Jump to content
View in the app

A better way to browse. Learn more.

Tuts 4 You

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Printing int in assembly

Featured Replies

Posted

Hi,

I am new to assembly and want to know how to print integers in assembly on stdout. As printing string is straight forward. But i am not able to find how to put integers on stdout.

I am using as and ld in linux to compile my program and run. I am not using HLA or MASM etc.

Thanks.

I don't program on Linux but I think you're confusing C and assembly.

He's not, stdout is the universal terminology for standard output.

As for dreambig2212; you'll have to print each digit individually by converting them to a printable ascii character. For example, the hexadecimal value of the printable ascii character '1' is 31h. If your dl register contains a digit you'd like to print, adding 30h to it will make it a printable ascii character.

add dl, 30h

To print larger numbers you'll have to write a routine to seperate the integer into printable digits.

  • Author

He's not, stdout is the universal terminology for standard output.

As for dreambig2212; you'll have to print each digit individually by converting them to a printable ascii character. For example, the hexadecimal value of the printable ascii character '1' is 31h. If your dl register contains a digit you'd like to print, adding 30h to it will make it a printable ascii character.

add dl, 30h

To print larger numbers you'll have to write a routine to seperate the integer into printable digits.

Thanks Gushe. You are correct I am asking for the same. I will do as you suggested.

Create an account or sign in to comment

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.