Nand2Tetris Weird screen behavior

132 views Asked by At

I'm currently taking the nand2tetris course and one assignement was to set the screen color to black when a key is pressed. That's my code, which passes the test script but the screen look like that, which according to other posts on nand2tetris does not look like the normal behavior. screenshot. Any ideas why?

(BEGIN)
    @KBD
    D=M
    @WHITE // go to white if no key is pressed
    D;JEQ
    
    @color
    M=-1
    @WHITEEND
    0;JMP
    
    (WHITE)
        @color
        M=0
    (WHITEEND)
    
    @SCREEN
    D=A
    @n
    M=D
    (LOOP)
        @color
        D=M
        @n
        A=M
        M=D
        
        @n
        M=M+1
        D=M
        
        @KBD
        D=D-A // When n reaches KBD, we reached the end of the screen
        @LOOP
        D;JNE
        

    @BEGIN // restart code
    0;JMP
1

There are 1 answers

10
MadOverlord On BEST ANSWER

Your code appears to run correctly on my Mac running the v2.5 tools. You may have a problem with your Nand2Tetris and/or Java installation or some weird display interaction that is causing the pixels to be displayed with a white border around them.

"Have you tried turning it off and turning it on again?" :)