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 

Quick question about CD_READ

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


Joined: 04 Sep 2006
Posts: 7

PostPosted: Tue Sep 12, 2006 2:47 pm    Post subject: Quick question about CD_READ Reply with quote

According to this, _dh defines the destination address type, but I'm not quite sure what Local is. Is the data uploaded to RAM ($2000-$3FFFF) and then run from there? I've got a couple other questions about this function but I need to figure out exactly what it is I want to know.

Also, is there any documentation on the Arcade Card's RAM? tomaitheous mentioned it's accessed via a special port, but I haven't been able to find any information on the port (beyond the fact that it exists) that is particularly helpful.

Thanks. Smile
_________________
Twilight Translations - Changing the world one Japanese game at a time. Smile
Back to top
View user's profile Send private message
Tomaitheous
Elder
Elder


Joined: 27 Sep 2005
Posts: 306
Location: Tucson

PostPosted: Wed Sep 13, 2006 5:36 am    Post subject: Reply with quote

It looks like Local takes a 16bit destination address, so anywhere in the CPU logical address looks to be game.

Quote:
then run from there?


Is CD_EXEC what you're looking at? I believe this is also used/executed, with the values stored in the header of the second sector of the boot track, as part of the system card CD boot process.

Maybe David or Charles can chime in about the Arcade Card.
_________________
www.pcedev.net
Back to top
View user's profile Send private message
RedComet
Visitor
Visitor


Joined: 04 Sep 2006
Posts: 7

PostPosted: Wed Sep 13, 2006 12:26 pm    Post subject: Reply with quote

I'm not really trying to do anything in particular beyond understanding how the system works. I find that if I have a decent grasp on the hardware's working, I'm more comfortable with changing things if I can anticipate how they're going to affect the game.
_________________
Twilight Translations - Changing the world one Japanese game at a time. Smile
Back to top
View user's profile Send private message
Squaresoft74
Elder
Elder


Joined: 19 Apr 2002
Posts: 366
Location: France

PostPosted: Wed Sep 13, 2006 9:01 pm    Post subject: Reply with quote

Sorry for the off topic but since RedComet is checking this thread :

Quote:
So in the interest in hopefully seeing the game one day completed, here is what I managed to figure out


I wanted to give a look at your notes but the link on you homepage is currently broken.
_________________
Back to top
View user's profile Send private message Visit poster's website
RedComet
Visitor
Visitor


Joined: 04 Sep 2006
Posts: 7

PostPosted: Wed Sep 13, 2006 9:36 pm    Post subject: Reply with quote

Okay, should work now. Not everything in there is completely accurate since I've figured out a bit more since then, but it's enough to understand the workings of what's there.

I managed to get the font down to use the 8x8, but it just doesn't look good. I'm gonna try and get a font similar to Symphony of the Night's in there, so I guess I'm gonna have to figure out how to get the new font and code into memory without screwing something else up. Sad On the bright side, I only have to make a few changes to support 8x8, 16x16, 8x16, 16x8, or any other font size under 16x16.
_________________
Twilight Translations - Changing the world one Japanese game at a time. Smile
Back to top
View user's profile Send private message
RedComet
Visitor
Visitor


Joined: 04 Sep 2006
Posts: 7

PostPosted: Wed Sep 13, 2006 9:42 pm    Post subject: Reply with quote

Tomaitheous from RHDN wrote:
Are you trying to setup a boot loader? If so, then you won't need to use the CD_READ function - there's a more automated way.


If nobody minds, I'll just keep going over here since I think I'll get more informative responses concerning the PC Engine. Smile

I think a boot loader is what I'm interested in, so would you care to explain this more automated way?
_________________
Twilight Translations - Changing the world one Japanese game at a time. Smile
Back to top
View user's profile Send private message
Tomaitheous
Elder
Elder


Joined: 27 Sep 2005
Posts: 306
Location: Tucson

PostPosted: Fri Sep 15, 2006 1:37 am    Post subject: Reply with quote

Quote:
I think a boot loader is what I'm interested in, so would you care to explain this more automated way?


Sure. First read through this and this.

You can have the system boot to your code first by changing the location of the boot code to point to somewhere else in the initial data track - like near the end where there's usually just sectors full of 0's. Then after your code finishes, call the CD_exec function with the original sector address from the header. This is a little more complicated if the original boot header is more than just code, i.e. logo screen.
_________________
www.pcedev.net
Back to top
View user's profile Send private message
RedComet
Visitor
Visitor


Joined: 04 Sep 2006
Posts: 7

PostPosted: Fri Sep 15, 2006 3:42 am    Post subject: Reply with quote

Tomaitheous wrote:
Quote:
I think a boot loader is what I'm interested in, so would you care to explain this more automated way?


Sure. First read through this and this.

You can have the system boot to your code first by changing the location of the boot code to point to somewhere else in the initial data track - like near the end where there's usually just sectors full of 0's. Then after your code finishes, call the CD_exec function with the original sector address from the header. This is a little more complicated if the original boot header is more than just code, i.e. logo screen.


