uxn/projects/examples/gui.picture.usm

103 lines
2.6 KiB
Plaintext
Raw Normal View History

2021-04-02 00:53:41 -04:00
( GUI Picture )
2021-02-27 12:39:06 -05:00
2021-03-16 00:29:44 -04:00
%RTN { JMP2r }
2021-04-14 15:11:01 -04:00
%8+ { #0008 ADD2 }
2021-03-16 00:29:44 -04:00
2021-04-14 15:11:01 -04:00
;color { byte 1 }
;position { x 2 y 2 }
;size { width 2 height 2 }
2021-02-27 12:39:06 -05:00
|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|0110 ;Console { vector 2 pad 6 char 1 byte 1 short 2 string 2 }
2021-04-09 13:01:53 -04:00
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 addr 2 color 1 }
2021-04-17 16:49:33 -04:00
|0170 ;File { vector 2 success 2 offset 2 pad 2 name 2 length 2 load 2 save 2 }
2021-03-21 17:16:19 -04:00
2021-04-05 16:00:55 -04:00
( program )
|0200
2021-02-27 12:39:06 -05:00
( theme ) #037a =System.r #032a =System.g #052a =System.b
2021-04-10 15:19:38 -04:00
( background ) ,checker_icn #22 ,cover-pattern JSR2
2021-04-10 15:19:38 -04:00
( load ) ,icn1_path =File.name #1800 =File.length ,image =File.load
( draw ) #0008 #0008 #0100 #00c0 #27 ,image ,draw-icn JSR2
2021-04-11 23:38:21 -04:00
( load ) ,icn2_path =File.name #0800 =File.length ,image =File.load
( draw ) #0010 #0078 #0080 #0080 #27 ,image ,draw-icn JSR2
( load ) ,chr1_path =File.name #4000 =File.length ,image =File.load
( draw ) #00a8 #0010 #0100 #0100 #4f ,image ,draw-chr JSR2
( load ) ,chr2_path =File.name #0900 =File.length ,image =File.load
( draw ) #0088 #0088 #0060 #0060 #41 ,image ,draw-chr JSR2
2021-02-27 12:39:06 -05:00
BRK
2021-04-14 15:11:01 -04:00
@draw-icn ( x y width height color addr -- )
( load ) =Screen.addr =color =size.height =size.width =position.y =position.x
#0000 ~size.height
$ver
( save ) OVR2 ~position.y ADD2 =Screen.y
#0000 ~size.width
$hor
( save ) OVR2 ~position.x ADD2 =Screen.x
( draw ) ~color =Screen.color
( incr ) ~Screen.addr 8+ =Screen.addr
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ^$hor JNZ
POP2 POP2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ^$ver JNZ
POP2 POP2
2021-04-10 15:19:38 -04:00
2021-04-14 15:11:01 -04:00
RTN
2021-04-10 15:19:38 -04:00
2021-04-14 15:11:01 -04:00
@draw-chr ( x y width height color addr -- )
2021-04-10 15:19:38 -04:00
2021-04-14 15:11:01 -04:00
( load ) =Screen.addr =color =size.height =size.width =position.y =position.x
#0000 ~size.height
2021-04-10 15:19:38 -04:00
$ver
2021-04-14 15:11:01 -04:00
( save ) OVR2 ~position.y ADD2 =Screen.y
#0000 ~size.width
2021-04-10 15:19:38 -04:00
$hor
2021-04-14 15:11:01 -04:00
( save ) OVR2 ~position.x ADD2 =Screen.x
( draw ) ~color =Screen.color
2021-04-10 15:19:38 -04:00
( incr ) ~Screen.addr #0010 ADD2 =Screen.addr
2021-04-14 15:11:01 -04:00
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ^$hor JNZ
POP2 POP2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ^$ver JNZ
POP2 POP2
2021-04-10 15:19:38 -04:00
RTN
2021-04-14 15:11:01 -04:00
@cover-pattern ( addr color -- )
2021-02-27 12:39:06 -05:00
2021-04-14 15:11:01 -04:00
( load ) =color =Screen.addr
#0000 ~Screen.height
2021-03-13 20:34:08 -05:00
$ver
2021-04-14 15:11:01 -04:00
( save ) OVR2 =Screen.y
#0000 ~Screen.width
2021-03-13 20:34:08 -05:00
$hor
2021-04-14 15:11:01 -04:00
( save ) OVR2 =Screen.x
( draw ) ~color =Screen.color
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ^$hor JNZ
POP2 POP2
( incr ) SWP2 8+ SWP2
OVR2 OVR2 LTH2 ^$ver JNZ
POP2 POP2
2021-02-27 12:39:06 -05:00
2021-03-14 17:26:17 -04:00
RTN
2021-02-27 12:39:06 -05:00
2021-04-14 15:11:01 -04:00
@checker_icn [ f0f0 f0f0 0f0f 0f0f ]
@icn1_path [ projects/pictures/ergo100x0c0.bit 00 ]
@icn2_path [ projects/pictures/dafu80x80.bit 00 ]
@chr1_path [ projects/pictures/zerotwo2020.chr 00 ]
@chr2_path [ projects/pictures/felix0cx0c.chr 00 ]
2021-04-10 15:19:38 -04:00
@image [ ]