Small improvments

This commit is contained in:
copy 2014-01-10 23:12:56 +01:00
parent 51c5009cfe
commit d89af6dc23
6 changed files with 66 additions and 39 deletions

View file

@ -38,7 +38,7 @@ How to build, run and embed?
- If you want a compressed and fast (ie, with debug code removed) version, you
need Closure Compiler.
Set the path to `compiler.jar` in the Makefile and run `make v86_all.js`.
- ROM and disk images are loaded via AJAX, so if you want to try out `index.html`
- ROM and disk images are loaded via XHR, so if you want to try out `index.html`
locally, make sure to serve it from a local webserver.
- For more details on how to customize the behaviour and interface, see [docs/adapters.md](docs/adapters.md).
@ -54,13 +54,32 @@ there might be some actual uses.
If you build something interesting, let me know. However, keep in mind that the project
is not very stable at the moment.
Compatibility
-
Here's an overview of the operating systems supported in v86:
- Linux works pretty well. Graphical boots fails in many versions, but you
mostly get a shell. The mouse is never detected automatically.
- Damn Small Linux (2.4 Kernel): Run with `lowram` and choose PS2 mouse in
xsetup. Takes circa 10 minutes to boot.
- Tinycore, Nanolinux (3.0 kernel): `udev` and `X` fail, but you get a
terminal.
- FreeDOS and Windows 1.01 run pretty good. A few applications cause the OS to
freeze. Some BIOS problems.
- KolibriOS works.
- Haiku boots after 30 minutes. r1alpha4 immediately reboots, the newest version
compiled from source works.
How can I contribute?
-
- Someone who could work on hardware devices, such as a modem or the AT
controller. I'll write an overview for that at a later point, if people are
interested.
- Someone who could work on new hardware devices, such as a modem. I'll write
an overview for that at a later point, if people are interested. Also, help
on the interface would be appreciated.
- Donate. Since Bitcoin is the new cool thing, here's my address:
`14KBXSoewGzbQY8VoznJ5MZXGxoia8RxC9`

View file

@ -1,4 +1,3 @@
/** @define {boolean} */
var DEBUG = true;
@ -30,7 +29,7 @@ var
/** @const */ LOG_LEVEL = LOG_ALL & ~LOG_DMA & ~LOG_PS2 & ~LOG_DISK & ~LOG_PIT;
/** @const */ LOG_LEVEL = LOG_ALL & ~LOG_DMA & ~LOG_DISK & ~LOG_PIT;
///** @const */ LOG_LEVEL = LOG_OTHER | LOG_PS2;
///** @const */ LOG_LEVEL = 0;
@ -47,7 +46,7 @@ var
ENABLE_HPET = false,
/** @const */
ENABLE_ACPI = false;
ENABLE_ACPI = true;
var
@ -146,8 +145,8 @@ PSE_ENABLED = 128,
/** @const */ LOOP_COUNTER = 4001,
/** @const */ TIME_PER_FRAME = 20;
/** @const */ LOOP_COUNTER = 11001,
/** @const */ TIME_PER_FRAME = 33;
var

View file

