Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; Jugurtha Hadjar & Raouf Moualdi
- ; Vérification de nombres dans une table dans la RAM
- ; et mise à zéro des éléments négatifs
- ; TP 7 - Partie 3
- ; Compilateur A86 & Utilisation de Debug
- DATA_SEG SEGMENT
- org 2000h
- TABLE dw 0FFh,0FAh,0A0h,0AAh,0EEh,067h,089h,0DEh,0DDh,0CFh,000h,0EFh,044h,011h,00Ch,099h
- NBR_ELEMENTS equ 16 ; Number of elements to check.
- DATA_SEG ENDS
- assume DS:DATA_SEG, CS:CODE
- CODE SEGMENT
- org 4000h
- main:
- mov ax, DATA_SEG ; Initialize Data Segment
- mov ds, ax
- mov si, offset TABLE
- mov cx, NBR_ELEMENTS ; Initialize the counter, CX
- ;
- lookup_loop:
- mov ah , byte ptr[SI]
- rol ax , 1
- jnc landing_zone ; If the number is positive, skip the call
- ; to the zeroing procedure.
- call replace_negative_element
- landing_zone:
- add si, 2 ; Go to the next Word (two bytes) in the table
- loop lookup_loop
- jmp exit ; Go to program exit
- replace_negative_element proc near ; Procedure replacing the negative element by 0.
- mov byte ptr [SI], 00h
- ret
- replace_negative_element endp
- exit:
- mov ah, 4Ch ; Exit routine
- int 21h
- end main
- code ends
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement