Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Binary routine for FoxPro 2.5 DOS
Message
De
06/09/2000 09:26:59
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
06/09/2000 01:27:52
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Divers
Thread ID:
00412373
Message ID:
00412884
Vues:
24
>Thanks for the reply. If I want to send parameters from foxpro to the binary, in the binary in what format can I expect the parameters ?
>
>Thanks
>
>Anurag

Depends on parameter. In the sample driveletter was sent (say for C it was hex 47 which is ascii code of 'C'). If you send an integer it would be a dword (ie: 64 00 hex for 100 decimal). I don't remember the details but as far as I remember when I needed to send an integer or whatsoever I converted it to a string and passed (ie: chr(64)+chr(0) for 100). There is little documentation about it so you should try and see (ie:it doesn't say where actually I should place return value-as a workaround I always assumed I was passing by ref. As I could remember I couldn't succeed the 'to ..' part so pushing the return values on the same ds:bx space - warning that string space shouldn't increase even one byte so on calling preserve wide enough). As a sample passing 3 integers to set system date :
* Run once to create .bin file
lcBinFile = chr(180)+chr(43)+chr(139)+chr(15)+chr(138)+;
chr(119)+chr(2)+chr(138)+chr(87)+chr(3)+chr(205)+chr(33)+chr(203)
handle=fcreate("setdate.bin")
=fwrite(handle,lcBinFile,13)
=fclose(handle)
* Run once to create .bin file
* Creates this
*!*             mov ah,2b       // Set date subfunction
*!*             mov cx,[bx]     // Year
*!*             mov dh,[bx+02]  // Month
*!*             mov dl,[bx+03]  // Day
*!*             int 21          // Call dos int
*!*             retf
* Creates this


function mySetDate
parameters lnYear, lnMonth, lnDay
load setdate.bin
lnYearLowByte = lnYear % 256
lnYearHighByte = int(lnYear / 256)
lcDate=CHR(lnYearLowByte)+CHR(lnYearHighByte)+CHR(lnMonth)+CHR(lnDay)
call setdate.bin with lcDate
And another one reading diskette A physical sectors :
set talk off
clear
set memowidth to 512
load CETIN.bin
=psector(12,0,18) && Track12, Head0, Sector18
=psector(0,0,1) && Boot sector

function psector
parameters track,head,sector
MP=CHR(SECTOR)+CHR(TRACK)+CHR(0)+CHR(HEAD)+space(508)
call CETIN.bin with mp
? "Track : "+str(TRACK,2)
?? "Head : "+str(HEAD,2)
?? "Sector : "+str(SECTOR,2)
? "-----------------------------------------"
? mp
? "=========================================="
ASM code (pls discard the way code is written. I'm no good in writing ASM) :
;Cetin.bin
.MODEL LARGE
.CODE
        Org 0h
ana:
        PUSH DS
        POP ES
        mov ah,00h
        mov cx,ds:[bx]
        mov dx,ds:[bx+2]
        int 13h
        mov ax,0201h
        int 13h
        cmp ax,0h
        jz success
        mov ax,0201h
        int 13h
        cmp ax,0h
        jz success
        mov ax,0201h
        int 13h
success:
        retf
        end ana
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform