-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscroll.asm
More file actions
211 lines (183 loc) · 3.47 KB
/
scroll.asm
File metadata and controls
211 lines (183 loc) · 3.47 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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
;
; VI65 (c) 2010-2013 Soci/Singular (soci@c64.rulez.org)
;
; This program is free software; you can redistribute it and/or modify
; it under the terms of the GNU General Public License as published by
; the Free Software Foundation; either version 2 of the License, or
; (at your option) any later version.
;
; This program is distributed in the hope that it will be useful,
; but WITHOUT ANY WARRANTY; without even the implied warranty of
; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
; GNU General Public License for more details.
;
; You should have received a copy of the GNU General Public License
; along with this program; if not, write to the Free Software
; Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
;
.if !SIMPLE
kz .proc
jsr waitkeyrepeat
ldx #keylookup.zkeys
jmp keylookup
.pend
;n; <h4>zL</h4>
;n; Move the view on the text half a screenwidth to the
;n; right, thus scroll the text half a screenwidth to the
;n; left.
scroll_zL .proc
ldx #width/2
jsr mulrepeatl
.cerror scroll_zl & 0
.pend
;n; <h4>z<Right> or zl</h4>
;n; Move the view on the text [count] characters to the
;n; right, thus scroll the text [count] characters to the
;n; left.
scroll_zl .proc
ldy #4
lda repeat+1
bne q
lda column2
clc
adc repeat
bge q
in cmp (cursorline),y
blt scroll_zh.fix
q lda (cursorline),y
beq scroll_zh.fix
sec
sbc #1
gcs scroll_zh.fix
.pend
;n; <h4>zH</h4>
;n; Move the view on the text half a screenwidth to the
;n; left, thus scroll the text half a screenwidth to the
;n; right.
scroll_zH .proc
ldx #width/2
jsr mulrepeatl
.cerror scroll_zh & 0
.pend
;n; <h4>z<Left> or zh</h4>
;n; Move the view on the text [count] characters to the
;n; left, thus scroll the text [count] characters to the
;n; right.
scroll_zh .proc
lda repeat+1
bne q
lda column2
sec
sbc repeat
bge fix
q lda #0
fix sta column2
ldx column
cmp column
blt +
clc
tax
+ adc #width-1
bge +
cmp column
bge +
tax
+ stx column
rts
.pend
;n; <h4>ze</h4>
;n; Scroll the text horizontally to position the cursor
;n; at the end (right side) of the screen.
scroll_ze .proc
lda column
sec
sbc #width-1
bge +
lda #0
+ .byte $2c
.cerror scroll_zs & 0
.pend
;n; <h4>zs</h4>
;n; Scroll the text horizontally to position the cursor
;n; at the start (left side) of the screen.
scroll_zs .proc
lda column
jmp scroll_zh.fix
.pend
.fi
scroll_ctrl_f .proc
ldx #height-3
.if SIMPLE
stx repeat
.else
jsr mulrepeatl
.fi
.cerror scroll_ctrl_e & 0
.pend
;n; <h4>CTRL-E</h4>
;n; Scroll window [count] lines downwards in the buffer.
scroll_ctrl_e .proc
lda line2
clc
adc repeat
tax
lda line2+1
adc repeat+1
bcc u
lda #255
j tax
u tay
cpx lines
sbc lines+1
tya
blt +
ldx lines
lda lines+1
+ stx line2
sta line2+1
cpx line
sbc line+1
blt +
lda line2+1
tl jsr toline
jmp motion_uparrow
+ cmp #255
bne ki
lda line
sbc line2
cmp #height-1
blt +
ki txa
adc #height-3
tax
lda line2+1
adc #0
bcc tl
lda #255
tax
gcs tl
+ rts
.pend
scroll_ctrl_b .proc
ldx #height-3
.if SIMPLE
stx repeat
.else
jsr mulrepeatl
.fi
.cerror scroll_ctrl_y & 0
.pend
;n; <h4>CTRL-Y</h4>
;n; Scroll window [count] lines upwards in the buffer.
scroll_ctrl_y .proc
lda line2
sec
sbc repeat
tax
lda line2+1
sbc repeat+1
bge scroll_ctrl_e.u
lda #0
tax
geq scroll_ctrl_e.tl
.pend