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

  • SEARCH
  • Home
  • 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 558841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:10:27+00:00 2026-05-13T12:10:27+00:00

Background: I’ve been tasked with writing a data collection program for a Unitech HT630

  • 0

Background: I’ve been tasked with writing a data collection program for a Unitech HT630, which runs a proprietary DOS operating system that can run executables compiled for 16-bit MS DOS, albeit with some restrictions. I’m using the Digital Mars C/C++ compiler, which seems to be working very well.

For some things I can use standard C libraries, but other things like drawing on the screen of the unit require assembly code. The assembly examples given in the device’s documentation are different from how I was taught to use inline assembly code in C/C++. For reference, BYTE in the examples below is of type unsigned char.

Sample of the example code I was given:

#include <dos.h>

/* Set the state of a pixel */
void LCD_setpixel(BYTE x, BYTE y, BYTE status) {
  if(status > 1 || x > 63 || y > 127) {
    /* out of range, return */
    return;
  }
  /* good data, set the pixel */
  union REGS regs;
  regs.h.ah = 0x41;
  regs.h.al = status;
  regs.h.dh = x;
  regs.h.dl = y;
  int86(0x10, &regs, &regs);
}

How I was always taught to use inline assembly:

/* Set the state of a pixel */
void LCD_setpixel(BYTE x, BYTE y, BYTE status) {
  if(status > 1 || x > 63 || y > 127) {
    /* out of range, return */
    return;
  }
  /* good data, set the pixel */
  asm {
    mov AH, 41H
    mov AL, status
    mov DH, x
    mov DL, y
    int 10H
  }
}

Both forms seem to work, I haven’t encountered a problem with either approach as of yet. Is one form considered better than the other for DOS programming? Does the int86 function handle something for me that I am not handling myself in my own assembly code in the second example?

Thank you in advance for any help.

  • 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-13T12:10:28+00:00Added an answer on May 13, 2026 at 12:10 pm

    When you use the int86 function call, that is a C runtime library call which sets up the registers and issues a DOS interrupt function. Both methods are really the same with one exception, when you use inline assembler, the code is actually embedded into the object code when compiled and linked.

    Inline assembly would be considered faster since you do not have the overhead involved in calling the C runtime library to invoke the DOS interrupt for you. The onus is on you to ensure there is enough stack space when using inline assembly, whereas the C Runtime library takes care of allocating stack space when setting up the registers prior to invoking the int86 function.

    The int86 is a way to make it easier to invoke DOS interrupts. This was extremely popular among the old Borland Turbo C suite of compilers and on Microsoft, I am talking about old compilers before Win 3.1 came out.

    Speaking of the interrupt 0x10, which is responsible for the video output, if I remember correctly, at the time, some BIOS’s destroyed the bp register and the workaround was to do this:

    __asm{
       push bp;
    }
    /* set up the registers */
    int86(0x10, &regs, &regs);
    __asm{
       pop bp;
    }
    

    You can find out the extensive BIOS functions on Ralph Brown’s Interrupt List here. Also HelpPC v2.1 may help also, found here.

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

Sidebar

Related Questions

No related questions found

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.