C64 Software  <  SCA: The C64 Software Collection / KOALASWAPPER

  Run
1000              ;
1010              ; KOALA-SWAPPER
1020              ;
1030              ; V1.70 / 6.'86
1040              ;
1050              ;
1060              ORG 20000
1070              ;
1080              ;
1090 CHKIN        EQU $FFC6
1100 CLRCH        EQU $FFCC
1110 OUTCHR       EQU $FFD2
1120 BASIN        EQU $FFCF
1130 GET          EQU $F142 ; NUR TAST.
1140              ;
1150 ST           EQU 144
1160 XCNTR        EQU 100
1170 YCNTR        EQU 101
1180 BYTE         EQU 102
1190 TMP1         EQU 252
1200 TMP2         EQU 254
1210              ;
1220 FILENAME     EQU 49152
1230              ;
1240 BA           EQU 8192     ; START
1250 BE           EQU BA+10001 ; ENDE+1
1260 C1           EQU BA+8000
1270 C2           EQU BA+9000
1280 C0           EQU BA+10000
1290 C1A          EQU 1024
1300 C2A          EQU 55296
1310              ;
1320              ;
1330              ;
1340 ANFANG       LDX #0
1350              STX 157
1360              STX 53280
1370              STX 53281
1380 TEXT1LOOP    LDA TEXT1,X
1390              BEQ LOADER
1400              JSR OUTCHR
1410              INX
1420              BNE TEXT1LOOP
1430              ;
1440 LOADER       JSR INPUT
1450              ;
1460 LOADIT       JSR INIT
1470              LDA #1
1480              LDX #8
1490              LDY #0 ; RELATIV
1500              JSR 65466
1510              LDA #15
1520              LDX #<FILENAME
1530              LDY #>FILENAME
1540              JSR 65469
1550              LDA #0
1560              LDX #<BA
1570              LDY #>BA
1580              JSR 65493
1590              BCS LOADER
1600              ;
1610              LDX #0
1620 TEXT2LOOP    LDA TEXT2,X
1630              BEQ MAINLOOP
1640              JSR OUTCHR
1650              INX
1660              BNE TEXT2LOOP
1670              ;
1680 MAINLOOP     JSR GET
1690              CMP #32
1700              BNE MAINLOOP
1710              ;
1720 WHATNOW      JSR SHOWPIC
1730 WHATNOW1     JSR GET
1740              CMP #133     ; F1
1750              BNE WHATNOW2
1760              JSR SWAP
1770              JMP WHATNOW
1780              ;
1790 WHATNOW2     CMP #88      ; ""
1800              BNE WHATNOW3
1810              JSR NORM
1820              JMP ANFANG
1830              ;
1840 WHATNOW3     CMP #83      ; ""
1850              BNE WHATNOW1
1860              ;
1870              JSR NORM
1880 SAVE         JSR INPUT
1890              ;
1900              JSR INIT
1910              LDA #1
1920              LDX #8
1930              LDY #1
1940              JSR $FFBA
1950              LDA #15
1960              LDX #<FILENAME
1970              LDY #>FILENAME
1980              JSR $FFBD
1990              LDA #<BA
2000              STA TMP1
2010              LDA #>BA
2020              STA TMP1+1
2030              LDA #TMP1
2040              LDX #<BE
2050              LDY #>BE
2060              JSR 65496
2070              BRK
2080              ;
2090              ;
2100 SHOWPIC      LDA #<C1
2110              STA TMP1
2120              LDA #>C1
2130              STA TMP1+1
2140              LDA #<C1A
2150              STA TMP2
2160              LDA #>C1A
2170              STA TMP2+1
2180              ;
2190              JSR MOVE
2200              ;
2210              LDA #<C2
2220              STA TMP1
2230              LDA #>C2
2240              STA TMP1+1
2250              LDA #<C2A
2260              STA TMP2
2270              LDA #>C2A
2280              STA TMP2+1
2290              ;
2300              JSR MOVE
2310              ;
2320              LDA #59
2330              STA 53265
2340              LDA #24
2350              STA 53272
2360              LDA #216
2370              STA 53270
2380              LDA #0
2390              STA 53280
2400              LDA C0
2410              STA 53281
2420              RTS
2430              ;
2440 MOVE         LDX #4
2450              LDY #0
2460 MOVE1        LDA (TMP1),Y
2470              STA (TMP2),Y
2480              INY
2490              BNE MOVE1
2500              INC TMP1+1
2510              INC TMP2+1
2520              DEX
2530              BNE MOVE1
2540              RTS
2550              ;
2560 NORM         LDA #27
2570              STA 53265
2580              LDA #21
2590              STA 53272
2600              LDA #200
2610              STA 53270
2620              LDA #147
2630              JMP OUTCHR
2640              ;
2650              ;
2660 SWAP         LDA #<C1
2670              LDX #>C1
2680              JSR SWAPCOL
2690              ;
2700              LDA #<C2
2710              LDX #>C2
2720              JSR SWAPCOL
2730              ;
2740              LDA #<BA
2750              LDX #>BA
2760              STA TMP1
2770              STX TMP1+1
2780              CLC
2790              ADC #56
2800              STA TMP2
2810              INX
2820              STX TMP2+1
2830              ;
2840              LDA #25
2850              STA YCNTR
2860 SWAP1        LDA #20
2870              STA XCNTR
2880              ;
2890 SWAP2        LDY #7
2900 SWAP3        LDA (TMP1),Y
2910              TAX
2920              LDA (TMP2),Y
2930              JSR SWAPBYTE
2940              STA (TMP1),Y
2950              TXA
2960              JSR SWAPBYTE
2970              STA (TMP2),Y
2980              DEY
2990              BPL SWAP3
3000              ;
3010              LDA #8
3020              JSR ADDTMP1
3030              LDA TMP2
3040              SEC
3050              SBC #8
3060              STA TMP2
3070              LDA TMP2+1
3080              SBC #0
3090              STA TMP2+1
3100              ;
3110              DEC XCNTR
3120              BNE SWAP2
3130              ;
3140              LDA #160
3150              JSR ADDTMP1
3160              LDA #240
3170              JSR ADDTMP2
3180              LDA #240
3190              JSR ADDTMP2
3200              ;
3210              DEC YCNTR
3220              BEQ SWAP4
3230              JMP SWAP1
3240              ;
3250 SWAP4        RTS
3260              ;
3270              ;
3280 SWAPCOL      STA TMP1
3290              STX TMP1+1
3300              CLC
3310              ADC #39
3320              STA TMP2
3330              TXA
3340              ADC #0
3350              STA TMP2+1
3360              ;
3370              LDA #25
3380              STA YCNTR
3390              ;
3400              LDY #0
3410 SWAPCOL1     LDA #20
3420              STA XCNTR
3430              ;
3440 SWAPCOL2     LDA (TMP1),Y
3450              TAX
3460              LDA (TMP2),Y
3470              STA (TMP1),Y
3480              TXA
3490              STA (TMP2),Y
3500              ;
3510              LDA #1
3520              JSR ADDTMP1
3530              LDA TMP2
3540              SEC
3550              SBC #1
3560              STA TMP2
3570              LDA TMP2+1
3580              SBC #0
3590              STA TMP2+1
3600              ;
3610              DEC XCNTR
3620              BNE SWAPCOL2
3630              ;
3640              LDA #20
3650              JSR ADDTMP1
3660              LDA #60
3670              JSR ADDTMP2
3680              ;
3690              DEC YCNTR
3700              BEQ SWAPCOL3
3710              JMP SWAPCOL1
3720              ;
3730 SWAPCOL3     RTS
3740              ;
3750              ;
3760 SWAPBYTE     PHA
3770              ROL
3780              ROL
3790              ROL
3800              AND #%00000011
3810              STA BYTE
3820              PLA
3830              PHA
3840              ROR
3850              ROR
3860              AND #%00001100
3870              ORA BYTE
3880              STA BYTE
3890              PLA
3900              PHA
3910              ROL
3920              ROL
3930              AND #%00110000
3940              ORA BYTE
3950              STA BYTE
3960              PLA
3970              ROR
3980              ROR
3990              ROR
4000              AND #%11000000
4010              ORA BYTE
4020              RTS
4030              ;
4040              ;
4050 ADDTMP1      CLC
4060              ADC TMP1
4070              STA TMP1
4080              LDA TMP1+1
4090              ADC #0
4100              STA TMP1+1
4110              RTS
4120              ;
4130 ADDTMP2      CLC
4140              ADC TMP2
4150              STA TMP2
4160              LDA TMP2+1
4170              ADC #0
4180              STA TMP2+1
4190              RTS
4200              ;
4210              ;
4220              ;
4230 INPUT        LDX #0
4240 ILOOP1       LDA ITEXT,X
4250              BEQ INPUT1
4260              JSR OUTCHR
4270              INX
4280              BNE ILOOP1
4290              ;
4300 INPUT1       LDA #129 ; ""
4310              STA FILENAME
4320              LDX #14
4330              LDA #32
4340 ILOOP2       STA FILENAME,X
4350              DEX
4360              BNE ILOOP2
4370              ;
4380              INX
4390 ILOOP3       JSR BASIN
4400              CMP #13
4410              BEQ INPUTAUS
4420              CMP #36 ; ""
4430              BEQ DIR
4440              ;
4450              STA FILENAME,X
4460              INX
4470              BNE ILOOP3
4480 INPUTAUS     RTS
4490              ;
4500 DIR          JSR INIT
4510              LDA #1
4520              LDX #8
4530              LDY #0
4540              JSR 65466
4550              LDA #1
4560              LDX #<DTEXT
4570              LDY #>DTEXT
4580              JSR 65469
4590              JSR 65472
4600              ;
4610              LDA #147
4620              JSR OUTCHR
4630              LDX #1
4640              JSR CHKIN
4650              JSR BASIN
4660              JSR BASIN
4670 DIR1         JSR BASIN
4680              JSR BASIN
4690              BEQ DIREND
4700              JSR BASIN
4710              STA TMP1
4720              JSR BASIN
4730              LDX TMP1
4740              JSR $BDCD ; NUMOUT
4750              LDA #32
4760              JSR OUTCHR
4770 DIR2         JSR GET
4780              BEQ DIR3
4790              CMP #3
4800              BEQ DIREND
4810 DIRWAIT      JSR GET
4820              BEQ DIRWAIT
4830              CMP #3
4840              BEQ DIREND
4850 DIR3         JSR BASIN
4860              JSR OUTCHR
4870              BNE DIR2
4880              LDA #13
4890              JSR OUTCHR
4900              JMP DIR1
4910              ;
4920 DIREND       JSR CLRCH
4930              LDA #1
4940              JSR 65475 ; CLOSE
4950              JMP INPUT
4960              ;
4970 INIT         LDA #1
4980              LDX #8
4990              LDY #15
5000              JSR 65466
5010              LDA #1
5020              LDX #<INITEXT
5030              LDY #>INITEXT
5040              JSR 65469
5050              JSR 65472
5060              LDA #1
5070              JMP 65475
5080              ;
5090              ;
5100 TEXT1        DFB "",13
5110              DFB "",13
5120              DFB "",13
5130              DFB "",13
5140              DFB "",13,0
5150 ITEXT        DFB 13,"",0
5160 TEXT2        DFB 13,"",13
5170              DFB "",13
5180              DFB "",13
5190              DFB "",0
5200 DTEXT        DFB ""
5210 INITEXT      DFB ""
READY.