Jiffy DOS software implementation

Started by Hydrophilic, November 30, 2009, 08:24 PM

Previous topic - Next topic

0 Members and 4 Guests are viewing this topic.

Hydrophilic

This thread could go under sever topics / boards of C128 Alive! but I decided on this place.

What I want is software that I can download to my C128 or my C64 imposter (C128 in C64 mode) that will give me the fast speed of JiffyDOS when used with an appropriate device.

For example, I own a 1571 with JiffyDOS and I own a uIEC/SD, but my C128 does NOT have JiffyDOS ROMs.  I would like to take advantage of JiffyDOS speed with my uIEC/SD even though I do not have C128 JiffyDOS ROMs installed.

I have a LOT of experience with writting fast-loaders for both C64 and C128, so I can write software to take advantage of such devices, even if I don't have the ROMs installed on my C128.

But, does anyone know of existing Software JiffyDOS, on the PC side???

This is just so I'm not re-inventing the wheel.  I am perfectly capable or writing my own version if needed... I have a LOT of fast-loader experience for 1541/1571/1581/c64/c128...

BTW, I think this would be usefull to many people.  Those with 1541/71/81 with JiffyDOS or users of SD2IEC or uIEC, but not JiffyDOS in there C64/C128.

If such software does not exist, I will write both C64 and C128 versions.
I'm kupo for kupo nuts!

Diddl

Quote from: Hydrophilic on November 30, 2009, 08:24 PM
What I want is software that I can download to my C128 or my C64 imposter (C128 in C64 mode) that will give me the fast speed of JiffyDOS when used with an appropriate device.

You need JLOAD. JLOAD is available for C64 (maybe C128 in C64 mode) and for VIC.

For VIC also JSAVE is available. Standalone (loadable) or always in Final Expansion.

Hydrophilic

#2
Searching for JLOAD gives me lots of links to Pop Music!  Filtering the results I only get a few pages... this page (grrr), an issue of Commodore World from '96 where I could find no info, and Denial / Vic-20 forums.

I'm guessing you are the same Diddl that did the FE3 for the Vic-20?  That's pretty cool!

On Denial there was some talk of JLOAD or SJLOAD but no downoads or links (directly).  Well, I finally found source code (SJLOAD04.ZIP) on the FE3 firmware source page.  Thanks!

That is a C64 version modified for Vic-20.  I guess I get to make the C128 version?

I also tried the C64 Scene Database but couldn't find anything there...

Although I haven't looked at SJLOAD source code much, I did spend quite a while with VICE single-stepping through a JiffyDOS file load.  I've got several pages of notes!  It seems JiffyDOS is a fairly standard 2-bit x4 turbo loader, with the main difference being how it identifies JiffyDOS devices connected to the computer: when sending LISTEN or TALK commands, the computer will wait a very long time after sending data bit 6 before proceeding to send the final data bit 7.  If a JiffyDOS device is connected, it will respond by toggling the DATA line during this period.

Oh, I almost forgot, there was some mention on Denial about PAL / NTSC conflicts.  Is this true of JiffyDOS?  I've never heard of such a thing, but I did notice in my testing that JiffyDOS (on the computer side) makes no compensation for frequency standard.

Edit
After reviewing the source above, it is not particularly useful because the Vic-20 doesn't use a CIA for disk I/O like the C64 and C128.  I'm really good with the CIA but not with that on Vic-20... does it use a VIA?  Also the comments are a bit sparse and in a mixture of English and German.  I only recently started learning German, so it causes me a lot of confusion!

On searching for SJLOAD, however, I found the C64 source; check it out.  That page has a link to a D64 disk image and the source code.  Because the source is for the C64 using the CIA, I understand it better.  The comments range from sparse to detailed.

I'll give it a try and see how it works in C64 mode (it's been so long... how do I activate that now  :P ).  Then I get to make a C128 version... unless somebody knows of an existing one?

Edit 2
On examing the source code for the C64 version, I discovered two things.  First, a lot of the comments match up with my notes I made from my VICE testing (this is good).  However, the source code is hard-coded to used the default VIC bank ($0000~$3FFF) and UserPort bit PA2 grounded (0 volts).  Not only is trashing the VIC / UserPort settings bad, but the default setting of PA2 is +5 volts!

