stdnet@stag.UUCP (07/09/88)
From: dal@syntel.UUCP (Dale Schumacher) [thelake!steve@stag.UUCP (Steve Yelvington) writes...] > In the midst of the recent discussion about reading a character at > a cursor position, someone mentioned that there is a "documented" > location in which the cursor's current location is stored. > > What is the location? > > In what format is the data stored? > > And is the data kept current, or updated only when a vt52 escape > sequence that means "save cursor location" is sent to the CON device? When the VT-52 "save cursor" sequence is processed (which is "\033j"), the cursor location (row and column) is saved at: *((WORD *) (aline - 334)) /* saved cursor column (x position) */ *((WORD *) (aline - 332)) /* saved cursor row (y position) */ In these examples, "aline" is a variable which has been initialized to the base address of the Line A variables. This address is returned in D0 and A0 after the $A000 (init a-line) instruction. As an aside, you can also set the cursor position by setting the row and column values and sending a VT-52 "restore cursor" sequence (which is "\033k"). THIS IS NOT a good way to find the cursor location. A much better place to get the cursor location is the current cursor location cells (kind of obvious, right?) which are located at: *((WORD *) (aline - 28)) /* cursor column (x position) */ *((WORD *) (aline - 26)) /* cursor row (y position) */ These values may be read, but writing to them is another matter. In addition to the row and column values, another location stores the memory address of the first byte of the current cursor cell. This address must be updated as well, and you have to be careful to check to see if the cursor is reversed (blink-on or blink-off) before moving it. The cursor address is at: *((char **) (aline - 22)) /* cursor memory address */ There IS a cursor status byte which indicates that the cursor is reversed, but it's location is currently not documented (** WHY NOT, ATARI! **). If you want to read about what happens when TOS moves the cursor, I refer you to p.436 of "Atari ST Internals" (the BIOS listing), and the surrounding pages. Remember, however, that listing is NOT what is in the current machines, but a close approximation. -- Dale Schumacher 399 Beacon Ave. (alias: Dalnefre') St. Paul, MN 55104 ...bungia!stag!syntel!dal United States of America "Man who says, 'It cannot be done', should not interrupt man who is doing it." -Ancient Chinese Proverb