File: nesasm

package info (click to toggle)
ruby-rouge 4.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,836 kB
  • sloc: ruby: 38,168; sed: 2,071; perl: 152; makefile: 8
file content (69 lines) | stat: -rw-r--r-- 1,235 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  .inesprg 2   ; 2x 16KB PRG code banks
  .ineschr 1   ; 1x  8KB CHR data banks 
  .inesmap 0   ; mapper (0 = NROM), no bank swapping
  .inesmir 0   ; 0 = horizontal background mirroring (for vertical scrolling)

  ;;;;;; VARIABLES
  .rsset $0000 ; zero page

gamestate  .rs 1
playerx    .rs 2

  .bank 1
  .org $C000 

Reset:
  jsr WaitSync	; wait for VSYNC
  jsr ClearRAM	; clear RAM
  jsr WaitSync	; wait for VSYNC (and PPU warmup)

SCR_ADDR .func (\1) + ((\2) << 5)

abs    .macro
  lda   \1
  bpl   .x\@
  eor   #$FF
  inc   A
  sta   \1

  lda \#
  sta numberOfParams

  lda \?4
  sta typeOfParam

  .x\@:
    .endm

NMI:
  LoadSprites:
  ldx #$00
LoadSpritesLoop:
  lda Sprites, x
  sta OAM_RAM, x
  inx 
  cpx #$10
  bne LoadSpritesLoop

  lda #HIGH(background)
  sta backHi
  lda #LOW(background)
  sta backLo

Sprites:
  ;vert tile attr horiz
  .db $80, $01, %00000000, $80   ;sprite 0
  .db $80, $02, %00110011, $88   ;sprite 1
  .db $88, $03, %00110011, $80   ;sprite 2
  .db $88, $05, %00000000, $88   ;sprite 3

  .include "somefile.asm"
  .incbin "somefile.chr"
  background:
    .incbin "background.chr"

;; CPU interrupts
  .org $FFFA     
  .dw NMI        ; vblank NMI
  .dw RESET      ; Reset
  .dw 0          ; IRQ