Demptronic NFL Football
Moderator: Moderators
- raydempsey
- Posts: 160
- Joined: Sat May 31, 2014 4:12 pm
Re: Demptronic NFL Football
As you can see, the menu has progressed but the field doesn't reflect the options selected yet. My next steps will be:
1) make the top three rows of the field stationary (never did this is a game before, reading Nerdy Nights to see how)
2) figure out why the screen still temporarily tweaks out when I write to the PPU
I thought I was following a basic principle: wait for VBlank then make writes to the PPU during Vblank. The subroutines that are causing the tweaks are DrawArrow and DrawSpeed. You can see the quick glitches by navigating the menu and making adjustments to the wind speed or wind direction. The correct background tiles are being placed but always with a quick screen tweak. It almost seems like my JSR NMIwait 's aren't doing anything.
Why is this still happening? Thanks for the advice.
1) make the top three rows of the field stationary (never did this is a game before, reading Nerdy Nights to see how)
2) figure out why the screen still temporarily tweaks out when I write to the PPU
I thought I was following a basic principle: wait for VBlank then make writes to the PPU during Vblank. The subroutines that are causing the tweaks are DrawArrow and DrawSpeed. You can see the quick glitches by navigating the menu and making adjustments to the wind speed or wind direction. The correct background tiles are being placed but always with a quick screen tweak. It almost seems like my JSR NMIwait 's aren't doing anything.
Why is this still happening? Thanks for the advice.
Re: Demptronic NFL Football
It looks like it's not resetting the PPU address with $2006 after updating VRAM. You should set it to $0000 before vblank ends.
Re: Demptronic NFL Football
Better yet: reset the scroll by writing to $2000 (to select a name table) and $2005 (to set X and Y scroll), which are the registers designed for this. Setting $2006 to $0000 works in some cases, but that doesn't fully set the scroll (the fine X scroll can only be changed through $2005), so it's safer to use $2000/$2005, and since you'll be doing that, writing to $2006 becomes redundant.Memblers wrote:You should set it to $0000 before vblank ends.
- raydempsey
- Posts: 160
- Joined: Sat May 31, 2014 4:12 pm
Re: Demptronic NFL Football
I'm still not sure how to change my code based on your suggestions because I am new enough that I don't understand VBlank as much as I thought. This is the code my other program uses:Better yet: reset the scroll by writing to $2000 (to select a name table) and $2005 (to set X and Y scroll), which are the registers designed for this. Setting $2006 to $0000 works in some cases, but that doesn't fully set the scroll (the fine X scroll can only be changed through $2005), so it's safer to use $2000/$2005, and since you'll be doing that, writing to $2006 becomes redundant.
Code: Select all
LDA #%10010000
STA $2000
LDA #%00011110
STA $2001
LDA #$00
STA $2005
STA $2005
Re: Demptronic NFL Football
It's affecting scrolling because basically all PPU registers are a copy of a single register when they're written to. You have to restore the register internally by writing the correct scroll as the last thing you do in Vblank.
- raydempsey
- Posts: 160
- Joined: Sat May 31, 2014 4:12 pm
Re: Demptronic NFL Football
Code: Select all
Indirect0:
.db $00,$1E,$37,$3F
Indirect1:
.db $F0,$F0,$F0,$F0
Code: Select all
LDX temp
LDA Indirect0,X
STA $A0
LDA Indirect1,X
STA $A1
LDY #$23
LDA [$A0],Y
Code: Select all
.bank 15
.org $F000
.db $00,$20,$CF,$71,(.etc)
Re: Demptronic NFL Football
Yeah, replace the Indirect0 and 1 tables with something like this. I haven't used nesasm in a while so I'm not sure what the equivalent syntax is, check the docs. Honestly, I'd advise using a different assembler because of bad experiences I've had with nesasm (having it assemble bad code instead of giving an error message), but you can probably get by anyways, and that topic is covered in several other threads.
edit: Also, if you need to know the size of a table, you can do stuff like this:
Or you can use that same expression as the immediate operand of a CMP instruction or whatever. I'm kinda veering off-topic here, but anyways..
Code: Select all
Indirect0:
.byte <table0, <table1, <table2 ; low byte
Indirect1:
.byte >table0, >table1, >table2 ; high byte
.org $F000
table0: .byte $00, etc.
table1: .byte $FF, etc.
Code: Select all
table0: .byte $00,$01,$02,etc.
table0_end:
table0_size: .word (table0_end - table0)
or
table0_size: .byte ((table0_end - table0) & $00FF)
- raydempsey
- Posts: 160
- Joined: Sat May 31, 2014 4:12 pm
Re: Demptronic NFL Football
I am not all that fond of NESASM3 as an assembler and I've heard mostly complaints about it so I'd be willing to convert my game to Asm6 if it isn't too difficult. Will that be hard to do?
Re: Demptronic NFL Football
It wouldn't be too hard. The main thing would be changing the way the memory is banked/padded. I haven't used ASM6 for a large project, but I think it would go something like this:
and so on. When you gets to the CHR data, then of course the .org doesn't matter. Just .incbin your CHR file, and it's all good as long as it started at the right offset. I'm not sure how you'd want to handle your unused/blank PRG banks, if it was me I'd probably just make some kind of skeleton file and .include it repeatedly for each bank. Or you could try just using a big .pad directive, I don't know if it'll take a larger than 16-bit address though, could try it. Maybe someone else would have a better suggestion.
The rest of the conversion should be simple text search-and-replace. Changing indirect [ to ( and ] to ), and for local labels, . to @
Code: Select all
.byte ; before any .org directive, define iNES header here, or just rip out your existing 16 byte header and .incbin it
.org $8000
; code here
.pad $FFFA
;vectors here, then it overflows to the next bank
.org $8000
; next bank's code
.pad $FFFA
;next bank's vectors
The rest of the conversion should be simple text search-and-replace. Changing indirect [ to ( and ] to ), and for local labels, . to @
- raydempsey
- Posts: 160
- Joined: Sat May 31, 2014 4:12 pm
Re: Demptronic NFL Football
I'm going to give conversion a shot and show everything I did. I will have the before and after posted as I do. I converted to lowercase letters and that's about it. I really don't know what to do but so far I put the .iNES header above as .byte code. Not sure if that's right. Not sure what to do with the .bank 15 type stuff because it is my first error in ASM6 so far. I'll keep grinding at this until I get it.
- Attachments
-
- NFL_asm6.asm
- (26.92 KiB) Downloaded 265 times
-
- NFL_NESASM.asm
- (26.84 KiB) Downloaded 268 times
Last edited by raydempsey on Tue Dec 29, 2015 5:55 am, edited 1 time in total.
Re: Demptronic NFL Football
Yeah that sounds reasonable, I seem to recall my earliest programs always had the opcodes in caps, but I soon switched to lowercase probably because it was easier to type. It somehow looks cooler or more "official" in caps, but it's hardly worth any trouble. Actually, looking at my current project, for PIC16, it's all in C except maybe 12 lines of assembly, and it looks like I had typed those asm opcodes in caps just for looks I guess, heheh.
I always type constant values in caps though (expressions and stuff that are defined with EQU or = and such, often used for immediate # operands), it's always good practice to distinguish those from variables.
I always type constant values in caps though (expressions and stuff that are defined with EQU or = and such, often used for immediate # operands), it's always good practice to distinguish those from variables.
- raydempsey
- Posts: 160
- Joined: Sat May 31, 2014 4:12 pm
Re: Demptronic NFL Football
OK so I've been looking at my NESASM3 code and trying to convert in to ASM6-ready code but I really don't know what to do exactly. I looked at the .NES file to retrieve the header, which I rewrote at the top of my program. I'm getting the following errors:
1) 'Illegal instruction' errors only on my .bank code.
2) 'Value out of range' errors on jmp's and jsr's
3) I'm getting tons and tons of 'PC out of range' errors on just about every line. My current code has two spaces before each thing. Should there be a tab or something?
I converted my local labels from .Skip to @Skip and will wait until it runs to implement + and - looping labels. I converted square brackets to round brackets. How do I complete the conversion?
1) 'Illegal instruction' errors only on my .bank code.
2) 'Value out of range' errors on jmp's and jsr's
3) I'm getting tons and tons of 'PC out of range' errors on just about every line. My current code has two spaces before each thing. Should there be a tab or something?
I converted my local labels from .Skip to @Skip and will wait until it runs to implement + and - looping labels. I converted square brackets to round brackets. How do I complete the conversion?
- Attachments
-
- NFL_ASM6.asm
- (26.92 KiB) Downloaded 254 times
Re: Demptronic NFL Football
ASM6 doesn't have a .bank command. You can use .base to start a bank instead, and .org to pad each bank until the end. Here's what a mapper 2 program with 4 PRG-ROM banks could look like in ASM6:raydempsey wrote:1) 'Illegal instruction' errors only on my .bank code.
Code: Select all
.incbin "header.bin"
;bank 0
.base $8000
;(bank contents)
.org $c000
;bank 1
.base $8000
;(bank contents)
.org $c000
;bank 2
.base $8000
;(bank contents)
.org $c000
;bank 3
.base $c000
;(bank contents)
.org $fffa
.dw NMI
.dw Reset
.dw IRQ
- raydempsey
- Posts: 160
- Joined: Sat May 31, 2014 4:12 pm
Re: Demptronic NFL Football
I cleared up the error notifications from ASM6 but there is still something wrong. This is what I have so far taking tokumaru's advice. As you can see I am really close. First, I don't know if I have the right header because when I look at the .nes file produced, the header takes up 32 bytes for some reason. Any suggestions from here?
- Attachments
-
- NFL-ASM6.asm
- (27.08 KiB) Downloaded 262 times
Re: Demptronic NFL Football
I assembled it, the header looks OK to me. Looking in a hex editor, the code starts at offset $E010, which shows the header added 16 ($10) bytes.
It looks like you need to add more banks or change the header, the header shows 8 * 16kB PRG banks, but the asm file only creates 4 16kB PRG banks.
I'm using asm6 v1.51 BTW, kinda old, if that matters. loopy's site moved, I'm not sure where to get the newer version.
edit: yep, I changed 8 prg pages to 4 in the header, and it runs again.
It looks like you need to add more banks or change the header, the header shows 8 * 16kB PRG banks, but the asm file only creates 4 16kB PRG banks.
I'm using asm6 v1.51 BTW, kinda old, if that matters. loopy's site moved, I'm not sure where to get the newer version.
edit: yep, I changed 8 prg pages to 4 in the header, and it runs again.