I need to produce a program which does the following:
Prints out a menu the asks for user input A-D (which works OK). You can see from the msg variables below what each option does.
I need to produce code which will take a string from the keyboard and store it into memory. It then needs to be displayed on command. rot13 I have the code for - I just need to know where to paste it in.
.intel_syntax noprefix
.global _main
.extern _exit
.extern _getchar
.extern _putchar
.data
msg1: .string "Mark Shercliff - 06032206 - Coursework - SY1S02"
msg2: .string "Option A - enter string into buffer"
msg3: .string "Option B - display string on screen"
msg4: .string "Option C - encode/decode string using rot13 algorithm"
msg5: .string "Option D - exit program"
input1: .string "Enter option A-D> "
input2: .string "Enter a string> "
option1: .rept 80
.byte 0
.endr
string1: .rept 80
.byte
.endr
.text
_main:
call menu
call getstring1
mov eax, 0
call _exit
menu:
call newline
lea ebx, msg1
call write
call newline
call newline
lea ebx, msg2
call write
call newline
lea ebx, msg3
call write
call newline
lea ebx, msg4
call write
call newline
lea ebx, msg5
call write
call newline
call newline
ret
write:
mov al, [ebx]
wh2:
cmp al, 0
je whe2
whd2:
push ebx
push eax
call _putchar
add esp, 4
pop ebx
inc ebx
mov al, [ebx]
jmp wh2
whe2:
ret
newline:
mov al, 10
push eax
call _putchar
add esp, 4
ret
getstring1:
lea ebx, input1
call write
lea ebx, option1
push ebx
call _getchar
pop ebx
ret