MCPcopy Create free account
hub / github.com/badvision/jace / write

Method write

src/main/java/jace/hardware/DiskIIDrive.java:161–184  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

159 }
160
161 void write() {
162 if (writeMode) {
163 while (diskUpdatePending.get()) {
164 // If another thread requested writes to block (e.g. because of disk activity), wait for it to finish!
165 Thread.onSpinWait();
166 }
167 // Holding the lock should block any other threads from writing to disk
168 synchronized (diskUpdatePending) {
169 if (disk != null) {
170 // Do nothing if write-protection is enabled!
171 if (getMediaEntry() == null || !getMediaEntry().writeProtected) {
172 dirtyTracks.add(trackStartOffset / FloppyDisk.TRACK_NIBBLE_LENGTH);
173 disk.nibbles[trackStartOffset + nibbleOffset++] = latch;
174 triggerDiskUpdate();
175 StateManager.markDirtyValue(disk.nibbles);
176 }
177 }
178 }
179
180 if (nibbleOffset >= FloppyDisk.TRACK_NIBBLE_LENGTH) {
181 nibbleOffset = 0;
182 }
183 }
184 }
185
186 void setLatchValue(byte value) {
187 if (writeMode) {

Callers

nothing calls this directly

Calls 5

getMediaEntryMethod · 0.95
triggerDiskUpdateMethod · 0.95
markDirtyValueMethod · 0.95
addMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected