ASM 105: ASCII (20 pts)

What You Need

Purpose

To practice collecting user input.

Greet in Assembler

Create this "greet.asm" file:
section  .text
global   _start

_start:

    mov  edx, len_prompt
    mov  ecx, prompt
    mov  ebx, 1
    mov  eax, 4     ; 4 = sys_write
    int  0x80

    mov  edx, len_name
    mov  ecx, yourname
    mov  ebx, 1
    mov  eax, 3     ; 4 = sys_read
    int  0x80

    mov  ecx, len_name
    mov  edx, hello
    add  edx, 7
next_char:
    mov  eax, [yourname + ecx]
    mov  ebx, edx + ecx
    dec  eax
    dec  ebx
    mov [ebx], eax
    loop next_char

    mov  edx, len_hello
    mov  ecx, hello
    mov  ebx, 1
    mov  eax, 4     ; 4 = sys_write
    int  0x80

    mov  eax, 1
    int  0x80

section  .data

    hello      db   "Hello,                         ", 10, 13
    len_hello  equ  $ - hello
    prompt     db   "What is your name?", 10, 13
    len_prompt equ  $ - prompt
    yourname   db   "          "
    len_name equ  $ - yourname
Compile and run the progam, as shown below.

ASM 105.1: ASCII (5 pts)

Create a program that accepts a series of two-digit numbers terminated by "00" and builds a string from them, as shown below.

Run your program on this string to see the flag:

8472693270766571327383328487799568737173848300

ASM 105.2: ASCII (15 pts)

Create a program that accepts a series of decimal numbers and builds a string from them, as shown below.

Run your program on this string to see the flag:

84,104,105,115,32,116,105,109,101,32,116,104,101,32,102,108,97,103,32,105,115,32,72,85,78,68,82,69,68,83,46,,

Sources

System calls in the Linux kernel. Part 1.
X86 Assembly/Interfacing with Linux
Linux System Call Table (32-bit)
List of Linux/i386 system calls
Assembly Programming Tutorial


Posted 7-19-2020