-
Notifications
You must be signed in to change notification settings - Fork 0
/
misc.i
109 lines (89 loc) · 1.44 KB
/
misc.i
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
;; This is a collection of functions
;; from the famous tiny tetris by Marcus Comsted
getkeys:
bp p7,0,quit ; external 5VOLT ?
ld p3 ; p3(Keys) into ACC
bn acc,6,quit ; MODE-key
bn acc,7,sleep ; SLEEP-key
ret
quit:
jmp goodbye
sleep:
bn p3,7,sleep ; Wait for SLEEP to be depressed
mov #0,vccr ; Blank LCD
sleepmore:
set1 pcon,0 ; Enter HALT mode
bp p7,0,quit ; Docked?
bp p3,7,sleepmore ; No SLEEP press yet
mov #$80,vccr ; Reenable LCD
waitsleepup:
bn p3,7,waitsleepup
br getkeys
;; Function: clrscr
;;
;; Clears the screen
clrscr:
push acc
push xbnk
push 2
mov #0,xbnk
.cbank: mov #$80,2
.cloop: mov #0,@R2
inc 2
ld 2
and #$f
bne #$c,.cskip
ld 2
add #4
st 2
.cskip: ld 2
bnz .cloop
bp xbnk,0,.cexit
mov #1,xbnk
br .cbank
.cexit: pop 2
pop xbnk
pop acc
ret
;; Function: setscr
;;
;; Copies a predefined full-screen image to the screen
;;
;; Inputs:
;; trl = low byte of predefined screen ROM address
;; trh = high byte of predefined screen ROM address
setscr:
push acc
push xbnk
push c
push 2
ld trl
add #2
st trl
bn psw, cy, .no_ovf
inc trh
.no_ovf:
mov #$80,2
xor acc
st xbnk
st c
.sloop: ldc
st @R2
inc 2
ld 2
and #$f
bne #$c,.sskip
ld 2
add #4
st 2
bnz .sskip
inc xbnk
mov #$80,2
.sskip: inc c
ld c
bne #$c0,.sloop
pop 2
pop c
pop xbnk
pop acc
ret