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,922 of 4,255    |
|    Robert Pengelly to wolfgang kern    |
|    Re: COM1 interrupt for 16-bit OS    |
|    12 Nov 23 17:41:38    |
      From: robertapengelly@gmail.com              On Monday, 13 November 2023 at 01:28:24 UTC, wolfgang kern wrote:       > On 13/11/2023 02:11, Robert Pengelly wrote:       > > On Monday, 13 November 2023 at 00:56:18 UTC, wolfgang kern 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.       > >>>>> 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]       > when did you assign BX for point to buffer ??       > >>>>> 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.       > >>> 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.       > >> then I assume that it is off screen, so you may not clip it correct.       > > Can you see anything wrong with the irq handler I sent a few messages ago?       Also, can you see anything that may be wrong in:       >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; Clear interrupts while we set other up.       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > cli       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; We'll use the extra segment to offset the correct positions       > > ;; so make sure it is zero.       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > xor ax, ax       > > mov es, ax       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; Setup INT 0Ch.       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > mov word ptr es:[HEX (0C) * 4], offset serial_handler       > > mov word ptr es:[HEX (0C) * 4 + 2], cs       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; Set DLAB on.       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > mov dx, HEX (03FB)       > > mov al, HEX (80)       > > out dx, al       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; Set baud rate (low).       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > mov dx, HEX (03F8)       > > mov al, HEX (60)       > > out dx, al       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; Set baud rate (high).       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > mov dx, HEX (03F9)       > > xor al, al       > > out dx, al       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; 8 bits, no parity, one stop bit.       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > mov dx, HEX (03FB)       > > mov al, HEX (03)       > > out dx, al       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; FIFO Control Register.       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > mov dx, HEX (03FC)       > > mov al, HEX (0B)       > > out dx, al       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; Turn on DTR, RTS and OUT2.       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > mov dx, HEX (03FA)       > > mov al, HEX (C7)       > > out dx, al       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; Interrupt when data received.       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > mov dx, HEX (03F9)       > > mov al, HEX (01)       > > out dx, al       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; Enable interrupts on IRQ4.       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > in al, HEX (21)       > >       > > and al, HEX (EF)       > > out HEX (21), al       > >       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > ;; Restore interrupts.       > > ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;       > > sti       I forgot that I was using bx when I modified the code. That's been fixed but       still having problems, did you see anything else wrong?              --- 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