For the record, this code is NOT mine in any way, this all belongs to Iambian. I've not seen him around for a few days, so I'm not sure if he'd care about this code being posted, and if he wants it removed, I'll be more than happy to comply.

However, I'm hoping some ASM gurus might see if this code is doing something that might mess with the basic parser in some way:


Code:
;By Iambian Zenith
;your "verbose" errorsystem included. Same capabilities.
;

#include "ti83plus.inc"
.org userMem-2
.db $BB,$6D

myflag equ asm_flag1
HitEOF equ 0  ;EOF during getnextline reached
HitSOF equ 1  ;SOF during getprevline reached
HitEOL equ 2  ;End of line encountered
GetNew equ 3  ;Newline at end if inserting instead of replacing
NoNull equ 4  ;Do not invoke nullline error code if set
Delete equ 5  ;Set to delete information only
Hidden equ 6  ;is set if variable is "hidden"
temp1  equ tempswaparea+00
temp2  equ tempswaparea+02
SOF    equ tempswaparea+04  ;2adr,1pg,1buf. start of file
EOF    equ tempswaparea+08  ;ditto above. end of file
curpos equ tempswaparea+12  ;... current cursor position. +3=0 if in RAM
page   equ tempswaparea+16  ;Page number for when exiting or for var in arc
stack  equ tempswaparea+17  ;2b stack address for restoring at end of prog
pline  equ tempswaparea+19  ;2adr,1pg,1buf. Position of previously read line
memdel equ tempswaparea+23  ;2bytes. Amount of data deleted
memins equ tempswaparea+25  ;2bytes. Amount of data inserted. To be compared.

;Notes: Str0=Programname, tAns=LineToLookFor
;Error will output basic readable "::ERROR::" in str9
;Otherwise, will output string that tTheta points to.

;tTheta will contain instruction codes. 1=replace 2=insert
;any other number will just read a line

;Second revision of program, made to work better with
;a smaller size, and utilizes Ans variable for num input

;
;
programstart:
 di
 ld a,00011000b
 ld (IY+myflag),a  ;set and reset flags
 ld (stack),SP
 in a,(6)
 ld (page),a
 call gettheta
 ld bc,0   ;for memdel variable replacement
 jr z,continuemainjump
 dec e
jumpnode02:
 jp z,replaceline
 dec e \ jp z,insertline
 dec e \ jp z,createforbiddenstring
 dec e \ jr z,createforbiddenprog
 dec e \ jr z,movebetweenmedium
 dec e \ jr z,deletemyprogram
 set Delete,(IY+myflag)
 dec e \ jr z,jumpnode02
 dec e \ jp z,outputstatus
 jr EndJumpnode1
createforbiddenprog:
 call getprogramname
 jr nc,Err.ProgIsFound
 ld hl,0
 ld a,(Op1)
 and $1F
 cp $15
 jr z,$+6
 bcall(_CreateProg)
 ret
 bcall(_CreateAppVar)
 ret
Err.ProgIsFound:   call ProgramErr \ .db "::P>IS>FN"
continuemainjump:
 jr continuemain
movebetweenmedium:
 call getprogramname
 jp c,Err.PrgmNotFnd
 bcall(_Arc_Unarc)
 ret
deletemyprogram:
 call getprogramname
 jr c,movebetweenmedium+3
 bcall(_DelVarArc)
 ret
continuemain:
 res NoNull,(IY+myflag)
 call getprogramans
 jr z,getnumberoflines
 call getthisline
 push bc
  push bc
   ld hl,Str9
   rst 20h
   rst 10h
   bcallnc(_DelVarArc)
  pop hl
  bcall(_CreateStrng)
  inc de
  inc de
 pop bc
 ld hl,(pline)
 ld a,(pline+2)
 out (6),a
 call gethlinc
 ld (de),a
 inc de
 dec bc
 ld a,b
 or c
 jr nz,$-8   ;this section lifts the 255 byte per line limit
endJumpnode1:
 jr programend
getnumberoflines:
 ld de,0
 call getnextline
 inc de
 bit HitEOF,(IY+myflag)
 jr z,getnumberoflines+3
 ex de,hl
 bcall(_SetXXXXOp2)
 bcall(_Op2toOp1)
 bcall(_ZeroOp2)
 bcall(_StoTheta)
Err.MillinSyil:   call ProgramErr \ .db "::NUMSTNG"
getthisline:
linetestloop:
 ld (pline),hl  ;retrieve line prior to reading the line
 in a,(6)
 ld (pline+2),a
 call getnextline
 dec de
 bit HitEOF,(IY+myflag)
 jr nz,skiptestendsituation
 ld a,d
 or e
 jr nz,linetestloop  ;if z, passes through next section to reach linetestloopend. Saves 2 bytes.
