daily pastebin goal
5%
SHARE
TWEET

Untitled

seberm Jan 18th, 2012 31 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bits 16
  2. segment data
  3.  
  4. s dw -15 ; short s = -15
  5. us dw 25 ; unsigned short us = 25
  6. c db -8 ; char c = -8
  7. uc db 0; unsigned char uc = 0
  8.  
  9. segment code
  10. ..start:
  11.  
  12.     mov ax,[s]  ; ax = s
  13.     cmp ax,0   ; porovnam
  14.    
  15.     jl else_s
  16.     neg ax    ; s = -s
  17.     jmp konec_podm_s
  18. else_s:
  19.     imul word 15  ; ax = ax * 15
  20. konec_podm_s:
  21.    
  22.     ; zavolame fci pro vypis cisla
  23.     push ax ; jeji parametr bude mit hodnotu ax
  24.     call far printNumber ; zavolame fci
  25.     ; v ax bude stale stejna hodnota
  26.  
  27.     mov dx,[us]   ; dx = us
  28. zacatek_cyklu:
  29.     cmp dx,10
  30.     ja konec_while
  31.        sub dx,2
  32.        imul word 4   ; ax = ax * 4
  33.     jmp zacatek_cyklu
  34. konec_while:
  35.  
  36.     mov bl,[c]    ; bx = c
  37. zacatek_do_while:
  38.     add bl,4    ; bx = bx + 4
  39.     add dx,ax   ; dx = dx + ax
  40.     cmp bl,0
  41.     jbe zacatek_do_while
  42.  
  43.  
  44.     mov cl,129
  45. zacatek_for: ; budu opakovat dokud cx == 0
  46.    
  47.     sub ax,[uc]; s = s - uc
  48.     loop zacatek_for
  49.    
  50.     mov bl,'r'  ; c(bl) = 'r'
  51.  
  52. zacatek_switch:
  53.     case_H:
  54.         cmp bl,'H'
  55.         jne case_65
  56.         mov bl,10
  57.         jmp konec_switch ; == break
  58.  
  59.     case_65:
  60.         cmp bl,65
  61.         jne case_default
  62.         mov bl,'a'  ; bl(c) = 'a'
  63.         jmp konec_switch
  64.  
  65.     case_default:
  66.         mov bl,0
  67. konec_switch:
  68.  
  69. epilogue
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top