mirror of
https://git.sr.ht/~rabbits/uxn
synced 2024-11-26 15:53:01 +00:00
(boot.rom) Renamed to launcher.rom
This commit is contained in:
parent
bdef6c3dbd
commit
38d2c7cbd7
8 changed files with 67 additions and 32 deletions
|
@ -30,7 +30,7 @@ Build the assembler and emulator by running the `build.sh` script. The assembler
|
|||
If you wish to build the emulator without graphics mode:
|
||||
|
||||
```sh
|
||||
cc src/devices/file.c src/uxn.c -DNDEBUG -Os -g0 -s src/uxncli.c -o bin/uxncli
|
||||
cc src/devices/datetime.c src/devices/system.c src/devices/file.c src/uxn.c -DNDEBUG -Os -g0 -s src/uxncli.c -o bin/uxncli
|
||||
```
|
||||
|
||||
### Plan 9
|
||||
|
@ -94,7 +94,7 @@ uxnemu orca.rom | shim
|
|||
- `F1` toggle zoom
|
||||
- `F2` toggle debug
|
||||
- `F3` capture screen
|
||||
- `F4` load boot.rom
|
||||
- `F4` load launcher.rom
|
||||
|
||||
### Buttons
|
||||
|
||||
|
|
6
build.sh
6
build.sh
|
@ -37,7 +37,7 @@ rm -f ./bin/uxnasm
|
|||
rm -f ./bin/uxnemu
|
||||
rm -f ./bin/uxncli
|
||||
rm -f ./bin/supervisor.rom
|
||||
rm -f ./bin/boot.rom
|
||||
rm -f ./bin/launcher.rom
|
||||
rm -f ./bin/asma.rom
|
||||
|
||||
# When clang-format is present
|
||||
|
@ -110,8 +110,8 @@ fi
|
|||
|
||||
echo "Assembling(supervisor).."
|
||||
./bin/uxnasm projects/software/supervisor.tal bin/supervisor.rom
|
||||
echo "Assembling(boot).."
|
||||
./bin/uxnasm projects/software/boot.tal bin/boot.rom
|
||||
echo "Assembling(launcher).."
|
||||
./bin/uxnasm projects/software/launcher.tal bin/launcher.rom
|
||||
echo "Assembling(asma).."
|
||||
./bin/uxnasm projects/software/asma.tal bin/asma.rom
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
%<< { LTH2 } %>> { GTH2 } %== { EQU2 } %!! { NEQ2 }
|
||||
%!~ { NEQk NIP }
|
||||
|
||||
%HALT { #01 #0f DEO }
|
||||
%HALT { #010f DEO }
|
||||
|
||||
%RTN { JMP2r }
|
||||
%TOS { #00 SWP }
|
||||
|
|
|
@ -22,8 +22,11 @@
|
|||
%2// { #01 SFT2 }
|
||||
%8** { #30 SFT2 }
|
||||
|
||||
%EADDR { #fd04 }
|
||||
%ECODE { #fd06 }
|
||||
%SYS_EADDR { #fd04 }
|
||||
%SYS_ECODE { #fd06 }
|
||||
%SYS_DEBUG { #fd0e }
|
||||
%WST { #fe00 }
|
||||
%RST { #ff00 }
|
||||
|
||||
( devices )
|
||||
|
||||
|
@ -56,6 +59,11 @@
|
|||
;on-frame .Screen/vector DEO2
|
||||
;on-button .Controller/vector DEO2
|
||||
|
||||
( print initial memory )
|
||||
SYS_DEBUG LDA #00 = ,&no-debug JCN
|
||||
;print-stacks JSR2
|
||||
&no-debug
|
||||
|
||||
BRK
|
||||
|
||||
@on-frame ( -> )
|
||||
|
@ -116,9 +124,9 @@ BRK
|
|||
|
||||
;at-txt #4f ;draw-str JSR2
|
||||
|
||||
EADDR LDA2 #47 ;draw-short JSR2
|
||||
SYS_EADDR LDA2 #47 ;draw-short JSR2
|
||||
|
||||
#0000 EADDR STA2
|
||||
#0000 SYS_EADDR STA2
|
||||
|
||||
BRK
|
||||
|
||||
|
@ -136,9 +144,8 @@ RTN
|
|||
|
||||
( load rom )
|
||||
|
||||
|
||||
RTN
|
||||
&boot-path "boot.rom $1
|
||||
&boot-path "launcher.rom $1
|
||||
|
||||
@draw-stacks ( -- )
|
||||
|
||||
|
@ -148,12 +155,12 @@ RTN
|
|||
( working stack )
|
||||
#0010 .Screen/y DEO2
|
||||
DUP2 #0018 ** #0010 ++ .Screen/x DEO2
|
||||
DUP #fe00 LDA ( ptr ) EQU #4b + STH
|
||||
DUP #fe00 LDA ( ptr ) EQU #41 + STH
|
||||
DUP2 #fe01 ++ LDA STHr ;draw-byte JSR2
|
||||
( return stack )
|
||||
#0028 .Screen/y DEO2
|
||||
DUP2 #0018 ** #0010 ++ .Screen/x DEO2
|
||||
DUP #ff00 LDA ( ptr ) EQU #4b + STH
|
||||
DUP #ff00 LDA ( ptr ) EQU #41 + STH
|
||||
DUP2 #ff01 ++ LDA STHr ;draw-byte JSR2
|
||||
INC2 GTH2k ,&wst JCN
|
||||
POP2 POP2
|
||||
|
@ -235,6 +242,39 @@ JMP2r
|
|||
|
||||
JMP2r
|
||||
|
||||
@print-stacks ( -- )
|
||||
|
||||
#0a EMIT
|
||||
WST ;&wst-txt ,print-stack JSR
|
||||
RST ;&rst-txt ,print-stack JSR
|
||||
|
||||
RTN
|
||||
&wst-txt "Working-stack $1
|
||||
&rst-txt "Return-stack $1
|
||||
|
||||
@print-stack ( addr* name* -- )
|
||||
|
||||
PRINT
|
||||
( keep ptr ) LDAk STH
|
||||
( keep counter ) LITr 00
|
||||
( skip ptr ) INC2
|
||||
DUP2 #0020 ++ SWP2
|
||||
&loop
|
||||
( print cell )
|
||||
EQUkr STHr #3b * #20 + EMIT
|
||||
LDAk ;print-hex/byte JSR2
|
||||
EQUkr STHr #3d * #20 + EMIT
|
||||
( break into columns )
|
||||
SUB2k #0001 -- #0007 AND2 #0000 !! ,&no-lb JCN
|
||||
#0a EMIT
|
||||
&no-lb
|
||||
INCr
|
||||
INC2 GTH2k ,&loop JCN
|
||||
POP2 POP2
|
||||
POP2r
|
||||
|
||||
RTN
|
||||
|
||||
@print-hex ( value* -- )
|
||||
|
||||
SWP ,&byte JSR
|
||||
|
|
|
@ -83,7 +83,6 @@ screen_resize(UxnScreen *p, Uint16 width, Uint16 height)
|
|||
if(bg && fg && pixels) {
|
||||
p->width = width;
|
||||
p->height = height;
|
||||
p->pixels = pixels;
|
||||
screen_clear(p, &p->bg);
|
||||
screen_clear(p, &p->fg);
|
||||
}
|
||||
|
@ -119,8 +118,6 @@ screen_dei(Device *d, Uint8 port)
|
|||
case 0x3: return uxn_screen.width;
|
||||
case 0x4: return uxn_screen.height >> 8;
|
||||
case 0x5: return uxn_screen.height;
|
||||
case 0x6:
|
||||
|
||||
default: return d->dat[port];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@ WITH REGARD TO THIS SOFTWARE.
|
|||
#define FIXED_SIZE 0
|
||||
|
||||
typedef struct Layer {
|
||||
Uint8 *pixels;
|
||||
Uint8 changed;
|
||||
Uint8 *pixels, changed;
|
||||
} Layer;
|
||||
|
||||
typedef struct UxnScreen {
|
||||
|
|
25
src/uxnemu.c
25
src/uxnemu.c
|
@ -255,15 +255,10 @@ start(Uxn *u, char *rom)
|
|||
memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
|
||||
supervisor_memory = (Uint8 *)calloc(0x10000, sizeof(Uint8));
|
||||
|
||||
if(!uxn_boot(&supervisor, supervisor_memory, supervisor_memory + VISOR_DEV, (Stack *)(supervisor_memory + VISOR_WST), (Stack *)(supervisor_memory + VISOR_RST)))
|
||||
return error("Boot", "Failed to start uxn.");
|
||||
if(!uxn_boot(u, memory, supervisor_memory + PAGE_DEV, (Stack *)(supervisor_memory + PAGE_WST), (Stack *)(supervisor_memory + PAGE_RST)))
|
||||
return error("Boot", "Failed to start uxn.");
|
||||
if(!load(&supervisor, "supervisor.rom"))
|
||||
error("Supervisor", "No debugger found.");
|
||||
if(!load(u, rom))
|
||||
return error("Boot", "Failed to load rom.");
|
||||
|
||||
/* system */ devsystem = uxn_port(u, 0x0, system_dei, system_deo);
|
||||
/* console */ devconsole = uxn_port(u, 0x1, nil_dei, console_deo);
|
||||
/* screen */ devscreen = uxn_port(u, 0x2, screen_dei, screen_deo);
|
||||
|
@ -282,16 +277,20 @@ start(Uxn *u, char *rom)
|
|||
/* unused */ uxn_port(u, 0xf, nil_dei, nil_deo);
|
||||
|
||||
/* Supervisor */
|
||||
uxn_port(&supervisor, 0x0, system_dei, system_deo);
|
||||
uxn_port(&supervisor, 0x1, nil_dei, console_deo);
|
||||
uxn_port(&supervisor, 0x2, screen_dei, screen_deo);
|
||||
uxn_port(&supervisor, 0x8, nil_dei, nil_deo);
|
||||
|
||||
uxn_eval(&supervisor, PAGE_PROGRAM);
|
||||
if(!uxn_boot(&supervisor, supervisor_memory, supervisor_memory + VISOR_DEV, (Stack *)(supervisor_memory + VISOR_WST), (Stack *)(supervisor_memory + VISOR_RST)))
|
||||
return error("Boot", "Failed to start uxn.");
|
||||
if(!load(&supervisor, "supervisor.rom"))
|
||||
error("Supervisor", "No debugger found.");
|
||||
/* system */ uxn_port(&supervisor, 0x0, system_dei, system_deo);
|
||||
/* console */ uxn_port(&supervisor, 0x1, nil_dei, console_deo);
|
||||
/* screen */ uxn_port(&supervisor, 0x2, screen_dei, screen_deo);
|
||||
/* control */ uxn_port(&supervisor, 0x8, nil_dei, nil_deo);
|
||||
|
||||
if(!uxn_eval(u, PAGE_PROGRAM))
|
||||
return error("Boot", "Failed to start rom.");
|
||||
|
||||
uxn_eval(&supervisor, PAGE_PROGRAM);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -330,7 +329,7 @@ static void
|
|||
restart(Uxn *u)
|
||||
{
|
||||
set_size(WIDTH, HEIGHT, 1);
|
||||
start(u, "boot.rom");
|
||||
start(u, "launcher.rom");
|
||||
}
|
||||
|
||||
static Uint8
|
||||
|
@ -527,7 +526,7 @@ main(int argc, char **argv)
|
|||
console_input(&u, '\n');
|
||||
}
|
||||
}
|
||||
if(!loaded && !start(&u, "boot.rom"))
|
||||
if(!loaded && !start(&u, "launcher.rom"))
|
||||
return error("usage", "uxnemu [-s scale] file.rom");
|
||||
run(&u);
|
||||
SDL_Quit();
|
||||
|
|
Loading…
Reference in a new issue