All pastes #939920 Raw Edit

Something

public text v1 · immutable
·published 2008-03-12 17:43 UTC
rendered paste body
start_of_program:

mov AH, 0
mov AL, 7
int 16

mov AH, 9
lea DX, Menu0
int 33
lea DX, crlf
int 33
lea DX, Menu1
int 33
lea DX, crlf
int 33
lea DX, Menu2
int 33
lea DX, crlf
int 33
lea DX, Menu3
int 33
lea DX, crlf
int 33
lea DX, Menu4
int 33
lea DX, crlf
int 33
lea DX, Menu5
int 33
lea DX, crlf
int 33
lea DX, Menu6
int 33
lea DX, crlf
int 33
lea DX, crlf
int 33
lea DX, Menu7
int 33
lea DX, crlf
int 33

mov AH, 63
mov CX, 1
lea DX, choice
mov BX, 0
int 33

cmp choice, '1'
	je read_string
cmp choice, '2'
	je print_string
cmp choice, '3'
	je reverse_string
cmp choice, '4'
	jmp start_of_program
cmp choice, '5'
	jmp start_of_program
cmp choice, '6'
	jmp start_of_program
cmp choice, '9'
	jmp start_of_program

hlt

read_string:

	mov AH, 0
	mov AL, 7
	int 16

	mov AH, 9
	lea DX, string0
	int 33
	lea DX, crlf
	int 33

	mov AH, 63
	mov BX, 0
	mov CX, 25
	lea dx, entered_str
	int 33

	sub AX, 2
	mov str_length, AX

	cmp str_length, 25
		ja error_mes

	jmp start_of_program

error_mes:

	mov AH, 9
	lea DX, crlf
	int 33
	lea DX, string1
	int 33

	jmp read_string

print_string:

	mov AH, 0
	mov AL, 7
	int 16

	mov AH, 9
	lea DX, string2
	int 33
	lea DX, crlf
	int 33
	lea DX, crlf
	int 33
	
	mov AH, 64
	mov BX, 1
	mov CX, str_length
	lea dx, entered_str
	int 33

	jmp start_of_program

Reverse_string:

	mov AH, 0
	mov AL, 7
	int 16

	mov AH, 9
	lea DX, string3
	int 33
	lea DX, crlf
	int 33
	lea DX, crlf
	int 33

	mov CX, 0
	lea SI, entered_str
	lea DI, copy_str
	add DI, str_length
	sub DI, 1
	loop:

	mov DL, [SI]
	mov [DI], DL
	inc SI
	dec DI
	inc CX
	cmp CX, str_length
	jb loop 

	mov CX, str_length
	mov AH, 64
	mov BX, 1
	lea DX, copy_str
	int 33
	mov AH, 9
	lea DX, crlf
	int 33
	lea DX, crlf
	int 33

jmp start_of_program 


Menu0 DB '[1] Enter String$'
Menu1 DB '[2] Display String$'
Menu2 DB '[3] Reverse String$'
Menu3 DB '[4] Display String without Vowels and Spaces$'
Menu4 DB '[5] Display String in Upper Case$'
Menu5 DB '[6] Caesar Cipher$' 
Menu6 DB '[9] Quite$'
Menu7 DB 'Please Choose an Option$'
choice DB '0'
str_length DW 0
string0 DB 'Please enter String, Max 25 characters in length$'
string1 DB 'Too many character have been entered, Please do it again$'
string2 DB 'Your String is:$'
string3 DB 'Your String Reversed is:$'
entered_str DB '123456789012345678901234567890'
copy_str DB '123456789012345678901234567890'
crlf DB 13, 10, 36