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 >
Commodore BASIC  |  2022-10-26  |  2KB  |  76 lines

  1. 100 *=$c100; _start of machine code
  2. 110 !
  3. 120 complen=$02; _compressed length of text stored in location 2
  4. 130 txstart=$c000; _start of compressed text
  5. 140 codestr=$fb; _temporary stores for two bytes ($fb/$fc)
  6. 150 decomst=$aa; _temp.stores for decoded info ($aa-$ac)
  7. 160 !
  8. 170 lda complen; _get compressed length
  9. 180 beq theend; _if =0 then end
  10. 190 and #$fe; _ensure it is even
  11. 200 sta complen; _store it again
  12. 210 !
  13. 220 ldy #$00; _start of comp.text
  14. 230 more lda txstart+1,y; _get 2nd byte
  15. 240 sta codestr+1; _store it
  16. 250 lda txstart,y; _get 1st byte
  17. 260 sta codestr; _and store it
  18. 270 cmp #$ff; _if =255 then non-standard
  19. 280 bne standard; _<>255 so standard
  20. 290 lda codestr+1; _retrieve 2nd byte
  21. 300 jsr $ffd2; _print it 'as is'
  22. 310 jmp loopback+2; _loop back for more
  23. 320 !
  24. 330 standard lda codestr; _get byte (equivalent of variable 'c1')
  25. 340 pha; _store it on the stack
  26. 350 lsr a; _divide by four
  27. 360 lsr a;
  28. 370 sta decomst; _stores integer value (equivalent of 'c(0)')
  29. 380 !
  30. 390 pla; _retrieve first coded byte
  31. 400 and #$03; _logical 'and' to get bits zero and one
  32. 410 asl a; _multiply by eight
  33. 420 asl a;
  34. 430 asl a;
  35. 440 sta decomst+1; _store as equiv. of 'c(1)'
  36. 450 lda codestr+1; _retrieve 2nd byte
  37. 460 and #$e0; _use bits 5-7 only
  38. 470 lsr a; _divide by 32
  39. 480 lsr a;
  40. 490 lsr a;
  41. 500 lsr a;
  42. 510 lsr a;
  43. 520 clc; _clear carry flag
  44. 530 adc decomst+1; _add to other store
  45. 540 sta decomst+1; _produces complete value for equiv. of 'c(1)'
  46. 550 !
  47. 560 lda codestr+1; _retrieve 2nd byte again
  48. 570 and #$1f; _only bits 0-4 incl.
  49. 580 sta decomst+2; _store as equiv. of 'c(3)'
  50. 590 !
  51. 600 tya; _store .y register on stack
  52. 610 pha;
  53. 620 ldx #$00
  54. 630 l1 ldy decomst,x; _get decoded byte number .x back and store in .y
  55. 640 cpy #$1f; _is it an 'end of set' marker?
  56. 650 beq loopback; _yes, so quit that block of three
  57. 660 !
  58. 670 lda chars,y; _get corresponding character (0=spc,1-26=letters,etc.)
  59. 680 jsr $ffd2; _print it
  60. 690 !
  61. 700 inx; _add one to counter
  62. 710 cpx #$03; _done all three?
  63. 720 bne l1; _no, so do another
  64. 730 !
  65. 740 loopback pla; _retrieve .y from stack
  66. 750 tay;
  67. 760 iny; _add two so that points to next set of two bytes
  68. 770 iny;
  69. 780 cpy complen; _retrieved last byte of compressed text yet?
  70. 790 bne more; _no, so get some more
  71. 800 !
  72. 810 theend rts; _all done. finish - return to basic
  73. 820 !
  74. 830 !
  75. 840 chars byt " abcdefghijklmnopqrstuvwxyz.,?!"; _31 corresponding characters
  76.