TITLE Applesoft: Using Applesoft Shape Tables from Disk Article ID: 49 Created: 9/21/84 Modified: 3/2/98 -------------------------------------------------------------------------------- TOPIC The following programs were written to make Applesoft shape tables easier to use. -------------------------------------------------------------------------------- DISCUSSION SHAPE LOADER The Applesoft SHLOAD statement loads shape tables from a cassette tape and sets up the proper pointer for Applesoft to use. The following program loads the shape table from diskettes as a binary file and sets up the proper pointer for Applesoft. This program assumes the shape table has been entered into the systems memory using the same format, but not necessarily the same addresses, as the example in the Applesoft reference manual. Name the program anything you choose, but be sure to place this routine in the first part of your program, since it destroys string variables while loading the shape table. 100 INPUT "WHICH SHAPE TABLE TO LOAD ? ";F$ 110 PRINT CHR$(4);"BLOAD ";F$;",A$D000" 120 DS = PEEK (977) + PEEK (978) * 256 + 3233 130 HM = PEEK (115) + PEEK (116) * 256 - PEEK (DS) - PEEK (DS + 1) * 256 140 PRINT CHR$(4);"BLOAD ";F$;",A";HM 150 HIMEM: HM 160 POKE 232,HM - INT (HM / 256) * 256: POKE 233,HM / 256 SHAPE SAVER This program saves your shape table to the disk as a binary file for the SHAPE LOADER routine to use. Load this program before entering the monitor and typing in your shape table. The best place to start your shape table is at $2000: this leaves alot of room for the shape saver and the table. (Refer to chapter 9 of the Applesoft Reference manual.) After typing in your shape table and checking it, type 3D0G to re-enter Applesoft and to RUN the program. 1000 REM SHAPE SAVER 1005 H$ = "0123456789ABCDEF" 1010 TEXT : HOME : VTAB 5 1020 INPUT "WHAT IS THE STARTING ADDRESS (HEX)?";A$ 1030 IF LEN (A$) = 0 THEN END 1040 GOSUB 5000 1050 IF F < 0 THEN 1000 1060 S = X 1070 PRINT 1080 INPUT "WHAT IS THE ENDING ADDRESS (HEX)?";A$ 1090 IF LEN (A$) = 0 THEN 1000 1100 GOSUB 5000 1110 IF F < 0 THEN 1000 1120 LET E = X 1130 IF E < = S THEN PRINT CHR$(7);"THE END IS LESS THAN THE START!": GOSUB 5100: GOTO 1000 1140 PRINT 1150 PRINT "WHAT NAME DO YOU WANT TO USE ?" 1160 INPUT " ";A$ 1170 PRINT CHR$(4);"BSAVE ";A$;",A";S;",L";E - S + 1 1180 END 5000 PRINT : PRINT "CONVERTING TO DECIMAL" 5010 LET F = 0:X = F 5020 FOR J = 1 TO LEN (A$) 5030 FOR I = 1 TO 16 5040 IF MID$ (A$,J,1) = MID$ (H$,I,1) THEN X = X * 16 + I - 1: F = F + 1 5050 NEXT I,J 5060 IF F < > LEN (A$) THEN F = - 1:"THAT'S NOT HEX!!!"; CHR$(7): GOSUB 5100 5070 IF X > 2 ^ 16 THEN F = - 1: PRINT "THAT'S TOO BIG!!!"; CHR$(7): GOSUB 5100 5080 RETURN 5100 FOR J = 1 TO 1000: NEXT J: RETURN