Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;============================
- fBinRead:
- ld hl,(var2) ;get Y
- ld a,l ;check
- or h ;if zero
- jp z,Err.NULLVAR ;If zero, then error condition; not reading any bytes
- push hl ;store # of bytes to read
- add hl,hl ;double this for string recall creation
- call makestring+3 ;create Str9 with as many bytes as hex digits
- push de ;save position of string
- ld hl,(var3)
- ld a,(sargs)
- or a
- jr z,$+5
- call getprogram ;locate program variable
- ld de,(var1) ;store back nth byte
- call AddDEtoHL ;get position to start reading from
- push hl
- bcall(_Op4toOp1)
- pop hl
- pop de ;restore position of the string
- pop bc ;restore # of bytes to read as BC for looping
- jp BinStringToHex
- getprogramname:
- ld hl,sc1
- call getsourcestring ;skip over the "LD HL,Str9" part
- jp z,Err.NULLVAR ;Str0 is null. Cannot accept input.
- ex de,hl
- ld hl,-22 ;This number picked to prevent terrible buffer overflow
- add hl,bc ;Can't be too long.
- jp c,Err.ENTRYTOOLONG
- ld hl,Op1
- ld a,(de) ;DE=input string. first byte
- cp $15 ;rowSwap( token equates to AppVar type
- jr z,skip923 ;jump over in order to copy in the type byte as well
- bit gList,(iy+myflag)
- jr z,skip922
- cp $5D ;official list token. L1 thru L6
- jr z,$+6 ;skip to handling list
- cp $EB ;list token used to name user-defined lists
- jr nz,skip922 ;skip to comparing all else if this is not a list
- ld (hl),$01 ;type byte for rList
- inc hl
- ld a,$5D ;list type
- ld (hl),a
- inc hl ;increment pointer to fill in list name data
- inc de ;increment pointer to get list name data
- dec bc ;decrement size of data for the list.
- jr skip923
- skip922:
- bit gGroup,(iy+myflag) ;
- jr z,$+7 ;
- ld a,(de) ;
- cp $17 ;*row( token equates to Group type
- jr z,skip923 ;
- ld (hl),$05 ;Prog obj
- inc hl
- skip923:
- ex de,hl
- ld b,c ;
- getprognamesubloop: ;
- ld a,(hl) ;
- inc hl ;
- cp $BB ;
- jr nz,getprognameminloop ;2bytetok skip if not found.
- ld a,(hl) ;
- inc hl ;
- dec b ;
- cp $BB ;byte not repeated in series. Skipping $BB in series.
- jr c,$+3 ;because of that, if less than that num, do not alter num
- dec a ;
- sub $B0-$61 ;decrease by appropriate number of bytes. Yeah.
- getprognameminloop: ;
- ld (de),a ;
- inc de ;
- djnz getprognamesubloop ;
- xor a ;would not reach this point if A!=0. See "LD A,B" earlier.
- ld (de),a ;clear out next byte for null-terminated string
- bcall(_ChkFindSym) ;check for program with name retrieved from Str0
- jr nc,$+30 ;skip if program info is found. Else, search for hidden
- ld hl,Op1+1 ;
- ld a,(hl) ;
- add a,-$40 ;
- ld (hl),a ;
- bcall(_ChkFindSym) ;
- jr c,$+8 ;
- set Hidden,(IY+myflag) ;
- jr $+12 ;
- push af ;
- ld a,(Op1+1) ;
- add a,$40 ;set back to normal
- ld (Op1+1),a ;
- pop af ;
- ret
- getprogram: ;outputs and resets vectors for program data using Str0 stuffs.
- call getprogramname
- jp c,Err.PRGMNOTFOUND ;kill program with this error if program is not found
- ex de,hl
- ld a,b
- ld (cpage),a
- or a
- jr z,$+15 ;2 skip if already unarchived
- ld de,9 ;3
- call addDEtoHL ;3
- call getHLinc ;3
- ld e,a ;1 ,D already set to zero
- call addDEtoHL ;3 = 15
- getvarcoll:
- ld (SOF),hl ;address at start of size field
- call getHLinc
- ld e,a
- call getHLinc
- ld d,a
- ld a,(cpage)
- ; ld (SOF+2),a ;page
- push af
- push hl
- call addDEtoHL ;add in size and compensate for page stuffs if in Flash
- ld (EOF),hl ;address
- ld a,(cpage)
- ld (EOF+2),a ;page
- pop hl
- pop af
- ld (cpage),a
- ret
Advertisement
Add Comment
Please, Sign In to add comment