|
Post by stiggity on Nov 9, 2022 4:23:46 GMT
I've thrown this together, from a c64 example. If compiled independently, it works great!!!! but once everything's placed in the whole program, it hangs upon the restore segment. Possibly something getting stomped on? Would anybody feel like having a peek and tell me what I'm doing wrong? Again,. stand-a-lone it functions, but after being wrapped up in a large hybrid (but sort of organized) c128 routine, it fails. I wish i knew how to say thanks right, but i appreciate any sort of assistance.
*=$1300
PTRSAV LDX #3
- LDA $31,X
STA POINTERS,X
DEX
BPL -
RTS
PTRRST LDA #$AC
STA FETCH+1
LDA #$AE
STA STORE+1
LDA $31
STA $AC
LDA $32
STA $AD
LDX #3
- LDA POINTERS,X
STA $31,X
DEX
BPL -
LDY #0
LDA $31
STA $AE
LDA $32
STA $AF
PRST3 JSR FETCH ;LDA ($AC),Y
JSR STORE ;STA ($AE),Y
LDA $AE
CMP $33
BNE +
LDA $AF
CMP $34
BNE +
RTS
+ LDA $AC
CLC
ADC #$01
STA $AC
LDA $AD
ADC #$00
STA $AD
LDA $AE
ADC #$01
STA $AE
LDA $AF
ADC #$00
STA $AF
JMP PRST3
FETCH LDA #$FF ; ZP pointer to use THIS GETS MODIFYED ** IMPORTANT **
LDX #1 ; bank index 1
JMP $FF74 ; kernal
STORE LDX #$FF ; ZP POINTER TO USE THIS GETS MODIFYED ** IMPORTANT **
STX $02B9
LDX #$01
JMP $FF77 ;INDSTA
POINTERS .BYTE 0,0,0,0
|
|
|
Post by stiggity on Nov 10, 2022 23:25:06 GMT
would this only work in a commodore64 environment ,even while using fetch/store? Something's telling me there needs to be work with the string pool, and readjusting for garbage collection? Would this routine work the way it is? If anyone has any comments, thoughts, Please let me know.
-Thanks!
|
|
|
Post by stiggity on Nov 10, 2022 23:51:53 GMT
I apologize for flooding, but i could seriously use some help with this. I mean, it does work... and the "hang" i was describing is like a 3 second pause, and it returns control. But!!! the other routines it's intermingled with are failing miserably.. I mean, it's just arranging pointers to a preserved state. Could this trick be used on the c128? Any sort of help is greatly appreciated...
|
|
|
Post by stiggity on Nov 11, 2022 19:56:58 GMT
Okay.. the routine does it's thing... and i just discovered this... if you call the "SAVE"(Beginning Portion), let's say you dim 5 multi dimensioned arrays. right after calling the SAV routine.. if you can finish hat your doing before the computer collects garbage, it all works just fine. Meaning call "PTRSAV" dim some arrays, populate with data, manipulate data however, then call PTRRST (before BASIC collects garbage, it works.. but im you call PTRSAV, dim numerous arrays, use them and call PTRRST befre garbage collection, things work just fine... `Is there any flags that get set right before a Garbage collection? so i can exit the PTRSAV before garbage collection? Or even so will it still lock up?? Sorry to compose a Novel, but this is kinda breakthrough, but now I'm lost..
|
|
|
Post by stiggity on Nov 13, 2022 22:13:29 GMT
idk why nobody has replied, but the routine works fine, except once the machine performs garbage collection, the program locks up. No matter if you SAV/RST before collection. If the SAV portion is used whatsoever, once GC happens, she locks up.
|
|
|
Post by c128old on Nov 14, 2022 20:09:02 GMT
C128 basic isn’t really my expertise but there are others with knowledge in that area, though infrequently visiting People don’t check this place all the time and I imagine the question about garbage collection is a though one.
|
|
|
Post by stiggity on Nov 14, 2022 21:54:48 GMT
c128old, I have ran into some bright minds, while visiting these pages over the years, too bad I'm not one of them! <jk> yeah, i know using the 128 and doing anything memory related, weather its creating a string from a buffer, you got to deal with string pool, and flagging variables for GC. Although, the original routine isn't creating a variable, but IMO it's even more complicated. Hoping one day to understand its full potential..
|
|
|
Post by c128old on Nov 15, 2022 18:44:13 GMT
I theory something can be achieved by calling the basic free() function. I recall it forces a GC
|
|
|
Post by stiggity on Nov 15, 2022 18:51:08 GMT
fre(1), fre(.) do perforom GC. What the idea of the routine is, to copy the current variable pointers, then use a DIM, dim some arrays, fill up some arrays, then when your finished with your arrays you created, call the RST portions, and pointers are re-adjusted to where they were when the SAV portion was called. Sorta like an array eraser...
|
|