Previous Next Contents Index
The periodic routines

THE '"P" CHANNEL DATA' TABLE
Here follow the '5' bytes that compose the DISCiPLE "P" channel.

221A P_CHANNEL  DEFW #0008
221C            DEFW #0008
221E            DEFB "P"

THE 'TAKEOVER PRINTER' SUBROUTINE
Being a PUPIL the Spectrum/DISCiPLE can't use its own printer. Instead all characters
send to the "P" channel are send to the master station. By changing the "P" channels
in- and output addresses, the data can be transmitted to the master. This routine is
executed every interrupt.

221F TAKE_PRTR  LD   HL,(23631)          Get address of channel data (CHANS).
2222            LD   BC,15               Offset for channel "P".
2225            ADD  HL,BC
2226            EX   DE,HL
2227            LD   HL,#021A            Copy the "P" channel data.
222A            LD   BC,5
222D            LDIR
222F            LD   L,#2F               Restore registers for 'main' ROM
2231            LD   DE,#FFFF            'KEY_SCAN'.
2234            LD   BC,#FEFE
2237            JR   #2294,KSCAN_RET     Return into the 'KEY_SCAN' routine.

MORE 'LOST' ASSEMBLER TEXT
Again Miles-Gordon have lost some assembler text: This time it's the source code for
the routine in RAM at address #1595.

2239            DEFB #00,#05
223B            DEFM "BTCNT"
2240            DEFB #00
2241            DEFB #50,#55
2243            DEFB #00,#04
2245            DEFM "LDIR"
2249            DEFB #00,#00
224B            DEFB #50,#56
224E            DEFB #04
224F            DEFM "PUSH"
2253            DEFB #02
2254            DEFM "DE"
2256            DEFB #00
2257            DEFb #50,#57
2259            DEFB #00,#03
225B            DEFM "POP"
225E            DEFB #02
225F            DEFM "IX"
2261            DEFB #00
2262            DEFB #50,#58
2264            DEFB #00,#03
2266            DEFM "POP"
2269            DEFB #02
226A            DEFM "DE"
226C            DEFB #00
226D            DEFB #50,#59
226F            DEFB #00,#03
2271            DEFM "POP"
2274            DEFB #02
2275            DEFM "BC"
2277            DEFB #00
2278            DEFB #50,#60
227A            DEFB #00,#03
227C            DEFM "RET"
227F            DEFB #00,#00
2281            DEFb #50,#61
2283            DEFB #00,#00,#00,#00
2287            DEFB #50,#62
2289            DEFB #00,#00,#00,#00
228D            DEFB #50

THE 'KEY_SCAN' ROUTINE
Whenever the Z80 reaches address #028E, i.e. the 'main' ROM 'KEY_SCAN' routine, the
DISCiPLE is paged-in. The action taken depends on the contents of #1DE4 (or #3DE4 when
the RAM is high). The DISCiPLE ROM is low after power-up, reset and IN 123.

228E KSCAN_ROM  LD   L,#2F               Same instruction as in 'main' ROM.
2290            JR   #229D,KSCAN_ROM1    Jump over the page-out part.

2292 KSCAN_RES  OUT  (123),A             Reset boot, ROM high.
2294 KSCAN_RET  OUT  (187),A             Page-out into the 'main' ROM
                                         'KEY_SCAN'.

SOME 'LEFTOVER' SYSTEM VARIABLES
It seems that MGT has lost some system variables also.

2296 'D_ERRSP'  DEFW #0000
2298 'RBCC'     DEFB 0
2299 'TRAKS1'   DEFB 208
229A 'TRAKS2'   DEFB 208
229B 'STPRAT'   DEFB 12
229C 'NSTAT'    DEFB 0

Now the 'KSCAN_ROM' routine continues.

229D KSCAN_ROM1 LD   DE,#FFFF            Set registers as needed by 'main' ROM
22A0            LD   BC,#FEFE            'KEY_SCAN'.

By examining the contents of #1DE4 when RAM is paged-in low, or #3DE4 when it's paged-in
high, this routine decides what has to be done:
- Whenever the power is turned on, the ROM resides low. #1DE4 contains #45, so
  #3DE4 is examined which contains some random value (should that be #44, the
  Spectrum will crash). Otherwise a 'minimal' system is created by copying the
  first 2335 bytes of ROM to RAM and then setting RAM low. This is indicated by
  #1DE4 containing #53.
- In case of a minimal system #1DE4 contains #53, and the routine returns
  immediately to the keyboard routine in 'main' ROM.
- By giving FORMAT nn (2nd n>=10) a minimal system can be changed to a PUPIL
  system. This is indicated by a #4E value in #1DE4. In this case the routine
  continues with scanning the network for activity.
- By giving RUN at a minimal system, the system file is loaded from disk. If a
  system file has been loaded #1DE4 contains #44.
- To get rid of a system file the reset button has to be pressed twice or IN 123
  has to be given twice. After the first of these ROM resides low, #1DE4 holds #45
  so #3DE4 is inspected which holds #44. The contents of #3DE4 are set to #00 and
  some DISCiPLE system variables are reset. Before returning the RAM is set low
  again.
- When pressing reset or giving IN 123 for the second time, #3DE4 (RAM is now high)
  holds #00. This means a minimal system will be created.
- By giving IN 123 or a reset once, a minimal or PUPIL system can be reset, which
  results in a minimal system being created.

22A3            LD   A,(#1DE4)
22A6            CP   #4E
22A8            JP   Z,#035D,NET_SERVER  Jump if this is a PUPIL.
22AB            CP   #53                 Exit immediately if the 'minimal' system
22AD            JR   Z,#2294,KSCAN_RET   is active. When the DROM is low #1DE4
                                         contains #45.

22AF            LD   A,(#3DE4)           RAM is now paged-in high.
22B2            CP   #44
22B4            JR   NZ,#22BC,SET_BOOT   Jump if system file no longer supposed
                                         to be active.
22B6            XOR  A                   Otherwise the next time the ROM is
22B7            LD   (#3DE4),A           found low the system will become
22BA            JR   #22D4,RESET_VARS    inactive. Jump to reset some variables.

The routine now initialises a 'minimal' system, i.e. no pupil and no system loaded.

22BC SET_BOOT   PUSH BC
22BD            PUSH DE
22BE            LD   HL,#0000            Copy the first 2335 bytes in ROM to the
22C1            LD   DE,#2000            RAM.
22C4            LD   BC,#091F
22C7            LDIR
22C9            POP  DE
22CA            POP  BC
22CB            LD   A,#53               Signal 'minimal system initialized'.
22CD            LD   (#3DE4),A
22D0            XOR  A
22D1            LD   (#3DDA),A           Reset control port state.
22D4 RESET_VARS LD   (#3DEF),A           Reset @6999.
22D7            LD   (#3DE5),A
22DA            LD   (#3ACF),A           Reset FLAGS3.
22DD            LD   HL,#0000            Reset D_ERR_SP.
22E0            LD   (#2296),HL
22E3            LD   A,(#3DDA)           Activate new control port settings.
22E6            OUT  (31),A
22E8            LD   HL,275              The disk buffer offset.
22EB            LD   (#3AD2),HL
22EE            LD   L,#2F               Restore registers for 'main' ROMs
22F0            JR   #2292,KSCAN_RES     'KEY_SCAN' and exit resetting boot.

THE 'POWER_UP2' ROUTINE
The routine continues, with the proper register  contents, in the 'main' ROM
'START/NEW' routine.

22F2 POWER_UP2  LD   A,#02               Red instead of black border.
22F4            OUT  (254),A
22F6            LD   A,#3F               Set interrupt vector.
22F8            LD   I,A
22FA            NOP
22FB            NOP
22FC            NOP
22FD            NOP
22FE            NOP
22FF            NOP
2300            XOR  A                   The resetting of the control lines has
2301            OUT  (31),A              been done already (at #0001).
2303            OUT  (251),A             Reset the printer port too.
2305            LD   HL,#7FFF            The stackpointer has to point into RAM,
2308            LD   SP,HL               otherwise: trouble (for the
                                         UNPAGE_HL routine).
2309            IM   1                   Set interrupt mode 1.
230B            XOR  A                   Restore registers for 'main' ROM
230C            LD   DE,65535            'START/NEW'.
230F            LD   HL,#11CB,START/NEW
2312            JP   #004F,UNPAGE_HL     Jump to 'START/NEW' in the 'main' ROM.
Previous Next Contents Index