首页 > 代码库 > 汇编画圆

汇编画圆

汇编画圆-->效果如下图

技术分享

代码如下:

 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 segment10       assume cs:cseg , ds:dseg11 start:       12       mov ax , dseg               ;装载ds段13       mov ds , ax14 15       mov ah , 0                  ;设置图形显示模式416       mov al , 04h            17       int 10h18       19       mov ax , center_x20       add ax , radius21       mov label_x , ax22       mov ax , center_y23       add ax , radius24       mov label_y , ax25       mov ax , radius26       mul ax27       mov distance , ax28       29       mov dx , center_y        ;mov dx , [0002]30       sub dx , radius31       dec dx                   ;增加一行余量32 33 row:34       inc dx35       cmp dx , label_y36       ja  exit37       mov cx , center_x38       sub cx , radius39 column:40       cmp cx , label_x41       ja  row42       43       push dx44       mov ax , dx45       sub ax , center_y46       imul ax47       48       mov bx , ax49       50       mov ax , cx51       sub ax , center_x52       imul ax53       54       pop dx55       add ax , bx56       cmp ax , distance57       ja  next58       mov al , 02              ;color59       mov ah , 0ch             ;0c号子功能        60       int 10h61 next:62       inc cx63       jmp column      64       65 exit:66       mov ax , 4c00h                  67       int 21h 68 69 cseg ends70 end  start

 

汇编画圆