0 ;WINDOWS2.ASM 01 ; ..TEST INTO GRAPHICS SCREENS.. 02 ; BIT to BIT PAIR Expansion with 03 ; conversion for 4 color Graphics 04 ; with string input capability. 05 ; vs.2 by Dave Culbertson 06 ; (C) Jun 11,1984 CE Softwart 07 ; 08 ;EQUATES 09 DAT = $CB ;ADR OF RESULT STRING. 10 SW = $CD ;FLAG FOR 2 NIBBLES. 11 TMP = $CE ;HOLDS WORKING BYTE. 12 COL = $CF ;COLOR MODIFIER REG. 13 COL1 = $D0 ;COPY OF COLOR MODIFIER. 14 YINR = $D1 ;Y POINTER INNER LOOP. 15 YOUT = $D2 ;Y POINTER OUTER LOOP. 16 CHR = $D3 ;ADR OF SOURCE STRING. 17 PT = $D5 ;PTR INTO CS. 18 INV = $D7 ;INVERSE FLAG. 19 NUM = $D8 ;LEN OF STRING. 20 NUM1 = $D9 ;COPY OF LEN*2. 21 TEA = $DA ;TEMP AREA. 22 PTR = $DB ;PTR TO WORK AREA ($400). 23 CS = 756 ;PAGE PNTR OF CHAR SET. 24 ; 25 *= $4000 ;IGNORE (RELOCATABLE) 26 GET THE VARIABLES 27 ; 28 PLA 29 PLA 30 STA DAT+1 31 PLA 32 STA DAT 33 PLA 34 STA CHR+1 35 PLA 36 STA CHR 37 PLA 38 PLA 39 STA NUM ;GET NUMBER OF CHRS 40 ASL A 41 STA NUM1 ;NUM1=NUM*2 42 PLA 43 PLA 44 AND #3 ;ONLY BITS 1&2 OK. 45 CLC 46 ROR A 47 ROR A 48 ROR A 49 AND #192 ;ONLY PASS BITS 7&8. 50 STA COL ;STORE COLOR CODE. 51 STA COL1 ;AND A COPY. 52 LDA #0 ;POINT TO PAGE 4. 53 STA PTR 54 LDA #4 55 STA PTR+1 56 ; CONVERT FROM CHARACTER TO 57 ; ADR OF PLACE IN CHARACTER SET 58 BE LDA #0 ;CLEAR WORK AREA. 59 TAY 60 BF STA (PTR),Y 61 INY 62 CPY #16 63 BNE BF 64 LDA #255 65 STA INV ;NORMAL MODE. 66 LDY #0 ;Y=0 67 LDA (CHR),Y ;GET THE CHARACTER 68 CMP #128 ;IS A <127? 69 BCC T ;YES GOTO T 70 STY INV ;SET INVERSE. 71 EOR #128 72 ; 73 T CMP #96 ;IS IT LOWERCASE? 74 BCC U ;NO,GOTO U. 75 LDY #3 ;SET OFFSET. 76 BCS Q ;GOTO Q. 77 ; 78 U CMP #64 ;IS IT UPPERCASE? 79 BCC V ;NO,GOTO V. 80 LDY #1 ;SET PAGE 1. 81 BCS Q ;GOTO Q. 82 ; 83 V CMP #32 ;IS IT A SYMBOL? 84 BCC W ;NO,GOTO W. 85 BCS Q ;YES,GOTO Q. 86 ; 1st ISLAND TO BEGINNING. 87 IS CLC 88 BCC BE ;GOTO BEGINNING. 89 ; 90 W LDY #2 ;A GRAPHICS CHR! 91 ; 92 Q AND #31 ;NOW ACC <32! 93 ASL A ;MULTIPLY BY 8! 94 ASL A 95 ASL A 96 STA PT ;INDEX INTO PAGE. 97 CLC ;MOVE PAGE OFFSET. 98 TYA 99 ADC CS ;ADD C.S. TO OFFSET. 0100 STA PT+1 ;STORE IT. 0101 ; MAIN ROUTINE 0102 LDY #0 0103 STY YINR 0104 STY YOUT 0105 S LDX #0 0106 STX SW 0107 LDY YOUT 0108 LDA (PT),Y 0109 STA TMP 0110 B LDY YINR 0111 LDA TMP 0112 BMI C 0113 ; 0114 LDA (PTR),Y 0115 ORA COL 0116 STA (PTR),Y 0117 C CLC 0118 ROR COL 0119 CLC 0120 ROR COL 0121 ASL TMP 0122 INX 0123 CPX #4 0124 BNE B 0125 ; 0126 LDA INV ;CHECK FOR INVERSE? 0127 BEQ D 0128 SEC ;INVERT BITS 0129 SBC (PTR),Y 0130 STA (PTR),Y 0131 D LDA COL1 ;ADJUST FOR NEXT 0132 STA COL 0133 INC YINR 0134 INC SW 0135 LDA SW 0136 CMP #2 0137 BNE B 0138 ; 0139 INC YOUT 0140 LDY YOUT 0141 CPY #8 0142 BNE S 0143 BEQ K ;HOP OVER ISLAND. 0144 ; 2nd ISLAND TO BEGINNING 0145 HOP CLC 0146 BCC IS ;GOTO BEGINNING. 0147 ; CONVERT DAT TO STRING FORMAT. 0148 K LDA DAT ;PUSH DAT ON STACK 0149 PHA 0150 LDA DAT+1 0151 PHA 0152 LDY #0 0153 AG LDA (PTR),Y 0154 STA (DAT),Y 0155 INY 0156 CPY #2 0157 BNE AG 0158 J LDA (PTR),Y 0159 TAX 0160 INY 0161 LDA (PTR),Y 0162 PHA 0163 INY 0164 STY TEA 0165 LDY NUM1 0166 TXA 0167 STA (DAT),Y 0168 PLA 0169 INY 0170 STA (DAT),Y 0171 CLC 0172 LDA DAT 0173 ADC NUM1 0174 STA DAT 0175 BCC G 0176 INC DAT+1 0177 G LDY TEA 0178 CPY #16 0179 BNE J 0180 PLA ;RECOVER & BUMP DAT 0181 STA DAT+1 0182 CLC 0183 PLA 0184 ADC #2 0185 STA DAT 0186 BCC I 0187 INC DAT+1 0188 I INC CHR ;INCREMENT CHR 0189 BNE H 0190 INC CHR+1 0191 H DEC NUM 0192 BNE HOP ;DO NEXT CHARACTER. 0193 RTS
Back to previous page