How is one supposed to launch SJLOAD07?

Discuss anything related to the VIC
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: How is one supposed to launch SJLOAD07?

Post by tokra »

nbla000 wrote: Wed Feb 02, 2022 5:31 am In any case if you don't have/use pi1541 but just sd2iec devices or CBM drives with JiffyDOS there is no reason to install SJLOAD09.
Of course. I just wonder: There seems to be only one version of SJLOAD07. Is this PAL-only?
A self hacking runtime code is not possible because when you write on $9E00-$9FFF (Mega-Cart NV-RAM area)
Ah yes, forgot that. So the code itself would be a bit larger I suppose if it had to check $ede4 each time on the fly (in ROM, not self-modifying), probably too big for the free are in Mega-Cart.

In any case: Once you have the source ready, I'd sure like to have a go at it :)
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: How is one supposed to launch SJLOAD07?

Post by nbla000 »

Of course. I just wonder: There seems to be only one version of SJLOAD07. Is this PAL-only?
Yes and SJLOAD08 for PAL is exactly the same as SJLOAD07 PAL only.
Mega-Cart: the cartridge you plug in once and for all.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: How is one supposed to launch SJLOAD07?

Post by nbla000 »

tokra wrote: To be honest, my installed PAL-version of SJLOAD08 on the MegaCart works fine on my NTSC-VIC as well. At least I never noticed a problem.
Do you use a 1541/1571/1581 drive + Jiffy ROM or a sd2iec device?
Maybe the sd2iec firmware is much more timing tolerant then the original JiffyRom for the CBM drive...

From sd2iec firmware readme:
JiffyDOS:
=========
The JiffyDOS protocol has very relaxed timing constraints compared to
Turbodisk, but still not as relaxed as the standard Commodore IEC protocol.
Mega-Cart: the cartridge you plug in once and for all.
User avatar
tokra
Vic 20 Scientist
Posts: 1123
Joined: Tue Apr 27, 2010 5:32 pm
Location: Scheessel, Germany

Re: How is one supposed to launch SJLOAD07?

Post by tokra »

nbla000 wrote: Sat Feb 19, 2022 10:51 am Do you use a 1541/1571/1581 drive + Jiffy ROM or a sd2iec device?
Just an SD2IEC-device.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: How is one supposed to launch SJLOAD07?

Post by nbla000 »

tokra[/quote wrote: Just an SD2IEC-device.
This may explain why you didn't have problems.

I don't know how much the NTSC emulation of VICE 3.6.1 is accurate but using the SJLOAD07 to load items from a Vic-20 NTSC with 1541-II+JiffyDOS drive produce a ?FILE NOT FOUND error while seems that the 1581+JiffyDOS works anyway.

Yesterday I've tested my Vic-20 PAL + Mega-Cart with SJLOAD08 NTSC with a couple of SD2IEC devices and it works anyway but testing the pi1541 that fully emulate the 1541/1581 and requires, like VICE, the original JiffyDOS Rom image, it fails.

So for the final SJLOAD09 version I remove the PAL/NTSC check since in some circustance (SD2IEC drive, 1581?) works anyway but I remember NTSC users with problems by using SJLOAD07 with a 1541+JiffyDOS drive.
Mega-Cart: the cartridge you plug in once and for all.
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: How is one supposed to launch SJLOAD07?

Post by srowe »

Where is the master copy of SJLOAD? I've found the repo managed by ops https://github.com/ops/sj20 but that's not been updated for over a year.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: How is one supposed to launch SJLOAD07?

Post by nbla000 »

I don't know this repository, someone just published the file in cc65 format posted by Diddl on forum64 in DASM format.

For SJLOAD08, I remember that I've added a variable (PAL-NTSC) to compile also for NTSC with few differences but PAL output was the same.

I'm sure I've used the 08 version for Mega-Cart IO 2/3 installer version published on mega-cart.com site for both PAL and NTSC systems but I don't remember if and where I published sources, they should be on a my old PC not accessible at the moment.

At the moment for the SJLOAD09 version required to proper work with the pi1541, I'm working with binaries since requires just few bytes changes, I'm testing it but until the new pi1541 kernel is released I am waiting to publish it to make sure it works, then I will find sources and adapt and publish them.

At the moment as you reported v7/v8 for PAL works without problem with SD2IEC also for NTSC, while this is not always true for pi1541 that since is an exact emulator of the 1541/1581 drive requires the proper PAL/NTSC version to avoid problems.

By testing SJLOAD NTSC from a PAL machine, the pi1541 has problems like the "Jiffed" 1541/1581 drives since it use the same JiffyDOS while SD2IEC, much more tolerant since it has a custom JiffyDOS protocol implementation, seems that works anyway.

I'm waiting an NTSC machine for some additional tests with pi1541 but again, since I already know problems with current 1.24 kernel of pi1541 (quite solved with 1.25 beta kernal that I'm testing) I wait the final 1.25 version before to publish SJLOAD09.

Just be patient :wink:
Mega-Cart: the cartridge you plug in once and for all.
User avatar
ops
Vic 20 Dabbler
Posts: 88
Joined: Mon Feb 19, 2018 11:25 am
Location: Finland

Re: How is one supposed to launch SJLOAD07?

Post by ops »

srowe wrote: Sun Apr 10, 2022 12:33 pm Where is the master copy of SJLOAD? I've found the repo managed by ops https://github.com/ops/sj20 but that's not been updated for over a year.
What kind of updates are you thinking of? Works for me.
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: How is one supposed to launch SJLOAD07?

Post by srowe »

ops wrote: Mon Apr 11, 2022 11:33 am What kind of updates are you thinking of? Works for me.
I'm planning to integrate it with some code for my current project, I wanted to have the latest version including any compatibility fixes that nbla000 has.
User avatar
ops
Vic 20 Dabbler
Posts: 88
Joined: Mon Feb 19, 2018 11:25 am
Location: Finland

Re: How is one supposed to launch SJLOAD07?

Post by ops »

Works with PAL & NTSC. However, separate versions should be compiled. Is there somethin else?
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: How is one supposed to launch SJLOAD07?

Post by srowe »

Oh, I'd missed that it was a compile-time choice between PAL & NTSC. Aren't there versions where a single binary works on either platform (for carts like FE3)?

Edit: after comparing the matching functions in the FE3 code I can see that the timing adjustments are for PAL. There doesn't appear to be a compile-time option for NTSC.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: How is one supposed to launch SJLOAD07?

Post by Mike »

ops wrote:Works with PAL & NTSC. [...]
No. With SJLOAD07 (dating from 2010) and SJLOAD08 (the MC NVRAM version) there had been a somewhat unsound assumption it would work regardless which TV system, where actually the timing was correct for PAL only. SD2IEC devices seem to have a somewhat relaxed requirements.

