Skip to content

PUB

Public Program

This string function returns information about the public programs in the specified memory bank.

PUB (bank-num [,ERR=line-ref|,ERC=error-code])
bank-num
is the integer number of the memory bank. The only valid value is 1.
line-ref
is the program line number or label to branch to if an error is produced by this function.
error-code
is a programmer-defined error code. Valid values are positive or negative whole numbers.

This string is dynamic; it changes as public programs are made resident with the ADDR directive or removed with the DROP directive.

If bank-num is negative, zero, or greater than the number of memory banks configured on this system, an ERR=41 results.

Each task occupies its own memory bank, which is always referred to as memory bank 1 and is the only bank that the task can access. Bank-num values of 2 through 7 do not generate an error, but return no value for PUB.

PUB returns 12 bytes for each public program in bank-num with the following information for each program. PUB is 0 bytes long if no public programs are resident, 12 bytes if one is resident, 24, if two are resident, and so on. Returned bytes contain the following information:

Bytes Description

1 - 2 Starting memory location within the memory bank in binary

3 - 4
Program size in binary (appears slightly larger than the actual PSZ of the public program)

5 - 12 Program name

The following routine lists the public programs that are currently in the same bank as the executing program:

1000 LET PUBLIC$ = PUB (1)
1010 FOR NUMBER = 1 TO LEN( PUBLIC$ ) STEP 12
1020 PRINT PUBLIC$( NUMBER + 4, 8 )," STARTS AT ",
STR( DEC( $00$ + PUBLIC$( NUMBER, 2) ):"###,###,##0"),
"FOR A LENGTH OF", STR( DEC($00$ +
PUBLIC$( NUMBER + 2, 2 ) ): "##.##0" )
1030 NEXT NUMBER

TSK function

From the Thoroughbred Basic Language Reference, Volume II: F–Q, version 8.9.1. Open this page in the PDF