Hello,
Does anyone know why example 4 of the 4022h routine does not work?
Login or register to post comments
Hello,
Does anyone know why example 4 of the 4022h routine does not work?
Hi GDX,
Could you give more details ? What is your MSX setup ? (Floppy disk only, Nextor only, Nextor with a floppy disk interface...).
Also, what is happening exactly (crash, return to BASIC but program not launched...) ?
Hi Louthrax,
I tryed on my Turbo R with the Sunrise CF (Nextor Driver), but also on BlueMSX and OpenMSX (Turbo R + Sunrise IDE and also floppy disk interface only). The first three examples work well. This is normal it is a standard routine of the Disk-ROM but the fourth example does not work. It returns to BASIC without executing the BASIC program in memory. I found these examples in a MSX-DOS1 documentation.
Here are the examples ready to use:
https://mon-partage.fr/f/URctKYT5/
Hello,
Does anyone know why example 4 of the 4022h routine does not work?
I have no idea, what has made you to think that it could work like that? You don't even try to initialize VARTAB, ARYTAB, FRETOP, VARWRK, STKTOP, STREND, or anything... and even if you would it still would not work as the routine in 4022h it self works like NEW-command in BASIC as it does a full COLD START of BASIC, so it clears the first 3 bytes of BASIC program, clears BASIC internal variables etc. etc.
What you want to do can be most easily done by populating BASIC hooks, but not like this.
Quickly looking my HDD, I found this... I hope it helps you to do what you want to do.
; Run MSXMEM2.BAS (for Zemmix CPC-51) ; By NYYRIKKI (10/2015) OUTPUT "MSXMEM2.ROM" ORG #4000 ;HOOK: EQU #FDC2 ; Character get routine HOOK. DOSHOOK: EQU #FDC2 ; Character get routine HOOK. HOOK: EQU #FF07 ; Works! (but not on DOS2) ;HOOK: EQU #FEF8 ; End of BASIC program (Only works when disk connected) ENASLT EQU 0024H ;enable slot RSLREG EQU 0138H ;read primary slot select register EXPTBL EQU 0FCC1H ;slot is expanded or not BUF equ 0F55EH STKTOP equ 0F674H TXTTAB equ 0F676H VARTAB equ 0F6C2H BOTTOM equ 0FC48H DW #4241,BEGIN,0,0,0,0,0,0 BEGIN: LD A,#F7 ; RST 30H LD (HOOK),A LD (DOSHOOK),A CALL GETSLOTID LD (HOOK+1),A LD (DOSHOOK+1),A LD HL,STARTUP LD (HOOK+2),HL LD HL,DOSQUIT LD (DOSHOOK+2),HL LD A,#C9 LD (HOOK+4),A LD (DOSHOOK+4),A RET DOSQUIT: LD HL,#C9C9 LD (DOSHOOK),HL LD (DOSHOOK+2),HL LD A,(#F37D) CP #C3 RET NZ ; We have no idea what is going on, let's wait. ; At least we have disk bios, let's go to BASIC! LD A,(#FFA8) ld iyh,a ld ix,#4022 jp #1C STARTUP: LD HL,#C9C9 LD (HOOK),HL LD (HOOK+2),HL LD (DOSHOOK),HL LD (DOSHOOK+2),HL LD HL,BASBEGIN+1 LD DE,(#F676) LD BC,BASEND-BASBEGIN-1 LDIR LD (#F6C2),DE RST 030H DB #80 DW #4253 ld hl,RUN;T69B9 ld de,BUF+10 ld bc,5 ldir ld sp,(STKTOP) ld hl,#4173 push hl ; execute RUN command ld hl,BUF+10-1 push hl ; ´basicpointer´ ld hl,BUF+64 push hl ld (hl),0E1H inc hl ld (hl),0C9H ; pop the basicpointer when returning ld a,(EXPTBL+0) ld h,00H CALL ENASLT ld a,(EXPTBL+0) ld h,040H jp ENASLT ; enable basic-rom on page 1 RUN: defb ":RUN",0 GETSLOTID: IN A,(#A8) RRCA ;move it to bit 0,1 of [Acc] RRCA AND 00000011B LD C,A LD B,0 LD HL,#FCC1 ;see if this slot is expanded or not ADD HL,BC LD C,A ;save primary slot # LD A,(HL) ;See if the slot is expanded or not AND 80H OR C ;set MSB if so LD C,A ;save it to [C] INC HL ;Point to SLTTBL entry INC HL INC HL INC HL LD A,(HL) ;Get what is currently output ;to expansion slot register AND 00001100B OR C ;Finally form slot address (SlotID) RET BASBEGIN: INCBIN "MSXMEM2.BAS" BASEND: DS #8000-$
I have no idea, what has made you to think that it could work like that? You don't even try to initialize VARTAB, ARYTAB, FRETOP, VARWRK, STKTOP, STREND, or anything... and even if you would it still would not work as the routine in 4022h it self works like NEW-command in BASIC as it does a full COLD START of BASIC, so it clears the first 3 bytes of BASIC program, clears BASIC internal variables etc. etc.
Thanks NYYRIKKI, I found these 4 examples in a MSX-DOS1 documentation. Your routine has the same effect as Example 1.
3 out of 4 examples work. So I think if the fourth does not work, it's probably because there's an error somewhere. I'm looking for the reason.
Interest of the routine is to launch a Basic program simply from a DOS program without initialize VARTAB, ARYTAB, FRETOP, VARWRK, STKTOP, STREND, or anything...
Thanks NYYRIKKI, I found these 4 examples in a MSX-DOS1 documentation. Your routine has the same effect as Example 1.
No, my routine does not load a file from disk, but from ROM and therefore it is similar to what I think example 4 is trying to do. This routine has some extra stuff around as I wanted it to execute AUTOEXEC.BAT before jumping to BASIC and executing the program from cartridge, but anyway...
3 out of 4 examples work. So I think if the fourth does not work, it's probably because there's an error somewhere. I'm looking for the reason.
Well, the fact that 3 out of 4 happen to work does not make them good examples... Actually they look pretty bad to my eyes:
REBOOT is set to NZ by COMMAND.COM as well as the routine it self (after handling), so I think there is no reason for user to touch it in normal situation. The reading of pointer from start of TEMPST (temporary string descriptors) also looks very weird to me... Looking from debugger this memory contains pointer to address 0 in DOS. I guess this might be bug and they meant TXTTAB, but even in that case the routine would be useless as this will be done by the STBAS anyway... or maybe they meant TEMPPT ? ... at least it does not work and is useless. -> Bad idea as an example
It might be that these examples are from some official MSX-DOS1 documentation (link would be nice), but I have found no evidence that there could be any possibility for the 4th routine to work on any MSX setup. Only reasons why it could not ever work. Maybe these examples were written before actual code for disk ROM was properly planned or implemented? Hard to say.
Ok I removed the fourth example. I tryed other seems on some machines. They seems works.
Ok I removed the fourth example. I tryed other seems on some machines. They seems works.
I bet they work fine on all machines. They are just over complicated due to extra stuff they do.
Don't you have an account yet? Become an MSX-friend and register an account!