MagicEngine
Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Japanese English 

BRAM code

 
Post new topic   Reply to topic    MagicEngine Forum Index -> General
View previous topic :: View next topic  
Author Message
ccovell
Regular
Regular


Joined: 19 Dec 2005
Posts: 100
Location: Japan

PostPosted: Wed Nov 15, 2006 3:42 am    Post subject: BRAM code Reply with quote

I'm going to try adding some BRAM-accessing code to my game, so...

Has anyone ever done any programming to interface with the BRAM area? Like, searching through it, adding/deleting files? Are there any pitfalls I should be worrying about?
_________________
http://www.chrismcovell.com
Back to top
View user's profile Send private message Visit poster's website
David Shadoff
Regular
Regular


Joined: 10 May 2002
Posts: 83
Location: Toronto, Ontario, Canada

PostPosted: Wed Nov 15, 2006 7:43 am    Post subject: Reply with quote

How are you planning on accessing it - directly, or via CDROM system card routines ?

If you are accessing it directly, you need to be in CSL slow CPU mode... but I've never tried using the system card's routines.

I also have information on the link-list format somewhere, but I'm pretty sure you can figure that out for yourself without my help...

Oh yeah, and I recall while single-stepping through games a while back that there appeared to be a write-protect latch that needed to be hit... although that didn't appear to do anything (it seemed like maybe something from a preliminary devkit maybe, which wasn't implemented in the commercial design).

Maybe Bt has done some of this stuff...
Back to top
View user's profile Send private message
ccovell
Regular
Regular


Joined: 19 Dec 2005
Posts: 100
Location: Japan

PostPosted: Wed Nov 15, 2006 2:31 pm    Post subject: Reply with quote

I'm going to be implementing it directly (through my own code). I know I have to switch to slow CPU mode, but I'm wondering if it's possible to do BRAM-RAM DMA transfers in that mode...?

I think I understand the format OK; I remember chatting with you on IRC as I looked at it. I think I understand the header info, and checksum (which is actually a checksubtract, since it subtracts all bytes in a save file from $0000. I'll have to refresh my memory on stuff like that.

I guess looking at how some games do it wouldn't hurt.
_________________
http://www.chrismcovell.com
Back to top
View user's profile Send private message Visit poster's website
dmichel
Admin
Admin


Joined: 04 Apr 2002
Posts: 1166
Location: France

PostPosted: Wed Nov 15, 2006 11:57 pm    Post subject: Reply with quote

I don't remember who wrote it but don't we have a BRAM lib in HuC? It's written in ASM if I remember right.
_________________
David Michel
Back to top
View user's profile Send private message
David Shadoff
Regular
Regular


Joined: 10 May 2002
Posts: 83
Location: Toronto, Ontario, Canada

PostPosted: Thu Nov 16, 2006 4:39 am    Post subject: Reply with quote

Geez David, I think you're right.

What's really strange is... I think I wrote part of it (but I didn't work too hard at testing it).
Back to top
View user's profile Send private message
nodtveidt
Elder
Elder


Joined: 27 Dec 2004
Posts: 414
Location: Isla del Encanto

PostPosted: Thu Nov 16, 2006 1:19 pm    Post subject: Reply with quote

Yes, HuC has BRAM functions in the clib (since version 1.5, with some functions appearing in 3.03). I've used them for ages.
_________________
Frozen Utopia
Retro gaming was never this cool.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
ccovell
Regular
Regular


Joined: 19 Dec 2005
Posts: 100
Location: Japan

PostPosted: Fri Dec 08, 2006 2:59 pm    Post subject: HuC BRAM libs have a bug!? Reply with quote

Hi, I'm having fun (?) using the BRAM interfacing routines from HuC, but I think I've discovered a serious bug in the routines that use bm_open().
The function goes like this:
Code:
; bm_open(char *name [bx])
; ---
; Internal function to obtain access to a named file
...
     ; -- compare names
     cly
     ldx   #4
.l2:     lda   [_bx],Y
     sxy
     cmp   [_si],Y
...


But the functions bm_delete(), bm_read(), and bm_write() store the name in AX (comments mine):
Code:
lib2_bm_delete:
   __stw   <_ax      ;Is this for real????
     jsr   lib2_bm_open
     bcs   .out
...


I was getting file deletion errors every time I tried, and then I noticed this mistake in the HuC Libs. Actually, several other functions also say that parameters are passed through [bx] but the functions that call them pass them through AX. Whoever actually wrote the BRAM libs might want to look into this.
_________________
http://www.chrismcovell.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    MagicEngine Forum Index -> General All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group