Forcing 'cursor' position on ZX80 from Basic

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
gertk
Posts: 14
Joined: Sun Oct 14, 2012 9:09 pm

Forcing 'cursor' position on ZX80 from Basic

Post by gertk »

Hi,

Is it possible to force (POKE) the position of the next character to be printed?
I already tried POKE-ing S_POSN but it seems to have no effect.
What I would like to do is preset X and Y and then do a PRINT ....
I understand I have to fill the screen (partially) with spaces to be able to do random position writes.

Anyone tried this ?
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: Forcing 'cursor' position on ZX80 from Basic

Post by XavSnap »

Hi Gertk,

May be...
But, on the Zx81, you can't force decimals entry on the "Print AT" function.
All BASIC ROM commmands refresh and update X and Y coords... and recalculate the D_File Screen memory pointer.
(CH_ADD to DF_CC)

In ZX81 BASIC, You had to write a short ASM program.
Just use a mirrored screen using, a string array... DIM SCR$(20,32)
Set end print the each string line on the screen, to refresh it.

Note:
On the ZX81, you can change the D_File offset, to point on the Vars memory.
You had to add a byte to each line to store the new/line byte($76).DIM SCR$(20,33)
A SCR$(10,10)="O" will directly display a "O" on your screen.
But, in this case, all "Print" Basic options will be hidden and unused ! (CLS,PLOT... print AT)
(cf. "Something to do in Paris")
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
gertk
Posts: 14
Joined: Sun Oct 14, 2012 9:09 pm

Re: Forcing 'cursor' position on ZX80 from Basic

Post by gertk »

Let me clarify a bit, on the ZX81 you have PRINT AT, not on the ZX80.

All I want to do is preset the next position where the PRINT instruction is going to write to.
This must be kept somewhere otherwise how is the Basic to know where to print the next character ?
So after a PRINT command it needs to keep track where to print the next, my question was where is this stored and can I POKE it so that I can direct it to another spot on the screen ?
User avatar
stefano
Posts: 542
Joined: Tue Dec 11, 2012 9:24 am
Contact:

Re: Forcing 'cursor' position on ZX80 from Basic

Post by stefano »

Your question is clear but you miss some information: the ZX80 display handling is very primitive. The display size is initially set to zero and grows up as muc as many things you print to the screen. Then the error message is printed on bottom and, as soon as you type something the DISPLAY is deleted because in edit mode, the top of the D-FILE is temporairly visualized on bottom.
While running a program the two lower lines do not exist; the 'INPUT' command puts the cursor at the current PRINT position, which is merely a memory location not defined by coordinates.. any text line can be of variable size (up to 32) and is always terminated by the CR character.
The PRINT command is able only to add characters to dhe D-FILE
The CLS command clears the display memory
The INPUT command gives some minimal dynamic to the current line only

To get more you need either the ZX81 ROM (which was called 'NEW ROM) or some trick.
The idea of defining a string variable holding a full sized display and making the Display File pointer pointing to it seems the best choice for a BASIC program: with relatively simple expressions you can put characters randomly on it... otherwise you're stuck to a sequential access display :)
Post Reply