use precompiled standard library (not really a linker)

This commit is contained in:
slederer 2024-11-09 22:22:48 +01:00
parent 5ce5bc44b8
commit 91cb059f38
8 changed files with 105 additions and 22 deletions

View file

@ -1051,3 +1051,16 @@ FLOAT32_ERR_TRUNC:
.BYTE "integer overflow",0
FLOAT32_ERR_DIVZ:
.BYTE "float division by zero",0
%export _ADDFLOAT32
%export _CMPFLOAT32
%export _CMPINTFLOAT32
%export _DIVFLOAT32
%export _FRACTFLOAT32
%export _GETFLOAT32EXP
%export _INTFLOAT32
%export _INTTOFLOAT32
%export _MULFLOAT32
%export _NEGFLOAT32
%export _SUBFLOAT32
%export _TRUNCFLOAT32

View file

@ -387,7 +387,7 @@ READCHANW_XT:
; --- check if a string is already initialized
; parameters: addr
; returns: 1 if it is initialied, 0 otherwise
; returns: 1 if it is initialized, 0 otherwise
_STRINGISINITED:
LOADI.S1.X2Y ; load length field, keep addr
CBRANCH.NZ STRIN_XT1 ; if not zero, it is already inited
@ -1616,7 +1616,7 @@ MEM_FREE_XT:
; Since the return stack is no longer valid afterwards, directly
; jumps to _MAIN instead of using RET.
; parameters: [ start of heap address ]
; parameters: [ _MAIN entry point, start of heap address ]
_MEM_INIT:
; initialize anchor chunk with start of heap address
; and heap size - header size
@ -1663,7 +1663,9 @@ _MEM_INIT:
LOADCP _MEM_FREE ; add chunk to free list
CALL
LOADCP _MAIN
; get address of _MAIN from program header
LOADCP _MAIN_PTR
LOADI
JUMP
; allocate a string with MEM_ALLOC.
@ -1937,3 +1939,35 @@ NEWLINESTR:
.BYTE 13,10
.CPOOL
%export _APPENDSTRING
%export _ARRAYTOSET
%export _BOUNDSCHECK
%export _CHARTOSTRING
%export _CHECK_ALLOC
%export _CLEARBIT
%export _CLEARMEM
%export _CMPSTRING
%export _CMPSTRINGL
%export _CMPWORDS
%export _COPYSTRING
%export _COPYWORDS
%export _ENUMCHECK
%export _INDEXSTRING
%export _INITSTRING
%export _INITSTRINGF
%export _INITSTRINGFROM
%export _ISCHARINSTRING
%export _ISINTINARRAY
%export _MEM_ALLOC
%export _MEM_INIT
%export _MEM_FREE
%export _RANGECHECK
%export _RUNTIME_ERR
%export _SETBIT
%export _SETSTRINGCHAR
%export _SETSTRINGLENGTH
%export _STRINGTOCHAR
%export _STRING_ALLOC
%export _TESTBIT
%export MEM_DUMP

11
lib/stdlibwrap.s Normal file
View file

@ -0,0 +1,11 @@
.ORG 24576 + 32
.EQU _HEAP_SZ_PTR 24576 + 4
.EQU _STACK_SZ_PTR 24576 + 8
.EQU _MAIN_PTR 24576 + 12
%include "coreloader.lsym"
%include "runtime.s"
%include "float32.s"
%include "stdlib.s"
_MAIN: