|
Post by wendling on Mar 27, 2021 11:16:22 GMT
You can use $02-$09. Used by jsrfar($ff6e=$02cd) and jmpfar ($ff71=$02e3).
Check with MONITOR variable space at $2f/$30, array space at $31/32 if length/pointers are correct: m 10400 or with common area(0-$3fff): m 14000 Check stringpool with: m 1fea0
Put in putaray: lda length
jsr $ffd2 lda $47 jsr ffd2 lda $48 jsr $ffd2
to check if length and varname are okay.
|
|
|
Post by stiggity on Mar 27, 2021 16:31:49 GMT
wendling: Now its crashing to basic (with an error trap running), breaking to monitor, and I think there was even a Jam, someplace. Odd thing is, its a random crash. An area will run great, multiple times.. then, all of the sudden, ding! breaks to monitor. Last break wasnt even performing an ML call.. it was (I believe) opening a seq file. The entire program is pretty big, so sending you code will be hard. but, snipping out ML fragments wont be very difficult. I do begin with a "fast:graphic1:graphic5:bank15" and its all ran in 80 columns... tell me what you may need to track the source of errors... also, b4 i implemented the putaray, and getarauy code, the program, was extremely reliable... but it lacked the put/getaray code which it desperately needed..
|
|
|
Post by stiggity on Mar 27, 2021 19:38:29 GMT
`Okay.. i figured i'd store the end of basic programs using MEMSIZ but it appears thats already done automatically to keep the MMU ($FF00) common. Or, are there pokes to set end of BASIC?? my main body of code thats in memory the entire duration the program is running is 42blocks, and the largest overlay is 49blocks... right now the module that i've been testing the core on, is only , also 42blocks.. A lot of variables are used. Multi dimensioned arrays are kept to a minimum, but I cant see BASIC overlapping my Machine code.. is there a poke or two to set hi/low of end of basic??
|
|
|
Post by stiggity on Mar 27, 2021 20:56:39 GMT
Welps, its still misbehaving. It spit out a bad subscript error. The only array on that line was y$(x) and its dimmed 10 deep, but never see's an element higher than 5. Soo... I typed in (y$="") just to see what would happen, and broke to monitor. I got back top basic typed in (a$="") and it broke to monitor. Any sort of basic token entered ater the bad subscript error breaks to monitor.. somethings telling me im N2Deep..
|
|
|
Post by stiggity on Mar 28, 2021 2:53:15 GMT
Wendling, it seems i'm unable to upload a small 3k text file for you to look at, and this CODE-INSERTION button is unforgivable. But here goes..
i
GETSTR
LDA VAR1
LDY VAR2
JSR STRFIN
JSR STRGET
LDA #STRPNT+1 ; ZP STARTING ADDRESS OF STRING (LO BYTE)
STA FETCH+1 ; UPDATE OUR FETCH ROUTINE TO FIND IT
LDA STRPNT ; STRING LENGTH
BNE + ; CONTINUE PRINTING IF ITS NOT 0 LENGTH
RTS ; IF ITS NULL, EXIT OUT
+ LDY #0 ; PRINTS CONTENTS OF THE STRING TO THE SCREEN
- STY TEMPY ; SAVE Y
JSR FETCH ; GET BYTE FROM STRING
STA BUFF,Y
LDY TEMPY ; RESTORE Y
INY
CPY STRPNT ; LENGTH OF STRING
BCC - ; LOOP UNTIL END OF STRING
dey
STY UPLEN
RTS
STRGET
LDY #2
- LDX #1
LDA #VARPNT
JSR INDFET
STA STRPNT,Y
DEY
BPL -
RTS
nsert code here
strout
lda #"a"
ldy #"n"+128
jsr strfin
jmp strstr
STRFIN
PHA
TYA
PHA
JSR DUPFAR ; DUP AND MOD JSRFAR
PLA
TAY ; Y WILL CONTAIN #$80 IF JUST SINGLE CHAR VARIABLE (A$, ETC)
PLA
STA VARNAM
STY VARNAM+1
LDA #$FF ; FLAG FOR TYPE $
STA $0F
LDA #14 ; BANK 14
STA $02
LDA #>PTRGET
STA $03
LDA #<PTRGET
STA $04
JSR NEWFAR ; CALL PTRGET AT $7B0B
LDA #14
STA 2
LDA #>STREX1
STA 3
LDA #<STREX1
STA 4
LDX VARPNT
LDY VARPNT+1
STX INDEX1
STY INDEX1+1
JSR NEWFAR ;CALL STREX1
LDA #INDEX1 ;POINTER
STA $2B9 ;FOR INDSTA
LDA 6 ;REGISTER .A FROM STREX1 CALL
BEQ EMPTY ;ZERO LENGTH, NO DATA
TAY ;AFTER DATA, "BACK POINTER" LOW BYTE
LDX #1
JSR INDSTA ;SET LENGTH OF GARBAGE
INY ;INDEX "BACK POINTER" HIGH BYTE
LDA #$FF ;FLAG AS GARBAGE
LDX #1
JMP INDSTA ;SET FLAG
EMPTY
RTS
;++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
STRSTR
LDA #14
STA $02
LDA #>STRLIT
STA $03
LDA #<STRLIT
STA $04
LDA #<BUFFER0 ;ADDRESS OF OUR $
STA $06 ;TO BE ALLOTTED/COPIED
LDA #>BUFFER0
STA $08
JSR NEWFAR ;CALL STRLIT AT $869A
DEC $18 ;CALLING FROM ÍÌ,
DEC $18 ;SO UNDO $,
DEC $18 ;DESCRIPTOR STACK
LDA #VARPNT ;ADDRESS OF VARPNT
STA $02B9
LDX #1 ;MMU BANK 1 RAM
LDY #0
LDA NY ;$ LENGTH
JSR INDSTA
LDX #1
INY
LDA FRETOP ;MAKE OUR VARIABLE
JSR INDSTA ;POINT TO COPIED $
LDX #1
INY
LDA FRETOP+1
JSR INDSTA
LDA #FRETOP ;POINTER TO NEW STRING DATA
STA $02B9 ;POINTER FOR INDSTA
LDX #1
LDY NY ;AFTER STRING DATA
LDA VARPNT ;MAKE "BACK-POINTER" LOW
JSR INDSTA ;FOR GARBAGE COLLECTION
LDX #1
INY
LDA VARPNT+1 ;MAKE "BACK-POINTER" HIGH
JMP INDSTA
index1 = $24
FRETOP = $35
FRESPC = $37
VARNAM = $47
VARPNT = $49
STRPNT = $52
LENGTH = $63
JSRFAR = $2CD
NEWFAR = $2A2-22
PTRGET = $7B0B
STRLIT = $869A
STREX1 = $87CA
INDFET = $FF74 ;KERNAL JUMPS
INDSTA = $FF77
|
|
|
Post by stiggity on Mar 29, 2021 18:46:59 GMT
Wendling, It's been a few days, and im still working on it. I've found it to now, be jamming @ $935e... so, the basic rom is banked out, and somewhere im trying to access a location in that vicinity. it has jammed numerous times, but now.. more often than not it's $935E?
|
|
|
Post by stiggity on Mar 29, 2021 23:56:49 GMT
I've been reading more about the MMU. I vaguely grasped the technique on the 64, but that's a lot different, in some aspects.. so flipping back and forth through code that's in another bank isn't 100% foreign. If i wanted to keep BASIC ROM in, Kernal in, I/o, etc.. and use $1300-$3fff as common ram, all while utilizing $8000-$bfff as ram, would i store the value #$0c to the MMU??? right now im using #$0e. Not entirely sure what the difference is... any insight? What do you think of those variable I/O snippets, Wendling?? they dont even work with some strings...
|
|
|
Post by wendling on Mar 30, 2021 11:10:10 GMT
Stiggity:
I have troubles too: I want to use several system SYS's but they do not do what I want. I will figure it out, but that takes time.
In the meantime:
BASIC end at $1212/$1213.
Your "getstr" and "strout" seem okay. I have one concern: You have a "jsr newfar" located at $02a2-$22. That's in the BASIC inputbuffer at $0280. This buffer is used to read in one entire BASIC program line. If you have a BASIC program line longer than $80=128 bytes your "newfar" will be overwritten, causing a crash to the monitor.
(Edit nr1: I have to look better at "strout", because at the moment I can't get it to work.)
(Edit nr2: Okay "strout" works but "fretop" isn't correct: the new string is at $1fe7e and should be at $1fef6. I have to look in $869a=strlit)
(Edit nr3: Solved! "strlit" ($869a) puts a string, pointed to by the a-reg and y-reg, in the stringpool, but expects the string to end with a zero.)
(Edit nr4: Well, I didn't know the function of: dec 18, dec 18 so I threw them out. I ran "strout" once. It worked. Then I tried it in a loop of ten. It broke after three calls to "strout". I put dec 18, dec 18 back in and ran the loop of ten again. Now it broke after nine. No clue why that is. But if without dec 18's it runs for three and with 2 dec 18's it runs for nine calls to "strout", how many calls to "strout" will work if I put in another dec 18? That's what I did and it finished the loop of ten. Then I tried it with four hunderd calls. It kept on working. I will investigate this $18 later, but maybe you know the function of $18? Let me know. Then "length" or "ny". I set "ny" to $63 = stringlength after executing $869a.
Add one extra dec $18:
dec $18 ; old code
dec $18 ; old code
dec $18 ; extra dec $18 added
By the way: I changed jsr newfar into jsr $ff6e to run the code on my computer.)
(Edit nr5: I will try to change "strout" to work with arrays and put my "putaray" in the trashcan.)
Because your program did run okay until you used putaray, putaray must be faulty. I compared it to your "strout" and it turns out that putaray does not set the garbage bytes. I did a fix:
The new putaray:
string in "buffer" stringlength in "length" arrayindex in "index" first character of array-variable in "var1" second character of array-variable in "var2"
buffer to array
lda var1 ldx var2 ldy index sta 47 ; sys4871,asc("a"),asc("b"),index: ab$(index)=buffer txa ora #80 sta 48 sty index
lda 31 sta fd lda 32 sta fe
searchloop: lda 33 cmp fd bne search lda 34 cmp fe bne search jmp undefined
search: ldy #00 lda #fd ldx #01 jsr ff74 cmp 47 bne next iny lda #fd ldx #01 jsr ff74 cmp 48 beq putaray
next: ldy #02 lda #fd ldx #01 jsr ff74 sta fb iny lda #fd ldx #01 jsr ff74 sta fc
clc lda fd adc fb sta fd lda fe adc fc sta fe jmp searchloop
putaray: clc lda fd adc #07 sta fd lda fe adc #00 sta fe
ldx index beq indexfound
findindexloop: clc lda fd adc #03 sta fd lda fe adc #00 sta fe dex bne findindexloop
indexfound: ldy #00 lda #fd ldx #01 jsr ff74 ; get stringlength sta stringlength beq makeroom ; if stringlength is zero dont set the garbage bytes
iny lda #fd ldx #01 jsr ff74 ; get lowbyte pointer to string in stringpool sta fb
iny lda #fd ldx #01 jsr ff74 ; get highbyte pointer to string in stringpool sta fc
lda #fb sta 02b9 ; set pointer to stringpool for stashfar
ldy stringlength ; point to after the string where the garbage collect bytes are stored. tya ; acc=stringlength ldx #01 jsr ff77 ; set lowbyte garbage pointer to stringlength
iny lda #ff ldx #01 jsr ff77 ; set highbyte garbage pointer to #ff
makeroom: ldy length ; make room in the stringpool for the new string and two garbage bytes iny iny sty lentemp
sec lda 35 sbc lentemp sta 35 lda 36 sbc #00 sta 36
lda #35 sta 02b9 ; set stashfar pointer to stringpool
dey lda fe ldx #01 jsr ff77 ; store highbyte pointer to the string at array-index in arrayspace: garbage byte 2
dey lda fd ldx #01 jsr ff77 ; store lowbyte pointer to the string at array-index in arrayspace: garbage byte 1
dey L2: lda buffer,y ; new string in bufffer ldx #01 jsr ff77 ; store the new string in the stringpool dey bpl L2:
lda #fd sta 02b9 ; set stashfar pointer to arrayspace
ldy #00 lda length ldx #01 jsr ff77 ; store length
iny lda 35 ldx #01 jsr ff77 ; store pointer lowbyte to stringpool
iny lda 36 ldx #01 jmp ff77 ; store pointer highbyte to stringpool
undefined: ldy #00 undefloop: lda undeftext,y jsr ffd2 iny cpy #09 bne undefloop rts
undeftext .text "undefined" stringlength .byte lentemp .byte index .byte 5 length .byte 8 buffer .text "stiggity"
|
|
|
Post by stiggity on Apr 1, 2021 0:04:02 GMT
~Trashcan? Ohh My No!!! LOL... why you do datt???... I have learned sooo much with your help, Wendling!! the three $18's have been and have always been used.. But!!! I have discovered a bug with the STROUT code. If the "buffer0" has a quote in it, Like grabbing a directory string, and trying too turn the grabbed directory entry into a string, using strout. It WILL NOT allow the use of "Quote Mode". Wendling, your code is awesome!! i've been letting my circle of friends know your abilities. the "NY" horrid label is the length of the input buffer. I've been using the label "NY" for decades. iNY-reg. lol there's an issue, Wendling.. don't make NY = $63, NY is your desired strings end result/current length. I check in here, multiple times/day.. I'm excited too see what you put together!!!!!
|
|
|
Post by stiggity on Apr 1, 2021 1:26:27 GMT
Jeez.. the program runs perfectly, but the more times you read from, or write to an array... my buffer to string is returning ZILCH!!! not the putaray/getaray !, a replacement for the STROUT, using your techniques.. idk why??? i can use getaray/putaray 100 times, and the entire unit works, but it's that 101th time!! My prg is seeing syntax errors, where therer isnt one. Any routine that grabs a single key, simply detects fall through, and gives me a syntax error, which is handled by the error-trap, logged, and control back to the program. but!! now.. at any prompt, anything i type/enter into the buffer to string routine, returns a null buffer. idk...
|
|