Recompiling an older Dos project with the latest version and have struck
some errors. Compiling for Windows works perfectly, but the identical routines
creates errors in some haphazard places.
I know the routines can be significantly improved, or one used for all 4, but I dont Fix what Aint broken.
Code: Select all
Function AD7701C2 (ByVal Addr As Integer) As Integer
#ifdef __FB_DOS__
Dim BitCount2 As Integer
Dim DDS As Ushort = _dos_ds
Asm
mov eax,[DDS] ' Directly using "_dos_ds" won't work here !!!
push eax
pop gs ' Just to get sure, it is usually set anyway
mov cl,[gs:0x046C] ' Get current Tick count
add cl,2 ' add 2 x 1/18 sec
MOV DX,[Addr] ' set input address
B1:
CMP cl,[gs:0x046C]
JE B4 ' chip stuffed, so quit.
IN AL,DX 'Wait here for DREADY to go on.
TEST AL,2 'as this syncronises for the next
JZ B1 'loop which is
B2:
IN AL,DX 'wait for next time
TEST AL,2 'DREADY bit is off.
JNZ B2 'loop if not off.
MOV BITCOUNT2,0 '2 otherwise ,zero the bitcount.
MOV AL,0 '2 set Chip Select bit to ACTIVE LOW.
OUT DX,AL '11 and send it to port.
XOR BX,BX '2
NOP '3
NOP '3
NOP '3
NOP '3
JMP READBIT2 '7
'*******************************;
BIT_LOOP2:
SHL BX,1 '*3
MOV AL,16 '*2
OUT DX,AL '*11 Set clk hi
NOP '*3
NOP '*3
NOP '*3
NOP '*3
'spec says 50nsec min.
MOV AL,0 '*2 = *2 x 30ns = 60nsec
OUT DX,AL '*16 = *17 X 30ns = 510 nsec
NOP 'spec says 180nsec min.
NOP '
NOP '*6 = *6 x 3 = 18 clks
NOP
NOP
NOP
READBIT2:
IN AL,DX '*13
TEST AL,4 '*2 otherwise test databit
JZ B3 '*7
OR BX,1 '*2 set bit in word.
B3:
INC BITCOUNT2 '*6
CMP BITCOUNT2,16 '*5 Is it bit 16 ?
JB BIT_LOOP2 '*7 if not keep reading bits.
Jmp B5
B4:
Mov BX,65534
B5: '-------------------------------
MOV AL,32 '*2 Last bit recvd so
OUT DX,AL '*11 set CS hi again
MOV [Function],BX
End Asm
#Endif
End Function
label names.
The first of these 3 compiles with AS.EXE without errors, but on the next three
I get errors in places that dont make sense.
assembling: C:\fbdos\bin\dos\as.exe --32 --strip-local-absolute "RunMod02.asm" -o "RunMod02.o"
RunMod02.asm: Assembler messages:
In Function AD7701C2
RunMod02.asm:149: Error: invalid use of register
OUT DX,AL
RunMod02.asm:179: Error: invalid use of register
B3:
RunMod02.asm:180: Error: invalid use of register
INC BITCOUNT2
In Function AD7701C3
RunMod02.asm:228: Error: invalid use of register
OUT DX,AL
RunMod02.asm:259: Error: invalid use of register
End Asm
RunMod02.asm:260: Error: invalid use of register
#EndIf
In Function AD7701C4
RunMod02.asm:308: Error: invalid use of register
NOP
Last Line Nbr in This module Is 330, but the following errors ?????
RunMod02.asm:339: Error: invalid use of register
RunMod02.asm:340: Error: invalid use of register
RunMod02.asm:388: Error: invalid use of register
RunMod02.asm:419: Error: invalid use of register
RunMod02.asm:420: Error: invalid use of register
assembling failed: 'C:\fbdos\bin\dos\as.exe' terminated with exit code 1
Is there some numbering problem with AS.EXE ?