On Fri, Aug 21, 2015 at 5:12 PM, tim Rowledge <tim@rowledge.org> wrote:


On 21-08-2015, at 4:58 PM, Chris Cunningham <cunningham.cb@gmail.com> wrote:
> Yes.  I had loaded the VMMaker to look at the ARM jit code (I'm working on an ARM simulator - fun project),

Do tell...

A colleague ran across
http://gedrap.github.io/xs-vm/
and coded it in his language, and challenged me to do it in Squeak as well.  So I did.  And was then inspired to take it further and visualize what was going in the CPU while it was happening.

The ASM isn't really finished, nor is the viewer, but it will handle a variety of aSM code listings I've seen for learning ARM ASM.  What I have now parses the code into objects, and will then simulate running the code, and showing the 'state' of the CPU while running, like:
Inline image 1
It's not really ready to announce yet, but if you are interested, it is at:
MCHttpRepository
location: 'http://www.smalltalkhub.com/mc/cbc/ARMAssembler/main'
user: ''
password: ''
load both XS-ArmAsmVm and Armvm viewer.

Use:
vm := XSVM new.
"GCD via Euclid"
vm assemble: '        MOV R0, #40      ; R0 is a
        MOV R1, #25      ; R1 is b
again   CMP R0, R1
        SUBGT R0, R0, R1
        SUBLT R1, R1, R0
        BNE again
halt    SWI #0'

vm view.
vm prepForStep.
vm step. "once for each instruction step, or vm run to just run until end"

My current struggle is to remember (or re-learn) how registers handle carry and overflow, and how to get Squeak to simulate that.  It's a little challenging with just Integers.

-cbc