Draw a pixel: Difference between revisions

Line 675:
Version 2 of Commodore BASIC, which shipped on the VIC-20 and Commodore 64, did not have any graphics support. A stock VIC didn't have enough memory for high-resolution graphics anyway, so they mostly weren't used. But Commodore shipped a "SuperExpander" cartridge for the VIC which not only included enough extra RAM to support a 160x160-pixel bitmap, but also extended BASIC to include statements for drawing on it. One oddity about the VIC's iteration of the SuperExpander is that, despite the low 160x160 resolution, it treats the screen as having 1024x1024 pixels; the below program compensates for this by asking for a dot at 640,640, which maps to the physical pixel at 100,100.
 
<lang basicgwbasic>10 COLOR 0,0,2,2: REM BLACK BACKGROUND AND BORDER, RED TEXT AND EXTRA COLOR
20 GRAPHIC 2:SCNCLR:REM SELECT HI-RES GRAPHICS AND CLEAR THE SCREEN
30 POINT 2,640,640:REM DRAW A POINT AT 640/1024*160,640/1024*160
Line 710:
Commodore released a version of the SuperExpander Cartridge for the C64 that was similar to the one for the VIC-20, but not identical. Besides some differences in the actual BASIC statements, it also does not have the artificial scale factor; graphics statements instead take physical pixel coordinates.
 
<lang basicgwbasic>10 COLOR 0,2,,,0: REM SET BACKGROUND AND BORDER TO BLACK, FOREGROUND TO RED
20 GRAPHIC 2,1:REM SELECT HIRES GRAPHICS AND CLEAR THE SCREEN
30 DRAW 1,100,100:REM DRAW A PIXEL AT 100,100
Line 721:
By the time the Commodore Plus/4 and C-16 were released, Commodore was ready to ship them with a version of BASIC, dubbed version 3.5, that included graphic support out of the box. The statements were again similar to but slightly different from what had come before in the SuperExpander cartridges. When the Commodore 128 was released, its version of BASIC, 7.0, included all of 3.5 essentially unchanged.
 
<lang basicgwbasic>10 COLOR 0,1:COLOR 1,3: REM SET BACKGROUND TO BLACK AND PIXEL COLOR TO RED
15 GRAPHIC 1,1 : REM ENTER BITMAP GRAPHICS MODE AND CLEAR SCREEN
20 DRAW 1,100,100 : REM PLOT PIXEL AT 100,100
Line 731:
While the Commodore 128's BASIC 7.0 had impressive support for graphics on the 40-column display, it had no such support for bitmap graphics on the double-resolution 80-column display provided by its VDC chip. For that, we turn to BASIC 8, which was released as a separate software package that had to be loaded (or installed as a chip on the C128's motherboard). It was developed outside of Commodore and has a syntax very different from the standard BASIC's graphic commands, but it supports 3D graphics out of the box, including viewport clipping, scaling, etc. Note that the below program specifies a Z coordinate of 0 for the dot, which places it on the surface of the viewport.
 
<lang basicgwbasic>10 @MODE,0:REM SELECT SCREEN SET
20 @COLOR,0,9,0:REM BACKGROUND BLACK, FOREGROUND BRIGHT RED
30 @SCREEN,0,0:REM SELECT MONOCHROME MODE
1,480

edits