ReactOS  0.4.15-dev-439-g292f67a
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 COLOR_BLACK
Definition: ui.h:204
unsigned char * PUCHAR
Definition: retypes.h:3
unsigned short es
Definition: pcbios.h:115
#define ATTR(cFore, cBack)
Definition: ui.h:192
unsigned char UCHAR
Definition: xmlstorage.h:181
UCHAR FrldrBootDrive
#define COLOR_WHITE
Definition: ui.h:220
#define MEM_DISK_BOOT
Definition: machpc98.h:44
PPC98_DISK_DRIVE Pc98DiskDriveNumberToDrive(IN UCHAR DriveNumber)
Definition: pc98disk.c:141
#define ERR(fmt,...)
Definition: debug.h:110
unsigned short USHORT
Definition: pedump.c:61
VOID __cdecl Relocator16Boot(IN REGS *In, IN USHORT StackSegment, IN USHORT StackPointer, IN USHORT CodeSegment, IN USHORT CodePointer)
unsigned short ax
Definition: pcbios.h:105
unsigned short si
Definition: pcbios.h:110
Definition: pcbios.h:152
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
WORDREGS w
Definition: pcbios.h:156
ULONG Pc98GetBootSectorLoadAddress(IN UCHAR DriveNumber)
Definition: machpc98.c:44
VOID Pc98VideoClearScreen(UCHAR Attr)
Definition: pc98video.c:158

