Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- org 0x100
- push 12345
- call num_to_str
- ; Вывод полученной строки
- while:
- pop ax
- cmp al, 0
- jz while_end
- mov ah, 0xE
- int 0x10
- jmp while
- while_end:
- ; Символ следущей строки, не обязательно, Dos
- ; автоматически переводит курсор на новую строку
- mov ax, 0xE00A
- int 0x10
- ret
- num_to_str:
- mov [num_to_str_register_storage + 2], bp
- mov bp, sp
- mov [num_to_str_register_storage + 4], ax
- mov [num_to_str_register_storage + 6], cx
- mov [num_to_str_register_storage + 8], dx
- mov ax, [bp]
- mov [num_to_str_register_storage], ax
- mov ax, [bp + 2]
- add sp, 4
- push 0
- mov cx, 10
- num_to_str_while:
- mov dx, 0
- div cx
- add dl, '0'
- push dx
- cmp ax, 0
- jnz num_to_str_while
- push word[num_to_str_register_storage]
- mov bp, [num_to_str_register_storage + 2]
- mov ax, [num_to_str_register_storage + 4]
- mov cx, [num_to_str_register_storage + 6]
- mov dx, [num_to_str_register_storage + 8]
- ret
- num_to_str_register_storage resw 5
Add Comment
Please, Sign In to add comment