One of the things I discovered while testing JiffyDOS in VICE is that it does a good job at being compatible.  In other words, it works with any VIC bank and doesn't muck with the UserPort lines.  So now I'm considering a complete rewrite.  Opinions?
I'm kupo for kupo nuts!

RobertB

Quote from: Hydrophilic on December 04, 2009, 12:52 PM
...there was some mention on Denial about PAL / NTSC conflicts.  Is this true of JiffyDOS?  I've never heard of such a thing, but I did notice in my testing that JiffyDOS (on the computer side) makes no compensation for frequency standard.
I do know that there are different versions, i.e., NTSC VIC-20 JiffyDOS, PAL VIC-20 JiffyDOS, NTSC Plus4 JiffyDOS, and PAL Plus4 JiffyDOS.

               Truly,
               Robert Bernardo
               Fresno Commodore User Group
               http://videocam.net.au/fcug
               The Other Group of Amigoids
               http://www.calweb.com/~rabel1/
               Southern California Commodore & Amiga Network
               http://www.sccaners.org

Diddl

Pardon, I did mean SJLOAD!

NTSC/PAL is not a real problem. SJLOAD works with both devices as I know. We test it with a NTSC C64 and a NTSC VIC-20.


Hydrophilic

NTSC in Austria is a neat trick!  Well, I'm glad PAL/NTSC issues are something I shouldn't have to worry about.

I wrote up some rudimentary code in the ML Monitor in C128 mode and tested it on VICE.  So far so good.  Only tested recognizing JiffyDOS devices and sending data with Jiffy protocol.  I then made sure it works for non-JiffyDOS devices using both standard/slow and fast bus protocols.

That part I wrote in the Monitor is less than 0.5kiB, but for complete read/write and turbo load (much faster than byte-wise Jiffy read) will require quite a bit more code so I started translating it to assembler before things get out of hand...

Translation is taking a while because I have a tendency to write a lot of comments.  Once I get it all working in VICE, I'll test it with my uIEC and both 1571's (one of which has JiffyDOS) on a real C128.

Obviously I could just steal code from C64 source, but I wouldn't learn as much that way!  I'll refer to it if I get stuck.

BTW, I noticed while writing the C128 port, that there is a serious bug in the KERNAL serial routines that I've never heard reported before... maybe it isn't that serious after all?

Anyway, sometimes (like after sending a command byte via Listen or Talk) the KERNAL will re-enable IRQs but then continue mucking with the $DD00 port register.  This could result in VIC screen / UserPort corruption if an interrupt routine were to change these bits (bits 0 to 2).  Comments?
I'm kupo for kupo nuts!

Diddl

Quote from: Hydrophilic on December 07, 2009, 02:33 PM
NTSC in Austria is a neat trick!

Not a trick. Most TV sets here are able to work with NTSC also. I also was surprised as Jogi from forum64 vistis me at home and connect his NTSC VIC to my TV set. It works fine like a normal PAL VIC

Hydrophilic

Maybe it is not a "trick", but it is still neat!  PAL video does not work on most things in U.S.A... yay Austria!

On topic, I got source code for C128 JiffySoft (my name) working in VICE supporting slow/fast/Jiffy read and write at low-level routines last night (things like Talk, Listen, Untalk, Second, Acptr).

Tonight I will work on high-level routines like Open, ChkIn, BsOut, and maybe Load/Save/Verify.  In particular, Load (maybe Save too) will take longer to write because JiffyDOS does not simply call Acptr for each byte, but uses an optimized approach.  Similar to burst load where a full sector is loaded in a single routine.
I'm kupo for kupo nuts!

Diddl

Quote from: Hydrophilic on December 09, 2009, 03:03 PM
Similar to burst load where a full sector is loaded in a single routine.
very nice!  :)

Do you plan to release this with source code? So I could do same for VIC version. I didn't check how this fast load is working so VIC SJLOAD version does only load at slower speed.

Hydrophilic

Quote from: Diddl on December 09, 2009, 06:00 PM
Do you plan to release this with source code?
Yes.
Quote from: DiddlSo I could do same for VIC version.
Another VIC version...cool, have fun!
I'm kupo for kupo nuts!

