This commit is contained in:
folkert van heusden 2022-03-20 11:52:42 +01:00
parent 7eec8c3520
commit 1e5fa1b9ec
21 changed files with 300 additions and 1 deletions

View file

@ -746,7 +746,7 @@ bool cpu::single_operand_instructions(const uint16_t instr)
uint16_t t = b -> read(a, word_mode);
bool new_carry = false;
uint16_t temp;
uint16_t temp = 0;
if (word_mode) {
new_carry = t & 0x80;
temp = ((t << 1) | getPSW_c()) & 0xff;

50
tests/test.mac Normal file
View file

@ -0,0 +1,50 @@
; in simh:
; simh> set console telnet=3333
; then invoke telnet to port 3333 on the simh systm
; simh> load test.bin
; simh> run
; initialize stack pointer
start: MOV #1000, R6
; store pointer to text in R0
loop: MOV #text, R0
CALL printstart
JMP loop
; store copy of R0 on the stack
printstart: MOV R0,-(SP)
; store PSW (status register) on stack
MOV R1,-(SP)
MFPS R1
MOV R1,-(SP)
; string ends with 0x00
print: TSTB (R0)
BEQ pdone
; put character in tty buffer
MOVB (R0), @#TTYTX
; wait for it to be transmitted
waittx: TSTB @#TTYST
BPL waittx
INC R0
JMP print
; retrieve stored r0, r1 and psw from stack
pdone: MOV (SP)+,R1
MTPS R1
MOV (SP)+,R1
MOV (SP)+,R0
RET
make_raw
text: .ASCII "test\r\n\x00"
TTYST = 177564
TTYTX = 177566

33
tests/test1.mac Normal file
View file

@ -0,0 +1,33 @@
label: CLC
MOV #0.,R0
ASR R0 ;
NOP
CLC
MOV #0,R1
ASRB R1 ;
NOP
CLC
MOV #117400,R2
ASR R2 ;
NOP
CLC
MOV #117400,R3
ASRB R3 ;
NOP
CLC
MOV #77776,R4
ASR R4 ;
NOP
CLC
MOV #77776,R5
ASRB R5 ;
NOP
HALT
make_raw

33
tests/test1l.mac Normal file
View file

@ -0,0 +1,33 @@
label: CLC
MOV #0.,R0
ASL R0 ;
NOP
CLC
MOV #0,R1
ASLB R1 ;
NOP
CLC
MOV #117400,R2
ASL R2 ;
NOP
CLC
MOV #117400,R3
ASLB R3 ;
NOP
CLC
MOV #77776,R4
ASL R4 ;
NOP
CLC
MOV #77776,R5
ASLB R5 ;
NOP
HALT
make_raw

16
tests/test2.mac Normal file
View file

@ -0,0 +1,16 @@
mov #1000,SP
mov #trapfunc, @#034
traploop: SEC
SEN
SEV
TRAP 0
JMP traploop
trapfunc:
NOP
NOP
RTT
make_raw

33
tests/test3.mac Normal file
View file

@ -0,0 +1,33 @@
label: SEC
MOV #0.,R0
ROR R0 ;
NOP
SEC
MOV #0,R1
RORB R1 ;
NOP
SEC
MOV #117400,R2
ROR R2 ;
NOP
SEC
MOV #117400,R3
RORB R3 ;
NOP
SEC
MOV #1,R4
ROR R4 ;
NOP
SEC
MOV #1,R5
RORB R5 ;
NOP
HALT
make_raw

33
tests/test3l.mac Normal file
View file

@ -0,0 +1,33 @@
label: SEC
MOV #0.,R0
ROL R0 ;
NOP
SEC
MOV #0,R1
ROLB R1 ;
NOP
SEC
MOV #117400,R2
ROL R2 ;
NOP
SEC
MOV #117400,R3
ROLB R3 ;
NOP
SEC
MOV #1,R4
ROL R4 ;
NOP
SEC
MOV #1,R5
ROLB R5 ;
NOP
HALT
make_raw

27
tests/test4.mac Normal file
View file

@ -0,0 +1,27 @@
label: MOV #0.,R0
NEG R0 ; 0
NOP
MOV #0,R1
NEGB R1 ; 0
NOP
MOV #117400,R2
NEG R2 ; 060400
NOP
MOV #117400,R3
NEGB R3 ; 117400
NOP
MOV #1,R4
NEG R4 ; 177777
NOP
MOV #1,R5
NEGB R5 ; 000377
NOP
HALT
make_raw

19
tests/test5.mac Normal file
View file

@ -0,0 +1,19 @@
label: MOV #0.,R0
INC R0
NOP
MOV #0,R1
INCB R1
NOP
MOV #117400,R2
INC R2
NOP
MOV #117400,R3
INCB R3
NOP
HALT
make_raw

19
tests/test5d.mac Normal file
View file

@ -0,0 +1,19 @@
label: MOV #0.,R0
DEC R0
NOP
MOV #0,R1
DECB R1
NOP
MOV #117400,R2
DEC R2
NOP
MOV #117400,R3
DECB R3
NOP
HALT
make_raw

19
tests/test6.mac Normal file
View file

@ -0,0 +1,19 @@
label: MOV #0.,R0
COM R0 ; 65535
NOP
MOV #0,R1
COMB R1 ; 255
NOP
MOV #117400,R2
COM R2 ; 24831
NOP
MOV #117400,R3
COMB R3 ; 40959
NOP
HALT
make_raw

8
tests/test7.mac Normal file
View file

@ -0,0 +1,8 @@
label: MOV #2000,SP
NOP
INC SP
NOP
DEC SP
NOP
make_raw

5
tests/test8.mac Normal file
View file

@ -0,0 +1,5 @@
NOP
label: .DW 077700
NOP
make_raw

4
tests/test9.mac Normal file
View file

@ -0,0 +1,4 @@
.DW 072527
.DW 000000
make_raw