diff options
| author | Drahflow <drahflow@gmx.de> | 2014-05-28 00:21:19 +0200 |
|---|---|---|
| committer | Drahflow <drahflow@gmx.de> | 2014-05-28 00:21:19 +0200 |
| commit | 8df51c3d165c9c225e51d502b8816998f25ea2a2 (patch) | |
| tree | 932d37ece575157b33bc33273d6c2218778a447d /samyle/cmdline.ey | |
| parent | 67450c10e3cce51ea1204cee511902c25b725fad (diff) | |
Initial commit.
Diffstat (limited to 'samyle/cmdline.ey')
| -rw-r--r-- | samyle/cmdline.ey | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/samyle/cmdline.ey b/samyle/cmdline.ey new file mode 100644 index 0000000..c2282a2 --- /dev/null +++ b/samyle/cmdline.ey @@ -0,0 +1,56 @@ +< + terminal "$" via + sys .linux "+" via + + "" ==input + + { + "" =input + display + } /init deffd + + { ==k + 0 10 $goto 0 k * txt .produce .u $out + [ + { 0 k * 10 eq } { input execute init } + { 0 k * 127 eq } { 1 neg input str .prefix =input } + { 1 } { input k cat =input } + ] conds + display + } /handle deffd + + { _ ==cmd " " str .split =*args + [ + { cmd len 0 eq } { "No command specified." $err } + { 0 args "q" eq } { 0 =running } + { 0 args "r" eq } { + |args len 2 neq { "Use :r <filename>" $err } { + 1 args "\0" cat +ORDONLY 0 +open ==fd + fd 0 le { "Could not open file" $err } { + fd +fstat -- .size ==size + 0 size +PROTREAD +MAPPRIVATE fd 0 +mmap ==addr + "Loaded at address " addr txt .produce .hu cat $info + + addr locations .cursor .gotoByte + screens .|hexedit screens .enter + } ? * + } ? * + } + { 0 args "e" eq } { + |args len 2 neq { "Use :e <filename.elf>" $err } { + 1 args elf .load + screens .|disasm screens .enter + } ? * + } + { 0 args "d" eq } { screens .|disasm screens .enter } + ] conds + } /execute deffd + + { + 0 25 $goto $clearLine ":" $out input $out + } /display deffd + + { _ "" eq |init |handle ? * } +> -- /cmdline deffd + +# vim: syn=elymas |
