Login
Forum Help



Post Your Message
Username: (Login)

Topic:
Message:
 


Previous Messages
Posted By

George
on 2019-12-07
06:21:01
 Re: [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

@MMS: You do great encyclopedia entries. I invite you to write one.

@KiCHY: Thank you for your hint.

P.S.: A table somewhere with the differences and matches between c64 an plus/4 would be cool. Its really hard to get the C64 routines running with a my small experience.



Posted By

MMS
on 2019-12-07
05:48:15
 Re: [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

Thanks! after that we can create a new entry for BASIC programming "saving memory area" happy

Posted By

KiCHY
on 2019-12-07
04:07:02
 Re: [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

That's what I talked about with POKEs and SYSes happy

I suggest change the usage of $C1-C2 to some other zero page address. The original routine was written for C64 and in most cases, you can't use the same addresses. $C1 on +4 is used as a temporary memory for text scrolling and $C2 holds a text reverse flag. There is a chance these (and lots of other zero page addresses) will interfere with the usual behavior of basic. It is safe to change these to somewhere between $D0-$E8, you won't interfere with the speech synthesis of C364.

Posted By

MMS
on 2019-12-06
15:57:06
 Re: [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

gerliczer, SVS, George,
Thank you for the clarifiaction! now it's clear!
(first the "C1" and "C2" adresses were unclear for me, why these? but it is explained it could be any random unused memory address at zero page, referred in SA later.

Those kernal routines are pretty powerful, I just need to start to learn and understand them happy

The funny thing is that with small modifications it may work on C64 too.
(and theses differences can be stored in variables, too bad the variables could have only two useful characters)

Posted By

George
on 2019-12-06
14:50:32
 Re: [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

- I tried save restore the Zero-Page without success
- I tried SVS suggestion ($00 at $17FF) with no success

Then i looked at MMS encyclopedia entry and C64-codebase for the save-routine in assembly https://codebase64.org/doku.php?id=base:saving_a_file

Here is the working code for saving a Memory area (1800-3fff) to a file in BASIC.

3000 REM -= GFX Save Routine by MMS/gerliczer/George =-
3010 SA=DEC("07f2"):SX=SA+1:SY=SX+1:SR=SY+1
3020 TB=DEC("0333") : DRV=8
3030 REM put the file name into FI$ eg.FI$="Data" BEFORE calling the Subroutine
3040 FI$="Data":FI=LEN(FI$)
3050 FORI=1TOFI:POKETB-1+I,ASC(MID$(FI$,I,1)):NEXT: REM filename to TB store
3060 POKESA,0:POKESX,DRV:POKESY,0:SYSDEC("ffba"): REM DRIVE 8
3070 POKESA,FI:POKESX,TBAND255:POKESY,TB/256:SYSDEC("ffbd"): REM filename KERNAL
3080 POKEDEC("C1"),0:POKEDEC("C2"),DEC("18"):POKESY,DEC("3f"):POKESX,DEC("ff")
3081 pokesa,DEC("C1"):SYSDEC("ffd8")
3090 goto210
3100 REM -= EOR GFX Saver =

I think its really cool to get this working with your help!

Posted By

SVS
on 2019-12-06
12:41:18
 Re: [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

@gerliczer: yes it means that you described; I'll write a better text in the map wink
@George: have you tried to set $00 at $17FF, before to restart the Basic after the saving?

Posted By

gerliczer
on 2019-12-06
11:29:25
 Re: [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

@MMS: That's the lower of two consecutive bytes in the zero-page (e.g. $D8 of the $D8, $D9 pair) containing the start address stored in lower byte, higher byte order.

Posted By

MMS
on 2019-12-06
10:30:26
 Re: [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

I think gerliczer's idea is great.

plus4encyclopedia/500251
Maybe just need to change Jump address $FFD5 to $FFD8 (change load to save kernal routine)

As per SVS map, SA ("07f2") need to be a "zero page byte with indirect start address"), ??? (this still to be clarified for me...)
X, and Y are the end address +1

3080 POKESA,??? :POKESX,DEC("00"):POKESY,DEC("40"):SYSDEC("ffd8"): REM Save from ??? to $3fff

Posted By

siz
on 2019-12-06
08:31:06
 Re: [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

You are overwriting the BASIC start and end pointers before your save. You should save and restore them before any GOTO or GOSUB. Perhaps this will help.

Posted By

George
on 2019-12-06
07:32:37
 Re: [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

gerliczer I have the same theory. I think i will do either call a small assembly program or do the poke/sys method KiCHY mentioned.

Posted By

gerliczer
on 2019-12-06
02:22:58
 Re: [BASIC] Sideeffect when calling DSave"..", 8,1 with a basic programm

What KiCHY wrote. That was my other idea. You should try and modify the KERNAL based custom loader routine, that you George, MMS and Mad perfected for saving. Probably it needs to replace one single KERNAL call.

Posted By

KiCHY
on 2019-12-06
01:42:43
 Re: [BASIC] Sideeffect when calling DSave"..", 8,1 with a basic programm

Another solution can be to use POKEs and SYS call kernel I/O routines. I never tried, tho.

Posted By

gerliczer
on 2019-12-06
00:11:26
 Re: [BASIC] Sideeffect when calling DSave"..", 8,1 with a basic programm

I have only a theory. You screw up your memory layout with those pokes. Then you do a GOTO. GOTO, AFAIK, finds the jump target by parsing the BASIC program from start. It can't find it in the designated memory area and somehow crashes. And LIST does the parsing again from that wrong memory. You could try saving and restoring the zero-page values and see if it improves the situation.

Posted By

George
on 2019-12-06
07:32:25
 [BASIC] Sideeffect when calling Save"..", 8,1 with a basic programm

i want to save 1800-3fff to from a BASIC program.

2400 POKE 44,6144/256:POKE 43,6144-256*PEEK(44)
2401 POKE 46,16383/256:POKE 45,16383-256*PEEK(46)
2402 SAVE"DATA",8,1
2403 goto210

The "Data-file" is saved properly, but after then the program crashes and when I type LIST only garbage appears.
Whats the reason? Does save has similar effects like LOAD?


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon