List Remedy

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
David G
Posts: 632
Joined: Thu Jul 17, 2014 7:58 am
Location: 48 North

Re: List Remedy

Post by David G »

Good explanation, Xav. At it's core it's using the same method as TextToP

* Start at PROGRAM (16509)
LOOP for LINE
* is it a NEWLINE? If so, done
* Print the LINE NUMBER
* Get the LINE LENGTH
LOOP on LINE LENGTH
- Is GETCHAR a 126/7EH? If so, skip over the next five bytes
- Display the character (which may be a TOKEN expanded to multiple characters)
- Next character

XavSnap wrote: Mon Nov 04, 2024 5:52 pmThe process for "LIST line" stop on a display error
Trying it ... yes. The standard LIST starts at the top of the display, and prints down until it either finishes, or runs out of lines on the display. In which case error "5/0" is listed (Error Code 5 means "No more room on the screen")

List Remedy, by contrast, starts near the bottom of the display and scrolls up. If the display gets full, it pauses until a key is pressed, then continues on until all lines have been listed. Much better
David G
Posts: 632
Joined: Thu Jul 17, 2014 7:58 am
Location: 48 North

Re: List Remedy

Post by David G »

i wondered what this meant in the Your Computer article:
The List routine provided by Sinclair in the ZX-81 ROM ... the end of a very long line cannot be listed
So i tried it with a very long REM (1203 characters). LIST only shows one screen, so technically he is correct. It does not LIST the end of a line that has more than a screenful of printable characters (more than about 700 characters)

Unfortunately, while List Remedy does list this line in full, it corrupts the listing. The reason is it doesn't read both bytes of the line length, so when a line is longer than 256 bytes, it prints a new line number (with weird "numbers") and skips several characters. As you keep press a key to continue, eventually this causes a crash

Code: Select all

LD B,(HL)
DEC B          ;b is length of line -1
Line Length on the ZX81 is 16-bit, so this should have been

Code: Select all

LD B,(HL)
INC HL
LD C,(HL)
DEC BC         ;bc is length of line -1

Stroebel modified it to:
allow the display of lines longer than 255 bytes
Indeed, with his version, List Remedy works as advertised
David G
Posts: 632
Joined: Thu Jul 17, 2014 7:58 am
Location: 48 North

List Remedy documentation: usage and assembly

Post by David G »

Documentation
=============

RUN 'List Remedy v4.p' from the zip archive
It will prompt for a relocation address

Or invoke ListRemedyV4 (NEWLIST) with:

Code: Select all

RAND USR 16541
The optional relocator is:
RAND USR 16516


How can List Remedy be used to LIST (NEWLIST) a different program?

(optional) Relocate/copy the code, say to address 15000 for a 16K machine

Code: Select all

RAND 15000
LOAD "MY OTHER PROGRAM"
RAND USER 15000
NOTE: if using an emulator, disable Autoload before loading the 2nd program. Autoload erases the memory before LOADing


ASSEMBLING
==========
Stroebel's ASM files are for TASM (Telemark assembler). It requires TASM.EXE and TASM80.TAB, which are not freeware. If you do have TASM, copy those files to the directory with List Remedy V4 and use this command:

Code: Select all

tasm -80 -b -s "List Remedy v4.asm" NEWLIST.p
To assemble with SJASM or ZX-IDE, you can port the code and adjust the includes and defines. Details are in the attached file Porting.txt

[edit:] Source code is in the zip archive

[edit:]Updated the SJASM porting file and added a PASMO porting file
Attachments
Porting_SJASM (updated).txt
(1.07 KiB) Downloaded 147 times
Porting_PASMO.txt
(1.46 KiB) Downloaded 146 times
Doumentation-List Remedy.txt
(1.29 KiB) Downloaded 146 times
Porting_ZX-IDE.txt
(3.1 KiB) Downloaded 144 times
_BLANK_TEMPLATE.ASM
ZX-IDE template for Assembly & BASIC code (2K)
(3.69 KiB) Downloaded 155 times
David G
Posts: 632
Joined: Thu Jul 17, 2014 7:58 am
Location: 48 North

Re: List Remedy porting to Assemblers

Post by David G »

Apologies to the folks who tried the SJASM porting. I forgot a step. Update text file has just been posted above. Please let me know if it works

Also added Porting PASMO instructions