skiptestendsituation:
 ld a,d
 or e
 jr nz,Err.LineNotFound
linetestloopend:
 ld a,b
 or c
 ret nz
 bit NoNull,(IY+myflag)
 ret nz
 call ProgramErr \ .db "::NULLSTR"
 ret
programend:
 ld SP,(stack)
 ld a,(page)
 out (6),a
 ret

Err.LineNotFound: call ProgramErr \ .db "::L>NT>FN"
Err.StrNotFnd:    call ProgramErr \ .db "::S>NT>FN"
Err.StrArchived:  call ProgramErr \ .db "::S>FLASH"

getstr9:
 ld hl,Str9
 rst 20h
 rst 10h
 jr c,Err.StrNotFnd
 ld a,b
 or a
 jr nz,Err.StrArchived  ;if archived, generate error
 ex de,hl
getsize:
 ld c,(hl)
 inc hl
 ld b,(hl)
 inc hl
 ld a,c
 or b
 ret

;Bytes for tokens. $3F=NewLine(hard-return) $3E=ColonChar(soft-return) - not used
;HL=address. Does not use DE. Screws up BC
;Positioned here to save a byte by the use of the JR instruction
Err.EntryTooLong: call ProgramErr \ .db "::E>2>LNG"
getnextline:
 res HitEOF,(IY+myflag)
 ld bc,0
getnextlineloop:
 push hl  ;old call for "checkposition"
  push bc
   ld bc,(EOF)
   sbc hl,bc
   jr nz,$+15  ;skip if address don't match
   ld a,(EOF+2)
   ld b,a
   in a,(6)
   cp b
   jr nz,$+6  ;skip EOF reached set if page don't match (for multipage arced vars)
   set HitEOF,(IY+myflag)
  pop bc
 pop hl
 bit HitEOF,(IY+myflag)
 ret nz
 call getHLinc
 cp $3F
 ret z
 inc bc
 ld a,c
 or b
 jr z,Err.EntryTooLong
 jr getnextlineloop
CheckSize:
 call getstr9
 jr z,Err.NullVar
 ld h,b
 ld l,c
 inc hl
 bcall(_EnoughMem)
 jr c,Err.EntryTooLong
 ret

