| ... | ... |
@@ -383,17 +383,22 @@ sprite_poke(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1) |
| 383 | 383 |
Uint8 |
| 384 | 384 |
file_poke(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1) |
| 385 | 385 |
{
|
| 386 |
- FILE *f; |
|
| 387 |
- ptr += 8; |
|
| 386 |
+ char *name = &m[(m[ptr + 8] << 8) + m[ptr + 8 + 1]]; |
|
| 387 |
+ Uint16 length = (m[ptr + 8 + 2] << 8) + m[ptr + 8 + 3]; |
|
| 388 | 388 |
if(b0 == 0x0d) {
|
| 389 |
- char *name = &m[(m[ptr] << 8) + m[ptr + 1]]; |
|
| 390 |
- Uint16 length = (m[ptr + 2] << 8) + m[ptr + 3]; |
|
| 391 |
- Uint16 addr = (m[ptr + 4] << 8) + b1; |
|
| 392 |
- f = fopen(name, "w"); |
|
| 393 |
- if(!fwrite(&m[addr], length, 1, f)) |
|
| 394 |
- return error("Save", "Failure");
|
|
| 395 |
- fclose(f); |
|
| 396 |
- printf("Exported %s[%d bytes]\n", name, length);
|
|
| 389 |
+ Uint16 addr = (m[ptr + 8 + 4] << 8) + b1; |
|
| 390 |
+ FILE *f = fopen(name, "r"); |
|
| 391 |
+ if(f && fread(&m[addr], length, 1, f)) {
|
|
| 392 |
+ fclose(f); |
|
| 393 |
+ printf("Loaded %d bytes, at %04x from %s\n", length, addr, name);
|
|
| 394 |
+ } |
|
| 395 |
+ } else if(b0 == 0x0f) {
|
|
| 396 |
+ Uint16 addr = (m[ptr + 8 + 6] << 8) + b1; |
|
| 397 |
+ FILE *f = fopen(name, "w"); |
|
| 398 |
+ if(fwrite(&m[addr], length, 1, f)) {
|
|
| 399 |
+ fclose(f); |
|
| 400 |
+ printf("Saved %d bytes, at %04x from %s\n", length, addr, name);
|
|
| 401 |
+ } |
|
| 397 | 402 |
} |
| 398 | 403 |
return b1; |
| 399 | 404 |
} |
| ... | ... |
@@ -467,22 +472,22 @@ main(int argc, char **argv) |
| 467 | 472 |
if(!init()) |
| 468 | 473 |
return error("Init", "Failed");
|
| 469 | 474 |
|
| 470 |
- portuxn(&u, "console", ppnil, console_poke); |
|
| 471 |
- devscreen = portuxn(&u, "screen", ppnil, screen_poke); |
|
| 472 |
- portuxn(&u, "sprite", ppnil, sprite_poke); |
|
| 473 |
- devctrl = portuxn(&u, "controller", ppnil, ppnil); |
|
| 474 |
- devkey = portuxn(&u, "key", ppnil, ppnil); |
|
| 475 |
- devmouse = portuxn(&u, "mouse", ppnil, ppnil); |
|
| 476 |
- portuxn(&u, "file", ppnil, file_poke); |
|
| 477 |
- portuxn(&u, "empty", ppnil, ppnil); |
|
| 478 |
- portuxn(&u, "empty", ppnil, ppnil); |
|
| 479 |
- portuxn(&u, "empty", ppnil, ppnil); |
|
| 480 |
- portuxn(&u, "empty", ppnil, ppnil); |
|
| 481 |
- portuxn(&u, "empty", ppnil, ppnil); |
|
| 482 |
- portuxn(&u, "empty", ppnil, ppnil); |
|
| 483 |
- portuxn(&u, "empty", ppnil, ppnil); |
|
| 484 |
- portuxn(&u, "empty", ppnil, ppnil); |
|
| 485 |
- portuxn(&u, "system", ppnil, system_poke); |
|
| 475 |
+ portuxn(&u, "console", console_poke); |
|
| 476 |
+ devscreen = portuxn(&u, "screen", screen_poke); |
|
| 477 |
+ portuxn(&u, "sprite", sprite_poke); |
|
| 478 |
+ devctrl = portuxn(&u, "controller", ppnil); |
|
| 479 |
+ devkey = portuxn(&u, "key", ppnil); |
|
| 480 |
+ devmouse = portuxn(&u, "mouse", ppnil); |
|
| 481 |
+ portuxn(&u, "file", file_poke); |
|
| 482 |
+ portuxn(&u, "empty", ppnil); |
|
| 483 |
+ portuxn(&u, "empty", ppnil); |
|
| 484 |
+ portuxn(&u, "empty", ppnil); |
|
| 485 |
+ portuxn(&u, "empty", ppnil); |
|
| 486 |
+ portuxn(&u, "empty", ppnil); |
|
| 487 |
+ portuxn(&u, "empty", ppnil); |
|
| 488 |
+ portuxn(&u, "empty", ppnil); |
|
| 489 |
+ portuxn(&u, "empty", ppnil); |
|
| 490 |
+ portuxn(&u, "system", system_poke); |
|
| 486 | 491 |
|
| 487 | 492 |
/* Write screen size to dev/screen */ |
| 488 | 493 |
u.ram.dat[devscreen->addr + 0] = (HOR * 8 >> 8) & 0xff; |
| ... | ... |
@@ -4,7 +4,7 @@ |
| 4 | 4 |
&Sprite { pad 8 x 2 y 2 addr 2 color 1 }
|
| 5 | 5 |
&Controller { buttons 1 }
|
| 6 | 6 |
&Mouse { x 2 y 2 state 1 chord 1 change 1 }
|
| 7 |
-&File { pad 8 name 2 length 2 binary 2 }
|
|
| 7 |
+&File { pad 8 name 2 length 2 load 2 save 2 }
|
|
| 8 | 8 |
|
| 9 | 9 |
&Rect2d { x1 2 y1 2 x2 2 y2 2 }
|
| 10 | 10 |
&Point2d { x 2 y 2 }
|
| ... | ... |
@@ -74,11 +74,20 @@ BRK |
| 74 | 74 |
,redraw JSR ,click-end JMP |
| 75 | 75 |
@no-toolbar-click |
| 76 | 76 |
|
| 77 |
+ ( load button ) |
|
| 78 |
+ |
|
| 79 |
+ ,no-load-click ~dev/mouse.y ~bankview.y #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 JMP? POP2 |
|
| 80 |
+ ,no-load-click ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #000e NEQU2 JMP? POP2 |
|
| 81 |
+ ( load ) ,filename =dev/file.name #0800 =dev/file.length ~bankview.addr =dev/file.load |
|
| 82 |
+ ( release ) #00 =dev/mouse.state |
|
| 83 |
+ ,redraw JSR ,click-end JMP |
|
| 84 |
+ @no-load-click |
|
| 85 |
+ |
|
| 77 | 86 |
( save button ) |
| 78 | 87 |
|
| 79 | 88 |
,no-save-click ~dev/mouse.y ~bankview.y #0010 SUB2 SUB2 #0008 DIV2 #0000 NEQ2 JMP? POP2 |
| 80 | 89 |
,no-save-click ~dev/mouse.x ~tileview.x SUB2 #0008 DIV2 #000f NEQU2 JMP? POP2 |
| 81 |
- ( save ) ,save_name =dev/file.name #0800 =dev/file.length ~bankview.addr =dev/file.binary |
|
| 90 |
+ ( save ) ,filename =dev/file.name #0800 =dev/file.length ~bankview.addr =dev/file.save |
|
| 82 | 91 |
( release ) #00 =dev/mouse.state |
| 83 | 92 |
,redraw JSR ,click-end JMP |
| 84 | 93 |
@no-save-click |
| ... | ... |
@@ -397,7 +406,7 @@ RTS |
| 397 | 406 |
@blank_icn [ 0000 0000 0000 0000 ] |
| 398 | 407 |
@cell1_icn [ 7cfe fefe fefe 7c00 ] |
| 399 | 408 |
@save_icn [ fe82 8282 848e f400 ] |
| 400 |
-@save_name [ nasu_export.chr 00 ] |
|
| 409 |
+@filename [ nasu_project.chr 00 ] |
|
| 401 | 410 |
|
| 402 | 411 |
@font_hex ( 0-F ) |
| 403 | 412 |
[ |
| ... | ... |
@@ -545,38 +554,134 @@ RTS |
| 545 | 554 |
|
| 546 | 555 |
|E800 @bank2 [ |
| 547 | 556 |
|
| 548 |
- 0000 0000 0000 0000 0000 2400 7e3c 0000 0000 2400 3c42 0000 0000 6c7c 7c38 1000 |
|
| 549 |
- 0010 387c 7c38 1000 0038 387c 6c10 3800 0010 387c 7c10 3800 0000 0018 1800 0000 |
|
| 550 |
- 007e 4242 4242 7e00 0000 1824 2418 0000 0018 2442 4224 1800 001e 063a 4a48 3000 |
|
| 551 |
- 0038 446c 107c 1000 000c 0808 0838 3800 003e 2222 2266 6600 0000 0822 0022 0800 |
|
| 552 |
- 0000 1018 1c18 1000 0000 0818 3818 0800 0008 1c00 001c 0800 0028 2828 2800 2800 |
|
| 553 |
- 003e 4a4a 3a0a 0a00 000c 3046 620c 3000 0000 0000 0000 ffff 0010 3800 3810 0038 |
|
| 554 |
- 0008 1c2a 0808 0800 0008 0808 2a1c 0800 0000 0804 7e04 0800 0000 1020 7e20 1000 |
|
| 555 |
- 0000 4040 7e00 0000 0000 0024 6624 0000 0000 1038 7c00 0000 0000 007c 3810 0000 |
|
| 556 |
- 0000 0000 0000 0000 0008 0808 0800 0800 0014 1400 0000 0000 0024 7e24 247e 2400 |
|
| 557 |
- 0008 1e28 1c0a 3c08 0042 0408 1020 4200 0030 4832 4c44 3a00 0008 1000 0000 0000 |
|
| 558 |
- 0004 0808 0808 0400 0010 0808 0808 1000 0000 1408 3e08 1400 0000 0808 3e08 0800 |
|
| 559 |
- 0000 0000 0008 0810 0000 0000 3c00 0000 0000 0000 0000 0800 0000 0204 0810 2000 |
|
| 560 |
- 003c 464a 5262 3c00 0018 2808 0808 3e00 003c 4202 3c40 7e00 003c 421c 0242 3c00 |
|
| 561 |
- 0008 1828 487e 0800 007e 407c 0242 3c00 003c 407c 4242 3c00 007e 0204 0810 1000 |
|
| 562 |
- 003c 423c 4242 3c00 003c 4242 3e02 3c00 0000 0008 0000 0800 0000 0800 0008 0810 |
|
| 563 |
- 0000 0810 2010 0800 0000 003e 003e 0000 0000 1008 0408 1000 003c 4202 0c00 0800 |
|
| 564 |
- 003c 425a 5442 3c00 0018 2442 7e42 4200 007c 427c 4242 7c00 003c 4240 4042 3c00 |
|
| 565 |
- 0078 4442 4244 7800 007e 407c 4040 7e00 003e 4040 7c40 4000 003c 4240 4e42 3c00 |
|
| 566 |
- 0042 427e 4242 4200 003e 0808 0808 3e00 0002 0202 4242 3c00 0044 4870 4844 4200 |
|
| 567 |
- 0040 4040 4040 7e00 0042 665a 4242 4200 0042 6252 4a46 4200 003c 4242 4242 3c00 |
|
| 568 |
- 007c 4242 7c40 4000 003c 4242 524a 3c00 007c 4242 7c44 4200 003c 403c 0242 3c00 |
|
| 569 |
- 00fe 1010 1010 1000 0042 4242 4242 3c00 0042 4242 4224 1800 0042 4242 5a66 4200 |
|
| 570 |
- 0042 2418 1824 4200 0082 4428 1010 1000 007e 0408 1020 7e00 000c 0808 0808 0c00 |
|
| 571 |
- 0040 2010 0804 0200 0018 0808 0808 1800 0008 1422 0000 0000 0000 0000 0000 7e00 |
|
| 572 |
- 0008 0400 0000 0000 0000 1c02 1e22 1e00 0020 203c 2222 3c00 0000 1e20 2020 1e00 |
|
| 573 |
- 0002 021e 2222 1e00 0000 1c22 3c20 1e00 000c 101c 1010 1000 0000 1c22 221e 021c |
|
| 574 |
- 0020 202c 3222 2200 0008 0018 0808 0400 0008 0008 0808 4830 0020 2428 3028 2400 |
|
| 575 |
- 0010 1010 1010 0c00 0000 6854 5454 5400 0000 5864 4444 4400 0000 3844 4444 3800 |
|
| 576 |
- 0000 7844 4478 4040 0000 3c44 443c 0406 0000 2c30 2020 2000 0000 3840 3804 7800 |
|
| 577 |
- 0010 103c 1010 0c00 0000 4444 4444 3800 0000 4444 2828 1000 0000 4454 5454 2800 |
|
| 578 |
- 0000 4428 1028 4400 0000 4444 443c 0438 0000 7c08 1020 7c00 000c 0810 1008 0c00 |
|
| 579 |
- 0008 0808 0808 0800 0030 1008 0810 3000 0000 0032 4c00 0000 3c42 99a1 a199 423c |
|
| 557 |
+ 0001 0303 0303 0307 c0c0 c0c0 c000 4000 |
|
| 558 |
+ 1010 1030 3018 3030 0000 0000 0000 0000 |
|
| 559 |
+ 0000 0800 1000 0010 0000 0000 0000 0101 |
|
| 560 |
+ 0409 0840 5090 1230 0000 0040 0080 0000 |
|
| 561 |
+ 0000 0000 0000 0000 0000 0010 0000 2000 |
|
| 562 |
+ 0000 0000 0000 0000 0000 0000 0100 0000 |
|
| 563 |
+ 0080 0000 0000 0000 0000 0000 0000 0000 |
|
| 564 |
+ 0707 0303 0301 0101 dfdf dfdf ffff fff7 |
|
| 565 |
+ 0606 0606 060c 0c04 4080 8040 0000 4040 |
|
| 566 |
+ 1030 3030 3020 6030 0000 0000 0000 0000 |
|
| 567 |
+ 0020 0020 8020 80c0 0102 0200 0004 0400 |
|
| 568 |
+ 2030 7060 6460 e0e1 4080 8000 0080 0000 |
|
| 569 |
+ 0400 0808 0010 1101 4040 4040 8080 8080 |
|
| 570 |
+ 0204 040c 0c08 0808 0002 0000 0400 0004 |
|
| 571 |
+ 2020 2040 4040 40a0 0000 0002 0004 0000 |
|
| 572 |
+ 0000 0000 0000 0001 ffff ffff ff7f 7f7f |
|
| 573 |
+ 0c0c 1818 0818 1810 0040 0000 4000 0040 |
|
| 574 |
+ 2060 5050 4050 5048 0101 0101 0101 0303 |
|
| 575 |
+ 8080 2080 8020 0000 0808 0109 1111 0332 |
|
| 576 |
+ a1a0 8222 2062 2220 0000 0000 0000 0000 |
|
| 577 |
+ 0123 0303 0745 058d 8000 0000 0000 0000 |
|
| 578 |
+ 1818 1210 1030 3004 0009 0901 0312 120a |
|
| 579 |
+ a080 c0c0 00c0 8080 0402 020c 0504 1c0d |
|
| 580 |
+ 8000 8200 0002 4000 7f7f 7f7f 7f7f 7f7f |
|
| 581 |
+ 1010 3030 0020 2060 0000 1000 2000 0000 |
|
| 582 |
+ 4050 5848 0898 4848 0303 0302 0206 0206 |
|
| 583 |
+ 0020 0040 2000 4000 2222 0224 2444 400c |
|
| 584 |
+ 4444 4444 4048 4044 0000 0001 0100 0202 |
|
| 585 |
+ 091b 1202 2222 0242 0000 0000 0004 0009 |
|
| 586 |
+ 5040 4020 a8a0 a020 0614 0c29 2910 5150 |
|
| 587 |
+ 8080 8000 0000 8000 2018 481a 1090 3231 |
|
| 588 |
+ 0000 8004 0000 0802 7f7f 7f7f 7f7f 7f7f |
|
| 589 |
+ 6040 cc03 c000 e407 0000 0010 c030 1806 |
|
| 590 |
+ 4848 0848 4808 2848 0404 0504 0408 0808 |
|
| 591 |
+ 4040 0040 4040 0040 4848 8010 9090 30a0 |
|
| 592 |
+ 4800 4048 10d0 0020 0204 0404 0109 282a |
|
| 593 |
+ 4206 8084 0404 0404 0101 1202 0212 0424 |
|
| 594 |
+ 4050 4040 4141 42c2 22a3 a042 42c6 8484 |
|
| 595 |
+ 0001 0002 0204 0400 2420 6248 48c2 9090 |
|
| 596 |
+ 0004 0010 0400 0008 7f7f 7fff 7fff ffff |
|
| 597 |
+ c07e 0f0b 0480 8060 e31d c63b 1c0f 1930 |
|
| 598 |
+ 0824 c4c4 f07c bcdd 0809 0808 0019 0811 |
|
| 599 |
+ 0020 0181 4100 2202 a020 2040 4000 4000 |
|
| 600 |
+ 9080 2020 a0a0 0041 1250 4424 a0a8 8850 |
|
| 601 |
+ 0000 0404 0008 0800 0448 0800 1111 1101 |
|
| 602 |
+ 8185 8782 0a08 1404 8404 0808 0808 1010 |
|
| 603 |
+ 0809 0212 1224 2526 8484 1080 2820 0060 |
|
| 604 |
+ 2001 0101 2301 1343 ffff ffff ffff ffff |
|
| 605 |
+ f038 cf70 0000 0000 e000 ff00 0000 0000 |
|
| 606 |
+ 5d2e e6f1 0800 0400 1014 d010 61c8 3010 |
|
| 607 |
+ 4282 9240 0490 9000 0000 0080 0000 8000 |
|
| 608 |
+ 4140 4202 8241 0502 5040 a080 4000 008d |
|
| 609 |
+ 0108 0000 121f 7037 2222 06c4 54c0 00fd |
|
| 610 |
+ 0810 1030 2020 0000 1011 2020 2125 4142 |
|
| 611 |
+ 4a4a 9a96 1434 2c2c 1040 4000 8080 0081 |
|
| 612 |
+ 4707 078f 0f4f 1f9f ffff ffff ffff ffff |
|
| 613 |
+ 0080 f07e 8ff1 feff 0000 0000 e07c 0feb |
|
| 614 |
+ 0000 0000 0000 8080 0000 0000 0000 0000 |
|
| 615 |
+ 0010 0000 0800 0000 0000 0000 0001 0000 |
|
| 616 |
+ 8284 0400 0900 0610 1942 2722 8800 0000 |
|
| 617 |
+ bcef bee0 3008 0300 07fc ff11 1008 8864 |
|
| 618 |
+ e03c c7f8 df03 0000 0614 84f8 18c0 f88f |
|
| 619 |
+ 495b 1a1a 5ab6 b4b4 0000 0102 0200 0404 |
|
| 620 |
+ 0f1c 1830 3030 6061 ff7f 3f3f 3f3f 3f7f |
|
| 621 |
+ ff3f 0700 0000 0000 ffff ff7f 0600 0000 |
|
| 622 |
+ c0c0 c080 0000 0000 0000 0000 0000 0000 |
|
| 623 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 624 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 625 |
+ 0000 0000 0000 0000 300e 0300 0000 0000 |
|
| 626 |
+ 063c c03b 07ff 0000 0307 fefc f080 0001 |
|
| 627 |
+ ece8 6878 d0d0 f0a0 0008 0801 1111 0323 |
|
| 628 |
+ e7cf dfd3 a1c1 c3e3 ffff ffff ffff ffff |
|
| 629 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 630 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 631 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 632 |
+ 0000 0000 0000 0000 0001 0303 0301 0000 |
|
| 633 |
+ 00c0 f83f c3f8 ff7f 0000 00c0 fe3f 81fe |
|
| 634 |
+ 0000 0000 00ff ff00 0101 0103 0ff7 df1f |
|
| 635 |
+ e0e0 c0c0 c0c0 8181 2307 474f 4fcf 9f9f |
|
| 636 |
+ a3e3 c7c7 c7cf 8f9f ffff ffff ffff ffff |
|
| 637 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 638 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 639 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 640 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 641 |
+ 1f07 0000 0000 0000 ffff 7f0f 0000 0000 |
|
| 642 |
+ f8ff ffff 7f00 0000 3fff ffff c60e 0e0c |
|
| 643 |
+ 8383 0306 060e 0e0c 3e3e 3c39 7163 67cf |
|
| 644 |
+ 3f7f ffff ffff ffff ffff ffff ffff ffff |
|
| 645 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 646 |
+ 0000 0000 0000 0000 8080 4040 6030 3838 |
|
| 647 |
+ 0000 0000 0003 071f 0000 0020 e0c0 8000 |
|
| 648 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 649 |
+ 0000 0000 0000 0000 0000 0000 0003 0206 |
|
| 650 |
+ 0000 0000 4000 0000 1c1c 1838 3870 71f1 |
|
| 651 |
+ 1c5d 1db8 bb33 73f3 df9f bfff ef3f 7fff |
|
| 652 |
+ ffff ffff ffff ffff ffff ffff ffff ffff |
|
| 653 |
+ 8080 c0e0 f0f8 fcfc 0000 0000 0000 0000 |
|
| 654 |
+ 0000 0000 000e 0300 1f1f 0500 0000 8070 |
|
| 655 |
+ ff78 3204 0000 0000 0000 0000 0000 0000 |
|
| 656 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 657 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 658 |
+ 0101 0307 0f1f 3f7f e0e2 e3c1 c5c7 838b |
|
| 659 |
+ f3e5 e5e3 ebc7 d7c7 ffff ffff ffff ffff |
|
| 660 |
+ ffff ffff ffff ffff ffff ffff ffff ffff |
|
| 661 |
+ feff bfdf dfff f7fb 0000 80c0 c0e0 f0f0 |
|
| 662 |
+ 0000 0000 0301 0000 1c07 0100 00c0 e070 |
|
| 663 |
+ 0020 ff01 0000 0000 0000 80fc f070 70f0 |
|
| 664 |
+ 0000 0000 0000 0000 0000 0000 0000 0000 |
|
| 665 |
+ 0000 0000 0000 0103 0001 030f 1fff ffff |
|
| 666 |
+ ffff fffe feff fefe 0717 1f1f 3f3f 7f7f |
|
| 667 |
+ cfcf cf9f df9f bebd ffef dfbf bf7b f7ef |
|
| 668 |
+ ffff ffff ffff ffff fffe fcfd f9f3 f9e3 |
|
| 669 |
+ fbef efff ffff ffff f8fc fefe ffff ffff |
|
| 670 |
+ 0000 0000 0080 80c0 7e0f 0100 0000 0000 |
|
| 671 |
+ 04f8 e000 0000 0000 6060 2020 3010 0010 |
|
| 672 |
+ 0000 0000 0000 0000 0000 0001 071f 7fff |
|
| 673 |
+ 0f1f 7fff ffff ffff ffff fdfd fbf7 ffff |
|
| 674 |
+ fefc fdf9 fbf9 e7f3 7fff ffff ffff fffe |
|
| 675 |
+ bf7f 7f7f 7ffe dff7 efdf bfbf 7fff efdf |
|
| 676 |
+ ffff ffff ffff fffe d7f7 e7cf 9fbf 3ffe |
|
| 677 |
+ ffff dfe7 f3f9 fcfe ffff ffff ffff ffff |
|
| 678 |
+ e0e0 f0f8 fcfe feff 0000 0000 0000 0080 |
|
| 679 |
+ 0000 0000 0000 0003 1010 1001 171f 7fff |
|
| 680 |
+ 030f 3fff ffff ffff ffff ffff ffff ffff |
|
| 681 |
+ fdfb f7ff ffff fdfb ffff ffff efff ffff |
|
| 682 |
+ d7e7 afcf dfbf bfff feff fbff ffff ffff |
|
| 683 |
+ f7ef dfff be7e fdef df9f 3f7f 7fff ffff |
|
| 684 |
+ fefd ffff ffff ffff ffff fbfe fcfb faf9 |
|
| 580 | 685 |
|
| 581 | 686 |
] |
| 582 | 687 |
|
| ... | ... |
@@ -589,4 +694,4 @@ RTS |
| 589 | 694 |
|FF60 ;dev/file File |
| 590 | 695 |
|
| 591 | 696 |
|FFF0 .RESET .FRAME .ERROR ( vectors ) |
| 592 |
-|FFF8 [ 35ac c03c afac ] ( palette ) |
|
| 593 | 697 |
\ No newline at end of file |
| 698 |
+|FFF8 [ e0fc 30cc 30ac ] ( palette ) |
|
| 594 | 699 |
\ No newline at end of file |
| ... | ... |
@@ -4,7 +4,9 @@ |
| 4 | 4 |
&Screen { width 2 height 2 pad 4 y 2 x 2 color 1 }
|
| 5 | 5 |
&Sprite { pad 8 y 2 x 2 addr 2 color 1 }
|
| 6 | 6 |
&Controller { buttons 1 }
|
| 7 |
+&Keyboard { key 1 }
|
|
| 7 | 8 |
&Mouse { x 2 y 2 state 1 chord 1 }
|
| 9 |
+&File { rname 2 rlen 2 rbin 2 rtxt 2 wname 2 wlen 2 wbin 2 wtxt 2 }
|
|
| 8 | 10 |
|
| 9 | 11 |
&Label2d { x 2 y 2 color 1 addr 2 }
|
| 10 | 12 |
&Picture2d { x 2 y 2 width 2 height 2 color 1 addr 2 }
|
| ... | ... |
@@ -19,7 +21,9 @@ |
| 19 | 21 |
|FF10 ;dev/screen Screen |
| 20 | 22 |
|FF20 ;dev/sprite Sprite |
| 21 | 23 |
|FF30 ;dev/ctrl Controller |
| 24 |
+|FF40 ;dev/key Keyboard |
|
| 22 | 25 |
|FF50 ;dev/mouse Mouse |
| 26 |
+|FF60 ;dev/file File |
|
| 23 | 27 |
|
| 24 | 28 |
|FFF0 .RESET .FRAME .ERROR ( vectors ) |
| 25 | 29 |
|FFF8 [ f2ac 35bb 2b53 ] ( palette ) |
| ... | ... |
@@ -19,9 +19,8 @@ WITH REGARD TO THIS SOFTWARE. |
| 19 | 19 |
void setflag(Uint8 *a, char flag, int b) { if(b) *a |= flag; else *a &= (~flag); }
|
| 20 | 20 |
int getflag(Uint8 *a, char flag) { return *a & flag; }
|
| 21 | 21 |
Uint8 devpoke8(Uxn *u, Uint8 id, Uint8 b0, Uint8 b1){ return id < u->devices ? u->dev[id].poke(u->ram.dat, 0xff00 + id * 0x10, b0, b1) : b1; }
|
| 22 |
-Uint8 devpeek8(Uxn *u, Uint8 id, Uint8 b0, Uint8 b1){ return id < u->devices ? u->dev[id].peek(u->ram.dat, 0xff00 + id * 0x10, b0, b1) : b1; }
|
|
| 23 | 22 |
void mempoke8(Uxn *u, Uint16 a, Uint8 b) { u->ram.dat[a] = a >= 0xff00 ? devpoke8(u, (a & 0xff) >> 4, a & 0xf, b) : b; }
|
| 24 |
-Uint8 mempeek8(Uxn *u, Uint16 a) { return a >= 0xff00 ? devpeek8(u, (a & 0xff) >> 4, a & 0xf, u->ram.dat[a]) : u->ram.dat[a]; }
|
|
| 23 |
+Uint8 mempeek8(Uxn *u, Uint16 a) { return u->ram.dat[a]; }
|
|
| 25 | 24 |
void mempoke16(Uxn *u, Uint16 a, Uint16 b) { mempoke8(u, a, b >> 8); mempoke8(u, a + 1, b); }
|
| 26 | 25 |
Uint16 mempeek16(Uxn *u, Uint16 a) { return (mempeek8(u, a) << 8) + mempeek8(u, a + 1); }
|
| 27 | 26 |
void push8(Stack *s, Uint8 a) { s->dat[s->ptr++] = a; }
|
| ... | ... |
@@ -205,11 +204,10 @@ loaduxn(Uxn *u, char *filepath) |
| 205 | 204 |
} |
| 206 | 205 |
|
| 207 | 206 |
Device * |
| 208 |
-portuxn(Uxn *u, char *name, Uint8 (*pefn)(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1), Uint8 (*pofn)(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1)) |
|
| 207 |
+portuxn(Uxn *u, char *name, Uint8 (*pofn)(Uint8 *m, Uint16 ptr, Uint8 b0, Uint8 b1)) |
|
| 209 | 208 |
{
|
| 210 | 209 |
Device *d = &u->dev[u->devices++]; |
| 211 | 210 |
d->addr = 0xff00 + (u->devices - 1) * 0x10; |
| 212 |
- d->peek = pefn; |
|
| 213 | 211 |
d->poke = pofn; |
| 214 | 212 |
printf("Device #%d: %s, at 0x%04x \n", u->devices - 1, name, d->addr);
|
| 215 | 213 |
return d; |
| ... | ... |
@@ -33,7 +33,6 @@ typedef struct {
|
| 33 | 33 |
|
| 34 | 34 |
typedef struct Device {
|
| 35 | 35 |
Uint16 addr; |
| 36 |
- Uint8 (*peek)(Uint8 *, Uint16, Uint8, Uint8); |
|
| 37 | 36 |
Uint8 (*poke)(Uint8 *, Uint16, Uint8, Uint8); |
| 38 | 37 |
} Device; |
| 39 | 38 |
|
| ... | ... |
@@ -50,4 +49,4 @@ int getflag(Uint8 *status, char flag); |
| 50 | 49 |
int loaduxn(Uxn *c, char *filepath); |
| 51 | 50 |
int bootuxn(Uxn *c); |
| 52 | 51 |
int evaluxn(Uxn *u, Uint16 vec); |
| 53 |
-Device *portuxn(Uxn *u, char *name, Uint8 (*pefn)(Uint8 *, Uint16, Uint8, Uint8), Uint8 (*pofn)(Uint8 *, Uint16, Uint8, Uint8)); |
|
| 52 |
+Device *portuxn(Uxn *u, char *name, Uint8 (*pofn)(Uint8 *, Uint16, Uint8, Uint8)); |