ASM: draw_tile conversion

This commit is contained in:
dwsJason 2018-09-23 18:06:18 -04:00
parent ff4bd68c0b
commit ffea5013d0
8 changed files with 64 additions and 11 deletions

View File

@ -5,10 +5,48 @@
case on case on
longa on longa on
longi on longi on
Dummy3 start ASMCODE Dummy3 start ASMCODE
end end
*
* void draw_tile(U8 tileNumber)
*
draw_tile start ASM_CODE
iTileNo equ 5
phb
lda iTileNo,s
ora |draw_tilesBank
asl A
tax
lda |fb
tay
adc #4
sta |fb
lda 3,s
sta iTileNo,s
lda 1,s
sta iTileNo-2,s
lda #$0101
sta 1,s
plb
plb
TILEBANK3 entry
lda >$880005,x
sta >TILEBANK4+1
TILEBANK4 entry
jsl >$880000
plb
rtl
*-------------------------------------------------------------------------------
end
* *
* void DrawTile(short offset, short tileNo) * void DrawTile(short offset, short tileNo)
* *
@ -63,6 +101,8 @@ iBank equ 4
lda iBank,s lda iBank,s
sta >TILEBANK+3 sta >TILEBANK+3
sta >TILEBANK2+3 sta >TILEBANK2+3
sta >TILEBANK3+3
sta >TILEBANK4+3
rep #$30 rep #$30
lda 2,s lda 2,s
sta iBank,s sta iBank,s

View File

@ -29,7 +29,7 @@ extern U8 *draw_tllst;
#ifdef GFXPC #ifdef GFXPC
extern U16 draw_filter; extern U16 draw_filter;
#endif #endif
extern U8 draw_tilesBank; extern U16 draw_tilesBank;
extern rect_t draw_STATUSRECT; extern rect_t draw_STATUSRECT;
extern rect_t draw_SCREENRECT; extern rect_t draw_SCREENRECT;

View File

@ -138,7 +138,7 @@ extern U8 map_frow;
/* /*
* tiles offset * tiles offset
*/ */
extern U8 map_tilesBank; extern U16 map_tilesBank;
extern void map_expand(void); extern void map_expand(void);
extern void map_init(void); extern void map_init(void);

View File

@ -186,7 +186,7 @@ extern volatile unsigned long* tick;
// GS Rendering Stuff // GS Rendering Stuff
extern void SetTileBank(short bank); extern void SetTileBank(short bank);
extern void DrawTile(int offset, int tileNo); extern void DrawTile(int offset, U16 tileNo);
extern void SetSpriteBanks(short b0, short b1, short b2, short b3); extern void SetSpriteBanks(short b0, short b1, short b2, short b3);
extern void DrawSprite(int offset, int SpriteNo); extern void DrawSprite(int offset, int SpriteNo);

View File

@ -64,7 +64,11 @@ devtools_run(void)
draw_setfb(64, 30 + i * 0x0a); draw_setfb(64, 30 + i * 0x0a);
draw_tile((i<10?0x30:'A'-10) + i); draw_tile((i<10?0x30:'A'-10) + i);
} }
#ifdef GFXGS
draw_tilesBank = pos << 8;
#else
draw_tilesBank = pos; draw_tilesBank = pos;
#endif
for (i = 0; i < 0x10; i++) for (i = 0; i < 0x10; i++)
for (j = 0; j < 0x10; j++) { for (j = 0; j < 0x10; j++) {
draw_setfb(80 + j * 0x0a, 30 + i * 0x0a); draw_setfb(80 + j * 0x0a, 30 + i * 0x0a);
@ -172,7 +176,11 @@ devtools_run(void)
draw_setfb(4, 4); draw_setfb(4, 4);
draw_tilesBank = 0; draw_tilesBank = 0;
draw_tilesListImm(s); draw_tilesListImm(s);
#ifdef GFXGS
draw_tilesBank = pos2<<8;
#else
draw_tilesBank = pos2; draw_tilesBank = pos2;
#endif
for (l = 0; l < 8; l++) for (l = 0; l < 8; l++)
for (k = 0; k < 4; k++) for (k = 0; k < 4; k++)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)

View File

@ -88,7 +88,7 @@ U8 *draw_tllst; /* pointer to tiles list */
#ifdef GFXPC #ifdef GFXPC
U16 draw_filter; /* CGA colors filter */ U16 draw_filter; /* CGA colors filter */
#endif #endif
U8 draw_tilesBank; /* tile number offset */ U16 draw_tilesBank; /* tile number offset */
rect_t draw_STATUSRECT = { rect_t draw_STATUSRECT = {
DRAW_STATUS_SCORE_X, DRAW_STATUS_Y, DRAW_STATUS_SCORE_X, DRAW_STATUS_Y,
DRAW_STATUS_LIVES_X + 6 * 8 - DRAW_STATUS_SCORE_X, 8, DRAW_STATUS_LIVES_X + 6 * 8 - DRAW_STATUS_SCORE_X, 8,
@ -100,7 +100,7 @@ rect_t draw_SCREENRECT = { 0, 0, 320, SYSVID_HEIGHT, NULL };
/* /*
* private vars * private vars
*/ */
static U8 *fb; /* frame buffer pointer */ U8 *fb; /* frame buffer pointer */
/* /*
@ -234,13 +234,14 @@ draw_tilesSubList()
* draw_filter: CGA colors filter * draw_filter: CGA colors filter
* fb: CHANGED (see above) * fb: CHANGED (see above)
*/ */
#ifndef GFXGS
void void
draw_tile(U8 tileNumber) draw_tile(U8 tileNumber)
{ {
#ifdef GFXGS #ifdef GFXGS
//$$JGA TODO convert to ASM //$$JGA TODO convert to ASM
int tileNo = (((int)draw_tilesBank)*256)+tileNumber; U16 tileNo = draw_tilesBank | tileNumber;
//printf("fb=%04x tileNo=%04x\n", (int)fb, tileNo); //printf("fb=%04x tileNo=%04x\n", (int)fb, tileNo);
//sys_sleep(1000); // Wait 1 second //sys_sleep(1000); // Wait 1 second
@ -289,6 +290,7 @@ draw_tile(U8 tileNumber)
fb += 8; /* next tile */ fb += 8; /* next tile */
#endif #endif
} }
#endif
/* /*
* Draw a sprite * Draw a sprite

View File

@ -48,7 +48,7 @@
U8 map_map[0x2C][0x20]; U8 map_map[0x2C][0x20];
U8 map_eflg[0x100]; U8 map_eflg[0x100];
U8 map_frow; U8 map_frow;
U8 map_tilesBank; U16 map_tilesBank;
/* /*
@ -105,8 +105,11 @@ map_init(void)
draw_filter = 0xffff; draw_filter = 0xffff;
map_tilesBank = (map_submaps[game_submap].page == 1) ? 3 : 2; map_tilesBank = (map_submaps[game_submap].page == 1) ? 3 : 2;
#endif #endif
#if defined(GFXST) || defined(GFXGS) #ifdef GFXST
map_tilesBank = (map_submaps[game_submap].page == 1) ? 2 : 1; map_tilesBank = (map_submaps[game_submap].page == 1) ? 2 : 1;
#endif
#ifdef GFXGS
map_tilesBank = (map_submaps[game_submap].page == 1) ? 0x200 : 0x100;
#endif #endif
map_eflg_expand((map_submaps[game_submap].page == 1) ? 0x10 : 0x00); map_eflg_expand((map_submaps[game_submap].page == 1) ? 0x10 : 0x00);
map_expand(); map_expand();

View File

@ -80,7 +80,7 @@ U32
sys_gettime(void) sys_gettime(void)
{ {
#ifdef IIGS #ifdef IIGS
return tick[0] * 16; return tick[0] << 4;
#else #else
static U32 ticks_base = 0; static U32 ticks_base = 0;
U32 ticks; U32 ticks;
@ -102,7 +102,7 @@ sys_sleep(int s)
{ {
#ifdef IIGS #ifdef IIGS
// on GS we're going to work in ms, also we don't sleep, we just wait // on GS we're going to work in ms, also we don't sleep, we just wait
while (s > 0) while (s > 8)
{ {
sysvid_wait_vblank(); sysvid_wait_vblank();
s -= 16; // About 1/60th of a second s -= 16; // About 1/60th of a second