高分求助:帮我修改一下这个汇编程序(程序在回答里面)···
程序是对的,但貌似出来的是长方体··我要做成立方体程序绘制的程序设计(要求由用户输入边长)希望帮我改改咯···在MF2KP上运行可加分的下面529703454回答的程序就...
程序是对的,但貌似出来的是长方体··
我要做成立方体程序绘制的程序设计(要求由用户输入边长)
希望帮我改改咯···在MF2KP上运行 可加分的
下面529703454回答的程序就是要改的程序···
或者高人帮我再写一个····
出来一定要是立方体··边长要能由用户输入 展开
我要做成立方体程序绘制的程序设计(要求由用户输入边长)
希望帮我改改咯···在MF2KP上运行 可加分的
下面529703454回答的程序就是要改的程序···
或者高人帮我再写一个····
出来一定要是立方体··边长要能由用户输入 展开
8个回答
展开全部
答cfc511: 立方体_百度百科
立方体,是由6个正方形面组成的正多面体,故又称正六面体。它有12条边和8个顶点。 应用[编辑本段] 日常生活 食盐和糖的结晶体都是立方状。 骰子最常见的形状就是立方体。
楼主绘图部分写的很好,无需修改,我再告诉你七个顶点便可。
汇编_绘制立方体程序
DATAS SEGMENT
mode dw 0
COLOR DW 02
BKCOLOR DW 15
POINT DW 200,200,400,200,160,300,360,300,160,400,360,400
DW 200,200,160,300,400,200,360,300,160,300,160,400
DW 360,300,360,400,400,320,400,200,400,320,360,400
DATAS ENDS
STACKS SEGMENT
DW 200 DUP(0)
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
mov dx,datas
mov ds,ax
mov ah,0fh
int 10h
mov ah,0
mov mode,ax;保存原显示模式
MOV AX,0012H
INT 10H ;设置640*480*16图形模式
jmp Q1
Tips DB 0dh,0ah,0dh,0ah,0dh,0ah,09h,09h,09h,09h,' DRAW A CUBE',0dh,0ah
DB 0dh,0ah,0dh,0ah,09h,09h,'Error Data ,Error Result!'
DB 0dh,0ah,0dh,0ah,09h,09h,'Input Length of Line(8-300) $'
Q1:push cs
pop ds
mov dx,offset Tips
mov ah,09
int 21h
xor di,di
mov bx,30ah
Q2:mov ah,0
int 16h
cmp al,0dh
jz Q3
cmp al,30h ;不接收,不显示0-9以外的数
jb Q2 ;加两条规矩
cmp al,39h
ja Q2
mov ah,0eh;显示数字0-9
int 10h
and al,0fh
cbw
mov dx,ax
mov ax,di
mul bl
mov di,dx
add di,ax
dec bh
jnz Q2
Q3:cmp di,4 ;最短
jb Q4
cmp di,320;最长
jb Q5 ;留一分宽容
Q4:mov ax,0e07h;输入数据不合法
int 10h ;显示长方体
jmp Q6 ;冥顽者错误伺候
nop
Q5:mov ax,datas
mov ds,ax
mov si,offset POINT;计算各顶点坐标
shr di,1
mov bp,di
shr bp,1
mov ax,320
sub ax,di
sub ax,bp
mov [si+08h],ax;存入数据段
mov [si+10h],ax
mov [si+1ch],ax
mov [si+30h],ax
mov [si+34h],ax
add ax,di
mov [si+00h],ax
mov [si+18h],ax
add ax,di
mov [si+0ch],ax
mov [si+14h],ax
mov [si+24h],ax
mov [si+2ch],ax
mov [si+38h],ax
mov [si+3ch],ax
add ax,di
mov [si+04h],ax
mov [si+20h],ax
mov [si+28h],ax
mov [si+40h],ax
mov [si+44h],ax
mov ax,240
sub ax,di
sub ax,bp
mov [si+02h],ax
mov [si+06h],ax
mov [si+1ah],ax
mov [si+22h],ax
mov [si+42h],ax
add ax,di
mov [si+0ah],ax
mov [si+0eh],ax
mov [si+1eh],ax
mov [si+26h],ax
mov [si+32h],ax
mov [si+3ah],ax
add ax,di
mov [si+2ah],ax
mov [si+46h],ax
add ax,di
mov [si+12h],ax
mov [si+16h],ax
mov [si+2eh],ax
mov [si+36h],ax
mov [si+3eh],ax
nop
Q6:MOV AX,DATAS
MOV DS,AX
MOV AX,0A000H
MOV ES,AX
MOV AL,2
CALL SET_WRITE_MODE
MOV AX,BKCOLOR
CALL CLEAR
MOV CX,9
MOV SI,OFFSET POINT
DDD: PUSH CX
PUSH SI
MOV AX,[SI]
PUSH AX
MOV AX,[SI+2]
PUSH AX
MOV AX,[SI+4]
PUSH AX
MOV AX,[SI+6]
PUSH AX
CALL LINE
POP SI
ADD SI,8
POP CX
LOOP DDD
mov ah,0
int 16h
mov ax,mode;恢复原显示模式
int 10h
MOV AX,4C00H
INT 21H
PIXEL:
PUSH BP
PUSH BX
PUSH CX
PUSH DS
MOV BP,SP
MOV AX,80
MOV BX,WORD PTR[BP+12] ;BX<=Y
MUL BX ;(DX:AX)<=80*Y
MOV BX,AX ;
MOV AX,WORD PTR[BP+14] ;AX<--X
MOV CL,8 ; | |
DIV CL ;AL<=商(X/8),AH<=余数(X%8) SP-> | |
MOV CL,AH ;CL<=AH | DS |<-BP
MOV AH,0 ; | CX |<-BP+2
ADD BX,AX ;BX(OFFSET)<=80*Y+X/8 | BX |<-BP+4
MOV AL,80H ; | BP |<-BP+6
SHR AL,CL ;AL(MASK)<=(80H>>CL) |返回地址|<-BP+8
PUSH AX ; | COLOR |<-BP+10
MOV DX,3CEH ; | Y |<-BP+12
MOV AL,8 ; | X |<-BP+14
OUT DX,AL ; | |
MOV DX,3CFH ; PIXEL堆栈结构
POP AX
OUT DX,AL
MOV AL,ES:[BX]
MOV AX,WORD PTR[BP+10] ;AX<=COLOR
MOV BYTE PTR ES:[BX],AL
POP DS
POP CX
POP BX
POP BP
RET 6
LINE:
PUSH BP
MOV BP,SP
SUB SP,16
MOV WORD PTR[BP-6],0 ;X=0
MOV WORD PTR[BP-8],0 ;Y=0
MOV WORD PTR[BP-14],1 ;INCX=1
MOV WORD PTR[BP-16],1 ;INCY=1
MOV AX,WORD PTR[BP+6] ;AX<=X2
SUB AX,WORD PTR[BP+10] ;AX<=X2-X1
JNC L1 ;IF X2>=X1,JMP L1
NEG AX ;IF X2<X1,DELTA_X=-DELTA_X
MOV WORD PTR[BP-14],-1 ;INCX<=-1
L1: CMP AX,0 ;IF DELTA_X!=0,JMP L11
JNE L11 ;
MOV WORD PTR[BP-14],0 ;INCX<=0
L11: MOV WORD PTR[BP-10],AX ;DELTA_X<=AX SP-> | |
MOV AX,WORD PTR[BP+4] ;AX<=Y2 | INCY |
SUB AX,WORD PTR[BP+8] ;AX<=Y2-Y1 | INCX |<-BP-14
JNC L2 ;IF Y2>=Y1,JMP L2 | DELTA_Y|<-BP-12
NEG AX ;IF Y2<Y1,DELTA_Y=-DELTA_Y | DELTA_X|<-BP-10
MOV WORD PTR[BP-16],-1 ;INCY<=-1 | Y |<-BP-8
L2: CMP AX,0 ;IF DELTA_Y!=0,JMP L22 | X |<-BP-6
JNE L22 ; |DISTANCE|<-BP-4
MOV WORD PTR[BP-16],0 ;INCY<=0 | T |<-BP-2
L22: MOV WORD PTR[BP-12],AX ;DELTA_Y<=AX | BP |<-BP
LP4: MOV AX,WORD PTR[BP-10] ;AX<=DELTA_X |返回地址|<-BP+2
CMP AX,WORD PTR[BP-12] ; | Y2 |<-BP+4
JG LP5 ;DELTA_X>DELTA_Y | X2 |<-BP+6
MOV AX,WORD PTR[BP-12] ; | Y1 |<-BP+8
MOV WORD PTR[BP-4],AX ;DISTANCE<=DELTA_Y | X1 |<-BP+10
JMP LP51 ; | |
LP5: MOV AX,WORD PTR[BP-10] ; LINE堆栈结构
MOV WORD PTR[BP-4],AX ;DISTANCE<=DELTA_X
LP51: INC AX
MOV WORD PTR[BP-2],AX
LP6: PUSH WORD PTR[BP+10]
PUSH WORD PTR[BP+8]
PUSH COLOR
CALL PIXEL
MOV AX,WORD PTR[BP-6] ;AX<=X
ADD AX,WORD PTR[BP-10] ;AX<=X+DELTA_X
MOV WORD PTR[BP-6],AX ;X=X+DELTA_X
MOV AX,WORD PTR[BP-8] ;AX<=Y
ADD AX,WORD PTR[BP-12] ;AX<=Y+DELTA_Y
MOV WORD PTR[BP-8],AX ;Y=Y+DELTA_Y
MOV AX,WORD PTR[BP-6] ;AX<=X
CMP AX,WORD PTR[BP-4]
JLE LP7 ;IF X<=DISTANCE,JMP LP7
MOV AX,WORD PTR[BP-6] ;X>DISTANCE
SUB AX,WORD PTR[BP-4] ;AX<=X-DISTANCE
MOV WORD PTR[BP-6],AX ;X=X-DISTANCE
MOV AX,WORD PTR[BP+10] ;AX<=X1
ADD AX,WORD PTR[BP-14] ;AX<=X1+INCX
MOV WORD PTR[BP+10],AX ;X1=X1+INCX
LP7: MOV AX,WORD PTR[BP-8] ;AX<=Y
CMP AX,WORD PTR[BP-4]
JLE LP8 ;IF Y<=DISTANCE,JMP LP8
MOV AX,WORD PTR[BP-8] ;Y>DISTANCE
SUB AX,WORD PTR[BP-4] ;AX<=Y-DISTANCE
MOV WORD PTR[BP-8],AX ;Y=Y-DISTANCE
MOV AX,WORD PTR[BP+8] ;AX<=Y1
ADD AX,WORD PTR[BP-16] ;AX<=Y1+INCY
MOV WORD PTR[BP+8],AX ;Y1=Y1+INCY
LP8: DEC WORD PTR[BP-2] ;IF T!=0,JMP LP6
jnz LP6
LP9: MOV SP,BP
POP BP
RET 8
SET_WRITE_MODE:
PUSH AX
MOV DX,3CEH
MOV AL,5
OUT DX,AL
MOV DX,3CFH
POP AX
OUT DX,AL
MOV DX,3CEH
MOV AL,8
OUT DX,AL
MOV DX,3CFH
MOV AL,0FFH
OUT DX,AL
RET
CLEAR:MOV BX,0
CLR1: MOV ES:[BX],AL
INC BX
CMP BX,80*480
jb CLR1
RET
CODES ENDS
END START
立方体,是由6个正方形面组成的正多面体,故又称正六面体。它有12条边和8个顶点。 应用[编辑本段] 日常生活 食盐和糖的结晶体都是立方状。 骰子最常见的形状就是立方体。
楼主绘图部分写的很好,无需修改,我再告诉你七个顶点便可。
汇编_绘制立方体程序
DATAS SEGMENT
mode dw 0
COLOR DW 02
BKCOLOR DW 15
POINT DW 200,200,400,200,160,300,360,300,160,400,360,400
DW 200,200,160,300,400,200,360,300,160,300,160,400
DW 360,300,360,400,400,320,400,200,400,320,360,400
DATAS ENDS
STACKS SEGMENT
DW 200 DUP(0)
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
mov dx,datas
mov ds,ax
mov ah,0fh
int 10h
mov ah,0
mov mode,ax;保存原显示模式
MOV AX,0012H
INT 10H ;设置640*480*16图形模式
jmp Q1
Tips DB 0dh,0ah,0dh,0ah,0dh,0ah,09h,09h,09h,09h,' DRAW A CUBE',0dh,0ah
DB 0dh,0ah,0dh,0ah,09h,09h,'Error Data ,Error Result!'
DB 0dh,0ah,0dh,0ah,09h,09h,'Input Length of Line(8-300) $'
Q1:push cs
pop ds
mov dx,offset Tips
mov ah,09
int 21h
xor di,di
mov bx,30ah
Q2:mov ah,0
int 16h
cmp al,0dh
jz Q3
cmp al,30h ;不接收,不显示0-9以外的数
jb Q2 ;加两条规矩
cmp al,39h
ja Q2
mov ah,0eh;显示数字0-9
int 10h
and al,0fh
cbw
mov dx,ax
mov ax,di
mul bl
mov di,dx
add di,ax
dec bh
jnz Q2
Q3:cmp di,4 ;最短
jb Q4
cmp di,320;最长
jb Q5 ;留一分宽容
Q4:mov ax,0e07h;输入数据不合法
int 10h ;显示长方体
jmp Q6 ;冥顽者错误伺候
nop
Q5:mov ax,datas
mov ds,ax
mov si,offset POINT;计算各顶点坐标
shr di,1
mov bp,di
shr bp,1
mov ax,320
sub ax,di
sub ax,bp
mov [si+08h],ax;存入数据段
mov [si+10h],ax
mov [si+1ch],ax
mov [si+30h],ax
mov [si+34h],ax
add ax,di
mov [si+00h],ax
mov [si+18h],ax
add ax,di
mov [si+0ch],ax
mov [si+14h],ax
mov [si+24h],ax
mov [si+2ch],ax
mov [si+38h],ax
mov [si+3ch],ax
add ax,di
mov [si+04h],ax
mov [si+20h],ax
mov [si+28h],ax
mov [si+40h],ax
mov [si+44h],ax
mov ax,240
sub ax,di
sub ax,bp
mov [si+02h],ax
mov [si+06h],ax
mov [si+1ah],ax
mov [si+22h],ax
mov [si+42h],ax
add ax,di
mov [si+0ah],ax
mov [si+0eh],ax
mov [si+1eh],ax
mov [si+26h],ax
mov [si+32h],ax
mov [si+3ah],ax
add ax,di
mov [si+2ah],ax
mov [si+46h],ax
add ax,di
mov [si+12h],ax
mov [si+16h],ax
mov [si+2eh],ax
mov [si+36h],ax
mov [si+3eh],ax
nop
Q6:MOV AX,DATAS
MOV DS,AX
MOV AX,0A000H
MOV ES,AX
MOV AL,2
CALL SET_WRITE_MODE
MOV AX,BKCOLOR
CALL CLEAR
MOV CX,9
MOV SI,OFFSET POINT
DDD: PUSH CX
PUSH SI
MOV AX,[SI]
PUSH AX
MOV AX,[SI+2]
PUSH AX
MOV AX,[SI+4]
PUSH AX
MOV AX,[SI+6]
PUSH AX
CALL LINE
POP SI
ADD SI,8
POP CX
LOOP DDD
mov ah,0
int 16h
mov ax,mode;恢复原显示模式
int 10h
MOV AX,4C00H
INT 21H
PIXEL:
PUSH BP
PUSH BX
PUSH CX
PUSH DS
MOV BP,SP
MOV AX,80
MOV BX,WORD PTR[BP+12] ;BX<=Y
MUL BX ;(DX:AX)<=80*Y
MOV BX,AX ;
MOV AX,WORD PTR[BP+14] ;AX<--X
MOV CL,8 ; | |
DIV CL ;AL<=商(X/8),AH<=余数(X%8) SP-> | |
MOV CL,AH ;CL<=AH | DS |<-BP
MOV AH,0 ; | CX |<-BP+2
ADD BX,AX ;BX(OFFSET)<=80*Y+X/8 | BX |<-BP+4
MOV AL,80H ; | BP |<-BP+6
SHR AL,CL ;AL(MASK)<=(80H>>CL) |返回地址|<-BP+8
PUSH AX ; | COLOR |<-BP+10
MOV DX,3CEH ; | Y |<-BP+12
MOV AL,8 ; | X |<-BP+14
OUT DX,AL ; | |
MOV DX,3CFH ; PIXEL堆栈结构
POP AX
OUT DX,AL
MOV AL,ES:[BX]
MOV AX,WORD PTR[BP+10] ;AX<=COLOR
MOV BYTE PTR ES:[BX],AL
POP DS
POP CX
POP BX
POP BP
RET 6
LINE:
PUSH BP
MOV BP,SP
SUB SP,16
MOV WORD PTR[BP-6],0 ;X=0
MOV WORD PTR[BP-8],0 ;Y=0
MOV WORD PTR[BP-14],1 ;INCX=1
MOV WORD PTR[BP-16],1 ;INCY=1
MOV AX,WORD PTR[BP+6] ;AX<=X2
SUB AX,WORD PTR[BP+10] ;AX<=X2-X1
JNC L1 ;IF X2>=X1,JMP L1
NEG AX ;IF X2<X1,DELTA_X=-DELTA_X
MOV WORD PTR[BP-14],-1 ;INCX<=-1
L1: CMP AX,0 ;IF DELTA_X!=0,JMP L11
JNE L11 ;
MOV WORD PTR[BP-14],0 ;INCX<=0
L11: MOV WORD PTR[BP-10],AX ;DELTA_X<=AX SP-> | |
MOV AX,WORD PTR[BP+4] ;AX<=Y2 | INCY |
SUB AX,WORD PTR[BP+8] ;AX<=Y2-Y1 | INCX |<-BP-14
JNC L2 ;IF Y2>=Y1,JMP L2 | DELTA_Y|<-BP-12
NEG AX ;IF Y2<Y1,DELTA_Y=-DELTA_Y | DELTA_X|<-BP-10
MOV WORD PTR[BP-16],-1 ;INCY<=-1 | Y |<-BP-8
L2: CMP AX,0 ;IF DELTA_Y!=0,JMP L22 | X |<-BP-6
JNE L22 ; |DISTANCE|<-BP-4
MOV WORD PTR[BP-16],0 ;INCY<=0 | T |<-BP-2
L22: MOV WORD PTR[BP-12],AX ;DELTA_Y<=AX | BP |<-BP
LP4: MOV AX,WORD PTR[BP-10] ;AX<=DELTA_X |返回地址|<-BP+2
CMP AX,WORD PTR[BP-12] ; | Y2 |<-BP+4
JG LP5 ;DELTA_X>DELTA_Y | X2 |<-BP+6
MOV AX,WORD PTR[BP-12] ; | Y1 |<-BP+8
MOV WORD PTR[BP-4],AX ;DISTANCE<=DELTA_Y | X1 |<-BP+10
JMP LP51 ; | |
LP5: MOV AX,WORD PTR[BP-10] ; LINE堆栈结构
MOV WORD PTR[BP-4],AX ;DISTANCE<=DELTA_X
LP51: INC AX
MOV WORD PTR[BP-2],AX
LP6: PUSH WORD PTR[BP+10]
PUSH WORD PTR[BP+8]
PUSH COLOR
CALL PIXEL
MOV AX,WORD PTR[BP-6] ;AX<=X
ADD AX,WORD PTR[BP-10] ;AX<=X+DELTA_X
MOV WORD PTR[BP-6],AX ;X=X+DELTA_X
MOV AX,WORD PTR[BP-8] ;AX<=Y
ADD AX,WORD PTR[BP-12] ;AX<=Y+DELTA_Y
MOV WORD PTR[BP-8],AX ;Y=Y+DELTA_Y
MOV AX,WORD PTR[BP-6] ;AX<=X
CMP AX,WORD PTR[BP-4]
JLE LP7 ;IF X<=DISTANCE,JMP LP7
MOV AX,WORD PTR[BP-6] ;X>DISTANCE
SUB AX,WORD PTR[BP-4] ;AX<=X-DISTANCE
MOV WORD PTR[BP-6],AX ;X=X-DISTANCE
MOV AX,WORD PTR[BP+10] ;AX<=X1
ADD AX,WORD PTR[BP-14] ;AX<=X1+INCX
MOV WORD PTR[BP+10],AX ;X1=X1+INCX
LP7: MOV AX,WORD PTR[BP-8] ;AX<=Y
CMP AX,WORD PTR[BP-4]
JLE LP8 ;IF Y<=DISTANCE,JMP LP8
MOV AX,WORD PTR[BP-8] ;Y>DISTANCE
SUB AX,WORD PTR[BP-4] ;AX<=Y-DISTANCE
MOV WORD PTR[BP-8],AX ;Y=Y-DISTANCE
MOV AX,WORD PTR[BP+8] ;AX<=Y1
ADD AX,WORD PTR[BP-16] ;AX<=Y1+INCY
MOV WORD PTR[BP+8],AX ;Y1=Y1+INCY
LP8: DEC WORD PTR[BP-2] ;IF T!=0,JMP LP6
jnz LP6
LP9: MOV SP,BP
POP BP
RET 8
SET_WRITE_MODE:
PUSH AX
MOV DX,3CEH
MOV AL,5
OUT DX,AL
MOV DX,3CFH
POP AX
OUT DX,AL
MOV DX,3CEH
MOV AL,8
OUT DX,AL
MOV DX,3CFH
MOV AL,0FFH
OUT DX,AL
RET
CLEAR:MOV BX,0
CLR1: MOV ES:[BX],AL
INC BX
CMP BX,80*480
jb CLR1
RET
CODES ENDS
END START
展开全部
留下浓浓的气味。
这分不到我赚,对绘图不熟悉。
这分不到我赚,对绘图不熟悉。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
http://files.cnblogs.com/norx/OMNI.rar
楼主可以参照下这个程序,你的程序就绝对明白了 。。。
楼主可以参照下这个程序,你的程序就绝对明白了 。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
长方体?是什么啊 ?
长方形?把你长方体的具体 形状介绍一下
长方形?把你长方体的具体 形状介绍一下
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
着什么程序啊,我看不懂
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询