Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .model small      
  2. .data            
  3. wlkMsg  db "Bitte geben sie einen Text mit Maximal 80 zeichen ein",0;
  4. newline db 10,13,0
  5. input db 80 dup(0)
  6. leng dw ?
  7. sortvector db 160 dup(0h)
  8. tempoutput dw 1 dup(0)
  9. include macros.mac
  10. .stack 100h
  11. .code
  12. start:
  13. mov ax,@data
  14. mov ds,ax
  15. writeS wlkMsg;
  16. writeS newLine;;
  17. readS input,80,leng     ;Destination-Var,Max-Length, Real-Length
  18. lea di,input            ;Offset von eingabe nach di
  19. mov dx,0h
  20. lettercheck:
  21. mov cx,1Ah
  22. mov al,[ds:di]
  23. mov ah,40h
  24. loop26x:
  25. inc ah
  26. cmp al,ah
  27. jz outercheck           ;wenn grossbuchstabe
  28. loop loop26x
  29. inc di                  ;naechster buchstabe
  30. inc dx
  31. cmp dx,leng
  32. jnz lettercheck
  33. jmp continue
  34. outercheck:             ;dann addiere 20h und naechsten buchstaben
  35. add al,20h
  36. mov ds:di,al            ;speichern
  37. inc di                  ;naechster buchstabe
  38. inc dx
  39. cmp dx,leng
  40. jnz lettercheck
  41. continue:
  42.  
  43. writeS input;
  44. lea di,input            ;zugriff mit ds:di wieder moeglich
  45. lea si,sortvector       ;nen loop fehlt
  46. mov dx,leng
  47. mov bh,1h
  48. mov bl,0h
  49. sortstart:
  50. mov al,[ds:di]
  51. cmp [ds:si],bl          ;wenn 0,dann springe zu newentry
  52. jz newentry
  53. ;sonst
  54. cmp [ds:si],al          ;wenn ds:si==ds:si,dann springe zu increasec
  55. jz increasec
  56. ;sonst
  57. add si,2h
  58. jmp sortstart
  59. newentry:
  60. mov ds:si,al
  61. inc si
  62. add [ds:si],bh
  63. lea si,sortvector
  64. inc di
  65. dec dx
  66. cmp dx,0h
  67. jz endofsort
  68. jmp sortstart
  69. increasec:
  70. inc si
  71. add [ds:si],bh
  72. lea si,sortvector
  73. inc di
  74. dec dx
  75. cmp dx,0h
  76. jz endofsort
  77. jmp sortstart
  78. endofsort:
  79.  
  80. ;ausgabe
  81. lea si,sortvector               ;offset neu laden
  82. mov bh,30h
  83. mov bl,0h
  84. output:
  85. inc si
  86. add [ds:si],bh
  87. inc si
  88. cmp [ds:si],bl
  89. loopnz output
  90. writeS newline
  91. writeS sortvector
  92.  
  93. ;fakultaet
  94.  
  95. mov ax,04c00h   ;4Ch (Programmbeendigung)
  96. int 21h
  97. end start
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement