Merged sprite in screen device

This commit is contained in:
neauoire 2021-04-09 10:01:53 -07:00
parent 79949be735
commit ffded2f642
18 changed files with 597 additions and 632 deletions

View File

@ -32,7 +32,7 @@ else
fi fi
echo "Assembling.." echo "Assembling.."
./bin/assembler projects/software/noodle.usm bin/boot.rom ./bin/assembler projects/examples/gui.shapes.usm bin/boot.rom
echo "Running.." echo "Running.."
if [ "${2}" = '--cli' ]; if [ "${2}" = '--cli' ];

View File

@ -28,8 +28,7 @@
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0140 ;Controller { vector 2 button 1 } |0140 ;Controller { vector 2 button 1 }
|0150 ;Keys { vector 2 key 1 } |0150 ;Keys { vector 2 key 1 }
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
@ -223,14 +222,14 @@ RTN
@move-head ( -- ) @move-head ( -- )
( clear ) ( clear )
~trkframe.y1 8- =Sprite.y ~trkframe.y1 8- =Screen.y
~trkframe.x1 #00 ~head.pos ADD2 =Sprite.x ~trkframe.x1 #00 ~head.pos ADD2 =Screen.x
,head_icn =Sprite.addr ,head_icn =Screen.addr
#00 =Sprite.color #20 =Screen.color
( incr ) ~head.pos #01 ADD =head.pos ( incr ) ~head.pos #01 ADD =head.pos
~trkframe.x1 #00 ~head.pos ADD2 =Sprite.x ~trkframe.x1 #00 ~head.pos ADD2 =Screen.x
,head_icn =Sprite.addr ,head_icn =Screen.addr
#01 ( if note ) TRACK #00 ~head.pos #08 DIV ADD2 PEK2 #00 NEQ ADD =Sprite.color #21 ( if note ) TRACK #00 ~head.pos #08 DIV ADD2 PEK2 #00 NEQ ADD =Screen.color
RTN RTN
@ -239,10 +238,10 @@ RTN
#00 #20 #00 #20
$loop $loop
( load ) OVR #00 SWP TRACK ADD2 PEK2 ( load ) OVR #00 SWP TRACK ADD2 PEK2
DUP STH #00 SWP #0e SWP SUB 8* ~trkframe.y1 ADD2 =Sprite.y DUP STH #00 SWP #0e SWP SUB 8* ~trkframe.y1 ADD2 =Screen.y
OVR #00 SWP 8* ~trkframe.x1 ADD2 =Sprite.x OVR #00 SWP 8* ~trkframe.x1 ADD2 =Screen.x
STHr #00 EQU ^$skip JNZ STHr #00 EQU ^$skip JNZ
#00 =Sprite.color #20 =Screen.color
$skip $skip
( incr ) SWP #01 ADD SWP ( incr ) SWP #01 ADD SWP
DUP2 LTH ^$loop JNZ DUP2 LTH ^$loop JNZ
@ -255,11 +254,11 @@ RTN
#00 #20 #00 #20
$notes-loop $notes-loop
( load ) OVR #00 SWP TRACK ADD2 PEK2 ( load ) OVR #00 SWP TRACK ADD2 PEK2
DUP STH #00 SWP #0e SWP SUB 8* ~trkframe.y1 ADD2 =Sprite.y DUP STH #00 SWP #0e SWP SUB 8* ~trkframe.y1 ADD2 =Screen.y
OVR #00 SWP 8* ~trkframe.x1 ADD2 =Sprite.x OVR #00 SWP 8* ~trkframe.x1 ADD2 =Screen.x
,note_icn =Sprite.addr ,note_icn =Screen.addr
STHr #00 EQU ^$skip JNZ STHr #00 EQU ^$skip JNZ
#05 =Sprite.color #25 =Screen.color
$skip $skip
( incr ) SWP #01 ADD SWP ( incr ) SWP #01 ADD SWP
DUP2 LTH ^$notes-loop JNZ DUP2 LTH ^$notes-loop JNZ
@ -273,14 +272,14 @@ RTN
~trkframe.x1 ~trkframe.y1 ~trkframe.x2 ~trkframe.y2 #01 ,line-rect JSR2 ~trkframe.x1 ~trkframe.y1 ~trkframe.x2 ~trkframe.y2 #01 ,line-rect JSR2
( grid ) ( grid )
~trkframe.y1 #0010 SUB2 =Sprite.y ~trkframe.y1 #0010 SUB2 =Screen.y
,font_hex =Sprite.addr ,font_hex =Screen.addr
#0000 #0100 #0000 #0100
$loop $loop
OVR2 SWP POP #02 DIV #0f AND #00 NEQ ^$skip JNZ OVR2 SWP POP #02 DIV #0f AND #00 NEQ ^$skip JNZ
OVR2 ~trkframe.x1 ADD2 =Sprite.x OVR2 ~trkframe.x1 ADD2 =Screen.x
#02 =Sprite.color #22 =Screen.color
~Sprite.addr 8+ =Sprite.addr ~Screen.addr 8+ =Screen.addr
OVR2 ~trkframe.x1 ADD2 ~trkframe.y1 ++ ~trkframe.y2 #01 ,line-vertical-dotted JSR2 OVR2 ~trkframe.x1 ADD2 ~trkframe.y1 ++ ~trkframe.y2 #01 ,line-vertical-dotted JSR2
$skip $skip
OVR2 ~trkframe.x1 ADD2 ~trkframe.y1 ~trkframe.y2 #01 ,line-vertical-dotted JSR2 OVR2 ~trkframe.x1 ADD2 ~trkframe.y1 ~trkframe.y2 #01 ,line-vertical-dotted JSR2
@ -295,18 +294,18 @@ RTN
@draw-octave ( x y -- ) @draw-octave ( x y -- )
=Sprite.y =Screen.y
=Sprite.x =Screen.x
,octave_icn =Sprite.addr ,octave_icn =Screen.addr
~Sprite.y ~Sprite.y #0038 ADD2 ~Screen.y ~Screen.y #0038 ADD2
$loop $loop
OVR2 =Sprite.y OVR2 =Screen.y
#01 =Sprite.color #21 =Screen.color
~Sprite.addr 8+ =Sprite.addr ~Screen.addr 8+ =Screen.addr
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
#01 =Sprite.color #21 =Screen.color
~Sprite.addr 8+ =Sprite.addr ~Screen.addr 8+ =Screen.addr
~Sprite.x 8- =Sprite.x ~Screen.x 8- =Screen.x
SWP2 8+ SWP2 SWP2 8+ SWP2
OVR2 OVR2 LTH2 ^$loop JNZ OVR2 OVR2 LTH2 ^$loop JNZ
POP2 POP2
@ -318,20 +317,20 @@ RTN
~trkframe.x1 #0018 SUB2 DUP2 ~trkframe.y1 ,draw-octave JSR2 ~trkframe.x1 #0018 SUB2 DUP2 ~trkframe.y1 ,draw-octave JSR2
~trkframe.y1 #0038 ADD2 ,draw-octave JSR2 ~trkframe.y1 #0038 ADD2 ,draw-octave JSR2
~trkframe.x1 #0028 SUB2 =Sprite.x ~trkframe.x1 #0028 SUB2 =Screen.x
~trkframe.y1 #0030 ADD2 =Sprite.y ~trkframe.y1 #0030 ADD2 =Screen.y
,font_hex #0028 ADD2 =Sprite.addr ,font_hex #0028 ADD2 =Screen.addr
#03 =Sprite.color #23 =Screen.color
~trkframe.x1 #0030 SUB2 =Sprite.x ~trkframe.x1 #0030 SUB2 =Screen.x
,font_hex #0060 ADD2 =Sprite.addr ,font_hex #0060 ADD2 =Screen.addr
#03 =Sprite.color #23 =Screen.color
~trkframe.x1 #0028 SUB2 =Sprite.x ~trkframe.x1 #0028 SUB2 =Screen.x
~trkframe.y1 #0068 ADD2 =Sprite.y ~trkframe.y1 #0068 ADD2 =Screen.y
,font_hex #0020 ADD2 =Sprite.addr ,font_hex #0020 ADD2 =Screen.addr
#03 =Sprite.color #23 =Screen.color
~trkframe.x1 #0030 SUB2 =Sprite.x ~trkframe.x1 #0030 SUB2 =Screen.x
,font_hex #0060 ADD2 =Sprite.addr ,font_hex #0060 ADD2 =Screen.addr
#03 =Sprite.color #23 =Screen.color
RTN RTN
@ -345,19 +344,19 @@ RTN
@draw-knob ( x* y* value -- ) @draw-knob ( x* y* value -- )
( load ) =knob.value =knob.y =knob.x ( load ) =knob.value =knob.y =knob.x
~knob.x =Sprite.x ~knob.x =Screen.x
~knob.y =Sprite.y ,knob_icns =Sprite.addr #01 =Sprite.color ~knob.y =Screen.y ,knob_icns =Screen.addr #21 =Screen.color
~knob.x 8+ =Sprite.x ,knob_icns 8+ =Sprite.addr #01 =Sprite.color ~knob.x 8+ =Screen.x ,knob_icns 8+ =Screen.addr #21 =Screen.color
~knob.y 8+ =Sprite.y ,knob_icns #0018 ADD2 =Sprite.addr #01 =Sprite.color ~knob.y 8+ =Screen.y ,knob_icns #0018 ADD2 =Screen.addr #21 =Screen.color
~knob.x =Sprite.x ,knob_icns #0010 ADD2 =Sprite.addr #01 =Sprite.color ~knob.x =Screen.x ,knob_icns #0010 ADD2 =Screen.addr #21 =Screen.color
~knob.x #00 #00 ~knob.value ,knob_offsetx ADD2 PEK2 ADD2 =Sprite.x ~knob.x #00 #00 ~knob.value ,knob_offsetx ADD2 PEK2 ADD2 =Screen.x
~knob.y #00 #00 ~knob.value ,knob_offsety ADD2 PEK2 ADD2 =Sprite.y ~knob.y #00 #00 ~knob.value ,knob_offsety ADD2 PEK2 ADD2 =Screen.y
,knob_icns #0020 ADD2 =Sprite.addr ,knob_icns #0020 ADD2 =Screen.addr
#05 =Sprite.color #25 =Screen.color
~knob.x #0004 ADD2 =Sprite.x ~knob.x #0004 ADD2 =Screen.x
~knob.y #0010 ADD2 =Sprite.y ~knob.y #0010 ADD2 =Screen.y
,font_hex #00 ~knob.value #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~knob.value #08 MUL ADD2 =Screen.addr
#01 =Sprite.color #21 =Screen.color
RTN RTN
@ -365,7 +364,7 @@ RTN
~ctlframe.x1 ~ctlframe.y1 ~ctlframe.x2 ~ctlframe.y2 #01 ,line-rect JSR2 ~ctlframe.x1 ~ctlframe.y1 ~ctlframe.x2 ~ctlframe.y2 #01 ,line-rect JSR2
( env ) ( env )
~ctlframe.x1 8+ ~ctlframe.y1 8+ #02 ,env_txt ,draw-label JSR2 ~ctlframe.x1 8+ ~ctlframe.y1 8+ #22 ,env_txt ,draw-label JSR2
~ctlframe.x1 8+ ~ctlframe.y1 #0010 ADD2 ~ctlframe.x1 8+ ~ctlframe.y1 #0010 ADD2
,adsr #00 ~track.active #04 MUL ADD2 PEK2 #04 SFT ,adsr #00 ~track.active #04 MUL ADD2 PEK2 #04 SFT
,draw-knob JSR2 ,draw-knob JSR2
@ -379,7 +378,7 @@ RTN
,adsr #00 ~track.active #04 MUL ADD2 #0003 ADD2 PEK2 #04 SFT ,adsr #00 ~track.active #04 MUL ADD2 #0003 ADD2 PEK2 #04 SFT
,draw-knob JSR2 ,draw-knob JSR2
( vol ) ( vol )
~ctlframe.x1 #0058 ADD2 ~ctlframe.y1 8+ #02 ,vol_txt ,draw-label JSR2 ~ctlframe.x1 #0058 ADD2 ~ctlframe.y1 8+ #22 ,vol_txt ,draw-label JSR2
~ctlframe.x1 #0058 ADD2 ~ctlframe.y1 #0010 ADD2 ~ctlframe.x1 #0058 ADD2 ~ctlframe.y1 #0010 ADD2
,volume #00 ~track.active ADD2 PEK2 #04 SFT ,volume #00 ~track.active ADD2 PEK2 #04 SFT
,draw-knob JSR2 ,draw-knob JSR2
@ -392,27 +391,27 @@ RTN
@draw-channels @draw-channels
~chnframe.x1 ~chnframe.y1 ~chnframe.x2 ~chnframe.y2 #01 ,line-rect JSR2 ~chnframe.x1 ~chnframe.y1 ~chnframe.x2 ~chnframe.y2 #01 ,line-rect JSR2
~chnframe.x1 8+ ~chnframe.y1 8+ #01 ~track.active #00 EQU #07 MUL ADD ,ch1_txt ,draw-label JSR2 ~chnframe.x1 8+ ~chnframe.y1 8+ #21 ~track.active #00 EQU #07 MUL ADD ,ch1_txt ,draw-label JSR2
~chnframe.x1 8+ ~chnframe.y1 #0010 ADD2 #01 ~track.active #01 EQU #07 MUL ADD ,ch2_txt ,draw-label JSR2 ~chnframe.x1 8+ ~chnframe.y1 #0010 ADD2 #21 ~track.active #01 EQU #07 MUL ADD ,ch2_txt ,draw-label JSR2
~chnframe.x1 8+ ~chnframe.y1 #0018 ADD2 #01 ~track.active #02 EQU #07 MUL ADD ,ch3_txt ,draw-label JSR2 ~chnframe.x1 8+ ~chnframe.y1 #0018 ADD2 #21 ~track.active #02 EQU #07 MUL ADD ,ch3_txt ,draw-label JSR2
~chnframe.x1 8+ ~chnframe.y1 #0020 ADD2 #01 ~track.active #03 EQU #07 MUL ADD ,ch4_txt ,draw-label JSR2 ~chnframe.x1 8+ ~chnframe.y1 #0020 ADD2 #21 ~track.active #03 EQU #07 MUL ADD ,ch4_txt ,draw-label JSR2
RTN RTN
@draw-cursor ( -- ) @draw-cursor ( -- )
( clear last cursor ) ( clear last cursor )
,clear_icn =Sprite.addr ,clear_icn =Screen.addr
~pointer.x =Sprite.x ~pointer.x =Screen.x
~pointer.y =Sprite.y ~pointer.y =Screen.y
#10 =Sprite.color #30 =Screen.color
( record pointer positions ) ( record pointer positions )
~Mouse.x =pointer.x ~Mouse.y =pointer.y ~Mouse.x =pointer.x ~Mouse.y =pointer.y
( draw new cursor ) ( draw new cursor )
,cursor_icn =Sprite.addr ,cursor_icn =Screen.addr
~pointer.x =Sprite.x ~pointer.x =Screen.x
~pointer.y =Sprite.y ~pointer.y =Screen.y
#12 ~Mouse.state #00 NEQ ADD =Sprite.color #32 ~Mouse.state #00 NEQ ADD =Screen.color
RTN RTN
@ -420,12 +419,12 @@ RTN
@draw-label ( x y color addr -- ) @draw-label ( x y color addr -- )
( load ) =label.addr =label.color =Sprite.y =Sprite.x ( load ) =label.addr =label.color =Screen.y =Screen.x
~label.addr ~label.addr
$loop $loop
( draw ) DUP2 PEK2 #00 SWP 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP 8* ,font ADD2 =Screen.addr ~label.color =Screen.color
( incr ) ++ ( incr ) ++
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
DUP2 PEK2 #00 NEQ ^$loop JNZ DUP2 PEK2 #00 NEQ ^$loop JNZ
POP2 POP2

View File

@ -11,8 +11,7 @@
( devices ) ( devices )
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0140 ;Controller { vector 2 p1 1 } |0140 ;Controller { vector 2 p1 1 }
|0200 |0200
@ -21,46 +20,46 @@
( vectors ) ,FRAME =Screen.vector ( vectors ) ,FRAME =Screen.vector
( set origin ) ( set origin )
~Screen.width 2/ =Sprite.x ~Screen.width 2/ =Screen.x
~Screen.height 2/ =Sprite.y ~Screen.height 2/ =Screen.y
,default_icn =Sprite.addr ,default_icn =Screen.addr
#11 =Sprite.color #31 =Screen.color
#0a =slime #2a =slime
BRK BRK
@FRAME @FRAME
#0a =slime #2a =slime
,default_icn =Sprite.addr ,default_icn =Screen.addr
( hold ctrl key to change slime color ) ( hold ctrl key to change slime color )
~Controller.p1 #0f AND ~Controller.p1 #0f AND
DUP #01 NEQ ^$no-ctrl JNZ #05 =slime $no-ctrl DUP #01 NEQ ^$no-ctrl JNZ #25 =slime $no-ctrl
DUP #02 NEQ ^$no-alt JNZ #0f =slime $no-alt DUP #02 NEQ ^$no-alt JNZ #2f =slime $no-alt
POP POP
( clear ) #10 =Sprite.color ( clear ) #30 =Screen.color
( detect movement ) ( detect movement )
~Controller.p1 #f0 AND ~Controller.p1 #f0 AND
DUP #04 SFT #01 AND #01 NEQ ^$no-up JNZ DUP #04 SFT #01 AND #01 NEQ ^$no-up JNZ
( move ) ~Sprite.y -- =Sprite.y ,up_icn =Sprite.addr $no-up ( move ) ~Screen.y -- =Screen.y ,up_icn =Screen.addr $no-up
DUP #05 SFT #01 AND #01 NEQ ^$no-down JNZ DUP #05 SFT #01 AND #01 NEQ ^$no-down JNZ
( move ) ~Sprite.y ++ =Sprite.y ,down_icn =Sprite.addr $no-down ( move ) ~Screen.y ++ =Screen.y ,down_icn =Screen.addr $no-down
DUP #06 SFT #01 AND #01 NEQ ^$no-left JNZ DUP #06 SFT #01 AND #01 NEQ ^$no-left JNZ
( move ) ~Sprite.x -- =Sprite.x ,left_icn =Sprite.addr $no-left ( move ) ~Screen.x -- =Screen.x ,left_icn =Screen.addr $no-left
DUP #07 SFT #01 AND #01 NEQ ^$no-right JNZ DUP #07 SFT #01 AND #01 NEQ ^$no-right JNZ
( move ) ~Sprite.x ++ =Sprite.x ,right_icn =Sprite.addr $no-right ( move ) ~Screen.x ++ =Screen.x ,right_icn =Screen.addr $no-right
POP POP
( draw face ) ( draw face )
#11 =Sprite.color #31 =Screen.color
( draw slime ) ( draw slime )
,slime_icn =Sprite.addr ,slime_icn =Screen.addr
~slime =Sprite.color ~slime =Screen.color
BRK BRK

View File

