quick memory load test

This commit is contained in:
2023-07-27 22:27:52 -04:00
parent db0838c8f2
commit e227a72ca5

View File

@@ -1,12 +1,43 @@
#include "definitions.asm" #include "definitions.asm"
; testing memory functionality ; testing memory functionality
prog: prog:
imm6 8 imm6 32
load r0, r3 ; aload copies the accumulator to "r6" load r0, r5 ; count
aload
imm6 42 imm6 0
load r0, [r3] ; after aload "r6" = r3 contains the address you want to write load r0, r3 ; start address (by preloading accumulator)
aload ; setup counter for later and skip using the ALU for now, just move to 8
imm6 1 ; stride
load r0, r2
imm6 0
load r0, r1
load r0, r4 ; current
imm6 prog.save
ba
.save_loop:
load r4, r1
.save:
imm6 1
load r0, r2 ; stride
imm6 42 ; value to save
out r0 ; after aload "r6" = r3 contains the address you want to write
add ; r1 (count) - r2 (stride)
load r3, r4 ; save count
imm6 prog.end ; check if we have reached the end of the write operation
load r5, r1
load r4, r2
sub
beqz ; if count - current == 0, branch r0 (prog.end)
load r4, r3 ; restore result from count
aload ; else, load result to address register
imm6 prog.save_loop
ba ; and loop
.end: .end:
.halt: .halt:
halt halt