EMULATOR_PDP_11
STEPIC Учебный проект на 'С', эмулятор PDP_11 в стиле ООП
Loading...
Searching...
No Matches
test_byte.c File Reference
#include "tests/test_pdp/test_memory/test_memory_byte/test_memory_byte.h"
#include <assert.h>
#include <stdio.h>
Include dependency graph for test_byte.c:

Functions

void test_rw_byte_b (struct pdp_11_t *pdp)
 
void test_rw_word_b (struct pdp_11_t *pdp)
 
void test_w2b_rword_b (struct pdp_11_t *pdp)
 
void test_wword_r2b_b (struct pdp_11_t *pdp)
 
void test_byte_buffer (struct pdp_11_t *pdp)
 

Function Documentation

◆ test_byte_buffer()

void test_byte_buffer ( struct pdp_11_t pdp)
98{
99 TRACE("\n\r\n\t\t TEST_BYTE\r\n\n", "\n");
100
101 test_rw_byte_b(pdp);
102 test_rw_word_b(pdp);
103 test_w2b_rword_b(pdp);
104 test_wword_r2b_b(pdp);
105}
#define TRACE(fmt,...)
Definition logger.h:39
void test_rw_byte_b(struct pdp_11_t *pdp)
Definition test_byte.c:11
void test_wword_r2b_b(struct pdp_11_t *pdp)
Definition test_byte.c:75
void test_rw_word_b(struct pdp_11_t *pdp)
Definition test_byte.c:31
void test_w2b_rword_b(struct pdp_11_t *pdp)
Definition test_byte.c:53
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_rw_byte_b()

void test_rw_byte_b ( struct pdp_11_t pdp)
12{
13 //пишем байт, читаем байт
14
16 byte_t b0, bres;
17
18 adr = 0;
19 b0 = 0x12;
20
21 DEBUG("\nПишем и читаем байт по четному адресу\r\n", "\n");
22
23 b_write(pdp, adr, b0);
24 bres = b_read(pdp, adr);
25
26 DEBUG("\na = %06o\t b0 = %hhx\t bres = %hhx\r\n", adr, b0, bres);
27 assert(bres == b0);
28}
#define DEBUG(fmt,...)
Definition logger.h:40
byte_t b_read(struct pdp_11_t *, const address_byte_t)
Читает байт из памяти PDP-11.
Definition pdp_11.c:92
void b_write(struct pdp_11_t *, const address_byte_t, byte_t)
Записывает байт в память PDP-11.
Definition pdp_11.c:79
unsigned int address_byte_t
Definition types.h:12
unsigned char byte_t
Definition types.h:6
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_rw_word_b()

void test_rw_word_b ( struct pdp_11_t pdp)
32{
33 // пишем слово, читаем слово.
34
36 word_t w, wres;
37
38 adr = 8;
39 w = 0x3456;
40
41 DEBUG("\nПишем и читаем слово\r\n", "\n");
42
43 w_write(pdp, adr, w);
44 wres = w_read(pdp, adr);
45 if (adr & 1)
46 (adr--);
47
48 DEBUG("\na = %06x\t w = %04x\t wres = %04x\n", adr, w, wres);
49 assert(w == wres);
50}
void w_write(struct pdp_11_t *, const address_word_t, word_t)
Записывает слово (16 бит) в память PDP-11.
Definition pdp_11.c:105
word_t w_read(struct pdp_11_t *, const address_word_t)
Читает слово (16 бит) из памяти PDP-11.
Definition pdp_11.c:118
unsigned short int word_t
Definition types.h:7
unsigned int address_word_t
Definition types.h:11
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_w2b_rword_b()

void test_w2b_rword_b ( struct pdp_11_t pdp)
54{
55 // пишем 2 байта, читаем 1 слов;
57 byte_t b0, b1;
58 word_t w, wres;
59 DEBUG("\nПишем 2 байта, читаем слово\n", "\n");
60 a = 4; // другой адрес
61 w = 0xa1b2;
62 // little-endian, младшие разряды по меньшему адресу
63 b0 = 0xb2;
64 b1 = 0xa1;
65 b_write(pdp, a, b0);
66 b_write(pdp, a + 1, b1);
67 wres = w_read(pdp, a);
68 // тут полезно написать отладочную печать a, w, wres
69 DEBUG("\na=%06o\t b1=%02hhx\t b0=%02hhx\t wres=%04x\n", a, b1, b0, wres);
70 assert(w == wres);
71}
Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_wword_r2b_b()

void test_wword_r2b_b ( struct pdp_11_t pdp)
76{
77
79 byte_t b0, b1, res_b0, res_b1;
80 word_t w;
81 DEBUG("\nПишем слово читаем 2 байта\n", "\n");
82 a = 4; // другой адрес
83 w = 0xa1b2;
84 // little-endian, младшие разряды по меньшему адресу
85 res_b0 = 0xb2;
86 res_b1 = 0xa1;
87 w_write(pdp, a, w);
88 b0 = b_read(pdp, a);
89 b1 = b_read(pdp, a + 1);
90 // тут полезно написать отладочную печать a, w, wres
91 DEBUG("\na=%06o\t b1=%02hhx\t b0=%02hhx\t w=%04x\n", a, b1, b0, w);
92 assert(b1 == res_b1);
93 assert(b0 == res_b0);
94}
Here is the call graph for this function:
Here is the caller graph for this function: