News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

heeeelllp for a newbie

Started by CHAD, August 27, 2009, 01:58:07 PM

Previous topic - Next topic

CHAD

hello everyone,
I am new to assembler so please have patience. Thanks !!!!!
I have some code that I have Been tweaking. The original code used triangles and I have tried to convert it to quads. All I wanted was a row of squares. The code reads in the floats from world.txt but the output is a mess of lines!!!!!!! HEEEELP PLEASE !!!!!!

dedndave

i like your patterns better than triangles or squares - lol
but, you also have another problem
it continually draws over and over (or something)
after the program appears to be done drawing, my hard drive keeps grinding

CHAD

not funny !!!!!! what hard drive do you have ????  Mine doesnt make any noise.
Does anyone have any idea how I can read in floats from a file and have them in the correct order for quads not triangles. ???????? :(

Astro

#3
EDIT: I can't build it - I'm missing gl.def in \masm32\include

Best regards,
Astro.

CHAD

astro
Ive attached the def file !!!!!!put this in masm.include !!!!!!

CHAD

 :P  actually dedndave it was hilarious  !!!!!!!!!  :P

Astro

I seem to be missing a bunch of includes and libs.

include \masm32\include\gl.def
include \masm32\include\glu.def
includelib \masm32\lib\opengl32.lib
includelib \masm32\lib\glu32.lib
include \masm32\include\WinExtra\winextra.def

Best regards,
Astro.

CHAD

sorry astro !!!!! here it is !!!! :wink

Farabi

Quad to triangle should be easier but triangle to quad, I dont think I can.
You will need to know which face is closest from current face and then make it into one quad.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

CHAD

farabi,
the vertex data in world.txt is in quad format ! I think my program is reading the data in the wrong order. The problem, I think, is in the reading of the line in the world file !!!

ReadALine proc pSource:DWORD, pDest:DWORD               ;eax = nb of significant bytes (0 = nothing)
  LOCAL cpy:BYTE                                        ;ecx = nb of bytes read (should be add to pointer)
    push esi
    push edi
    mov esi, 40000
    mov cpy, 1
    mov eax, pSource
    mov edx, pDest
    xor ecx, ecx
    .WHILE (BYTE PTR [eax+ecx] != 13)
        .IF (BYTE PTR [eax+ecx] == '/')
            mov cpy, 0
            .IF esi == 40000
                mov esi, ecx
            .ENDIF
        .ENDIF
        .IF (cpy)
            mov bl, BYTE PTR [eax+ecx]
            mov BYTE PTR [edx+ecx], bl
        .ENDIF
        inc ecx
    .ENDW
    mov BYTE PTR [edx+ecx], 0
    mov eax, ecx
    inc ecx
    inc ecx
    .IF esi == 0
        xor eax, eax
    .ENDIF
    pop edi
    pop esi
    ret
ReadALine endp

atodw proc ptrString:DWORD
  ;----------------------------------------
  ; Convert decimal string into dword value
  ; return value in eax
  ;----------------------------------------
    xor eax, eax
    mov esi, ptrString
    xor ecx, ecx
    xor edx, edx
    mov al, BYTE PTR [esi]
    inc esi
    .if al == '-'
        mov edx, -1
     mov al, BYTE PTR [esi]
     inc esi
    .endif
    .while al != 0
     sub al, '0'   ; convert to bcd
     lea ecx, [ecx+ecx*4]   ; ecx = ecx * 5
     lea ecx, [eax+ecx*2]   ; ecx = eax + old ecx * 10
     mov al, BYTE PTR [esi]
     inc esi
    .endw
    lea eax, [ecx+edx]   ; move to eax and negate
    xor eax, edx
    ret
atodw endp

atof proc ptrString:DWORD
  ;----------------------------------------
  ;convert a string containing a float to
  ;a simple precision float number returned
  ;in st(0), number of bytes read + 1
  ;returned in eax.
  ;----------------------------------------
  LOCAL sign:BYTE, entiere:DWORD, decimal:DWORD, precision:DWORD, temp:REAL4
    push esi
    push edi
    xor eax, eax
    mov esi, ptrString
    mov al, BYTE PTR [esi]
    cmp al, 0
    je fini0
    mov sign, 0
    .IF al == '+'
        inc esi
    .ELSEIF al == '-'
        mov sign, 1
        inc esi
    .ENDIF
    xor ecx, ecx
    mov al, BYTE PTR [esi]
    .while al != '.'
     sub al, '0'
     lea ecx, [ecx+ecx*4]
     lea ecx, [eax+ecx*2]
     inc esi
     mov al, BYTE PTR [esi]
    .endw
    mov entiere, ecx
    xor ecx, ecx
    mov ebx, 1
    inc esi
    mov al, BYTE PTR [esi]
    .while ((al != ' ')&&(al != 0))
     sub al, '0'
     lea ecx, [ecx+ecx*4]
     lea ecx, [eax+ecx*2]
     inc esi
        imul ebx, 10
     mov al, BYTE PTR [esi]
    .endw
    sub esi, ptrString
    mov eax, esi
    mov decimal, ecx
    mov precision, ebx
    fild decimal
    fild precision
    fdivp st(1), st(0)
    fstp temp
    fild entiere
    fadd temp
    .IF (sign == 1)
        fchs
    .ENDIF
    jmp fini
  fini0:
    xor eax, eax
  fini:
    pop edi
    pop esi
    ret
atof endp

CHAD

 :bg ok Im getting a little closer !!! I changed the count2 parameter to 5 . the number of data items in the world file !!!! Im begining to see quads but its still drawing unwanted lines !!!!

Farabi

Quote from: CHAD on August 31, 2009, 02:15:33 PM
:bg ok Im getting a little closer !!! I changed the count2 parameter to 5 . the number of data items in the world file !!!! Im begining to see quads but its still drawing unwanted lines !!!!

I'll try to use my text parser and see if I can read it right. Im bussy creating game engine right now, I hope I can remember it.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"

Farabi

Here is the file. I can get it working. Make your application based on my code. Every funtion there is free to use and created by me, mentioning my name even it was not neccesary is appreciated.
Those who had universe knowledges can control the world by a micro processor.
http://www.wix.com/farabio/firstpage

"Etos siperi elegi"