🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: rec.games.programmer
Article #1007

speedup PutBlock

#1007
From: james blaisdell
Date: Fri, 06 Nov 1992 06:32
22 lines
1441 bytes
somebody writes:
JA>void PutBlock( int x, int y, int height, int width, char far * buffer )
add to arg list: unsigned far *table
table will point to a table of multiples of 320.  ex. 0,320,640,960,...
  >{   _asm {
  >        push    di
  >        push    si
  >        push    es
  >        push    ds
  >        mov     ax, 320                 <<<-- change this to mov bx, y
  >        mul     y       ; AX = y * 320  <<<-- and this to add bx, bx
	then set ds, si for the table lookup by:  lds si, table

        then load ax with screen addr by          mov ax, ds:[si+bx]
  >        add     ax, x   ;             + x
  >        mov     di, ax  ; ES:DI = destination of pixels
  >        mov     ax, 0A000h
  >        mov     es, ax  ; Segment of VGA memory
            .....
by making these changes you'll probably be saving at least 70 clock cycles,
the table can also be used for get_dot, or plot_dot any other graphics 
routine that addresses the screen.
Technical Details
Message-ID: <23707@galaxy.ucr.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!emory!swrinde!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!network.ucsd.edu!galaxy!ucrengr!blaisdel

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!europa.asd.contel.com!emory!swrinde!zaphod.mps.ohio-state.edu!news.acns.nwu.edu!network.ucsd.edu!galaxy!ucrengr!blaisdel
From: blaisdel@ucrengr.ucr.edu (james blaisdell)
Newsgroups: rec.games.programmer
Subject: speedup PutBlock
Message-ID: <23707@galaxy.ucr.edu>
Date: 6 Nov 92 06:32:56 GMT
Sender: news@galaxy.ucr.edu
Distribution: usa
Organization: University of California, Riverside
Lines: 23
Nntp-Posting-Host: ucrengr