.model small
.stack 100h
.data
regs BYTE PTR 3 DUP(?) ; Array to store 3 register values (adjust size as needed)
.code
main PROC
; Load register values explicitly
mov al, 7 ; Your register number (069) - Lower order byte
mov ah, 0 ; Your register number (069) - Higher order byte (assuming single byte)
mov [regs], al ; Store lower byte in regs[0]
mov al, 27 ; Friend's register number (027)
mov [regs+1], al ; Store in regs[1]
mov al, 7 ; Other friend's register number (007)
mov [regs+2], al ; Store in regs[2]
; Find the smallest register value (optional)
; You can uncomment this section and modify it if needed
; ... (refer to previous explanation for the logic)
; Move register values to memory in ascending order
mov di, OFFSET memory_start ; Base address for memory locations
mov cl, 3 ; Loop counter (adjust as needed)
loop_move:
mov bl, [regs+si] ; Get the smallest value (or next in order)
; Assuming memory starts at the specified address
mov [di], bl ; Move the value to memory at di
inc di ; Move to the next memory location
inc si ; Move to the next register value (already sorted)
dec cl ; Decrement loop counter
cmp cl, 0 ; Check if all elements are moved
jne loop_move ; If not, continue looping
; (Optional) Print the sorted register values (replace with your output method)
; ...
exit:
mov ax, 4C00h ; Exit code for DOS programs
int 21h ; Terminate program
main ENDP
END main
|