I have a screen res of 80x50 and i want to have a routine that reads the current cursor position, and then moves the curror on the same line ( row) one char to the left (ie one col left). i have tried using gotoxy and wherey) and i have had no luck. is there a simple solution either in asm or c.
thanks.
ed.
Help with cursor positioning
RE:Help with cursor positioning
This is documented on the web in more detail, but all you need to do is fetch the cursor offset, decrement, and set the cursor offset. All VGA control functions are done through port 0x3D4 and 0x3D5 (a search of those ports should point you to documentation).
To fetch the offset, write 0x0D(14) to port 0x3D4, then read a byte from 0x3D5. It will return the high byte of the offset. Do the same again, this time writing 0x0E(15) to 0x3D4. 0x3D5 this time will return the low byte of the offset.
Setting the offset is almost the same thing in reverse. Write 0x0D(14) to 0x3D4, then write the high byte of the offset to 0x3D5. Write 0x0E(14) to 0x3D5, then write the lower byte of the offset 0x3D5.
You'll probably want to wrap those in functions.
Gnome
To fetch the offset, write 0x0D(14) to port 0x3D4, then read a byte from 0x3D5. It will return the high byte of the offset. Do the same again, this time writing 0x0E(15) to 0x3D4. 0x3D5 this time will return the low byte of the offset.
Setting the offset is almost the same thing in reverse. Write 0x0D(14) to 0x3D4, then write the high byte of the offset to 0x3D5. Write 0x0E(14) to 0x3D5, then write the lower byte of the offset 0x3D5.
You'll probably want to wrap those in functions.
Gnome
RE:Help with cursor positioning
HI Gnome,
Thank you very much for your help, its just a case of doing some more research and comming up with some code. if you know of any useful websites and or code please let me know.
once again, thanks for your help.
ed.
Thank you very much for your help, its just a case of doing some more research and comming up with some code. if you know of any useful websites and or code please let me know.
once again, thanks for your help.
ed.