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,928 of 4,255   
   wolfgang kern to Robert Pengelly   
   Re: COM1 interrupt for 16-bit OS   
   13 Nov 23 10:38:21   
   
   From: nowhere@never.at   
      
   On 13/11/2023 10:11, Robert Pengelly wrote:   
   > On Monday, 13 November 2023 at 09:01:29 UTC, wolfgang kern wrote:   
   >> On 13/11/2023 09:49, Robert Pengelly wrote:   
   >>> On Monday, 13 November 2023 at 08:37:18 UTC, wolfgang kern wrote:   
   >> ...   
   >>>> I found my hand written notes from 1980 on Serial Mice now,   
   >>>> two button standard:   
   >>>> 1200 baud, No Parity, 7(or8)bit, 1 stop bit   
   >>>> 1st byte   
   >>>> 7 * don't care   
   >>>> 6 == 1 sync bit   
   >>>> 5 Right Button Down   
   >>>> 4 Left Button Down   
   >>>> 3 b7 Y   
   >>>> 2 b6 Y   
   >>>> 1 b7 X   
   >>>> 0 b6 X   
   >>>> 2nd byte   
   >>>> 7 *   
   >>>> 6 == 0   
   >>>> 5..0 b5..0 X   
   >>>> 3rd byte   
   >>>> 7 *   
   >>>> 6 ==0   
   >>>> 5..0 b5..0 Y   
   >>>> assume BX points to buffer yet   
   >>>>>>> mov cl, [bx + 2]   
   >>>> AND CL, 0x7f ;can't be sure for b7==0   
   >>>> ;missed to sign extend AX,AL   
   >>>> CBW makes AX sign extended from AL   
   >>>> or ax, cx OK insert low 6 bits   
   >>>>   
   >>>> ADD [mouse_y],AX it does a SUB if AX is negativ   
   >>>> mov cl, [bx + 1]   
   >>>> AND CX,0x7f   
   >>>> MOV AL,DL   
   >>>> CBW   
   >>>> OR AX,CX   
   >>>> ADD [mouse_x],AX   
   >>>> DONE:   
   >> ...   
   >>> Just as I was going to reply you sent that last message. Anyways this   
   seems to work:   
   >>>   
   >>> xor ax, ax   
   >>> xor dx, dx   
   >>> xor cx, cx   
   >>> mov bx, offset buffer   
   >>>   
   >>> mov al, [bx]   
   >>> and al, HEX (0C)   
   >>>   
   >>> mov cl, 4   
   >>> shl ax, cl   
   >>>   
   >>> cbw   
   >>>   
   >>> mov cl, [bx + 2]   
   >>> or ax, cx   
   >>> add [mouse_y], ax   
   >>>   
   >>> mov al, [bx]   
   >>> and al, HEX (03)   
   >>>   
   >>> mov cl, 6   
   >>> shl ax, cl   
   >>>   
   >>> cbw   
   >>>   
   >>> mov cl, [bx + 1]   
   >>> or ax, cx   
   >>> add [mouse_x], ax   
   >>>   
   >>> but not sure if it's right or not. You did just have "CBW makes AX sign   
   extended from AL" so maybe the code is right.   
   >> Fine so far, you rely on b7=0 in first byte which may cause errors.   
   >> you could check of the first byte got a sync bit to avoid jumping mice.   
   >> __   
   >> wolfgang   
   > I'm a little confused by :   
   >   
   > you rely on b7=0 in first byte which may cause errors.   
   > you could check of the first byte got a sync bit to avoid jumping mice.   
   >   
   > You had:   
   >   
   > 1st byte   
   > 7 * don't care   
   > 6 == 1 sync bit   
   > 5 Right Button Down   
   > 4 Left Button Down   
   > 3 b7 Y   
   > 2 b6 Y   
   > 1 b7 X   
   > 0 b6 X   
   >   
   > in your previous message, do you mean bit 6 (i.e. the sync bit).  If you do   
   should I do something like:   
   >   
   > test al, 0x40   
   > jnz .done   
   >   
   > before the updating code   
      
   yes, but you can do it already in the IRQ routine.   
   __   
   wolfgang   
      
   I posted this a few days ago:   
      
   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   
      
   --- 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