## RECOMP

PURPOSE:
The RECOMP statement Recompiles a complete program.

    STATEMENT SYNTAX:
    Recompiles the program in the workspace
    RECOMP
    Recompile the program in P!
    1000 RECOMP P![""]
    Recompiles the program in P! while renumbering it based on L!
    1000 RECOMP P![""],L![""]
    Recompile program in P! while generating Cross Reference Information
    1000 X!["XREF"]=1;RECOMP P![""],X![""]

L! above contains a Line Number Array with the following format:
The Key the Current Line Number as a 3 byte binary number (eg BIN(1000,3) for line 1000)
The Data the New Line Number as a 4 byte Little Endian number (eg SWAP(BIN(1000,4),$07$) for line 1000)
The following program renumbers the program "MYPROG" so that the first line number is 1000 and subsequent line numbers are an increment of 5.

    10 BEGIN
    20 DIM P!
    30 LOADPROG "MYPROG",P![""]
    40 DIM L!
    50 LET NL=1000
    60 LET L$=P!["L"]
    70 LET L$=P![#ksa_current_key]
    80 GOTO 0100
    90 LET L$=P![#ksa_next_key]
    100 IF L$(1,1)<>"L" THEN GOTO 0160
    110 LET L$=L$(2)
    120 LET NL$=SWAP(BIN(NL,4),$07$)
    130 LET L![L$]=NL$
    140 LET NL=NL+5
    150 GOTO 0090
    160 RECOMP P![""],L![""]
    170 SAVEPROG "MYPROG",P![""]

Note: RENUM is a RECOMP where a Line Number Array is generated based on the contents of REM statements.
When generating a new program into a KSA and then using RECOMP to compile it you do not need to INITPROG the KSA
The contents X! will be documented in an appendix. It's use can be seen in the program "$__DISPLAY_XREF1"
SEE:
LOADPROG SAVEPROG INITPROG COMPILE RENUM