-
Notifications
You must be signed in to change notification settings - Fork 0
/
io.inc
62 lines (48 loc) · 740 Bytes
/
io.inc
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
.scope io
CONIN := $e004
CONOUT := $e001
control = $30
returnl := control
returnh := returnl + 1
return := control
saveda := returnh + 1
savedx := saveda + 1
savedy := savedx + 1
.proc outchr
sta CONOUT
rts
.endproc ; outchr
; outstr
; example:
; jsr library::io::outstr
; asciiz "Hello world,"
.proc outstr
sta saveda
pla
sta returnl ; address low
pla
sta returnh ; address high
sty savedy
; Print each character in turn (first character is offset by one)
ldy #0
loop: iny
lda (return),y
beq finished
jsr outchr
bne loop
finished:
; Sort out the return address so
clc
tya
adc returnl
sta returnl
lda #0
adc returnh
pha
lda returnl
pha
ldy savedy
lda saveda
rts
.endproc ; outstr
.endscope ; io