gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

DS development > how to access the GBA catridge port?

#95704 - smoothingeye - Sun Jul 30, 2006 8:07 pm

How do i access the GBA catridge port . How to i set data into the A0-A15 and D0-D7 and how to i set some pin to be high or low and how do i read data off from there?

thanks

#95706 - tepples - Sun Jul 30, 2006 8:08 pm

Reiner Ziegler's GBA page has hardware info.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#95721 - smoothingeye - Sun Jul 30, 2006 8:27 pm

What happen when i write to 0x080000? what will be written to the catride bus ? How can i do bus programming sorry i do not seems to find the information in the page

#95746 - Payk - Sun Jul 30, 2006 10:15 pm

hmhmh i cant give u that informations but i can give u a hind...gbfs has source out there...so u can watch how they did it...and even better hind is:
use romdiscfs....its like gbfs with stdio like functions...also there the source is aviable....i hope i helped with that...what u are aiming to?

#95957 - smoothingeye - Mon Jul 31, 2006 6:46 pm

it may sound stupid but can someone explain the the following address and how it affect the bus

when i write the address 0x08000000 what will be put in the bus ?
and if i read this address what will happen?


Code:
#define CF_RD_DATA          (*(volatile u16*)(0x08000000 + 0x00000))
#define CF_RD_ERROR         (*(volatile u16*)(0x08000000 + 0x20000))
#define CF_RD_SECTOR_COUNT  (*(volatile u16*)(0x08000000 + 0x40000))
#define CF_RD_SECTOR_NO     (*(volatile u16*)(0x08000000 + 0x60000))
#define CF_RD_CYLINDER_LOW  (*(volatile u16*)(0x08000000 + 0x80000))
#define CF_RD_CYLINDER_HIGH (*(volatile u16*)(0x08000000 + 0xA0000))
#define CF_RD_SEL_HEAD      (*(volatile u16*)(0x08000000 + 0xC0000))
#define CF_RD_STATUS        (*(volatile u16*)(0x08000000 + 0xE0000))

#define CF_WR_DATA          (*(volatile u16*)(0x08000000 + 0x00000))
#define CF_WR_FEATURES      (*(volatile u16*)(0x08000000 + 0x20000))
#define CF_WR_SECTOR_COUNT  (*(volatile u16*)(0x08000000 + 0x40000))
#define CF_WR_SECTOR_NO     (*(volatile u16*)(0x08000000 + 0x60000))
#define CF_WR_CYLINDER_LOW  (*(volatile u16*)(0x08000000 + 0x80000))
#define CF_WR_CYLINDER_HIGH (*(volatile u16*)(0x08000000 + 0xA0000))
#define CF_WR_SEL_HEAD      (*(volatile u16*)(0x08000000 + 0xC0000))
#define CF_WR_COMMAND       (*(volatile u16*)(0x08000000 + 0xE0000))

#define GAME_PAK      0x08000000         // Game pack start address
#define MP_DATA         (vu16*)(GAME_PAK + 0x01000000)      // Pointer to buffer of CF data transered from card
#define MP_REG_LBA1      *(vu16*)(GAME_PAK + 0x01060000)   // 1st byte of sector address
#define CARD_TIMEOUT   10000000      // Updated due to suggestion from SaTa, otherwise card will timeout sometimes on a write

#95991 - tepples - Mon Jul 31, 2006 8:03 pm

When you read an address, it puts the address shifted right by 1 on the cart's address lines and asserts the "seek" signal. Then it asserts the "read" signal and reads a data word from the 16 lower address lines. Repeatedly asserting the "read" signal reads subsequent data words.

For example:
  • Read 0x08000000. GBA puts 0x000000 on the cart's address lines, asserts "seek", asserts "read", and reads the data lines.
  • Read 0x08000002. GBA detects a consecutive access, skips the seek, asserts "read", and reads the data lines.
  • Read 0x08000004. GBA detects a consecutive access, skips the seek, asserts "read", and reads the data lines.
  • Read 0x08CA8642, GBA puts 0x654321 on the cart's address lines, asserts "seek", asserts "read", and reads the data lines.

EDIT: correct an address in the third example
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.


Last edited by tepples on Tue Aug 01, 2006 4:11 pm; edited 1 time in total

#96112 - smoothingeye - Tue Aug 01, 2006 12:34 pm

Why is it necessary to shift 1 bit ?

#96117 - Mighty Max - Tue Aug 01, 2006 12:53 pm

The gba port delivers 16bit each access. You can therefor access every bit while reading/writing at 2-byte aligned addresses. You can therefor access every bit while the addr0 line would be 0.

To increase the addressrange, with the same amount of addressbits, the HW just drop this bit and append another bit on the other side. This is the 1 bit shift.

Now you can address 2^24 * 2 bytes = 32Megabyte instead of the 2^24 bytes = 16Megabyte without this little trick.
_________________
GBAMP Multiboot

#96141 - smoothingeye - Tue Aug 01, 2006 5:20 pm

Quote:
The gba port delivers 16bit each access. You can therefor access every bit while reading/writing at 2-byte aligned addresses. You can therefor access every bit while the addr0 line would be 0.


sorry i cannot understand this part "while the addr0 line would be 0" what does it mean . and how do i access other line like the CS WR RD lines ?

#96144 - smoothingeye - Tue Aug 01, 2006 5:43 pm

say i read 0x08000000 + 0x60000). what will the address in binary in the bus? from AD0 - AD23?

how to assert seek and assert a Read or write?

#96145 - tepples - Tue Aug 01, 2006 5:47 pm

0x060000 >> 1 = 0x030000
In binary, this number is 0000 0011 0000 0000 0000 0000
(Every hexadecimal digit corresponds to a string of four bits.)
Bits 23 through 18 are 0; bits 17 and 16 are 1; bits 15 through 0 are 0.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#96339 - smoothingeye - Wed Aug 02, 2006 6:32 pm

Code:
MP_DATA         (vu16*)(GAME_PAK + 0x01000000)


why is it at this area . and also can i access to other IO lines in the GBA bus?