mirror of
https://github.com/hsoft/collapseos.git
synced 2025-03-31 09:48:48 +11:00
Remove memory maps
It was a dead end. my new tentative solution is xcomp.
This commit is contained in:
parent
6c48c1b53c
commit
afed423530
@ -91,8 +91,6 @@ I' -- n Copy RS second item to PS
|
|||||||
J -- n Copy RS third item to PS
|
J -- n Copy RS third item to PS
|
||||||
|
|
||||||
*** Memory ***
|
*** 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
|
@ a -- n Set n to value at address a
|
||||||
! n a -- Store n in address a
|
! n a -- Store n in address a
|
||||||
? a -- Print value of addr a
|
? a -- Print value of addr a
|
||||||
|
Binary file not shown.
@ -36,23 +36,6 @@
|
|||||||
: (parse*) 0x0a RAM+ ;
|
: (parse*) 0x0a RAM+ ;
|
||||||
: HERE 0x04 RAM+ ;
|
: HERE 0x04 RAM+ ;
|
||||||
: CURRENT 0x02 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
|
: QUIT
|
||||||
0 FLAGS ! (resRS)
|
0 FLAGS ! (resRS)
|
||||||
@ -199,7 +182,6 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
: BOOT
|
: BOOT
|
||||||
0 0x51 RAM+ _!
|
|
||||||
LIT< (parse) (find) DROP (parse*) !
|
LIT< (parse) (find) DROP (parse*) !
|
||||||
( 60 == SYSTEM SCRATCHPAD )
|
( 60 == SYSTEM SCRATCHPAD )
|
||||||
CURRENT @ 0x60 RAM+ !
|
CURRENT @ 0x60 RAM+ !
|
||||||
@ -229,7 +211,7 @@
|
|||||||
( We cannot use LITN as IMMEDIATE because of bootstrapping
|
( We cannot use LITN as IMMEDIATE because of bootstrapping
|
||||||
issues. Same thing for ",".
|
issues. Same thing for ",".
|
||||||
32 == NUMBER 14 == compiledWord )
|
32 == NUMBER 14 == compiledWord )
|
||||||
[ 32 H@ _! 2 ALLOT 14 H@ _! 2 ALLOT ] ,
|
[ 32 H@ ! 2 ALLOT 14 H@ ! 2 ALLOT ] ,
|
||||||
BEGIN
|
BEGIN
|
||||||
WORD
|
WORD
|
||||||
(find)
|
(find)
|
||||||
@ -248,8 +230,8 @@ XCURRENT @ ( to PSP )
|
|||||||
; IMMEDIATE
|
; IMMEDIATE
|
||||||
|
|
||||||
( Give ":" and ";" their real name )
|
( Give ":" and ";" their real name )
|
||||||
';' XCURRENT @ 4 - _C!
|
';' XCURRENT @ 4 - C!
|
||||||
':' SWAP ( from PSP ) 4 - _C!
|
':' SWAP ( from PSP ) 4 - C!
|
||||||
|
|
||||||
(xentry) _
|
(xentry) _
|
||||||
H@ 256 /MOD 2 PC! 2 PC!
|
H@ 256 /MOD 2 PC! 2 PC!
|
||||||
|
@ -232,7 +232,7 @@ L2 FSET ( skip )
|
|||||||
BC PUSHqq,
|
BC PUSHqq,
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
CODE _!
|
CODE !
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
DE POPqq,
|
DE POPqq,
|
||||||
chkPS,
|
chkPS,
|
||||||
@ -241,7 +241,7 @@ CODE _!
|
|||||||
(HL) D LDrr,
|
(HL) D LDrr,
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
CODE _@
|
CODE @
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
chkPS,
|
chkPS,
|
||||||
E (HL) LDrr,
|
E (HL) LDrr,
|
||||||
@ -250,14 +250,14 @@ CODE _@
|
|||||||
DE PUSHqq,
|
DE PUSHqq,
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
CODE _C!
|
CODE C!
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
DE POPqq,
|
DE POPqq,
|
||||||
chkPS,
|
chkPS,
|
||||||
(HL) E LDrr,
|
(HL) E LDrr,
|
||||||
;CODE
|
;CODE
|
||||||
|
|
||||||
CODE _C@
|
CODE C@
|
||||||
HL POPqq,
|
HL POPqq,
|
||||||
chkPS,
|
chkPS,
|
||||||
L (HL) LDrr,
|
L (HL) LDrr,
|
||||||
|
32
notes.txt
32
notes.txt
@ -88,8 +88,7 @@ RAMSTART INITIAL_SP
|
|||||||
+0e WORDBUF
|
+0e WORDBUF
|
||||||
+2e SYSVNXT
|
+2e SYSVNXT
|
||||||
+4e INTJUMP
|
+4e INTJUMP
|
||||||
+51 MMAPPTR
|
+51 RESERVED
|
||||||
+53 RESERVED
|
|
||||||
+60 SYSTEM SCRATCHPAD
|
+60 SYSTEM SCRATCHPAD
|
||||||
+80 RAMEND
|
+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
|
one of those slots for an interrupt, write a jump to the appropriate offset in
|
||||||
that RAM location.
|
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
|
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
|
by low-level drivers. These are the current usages of this space throughout the
|
||||||
project:
|
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
|
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
|
in dict entry creation overwriting the code before it has the chance to be
|
||||||
interpreted.
|
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.....
|
|
||||||
>
|
|
||||||
|
Loading…
Reference in New Issue
Block a user