-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbios.h
More file actions
126 lines (106 loc) · 3.15 KB
/
bios.h
File metadata and controls
126 lines (106 loc) · 3.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/**
bios.h - CP/M 2.2 compatible Basic Input / Output System (BIOS)
Copyright (C) 2020 Costin STROIE <costinstroie@eridu.eu.org>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef BIOS_H
#define BIOS_H
#include "Arduino.h"
#include "global.h"
#include "config.h"
#include "i8080.h"
#ifdef SPI_RAM
#include "spiram.h"
typedef SPIRAM RAM;
#else
#include "mcuram.h"
typedef MCURAM RAM;
#endif
#include "drive.h"
struct DPH_t {
union {
struct {
uint16_t xlt; // Address of the logical-to-physical translation vector
uint16_t sp1; // Scratch pad 1
uint16_t sp2; // Scratch pad 2
uint16_t sp3; // Scratch pad 3
uint16_t dbf; // Address of a 128-byte scratch pad area for directory operations
uint16_t dpb; // Address of a disk parameter block for this drive
uint16_t csv; // Address of a 16-byte scratch pad area used for software check for changed disks
uint16_t alv; // Address of a 32-byte scratch pad area for disk storage allocation information
};
uint8_t buf[16];
};
};
struct DPB_t {
union {
struct {
uint16_t spt; // Sectors per track
uint8_t bsh; // Data allocation "Block Shift Factor"
uint8_t blm; // Data allocation Block Mask
uint8_t exm; // Extent Mask
uint16_t dsm; // Total storage capacity of the disk drive
uint16_t drm; // Number of the last directory entry
uint8_t al0; // Allocation 0
uint8_t al1; // Allocation 1
uint16_t cks; // Check area Size
uint16_t off; // Number of system reserved tracks at the beginning of the disk
};
uint8_t buf[16];
};
};
class BIOS {
public:
BIOS(I8080 *cpu, RAM *ram, DRIVE *drv);
~BIOS();
void init();
void call(uint16_t code);
void boot();
void wboot();
uint8_t consts();
uint8_t conin();
void conout();
void conout(uint8_t c);
void list();
void list(uint8_t c);
void punch();
void punch(uint8_t c);
uint8_t reader();
void home();
void seldsk();
void settrk();
void setsec();
void setdma();
uint8_t read();
uint8_t write();
uint8_t listst();
void sectran();
void ioByte(uint8_t iobyte);
void tick();
DPH_t dph;
DPB_t dpb;
private:
I8080 *cpu;
RAM *ram;
DRIVE *drv;
void ledOn();
void ledOff();
void signon();
void gocpm();
uint8_t result;
uint8_t ioCON;
uint8_t ioRDR;
uint8_t ioPUN;
uint8_t ioLST;
uint32_t nextTick;
};
#endif /* BIOS_H */