Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local term = require("term")
- local floppy = component.drive
- local fs = require("filesystem")
- local io = require("io")
- local capacityInit = floppy.getCapacity()
- local capacity = capacityInit/1024
- local fileName = ""
- local dataToWrite = ""
- local offset = 0
- local function copyData()
- file:seek(offset)
- dataToWrite = file:read(offset)
- floppy.writeByte(dataToWrite)
- end
- term.clear()
- term.write("Floppy's capacity is ".. capacity .. " kilobytes")
- term.setCursor(1,2)
- term.write("What file would you like to write to the floppy disk? File must be in the same folder as this program.")
- term.setCursor(1,3)
- fileName = term.read()
- term.setCursor(1,3)
- term.write(" ")
- term.setCursor(1,3)
- term.write("Writing to Floppy...")
- local file = fs.open(fileName, "r")
- while (dataToWrite ~= nil) do
- dataToWrite = file:read(offset)
- floppy.writeByte(offset, dataToWrite)
- offset = offset + 1
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement