.ORIG x3000 TstAsgn4 LEA R4,CaseArr ST R4,SavePTR TstLoop LDR R0,R4,#0 BRnp x1 HALT PUTS LD R3,TestLoc LDR R5,R4,#1 ADD R5,R5,#-3 ;; R5 now points to test "frame" JSRR R3 ;; Call the test function LDR R3,R5,#3 ;; R3 now has the return value LD R4,SavePTR LDR R5,R4,#2 ;; R5 now has the value that should be returned LEA R0,Bad NOT R5,R5 ;; See if R3 and R5 are equal ADD R5,R5,#1 ADD R3,R3,R5 BRnp x1 LEA R0,Good PUTS ADD R4,R4,#3 ST R4,SavePTR BR TstLoop SavePTR .FILL 0 ;; Location of the code to be tested TestLoc .FILL x3400 Test1 .FILL xBEEF ;; result should go here -- 109 .FILL x39 ;; '9' .FILL #2 ;; 0: '0', 1: '1'-'7', 2: '8'-'9', 3: 'A'-'F' .FILL #10 ;; base .FILL #10 ;; value Test2 .FILL xBEEF ;; result should go here -- 100 .FILL x35 ;; '5' .FILL #1 ;; 0: '0', 1: '1'-'7', 2: '8'-'9', 3: 'A'-'F' .FILL #8 ;; base .FILL #13 ;; value Test3 .FILL xBEEF ;; result should go here -- 255 .FILL x46 ;; 'F' .FILL #3 ;; 0: '0', 1: '1'-'7', 2: '8'-'9', 3: 'A'-'F' .FILL #16 ;; base .FILL #15 ;; value Test4 .FILL xBEEF ;; result should go here -- 255 .FILL x66 ;; 'f' .FILL #3 ;; 0: '0', 1: '1'-'7', 2: '8'-'9', 3: 'A'-'F' .FILL #16 ;; base .FILL #15 ;; value CaseArr .FILL Print1 .FILL Test1 .FILL #109 .FILL Print2 .FILL Test2 .FILL #109 .FILL Print3 .FILL Test3 .FILL #255 .FILL Print4 .FILL Test4 .FILL #255 .FILL 0 Good .STRINGZ "Expected result returned\n\n" Bad .STRINGZ "Result is bad\n\n" Print1 .STRINGZ "Testing with (10,10,2,'9')\nResult should be 109\n\n" Print2 .STRINGZ "Testing with (013,8,1,'5')\nResult should be 0155\n\n" Print3 .STRINGZ "Testing with (0xF,16,3,'F')\nResult should be 0xFF\n\n" Print4 .STRINGZ "Testing with (0xF,16,3,'f')\nResult should be 0xFF\n\n" .END