- Inventory what is here
- Implement the
CPU
constructor - Add RAM functions
ram_read()
andram_write()
- Implement the core of
run()
- Implement the
HLT
instruction handler - Add the
LDI
instruction - Add the
PRN
instruction
- Un-hardcode the machine code
- Implement the
load()
function to load an.ls8
file given the filename passed in as an argument - Implement a Multiply instruction (run
mult8.ls8
)
- Implement the System Stack and be able to run the
stack.ls8
program
- Implement the CALL and RET instructions
- Implement Subroutine Calls and be able to run the
call.ls8
program
- Add the
CMP
instruction andequal
flag to your LS-8. - Add the
JMP
instruction. - Add the
JEQ
andJNE
instructions.
-
When is the ALU activated in the CPU?
ALU is activated when logic based arithmetic operations are called.
-
Why is the purpose of a CPU stack?
-
Temporary storage of variables. Suppose we want to store the values of some variables. Since there are a limited number of registers, we can push their values on to a stack, re-use those registers to store those variable values, then pop them off the stack when done.
-
Store the return address of a subroutine. Suppose CALL is called. The program executes that part of the code until RET is reached. At RET, the program resumes to what it was doing before CALL. We can store this return address in the CPU stack.
-
Store registers and CPU state to handle interrupt. When there is an interrupt, like a keyboard interrupt, that part of the program runs. After the interrupt ends and the program is to be resumed, we can restore the entire CPU state such as registers, flags, etc. from the CPU stack.
-
Store subroutine local variables. Same as #1
-
-
Convert 01010110 to Decimal:
0101 = (0 * 2^3) + (1 * 2^2) + (0 * 2^1) + (1 * 2^0) = 5
0110 = (0 * 2^3) + (1 * 2^2) + (1 * 2^1) + (0 * 2^0) = 6
Thus, 56
-
Convert 10100011 to Hexadecimal:
1010 = (1 * 2^3) + (0 * 2^2) + (1 * 2^1) + (0 * 2^0) = 10 = A
0011 = (0 * 2^3) + (0 * 2^2) + (1 * 2^1) + (1 * 2^0) = 3
Thus, A3
- Add the ALU operations:
AND
OR
XOR
NOT
SHL
SHR
MOD
- Add an
ADDI
extension instruction to add an immediate value to a register - Add timer interrupts
- Add keyboard interrupts
- Write an LS-8 assembly program to draw a curved histogram on the screen