1 |
/* |
/* |
2 |
* Copyright (C) 2005 Anders Gavare. All rights reserved. |
* Copyright (C) 2005-2006 Anders Gavare. All rights reserved. |
3 |
* |
* |
4 |
* Redistribution and use in source and binary forms, with or without |
* Redistribution and use in source and binary forms, with or without |
5 |
* modification, are permitted provided that the following conditions are met: |
* modification, are permitted provided that the following conditions are met: |
25 |
* SUCH DAMAGE. |
* SUCH DAMAGE. |
26 |
* |
* |
27 |
* |
* |
28 |
* $Id: pc_bios.c,v 1.2 2005/09/30 14:17:04 debug Exp $ |
* $Id: pc_bios.c,v 1.6 2006/03/30 19:41:51 debug Exp $ |
29 |
* |
* |
30 |
* Generic PC BIOS emulation. |
* Generic PC BIOS emulation. |
31 |
* |
* |
878 |
} |
} |
879 |
|
|
880 |
debug("[ pc_bios_int13(): %s biosdisk 0x%02x (offset=" |
debug("[ pc_bios_int13(): %s biosdisk 0x%02x (offset=" |
881 |
"0x%llx) mem=0x%04x:0x%04x ]\n", ah==2? "read from" |
"0x%"PRIx64") mem=0x%04x:0x%04x ]\n", ah==2? |
882 |
: "write to", dl, (long long)offset, |
"read from" : "write to", dl, (uint64_t) offset, |
883 |
cpu->cd.x86.s[X86_S_ES], bx); |
cpu->cd.x86.s[X86_S_ES], bx); |
884 |
|
|
885 |
if (ah == 3) { |
if (ah == 3) { |
897 |
if (!res) { |
if (!res) { |
898 |
err = 4; |
err = 4; |
899 |
fatal("[ pc_bios_int13(): FAILED to %s" |
fatal("[ pc_bios_int13(): FAILED to %s" |
900 |
" biosdisk 0x%02x (offset=0x%llx)" |
" biosdisk 0x%02x (offset=0x%"PRIx64")" |
901 |
" ]\n", ah==2? "read from" : |
" ]\n", ah==2? "read from" : |
902 |
"write to", dl, (long long)offset); |
"write to", dl, (uint64_t) offset); |
903 |
} else if (ah == 2) { |
} else if (ah == 2) { |
904 |
cpu->cd.x86.cursegment = X86_S_ES; |
cpu->cd.x86.cursegment = X86_S_ES; |
905 |
if (bx + 512*al > 0x10000) { |
if (bx + 512*al > 0x10000) { |
1330 |
static void pc_bios_int1c(struct cpu *cpu) |
static void pc_bios_int1c(struct cpu *cpu) |
1331 |
{ |
{ |
1332 |
unsigned char ticks[4]; |
unsigned char ticks[4]; |
1333 |
int i; |
size_t i; |
1334 |
|
|
1335 |
/* Increase word at 0x0040:0x006C */ |
/* Increase word at 0x0040:0x006C */ |
1336 |
cpu->memory_rw(cpu, cpu->mem, 0x46C, |
cpu->memory_rw(cpu, cpu->mem, 0x46C, |
1484 |
{ |
{ |
1485 |
char t[81]; |
char t[81]; |
1486 |
int x, y, nboxlines, i, any_disk = 0, disknr, tmp; |
int x, y, nboxlines, i, any_disk = 0, disknr, tmp; |
1487 |
|
int old_cursegment = cpu->cd.x86.cursegment; |
1488 |
int boot_id, boot_type, bios_boot_id = 0, nfloppies = 0, nhds = 0; |
int boot_id, boot_type, bios_boot_id = 0, nfloppies = 0, nhds = 0; |
1489 |
|
|
1490 |
/* Go to real mode: */ |
/* Go to real mode: */ |
1782 |
cpu->pc = 0x7c00; |
cpu->pc = 0x7c00; |
1783 |
|
|
1784 |
cpu->machine->md.pc.initialized = 1; |
cpu->machine->md.pc.initialized = 1; |
1785 |
|
|
1786 |
|
cpu->cd.x86.cursegment = old_cursegment; |
1787 |
} |
} |
1788 |
|
|
1789 |
|
|