1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212
|
\ tag: Other FCode functions
\
\ this code implements IEEE 1275-1994 ch. 5.3.7
\
\ Copyright (C) 2003 Stefan Reinauer
\
\ See the file "COPYING" for further information about
\ the copyright and warranty status of this work.
\
\ The current diagnostic setting
defer _diag-switch?
\
\ 5.3.7 Other FCode functions
\
hex
\ 5.3.7.1 Peek/poke
: cpeek ( addr -- false | byte true )
c@ true
;
: wpeek ( waddr -- false | w true )
w@ true
;
: lpeek ( qaddr -- false | quad true )
l@ true
;
: cpoke ( byte addr -- okay? )
c! true
;
: wpoke ( w waddr -- okay? )
w! true
;
: lpoke ( quad qaddr -- okay? )
l! true
;
\ 5.3.7.2 Device-register access
: rb@ ( addr -- byte )
;
: rw@ ( waddr -- w )
;
: rl@ ( qaddr -- quad )
;
: rb! ( byte addr -- )
;
: rw! ( w waddr -- )
;
: rl! ( quad qaddr -- )
;
: rx@ ( oaddr - o )
state @ if
h# 22e get-token if , else execute then
else
h# 22e get-token drop execute
then
; immediate
: rx! ( o oaddr -- )
state @ if
h# 22f get-token if , else execute then
else
h# 22f get-token drop execute
then
; immediate
\ 5.3.7.3 Time
0 value dummy-msecs
: get-msecs ( -- n )
dummy-msecs dup 1+ to dummy-msecs
;
: ms ( n -- )
get-msecs +
begin dup get-msecs < until
drop
;
: alarm ( xt n -- )
;
: user-abort ( ... -- ) ( R: ... -- )
;
\ 5.3.7.4 System information
0003.0000 value fcode-revision ( -- n )
: mac-address ( -- mac-str mac-len )
;
\ 5.3.7.5 FCode self-test
: display-status ( n -- )
;
: memory-test-suite ( addr len -- fail? )
;
: mask ( -- a-addr )
;
: diagnostic-mode? ( -- diag? )
\ Return the NVRAM diag-switch? setting
_diag-switch?
;
\ 5.3.7.6 Start and end.
\ Begin program with spread 0 followed by FCode-header.
: start0 ( -- )
0 fcode-spread !
offset16
fcode-header
;
\ Begin program with spread 1 followed by FCode-header.
: start1 ( -- )
1 to fcode-spread
offset16
fcode-header
;
\ Begin program with spread 2 followed by FCode-header.
: start2 ( -- )
2 to fcode-spread
offset16
fcode-header
;
\ Begin program with spread 4 followed by FCode-header.
: start4 ( -- )
4 to fcode-spread
offset16
fcode-header
;
\ Begin program with spread 1 followed by FCode-header.
: version1 ( -- )
1 to fcode-spread
fcode-header
;
\ Cease evaluating this FCode program.
: end0 ( -- )
true fcode-end !
;
\ Cease evaluating this FCode program.
: end1 ( -- )
end0
;
\ Standard FCode number for undefined FCode functions.
: ferror ( -- )
." undefined fcode# encountered." cr
true fcode-end !
;
\ Pause FCode evaluation if desired; can resume later.
: suspend-fcode ( -- )
\ NOT YET IMPLEMENTED.
;
\ Evaluate FCode beginning at location addr.
\ : byte-load ( addr xt -- )
\ \ this word is implemented in feval.fs
\ ;
\ Set address and arguments of new device node.
: set-args ( arg-str arg-len unit-str unit-len -- )
?my-self drop
depth 1- >r
" decode-unit" ['] $call-parent catch if
2drop 2drop
then
my-self ihandle>phandle >dn.probe-addr \ offset
begin depth r@ > while
dup na1+ >r ! r>
repeat
r> 2drop
my-self >in.arguments 2@ free-mem
strdup my-self >in.arguments 2!
;
: dma-alloc
s" dma-alloc" $call-parent
;
|