Fixing up code words more.
This commit is contained in:
@ -16,8 +16,13 @@
|
|||||||
: asm r|
|
: asm r|
|
||||||
|
|
||||||
also forth definitions
|
also forth definitions
|
||||||
vocabulary asm asm definitions
|
vocabulary asm
|
||||||
also internals
|
internals definitions
|
||||||
|
|
||||||
|
: ca! ( n a -- ) dup cell-base >r cell-shift swap over lshift
|
||||||
|
swap 255 swap lshift invert r@ @ and or r> ! ;
|
||||||
|
|
||||||
|
also asm definitions
|
||||||
|
|
||||||
variable code-start
|
variable code-start
|
||||||
variable code-at
|
variable code-at
|
||||||
@ -25,7 +30,8 @@ variable code-at
|
|||||||
DEFINED? posix [IF]
|
DEFINED? posix [IF]
|
||||||
also posix
|
also posix
|
||||||
: reserve ( n -- )
|
: reserve ( n -- )
|
||||||
0 swap PROT_READ PROT_WRITE PROT_EXEC or or MAP_ANONYMOUS -1 0 mmap code-start ! ;
|
0 swap PROT_READ PROT_WRITE PROT_EXEC or or
|
||||||
|
MAP_ANONYMOUS MAP_PRIVATE or -1 0 mmap code-start ! ;
|
||||||
previous
|
previous
|
||||||
4096 reserve
|
4096 reserve
|
||||||
[THEN]
|
[THEN]
|
||||||
@ -37,14 +43,19 @@ previous
|
|||||||
1024 reserve
|
1024 reserve
|
||||||
[THEN]
|
[THEN]
|
||||||
|
|
||||||
code-start code-at !
|
code-start @ code-at !
|
||||||
|
|
||||||
: chere ( -- a ) code-at @ ;
|
: chere ( -- a ) code-at @ ;
|
||||||
: callot ( n -- ) code-at +! ;
|
: callot ( n -- ) code-at +! ;
|
||||||
: code, ( n -- ) chere ! cell callot ;
|
: code1, ( n -- ) chere ca! 1 callot ;
|
||||||
: code1, ( n -- ) chere c! 1 callot ;
|
: code2, ( n -- ) dup code1, 8 rshift code1, ;
|
||||||
: code2, ( n -- ) chere w! 2 callot ;
|
: code3, ( n -- ) dup code2, 16 rshift code1, ;
|
||||||
: code4, ( n -- ) chere l! 4 callot ;
|
: code4, ( n -- ) dup code2, 16 rshift code2, ;
|
||||||
|
cell 8 = [IF]
|
||||||
|
: code, dup code4, 32 rshift code4, ;
|
||||||
|
[ELSE]
|
||||||
|
: code, code4, ;
|
||||||
|
[THEN]
|
||||||
: end-code previous ;
|
: end-code previous ;
|
||||||
|
|
||||||
also forth definitions
|
also forth definitions
|
||||||
|
|||||||
@ -22,8 +22,16 @@
|
|||||||
|
|
||||||
internals definitions
|
internals definitions
|
||||||
|
|
||||||
|
( Temporary for platforms without CALLCODE )
|
||||||
|
DEFINED? CALLCODE 0= [IF]
|
||||||
|
create CALLCODE
|
||||||
|
[THEN]
|
||||||
|
|
||||||
( Safe memory access, i.e. aligned )
|
( Safe memory access, i.e. aligned )
|
||||||
: ca@ ( a -- n ) dup cell 1- invert and @ swap cell 1- and 8 * rshift 255 and ;
|
cell 1- constant cell-mask
|
||||||
|
: cell-base ( a -- a ) cell-mask invert and ;
|
||||||
|
: cell-shift ( a -- a ) cell-mask and 8 * ;
|
||||||
|
: ca@ ( a -- n ) dup cell-base @ swap cell-shift rshift 255 and ;
|
||||||
|
|
||||||
( Print address line leaving room )
|
( Print address line leaving room )
|
||||||
: dump-line ( a -- a ) cr <# #s #> 20 over - >r type r> spaces ;
|
: dump-line ( a -- a ) cr <# #s #> 20 over - >r type r> spaces ;
|
||||||
|
|||||||
@ -171,16 +171,14 @@ forth definitions
|
|||||||
|
|
||||||
internals definitions
|
internals definitions
|
||||||
( Heap Capabilities )
|
( Heap Capabilities )
|
||||||
binary
|
1 0 lshift constant MALLOC_CAP_EXEC
|
||||||
0001 constant MALLOC_CAP_EXEC
|
1 1 lshift constant MALLOC_CAP_32BIT
|
||||||
0010 constant MALLOC_CAP_32BIT
|
1 2 lshift constant MALLOC_CAP_8BIT
|
||||||
0100 constant MALLOC_CAP_8BIT
|
1 3 lshift constant MALLOC_CAP_DMA
|
||||||
1000 constant MALLOC_CAP_DMA
|
1 10 lshift constant MALLOC_CAP_SPIRAM
|
||||||
: MALLOC_CAP_PID ( n -- ) 10000 over 11 ( 3 ) - for 2* next ;
|
1 11 lshift constant MALLOC_CAP_INTERNAL
|
||||||
000010000000000 constant MALLOC_CAP_SPIRAM
|
1 12 lshift constant MALLOC_CAP_DEFAULT
|
||||||
000100000000000 constant MALLOC_CAP_INTERNAL
|
1 13 lshift constant MALLOC_CAP_IRAM_8BIT
|
||||||
001000000000000 constant MALLOC_CAP_DEFAULT
|
1 14 lshift constant MALLOC_CAP_RETENTION
|
||||||
010000000000000 constant MALLOC_CAP_IRAM_8BIT
|
1 15 lshift constant MALLOC_CAP_RTCRAM
|
||||||
010000000000000 constant MALLOC_CAP_RETENTION
|
|
||||||
decimal
|
|
||||||
forth definitions
|
forth definitions
|
||||||
|
|||||||
@ -17,10 +17,11 @@
|
|||||||
asm forth
|
asm forth
|
||||||
|
|
||||||
code my2*
|
code my2*
|
||||||
$02 code1, $48 code1, ( l32i.n a4, a2, 0 )
|
$364100 code3, ( entry a1, 32 )
|
||||||
$11 code1, $44 code1, $f0 code1, ( slli a4, a4, 1 )
|
$8802 code2, ( l32i.n a8, a2, 0 )
|
||||||
$02 code1, $49 code1, ( s32i.n a4, a2, 0 )
|
$f08811 code3, ( slli a8, a8, 1 )
|
||||||
$f0 code1, $0d code1, ( ret.n )
|
$8902 code2, ( s32i.n a8, a2, 0 )
|
||||||
|
$1df0 code2, ( retw.n )
|
||||||
end-code
|
end-code
|
||||||
|
|
||||||
see my2*
|
see my2*
|
||||||
|
|||||||
@ -85,6 +85,7 @@ z" __errno_location" 0 sysfunc __errno_location
|
|||||||
1 constant PROT_READ
|
1 constant PROT_READ
|
||||||
2 constant PROT_WRITE
|
2 constant PROT_WRITE
|
||||||
4 constant PROT_EXEC
|
4 constant PROT_EXEC
|
||||||
|
$2 constant MAP_PRIVATE
|
||||||
$10 constant MAP_FIXED
|
$10 constant MAP_FIXED
|
||||||
$20 constant MAP_ANONYMOUS
|
$20 constant MAP_ANONYMOUS
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user