Clean up some logging

This commit is contained in:
copy 2016-11-21 19:59:48 +01:00
parent 60e330dd53
commit ae7bbcc58a
2 changed files with 30 additions and 26 deletions

View file

@ -1,3 +1,5 @@
"use strict";
/** @define {boolean} */
var DEBUG = true;
@ -26,7 +28,7 @@ var
/** @const */ LOG_MOUSE = 0x000400,
/** @const */ LOG_PCI = 0x000800,
/** @const */ LOG_BIOS = 0x001000,
/** @const */ LOG_CD = 0x002000,
/** @const */ LOG_FLOPPY = 0x002000,
/** @const */ LOG_SERIAL = 0x004000,
/** @const */ LOG_DISK = 0x008000,
/** @const */ LOG_RTC = 0x010000,
@ -64,7 +66,7 @@ var LOG_NAMES = [
[LOG_MOUSE, "MOUS"],
[LOG_PCI, "PCI"],
[LOG_BIOS, "BIOS"],
[LOG_CD, "CD"],
[LOG_FLOPPY, "FLOP"],
[LOG_SERIAL, "SERI"],
[LOG_RTC, "RTC"],
[LOG_HPET, "HPET"],

View file

@ -160,7 +160,7 @@ FloppyController.prototype.set_state = function(state)
FloppyController.prototype.port3F0_read = function()
{
dbg_log("3F0 read", LOG_DISK);
dbg_log("3F0 read", LOG_FLOPPY);
return 0;
};
@ -168,7 +168,7 @@ FloppyController.prototype.port3F0_read = function()
FloppyController.prototype.port3F4_read = function()
{
dbg_log("3F4 read", LOG_DISK);
dbg_log("3F4 read", LOG_FLOPPY);
var return_byte = 0x80;
@ -187,7 +187,7 @@ FloppyController.prototype.port3F4_read = function()
FloppyController.prototype.port3F7_read = function()
{
dbg_log("3F7 read", LOG_DISK);
dbg_log("3F7 read", LOG_FLOPPY);
return 0x00;
}
@ -195,20 +195,22 @@ FloppyController.prototype.port3F5_read = function()
{
if(this.response_index < this.response_length)
{
dbg_log("3F5 read: " + this.response_data[this.response_index], LOG_DISK);
dbg_log("3F5 read: " + this.response_data[this.response_index], LOG_FLOPPY);
this.cpu.device_lower_irq(6);
return this.response_data[this.response_index++];
}
else
{
dbg_log("3F5 read, empty", LOG_DISK);
dbg_log("3F5 read, empty", LOG_FLOPPY);
return 0xFF;
}
};
FloppyController.prototype.port3F5_write = function(reg_byte)
{
dbg_log("3F5 write " + h(reg_byte), LOG_DISK);
if(!this.fda_image) return;
dbg_log("3F5 write " + h(reg_byte), LOG_FLOPPY);
if(this.bytes_expecting > 0)
{
@ -223,7 +225,7 @@ FloppyController.prototype.port3F5_write = function(reg_byte)
var log = "3F5 command received: ";
for(var i = 0; i < this.receiving_index; i++)
log += h(this.receiving_command[i]) + " ";
dbg_log(log, LOG_DISK);
dbg_log(log, LOG_FLOPPY);
}
this.next_command.call(this, this.receiving_command);
@ -272,7 +274,7 @@ FloppyController.prototype.port3F5_write = function(reg_byte)
break;
case 0x0E:
// dump regs
dbg_log("dump registers", LOG_DISK);
dbg_log("dump registers", LOG_FLOPPY);
this.response_data[0] = 0x80;
this.response_index = 0;
this.response_length = 1;
@ -290,7 +292,7 @@ FloppyController.prototype.port3F5_write = function(reg_byte)
FloppyController.prototype.port3F2_read = function()
{
dbg_log("read 3F2: DOR", LOG_DISK);
dbg_log("read 3F2: DOR", LOG_FLOPPY);
return this.dor;
}
@ -302,18 +304,18 @@ FloppyController.prototype.port3F2_write = function(value)
this.cpu.device_raise_irq(6);
}
dbg_log("start motors: " + h(value >> 4), LOG_DISK);
dbg_log("enable dma: " + !!(value & 8), LOG_DISK);
dbg_log("reset fdc: " + !!(value & 4), LOG_DISK);
dbg_log("drive select: " + (value & 3), LOG_DISK);
dbg_log("DOR = " + h(value), LOG_DISK);
dbg_log("start motors: " + h(value >> 4), LOG_FLOPPY);
dbg_log("enable dma: " + !!(value & 8), LOG_FLOPPY);
dbg_log("reset fdc: " + !!(value & 4), LOG_FLOPPY);
dbg_log("drive select: " + (value & 3), LOG_FLOPPY);
dbg_log("DOR = " + h(value), LOG_FLOPPY);
this.dor = value;
}
FloppyController.prototype.check_drive_status = function(args)
{
dbg_log("check drive status", LOG_DISK);
dbg_log("check drive status", LOG_FLOPPY);
this.response_index = 0;
this.response_length = 1;
@ -322,7 +324,7 @@ FloppyController.prototype.check_drive_status = function(args)
FloppyController.prototype.seek = function(args)
{
dbg_log("seek", LOG_DISK);
dbg_log("seek", LOG_FLOPPY);
dbg_assert((args[0] & 3) === 0, "Unhandled seek drive");
this.last_cylinder = args[1];
@ -333,7 +335,7 @@ FloppyController.prototype.seek = function(args)
FloppyController.prototype.calibrate = function(args)
{
dbg_log("floppy calibrate", LOG_DISK);
dbg_log("floppy calibrate", LOG_FLOPPY);
this.raise_irq();
}
@ -341,7 +343,7 @@ FloppyController.prototype.calibrate = function(args)
FloppyController.prototype.check_interrupt_status = function()
{
// do not trigger an interrupt here
dbg_log("floppy check interrupt status", LOG_DISK);
dbg_log("floppy check interrupt status", LOG_FLOPPY);
this.response_index = 0;
this.response_length = 2;
@ -360,13 +362,13 @@ FloppyController.prototype.do_sector = function(is_write, args)
read_offset = ((head + this.number_of_heads * cylinder) * this.sectors_per_track + sector - 1) * sector_size;
dbg_log("Floppy " + (is_write ? "Write" : "Read"), LOG_DISK);
dbg_log("from " + h(read_offset) + " length " + h(read_count * sector_size), LOG_DISK);
dbg_log(cylinder + " / " + head + " / " + sector, LOG_DISK);
dbg_log("Floppy " + (is_write ? "Write" : "Read"), LOG_FLOPPY);
dbg_log("from " + h(read_offset) + " length " + h(read_count * sector_size), LOG_FLOPPY);
dbg_log(cylinder + " / " + head + " / " + sector, LOG_FLOPPY);
if(!args[4])
{
dbg_log("FDC: sector count is zero, use data length instead", LOG_DISK);
dbg_log("FDC: sector count is zero, use data length instead", LOG_FLOPPY);
}
if(!this.fda_image)
@ -426,12 +428,12 @@ FloppyController.prototype.done = function(args, cylinder, head, sector, error)
FloppyController.prototype.fix_drive_data = function(args)
{
dbg_log("floppy fix drive data " + args, LOG_DISK);
dbg_log("floppy fix drive data " + args, LOG_FLOPPY);
}
FloppyController.prototype.read_sector_id = function(args)
{
dbg_log("floppy read sector id " + args, LOG_DISK);
dbg_log("floppy read sector id " + args, LOG_FLOPPY);
this.response_index = 0;
this.response_length = 7;