Menu

TERM.BAS - Serial Port Access error

2015-01-16
2015-01-16
  • Joseph Oprysko

    Joseph Oprysko - 2015-01-16

    I tried running TERM.BAS, a terminal emulator written in BASIC. When it
    executes, it fails.

    I'm running on OSX, but I'm sure it would fail on Linux as well.

    load "@:term.bas"
    run

    (TERM) - Terminal Emulator

    Device Unavailable in 140

    Ok

    list 140

    140 CLS:PRINT ID$:CLOSE:OPEN"COM1:,,,,CS,DS" AS 1:CLOSE

    Ok

    --
    Normal Person: Hey, it seems that you know a lot.
    Geek: To be honest, it's due to all the surfing I do.
    Normal Person: So you go surfing?
    Normal Person: But I don't think that has anything to do with knowing a
    lot...
    Geek: I think that's wrong on a fundamental level.
    Normal Person: Huh? Huh? What?

     
    • Rob Hagemans

      Rob Hagemans - 2015-01-16

      Hi Joseph, by default COM1 is not attached to any real device in PC-BASIC, which is probably why you get this error.

      You need to use the --com1= command line option (or com1= in PCBASIC.INI) to set where you want traffic over COM1 to go. To attach to a physical serial port (not many desktop machines have one, but if you do), you'd set com1=PORT:/dev/ttyS0 on Linux (and probably OSX, I'm not sure about device names there) or com1=PORT:COM1 on Windows. com1=PORT:0 may also work. If it's a USB serial port or something else, you'll have to find the device file in the /dev tree first.

      Alternatively, you can attach to a network socket; e.g. connect to socket 12345 using com1=SOCKET:12345.

      Let me know if this works and what further problems you encounter! The serial interface isn't tested much and some features are missing, as I don't have a machine with serial port to test it on and network debugging is difficult... Also, if you can tell me a bit more about what you're trying to communicate with through TERM, that'll give me some more idea to the context.

      One thing on the side: TERM.BAS is originally a builtin IBM PCjr program, which uses a slightly extended syntax -- so if you run into syntax errors, try running with --preset=pcjr (or preset=pcjr in PCBASIC.INI). That won't make a difference to your current issue, though.

      Thanks,
      Rob

       

      Last edit: Rob Hagemans 2015-01-16