Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Code Segment
- assume CS:Code, DS:Data, SS:Stack
- Start:
- mov ax, Code
- mov DS, AX
- ; Starting coordinate set
- mov dl,100
- mov dh,100
- push dx
- mov ax, 13h
- int 10h
- mov ax, 0a000h
- mov es, ax
- mov cl,128
- Draw:
- pop dx
- xor ah,ah
- mov al,dh
- push dx
- mov bx,320
- mul bx
- pop dx
- add al,dl
- jnc Pixel
- inc ah
- Pixel:
- push dx ; exact pixel coordinate
- mov di,ax
- inc cl
- mov es:[di],cl
- Waitfor:
- xor ah,ah
- int 16h
- cmp al,27
- jz Program_Vege
- ; Was the pressed key a movement one?
- cmp ah,75
- jz Lefter
- cmp ah,77
- jz Righter
- cmp ah,72
- jz Upper
- cmp ah,80
- jz Downer
- jmp Waitfor
- ; we change the dl (x) of dh (y) corordinate according to the pressed key (inc and dec 1 and -1)
- Lefter:
- pop dx
- dec dl
- cmp dl,1
- jnc Keeper
- inc dl
- Righter:
- pop dx
- inc dl
- cmp dl,250
- jc Keeper
- dec dl
- Upper:
- pop dx
- dec dh
- cmp dh,1
- jnc Keeper
- inc dh
- Downer:
- pop dx
- inc dh
- cmp dh,200
- jc Keeper
- dec dh
- Keeper: ; and we save the new coordinate, yay!
- push dx
- jmp Draw
- Program_Vege:
- mov ax,03h
- int 10h
- pop dx
- mov ax, 4c00h
- int 21h
- Code Ends
- Data Segment
- Data Ends
- Stack Segment
- Stack Ends
- End Start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement