Browse code

Merged sprite in screen device

neauoire authored on 09/04/2021 17:01:53
Showing 18 changed files
... ...
@@ -32,7 +32,7 @@ else
32 32
 fi
33 33
 
34 34
 echo "Assembling.."
35
-./bin/assembler projects/software/noodle.usm bin/boot.rom
35
+./bin/assembler projects/examples/gui.shapes.usm bin/boot.rom
36 36
 
37 37
 echo "Running.."
38 38
 if [ "${2}" = '--cli' ]; 
... ...
@@ -28,8 +28,7 @@
28 28
 
29 29
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
30 30
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
31
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
32
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
31
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
33 32
 |0140 ;Controller { vector 2 button 1 }
34 33
 |0150 ;Keys { vector 2 key 1 }
35 34
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
... ...
@@ -223,14 +222,14 @@ RTN
223 222
 @move-head ( -- )
224 223
 
225 224
 	( clear )
226
-	~trkframe.y1 8- =Sprite.y
227
-	~trkframe.x1 #00 ~head.pos ADD2 =Sprite.x
228
-	,head_icn =Sprite.addr
229
-	#00 =Sprite.color
225
+	~trkframe.y1 8- =Screen.y
226
+	~trkframe.x1 #00 ~head.pos ADD2 =Screen.x
227
+	,head_icn =Screen.addr
228
+	#20 =Screen.color
230 229
 	( incr ) ~head.pos #01 ADD =head.pos
231
-	~trkframe.x1 #00 ~head.pos ADD2 =Sprite.x
232
-	,head_icn =Sprite.addr 
233
-	#01 ( if note ) TRACK #00 ~head.pos #08 DIV ADD2 PEK2 #00 NEQ ADD =Sprite.color
230
+	~trkframe.x1 #00 ~head.pos ADD2 =Screen.x
231
+	,head_icn =Screen.addr 
232
+	#21 ( if note ) TRACK #00 ~head.pos #08 DIV ADD2 PEK2 #00 NEQ ADD =Screen.color
234 233
 
235 234
 RTN
236 235
 
... ...
@@ -239,10 +238,10 @@ RTN
239 238
 	#00 #20
240 239
 	$loop
241 240
 		( load ) OVR #00 SWP TRACK ADD2 PEK2
242
-		DUP STH #00 SWP #0e SWP SUB 8* ~trkframe.y1 ADD2 =Sprite.y
243
-		OVR #00 SWP 8* ~trkframe.x1 ADD2 =Sprite.x
241
+		DUP STH #00 SWP #0e SWP SUB 8* ~trkframe.y1 ADD2 =Screen.y
242
+		OVR #00 SWP 8* ~trkframe.x1 ADD2 =Screen.x
244 243
 		STHr #00 EQU ^$skip JNZ
245
-			#00 =Sprite.color
244
+			#20 =Screen.color
246 245
 		$skip
247 246
 		( incr ) SWP #01 ADD SWP
248 247
 		DUP2 LTH ^$loop JNZ
... ...
@@ -255,11 +254,11 @@ RTN
255 254
 	#00 #20
256 255
 	$notes-loop
257 256
 		( load ) OVR #00 SWP TRACK ADD2 PEK2
258
-		DUP STH #00 SWP #0e SWP SUB 8* ~trkframe.y1 ADD2 =Sprite.y
259
-		OVR #00 SWP 8* ~trkframe.x1 ADD2 =Sprite.x
260
-		,note_icn =Sprite.addr
257
+		DUP STH #00 SWP #0e SWP SUB 8* ~trkframe.y1 ADD2 =Screen.y
258
+		OVR #00 SWP 8* ~trkframe.x1 ADD2 =Screen.x
259
+		,note_icn =Screen.addr
261 260
 		STHr #00 EQU ^$skip JNZ
262
-			#05 =Sprite.color
261
+			#25 =Screen.color
263 262
 		$skip
264 263
 		( incr ) SWP #01 ADD SWP
265 264
 		DUP2 LTH ^$notes-loop JNZ
... ...
@@ -273,14 +272,14 @@ RTN
273 272
 	~trkframe.x1 ~trkframe.y1 ~trkframe.x2 ~trkframe.y2 #01 ,line-rect JSR2
274 273
 
275 274
 	( grid )
276
-	~trkframe.y1 #0010 SUB2 =Sprite.y
277
-	,font_hex =Sprite.addr
275
+	~trkframe.y1 #0010 SUB2 =Screen.y
276
+	,font_hex =Screen.addr
278 277
 	#0000 #0100 
279 278
 	$loop 
280 279
 		OVR2 SWP POP #02 DIV #0f AND #00 NEQ ^$skip JNZ
281
-			OVR2 ~trkframe.x1 ADD2 =Sprite.x
282
-			#02 =Sprite.color
283
-			~Sprite.addr 8+ =Sprite.addr
280
+			OVR2 ~trkframe.x1 ADD2 =Screen.x
281
+			#22 =Screen.color
282
+			~Screen.addr 8+ =Screen.addr
284 283
 			OVR2 ~trkframe.x1 ADD2 ~trkframe.y1 ++ ~trkframe.y2 #01 ,line-vertical-dotted JSR2
285 284
 		$skip
286 285
 		OVR2 ~trkframe.x1 ADD2 ~trkframe.y1 ~trkframe.y2 #01 ,line-vertical-dotted JSR2
... ...
@@ -295,18 +294,18 @@ RTN
295 294
 
296 295
 @draw-octave ( x y -- )
297 296
 
298
-	=Sprite.y
299
-	=Sprite.x
300
-	,octave_icn =Sprite.addr
301
-	~Sprite.y ~Sprite.y #0038 ADD2
297
+	=Screen.y
298
+	=Screen.x
299
+	,octave_icn =Screen.addr
300
+	~Screen.y ~Screen.y #0038 ADD2
302 301
 	$loop
303
-		OVR2 =Sprite.y
304
-		#01 =Sprite.color
305
-		~Sprite.addr 8+ =Sprite.addr
306
-		~Sprite.x 8+ =Sprite.x
307
-		#01 =Sprite.color
308
-		~Sprite.addr 8+ =Sprite.addr
309
-		~Sprite.x 8- =Sprite.x
302
+		OVR2 =Screen.y
303
+		#21 =Screen.color
304
+		~Screen.addr 8+ =Screen.addr
305
+		~Screen.x 8+ =Screen.x
306
+		#21 =Screen.color
307
+		~Screen.addr 8+ =Screen.addr
308
+		~Screen.x 8- =Screen.x
310 309
 		SWP2 8+ SWP2
311 310
 		OVR2 OVR2 LTH2 ^$loop JNZ
312 311
 	POP2
... ...
@@ -318,20 +317,20 @@ RTN
318 317
 	
319 318
 	~trkframe.x1 #0018 SUB2 DUP2 ~trkframe.y1 ,draw-octave JSR2
320 319
 	~trkframe.y1 #0038 ADD2 ,draw-octave JSR2
321
-	~trkframe.x1 #0028 SUB2 =Sprite.x
322
-	~trkframe.y1 #0030 ADD2 =Sprite.y
323
-	,font_hex #0028 ADD2 =Sprite.addr
324
-	#03 =Sprite.color 
325
-	~trkframe.x1 #0030 SUB2 =Sprite.x
326
-	,font_hex #0060 ADD2 =Sprite.addr
327
-	#03 =Sprite.color 
328
-	~trkframe.x1 #0028 SUB2 =Sprite.x
329
-	~trkframe.y1 #0068 ADD2 =Sprite.y
330
-	,font_hex #0020 ADD2 =Sprite.addr
331
-	#03 =Sprite.color 
332
-	~trkframe.x1 #0030 SUB2 =Sprite.x
333
-	,font_hex #0060 ADD2 =Sprite.addr
334
-	#03 =Sprite.color 
320
+	~trkframe.x1 #0028 SUB2 =Screen.x
321
+	~trkframe.y1 #0030 ADD2 =Screen.y
322
+	,font_hex #0028 ADD2 =Screen.addr
323
+	#23 =Screen.color 
324
+	~trkframe.x1 #0030 SUB2 =Screen.x
325
+	,font_hex #0060 ADD2 =Screen.addr
326
+	#23 =Screen.color 
327
+	~trkframe.x1 #0028 SUB2 =Screen.x
328
+	~trkframe.y1 #0068 ADD2 =Screen.y
329
+	,font_hex #0020 ADD2 =Screen.addr
330
+	#23 =Screen.color 
331
+	~trkframe.x1 #0030 SUB2 =Screen.x
332
+	,font_hex #0060 ADD2 =Screen.addr
333
+	#23 =Screen.color 
335 334
 
336 335
 RTN
337 336
 
... ...
@@ -345,19 +344,19 @@ RTN
345 344
 @draw-knob ( x* y* value -- )
346 345
 	
347 346
 	( load ) =knob.value =knob.y =knob.x
348
-	~knob.x =Sprite.x
349
-	~knob.y =Sprite.y ,knob_icns =Sprite.addr #01 =Sprite.color 
350
-	~knob.x 8+ =Sprite.x ,knob_icns 8+ =Sprite.addr #01 =Sprite.color 
351
-	~knob.y 8+ =Sprite.y ,knob_icns #0018 ADD2 =Sprite.addr #01 =Sprite.color 
352
-	~knob.x =Sprite.x ,knob_icns #0010 ADD2 =Sprite.addr #01 =Sprite.color 
353
-	~knob.x #00 #00 ~knob.value ,knob_offsetx ADD2 PEK2 ADD2 =Sprite.x
354
-	~knob.y #00 #00 ~knob.value ,knob_offsety ADD2 PEK2 ADD2 =Sprite.y
355
-	,knob_icns #0020 ADD2 =Sprite.addr
356
-	#05 =Sprite.color 
357
-	~knob.x #0004 ADD2 =Sprite.x
358
-	~knob.y #0010 ADD2 =Sprite.y
359
-	,font_hex #00 ~knob.value #08 MUL ADD2 =Sprite.addr
360
-	#01 =Sprite.color 
347
+	~knob.x =Screen.x
348
+	~knob.y =Screen.y ,knob_icns =Screen.addr #21 =Screen.color 
349
+	~knob.x 8+ =Screen.x ,knob_icns 8+ =Screen.addr #21 =Screen.color 
350
+	~knob.y 8+ =Screen.y ,knob_icns #0018 ADD2 =Screen.addr #21 =Screen.color 
351
+	~knob.x =Screen.x ,knob_icns #0010 ADD2 =Screen.addr #21 =Screen.color 
352
+	~knob.x #00 #00 ~knob.value ,knob_offsetx ADD2 PEK2 ADD2 =Screen.x
353
+	~knob.y #00 #00 ~knob.value ,knob_offsety ADD2 PEK2 ADD2 =Screen.y
354
+	,knob_icns #0020 ADD2 =Screen.addr
355
+	#25 =Screen.color 
356
+	~knob.x #0004 ADD2 =Screen.x
357
+	~knob.y #0010 ADD2 =Screen.y
358
+	,font_hex #00 ~knob.value #08 MUL ADD2 =Screen.addr
359
+	#21 =Screen.color 
361 360
 
362 361
 RTN
363 362
 
... ...
@@ -365,7 +364,7 @@ RTN
365 364
 	
366 365
 	~ctlframe.x1 ~ctlframe.y1 ~ctlframe.x2 ~ctlframe.y2 #01 ,line-rect JSR2
367 366
 	( env )
368
-	~ctlframe.x1 8+ ~ctlframe.y1 8+ #02 ,env_txt ,draw-label JSR2
367
+	~ctlframe.x1 8+ ~ctlframe.y1 8+ #22 ,env_txt ,draw-label JSR2
369 368
 	~ctlframe.x1 8+ ~ctlframe.y1 #0010 ADD2 
370 369
 		,adsr #00 ~track.active #04 MUL ADD2 PEK2 #04 SFT
371 370
 		,draw-knob JSR2
... ...
@@ -379,7 +378,7 @@ RTN
379 378
 		,adsr #00 ~track.active #04 MUL ADD2 #0003 ADD2 PEK2 #04 SFT
380 379
 		,draw-knob JSR2
381 380
 	( vol )
382
-	~ctlframe.x1 #0058 ADD2 ~ctlframe.y1 8+ #02 ,vol_txt ,draw-label JSR2
381
+	~ctlframe.x1 #0058 ADD2 ~ctlframe.y1 8+ #22 ,vol_txt ,draw-label JSR2
383 382
 	~ctlframe.x1 #0058 ADD2 ~ctlframe.y1 #0010 ADD2
384 383
 		,volume #00 ~track.active ADD2 PEK2 #04 SFT
385 384
 	,draw-knob JSR2
... ...
@@ -392,27 +391,27 @@ RTN
392 391
 @draw-channels
393 392
 	
394 393
 	~chnframe.x1 ~chnframe.y1 ~chnframe.x2 ~chnframe.y2 #01 ,line-rect JSR2
395
-	~chnframe.x1 8+ ~chnframe.y1 8+ #01 ~track.active #00 EQU #07 MUL ADD ,ch1_txt ,draw-label JSR2
396
-	~chnframe.x1 8+ ~chnframe.y1 #0010 ADD2 #01 ~track.active #01 EQU #07 MUL ADD ,ch2_txt ,draw-label JSR2
397
-	~chnframe.x1 8+ ~chnframe.y1 #0018 ADD2 #01 ~track.active #02 EQU #07 MUL ADD ,ch3_txt ,draw-label JSR2
398
-	~chnframe.x1 8+ ~chnframe.y1 #0020 ADD2 #01 ~track.active #03 EQU #07 MUL ADD ,ch4_txt ,draw-label JSR2
394
+	~chnframe.x1 8+ ~chnframe.y1 8+ #21 ~track.active #00 EQU #07 MUL ADD ,ch1_txt ,draw-label JSR2
395
+	~chnframe.x1 8+ ~chnframe.y1 #0010 ADD2 #21 ~track.active #01 EQU #07 MUL ADD ,ch2_txt ,draw-label JSR2
396
+	~chnframe.x1 8+ ~chnframe.y1 #0018 ADD2 #21 ~track.active #02 EQU #07 MUL ADD ,ch3_txt ,draw-label JSR2
397
+	~chnframe.x1 8+ ~chnframe.y1 #0020 ADD2 #21 ~track.active #03 EQU #07 MUL ADD ,ch4_txt ,draw-label JSR2
399 398
 
400 399
 RTN
401 400
 
402 401
 @draw-cursor ( -- )
403 402
 
404 403
 	( clear last cursor )
405
-	,clear_icn =Sprite.addr 
406
-	~pointer.x =Sprite.x 
407
-	~pointer.y =Sprite.y 
408
-	#10 =Sprite.color
404
+	,clear_icn =Screen.addr 
405
+	~pointer.x =Screen.x 
406
+	~pointer.y =Screen.y 
407
+	#30 =Screen.color
409 408
 	( record pointer positions )
410 409
 	~Mouse.x =pointer.x ~Mouse.y =pointer.y
411 410
 	( draw new cursor )
412
-	,cursor_icn =Sprite.addr 
413
-	~pointer.x =Sprite.x 
414
-	~pointer.y =Sprite.y 
415
-	#12 ~Mouse.state #00 NEQ ADD =Sprite.color
411
+	,cursor_icn =Screen.addr 
412
+	~pointer.x =Screen.x 
413
+	~pointer.y =Screen.y 
414
+	#32 ~Mouse.state #00 NEQ ADD =Screen.color
416 415
 
417 416
 RTN
418 417
 
... ...
@@ -420,12 +419,12 @@ RTN
420 419
 
421 420
 @draw-label ( x y color addr -- )
422 421
 	
423
-	( load ) =label.addr =label.color =Sprite.y =Sprite.x 
422
+	( load ) =label.addr =label.color =Screen.y =Screen.x 
424 423
 	~label.addr
425 424
 	$loop
426
-		( draw ) DUP2 PEK2 #00 SWP 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color
425
+		( draw ) DUP2 PEK2 #00 SWP 8* ,font ADD2 =Screen.addr ~label.color =Screen.color
427 426
 		( incr ) ++
428
-		( incr ) ~Sprite.x 8+ =Sprite.x
427
+		( incr ) ~Screen.x 8+ =Screen.x
429 428
 		DUP2 PEK2 #00 NEQ ^$loop JNZ
430 429
 	POP2
431 430
 
... ...
@@ -11,8 +11,7 @@
11 11
 ( devices )
12 12
 
13 13
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
14
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
15
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
14
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
16 15
 |0140 ;Controller { vector 2 p1 1 }
17 16
 
18 17
 |0200
... ...
@@ -21,46 +20,46 @@
21 20
 	( vectors ) ,FRAME =Screen.vector
22 21
 	
23 22
 	( set origin )
24
-	~Screen.width 2/ =Sprite.x 
25
-	~Screen.height 2/ =Sprite.y
26
-	,default_icn =Sprite.addr
27
-	#11 =Sprite.color
28
-	#0a =slime
23
+	~Screen.width 2/ =Screen.x 
24
+	~Screen.height 2/ =Screen.y
25
+	,default_icn =Screen.addr
26
+	#31 =Screen.color
27
+	#2a =slime
29 28
 
30 29
 BRK
31 30
 
32 31
 @FRAME
33 32
 
34
-	#0a =slime
35
-	,default_icn =Sprite.addr
33
+	#2a =slime
34
+	,default_icn =Screen.addr
36 35
 
37 36
 	( hold ctrl key to change slime color )
38 37
 
39 38
 	~Controller.p1 #0f AND
40
-		DUP #01 NEQ ^$no-ctrl JNZ #05 =slime $no-ctrl
41
-		DUP #02 NEQ ^$no-alt JNZ #0f =slime $no-alt
39
+		DUP #01 NEQ ^$no-ctrl JNZ #25 =slime $no-ctrl
40
+		DUP #02 NEQ ^$no-alt JNZ #2f =slime $no-alt
42 41
 	POP
43 42
 
44
-	( clear ) #10 =Sprite.color
43
+	( clear ) #30 =Screen.color
45 44
 
46 45
 	( detect movement )
47 46
 	~Controller.p1 #f0 AND
48 47
 		DUP #04 SFT #01 AND #01 NEQ ^$no-up JNZ 
49
-			( move ) ~Sprite.y -- =Sprite.y ,up_icn =Sprite.addr $no-up
48
+			( move ) ~Screen.y -- =Screen.y ,up_icn =Screen.addr $no-up
50 49
 		DUP #05 SFT #01 AND #01 NEQ ^$no-down JNZ 
51
-			( move ) ~Sprite.y ++ =Sprite.y ,down_icn =Sprite.addr $no-down
50
+			( move ) ~Screen.y ++ =Screen.y ,down_icn =Screen.addr $no-down
52 51
 		DUP #06 SFT #01 AND #01 NEQ ^$no-left JNZ 
53
-			( move ) ~Sprite.x -- =Sprite.x ,left_icn =Sprite.addr $no-left
52
+			( move ) ~Screen.x -- =Screen.x ,left_icn =Screen.addr $no-left
54 53
 		DUP #07 SFT #01 AND #01 NEQ ^$no-right JNZ 
55
-			( move ) ~Sprite.x ++ =Sprite.x ,right_icn =Sprite.addr $no-right
54
+			( move ) ~Screen.x ++ =Screen.x ,right_icn =Screen.addr $no-right
56 55
 	POP
57 56
 
58 57
 	( draw face )
59
-	#11 =Sprite.color
58
+	#31 =Screen.color
60 59
 
61 60
 	( draw slime )
62
-	,slime_icn =Sprite.addr
63
-	~slime =Sprite.color
61
+	,slime_icn =Screen.addr
62
+	~slime =Screen.color
64 63
 
65 64
 BRK
66 65
 
... ...
@@ -5,7 +5,7 @@
5 5
 %8*  { #0030 SFT2 }
6 6
 
7 7
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
8
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
8
+|0120 ;Screen { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
9 9
 |0140 ;Controller { vector 2 button 1 }
10 10
 |0150 ;Keys { vector 2 key 1 }
11 11
 
... ...
@@ -22,10 +22,10 @@ BRK
22 22
 
23 23
 @KEY
24 24
 	
25
-	,cursor_icn =Sprite.addr
26
-	,font #00 ~Keys.key 8* ADD2 =Sprite.addr
27
-	( draw ) #01 =Sprite.color
28
-	~Sprite.x 8+ =Sprite.x
25
+	,cursor_icn =Screen.addr
26
+	,font #00 ~Keys.key 8* ADD2 =Screen.addr
27
+	( draw ) #21 =Screen.color
28
+	~Screen.x 8+ =Screen.x
29 29
 	( release ) #00 =Keys.key
30 30
 	,draw-cursor JSR2
31 31
 
... ...
@@ -35,9 +35,9 @@ BRK
35 35
 	
36 36
 	( enter key )
37 37
 	~Controller.button #08 NEQ ^$no-return JNZ 
38
-		#00 =Sprite.color
39
-		#0000 =Sprite.x
40
-		( incr ) ~Sprite.y 8+ =Sprite.y
38
+		#20 =Screen.color
39
+		#0000 =Screen.x
40
+		( incr ) ~Screen.y 8+ =Screen.y
41 41
 		( release ) #00 =Controller.button
42 42
 		,draw-cursor JSR2
43 43
 	$no-return
... ...
@@ -46,7 +46,7 @@ BRK
46 46
 
47 47
 @draw-cursor
48 48
 	
49
-	,cursor_icn =Sprite.addr #02 =Sprite.color
49
+	,cursor_icn =Screen.addr #22 =Screen.color
50 50
 
51 51
 RTN
52 52
 
... ...
@@ -9,8 +9,7 @@
9 9
 ;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
10 10
 
11 11
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
12
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
13
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
12
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
14 13
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
15 14
 
16 15
 ( program )
... ...
@@ -48,19 +47,19 @@ BRK
48 47
 @draw-cursor ( -- )
49 48
 
50 49
 	( clear last cursor )
51
-	,clear_icn =Sprite.addr 
52
-	~pointer.x =Sprite.x 
53
-	~pointer.y =Sprite.y 
54
-	#10 =Sprite.color
50
+	,clear_icn =Screen.addr 
51
+	~pointer.x =Screen.x 
52
+	~pointer.y =Screen.y 
53
+	#30 =Screen.color
55 54
 
56 55
 	( record pointer positions )
57 56
 	~Mouse.x =pointer.x ~Mouse.y =pointer.y
58 57
 
59 58
 	( draw new cursor )
60
-	,cursor_icn =Sprite.addr 
61
-	~pointer.x =Sprite.x 
62
-	~pointer.y =Sprite.y 
63
-	#11 ~Mouse.state #00 NEQ ADD =Sprite.color
59
+	,cursor_icn =Screen.addr 
60
+	~pointer.x =Screen.x 
61
+	~pointer.y =Screen.y 
62
+	#31 ~Mouse.state #00 NEQ ADD =Screen.color
64 63
 
65 64
 RTN
66 65
 
... ...
@@ -22,8 +22,7 @@
22 22
 }
23 23
 
24 24
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
25
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
26
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
25
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
27 26
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
28 27
 
29 28
 ( program )
... ...
@@ -130,11 +129,11 @@ RTN
130 129
 	POP2 POP2
131 130
 
132 131
 	( draw blending modes )
133
-	#0020 =Sprite.x #0020 =Sprite.y ,icon_icn =Sprite.addr
134
-	#00 #10
132
+	#0000 =Screen.x #0020 =Screen.y ,icon_icn =Screen.addr
133
+	#20 #30
135 134
 	$draw-blends
136
-		( move ) OVR #00 SWP #0008 MUL2 #0020 ADD2 =Sprite.x
137
-		( draw ) OVR =Sprite.color
135
+		( move ) OVR #00 SWP #0008 MUL2 =Screen.x
136
+		( draw ) OVR =Screen.color
138 137
 		( incr ) SWP #01 ADD SWP 
139 138
 		DUP2 LTH ^$draw-blends JNZ
140 139
 	POP POP
... ...
@@ -149,52 +148,52 @@ RTN
149 148
 	~window.x1 ~window.y1 ~window.x2 ~window.y2 #01 ,line-rect JSR2
150 149
 	~window.x1 #0002 SUB2 ~window.y1 #0002 SUB2 ~window.x2 #0002 ADD2 ~window.y2 #0002 ADD2 #01 ,line-rect JSR2
151 150
 
152
-	~window.x1 #0008 ADD2 ~window.y1 #0010 ADD2 #05 ,red_txt ,draw-label JSR2
153
-	~window.x1 #0008 ADD2 ~window.y1 #0020 ADD2 #05 ,green_txt ,draw-label JSR2
154
-	~window.x1 #0008 ADD2 ~window.y1 #0030 ADD2 #05 ,blue_txt ,draw-label JSR2
151
+	~window.x1 #0008 ADD2 ~window.y1 #0010 ADD2 #25 ,red_txt ,draw-label JSR2
152
+	~window.x1 #0008 ADD2 ~window.y1 #0020 ADD2 #25 ,green_txt ,draw-label JSR2
153
+	~window.x1 #0008 ADD2 ~window.y1 #0030 ADD2 #25 ,blue_txt ,draw-label JSR2
155 154
 
156 155
 	~window.x1 #0050 ADD2 ~window.y1 #0010 ADD2 ~window.x1 #0080 ADD2 #00 ,theme.r1 ~selection ADD PEK2 #0004 MUL2 #01 ,draw-slider JSR2
157 156
 	~window.x1 #0050 ADD2 ~window.y1 #0020 ADD2 ~window.x1 #0080 ADD2 #00 ,theme.g1 ~selection ADD PEK2 #0004 MUL2 #01 ,draw-slider JSR2
158 157
 	~window.x1 #0050 ADD2 ~window.y1 #0030 ADD2 ~window.x1 #0080 ADD2 #00 ,theme.b1 ~selection ADD PEK2 #0004 MUL2 #01 ,draw-slider JSR2
159 158
 
160
-	~window.x1 #0050 ADD2 =Sprite.x
161
-	~window.y1 #0040 ADD2 =Sprite.y
162
-	,radio_icns #00 ~selection #00 EQU #0008 MUL2 ADD2 =Sprite.addr
163
-	#05 =Sprite.color
159
+	~window.x1 #0050 ADD2 =Screen.x
160
+	~window.y1 #0040 ADD2 =Screen.y
161
+	,radio_icns #00 ~selection #00 EQU #0008 MUL2 ADD2 =Screen.addr
162
+	#25 =Screen.color
164 163
 
165
-	~window.x1 #0060 ADD2 =Sprite.x
166
-	~window.y1 #0040 ADD2 =Sprite.y
167
-	,radio_icns #00 ~selection #01 EQU #0008 MUL2 ADD2 =Sprite.addr
168
-	#05 =Sprite.color
164
+	~window.x1 #0060 ADD2 =Screen.x
165
+	~window.y1 #0040 ADD2 =Screen.y
166
+	,radio_icns #00 ~selection #01 EQU #0008 MUL2 ADD2 =Screen.addr
167
+	#25 =Screen.color
169 168
 
170
-	~window.x1 #0070 ADD2 =Sprite.x
171
-	~window.y1 #0040 ADD2 =Sprite.y
172
-	,radio_icns #00 ~selection #02 EQU #0008 MUL2 ADD2 =Sprite.addr
173
-	#05 =Sprite.color
169
+	~window.x1 #0070 ADD2 =Screen.x
170
+	~window.y1 #0040 ADD2 =Screen.y
171
+	,radio_icns #00 ~selection #02 EQU #0008 MUL2 ADD2 =Screen.addr
172
+	#25 =Screen.color
174 173
 
175
-	~window.x1 #0080 ADD2 =Sprite.x
176
-	~window.y1 #0040 ADD2 =Sprite.y
177
-	,radio_icns #00 ~selection #03 EQU #0008 MUL2 ADD2 =Sprite.addr
178
-	#05 =Sprite.color
174
+	~window.x1 #0080 ADD2 =Screen.x
175
+	~window.y1 #0040 ADD2 =Screen.y
176
+	,radio_icns #00 ~selection #03 EQU #0008 MUL2 ADD2 =Screen.addr
177
+	#25 =Screen.color
179 178
 
180 179
 RTN
181 180
 
182 181
 @draw-cursor
183 182
 
184 183
 	( clear last cursor )
185
-	,clear_icn =Sprite.addr 
186
-	~pointer.x =Sprite.x 
187
-	~pointer.y =Sprite.y 
188
-	#10 =Sprite.color
184
+	,clear_icn =Screen.addr 
185
+	~pointer.x =Screen.x 
186
+	~pointer.y =Screen.y 
187
+	#30 =Screen.color
189 188
 
190 189
 	( record pointer positions )
191 190
 	~Mouse.x =pointer.x ~Mouse.y =pointer.y
192 191
 
193 192
 	( draw new cursor )
194
-	,pointer_icn =Sprite.addr 
195
-	~pointer.x =Sprite.x 
196
-	~pointer.y =Sprite.y 
197
-	#13 =Sprite.color
193
+	,pointer_icn =Screen.addr 
194
+	~pointer.x =Screen.x 
195
+	~pointer.y =Screen.y 
196
+	#33 =Screen.color
198 197
 
199 198
 RTN
200 199
 
... ...
@@ -202,26 +201,26 @@ RTN
202 201
 	
203 202
 	( load ) =color =slider.pos =slider.x2 =slider.y =slider.x1
204 203
 
205
-	~slider.x1 =Sprite.x
206
-	~slider.y =Sprite.y
207
-	,halftone_icn =Sprite.addr
204
+	~slider.x1 =Screen.x
205
+	~slider.y =Screen.y
206
+	,halftone_icn =Screen.addr
208 207
 
209
-	,slidera_icn =Sprite.addr
210
-	( draw ) #05 =Sprite.color
211
-	,sliderb_icn =Sprite.addr
208
+	,slidera_icn =Screen.addr
209
+	( draw ) #25 =Screen.color
210
+	,sliderb_icn =Screen.addr
212 211
 
213 212
 	$loop
214
-		( incr ) ~Sprite.x 8+ =Sprite.x
215
-		( draw ) #05 =Sprite.color
216
-		~Sprite.x ~slider.x2 #0008 ADD2 LTH2 ^$loop JNZ
213
+		( incr ) ~Screen.x 8+ =Screen.x
214
+		( draw ) #25 =Screen.color
215
+		~Screen.x ~slider.x2 #0008 ADD2 LTH2 ^$loop JNZ
217 216
 
218
-	( incr ) ~Sprite.x #0004 ADD2 =Sprite.x
219
-	,sliderc_icn =Sprite.addr
220
-	( draw ) #05 =Sprite.color
217
+	( incr ) ~Screen.x #0004 ADD2 =Screen.x
218
+	,sliderc_icn =Screen.addr
219
+	( draw ) #25 =Screen.color
221 220
 
222
-	~slider.x1 ~slider.pos ADD2 =Sprite.x
223
-	,sliderd_icn =Sprite.addr
224
-	( draw ) #0a =Sprite.color
221
+	~slider.x1 ~slider.pos ADD2 =Screen.x
222
+	,sliderd_icn =Screen.addr
223
+	( draw ) #2a =Screen.color
225 224
 
226 225
 RTN
227 226
 
... ...
@@ -258,11 +257,11 @@ RTN
258 257
 
259 258
 @draw-label ( x y color addr )
260 259
 	
261
-	( load ) =label.addr =color =Sprite.y =Sprite.x ~label.addr
260
+	( load ) =label.addr =color =Screen.y =Screen.x ~label.addr
262 261
 	$loop
263
-		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~color =Sprite.color
262
+		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr ~color =Screen.color
264 263
 		( incr ) ++
265
-		( incr ) ~Sprite.x 8+ =Sprite.x
264
+		( incr ) ~Screen.x 8+ =Screen.x
266 265
 		DUP2 PEK2 #00 NEQ ^$loop JNZ
267 266
 	POP2
268 267
 
... ...
@@ -15,8 +15,7 @@
15 15
 ( devices )
16 16
 
17 17
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
18
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
19
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
18
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
20 19
 |01a0 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dotw 1 doty 2 isdst 1 refresh 1 }
21 20
 
22 21
 ( program )
... ...
@@ -69,26 +68,26 @@ BRK
69 68
 	POP2
70 69
 
71 70
 	( display )
72
-	~Screen.height #0002 DIV2 #0048 ADD2 =Sprite.y
71
+	~Screen.height #0002 DIV2 #0048 ADD2 =Screen.y
73 72
 	~Screen.width #0002 DIV2
74
-	DUP2 #0020 SUB2 =Sprite.x 
75
-		,font_hex #00 ~DateTime.hour #0a DIV #08 MUL ADD2 =Sprite.addr 
76
-		#02 =Sprite.color
77
-	DUP2 #0018 SUB2 =Sprite.x 
78
-		,font_hex #00 ~DateTime.hour #0a MOD #08 MUL ADD2 =Sprite.addr 
79
-		#02 =Sprite.color
80
-	DUP2 #0008 SUB2 =Sprite.x 
81
-		,font_hex #00 ~DateTime.minute #0a DIV #08 MUL ADD2 =Sprite.addr 
82
-		#02 =Sprite.color
83
-	DUP2 =Sprite.x 
84
-		,font_hex #00 ~DateTime.minute #0a MOD #08 MUL ADD2 =Sprite.addr 
85
-		#02 =Sprite.color
86
-	DUP2 #0010 ADD2 =Sprite.x 
87
-		,font_hex #00 ~DateTime.second #0a DIV #08 MUL ADD2 =Sprite.addr 
88
-		#02 =Sprite.color
89
-	DUP2 #0018 ADD2 =Sprite.x 
90
-		,font_hex #00 ~DateTime.second #0a MOD #08 MUL ADD2 =Sprite.addr 
91
-		#02 =Sprite.color
73
+	DUP2 #0020 SUB2 =Screen.x 
74
+		,font_hex #00 ~DateTime.hour #0a DIV #08 MUL ADD2 =Screen.addr 
75
+		#22 =Screen.color
76
+	DUP2 #0018 SUB2 =Screen.x 
77
+		,font_hex #00 ~DateTime.hour #0a MOD #08 MUL ADD2 =Screen.addr 
78
+		#22 =Screen.color
79
+	DUP2 #0008 SUB2 =Screen.x 
80
+		,font_hex #00 ~DateTime.minute #0a DIV #08 MUL ADD2 =Screen.addr 
81
+		#22 =Screen.color
82
+	DUP2 =Screen.x 
83
+		,font_hex #00 ~DateTime.minute #0a MOD #08 MUL ADD2 =Screen.addr 
84
+		#22 =Screen.color
85
+	DUP2 #0010 ADD2 =Screen.x 
86
+		,font_hex #00 ~DateTime.second #0a DIV #08 MUL ADD2 =Screen.addr 
87
+		#22 =Screen.color
88
+	DUP2 #0018 ADD2 =Screen.x 
89
+		,font_hex #00 ~DateTime.second #0a MOD #08 MUL ADD2 =Screen.addr 
90
+		#22 =Screen.color
92 91
 	POP2
93 92
 
94 93
 BRK
... ...
@@ -12,8 +12,7 @@
12 12
 
13 13
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
14 14
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
15
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
16
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
15
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
17 16
 |0140 ;Controller { vector 2 button 1 }
18 17
 |0150 ;Keys { vector 2 key 1 }
19 18
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
... ...
@@ -65,19 +64,19 @@ BRK
65 64
 @draw-cursor
66 65
 
67 66
 	( clear last cursor )
68
-	,clear_icn =Sprite.addr 
69
-	~pointer.x =Sprite.x 
70
-	~pointer.y =Sprite.y 
71
-	#10 =Sprite.color
67
+	,clear_icn =Screen.addr 
68
+	~pointer.x =Screen.x 
69
+	~pointer.y =Screen.y 
70
+	#30 =Screen.color
72 71
 
73 72
 	( record pointer positions )
74 73
 	~Mouse.x =pointer.x ~Mouse.y =pointer.y
75 74
 
76 75
 	( draw new cursor )
77
-	~pointer.sprite =Sprite.addr 
78
-	~pointer.x =Sprite.x 
79
-	~pointer.y =Sprite.y 
80
-	#11 =Sprite.color
76
+	~pointer.sprite =Screen.addr 
77
+	~pointer.x =Screen.x 
78
+	~pointer.y =Screen.y 
79
+	#31 =Screen.color
81 80
 
82 81
 RTN
83 82
 
... ...
@@ -7,8 +7,7 @@
7 7
 
8 8
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
9 9
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
10
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
11
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
10
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
12 11
 |0140 ;Controller { vector 2 button 1 }
13 12
 |0150 ;Keys { vector 2 key 1 }
14 13
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
... ...
@@ -30,22 +29,22 @@
30 29
 		( incr ) ~Screen.y #0002 ADD2 =Screen.y
31 30
 		~Screen.y ~Screen.height LTH2 ^$draw-ver JNZ
32 31
 
33
-	~center.x ~center.y #0010 SUB2 #0c ,text1 ,draw-label-left JSR2
34
-	~center.x ~center.y #0c ,text2 ,draw-label-middle JSR2
35
-	~center.x ~center.y #0010 ADD2 #0c ,text3 ,draw-label-right JSR2
36
-	~center.x ~center.y #0020 ADD2 #0c ,text4 ,draw-label-middle JSR2
37
-	~center.x ~center.y #0030 ADD2 #0c ,text5 ,draw-label-middle JSR2
32
+	~center.x ~center.y #0010 SUB2 #2c ,text1 ,draw-label-left JSR2
33
+	~center.x ~center.y #2c ,text2 ,draw-label-middle JSR2
34
+	~center.x ~center.y #0010 ADD2 #2c ,text3 ,draw-label-right JSR2
35
+	~center.x ~center.y #0020 ADD2 #2c ,text4 ,draw-label-middle JSR2
36
+	~center.x ~center.y #0030 ADD2 #2c ,text5 ,draw-label-middle JSR2
38 37
 	
39 38
 BRK
40 39
 
41 40
 @draw-label-left ( x y color addr )
42 41
 	
43
-	( load ) =label.addr =label.color =Sprite.y =Sprite.x 
42
+	( load ) =label.addr =label.color =Screen.y =Screen.x 
44 43
 	~label.addr
45 44
 	$loop
46
-		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
45
+		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr ~label.color =Screen.color
47 46
 		( incr ) #0001 ADD2
48
-		( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
47
+		( incr ) ~Screen.x #0008 ADD2 =Screen.x
49 48
 		DUP2 PEK2 #00 NEQ ^$loop JNZ
50 49
 	POP2
51 50
 
... ...
@@ -53,13 +52,13 @@ RTN
53 52
 
54 53
 @draw-label-middle ( x y color addr )
55 54
 	
56
-	( load ) =label.addr =label.color =Sprite.y
57
-	( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 =Sprite.x 
55
+	( load ) =label.addr =label.color =Screen.y
56
+	( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 =Screen.x 
58 57
 	~label.addr
59 58
 	$loop
60
-		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
59
+		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr ~label.color =Screen.color
61 60
 		( incr ) #0001 ADD2
62
-		( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
61
+		( incr ) ~Screen.x #0008 ADD2 =Screen.x
63 62
 		DUP2 PEK2 #00 NEQ ^$loop JNZ
64 63
 	POP2
65 64
 
... ...
@@ -67,13 +66,13 @@ RTN
67 66
 
68 67
 @draw-label-right ( x y color addr )
69 68
 	
70
-	( load ) =label.addr =label.color =Sprite.y
71
-	( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 =Sprite.x 
69
+	( load ) =label.addr =label.color =Screen.y
70
+	( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 =Screen.x 
72 71
 	~label.addr
73 72
 	$loop
74
-		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color
73
+		( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr ~label.color =Screen.color
75 74
 		( incr ) #0001 ADD2
76
-		( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
75
+		( incr ) ~Screen.x #0008 ADD2 =Screen.x
77 76
 		DUP2 PEK2 #00 NEQ ^$loop JNZ
78 77
 	POP2
79 78
 
... ...
@@ -6,8 +6,7 @@
6 6
 
7 7
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
8 8
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
9
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
10
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
9
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
11 10
 |0140 ;Controller { vector 2 button 1 }
12 11
 |0150 ;Keys { vector 2 key 1 }
13 12
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
... ...
@@ -18,24 +17,24 @@
18 17
 
19 18
 	( theme ) #0ffc =System.r #0f0b =System.g #0f03 =System.b
20 19
 	
21
-	#0000 #0000 #0100 #0100 #01 ,pict_large ,draw-picture JSR2
22
-	#0098 #0060 #0080 #0080 #01 ,pict_medium ,draw-picture JSR2
23
-	#0020 #0090 #0020 #0020 #0a ,pict_small ,draw-picture JSR2
20
+	#0000 #0000 #0100 #0100 #21 ,pict_large ,draw-picture JSR2
21
+	#0098 #0060 #0080 #0080 #21 ,pict_medium ,draw-picture JSR2
22
+	#0020 #0090 #0020 #0020 #2a ,pict_small ,draw-picture JSR2
24 23
 
25 24
 BRK
26 25
 
27 26
 @draw-picture ( x y width height color addr )
28 27
 	
29
-	DUP2 =Sprite.addr =pict.addr =pict.color =pict.height =pict.width DUP2 =Sprite.y =pict.y =pict.x
28
+	DUP2 =Screen.addr =pict.addr =pict.color =pict.height =pict.width DUP2 =Screen.y =pict.y =pict.x
30 29
 	$ver
31
-		~pict.x =Sprite.x 
30
+		~pict.x =Screen.x 
32 31
 		$hor
33
-			( draw ) ~pict.color =Sprite.color
34
-			( incr ) ~Sprite.x #0008 ADD2 =Sprite.x
35
-			( incr ) ~Sprite.addr #0008 ADD2 =Sprite.addr
36
-		~Sprite.x ~pict.width ~pict.x ADD2 LTH2 ^$hor JNZ
37
-		( incr ) ~Sprite.y #0008 ADD2 =Sprite.y
38
-	~Sprite.y ~pict.height ~pict.y ADD2 LTH2 ^$ver JNZ
32
+			( draw ) ~pict.color =Screen.color
33
+			( incr ) ~Screen.x #0008 ADD2 =Screen.x
34
+			( incr ) ~Screen.addr #0008 ADD2 =Screen.addr
35
+		~Screen.x ~pict.width ~pict.x ADD2 LTH2 ^$hor JNZ
36
+		( incr ) ~Screen.y #0008 ADD2 =Screen.y
37
+	~Screen.y ~pict.height ~pict.y ADD2 LTH2 ^$ver JNZ
39 38
 
40 39
 RTN
41 40
 
... ...
@@ -14,8 +14,7 @@
14 14
 
15 15
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
16 16
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
17
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
18
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
17
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
19 18
 |0140 ;Controller { vector 2 button 1 }
20 19
 |0150 ;Keys { vector 2 key 1 }
21 20
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
... ...
@@ -33,10 +32,10 @@
33 32
 	#0080 #0030 #00b0 #0070 #02 ,line-rect JSR2
34 33
 	#0090 #0040 #00c0 #0080 #03 ,line-rect JSR2
35 34
 
36
-	#0000 #0080 #0020 #0020 #01 ,pict_small ,draw-picture JSR2
37
-	#0010 #0088 #0020 #0020 #02 ,pict_small ,draw-picture JSR2
38
-	#0020 #0090 #0020 #0020 #03 ,pict_small ,draw-picture JSR2
39
-	#0030 #0098 #0020 #0020 #04 ,pict_small ,draw-picture JSR2
35
+	#0000 #0080 #0020 #0020 #21 ,pict_small ,draw-picture JSR2
36
+	#0010 #0088 #0020 #0020 #22 ,pict_small ,draw-picture JSR2
37
+	#0020 #0090 #0020 #0020 #23 ,pict_small ,draw-picture JSR2
38
+	#0030 #0098 #0020 #0020 #24 ,pict_small ,draw-picture JSR2
40 39
 
41 40
 	#0020 #0020 #0070 #0080 #01 ,draw-line JSR2
42 41
 	#0020 #0080 #0070 #0030 #02 ,draw-line JSR2
... ...
@@ -108,16 +107,16 @@ RTN
108 107
 
109 108
 @draw-picture ( x y width height color addr )
110 109
 	
111
-	( load ) DUP2 =Sprite.addr =pict.addr =pict.color =pict.height =pict.width DUP2 =Sprite.y =pict.y =pict.x
110
+	( load ) DUP2 =Screen.addr =pict.addr =pict.color =pict.height =pict.width DUP2 =Screen.y =pict.y =pict.x
112 111
 	$ver
113
-		~pict.x =Sprite.x 
112
+		~pict.x =Screen.x 
114 113
 		$hor
115
-			( draw ) ~pict.color =Sprite.color
116
-			( incr ) ~Sprite.x 8+ =Sprite.x
117
-			( incr ) ~Sprite.addr 8+ =Sprite.addr
118
-		~Sprite.x ~pict.width ~pict.x ADD2 LTH2 ^$hor JNZ
119
-		( incr ) ~Sprite.y 8+ =Sprite.y
120
-	~Sprite.y ~pict.height ~pict.y ADD2 LTH2 ^$ver JNZ
114
+			( draw ) ~pict.color =Screen.color
115
+			( incr ) ~Screen.x 8+ =Screen.x
116
+			( incr ) ~Screen.addr 8+ =Screen.addr
117
+		~Screen.x ~pict.width ~pict.x ADD2 LTH2 ^$hor JNZ
118
+		( incr ) ~Screen.y 8+ =Screen.y
119
+	~Screen.y ~pict.height ~pict.y ADD2 LTH2 ^$ver JNZ
121 120
 
122 121
 RTN
123 122
 
... ...
@@ -44,11 +44,10 @@
44 44
 
45 45
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
46 46
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
47
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
48
-|0130 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
49
-|0140 ;Controller { buttons 1 }
50
-|0150 ;Keys { key 1 }
51
-|0160 ;Mouse { x 2 y 2 state 1 chord 1 }
47
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
48
+|0140 ;Controller { vector 2 button 1 }
49
+|0150 ;Keys { vector 2 key 1 }
50
+|0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
52 51
 |0170 ;File { pad 8 name 2 length 2 load 2 save 2 }
53 52
 
54 53
 ( program )
... ...
@@ -56,7 +55,9 @@
56 55
 |0200 @RESET
57 56
 	
58 57
 	( theme ) #e0fa =System.r #30fa =System.g #30fa =System.b
59
-	( vectors ) ,FRAME =Screen.vector
58
+	( vectors ) ,on-mouse =Mouse.vector
59
+	( vectors ) ,on-key =Keys.vector
60
+	( vectors ) ,on-button =Controller.vector
60 61
 
61 62
 	( load file )
62 63
 	,filepath ,load-file JSR2
... ...
@@ -69,102 +70,96 @@
69 70
 
70 71
 BRK
71 72
 
72
-@FRAME
73
-
74
-	( ctrl )
75
-	~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 ,$ctrl-end JNZ2
76
-		( lock ) #04 =lock
77
-
78
-		( alt + arrow )
79
-		~Controller #0f AND #02 NEQ ^$no-alt JNZ
80
-			~Controller #04 SFT 
81
-			DUP #01 NEQ ^$no-aup JNZ
82
-				( sel word ) ,find-wordstart JSR2 =selection.to $no-aup
83
-			DUP #02 NEQ ^$no-adown JNZ
84
-				( sel word ) ,find-wordend JSR2 =selection.to $no-adown
85
-			DUP #04 NEQ ^$no-aleft JNZ
86
-				( sel decr ) ~selection.to -- =selection.to $no-aleft
87
-			DUP #08 NEQ ^$no-aright JNZ
88
-				( sel incr ) ~selection.to ++ =selection.to $no-aright
89
-			POP
90
-			,clamp-selection JSR2 
91
-			,redraw JSR2
92
-			,$ctrl-end JMP2
93
-		$no-alt
94
-
95
-		( ctrl + arrow )
96
-		~Controller #0f AND #01 NEQ ^$no-ctrl JNZ
97
-			~Controller #04 SFT 
98
-			DUP #01 NEQ ^$no-cup JNZ
99
-				( jump scroll ) #0004 ,scroll-up JSR2 $no-cup
100
-			DUP #02 NEQ ^$no-cdown JNZ
101
-				( jump scroll ) #0004 ,scroll-down JSR2 $no-cdown
102
-			DUP #04 NEQ ^$no-cleft JNZ
103
-				( jump line ) ,goto-linestart JSR2 $no-cleft
104
-			DUP #08 NEQ ^$no-cright JNZ
105
-				( jump line ) ,goto-lineend JSR2 $no-cright
106
-			POP
107
-			,redraw JSR2
108
-			,$ctrl-end JMP2
109
-		$no-ctrl
110
-
111
-		( arrow )
112
-		~Controller #f0 AND #00 EQU ,$no-arrow JNZ2
113
-			~Controller #f0 AND
114
-			DUP #10 NEQ ^$no-arrowup JNZ
115
-				( clamp ) ~position.y #0000 EQU2 ^$no-arrowup JNZ
116
-				,find-lineoffset JSR2 =position.x ~position.y -- =position.y 
117
-				,find-selection JSR2 DUP2 =selection.from ++ =selection.to $no-arrowup
118
-			DUP #20 NEQ ^$no-arrowdown JNZ
119
-				( clamp:TODO )
120
-				,find-lineoffset JSR2 =position.x ~position.y ++ =position.y 
121
-				,find-selection JSR2 DUP2 =selection.from ++ =selection.to $no-arrowdown
122
-			DUP #40 NEQ ^$no-arrowleft JNZ
123
-				( clamp ) ~selection.from ,document.body EQU2 ^$no-arrowleft JNZ
124
-				~selection.from -- DUP2 =selection.from ++ =selection.to $no-arrowleft
125
-			DUP #80 NEQ ^$no-arrowright JNZ
126
-				( clamp:TODO )
127
-				#aa =Console.byte
128
-				~selection.from ++ DUP2 =selection.from ++ =selection.to $no-arrowright
129
-			POP
130
-			,clamp-selection JSR2 
131
-			,follow-selection JSR2 
132
-			,redraw JSR2 
133
-		$no-arrow
134
-
135
-	$ctrl-end
136
-
137
-	( keys )
138
-
139
-	~Keys #00 EQU ,$no-keys JNZ2
140
-
141
-		~Keys #08 NEQ ^$no-backspace JNZ
142
-			( erase )
143
-			~selection.to ~selection.from SUB2 #0001 NEQ2 ^$erase-multiple JNZ
144
-				~selection.to ~selection.from SUB2 ,shift-left JSR2
145
-				,$erase-end JMP2
146
-			$erase-multiple
147
-				~selection.from ++ =selection.from
148
-				~selection.to ~selection.from SUB2 ++ ,shift-left JSR2
149
-			$erase-end
150
-			~selection.from -- =selection.from
151
-			^$keys-end JMP
152
-		$no-backspace
153
-
154
-		( insert )
155
-		~selection.to ~selection.from SUB2 ,shift-right JSR2
156
-		~Keys ~selection.from POK2
157
-		~selection.from ++ =selection.from
158
-
159
-		$keys-end
160
-		~selection.from ++ =selection.to
161
-		( release ) #00 =Keys
162
-		,redraw JSR2
73
+@on-key
74
+
75
+	~Keys #08 NEQ ^$no-backspace JNZ
76
+		( erase )
77
+		~selection.to ~selection.from SUB2 #0001 NEQ2 ^$erase-multiple JNZ
78
+			~selection.to ~selection.from SUB2 ,shift-left JSR2
79
+			,$erase-end JMP2
80
+		$erase-multiple
81
+			~selection.from ++ =selection.from
82
+			~selection.to ~selection.from SUB2 ++ ,shift-left JSR2
83
+		$erase-end
84
+		~selection.from -- =selection.from
85
+		^$keys-end JMP
86
+	$no-backspace
87
+
88
+	( insert )
89
+	~selection.to ~selection.from SUB2 ,shift-right JSR2
90
+	~Keys ~selection.from POK2
91
+	~selection.from ++ =selection.from
92
+
93
+	$keys-end
94
+	~selection.from ++ =selection.to
95
+	( release ) #00 =Keys
96
+	,redraw JSR2
163 97
 
164
-	$no-keys
98
+BRK 
165 99
 
166
-	( mouse )
100
+@on-button ( -> )
101
+	
102
+	( alt + arrow )
103
+	~Controller #0f AND #02 NEQ ^$no-alt JNZ
104
+		~Controller #04 SFT 
105
+		DUP #01 NEQ ^$no-aup JNZ
106
+			( sel word ) ,find-wordstart JSR2 =selection.to $no-aup
107
+		DUP #02 NEQ ^$no-adown JNZ
108
+			( sel word ) ,find-wordend JSR2 =selection.to $no-adown
109
+		DUP #04 NEQ ^$no-aleft JNZ
110
+			( sel decr ) ~selection.to -- =selection.to $no-aleft
111
+		DUP #08 NEQ ^$no-aright JNZ
112
+			( sel incr ) ~selection.to ++ =selection.to $no-aright
113
+		POP
114
+		,clamp-selection JSR2 
115
+		,redraw JSR2
116
+		BRK
117
+	$no-alt
118
+
119
+	( ctrl + arrow )
120
+	~Controller #0f AND #01 NEQ ^$no-ctrl JNZ
121
+		~Controller #04 SFT 
122
+		DUP #01 NEQ ^$no-cup JNZ
123
+			( jump scroll ) #0004 ,scroll-up JSR2 $no-cup
124
+		DUP #02 NEQ ^$no-cdown JNZ
125
+			( jump scroll ) #0004 ,scroll-down JSR2 $no-cdown
126
+		DUP #04 NEQ ^$no-cleft JNZ
127
+			( jump line ) ,goto-linestart JSR2 $no-cleft
128
+		DUP #08 NEQ ^$no-cright JNZ
129
+			( jump line ) ,goto-lineend JSR2 $no-cright
130
+		POP
131
+		,redraw JSR2
132
+		BRK
133
+	$no-ctrl
134
+
135
+	( arrow )
136
+	~Controller #f0 AND #00 EQU ,$no-arrow JNZ2
137
+		~Controller #f0 AND
138
+		DUP #10 NEQ ^$no-arrowup JNZ
139
+			( clamp ) ~position.y #0000 EQU2 ^$no-arrowup JNZ
140
+			,find-lineoffset JSR2 =position.x ~position.y -- =position.y 
141
+			,find-selection JSR2 DUP2 =selection.from ++ =selection.to $no-arrowup
142
+		DUP #20 NEQ ^$no-arrowdown JNZ
143
+			( clamp:TODO )
144
+			,find-lineoffset JSR2 =position.x ~position.y ++ =position.y 
145
+			,find-selection JSR2 DUP2 =selection.from ++ =selection.to $no-arrowdown
146
+		DUP #40 NEQ ^$no-arrowleft JNZ
147
+			( clamp ) ~selection.from ,document.body EQU2 ^$no-arrowleft JNZ
148
+			~selection.from -- DUP2 =selection.from ++ =selection.to $no-arrowleft
149
+		DUP #80 NEQ ^$no-arrowright JNZ
150
+			( clamp:TODO )
151
+			#aa =Console.byte
152
+			~selection.from ++ DUP2 =selection.from ++ =selection.to $no-arrowright
153
+		POP
154
+		,clamp-selection JSR2 
155
+		,follow-selection JSR2 
156
+		,redraw JSR2 
157
+	$no-arrow
167 158
 
159
+BRK
160
+
161
+@on-mouse ( -> )
162
+	
168 163
 	~Mouse.state #00 EQU ^$touch-end JNZ
169 164
 		~Mouse.x #0010 LTH2 ,touch-linebar JNZ2
170 165
 		~Mouse.x ~Screen.width 8- LTH2 ,touch-body JNZ2
... ...
@@ -173,11 +168,9 @@ BRK
173 168
 
174 169
 	~Mouse.state =touch.state
175 170
 
176
-	( unlock ) ~lock #00 EQU ,skip-unlock JNZ2 ~lock #01 SUB =lock @skip-unlock
177
-
178 171
 	,draw-cursor JSR2
179 172
 
180
-BRK 
173
+BRK
181 174
 
182 175
 @touch-linebar ( -- )
183 176
 	
... ...
@@ -463,64 +456,60 @@ RTN
463 456
 	,draw-titlebar JSR2
464 457
 
465 458
 	( save/load icons )
466
-	~Screen.height 8- =Sprite.y
459
+	~Screen.height 8- =Screen.y
467 460
 
468
-	~Screen.width #0030 SUB2 =Sprite.x
469
-	,eye_icn =Sprite.addr
470
-	#02 =Sprite.color
461
+	~Screen.width #0030 SUB2 =Screen.x
462
+	,eye_icn =Screen.addr
463
+	#22 =Screen.color
471 464
 
472
-	~Screen.width #0028 SUB2 =Sprite.x
473
-	,name_icn =Sprite.addr
474
-	#02 =Sprite.color
465
+	~Screen.width #0028 SUB2 =Screen.x
466
+	,name_icn =Screen.addr
467
+	#22 =Screen.color
475 468
 
476
-	~Screen.width #0020 SUB2 =Sprite.x
477
-	,load_icn =Sprite.addr
478
-	#02 =Sprite.color
469
+	~Screen.width #0020 SUB2 =Screen.x
470
+	,load_icn =Screen.addr
471
+	#22 =Screen.color
479 472
 
480
-	~Screen.width #0018 SUB2 =Sprite.x
481
-	,save_icn =Sprite.addr
482
-	#02 =Sprite.color
473
+	~Screen.width #0018 SUB2 =Screen.x
474
+	,save_icn =Screen.addr
475
+	#22 =Screen.color
483 476
 
484 477
 RTN
485 478
 
486 479
 @draw-short ( short )
487 480
 
488 481
 	=addr
489
-	,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
490
-	( draw ) #0e =Sprite.color
491
-	~Sprite.x 8+ =Sprite.x
492
-	,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
493
-	( draw ) #0e =Sprite.color
494
-	~Sprite.x 8+ =Sprite.x
495
-	,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
496
-	( draw ) #0e =Sprite.color
497
-	~Sprite.x 8+ =Sprite.x
498
-	,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
499
-	( draw ) #0e =Sprite.color
482
+	,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
483
+	( draw ) #2e =Screen.color
484
+	~Screen.x 8+ =Screen.x
485
+	,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Screen.addr
486
+	( draw ) #2e =Screen.color
487
+	~Screen.x 8+ =Screen.x
488
+	,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
489
+	( draw ) #2e =Screen.color
490
+	~Screen.x 8+ =Screen.x
491
+	,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Screen.addr
492
+	( draw ) #2e =Screen.color
500 493
 
501 494
 RTN
502 495
 
503 496
 @draw-cursor
504 497
 
505
-	~mouse.x ~Mouse.x NEQ2
506
-	~mouse.y ~Mouse.y NEQ2
507
-	#0000 EQU2 RTN? ( Return if unchanged )
508
-
509 498
 	( clear last cursor )
510
-	~mouse.x =Sprite.x
511
-	~mouse.y =Sprite.y
512
-	,blank_icn =Sprite.addr
513
-	#10 =Sprite.color
499
+	~mouse.x =Screen.x
500
+	~mouse.y =Screen.y
501
+	,blank_icn =Screen.addr
502
+	#30 =Screen.color
514 503
 
515 504
 	( record mouse positions )
516 505
 	~Mouse.x =mouse.x 
517 506
 	~Mouse.y =mouse.y
518 507
 
519 508
 	( draw new cursor )
520
-	~mouse.x =Sprite.x
521
-	~mouse.y =Sprite.y
522
-	,cursor_icn =Sprite.addr
523
-	#1f ~Mouse.state #01 EQU #0a MUL SUB =Sprite.color
509
+	~mouse.x =Screen.x
510
+	~mouse.y =Screen.y
511
+	,cursor_icn =Screen.addr
512
+	#3f ~Mouse.state #01 EQU #0a MUL SUB =Screen.color
524 513
 
525 514
 RTN
526 515
 
... ...
@@ -538,55 +527,55 @@ RTN
538 527
 	~textarea.addr PEK2 #00 NEQ ^$find-offset JNZ
539 528
 	$find-offset-end
540 529
 
541
-	#0018 =Sprite.x #0000 =Sprite.y
530
+	#0018 =Screen.x #0000 =Screen.y
542 531
 	~textarea.addr =i
543 532
 
544 533
 	$loop
545 534
 
546
-		~Sprite.y ~Screen.height #0010 SUB2 GTH2 ,$end JNZ2
535
+		~Screen.y ~Screen.height #0010 SUB2 GTH2 ,$end JNZ2
547 536
 
548 537
 
549 538
 		~i PEK2 #0a NEQ ~i PEK2 #0d NEQ #0101 EQU2 ,$no-linebreak JNZ2
550 539
 			( draw linebreak )
551
-			,linebreak_icn =Sprite.addr
540
+			,linebreak_icn =Screen.addr
552 541
 			( draw ) #02
553 542
 			~i ~selection.from -- GTH2 
554 543
 			~i ~selection.to LTH2 #0101 EQU2
555
-			#06 MUL ADD =Sprite.color
544
+			#26 MUL ADD =Screen.color
556 545
 			( fill clear )
557 546
 			$fill-clear
558
-				( incr ) ~Sprite.x 8+ =Sprite.x
559
-				,font =Sprite.addr
560
-				#01 =Sprite.color
561
-				~Sprite.x ~Screen.width 8- LTH2 ^$fill-clear JNZ
547
+				( incr ) ~Screen.x 8+ =Screen.x
548
+				,font =Screen.addr
549
+				#21 =Screen.color
550
+				~Screen.x ~Screen.width 8- LTH2 ^$fill-clear JNZ
562 551
 
563 552
 			( draw line number )
564
-			#0000 =Sprite.x
565
-			~scroll.y ~Sprite.y 8/ ADD2 DUP2 SWP POP =k 
553
+			#0000 =Screen.x
554
+			~scroll.y ~Screen.y 8/ ADD2 DUP2 SWP POP =k 
566 555
 			~position.y EQU2 #05 MUL =l
567
-			,font_hex #00 ~k #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
568
-			#04 ~l ADD =Sprite.color
569
-			#0008 =Sprite.x
570
-			,font_hex #00 ~k #0f AND #08 MUL ADD2 =Sprite.addr
571
-			#04 ~l ADD =Sprite.color
572
-
573
-			#0010 =Sprite.x
574
-			( incr ) ~Sprite.y 8+ =Sprite.y
556
+			,font_hex #00 ~k #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
557
+			#24 ~l ADD =Screen.color
558
+			#0008 =Screen.x
559
+			,font_hex #00 ~k #0f AND #08 MUL ADD2 =Screen.addr
560
+			#24 ~l ADD =Screen.color
561
+
562
+			#0010 =Screen.x
563
+			( incr ) ~Screen.y 8+ =Screen.y
575 564
 		$no-linebreak
576 565
 
577 566
 
578 567
 		( get character )
579
-		,font #00 ~i PEK2 #20 SUB 8* ADD2 =Sprite.addr
568
+		,font #00 ~i PEK2 #20 SUB 8* ADD2 =Screen.addr
580 569
 		( is a special character )
581
-		~i PEK2 #20 GTH ^$no-tab JNZ ,font =Sprite.addr $no-tab
570
+		~i PEK2 #20 GTH ^$no-tab JNZ ,font =Screen.addr $no-tab
582 571
 
583
-		( draw ) #01 
572
+		( draw ) #21 
584 573
 		~i ~selection.from -- GTH2 
585 574
 		~i ~selection.to LTH2 #0101 EQU2
586
-		#05 MUL ADD =Sprite.color
575
+		#05 MUL ADD =Screen.color
587 576
 
588 577
 		( incr ) ~i ++ =i
589
-		( incr ) ~Sprite.x #0007 ADD2 =Sprite.x
578
+		( incr ) ~Screen.x #0007 ADD2 =Screen.x
590 579
 
591 580
 	~i PEK2 #00 NEQ ,$loop JNZ2
592 581
 
... ...
@@ -598,40 +587,40 @@ RTN
598 587
 	
599 588
 	,scrollbar_icn ( keeping a copy on stack )
600 589
 
601
-	~Screen.width 8- =Sprite.x 
602
-	#0008 =Sprite.y
603
-	DUP2 =Sprite.addr
590
+	~Screen.width 8- =Screen.x 
591
+	#0008 =Screen.y
592
+	DUP2 =Screen.addr
604 593
 
605 594
 	#0008 ~Screen.height 8-
606 595
 	$loop
607
-		( draw ) #01 =Sprite.color
608
-		( incr ) SWP2 8+ DUP2 =Sprite.y SWP2
596
+		( draw ) #21 =Screen.color
597
+		( incr ) SWP2 8+ DUP2 =Screen.y SWP2
609 598
 		OVR2 OVR2 LTH2 ^$loop JNZ
610 599
 	POP2 POP2
611 600
 
612
-	~scroll.y 8+ =Sprite.y
613
-	DUP2 #0008 ADD2 =Sprite.addr
614
-	( draw ) #01 =Sprite.color
601
+	~scroll.y 8+ =Screen.y
602
+	DUP2 #0008 ADD2 =Screen.addr
603
+	( draw ) #21 =Screen.color
615 604
 
616
-	#0000 =Sprite.y
617
-	DUP2 #0010 ADD2 =Sprite.addr
618
-	( draw ) #04 =Sprite.color
605
+	#0000 =Screen.y
606
+	DUP2 #0010 ADD2 =Screen.addr
607
+	( draw ) #24 =Screen.color
619 608
 
620
-	~Screen.height 8- =Sprite.y
621
-	#0018 ADD2 =Sprite.addr
622
-	( draw ) #04 =Sprite.color
609
+	~Screen.height 8- =Screen.y
610
+	#0018 ADD2 =Screen.addr
611
+	( draw ) #24 =Screen.color
623 612
 
624 613
 RTN
625 614
 
626 615
 @draw-titlebar
627 616
 	
628
-	#0018 ~Screen.height 8- #09 ,filepath 
629
-	( load ) =label.addr =label.color =Sprite.y =Sprite.x 
617
+	#0018 ~Screen.height 8- #29 ,filepath 
618
+	( load ) =label.addr =label.color =Screen.y =Screen.x 
630 619
 	~label.addr
631 620
 	$loop
632
-		( draw ) DUP2 PEK2 #00 SWP #20 SUB 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color
621
+		( draw ) DUP2 PEK2 #00 SWP #20 SUB 8* ,font ADD2 =Screen.addr ~label.color =Screen.color
633 622
 		( incr ) ++
634
-		( incr ) ~Sprite.x 8+ =Sprite.x
623
+		( incr ) ~Screen.x 8+ =Screen.x
635 624
 		DUP2 PEK2 #00 NEQ ^$loop JNZ
636 625
 	POP2
637 626
 	( selection )
... ...
@@ -33,8 +33,7 @@
33 33
 
34 34
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
35 35
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
36
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
37
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
36
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
38 37
 |0140 ;Controller { vector 2 button 1 }
39 38
 |0150 ;Keys { vector 2 key 1 }
40 39
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
... ...
@@ -254,65 +253,65 @@ RTN
254 253
 
255 254
 	( position )
256 255
 
257
-	~bankview.x =Sprite.x
258
-	~bankview.y #0010 SUB2 =Sprite.y
256
+	~bankview.x =Screen.x
257
+	~bankview.y #0010 SUB2 =Screen.y
259 258
 	~bankview.addr ,draw-short JSR2
260 259
 
261 260
 	( toolbar )
262 261
 
263
-	~bankview.x #0068 ADD2 =Sprite.x
264
-	~bankview.y #0010 SUB2 =Sprite.y
265
-	,tool_selector =Sprite.addr
266
-	#01 ~bankview.mode #00 EQU ADD =Sprite.color
262
+	~bankview.x #0068 ADD2 =Screen.x
263
+	~bankview.y #0010 SUB2 =Screen.y
264
+	,tool_selector =Screen.addr
265
+	#21 ~bankview.mode #00 EQU ADD =Screen.color
267 266
 
268
-	~Sprite.x 8+ =Sprite.x
269
-	,tool_hand =Sprite.addr
270
-	#01 ~bankview.mode #01 EQU ADD =Sprite.color
267
+	~Screen.x 8+ =Screen.x
268
+	,tool_hand =Screen.addr
269
+	#21 ~bankview.mode #01 EQU ADD =Screen.color
271 270
 
272
-	~Sprite.x 8+ =Sprite.x
273
-	,tool_eraser =Sprite.addr
274
-	#01 ~bankview.mode #02 EQU ADD =Sprite.color
271
+	~Screen.x 8+ =Screen.x
272
+	,tool_eraser =Screen.addr
273
+	#21 ~bankview.mode #02 EQU ADD =Screen.color
275 274
 
276
-	~tileview.x #0070 ADD2 =Sprite.x
277
-	,load_icn =Sprite.addr
278
-	#01 =Sprite.color
275
+	~tileview.x #0070 ADD2 =Screen.x
276
+	,load_icn =Screen.addr
277
+	#21 =Screen.color
279 278
 
280
-	~tileview.x #0078 ADD2 =Sprite.x
281
-	,save_icn =Sprite.addr
282
-	#01 =Sprite.color
279
+	~tileview.x #0078 ADD2 =Screen.x
280
+	,save_icn =Screen.addr
281
+	#21 =Screen.color
283 282
 
284 283
 	( guides )
285 284
 
286
-	#00 =i ,font_hex =Sprite.addr
285
+	#00 =i ,font_hex =Screen.addr
287 286
 	$guides
288
-		~bankview.x #0010 SUB2 =Sprite.x
289
-		~bankview.y #00 ~i #08 MUL ADD2 =Sprite.y
290
-		( draw ) #02 =Sprite.color
291
-		~bankview.x #00 ~i #08 MUL ADD2 =Sprite.x
292
-		~bankview.y #0088 ADD2 =Sprite.y
293
-		( draw ) #02 =Sprite.color
294
-		~Sprite.addr 8+ =Sprite.addr
287
+		~bankview.x #0010 SUB2 =Screen.x
288
+		~bankview.y #00 ~i #08 MUL ADD2 =Screen.y
289
+		( draw ) #22 =Screen.color
290
+		~bankview.x #00 ~i #08 MUL ADD2 =Screen.x
291
+		~bankview.y #0088 ADD2 =Screen.y
292
+		( draw ) #22 =Screen.color
293
+		~Screen.addr 8+ =Screen.addr
295 294
 		( incr ) ~i #01 ADD =i
296 295
 		~i #10 LTH ^$guides JNZ
297 296
 
298 297
 	( body )
299 298
 
300
-	~bankview.x =Sprite.x ~bankview.y =Sprite.y
301
-	#00 =pt.x #00 =pt.y ~bankview.addr =Sprite.addr
299
+	~bankview.x =Screen.x ~bankview.y =Screen.y
300
+	#00 =pt.x #00 =pt.y ~bankview.addr =Screen.addr
302 301
 	$ver
303 302
 		#00 =pt.x
304
-		~bankview.x =Sprite.x
303
+		~bankview.x =Screen.x
305 304
 		$hor
306
-			( draw ) #01
307
-				~Sprite.addr ~tileview.addr LTH2 
308
-				~Sprite.addr ~tileview.addr #0018 ADD2 GTH2 
309
-				#0000 EQU2 #06 MUL ADD =Sprite.color
310
-			( incr ) ~Sprite.x 8+ =Sprite.x
311
-			( incr ) ~Sprite.addr 8+ =Sprite.addr
305
+			( draw ) #21
306
+				~Screen.addr ~tileview.addr LTH2 
307
+				~Screen.addr ~tileview.addr #0018 ADD2 GTH2 
308
+				#0000 EQU2 #06 MUL ADD =Screen.color
309
+			( incr ) ~Screen.x 8+ =Screen.x
310
+			( incr ) ~Screen.addr 8+ =Screen.addr
312 311
 			( incr ) ~pt.x #01 ADD =pt.x
313 312
 			~pt.x #10 LTH ,$hor JNZ2
314 313
 		( incr ) ~pt.y #01 ADD =pt.y
315
-		( incr ) ~Sprite.y 8+ =Sprite.y
314
+		( incr ) ~Screen.y 8+ =Screen.y
316 315
 		~pt.y #10 LTH ,$ver JNZ2
317 316
 
318 317
 RTN
... ...
@@ -321,36 +320,36 @@ RTN
321 320
 
322 321
 	~tileview.x #0002 SUB2 ~tileview.y #0002 SUB2 ~tileview.x #0080 ADD2 ~tileview.y #0081 ADD2 #03 ,line-rect JSR2
323 322
 
324
-	~tileview.x #0028 ADD2 =Sprite.x
325
-	~tileview.y #0010 SUB2 =Sprite.y
326
-	~tileview.addr =Sprite.addr
327
-	#03 =Sprite.color
323
+	~tileview.x #0028 ADD2 =Screen.x
324
+	~tileview.y #0010 SUB2 =Screen.y
325
+	~tileview.addr =Screen.addr
326
+	#23 =Screen.color
328 327
 
329 328
 	( position )
330 329
 
331
-	~tileview.x =Sprite.x
332
-	~tileview.y #0010 SUB2 =Sprite.y
330
+	~tileview.x =Screen.x
331
+	~tileview.y #0010 SUB2 =Screen.y
333 332
 	~tileview.addr ,draw-short JSR2
334 333
 
335 334
 	( body )
336 335
 
337
-	~tileview.x =Sprite.x
338
-	~tileview.y =Sprite.y
336
+	~tileview.x =Screen.x
337
+	~tileview.y =Screen.y
339 338
 	~tileview.addr =tileview.addr
340 339
 	,draw-tileview-icn JSR2
341 340
 
342
-	~tileview.x #0040 ADD2 =Sprite.x
343
-	~tileview.y =Sprite.y
341
+	~tileview.x #0040 ADD2 =Screen.x
342
+	~tileview.y =Screen.y
344 343
 	~tileview.addr 8+ =tileview.addr
345 344
 	,draw-tileview-icn JSR2
346 345
 
347
-	~tileview.x =Sprite.x
348
-	~tileview.y #0040 ADD2 =Sprite.y
346
+	~tileview.x =Screen.x
347
+	~tileview.y #0040 ADD2 =Screen.y
349 348
 	~tileview.addr 8+ =tileview.addr
350 349
 	,draw-tileview-icn JSR2
351 350
 
352
-	~tileview.x #0040 ADD2 =Sprite.x
353
-	~tileview.y #0040 ADD2 =Sprite.y
351
+	~tileview.x #0040 ADD2 =Screen.x
352
+	~tileview.y #0040 ADD2 =Screen.y
354 353
 	~tileview.addr 8+ =tileview.addr
355 354
 	,draw-tileview-icn JSR2
356 355
 
... ...
@@ -374,43 +373,43 @@ RTN
374 373
 
375 374
 	( bytes )
376 375
 
377
-	~tileview.y #0018 ADD2 =Sprite.y
376
+	~tileview.y #0018 ADD2 =Screen.y
378 377
 	#00 =i
379 378
 	$bytes
380
-		~tileview.x #0088 ADD2 =Sprite.x
381
-		,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
382
-		( draw ) #02 =Sprite.color
383
-		~Sprite.x 8+ =Sprite.x
384
-		,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
385
-		( draw ) #02 =Sprite.color
379
+		~tileview.x #0088 ADD2 =Screen.x
380
+		,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
381
+		( draw ) #22 =Screen.color
382
+		~Screen.x 8+ =Screen.x
383
+		,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #0f AND #08 MUL ADD2 =Screen.addr
384
+		( draw ) #22 =Screen.color
386 385
 		( incr ) ~i #01 ADD =i
387
-		( incr ) ~Sprite.y 8+ =Sprite.y
386
+		( incr ) ~Screen.y 8+ =Screen.y
388 387
 	~i #08 LTH ,$bytes JNZ2
389 388
 
390 389
 	( operations )
391 390
 
392
-	~Sprite.y 8+ =Sprite.y
393
-	,movedown_icn =Sprite.addr
394
-	#01 =Sprite.color
395
-	~Sprite.x 8- =Sprite.x
396
-	,moveup_icn =Sprite.addr
397
-	#01 =Sprite.color
391
+	~Screen.y 8+ =Screen.y
392
+	,movedown_icn =Screen.addr
393
+	#21 =Screen.color
394
+	~Screen.x 8- =Screen.x
395
+	,moveup_icn =Screen.addr
396
+	#21 =Screen.color
398 397
 
399 398
 	( draw tiles )
400
-	~tileview.y =Sprite.y
401
-	#00 =pt.x #00 =pt.y ~tileview.addr =Sprite.addr
399
+	~tileview.y =Screen.y
400
+	#00 =pt.x #00 =pt.y ~tileview.addr =Screen.addr
402 401
 
403 402
 	$tiles-ver
404 403
 		#00 =pt.x
405
-		~tileview.x #0088 ADD2 =Sprite.x
404
+		~tileview.x #0088 ADD2 =Screen.x
406 405
 		$tiles-hor
407
-			( draw ) #03 =Sprite.color
408
-			( incr ) ~Sprite.x 8+ =Sprite.x
409
-			( incr ) ~Sprite.addr 8+ =Sprite.addr
406
+			( draw ) #23 =Screen.color
407
+			( incr ) ~Screen.x 8+ =Screen.x
408
+			( incr ) ~Screen.addr 8+ =Screen.addr
410 409
 			( incr ) ~pt.x #01 ADD =pt.x
411 410
 			~pt.x #02 LTH ,$tiles-hor JNZ2
412 411
 		( incr ) ~pt.y #01 ADD =pt.y
413
-		( incr ) ~Sprite.y 8+ =Sprite.y
412
+		( incr ) ~Screen.y 8+ =Screen.y
414 413
 		~pt.y #02 LTH ,$tiles-ver JNZ2
415 414
 
416 415
 RTN
... ...
@@ -424,14 +423,14 @@ RTN
424 423
 			( get bit )
425 424
 			,blank_icn #00
426 425
 			~tileview.addr #00 ~pt.y ADD2 PEK2 #07 ~pt.x SUB SFT #01 AND ( get bit )
427
-			8* ADD2 =Sprite.addr ( add *8 )
428
-			( draw ) #01 =Sprite.color
429
-			( incr ) ~Sprite.x 8+ =Sprite.x
426
+			8* ADD2 =Screen.addr ( add *8 )
427
+			( draw ) #21 =Screen.color
428
+			( incr ) ~Screen.x 8+ =Screen.x
430 429
 			( incr ) ~pt.x #01 ADD =pt.x
431 430
 			~pt.x #08 LTH ,$hor JNZ2
432
-		( incr ) ~Sprite.y 8+ =Sprite.y
431
+		( incr ) ~Screen.y 8+ =Screen.y
433 432
 		( incr ) ~pt.y #01 ADD =pt.y
434
-		~Sprite.x #0040 SUB2 =Sprite.x
433
+		~Screen.x #0040 SUB2 =Screen.x
435 434
 		~pt.y #08 LTH ,$ver JNZ2
436 435
 
437 436
 RTN
... ...
@@ -444,37 +443,37 @@ RTN
444 443
 	#0000 EQU2 RTN? ( Return if unchanged )
445 444
 
446 445
 	( clear last cursor )
447
-	~mouse.x =Sprite.x
448
-	~mouse.y =Sprite.y
449
-	,blank_icn =Sprite.addr
450
-	#10 =Sprite.color
446
+	~mouse.x =Screen.x
447
+	~mouse.y =Screen.y
448
+	,blank_icn =Screen.addr
449
+	#30 =Screen.color
451 450
 
452 451
 	( record mouse positions )
453 452
 	~Mouse.x =mouse.x 
454 453
 	~Mouse.y =mouse.y
455 454
 
456 455
 	( draw new cursor )
457
-	~mouse.x =Sprite.x
458
-	~mouse.y =Sprite.y
459
-	,tool_selector #00 ~bankview.mode #08 MUL ADD2 =Sprite.addr
460
-	#12 =Sprite.color
456
+	~mouse.x =Screen.x
457
+	~mouse.y =Screen.y
458
+	,tool_selector #00 ~bankview.mode #08 MUL ADD2 =Screen.addr
459
+	#32 =Screen.color
461 460
 
462 461
 RTN
463 462
 
464 463
 @draw-short ( short )
465 464
 
466 465
 	=addr
467
-	,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
468
-	( draw ) #02 =Sprite.color
469
-	~Sprite.x 8+ =Sprite.x
470
-	,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
471
-	( draw ) #02 =Sprite.color
472
-	~Sprite.x 8+ =Sprite.x
473
-	,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
474
-	( draw ) #02 =Sprite.color
475
-	~Sprite.x 8+ =Sprite.x
476
-	,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr
477
-	( draw ) #02 =Sprite.color
466
+	,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
467
+	( draw ) #22 =Screen.color
468
+	~Screen.x 8+ =Screen.x
469
+	,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Screen.addr
470
+	( draw ) #22 =Screen.color
471
+	~Screen.x 8+ =Screen.x
472
+	,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
473
+	( draw ) #22 =Screen.color
474
+	~Screen.x 8+ =Screen.x
475
+	,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Screen.addr
476
+	( draw ) #22 =Screen.color
478 477
 
479 478
 RTN
480 479
 
... ...
@@ -13,8 +13,7 @@
13 13
 
14 14
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
15 15
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
16
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
17
-|0130 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
16
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
18 17
 |01a0 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dotw 1 doty 2 isdst 1 pad 4 refresh 1 }
19 18
 
20 19
 ( program )
... ...
@@ -50,7 +49,7 @@
50 49
 	,neralie-lines JSR2
51 50
 	BRK
52 51
 
53
-	#02 =Sprite.color
52
+	#22 =Screen.color
54 53
 	#0000 #00 ~number.count DUP2 ,h JSR2
55 54
 	~number.count #01 ADD =number.count
56 55
 
... ...
@@ -76,8 +75,8 @@
76 75
 	JMP2r
77 76
 
78 77
 @arvelie-text ( -- )
79
-	~Screen.width #0002 DIV2 #0034 SUB2 =Sprite.x
80
-	~Screen.height #0008 SUB2 =Sprite.y
78
+	~Screen.width #0002 DIV2 #0034 SUB2 =Screen.x
79
+	~Screen.height #0008 SUB2 =Screen.y
81 80
 	~DateTime.year #07d6 SUB2
82 81
 	#000a ,modf JSR2 ,digit JSR2
83 82
 	                 ,digit JSR2
... ...
@@ -88,7 +87,7 @@
88 87
 	JMP2r
89 88
 
90 89
 @neralie-text ( -- )
91
-	~Screen.width #0002 DIV2 #0004 SUB2 =Sprite.x
90
+	~Screen.width #0002 DIV2 #0004 SUB2 =Screen.x
92 91
 	~neralie.n0123
93 92
 	#03e8 ,modf JSR2 ^digit JSR
94 93
 	#0064 ,modf JSR2 ^digit JSR
... ...
@@ -100,14 +99,14 @@
100 99
 	JMP2r
101 100
 
102 101
 @letter ( index* -- )
103
-	#0008 MUL2 ,font-letters ADD2 =Sprite.addr
102
+	#0008 MUL2 ,font-letters ADD2 =Screen.addr
104 103
 	^digit-middle JMP
105 104
 
106 105
 @digit ( index* -- )
107
-	#0008 MUL2 ,font-numbers ADD2 =Sprite.addr
106
+	#0008 MUL2 ,font-numbers ADD2 =Screen.addr
108 107
 	$middle
109
-	~neralie.color =Sprite.color
110
-	~Sprite.x #0008 ADD2 =Sprite.x
108
+	~neralie.color #20 ADD =Screen.color
109
+	~Screen.x #0008 ADD2 =Screen.x
111 110
 	JMP2r
112 111
 
113 112
 @neralie-lines ( -- )
... ...
@@ -116,14 +115,14 @@
116 115
 
117 116
 	,neralie.n4 SWP POP ~neralie.n0123
118 117
 	DUP2 ,$h JSR2
119
-	,$next JSR2 #0001 =Sprite.x ~neralie.y #0003 SUB2 =Sprite.y ^digit JSR
118
+	,$next JSR2 #0001 =Screen.x ~neralie.y #0003 SUB2 =Screen.y ^digit JSR
120 119
 	DUP2 ,$v JSR2
121 120
 	#04 ,v-spacing POK2
122 121
 	~lines.y1 #0003 SUB2 ~neralie.y ~neralie.x ,v JSR2
123 122
 	#01 ,v-spacing POK2
124
-	^$next JSR #0001 =Sprite.y ~neralie.x #0003 SUB2 =Sprite.x ,digit JSR2
123
+	^$next JSR #0001 =Screen.y ~neralie.x #0003 SUB2 =Screen.x ,digit JSR2
125 124
 	DUP2 ^$h JSR
126
-	^$next JSR ~Screen.width #0009 SUB2 =Sprite.x ~neralie.y #0003 SUB2 =Sprite.y ,digit JSR2
125
+	^$next JSR ~Screen.width #0009 SUB2 =Screen.x ~neralie.y #0003 SUB2 =Screen.y ,digit JSR2
127 126
 	DUP2 ^$v JSR
128 127
 	^$next JSR POP2
129 128
 	DUP2 ^$h JSR
... ...
@@ -53,8 +53,7 @@
53 53
 
54 54
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
55 55
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
56
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
57
-|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
56
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
58 57
 |0140 ;Controller { vector 2 button 1 }
59 58
 |0150 ;Keys { vector 2 key 1 }
60 59
 |0160 ;Mouse  { vector 2 x 2 y 2 state 1 chord 1 }
... ...
@@ -99,12 +98,12 @@ BRK
99 98
 @on-screen ( -- )
100 99
 	
101 100
 	~document.edit #01 NEQ ^$no-edit JNZ
102
-		#0008 =Sprite.x 
103
-		~Screen.height #0010 SUB2 =Sprite.y
101
+		#0008 =Screen.x 
102
+		~Screen.height #0010 SUB2 =Screen.y
104 103
 		,path.name #01 ~timer #04 DIV #03 AND #03 MUL ADD ,draw-label JSR2
105 104
 		$clear
106
-			#00 =Sprite.color
107
-			~Sprite.x 8+ DUP2 =Sprite.x
105
+			#20 =Screen.color
106
+			~Screen.x 8+ DUP2 =Screen.x
108 107
 			~Screen.width LTH2 ^$clear JNZ
109 108
 		( blink ) ~timer #01 ADD =timer
110 109
 	$no-edit
... ...
@@ -623,37 +622,37 @@ RTN
623 622
 	
624 623
 	~zoom.active #01 EQU ,draw-canvas-zoom JNZ2
625 624
 
626
-	~canvas.y1 =Sprite.y
627
-	,data =Sprite.addr
625
+	~canvas.y1 =Screen.y
626
+	,data =Screen.addr
628 627
 	$ver
629
-		~canvas.x1 =Sprite.x 
628
+		~canvas.x1 =Screen.x 
630 629
 		$hor
631
-			( draw ) #09 =Sprite.color
632
-			( incr ) ~Sprite.x 8+ =Sprite.x
633
-			( incr ) ~Sprite.addr 8+ =Sprite.addr
634
-		~Sprite.x ~canvas.x2 NEQ2 ^$hor JNZ
635
-		( incr ) ~Sprite.y 8+ =Sprite.y
636
-	~Sprite.y ~canvas.y2 NEQ2 ^$ver JNZ
630
+			( draw ) #29 =Screen.color
631
+			( incr ) ~Screen.x 8+ =Screen.x
632
+			( incr ) ~Screen.addr 8+ =Screen.addr
633
+		~Screen.x ~canvas.x2 NEQ2 ^$hor JNZ
634
+		( incr ) ~Screen.y 8+ =Screen.y
635
+	~Screen.y ~canvas.y2 NEQ2 ^$ver JNZ
637 636
 
638 637
 RTN
639 638
 
640 639
 @draw-canvas-zoom ( -- )
641 640
 	
642 641
 	~zoom.y =pt1.y
643
-	~canvas.y1 =Sprite.y
644
-	,data =Sprite.addr
642
+	~canvas.y1 =Screen.y
643
+	,data =Screen.addr
645 644
 	$ver
646
-		~canvas.x1 =Sprite.x 
645
+		~canvas.x1 =Screen.x 
647 646
 		~zoom.x =pt1.x
648 647
 		$hor
649
-			( incr ) ,bigpixel_icn #0008 #00 ~pt1.x ~pt1.y ,get-pixel JSR2 MUL2 ADD2 =Sprite.addr
650
-			( draw ) #09 =Sprite.color
651
-			( incr ) ~Sprite.x 8+ =Sprite.x
648
+			( incr ) ,bigpixel_icn #0008 #00 ~pt1.x ~pt1.y ,get-pixel JSR2 MUL2 ADD2 =Screen.addr
649
+			( draw ) #29 =Screen.color
650
+			( incr ) ~Screen.x 8+ =Screen.x
652 651
 			( incr ) ~pt1.x ++ =pt1.x
653
-		~Sprite.x ~canvas.x2 NEQ2 ^$hor JNZ
654
-		( incr ) ~Sprite.y 8+ =Sprite.y
652
+		~Screen.x ~canvas.x2 NEQ2 ^$hor JNZ
653
+		( incr ) ~Screen.y 8+ =Screen.y
655 654
 		( incr ) ~pt1.y ++ =pt1.y
656
-	~Sprite.y ~canvas.y2 NEQ2 ^$ver JNZ
655
+	~Screen.y ~canvas.y2 NEQ2 ^$ver JNZ
657 656
 
658 657
 RTN
659 658
 
... ...
@@ -666,11 +665,11 @@ RTN
666 665
 	#00 NEQ 
667 666
 	#0101 EQU2 RTN? ( Return if unchanged )
668 667
 
669
-	,blank_icn =Sprite.addr
668
+	,blank_icn =Screen.addr
670 669
 	( clear brush size )
671
-	~cursor.x #0003 SUB2 =Sprite.x ~cursor.y #0003 SUB2 =Sprite.y #10 =Sprite.color
670
+	~cursor.x #0003 SUB2 =Screen.x ~cursor.y #0003 SUB2 =Screen.y #30 =Screen.color
672 671
 	( clear last cursor )
673
-	~cursor.x =Sprite.x ~cursor.y =Sprite.y #10 =Sprite.color
672
+	~cursor.x =Screen.x ~cursor.y =Screen.y #30 =Screen.color
674 673
 	( record cursor positions )
675 674
 	~Mouse.x =cursor.x ~Mouse.y =cursor.y
676 675
 	( draw size cursor )
... ...
@@ -683,15 +682,15 @@ RTN
683 682
 	~Mouse.x CLN2r ~toolpane.x1 GTH2 STH2r ~toolpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~toolpane.y1 GTH2 STH2r ~toolpane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2
684 683
 	~Mouse.x CLN2r ~sizepane.x1 GTH2 STH2r ~sizepane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~sizepane.y1 GTH2 STH2r ~sizepane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2
685 684
 	~Mouse.x CLN2r ~pattpane.x1 GTH2 STH2r ~pattpane.x2 LTH2 #0101 EQU2 ~Mouse.y CLN2r ~pattpane.y1 GTH2 STH2r ~pattpane.y2 LTH2 #0101 EQU2 #0101 EQU2 ,$outside-canvas JNZ2
686
-		~cursor.x #0003 SUB2 =Sprite.x ~cursor.y #0003 SUB2 =Sprite.y
687
-		,brush_icns #00 ~brush.size 8* ADD2 =Sprite.addr
688
-		#11 ~Mouse.state #02 MUL ADD =Sprite.color
685
+		~cursor.x #0003 SUB2 =Screen.x ~cursor.y #0003 SUB2 =Screen.y
686
+		,brush_icns #00 ~brush.size 8* ADD2 =Screen.addr
687
+		#31 ~Mouse.state #02 MUL ADD =Screen.color
689 688
 		~Mouse.state #00 EQU ^$outside-canvas JNZ RTN
690 689
 	$outside-canvas
691 690
 	( draw new cursor )
692
-	~cursor.x =Sprite.x ~cursor.y =Sprite.y
693
-	,pointers_icn #00 ~Controller.button #02 EQU 8* ADD2 =Sprite.addr
694
-	#1f ~Mouse.state #01 EQU #0a MUL SUB =Sprite.color
691
+	~cursor.x =Screen.x ~cursor.y =Screen.y
692
+	,pointers_icn #00 ~Controller.button #02 EQU 8* ADD2 =Screen.addr
693
+	#3f ~Mouse.state #01 EQU #0a MUL SUB =Screen.color
695 694
 
696 695
 RTN
697 696
 
... ...
@@ -703,18 +702,18 @@ RTN
703 702
 	~toolpane.x1 -- ~toolpane.y1 -- ~toolpane.x2 ~toolpane.y2 #00 ,line-rect JSR2
704 703
 	~toolpane.x1 #0002 SUB2 ~toolpane.y1 #0002 SUB2 ~toolpane.x2 ~toolpane.y2 #01 ,line-rect JSR2
705 704
 
706
-	~toolpane.x1 =Sprite.x ~toolpane.y1 =Sprite.y ,tool_icns =Sprite.addr
705
+	~toolpane.x1 =Screen.x ~toolpane.y1 =Screen.y ,tool_icns =Screen.addr
707 706
 
708 707
 	$loop
709
-		( draw ) #01 ~Sprite.x ~toolpane.x1 SUB2 8/ SWP POP ~brush.tool EQU #02 MUL ADD =Sprite.color
710
-		( incr ) ~Sprite.x 8+ =Sprite.x
711
-		( incr ) ~Sprite.addr 8+ =Sprite.addr
712
-		~Sprite.x ~toolpane.x2 LTH2 ^$loop JNZ
708
+		( draw ) #21 ~Screen.x ~toolpane.x1 SUB2 8/ SWP POP ~brush.tool EQU #02 MUL ADD =Screen.color
709
+		( incr ) ~Screen.x 8+ =Screen.x
710
+		( incr ) ~Screen.addr 8+ =Screen.addr
711
+		~Screen.x ~toolpane.x2 LTH2 ^$loop JNZ
713 712
 
714 713
 	~zoom.active #01 NEQ ^$no-zoom JNZ
715
-		~Sprite.x #0008 SUB2 =Sprite.x
716
-		,tool_icns #0028 ADD2 =Sprite.addr
717
-		#01 #04 ~brush.tool EQU #02 MUL ADD =Sprite.color
714
+		~Screen.x #0008 SUB2 =Screen.x
715
+		,tool_icns #0028 ADD2 =Screen.addr
716
+		#21 #04 ~brush.tool EQU #02 MUL ADD =Screen.color
718 717
 		$no-zoom
719 718
 
720 719
 RTN
... ...
@@ -727,13 +726,13 @@ RTN
727 726
 	~pattpane.x1 -- ~pattpane.y1 -- ~pattpane.x2 ~pattpane.y2 #00 ,line-rect JSR2
728 727
 	~pattpane.x1 #0002 SUB2 ~pattpane.y1 #0002 SUB2 ~pattpane.x2 ~pattpane.y2 #01 ,line-rect JSR2
729 728
 
730
-	~pattpane.x1 =Sprite.x ~pattpane.y1 =Sprite.y ,patt_icns =Sprite.addr
729
+	~pattpane.x1 =Screen.x ~pattpane.y1 =Screen.y ,patt_icns =Screen.addr
731 730
 
732 731
 	$loop
733
-		( draw ) #01 ~Sprite.x ~pattpane.x1 SUB2 8/ SWP POP ~brush.patt EQU #02 MUL ADD =Sprite.color
734
-		( incr ) ~Sprite.x 8+ =Sprite.x
735
-		( incr ) ~Sprite.addr 8+ =Sprite.addr
736
-		~Sprite.x ~pattpane.x2 LTH2 ^$loop JNZ
732
+		( draw ) #21 ~Screen.x ~pattpane.x1 SUB2 8/ SWP POP ~brush.patt EQU #02 MUL ADD =Screen.color
733
+		( incr ) ~Screen.x 8+ =Screen.x
734
+		( incr ) ~Screen.addr 8+ =Screen.addr
735
+		~Screen.x ~pattpane.x2 LTH2 ^$loop JNZ
737 736
 
738 737
 RTN
739 738
 
... ...
@@ -745,13 +744,13 @@ RTN
745 744
 	~sizepane.x1 -- ~sizepane.y1 -- ~sizepane.x2 ~sizepane.y2 #00 ,line-rect JSR2
746 745
 	~sizepane.x1 #0002 SUB2 ~sizepane.y1 #0002 SUB2 ~sizepane.x2 ~sizepane.y2 #01 ,line-rect JSR2
747 746
 
748
-	~sizepane.x1 =Sprite.x ~sizepane.y1 =Sprite.y ,size_icns =Sprite.addr
747
+	~sizepane.x1 =Screen.x ~sizepane.y1 =Screen.y ,size_icns =Screen.addr
749 748
 
750 749
 	$loop
751
-		( draw ) #01 ~Sprite.x ~sizepane.x1 SUB2 8/ SWP POP ~brush.size EQU #02 MUL ADD =Sprite.color
752
-		( incr ) ~Sprite.x 8+ =Sprite.x
753
-		( incr ) ~Sprite.addr 8+ =Sprite.addr
754
-		~Sprite.x ~sizepane.x2 LTH2 ^$loop JNZ
750
+		( draw ) #21 ~Screen.x ~sizepane.x1 SUB2 8/ SWP POP ~brush.size EQU #02 MUL ADD =Screen.color
751
+		( incr ) ~Screen.x 8+ =Screen.x
752
+		( incr ) ~Screen.addr 8+ =Screen.addr
753
+		~Screen.x ~sizepane.x2 LTH2 ^$loop JNZ
755 754
 
756 755
 RTN
757 756
 
... ...
@@ -763,13 +762,13 @@ RTN
763 762
 	~viewpane.x1 -- ~viewpane.y1 -- ~viewpane.x2 ~viewpane.y2 #00 ,line-rect JSR2
764 763
 	~viewpane.x1 #0002 SUB2 ~viewpane.y1 #0002 SUB2 ~viewpane.x2 ~viewpane.y2 #01 ,line-rect JSR2
765 764
 
766
-	~viewpane.x1 =Sprite.x ~viewpane.y1 =Sprite.y ,view_icns =Sprite.addr
765
+	~viewpane.x1 =Screen.x ~viewpane.y1 =Screen.y ,view_icns =Screen.addr
767 766
 
768 767
 	$loop
769
-		( draw ) #01 =Sprite.color
770
-		( incr ) ~Sprite.x 8+ =Sprite.x
771
-		( incr ) ~Sprite.addr 8+ =Sprite.addr
772
-		~Sprite.x ~viewpane.x2 LTH2 ^$loop JNZ
768
+		( draw ) #21 =Screen.color
769
+		( incr ) ~Screen.x 8+ =Screen.x
770
+		( incr ) ~Screen.addr 8+ =Screen.addr
771
+		~Screen.x ~viewpane.x2 LTH2 ^$loop JNZ
773 772
 
774 773
 RTN
775 774
 
... ...
@@ -791,35 +790,35 @@ RTN
791 790
 
792 791
 	~document.presentation #01 EQU ,$skip-size JNZ2
793 792
 		( draw size )
794
-		#0010 =Sprite.y
793
+		#0010 =Screen.y
795 794
 		( draw width )
796
-		~Screen.width #00a0 SUB2 =Sprite.x ,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
797
-		( draw ) #01 =Sprite.color
798
-		~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr
799
-		( draw ) #01 =Sprite.color
795
+		~Screen.width #00a0 SUB2 =Screen.x ,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
796
+		( draw ) #21 =Screen.color
797
+		~Screen.x 8+ =Screen.x ,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Screen.addr
798
+		( draw ) #21 =Screen.color
800 799
 		( draw height )
801
-		~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr
802
-		( draw ) #01 =Sprite.color
803
-		~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr
804
-		( draw ) #01 =Sprite.color
800
+		~Screen.x 8+ =Screen.x ,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
801
+		( draw ) #21 =Screen.color
802
+		~Screen.x 8+ =Screen.x ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Screen.addr
803
+		( draw ) #21 =Screen.color
805 804
 	$skip-size
806 805
 
807 806
 	( draw save/load/guides icons )
808
-	~Screen.height #0010 SUB2 =Sprite.y
809
-	~Screen.width #0028 SUB2 =Sprite.x
810
-	,eye_icn #00 ~document.presentation #08 MUL ADD2 =Sprite.addr
811
-	#03 =Sprite.color
812
-	~Sprite.x 8+ =Sprite.x
813
-	,filestate_icn =Sprite.addr
814
-	#03 =Sprite.color
815
-	~Sprite.x 8+ =Sprite.x
816
-	,load_icn =Sprite.addr
817
-	#03 =Sprite.color
818
-	~Sprite.x 8+ =Sprite.x
819
-	,save_icn =Sprite.addr
820
-	#03 =Sprite.color
807
+	~Screen.height #0010 SUB2 =Screen.y
808
+	~Screen.width #0028 SUB2 =Screen.x
809
+	,eye_icn #00 ~document.presentation #08 MUL ADD2 =Screen.addr
810
+	#23 =Screen.color
811
+	~Screen.x 8+ =Screen.x
812
+	,filestate_icn =Screen.addr
813
+	#23 =Screen.color
814
+	~Screen.x 8+ =Screen.x
815
+	,load_icn =Screen.addr
816
+	#23 =Screen.color
817
+	~Screen.x 8+ =Screen.x
818
+	,save_icn =Screen.addr
819
+	#23 =Screen.color
821 820
 	
822
-	#0008 =Sprite.x
821
+	#0008 =Screen.x
823 822
 	,path.name #01 ,draw-label JSR2
824 823
 
825 824
 RTN
... ...
@@ -861,10 +860,10 @@ RTN
861 860
 	
862 861
 	=color 
863 862
 	$loop
864
-		DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr
865
-		( draw ) ~color =Sprite.color
863
+		DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr
864
+		( draw ) ~color #20 ADD =Screen.color
866 865
 		( incr ) #0001 ADD2
867
-		( incr ) ~Sprite.x 8+ =Sprite.x
866
+		( incr ) ~Screen.x 8+ =Screen.x
868 867
 		( loop ) DUP2 PEK2 #00 NEQ ^$loop JNZ
869 868
 	POP2
870 869
 
... ...
@@ -28,7 +28,7 @@
28 28
 
29 29
 |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
30 30
 |0110 ;Console { pad 8 char 1 byte 1 short 2 }
31
-|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
31
+|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
32 32
 |0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
33 33
 |0140 ;Controller { vector 2 button 1 }
34 34
 |0150 ;Keys { vector 2 key 1 }
... ...
@@ -210,29 +210,15 @@ console_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
210 210
 Uint8
211 211
 screen_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
212 212
 {
213
-	Uint8 *m = u->ram.dat;
214
-	ptr += 8;
215
-	if(b0 == 0x0c) {
216
-		Uint16 x = (m[ptr] << 8) + m[ptr + 1];
217
-		Uint16 y = (m[ptr + 2] << 8) + m[ptr + 3];
218
-		Uint8 *layer = b1 >> 4 & 0xf ? ppu.fg : ppu.bg;
219
-		putpixel(&ppu, layer, x, y, b1 & 0xf);
220
-		reqdraw = 1;
221
-	}
222
-	return b1;
223
-}
224
-
225
-Uint8
226
-sprite_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
227
-{
228
-	Uint8 *m = u->ram.dat;
229
-	ptr += 8;
230 213
 	if(b0 == 0x0e) {
231
-		Uint16 x = (m[ptr] << 8) + m[ptr + 1];
232
-		Uint16 y = (m[ptr + 2] << 8) + m[ptr + 3];
233
-		Uint8 *layer = (b1 >> 4) & 0xf ? ppu.fg : ppu.bg;
234
-		Uint8 *sprite = &m[(m[ptr + 4] << 8) + m[ptr + 5]];
235
-		putsprite(&ppu, layer, x, y, sprite, b1 & 0xf);
214
+		Uint16 x = mempeek16(u, ptr + 8);
215
+		Uint16 y = mempeek16(u, ptr + 10);
216
+		Uint8 *addr = &u->ram.dat[mempeek16(u, ptr + 12)];
217
+		Uint8 *layer = (b1 >> 4 & 0xf) % 2 ? ppu.fg : ppu.bg;
218
+		if((b1 >> 4 & 0xf) / 2)
219
+			putsprite(&ppu, layer, x, y, addr, b1 & 0xf);
220
+		else
221
+			putpixel(&ppu, layer, x, y, b1 & 0xf);
236 222
 		reqdraw = 1;
237 223
 	}
238 224
 	return b1;
... ...
@@ -398,7 +384,7 @@ main(int argc, char **argv)
398 384
 	devsystem = portuxn(&u, 0x00, "system", system_poke);
399 385
 	portuxn(&u, 0x01, "console", console_poke);
400 386
 	devscreen = portuxn(&u, 0x02, "screen", screen_poke);
401
-	portuxn(&u, 0x03, "sprite", sprite_poke);
387
+	portuxn(&u, 0x03, "---", ppnil);
402 388
 	devctrl = portuxn(&u, 0x04, "controller", ppnil);
403 389
 	devkey = portuxn(&u, 0x05, "key", ppnil);
404 390
 	devmouse = portuxn(&u, 0x06, "mouse", ppnil);
... ...
@@ -46,5 +46,7 @@ int loaduxn(Uxn *c, char *filepath);
46 46
 int bootuxn(Uxn *c);
47 47
 int inituxn(Uxn *u, Uint16 vec);
48 48
 int evaluxn(Uxn *u, Uint16 vec);
49
-Device *portuxn(Uxn *u, Uint8 id, char *name, Uint8 (*pofn)(Uxn *, Uint16, Uint8, Uint8));
50
-void mempoke16(Uxn *u, Uint16 a, Uint16 b);
51 49
\ No newline at end of file
50
+void mempoke16(Uxn *u, Uint16 a, Uint16 b);
51
+Uint16 mempeek16(Uxn *u, Uint16 a);
52
+
53
+Device *portuxn(Uxn *u, Uint8 id, char *name, Uint8 (*pofn)(Uxn *, Uint16, Uint8, Uint8));
52 54
\ No newline at end of file