Created
November 22, 2016 16:32
-
-
Save simonas-dev/67b0bfb4cae31cc2bfea733401218220 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; multi-segment executable file template. | |
data segment | |
a DB 1 | |
b DB 1 | |
c DW 1 | |
x DW 1, 2, 3 | |
count = ($-x)/2 | |
y DW count dup(0AAh) | |
err_msg DB 'Err', 0Dh, 0Ah, '$' | |
data ends | |
stack segment | |
DB 128 dup(0) | |
stack ends | |
code segment | |
start: | |
; set segment registers: | |
mov ax, data | |
mov ds, ax | |
XOR si, si ; clear stuff | |
XOR di, di ; clear stuff | |
c_pr: ; if start is not called run this | |
MOV cx, count | |
JCXZ pab | |
cikl: | |
MOV al, b | |
CBW | |
CMP x[si], ax | |
;JE f2 | |
;JL f3 | |
ger: | |
MOV y[di], al | |
INC si | |
INC si | |
INC di | |
LOOP cikl | |
pab: | |
mov ax, 4c00h ; exit to operating system. | |
int 21h | |
err: | |
LEA dx, err_msg | |
MOV ah, 9 | |
INT 21h | |
XOR al, al | |
JMP ger | |
ends | |
end start ; set entry point and stop the assembler. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment