stack_seg segment para stack 'stack' db 100 dup(66h) stack_seg ends
data_seg segment 'data'
data_seg ends
prog_seg segment 'prog' assume cs:prog_seg, ds:data_seg, ss:stack_seg
start: mov ax,data_seg mov ds,ax
mov cx,3 ; vorbelegungen, test ob Sicherung funktioniert mov di, 44 mov ax,123 ; eigentliche Zahl call AX2Char
mov ax,4123 ; eigentliche Zahl call AX2Char
mov ax,65535 ; eigentliche Zahl call AX2Char mov al,0h mov ah,4ch int 21h
sZiffern db ' 00000$'
AX2Char: push ax push bx push cx push dx push di mov cx,cs mov es,cx mov di, offset sZiffern+5 STD ; STD=abwärts CLD=aufwärts mov cx,5 ; Anzahl AX2Char2: mov bx,10 xor dx,dx div bx ; div dx:ax,bx => dx ist rest dx:ax ist ganzahlig mov bx, ax ; zwischenspeichern nur al geht mit stosb mov al,dl add al,030h stosb ; kopiert nur al, inc DI mov ax,bx ; restauration loop AX2Char2 mov ah, 09h ; Ausgabe lea dx, sZiffern int 21h
pop di pop dx pop cx pop bx pop ax ret
prog_seg ends end start
|