News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

True DOS program help, please?

Started by KrisB, April 25, 2005, 02:30:05 PM

Previous topic - Next topic

roticv

It is easy to write to and read from a CSV database. Reading of data from the CSV database would be slightly harder than storing it, but it is possible - all it requires is some parsing.

Just follow the steps P1 has given and you will be fine.

P1

Quote from: MichaelW on April 27, 2005, 06:17:53 AM... QBASIC is an interpreter with limited capacity (nominally 160KB code and data combined). ...
Michael, Thanks for the clarification.  I meant to say Quick Basic & Quick C.  I have seen these around for sale, at used software places.

Kris, Let us know if you need any further support on this.  Including the Quick Basic, I have a library of routines, I could clip from.  The believe it or not category, I maintain several old apps from Quick Basic, here at work, which I am in the process of re-writing and updating.

Regards,  P1  :8)

rea

I suguest if there exist a command line tool that can access the server learn how to use it and with that you will have the necesary for take over, what I dont know is how you will doit in 16 bits, with a console application will be far more easy because you have the help f Windows I guess.

BigDaddy

Actually, this sounds do-able.  Wish we weren't so busy at work (and prefer tab-delimited, but oh well.) 

Given your description, this database could easily end up with records that are all the same length, which would be wonderful, and make your job much easier.  Besides, it doesn't sound like quotes and commas embedded in the data are going to get in your way. 

Can you give us a typical record?  Maybe ambition will strike over the weekend. 

KrisB

Quote from: BigDaddy on April 27, 2005, 06:30:09 PM
Actually, this sounds do-able.  Wish we weren't so busy at work (and prefer tab-delimited, but oh well.) 

Given your description, this database could easily end up with records that are all the same length, which would be wonderful, and make your job much easier.  Besides, it doesn't sound like quotes and commas embedded in the data are going to get in your way. 

Can you give us a typical record?  Maybe ambition will strike over the weekend. 


The database comes with a lot of extras.
"ZIP_CODE","CITY","STATE","AREA_CODE","CITY_ALIAS_NAME","CITY_ALIAS_ABBR","CITY_TYPE","COUNTY_NAME","COUNTY_FIPS","TIME_ZONE","DAY_LIGHT_SAVING","LATITUDE","LONGITUDE","ELEVATION"
"00501","HOLTSVILLE","NY","516","HOLTSVILLE","","P","SUFFOLK","103","5","Y","40.8153","73.0456","25"

Thanks! :)
Kris

KrisB

Quote from: P1 on April 27, 2005, 02:30:08 PM
Quote from: MichaelW on April 27, 2005, 06:17:53 AM... QBASIC is an interpreter with limited capacity (nominally 160KB code and data combined). ...
Michael, Thanks for the clarification.  I meant to say Quick Basic & Quick C.  I have seen these around for sale, at used software places.

Kris, Let us know if you need any further support on this.  Including the Quick Basic, I have a library of routines, I could clip from.  The believe it or not category, I maintain several old apps from Quick Basic, here at work, which I am in the process of re-writing and updating.

Regards,  P1  :8)

*grin*
You've been wonderful. I THINK I'm getting closer, but it always seems to be just out of reach.
I plan on looking into Quick Basic / Quick C to see what they are like.
Ya see, the sad thing about me is, when I get an idea in my head, I work on it to death before I allow myself to try something different.
Honestly, I am getting closer to "and now for something COMPLETELY different...."

Thanks again!
Kris

P1

Quote from: KrisB on April 27, 2005, 06:51:16 PM
The database comes with a lot of extras.
"ZIP_CODE","CITY","STATE","AREA_CODE","CITY_ALIAS_NAME","CITY_ALIAS_ABBR","CITY_TYPE","COUNTY_NAME","COUNTY_FIPS","TIME_ZONE","DAY_LIGHT_SAVING","LATITUDE","LONGITUDE","ELEVATION"
"00501","HOLTSVILLE","NY","516","HOLTSVILLE","","P","SUFFOLK","103","5","Y","40.8153","73.0456","25"
Setup your export to output working data for use.  If you don't use it, don't export it.  You can always link back later, if necessary.

