Der Post wurde leider vom Ersteller gelöscht aber da ich schon etwas gebastelt hatte...
Original Frage:
Hallo, guten Tag.
Ich möchte den Text von Volksforth-Seiten(Blöcken) entziffern.
Ein Block hat 1024 Byte.
Der besteht 16 Zeilen , eine Zeile hat 64 Zeichen.
Da der Text dort drinnen nur durch das Zeichen $20 getrennt ist erscheint er im Notepad++ als eine lange Zeile.
Nun möchte ich den Text auslesen.
16 mal und je ein Zeile 64 Byte lang zum lesen.
Ich möchte auch wieder Text den ich erstellt habe in diesen Forth-text umwandeln.
wie kann man das bitte anfangen?
Als Byte auslesen und dann in Text umwandeln und speichern?
Danke.
Gruss
Vorschlag:
Code: Alles auswählen
EnableExplicit
Structure VOLKSFORTH_BLOCK_STRUCT
chr.a[64]
EndStructure
Structure VOLKSFORTH_STRUCT
*block.VOLKSFORTH_BLOCK_STRUCT[16]
block_size.i[16]
EndStructure
Procedure.i VolksForthCreate(*Buffer)
Protected *vf.VOLKSFORTH_STRUCT
Protected index.i
Protected page.i
Protected *split.Ascii
If *Buffer
*vf = AllocateStructure(VOLKSFORTH_STRUCT)
If *vf
*vf\block = *Buffer
*split = *vf\block
For index = 0 To 1023
If *split\a = $20
*vf\block_size[page] = index << 4
page + 1
EndIf
*split + index
Next
EndIf
EndIf
ProcedureReturn *vf
EndProcedure
Procedure.s VolksForthString(*VolksForth.VOLKSFORTH_STRUCT,Index.i)
ProcedureReturn PeekS(*VolksForth\block[Index],*VolksForth\block_size[Index],#PB_Ascii)
EndProcedure
Procedure.i VolksForthRelease(*VolksForth)
FreeStructure(*VolksForth)
ProcedureReturn #Null
EndProcedure
;-> load ur VolksForthFile into a buffer
;-> call VolksForthCreate(*Buffer)
;-> use the result and call VolksForthString() to read a string
;-> call VolksForthRelease() at the end to release the allocatet memory