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

jj2007

  • Member
  • *****
  • Posts: 11783
  • Assembler is fun ;-)
    • MasmBasic
Re: NeHe Tutorial in masm64
« Reply #135 on: July 11, 2021, 12:15:50 PM »
#30 works like a charm and looks quite impressive, Mikl :thumbsup:

Mikl__

  • Member
  • *****
  • Posts: 1137
Re: NeHe Tutorial in masm64
« Reply #136 on: July 11, 2021, 12:24:42 PM »
I suffered for a long time with 30th lesson on my own until Timo helped to me . Many thanks to Timo!
« Last Edit: July 11, 2021, 02:38:34 PM by Mikl__ »

Biterider

  • Member
  • ****
  • Posts: 782
  • ObjAsm Developer
    • ObjAsm
Re: NeHe Tutorial in masm64
« Reply #137 on: July 11, 2021, 03:04:50 PM »
Very cool
The big effort seems to be worth it  :thumbsup:

Biterider

caballero

  • Member
  • *****
  • Posts: 1698
  • Matrix - Noah
    • abre ojos ensamblador
Re: NeHe Tutorial in masm64
« Reply #138 on: July 11, 2021, 07:02:35 PM »
Hello, Breaking bad Mikl  :biggrin:
The logic of the error is hidden among the most unexpected lines of the program

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: NeHe Tutorial in masm64
« Reply #139 on: July 12, 2021, 12:52:59 AM »
Virus?!

Fa is a musical note to play with CL

jj2007

  • Member
  • *****
  • Posts: 11783
  • Assembler is fun ;-)
    • MasmBasic
Re: NeHe Tutorial in masm64
« Reply #140 on: July 12, 2021, 01:14:39 AM »
Virus?!

See a doctor, Yves, if you have a virus.

Mikl__

  • Member
  • *****
  • Posts: 1137
Re: NeHe Tutorial in masm64
« Reply #141 on: July 12, 2021, 01:23:07 AM »
Quote from: TouEnMasm
Virus?!
Bonjour, TouEnMasm!
Là est ASM-source, si vous pensez que j'ai mis un virus dans le programme, essayez de créer le programme vous-même ...

six_L

  • Member
  • **
  • Posts: 229
Re: NeHe Tutorial in masm64
« Reply #142 on: July 12, 2021, 03:04:12 AM »
Hi,Mikl__
the lesson30 is very very good. :thumbsup: :thumbsup: :thumbsup:
thanks you has done much effective work with opengl.  :eusa_boohoo: :eusa_boohoo: :eusa_boohoo:
Say you, Say me, Say the codes together for ever.

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: NeHe Tutorial in masm64
« Reply #143 on: July 12, 2021, 03:31:42 AM »
Quote
Bonjour, TouEnMasm!
Là est ASM-source, si vous pensez que j'ai mis un virus dans le programme, essayez de créer le programme vous-même ...
be cool I don't think that.
Probable reason "WinMain   proc"    is not standard  and had no ret  , must be a question for AV
Code: [Select]
WinMain proc
local msg:MSG

xor ebx,ebx
        mov edi,offset szClassName
        mov esi,IMAGE_BASE
        mov ecx,offset FileName
invoke LoadCursorFromFile
        push rax ;hIconSm
push rdi ;lpszClassName
push rbx ;lpszMenuName
push COLOR_WINDOWTEXT+1;hbrBackground
push rax ;hCursor
push rax        ;hIcon
push rsi ;hInstance
push rbx        ;cbClsExtra & cbWndExtra
pushaddr WndProc;lpfnWndProc
mov rax,(CS_HREDRAW or CS_VREDRAW or CS_OWNDC)shl 32 \
or (sizeof WNDCLASSEX)
push rax ;cbSize & style
invoke RegisterClassEx,esp ;addr WNDCLASSEX

push rbx
push rsi ;rsi = 400000h
shl esi,9 ;rsi = CW_USEDEFAULT
push rbx
push rbx
push WINDOWHEIGHT
push WINDOWWIDTH
push rsi
push rsi
sub esp,20h
    invoke CreateWindowEx,0,edi,edi,WS_OVERLAPPEDWINDOW or \
WS_CLIPCHILDREN or WS_CLIPSIBLINGS or WS_VISIBLE
;öèêë ñîîáùåíèé
    lea edi,msg
@@: invoke GetMessage,edi,0,0,0
invoke DispatchMessage,edi
jmp @b
WinMain endp
« Last Edit: July 13, 2021, 06:02:05 PM by TouEnMasm »
Fa is a musical note to play with CL

Mikl__

  • Member
  • *****
  • Posts: 1137
Re: NeHe Tutorial in masm64
« Reply #144 on: July 12, 2021, 08:40:36 AM »
Bonjour, TouEnMasm!
For the normal completion of the Windows program, it is enough to process the WM_DESTROY message
Code: [Select]
WndProc proc hWin:QWORD,uMsg:QWORD,wParam:QWORD,lParam:QWORD
        mov hWin,rcx

        cmp edx,WM_CREATE
je      wmCREATE
        cmp edx,WM_SIZE
je      wmSIZE
        cmp edx,WM_PAINT
je      wmPAINT
        cmp edx,WM_DESTROY
