|
Post by stiggity on Apr 21, 2021 3:32:50 GMT
Okay. I really owe you.. big time!!! Just feel like saying I appreciate your hard work, and sit back, and look at your code. Thinking... jumpin jeez!!! I've slowly been transitioning over to the latest. I do have an ODD but real issue that was stumbled upon. While the program was running, the error trap spit out an Out of memory error... both, the STROUT and ARRAY STROUT code, put the old remnants into garbage collection area, and flag them as garbage, aye?? This error happened while navigating the prg. It happened on 2 different BASIC lines, but in the same module. I went back, and Yes, its 5 multi dimensioned arrays, but there only accessed by BASIC itself.. no Machine Code involved. I dim q$(10,10),r$(10,10),s$(10,10),t$(10,10),u$(10,10) and they get populated by a file I/O routine that has been ending in a STROUT call. But! the even more odd thing, the rest of the program reset, and it all works, except those 5 arrays. those arrays aren't accessed via ML, directly. Soin short, its all working, except the out of memory error...any insight? to call garbage collection on the 128 do i perform an x=fre(.), x=fre(1) Oh! your replied to me, explaining how to setup a garbage collection call in your PUTARY code, should that also be incorporated in this new ML?
|
|
|
Post by wendling on Apr 21, 2021 19:39:46 GMT
Does that file I/O routine end the buffer (with the string) that STROUT needs with a “0”? After the “out of memory” error what is the value of fre(1)?
|
|
|
Post by stiggity on Apr 21, 2021 20:00:57 GMT
Wendling, Yes, the file I/O end its buffer with a "0", and it was working for 1.2 hour, then started giving me out of memory errors.. next time it happens, i'll log the value of x=fre(1)
May I ask you a question... what am i doing wrong. I have a%=123 (just for an example) after executing the VAR to BUFF @ $3f00 when the contents of buffer are _printed_ i get a chr$(123) not "chr$(123)" but instead of my buffer containing a string of "123" and/or if a%=32768 i get the chr$(a%) in my buffer, instead of a string like "32768",0 ... if that makes any sense, please let me know.. im converting the entire program to utilize STROUT and its branches..
|
|
|
Post by stiggity on Apr 22, 2021 2:33:26 GMT
Wendling, I got it working... im an obviously, challenged idiot! its all right in front of me. I really need to tidy up my work environment!! thanks alot!! if you only knew how much i appreciate your help.
|
|
|
Post by wendling on Apr 23, 2021 11:22:34 GMT
Stiggity, about the out of memory problem:
I put yours dims : q$(10,10),r$(10,10),s$(10,10),t$(10,10),u$(10,10) in my bufall demo 5. Filled them all with strings of 99 chars. Checked memory not with fre(1) because that performs a garbage collect and I want my demo to do that, but with print peek(51)+peek(52)*256;peek(53)+peek(54)*256: around 500 bytes left. Deleted all the getkey’s out of the demo. Put at the end of my demo a goto to just after the dims to the memory check and let my demo loop. Put a string in with random length, so variable memory size would change every loop. Then let it loop for an hour. No problems. Then I changed the fill string to 100 chars. That gave me an out of memory error, but this was no programming error: memory was truly not enough.
So I suspect you are really out of memory.
What to do? You mentioned that you selected a common area of 16k from $0000-$3fff. If you use jsrfar and fetchfar and stashfar, there is no need for that amount of common area. Try to restore it to its default value and set start of variable space ($2f/$30) at its original value:$0400 in bank1. That gives 15k more variable memory. And hopefully solves the “out of memory” error.
|
|
|
Post by stiggity on Apr 24, 2021 1:01:56 GMT
Wendling, thank you for the help/advice. I use $1300-$3fff as common ram, and all Machine code modules load in @ $a000 using #$0E to alter MMU. Swap out BASIC. Stumbling into the out of memory error was a first. I wouldn't know where to relocate common memory. Where would you recommend? Each and EVERY one of your responses, i l earn something new. I never knew about peek(51)+(52),*256 etc.. but now its Sooo correct, i'll never forget..My BASIC code is roughly 100 blocks, and, as the same as ASM, my skills lack real potential. And variable usage has no real _strategy_. Hence, Out of Memory error.. Please let me know, as im refining already running, constructed code, while catching-up on here.
|
|
|
Post by stiggity on Apr 24, 2021 1:08:06 GMT
i was always under the assumption, simply using the VDC, the VIC screen memory ($1300-$3fff) was free game..
|
|
|
Post by wendling on Apr 25, 2021 8:16:04 GMT
I don’t think we mean the same thing as we speak of the common area. With the common area I mean the area set up by $d506. Its default value is 4 and means a common area from $0000-$03ff= 1K=1024 bytes. In this area every bank writes to and reads from bank 0 instead of their own bank. If the default value is selected, variable start ($2f/$30) can stay at the default value ($0400). I would use the default values. After GRAPHIC 1 and only using the VDC, $1300-$3fff (this is not a common area) is free to use. Don’t let your ML (if you put it at $a000) and the end of your BASIC program overlap. To show the end of a BASIC program: print peek(4624)+peek(4625)*256 ($1210/$1211). To set the highest address available to BASIC: poke4626,low:poke4627,high ($1212/$1213). To cross this border gives an “out of memory” error. For my own fun I tried to mimic GRAPHIC 1 in such a way that I could choose the new location of BASIC. It is only working once, if you run it a second time everything goes very wrong. But it shows how to do it.
10 sys 4864,128:rem put basic at $8000 and continue there with the program 20 print"hello" 30 print"good bye" 40 printpeek(45);peek(46) 50 printpeek(4624);peek(4625)
$1300:
sta $fb ; highbyte of the new location clc jsr $9f5c ; move basic to highbyte in reg-a lda $3e ; reset the basic text pointer so it continues at the new locatiion sec sbc $2e ; subtract old value clc adc $fb ; add new value sta $3e lda $fb sta $2e ; set new basic start jsr $4f4f ; relink lines jmp $4f82 ; set new basic end
|
|
|
Post by stiggity on Apr 25, 2021 23:56:52 GMT
How was your weekend Wendling? I ended up tearing some tendons in my hand... No, not from typing.. lol.. would there we anyway you could send me in the right direction on how to setup and execute a garbage collection process, on the fly? I know you've already given an example, but not from PUTARY or STROUT, just a way to JMP/JSR to, what's in the box?? what i'm trying to accomplish is..
lda FRETOP +1
clc sbc STREND +1
bne nocollect jsr collect
Im attempting a wedge in @ $0308/$0309, so each time a certain token arrives in BASIC, a check for low memory is called, if its not LOW, continue, if it is alarmingly low, call garbage collection...thanks again.
|
|
|
Post by stiggity on Apr 26, 2021 3:44:58 GMT
i got it working, im just uncertain if my GC call is being ran, or the 128's stock call. Heading to bed, 7:30 comes early.. thank you for you time, patience, effort... appreciated is an under statement..
|
|