利用修改显示页面功能实现动画

; masm main.asm;

; link main;

 

 

STACK SEGMENT PARA STACK
 DB 256 DUP (0)
STACK ENDS

DATA SEGMENT PUBLIC
 point dw 0b800h
 COLOR DB 11011000B
 MASKS DB 11000000b
       DB 00110000B
       DB 00001100B
       DB 00000011B
 COUNT DW 24
 COORD DB 103
       DW 154
       DB 103
       DW 155
       DB 103
       DW 156
       DB 103
       DW 157
       DB 103
       DW 158
       DB 103
       DW 159
       DB 103
       DW 160
       DB 103
       DW 161
       DB 103
       DW 162
       DB 103
       DW 163
       DB 103
       DW 164
       DB 103
       DW 165
       DB 103
       DW 166
       DB 102
       DW 155
       DB 101
       DW 165
       DB 101
       DW 156
       DB 101
       DW 164
       DB 100
       DW 157
       DB 100
       DW 163
       DB 99
       DW 158
       DB 99
       DW 162
       DB 98
       DW 159
       DB 98
       DW 161
       DB 97
       DW 160
EIGHTY DB 80
DATA ENDS
CODE SEGMENT PUBLIC
 START PROC FAR
   ASSUME CS:CODE, DS:DATA , SS:STACK
     PUSH DS
     MOV AX,0
     PUSH AX
     MOV AX,DATA;
     MOV DS,AX
     MOV Ax,4
     INT 10H
     mov dx,3d4h
     MOV DX,3D9H
     MOV AL,09H
     OUT DX,AL
     mov bx,point
     call chgdm
     MOV AX,0b8feh
     MOV ES,AX
     MOV CX,COUNT
     MOV BX,OFFSET COORD
MAIN:MOV AL,[BX]
     INC BX
     MOV DX,[BX]
     ADD BX,2
     CALL DRAW
     LOOP MAIN
move:mov cx,0dh
     mov dx,3300h
     mov ah,86h
     int 15h
     add point,010h
     cmp point,0bb30h
     je exit
     mov bx,point
     call chgdm;
     jmp move
exit:mov cx,3dh
     mov dx,3300h
     mov ah,86h
     int 15h
     mov ax,2
     int 10h
     ret
 start endp
 DRAW PROC NEAR
     SHR AL,1
     JC ODD
     MOV DI,0
     JMP SHORT COMMON
 ODD:MOV DI,2000H
COMMON:MUL EIGHTY
     ADD DI,AX
     MOV SI,DX
     SHR DX,1
     SHR DX,1
     ADD DI,DX
     AND SI,03H
     MOV AL,[MASKS+SI]
     MOV DH,COLOR
     AND DH,AL
     not al
     mov ah,es:[di]
     and ah,al
     OR AH,DH
     MOV ES:[DI],AH
     RET
 DRAW ENDP
 chgdm proc near ;DM segment in bx
     push dx
     push ax
     mov dx,3d4h
     mov al,12
     out dx,al
     inc dx
     mov ah,bh
     out dx,al
     dec dx
     mov al,13
     out dx,al
     inc dx
     mov al,bl
     out dx,al
     pop ax
     pop dx
     ret
 chgdm endp
CODE ENDS
   END START
 

你可能感兴趣的:(动画,汇编)