mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-23 22:58:06 +11:00
recipes/sms/romasm: make zasm's memory usage fit the SMS
This commit is contained in:
parent
af0b6231ca
commit
1c6a7caeae
@ -44,9 +44,25 @@
|
|||||||
; FS_HANDLE_SIZE
|
; FS_HANDLE_SIZE
|
||||||
; BLOCKDEV_SIZE
|
; BLOCKDEV_SIZE
|
||||||
|
|
||||||
; *** Variables ***
|
|
||||||
|
|
||||||
#include "user.h"
|
#include "user.h"
|
||||||
|
|
||||||
|
; *** Overridable consts ***
|
||||||
|
; Maximum number of symbols we can have in the global and consts registry
|
||||||
|
.equ ZASM_REG_MAXCNT 0xff
|
||||||
|
|
||||||
|
; Maximum number of symbols we can have in the local registry
|
||||||
|
.equ ZASM_LREG_MAXCNT 0x40
|
||||||
|
|
||||||
|
; Size of the symbol name buffer size. This is a pool. There is no maximum name
|
||||||
|
; length for a single symbol, just a maximum size for the whole pool.
|
||||||
|
; Global labels and consts have the same buf size
|
||||||
|
.equ ZASM_REG_BUFSZ 0x1000
|
||||||
|
|
||||||
|
; Size of the names buffer for the local context registry
|
||||||
|
.equ ZASM_LREG_BUFSZ 0x200
|
||||||
|
|
||||||
|
; ******
|
||||||
|
|
||||||
#include "err.h"
|
#include "err.h"
|
||||||
.org USER_CODE
|
.org USER_CODE
|
||||||
|
|
||||||
@ -69,4 +85,3 @@ jp zasmMain
|
|||||||
#include "zasm/symbol.asm"
|
#include "zasm/symbol.asm"
|
||||||
.equ ZASM_RAMSTART SYM_RAMEND
|
.equ ZASM_RAMSTART SYM_RAMEND
|
||||||
#include "zasm/main.asm"
|
#include "zasm/main.asm"
|
||||||
|
|
||||||
|
@ -5,28 +5,18 @@
|
|||||||
; Local labels during the "official" first pass are ignored. To register them
|
; Local labels during the "official" first pass are ignored. To register them
|
||||||
; in the global registry during that pass would be wasteful in terms of memory.
|
; in the global registry during that pass would be wasteful in terms of memory.
|
||||||
;
|
;
|
||||||
; What we don instead is set up a separate register for them and have a "second
|
; What we do instead is set up a separate register for them and have a "second
|
||||||
; first pass" whenever we encounter a new context. That is, we wipe the local
|
; first pass" whenever we encounter a new context. That is, we wipe the local
|
||||||
; registry, parse the code until the next global symbol (or EOF), then rewind
|
; registry, parse the code until the next global symbol (or EOF), then rewind
|
||||||
; and continue second pass as usual.
|
; and continue second pass as usual.
|
||||||
|
|
||||||
; *** Constants ***
|
; *** Constants ***
|
||||||
; Maximum number of symbols we can have in the global and consts registry
|
|
||||||
.equ SYM_MAXCOUNT 0xff
|
|
||||||
; Maximum number of symbols we can have in the local registry
|
|
||||||
.equ SYM_LOC_MAXCOUNT 0x40
|
|
||||||
; Size of each record in registry
|
; Size of each record in registry
|
||||||
.equ SYM_RECSIZE 3
|
.equ SYM_RECSIZE 3
|
||||||
|
|
||||||
; Size of the symbol name buffer size. This is a pool. There is no maximum name
|
.equ SYM_REGSIZE ZASM_REG_BUFSZ+1+ZASM_REG_MAXCNT*SYM_RECSIZE
|
||||||
; length for a single symbol, just a maximum size for the whole pool.
|
|
||||||
; Global labels and consts have the same buf size
|
|
||||||
.equ SYM_BUFSIZE 0x1000
|
|
||||||
.equ SYM_REGSIZE SYM_BUFSIZE+1+SYM_MAXCOUNT*SYM_RECSIZE
|
|
||||||
|
|
||||||
; Size of the names buffer for the local context registry
|
.equ SYM_LOC_REGSIZE ZASM_LREG_BUFSZ+1+ZASM_LREG_MAXCNT*SYM_RECSIZE
|
||||||
.equ SYM_LOC_BUFSIZE 0x200
|
|
||||||
.equ SYM_LOC_REGSIZE SYM_LOC_BUFSIZE+1+SYM_LOC_MAXCOUNT*SYM_RECSIZE
|
|
||||||
|
|
||||||
; *** Variables ***
|
; *** Variables ***
|
||||||
; A registry has three parts: record count (byte) record list and names pool.
|
; A registry has three parts: record count (byte) record list and names pool.
|
||||||
@ -53,16 +43,16 @@
|
|||||||
; records list of the register and then the max record count.
|
; records list of the register and then the max record count.
|
||||||
|
|
||||||
SYM_GLOBAL_REGISTRY:
|
SYM_GLOBAL_REGISTRY:
|
||||||
.dw SYM_GLOB_REG, SYM_GLOB_REG+SYM_BUFSIZE
|
.dw SYM_GLOB_REG, SYM_GLOB_REG+ZASM_REG_BUFSZ
|
||||||
.db SYM_MAXCOUNT
|
.db ZASM_REG_MAXCNT
|
||||||
|
|
||||||
SYM_LOCAL_REGISTRY:
|
SYM_LOCAL_REGISTRY:
|
||||||
.dw SYM_LOC_REG, SYM_LOC_REG+SYM_LOC_BUFSIZE
|
.dw SYM_LOC_REG, SYM_LOC_REG+ZASM_LREG_BUFSZ
|
||||||
.db SYM_LOC_MAXCOUNT
|
.db ZASM_LREG_MAXCNT
|
||||||
|
|
||||||
SYM_CONST_REGISTRY:
|
SYM_CONST_REGISTRY:
|
||||||
.dw SYM_CONST_REG, SYM_CONST_REG+SYM_BUFSIZE
|
.dw SYM_CONST_REG, SYM_CONST_REG+ZASM_REG_BUFSZ
|
||||||
.db SYM_MAXCOUNT
|
.db ZASM_REG_MAXCNT
|
||||||
|
|
||||||
; *** Code ***
|
; *** Code ***
|
||||||
|
|
||||||
|
@ -8,6 +8,12 @@
|
|||||||
.equ ED_BUF_MAXLINES 0x100
|
.equ ED_BUF_MAXLINES 0x100
|
||||||
.equ ED_BUF_PADMAXLEN 0x800
|
.equ ED_BUF_PADMAXLEN 0x800
|
||||||
|
|
||||||
|
; Make zasm fit in SMS's memory
|
||||||
|
.equ ZASM_REG_MAXCNT 0x80
|
||||||
|
.equ ZASM_LREG_MAXCNT 0x10
|
||||||
|
.equ ZASM_REG_BUFSZ 0x800
|
||||||
|
.equ ZASM_LREG_BUFSZ 0x100
|
||||||
|
|
||||||
; *** JUMP TABLE ***
|
; *** JUMP TABLE ***
|
||||||
.equ strncmp 0x03
|
.equ strncmp 0x03
|
||||||
.equ addDE 0x06
|
.equ addDE 0x06
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
.equ RAMSTART 0x4000
|
.equ RAMSTART 0x4000
|
||||||
|
.equ ZASM_REG_MAXCNT 0xff
|
||||||
|
.equ ZASM_LREG_MAXCNT 0x40
|
||||||
|
.equ ZASM_REG_BUFSZ 0x1000
|
||||||
|
.equ ZASM_LREG_BUFSZ 0x200
|
||||||
|
|
||||||
jp test
|
jp test
|
||||||
|
|
||||||
#include "core.asm"
|
#include "core.asm"
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
.equ RAMSTART 0x4000
|
.equ RAMSTART 0x4000
|
||||||
|
.equ ZASM_REG_MAXCNT 0xff
|
||||||
|
.equ ZASM_LREG_MAXCNT 0x40
|
||||||
|
.equ ZASM_REG_BUFSZ 0x1000
|
||||||
|
.equ ZASM_LREG_BUFSZ 0x200
|
||||||
|
|
||||||
jp test
|
jp test
|
||||||
|
|
||||||
#include "core.asm"
|
#include "core.asm"
|
||||||
|
Loading…
Reference in New Issue
Block a user