!pr2
!lm12
!rm75
A New Hi-Res Function for Applesoft............. Mike Laumer

Most people use the language card as nothing more than a ROM simulator for the other version of BASIC that is not on the motherboard.  But it can do much more since the memory is actually RAM.  Indeed Bob S-C's Macro Assembler has a version which runs in a Language Card.  The FLASH! Integer BASIC compiler which I wrote uses the language card in place of a disk file providing higher speed compilations for those people who have a language card.

One nice aspect of having the language card is the ability to move Apple software from ROM to RAM in the card and make changes to add a new capability.  Some people have done this already with the Apple monitor to add an extra feature or two at the expense of another (who needs the tape I/O routines).

The program assciated with this article will allow you to patch a RAM card version of Applesoft to modify the 'HPLOT' command to function as an 'HXPLOT' command.  What is 'HXPLOT' you say.  Remember the DRAW and XDRAW commands in Applesoft.  The 'DRAW' command will place a shape on the screen; 'XDRAW' does the same thing, but 'XDRAW' has the unique ability to redraw the shape and erase it from the screen leaving whatever was on the screen initially still intact.  The 'HXPLOT' function in the listing functions the same way for the 'HPLOT' command as 'XDRAW' does for the 'DRAW' command.

I have been developing a Hi-Res graphics editor as my next product.  During the development cycle I was working with a line draw game paddle routine.  You move a cursor to a position and anchor one end of the line to a point.  Then you can move to another position and while you move a line stretches out from the point like a rubber band to the current cursor position.  This gives you a preview of what the line looks like before you plot the line.  The 'HXPLOT' function does have one sleight problem:  it plots independent of the current color.

What the function actually does as it draws a line is to invert each dot of the line path instead of plotting a color.  When the same line is drawn with the same coordinates the bits on the line path are inverted again back to their original value, restoring the screen to what it was before you started HXPLOTting.

You may be wondering why not just use the 'HPLOT' as it is to do this.  You could just draw the line once with a color of 3 then change the color to 0 and erase the line with another 'HPLOT'.  This only works if you have a black screen with no other images on it.  If their are other images on the screen then when you erase the line you will draw a black line through those other images causing them to change.  Only a function like 'XDRAW' or the 'HXPLOT' will be non-destructive of the background data on the screen.
!np
How It Works

The 'HPLOT' command in Applesoft is actually two commands in one.

     HPLOT x, y             plots 1 point
     HPLOT x1,y1 TO x2,y2   plots a line

Each of the routines have one common place where they plot a bit onto the hi-res screen.  The point plotting routine is at $F457 in the ROM and the line routine is at $F53A in the ROM.  By putting Applesoft into the RAM card we can patch into these routines and modify their operation.

The two areas that are patched are at $F457 and $F58D.  After you run the patch program you should see the Applesoft prompt character and there will be no program in memory.  So type in the small demo program listed here and run it.

 <<<<program here>>>>

If you have an Integer BASIC motherboard you should boot up your system master disk and have Applesoft loaded into your RAM card before using the routine.
