Serial Printer I/O Configuration

85 views
Skip to first unread message

Hendrik Magilsen

unread,
Jul 6, 2024, 6:00:33 PMJul 6
to Altair-Duino
Now that I have 2 functioning serial IO ports (Thanks David!), I'm attempting to connect to a serial printer.  I have a retro Radio Shack TP-10 Thermal 4 inch printer.  I can get it to work (mostly) by sending characters to it a byte at a time via the OUT command in basic.  I haven't quite got the timing worked out yet (If I add a small delay between characters and allow time for a carriage return to physically happen, then the printer is happy).  Figuring out flow control with CTS which the printer happily sends me is on my to-do list.  But so far this is all low level throwing bits to the port.

I'm also trying to understand how to configure the simulator and BASIC  to know I have a serial printer connected so things like LPRINT and LLIST work.  I see some printer related configurations in the Config menu, but it's not super clear to me. 

Have been searching for Altair and Basic documentation but can't quite pin it down.  Looking for a few more bread crumbs :-)

da...@hansels.net

unread,
Jul 6, 2024, 6:22:22 PMJul 6
to Altair-Duino
If you are using a hardware serial card then the simulator configuration does not matter.
It's just like if you had a real Altair with a 88-2SIO serial card that has a printer attached to it.
The Simulator printer configuration only matters if you are using an emulated printer port.

If you want to get Altair BASIC to work with your serial printer then you'll likely have to modify BASIC
itself. As far as I know it's hard-coded to talk to a parallel printer.

For BASIC within CP/M it may be possible that changing the IOBYTE settings will affect where
BASIC sends its printer output but I'm not sure. Others will know more about the IOBYTE settings
and how they affect programs running within CP/M.

David

Patrick Linstruth

unread,
Jul 6, 2024, 6:40:21 PMJul 6
to Altair-Duino
The 2SIO with 6850 ACIA will not transmit if CTS is not active. When CTS goes low, the Transmit Buffer Empty bit is also goes low even if it’s empty. Are you checking that the Transmit Buffer Empty bit of the status port is high before sending a character?

-- 
You received this message because you are subscribed to the Google Groups "Altair-Duino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altair-duino...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/altair-duino/6f4c47e1-d7b5-4705-86ab-a1a892d50e6bn%40googlegroups.com.

Hendrik Magilsen

unread,
Jul 7, 2024, 8:01:17 AMJul 7
to Altair-Duino
Thanks David.  I was sort of afraid of that, but wasn't sure how far the simulator would go to accommodate me.  Thanks for the lead on IOBYTE, it's been a long time since I played in the realm of CP/M so hints are super helpful in narrowing the search path.  I guess I need to think building the centronics interface and looking for compatible hardware to my list (after I build a bigger backplane).

Hendrik Magilsen

unread,
Jul 7, 2024, 8:24:45 AMJul 7
to Altair-Duino
On Saturday, July 6, 2024 at 6:40:21 PM UTC-4 pat...@deltecent.com wrote:
The 2SIO with 6850 ACIA will not transmit if CTS is not active. When CTS goes low, the Transmit Buffer Empty bit is also goes low even if it’s empty. Are you checking that the Transmit Buffer Empty bit of the status port is high before sending a character?


I read that section on probing the control status and understand what to look for but not how.  The OUT function seems to be much better documented than IN :-).   So I can write to the ports, but not read from them yet.  Keeping my eyes open for a code fragment to help me with usage.  In the interim to prove that the card build works I've just been padding with a simple For/Next loop delay while I test the interface.  (It's also how I solved the mystery of port number vs jumper config :-) ). 

Patrick Linstruth

unread,
Jul 7, 2024, 2:47:54 PMJul 7
to Altair-Duino
Here is a small MBASIC program with GISUB routines that will check for a character, read a character, and send a character using a 2SIO port:

10 GOSUB 1000

20 GOSUB 1100

30 PRINT A

40 A=ASC("*")

50 GOSUB 1300

60 GOSUB 1200

70 PRINT CHR$(A)

999 END

1000 REM 2SIO BASIC SUBROUTINES

1010 REM SET 2SIOPORT TO BASE ADDRESS

1020 SIOPORT=&H12

1030 RDRF=1:TDRE=2

1050 OUT SIOPORT,3

1060 OUT SIOPORT,15

1070 RETURN

1100 REM 1100 CONST - RETURNS TRUE IF CHARACTER AVAILABE

1110 A=INP(SIOPORT)

1120 A=A AND RDRF

1130 RETURN

1200 REM 1200 CONIN - RETURNS INPUT CHARACTER IN A VARIABLE

1210 WAIT SIOPORT,RDRF

1220 A=INP(SIOPORT+1)

1230 RETURN

1300 REM 1300 CONOUT - SEND CHARACTER IN A VARIABLE

1310 WAIT SIOPORT,TDRE

1320 OUT SIOPORT+1,A

1330 RETURN


1000 - Sets the variables and initializes the 2SIO port
1100 - Returns a non-zero value if a character is available to read
1200 - Waits for and returns a character in “A”
1300 - Waits for transmit buffer empty and sends character in “A”

--
You received this message because you are subscribed to the Google Groups "Altair-Duino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altair-duino...@googlegroups.com.

da...@hansels.net

unread,
Jul 7, 2024, 5:32:22 PMJul 7
to Altair-Duino
On Sunday, July 7, 2024 at 2:24:45 PM UTC+2 ve3...@gmail.com wrote:
[...] I can write to the ports, but not read from them yet. 

If I remember correctly, the 8650 ACIA on the 88-2SIO will not receive data if the DCD (data carrier detect)
input signal is HIGH. Try pulling the DCD input low and see if you can read.

Patrick Linstruth

unread,
Jul 7, 2024, 6:02:14 PMJul 7
to Altair-Duino
David is talking /DCD at the TTL level at the 6850. /DCD and /CTS are active low so they would need to be pulled to ground in order to enable the transmitter and receiver. If you’re going to provide DCD on the RS232 side, you will need to pull them high from RTS or another RS232 signal. I like to use an RS232 breakout box for that purpose.

And these two lines of the MBASIC program should be changed to:

1050 OUT SIOPORT,&H03

1060 OUT SIOPORT,&H15


I forgot to make those values hexadecimal.

Patrick

--
You received this message because you are subscribed to the Google Groups "Altair-Duino" group.
To unsubscribe from this group and stop receiving emails from it, send an email to altair-duino...@googlegroups.com.

Hendrik Magilsen

unread,
Jul 8, 2024, 5:26:11 PM (14 days ago) Jul 8
to Altair-Duino
Thanks!  A few things for me to try over the next week and experiment with.  Good point about pulling the unused signals high/low.   I miss my trusty old RS232 breakout box. :-)   These Aliexpress MAX232 modules generally don't carry over all the signals.  Best I've found is VCC/GND, TX/RX, CTS/RTS.  I may have to build my own.  

I've done some quick testing and I can see the CTS signal flipping the appropriate bit based on printer status, but so far all my WAIT statement seems to do is lock up my Altair forcing me to reset/restart (and re-enter my test programs again).

Further testing to follow later this week when I can spend more than 5 minutes at a time on the bench :-)

Thanks for the insights and sample code!  I keep reminding myself, the fun is in the journey, not the destination.

Patrick Linstruth

unread,
Jul 8, 2024, 7:31:33 PM (14 days ago) Jul 8
to Altair-Duino
The program should send a ‘*’ and then wait for a character and print that character on the screen. 

I will write another one that doesn’t use WAIT so you can break out of the program and test on real hardware. 

Sent from my iPhone

On Jul 8, 2024, at 5:26 PM, Hendrik Magilsen <ve3...@gmail.com> wrote:

Thanks!  A few things for me to try over the next week and experiment with.  Good point about pulling the unused signals high/low.   I miss my trusty old RS232 breakout box. :-)   These Aliexpress MAX232 modules generally don't carry over all the signals.  Best I've found is VCC/GND, TX/RX, CTS/RTS.  I may have to build my own.  

Patrick Linstruth

unread,
Jul 9, 2024, 7:41:41 AM (13 days ago) Jul 9
to Altair-Duino
Following is an updated version of the MBASIC code that eliminates the use of WAIT and will break on Ctrl-C while waiting to send or receive a character.

10 GOSUB 1000

20 GOSUB 1100

30 PRINT A

40 A=ASC("*")

50 GOSUB 1300

60 GOSUB 1200

70 PRINT CHR$(A)

999 END


1000 REM 2SIO BASIC SUBROUTINES

1010 REM SET SIOPORT TO BASE ADDRESS

1020 SIOPORT=&H12

1030 RDRF=1:TDRE=2

1050 OUT SIOPORT,&H03

1060 OUT SIOPORT,&H55

1070 RETURN

1100 REM 1100 CONST - RETURNS TRUE IF CHARACTER AVAILABE

1110 A=INP(SIOPORT)

1120 A=A AND RDRF

1130 RETURN

1200 REM 1200 CONIN - RETURNS INPUT CHARACTER IN A VARIABLE

1210 S=INP(SIOPORT)

1220 IF (S AND RDRF) <> RDRF THEN GOTO 1210

1230 A=INP(SIOPORT+1)

1240 RETURN

1300 REM 1300 CONOUT - SEND CHARACTER IN A VARIABLE

1310 S=INP(SIOPORT)

1320 IF (S AND TDRE) <> TDRE THEN GOTO 1310

1330 OUT SIOPORT+1,A

1340 RETURN


Reply all
Reply to author
Forward
0 new messages