Autor
| combining multiple files in 1 game
| norakomi msx professional Mensajes: 861 | Publicado: Mayo 22 2005, 03:50   | I have made a couple of files which I each have to load into memory before my gave can start playing.
(I use page 1,3,0,3 everytime I startup the msx in Wbass2)
1) There is a moventpattern file which contains all the info about the
movement of all the enemys
2) There is a background file which makes the background move
3) and there is a gamefile
Everytime I restart Wbass2 I have to type:
page 1,3,0,3
load "pattern.asm" (this one is loaded in $4000)
asm
load "backgr.asm" (this one is loaded in $4800)
asm
load "game.asm" (this one is loaded in $5000)
asm
and then finaly I can give my GO instruction
The problem is that every now and then the computer 'hangs'
because of sloppy programming, and I have to reboot again
which means that I have to type all those above lines again.
Is there a way to make a little basic loader (in the autoexec of Wbass)
which loads all three files in their corresponding RAM address, and then
starts WBASS???
or even better ...... how can I make a programm in assembly
which loads the three files from disk and assembles them into memory ?
| | ro msx guru Mensajes: 2347 | Publicado: Mayo 22 2005, 16:32   | cool. now here's where the BASM (Batch Assembly) comes in handy. however, it only works in the F-kernel mode.
BASM is *NOT* a standard instruction, I build it myself.
it can do page swap, load asm files and assemble them. just like you do manually.
you can do the same.. I quess. dunno.
(again, I build it around f-kernel/midas so euh, thaz not really gonna work for u I guess..)
Before the enhanched version I saved all code to dat files and ran a game booter and only loade the asm file I was working on.. (read: make a loader!)
Oh, or just don't make sloppy code
| | norakomi msx professional Mensajes: 861 | Publicado: Mayo 23 2005, 13:51   | batch assembly.... that sounds logical......
Can you give me a bit more info about Fkernel???????
Can I use this maybe to make a batch loader for my files?
or is there a way to load files from disk into memory using a machine language programm?
| | ro msx guru Mensajes: 2347 | Publicado: Mayo 23 2005, 13:59   | well the problem is that FK is kinda a autonome OS. It's not that e.z. to just say "here ya go, good luck" and.. I have to search for a descend published version since I've been hacking new stuff into the FK since euah... years ago. (read: updates, but not published)
So skip that for now. You might also use the Keyboard buffer to make a BATCH (did that in the beginning of my wbass years too) how?
I made a source file which would assemble onto the kb-buffer and just filled it with something like:
ORG KBBUF (what's the adr again?)
DB "page 1,3,0,3",13
DB "load ",34,"pattern.asm",34,13
DB "asm",13
etc.
34=char code for "
13=char for ENTER/RETURN key
| | ro msx guru Mensajes: 2347 | Publicado: Mayo 23 2005, 14:00   | loading into a RAM disk is very, very possible
| | Sonic_aka_T
 msx guru Mensajes: 2269 | Publicado: Mayo 23 2005, 14:51   | @norakomi: why not just load the datafiles in game.asm? Eventually your game will need to load that data anyhow.
Just assemble and DSAVE pattern.asm and backgr.asm to disk, and have GAME.ASM load the resulting data files whenever it starts. Loading them using BDOS is probably easiest. You'd still have to do the PAGE command when you start WB though, plus you'd have to load and assemble GAME.ASM like usual.
I guess the real problem with WB2 is that it's not really suited for bigger projects. Not much you can do about that, except maybe considering cross-developing. The up-side of that is that you could make your game for DOS and have more memory available. The down-side of course, is that using BIOS routines will be a bit more difficult, and less desireable...
| | norakomi msx professional Mensajes: 861 | Publicado: Mayo 23 2005, 15:46   | I have no experience working with dos,,,,,
What i did find ,on the net, was a programm to load data from a
file (filename in DE) into VRAM,
I havent changed this so that the file wil be loaded in RAM.
but I guess that this is possible ?
Or can you suggest I use Dos, and if so, where/how to start?????
| | ro msx guru Mensajes: 2347 | Publicado: Mayo 23 2005, 19:00   | what you need is an update on how to be a cool coder 
do u know anything about handling files 'n stuff? (bdos for example)
no? .. well read'm and learn. there's plenty 'o dox around the net (map?) else I'll be glad to provide them (I got them digital.. iirc)
there's much to be learned. | | norakomi msx professional Mensajes: 861 | Publicado: Mayo 24 2005, 12:10   | Cewl, thanks.....
Looking forward to be a cewler coder !!
Maybe then I need to change my name, to ehh, mr. cool.... Or mr groove !!
hehe, ...... well, lets first focussss on the file handling....
| | norakomi msx professional Mensajes: 861 | Publicado: Mayo 24 2005, 12:12   | BiFi
msx guru
Posts: 2220 Posted: May 16 2004, 16:58
I made a load routine that can do a BASIC BLOAD type. Here's the source:
org &hc000
;
bDos equ 5
;
; B(in)LOAD
;
; Written by: BiFi 2001
;
bload: ld c,15 ; Open file
ld de,fcb
call bDos
xor a ; Clear FCB extent number
ld (fcb+12),a
ld h,a ; Point to start of file
ld l,a
ld (fcb+33),hl
inc hl ; Set record size
ld (fcb+14),hl
ld c,26 ; Set DMA for BIN-Header
ld de,dma
call bDos
ld c,39 ; Read BIN-Header
ld de,fcb
ld hl,7
call bDos
ld a,(dma)
cp &hfe
jr nz,close ; Stop loading the rest... No BIN-File
ld de,(dma+1) ; Start address of BIN-File
ld hl,(dma+3) ; End address of Bin-File
inc hl
sbc hl,de ; Number of bytes in HL
push hl
ld c,26 ; Set new DMA
call bDos
pop hl
ld c,39
ld de,fcb
call bDos
close: ld c,16
ld de,fcb
jp bDos
;
fcb: db 0,"FILENAMEEXT"
dw 0,0,0,0
dw 0,0,0,0
dw 0,0,0,0
dw 0,0,0,0
dw 0,0
;
dma equ $
I hope it helps. BDOS is the address for all disk-related calls. It's &h0005 for MSX-DOS environments and &hf37d for all other.
I saw this post on the forum somewhere !! Thanks Bifi !!
| | ro msx guru Mensajes: 2347 | Publicado: Mayo 24 2005, 12:22   | that would do the trick indeed, altho you might consider saving as .dat files.. but binarairy files are ok. just don't forget you CANNOT load data directly into page 1 (e.g. page 1,3,0,3) but don't fear. just load the content in page 2 instead (e.g. page 2,3,0,3) and you'll have your data in the right memmap.
| | norakomi msx professional Mensajes: 861 | Publicado: Mayo 24 2005, 13:47   | I assume that the last line of the programm should be
dma equ $00
I made a simple program:
org $d000
ld a,2
ret
After that I assembled this and Bsaved this as follows:
bsave "testtest.bin",$d000,$d002
I clear the memory (the "2" at $d001)
And then I asm the programm Bifi wrote
(but changed :
BDOS EQU $f37d
....and
FCB: DB 0,"testtestbin"
When I run this programm I notice that the diskdrive is reading
When I check memory location $d001 afterwards(by typing mon $d000)
this location has not been writen to (I dont see the "2" which the ld a,2
should put here)
If I type: bload "testtest.bin" in Wbass and then check mon $d000
I DO see that this location has been writen to.
( also did I try the page 1,3,0,3 and 2,3,0,3 experiment.....)
| | norakomi msx professional Mensajes: 861 | Publicado: Mayo 24 2005, 13:55   | Oeps,
nevermind
I figured that DMA should be the destiny location in memory
so
DMA equ $C000
| | ro msx guru Mensajes: 2347 | Publicado: Mayo 24 2005, 13:58   | no, DMA should be the address where to store TEMP data (the bin header)
so you should leave DMA at the end of the source and should be 7 bytes long
like this
DMA DS 7
(DS means Define Space. It'll preserve 7 bytes for ya)
| | ro msx guru Mensajes: 2347 | Publicado: Mayo 24 2005, 13:58   | gheh, like that yeah (I was just typing!)
| |
| |
| |