; **************************************************************** ; Lab 2 Assembly Counter ; Purpose: This is an assembly-language counter that assumes ; 3 LEDs exist and are connected to the low bits of PORTAD ; **************************************************************** ;***************************************************************** ;* This stationery serves as the framework for a * ;* user application (single file, absolute assembly application) * ;* For a more comprehensive program that * ;* demonstrates the more advanced functionality of this * ;* processor, please see the demonstration applications * ;* located in the examples subdirectory of the * ;* Freescale CodeWarrior for the HC12 Program directory * ;***************************************************************** ; export symbols XDEF Entry ; export 'Entry' symbol ABSENTRY Entry ; for absolute assembly: mark this as application entry point ; include derivative specific macros INCLUDE 'mc9s12c32.inc' ROMStart EQU $4000 ; absolute address to place my code/constant data ; variable/data section ifdef _HCS12_SERIALMON ORG $3FFF - (RAMEnd - RAMStart) else ORG RAMStart endif ; Insert here your data definition. Counter DS.W 1 FiboRes DS.W 1 ; code section ORG ROMStart Entry: ; remap the RAM & EEPROM here. See EB386.pdf ifdef _HCS12_SERIALMON ; set registers at $0000 CLR $11 ; INITRG= $0 ; set ram to end at $3FFF LDAB #$39 STAB $10 ; INITRM= $39 ; set eeprom to end at $0FFF LDAA #$9 STAA $12 ; INITEE= $9 LDS #$3FFF+1 ; See EB386.pdf, initialize the stack pointer else LDS #RAMEnd+1 ; initialize the stack pointer endif CLI ; enable interrupts ;********************************Start of Program Code********************************** LDAA #$FF STAA DDRAD ; Setup port AD LDAA #$FF STAA DDRT ; Setup port T LDAA #$00 STAA DDRE ; Setup port E LDAA #$CF STAA PTT ; Set output of port T to electronically enable ; the push buttons and LEDs LDAA #$00 STAA PTAD ; Set counter value to 0 mainLoop: INC PTAD BRA mainLoop ;*******************************End of counter code************************************ ;************************************************************** ;* Interrupt Vectors * ;************************************************************** ORG $FFFE DC.W Entry ; Reset Vector