~rabbits/uxn

f5fb9714e454a91b7f22257e32412f467a516b86 — neauoire 2 months ago 8492153
*
M README.md => README.md +2 -2
@@ 41,9 41,9 @@ BRK
@print ( addr* -- )
	
	&loop
		( send ) DUP2 GET .Console/char DEO
		( send ) DUP2 LDA .Console/char DEO
		( incr ) #0001 ADD2
		( loop ) DUP2 GET #00 NEQ ,&loop JNZ
		( loop ) DUP2 LDA #00 NEQ ,&loop JNZ
	POP2

RTN

M build.sh => build.sh +1 -1
@@ 34,7 34,7 @@ else
fi

echo "Assembling.."
./bin/assembler projects/software/noodle.usm bin/boot.rom
./bin/assembler projects/demos/drum-rack.usm bin/boot.rom

echo "Running.."
if [ "${2}" = '--cli' ]; 

M etc/usm.sublime-syntax => etc/usm.sublime-syntax +4 -4
@@ 24,10 24,10 @@ contexts:
    - match: '\.(\S+)\sPOK'
      scope:  constant.numeric
      pop: true
    - match: '\.(\S+)\sGET2'
    - match: '\.(\S+)\sLDA2'
      scope:  constant.numeric
      pop: true
    - match: '\.(\S+)\sGET'
    - match: '\.(\S+)\sLDA'
      scope:  constant.numeric
      pop: true



@@ 43,10 43,10 @@ contexts:
    - match: '\.(\S+)\sPEK'
      scope:  entity.name.type.typedef
      pop: true
    - match: '\.(\S+)\sPUT2'
    - match: '\.(\S+)\sSTA2'
      scope:  entity.name.type.typedef
      pop: true
    - match: '\.(\S+)\sPUT'
    - match: '\.(\S+)\sSTA'
      scope:  entity.name.type.typedef
      pop: true


M etc/uxambly-translate.moon => etc/uxambly-translate.moon +4 -4
@@ 7,12 7,12 @@ import P, R, S, C, Ct, Cp, V from require 'lpeg'
local labels, filename

opcode_translate =
    PEK2: 'GET'
    POK2: 'PUT'
    PEK2: 'LDA'
    POK2: 'STA'
    LDR: 'PEK2'
    STR: 'POK2'
    LDR2: 'GET2'
    STR2: 'PUT2'
    LDR2: 'LDA2'
    STR2: 'STA2'

grammar = P {
    'file'

M projects/demos/bifurcan.usm => projects/demos/bifurcan.usm +1 -1
@@ 110,7 110,7 @@ RTN
	&loop
		( save-x ) OVR #03 MOD TOS #0008 MUL2 .anchor/x PEK2 ADD2 .Screen/x DEO2
		( save-y ) OVR #03 DIV TOS #0008 MUL2 .anchor/y PEK2 ADD2 .Screen/y DEO2
		( get digit* ) OVR DUPr STHr #02 MUL TOS ;digits ADD2 GET2 
		( get digit* ) OVR DUPr STHr #02 MUL TOS ;digits ADD2 LDA2 
		( get bit ) ROT #0e SWP SUB TOS SFT2 #0001 AND2 
		( set tile ) #0008 MUL2 ;tiles ADD2 
		( set style ) .style PEK #10 MUL TOS ADD2

M projects/demos/drum-rack.usm => projects/demos/drum-rack.usm +151 -74
@@ 35,7 35,6 @@

|0000

@selection $1
@last $1
@color $1
@center      [ &x $2 &y $2 ]


@@ 47,6 46,7 @@
@pos         [ &x $2 &y $2 ] 
@padview     [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@mixview     [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]
@wavview     [ &x1 $2 &y1 $2 &x2 $2 &y2 $2 ]

@state [ ( addr length )
	$4 $4 $4 $4


@@ 60,9 60,9 @@
|0100 ( -> )
	
	( theme ) 
	#0fe5 .System/r DEO2 
	#0fc5 .System/g DEO2 
	#0f25 .System/b DEO2
	#0aff .System/r DEO2 
	#0af2 .System/g DEO2 
	#0af3 .System/b DEO2

	( vectors )
	;on-control .Controller/vector DEO2


@@ 82,11 82,11 @@
	.Screen/width DEI2 2/ .center/x POK2
	.Screen/height DEI2 2/ .center/y POK2

	( place views )
	( place frame )
	.center/x PEK2 PAD-WIDTH #0003 MUL2 SUB2 #0010 SUB2 .frame/x1 POK2
	.center/y PEK2 PAD-HEIGHT 2* SUB2 .frame/y1 POK2
	.center/y PEK2 #0050 SUB2 .frame/y1 POK2
	.center/x PEK2 PAD-WIDTH #0003 MUL2 ADD2 #0010 ADD2 .frame/x2 POK2
	.center/y PEK2 PAD-HEIGHT 2* ADD2 .frame/y2 POK2
	.frame/y1 PEK2 PAD-HEIGHT #0004 MUL2 ADD2 #0030 ADD2 .frame/y2 POK2

	( place padview )
	.frame/x1 PEK2 .padview/x1 POK2


@@ 100,6 100,12 @@
	.mixview/x1 PEK2 #0080 ADD2 .mixview/x2 POK2
	.padview/y2 PEK2 .mixview/y2 POK2

	( place wavview )
	.frame/x1 PEK2 .wavview/x1 POK2
	.mixview/y2 PEK2 #0008 ADD2 .wavview/y1 POK2
	.frame/x2 PEK2 .wavview/x2 POK2
	.wavview/y1 PEK2 #0020 ADD2 .wavview/y2 POK2

	;draw-pads JSR2
	;draw-mixers JSR2



@@ 107,21 113,14 @@
	.frame/y1 PEK2 #0004 SUB2 
	.frame/x2 PEK2 #0002 ADD2
	.frame/y2 PEK2 #0002 ADD2
	#03
	;line-rect JSR2

	.padview/x1 PEK2 #0002 SUB2
	.padview/y1 PEK2 #0002 SUB2
	.padview/x2 PEK2
	.padview/y2 PEK2
	#02
	#01
	;line-rect JSR2

	.mixview/x1 PEK2 #0002 ADD2
	.mixview/y1 PEK2 #0002 SUB2
	.mixview/x2 PEK2
	.mixview/y2 PEK2
	#02
	.mixview/x1 PEK2 #0002 ADD2 
	.mixview/y1 PEK2 #0000 SUB2 
	.mixview/x2 PEK2 #0002 SUB2
	.mixview/y2 PEK2 #0002 SUB2
	#01
	;line-rect JSR2

BRK


@@ 172,7 171,7 @@ BRK
		BRK
	&no-drum

	;pad-addr #0008 ADD2 GET2 .Audio0/addr DEO2
	;pad-addr #0008 ADD2 LDA2 .Audio0/addr DEO2
	#0008 .Audio0/length DEO2
	.Midi/note DEI .Audio0/pitch DEO



@@ 205,14 204,15 @@ BRK

@on-touch-pad ( -> )
	

	( x ) .Mouse/x DEI2 .padview/x1 PEK2 SUB2 PAD-WIDTH DIV2 SWP POP
	( y ) .Mouse/y DEI2 .padview/y1 PEK2 SUB2 PAD-HEIGHT DIV2 SWP POP #04 MUL ADD
	DUP #b0 SWP
	;play-pad JSR2
	
	DUP #b0 SWP ;play-pad JSR2

	( select ) DUP .selection POK ;draw-editor JSR2
	DUP ;draw-editor JSR2
	DUP ;draw-waveform JSR2

	POP
	( release ) #00 .Mouse/state DEO

BRK


@@ 222,8 222,8 @@ BRK
	#00 #10
	&loop
		( name ) OVR TOS #0019 MUL2 ;pad-path ADD2 .File/name DEO2
		( length ) OVR TOS #0002 MUL2 ;pad-length ADD2 GET2 .File/length DEO2
		( load ) OVR TOS #0002 MUL2 ;pad-addr ADD2 GET2 .File/load DEO2
		( length ) OVR TOS #0002 MUL2 ;pad-length ADD2 LDA2 .File/length DEO2
		( load ) OVR TOS #0002 MUL2 ;pad-addr ADD2 LDA2 .File/load DEO2
		( incr ) SWP #01 ADD SWP
		DUP2 LTH ,&loop JNZ
	POP2


@@ 241,11 241,11 @@ RTN
	DUPr STHr #02 ;draw-pad JSR2

	( length )
	DUPr STHr TOS #0002 MUL2 ;pad-addr ADD2 DUP2 GET2 SWP2 #0002 ADD2 GET2 SWP2 SUB2 
	DUPr STHr TOS #0002 MUL2 ;pad-addr ADD2 DUP2 LDA2 SWP2 #0002 ADD2 LDA2 SWP2 SUB2 
	DUPr STHr #04 DIV #10 MUL .Audio0/length ADD DEO2	

	( addr )
	DUPr STHr TOS #0002 MUL2 ;pad-addr ADD2 GET2
	DUPr STHr TOS #0002 MUL2 ;pad-addr ADD2 LDA2
	DUPr STHr #04 DIV #10 MUL .Audio0/addr ADD DEO2

	( pitch )


@@ 257,6 257,39 @@ RTN

RTN

@draw-waveform ( pad -- )
	
	#02 MUL #00 SWP ;pad-addr ADD2 LDA2 STH2

	.wavview/x1 PEK2
	.wavview/y1 PEK2
	.wavview/x2 PEK2 ++
	.wavview/y2 PEK2
	#00 ;fill-rect JSR2

	.wavview/x1 PEK2 .Screen/x DEO2

	( waveform )
	#00 #ff
	&loop
		( dotted line )
		OVR #01 AND ,&no-dot JNZ 
			.wavview/y1 PEK2 #0010 ADD2 .Screen/y DEO2
			#03 .Screen/color DEO
		&no-dot
		OVR TOS #0010 MUL2 [ DUP2r STH2r ] ADD2 LDA 
		#02 DIV #40 ADD DUP #07 SFT #80 MUL SUB 
		TOS #0004 DIV2 .wavview/y1 PEK2 ADD2 .Screen/y DEO2
		.Screen/x DEI2 ++ .Screen/x DEO2
		( draw ) OVR .Audio0/length DEI2 SWP POP GTH #02 MUL #01 ADD .Screen/color DEO
		( incr ) SWP #01 ADD SWP
		DUP2 LTH ,&loop JNZ
	POP2

	POP2r

RTN

@draw-editor ( pad -- )

	( get state )


@@ 264,11 297,11 @@ RTN
	.frame/y2 PEK2 #0008 ADD2 .Screen/y DEO2

	.frame/x1 PEK2 .Screen/x DEO2
	DUP #02 MUL TOS ;pad-addr ADD2 GET2
	DUP #02 MUL TOS ;pad-addr ADD2 LDA2
	( addr ) #21 ;draw-short JSR2

	.frame/x1 PEK2 #0028 ADD2 .Screen/x DEO2
	DUP #02 MUL TOS ;pad-length ADD2 GET2
	DUP #02 MUL TOS ;pad-length ADD2 LDA2
	( addr ) #21 ;draw-short JSR2

	POP


@@ 279,7 312,7 @@ RTN

	;cursor .Screen/addr DEO2

	DUP #00 SWP PAD-HEIGHT MUL2 .mixview/y1 PEK2 ADD2 STH2
	DUP #00 SWP PAD-HEIGHT MUL2 .mixview/y1 PEK2 ADD2 #0002 ADD2 STH2

	( adsr )
	.mixview/x1 PEK2 #0008 ADD2 DUP2r STH2r


@@ 295,6 328,9 @@ RTN
		.Audio0/adsr #01 ADD DEI #0f AND
		;draw-knob JSR2

	.mixview/x1 PEK2 #0048 ADD2 DUP2r STH2r
		#00 ;draw-switch JSR2

	( volume )
	.mixview/x1 PEK2 #0058 ADD2 DUP2r STH2r
		.Audio0/volume DEI #04 SFT


@@ 303,9 339,9 @@ RTN
		.Audio0/volume DEI #0f AND
		;draw-knob JSR2


	POP
	POP2r

	( once/repeat interface )

RTN


@@ 319,8 355,8 @@ RTN
	.knob/x PEK2 8+ .Screen/x DEO2 ;knob_icns 8+ .Screen/addr DEO2 #21 .Screen/color DEO
	.knob/y PEK2 8+ .Screen/y DEO2 ;knob_icns #0018 ADD2 .Screen/addr DEO2 #21 .Screen/color DEO
	.knob/x PEK2 .Screen/x DEO2 ;knob_icns #0010 ADD2 .Screen/addr DEO2 #21 .Screen/color DEO
	.knob/x PEK2 #00 #00 .knob/value PEK ;knob-offsetx ADD2 GET ADD2 .Screen/x DEO2
	.knob/y PEK2 #00 #00 .knob/value PEK ;knob-offsety ADD2 GET ADD2 .Screen/y DEO2
	.knob/x PEK2 #00 #00 .knob/value PEK ;knob-offsetx ADD2 LDA ADD2 .Screen/x DEO2
	.knob/y PEK2 #00 #00 .knob/value PEK ;knob-offsety ADD2 LDA ADD2 .Screen/y DEO2
	;knob_icns #0020 ADD2 .Screen/addr DEO2
	#25 .Screen/color DEO
	.knob/x PEK2 #0004 ADD2 .Screen/x DEO2


@@ 330,6 366,29 @@ RTN

RTN

@draw-switch ( x* y* value -- )
	
	POP ( TODO: use value for toggle position )
	.Screen/y DEO2
	.Screen/x DEO2
	;switch .Screen/addr DEO2
	#21 .Screen/color DEO

	.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
	;switch #0008 ADD2 .Screen/addr DEO2
	#21 .Screen/color DEO

	.Screen/y DEI2 #0008 ADD2 .Screen/y DEO2
	.Screen/x DEI2 #0008 SUB2 .Screen/x DEO2
	;switch #0010 ADD2 .Screen/addr DEO2
	#21 .Screen/color DEO

	.Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
	;switch #0018 ADD2 .Screen/addr DEO2
	#21 .Screen/color DEO

RTN

@draw-pads ( -- )
	
	#00 #10


@@ 395,7 454,7 @@ RTN
	.pointer/x PEK2 .Screen/x DEO2 
	.pointer/y PEK2 .Screen/y DEO2 
	( colorize on state )
	#31 [ .Mouse/state DEI #00 NEQ ] ADD .Screen/color DEO
	#33 [ .Mouse/state DEI #00 NEQ ] SUB .Screen/color DEO

RTN



@@ 443,14 502,33 @@ RTN
	( load ) .label/addr POK2 .label/color POK .Screen/y DEO2 .Screen/x DEO2
	.label/addr PEK2
	&loop
		( draw ) DUP2 GET #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( draw ) DUP2 LDA #00 SWP #0030 SUB2 #0008 MUL2 ;font-num-uc ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( incr ) #0001 ADD2
		( incr ) .Screen/x DEI2 #0007 ADD2 .Screen/x DEO2
		DUP2 GET #00 NEQ ,&loop JNZ
		( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
		DUP2 LDA #00 NEQ ,&loop JNZ
	POP2

RTN

@fill-rect ( x1* y1* x2* y2* color -- )
	
	.color POK
	( x1 x2 y1 y2 ) ROT2 SWP2
	&ver
		( save ) OVR2 .Screen/y DEO2
		STH2 STH2 OVR2 OVR2
		&hor
			( save ) OVR2 .Screen/x DEO2
			( draw ) .color PEK .Screen/color DEO
			( incr ) SWP2 ++ SWP2
			OVR2 OVR2 LTS2 ,&hor JNZ
		POP2 POP2 STH2r STH2r
		( incr ) SWP2 ++ SWP2
		OVR2 OVR2 LTS2 ,&ver JNZ
	POP2 POP2 POP2 POP2

RTN

@pad-name [
	"PAD1 $1 "SYN1 $1 "SYN2 $1 "CYM1 $1 ( short )
	"HHAT $1 "OHAT $1 "CHAT $1 "RIDE $1


@@ 518,6 596,17 @@ RTN
	707e 7e7e 7e7e 7e7e
	7e7e 7e7e 7e7e 7e7e ]

@switch [
	001f 204f 5f5f 4f40
	00f8 04f2 fafa f202
	4040 4040 4020 1f00
	0202 0202 0204 f800
	0000 0000 0000 0000
	0000 0000 0000 0000
	0000 0000 0000 0000
	0000 0000 0000 0000
]

@font-hex ( 0-F )
[
	007c 8282 8282 827c 0030 1010 1010 1010


@@ 530,38 619,26 @@ RTN
	007c 8280 f080 827c 007c 8280 f080 8080
]

@font ( spectrum-zx font )
[
	0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000
	0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000
	007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000
	0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800
	0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800
	003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038
	0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000
	0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000
	0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400
	0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000
	0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800
	0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000
	003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00
	0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000
	003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810
	0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800
	003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00
	0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00
	0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200
	0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00
	007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00
	00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200
	0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00
	0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00
	0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00
	0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c
	0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400
	0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800
	0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800
	0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800
	0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00
	0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c
]
@font-num-uc [
	003e 4141 4141 413e 0018 0808 0808 081c 
	003e 4101 3e40 407f 003e 4101 1f01 413e 
	0011 2141 7f01 0101 007f 4040 7e01 413e 
	003e 4140 7e41 413e 003e 4101 0102 0408 
	003e 4141 3e41 413e 003e 4141 3f01 0102 
	0000 0800 0000 0800 0000 0800 0000 0800 
	0000 0800 0000 0810 0000 0408 1008 0400 
	0000 001c 001c 0000 0000 1008 0408 1000 
	0000 0000 0000 0000 003e 4101 3f41 413f 
	007e 4141 7e41 417e 003e 4140 4040 413e 
	007e 4141 4141 417e 007f 4040 7e40 407f 
	007f 4040 7e40 4040 003e 4140 5e41 413e 
	0041 4141 7f41 4141 0008 0808 0808 0808 
	007f 0101 0101 413e 0041 4244 7844 4241 
	0040 4040 4040 403f 0076 4949 4949 4949 
	005e 6141 4141 4141 003e 4141 4141 413e 
	007e 4141 7e40 4040 003e 4141 4145 423d 
	007e 4141 7e41 4141 003e 4140 3e01 413e 
	007f 0808 0808 0808 0041 4141 4141 433d 
	0041 4141 4122 1408 0049 4949 4949 4976 
	0041 2214 0814 2241 0041 4141 3f01 413e 
	007f 0101 3e40 407f ]

M projects/demos/musictracker.usm => projects/demos/musictracker.usm +24 -24
@@ 107,21 107,21 @@ BRK

	.Controller/key DEI
	DUP #61 NEQ ,&no-c JNZ
		;notes GET ;play JSR2 &no-c
		;notes LDA ;play JSR2 &no-c
	DUP #73 NEQ ,&no-d JNZ
		;notes #0001 ADD2 GET ;play JSR2 &no-d
		;notes #0001 ADD2 LDA ;play JSR2 &no-d
	DUP #64 NEQ ,&no-e JNZ
		;notes #0002 ADD2 GET ;play JSR2 &no-e
		;notes #0002 ADD2 LDA ;play JSR2 &no-e
	DUP #66 NEQ ,&no-f JNZ
		;notes #0003 ADD2 GET ;play JSR2 &no-f
		;notes #0003 ADD2 LDA ;play JSR2 &no-f
	DUP #67 NEQ ,&no-g JNZ
		;notes #0004 ADD2 GET ;play JSR2 &no-g
		;notes #0004 ADD2 LDA ;play JSR2 &no-g
	DUP #68 NEQ ,&no-a JNZ
		;notes #0005 ADD2 GET ;play JSR2 &no-a
		;notes #0005 ADD2 LDA ;play JSR2 &no-a
	DUP #6a NEQ ,&no-b JNZ
		;notes #0006 ADD2 GET ;play JSR2 &no-b
		;notes #0006 ADD2 LDA ;play JSR2 &no-b
	DUP #6b NEQ ,&no-c2 JNZ
		;notes #0007 ADD2 GET ;play JSR2 &no-c2
		;notes #0007 ADD2 LDA ;play JSR2 &no-c2
	POP

BRK


@@ 139,7 139,7 @@ RTN
	#0e .Mouse/y DEI2 .trkframe/y1 PEK2 SUB2 SWP POP #08 DIV SUB
	.Mouse/state DEI #10 NEQ ,&no-erase JNZ POP #00 &no-erase
	( edit note )
	TRACK #00 .Mouse/x DEI2 .trkframe/x1 PEK2 SUB2 SWP POP #08 DIV ADD2 PUT
	TRACK #00 .Mouse/x DEI2 .trkframe/x1 PEK2 SUB2 SWP POP #08 DIV ADD2 STA
	( release ) #00 .Mouse/state DEO
	;draw-notes JSR2



@@ 191,33 191,33 @@ BRK

@bang ( -- )
		
	;track/ch1 #00 .head/pos PEK #08 DIV ADD2 GET
	;track/ch1 #00 .head/pos PEK #08 DIV ADD2 LDA
	#01 SUB
	DUP #ff NEQ ,&skip1 JNZ
		POP ,&listen2 JMP
	&skip1
	#00 SWP ;notes ADD2 GET .Audio0/pitch DEO
	#00 SWP ;notes ADD2 LDA .Audio0/pitch DEO
	&listen2
	;track/ch2 #00 .head/pos PEK #08 DIV ADD2 GET
	;track/ch2 #00 .head/pos PEK #08 DIV ADD2 LDA
	#01 SUB
	DUP #ff NEQ ,&skip2 JNZ
		POP ,&listen3 JMP
	&skip2
	#00 SWP ;notes ADD2 GET .Audio1/pitch DEO
	#00 SWP ;notes ADD2 LDA .Audio1/pitch DEO
	&listen3
	;track/ch3 #00 .head/pos PEK #08 DIV ADD2 GET
	;track/ch3 #00 .head/pos PEK #08 DIV ADD2 LDA
	#01 SUB
	DUP #ff NEQ ,&skip3 JNZ
		POP ,&listen4 JMP
	&skip3
	#00 SWP ;notes ADD2 GET .Audio2/pitch DEO
	#00 SWP ;notes ADD2 LDA .Audio2/pitch DEO
	&listen4
	;track/ch4 #00 .head/pos PEK #08 DIV ADD2 GET
	;track/ch4 #00 .head/pos PEK #08 DIV ADD2 LDA
	#01 SUB
	DUP #ff NEQ ,&skip4 JNZ
		POP ,&end JMP
	&skip4
	#00 SWP ;notes ADD2 GET #80 ORA .Audio3/pitch DEO
	#00 SWP ;notes ADD2 LDA #80 ORA .Audio3/pitch DEO
	&end

RTN


@@ 232,7 232,7 @@ RTN
	( incr ) .head/pos PEK #01 ADD .head/pos POK
	.trkframe/x1 PEK2 #00 .head/pos PEK ADD2 .Screen/x DEO2
	;head_icn .Screen/addr DEO2
	#21 ( if note ) TRACK #00 .head/pos PEK #08 DIV ADD2 GET #00 NEQ ADD .Screen/color DEO
	#21 ( if note ) TRACK #00 .head/pos PEK #08 DIV ADD2 LDA #00 NEQ ADD .Screen/color DEO

RTN



@@ 240,7 240,7 @@ RTN

	#00 #20
	&loop
		( load ) OVR #00 SWP TRACK ADD2 GET
		( load ) OVR #00 SWP TRACK ADD2 LDA
		DUP STH #00 SWP #0e SWP SUB 8* .trkframe/y1 PEK2 ADD2 .Screen/y DEO2
		OVR #00 SWP 8* .trkframe/x1 PEK2 ADD2 .Screen/x DEO2
		STHr #00 EQU ,&skip JNZ


@@ 256,7 256,7 @@ RTN

	#00 #20
	&notes-loop
		( load ) OVR #00 SWP TRACK ADD2 GET
		( load ) OVR #00 SWP TRACK ADD2 LDA
		DUP STH #00 SWP #0e SWP SUB 8* .trkframe/y1 PEK2 ADD2 .Screen/y DEO2
		OVR #00 SWP 8* .trkframe/x1 PEK2 ADD2 .Screen/x DEO2
		;note_icn .Screen/addr DEO2


@@ 356,8 356,8 @@ RTN
	.knob/x PEK2 8+ .Screen/x DEO2 ;knob_icns 8+ .Screen/addr DEO2 #21 .Screen/color DEO
	.knob/y PEK2 8+ .Screen/y DEO2 ;knob_icns #0018 ADD2 .Screen/addr DEO2 #21 .Screen/color DEO
	.knob/x PEK2 .Screen/x DEO2 ;knob_icns #0010 ADD2 .Screen/addr DEO2 #21 .Screen/color DEO
	.knob/x PEK2 #00 #00 .knob/value PEK ;knob_offsetx ADD2 GET ADD2 .Screen/x DEO2
	.knob/y PEK2 #00 #00 .knob/value PEK ;knob_offsety ADD2 GET ADD2 .Screen/y DEO2
	.knob/x PEK2 #00 #00 .knob/value PEK ;knob_offsetx ADD2 LDA ADD2 .Screen/x DEO2
	.knob/y PEK2 #00 #00 .knob/value PEK ;knob_offsety ADD2 LDA ADD2 .Screen/y DEO2
	;knob_icns #0020 ADD2 .Screen/addr DEO2
	#25 .Screen/color DEO
	.knob/x PEK2 #0004 ADD2 .Screen/x DEO2


@@ 453,10 453,10 @@ RTN
	( load ) .label/addr POK2 .label/color POK .Screen/y DEO2 .Screen/x DEO2
	.label/addr PEK2
	&loop
		( draw ) DUP2 GET #00 SWP 8* ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( draw ) DUP2 LDA #00 SWP 8* ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( incr ) ++
		( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
		DUP2 GET #00 NEQ ,&loop JNZ
		DUP2 LDA #00 NEQ ,&loop JNZ
	POP2

RTN

M projects/demos/piano.usm => projects/demos/piano.usm +12 -12
@@ 159,7 159,7 @@ BRK
	&no-mod

	.Mouse/x DEI2 .octave-view/x1 PEK2 SUB2 8/ SWP POP #06 GTH ,&no-key JNZ
		.Mouse/x DEI2 .octave-view/x1 PEK2 SUB2 8/ DUP2 SWP POP .last-note POK ;notes ADD2 GET ;play JSR2
		.Mouse/x DEI2 .octave-view/x1 PEK2 SUB2 8/ DUP2 SWP POP .last-note POK ;notes ADD2 LDA ;play JSR2
		( release ) #00 .Mouse/state DEO
		;draw-octave JSR2
	&no-key


@@ 211,21 211,21 @@ BRK

	.Controller/key DEI
	DUP #61 NEQ ,&no-c JNZ
		#00 .last-note POK ;notes GET ;play JSR2 &no-c
		#00 .last-note POK ;notes LDA ;play JSR2 &no-c
	DUP #73 NEQ ,&no-d JNZ
		#01 .last-note POK ;notes ++ GET ;play JSR2 &no-d
		#01 .last-note POK ;notes ++ LDA ;play JSR2 &no-d
	DUP #64 NEQ ,&no-e JNZ
		#02 .last-note POK ;notes #0002 ADD2 GET ;play JSR2 &no-e
		#02 .last-note POK ;notes #0002 ADD2 LDA ;play JSR2 &no-e
	DUP #66 NEQ ,&no-f JNZ
		#03 .last-note POK ;notes #0003 ADD2 GET ;play JSR2 &no-f
		#03 .last-note POK ;notes #0003 ADD2 LDA ;play JSR2 &no-f
	DUP #67 NEQ ,&no-g JNZ
		#04 .last-note POK ;notes #0004 ADD2 GET ;play JSR2 &no-g
		#04 .last-note POK ;notes #0004 ADD2 LDA ;play JSR2 &no-g
	DUP #68 NEQ ,&no-a JNZ
		#05 .last-note POK ;notes #0005 ADD2 GET ;play JSR2 &no-a
		#05 .last-note POK ;notes #0005 ADD2 LDA ;play JSR2 &no-a
	DUP #6a NEQ ,&no-b JNZ
		#06 .last-note POK ;notes #0006 ADD2 GET ;play JSR2 &no-b
		#06 .last-note POK ;notes #0006 ADD2 LDA ;play JSR2 &no-b
	DUP #6b NEQ ,&no-c2 JNZ
		#07 .last-note POK ;notes #0007 ADD2 GET ;play JSR2 &no-c2
		#07 .last-note POK ;notes #0007 ADD2 LDA ;play JSR2 &no-c2
	POP

	.Controller/button DEI #f0 AND


@@ 359,7 359,7 @@ RTN
			.wave-view/y1 PEK2 #0010 ADD2 .Screen/y DEO2
			#03 .Screen/color DEO
		&no-dot
		OVR TOS .Audio0/addr DEI2 ADD2 GET 
		OVR TOS .Audio0/addr DEI2 ADD2 LDA 
		#02 DIV #40 ADD DUP #07 SFT #80 MUL SUB 
		TOS #0004 DIV2 .wave-view/y1 PEK2 ADD2 .Screen/y DEO2
		.Screen/x DEI2 ++ .Screen/x DEO2


@@ 401,8 401,8 @@ RTN
	.knob/x PEK2 8+ .Screen/x DEO2 ;knob_icns 8+ .Screen/addr DEO2 #21 .Screen/color DEO
	.knob/y PEK2 8+ .Screen/y DEO2 ;knob_icns #0018 ADD2 .Screen/addr DEO2 #21 .Screen/color DEO
	.knob/x PEK2 .Screen/x DEO2 ;knob_icns #0010 ADD2 .Screen/addr DEO2 #21 .Screen/color DEO
	.knob/x PEK2 #00 #00 .knob/value PEK ;knob-offsetx ADD2 GET ADD2 .Screen/x DEO2
	.knob/y PEK2 #00 #00 .knob/value PEK ;knob-offsety ADD2 GET ADD2 .Screen/y DEO2
	.knob/x PEK2 #00 #00 .knob/value PEK ;knob-offsetx ADD2 LDA ADD2 .Screen/x DEO2
	.knob/y PEK2 #00 #00 .knob/value PEK ;knob-offsety ADD2 LDA ADD2 .Screen/y DEO2
	;knob_icns #0020 ADD2 .Screen/addr DEO2
	#25 .Screen/color DEO
	.knob/x PEK2 #0004 ADD2 .Screen/x DEO2

M projects/demos/theme.usm => projects/demos/theme.usm +8 -8
@@ 76,17 76,17 @@ BRK
	DUP2 #0010 NEQ2 ,&no-touch-red JNZ
		.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-red JNZ
		.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-red JNZ
		( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/r1 #00 .selection PEK ADD2 PUT
		( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/r1 #00 .selection PEK ADD2 STA
	&no-touch-red
	DUP2 #0020 NEQ2 ,&no-touch-green JNZ
		.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-green JNZ
		.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-green JNZ
		( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/g1 #00 .selection PEK ADD2 PUT
		( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/g1 #00 .selection PEK ADD2 STA
	&no-touch-green
	DUP2 #0030 NEQ2 ,&no-touch-blue JNZ
		.Mouse/x DEI2 .window/x1 PEK2 #0060 ADD2 LTH2 ,&no-touch-blue JNZ
		.Mouse/x DEI2 .window/x1 PEK2 #009c ADD2 GTH2 ,&no-touch-blue JNZ
		( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/b1 #00 .selection PEK ADD2 PUT
		( get new value ) .Mouse/x DEI2 .window/x1 PEK2 SUB2 #0060 SUB2 #0004 DIV2 SWP POP ;theme/b1 #00 .selection PEK ADD2 STA
	&no-touch-blue
	DUP2 #0040 NEQ2 ,&no-touch-radio JNZ
		.Mouse/x DEI2 .window/x1 PEK2 #0050 ADD2 LTH2 ,&no-touch-radio JNZ


@@ 210,9 210,9 @@ RTN
	.window/x1 PEK2 #0038 ADD2 .Screen/x DEO2 
	.System/b DEI2 #28 ;draw-short JSR2

	.window/x1 PEK2 #0060 ADD2 .window/y1 PEK2 #0010 ADD2 .window/x1 PEK2 #0090 ADD2 #00 ;theme/r1 .selection PEK ADD GET #0004 MUL2 #01 ;draw-slider JSR2
	.window/x1 PEK2 #0060 ADD2 .window/y1 PEK2 #0020 ADD2 .window/x1 PEK2 #0090 ADD2 #00 ;theme/g1 .selection PEK ADD GET #0004 MUL2 #01 ;draw-slider JSR2
	.window/x1 PEK2 #0060 ADD2 .window/y1 PEK2 #0030 ADD2 .window/x1 PEK2 #0090 ADD2 #00 ;theme/b1 .selection PEK ADD GET #0004 MUL2 #01 ;draw-slider JSR2
	.window/x1 PEK2 #0060 ADD2 .window/y1 PEK2 #0010 ADD2 .window/x1 PEK2 #0090 ADD2 #00 ;theme/r1 .selection PEK ADD LDA #0004 MUL2 #01 ;draw-slider JSR2
	.window/x1 PEK2 #0060 ADD2 .window/y1 PEK2 #0020 ADD2 .window/x1 PEK2 #0090 ADD2 #00 ;theme/g1 .selection PEK ADD LDA #0004 MUL2 #01 ;draw-slider JSR2
	.window/x1 PEK2 #0060 ADD2 .window/y1 PEK2 #0030 ADD2 .window/x1 PEK2 #0090 ADD2 #00 ;theme/b1 .selection PEK ADD LDA #0004 MUL2 #01 ;draw-slider JSR2

	.window/x1 PEK2 #0050 ADD2 .Screen/x DEO2
	.window/y1 PEK2 #0040 ADD2 .Screen/y DEO2


@@ 326,12 326,12 @@ RTN
	.Screen/x DEO2 
	STH2r
	&loop
		DUP2 GET #00 SWP #0008 MUL2 
		DUP2 LDA #00 SWP #0008 MUL2 
		;font ADD2 .Screen/addr DEO2 
		( draw ) DUPr STHr .Screen/color DEO
		( incr ) ++
		( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
		DUP2 GET #00 NEQ ,&loop JNZ
		DUP2 LDA #00 NEQ ,&loop JNZ
	POP2 POPr

RTN

M projects/examples/devices/audio.usm => projects/examples/devices/audio.usm +1 -1
@@ 35,7 35,7 @@ BRK
	( skip ) .timer PEK #10 EQU #01 JNZ [ BRK ]

	( get note )
	;melody #00 .progress PEK ADD2 GET 
	;melody #00 .progress PEK ADD2 LDA 

	( play note )
	DUP .Audio0/pitch DEO

M projects/examples/devices/console.lib.usm => projects/examples/devices/console.lib.usm +2 -2
@@ 33,9 33,9 @@ BRK
@print ( addr -- )
	
	&loop
		( send ) DUP2 GET .Console/char DEO
		( send ) DUP2 LDA .Console/char DEO
		( incr ) #0001 ADD2
		( loop ) DUP2 GET ,&loop JNZ
		( loop ) DUP2 LDA ,&loop JNZ
	POP2

RTN

M projects/examples/devices/console.usm => projects/examples/devices/console.usm +2 -2
@@ 17,9 17,9 @@ BRK
@print ( addr* -- )
	
	&loop
		( send ) DUP2 GET .Console/char DEO
		( send ) DUP2 LDA .Console/char DEO
		( incr ) #0001 ADD2
		( loop ) DUP2 GET #00 NEQ ,&loop JNZ
		( loop ) DUP2 LDA #00 NEQ ,&loop JNZ
	POP2

RTN

M projects/examples/devices/datetime.usm => projects/examples/devices/datetime.usm +4 -4
@@ 51,13 51,13 @@ BRK
	#0080 SCALEX #0080 SCALEY .needles/hx PEK2 .needles/hy PEK2 #00 ;draw-line JSR2

	( place )
	#00 .DateTime/second DEI #0002 MUL2 ;table ADD2 GET2
	#00 .DateTime/second DEI #0002 MUL2 ;table ADD2 LDA2
		#00 SWP SCALEY .needles/sy POK2
		#00 SWP SCALEX .needles/sx POK2
	#00 .DateTime/minute DEI #0002 MUL2 ;table ADD2 GET2
	#00 .DateTime/minute DEI #0002 MUL2 ;table ADD2 LDA2
		#00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEY .needles/my POK2
		#00 SWP #0004 DIV2 #0003 MUL2 #0020 ADD2 SCALEX .needles/mx POK2
	#00 .DateTime/hour DEI 12HOURS #05 MUL #0002 MUL2 ;table ADD2 GET2
	#00 .DateTime/hour DEI 12HOURS #05 MUL #0002 MUL2 ;table ADD2 LDA2
		#00 SWP #0002 DIV2 #0040 ADD2 SCALEY .needles/hy POK2
		#00 SWP #0002 DIV2 #0040 ADD2 SCALEX .needles/hx POK2



@@ 69,7 69,7 @@ BRK
	( circle )
	#00 #3c
	&loop
		( load ) OVR #00 SWP #0002 MUL2 ;table ADD2 GET2
		( load ) OVR #00 SWP #0002 MUL2 ;table ADD2 LDA2
		#00 SWP SCALEY .Screen/y DEO2
		#00 SWP SCALEX .Screen/x DEO2
		OVR #0f MOD #00 EQU #01 ADD .Screen/color DEO

M projects/examples/gui/label.usm => projects/examples/gui/label.usm +7 -7
@@ 50,10 50,10 @@ RTN
	( load ) .label/addr POK2 .label/color POK .Screen/y DEO2 .Screen/x DEO2
	.label/addr PEK2
	&loop
		( draw ) DUP2 GET #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( incr ) #0001 ADD2
		( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
		DUP2 GET #00 NEQ ,&loop JNZ
		DUP2 LDA #00 NEQ ,&loop JNZ
	POP2

RTN


@@ 64,10 64,10 @@ RTN
	( align ) .label/addr PEK2 ;get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 .Screen/x DEO2
	.label/addr PEK2
	&loop
		( draw ) DUP2 GET #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( incr ) #0001 ADD2
		( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
		DUP2 GET #00 NEQ ,&loop JNZ
		DUP2 LDA #00 NEQ ,&loop JNZ
	POP2

RTN


@@ 78,10 78,10 @@ RTN
	( align ) .label/addr PEK2 ;get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 .Screen/x DEO2
	.label/addr PEK2
	&loop
		( draw ) DUP2 GET #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( draw ) DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( incr ) #0001 ADD2
		( incr ) .Screen/x DEI2 #0008 ADD2 .Screen/x DEO2
		DUP2 GET #00 NEQ ,&loop JNZ
		DUP2 LDA #00 NEQ ,&loop JNZ
	POP2

RTN


@@ 91,7 91,7 @@ RTN
	#0000 ( counter )
	&loop
		( incr ) #0001 ADD2 OVR2 OVR2 ADD2
		GET #00 NEQ ,&loop JNZ
		LDA #00 NEQ ,&loop JNZ
	SWP2 POP2

RTN

M projects/software/asma.usm => projects/software/asma.usm +30 -30
@@ 64,7 64,7 @@

	&loop
	#0001 ADD2
	DUP2 GET
	DUP2 LDA
	#20 GTH ,&loop JNZ

	DUP2 OVR2r STH2r LTS2 ,&valid JNZ


@@ 73,7 73,7 @@
	JMP2r

	&valid
	DUP2 GET #00 OVR2 PUT
	DUP2 LDA #00 OVR2 STA
	STH2r #0001 ADD2 ,assemble-token JSR
	,&per-token JNZ



@@ 107,24 107,24 @@
	POP2
	.assembler/token POK2
	( tail call default handling function defined in state-machine-pointers )
	LIT2r [ 0002 ] ADD2r GET2r
	LIT2r [ 0002 ] ADD2r LDA2r
	JMP2r

@parse-hex-length ( string-ptr* -- value 01 if one or two hex digits
                                OR 00 otherwise )
	DUP2 #0001 ADD2 GET ,parse-hex-string/try-two JNZ
	GET ,parse-hex-digit JSR DUP #04 SFT ,parse-hex-string/fail1 JNZ
	DUP2 #0001 ADD2 LDA ,parse-hex-string/try-two JNZ
	LDA ,parse-hex-digit JSR DUP #04 SFT ,parse-hex-string/fail1 JNZ
	#01 JMP2r

@parse-hex-string ( string-ptr* -- value* 02 if four hex digits
                                OR value 01 if two hex digits
                                OR 00 otherwise )
	DUP2 #0004 ADD2 GET #00 EQU ,&try-four JNZ
	DUP2 #0004 ADD2 LDA #00 EQU ,&try-four JNZ
	&try-two
	DUP2 #0002 ADD2 GET ,&fail2 JNZ
	DUP2 #0002 ADD2 LDA ,&fail2 JNZ
	&known-two
	DUP2 GET ,parse-hex-digit JSR DUP #04 SFT ,&fail3 JNZ ROT ROT
	#0001 ADD2 GET ,parse-hex-digit JSR DUP #04 SFT ,&fail2 JNZ
	DUP2 LDA ,parse-hex-digit JSR DUP #04 SFT ,&fail3 JNZ ROT ROT
	#0001 ADD2 LDA ,parse-hex-digit JSR DUP #04 SFT ,&fail2 JNZ
	SWP #40 SFT ORA #01 JMP2r

	&fail3 POP


@@ 174,11 174,11 @@
	.tree/max-key-len POK .tree/search-key POK2

	&loop
	DUP2 GET2 #0000 NEQ2 ,&valid-node JNZ
	DUP2 LDA2 #0000 NEQ2 ,&valid-node JNZ
	#01 JMP2r

	&valid-node
	GET2 DUP2 STH2 #0004 ADD2 ,strcmp-tree JSR
	LDA2 DUP2 STH2 #0004 ADD2 ,strcmp-tree JSR
	DUP ,&nomatch JNZ
	POP2r JMP2r



@@ 200,7 200,7 @@
	JMP2r

	&keep-going
	#01 OVR2 GET DUP2r GETr STHr
	#01 OVR2 LDA DUP2r LDAr STHr
	DUP2 ORA ,&not-end JNZ

	( end of C strings, match found )


@@ 229,7 229,7 @@
	DUP #01 SFT ORA
	DUP #02 SFT ORA
	DUP #04 SFT ORA
	#1d MUL #05 SFT #00 SWP ;&lookup ADD2 GET
	#1d MUL #05 SFT #00 SWP ;&lookup ADD2 LDA
	JMP2r

	&lookup


@@ 245,7 245,7 @@

	&keep-going
	#0001 SUB2
	SWP2 DUP2 GET DUP2r STH2r PUT
	SWP2 DUP2 LDA DUP2r STH2r STA
	#0001 ADD2 SWP2
	LIT2r [ 0001 ] ADD2r
	,&loop JMP


@@ 257,7 257,7 @@
	DUP2 #0001 SUB2
	&loop
	#0001 ADD2
	DUP2 GET ,&loop JNZ
	DUP2 LDA ,&loop JNZ
	SWP2 SUB2
	JMP2r



@@ 267,7 267,7 @@
	JMP2r

@append-tree ( string-ptr* incoming-ptr* -- binary-data* )
	.assembler/heap PEK2 SWP2 PUT2
	.assembler/heap PEK2 SWP2 STA2
	;&zero-pointers .assembler/heap PEK2 #0004 ,memcpy JSR .assembler/heap POK2
	,append-heap JSR
	JMP2r


@@ 280,10 280,10 @@

	( label already exists, check the flags and addr value )
	SWP2 POP2
	DUP2 #0001 ADD2 GET2 .assembler/addr PEK2 EQU2 ,&addr-okay JNZ
	DUP2 #0001 ADD2 LDA2 .assembler/addr PEK2 EQU2 ,&addr-okay JNZ
	( FIXME address is different to previous run, or label defined twice )
	&addr-okay
	GET EQU ,&type-okay JNZ
	LDA EQU ,&type-okay JNZ
	( FIXME node type is different to before )
	&type-okay
	JMP2r


@@ 296,8 296,8 @@
	~assembler.heap ,strcpy JSR2
	)
	
	DUP2 STH2 PUT STH2r
	DUP2 #0001 ADD2 .assembler/addr PEK2 SWP2 PUT2
	DUP2 STH2 STA STH2r
	DUP2 #0001 ADD2 .assembler/addr PEK2 SWP2 STA2
	#0003 ADD2 .assembler/heap POK2
	JMP2r



@@ 305,7 305,7 @@
                            OR false-address* 00 if not found )
	DUP2
	&loop
	DUP2 #0001 ADD2 SWP2 GET
	DUP2 #0001 ADD2 SWP2 LDA
	DUP #2e EQU ,&dotted JNZ
	,&loop JNZ
	DUP2 EOR2 ( faster than POP2 #0000 )


@@ 317,12 317,12 @@

	SWP2 POP2
	.assembler/field PEK2 #0000 EQU2 ,&end JNZ
	DUP2 GET #80 LTH ,&not-found JNZ
	DUP2 LDA #80 LTH ,&not-found JNZ
	#0003 ADD2 .assembler/field PEK2 #ff ;traverse-tree JSR2
	,&not-found JNZ

	&end
	DUP2 #0001 ADD2 GET2 SWP2 GET
	DUP2 #0001 ADD2 LDA2 SWP2 LDA
	JMP2r

	&not-found


@@ 336,7 336,7 @@

	&dotted
	DUP OVR2 .assembler/field POK2
	EOR ROT ROT #0001 SUB2 PUT
	EOR ROT ROT #0001 SUB2 STA
	,&main JMP

@write-byte ( byte -- )


@@ 554,7 554,7 @@

	.assembler/token PEK2
	&loop
	DUP2 GET
	DUP2 LDA
	DUP ,&keep-going JNZ
	POP POP2 JMP2r



@@ 671,7 671,7 @@

@normal-;   [ 0000 ]    [ 0000 ]    [ 3b ]
	#80 .assembler/token PEK2 ;label-tree ;add-label JSR2
	.assembler/heap PEK2 #0000 OVR2 PUT2
	.assembler/heap PEK2 #0000 OVR2 STA2
	DUP2 #0003 SUB2 .assembler/var_size POK2
	DUP2 .assembler/subtree POK2
	#0002 ADD2 .assembler/heap POK2


@@ 705,9 705,9 @@
	&valid
	&no-var-size
	DUP #02 GTH ,&end JNZ
	DUP .assembler/field_size PEK2 PUT
	DUP .assembler/field_size PEK2 STA
	.assembler/var_size PEK2 #0000 EQU2 ,&end JNZ
	DUP #80 EOR .assembler/var_size PEK2 PUT
	DUP #80 EOR .assembler/var_size PEK2 STA
	,&end JMP

	&loop


@@ 747,7 747,7 @@
	JMP2r

@macro-}   [ 0000 ]    [ 0000 ]    [ 7d ]
	.assembler/heap PEK2 DUP2 #00 ROT ROT PUT
	.assembler/heap PEK2 DUP2 #00 ROT ROT STA
	#0001 ADD2 .assembler/heap POK2
	.assembler/state PEK #fc AND .assembler/state POK
	JMP2r


@@ 785,7 785,7 @@
	;opcodes/asm SUB2 #0007 DIV2
	SWP2 #0003 ADD2
	&flags
	DUP2 GET
	DUP2 LDA
	DUP #00 EQU ,&end-flags JNZ
	DUP #32 NEQ ,&not-two JNZ
	POP SWP2 SHORT_FLAG ORA SWP2 #0001 ADD2 ,&flags JMP

M projects/software/left.usm => projects/software/left.usm +47 -47
@@ 149,7 149,7 @@ BRK

	( insert )
	.selection/to PEK2 .selection/from PEK2 SUB2 ;shift-right JSR2
	.Controller/key DEI .selection/from PEK2 PUT
	.Controller/key DEI .selection/from PEK2 STA
	.selection/from PEK2 ++ .selection/from POK2
	.selection/from PEK2 ++ .selection/to POK2
	;redraw JSR2


@@ 234,10 234,10 @@ BRK

	.File/name DEO2 #8000 .File/length DEO2 ;document/body .File/load DEO2
	( get file length )
	;document/body ;document/eof PUT2
	;document/body ;document/eof STA2
	&loop
		( incr ) ;document/eof GET2 ++ ;document/eof PUT2
	;document/eof GET2 GET #00 NEQ ,&loop JNZ
		( incr ) ;document/eof LDA2 ++ ;document/eof STA2
	;document/eof LDA2 LDA #00 NEQ ,&loop JNZ

RTN



@@ 262,22 262,22 @@ RTN
	.i POK2
	.selection/from PEK2 -- .j POK2 ( start -> end )
	&loop
		( move ) .j PEK2 .i PEK2 ADD2 GET .j PEK2 PUT
		( move ) .j PEK2 .i PEK2 ADD2 LDA .j PEK2 STA
		( incr ) .j PEK2 ++ .j POK2
		.j PEK2 ;document/eof GET2 LTH2 ,&loop JNZ
	;document/eof GET2 .i PEK2 SUB2 ;document/eof PUT2
		.j PEK2 ;document/eof LDA2 LTH2 ,&loop JNZ
	;document/eof LDA2 .i PEK2 SUB2 ;document/eof STA2

RTN

@shift-right ( length -- )

	.i POK2
	;document/eof GET2 .j POK2 ( end -> start )
	;document/eof LDA2 .j POK2 ( end -> start )
	&loop
		( move ) .j PEK2 .i PEK2 SUB2 GET .j PEK2 PUT
		( move ) .j PEK2 .i PEK2 SUB2 LDA .j PEK2 STA
		( decr ) .j PEK2 -- .j POK2
		.j PEK2 .selection/from PEK2 GTH2 ,&loop JNZ
	;document/eof GET2 .i PEK2 ADD2 ;document/eof PUT2
	;document/eof LDA2 .i PEK2 ADD2 ;document/eof STA2

RTN



@@ 302,10 302,10 @@ RTN
@goto-linestart ( -- )

	&loop
		.selection/from PEK2 -- GET #0a EQU RTN?
		.selection/from PEK2 -- GET #0d EQU RTN?
		.selection/from PEK2 -- LDA #0a EQU RTN?
		.selection/from PEK2 -- LDA #0d EQU RTN?
		( decr ) .selection/from PEK2 DUP2 .selection/to POK2 -- .selection/from POK2
	.selection/from PEK2 GET #00 NEQ ,&loop JNZ
	.selection/from PEK2 LDA #00 NEQ ,&loop JNZ
	( clamp at document body )
	.selection/from PEK2 ;document/body GTH2 RTN?
	;document/body DUP2 .selection/from POK2 ++ .selection/to POK2


@@ 315,10 315,10 @@ RTN
@goto-lineend ( -- )
	
	&loop
		.selection/from PEK2 GET #0a EQU RTN?
		.selection/from PEK2 GET #0d EQU RTN?
		.selection/from PEK2 LDA #0a EQU RTN?
		.selection/from PEK2 LDA #0d EQU RTN?
		( incr ) .selection/from PEK2 ++ DUP2 ++ .selection/to POK2 .selection/from POK2
		.selection/from PEK2 GET #00 NEQ ,&loop JNZ
		.selection/from PEK2 LDA #00 NEQ ,&loop JNZ
	( clamp at document body )
	.selection/from PEK2 ;document/eof LTH2 RTN?
	;document/eof -- DUP2 .selection/from POK2 ++ .selection/to POK2


@@ 330,9 330,9 @@ RTN
	.selection/to PEK2 .j POK2
	&loop
		( decr ) .j PEK2 -- .j POK2
		.j PEK2 GET #20 EQU ,&end JNZ
		.j PEK2 GET #0a EQU ,&end JNZ
		.j PEK2 GET #0d EQU ,&end JNZ
		.j PEK2 LDA #20 EQU ,&end JNZ
		.j PEK2 LDA #0a EQU ,&end JNZ
		.j PEK2 LDA #0d EQU ,&end JNZ
		.j PEK2 ;document/body GTH2 ,&loop JNZ
	&end
	( return ) .j PEK2 --


@@ 344,9 344,9 @@ RTN
	.selection/to PEK2 .j POK2
	&loop
		( incr ) .j PEK2 ++ .j POK2
		.j PEK2 GET #20 EQU ,&end JNZ
		.j PEK2 GET #0a EQU ,&end JNZ
		.j PEK2 GET #0d EQU ,&end JNZ
		.j PEK2 LDA #20 EQU ,&end JNZ
		.j PEK2 LDA #0a EQU ,&end JNZ
		.j PEK2 LDA #0d EQU ,&end JNZ
		.j PEK2 ;document/body GTH2 ,&loop JNZ
	&end
	( return ) .j PEK2 ++


@@ 358,8 358,8 @@ RTN
	#0000 .j POK2
	&loop
		( incr ) .j PEK2 ++ .j POK2
		.selection/from PEK2 .j PEK2 SUB2 GET #0a EQU ,&end JNZ
		.selection/from PEK2 .j PEK2 SUB2 GET #0d EQU ,&end JNZ
		.selection/from PEK2 .j PEK2 SUB2 LDA #0a EQU ,&end JNZ
		.selection/from PEK2 .j PEK2 SUB2 LDA #0d EQU ,&end JNZ
		.selection/from PEK2 .j PEK2 SUB2 ;document/body GTH2 ,&loop JNZ
	&end
	( return ) .j PEK2


@@ 371,11 371,11 @@ RTN
	;document/body .j POK2 #0000 .pt/y POK2
	&loop
		.pt/y PEK2 .position/y PEK2 -- GTH2 ,&end JNZ
		.j PEK2 GET #0a NEQ .j PEK2 GET #0d NEQ #0101 EQU2 ,&no-space JNZ
		.j PEK2 LDA #0a NEQ .j PEK2 LDA #0d NEQ #0101 EQU2 ,&no-space JNZ
			( incr ) .pt/y PEK2 ++ .pt/y POK2
		&no-space
		( incr ) .j PEK2 ++ .j POK2
	.j PEK2 GET #00 NEQ ,&loop JNZ
	.j PEK2 LDA #00 NEQ ,&loop JNZ
	&end
	( return ) .j PEK2



@@ 386,8 386,8 @@ RTN
	;find-line JSR2 ( find line )
	#0000 .pt/x POK2
	&loop
		.j PEK2 .pt/x PEK2 ADD2 GET #0a EQU ,&end JNZ
		.j PEK2 .pt/x PEK2 ADD2 GET #0d EQU ,&end JNZ
		.j PEK2 .pt/x PEK2 ADD2 LDA #0a EQU ,&end JNZ
		.j PEK2 .pt/x PEK2 ADD2 LDA #0d EQU ,&end JNZ
		( incr ) .pt/x PEK2 ++ .pt/x POK2
		.pt/x PEK2 .position/x PEK2 -- LTH2 ,&loop JNZ
	&end


@@ 407,9 407,9 @@ RTN
	
	#0000 .i POK2 ( start )
	.selection/to PEK2 .selection/from PEK2 SUB2 .j POK2 ( end )
	.j PEK2 ;clip/len PUT2
	.j PEK2 ;clip/len STA2
	&loop
		.selection/from PEK2 .i PEK2 ADD2 GET ;clip/body .i PEK2 ADD2 PUT
		.selection/from PEK2 .i PEK2 ADD2 LDA ;clip/body .i PEK2 ADD2 STA
		( incr ) .i PEK2 ++ .i POK2
		.i PEK2 .j PEK2 LTH2 ,&loop JNZ



@@ 417,11 417,11 @@ RTN

@paste ( -- )
	
	;clip/len GET2 ;shift-right JSR2
	;clip/len LDA2 ;shift-right JSR2
	#0000 .i POK2 ( start )
	;clip/len GET2 .j POK2 ( end )
	;clip/len LDA2 .j POK2 ( end )
	&loop
		;clip/body .i PEK2 ADD2 GET .selection/from PEK2 .i PEK2 ADD2 PUT
		;clip/body .i PEK2 ADD2 LDA .selection/from PEK2 .i PEK2 ADD2 STA
		( incr ) .i PEK2 ++ .i POK2
		.i PEK2 .j PEK2 LTH2 ,&loop JNZ



@@ 431,7 431,7 @@ RTN
	
	;document/body .selection/from POK2 #0000 .pt/x POK2 #0000 .pt/y POK2
	&loop
		.selection/from PEK2 GET #0a NEQ .selection/from PEK2 GET #0d NEQ #0101 EQU2 ,&no-space JNZ
		.selection/from PEK2 LDA #0a NEQ .selection/from PEK2 LDA #0d NEQ #0101 EQU2 ,&no-space JNZ
			( incr ) .pt/y PEK2 ++ .pt/y POK2
			#0000 .pt/x POK2
		&no-space


@@ 441,7 441,7 @@ RTN
		&no-reached
		( incr ) .pt/x PEK2 ++ .pt/x POK2
		( incr ) .selection/from PEK2 ++ .selection/from POK2
	.selection/from PEK2 GET #00 NEQ ,&loop JNZ
	.selection/from PEK2 LDA #00 NEQ ,&loop JNZ

RTN



@@ 477,16 477,16 @@ RTN
@draw-short ( short )

	.addr POK2
	;font_hex #00 ;addr GET #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
	;font_hex #00 ;addr LDA #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
	( draw ) #2e .Screen/color DEO
	.Screen/x DEI2 8+ .Screen/x DEO2
	;font_hex #00 ;addr GET #0f AND #08 MUL ADD2 .Screen/addr DEO2
	;font_hex #00 ;addr LDA #0f AND #08 MUL ADD2 .Screen/addr DEO2
	( draw ) #2e .Screen/color DEO
	.Screen/x DEI2 8+ .Screen/x DEO2
	;font_hex #00 ;addr ++ GET #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
	;font_hex #00 ;addr ++ LDA #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
	( draw ) #2e .Screen/color DEO
	.Screen/x DEI2 8+ .Screen/x DEO2
	;font_hex #00 ;addr ++ GET #0f AND #08 MUL ADD2 .Screen/addr DEO2
	;font_hex #00 ;addr ++ LDA #0f AND #08 MUL ADD2 .Screen/addr DEO2
	( draw ) #2e .Screen/color DEO

RTN


@@ 519,10 519,10 @@ RTN
	#0000 .j POK2 ( j is linebreaks )
	&find-offset
		.scroll/y PEK2 .j PEK2 EQU2 ,&find-offset-end JNZ
		.textarea/addr PEK2 GET #0a NEQ .textarea/addr PEK2 GET #0d NEQ #0101 EQU2 ,&no-break JNZ
		.textarea/addr PEK2 LDA #0a NEQ .textarea/addr PEK2 LDA #0d NEQ #0101 EQU2 ,&no-break JNZ
			( incr ) .j PEK2 ++ .j POK2 &no-break
		( incr ) .textarea/addr PEK2 ++ .textarea/addr POK2
	.textarea/addr PEK2 GET #00 NEQ ,&find-offset JNZ
	.textarea/addr PEK2 LDA #00 NEQ ,&find-offset JNZ
	&find-offset-end

	#0018 .Screen/x DEO2 #0000 .Screen/y DEO2


@@ 533,7 533,7 @@ RTN
		.Screen/y DEI2 .Screen/height DEI2 #0010 SUB2 GTH2 ;&end JNZ2


		.i PEK2 GET #0a NEQ .i PEK2 GET #0d NEQ #0101 EQU2 ;&no-linebreak JNZ2
		.i PEK2 LDA #0a NEQ .i PEK2 LDA #0d NEQ #0101 EQU2 ;&no-linebreak JNZ2
			( draw linebreak )
			;linebreak_icn .Screen/addr DEO2
			( draw ) #02


@@ 563,9 563,9 @@ RTN


		( get character )
		;font #00 .i PEK2 GET #20 SUB 8* ADD2 .Screen/addr DEO2
		;font #00 .i PEK2 LDA #20 SUB 8* ADD2 .Screen/addr DEO2
		( is a special character )
		.i PEK2 GET #20 GTH ,&no-tab JNZ ;font .Screen/addr DEO2 &no-tab
		.i PEK2 LDA #20 GTH ,&no-tab JNZ ;font .Screen/addr DEO2 &no-tab

		( draw ) #21
		.i PEK2 .selection/from PEK2 -- GTH2


@@ 575,7 575,7 @@ RTN
		( incr ) .i PEK2 ++ .i POK2
		( incr ) .Screen/x DEI2 #0007 ADD2 .Screen/x DEO2

	.i PEK2 GET #00 NEQ ;&loop JNZ2
	.i PEK2 LDA #00 NEQ ;&loop JNZ2

	&end



@@ 616,10 616,10 @@ RTN
	( load ) .label/addr POK2 .label/color POK .Screen/y DEO2 .Screen/x DEO2
	.label/addr PEK2
	&loop
		( draw ) DUP2 GET #00 SWP #20 SUB 8* ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( draw ) DUP2 LDA #00 SWP #20 SUB 8* ;font ADD2 .Screen/addr DEO2 .label/color PEK .Screen/color DEO
		( incr ) ++
		( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
		DUP2 GET #00 NEQ ,&loop JNZ
		DUP2 LDA #00 NEQ ,&loop JNZ
	POP2
	( selection )
	.selection/from PEK2 ;document/body SUB2 ;draw-short JSR2

M projects/software/nasu.usm => projects/software/nasu.usm +35 -35
@@ 31,10 31,10 @@
} ( x y w h -- x1 y1 x2 y2 )

%SET-RECT {
	DUP2 ROT2 SWP2 #0006 ADD2 PUT2
	DUP2 ROT2 SWP2 #0004 ADD2 PUT2
	DUP2 ROT2 SWP2 #0002 ADD2 PUT2
	DUP2 ROT2 SWP2 PUT2
	DUP2 ROT2 SWP2 #0006 ADD2 STA2
	DUP2 ROT2 SWP2 #0004 ADD2 STA2
	DUP2 ROT2 SWP2 #0002 ADD2 STA2
	DUP2 ROT2 SWP2 STA2
	POP2
} ( x1 y1 x2 y2 addr -- )



@@ 208,12 208,12 @@ BRK
	.bankview/mode PEK #01 NEQ ,&not-copy-mode JNZ
		#00 .i POK
		&copy-loop
			( load ) .settings/tile PEK2 .i PEK ADD GET
			( load ) .settings/tile PEK2 .i PEK ADD LDA
			( get touch addr )
			.Mouse/x DEI2 .bankview/x PEK2 SUB2 STEP8
			.Mouse/y DEI2 .bankview/y PEK2 SUB2 STEP8 #0010 MUL2 ADD2
			( 2-bit mode ) #00 .settings/depth PEK #01 ADD MUL2
			.settings/page PEK2 ADD2 #00 .i PEK ADD2 PUT
			.settings/page PEK2 ADD2 #00 .i PEK ADD2 STA
			( incr ) .i PEK #01 ADD .i POK
			.i PEK #08 LTH ,&copy-loop JNZ
		;redraw JSR2 BRK


@@ 227,7 227,7 @@ BRK
			.Mouse/x DEI2 .bankview/x PEK2 SUB2 STEP8
			.Mouse/y DEI2 .bankview/y PEK2 SUB2 STEP8 #0010 MUL2 ADD2
			( 2-bit mode ) #00 .settings/depth PEK #01 ADD MUL2
			.settings/page PEK2 ADD2 #00 .i PEK ADD2 PUT
			.settings/page PEK2 ADD2 #00 .i PEK ADD2 STA
			( incr ) .i PEK #01 ADD .i POK
			.i PEK #08 LTH ,&erase-loop JNZ
		;redraw JSR2 BRK


@@ 251,16 251,16 @@ BRK
	.Mouse/x DEI2 .tileview/x PEK2 SUB2 .Mouse/x DEI2 .tileview/x PEK2 SUB2 #0040 DIV2 #0040 MUL2 SUB2 .pos/x POK2
	.Mouse/y DEI2 .tileview/y PEK2 SUB2 .Mouse/y DEI2 .tileview/y PEK2 SUB2 #0040 DIV2 #0040 MUL2 SUB2 .pos/y POK2
	.Mouse/state DEI #10 NEQ ,&no-erase-mode JNZ
		( load ) .addr PEK2 .pos/y PEK2 8/ ADD2 GET
		( load ) .addr PEK2 .pos/y PEK2 8/ ADD2 LDA
		( mask ) #01 #07 .pos/x PEK2 8/ SWP POP SUB SFL
		#ff EOR AND
		( save ) .addr PEK2 .pos/y PEK2 8/ ADD2 PUT
		( save ) .addr PEK2 .pos/y PEK2 8/ ADD2 STA
		;redraw JSR2 BRK
	&no-erase-mode
	( load ) .addr PEK2 .pos/y PEK2 8/ ADD2 GET
	( load ) .addr PEK2 .pos/y PEK2 8/ ADD2 LDA
	( mask ) #01 #07 .pos/x PEK2 8/ SWP POP SUB SFL
	ORA
	( save ) .addr PEK2 .pos/y PEK2 8/ ADD2 PUT
	( save ) .addr PEK2 .pos/y PEK2 8/ ADD2 STA
	;redraw JSR2

BRK


@@ 358,29 358,29 @@ RTN

@op_shiftup
	
	.settings/tile PEK2 GET
	.settings/tile PEK2 #0001 ADD2 GET .settings/tile PEK2 PUT
	.settings/tile PEK2 #0002 ADD2 GET .settings/tile PEK2 #0001 ADD2 PUT
	.settings/tile PEK2 #0003 ADD2 GET .settings/tile PEK2 #0002 ADD2 PUT
	.settings/tile PEK2 #0004 ADD2 GET .settings/tile PEK2 #0003 ADD2 PUT
	.settings/tile PEK2 #0005 ADD2 GET .settings/tile PEK2 #0004 ADD2 PUT
	.settings/tile PEK2 #0006 ADD2 GET .settings/tile PEK2 #0005 ADD2 PUT
	.settings/tile PEK2 #0007 ADD2 GET .settings/tile PEK2 #0006 ADD2 PUT
	.settings/tile PEK2 #0007 ADD2 PUT
	.settings/tile PEK2 LDA
	.settings/tile PEK2 #0001 ADD2 LDA .settings/tile PEK2 STA
	.settings/tile PEK2 #0002 ADD2 LDA .settings/tile PEK2 #0001 ADD2 STA
	.settings/tile PEK2 #0003 ADD2 LDA .settings/tile PEK2 #0002 ADD2 STA
	.settings/tile PEK2 #0004 ADD2 LDA .settings/tile PEK2 #0003 ADD2 STA
	.settings/tile PEK2 #0005 ADD2 LDA .settings/tile PEK2 #0004 ADD2 STA
	.settings/tile PEK2 #0006 ADD2 LDA .settings/tile PEK2 #0005 ADD2 STA
	.settings/tile PEK2 #0007 ADD2 LDA .settings/tile PEK2 #0006 ADD2 STA
	.settings/tile PEK2 #0007 ADD2 STA

RTN

@op_shiftdown
	
	.settings/tile PEK2 #0007 ADD2 GET
	.settings/tile PEK2 #0006 ADD2 GET .settings/tile PEK2 #0007 ADD2 PUT
	.settings/tile PEK2 #0005 ADD2 GET .settings/tile PEK2 #0006 ADD2 PUT
	.settings/tile PEK2 #0004 ADD2 GET .settings/tile PEK2 #0005 ADD2 PUT
	.settings/tile PEK2 #0003 ADD2 GET .settings/tile PEK2 #0004 ADD2 PUT
	.settings/tile PEK2 #0002 ADD2 GET .settings/tile PEK2 #0003 ADD2 PUT
	.settings/tile PEK2 #0001 ADD2 GET .settings/tile PEK2 #0002 ADD2 PUT
	.settings/tile PEK2 GET .settings/tile PEK2 #0001 ADD2 PUT
	.settings/tile PEK2 PUT
	.settings/tile PEK2 #0007 ADD2 LDA
	.settings/tile PEK2 #0006 ADD2 LDA .settings/tile PEK2 #0007 ADD2 STA
	.settings/tile PEK2 #0005 ADD2 LDA .settings/tile PEK2 #0006 ADD2 STA
	.settings/tile PEK2 #0004 ADD2 LDA .settings/tile PEK2 #0005 ADD2 STA
	.settings/tile PEK2 #0003 ADD2 LDA .settings/tile PEK2 #0004 ADD2 STA
	.settings/tile PEK2 #0002 ADD2 LDA .settings/tile PEK2 #0003 ADD2 STA
	.settings/tile PEK2 #0001 ADD2 LDA .settings/tile PEK2 #0002 ADD2 STA
	.settings/tile PEK2 LDA .settings/tile PEK2 #0001 ADD2 STA
	.settings/tile PEK2 STA

RTN



@@ 529,7 529,7 @@ RTN
		&hor
			( get bit )
			;blank_icn #00
			.settings/tile PEK2 #00 .pt/y PEK ADD2 GET #07 .pt/x PEK SUB SFT #01 AND ( get bit )
			.settings/tile PEK2 #00 .pt/y PEK ADD2 LDA #07 .pt/x PEK SUB SFT #01 AND ( get bit )
			8* ADD2 .Screen/addr DEO2 ( add *8 )
			( draw ) #21 .Screen/color DEO
			( incr ) .Screen/x DEI2 8+ .Screen/x DEO2


@@ 575,7 575,7 @@ RTN
	#00 .i POK
	&bytes
		.tileview/x PEK2 #0088 ADD2 .Screen/x DEO2
		.settings/tile PEK2 #00 .i PEK ADD2 GET #22 ;draw-byte JSR2
		.settings/tile PEK2 #00 .i PEK ADD2 LDA #22 ;draw-byte JSR2
		( incr ) .i PEK #01 ADD .i POK
		( incr ) .Screen/y DEI2 8+ .Screen/y DEO2
	.i PEK #08 LTH ;&bytes JNZ2


@@ 684,16 684,16 @@ RTN
@draw-short ( short -- )

	.addr POK2
	;font_hex #00 ;addr GET #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
	;font_hex #00 ;addr LDA #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
	( draw ) #22 .Screen/color DEO
	.Screen/x DEI2 8+ .Screen/x DEO2
	;font_hex #00 ;addr GET #0f AND #08 MUL ADD2 .Screen/addr DEO2
	;font_hex #00 ;addr LDA #0f AND #08 MUL ADD2 .Screen/addr DEO2
	( draw ) #22 .Screen/color DEO
	.Screen/x DEI2 8+ .Screen/x DEO2
	;font_hex #00 ;addr ++ GET #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
	;font_hex #00 ;addr ++ LDA #f0 AND #04 SFT #08 MUL ADD2 .Screen/addr DEO2
	( draw ) #22 .Screen/color DEO
	.Screen/x DEI2 8+ .Screen/x DEO2
	;font_hex #00 ;addr ++ GET #0f AND #08 MUL ADD2 .Screen/addr DEO2
	;font_hex #00 ;addr ++ LDA #0f AND #08 MUL ADD2 .Screen/addr DEO2
	( draw ) #22 .Screen/color DEO

RTN

M projects/software/neralie.usm => projects/software/neralie.usm +3 -3
@@ 127,9 127,9 @@
	DUP2 ;&h JSR2
	;&next JSR2 #0001 .Screen/x DEO2 .neralie/y PEK2 #0003 SUB2 .Screen/y DEO2 ,digit JSR
	DUP2 ;&v JSR2
	#04 ;v/spacing PUT
	#04 ;v/spacing STA
	.lines/y1 PEK2 #0003 SUB2 .neralie/y PEK2 .neralie/x PEK2 ;v JSR2
	#01 ;v/spacing PUT
	#01 ;v/spacing STA
	,&next JSR #0001 .Screen/y DEO2 .neralie/x PEK2 #0003 SUB2 .Screen/x DEO2 ;digit JSR2
	DUP2 ,&h JSR
	,&next JSR .Screen/width DEI2 #0009 SUB2 .Screen/x DEO2 .neralie/y PEK2 #0003 SUB2 .Screen/y DEO2 ;digit JSR2


@@ 226,7 226,7 @@
		can end up overflowing into bit 24.
	)
	
	;mul/bhi PUT2 ;mul/ahi PUT2
	;mul/bhi STA2 ;mul/ahi STA2
	#00
		#00
			#00 .mul/alo PEK #00 .mul/blo PEK MUL2

M projects/software/noodle.usm => projects/software/noodle.usm +15 -15
@@ 301,15 301,15 @@ BRK
		.Controller/key DEI #08 NEQ ,&no-edit-backspace JNZ
			.path/length PEK #00 EQU ,&edit-end JNZ
			.path/length PEK #01 SUB .path/length POK
			#00 ;path/name #00 .path/length PEK ADD2 PUT
			#00 ;path/name #00 .path/length PEK ADD2 STA
			BRK
			&no-edit-backspace
		( default )
		.path/length PEK #1f EQU ,&edit-end JNZ
			.Controller/key DEI ;path/name #00 .path/length PEK ADD2 PUT
			.Controller/key DEI ;path/name #00 .path/length PEK ADD2 STA
			.path/length PEK #01 ADD .path/length POK
		&edit-end
		#00 ;path/name #00 .path/length PEK ADD2 PUT
		#00 ;path/name #00 .path/length PEK ADD2 STA
		BRK
	&no-edit
	


@@ 375,7 375,7 @@ RTN
	
	;data FILESIZE ;data ADD2
	&loop
		( write ) OVR2 #00 ROT ROT PUT
		( write ) OVR2 #00 ROT ROT STA
		( incr ) SWP2 #0001 ADD2 SWP2
		OVR2 OVR2 LTH2 ,&loop JNZ
	POP2 POP2


@@ 498,7 498,7 @@ RTN
		#00 .px/x POK
		&hor
			( addr ) ;size_icns #00 .brush/size PEK 8* ADD2
			( byte ) #00 .px/y PEK ADD2 GET #07 .px/x PEK SUB SFT #01 AND
			( byte ) #00 .px/y PEK ADD2 LDA #07 .px/x PEK SUB SFT #01 AND
			#00 EQU ,&no-pixel JNZ
			;patternize JSR2 #00 EQU ,&no-pixel JNZ
				.pt0/x PEK2 #00 .px/x PEK ADD2 .pt0/y PEK2 #00 .px/y PEK ADD2 .brush/oper PEK2 JSR2 &no-pixel


@@ 557,7 557,7 @@ RTN
	SWP POP #07 AND .px/x POK
	( get tile ) .pt1/x PEK2 8/ .pt1/y PEK2 8/ .canvas/w PEK2 MUL2 ADD2 8*
	( add addr ) ;data ADD2
	#00 .px/y PEK ADD2 GET #07 .px/x PEK SUB SFT #01 AND
	#00 .px/y PEK ADD2 LDA #07 .px/x PEK SUB SFT #01 AND

RTN



@@ 565,9 565,9 @@ RTN

	.pt1/y POK2 .pt1/x POK2
	( get tile addr ) ;data .pt1/x PEK2 8/ .pt1/y PEK2 8/ .canvas/w PEK2 MUL2 ADD2 8* .pt1/y PEK2 MOD8 ADD2 ADD2
	( load ) DUP2 GET
	( load ) DUP2 LDA
	( mask ) #01 #07 .pt1/x PEK2 MOD8 SWP POP SUB SFL ORA
	( save ) ROT ROT PUT
	( save ) ROT ROT STA

RTN



@@ 575,9 575,9 @@ RTN

	.pt1/y POK2 .pt1/x POK2
	( get tile addr ) ;data .pt1/x PEK2 8/ .pt1/y PEK2 8/ .canvas/w PEK2 MUL2 ADD2 8* .pt1/y PEK2 MOD8 ADD2 ADD2
	( load ) DUP2 GET
	( load ) DUP2 LDA
	( mask ) #01 #07 .pt1/x PEK2 MOD8 SWP POP SUB SFL #ff EOR AND
	( save ) ROT ROT PUT
	( save ) ROT ROT STA

RTN



@@ 852,11 852,11 @@ RTN
	
	.color POK
	&loop
		DUP2 GET #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
		DUP2 LDA #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
		( draw ) .color PEK #20 ADD .Screen/color DEO
		( incr ) #0001 ADD2
		( incr ) .Screen/x DEI2 8+ .Screen/x DEO2
		( loop ) DUP2 GET #00 NEQ ,&loop JNZ
		( loop ) DUP2 LDA #00 NEQ ,&loop JNZ
	POP2

RTN


@@ 886,11 886,11 @@ RTN
@strcpy ( src* dst* -- )

	&loop
		( copy src->dst ) OVR2 OVR2 SWP2 GET ROT ROT PUT
		( copy src->dst ) OVR2 OVR2 SWP2 LDA ROT ROT STA
		( incr dst ) ++
		( incr src ) SWP2 ++ SWP2
		OVR2 GET #00 NEQ ,&loop JNZ
	#00 ROT ROT PUT POP2
		OVR2 LDA #00 NEQ ,&loop JNZ
	#00 ROT ROT STA POP2
	
RTN


M projects/software/orca.usm => projects/software/orca.usm +32 -32
@@ 21,20 21,20 @@
%DATA-LOCKS { #3000 }
%DATA-TYPES { #4000 }

%GET-CHAR { #24 MOD #00 SWP ;b36clc ADD2 GET } ( b36 -- char )
%GET-VALUE { #20 SUB #00 SWP ;values ADD2 GET } ( char -- b36 )

%GET-INDEX { #00 SWP #00 .grid/width PEK MUL2 ROT #00 SWP ADD2 } ( x y -- index )
%GET-CELL { GET-INDEX DATA-CELLS ADD2 GET } ( x y -- char )
%SET-CELL { ROT ROT GET-INDEX DATA-CELLS ADD2 PUT } ( x y char -- )
%GET-TYPE { GET-INDEX DATA-TYPES ADD2 GET } ( x y -- type )
%SET-TYPE { ROT ROT GET-INDEX DATA-TYPES ADD2 PUT } ( x y type -- )
%GET-LOCK { GET-INDEX DATA-TYPES ADD2 GET } ( x y -- type )
%SET-LOCK { ROT ROT GET-INDEX DATA-TYPES ADD2 PUT } ( x y type -- )
%GET-PORT { } ( x y lock -- char )
%LDA-CHAR { #24 MOD #00 SWP ;b36clc ADD2 LDA } ( b36 -- char )
%LDA-VALUE { #20 SUB #00 SWP ;values ADD2 LDA } ( char -- b36 )

%LDA-INDEX { #00 SWP #00 .grid/width PEK MUL2 ROT #00 SWP ADD2 } ( x y -- index )
%LDA-CELL { LDA-INDEX DATA-CELLS ADD2 LDA } ( x y -- char )
%SET-CELL { ROT ROT LDA-INDEX DATA-CELLS ADD2 STA } ( x y char -- )
%LDA-TYPE { LDA-INDEX DATA-TYPES ADD2 LDA } ( x y -- type )
%SET-TYPE { ROT ROT LDA-INDEX DATA-TYPES ADD2 STA } ( x y type -- )
%LDA-LOCK { LDA-INDEX DATA-TYPES ADD2 LDA } ( x y -- type )
%SET-LOCK { ROT ROT LDA-INDEX DATA-TYPES ADD2 STA } ( x y type -- )
%LDA-PORT { } ( x y lock -- char )
%SET-PORT { } ( x y char -- )

%GET-CELL-VALUE { GET-CELL GET-VALUE } ( x y -- b36 )
%LDA-CELL-VALUE { LDA-CELL LDA-VALUE } ( x y -- b36 )

( devices )



@@ 183,14 183,14 @@ RTN
		DUP2 #01 SET-LOCK
	$no-lock
	STH DUP2 #02 #02 STHr MUL ADD ,set-type JSR2
	GET-CELL
	LDA-CELL
	)

RTN

@get-cell-sprite ( x y -- addr )
	
	DUP2 GET-CELL
	DUP2 LDA-CELL
	( if character is dot )
	DUP #2e NEQ ,&no-bar JNZ
		( check if x,y is grid )


@@ 209,11 209,11 @@ RTN
@op-a ( x y char -- )

	POP
	( get left ) DUP2 SWP -- SWP GET-CELL-VALUE STH
	( get right ) DUP2 SWP ++ SWP GET-CELL-VALUE STH
	( get left ) DUP2 SWP -- SWP LDA-CELL-VALUE STH
	( get right ) DUP2 SWP ++ SWP LDA-CELL-VALUE STH
	( incr y ) ++
	( get result ) ADDr STHr
	GET-CHAR
	LDA-CHAR
	SET-CELL

RTN


@@ 221,11 221,11 @@ RTN
@op-b ( x y char -- )
	
	POP
	( get left ) DUP2 SWP -- SWP GET-CELL-VALUE STH
	( get right ) DUP2 SWP ++ SWP GET-CELL-VALUE STH
	( get left ) DUP2 SWP -- SWP LDA-CELL-VALUE STH
	( get right ) DUP2 SWP ++ SWP LDA-CELL-VALUE STH
	( incr y ) ++
	( get result ) SUBr STHr
	GET-CHAR
	LDA-CHAR
	SET-CELL

	( NOTE: Issue is not with modulo, but with converting ff to 36 )


@@ 308,7 308,7 @@ RTN
		#2a SET-CELL POP STHr RTN
	&not-edge
	( collide )
	DUP2 -- GET-CELL #2e EQU ,&not-collide JNZ
	DUP2 -- LDA-CELL #2e EQU ,&not-collide JNZ
		#2a SET-CELL POP STHr RTN
	&not-collide
	( move )


@@ 377,7 377,7 @@ RTN
		#2a SET-CELL POP STHr RTN
	&not-edge
	( collide )
	DUP2 SWP -- SWP GET-CELL #2e EQU ,&not-collide JNZ
	DUP2 SWP -- SWP LDA-CELL #2e EQU ,&not-collide JNZ
		#2a SET-CELL POP STHr RTN
	&not-collide
	( move )


@@ 420,7 420,7 @@ RTN
	&not-dot

	( skip locked )
	ROT ROT DUP2 GET-LOCK #00 EQU ,&not-locked JNZ
	ROT ROT DUP2 LDA-LOCK #00 EQU ,&not-locked JNZ
		POP POP2 RTN
	&not-locked
	ROT


@@ 469,7 469,7 @@ RTN
		#00 .grid/width PEK
		&hor
			( get x,y ) SWP2 OVR STH SWP2 OVR STHr
			DUP2 GET-CELL ;run-char JSR2
			DUP2 LDA-CELL ;run-char JSR2
			( incr ) SWP ++ SWP
			DUP2 LTH ,&hor JNZ
		POP2


@@ 487,19 487,19 @@ RTN
	( Positionx )
	#0000 .Screen/x DEO2
	.selection/x1 PEK
		DUP #04 SFT GET-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
	#22 .Screen/color DEO
	#0008 .Screen/x DEO2
		#0f AND GET-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
		#0f AND LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
	#22 .Screen/color DEO

	( Positiony )
	#0010 .Screen/x DEO2
	.selection/y1 PEK
		DUP #04 SFT GET-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
	#22 .Screen/color DEO
	#0018 .Screen/x DEO2
		#0f AND GET-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
		#0f AND LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
	#22 .Screen/color DEO

	#0020 .Screen/x DEO2


@@ 509,10 509,10 @@ RTN
	( Frame )
	#0030 .Screen/x DEO2
	.timer/frame PEK
		DUP #04 SFT GET-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
	#22 .Screen/color DEO
	#0038 .Screen/x DEO2
		#0f AND GET-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
		#0f AND LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
	#22 .Screen/color DEO

	#0040 .Screen/x DEO2


@@ 522,10 522,10 @@ RTN
	( Speed )
	#0050 .Screen/x DEO2
	.timer/speed PEK
		DUP #04 SFT GET-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
		DUP #04 SFT LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
	#22 .Screen/color DEO
	#0058 .Screen/x DEO2
		#0f AND GET-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
		#0f AND LDA-CHAR #20 SUB #00 SWP #0008 MUL2 ;font ADD2 .Screen/addr DEO2
	#22 .Screen/color DEO

	( TODO: Signal VU )

D projects/sounds/sin.pcm => projects/sounds/sin.pcm +0 -0
D projects/sounds/sqr.pcm => projects/sounds/sqr.pcm +0 -1
@@ 1,1 0,0 @@
��������������������������������������������������������������������������������������������������������������������������������
\ No newline at end of file

D projects/sounds/tri.pcm => projects/sounds/tri.pcm +0 -0
M src/assembler.c => src/assembler.c +1 -1
@@ 42,7 42,7 @@ Program p;
char ops[][4] = {
	"BRK", "LIT", "NOP", "POP", "DUP", "SWP", "OVR", "ROT",
	"EQU", "NEQ", "GTH", "LTH", "JMP", "JNZ", "JSR", "STH",
	"PEK", "POK", "GET", "PUT", "---", "---", "DEI", "DEO",
	"PEK", "POK", "LDR", "STR", "LDA", "STA", "DEI", "DEO",
	"ADD", "SUB", "MUL", "DIV", "AND", "ORA", "EOR", "SFT"
};


M src/uxn.c => src/uxn.c +12 -8
@@ 45,14 45,16 @@ void op_neq(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b 
void op_gth(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b > a); }
void op_lth(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); push8(u->src, b < a); }
void op_jmp(Uxn *u) { Uint8 a = pop8(u->src); u->ram.ptr += (Sint8)a; }
void op_jnz(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); if (b) u->ram.ptr += (Sint8)a; }
void op_jnz(Uxn *u) { Uint8 a = pop8(u->src); if (pop8(u->src)) u->ram.ptr += (Sint8)a; }
void op_jsr(Uxn *u) { Uint8 a = pop8(u->src); push16(u->dst, u->ram.ptr); u->ram.ptr += (Sint8)a; }
void op_sth(Uxn *u) { Uint8 a = pop8(u->src); push8(u->dst, a); }
/* Memory */
void op_pek(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, mempeek8(u->ram.dat, a)); }
void op_pok(Uxn *u) { Uint8 a = pop8(u->src); Uint8 b = pop8(u->src); mempoke8(u->ram.dat, a, b); }
void op_get(Uxn *u) { Uint16 a = pop16(u->src); push8(u->src, mempeek8(u->ram.dat, a)); }
void op_put(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); mempoke8(u->ram.dat, a, b); }
void op_ldr(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, mempeek8(u->ram.dat, u->ram.ptr + (Sint8)a)); }
void op_str(Uxn *u) { Uint8 a = pop8(u->src); Uint8 b = pop8(u->src); mempoke8(u->ram.dat, u->ram.ptr + (Sint8)a, b); }
void op_lda(Uxn *u) { Uint16 a = pop16(u->src); push8(u->src, mempeek8(u->ram.dat, a)); }
void op_sta(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); mempoke8(u->ram.dat, a, b); }
void op_dei(Uxn *u) { Uint8 a = pop8(u->src); push8(u->src, devpeek8(&u->dev[a >> 4], a)); }
void op_deo(Uxn *u) { Uint8 a = pop8(u->src), b = pop8(u->src); devpoke8(&u->dev[a >> 4], a, b); }
/* Arithmetic */


@@ 77,14 79,16 @@ void op_neq16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->sr
void op_gth16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, b > a); }
void op_lth16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push8(u->src, b < a); }
void op_jmp16(Uxn *u) { u->ram.ptr = pop16(u->src); }
void op_jnz16(Uxn *u) { Uint16 a = pop16(u->src); Uint8 b = pop8(u->src); if (b) u->ram.ptr = a; }
void op_jnz16(Uxn *u) { Uint16 a = pop16(u->src); if (pop8(u->src)) u->ram.ptr = a; }
void op_jsr16(Uxn *u) { push16(u->dst, u->ram.ptr); u->ram.ptr = pop16(u->src); }
void op_sth16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->dst, a); }
/* Memory(16-bits) */
void op_pek16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, mempeek16(u->ram.dat, a)); }
void op_pok16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, a, b); }
void op_get16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, mempeek16(u->ram.dat, a)); }
void op_put16(Uxn *u) { Uint16 a = pop16(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, a, b); }
void op_ldr16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, mempeek16(u->ram.dat, u->ram.ptr + (Sint8)a)); }
void op_str16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, u->ram.ptr + (Sint8)a, b); }
void op_lda16(Uxn *u) { Uint16 a = pop16(u->src); push16(u->src, mempeek16(u->ram.dat, a)); }
void op_sta16(Uxn *u) { Uint16 a = pop16(u->src); Uint16 b = pop16(u->src); mempoke16(u->ram.dat, a, b); }
void op_dei16(Uxn *u) { Uint8 a = pop8(u->src); push16(u->src, devpeek16(&u->dev[a >> 4], a)); }
void op_deo16(Uxn *u) { Uint8 a = pop8(u->src); Uint16 b = pop16(u->src); devpoke16(&u->dev[a >> 4], a, b); }
/* Arithmetic(16-bits) */