Hydrophilic

I have finished testing v0.3 of "jiffy soft 128".  Here is a web page that describes it.  Here is the disk imageHere is the source code.  Let me know how it (does not) work for you!
I'm kupo for kupo nuts!

Diddl

Thank you!

Will update my SJLOAD for VIC with your improved code after Xmas holidays.

airship

Any chance for a burnable version of JiffySoft 128?
Serving up content-free posts on the Interwebs since 1983.
History of INFO Magazine

Hydrophilic

Quote from: airshipAny chance for a burnable version of JiffySoft 128?

Having it in ROM would be soooo much better than installing to RAM as it is now.  But, wouldn't that be JiffyDOS itself?  Just what kind of legal trouble are you trying to get me into!?

As I understand it, you can get JiffyDOS from Jim Brain's storefront.  However looking at the site, it seems these are just images of the firmware, not actual (EP)ROMs that you can plug into your C128.

That reminds me: one major problem that I thought of but didn't mention on my web page (or in the source code) is there are no vectors for low-level routines.  Any software that mixes calls to high level routines (like Open, ChkIn) with low-level calls (like Acptr) will behave badly or crash.  If this were put in ROM, then there would be no problem.
I'm kupo for kupo nuts!

Diddl

@Hydrophilic

Very nice work!! Your code is like school exercise, very fine documented and clearly structured.

Now I understand how jiffy load works, change sa to 1 and TALK again. Didn't understand this on old SJLOAD sources for C64. And your CHKIN/CHKOUT vector procedures are also much better than old SJLOAD cause not only LOAD work fast but also normal data transfer with OPEN, GET# ...

I'm impressed!

Thank you very much for this present to CBM community. Will try to do same for VIC-20 version.

brain

#15
Quote from: Hydrophilic on December 19, 2009, 09:16 AM

As I understand it, you can get JiffyDOS from Jim Brain's storefront.  However looking at the site, it seems these are just images of the firmware, not actual (EP)ROMs that you can plug into your C128.

The ROMs are available ($35.00 for the C128 set, $40.00 for the C128D triple set, $20 for other ROMs).  I will put them in the storefront pronto.  People can PM or email for more information.

Note that SJLOAD sits in somewhat a gray area of copyright.  Unless the core transfer routines have been modified since I last saw them, they are almost identical to the copyrighted JD ones. 

Personally, I don't see an issue with SJLOAD, due to the target audience.  Many gamers and other users who just want decreased load times would never consider buying a JD, so I don't see any overlap.  Obviously, with a limited functionality, there's a natural stepping stone to an actual JD ROM overlay.

This code, though, is sliding into a no-man's-land concerning the copyright.  I can't use my "It's only the LOAD function" defense if the copyright holder protests. 

As I'm not the copyright holder, and it's not a pirated ROM image, I don't have any clear direction on this, but folks might want to consider ensuring the functionality stays a bit more limited.  Note that I'd give the same advice regardless of my licensee status, for what it is worth.  I think if only loads/gets were supported, I could continue to use my "load" defense if there is a protest.

As well, my apologies for not seeing this thread earlier and helping with information.  I check this forum on a regular basis, but I use the "unread" link to quickly scan new messages, and this thread did not (and does not) show up on that search.  I have no idea why.

Jim

brain

One thing I would recommend is to reimplement SJLOAD64 functionality using this codebase.  I know the original author of SJLOAD, and he mainly intended it as a proof of concept, not a shipping product. 

Hydrophilic

I don't think I'll ever find the time to do a C64 port.  I'll leave that to the 64 programmers.

Putting this in a ROM image is very gray indeed.  For one thing the author of JiffyDOS did a fine job and I don't want to be robbing him (or those licensed to sell JiffyDOS) of anything.  If the JiffyDOS protocol were patented then I never would have published SJ128.

However the software is original, not copied.  What I did was use VICE to see what JiffyDOS was doing, and how many cycles were used, etc. and made a ton of notes.  Then I wrote the source by referencing both the C128 KERNAL code and my notes.  In particular, reconstructing the 16 byte table used to trasmit bytes based only on my notes was a bit tricky...

