~rabbits/dexe

1175fb33ab1f05bb8cb2772338fb9b233f14ce52 — neauoire 2 years ago 23b667a
Migrated manifest
3 files changed, 140 insertions(+), 134 deletions(-)

R src/{font.tal => assets.tal}
M src/dexe.tal
M src/manifest.tal
R src/font.tal => src/assets.tal +24 -0
@@ 1,3 1,24 @@
@make-icn
	00fe 8282 8282 8282
	8282 8282 848a f400
@load-icn
	00fe d6aa d6aa d6aa
	d6aa d6aa d4aa f400
@save-icn
	0010 1092 9254 5428
	d628 5454 9292 1000
@cursor-icn
	80c0 e0f0 f8e0 1000
@bit-icns
	3844 8282 8244 3800
	387c fefe fe7c 3800
@touch-table
	0000 0101 0202 0203
	0303 0404 0505 0606
	0607 0707 0000 0000
@dash-icn
	5500 0000 0000 0000

@font ( msx816 )
	0000 0000 0000 0000 0000 0000 0000 0000
	0000 0020 2020 2020 2020 0000 2020 0000


@@ 97,3 118,6 @@
	0000 1010 1010 0000 0000 1010 1010 0000
	0000 0060 1010 1010 0810 1010 1060 0000
	0000 0060 920c 0000 0000 0000 0000 0000

@data


M src/dexe.tal => src/dexe.tal +77 -85
@@ 7,42 7,31 @@
|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
|a0 @File &vector $2 &success $2 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2

