Added stack pointer accessors to system device
This commit is contained in:
parent
c6bd7f06a7
commit
2e2f8df0e0
|
@ -116,6 +116,16 @@ system_init(Uxn *u, Uint8 *ram, char *rom)
|
|||
|
||||
/* IO */
|
||||
|
||||
Uint8
|
||||
system_dei(Uxn *u, Uint8 addr)
|
||||
{
|
||||
switch(addr) {
|
||||
case 0x4: return u->wst.ptr;
|
||||
case 0x5: return u->rst.ptr;
|
||||
default: return u->dev[addr];
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
system_deo(Uxn *u, Uint8 *d, Uint8 port)
|
||||
{
|
||||
|
@ -134,6 +144,12 @@ system_deo(Uxn *u, Uint8 *d, Uint8 port)
|
|||
ram[dst + (Uint16)(b_addr + i)] = ram[src + (Uint16)(a_addr + i)];
|
||||
}
|
||||
break;
|
||||
case 0x4:
|
||||
u->wst.ptr = d[4];
|
||||
break;
|
||||
case 0x5:
|
||||
u->rst.ptr = d[5];
|
||||
break;
|
||||
case 0xe:
|
||||
system_inspect(u);
|
||||
break;
|
||||
|
|
|
@ -9,9 +9,9 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
|||
WITH REGARD TO THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#define SYSTEM_VERSION 1
|
||||
#define SYSTEM_DEIMASK 0x0000
|
||||
#define SYSTEM_DEOMASK 0xff08
|
||||
#define SYSTEM_VERSION 2
|
||||
#define SYSTEM_DEIMASK 0x0030
|
||||
#define SYSTEM_DEOMASK 0xff38
|
||||
|
||||
#define RAM_PAGES 0x10
|
||||
|
||||
|
@ -24,4 +24,5 @@ int system_version(Uxn *u, char *emulator, char *date);
|
|||
int system_error(char *msg, const char *err);
|
||||
int system_init(Uxn *u, Uint8 *ram, char *rom);
|
||||
|
||||
Uint8 system_dei(Uxn *u, Uint8 addr);
|
||||
void system_deo(Uxn *u, Uint8 *d, Uint8 port);
|
||||
|
|
|
@ -49,6 +49,7 @@ Uint8
|
|||
emu_dei(Uxn *u, Uint8 addr)
|
||||
{
|
||||
switch(addr & 0xf0) {
|
||||
case 0x00: return system_dei(u, addr);
|
||||
case 0x20: return screen_dei(u, addr);
|
||||
case 0xc0: return datetime_dei(u, addr);
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ Uint8
|
|||
emu_dei(Uxn *u, Uint8 addr)
|
||||
{
|
||||
switch(addr & 0xf0) {
|
||||
case 0x00: return system_dei(u, addr);
|
||||
case 0xc0: return datetime_dei(u, addr);
|
||||
}
|
||||
return u->dev[addr];
|
||||
|
@ -73,7 +74,7 @@ main(int argc, char **argv)
|
|||
system_connect(&u, 0xc, DATETIME_VERSION, DATETIME_DEIMASK, DATETIME_DEOMASK);
|
||||
/* Read flags */
|
||||
if(argv[i][0] == '-' && argv[i][1] == 'v')
|
||||
return system_version(&u, "Uxncli - Console Varvara Emulator", "17 Aug 2023");
|
||||
return system_version(&u, "Uxncli - Console Varvara Emulator", "19 Aug 2023");
|
||||
if(!system_init(&u, (Uint8 *)calloc(0x10000 * RAM_PAGES, sizeof(Uint8)), argv[i++]))
|
||||
return system_error("Init", "Failed to initialize uxn.");
|
||||
/* Game Loop */
|
||||
|
|
Loading…
Reference in New Issue