@ -5,7 +5,7 @@
%8* { #0030 SFT2 } %8* { #0030 SFT2 }
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 } |0120 ;Screen { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0140 ;Controller { vector 2 button 1 } |0140 ;Controller { vector 2 button 1 }
|0150 ;Keys { vector 2 key 1 } |0150 ;Keys { vector 2 key 1 }
@ -22,10 +22,10 @@ BRK
@KEY @KEY
,cursor_icn =Sprite.addr ,cursor_icn =Screen.addr
,font #00 ~Keys.key 8* ADD2 =Sprite.addr ,font #00 ~Keys.key 8* ADD2 =Screen.addr
( draw ) #01 =Sprite.color ( draw ) #21 =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
( release ) #00 =Keys.key ( release ) #00 =Keys.key
,draw-cursor JSR2 ,draw-cursor JSR2
@ -35,9 +35,9 @@ BRK
( enter key ) ( enter key )
~Controller.button #08 NEQ ^$no-return JNZ ~Controller.button #08 NEQ ^$no-return JNZ
#00 =Sprite.color #20 =Screen.color
#0000 =Sprite.x #0000 =Screen.x
( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~Screen.y 8+ =Screen.y
( release ) #00 =Controller.button ( release ) #00 =Controller.button
,draw-cursor JSR2 ,draw-cursor JSR2
$no-return $no-return
@ -46,7 +46,7 @@ BRK
@draw-cursor @draw-cursor
,cursor_icn =Sprite.addr #02 =Sprite.color ,cursor_icn =Screen.addr #22 =Screen.color
RTN RTN

View File

@ -9,8 +9,7 @@
;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 } ;circle { xc 2 yc 2 x 2 y 2 r 2 d 2 }
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
( program ) ( program )
@ -48,19 +47,19 @@ BRK
@draw-cursor ( -- ) @draw-cursor ( -- )
( clear last cursor ) ( clear last cursor )
,clear_icn =Sprite.addr ,clear_icn =Screen.addr
~pointer.x =Sprite.x ~pointer.x =Screen.x
~pointer.y =Sprite.y ~pointer.y =Screen.y
#10 =Sprite.color #30 =Screen.color
( record pointer positions ) ( record pointer positions )
~Mouse.x =pointer.x ~Mouse.y =pointer.y ~Mouse.x =pointer.x ~Mouse.y =pointer.y
( draw new cursor ) ( draw new cursor )
,cursor_icn =Sprite.addr ,cursor_icn =Screen.addr
~pointer.x =Sprite.x ~pointer.x =Screen.x
~pointer.y =Sprite.y ~pointer.y =Screen.y
#11 ~Mouse.state #00 NEQ ADD =Sprite.color #31 ~Mouse.state #00 NEQ ADD =Screen.color
RTN RTN

View File

@ -22,8 +22,7 @@
} }
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
( program ) ( program )
@ -130,11 +129,11 @@ RTN
POP2 POP2 POP2 POP2
( draw blending modes ) ( draw blending modes )
#0020 =Sprite.x #0020 =Sprite.y ,icon_icn =Sprite.addr #0000 =Screen.x #0020 =Screen.y ,icon_icn =Screen.addr
#00 #10 #20 #30
$draw-blends $draw-blends
( move ) OVR #00 SWP #0008 MUL2 #0020 ADD2 =Sprite.x ( move ) OVR #00 SWP #0008 MUL2 =Screen.x
( draw ) OVR =Sprite.color ( draw ) OVR =Screen.color
( incr ) SWP #01 ADD SWP ( incr ) SWP #01 ADD SWP
DUP2 LTH ^$draw-blends JNZ DUP2 LTH ^$draw-blends JNZ
POP POP POP POP
@ -149,52 +148,52 @@ RTN
~window.x1 ~window.y1 ~window.x2 ~window.y2 #01 ,line-rect JSR2 ~window.x1 ~window.y1 ~window.x2 ~window.y2 #01 ,line-rect JSR2
~window.x1 #0002 SUB2 ~window.y1 #0002 SUB2 ~window.x2 #0002 ADD2 ~window.y2 #0002 ADD2 #01 ,line-rect JSR2 ~window.x1 #0002 SUB2 ~window.y1 #0002 SUB2 ~window.x2 #0002 ADD2 ~window.y2 #0002 ADD2 #01 ,line-rect JSR2
~window.x1 #0008 ADD2 ~window.y1 #0010 ADD2 #05 ,red_txt ,draw-label JSR2 ~window.x1 #0008 ADD2 ~window.y1 #0010 ADD2 #25 ,red_txt ,draw-label JSR2
~window.x1 #0008 ADD2 ~window.y1 #0020 ADD2 #05 ,green_txt ,draw-label JSR2 ~window.x1 #0008 ADD2 ~window.y1 #0020 ADD2 #25 ,green_txt ,draw-label JSR2
~window.x1 #0008 ADD2 ~window.y1 #0030 ADD2 #05 ,blue_txt ,draw-label JSR2 ~window.x1 #0008 ADD2 ~window.y1 #0030 ADD2 #25 ,blue_txt ,draw-label JSR2
~window.x1 #0050 ADD2 ~window.y1 #0010 ADD2 ~window.x1 #0080 ADD2 #00 ,theme.r1 ~selection ADD PEK2 #0004 MUL2 #01 ,draw-slider JSR2 ~window.x1 #0050 ADD2 ~window.y1 #0010 ADD2 ~window.x1 #0080 ADD2 #00 ,theme.r1 ~selection ADD PEK2 #0004 MUL2 #01 ,draw-slider JSR2
~window.x1 #0050 ADD2 ~window.y1 #0020 ADD2 ~window.x1 #0080 ADD2 #00 ,theme.g1 ~selection ADD PEK2 #0004 MUL2 #01 ,draw-slider JSR2 ~window.x1 #0050 ADD2 ~window.y1 #0020 ADD2 ~window.x1 #0080 ADD2 #00 ,theme.g1 ~selection ADD PEK2 #0004 MUL2 #01 ,draw-slider JSR2
~window.x1 #0050 ADD2 ~window.y1 #0030 ADD2 ~window.x1 #0080 ADD2 #00 ,theme.b1 ~selection ADD PEK2 #0004 MUL2 #01 ,draw-slider JSR2 ~window.x1 #0050 ADD2 ~window.y1 #0030 ADD2 ~window.x1 #0080 ADD2 #00 ,theme.b1 ~selection ADD PEK2 #0004 MUL2 #01 ,draw-slider JSR2
~window.x1 #0050 ADD2 =Sprite.x ~window.x1 #0050 ADD2 =Screen.x
~window.y1 #0040 ADD2 =Sprite.y ~window.y1 #0040 ADD2 =Screen.y
,radio_icns #00 ~selection #00 EQU #0008 MUL2 ADD2 =Sprite.addr ,radio_icns #00 ~selection #00 EQU #0008 MUL2 ADD2 =Screen.addr
#05 =Sprite.color #25 =Screen.color
~window.x1 #0060 ADD2 =Sprite.x ~window.x1 #0060 ADD2 =Screen.x
~window.y1 #0040 ADD2 =Sprite.y ~window.y1 #0040 ADD2 =Screen.y
,radio_icns #00 ~selection #01 EQU #0008 MUL2 ADD2 =Sprite.addr ,radio_icns #00 ~selection #01 EQU #0008 MUL2 ADD2 =Screen.addr
#05 =Sprite.color #25 =Screen.color
~window.x1 #0070 ADD2 =Sprite.x ~window.x1 #0070 ADD2 =Screen.x
~window.y1 #0040 ADD2 =Sprite.y ~window.y1 #0040 ADD2 =Screen.y
,radio_icns #00 ~selection #02 EQU #0008 MUL2 ADD2 =Sprite.addr ,radio_icns #00 ~selection #02 EQU #0008 MUL2 ADD2 =Screen.addr
#05 =Sprite.color #25 =Screen.color
~window.x1 #0080 ADD2 =Sprite.x ~window.x1 #0080 ADD2 =Screen.x
~window.y1 #0040 ADD2 =Sprite.y ~window.y1 #0040 ADD2 =Screen.y
,radio_icns #00 ~selection #03 EQU #0008 MUL2 ADD2 =Sprite.addr ,radio_icns #00 ~selection #03 EQU #0008 MUL2 ADD2 =Screen.addr
#05 =Sprite.color #25 =Screen.color
RTN RTN
@draw-cursor @draw-cursor
( clear last cursor ) ( clear last cursor )
,clear_icn =Sprite.addr ,clear_icn =Screen.addr
~pointer.x =Sprite.x ~pointer.x =Screen.x
~pointer.y =Sprite.y ~pointer.y =Screen.y
#10 =Sprite.color #30 =Screen.color
( record pointer positions ) ( record pointer positions )
~Mouse.x =pointer.x ~Mouse.y =pointer.y ~Mouse.x =pointer.x ~Mouse.y =pointer.y
( draw new cursor ) ( draw new cursor )
,pointer_icn =Sprite.addr ,pointer_icn =Screen.addr
~pointer.x =Sprite.x ~pointer.x =Screen.x
~pointer.y =Sprite.y ~pointer.y =Screen.y
#13 =Sprite.color #33 =Screen.color
RTN RTN
@ -202,26 +201,26 @@ RTN
( load ) =color =slider.pos =slider.x2 =slider.y =slider.x1 ( load ) =color =slider.pos =slider.x2 =slider.y =slider.x1
~slider.x1 =Sprite.x ~slider.x1 =Screen.x
~slider.y =Sprite.y ~slider.y =Screen.y
,halftone_icn =Sprite.addr ,halftone_icn =Screen.addr
,slidera_icn =Sprite.addr ,slidera_icn =Screen.addr
( draw ) #05 =Sprite.color ( draw ) #25 =Screen.color
,sliderb_icn =Sprite.addr ,sliderb_icn =Screen.addr
$loop $loop
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( draw ) #05 =Sprite.color ( draw ) #25 =Screen.color
~Sprite.x ~slider.x2 #0008 ADD2 LTH2 ^$loop JNZ ~Screen.x ~slider.x2 #0008 ADD2 LTH2 ^$loop JNZ
( incr ) ~Sprite.x #0004 ADD2 =Sprite.x ( incr ) ~Screen.x #0004 ADD2 =Screen.x
,sliderc_icn =Sprite.addr ,sliderc_icn =Screen.addr
( draw ) #05 =Sprite.color ( draw ) #25 =Screen.color
~slider.x1 ~slider.pos ADD2 =Sprite.x ~slider.x1 ~slider.pos ADD2 =Screen.x
,sliderd_icn =Sprite.addr ,sliderd_icn =Screen.addr
( draw ) #0a =Sprite.color ( draw ) #2a =Screen.color
RTN RTN
@ -258,11 +257,11 @@ RTN
@draw-label ( x y color addr ) @draw-label ( x y color addr )
( load ) =label.addr =color =Sprite.y =Sprite.x ~label.addr ( load ) =label.addr =color =Screen.y =Screen.x ~label.addr
$loop $loop
( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr ~color =Screen.color
( incr ) ++ ( incr ) ++
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
DUP2 PEK2 #00 NEQ ^$loop JNZ DUP2 PEK2 #00 NEQ ^$loop JNZ
POP2 POP2

View File

@ -15,8 +15,7 @@
( devices ) ( devices )
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|01a0 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dotw 1 doty 2 isdst 1 refresh 1 } |01a0 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dotw 1 doty 2 isdst 1 refresh 1 }
( program ) ( program )
@ -69,26 +68,26 @@ BRK
POP2 POP2
( display ) ( display )
~Screen.height #0002 DIV2 #0048 ADD2 =Sprite.y ~Screen.height #0002 DIV2 #0048 ADD2 =Screen.y
~Screen.width #0002 DIV2 ~Screen.width #0002 DIV2
DUP2 #0020 SUB2 =Sprite.x DUP2 #0020 SUB2 =Screen.x
,font_hex #00 ~DateTime.hour #0a DIV #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~DateTime.hour #0a DIV #08 MUL ADD2 =Screen.addr
#02 =Sprite.color #22 =Screen.color
DUP2 #0018 SUB2 =Sprite.x DUP2 #0018 SUB2 =Screen.x
,font_hex #00 ~DateTime.hour #0a MOD #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~DateTime.hour #0a MOD #08 MUL ADD2 =Screen.addr
#02 =Sprite.color #22 =Screen.color
DUP2 #0008 SUB2 =Sprite.x DUP2 #0008 SUB2 =Screen.x
,font_hex #00 ~DateTime.minute #0a DIV #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~DateTime.minute #0a DIV #08 MUL ADD2 =Screen.addr
#02 =Sprite.color #22 =Screen.color
DUP2 =Sprite.x DUP2 =Screen.x
,font_hex #00 ~DateTime.minute #0a MOD #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~DateTime.minute #0a MOD #08 MUL ADD2 =Screen.addr
#02 =Sprite.color #22 =Screen.color
DUP2 #0010 ADD2 =Sprite.x DUP2 #0010 ADD2 =Screen.x
,font_hex #00 ~DateTime.second #0a DIV #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~DateTime.second #0a DIV #08 MUL ADD2 =Screen.addr
#02 =Sprite.color #22 =Screen.color
DUP2 #0018 ADD2 =Sprite.x DUP2 #0018 ADD2 =Screen.x
,font_hex #00 ~DateTime.second #0a MOD #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~DateTime.second #0a MOD #08 MUL ADD2 =Screen.addr
#02 =Sprite.color #22 =Screen.color
POP2 POP2
BRK BRK

View File

@ -12,8 +12,7 @@
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0140 ;Controller { vector 2 button 1 } |0140 ;Controller { vector 2 button 1 }
|0150 ;Keys { vector 2 key 1 } |0150 ;Keys { vector 2 key 1 }
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
@ -65,19 +64,19 @@ BRK
@draw-cursor @draw-cursor
( clear last cursor ) ( clear last cursor )
,clear_icn =Sprite.addr ,clear_icn =Screen.addr
~pointer.x =Sprite.x ~pointer.x =Screen.x
~pointer.y =Sprite.y ~pointer.y =Screen.y
#10 =Sprite.color #30 =Screen.color
( record pointer positions ) ( record pointer positions )
~Mouse.x =pointer.x ~Mouse.y =pointer.y ~Mouse.x =pointer.x ~Mouse.y =pointer.y
( draw new cursor ) ( draw new cursor )
~pointer.sprite =Sprite.addr ~pointer.sprite =Screen.addr
~pointer.x =Sprite.x ~pointer.x =Screen.x
~pointer.y =Sprite.y ~pointer.y =Screen.y
#11 =Sprite.color #31 =Screen.color
RTN RTN

View File

