-
Notifications
You must be signed in to change notification settings - Fork 0
/
template.z80
78 lines (66 loc) · 1.32 KB
/
template.z80
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
; Gets page pageNum ($bootPage) on progName
; By Andree Chea
.nolist
; Hack to see if we're building for CSE
#define IS_CSE bootPage > 80h
#if IS_CSE
#include "ti84pcse.inc"
_ClrScrnFull .equ _maybe_ClrScrnFull
#else
#include "ti83plus.inc"
#endif
.list
.org userMem-2
#if IS_CSE
.db tExtTok, tAsm84CCmp
#else
.db t2ByteTok, tasmCmp
#endif
ld hl,saveVariable
rst 20h ;rMOV9TOOP1
bcall(_ChkFindSym)
ld hl,ErrDefined
jr nc,DisplayError
;ret nc ;already exists
ld hl,saveVariable
rst 20h ;rMOV9TOOP1
ld hl,$4000 ;1 page
bcall(_EnoughMem)
ld hl,ErrMemory
jr c,DisplayError
;ret c ;Not enough memory
ex de,hl ;hl = $4000
bcall(_CreateAppVar)
inc de
inc de ;de -> data
ld a,bootPage
ld hl,$4000
ld bc,$4000
bcall(_FlashToRam)
ld hl,txtSuccess
;ret
DisplayError:
push hl
bcall(_ClrScrnFull)
ld hl,$0000
ld (curRow),hl
pop hl
bcall(_PutS)
bcall(_NewLine)
ret
txtSuccess:
;0123456789ABCDEF
.db "AppVar D",progName,pageNum," "
.db "created.",$00
ErrMemory:
;0123456789ABCDEF
.db "You do not have "
.db "16KBs of RAM "
.db "free.",$00
ErrDefined:
;0123456789ABCDEF
.db "AppVar D",progName,pageNum," "
.db "already exists.",$00
saveVariable:
.db AppVarObj,"D",progName,pageNum,$00
.end