OSDN Git Service

[VM] Apply VM_TEMPLATE to all VMs.
[csp-qt/common_source_project-fm7.git] / source / src / vm / fmtowns / bios.h
1 /*
2         FUJITSU FMR-30 Emulator 'eFMR-30'
3         FUJITSU FMR-50 Emulator 'eFMR-50'
4         FUJITSU FMR-60 Emulator 'eFMR-60'
5
6         Author : Takeda.Toshiya
7         Date   : 2008.10.06 -
8
9         [ bios ]
10 */
11
12 #ifndef _BIOS_H_
13 #define _BIOS_H_
14
15 #include "../vm.h"
16 #include "../../emu.h"
17 #include "../device.h"
18
19 class DISK;
20
21 class BIOS : public DEVICE
22 {
23 private:
24         DEVICE *d_mem, *d_io;
25         DISK *disk[MAX_DRIVE];
26         
27         // pseudo bios
28         uint8_t *cmos, *vram, *cvram;
29 #ifdef _FMR60
30         uint8_t *avram;
31 #else
32         uint8_t *kvram;
33 #endif
34         int secnum, timeout;
35         
36         // disk bios
37         bool access_fdd[MAX_DRIVE], access_scsi;
38         int scsi_blocks[MAX_SCSI];
39         
40 public:
41         BIOS(VM_TEMPLATE* parent_vm, EMU* parent_emu) : DEVICE(parent_vm, parent_emu) {
42                 set_device_name(_T("PSEUDO BIOS"));
43         }
44         ~BIOS() {}
45         
46         // common functions
47         void initialize();
48         void reset();
49         void event_frame();
50         bool bios_call_i86(uint32_t PC, uint16_t regs[], uint16_t sregs[], int32_t* ZeroFlag, int32_t* CarryFlag);
51         bool bios_int_i86(int intnum, uint16_t regs[], uint16_t sregs[], int32_t* ZeroFlag, int32_t* CarryFlag);
52         uint32_t read_signal(int ch);
53         void save_state(FILEIO* state_fio);
54         bool load_state(FILEIO* state_fio);
55         
56         // unique functions
57         void set_context_mem(DEVICE* device)
58         {
59                 d_mem = device;
60         }
61         void set_context_io(DEVICE* device)
62         {
63                 d_io = device;
64         }
65         void set_disk_handler(int drv, DISK* dsk)
66         {
67                 disk[drv] = dsk;
68         }
69         void set_cmos_ptr(uint8_t* ptr)
70         {
71                 cmos = ptr;
72         }
73         void set_vram_ptr(uint8_t* ptr)
74         {
75                 vram = ptr;
76         }
77         void set_cvram_ptr(uint8_t* ptr)
78         {
79                 cvram = ptr;
80         }
81 #ifdef _FMR60
82         void set_avram_ptr(uint8_t* ptr)
83         {
84                 avram = ptr;
85         }
86 #else
87         void set_kvram_ptr(uint8_t* ptr)
88         {
89                 kvram = ptr;
90         }
91 #endif
92 };
93
94 #endif
95