6809 Assembly Language – Part 1

If you’ve never tried to write 6×09 assembly language programming for the Radio Shack Color Computer before, now it’s easier than ever before. While you can use a native editor assembler, like Robert Gault’s 6×09 updates to Tandy’s DISK EDTASM (which is excellent), its probably a lot simpler to just write the code in your favorite editor and then use a cross-compiler such as LWASM to assemble your code on your PC.

You can then use programs from the cross development TOOLSHED to copy your local binaries to a virtual floppy and test your work on one of the virtual color computer emulators such as Xroar, VCC or MAME.

When I started to learn assembly language programming, my biggest hurdle was finding out how to set up the various graphics modes available to the Color Computer. I mean, after a few tests, the 32 column screen with eye piercing radium green background you really end up wanting alternatives.

LWASM is part of the LWTOOLS distribution (along with documentation) found at: http://www.lwtools.ca/

Note: If you use Windows, look for the appropriate pre-compiled windows binaries zip file at

http://www.lwtools.ca/contrib/tormod/

TOOLSHED is found at : https://sourceforge.net/projects/toolshed/files/

Learning 6809 Assembler

The 6809 microcontroller, developed by Motorola in the late 70s, was a significant milestone in the history of embedded systems. With its advanced capabilities and versatility, it paved the way for numerous applications ranging from industrial automation to telecommunications and gaming consoles.

In this topic, we embark on an educational journey to understand the intricacies of programming the 6809 microcontroller using its dedicated assembler.

The LWASM 6809 Assembler is a powerful tool that translates human-readable mnemonics into machine code instructions that can be executed directly by the microcontroller. To begin our learning process, let’s first familiarize ourselves with the essential components of the 6809 architecture.

The 6809 is an 8 bit CPU with 16-bit capabilities featuring two Accumulators (A and B), 2 index registers (X, Y) along with a User Stack (U) , Stack Pointer (s) and Program Counter (PC). A 16 bit Accumulator (D) is the A & B Accumulators combined to make D Accumulator. Additionally, it features a 16-bit memory address bus that allows it to directly access up to 65,535 bytes of memory.

Now, let’s discuss the fundamentals of 6809 Assembler programming. The process generally involves writing mnemonics representing machine instructions followed by their operands in the desired addressing mode. For instance, an instruction to load the value at memory location $1234 into Accumulator A would be written as:

LDA $1234

Several other common instructions include:

  • STA (Store Accumulator): Stores the contents of a register into a memory location
  • LDX and LDA: Load indices X and A with values
  • CMP: Compare registers or memories
  • JSR: Jump to Subroutine
  • RTS: Return from Subroutine
  • BRA: Branch Always
  • BRN, BEQ, BMI, etc.: Branch Never, Branch Equal Zero, Branch Negative, etc.

It is essential to understand the addressing modes as they enable us to manipulate data in memory
effectively. Some of the commonly used addressing modes include:

  1. Inherent – Where the mnemonic instruction already knows everything needed. Example: the DAA instruction
  2. Immediate – The effective address of the data is the location following the mnemonic. Example: LDA #$20
  3. Extended – The contents of the 2 bytes following the mnemonic specify a 16 bit effective address of the instruction. Example: LDD $7000
  4. Extended Indirect – Indexed addressing, the 2 bytes following the instruction contain the address of the data. Example: LDX [$FFFE]
  5. Direct – Similar to Extended, except that only one byte follows the instruction where the lower 8 bits of the address are used and the upper 8 bits are from the contents of the direct page (DP) register. By default, the DP register is set to value $00, so unless the DP register is changed, the direct address refers to the lowest 256 bytes of RAM. Example: LDD <$50 Where the < symbol forces Direct mode.
  6. Register – The instructions are followed by an operand that defines the register(s) to be used by the instruction. Example: EXG A, B

As we progress on our learning journey, it is crucial to gain hands-on experience by attempting simple exercises such as writing programs to perform arithmetic operations, input/output data, or creating basic control structures. Additionally, studying example programs and understanding their functionality will further deepen your knowledge of the 6809 Assembler.

Mastering the 6809 Assembler requires dedication, patience, and a strong foundation in microprocessor architecture. By understanding the fundamental concepts such as instruction sets, addressing modes, and programming techniques, you will be well-equipped to embark on more complex projects involving real-world applications of this versatile microcontroller.

As we continue to explore 6809 assembly language , we must remember that practice is key to mastering any new skill. Engage in writing and debugging programs, consult documentation, and collaborate with peers to create a supportive learning environment. With perseverance and determination, you will be on your way to becoming an accomplished 6809 Assembler programmer!

Lastly, always keep in mind that the 6809 is just one example of many microprocessors and assemblers available today. By gaining a solid foundation with this system, you’ll be better prepared for learning other architectures as they share fundamental principles with their counterparts. Happy coding!

One thought on “6809 Assembly Language – Part 1

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.