Skip navigation
Welcome, Guest! Please Login or Join

Loading...

NES Programming Organized - Nerdy Nights

Jun 10, 2016 at 6:54:26 AM
freeman.pixelz (0)

< Cherub >
Posts: 5 - Joined: 04/08/2016
Profile
Thanks to this group, I have developed 3 music demos on NES/Famicom available here on github. The source asm files are available and you can see how I developed the sound engine.


Edited: 03/27/2017 at 03:05 PM by freeman.pixelz

Jun 16, 2016 at 11:13:15 AM
LayneFelix (0)

< Cherub >
Posts: 1 - Joined: 06/15/2016
Profile
Hi..i am not much familiar about its hardware but as per my knowledge some programmer back in the late 70s or early 80s made up the term using that idea from the novel whenever there were big debates about endianness. Big won out because it's more natural, but there are still people who claim the other is better. I guess most systems and computers at this time used little.

low cost pcb


Edited: 06/29/2016 at 01:54 PM by LayneFelix

Jul 9, 2016 at 9:07:58 AM
Daniel_Doyce (0)
avatar
< Eggplant Wizard >
Posts: 356 - Joined: 04/22/2016
North Carolina
Profile
I'm about to go through these tutorials in detail. Are the source code files still hosted somewhere? I see references to code in each of the sections, but no attachments. Thanks!

Jul 9, 2016 at 9:29:26 AM
SoleGooseProductions (120)
avatar
(Beau ) < Ridley Wrangler >
Posts: 2778 - Joined: 04/22/2013
Indiana
Profile
Originally posted by: Daniel_Doyce

I'm about to go through these tutorials in detail. Are the source code files still hosted somewhere? I see references to code in each of the sections, but no attachments. Thanks!

In the last paragraph of each lesson there is a link (it says "click here", but it is part way into the text). They seem to still be good for me. Good luck with learning, ask as many questions as you want  .


-------------------------
"The light that burns twice as bright burns half as long..." ~ Blade Runner

SoleGooseProductions.com


Jul 9, 2016 at 9:36:16 AM
Daniel_Doyce (0)
avatar
< Eggplant Wizard >
Posts: 356 - Joined: 04/22/2016
North Carolina
Profile
Originally posted by: SoleGooseProductions
 
Originally posted by: Daniel_Doyce

I'm about to go through these tutorials in detail. Are the source code files still hosted somewhere? I see references to code in each of the sections, but no attachments. Thanks!

In the last paragraph of each lesson there is a link (it says "click here", but it is part way into the text). They seem to still be good for me. Good luck with learning, ask as many questions as you want  .
 
Ah, now I feel stupid. Got it, thanks!

 

Jul 9, 2016 at 9:37:15 AM
SoleGooseProductions (120)
avatar
(Beau ) < Ridley Wrangler >
Posts: 2778 - Joined: 04/22/2013
Indiana
Profile
Never feel stupid! Judgment free zone here.

-------------------------
"The light that burns twice as bright burns half as long..." ~ Blade Runner

SoleGooseProductions.com


Jul 9, 2016 at 10:32:20 AM
KHAN Games (88)
avatar
(Kevin Hanley) < Master Higgins >
Posts: 7784 - Joined: 06/21/2007
Florida
Profile
The power of NGD on a Unicorn protects you.

Jul 9, 2016 at 11:09:38 AM
SoleGooseProductions (120)
avatar
(Beau ) < Ridley Wrangler >
Posts: 2778 - Joined: 04/22/2013
Indiana
Profile
Is the safe word still 6502?

-------------------------
"The light that burns twice as bright burns half as long..." ~ Blade Runner

SoleGooseProductions.com


Nov 08 at 5:49:11 AM
siudym (0)

(Lucas Siudym) < Cherub >
Posts: 1 - Joined: 10/19/2008
Poland
Profile
Hi,


I have a problem with background animation. Mapper is UNROM, so the animation is changing the tiles in VRAM (NameTable)


Unfortunately, the method is poor and takes a lot of NMI time. How do you animate background elements (change BGR tiles numbers in VRAM) to minimize the VBLANK time (NMI)?


 


The code that is used for the animation:
[code]
;------------------------------------
BGR_Anim:      ;in the NMI loop

   INC Anim_Timer   ;timer
   INC Anim_Timer
   INC Anim_Timer
   INC Anim_Timer

   LDA Anim_Timer
   CMP #$00
   BCC skip1

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$10          ;pattern table bgr tile1 nr.
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$11         ;pattern table bgr tile2 nr.
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$20         ;pattern table bgr tile3 nr.
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$21         ;pattern table bgr tile4 nr.
   sta $2007
   LDA #$00   ;reset screen
   STA $2006
   LDA #$00
   STA $2006

skip1:

   LDA Anim_Timer
   CMP #$40
   BCC skip2

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$12
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$13
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$22
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$23
   sta $2007
   LDA #$00
   STA $2006
   LDA #$00
   STA $2006

skip2:

   LDA Anim_Timer
   CMP #$80
   BCC skip3

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$14
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$15
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$24
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$25
   sta $2007
   LDA #$00
   STA $2006
   LDA #$00
   STA $2006

skip3:

   LDA Anim_Timer
   CMP #$C0
   BCC skip4

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$12
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$13
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$22
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$23
   sta $2007
   LDA #$00
   STA $2006
   LDA #$00
   STA $2006

skip4:
   RTS
[/code]


Edited: 11/08/2017 at 05:54 AM by siudym

