~rabbits/nasu

ref: 01ddfaf5fdee6f15a6ae7d69afc1ecb31a895638 nasu/src/manifest.tal -rw-r--r-- 2.5 KiB
01ddfaf5Devine Lu Linvega Fixed issue printing arrow mods 2 months ago
                                                                                
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
134
135
@manifest

	&size &w 0130 &h 00e0
	&theme &r 0a6f &g 05cf &b 0caf

	&name "Nasu $1 
	&date "2022-06-27 $1
	&menu
		04 "File $1
			01 'n :file-new "New $1
			01 'r :file-rename "Rename $1
			01 'o :file-open "Open $1
			01 's :file-save "Save $1
		03 "Edit $1
			01 'c :edit-copy "Copy $1
			01 'v :edit-paste "Paste $1
			01 'x :edit-cut "Cut $1
		0b "Select $1
			00 'q :select-brush "Brush $1
			00 'w :select-selector "Selector $1
			00 'e :select-zoom "Zoom $1
			10 00 :select-up "Up $1
			20 00 :select-down "Down $1
			40 00 :select-left "Left $1
			80 00 :select-right "Right $1
			14 00 :select-dech "Decr.Height $1
			24 00 :select-inch "Incr.Height $1
			44 00 :select-decw "Decr.Width $1
			84 00 :select-incw "Incr.Width $1
		04 "Pick $1
			00 '1 :pick-color1 "Color1 $1
			00 '2 :pick-color2 "Color2 $1
			00 '3 :pick-color3 "Color3 $1
			00 '4 :pick-color4 "Color4 $1
		03 "Options $1
			00 08 :option-erase "Erase $1
			00 20 :option-zoom "Zoom $1
			00 1b :option-deselect "Deselect $1
		$1

@print-manifest ( -- )

	;manifest/name ;print-str JSR2
	LIT '( #18 DEO ;print-str JSR2 LIT ') #18 DEO
	#0a18 DEOk DEO
	( menu )
	;manifest/menu
	&cat
		LDAk STH INC2 ;print-str JSR2 #0a18 DEO
		STHr #00
		&subcat
			SWP2
			( modkey ) #0918 DEO ;print-mod JSR2 ;print-key JSR2
			( spacer ) #2018 DEOk LIT ': #18 DEO DEO
			( name ) INC2 INC2 ;print-str JSR2 #0a18 DEO
			SWP2
			INC GTHk ,&subcat JCN
		POP2
		LDAk ,&cat JCN
	POP2

JMP2r

@print-mod ( addr* -- addr* )

	LDAk STH
	#0800
	&loop
		STHkr OVR SFT #01 AND #00 EQU ,&no-button JCN
			#00 OVR ;&buttons ADD2 LDA #18 DEO
			DUP #03 GTH ,&no-mod JCN
				LIT '+ #18 DEO
				&no-mod
			&no-button
		INC GTHk ,&loop JCN
	POP2
	POPr
	INC2

JMP2r
	&buttons
		"ABsSUDLR $1

@print-key ( addr* -- addr* )

	LDAk
	DUP #08 NEQ ,&no-del JCN ;&del ,&inv JMP &no-del
	DUP #09 NEQ ,&no-tab JCN ;&tab ,&inv JMP &no-tab
	DUP #20 NEQ ,&no-spc JCN ;&spc ,&inv JMP &no-spc
	DUP #1b NEQ ,&no-esc JCN ;&esc ,&inv JMP &no-esc
	#18 DEO
	INC2

JMP2r
	&inv ROT POP ;print-str JSR2 POP2 INC2 JMP2r
	&del "del $1
	&tab "tab $1
	&spc "spc $1
	&esc "esc $1

@print-str ( addr* -- addr* )

	&while
		LDAk #18 DEO
		INC2 LDAk ,&while JCN
	INC2

JMP2r

@find-modkey ( mod key -- fn* )

	,&mk STR2
	;manifest/menu
	&cat
		LDAk STH INC2 ,skip-str JSR
		STHr #00
		&subcat
			OVR2 LDA2 [ LIT2 &mk $2 ] NEQ2 ,&continue JCN
				POP2 INC2 INC2 LDA2 JMP2r
				&continue
			SWP2 #0004 ADD2 ,skip-str JSR SWP2
			INC GTHk ,&subcat JCN
		POP2
		LDAk ,&cat JCN
	POP2
	#0000

JMP2r

@skip-str ( str* -- str* )

	&skip INC2 LDAk ,&skip JCN INC2

JMP2r