[AD] inline asm & mingw32 status report |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
can somebody with proper assembly experience please take a look at this code
and fix my errors? i know at least two lines are wrong:
mov %eax, (%edx, %eax, 4):BITMAP.line
and
and %edx:(BITMAP.id), ~BMP_ID_AUTOLOCK \n
this is in between #idef __MINGW32__ and #else
thank you very much ...
-----------------------------------------------------------------------
/* gfx_directx_bank_switch:
* edx = bitmap
* eax = line
*/
void gfx_directx_write_bank(void)
{
#ifdef __MINGW32__
__asm__
("
/* Check whether is is locked already */
test %edx:(BITMAP.id), BMP_ID_LOCKED \n
jnz Locked \n
/* lock the surface once */
pusha \n
push %edx \n /* bitmap */
call gfx_directx_lock \n /* todo: inline manually to avoid this call
*/
pop %edx \n
popa \n
or %edx:(BITMAP.id), BMP_ID_AUTOLOCK \n
Locked: \n
mov %eax, (%edx, %eax, 4):BITMAP.line
");
#else
_asm
{
; Check whether is is locked already
test [edx]BITMAP.id, BMP_ID_LOCKED
jnz Locked
; lock the surface once
pushad
push edx ; bitmap
call gfx_directx_lock ; todo: inline manually to avoid this call
pop edx
popad
or [edx]BITMAP.id, BMP_ID_AUTOLOCK
Locked:
mov eax, [edx + eax * 4]BITMAP.line
}
#endif
}
/* gfx_directx_unbank_switch:
* edx = bmp
*/
void gfx_directx_unwrite_bank(void)
{
#ifdef __MINGW32__
__asm__
("
/* only unlock if bmp was locked with bank_switch */
test %edx:(BITMAP.id), BMP_ID_AUTOLOCK \n
jz NoUnlock \n
/* unlock surface */
pusha \n
push %edx \n
call gfx_directx_unlock \n /* todo: inline manually to avoid this
call */
pop %edx \n
popa \n
and %edx:(BITMAP.id), ~BMP_ID_AUTOLOCK \n
NoUnlock:
");
#else
_asm
{
; only unlock if bmp was locked with bank_switch
test [edx]BITMAP.id, BMP_ID_AUTOLOCK
jz NoUnlock
; unlock surface
pushad
push edx
call gfx_directx_unlock ; todo: inline manually to avoid this call
pop edx
popad
and [edx]BITMAP.id, ~BMP_ID_AUTOLOCK
NoUnlock:
}
#endif
}
-----------------------------------------------------------------------
status report on the mingw32 native port:
-dll version has to wait for the next release of mingw32 so i'm leaving it
as it is for now.
-the staticklink version is almost finished.
-made a little change to the makefile (generated by fixming.bat) to combine
the two versions. :)
Sincerely Henrik Stokseth.
------------------------------------------------------
E-Mail: hstokset@xxxxxxxxxx
Homepage: http://thunder.prohosting.com/~hstokset/
------------------------------------------------------