-
Notifications
You must be signed in to change notification settings - Fork 0
/
taki-os-prodos.s
86 lines (76 loc) · 1.5 KB
/
taki-os-prodos.s
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
; taki-os-prodos: implements OS-specific features
; for ProDOS.
.macpack apple2
.include "a2-monitor.inc"
.include "taki-util.inc"
.include "taki-public.inc"
I_AM_TAKI_OS_FOO = 1
.include "taki-internal.inc"
; ProDOS Addresses
GETBUFR = $BEF5
FREEBUFR= $BEF8
VECTOUT = $BE30
VECTIN = $BE32
.export _TakiInit
_TakiInit:
jsr _TakiBareInit
; Protect Taki from BASIC data
jsr FREEBUFR ; Release any previous allocations
lda #$9A ; bottom of BASIC.SYSTEM, should be our top
sec
sbc TakiVarEffectsAllocStartPage
jsr GETBUFR
bcs @oom
cmp TakiVarEffectsAllocStartPage
bne @bad
; Set up CSW and KSW
writeWord VECTOUT, TakiOut
writeWord VECTIN, TakiIn
; Indicate success
lda #0
sta TakiVarInitStatus
rts
@oom:
lda #<FailMsg
ldy #>FailMsg
jsr PrintStr
lda #<OomMsg
ldy #>OomMsg
jsr PrintStr
lda #3
sta TakiVarInitStatus
rts
@bad:
lda #<FailMsg
ldy #>FailMsg
jsr PrintStr
lda #<BadMsg
ldy #>BadMsg
jsr PrintStr
lda #2
sta TakiVarInitStatus
rts
FailMsg:
scrcode "!!!PRODOS ALLOC FAILED!!!", $0D
.byte 0
OomMsg:
scrcode "COULD NOT ALLOCATE BUFFERS", $0D
.byte 0
BadMsg:
scrcode "SOMETHING ELSE WAS ALLOCATED", $0D
scrcode "IN AN AREA NEEDED BY TAKI.", $0D
.byte 0
PrintStr:
sta @str
sty @str+1
@lp:
@str = * + 1
lda $1234 ; addr overwritten at start
beq @out
jsr Mon_COUT
inc @str
bne @lp
inc @str+1
bne @lp
@out:
rts