ReactOS  0.4.14-dev-49-gfb4591c
i386rtl.c File Reference
#include <freeldr.h>
Include dependency graph for i386rtl.c:

Go to the source code of this file.

Functions

void sound (int freq)
 
void delay (unsigned msec)
 
VOID PcBeep (VOID)
 
VOID __cdecl ChainLoadBiosBootSectorCode (IN UCHAR BootDrive OPTIONAL, IN ULONG BootPartition OPTIONAL)
 

Function Documentation

◆ ChainLoadBiosBootSectorCode()

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

Definition at line 92 of file i386rtl.c.

95 {
96  REGS Regs;
97 
98  RtlZeroMemory(&Regs, sizeof(Regs));
99 
100  /* Set the boot drive and the boot partition */
101  Regs.b.dl = (UCHAR)(BootDrive ? BootDrive : FrldrBootDrive);
102  Regs.b.dh = (UCHAR)(BootPartition ? BootPartition : FrldrBootPartition);
103 
104  /*
105  * Don't stop the floppy drive motor when we are just booting a bootsector,
106  * a drive, or a partition. If we were to stop the floppy motor, the BIOS
107  * wouldn't be informed and if the next read is to a floppy then the BIOS
108  * will still think the motor is on and this will result in a read error.
109  */
110  // DiskStopFloppyMotor();
111 
112  Relocator16Boot(&Regs,
113  /* Stack segment:pointer */
114  0x0000, 0x7C00,
115  /* Code segment:pointer */
116  0x0000, 0x7C00);
117 }
ULONG FrldrBootPartition
unsigned char dh
Definition: pcbios.h:129
unsigned char dl
Definition: pcbios.h:128
UCHAR FrldrBootDrive
unsigned char UCHAR
Definition: xmlstorage.h:181
BYTEREGS b
Definition: pcbios.h:151
VOID __cdecl Relocator16Boot(IN REGS *In, IN USHORT StackSegment, IN USHORT StackPointer, IN USHORT CodeSegment, IN USHORT CodePointer)
Definition: pcbios.h:146
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:261

◆ delay()

void delay ( unsigned  msec)

Definition at line 32 of file i386rtl.c.

33 {
34  REGS Regs;
35  unsigned usec;
36  unsigned msec_this;
37 
38  // Int 15h AH=86h
39  // BIOS - WAIT (AT,PS)
40  //
41  // AH = 86h
42  // CX:DX = interval in microseconds
43  // Return:
44  // CF clear if successful (wait interval elapsed)
45  // CF set on error or AH=83h wait already in progress
46  // AH = status (see #00496)
47 
48  // Note: The resolution of the wait period is 977 microseconds on
49  // many systems because many BIOSes use the 1/1024 second fast
50  // interrupt from the AT real-time clock chip which is available on INT 70;
51  // because newer BIOSes may have much more precise timers available, it is
52  // not possible to use this function accurately for very short delays unless
53  // the precise behavior of the BIOS is known (or found through testing)
54 
55  while (msec)
56  {
57  msec_this = msec;
58 
59  if (msec_this > 4000)
60  {
61  msec_this = 4000;
62  }
63 
64  usec = msec_this * 1000;
65 
66  Regs.b.ah = 0x86;
67  Regs.w.cx = usec >> 16;
68  Regs.w.dx = usec & 0xffff;
69  Int386(0x15, &Regs, &Regs);
70 
71  msec -= msec_this;
72  }
73 }
unsigned short dx
Definition: pcbios.h:102
unsigned short cx
Definition: pcbios.h:101
unsigned char ah
Definition: pcbios.h:120
int __cdecl Int386(int ivec, REGS *in, REGS *out)
BYTEREGS b
Definition: pcbios.h:151
Definition: pcbios.h:146
WORDREGS w
Definition: pcbios.h:150

Referenced by _Function_class_(), apartment_freeunusedlibraries(), CdRomUpdateMmcDriveCapabilitiesCompletion(), ClassSendSrbSynchronous(), denied_lock_backoff(), DriverEntry(), gif_metadata_reader(), load_GCE_metadata(), PcBeep(), ScsiClassSendSrbSynchronous(), StorageImpl_LockRegionSync(), test_SPI_SETKEYBOARDDELAY(), timer_queue_cb5(), UDFCommonShutdown(), UDFDoDismountSequence(), UDFDriverUnload(), UDFEjectReqWaiter(), UDFMountVolume(), UDFRecoverFromError(), UDFReleaseVCB(), and UpDownWindowProc().

◆ PcBeep()

VOID PcBeep ( VOID  )

Definition at line 25 of file i386rtl.c.

26 {
27  sound(700);
28  delay(200);
29  sound(0);
30 }
void sound(int freq)
Definition: i386rtl.c:75
void delay(unsigned msec)
Definition: i386rtl.c:32

Referenced by PcMachInit(), XboxBeep(), and XboxMachInit().

◆ sound()

void sound ( int  freq)

Definition at line 75 of file i386rtl.c.

76 {
77  int scale;
78 
79  if (freq == 0)
80  {
81  WRITE_PORT_UCHAR((PUCHAR)0x61, READ_PORT_UCHAR((PUCHAR)0x61) & ~3);
82  return;
83  }
84 
85  scale = 1193046 / freq;
86  WRITE_PORT_UCHAR((PUCHAR)0x43, 0xb6);
87  WRITE_PORT_UCHAR((PUCHAR)0x42, scale & 0xff);
88  WRITE_PORT_UCHAR((PUCHAR)0x42, scale >> 8);
89  WRITE_PORT_UCHAR((PUCHAR)0x61, READ_PORT_UCHAR((PUCHAR)0x61) | 3);
90 }
unsigned char * PUCHAR
Definition: retypes.h:3
GLenum GLenum GLenum GLenum GLenum scale
Definition: glext.h:9032
UCHAR NTAPI READ_PORT_UCHAR(PUCHAR Address)
Definition: mach.c:528
void WRITE_PORT_UCHAR(PUCHAR Address, UCHAR Value)
Definition: mach.c:532

Referenced by PcBeep(), and PlaySound_Alloc().