-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpinned.asm
93 lines (88 loc) · 2.03 KB
/
pinned.asm
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
loadPinnedConfig:
kld(ix, pinned_apps)
ld bc, 0x0A00
.loop:
push bc
push de
kld(de, pin_path)
kld(hl, number@pin_path)
ld a, c
add a, '0'
ld (hl), a
config(openConfigRead)
jr nz, .emptyPin
kld(hl, config_name_variable)
config(readOption)
jr nz, _
ld (ix + 2), l
ld (ix + 3), h
_: kld(hl, config_exec_variable)
config(readOption)
jr nz, _
ld (ix + 0), l
ld (ix + 1), h
_: kld(hl, config_icon_variable)
config(readOption)
push af
config(closeConfig)
pop af
jr nz, .emptyPin
; Load icon
ld b, h \ ld c, l
ex de, hl
pcall(openFileRead)
push ix
push af
push bc \ pop ix \ pcall(free) ; Free icon path
pop af
jr nz, .emptyPin_
pcall(getStreamInfo)
pcall(malloc)
pcall(streamReadToEnd)
pcall(closeStream)
push ix \ pop hl
pop ix
ld (ix + 4), l
ld (ix + 5), h
; TODO: Use kernel image handlers
; TODO: Check for monochrome images
; TODO: Check that image is 16x16
jr .emptyPin
.emptyPin_:
pop ix
.emptyPin:
ld bc, 6
add ix, bc
pop de
pop bc
inc c
djnz .loop_
ret
.loop_:
kjp(.loop)
pin_path:
.db "/var/castle/pin-"
.number:
.db " ", 0
config_icon_variable:
.db "icon", 0
config_exec_variable:
.db "exec", 0
config_name_variable:
.db "name", 0
pinned_apps:
; struct {
; char *exec;
; char *name;
; char *icon_mem;
; }[10]
.dw 0, 0, 0
.dw 0, 0, 0
.dw 0, 0, 0
.dw 0, 0, 0
.dw 0, 0, 0
.dw 0, 0, 0
.dw 0, 0, 0
.dw 0, 0, 0
.dw 0, 0, 0
.dw 0, 0, 0