1000 ;SAVE"",8
1010 ;
1020 ; KOALA - GRAPHICRAFT
1030 ; PICTURE - CONVERTER
1040 ; (C)1986 BY SATURNUS
1050 ; V0.35 8/11/86 17:55
1060 ; NOT TO BE RELEASED!
1070 ;
1080 ;
1090 ORG 2049
1100 ;
1110 ;
1120 CHKIN EQU $FFC6
1130 CHKOUT EQU $FFC9
1140 CLRCH EQU $FFCC
1150 CLALL EQU $FFE7
1160 OUTCHR EQU $FFD2
1170 BASIN EQU $FFCF
1180 GET EQU $F142 ; NUR TAST.
1190 ;
1200 ST EQU 144
1210 X EQU 23
1220 Y EQU 24
1230 PIXEL EQU 25
1240 ADR EQU 172
1250 TMP1 EQU 174
1260 ;
1270 B EQU $0E00
1280 ;
1290 COLTAB EQU B ; BIS B+3
1300 P0 EQU B+4
1310 P1 EQU B+5
1320 P2 EQU B+6
1330 P3 EQU B+7
1340 ;
1350 FILENAME EQU B+8 ; BIS B+23
1360 ;
1370 PLNE0 EQU B+24
1380 PLNE1 EQU PLNE0+40
1390 PLNE2 EQU PLNE1+40
1400 PLNE3 EQU PLNE2+40
1410 ;
1420 KOALA EQU 8192 ; START
1430 COLOR1 EQU KOALA+8000
1440 COLOR2 EQU KOALA+9000
1450 COLOR0 EQU KOALA+10000
1460 C1A EQU 1024
1470 C2A EQU 55296
1480 ;
1490 HLENGTH EQU 186
1500 ;
1510 ;
1520 ;
1530 DFB 15,8,250,255,158,"",0,0,0,0
1540 ;
1550 ANFANG JSR CLALL
1560 LDA #6
1570 STA 53280
1580 STA 53281
1590 LDX #0
1600 STX 157
1610 TEXT1LOOP LDA TEXT1,X
1620 BEQ LOADER
1630 JSR OUTCHR
1640 INX
1650 BNE TEXT1LOOP
1660 ;
1670 LOADER JSR INPUT
1680 ;
1690 LOADIT JSR INIT
1700 LDA #1
1710 LDX #8
1720 LDY #0 ; RELATIV
1730 JSR 65466
1740 LDA #15
1750 LDX #<FILENAME
1760 LDY #>FILENAME
1770 JSR 65469
1780 LDA #0
1790 LDX #<KOALA
1800 LDY #>KOALA
1810 JSR 65493
1820 BCS LOADER
1830 ;
1840 LDX #0
1850 TEXT2LOOP LDA TEXT2,X
1860 BEQ WAITKEY
1870 JSR OUTCHR
1880 INX
1890 BNE TEXT2LOOP
1900 ;
1910 WAITKEY JSR GET
1920 CMP #88 ; ""
1930 BEQ ANFANG
1940 ;
1950 CMP #133 ; F1
1960 BNE WAITKEY
1970 ;
1980 ;
1990 RSOPEN LDA #2
2000 LDX #2 ; RS 232
2010 LDY #0
2020 JSR 65466
2030 LDA #2
2040 LDX #<RSBYTE
2050 LDY #>RSBYTE
2060 JSR 65469
2070 JSR 65472
2080 ;
2090 LDX #2
2100 JSR CHKOUT
2110 ;
2120 LDX #0
2130 HTLOOP LDA FILEHEADER,X
2140 JSR SENDABYTE
2150 INX
2160 CPX #HLENGTH
2170 BCC HTLOOP
2180 ;
2190 JSR SHOWPIC
2200 ;
2210 ;
2220 LDA #0
2230 STA Y
2240 ;
2250 LOOP1 LDA #0
2260 STA X
2270 JSR CLRPLNES
2280 ;
2290 LOOP2 JSR GETCOLS
2300 JSR GETADR
2310 ;
2320 LDY #0
2330 LOOP3 STY PIXEL
2340 LDY #0
2350 LDA (ADR),Y
2360 JSR SHIFTRIGHT
2370 AND #3
2380 TAX
2390 JSR SETP0BIS3
2400 JSR PTOPLNE
2410 ;
2420 LDY PIXEL
2430 INY
2440 CPY #4
2450 BCC LOOP3
2460 ;
2470 LDY #0
2480 TYA
2490 STA (ADR),Y
2500 ;
2510 INC X
2520 LDA X
2530 CMP #40
2540 BCC LOOP2
2550 ;
2560 JSR SENDLINE
2570 INC Y
2580 LDA Y
2590 CMP #200
2600 BCC LOOP1
2610 ;
2620 LDA #16 ; FERTIG
2630 JSR OUTCHR
2640 JSR OUTCHR
2650 WARTPUFFER LDA $029D
2660 CMP $029E
2670 BNE WARTPUFFER
2680 ;
2690 LDX #200
2700 DELAY INC 53280
2710 LDA 53265
2720 BPL DELAY
2730 DELAY1 INC 53280
2740 LDA 53265
2750 BMI DELAY1
2760 DEX
2770 BNE DELAY
2780 ;
2790 JSR CLRCH
2800 JSR NORM
2810 LDA #2
2820 JSR 65475 ; CLOSE
2830 JSR CLALL
2840 JMP 64738
2850 ;
2860 ;
2870 ;
2880 CLRPLNES LDX #200 ; 5*40
2890 LDA #0
2900 CLRPLNES1 STA PLNE0-1,X
2910 DEX
2920 BNE CLRPLNES1
2930 RTS
2940 ;
2950 ;
2960 GETCOLS LDA COLOR0
2970 AND #15
2980 STA COLTAB
2990 LDA Y
3000 LSR
3010 LSR
3020 LSR
3030 ASL ;DURCH 8 MAL 2
3040 TAY
3050 LDA X
3060 STA TMP1
3070 LDA #0
3080 STA TMP1+1
3090 LDA CMULT+1,Y
3100 TAX
3110 LDA CMULT ,Y
3120 JSR ADDTMP1
3130 LDA #<COLOR1
3140 LDX #>COLOR1
3150 JSR ADDTMP1
3160 ;
3170 LDY #0
3180 LDA (TMP1),Y
3190 PHA
3200 LSR
3210 LSR
3220 LSR
3230 LSR
3240 STA COLTAB+1
3250 PLA
3260 AND #15
3270 STA COLTAB+2
3280 ;
3290 LDA #<1000
3300 LDX #>1000
3310 JSR ADDTMP1
3320 ;
3330 LDA (TMP1),Y
3340 AND #15
3350 STA COLTAB+3
3360 RTS
3370 ;
3380 ;
3390 GETADR LDA Y
3400 LSR
3410 LSR
3420 LSR ; INT(Y/8)
3430 STA TMP1
3440 LDX #0
3450 STX TMP1+1
3460 ; MAL 320
3470 ASL TMP1 ; MAL 5
3480 ROL TMP1+1
3490 ASL TMP1
3500 ROL TMP1+1
3510 JSR ADDTMP1
3520 ;
3530 LDX #6 ; MAL 64
3540 GETADR1 ASL TMP1
3550 ROL TMP1+1
3560 DEX
3570 BNE GETADR1
3580 ;
3590 LDA Y
3600 AND #7
3610 CLC
3620 ADC TMP1
3630 STA TMP1
3640 ;
3650 LDA X
3660 ASL
3670 ASL
3680 ASL ; MAL 8
3690 BCC GETADR2
3700 INC TMP1+1
3710 GETADR2 LDX #0
3720 JSR ADDTMP1
3730 LDA #<KOALA
3740 LDX #>KOALA
3750 JSR ADDTMP1
3760 LDA TMP1
3770 STA ADR
3780 LDA TMP1+1
3790 STA ADR+1
3800 RTS
3810 ;
3820 ;
3830 SHIFTRIGHT LDX PIXEL
3840 BEQ SR6
3850 CPX #1
3860 BEQ SR4
3870 CPX #2
3880 BEQ SR2
3890 BNE SR0
3900 BRK
3910 SR6 LSR
3920 LSR
3930 SR4 LSR
3940 LSR
3950 SR2 LSR
3960 LSR
3970 SR0 RTS
3980 ;
3990 ;
4000 SETP0BIS3 LDY PIXEL
4010 LDA #0
4020 STA P0
4030 STA P1
4040 STA P2
4050 STA P3
4060 LDA COLTAB,X
4070 TAX
4080 AND #1
4090 BEQ W1
4100 LDA MASK,Y
4110 STA P0
4120 W1 TXA
4130 AND #2
4140 BEQ W2
4150 LDA MASK,Y
4160 STA P1
4170 W2 TXA
4180 AND #4
4190 BEQ W3
4200 LDA MASK,Y
4210 STA P2
4220 W3 TXA
4230 AND #8
4240 BEQ W4
4250 LDA MASK,Y
4260 STA P3
4270 W4 RTS
4280 ;
4290 ;
4300 PTOPLNE LDX X
4310 LDA PLNE0,X
4320 ORA P0
4330 STA PLNE0,X
4340 LDA PLNE1,X
4350 ORA P1
4360 STA PLNE1,X
4370 LDA PLNE2,X
4380 ORA P2
4390 STA PLNE2,X
4400 LDA PLNE3,X
4410 ORA P3
4420 STA PLNE3,X
4430 RTS
4440 ;
4450 ;
4460 ADDTMP1 CLC ; A LOW,X HI
4470 ADC TMP1
4480 STA TMP1
4490 TXA
4500 ADC TMP1+1
4510 STA TMP1+1
4520 RTS
4530 ;
4540 ;
4550 SENDLINE LDX #0
4560 SENDLINE1 LDA PLNE0,X
4570 JSR SENDABYTE
4580 INX
4590 CPX #200 ; 5*40
4600 BCC SENDLINE1
4610 RTS
4620 ;
4630 SENDABYTE PHA
4640 ;
4650 WAITRASTER LDA 53265
4660 BMI WAITRASTER
4670 WAITRASTER2 LDA 53266
4680 AND #31
4690 BNE WAITRASTER2
4700 INC 53280
4710 LDA $029E
4720 SBC $029D
4730 CMP #200
4740 BCS WAITRASTER2
4750 ;
4760 PLA
4770 PHA
4780 AND #15
4790 JSR OUTCHR
4800 PLA
4810 LSR
4820 LSR
4830 LSR
4840 LSR
4850 JSR OUTCHR
4860 LDA #0
4870 STA 53280
4880 RTS
4890 ;
4900 ;
4910 SHOWPIC LDA #<COLOR1
4920 STA TMP1
4930 LDA #>COLOR1
4940 STA TMP1+1
4950 LDA #<C1A
4960 STA ADR
4970 LDA #>C1A
4980 STA ADR+1
4990 ;
5000 JSR MOVE
5010 ;
5020 LDA #<COLOR2
5030 STA TMP1
5040 LDA #>COLOR2
5050 STA TMP1+1
5060 LDA #<C2A
5070 STA ADR
5080 LDA #>C2A
5090 STA ADR+1
5100 ;
5110 JSR MOVE
5120 ;
5130 LDA #59
5140 STA 53265
5150 LDA #24
5160 STA 53270
5170 STA 53272
5180 LDA COLOR0
5190 STA 53281
5200 LDA #0
5210 STA 53280
5220 RTS
5230 ;
5240 MOVE LDX #4
5250 LDY #0
5260 MOVE1 LDA (TMP1),Y
5270 STA (ADR ),Y
5280 INY
5290 BNE MOVE1
5300 INC TMP1+1
5310 INC ADR +1
5320 DEX
5330 BNE MOVE1
5340 RTS
5350 ;
5360 NORM LDA #27
5370 STA 53265
5380 LDA #21
5390 STA 53272
5400 LDA #200
5410 STA 53270
5420 LDA #147
5430 JMP OUTCHR
5440 ;
5450 ;
5460 ;
5470 INPUT LDX #0
5480 ILOOP1 LDA ITEXT,X
5490 BEQ INPUT1
5500 JSR OUTCHR
5510 INX
5520 BNE ILOOP1
5530 ;
5540 INPUT1 LDA #129 ; ""
5550 STA FILENAME
5560 LDX #14
5570 LDA #32
5580 ILOOP2 STA FILENAME,X
5590 DEX
5600 BNE ILOOP2
5610 ;
5620 INX
5630 ILOOP3 JSR BASIN
5640 CMP #13
5650 BEQ CHEPCH
5660 CMP #36 ; ""
5670 BEQ DIR
5680 ;
5690 STA FILENAME,X
5700 INX
5710 BNE ILOOP3
5720 CHEPCH RTS
5730 ;
5740 DIR JSR INIT
5750 LDA #1
5760 LDX #8
5770 LDY #0
5780 JSR 65466
5790 LDA #1
5800 LDX #<DTEXT
5810 LDY #>DTEXT
5820 JSR 65469
5830 JSR 65472
5840 ;
5850 LDA #147
5860 JSR OUTCHR
5870 LDX #1
5880 JSR CHKIN
5890 JSR BASIN
5900 JSR BASIN
5910 DIR1 JSR BASIN
5920 JSR BASIN
5930 BEQ DIREND
5940 JSR BASIN
5950 STA TMP1
5960 JSR BASIN
5970 LDX TMP1
5980 JSR $BDCD ; NUMOUT
5990 LDA #32
6000 JSR OUTCHR
6010 DIR2 JSR GET
6020 BEQ DIR3
6030 CMP #3
6040 BEQ DIREND
6050 DIRWAIT JSR GET
6060 BEQ DIRWAIT
6070 CMP #3
6080 BEQ DIREND
6090 DIR3 JSR BASIN
6100 JSR OUTCHR
6110 BNE DIR2
6120 LDA #13
6130 JSR OUTCHR
6140 JMP DIR1
6150 ;
6160 DIREND JSR CLRCH
6170 LDA #1
6180 JSR 65475 ; CLOSE
6190 JMP INPUT
6200 ;
6210 INIT LDA #1
6220 LDX #8
6230 LDY #15
6240 JSR 65466
6250 LDA #1
6260 LDX #<INITEXT
6270 LDY #>INITEXT
6280 JSR 65469
6290 JSR 65472
6300 LDA #1
6310 JMP 65475
6320 ;
6330 ;
6340 MASK DFB %11000000
6350 DFB %00110000
6360 DFB %00001100
6370 DFB %00000011
6380 ;
6390 ;
6400 TEXT1 DFB "",13
6410 DFB "",13
6420 DFB "",13
6430 DFB "",13
6440 DFB "",13
6450 DFB "",13,0
6460 ITEXT DFB 13,"",0
6470 TEXT2 DFB 13,"",13
6480 DFB "",0
6490 ;
6500 DTEXT DFB ""
6510 INITEXT DFB ""
6520 RSBYTE DFB $88,$00 ; 1200 BPS / 8 BITS / 2 STOPBITS
6530 ;
6540 CMULT DFB 000,000,040,000
6550 DFB 080,000,120,000
6560 DFB 160,000,200,000
6570 DFB 240,000,024,001
6580 DFB 064,001,104,001
6590 DFB 144,001,184,001
6600 DFB 224,001,008,002
6610 DFB 048,002,088,002
6620 DFB 128,002,168,002
6630 DFB 208,002,248,002
6640 DFB 032,003,072,003
6650 DFB 112,003,152,003
6660 DFB 192,003
6670 ;
6680 ;
6690 FILEHEADER DFB "",0,0,$9C,$F2
6700 DFB ""
6710 DFB "",0,0,$00,$14
6720 DFB $01,$40,$00,$C8
6730 DFB $00,$00,$00,$00
6740 DFB $05,$00,$00,$00
6750 DFB $00,$00,$0A,$0B
6760 DFB $01,$40,$00,$C8
6770 DFB "",0,0,$00,$60
6780 DFB $00,$00,$00 ;BLK
6790 DFB $F0,$F0,$F0 ;WHT
6800 DFB $F0,$00,$00 ;RED
6810 DFB $00,$F0,$F0 ;CYN
6820 DFB $F0,$00,$F0 ;PUR
6830 DFB $00,$F0,$00 ;GRN
6840 DFB $00,$00,$F0 ;BLU
6850 DFB $F0,$F0,$00 ;YEL
6860 DFB $F0,$70,$00 ;ORG
6870 DFB $70,$70,$00 ;BRN
6880 DFB $F0,$70,$70 ;LRED
6890 DFB $40,$40,$40 ;GRY1
6900 DFB $70,$70,$70 ;GRY2
6910 DFB $70,$F0,$70 ;LGRN
6920 DFB $70,$70,$F0 ;LBLU
6930 DFB $B0,$B0,$B0 ;GRY3
6940 ;
6950 DFB $00,$00,$00 ;BLK
6960 DFB $F0,$F0,$F0 ;WHT
6970 DFB $F0,$00,$00 ;RED
6980 DFB $00,$F0,$F0 ;CYN
6990 DFB $F0,$00,$F0 ;PUR
7000 DFB $00,$F0,$00 ;GRN
7010 DFB $00,$00,$F0 ;BLU
7020 DFB $F0,$F0,$00 ;YEL
7030 DFB $F0,$70,$00 ;ORG
7040 DFB $70,$70,$00 ;BRN
7050 DFB $F0,$70,$70 ;LRED
7060 DFB $40,$40,$40 ;GRY1
7070 DFB $70,$70,$70 ;GRY2
7080 DFB $70,$F0,$70 ;LGRN
7090 DFB $70,$70,$F0 ;LBLU
7100 DFB $B0,$B0,$B0 ;GRY3
7110 ;
7120 DFB "",0,0,$00,$04
7130 DFB $00,$00,$40,$00
7140 DFB "",0,0,$00,$0E
7150 DFB $00,$00,$FF,$FF
7160 DFB $00,$00,$00,$00
7170 DFB $00,$0F,$42,$3F
7180 DFB $00,$00
7190 DFB "",0,0,$9C,$40
7200 DFB 0,0,0,240,0,0,0
READY.