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 6924753
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:42:08+00:00 2026-05-27T10:42:08+00:00

I’m writing an encoding/decoding .COM program using Huffman algorithm for dos 8086 (16-bit tasm

  • 0

I’m writing an encoding/decoding .COM program using Huffman algorithm for dos 8086 (16-bit tasm or masm without using libraries), and need to store 2 command-line arguments (inputfilename and outputfilename) in arrays so that I can read the input file, apply my huffman encoding, and write to the output file.

I’ve read that they are stored at address 80h, where 80h contains the length of the arguments, and 81h onward the arguments themselves. So the idea is to store the first argument in inarg (and the second one in outarg, which I haven’t started working on yet)
The purpose of the interrupt 21h call with subroutine 9 was to check I had it right. (which is not the case)

Here is what I have so far:

getCLargs proc near 

mov cx, [080h]        ; store memory address of command-line argument length
mov bx, 082h          ; store command-line arguments first byte

sub si,si  
sub di,di
next:         
mov dx, [bx]          ; store first byte of argument into dx 
mov inarg[si],dx      ; put it into the first byte of the array inarg
cmp cx, di            ; compare di to the length of the args
je print              ; if equal, done, jump to print
inc di                ; else: inc di
;    inc si
jmp next              ; do it again until cx=di
print:
mov ah, 09h           ; print content of inarg array to check it's right
mov dx, inarg
mov inarg[si+1], '$'  ; not sure whether I must terminate my string array with '$'
int 21h
done:    
ret
getCLargs endp

With the following relevant data:

inarg dw ?
outarg dw ?

I’ve started with the basics without considering delimiters, and trying to get only the first argument (inarg, which is the input file name).

And it doesn’t work, so I’m definitely doing something wrong.
This look may like a total mess to any experienced programmer, but that’s because I tried to follow resources I found on the internet without success, and therefore switch to implement it using only the concepts I understand so far.
Any help would be greatly appreciated,
Thank you.

  • 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-05-27T10:42:09+00:00Added an answer on May 27, 2026 at 10:42 am

    There are several things wrong with your code. Rather than me describing how to fix it, you might consider that you don’t have to copy the arguments. They’re already in memory, so you could just store pointers to the arguments, and their lengths. And you don’t even have to store the lengths if you don’t want to. Instead, put a 0 byte in memory at the end of each argument.

    The article at http://www.arl.wustl.edu/~lockwood/class/cs306/books/artofasm/Chapter_13/CH13-9.html has a very good example of parsing the command line.

    In the 16-bit edition of the online book Art of Assembly language, there’s a section in Chapter 13 about parsing the command line. The book is available in several places on the Web. One good link (as of 05/04/2016) is http://www.plantation-productions.com/Webster/www.artofasm.com/DOS/ch13/CH13-9.html#HEADING9-1.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm making a simple page using Google Maps API 3. My first. One marker
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I am writing an app with both english and french support. The app requests

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.