Previous Next Contents Index
The hook and command code routine &
   The command code table

This routine is entered with the A register holding an 'IF1 hook code', a
'DISCiPLE command code' or an invalid error code. The routine calls a set of
subroutines in the DISCiPLE system, and is intended to help machine-code access
to the drives. There are two tables containing addresses of the routines, the first
is located in ROM and consists of the addresses of the routines for the IF1 hookcodes.
The second table is located at address #050B and consists of the addresses of the
DISCiPLE command code routines.

04C3 HOOK_CODE  LD   (#1AC5),DE
04C7            CP   24
04C9            JR   NC,#04F1,COMM_CODE  Jump if code isn't a hook code.
04CB            LD   DE,#29D2            Address of hook (IF1) code table.
04CE CODE_CONT  LD   (IY+0),#FF          Clear error.
04D2            SET  2,(IY+1)            What's the purpose of this?
04D6            INC  HL                  Advance return address past the code.
04D7            PUSH HL
04D8            ADD  A,A                 Table is made of two byte addresses, so
04D9            LD   L,A                 double code.
04DA            LD   H,0
04DC            ADD  HL,DE               Point codes entry in table.
04DD            LD   E,(HL)              Fetch the address of the routine.
04DE            INC  HL
04DF            LD   D,(HL)
04E0            LD   HL,#04FD,HOOK_RET   Return address after completion of
04E3            PUSH HL                  code.
04E4            LD   (#0296),SP          Set D_ERR_SP.
04E8            EX   DE,HL
04E9            LD   DE,(#1AC5)          Restore DE and A.
04ED            LD   A,(#1DEA)
04F0 JP_HL      JP   (HL)                Jump to the routine.

04F1 COMM_CODE  SUB  24                  Adjust range for command codes (0..20).
04F3            CP   21
04F5            JP   NC,#2942,REP_17     Give error if not a command code.
04F8            LD   DE,#050B            Address of command code table.
04FB            JR   #04CE,CODE_CONT     Continue with command codes.

THE 'HOOK_RET' ROUTINE
This routine is entered whenever a hook or command code is finished.

04FD HOOK_RET   PUSH HL
04FE            LD   HL,#0000
0501            LD   (#0296),HL          Clear D_ERR_SP.
0504            POP  HL
0505            CALL #297B,JBORD_REST    Return to the calling routine with the
0508            JP   #0050,UNPAGE_1      'main' ROM paged in.

THE 'COMMAND CODE ADRESSES' TABLE
This jump table consists of the 21 addresses of the routines called by using the
various 'command codes'. Command code 70 and 71 were added in system 3d.

050B            DEFW #1539,HXFER         Command code #33, 51.
050D            DEFW #154C,OFSM          Command code #34, 52.
050F            DEFW #1552,HOFLE         Command code #35, 53.
0511            DEFW #29C3,JSBYT         Command code #36, 54.
0513            DEFW #1559,HSVBK         Command code #37, 55.
0515            DEFW #2981,JCFSM         Command code #38, 56.
0517            DEFW #1944,PNTP          Command code #39, 57.
0519            DEFW #164C,COPS          Command code #3A, 58.
051B            DEFW #155F,HGFLE         Command code #3B, 59.
051D            DEFW #29A2,JLBYT         Command code #3C, 60.
051F            DEFW #1565,HLDBK         Command code #3D, 61.
0521            DEFW #15C4,WSAD          Command code #3E, 62.
0523            DEFW #15BD,RSAD          Command code #3F, 63.
0525            DEFW #29BA,JREST         Command code #40, 64.
0527            DEFW #156B,HERAZ         Command code #41, 65.
0529            DEFW #16B2,COPS2         Command code #42, 66.
052B            DEFW #08AA,PCAT          Command code #43, 67.
052D            DEFW #1582,HRSAD         Command code #44, 68.
052F            DEFW #15A0,HWSAD         Command code #45, 69.
0531            DEFW #0287,OTFOC         Command code #46, 70.
0533            DEFW #136B,PATCH         Command code #47, 71.

0535 UNDEFINED  RET                      This RET was used in older systemfiles
                                         for undefined command codes.
Previous Next Contents Index