Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Printing CPU register values in ASM/C/C++

Printing CPU register values in ASM/C/C++

Scheduled Pinned Locked Moved C / C++ / MFC
questionc++comperformancehelp
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    digitalmythology
    wrote on last edited by
    #1

    First of all, you fellows really need an ASM forum in this place, so I won't have to ask all of my ASM questions in here. I do tie in most of my ASM code into C++ anyway, but its just disorganized to post it this way. I've been a member for over 3 years now and no ASM board? What's up with that? Other than that, it is a wonderfully great site ... Anyway, on to my question. I need to : 1] print out the value in the AX register 2] I prefer to do it using int 10h, service 13h [write string with attributes] 3] I need to be able to use the basic 16 colors 4] I need to be able to print it onto the screen at any row and column that I wish 5] I can only use BIOS interrupts, so that means 10h for video, not 21h, since DOS will not be loaded yet. In summary, I need to display conventional memory size, and that means using int 12h. However the memory size is returned in AX, and I have no idea how to print that. I have googled things to death, and all I can come up with is 100s of sites telling me that it is returned in AX [duh ...] but how in the #$@% do I get to see AX ??!? If I do not get that, then I get a bunch of hoo-hah about that awful NASM and such. Apologies for all the griping, please help ... Any ASM and / or C/C++ programmers feel free to contact me via Y! messenger @ digitalmythology or via e-mail @ digitalmythology@yahoo.com ... Thanks in advance to all ...

    -digitalmythology -dm webmaster@digitalmythologywebdesigns.com http://www.digitalmythologywebdesigns.com

    PJ ArendsP 1 Reply Last reply
    0
    • D digitalmythology

      First of all, you fellows really need an ASM forum in this place, so I won't have to ask all of my ASM questions in here. I do tie in most of my ASM code into C++ anyway, but its just disorganized to post it this way. I've been a member for over 3 years now and no ASM board? What's up with that? Other than that, it is a wonderfully great site ... Anyway, on to my question. I need to : 1] print out the value in the AX register 2] I prefer to do it using int 10h, service 13h [write string with attributes] 3] I need to be able to use the basic 16 colors 4] I need to be able to print it onto the screen at any row and column that I wish 5] I can only use BIOS interrupts, so that means 10h for video, not 21h, since DOS will not be loaded yet. In summary, I need to display conventional memory size, and that means using int 12h. However the memory size is returned in AX, and I have no idea how to print that. I have googled things to death, and all I can come up with is 100s of sites telling me that it is returned in AX [duh ...] but how in the #$@% do I get to see AX ??!? If I do not get that, then I get a bunch of hoo-hah about that awful NASM and such. Apologies for all the griping, please help ... Any ASM and / or C/C++ programmers feel free to contact me via Y! messenger @ digitalmythology or via e-mail @ digitalmythology@yahoo.com ... Thanks in advance to all ...

      -digitalmythology -dm webmaster@digitalmythologywebdesigns.com http://www.digitalmythologywebdesigns.com

      PJ ArendsP Offline
      PJ ArendsP Offline
      PJ Arends
      wrote on last edited by
      #2

      The memory is returned in AX, so why not do a mov to move the memory size from AX to a variable of your choice?

      pusha
      int 12h
      mov ax, My_variable
      popa


      You may be right
      I may be crazy
      -- Billy Joel --

      Within you lies the power for good, use it!!!

      Within you lies the power for good; Use it!

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups