To assign the current segment address to be referenced by a subsequent BLOAD, BSAVE, CALL, PEEK, POKE, or USR.
DEF SEG [=address]
addressis a numeric expression within the range of 0 to 65535.
The address specified is saved for use as the segment required by BLOAD, BSAVE, PEEK, POKE, and CALL statements.
Entry of any value outside the address range (0-65535) results in an "Illegal Function Call" error, and the previous value is retained.
If the address option is omitted, the segment to be used is set to GW-BASIC's data segment (DS). This is the initial default value.
If you specify the address option, base it on a 16-byte boundary.
Segment addresses are shifted 4 bits to the left; so to get the segment address, divide the memory location by 16.
For BLOAD, BSAVE, PEEK, POKE, or CALL statements, the value is shifted left four bits (this is done by the microprocessor, not by GW-BASIC) to form the code segment address for the subsequent call instruction (see the BLOAD, BSAVE, CALL, PEEK, and POKE statements).
GW-BASIC does not perform additional checking to assure that the resultant segment address is valid.
10 DEF SEG=&HB800
Sets segment to screen buffer.
20 DEF SEG
Restores segment to BASIC DS.
DEF and SEG must be separated by a space. Otherwise, GW-BASIC will interpret the statement DEFSEG=100 to mean, "assign the value 100 to the variable DEFSEG."
All Frank Sinatra recordings, All Beatles albums, All solo albums from John Lennon, Paul McCartney, George Harrison and Ringo Starr, All Beatles songs, List of Platinum selling albums, Database with hits from 1950 to 1999.
Sought after DLL files, Nutworks magazine (retro), Worldwide ISO and TLD codes, File extensions database, The Hackers dictionary, Free software for the Atari, Amiga and Macintosh, Nokia smartphone, PocketPC, List of all BASIC programming language commands, List of all DOS commands, Free Advanced Bash-Scripting Guide (Linux-Unix)