ReactOS 0.4.15-dev-7931-gfd331f1
dskbios32.c File Reference
#include "ntvdm.h"
#include <debug.h>
#include "emulator.h"
#include "cpu/cpu.h"
#include "int32.h"
#include "dskbios32.h"
#include "bios32p.h"
#include "hardware/disk.h"
Include dependency graph for dskbios32.c:

Go to the source code of this file.

Classes

struct  _FLOPPY_PARAM_TABLE
 
struct  _FLOPPY_PARAM_TABLE_EX
 
struct  _HARDDISK_PARAM_TABLE
 

Macros

#define NDEBUG
 
#define FLOPPY_SIZE_CODE   0x02
 
#define FLOPPY_DATALEN   0xFF
 
#define FLOPPY_MOTOR_TICKS   37
 
#define FLOPPY_FILLBYTE   0xF6
 
#define FLOPPY_GAPLEN   0x1B
 
#define FLOPPY_FORMAT_GAPLEN   0x6C
 

Typedefs

typedef struct _FLOPPY_PARAM_TABLE FLOPPY_PARAM_TABLE
 
typedef struct _FLOPPY_PARAM_TABLEPFLOPPY_PARAM_TABLE
 
typedef struct _FLOPPY_PARAM_TABLE_EX FLOPPY_PARAM_TABLE_EX
 
typedef struct _FLOPPY_PARAM_TABLE_EXPFLOPPY_PARAM_TABLE_EX
 
typedef struct _HARDDISK_PARAM_TABLE HARDDISK_PARAM_TABLE
 
typedef struct _HARDDISK_PARAM_TABLEPHARDDISK_PARAM_TABLE
 

Functions

static PDISK_IMAGE GetDisk (IN BYTE DiskNumber)
 
static VOID AllDisksReset (VOID)
 
VOID WINAPI BiosDiskService (LPWORD Stack)
 
VOID DiskBios32Post (VOID)
 
BOOLEAN DiskBios32Initialize (VOID)
 
VOID DiskBios32Cleanup (VOID)
 

Variables

static PDISK_IMAGE FloppyDrive [2] = {NULL}
 
static PDISK_IMAGE HardDrive [4] = {NULL}
 
static const FLOPPY_PARAM_TABLE_EX FloppyParamTable
 

Macro Definition Documentation

◆ FLOPPY_DATALEN

#define FLOPPY_DATALEN   0xFF

Definition at line 72 of file dskbios32.c.

◆ FLOPPY_FILLBYTE

#define FLOPPY_FILLBYTE   0xF6

Definition at line 74 of file dskbios32.c.

◆ FLOPPY_FORMAT_GAPLEN

#define FLOPPY_FORMAT_GAPLEN   0x6C

Definition at line 76 of file dskbios32.c.

◆ FLOPPY_GAPLEN

#define FLOPPY_GAPLEN   0x1B

Definition at line 75 of file dskbios32.c.

◆ FLOPPY_MOTOR_TICKS

#define FLOPPY_MOTOR_TICKS   37

Definition at line 73 of file dskbios32.c.

◆ FLOPPY_SIZE_CODE

#define FLOPPY_SIZE_CODE   0x02

Definition at line 71 of file dskbios32.c.

◆ NDEBUG

#define NDEBUG

Definition at line 13 of file dskbios32.c.

Typedef Documentation

◆ FLOPPY_PARAM_TABLE

◆ FLOPPY_PARAM_TABLE_EX

◆ HARDDISK_PARAM_TABLE

◆ PFLOPPY_PARAM_TABLE

◆ PFLOPPY_PARAM_TABLE_EX

◆ PHARDDISK_PARAM_TABLE

Function Documentation

◆ AllDisksReset()

static VOID AllDisksReset ( VOID  )
static

Definition at line 157 of file dskbios32.c.

