ReactOS 0.4.16-dev-334-g4d9f67c
machpc98.c File Reference
#include <freeldr.h>
#include <debug.h>
Include dependency graph for machpc98.c:

Go to the source code of this file.

Functions

 DBG_DEFAULT_CHANNEL (HWDETECT)
 
VOID Pc98GetExtendedBIOSData (PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
 
VOID Pc98HwIdle (VOID)
 
VOID Pc98PrepareForReactOS (VOID)
 
ULONG Pc98GetBootSectorLoadAddress (IN UCHAR DriveNumber)
 
VOID __cdecl ChainLoadBiosBootSectorCode (IN UCHAR BootDrive OPTIONAL, IN ULONG BootPartition OPTIONAL)
 
static BOOLEAN Pc98ArchTest (VOID)
 
VOID MachInit (const char *CmdLine)
 

Variables

BOOLEAN HiResoMachine
 

Function Documentation

◆ ChainLoadBiosBootSectorCode()

VOID __cdecl ChainLoadBiosBootSectorCode ( IN UCHAR BootDrive  OPTIONAL,
IN ULONG BootPartition  OPTIONAL 
)

Definition at line 69 of file machpc98.c.

72{
73 REGS Regs;
74 PPC98_DISK_DRIVE DiskDrive;
75 USHORT LoadAddress;
76 UCHAR DriveNumber = BootDrive ? BootDrive : FrldrBootDrive;
77
78 DiskDrive = Pc98DiskDriveNumberToDrive(DriveNumber);
79 if (!DiskDrive)
80 {
81 ERR("Failed to get drive 0x%x\n", DriveNumber);
82 return;
83 }
84
85 LoadAddress = (USHORT)(Pc98GetBootSectorLoadAddress(DriveNumber) >> 4);
86
87 RtlZeroMemory(&Regs, sizeof(Regs));
88 Regs.w.ax = DiskDrive->DaUa;
89 Regs.w.si = LoadAddress;
90 Regs.w.es = LoadAddress;
91 *(PUCHAR)MEM_DISK_BOOT = DiskDrive->DaUa;
92
94
95 Relocator16Boot(&Regs,
96 /* Stack segment:pointer */
97 0x0020, 0x00FF,
98 /* Code segment:pointer */
99 LoadAddress, 0x0000);
100}
#define ERR(fmt,...)
Definition: precomp.h:57
#define ATTR(cFore, cBack)
Definition: ui.h:317
#define COLOR_WHITE
Definition: ui.h:338
#define COLOR_BLACK
Definition: ui.h:322
ULONG Pc98GetBootSectorLoadAddress(IN UCHAR DriveNumber)
Definition: machpc98.c:44
#define MEM_DISK_BOOT
Definition: machpc98.h:44
PPC98_DISK_DRIVE Pc98DiskDriveNumberToDrive(IN UCHAR DriveNumber)
Definition: pc98disk.c:141
VOID Pc98VideoClearScreen(UCHAR Attr)
Definition: pc98video.c:167
VOID __cdecl Relocator16Boot(IN REGS *In, IN USHORT StackSegment, IN USHORT StackPointer, IN USHORT CodeSegment, IN USHORT CodePointer)
unsigned short USHORT
Definition: pedump.c:61
unsigned short si
Definition: pcbios.h:116
unsigned short es
Definition: pcbios.h:121
unsigned short ax
Definition: pcbios.h:111
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262
unsigned char * PUCHAR
Definition: typedefs.h:53
UCHAR FrldrBootDrive
Definition: uefidisk.c:47
Definition: pcbios.h:159
WORDREGS w
Definition: pcbios.h:162
unsigned char UCHAR
Definition: xmlstorage.h:181

◆ DBG_DEFAULT_CHANNEL()

DBG_DEFAULT_CHANNEL ( HWDETECT  )

◆ MachInit()

VOID MachInit ( const char CmdLine)

Definition at line 117 of file machpc98.c.

118{
119 if (!Pc98ArchTest())
120 {
121 ERR("This is not a supported PC98!\n");
122
123 /* Disable and halt the CPU */
124 _disable();
125 __halt();
126
127 while (TRUE)
128 NOTHING;
129 }
130
131 /* Setup vtbl */
161
163
166}
MACHVTBL MachVtbl
Definition: arcemul.c:21
#define TRUE
Definition: types.h:120
#define NOTHING
Definition: input_list.c:10
void __cdecl _disable(void)
Definition: intrin_arm.h:365
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1714
VOID Pc98HwIdle(VOID)
Definition: machpc98.c:29
VOID Pc98GetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machpc98.c:22
static BOOLEAN Pc98ArchTest(VOID)
Definition: machpc98.c:103
BOOLEAN HiResoMachine
Definition: machpc98.c:17
VOID Pc98PrepareForReactOS(VOID)
Definition: machpc98.c:35
#define HIGH_RESOLUTION_FLAG
Definition: machpc98.h:37
#define MEM_BIOS_FLAG1
Definition: machpc98.h:35
VOID Pc98Beep(VOID)
Definition: pc98beep.c:10
BOOLEAN Pc98ConsKbHit(VOID)
Definition: pc98cons.c:64
VOID Pc98ConsPutChar(int Ch)
Definition: pc98cons.c:25
int Pc98ConsGetCh(VOID)
Definition: pc98cons.c:85
ULONG Pc98DiskGetCacheableBlockCount(UCHAR DriveNumber)
Definition: pc98disk.c:887
BOOLEAN Pc98InitializeBootDevices(VOID)
Definition: pc98disk.c:721
BOOLEAN Pc98DiskReadLogicalSectors(IN UCHAR DriveNumber, IN ULONGLONG SectorNumber, IN ULONG SectorCount, OUT PVOID Buffer)
Definition: pc98disk.c:838
BOOLEAN Pc98DiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pc98disk.c:871
PCONFIGURATION_COMPONENT_DATA Pc98HwDetect(_In_opt_ PCSTR Options)
Definition: pc98hw.c:1183
UCHAR Pc98GetFloppyCount(VOID)
Definition: pc98hw.c:1214
PFREELDR_MEMORY_DESCRIPTOR Pc98MemGetMemoryMap(ULONG *MemoryMapSize)
Definition: pc98mem.c:48
TIMEINFO * Pc98GetTime(VOID)
Definition: pc98rtc.c:13
VOID Pc98VideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: pc98video.c:195
BOOLEAN Pc98VideoIsPaletteFixed(VOID)
Definition: pc98video.c:399
ULONG Pc98VideoGetBufferSize(VOID)
Definition: pc98video.c:203
VOID Pc98VideoInit(VOID)
Definition: pc98video.c:69
VOID Pc98VideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: pc98video.c:209
VOID Pc98VideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: pc98video.c:215
VOID Pc98VideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: pc98video.c:316
VIDEODISPLAYMODE Pc98VideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init)
Definition: pc98video.c:188
VOID Pc98VideoHideShowTextCursor(BOOLEAN Show)
Definition: pc98video.c:228
VOID Pc98VideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: pc98video.c:417
VOID Pc98VideoSync(VOID)
Definition: pc98video.c:435
VOID Pc98VideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: pc98video.c:383
VOID Pc98VideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: pc98video.c:405
VOID HalpCalibrateStallExecution(VOID)
Definition: pchw.c:105
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:56
VOID(* GetExtendedBIOSData)(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machine.h:64
int(* ConsGetCh)(VOID)
Definition: machine.h:43
VOID(* PrepareForReactOS)(VOID)
Definition: machine.h:59
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:55
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:76
VOID(* VideoCopyOffScreenBufferToVRAM)(PVOID Buffer)
Definition: machine.h:53
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:51
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:72
UCHAR(* GetFloppyCount)(VOID)
Definition: machine.h:66
BOOLEAN(* DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
Definition: machine.h:68
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:67
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:63
VOID(* VideoGetFontsFromFirmware)(PULONG RomFontPointers)
Definition: machine.h:49
VOID(* Beep)(VOID)
Definition: machine.h:58
VOID(* VideoSetTextCursorPosition)(UCHAR X, UCHAR Y)
Definition: machine.h:50
ULONG(* VideoGetBufferSize)(VOID)
Definition: machine.h:48
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:52
ULONG(* DiskGetCacheableBlockCount)(UCHAR DriveNumber)
Definition: machine.h:69
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
VOID(* HwIdle)(VOID)
Definition: machine.h:78
VOID(* VideoSync)(VOID)
Definition: machine.h:57
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
BOOLEAN(* VideoIsPaletteFixed)(VOID)
Definition: machine.h:54
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(_In_opt_ PCSTR Options)
Definition: machine.h:77
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41

◆ Pc98ArchTest()

static BOOLEAN Pc98ArchTest ( VOID  )
static

Definition at line 103 of file machpc98.c.

104{
105 REGS RegsIn, RegsOut;
106
107 /* Int 1Ah AX=1000h
108 * NEC PC-9800 series - Installation check
109 */
110 RegsIn.w.ax = 0x1000;
111 Int386(0x1A, &RegsIn, &RegsOut);
112
113 return RegsOut.w.ax != 0x1000;
114}
int __cdecl Int386(int ivec, REGS *in, REGS *out)

Referenced by MachInit().

◆ Pc98GetBootSectorLoadAddress()

ULONG Pc98GetBootSectorLoadAddress ( IN UCHAR  DriveNumber)

Definition at line 44 of file machpc98.c.

45{
46 PPC98_DISK_DRIVE DiskDrive;
47
48 DiskDrive = Pc98DiskDriveNumberToDrive(DriveNumber);
49 if (!DiskDrive)
50 {
51 ERR("Failed to get drive 0x%x\n", DriveNumber);
52 return 0x1FC00;
53 }
54
55 if (((DiskDrive->DaUa & 0xF0) == 0x30) ||
56 ((DiskDrive->DaUa & 0xF0) == 0xB0))
57 {
58 /* 1.44 MB floppy */
59 return 0x1FE00;
60 }
61 else if (DiskDrive->Type & DRIVE_FDD)
62 {
63 return 0x1FC00;
64 }
65
66 return 0x1F800;
67}
#define DRIVE_FDD
Definition: machpc98.h:120

Referenced by ChainLoadBiosBootSectorCode().

◆ Pc98GetExtendedBIOSData()

VOID Pc98GetExtendedBIOSData ( PULONG  ExtendedBIOSDataArea,
PULONG  ExtendedBIOSDataSize 
)

Definition at line 22 of file machpc98.c.

23{
26}
#define ExtendedBIOSDataArea
Definition: winldr.c:346
#define ExtendedBIOSDataSize
Definition: winldr.c:347
#define MEM_EXTENDED_HIGH_RESO
Definition: machpc98.h:56
#define MEM_EXTENDED_NORMAL
Definition: machpc98.h:55

Referenced by MachInit().

◆ Pc98HwIdle()

VOID Pc98HwIdle ( VOID  )

Definition at line 29 of file machpc98.c.

30{
31 /* Unimplemented */
32}

Referenced by MachInit().

◆ Pc98PrepareForReactOS()

VOID Pc98PrepareForReactOS ( VOID  )

Definition at line 35 of file machpc98.c.

36{
41}
#define DebugDisableScreenPort()
Definition: debug.h:123
VOID Pc98DiskPrepareForReactOS(VOID)
Definition: pc98disk.c:135
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1235
VOID Pc98VideoPrepareForReactOS(VOID)
Definition: pc98video.c:445

Referenced by MachInit().

Variable Documentation

◆ HiResoMachine