@@ -1041,7 +1041,7 @@ OVERRIDE:
10411041SLAVE:
10421042 ld a,(KER250##+3)
10431043 or a
1044- ret nz ;Return if four 2.50 kernels initialized already
1044+ ret nz ;Return if four Nextor kernels initialized already
10451045
10461046 call VALTBL ;get number of drives declared so far
10471047 ret z ;no room is left
@@ -1480,42 +1480,10 @@ endif
14801480 ld hl,(HIMEM##) ;save HIMEM
14811481 ld (HIMSAV##),hl ;
14821482;
1483- ld hl,H.TIMI ;Save the current setting of
1484- push hl ; the timer interrupt hook
1485- ld de,TIMI_SAVE## ; in our data area.
1486- ld bc,5
1487- ldir
1488- ;===== start add DOS2.50 (support MegaSCSI)
1489- ld hl,_TIME_IRQ##
1490- ld de,@TIME_IRQ##
1491- call MYHOOK
1492- ;===== end add DOS2.50
1493- pop hl ;Now set up an inter-slot call
1494-
1495- ;This "patch for MegaSCSI" was causing the kanji mode to not work
1496- ;(CALL KANJI hanging the computer)
1497- ;since the Kanji ROM timer interrupt routine assumes that the
1498- ;previous hook is either a RET or a RST 30h (not a CALL!)
1499- if 0
1500- ;===== start mod DOS2.50 (support MegaSCSI)
1501- ld de,_TIME_IRQ## ; to our timer interrupt
1502- ld (hl),0;NOP ; routine in this ROM page.
1503- inc hl
1504- ld (hl),0CDh;CALL
1505- inc hl
1506- ld (hl),e
1507- inc hl
1508- ld (hl),d
1509- inc hl
1510- ld (hl),0C9h;RET
1511- else
1483+ ld hl,TIMI_SAVE##
15121484 ld de,@TIME_IRQ##
1513- call MYHOOK
1514- endif
1485+ call SAVE_AND_PATCH_HTIMI
15151486
1516- ;; ld de,@TIME_IRQ##
1517- ;; call MYHOOK
1518- ;===== end mod DOS2.50
15191487;
15201488; Establish extended BIOS hook
15211489;
@@ -2111,36 +2079,46 @@ endif
21112079;
21122080;------------------------------------------------------------------------------
21132081;
2082+ ; Timer interrupt handler.
2083+ ;
2084+ ; Note that both in normal mode and in DOS 1 mode jumping to the previous
2085+ ; hook will trigger the chain of interrupt routines for the drivers
2086+ ; attached to MSX-DOS 1 kernels (each will call its "previous hook"
2087+ ; as configured in HOOKSAV).
2088+
21142089TIMINT::
21152090 push af ;Save VDP status
21162091 ld a,(DOS_VER##)
21172092 or a
21182093 jr nz,DOS2INT
21192094
2120- ;Interrupt handler, DOS 1 version
21212095
2122- call TIMI_250 ;Call 2.50 kernels driver interrupt routine.
2123- ex af,af'
2124- pop af ;Restore VDP status
2125- ex af,af'
2126- ld a,3
2127- ld ix,PRV1INT##
2128- jp CALBNK##
2096+ ;Interrupt handler, DOS 1 mode version
2097+
2098+ call TIMI_NEXTOR_DRV ;Call interrupt routine for Nextor drivers.
2099+ pop af ;Restore VDP status.
2100+ jp TM1_SAVE## ;Jump to the previous interrupt routine.
2101+
21292102
2130- ;Interrupt handler, DOS 2 version
2103+ ;Interrupt handler, normal (" DOS 2 mode") version
21312104
21322105DOS2INT:
21332106 call TIME_IRQ## ;Call the master interrupt routine.
2134- call TIMI_DRV ;Call driver interrupt routine in turn .
2135- call TIMI_250 ;Call 2.50 kernels driver interrupt routine .
2136- pop af ;Restore VDP status
2137- jp TIMI_SAVE##
2107+ call TIMI_DOS2_DRV ;Call interrupt routines of drivers attached to DOS 2 kernels .
2108+ call TIMI_NEXTOR_DRV ;Call interrupt routine for Nextor drivers .
2109+ pop af ;Restore VDP status.
2110+ jp TIMI_SAVE## ;Jump to the previous interrupt routine.
21382111
2139- TIMI_DRV:
2112+
2113+ TIMI_DOS2_DRV:
21402114;
2141- ; Call all possible disk drivers interrupt which is combined with
2142- ; new DOS2 code. This is because the disk drivers entry may not
2143- ; be revealed at this point (because of local banking)
2115+ ; Call the interrupt routines of drivers attached to MSX-DOS 2 kernels.
2116+ ; These are the ones that have an entry in HOOKSAV whose slot number matches
2117+ ; the entry with the same index in DRVTBL, thus representing a "my hook" entry
2118+ ; (if the slot number is different then the HOOKSAV entry has been
2119+ ; set by a driver attached to a MSX-DOS 1 kernel, and in this case
2120+ ; it represents a "previous hook" entry and the driver itself will call it
2121+ ; at the end of its own interrupt routine).
21442122;
21452123 ld de,DRVTBL
21462124 ld hl,HOOKSAV
@@ -2151,26 +2129,22 @@ scan_loop:
21512129 ret z ; yes, done
21522130
21532131 inc de
2154- ld a,(de) ;Get slot address
2132+ ld a,(de) ;Get slot address from DRVTBL
21552133 inc de
2156- cp (hl) ; same?
2157- jr nz,next_cart ; no, this has been set by
2158- ; old SETINT
2159- ld a,(MASTER_SLOT##)
2160- cp (hl) ;Is it me?
2161- ld a,(hl) ; assume not
2134+ cp (hl) ; same slot number in equivalent HOOKSAV entry?
2135+ jr nz,next_cart ; no, HOOKSAV entry has been set by DOS 1 SETINT
2136+ ld a,(hl) ; slot number
21622137 push bc ; save count
21632138 push de ; DRVTBL pointer
21642139 push hl ; HOOKSAV pointer
21652140 inc hl
21662141 ld e,(hl)
21672142 inc hl
21682143 ld d,(hl)
2169- push af
2170- pop iy
2144+ db 0FDh,67h ;LD IYh,A
21712145 push de
21722146 pop ix
2173- call call_drv
2147+ call CALSLT
21742148 pop hl
21752149 pop de
21762150 pop bc
@@ -2181,21 +2155,18 @@ next_cart:
21812155 djnz scan_loop
21822156 ret
21832157;
2184- call_drv:
2185- jp nz,CALSLT ;Was slave, call thru inter-slot call
2186- jp (ix) ;Was me, just call my slot.
21872158;
21882159;
2189- TIMI_250 :
2160+ TIMI_NEXTOR_DRV :
21902161;
2191- ; Call the interrupt routine of DOS 2.50 kernels
2162+ ; Call the interrupt routine of all drivers attached to Nextor kernels.
21922163;
21932164 ld hl,KER250
21942165 ld b,4
2195- T250_LOOP :
2166+ TNEX_LOOP :
21962167 ld a,(hl)
21972168 bit 6,a ;Zero if empty entry or if no interrupt declared
2198- jr z,T250_DJNZ
2169+ jr z,TNEX_DJNZ
21992170
22002171 push hl
22012172 push bc
@@ -2210,11 +2181,15 @@ T250_LOOP:
22102181 pop bc
22112182 pop hl
22122183
2213- T250_DJNZ :
2184+ TNEX_DJNZ :
22142185 inc hl
2215- djnz T250_LOOP
2186+ djnz TNEX_LOOP
22162187 ret
22172188
2189+ call_drv:
2190+ jp nz,CALSLT ;Was slave, call thru inter-slot call
2191+ jp (ix) ;Was me, just call my slot.
2192+
22182193;
22192194 ;public PROMPT
22202195PROMPT:
@@ -2346,35 +2321,6 @@ ADDHLBC:
23462321 add hl,bc
23472322 ret
23482323
2349- ;
2350- ; Define disk driver's timer interrupt entry
2351- ;
2352- ; HL = timer interrupt entry address
2353- ;
2354- public SETINT
2355- SETINT:
2356- ex de,hl ; de = interrupt entry
2357- call GSLOT1##
2358- push af ; save slot number
2359- call GET_DISKID_HL
2360- ld a,(hl) ;(DISKID) ; make a pointer to HOOKSAV
2361- ld hl,HOOKSAV
2362- call ADDHLBC
2363- add hl,bc
2364- add hl,bc
2365- pop af
2366- ld (hl),a
2367- inc hl
2368- ld (hl),e
2369- inc hl
2370- ld (hl),d
2371- ;
2372- ; Return from disk driver interrupt (was jump to previous hook in DOS1)
2373- ;
2374- public PRVINT
2375- PRVINT:
2376- ret
2377-
23782324;
23792325;-----------------------------------------------------------------------
23802326;
@@ -2943,17 +2889,9 @@ olddos_9:
29432889 ld de,@EXTBIO##
29442890 call MYHOOK
29452891
2946- ld a,3 ;Do a DOS1 style SETINT
2947- ld ix,SET1INT##
2948- ld hl,@TIME_IRQ##
2949- call CALBNK##
2950-
2951- ;ld a,(FCALSAV##) ;TODO: Investigate why FCALSAV is all zeros
2952- ;or a ;at this point (should be all RETs)
2953- ;jr nz,FCALSAV_OK
2954- ;ld a,0C9h ;Code for RET
2955- ;ld (FCALSAV##),a
2956- ;FCALSAV_OK:
2892+ ld hl,TM1_SAVE##
2893+ ld de,@TIME_IRQ##
2894+ call SAVE_AND_PATCH_HTIMI
29572895
29582896 ld a,3
29592897 ld (MAIN_BANK##),a
@@ -2962,6 +2900,25 @@ olddos_9:
29622900 push hl ; CLEAN+11h (just after RET P) of
29632901 ld a,3 ; INIT.Z80, not INIT.MAC (this code).
29642902 jp CHGBNK
2903+
2904+
2905+ ; Make a copy of H.TIMI hook and then patch it to point to another address
2906+ ; of our slot via interslot call.
2907+ ;
2908+ ; In: HL = Address for the copy
2909+ ; DE = New destination address (in main Nextor kernel) for the hook
2910+
2911+ SAVE_AND_PATCH_HTIMI:
2912+ push de
2913+ ex de,hl
2914+ ld hl,H.TIMI
2915+ push hl
2916+ ld bc,5
2917+ ldir
2918+ pop hl
2919+ pop de
2920+ jp MYHOOK
2921+
29652922;
29662923;
29672924;===== start add DOS2.50 (build type)
0 commit comments