Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

; Part d) Sort updated VUID in ascending order

mov esi, temp_array ; Load address of temp_array

mov edi, updated_vuid ; Load address of updated_vuid

call sort_array

; Exit the program

mov eax, 1 ; Syscall number for exit

xor ebx, ebx ; Exit code 0

int 80h ; Invoke syscall

; Function to extract numeric digits from VUID

extract_numeric:

xor ecx, ecx ; Clear counter register

.extract_loop:

mov al, byte [esi + ecx] ; Load character from VUID

cmp al, 0 ; Check for null terminator

je .extract_done ; If null terminator, exit loop

cmp al, '0' ; Compare with ASCII '0'

jl .not_numeric ; If less than '0', not a numeric digit

cmp al, '9' ; Compare with ASCII '9'

jg .not_numeric ; If greater than '9', not a numeric digit

sub al, '0' ; Convert ASCII to numeric value

mov [edi + ecx], al ; Store numeric digit in numeric_array

inc ecx ; Increment counter


jmp .extract_loop

.not_numeric:

inc ecx ; Move to next character

jmp .extract_loop

.extract_done:

ret

You might also like