Permalink
Commits on Apr 29, 2012
  1. Adding a .gitignore

    The inputTests directory should only have 420 files, so we can tell git
    to ignore the .hack files in this subdirectory.
    committed Apr 29, 2012
  2. Another test.

    This sums the numbers from 0 to 100.
    
    It comes out as 5050. This is the correct answer, and the interpreter
    and emulator agree.
    committed Apr 29, 2012
  3. Emulator was incorrect.

    So, I'll be happy to show you the emulator on Tuesday.
    
    It was wrong.
    
    Specifically, the emulator was building a jump structure that looked
    like this:
    
    (jump type target)
    
    and then using the jump target for the comparison. So, if we were
    jumping to line 22 of the code, the JNE was asking if line 22 was zero.
    This, of course, is silly.
    
    I've fixed the structure so it looks like
    
    (jump type value target)
    
    and it asks if the value (which is the result of the computation) is
    zero. In the case of JNE, if it is not equal to zero, the code jumps to
    the target.
    
    This fixed the emulator. It still bears testing, but it seems like our
    problem was in in the emulator, not in the compiler.
    
    Good work on all of you, poor work on me. It was Trent's debugging this
    afternoon that lead me to look more closely, because his tests were not
    that complex, and... seemed like they should be working. That implied to
    me that things were possibly not right somewhere else. (Honestly, I was
    also suspicious of the compiler... we do a lot of shuffling of values.
    However, it may be that *I* was wrong and *y'all* were right.)
    
    Cheers,
    M
    committed Apr 29, 2012
Commits on Apr 28, 2012
  1. Added provide statements and new "driver".

    So, I recmomend using "run-all-three.rkt" for exploration. It is because
    I am too lazy to explore things using multiple tabs...
    
    (all-three "filename.420")
    
    is the way to go.
    
    It will show you the result of running the interpreter on the input
    file, then run the compiler driver, and then run the emulator on the
    resulting assembly.
    
    I created two tests:
    
    if-result-8.420
    if-result-42.420
    
    based on Trent's exploration.
    
    Looking at the assembly from if-result-8.420, it looks... wrong.
    
    @0
    D=A
    @num0
    M=D
    @num0
    D=M
    @TEST13284
    M=D
    @TEST13284
    D=M
    @sym0
    M=D
    @sym0
    D=M
    @FALSE-LABEL13282
    D;JNE
    @8
    D=A
    @num1
    M=D
    @ENDIF-LABEL13283
    0;JMP
    (FALSE-LABEL13282)
    @42
    D=A
    @num2
    M=D
    @ENDIF-LABEL13283
    0;JMP
    (ENDIF-LABEL13283)
    @0
    M=D
    
    Notice how zero is loaded into memory at location @num0. That's OK.
    Then... it loads the location of label @TEST13284, and does something
    with it... and, then shuffles the value located at @sym0 back-=and-forth
    from memory.
    
    I have no idea if we end up with a zero in D when we get to the D;JNE
    instruction.
    
    So, it seems like some focus is needed around that part of the
    expansion. I think. Perhaps.
    
    In other words... Trent, you're on the right track.
    
    M
    committed Apr 28, 2012
Commits on Apr 26, 2012
  1. Adding in a test.

    Should result in 55.
    committed Apr 26, 2012
  2. Fixed the emulator (again).

    We'll get there. I can't remember what I changed.
    committed Apr 26, 2012
  3. I'm not too smart sometimes...

    Loops are hard.
    committed Apr 26, 2012
  4. Fixes.

    Jumps were not quite right. In the case of
    
    0;JMP
    
    I was jumping to zero. Really, the computation should happen and then be
    ignored. (That is, the computation says what the ALU should output, not
    where it should go.) Hence, the 0 just means "emit a zero from the ALU,
    and don't store it." The JMP is an unconditional jump to the contents of
    the A register.
    
    Hence, this should do the trick.
    committed Apr 26, 2012
  5. Moving my two tests.

    committed Apr 26, 2012
  6. Moving the emulator here.

    committed Apr 26, 2012
  7. Interpreter is probably working...

    This is not yet "tested."
    
    What I've done is work through the ten.hack code, updating the
    emulator with better debugging, and (along the way) doing things that I
    know need doing to make the code more robust/work. Put another way,
    there were one or two things that were clearly naive and/or wrong, which
    I've fixed.
    
    I'll now try some specific tests, and see if JNE is working correctly. I
    believe, though, that the ASM is laid out incorrectly at this point. So,
    it will be time to revisit the code tomorrow and see what comes.
    committed Apr 26, 2012
Commits on Apr 25, 2012
  1. We fixed the bugs... maybe.

    It compiles, but is it right?
    
    Is the emulator wrong?
    
    The world may never know... to be continued...
    committed Apr 25, 2012
  2. Committing my changes.

    committed Apr 25, 2012
  3. removing gensyms

    Molly Mattis committed Apr 25, 2012
  4. A driver and interpreter.

    But, das compiler is broken.
    committed Apr 25, 2012
  5. fixed once again

    thehumancompiler committed Apr 25, 2012
  6. fixed provide statement

    thehumancompiler committed Apr 25, 2012
  7. Merge branch 'master' of github.com:jadudm/eocs-assembler

    Conflicts:
    	swigls-compiler/compiled/drracket/errortrace/base_rkt.zo
    	swigls-compiler/remove-if.rkt
    thehumancompiler committed Apr 25, 2012
  8. Merge branch 'master' of github.com:jadudm/eocs-assembler

    Conflicts:
    	swigls-compiler/compiled/drracket/errortrace/base_rkt.zo
    thehumancompiler committed Apr 25, 2012
  9. Merge branch 'master' of github.com:jadudm/eocs-assembler

    Conflicts:
    	swigls-compiler/compiled/drracket/errortrace/base_rkt.dep
    	swigls-compiler/compiled/drracket/errortrace/base_rkt.zo
    BenchPressesBooks committed Apr 25, 2012
  10. adding forgoten provides

    Zachary Williams committed Apr 25, 2012
  11. Merge branch 'master' of github.com:jadudm/eocs-assembler

    Zachary Williams committed Apr 25, 2012
  12. adding testing files, both the expressions to be tested and what the …

    …assembly should be
    Molly Mattis committed Apr 25, 2012
Commits on Apr 24, 2012
  1. changed the jump struct in 'base.rkt' to include a destination field

    changed 'remove-if.rkt' to reflect the added destination field
    thehumancompiler committed Apr 24, 2012