cfj@omovax.UUCP (Charles Johnson) (12/20/84)
Does anyone know, which memory locations control where the next position that characters will be printed at on the C-64 ? I believe 211 (decimal) controls which column but I haven't been able to find out what controls which line. I'm trying to write a function which will print anywhere on the screen without using the cursor controls or poking directly to the screen. Thanks, Charles Johnson Hillsboro, OR P.S. I have a copy of the programmer's manual, but their descriptions of the memory map is not that great.
calway@ecsvax.UUCP (James Calloway) (12/31/84)
x
The PLOT routine in the kernal ($FFF0 or65520) will position the cursor for you. Load the Y register with the column number, 0-39, and the X resister with the row number, 0-24, clear the carry flag and JSR to FFF0.
If you want to do that from BASIC, you can poke the Y value into 782 and the X value into 781. I don't know how to clear the carry flag except to SYS to a short routine that contains these numbers:
24,76,240,255
This will jump to FFFO for you and then return to BASIC.
--
James Calloway
The News and Observer
Box 191
Raleigh, N.C. 27602
(919) 829-4570
{akgua,decvax}!mcnc!ecsvax!calwayjoels@tektools.UUCP (Joel Swank) (01/02/85)
> x > The PLOT routine in the kernal ($FFF0 or65520) will position the cursor for you. Load the Y register with the column number, 0-39, and the X resister with the row number, 0-24, clear the carry flag and JSR to FFF0. > > If you want to do that from BASIC, you can poke the Y value into 782 and the X value into 781. I don't know how to clear the carry flag except to SYS to a short routine that contains these numbers: > 24,76,240,255 > > This will jump to FFFO for you and then return to BASIC. Location 783 is the initial P reg for SYS calls. To clear carry (and all other flags) poke a 0 here. Location 780 passes the A reg. All 4 locations can be peeked after retrurn from the SYS to see the contents of the registers after the ML subroutine has executed. Joel Swank Software Center Tools Support 50-487 Tektronix Beaverton OR 97077 (503) 627-4403
calway@ecsvax.UUCP (James Calloway) (01/05/85)
x
Good point. If the cursor is on while you call the PLOT routine, it sometimes gets caught by the interrupt, causing some screen locations visited by the cursor
to switch to reverse video.
You will need a short ML routine that turns off the interrupt, corrects the cursor if necessary, calls PLOT and then turns the interrupt back on.
I have something like that lying around. If I can find it, I will post it.
Thanks for the tip on the status register (location 784). My Programmer's Reference Guide lists it as "SP" which I took to mean stack pointer. Should have known.
--
James Calloway
The News and Observer
Box 191
Raleigh, N.C. 27602
(919) 829-4570
{akgua,decvax}!mcnc!ecsvax!calwaycalway@ecsvax.UUCP (James Calloway) (01/07/85)
x
Below is a ML routine that will move the cursor without leaving parts of the
screen in reverse video. The only instance I have found in which it does not work is on line 24, the last line (starting with 0). I'm not sure why.
The routine assumes you already have loaded the X register with the row number
(0-24) and the Y register with the column number (0-39).
SEI
LDA $CF
BNE fixcrsr
CLC
goplot JSR FFF0
CLI
RTS
fixcrsr LDA #$01
STA $CD
ckagain CLI
NOP
NOP
NOP
NOP
NOP
SEI
LDA $CF
BNE ckagain
CLC
BCC goplot
This can be used with BASIC. Select an address that is safe from BASIC and POKE
the following numbers into memory:
120,165,207,208,6,24,
32,240,255,88,96,169,
1,133,205,88,234,234,234,
234,234,120,165,207,208,
245,24,144,233
From BASIC you can POKE the column number into 782 and the row number into 781.
Then SYS to the address you chose for the routine. It will move the cursor and
return to BASIC.
--
James Calloway
The News and Observer
Box 191
Raleigh, N.C. 27602
(919) 829-4570
{akgua,decvax}!mcnc!ecsvax!calwaygrant@hp-pcd.UUCP (grant) (01/12/85)
{}
you can set/clear the carry for a BASIC SYS call by writing an
appropriate value (0 for clear, 1 for set, I think) into the PSW
location (similar to the X, Y, and A locations). I think its address
is 784, but I don't have my documentation here. When you do a SYS,
the X, Y, A registers and the PSW are all loaded from their respective
locations before the user routine is called. When the routine is
finished, the registers and PSW are saved back into their locations
before BASIC resumes. This means that BASIC can both send and receive
parameters to/from the ML.
For example, if you set the carry before calling PLOT, the cursur's
row and column will be returned to you.
One warning: PLOT may give funny results if the cursor is on. It
may move to a new spot while the screen is reversed, leaving an
inverse character and possibly a funny color under its old position.
(It is possible that I am confusing PLOT with just trying to turn the
cursor on in BASIC.)