SBUG monitor

In this section there is a look at SBUG monitor and sample code implementation using the monitor.

To access the comms port via SBUG you can use subroutine calls for characters In or Out. You can also do your own control of the port via following two assembly examples.

Receive a character (via ACIA Port)


The following sample code is examined in Leventhal's book, in 'Using a 6850', ch 14.5 .

Basically the aim is to:
  • set the control register of the comms port ($E000) ,
  • read the status register , and
  • if the IRQ (bit7) is set, save the character in Address $7060

Note this address range is used not to interfere with the Basic code.

Now because the ACIA is already reset and operating (within SBUG) we do not have to reset the control register. So then just read the status register and wait till IRQ flag is set ..then save the character data in $7060 memory location.

The listing of the code would be something like this:

0000                    ACIACR:   EQU   $E000  
0000                    ACIASR:   EQU   $E000  
0000                    ACIADR:   EQU   $E001  
7000                                    .ORG   $7000  
7000   B6 E0 00     WAITD:   LDA   ACIASR  
7003   44                             LSRA  
7004   24 FA                        BCC   WAITD  
7006   B6 E0 01                   LDA   ACIADR  
7009   B7 70 60                   STA   $7060  
700C   3F                             SWI  


This can be entered manually using the M command .. Here is a snapshot of the terminal screen.


As you can see the code data is entered $7000-$700C. The location $7060 is zeroed. After that the PC is set to $7000 and Go command issued to run the program.

Capital letter "A" was typed on the terminal  and the program returned to SBUG.. with listing of the registers including register A which has $42..equivalent to letter "A"

This was repeated again and letter "B" was typed ..with return value of $42 in register A.
Just to make sure it all worked OK memory location $7060 was also looked at and it has the value of $42.


So there you are easy way of capturing entered value via the ACIA chip.

Transmit a character (via ACIA port)

In a similar way we can transmit a single character with the following example. For more detail see Leventhal 14.6 .
The listing of the code would go something like this:

0000                     ACIACR:   EQU   $E000  
0000                     ACIASR:   EQU   $E000  
0000                     ACIADR:   EQU   $E001  
0000                     MASK:      EQU   00000010B  
7000                                     .ORG   $7000  
7000   86 02                           LDA   #MASK  
7002   B5 E0 00     WAITR:     BITA   ACIASR  
7005   27 FB                          BEQ   WAITR  
7007   B6 70 60                      LDA   $7060  
700A   B7 E0 01                     STA   ACIADR  
700D   3F                               SWI  


Load the above code and place $43 value in $7060 memory location (which when fetched will printout letter "C").



You can see from the above when the program loaded and run...it displays letter "C" after G .. and the value of reg A is $43 ... which is the code put out on the port.  Nice ...


Links