Stijn
By: a guest | Jan 8th, 2009 | Syntax:
ASM (NASM) | Size: 1.56 KB | Hits: 182 | Expires: Never
%include "gt.asm"
covar
outarea: db 'De winnende ploeg is '
resb 1
db ' met '
times 5 db ' '
db ' punten.' , 0Dh , 0Ah
inarea: times 0 resb 37
naam: resb 25
ploeg: resb 1
spaties: resb 4
score: resb 5
enter_: resb 2
totaal_a: dd 0
totaal_b: dd 0
h_score: resd 1
inleiding
openin
openuit
cld
lezen: mov edi , inarea
mov ecx , 37
lees
cmp eax , 0
je eof
mov esi , score
mov ecx , 5
tekstbin
mov [h_score] , eax
uit [h_score]
mov esi , ploeg
lodsb
cmp al , 'A'
jne ploeg_b
mov eax , [h_score]
add eax , [totaal_a]
mov [totaal_a] , eax
jmp near lezen
ploeg_b: mov eax , [h_score]
add eax , [totaal_b]
mov [totaal_b] , eax
jmp near lezen
eof: mov edi , outarea + 21
mov ebx , [totaal_a]
mov edx , [totaal_b]
cmp ebx , edx
jl win_b
je win_x
mov al , 'A'
stosb
push ebx
mov edi , outarea + 31
push edi
call dechex
jmp near einde
win_b: mov al , 'B'
stosb
push edx
mov edi , outarea + 31
push edi
call dechex
jmp near einde
win_x: mov al , 'X'
stosb
push edx
mov edi , outarea + 31
push edi
call dechex
jmp near einde
dechex: mov ebp , esp
push ebx
push eax
push edx
push edi
mov ebx , 10
mov edi , [ebp + 4]
mov eax , [ebp + 8]
std
_dechex_: mov edx , 0
idiv ebx
or dl , 30h
xchg al , dl
stosb
xchg al , dl
cmp eax , 0
jne _dechex_
cld
pop edi
pop edx
pop eax
pop ebx
ret 8
einde: mov esi , outarea
mov ecx , 42
schrijf
slot