include irvine16.inc .data snakestart word ? forecolor byte 0ffh;;white backcolor byte 01010101b;;bluegreen snakelen = 14 Video equ 0b800h .code start proc mov ax, @data mov ds, ax mov ax, Video mov es, ax cld ;;;forward ;set to medium resolution mov ax, 4 int 10h background: mov di, 07D0h mov cx, 6000 mov al, backcolor rep stosb mov di, 27D0h mov cx, 6000 rep stosb mov snakestart, 1C20h ;;;horizontal snake mov ecx,30 top: movzx edi, snakestart mov al,forecolor ;;;white call draw_snake_horiz mov eax, 1000 call delay mov al,backcolor movzx edi, snakestart call draw_snake_horiz ; mov eax, 10000 ;call delay inc snakestart loop top ;;;;vertical snake add snakestart, snakelen mov ecx,30 top2: movzx edi, snakestart mov al,forecolor ;;;white call draw_snake_vert mov eax, 1000 call delay mov al,backcolor movzx edi, snakestart call draw_snake_vert ; mov eax, 10000 ;call delay sub snakestart, 80 loop top2 mov ah, 1 int 21h mov ax, 2 int 10h mov ax, 4c00h int 21h start endp draw_snake_horiz proc uses ecx edi ;draw even lines (bottom) push edi mov ecx, 14 rep stosb pop edi push edi add edi,80 mov ecx, 14 rep stosb ;draw odd lines (bottom) pop edi add edi, 2000h push edi mov ecx, 14 rep stosb pop edi add edi,80 mov ecx, 14 rep stosb ret draw_snake_horiz endp draw_snake_vert proc uses ecx edi ;draw even lines (bottom) ;;do 14X mov ecx, 14 push edi even_vert: push edi stosb ;stosb pop edi sub edi,80 loop even_vert ;draw odd lines (bottom) pop edi add edi, 2000h ;;do 14X mov ecx, 14 odd_vert: push edi ; stosb stosb pop edi sub edi,80 loop odd_vert ret draw_snake_vert endp end start