Powerglove
Moderator: Moderators
Re: Powerglove
Finally, I've got some time to continue with Powerglove. Cartridge init seems to work now, but I had to write my own PNG converter, because the chars seem to be numbered differently than on the C64 and my plan is use as much original code as possible.
pgtest1.nes
It's just a test image, but just in case you want to have some evidence that I am really working on this, here's the cartridge image...
Next up: colors (PNG converter only works b/w for now)
Which black do you usually use? ...and wasn't there a color you should not use?
pgtest1.nes
It's just a test image, but just in case you want to have some evidence that I am really working on this, here's the cartridge image...
Next up: colors (PNG converter only works b/w for now)
Which black do you usually use? ...and wasn't there a color you should not use?
Re: Powerglove
$0D is the color to avoid (in practice, it's almost never a problem though. Codemasters games always used it). $0F is usually used for black.
Re: Powerglove
Use colors $xE, $xF, or $1D for black. Don't use $0D, that's darker-than-black and some TVs will incorrectly parse it as hsync.
Re: Powerglove
pgtest2.nes
Ok, the png converter handles colors now. (Using $1d for black) - Still only a boring test picture.
I also changed the map generation to use 16x16 pixel tiles, but it does not fit into the 32k rom. Can you recommend a simple code example for ca65/cc65 bank switching? (i have found some code here at nesdev, but phew...)
edit: wait, it's a 16k +8k rom... can't I use a 32k +8k rom without bankswitching?!
Re: Powerglove
Yes, NROM ("mapper 0") supports that. Just make sure you pad things correctly with your assembler and/or linker so that your vectors/etc. end up in the last 16KByte portion of the 32KBytes (I'm sure you know why).Lazycow wrote:edit: wait, it's a 16k +8k rom... can't I use a 32k +8k rom without bankswitching?!
Re: Powerglove
Hi, I am currently working on a sprite-0 split for scrolling.
A busy-loop checking for bit 6 in $2002 seems to work, but... how can I trigger an interrupt?
A busy-loop checking for bit 6 in $2002 seems to work, but... how can I trigger an interrupt?
- Attachments
-
- shot.png (955 Bytes) Viewed 5694 times
Re: Powerglove
By using a mapper (such as MMC3) that provides such IRQs.
Re: Powerglove
Sprite 0 hit can't generate an interrupt (unfortunately).
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Re: Powerglove
thefox wrote:Sprite 0 hit can't generate an interrupt (unfortunately).
For a split at the top, I could busy-wait in the NMI-code for the sprite-0 hit. That might work.
Let's say I don't want to use a special chip like MMC3 (and no audio-IRQ), how do games usually handle a split at the bottom of the screen?
Re: Powerglove
They busy-wait (examples offhand: Addams Family, Ghostbusters II, Gradius). Of course this has obvious problems if the frame handling can take longer than a frame.
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Re: Powerglove
The other way is to use DPCM Split technique, which (ab)uses the DMC as a crude interval timer. See the DPCM Letterbox demo.
Re: Powerglove
Yes, I know the (amazing) DPCM demo. Maybe I will try, but there's another problem with the IRQ.
This little test is called at the beginning when I startup the NES. (screen turns green and I see some garbage)
here's the init code, did I disable IRQ correctly on startup?
Any hints?
Code: Select all
irq:
pha
lda #30+65
sta $2001
pla
rti
here's the init code, did I disable IRQ correctly on startup?
Code: Select all
sei
cld ; Decimal mode on famiclones: OFF!
ldx #$ff
txs
inx
stx PPU_MASK ; $2001
stx DMC_FREQ ; $4010
stx PPU_CTRL ; $2000 ;no NMI
stx $4015 ; DPCM and tone generators: OFF!
lda #$40
sta $4017 ; APU IRQ: OFF!
lda $4015 ; APU IRQ: ACK!
Re: Powerglove
Seems fine for disabling the APU frame IRQ. Have you tried in debugging emulators?
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
Re: Powerglove
After the SEI, no IRQs will ever fire, even if you fail to disable the IRQ sources. It's good practice to disable them anyway, though.
Re: Powerglove
Ok, I have found the bug, NMI and IRQ used parts of the same code segment. (oops)
Some progress: In the NMI, I wait for the sprite-0 hit (red part), then I setup the DPCM IRQ.
The IRQ-handler is called 3 times (green part), it increases a counter and wastes some time
and then at the 3rd call it disables the IRQ (lda #0 sta $4015). (end of green part)
But there's a problem: The start of the green part is moving with each frame.
I know, this should happen, BUT at the end of the movement, before it jumps back, it seems like one IRQ is missing for one frame. This is a bug, right? What's wrong? How do I avoid this?
Some progress: In the NMI, I wait for the sprite-0 hit (red part), then I setup the DPCM IRQ.
The IRQ-handler is called 3 times (green part), it increases a counter and wastes some time
and then at the 3rd call it disables the IRQ (lda #0 sta $4015). (end of green part)
But there's a problem: The start of the green part is moving with each frame.
I know, this should happen, BUT at the end of the movement, before it jumps back, it seems like one IRQ is missing for one frame. This is a bug, right? What's wrong? How do I avoid this?
Code: Select all
lda #$0f | DMC_IRQMODE
sta DMCFREQ
lda #SNDCHN_PSGS|SNDCHN_DMC
sta val_4015
sta $4015
sta $4015
sta $4015
cli
- Attachments
-
- irq2.png (3.39 KiB) Viewed 5542 times