Previous Next Contents Index
The restart routines

THE 'POWER UP RESET' RESTART
When the Spectrum is turned on or the reset button is pressed, the DISCiPLE ROM is paged
in at address 0, i.e. the routine, listed here at address #2000 is executed.

2000 POWER_UP   DI                       Not executed, DISCiPLE pages-in at #0001.
2001            XOR  A                   #00 'start' (#FF for 'NEW').
2002            OUT  (31),A              Reset control lines.
2004            JP   #02F2,POWER_UP2     Jump to main routine (#22F2).
2007            DEFB #00                 Unused byte.

THE 'MAIN ROM ERROR' RESTART
Whenever #0008 is reached in the Spectrum ROM with no system file loaded this routine is
executed. This routine handles the execution of the "RUN" command or the 'pupil'
commands.

2008 ROM_START  LD   HL,(23645)          The address reached by the interpreter
200B            LD   (23647),HL          (CH_ADD) is copied to the error pointer
200E            JR   #2086,ROM_START2    (X_PTR) before proceeding.

THE 'CALL BASIC ROM ROUTINE' RESTART
This routine is used to CALL a subroutine in the 'main' ROM, the way to use it is a
RST 16 followed by the address to be called.

2010 CALBAS     JP   #0190,CALBAS_2      Jump forward.

THE 'INITIALIZE SYSTEM' ROUTINE
This routine immediately jumps to #0013 in RAM.

2013 INIT_SYS   OUT  (123),A             Resets boot, i.e. ROM at #2000.
2015            JP   #0013,INIT_SYS      So this jumps to the RAM.

THE 'FLAGS ADDRESS' RESTART
This is part of the -BIT- routines at address #23C6, the original HL is saved and the
flags address is loaded into HL, in the routines a POP HL restores.

2018 F_ADDR_ROM EX   (SP),HL             HL to stack and return address to HL.
2019            PUSH HL                  Re-stack return address.
201A            LD   HL,#1ACF            Address of flags.
201D            RET                      Return so only original HL on stack.
201E            DEFB #00,#00             Unused locations.

THE 'DISCIPLE ERROR' RESTART
DISCiPLE error routine, a RST 32 followed by a byte will print the appropriate message
unless hookcodes are being executed.

2020 DISC_ERR   LD   HL,(23645)          The address reached by the interpreter
2023            LD   (23647),HL          is copied to the error pointer before
2026            JR   #2035,DISC_ERR2     proceeding.

THE 'NEXT CHARACTER' RESTART
Get next character of BASIC line to be interpreted.

2028 NEXT_C_ROM RST  #10,CALBAS          CALL Spectrum ROM
2029            DEFW #0020,NEXT_CHAR     routine NEXT_CHAR.
202B            RET

THE 'GET CHARACTER' ROUTINE
Get character of BASIC line to be interpreted.

202C GET_C_ROM  RST  #10,CALBAS          CALL Spectrum ROM
202D            DEFW #0018,GET_CHAR      routine GET_CHAR.
202F            RET

THE 'SYNTAX-Z' RESTART
Test the sytax checking flag, NZ means runtime, Z means syntax checking.

2030 SYNTAX_Z   BIT  7,(IY+1)            Flag is in system-var MODE (23617).
2034            RET

THE 'DISC_ERR2' ROUTINE

2035 DISC_ERR2  JP   #3CBC,D_ERROR       Jump to main DISCiPLE error routine.

THE 'MASKABLE INTERRUPT' RESTART
In case of an interupt while the DISCiPLE is paged in, 'nothing' is done.

2038 INT_ROM    EI                       Re-enable interupts before returning.
2039            RET

SOME 'LOST' ASSEMBLER TEXT
Miles-Gordon seem to have lost some of their assembler text: This is the source code for
the routine in RAM at address #154F.

203A            DEFB #50,#13
203C            DEFB #00,#00
203E            DEFB #00,#00
2040            DEFW #50,#14
2042            DEFB #05
2043            DEFM "HOFLE"
2048            DEFB #04
2049            DEFM "CALL"
204D            DEFB #05
204E            DEFM "H"

THE 'UNPAGE' SUBROUTINE
As an intermezzo, here is the routine that pages out the DISCiPLE ROM and returns to the
Spectrum ROM at address #0052. This is just a RET so effectively a jump is made to HL.
This routine is used by CALBAS and to jump to the Spectrum ROM.

204F UNPAGE_HL  PUSH HL                  Put address to jump to on the stack.
2050 UNPAGE_1   OUT  (187),A             Page out the DISCiPLE.
2052            RET                      This statement is not reached.

Now the assembler text continues:

2053            DEFB #00
2054            DEFB #50,#15
2056            DEFB #00
2057            DEFB #04
2058            DEFM "CALL"
205C            DEFB #04
205D            DEFW "SVHD"
2061            DEFB #00
2062            DEFB #50,#16
2064            DEFB #00
2065            DEFB #03

THE 'NON-MASKABLE INTERRUPT' ROUTINE
In case the Spectrum ROM address #0066 is reached, the DISCiPLE is paged-in and this
routine is executed. It is also used by CALBAS. With no system file loaded, only CALBAS
is valid, so in all other cases, a return is made.

2066 NMI_ROM    PUSH AF                  Save the A register on the stack.
2067            LD   A,(#1DE5)
206A            CP   #47                 Check if returning from a CALBAS.
206C            JP   Z,#2074,RET_BASROM  Jump if returning from a CALBAS.
206F            OUT  (187),A             Else page out the DISCiPLE.

This code is never reached.

2071            POP  AF                  Same as in Spectrum ROM, retrieve A
2072            RETN                     and return with old interrupt status.

A return is made to the CALBASsing routine.

2074 RET_BASROM XOR  A                   Clear the A register.
2075            LD   (#1DE5),A           Clear the CALBAS flag.
2078            POP  AF                  Retrieve A register.
2079            RET                      Return to address after RST #10 + DEFW.

THE 'INCREMENT RPT' ROUTINE
This routine is probably a leftover from an older ROM version. It increments the
DISCiPLE's internal RPT.

207A            LD   HL,(#1AD0)
207D            INC  HL
207E            LD   (#1AD0),HL
2081            LD   HL,(#1AD0)
2084            LD   A,(HL)
2085            RET
Previous Next Contents Index