diff --git a/resources/dsa/print.dsa b/resources/dsa/print.dsa new file mode 100644 index 0000000..bd21c84 --- /dev/null +++ b/resources/dsa/print.dsa @@ -0,0 +1,33 @@ +db stack: 0x10000 +db screen: 0x20000 +db string: "Dominos sucks!" +db length: 14 + +cll init +cll start +hlt + +init: + ldw stack, bpr + mov bpr, spr + ret + +start: + ldb length, rg0 + lwi string, rg1 + lwi display, rg2 + +loop: + // read from string and write to display + ldb rg1, rg3, rg4 + stb rg3, rg1, rg4 + + // increment the offset & decrement the loop counter + inc rg4 + dec rg0 + + // if loop counter <= 0 return. + cmp rg0, zero, + jgt loop + ret + diff --git a/src/emulator/system/processor.rs b/src/emulator/system/processor.rs index 77fc1aa..bd5f0a7 100644 --- a/src/emulator/system/processor.rs +++ b/src/emulator/system/processor.rs @@ -216,7 +216,7 @@ impl Executable for Instruction { // Loads a 16-bit literal value into reg, setting the bottom 16 bits of the word. To populate the upper 16 bits, see LUI. Self::LoadLowerImmediate(reg, imm) => { - *cpu.reg(reg) = (cpu.get(reg) & 0xFFFF_0000) | imm as u32; + *cpu.reg(reg) = imm as u32; } // Loads a 16-bit literal value into reg, setting the top 16 bits of the word. To populate the lower 16 bits, see LLI.