Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "ti83plus.inc"
- #include "grammer.inc"
- #include "grammer2.5.inc"
- safearea = 8000h
- .db "Gram"
- .dw 0
- .dw 1
- .dw func0
- .org 0
- func0:
- ;=============================
- ; String Concatration
- ; Syntax:
- ; $CC(String1,String2,...
- ;=============================
- .db "CC",$10 ; String Concat
- .dw func0_end-func0_start
- func0_start:
- call ParseFullArg
- cp 2Bh ; check for comma
- ret z ; need more than 1 argu
- push bc \ pop hl \ push hl ; save string pointer/load it to hl
- call saveSScreen+GetGrammerStr-func0_start
- pop hl ; grab string pointer. BC is now a size of the tokens.
- push hl
- push bc ; save size and string pointer
- ld hl,saveSScreen+CONCATname-func0_start-1
- rst 10h ; rMov9ToOP1
- pop hl ; load byte size to hl
- push hl
- ld a,16h ; I want to create a temp prog
- bcall(_CreateVar) ; Current stack {sizebyte,pointer to tokens}
- pop bc
- pop hl
- push de
- push bc ; Current stack {sizebyte,pointer to prgmCC}
- inc de
- inc de ; calibrate location for ldir
- ldir ; prgmCC now contains the initial string
- grabrest:
- call ParseNextFullArg
- cp 2Bh
- ret z
- push bc \ pop hl \ push hl
- call saveSScreen+GetGrammerStr-func0_start
- pop hl ; grab string pointer. BC is now a size of the tokens.
- push hl
- push bc ; save size and string pointer
- ld hl,saveSScreen+TEMPname-func0_start-1
- rst 10h ; rMov9ToOP1
- pop hl ; load byte size to hl
- push hl
- ld a,16h ; I want to create a temp prog
- bcall(_CreateVar) ; Current stack {sizebyte,pointer to tokens,totalsizebye,pointer to prgmCC}
- pop bc
- pop hl
- push de
- push bc ; Current stack {sizebyte of TEMP,pointer to TEMP,totalsizebyte,pointer to prgmCC}
- inc de
- inc de ; calibrate location for ldir
- ldir ; prgmTEMP now contains the next string
- pop bc \ pop de \ pop hl \ pop ix
- push ix \ push hl
- add hl,bc
- ld (ix),l
- ld (ix+1),h ; change size data
- dec ix
- dec ix
- pop hl
- push bc
- push hl
- pop bc
- add ix,bc ; calibrate to last byte of CC
- pop bc
- push hl \ push de \ push bc
- push bc \ pop hl
- push ix \ pop de
- bcall(_InsertMem) ; CC size should be increased now
- inc de ; calibrate for ldir
- pop bc ; TEMP size
- pop hl ; TEMP loc
- push hl ; save TEMP loc
- inc hl
- inc hl ; calibrate for ldir
- pop ix
- add ix,bc
- push ix ; stores new size for CC
- ldir ; concat happens Stack: {TEMP loc, totalsize, CC loc}
- ld hl,saveSScreen+TEMPname2-func0_start
- rst 10h
- bcall(_ChkFindSym)
- bcall(_DelVar)
- pop hl
- jr grabrest
- pop hl
- pop bc
- inc bc
- inc bc
- ret
- func0_end:
- TEMPname:
- .db "TEMP"
- CONCATname:
- .db "CC"
- TEMPname2:
- .db TempProgObj,"TEMP",0
- GetGrammerStr:
- ld bc,0
- _:
- inc hl
- inc bc
- ld a,(hl)
- cp 4 \ ret z
- cp 3Fh \ ret z
- cp 2Ah \ jr nz,-_
- inc hl
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement