[HN Gopher] Asmrepl: REPL for x86 Assembly Language
       ___________________________________________________________________
        
       Asmrepl: REPL for x86 Assembly Language
        
       Author : tekkertje
       Score  : 74 points
       Date   : 2021-11-29 20:43 UTC (2 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | jonny_eh wrote:
       | Is this emulating x86? Can I run it on an M1?
        
         | woodruffw wrote:
         | It's not emulating x86: it looks like it's assembling
         | instructions on the fly and executing them in a mmap'd region.
         | In other words, it's a very simple JIT.
         | 
         | But you probably _can_ run it on an M1 anyways, since Apple 's
         | Rosetta will do the dynamic binary translation for you under
         | the hood. YMMV.
        
           | a-dub wrote:
           | would it? rosetta is a jit translator isn't it? how would it
           | know to translate the instructions that are being generated
           | on the fly interactively? unless there's hardware support in
           | the m1 for translation or some other interrupt that gets
           | triggered to do translation on the fly...
        
       | nielsbot wrote:
       | Not snark, but a serious question: What would one use this for?
        
         | sebow wrote:
         | Learning assembly can be a pain, especially without something
         | like gdb (with layout regs &layout asm). This is much simpler
         | and doesn't require you to type like 4-5 extra commands(start
         | gdb, put breakpoint, set layouts, step through the code),thus
         | avoiding the pain that gdb can be for very-simple asm programs.
        
         | unbanned wrote:
         | Education
        
         | woodruffw wrote:
         | I do a lot of program analysis work, and it's occasionally
         | useful to see the pre- and post-machine states of arbitrary
         | instructions. I have my own (more? less?) hacky version of this
         | program that I use for that purpose; I know other people use
         | GEF and similar GDB extensions for similar purposes.
        
         | tenderlove wrote:
         | I wrote it because I can never remember what the `test`
         | instruction does to the zero flag. Every time I use the
         | instruction I have to look up the docs. Looking up docs is
         | fine, but running code in a REPL helps me remember things
         | better.
        
         | qsort wrote:
         | For visually exploring the results of applying instructions.
         | Similar to how you would use jshell.
        
         | 6bfdc1954b8e wrote:
         | Shellcode testing I suppose.
        
       | pavlov wrote:
       | Somebody should wrap this into a VGA-As-A-Service platform so
       | that kids could learn programming the correct way:
       | mov ax, 13h       int 10h
        
         | a-priori wrote:
         | The assembly you've listed there assumes it runs in real mode
         | and ring 0. You'd need to use virtualization of some kind to
         | execute that.
        
           | StillBored wrote:
           | With a BIOS, or CSM on UEFI.
        
           | [deleted]
        
         | zokier wrote:
         | Ducktaping assembler into DOSBox Debugger would be interesting
         | project, it provides almost whole UI otherwise by itself
         | https://zwomp.com/index.php/2020/05/01/understanding-the-dos...
        
           | dcveloper wrote:
           | I recently found some of my old Pascal mode 13h projects from
           | when I was a teenager. Is DOSBox the best way to run those
           | and Turbo Pascal?
        
         | [deleted]
        
       | westurner wrote:
       | This could be implemented with Jupyter notebooks as a Jupyter
       | kernel or maybe with just fancy use of explicitly returned
       | objects that support the (Ruby-like, implicit) IPython.display.
       | display() magic
       | 
       | IRuby is the Jupyter kernel for Rubylang:
       | 
       | iruby/display:
       | https://github.com/SciRuby/iruby/blob/master/lib/iruby/displ...
       | 
       | iruby/formatter:
       | https://github.com/SciRuby/iruby/blob/master/lib/iruby/forma...
       | 
       | More links to how Jupyter kernels and implicit display() and DAP:
       | Debug Adapter Protocol work: "Evcxr: A Rust REPL and Jupyter
       | Kernel" https://news.ycombinator.com/item?id=25923123
        
       | webdoodle wrote:
       | I fondly remember writing my first game using assembly that I
       | hand typed from a magazine article on an Amiga. It didn't work
       | because of a reversed peek/poke. It took us all day to figure it
       | out, but we got it working!
        
       ___________________________________________________________________
       (page generated 2021-11-29 23:00 UTC)