7. Finite State Machine in a Nutshell
• Next state is a func
tion of current stat
e and input, mapp
ed by state transfe
r function.
• Processor is a finit
e state machine.
9. Main Components
• RAM – Holds instructions and longer term data
• Register – Storage to do arithmetic/ store pointers
• ALU – circuit that carries out all arithmetic operations
• PC – program counter that points to instruction to be d
one.
• BUS – Communication between components (terminal
etc)
10. Basic Processor Instructions
• Load to register
• Write to address
• Arithmetic
• Compare->was result of arithmetic 0? gt 0 ? lt
0?
• Jump – Modify PC value -> functions are acco
mplished using this.
13. Plain Text
; Ikuru K
; Simple iteration example
; Writes the character to the terminal stored in register A
; (Number in register C) times.
;intended for use on http://schweigi.github.io/assembler-simulator/
JMP start
start:
MOV A, 100; write ascii value of character to be printed here
MOV C, 11 ; write x here
MOV D, 232 ; Point to output
CALL print_x_times
HLT ; Stop execution
print_x_times:
INC C;offsetting.
.print_loop:
MOV [D], A ;Print character to be written
DEC C;Updating the counter
INC D;Each charactor slot is mapped to a different location
CMP C,0;Done?
JNZ .print_loop;Continue if not done
RET;