MCPcopy
hub / github.com/Eugeny/tabby / FloppyController

Function FloppyController

tabby-web-demo/data/v86_all.js:174–177  ·  view source on GitHub ↗
(a,b,c)

Source from the content-addressed store, hash-verified

172PCI.prototype.set_io_bars=function(a,b,c){var d=a.size;dbg_log("Move io bars: from="+h(b)+" to="+h(c)+" count="+d,LOG_PCI);for(var e=this.io.ports,f=0;f<d;f++){var k=e[b+f];e[b+f]=this.io.create_empty_entry();k.read8===this.io.empty_port_read8&&k.read16===this.io.empty_port_read16&&k.read32===this.io.empty_port_read32&&k.write8===this.io.empty_port_write&&k.write16===this.io.empty_port_write&&k.write32===this.io.empty_port_write&&dbg_log("Warning: Bad IO bar: Source not mapped, port="+h(b+f,4),LOG_PCI);
173k=a.entries[f];var g=e[c+f];dbg_assert(k&&g);e[c+f]=k;g.read8!==this.io.empty_port_read8&&g.read16!==this.io.empty_port_read16&&g.read32!==this.io.empty_port_read32&&g.write8!==this.io.empty_port_write&&g.write16!==this.io.empty_port_write&&g.write32!==this.io.empty_port_write||dbg_log("Warning: Bad IO bar: Target already mapped, port="+h(c+f,4),LOG_PCI)}};
174PCI.prototype.raise_irq=function(a){var b=this.device_spaces[a];dbg_assert(b);this.cpu.device_raise_irq(this.isa_bridge_space8[96+((b[15]>>8&255)-1+((a>>3)-1&255)&3)])};PCI.prototype.lower_irq=function(a){var b=this.device_spaces[a];dbg_assert(b);this.cpu.device_lower_irq(this.isa_bridge_space8[96+((b[15]>>8&255)+(a>>3&255)-2&3)])};function FloppyController(a,b,c){this.io=a.io;this.cpu=a;this.dma=a.devices.dma;this.bytes_expecting=0;this.receiving_command=new Uint8Array(10);this.receiving_index=0;this.next_command=null;this.response_data=new Uint8Array(10);this.floppy_size=this.response_length=this.response_index=0;this.fda_image=b;this.fdb_image=c;this.last_head=this.last_cylinder=this.drive=this.status_reg2=this.status_reg1=this.status_reg0=0;this.last_sector=1;this.dor=0;if(b){this.floppy_size=b.byteLength;if((c={160:{type:1,
175tracks:40,sectors:8,heads:1},180:{type:1,tracks:40,sectors:9,heads:1},200:{type:1,tracks:40,sectors:10,heads:1},320:{type:1,tracks:40,sectors:8,heads:2},360:{type:1,tracks:40,sectors:9,heads:2},400:{type:1,tracks:40,sectors:10,heads:2},720:{type:3,tracks:80,sectors:9,heads:2},1200:{type:2,tracks:80,sectors:15,heads:2},1440:{type:4,tracks:80,sectors:18,heads:2},1722:{type:5,tracks:82,sectors:21,heads:2},2880:{type:5,tracks:80,sectors:36,heads:2}}[this.floppy_size>>10])&&0===(this.floppy_size&1023))a.devices.rtc.cmos_write(CMOS_FLOPPY_DRIVE_TYPE,
176c.type<<4),a=c.sectors,b=c.heads,c=c.tracks;else throw"Unknown floppy size: "+h(b.byteLength);this.sectors_per_track=a;this.number_of_heads=b;this.number_of_cylinders=c}else a.devices.rtc.cmos_write(CMOS_FLOPPY_DRIVE_TYPE,64),this.floppy_size=this.number_of_cylinders=this.number_of_heads=this.sectors_per_track=0;this.io.register_read(1008,this,this.port3F0_read);this.io.register_read(1010,this,this.port3F2_read);this.io.register_read(1012,this,this.port3F4_read);this.io.register_read(1013,this,this.port3F5_read);
177this.io.register_read(1015,this,this.port3F7_read);this.io.register_write(1010,this,this.port3F2_write);this.io.register_write(1013,this,this.port3F5_write)}
178FloppyController.prototype.get_state=function(){var a=[];a[0]=this.bytes_expecting;a[1]=this.receiving_command;a[2]=this.receiving_index;a[4]=this.response_data;a[5]=this.response_index;a[6]=this.response_length;a[7]=this.floppy_size;a[8]=this.status_reg0;a[9]=this.status_reg1;a[10]=this.status_reg2;a[11]=this.drive;a[12]=this.last_cylinder;a[13]=this.last_head;a[14]=this.last_sector;a[15]=this.dor;a[16]=this.sectors_per_track;a[17]=this.number_of_heads;a[18]=this.number_of_cylinders;return a};
179FloppyController.prototype.set_state=function(a){this.bytes_expecting=a[0];this.receiving_command=a[1];this.receiving_index=a[2];this.next_command=a[3];this.response_data=a[4];this.response_index=a[5];this.response_length=a[6];this.floppy_size=a[7];this.status_reg0=a[8];this.status_reg1=a[9];this.status_reg2=a[10];this.drive=a[11];this.last_cylinder=a[12];this.last_head=a[13];this.last_sector=a[14];this.dor=a[15];this.sectors_per_track=a[16];this.number_of_heads=a[17];this.number_of_cylinders=a[18]};
180FloppyController.prototype.port3F0_read=function(){dbg_log("3F0 read",LOG_FLOPPY);return 0};FloppyController.prototype.port3F4_read=function(){dbg_log("3F4 read",LOG_FLOPPY);var a=128;this.response_index<this.response_length&&(a|=80);0===(this.dor&8)&&(a|=32);return a};FloppyController.prototype.port3F7_read=function(){dbg_log("3F7 read",LOG_FLOPPY);return 0};

Callers

nothing calls this directly

Calls 1

hFunction · 0.85

Tested by

no test coverage detected