Writing img files to 360K disks with no other PC

Software related questions
toddvernon
Posts: 47
Joined: Sat Feb 29, 2020 11:38 am

Writing img files to 360K disks with no other PC

Post by toddvernon »

Hey guys, sorry if this has been covered but I have not had any luck finding anywhere on the web. I'm a Mac user recreating my PCjr experience. Successfully found and fixed a PCjr, monitor, etc. Now I'm looking for a way to write diskette image files on diskettes.

I see a thread about doing it an old XT box and some software Mike wrote. Looks good but I don't currently have any of that stuff.

I'm curious if anyone has ever written software that takes a diskette image byte stream in from the serial port (perhaps sector by sector) and then writes it to the diskette on the PCJr. It would seem possible. I'm looking forward to the next run of jrIDE but until then looking for ways to go. Seems doable with Turbo Pascal and some of the other source available for this machine.

Thanks in advance!

-todd
Trixter
Posts: 720
Joined: Mon Sep 01, 2008 12:00 am
Location: Illinois, USA
Contact:

Re: Writing img files to 360K disks with no other PC

Post by Trixter »

This comes up every few years, but so far nobody has written a "bootstrap" for it. It would need to be a program that could be entered as a BASIC program with a series of DATA statements that could be POKED into memory and then executed, because the IBM PC ROM basic doesn't support the serial port. (It supports the cassette port though, and that might be easier.)

PCjr Cartridge BASIC does support the serial port, but since you'd still need machine language to write to the disk, it would be less typing to just do it all in the machine language.

If I were writing it (and I don't have time for several months, sorry), I'd do it like this:
  • BASIC program that has a machine-language bootstrap (see Appendix C in the PCjr BASIC manual).
  • Bootstrap would be very simple, would just open the serial port and accept incoming bytes, writing them to an area of memory.
  • Once finished, would just JMP to this memory, to execute what came through. This is the actual program that would stream a disk image over serial, format/write/verify disks, and prompt the user.
You're all insane and trying to steal my magic bag!
Hargle
Posts: 171
Joined: Wed Apr 27, 2011 3:53 pm

Re: Writing img files to 360K disks with no other PC

Post by Hargle »

I can see two utilities:
1) the bootstrap program as trixter outlines below. that would get you that critical first-ever disk written to supply DOS to the machine.
2) a DOS based program that simply allows the user to create additional disks over the COM port.

#2 might be a great project for the "let's learn assembly language" thread.
Trixter
Posts: 720
Joined: Mon Sep 01, 2008 12:00 am
Location: Illinois, USA
Contact:

Re: Writing img files to 360K disks with no other PC

Post by Trixter »

To clarify, I'd do it in three pieces, like this:
  1. Write tiny program that grabs bytes from COM1 and puts into memory, then JMPs to them. This is the stage1 loader.
  2. Embed stage1 loader into a BASIC program as a series of DATA statements which are then CALL'd as machine language. This is the bootstrap.
  3. Bootstrap is manually typed into ROM BASIC by the user, then RUN. This starts the stage1 loader.
  4. Stage1 loader transfers a larger program over. That larger program is the stage2 loader.
  5. Stage2 loader has a rudimentary user interface, transfers disk images over serial, performs error checking, formats/writes/verifies disks, etc.
I'm interested in writing all of this; it's very straightforward. The only real challenge is the size of the stage1 loader; I don't think a user is going to want to type more than about 20 lines of BASIC DATA statements, so it has to be as small as possible. Thankfully, every IBM ROM BIOS has int 14h support (even the original dated 04/24/81), so it should be relatively straightforward. (A secondary challenge would be ensuring the stage2 loader doesn't do anything that would piss off BASIC.)

The stage2 loader could certainly also be an executable .COM program, I guess... That way, once people have it on a diskette, they can just load it directly to transfer images directly to disks. However, this is a lower-priority need, since once you can write disk images at all, you can just transfer a disk image over that has FastLynx, interlnk/intersvr, mTCP, Xmodem, etc.

Fun project, but I don't have time to work on it until May at the earliest, and that's assuming I'll have the time even then. I could probably bang out the bootstrap and stage1 loader in a weekend though.
You're all insane and trying to steal my magic bag!
toddvernon
Posts: 47
Joined: Sat Feb 29, 2020 11:38 am

Re: Writing img files to 360K disks with no other PC

Post by toddvernon »

Great thoughts here guys. Really enjoying the creative thoughts. I'm in for helping out. I have an entire working system.....except the diskette drive apparently. I bought some sealed PC Dos 3.3 disks on ebay but I think the drive is a little messed up. The internal power supply had obviously fried and there was soot all over the inside. I replace the card and everything seemed to work fine. But trying to boot the disk spins, the head seeks and then it fails in various ways. Cleaned the heads and greased the rails but didn't help. I noticed that the drive is missing a chip that seems to be socketed in all photos of the qumetrack 142 drive photos I have seen. I took a flyer and bought a broken drive on eBay for the chip to see if that's the problem. Waiting for that.

Long story but almost booting, then im in to help. Can do assembly but not done anything in 20 years.

Thanks for all the responses! Seems like a good way to get images onto anything including and jrIDE!

-t
Brutman
Site Admin
Posts: 1331
Joined: Sat Jun 21, 2008 5:03 pm
Contact:

Re: Writing img files to 360K disks with no other PC

Post by Brutman »

I'm going to suggest a slightly different approach ... the US mail.

The easiest way to do this is to supply a bootable DOS 2.1 diskette with Procomm (or some other terminal emulator and file transfer program) and a disk writing utility that uses the serial port and can write data as it is streamed across the serial port. The other side of this program has to run on Windows or Linux and stream a diskette image through a serial port, presumably a USB to Serial device these days.

The kit version of this includes the diskette and a PCjr serial cable. A recommended/approved list of USB to Serial adapters is also probably a good idea.

The program needs to support speeds from 2400 to 9600. 9600 is possible but having fallbacks to 4800 or 2400 helps with dodge serial adapters and stray interrupts. Standard images from 160 to 360KB should be supported. Standard FORMAT.COM can be used to prep a diskette before streaming an image to it.
toddvernon
Posts: 47
Joined: Sat Feb 29, 2020 11:38 am

Re: Writing img files to 360K disks with no other PC

Post by toddvernon »

Thanks Mike, the part I wasn't sure of with this approach was the part where you could just stream the image file direct to the disk. I would have assumed that it would just create a big file on the disk. Or maybe what you are saying is it will do that but then you can use the utility you wrote to read that file from the floppy and write the image in disk format on another diskette?
Brutman
Site Admin
Posts: 1331
Joined: Sat Jun 21, 2008 5:03 pm
Contact:

Re: Writing img files to 360K disks with no other PC

Post by Brutman »

If you have a 360KB diskette image and a system with a single diskette drive you have a chicken and egg problem: the image (as a file) is bigger than anything the machine can store on a diskette. (This assumes no compression.)

So there are three ways around this:
  • Add storage to the machine big enough to hold a disk image. This can be a hard drive, a Zip drive, a 720KB diskette drive, a Backpack 1.44MB drive, a CD-ROM, etc. All of these are usually added through the parallel port, although jrIDE and some old SCSI adapters are sidecars.
  • Get a machine big enough to write the diskettes for the target machine. I used a 386-40 clone with a 1.44MB drive, a hard drive, and a 360KB floppy drive for this. It also has network connectivity.
  • Have a utility that runs on the target machine that can write a diskette image as it is streamed to the machine. Streaming through a serial port would be slow, but it's almost universally available. Streaming through a network would be faster, but you are still limited by the speed of the floppy disk.
I'm proposing the 3rd solution. But you still have to get the diskette with the utility on it forst.

Jim is thinking about something that you can do in BASIC to start the process. No US mail required for that.
toddvernon
Posts: 47
Joined: Sat Feb 29, 2020 11:38 am

Re: Writing img files to 360K disks with no other PC

Post by toddvernon »

Thanks guys.

I think I'm almost there. I got a Zip-100 parallel on eBay for the pcJr and a Zip-100 USB on eBay for my mac. Chuckphd53 is sending me the palmzip driver on a floppy (I'm going to buy it from the developer as well, just expediting) and then I "think" ill be bootstrapped. After that, I'm still very interested in solving the boot-zero problem that started this thread. The problem is only going to get worst as time goes on and it's a fun problem to tackle.

The pcJr really needs a JrIDE "like effort" to move files via thumb drive. The C64 world which I'm also a part of is super easy with sd2iec!

None the less super fun to figure it all out!

-t
ZiggyTheHamster
Posts: 46
Joined: Wed Jul 24, 2019 7:19 am

Re: Writing img files to 360K disks with no other PC

Post by ZiggyTheHamster »

This comes up all the time. Those of us who can write disk images easily (jrIDE) should maybe have a sticky somewhere so people can just send us (via eBay or whatever) some blank disks and we can then write whatever they want.

I like Trixter's idea of a bootstrap, but I like the idea of making a cassette bootstrap a lot more. It would be trivial to make a 3.5" headphone to cassette adapter, possibly even to make enough to sell, and the disk writing application could be written as a cassette-based program. Then, we could have a FLAC file of the audio (maybe even a little web app) and then anyone with a headphone port could get to a disk writer, without having to type in a bunch of DATA commands or special software on the remote end (you could use any terminal file transfer program instead). I don't know enough about the cassette interface, but it might even be possible to bundle a disk image with the bootstrapper. The only trouble I can think of is that I think the PCjr was meant to start/stop the tape itself, and that could be an issue, as well as the fact that I think you'd have to load the entire file into memory before writing it (meaning you'd need >400K RAM) and that it'd take about 25 minutes for a 360K disk. OTOH, I bet you could compress the image pretty heavily.
Post Reply