Home > Tech Blog > Timing from the Past

Timing from the Past

Digging out some old QuickBasic code
By 14/04/11 [Last Edited by Joseph 14/04/11]
BOOKMARK
LOGIN
REGISTER
Blog Navigation: Previous Next
Dug out an old lump of code off my Toshiba Satellite 110CS running MS-DOS 6.22 for a visitor interested in my UT70B Multimeter Interface Software for DOS. I wrote this application in QuickBasic 4.5, and never quite finished it, although it mostly works. Looking through the code, I pulled this snipped of code as an embarrassing example of how I used to do timing in my QB apps:

DO
        Count = Count + 1
        IF Count = 5000 THEN Count = 0
        IF Count = 1000 THEN LocVar = LocVar + 1
        IF LocVar = 57 THEN LocVar = 1
        IF Count = 2000 THEN LOCATE 2, 1: COLOR 7, 5: PRINT BlankBar$: LOCATE 2, LocVar: PRINT "ALPHA EXPERIMENTAL BUILD!"
        COLOR 7, 0
        DataCollect$ = GetData$
        IF LEN(DataCollect$) THEN
                LOCATE 4, 1: PRINT "                                                 "
                LOCATE 4, 1: PRINT STR$(GetValue(DataCollect$, NegPos$)) + Sign$ + "    " + GetMode(DataCollect$, Sign$, NegPos$)
                AddList (STR$(GetValue(DataCollect$, NegPos$)) + Sign$)
        END IF
LOOP UNTIL INKEY$ = CHR$(27)

In case you haven't yet realised, the timing was done by looping, whilst maintaining a loop counter, and branching off when the loop counter hit certain values! I just had no clue how else you were meant to do it in QB!