home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.os.development      Operating system development chatter      4,255 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 3,918 of 4,255   
   Robert Pengelly to wolfgang kern   
   Re: COM1 interrupt for 16-bit OS   
   12 Nov 23 16:39:45   
   
   From: robertapengelly@gmail.com   
      
   On Monday, 13 November 2023 at 00:31:02 UTC, wolfgang kern wrote:   
   > On 13/11/2023 01:01, Robert Pengelly wrote:   
   > > On Sunday, 12 November 2023 at 23:55:27 UTC, wolfgang kern wrote:   
   > >> On 12/11/2023 23:14, Robert Pengelly wrote:   
   > >> ...   
   > >>> Also, how do I scale down a number in assembly?   
   > >> SHR 3 ;aka divide by 8   
   > >> SHR 4 ;aka divide by 16   
   > >> both rounds down, but who cares?   
   > >>   
   > >> odd divide values can perform with a combination of SHR and MUL or even   
   > >> with the famous awful slow DIV instruction.   
   > >>   
   > >> __   
   > >> wolfgang   
   > > So I was doing it right. I have:   
   > >   
   > > xor ax, ax   
   > > xor dx, dx   
   > > xor cx, cx   
   > >   
   > > mov al, [buffer]   
   > > and al, HEX (0C)   
   > >   
   > > mov dl, [buffer]   
   > > and dl, HEX (03)   
   > >   
   > > mov cl, 4   
   > > shl ax, cl   
   > >   
   > > mov cl, 6   
   > > shl dx, cl   
   > >   
   > > mov cl, [bx + 2]   
   > > or ax, cx   
   > > add ax, [mouse_y]   
   > >   
   > > mov cl, 4   
   > > shr ax, cl   
   > >   
   > > mov cl, [bx + 1]   
   > > or dx, cx   
   > > add dx, [mouse_x]   
   > >   
   > > mov cl, 3   
   > > shr dx, cl   
   > >   
   > > mov [mouse_x], dx   
   > > mov [mouse_y], ax   
   > >   
   > > but I'm getting weird results, am I shifting in the right place?   
   > I'd keep mouse positions stored in pixels and only scale down for cursor   
   > updates.   
   > __   
   > wolfgang   
   The following code gives weird results as well:   
      
   timer_handler:   
      
       mov     bx,     cs:[mouse_x]   
       shr     bx   
       shr     bx   
       shr     bx   
      
       mov     cx,     cs:[mouse_y]   
       shr     cx   
       shr     cx   
       shr     cx   
       shr     cx   
      
   timer_handler.move:   
      
       mov     ah,     HEX (02)   
       xor     bh,     bh   
       mov     dh,     cl   
       mov     dl,     bl   
       int     HEX (10)   
      
   I've removed the shifts from the irq handler but the cursor is dodgy.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca