It is currently Sat Sep 21, 2019 6:39 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 8 posts ] 
Author Message
PostPosted: Thu Mar 28, 2019 1:55 pm 
Offline

Joined: Mon Mar 25, 2019 10:58 am
Posts: 13
I'm following the Nerdy Nights tutorials and i'm unable to compile it together. Specifically, the variable/(.rsset) segment is unrecognizable.

Here's my code.
Code:
  .inesprg 1   ; 1x 16KB PRG code
  .ineschr 1   ; 1x  8KB CHR data
  .inesmap 0   ; mapper 0 = NROM, no bank swapping
  .inesmir 1   ; background mirroring

;;;;;;;;;;;;;;;;

   .rsset $0000

   gamestate   .rs 1
   ballx      .rs 1
   bally      .rs 1
   ballup      .rs 1
   balldown   .rs 1
   ballleft   .rs 1
   ballright   .rs 1
   ballspeedx   .rs 1
   ballspeedy  .rs 1
   paddletop1   .rs 1
   pattlebot1   .rs 1
   paddletop2   .rs 1
   pattlebot2   .rs 1
   buttons1   .rs 1
   buttons2   .rs 1
   score1      .rs 1
   score2      .rs 1
;;;;;;;;;;;;;;;;
;;Constants
   STATETITLE     = $00  ; displaying title screen
   STATEPLAYING   = $01  ; move paddles/ball, check for collisions
   STATEGAMEOVER  = $02  ; displaying game over screen

   RIGHTWALL      = $F4  ; when ball reaches one of these, do something
   TOPWALL        = $20
   BOTTOMWALL     = $E0
   LEFTWALL       = $04
 
   PADDLE1X       = $08  ; horizontal position for paddles, doesnt move
   PADDLE2X       = $F0

;;;;;;;;;;;;;;;;
   
   
   
   .bank 0
   .org $C000
RESET:
   SEI          ; disable IRQs
   CLD          ; disable decimal mode
   JSR vblankwait  jump to vblank wait #1
clrmem:
   LDA #$00
   STA $0000, x
   STA $0100, x
   STA $0300, x
   STA $0400, x
   STA $0500, x
   STA $0600, x
   STA $0700, x
   LDA #$FE
   STA $0200, x
   INX
   BNE clrmem
   JSR vblankwait   jump to vblank wait again

  LDA #%10010000   ; enable NMI, sprites from Pattern Table 0, background from Pattern Table 1
  STA $2000

  LDA #%00011110   ; enable sprites, enable background, no clipping on left side
  STA $2001



LoadBackground:
  LDA $2002             ; read PPU status to reset the high/low latch
  LDA #$20
  STA $2006             ; write the high byte of $2000 address
  LDA #$00
  STA $2006             ; write the low byte of $2000 address
  LDX #$00              ; start out at 0

Forever:
   JMP Forever      

vblankwait:      ;wait for vblank
   BIT $2002
   BPL vblankwait
   RTS

NMI:

;;Graphic Updates
   LDA #$00
   STA $2003
   LDA #$02
   STA $4014

   JSR DrawScore

   LDA #%10010000   ; enable NMI, sprites from Pattern Table 0, background from Pattern Table 1
   STA $2000
   LDA #%00011110   ; enable sprites, enable background, no clipping on left side
   STA $2001
   LDA #$00        ;;tell the ppu there is no background scrolling
   STA $2005
   STA $2005
   
;; Gamecode
   JSR ReadController1  ;;get the current button data for player 1
   JSR ReadController2  ;;get the current button data for player 2

GameEngine:
   LDA gamestate
   CMP #STATETITLE
   BEQ GameTitle

   LDA gamestate
   CMP #STATEGAMEOVER
   BEQ GameOver

   LDA gamestate
   CMP #STATEPLAYING
   BEQ GamePlaying
GameEngineDone:
   JSR UpdateSprites

   RTI

;;;;;;;;;;;;;;

GameTitle:
   JSR DisplayTitle
   LDA buttons1
   JMP GameEngineDone


