Setting cursor location

Post Reply
BillO
Posts: 216
Joined: Tue Jul 08, 2014 4:03 pm
Location: Canada
Contact:

Setting cursor location

Post by BillO »

Hey all!

Winer has set in where I am so it's time to play!

Does any one know where the cursor location is stored in 8K basic? I want to be able to set the cursor to any location I'd like. It has to be stored somewhere, but I just can't seem to find it.

Any help is much appreciated.
Box stock Superboard II Rev. B
KLyball replica 600D, replica 610 & KLyball Data Separator
OMS SBME and SBME+ memory cards
OMS Digi-Mule expansion bus
KLyball memory card
bxdanny
Posts: 335
Joined: Thu Apr 16, 2015 2:27 pm
Location: Bronx, NY USA

Re: Setting cursor location

Post by bxdanny »

The current cursor position within a row of output (value of the POS(x) function) is stored at location 14 ($0E) under BASIC-in-ROM.
Under 65D [and 65U], it's at location 22 ($16).

BASIC itself has no concept of a cursor location beyond that. However, there is a routine in the BASIC 4 ROM (starting at $BF2D) that is used to send output to the video screen (on the 440, 540, or 600 board). Although it is contained within the BASIC ROM, it is not really part of BASIC itself, and I don't think Microsoft had anything to do with writing it. Output from BASIC is routed there via a JMP instruction in the Monitor ROM at $FFEE (which in turn is called from $A8FA, part of the character-output routine that begins at $A8E5).

Variables used by the the routine at $BF2D are as follows:

$0200 - current location of the video cursor within the last page of video RAM ($D3xx or $D7xx)
$0201 - character under the cursor
$0202 - temp storage for character currently being output
$0206 - amount of delay to introduce during output. Normally this is 0, but you can create a slow "teletype effect" by putting a non-zero value here.

This routine can only output characters to the last page of video RAM ($D3xx or $D7xx). It cannot send output to other pages, which it writes to only when scrolling the screen. It looks at three locations in the Monitor ROM to tell it about the video screen:

$FFE0 - offset into the last page of video RAM where the cursor is placed when a carriage return is received
$FFE1 - contains 0 if there is 1k of video RAM (characters are written to $D3xx), or 1 if there is 2k of video RAM (characters are written to $D7xx)
$FFE2 - the number of characters, less 1, to be output on a screen row, or equivalently the offset from the first to the last character cell used on a row.
(For example, on the C1P/Superboard II, this value is 23.)
No current OSI hardware
Former programmer for Dwo Quong Fok Lok Sow and Orion Software Associates
Former owner of C1P MF (original version) and C2-8P DF (502-based)
BillO
Posts: 216
Joined: Tue Jul 08, 2014 4:03 pm
Location: Canada
Contact:

Re: Setting cursor location

Post by BillO »

Thanks Danny. That stuff might come in handy.

What I'm trying to do is, after clearing the screen I want the cursor to go back to the top right hand position of the screen.

I'm using a little bit of ML code to clear the screen by loading $20 into $D000-$D3FF. Now I just need to start printing the next character at $D083. Reset the text position, so to speak.

This information must be tracked somewhere. After all when the machine is first started, the first character is printed at $D083.
Box stock Superboard II Rev. B
KLyball replica 600D, replica 610 & KLyball Data Separator
OMS SBME and SBME+ memory cards
OMS Digi-Mule expansion bus
KLyball memory card
bxdanny
Posts: 335
Joined: Thu Apr 16, 2015 2:27 pm
Location: Bronx, NY USA

Re: Setting cursor location

Post by bxdanny »

>>> After all when the machine is first started, the first character is printed at $D083.

Not on a stock Superboard, it's not. The "D" of "D/C/W/M ?" is at $D365. With CEGMON installed, the first character is at $D045. What kind of system are we talking about? On disk-based video systems, the "H" of "H/D/M?" is at $D0C6, but that is just written there directly, it's not the output of a video driver routine.
No current OSI hardware
Former programmer for Dwo Quong Fok Lok Sow and Orion Software Associates
Former owner of C1P MF (original version) and C2-8P DF (502-based)
BillO
Posts: 216
Joined: Tue Jul 08, 2014 4:03 pm
Location: Canada
Contact:

Re: Setting cursor location

Post by BillO »

Right. I forgot the stock arrangement. I've used CEGMON for so long.

It's a 600 rev. B with CEGMON. No disk.

Edit:
On my system $D084 is visible but does not scroll. $D084 is the first scrolling character position.
Box stock Superboard II Rev. B
KLyball replica 600D, replica 610 & KLyball Data Separator
OMS SBME and SBME+ memory cards
OMS Digi-Mule expansion bus
KLyball memory card
bxdanny
Posts: 335
Joined: Thu Apr 16, 2015 2:27 pm
Location: Bronx, NY USA

Re: Setting cursor location

Post by bxdanny »

With CEGMON, just PRINT CHR$(26); to clear the screen and home the cursor.
No current OSI hardware
Former programmer for Dwo Quong Fok Lok Sow and Orion Software Associates
Former owner of C1P MF (original version) and C2-8P DF (502-based)
BillO
Posts: 216
Joined: Tue Jul 08, 2014 4:03 pm
Location: Canada
Contact:

Re: Setting cursor location

Post by BillO »

Thanks! I'll use that for my own programs in teh future.

My inquiry stemmed from my writing a version classic game (Wumpus) for the 600/Superboard II that I intend to share, so it has to work with the SYN600 monitor too.

I'll work something else out to make the game aesthetic.

Thanks for the helpful input though.
Box stock Superboard II Rev. B
KLyball replica 600D, replica 610 & KLyball Data Separator
OMS SBME and SBME+ memory cards
OMS Digi-Mule expansion bus
KLyball memory card
Post Reply