标签:
汇编版圣诞树
先附上截图:
汇编代码如下:
1 dseg segment 2 x_label dw ? ;每层空格数 3 y_label dw ? ;每层高度 4 axis equ 30 5 dseg ends 6 cseg segment 7 assume cs:cseg , ds:dseg 8 start: 9 mov ah , 0 ;设置图形显示模式4 10 mov al , 04h 11 int 10h 12 13 mov al , 04 ;color 14 15 mov dx , 60 ;y 16 mov y_label , 30 17 mov x_label , 30 18 floor: 19 cmp y_label , 0 20 je exit 21 mov x_label , 30 22 sub y_label , 10 23 add al , 1 ;每层变换颜色 24 inc dx 25 column: 26 mov cx , x_label ;x 27 inc dx 28 mov bx , axis ;圣诞树轴线 29 sub bx , x_label 30 add bx , bx ;圣诞树每层宽度 31 add bx , cx 32 row: 33 mov ah , 0ch ;0c号子功能 34 int 10h 35 inc cx 36 cmp cx , bx 37 jbe row 38 39 push bx 40 mov bx , y_label 41 dec x_label 42 cmp x_label , bx 43 jge column 44 jb floor 45 46 exit: 47 mov al , 05 48 mov cx , axis ;树根 49 mov bx , 26 50 next: 51 inc dx 52 mov ah , 0ch ;0c号子功能 53 int 10h 54 dec bx 55 jnz next 56 57 mov ax , 4c00h 58 int 21h 59 60 cseg ends 61 end start
标签:
原文地址:http://www.cnblogs.com/Karma-wjc/p/4198393.html