1

I need a code listing for 6802 (or 6809) to initialize and set the 6850 ACIA into bidirectional serial I/O mode.

I have two vintage boards and need to get the ports working and connected before I can do anything with them.

The relevant Motorola App Note is missing from my collection (AN-754), and everything else I have points to that.

Most references talk about the registers, but not how poll/monitor or control flow...code

  • 2
    Before answering, have you ever written serial code, or interface code at all? – Raffzahn Aug 31 '20 at 17:37
  • 1
    Yes, but about the time the MC6850 was a new chip, and so was I... – Joe Blackburn Aug 31 '20 at 19:25
  • 1
    If you can find a copy¹ , The 68000 Microprocessor by Andrew M. Veronis has a section on interfacing to the 6850 (pp. 92-104). Though the book is about designing 68000-based systems that section provides a pretty good overview of how to interact with the chip both on a hardware and a software level. Most of the section is about the 6850 and isn't specific to the 68k. ¹ This is on Google Books but it'll take a bit of coaxing to get Google to show those pages. – Alex Hajnal Aug 31 '20 at 23:35
2

initialize and set the 6850 ACIA into bidirectional serial I/O mode.

Google "6850 ACIA" and look at the pin out. There is a "Tx Data" line and an "Rx Data" line on the chip. It's already bidirectional.

If you want it unidirectional you have to not do one of these things:

  • When you setup the chip, you have to put a 1 into bit 7 of the Control Register to "Receive Interrupt Enable". You need an IRQ routine that will check bit 0 of the Status Register to ensure that's what caused the IRQ and then get the data from the Receive Data register and put it into a buffer.

  • I'm guessing if you write a byte to the Transmit Data Register, the ACIA will start sending it and generate an IRQ when it's done. Your IRQ routine needs to check bit 1 of the Status Register to ensure that's what caused the IRQ and then put new data from a buffer into the Transmit Data Register.

It does look like you have to "Master Reset" the chip by writing 1s into the "Counter Divide" bits and then write 00, 10, or 01 - not sure what the correct value is for your boards/application.

but not how poll/monitor or control flow...code

On a CPU of this type, you're basically having to build a small system that feeds/eats bytes in/out of the ACIA from a buffer that is separately filled using other routines. This is too application specific to make general code for.

2

Most references talk about the registers,

'cause that's all there is.

but not how poll/monitor or control flow...code

Polling is done by reading the status register.

  • To see if data has been received, one reads the status register (Offset 0) and checks bit 0:

    • If set, a character has been received, which can now be read from the data register (Offset 0).
  • To see i data can be send, again the status register is to be read, just this time bit 1 tells the story:

    • If set, the resister is empty, and a character can written into (to be send).

Or, as pseudo C like code:

while(1)
{
  char status = read_status_port;
  if(status & 1)
    read_byte_from_ACIA();
  if(status & 2)
    write_byte_to_ACIA();
}

Yes, it's that simple. Of course I can't tell how to handle your buffers, detect transmission end or alike. this is just the serial handling. Everythign else depends on your application structure and goal ... as usual.

And yes, one could get into background operation with interrupts and alike to operate in parallel with some program and so on, but i guess that is out of scope here.

  • I was harbouring the impression that it was far more complex. Okay, Now that I have the AN-754 App Note, and two very effective code samples (Terminal I/O and Console) it looks much better. Will see If I can get the laptop talking to the boards so I can grab the Monitor Rom's from them... – Joe Blackburn Aug 31 '20 at 19:33
  • 1
    @JoeBlackburn Keep in mind, it's very basic. basic communication is that simple. It's the many layers that make it complex - the natural side effect of making it more convenient and powerful. What are the boards? – Raffzahn Aug 31 '20 at 19:53
  • Student boards we used to teach college engineering students with, as "Project Boards". Based on Peter A. Stark's "Kilobaud Computer" that was run in the magazine, and later sold as controller kit. The 6809 was an enhanced version, used to teach Electrohome staff who were working on the Telidon/VideoTex Decoders for Canada's Telidon. Both boards had Ram, 2716 ROM, two 6821's and one 6850 on board. The 6809 version was built up with the 1488/1489's and connectors on-board for two RS-232 Ports. Older, 6802 board had the chips but no 1488/1489's or connectors - just a wire-wrap area – Joe Blackburn Sep 9 '20 at 14:28
  • @JoeBlackburn Oh, sounds like real cool boards. Mid to add a picture each to the question? Not that it's necessary in any way, but I'd love to see them. – Raffzahn Sep 9 '20 at 19:19
0

Here is my code for 6809 / 6850 for my homebrew computer. Hope it helps.

Anyway, the communication is bidirectional "by nature", the ACIA can transmit and receive data at the same moment (but only one byte at once).

You can combine both those routines to one "transmit-and-read-if-necessary" and call it often, or by an interrupt.

 ; serial

ACIA        EQU     $83fe  ;base address
ACIAC       EQU     ACIA   ;control register
ACIAS       EQU     ACIA   ;status register
ACIAD       EQU     ACIA+1 ;data register

INIT:       LDA     #$15 
            STA     ACIAC 

ACIA_TDRE   EQU     02h 
ACIA_RDRF   EQU     01h 


; send one byte from A to serial

SEROUT:             
            PSHS    a,b 
SEROUTL:            
            LDB     ACIAS 
            ANDB    #ACIA_TDRE 
            BEQ     seroutl 
            STA     ACIAD 
            PULS    a,b 
            RTS     

; Wait for serial char to read

SERIN:              
            LDA     ACIAS 
            ANDA    #ACIA_RDRF 
            BEQ     serin 
            LDA     ACIAD 
            RTS     
  • Thanks That answers it! Yes, the 6809 code will be compatible. The first board has a MC6802, the second is a 6809. – Joe Blackburn Sep 9 '20 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.