I'm really hoping someone can help me on this, I may have overlooked some info somewhere doing numerous searches in the past week, but what I'm trying to do is quite simple.
I have a handheld inventory device (circa early 90's but still in prolific use in the industry) that sends data to a PC via the serial port. I do have the manufacturer's app in DOS that facilitates this, and it works in Windows, but in Linux I need to use dosemu (dosbox won't work), and on Mac OSX you can not use dosemu at all (just dosbox). So I'm trying to write a simple program to do this in legacy basic (I know Quick Basic, also python, but not Visual Basic or C). It will be a non-gui app, just one run in the console as part of a script.
I actually figured out how to get the device to send the data, and I know all the parameters to open / close the port etc. But so far I can only do this using a terminal emulator, and not an actual program where I can read the data into arrays and save it to files.
Ok, without trying to get too wordy here, this is what I got to work:
In Windows XP, I downloaded a shareware program called Eltima's "Advanced Serial Port Terminal". I open the terminal and com1 with 19200, none, 8, 1 and no flow control, then hook up the device and put it in send mode. Then I send a hexadecimal 43 (character "C") to the port and the device spits out its first block of 133 characters, which appear on the terminal screen. All the data is in blocks of 133, even the last block. To get the next block, I send a hexadecimal 06 ("ACK"), and the next data scrolls on the screen. If at any point I send a 43 as I did to get the first block, it repeats the previous block. After the last block, when I send an 06, the machine sends an 04 (end of transmission), and then I can close the port.
I need to somehow save the data I see on the screen into an array, and write it (later) to a data file, which I can later parse and get the data I need. I just can't figure out exactly what to do, and I tried a bunch of things.
I'd like to use an older Basic, as I can get one (such as Chipmunk basic) that works on OS X as well (my final target platform), and by coming up with something that works, I finally won't need any more DOS emulators or virtual machines.
Not sure if I need to out the INP or OUT statements rather than try to INPUT from #1 (etc), or need use some sort of direct hardware address. Nor if this project can even be done in an "early" basic. I would like to keep away from learning visual basic as I need to make the source code compilable cross platform for Linux & Mac too, as mentioned.
On this particular windows box, the I/O range for com1 shows as 03F8-03FF with interrupt 4.
Any clues on where to go from here would be sincerely appreciated.
Thanks in advance.

OK, I've made a bit of progress, using code from www.garypeek.com, I stripped his code down to a minimal terminal with the exact parameters I need that can do the same thing as the shareware terminal app, and actually in the course of this, have the output characters in variables before printing them out. The code (and this is in ancient basic) compiles fine on Quick Basic V1 from 1986):

90 KEY OFF:FOR A=1 TO 10:KEY A,"":NEXT
100 CLS
110 PRINT "DATACOMPUTER TRANSMIT APP OCT 2008"
120 PRINT
190 PRINT
195 PRINT "enter F9 to open port"
200 PRINT "or escape to exit"
210 B$=INKEY$:IF B$="" THEN 210
300 IF B$=CHR$(0)+CHR$(67) THEN OPEN "COM1:19200,N,8,1,CS,DS,CD" AS 1:GOTO 340
320 IF B$=CHR$(27) THEN COLOR 7,0:END
330 GOTO 100
340 CLS
350 PRINT "Now in terminal mode, use F10 to EXIT"
355 PRINT "Enter C to start first block or repeat a block"
357 PRINT "Enter N for the next block"
360 PRINT:LOCATE ,,1
370 REM ********** TERMINAL LOOP **********
380 IF EOF(1) THEN 410
390 A$=INPUT$(1,#1)
400 PRINT A$;
405 IF EOF(1) THEN PRINT
410 B$=INKEY$:IF B$="" THEN 380
420 IF B$=CHR$(0)+CHR$(68) THEN CLOSE:GOTO 100
425 IF B$=CHR$(78) THEN B$=CHR$(6)
430 PRINT #1,B$;
440 GOTO 380

I start it up, first use "C", and then "N" which is turned into a Hex 06, and can gingerly step through all the data to the end, using the "N" characters.
Next step is to try putting it into arrays of 133 bytes and save them, and to also automate the process, perhaps putting in a few "sleep/wait a bit" commands so as not to let it get ahead of itself.
Any suggestions, please add to this, and if I am welcome to, I will post later again what I end up with after some more experimentation.
Parts of each block, or at least the first block of each section (the manufacturer's dos app actually creates 3 files from that data and saves them to the hard drive) are header info and not the actual data I need, so I will have to step through the byte-by-byte data and see where the useful info begins.

But anyway, at least so far I have a clumsy way of getting the data out and the start of getting it into variables.

Well, I did get a lot further along, but the data is gibberish to me. Can anyone take a look at this and tell if it's compressed, encrypted, in EBCDIC, or some shifting that I can decrypt somehow? The data is supposed to be straight strings of numbers, with some line feeds. As you can see, the first filename (subtotal.dat) appears in the string, and I stop it at where the second filename appears (invtx.dat), but in between that it appears to be far from strings of numbers which is what I get when I use the manufacturer's proprietary dos app. If I can't make anything from the data I'm back at square one.
If need be, I can post exactly what lines of numbers are derived from this if it is done using the manufacturer's app, so it can be traced somehow.
Thanks for any help.

Write data

00000000: 43                                                     C                 

Read data

00000000: 01 01 FE 30 30 30 30 31  |  31 30 30 30 30 30 31 30    ..þ0000110000010  
00000010: 34 30 30 30 30 30 30 30  |  30 30 31 20 20 20 20 20    40000000001       
00000020: 20 20 20 20 20 20 20 20  |  20 20 20 20 20 20 20 20                      
00000030: 20 20 20 20 20 20 20 20  |  20 20 20 20 20 20 20 20                      
00000040: 20 20 20 53 55 42 54 4F  |  54 41 4C 2E 44 41 54 20       SUBTOTAL.DAT   
00000050: 20 20 20 20 20 20 20 20  |  20 20 20 20 20 20 20 20                      
00000060: 20 20 20 20 20 20 20 20  |  20 20 20 36 00 00 00 00               6....  
00000070: 00 07 00 0F 00 00 00 03  |  00 0E 00 00 00 07 00 0E    ................  
00000080: 00 00 00 C0 B2                                         ...À²             

Write data

00000000: 06                                                     .                 

Read data

00000000: 01 02 FD 0C 00 0E 00 00  |  00 0C 00 0E 00 00 00 0A    ..ý.............  
00000010: 00 0E 00 00 00 04 00 0E  |  00 00 00 00 00 00 00 00    ................  
00000020: 00 0E 00 30 10 0D 7D AE  |  15 61 49 E5 AA 07 B5 A3    ...0..}®.aIåª.µ£  
00000030: 90 0E 00 30 10 1D 7D AE  |  15 61 47 EC BA 07 7B A3    ..0..}®.aGìº.{£  
00000040: 70 0D 00 30 10 2D 7D AE  |  15 61 3B E5 D0 68 73 60    p..0.-}®.a;åÐhs`  
00000050: 0E 00 30 10 3D 7D AE 15  |  61 4A 78 E9 07 6C E3 60    ..0.=}®.aJxé.lã`  
00000060: 0E 00 30 20 0D 7D AE 15  |  61 4A AC 76 07 A9 73 A0    ..0 .}®.aJ¬v.©s   
00000070: 0E 00 30 20 1D 7D AE 15  |  61 4B BB A6 07 BB E3 90    ..0 .}®.aK»¦.»ã  
00000080: 0C 00 30 E0 D8                                         ..0àØ             

Write data

00000000: 06                                                     .                 

Read data

00000000: 01 03 FC 20 2D 7E 71 46  |  14 6B B9 C0 6E 82 0D 00    ..ü -~qF.k¹Àn..  
00000010: 30 20 3D 7D A1 46 14 6A  |  98 C0 76 6C 36 0E 00 30    0 =}¡F.jÀvl6..0  
00000020: 20 3D 7D A8 15 61 49 5C  |  E7 07 DC B3 70 0C 00 30     =}¨.aI\ç.ܳp..0  
00000030: 30 0D 7D A6 15 61 37 8B  |  80 5C 20 0D 00 30 30 0D    0.}¦.a7\ ..00.  
00000040: 7D A7 15 61 46 B7 7D 06  |  C7 37 0E 00 30 30 0D 7D    }§.aF·}.Ç7..00.}  
00000050: A9 15 61 56 47 99 07 9E  |  B3 90 0C 00 30 30 0D 7D    ©.aVG.³..00.}  
00000060: AC 15 61 37 BD 90 66 D2  |  0E 00 30 30 0D 7D AE 15    ¬.a7½fÒ..00.}®.  
00000070: 61 49 6D EC 07 79 83 70  |  0F 00 30 30 1D 7D A8 15    aImì.yp..00.}¨.  
00000080: 61 58 9A CC 6A                                         aXÌj             

Write data

00000000: 06                                                     .                 

Read data

