PageRenderTime 67ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 0ms

/test/hrc/forth/aw.fth

https://github.com/mediogre/colorite
Forth | 507 lines | 469 code | 28 blank | 10 comment | 82 complexity | af42b43345e8cf636c02eebf72779786 MD5 | raw file
  1. \ Additional words for working BOOTMON -- LNM 05-10-1999
  2. ." Additional words for BOOTMON"
  3. include? task-instdata.fth instdata.fth
  4. include? task-configur.fth configur.fth
  5. anew task-aw.fth decimal
  6. : norealize cr r@ new>name
  7. ." - Error !!! The function " id. ." is not realized once more !!!" cr cr ;
  8. : .h base @ swap hex . base ! ;
  9. : base$ ( base, <number> -- N , convert next number as hex )
  10. base @ swap base ! 32 lword number? num_type_single = not
  11. abort" Not a single number!" swap base ! state @
  12. IF [compile] literal THEN ;
  13. : h# 16 base$ ; immediate
  14. : d# 10 base$ ; immediate
  15. : o# 8 base$ ; immediate
  16. : leftsymbsrch ( Adr Len Symb )
  17. 0 do dup c@ 2 pick = if leave then 1 + loop swap drop ( Adr Len AdrSymb ) ;
  18. : left-split ( Adr Len Symb -- Adr LenSymb AdrSymb+1 Len-LenSymb-1 )
  19. 2 pick 2 pick ( Adr Len Symb Adr Len )
  20. leftsymbsrch
  21. dup 3 pick - ( Adr Len AdrSymb LenSymb )
  22. rot swap -rot ( Adr LenSymb AdrSymb Len )
  23. swap 1+ swap 1- 2 pick - 0 max ( Adr LenSymb AdrSymb+1 Len-LenSymb-1 ) ;
  24. : rightsymbsrch ( Adr Len Symb )
  25. 0 do dup c@ 2 pick = if leave then 1 - loop swap drop ( Adr Len AdrSymb ) ;
  26. : right-split ( Adr Len Symb -- Adr LenSymb AdrSymb+1 Len-LenSymb-1 )
  27. 2 pick 2 pick + 1- 2 pick ( Adr Len Symb Adr+Len-1 Len )
  28. rightsymbsrch
  29. dup 3 pick - 0 max ( Adr Len AdrSymb LenSymb )
  30. rot swap -rot ( Adr LenSymb AdrSymb Len )
  31. swap 1+ swap 1- 2 pick - ( Adr LenSymb AdrSymb+1 Len-LenSymb-1 ) ;
  32. : left-parse-string left-split ;
  33. : unaligned-@ 0 4 0 do dup 8 << over 8 c@ + swap 1 + swap loop ( Data ) ;
  34. \ variable #out
  35. : lcc ( char ) dup h# 41 h# 5a between if h# 20 + then ( char' ) ;
  36. : upc ( char ) dup ascii a ascii z between if h# 20 - then ( char' ) ;
  37. \ encode string to upper registr
  38. : stupc ( A L ) dup if 2dup 0 do dup c@ upc over c! 1+ loop drop then ( A L ) ;
  39. : allignhere ( -- ) here 4 mod dup
  40. if 4 swap - ( dup ." SmGr=" . )
  41. 0 do 255 c, loop \ Aliigen for 4
  42. else drop then ( -- ) ;
  43. : encode+ ( Padr1 Plen1 Padr2 Plen2 -- Padr1 Plen1+len2 )
  44. ASCII , rot c! + dup 1+ 2 pick c! ( Padr1 Plen1+len2 ) ; \ ++
  45. : encode-bytes here >r ( adr len ) dup c, 0 do dup c@ c, 1+ loop drop ( )
  46. r> here over - 1- ( adr len ) ; \ ++
  47. : encode-string here >r ( adr len ) dup c, 0 do dup c@ c, 1+ loop drop ( )
  48. 0 c, r> here over - 1- ( adr len ) ; \ ++
  49. : encode-int ( n -- Padr Plen ) base @ >r hex
  50. \ LNM variant <# 0 8 0 do # loop #> ( adr len )
  51. (.) \ Classic variant
  52. encode-bytes r> base ! ( Padr Plen ) ; \ ++
  53. : encode-2int >r encode-int r> encode-int encode+ ( Padr Plen ) ; \ ++
  54. : //string tuck - >r + r> ;
  55. 15 constant obio
  56. : decode-bytes ( pAdr1 pLen1 dLen -- pAdr1 pLen1 dAdr dLen )
  57. >r over r@ + swap r@ - rot r> ( pAdr1 pLen1 dAdr dLen ) ;
  58. : decode-space dup 0=
  59. if drop obio exit then 2dup " obio" $=
  60. if 2drop obio exit then 2dup " io" $=
  61. if 2drop obio exit then ( ffd2c320 ) dup obio =
  62. if drop obio exit then dup 1 >
  63. if dup ." Invalid address" .h cr abort then ;
  64. : decode-int ( Padr Plen ) base @ >r hex 0 0 2swap >number
  65. dup if 1- swap 1+ swap then 2swap drop
  66. r> base ! ( Padr' Plen' N ) ; \ ++++ 21-02-2000
  67. : decode-unit ascii , left-parse-string 2swap decode-int -rot decode-space ;
  68. : decode-string ( pAdr pLen -- pAdr' pLen' str len )
  69. 2dup 0 do dup c@ not if leave then 1+ loop ( pAdr pLen pAdr' )
  70. dup 1+ swap 3 pick - ( pAdr pLen pAdr' StLen )
  71. rot ( pAdr pAdr' StLen pLen ) over - 1- swap -rot 2swap ( pAdr' pLen' str len ) ; \ ++++ 03-05-2000
  72. : creanewvoc ( -- ) base @ hex
  73. voccount @ 1+ voccount !
  74. <# voccount @ 0 # # #
  75. ascii - hold
  76. ascii d hold
  77. ascii o hold
  78. ascii h hold
  79. ascii t hold
  80. ascii e hold
  81. ascii m hold
  82. #> ( Adr Len ) \ over over type
  83. over over tvocabulary
  84. ( also ) evaluate definitions \ Set current Voc
  85. dictlist @ cell+ voclistbase @ - \ Adres of pointer's of latest created vocabulary
  86. nodehandle @nt methvochandle ! \ Store PtrVoc of metod's for this node
  87. base ! ( -- ) ;
  88. : find_end_chain_sibling ( Adr ) begin dup @ while @nt siblinghandle repeat ( Adr ) ;
  89. : creaendnode ( -- )
  90. 0 , \ place child handle
  91. 0 , \ place sibling handle
  92. 0 , \ place property voc handle
  93. 0 , \ place method voc handle
  94. 0 , \ place adress arguments
  95. 0 , \ place adress inst data
  96. 0 , \ place len inst data
  97. 0 , \ place ihandle 1'st instance
  98. ; \ +++
  99. : makenode ( -- ) allignhere ( -- )
  100. here code> creanode ! \ store place for begining area new node
  101. nodehandle @ 0= \ It is 1'st node or not
  102. if
  103. here code> roothandle ! \ store the base of tree
  104. cr ." Root of tree ="
  105. here code> dup . , \ place protohandle
  106. creanode @ , ( ? More correct variant ) \ place parent handle
  107. else
  108. cr ." Leaf of tree ="
  109. here code> dup . dup , \ place protohandle
  110. ." From node ="
  111. nodehandle @nt dup dup code> . ( cr ( here AdrPtrNode PtrNode ) -rot
  112. childhandle dup @ 0<> \ Have child?
  113. if @nt siblinghandle find_end_chain_sibling then
  114. ! \ Store adres of this node as child
  115. code> , \ place parent handle
  116. then creaendnode ( ) ; \ +++
  117. : makeinstnode ( -- ) allignhere ( -- )
  118. here code> creanode ! \ store place for begining area new node
  119. nodehandle @ 0= \ It is 1'st node or not
  120. if abort" Tree are absent !!!"
  121. else
  122. cr ." Instance="
  123. here code> dup . nodehandle @ , \ place protohandle
  124. ." From node="
  125. nodehandle @ dup . >code ( here AdrPtrNode PtrNode )
  126. ihandle find_end_chain_sibling ! \ Store adres of this node as instance
  127. 0 , \ place parent handle
  128. then creaendnode ( ) ; \ +++
  129. : new-device ( -- )
  130. sizedefinst if ( creanode @ cr ." Node=" . )
  131. save-instdata then \ Save inst data
  132. \ forth definitions ( set forth vocabulary as master )
  133. ini-instproc makenode \ Create new node
  134. creanode @ dup nodehandle ! -> my-self \ store last defined node as current
  135. instbase @ creanode @nt adrinstdata ! \ Store adr of area placeing new instance data
  136. creanewvoc ( vocabulary for methods node ) ; \ +++
  137. : ihandle>phandle ( ihandle ) @ ( phandle ) ;
  138. \ Place string in vocabulary
  139. : altovoc ( adr len ) 0 do dup c@ c, 1+ loop drop ( ) ;
  140. \ Place string with her lenght at the begining in vocabulary
  141. : placeinvoc ( adr len HereAdr -- hereVoc )
  142. -rot dup c, ( Here, adr, len ) \ Place len
  143. altovoc ( Here ( Store value in voc ) ; \ +++
  144. : placeproperty ( Padr Plen Nadr Nlen -- Adr )
  145. allignhere here >r ( Padr Plen Nadr Nlen )
  146. nodehandle @nt prophandle @ , \ Place pointer to next property
  147. 2swap swap ( Nadr Nlen Plen Padr )
  148. code> , \ Store ptr to value property
  149. ( 1- ) 1 max , \ Store lenght of property
  150. ( Nadr Nlen ) dup c, altovoc allignhere \ Alligen adress by 4
  151. r> ( PPadr ) ;
  152. \ Create property
  153. : attribute ( Padr, Plen, Nadr, Nlen -- AdrPropRec )
  154. placeproperty ( here ) code> nodehandle @nt prophandle ! ( -- ) ;
  155. : .properties ( -- )
  156. nodehandle @nt prophandle @ ( Phandle ) dup
  157. if ( Phandle )
  158. begin
  159. >code dup ptrvalprop @nt 1+
  160. over ptrlenvalprop @
  161. 2 pick ptrnameprop
  162. count cr type ." =" type
  163. @ dup 0=
  164. until drop
  165. else
  166. drop cr ." No property defined for this node!!!"
  167. then ; \ +++
  168. : next-property ( PreviousStr, PreviousLen, Phandle - Ap Lp T | F )
  169. >code over 0=
  170. if \ Is the first property in list
  171. -rot 2drop ( Phandle ) prophandle @ dup
  172. if \ Get first property name
  173. >code ptrnameprop count
  174. else \ Property list is empty
  175. drop false
  176. then
  177. else \ We must first of all find previous property in list
  178. ( PreviousStr, PreviousLen, Phandle )
  179. prophandle @nt ( PtrPropList )
  180. begin
  181. dup ptrnameprop count ( PtrNextProp, PtrName, Len )
  182. \ Comparing contents
  183. 4 pick 4 pick compare 0= ( 1/0 )
  184. if \ We are finded previous property
  185. ( PreviousStr, PreviousLen, PtrNextProp )
  186. @nt ptrnameprop -rot 2drop
  187. count true exit ( NameStr, NameLen, True )
  188. then
  189. @ dup >code swap 0= ( PreviousStr, PreviousLen, PtrNextProp )
  190. until ( PreviousStr, PreviousLen, PtrNextProp )
  191. drop 2drop false ( F )
  192. then ;
  193. variable PrevPropPtr \ Adres of Ptr current property
  194. : eqpropname? ( Ptrnode -- F|T )
  195. dup >code ptrnameprop count 4 pick 4 pick compare 0= ( F | T ) ; \ +++
  196. : delete-property ( NameStr, NameLen ) stupc
  197. nodehandle @nt ( NameStr, NameLen, Phandle )
  198. prophandle dup code> PrevPropPtr ! @ dup
  199. if \ Property list not empty
  200. eqpropname?
  201. if \ It is deleting property
  202. ( ,,NextPropPtr ) >code @ PrevPropPtr @ ! \ Delete Property
  203. else
  204. begin
  205. ( NameStr, NameLen, NextPropPtr ) >code @ dup
  206. if \ Working with next property
  207. eqpropname?
  208. if \ It is deleting property
  209. ( NameStr, NameLen, PropPtr)
  210. >code @ PrevPropPtr @nt ! True ( NameStr, NameLen, True )
  211. else
  212. dup PrevPropPtr ! false
  213. ( NameStr, NameLen, NextPropPtr, False )
  214. then
  215. else \ Its end of list
  216. drop true
  217. then
  218. until
  219. then
  220. else \ Empty property list
  221. drop
  222. then 2drop \ Drop namestring
  223. ; \ +++
  224. : ptrprop>valprop ( ptrprop ) >code dup ptrvalprop @nt 1+ swap ptrlenvalprop @ ( A L ) ;
  225. : getPhandleProperty ( NameStr, NameLen, Phandle -- Adr Len False | True )
  226. >r stupc r>
  227. >code prophandle ( dup PrevPropPtr ! ) @ dup
  228. if \ Property list not empty
  229. eqpropname?
  230. if \ It is finding property
  231. ( ,,NextPropPtr ) ( ." It's true?" cr )
  232. ptrprop>valprop False
  233. else
  234. begin
  235. ( NameStr, NameLen, NextPropPtr ) >code @ dup
  236. if \ Working with next property
  237. eqpropname?
  238. if \ It is finding property
  239. ( NameStr, NameLen, PropPtr)
  240. ptrprop>valprop False True
  241. ( ValAdr Len False True )
  242. else
  243. ( dup >code PrevPropPtr ! ) false
  244. ( NameStr, NameLen, NextPropPtr, False )
  245. then
  246. else \ Its end of list
  247. true dup dup
  248. then
  249. until
  250. then
  251. else \ Empty property list
  252. true swap true
  253. then
  254. 3 roll drop 3 roll drop ( Adr, Len, 0/1 ) dup
  255. if -rot 2drop \ Drop namestring
  256. then ( Adr Len False | True ) ; \ +++
  257. : get-package-property ( NameStr NameLen Phandle -- Adr Len False | True )
  258. getPhandleProperty ;
  259. : get-my-property ( NameStr, NameLen -- Adr Len False | True )
  260. stupc nodehandle @ ( NameStr, NameLen, Phandle )
  261. getPhandleProperty ( Adr Len False | True ) ; \ +++
  262. : oldplace ( Padr Plen PadrOldV PlenOldV PtrProperty -- AdrPropRec )
  263. 2dup ptrlenvalprop ! \ Story new lenght
  264. >r drop \ Drop old lenght
  265. ( Padr Plen PadrOldV )
  266. over over 1- c! swap move ( -- ) \ Rewrite value of old property
  267. r> ( AdrPropRec ) ;
  268. : newplace ( Padr Plen PadrOldV PlenOldV PtrProperty -- AdrPropRec )
  269. -rot 2drop -rot dup 3 pick ptrlenvalprop ! \ Story new lenght of value property
  270. ( PtrProperty Padr Plen )
  271. here placeinvoc ( PtrProperty Adr )
  272. code> over ptrvalprop ! ( AdrPropRec ) ;
  273. : changevalueproperty ( Padr Plen Nadr Nlen PadrOldV PlenOldV )
  274. \ 4 pick ( ... NewLen ) < if oldplace else newplase then
  275. 2drop ( Padr Plen Nadr Nlen )
  276. nodehandle @nt prophandle @ ( Padr Plen NameStr NameLen Phandle )
  277. begin
  278. eqpropname? not
  279. over >code @ and
  280. while
  281. >code @ \ Go to next proprty
  282. repeat -rot 2drop ( Padr Plen PtrProperty ) dup
  283. if ( Padr Plen PtrProperty )
  284. >code dup -rot ( Padr PtrProperty Plen PtrProperty )
  285. ptrlenvalprop ! swap code> swap ptrvalprop ! ( -- )
  286. else ( Padr Plen PtrProperty )
  287. drop 2drop abort" Error !!! Property not find in list chain"
  288. then ( AdrPropRec ) ;
  289. : property ( Padr, Plen, Nadr, Nlen -- AdrPropRec )
  290. \ cr .s
  291. stupc \ Name to upper registr
  292. \ .s 2dup space type
  293. 2dup get-my-property if attribute else changevalueproperty then ; \ +++
  294. : addproperty property drop ( -- ) ;
  295. : device-name ( A L -- ) ." Name=" 2dup type encode-string s" name" property ; \ +++
  296. : device-type ( A L -- ) encode-string s" device-type" property ; \ +++
  297. : model ( A L -- ) encode-string s" model" property ; \ +++
  298. : set-args ( arg-str, arg-len, reg-str, reg-len )
  299. s" reg" property ( arg-str, arg-len ) \ Story Reg-str i property REG
  300. placeinvoc \ Place arg-ar to voc
  301. ( adrargstr ) my-self >code adrarguments ! ( -- ) ;
  302. : izvlargs ( node ) >code adrarguments @ dup 0<>
  303. if >code count else 0 then ( Adr, Len ) ; \ +
  304. : my-args ( -- ) my-self dup if izvlargs else drop then ( ) ; \ +
  305. : typechainchild ( Pnode )
  306. begin dup while dup . space >code childhandle @ repeat drop ( -- ) ; \ +
  307. : typechainsibl ( Pnode )
  308. begin dup while dup . space >code siblinghandle @ repeat drop ( -- ) ; \ +
  309. c" bvfind" find swap drop not [IF]
  310. : bvfind ( AdrW LenW VocPtr -- XtW 1 | endVoc 0 )
  311. @ ( AdrW LenW LatestTVoc )
  312. begin
  313. dup @ 0<>
  314. if ( AdrW LenW Nfa )
  315. dup count 4 pick 4 pick compare 0=
  316. if ( We find it ! )
  317. false
  318. else
  319. true
  320. then
  321. else
  322. false
  323. then
  324. while
  325. prevname
  326. repeat ( AdrW LenW Nfa )
  327. -rot 2drop dup @ 0<> ( Nfa 1 | endVoc 0 ) swap over
  328. if name> then swap ( XtW 1 | endVoc 0 ) ; [THEN]
  329. : .nm cr ." Words-" dup count type ;
  330. : xtfindinvoc ( Xt LNFAVoc -- Xt )
  331. begin
  332. dup @ 0<>
  333. if
  334. dup cell- @ dup is.primitive?
  335. if
  336. drop true
  337. else
  338. >code
  339. begin
  340. dup @ dup 0<>
  341. if
  342. 3 pick =
  343. if
  344. cr? ?pause drop dup id. tab true false
  345. else
  346. true true
  347. then
  348. else
  349. swap drop ( ,, 0 ) true swap
  350. then
  351. while
  352. drop cell+
  353. repeat
  354. then
  355. else
  356. false
  357. then
  358. while
  359. prevname
  360. repeat ;
  361. \ Show all words that included Xt in own body
  362. : .calls ( xt -- )
  363. dictlist @ swap ( PtrVoc Xt )
  364. begin
  365. over dup @ 0<>
  366. if
  367. dup cell 4 * + cr ." Voc-" id. cr
  368. cell+ @ @ dup @ 0<>
  369. if xtfindinvoc true else drop then
  370. else
  371. false
  372. then
  373. while
  374. drop swap @ swap
  375. repeat drop drop cr ( -- ) ;
  376. : find-method ( MethStr MethLen Phandle -- False | Xt True )
  377. >code methvochandle @ voclistbase @ + @ ( MethStr MethLen Pvoc )
  378. bvfind ( xt true | ptrvoc false )
  379. dup 0= if swap drop then ( False | Xt True ) ;
  380. : $call-method ( MethStr MethLen Phandle -- )
  381. nodehandle @ >r dup nodehandle !
  382. find-method ( False | Xt True )
  383. if execute
  384. else abort" Sorry this method dosn't consist in this node !!!"
  385. then r> nodehandle ! ( ) ;
  386. : headers norealize ;
  387. : 3drop ( i j k -- ) 2drop drop ( ) ;
  388. : 2rot ( 1 2 3 4 5 6 ) 5 roll 5 roll ( 3 4 5 6 1 2 ) ;
  389. : 3rot ( 1 2 3 4 5 6 7 8 ) 7 roll 7 roll ( 3 4 5 6 7 8 1 2 ) ;
  390. : fcode-version2 h# 00020001 ;
  391. : fcode-revision h# 00020001 ;
  392. variable fcode-debug? 0 fcode-debug? ! \ Flag for debuging fcode programm
  393. variable fcode-end
  394. : scsi-selftest norealize ;
  395. : .. .s ( cr ." It dont worked !!!" ) ;
  396. : x+ encode+ ;
  397. : get-buffers here 1000 allot ;
  398. : $open-package norealize ;
  399. : close-package norealize ;
  400. : my-parent ( -- Inode ) my-self >code parenthandle @ ( Inode ) ;
  401. : $call-parent ( Am Lm ) my-parent $call-method ( ??? ) ;
  402. : version norealize ;
  403. : sdc . norealize ;
  404. : external norealize ;
  405. : end0 00 norealize ;
  406. : end1 255 norealize ;
  407. \ For example 3-1
  408. : bounds 10 ;
  409. : #out 20 ;
  410. : l@ @ ;
  411. defer b(:) ( 0xb7 )
  412. decimal
  413. : get-phan-inher-prop ( NameStr NameLen node )
  414. begin
  415. \ s" name" 2 pick get-package-property
  416. \ not if cr ." Node=" type space then
  417. 2 pick 2 pick 2 pick ( NameStr NameLen Inode )
  418. get-package-property ( Adr Len False | True )
  419. dup dup if 2 pick >code parenthandle @ else false then and
  420. while ( NameStr NameLen Inode )
  421. drop >code parenthandle @
  422. repeat
  423. dup if 2drop drop else 2rot 2drop 2swap swap drop -rot then
  424. ( Adr Len False | True ) ; \ ++
  425. : get-inherited-property ( NameStr NameLen -- Adr Len False | True )
  426. my-self ( NameStr NameLen Inode ) get-phan-inher-prop ( Adr Len False | True ) ;
  427. : decode-physadr ( A L -- PhysHi ... PhysLo Aend Lend Size )
  428. s" #address-cells" nodehandle @ get-phan-inher-prop ( Adr Len False | True )
  429. if 1 else decode-int -rot 2drop then ( A L AC ) >r
  430. r@ 0 do decode-int -rot loop
  431. r@ 0 do decode-int -rot loop
  432. r@ 0 do decode-int -rot loop
  433. r> \ For standart variant dup dup + + 1+ dup >r roll r@ roll r> roll
  434. ( PhysHi ... PhysLo Aend Lend Size ) ;
  435. : decode-phys ( A L -- PhysHi ... PhysLo Aend Lend Size )
  436. decode-physadr ( PhysHi ... PhysLo Aend Lend Size )
  437. r> dup dup + + \ 3 *
  438. dup 1+ swap 0 do dup >r roll r> loop drop
  439. ( Aend Lend PhysHi ... PhysLo Size ) ;
  440. : encode-phys ( PhysHi ... PhysLo Size )
  441. s" #address-cells" nodehandle @ get-phan-inher-prop ( Adr Len False | True )
  442. \ br0 decode-int 1 ( N ( Ncells by adress )
  443. if 1 else decode-int -rot 2drop then
  444. 3 * dup >r 1- roll encode-int 2 r> do i roll encode-int encode+ -1 +loop
  445. ( Padr Plen ) ; \ ++
  446. : my-unit ( -- phys.lo .... phys.hi )
  447. s" reg" my-self get-package-property ( Adr Len False | True )
  448. if \ No property "reg" defined
  449. s" #address-cells" my-self get-phan-inher-prop
  450. if 2 else decode-int -rot 2drop then dup
  451. >r 0 do 0 loop r@ 0 do 0 loop r> 0 do 0 loop \ ?????
  452. else ( Adr Len ) decode-physadr drop 2drop ( phys.lo .... phys.hi )
  453. then ( phys.lo .... phys.hi ) ;
  454. \ Convert interrup to CPU inerupt
  455. : intr>cpu ;
  456. : reg ( Phys.lo Phys.hi Size ) >r encode-phys r> encode-int ( A1 L1 A2 L2 )
  457. encode+ ( A L ) s" reg" property ( ) ;
  458. : name ( adr len -- ) encode-string s" name" property ( -- ) ;
  459. : intr ( Level Vector ) >r intr>cpu encode-int r> encode-int encode+
  460. ( adr len ) s" intr" property ( -- ) ;
  461. : mask-lo-part ( phis.lo .... phys.hi ) drop ( phis.lo .... ) ;
  462. : mask-hi-part ( phis.lo .... phys.hi ) >r
  463. s" #address-cells" my-self get-phan-inher-prop ( A L F | T )
  464. if 1 else decode-int -rot 2drop then 1 << ( ( 2 component: LO & HI )
  465. 0 do drop loop r> ( phis.hi ) ;
  466. : my-address ( -- phys.lo ) my-unit mask-lo-part ( phys.lo ) ;
  467. : my-space ( -- phys.hi ) my-unit mask-hi-part ( phys.hi ) ;
  468. : >reg-spec ( offset size -- encodereg )
  469. >r my-address + my-space encode-phys
  470. r> encode-int encode+ ( 2dup type ( A L ) ;
  471. : getnamehandleproperty ( A L A L ) 2drop 2drop norealize
  472. s" 120,400000" ( A L ) ;
  473. : btest ( -- bit ) s" testbit" get-my-property ( A L F|T )
  474. if abort" No define testbit property !!!"
  475. else
  476. decode-int -rot 2drop ( i ) /mod ( i ost n ) 2 <<
  477. s" adrtestbittable" s" /options" getnamehandleproperty
  478. encode-phys + @ swap 1 swap << and ( bit )
  479. then ;