guys wondering how come the code doesnt work..
im using tasm as u might know..im checking on things work and want to see what its output be..thanks hope you can help me with this one. i tried converting it tasm but say argument needs to be override.
.model small
.stack 100h
.data
; string has '$' in the end:
string1 db 'hello world!', 0Dh,0Ah, '$'
; 'abcdefghijklmnopqrstvuwxyz'
table1 db 97 dup (' '), 'klmnxyzabcopqrstvuwdefghij'
table2 db 97 dup (' '), 'hijtuvwxyzabcdklmnoprqsefg'
.code
start:
; encrypt:
lea bx, table1
lea si, string1
call parse
; show result:
lea dx, string1
; output of a string at ds:dx
mov ah, 9
int 21h
; decrypt:
lea bx, table2
lea si, string1
call parse
; show result:
lea dx, string1
; output of a string at ds:dx
mov ah, 09
int 21h
ret ; exit to operating system.
; subroutine to encrypt/decrypt
; parameters:
; si - address of string to encrypt
; bx - table to use.
parse proc near
next_char:
cmp [si], '$'
je end_of_string
mov al, [si]
cmp al, 'a'
jb skip
cmp al, 'z'
ja skip
; xlat algorithm: al = ds:[bx + unsigned al]
xlatb ; encrypt using table2.
mov [si], al
skip:
inc si
jmp next_char
end_of_string:
ret
parse endp
end start