In this page...


Index

$1100-$11FF - BASIC Working Storage

BASIC Working Storage

4352-4400 $1100-$1130 DOSSTR

DOS command assembly area

The BASIC statements that issue DOS commands - for example, HEADER, COPY, CATALOG, and SCRATCH - use this area to assemble the command string to be sent to the disk drive.

4401-4402 $1131-$1132 XPOS

Bitmapped-screen pixel-cursor horizontal position

These locations hold the horizontal (x) coordinate of the current position of the pixel cursor on the bitmapped screen. The range of values here depends on the scale factor currently in use. If scaling is not used, the value can be found in the range 0-319. In any case, a value of zero specifies the left edge of the screen. The value here is set to 0/$00 whenever the bitmapped screen is cleared, either by the SCNCLR routine or by adding the clear parameter to a GRAPHIC statement. After execution of any BASIC graphic statement, this location will hold the value of the final horizontal pixel position affected by the operation. The value here can be set explicitly using the LOCATE statement, which stores the specified horizontal position in this location. If the DRAWTO form of the DRAW statement is used, the line will begin at the horizontal position specified here.

4403-4404 $1133-$1134 YPOS XPOS

Bitmapped-screen pixel-cursor vertical position

These locations hold the vertical (y) coordinate of the current position of the pixel cursor on the bitmapped screen. The range of values here depends on the scale factor currently in use. If scaling is not used, the value can be found in the range 0-199. In any case, a value of zero specifies the top edge of the screen. The value here is set to 0/$00 whenever the bitmapped screen is cleared, either by the SCNCLR routine or by adding the clear parameter to a GRAPHIC statement. After execution of any BASIC graphic statement, this location will hold the value of the final vertical pixel position affected by the operation. The value here can be set explicitly using the LOCATE statement, which stores the specified vertical position in this location. If the DRAWTO form of the DRAW statement is used, the line will begin at the vertical position specified here.

4405-4406 $1135-$1136 XDEST

Final horizontal pixel position for graphics operations

These locations hold the calculated ending horizontal pixelcursor position for BASIC graphics operations. The operation is complete when the value in locations $1131-$1132 equals the value here.

4407-4408 $1137-$1138 YDEST

Final vertical pixel position for graphics operations

These locations hold the calculated ending vertical pixel-cursor position for BASIC graphics operations. The operation is complete when the value in locations $1133-$1134 equals the value here.

4409-4455 $1139-$1167

Working storage for assorted graphics routines

BASIC graphics routines such as BOX, CIRCLE, DRAW, and PAINT use various locations in this range to perform the calculations necessary to plot the points for the figure being drawn. The MOVSPR routine also uses some of these locations for sprite position calculations in those cases where the sprite is moved relative to the pixel cursor.

4456 $1168 CHRPAG

Starting page for character pattern definitions

This location is used during the CHAR routine $67D7 in the calculations to determine where character shapes are to be placed on the bitmapped screen. The value here is the starting page of character memory. This location will hold the value from either $11EC or $11EB.

4457 $1169 BITCNT

Bit counter for shape retrieval

This location is used during the GSHAPE routine $658D as a counter for the bits to be read from each byte of the storage string.

4458 $116A SCALEM

Scaling flag

This location indicates whether the scaling feature is to be used when graphics are drawn on the bitmapped screen. While this location contains 0/$00, scaling will not be used. When the location contains any nonzero value, the horizontal and vertical coordinates for all graphics routines will be scaled according to the values in locations $87-$88 and $89-$8A. This location is initialized to 0/$00 (scaling off) during the BASIC cold-start sequence, and also whenever the clear-screen parameter is included in a GRAPHIC statement. The routine to execute the SCALE statement $6960 will store the first parameter following SCALE (0 or 1) here.

4459 $116B WIDTH

Line width for bitmapped graphics routines

The value here determines whether the lines drawn by BASIC bitmapped graphics routines are to be standard width (indicated when this location contains 0/$00) or double width (indicated when this location contains any nonzero value). The value here is initialized to 0/$00 (normal width) during the BASIC cold-start sequence. The routine to execute the WIDTH statement $71B6 will store the width parameter minus 1 in this location.

4460 $116C FILFLG

BOX fill flag

This location is used during the BOX routine $62B7 to specify whether the shape is to be open or filled. If the value here is 0/$00 the shape will be open; otherwise, it will be filled. This location is initialized to 0/$00 (open shapes) during the BASIC cold-start sequence. When a BOX statement is executed, the seventh parameter (paint) following the statement will be copied here. If that parameter is omitted, it will default to 0/$00.

4461 $116D BITMSK

Bit mask value

This location is used as a mask value to select individual bits during the DRAW and SPRDEF routines

4462 $116E NUMCNT

Temporary storage for assorted routines

This location is used for temporary working storage during the CHAR, MOVSPR, and SPRDEF routines.

4463 $116F TRCFLG

Trace mode flag

This location is used to indicate whether BASIC is in trace mode. When a program is executed in trace mode, the line number of each program line is printed as it is executed. Trace mode is off when bit 7 of this location is %0, and on when bit 7 is %1. This location is initialized to 0/$00 (trace off) during the BASIC cold-start sequence. It is also reset to 0/$00 during the NEW routine. The value here can be changed using the TRON and TROFF statements. TRON sets this location to 255/$FF, and TROFF resets it to 0/$00.

4464-4467 $1170-$1173 RENUM-TMPS

Working storage for RENUMBER

These locations are used for working storage during BASIC’s RENUMBER routine $5AF8. Locations $1170-$1171 hold the line number at which renumbering is to begin, and $1172-$1173 hold the increment by which subsequent lines are to be renumbered.

4468 $1174 T3

Loop counter for reading directory entries

Tris location is used during the CATALOG/DIRECTORY routine $A07E as a counter in the loop to discard extraneous characters before the block count.

4469-4470 $1175-$1176 T4

Block count for directory entry

These locations are used during the CATALOG/DIRECTORY routine $A07E to hold the block count for each file entry read from the drive.

4471 $1177 VTEMP3

Working storage for graphics parameter scaling

This location is used for working storage during the routine that scales graphics parameters $9DAE when the SCALE option is in effect.

4472 $1178 VTEMP4

Working storage for graphics parameter evaluation

This location is used during the routine that evaluates parameters for graphics routines $9E6D to hold the offset to the parameter being evaluated.

4473 $1179 VTEMP5

Working storage for graphics parameter evaluation

This location is used during the routine that evaluates parameters for graphics routines $9E6D to hold a value indicating the parameter type.

4474-4475 $117A-$117B ADRAYI

Pointer to floating point-to-integer conversion routine

These locations point to the routine that converts the floatingpoint value in FAC1 (99-103/$63-$67) into a two-byte integer value in the accumulator (low byte) and Y register (high byte). The BASIC cold-start sequence initializes the value here to 33951/$849F, the address of that routine in the current version of BASIC ROM.

This pointer is especially useful in conjunction with the USR function. See the entry in Chapter 5 for details. To perform this conversion, it’s best to use the indirect JMP ($117A) instead of the absolute JMP $849F. That way, your program will still work if the ROM is revised in future versions.

4476-4477 $117C-$117D ADRAY2

Pointer to integer-to-floating point conversion routine

These locations point to the routine that converts a two-byte integer value in the accumulator (low byte) and Y register (high byte) to a floating-point value in FAC1 $63-$67. The BASIC cold-start sequence initializes the value here to 31036/$793C, the address of that routine in the current version of BASIC ROM.

This pointer is especially useful in conjunction with the USR function. To perform this conversion, it’s best to use the indirect JMP ($117F) rather than the absolute JMP $793C. That way, your program will still work if the ROM is revised in future versions

4478-4565 $117E-$11D5 SPRITE-DATA

Sprite movement control data

The MOVSPR statement has an option to set sprites in motion at a given angle and speed. These locations hold data concerning sprite motion. For moving sprites, the values here will be used to generate position values that will be copied to the shadow registers at $11D6-$11E6. The locations are used as follows:

  Sprite 0 Sprite 1 Sprite 2 Sprite 3 Sprite 4 Sprite 5 Sprite 6 Sprite 7
Speed 4478/$117E 4489/$1189 4500/$1194 4511/$119F 4522/$11AA 4533/$11B5 4544/$11C0 4555/$11CB
Speed countdown 4479/$117F 4490/$118A 4501/$1195 4512/$11A0 4523/$11AB 4534/$11B6 4545/$11C1 4556/$11CC
Direction 4480/$1180 4491/$118B 4502/$1196 4513/$11A1 4524/$11AC 4535/$11B7 4546/$11C2 4557/$11CD
Horizontal increment (low) 4481/$1181 4492/$118C 4503/$1197 4514/$11A2 4525/$11AD 4536/$11B8 4547/$11C3 4558/$11CE
(high) 4482/$1182 4493/$118D 4504/$1198 4515/$11A3 4526/$11AE 4537/$11B9 4548/$11C4 4559/$11CF
Vertical increment (low) 4483/$1183 4494/$118E 4505/$1199 4516/$11A4 4527/$11AF 4538/$11BA 4549/$11C5 4560/$11D0
(high) 4484/$1184 4495/$118F 4506/$119A 4517/$11A5 4528/$11B0 4539/$11BB 4550/$11C6 4561/$11D1
Horizontal position (low) 4485/$1185 4496/$1190 4507/$119B 4518/$11A6 4529/$11B1 4540/$11BC 4551/$11C7 4562/$11D2
(high) 4486/$1186 4497/$1191 4508/$119C 4519/$11A7 4530/$11B2 4541/$11BD 4552/$11C8 4563/$11D3
Vertical position (low) 4487/$1187 4498/$1192 4509/$119D 4520/$11A8 4531/$11B3 4542/$11BE 4553/$11C9 4564/$11D4
(high) 4488/$1188 4499/$1193 4510/$119E 4521/$11A9 4532/$11B4 4543/$11BF 4554/$11CA 4565/$11D5

In addition to using the MOVSPR routine, the values here can be set directly to set a sprite in motion. (The corresponding sprite must be enabled before the motion values have any effect.) The speed value (0-15) determines how many times per IRQ interrupt the horizontal and vertical increment values will be applied to the horizontal and vertical position values. If the speed value is 0/$00, the corresponding sprite will not be moved. The speed value is copied to the countdown value during each interrupt. The direction value can have one of the following values:

Direction value Sprite motion
0 x increasing, y decreasing
1 x increasing, y increasing
2 x decreasing, y increasing
3 x decreasing, y decreasing

All locations in this range are initialized to 0/$00 during the BASIC cold-start sequence. The warm-start sequence performs the less dramatic initialization step of resetting all the speed locations to 0/$00, which stops all sprite motion.

4566-4582 $11D6-$11E6 VIC-SAVE

Shadows for VIC sprite position registers

The contents of these locations are copied into the VIC chip sprite position registers ($D000-$D010) during each pass through the BASIC IRQ routine $A84D. As long as the BASIC IRQ routine is active, the VIC registers cannot be changed directly. Instead, you should store the desired register value in the corresponding shadow location. All locations in this range are initialized to 0/$00 during the BASIC cold-start sequence. The values here can be set using the MOVSPR statement. The MOVSPR routine $6CC6 sets the value here directly when a static sprite position is specified. When a moving sprite is specified, the movement information is stored in the table at $117E-$11D5 and the values here are updated during each pass through the BASIC IRQ routine $A84D. The locations are used as follows:

Location Register Function
4566/$11D6 53248/$D000 Sprite 0 horizontal position
4567/$11D7 53249/$D001 Sprite 0 vertical position
4568/$11D8 53250/$D002 Sprite 1 horizontal position
4569/$11D9 53251/$D003 Sprite 1 vertical position
4570/$11DA 53252/$D004 Sprite 2 horizontal position
4571/$11DB 53253/$D005 Sprite 2 vertical position
4572/$11DC 53254/$D006 Sprite 3 horizontal position
4573/$11DD 53255/$D007 Sprite 3 vertical position
4574/$11DE 53256/$D008 Sprite 4 horizontal position
4575/$11DF 53257/$D009 Sprite 4 vertical position
4576/$11E0 53258/$D00A Sprite 5 horizontal position
4577/$11E1 53259/$D00B Sprite 5 vertical position
4578/$11E2 53260/$D00C Sprite 6 horizontal position
4579/$11E3 53261/$D00D Sprite 6 vertical position
458O/$11E4 53262/$D00E Sprite 7 horizontal position
4581/$11E5 53263/$D00F Sprite 7 vertical position
4582/$11E6 53264/$D010 Most significant bits of horizontal position

4583-4584 $11E7-$11E8

Shadows for VIC sprite-collision registers

During any pass through the BASIC IRQ routine $A84D where either or both of the sprite-collision latch flags (bits 1-2 of $D019) are found to be set to %1, the contents of the corresponding VIC chip sprite-collision register will be recorded in these locations. For sprite-foreground collisions (indicated when bit 1 of the flag is set), any bits in the register at $D01F which are set to %1 will also be set to %1 in location $11E8. Likewise, for sprite-sprite collisions (indicated when bit 2 of the flag is set), the %1 bits in the register at $D01E will be recorded in location $11E7.

Thus, these locations will accumulate collision readings until they are cleared, rather than simply holding the most recent collision values. The routine for the BASIC function BUMP $837C returns values based on the contents of these locations, rather than on the actual register contents. BUMP(1) returns the sprite-sprite collision value in $11E7, and BUMP(2) returns the sprite-foreground collision value in $11E8. Either location will be reset to 0/$00 after being read by BUMP. Both locations are also initialized to 0/$00 during the BASIC cold-start sequence.

4585-4586 $11E9-$11EA

Shadow for VIC light pen registers

During any pass through the BASIC IRQ routine $A84D where the light pen latch flag (bit 3 of $D019) is found to be set to %1, the contents of the VIC chip light pen registers at $D013-$D014 will be copied into these locations. The routine for the BASIC function PEN $82AE returns values based on the contents of these locations, rather than on the actual register contents. PEN(0) returns the value in $11E9, multiplied by 2. PEN(1) returns the value in $11EA. Either location will be reset to 0/$00 after being read by PEN. Both of these locations are also initialized to 0/$00 during the BASIC cold-start sequence.

4587 $11EB UPPER_LOWER

Starting page for alternate character set during CHAR

The value here determines the starting page in system memory for the alternate set of characters used during the CHAR statement for bitmapped screens (see location 4588/$11EC for more information). CHAR will always begin using the character set pointed to in location 4588/$11EC. To switch to the alternate character set, the CHAR string must include character code 14/$0E. Character code 142/$8E switches back to the default set. This location is initialized to 216/$D8 during BASIC cold start. That value selects the ROM lowercase/ uppercase set at 55296/$D800 as the alternate character pattern source. If you use a custom character set, you can change the value here to have CHAR use your new characters. However, the new character set must be visible in the bank 14 memory configuration, since that is how the system will be configured when character pattern data is read.

4588 $11EC UPPER_GRAPHIC

Starting page for default character set during CHAR

The value here determines the starting page in system memory for the default set of characters used during the CHAR statement. The value here doesn’t affect any statement other than CHAR, and is used only when character shapes are being placed on a bitmapped screen. (When CHAR is used to place characters on the text screen, the screen editor printing routines are used instead.) For bitmapped screens, CHAR will always begin using the character set pointed to here, regardless of the character set in use on the text screen. To switch to the alternate character set (starting page in 4587/$11EB), the CHAR string must include character code 14/$0E. Character code 142/$8E switches back to the character set pointed to here. Thus, it is possible to mix the two character sets in a single CHAR statement. This location is initialized to 208/$D0 during BASIC cold start. That value makes the ROM uppercase/ graphics set at 53248/$D000 the default character pattern source. If you use a custom character set, you can change the value here to have CHAR use your new characters. However, the new character set must be visible in the bank 14 memory configuration, since that is how the system will be configured when character pattern data is read.

4589 $11ED DOSSA

Channel number for BASIC relative file operations

The channel number (secondary address) for BASIC relative file operations is stored in this location.

4590-4607 $11EE-$11FF Unused

None of these locations is used by any system ROM routine.

See also