Skip to content

Commit 05fdcef

Browse files
authored
Merge pull request #109 from Konamiman/v2.1.1
2 parents 413810c + fafa398 commit 05fdcef

File tree

13 files changed

+261
-194
lines changed

13 files changed

+261
-194
lines changed
-5.14 KB
Binary file not shown.

source/kernel/Makefile

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# See the "all" main rule for some handy aliases to generate specific ROMs
55
# (e.g. you can run "make base" or "make ide").
66

7-
VERSION := 2.1.1-beta2
7+
VERSION := 2.1.1
88

99
export X80_COMMAND_LINE=-t -nb
1010
export M80_COMMAND_LINE=-8
@@ -31,7 +31,7 @@ endef
3131
### MAIN RULE ###
3232
###################
3333

34-
all: base ide ide-emu ascii8 ascii16 mfrsd flashjacks ocm
34+
all: base ide ide-masteronly ide-emu ide-masteronly-emu ascii8 ascii16 mfrsd flashjacks ocm
3535

3636
TOOLS := M80 L80 LIB80 objcopy sdcc mknexrom dd
3737

@@ -74,6 +74,26 @@ drivers/SunriseIDE/sunride.BIN: \
7474
sjasm -c drivers/SunriseIDE/sunride.asm drivers/SunriseIDE/sunride.BIN
7575

7676

77+
### Sunrise IDE, normal ROM, master device only
78+
79+
ide-masteronly: drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.MasterOnly.ROM
80+
81+
drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.MasterOnly.ROM: \
82+
nextor_base.dat \
83+
drivers/SunriseIDE/sunride.masteronly.BIN \
84+
drivers/SunriseIDE/CHGBNK.BIN
85+
86+
mknexrom nextor_base.dat $@ /d:drivers/SunriseIDE/sunride.masteronly.BIN /m:drivers/SunriseIDE/CHGBNK.BIN
87+
$(call copy_to_bin,$@)
88+
89+
drivers/SunriseIDE/sunride.masteronly.BIN: \
90+
drivers/SunriseIDE/sunride.asm
91+
92+
sed 's/MASTER_ONLY equ 0/MASTER_ONLY equ 1/g' drivers/SunriseIDE/sunride.asm > drivers/SunriseIDE/sunride.masteronly.asm
93+
94+
sjasm -c drivers/SunriseIDE/sunride.masteronly.asm drivers/SunriseIDE/sunride.masteronly.BIN
95+
96+
7797
### Sunrise IDE, ROM for emulators
7898

7999
ide-emu: drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.emulators.ROM
@@ -96,6 +116,30 @@ drivers/SunriseIDE/DRIVER.BIN: \
96116
$(call hex2bin,$(patsubst %.BIN,%,$@))
97117

98118

119+
### Sunrise IDE, ROM for emulators, master device only
120+
121+
ide-masteronly-emu: drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.MasterOnly.emulators.ROM
122+
123+
drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.MasterOnly.emulators.ROM: \
124+
nextor_base.dat \
125+
drivers/SunriseIDE/DRVMONLY.BIN \
126+
drivers/SunriseIDE/CHGBNK.BIN \
127+
256.bytes
128+
129+
cat 256.bytes drivers/SunriseIDE/DRVMONLY.BIN > drivers/SunriseIDE/_driver.BIN
130+
mknexrom nextor_base.dat $@ /d:drivers/SunriseIDE/_driver.BIN /m:drivers/SunriseIDE/CHGBNK.BIN
131+
$(call copy_to_bin,$@)
132+
133+
drivers/SunriseIDE/DRVMONLY.BIN: \
134+
drivers/SunriseIDE/driver.mac
135+
136+
sed 's/MASTER_ONLY equ 0/MASTER_ONLY equ 1/g' drivers/SunriseIDE/driver.mac > drivers/SunriseIDE/drvmonly.mac
137+
138+
M80 -w drivers/SunriseIDE -p ../.. =DRVMONLY
139+
L80 -w drivers/SunriseIDE -p ../../ /P:4100,DRVMONLY,DRVMONLY/N/X/Y/E
140+
$(call hex2bin,$(patsubst %.BIN,%,$@))
141+
142+
99143
### Sunrise IDE, common rules
100144

101145
drivers/SunriseIDE/CHGBNK.BIN: \
@@ -463,6 +507,7 @@ bank6/B6.HEX: \
463507
bank5/fdisk.dat bank5/fdisk2.dat: \
464508
bank5/fdisk_crt0.rel \
465509
bank5/fdisk.h \
510+
bank5/fdisk.c \
466511
$(patsubst %.dat,%.c,$@) \
467512
bank5/drivercall.h \
468513
bank5/drivercall.c \

source/kernel/bank0/init.mac

Lines changed: 68 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -1041,7 +1041,7 @@ OVERRIDE:
10411041
SLAVE:
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+
21142089
TIMINT::
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

21322105
DOS2INT:
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
22202195
PROMPT:
@@ -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

Comments
 (0)