Hi,
I'm new at NES programming and I started coding a NES game entirely in assembly.
I attached a build to this message.
Actually it's not very intresting because I have a lot to do to finish it.
I make it for a PAL NES, so he may be harder on NTSC.
Flashdroïd - a little homebrew nes game.
Moderator: Moderators
Flashdroïd - a little homebrew nes game.
- Attachments
-
- laser.nes
- (40.02 KiB) Downloaded 76 times
Re: Flashdroïd - a little homebrew nes game.
Cool, getting your first game working is always a great feeling. I look forward to seeing where you go with this.
My games: http://www.bitethechili.com
Re: Flashdroïd - a little homebrew nes game.
That's cool. Seeing the "one pixel per frame" movement gives me a little twinge of nostalgia for my first NES programs. My apologies if you're familiar with the technique already, but you may want to consider using fixed-point (aka subpixel) precision for sprite movement, if you end up needing a wider range of movement speeds.
viewtopic.php?p=275221#p275221
viewtopic.php?p=275221#p275221
Re: Flashdroïd - a little homebrew nes game.
Hi,
Thanks for your replies.
Actually I don't want to add fixed point precision for the sprite mouvements.
I coded the level loading these last days, but I am stuck : after I JSR in the NMI to the .proc that loads the level, the nametable has not changed, and I don't know why.
Here's my code (I know, I could surely optimize it, but I want to get something working before) :
Thanks for your replies.
Actually I don't want to add fixed point precision for the sprite mouvements.
I coded the level loading these last days, but I am stuck : after I JSR in the NMI to the .proc that loads the level, the nametable has not changed, and I don't know why.
Here's my code (I know, I could surely optimize it, but I want to get something working before) :
Code: Select all
.proc LOADLEVEL
; Configure everything.
SEI
LDA #$00
STA PPUCTRL ; Zero at PPU registers.
STA PPUMASK
VBLANKCHECK:
BIT PPUSTAT ; Waiting for VBLANK.
BPL VBLANKCHECK
BIT PPUSTAT ; Setup the PPU for the nametable data.
LDA #$20
STA PPUADDR
LDA #$00
STA PPUADDR
STA PPUCTRL ; Zero at PPU registers.
STA PPUMASK
; Get ready.
LDX #$00
LDY #$00
LDA #$00
FILLTOP:
LDA #$00
STA PPUDATA
INX
CPX #$41
BNE FILLTOP
YLOOP:
PHA
LDX #$00
TAY
XLOOP:
; Get the y tile position.
; Get the y position
LSR ; Divide by 4 with two LSR.
LSR
ASL ; Multiply by 8, the with of the screen, with three ASL.
ASL
ASL
PHA ; Push it on the stack.
; Get the x tile position.
TXA
LSR ; Divide by 4 with two LSR.
LSR
STA gfxtmp ; Put it in gfxtmp.
; Add the Y and X positions together.
PLA ; Pull A from the stack and push A back there.
PHA
CLC
ADC gfxtmp ; Add the x position to the y one.
TAY ; transfer it into Y.
LDA (backgroundpos), Y ; Get the tile number.
TAY ; Put the tile number to y to be able to get the tile number later on.
; Get the Y tile position offset.
PLA ; Get the y tile position, and divide it by two.
LSR
STA gfxtmp
PLA ; Pull the y loop position and push it back on the stack.
PHA
CLC
SBC gfxtmp
; Substract the y loop position with the tile position/2 to get the y loop
; position % 4.
ASL ; Multiply it by 4 to have the y tile offset.
ASL
STA gfxtmp ; Store it in gfxtmp to be able to add it to y.
TYA ; Transfer the tile position into A.
CLC
ADC gfxtmp ; Add the Y offset.
TAY ; Put the Y position back on Y.
; Get the x tile position * 4.
TXA
LSR ; Divide by 4 with two LSR.
LSR
ASL ; Multiply by 4 with two ASL.
ASL
STA gfxtmp ; Store it in gfxtmp.
TXA ; Put the x loop position into A.
CLC
SBC gfxtmp
; Substract the x loop position / 4 * 4 from the x loop position to get the
; x loop position % 4, the x offset.
STA gfxtmp ; Store it on gfxtmp.
TYA ; Get the tile position.
CLC
ADC gfxtmp ; Add the x offset.
TAY ; Transfer the tile position back on Y.
; XLOOP end.
INX
CPX #$21
BNE XLOOP
; YLOOP end.
PLA
TAY
INY
TYA
CMP #$1D ; 7*4 = 28+1, the height of the map when she's rendered.
BNE YLOOP
YLOOPEND:
LDX #$00
FILLBOTTOM:
LDA #$00
STA PPUDATA
INX
CPX #$41
BNE FILLBOTTOM
END:
LDA #%10010000 ; Setting up the PPU.
STA PPUCTRL
LDA #%00011110 ; Enabling drawings.
STA PPUMASK
CLI
RTS
.endproc
Re: Flashdroïd - a little homebrew nes game.
Oh sorry, I just forgot to write to PPUDATA . I'm so tired this week that I can do a lot of s*** like this.
EDIT :
Now it loads the nametable, but the nametable looks weird, so ill need to search what I did wrong tomorrow.
EDIT :
Now it loads the nametable, but the nametable looks weird, so ill need to search what I did wrong tomorrow.