add program and cpu opcode defs added

This commit is contained in:
2023-07-27 07:54:43 -04:00
commit dc905691d9
2 changed files with 90 additions and 0 deletions

26
add.asm Normal file
View File

@@ -0,0 +1,26 @@
#include "definitions.asm"
; program adds 5 to the input and puts
; the sum on the output, no carry
prog:
imm6 0 ; start at 0
load r0, r1
imm6 prog.add ; load address to add5 and branch
ba
.add:
imm6 0x01 ; edit this imm value to change count-by value
load r0, r2
add ; r1 + 0x05 = r3
load r3, r4 ; save result in r4
load r3, r2
imm6 0x32
load r0, r1
sub ; 50 - result = r3
imm6 prog.result
beqz ; PC = R0 if R3 = 0
load r4, r1 ; add5(result)
imm6 prog.add
ba
.result:
out r4
.hcf:
hcf