TST test
This commit is contained in:
parent
d140590a06
commit
9ebb1aa0c9
3 changed files with 72 additions and 3 deletions
|
@ -13,7 +13,7 @@ test_mov:
|
|||
MOV #0,R0
|
||||
; get flag-register
|
||||
MFPS R1
|
||||
; mask off upper 4 bits of byte
|
||||
; mask off upper bits of byte
|
||||
BIC #65520.,R1
|
||||
; only Z and CARRY must be set
|
||||
CMP #5.,R1
|
||||
|
@ -31,8 +31,8 @@ test_mov_t2:
|
|||
MOV #32768.,R0
|
||||
; get flag-register
|
||||
MFPS R1
|
||||
; mask off upper 4 bits of byte
|
||||
BIC #240.,R1
|
||||
; mask off upper bits of byte
|
||||
BIC #65520.,R1
|
||||
; only N must be set
|
||||
CMPB #8.,R1
|
||||
BEQ test_mov_t2_ok
|
||||
|
|
66
tester-tst.mac
Normal file
66
tester-tst.mac
Normal file
|
@ -0,0 +1,66 @@
|
|||
.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
|
|
@ -14,6 +14,7 @@ start: MOV #1000, R6
|
|||
.INCLUDE "tester-adc-sbc.mac"
|
||||
.INCLUDE "tester-addressing.mac"
|
||||
.INCLUDE "tester-mov.mac"
|
||||
.INCLUDE "tester-tst.mac"
|
||||
|
||||
go: MOV #textstart, R0
|
||||
CALL print_start
|
||||
|
@ -30,6 +31,8 @@ go: MOV #textstart, R0
|
|||
|
||||
CALL test_mov
|
||||
|
||||
CALL test_tst
|
||||
|
||||
MOV #textfin, R0
|
||||
CALL print_start
|
||||
TRAP 7
|
||||
|
|
Loading…
Add table
Reference in a new issue