1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
org 0x100 ; .com files always start 256 bytes into the segment
;------------------------------------------------------------
%macro printString 1
mov dx, %1
mov ah, 0x09 ;
int 0x21 ; call dos "print string"
%endmacro
;-------------------------------------------------------------
%macro waitTillKeyPressed 0
mov ax, 0x0c00
int 0x21 ; flush buffer; doesn't read standard input (al=0)
mov ah, 0x00
int 0x16 ; BIOS : wait for keyboard input
%endmacro
;-------------------------------------------------------------
section .data
borneInf dw 0x0002
borneSup dw 0x0006
msg_borne_inf db 0x0a,0x0d,"borne inferieure atteinte",'$'
msg_inter db 0x0a,0x0d,"entre 2 bornes",'$'
msg_borne_sup db 0x0a,0x0d,"borne superieure atteinte",'$'
section .text
start:
xor ax, ax ;ax = 0
mov cx, 0x000a ; count
loop:
cmp word [borneInf], ax
jnz suite
printString msg_borne_inf
loop2:
inc ax
suite2:
dec cx
jz fin
cmp word [borneSup], ax
jz suite2
printString msg_inter
jmp loop2
fin:
printString msg_borne_sup
jmp quit
suite:
inc ax
dec cx
jnz loop
quit:
mov ah, 0x4c ; "terminate program" sub-function
int 0x21 ; call dos services |
Partager