.model small .586 .stack 100h .data row db 12 ;;initially at row 12 col db 40 ;;initially at col 40 .code extern Clrscr:proc main proc mov ax,@data mov ds,ax call Clrscr ;clear screen call setcur ; set cursor at row/col lp1: mov ah,7 int 21h ; get character with no echo cmp al,'w' jne skip1 dec row ; move up jmp domove skip1: cmp al,'s' jne skip2 inc row ; move down jmp domove skip2: cmp al,'a' jne skip3 dec col ; move left jmp domove skip3: cmp al,'d' jne skip4 inc col ; move right skip4: cmp al,20h ;space = exit je doexit domove: call setcur ; set cursor at new position jmp lp1 doexit: Mov ax, 4c00h Int 21h Main endp setcur proc mov ah,2 ;use BIOS 10h to set cursor mov dh,row ; row position mov dl,col ; column position mov bh,0 int 10h ret setcur endp end main