home :: about :: development guides :: irc :: forums :: search :: paste :: links :: contribute :: code dump

-> Click here to learn how to get live help <-

New Paste :: Recent Pastes:: No Line Numbers

string.ASM by Merlin
format PE console
entry start

section '.code' code readable executable


mov ax,    @data
mov ds,    ax
mov es,    ax
mov ah,    9
mov dx, OFFSET Message1
int 21h

mov si, OFFSET String1
mov di, OFFSET String2
mov cx, 18
rep movsb

mov ah, 9
;mov dx, OFFSET Message2
int 21h

mov dx, OFFSET String1
int 21h

mov dx,    OFFSET Message3
int 21h

mov dx, OFFSET String2
int 21h

mov si, OFFSET Diff1
mov di, OFFSET Diff2
mov cx, 39
repz cmpsb
jnz Not_Equal

mov ah,    9
mov dx,    OFFSET Message4
int 21h
jmp Next_Operation

mov ah, 9
mov dx, OFFSET Message5
int 21h

mov di, OFFSET SearchString
mov cx, 36
mov al, 'H'
repne scasb
jnz Not_Found

mov ah, 9
mov dx, OFFSET Message6
int 21h
jmp Lodsb_Example

mov ah, 9
mov dx, OFFSET Message7    
int 21h

mov ah, 9
mov dx, OFFSET NewLine
int 21h

mov cx, 17
mov si, OFFSET Message
xor bh, bh
mov ah, 0Eh

int 10h
loop NextChar

mov ax, 4C00h
int 21h

section '.data' data readable writeable

CR equ 13
LF equ 10

NewLine db CR,LF,0
String1 db 'This is a string!',0
String2 db 18 dup(0)
Diff1 db 'This string is nearly the same as Diff2',0
Diff2 db 'This string is nearly the same as Diff1',0
Equal1 db 'The strings are equal',0
Equal2 db 'The strings are not equal',0
Message db 'This is a message',0
SearchString db '1293ijdkfjiu938uHello983fjkfjsi98934',0

Message1 db 'Using String instructions example program',0
Message2 db CR,LF,'String1 is now: ',0
Message3 db CR,LF,'String2 is now: ',0
Message4 db CR,LF,'Strings are equal!',0
Message5 db CR,LF,'Strings are not equal!',0
Message6 db CR,LF,'Character was found.',0
Message7 db CR,LF,'Character was not found.',0