need help with creating ROM game (Development MSX Fora)MSX Resource Center MSX Info Update - Finnish MSX madness at its best           
            
English Nederlands Español Português Russian         
 Nieuws
   Voorpagina
  Nieuws archief
  Nieuws onderwerpen

 Informatie
   MSX Fora
  Artikelen
  Recensies
  Beursverslagen
  Fotoreportages
  Beurzen en meetings
  Enquêtes
  Links
  Zoek

 Software
   Downloads
  Webshop

 MRC
   Wie we zijn
  Kom bij ons team
  Doneren
  Policies
  Contact met het MRC
  Link naar Ons
  Statistieken

 Zoek
 
  

  

 Login
 

Gebruikersnaam

Wachtwoord




Ben je nog niet lid? Klik hier en word MSX vriend!


 Statistieken
 

Er zijn 136 gasten en 8 MSX vrienden online

Je bent een anonieme bezoeker.
 

MSX Fora


MSX Fora

Development - need help with creating ROM game

Schrijver

need help with creating ROM game

DamageX
msx freak
Berichten: 166
Geplaatst: 27 Juni 2006, 06:47   
I want to make a 48KB ROM but there are some things I don't know about MSX.

The Z80 int vectors are at the start of page 0 so I need to have them in my ROM right? How many vectors are there and what is their function? Are there any other than the VDP interrupt?

If I have the "AB" and the init address at $4000 then when my code starts does it have to also set page 0 and page 2 to the same slot to get the full 48KB? Does it have to check whether it is in a subslot also?

tia
BiFi
msx guru
Berichten: 3142
Geplaatst: 27 Juni 2006, 08:34   
in short, yes... luckilly there's some simple piece of code to determine in which slot it's located:
	call	$138
	rrca
	rrca
	and	$03
	ld	c,a
	ld	b,0
	ld	hl,$fcc1
	add	hl,bc
	or	(hl)
	ld	b,a
	inc	hl
	inc	hl
	inc	hl
	inc	hl
	ld	a,(hl)
	and	$0c
	or	b

You'll get the current slot for the game in A.
GhostwriterP
msx addict
Berichten: 305
Geplaatst: 27 Juni 2006, 19:29   
A 48 kb rom hey?
Wrong way: Place your own interrupt routine at adress 38h. Don't use bios.
Right way: Use the first 16 kb only for data. Acces only when interrupts disabled.

The wrong way is faster but might be incompatible with generation to come
(not using bios)

The right way requires swapping slots. Wich is slow. But you could still hook
the int at adress fd9ah like:
ld a,0c3h
ld (0fd9ah),a
ld hl,interrupt ;your routine adress
ld (0fd9bh),hl

end your routine with:
pop af ;nop pop voor call FD9A
pop ix ;pop all registers
pop iy
pop af
pop bc
pop de
pop hl
ex af,af'
exx
pop af
pop bc
pop de
pop hl

DamageX
msx freak
Berichten: 166
Geplaatst: 27 Juni 2006, 20:10   
BiFi, thanks for the code

I looked at Z80 docs and I guess that the vector at $38 is the only one... so the "Wrong way" is exactly what I was planning...

What is the "generation to come" you speak of?
ARTRAG
msx master
Berichten: 1594
Geplaatst: 27 Juni 2006, 20:35   
I do not think that any next gen msx will change the HW
requirements in such a way you can incurr in problems.

IMHO the "wrong way" is also the best and
more efficient way.
my suggestion is : avoid the bios any time you can

BiFi
msx guru
Berichten: 3142
Geplaatst: 28 Juni 2006, 09:56   
it's bad enough games were made with a specific slot structure in mind and still have the MSX logo to claim it works on all MSX computers... and those were MSX1 games!
Anvil
msx user
Berichten: 36
Geplaatst: 28 Juni 2006, 09:56   
Quote:

A 48 kb rom hey?
Wrong way: Place your own interrupt routine at adress 38h. Don't use bios.
Right way: Use the first 16 kb only for data. Acces only when interrupts disabled.

The wrong way is faster but might be incompatible with generation to come
(not using bios)

The right way requires swapping slots. Wich is slow. But you could still hook
the int at adress fd9ah like:
ld a,0c3h
ld (0fd9ah),a
ld hl,interrupt ;your routine adress
ld (0fd9bh),hl

end your routine with:
pop af ;nop pop voor call FD9A
pop ix ;pop all registers
pop iy
pop af
pop bc
pop de
pop hl
ex af,af'
exx
pop af
pop bc
pop de
pop hl



This is a bit dangerous because you assume every bios pushes the registers the same way. A better way for ending the interrupt routine is:

in a,(99h)
ret

It's also shorter :-)

There is nothing wrong with "the wrong way". When the rom detects ram in page 0, it can swap out the bios, use the ram instead and install a proprietary interrupt handler. The bios isn't required anyway; all I/O is the same from MSX1 onwards.

GhostwriterP
msx addict
Berichten: 305
Geplaatst: 28 Juni 2006, 19:36   
Quote:

This is a bit dangerous because you assume every bios pushes the registers the same way.

I must admit I did not think about that. On the other hand I do not believe
this code part is something that is rewritten that often.
Anyway it would be smarter to use something like:

ld hl,11*2
add hl,sp
ld sp,hl

And now push and pop your own. (again asuming all regs will be pushed)

GhostwriterP
msx addict
Berichten: 305
Geplaatst: 28 Juni 2006, 19:48   
Not quite right... we have to add these so save hl.
ld (savehl),hl
ld hl,(savehl)
DamageX
msx freak
Berichten: 166
Geplaatst: 29 Juni 2006, 00:34   
Quote:


in a,(99h)
ret



What is the difference between ret and reti? And is ei normally needed at the end of the interrupt routine also?
Sonic_aka_T

msx guru
Berichten: 2262
Geplaatst: 29 Juni 2006, 00:37   
Quote:

Quote:


in a,(99h)
ret



What is the difference between ret and reti? And is ei normally needed at the end of the interrupt routine also?

RETI isn't really used on MSX. It'll work exactly like a RET would. Wether or not EI is needed depends on the ISR. If you use the BIOS hooks you won't need to EI. When making your own ISR you'd have to enable them eventually, of course.
 
 







(c) 1994 - 2008 Stichting MSX Resource Center. MSX is een trademark van MSX Licensing Corporation.