[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [N8VEM-S100:6719] CP/M or Basic and COM Ports....



Todd,

PEEK and POKE will READ/WRITE to Memory.  You need to look for a command to INPUT and OUTPUT a byte to I/O space.

In QBasic, you could write:

   a = INP(&h20)

and

   OUT &h20, b

I don't know MBasic, but would love the feed back when or if you find these commands.
If these commands are not available, look for a way to execute a machine language program and then I can help you with the 8080 codes to load the accumulator and output.  I think it's 3E to load, D3 to output and CD to return but let me confirm.  Inputing will be more tricky.

Now... here's what you need to OUTPUT and INPUT to talk to the 8250 UART.

BASE I/O Address for 1st Uart (used as console) is 0x20
The 2nd UART is at 0x28
My code below which is part of the firmware configures the UART for 9600 BAUD.  Please read the data sheet for 8250 for other baud rates.
(The clock is 18.432Mhz divided by 10).

        MVI    A,80H    ;Set baud rate
        OUT    UART0+3
        OUT    UART1+3
        MVI    A,12    ;12=9600 baud
        OUT    UART0
        OUT    UART1
        MVI    A,0
        OUT    UART0+1
        OUT    UART1+1
        MVI    A,3    ;Set 8 data bits, no parity, 1 stop
        OUT    UART0+3
        OUT    UART1+3


Where it says UART1+3, that makes it I/O address 0x2B

You can skip the baud setting if you don't wish to deviate from 9600, N,8,1

Next, to Send a byte... you must first test to see if the Transmit buffer is empty (or still sending the previous byte), then send the byte. 
Here's the 8080 code that does that.
LOOP      IN    UART0+5
                 ANI    20H    ;TEST FOR TX HOLD REG EMPTY
                JZ    LOOP
                 POP    PSW
                 OUT    UART0

So, INPUT IO at 0x2D and test for bit 0x20 to be SET or ON,  if not ON, then stay in loop.
When it's OFF, then output to 0x28 the desired byte.

eg, quick basic

100   a=INP(&H2D)
110   if (a and &h20) = 0 then 100
120   OUT &h28, char

Receiving data uses the flag at bit 1, like this.

200  a=INP(&H2D)
210  if (a and &h01) = 0 then 200
220  char=INP(&h28)

Hope that helps.  Good luck!

Regards,
Josh








Date: Sat, 11 Apr 2015 17:04:31 -0700
From: litte...@gmail.com
To: n8vem...@googlegroups.com
Subject: [N8VEM-S100:6719] CP/M or Basic and COM Ports....

I have Josh's 8080 board with COM1 being the console and
a ver 2.0 Console I/O board mirroring input/output on VGA.

Josh's board has a second COM port and I would like
to send text strings to it in Basic....

I have an old Digital DECtalk voice synthesizer I want
to play with.  I have a Mbasic manual but didn't see
anything, perhaps I could 'PEEK" it, but I don't know
how to talk to the UART.

Anyone have an idea on or point me in a direction ?



--
You received this message because you are subscribed to the Google Groups "N8VEM-S100" group.
To unsubscribe from this group and stop receiving emails from it, send an email to n8vem-s100+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.