From 87b51a6261b2dca6382a845d5aae8b013396c76a Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Thu, 14 May 2020 18:41:09 -0400 Subject: [PATCH] By default, allocate about 0x100 bytes for PSP+RSP During "make updatebootstrap", we use less than 0x20 bytes on the PSP side and less than 0x40 bytes on the RSP one. 0x100 bytes ought to be enough for anybody. --- blk/618 | 2 +- emul/emul.c | 5 +++++ emul/emul.h | 2 ++ emul/forth.bin | Bin 5906 -> 5906 bytes emul/stage.c | 12 +----------- emul/xcomp.fs | 2 +- recipes/ti84/xcomp.fs | 2 +- recipes/trs80/xcomp.fs | 2 +- 8 files changed, 12 insertions(+), 15 deletions(-) diff --git a/blk/618 b/blk/618 index 3f8ec69..3c5949f 100644 --- a/blk/618 +++ b/blk/618 @@ -1,5 +1,5 @@ 0x8000 CONSTANT RAMSTART -0xf000 CONSTANT RS_ADDR 0xfffa CONSTANT PS_ADDR +0xff00 CONSTANT RS_ADDR 0xfffa CONSTANT PS_ADDR 0x80 CONSTANT ACIA_CTL 0x81 CONSTANT ACIA_IO 4 CONSTANT SDC_SPI 5 CONSTANT SDC_CSLOW 6 CONSTANT SDC_CSHIGH diff --git a/emul/emul.c b/emul/emul.c index 75b6b7c..4cc0aec 100644 --- a/emul/emul.c +++ b/emul/emul.c @@ -53,6 +53,7 @@ Machine* emul_init() memset(m.mem, 0, 0x10000); m.ramstart = 0; m.minsp = 0xffff; + m.maxix = 0; for (int i=0; i<0x100; i++) { m.iord[i] = NULL; m.iowr[i] = NULL; @@ -74,6 +75,9 @@ bool emul_step() if (newsp != 0 && newsp < m.minsp) { m.minsp = newsp; } + if (m.cpu.R1.wr.IX > m.maxix) { + m.maxix = m.cpu.R1.wr.IX; + } return true; } else { return false; @@ -116,4 +120,5 @@ void emul_memdump() void emul_printdebug() { fprintf(stderr, "Min SP: %04x\n", m.minsp); + fprintf(stderr, "Max IX: %04x\n", m.maxix); } diff --git a/emul/emul.h b/emul/emul.h index db3a55f..cf41c1a 100644 --- a/emul/emul.h +++ b/emul/emul.h @@ -14,6 +14,8 @@ typedef struct { ushort ramstart; // The minimum value reached by SP at any point during execution. ushort minsp; + // same principle for IX + ushort maxix; // Array of 0x100 function pointers to IO read and write routines. Leave to // NULL when IO port is unhandled. IORD iord[0x100]; diff --git a/emul/forth.bin b/emul/forth.bin index c08d3e44a11e6f927de0bbbc582b1ccb9d6171b4..666ef8eb5a91fb1b5b5e4c1a9c7d485b12782a46 100644 GIT binary patch delta 27 icmbQFH%V`UAS2`d$wG`%82@ix&e+EUq|8|E2mt_%Hwr@l delta 27 icmbQFH%V`UAS2_4$wG`%7(Z-Y&e+EUq|8|E2mt_!{R$QU diff --git a/emul/stage.c b/emul/stage.c index f33b63f..7b5b3b8 100644 --- a/emul/stage.c +++ b/emul/stage.c @@ -20,11 +20,6 @@ trouble of compiling defs to binary. */ -// When DEBUG is set, stage1 is a core-less forth that works interactively. -// Useful for... debugging! -// By the way: there's a double-echo in stagedbg. It's normal. Don't panic. - -//#define DEBUG #define RAMSTART 0 #define STDIO_PORT 0x00 // To know which part of RAM to dump, we listen to port 2, which at the end of @@ -56,10 +51,6 @@ static uint8_t iord_stdio() static void iowr_stdio(uint8_t val) { // we don't output stdout in stage0 -#ifdef DEBUG - // ... unless we're in DEBUG mode! - putchar(val); -#endif } static void iowr_here(uint8_t val) @@ -101,12 +92,11 @@ int main(int argc, char *argv[]) while (running && emul_step()); -#ifndef DEBUG // We're done, now let's spit dict data for (int i=start_here; imem[i]); } -#endif + emul_printdebug(); return 0; } diff --git a/emul/xcomp.fs b/emul/xcomp.fs index 4ffc47c..4551be1 100644 --- a/emul/xcomp.fs +++ b/emul/xcomp.fs @@ -1,5 +1,5 @@ 0xe800 CONSTANT RAMSTART -0xf000 CONSTANT RS_ADDR +0xff00 CONSTANT RS_ADDR 0xfffa CONSTANT PS_ADDR 212 LOAD ( z80 assembler ) 262 LOAD ( xcomp ) diff --git a/recipes/ti84/xcomp.fs b/recipes/ti84/xcomp.fs index c73a2a2..a550a36 100644 --- a/recipes/ti84/xcomp.fs +++ b/recipes/ti84/xcomp.fs @@ -1,5 +1,5 @@ 0x8000 CONSTANT RAMSTART -0xb000 CONSTANT RS_ADDR +0xbf00 CONSTANT RS_ADDR 0xbffa CONSTANT PS_ADDR RAMSTART 0x70 + CONSTANT LCD_MEM RAMSTART 0x72 + CONSTANT KBD_MEM diff --git a/recipes/trs80/xcomp.fs b/recipes/trs80/xcomp.fs index 8bc4acd..53becd9 100644 --- a/recipes/trs80/xcomp.fs +++ b/recipes/trs80/xcomp.fs @@ -1,4 +1,4 @@ -0xf000 CONSTANT RS_ADDR +0xff00 CONSTANT RS_ADDR 0xfffa CONSTANT PS_ADDR RS_ADDR 0x80 - CONSTANT RAMSTART 212 LOAD ( z80 assembler )