Autor
| basic loader
|
norakomi msx professional Mensajes: 861 | Publicado: Junio 27 2005, 11:08   |
Hello,
I want to make a basic loader for my game, but so far Im unsuccesfull.
I reboot my msx, which starts with WB-ASS2.
I type:
bload "loader.bin"
it loads at $c000
I type:
go $c000
and the file is loaded and it runs automaticaly.
So not very difficult to get this to work in WB-ASS
When I go to basic however and type:
Bload "loader.bin",r
it doesnt work
or: bload"loader.bin"
defusr=&hc000
a=usr(0) (or ?usr(0))
doesnt work either.
Now, the loader file loads several files into memory, music, sfx, pictures into VRAM, data tables, sprite structure files, colors, pallette etc. etc.
When all these files are loader the Loader.bin file jumps to the beginning of the game
at $4000.
Why does it work in WB-ASS, but not in Basic???
|
|
MysteryMan msx friend Mensajes: 13 | Publicado: Junio 27 2005, 11:22   |
Hi,
Well in basic theres ROM from &h4000 - &h7fff --normaly in wbasm too but can easely be remapped to ram with the page instruction--
So i think you have map a ram page there and then give it a try.
so then your mem looks like :
&h0000 ~ &h3fff BIOS ROM
&h4000 ~ &h7fff RAM insteed of BASIC ROM
&h8000 ~ &hbfff ram
&hc000 ~ &hffff Youre loader and in the top of mem some system variables used bij ROM-BIOS (and basic)
|
|
ro msx guru Mensajes: 2329 | Publicado: Junio 27 2005, 12:55   |
jup, u might wanna set RAM to page 1
it's something like:
ld h,0x40
ld a,primramslot
call #24
(then u also might even wanna do the poke -1,xx trick to set sec.slots. just figure it out will ya!)
it's the same as page 1,p-slot,s-slot
|
|
NYYRIKKI msx master Mensajes: 1510 | Publicado: Junio 27 2005, 16:22   |
|
|
norakomi msx professional Mensajes: 861 | Publicado: Septiembre 26 2005, 16:20   |
I know this has been explained, but I still cannot get the program to work in a basic loader.
The loader is simply loaded into memory when the computer boots and WBASS2 is loaded by typing:
bload "bload.bin"
then the loader is loaded at $c200
then I type:
GO $c200
and the programm works
(the page switching is done within the programm)
However, still.....
when i reboot and in basic I type:
Bload "loader.bin",r
it starts to load,
and load, and load, and some more files, are loaded,
and then ....
an error message says:
type mismatch !!!
what is this??
|
|
Latok msx master Mensajes: 1727 | Publicado: Septiembre 26 2005, 16:27   |
Is it possible to load a bin-file from basic which selects a RAM-block into page 1 and after that, load another bin-file from basic? Don't think so, there is no BASIC rom present anymore in page 1, right? I guess you will need to load your other bin-files from ASM as well, not from within a Basic listing....
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Septiembre 26 2005, 16:29   |
Quote:
| (then u also might even wanna do the poke -1,xx trick to set sec.slots. just figure it out will ya!)
|
When using BIOS CALL 0024h the secundary slot is also set. |
|
Sonic_aka_T
 msx guru Mensajes: 2268 | Publicado: Septiembre 26 2005, 16:29   |
It means your program for some reasons returns to BASIC. And since you've loaded data in the memory space normally used for the BASIC listings, the interpreter tries to continue the BASIC program when in fact there's just 'garbage' there. (as far as BASIC is concerned) It can be any error message by the way, doesn't have to be type mismatch. Anyhoo, check a number of things:
1) Did you set RAM at $4000?
2) Did you set the correct pages at $4000/$8000
3) Did you correctly save your loader?
Check the other thread to see how to set RAM at $4000. Also make sure the correct pages (banks) are set. So after setting the RAM do an OUT FD / FE to ensure all is as your main program expects it to be. Be sure to also specified the correct execution address for your loader. I don't know how big your loader is, but anything that goes past $D800 can already be a problem in some BASIC environments. If your loader is very big, try reducing it... Well, lemme know how it goes...
|
|
BiFi msx guru Mensajes: 3142 | Publicado: Septiembre 26 2005, 16:31   |
Latok, you can... what you basically do is this:
ld a,ramslot
ld h,40h
call 24h
; do you memory moving stuff here
ld a,(0fcc1h) ; slot with BASIC ROM
ld h,40h
call 24h
|
|
Latok msx master Mensajes: 1727 | Publicado: Septiembre 26 2005, 16:33   |
Yes, after selecting a ramblock in page 1, you select the basicrom back into page1 and then return to Basic....That's true, right?  |
|
NYYRIKKI msx master Mensajes: 1510 | Publicado: Septiembre 26 2005, 16:49   |
Just compile this code to loader.bin and try if it works.
DB #FE
DW BEGIN
DW END
DW BEGIN
ORG #B000
BEGIN:
LD A,(#F342)
LD H,#40
CALL #24
CALL #C000
LD A,(#FCC1)
LD H,#40
JP #24
END:
This is the basic loader, you can use:
10 BLOAD"BLOAD.BIN"
20 BLOAD"LOADER.BIN",R
BiFi: Secundary slot is set only if bit7 of SlotID is set.
Example:
LD A,1
LD H,#40
CALL #24
will set primary slot 1...
LD A,%10001101
LD H,#40
CALL #24
will set primary slot 1 and secondary slot 3...
|
|
norakomi msx professional Mensajes: 861 | Publicado: Septiembre 26 2005, 17:44   |
Quote:
|
Just compile this code to loader.bin and try if it works.
DB #FE
DW BEGIN
DW END
DW BEGIN
ORG #B000
BEGIN:
LD A,(#F342)
LD H,#40
CALL #24
CALL #C000
LD A,(#FCC1)
LD H,#40
JP #24
END:
This is the basic loader, you can use:
10 BLOAD"BLOAD.BIN"
20 BLOAD"LOADER.BIN",R
|
HAHAHA, NYYRIKKI youre a complete mistery and Magician to me......
Fantastic....
2 questions:
1) I'd like understand the coding....
LD A,(#F342) (what is this address for)
LD H,#40
CALL #24 (this is to select a piece of ram into a page???? And what is the LD H,#40 for????)
2) why is: DB #FE
DW BEGIN
DW END
DW BEGIN
this piece of code used ?>?>?[/quote] |
|
BiFi msx guru Mensajes: 3142 | Publicado: Septiembre 26 2005, 18:25   |
F342 is the address where the RAMslot is found for page 1 (detected by the diskrom).
|
|
Latok msx master Mensajes: 1727 | Publicado: Septiembre 26 2005, 18:52   |
Quote:
| 2) why is: DB #FE
DW BEGIN
DW END
DW BEGIN
this piece of code used ?>?>?
|
Because you want to compile a BIN-file which can be loaded from Basic. |
|
ro msx guru Mensajes: 2329 | Publicado: Septiembre 26 2005, 19:15   |
first 7 bytes are the header for BASIC to recognize a BIN file and it's addresses
+00: ID (#FE=bin executable)
+01: startadr, where to load the file (#e.g,. #c000)
+03: endadr, so BASIC will know its length (e.g. #c2ff)
+05: exec address. When using ",r" it will use this address to RUN
|
|
|
|
|