Mounting a 16kb asm+16kb BASIC ROM

Por Ada

Resident (49)

Imagen del Ada

07-05-2005, 16:52

Hi everyone!

ld hl,ENABLE_BASIC
ld de,51000
ld bc,100
ldir ;Copy the routine to 51000

ld hl,DISABLE_BASIC
ld de,52000
ld bc,100
ldir ;Copy the routine to 52000

ld hl,ENABLE_BASIC_FIRST
ld de,53000
ld bc,100
ldir ;Copy the routine to 53000

jp 53000 ;Jump to the MSX Program, disabling first
;the ROM, enabling the BASIC and executing

ENABLE_BASIC:
call RSLREG
res 2,a
res 3,a
call WSLREG ;Enables the BASIC interpreter

ld a,1
ld [fbb1h],a ;Indicates it's executing a BASIC ROM

call RSLREG
set 4,a
res 5,a
call WSLREG ;Enables page 2 (the cartridge) which contains
;the basic program
ret

ENABLE_BASIC_FIRST:

call RSLREG
res 2,a
res 3,a
call WSLREG ;Enables the BASIC interpreter

call RSLREG
set 4,a
res 5,a
call WSLREG ;Enables page 2 (the cartridge) which contains
;the basic program

ld a,1
ld [fbb1h],a ;Indicates it's executing a BASIC program

jp 73ACh ;Execute RUN instruction (launches BAS program)
ret

DISABBLE_BASIC:
call RSLREG
set 2,a
res 3,a
call WSLREG ;Enables the cartridge (page 1) which contains
;the asm routines
jp ROUTINES

;---------------------------------------------
;Insert asm routines here
;---------------------------------------------
ROUTINES:

ld hl,MESSAGE ;Just for testing
call PRINT_MESSAGE
jp 51000 ;Enables BASIC interpreter again

I'm trying to make a 32kb rom containing 16kb of asm in page 1 and 16kb of BASIC in page 2.

I pretend to execute the rom, execute some routines and then it executes the basic program (which is the main program) and call later some routines contained in the asm part using some defusr's.

I mount the rom using an hex editor. It executes the BASIC program (shows 'HELLO') and is fine.

Here's the problem. I define defusr1=52000. It disables the BASIC, enables the cartridge, executes anything and returns to BASIC, enabling the interpreter. If I use u=usr1(0) once, it runs great (it shows'HELLO AGAIN',g.e.). But if I use it twice, the computer hangs.

Surprisingly, if I execute run between the instructions, it works fine.

G.e.:

u=usr1(0)
'HELLO AGAIN'
run
u=usr1(0)
'HELLO AGAIN'

But that's something I don't want. If I omit the run, the computer hangs Sad

When I have no BASIC program (I have mounted only the asm part) and execute the u=usr1(0), everything is fine and I can do it as many times as I want.

I have indicated the interpreter it is executing a BASIC ROM, but it fails anyway.

I think it's quite interesting as it helps to overcome the problem of having only 16kb BASIC ROMs.

Please help me with any kind of info Smile

Many thanks!

Login sesión o register para postear comentarios