Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7823335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T08:12:30+00:00 2026-06-02T08:12:30+00:00

I created a silly Huffman compressor in Python, so I can compress image/sound data

  • 0

I created a silly Huffman compressor in Python, so I can compress image/sound data to be applied in my Tandy Color Computer Projects. The decompressor is written in 6809 Assembly.
I couldn’t find a way to store the huffman tree, so I generated Assembly code that walks into the tree and get the correct uncompressed data. Here is an example:

DECOMP_HUFFMAN:        PSHS    A,B,X,Y,U
                       LDB     #8
                       STB     $2100
                       pshs    x
                       ldx     $2102
                       stx     $2106
                       puls    x                       
                       LDB     ,X+
                       JMP     inicio
prox_bit:              LSLB
                       PSHS    CC
                       DEC     $2100
                       BNE     S_P_B
                       LDB     #8
                       STB     $2100
                       LDB       ,X+
S_P_B:                 PULS    CC
                       RTS
armazena:              STA       ,U+
                       LEAY    -1,Y
                       BNE      inicio
                       PULS   U,Y,X,B,A
                       RTS


inicio:     jsr prox_bit
            tfr  cc,a
            anda #1
            sta  $2104
            lda ($2102)
            bne  n1
            lda $2104
n0:         pshs x
            ldx  $2102
            leax 1,x
            lda  a,x            
            puls x
            bsr  armazena
            pshs x
            ldx  $2106
            stx  $2102
            puls x
            bra inicio


n1:         cmpa #1
            bne  n2
            lda  $2104
            bne  n0
            bra  n4

n2:         cmpa #2
            bne  n3
            lda  $2104
            beq  n0

n3:         lda  $2104
n4:         pshs x
            ldx   $2102
            leax  1,x
            lda   a,x
            leax  a,x            
            stx   $2102
            puls x
            bra   inicio

I would like to use the real huffman tree, instead of creating the Assembly code to do it.

Thank you for your time.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T08:12:32+00:00Added an answer on June 2, 2026 at 8:12 am

    You can transmit a Huffman code simply by sending the code length for each symbol. You do not need to send a tree. A code length of zero indicates that that symbol does not occur.

    What you send might be something like:

    A: 2
    B: 0
    C: 0
    D: 3
    E: 1
    F: 0
    G: 0
    H: 0
    I: 3
    J: 0
    

    Where you only send the numbers — the assignment to symbols is in symbol order.

    Both ends would assume a canonical Huffman code, where the code values are assigned in order from the shortest code lengths to the longest. Within a bit length, the codes are assigned incrementally to the symbols in their order. For example (symbol: code length – code):

    E: 1 - 0
    A: 2 - 10
    D: 3 - 110
    I: 3 - 111
    

    Now the decoder only has to compare the low bits with integer values at the cutoff between each bit length (store the bits above reversed), starting with the shortest. Within each bit length, an index from the start provides an offset into a lookup table for the symbol.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

HI, this might sound like a silly question but.. i've created several types in
I know that the heading of this thread sound silly, but I can not
Created .NET WCF service, tested it - works. Generated schemas from Data and service
I created a batch file to run SqlMetal and generate Linq2Sql data classes, check
I created a web control, and it needs some data from its parent page.
I created this silly program to play with wait() public class WaitTest { public
i know it's a silly one but i want to know how can we
One of my co-workers created a silly bug in mongo mapreduce, he should have
In Metro app created by VS11, where can I find main function? I know
this may be a silly question. i have created a subnet on my network

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.