Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; multi-segment executable file template.
- data segment
- ; add your data here!
- pkey db "press any key...$"
- input db "43 67 954 36 -8 56 -30 594 896 48 4 3 5 -96 59 49 345 10 295 48 -94 58 9 -5 65 932 450 98 129 59 39 "
- result dw 50 dup(?)
- finalN dw ?
- N db ?
- ends
- stack segment
- dw 128 dup(0)
- ends
- code segment
- start:
- ; set segment registers:
- mov ax, data
- mov ds, ax
- mov es, ax
- MOV ah, 0 ;ah: n cifre
- ;bl: negato
- ;bh: pos result
- converti PROC
- inizio:
- LODSB
- CMP al, '-'
- JE negato
- CMP al, ' '
- JE spazio
- SUB al, 48
- PUSH ax
- INC ah
- JMP inizio
- negato:
- MOV bl,1
- JMP inizio
- spazio:
- POP dx
- MOV dh, 0
- MOV bh, 1
- ciclo1:
- CMP dh, ah
- JE fineFase
- MUL N,10
- INC dh
- JMP ciclo1
- fineFase:
- converti ENDP
- lea dx, pkey
- mov ah, 9
- int 21h ; output string at ds:dx
- ; wait for any key....
- mov ah, 1
- int 21h
- mov ax, 4c00h ; exit to operating system.
- int 21h
- ends
- end start ; set entry point and stop the assembler.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement