From: qball1723 AT aol DOT com (QBall1723) Newsgroups: comp.os.msdos.djgpp Subject: DJGPP inline solution anyone? Date: 13 Nov 1997 13:02:22 GMT Lines: 227 Message-ID: <19971113130201.IAA27637@ladder01.news.aol.com> NNTP-Posting-Host: ladder01.news.aol.com Organization: AOL http://www.aol.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk Hello All, I've just begun coding with DJGPP... and I'd like to get some input on converting a routine originally written for 16-bit REAL MODE Dos... to DJGPP's inline assembly.... ... I may give TOO much information... but here goes.. (I'm including some declarations & support routines...) Thank you for reading this and trying to help me out! ********************* some declares int *scale_table[MAX_SCALE+1]; // table with pre-computed scale indices // parmeter block used by assembly language sliver engine char *sliver_texture; // pointer to texture being rendered int sliver_column; // index into texture i.e. which column of texture int sliver_top; // starting Y position to render at int sliver_bottom; int sliver_scale; // overall height of sliver int sliver_ray; // current ray being cast int sliver_clip; // index into texture after clipping int *scale_row; // row of scale value look up table to use ****************Here's the routine in question void Render_Sliver(void) { // this is yet another version of the sliver scaler, however it uses look up // tables with pre-computed scale indices. // this draws vertical slivers fromthe middle of the strip to the top, // and fromthe middle of the strip to the bottom. char *work_sprite; int *row; char *draw_from; int work_offset=0,offset,temp_offset,y_off,scale_off; // alias a pointer to sprite for ease of access work_sprite = sliver_texture; // compute offset of sprite in video buffer temp_offset = v_320[99] + sliver_ray; // render top half of wall sliver offset = temp_offset; draw_from = double_buffer + offset; work_offset = WALL_MIDDLE_OFFSET; *draw_from = work_sprite[work_offset+sliver_column]; for (y_off=1; y_off WALL_MIDDLE_OFFSET) row[y_off] = WALL_MIDDLE_OFFSET; // next index please y_scale_index+=y_scale_step; } // end for y_off } // end Create_Scale_Data void Create_Scale_Data2(int scaler, int *row) { // this function synthesizes the scaling of a texture sliver to all possible // sizes and creates a huge look up table of the data. // this adds data for cases where the vertical extents of the "sliver" are // beyond the vertical extents of the viewport int y_off; float y_scale_index=0, y_scale_step; // compute scale step or number of source pixels to map to destination/cycle y_scale_step = (float)32/(float)scaler; y_scale_index+=y_scale_step; for (y_off=0; y_off<99+1; y_off++) { // place data into proper array position for later use row[y_off] = ((int)(y_scale_index+.3)) * SWATCH_WIDTH; // test if we slightly went overboard if (row[y_off] > WALL_MIDDLE_OFFSET) row[y_off] = WALL_MIDDLE_OFFSET; // next index please y_scale_index+=y_scale_step; } // end for y_off } // end Create_Scale_Data2 Again - thanks for checking this out! Jim the loiterer http://members.aol.com/qball1723/index.htm (I make games)