I’m trying to find a way to make my code wait for two seconds before proceeding. I’m using nasm for Linux in protected mode, so I can only use int 80h. I found a syscall called “alarm” (27) and another called “pause” (29). However, when I try to use those, the program waits and finishes instead of continuing execution. I’ve
Tag: assembly
How to clear screen on protected mode
I’m using NASM for Linux and I’d like know how, in the protected mode, you can clear the screen. I found a solution using the int10h, but on the protected mode I can only use int80h. Thanks in advance. Answer You can write x1b[2J to the standard output so the terminal get cleared and fix the cursor position using x1b[H,
How to print a number in ARM assembly?
I am trying to print a number that I have stored. I’m not sure if I am close or way off. Any help would be appreciated though. Here is my code: It compiles and runs, but I don’t see anything printed. From what I understand, I need the address of where to start printing in r1, how many bytes in
Calling assembly routines from C source code
I have this simple C source code : and i have this s.asm which defines the function _Sum : now , i compiled the .asm using : and compiled and linked the .c file using : this is the outcome : So what is the problem ? I’m using Ubuntu-Linux Any help would be greatly appreciated , Thanks [SOLVED] :
How can I create a basic NASM Assembly (Linux) calculator to add two integers?
I had a go at it, and tried: Sorry about all the XOR instructions, I just wanted to make sure registers were cleared before I used them for a system call, I’m still learning assembly and not sure about what instructions will render a register empty. When I compile, link and run this I can enter the two integers only
Clear screen in a Linux terminal using assembly?
Is there a way to clear the screen in a terminal window with nasm? By clear the screen, I mean emulate the Ctrl-L hotkey. Remove all text from the window. Answer In Bash: In C: How do I find the string:
How to get a pointer to a specific executable file’s section of a program from within itself? (Maybe with libelf)
I’m on a Linux environment and I need to make a program that retrieves some data that is placed in one of the sections of its executable file. So, how to get a pointer to a section of a program (by its name) from within itself? I know it’s possible to use elf_getdata() passing the index of the section as
How do I get the interrupt vector number on Linux?
When I run “cat /proc/interrupts”, I can get the following: How can I get the interrupt number of “NMI” “LOC” “SPU” “PMI”, etc. Answer On x86 NMIs are always on interrupt vector 2. The number is hard-coded just as common exceptions (division by 0, page fault, etc). You can find this in the CPU documentation from Intel/AMD. If the APIC
What does the GCC error message, “Error: unsupported for `mov'”, mean?
I am just trying to compile some simple example code I typed in from a book, and GCC gives me the above error. Here’s my code: The code is supposed to invoke the syslog() system call to read the last 128 bytes from the kernel printk() ring buffer. Here is some information about my OS and system configuration: uname -a:
What’s the purpose of the UD2 opcode in the Linux kernel?
I have found the following fragment in the Linux kernel (not the corresponding C code though), somewhere during the start up phase. You can clearly see the 0F 0B parts, which stand for the UD2 opcode (IDA refused to disassemble). There are some possible usages for this opcode explained here and here. In this case, however, the opcodes after this