From af0b6231ca583da69e9ca35d73b1794c2003768b Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 23 Jul 2019 16:13:52 -0400 Subject: [PATCH] recipes/sms/romasm: make ed's memory usage fit the SMS Yup, that's ultimately why I've just made this whole big zasm refactoring in the previous commits. To allow for this. But also, zasm is in much better shape now... --- apps/ed/buf.asm | 11 ++--------- apps/ed/glue.asm | 10 +++++++++- recipes/sms/romasm/user-tmpl.h | 3 +++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/apps/ed/buf.asm b/apps/ed/buf.asm index 988f191..20b19b6 100644 --- a/apps/ed/buf.asm +++ b/apps/ed/buf.asm @@ -1,12 +1,5 @@ ; buf - manage line buffer ; -; *** Consts *** -; -; Maximum number of lines allowed in the buffer. -.equ BUF_MAXLINES 0x800 -; Size of our scratchpad -.equ BUF_PADMAXLEN 0x1000 - ; *** Variables *** ; Number of lines currently in the buffer .equ BUF_LINECNT BUF_RAMSTART @@ -14,11 +7,11 @@ .equ BUF_LINES BUF_LINECNT+2 ; Points to the end of the scratchpad, that is, one byte after the last written ; char in it. -.equ BUF_PADEND BUF_LINES+BUF_MAXLINES*2 +.equ BUF_PADEND BUF_LINES+ED_BUF_MAXLINES*2 ; The in-memory scratchpad .equ BUF_PAD BUF_PADEND+2 -.equ BUF_RAMEND BUF_PAD+BUF_PADMAXLEN +.equ BUF_RAMEND BUF_PAD+ED_BUF_PADMAXLEN ; *** Code *** diff --git a/apps/ed/glue.asm b/apps/ed/glue.asm index 5a5a5cb..5956aed 100644 --- a/apps/ed/glue.asm +++ b/apps/ed/glue.asm @@ -1,4 +1,13 @@ #include "user.h" + +; *** Overridable consts *** +; Maximum number of lines allowed in the buffer. +.equ ED_BUF_MAXLINES 0x800 +; Size of our scratchpad +.equ ED_BUF_PADMAXLEN 0x1000 + +; ****** + #include "err.h" .org USER_CODE @@ -14,4 +23,3 @@ #include "ed/cmd.asm" .equ ED_RAMSTART CMD_RAMEND #include "ed/main.asm" - diff --git a/recipes/sms/romasm/user-tmpl.h b/recipes/sms/romasm/user-tmpl.h index cbcfd20..ba23a5b 100644 --- a/recipes/sms/romasm/user-tmpl.h +++ b/recipes/sms/romasm/user-tmpl.h @@ -4,6 +4,9 @@ .equ USER_RAMSTART 0xc200 .equ FS_HANDLE_SIZE 6 .equ BLOCKDEV_SIZE 8 +; Make ed fit in SMS's memory +.equ ED_BUF_MAXLINES 0x100 +.equ ED_BUF_PADMAXLEN 0x800 ; *** JUMP TABLE *** .equ strncmp 0x03