Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;;this version directly searches for the catalog data, instead of relying on the user for help and destroying the catalog hook
- _ConvKeyToTok=4A02h
- ;_Get_Tok_Strng=4594h
- ;_CreateTempString=4324h
- _ExecuteNewProgram=4C3Ch
- _RclAns=4AD7h
- _ConvOP1=4AEFh
- keyExtend=8446h
- OP1=8478h
- OP3=OP1+33
- ;_OP4ToOP1=4138h
- _SetXXXXOP2=4792h
- _OP2ToOP1=4156h
- _StoAns=4ABFh
- #define bcall(x) rst 28h \ .dw x
- .db $BB,$6D
- .org $9D95
- SetUpCatalogElement:
- ;;search for the the catalog stuff
- in a,(6)
- ld (pagereturn),a
- ld d,a ;return page
- xor a
- out (6),a ;start at page 0
- ld c,a
- ld hl,4000h
- ld b,h
- searchloop:
- ld a,-2
- cpir
- jr z,$+7
- call incmem+2
- jr searchloop-1
- inc l
- call z,incmem
- ld a,(hl)
- cp 9
- jr nz,searchloop
- inc l
- call z,incmem
- ld a,(hl)
- add a,2
- jr nz,searchloop
- inc l
- call z,incmem
- ld a,(hl)
- cp 16
- jr nz,searchloop
- ;;match found at HL-3
- in a,(6)
- ld e,a
- ld a,d
- out (6),a
- dec hl
- dec hl
- dec hl
- ld a,h
- add a,40h
- jp m,$+5
- ld h,a
- dec e
- ld a,e
- ld (pagebase),a
- ld (tablestart),hl
- ex de,hl
- ld hl,-19Ch
- add hl,de
- ld a,(hl)
- inc hl
- ld h,(hl)
- ld l,a
- or a
- sbc hl,de
- rr h
- rr l
- ld (tablesize),hl ;need to find some way to actually get this
- ld hl,progname
- ld a,6
- bcall(_ExecuteNewProgram)
- ret
- progname:
- .db "CATELEM",0
- .dw progend-progstart
- progstart:
- .db $BB,$6D
- bcall(_RclAns)
- and $1F
- ret nz
- bcall(_ConvOP1)
- tablesize =$+1
- ld hl,0
- or d
- jr z,returnsize
- dec de
- sla e
- rl d
- add hl,de
- jr c,dne
- tablestart=$+1
- ld hl,0
- pagebase=$+1
- ld a,1
- out (6),a
- add hl,de
- ld a,(hl)
- ;FF=>FE, FD=>0
- cp $FD
- jr nz,$+3
- xor a
- add a,1
- sbc a,1
- ld c,a
- inc hl
- ld a,(hl)
- ld (keyExtend),a
- jr z,$+3
- ld a,c
- bcall(_ConvKeyToTok)
- pagereturn=$+1
- ld a,7
- out (6),a
- ld c,1
- ld hl,OP3+1
- ld (hl),e
- inc d
- dec d
- jr z,$+5
- dec l
- ld (hl),d
- inc c
- outstr:
- ld b,0
- push hl
- push bc
- ld a,7
- sub c
- ld c,a
- push bc
- bcall(4B52h) ;AnsName
- rst 10h
- ld (hl),4
- pop hl
- push de
- inc de
- inc de
- ex de,hl
- bcall(4357h) ;delmem
- pop hl
- pop bc
- pop de
- ld (hl),c
- inc hl
- ld (hl),b
- inc hl
- ex de,hl
- ldir
- ret
- dne:
- ld c,3
- ld hl,s_dne
- jr outstr
- returnsize:
- sub l
- ld l,a
- sbc a,a
- sub h
- ld h,a
- srl h
- rr l
- inc hl
- bcall(_SetXXXXOP2)
- bcall(_OP2ToOP1)
- stoans:
- bcall(_StoAns)
- ret
- s_dne=$-progstart+$9D93
- .db "DNE"
- progend:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement