Documentation for BASMOD ------------------------ BASMOD is a modification by Joel Rubin of a program which appeared in the August 1983 COMPUTE! Gazette (Note 1) which adds four new graphics commands to your Commodore 64. It enables you to plot points on a high resolution screen with simple commands from BASIC. What the Program Does --------------------- Part of BASMOD consists of a machine language routine which copies the BASIC ROM (Read Only Memory), which interprets BASIC commands, into RAM (Random Access Memory). ROM is "permanent" memory - that is, the program stored in ROM is "burned" into the ROM memory chip so that it is not lost when power is removed from the '64. This "permanent" machine language program, and its counterpart, the KERNAL ROM, which oversees the general operation of the '64, are essential to the function of all BASIC programs; they tell the computer what it should do when it "sees" a BASIC command such as PRINT or LOAD, either in a program or typed in from the keyboard ("immediate" mode). However, there are several commands in CBM BASIC that are rarely used by programmers, and virtually no commands for creating high-resolution graphics. Wouldn't it be nice if we could replace those unused commands with some that would let us easily use the hi-res screen, without all those peeks and pokes? Since we can't change the BASIC ROM, we must first "copy" it into RAM. RAM can be changed easily; this is what you're doing when you POKE a number into a memory location. If we copy ROM into RAM, change the appropriate routines, and then tell the '64 to use the new instructions in RAM instead of ROM, we can change those unused to commands to do almost anything we like! BASMOD does just that. After copying ROM into RAM (lines 30-34), it replaces the following BASIC commands: LET becomes HUE; WAIT becomes PLOT; CONT becomes WIPE; and VERIFY becomes SCREEN. USING BASMOD ------------ Here's how to use the new commands: SCREEN ------ SCREEN is used to switch between the normal text screen (beginning at memory location 1024) and a high-resolution screen (beginning at 8192). The contents of one screen will not affect the other; you can even draw on the hi-res screen while looking at the text screen! The syntax is: SCREEN0 selects the text screen; SCREEN1 selects the hi-res screen. HUE --- HUE selects the colors to be used on your hi-res screen; it does not change the text screen colors. HUE should be used before SCREEN or WIPE. The syntax is: HUE colr,bkgd where "colr" is a number from 0 to 15, corresponding to the desired color of the points plotted on the screen, and "bkgd", also between 0 and 15, is the background color. (See page 61 of your User's Guide for the numbers to use here). If you change HUE after PLOTting points on the screen, the color of those points will change too. WIPE ---- WIPE clears your hi-resolution screen. You should use WIPE before starting to draw with PLOT. The syntax is: WIPE PLOT ---- Now that you've selected your HUEs, WIPEd, and selected the hi-res SCREEN, here's where the fun starts! Your hi-res screen is made up of 64000 points. You can turn each of these points "on" or "off"; turning it "on" means that point will be the plot color you've selected with HUE, instead of the background color. To make it easy to find each point, each of them has two "coordinates", corresponding to its horizontal (X) and vertical (Y) location. The screen is 320 points "across", and 200 points "high". The point at the lower left hand corner of the screen corresponds, in our X,Y format, to "0,0", while the upper right hand corner is "319,199" (we can't use x=320 or y=200; 0 to 319 is 320 points, and 0 to 199 is 200 points). To plot a point on the screen, all we have to do is say, in our program or from the keyboard: PLOT X,Y and that point is turned on! We can also plot computed locations; for example, PLOT 2*A,B+100 will work fine, as long as the computed values are within the limits above. By plotting points repeatedly, we can draw lines and graphic shapes. Other Notes ----------- If you make an error in your commands, the screen will automatically switch back to "text". You can disable BASMOD by hitting RUN/STOP and RESTORE; if you do this, and LIST your program, you'll see that your special graphics commands are now the old ones we replaced! Your program won't RUN this way; you'll probably get a "syntax error" if you try. To use BASMOD after doing this, type: POKE1,PEEK(1)AND254 from the keyboard. Note that if you save your graphics program, you should always load and run BASMOD before loading your program again. Also, you must type in and save your program with BASMOD installed, or the '64 won't know what you're trying to say! -------------------------------------- Here's a sample program to type in (with BASMOD in place) and try. This will draw a sine wave, and the horizontal axis, on the screen: 10 wipe:hue1,0:poke53280,6:screen1 15 rem clear, set colors, select hires 20 fori=0to319 30 x=i:rem horizontal coordinate 40 y=sin(i/20)*100+100:rem vert coord 50 plotx,y:plotx,100 55 rem plot point, mark horiz axis 60 next:rem do the next point 70 geta$:ifa$=""then70:rem finished 80 screen0:end 90 rem return to text mode -------------------------------------- Hope you'll enjoy using BASMOD; if you have questions, please be sure to ask! SYSOP/Dave Paul 70007,1052 (1) (c)COMPUTE! Publications, Inc.
Amiga7878