How to make a loader for a machinecode game. (Development Foros MSX)MSX Resource Center MSXdev 2008 - MSX1 development bonanza!           
                       
English Nederlands Español Português Russian                  
 Noticias
   Página principal
  Almacén de noticias
  Temas de noticias

 Recursos
   Foros MSX
  Artículos
  Analisis
  Informe de ferias/RUs
  Álbum de fotos
  Ferias y encuentros
  Encuestas
  Enlaces
  Buscar

 Software
   Descargas
  Tienda Online

 MRC
   Quiénes somos
  Únete a nuestro equipo
  Donar
  Políticas
  Contacta con nosotros
  Enlázanos
  Estadísticas

 Buscar
 
  

  

 Login
 

Login

Contraseña




¿Aún no tienes una cuenta? ¡Conviértete en miembro del MSX Resource Center! ¡Únete a nosotros!.


 Estadísticas
 

Hay 127 invitados y 0 miembros en línea

Eres un usuario anónimo.
 

Foros MSX


Foros MSX

Development - How to make a loader for a machinecode game.

Autor

How to make a loader for a machinecode game.

marcel
msx friend
Mensajes: 6
Publicado: Mayo 16 2004, 16:44   
Hi

Can anybody give me some advice / knows a clear document on the web, how to make a simple loader for the MSX2.

I just want to load a .bin file in 64 k (or more) memory and do >not< want any BASIC or MSXDOS in the memory.
For assembling I use GEN80. and some wbass.

I could not find any good documentation.

Thanks in advance, Marcel.
BiFi
msx guru
Mensajes: 3142
Publicado: Mayo 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.
marcel
msx friend
Mensajes: 6
Publicado: Mayo 16 2004, 17:14   
OK- that's cool thanks- but how can I make this program run when resetting or starting the MSX2?
But if I want my program to load when the MSX2 boots, for example at address #0000 or #4000, how do I 'implement' that? And what If I want to print let's say 256 Kb of images?
The memory issues are so vague and unclear on the MSX2.

flyguille
msx master
Mensajes: 1197
Publicado: Mayo 16 2004, 17:18   
Quote:

Hi

Can anybody give me some advice / knows a clear document on the web, how to make a simple loader for the MSX2.

I just want to load a .bin file in 64 k (or more) memory and do >not< want any BASIC or MSXDOS in the memory.
For assembling I use GEN80. and some wbass.

I could not find any good documentation.

Thanks in advance, Marcel.



Well, you need divide all bin in 16kb pages...

and in each page add a loader routine so

you finally will save it with BSAVE"file",&h8000,&hC0FF,&hC000

placing the loader starting from &hc000

All konami games with several blocks do that...

so, the user can use BLOAD"file",R for all blocks....


I will write quickly the loader here...


 

Universal without slotting sensitive.

DI
IN A,(0xA8)
PUSH AF

AND 0x30
RRCA
RRCA
LD B,A
IN A,(0xA8)
AND 0xF3
OR B
OUT (0xA8),A

LD A,(0xFFFF)
CPL
PUSH AF
AND 0x30
RRCA
RRCA
LD B,A
LD A,(0xFFFF)
AND 0xF3
OR B
LD (0xFFFF),A

IN A,(0xFD)
PUSH AF
LD A,0xXX       ------< page number where load the bin.
OUT (0xFD),A ----> this block only for MSX2

LD HL, 0x8000
LD DE, 0x4000
LD BC, 0x4000
LDIR

POP AF
OUT (0xFD),A -----> this block only for MSX2

POP AF
LD (0xFFFF),A

POP AF
OUT (0xA8),A
EI
RET


This is the more perfect loader, for work in all world msx.

At following the coding....all in HEXA

F3, DB, A8, F5
E6, 30, 0F, 0F, 47, DB, A8, E6, F3, B0, D3 , A8
3A, FF, FF, 2F, F5, E6, 30, 0F, 0F, 47, 3A, FF, FF, E6, F3, B0, 32, FF, FF
DB, FD, F5, 3E, xx, D3, FD
21, 00, 80, 11, 00, 40, 01, 00, 40, ED, B0
F1, D3, FD
F1, 32, FF, FF
F1, D3, A8, FB, C9




tHE CODING and routine I DO IT A HAND, MAYBE WRONG , just need a test.

Please tellme, if it work


AND THIS WORK WITH ALL INPUT DEVICE LIKE CASSETE
flyguille
msx master
Mensajes: 1197
Publicado: Mayo 16 2004, 17:27   
so,, you need save to page number 3 for normal 0000-3FFF addresses
page number 2 for normal 4000-7FFF addresses

and the last block, addresses 8000-BFFF you can directly load and run you program

also you can load a 8k bin C000-DFFF without any problem....

for save more bins to out of 64kb, you can save bins to pages 4...5...6...7....
marcel
msx friend
Mensajes: 6
Publicado: Mayo 16 2004, 18:39   
ok i'll check this out.. hope this will make it more clear.
 
 







(c) 1994 - 2008 Fundación MSX Resource Center. MSX es una marca registrada de MSX Licensing Corporation