@ -7,8 +7,7 @@
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0140 ;Controller { vector 2 button 1 } |0140 ;Controller { vector 2 button 1 }
|0150 ;Keys { vector 2 key 1 } |0150 ;Keys { vector 2 key 1 }
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
@ -30,22 +29,22 @@
( incr ) ~Screen.y #0002 ADD2 =Screen.y ( incr ) ~Screen.y #0002 ADD2 =Screen.y
~Screen.y ~Screen.height LTH2 ^$draw-ver JNZ ~Screen.y ~Screen.height LTH2 ^$draw-ver JNZ
~center.x ~center.y #0010 SUB2 #0c ,text1 ,draw-label-left JSR2 ~center.x ~center.y #0010 SUB2 #2c ,text1 ,draw-label-left JSR2
~center.x ~center.y #0c ,text2 ,draw-label-middle JSR2 ~center.x ~center.y #2c ,text2 ,draw-label-middle JSR2
~center.x ~center.y #0010 ADD2 #0c ,text3 ,draw-label-right JSR2 ~center.x ~center.y #0010 ADD2 #2c ,text3 ,draw-label-right JSR2
~center.x ~center.y #0020 ADD2 #0c ,text4 ,draw-label-middle JSR2 ~center.x ~center.y #0020 ADD2 #2c ,text4 ,draw-label-middle JSR2
~center.x ~center.y #0030 ADD2 #0c ,text5 ,draw-label-middle JSR2 ~center.x ~center.y #0030 ADD2 #2c ,text5 ,draw-label-middle JSR2
BRK BRK
@draw-label-left ( x y color addr ) @draw-label-left ( x y color addr )
( load ) =label.addr =label.color =Sprite.y =Sprite.x ( load ) =label.addr =label.color =Screen.y =Screen.x
~label.addr ~label.addr
$loop $loop
( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr ~label.color =Screen.color
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Screen.x #0008 ADD2 =Screen.x
DUP2 PEK2 #00 NEQ ^$loop JNZ DUP2 PEK2 #00 NEQ ^$loop JNZ
POP2 POP2
@ -53,13 +52,13 @@ RTN
@draw-label-middle ( x y color addr ) @draw-label-middle ( x y color addr )
( load ) =label.addr =label.color =Sprite.y ( load ) =label.addr =label.color =Screen.y
( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 =Sprite.x ( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 #0002 DIV2 SUB2 =Screen.x
~label.addr ~label.addr
$loop $loop
( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr ~label.color =Screen.color
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Screen.x #0008 ADD2 =Screen.x
DUP2 PEK2 #00 NEQ ^$loop JNZ DUP2 PEK2 #00 NEQ ^$loop JNZ
POP2 POP2
@ -67,13 +66,13 @@ RTN
@draw-label-right ( x y color addr ) @draw-label-right ( x y color addr )
( load ) =label.addr =label.color =Sprite.y ( load ) =label.addr =label.color =Screen.y
( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 =Sprite.x ( align ) ~label.addr ,get-text-length JSR2 #0008 MUL2 SUB2 #0008 SUB2 =Screen.x
~label.addr ~label.addr
$loop $loop
( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr ~label.color =Screen.color
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Screen.x #0008 ADD2 =Screen.x
DUP2 PEK2 #00 NEQ ^$loop JNZ DUP2 PEK2 #00 NEQ ^$loop JNZ
POP2 POP2

View File

@ -6,8 +6,7 @@
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0140 ;Controller { vector 2 button 1 } |0140 ;Controller { vector 2 button 1 }
|0150 ;Keys { vector 2 key 1 } |0150 ;Keys { vector 2 key 1 }
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
@ -18,24 +17,24 @@
( theme ) #0ffc =System.r #0f0b =System.g #0f03 =System.b ( theme ) #0ffc =System.r #0f0b =System.g #0f03 =System.b
#0000 #0000 #0100 #0100 #01 ,pict_large ,draw-picture JSR2 #0000 #0000 #0100 #0100 #21 ,pict_large ,draw-picture JSR2
#0098 #0060 #0080 #0080 #01 ,pict_medium ,draw-picture JSR2 #0098 #0060 #0080 #0080 #21 ,pict_medium ,draw-picture JSR2
#0020 #0090 #0020 #0020 #0a ,pict_small ,draw-picture JSR2 #0020 #0090 #0020 #0020 #2a ,pict_small ,draw-picture JSR2
BRK BRK
@draw-picture ( x y width height color addr ) @draw-picture ( x y width height color addr )
DUP2 =Sprite.addr =pict.addr =pict.color =pict.height =pict.width DUP2 =Sprite.y =pict.y =pict.x DUP2 =Screen.addr =pict.addr =pict.color =pict.height =pict.width DUP2 =Screen.y =pict.y =pict.x
$ver $ver
~pict.x =Sprite.x ~pict.x =Screen.x
$hor $hor
( draw ) ~pict.color =Sprite.color ( draw ) ~pict.color =Screen.color
( incr ) ~Sprite.x #0008 ADD2 =Sprite.x ( incr ) ~Screen.x #0008 ADD2 =Screen.x
( incr ) ~Sprite.addr #0008 ADD2 =Sprite.addr ( incr ) ~Screen.addr #0008 ADD2 =Screen.addr
~Sprite.x ~pict.width ~pict.x ADD2 LTH2 ^$hor JNZ ~Screen.x ~pict.width ~pict.x ADD2 LTH2 ^$hor JNZ
( incr ) ~Sprite.y #0008 ADD2 =Sprite.y ( incr ) ~Screen.y #0008 ADD2 =Screen.y
~Sprite.y ~pict.height ~pict.y ADD2 LTH2 ^$ver JNZ ~Screen.y ~pict.height ~pict.y ADD2 LTH2 ^$ver JNZ
RTN RTN

View File

@ -14,8 +14,7 @@
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0140 ;Controller { vector 2 button 1 } |0140 ;Controller { vector 2 button 1 }
|0150 ;Keys { vector 2 key 1 } |0150 ;Keys { vector 2 key 1 }
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
@ -33,10 +32,10 @@
#0080 #0030 #00b0 #0070 #02 ,line-rect JSR2 #0080 #0030 #00b0 #0070 #02 ,line-rect JSR2
#0090 #0040 #00c0 #0080 #03 ,line-rect JSR2 #0090 #0040 #00c0 #0080 #03 ,line-rect JSR2
#0000 #0080 #0020 #0020 #01 ,pict_small ,draw-picture JSR2 #0000 #0080 #0020 #0020 #21 ,pict_small ,draw-picture JSR2
#0010 #0088 #0020 #0020 #02 ,pict_small ,draw-picture JSR2 #0010 #0088 #0020 #0020 #22 ,pict_small ,draw-picture JSR2
#0020 #0090 #0020 #0020 #03 ,pict_small ,draw-picture JSR2 #0020 #0090 #0020 #0020 #23 ,pict_small ,draw-picture JSR2
#0030 #0098 #0020 #0020 #04 ,pict_small ,draw-picture JSR2 #0030 #0098 #0020 #0020 #24 ,pict_small ,draw-picture JSR2
#0020 #0020 #0070 #0080 #01 ,draw-line JSR2 #0020 #0020 #0070 #0080 #01 ,draw-line JSR2
#0020 #0080 #0070 #0030 #02 ,draw-line JSR2 #0020 #0080 #0070 #0030 #02 ,draw-line JSR2
@ -108,16 +107,16 @@ RTN
@draw-picture ( x y width height color addr ) @draw-picture ( x y width height color addr )
( load ) DUP2 =Sprite.addr =pict.addr =pict.color =pict.height =pict.width DUP2 =Sprite.y =pict.y =pict.x ( load ) DUP2 =Screen.addr =pict.addr =pict.color =pict.height =pict.width DUP2 =Screen.y =pict.y =pict.x
$ver $ver
~pict.x =Sprite.x ~pict.x =Screen.x
$hor $hor
( draw ) ~pict.color =Sprite.color ( draw ) ~pict.color =Screen.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~Screen.addr 8+ =Screen.addr
~Sprite.x ~pict.width ~pict.x ADD2 LTH2 ^$hor JNZ ~Screen.x ~pict.width ~pict.x ADD2 LTH2 ^$hor JNZ
( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~Screen.y 8+ =Screen.y
~Sprite.y ~pict.height ~pict.y ADD2 LTH2 ^$ver JNZ ~Screen.y ~pict.height ~pict.y ADD2 LTH2 ^$ver JNZ
RTN RTN

View File

@ -44,11 +44,10 @@
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 } |0140 ;Controller { vector 2 button 1 }
|0140 ;Controller { buttons 1 } |0150 ;Keys { vector 2 key 1 }
|0150 ;Keys { key 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
|0160 ;Mouse { x 2 y 2 state 1 chord 1 }
|0170 ;File { pad 8 name 2 length 2 load 2 save 2 } |0170 ;File { pad 8 name 2 length 2 load 2 save 2 }
( program ) ( program )
@ -56,7 +55,9 @@
|0200 @RESET |0200 @RESET
( theme ) #e0fa =System.r #30fa =System.g #30fa =System.b ( theme ) #e0fa =System.r #30fa =System.g #30fa =System.b
( vectors ) ,FRAME =Screen.vector ( vectors ) ,on-mouse =Mouse.vector
( vectors ) ,on-key =Keys.vector
( vectors ) ,on-button =Controller.vector
( load file ) ( load file )
,filepath ,load-file JSR2 ,filepath ,load-file JSR2
@ -69,11 +70,34 @@
BRK BRK
@FRAME @on-key
( ctrl ) ~Keys #08 NEQ ^$no-backspace JNZ
~Controller #00 EQU ~lock #00 NEQ #0000 NEQ2 ,$ctrl-end JNZ2 ( erase )
( lock ) #04 =lock ~selection.to ~selection.from SUB2 #0001 NEQ2 ^$erase-multiple JNZ
~selection.to ~selection.from SUB2 ,shift-left JSR2
,$erase-end JMP2
$erase-multiple
~selection.from ++ =selection.from
~selection.to ~selection.from SUB2 ++ ,shift-left JSR2
$erase-end
~selection.from -- =selection.from
^$keys-end JMP
$no-backspace
( insert )
~selection.to ~selection.from SUB2 ,shift-right JSR2
~Keys ~selection.from POK2
~selection.from ++ =selection.from
$keys-end
~selection.from ++ =selection.to
( release ) #00 =Keys
,redraw JSR2
BRK
@on-button ( -> )
( alt + arrow ) ( alt + arrow )
~Controller #0f AND #02 NEQ ^$no-alt JNZ ~Controller #0f AND #02 NEQ ^$no-alt JNZ
@ -89,7 +113,7 @@ BRK
POP POP
,clamp-selection JSR2 ,clamp-selection JSR2
,redraw JSR2 ,redraw JSR2
,$ctrl-end JMP2 BRK
$no-alt $no-alt
( ctrl + arrow ) ( ctrl + arrow )
@ -105,7 +129,7 @@ BRK
( jump line ) ,goto-lineend JSR2 $no-cright ( jump line ) ,goto-lineend JSR2 $no-cright
POP POP
,redraw JSR2 ,redraw JSR2
,$ctrl-end JMP2 BRK
$no-ctrl $no-ctrl
( arrow ) ( arrow )
@ -132,38 +156,9 @@ BRK
,redraw JSR2 ,redraw JSR2
$no-arrow $no-arrow
$ctrl-end BRK
( keys ) @on-mouse ( -> )
~Keys #00 EQU ,$no-keys JNZ2
~Keys #08 NEQ ^$no-backspace JNZ
( erase )
~selection.to ~selection.from SUB2 #0001 NEQ2 ^$erase-multiple JNZ
~selection.to ~selection.from SUB2 ,shift-left JSR2
,$erase-end JMP2
$erase-multiple
~selection.from ++ =selection.from
~selection.to ~selection.from SUB2 ++ ,shift-left JSR2
$erase-end
~selection.from -- =selection.from
^$keys-end JMP
$no-backspace
( insert )
~selection.to ~selection.from SUB2 ,shift-right JSR2
~Keys ~selection.from POK2
~selection.from ++ =selection.from
$keys-end
~selection.from ++ =selection.to
( release ) #00 =Keys
,redraw JSR2
$no-keys
( mouse )
~Mouse.state #00 EQU ^$touch-end JNZ ~Mouse.state #00 EQU ^$touch-end JNZ
~Mouse.x #0010 LTH2 ,touch-linebar JNZ2 ~Mouse.x #0010 LTH2 ,touch-linebar JNZ2
@ -173,8 +168,6 @@ BRK
~Mouse.state =touch.state ~Mouse.state =touch.state
( unlock ) ~lock #00 EQU ,skip-unlock JNZ2 ~lock #01 SUB =lock @skip-unlock
,draw-cursor JSR2 ,draw-cursor JSR2
BRK BRK
@ -463,64 +456,60 @@ RTN
,draw-titlebar JSR2 ,draw-titlebar JSR2
( save/load icons ) ( save/load icons )
~Screen.height 8- =Sprite.y ~Screen.height 8- =Screen.y
~Screen.width #0030 SUB2 =Sprite.x ~Screen.width #0030 SUB2 =Screen.x
,eye_icn =Sprite.addr ,eye_icn =Screen.addr
#02 =Sprite.color #22 =Screen.color
~Screen.width #0028 SUB2 =Sprite.x ~Screen.width #0028 SUB2 =Screen.x
,name_icn =Sprite.addr ,name_icn =Screen.addr
#02 =Sprite.color #22 =Screen.color
~Screen.width #0020 SUB2 =Sprite.x ~Screen.width #0020 SUB2 =Screen.x
,load_icn =Sprite.addr ,load_icn =Screen.addr
#02 =Sprite.color #22 =Screen.color
~Screen.width #0018 SUB2 =Sprite.x ~Screen.width #0018 SUB2 =Screen.x
,save_icn =Sprite.addr ,save_icn =Screen.addr
#02 =Sprite.color #22 =Screen.color
RTN RTN
@draw-short ( short ) @draw-short ( short )
=addr =addr
,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
( draw ) #0e =Sprite.color ( draw ) #2e =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Screen.addr
( draw ) #0e =Sprite.color ( draw ) #2e =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
( draw ) #0e =Sprite.color ( draw ) #2e =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Screen.addr
( draw ) #0e =Sprite.color ( draw ) #2e =Screen.color
RTN RTN
@draw-cursor @draw-cursor
~mouse.x ~Mouse.x NEQ2
~mouse.y ~Mouse.y NEQ2
#0000 EQU2 RTN? ( Return if unchanged )
( clear last cursor ) ( clear last cursor )
~mouse.x =Sprite.x ~mouse.x =Screen.x
~mouse.y =Sprite.y ~mouse.y =Screen.y
,blank_icn =Sprite.addr ,blank_icn =Screen.addr
#10 =Sprite.color #30 =Screen.color
( record mouse positions ) ( record mouse positions )
~Mouse.x =mouse.x ~Mouse.x =mouse.x
~Mouse.y =mouse.y ~Mouse.y =mouse.y
( draw new cursor ) ( draw new cursor )
~mouse.x =Sprite.x ~mouse.x =Screen.x
~mouse.y =Sprite.y ~mouse.y =Screen.y
,cursor_icn =Sprite.addr ,cursor_icn =Screen.addr
#1f ~Mouse.state #01 EQU #0a MUL SUB =Sprite.color #3f ~Mouse.state #01 EQU #0a MUL SUB =Screen.color
RTN RTN
@ -538,55 +527,55 @@ RTN
~textarea.addr PEK2 #00 NEQ ^$find-offset JNZ ~textarea.addr PEK2 #00 NEQ ^$find-offset JNZ
$find-offset-end $find-offset-end
#0018 =Sprite.x #0000 =Sprite.y #0018 =Screen.x #0000 =Screen.y
~textarea.addr =i ~textarea.addr =i
$loop $loop
~Sprite.y ~Screen.height #0010 SUB2 GTH2 ,$end JNZ2 ~Screen.y ~Screen.height #0010 SUB2 GTH2 ,$end JNZ2
~i PEK2 #0a NEQ ~i PEK2 #0d NEQ #0101 EQU2 ,$no-linebreak JNZ2 ~i PEK2 #0a NEQ ~i PEK2 #0d NEQ #0101 EQU2 ,$no-linebreak JNZ2
( draw linebreak ) ( draw linebreak )
,linebreak_icn =Sprite.addr ,linebreak_icn =Screen.addr
( draw ) #02 ( draw ) #02
~i ~selection.from -- GTH2 ~i ~selection.from -- GTH2
~i ~selection.to LTH2 #0101 EQU2 ~i ~selection.to LTH2 #0101 EQU2
#06 MUL ADD =Sprite.color #26 MUL ADD =Screen.color
( fill clear ) ( fill clear )
$fill-clear $fill-clear
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
,font =Sprite.addr ,font =Screen.addr
#01 =Sprite.color #21 =Screen.color
~Sprite.x ~Screen.width 8- LTH2 ^$fill-clear JNZ ~Screen.x ~Screen.width 8- LTH2 ^$fill-clear JNZ
( draw line number ) ( draw line number )
#0000 =Sprite.x #0000 =Screen.x
~scroll.y ~Sprite.y 8/ ADD2 DUP2 SWP POP =k ~scroll.y ~Screen.y 8/ ADD2 DUP2 SWP POP =k
~position.y EQU2 #05 MUL =l ~position.y EQU2 #05 MUL =l
,font_hex #00 ~k #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~k #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
#04 ~l ADD =Sprite.color #24 ~l ADD =Screen.color
#0008 =Sprite.x #0008 =Screen.x
,font_hex #00 ~k #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~k #0f AND #08 MUL ADD2 =Screen.addr
#04 ~l ADD =Sprite.color #24 ~l ADD =Screen.color
#0010 =Sprite.x #0010 =Screen.x
( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~Screen.y 8+ =Screen.y
$no-linebreak $no-linebreak
( get character ) ( get character )
,font #00 ~i PEK2 #20 SUB 8* ADD2 =Sprite.addr ,font #00 ~i PEK2 #20 SUB 8* ADD2 =Screen.addr
( is a special character ) ( is a special character )
~i PEK2 #20 GTH ^$no-tab JNZ ,font =Sprite.addr $no-tab ~i PEK2 #20 GTH ^$no-tab JNZ ,font =Screen.addr $no-tab
( draw ) #01 ( draw ) #21
~i ~selection.from -- GTH2 ~i ~selection.from -- GTH2
~i ~selection.to LTH2 #0101 EQU2 ~i ~selection.to LTH2 #0101 EQU2
#05 MUL ADD =Sprite.color #05 MUL ADD =Screen.color
( incr ) ~i ++ =i ( incr ) ~i ++ =i
( incr ) ~Sprite.x #0007 ADD2 =Sprite.x ( incr ) ~Screen.x #0007 ADD2 =Screen.x
~i PEK2 #00 NEQ ,$loop JNZ2 ~i PEK2 #00 NEQ ,$loop JNZ2
@ -598,40 +587,40 @@ RTN
,scrollbar_icn ( keeping a copy on stack ) ,scrollbar_icn ( keeping a copy on stack )
~Screen.width 8- =Sprite.x ~Screen.width 8- =Screen.x
#0008 =Sprite.y #0008 =Screen.y
DUP2 =Sprite.addr DUP2 =Screen.addr
#0008 ~Screen.height 8- #0008 ~Screen.height 8-
$loop $loop
( draw ) #01 =Sprite.color ( draw ) #21 =Screen.color
( incr ) SWP2 8+ DUP2 =Sprite.y SWP2 ( incr ) SWP2 8+ DUP2 =Screen.y SWP2
OVR2 OVR2 LTH2 ^$loop JNZ OVR2 OVR2 LTH2 ^$loop JNZ
POP2 POP2 POP2 POP2
~scroll.y 8+ =Sprite.y ~scroll.y 8+ =Screen.y
DUP2 #0008 ADD2 =Sprite.addr DUP2 #0008 ADD2 =Screen.addr
( draw ) #01 =Sprite.color ( draw ) #21 =Screen.color
#0000 =Sprite.y #0000 =Screen.y
DUP2 #0010 ADD2 =Sprite.addr DUP2 #0010 ADD2 =Screen.addr
( draw ) #04 =Sprite.color ( draw ) #24 =Screen.color
~Screen.height 8- =Sprite.y ~Screen.height 8- =Screen.y
#0018 ADD2 =Sprite.addr #0018 ADD2 =Screen.addr
( draw ) #04 =Sprite.color ( draw ) #24 =Screen.color
RTN RTN
@draw-titlebar @draw-titlebar
#0018 ~Screen.height 8- #09 ,filepath #0018 ~Screen.height 8- #29 ,filepath
( load ) =label.addr =label.color =Sprite.y =Sprite.x ( load ) =label.addr =label.color =Screen.y =Screen.x
~label.addr ~label.addr
$loop $loop
( draw ) DUP2 PEK2 #00 SWP #20 SUB 8* ,font ADD2 =Sprite.addr ~label.color =Sprite.color ( draw ) DUP2 PEK2 #00 SWP #20 SUB 8* ,font ADD2 =Screen.addr ~label.color =Screen.color
( incr ) ++ ( incr ) ++
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
DUP2 PEK2 #00 NEQ ^$loop JNZ DUP2 PEK2 #00 NEQ ^$loop JNZ
POP2 POP2
( selection ) ( selection )

View File

@ -33,8 +33,7 @@
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0140 ;Controller { vector 2 button 1 } |0140 ;Controller { vector 2 button 1 }
|0150 ;Keys { vector 2 key 1 } |0150 ;Keys { vector 2 key 1 }
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
@ -254,65 +253,65 @@ RTN
( position ) ( position )
~bankview.x =Sprite.x ~bankview.x =Screen.x
~bankview.y #0010 SUB2 =Sprite.y ~bankview.y #0010 SUB2 =Screen.y
~bankview.addr ,draw-short JSR2 ~bankview.addr ,draw-short JSR2
( toolbar ) ( toolbar )
~bankview.x #0068 ADD2 =Sprite.x ~bankview.x #0068 ADD2 =Screen.x
~bankview.y #0010 SUB2 =Sprite.y ~bankview.y #0010 SUB2 =Screen.y
,tool_selector =Sprite.addr ,tool_selector =Screen.addr
#01 ~bankview.mode #00 EQU ADD =Sprite.color #21 ~bankview.mode #00 EQU ADD =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,tool_hand =Sprite.addr ,tool_hand =Screen.addr
#01 ~bankview.mode #01 EQU ADD =Sprite.color #21 ~bankview.mode #01 EQU ADD =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,tool_eraser =Sprite.addr ,tool_eraser =Screen.addr
#01 ~bankview.mode #02 EQU ADD =Sprite.color #21 ~bankview.mode #02 EQU ADD =Screen.color
~tileview.x #0070 ADD2 =Sprite.x ~tileview.x #0070 ADD2 =Screen.x
,load_icn =Sprite.addr ,load_icn =Screen.addr
#01 =Sprite.color #21 =Screen.color
~tileview.x #0078 ADD2 =Sprite.x ~tileview.x #0078 ADD2 =Screen.x
,save_icn =Sprite.addr ,save_icn =Screen.addr
#01 =Sprite.color #21 =Screen.color
( guides ) ( guides )
#00 =i ,font_hex =Sprite.addr #00 =i ,font_hex =Screen.addr
$guides $guides
~bankview.x #0010 SUB2 =Sprite.x ~bankview.x #0010 SUB2 =Screen.x
~bankview.y #00 ~i #08 MUL ADD2 =Sprite.y ~bankview.y #00 ~i #08 MUL ADD2 =Screen.y
( draw ) #02 =Sprite.color ( draw ) #22 =Screen.color
~bankview.x #00 ~i #08 MUL ADD2 =Sprite.x ~bankview.x #00 ~i #08 MUL ADD2 =Screen.x
~bankview.y #0088 ADD2 =Sprite.y ~bankview.y #0088 ADD2 =Screen.y
( draw ) #02 =Sprite.color ( draw ) #22 =Screen.color
~Sprite.addr 8+ =Sprite.addr ~Screen.addr 8+ =Screen.addr
( incr ) ~i #01 ADD =i ( incr ) ~i #01 ADD =i
~i #10 LTH ^$guides JNZ ~i #10 LTH ^$guides JNZ
( body ) ( body )
~bankview.x =Sprite.x ~bankview.y =Sprite.y ~bankview.x =Screen.x ~bankview.y =Screen.y
#00 =pt.x #00 =pt.y ~bankview.addr =Sprite.addr #00 =pt.x #00 =pt.y ~bankview.addr =Screen.addr
$ver $ver
#00 =pt.x #00 =pt.x
~bankview.x =Sprite.x ~bankview.x =Screen.x
$hor $hor
( draw ) #01 ( draw ) #21
~Sprite.addr ~tileview.addr LTH2 ~Screen.addr ~tileview.addr LTH2
~Sprite.addr ~tileview.addr #0018 ADD2 GTH2 ~Screen.addr ~tileview.addr #0018 ADD2 GTH2
#0000 EQU2 #06 MUL ADD =Sprite.color #0000 EQU2 #06 MUL ADD =Screen.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~Screen.addr 8+ =Screen.addr
( incr ) ~pt.x #01 ADD =pt.x ( incr ) ~pt.x #01 ADD =pt.x
~pt.x #10 LTH ,$hor JNZ2 ~pt.x #10 LTH ,$hor JNZ2
( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~pt.y #01 ADD =pt.y
( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~Screen.y 8+ =Screen.y
~pt.y #10 LTH ,$ver JNZ2 ~pt.y #10 LTH ,$ver JNZ2
RTN RTN
@ -321,36 +320,36 @@ RTN
~tileview.x #0002 SUB2 ~tileview.y #0002 SUB2 ~tileview.x #0080 ADD2 ~tileview.y #0081 ADD2 #03 ,line-rect JSR2 ~tileview.x #0002 SUB2 ~tileview.y #0002 SUB2 ~tileview.x #0080 ADD2 ~tileview.y #0081 ADD2 #03 ,line-rect JSR2
~tileview.x #0028 ADD2 =Sprite.x ~tileview.x #0028 ADD2 =Screen.x
~tileview.y #0010 SUB2 =Sprite.y ~tileview.y #0010 SUB2 =Screen.y
~tileview.addr =Sprite.addr ~tileview.addr =Screen.addr
#03 =Sprite.color #23 =Screen.color
( position ) ( position )
~tileview.x =Sprite.x ~tileview.x =Screen.x
~tileview.y #0010 SUB2 =Sprite.y ~tileview.y #0010 SUB2 =Screen.y
~tileview.addr ,draw-short JSR2 ~tileview.addr ,draw-short JSR2
( body ) ( body )
~tileview.x =Sprite.x ~tileview.x =Screen.x
~tileview.y =Sprite.y ~tileview.y =Screen.y
~tileview.addr =tileview.addr ~tileview.addr =tileview.addr
,draw-tileview-icn JSR2 ,draw-tileview-icn JSR2
~tileview.x #0040 ADD2 =Sprite.x ~tileview.x #0040 ADD2 =Screen.x
~tileview.y =Sprite.y ~tileview.y =Screen.y
~tileview.addr 8+ =tileview.addr ~tileview.addr 8+ =tileview.addr
,draw-tileview-icn JSR2 ,draw-tileview-icn JSR2
~tileview.x =Sprite.x ~tileview.x =Screen.x
~tileview.y #0040 ADD2 =Sprite.y ~tileview.y #0040 ADD2 =Screen.y
~tileview.addr 8+ =tileview.addr ~tileview.addr 8+ =tileview.addr
,draw-tileview-icn JSR2 ,draw-tileview-icn JSR2
~tileview.x #0040 ADD2 =Sprite.x ~tileview.x #0040 ADD2 =Screen.x
~tileview.y #0040 ADD2 =Sprite.y ~tileview.y #0040 ADD2 =Screen.y
~tileview.addr 8+ =tileview.addr ~tileview.addr 8+ =tileview.addr
,draw-tileview-icn JSR2 ,draw-tileview-icn JSR2
@ -374,43 +373,43 @@ RTN
( bytes ) ( bytes )
~tileview.y #0018 ADD2 =Sprite.y ~tileview.y #0018 ADD2 =Screen.y
#00 =i #00 =i
$bytes $bytes
~tileview.x #0088 ADD2 =Sprite.x ~tileview.x #0088 ADD2 =Screen.x
,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
( draw ) #02 =Sprite.color ( draw ) #22 =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ~tileview.addr #00 ~i ADD2 PEK2 #0f AND #08 MUL ADD2 =Screen.addr
( draw ) #02 =Sprite.color ( draw ) #22 =Screen.color
( incr ) ~i #01 ADD =i ( incr ) ~i #01 ADD =i
( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~Screen.y 8+ =Screen.y
~i #08 LTH ,$bytes JNZ2 ~i #08 LTH ,$bytes JNZ2
( operations ) ( operations )
~Sprite.y 8+ =Sprite.y ~Screen.y 8+ =Screen.y
,movedown_icn =Sprite.addr ,movedown_icn =Screen.addr
#01 =Sprite.color #21 =Screen.color
~Sprite.x 8- =Sprite.x ~Screen.x 8- =Screen.x
,moveup_icn =Sprite.addr ,moveup_icn =Screen.addr
#01 =Sprite.color #21 =Screen.color
( draw tiles ) ( draw tiles )
~tileview.y =Sprite.y ~tileview.y =Screen.y
#00 =pt.x #00 =pt.y ~tileview.addr =Sprite.addr #00 =pt.x #00 =pt.y ~tileview.addr =Screen.addr
$tiles-ver $tiles-ver
#00 =pt.x #00 =pt.x
~tileview.x #0088 ADD2 =Sprite.x ~tileview.x #0088 ADD2 =Screen.x
$tiles-hor $tiles-hor
( draw ) #03 =Sprite.color ( draw ) #23 =Screen.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~Screen.addr 8+ =Screen.addr
( incr ) ~pt.x #01 ADD =pt.x ( incr ) ~pt.x #01 ADD =pt.x
~pt.x #02 LTH ,$tiles-hor JNZ2 ~pt.x #02 LTH ,$tiles-hor JNZ2
( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~pt.y #01 ADD =pt.y
( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~Screen.y 8+ =Screen.y
~pt.y #02 LTH ,$tiles-ver JNZ2 ~pt.y #02 LTH ,$tiles-ver JNZ2
RTN RTN
@ -424,14 +423,14 @@ RTN
( get bit ) ( get bit )
,blank_icn #00 ,blank_icn #00
~tileview.addr #00 ~pt.y ADD2 PEK2 #07 ~pt.x SUB SFT #01 AND ( get bit ) ~tileview.addr #00 ~pt.y ADD2 PEK2 #07 ~pt.x SUB SFT #01 AND ( get bit )
8* ADD2 =Sprite.addr ( add *8 ) 8* ADD2 =Screen.addr ( add *8 )
( draw ) #01 =Sprite.color ( draw ) #21 =Screen.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( incr ) ~pt.x #01 ADD =pt.x ( incr ) ~pt.x #01 ADD =pt.x
~pt.x #08 LTH ,$hor JNZ2 ~pt.x #08 LTH ,$hor JNZ2
( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~Screen.y 8+ =Screen.y
( incr ) ~pt.y #01 ADD =pt.y ( incr ) ~pt.y #01 ADD =pt.y
~Sprite.x #0040 SUB2 =Sprite.x ~Screen.x #0040 SUB2 =Screen.x
~pt.y #08 LTH ,$ver JNZ2 ~pt.y #08 LTH ,$ver JNZ2
RTN RTN
@ -444,37 +443,37 @@ RTN
#0000 EQU2 RTN? ( Return if unchanged ) #0000 EQU2 RTN? ( Return if unchanged )
( clear last cursor ) ( clear last cursor )
~mouse.x =Sprite.x ~mouse.x =Screen.x
~mouse.y =Sprite.y ~mouse.y =Screen.y
,blank_icn =Sprite.addr ,blank_icn =Screen.addr
#10 =Sprite.color #30 =Screen.color
( record mouse positions ) ( record mouse positions )
~Mouse.x =mouse.x ~Mouse.x =mouse.x
~Mouse.y =mouse.y ~Mouse.y =mouse.y
( draw new cursor ) ( draw new cursor )
~mouse.x =Sprite.x ~mouse.x =Screen.x
~mouse.y =Sprite.y ~mouse.y =Screen.y
,tool_selector #00 ~bankview.mode #08 MUL ADD2 =Sprite.addr ,tool_selector #00 ~bankview.mode #08 MUL ADD2 =Screen.addr
#12 =Sprite.color #32 =Screen.color
RTN RTN
@draw-short ( short ) @draw-short ( short )
=addr =addr
,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
( draw ) #02 =Sprite.color ( draw ) #22 =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr PEK2 #0f AND #08 MUL ADD2 =Screen.addr
( draw ) #02 =Sprite.color ( draw ) #22 =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ PEK2 #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
( draw ) #02 =Sprite.color ( draw ) #22 =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Sprite.addr ,font_hex #00 ,addr ++ PEK2 #0f AND #08 MUL ADD2 =Screen.addr
( draw ) #02 =Sprite.color ( draw ) #22 =Screen.color
RTN RTN

View File

@ -13,8 +13,7 @@
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|01a0 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dotw 1 doty 2 isdst 1 pad 4 refresh 1 } |01a0 ;DateTime { year 2 month 1 day 1 hour 1 minute 1 second 1 dotw 1 doty 2 isdst 1 pad 4 refresh 1 }
( program ) ( program )
@ -50,7 +49,7 @@
,neralie-lines JSR2 ,neralie-lines JSR2
BRK BRK
#02 =Sprite.color #22 =Screen.color
#0000 #00 ~number.count DUP2 ,h JSR2 #0000 #00 ~number.count DUP2 ,h JSR2
~number.count #01 ADD =number.count ~number.count #01 ADD =number.count
@ -76,8 +75,8 @@
JMP2r JMP2r
@arvelie-text ( -- ) @arvelie-text ( -- )
~Screen.width #0002 DIV2 #0034 SUB2 =Sprite.x ~Screen.width #0002 DIV2 #0034 SUB2 =Screen.x
~Screen.height #0008 SUB2 =Sprite.y ~Screen.height #0008 SUB2 =Screen.y
~DateTime.year #07d6 SUB2 ~DateTime.year #07d6 SUB2
#000a ,modf JSR2 ,digit JSR2 #000a ,modf JSR2 ,digit JSR2
,digit JSR2 ,digit JSR2
@ -88,7 +87,7 @@
JMP2r JMP2r
@neralie-text ( -- ) @neralie-text ( -- )
~Screen.width #0002 DIV2 #0004 SUB2 =Sprite.x ~Screen.width #0002 DIV2 #0004 SUB2 =Screen.x
~neralie.n0123 ~neralie.n0123
#03e8 ,modf JSR2 ^digit JSR #03e8 ,modf JSR2 ^digit JSR
#0064 ,modf JSR2 ^digit JSR #0064 ,modf JSR2 ^digit JSR
@ -100,14 +99,14 @@
JMP2r JMP2r
@letter ( index* -- ) @letter ( index* -- )
#0008 MUL2 ,font-letters ADD2 =Sprite.addr #0008 MUL2 ,font-letters ADD2 =Screen.addr
^digit-middle JMP ^digit-middle JMP
@digit ( index* -- ) @digit ( index* -- )
#0008 MUL2 ,font-numbers ADD2 =Sprite.addr #0008 MUL2 ,font-numbers ADD2 =Screen.addr
$middle $middle
~neralie.color =Sprite.color ~neralie.color #20 ADD =Screen.color
~Sprite.x #0008 ADD2 =Sprite.x ~Screen.x #0008 ADD2 =Screen.x
JMP2r JMP2r
@neralie-lines ( -- ) @neralie-lines ( -- )
@ -116,14 +115,14 @@
,neralie.n4 SWP POP ~neralie.n0123 ,neralie.n4 SWP POP ~neralie.n0123
DUP2 ,$h JSR2 DUP2 ,$h JSR2
,$next JSR2 #0001 =Sprite.x ~neralie.y #0003 SUB2 =Sprite.y ^digit JSR ,$next JSR2 #0001 =Screen.x ~neralie.y #0003 SUB2 =Screen.y ^digit JSR
DUP2 ,$v JSR2 DUP2 ,$v JSR2
#04 ,v-spacing POK2 #04 ,v-spacing POK2
~lines.y1 #0003 SUB2 ~neralie.y ~neralie.x ,v JSR2 ~lines.y1 #0003 SUB2 ~neralie.y ~neralie.x ,v JSR2
#01 ,v-spacing POK2 #01 ,v-spacing POK2
^$next JSR #0001 =Sprite.y ~neralie.x #0003 SUB2 =Sprite.x ,digit JSR2 ^$next JSR #0001 =Screen.y ~neralie.x #0003 SUB2 =Screen.x ,digit JSR2
DUP2 ^$h JSR DUP2 ^$h JSR
^$next JSR ~Screen.width #0009 SUB2 =Sprite.x ~neralie.y #0003 SUB2 =Sprite.y ,digit JSR2 ^$next JSR ~Screen.width #0009 SUB2 =Screen.x ~neralie.y #0003 SUB2 =Screen.y ,digit JSR2
DUP2 ^$v JSR DUP2 ^$v JSR
^$next JSR POP2 ^$next JSR POP2
DUP2 ^$h JSR DUP2 ^$h JSR

View File

@ -53,8 +53,7 @@
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0140 ;Controller { vector 2 button 1 } |0140 ;Controller { vector 2 button 1 }
|0150 ;Keys { vector 2 key 1 } |0150 ;Keys { vector 2 key 1 }
|0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 } |0160 ;Mouse { vector 2 x 2 y 2 state 1 chord 1 }
@ -99,12 +98,12 @@ BRK
@on-screen ( -- ) @on-screen ( -- )
~document.edit #01 NEQ ^$no-edit JNZ ~document.edit #01 NEQ ^$no-edit JNZ
#0008 =Sprite.x #0008 =Screen.x
~Screen.height #0010 SUB2 =Sprite.y ~Screen.height #0010 SUB2 =Screen.y
,path.name #01 ~timer #04 DIV #03 AND #03 MUL ADD ,draw-label JSR2 ,path.name #01 ~timer #04 DIV #03 AND #03 MUL ADD ,draw-label JSR2
$clear $clear
#00 =Sprite.color #20 =Screen.color
~Sprite.x 8+ DUP2 =Sprite.x ~Screen.x 8+ DUP2 =Screen.x
~Screen.width LTH2 ^$clear JNZ ~Screen.width LTH2 ^$clear JNZ
( blink ) ~timer #01 ADD =timer ( blink ) ~timer #01 ADD =timer
$no-edit $no-edit
@ -623,37 +622,37 @@ RTN
~zoom.active #01 EQU ,draw-canvas-zoom JNZ2 ~zoom.active #01 EQU ,draw-canvas-zoom JNZ2
~canvas.y1 =Sprite.y ~canvas.y1 =Screen.y
,data =Sprite.addr ,data =Screen.addr
$ver $ver
~canvas.x1 =Sprite.x ~canvas.x1 =Screen.x
$hor $hor
( draw ) #09 =Sprite.color ( draw ) #29 =Screen.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~Screen.addr 8+ =Screen.addr
~Sprite.x ~canvas.x2 NEQ2 ^$hor JNZ ~Screen.x ~canvas.x2 NEQ2 ^$hor JNZ
( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~Screen.y 8+ =Screen.y
~Sprite.y ~canvas.y2 NEQ2 ^$ver JNZ ~Screen.y ~canvas.y2 NEQ2 ^$ver JNZ
RTN RTN
@draw-canvas-zoom ( -- ) @draw-canvas-zoom ( -- )
~zoom.y =pt1.y ~zoom.y =pt1.y
~canvas.y1 =Sprite.y ~canvas.y1 =Screen.y
,data =Sprite.addr ,data =Screen.addr
$ver $ver
~canvas.x1 =Sprite.x ~canvas.x1 =Screen.x
~zoom.x =pt1.x ~zoom.x =pt1.x
$hor $hor
( incr ) ,bigpixel_icn #0008 #00 ~pt1.x ~pt1.y ,get-pixel JSR2 MUL2 ADD2 =Sprite.addr ( incr ) ,bigpixel_icn #0008 #00 ~pt1.x ~pt1.y ,get-pixel JSR2 MUL2 ADD2 =Screen.addr
( draw ) #09 =Sprite.color ( draw ) #29 =Screen.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( incr ) ~pt1.x ++ =pt1.x ( incr ) ~pt1.x ++ =pt1.x
~Sprite.x ~canvas.x2 NEQ2 ^$hor JNZ ~Screen.x ~canvas.x2 NEQ2 ^$hor JNZ
( incr ) ~Sprite.y 8+ =Sprite.y ( incr ) ~Screen.y 8+ =Screen.y
( incr ) ~pt1.y ++ =pt1.y ( incr ) ~pt1.y ++ =pt1.y
~Sprite.y ~canvas.y2 NEQ2 ^$ver JNZ ~Screen.y ~canvas.y2 NEQ2 ^$ver JNZ
RTN RTN
@ -666,11 +665,11 @@ RTN
#00 NEQ #00 NEQ
#0101 EQU2 RTN? ( Return if unchanged ) #0101 EQU2 RTN? ( Return if unchanged )
,blank_icn =Sprite.addr ,blank_icn =Screen.addr
( clear brush size ) ( clear brush size )
~cursor.x #0003 SUB2 =Sprite.x ~cursor.y #0003 SUB2 =Sprite.y #10 =Sprite.color ~cursor.x #0003 SUB2 =Screen.x ~cursor.y #0003 SUB2 =Screen.y #30 =Screen.color
( clear last cursor ) ( clear last cursor )
~cursor.x =Sprite.x ~cursor.y =Sprite.y #10 =Sprite.color ~cursor.x =Screen.x ~cursor.y =Screen.y #30 =Screen.color
( record cursor positions ) ( record cursor positions )
~Mouse.x =cursor.x ~Mouse.y =cursor.y ~Mouse.x =cursor.x ~Mouse.y =cursor.y
( draw size cursor ) ( draw size cursor )
@ -683,15 +682,15 @@ RTN
~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 ~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
~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 ~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
~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 ~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
~cursor.x #0003 SUB2 =Sprite.x ~cursor.y #0003 SUB2 =Sprite.y ~cursor.x #0003 SUB2 =Screen.x ~cursor.y #0003 SUB2 =Screen.y
,brush_icns #00 ~brush.size 8* ADD2 =Sprite.addr ,brush_icns #00 ~brush.size 8* ADD2 =Screen.addr
#11 ~Mouse.state #02 MUL ADD =Sprite.color #31 ~Mouse.state #02 MUL ADD =Screen.color
~Mouse.state #00 EQU ^$outside-canvas JNZ RTN ~Mouse.state #00 EQU ^$outside-canvas JNZ RTN
$outside-canvas $outside-canvas
( draw new cursor ) ( draw new cursor )
~cursor.x =Sprite.x ~cursor.y =Sprite.y ~cursor.x =Screen.x ~cursor.y =Screen.y
,pointers_icn #00 ~Controller.button #02 EQU 8* ADD2 =Sprite.addr ,pointers_icn #00 ~Controller.button #02 EQU 8* ADD2 =Screen.addr
#1f ~Mouse.state #01 EQU #0a MUL SUB =Sprite.color #3f ~Mouse.state #01 EQU #0a MUL SUB =Screen.color
RTN RTN
@ -703,18 +702,18 @@ RTN
~toolpane.x1 -- ~toolpane.y1 -- ~toolpane.x2 ~toolpane.y2 #00 ,line-rect JSR2 ~toolpane.x1 -- ~toolpane.y1 -- ~toolpane.x2 ~toolpane.y2 #00 ,line-rect JSR2
~toolpane.x1 #0002 SUB2 ~toolpane.y1 #0002 SUB2 ~toolpane.x2 ~toolpane.y2 #01 ,line-rect JSR2 ~toolpane.x1 #0002 SUB2 ~toolpane.y1 #0002 SUB2 ~toolpane.x2 ~toolpane.y2 #01 ,line-rect JSR2
~toolpane.x1 =Sprite.x ~toolpane.y1 =Sprite.y ,tool_icns =Sprite.addr ~toolpane.x1 =Screen.x ~toolpane.y1 =Screen.y ,tool_icns =Screen.addr
$loop $loop
( draw ) #01 ~Sprite.x ~toolpane.x1 SUB2 8/ SWP POP ~brush.tool EQU #02 MUL ADD =Sprite.color ( draw ) #21 ~Screen.x ~toolpane.x1 SUB2 8/ SWP POP ~brush.tool EQU #02 MUL ADD =Screen.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~Screen.addr 8+ =Screen.addr
~Sprite.x ~toolpane.x2 LTH2 ^$loop JNZ ~Screen.x ~toolpane.x2 LTH2 ^$loop JNZ
~zoom.active #01 NEQ ^$no-zoom JNZ ~zoom.active #01 NEQ ^$no-zoom JNZ
~Sprite.x #0008 SUB2 =Sprite.x ~Screen.x #0008 SUB2 =Screen.x
,tool_icns #0028 ADD2 =Sprite.addr ,tool_icns #0028 ADD2 =Screen.addr
#01 #04 ~brush.tool EQU #02 MUL ADD =Sprite.color #21 #04 ~brush.tool EQU #02 MUL ADD =Screen.color
$no-zoom $no-zoom
RTN RTN
@ -727,13 +726,13 @@ RTN
~pattpane.x1 -- ~pattpane.y1 -- ~pattpane.x2 ~pattpane.y2 #00 ,line-rect JSR2 ~pattpane.x1 -- ~pattpane.y1 -- ~pattpane.x2 ~pattpane.y2 #00 ,line-rect JSR2
~pattpane.x1 #0002 SUB2 ~pattpane.y1 #0002 SUB2 ~pattpane.x2 ~pattpane.y2 #01 ,line-rect JSR2 ~pattpane.x1 #0002 SUB2 ~pattpane.y1 #0002 SUB2 ~pattpane.x2 ~pattpane.y2 #01 ,line-rect JSR2
~pattpane.x1 =Sprite.x ~pattpane.y1 =Sprite.y ,patt_icns =Sprite.addr ~pattpane.x1 =Screen.x ~pattpane.y1 =Screen.y ,patt_icns =Screen.addr
$loop $loop
( draw ) #01 ~Sprite.x ~pattpane.x1 SUB2 8/ SWP POP ~brush.patt EQU #02 MUL ADD =Sprite.color ( draw ) #21 ~Screen.x ~pattpane.x1 SUB2 8/ SWP POP ~brush.patt EQU #02 MUL ADD =Screen.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~Screen.addr 8+ =Screen.addr
~Sprite.x ~pattpane.x2 LTH2 ^$loop JNZ ~Screen.x ~pattpane.x2 LTH2 ^$loop JNZ
RTN RTN
@ -745,13 +744,13 @@ RTN
~sizepane.x1 -- ~sizepane.y1 -- ~sizepane.x2 ~sizepane.y2 #00 ,line-rect JSR2 ~sizepane.x1 -- ~sizepane.y1 -- ~sizepane.x2 ~sizepane.y2 #00 ,line-rect JSR2
~sizepane.x1 #0002 SUB2 ~sizepane.y1 #0002 SUB2 ~sizepane.x2 ~sizepane.y2 #01 ,line-rect JSR2 ~sizepane.x1 #0002 SUB2 ~sizepane.y1 #0002 SUB2 ~sizepane.x2 ~sizepane.y2 #01 ,line-rect JSR2
~sizepane.x1 =Sprite.x ~sizepane.y1 =Sprite.y ,size_icns =Sprite.addr ~sizepane.x1 =Screen.x ~sizepane.y1 =Screen.y ,size_icns =Screen.addr
$loop $loop
( draw ) #01 ~Sprite.x ~sizepane.x1 SUB2 8/ SWP POP ~brush.size EQU #02 MUL ADD =Sprite.color ( draw ) #21 ~Screen.x ~sizepane.x1 SUB2 8/ SWP POP ~brush.size EQU #02 MUL ADD =Screen.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~Screen.addr 8+ =Screen.addr
~Sprite.x ~sizepane.x2 LTH2 ^$loop JNZ ~Screen.x ~sizepane.x2 LTH2 ^$loop JNZ
RTN RTN
@ -763,13 +762,13 @@ RTN
~viewpane.x1 -- ~viewpane.y1 -- ~viewpane.x2 ~viewpane.y2 #00 ,line-rect JSR2 ~viewpane.x1 -- ~viewpane.y1 -- ~viewpane.x2 ~viewpane.y2 #00 ,line-rect JSR2
~viewpane.x1 #0002 SUB2 ~viewpane.y1 #0002 SUB2 ~viewpane.x2 ~viewpane.y2 #01 ,line-rect JSR2 ~viewpane.x1 #0002 SUB2 ~viewpane.y1 #0002 SUB2 ~viewpane.x2 ~viewpane.y2 #01 ,line-rect JSR2
~viewpane.x1 =Sprite.x ~viewpane.y1 =Sprite.y ,view_icns =Sprite.addr ~viewpane.x1 =Screen.x ~viewpane.y1 =Screen.y ,view_icns =Screen.addr
$loop $loop
( draw ) #01 =Sprite.color ( draw ) #21 =Screen.color
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( incr ) ~Sprite.addr 8+ =Sprite.addr ( incr ) ~Screen.addr 8+ =Screen.addr
~Sprite.x ~viewpane.x2 LTH2 ^$loop JNZ ~Screen.x ~viewpane.x2 LTH2 ^$loop JNZ
RTN RTN
@ -791,35 +790,35 @@ RTN
~document.presentation #01 EQU ,$skip-size JNZ2 ~document.presentation #01 EQU ,$skip-size JNZ2
( draw size ) ( draw size )
#0010 =Sprite.y #0010 =Screen.y
( draw width ) ( draw width )
~Screen.width #00a0 SUB2 =Sprite.x ,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ~Screen.width #00a0 SUB2 =Screen.x ,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
( draw ) #01 =Sprite.color ( draw ) #21 =Screen.color
~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr ~Screen.x 8+ =Screen.x ,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Screen.addr
( draw ) #01 =Sprite.color ( draw ) #21 =Screen.color
( draw height ) ( draw height )
~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr ~Screen.x 8+ =Screen.x ,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Screen.addr
( draw ) #01 =Sprite.color ( draw ) #21 =Screen.color
~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr ~Screen.x 8+ =Screen.x ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Screen.addr
( draw ) #01 =Sprite.color ( draw ) #21 =Screen.color
$skip-size $skip-size
( draw save/load/guides icons ) ( draw save/load/guides icons )
~Screen.height #0010 SUB2 =Sprite.y ~Screen.height #0010 SUB2 =Screen.y
~Screen.width #0028 SUB2 =Sprite.x ~Screen.width #0028 SUB2 =Screen.x
,eye_icn #00 ~document.presentation #08 MUL ADD2 =Sprite.addr ,eye_icn #00 ~document.presentation #08 MUL ADD2 =Screen.addr
#03 =Sprite.color #23 =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,filestate_icn =Sprite.addr ,filestate_icn =Screen.addr
#03 =Sprite.color #23 =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,load_icn =Sprite.addr ,load_icn =Screen.addr
#03 =Sprite.color #23 =Screen.color
~Sprite.x 8+ =Sprite.x ~Screen.x 8+ =Screen.x
,save_icn =Sprite.addr ,save_icn =Screen.addr
#03 =Sprite.color #23 =Screen.color
#0008 =Sprite.x #0008 =Screen.x
,path.name #01 ,draw-label JSR2 ,path.name #01 ,draw-label JSR2
RTN RTN
@ -861,10 +860,10 @@ RTN
=color =color
$loop $loop
DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Sprite.addr DUP2 PEK2 #00 SWP #0008 MUL2 ,font ADD2 =Screen.addr
( draw ) ~color =Sprite.color ( draw ) ~color #20 ADD =Screen.color
( incr ) #0001 ADD2 ( incr ) #0001 ADD2
( incr ) ~Sprite.x 8+ =Sprite.x ( incr ) ~Screen.x 8+ =Screen.x
( loop ) DUP2 PEK2 #00 NEQ ^$loop JNZ ( loop ) DUP2 PEK2 #00 NEQ ^$loop JNZ
POP2 POP2

View File

@ -28,7 +28,7 @@
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 } |0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { pad 8 char 1 byte 1 short 2 } |0110 ;Console { pad 8 char 1 byte 1 short 2 }
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 } |0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 } |0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|0140 ;Controller { vector 2 button 1 } |0140 ;Controller { vector 2 button 1 }
|0150 ;Keys { vector 2 key 1 } |0150 ;Keys { vector 2 key 1 }

View File

@ -210,29 +210,15 @@ console_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
Uint8 Uint8
screen_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1) screen_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
{ {
Uint8 *m = u->ram.dat;
ptr += 8;
if(b0 == 0x0c) {
Uint16 x = (m[ptr] << 8) + m[ptr + 1];
Uint16 y = (m[ptr + 2] << 8) + m[ptr + 3];
Uint8 *layer = b1 >> 4 & 0xf ? ppu.fg : ppu.bg;
putpixel(&ppu, layer, x, y, b1 & 0xf);
reqdraw = 1;
}
return b1;
}
Uint8
sprite_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1)
{
Uint8 *m = u->ram.dat;
ptr += 8;
if(b0 == 0x0e) { if(b0 == 0x0e) {
Uint16 x = (m[ptr] << 8) + m[ptr + 1]; Uint16 x = mempeek16(u, ptr + 8);
Uint16 y = (m[ptr + 2] << 8) + m[ptr + 3]; Uint16 y = mempeek16(u, ptr + 10);
Uint8 *layer = (b1 >> 4) & 0xf ? ppu.fg : ppu.bg; Uint8 *addr = &u->ram.dat[mempeek16(u, ptr + 12)];
Uint8 *sprite = &m[(m[ptr + 4] << 8) + m[ptr + 5]]; Uint8 *layer = (b1 >> 4 & 0xf) % 2 ? ppu.fg : ppu.bg;
putsprite(&ppu, layer, x, y, sprite, b1 & 0xf); if((b1 >> 4 & 0xf) / 2)
putsprite(&ppu, layer, x, y, addr, b1 & 0xf);
else
putpixel(&ppu, layer, x, y, b1 & 0xf);
reqdraw = 1; reqdraw = 1;
} }
return b1; return b1;
@ -398,7 +384,7 @@ main(int argc, char **argv)
devsystem = portuxn(&u, 0x00, "system", system_poke); devsystem = portuxn(&u, 0x00, "system", system_poke);
portuxn(&u, 0x01, "console", console_poke); portuxn(&u, 0x01, "console", console_poke);
devscreen = portuxn(&u, 0x02, "screen", screen_poke); devscreen = portuxn(&u, 0x02, "screen", screen_poke);
portuxn(&u, 0x03, "sprite", sprite_poke); portuxn(&u, 0x03, "---", ppnil);
devctrl = portuxn(&u, 0x04, "controller", ppnil); devctrl = portuxn(&u, 0x04, "controller", ppnil);
devkey = portuxn(&u, 0x05, "key", ppnil); devkey = portuxn(&u, 0x05, "key", ppnil);
devmouse = portuxn(&u, 0x06, "mouse", ppnil); devmouse = portuxn(&u, 0x06, "mouse", ppnil);

View File

@ -46,5 +46,7 @@ int loaduxn(Uxn *c, char *filepath);
int bootuxn(Uxn *c); int bootuxn(Uxn *c);
int inituxn(Uxn *u, Uint16 vec); int inituxn(Uxn *u, Uint16 vec);
int evaluxn(Uxn *u, Uint16 vec); int evaluxn(Uxn *u, Uint16 vec);
Device *portuxn(Uxn *u, Uint8 id, char *name, Uint8 (*pofn)(Uxn *, Uint16, Uint8, Uint8));
void mempoke16(Uxn *u, Uint16 a, Uint16 b); void mempoke16(Uxn *u, Uint16 a, Uint16 b);
Uint16 mempeek16(Uxn *u, Uint16 a);
Device *portuxn(Uxn *u, Uint8 id, char *name, Uint8 (*pofn)(Uxn *, Uint16, Uint8, Uint8));