je      wmDESTROY     
        cmp edx,WM_KEYDOWN
je      wmKEYDOWN
        cmp edx,WM_TIMER
je      wmTIMER
leave
jmp NtdllDefWindowProc_
wmDESTROY::invoke wglMakeCurrent,0,0
invoke wglDeleteContext,hRC
invoke ReleaseDC,hWin,hDC
invoke KillTimer,hWin,10
invoke RtlExitUserProcess,NULL; <----

Mikl__

  • Member
  • *****
  • Posts: 1137
Re: NeHe Tutorial in masm64
« Reply #145 on: July 13, 2021, 01:50:16 AM »
Lesson #30: Collision Detection. Ultimate gloss

Now, when the program has started working, we will eliminate the discovered disadvantages
« Last Edit: July 13, 2021, 11:17:57 AM by Mikl__ »

TouEnMasm

  • Member
  • *****
  • Posts: 1805
    • EditMasm
Re: NeHe Tutorial in masm64
« Reply #146 on: July 13, 2021, 05:25:22 PM »
 :thumbsup:
The AV don't protest
Fa is a musical note to play with CL

Mikl__

  • Member
  • *****
  • Posts: 1137
Re: NeHe Tutorial in masm64
« Reply #147 on: July 18, 2021, 09:08:41 AM »
Hello, All!
Now I'm dealing with lesson #43 (FreeType fonts in OpenGL). Can anyone help create structures for the 64 bit masm?
  • FT_Face,
  • FT_Library,
  • FT_Bitmap,
  • FT_BitmapGlyph,
  • FT_Glyph

jj2007

  • Member
  • *****
  • Posts: 11783
  • Assembler is fun ;-)
    • MasmBasic
Re: NeHe Tutorial in masm64
« Reply #148 on: July 18, 2021, 09:44:08 AM »
From what I see in FreeType.h, Ft_Face is just a handle; same for FT_Library. But I'm not a C guy...

Mikl__

  • Member
  • *****
  • Posts: 1137
Re: NeHe Tutorial in masm64
« Reply #149 on: July 18, 2021, 10:29:40 AM »
Thank you jj
How to translate this FT_shit into normal masm-structures with real4, real8, qword and dword? Moreover, take into account the specifics of masm64?
Code: [Select]
FT_Int  = signed int
FT_Long = signed long
FT_String*
FT_Bitmap_Size*
FT_CharMap*
FT_Pos = signed long
FT_Generic =
---------------------------------------
typedef struct  FT_BBox_
  {
    FT_Pos  xMin, yMin;
    FT_Pos  xMax, yMax;

  } FT_BBox;
---------------------------------------------------
FT_UShort = unsigned short
FT_Short  = signed short
-------------------------------------------------------
typedef struct  FT_Bitmap_
  {
    unsigned int    rows;
    unsigned int    width;
    int             pitch;
    unsigned char*  buffer;
    unsigned short  num_grays;
    unsigned char   pixel_mode;
    unsigned char   palette_mode;
    void*           palette;

  } FT_Bitmap;
----------------------------------------------------
typedef struct  FT_BitmapGlyphRec_
  {
    FT_GlyphRec  root;
    FT_Int       left;
    FT_Int       top;
    FT_Bitmap    bitmap;

  } FT_BitmapGlyphRec;
-------------------------------------------------------
typedef struct  FT_GlyphRec_
  {
    FT_Library             library;
    const FT_Glyph_Class*  clazz;
    FT_Glyph_Format        format;
    FT_Vector              advance;

  } FT_GlyphRec;
---------------------------------------------------
typedef struct FT_LibraryRec_   *FT_Library
-----------------------------------------------------
typedef struct  FT_Vector_
  {
    FT_Pos  x;
    FT_Pos  y;

  } FT_Vector
------------------------------------------------
typedef struct FT_FaceRec_*  FT_Face
{
    FT_Long           num_faces;
    FT_Long           face_index;

    FT_Long           face_flags;
    FT_Long           style_flags;

    FT_Long           num_glyphs;

    FT_String*        family_name;
    FT_String*        style_name;

    FT_Int            num_fixed_sizes;
    FT_Bitmap_Size*   available_sizes;

    FT_Int            num_charmaps;
    FT_CharMap*       charmaps;

    FT_Generic        generic;

    /*# The following member variables (down to `underline_thickness`) */
    /*# are only relevant to scalable outlines; cf. @FT_Bitmap_Size    */
    /*# for bitmap fonts.                                              */
    FT_BBox           bbox;

    FT_UShort         units_per_EM;
    FT_Short          ascender;
    FT_Short          descender;
    FT_Short          height;

    FT_Short          max_advance_width;
    FT_Short          max_advance_height;

    FT_Short          underline_position;
    FT_Short          underline_thickness;

    FT_GlyphSlot      glyph;
    FT_Size           size;
    FT_CharMap        charmap;

    /*@private begin */

    FT_Driver         driver;
    FT_Memory         memory;
    FT_Stream         stream;

    FT_ListRec        sizes_list;

    FT_Generic        autohint;   /* face-specific auto-hinter data */
    void*             extensions; /* unused                         */

    FT_Face_Internal  internal;

    /*@private end */

  } FT_FaceRec;