home *** CD-ROM | disk | FTP | other *** search
- 100 sys700 ;enable pal 64
- 110 ;
- 120 ; picture compressor -
- 130 ; optimizes hi-res picture
- 140 ; and saves on disk
- 150 ; this version converts file#8 (r)
- 160 ; to file#9 (w) with same load addr
- 170 ; sys(*) compresses 8 to 9
- 180 ; sys(*+3) loads 8 to memory
- 190 ;
- 200 ;save"@0:comp1.pal",8
- 210 ;
- 220 .opt oo
- 230 *=$c000
- 240 ;
- 250 jmp compress
- 260 jmp decomp
- 270 ;
- 280 repcount .byte 1
- 290 newbyt .byte 0
- 300 prevbyt .byte 0
- 310 st8 .byte 0
- 320 ;
- 330 picptr =$fb
- 340 ;kernel routines:
- 350 chrout =$ffd2
- 360 getin =$ffe4
- 370 close =$ffc3
- 380 chkout =$ffc9
- 390 chkin =$ffc6
- 400 clrchn =$ffcc
- 410 readst =$ffb7
- 420 ;
- 430 compress =*
- 440 jsr setin
- 450 jsr getin ;start addr lo
- 460 jsr setout
- 470 jsr chrout
- 480 jsr setin
- 490 jsr getin ;start addr hi
- 500 jsr setout
- 510 jsr chrout
- 520 jsr sendpic ;send picture to file
- 530 jmp fin
- 540 ;
- 550 decomp =*
- 560 jsr setin
- 570 jsr getin: sta picptr ;load addr lo
- 580 jsr getin: sta picptr+1 ;" " hi
- 590 ldy #0
- 600 jsr getpic ;get picture
- 610 ;
- 620 fin =*
- 630 jsr clrchn
- 640 lda #8: jsr close
- 650 lda #9: jsr close
- 660 rts
- 670 ;
- 680 ;
- 690 sendpic =*
- 700 jsr setin
- 710 jsr getin
- 720 sta prevbyt
- 730 nextout =*
- 740 jsr outbyte
- 750 lda st8
- 760 beq nextout
- 770 jsr writerep ;last sequence
- 780 rts
- 790 ;
- 800 ;
- 810 outbyte =*
- 820 jsr setin
- 830 jsr getin
- 840 pha
- 850 jsr readst: sta st8 ;save status
- 860 pla
- 870 sta newbyt
- 880 cmp prevbyt
- 890 bne diff
- 900 ;
- 910 inc repcount
- 920 bne ok ;count past 255"?
- 930 dec repcount
- 940 jsr writerep ;write rep code
- 950 ok [178][172]
- 960 jmp obfin
- 970 ;
- 980 d[139]f [178][172] ;[162] byte d[139]ferent
- 990 lda repcount
- 1000 cmp #6
- 1010 bcs docode ;m[176]e than 4 the same"?
- 1020 ;no, just print byte n times
- 1030 tax ;# reps for loop
- 1040 lda prevbyt
- 1050 cmp #254 ;ctrl byte"?
- 1060 beq docode ;yes, have [164] code it
- 1070 ;
- 1080 jsr se[164]ut
- 1090 lda prevbyt
- 1100 nlp [178][172]
- 1110 jsr chrout
- 1120 dex
- 1130 bne nlp
- 1140 lda #1: sta repcount
- 1150 jmp obfin
- 1160 ;
- 1170 docode [178][172]
- 1180 jsr writerep
- 1190 ;
- 1200 obfin [178][172]
- 1210 lda [162]byt
- 1220 sta prevbyt
- 1230 rts
- 1240 ;
- 1250 ;
- 1260 writerep [178][172] ;write repeat code
- 1270 jsr se[164]ut
- 1280 lda #254 ;special [154]rol byte
- 1290 jsr chrout
- 1300 lda prevbyt ;byte [164] repeat
- 1310 jsr chrout
- 1320 lda repcount ;number of reps
- 1330 jsr chrout
- 1340 lda #1
- 1350 sta repcount ;re[171]initialize count
- 1360 rts
- 1370 ;
- 1380 ;
- 1390 [161]pic [178][172] ;uncompress
- 1400 jsr [161]in
- 1410 cmp #254 ;rep indica[164]r
- 1420 beq [161]rep
- 1430 ;n[176]mal byte, just s[164]re it
- 1440 jsr s[164]rbyt
- 1450 jmp gpfin
- 1460 ;
- 1470 [161]rep [178][172] ;repeat byte n times
- 1480 jsr [161]in ;byte [164] repeat
- 1490 pha
- 1500 jsr [161]in ;# of repetiti[145]s
- 1510 tax
- 1520 pla
- 1530 replp [178][172]
- 1540 jsr s[164]rbyt ;stick it in mem[176]y
- 1550 dex
- 1560 bne replp ;do it .x times
- 1570 ;
- 1580 gpfin [178][172]
- 1590 jsr [135]st ;check disk status
- 1600 beq [161]pic ;do until [128][171]of[171]file
- 1610 rts
- 1620 ;
- 1630 ;
- 1640 s[164]rbyt [178][172] ;put .a in mem[176]y
- 1650 sta (picptr),y
- 1660 inc picptr ;inc[143]ent pointer
- 1670 bne sb0
- 1680 inc picptr[170]1
- 1690 sb0 [178][172]
- 1700 rts
- 1710 ;
- 1720 ;
- 1730 setin [178][172] ;set [133] [164] file #8
- 1740 pha:txa:pha
- 1750 ldx #8
- 1760 jsr chkin
- 1770 pla:tax:pla
- 1780 rts
- 1790 ;
- 1800 ;
- 1810 se[164]ut [178][172] ;set output [164] file #9
- 1820 pha:txa:pha
- 1830 ldx #9
- 1840 jsr chkout
- 1850 pla:tax:pla
- 1860 rts
- 1870 .[128]
-