%menu-def { #01 }
%menu-sel { #04 }
%menu-hov { #08 }
%menu-hit { #0014 }
%menu-auto { #15 }
%menu-label { DEOk DEO }
%menu-l { #40 }
%menu-r { #04 }

|0000

@length $2
@cursor
	&x $2 &y $2 &last $1
@state
	&timer $1 &changed $1
@filepath $40
@selection
	&from $2 &to $2 &scroll $2
	&mode $1 &nibble $1 &key $2
@frame
	&x $2 &y $2 &x2 $2 &y2 $2 &rows $2
@file-frame
	&x $2 &y $2 &x2 $2 &y2 $2
@byte-frame
	&x $2 &y $2 &x2 $2 &y2 $2 
@char-frame
	&x $2 &y $2 &x2 $2 &y2 $2
@tile-frame
	&x $2 &y $2 &x2 $2 &y2 $2
@options-frame
	&x $2 &y $2 &x2 $2 &y2 $2
@asm-frame
	&x $2 &y $2 &x2 $2 &y2 $2

( program )
	@length $2
	@cursor
		&x $2 &y $2 &last $1
	@state
		&timer $1 &changed $1
	@filepath $40
	@selection
		&from $2 &to $2 &scroll $2
		&mode $1 &nibble $1 &key $2
	@frame
		&x $2 &y $2 &x2 $2 &y2 $2 &rows $2
	@file-frame
		&x $2 &y $2 &x2 $2 &y2 $2
	@byte-frame
		&x $2 &y $2 &x2 $2 &y2 $2 
	@char-frame
		&x $2 &y $2 &x2 $2 &y2 $2
	@tile-frame
		&x $2 &y $2 &x2 $2 &y2 $2
	@options-frame
		&x $2 &y $2 &x2 $2 &y2 $2
	@asm-frame
		&x $2 &y $2 &x2 $2 &y2 $2

|0100



@@ 50,12 39,15 @@
	#0f77 .System/r DEO2
	#0fc7 .System/g DEO2
	#0f97 .System/b DEO2

	( vectors )
	;on-console .Console/vector DEO2
	;untrap JSR2

	( set size )
	#0150 .Screen/width DEO2
	#0188 .Screen/height DEO2

	( frame )
	#0010 DUP2 .frame/x STZ2
		#0130 ADD2 .frame/x2 STZ2


@@ 109,38 101,38 @@
BRK

@manifest

	&name "Dexe $1
	&date "2022-07-01 $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
		05 "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
			01 "q =exit "Exit $1
		03 "Edit $1
			01 "c :edit-copy "Copy $1
			01 "C :edit-copy-string "CopyText $1
			01 "v :edit-paste "Paste $1
			01 "c =edit-copy "Copy $1
			01 "C =edit-copy-string "CopyText $1
			01 "v =edit-paste "Paste $1
		09 "Move $1
			10 00 :move-up "Up $1
			20 00 :move-down "Down $1
			40 00 :move-left "Left $1
			80 00 :move-right "Right $1
			14 00 :move-dech "Decr.H $1
			24 00 :move-inch "Incr.H $1
			44 00 :move-decw "Decr.W $1
			84 00 :move-incw "Incr.W $1
			00 1b :move-reset "Reset $1
			10 00 =move-up "Up $1
			20 00 =move-down "Down $1
			40 00 =move-left "Left $1
			80 00 =move-right "Right $1
			14 00 =move-dech "Decr.H $1
			24 00 =move-inch "Incr.H $1
			44 00 =move-decw "Decr.W $1
			84 00 =move-incw "Incr.W $1
			00 1b =move-reset "Reset $1
		06 "Options $1
			00 0d :option-insert "Insert $1
			00 08 :option-erase "Erase $1
			00 ". :option-incr "ValIncr $1
			00 ", :option-decr "ValDecr $1
			04 "< :option-roll "RollLeft $1
			04 "> :option-rolr "RollRight $1
			00 0d =option-insert "Insert $1
			00 08 =option-erase "Erase $1
			00 ". =option-incr "ValIncr $1
			00 ", =option-decr "ValDecr $1
			04 "< =option-roll "RollLeft $1
			04 "> =option-rolr "RollRight $1
		$1

(
@|vectors )

@trap ( -- )



@@ 396,7 388,8 @@ BRK

BRK

( main )
(
@|main )

@do ( operation -- )



@@ 575,6 568,9 @@ JMP2r

JMP2r

(
@|drawing )

@redraw-all ( -- )

	;draw-spacer JSR2


@@ 855,6 851,22 @@ JMP2r

JMP2r

@draw-str-right ( text* -- )

	DUP2 ,get-strw JSR STH2
	.Screen/x DEI2k STH2r SUB2 ROT DEO2

@draw-str ( str* -- str* )

	LDAk #00 EQU ,&skip JCN
	&while
		LDAk ,draw-chr JSR
		INC2 LDAk ,&while JCN
	&skip
	INC2

JMP2r

@hex-char ( hex -- char )

	#0f AND DUP #09 GTH #27 MUL ADD #30 ADD


@@ 886,7 898,8 @@ JMP2r

JMP2r

( file )
(
@|file )

@file-new ( -- )



@@ 1019,6 1032,8 @@ JMP2r

JMP2r

@mcpy ( src* dst* len* -- ) SWP2 STH2 OVR2 ADD2 SWP2 &loop LDAk STH2kr STA INC2r INC2 GTH2k ,&loop JCN POP2 POP2 POP2r JMP2r

@untitled-txt "untitled.chr $1

@opcodes


@@ 1028,28 1043,5 @@ JMP2r
	"ADD $1 "SUB $1 "MUL $1 "DIV $1 "AND $1 "ORA $1 "EOR $1 "SFT $1
	&brk "BRK $1

@make-icn
	00fe 8282 8282 8282
	8282 8282 848a f400
@load-icn
	00fe d6aa d6aa d6aa
	d6aa d6aa d4aa f400
@save-icn
	0010 1092 9254 5428
	d628 5454 9292 1000
@cursor-icn
	80c0 e0f0 f8e0 1000
@bit-icns
	3844 8282 8244 3800
	387c fefe fe7c 3800
@touch-table
	0000 0101 0202 0203
	0303 0404 0505 0606
	0607 0707 0000 0000
@dash-icn
	5500 0000 0000 0000

~src/manifest.tal
~src/font.tal

@data

M src/manifest.tal => src/manifest.tal +39 -49
@@ 11,16 11,10 @@ BRK

@on-mouse-menu ( -> )

	#40 ;draw-cursor JSR2
	( record mouse positions )
	.Mouse/x DEI2 DUP2 .cursor/x STZ2 .Screen/x DEO2
	.Mouse/y DEI2 DUP2 .cursor/y STZ2 .Screen/y DEO2
	( draw new cursor )
	;hand-icn .Screen/addr DEO2
	#42 .Mouse/state DEI #00 NEQ ADD .Screen/sprite DEO
	#41 .Mouse/state DEI #00 NEQ ADD ;hand-icn ;update-cursor JSR2
	( when touch cat )
	.Mouse/state DEI #00 EQU ,&no-touch-cat JCN
	.Mouse/y DEI2 menu-hit GTH2 ,&no-touch-cat JCN
	.Mouse/y DEI2 #0014 GTH2 ,&no-touch-cat JCN
		.Mouse/x DEI2 ;get-xcat JSR2 ;menu-select JSR2
		( release ) #00 .Mouse/state DEO
		BRK


@@ 28,7 22,7 @@ BRK
	( when sub active )
	;draw-menu/sel LDA #ff EQU ,&no-sub JCN
		( when sel changed )
		.Mouse/y DEI2 #0004 SUB2 menu-r SFT2 NIP #01 SUB
		.Mouse/y DEI2 #0004 SUB2 #04 SFT2 NIP #01 SUB
		DUP ;draw-sub/sel LDA EQU ,&no-change JCN
			DUP ;draw-sub/sel STA
			;draw-menu/sel LDA #ff ;draw-sub JSR2


@@ 41,9 35,9 @@ BRK
			&no-touch-sub
		BRK
		&no-sub
	( don't leave if menu is active )
	( do not leave if menu is active )
	;draw-menu/sel LDA #ff NEQ ,&no-leave JCN
	.Mouse/y DEI2 menu-hit LTH2 ,&no-leave JCN
	.Mouse/y DEI2 #0014 LTH2 ,&no-leave JCN
		,menu-close JSR
		&no-leave



@@ 56,8 50,8 @@ BRK
	DUP #ff EQU ,&no-clear JCN
		DUP #00 ;draw-sub JSR2
		#ff ;draw-menu/sel STA
		;draw-menu JSR2
		;redraw-all JSR2
		;draw-menu JSR2
	&no-clear
	POP



@@ 81,15 75,15 @@ JMP2r
	#ff ;draw-sub/sel STA
	DUP ;draw-menu/sel STA
	#ff ;draw-sub JSR2
	;draw-menu JSR2
	;draw-menu ( .. )

JMP2r
JMP2

@menu-deselect ( cat cat -- )

	POP2 ;menu-close JSR2
	POP2 ;menu-close ( .. )

JMP2r
JMP2

@menu-select-sub ( sub -- )



@@ 109,7 103,7 @@ BRK

	STH
	#00 ,&id STR
	;manifest/menu
	;draw-menu/manifest LDA2
	&cat
		[ LIT &id 00 ] STHkr EQU ,&end JCN
		;skip-sub JSR2


@@ 149,7 143,7 @@ JMP2r
	LIT2r 0000
	,&target STR
	#00 ,&id STR
	;manifest/menu
	;draw-menu/manifest LDA2
	&cat
		[ LIT &id 00 ] [ LIT &target $1 ] EQU ,&end JCN
		INC2k ;get-strw JSR2 #0008 ADD2 STH2 ADD2r


@@ 163,13 157,13 @@ JMP2r

JMP2r

@get-xcat ( x* -- cat )
@get-xcat ( x* -- <cat> )

	#0010 SUB2
	LIT2r 0000
	,&target STR2
	#00 ,&id STR
	;manifest/menu
	;draw-menu/manifest LDA2
	&cat
		INC2k ;get-strw JSR2 #0008 ADD2 STH2r ADD2
		DUP2 [ LIT2 &target $2 ] LTH2 ,&continue JCN


@@ 190,7 184,7 @@ JMP2r
	ORAk ,&no-null JCN JMP2r &no-null
	( not null )
	,&mk STR2
	;manifest/menu
	;draw-menu/manifest LDA2
	&cat
		LDAk STH INC2 ,skip-str JSR
		STHr #00


@@ 229,10 223,10 @@ JMP2r
	#0010 .Screen/x DEO2
	#0004 .Screen/y DEO2
	#00 ,&id STR
	;manifest/menu
	[ LIT2 &manifest =manifest ]
	&cat
		menu-sel menu-def [ LIT &sel ff ] [ LIT &id $1 ] EQU [ JMP SWP POP ] ;draw-chr/color STA
		INC2k ;draw-str JSR2 POP2 #00 .Screen/sprite DEO
		#0401 [ LIT &sel ff ] [ LIT &id $1 ] EQU [ JMP SWP POP ] ;draw-chr/color STA
		INC2k ;draw-str JSR2 POP2 #20 ;draw-chr JSR2
		;skip-sub JSR2
		,&id LDR INC ,&id STR
		LDAk ,&cat JCN


@@ 249,9 243,9 @@ JMP2r
	LDAk STH INC2 ;skip-str JSR2
	STHr #00
	&subcat
		STHk menu-hov menu-sel STHr [ LIT &sel ff ] EQU [ JMP SWP POP ] [ LIT &mask $1 ] AND ;draw-chr/color STA
		STHk #0904 STHr [ LIT &sel ff ] EQU [ JMP SWP POP ] [ LIT &mask $1 ] AND ;draw-chr/color STA
		[ LIT2 &anchor $2 ] .Screen/x DEO2
		#00 OVR INC menu-l SFT2 #0004 ADD2 .Screen/y DEO2
		#00 OVR INC #40 SFT2 #0004 ADD2 .Screen/y DEO2
		SWP2 ;draw-label JSR2 SWP2
		INC GTHk ,&subcat JCN
	POP2 POP2


@@ 267,16 261,16 @@ JMP2r
		.Screen/auto DEI
			#f2 .Screen/auto DEO
			;blank-icn .Screen/addr DEO2
			;draw-chr/color LDA .Screen/sprite menu-label
			;draw-chr/color LDA .Screen/sprite DEOk DEO
		.Screen/auto DEO
	.Screen/y DEO2
	( mod )
	STH2k #0078 ADD2 .Screen/x DEO2
	LDA2k ;get-modkey-str JSR2 ;draw-str-right JSR2 POP2
	STH2r .Screen/x DEO2
	#0004 ADD2 ;draw-str JSR2
	#0004 ADD2 ;draw-str ( .. )

JMP2r
JMP2

@get-modkey-str ( mod key -- str* )



@@ 312,22 306,12 @@ JMP2r
	&cat ;&buf ;scat JSR2 ,&end JMP
	&bsp "bsp $1 &tab "tab $1 &ent "ent $1 &spc "spc $1 &esc "esc $1 &del "del $1

@draw-str-right ( text* -- )
@update-cursor ( color addr* -- )

	DUP2 ;get-strw JSR2 STH2
	.Screen/x DEI2k STH2r SUB2 ROT DEO2

@draw-str ( str* -- str* )

	LDAk #00 EQU ,&skip JCN
	menu-auto .Screen/auto DEO
	&while
		LDAk ;draw-chr JSR2
		INC2 LDAk ,&while JCN
	&skip
	INC2

JMP2r
	#40 ,draw-cursor JSR
	.Mouse/x DEI2 .cursor/x STZ2
	.Mouse/y DEI2 .cursor/y STZ2
	.Screen/addr DEO2

@draw-cursor ( color -- )



@@ 354,16 338,16 @@ JMP2r
JMP2r
	&path ".theme $1

( stdlib )
(
@|stdlib )

@scap ( str* -- end* ) LDAk #00 NEQ JMP JMP2r &w INC2 LDAk ,&w JCN JMP2r
@spop ( str* -- ) LDAk ,&n JCN POP2 JMP2r &n ,scap JSR #0001 SUB2 #00 ROT ROT STA JMP2r
@sput ( chr str* -- ) ,scap JSR STA JMP2r
@sput ( chr str* -- ) ,scap JSR INC2k #00 ROT ROT STA STA JMP2r
@slen ( str* -- len* ) DUP2 ,scap JSR SWP2 SUB2 JMP2r
@scat ( src* dst* -- ) DUP2 ,slen JSR ADD2
@scat ( src* dst* -- ) ,scap JSR
@scpy ( src* dst* -- ) STH2 &w LDAk STH2kr STA INC2r INC2 LDAk ,&w JCN POP2 #00 STH2r STA JMP2r
@mclr ( src* len* -- ) OVR2 ADD2 SWP2 &l STH2k #00 STH2r STA INC2 GTH2k ,&l JCN POP2 POP2 JMP2r
@mcpy ( src* dst* len* -- ) SWP2 STH2 OVR2 ADD2 SWP2 &loop LDAk STH2kr STA INC2r INC2 GTH2k ,&loop JCN POP2 POP2 POP2r JMP2r

@print ( short* -- )



@@ 373,9 357,15 @@ JMP2r

JMP2r

( assets )
@exit ( -- )

	#010f DEO

JMP2r

@hand-icn
	2020 20b8 7c7c 3838
@blank-icn
	0000 0000 0000 0000

~src/assets.tal