Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

#1 2015-01-22 15:48:36

Ben
Member
Registered: 2015-01-21
Posts: 10

[ASM] Cartridge RAM unsusable

Hello,

I'm having trouble trying to create my first ROM+RAM rom :
I've specified the cartridge type and the ram size in the header,  but, first, on my emulator memory window, I see all the bits of the RAM are set to 1 (RAM full of $FF) with no instruction for it, and, when I try to write a byte in it, it does nothing.

Do I miss something in my code ? Is there a specific method to read/write in cartridge RAM ?

Thanks.

I use WLA and Virtual  Boy Advance by the way.

Here is my code :


;###################### En-Tete #####################################

.ROMDMG
.NAME "RAM"
.CARTRIDGETYPE 8
.COMPUTEGBCHECKSUM
.COMPUTEGBCOMPLEMENTCHECK
.LICENSEECODENEW "17"
.EMPTYFILL $00

.MEMORYMAP
SLOTSIZE $4000
DEFAULTSLOT 0
SLOT 0 $0000
SLOT 1 $4000
.ENDME

.RAMSIZE 2

.ROMBANKSIZE $4000
.ROMBANKS 2

.BANK 0 SLOT 0

.ORG $0100
nop
jp start

.ORG $0104
;Logo Nintendo, obligatoire
.db $CE,$ED,$66,$66,$CC,$0D,$00,$0B,$03,$73,$00,$83,$00,$0C
.db $00,$0D,$00,$08,$11,$1F,$88,$89,$00,$0E,$DC,$CC,$6E,$E6
.db $DD,$DD,$D9,$99,$BB,$BB,$67,$63,$6E,$0E,$EC,$CC,$DD,$DC
.db $99,$9F,$BB,$B9,$33,$3E

;##################################################################
;###################### Programme ###################################

.org $0150
start:
   
    ld    hl,$A000
    ld    a,$48
    ld    (hl),a
loop:   
    nop
    jr    loop


;##################################################################

With this code I'm trying to get the value $48 at the first adress of my RAM ($A000)


[Ben]
-----------------------------------------------------

Offline

 

#2 2015-01-23 15:07:03

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: [ASM] Cartridge RAM unsusable

You have to enable the cart RAM.

ld a,$0A
ld ($0000),a

To disable it:

ld a,0
ld ($0000),a

Offline

 

#3 2015-01-24 10:50:13

Ben
Member
Registered: 2015-01-21
Posts: 10

Re: [ASM] Cartridge RAM unsusable

Thanks you, it works fine !
Do you know where I can find some information about the jump vectors ? My only sources are the pandocs and some web sites, but none of them give more information than :
--------------------------------------------------------------------------------
The following addresses are supposed to be used as jump vectors:

  0000,0008,0010,0018,0020,0028,0030,0038   for RST commands
  0040,0048,0050,0058,0060                  for Interrupts
--------------------------------------------------------------------------------

Thanks


[Ben]
-----------------------------------------------------

Offline

 

#4 2015-01-25 14:15:30

AntonioND
Member
Registered: 2014-06-17
Posts: 134
Website

Re: [ASM] Cartridge RAM unsusable

The first ones are used by RST opcodes. "RST 0x0008" is the same as "CALL 0x0008", but it's a byte long (call is 3 bytes long).
The other ones are the addresses where the CPU jumps after an interrupt (IF&IE&0x1F != 0) if IME is enabled.

Offline

 

#5 2015-01-26 16:13:52

Ben
Member
Registered: 2015-01-21
Posts: 10

Re: [ASM] Cartridge RAM unsusable

OK, thanks


[Ben]
-----------------------------------------------------

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson