Remove memory maps

It was a dead end. my new tentative solution is xcomp.
This commit is contained in:
Virgil Dupras 2020-04-09 09:21:55 -04:00
parent 6c48c1b53c
commit afed423530
5 changed files with 8 additions and 58 deletions

View File

@ -91,8 +91,6 @@ I' -- n Copy RS second item to PS
J -- n Copy RS third item to PS
*** Memory ***
(mmap*) -- a Address of active memory mapper. 0 for none. See
"Memory maps" in notes.txt.
@ a -- n Set n to value at address a
! n a -- Store n in address a
? a -- Print value of addr a

Binary file not shown.

View File

@ -36,23 +36,6 @@
: (parse*) 0x0a RAM+ ;
: HERE 0x04 RAM+ ;
: CURRENT 0x02 RAM+ ;
: (mmap*) 0x51 RAM+ ;
( The goal here is to be as fast as possible *when there is
no mmap*, which is the most frequent situation. That is why
we don't DUP and we rather refetch. That is also why we
use direct literal instead of RAM+ or (mmap*). )
: (mmap)
[ RAMSTART 0x51 + LITN ] _@
IF
[ RAMSTART 0x51 + LITN ] _@ EXECUTE
THEN
;
: @ (mmap) _@ ;
: C@ (mmap) _C@ ;
: ! (mmap) _! ;
: C! (mmap) _C! ;
: QUIT
0 FLAGS ! (resRS)
@ -199,7 +182,6 @@
;
: BOOT
0 0x51 RAM+ _!
LIT< (parse) (find) DROP (parse*) !
( 60 == SYSTEM SCRATCHPAD )
CURRENT @ 0x60 RAM+ !
@ -229,7 +211,7 @@
( We cannot use LITN as IMMEDIATE because of bootstrapping
issues. Same thing for ",".
32 == NUMBER 14 == compiledWord )
[ 32 H@ _! 2 ALLOT 14 H@ _! 2 ALLOT ] ,
[ 32 H@ ! 2 ALLOT 14 H@ ! 2 ALLOT ] ,
BEGIN
WORD
(find)
@ -248,8 +230,8 @@ XCURRENT @ ( to PSP )
; IMMEDIATE
( Give ":" and ";" their real name )
';' XCURRENT @ 4 - _C!
':' SWAP ( from PSP ) 4 - _C!
';' XCURRENT @ 4 - C!
':' SWAP ( from PSP ) 4 - C!
(xentry) _
H@ 256 /MOD 2 PC! 2 PC!

View File

@ -232,7 +232,7 @@ L2 FSET ( skip )
BC PUSHqq,
;CODE
CODE _!
CODE !
HL POPqq,
DE POPqq,
chkPS,
@ -241,7 +241,7 @@ CODE _!
(HL) D LDrr,
;CODE
CODE _@
CODE @
HL POPqq,
chkPS,
E (HL) LDrr,
@ -250,14 +250,14 @@ CODE _@
DE PUSHqq,
;CODE
CODE _C!
CODE C!
HL POPqq,
DE POPqq,
chkPS,
(HL) E LDrr,
;CODE
CODE _C@
CODE C@
HL POPqq,
chkPS,
L (HL) LDrr,

View File

@ -88,8 +88,7 @@ RAMSTART INITIAL_SP
+0e WORDBUF
+2e SYSVNXT
+4e INTJUMP
+51 MMAPPTR
+53 RESERVED
+51 RESERVED
+60 SYSTEM SCRATCHPAD
+80 RAMEND
@ -117,9 +116,6 @@ those slots...) in boot binaries are made to jump to this address. If you use
one of those slots for an interrupt, write a jump to the appropriate offset in
that RAM location.
MMAPPTR: Address behind (mmap), which is called before every !/C!/@/C@ world
to give the opportunity to change the address of the call.
SYSTEM SCRATCHPAD is reserved for temporary system storage or can be reserved
by low-level drivers. These are the current usages of this space throughout the
project:
@ -158,29 +154,3 @@ can't have comments. This leads to peculiar code in this area. If you see weird
whitespace usage, it's probably because not using those whitespace would result
in dict entry creation overwriting the code before it has the chance to be
interpreted.
*** Memory maps
We have a mechanism to map memory ranges to something else. We call this memory
maps. There is a reserved address in memory for a memory mapping routine. The
word (mmap*) returns that address. By default, it's zero which means no mapping.
Each call to @, C@, ! or C! call that word, if nonzero, before executing. This
allows you to do pretty much anything. Try to be efficient in your programming,
however, because those words are called *very* often.
Here's a toy example of memory map usage:
> 8 0x8000 DUMP
:00 0000 0000 0000 0000 ........
> : foo DUP 0x8000 = IF 2 + THEN ;
> ' foo (mmap*) !
> 8 0x8000 DUMP
:00 0000 0000 0000 0000 ........
> 0x1234 0x8000 !
> 8 0x8000 DUMP
:00 3412 3412 0000 0000 4.4.....
> 0 (mmap*) !
> 8 0x8000 DUMP
:00 0000 3412 0000 0000 ..4.....
>