aboutsummaryrefslogtreecommitdiff
path: root/samyle/utils.ey
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2014-05-28 00:21:19 +0200
committerDrahflow <drahflow@gmx.de>2014-05-28 00:21:19 +0200
commit8df51c3d165c9c225e51d502b8816998f25ea2a2 (patch)
tree932d37ece575157b33bc33273d6c2218778a447d /samyle/utils.ey
parent67450c10e3cce51ea1204cee511902c25b725fad (diff)
Initial commit.
Diffstat (limited to 'samyle/utils.ey')
-rw-r--r--samyle/utils.ey39
1 files changed, 39 insertions, 0 deletions
diff --git a/samyle/utils.ey b/samyle/utils.ey
new file mode 100644
index 0000000..d0d5f32
--- /dev/null
+++ b/samyle/utils.ey
@@ -0,0 +1,39 @@
+<
+ sys .linux "+" via
+
+ ".crap\0" +OWRONLY +OCREAT bor +OTRUNC bor 342 +open ==CRAPFILE
+
+ { ==addr
+ CRAPFILE addr 1 +write ==err
+
+ err 0 le { # EFAULT -> address not mapped
+ 1 neg
+ } {
+ addr sys .asm .peek
+ } ? *
+ } '0.0 /memory deffd
+
+ <
+ { # ==addr
+ 0 2 range add memory
+ _ 1 neg eq any { -- ??io.invalid } { 256 math .unbase } ? *
+ } /u16 deffd
+
+ { # ==addr
+ 0 4 range add memory
+ _ 1 neg eq any { -- ??io.invalid } { 256 math .unbase } ? *
+ } /u32 deffd
+
+ { # ==addr
+ 0 8 range add memory
+ _ 1 neg eq any { -- ??io.invalid } { 256 math .unbase } ? *
+ } /u64 deffd
+ > /readMemory defvd
+
+ # CRAPFILE +close
+
+ { _ 16 div -01 16 mod "0123456789ABCDEF" [ -031*21* ] str .fromArray } '0.0 /toHex deffd
+ { _ 1 neg eq { -- "--" } |toHex ? * } '0.0 /toHexSave deffd
+> /utils defvd
+
+# vim: syn=elymas