I am trying to learn assembler. I am writing a very simple program that will XOR a 7 digit string with the key 236, but I am first trying to get my feet wet with something simple.
I am trying to first display the prompt: Number (7 digits):, which I am able to do, BUT then I want to accept user input (no clue how) and display the input.
section .text global _start ;must be declared for linker (ld) _start: ;tell linker entry point mov edx,promptNumLen ;prompt length mov ecx,promptNum ;prompt text mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax, 5 mov [cipherText], eax mov edx,1 ; Number length mov ecx,cipherText ; Number to write mov ebx,1 ;file descriptor (stdout) mov eax,4 ;system call number (sys_write) int 0x80 ;call kernel mov eax,1 ;system call number (sys_exit) int 0x80 ;call kernel section .data promptNum db 'Number (7 digits): ',0xa promptNumLen equ $ - promptNum section .bss cipherText resd 1
Since I dont know how to accept user input yet, I wanted to hardcode 5 to cipherText and just display that.
All it does is display
-------------------------
Number (7 digits):
The expected output is
------------------------------
All it does is display:
Number (7 digits):
5
Any tips? (And yes this is homework, but the homework portion is to encrypt the number and then decrypt, which I have already done in C. I just need to convert to assembler)
Thanks,
Rakshasas84


Sign In
Create Account

Back to top









