[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1001
  • Last Modified:

write and read a value in COM 1 (0x3F8)

This is a simple program in c to write and read a value from COM 1.The question is how i write this code in asm.
#include <stdio.h>
#define com 0x3f8
main()
{
int valoare;
outp(com,2);
valoare=inp(com);
printf("%d",valoare);
}
0
cipriancomsa
Asked:
cipriancomsa
1 Solution
 
sysiphusCommented:
I suggest a good google on assembler op codes to get the commands needed to read and write to a port. Then it is just a matter of moving data values into registers and calling the command to read and write from the port. The tricky part will be outputing the results for which the easiest thing to do is use BIOS routines to print out a zero delimited string. All this can be found using google.
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now