.model small .stack 256h .386 video equ 0b800h ;----------------------------------- ; STANDARD 4-bit COLOR DEFINITIONS ;----------------------------------- black = 0 blue = 00010001b green = 00100010b cyan = 00110011b red = 01000100b magenta = 01010101b brown = 01100110b lightGray = 01110111b gray = 10000111b lightBlue = 10011001b lightGreen = 10101010b lightCyan = 10111011b lightRed = 11001100b lightMagenta = 11011101b yellow = 11101110b white = 11111111b ESCKEY =27 spacebar =32 .data save_di word ? incr word 1 bullet word 0 bpos word 5 dup (0) .code start proc near mov ax, @data mov ds, ax mov ax, video mov es, ax mov ax, 4 int 10h ;sets at medium resolution mov ah, 0ch int 21h xor si, si xor dx, dx call paint_back;;; paint the entire screen green mov di, 4 ;to begin the figure at the first even line redraw: mov save_di,di call drawalien;;draws alien in magenta and black mov ah,11h ; key pressed already? int 16h jz L2 ; no, continue the loop mov ah,10h ; remove key from buffer int 16h cmp al,ESCkey ; yes. Is it the ESC key? cmp al,spacebar je dosret ; yes, quit the program L2: mov cx,100 again: call slow loop again call paint_over ;;redo background just in the spot alien was drawn mov di,save_di add di,incr ;cmp di,10 ;jle cont ;cmp di,4 ;jge cont ;neg incr cont: jmp redraw dosRet: mov ax, 2 int 10h mov ax, 4c00h int 21h start endp slow proc pusha mov cx,32000 slow1: pusha popa loop slow1 popa ret slow endp paint_back proc xor di, di ;start di at first even line mov cx,1f40h mov al, 0aah rep stosb mov di, 2000h mov cx,1f40h rep stosb ret paint_back endp drawalien proc mov al,magenta mov di,save_di ;restore the starting position mov cx, 1 rep stosb ;second even line add di, 78 mov cx, 3 rep stosb add di, 76 ;third even line stosb mov al,black stosb mov al,magenta stosb mov al,black stosb mov al,magenta stosb add di, 75 ;fourth even line mov cx, 5 rep stosb add di, 76 mov al,black mov cx, 3 rep stosb mov al,magenta add di, 77 mov cx, 3 rep stosb mov di,save_di add di, 2000h ;first odd line mov cx, 1 rep stosb add di, 78 ;second odd line mov cx, 3 rep stosb add di, 76 ;third odd line mov cx, 1 stosb mov al,black stosb mov al,magenta stosb mov al,black stosb mov al,magenta stosb add di, 75 ;4th odd line mov cx, 5 rep stosb add di, 76 mov cx, 3 mov al,black rep stosb add di, 77 mov al,magenta mov cx, 3 rep stosb ret drawalien endp paint_over proc mov al, 0aah mov di,save_di ;restore the starting position mov cx, 1 rep stosb ;second even line add di, 78 mov cx, 3 rep stosb add di, 76 ;third even line stosb ;mov al,black stosb ;mov al,magenta stosb ;mov al,black stosb ;mov al,magenta stosb add di, 75 ;fourth even line mov cx, 5 rep stosb add di, 76 ;mov al,black mov cx, 3 rep stosb ;mov al,magenta add di, 77 mov cx, 3 rep stosb mov di,save_di add di, 2000h ;first odd line mov cx, 1 rep stosb add di, 78 ;second odd line mov cx, 3 rep stosb add di, 76 ;third odd line mov cx, 1 stosb ;mov al,black stosb ;mov al,magenta stosb ;mov al,black stosb ;mov al,magenta stosb add di, 75 ;4th odd line mov cx, 5 rep stosb add di, 76 mov cx, 3 ;mov al,black rep stosb add di, 77 ;mov al,magenta mov cx, 3 rep stosb ret paint_over endp end start