Previous Next Contents Index
The restart routines

THE 'USR 0' RESTART
When address #0001 (NOT #0000!) is reached the DISCiPLE hardware pages in the
DISCiPLE RAM/ROM. (RAM at #0000) NOTE: On power up or when the reset button is
pressed the ROM is paged in at address #0000.

0000 USR_0      DI                       Disable the 'keyboard interrupt'.
0001            XOR  A                   #00 for 'USR 0' (#FF for 'NEW').
0002            OUT  (31),A              Reset control lines.
0004            JP   #04BA,USR_0_1       Continue with the 'USR_0' routine.
0007            DEFB #00                 Unused location.

THE 'USE GDOS' RESTART
This is the main entry point to the DISCiPLE 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   #003A,START_2       (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 DISCiPLE
system. It can be called by using a RST #10 instruction, followed by the address of
the 'main' ROM subroutine.

0010 CALBAS     JP   #0499,CALBAS_2        Jump forward.

THE 'INITIALIZE SYSTEM' ROUTINE
This is part of the boot routine, after loading the system file (using the ROM routine)
control is transferred to this address.

0013 INIT_SYS   OUT  (123),A             Resets boot, i.e. ROM at #2000.
0015            JP   #0550,LOAD_AUTO     Jump forward.

THE 'FLAGS ADDRESS' RESTART
This routine is used by the -BIT- routines at address #09CE, the original HL is
saved and the flags address is loaded into HL.

0018 F_ADDR_RAM EX   (SP),HL             Exchange RETurn address and HL.
0019            PUSH HL                  Re-stack RETurn address.
001A            LD   HL,#1ACF            Address of FLAGS3.
001D            RET
001E            DEFB #00,#00             Unused locations.

THE 'DISCiPLE 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_RAM RST  16,CALBAS           Call 'main' ROM 'NEXT_CHAR'.
0029            DEFW #0020,NEXT_CHAR
002B            RET

THE 'GET CHAR' ROUTINE
Get character by calling the 'main' ROM restart.

002C GET_C_RAM  RST  16,CALBAS           Call 'main' ROM 'GET_CHAR'.
002D            DEFW #0018,GET_CHAR
002F            RET

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.
0034            RET

THE 'DISC_ERR2' ROUTINE

0035 DISC_ERR2  JP   #2990,JD_ERROR      Continue with the DISCiPLE error
                                         routine.

THE 'MASKABLE INTERRUPT' RESTART
While the DISCiPLE system is paged in, 'nothing' is done during a interrupt.

0038 INT_RAM    EI                       Enable interrupts before RETurning.
0039            RET

THE 'START_2' ROUTINE

003A START_2    JP   #0597,START_3       Continue with the DISCiPLE systems main
                                         entry routine.
Previous Next Contents Index