| Home CBM ASCII-X BASIC Disk Commands Enter RUN mode Program Format Secret Variables Variable Format Expressions Keywords (divide) (equal) (less) (minus) (more) (multiply) (plus) (power) Abs And Append Asc Atn Auto Backup Bank Begin Bend Bload Boot Box Bsave Bump Catalog Char Chr Circle Close Clr Cmd Collect Collision Color Concat Cont Copy Cos Data Dclear Dclose Dec Def Delete Dim Directory Dispose Dload Do Dopen Draw Ds Ds string Dsave Dverify El Else End Envelope Er Err Exit Exp Fast Fetch Filter Fn For Fre Get Get num Getkey Go Gosub Goto Graphic Gshape Header Help Hex If Input Input num Instr Int Joy Key Left Len Let List Load Locate Log Loop Mid Monitor Movspr New Next Not Off On Open Or Paint Peek Pen Pi Play Pointer Poke Pos Pot Print num Pudef Quit Rclr Rdot Read Record Rem Rename Renumber Restore Resume Return Rgr Right Rlum Rnd Rreg Rspcolor Rsppos Rsprite Run Rwindow Save Scale Scnclr Scratch Sgn Sin Sleep Slow Sound Spc Sprcolor Sprdef Sprite Sprsav Sqr Sshape St Stash Step Stop Str Swap Sys Tab Tan Tempo Then Ti Ti string To Trap Troff Tron Until Using Usr Val Verify Vol Wait While Width Window Xor Syntax Tokens C128 D64plus Disk Escape Codes Hardware PCxface PETSCII Pet2asc Futurama IBM PC-AT Contact Games Glossary Hall of fame Hall of shame Miscellaneous Privacy policy Programming Twisty puzzles |
BOX [ colorSource ] , { [ + | - ] xValA [ , [ + | - ] yValA ] | distanceA ; angleA } [ , { [ + | - ] xValB [ , [ + | - ] yValB ] | distanceB ; angleB } [ , [ rotation ] [ , fill ] ] ]
*Due to a bug in the original C128 ROMs (start-up message says (c)1985), only positive/unsigned values of 0 to 65535 may be used.
Draw a parallelogram (typically a rectangle) on the bitmap screen.
The first coordinate (following immediately after the optional colorSource) is required. It defines one corner of the un-rotated box. The second coordinate is optional; it defines the opposite corner of the un-rotated box. If not specified, the second coordinate defaults to the pixel cursor (the last point calculated in the previous bitmap command). Any specified coordinate(s) will be effected by SCALE if it is active. The resulting value(s) may be off-screen, as long as they are legal values as shown above. Without the optional rotation (or if it is specified as a multiple of 180), a rectangle will typically be drawn. A true square will result only if a proper scaling of the X ordinate relative to the Y is used (this varies based on GRAPHIC mode and PAL/NTSC video). Otherwise a rotated box (a "diamond") will be drawn. Because of symmetry, only the rotation mod 180 is significant. For example a rotation of 45 is effectively the same as a rotation of 225 or 405 (45 + 180*1 or 45 + 180*2). In order to specify this value, the normally optional second coordinate must be specified (you can use +0,+0 to effectively use the default value). The fill acts like a boolean flag: a value of 1 causes the box to be drawn solid ("filled"), and a value of 0 (the default) causes only an outline to be drawn ("hollow"). Unfortunately, BASIC won't accept its own boolean values!! For example, BASIC returns -1 for true from relational operators, but if such a value is specified for fill an ILLEGAL QUANTITY ERROR is generated. Use the ABS() function to fix this behavior. If the BOX is not filled, then the width plotted on screen of all four line-segments is controlled by a secret BASIC variable. That secret variable can be set with WIDTH. If it is 1, each "dot" (of the line-segments) will be 1 pixel wide; if it is 2, each "dot" will be 2 pixels wide. Strangely in all versions, negative angles are not allowed! Try adding 360 (or 720) to fix this problem (this works for positive angles too). Any floating-point numbers will first be converted to integers (see INT). If any value is out-of-range (see above) an ILLEGAL QUANTITY ERROR is generated. If no bitmap has been setup (see GRAPHIC), a NO GRAPHICS AREA is generated. Example of optional colorSource and optional "Coordinate B":
Example of relative rectangular and polar coordinate:
Example of rotation and fill (these require the normally optional "Coordinate B"):
© H2Obsession, 2014 |