********************************************************************************************** * * Title: Star Fill (In Memory) Homework #1 * * Objective: CMPEN472 Homework #1 demonstration program. Fill 225 bytes of memory with '*'. * * Revision: V1.0 * * Date: Jan. 22, 2025 * * Programmer: Jacob McDonnell * * Company: The Pennsylvania State Universtiy * Electrical Engineering and Computer Science * * Algorithm: While Loop demo of HCS12 Assembly * * Register Use: A accumulator: character to be placed in memory * B accumulator: counter of filled memory locations * X register: pointer to memory location to fill * * Memory use: RAM locations $3000 to $30E1 * * Input: No input, data and parameters are hard coded. * * Output: Memory locations $3000 to $30E1 are filled with '*' character. * * Observation: This program is designed for instruction purpose. * This program can be a template for other loop based code. * * Comments: This program is developed and simulated using CodeWarrior Development Software. * ********************************************************************************************** * Parameter Declaration Section * * Export Symbols xdef pgstart ; export 'pgstart' symbol absentry pgstart ; for assembly entry point * Symbols and Macros porta equ $0000 ; i/o port address portb equ $0001 ddra equ $0002 ddrb equ $0003 ********************************************************************************************** * Data Section * org $3000 ; reserved memory starting address here ds.b $e1 ; 225 memory locations reserved count dc.b $e1 ; constant counter for stars = 225 * ********************************************************************************************** * Program Section * org $3100 ; Program Start Address in RAM pgstart ldaa #'*' ; Load '*' into accumulator A ldab count ; Load count of stars into B ldx #here ; Load address pointer into X loop staa 0,x ; Put a start at this memory location inx ; Go to the next memory location decb ; Decrement the counter bne loop ; Loop if not done done bra done ; Task finished end ; Last line of a file