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,909 of 4,255   
   Robert Pengelly to Robert Pengelly   
   Re: COM1 interrupt for 16-bit OS   
   12 Nov 23 12:31:31   
   
   From: robertapengelly@gmail.com   
      
   On Sunday, 12 November 2023 at 19:13:16 UTC, Robert Pengelly wrote:   
   > On Sunday, 12 November 2023 at 19:04:55 UTC, Robert Pengelly wrote:    
   > > On Sunday, 12 November 2023 at 15:18:45 UTC, wolfgang kern wrote:    
   > > > On 12/11/2023 15:34, Robert Pengelly wrote:    
   > > > ...    
   > > > >>>> the mouse sends a sequence of bytes where every byte causes in IRQ.    
   > > > >>>> so you first need to fill a buffer with the gotten bytes before you   
   can    
   > > > >>>> calculate/scale/interpret the values. mouse IRQs can easy come out   
   of    
   > > > >>>> sync, so checking always for the first byte mark is a good idea.    
   > > > >>> Oh I thought you had to get them all at the same time when the   
   interrupt was fired. As for filling the buffer how would I tell the interrupts   
   apart? I can test for 0x40 and 0x01 (which I'm already doing) I'm just a   
   little confused how I would    
   know whether it's the 1st, 2nd and 3rd bytes.    
   > > > >> there is a mark for the first byte (reread the RBIL I posted)    
   > > > >> I use one variable for count down (easier than count up) and use this    
   > > > >> with BX as an index into my buffer.    
   > > > >> and when the buffer is filled I adjust all my mouse-variables which I    
   > > > >> later use on my mSec timer-base schedule to update cursor and act on    
   > > > >> buttons.    
   > > > > Yeah, there's bit 6 for the initial bit, I weren't sure if there's   
   anything identifying the others. So basically have two variables one being a   
   counter and just write to the buffer until I get three (or if it's counting   
   down then it would be    
   until I hit zero)?    
   > > > yes.    
   > > > As for:    
   > > > >> I use one variable for count down (easier than count up) and use this    
   > > > >> with BX as an index into my buffer.    
   > > >    
   > > > > How do you use it for the buffer if your counting down? If you were   
   counting up you could shl by 8 and add that to the buffer offset.    
   > > > no shift required here at all:    
   > > >    
   > > > push ...ds,ax,bx,cx,dx    
   > > > ... ds become ptr to my data    
   > > > IN AL,port    
   > > > TEST AL,0x40    
   > > > jz skip_init    
   > > > xor bx,bx    
   > > > MOV CX,3 ;(or eight in my case)    
   > > > MOV [count],cl    
   > > > MOV [index].bx    
   > > > skip_init:    
   > > > MOV BX,[index]    
   > > > MOV [BX+buffer],AL    
   > > > INC word[index] ;or: INC BX |MOV [index],BX    
   > > > DEC byte[count]    
   > > > pop ... dx,cx,bx    
   > > > MOV AL,0x20    
   > > > out 0xA0,AL    
   > > > jnz done_it    
   > > > got_all:    
   > > > ;store/modify, update only variables, actions are done in idle queue.    
   > > > done_it:    
   > > > pop ax    
   > > > pop ds    
   > > > iret    
   > > > __    
   > > > wolfgang    
   > > Ahh you have 3 variables instead of 2, right I think I understand. What   
   should I do about the buffer though? Like should I get them in say a 1Ch   
   handler to move the cursor in there?   
   > That should have been "What should I do about the values though?" Like   
   should I parse the buffer in say 1Ch and move the cursor in there?   
   Am I updating the x and y correctly with:   
      
       xor     ax,     ax   
       xor     dx,     dx   
       xor     cx,     cx   
       mov     bx,     offset buffer   
          
       mov     al,     [bx]   
       mov     dl,     [bx]   
          
       and     al,     HEX (0C)   
       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,     [bx + 1]   
       or      dx,     cx   
       add     dx,     [mouse_x]   
          
       mov     [mouse_x],      dx   
       mov     [mouse_y],      ax   
      
   If I am how do I stop it wrapping around the screen as doing:   
      
       cmp     ax,     80   
       jge     .no_x_inc   
          
       cmp     ax,     0   
       jl      .no_x_inc   
      
   .inc_x:   
      
       mov     cs:[mouse_x],       ax   
      
   .no_x_inc:   
          
       cmp     dx,     25   
       jge     .done   
          
       cmp     dx,     0   
       jl      .done   
      
   .inc_y:   
      
       mov     cs:[mouse_y],       dx   
      
   doesn't seem to work.   
      
   --- 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