PASMO is an open source assembler designed for the Spectrum crowd, but works equally well for the ZX81. It appears to use the same conventions as SJASM, so the porting instructions are the same. It is available for Linux and for the Windows command line
https://pasmo.speccy.org/
David G
Posts: 632
Joined: Thu Jul 17, 2014 7:58 am
Location: 48 North

Re: List Remedy

Post by David G »

interesting questions

XavSnap wrote: Mon Nov 04, 2024 5:52 pm Is there anyone able to do a REM able to freeze or rebout a BASIC program ? (Witout a $76;$76 code!)
Even with the double-NEWLINE I have no crash, hang, or reboot with standard LIST. Even with twin or single $76 at beginning of REM or at end of REM. We were recently discussing NEWLINE in REM causing crashes


1 REM HELLO WORLD
2 REM END
POKE 16513,0 (SPACE)
RUN
C/1
POKE 16513,228 (SLOW)
POKE 16513,229 (FAST)
RUN
0/2
LIST is ok...

POKE 16513,232 (CONT)
RUN
wait a break to exit.
POKE 16513,240 (LIST)
RUN
2/1
Without $76;$76 in the REM line...
(...)

confirmed. The standard LIST has no crash with all these POKE variations of line 1:

Code: Select all

1 FAST HELLO WORLD
1  HELLO WORLD
1 SLOW HELLO WORLD
1 FAST HELLO WORLD
1 CONT HELLO WORLD
$76;$76 [end of BASIC bloc]
Ah, so LIST interprets this as the double-76 that always appears? (76 at end of last BASIC line, 76 at beginning of Display File). Except when there are no BASIC lines, then the BASIC block doesn't end with a 76

I did see a weird display with a 7E right at the end, then the display file is interpreted as more program lines. But still no crash

the famous LIST display crash on the illegals ASM codes in a REM line
I have long heard about this. But on recollection, in 40 years have never encountered it. I too would love to see an example REM that causes a LIST crash or LLIST crash
sboisvert
Posts: 45
Joined: Mon Nov 02, 2009 3:43 pm

Re: List Remedy

Post by sboisvert »

I noted weirdness for LIST too if various conditions are met, but never encountered any 'crash' - the only thing I ran into was a loop, which did require a power cycle to get out of.
User avatar
GCHarder
Posts: 477
Joined: Sat Dec 14, 2013 7:46 pm

Re: List Remedy

Post by GCHarder »

Turning off the computer to get out of an endless loop, isn't that a crash? I believe that was the behavior the $76$76 avoided.
sboisvert
Posts: 45
Joined: Mon Nov 02, 2009 3:43 pm

Re: List Remedy

Post by sboisvert »

In terms of the ZX81, I guess both can be considered crashes.

My version of 'crash' meant more that either it ends up doing a reset and returning to the 'K' cursor with wiped memory, or completely locks up (frozen).

I call the looping it did with the listing the 'hypnotist mode'.
David G
Posts: 632
Joined: Thu Jul 17, 2014 7:58 am
Location: 48 North

Re: List Remedy

Post by David G »

sboisvert wrote: Thu Nov 14, 2024 6:51 pm My version of 'crash' meant more that either it ends up doing a reset and returning to the 'K' cursor with wiped memory, or completely locks up (frozen).

Technically, when the program stops responding to input it's called a hang. It may still be running but it's hard to tell unless it gets past the hang on its own

A crash is when the program exits unexpectedly


In any case, List Remedy V4 is a solution. I was thinking of building a ROM image for the 8K slot that has List Remedy at 8192 so List Remedy is always available. But if LIST never actually crashes or hangs maybe its not so important
stroebeljc
Posts: 114
Joined: Thu Apr 23, 2020 6:02 am
Location: Minneapolis, MN

Re: List Remedy

Post by stroebeljc »

I apologize for not providing more clarity on how to use 'List Remedy v4.p'. I've updated the README.md file on github. I've also included the new instructions here.

The program will install the list tool at an address you specify when you RUN after loading. I recommend placing it above RAMTOP.

Example (16k RAM):

Code: Select all

NEW
POKE 16389,127
NEW
LOAD ""
RUN
[Enter 32512 at the RELOCATE TO: input prompt.]
The program listing will be displayed using the newly relocated code. Now you can NEW and enter your program or LOAD a new program. To list it:

Code: Select all

RAND USR 32512
John
Post Reply