Saturday, February 19, 2011

Cursor operations-Change size and Move

Share Orkut
print macro msg lea dx,msg mov ah,09h int 21h endm .model small .stack 100h .data msg1 db 10,13,'Press 1 to increase and 0 to decrease
     the size of cursor (only 4 sizes, initially minimum) $'
msg2 db 10,13,'Press 8,2,4 and 6 to move the cursor
     up,down,left and right respectively $'
msg3 db 10,13,'Press ENTER to finish $' .code main proc mov ax,@data mov ds,ax mov cl,8 mov ch,8 ;clear screen mov ah,0 mov al,03 int 10h print msg1 print msg2 print msg3 loop1:; wait key press: xor ax, ax int 16h cmp al,0dh je exit cmp al,31h je incr cmp al,30h je decr cmp al,38h je up cmp al,32h je down cmp al,36h je right cmp al,34h jne loop1 call getcursor dec dl call putcursor jmp loop1 up: call getcursor dec dh call putcursor jmp loop1 down:call getcursor inc dh call putcursor jmp loop1 right:call getcursor inc dl call putcursor jmp loop1 decr:cmp ch,08 je loop1 rol ch,1 call chgcursor jmp loop1 incr:cmp ch,01 je loop1 ror ch,1 call chgcursor jmp loop1 exit:mov ah,4ch int 21h main endp chgcursor proc ;change cursor size mov ah, 1 int 10h ret chgcursor endp getcursor proc ;get cursor position and size mov ah,03h int 10h ret getcursor endp putcursor proc ;show the cursor mov ah,02h int 10h ret putcursor endp end

2 comments:

  1. Won't the value of AX be reset to 0 if XOR is performed? Shouldn't you push and pop it?

    xor ax, ax
    int 16h
    cmp al,0dh

    Also why use 16h instead of 21h?

    Thanks in advance.

    ReplyDelete
  2. 4x8 sheet metal prices near me - Titanium-Arts
    1st of March 2021 titanium sunglasses at 11:12 babyliss pro nano titanium straightener AM | titanium coating Posted titanium 3d printing on apple watch series 6 titanium the 3rd of April 2021 at 12:30 AM.

    ReplyDelete