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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
|
processor 6502
option output-file,"nes.nes"
option output-format,nes
option nes-vector,reset,start
option nes-vector,nmi,nmi
option nes-vector,brk,nmi
vsync: macro
.wait
lda $2002
bpl wait
endm
start: org $c000
sei
cld
ldx #$ff
txs
; this sets up the PPU. Apparently.
lda #%00001000
sta $2000
lda #%00011110
sta $2001
; Set PPU to palette
;
loadpalette:
lda #$3f
sta $2006
lda #$00
sta $2006
; Load the palette
;
ldx #0
.loop lda palette,x
sta $2007
inx
cpx #$20
bne loop
; Wait for a vysnc before loading the name table
;
vsync
; Load the name map
;
load_namemap:
lda #$20
sta $2006
lda #$20
sta $2006
ldx #0
.loop lda map,x
cmp #$ff
beq done
sta $2007
inx
jmp loop
.done
forever:
jmp forever
nmi:
rti
palette:
db 15, 0, 16, 48, 15, 1, 33, 49, 15, 6, 22, 38, 15, 9, 25, 41
db 15, 0, 16, 48, 15, 1, 33, 49, 15, 6, 22, 38, 15, 9, 25, 41
map:
db 'H'-'@'
db 'E'-'@'
db 'L'-'@'
db 'L'-'@'
db 'O'-'@'
db 0
db 'W'-'@'
db 'O'-'@'
db 'R'-'@'
db 'L'-'@'
db 'D'-'@'
db 255
;
; VROM
;
org 0
bank 1
incbin "tiles.chr"
|