-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscroller.asm
executable file
·133 lines (87 loc) · 2.49 KB
/
scroller.asm
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
/*
DONE AS PROOF OF ABILITY IN 2016 BY STEPHAN STRAUSS
Most scrollers are restriced to most 256 bytes, this one not ; it uses self-modifying code.
*/
//.break
.const shiftRegister = $D016
.const keyboardRegister = $DC01
.const raster = $D012
.const clearScreen = $E544
BasicUpstart2(start)
*=$0810
start:
// Disable interrupts and clear screen
sei
jsr clearScreen
// Setup indirect pointer
lda #<text // LowByte
sta $BB
lda #>text // HighByte
sta $BC
// Initialization of copy loop
ldy #39 // DEC [0,39] ; length=40 (char width)
copyLoop:
lda ($BB),y
sta erange, y
dey // decreased AFTER sta
bpl copyLoop // ... so should be stopped when negative
redoShift:
ldx #$C7
stx shiftRegister
checkkeys:
lda keyboardRegister
cmp #$FF
bne endit
ldx #$12
wait:
dex
bne wait
shiftPixels: // to be zero (outside of view)
lda raster
bne shiftPixels // jump back as long raster is not zero
ldx shiftRegister
dex
stx shiftRegister
cpx #$BF
bne wait
// Initialization of print loop
ldy #$00
printLoop:
lda load:text,y
cmp #$00 // brk 082e if .A==$00
beq initialize
sta store:[$0400+23*40],y
iny
cpy #40 // iny before, therefore against 40 and not 39
bne printLoop
// Initalization of the new starting address of the printloop
clc
lda load // Low byte in big-endian (reflection code)
adc #$01
sta load
lda load+1 // High byte in big-endian (reflection code)
adc #$00
sta load+1
ldy #$00
beq redoShift
rts // Never reached (infinite loop)
initialize:
// Reinitialization when end of text is reached (NULL-termination)
lda #<text
sta load
lda #>text
sta load+1
ldy #$00
beq printLoop // unconditional fast jump (trick!)
endit:
rts
.align $100
brange:
.text ">>>"
text:
.encoding "screencode_upper"
.import text "humanrights.txt"
erange:
.fill 40, 'X'
.byte $00
.text "<<<"