ZXERR
LD (MSERR),DE ;Error string
LD IY,#5C3A ;Spectrum system veriables
EI
CALL vers ;This is done differently on 128s,48s and +3s
LD A,H
OR A
JR Z,BERR48
DEC A
JP NZ,BERRP3
;
;Running on a 128.
;
BIT 4,(IY+1) ;Running 128 BASIC?
JR Z,BERR48 ;No; 48 mode is assumed.
LD HL,(#5B8B) ;Fake a 128 BASIC error.
LD (MSRET),HL
LD HL,#0397 ;Jump in after the part which determines the
LD (MSMES+1),HL ;address of the message.
LD HL,ERRRT1
LD (#5B8B),HL
JP 23325 ;Page in ROM 1 etc.
;
ERRRT1
LD HL,(MSRET)
LD (#5B8B),HL ;Restore old SYNRET.
LD SP,(RAMTOP) ;Clear machine & GOSUB stacks.
INC SP
LD HL,#5BFF
LD (#5B81),HL ;OLDSP
HALT
RES 5,(IY+1)
LD HL,#5B66
BIT 2,(HL)
JP Z,R034A ;$+14
CALL #1F45
LD IX,(#5B83)
LD BC,#14
ADD IX,BC
CALL #1D56
CALL #1F20
JR R034A
;
BERR48
HALT
RES 5,(IY+#01)
BIT 1,(IY+#30)
CALL NZ,#0ECD
LD HL,0
LD (IY+#37),H
LD (IY+#26),H
LD (#5C0B),HL
LD HL,1
LD (#5C16),HL
CALL #16B0
RES 5,(IY+#37)
CALL #0D6E
SET 5,(IY+#02)
LD DE,(MSERR)
L0C22
LD A,(DE)
AND #7F
CALL #0C3B
LD A,(DE)
INC DE
ADD A,A
JR NC,L0C22
JP #1349
;
BERRP3
BIT 4,(IY+1) ;Running +3BASIC?
JR Z,BERR48 ;No; 48 mode is assumed.
LD HL,(SYNRET) ;Fake a +3BASIC error.
LD (MSRET),HL
LD DE,#61
ADD HL,DE ;Jump in after the part which determines the
LD (MSMES+1),HL ;address of the message.
LD HL,ERRRTN
LD (SYNRET),HL
JP ONERR ;Page in ROM 1 etc.
;
ERRRTN
LD HL,(MSRET)
LD (SYNRET),HL ;Restore old SYNRET.
LD SP,(RAMTOP) ;Clear machine & GOSUB stacks.
INC SP
LD HL,#5BFF
LD (OLDSP),HL
HALT
RES 5,(IY+1)
R034A
LD HL,0
LD (IY+55),H
LD (IY+38),H
LD (#5C0B),HL
INC HL
LD (#5C16),HL
RST #28
DEFW #16B0
RES 5,(IY+55)
RST #28
DEFW #0D6E
SET 5,(IY+2)
LD DE,(MSERR) ;Address of error message.
MSMES
JP 0
MSRET
DEFW 0
MSERR
DEFW 0