Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; You may customize this and other start-up templates;
- ; The location of this template is c:\emu8086\inc\0_com_template.txt
- org 100h
- inp DB 0Ah DUP (0)
- PRINT
- mov cx, 0Ah
- lea di, inp
- input:
- ;cld useless
- mov ah, 0
- int 16h
- stosb
- loop input
- outp DB 0Ah DUP (0)
- mov cx, 0Ah
- lea di, [outp]
- input2:
- ;cld useless
- mov ah, 0
- int 16h
- stosb
- loop input2
- ;std reverse for sum
- mov cx, 0Ah
- lea si, [inp+0Ah-1h] ;konec
- lea di, [outp+0Ah-1h] ; konec
- mov bl, 0
- jmp sum
- add_1_to_next:
- dec bl
- inc al
- jmp added_1
- overflow:
- sub al, 10h
- inc bl
- jmp afterflow
- small_word:
- sub bl, 20h
- jmp ret3
- f_word_to_hex:
- sub bl, 7h
- cmp bl, 0Fh
- jg small_word
- ret3:
- sub bh, 1
- jz to_ret2
- xor bh, bh
- push bx
- jmp ret1
- to_ret2:
- push bx
- jmp ret2
- sum:
- std
- lodsb
- mov bp, cx
- mov dl, byte [outp-bp-1]
- sub al, 30h
- sub dl, 30h
- cmp al, 9
- jle is_1digit
- push bx
- xor bx, bx
- mov bl, al
- jmp f_word_to_hex
- ret1:
- pop bx
- mov al, bl
- pop bx
- is_1digit:
- cmp dl, 9
- jle is_2digit
- push bx
- xor bx, bx
- mov bl, dl
- mov bh, 1 ;ret2
- jmp f_word_to_hex
- ret2:
- pop bx
- mov dl, bl
- pop bx
- is_2digit:
- add al, dl
- test bl, bl
- jnz add_1_to_next
- added_1:
- cmp al, 0Fh
- jg overflow
- afterflow:
- std
- stosb
- loop sum
- test bl, bl
- printed_first:
- lea si, outp
- mov cx, 0Ah
- jmp output
- isword:
- add al, 57h
- jmp nowgoodword
- first_symbol:
- mov al, 31h
- mov ah, 0x0E
- int 10h
- jmp printed_first
- output:
- cld
- mov ah, 0x0E
- lodsb
- ;mov al, 'a'
- cmp al, 09h
- jg isword
- add al, 30h
- nowgoodword:
- int 10h
- loop output
- jmp $
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement