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