Tri-d chess

 BBS: Inland Empire Archive
Date: 03-16-92 (23:00)             Number: 196
From: STEVE HALKO                  Refer#: NONE
  To: MICHAEL MALLEY                Recvd: NO  
Subj: Tri-d chess                    Conf: (2) Quik_Bas
MM>SH>  Actually, direct screen writes are TONS faster than LOCATE/PRINT.  QB
MM>SH>  uses direct screen writes, but only after wading through all the
MM>SH>  internal code for LOCATE and PRINT.

MM>Not if he's doing it in BASIC it's not.  Try using PEEK and you'll see
MM>what I mean.  Most of what BASIC does that slows it down is checking

  I did try it, and POKEing to screen memory is mucho faster.  My test
  code fills the screen with characters 100 times using each method.
  The results (all times in seconds):

                QB IDE     EXE
                ------     ---
  LOCATE/PRINT  20.16     14.11
  POKE           3.68       .23


  Bottom line:  using POKE is almost  7 times faster in the QB IDE
                using POKE is almost 70 times faster in stand-alone EXE


  Here be my test code:

  DEFINT A-Z
  CLS
  Start# = TIMER
  FOR k = 1 TO 100                 'Do it 100 times
     FOR i = 1 TO 25               'For each row
          FOR j = 1 TO 80          'For each column
               LOCATE i, j
               PRINT CHR$(i + 64);
          NEXT j
     NEXT i
  NEXT k
  CLS
  PRINT "LOCATE/PRINT:"; TIMER - Start#       'Print elapsed time
  DO                                'Wait for a key press
  LOOP UNTIL LEN(INKEY$)
  DEF SEG = &HB800                  'Video screen memory segment
  Start# = TIMER
  FOR k = 1 TO 100                  'Do it 100 times
     FOR i = 1 TO 25                'For each row
          FOR j = 1 TO 80           'For each column
               POKE ((j - 1) + (i - 1) * 80) * 2, i + 64
          NEXT j
     NEXT i
  NEXT k
  CLS
  PRINT "POKE:"; TIMER - Start#               'Print elapsed time
  END

 * SLMR 2.1a * Apathy Error - Strike any key ... or none for that matter

--- DB B1061/002487
 * Origin: Gulf Coast BBS -QuickSHARE #2- (904)563-2547 HST/V.32bis (1:365/12)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET