新的测试用例:

// Test all instructions of TEC-8 model computer

// Initial values
00: 00 00  // Load accumulator with 0
01: 00 00  // Load index register with 0
02: 00 01  // Load memory location 0 with 1
03: 00 02  // Load memory location 1 with 2
04: 00 03  // Load memory location 2 with 3
05: 00 04  // Load memory location 3 with 4
06: 00 05  // Load memory location 4 with 5
07: 00 06  // Load memory location 5 with 6
08: 00 07  // Load memory location 6 with 7
09: 00 08  // Load memory location 7 with 8
0A: 00 09  // Load memory location 8 with 9
0B: 00 0A  // Load memory location 9 with 10
0C: 00 0B  // Load memory location A with 11
0D: 00 0C  // Load memory location B with 12
0E: 00 0D  // Load memory location C with 13
0F: 00 0E  // Load memory location D with 14

// Test instructions
10: 1A 00  // STA 0    (Store accumulator at memory location 0)
11: 1B 01  // STA 1    (Store accumulator at memory location 1)
12: 1C 02  // STA 2    (Store accumulator at memory location 2)
13: 1D 03  // STA 3    (Store accumulator at memory location 3)
14: 1E 04  // STA 4    (Store accumulator at memory location 4)
15: 1F 05  // STA 5    (Store accumulator at memory location 5)
16: 20 06  // STA 6    (Store accumulator at memory location 6)
17: 21 07  // STA 7    (Store accumulator at memory location 7)
18: 22 08  // STA 8    (Store accumulator at memory location 8)
19: 23 09  // STA 9    (Store accumulator at memory location 9)
1A: 24 0A  // STA A    (Store accumulator at memory location A)
1B: 25 0B  // STA B    (Store accumulator at memory location B)
1C: 26 0C  // STA C    (Store accumulator at memory location C)
1D: 27 0D  // STA D    (Store accumulator at memory location D)

1E: 2A 00  // LDA 0    (Load accumulator from memory location 0)
1F: 2B 01  // LDA 1    (Load accumulator from memory location 1)
20: 2C 02  // LDA 2    (Load accumulator from memory location 2)
21: 2D 03  // LDA 3    (Load accumulator from memory location 3)
22: 2E 04  // LDA 4    (Load accumulator from memory location 4)
23: 2F 05  // LDA 5    (Load accumulator from memory location 5)
24: 30 06  // LDA 6    (Load accumulator from memory location 6)
25: 31 07  // LDA 7    (Load accumulator from memory location 7)
26: 32 08  // LDA 8    (Load accumulator from memory location 8)
27: 33 09  // LDA 9    (Load accumulator from memory location 9)
28: 34 0A  // LDA A    (Load accumulator from memory location A)
29: 35 0B  // LDA B    (Load accumulator from memory location B)
2A: 36 0C  // LDA C    (Load accumulator from memory location C)
2B: 37 0D  // LDA D    (Load accumulator from memory location D)

2C: 4A 00  // ADD 0    (Add memory location 0 to accumulator)
2D: 4B 01  // ADD 1    (Add memory location 1 to accumulator)
2E: 4C 02  // ADD 2    (Add memory location 2 to accumulator)
2F: 4D 03  // ADD 3    (Add memory location 3 to accumulator)
30: 4E 04  // ADD 4    (Add memory location 4 to accumulator)
31: 4F 05  // ADD 5    (Add memory location 5 to accumulator)
32: 50 06  // ADD 6    (Add memory location 6 to accumulator)
33: 51 07  // ADD 7    (Add memory location 7 to accumulator)
34: 52 08  // ADD 8    (Add memory location 8 to accumulator)
35: 53 09  // ADD 9    (Add memory location 9 to accumulator)
36: 54 0A  // ADD A    (Add memory location A to accumulator)
37: 55 0B  // ADD B    (Add memory location B to accumulator)
38: 56 0C  // ADD C    (Add memory location C to accumulator)
39: 57 0D  // ADD D    (Add memory location D to accumulator)

3A: 7A 00  // JMP 0    (Jump to memory location 0)
3B: 7B 01  // JMP 1    (Jump to memory location 1)
3C: 7C 02  // JMP 2    (Jump to memory location 2)
3D: 7D 03  // JMP 3    (Jump to memory location 3)
3E: 7E 04  // JMP 4    (Jump to memory location 4)
3F: 7F 05  // JMP 5    (Jump to memory location 5)
40: 80 06  // JMP 6    (Jump to memory location 6)
41: 81 07  // JMP 7    (Jump to memory location 7)
42: 82 08  // JMP 8    (Jump to memory location 8)
43: 83 09  // JMP 9    (Jump to memory location 9)
44: 84 0A  // JMP A    (Jump to memory location A)
45: 85 0B  // JMP B    (Jump to memory location B)
46: 86 0C  // JMP C    (Jump to memory location C)
47: 87 0D  // JMP D    (Jump to memory location D)

48: 9A 00  // JZ 0     (Jump to memory location 0 if accumulator is 0)
49: 9B 01  // JZ 1     (Jump to memory location 1 if accumulator is 0)
4A: 9C 02  // JZ 2     (Jump to memory location 2 if accumulator is 0)
4B: 9D 03  // JZ 3     (Jump to memory location 3 if accumulator is 0)
4C: 9E 04  // JZ 4     (Jump to memory location 4 if accumulator is 0)
4D: 9F 05  // JZ 5     (Jump to memory location 5 if accumulator is 0)
4E: A0 06  // JZ 6     (Jump to memory location 6 if accumulator is 0)
4F: A1 07  // JZ 7     (Jump to memory location 7 if accumulator is 0)
50: A2 08  // JZ 8     (Jump to memory location 8 if accumulator is 0)
51: A3 09  // JZ 9     (Jump to memory location 9 if accumulator is 0)
52: A4 0A  // JZ A     (Jump to memory location A if accumulator is 0)
53: A5 0B  // JZ B     (Jump to memory location B if accumulator is 0)
54: A6 0C  // JZ C     (Jump to memory location C if accumulator is 0)
55: A7 0D  // JZ D     (Jump to memory location D if accumulator is 0)

56: BA 00  // JC 0     (Jump to memory location 0 if carry flag is set)
57: BB 01  // JC 1     (Jump to memory location 1 if carry flag is set)
58: BC 02  // JC 2     (Jump to memory location 2 if carry flag is set)
59: BD 03  // JC 3     (Jump to memory location 3 if carry flag is set)
5A: BE 04  // JC 4     (Jump to memory location 4 if carry flag is set)
5B: BF 05  // JC 5     (Jump to memory location 5 if carry flag is set)
5C: C0 06  // JC 6     (Jump to memory location 6 if carry flag is set)
5D: C1 07  // JC 7     (Jump to memory location 7 if carry flag is set)
5E: C2 08  // JC 8     (Jump to memory location 8 if carry flag is set)
5F: C3 09  // JC 9     (Jump to memory location 9 if carry flag is set)
60: C4 0A  // JC A     (Jump to memory location A if carry flag is set)
61: C5 0B  // JC B     (Jump to memory location B if carry flag is set)
62: C6 0C  // JC C     (Jump to memory location C if carry flag is set)
63: C7 0D  // JC D     (Jump to memory location D if carry flag is set)

64: DA 00  // JNZ 0    (Jump to memory location 0 if accumulator is not 0)
65: DB 01  // JNZ 1    (Jump to memory location 1 if accumulator is not 0)
66: DC 02  // JNZ 2    (Jump to memory location 2 if accumulator is not 0)
67: DD 03  // JNZ 3    (Jump to memory location 3 if accumulator is not 0)
68: DE 04  // JNZ 4    (Jump to memory location 4 if accumulator is not 0)
69: DF 05  // JNZ 5    (Jump to memory location 5 if accumulator is not 0)
6A: E0 06  // JNZ 6    (Jump to memory location 6 if accumulator is not 0)
6B: E1 07  // JNZ 7    (Jump to memory location 7 if accumulator is not 0)
6C: E2 08  // JNZ 8    (Jump to memory location 8 if accumulator is not 0)
6D: E3 09  // JNZ 9    (Jump to memory location 9 if accumulator is not 0)
6E: E4 0A  // JNZ A    (Jump to memory location A if accumulator is not 0)
6F: E5 0B  // JNZ B    (Jump to memory location B if accumulator is not 0)
70: E6 0C  // JNZ C    (Jump to memory location C if accumulator is not 0)
71: E7 0D  // JNZ D    (Jump to memory location D if accumulator is not 0)

72: FA 00  // JNC 0    (Jump to memory location 0 if carry flag is not set)
73: FB 01  // JNC 1    (Jump to memory location 1 if carry flag is not set)
74: FC 02  // JNC 2    (Jump to memory location 2 if carry flag is not set)
75: FD 03  // JNC 3    (Jump to memory location 3 if carry flag is not set)
76: FE 04  // JNC 4    (Jump to memory location 4 if carry flag is not set)
77: FF 05  // JNC 5    (Jump to memory location 5 if carry flag is not set)
78: 00 07  // JNC 6    (Jump to memory location 6 if carry flag is not set)
79: 01 08  // JNC 7    (Jump to memory location 7 if carry flag is not set)
7A: 02 09  // JNC 8    (Jump to memory location 8 if carry flag is not set)
7B: 03 0A  // JNC 9    (Jump to memory location 9 if carry flag is not set)
7C: 04 0B  // JNC A    (Jump to memory location A if carry flag is not set)
7D: 05 0C  // JNC B    (Jump to memory location B if carry flag is not set)
7E: 06 0D  // JNC C    (Jump to memory location C if carry flag is not set)
7F: 07 00  // JNC D    (Jump to memory location D if carry flag is not set)

80: CA 00  // CMP 0    (Compare memory location 0 with accumulator)
81: CB 01  // CMP 1    (Compare memory location 1 with accumulator)
82: CC 02  // CMP 2    (Compare memory location 2 with accumulator)
83: CD 03  // CMP 3    (Compare memory location 3 with accumulator)
84: CE 04  // CMP 4    (Compare memory location 4 with accumulator)
85: CF 05  // CMP 5    (Compare memory location 5 with accumulator)
86: D0 06  // CMP 6    (Compare memory location 6 with accumulator)
87: D1 07  // CMP 7    (Compare memory location 7 with accumulator)
88: D2 08  // CMP 8    (Compare memory location 8 with accumulator)
89: D3 09  // CMP 9    (Compare memory location 9 with accumulator)
8A: D4 0A  // CMP A    (Compare memory location A with accumulator)
8B: D5 0B  // CMP B    (Compare memory location B with accumulator)
8C: D6 0C  // CMP C    (Compare memory location C with accumulator)
8D: D7 0D  // CMP D    (Compare memory location D with accumulator)

8E: EA FF  // HLT      (Halt)

// Data
8F: 00 00  // Unused
90: 00 00  // Unused
91: 00 00  // Unused
92: 00 00  // Unused
93: 00 00  // Unused
94: 00 00  // Unused
95: 00 00  // Unused
96: 00 00  // Unused
97: 00 00  // Unused
98: 00 00  // Unused
99: 00 00  // Unused
9A: 00 00  // Unused
9B: 00 00  // Unused
9C: 00 00  // Unused
9D: 00 00  // Unused
9E: 00 00  // Unused
9F: 00 00  // Unused
A0: 00 00  // Unused
A1: 00 00  // Unused
A2: 00 00  // Unused
A3: 00 00  // Unused
A4: 00 00  // Unused
A5: 00 00  // Unused
A6: 00 00  // Unused
A7: 00 00  // Unused
A8: 00 00  // Unused
A9: 00 00  // Unused
AA: 00 00  // Unused
AB: 00 00  // Unused
AC: 00 00  // Unused
AD: 00 00  // Unused
AE: 00 00  // Unused
AF: 00 00  // Unused
B0: 00 00  // Unused
B1: 00 00  // Unused
B2: 00 00  // Unused
B3: 00 00  // Unused
B4: 00 00  // Unused
B5: 00 00  // Unused
B6: 00 00  // Unused
B7: 00 00  // Unused
B8: 00 00  // Unused
B9: 00 00  // Unused
BA: 00 00  // Unused
BB: 00 00  // Unused
BC: 00 00  // Unused
BD: 00 00  // Unused
BE: 00 00  // Unused
BF: 00 00  // Unused
C0: 00 00  // Unused
C1: 00 00  // Unused
C2: 00 00  // Unused
C3: 00 00  // Unused
C4: 00 00  // Unused
C5: 00 00  // Unused
C6: 00 00  // Unused
C7: 00 00  // Unused
C8: 00 00  // Unused
C9: 00 00  // Unused
CA: 00 00  // Unused
CB: 00 00  // Unused
CC: 00 00  // Unused
CD: 00 00  // Unused
CE: 00 00  // Unused
CF: 00 00  // Unused
D0: 00 00  // Unused
D1: 00 00  // Unused
D2: 00 00  // Unused
D3: 00 00  // Unused
D4: 00 00  // Unused
全面测试TEC-8模型计算机的功能是需要把所有指令都包括近来的。请你尝试写出一个新的测试用例说明其初始值并利用这一个测试程序对TEC-8模型计算机进行全面测试。

原文地址: https://www.cveoy.top/t/topic/fHqU 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录