Author Topic: NeHe Tutorial in masm64  (Read 24650 times)

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: NeHe Tutorial in masm64
« Reply #90 on: February 28, 2021, 04:17:08 AM »
soluce write the readfile correctly:
Quote
BOOL ReadFile(
  HANDLE       hFile,
  LPVOID       lpBuffer,
  DWORD        nNumberOfBytesToRead,
  LPDWORD      lpNumberOfBytesRead,
  LPOVERLAPPED lpOverlapped
);
in 64,there only one dword,nNumberOfBytesToRead others are qword
tut45 part of code
   mov   [rsp+20h],rbx
   lea   r9d,szReadWrite
        invoke   ReadFile,hFile,eax,FSize   ;<<<<<<<<<<<<<<<<<<<<<<<<< eax wrong ,not a qword adress

This error don't append with UASM or JWASM >>> compile error "incorrect size"


looking upper:

   push   rsi
   push   rsi
   sub   esp,20h                 ;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> perhaps RSP not ?


it seems there is many local dword here :

Quote
LoadHeightmap proc
local   nX:dword
local   nZ:dword
local   nTri:dword
local   nIndex:dword; Ñîçäàòü ïåðåìåííûå
local   flX:dword
local   flZ:dword
local   buff:dword
local   buff1[256]:byte
local   szReadWrite:QWORD   ;number of bytes actually read or write
local   hFile:dword            ;<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< at least one wrong
local   FSize:dword

   mov   ecx,offset aTerrain
   invoke   CreateFile,,GENERIC_READ,0,0,OPEN_EXISTING,\
        FILE_ATTRIBUTE_ARCHIVE,rbx
   mov   hFile,eax
        invoke   GetFileSize,eax,0
        mov   FSize,eax
   inc   eax            ; Append a 0 char
   invoke   GlobalAlloc,GMEM_ZEROINIT or GMEM_FIXED,eax
   mov   buff,eax
   mov   [rsp+20h],rbx
   lea   r9d,szReadWrite
        invoke   ReadFile,hFile,eax,FSize

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





Fa is a musical note to play with CL

Mikl__

  • Member
  • *****
  • Posts: 1136
Re: NeHe Tutorial in masm64
« Reply #91 on: February 28, 2021, 03:39:36 PM »
Programs run under Win7 and Win10
to be Continued. . .

Mikl__

  • Member
  • *****
  • Posts: 1136
Re: NeHe Tutorial in masm64
« Reply #92 on: February 28, 2021, 03:41:54 PM »
to be Continued. . .

six_L

  • Member
  • **
  • Posts: 229
Re: NeHe Tutorial in masm64
« Reply #93 on: February 28, 2021, 07:59:28 PM »
Hi,Mikl__
the tut_40-12.exe works failed, others is ok.
Code: [Select]
;-------------------------------------------------------
        mov ecx,offset FileName2 ;<==
        xor r8d,r8d
mov [rsp+30h],r8
invoke CreateFile,,GENERIC_READ,,0,OPEN_EXISTING,FILE_FLAG_SEQUENTIAL_SCAN
        mov esi,eax         ;<==
        invoke GetFileSize,eax,0
        mov FSize,eax
inc eax ; Append a 0 char
invoke GlobalAlloc,GMEM_ZEROINIT or GMEM_FIXED,eax
mov texture,eax        ;<==
        mov edi,eax
lea r9d,szReadWrite
        and qword ptr [rsp+20h],0
        invoke ReadFile,esi,eax,FSize
        invoke CloseHandle,esi         ;<==
mov esi,edi
        add esi,[rdi + BITMAPFILEHEADER.bfOffBits]
lea edi,[rdi + sizeof BITMAPFILEHEADER]
mov eax,[rdi + BITMAPINFOHEADER.biWidth]
        mov w,eax
        movzx eax, word ptr [rdi + BITMAPINFOHEADER.biHeight]
        mov h,eax
;--------------------------------------------------------------
mov edx,offset Texture1_Id               ;<==
invoke glGenTextures,1
HANDLE, ADDRESS should be QWORD.
Say you, Say me, Say the codes together for ever.

Mikl__

  • Member
  • *****
  • Posts: 1136
Re: NeHe Tutorial in masm64
« Reply #94 on: March 01, 2021, 12:44:12 AM »
to be Continued. . .

six_L

  • Member
  • **
  • Posts: 229
Re: NeHe Tutorial in masm64
« Reply #95 on: March 01, 2021, 01:10:45 AM »
Hi,Mikl__
Now, the tut_40-12.exe works ok. :thumbsup:
Say you, Say me, Say the codes together for ever.

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: NeHe Tutorial in masm64
« Reply #96 on: March 03, 2021, 02:26:25 AM »

All was good (except one) until this time.
 :skrewy: Courage
Fa is a musical note to play with CL

LiaoMi

  • Member
  • ****
  • Posts: 943
Re: NeHe Tutorial in masm64
« Reply #97 on: March 03, 2021, 05:45:10 AM »

Mikl__

  • Member
  • *****
  • Posts: 1136
Re: NeHe Tutorial in masm64
« Reply #98 on: March 06, 2021, 05:35:37 PM »
Lesson #44: 3D-Lens Flare With Occlusion Testing

Learn how to do lens flares by extending a glCamera class. If you look at a lens flare you will notice that they all share one thing in common. They all seem to move through the center of the screen. With this in mind you could actually just throw out the z coordinate and make your flares all 2D. The only problem with this approach is without a z coordinate how do you find out if the camera is looking at the light source or not? In this tutorial we will be making 3D lens flares so get ready for a little bit of math.

https://nehe.gamedev.net/tutorial/3d_lens_flare_with_occlusion_testing/16007/

Interaction:
  • 'W', 'S', 'A' and 'D' keys ― to change the direction the camera is pointed in
  • '1'/'2' keys ― toggle information on/off
  • 'Z' key ― gives the camera a constant forward velocity
  • 'C' key ― gives the camera a constant backward velocity
  • 'X' key ― stop the camera from moving at all
There are asm-\bmp-\exe-files and cursor in the 44.zip attachment.
« Last Edit: March 06, 2021, 07:57:38 PM by Mikl__ »

Mikl__

  • Member
  • *****
  • Posts: 1136
Re: NeHe Tutorial in masm64
« Reply #99 on: March 07, 2021, 01:11:03 PM »
to be Continued. . .

Mikl__

  • Member
  • *****
  • Posts: 1136
Re: NeHe Tutorial in masm64
« Reply #100 on: March 07, 2021, 01:32:27 PM »
to be Continued. . .

Mikl__

  • Member
  • *****
  • Posts: 1136
Re: NeHe Tutorial in masm64
« Reply #101 on: March 07, 2021, 01:36:58 PM »
to be Continued. . .

Mikl__

  • Member
  • *****
  • Posts: 1136
Re: NeHe Tutorial in masm64
« Reply #102 on: March 07, 2021, 01:41:35 PM »
to be Continued. . .

Mikl__

  • Member
  • *****
  • Posts: 1136
Re: NeHe Tutorial in masm64
« Reply #103 on: March 07, 2021, 01:45:46 PM »
to be Continued. . .

Mikl__

  • Member
  • *****
  • Posts: 1136
Re: NeHe Tutorial in masm64
« Reply #104 on: March 07, 2021, 01:54:53 PM »
to be Continued. . .

P.S. File movie0.avi for Lesson #35 is here