psw test & emit binary fixes
This commit is contained in:
parent
33358346a3
commit
e207093572
2 changed files with 65 additions and 48 deletions
41
tester-psw.mac
Normal file
41
tester-psw.mac
Normal file
|
@ -0,0 +1,41 @@
|
|||
.EXTERN ALL
|
||||
|
||||
psw_store_retrieve:
|
||||
; set PSW to all bits set
|
||||
MOV #65535,R1
|
||||
MTPS R1
|
||||
; clear PSW status bits
|
||||
CLC
|
||||
CLV
|
||||
CLZ
|
||||
CLN
|
||||
; retrieve PSW and verify the flags are 0
|
||||
MFPS R2
|
||||
|
||||
; clear currently non-relevant psw-bits
|
||||
BIC #240.,R2
|
||||
|
||||
TSTB R2
|
||||
BNE psw_store_retrieve_fail
|
||||
|
||||
RET
|
||||
|
||||
psw_store_retrieve_fail:
|
||||
MOV R2,R0
|
||||
CALL print_binary
|
||||
|
||||
MOV #psw_fail_text, R0
|
||||
CALL print_start
|
||||
RET
|
||||
|
||||
psw_flags_trigger:
|
||||
CLC
|
||||
CLV
|
||||
CLZ
|
||||
CLN
|
||||
|
||||
; TODO
|
||||
|
||||
RET
|
||||
|
||||
psw_fail_text: .ASCII "MFPS / MTPS handling FAIL\r\n\x00"
|
72
tester.mac
72
tester.mac
|
@ -4,11 +4,15 @@
|
|||
; simh> load test.bin
|
||||
; simh> run
|
||||
|
||||
.EXTERN ALL
|
||||
|
||||
; initialize stack pointer
|
||||
start: MOV #1000, R6
|
||||
JMP go
|
||||
|
||||
MOV #textstart, R0
|
||||
.INCLUDE "tester-psw.mac"
|
||||
|
||||
go: MOV #textstart, R0
|
||||
CALL print_start
|
||||
|
||||
CALL psw_store_retrieve
|
||||
|
@ -19,46 +23,6 @@ start: MOV #1000, R6
|
|||
CALL print_start
|
||||
TRAP 7
|
||||
|
||||
psw_store_retrieve:
|
||||
; set PSW to all bits set
|
||||
MOV #65535,R1
|
||||
MTPS R1
|
||||
; clear PSW status bits
|
||||
CLC
|
||||
CLV
|
||||
CLZ
|
||||
CLN
|
||||
; retrieve PSW and verify the flags are 0
|
||||
MFPS R2
|
||||
|
||||
; clear uninteresting flags
|
||||
BIC #4,R2
|
||||
BIC #5,R2
|
||||
BIC #6,R2
|
||||
BIC #7,R2
|
||||
|
||||
TSTB R2
|
||||
BNE psw_store_retrieve_fail
|
||||
|
||||
RET
|
||||
|
||||
psw_store_retrieve_fail:
|
||||
MOV R2,R0
|
||||
CALL print_binary
|
||||
MOV #psw_fail_text, R0
|
||||
CALL print_start
|
||||
RET
|
||||
|
||||
psw_flags_trigger:
|
||||
CLC
|
||||
CLV
|
||||
CLZ
|
||||
CLN
|
||||
|
||||
RET
|
||||
|
||||
psw_fail_text: .ASCII "MFPS / MTPS handling FAIL\r\n\x00"
|
||||
|
||||
; store copy of R0 on the stack
|
||||
print_start: MOV R0,-(SP)
|
||||
; store PSW (status register) on stack
|
||||
|
@ -85,35 +49,47 @@ pdone: MTPS (SP)+
|
|||
RET
|
||||
|
||||
print_binary:
|
||||
MFPS -(SP)
|
||||
MOV R0,-(SP)
|
||||
MOV R1,-(SP)
|
||||
; 8 bits in a byte
|
||||
MOV #8.,R1
|
||||
|
||||
print_bit:
|
||||
BIT #0,R0
|
||||
BEQ print_1:
|
||||
ASLB R0
|
||||
BCS print_1
|
||||
waittx0:
|
||||
TSTB @#TTYST
|
||||
BPL waittx0
|
||||
MOVB #33, @#TTYTX
|
||||
MOVB #48., @#TTYTX
|
||||
BR print_next_bit
|
||||
print_1:
|
||||
waittxt1:
|
||||
waittx1:
|
||||
TSTB @#TTYST
|
||||
BPL waittx1
|
||||
MOVB #34, @#TTYTX
|
||||
MOVB #49., @#TTYTX
|
||||
BR print_next_bit
|
||||
|
||||
print_next_bit:
|
||||
; move R0 contents to the next bit
|
||||
ASR R0
|
||||
; keep track of the number of bits emitted
|
||||
DEC R1
|
||||
TST R1
|
||||
BNE print_bit
|
||||
|
||||
; emit seperator
|
||||
bit_seperator:
|
||||
TSTB @#TTYST
|
||||
BPL bit_seperator
|
||||
MOVB #32., @#TTYTX
|
||||
; for some reason the last character is not printed in simh unless repeated
|
||||
bit_seperator2:
|
||||
TSTB @#TTYST
|
||||
BPL bit_seperator2
|
||||
MOVB #32., @#TTYTX
|
||||
|
||||
MOV (SP)+,R1
|
||||
MOV (SP)+,R0
|
||||
MTPS (SP)+
|
||||
RET
|
||||
|
||||
make_raw
|
||||
|
|
Loading…
Add table
Reference in a new issue