@ -20,11 +20,15 @@ function IDEDevice(dev, buffer, is_cd, nr)
{
this.ata_port = 0x1F0;
this.irq = 14;
this.pci_id = 0x1E << 3;
}
else
{
this.ata_port = 0x1F0;
this.irq = 15;
this.irq = 14;
this.pci_id = 0x1F << 3;
}
// alternate status, starting at 3f4/374
@ -40,24 +44,36 @@ function IDEDevice(dev, buffer, is_cd, nr)
this.buffer = buffer;
this.is_atapi = is_cd;
this.sector_count = me.buffer.byteLength / this.sector_size;
if(is_cd)
if(buffer)
{
this.head_count = 1;
this.sectors_per_track = 0;
this.sector_count = me.buffer.byteLength / this.sector_size;
if(is_cd)
{
this.head_count = 1;
this.sectors_per_track = 0;
}
else
{
this.head_count = 1;
this.sectors_per_track = 63;
}
this.cylinder_count = me.buffer.byteLength /
this.head_count / (this.sectors_per_track + 1) / this.sector_size;
dbg_assert(this.cylinder_count === (this.cylinder_count | 0));
}
else
{
this.head_count = 1;
this.sectors_per_track = 63;
this.sector_count = 0;
this.head_count = 0;
this.sectors_per_track = 0;
this.cylinder_count = 0;
}
this.cylinder_count = me.buffer.byteLength /
this.head_count / (this.sectors_per_track + 1) / this.sector_size;
dbg_assert(this.cylinder_count === (this.cylinder_count | 0));
this.stats = {
sectors_read: 0,
sectors_written: 0,
@ -76,7 +92,6 @@ function IDEDevice(dev, buffer, is_cd, nr)
}
}
this.pci_id = 0x1F << 3;
this.pci_space = [
0x86, 0x80, 0x20, 0x3a, 0x05, 0x00, 0xa0, 0x02, 0x00, 0x8f, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
this.ata_port & 0xFF | 1, this.ata_port >> 8, 0x00, 0x00,

View file

@ -132,7 +132,7 @@ function getcf()
{
if(flags_changed & 1)
{
return !!((last_op1 ^ (last_op1 ^ last_op2) & (last_op2 ^ last_add_result)) & last_op_size);
return +!!((last_op1 ^ (last_op1 ^ last_op2) & (last_op2 ^ last_add_result)) & last_op_size);
}
else
{
@ -247,7 +247,7 @@ function pusha16()
// make sure we don't get a pagefault after having
// pushed several registers already
translate_address_write(temp - 15);
translate_address_write(get_seg(reg_ss) + temp - 15);
push16(reg16[reg_ax]);
push16(reg16[reg_cx]);
@ -263,7 +263,7 @@ function pusha32()
{
var temp = reg32s[reg_esp];
translate_address_write(temp - 31);
translate_address_write(get_seg(reg_ss) + temp - 31);
push32(reg32s[reg_eax]);
push32(reg32s[reg_ecx]);
@ -277,7 +277,7 @@ function pusha32()
function popa16()
{
translate_address_read(stack_reg[reg_vsp] + 15);
translate_address_read(get_seg(reg_ss) + stack_reg[reg_vsp] + 15);
reg16[reg_di] = pop16();
reg16[reg_si] = pop16();
@ -291,7 +291,7 @@ function popa16()
function popa32()
{
translate_address_read(stack_reg[reg_vsp] + 31);
translate_address_read(get_seg(reg_ss) + stack_reg[reg_vsp] + 31);
reg32[reg_edi] = pop32s();
reg32[reg_esi] = pop32s();

View file

@ -41,6 +41,9 @@ var modrm_table16 = Array(0xC0),
modrm_table16[n] = function() { return offset | 0; };
#define getsib(mod)\
sib_table[read_imm8()](mod)
entry16(0, ds, reg16[reg_bx] + reg16[reg_si])
entry16(1, ds, reg16[reg_bx] + reg16[reg_di])
entry16(2, ss, reg16[reg_bp] + reg16[reg_si])
@ -140,15 +143,6 @@ modrm_resolve32 = function(modrm_byte)
return modrm_table32[modrm_byte]();
}
/**
* @param {boolean} mod
* @return {number}
*/
function getsib(mod)
{
return sib_table[read_imm8()](mod);
}
#undef ds
#undef ss

View file

@ -176,7 +176,7 @@ function PCI(dev)
if(space)
{
(new Uint8Array(space.buffer))[addr | byte_pos] = byte;
//(new Uint8Array(space.buffer))[addr | byte_pos] = byte;
if(byte_pos === 3 && addr >= 0x10 && addr < 0x28)
{
@ -189,7 +189,7 @@ function PCI(dev)
if(bar)
{
dbg_assert(!(bar.size & bar.size - 1));
space[addr >> 2] = value & ~(bar.size - 1) | 3;
//space[addr >> 2] = value & ~(bar.size - 1) | 3;
}
else
{