> > > USBboot.exe is written in the SwiftForth dialect of Forth.
> > > FAT32ldr.bin and kernel.bin are writen in NASM.
> > > USBboot is designed to allow colorForth or another operating system to be run from a USB drive. The colorForth port will be done ASAP...
> > > Feedback welcome,
> > > Enjoy!
> > > Howerd
> > I have just released USBboot, a selection of three files to make a USB drive bootable :- Hide quoted text -
> > - Show quoted text -
> This is excellent! Thank you for sharing this, Howerd! I'll give this
> a try tonight!
Thanks for the comment :-)
Basically USBboot is the Windows version of cfDOS. I have been surprised by how much harder it was to achieve the same thing in Windows/USB compared to DOS/Floppy - maybe 10 x harder.
Firstly you've got the never ending battle to make anything work on the latest version of Windows. With Win7 you must "Run as administrator"...
Then there is BIOS USB versus Floppy Disk hardware - somehow floppy disk hardware got integrated into the PC glue logic in the same way on almost all PCs from the 1990's onwards. USB is way to complicated to fit into one 512 byte sector, so you have to use the BIOS.
Then USB drives can be formatted in at least two ways, with or without an MBR, with varying disk parameters, and there is only reverse engineered documentation about how a BIOS deals with this, and only guesswork about what Windows does.
Then there is LBA versus CHS - a comment on OSdev.org said that all BIOS's since the 1990's support LBA, and this is true of every PC and laptop that I have access to - so thankfully CHS is gone...
Then there is how Windows decides to format a USB drive - not only FAT12,16,32 or NTFS, but whether to use an MBR or not, and whatever it decides it will certainly not be the way the USB drive manufacturer did it.
And not forgetting my favourite, FAT32. There are just enough strange offsets and bizarre calculations to make the official MS document a challenging read.
I defined USBboot as "working" when it successfully made all of my USB drives (and an SDCard in a card reader) boot. This has taken a lot of evenings and weekends sporadically over the last year or so...
If anyone finds a USB drive that does not work, press 'C' to capture the important sectors to a file and send it to me :-)
> Here is the code for (u.r) :
> : (U.R) ( u n -- addr len )
> >R 0 (D.) R@ OVER - 0 MAX 0 ?DO BL HOLD LOOP #> R> MIN ;
Thanks. It works now.
One another thing: the variable ptrDeviceNotificationHandle always has
its value stop at 32, even quit the program immediately without an USB
drive plug in. The way of handling its balance seems a little strange to me:-)
On Oct 16, 4:23 am, jfong <jf...@ms4.hinet.net> wrote:
> Hower wrote：
> > Here is the code for (u.r) :
> > : (U.R) ( u n -- addr len )
> > >R 0 (D.) R@ OVER - 0 MAX 0 ?DO BL HOLD LOOP #> R> MIN ;
> Thanks. It works now.
> One another thing: the variable ptrDeviceNotificationHandle always has
> its value stop at 32, even quit the program immediately without an USB
> drive plug in. The way of handling its balance seems a little strange to me:-)
> Best Regards,
ptrDeviceNotificationHandle is just a pointer into the array of device
notifications, and I limit it to between 0 and 31 so that I cannot
overflow the array.
Yes, if you request more than 32 different device notifications its
behaviour would be very strange ;-)
But I warn you if this happens. I always like to protect arrays in
On Oct 16, 9:20 am, jfong <jf...@ms4.hinet.net> wrote:
> Howerd wrote：
> > ptrDeviceNotificationHandle is just a pointer into the array of device
> > notifications, and I limit it to between 0 and 31 so that I cannot
> > overflow the array.
> I saw this variable increments in both the words "Unregist...Notification"
> and "Regist...Notification", but only decrements once in the word
> "InitRegist...Notifications". It logically confuse me.
> By the way, the word "ShowBPB" didn't clean its stack input. Although
> no harm, but seems is unexpected.
> Op Mon, 15 Oct 2012 09:29:00 -0700 (PDT) schreef Howerd:
>> On Oct 15, 12:32 pm, jfong <jf...@ms4.hinet.net> wrote:
>>> Howerd ... wrote：
>>>> I have just released USBboot, a selection of three files to make a USB drive bootable :
>>>> USBboot.exe is written in the SwiftForth dialect of Forth.
>>> What SwiftForth version you use? I had try to include USBboot.f under
>>> version 3.2.5 but failed when encounter the word (u.r).
>> Hi Jach,
>> I have SwiftForth version 3.4.1 14-Sep-2011 .
>> Here is the code for (u.r) :
>> : (U.R) ( u n -- addr len )
>> >R 0 (D.) R@ OVER - 0 MAX 0 ?DO BL HOLD LOOP #> R> MIN ;
>> Best regards,
> What is the last MIN for? It truncates '12345 3 U.R' to '123'
> Maybe useful for tables, but no Forth with .R words I know does this, all
> will print '12345'
You have specified that it is supposed to fit in a field 3 spaces wide. If it won't fit, do you want the most significant digits or a messed-up table? If you want all the digits, leave out the MIN. Easy to do.
Elizabeth D. Rather (US & Canada) 800-55-FORTH
FORTH Inc. +1 310.999.6784
5959 West Century Blvd. Suite 700
Los Angeles, CA 90045
"Forth-based products and Services for real-time
applications since 1973."
I have added the option to copy the file KERNEL.IMG to the USB drive - finding the drive letter from an inserted USB drive is unreasonably difficult, for reasons that are explained by Microsoft, but that I don't really understand.
This functionality may fail if you choose to insert two USB drives while running USBboot.exe, and Windows decides to allocate the drive letter in reverse numerical order. If this happens, the file KERNEL.IMG will get copied to the wrong drive, so please, just one USB drive at a time :-)
I have also included cf2012,the colorForth NASM sources which I hope will one day be adapted to boot from a FAT32 USB drive, either by me or someone else with more free time...
If any one has a PC BIOS based Forth running in Real Mode from segment:address 0x1000:0x0000, or can make one, please let me know. This can then be the first Forth to be run by the FAT32 boot loader.
I have to leave the strange world of Windows USB and BIOS bootloaders and return to the real world - alas I may not have a lot of free time for a while...