
 1000  *SAVE S.WINDOWS
 1010  *--------------------------------
 1020  * MOVE WINDOW
 1030  * by Mike Ching, Kula Software
 1040  *    2118 Kula Street, Honolulu, HI 96817
 1050  *--------------------------------
 1060  WNDLFT   .EQ $20
 1070  WNDWDTH  .EQ $21
 1080  WNDTOP   .EQ $22
 1090  WNDBTM   .EQ $23
 1100  BASL     .EQ $28
 1110  BASH     .EQ $29
 1120  A1       .EQ $18,19     MEMORY SOURCE START
 1130  A2       .EQ $1A,1B     MEMORY SOURCE END
 1140  *--------------------------------
 1150  AMPERV   .EQ $3F5
 1160  *--------------------------------
 1170  GETBYT   .EQ $E6F8
 1180  COMBYTE  .EQ $E74C
 1190  BASCALC  .EQ $FBC1
 1200  HOME     .EQ $FC58
 1210  *--------------------------------
 1220           .OR $2F5
 1230           .TF B.WINDOWS
 1240  *--------------------------------
 1250  SETUP  LDA #MOVE.WINDOW     SET UP & VECTOR
 1260         STA AMPERV+1
 1270         LDA /MOVE.WINDOW
 1280         STA AMPERV+2
 1290         RTS
 1300  *--------------------------------
 1310  MOVE.WINDOW
 1320         JSR GETBYT   GET VALUES FROM APPLESOFT
 1330         STX TOP
 1340         STX LINE
 1350         JSR COMBYTE
 1360         STX BOTTOM
 1370         JSR COMBYTE
 1380         STX LEFT
 1390         JSR COMBYTE
 1400         STX RIGHT
 1410         SEC          WIDTH = RIGHT-LEFT
 1420         TXA
 1430         SBC LEFT
 1440         STA WIDTH
 1450         JSR COMBYTE  GET DIRECTION (1 OR 2)
 1460         DEX
 1470         STX TPAGE
 1480  *--------------------------------
 1490  MOVE.LINE
 1500         LDA LINE     BASL,H = BASCALC(LINE)
 1510         JSR BASCALC
 1520         CLC
 1530         LDA BASH
 1540         LDX TPAGE
 1550         BEQ .1       ...SOURCE IS REAL SCREEN
 1560         EOR #$0C     ...SOURCE IS SAVED SCREEN
 1570  .1     STA A1+1     SOURCE HI BYTE
 1580         EOR #$0C     FLIP TEXT PAGE
 1590         STA A2+1     DESTINATION HI BYTE
 1600         CLC          MEMSTART = BASL,H + LEFT
 1610         LDA BASL
 1620         ADC LEFT
 1630         STA A1       SOURCE LO BYTE
 1640         STA A2       DESTINATION LO BYTE
 1650  *---MOVE THE LINE SEGMENT--------
 1660         LDY WIDTH
 1670  .2     LDA (A1),Y
 1680         STA (A2),Y
 1690         DEY
 1700         BPL .2
 1710  *---IF CLEARING, DRAW FRAME------
 1720         LDY TPAGE
 1730         BNE .4       ...NOT CLEAR, DO NOT DRAW FRAME
 1740         LDA #$20     INVERSE BLANK
 1750         STA (A1),Y   LEFT SIDE
 1760         LDY WIDTH
 1770         STA (A1),Y   RIGHT SIDE
 1780         LDX LINE
 1790         CPX TOP
 1800         BEQ .3       ...TOP LINE
 1810         CPX BOTTOM
 1820         BNE .4       ...NEITHER TOP NOR BOTTOM
 1830  .3     STA (A1),Y
 1840         DEY
 1850         BNE .3
 1860  *---NEXT LINE--------------------
 1870  .4     INC LINE     UNTIL LINE > BOTTOM
 1880         LDA BOTTOM
 1890         CMP LINE
 1900         BCS MOVE.LINE     ANOTHER LINE TO MOVE
 1910  *---IF CLEARING, SET WINDOW------
 1920         LDA TPAGE
 1930         BNE .5
 1940         LDX LEFT
 1950         INX
 1960         STX WNDLFT
 1970         LDX WIDTH
 1980         DEX
 1990         STX WNDWDTH
 2000         LDX TOP
 2010         INX
 2020         STX WNDTOP
 2030         LDX BOTTOM
 2040         STX WNDBTM
 2050         JSR HOME
 2060  .5     RTS
 2070  *--------------------------------
 2080  TOP    .BS 1        PROGRAM STORAGE
 2090  BOTTOM .BS 1
 2100  LEFT   .BS 1
 2110  RIGHT  .BS 1
 2120  WIDTH  .BS 1
 2130  LINE   .BS 1
 2140  TPAGE  .BS 1
 2150  *--------------------------------