Your best bet for a Compilier DOS Basic is:
http://www.powerbasic.com/products/pbvision/ 
And for twenty dollars you can't beat that with a stick.

Regards,  P1  :8)

KrisB

Quote from: P1 on April 28, 2005, 04:39:19 AM
Quote from: KrisB on April 27, 2005, 06:51:16 PM
The database comes with a lot of extras.
"ZIP_CODE","CITY","STATE","AREA_CODE","CITY_ALIAS_NAME","CITY_ALIAS_ABBR","CITY_TYPE","COUNTY_NAME","COUNTY_FIPS","TIME_ZONE","DAY_LIGHT_SAVING","LATITUDE","LONGITUDE","ELEVATION"
"00501","HOLTSVILLE","NY","516","HOLTSVILLE","","P","SUFFOLK","103","5","Y","40.8153","73.0456","25"
Setup your export to output working data for use.  If you don't use it, don't export it.  You can always link back later, if necessary.

Your best bet for a Compilier DOS Basic is:
http://www.powerbasic.com/products/pbvision/ 
And for twenty dollars you can't beat that with a stick.

Regards,  P1  :8)

Unfortunately, it is a long process in order for my company to purchase something, and I need it done before that process will be completed.

And you are correct, I only plan on pulling the ones we need: Time_Zone and Day_Light_Saving.

Kris

P1

Quote from: KrisB on April 28, 2005, 12:25:35 PMAnd you are correct, I only plan on pulling the ones we need: Time_Zone and Day_Light_Saving.
And ZIP_CODE.  From what I can tell.  This is a Local Time Zone TimeSync program for TrueDos.  Post an export of ZIP_CODE,Time_Zone,Day_Light_Saving in CSV.  And maybe we can help you knock this out.  And doing in MASM, would be an Education.  Are you including Canada in this export as well?  The all numeric format of the US would make the coding easier.

Regards,  P1  :8)

KrisB

Quote from: P1 on April 28, 2005, 01:59:51 PM
Quote from: KrisB on April 28, 2005, 12:25:35 PMAnd you are correct, I only plan on pulling the ones we need: Time_Zone and Day_Light_Saving.
And ZIP_CODE.  From what I can tell.  This is a Local Time Zone TimeSync program for TrueDos.  Post an export of ZIP_CODE,Time_Zone,Day_Light_Saving in CSV.  And maybe we can help you knock this out.  And doing in MASM, would be an Education.  Are you including Canada in this export as well?  The all numeric format of the US would make the coding easier.

Regards,  P1  :8)

Yes, and Zip_code!

Just the US. :)
Thank goodness.. at least for now!

Kris

MichaelW

#25
Another possibility for a compiler would be the FreeBASIC DOS-32 version.
Quote
FreeBASIC - as the name suggests - is a free, open-source, 32-bit, MS-QuickBASIC's syntax-compatible compiler, that adds new features such as pointers, unsigned data types, inline-assembly and many others.

FreeBASIC is still in beta, but it appears to be very stable. After a number of small projects (including a mouse hook demo) I have encountered no significant problems.

http://www.freebasic.net/

The FreeBASIC DOS-32 version requires a DPMI provider. Under Windows this is no problem. For DOS, you can download the recommended one (csdpmi5b.zip) here:

http://sunsite.utk.edu/ftp/pub/djgpp/djgpp/current/v2misc/

The FreeBASIC download includes some documentation and multiple examples (and the included changelog.txt is also useful). A partially completed help file is available here:

http://www.hybd.net/~mms/fb/help/current/contents.html

The attachment contains a demo that uses as sample data the Zip Code list available here (the sample is not included in the attachment):

http://www.powerbasic.com/files/pub/tools/data/


'----------------------------------------------------------
' Quick and dirty, loads the entire file into memory,
' does not implement a binary search (even though the
' list is sorted).
'----------------------------------------------------------
option explicit

declare function strtok (search as string,_
  delimiter as string) as string

dim i as long, nlines as long
dim junk as string, zip as string, tok as string

  on error goto errhandler
  open "zipcode.asc" for input as 1
  on error goto 0

  do
    line input #1, junk
    i += 1
  loop while not eof( 1 )
  nlines = i
  dim buffer( 1 to nlines ) as string

  seek #1, 1
  for i = 1 to nlines
    line input #1, buffer( i )
  next

  do
    input "Enter Zip Code:", zip
    if zip = "" then exit do
    zip = chr(34) + zip + chr(34)
    for i = 1 to nlines
      tok = strtok( buffer( i ), "," )
      if tok = zip then
        print buffer( i )
        exit for
      end if
    next
    if i > nlines then print "not found"
  loop

  print
  print "Press any key to exit..."
  sleep
  end

errhandler:

  print 
  print "error opening zipcode.asc"
  print "Press any key to exit..."
  sleep

'----------------------------------------------------------
function strtok (search as string, delimiter as string)_
  as string

  static save as string, saveLength as long, start as long
  dim tokLength as long, c as string * 1

  if search = "" then
    if save = "" then exit function
  else
    save = search
    saveLength = len( save )
    start = 1
  end if

  do while start + tokLength <= saveLength
    c = mid( save, start + toklength, 1 )
    if instr( delimiter, c ) then
      if tokLength then exit do
      start += 1
    else
      tokLength += 1
    end if
  loop

  strtok = mid( save , start, tokLength )

  start += tokLength

end function
'----------------------------------------------------------


The file zipcode.asm in the attachment is the actual output of the compiler.

EDIT:

Curious about why the exe was so large at 108032 bytes, I built the source (with no changes) as a Windows console app. The resulting exe was 22552 bytes (and it worked correctly).




[attachment deleted by admin]
eschew obfuscation

KrisB

Thanks to MichaelW, but I tried Basic (VB6) and the program needs to be for 16 bit dos, not 32 bit dos. If I could do it with Basic, it would be done! :)

I believe P1 asked for an example of the database. Here is a link to the page that offers a sample of the database.
http://www.zipcodeworld.com/zipcodepremium.htm

I am also attaching a zip of this same file.

I'm not sure why I am having such difficulty figuring this out. I guess my mind doesn't want to think backwards in time and programming languages. Everything I try, I realize after I've tried it, "oh yeah, that isn't going to compile because it is something new and I'm working with something older..."

I do wish to thank everyone for trying to help me out with this! You all have been wonderful!

Kris


[attachment deleted by admin]

MichaelW

QuoteThanks to MichaelW, but I tried Basic (VB6) and the program needs to be for 16 bit dos, not 32 bit dos. If I could do it with Basic, it would be done! :)

The so-called 32-bit DOS is 16-bit DOS running a DPMI provider (server). I tested under Windows 98 SE MS-DOS mode (which does not natively provide DPMI support). The DPMI provider (CWSDPMI.EXE) can be installed as a TSR before running zipcode.exe, or it can simply be placed in the same directory and zipcode.exe will find it and load it. It couldn't be easier :)


eschew obfuscation

rea

I have a question...

How a 16-bit app can manage to communicate with a 32-bit application without any DOS extender ¿?¿? or how a 16-bit application can use a 32-bit library???

Is posible do that?? (I have readed a DOS extender that even let you "load" DLLs... but what about 16bit apps¿?... haent used them).. or back to the Win 16 API ¿?¿?...

http://msdn.microsoft.com/library/en-us/dblibc/dbc_pdc00b_589v.asp I supose this is the more near API that can suit asm, but I think is for 32-bit applications...


MichaelW

eschew obfuscation