I was looking for a trick here that I haven't seen discussed yet. Maybe it is, but I just haven't searched thoroughly enough. Anyway, I can describe it here. I have a program in which the last BASIC line, a REM statement, is totally hidden from the program listing. It's intended to contain, of course, assembly code. However, it's the manner in which this line is created that is interesting.
At the end of the program, create a REM statement with an adequate number of trailing spaces to store the assembly code.
If you're starting fresh and this is the only line in your code, then POKE 16509,118 at the command line (this is the high byte of the line number).
Otherwise, count back from the value of D-FILE by the (number of spaces + 6) and POKE that address with 118.
LIST will no longer show this line!
You can then use addresses from D-FILE minus (number of spaces + 5) to D-FILE minus 1 for code.
The other piece is that you need to determine any POKE addresses and USR call addresses at runtime by reading D-FILE and subtracting offsets from it.
Has anyone ever done this?
Last edited by stroebeljc on Wed Apr 29, 2020 4:13 pm, edited 1 time in total.
stroebeljc wrote: ↑Tue Apr 28, 2020 9:33 pm
I was looking for a trick here that I haven't seen discussed yet. Maybe it is, but I just haven't searched thoroughly enough. Anyway, I can describe it here. I have a program in which the last BASIC line, a REM statement, is totally hidden from the program listing. It's intended to contain, of course, assembly code. However, it's the manner in which this line is created that is interesting.
At the end of the program, create a REM statement with an adequate number of trailing spaces to store the assembly code.
If you're starting fresh and this is the only line in your code, then POKE 16509,118 at the command line (this is the high byte of the line number).
Otherwise, count back from the value of D-FILE by the (number of spaces + 6) and POKE that address with 118.
LIST will no longer show this line!
You can then use addresses from D-FILE minus (number of spaces + 5) to D-FILE minus 1 for code.
The other piece is that you need to determine any POKE addresses and USR call addresses at runtime by reading D-FILE and subtracting offsets from it.
USCII : User Specified Character Integrated Interpreter
-------------------------------------------------------
Introduction:
-------------
Hires graphics are possible on a ZX81. Games are written in it.
However in BASIC you never had a utility to define your own graphics.
Finally (2019) you can use 25 user characters together with the default ROM-set
in your own games.
How to use:
-----------
Load the USCII like any other game.
After loading you will see 1 line with
"0 REM PRINT USR 22722;H"
This line holds a lot more data, but it is made invisible.
NEVER delete this line. The line holds the machinecode for the interpreter,
the hiresscreen and the data for 25 user graphics.
You can now code your own program. The first line to enter is a bit slow, but after
that the program can be typed quicker.
With USCII you will get the use of extra commands to select a hires mode and your own
characters. The commands are easy to use and most error checking is done by the ROM.
All extra commands will start with PRINT USR 22722
Switch hiresscreen on:
----------------------
PRINT USR 22722;H
The game will now show the hires screen until BREAK is pressed or hires display is switched off.
Switch hiresscreen off:
-----------------------
PRINT USR 22722;L
The game will return to the standard screen. The hiresscreen is saved as it is now.
Clear hiresscreen:
------------------
PRINT USR 22722;C
You are allowed to type CLS also.
Define user specified characters:
---------------------------------
You have 25 characters free to define. They start at 192 up to 216 (25!).
You can define characters by
PRINT USR 22722;U;nr;d1;d2;d3;d4;d5;d6;d7;d8
The U for USC and nr is the USC to start and d1 to d8 the value (0-255) for the character
Multiple USC can be set by adding more data. The program will automatically set the next USC.
You can also set USC 1 by 1
Printing on hiresscreen:
------------------------
Each PRINT starts with PRINT USR 22722;
After that you can use AT (not TAB) and text like you do in lowres.
The USC can be printed as CHR$ 192 and on.
Only integer numbers from 0 to 65535 can be printed, other numbers must use the slow STR$
Errors:
-------
When an error occurs this will not show, when your game freezes just press BREAK and the error
will show on the lowres screen.
Adding too much USC with too much data will not give an error, but will corrupt your BASIC.
Saving program:
---------------
When you save your code the graphics and hiresscreen at that moment are saved too.
mrtinb wrote: ↑Wed Apr 29, 2020 10:19 pm
It is UDG (user defined graphics) emulated with WRX hires graphics (Wilf Rigter graphic).
(WRX requires a hardware modification to your RAMpack.)
One thing that is different is that you are not really hiding basic lines. You just have a huge REM at line 0 and all of your BASIC code comes after. There are no hidden BASIC lines, as in this memory image. The hidden stuff follows the BASIC.
mrtinb wrote: ↑Wed Apr 29, 2020 10:19 pm
It is UDG (user defined graphics) emulated with WRX hires graphics (Wilf Rigter graphic).
(WRX requires a hardware modification to your RAMpack.)
One thing that is different is that you are not really hiding basic lines. You just have a huge REM at line 0 and all of your BASIC code comes after. There are no hidden BASIC lines, as in this memory image. The hidden stuff follows the BASIC.
dr beep wrote: ↑Thu Apr 30, 2020 10:07 pm
True... but same technic. Double 118.
I see. You're using the double 118 within a BASIC statement to stop printing any further characters in that statement, versus the method I described which places the double 118 at the end of a statement.
I am coding directly in a compiler and compile to .P
My BASIC is always just 1 line, the call to MC only.
My MC is stored in every available address.
I have placed my BASIC line call to MC fully over the sysvar.
My games have autostart. When you would hack the NXTLIN you still don't get a line of BASIC since it is placed over sysvar.
Because I am not using the editor to enter lines I can make such games.
If you want to code the most out of a ZX81 you must not code ON the ZX81 but on other platform and make it only loadable for the ZX81.