commit 8e8d627
Devine Lu Linvega
·
2024-11-13 04:08:24 +0000 UTC
parent cbc4de7
Starting bios connections
10 files changed,
+69,
-27
+3,
-0
1@@ -13,3 +13,6 @@
2 *theme
3
4 *.[o0125678vqki]
5+
6+bios.rom
7+bios.rom.sym
M
makefile
+6,
-4
1@@ -11,8 +11,8 @@ PREFIX=${HOME}/.local
2
3 all: bin/uxnasm bin/uxncli bin/uxn11
4
5-run: all bin/uxnasm bin/uxncli bin/uxn11 bin/mouse
6- @ bin/uxn11
7+run: all bin/mouse.rom bios.rom
8+ @ bin/uxn11 bin/mouse.rom
9 debug: bin/uxnasm-debug bin/uxncli-debug bin/uxn11-debug
10 @ bin/uxncli-debug bin/opctest.rom
11 test: all
12@@ -40,9 +40,11 @@ archive:
13 clean:
14 @ rm -fr bin
15
16-bin/mouse: etc/mouse.tal
17+bin/mouse.rom: etc/mouse.tal
18 @ bin/uxnasm etc/mouse.tal bin/mouse.rom
19- @ bin/uxn11 bin/mouse.rom
20+
21+bios.rom: src/bios.tal
22+ @ bin/uxnasm src/bios.tal bios.rom
23
24 bin/uxnasm: src/uxnasm.c
25 @ mkdir -p bin
+35,
-0
1@@ -0,0 +1,35 @@
2+( bios )
3+
4+|00 @System &vector $2 &pad $6 &r $2 &g $2 &b $2
5+|10 @Console &vector $2 &read $1 &pad $5 &write $1
6+|20 @Screen &vector $2 &width $2 &height $2 &auto $1 &pad $1 &x $2 &y $2 &addr $2 &pixel $1 &sprite $1
7+|80 @Controller &vector $2 &button $1 &key $1
8+|90 @Mouse &vector $2 &x $2 &y $2 &state $1 &pad $3 &scrollx $2 &scrolly $2
9+|a0 @File &vector $2 &success $1 &success-lb $1 &stat $2 &delete $1 &append $1 &name $2 &length $2 &read $2 &write $2
10+
11+|100
12+
13+@on-reset ( -> )
14+ #1234 <phex> #0a18 DEO
15+ ( ;on-frame .Screen/vector DEO2 )
16+ BRK
17+
18+@meta $1
19+ ( name ) "BIOS 0a
20+ ( details ) "A 20 "Uxn 20 "BIOS 0a
21+ ( author ) "By 20 "Hundred 20 "Rabbits 0a
22+ ( date ) "12 20 "Nov 20 "2024 $1 00
23+
24+@on-frame ( -> )
25+ BRK
26+
27+
28+@<phex> ( short* -: )
29+ SWP /b
30+ &b ( byte -: )
31+ DUP #04 SFT /c
32+ &c ( byte -: )
33+ #0f AND DUP #09 GTH #27 MUL ADD [ LIT "0 ] ADD #19 DEO
34+ JMP2r
35+
36+
+5,
-5
1@@ -210,22 +210,22 @@ console_listen(int i, int argc, char **argv)
2 }
3
4 Uint8
5-console_dei(Uint8 addr)
6+console_dei(Uxn *u, Uint8 addr)
7 {
8 switch(addr) {
9 case CMD_LIVE:
10 case CMD_EXIT: check_child(); break;
11 }
12- return uxn.dev[addr];
13+ return u->dev[addr];
14 }
15
16 void
17-console_deo(Uint8 addr)
18+console_deo(Uxn *u, Uint8 addr)
19 {
20 FILE *fd;
21 switch(addr) {
22- case 0x18: fd = stdout, fputc(uxn.dev[0x18], fd), fflush(fd); break;
23- case 0x19: fd = stderr, fputc(uxn.dev[0x19], fd), fflush(fd); break;
24+ case 0x18: fd = stdout, fputc(u->dev[0x18], fd), fflush(fd); break;
25+ case 0x19: fd = stderr, fputc(u->dev[0x19], fd), fflush(fd); break;
26 case CMD_EXEC: start_fork(); break;
27 }
28 }
+2,
-2
1@@ -16,6 +16,6 @@ WITH REGARD TO THIS SOFTWARE.
2
3 int console_input(Uint8 c, int type);
4 void console_listen(int i, int argc, char **argv);
5-Uint8 console_dei(Uint8 addr);
6-void console_deo(Uint8 addr);
7+Uint8 console_dei(Uxn *u, Uint8 addr);
8+void console_deo(Uxn *u, Uint8 addr);
9 void close_console(void);
+2,
-0
1@@ -81,11 +81,13 @@ system_boot(Uint8 *ram, char *boot)
2 {
3 /* Load rom(bios) */
4 if(system_load(&bios_ram[PAGE_PROGRAM], "bios.rom")) {
5+ printf("FOUND BIOS!!!\n");
6 bios.ram = bios_ram;
7 bios.dev = bios_ram + 0x8300;
8 bios.wst.dat = bios_ram + 0x8400;
9 bios.rst.dat = bios_ram + 0x8500;
10 bios.dev[0xe] = 0xff;
11+ uxn_eval(&bios, PAGE_PROGRAM);
12 }
13 /* Load rom(main) */
14 if(system_load(&ram[PAGE_PROGRAM], boot)) {
+2,
-2
1@@ -37,8 +37,8 @@ WITH REGARD TO THIS SOFTWARE.
2 #define PUx(i) { if(_2) { c = (i); PU1(c >> 8) PU1(c) } else PU1(i) }
3 #define GET(o) { if(_2) PO1(o[1]) PO1(o[0]) }
4 #define PUT(i) { PU1(i[0]) if(_2) PU1(i[1]) }
5-#define DEI(i,o) o[0] = emu_dei(i); if(_2) o[1] = emu_dei(i + 1); PUT(o)
6-#define DEO(i,j) emu_deo(i, j[0]); if(_2) emu_deo(i + 1, j[1]);
7+#define DEI(i,o) o[0] = emu_dei(u, i); if(_2) o[1] = emu_dei(u, i + 1); PUT(o)
8+#define DEO(i,j) emu_deo(u, i, j[0]); if(_2) emu_deo(u, i + 1, j[1]);
9 #define PEK(i,o,m) o[0] = u->ram[i]; if(_2) o[1] = u->ram[(i + 1) & m]; PUT(o)
10 #define POK(i,j,m) u->ram[i] = j[0]; if(_2) u->ram[(i + 1) & m] = j[1];
11
+2,
-2
1@@ -34,8 +34,8 @@ typedef struct Uxn {
2 Stack wst, rst;
3 } Uxn;
4
5-extern Uint8 emu_dei(Uint8 addr);
6-extern void emu_deo(Uint8 addr, Uint8 value);
7+extern Uint8 emu_dei(Uxn *u, Uint8 addr);
8+extern void emu_deo(Uxn *u, Uint8 addr, Uint8 value);
9 extern Uxn uxn;
10
11 int uxn_eval(Uxn *u, Uint16 pc);
+6,
-6
1@@ -46,28 +46,28 @@ clamp(int val, int min, int max)
2 }
3
4 Uint8
5-emu_dei(Uint8 addr)
6+emu_dei(Uxn *u, Uint8 addr)
7 {
8 switch(addr & 0xf0) {
9 case 0x00: return system_dei(addr);
10- case 0x10: return console_dei(addr);
11+ case 0x10: return console_dei(u, addr);
12 case 0x20: return screen_dei(addr);
13 case 0xc0: return datetime_dei(addr);
14 }
15- return uxn.dev[addr];
16+ return u->dev[addr];
17 }
18
19 void
20-emu_deo(Uint8 addr, Uint8 value)
21+emu_deo(Uxn *u, Uint8 addr, Uint8 value)
22 {
23- uxn.dev[addr] = value;
24+ u->dev[addr] = value;
25 switch(addr & 0xf0) {
26 case 0x00:
27 system_deo(addr);
28 if(addr > 0x7 && addr < 0xe)
29 screen_palette();
30 break;
31- case 0x10: console_deo(addr); break;
32+ case 0x10: console_deo(u, addr); break;
33 case 0x20: screen_deo(addr); break;
34 case 0xa0: file_deo(addr); break;
35 case 0xb0: file_deo(addr); break;
+6,
-6
1@@ -22,23 +22,23 @@ Uxn uxn;
2 Uint8 ram[0x10000 * RAM_PAGES];
3
4 Uint8
5-emu_dei(Uint8 addr)
6+emu_dei(Uxn *u, Uint8 addr)
7 {
8 switch(addr & 0xf0) {
9 case 0x00: return system_dei(addr);
10- case 0x10: return console_dei(addr);
11+ case 0x10: return console_dei(u, addr);
12 case 0xc0: return datetime_dei(addr);
13 }
14- return uxn.dev[addr];
15+ return u->dev[addr];
16 }
17
18 void
19-emu_deo(Uint8 addr, Uint8 value)
20+emu_deo(Uxn *u, Uint8 addr, Uint8 value)
21 {
22- uxn.dev[addr] = value;
23+ u->dev[addr] = value;
24 switch(addr & 0xf0) {
25 case 0x00: system_deo(addr); break;
26- case 0x10: console_deo(addr); break;
27+ case 0x10: console_deo(u, addr); break;
28 case 0xa0: file_deo(addr); break;
29 case 0xb0: file_deo(addr); break;
30 }