The restart routines
THE 'POWER UP RESET' RESTART
When the Spectrum is turned on or the reset button is pressed, the +D ROM is paged in at
address 0, i.e. the routine listed here is executed.
0000 POWER_UP NOP
0001 LD BC,#0101
0005 JP #0533,POWER_UP2 Jump to main routine.
THE 'USE G+DOS' RESTART
This is the main entry point to the +D system; it is paged in when the Z80 reaches
address #0008, that is, the address of the 'main' ROM 'ERROR' routine.
0008 START LD HL,(23645) The address reached by the interpreter
000B LD (23647),HL (CH_ADD) is copied to the error pointer
000E JR #0013,START2 (X_PTR) before proceeding.
THE 'CALL A MAIN ROM ROUTINE' RESTART
This routine allows for a subroutine in the 'main' ROM to be called from the
+D system. It can be called by using a RST #10 instruction, followed by the
address of the 'main' ROM subroutine.
0010 CALBAS JP #04A6,CALBAS_2 Jump forward.
THE 'START_2' ROUTINE
0013 START2 JP #013B,START_3 Continue with the +D systems main
0016 DEFB #00,#00 Unused locations.
THE 'FLAGS ADDRESS' RESTART
This routine is used by the -BIT- routines at address #15F4, the original HL is saved
and the flags address is loaded into HL.
0018 F_ADDR EX (SP),HL Exchange RETurn address and HL.
0019 PUSH HL Re-stack RETurn address.
001A LD HL,#3ACF Address of FLAGS3.
001E DEFB #00,#00 Unused locations.
THE '+D ERROR' RESTART
A RST #20 followed by an one-byte error code will print the appropriate message, when
the error occurred during the execution of a command code however, the error code will be
returned in the A register with the Carry flag set.
0020 DISC_ERR LD HL,(23645) The address reached by the interpreter
0023 LD (23647),HL is copied to the error pointer before
0026 JR #0035,DISC_ERR2 proceeding.
THE 'NEXT CHAR' RESTART
This routine gets the next character from a BASIC line, it does this by calling the RST
#20 routine in the 'main' ROM.
0028 NEXT_C RST #10,CALBAS Call 'main' ROM 'NEXT_CHAR'.
0029 DEFW #0020,NEXT_CHAR
THE 'GET CHAR' ROUTINE
Get character by calling the 'main' ROM restart.
002C GET_C RST #10,CALBAS Call 'main' ROM 'GET_CHAR'.
002D DEFW #0018,GET_CHAR
THE 'SYNTAX-Z' RESTART
This corresponds to the 'main' ROM 'SYNTAX-Z' subroutine. A test of bit 7 of FLAGS will
give the Zero flag set during syntax checking, and reset during execution.
0030 SYNTAX_Z BIT 7,(IY+1) Test the runtime flag.
THE 'DISC_ERR2' ROUTINE
0035 DISC_ERR2 JP #182D,D_ERROR Continue with the +D error routine.
THE 'MASKABLE INTERRUPT' RESTART
While the +D system is paged in, 'nothing' is done during an interrupt.
0038 INT EI Enable interrupts before RETurning.
AN 'UNUSED' SUBROUTINE
This is probably a piece of an older ROM version, it loads HL with (FRAMES) and CALLs
another unused routine at #02E3.
003A LD HL,(23672) Get the two LSBs of FRAMES.
003D CALL #02E3
0040 OUT (231),A Page-out.
0042 DEFB #B5
0043 DEFB #00,#00,#00
THE 'UNPAGE 128 ROM' SUBROUTINE
This routine pages out the +D system and returns to the 128K ROM at address #0049. That
address contains a RET instruction so the effect is a jump to BC with the 128K ROM paged
0046 UNPAGE_BC PUSH BC Stack return address.
0047 UNPAGE_0 OUT (231),A Page out +D system.
0049 RET ? This statement is not reached from
004A DEFB #00,#00,#00,#00,#00 Unused locations.
THE 'UNPAGE' SUBROUTINE
This routine pages out the +D system and returns to the 'main' ROM at address #0052.
That address contains a RET instruction so the effect is a jump to HL with the 'main' ROM
004F UNPAGE_HL PUSH HL Stack return address.
0050 UNPAGE_1 OUT (231),A Page out +D system.