Powerglove

A place where you can keep others updated about your NES-related projects through screenshots, videos or information in general.

Moderator: Moderators

User avatar
Lazycow
Posts: 105
Joined: Tue Jun 11, 2013 1:04 pm
Location: Germany
Contact:

Re: Powerglove

Post by Lazycow »

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.

Image
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... :wink:

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?
User avatar
Memblers
Site Admin
Posts: 4044
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Re: Powerglove

Post by Memblers »

$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.
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Powerglove

Post by lidnariq »

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.
User avatar
Lazycow
Posts: 105
Joined: Tue Jun 11, 2013 1:04 pm
Location: Germany
Contact:

Re: Powerglove

Post by Lazycow »

Image
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...) :shock:

edit: wait, it's a 16k +8k rom... can't I use a 32k +8k rom without bankswitching?!
User avatar
koitsu
Posts: 4201
Joined: Sun Sep 19, 2004 9:28 pm
Location: A world gone mad

Re: Powerglove

Post by koitsu »

Lazycow wrote:edit: wait, it's a 16k +8k rom... can't I use a 32k +8k rom without bankswitching?!
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).
User avatar
Lazycow
Posts: 105
Joined: Tue Jun 11, 2013 1:04 pm
Location: Germany
Contact:

Re: Powerglove

Post by Lazycow »

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?
Attachments
shot.png
shot.png (955 Bytes) Viewed 5694 times
lidnariq
Posts: 11432
Joined: Sun Apr 13, 2008 11:12 am

Re: Powerglove

Post by lidnariq »

By using a mapper (such as MMC3) that provides such IRQs.
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Powerglove

Post by thefox »

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
User avatar
Lazycow
Posts: 105
Joined: Tue Jun 11, 2013 1:04 pm
Location: Germany
Contact:

Re: Powerglove

Post by Lazycow »

thefox wrote:Sprite 0 hit can't generate an interrupt (unfortunately).
:shock:

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?
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Powerglove

Post by thefox »

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
tepples
Posts: 22708
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Re: Powerglove

Post by tepples »

The other way is to use DPCM Split technique, which (ab)uses the DMC as a crude interval timer. See the DPCM Letterbox demo.
User avatar
Lazycow
Posts: 105
Joined: Tue Jun 11, 2013 1:04 pm
Location: Germany
Contact:

Re: Powerglove

Post by Lazycow »

Yes, I know the (amazing) DPCM demo. Maybe I will try, but there's another problem with the IRQ.

Code: Select all

irq:
pha
lda	#30+65
sta	$2001
pla
rti
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?

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!
Any hints?
User avatar
thefox
Posts: 3134
Joined: Mon Jan 03, 2005 10:36 am
Location: 🇫🇮
Contact:

Re: Powerglove

Post by thefox »

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
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Powerglove

Post by tokumaru »

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.
User avatar
Lazycow
Posts: 105
Joined: Tue Jun 11, 2013 1:04 pm
Location: Germany
Contact:

Re: Powerglove

Post by Lazycow »

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?

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
irq2.png (3.39 KiB) Viewed 5542 times
Post Reply