汇编画圆
汇编画圆-->效果如下图
代码如下:
1 dseg segment 2 center_x dw 150 ;原点坐标_x 3 center_y dw 90 ;原点坐标_y 4 radius dw 50 ;半径_r 5 label_x dw ? ;外接正方形右边界 6 label_y dw ? ;外接正方形下边界 7 distance dw ? 8 dseg ends 9 cseg segment 10 assume cs:cseg , ds:dseg 11 start: 12 mov ax , dseg ;装载ds段 13 mov ds , ax 14 15 mov ah , 0 ;设置图形显示模式4 16 mov al , 04h 17 int 10h 18 19 mov ax , center_x 20 add ax , radius 21 mov label_x , ax 22 mov ax , center_y 23 add ax , radius 24 mov label_y , ax 25 mov ax , radius 26 mul ax 27 mov distance , ax 28 29 mov dx , center_y ;mov dx , [0002] 30 sub dx , radius 31 dec dx ;增加一行余量 32 33 row: 34 inc dx 35 cmp dx , label_y 36 ja exit 37 mov cx , center_x 38 sub cx , radius 39 column: 40 cmp cx , label_x 41 ja row 42 43 push dx 44 mov ax , dx 45 sub ax , center_y 46 imul ax 47 48 mov bx , ax 49 50 mov ax , cx 51 sub ax , center_x 52 imul ax 53 54 pop dx 55 add ax , bx 56 cmp ax , distance 57 ja next 58 mov al , 02 ;color 59 mov ah , 0ch ;0c号子功能 60 int 10h 61 next: 62 inc cx 63 jmp column 64 65 exit: 66 mov ax , 4c00h 67 int 21h 68 69 cseg ends 70 end start