Share Pastebin
Guest
Public paste!

Stijn

By: a guest | Jan 8th, 2009 | Syntax: ASM (NASM) | Size: 1.56 KB | Hits: 182 | Expires: Never
Copy text to clipboard
  1. %include "gt.asm"
  2.                 covar
  3. outarea:        db 'De winnende ploeg is '
  4.                 resb 1
  5.                 db ' met '
  6.                 times 5 db ' '
  7.                 db ' punten.' , 0Dh , 0Ah
  8. inarea:         times 0 resb 37
  9. naam:           resb 25
  10. ploeg:          resb 1
  11. spaties:        resb 4
  12. score:          resb 5
  13. enter_:         resb 2
  14. totaal_a:       dd 0
  15. totaal_b:       dd 0
  16. h_score:        resd 1
  17.                 inleiding
  18.                        
  19.                 openin
  20.                 openuit
  21.                 cld
  22.                        
  23. lezen:          mov edi , inarea
  24.                 mov ecx , 37
  25.                 lees
  26.                 cmp eax , 0
  27.                 je eof
  28.                 mov esi , score
  29.                 mov ecx , 5
  30.                 tekstbin
  31.                 mov [h_score] , eax
  32.                 uit [h_score]
  33.                 mov esi , ploeg
  34.                 lodsb
  35.                 cmp al , 'A'
  36.                 jne ploeg_b
  37.                 mov eax , [h_score]
  38.                 add eax , [totaal_a]
  39.                 mov [totaal_a] , eax
  40.                 jmp near lezen
  41. ploeg_b:        mov eax , [h_score]
  42.                 add eax , [totaal_b]
  43.                 mov [totaal_b] , eax
  44.                 jmp near lezen
  45.                        
  46. eof:            mov edi , outarea + 21
  47.                 mov ebx , [totaal_a]
  48.                 mov edx , [totaal_b]
  49.                 cmp ebx , edx
  50.                 jl win_b
  51.                 je win_x
  52.                 mov al , 'A'
  53.                 stosb
  54.                 push ebx
  55.                 mov edi , outarea + 31
  56.                 push edi
  57.                 call dechex
  58.                 jmp near einde
  59. win_b:          mov al , 'B'
  60.                 stosb
  61.                 push edx
  62.                 mov edi , outarea + 31
  63.                 push edi
  64.                 call dechex
  65.                 jmp near einde
  66. win_x:          mov al , 'X'
  67.                 stosb
  68.                 push edx
  69.                 mov edi , outarea + 31
  70.                 push edi
  71.                 call dechex
  72.                 jmp near einde
  73.                        
  74. dechex:         mov ebp , esp
  75.                 push ebx
  76.                 push eax
  77.                 push edx
  78.                 push edi
  79.                 mov ebx , 10
  80.                 mov edi , [ebp + 4]
  81.                 mov eax , [ebp + 8]
  82.                 std
  83. _dechex_:       mov edx , 0
  84.                 idiv ebx
  85.                 or dl , 30h
  86.                 xchg al , dl
  87.                 stosb
  88.                 xchg al , dl
  89.                 cmp eax , 0
  90.                 jne _dechex_
  91.                 cld
  92.                 pop edi
  93.                 pop edx
  94.                 pop eax
  95.                 pop ebx
  96.                 ret 8
  97.                        
  98. einde:          mov esi , outarea
  99.                 mov ecx , 42
  100.                 schrijf
  101.                 slot