00000000: 01 04 FB 66 80 88 A9 84  |  6B 0D 00 31 10 0D 7E 57    ..ûf©k..1..~W  
00000010: 15 61 4A BE 79 06 EB 37  |  0E 00 31 20 0D 7E 57 15    .aJ¾y.ë7..1 .~W.  
00000020: 61 56 56 E7 C0 79 68 38  |  0D 00 31 40 0D 7E 71 46    aVVçÀyh8..1@.~qF  
00000030: 14 8B C5 60 77 6E 36 0D  |  00 31 50 0D 7E 71 46 14    .Å`wn6..1P.~qF.  
00000040: AA ED B0 79 59 36 0C 00  |  31 60 0D 7E 71 46 14 A6    ªí°yY6..1`.~qF.¦  
00000050: 66 06 89 10 0D 00 31 6D  |  30 D7 DA 81 56 13 6A B8    f....1m0×ÚV.j¸  
00000060: 06 6D 20 0E 00 31 6D 30  |  D7 E7 14 61 4B 77 BD 07    .m ..1m0×ç.aKw½.  
00000070: 98 73 60 0D 00 31 71 0D  |  7E 71 46 14 B5 6D 90 79    s`..1q.~qF.µmy  
00000080: 7B 36 0D ED E5                                         {6.íå             

Write data

00000000: 06                                                     .                 

Read data

00000000: 01 05 FA 00 31 81 0D 7E  |  71 46 14 9B A5 C0 77 E8    ..ú.1.~qF.¥Àwè  
00000010: 37 0C 00 32 00 0D 7E 71  |  46 14 BE 6C 06 A6 10 0D    7..2..~qF.¾l.¦..  
00000020: 00 32 10 0D 7E 71 46 14  |  D4 A9 07 8D B3 60 0D 00    .2..~qF.Ô©.³`..  
00000030: 32 20 0D 7E 71 46 14 8D  |  B9 60 77 DE 36 0C 00 32    2 .~qF.¹`wÞ6..2  
00000040: 30 0D 7D CA 15 61 3B 9A  |  70 56 20 0D 00 32 30 0D    0.}Ê.a;pV ..20.  
00000050: 7E 71 46 14 BB CE 90 77  |  CB 36 0B 00 35 21 1D 7D    ~qF.»ÎwË6..5!.}  
00000060: A8 15 61 3F A0 5E 10 0E  |  00 35 21 1D 7D AE 15 61    ¨.a? ^...5!.}®.a  
00000070: 47 E5 CC 07 99 83 60 0E  |  00 35 21 1D 7E 57 15 61    GåÌ.`..5!.~W.a  
00000080: 4C 59 C8 E7 72                                         LYÈçr             

Write data

00000000: 06                                                     .                 

Read data

00000000: 01 06 F9 07 79 E3 70 0C  |  00 35 21 1D 7E 67 15 61    ..ù.yãp..5!.~g.a  
00000010: 38 78 C0 66 82 0E 00 35  |  21 1D 7E 71 46 15 79 DC    8xÀf..5!.~qF.yÜ  
00000020: C9 08 69 8E 3C 0C 00 35  |  30 F6 07 DA E1 56 12 D9    É.i<..50ö.ÚáV.Ù  
00000030: E0 66 62 0C 00 35 30 F6  |  07 E7 14 61 38 BF 06 76    àfb..50ö.ç.a8¿.v  
00000040: 36 0C 00 35 40 0D 7D AC  |  15 61 38 DE C0 58 36 0C    6..5@.}¬.a8ÞÀX6.  
00000050: 00 35 40 0D 7E 71 46 13  |  7D DC 06 68 20 0E 00 35    .5@.~qF.}Ü.h ..5  
00000060: 40 0D 7F 56 15 61 56 79  |  D8 B0 79 77 39 0B 00 35    @.V.aVyØ°yw9..5  
00000070: 40 0D 82 66 15 61 29 BD  |  05 72 0C 00 35 40 2D 7D    @.f.a)½.r..5@-}  
00000080: A6 15 61 1D 08                                         ¦.a..             

Write data

00000000: 06                                                     .                 

Read data

00000000: 01 07 F8 39 6A E0 66 62  |  0B 00 35 40 2D 7D A9 15    ..ø9jàfb..5@-}©.  
00000010: 61 28 AB 05 92 0D 00 35  |  40 2D 7D AC 15 61 48 6D    a(«...5@-}¬.aHm  
00000020: AB 06 99 36 0E 00 35 40  |  3D 7F 58 15 61 56 97 CA    «.6..5@=X.aVÊ  
00000030: A0 77 9E 37 0E 00 35 41  |  2D 7E 57 15 61 56 DA 4A     w7..5A-~W.aVÚJ  
00000040: 07 6C A3 80 0F 00 35 6D  |  3F 60 7D 5E 15 61 57 E7    .l£..5m?`}^.aWç  
00000050: EC D0 7B D7 39 0E 00 35  |  6D 3F 60 7D 61 46 14 DD    ìÐ{×9..5m?`}aF.Ý  
00000060: 65 70 77 8D 36 0E 00 35  |  6D 3F 60 7D 66 15 61 47    epw6..5m?`}f.aG  
00000070: 98 9B 06 E9 20 0E 00 35  |  6D 3F 60 7D A8 15 61 4B    .é ..5m?`}¨.aK  
00000080: 7B B0 76 17 BA                                         {°v.º             

Write data

00000000: 06                                                     .                 

Read data

00000000: 01 08 F7 47 37 0D 00 35  |  6D 3F 60 7D A9 15 61 3C    ..÷G7..5m?`}©.a<  
00000010: E6 C0 69 82 0F 00 35 6D  |  3F 60 7D AC 15 61 56 8D    æÀi..5m?`}¬.aV  
00000020: A5 60 76 9E 37 0D 00 35  |  6D 3F 60 7D AE 15 61 39    ¥`v7..5m?`}®.a9  
00000030: C5 60 6A B2 0C 00 35 6D  |  3F 60 7D D6 15 61 36 A0    Å`j²..5m?`}Ö.a6   
00000040: 46 72 0E 00 35 6D 3F 60  |  7E 67 15 61 56 7A 56 06    Fr..5m?`~g.aVzV.  
00000050: 9E 29 0B 00 35 6D 3F 60  |  7E 71 46 12 FD 05 72 0D    )..5m?`~qF.ý.r.  
00000060: 00 35 6D 3F 60 81 AA 15  |  61 37 BC C0 67 82 0C 00    .5m?`ª.a7¼Àg..  
00000070: 35 6D 3F 60 82 61 46 13  |  CF 60 5E 36 0E 00 35 6D    5m?`aF.Ï`^6..5m  
00000080: 44 D7 DA A9 32                                         D×Ú©2             

Write data

00000000: 06                                                     .                 

Read data

00000000: 01 09 F6 A1 56 14 7A DE  |  80 76 8C 36 0D 00 35 6D    ..ö¡V.zÞv6..5m  
00000010: 45 D7 DA 14 61 3D CE D0  |  67 73 60 0D 00 35 6D 45    E×Ú.a=ÎÐgs`..5mE  
00000020: D7 DA C1 56 13 DE 98 06  |  72 70 0D 00 35 81 4D 7D    ×ÚÁV.Þ.rp..5M}  
00000030: A8 15 61 3B 6B B0 6D 93  |  60 0E 00 35 81 4D 7D AE    ¨.a;k°m`..5M}®  
00000040: 15 61 4A CC 8C 07 A6 63  |  A0 0E 00 35 81 4D 7E 71    .aJÌ.¦c ..5M~q  
00000050: 46 15 69 AE CA 07 AE 63  |  70 00 00 30 30 30 30 31    F.i®Ê.®cp..00001  
00000060: 31 30 30 30 30 30 31 30  |  34 30 30 30 30 30 30 30    1000001040000000  
00000070: 30 30 31 20 20 20 20 20  |  20 20 20 20 20 20 20 20    001               
00000080: 20 20 20 E4 C5                                            äÅ             

Write data

00000000: 06                                                     .                 

Read data

00000000: 01 0A F5 20 20 20 20 20  |  20 20 20 20 20 20 20 20    ..õ               
00000010: 20 20 20 20 20 20 20 20  |  20 20 20 49 4E 56 54 58               INVTX  
00000020: 2E 44 41 54 20 20 20 20  |  20 20 20 20 20 20 20 20    .DAT              
00000030: 20 20 20 20 20 20 20 20  |  20 20 20 20 20 20 20 20                      
00000040: 20 20 20 36 00 00 00 00  |  00 05 00 0E 00 00 00 0A       6............  
00000050: 00 0E 00 00 00 04 00 0E  |  00 00 00 04 00 0E 00 00    ................  
00000060: 00 04 00 0E 00 00 00 04  |  00 0E 00 00 00 01 00 0E    ................  
00000070: 00 00 00 00 00 00 00 00  |  00 08 00 26 14 95 E3 93    ...........&.ã

It is unlikely to be ebcdic if it was a handheld inventory device made in the 90's, more likely ascii. It is more likely that you are looking at a hex dump, or the device is sending the equivalent of a hex dump and you will need to know the data format in order to interpret it properly. For example 0x20 is the space character.

You can look for the last freeware version of procomm and do this easily in the script language that is included called aspect.

You *absolutely* need to get the data transfer specs from the vendor. With that, this type of work is a walk in the park. Without it, there is a lot of reverse engineering to do.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.