home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Commodore Disk User Volume 3 #11
/
Commodore_Disk_User_Vol.3_11_1990_-.d64
/
aw-decom.src
(
.txt
)
< prev
next >
Wrap
Commodore BASIC
|
2022-10-26
|
2KB
|
76 lines
100 *=$c100; _start of machine code
110 !
120 complen=$02; _compressed length of text stored in location 2
130 txstart=$c000; _start of compressed text
140 codestr=$fb; _temporary stores for two bytes ($fb/$fc)
150 decomst=$aa; _temp.stores for decoded info ($aa-$ac)
160 !
170 lda complen; _get compressed length
180 beq theend; _if =0 then end
190 and #$fe; _ensure it is even
200 sta complen; _store it again
210 !
220 ldy #$00; _start of comp.text
230 more lda txstart+1,y; _get 2nd byte
240 sta codestr+1; _store it
250 lda txstart,y; _get 1st byte
260 sta codestr; _and store it
270 cmp #$ff; _if =255 then non-standard
280 bne standard; _<>255 so standard
290 lda codestr+1; _retrieve 2nd byte
300 jsr $ffd2; _print it 'as is'
310 jmp loopback+2; _loop back for more
320 !
330 standard lda codestr; _get byte (equivalent of variable 'c1')
340 pha; _store it on the stack
350 lsr a; _divide by four
360 lsr a;
370 sta decomst; _stores integer value (equivalent of 'c(0)')
380 !
390 pla; _retrieve first coded byte
400 and #$03; _logical 'and' to get bits zero and one
410 asl a; _multiply by eight
420 asl a;
430 asl a;
440 sta decomst+1; _store as equiv. of 'c(1)'
450 lda codestr+1; _retrieve 2nd byte
460 and #$e0; _use bits 5-7 only
470 lsr a; _divide by 32
480 lsr a;
490 lsr a;
500 lsr a;
510 lsr a;
520 clc; _clear carry flag
530 adc decomst+1; _add to other store
540 sta decomst+1; _produces complete value for equiv. of 'c(1)'
550 !
560 lda codestr+1; _retrieve 2nd byte again
570 and #$1f; _only bits 0-4 incl.
580 sta decomst+2; _store as equiv. of 'c(3)'
590 !
600 tya; _store .y register on stack
610 pha;
620 ldx #$00
630 l1 ldy decomst,x; _get decoded byte number .x back and store in .y
640 cpy #$1f; _is it an 'end of set' marker?
650 beq loopback; _yes, so quit that block of three
660 !
670 lda chars,y; _get corresponding character (0=spc,1-26=letters,etc.)
680 jsr $ffd2; _print it
690 !
700 inx; _add one to counter
710 cpx #$03; _done all three?
720 bne l1; _no, so do another
730 !
740 loopback pla; _retrieve .y from stack
750 tay;
760 iny; _add two so that points to next set of two bytes
770 iny;
780 cpy complen; _retrieved last byte of compressed text yet?
790 bne more; _no, so get some more
800 !
810 theend rts; _all done. finish - return to basic
820 !
830 !
840 chars byt " abcdefghijklmnopqrstuvwxyz.,?!"; _31 corresponding characters