DisplayTitle
   LDX #$00
   LoadBackgroundLoop:
   LDA background, x     ; load data from address (background + the value in x)
   STA $2007             ; write to PPU
   INX                   ; X = X + 1
   CPX #$80              ; Compare X to hex $80, decimal 128 - copying 128 bytes
   BNE LoadBackgroundLoop  ; Branch to LoadBackgroundLoop if compare was Not Equal to zero
                        ; if compare was equal to 128, keep going down
   RTS

UpdateSprites:
  LDA bally  ;;update all ball sprite info
  STA $0200
 
  LDA #$30
  STA $0201
 
  LDA #$00
  STA $0202
 
  LDA ballx
  STA $0203
 
  ;;update paddle sprites
  RTS
 
 
DrawScore:
  ;;draw score on screen using background tiles
  ;;or using many sprites
  RTS

;;Controller inputs
ReadController1:
  LDA #$01
  STA $4016
  LDA #$00
  STA $4016
  LDX #$08
ReadController1Loop:
  LDA $4016
  LSR A           ; bit0 -> Carry
  ROL buttons     ; bit0 <- Carry
  DEX
  BNE ReadControllerLoop
  RTS

ReadController2:
  LDA #$01
  STA $4016
  LDA #$00
  STA $4016
  LDX #$08
ReadController2Loop:
  LDA $4017
  LSR A           ; bit0 -> Carry
  ROL buttons     ; bit0 <- Carry
  DEX
  BNE ReadControllerLoop
  RTS

;;;;;;;;;;;;;;;;

 .bank 1                       ; change to bank 1
  .org $E000                    ; start at $E000

title:
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$44,$48,$48,$48,$48,$48,$48,$48,$48,$48,$48,$48,$48,$48,$48,$49,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$46,$26,$26,$26,$26,$26,$26,$26,$26,$26,$26,$26,$26,$26,$26,$4a,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$46,$26,$d0,$d1,$26,$d0,$d1,$26,$26,$d0,$d1,$26,$d0,$d1,$26,$4a,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$46,$26,$db,$d5,$26,$db,$db,$26,$26,$db,$db,$26,$db,$26,$26,$4a,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$46,$26,$db,$d7,$26,$db,$db,$26,$26,$db,$db,$26,$db,$db,$26,$4a,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$46,$26,$db,$26,$26,$d4,$d5,$26,$26,$db,$db,$26,$d4,$d5,$26,$4a,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$46,$26,$e1,$26,$26,$d6,$d7,$26,$26,$e1,$e1,$26,$d6,$d7,$26,$4a,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$5f,$78,$78,$78,$78,$78,$78,$78,$78,$78,$78,$78,$78,$78,$78,$7a,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$0c,$18,$19,$22,$20,$1b,$12,$1d,$0e,$24,$02,$00,$01,$09,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
   .db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24



  palette:
  .db $22,$29,$1A,$0F,  $22,$36,$17,$0F,  $22,$30,$21,$0F,  $22,$27,$17,$0F   ;;background palette
  .db $22,$1C,$15,$14,  $22,$02,$38,$3C,  $22,$1C,$15,$14,  $22,$02,$38,$3C   ;;sprite palette

sprites:
     ;vert tile attr horiz
  .db $80, $32, $00, $80   ;sprite 0
  .db $80, $33, $00, $88   ;sprite 1
  .db $88, $34, $00, $80   ;sprite 2
  .db $88, $35, $00, $88   ;sprite 3

   .org $FFFA     ;first of the three vectors starts here
  .dw NMI        ;when an NMI happens (once per frame if enabled) the
                   ;processor will jump to the label NMI:
  .dw RESET      ;when the processor first turns on or is reset, it will jump
                   ;to the label RESET:
  .dw 0          ;external interrupt IRQ is not used in this tutorial

  .bank 2                       ; Change to bank 2
  .org $0000                    ; start at $0000
  .incbin "mario.chr"

A lot of it is incomplete so you might see some segments missing.

Thanks in advanced :) :)


Top
 Profile  
 
PostPosted: Thu Mar 28, 2019 2:59 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11412
Location: Rio de Janeiro - Brazil
What do you mean "unrecognizable"? What's the exact error message you're getting?


Top
 Profile  
 
PostPosted: Thu Mar 28, 2019 3:17 pm 
Offline

