Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- _ConvKeyToTok=4A02h
- ;_Get_Tok_Strng=4594h
- ;_CreateTempString=4324h
- _ExecuteNewProgram=4C3Ch
- _PutS=450Ah
- _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:
- bit 3,(iy+36h)
- jr z,setuphook
- ld hl,(8000h)
- ld a,h
- or l
- jr z,directions
- ld (tablestart),hl
- ld de,(8002h)
- sbc hl,de
- ld (tablesize),hl
- in a,(6)
- ld (pagereturn),a
- ld c,-1
- pagesearchloop:
- inc c
- ld a,c
- out (6),a
- ld (hl),a
- add a,2
- jr nz,pagesearchloop
- inc hl
- ld a,(hl)
- dec hl
- sub 9
- jr nz,pagesearchloop
- ld a,c
- ld (pagebase),a
- ld hl,0
- ld (8000h),hl
- ld (8002h),hl
- bcall(5047h) ;disablehook
- ; bcall(4F90h) ;disablehook
- ld hl,progname
- ld a,6
- bcall(_ExecuteNewProgram)
- ret
- setuphook:
- ld hl,hook
- ld de,9872h
- ld bc,hookend-hook
- ld a,c
- push de
- ldir
- pop hl
- ld (8000h),bc
- ld (8002h),bc
- bcall(5044h) ;enable catalog1 hook
- ; bcall(4F8Dh) ;enable catalog2 hook
- directions:
- ld hl,help
- bcall(_PutS)
- ret
- hook:
- .db 83h
- cp 5
- jr nz,$+5
- ld (8000h),hl
- cp 6
- ret nz
- ld (8002h),de
- ret
- hookend:
- 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:
- help:
- .db "Open the catalog"
- .db "Then run this "
- .db "program again. ",0
- .echo "setup:",$-$9D95
- .echo "catelem:",progend-progstart-2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement