Hello All,
I found some info on how to program BNU.
So I made this fossilunit. But when I compile it, it won't work anymore!!
Can someone tell me what I do wrong??
The program SHOULD do this:
- Initialize your fossil and return the revision level (could be 1 - 5)
- Send the text " X LeeMeRZ ", and if less then 1 character sent, it
should return the resultcode with the word 'FOUT' (dutch for WRONG)
- Delay for 2 seconds
- DeInitialize your fossil and exit
But it does this:
- NOT initializing my fossil, and returning a random number 25,27,80 etc
- NOT Sending text, but returning -1 (wich means error, because fossil
isn't initialized?
- Delaying for 2 seconds
- NOT DeInitializing my fossil.
The PORT variable is for your zero based comport (eg. com 1 = 0, com 2 = 1)
Here comes the source: First the mainprogram then the shortend fossillibrary:
CUT DA CRAP HERE
$COMPILE EXE "TESTJE2.EXE"
DECLARE SUB F_DeInit()
DECLARE FUNCTION F_Init () AS INTEGER
DECLARE FUNCTION F_Write (Messg AS STRING) AS INTEGER
$LINK "TESTJE2.PBL"
PUBLIC Port, Remote
Port = 3
Remote = 0
CLS
PRINT F_Init
A% = F_Write(" þ LeeMeRZ! " + CHR$(13))
IF A% < 1 THEN
PRINT A%; "fout!"
END IF
DELAY 2
CALL F_DeInit END Noname.Bas
CUT DA CRAP HERE
$COMPILE UNIT "TESTJE2.PBU"
EXTERNAL Port, Remote
FUNCTION F_Init PUBLIC AS INTEGER
IF Remote = 0 THEN
!MOV AH, &H04
!MOV DX, Port
!INT &H14
!MOV FUNCTION, BL
ELSE
FUNCTION = -1
END IF
END FUNCTION
SUB F_DeInit PUBLIC
IF Remote = 0 THEN
!MOV AH, &H05
!MOV DX, Port
!INT &H14
END IF
END SUB
FUNCTION F_Write(Text AS STRING) PUBLIC AS INTEGER
DIM BlockSEG AS INTEGER
DIM BlockOFF AS INTEGER
DIM MaxChars AS INTEGER
MaxChars = LEN(Text)
BlockSEG = VARSEG(Text)
BlockOFF = VARPTR(Text)
IF Remote = 0 THEN
!MOV AH, &H19
!MOV DX, Port
!MOV CX, MaxChars
!MOV ES, BlockSEG
!MOV DI, BlockOFF
!INT &H14
!MOV FUNCTION, AX
PRINT Text;
ELSE
PRINT Text;
END IF
END FUNCTION
END TRYFOS2.bas
L8eRZ!
sander@taf.idn.nl
... GIVE: Support the helpless victims of computer error.
--- GoldED/386 2.50+
---------------
* Origin: iNFiNiTY SYSTeM - !33k6! - 033-4943146 (2:283/507)
|