getprogramname:
 ld hl,Str0
 call getstr9+3  ;skip over the "LD HL,Str9" part
 jr z,Err.NullVar  ;Str0 is null. Cannot accept input.
 ex de,hl
 ld hl,22
 sbc hl,bc  ;Can't be too long.
 jr c,Err.StrTooLong
 ld hl,Op1
 ld a,(de)
 cp $15   ;rowSwap( token equates to AppVar type
 jr z,$+5  ;jump over in order to copy in the type byte as well
 ld (hl),$05  ;Prog obj (not protected)
 inc hl
 ex de,hl
getprognamesubloop:
 ld a,(hl)
 inc hl
 cp $BB
 jr nz,getprognameminloop  ;2bytetok skip if not found.
 ld a,(hl)
 inc hl
 dec bc
 cp $BB  ;byte not used, see above
 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
 dec bc
 ld a,b
 or c
 jr nz,getprognamesubloop
 xor a   ;program would not reach this point if A wasn't zero. 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,$+19      ;skip if program info is found. Else, search for hidden
 ld a,(Op1+1)
 sub $40
 ld (Op1+1),A
 bcall(_ChkFindSym)
 jr c,$+6
 set Hidden,(IY+myflag)
 ret
Err.StrTooLong:   call ProgramErr \ .db "::S>2>LNG"
Err.NullVar:      call ProgramErr \ .db "::NULLVAR"
getprogram:  ;outputs and resets vectors for program data using Str0 stuffs.
 call getprogramname
 jr c,Err.PrgmNotFnd    ;kill program with this error if program is not found
 ex de,hl
 ld a,b
 out (6),a
 or a
 jr z,$+17  ;skip if already unarchived
 ld de,9        ;3
 call addDEtoHL ;3
 call getHLinc  ;3
 ld e,a         ;1
 ld d,0         ;2
 call addDEtoHL ;3 = 15
 call getHLinc
 ld e,a
 call getHLinc
 ld d,a
 ld (SOF),hl   ;address
 in a,(6)
; 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
   in a,(6)
   ld (EOF+2),a  ;page
  pop hl
 pop af
 out (6),a
 ret
Err.PrgmNotFnd:   call ProgramErr \ .db "::P>NT>FN"
Err.IsArchived:    call ProgramErr \ .db "::PGM>ARC"
;=====================================================================
deleteFix:
 bit HitEOF,(IY+myflag)
 jr nz,$+4
 inc bc  ;delete the next newline character to move next line into this one if there is one.
 inc de
 ld a,b
 or c
 jr z,Err.NullLine
 push bc
  bcall(_DelMem)
  call getprogram
 pop bc
 ld a,c
 cpl
 ld c,a
 ld a,b
 cpl
 ld b,a
 inc bc  ;NEG BC. HL-BC = HL+-BC
 call updateSizeWithBC+1
 jp ProgramErr-3
Err.NullLine:     call ProgramErr \ .db "::NULLINE"
replaceline:
 call checksize
 res GetNew,(IY+myflag)
 call getprogramans
 in a,(6)
 or a
 jr nz,Err.IsArchived
 call getthisline  ;BC=line length. IX=endOfBuffer
 ld hl,(pline)
 ld e,c
 ld d,b  ;Memory to delete is taken in DE
 bit Delete,(IY+myflag)
 jr nz,DeleteFix
 ld a,e
 or d
 jr z,Err.NullLine  ;HL=addy [DE,BC]=#toDelete
 push bc
  bcall(_DelMem)  ;BC does not stay intact, nor does it reflect what docs say
 pop bc
;insert program size updating routines here
;
insertline:
 push bc
  bit GetNew,(IY+myflag)
  call nz,checksize   ;check size if calling from insertline. Otherwise, don't want to check memory when the VAT's not been updated.
  call getprogramans
  call getthisline  ;scan file. (pline)=SOL
  call getstr9      ;HL=adr, BC=size
  jp z,Err.NullVar  ;Stop program if null variable exists; nothing to insert.
  push bc           ;save size of string to insert
   ld de,(pline)     ;Get address of SOL in DE
   ld h,b            ;BC -> HL
   ld l,c
   bit GetNew,(IY+myflag)  ;set if inserting line
   jr z,$+3
   inc hl   ;increasing for added $3F
   bcall(_InsertMem) ;HL=numbytestoinsert, DE=Address of insertion
   ld de,(SOF)
  pop hl   ;HL=bytestoinsert DE=adr
 pop bc    ;BC=replacement for (memdel).
 or a
 sbc hl,bc  ;insert-subtract
 ld c,l
 ld b,h
 bit GetNew,(IY+myflag)
 jr z,$+3
 inc hl
;HL=JUNK DE=ADDY BC=sizeupdate
 call updatesizewithBC
 call getans
 call getthisline
 call getstr9   ;should insert as much as Str9 has
 ld de,(pline)
 ldir
 bit GetNew,(IY+myflag)
 jr z,$+5
 ld a,$3F
 ld (de),a
 jp programend
ProgramErr:  ;HL already pushed by the call
 call makestring
 pop hl
 inc de
 inc de
 ldir
 jr ProgramErr-3  ; reusing "jp programend" jump found just above. Don't move this.
makestring:
 ld hl,Str9
 rst 20h
 rst 10h
 bcallnc(_DelVarArc)
 ld hl,9
 push hl
  bcall(_CreateStrng)
 pop bc
 ret
createforbiddenstring:
 call makestring
 ex de,hl
 inc hl
 inc hl
 ld (hl),$04  ;STO sym
 inc hl
 ld (hl),$2A  ;dblquote sym
 jr ProgramErr-3
 
getHLinc:
 ld a,(hl)
IncHL:
 bit 7,h
 inc hl
 ret nz
 bit 7,h
 ret z
 push af
  in a,(6)
  inc a
  out (6),a
 pop af
 res 7,h
 set 6,h
 ret
addDEtoHL:   ;cares for >16384 possibility. Overglorified ADD HL,DE wrt/ pages
 bit 7,h
 push af
  jr nz,addDEtoHLskip
  ld a,d
  rlca
  rlca
  and 00000011b  ;get two MSbits of H, and add to page with that
  push bc
   ld b,a
   in a,(6)
   add a,b
   out (6),a
  pop bc
  res 7,d
  res 6,d
addDEtoHLskip:
  add hl,de
 pop af
 jr IncHL+3  ;optimizing in space by reusing an old checking routine
 
checkposition:
; push hl
;  push bc
;   ld bc,(EOF)
;   sbc hl,bc
;   jr nz,$+15  ;skip if address don't match
;   ld a,(EOF+2)
;   ld b,a
;   in a,(6)
;   cp b
;   jr nz,$+6  ;skip EOF reached set if page don't match (for multipage arced vars)
;   set HitEOF,(IY+myflag)
;  pop bc
; pop hl
; ret
getprogramans:  ;
 call getprogram ;continue further for getans part of program
getans:
 push hl
  bcall(_RclAns)  ;obtain ANS var for line input.
  bcall(_ConvOp1)
 pop hl
 ld a,e
 or d   ;# of lines to go thru in DE
 ret
gettheta:
 push hl
  push bc
   ld hl,theta
   rst 20h
   rst 10h
   jr c,Err.ThetaNotFnd
   ld a,b
   or a
   jr nz,Err.ThetaNotFnd
   ex de,hl
   rst 20h
  pop bc
  jr getans+4  ;continue with ConvOp1 call in previous routine
Err.ThetaNotFnd:  call ProgramErr \ .db "::T>NT>FN"
UpdateSizeWithBC: ;DE=addy BC=sizeupdate
 ex de,hl
 dec hl
 ld d,(hl)  ;extract size to BC
 dec hl
 ld e,(hl)
 ex de,hl   ;HL=bytestoinsertfixed DE=adr
 add hl,bc  ;fixed address
 ex de,hl   ;HL=adr DE=fixedsizefield
 ld (hl),e  ;load size field with updated size
 inc hl
 ld (hl),d
 inc hl
 ret
outputstatus:
;output: "1234XXXXX"
;1= A/R Arc/RAM
;2= L/W/P Lock/Writable/appvar
;3= H/V   Hidden/Visible
;4= Reserved (space)
;XXXXX = five digit size
;
 call makestring  ;output: DE=addy
 inc de
 inc de
 push de
  call getprogram
 pop hl
 in a,(6)
 ld bc,$5241 ;C='A' B='R'
 bit 7,a
 jr z,$+4
 ld c,'E'    ;If in ExRAM, "E"
 ld (hl),c
 or a
 jr nz,$+3   ;default archived. Jump if so.
 ld (hl),b   ;load "R" to byte.
 inc hl
 ld bc,$4856 ;'V'+(256*'H')
 ld (hl),c
 bit Hidden,(IY+myflag)
 jr z,$+3
 ld (hl),b
 inc hl
 ld a,(Op1)
 ld bc,$574C ;'L'+(256*'W')
 ld (hl),'P'
 cp AppVarObj
 jr z,$+8
 ld (hl),c
 cp $05
 jr nz,$+3
 ld (hl),b
 inc hl
 ld (hl),$29  ;BASIC space token
 ld b,5
 inc hl
 ld (hl),'0'
 djnz $-3   ;setting to numerical string zero
 ex de,hl
 push de
  bcall(_SetXXXXOp2)
  bcall(_Op2toOp1)
  ld a,6
  bcall(_FormEReal)
 pop de
 ld hl,OP3
 add hl,bc  ;BC=string size
 dec hl
 lddr
 jp programend
 
;
debug:
; push hl \ push bc \ push de \ push af
; push ix \ push hl \ push de \ push bc \ push af
;; ld hl,0 \ ld (currow),hl
; pop hl \ call convertHtoT2b \ ld de,$0020 \ ld (Op6+4),de \ ld hl,Op6 \ bcall(_PutS) ;AF
; pop hl \ call convertHtoT2b \ ld de,$0020 \ ld (Op6+4),de \ ld hl,Op6 \ bcall(_PutS) ;BC
; pop hl \ call convertHtoT2b \ ld de,$0020 \ ld (Op6+4),de \ ld hl,Op6 \ bcall(_PutS) ;DE
; bcall(_NewLine)
; pop hl \ call convertHtoT2b \ ld de,$0020 \ ld (Op6+4),de \ ld hl,Op6 \ bcall(_PutS) ;HL
; pop hl \ call convertHtoT2b \ ld de,$0020 \ ld (Op6+4),de \ ld hl,Op6 \ bcall(_PutS) ;IX
; ld hl,0 \ add hl,sp \ call convertHtoT2b \ ld de,$0020 \ ld (Op6+4),de \ ld hl,Op6 \ bcall(_PutS) ;SP
; bcall(_NewLine)
; in a,(4)
; bit 3,a
; jr nz,$-4   ;keeps program from moving anywhere
; in a,(4)
; bit 3,a
; jr z,$-4   ;keeps program from moving anywhere
; pop af \ pop de \ pop bc \ pop hl
; ret
;#include "R/_hex.z80"

Str0:  .db $04,$AA,$09,$00
Str9:  .db $04,$AA,$08    ;taking cheap way out by using first $00 in theta name as null terminator
theta: .db $00,$5B,$00,$00

.echo "-----------------------\n"
.echo "Prgm CELTIC2 size: "
.echo $-programstart
.echo " bytes.\n"
.echo "-----------------------\n"

.end


And, if nothing else, this should be preserved in some fashion :p
Can you narrow down the problem at all, because that's a hell of a lot of code?

Code:
SetUpEditor |LBALI:1->dim(|LBALI:SetUpEditor |LPRTY:|LPRTY(1->|LBALI(1
ClrDraw:SetUpEditor |LPRTY2:|LPRTY->|LPRTY2
"0ZBD
prgmZRS:{94,0,3,15:prgmTEMP:prgmZC1
"rowSwap(ZSS->Str0:0->theta
1:prgmZCE:expr(Str9->Str4
{15,24:prgmZSP
SetUpEditor L6
60->dim(L6:Fill(0,L6
iPart(|LEPRTY(1->L6(43:|E2fPart(|LEPRTY(1->L6(46
"0ZEQU
prgmZRS:1->Z:prgmTEMP
prgmZC1
L6->L2


I put a ClrList L6, DelVar L6, or #->dim(L6 after this block of code (which is the very beginning of the battle system) and it kills the program with an ERR:SYNTAX.

The only time it is calling Celtic is the ZCE bit.


Code:
"rowSwap(ZSS->Str0:0->theta
1:prgmZCE


And to be honest, I'm not sure this IS the problem. I know Iambian said what he did to make things work is hacky at best. I'm just wondering if something he did to deal with appvars isn't causing issues with certain system variables.

Code:
Author Pseudoname..: Iambian Zenith
Date...............: O RLY?
Version............: v2.4
Project Title......: Celtic
Program Package....: (README) (BINARY) (SOURCE)
Platform...........: TI-83 Plus Series / TI-84 Plus Series
_________
Warning:|
--------/
DO NOT VIEW THIS DOCUMENT
WITH WORD-WRAP ENABLED.
______________
Introduction:|
-------------/
This is a toolkit for BASIC programs designed to edit or pull together
other BASIC programs into a custom-made file that is ready for
execution. It features the ability to read lines from either RAM or
Flash (archive), the ability to insert, delete, or overwrite lines in
a specified program, to create a specified program and to find out how
many lines there are in a BASIC program, and to output special
characters into a string that is not normally storable into a string
via any other method (doublequote and sto).
_____________
Definitions:|
------------/
The inputs and outputs are as follows:

Theta = Command input, containing the function number for the command.
Ans   = Answer variable. Usually defines the line number to search for.
Str0  = Standard input string. Depends on function, but is generally
        the name of the program to read from.
Str9  = Standard output string. It contains the output for a function.
        This string is also used for input if a line is being written.

Make sure the program you're reading from is either a BASIC program or
a carefully crafted data file that is meant to be read in this fashion.
_______
NOTE!:|
------/
If you input a program's name, you can prefix it with the token
"rowSwap(", which is found in the Matrix menu, you ask the program to
look up the name as an AppVar instead of as a program. Example:

"ABBA"->Str0            //refers to a program
"rowSwap(ABBA"->Str0    //refers to an appvar.

Important to remember:
(1) You DO NOT CLOSE the parentheses.
(2) The "rowSwap(" goes inside the quotes so that it's read as part
    of the string. The technical reason why I do this is because the
    byte referring to "rowSwap(" is $15, which corresponds to the
    AppVar variable type.

Also, you may use lowercase for AppVars, but you will screw up your
program names (you cannot reference them in your program) if you try
to do that with a program var. Always use uppercase letters w/o spaces
for names unless you are, say, accessing another appvar
(i.e. "MirageOS") or you are sure you're not going to try to create
another program, or that there's no conflict with names.

"rowSwap(MirageOS"->Str0   //referring to AppVar "MirageOS". Heh.

_______________
Command input:|
--------------/
All commands are sent through variable Theta (the character next to
the "Z" key on the calculator). All commands are numeric, and the
following list shows what numbers tell the program to do what.

---------------------------------------------------------------------------------
Theta = 0 : Read a line from a program

 Inputs: Str0 = Name of program to read from
         Ans  = Line number to read from (first line is "1")
 Output: Str9 = Contents of line read. Error "..NULLINE" if the line is empty.
                May also contain other error codes if conditions are wrong.

 Others: If Ans = 0, then Theta will be overwritten with the number of lines
         in the program being read. Useful for editors, curiousities, and verification.

---------------------------------------------------------------------------------
Theta = 1 : Replace (overwrite) a line in a program
 Inputs: Str0 = Name of program to read from
         Ans  = Line number to write to (first line is "1")
         Str9 = Material to replace line in Ans with

 Output: Str9 = If it's intact, no error occurred. Else, check for error codes.

---------------------------------------------------------------------------------
Theta = 2 : Insert a line in a program

 Inputs: Str0 = Name of program to read from
         Ans  = Line number to write to (first line is "1")
         Str9 = Material to insert into a program. The line
                that was occupied is shifted down one line and
                this string is inserted into the resulting spot

 Output: Str9 = If it's intact, no error occurred. Else, check for error codes.

---------------------------------------------------------------------------------
Theta = 3 : Output "special" string containing STO and doublequote chars

 Inputs: None

 Outputs: Str9 = Sto and doublequote characters, in that order. Use substrings
                 to extract them. If using the standard version of Celtic, the
                 string will be 9 characters long, the other 7 being junk. This
                 should not affect the integrity of string just as long as you
                 extract only the first two characters.

---------------------------------------------------------------------------------
Theta = 4 : Create a program variable given a name
 Inputs: Str0 = Program name to create

 Outputs: Str9 = Intact if nothing went wrong. Otherwise, an error code results.
          If successful, you will be able to read the first line of the newly
          created program as a null line.
          Str0 = Intact with program's name to be created.

---------------------------------------------------------------------------------
Theta = 5 : Archive/unarchive a program variable given a name

 Inputs: Str0 = Program name to archive/unarchive

 Outputs: The resulting program is shifted between mediums.

---------------------------------------------------------------------------------
Theta = 6 : Delete a program variable given a name

 Inputs: Str0 = Program name to delete

 Outputs: The resulting program is deleted.

---------------------------------------------------------------------------------
Theta = 7 : Delete a line from a program

 Inputs: Str0 = Name of program to delete from
         Ans  = Line number to delete from (first line is "1")
 Output: Str9 = Contains error codes if conditions are wrong.

 Others: If Ans = 0, then Theta will be overwritten with the number of
         lines in the program being read.

---------------------------------------------------------------------------------
Theta = 8 : Output status string

 Inputs: Str0 = Name of program to delete from
 Output: Str9 = Contains 9 byte output codes.
         1st character: "A"=Archived  "R"=RAM "     "E"=ExRAM
         2nd character: "V"=Visible   "H"=Hidden
         3rd character: "L"=Locked    "W"=Writable  "O"=AppVar
         4th character: --RESERVED-- (filled with space char)

         Five character string afterward is the size of data portion of variable

---------------------------------------------------------------------------------

__________
Examples:|
---------/
Perhaps you wanted to write your own BASIC program from within a BASIC
program. We can create a new program called "HELLO" and have it be the
ever-famous "Hello World" program.
(the starting colons on each line are implied)
(let "T" represent variable theta, and "->" represent the STO symbol)

"HELLO"->Str0                         //Store program name in Str0 for input
4->T                                  //Command 4: Create new program
Asm(prgmCELTIC2)                      //Execute util.
3->T                                  //Command 3: Create special char string
Asm(prgmCELTIC2)                      //Execute util.
sub(Str9,2,1)->Str1                   //Extract doublequote char and put it in Str1
"Disp"+Str1+"HELLO WORLD"+Str1->Str9  //String concentration. "Disp" is BASIC token, not text
1->T                                  //Command 1: Overwrite line
1                                     //Storing 1 to Ans var. Write to line one
Asm(prgmCELTIC2)                      //Execute util.
prgmHELLO                             //Run the newly created program.
                                      //Creating a "HELLO WORLD" program should've been simpler :P

You know. I'm still working on this. More examples later, but at least
the example here shows what the program is capable of. Use it to read
from other programs (not shown in example) and then output to a new
program. Or you could save high score information in games, or string
data for large RPGs.

Of course, none of these examples shows the use of error codes; it
assumes that conditions are perfect when the program runs, but in your
case, it might not be. For example. prgmHELLO in the first example
could've already existed and that possibility could've been tested by
checking error codes before trying to write them.
_____________
Error Codes:|
------------/
You will probably get some errors when you try to use this program.
They will be outputted to Str9 in the event one such error did occur.
Here is a list of the errors that you will see and meanings to them:

"..P:IS:FN" : Program Is Found. User tried to create an existing program
"..NUMSTNG" : Status message. Shows that the # of lines is in Theta.
"..NULLSTR" : Null String. User passed an empty string to Celtic
"..L:NT:FN" : Line Not Found. Line number defined in Theta isn't there.
"..S:NT:FN" : String Not Found. Str9/Str0 is not defined or is archived.
"..E:2:LNG" : Entry too long. Not enough memory to store read string.
"..S:2:LNG" : String Too Long. Str0 exceeds max filename length
"..NULLVAR" : Null variable. A string or a variable has not been set.
"..P:NT:FN" : Program Not Found. Name of program in Str0 is undefined.
"..PGM:ARC" : Program Archived. User tried to edit an archived file.
"..T:NT:FN" : Theta Not Found. Theta is not defined or is archived.
"..NULLINE" : Null Line. User attempted to read an empty line.

____________
Disclaimer:|
-----------/
----------------------------------------------------------------------
Although this program has been tested to ensure that it doesn't
crash outright, there is no guarantee that this program will not
perform an undesired action that may result in loss of data, loss of
profits, loss of time, or just a general loss of anything. I do not
take responsibility for any problems that this program may cause, and
all responsibility is thusly transferred to the user.
In essence, if you have a problem, I am not obligated to take
responsibility in any way, shape, or form. Got a problem? Don't
use the program.
_________________
Version History:|
----------------/
Afterthoughts are not nice. I don't really
have a version history.

1.0 -- simple line count and reading
1.4 -- slimmed code down

2.0 -- rewrote entire program, added line add and delete function
2.1 -- rewrote code to allow transparent flash-based operations
2.2 -- added in create/delete/(un)archive program with appvar support
2.3 -- re-implemented untested delete line function
2.4 -- Added program status output. See appropriate section. Cmd 8

________________
Special Thanks:|
---------------/
(telroth / Darth Android) - For asking me to develop a program like this.
( tifreak8x )             - Thanks for being one of my first users
UTI Forum users           - Thanks for supporting my project 100%
DragonFire IRC users      - Thanks for beta testing more unstable versions

Did I forget your name? I don't actually check email, so just find me in the
DragonFire chatrooms. irc://www.unitedti.org/UnitedTI
Now that I remember, I *know* I forgot someone, especially that guy who
asked me about making the program do things like change lines around.

Copyright © 2007 Rodger Weisman (Iambian Zenith)
I've agreed to rewrite Celtic II from scratch and hopefully fix the delete line problem that prevented me from placing my full trust in the later versions of this program. Maybe shave off a few bytes and make the whole thing run faster. No guarantees as to the previous statement, but hey. We'll see.

EDIT: Unfortunately, the new code (probably) won't look any better than the old code. I suppose that's how optimization works?

EDIT2: The new code is still being worked on. I've changed how the get line function works so this'll take some time to debug, so instead... I ran branchmap on the old Celtic II code and this is what I come up with:

65 branches
50 calls
23 bcalls
54 labels

Yes. I am distracted.
I'd be happy to mercilessly criticize your code, if you like. I definitely support this project, though, and I hope you'll let me know if there's anything I can do to help.
Here is the code I have so far for the Celtic Diagnostic program, as I am tentatively calling it. Something that Iambian had asked me to write up so we can properly test the newest version of Celtic2 when he manages to get it rewritten and working. Smile


Code:
Goto A
Lbl ER
If Str9="..P:IS:FN"
Text(X,1,"Error! Program already exists!
If Str9="..NUMSTNG"
Text(X,1,"Number of lines in ",Str9,": ",theta
If Str9="..NULLSTR"
Text(X,1,"Error! Str0/Str9 contains no data!
If Str9="..L:NT:FN"
Text(X,1,"Error! Line number in Ans not found!
If Str9="..S:NT:FN"
Text(X,1,"Error! Str0/Str9 archived or not defined!
If Str9="..E:2:LNG"
Text(X,1,"Error! Not enough RAM to store to Str9!
If Str9="..S:2:LNG"
Text(X,1,"Error! Str0 exceeds eight characters!
If Str9="..NULLVAR"
Text(X,1,"Error! Variable or string not defined!
If Str9="..P:NT:FN"
Text(X,1,"Error! Name of program in Str0 not found!
If Str9="..PGM:ARC"
Text(X,1,"Error! Program archived, cannot edit!
If Str9="..T:NT:FN"
Text(X,1,"Error! Theta not defined or archived!
If Str9="..NULLINE"
Text(X,1,"Error! Attempted to read empty line!
Pause:Return
Lbl A
AxesOff:CoordOff:7->X
ClrDraw
"123456"
Text(1,1,"Celtic 2 Diagnostic Tool
Text(7,1,"Testing 'Read from program'
X+6->X
0->theta:"C2DIAG"->Str0
30:Asm(prgmCELTIC2
If sub(Str9,1,2)="..":Goto ER
expr(Str9->A
If A=123456:Then
Text(X,1,"'Read from program' functioning
X+6->X
Text(X,1,"Testing 'Create program' function
4->theta:"TEST1"->Str0
Asm(prgmCELTIC2
If sub(Str9,1,2)="..":Goto ER
Text(X,1,"Program created
X+6->X
Text(X,1,"Testing 'Write to program' function
X+6->X
"ClrHome:Output(4,4,A:Pause "->Str9:"TEST1"->Str0
1->theta:1:Asm(prgmCELTIC2
If sub(Str9,1,2)="..":Goto ER
prgmTEST1

Code:
Goto A
Lbl ER
If Str9="..P:IS:FN"
Text(X,1,"Error! Program already exists!
If Str9="..NUMSTNG"
Text(X,1,"Number of lines in ",Str9,": ",theta
If Str9="..NULLSTR"
Text(X,1,"Error! Str0/Str9 contains no data!
If Str9="..L:NT:FN"
Text(X,1,"Error! Line number in Ans not found!
If Str9="..S:NT:FN"
Text(X,1,"Error! Str0/Str9 archived or not defined!
If Str9="..E:2:LNG"
Text(X,1,"Error! Not enough RAM to store to Str9!
If Str9="..S:2:LNG"
Text(X,1,"Error! Str0 exceeds eight characters!
If Str9="..NULLVAR"
Text(X,1,"Error! Variable or string not defined!
If Str9="..P:NT:FN"
Text(X,1,"Error! Name of program in Str0 not found!
If Str9="..PGM:ARC"
Text(X,1,"Error! Program archived, cannot edit!
If Str9="..T:NT:FN"
Text(X,1,"Error! Theta not defined or archived!
If Str9="..NULLINE"
Text(X,1,"Error! Attempted to read empty line!
If sub(Str9,1,2)=".." and Str9!="..P:IS:FN" and Str9!="..NUMSTNG" and Str9!="..NULLSTR" and Str9!="..L:NT:FN" and Str9!="..S:NT:FN" and Str9!="..E:2:LNG" and Str9!="..S:2:LNG" and Str9!="..NULLVAR" and Str9!="..P:NT:FN" and Str9!="..PGM:ARC" and Str9!="..T:NT:FN" and Str9!="..NULLINE"
Text(X,1,"Error! Undefined error occurred!
Pause:Return
Lbl A
AxesOff:CoordOff:7->X
ClrDraw
"123456"
Text(1,1,"Celtic 2 Diagnostic Tool
Text(7,1,"Testing 'Read from program'
X+6->X
0->theta:"C2DIAG"->Str0
32:Asm(prgmCELTIC2
If sub(Str9,1,2)="..":Goto ER
expr(Str9->A
If A=123456:Then
Text(X,1,"'Read from program' functioning
X+6->X
Text(X,1,"Testing 'Create program' function
X+6->X
4->theta:"TEST1"->Str0
Asm(prgmCELTIC2
If sub(Str9,1,2)="..":Goto ER
"X=25
Text(X,1,"Program created
X+6->X
Text(X,1,"Testing 'Write to program' function
X+6->X
"ClrHome:Output(4,4,A:Pause "->Str9:"TEST1"->Str0
1->theta:1:Asm(prgmCELTIC2
If sub(Str9,1,2)="..":Goto ER
prgmTEST1
"X=37
Text(X,1,"'Write to program' functioning
X+6->X
Text(X,1,"Testing 'Special string' function
X+6->X
If sub(Str9,1,2)="..":Goto ER
Text(X,1,Str9
1->X
Text(5,50,"Press Enter to continue..
Repeat getKey
End
ClrDraw
"X=1
Text(X,1,"Testing 'Insert line and Line count' functions
X+6-X
2->theta:"TEST1"->Str0
1:Asm(prgmCELTIC2
If sub(Str9,1,2)="..":Goto ER
0->theta:0
Asm(prgmCELTIC2
If sub(Str9,1,2)=".." and Str9!="..NUMSTNG":Goto ER
If theta=2
Text(X,1,"'Insert line and line count' functioning
X+6->X
Text(X,1,"Lines in prgmTEST1: ",theta
X+6->X
"X+24


What this covers:

theta=0: Reading lines from a program, amount of total lines in a program
theta=1: Replacing a line inside a program
theta=2: Inserting a line into a program
theta=3: Output of special string with -> and " characters
theta=4: Creation of program variable.

@Iambian: Is the theta=4 instruction supposed to also do appvars?
You are supposed to be able to create appvars with theta=4.

Still working away at making the line get routine bulletproof. Problems with respect to what happens at and around the end of the input file is messing me up.
Alright then, I need to add that function to the test program as well and see what happens. I don't know if the old copy of C2 would do it. And the new copy is just broke. :p
Source got lost in the shuffle while I was switching to Win7. Tried to get it back but the file was unrecoverable.

Sorry guys.

This event almost makes me wish I stuck with Crimson Editor while coding Celtic 2.5. At least I would've been able to put the project back together through the numerous backups it tends to create.
So you've lost all the progress you've made over the last few days? Or are we talking about the newest version that was available before you restarted writing?

edit:

nevermind :<
Iambian wrote:
Source got lost in the shuffle while I was switching to Win7. Tried to get it back but the file was unrecoverable.

Sorry guys.

This event almost makes me wish I stuck with Crimson Editor while coding Celtic 2.5. At least I would've been able to put the project back together through the numerous backups it tends to create.
That sucks, sorry to hear it. Sad Was the culprit a failure to create backups at a regular basis, or saving the files in a directory that was not being backed up?
He forgot to grab the folder because of a weird name and wiped the drive to replace Vista with 7. :<
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement