
 1000  *******************************
 1010  *                             *
 1020  *  BENCHMARKING BLOCK MOVES   *
 1030  *                             *
 1040  *  BY WILLIAM R. SAVOIE  3/82 *
 1050  *   LIMERICK TRAINING CENTER  *
 1060  *  C/O GENERAL PHYSICS CORP.  *
 1070  *  341 LONGVIEW RD., LINFIELD *
 1080  *   PENNSYLVANIA   ZIP 19468  *
 1090  *******************************
 1100  
 1110  
 1120  *-------------------------------*
 1130  * APPLE II PAGE ZERO MEMORY USE *
 1140  *-------------------------------*
 1150  
 1160  A1L    .EQ $3C      MONITOR
 1170  A1H    .EQ $3D       USE
 1180  A2L    .EQ $3E       FOR
 1190  A2H    .EQ $3F       BLOCK
 1200  A3L    .EQ $40       MOVE
 1210  A3H    .EQ $41
 1220  A4L    .EQ $42
 1230  A4H    .EQ $43
 1240  FACMO  .EQ $A0      FP REGISTER
 1250  FACLO  .EQ $A1      FP REGISTER
 1260  
 1270  *-------------------------------*
 1280  * OTHER APPLE II MEMORY MAPPING *
 1290  *-------------------------------*
 1300  
 1310  BLTU   .EQ $D39B    BLOCK TRANSFER
 1320  FRMNUM .EQ $DD67    FORMULA=>NUM
 1330  COMA   .EQ $DEBE    CHECK COMA
 1340  AYINT  .EQ $E10C    MAKE INTEGER
 1350  PRNTX  .EQ $F944    PRINT X
 1360  NXTA1  .EQ $FCBA    INCR POINTER
 1370  PRBYTE .EQ $FDDA    PRINT A
 1380  MOVE   .EQ $FE2C    MONITOR MOVE
 1390  
 1400  
 1410  *-------------------------------*
 1430       .OR $3000
 1440       .TF B.BLOCK MOVE BENCHMARKS
 1450  *-------------------------------*
 1460  
 1470  *  THIS CODE ALLOWS SIMPLE ENTRY WITHOUT THE & COMMAND
 1480  BEGIN  JMP MONITOR.MOVE
 1490         JMP APPLESOFT.MOVE
 1500         JMP QUICK.MOVE
 1510         JMP DUMP     HEX OUTPUT
 1520         JMP FILL     LABLE MEMORY
 1530  
 1540  * TO HELP A HEX CONVERTER
 1550  CONVERT
 1560         JSR GETVAR   GET VARIABLE
 1570         JSR PRNTX    HI BYTE OUT
 1580         LDA FACLO    GET LOW BYTE
 1590         JMP PRBYTE   HEX OUTPUT
 1600         .PG
 1610  * THIS CODE FILLS MEMORY WITH IT'S OWN ADDRESS
 1620  * WHICH IS VERY USEFULL FOR CHECKING BLOCK MOVES
 1630  FILL   JSR GM       GET VARIABLES
 1640  .01    LDY #$01     TWO BYTE OFFSET
 1650         LDA A1L      GET LOW BYTE
 1660         STA (A1L),Y  WRITE ADDRESS LO
 1670         DEY          MOVE LEFT
 1680         LDA A1H      GET HI ADDRES
 1690         STA (A1L),Y  WRITE TO MEMORY
 1700         JSR NXTA1    INCREMENT PTR
 1710         JSR NXTA1    TWICE
 1720         BCC .01      GO TELL DONE
 1730         RTS
 1740  
 1750  * A UTILITY DUMP T0 SEE MEMORY FROM BASIC
 1760  DUMP   JSR GM       GET VARS
 1770         LDA $C010    CLEAR STROBE
 1780  .01    LDA $C000    GET KEY IF ONE
 1790         BPL .03      GO DUMP HEX
 1800         LDA $C010    CLEAR STROBE
 1810  .02    LDA $C000    READ KEY AGAIN
 1820         BPL .02      WAIT FOR KEY
 1830         CMP #$8D     'RETURN' KEY?
 1840         BEQ .04      EXIT
 1850         LDA $C010    CLEAR STROBE
 1860  .03    JSR $FDA3    8 HEX OUT
 1870         LDA A2L      END LOW
 1880         CMP $A1      DESIRED LOW
 1890         LDA A2H      HI TOO
 1900         SBC $A0      ENOUGH?
 1910         BCC .01      GO TELL DONE
 1920  .04    RTS
 1930  
 1940  * GET VARIABLE FROM BASIC
 1950  * MUST BE <65357 OR SYNTAX ERR
 1960  * PLACE IN REGISTERS X AND A
 1970  
 1980  GETVAR JSR COMA     MUST SEE COMA
 1990         JSR FRMNUM   GET NUMBER
 2000         JSR AYINT    MAKE INTEGER
 2010         LDX FACMO    HI BYTE
 2020         LDA FACLO    LOW BYTE
 2030         RTS
 2040  
 2050  
 2060  * GET BASIC VARIABLES INTO THE
 2070  * MONITORS WORK REGISTERS USED BY
 2080  * COMMANDS M,V,G,L,S,T,-,+,..ETC
 2090  
 2100  GM     JSR GETVAR   BLOCK START
 2110         STA A1L      LOW BYTE
 2120         STX A1H      HI BYTE
 2130         JSR GETVAR   BLOCK END
 2140         STA A2L      LOW
 2150         STX A2H      HI BYTE
 2160         JSR GETVAR   DEST. START
 2170         STA A4L      LOW
 2180         STX A4H      HI
 2190         RTS
 2200         .PG
 2210  *-------------------------------*
 2220  * THE OLD MONITOR MOVE          *
 2230  * MOVE BLOCK OF MEMORY UP/DOWN  *
 2240  *-------------------------------*
 2250  
 2260  MONITOR.MOVE
 2270         JSR GM       SET UP MOVE
 2280         LDA A1L      START LOW
 2290         CMP A4L      END LOW
 2300         LDA A1H      START HI
 2310         SBC A4H      WHICH BIGGER?
 2320         BCS MOVEDN   GO DOWN IN MEM
 2330  
 2340  MOVEUP LDY #$00     CLEAR INDEX
 2350  .01    LDA (A2L),Y    GET DATA
 2360         STA (A4L),Y    PUT DATA
 2370         LDA A4L      GET INDEX
 2380         BNE .02      PAGE CROSS?
 2390         DEC A4H      HI BYTE
 2400  .02    DEC A4L      LOW BYTE
 2410         LDA A2L
 2420         CMP A1L      END YET?
 2430         LDA A2H
 2440         SBC A1H
 2450         LDA A2L
 2460         BNE .03      PAGE CROSS?
 2470         DEC A2H      HI BYTE
 2480  .03    DEC A2L      LOW BYTE
 2490         BCS .01      GO TELL DONE
 2500         RTS
 2510  
 2520  MOVEDN LDY #$00     CLEAR INDEX
 2530         JMP MOVE     MONITOR MOVE
 2540  
 2550  
 2560  *------------------------------*
 2570  * AND ALONG CAME THE PEOPLE AT *
 2580  * MICROSOFT WITH THEIR MOVE    *
 2590  *------------------------------*
 2600  
 2610  APPLESOFT.MOVE
 2620         JSR GETVAR   HI ADDRESS OF BLOCK TO MOVE
 2630         STA $96      LOW
 2640         STX $97      HI BYTE
 2650         JSR GETVAR   BLOCK END
 2660         PHA          SAVE TELL LAST
 2670         TXA          NEED 9B,9C
 2680         PHA          TO GETVARS
 2690         JSR GETVAR   HI ADDRESS OF DISTINATION
 2700         STA $94      LO&HI BYTES
 2710         STX $95
 2720  
 2730  * WE USED $9B,9C TO GET THE TWO BYTE FP VALUE
 2740         PLA          END OF BLOCK
 2750         STA $9C      HI BYTE
 2760         PLA
 2770         STA $9B      LOW BYTE TOO
 2780         SEC          SUBTRACT COMMING
 2790         JMP BLTU     A.MOVE
 2800         .PG
 2810  *-------------------*
 2820  * MOVING IN RAM CAN *
 2830  * BE EVEN FASTER    *
 2840  *-------------------*
 2850  
 2860  QUICK.MOVE
 2870         JSR GETVAR   GET START
 2880         STA .01+1    LOW BYTE
 2890         STA .06+1    COPY HERE TOO
 2900         STX .01+2    HI
 2910         JSR GETVAR   DESTINATION
 2920         STA .02+1    LO
 2930         STA .07+1    COPY HERE TOO
 2940         STX .02+2    HI BYTE
 2950         JSR GETVAR   END ADDRESS
 2960         TXA          SET TEST FOR
 2970         BEQ .05       MOVE<256?
 2980  
 2990  * X=PAGE NUMBERS TO MOVE
 3000         LDY #$00     INDEX=0
 3010  .01    LDA $4800,Y  SOURCE
 3020  .02    STA $4000,Y  DESTINATION
 3030         INY          NEXT BYTE
 3040         BNE .01      SMALL MOVE
 3050  .03    INC .01+2    HI SOURCE
 3060  .04    INC .02+2    HI DESTINATION
 3070         DEX          DONE?
 3080         BNE .01      Y=0 SO MOVE PAGE
 3090  
 3100  * SET UP REMAINING MOVE
 3110  .05    LDY $A1      LOW BYTE LENGTH
 3120         BEQ .08      GO IF NONE
 3130         LDA .01+2    COPY HI BYTE
 3140         STA .06+2    FOR SOURCE
 3150         LDA .02+2     AND
 3160         STA .07+2     DESTINATION
 3170  
 3180  * NOW WITH X=0 START MOVING LOW BYTE OF LENGTH
 3185  * (Y) = REMAINING BYTES TO MOVE
 3190  .06    LDA $4800,X  SOURCE
 3200  .07    STA $4000,X  DESTINATION
 3210         INX          NEXT
 3220         DEY          MOVE ENOUGH?
 3230         BNE .06      GO TELL DONE
 3240  .08    RTS
 3250         .LIST OFF

