Replies: 2 comments 7 replies
-
Stupid web page...The first sentence should read: Hi, I'm trying to write a simple text mode (mode1) editor that uses both the keyboard and the mouse to move a text mode cursor. |
Beta Was this translation helpful? Give feedback.
-
Writing to the mouse registers should be considered undefined behavior. For even a trivial use case of the mouse, you'll have to implement a small driver that works like the paint program. Accumulate the small char movements and apply their delta to your cursor position. Perhaps keep your cursor position as a fixed point 8.8 so you can slow down the mouse as necessary. This works like a Commodore 64 mouse. Maybe you can get some ideas looking at what C64 programmers do. |
Beta Was this translation helpful? Give feedback.
-
Hi, I'm trying to the mouse to control the cursor a simple text mode (mode1) editor that uses both the keyboard and the mouse to move the cursor. I'm using canvas mode3 (640X480), but I think the issues will still happen in 320x240.
Problem 1: If I move the cursor with mouse, then keyboard, then mouse, the cursor jumps back to original mouse position. I need a way to set mouse position to the current cursor position set with keyboard.
I tried writing to the mouse RIA registers like this:
RIA.addr0 = MOUSE_INPUT + 1;
RIA.step0 = 0;
RIA.rw0 = cur_col * 8;
RIA.addr0 = MOUSE_INPUT + 2;
RIA.step0 = 0;
RIA.rw0 = cur_row * 16;
Problem 2: This doesn't work, however, because the x and y mouse position registers are only a byte, 255 max, and the current position on the screen can exceed that in both X and Y.
In the paint program you used static int sx, sy to accumulate small delta movements, which is why it worked there, but I can't go backwards that way.
Any suggestions?
Thanks, tonyvr
Beta Was this translation helpful? Give feedback.
All reactions