◆ 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  _disable();
122  __halt();
123 
124  while (TRUE)
125  NOTHING;
126  }
127 
128  /* Setup vtbl */
129  RtlZeroMemory(&MachVtbl, sizeof(MACHVTBL));
158 
160 
162  Pc98VideoInit();
163 }
VOID Pc98VideoCopyOffScreenBufferToVRAM(PVOID Buffer)
Definition: pc98video.c:266
VOID Pc98VideoSync(VOID)
Definition: pc98video.c:318
PFREELDR_MEMORY_DESCRIPTOR(* GetMemoryMap)(PULONG MaxMemoryMapSize)
Definition: machine.h:63
VOID Pc98VideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
Definition: pc98video.c:186
#define TRUE
Definition: types.h:120
BOOLEAN Pc98ConsKbHit(VOID)
Definition: pc98cons.c:64
#define MEM_BIOS_FLAG1
Definition: machpc98.h:35
VOID(* GetExtendedBIOSData)(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machine.h:64
VOID(* VideoClearScreen)(UCHAR Attr)
Definition: machine.h:45
unsigned char * PUCHAR
Definition: retypes.h:3
BOOLEAN Pc98VideoIsPaletteFixed(VOID)
Definition: pc98video.c:282
__INTRIN_INLINE void __halt(void)
Definition: intrin_x86.h:1595
PCONFIGURATION_COMPONENT_DATA(* HwDetect)(VOID)
Definition: machine.h:77
VOID(* VideoGetDisplaySize)(PULONG Width, PULONG Height, PULONG Depth)
Definition: machine.h:47
UCHAR Pc98GetFloppyCount(VOID)
Definition: pc98hw.c:1223
VOID Pc98VideoSetTextCursorPosition(UCHAR X, UCHAR Y)
Definition: pc98video.c:206
VOID Pc98VideoInit(VOID)
Definition: pc98video.c:60
VOID Pc98VideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: pc98video.c:288
BOOLEAN(* VideoIsPaletteFixed)(VOID)
Definition: machine.h:54
UCHAR(* GetFloppyCount)(VOID)
Definition: machine.h:66
VOID Pc98PrepareForReactOS(VOID)
Definition: machpc98.c:35
VOID Pc98VideoHideShowTextCursor(BOOLEAN Show)
Definition: pc98video.c:219
VOID Pc98VideoGetFontsFromFirmware(PULONG RomFontPointers)
Definition: pc98video.c:200
VOID(* VideoGetFontsFromFirmware)(PULONG RomFontPointers)
Definition: machine.h:49
VOID Pc98VideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: pc98video.c:236
BOOLEAN(* DiskGetDriveGeometry)(UCHAR DriveNumber, PGEOMETRY DriveGeometry)
Definition: machine.h:68
VOID(* VideoSetTextCursorPosition)(UCHAR X, UCHAR Y)
Definition: machine.h:50
PCONFIGURATION_COMPONENT_DATA Pc98HwDetect(VOID)
Definition: pc98hw.c:1192
VOID Pc98HwIdle(VOID)
Definition: machpc98.c:29
VOID Pc98VideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: pc98video.c:300
TIMEINFO *(* GetTime)(VOID)
Definition: machine.h:72
VOID Pc98Beep(VOID)
Definition: pc98beep.c:10
BOOLEAN(* InitializeBootDevices)(VOID)
Definition: machine.h:76
BOOLEAN Pc98DiskGetDriveGeometry(UCHAR DriveNumber, PGEOMETRY Geometry)
Definition: pc98disk.c:870
VOID(* VideoGetPaletteColor)(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
Definition: machine.h:56
PFREELDR_MEMORY_DESCRIPTOR Pc98MemGetMemoryMap(ULONG *MemoryMapSize)
Definition: pc98mem.c:48
BOOLEAN HiResoMachine
Definition: machpc98.c:17
BOOLEAN Pc98DiskReadLogicalSectors(IN UCHAR DriveNumber, IN ULONGLONG SectorNumber, IN ULONG SectorCount, OUT PVOID Buffer)
Definition: pc98disk.c:837
BOOLEAN(* DiskReadLogicalSectors)(UCHAR DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
Definition: machine.h:67
BOOLEAN(* ConsKbHit)(VOID)
Definition: machine.h:42
int Pc98ConsGetCh(VOID)
Definition: pc98cons.c:85
VOID(* VideoPutChar)(int Ch, UCHAR Attr, unsigned X, unsigned Y)
Definition: machine.h:52
TIMEINFO * Pc98GetTime(VOID)
Definition: pc98rtc.c:13
#define NOTHING
Definition: env_spec_w32.h:461
#define HIGH_RESOLUTION_FLAG
Definition: machpc98.h:37
VOID(* VideoSetPaletteColor)(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
Definition: machine.h:55
VOID Pc98ConsPutChar(int Ch)
Definition: pc98cons.c:25
VOID(* PrepareForReactOS)(VOID)
Definition: machine.h:59
ULONG(* VideoGetBufferSize)(VOID)
Definition: machine.h:48
static BOOLEAN Pc98ArchTest(VOID)
Definition: machpc98.c:103
int(* ConsGetCh)(VOID)
Definition: machine.h:43
ULONG(* DiskGetCacheableBlockCount)(UCHAR DriveNumber)
Definition: machine.h:69
ULONG Pc98DiskGetCacheableBlockCount(UCHAR DriveNumber)
Definition: pc98disk.c:886
VOID(* ConsPutChar)(int Ch)
Definition: machine.h:41
MACHVTBL MachVtbl
Definition: arcemul.c:21
BOOLEAN Pc98InitializeBootDevices(VOID)
Definition: pc98disk.c:720
VOID(* HwIdle)(VOID)
Definition: machine.h:78
VOID HalpCalibrateStallExecution(VOID)
Definition: pchw.c:105
VOID Pc98GetExtendedBIOSData(PULONG ExtendedBIOSDataArea, PULONG ExtendedBIOSDataSize)
Definition: machpc98.c:22
VOID(* VideoSync)(VOID)
Definition: machine.h:57
void __cdecl _disable(void)
Definition: intrin_arm.h:365
ULONG Pc98VideoGetBufferSize(VOID)
Definition: pc98video.c:194
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261
VOID(* VideoCopyOffScreenBufferToVRAM)(PVOID Buffer)
Definition: machine.h:53
VIDEODISPLAYMODE(* VideoSetDisplayMode)(char *DisplayMode, BOOLEAN Init)
Definition: machine.h:46
VIDEODISPLAYMODE Pc98VideoSetDisplayMode(char *DisplayModeName, BOOLEAN Init)
Definition: pc98video.c:179
VOID(* Beep)(VOID)
Definition: machine.h:58
VOID(* VideoHideShowTextCursor)(BOOLEAN Show)
Definition: machine.h:51
VOID Pc98VideoClearScreen(UCHAR Attr)
Definition: pc98video.c:158

◆ 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)
unsigned short ax
Definition: pcbios.h:105
Definition: pcbios.h:152
WORDREGS w
Definition: pcbios.h:156

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:116
PPC98_DISK_DRIVE Pc98DiskDriveNumberToDrive(IN UCHAR DriveNumber)
Definition: pc98disk.c:141
#define ERR(fmt,...)
Definition: debug.h:110

Referenced by ChainLoadBiosBootSectorCode().

◆ Pc98GetExtendedBIOSData()

VOID Pc98GetExtendedBIOSData ( PULONG  ExtendedBIOSDataArea,
PULONG  ExtendedBIOSDataSize 
)

Definition at line 22 of file machpc98.c.

23 {
26 }
#define MEM_EXTENDED_NORMAL
Definition: machpc98.h:55
#define ExtendedBIOSDataSize
Definition: winldr.c:421
#define ExtendedBIOSDataArea
Definition: winldr.c:420
BOOLEAN HiResoMachine
Definition: machpc98.c:17
#define MEM_EXTENDED_HIGH_RESO
Definition: machpc98.h:56

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 {
40  DebugDisableScreenPort();
41 }
VOID Pc98DiskPrepareForReactOS(VOID)
Definition: pc98disk.c:135
VOID __cdecl DiskStopFloppyMotor(VOID)
Definition: pc98hw.c:1244
VOID Pc98VideoPrepareForReactOS(VOID)
Definition: pc98video.c:328

Referenced by MachInit().

Variable Documentation

◆ HiResoMachine