Advertisement
Guest User

Untitled

a guest
Feb 9th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "ti83plus.inc"
  2. #include "grammer.inc"
  3. #include "grammer2.5.inc"
  4. safearea = 8000h
  5. .db "Gram"
  6. .dw 0
  7. .dw 1
  8. .dw func0
  9. .org 0
  10. func0:
  11. ;=============================
  12. ;  String Concatration
  13. ;  Syntax:
  14. ;  $CC(String1,String2,...
  15. ;=============================
  16.     .db "CC",$10 ; String Concat
  17.     .dw func0_end-func0_start
  18. func0_start:
  19.     call ParseFullArg
  20.     cp 2Bh ; check for comma
  21.     ret z ; need more than 1 argu
  22.     push bc \ pop hl \ push hl ; save string pointer/load it to hl
  23.     call saveSScreen+GetGrammerStr-func0_start
  24.     pop hl ; grab string pointer. BC is now a size of the tokens.
  25.     push hl
  26.     push bc ; save size and string pointer
  27.     ld hl,saveSScreen+CONCATname-func0_start-1
  28.     rst 10h ; rMov9ToOP1
  29.     pop hl ; load byte size to hl
  30.     push hl
  31.     ld a,16h ; I want to create a temp prog
  32.     bcall(_CreateVar) ; Current stack {sizebyte,pointer to tokens}
  33.     pop bc
  34.     pop hl
  35.     push de
  36.     push bc ; Current stack {sizebyte,pointer to prgmCC}
  37.     inc de
  38.     inc de ; calibrate location for ldir
  39.     ldir ; prgmCC now contains the initial string
  40. grabrest:
  41.     call ParseNextFullArg
  42.     cp 2Bh
  43.     ret z
  44.     push bc \ pop hl \ push hl
  45.     call saveSScreen+GetGrammerStr-func0_start
  46.     pop hl ; grab string pointer. BC is now a size of the tokens.
  47.     push hl
  48.     push bc ; save size and string pointer
  49.     ld hl,saveSScreen+TEMPname-func0_start-1
  50.     rst 10h ; rMov9ToOP1
  51.     pop hl ; load byte size to hl
  52.     push hl
  53.     ld a,16h ; I want to create a temp prog
  54.     bcall(_CreateVar) ; Current stack {sizebyte,pointer to tokens,totalsizebye,pointer to prgmCC}
  55.     pop bc
  56.     pop hl
  57.     push de
  58.     push bc ; Current stack {sizebyte of TEMP,pointer to TEMP,totalsizebyte,pointer to prgmCC}
  59.     inc de
  60.     inc de ; calibrate location for ldir
  61.     ldir ; prgmTEMP now contains the next string
  62.     pop bc \ pop de \ pop hl \ pop ix
  63.     push ix \ push hl
  64.     add hl,bc
  65.     ld (ix),l
  66.     ld (ix+1),h ; change size data
  67.     dec ix
  68.     dec ix
  69.     pop hl
  70.     push bc
  71.     push hl
  72.     pop bc
  73.     add ix,bc ; calibrate to last byte of CC
  74.     pop bc
  75.     push hl \ push de \ push bc
  76.     push bc \ pop hl
  77.     push ix \ pop de
  78.     bcall(_InsertMem) ; CC size should be increased now
  79.     inc de ; calibrate for ldir
  80.     pop bc ; TEMP size
  81.     pop hl ; TEMP loc
  82.     push hl ; save TEMP loc
  83.     inc hl
  84.     inc hl ; calibrate for ldir
  85.     pop ix
  86.     add ix,bc
  87.     push ix ; stores new size for CC
  88.     ldir ; concat happens Stack: {TEMP loc, totalsize, CC loc}
  89.     ld hl,saveSScreen+TEMPname2-func0_start
  90.     rst 10h
  91.     bcall(_ChkFindSym)
  92.     bcall(_DelVar)
  93.     pop hl
  94.     jr grabrest
  95.     pop hl
  96.     pop bc
  97.     inc bc
  98.     inc bc 
  99.     ret
  100. func0_end:
  101.  
  102. TEMPname:
  103.     .db "TEMP"
  104. CONCATname:
  105.     .db "CC"
  106. TEMPname2:
  107.     .db TempProgObj,"TEMP",0
  108. GetGrammerStr:
  109.   ld bc,0
  110. _:
  111.   inc hl
  112.   inc bc
  113.   ld a,(hl)
  114.   cp 4 \ ret z
  115.   cp 3Fh \ ret z
  116.   cp 2Ah \ jr nz,-_
  117.   inc hl
  118.   ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement