#DIM ALL ' we do enforce declarations for all variables #REGISTER ALL ' we use register variables whereever possible #DEBUG ERROR ON ' should trap array boundary errors... #OPTION VERSION5 ' VERSION4 compiles for Win95, Win98, WinNT4 - 32 bit only. ' version5 compiles for Windows2000 and NT5.0 #COMPILE EXE ' The order in which the following includes appear is very important! ' Do not change unless you understand what you are doing. Keep all filenames lowercase. ' Includes for sourcecode libraries: #INCLUDE "..\winapi\win32api.inc" ' Win32API - version 31.03.2000 ' this includes way too much. You may want to build a smaller ' include. However, there is no performance penalty. Only ' elements that are called in, are compiled into the code. ' It only makes compilation a little bit slower. #INCLUDE "..\winapi\commctrl.inc" #INCLUDE "..\winapi\comdlg32.inc" #INCLUDE "..\winapi\mdi32.inc" #INCLUDE "..\winapi\richedit.inc" ' Next we declare all our own constants: #INCLUDE "gmt_kons.bi" ' only integer and string constants can be declared in PB #INCLUDE "gmt_type.bi" ' This declares all our own structures, user defined types #INCLUDE "gmt_glob.bi" ' This declares all variables shared across modules ' must appear after win32api: we use Win32 types as globals #INCLUDE "gmt_lib.bi" ' loads the library DLL, by including its declarations. '#INCLUDE "gmt.bi" ' kernel procedure declaration file FUNCTION PBMAIN() AS LONG LOCAL noot AS BYTE local i as long LOCAL strobebyte AS BYTE SLEEP 100 strobebyte = Portin (%Preg) ' MSGBOX BIN$(Strobebyte) ' returns 1111 0000 - the high nibble cannot be read back... BIT RESET strobebyte,5 ' bit 5 must be reset to make the port output!!!! ' Portout %Preg, strobebyte ' strobebyte = Portin (%Preg) ' MSGBOX BIN$(Strobebyte) ' returns 1111 0000 - the high nibble cannot be read back... BIT RESET strobebyte,1 BIT RESET strobebyte,2 BIT RESET strobebyte,3 strobebyte = &H80 FOR noot = 48 TO 69'95 '69 IF (noot = 68) OR (noot = 94) THEN ITERATE FOR FOR i = 1 TO 10 IF noot > 69 THEN noot = noot - 24 ELSE noot = noot + 24 end if ' MSGBOX BIN$(noot\8) PortOut %Padr,(noot \ 8) ' select the correct note adress for the velo latch DATA= 0-15 ' must be sent to velo latch ' SLEEP 1 PortOut %Preg, strobebyte OR 10 ' SLEEP 1 Strobe %Preg,strobebyte OR 10,0,%StrobeLength ' strobe it into the 74574, nr 4 ' 1500-2000ns ' SLEEP 1 PortOut %Padr, 2^(noot MOD 8) ' WAS GROTE BUG !!! noot MOD 8 ' SLEEP 1 PortOut %Preg, strobebyte OR 2 ' SLEEP 1 Strobe %Preg,strobebyte OR 2,0,%StrobeLength ' strobe the note data to the velo latch ' SLEEP 1 Portout %Preg, strobebyte OR 14 ' SLEEP 1 Strobe %Preg, strobebyte OR 14,0,%StrobeLength SLEEP 100 ' = velo '------------ note off: PortOut %Padr,(noot \ 8) ' select the correct note adress for the velo latch DATA= 0-15 ' SLEEP 1 PortOut %Preg, strobebyte OR 10 ' SLEEP 1 Strobe %Preg,strobebyte OR 10,0,%StrobeLength ' strobe it into the 74574, nr 4 ' 1500-2000ns ' SLEEP 1 PortOut %Padr, 0 ' no note ' SLEEP 1 PortOut %Preg, strobebyte OR 2 ' SLEEP 1 Strobe %Preg,strobebyte OR 2,0,%StrobeLength ' strobe the note data to the velo latch ' SLEEP 1 PortOut %Preg, strobebyte OR 14 ' SLEEP 1 Strobe %Preg, strobebyte OR 14,0,%StrobeLength ' SLEEP 1 ' MSGBOX STR$(noot) next i NEXT noot 'MSGBOX "done" END FUNCTION 'EOF