Microdrive: Number of free kilobytes stored after CAT

For experts to discuss very technical stuff and newbies to ask why the Spectrum they bought off ebay doesn't work.
Post Reply
User avatar
8BitSC
Microbot
Posts: 131
Joined: Mon Feb 13, 2023 1:23 am

Microdrive: Number of free kilobytes stored after CAT

Post by 8BitSC »

After CATting a Microdrive, is the number of free kilobytes on the cartridge accessible to BASIC?

I.e. if I CAT a drive from BASIC, can this number be stored as a variable?
User avatar
+3code
Manic Miner
Posts: 450
Joined: Sat Mar 19, 2022 7:40 am

Re: Microdrive: Number of free kilobytes stored after CAT

Post by +3code »

Sure there is a better method (with machine code), but a dirty one can be to use the screen$ function to "capture" the number printed in screen.
RST#08
Drutt
Posts: 31
Joined: Sun Jul 24, 2022 6:29 pm

Re: Microdrive: Number of free kilobytes stored after CAT

Post by RST#08 »

Check out page 41-42 of Ian Logan's Spectrum Microdrive Book. It should be a relatively simple task to add a counter to the program on page 41 to add up the '1's or '0's (instead of printing them) depending on whether you want to know 'free' or 'used' space. Note that each sector is 512 bytes, so you'll need to divide by two for a result in Kb.

https://spectrumcomputing.co.uk/entry/2 ... drive_Book
Post Reply