158{
161}
BYTE LastDiskOperation
Definition: bios.h:81
BYTE LastDisketteOperation
Definition: bios.h:57
PBIOS_DATA_AREA Bda
Definition: bios.c:42

Referenced by BiosDiskService(), and DiskBios32Post().

◆ BiosDiskService()

VOID WINAPI BiosDiskService ( LPWORD  Stack)

Definition at line 164 of file dskbios32.c.

165{
166 BYTE Drive;
167 PDISK_IMAGE DiskImage;
168
169 switch (getAH())
170 {
171 /* Disk -- Reset Disk System */
172 case 0x00:
173 {
174 Drive = getDL();
175
176 if (Drive & 0x80)
177 {
179
180 /* Return success */
181 setAH(0x00);
182 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
183 break;
184 }
185
186 Drive &= ~0x80;
187
189 {
190 DPRINT1("BiosDiskService(0x00): Drive number 0x%02X invalid\n", Drive);
191
192 /* Return error */
193 setAH(0x01);
195 break;
196 }
197
198 // TODO: Reset drive
199
200 /* Return success */
201 setAH(0x00);
202 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
203 break;
204 }
205
206 /* Disk -- Get Status of Last Operation */
207 case 0x01:
208 {
209 BYTE LastOperationStatus = 0x00;
210
211 Drive = getDL();
212 DiskImage = GetDisk(Drive);
213 if (!DiskImage || !IsDiskPresent(DiskImage))
214 {
215 DPRINT1("BiosDiskService(0x01): Disk number 0x%02X invalid\n", Drive);
216
217 /* Return error */
218 setAH(0x01);
220 break;
221 }
222
223 LastOperationStatus = DiskImage->LastOperationStatus;
224
225 if (Drive & 0x80)
226 Bda->LastDiskOperation = LastOperationStatus;
227 else
228 Bda->LastDisketteOperation = LastOperationStatus;
229
230 /* Return last error */
231 setAH(LastOperationStatus);
232 if (LastOperationStatus == 0x00)
233 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
234 else
236
237 break;
238 }
239
240 /* Disk -- Read Sectors into Memory */
241 case 0x02:
242 {
243 BYTE Status;
244 BYTE Head = getDH();
245 BYTE NumSectors = getAL();
246
247 // CH: Low eight bits of cylinder number
248 // CL: High two bits of cylinder (bits 6-7, hard disk only)
249 WORD Cylinder = MAKEWORD(getCH(), (getCL() >> 6) & 0x02);
250
251 // CL: Sector number 1-63 (bits 0-5)
252 BYTE Sector = (getCL() & 0x3F); // 1-based
253
254 Drive = getDL();
255 DiskImage = GetDisk(Drive);
256 if (!DiskImage || !IsDiskPresent(DiskImage))
257 {
258 DPRINT1("BiosDiskService(0x02): Disk number 0x%02X invalid\n", Drive);
259
260 /* Return error */
261 setAH(0x01);
263 break;
264 }
265
266 /* Read the sectors */
267 Status = ReadDisk(DiskImage, Cylinder, Head, Sector, NumSectors);
268 if (Status == 0x00)
269 {
270 /* Return success */
271 setAH(0x00);
272 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
273 }
274 else
275 {
276 DPRINT1("BiosDiskService(0x02): Error when reading from disk number 0x%02X (0x%02X)\n", Drive, Status);
277
278 /* Return error */
279 setAH(Status);
281 }
282
283 break;
284 }
285
286 /* Disk -- Write Disk Sectors */
287 case 0x03:
288 {
289 BYTE Status;
290 BYTE Head = getDH();
291 BYTE NumSectors = getAL();
292
293 // CH: Low eight bits of cylinder number
294 // CL: High two bits of cylinder (bits 6-7, hard disk only)
295 WORD Cylinder = MAKEWORD(getCH(), (getCL() >> 6) & 0x02);
296
297 // CL: Sector number 1-63 (bits 0-5)
298 BYTE Sector = (getCL() & 0x3F); // 1-based
299
300 Drive = getDL();
301 DiskImage = GetDisk(Drive);
302 if (!DiskImage || !IsDiskPresent(DiskImage))
303 {
304 DPRINT1("BiosDiskService(0x03): Disk number 0x%02X invalid\n", Drive);
305
306 /* Return error */
307 setAH(0x01);
309 break;
310 }
311
312 /* Write the sectors */
313 Status = WriteDisk(DiskImage, Cylinder, Head, Sector, NumSectors);
314 if (Status == 0x00)
315 {
316 /* Return success */
317 setAH(0x00);
318 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
319 }
320 else
321 {
322 DPRINT1("BiosDiskService(0x03): Error when writing to disk number 0x%02X (0x%02X)\n", Drive, Status);
323
324 /* Return error */
325 setAH(Status);
327 }
328
329 break;
330 }
331
332 /* Disk -- Verify Disk Sectors */
333 case 0x04:
334
335 /* Floppy/Fixed Disk -- Format Track */
336 case 0x05:
337
338 /* Fixed Disk -- Format Track and Set Bad Sector Flags */
339 case 0x06:
340
341 /* Fixed Disk -- Format Drive starting at Given Track */
342 case 0x07:
343 goto Default;
344
345 /* Disk -- Get Drive Parameters */
346 case 0x08:
347 {
348 WORD MaxCylinders;
349 BYTE MaxHeads;
350 BYTE PresentDrives = 0;
351 BYTE i;
352
353 Drive = getDL();
354 DiskImage = GetDisk(Drive);
355 if (!DiskImage || !IsDiskPresent(DiskImage))
356 {
357 DPRINT1("BiosDiskService(0x08): Disk number 0x%02X invalid\n", Drive);
358
359 /* Return error */
360 setAH(0x01);
362 break;
363 }
364
365 // Minus 2 because it's the maximum cylinder number (not count),
366 // and the last cylinder is reserved (for compatibility with BIOSes
367 // which reserve it for testing purposes).
368 MaxCylinders = DiskImage->DiskInfo.Cylinders - 2;
369 // Minus 1 because it's the maximum head number (not count).
370 MaxHeads = DiskImage->DiskInfo.Heads - 1;
371
372 // CL: Sector number 1-63 (bits 0-5)
373 // High two bits of cylinder (bits 6-7, hard disk only)
374 setCL((DiskImage->DiskInfo.Sectors & 0x3F) |
375 ((HIBYTE(MaxCylinders) & 0x02) << 6));
376 // CH: Low eight bits of cylinder number
377 setCH(LOBYTE(MaxCylinders));
378
379 setDH(MaxHeads);
380
381 if (Drive & 0x80)
382 {
383 /* Count the number of active HDDs */
384 for (i = 0; i < ARRAYSIZE(HardDrive); ++i)
385 {
387 ++PresentDrives;
388 }
389
390 /* Reset ES:DI to NULL */
391 // FIXME: NONONO!! Apps expect (for example, MS-DOS kernel)
392 // that this function does not modify ES:DI if it was called
393 // for a HDD.
394 // setES(0x0000);
395 // setDI(0x0000);
396 }
397 else
398 {
399 /* Count the number of active floppies */
400 for (i = 0; i < ARRAYSIZE(FloppyDrive); ++i)
401 {
403 ++PresentDrives;
404 }
405
406 /* ES:DI points to the floppy parameter table */
407 setES(HIWORD(((PULONG)BaseAddress)[0x1E]));
408 setDI(LOWORD(((PULONG)BaseAddress)[0x1E]));
409 }
410 setDL(PresentDrives);
411
412 setBL(DiskImage->DiskType); // DiskGeometryList[DiskImage->DiskType].biosval
413 setAL(0x00);
414
415 /* Return success */
416 setAH(0x00);
417 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
418 break;
419 }
420
421 /* Hard Disk -- Initialize Controller with Drive Parameters */
422 case 0x09:
423
424 /* Hard Disk -- Read Long Sectors */
425 case 0x0A:
426
427 /* Hard Disk -- Write Long Sectors */
428 case 0x0B:
429 goto Default;
430
431 /* Hard Disk -- Seek to Cylinder */
432 case 0x0C:
433 {
434 BYTE Status;
435 BYTE Head = getDH();
436
437 // CH: Low eight bits of cylinder number
438 // CL: High two bits of cylinder (bits 6-7, hard disk only)
439 WORD Cylinder = MAKEWORD(getCH(), (getCL() >> 6) & 0x02);
440
441 // CL: Sector number 1-63 (bits 0-5)
442 BYTE Sector = (getCL() & 0x3F); // 1-based
443
444 Drive = getDL();
445 if (!(Drive & 0x80))
446 {
447 DPRINT1("BiosDiskService(0x0C): Disk number 0x%02X is not a HDD\n", Drive);
448
449 /* Return error */
450 setAH(0x01);
452 break;
453 }
454
455 DiskImage = GetDisk(Drive);
456 if (!DiskImage || !IsDiskPresent(DiskImage))
457 {
458 DPRINT1("BiosDiskService(0x0C): Disk number 0x%02X invalid\n", Drive);
459
460 /* Return error */
461 setAH(0x01);
463 break;
464 }
465
466 /* Set position */
467 Status = SeekDisk(DiskImage, Cylinder, Head, Sector);
468 if (Status == 0x00)
469 {
470 /* Return success */
471 setAH(0x00);
472 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
473 }
474 else
475 {
476 DPRINT1("BiosDiskService(0x0C): Error when seeking in disk number 0x%02X (0x%02X)\n", Drive, Status);
477
478 /* Return error */
479 setAH(Status);
481 }
482
483 break;
484 }
485
486 /* Hard Disk -- Reset Hard Disks */
487 case 0x0D:
488 {
489 // FIXME: Should do what 0x11 does.
491 }
492
493 /* Hard Disk -- Read Sector Buffer (XT only) */
494 case 0x0E:
495
496 /* Hard Disk -- Write Sector Buffer (XT only) */
497 case 0x0F:
498 goto Default;
499
500 /* Hard Disk -- Check if Drive is ready */
501 case 0x10:
502 {
503 Drive = getDL();
504 if (!(Drive & 0x80))
505 {
506 DPRINT1("BiosDiskService(0x10): Disk number 0x%02X is not a HDD\n", Drive);
507
508 /* Return error */
509 setAH(0x01);
511 break;
512 }
513
514 DiskImage = GetDisk(Drive);
515 if (!DiskImage || !IsDiskPresent(DiskImage))
516 {
517 DPRINT1("BiosDiskService(0x10): Disk number 0x%02X invalid\n", Drive);
518
519 /* Return error */
520 setAH(0x01);
522 break;
523 }
524
525 /* Return success */
526 setAH(0x00);
527 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
528 break;
529 }
530
531 /* Hard Disk -- Recalibrate Drive */
532 case 0x11:
533 {
534 BYTE Status;
535
536 Drive = getDL();
537 if (!(Drive & 0x80))
538 {
539 DPRINT1("BiosDiskService(0x11): Disk number 0x%02X is not a HDD\n", Drive);
540
541 /* Return error */
542 setAH(0x01);
544 break;
545 }
546
547 DiskImage = GetDisk(Drive);
548 if (!DiskImage || !IsDiskPresent(DiskImage))
549 {
550 DPRINT1("BiosDiskService(0x11): Disk number 0x%02X invalid\n", Drive);
551
552 /* Return error */
553 setAH(0x01);
555 break;
556 }
557
558 /* Set position to zero */
559 Status = SeekDisk(DiskImage, /*Cylinder*/ 0, /*Head*/ 0, /*Sector*/ 1);
560 if (Status == 0x00)
561 {
562 /* Return success */
563 setAH(0x00);
564 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
565 }
566 else
567 {
568 DPRINT1("BiosDiskService(0x11): Error when recalibrating disk number 0x%02X (0x%02X)\n", Drive, Status);
569
570 /* Return error */
571 setAH(Status);
573 }
574
575 break;
576 }
577
578 /* Hard Disk -- Controller RAM Diagnostic */
579 case 0x12:
580
581 /* Hard Disk -- Drive Diagnostic */
582 case 0x13:
583
584 /* Hard Disk -- Controller Internal Diagnostic */
585 case 0x14:
586 goto Default;
587
588 /* Disk -- Get Disk Type */
589 case 0x15:
590 {
591 Drive = getDL();
592 DiskImage = GetDisk(Drive);
593 if (!DiskImage || !IsDiskPresent(DiskImage))
594 {
595 DPRINT1("BiosDiskService(0x15): Disk number 0x%02X invalid\n", Drive);
596
597 /* Return error */
598 setAH(0x01);
600 break;
601 }
602
603 if (Drive & 0x80)
604 {
605 ULONG NumSectors;
606
607 /* Hard disk */
608 setAH(0x03);
609
610 /* Number of 512-byte sectors in CX:DX */
611 NumSectors = (ULONG)((ULONG)DiskImage->DiskInfo.Cylinders * DiskImage->DiskInfo.Heads)
612 * DiskImage->DiskInfo.Sectors;
613 setCX(HIWORD(NumSectors));
614 setDX(LOWORD(NumSectors));
615 }
616 else
617 {
618 /* Floppy */
619 setAH(0x01);
620 }
621
622 /* Return success */
623 Stack[STACK_FLAGS] &= ~EMULATOR_FLAG_CF;
624 break;
625 }
626
627 /* Floppy Disk -- Detect Disk Change */
628 case 0x16:
629
630 /* Floppy Disk -- Set Disk Type for Format */
631 case 0x17:
632
633 /* Disk -- Set Media Type for Format */
634 case 0x18:
635 goto Default;
636
637 default: Default:
638 {
639 DPRINT1("BIOS Function INT 13h, AH = 0x%02X, AL = 0x%02X, BH = 0x%02X NOT IMPLEMENTED\n",
640 getAH(), getAL(), getBH());
641 }
642 }
643}
#define DPRINT1
Definition: precomp.h:8
PWCHAR Drive
Definition: chkdsk.c:73
#define UNIMPLEMENTED
Definition: debug.h:115
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
static VOID AllDisksReset(VOID)
Definition: dskbios32.c:157
static PDISK_IMAGE GetDisk(IN BYTE DiskNumber)
Definition: dskbios32.c:130
static PDISK_IMAGE HardDrive[4]
Definition: dskbios32.c:37
static PDISK_IMAGE FloppyDrive[2]
Definition: dskbios32.c:36
unsigned short WORD
Definition: ntddk_ex.h:93
Status
Definition: gdiplustypes.h:25
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define STACK_FLAGS
Definition: int32.h:35
#define LOBYTE(W)
Definition: jmemdos.c:487
#define HIBYTE(W)
Definition: jmemdos.c:486
@ Default
Definition: stdole2.idl:392
_In_ HANDLE _Outptr_result_bytebuffer_ ViewSize PVOID * BaseAddress
Definition: mmfuncs.h:404
#define LOWORD(l)
Definition: pedump.c:82
DISK_INFO DiskInfo
Definition: disk.h:30
BYTE DiskType
Definition: disk.h:31
BYTE LastOperationStatus
Definition: disk.h:33
BYTE Sectors
Definition: disk.h:23
BYTE Heads
Definition: disk.h:22
WORD Cylinders
Definition: disk.h:21
#define EMULATOR_FLAG_CF
Definition: cpu.h:19
BYTE ReadDisk(IN PDISK_IMAGE DiskImage, IN WORD Cylinder, IN BYTE Head, IN BYTE Sector, IN BYTE NumSectors)
Definition: disk.c:359
BOOLEAN IsDiskPresent(IN PDISK_IMAGE DiskImage)
Definition: disk.c:321
BYTE WriteDisk(IN PDISK_IMAGE DiskImage, IN WORD Cylinder, IN BYTE Head, IN BYTE Sector, IN BYTE NumSectors)
Definition: disk.c:413
BYTE SeekDisk(IN PDISK_IMAGE DiskImage, IN WORD Cylinder, IN BYTE Head, IN BYTE Sector)
Definition: disk.c:328
uint32_t * PULONG
Definition: typedefs.h:59
#define MAKEWORD(a, b)
Definition: typedefs.h:248
uint32_t ULONG
Definition: typedefs.h:59
#define HIWORD(l)
Definition: typedefs.h:247
UCHAR WINAPI getBH(VOID)
Definition: registers.c:184
VOID WINAPI setCX(USHORT)
Definition: registers.c:235
VOID WINAPI setCH(UCHAR)
Definition: registers.c:249
VOID WINAPI setDX(USHORT)
Definition: registers.c:293
VOID WINAPI setAL(UCHAR)
Definition: registers.c:149
UCHAR WINAPI getCH(VOID)
Definition: registers.c:242
VOID WINAPI setDL(UCHAR)
Definition: registers.c:321
UCHAR WINAPI getAL(VOID)
Definition: registers.c:142
VOID WINAPI setAH(UCHAR)
Definition: registers.c:135
VOID WINAPI setBL(UCHAR)
Definition: registers.c:205
UCHAR WINAPI getCL(VOID)
Definition: registers.c:256
VOID WINAPI setDH(UCHAR)
Definition: registers.c:307
UCHAR WINAPI getDL(VOID)
Definition: registers.c:314
VOID WINAPI setES(USHORT)
Definition: registers.c:529
VOID WINAPI setCL(UCHAR)
Definition: registers.c:263
UCHAR WINAPI getAH(VOID)
Definition: registers.c:128
VOID WINAPI setDI(USHORT)
Definition: registers.c:441
UCHAR WINAPI getDH(VOID)
Definition: registers.c:300
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
Definition: wdfrequest.h:639
unsigned char BYTE
Definition: xxhash.c:193

Referenced by BiosBootstrapLoader(), and DiskBios32Post().

◆ DiskBios32Cleanup()

VOID DiskBios32Cleanup ( VOID  )

Definition at line 701 of file dskbios32.c.

702{
703}

Referenced by Bios32Cleanup().

◆ DiskBios32Initialize()

BOOLEAN DiskBios32Initialize ( VOID  )

Definition at line 674 of file dskbios32.c.

675{
676 /*
677 * Initialize BIOS Disk ROM static data
678 */
679
680 /* Floppy Parameter Table */
684
685 //
686 // FIXME: Must be done by HW floppy controller!
687 //
688
689 /* Detect and initialize the supported disks */
690 // TODO: the "Detect" part is missing.
697
698 return TRUE;
699}
#define BIOS_SEGMENT
Definition: bios.h:29
#define TRUE
Definition: types.h:120
static const FLOPPY_PARAM_TABLE_EX FloppyParamTable
Definition: dskbios32.c:78
#define SEG_OFF_TO_PTR(seg, off)
Definition: emulator.h:32
FLOPPY_PARAM_TABLE FloppyParamTable
Definition: dskbios32.c:59
PDISK_IMAGE RetrieveDisk(IN DISK_TYPE DiskType, IN ULONG DiskNumber)
Definition: disk.c:485
@ HARD_DISK
Definition: disk.h:45
@ FLOPPY_DISK
Definition: disk.h:44
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263

Referenced by Bios32Initialize().

◆ DiskBios32Post()

VOID DiskBios32Post ( VOID  )

Definition at line 647 of file dskbios32.c.

648{
649 /*
650 * Initialize BIOS Disk RAM dynamic data
651 */
652
653 /* Some vectors are in fact addresses to tables */
654 // Diskette Parameters
655 ((PULONG)BaseAddress)[0x1E] = MAKELONG(0xEFC7, BIOS_SEGMENT);
656 // Hard Disk 0 Parameter Table Address
657 ((PULONG)BaseAddress)[0x41] = NULL32;
658 // Hard Disk 1 Drive Parameter Table Address
659 ((PULONG)BaseAddress)[0x46] = NULL32;
660
661 /* Relocated services by the BIOS (when needed) */
662 ((PULONG)BaseAddress)[0x40] = NULL32; // ROM BIOS Diskette Handler relocated by Hard Disk BIOS
663 // RegisterBiosInt32(0x40, NULL); // ROM BIOS Diskette Handler relocated by Hard Disk BIOS
664
665 /* Register the BIOS 32-bit Interrupts */
667
668 /* Initialize the BDA */
669 // Bda->LastDisketteOperation = 0;
670 // Bda->LastDiskOperation = 0;
672}
#define RegisterBiosInt32(IntNumber, IntHandler)
Definition: bios32p.h:34
VOID WINAPI BiosDiskService(LPWORD Stack)
Definition: dskbios32.c:164
#define BIOS_DISK_INTERRUPT
Definition: dskbios32.h:14
#define NULL32
Definition: emulator.h:21
#define MAKELONG(a, b)
Definition: typedefs.h:249

Referenced by Bios32Post().

◆ GetDisk()

static PDISK_IMAGE GetDisk ( IN BYTE  DiskNumber)
static

Definition at line 130 of file dskbios32.c.

131{
132 if (DiskNumber & 0x80)
133 {
134 DiskNumber &= ~0x80;
135
136 if (DiskNumber >= ARRAYSIZE(HardDrive))
137 {
138 DPRINT1("GetDisk: HDD number 0x%02X invalid\n", DiskNumber | 0x80);
139 return NULL;
140 }
141
142 return HardDrive[DiskNumber];
143 }
144 else
145 {
146 if (DiskNumber >= ARRAYSIZE(FloppyDrive))
147 {
148 DPRINT1("GetDisk: Floppy number 0x%02X invalid\n", DiskNumber);
149 return NULL;
150 }
151
152 return FloppyDrive[DiskNumber];
153 }
154}
#define NULL
Definition: types.h:112

Referenced by BiosDiskService().

Variable Documentation

◆ FloppyDrive

PDISK_IMAGE FloppyDrive[2] = {NULL}
static

Definition at line 36 of file dskbios32.c.

Referenced by BiosDiskService(), DiskBios32Initialize(), and GetDisk().

◆ FloppyParamTable

const FLOPPY_PARAM_TABLE_EX FloppyParamTable
static
Initial value:
=
{
{
0xAF,
0x02,
18,
0x0F,
0x08,
},
79,
0,
4,
}
#define FLOPPY_DATALEN
Definition: dskbios32.c:72
#define FLOPPY_FORMAT_GAPLEN
Definition: dskbios32.c:76
#define FLOPPY_SIZE_CODE
Definition: dskbios32.c:71
#define FLOPPY_MOTOR_TICKS
Definition: dskbios32.c:73
#define FLOPPY_GAPLEN
Definition: dskbios32.c:75
#define FLOPPY_FILLBYTE
Definition: dskbios32.c:74

Definition at line 78 of file dskbios32.c.

Referenced by DiskBios32Initialize().

◆ HardDrive

PDISK_IMAGE HardDrive[4] = {NULL}
static

Definition at line 37 of file dskbios32.c.

Referenced by BiosDiskService(), DiskBios32Initialize(), and GetDisk().