It is currently Mon Nov 20, 2017 10:38 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: Powerglove
PostPosted: Sun Jan 18, 2015 11:36 am 
Offline
User avatar

Joined: Tue Jun 11, 2013 1:04 pm
Posts: 52
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?


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Sun Jan 18, 2015 11:52 am 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3484
Location: Indianapolis
$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.


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Sun Jan 18, 2015 11:54 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6446
Location: UK (temporarily)
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.


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Fri Feb 20, 2015 11:47 am 
Offline
User avatar

Joined: Tue Jun 11, 2013 1:04 pm
Posts: 52
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?!


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Fri Feb 20, 2015 1:26 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3192
Location: Mountain View, CA, USA
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).


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Sun Jun 12, 2016 2:27 pm 
Offline
User avatar

Joined: Tue Jun 11, 2013 1:04 pm
Posts: 52
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 1657 times ]
Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Sun Jun 12, 2016 2:29 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6446
Location: UK (temporarily)
By using a mapper (such as MMC3) that provides such IRQs.


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Sun Jun 12, 2016 2:29 pm 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2981
Location: Tampere, Finland
Sprite 0 hit can't generate an interrupt (unfortunately).

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Sun Jun 12, 2016 2:52 pm 
Offline
User avatar

Joined: Tue Jun 11, 2013 1:04 pm
Posts: 52
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?


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Sun Jun 12, 2016 2:59 pm 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2981
Location: Tampere, Finland
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: kkfos.aspekt.fi


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Sun Jun 12, 2016 6:52 pm 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19234
Location: NE Indiana, USA (NTSC)
The other way is to use DPCM Split technique, which (ab)uses the DMC as a crude interval timer. See the DPCM Letterbox demo.


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Mon Jun 13, 2016 3:39 am 
Offline
User avatar

Joined: Tue Jun 11, 2013 1:04 pm
Posts: 52
Yes, I know the (amazing) DPCM demo. Maybe I will try, but there's another problem with the IRQ.
Code:
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:
   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?


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Mon Jun 13, 2016 5:42 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2981
Location: Tampere, Finland
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: kkfos.aspekt.fi


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Mon Jun 13, 2016 10:33 am 
Offline
User avatar

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


Top
 Profile  
 
 Post subject: Re: Powerglove
PostPosted: Wed Jun 15, 2016 12:26 pm 
Offline
User avatar

Joined: Tue Jun 11, 2013 1:04 pm
Posts: 52
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:
   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 1505 times ]
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 50 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group