;
; emxaout3.asm
;
        .386
        .model  flat

        .code

        public  main
        extern  puts:proc

main:   lea     ebx, data
        mov     edx, 42
outer:  mov     ecx, 17
inner:  cmp     byte ptr [ebx], 'x'
        jne     error
        inc     ebx
        loop    inner
        cmp     byte ptr [ebx], 'y'
        jne     error
        inc     ebx
        dec     edx
        jnz     outer
;
        mov     ecx, 600
second: cmp     byte ptr [ebx], 'z'
        jne     error
        inc     ebx
        loop    second
        cmp     byte ptr [ebx], 1
        jne     error
        inc     ebx
        cmp     byte ptr [ebx], 87h
        jne     error
        inc     ebx
        cmp     byte ptr [ebx], 0dbh
        jne     error
        inc     ebx
        cmp     byte ptr [ebx], 'a'
        jne     error
        inc     ebx
        cmp     byte ptr [ebx], 'a'
        jne     error
        inc     ebx
        cmp     byte ptr [ebx], 'b'
        jne     error
        inc     ebx
        cmp     byte ptr [ebx], 2
        jne     error
        lea     eax, $ok
        jmp     print

error:  lea     eax, $error
print:  push    eax
        call    puts
        add     esp, 1*4
;
        xor     eax, eax
        ret

        .data

$error  db      "Error!", 00h
$ok     db      "OK.", 00h

data    db      42 dup (17 dup ('x'),'y')
        db      600 dup ('z')
        db      1
        db      1 dup (1 dup (87h), 1 dup (0dbh))
        db      1 dup (2 dup ('a'), 1 dup ('b'))
        db      2

        end
