-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.oph
More file actions
168 lines (154 loc) · 3.28 KB
/
lib.oph
File metadata and controls
168 lines (154 loc) · 3.28 KB
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
press'a:
ldx page
cpx #num_pages
bne +
; SHE SAID YES!!
inc lock'input
; Draw last screen
lda #<bgyes
sta current'nt'ptr
lda #>bgyes
sta current'nt'ptr+1
jsr disable'graphics
jsr send'prose'page
jsr enable'graphics
; Start music
lda #$00
ldx #$00
jsr $AA55 ; Call music init
; Set state
lda #STATE_ACCEPT
sta state
* rts
press'b:
ldx page
cpx #num_pages
bne ++
; SHE SAID NO!!
inc lock'input
; Make the NES meltdown
; Pipe CODE into PPU nametables!!
lda #<reset
sta current'nt'ptr
lda #>reset
sta current'nt'ptr+1
; Set state
lda #STATE_MELTDOWN
sta state
* rts
press'left:
ldx page
cpx #1
beq +
lda #DIRECTION_LEFT
sta direction
lda #4
sta fade'level
lda #STATE_FADEOUT
sta state
* rts
press'right:
ldx page
cpx #num_pages
beq +
lda #DIRECTION_RIGHT
sta direction
lda #4
sta fade'level
lda #STATE_FADEOUT
sta state
* rts
play'noise:
pha
lda #%00000101
sta $400E
lda #%00110011
sta $400C
pla
rts
disable'graphics:
lda #$00
sta $2000
sta $2001
rts
enable'graphics:
; Set basic PPU registers. Load background from $0000,
; sprites from $1000, and the name table from $2000.
lda #%10001000
sta $2000
lda #%00011110
sta $2001
rts
previous'page:
ldx page
cpx #1
beq +
lda current'nt'ptr+1
sbc #8
sta current'nt'ptr+1
jsr disable'graphics
jsr send'prose'page
jsr enable'graphics
dec page
* rts
next'page:
ldx page
cpx #num_pages
beq +
jsr disable'graphics
jsr send'prose'page
jsr enable'graphics
inc page
* rts
; Blast fade level
send'fade'level:
;Blast correct fade level
ldx fade'level
lda #$3F
ldy #$02
sta $2006
sty $2006
lda bg'fade'level,x
sta $2007
lda fg'fade'level,x
sta $2007
rts
; Blast the two pages of prose pointed to to VRAM
send'prose'page:
lda #$24
sta $2006
lda #$00
sta $2006
; Send bg
ldy #$00
ldx #$04
* lda (current'nt'ptr),y
sta $2007
iny
bne -
inc current'nt'ptr+1
dex
bne -
rts
scroll'up:
ldx scroll
beq +
dex
stx scroll
* rts
scroll'down:
ldx scroll
cpx #239
beq +
inx
stx scroll
* rts
send'scroll:
ldx #$00 ; Reset VRAM
stx $2006
stx $2006
lda #$00
ldx scroll
sta $2005 ; Write 0 for horizontal scroll value
stx $2005 ; Write scroll value for Vert. Scroll value
rts