[mweeks@gsuad.gsu.edu@snowball ~]$ cat example2.s # example2.s # # java -jar /home/mweeks/rars1_6.jar example2.s # # This movie 2001 A Space Odyssey features a computer called "HAL". # What do you get when you add 1 to each character code? This program # does that. # # -MCW, 2025 .text main: # Use s0 since it is "saved" # load the first char value into x1 la s0, mychars lb x1, 0(s0) # add 1 to it addi x1, x1, 1 # print it out as a char mv a0, x1 li a7, 11 ecall # print space li a7, 11 li a0, 32 ecall ############################## # REPEAT with small change ############################## # load the next char value into x1 lb x1, 1(s0) # add 1 to it addi x1, x1, 1 # print it out as a char mv a0, x1 li a7, 11 ecall # print space li a7, 11 li a0, 32 ecall ############################## # REPEAT with small changes ############################## # load the next char value into x1 lb x1, 2(s0) # add 1 to it addi x1, x1, 1 # print it out as a char mv a0, x1 li a7, 11 ecall # print NL li a7, 11 li a0, 10 ecall # Exit the program with a return code li a7, 93 li a0, 0 # 0 for everything is OK ecall .data mychars: .string "HAL" [mweeks@gsuad.gsu.edu@snowball ~]$ cat example2_Venus.S # example2_Venus.s # # Use VSCode/Venus for this # # This movie 2001 A Space Odyssey features a computer called "HAL". # What do you get when you add 1 to each character code? This program # does that. # # -MCW, 2025 .text main: # Use s0 since it is "saved" # load the first char value into x1 la s0, mychars lb x1, 0(s0) # add 1 to it addi x1, x1, 1 # print it out as a char #mv a0, x1 #li a7, 11 mv a1, x1 li a0, 11 ecall # print space #li a7, 11 #li a0, 32 li a0, 11 li a1, 32 ecall ############################## # REPEAT with small change ############################## # load the next char value into x1 lb x1, 1(s0) # add 1 to it addi x1, x1, 1 # print it out as a char #mv a0, x1 #li a7, 11 mv a1, x1 li a0, 11 ecall # print space #li a7, 11 #li a0, 32 li a0, 11 li a1, 32 ecall ############################## # REPEAT with small changes ############################## # load the next char value into x1 lb x1, 2(s0) # add 1 to it addi x1, x1, 1 # print it out as a char #mv a0, x1 #li a7, 11 mv a1, x1 li a0, 11 ecall # print NL #li a7, 11 #li a0, 10 li a0, 11 li a1, 10 ecall # Exit the program with a return code #li a7, 93 #li a0, 0 # 0 for everything is OK li a0, 17 li a1, 0 # 0 for everything is OK ecall .data mychars: .string "HAL" [mweeks@gsuad.gsu.edu@snowball ~]$ diff example2.s example2_Venus.S 1c1 < # example2.s --- > # example2_Venus.s 3c3 < # java -jar /home/mweeks/rars1_6.jar example2.s --- > # Use VSCode/Venus for this 23,24c23,26 < mv a0, x1 < li a7, 11 --- > #mv a0, x1 > #li a7, 11 > mv a1, x1 > li a0, 11 28,29c30,33 < li a7, 11 < li a0, 32 --- > #li a7, 11 > #li a0, 32 > li a0, 11 > li a1, 32 43,44c47,50 < mv a0, x1 < li a7, 11 --- > #mv a0, x1 > #li a7, 11 > mv a1, x1 > li a0, 11 48,49c54,57 < li a7, 11 < li a0, 32 --- > #li a7, 11 > #li a0, 32 > li a0, 11 > li a1, 32 63,64c71,74 < mv a0, x1 < li a7, 11 --- > #mv a0, x1 > #li a7, 11 > mv a1, x1 > li a0, 11 68,69c78,81 < li a7, 11 < li a0, 10 --- > #li a7, 11 > #li a0, 10 > li a0, 11 > li a1, 10 75,76c87,90 < li a7, 93 < li a0, 0 # 0 for everything is OK --- > #li a7, 93 > #li a0, 0 # 0 for everything is OK > li a0, 17 > li a1, 0 # 0 for everything is OK [mweeks@gsuad.gsu.edu@snowball ~]$