Author: stepan Date: 2009-11-20 17:37:41 +0100 (Fri, 20 Nov 2009) New Revision: 620
Modified: trunk/openbios-devel/forth/lib/64bit.fs trunk/openbios-devel/kernel/cross.h Log: improve x@ and x! functions, at least x@?\194?\160reads back what x! wrote, now.
Modified: trunk/openbios-devel/forth/lib/64bit.fs =================================================================== --- trunk/openbios-devel/forth/lib/64bit.fs 2009-11-20 15:58:55 UTC (rev 619) +++ trunk/openbios-devel/forth/lib/64bit.fs 2009-11-20 16:37:41 UTC (rev 620) @@ -20,6 +20,10 @@ then ;
+: 64>32 ( 64bitsigned -- 32bitsigned ) + h# ffffffff and +; + : lxjoin ( quad.lo quad.hi -- o ) d# 32 lshift or ; @@ -37,12 +41,12 @@ ;
: unaligned-x@ ( addr - o ) - dup la+ unaligned-l@ swap unaligned-l@ lxjoin + dup la1+ unaligned-l@ 64>32 swap unaligned-l@ 64>32 lxjoin ;
-: unaligned-x! ( oaddr o -- ) - 2dup d# 32 rshift unaligned-l! - swap la+ swap h# ffffffff and unaligned-l! +: unaligned-x! ( o oaddr -- ) + >r dup d# 32 rshift r@ unaligned-l! + h# ffffffff and r> la1+ unaligned-l! ;
: x@ ( oaddr -- o )
Modified: trunk/openbios-devel/kernel/cross.h =================================================================== --- trunk/openbios-devel/kernel/cross.h 2009-11-20 15:58:55 UTC (rev 619) +++ trunk/openbios-devel/kernel/cross.h 2009-11-20 16:37:41 UTC (rev 620) @@ -77,11 +77,11 @@ (unaligned_read_word(addr)|(unaligned_read_word((u8 *)addr+2)<<16))
#define unaligned_write_word(addr, value) \ - write_byte(addr, value & 0xff); write_byte((u8 *)addr+1, value>>8) + write_byte(addr, (value & 0xff)); write_byte((u8 *)(addr+1), (value>>8))
#define unaligned_write_long(addr, value) \ - unaligned_write_word(addr, value & 0xffff); \ - unaligned_write_word(addr + 2, value >> 16) + unaligned_write_word(addr, (value & 0xffff)); \ + unaligned_write_word((addr + 2), (value >> 16))
#endif
@@ -93,11 +93,11 @@ ((unaligned_read_word(addr)<<16)|unaligned_read_word((u8 *)addr+2))
#define unaligned_write_word(addr, value) \ - write_byte(addr, value >> 8); write_byte((u8 *)addr+1, value & 0xff) + write_byte(addr, (value >> 8)); write_byte((u8 *)(addr+1), (value & 0xff))
#define unaligned_write_long(addr, value) \ - unaligned_write_word(addr, value >> 16); \ - unaligned_write_word(addr + 2, value & 0xffff) + unaligned_write_word(addr, (value >> 16)); \ + unaligned_write_word((addr + 2), (value & 0xffff)) #endif
/* bit width handling */