Close

Writing a Program

A project log for MIKBUG on Multicomp

MIKBUG Running on Multicomp with 6800 CPU

land-boardscomland-boards.com 03/02/2020 at 12:030 Comments

Now that the toolchain works, it is possible to write a program, assemble the program, enter the program in RAM, and then run the program.

The Assembler

The a68 Assembler is here. The MIKBUG debugger source file is here

Typing in a short program

Typing in a program is time consuming, There are standard entry points for the debugger I/O which can be called. The list file for the debugger is here.

A simple program example is to read a character from the PS/2 keyboard and then write it out to the Video Display Unit (VDU).

The function to input a character from the PS/2 keyboard is:

                        ;
                        ;    INPUT ONE CHAR INTO A-REGISTER
                        ;
   c1f3   8d fa         INEEE     BSR    SAV
   c1f5   b6 80 18      IN1    LDAA    ACIACS
   c1f8   47                ASRA
   c1f9   24 fa             BCC    IN1     ;RECEIVE NOT READY
   c1fb   b6 80 19          LDAA   ACIADA  ;INPUT CHARACTER
   c1fe   84 7f             ANDA   #$7F    ;RESET PARITY BIT
   c200   81 7f             CMPA   #$7F
   c202   27 f1             BEQ    IN1     ;IF RUBOUT, GET NEXT CHAR
   c204   7d 7f 0d          TST    ECHO
   c207   2f 01             BLE    OUTEEE
   c209   39                RTS

The function to output a character to the VDU is:

                        ;
                        ;    OUTPUT ONE CHAR 
                        ;
   c20a   36            OUTEEE    PSH    A
   c20b   b6 80 18      OUTEEE1 LDA A    ACIACS
   c20e   47                ASR A
   c20f   47                ASR A
   c210   24 f9             BCC OUTEEE1
   c212   32                PUL A
   c213   b7 80 19          STA A ACIADA
   c216   39                RTS

It should be easy to write the code to read a character and then echo it out. Here is the instruction set card for the 6800. The In/out functions are written as subroutines can get called with a JSR. The instruction to jump to a subroutine is:

The instruction to branch back to start is:

The code to do this should look something like the following:
; INEEE    EQU    $C1F4
; OUTEEE   EQU    $C20A

LOOP4VR
    JSR    $C1F4
    JSR    $C20A
    BRA    LOOP4VR
    

The listing file is:

   0000                 LOOP4VR
   0000   bd c1 f4          JSR $C1F4
   0003   bd c2 0a          JSR    $C20A
   0006   20 f8             BRA    LOOP4VR

 Commands to enter, disassemble and run program:

; E CHANGE MEMORY
; D DISASSEMBLE CODE
; G GO TO PROGRAM

 Runs but prints a lot of chars...

Discussions