| ... | ... |
@@ -13,9 +13,9 @@ |
| 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 | 15 |
|0120 ;Screen { vector 2 width 2 height 2 pad 2 x 2 y 2 color 1 }
|
| 16 |
-|0130 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
|
| 17 |
-|0140 ;Controller { p1 1 }
|
|
| 18 |
-|0150 ;Keys { key 1 }
|
|
| 16 |
+|0130 ;Sprite { vector 2 pad 6 x 2 y 2 addr 2 color 1 }
|
|
| 17 |
+|0140 ;Controller { vector 2 p1 1 }
|
|
| 18 |
+|0150 ;Keys { vector 2 key 1 }
|
|
| 19 | 19 |
|0160 ;Mouse { x 2 y 2 state 1 chord 1 change 1 }
|
| 20 | 20 |
|0170 ;File { pad 8 name 2 length 2 load 2 save 2 }
|
| 21 | 21 |
|0180 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 }
|
| ... | ... |
@@ -34,13 +34,7 @@ |
| 34 | 34 |
|
| 35 | 35 |
BRK |
| 36 | 36 |
|
| 37 |
-@FRAME |
|
| 38 |
- |
|
| 39 |
- ~Controller.p1 ,on-ctrl-arrows JNZ2 |
|
| 40 |
- |
|
| 41 |
-BRK |
|
| 42 |
- |
|
| 43 |
-@on-ctrl-arrows |
|
| 37 |
+@FRAME |
|
| 44 | 38 |
|
| 45 | 39 |
#0a =slime |
| 46 | 40 |
,default_icn =Sprite.addr |
| ... | ... |
@@ -81,5 +75,3 @@ BRK |
| 81 | 75 |
@left_icn [ 3c7e ef1f 1fef 7e3c ] |
| 82 | 76 |
@right_icn [ 3c7e f7f8 f8f7 7e3c ] |
| 83 | 77 |
@slime_icn [ 0000 183c 3c18 0000 ] |
| 84 |
- |
|
| 85 |
-@ERROR BRK |
| ... | ... |
@@ -1,55 +1,59 @@ |
| 1 | 1 |
( Dev/Keys ) |
| 2 | 2 |
|
| 3 |
+%RTN { JMP2r }
|
|
| 3 | 4 |
%8+ { #0008 ADD2 }
|
| 4 | 5 |
%8* { #0030 SFT2 }
|
| 5 | 6 |
%MOD2 { #03 AND }
|
| 6 | 7 |
|
| 7 |
-;cursor { x 2 y 2 blink 1 }
|
|
| 8 |
+;cursor { x 2 y 2 }
|
|
| 8 | 9 |
|
| 9 |
-|0100 ;Console { pad 8 char 1 byte 1 short 2 }
|
|
| 10 |
-|0110 ;Screen { width 2 height 2 pad 4 y 2 x 2 color 1 }
|
|
| 11 |
-|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
|
| 12 |
-|0130 ;Controller { buttons 1 }
|
|
| 13 |
-|0140 ;Keys { key 1 }
|
|
| 14 |
-|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
|
| 15 |
-|0200 ^RESET JMP |
|
| 16 |
-|0204 ,ERROR JMP2 |
|
| 17 |
-|0208 ,FRAME JMP2 |
|
| 10 |
+|0100 ;System { vector 2 pad 6 r 2 g 2 b 2 }
|
|
| 11 |
+|0110 ;Console { pad 8 char 1 byte 1 short 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 }
|
|
| 14 |
+|0140 ;Controller { vector 2 button 1 }
|
|
| 15 |
+|0150 ;Keys { vector 2 key 1 }
|
|
| 18 | 16 |
|
| 19 |
-@RESET |
|
| 17 |
+( program ) |
|
| 20 | 18 |
|
| 21 |
- ( theme ) #127f =System.r #34e7 =System.g #56c4 =System.b |
|
| 19 |
+|0200 @RESET |
|
| 20 |
+ |
|
| 21 |
+ ( theme ) #0f73 =System.r #0fe3 =System.g #0fc3 =System.b |
|
| 22 |
+ ( vectors ) ,KEY =Keys.vector |
|
| 23 |
+ ( vectors ) ,BUTTON =Controller.vector |
|
| 24 |
+ ,draw-cursor JSR2 |
|
| 22 | 25 |
|
| 23 | 26 |
BRK |
| 24 | 27 |
|
| 25 |
-@FRAME |
|
| 26 |
- |
|
| 27 |
- ( theme ) #0daf =System.r #02ff =System.g #035f =System.b |
|
| 28 |
+@KEY |
|
| 28 | 29 |
|
| 29 |
- ( update cursor ) |
|
| 30 |
- #02 =Sprite.color |
|
| 31 |
- |
|
| 32 | 30 |
,cursor_icn =Sprite.addr |
| 33 |
- ~cursor.blink MOD2 #00 EQU =cursor.blink |
|
| 31 |
+ ,font #00 ~Keys.key 8* ADD2 =Sprite.addr |
|
| 32 |
+ ( draw ) #01 =Sprite.color |
|
| 33 |
+ ~Sprite.x 8+ =Sprite.x |
|
| 34 |
+ ( release ) #00 =Keys.key |
|
| 35 |
+ ,draw-cursor JSR2 |
|
| 34 | 36 |
|
| 35 |
- ~Keys #00 EQU ^$end JNZ |
|
| 37 |
+BRK |
|
| 36 | 38 |
|
| 39 |
+@BUTTON |
|
| 40 |
+ |
|
| 37 | 41 |
( enter key ) |
| 38 |
- ~Keys #0d NEQ ^$no-return JNZ |
|
| 42 |
+ ~Controller.button #08 NEQ ^$no-return JNZ |
|
| 43 |
+ #00 =Sprite.color |
|
| 39 | 44 |
#0000 =Sprite.x |
| 40 | 45 |
( incr ) ~Sprite.y 8+ =Sprite.y |
| 41 |
- ( release ) #00 =Keys |
|
| 42 |
- BRK |
|
| 46 |
+ ( release ) #00 =Controller.button |
|
| 47 |
+ ,draw-cursor JSR2 |
|
| 43 | 48 |
$no-return |
| 44 | 49 |
|
| 45 |
- ,font #00 ~Keys 8* ADD2 =Sprite.addr |
|
| 46 |
- ( draw ) #01 =Sprite.color |
|
| 47 |
- ( incr ) ~Sprite.x 8+ =Sprite.x |
|
| 48 |
- ( release ) #00 =Keys |
|
| 50 |
+BRK |
|
| 49 | 51 |
|
| 50 |
- $end |
|
| 52 |
+@draw-cursor |
|
| 53 |
+ |
|
| 54 |
+ ,cursor_icn =Sprite.addr #02 =Sprite.color |
|
| 51 | 55 |
|
| 52 |
-BRK |
|
| 56 |
+RTN |
|
| 53 | 57 |
|
| 54 | 58 |
@cursor_icn [ ffff ffff ffff ffff ] |
| 55 | 59 |
|
| ... | ... |
@@ -89,6 +93,4 @@ BRK |
| 89 | 93 |
0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c |
| 90 | 94 |
] |
| 91 | 95 |
|
| 92 |
-@ERROR BRK |
|
| 93 |
- |
|
| 94 | 96 |
;text { body 2 }
|
| ... | ... |
@@ -16,13 +16,13 @@ |
| 16 | 16 |
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
| 17 | 17 |
|0170 ;Audio { ch1adsr 2 ch2adsr 2 ch3adsr 2 ch4adsr 2 ch1vol 1 ch1pitch 1 ch2vol 1 ch2pitch 1 ch3vol 1 ch3pitch 1 ch4vol 1 ch4pitch 1 }
|
| 18 | 18 |
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
| 19 |
-|0200 ^RESET JMP |
|
| 20 |
-|0204 ,ERROR JMP2 |
|
| 21 |
-|0208 ,FRAME JMP2 |
|
| 22 | 19 |
|
| 23 |
-@RESET |
|
| 20 |
+( program ) |
|
| 21 |
+ |
|
| 22 |
+|0200 @RESET |
|
| 24 | 23 |
|
| 25 | 24 |
( theme ) #03fd =System.r #0ef3 =System.g #0bf2 =System.b |
| 25 |
+ ( vectors ) ,FRAME =Screen.vector |
|
| 26 | 26 |
|
| 27 | 27 |
#004f =Audio.ch1adsr #33 =Audio.ch1vol |
| 28 | 28 |
|
| ... | ... |
@@ -26,13 +26,13 @@ |
| 26 | 26 |
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
| 27 | 27 |
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
| 28 | 28 |
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
| 29 |
-|0200 ^RESET JMP |
|
| 30 |
-|0204 ,ERROR JMP2 |
|
| 31 |
-|0208 ,FRAME JMP2 |
|
| 32 | 29 |
|
| 33 |
-@RESET |
|
| 30 |
+( program ) |
|
| 31 |
+ |
|
| 32 |
+|0200 @RESET |
|
| 34 | 33 |
|
| 35 | 34 |
( theme ) #127f =System.r #34e7 =System.g #56c4 =System.b |
| 35 |
+ ( vectors ) ,FRAME =Screen.vector |
|
| 36 | 36 |
|
| 37 | 37 |
#00a0 =window.w |
| 38 | 38 |
#0050 =window.h |
| ... | ... |
@@ -21,17 +21,12 @@ |
| 21 | 21 |
|0190 ;Time { year 2 month 1 day 1 hour 1 minute 1 second 1 dow 1 doy 2 isdst 1 get 1 }
|
| 22 | 22 |
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
| 23 | 23 |
|
| 24 |
-( vectors ) |
|
| 25 |
- |
|
| 26 |
-|0200 ^RESET JMP |
|
| 27 |
-|0204 ,ERROR JMP2 |
|
| 28 |
-|0208 ,FRAME JMP2 |
|
| 29 |
- |
|
| 30 | 24 |
( program ) |
| 31 | 25 |
|
| 32 |
-@RESET |
|
| 26 |
+|0200 @RESET |
|
| 33 | 27 |
|
| 34 | 28 |
( theme ) #0ff8 =System.r #0f08 =System.g #0f08 =System.b |
| 29 |
+ ( vectors ) ,FRAME =Screen.vector |
|
| 35 | 30 |
|
| 36 | 31 |
#1000 =Audio.ch1adsr |
| 37 | 32 |
#66 =Audio.ch1vol |
| ... | ... |
@@ -14,13 +14,13 @@ |
| 14 | 14 |
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
| 15 | 15 |
|0150 ;Mouse { x 2 y 2 state 1 chord 1 }
|
| 16 | 16 |
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
| 17 |
-|0200 ^RESET JMP |
|
| 18 |
-|0204 ,ERROR JMP2 |
|
| 19 |
-|0208 ,FRAME JMP2 |
|
| 20 | 17 |
|
| 21 |
-@RESET |
|
| 18 |
+( program ) |
|
| 19 |
+ |
|
| 20 |
+|0200 @RESET |
|
| 22 | 21 |
|
| 23 | 22 |
( theme ) #0f0f =System.r #0fff =System.g #0ff0 =System.b |
| 23 |
+ ( vectors ) ,FRAME =Screen.vector |
|
| 24 | 24 |
|
| 25 | 25 |
#0020 #0030 #0060 #0060 =r1.y2 =r1.x2 =r1.y1 =r1.x1 |
| 26 | 26 |
#0058 #0050 #0090 #0080 =r2.y2 =r2.x2 =r2.y1 =r2.x1 |
| ... | ... |
@@ -10,13 +10,13 @@ |
| 10 | 10 |
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
| 11 | 11 |
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
| 12 | 12 |
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
| 13 |
-|0200 ^RESET JMP |
|
| 14 |
-|0204 ,ERROR JMP2 |
|
| 15 |
-|0208 ,FRAME JMP2 |
|
| 16 | 13 |
|
| 17 |
-@RESET |
|
| 14 |
+( program ) |
|
| 15 |
+ |
|
| 16 |
+|0200 @RESET |
|
| 18 | 17 |
|
| 19 | 18 |
( theme ) #0f0f =System.r #0fff =System.g #0ff0 =System.b |
| 19 |
+ ( vectors ) ,FRAME =Screen.vector |
|
| 20 | 20 |
|
| 21 | 21 |
( find screen center ) |
| 22 | 22 |
~Screen.width #0002 DIV2 =center.x |
| ... | ... |
@@ -6,13 +6,13 @@ |
| 6 | 6 |
|
| 7 | 7 |
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
| 8 | 8 |
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
| 9 |
-|0200 ^RESET JMP |
|
| 10 |
-|0204 ,ERROR JMP2 |
|
| 11 |
-|0208 ,FRAME JMP2 |
|
| 12 | 9 |
|
| 13 |
-@RESET |
|
| 10 |
+( program ) |
|
| 11 |
+ |
|
| 12 |
+|0200 @RESET |
|
| 14 | 13 |
|
| 15 | 14 |
( theme ) #0ffc =System.r #0f0b =System.g #0f03 =System.b |
| 15 |
+ ( vectors ) ,FRAME =Screen.vector |
|
| 16 | 16 |
|
| 17 | 17 |
#0000 #0000 #0100 #0100 #01 ,pict_large ,draw-picture JSR2 |
| 18 | 18 |
#0098 #0060 #0080 #0080 #01 ,pict_medium ,draw-picture JSR2 |
| ... | ... |
@@ -16,11 +16,10 @@ |
| 16 | 16 |
|0110 ;Screen { width 2 height 2 pad 4 x 2 y 2 color 1 }
|
| 17 | 17 |
|0120 ;Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
| 18 | 18 |
|01F0 ;System { pad 8 r 2 g 2 b 2 }
|
| 19 |
-|0200 ^RESET JMP |
|
| 20 |
-|0204 ,ERROR JMP2 |
|
| 21 |
-|0208 ,FRAME JMP2 |
|
| 22 | 19 |
|
| 23 |
-@RESET |
|
| 20 |
+( program ) |
|
| 21 |
+ |
|
| 22 |
+|0200 @RESET |
|
| 24 | 23 |
|
| 25 | 24 |
( theme ) #13fd =System.r #1ef3 =System.g #1bf2 =System.b |
| 26 | 25 |
|
| ... | ... |
@@ -160,6 +159,3 @@ RTN |
| 160 | 159 |
8f83 8383 8383 83ff fff7 fdff c0e2 f1ff |
| 161 | 160 |
7fef bfff 07af 5fff ffff ffff ffff ffff |
| 162 | 161 |
] |
| 163 |
- |
|
| 164 |
-@FRAME BRK |
|
| 165 |
-@ERROR BRK |
| ... | ... |
@@ -351,7 +351,7 @@ void |
| 351 | 351 |
domouse(Uxn *u, SDL_Event *event) |
| 352 | 352 |
{
|
| 353 | 353 |
Uint8 flag = 0x00; |
| 354 |
- Uint16 addr = devmouse->addr; |
|
| 354 |
+ Uint16 addr = devmouse->addr + 2; |
|
| 355 | 355 |
Uint16 x = clamp(event->motion.x / ZOOM - PAD * 8, 0, HOR * 8 - 1); |
| 356 | 356 |
Uint16 y = clamp(event->motion.y / ZOOM - PAD * 8, 0, VER * 8 - 1); |
| 357 | 357 |
u->ram.dat[addr + 0] = (x >> 8) & 0xff; |
| ... | ... |
@@ -381,7 +381,7 @@ void |
| 381 | 381 |
dotext(Uxn *u, SDL_Event *event) |
| 382 | 382 |
{
|
| 383 | 383 |
int i; |
| 384 |
- Uint16 addr = devkey->addr; |
|
| 384 |
+ Uint16 addr = devkey->addr + 2; |
|
| 385 | 385 |
if(SDL_GetModState() & KMOD_LCTRL || SDL_GetModState() & KMOD_RCTRL) |
| 386 | 386 |
return; |
| 387 | 387 |
for(i = 0; i < SDL_TEXTINPUTEVENT_TEXT_SIZE; ++i) {
|
| ... | ... |
@@ -396,7 +396,7 @@ void |
| 396 | 396 |
doctrl(Uxn *u, SDL_Event *event, int z) |
| 397 | 397 |
{
|
| 398 | 398 |
Uint8 flag = 0x00; |
| 399 |
- Uint16 addr = devctrl->addr; |
|
| 399 |
+ Uint16 addr = devctrl->addr + 2; |
|
| 400 | 400 |
if(z && event->key.keysym.sym == SDLK_h) {
|
| 401 | 401 |
if(SDL_GetModState() & KMOD_LCTRL) |
| 402 | 402 |
toggledebug(u); |
| ... | ... |
@@ -408,11 +408,11 @@ doctrl(Uxn *u, SDL_Event *event, int z) |
| 408 | 408 |
case SDLK_LALT: flag = 0x02; break; |
| 409 | 409 |
case SDLK_BACKSPACE: |
| 410 | 410 |
flag = 0x04; |
| 411 |
- if(z) u->ram.dat[devkey->addr] = 0x08; |
|
| 411 |
+ if(z) u->ram.dat[devkey->addr + 2] = 0x08; |
|
| 412 | 412 |
break; |
| 413 | 413 |
case SDLK_RETURN: |
| 414 | 414 |
flag = 0x08; |
| 415 |
- if(z) u->ram.dat[devkey->addr] = 0x0d; |
|
| 415 |
+ if(z) u->ram.dat[devkey->addr + 2] = 0x0d; |
|
| 416 | 416 |
break; |
| 417 | 417 |
case SDLK_UP: flag = 0x10; break; |
| 418 | 418 |
case SDLK_DOWN: flag = 0x20; break; |
| ... | ... |
@@ -592,10 +592,22 @@ start(Uxn *u) |
| 592 | 592 |
case SDL_QUIT: quit(); break; |
| 593 | 593 |
case SDL_MOUSEBUTTONUP: |
| 594 | 594 |
case SDL_MOUSEBUTTONDOWN: |
| 595 |
- case SDL_MOUSEMOTION: domouse(u, &event); break; |
|
| 596 |
- case SDL_TEXTINPUT: dotext(u, &event); break; |
|
| 597 |
- case SDL_KEYDOWN: doctrl(u, &event, 1); break; |
|
| 598 |
- case SDL_KEYUP: doctrl(u, &event, 0); break; |
|
| 595 |
+ case SDL_MOUSEMOTION: |
|
| 596 |
+ domouse(u, &event); |
|
| 597 |
+ evaluxn(u, devmouse->vector); |
|
| 598 |
+ break; |
|
| 599 |
+ case SDL_TEXTINPUT: |
|
| 600 |
+ dotext(u, &event); |
|
| 601 |
+ evaluxn(u, devkey->vector); |
|
| 602 |
+ break; |
|
| 603 |
+ case SDL_KEYDOWN: |
|
| 604 |
+ doctrl(u, &event, 1); |
|
| 605 |
+ evaluxn(u, devctrl->vector); |
|
| 606 |
+ break; |
|
| 607 |
+ case SDL_KEYUP: |
|
| 608 |
+ doctrl(u, &event, 0); |
|
| 609 |
+ evaluxn(u, devctrl->vector); |
|
| 610 |
+ break; |
|
| 599 | 611 |
case SDL_WINDOWEVENT: |
| 600 | 612 |
if(event.window.event == SDL_WINDOWEVENT_EXPOSED) |
| 601 | 613 |
redraw(pixels, u); |