12.07.2015 Views

williams-et-al-1983-apple-ii-computer-graphics

williams-et-al-1983-apple-ii-computer-graphics

williams-et-al-1983-apple-ii-computer-graphics

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

154 APPLE II COMPUTER GRAPHICSdesired direction, and XDRAW it again. To demonstrate, l<strong>et</strong>'s fi nd thevertic<strong>al</strong> pre-shift of our rectangle. From BASIC type:HGRXDRAW 1 AT 50,50XDRAW 1 AT 50, 49The figure remaining on the screen is the vertic<strong>al</strong> pre-shift of the rectangle.To use it, you need to include it in a shape table and then XDRAW itover the rectangle. Doing this will make the rectangle appear to movevertic<strong>al</strong>ly. Creating a shape out of the pre-shift may still be a sm<strong>al</strong>l problem,but sever<strong>al</strong> of the Hi-Res editors are capable of that.Pre-shifting may <strong>al</strong>so be used with byte-move shapes. To do this, the fullfigure is fi rst drawn on the screen, and from then on pre-shifts are used tomove it. As a consequence, there are seven versions of the pre-shift insteadof seven versions of the figure, and the proper pre-shift is selected byexamining the remainder.Pre-shifting with byte-move requires that you "Exclusive Or" (EOR) thebytes in the pre-shift over the bytes on the screen. Remember, an "ExclusiveOr" operation compares two bits and gives a positive (ON) result ifeither one of the origin<strong>al</strong>s was ON, but not both. Otherwise, the result isnegative (OFF) . The XDRAW command does exactly that with shape tablefigures, but since byte-move does not use a shape table, you must arrive atyour own EOR routine. This is a pain from BASIC, but machine language,where byte-move is most advantageous anyway, has its own EOR commandso the routine is fairly easy to write.Back in the Paddle AgainJust for fu n, l<strong>et</strong>'s mod ify Listing 13-3 fu rther to use paddle (/) to control therectangle.80 DRAW 1 AT 20,10090 X = 20: XO = 20100 OD = 1110 REM120 IF PDL (0) < 90 THEN X = X-1:ND = 0: GOTO 140130 IF PDL (0) > 150 THEN X = X + 1:ND = 1140 IF X < 20 OR X > 275 THEN X XO150 IF X = XO GOTO 110160 IF ND < > OD THEN XDRAW 2 ATxo,100170 XDRAW 2 AT X ,100 : XO = X :OD = ND180 GOTO 110

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!