I also recently noticed that single byte transmission (or was it reception) is not checking for device time out.  Since neither the VICE emulated JiffyDOS device nor my uIEC ever had time-out errors, I didn't realise this until I decided to compare my code with JLOAD (64).  The fix would require 4 bytes as I recall and should still fit in the segmented memory configuration I came up with.  By the way, I had to do some crunching to get it to fit in the first place, which should be appearant if you read the source.

Anyway, I updated my webpage with some more info about SJ128 and added some images showing the timing of JiffyDOS.  I've attached them here for your viewing convenience.
I'm kupo for kupo nuts!

Diddl

Best way is to buy Jiffy for whole equipment.

But if someone has a µIEC and soldered kernel (no socket), SJLOAD is a good way to use µIEC in a faster way as usual.


I am fan of parallel speeder like Dolphin or Professional DOS. I am waiting hard for a µIEC with parallel connector to my userport and Dolphin or SpeedDos compatibility.

Parallel is always better than seriell, although Jiffy is really very very good!

brain

Quote from: Hydrophilic on January 06, 2010, 02:51 PM
Putting this in a ROM image is very gray indeed.  For one thing the author of JiffyDOS did a fine job and I don't want to be robbing him (or those licensed to sell JiffyDOS) of anything.
As the licensee, I appreciate that :-)
Quote

However the software is original, not copied.  What I did was use VICE to see what JiffyDOS was doing, and how many cycles were used, etc. and made a ton of notes.  Then I wrote the source by referencing both the C128 KERNAL code and my notes.  In particular, reconstructing the 16 byte table used to trasmit bytes based only on my notes was a bit tricky...
Then, I think you are good to go, then.  However, I think the VIC port and the 64 port need to be rewritten to use your code, since I understand the original 64 routines were just lifted from JD.  I know you're not planning to do it, but I hope someone reads this and takes care of this issue.
Quote
I also recently noticed that single byte transmission (or was it reception) is not checking for device time out.  Since neither the VICE emulated JiffyDOS device nor my uIEC ever had time-out errors, I didn't realise this until I decided to compare my code with JLOAD (64).  The fix would require 4 bytes as I recall and should still fit in the segmented memory configuration I came up with.  By the way, I had to do some crunching to get it to fit in the first place, which should be appearant if you read the source.
Is the error check not done in the original JD as well?  If so, could I trouble you to explain it to me?  I am looking for ways to improve the product (fixing bugs, mainly) and this would help.

Jim

Hydrophilic

#20
I looked at the code I released and noticed the correction is in there already!  (saves me a rebuild and re-release)  It is in reception of byte from Jiffy device (a.k.a. Acptr, Jin).  It took 5 bytes instead of 4, but worth every byte.

Quote from: SJ128
bpl JiEOI ;okay
lda #$42 ;EOI + talker error
.byte $2c ;skip next opcode

The test is already present in the C64 JiffyDOS ROM.  It uses 7 bytes.

Quote from: C64 JiffyDOS
fbf7 bpl $fc1d
fbf9 lda #$42
fbfb jmp $edb2 ;update status ($90) and release ATN/CLK/DATA

The main difference is my code doesn't release DATA -- the C128 stays in "listening" mode and returns whatever byte was read (probably junk).  JiffyDOS (like KERNAL) releases all serial lines, with delay, and then returns junk for sure (whatever is in $dd00 at the end).  In either version, it returns with carry flag clear.  I've always thought that odd of the KERNAL.

I don't think my version would cause trouble, but could be "fixed" by change .byte $2c into JMP $e42a (assuming the extra 2 bytes would not cause alignment issues).  In the C128 KERNAL, the $e42a code is similar to C64 $edb2, but it also clears "use fast serial" flag (bit 7 of $a1c).

I should also point out that I don't know how SJLOAD (64) does it, nor do I know how JiffyDOS for Vic-20, Plus4, or C128 do it.  I only studied JiffyDOS on C64 because I thought it would be the most original, easiest one to study.

Sorry for all confusion!

Edit
I had to hunt down that code fragment in the C64 JiffyDOS since I don't have my notes here and they don't include hard-coded values like addresses or table data.  That would be plagerism!  I did copy some stuff from C128 ROM... I hope CBM's lawyers don't come for me!
/Edit
I'm kupo for kupo nuts!

Diddl

@Hydrophilic

I did all your improvements implement into the VIC-20 SJLOAD version yesterday. It works fine as far I tested it.

You changed vectors BASIN,BASOUT,GETIN,CHKIN,CHKOUT and OPEN. Ich think for SJLOAD it is not nessecary to change OPEN vector, my    measuring of speed give no benefit for it. OPEN happens very rare and after it always comes a UNLISTEN, so normal speed is sufficient.

Will release it the next days. Thank you for this work on SJLOAD128

brain

If desired, I can link to the projects from the JiffyDOS site (for those who want to try before buying, etc.)

Let me know.

Jim

Diddl

Quote from: brain on January 08, 2010, 04:36 AM
If desired, I can link to the projects from the JiffyDOS site (for those who want to try before buying, etc.)

Maybe a good idea.

I don't want to reduce jiffy market. But maybe someone has a jiffy drive from ebay and with SJLOAD he would see the benefit of a jiffy kernal.

Someone who use a illegal Jiffy don't need SJLOAD. This people use a illegal Jiffy kernal with or without SJLOAD.

Maybe some µIEC customers want to use SJLOAD to get faster access to µIEC. And maybe it is cumbrously to load everytime SJLOAD and some will buy a real Jiffy kernal.

Hydrophilic

#24
Quote from: DiddlI did all your improvements implement into the VIC-20 SJLOAD version yesterday. It works fine as far I tested it.

Awesome!  This is the reason I released the source code as open source, so people like you can apply it to other machines like VIC-20 or C64 or Plus/4.  I'm glad you got it to work on VIC!!  In fact, I am suprised since the VIC does not work at 0.98 or 1.02 MHz like the C64 / C128 (with PAL or NTSC timing respectively).

Quote from: DiddlIch think for SJLOAD it is not nessecary to change OPEN vector, my    measuring of speed give no benefit for it. OPEN happens very rare and after it always comes a UNLISTEN, so normal speed is sufficient.

I will look at OPEN some more.  From what I am thinking (please note I have had many drinks tonight), OPEN will send Jiffy protocol request so that future commands, like Talk or Listen, will be with Jiffy speed.  This is not very important for programs that use small transfers with Open.  For example, a program that does OPEN then PRINT#15,"S0:FILENAME" will not have a good benefit...

But, for programs that do a lot of reading/writing of files, in other words lots of PRINT#x, DATA and / or INPUT#x, DATA this could mean a big speed benefit.  Programs that write SEQ or REL files should get a great benefit.  To be honest, I do not know of such programs for the C128, but I can think of some for the C64...

On second thought, after OPEN comes Unlisten as you say, and then later (like PRINT# or INPUT#) there is call to CHKIN and/or CHKOUT which send a command (TALK or LISTEN) which will activate Jiffy speed transfers... that is a great idea to reduce code size. Thanks for a great idea!!

Quote from: DiddlWill release it the next days. Thank you for this work on SJLOAD128
I hope VIC-20 users like it, and everbody is welcome.  And thank you for making the VIC-20 version... please post a link here when it becomes available.

Edit
I now see you have already posted a link for VIC-20.  And you did testing too.  40% faster is pretty good.  Thanks again for VIC-20 version!
/Edit

Quote from: BrainIf desired, I can link to the projects from the JiffyDOS site...
Okay by me.  The more who use it, the happier I am.  You should add some disclaimer that it does NOT have all the features of JiffyDOS.  For example, there is no PRINT SCREEN, PAUSE, F-KEY enhancements, or DOS Wedge.  (DOS Wedge not important for C128 or Plus/4, but very important for C64 and Vic-20).

Quote from: DiddlMaybe some µIEC customers want to use SJLOAD to get faster access to µIEC. And maybe it is cumbrously to load everytime SJLOAD and some will buy a real Jiffy kernal.

I made SJ128 because I have µIEC, and I think it should work with SD2IEC also.  Yes, it is cumbersome to load SJ128 everytime, so JiffyDOS ROM is the way to go for those people who are not afraid to open their C128 and replace a ROM or two... as I understand there are two ROMs needed for C128 JiffyDOS, correct?
I'm kupo for kupo nuts!