From 2590cbc1ea89c40a1a8f10f80c94ef8b7d83b4a5 Mon Sep 17 00:00:00 2001 From: uniabis Date: Thu, 7 Apr 2022 12:51:12 +0900 Subject: [PATCH 1/9] EXB_RAM restore secondary slot(#75) --- source/kernel/bank1/mapinit.mac | 61 +++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/source/kernel/bank1/mapinit.mac b/source/kernel/bank1/mapinit.mac index 4df88569..5d03ff11 100644 --- a/source/kernel/bank1/mapinit.mac +++ b/source/kernel/bank1/mapinit.mac @@ -754,10 +754,23 @@ EXB_NEX: ; exx ex af,af' + ld hl,EXB_RAM ld de,($SECBUF##) ld bc,EXB_RAM_END-EXB_RAM ldir + + ld hl, +(EXB_SLOT_RESTORE+1)-EXB_RAM_END + add hl, de + ld c, l + ld b, h + + ld de, +(EXB_SLOT_BACKUP+1)-(EXB_SLOT_RESTORE+1) + add hl, de + ld (hl), c + inc hl + ld (hl), b + ex af,af' exx ld ix,($SECBUF##) @@ -787,8 +800,34 @@ EXB_LOOP: push bc push de push hl + + ld a, (ix) + add a, a + jr nc, EXB_SKIP_BACKUP + + rrca + and 3 + ld e, a + + ld hl, SLTTBL + ld d, 0 + add hl, de + ld a, (hl) + and 0Ch + or e + or 80h + jr EXB_SLOT_BACKUP + +EXB_SKIP_BACKUP: + xor a + +EXB_SLOT_BACKUP: + ld (EXB_SLOT_RESTORE + 1), a + + ld a,(ix) and 10001111b + ld h,40h call ENASLT ld hl,DV_EXTBIO## @@ -802,6 +841,28 @@ EXB_LOOP: pop af call CALDRV## + push af + +EXB_SLOT_RESTORE: + ld a, 00h + or a + jr z, EXB_SKIP_RESTORE + + push bc + push de + push hl + + ld h, 40h + call ENASLT + + pop hl + pop de + pop bc + +EXB_SKIP_RESTORE: + + pop af + pop iy pop ix exx From d8539516dd2889dbdffc743667b91515a847cf9c Mon Sep 17 00:00:00 2001 From: uniabis Date: Mon, 16 May 2022 09:56:36 +0900 Subject: [PATCH 2/9] Delete duplicated image. --- docs/img/gsg/Partitions2And4Active.PNG | Bin 5264 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 docs/img/gsg/Partitions2And4Active.PNG diff --git a/docs/img/gsg/Partitions2And4Active.PNG b/docs/img/gsg/Partitions2And4Active.PNG deleted file mode 100644 index 7d0cb2ff8d0b11b2c53c161ee6626282fc2433a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5264 zcmbW5c{r5c-^WSF)|e(+VvMntVkEL<8-@%L60%K}WJ^g#jO;VABw>(UgF=>xvM;x7 zX1*xdE3%9&#h|{UDbMt~e$W5U_55+pxz73HT-W`%&inm&y>G&0Ym^ZG34RU^4j~J3 zJnY#gxK)6?aNfOwGUliqKDox;9QHM`GUDK+cp>bY+Tzc_W#N1kM*|vS=C)~$R4&&Yj!C4LsdN9wM<^Wn; z?id2XLqO8vjby>+JRkqRkHilnK-zLtkj|iue{39Rm?3Ye0B$nsxZEH8N(I{+S%RLr z-K)|$A6xp-T9=7k_lOf}V6k=-NB9ETLNa_?H~W`$zw4cP@EKbc>G69{U|JzR#ml5u z2G1OXJK^S{aLy3D-OJg&({j?`9(r?eAZyCM-?N@u=YRk6OVPWhw$+E(c_6wxtUozo z$J_e#$#V38KGxdfd;253iUQ5EE8T`ijSlutQ-4nT+CxDC4N*U(h7uF8iu6)br$19S zK0$Vhq8nHv1_L4A+spLG0(>y>fhU%PNZVVi55shiO>aI_S|_}KNWRS}aNYaQ{2sdBKK^NnE9o+2ok zAEZOs`FPg}_a(sz_s+DherXBzJ!HU}8GYc*+#ayWj`}gJa=`R0BBG?SmZ{kyUZo!+ zHmvAX0^l70f|``AZV$_LzvqxWcX#9s>&I*(Ykva;T(6g<+FXE9K?Zu%PA2J16OwjB zhOSt29BwxWkm1jgKn5yi=ek0O!<9Y%%-%>JB7-g}4Nt@AxxPNk0jSudDCv9xzRFMc za2cyCJ&h`JN*!!B)>^=TAfy7wwunz3!(6hXw@sfBm�RmD)l<-axtZ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kernel/bank1/mapinit.mac | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source/kernel/bank1/mapinit.mac b/source/kernel/bank1/mapinit.mac index 5d03ff11..0938a231 100644 --- a/source/kernel/bank1/mapinit.mac +++ b/source/kernel/bank1/mapinit.mac @@ -755,26 +755,27 @@ EXB_NEX: exx ex af,af' - ld hl,EXB_RAM ld de,($SECBUF##) + push de + + ld hl,EXB_RAM ld bc,EXB_RAM_END-EXB_RAM ldir ld hl, +(EXB_SLOT_RESTORE+1)-EXB_RAM_END add hl, de - ld c, l - ld b, h + ex de, hl - ld de, +(EXB_SLOT_BACKUP+1)-(EXB_SLOT_RESTORE+1) + ld hl, +(EXB_SLOT_BACKUP+1)-(EXB_SLOT_RESTORE+1) add hl, de - ld (hl), c + ld (hl), e inc hl - ld (hl), b + ld (hl), d ex af,af' exx - ld ix,($SECBUF##) - jp (ix) + + ret ;--- From here is copied to RAM EXB_RAM: From 7989db468ae52041b94d2b03fb3c5bf1498cb060 Mon Sep 17 00:00:00 2001 From: uniabis Date: Mon, 20 Jun 2022 10:17:36 +0900 Subject: [PATCH 4/9] More optimization. --- source/kernel/bank1/mapinit.mac | 36 ++++++++++++++------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/source/kernel/bank1/mapinit.mac b/source/kernel/bank1/mapinit.mac index 0938a231..22d68ca2 100644 --- a/source/kernel/bank1/mapinit.mac +++ b/source/kernel/bank1/mapinit.mac @@ -802,31 +802,25 @@ EXB_LOOP: push de push hl - ld a, (ix) - add a, a - jr nc, EXB_SKIP_BACKUP + ld a,(ix) + ld d,a + and 80h + jr z,EXB_SLOT_BACKUP - rrca + ld a,d and 3 - ld e, a - - ld hl, SLTTBL - ld d, 0 - add hl, de - ld a, (hl) + ld e,a + ld hl,SLTTBL + add a,l + ld l,a + ld a,(hl) and 0Ch or e or 80h - jr EXB_SLOT_BACKUP - -EXB_SKIP_BACKUP: - xor a EXB_SLOT_BACKUP: - ld (EXB_SLOT_RESTORE + 1), a - - - ld a,(ix) + ld (EXB_SLOT_RESTORE+1),a + ld a,d and 10001111b ld h,40h @@ -845,15 +839,15 @@ EXB_SLOT_BACKUP: push af EXB_SLOT_RESTORE: - ld a, 00h + ld a,00h or a - jr z, EXB_SKIP_RESTORE + jr z,EXB_SKIP_RESTORE push bc push de push hl - ld h, 40h + ld h,40h call ENASLT pop hl From 39ac45ba0d8f3c4ec7af630659f73bf5cc5b1073 Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Mon, 4 Jul 2022 11:25:08 +0200 Subject: [PATCH 5/9] Add "master only" editions for the Sunrise IDE ROMs. Makefile and driver sources have been modified so that now two additional kernels will be generated: Nextor-(version).SunriseIDE.MasterOnly.ROM and Nextor-(version).SunriseIDE.MasterOnly.emulators.ROM --- source/kernel/Makefile | 46 +++++++++++++++++++- source/kernel/drivers/SunriseIDE/.gitignore | 2 + source/kernel/drivers/SunriseIDE/driver.mac | 30 +++++++++++++ source/kernel/drivers/SunriseIDE/sunride.asm | 18 ++++++++ 4 files changed, 95 insertions(+), 1 deletion(-) create mode 100644 source/kernel/drivers/SunriseIDE/.gitignore diff --git a/source/kernel/Makefile b/source/kernel/Makefile index 2b957256..0b96218a 100644 --- a/source/kernel/Makefile +++ b/source/kernel/Makefile @@ -31,7 +31,7 @@ endef ### MAIN RULE ### ################### -all: base ide ide-emu ascii8 ascii16 mfrsd flashjacks ocm +all: base ide ide-masteronly ide-emu ide-masteronly-emu ascii8 ascii16 mfrsd flashjacks ocm TOOLS := M80 L80 LIB80 objcopy sdcc mknexrom dd @@ -74,6 +74,26 @@ drivers/SunriseIDE/sunride.BIN: \ sjasm -c drivers/SunriseIDE/sunride.asm drivers/SunriseIDE/sunride.BIN +### Sunrise IDE, normal ROM, master device only + +ide-masteronly: drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.MasterOnly.ROM + +drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.MasterOnly.ROM: \ + nextor_base.dat \ + drivers/SunriseIDE/sunride.masteronly.BIN \ + drivers/SunriseIDE/CHGBNK.BIN + + mknexrom nextor_base.dat $@ /d:drivers/SunriseIDE/sunride.masteronly.BIN /m:drivers/SunriseIDE/CHGBNK.BIN + $(call copy_to_bin,$@) + +drivers/SunriseIDE/sunride.masteronly.BIN: \ + drivers/SunriseIDE/sunride.asm + + sed 's/MASTER_ONLY equ 0/MASTER_ONLY equ 1/g' drivers/SunriseIDE/sunride.asm > drivers/SunriseIDE/sunride.masteronly.asm + + sjasm -c drivers/SunriseIDE/sunride.masteronly.asm drivers/SunriseIDE/sunride.masteronly.BIN + + ### Sunrise IDE, ROM for emulators ide-emu: drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.emulators.ROM @@ -96,6 +116,30 @@ drivers/SunriseIDE/DRIVER.BIN: \ $(call hex2bin,$(patsubst %.BIN,%,$@)) +### Sunrise IDE, ROM for emulators, master device only + +ide-masteronly-emu: drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.MasterOnly.emulators.ROM + +drivers/SunriseIDE/Nextor-$(VERSION).SunriseIDE.MasterOnly.emulators.ROM: \ + nextor_base.dat \ + drivers/SunriseIDE/DRVMONLY.BIN \ + drivers/SunriseIDE/CHGBNK.BIN \ + 256.bytes + + cat 256.bytes drivers/SunriseIDE/DRVMONLY.BIN > drivers/SunriseIDE/_driver.BIN + mknexrom nextor_base.dat $@ /d:drivers/SunriseIDE/_driver.BIN /m:drivers/SunriseIDE/CHGBNK.BIN + $(call copy_to_bin,$@) + +drivers/SunriseIDE/DRVMONLY.BIN: \ + drivers/SunriseIDE/driver.mac + + sed 's/MASTER_ONLY equ 0/MASTER_ONLY equ 1/g' drivers/SunriseIDE/driver.mac > drivers/SunriseIDE/drvmonly.mac + + M80 -w drivers/SunriseIDE -p ../.. =DRVMONLY + L80 -w drivers/SunriseIDE -p ../../ /P:4100,DRVMONLY,DRVMONLY/N/X/Y/E + $(call hex2bin,$(patsubst %.BIN,%,$@)) + + ### Sunrise IDE, common rules drivers/SunriseIDE/CHGBNK.BIN: \ diff --git a/source/kernel/drivers/SunriseIDE/.gitignore b/source/kernel/drivers/SunriseIDE/.gitignore new file mode 100644 index 00000000..3a26c215 --- /dev/null +++ b/source/kernel/drivers/SunriseIDE/.gitignore @@ -0,0 +1,2 @@ +sunride.masteronly.asm +drvmonly.mac diff --git a/source/kernel/drivers/SunriseIDE/driver.mac b/source/kernel/drivers/SunriseIDE/driver.mac index 4bb0845a..26933b18 100644 --- a/source/kernel/drivers/SunriseIDE/driver.mac +++ b/source/kernel/drivers/SunriseIDE/driver.mac @@ -7,6 +7,8 @@ DRV_START: TESTADD equ 0F3F5h +MASTER_ONLY equ 0 + ;----------------------------------------------------------------------------- ; ; Driver configuration constants @@ -406,6 +408,9 @@ WAIT_RESET_END: ld a,1 ;Flag the device ld (ix),a MASTER_CHECK1_END: + +if MASTER_ONLY eq 0 + ld a,46 ;Print dot call CHPUT @@ -442,6 +447,8 @@ SLAVE_CHECK1_END: ld de,CRLF_S call PRINT +endif + ;--- Get info and show the name for the MASTER ld de,MASTER_S @@ -508,6 +515,8 @@ NODEV_MASTER: OK_MASTER: +if MASTER_ONLY eq 0 + ;--- Get info and show the name for the SLAVE ld de,SLAVE_S @@ -580,6 +589,8 @@ OK_SLAVE: xor a ld (IDE_DEVCTRL),a +endif + jr DRV_INIT_END INIT_NO_DEV: @@ -592,8 +603,14 @@ INIT_NO_DEV: call PRINT ld de,NODEVS_S call PRINT + +if MASTER_ONLY eq 0 + ld de,SLAVE_S call PRINT + +endif + ld de,NODEVS_S call PRINT @@ -1671,6 +1688,13 @@ CHECK_DEV_LUN: INFO_S: db "Sunrise IDE driver v" db VER_MAIN+"0",".",VER_SEC+"0",".",VER_REV+"0",13,10 + +if MASTER_ONLY eq 1 + + db "Master device only edition",13,10 + +endif + db "(c) Konamiman 2009",13,10 db "(c) Piter Punk 2014",13,10,13,10,0 @@ -1681,8 +1705,14 @@ NODEVS_S: db "Not found",13,10,0 MASTER_S: db "Master device: ",0 + +if MASTER_ONLY eq 0 + SLAVE_S: db "Slave device: ",0 + +endif + CRLF_S: db 13,10,0 diff --git a/source/kernel/drivers/SunriseIDE/sunride.asm b/source/kernel/drivers/SunriseIDE/sunride.asm index 0f427c66..f99cd3b6 100644 --- a/source/kernel/drivers/SunriseIDE/sunride.asm +++ b/source/kernel/drivers/SunriseIDE/sunride.asm @@ -9,6 +9,8 @@ ds 4100h-$,0 ; DRV_START must be at 4100h DRV_START: +MASTER_ONLY equ 0 + TESTADD equ 0F3F5h TEMP_WORK equ 0C000h @@ -551,6 +553,8 @@ DRV_INIT: jr z,INIT_MASTERFAIL ; Finish DEV_INIT .chkslave: + if MASTER_ONLY = 0 + ld de,SLAVE_S ld (TEMP_WORK+WRKTEMP.pDEVMSG),de call PRINT @@ -572,6 +576,8 @@ DRV_INIT: call DETDEV pop ix + endif + ; Reset all devices to finish END_DETECT: call RESET_ALL @@ -3251,6 +3257,13 @@ INICHKSTOP: INFO_S: db 13,"Sunrise compatible IDE driver v",27,'J' db VER_MAIN+$30,'.',VER_SEC+$30,'.',VER_REV+$30 + + if MASTER_ONLY = 1 + + db 13,10,"Master device only edition" + + endif + CRLF_S: db 13,10,0 COPYRIGHT_S: db "(c) 2009 Konamiman",13,10 @@ -3271,9 +3284,14 @@ INIT_S: db 13,"Initializing : ",27,'J',0 MASTER_S: db 13,"Master device: ",27,'J',0 + + if MASTER_ONLY = 0 + SLAVE_S: db 13,"Slave device : ",27,'J',0 + endif + OK_S: db "Ok",13,10,0 ERROR_S: db "Error!",13,10,0 From 0740e07f2ecbfae752affc2192a8e28bcb5ecf4c Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Wed, 13 Jul 2022 18:26:43 +0200 Subject: [PATCH 6/9] Fix: FDISK not working on korean MSX computers The problem (visible at least in the Daewoo CPC-400) is that the CHPUT routine is supposed to not modify the IX and IY registers, but in this computer it does since it does an inter-slot call to an internal slot (presumably to handle korean characters); this causes the PRINTF routine used by FDISK to crash. Additionally, a small hack is added to print one less "-" character in the upper and lower rulers when that inter-slot call is performed, otherwise the FDISK screen isn't printed properly (it introduces an additional line break for some reason). --- source/kernel/Makefile | 1 + source/kernel/bank5/fdisk.c | 16 ++++++++++++++-- source/tools/C/printf.c | 11 ++++++++++- source/tools/C/system.h | 3 ++- 4 files changed, 27 insertions(+), 4 deletions(-) diff --git a/source/kernel/Makefile b/source/kernel/Makefile index 2b957256..5607a896 100644 --- a/source/kernel/Makefile +++ b/source/kernel/Makefile @@ -463,6 +463,7 @@ bank6/B6.HEX: \ bank5/fdisk.dat bank5/fdisk2.dat: \ bank5/fdisk_crt0.rel \ bank5/fdisk.h \ + bank5/fdisk.c \ $(patsubst %.dat,%.c,$@) \ bank5/drivercall.h \ bank5/drivercall.c \ diff --git a/source/kernel/bank5/fdisk.c b/source/kernel/bank5/fdisk.c index bc91d452..81986dd1 100644 --- a/source/kernel/bank5/fdisk.c +++ b/source/kernel/bank5/fdisk.c @@ -1591,9 +1591,19 @@ void InitializeWorkingScreen(char* header) void PrintRuler() { int i; + byte width; + + // "Hack" for korean MSX computers that do weird things + // when printing a character at the last column of the screen + if(*((byte*)H_CHPH) != 0xC9) { + width = currentScreenConfig.screenWidth - 1; + } + else { + width = currentScreenConfig.screenWidth; + } HomeCursor(); - for(i = 0; i < currentScreenConfig.screenWidth; i++) { + for(i = 0; i < width; i++) { chput('-'); } } @@ -1636,10 +1646,12 @@ void chput(char ch) __naked { __asm push ix - ld ix,#4 + push iy + ld ix,#6 add ix,sp ld a,(ix) call CHPUT + pop iy pop ix ret __endasm; diff --git a/source/tools/C/printf.c b/source/tools/C/printf.c index 31c38094..3e908e0f 100644 --- a/source/tools/C/printf.c +++ b/source/tools/C/printf.c @@ -74,12 +74,21 @@ static void do_char(const char* buf, char c) __naked jp z,5 #else ld a,e - jp z,CHPUT + jr z,DO_CHPUT #endif ld (hl),e ret + ;CHPUT shouldnt modify IX and IY but on some buggy MSX models it does +DO_CHPUT: + push ix + push iy + call CHPUT + pop iy + pop ix + ret + __endasm; } diff --git a/source/tools/C/system.h b/source/tools/C/system.h index 4ab4a7ec..c3d3bd9a 100644 --- a/source/tools/C/system.h +++ b/source/tools/C/system.h @@ -43,5 +43,6 @@ #define DAC 0xF7F6 #define SCRMOD 0xFCAF #define EXPTBL 0xFCC1 +#define H_CHPH 0xFDA4 -#endif //__SYSTEM_H \ No newline at end of file +#endif //__SYSTEM_H From 18ba22d01957fc2127edf155bef690afc0b1c28e Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Fri, 15 Jul 2022 22:31:25 +0200 Subject: [PATCH 7/9] Fix interrupt handling in DOS 1 mode, and remove useless code - In DOS 1 mode, save old interrupt and jump to it the same way it's done in normal mode, instead of trying to use the DOS 1 style SETINT and PRVINT routines. - Remove the useless SETINT and PRVINT routines (these are intended to be called by DOS 1 and DOS 2 drivers, but in Nextor the driver's interrupt routine is called explicitly by the kernel) --- source/kernel/bank0/init.mac | 179 ++++++++++++-------------------- source/kernel/bank3/dos1ker.mac | 53 +--------- source/kernel/data.mac | 24 +---- 3 files changed, 74 insertions(+), 182 deletions(-) diff --git a/source/kernel/bank0/init.mac b/source/kernel/bank0/init.mac index 37e50d30..365fc339 100644 --- a/source/kernel/bank0/init.mac +++ b/source/kernel/bank0/init.mac @@ -1041,7 +1041,7 @@ OVERRIDE: SLAVE: ld a,(KER250##+3) or a - ret nz ;Return if four 2.50 kernels initialized already + ret nz ;Return if four Nextor kernels initialized already call VALTBL ;get number of drives declared so far ret z ;no room is left @@ -1480,42 +1480,10 @@ endif ld hl,(HIMEM##) ;save HIMEM ld (HIMSAV##),hl ; ; - ld hl,H.TIMI ;Save the current setting of - push hl ; the timer interrupt hook - ld de,TIMI_SAVE## ; in our data area. - ld bc,5 - ldir -;===== start add DOS2.50 (support MegaSCSI) - ld hl,_TIME_IRQ## - ld de,@TIME_IRQ## - call MYHOOK -;===== end add DOS2.50 - pop hl ;Now set up an inter-slot call - - ;This "patch for MegaSCSI" was causing the kanji mode to not work - ;(CALL KANJI hanging the computer) - ;since the Kanji ROM timer interrupt routine assumes that the - ;previous hook is either a RET or a RST 30h (not a CALL!) -if 0 -;===== start mod DOS2.50 (support MegaSCSI) - ld de,_TIME_IRQ## ; to our timer interrupt - ld (hl),0;NOP ; routine in this ROM page. - inc hl - ld (hl),0CDh;CALL - inc hl - ld (hl),e - inc hl - ld (hl),d - inc hl - ld (hl),0C9h;RET -else + ld hl,TIMI_SAVE## ld de,@TIME_IRQ## - call MYHOOK -endif + call SAVE_AND_PATCH_HTIMI -;; ld de,@TIME_IRQ## -;; call MYHOOK -;===== end mod DOS2.50 ; ; Establish extended BIOS hook ; @@ -2111,36 +2079,46 @@ endif ; ;------------------------------------------------------------------------------ ; +; Timer interrupt handler. +; +; Note that both in normal mode and in DOS 1 mode jumping to the previous +; hook will trigger the chain of interrupt routines for the drivers +; attached to MSX-DOS 1 kernels (each will call its "previous hook" +; as configured in HOOKSAV). + TIMINT:: push af ;Save VDP status ld a,(DOS_VER##) or a jr nz,DOS2INT - ;Interrupt handler, DOS 1 version - call TIMI_250 ;Call 2.50 kernels driver interrupt routine. - ex af,af' - pop af ;Restore VDP status - ex af,af' - ld a,3 - ld ix,PRV1INT## - jp CALBNK## + ;Interrupt handler, DOS 1 mode version + + call TIMI_NEXTOR_DRV ;Call interrupt routine for Nextor drivers. + pop af ;Restore VDP status. + jp TM1_SAVE## ;Jump to the previous interrupt routine. + - ;Interrupt handler, DOS 2 version + ;Interrupt handler, normal ("DOS 2 mode") version DOS2INT: call TIME_IRQ## ;Call the master interrupt routine. - call TIMI_DRV ;Call driver interrupt routine in turn. - call TIMI_250 ;Call 2.50 kernels driver interrupt routine. - pop af ;Restore VDP status - jp TIMI_SAVE## + call TIMI_DOS2_DRV ;Call interrupt routines of drivers attached to DOS 2 kernels. + call TIMI_NEXTOR_DRV ;Call interrupt routine for Nextor drivers. + pop af ;Restore VDP status. + jp TIMI_SAVE## ;Jump to the previous interrupt routine. -TIMI_DRV: + +TIMI_DOS2_DRV: ; -; Call all possible disk drivers interrupt which is combined with -; new DOS2 code. This is because the disk drivers entry may not -; be revealed at this point (because of local banking) +; Call the interrupt routines of drivers attached to MSX-DOS 2 kernels. +; These are the ones that have an entry in HOOKSAV whose slot number matches +; the entry with the same index in DRVTBL, thus representing a "my hook" entry +; (if the slot number is different then the HOOKSAV entry has been +; set by a driver attached to a MSX-DOS 1 kernel, and in this case +; it represents a "previous hook" entry and the driver itself will call it +; at the end of its own interrupt routine). ; ld de,DRVTBL ld hl,HOOKSAV @@ -2151,14 +2129,11 @@ scan_loop: ret z ; yes, done inc de - ld a,(de) ;Get slot address + ld a,(de) ;Get slot address from DRVTBL inc de - cp (hl) ; same? - jr nz,next_cart ; no, this has been set by - ; old SETINT - ld a,(MASTER_SLOT##) - cp (hl) ;Is it me? - ld a,(hl) ; assume not + cp (hl) ; same slot number in equivalent HOOKSAV entry? + jr nz,next_cart ; no, HOOKSAV entry has been set by DOS 1 SETINT + ld a,(hl) ; slot number push bc ; save count push de ; DRVTBL pointer push hl ; HOOKSAV pointer @@ -2166,11 +2141,10 @@ scan_loop: ld e,(hl) inc hl ld d,(hl) - push af - pop iy + db 0FDh,67h ;LD IYh,A push de pop ix - call call_drv + call CALSLT pop hl pop de pop bc @@ -2181,21 +2155,18 @@ next_cart: djnz scan_loop ret ; -call_drv: - jp nz,CALSLT ;Was slave, call thru inter-slot call - jp (ix) ;Was me, just call my slot. ; ; -TIMI_250: +TIMI_NEXTOR_DRV: ; -; Call the interrupt routine of DOS 2.50 kernels +; Call the interrupt routine of all drivers attached to Nextor kernels. ; ld hl,KER250 ld b,4 -T250_LOOP: +TNEX_LOOP: ld a,(hl) bit 6,a ;Zero if empty entry or if no interrupt declared - jr z,T250_DJNZ + jr z,TNEX_DJNZ push hl push bc @@ -2210,11 +2181,15 @@ T250_LOOP: pop bc pop hl -T250_DJNZ: +TNEX_DJNZ: inc hl - djnz T250_LOOP + djnz TNEX_LOOP ret +call_drv: + jp nz,CALSLT ;Was slave, call thru inter-slot call + jp (ix) ;Was me, just call my slot. + ; ;public PROMPT PROMPT: @@ -2346,35 +2321,6 @@ ADDHLBC: add hl,bc ret -; -; Define disk driver's timer interrupt entry -; -; HL = timer interrupt entry address -; - public SETINT -SETINT: - ex de,hl ; de = interrupt entry - call GSLOT1## - push af ; save slot number - call GET_DISKID_HL - ld a,(hl) ;(DISKID) ; make a pointer to HOOKSAV - ld hl,HOOKSAV - call ADDHLBC - add hl,bc - add hl,bc - pop af - ld (hl),a - inc hl - ld (hl),e - inc hl - ld (hl),d -; -; Return from disk driver interrupt (was jump to previous hook in DOS1) -; - public PRVINT -PRVINT: - ret - ; ;----------------------------------------------------------------------- ; @@ -2943,17 +2889,9 @@ olddos_9: ld de,@EXTBIO## call MYHOOK - ld a,3 ;Do a DOS1 style SETINT - ld ix,SET1INT## - ld hl,@TIME_IRQ## - call CALBNK## - - ;ld a,(FCALSAV##) ;TODO: Investigate why FCALSAV is all zeros - ;or a ;at this point (should be all RETs) - ;jr nz,FCALSAV_OK - ;ld a,0C9h ;Code for RET - ;ld (FCALSAV##),a -;FCALSAV_OK: + ld hl,TM1_SAVE## + ld de,@TIME_IRQ## + call SAVE_AND_PATCH_HTIMI ld a,3 ld (MAIN_BANK##),a @@ -2962,6 +2900,25 @@ olddos_9: push hl ; CLEAN+11h (just after RET P) of ld a,3 ; INIT.Z80, not INIT.MAC (this code). jp CHGBNK + + +; Make a copy of H.TIMI hook and then patch it to point to another address +; of our slot via interslot call. +; +; In: HL = Address for the copy +; DE = New destination address (in main Nextor kernel) for the hook + +SAVE_AND_PATCH_HTIMI: + push de + ex de,hl + ld hl,H.TIMI + push hl + ld bc,5 + ldir + pop hl + pop de + jp MYHOOK + ; ; ;===== start add DOS2.50 (build type) diff --git a/source/kernel/bank3/dos1ker.mac b/source/kernel/bank3/dos1ker.mac index 16739529..8d4dc66e 100644 --- a/source/kernel/bank3/dos1ker.mac +++ b/source/kernel/bank3/dos1ker.mac @@ -513,9 +513,7 @@ SET_SLOT: pop iy ret - ALIGN 04115h-6 - jp SETINT - jp PRVINT + ALIGN 04115h ; Subroutine store date ; Inputs @@ -5662,55 +5660,8 @@ A5FF3: ld c,a add hl,bc ret -; Subroutine install my diskdriver interrupt handler -; Inputs HL = pointer to interrupt handler -; Outputs - -; Remark used by the diskdriver - -SETINT: -A5FF6: ld a,(H.TIMI+0) - cp 0C9H - jr z,A6012 ; H.TIMI not hooked, skip saving H.TIMI - push hl - ld a,(DEVICE) ; this diskdriver number - ld hl,YFB29 - call A5FF1 - add hl,bc - add hl,bc ; get DRVINT pointer - ex de,hl - ld hl,H.TIMI+1 - ld c,003H - ldir ; save slotid and address (assumes that is hooked by a CALLF!) - pop hl -A6012: di - ld a,0F7H - ld (H.TIMI+0),a - ld (H.TIMI+2),hl ; diskdriver interrupt handler - ld a,0C9H - ld (H.TIMI+4),a - call A402D - ld (H.TIMI+1),a ; slotid of this diskdriver - ret + ALIGN 603Dh -; Subroutine call orginal interrupt handler -; Inputs - -; Outputs - -; Remark used by the diskdriver - -PRVINT: -A6027: push af - call A402D ; slotid of this diskdriver - ld b,4 - ld de,YFB29 - ld hl,YFB21+1 -A6033: cp (hl) ; is this my DRVTBL entry ? - jr z,A603F ; yep, get the saved interrupt handler and jump to it - inc de - inc de - inc de - inc hl - inc hl - djnz A6033 ; next DRVTBL and DRVINT entry A603D: pop af ret ; quit diff --git a/source/kernel/data.mac b/source/kernel/data.mac index 847be00b..4986472c 100644 --- a/source/kernel/data.mac +++ b/source/kernel/data.mac @@ -165,7 +165,8 @@ ram_ad defl DATABASE var1 TIM_TICK ;Deferred timeout counter for unit descriptor ; timeouts. ; - var TIMI_SAVE,5 ;Save address for old interrupt hook. + var TIMI_SAVE,5 ;Save address for old interrupt hook + ;(in DOS 1 mode TM1_SAVE is used instead) ; var2 MAP_TAB ;Pointer to mapper records. ; @@ -270,15 +271,12 @@ ram_ad defl DATABASE const DVB_TABLE,P0_64K ;Pointer to table of device-based drives for DOS1 const KSLOT,P2_64K ;Slot of disk controller being called (used in DOS 1 mode) ; -;===== start mod DOS2.50 (support MegaSCSI) var1 NXT_VER ;Nextor version numbr - var1 MAIN_BANK + var1 MAIN_BANK ;Will be 0 in normal mode or 3 in DOS 1 mode var KER250,4 ;Nextor kernel slots, ;bit 6 is set if timer interrupt routine is to be called ;bit 5 is set if the driver provides configuration - var _TIME_IRQ,5,F31E -;; spare 11 -;===== end mod DOS2.50 + var TM1_SAVE,5,F31E ;Save address for old interrupt hook (used in DOS 1 mode) ; ; ------------------------ ; @@ -584,20 +582,6 @@ ram_ad defl 4100h var0 DV_MTOFF var3 DEV_CMD -;----------------------------------------------------------------------------- -; -; DOS 1 bank routines for interrupt management - -ram_ad defl 04115h-6 - - var3 SET1INT - var3 PRV1INT - -;----------------------------------------------------------------------------- -; -; Fields in the disk amulation mode table - - ;----------------------------------------------------------------------------- ; From 486d78ad477be1121bc518d56334d4cb884bfaa8 Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Sun, 17 Jul 2022 17:36:35 +0200 Subject: [PATCH 8/9] Update kernel version number to 2.1.1 --- source/kernel/Makefile | 2 +- source/kernel/condasm.inc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/source/kernel/Makefile b/source/kernel/Makefile index 2b957256..557b8adb 100644 --- a/source/kernel/Makefile +++ b/source/kernel/Makefile @@ -4,7 +4,7 @@ # See the "all" main rule for some handy aliases to generate specific ROMs # (e.g. you can run "make base" or "make ide"). -VERSION := 2.1.1-beta2 +VERSION := 2.1.1 export X80_COMMAND_LINE=-t -nb export M80_COMMAND_LINE=-8 diff --git a/source/kernel/condasm.inc b/source/kernel/condasm.inc index e735232a..18b06b76 100644 --- a/source/kernel/condasm.inc +++ b/source/kernel/condasm.inc @@ -10,7 +10,7 @@ BUILTIN equ -1 ;built-in system ALPHA equ 0 ;Level of Alpha release (0: no alpha) ALPHAL equ "" ;Letter after the Alpha release number, or empty -BETA equ 2 ;Level of Beta release (0: no beta) +BETA equ 0 ;Level of Beta release (0: no beta) RC equ 0 ;Level of RC (0: no RC) RR equ 0 ;Level of release (0: no release level) ; From cf04353dde1aca9b42f5030519309f0b17db55c7 Mon Sep 17 00:00:00 2001 From: Nestor Soriano Date: Mon, 18 Jul 2022 18:20:34 +0200 Subject: [PATCH 9/9] Change temp work area in sunride.asm from C000h to C400h. This is to prevent conflicts with some Panasonic FS machines that use C000-C400 as temporary work area at boot time. --- source/kernel/drivers/SunriseIDE/sunride.asm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/source/kernel/drivers/SunriseIDE/sunride.asm b/source/kernel/drivers/SunriseIDE/sunride.asm index f99cd3b6..41d17871 100644 --- a/source/kernel/drivers/SunriseIDE/sunride.asm +++ b/source/kernel/drivers/SunriseIDE/sunride.asm @@ -13,7 +13,9 @@ MASTER_ONLY equ 0 TESTADD equ 0F3F5h -TEMP_WORK equ 0C000h +;A few Panasonic FS machines uses the area around C000-C400 at boot time, +;so better to not use C000; C400 will do. +TEMP_WORK equ 0C400h ;----------------------------------------------------------------------------- ;