2 \
Copyright (C) 2009 Stefan Reinauer
4 \
See the file
"COPYING" for further information about
5 \
the copyright and warranty status
of this
work.
8 \
Implementation of IEEE Draft Std P1275.6
/D5
9 \
Standard for Boot (Initialization Configuration) Firmware
13 cell
/x
= constant
64bit?
17 : 32>64 ( 32bitsigned -- 64bitsigned )
18 dup
80000000 and if \ is
it negative
?
19 ffffffff00000000
or \
then set
all high bits
23 : 64>32 ( 64bitsigned -- 32bitsigned )
27 : lxjoin
( quad
.lo quad
.hi
-- o
)
31 : wxjoin
( w
.lo w
.2 w
.3 w
.hi
-- o
)
32 wljoin
>r wljoin r
> lxjoin
35 : bxjoin
( b
.lo b
.2 b
.3 b
.4 b
.5 b
.6 b
.7 b
.hi
-- o
)
36 bljoin
>r bljoin r
> lxjoin
43 : unaligned
-x
@ ( addr
- o
)
44 dup la1
+ unaligned
-l
@ 64>32 swap unaligned
-l
@ 64>32 lxjoin
47 : unaligned
-x
! ( o oaddr
-- )
48 >r dup d
# 32 rshift r@ unaligned-l!
49 h
# ffffffff and r> la1+ unaligned-l!
53 unaligned
-x
@ \
for now
57 unaligned
-x
! \
for now
64 : (rx
!) ( o oaddr
-- )
76 : xa
+ ( addr1 index
-- addr2
)
80 : xa1
+ ( addr1
-- addr2
)
84 : xlsplit
( o
-- quad
.lo quad
.hi
)
85 dup h
# ffffffff and swap d# 32 rshift
88 : xwsplit
( o
-- w
.lo w
.2 w
.3 w
.hi
)
89 xlsplit
>r lwsplit
r> lwsplit
92 : xbsplit
( o
-- b
.lo b
.2 b
.3 b
.4 b
.5 b
.6 b
.7 b
.hi
)
93 xlsplit
>r lbsplit
r> lbsplit
96 : xlflip
( oct1
-- oct2
)
100 : xlflips
( oaddr len
-- )
102 i unaligned
-x@ xlflip i unaligned
-x!
106 : xwflip
( oct1
-- oct2
)
107 xlsplit
lwflip swap lwflip lxjoin
110 : xwflips
( oaddr len
-- )
112 i unaligned
-x@ xwflip i unaligned
-x! /x
116 : xbflip
( oct1
-- oct2
)
117 xlsplit
lbflip swap lbflip lxjoin
120 : xbflips
( oaddr len
-- )
122 i unaligned
-x@ xbflip i unaligned
-x!
126 \
: b
(lit
) b
(lit
) 32>64 ;