The Error Restart $08

Any discussions related to the creation of new hardware or software for the ZX80 or ZX81
Post Reply
User avatar
mrtinb
Posts: 1911
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

The Error Restart $08

Post by mrtinb »

The error restart is used to set up an error code, and quit from current code.

We see it in the kernel many times, including here:

Code: Select all

02F4 RST $08
02F5 $0E
:
03A6 RST $08
03A7 $0C
:
0888 RST $08
0889 $0C
However 2 times, we see calling to ERROR_3 instead:

Code: Select all

0835 LD L,4
0837 JP ERROR_3 [$0058]
:
0ED3 LD L,3
0ED5 JP ERROR_3 [$0058]
Why is that? This takes 5 bytes, but calling the error restart would only take 2 bytes.

Any ideas?
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
XavSnap
Posts: 1941
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: The Error Restart $08

Post by XavSnap »

No,

But the RST** is a CALL **** procedure, and a RET loop to it.
The stack of processor address is update and removed after its call.
With a JMP, the RET is done on the last stack BASIC address and return to the BASIC editor/routine.

RST isn't a special function, it's use to do a CALL $00xx in the ROM.
RST <address>
"Reset" or "Software interrupt". Works like CALL, but is smaller and faster and works only to 1 of 8 fixed addresses that are 0h, 8h, 10h, 18h, 20h, 28h, 30h or 38h.
If this function stores the origin address in the RAM, this function can't be use in a system without RAM (Buffered stacks).

RST.JPG
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
User avatar
mrtinb
Posts: 1911
Joined: Fri Nov 06, 2015 5:44 pm
Location: Denmark
Contact:

Re: The Error Restart $08

Post by mrtinb »

Hi Xavier.

Thanks for your reply.

I see now, that one is a call, and the other is a jump. The question remains: Why do they do it differently.

It's not like a RST call to RST $08 expect to be returned to the place where the error occured. The whole idea is to display an error and go back to the command line. That must be the intend in all situtations where the error is reported.
Martin
https://zx.rtin.be
ZX81, Lambda 8300, Commodore 64, Mac G4 Cube
User avatar
1024MAK
Posts: 5118
Joined: Mon Sep 26, 2011 10:56 am
Location: Looking forward to summer in Somerset, UK...

Re: The Error Restart $08

Post by 1024MAK »

Maybe it’s because these two errors are related to no more room on screen / no more room available in memory (RAM). Hence the first part of the routine for RST $08 not being required, hence the jump directly into the last part of that routine.

Mark
ZX81 Variations
ZX81 Chip Pin-outs
ZX81 Video Transistor Buffer Amp

:!: Standby alert :!:
There are four lights!
Step up to red alert. Sir, are you absolutely sure? It does mean changing the bulb :!:
Looking forward to summer later in the year.
Post Reply