@@ 100,12 104,12 @@ void op_sft16(Uxn *u) { Uint16 a = pop16(u->src), b = pop16(u->src); push16(u->s
void (*ops[])(Uxn *u) = {
	op_brk, op_lit, op_nop, op_pop, op_dup, op_swp, op_ovr, op_rot,
	op_equ, op_neq, op_gth, op_lth, op_jmp, op_jnz, op_jsr, op_sth, 
	op_pek, op_pok, op_get, op_put, op_nop, op_nop, op_dei, op_deo,
	op_pek, op_pok, op_ldr, op_str, op_lda, op_sta, op_dei, op_deo,
	op_add, op_sub, op_mul, op_div, op_and, op_ora, op_eor, op_sft,
	/* 16-bit */
	op_brk,   op_lit16, op_nop,   op_pop16, op_dup16, op_swp16, op_ovr16, op_rot16,
	op_equ16, op_neq16, op_gth16, op_lth16, op_jmp16, op_jnz16, op_jsr16, op_sth16, 
	op_pek16, op_pok16, op_get16, op_put16, op_nop,   op_nop,   op_dei16, op_deo16, 
	op_pek16, op_pok16, op_ldr16, op_str16, op_lda16, op_sta16, op_dei16, op_deo16, 
	op_add16, op_sub16, op_mul16, op_div16, op_and16, op_ora16, op_eor16, op_sft16
};