Joined: Mon Mar 25, 2019 10:58 am
Posts: 13
tokumaru wrote:
What do you mean "unrecognizable"? What's the exact error message you're getting?

Sorry. Here's the nesasm log
Code:
pass 1
#[1]   main.asm
   10  00:E000                    gamestate       .rs 1
       Unknown instruction!
   11  00:E000                    ballx           .rs 1
       Unknown instruction!
   12  00:E000                    bally           .rs 1
       Unknown instruction!
   13  00:E000                    ballup          .rs 1
       Unknown instruction!
   14  00:E000                    balldown        .rs 1
       Unknown instruction!
   15  00:E000                    ballleft        .rs 1
       Unknown instruction!
   16  00:E000                    ballright       .rs 1
       Unknown instruction!
   17  00:E000                    ballspeedx      .rs 1
       Unknown instruction!
   18  00:E000                    ballspeedy  .rs 1
       Unknown instruction!
   19  00:E000                    paddletop1      .rs 1
       Unknown instruction!
   20  00:E000                    pattlebot1      .rs 1
       Unknown instruction!
   21  00:E000                    paddletop2      .rs 1
       Unknown instruction!
   22  00:E000                    pattlebot2      .rs 1
       Unknown instruction!
   23  00:E000                    buttons1        .rs 1
       Unknown instruction!
   24  00:E000                    buttons2        .rs 1
       Unknown instruction!
   25  00:E000                    score1          .rs 1
       Unknown instruction!
   26  00:E000                    score2          .rs 1
       Unknown instruction!
   29  00:E000                    STATETITLE     = $00  ; displaying title screen
       Unknown instruction!
   30  00:E000                    STATEPLAYING   = $01  ; move paddles/ball, check for collisions
       Unknown instruction!
   31  00:E000                    STATEGAMEOVER  = $02  ; displaying game over screen
       Unknown instruction!
   33  00:E000                    RIGHTWALL      = $F4  ; when ball reaches one of these, do something
       Unknown instruction!
   34  00:E000                    TOPWALL        = $20
       Unknown instruction!
   35  00:E000                    BOTTOMWALL     = $E0
       Unknown instruction!
   36  00:E000                    LEFTWALL       = $04
       Unknown instruction!
   38  00:E000                    PADDLE1X       = $08  ; horizontal position for paddles, doesnt move
       Unknown instruction!
   39  00:E000                    PADDLE2X       = $F0
       Unknown instruction!
   50  00:C002                    JSR vblankwait  jump to vblank wait #1
       Syntax error in expression!
   64  00:C021                    JSR vblankwait   jump to vblank wait again
       Syntax error in expression!
# 28 error(s


Top
 Profile  
 
PostPosted: Thu Mar 28, 2019 4:13 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11412
Location: Rio de Janeiro - Brazil
Try removing any tabs or spaces before the labels. I'm not sure, but it's possible that NESASM only accepts labels starting at the far left of the document.


Top
 Profile  
 
PostPosted: Thu Mar 28, 2019 4:21 pm 
Offline

Joined: Mon Mar 25, 2019 10:58 am
Posts: 13
tokumaru wrote:
Try removing any tabs or spaces before the labels. I'm not sure, but it's possible that NESASM only accepts labels starting at the far left of the document.

Yeah..... I tried to do that but that didn't work... FYI I fixed the JSR vblank problem so you dont need to worry bout that.


Top
 Profile  
 
PostPosted: Thu Mar 28, 2019 4:39 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3726
Location: Indianapolis
I tried assembling it over here, it is the spacing of the labels. Move those labels to the leftmost it and will accept them.

NESASM is always the best at giving unhelpful error messages..


Top
 Profile  
 
PostPosted: Thu Mar 28, 2019 4:46 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2564
Location: DIGDUG
10 00:E000

This is odd. The PC shouldn't be at $e000

Anyway, the labels need to be flush left, but the .reset need a to be tabbed in.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Thu Mar 28, 2019 8:18 pm 
Offline

Joined: Mon Mar 25, 2019 10:58 am
Posts: 13
Memblers wrote:
I tried assembling it over here, it is the spacing of the labels. Move those labels to the leftmost it and will accept them.

NESASM is always the best at giving unhelpful error messages..


That Worked! Thank you so Much!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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