From the course: Learning Assembly Language

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Calling the printf external function

Calling the printf external function - Python Tutorial

From the course: Learning Assembly Language

Start my 1-month free trial

Calling the printf external function

- [Instructor] It's useful to be able to display outputs, using a format string. This is achieved when programming in C by using the printf function. Let's borrow this function from C and use it in our assembly code. We'll use the basic starter program and put in a message and a format string. Msg db Valhalla. Fmt db The norse gods live in %s, 0Ah,0. And in the main code area, we'll invoke printf. Invoke printf, addr of fmt, addr of msg, 0. That's all we need to code. In the top right panel, we need to add the msvcrt.dll library. Msvcrt.dll. Okay, let's build that. And in our command shell, when we run it, we get a formatted output line.

Contents