Nov 08 at 7:48:31 PM
Mega Mario Man (58)
avatar
(Tim ) < Kraid Killer >
Posts: 2286 - Joined: 02/13/2014
Nebraska
Profile
Originally posted by: siudym
 
Hi,


I have a problem with background animation. Mapper is UNROM, so the animation is changing the tiles in VRAM (NameTable)


Unfortunately, the method is poor and takes a lot of NMI time. How do you animate background elements (change BGR tiles numbers in VRAM) to minimize the VBLANK time (NMI)?


 


The code that is used for the animation:
[code]
;------------------------------------
BGR_Anim:      ;in the NMI loop

   INC Anim_Timer   ;timer
   INC Anim_Timer
   INC Anim_Timer
   INC Anim_Timer

   LDA Anim_Timer
   CMP #$00
   BCC skip1

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$10          ;pattern table bgr tile1 nr.
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$11         ;pattern table bgr tile2 nr.
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$20         ;pattern table bgr tile3 nr.
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$21         ;pattern table bgr tile4 nr.
   sta $2007
   LDA #$00   ;reset screen
   STA $2006
   LDA #$00
   STA $2006

skip1:

   LDA Anim_Timer
   CMP #$40
   BCC skip2

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$12
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$13
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$22
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$23
   sta $2007
   LDA #$00
   STA $2006
   LDA #$00
   STA $2006

skip2:

   LDA Anim_Timer
   CMP #$80
   BCC skip3

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$14
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$15
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$24
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$25
   sta $2007
   LDA #$00
   STA $2006
   LDA #$00
   STA $2006

skip3:

   LDA Anim_Timer
   CMP #$C0
   BCC skip4

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$12
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$13
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$22
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$23
   sta $2007
   LDA #$00
   STA $2006
   LDA #$00
   STA $2006

skip4:
   RTS
[/code]


Ask this in this thread: http://nintendoage.com/forum/mess...

Hopefully someone there can help. I can't really see an issue from what you have posted. I have changed upwards to 36 tiles at once in my game with no issues. I know that's cutting it pretty close to the time limit with that many tiles.

-------------------------
Current Project
Isometric Survival Horror

Older Projects
Tailgate Party, Power Pad Demo, Happy Hour

Links
Store, Facebook, Twitter

Nov 09 at 3:41:34 AM
glutock (0)
avatar
< Little Mac >
Posts: 99 - Joined: 06/02/2015
France
Profile
Originally posted by: siudym
 
Hi,


I have a problem with background animation. Mapper is UNROM, so the animation is changing the tiles in VRAM (NameTable)


Unfortunately, the method is poor and takes a lot of NMI time. How do you animate background elements (change BGR tiles numbers in VRAM) to minimize the VBLANK time (NMI)?


 


The code that is used for the animation:
[code]
;------------------------------------
BGR_Anim:      ;in the NMI loop

   INC Anim_Timer   ;timer
   INC Anim_Timer
   INC Anim_Timer
   INC Anim_Timer

   LDA Anim_Timer
   CMP #$00
   BCC skip1

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$10          ;pattern table bgr tile1 nr.
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$11         ;pattern table bgr tile2 nr.
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$20         ;pattern table bgr tile3 nr.
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$21         ;pattern table bgr tile4 nr.
   sta $2007
   LDA #$00   ;reset screen
   STA $2006
   LDA #$00
   STA $2006

skip1:

   LDA Anim_Timer
   CMP #$40
   BCC skip2

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$12
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$13
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$22
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$23
   sta $2007
   LDA #$00
   STA $2006
   LDA #$00
   STA $2006

skip2:

   LDA Anim_Timer
   CMP #$80
   BCC skip3

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$14
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$15
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$24
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$25
   sta $2007
   LDA #$00
   STA $2006
   LDA #$00
   STA $2006

skip3:

   LDA Anim_Timer
   CMP #$C0
   BCC skip4

   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE1_AddrLO
   STA $2006
   lda #$12
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE2_AddrLO
   STA $2006
   lda #$13
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE3_AddrLO
   STA $2006
   lda #$22
   sta $2007
   LDA BGR_NT_TILE1_AddrHI
   STA $2006
   LDA BGR_NT_TILE4_AddrLO
   STA $2006
   lda #$23
   sta $2007
   LDA #$00
   STA $2006
   LDA #$00
   STA $2006

skip4:
   RTS
[/code]


after branching on Anim_Timer, and executing the corresponding code, you don't skip the rest of the code.
You should do something like this :
 
lda Anim_Timer
; cmp#$00 ; not needed
beq anim1
cmp #$40
beq anim2
cmp #$80
beq anim3
cmp #$C0
beq anim4
jmp skipAnimation

anim1:
 ; anim 1 code here
jmp skipAnimation

anim2:
 ; anim 2 code here
jmp skipAnimation

anim3:
 ; anim 3 code here
jmp skipAnimation

anim4:
 ; anim 4 code here

skipAnimation:

Note that I'm using BEQ and not BCC to check Anim_Timer state and update only once the NT.

Also you can replace this :
   LDA #$00
   STA $2006
   LDA #$00
   STA $2006

by this :
   LDA #$00
   STA $2006
   STA $2006

and this :
 
INC Anim_Timer   ;timer
INC Anim_Timer
INC Anim_Timer
INC Anim_Timer

by this :
 
lda Anim_Timer
clc
adc #$04
sta Anim_Timer

to gain cycles and ROM bytes.

Hope it helps !


Edited: 11/09/2017 at 03:46 AM by glutock