Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .model small
- .data
- wlkMsg db "Bitte geben sie einen Text mit Maximal 80 zeichen ein",0;
- newline db 10,13,0
- input db 80 dup(0)
- leng dw ?
- sortvector db 160 dup(0h)
- tempoutput dw 1 dup(0)
- include macros.mac
- .stack 100h
- .code
- start:
- mov ax,@data
- mov ds,ax
- writeS wlkMsg;
- writeS newLine;;
- readS input,80,leng ;Destination-Var,Max-Length, Real-Length
- lea di,input ;Offset von eingabe nach di
- mov dx,0h
- lettercheck:
- mov cx,1Ah
- mov al,[ds:di]
- mov ah,40h
- loop26x:
- inc ah
- cmp al,ah
- jz outercheck ;wenn grossbuchstabe
- loop loop26x
- inc di ;naechster buchstabe
- inc dx
- cmp dx,leng
- jnz lettercheck
- jmp continue
- outercheck: ;dann addiere 20h und naechsten buchstaben
- add al,20h
- mov ds:di,al ;speichern
- inc di ;naechster buchstabe
- inc dx
- cmp dx,leng
- jnz lettercheck
- continue:
- writeS input;
- lea di,input ;zugriff mit ds:di wieder moeglich
- lea si,sortvector ;nen loop fehlt
- mov dx,leng
- mov bh,1h
- mov bl,0h
- sortstart:
- mov al,[ds:di]
- cmp [ds:si],bl ;wenn 0,dann springe zu newentry
- jz newentry
- ;sonst
- cmp [ds:si],al ;wenn ds:si==ds:si,dann springe zu increasec
- jz increasec
- ;sonst
- add si,2h
- jmp sortstart
- newentry:
- mov ds:si,al
- inc si
- add [ds:si],bh
- lea si,sortvector
- inc di
- dec dx
- cmp dx,0h
- jz endofsort
- jmp sortstart
- increasec:
- inc si
- add [ds:si],bh
- lea si,sortvector
- inc di
- dec dx
- cmp dx,0h
- jz endofsort
- jmp sortstart
- endofsort:
- ;ausgabe
- lea si,sortvector ;offset neu laden
- mov bh,30h
- mov bl,0h
- output:
- inc si
- add [ds:si],bh
- inc si
- cmp [ds:si],bl
- loopnz output
- writeS newline
- writeS sortvector
- ;fakultaet
- mov ax,04c00h ;4Ch (Programmbeendigung)
- int 21h
- end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement