SHOW:
|
|
- or go back to the newest paste.
| 1 | ; multi-segment executable file template. | |
| 2 | ||
| 3 | data segment | |
| 4 | ; add your data here! | |
| 5 | pkey db "press any key...$" | |
| 6 | arr1 DB 36dup (?) | |
| 7 | arr2 DB 36dup (?) | |
| 8 | ends | |
| 9 | ||
| 10 | stack segment | |
| 11 | dw 128 dup(0) | |
| 12 | ends | |
| 13 | ||
| 14 | code segment | |
| 15 | start: | |
| 16 | ; set segment registers: | |
| 17 | mov ax, data | |
| 18 | mov ds, ax | |
| 19 | mov es, ax | |
| 20 | ||
| 21 | mov si,0 | |
| 22 | mov bx,0 | |
| 23 | mov cx,36 | |
| 24 | ||
| 25 | first: | |
| 26 | mov ax,arr1[bx] | |
| 27 | - | jmp before check: |
| 27 | + | jmp before_check: |
| 28 | a1: | |
| 29 | mov arr2[si],ax | |
| 30 | inc si | |
| 31 | inc bx | |
| 32 | ||
| 33 | loop first | |
| 34 | jmp finish | |
| 35 | ||
| 36 | - | before check: |
| 36 | + | before_check: |
| 37 | mov di,0 | |
| 38 | check: | |
| 39 | mov dx,arr2[di] | |
| 40 | cmp ax,dx | |
| 41 | jz a2 | |
| 42 | inc di | |
| 43 | cmp di,36 | |
| 44 | jz a1 | |
| 45 | jmp check | |
| 46 | ||
| 47 | a2: | |
| 48 | inc bx | |
| 49 | jmp first | |
| 50 | ||
| 51 | finish: nop | |
| 52 | ||
| 53 | lea dx, pkey | |
| 54 | mov ah, 9 | |
| 55 | int 21h ; output string at ds:dx | |
| 56 | ||
| 57 | ; wait for any key.... | |
| 58 | mov ah, 1 | |
| 59 | int 21h | |
| 60 | ||
| 61 | mov ax, 4c00h ; exit to operating system. | |
| 62 | int 21h | |
| 63 | ends | |
| 64 | ||
| 65 | end start ; set entry point and stop the assembler. |