Remove ASM code from Allegro source.

This commit is contained in:
David Capello 2010-10-17 14:12:18 -03:00
parent 7c3c2bf69e
commit 7d5e78ea94
18 changed files with 0 additions and 1036 deletions

View File

@ -96,7 +96,6 @@ set(ALLEGRO_SRC_C_FILES
)
set(ALLEGRO_SRC_WIN_FILES
src/win/asmlock.s
src/win/dllver.rc
src/win/gdi.c
src/win/wddaccel.c
@ -147,10 +146,8 @@ set(ALLEGRO_SRC_LINUX_FILES
src/linux/lvga.c
src/linux/lvgahelp.c
src/linux/svgalib.c
src/linux/svgalibs.s
src/linux/vtswitch.c
src/misc/vbeaf.c
src/misc/vbeafs.s
src/misc/vgaregs.c
src/misc/vga.c
)
@ -191,8 +188,6 @@ set(ALLEGRO_SRC_X_FILES
src/x/xvtable.c
src/x/xwin.c
src/x/xdga2.c
src/x/xdga2s.s
src/x/xwins.s
src/misc/colconv.c
)

View File

@ -27,28 +27,10 @@
struct BITMAP;
#if (defined ALLEGRO_I386) && (!defined ALLEGRO_NO_ASM)
/* compiled sprite structure */
typedef struct COMPILED_SPRITE
{
short planar; /* set if it's a planar (mode-X) sprite */
short color_depth; /* color depth of the image */
short w, h; /* size of the sprite */
struct {
void *draw; /* routines to draw the image */
int len; /* length of the drawing functions */
} proc[4];
} COMPILED_SPRITE;
#else
/* emulate compiled sprites using RLE on other platforms */
struct RLE_SPRITE;
typedef struct RLE_SPRITE COMPILED_SPRITE;
#endif
AL_FUNC(COMPILED_SPRITE *, get_compiled_sprite, (struct BITMAP *bitmap, int planar));
AL_FUNC(void, destroy_compiled_sprite, (COMPILED_SPRITE *sprite));
AL_FUNC(void, draw_compiled_sprite, (struct BITMAP *bmp, AL_CONST COMPILED_SPRITE *sprite, int x, int y));

View File

@ -22,36 +22,15 @@
#ifndef ALLEGRO_NO_ASM
#if (defined ALLEGRO_GCC) && (defined ALLEGRO_I386)
/* use i386 asm, GCC syntax */
#include "allegro/platform/al386gcc.h"
#elif (defined ALLEGRO_MSVC) && (defined ALLEGRO_I386)
/* use i386 asm, MSVC syntax */
#include "allegro/platform/al386vc.h"
#elif (defined ALLEGRO_WATCOM) && (defined ALLEGRO_I386)
/* use i386 asm, Watcom syntax */
#include "allegro/platform/al386wat.h"
#else
/* asm not supported */
#define ALLEGRO_NO_ASM
#endif
#endif
/* Define ALLEGRO_USE_C for backwards compatibility. It should not be used
* anywhere else in the sources for now.
*/
#ifdef ALLEGRO_NO_ASM
#define ALLEGRO_USE_C
#endif
#ifdef __cplusplus
}

View File

@ -21,7 +21,6 @@
#ifdef ALLEGRO_NO_ASM
/* Empty bank switch routines. Should be used with C calling convention. */
uintptr_t _stub_bank_switch(BITMAP *bmp, int y)
@ -37,16 +36,6 @@ void _stub_bank_switch_end(void)
{
}
#else
/*
* For ASM calling convention:
* Unix version uses bank switch routines from src/i386/imisc.s.
* DOS version uses bank switch routines from -#- or src/c/cmiscs.s.
*/
#endif
/* apply_matrix_f:
@ -61,4 +50,3 @@ void apply_matrix_f(AL_CONST MATRIX_f *m, float x, float y, float z,
*zout = CALC_ROW(2);
#undef CALC_ROW
}

View File

@ -42,11 +42,6 @@ unsigned long _blender_black(unsigned long x, unsigned long y, unsigned long n)
#if (defined ALLEGRO_COLOR24) || (defined ALLEGRO_COLOR32)
#if (defined ALLEGRO_NO_ASM) || (!defined ALLEGRO_I386)
/* i386 asm version is in imisc.s */
/* _blender_trans24:
* 24 bit trans blender function.
*/
@ -69,9 +64,6 @@ unsigned long _blender_trans24(unsigned long x, unsigned long y, unsigned long n
}
#endif /* C version */
/* _blender_alpha24:
* Combines a 32 bit RGBA sprite with a 24 bit RGB destination.

View File

@ -46,12 +46,6 @@ static void svga_save(void);
static void svga_restore(void);
/* static GFX_MODE_LIST *svga_fetch_mode_list(void); */
#ifndef ALLEGRO_NO_ASM
unsigned long _svgalib_read_line_asm(BITMAP *bmp, int line);
unsigned long _svgalib_write_line_asm(BITMAP *bmp, int line);
void _svgalib_unwrite_line_asm(BITMAP *bmp);
#endif
GFX_DRIVER gfx_svgalib =
@ -436,15 +430,9 @@ static BITMAP *do_set_mode(int w, int h, int v_w, int v_h, int color_depth)
&gfx_svgalib, color_depth, bytes_per_line);
if (bmp) {
/* Set bank switching routines. */
#ifndef ALLEGRO_NO_ASM
bmp->read_bank = _svgalib_read_line_asm;
bmp->write_bank = _svgalib_write_line_asm;
bmp->vtable->unwrite_bank = _svgalib_unwrite_line_asm;
#else
bmp->read_bank = _svgalib_read_line;
bmp->write_bank = _svgalib_write_line;
bmp->vtable->unwrite_bank = _svgalib_unwrite_line;
#endif
}
return bmp;

View File

@ -1,67 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* SVGAlib bank switching code. These routines will be called
* with a line number in %eax and a pointer to the bitmap in %edx.
* The bank switcher should select the appropriate bank for the
* line, and replace %eax with a pointer to the start of the line.
*
* By Peter Wang.
*
* See readme.txt for copyright information.
*/
#include "allegro/platform/alunixac.h"
#include "../i386/asmdefs.inc"
.text
#if (!defined ALLEGRO_NO_ASM) && (defined ALLEGRO_LINUX_SVGALIB)
#if (!defined ALLEGRO_WITH_MODULES) || (defined ALLEGRO_MODULE)
FUNC(_svgalib_read_line_asm)
pushl %ecx
pushl %eax
pushl %edx
call GLOBL(_svgalib_read_line)
popl %edx
popl %ecx /* preserve %eax */
popl %ecx
ret
FUNC(_svgalib_write_line_asm)
pushl %ecx
pushl %eax
pushl %edx
call GLOBL(_svgalib_write_line)
popl %edx
popl %ecx /* preserve %eax */
popl %ecx
ret
FUNC(_svgalib_unwrite_line_asm)
pushl %ecx
pushl %eax
pushl %edx
call GLOBL(_svgalib_unwrite_line)
popl %edx
popl %eax
popl %ecx
ret
#endif
#endif

View File

@ -289,54 +289,6 @@ AL_CONST fixed radtofix_r = (fixed)2670177; /* 256/2pi */
#if (defined ALLEGRO_I386) && (!defined ALLEGRO_NO_ASM)
unsigned short _sqrt_table[256] =
{
/* this table is used by the fixsqrt() and fixhypot() routines in imisc.s */
0x2D4, 0x103F, 0x16CD, 0x1BDB, 0x201F, 0x23E3, 0x274B, 0x2A6D,
0x2D57, 0x3015, 0x32AC, 0x3524, 0x377F, 0x39C2, 0x3BEE, 0x3E08,
0x400F, 0x4207, 0x43F0, 0x45CC, 0x479C, 0x4960, 0x4B19, 0x4CC9,
0x4E6F, 0x500C, 0x51A2, 0x532F, 0x54B6, 0x5635, 0x57AE, 0x5921,
0x5A8D, 0x5BF4, 0x5D56, 0x5EB3, 0x600A, 0x615D, 0x62AB, 0x63F5,
0x653B, 0x667D, 0x67BA, 0x68F5, 0x6A2B, 0x6B5E, 0x6C8D, 0x6DBA,
0x6EE3, 0x7009, 0x712C, 0x724C, 0x7369, 0x7484, 0x759C, 0x76B1,
0x77C4, 0x78D4, 0x79E2, 0x7AEE, 0x7BF7, 0x7CFE, 0x7E04, 0x7F07,
0x8007, 0x8106, 0x8203, 0x82FF, 0x83F8, 0x84EF, 0x85E5, 0x86D9,
0x87CB, 0x88BB, 0x89AA, 0x8A97, 0x8B83, 0x8C6D, 0x8D56, 0x8E3D,
0x8F22, 0x9007, 0x90E9, 0x91CB, 0x92AB, 0x938A, 0x9467, 0x9543,
0x961E, 0x96F8, 0x97D0, 0x98A8, 0x997E, 0x9A53, 0x9B26, 0x9BF9,
0x9CCA, 0x9D9B, 0x9E6A, 0x9F39, 0xA006, 0xA0D2, 0xA19D, 0xA268,
0xA331, 0xA3F9, 0xA4C1, 0xA587, 0xA64D, 0xA711, 0xA7D5, 0xA898,
0xA95A, 0xAA1B, 0xAADB, 0xAB9A, 0xAC59, 0xAD16, 0xADD3, 0xAE8F,
0xAF4B, 0xB005, 0xB0BF, 0xB178, 0xB230, 0xB2E8, 0xB39F, 0xB455,
0xB50A, 0xB5BF, 0xB673, 0xB726, 0xB7D9, 0xB88A, 0xB93C, 0xB9EC,
0xBA9C, 0xBB4B, 0xBBFA, 0xBCA8, 0xBD55, 0xBE02, 0xBEAE, 0xBF5A,
0xC005, 0xC0AF, 0xC159, 0xC202, 0xC2AB, 0xC353, 0xC3FA, 0xC4A1,
0xC548, 0xC5ED, 0xC693, 0xC737, 0xC7DC, 0xC87F, 0xC923, 0xC9C5,
0xCA67, 0xCB09, 0xCBAA, 0xCC4B, 0xCCEB, 0xCD8B, 0xCE2A, 0xCEC8,
0xCF67, 0xD004, 0xD0A2, 0xD13F, 0xD1DB, 0xD277, 0xD312, 0xD3AD,
0xD448, 0xD4E2, 0xD57C, 0xD615, 0xD6AE, 0xD746, 0xD7DE, 0xD876,
0xD90D, 0xD9A4, 0xDA3A, 0xDAD0, 0xDB66, 0xDBFB, 0xDC90, 0xDD24,
0xDDB8, 0xDE4C, 0xDEDF, 0xDF72, 0xE004, 0xE096, 0xE128, 0xE1B9,
0xE24A, 0xE2DB, 0xE36B, 0xE3FB, 0xE48B, 0xE51A, 0xE5A9, 0xE637,
0xE6C5, 0xE753, 0xE7E1, 0xE86E, 0xE8FB, 0xE987, 0xEA13, 0xEA9F,
0xEB2B, 0xEBB6, 0xEC41, 0xECCB, 0xED55, 0xEDDF, 0xEE69, 0xEEF2,
0xEF7B, 0xF004, 0xF08C, 0xF114, 0xF19C, 0xF223, 0xF2AB, 0xF332,
0xF3B8, 0xF43E, 0xF4C4, 0xF54A, 0xF5D0, 0xF655, 0xF6DA, 0xF75E,
0xF7E3, 0xF867, 0xF8EA, 0xF96E, 0xF9F1, 0xFA74, 0xFAF7, 0xFB79,
0xFBFB, 0xFC7D, 0xFCFF, 0xFD80, 0xFE02, 0xFE82, 0xFF03, 0xFF83
};
#else /* not i386, so use straight C versions */
/* fixsqrt:
* Fixed point square root routine for non-i386.
*/
@ -360,8 +312,3 @@ fixed fixhypot(fixed x, fixed y)
{
return ftofix(hypot(fixtof(x), fixtof(y)));
}
#endif /* i386 vs. portable C implementations */

View File

@ -26,8 +26,6 @@ extern int *_colorconv_rgb_scale_5x35; /* for conversion from 15/16-bit */
extern unsigned char *_colorconv_rgb_map; /* for conversion from 8/12-bit to 8-bit */
#ifdef ALLEGRO_NO_ASM
#ifdef ALLEGRO_COLOR8
@ -1001,6 +999,4 @@ void _colorcopy_blit_32_to_32(struct GRAPHICS_RECT *src_rect, struct GRAPHICS_RE
}
#endif
#endif

View File

@ -1169,366 +1169,11 @@ static int vbeaf_lowlevel_init(void)
*/
static BITMAP *vbeaf_init(int w, int h, int v_w, int v_h, int color_depth)
{
BITMAP *b;
AF_MODE_INFO mode_info;
int bpp = BYTES_PER_PIXEL(color_depth);
int bytes_per_scanline, width, height;
int scrollable, mode;
int vseg;
int rs, gs, bs;
char tmp1[512];
void *vaddr;
/* Do not continue if this version of Allegro was built in C-only mode.
* The bank switchers assume asm-mode calling conventions, but the
* library would try to call them with C calling conventions.
*/
#ifdef ALLEGRO_NO_ASM
return NULL;
#endif
/* locate and load VBE/AF driver from disk */
if (!vbeaf_locate_driver())
return NULL;
LOCK_VARIABLE(af_driver);
LOCK_VARIABLE(_accel_driver);
LOCK_VARIABLE(_accel_active);
LOCK_VARIABLE(_accel_set_bank);
LOCK_VARIABLE(_accel_idle);
LOCK_VARIABLE(vbeaf_cur_on);
LOCK_VARIABLE(vbeaf_cur_x);
LOCK_VARIABLE(vbeaf_cur_y);
LOCK_FUNCTION(_accel_bank_switch);
LOCK_FUNCTION(_accel_bank_stub);
LOCK_FUNCTION(_af_wrapper);
LOCK_FUNCTION(vbeaf_no_wait);
LOCK_FUNCTION(vbeaf_move_mouse);
LOCK_FUNCTION(vbeaf_draw_sprite);
LOCK_FUNCTION(vbeaf_blit_from_memory);
/* init the currently loaded VBE/AF driver */
if (!vbeaf_lowlevel_init())
return NULL;
/* bodge to work around bugs in the present (6.51) version of UniVBE */
if ((v_w > w) && (!faf_id)) {
vbeaf_exit(NULL);
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("SciTech VBE/AF drivers do not support wide virtual screens"));
return NULL;
}
/* get ourselves a mode number */
mode = find_vbeaf_mode(w, h, v_w, v_h, color_depth, &mode_info);
if (mode == 0) {
vbeaf_exit(NULL);
return NULL;
}
gfx_vbeaf.vid_mem = af_driver->TotalMemory * 1024;
vaddr = NULL;
if (mode_info.Attributes & 8) {
/* linear framebuffer */
gfx_vbeaf.linear = TRUE;
gfx_vbeaf.bank_size = gfx_vbeaf.bank_gran = 0;
gfx_vbeaf.vid_phys_base = af_driver->LinearBasePtr;
bytes_per_scanline = mode_info.LinBytesPerScanLine;
if (faf_farptr) {
vaddr = (void *)faf_farptr->LinearMem.offset;
vseg = faf_farptr->LinearMem.sel;
}
else {
vaddr = af_driver->LinearMem;
vseg = _default_ds();
}
}
else {
/* banked framebuffer */
gfx_vbeaf.linear = FALSE;
gfx_vbeaf.bank_size = 65536;
gfx_vbeaf.bank_gran = af_driver->BankSize * 1024;
gfx_vbeaf.vid_phys_base = af_driver->BankedBasePtr;
bytes_per_scanline = mode_info.BytesPerScanLine;
if (faf_farptr) {
vaddr = (void *)faf_farptr->BankedMem.offset;
vseg = faf_farptr->BankedMem.sel;
}
else {
vaddr = af_driver->BankedMem;
vseg = _default_ds();
}
}
width = MAX(bytes_per_scanline, v_w*bpp);
height = MAX(h, v_h);
_sort_out_virtual_width(&width, &gfx_vbeaf);
if (width * height > gfx_vbeaf.vid_mem) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Insufficient video memory"));
vbeaf_exit(NULL);
return NULL;
}
/* set the mode */
if (set_vbeaf_mode(mode, w, h, width/bpp, height, &width, &scrollable) != 0) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Failed to set VBE/AF mode"));
vbeaf_exit(NULL);
return NULL;
}
in_af_mode = TRUE;
_accel_active = FALSE;
if (scrollable)
height = MAX(height, (int)af_driver->OffscreenEndY+1);
if ((width/bpp < v_w) || (width/bpp < w) || (height < v_h) || (height < h)) {
ustrzcpy(allegro_error, ALLEGRO_ERROR_SIZE, get_config_text("Virtual screen size too large"));
vbeaf_exit(NULL);
return NULL;
}
/* construct the screen bitmap */
b = _make_bitmap(width/bpp, height, (unsigned long)vaddr, &gfx_vbeaf, color_depth, width);
if (!b) {
vbeaf_exit(NULL);
return NULL;
}
b->seg = vseg;
/* set up the /AF driver state */
af_driver->SetActiveBuffer(af_driver, 0);
af_driver->SetVisibleBuffer(af_driver, 0, 0);
if (af_driver->EnableDirectAccess)
af_driver->EnableDirectAccess(af_driver);
if (af_driver->SetClipRect)
af_driver->SetClipRect(af_driver, 0, 0, b->w-1, b->h-1);
_accel_set_bank = af_driver->SetBank;
if (af_driver->EnableDirectAccess)
_accel_idle = af_driver->EnableDirectAccess;
else if (af_driver->WaitTillIdle)
_accel_idle = af_driver->WaitTillIdle;
else
_accel_idle = vbeaf_no_wait;
if (gfx_vbeaf.linear) {
if (_accel_idle == vbeaf_no_wait)
b->write_bank = b->read_bank = _stub_bank_switch;
else
b->write_bank = b->read_bank = _accel_bank_stub;
}
else {
b->write_bank = b->read_bank = _accel_bank_switch;
b->id |= BMP_ID_NOBLIT;
}
vbeaf_xscroll = vbeaf_yscroll = 0;
gfx_vbeaf.w = b->cr = w;
gfx_vbeaf.h = b->cb = h;
/* set up the truecolor pixel format */
#if (defined ALLEGRO_COLOR16) || (defined ALLEGRO_COLOR24) || (defined ALLEGRO_COLOR32)
if (gfx_vbeaf.linear) {
rs = mode_info.LinRedFieldPosition;
gs = mode_info.LinGreenFieldPosition;
bs = mode_info.LinBlueFieldPosition;
}
else {
rs = mode_info.RedFieldPosition;
gs = mode_info.GreenFieldPosition;
bs = mode_info.BlueFieldPosition;
}
switch (color_depth) {
#ifdef ALLEGRO_COLOR16
case 15:
_rgb_r_shift_15 = rs;
_rgb_g_shift_15 = gs;
_rgb_b_shift_15 = bs;
break;
case 16:
_rgb_r_shift_16 = rs;
_rgb_g_shift_16 = gs;
_rgb_b_shift_16 = bs;
break;
#endif
#ifdef ALLEGRO_COLOR24
case 24:
_rgb_r_shift_24 = rs;
_rgb_g_shift_24 = gs;
_rgb_b_shift_24 = bs;
break;
#endif
#ifdef ALLEGRO_COLOR32
case 32:
_rgb_r_shift_32 = rs;
_rgb_g_shift_32 = gs;
_rgb_b_shift_32 = bs;
break;
#endif
}
#endif
orig_vline = _screen_vtable.vline;
orig_hline = _screen_vtable.hline;
orig_line = _screen_vtable.line;
orig_rectfill = _screen_vtable.rectfill;
orig_draw_glyph = _screen_vtable.draw_glyph;
orig_draw_sprite = _screen_vtable.draw_sprite;
orig_masked_blit = _screen_vtable.masked_blit;
/* is triple buffering supported? */
if (mode_info.Attributes & 2048) {
gfx_vbeaf.request_scroll = vbeaf_request_scroll;
gfx_vbeaf.poll_scroll = vbeaf_poll_scroll;
}
else {
gfx_vbeaf.request_scroll = NULL;
gfx_vbeaf.poll_scroll = NULL;
}
/* are hardware cursors supported? */
if ((mode_info.Attributes & 64) && (af_driver->SetCursor)) {
gfx_vbeaf.set_mouse_sprite = vbeaf_set_mouse_sprite;
gfx_vbeaf.show_mouse = vbeaf_show_mouse;
gfx_vbeaf.hide_mouse = vbeaf_hide_mouse;
gfx_vbeaf.move_mouse = vbeaf_move_mouse;
}
else {
gfx_vbeaf.set_mouse_sprite = NULL;
gfx_vbeaf.show_mouse = NULL;
gfx_vbeaf.hide_mouse = NULL;
gfx_vbeaf.move_mouse = NULL;
}
/* accelerated scanline fills? */
if (af_driver->DrawScan)
gfx_capabilities |= (GFX_HW_HLINE | GFX_HW_HLINE_XOR);
if (af_driver->DrawPattScan)
gfx_capabilities |= GFX_HW_HLINE_SOLID_PATTERN;
if (af_driver->DrawColorPattScan)
gfx_capabilities |= GFX_HW_HLINE_COPY_PATTERN;
/* accelerated line drawing? */
if (af_driver->DrawLine)
gfx_capabilities |= (GFX_HW_LINE | GFX_HW_LINE_XOR);
/* accelerated rectangle fills? */
if (af_driver->DrawRect) {
_screen_vtable.clear_to_color = vbeaf_clear_to_color;
gfx_capabilities |= (GFX_HW_FILL | GFX_HW_FILL_XOR);
}
if (af_driver->DrawPattRect)
gfx_capabilities |= GFX_HW_FILL_SOLID_PATTERN;
if (af_driver->DrawColorPattRect)
gfx_capabilities |= GFX_HW_FILL_COPY_PATTERN;
/* accelerated triangle drawing? */
if (af_driver->DrawTrap)
gfx_capabilities |= (GFX_HW_TRIANGLE | GFX_HW_TRIANGLE_XOR);
/* accelerated monochrome text output? */
if (af_driver->PutMonoImage) {
_screen_vtable.draw_glyph = vbeaf_draw_glyph;
gfx_capabilities |= GFX_HW_GLYPH;
}
/* accelerated video memory blits? */
if (af_driver->BitBlt) {
_screen_vtable.blit_to_self = vbeaf_blit_to_self;
_screen_vtable.blit_to_self_forward = vbeaf_blit_to_self;
_screen_vtable.blit_to_self_backward = vbeaf_blit_to_self;
gfx_capabilities |= GFX_HW_VRAM_BLIT;
}
/* accelerated blits from system memory? */
if (af_driver->BitBltSys) {
_screen_vtable.blit_from_memory = vbeaf_blit_from_memory;
_screen_vtable.blit_from_system = vbeaf_blit_from_memory;
gfx_capabilities |= GFX_HW_MEM_BLIT;
}
/* accelerated masked blits? */
if ((af_driver->SrcTransBlt) || (af_driver->SrcTransBltSys)) {
_screen_vtable.masked_blit = vbeaf_masked_blit;
_screen_vtable.draw_sprite = vbeaf_draw_sprite;
if (_screen_vtable.draw_256_sprite == orig_draw_sprite)
_screen_vtable.draw_256_sprite = vbeaf_draw_sprite;
if (af_driver->SrcTransBlt)
gfx_capabilities |= GFX_HW_VRAM_BLIT_MASKED;
if (af_driver->SrcTransBltSys)
gfx_capabilities |= GFX_HW_MEM_BLIT_MASKED;
}
/* set up the VBE/AF description string */
ustrzcpy(vbeaf_desc, sizeof(vbeaf_desc), uconvert_ascii(af_driver->OemVendorName, tmp1));
if (gfx_vbeaf.linear)
ustrzcat(vbeaf_desc, sizeof(vbeaf_desc), uconvert_ascii(", linear", tmp1));
else
ustrzcat(vbeaf_desc, sizeof(vbeaf_desc), uconvert_ascii(", banked", tmp1));
if (faf_ext > 0)
uszprintf(vbeaf_desc+ustrsize(vbeaf_desc), sizeof(vbeaf_desc) - ustrsize(vbeaf_desc),
uconvert_ascii(", FreeBE ex%02d", tmp1), faf_ext);
else if (faf_id)
ustrzcat(vbeaf_desc, sizeof(vbeaf_desc), uconvert_ascii(", FreeBE noex", tmp1));
if (faf_farptr)
ustrzcat(vbeaf_desc, sizeof(vbeaf_desc), uconvert_ascii(", farptr", tmp1));
/* is this an accelerated or dumb framebuffer mode? */
if (mode_info.Attributes & 16) {
gfx_vbeaf.drawing_mode = vbeaf_drawing_mode;
vbeaf_drawing_mode();
ustrzcat(vbeaf_desc, sizeof(vbeaf_desc), uconvert_ascii(", accel", tmp1));
}
else {
gfx_vbeaf.drawing_mode = NULL;
ustrzcat(vbeaf_desc, sizeof(vbeaf_desc), uconvert_ascii(", noaccel", tmp1));
}
gfx_vbeaf.desc = vbeaf_desc;
#ifdef ALLEGRO_LINUX
__al_linux_console_graphics();
b->vtable->acquire = __al_linux_acquire_bitmap;
b->vtable->release = __al_linux_release_bitmap;
#endif
return b;
}

View File

@ -28,10 +28,6 @@
#include "allegro.h"
#include "allegro/internal/aintern.h"
#if defined ALLEGRO_ASMCAPA_HEADER && !defined ALLEGRO_NO_ASM
#include ALLEGRO_ASMCAPA_HEADER
#endif
#ifdef ALLEGRO_MMX
/* for use by iscan.s */

View File

@ -1,307 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* Asm functions for Windows bitmap locking.
*
* By Isaac Cruz.
*
* Improved dirty rectangles mechanism by Eric Botcazou.
*
* See readme.txt for copyright information.
*/
#include "src/i386/asmdefs.inc"
.text
#if !defined(ALLEGRO_NO_ASM)
/* gfx_directx_write_bank:
* edx = bitmap
* eax = line
*/
FUNC (gfx_directx_write_bank)
/* check whether bitmap is already locked */
testl $BMP_ID_LOCKED, BMP_ID(%edx)
jnz Locked
/* lock the surface */
pushl %ecx
pushl %eax
pushl %edx
pushl %edx /* argument */
call *GLOBL(ptr_gfx_directx_autolock)
popl %edx
popl %edx
popl %eax
popl %ecx
Locked:
/* get pointer to the video memory */
movl BMP_LINE(%edx,%eax,4), %eax
ret
/* gfx_directx_unwrite_bank:
* edx = bmp
*/
FUNC (gfx_directx_unwrite_bank)
/* only unlock bitmaps that were autolocked */
testl $BMP_ID_AUTOLOCK, BMP_ID(%edx)
jz No_unlock
/* unlock surface */
pushl %ecx
pushl %eax
pushl %edx
pushl %edx /* argument */
call *GLOBL(ptr_gfx_directx_unlock)
popl %edx
popl %edx
popl %eax
popl %ecx
/* clear the autolock flag */
andl $~BMP_ID_AUTOLOCK, BMP_ID(%edx)
No_unlock:
ret
/* gfx_directx_write_bank_win:
* edx = bitmap
* eax = line
*/
FUNC (gfx_directx_write_bank_win)
pushl %ecx
/* clobber the line */
movl GLOBL(_al_wd_dirty_lines), %ecx
addl BMP_YOFFSET(%edx), %ecx
movb $1, (%ecx,%eax) /* _al_wd_dirty_lines[line] = 1; (line has changed) */
/* check whether bitmap is already locked */
testl $BMP_ID_LOCKED, BMP_ID(%edx)
jnz Locked_win
/* lock the surface */
pushl %eax
pushl %edx
pushl %edx /* argument */
call *GLOBL(ptr_gfx_directx_autolock)
popl %edx
popl %edx
popl %eax
Locked_win:
popl %ecx
/* get pointer to the video memory */
movl BMP_LINE(%edx,%eax,4), %eax
ret
/* gfx_directx_unwrite_bank_win:
* edx = bmp
*/
FUNC (gfx_directx_unwrite_bank_win)
/* only unlock bitmaps that were autolocked */
testl $BMP_ID_AUTOLOCK, BMP_ID(%edx)
jz No_unlock_win
pushl %ecx
pushl %eax
/* unlock surface */
pushl %edx
pushl %edx /* argument */
call *GLOBL(ptr_gfx_directx_unlock)
popl %edx
popl %edx
/* clear the autolock flag */
andl $~BMP_ID_AUTOLOCK, BMP_ID(%edx)
/* update dirty lines: this is safe because autolocking
* is guaranteed to be the only level of locking.
*/
movl GLOBL(gfx_directx_forefront_bitmap), %edx
call update_dirty_lines
popl %eax
popl %ecx
No_unlock_win:
ret
/* gfx_directx_unlock_win:
* arg1 = bmp
*/
FUNC(gfx_directx_unlock_win)
/* unlock surface */
movl 4(%esp), %edx
pushl %edx
pushl %edx /* argument */
call *GLOBL(ptr_gfx_directx_unlock)
popl %edx
popl %edx
/* forefront_bitmap may still be locked in case of nested locking */
movl GLOBL(gfx_directx_forefront_bitmap), %edx
testl $BMP_ID_LOCKED, BMP_ID(%edx)
jnz No_update_win
/* ok, we can safely update */
call update_dirty_lines
No_update_win:
ret
/* update_dirty_lines
* edx = dd_frontbuffer
* clobbers: %eax, %ecx
*/
#define RECT_LEFT (%esp)
#define RECT_TOP 4(%esp)
#define RECT_RIGHT 8(%esp)
#define RECT_BOTTOM 12(%esp)
update_dirty_lines:
pushl %ebx
pushl %esi
pushl %edi
subl $16, %esp /* allocate a RECT structure */
movl $0, RECT_LEFT
movl BMP_W(%edx), %ecx /* ecx = dd_frontbuffer->w */
movl %ecx, RECT_RIGHT
movl GLOBL(_al_wd_dirty_lines), %ebx /* ebx = _al_wd_dirty_lines */
movl BMP_H(%edx), %esi /* esi = dd_frontbuffer->h */
movl $0, %edi
_align_
next_line:
movb (%ebx,%edi), %al /* al = _al_wd_dirty_lines[edi] */
testb %al, %al /* is dirty? */
jz test_end /* no ! */
movl %edi, RECT_TOP
_align_
loop_dirty_lines:
movb $0, (%ebx,%edi) /* _al_wd_dirty_lines[edi] = 0 */
incl %edi
movb (%ebx,%edi), %al /* al = _al_wd_dirty_lines[edi] */
testb %al, %al /* is still dirty? */
jnz loop_dirty_lines /* yes ! */
movl %edi, RECT_BOTTOM
leal RECT_LEFT, %eax
pushl %eax
call *GLOBL(_al_wd_update_window)
popl %eax
_align_
test_end:
incl %edi
cmpl %edi, %esi /* last line? */
jge next_line /* no ! */
addl $16, %esp
popl %edi
popl %esi
popl %ebx
ret
/* gfx_gdi_write_bank:
* edx = bitmap
* eax = line
*/
FUNC (gfx_gdi_write_bank)
pushl %ecx
/* clobber the line */
movl GLOBL(gdi_dirty_lines), %ecx
addl BMP_YOFFSET(%edx), %ecx
movb $1, (%ecx,%eax) /* gdi_dirty_lines[line] = 1; (line has changed) */
/* check whether bitmap is already locked */
testl $BMP_ID_LOCKED, BMP_ID(%edx)
jnz Locked_gdi
/* lock the surface */
pushl %eax
pushl %edx
pushl %edx /* argument */
call *GLOBL(ptr_gfx_gdi_autolock)
popl %edx
popl %edx
popl %eax
Locked_gdi:
popl %ecx
/* get pointer to the video memory */
movl BMP_LINE(%edx,%eax,4), %eax
ret
/* gfx_gdi_unwrite_bank:
* edx = bmp
*/
FUNC (gfx_gdi_unwrite_bank)
/* only unlock bitmaps that were autolocked */
testl $BMP_ID_AUTOLOCK, BMP_ID(%edx)
jz No_unlock_gdi
/* unlock surface */
pushl %ecx
pushl %eax
pushl %edx
pushl %edx /* argument */
call *GLOBL(ptr_gfx_gdi_unlock)
popl %edx
popl %edx
popl %eax
popl %ecx
/* clear the autolock flag */
andl $~BMP_ID_AUTOLOCK, BMP_ID(%edx)
No_unlock_gdi:
ret
#endif /* !defined(ALLEGRO_NO_ASM) */

View File

@ -24,11 +24,6 @@
/* If custom (asm) calling conversions are used, then the code in asmlock.s is
* used instead.
*/
#if defined(ALLEGRO_NO_ASM)
static void update_dirty_lines(BITMAP *bmp)
{
RECT rect;
@ -116,20 +111,6 @@ void gfx_directx_unlock_win(BITMAP *bmp)
#else /* !defined(ALLEGRO_NO_ASM) */
/* asmlock.s requires these two variables */
void (*ptr_gfx_directx_autolock) (BITMAP* bmp) = gfx_directx_autolock;
void (*ptr_gfx_directx_unlock) (BITMAP* bmp) = gfx_directx_unlock;
#endif /* !defined(ALLEGRO_NO_ASM) */
/* gfx_directx_switch_out:
* Arranges for drawing requests to pause when we are in the background.
*/

View File

@ -40,13 +40,6 @@ char *gdi_dirty_lines = NULL; /* used in WRITE_BANK() */
/* If custom (asm) calling conversions are used, then the code in asmlock.s is
* used instead.
*/
#if defined(ALLEGRO_NO_ASM)
uintptr_t gfx_gdi_write_bank(BITMAP *bmp, int line)
{
gdi_dirty_lines[bmp->y_ofs +line] = 1;
@ -70,23 +63,6 @@ void gfx_gdi_unwrite_bank(BITMAP *bmp)
#else /* !defined(ALLEGRO_NO_ASM) */
/* asmlock.s requires these two variables */
void (*ptr_gfx_gdi_autolock)(struct BITMAP* bmp) = gfx_gdi_autolock;
void (*ptr_gfx_gdi_unlock)(struct BITMAP* bmp) = gfx_gdi_unlock;
/* wddraw.h, despite its name, includes the exports from asmlock.s */
#include "wddraw.h"
#endif /* !defined(ALLEGRO_NO_ASM) */
static struct BITMAP *gfx_gdi_init(int w, int h, int v_w, int v_h, int color_depth);
static void gfx_gdi_exit(struct BITMAP *b);
static void gfx_gdi_set_palette(AL_CONST struct RGB *p, int from, int to, int vsync);

View File

@ -48,12 +48,7 @@ static int _xdga2_scroll_screen(int x, int y);
static void _xdga2_set_palette_range(AL_CONST PALETTE p, int from, int to, int vsync);
static void _xdga2_acquire(BITMAP *bmp);
static GFX_MODE_LIST *_xdga2_fetch_mode_list(void);
#ifdef ALLEGRO_NO_ASM
uintptr_t _xdga2_write_line(BITMAP *bmp, int line);
#else
uintptr_t _xdga2_write_line_asm(BITMAP *bmp, int line);
#endif
static void (*_orig_hline) (BITMAP *bmp, int x1, int y, int x2, int color);
@ -559,13 +554,8 @@ static BITMAP *_xdga2_private_gfxdrv_init_drv(GFX_DRIVER *drv, int w, int h, int
/* Hardware acceleration has been requested */
/* Updates line switcher to accommodate framebuffer synchronization */
#ifdef ALLEGRO_NO_ASM
bmp->write_bank = _xdga2_write_line;
bmp->read_bank = _xdga2_write_line;
#else
bmp->write_bank = _xdga2_write_line_asm;
bmp->read_bank = _xdga2_write_line_asm;
#endif
_screen_vtable.acquire = _xdga2_acquire;
@ -816,7 +806,6 @@ static void _xdga2_acquire(BITMAP *bmp)
}
#ifdef ALLEGRO_NO_ASM
/* _xdga2_write_line:
* Returns new line and synchronizes framebuffer if needed.
@ -829,7 +818,6 @@ uintptr_t _xdga2_write_line(BITMAP *bmp, int line)
return (uintptr_t)(bmp->line[line]);
}
#endif
/* _xaccel_hline:

View File

@ -1,53 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* DGA2 bank switching code. These routines will be called
* with a line number in %eax and a pointer to the bitmap in %edx.
* The bank switcher should select the appropriate bank for the
* line, and replace %eax with a pointer to the start of the line.
*
* By Angelo Mottola.
*
* See readme.txt for copyright information.
*/
#include "allegro/platform/alunixac.h"
#include "../i386/asmdefs.inc"
.text
#if (!defined ALLEGRO_NO_ASM) && (defined ALLEGRO_XWINDOWS_WITH_XF86DGA2)
#if (!defined ALLEGRO_WITH_MODULES) || (defined ALLEGRO_MODULE)
FUNC (_xdga2_write_line_asm)
/* check whether bitmap is already locked */
testl $BMP_ID_LOCKED, BMP_ID(%edx)
jnz Locked
pushl %ecx
pushl %eax
pushl %edx
call GLOBL(_xdga2_lock)
popl %edx
popl %eax
popl %ecx
Locked:
/* get pointer to the video memory */
movl BMP_LINE(%edx,%eax,4), %eax
ret
#endif
#endif

View File

@ -272,10 +272,6 @@ static void _xvidmode_private_unset_fullscreen(void);
uintptr_t _xwin_write_line(BITMAP *bmp, int line);
void _xwin_unwrite_line(BITMAP *bmp);
#ifndef ALLEGRO_NO_ASM
uintptr_t _xwin_write_line_asm(BITMAP *bmp, int line);
void _xwin_unwrite_line_asm(BITMAP *bmp);
#endif
@ -1047,13 +1043,8 @@ static BITMAP *_xwin_private_create_screen_bitmap(GFX_DRIVER *drv,
drv->vid_mem = _xwin.virtual_width * _xwin.virtual_height * BYTES_PER_PIXEL(_xwin.screen_depth);
/* Need some magic for updating frame buffer. */
#ifndef ALLEGRO_NO_ASM
bmp->write_bank = _xwin_write_line_asm;
bmp->vtable->unwrite_bank = _xwin_unwrite_line_asm;
#else
bmp->write_bank = _xwin_write_line;
bmp->vtable->unwrite_bank = _xwin_unwrite_line;
#endif
/* Replace entries in vtable with magical wrappers. */
_xwin_replace_vtable(bmp->vtable);

View File

@ -1,53 +0,0 @@
/* ______ ___ ___
* /\ _ \ /\_ \ /\_ \
* \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
* \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
* \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
* \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
* \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
* /\____/
* \_/__/
*
* X-windows bank switching code. These routines will be called
* with a line number in %eax and a pointer to the bitmap in %edx.
* The bank switcher should select the appropriate bank for the
* line, and replace %eax with a pointer to the start of the line.
*
* By Michael Bukin.
*
* See readme.txt for copyright information.
*/
#include "allegro/platform/alunixac.h"
#include "../i386/asmdefs.inc"
.text
#ifndef ALLEGRO_NO_ASM
/* Use only with ASM calling convention. */
FUNC(_xwin_write_line_asm)
pushl %ecx
pushl %eax
pushl %edx
call GLOBL(_xwin_write_line)
popl %edx
popl %ecx /* preserve %eax */
popl %ecx
ret
FUNC(_xwin_unwrite_line_asm)
pushl %ecx
pushl %eax
pushl %edx
call GLOBL(_xwin_unwrite_line)
popl %edx
popl %eax
popl %ecx
ret
#endif