Advertisement
Yashtaz

Zamiana Liter ASM

Dec 1st, 2020
1,599
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. format MZ
  2. entry text:main
  3. stack stk:256
  4.  
  5. segment stk use16                    ;stack
  6.         db 256 dup(?)
  7.  
  8. segment data_16 use16
  9.         example:                      ;data
  10.                 db 'TOMek',24h,'$'
  11.  
  12.         db 0dh,0ah,'$'
  13.  
  14. segment text use16
  15. main:
  16.         mov     ax,data_16
  17.         mov     ds,ax
  18.         mov     ax,stk
  19.         mov     ss,ax
  20.         mov     sp,256
  21.         mov     si,example
  22.  
  23.         mov     cl,5    ;Okreslenie ilosci liter
  24.         mov     dh,5Ah
  25.         mov     ch,25   ;25 liter w alfabecie
  26.  
  27.         jmp     change
  28.  
  29. savestate: mov byte[ds:si], AL  ;Zapisanie wartosci do pamieci
  30.            inc si
  31.            dec cl
  32.            jnz change
  33.            jmp finish
  34.  
  35. change: mov AL,byte[ds:si]
  36.  
  37.         decide:                 ;Rozpoznanie wielkosci litery
  38.         cmp     al,dh
  39.         jle     lower
  40.         dec     ch
  41.         jnz     decide
  42.         jmp     higher
  43.  
  44.         lower:                 ;Dodanie 20h powodujace zmiane wielkosci
  45.         mov     dh,5Ah
  46.         mov     ch,25
  47.         add     al,20h
  48.         jmp     savestate
  49.  
  50.         higher:                ;Odjecie 20h
  51.         mov     dh,5Ah
  52.         mov     ch,25
  53.         sub     al,20h
  54.         jmp     savestate
  55.  
  56.  
  57. finish:
  58.  
  59.        mov bx,0
  60.        mov ah,9
  61.  
  62.        mov dx,example        ;Wyswietlanie
  63.        int 21h
  64.  
  65.        mov ah,1
  66.        int 21h
  67.  
  68.        mov ax,4c00h          ;zakonczenie programu
  69.        int 21h
  70.        ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement