Author: wmb Date: 2007-09-30 20:03:33 +0200 (Sun, 30 Sep 2007) New Revision: 655
Modified: cpu/x86/build/builder.dic cpu/x86/disassem.fth forth/lib/util.fth Log: Fixed address calculation bug in disassembler (16-bit mode only), made dis16 and dis32 appear in the forth vocabulary, add "mib" and "kib" for convenience.
Modified: cpu/x86/build/builder.dic =================================================================== (Binary files differ)
Modified: cpu/x86/disassem.fth =================================================================== --- cpu/x86/disassem.fth 2007-09-29 20:03:38 UTC (rev 654) +++ cpu/x86/disassem.fth 2007-09-30 18:03:33 UTC (rev 655) @@ -21,11 +21,14 @@ : op16@ ( -- w ) op8@ op8@ bwjoin ; : op32@ ( -- l ) op16@ op16@ wljoin ;
+: bext ( b -- l ) d# 24 << d# 24 >>a ; +: wext ( w -- l ) d# 16 << d# 16 >>a ; + \ change size of data true value op32? : opv@ ( -- l | w ) op32? if op32@ else op16@ then ; true value ad32? -: adv@ ( -- l | w ) ad32? if op32@ else op16@ then ; +: adv@ ( -- l | w ) ad32? if op32@ else op16@ wext then ; : dis16 ( -- ) false is op32? false is ad32? ; : dis32 ( -- ) true is op32? true is ad32? ; \ XXX We should also change the register names e.g. from "eax" to "ax" @@ -42,9 +45,6 @@ : midbits ( -- n ) 3 3 ibits ; : hibits ( -- n ) 6 2 ibits ;
-: bext ( b -- l ) d# 24 << d# 24 >>a ; -: wext ( w -- l ) d# 16 << d# 16 >>a ; - hex
: ., ( -- ) ." ," ; @@ -594,6 +594,8 @@ alias pc!dis1 pc!dis1 alias +dis +dis alias dis dis +alias dis16 dis16 +alias dis32 dis32
previous previous previous definitions \ LICENSE_BEGIN
Modified: forth/lib/util.fth =================================================================== --- forth/lib/util.fth 2007-09-29 20:03:38 UTC (rev 654) +++ forth/lib/util.fth 2007-09-30 18:03:33 UTC (rev 655) @@ -72,6 +72,9 @@ : bits ( n bit# #bits -- bits ) -rot rshift swap lowbits ; : bit ( n bit# -- ) 1 bits ;
+: kib ( n -- nkib ) d# 10 lshift ; \ Convert to kilobytes +: mib ( n -- nmib ) d# 20 lshift ; \ Convert to megabytes + : log2 ( n -- log2-of-n ) 0 begin ( n log ) swap 2/ ( log n' )