MCPcopy Create free account
hub / github.com/BlitterStudio/amiberry / disk_doupdate_write

Function disk_doupdate_write

src/disk.cpp:4022–4112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4020}
4021
4022static int disk_doupdate_write(int floppybits, int trackspeed)
4023{
4024 int dr;
4025 int drives[4];
4026
4027 for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
4028 drive *drv2 = &floppy[dr];
4029 drives[dr] = 0;
4030 if (drv2->motoroff)
4031 continue;
4032 if ((selected | disabled) & (1 << dr))
4033 continue;
4034 drives[dr] = 1;
4035 }
4036
4037 while (floppybits >= trackspeed) {
4038 for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
4039 if (drives[dr]) {
4040 drive *drv2 = &floppy[dr];
4041 drv2->mfmpos++;
4042 drv2->mfmpos %= drv2->tracklen;
4043 if (drive_at_index(drv2, drv2->mfmpos, drv2->mfmpos)) {
4044 do_disk_index();
4045 }
4046 }
4047 }
4048 if (dmaen(DMA_DISK) && dmaen(DMA_MASTER) && dskdmaen == DSKDMA_WRITE && dsklength > 0 && fifo_filled) {
4049 bitoffset++;
4050 bitoffset &= 15;
4051 if (!bitoffset) {
4052 // fast disk modes, fill the fifo instantly
4053 if (currprefs.floppy_speed > 100 && !fifo_inuse[0] && !fifo_inuse[1] && !fifo_inuse[2]) {
4054 while (!fifo_inuse[2]) {
4055 uae_u16 w = chipmem_wget_indirect (dskpt);
4056 DSKDAT (w);
4057 dskpt += 2;
4058 }
4059 }
4060 if (disk_fifostatus() >= 0) {
4061#ifdef FLOPPYBRIDGE
4062 bool wasBridge = false;
4063#endif
4064 uae_u16 w = DSKDATR(0);
4065 for (dr = 0; dr < MAX_FLOPPY_DRIVES; dr++) {
4066 drive *drv2 = &floppy[dr];
4067 if (drives[dr]) {
4068 drv2->bigmfmbuf[drv2->mfmpos >> 4] = w;
4069 drv2->bigmfmbuf[(drv2->mfmpos >> 4) + 1] = 0x5555;
4070 drv2->writtento = 1;
4071#ifdef FLOPPYBRIDGE
4072 if (drv2->bridge) {
4073 wasBridge = true;
4074 drv2->bridge->writeShortToBuffer(side, drv2->cyl, w, drv2->mfmpos);
4075 }
4076#endif
4077 }
4078#ifdef AMAX
4079 if (amax_enabled)

Callers 1

DISK_updateFunction · 0.85

Calls 11

drive_at_indexFunction · 0.85
do_disk_indexFunction · 0.85
dmaenFunction · 0.85
DSKDATFunction · 0.85
disk_fifostatusFunction · 0.85
DSKDATRFunction · 0.85
amax_diskwriteFunction · 0.85
disk_dmafinishedFunction · 0.85
drive_write_dataFunction · 0.85
canloaddskbytrFunction · 0.85
writeShortToBufferMethod · 0.45

Tested by

no test coverage detected