1000 ; RGB_EXPAND›1010 ; by Clay Halliwell›1020 ; -----------------›1030 ; USR(addr,indev#,width,height)›1040 ;›1050 ; O.S. EQUATES›1060 ICCOM=$0342›1070 ICBAL=$0344›1080 ICBAH=$0345›1090 ICBLL=$0348›1100 ICBLH=$0349›1110 CIOV =$E456›1120 FR0  =$00D4›1130 SAVMSC=$58›1140 ;›1150 GETCHR=$07›1160 BUFFER=$0600›1170 ;›1180 ; VARIABLES›1190 INDEV=218›1200 COUNT=219›1210 SNDEX=220›1220 INDEX=221›1230 XCOR =222›1240 YCOR =223›1250 BYTE =224›1260 NSTAT=225›1270 TYPE =226›1280 STACK=227›1290 ADDR =228       ; 2 bytes›1300 SCADDR=230      ;   "›1310 WIDE =232›1320 HIGH =233›1330 PIX  =234       ; 3 bytes›1340 ;›1350  *=$5F50›1360 ;›1370  PLA›1380  PLA›1390  PLA›1400  ASL A›1410  ASL A›1420  ASL A›1430  ASL A›1440  STA INDEV›1450  PLA›1460  PLA›1470  STA WIDE›1480  PLA›1490  PLA›1500  STA HIGH›1510 ;›1520  LDA #0›1530  STA XCOR›1540  STA YCOR›1550  STA NSTAT›1560  STA SNDEX›1570  STA INDEX›1580 ;›1590  LDA #$50       ; screen address›1600  STA ADDR›1610  STA SCADDR›1620  LDA #$41›1630  STA ADDR+1›1640 ;›1650  TSX›1660  STX STACK      ; save RTS addr›1670 ;›1680 MAINLOOP›1690  JSR GETCOUNT›1700  LDA TYPE›1710  BNE LITERAL›1720  JSR GETRGB›1730 REPDATA›1740  JSR PLOTRGB›1750  DEC COUNT›1760  BPL REPDATA›1770  JMP MAINLOOP›1780 ;›1790 LITERAL›1800  JSR GETRGB›1810  JSR PLOTRGB›1820  DEC COUNT›1830  BNE LITERAL›1840  JMP MAINLOOP›1850 ;›1860 PLOTRGB›1870  LDA PIX›1880  JSR PLOT›1890  LDA PIX+1›1900  JSR PLOT›1910  LDA PIX+2›1920  JSR PLOT›1930  JSR BUMPCURSOR›1940  JSR INCSCREEN›1950  RTS›1960 ;›1970 INCSCREEN›1980  DEC SNDEX›1990  BPL IDONE›2000  LDA #2›2010  STA SNDEX›2020 IDONE›2030  RTS›2040 ;›2050 PLOT›2060  PHA            ; save pixel›2070  JSR INCSCREEN›2080  CLC›2090  LDX SNDEX›2100  LDA OFFSET,X›2110  ADC ADDR+1›2120  STA SCADDR+1›2130 ;›2140  LDA XCOR›2150  LSR A          ; /2 *and*›2160  TAY            ; determine›2170  BCS ODDPIX     ; odd/even!›2180  PLA›2190  TAX›2200  LDA SHFTAB,X›2210  STA (SCADDR),Y›2220  RTS›2230 ODDPIX›2240  PLA            ; retrieve›2250  ORA (SCADDR),Y›2260  STA (SCADDR),Y›2270  RTS›2280 ;›2290 BUMPCURSOR›2300  CLC›2310  LDA ADDR›2320  ADC #40›2330  STA ADDR›2340  STA SCADDR›2350  BCC CHKY›2360  LDA ADDR+1›2370  ADC #0›2380  STA ADDR+1›2390 ;›2400 CHKY›2410  INC YCOR›2420  LDA YCOR›2430  CMP HIGH       ; at bottom?›2440  BNE BDONE›2450  INC XCOR›2460  LDA XCOR›2470  CMP WIDE       ; at far edge?›2480  BNE NEWCOLUMN›2490  LDX STACK›2500  TXS›2510  RTS›2520 ;›2530 NEWCOLUMN›2540  LDA #0›2550  STA YCOR›2560  LDA #$50›2570  STA ADDR›2580  LDA #$41›2590  STA ADDR+1›2600 BDONE›2610  RTS›2620 ;›2630 GETCOUNT›2640  JSR GETNYB›2650  TAX›2660  AND #8›2670  STA TYPE›2680  TXA›2690  AND #7›2700  BEQ BIGCOUNT›2710  STA COUNT›2720  RTS›2730 BIGCOUNT›2740  JSR GETNYB›2750  CLC›2760  ADC #7›2770  STA COUNT›2780  RTS›2790 ;›2800 GETRGB›2810  JSR GETNYB›2820  STA PIX›2830  JSR GETNYB›2840  STA PIX+1›2850  JSR GETNYB›2860  STA PIX+2›2870  RTS›2880 ;›2890 GETNYB›2900  LDA NSTAT›2910  BNE LOW›2920  LDA #1›2930  STA NSTAT›2940  JSR GET›2950  LSR A›2960  LSR A›2970  LSR A›2980  LSR A›2990  RTS›3000 LOW›3010  LDA #0›3020  STA NSTAT›3030  LDA BYTE›3040  AND #$0F›3050  RTS›3060 ;›3070 GET›3080  LDY INDEX›3090  BEQ FILLBUFF›3100 FETCH›3110  LDA BUFFER,Y›3120  STA BYTE›3130  INC INDEX›3140  RTS›3150 FILLBUFF›3160  LDA #GETCHR›3170  LDX INDEV›3180  STA ICCOM,X›3190  LDA #0›3200  STA ICBAL,X›3210  STA ICBLL,X›3220  LDA #6         ; buffer @ $0600›3230  STA ICBAH,X›3240  LDA #1›3250  STA ICBLH,X›3260  JSR CIOV›3270  LDY #0›3280  JMP FETCH›3290 ;›3300 OFFSET›3310  .BYTE $00,$20,$40›3320 SHFTAB›3330  .BYTE 0,16,32,48,64,80,96,112›3340  .BYTE 128,144,160,176,192,208,224,240›