diff --git a/docs/img/gsg/Partitions2And4Active.PNG b/docs/img/gsg/Partitions2And4Active.PNG deleted file mode 100644 index 7d0cb2ff..00000000 Binary files a/docs/img/gsg/Partitions2And4Active.PNG and /dev/null differ diff --git a/source/kernel/Makefile b/source/kernel/Makefile index 2b957256..c91fdd63 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 @@ -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: \ @@ -463,6 +507,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/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/bank1/mapinit.mac b/source/kernel/bank1/mapinit.mac index 4df88569..22d68ca2 100644 --- a/source/kernel/bank1/mapinit.mac +++ b/source/kernel/bank1/mapinit.mac @@ -754,14 +754,28 @@ 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 + ex de, hl + + ld hl, +(EXB_SLOT_BACKUP+1)-(EXB_SLOT_RESTORE+1) + add hl, de + ld (hl), e + inc hl + ld (hl), d + ex af,af' exx - ld ix,($SECBUF##) - jp (ix) + + ret ;--- From here is copied to RAM EXB_RAM: @@ -787,8 +801,28 @@ EXB_LOOP: push bc push de push hl - ld a,(ix) + + ld a,(ix) + ld d,a + and 80h + jr z,EXB_SLOT_BACKUP + + ld a,d + and 3 + ld e,a + ld hl,SLTTBL + add a,l + ld l,a + ld a,(hl) + and 0Ch + or e + or 80h + +EXB_SLOT_BACKUP: + ld (EXB_SLOT_RESTORE+1),a + ld a,d and 10001111b + ld h,40h call ENASLT ld hl,DV_EXTBIO## @@ -802,6 +836,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 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/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/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) ; 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 - - ;----------------------------------------------------------------------------- ; 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..41d17871 100644 --- a/source/kernel/drivers/SunriseIDE/sunride.asm +++ b/source/kernel/drivers/SunriseIDE/sunride.asm @@ -9,9 +9,13 @@ ds 4100h-$,0 ; DRV_START must be at 4100h DRV_START: +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 ;----------------------------------------------------------------------------- ; @@ -551,6 +555,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 +578,8 @@ DRV_INIT: call DETDEV pop ix + endif + ; Reset all devices to finish END_DETECT: call RESET_ALL @@ -3251,6 +3259,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 +3286,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 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