In the core transfer loop for byte input, after the initial sync (.loop LDA $911F:AND #$03:BEQ loop) which itself has a jitter of 0..8 cycles, five LDA/ORA $911F read DATA/CLOCK for a 2-bit transfer in parallel. Their bus accesses happen at cycle # 51+0..8, 63+0..8, 74+0..8, 86+0..8 and 97+0..8. Ideally these accesses should be positioned near the middle of a bit time as sent by the drive (for the mean jitter of 4 cycles).

These are the timings in µs, with f_PAL = 1.108409 MHz, f_NTSC = 1.022727 MHz, rounded to the nearest µs:

Code: Select all

 cycles       t/µs (PAL)      t/µs (NTSC)  t/µs (Drive bit time)
                                           
min   max     min    max      min    max     min   mean   max
              
51 .. 59       46 .. 53        50 .. 58       45    50    55
63 .. 71       57 .. 64        62 .. 69       55    60    65
74 .. 82       67 .. 74        72 .. 80       65    70    76
86 .. 94       78 .. 85        84 .. 92       76    82    87
97 .. 105      88 .. 95        95 .. 103      87    92    97
The drive bit times were calculated under the assumption the SJLOAD07 transfer loop is correct for PAL timing. The middle of the bit times with 50/60/70/80+X/90+X µs seem to be plausible. For PAL, the accesses of $911F are all within the bit times. With NTSC, quite some accesses of $911F, especially the last ones, may happen outside the calculated drive bit times. There's no way the transfer loop as is could be correct for both PAL and NTSC.


P.S. above analysis is very much in line with a post I wrote about HYPRA SYSTEM some time ago: (link).
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Re: How is one supposed to launch SJLOAD07?

Post by nbla000 »

No. With SJLOAD07 (dating from 2010) and SJLOAD08 (the MC NVRAM version) there had been a somewhat unsound assumption it would work regardless which TV system, where actually the timing was correct for PAL only. SD2IEC devices seem to have a somewhat relaxed requirements.
This is right for SJLOAD07 but not for SJLOAD08, the main update I've done for SJLOAD08 is the NTSC compatibility by using 2 distinct versions.

From Mega-Cart revision 20 (2011), SJLOAD08 is integrated (both PAL/NTSC versions), from the Menu you simply select VIC +SJLOAD and the firmware will automatically uses the proper SJLOAD version PAL or NTSC according to the system you are using.

For old users I've also released the NVRAM version that can be "installed" for any revision and launched with a simply SYS40000 (CBM FileBrowser detects and uses it), unfortunatelly there is no space to include both PAL and NTSC versions plus music data and mc preferences so only for the NVRAM version, you have to install the proper version PAL or NTSC according with your system while as said for the integrated version you don't have to do nothing, just select the VIC+SJLOAD or VIC+3K +SJLOAD or VIC+32K +SJLOAD from the menu and the proper version will be used.

However as tokra reported the PAL NVRAM version of SJLOAD07 works with both systems if used with SD2IEC devices.
Mike wrote: Tue Apr 12, 2022 4:18 am There's no way the transfer loop as is could be correct for both PAL and NTSC.
Thanks Mike for your explanation.
Mega-Cart: the cartridge you plug in once and for all.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: How is one supposed to launch SJLOAD07?

Post by Mike »

nbla000 wrote:This is right for SJLOAD07 but not for SJLOAD08, the main update I've done for SJLOAD08 is the NTSC compatibility by using 2 distinct versions.
I had thought SJLOAD08 was 'just' that version especially tuned to be installed into the NVRAM of Mega-Cart, but so I stand corrected.

It is clearly feasible to have stand-alone versions of SJLOAD available (so non-MC owners can also use them), distinguishable by file name. For example, I had put SJLOAD07 into some releases (most notably, Mah Jongg) and that speeder only works on PAL VIC-20s. Thus far, I got no complaints from NTSC users that Mah Jongg with SJLOAD activated would not run - any kind of conclusions can be drawn from this, yes - but anyhow, I really would like to update my releases with a consolidated version pack of SJLOAD and would have no problems if it came as two separate binaries for PAL and NTSC. The boot loader in my programs then could load the correct version of SJLOAD by itself.
Thanks Mike for your explanation.
Unfortunately, this kind of application is one where emulation really has to be taken with a grain of salt. If it 'works' on emulation, you still can't be sure that the timing is not actually marginal.

The reference is the timing as delivered by original CBM drive JiffyDOS installations. The bit time length needs to be right and the delay between synchronisation and first bit time needs to be correct as well. That can't be done right just by assembling one version of code and the emulation telling you "everything's in order - move along, move along!". At least both (bit time) length and (synchronisation) delay need to be stress-tested to see where communication errors set in - and then choose values in the middle between the two extremes. That would put the fetch cycle of the LDA/ORA $911F instructions into their optimal positions. It is also quite unfortunate, that the initial synchronisation has a 0..8 cycle jitter. With "LDA #$03/.loop BIT $911F/BEQ loop", that jitter could be reduced by 2 cycles to a 0..6 cycle jitter.
User avatar
ops
Vic 20 Dabbler
Posts: 88
Joined: Mon Feb 19, 2018 11:25 am
Location: Finland

Re: How is one supposed to launch SJLOAD07?

Post by ops »

Mike wrote: Tue Apr 12, 2022 4:18 am
ops wrote:Works with PAL & NTSC. [...]
No. With SJLOAD07 (dating from 2010) and SJLOAD08 (the MC NVRAM version) there had been a somewhat unsound assumption it would work regardless which TV system, where actually the timing was correct for PAL only. SD2IEC devices seem to have a somewhat relaxed requirements.
Sorry for confusion. I and @srowe were talking about code in https://github.com/ops/sj20

This version supports PAL and NTSC.
Post Reply