KEK/tester-tst.mac
folkert van heusden 9ebb1aa0c9 TST test
2022-03-14 20:01:24 +01:00

66 lines
877 B
Text

.EXTERN ALL
test_tst:
MOV #what_tst,R0
CALL print_start
test_tst_1:
; initialize flags
MOV #15.,R0
MTPS R0
; test TST when value is 0
MOV #0,R1
TST R1
; retrieve flags
MFPS R2
; mask off upper bits of byte
BIC #65520.,R2
CMP #4.,R2
BEQ test_tst_1_ok
MOV #1.,R0
JMP test_tst_fail
test_tst_1_ok:
test_tst_2:
; initialize flags
MOV #15.,R0
MTPS R0
; test TST when value is !0
MOV #32768.,R1
TST R1
; retrieve flags
MFPS R2
; mask off upper bits of byte
BIC #65520.,R2
CMP #8.,R2
BEQ test_tst_2_ok
MOV #2.,R0
JMP test_tst_fail
test_tst_2_ok:
RET
test_tst_fail:
; print test number
CALL print_binary
; flags are always (for this tester) in R2
MOV R2,R0
CALL print_binary
MOV #test_tst_fail_txt,R0
CALL print_start
RET
test_tst_fail_txt:
.ASCII "TST handling FAIL\r\n\x00"
what_tst:
.ASCII "TST test\r\n\x00"
.EVEN