OSDN Git Service

0fb76817b1c0f62ef305cb443dd3e856f2c39727
[csp-qt/common_source_project-fm7.git] / source / src / vm / pc98ha / bios.cpp
1 /*
2         NEC PC-98LT Emulator 'ePC-98LT'
3         NEC PC-98HA Emulator 'eHANDY98'
4
5         Author : Takeda.Toshiya
6         Date   : 2010.05.12 -
7
8         [ bios ]
9 */
10
11 #include "bios.h"
12 #include "../upd765a.h"
13 #include "../disk.h"
14
15 // regs
16 #define AL      regs8[0]
17 #define AH      regs8[1]
18
19 bool BIOS::bios_int_i86(int intnum, uint16_t regs[], uint16_t sregs[], int32_t* ZeroFlag, int32_t* CarryFlag)
20 {
21         static const int check_cmds[16] = {1, 1, 1, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 1, 0, 0};
22         uint8_t *regs8 = (uint8_t *)regs;
23         
24         if(intnum == 0x1b && check_cmds[AH & 0x0f]) {
25                 switch(AL & 0xf0) {
26                 case 0x10:
27                 case 0x70:
28                         // 2DD
29                         if(d_fdc->is_disk_inserted(AL & 0x03) && d_fdc->get_media_type(AL & 0x03) != MEDIA_TYPE_2DD) {
30                                 AH = 0xe0;
31                                 *CarryFlag = 1;
32                                 return true;
33                         }
34                         break;
35                 case 0x90:
36                 case 0xf0:
37                         // 2HD
38                         if(d_fdc->is_disk_inserted(AL & 0x03) && d_fdc->get_media_type(AL & 0x03) != MEDIA_TYPE_2HD) {
39                                 AH = 0xe0;
40                                 *CarryFlag = 1;
41                                 return true;
42                         }
43                         break;
44                 }
45         }
46         return false;
47 }