Hello, the target is intel i7 cpu core, and here the sample of asm code make by gcc:
LVL3:
fmul dword [_rotation_z]
LVL4:
fsincos
LVL5:
fld st(4)
LVL6:
fxch st(1) al
LVL7:
fst dword [esp+4]
fmulp st(1), st
fmul dword [esp+24]
fld st(4)
fmul st, st(2)
fmul dword [esp+28]
fsubp st(1), st
I think i found the problem for crash, the roll block work, because i don't store value (z) in RAM, whereas other block (pitch and yaw) i stock with
movd [_x], xmm0
movd [_y], xmm4
Yes, PhysBasePtr is a pointer to first pixel in top right, calculate by first function, honnestly i don't know how this mapping is doing and GPU access to this buffer:
; Return VBE Mode Information
mov ax, 0x4F01
mov cx, 0x115 ; Mode number
mov di, ModeInfoBlock ; Pointer to ModeInfoBlock structure. Scroll up for read all structure
int 0x10
; Set VBE Mode
mov ax, 0x4F02
mov bx, 0_1_0_0_0_0_0_1_0_0_0_1_0_1_0_1b
; | | | | | | | `-`-`-`-`-`-`-`-`----- Mode number: 0x115 = 800 * 600
; | | | | | `-`---------------------- Reserved (must be 0)
; | | | | `------------------------- 0 = Use current default refresh rate, 1 = Use user specified CRTC values for refresh rate
; | | `-`-------------------------- Reserved for VBE/AF (must be 0)
; | `----------------------------- 0 = Use windowed frame buffer model, 1 = Use linear/flat frame buffer model
; `------------------------------ 0 = Clear display memory, 1 = Don't clear display memory
mov di, CRTCInfoBlock
int 0x10
else i have wrote this algorithm for found LFB pointer without call this function:
; Algo: LFB = 0x40000000+((RAM_SIZE_Go-1)*0x40000000)
;
; If RAM == 1 Go { LFB = 0x040000000 }
; + 0x40000000
; If RAM == 2 Go { LFB = 0x080000000 }
; + 0x40000000
; If RAM == 3 Go { LFB = 0x0C0000000 }
; + 0x40000000
; If RAM == 4 Go { LFB = 0x100000000 }
; + 0x40000000
; RAM == 5 Go { LFB = 0x140000000 }
This pointer is only availbe in vesa mode is, for SDL i don't know how is managed, but the algorithm it's the same, work with a pointer:
SDL_Surface *screen;
screen = SDL_SetVideoMode( LENGTH, WIDTH, 32, SDL_HWSURFACE );
int *ptr_pixel = screen->pixels;
*(ptr_pixel) = 0xFF0000FF; //blue