KEK/tests/tester-mov.mac
folkert van heusden 1e5fa1b9ec tests
2022-03-20 11:52:42 +01:00

66 lines
901 B
Text

.EXTERN ALL
test_mov:
MOV #what_mov,R0
CALL print_start
; test if flags are set when moving value
; clear N, Z, set V and C
MOV #3,R0
MTPS R0
MOV #0,R0
; get flag-register
MFPS R1
; mask off upper bits of byte
BIC #65520.,R1
; only Z and CARRY must be set
CMP #5.,R1
BEQ test_mov_t1_ok
; test 1 failed
MOV #1.,R0
JMP test_mov_fail
test_mov_t1_ok:
test_mov_t2:
; clear all flags
MOV #0,R0
MTPS R0
MOV #32768.,R0
; get flag-register
MFPS R1
; mask off upper bits of byte
BIC #65520.,R1
; only N must be set
CMPB #8.,R1
BEQ test_mov_t2_ok
; test 2 failed
MOV #2.,R0
JMP test_mov_fail
test_mov_t2_ok:
RET
test_mov_fail:
; print test number
CALL print_binary
; flags are always in R1
MOV R1,R0
CALL print_binary
MOV #test_mov_fail_txt,R0
CALL print_start
RET
test_mov_fail_txt:
.ASCII "MOV handling FAIL\r\n\x00"
what_mov:
.ASCII "MOV flag test\r\n\x00"
.EVEN