Best way to create D64 or D71 files on a C128D?

Other Computers and Game Systems

Moderator: Moderators

User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

tokra wrote:Also there are no jmp in the routine itself, so it's relocatable.
Yes there are no JMP but there are fixed STA/LDA in the ML routines:

STA $C000,Y <- for the original C64 routine
LDA $C000,Y <- for the original C64 routine

The routine needs 256 bytes so I need another place to put the routine.

For example the Vic use $400-$430 to store the routine and $0f00-$0fff as temp buffer while the original C64 version use $1000-$1030 for the routine and $C000 $C0FF for the buffer.

So for the C128 $1300-$13FF will be the tmp buffer but where to put the routine ?
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

Post by nbla000 »

based on C128 Memory map it seems that the area $1300-$17FF is unused so for the C128 I may store the routine on $1300-$1330 and change LDA/STA pointers to use $1400-$14FF as tmp buffer.

Based on C64 Memory map I may do a similar thing for the C64 too so I may use $C000-$C030 for the ML routine and $C100-$C1FF as tmp buffer...

There is something wrong ?
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

Post by tokra »

Sound all very fine to me. You can do the testing for which machine you're running on by the Reset-Vector at $fffc for example
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

Exactly what I'm doing:

Basic code:

Code: Select all

1 fori=0to6:reada:poke320+i,a:next
2 sys320:sa=0:a=peek(327):ifa=34thensa=1024:rem vic20
3 ifa=226thensa=49152:rem c64
4 ifa=61thensa=4864:rem c128
5 ifsa=0thenprint"supported systems:":print"c64, c128, vic20":end
592 data173,252,255,141,71,01,96
ML code on $140

Code: Select all

.C:0140   AD FC FF   LDA $FFFC
.C:0143   8D 47 01   STA $0147
.C:0146   60         RTS
.C:0147   22         JAM
I've used this technique to prevent strange C16/PLUS4 behaviour, by using these machines PEEK(65532) reports a value in RAM while by using a ML routine it reports the value in ROM.

btw I've tested a bit the program with Vic-20 C64 C128 and seems that all is fine except some strange things...

1581 tasks (1581->1581, D81->1581) on a Vic-20 sometime freeze in random mode and some time reports a device not present (always random) while all is ok for C64 and C128.

I must check on real machines but since I use the same code for the C64, C128 and VIC-20 maybe there is an issue on 1581 true drive emulation on the VIC-20....

There is another question about the C128, If I use 1571 drives all is ok but if I use 1571cr drives, the programs hangs here:

Code: Select all

130 open1,sd,5,"#"
Any Idea ? are 1571cr drives different ?


PS: I discarded C16/PLUS4 systems because I don't think they may use 1541/71/81 drives, right ?
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

Post by nbla000 »

I'm doing some testing with SJLOAD with good results, for example by using the Vic-20 the 1541->1541 task takes 10:41 while with SJLOAD it takes 4:18 :shock:

btw the 1571->D71 task takes 20:31 but with SJLOAD it takes 16:21 not so fast like the 1541...

I've used a 1581 as target drive, and all drives with JiffyDOS ROM of course.

Good results also with the SJLOAD for the C128, both installation options are ok (1 $1700-$1BFF and 2 $0C00-$0DFF, $1900-$1BFF)
Just because I use $1300-1330, $1400-$14FF for the program...

I need to test SJLOAD for the C64 but I guess there are no differences because it does not speed-up OPEN statements but just LOAD.


btw all tests are in PAL, I guess there are some problems with SJLOAD for NTSC...

If I'm not wrong, I remember that some users reported problems with SJLOAD by using 1541/1571/1581 "classic" drives on NTSC machines...

Diddl, have you done some SJLOAD adjustment for classic drives on NTSC machines ?
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

Post by tokra »

Can't say anything about 1571cr, I use a european old C128D with the standard 1571. I've noticed however that I cannot use the Diddl-program that writes the .d64 images directly (using ,p,w as paramters), but only the one that writes to an already existing image (using # parameter) I created beforehand with my SD2IEC device. So that's exactly the opposite behaviour you are seeing to the 1571cr. However the D128IT-program mentioned before can write the .d64-images directly. I haven't yet figured out why the Diddl-program won't work this way. But since I now have a way to backup all my disks, I can't be bothered to hunt down the reasons.

Oh, and regarding the C16 and PLUS/4 - they can use the 1541/71/81 as any other Commodore on the serial port. The 1551 drive however ONLY works on a C16 and PLUS/4 as it uses its expansion port.
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

tokra wrote:Can't say anything about 1571cr, I use a european old C128D with the standard 1571.
I think I may ignore the 1571cr, just a curious thing, based on this info, the cr means "Cost Reduced"...

I've noticed however that I cannot use the Diddl-program that writes the .d64 images directly (using ,p,w as paramters), but only the one that writes to an already existing image (using # parameter) I created beforehand with my SD2IEC device.
It's strange, the only issue that I know is that it does not work if there is an existing image file.
There is a command that scratches the existing image file but it does not work at least with a 1581 as target drive.
I've the same problem with my multi-system/target tool that I will check in the future, just don't overwrite a file for the moment.
Oh, and regarding the C16 and PLUS/4 - they can use the 1541/71/81 as any other Commodore on the serial port. The 1551 drive however ONLY works on a C16 and PLUS/4 as it uses its expansion port.
ah ok, then I will adapt the program for C16 PLUS/4 too...

PS: Do you want to test my current version with the C128 ? in case contact me in PM.
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

Post by nbla000 »

I'm thinking to move routines and tmp buffer to the top of the basic memory so it does not interfere with any tool like SJLOAD or any other turbo...

I read the top of basic and then I will reduce it a bit before to execute any variable, something like this:

Code: Select all

1 POKE56,PEEK(56)-2
Then I may write the routine to the proper location according with the limit memory value...

By using this technique, I may use the program from any vic memory configuration (unexpanded, +3K or +8K and more) and also for the C64 but How I can do a similar thing for the C128 ?

It seems there are 2 banks of memory, I've tried by reading 1212/1213 locations (Basic program limit [FF00]) by reducing it to $FC00 but I'm not able to read write to these locations...

Any idea ?
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

Post by Mike »

nbla000 wrote:How I can do a similar thing for the C128? It seems there are 2 banks of memory, ...
The C128 has 2 banks of RAM, and ROM from $4000 .. $FFFF which is accessible by issuing BANK14 before a PEEK(), or SYS; part of the ROM (the character set) is overlayed by I/O at $D000 .. $DFFF with BANK 15.

BANK 0 contains the BASIC program, BANK 1 the variables.

Furthermore, there exists a "common" area from $0000 .. $03FF where always BANK 0 is switched in. Within that common area, there are some routines (FARLDA, FARSTA, FARJSR, FARJMP), which enable one (you could guess) to load, store, JSR, and JMP into another BANK from that one currently switched in. Otherwise the BASIC interpreter wouldn't be able to access data in the RAM "lying" under itself.

These routines are however quite complicated to use. Unless you really need a substantial amount of memory, I'd stick with the BANK 15 configuration, so the whole ROM, and I/O is switched in - and you can still use BANK 0 RAM from $0000 .. $3FFF.

In that case, the ML part of the program could be located at $1300 .. $1BFF, and the RS232 buffers (256 bytes each at $0C00, and $0D00) are good candidates for sector buffers.

Greetings,

Michael
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

Mike wrote:In that case, the ML part of the program could be located at $1300 .. $1BFF, and the RS232 buffers (256 bytes each at $0C00, and $0D00) are good candidates for sector buffers.
Thanks for your suggestions Mike.

At the moment for the C128 I already use the $1300-$14FF area for both ML part and 256 bytes buffer but since it could be used also from other tools I wish to use the Basic program area by reducing it a bit so while for C16-C64-Vic20 seems very simple, for the C128 there is not an easy way...
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

Post by Mike »

I already use the $1300-$14FF area for both ML part and 256 bytes buffer but since it could be used also from other tools
From what I've seen you're programming a stand-alone program anyway. So why care what else might reside in that area?

Of course, when there is a specific version of SJLOAD for the C128 which happens to occupy $1300..$1BFF, and $0C00..$0DFF you still might go for the ML part of your program residing below $4000. Lowering the roof of the BASIC program area in any case isn't of that importance, since *only* the program is stored in BANK 0, no variables. I.e., as long as your main program doesn't reach up to your ML routines you don't need to fear the ML routines might be overwritten.

And $1C00 .. $3FFF (provided no graphics memory is activated) don't suffice for your program?
User avatar
nbla000
Salmon Run
Posts: 2582
Joined: Thu Oct 13, 2005 8:58 am
Location: Italy

Post by nbla000 »

ah ok, I don't need to know where is the limit for basic just because the C128 uses a specific area for the program and a specific area for variables so since the basic program at the moment is from $1C01 to $2500, I may simply put routines on $3E00 and tmp buffer on $3F00 without any problem and without any POKE56,XX like for C64/C16/VIC20...

An easy alternative is an hybrid program (BASIC+ML) like the original C64 program without READ/DATA to put ML code in some place.

I may simply append the ML routines and 256 bytes for tmp buffer to the basic code but I wish to leave the program in full basic with ML code "injected" with READ/DATA statements if possible...

wip...


Diddl, any news about Vic-20 SJLOAD for NTSC machines along with "classic" drives ?
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

Post by nbla000 »

OK, the full-basic CBM multi-platform "suite" for Disk copying is quite ready, I will call it Disk Copier :oops:

I've tested it on Emulation with 1541-1541-II-1571 and 1581 drives by using Vic-20 (any memory configuration, unexpanded too), C16-Plus/4, C64 and C128.

It uses just the Basic memory area so no strange memory areas/expansions are required for any of the supported systems, except if you want to use SJLOAD of course.

SJLOAD speedup works for C128 and Vic-20 only, The C16 hasn't an SJLOAD port while the SJLOAD C64's version does not speedup OPEN so it hasn't any effect to Disk Copier.

SJLOAD has some problems with CBM drives if used on NTSC machines.

This is the current basic code, maybe is the final version btw if you have any suggestion please inform me.

Code: Select all

1 poke320,173:poke321,252:poke322,255:poke323,141:poke324,71:poke325,01:poke326,96
2 sys320:ma=peek(327):ifma=34orma=226orma=246then5:rem vic20, c64, c16
3 ifma=61thensa=61*256:goto11:rem c128
4 print"supported{space}systems:":print"c64,{space}c128,{space}vic20,{space}c16-plus/4":end
5 poke56,peek(56)-3:clr:sa=(peek(56)+1)*256
10 :
11 restore:print"{clear}{space*5}disk{space}copier"
12 print"{down*2}select{space}task:{down}"
13 fori=1to9:readt$(i):printi;"-{space}";t$(i):nexti
14 print"{down}{space}0{space}-{space}exit{down*3}"
15 input"{up*2}task{space}";ta:ifta>9orta<0then11
16 ifta=0andma<>61thenpoke56,peek(56)+3:clr:print"{clear}":end
17 ifta=0thenprint"{clear}":end
18 :
19 print"{clear}{space*5}disk{space}copier"
20 print"{down}task:"ta"-{space}"t$(ta)"{down*3}"
21 input"{up*2}source{space}drive{space}?{space}8{left*3}";sd:print"{down*2}"
22 input"{up*2}target{space}drive{space}?{space}9{left*3}";dd
23 ifsd=ddthen19
25 ifta<4then29
26 ex$=right$(t$(ta),3):ifta<7then28
27 ex$=left$(t$(ta),3)
28 print"{down}file{space}?{space}image."ex$"{left*11}";:inputim$
29 input"{down*3}confirm{space}(y/n){space}?{space}y{left*3}";a$
30 ifa$<>"y"then11
40 ti$="{0*6}"
100 gosub 500
101 ifta=1orta=4orta=7then110:rem 1541
102 gosub105:ifta=2orta=5orta=8then110:rem 1571
103 gosub105:goto110:rem 1581
105 read mt,ms:if mt<>0then105
106 return
110 tr=1:se=0
116 rem switch the 1571 in double side mode
117 ifta=2orta=5thenopen15,sd,15,"u0>m1":close15
118 ifta=2orta=8thenopen15,dd,15,"u0>m1":close15
120 print"{up}copying{.*3}{space*11}{down*2}"
129 ifta>6thenopen1,sd,5,im$+",p,r":goto135
130 open1,sd,5,"#"
134 ifta>3andta<7thenopen2,dd,5,im$+",p,w":goto140
135 open2,dd,5,"#"
140 open3,sd,15
145 open4,dd,15
147 ifta>3andta<7thenprint#4,"s:"+im$:fori=1to3000:nexti
150 read mt,ms
160 if mt=0 then 300
170 for tr=tr to mt
175 print"{up}track{space}";tr;"{left}{space},{space*3}{left*3}";:b$="{left*4}"
180 for se=0 to ms-1
190 a$=str$(se):a$=a$+left$(b$,len(a$)):printa$;
199 ifta>6then210
200 print#3,"u1:5{space}0{space}"+str$(tr)+str$(se)
209 ifta>3andta<7then220
210 print#4,"b-p:5{space}0"
219 ifta>6then230
220 print#3,"b-p:5{space}0"
230 sys sa
239 ifta>3andta<7then250
240 print#4,"u2:5{space}0{space}"+str$(tr)+str$(se)
250 next se:print
255 next tr
260 goto 150
300 close4:close2:close1:close3
305 print"{down*2}time:{space}"left$(ti$,2)":"mid$(ti$,3,2)":"right$(ti$,2)
310 print"{down*3}done,{space}press{space}any{space}key";
490 geta$:ifa$=""then490
495 goto11
499 :
500 for i=0to47
510 :read a
520 :pokesa+i,a
530 :next
540 pokesa+14,sa/256+1:pokesa+30,sa/256+1
550 return
599 :
600 data "1541->1541","1571->1571","1581->1581","1541->d64","1571->d71"
610 data "1581->d81","d64->1541","d71->1571","d81->1581"
699 :
700 data162,  1, 32,198,255,160,  0,162,  1, 32,207,255
710 data153,  0, 15,200,208,245, 32,204,255,162,  2, 32
720 data201,255,160,  0,185,  0, 15,162,  2, 32,210,255
730 data200,208,245, 32,204,255, 96,  0,  0,  0,  0,  0
799 :rem 1541
800 data 17,21,24,19,30,18,35,17,0,0
809 :rem 1571
810 data 17,21,24,19,30,18,35,17
811 data 52,21,59,19,65,18,70,17,0,0
819 :rem 1581
820 data 80,40,0,0
999 :
Screenshots:
Image
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

Post by tokra »

Do you have this as a downloadable .prg ? converting the { } to cursor-commands is such a pain...
User avatar
Schlowski
NoMess!
Posts: 892
Joined: Tue Jun 08, 2004 12:20 pm

Post by Schlowski »

Shameless self-advertisement :
Use BasEdit, set Ascii-Tokenizer to BasText-Tokens.txt (in the BasEdit.ini or via options-menu) and then copy&paste the source :-)
Post Reply