Archive for the ‘resources’ tag
Assembly Display
Assembly Display
Write lines of code in assembly language to display a character ‘B’ at 20th row and?
Um...
You can write directly to the framebuffer, or use terminal codes. I will presume terminal codes. Most terminals repond to ANSI sequences.
To position the cursor to row 20, column 5, you will have to send
ESC [ 20 ; 5 H
(with no spaces).
Assuming Intel assembler (using NASM), running on a Linux (or unix-like) platform, the assembler would look like:
; vim: set ft=asm ts=8 sts=8 sw=8 ai et :
; :asmsyntax=nasm
; tabs 9,17,33,71
;
; PROJECT: POSITION
; FILE: DUMB.ASM
; AUTHOR: FRED WEIGEL
; DATE WRITTEN: OCTOBER 19, 2009
; DATE MODIFIED: OCTOBER 19, 2009
GLOBAL main
EXTERN write,exit
DATA: DB 01BH,'[20;5HB'
main:
MOV EAX,8 ; LENGTH OF DATA
PUSH EAX
MOV EAX,DATA
PUSH EAX
MOV EAX,1
PUSH EAX
CALL write ; WRITE(1,DATA,8)
MOV EAX,0
PUSH EAX
CALL exit ; EXIT(0)
END
To build this:
nasm -f elf -o dumb.o dumb.asm
gcc -o dumb dumb.o
would do. We use gcc to invoke the system linker, to bind in the needed system calls (in this case "write" and "exit"). Note that you could use INT 80H to accomplish this as well, and bypass any run-time library support. However, this technique is beyond this introduction.
Edit: fixed asm to actually display the "B", and illustrate use of LEA instruction.
![]() |
| Powered by phpBay Pro |
LCD DISPLAY NOKIA E66,E66i TROCA, DISSASSEMBLY, assembly PAULO.CRUZZZ@HOTMAIL.COM


US $79.99










