kramlat
Moldy Popcorn
got slack?
Posts: 42
|
Post by kramlat on Jun 4, 2004 19:03:41 GMT -5
how do you get a BASIC game to do SRAM saves, and how do you get it to lock onto other BASIC games, I wish to know how to do these for a project.
|
|
|
Post by Tom Maneiro on Jun 5, 2004 18:51:10 GMT -5
Raw assembly man, raw assembly is that you need!
|
|
kramlat
Moldy Popcorn
got slack?
Posts: 42
|
Post by kramlat on Jun 7, 2004 1:12:56 GMT -5
explain: what sort of regions would need raw assembly?
|
|
kramlat
Moldy Popcorn
got slack?
Posts: 42
|
Post by kramlat on Jun 7, 2004 1:15:22 GMT -5
what I am asking, is for a more detailed answer, like first of all, what sort of "raw assembly" would be needed in order to page the region of the SRAM saves. if you can post your reply in a more user friendly way, maybe you will help out more than just me.
|
|
oompa loompa
I AM THE GOVERNATOR
"Git 'Er Dun!"
Posts: 1,301
|
Post by oompa loompa on Jun 11, 2004 0:04:10 GMT -5
mmmmmm, i don't think saving to sram is going to work with the current version of basiegaxorz (at least on emulators, but i doubt you'd use real hardware to test). This is b/c the rom header needs a couple of bytes modified in order for an emulator to use save sram. but anyways, if the header's all good, and you manually hex editted it, then this is how you would r/w to the sram: use peek to read data from the sram use poke to write data to the sram the address for the function is the address of the sram you mapped. this address differs from cartridge to cartridge (commercial), there is no set value for the address of the sram, that's all going to be up to the coder. usually its at &h200000. The size of the save sram depends on the size of sram you want, der. If the sram is allocated for odd bytes, then the addresses would be 0x01, 0x03, 0x05, etc. If even addressed, then it would be 0x00, 0x02, 0x04, etc. Here's an example: to save the number 54 into even sram location 10 with sram mapped at &h200000, you'd do: poke 54,&h200014 to save the string "HELLO" into even sram location 64 with sram mapped at &h300000, you'd do the following: poke asc("H"),&h300080 poke asc("E"),&h300082 poke asc("L"),&h300084 poke asc("L"),&h300086 poke asc("O"),&h300088 poke 0,&h30008A ' we always need a null after strings to read the data at odd sram location 90 with sram mapped at &h200000: myval=peek(&h20000B5) this method might suck, and may not be the easiest, and may take some assembly coding here and there to make reading/writing practical data easily. i will have an option to include save sram, and include some functions/commands to write to it in the next release of the compiler hope this explanation was "detailed" enough
|
|
|
Post by Tom Maneiro on Jun 12, 2004 18:30:49 GMT -5
And... what bytes i need to edit in the header? (maybe for add it in the next GenRomSuite release)
|
|
oompa loompa
I AM THE GOVERNATOR
"Git 'Er Dun!"
Posts: 1,301
|
Post by oompa loompa on Jun 15, 2004 12:42:03 GMT -5
extracted from genrom.txt:
1B0h External RAM Data When no external RAM is mounted, fill the address by a space code and when it is mounted follow the following: 1B0h: dc.b 'RA', %1x1yz000, %00100000 1B4h: dc.l RAM start address 1B8h: dc.l RAM end address
x 1 for BACKUP and 0 If not BACKUP yz 10 if even address only 11 if odd address only 00 if both even and odd address
|
|
|
Post by Tom Maneiro on Jun 19, 2004 22:33:31 GMT -5
Litte complex... but i will try to understand it.
|
|
kramlat
Moldy Popcorn
got slack?
Posts: 42
|
Post by kramlat on Jul 8, 2004 16:17:11 GMT -5
actually it is just what I was looking for thanx, I do understand that sort of asm.
I know that dc.b writes bytes directly to the rom, dr.w writes words directly to the rom, and dc.l writes long words to the rom, and .q on a 68040 is a quad word (64 bits) I plan to use dc.b, dc.w, and dc.l to build compressed levels and art using datafile, then decompress art into vram, like the everyday genesis game does, but sprites that move wont be compressed, and yes I recognise poke and peek, they work sorta like move I used BASIC a long time ago, I just dont know what all the addresses do, btw I plan to keep the text tiles in vram, so that I can have mapped text on screens.
|
|