Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Can someone help me out?

Name: Anonymous 2009-06-03 15:18

I'm trying to get this game to work, but it wont. Sorry for the sloppy failure code.


.data
message BYTE "X wins!", 0
board SBYTE 'X', 'O', 'X',
            'O', 'O', 'O',
            'X', ' ', ' '
row SBYTE 0
col SBYTE 0
count SBYTE 0
xwins SBYTE 0

.code
main PROC
    call Clrscr
    mov esi, OFFSET board
    ;--------check for ROW wins
    L1:
        mov bl, row                    ;row coord in bl
        L2:    mov cl, col                ;col coord in cl
            mov eax, 0                ;clear eax
            mov al, 3                ;cells per row
            mul bl                    ;times row
            add al, col                ;plus col => offset in bytes
            mov dl, [esi + eax]        ;get char from array
            .if (dl == 'X')            ;if it's an X
                inc count            ;add 1 to the count
            .endif
            inc col                    ;move to next column
            cmp col, 3                ;is it column 4?
            jl L2                    ;if not, go back up
            .if (count == 3)        ;if count is 3
              mov xwins, 1            ;x wins
            .endif
            mov count, 0            ;clear count
            mov col, 0                ;start back at column 0
            inc row                    ;move to next row
            cmp row, 3                ;is it row 4?
            jl L1                    ;if not, do that row

        mov col, 0                    ;reset row and col
        mov row, 0
    L3:
        mov cl, col                    ;col coord in cl
        L4:    mov bl, row                ;row coord in bl
            mov eax, 0               
            mov al, 3               
            mul bl                   
            add al, col               
            mov dl, [esi + eax]       
            .if (dl == 'X')
                inc count
            .endif
            inc row                    ;move to next row
            cmp row, 3                ;is it row 4?
            jl L4                    ;if not, do next row
        .if (count == 3)
            mov xwins, 1
        .endif
        mov count, 0
        mov row, 0                    ;reset for next row
        inc col                        ;move to next col
        cmp col, 3                    ;is it col 4?
        jl L3                        ;if not, do next col
           
    cmp xwins, 0                    ;no wins for X?
    jng    L5                            ;then end it
        mov edx, OFFSET message        ;else print message
        call writestring
        call crlf       
    L5:
           
    exit
main ENDP

xWin PROC

xWin ENDP
END main

Name: Anonymous 2009-06-03 15:20

assembler is not programming.

Name: Anonymous 2009-06-03 15:21

Use a real language

Name: Anonymous 2009-06-03 15:23

I would use C++ or java. But this is Homework.

Name: Anonymous 2009-06-03 15:25

I have not been trolled.

Name: Anonymous 2009-06-03 15:27

INTEL SYNTAX IS PIG DISGUSTING AND CONSIDERED HARMFUL.

Oh, and by the way, your finished program will be SLOW AS FUCK, considering your bad coding style, such as using mov eax, 0 instead of xor eax, eax.

Name: Anonymous 2009-06-03 15:30

>>6
lol

Name: Anonymous 2009-06-03 15:32

>>6
Also, use real assembler instead of this HLA shit. I almost vomitted inside my anus when I saw .if.

Name: Anonymous 2009-06-03 15:40

>>8
I almost vomitted inside my anus
lol

Name: Anonymous 2009-06-03 15:46

bitches don't know bout my .if

Name: Anonymous 2009-06-03 15:48

>>6l  %T,%B,%H,%I

Name: Anonymous 2009-06-03 15:50

>>11
UON.

Name: Anonymous 2009-06-03 15:54

. ..  . . ..  ..  . . ...  .  . . . ... .   ..  . . . ..  . . . . ..  . ..  . . ..  .. . . .  . . .. . .  . . .. . ..  .  ..  ...   . . .

Name: Anonymous 2009-06-03 17:03

.if (dl == 'X')

Name: Anonymous 2009-06-03 17:15

This is some of the worst commenting I've had the displeasure of seeing in my life.

Would not read again. F-.

Name: Anonymous 2009-06-03 17:48

Well as soon as I figure out how to make this works. I can delete this off the face of the earth.

Name: Anonymous 2009-06-03 17:56

>>16
delete this
;-)

Name: Anonymous 2009-06-03 18:05

[quote="Mr. Blobby"]The text Mr. Blobby wrote would go here[/quote]

Name: Anonymous 2009-06-03 18:48

Nobody body knows the answer to your question on Quantum Mechanics..

Name: Anonymous 2009-06-03 21:27

>>17
I chortled.

Name: Anonymous 2010-12-17 1:40

FOLLOW THE NEW GNAA TWITTER AT http://twitter.com/Gary_Niger

Name: Anonymous 2011-01-31 19:49

<-- check em dubz

Don't change these.
Name: Email:
Entire Thread Thread List