test flags when doing mov
This commit is contained in:
parent
1b527c8c38
commit
d140590a06
2 changed files with 69 additions and 0 deletions
66
tester-mov.mac
Normal file
66
tester-mov.mac
Normal file
|
@ -0,0 +1,66 @@
|
|||
.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 4 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 4 bits of byte
|
||||
BIC #240.,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
|
|
@ -13,6 +13,7 @@ start: MOV #1000, R6
|
|||
.INCLUDE "tester-psw.mac"
|
||||
.INCLUDE "tester-adc-sbc.mac"
|
||||
.INCLUDE "tester-addressing.mac"
|
||||
.INCLUDE "tester-mov.mac"
|
||||
|
||||
go: MOV #textstart, R0
|
||||
CALL print_start
|
||||
|
@ -27,6 +28,8 @@ go: MOV #textstart, R0
|
|||
|
||||
CALL test_addr
|
||||
|
||||
CALL test_mov
|
||||
|
||||
MOV #textfin, R0
|
||||
CALL print_start
|
||||
TRAP 7
|
||||
|
|
Loading…
Add table
Reference in a new issue