Hah, that's what I was thinking once I started reading about the boot sector. Glad I was on the right track. Now the only problem is finding a way to keep the new data/code in the PC Engine's physical memory. What would be the best way to go about this? Chuck it in an unused bank of the ADPCM buffer? Speaking of, is there any way, short of manipulating the MPR registers in Mednafen, to view the contents of the ADPCM buffer ($80-$87 in a Super CD, I think)?

Also, I tried running the hacked bin/cue in MagicEngine (mounted the cue via Daemon Tools) and the font doesn't show up at all! It works perfectly in Mednafen though. Is there something up with one of the emulators that would cause this? I'm thinking a checksum or something along those lines, but I don't recall reading anything about checksums in conjunction with the PC Engine thus far.
_________________
Twilight Translations - Changing the world one Japanese game at a time. Smile
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: Fri Sep 15, 2006 7:19 am    Post subject: Reply with quote

Quote:
According to this, _dh defines the destination address type, but I'm not quite sure what Local is. Is the data uploaded to RAM ($2000-$3FFFF) and then run from there? I've got a couple other questions about this function but I need to figure out exactly what it is I want to know.


Local means "currently mapped, physical memory in the regular 16-bit address range of the CPU". If you use the ADPCM or VRAM loads, the data does NOT get loaded first to an intermediate buffer; it goes directly to the final destination, one byte at a time as it is read from the disc.

re: discussion about boot loaders:
You can check out the startup.asm in the HuC development kit, in 'include/pce'. There is the bootloader that HuC uses, and it is (somewhat) commented too. But maybe that's overkill, if you just want to tweak an existing game.

Quote:

Now the only problem is finding a way to keep the new data/code in the PC Engine's physical memory. What would be the best way to go about this? Chuck it in an unused bank of the ADPCM buffer? Speaking of, is there any way, short of manipulating the MPR registers in Mednafen, to view the contents of the ADPCM buffer ($80-$87 in a Super CD, I think)?

OK, a couple of notes here...
(1) There is no way of knowing what part of memory is "unused", except through play-testing... unless you choose to alter the "expected hardware requirements". Like for a CDROM game, put it in Super CDROM memory, and require players to use a SuperCDROM (although you may probably want to add a system card check screen).
(2) ADPCM memory, like VRAM, is not directly connected to the CPU, so it is technically not "mapped into physical memory". You need to read it via a port into the main memory.
Back to top
View user's profile Send private message
Tomaitheous
Elder
Elder


Joined: 27 Sep 2005
Posts: 306
Location: Tucson

PostPosted: Fri Sep 15, 2006 8:03 am    Post subject: Reply with quote

Also, if your writing your own routine that writes to the VDC - you'll need to use the zeropage variable to store the reg your currently using. I don't remember off the top of my head what it is. If you don't, a games hsync interrupt routine can setup the wrong VDC REG on right before RTI exit and will cause corruption. Spriggan Mark 2 does this. Also be careful about using the block transfer instructions during active display as it will delay all interrupts.

Using the ADPCM buffer is a little tricky because you don't know if the game will over write it at any point in time. YsIV uses it, but I think Nightwolve said there were a few spots in the game in that he couldn't load the font because the system was using it for audio. I know Auleria uses it for text storage. I not to versed in ADPCM, but I think quite a few games use to as a make-shift CD data DMA too and this might overwrite the whole chuck at a time.


I know you mentioned something about subtitling the cinemas if the code existed for all the cinemas and not just the first one. I was thinking of doing this to another game. I was thinking I could do a SGX version and have the subtitles appear on the second VDC. That and a timer code +script.
_________________
www.pcedev.net
Back to top
View user's profile Send private message
RedComet
Visitor
Visitor


Joined: 04 Sep 2006
Posts: 7

PostPosted: Sun Sep 17, 2006 1:16 am    Post subject: Reply with quote

David Shadoff wrote:
(2) ADPCM memory, like VRAM, is not directly connected to the CPU, so it is technically not "mapped into physical memory". You need to read it via a port into the main memory.


That cleared it up a lot. I've a question about the CD functions that access the data based on its LBA. I'm new to LBA, so bear with me. Is the LBA returned by $F104 relative to the start of the data track or the start of the CD? Also, a bit of a newb question, but is the LBA address the same as the address would appear in a hex editor? I'm pulling all sorts of stuff off google that, while interesting, isn't exactly answering my questions aobut it.

I've been working through AD_TRANS and I've determined the address going in is $ED0000 and when converted by $F104, it becomes $1F1000. I checked that address ($1F10000) out in just the data track and it's plausible (at least in my mind) that that could be the correct data. Checked that same address out in the iso and it could seems a possible choice too.

AD_TRANS, so far, seems to be the only function taht's actually writing to the ADPCM buffer; AD_WRITE isn't called any from what I could see. AD_TRANS occurs right after the CD is run, but before teh Konami logo appears and at the beginning of each Stage after that, and that's it.

What I'm thinking is determine how much of the 64kb worth of data that is loaded is unused and place my code/data in there and let it be written into the ADPCM buffer along with the rest of the data. I haven't thought much further from there, though, but I have some ideas; I'm always open to suggests that'll make my life easier and/or lower my blood pressure. Razz
_________________
Twilight Translations - Changing the world one Japanese game at a time. Smile
Back to top
View user's profile Send private message
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