I was a little unclear above.
Probably you''ll need more info on ports than simple tables with the possible bit values and their use.
Some PutPixel VDP pseudo:
// Get video ports via ROM calls (no standard)
// Wait for VDP to end previous processing
// Set VDP to command mode
// Write PUTPIXEL command to VDP
// Write Logical operator for PUTPIXEL
// Write Command end
// Set other VDP port to PALETTE mode
// Write Palette color 1
// Set VDP to "value" mode
// Write pixel value
// Write the end/process value to another port....
Better stop here. It was TOO long ago. But I hope you can see what I''m trying to say?
- One port can be used for multiple commands.
- Another port must thereafter be called for writing the value.
- Another port must thereafter be called for writing more values.
- Then the 2nd port must be used again...
- Reading/writing occurs in different ports.
So: Documentation on ports alone is NOT enough! Multiple ports are used in a specific order, and work together. Lots of good examples will probably be needed...
But then again - This was MSX-Z80 stuff - Maybe the nes is easy?
I know this is not exactly what you''re asking for, but this is all I can do. Hope it helps a little.
Indirect addressing
Yep, you're right about LDA $2000. I meant to load the value in $2000 in A. Maybe this is correct:
LDA ($2000).
(Looks through 6502 docs)
Nope, this is how it's done (I hope ):
LDA #0 ; Clear A.
LDA ($2000, X) ; Load A with memory in $2000
Thanks for answering my questions.
- Muzzafarath
Mad House Software
The Field Marshals
Edited by - Muzzafarath on July 9, 2000 4:56:14 PM
LDA ($2000).
(Looks through 6502 docs)
Nope, this is how it's done (I hope ):
LDA #0 ; Clear A.
LDA ($2000, X) ; Load A with memory in $2000
Thanks for answering my questions.
- Muzzafarath
Mad House Software
The Field Marshals
Edited by - Muzzafarath on July 9, 2000 4:56:14 PM
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
I don't want to screw you up by saying LDA $2000 isn't allowed, because it probably is!
I can't remember how the compiler distinguished between
LDA $09
LDA $2000
but I'm sure it was with square braces. I'd forgotten how many flavours of LDA there were!
LDA ($2000) - Means load A with the value held at mem add. $2000 - Direct indexed addressing.
LDA ($2000,X) - Means load A with the value held at mem add. ($2000 + X) - Indirect indexed addressing.
LDA ($2000),Y - Means load A with the value held at mem add. $2000 and ADD Y.
You might want to double check all that
- Baskuenen
I'm sure there are lots of problems to be encountered when trying to emulate a ROM, I can even remember read-only memory addresses that had to be written to! The OS must of caught them en-route to no-where land and did the right thing with it.
Some of those links seem pretty exhaustive, I'm sure it's all there.
I'm sure the Atari ROMS were simpler than what you have described for the MSX, they all manipulated the same readable memory as any other code, except for the hardware sprites, but these could be emulated in software quite easily.
Later
Matt
Check out my project at:www.btinternet.com/~Matthew.Bennett
Edited by - 3dModelMan on July 9, 2000 5:11:14 PM
I can't remember how the compiler distinguished between
LDA $09
LDA $2000
but I'm sure it was with square braces. I'd forgotten how many flavours of LDA there were!
LDA ($2000) - Means load A with the value held at mem add. $2000 - Direct indexed addressing.
LDA ($2000,X) - Means load A with the value held at mem add. ($2000 + X) - Indirect indexed addressing.
LDA ($2000),Y - Means load A with the value held at mem add. $2000 and ADD Y.
You might want to double check all that
- Baskuenen
I'm sure there are lots of problems to be encountered when trying to emulate a ROM, I can even remember read-only memory addresses that had to be written to! The OS must of caught them en-route to no-where land and did the right thing with it.
Some of those links seem pretty exhaustive, I'm sure it's all there.
I'm sure the Atari ROMS were simpler than what you have described for the MSX, they all manipulated the same readable memory as any other code, except for the hardware sprites, but these could be emulated in software quite easily.
Later
Matt
Check out my project at:www.btinternet.com/~Matthew.Bennett
Edited by - 3dModelMan on July 9, 2000 5:11:14 PM
Bas, gfx programming on the NES *seems* quite easy.
This is how you would write to VRAM in the NES:
1) Wait for VBlank (if 7th bit of register $2002 is set).
2) Write upper VRAM address byte into $2006.
3) Write lower VRAM address byte into $2006.
4) Write data to $2007.
And this is how you would read from VRAM in the NES:
1) Wait for VBlank (if 7th bit of register $2002 is set).
2) Write upper VRAM address byte into $2006.
3) Write lower VRAM address byte into $2006.
4) Read data from $2007 (.
Of course, how I should emulate all of this I have no idea right now, but it sure seems simpler than emulating the MSX-Z80
>> I''m sure there are lots of problems to be encountered when trying to emulate a ROM, I can even remember read-only memory addresses that had to be written to! <<
Read only memory that had to be written to? That seems weird
>> LDA ($2000) - Means load A with the value held at mem add. $2000 - Direct indexed addressing. <<
According to my docs, only JMP use direct indexed addressing. Oh well, it really doesn''t matter.
Emulating the NES seems like an interesting challenge, and if I fail, at least I have some knowledge about the 6502 CPU
- Muzzafarath
Mad House Software
The Field Marshals
This is how you would write to VRAM in the NES:
1) Wait for VBlank (if 7th bit of register $2002 is set).
2) Write upper VRAM address byte into $2006.
3) Write lower VRAM address byte into $2006.
4) Write data to $2007.
And this is how you would read from VRAM in the NES:
1) Wait for VBlank (if 7th bit of register $2002 is set).
2) Write upper VRAM address byte into $2006.
3) Write lower VRAM address byte into $2006.
4) Read data from $2007 (.
Of course, how I should emulate all of this I have no idea right now, but it sure seems simpler than emulating the MSX-Z80
>> I''m sure there are lots of problems to be encountered when trying to emulate a ROM, I can even remember read-only memory addresses that had to be written to! <<
Read only memory that had to be written to? That seems weird
>> LDA ($2000) - Means load A with the value held at mem add. $2000 - Direct indexed addressing. <<
According to my docs, only JMP use direct indexed addressing. Oh well, it really doesn''t matter.
Emulating the NES seems like an interesting challenge, and if I fail, at least I have some knowledge about the 6502 CPU
- Muzzafarath
Mad House Software
The Field Marshals
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Yes - I also can remember something about writing to ROM. It also was used for setting the entry point for external ROM cartridges orso...I don''t know exactly anymore...
Gee - This was all too long ago. In the previous posts I made, I confused myself a little - let alone the readers...
Muzzafarath: The VRAM stuff looks nice!
I''ll stop my rambling for a moment. Wait at a distant to see what this thread will bring. Maybe I''ll be back to confuse you all hehe
It sure is a fun thing to program - a nes emulator -
Gee - This was all too long ago. In the previous posts I made, I confused myself a little - let alone the readers...
Muzzafarath: The VRAM stuff looks nice!
I''ll stop my rambling for a moment. Wait at a distant to see what this thread will bring. Maybe I''ll be back to confuse you all hehe
It sure is a fun thing to program - a nes emulator -
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement