DECLARE FUNCTION AskForBaseAddress! (OldOne AS INTEGER) '************************************************************************** '* BSAMPLE #4 : SAMPLE4.BAS * '* * '* This sample will continuously read the digital input port and display * '* the value bit by bit. * '* * '************************************************************************** 'BEGIN CLS PRINT " BASIC SAMPLE #4 : SAMPLE4.BAS " PRINT PRINT " This sample will continuously read the digital input port and " PRINT " display the value bit by bit. " PRINT PRINT " Pressing any key will terminate the program. " PRINT PRINT PRINT Address% = Address(&H340) OUT (Address% + 1), &H0 ' tristate the port and set to zero OUT Address%, &H20 ' initialize the control register WHILE INKEY$ = "" LOCATE 14, 30 value = INP(Address% + 1) mask = &H80 FOR i = 0 TO 7 IF ((mask AND value) <> 0) THEN PRINT "1 "; ELSE PRINT "0 "; mask = mask / 2 NEXT i WEND PRINT PRINT 'END FUNCTION AskForBaseAddress (OldOne AS INTEGER) Msg$ = "" NewOne% = 0: Success = 0: Dummy% = 0 AddrInputPosX = 0: AddrInputPosY = 0 PRINT "Please enter the Base Address (0000-FFFF) for your card (in hex)" PRINT "or press ENTER for "; HEX$(OldOne%); "." PRINT ">"; AddrInputPosX = POS(0): AddrInputPosY = CSRLIN WHILE Success = 0 LOCATE AddrInputPosY, AddrInputPosX PRINT " " LOCATE AddrInputPosY, AddrInputPosX LINE INPUT Msg$ NewOne% = VAL("&H0" + LEFT$(Msg$, 4)) Success = 1 Dummy% = NewOne% ELSEIF (Msg$ = "") THEN LOCATE AddrInputPosY, AddrInputPosX PRINT HEX$(OldOne%) Success = 1 Dummy% = OldOne% END IF WEND AskForBaseAddress = Dummy% END FUNCTION