-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdayview.asm
More file actions
133 lines (115 loc) · 2.22 KB
/
Copy pathdayview.asm
File metadata and controls
133 lines (115 loc) · 2.22 KB
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
;; dayView
;; Displays the day view.
dayView:
kcall(normalizeSelectedDate)
pcall(clearBuffer)
kld(hl, window_title)
ld a, 0b0100 ; draw the menu graphic
corelib(drawWindow)
; draw the day
ld e, 0x34
ld l, 0
ld c, 8
ld b, 8
pcall(rectXOR)
ld de, 0x3401
kld(a, (selected_day))
inc a ; days are zero-based
kcall(drawDecAPadded)
ld e, 0x34
ld l, 0
ld c, 8
ld b, 8
pcall(rectXOR)
; draw the month name
ld de, 0x4001
kld(hl, month_names)
kld(a, (selected_month))
add a, a ; 2x
add a, a ; 4x
ld b, 0
ld c, a
add hl, bc
pcall(drawStrXOR)
; draw the year
ld e, 0x4f
ld l, 0
ld c, 16
ld b, 8
pcall(rectXOR)
ld de, 0x4f01
kld(hl, (selected_year))
kcall(drawYear)
ld e, 0x4f
ld l, 0
ld c, 16
ld b, 8
pcall(rectXOR)
.drawAppointments:
kld(hl, no_appointments)
ld de, 0x0208
pcall(drawStr)
.waitForKey:
; update the screen
pcall(fastCopy)
; wait for a key
corelib(appWaitKey)
pcall(flushKeys)
; arrow keys (move selected day)
cp kRight
jr nz, +_
kld(a, (selected_day))
inc a
kld((selected_day), a)
kjp(dayView)
_: cp kLeft
jr nz, +_
kld(a, (selected_day))
dec a
kld((selected_day), a)
kjp(dayView)
_:
; F3 (show menu)
cp kF3
jr nz, .no_f3
kld(hl, menu_dayview)
ld c, 70
corelib(showMenu)
pcall(flushKeys)
; option 0: new appointment
cp 0
jr nz, +_
kld(hl, appointments_not_supported_message)
kld(de, appointments_not_supported_options)
ld a, 0
ld b, 0
corelib(showMessage)
kjp(dayView)
_:
; option 1: back to month view
cp 1
jr nz, +_
kjp(monthView)
_:
; option 2: quit
cp 2
jr nz, +_
ret
_:
; no option chosen
kjp(dayView)
.no_f3:
; MODE (quit)
cp kMode
jr nz, +_
ret
_:
kjp(.waitForKey)
; strings
no_appointments:
.db "No appointments.", 0
appointments_not_supported_message:
.db "Creating ap-\npointments is\nnot supported.", 0
appointments_not_supported_options:
.db 1
.db "Dismiss", 0