http://www.nand2tetris.org/lectures/PDF/lecture%2005%20computer%20architecture.pdf
So, you have 256 rows each 1 pixel thick.
You have 32 columns each 16 bits thick, or 512 columns, each 1 pixel thick.
So, to set pixel at x,y where x,y within (0-511, 0-255) :
Set (black) the y % 16 bit of the word addressed by Screen[ x*32 + y/16]
where Screen[X] implies memory address 16384 + X.
Saturday, March 11, 2017
Friday, March 10, 2017
Nand2Tetris Hack Language Min Function
Make a more efficient mult:)
// finds min of R0 and R1 and stores the result in R2.
// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)
// how : start off assuming R0 is smaller. Then, subtract R1 from R0 and, if
// result is > 0 => R1 is smaller, put R1 in R2.
@R0
D=M
@R2
M=D // until we find that R1 is smaller
@R1
D=M
@R0
M=M-D // we have R0 - R1
@R0 // if > 0, then we need to put R1 in R2
D=M
@R1SMALLER
D, JGT // if R1 is smaller than R0, this will be > 0 ..
@END
0, JMP // else, we're done
(R1SMALLER)
@R1
D=M
@R2
M=D
(END)
@END
0, JMP
// finds min of R0 and R1 and stores the result in R2.
// (R0, R1, R2 refer to RAM[0], RAM[1], and RAM[2], respectively.)
// how : start off assuming R0 is smaller. Then, subtract R1 from R0 and, if
// result is > 0 => R1 is smaller, put R1 in R2.
@R0
D=M
@R2
M=D // until we find that R1 is smaller
@R1
D=M
@R0
M=M-D // we have R0 - R1
@R0 // if > 0, then we need to put R1 in R2
D=M
@R1SMALLER
D, JGT // if R1 is smaller than R0, this will be > 0 ..
@END
0, JMP // else, we're done
(R1SMALLER)
@R1
D=M
@R2
M=D
(END)
@END
0, JMP
nand2tetris Hilf Help Shimon!
I load a program into the CPU emulator and nothing happens.
Might need to drag the lower right corners south-east a little to see the status line - you'll probably see a message there. Why the hell they don't have a View > Parser Log through the Menu just beats me. But hey, it's free :)
I do
@LOOP
JMP
and it doesn't like it. Ya, coz you HAVE to supply the core part of a C (compute) instruction always - only the jump and destination are optional. So, in this case, just do
0, JMP
Might need to drag the lower right corners south-east a little to see the status line - you'll probably see a message there. Why the hell they don't have a View > Parser Log through the Menu just beats me. But hey, it's free :)
I do
@LOOP
JMP
and it doesn't like it. Ya, coz you HAVE to supply the core part of a C (compute) instruction always - only the jump and destination are optional. So, in this case, just do
0, JMP
Sunday, July 3, 2016
Better nand2tetris. Please Shimon. Please Yaron.
In script ... illegal terminator '}' -- when your code doesn't even contain that character on that line. This happens when you run the HDLsimulator from the command line and give it an HDL file rather than a test script.
Why not provide an intelligent error message - ATLO perl saying ". Missing semicolon on previous line?" You get the idea..
Also, support for underscores would be nice. Duh :)
Why not provide an intelligent error message - ATLO perl saying "
Also, support for underscores would be nice. Duh :)
Sunday, June 5, 2016
Saturday, April 23, 2016
Qualcomm Snapdragon Boot Android
Can you use a bluetooth mouse/keyboard combo? Yes - something like the Logitech MK700/M705 work fine.
Do you *have* to use a true HDMI cable (no HDMI/VGA adapter allowed)? Yes (I know, shame on Q - R-Pi can do this)
Do you *have* to use a true HDMI cable (no HDMI/VGA adapter allowed)? Yes (I know, shame on Q - R-Pi can do this)
Subscribe to:
Posts (Atom)