| ... | ... |
@@ -45,9 +45,10 @@ |
| 45 | 45 |
;pt1 { x 2 y 2 }
|
| 46 | 46 |
;pt2 { x 2 y 2 } ( paint-rect )
|
| 47 | 47 |
;px { x 1 y 1 }
|
| 48 |
-;document { state 1 edit 1 }
|
|
| 48 |
+;document { state 1 edit 1 presentation 1 }
|
|
| 49 | 49 |
;path { length 1 name 20 }
|
| 50 | 50 |
;timer { byte 1 }
|
| 51 |
+;theme { r0 2 g0 2 b0 2 r1 2 g1 2 b1 2 }
|
|
| 51 | 52 |
|
| 52 | 53 |
( devices ) |
| 53 | 54 |
|
| ... | ... |
@@ -68,7 +69,10 @@ |
| 68 | 69 |
@RESET ( -- ) |
| 69 | 70 |
|
| 70 | 71 |
( theme ) |
| 71 |
- #e0fd =System.r #30fd =System.g #30fd =System.b |
|
| 72 |
+ #e0cd =theme.r0 #30fd =theme.g0 #30fd =theme.b0 ( normal mode ) |
|
| 73 |
+ #00fe =theme.r1 #00f3 =theme.g1 #00f3 =theme.b1 ( presentation mode ) |
|
| 74 |
+ |
|
| 75 |
+ ~theme.r0 =System.r ~theme.g0 =System.g ~theme.b0 =System.b |
|
| 72 | 76 |
|
| 73 | 77 |
( default canvas ) |
| 74 | 78 |
#002a =canvas.w #001a =canvas.h |
| ... | ... |
@@ -233,22 +237,26 @@ BRK |
| 233 | 237 |
|
| 234 | 238 |
( background interface ) |
| 235 | 239 |
~Mouse.y STEP8 ~Screen.height #0010 SUB2 NEQ2 ^$no-touch-background JNZ |
| 236 |
- ~Mouse.x ~Screen.width #0020 SUB2 SUB2 8/ |
|
| 237 |
- DUP2 #0000 NEQ2 ^$no-clear-button JNZ |
|
| 238 |
- ,clear JSR2 |
|
| 240 |
+ ~Mouse.x ~Screen.width #0028 SUB2 SUB2 8/ SWP POP |
|
| 241 |
+ DUP #00 NEQ ^$no-eye-button JNZ |
|
| 242 |
+ ,present JSR2 |
|
| 243 |
+ ( release ) #00 =Mouse.state |
|
| 244 |
+ $no-eye-button |
|
| 245 |
+ DUP #01 NEQ ^$no-rename-button JNZ |
|
| 246 |
+ ,rename JSR2 |
|
| 239 | 247 |
#01 =document.edit |
| 240 | 248 |
( release ) #00 =Mouse.state |
| 241 |
- $no-clear-button |
|
| 242 |
- DUP2 #0001 NEQ2 ^$no-load-button JNZ |
|
| 249 |
+ $no-rename-button |
|
| 250 |
+ DUP #02 NEQ ^$no-load-button JNZ |
|
| 243 | 251 |
,path.name ,load-file JSR2 |
| 244 | 252 |
,draw-canvas JSR2 |
| 245 | 253 |
( release ) #00 =Mouse.state |
| 246 | 254 |
$no-load-button |
| 247 |
- DUP2 #0002 NEQ2 ^$no-save-button JNZ |
|
| 255 |
+ DUP #03 NEQ ^$no-save-button JNZ |
|
| 248 | 256 |
,path.name ,save-file JSR2 |
| 249 | 257 |
( release ) #00 =Mouse.state |
| 250 | 258 |
$no-save-button |
| 251 |
- POP2 |
|
| 259 |
+ POP |
|
| 252 | 260 |
$no-touch-background |
| 253 | 261 |
|
| 254 | 262 |
( jump label ) |
| ... | ... |
@@ -348,12 +356,15 @@ BRK |
| 348 | 356 |
|
| 349 | 357 |
RTN |
| 350 | 358 |
|
| 351 |
-@clear ( -- ) |
|
| 359 |
+@rename |
|
| 352 | 360 |
|
| 353 |
- ( new label ) |
|
| 354 | 361 |
,untitled_txt ,path.name ,strcpy JSR2 |
| 355 | 362 |
#00 =path.length |
| 356 |
- ( erase data ) |
|
| 363 |
+ |
|
| 364 |
+RTN |
|
| 365 |
+ |
|
| 366 |
+@clear ( -- ) |
|
| 367 |
+ |
|
| 357 | 368 |
,data FILESIZE ,data ADD2 |
| 358 | 369 |
$loop |
| 359 | 370 |
( write ) OVR2 #00 ROT ROT POK2 |
| ... | ... |
@@ -364,6 +375,29 @@ RTN |
| 364 | 375 |
|
| 365 | 376 |
RTN |
| 366 | 377 |
|
| 378 |
+@present |
|
| 379 |
+ |
|
| 380 |
+ ~document.presentation #00 EQU =document.presentation |
|
| 381 |
+ |
|
| 382 |
+ ~document.presentation |
|
| 383 |
+ DUP #00 NEQ ^$skip0 JNZ |
|
| 384 |
+ ~theme.r0 =System.r ~theme.g0 =System.g ~theme.b0 =System.b |
|
| 385 |
+ $skip0 |
|
| 386 |
+ DUP #01 NEQ ^$skip1 JNZ |
|
| 387 |
+ ~theme.r1 =System.r ~theme.g1 =System.g ~theme.b1 =System.b |
|
| 388 |
+ $skip1 |
|
| 389 |
+ POP |
|
| 390 |
+ |
|
| 391 |
+ ~toolpane.x1 #0002 SUB2 ~toolpane.y1 #0002 SUB2 ~toolpane.x2 ++ ~toolpane.y2 ++ #00 ,fill-rect JSR2 |
|
| 392 |
+ ~pattpane.x1 #0002 SUB2 ~pattpane.y1 #0002 SUB2 ~pattpane.x2 ++ ~pattpane.y2 ++ #00 ,fill-rect JSR2 |
|
| 393 |
+ ~sizepane.x1 #0002 SUB2 ~sizepane.y1 #0002 SUB2 ~sizepane.x2 ++ ~sizepane.y2 ++ #00 ,fill-rect JSR2 |
|
| 394 |
+ ~viewpane.x1 #0002 SUB2 ~viewpane.y1 #0002 SUB2 ~viewpane.x2 ++ ~viewpane.y2 ++ #00 ,fill-rect JSR2 |
|
| 395 |
+ |
|
| 396 |
+ ( clear panes ) |
|
| 397 |
+ ,redraw JSR2 |
|
| 398 |
+ |
|
| 399 |
+RTN |
|
| 400 |
+ |
|
| 367 | 401 |
@load-file ( path -- ) |
| 368 | 402 |
|
| 369 | 403 |
=File.name FILESIZE =File.length ,data =File.load |
| ... | ... |
@@ -646,7 +680,9 @@ RTN |
| 646 | 680 |
RTN |
| 647 | 681 |
|
| 648 | 682 |
@draw-toolpane ( -- ) |
| 649 |
- |
|
| 683 |
+ |
|
| 684 |
+ ~document.presentation #00 EQU ^$skip JNZ RTN $skip |
|
| 685 |
+ |
|
| 650 | 686 |
( frame ) |
| 651 | 687 |
~toolpane.x1 -- ~toolpane.y1 -- ~toolpane.x2 ~toolpane.y2 #00 ,line-rect JSR2 |
| 652 | 688 |
~toolpane.x1 #0002 SUB2 ~toolpane.y1 #0002 SUB2 ~toolpane.x2 ~toolpane.y2 #01 ,line-rect JSR2 |
| ... | ... |
@@ -668,7 +704,9 @@ RTN |
| 668 | 704 |
RTN |
| 669 | 705 |
|
| 670 | 706 |
@draw-pattpane ( -- ) |
| 671 |
- |
|
| 707 |
+ |
|
| 708 |
+ ~document.presentation #00 EQU ^$skip JNZ RTN $skip |
|
| 709 |
+ |
|
| 672 | 710 |
( frame ) |
| 673 | 711 |
~pattpane.x1 -- ~pattpane.y1 -- ~pattpane.x2 ~pattpane.y2 #00 ,line-rect JSR2 |
| 674 | 712 |
~pattpane.x1 #0002 SUB2 ~pattpane.y1 #0002 SUB2 ~pattpane.x2 ~pattpane.y2 #01 ,line-rect JSR2 |
| ... | ... |
@@ -684,7 +722,9 @@ RTN |
| 684 | 722 |
RTN |
| 685 | 723 |
|
| 686 | 724 |
@draw-sizepane ( -- ) |
| 687 |
- |
|
| 725 |
+ |
|
| 726 |
+ ~document.presentation #00 EQU ^$skip JNZ RTN $skip |
|
| 727 |
+ |
|
| 688 | 728 |
( frame ) |
| 689 | 729 |
~sizepane.x1 -- ~sizepane.y1 -- ~sizepane.x2 ~sizepane.y2 #00 ,line-rect JSR2 |
| 690 | 730 |
~sizepane.x1 #0002 SUB2 ~sizepane.y1 #0002 SUB2 ~sizepane.x2 ~sizepane.y2 #01 ,line-rect JSR2 |
| ... | ... |
@@ -701,6 +741,8 @@ RTN |
| 701 | 741 |
|
| 702 | 742 |
@draw-viewpane ( -- ) |
| 703 | 743 |
|
| 744 |
+ ~document.presentation #00 EQU ^$skip JNZ RTN $skip |
|
| 745 |
+ |
|
| 704 | 746 |
( frame ) |
| 705 | 747 |
~viewpane.x1 -- ~viewpane.y1 -- ~viewpane.x2 ~viewpane.y2 #00 ,line-rect JSR2 |
| 706 | 748 |
~viewpane.x1 #0002 SUB2 ~viewpane.y1 #0002 SUB2 ~viewpane.x2 ~viewpane.y2 #01 ,line-rect JSR2 |
| ... | ... |
@@ -727,41 +769,44 @@ RTN |
| 727 | 769 |
@draw-background |
| 728 | 770 |
|
| 729 | 771 |
( draw hor line ) |
| 730 |
- #0000 ~Screen.width ~Screen.height #0002 DIV2 ,line-horizontal-dotted JSR2 |
|
| 772 |
+ #0000 ~Screen.width ~Screen.height #0002 DIV2 ~document.presentation #00 EQU ,line-horizontal-dotted JSR2 |
|
| 731 | 773 |
( draw ver line ) |
| 732 |
- ~Screen.width #0002 DIV2 #0000 ~Screen.height ,line-vertical-dotted JSR2 |
|
| 733 |
- |
|
| 734 |
- ( draw size ) |
|
| 735 |
- #0010 =Sprite.y |
|
| 736 |
- ( draw width ) |
|
| 737 |
- ~Screen.width #00a0 SUB2 =Sprite.x ,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr |
|
| 738 |
- ( draw ) #01 =Sprite.color |
|
| 739 |
- ~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr |
|
| 740 |
- ( draw ) #01 =Sprite.color |
|
| 741 |
- ( draw height ) |
|
| 742 |
- ~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr |
|
| 743 |
- ( draw ) #01 =Sprite.color |
|
| 744 |
- ~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr |
|
| 745 |
- ( draw ) #01 =Sprite.color |
|
| 774 |
+ ~Screen.width #0002 DIV2 #0000 ~Screen.height ~document.presentation #00 EQU ,line-vertical-dotted JSR2 |
|
| 775 |
+ |
|
| 776 |
+ ~document.presentation #01 EQU ,$skip-size JNZ2 |
|
| 777 |
+ ( draw size ) |
|
| 778 |
+ #0010 =Sprite.y |
|
| 779 |
+ ( draw width ) |
|
| 780 |
+ ~Screen.width #00a0 SUB2 =Sprite.x ,font_hex ~canvas.w #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr |
|
| 781 |
+ ( draw ) #01 =Sprite.color |
|
| 782 |
+ ~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.w #0f AND #08 MUL ADD2 =Sprite.addr |
|
| 783 |
+ ( draw ) #01 =Sprite.color |
|
| 784 |
+ ( draw height ) |
|
| 785 |
+ ~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #f0 AND #04 SFT #08 MUL ADD2 =Sprite.addr |
|
| 786 |
+ ( draw ) #01 =Sprite.color |
|
| 787 |
+ ~Sprite.x 8+ =Sprite.x ,font_hex ~canvas.h #0f AND #08 MUL ADD2 =Sprite.addr |
|
| 788 |
+ ( draw ) #01 =Sprite.color |
|
| 789 |
+ $skip-size |
|
| 790 |
+ |
|
| 746 | 791 |
( draw save/load/guides icons ) |
| 747 | 792 |
~Screen.height #0010 SUB2 =Sprite.y |
| 748 |
- ~Screen.width #0020 SUB2 =Sprite.x |
|
| 749 |
- ( TODO: Presentation mode button |
|
| 750 |
- ,guides_icn =Sprite.addr |
|
| 751 |
- #01 =Sprite.color |
|
| 793 |
+ ~Screen.width #0028 SUB2 =Sprite.x |
|
| 794 |
+ ,eye #00 ~document.presentation #08 MUL ADD2 =Sprite.addr |
|
| 795 |
+ #03 =Sprite.color |
|
| 752 | 796 |
~Sprite.x 8+ =Sprite.x |
| 753 |
- ) |
|
| 754 | 797 |
,filestate_icn =Sprite.addr |
| 755 |
- #01 =Sprite.color |
|
| 798 |
+ #03 =Sprite.color |
|
| 756 | 799 |
~Sprite.x 8+ =Sprite.x |
| 757 | 800 |
,load_icn =Sprite.addr |
| 758 |
- #01 =Sprite.color |
|
| 801 |
+ #03 =Sprite.color |
|
| 759 | 802 |
~Sprite.x 8+ =Sprite.x |
| 760 | 803 |
,save_icn =Sprite.addr |
| 761 |
- #01 =Sprite.color |
|
| 762 |
- ( filename ) |
|
| 763 |
- #0008 =Sprite.x |
|
| 764 |
- ,path.name #01 ,draw-label JSR2 |
|
| 804 |
+ #03 =Sprite.color |
|
| 805 |
+ |
|
| 806 |
+ ~document.presentation #01 EQU ^$skip-path JNZ |
|
| 807 |
+ #0008 =Sprite.x |
|
| 808 |
+ ,path.name #01 ,draw-label JSR2 |
|
| 809 |
+ $skip-path |
|
| 765 | 810 |
|
| 766 | 811 |
RTN |
| 767 | 812 |
|
| ... | ... |
@@ -811,22 +856,22 @@ RTN |
| 811 | 856 |
|
| 812 | 857 |
RTN |
| 813 | 858 |
|
| 814 |
-@line-horizontal-dotted ( x0 x1 y -- ) |
|
| 859 |
+@line-horizontal-dotted ( x0 x1 y color -- ) |
|
| 815 | 860 |
|
| 816 |
- =Screen.y OVR2 =Screen.x |
|
| 861 |
+ =color =Screen.y OVR2 =Screen.x |
|
| 817 | 862 |
$draw-hor |
| 818 |
- ( draw ) #01 =Screen.color |
|
| 863 |
+ ( draw ) ~color =Screen.color |
|
| 819 | 864 |
( incr ) SWP2 #0002 ADD2 DUP2 =Screen.x SWP2 |
| 820 | 865 |
OVR2 OVR2 LTH2 ^$draw-hor JNZ |
| 821 | 866 |
POP2 POP2 |
| 822 | 867 |
|
| 823 | 868 |
RTN |
| 824 | 869 |
|
| 825 |
-@line-vertical-dotted ( x y0 y1 -- ) |
|
| 870 |
+@line-vertical-dotted ( x y0 y1 color -- ) |
|
| 826 | 871 |
|
| 827 |
- STH2 SWP2 =Screen.x STH2r OVR2 =Screen.y |
|
| 872 |
+ =color STH2 SWP2 =Screen.x STH2r OVR2 =Screen.y |
|
| 828 | 873 |
$draw-ver |
| 829 |
- ( draw ) #01 =Screen.color |
|
| 874 |
+ ( draw ) ~color =Screen.color |
|
| 830 | 875 |
( incr ) SWP2 #0002 ADD2 DUP2 =Screen.y SWP2 |
| 831 | 876 |
OVR2 OVR2 LTH2 ^$draw-ver JNZ |
| 832 | 877 |
POP2 POP2 |
| ... | ... |
@@ -898,8 +943,8 @@ RTN |
| 898 | 943 |
[ 4040 4070 f8f8 f870 ] |
| 899 | 944 |
|
| 900 | 945 |
@eye |
| 901 |
- [ 0000 0082 4438 0000 ] ( open ) |
|
| 902 |
- [ 0038 4492 2810 0000 ] ( closed ) |
|
| 946 |
+ [ 0038 4492 2810 0000 ] ( open ) |
|
| 947 |
+ [ 0000 0082 4438 0000 ] ( closed ) |
|
| 903 | 948 |
|
| 904 | 949 |
@load_icn [ feaa d6aa d4aa f400 ] |
| 905 | 950 |
@save_icn [ fe82 8282 848a f400 ] |
| ... | ... |
@@ -154,7 +154,7 @@ loadtheme(Uint8 *addr) |
| 154 | 154 |
r = (*(addr + i / 2) >> (!(i % 2) << 2)) & 0x0f, |
| 155 | 155 |
g = (*(addr + 2 + i / 2) >> (!(i % 2) << 2)) & 0x0f, |
| 156 | 156 |
b = (*(addr + 4 + i / 2) >> (!(i % 2) << 2)) & 0x0f; |
| 157 |
- theme[i] = (r << 20) + (g << 12) + (b << 4); |
|
| 157 |
+ theme[i] = (r << 20) + (r << 16) + (g << 12) + (g << 8) + (b << 4) + b; |
|
| 158 | 158 |
} |
| 159 | 159 |
screen.reqdraw = 1; |
| 160 | 160 |
} |
| ... | ... |
@@ -444,6 +444,7 @@ Uint8 |
| 444 | 444 |
system_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1) |
| 445 | 445 |
{
|
| 446 | 446 |
Uint8 *m = u->ram.dat; |
| 447 |
+ m[PAGE_DEVICE + 0x00f0 + b0] = b1; |
|
| 447 | 448 |
loadtheme(&m[PAGE_DEVICE + 0x00f8]); |
| 448 | 449 |
(void)ptr; |
| 449 | 450 |
(void)b0; |
| ... | ... |
@@ -466,7 +467,6 @@ start(Uxn *u) |
| 466 | 467 |
{
|
| 467 | 468 |
int ticknext = 0; |
| 468 | 469 |
evaluxn(u, PAGE_VECTORS); |
| 469 |
- loadtheme(u->ram.dat + PAGE_DEVICE + 0x00f8); |
|
| 470 | 470 |
if(screen.reqdraw) |
| 471 | 471 |
redraw(pixels, u); |
| 472 | 472 |
while(1) {
|