summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob McDonnell <jacob@jacobmcdonnell.com>2025-04-14 11:19:04 -0400
committerJacob McDonnell <jacob@jacobmcdonnell.com>2025-04-14 11:19:04 -0400
commit0616b5d255a33bd253b29aa3867f2b8c4e40bc94 (patch)
treea5a29fa2bc9b0dfe40ad231b1368341ce9991cb4
parentc76f1635c431e7174af5830b872a2bb2fa7a103d (diff)
HW 11: Switched to Channel 1 timer
-rw-r--r--cmpen472hw10_McDonnell/bin/Project.absbin11062 -> 11062 bytes
-rw-r--r--cmpen472hw10_McDonnell/bin/Project.abs.s192
-rw-r--r--cmpen472hw10_McDonnell/bin/main.dbg2
-rw-r--r--cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/CWSettingsWindows.stgbin2004 -> 4175 bytes
-rw-r--r--cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/ObjectCode/main.asm.obin11062 -> 11062 bytes
-rw-r--r--cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/ObjectCode/main.asm.sx2
-rw-r--r--cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/TargetDataWindows.tdtbin65942 -> 65942 bytes
-rw-r--r--cmpen472hw10_McDonnell/data.csv2049
-rw-r--r--cmpen472hw11_McDonnell/ASM_layout.hwl27
-rw-r--r--cmpen472hw11_McDonnell/Default.membin0 -> 285 bytes
-rw-r--r--cmpen472hw11_McDonnell/Full_Chip_Simulation.hwc1
-rw-r--r--cmpen472hw11_McDonnell/Full_Chip_Simulation.ini42
-rw-r--r--cmpen472hw11_McDonnell/Sources/derivative.inc10
-rw-r--r--cmpen472hw11_McDonnell/Sources/example.asm356
-rw-r--r--cmpen472hw11_McDonnell/Sources/main.asm1073
-rw-r--r--cmpen472hw11_McDonnell/bin/Project.absbin0 -> 11062 bytes
-rw-r--r--cmpen472hw11_McDonnell/bin/Project.abs.phy4
-rw-r--r--cmpen472hw11_McDonnell/bin/Project.abs.s1979
-rw-r--r--cmpen472hw11_McDonnell/bin/main.dbg1072
-rw-r--r--cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd1
-rw-r--r--cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd1
-rw-r--r--cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd1
-rw-r--r--cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd1
-rw-r--r--cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd1
-rw-r--r--cmpen472hw11_McDonnell/cmpen472hw11_McDonnell.mcpbin0 -> 57065 bytes
-rw-r--r--cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/CWSettingsWindows.stgbin0 -> 4175 bytes
-rw-r--r--cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.obin0 -> 11062 bytes
-rw-r--r--cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.sx79
-rw-r--r--cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdtbin0 -> 62970 bytes
-rw-r--r--cmpen472hw11_McDonnell/prm/burner.bbl157
30 files changed, 2908 insertions, 2052 deletions
diff --git a/cmpen472hw10_McDonnell/bin/Project.abs b/cmpen472hw10_McDonnell/bin/Project.abs
index be9191c..3df1bad 100644
--- a/cmpen472hw10_McDonnell/bin/Project.abs
+++ b/cmpen472hw10_McDonnell/bin/Project.abs
Binary files differ
diff --git a/cmpen472hw10_McDonnell/bin/Project.abs.s19 b/cmpen472hw10_McDonnell/bin/Project.abs.s19
index d9e4989..6ed81a9 100644
--- a/cmpen472hw10_McDonnell/bin/Project.abs.s19
+++ b/cmpen472hw10_McDonnell/bin/Project.abs.s19
@@ -27,7 +27,7 @@ S12333A024014D8C0000182D01467C302AA61F81001826013B877A302C10EF3A3A3A163396
S12333C0051820014181682612E630C1001826012D7A30431633051820012B816D2612E65B
S12333E030C100182601177A30431633051820011581732612E630C100182601017A3043C9
S1233400163305182000FF8171260BE630C100182600EB0631498167182600E2A6308177AA
-S12334202650E630C100261ECE36811635DA86537A304ECC00017C304C1632DFCE371F1656
+S12334202650E630C100261ECE36811635DA86537A304ECC00087C304C1632DFCE371F164F
S123344035DA182000C0C132182600B2E630C100182600AACE369F1635DA86537A304ECC5A
S123346000047C304C1632DFCE371F1635DA1820009481742626E630C10018260080CE3636
S1233480C31635DA86547A304ECC00017C304C1632DFCE371F1635DA1820006A8171182667
diff --git a/cmpen472hw10_McDonnell/bin/main.dbg b/cmpen472hw10_McDonnell/bin/main.dbg
index 1722977..0e74339 100644
--- a/cmpen472hw10_McDonnell/bin/main.dbg
+++ b/cmpen472hw10_McDonnell/bin/main.dbg
@@ -667,7 +667,7 @@ isGw cmpa #'g' ; Compare A to 'g'
jsr WriteString ; Write string
ldaa #'S' ; Load 'S' for sawtooth
staa waveType ; Save A to waveType
- ldd #1 ; Load 1 into D
+ ldd #8 ; Load 1 into D
std increment ; Set Increment to 1 -> 31.25Hz
jsr GenWave ; Jump to GenWave
ldx #doneWave ; Load the address of doneWave
diff --git a/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/CWSettingsWindows.stg b/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/CWSettingsWindows.stg
index 1f2028b..80116df 100644
--- a/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/CWSettingsWindows.stg
+++ b/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/CWSettingsWindows.stg
Binary files differ
diff --git a/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/ObjectCode/main.asm.o b/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/ObjectCode/main.asm.o
index be9191c..3df1bad 100644
--- a/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/ObjectCode/main.asm.o
+++ b/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/ObjectCode/main.asm.o
Binary files differ
diff --git a/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/ObjectCode/main.asm.sx b/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/ObjectCode/main.asm.sx
index 7f841e9..2754af6 100644
--- a/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/ObjectCode/main.asm.sx
+++ b/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/ObjectCode/main.asm.sx
@@ -29,7 +29,7 @@ S12333A024014D8C0000182D01467C302AA61F81001826013B877A302C10EF3A3A3A163396
S12333C0051820014181682612E630C1001826012D7A30431633051820012B816D2612E65B
S12333E030C100182601177A30431633051820011581732612E630C100182601017A3043C9
S1233400163305182000FF8171260BE630C100182600EB0631498167182600E2A6308177AA
-S12334202650E630C100261ECE36811635DA86537A304ECC00017C304C1632DFCE371F1656
+S12334202650E630C100261ECE36811635DA86537A304ECC00087C304C1632DFCE371F164F
S123344035DA182000C0C132182600B2E630C100182600AACE369F1635DA86537A304ECC5A
S123346000047C304C1632DFCE371F1635DA1820009481742626E630C10018260080CE3636
S1233480C31635DA86547A304ECC00017C304C1632DFCE371F1635DA1820006A8171182667
diff --git a/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/TargetDataWindows.tdt
index d0e6877..474f122 100644
--- a/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/TargetDataWindows.tdt
+++ b/cmpen472hw10_McDonnell/cmpen472hw10_McDonnell_Data/Standard/TargetDataWindows.tdt
Binary files differ
diff --git a/cmpen472hw10_McDonnell/data.csv b/cmpen472hw10_McDonnell/data.csv
deleted file mode 100644
index 47e3dc3..0000000
--- a/cmpen472hw10_McDonnell/data.csv
+++ /dev/null
@@ -1,2049 +0,0 @@
-Sawtooth,Triangle,Square,Sawtooth 125Hz,Square 125Hz,time
-0,0,0,0,0,0
-1,1,0,4,0,125
-2,2,0,8,0,250
-3,3,0,12,0,375
-4,4,0,16,0,500
-5,5,0,20,0,625
-6,6,0,24,0,750
-7,7,0,28,0,875
-8,8,0,32,0,1000
-9,9,0,36,0,1125
-10,10,0,40,0,1250
-11,11,0,44,0,1375
-12,12,0,48,0,1500
-13,13,0,52,0,1625
-14,14,0,56,0,1750
-15,15,0,60,0,1875
-16,16,0,64,0,2000
-17,17,0,68,0,2125
-18,18,0,72,0,2250
-19,19,0,76,0,2375
-20,20,0,80,0,2500
-21,21,0,84,0,2625
-22,22,0,88,0,2750
-23,23,0,92,0,2875
-24,24,0,96,0,3000
-25,25,0,100,0,3125
-26,26,0,104,0,3250
-27,27,0,108,0,3375
-28,28,0,112,0,3500
-29,29,0,116,0,3625
-30,30,0,120,0,3750
-31,31,0,124,0,3875
-32,32,0,128,255,4000
-33,33,0,132,255,4125
-34,34,0,136,255,4250
-35,35,0,140,255,4375
-36,36,0,144,255,4500
-37,37,0,148,255,4625
-38,38,0,152,255,4750
-39,39,0,156,255,4875
-40,40,0,160,255,5000
-41,41,0,164,255,5125
-42,42,0,168,255,5250
-43,43,0,172,255,5375
-44,44,0,176,255,5500
-45,45,0,180,255,5625
-46,46,0,184,255,5750
-47,47,0,188,255,5875
-48,48,0,192,255,6000
-49,49,0,196,255,6125
-50,50,0,200,255,6250
-51,51,0,204,255,6375
-52,52,0,208,255,6500
-53,53,0,212,255,6625
-54,54,0,216,255,6750
-55,55,0,220,255,6875
-56,56,0,224,255,7000
-57,57,0,228,255,7125
-58,58,0,232,255,7250
-59,59,0,236,255,7375
-60,60,0,240,255,7500
-61,61,0,244,255,7625
-62,62,0,248,255,7750
-63,63,0,252,255,7875
-64,64,0,0,0,8000
-65,65,0,4,0,8125
-66,66,0,8,0,8250
-67,67,0,12,0,8375
-68,68,0,16,0,8500
-69,69,0,20,0,8625
-70,70,0,24,0,8750
-71,71,0,28,0,8875
-72,72,0,32,0,9000
-73,73,0,36,0,9125
-74,74,0,40,0,9250
-75,75,0,44,0,9375
-76,76,0,48,0,9500
-77,77,0,52,0,9625
-78,78,0,56,0,9750
-79,79,0,60,0,9875
-80,80,0,64,0,10000
-81,81,0,68,0,10125
-82,82,0,72,0,10250
-83,83,0,76,0,10375
-84,84,0,80,0,10500
-85,85,0,84,0,10625
-86,86,0,88,0,10750
-87,87,0,92,0,10875
-88,88,0,96,0,11000
-89,89,0,100,0,11125
-90,90,0,104,0,11250
-91,91,0,108,0,11375
-92,92,0,112,0,11500
-93,93,0,116,0,11625
-94,94,0,120,0,11750
-95,95,0,124,0,11875
-96,96,0,128,255,12000
-97,97,0,132,255,12125
-98,98,0,136,255,12250
-99,99,0,140,255,12375
-100,100,0,144,255,12500
-101,101,0,148,255,12625
-102,102,0,152,255,12750
-103,103,0,156,255,12875
-104,104,0,160,255,13000
-105,105,0,164,255,13125
-106,106,0,168,255,13250
-107,107,0,172,255,13375
-108,108,0,176,255,13500
-109,109,0,180,255,13625
-110,110,0,184,255,13750
-111,111,0,188,255,13875
-112,112,0,192,255,14000
-113,113,0,196,255,14125
-114,114,0,200,255,14250
-115,115,0,204,255,14375
-116,116,0,208,255,14500
-117,117,0,212,255,14625
-118,118,0,216,255,14750
-119,119,0,220,255,14875
-120,120,0,224,255,15000
-121,121,0,228,255,15125
-122,122,0,232,255,15250
-123,123,0,236,255,15375
-124,124,0,240,255,15500
-125,125,0,244,255,15625
-126,126,0,248,255,15750
-127,127,0,252,255,15875
-128,128,0,0,0,16000
-129,129,0,4,0,16125
-130,130,0,8,0,16250
-131,131,0,12,0,16375
-132,132,0,16,0,16500
-133,133,0,20,0,16625
-134,134,0,24,0,16750
-135,135,0,28,0,16875
-136,136,0,32,0,17000
-137,137,0,36,0,17125
-138,138,0,40,0,17250
-139,139,0,44,0,17375
-140,140,0,48,0,17500
-141,141,0,52,0,17625
-142,142,0,56,0,17750
-143,143,0,60,0,17875
-144,144,0,64,0,18000
-145,145,0,68,0,18125
-146,146,0,72,0,18250
-147,147,0,76,0,18375
-148,148,0,80,0,18500
-149,149,0,84,0,18625
-150,150,0,88,0,18750
-151,151,0,92,0,18875
-152,152,0,96,0,19000
-153,153,0,100,0,19125
-154,154,0,104,0,19250
-155,155,0,108,0,19375
-156,156,0,112,0,19500
-157,157,0,116,0,19625
-158,158,0,120,0,19750
-159,159,0,124,0,19875
-160,160,0,128,255,20000
-161,161,0,132,255,20125
-162,162,0,136,255,20250
-163,163,0,140,255,20375
-164,164,0,144,255,20500
-165,165,0,148,255,20625
-166,166,0,152,255,20750
-167,167,0,156,255,20875
-168,168,0,160,255,21000
-169,169,0,164,255,21125
-170,170,0,168,255,21250
-171,171,0,172,255,21375
-172,172,0,176,255,21500
-173,173,0,180,255,21625
-174,174,0,184,255,21750
-175,175,0,188,255,21875
-176,176,0,192,255,22000
-177,177,0,196,255,22125
-178,178,0,200,255,22250
-179,179,0,204,255,22375
-180,180,0,208,255,22500
-181,181,0,212,255,22625
-182,182,0,216,255,22750
-183,183,0,220,255,22875
-184,184,0,224,255,23000
-185,185,0,228,255,23125
-186,186,0,232,255,23250
-187,187,0,236,255,23375
-188,188,0,240,255,23500
-189,189,0,244,255,23625
-190,190,0,248,255,23750
-191,191,0,252,255,23875
-192,192,0,0,0,24000
-193,193,0,4,0,24125
-194,194,0,8,0,24250
-195,195,0,12,0,24375
-196,196,0,16,0,24500
-197,197,0,20,0,24625
-198,198,0,24,0,24750
-199,199,0,28,0,24875
-200,200,0,32,0,25000
-201,201,0,36,0,25125
-202,202,0,40,0,25250
-203,203,0,44,0,25375
-204,204,0,48,0,25500
-205,205,0,52,0,25625
-206,206,0,56,0,25750
-207,207,0,60,0,25875
-208,208,0,64,0,26000
-209,209,0,68,0,26125
-210,210,0,72,0,26250
-211,211,0,76,0,26375
-212,212,0,80,0,26500
-213,213,0,84,0,26625
-214,214,0,88,0,26750
-215,215,0,92,0,26875
-216,216,0,96,0,27000
-217,217,0,100,0,27125
-218,218,0,104,0,27250
-219,219,0,108,0,27375
-220,220,0,112,0,27500
-221,221,0,116,0,27625
-222,222,0,120,0,27750
-223,223,0,124,0,27875
-224,224,0,128,255,28000
-225,225,0,132,255,28125
-226,226,0,136,255,28250
-227,227,0,140,255,28375
-228,228,0,144,255,28500
-229,229,0,148,255,28625
-230,230,0,152,255,28750
-231,231,0,156,255,28875
-232,232,0,160,255,29000
-233,233,0,164,255,29125
-234,234,0,168,255,29250
-235,235,0,172,255,29375
-236,236,0,176,255,29500
-237,237,0,180,255,29625
-238,238,0,184,255,29750
-239,239,0,188,255,29875
-240,240,0,192,255,30000
-241,241,0,196,255,30125
-242,242,0,200,255,30250
-243,243,0,204,255,30375
-244,244,0,208,255,30500
-245,245,0,212,255,30625
-246,246,0,216,255,30750
-247,247,0,220,255,30875
-248,248,0,224,255,31000
-249,249,0,228,255,31125
-250,250,0,232,255,31250
-251,251,0,236,255,31375
-252,252,0,240,255,31500
-253,253,0,244,255,31625
-254,254,0,248,255,31750
-255,255,0,252,255,31875
-0,255,255,0,0,32000
-1,254,255,4,0,32125
-2,253,255,8,0,32250
-3,252,255,12,0,32375
-4,251,255,16,0,32500
-5,250,255,20,0,32625
-6,249,255,24,0,32750
-7,248,255,28,0,32875
-8,247,255,32,0,33000
-9,246,255,36,0,33125
-10,245,255,40,0,33250
-11,244,255,44,0,33375
-12,243,255,48,0,33500
-13,242,255,52,0,33625
-14,241,255,56,0,33750
-15,240,255,60,0,33875
-16,239,255,64,0,34000
-17,238,255,68,0,34125
-18,237,255,72,0,34250
-19,236,255,76,0,34375
-20,235,255,80,0,34500
-21,234,255,84,0,34625
-22,233,255,88,0,34750
-23,232,255,92,0,34875
-24,231,255,96,0,35000
-25,230,255,100,0,35125
-26,229,255,104,0,35250
-27,228,255,108,0,35375
-28,227,255,112,0,35500
-29,226,255,116,0,35625
-30,225,255,120,0,35750
-31,224,255,124,0,35875
-32,223,255,128,255,36000
-33,222,255,132,255,36125
-34,221,255,136,255,36250
-35,220,255,140,255,36375
-36,219,255,144,255,36500
-37,218,255,148,255,36625
-38,217,255,152,255,36750
-39,216,255,156,255,36875
-40,215,255,160,255,37000
-41,214,255,164,255,37125
-42,213,255,168,255,37250
-43,212,255,172,255,37375
-44,211,255,176,255,37500
-45,210,255,180,255,37625
-46,209,255,184,255,37750
-47,208,255,188,255,37875
-48,207,255,192,255,38000
-49,206,255,196,255,38125
-50,205,255,200,255,38250
-51,204,255,204,255,38375
-52,203,255,208,255,38500
-53,202,255,212,255,38625
-54,201,255,216,255,38750
-55,200,255,220,255,38875
-56,199,255,224,255,39000
-57,198,255,228,255,39125
-58,197,255,232,255,39250
-59,196,255,236,255,39375
-60,195,255,240,255,39500
-61,194,255,244,255,39625
-62,193,255,248,255,39750
-63,192,255,252,255,39875
-64,191,255,0,0,40000
-65,190,255,4,0,40125
-66,189,255,8,0,40250
-67,188,255,12,0,40375
-68,187,255,16,0,40500
-69,186,255,20,0,40625
-70,185,255,24,0,40750
-71,184,255,28,0,40875
-72,183,255,32,0,41000
-73,182,255,36,0,41125
-74,181,255,40,0,41250
-75,180,255,44,0,41375
-76,179,255,48,0,41500
-77,178,255,52,0,41625
-78,177,255,56,0,41750
-79,176,255,60,0,41875
-80,175,255,64,0,42000
-81,174,255,68,0,42125
-82,173,255,72,0,42250
-83,172,255,76,0,42375
-84,171,255,80,0,42500
-85,170,255,84,0,42625
-86,169,255,88,0,42750
-87,168,255,92,0,42875
-88,167,255,96,0,43000
-89,166,255,100,0,43125
-90,165,255,104,0,43250
-91,164,255,108,0,43375
-92,163,255,112,0,43500
-93,162,255,116,0,43625
-94,161,255,120,0,43750
-95,160,255,124,0,43875
-96,159,255,128,255,44000
-97,158,255,132,255,44125
-98,157,255,136,255,44250
-99,156,255,140,255,44375
-100,155,255,144,255,44500
-101,154,255,148,255,44625
-102,153,255,152,255,44750
-103,152,255,156,255,44875
-104,151,255,160,255,45000
-105,150,255,164,255,45125
-106,149,255,168,255,45250
-107,148,255,172,255,45375
-108,147,255,176,255,45500
-109,146,255,180,255,45625
-110,145,255,184,255,45750
-111,144,255,188,255,45875
-112,143,255,192,255,46000
-113,142,255,196,255,46125
-114,141,255,200,255,46250
-115,140,255,204,255,46375
-116,139,255,208,255,46500
-117,138,255,212,255,46625
-118,137,255,216,255,46750
-119,136,255,220,255,46875
-120,135,255,224,255,47000
-121,134,255,228,255,47125
-122,133,255,232,255,47250
-123,132,255,236,255,47375
-124,131,255,240,255,47500
-125,130,255,244,255,47625
-126,129,255,248,255,47750
-127,128,255,252,255,47875
-128,127,255,0,0,48000
-129,126,255,4,0,48125
-130,125,255,8,0,48250
-131,124,255,12,0,48375
-132,123,255,16,0,48500
-133,122,255,20,0,48625
-134,121,255,24,0,48750
-135,120,255,28,0,48875
-136,119,255,32,0,49000
-137,118,255,36,0,49125
-138,117,255,40,0,49250
-139,116,255,44,0,49375
-140,115,255,48,0,49500
-141,114,255,52,0,49625
-142,113,255,56,0,49750
-143,112,255,60,0,49875
-144,111,255,64,0,50000
-145,110,255,68,0,50125
-146,109,255,72,0,50250
-147,108,255,76,0,50375
-148,107,255,80,0,50500
-149,106,255,84,0,50625
-150,105,255,88,0,50750
-151,104,255,92,0,50875
-152,103,255,96,0,51000
-153,102,255,100,0,51125
-154,101,255,104,0,51250
-155,100,255,108,0,51375
-156,99,255,112,0,51500
-157,98,255,116,0,51625
-158,97,255,120,0,51750
-159,96,255,124,0,51875
-160,95,255,128,255,52000
-161,94,255,132,255,52125
-162,93,255,136,255,52250
-163,92,255,140,255,52375
-164,91,255,144,255,52500
-165,90,255,148,255,52625
-166,89,255,152,255,52750
-167,88,255,156,255,52875
-168,87,255,160,255,53000
-169,86,255,164,255,53125
-170,85,255,168,255,53250
-171,84,255,172,255,53375
-172,83,255,176,255,53500
-173,82,255,180,255,53625
-174,81,255,184,255,53750
-175,80,255,188,255,53875
-176,79,255,192,255,54000
-177,78,255,196,255,54125
-178,77,255,200,255,54250
-179,76,255,204,255,54375
-180,75,255,208,255,54500
-181,74,255,212,255,54625
-182,73,255,216,255,54750
-183,72,255,220,255,54875
-184,71,255,224,255,55000
-185,70,255,228,255,55125
-186,69,255,232,255,55250
-187,68,255,236,255,55375
-188,67,255,240,255,55500
-189,66,255,244,255,55625
-190,65,255,248,255,55750
-191,64,255,252,255,55875
-192,63,255,0,0,56000
-193,62,255,4,0,56125
-194,61,255,8,0,56250
-195,60,255,12,0,56375
-196,59,255,16,0,56500
-197,58,255,20,0,56625
-198,57,255,24,0,56750
-199,56,255,28,0,56875
-200,55,255,32,0,57000
-201,54,255,36,0,57125
-202,53,255,40,0,57250
-203,52,255,44,0,57375
-204,51,255,48,0,57500
-205,50,255,52,0,57625
-206,49,255,56,0,57750
-207,48,255,60,0,57875
-208,47,255,64,0,58000
-209,46,255,68,0,58125
-210,45,255,72,0,58250
-211,44,255,76,0,58375
-212,43,255,80,0,58500
-213,42,255,84,0,58625
-214,41,255,88,0,58750
-215,40,255,92,0,58875
-216,39,255,96,0,59000
-217,38,255,100,0,59125
-218,37,255,104,0,59250
-219,36,255,108,0,59375
-220,35,255,112,0,59500
-221,34,255,116,0,59625
-222,33,255,120,0,59750
-223,32,255,124,0,59875
-224,31,255,128,255,60000
-225,30,255,132,255,60125
-226,29,255,136,255,60250
-227,28,255,140,255,60375
-228,27,255,144,255,60500
-229,26,255,148,255,60625
-230,25,255,152,255,60750
-231,24,255,156,255,60875
-232,23,255,160,255,61000
-233,22,255,164,255,61125
-234,21,255,168,255,61250
-235,20,255,172,255,61375
-236,19,255,176,255,61500
-237,18,255,180,255,61625
-238,17,255,184,255,61750
-239,16,255,188,255,61875
-240,15,255,192,255,62000
-241,14,255,196,255,62125
-242,13,255,200,255,62250
-243,12,255,204,255,62375
-244,11,255,208,255,62500
-245,10,255,212,255,62625
-246,9,255,216,255,62750
-247,8,255,220,255,62875
-248,7,255,224,255,63000
-249,6,255,228,255,63125
-250,5,255,232,255,63250
-251,4,255,236,255,63375
-252,3,255,240,255,63500
-253,2,255,244,255,63625
-254,1,255,248,255,63750
-255,0,255,252,255,63875
-0,0,0,0,0,64000
-1,1,0,4,0,64125
-2,2,0,8,0,64250
-3,3,0,12,0,64375
-4,4,0,16,0,64500
-5,5,0,20,0,64625
-6,6,0,24,0,64750
-7,7,0,28,0,64875
-8,8,0,32,0,65000
-9,9,0,36,0,65125
-10,10,0,40,0,65250
-11,11,0,44,0,65375
-12,12,0,48,0,65500
-13,13,0,52,0,65625
-14,14,0,56,0,65750
-15,15,0,60,0,65875
-16,16,0,64,0,66000
-17,17,0,68,0,66125
-18,18,0,72,0,66250
-19,19,0,76,0,66375
-20,20,0,80,0,66500
-21,21,0,84,0,66625
-22,22,0,88,0,66750
-23,23,0,92,0,66875
-24,24,0,96,0,67000
-25,25,0,100,0,67125
-26,26,0,104,0,67250
-27,27,0,108,0,67375
-28,28,0,112,0,67500
-29,29,0,116,0,67625
-30,30,0,120,0,67750
-31,31,0,124,0,67875
-32,32,0,128,255,68000
-33,33,0,132,255,68125
-34,34,0,136,255,68250
-35,35,0,140,255,68375
-36,36,0,144,255,68500
-37,37,0,148,255,68625
-38,38,0,152,255,68750
-39,39,0,156,255,68875
-40,40,0,160,255,69000
-41,41,0,164,255,69125
-42,42,0,168,255,69250
-43,43,0,172,255,69375
-44,44,0,176,255,69500
-45,45,0,180,255,69625
-46,46,0,184,255,69750
-47,47,0,188,255,69875
-48,48,0,192,255,70000
-49,49,0,196,255,70125
-50,50,0,200,255,70250
-51,51,0,204,255,70375
-52,52,0,208,255,70500
-53,53,0,212,255,70625
-54,54,0,216,255,70750
-55,55,0,220,255,70875
-56,56,0,224,255,71000
-57,57,0,228,255,71125
-58,58,0,232,255,71250
-59,59,0,236,255,71375
-60,60,0,240,255,71500
-61,61,0,244,255,71625
-62,62,0,248,255,71750
-63,63,0,252,255,71875
-64,64,0,0,0,72000
-65,65,0,4,0,72125
-66,66,0,8,0,72250
-67,67,0,12,0,72375
-68,68,0,16,0,72500
-69,69,0,20,0,72625
-70,70,0,24,0,72750
-71,71,0,28,0,72875
-72,72,0,32,0,73000
-73,73,0,36,0,73125
-74,74,0,40,0,73250
-75,75,0,44,0,73375
-76,76,0,48,0,73500
-77,77,0,52,0,73625
-78,78,0,56,0,73750
-79,79,0,60,0,73875
-80,80,0,64,0,74000
-81,81,0,68,0,74125
-82,82,0,72,0,74250
-83,83,0,76,0,74375
-84,84,0,80,0,74500
-85,85,0,84,0,74625
-86,86,0,88,0,74750
-87,87,0,92,0,74875
-88,88,0,96,0,75000
-89,89,0,100,0,75125
-90,90,0,104,0,75250
-91,91,0,108,0,75375
-92,92,0,112,0,75500
-93,93,0,116,0,75625
-94,94,0,120,0,75750
-95,95,0,124,0,75875
-96,96,0,128,255,76000
-97,97,0,132,255,76125
-98,98,0,136,255,76250
-99,99,0,140,255,76375
-100,100,0,144,255,76500
-101,101,0,148,255,76625
-102,102,0,152,255,76750
-103,103,0,156,255,76875
-104,104,0,160,255,77000
-105,105,0,164,255,77125
-106,106,0,168,255,77250
-107,107,0,172,255,77375
-108,108,0,176,255,77500
-109,109,0,180,255,77625
-110,110,0,184,255,77750
-111,111,0,188,255,77875
-112,112,0,192,255,78000
-113,113,0,196,255,78125
-114,114,0,200,255,78250
-115,115,0,204,255,78375
-116,116,0,208,255,78500
-117,117,0,212,255,78625
-118,118,0,216,255,78750
-119,119,0,220,255,78875
-120,120,0,224,255,79000
-121,121,0,228,255,79125
-122,122,0,232,255,79250
-123,123,0,236,255,79375
-124,124,0,240,255,79500
-125,125,0,244,255,79625
-126,126,0,248,255,79750
-127,127,0,252,255,79875
-128,128,0,0,0,80000
-129,129,0,4,0,80125
-130,130,0,8,0,80250
-131,131,0,12,0,80375
-132,132,0,16,0,80500
-133,133,0,20,0,80625
-134,134,0,24,0,80750
-135,135,0,28,0,80875
-136,136,0,32,0,81000
-137,137,0,36,0,81125
-138,138,0,40,0,81250
-139,139,0,44,0,81375
-140,140,0,48,0,81500
-141,141,0,52,0,81625
-142,142,0,56,0,81750
-143,143,0,60,0,81875
-144,144,0,64,0,82000
-145,145,0,68,0,82125
-146,146,0,72,0,82250
-147,147,0,76,0,82375
-148,148,0,80,0,82500
-149,149,0,84,0,82625
-150,150,0,88,0,82750
-151,151,0,92,0,82875
-152,152,0,96,0,83000
-153,153,0,100,0,83125
-154,154,0,104,0,83250
-155,155,0,108,0,83375
-156,156,0,112,0,83500
-157,157,0,116,0,83625
-158,158,0,120,0,83750
-159,159,0,124,0,83875
-160,160,0,128,255,84000
-161,161,0,132,255,84125
-162,162,0,136,255,84250
-163,163,0,140,255,84375
-164,164,0,144,255,84500
-165,165,0,148,255,84625
-166,166,0,152,255,84750
-167,167,0,156,255,84875
-168,168,0,160,255,85000
-169,169,0,164,255,85125
-170,170,0,168,255,85250
-171,171,0,172,255,85375
-172,172,0,176,255,85500
-173,173,0,180,255,85625
-174,174,0,184,255,85750
-175,175,0,188,255,85875
-176,176,0,192,255,86000
-177,177,0,196,255,86125
-178,178,0,200,255,86250
-179,179,0,204,255,86375
-180,180,0,208,255,86500
-181,181,0,212,255,86625
-182,182,0,216,255,86750
-183,183,0,220,255,86875
-184,184,0,224,255,87000
-185,185,0,228,255,87125
-186,186,0,232,255,87250
-187,187,0,236,255,87375
-188,188,0,240,255,87500
-189,189,0,244,255,87625
-190,190,0,248,255,87750
-191,191,0,252,255,87875
-192,192,0,0,0,88000
-193,193,0,4,0,88125
-194,194,0,8,0,88250
-195,195,0,12,0,88375
-196,196,0,16,0,88500
-197,197,0,20,0,88625
-198,198,0,24,0,88750
-199,199,0,28,0,88875
-200,200,0,32,0,89000
-201,201,0,36,0,89125
-202,202,0,40,0,89250
-203,203,0,44,0,89375
-204,204,0,48,0,89500
-205,205,0,52,0,89625
-206,206,0,56,0,89750
-207,207,0,60,0,89875
-208,208,0,64,0,90000
-209,209,0,68,0,90125
-210,210,0,72,0,90250
-211,211,0,76,0,90375
-212,212,0,80,0,90500
-213,213,0,84,0,90625
-214,214,0,88,0,90750
-215,215,0,92,0,90875
-216,216,0,96,0,91000
-217,217,0,100,0,91125
-218,218,0,104,0,91250
-219,219,0,108,0,91375
-220,220,0,112,0,91500
-221,221,0,116,0,91625
-222,222,0,120,0,91750
-223,223,0,124,0,91875
-224,224,0,128,255,92000
-225,225,0,132,255,92125
-226,226,0,136,255,92250
-227,227,0,140,255,92375
-228,228,0,144,255,92500
-229,229,0,148,255,92625
-230,230,0,152,255,92750
-231,231,0,156,255,92875
-232,232,0,160,255,93000
-233,233,0,164,255,93125
-234,234,0,168,255,93250
-235,235,0,172,255,93375
-236,236,0,176,255,93500
-237,237,0,180,255,93625
-238,238,0,184,255,93750
-239,239,0,188,255,93875
-240,240,0,192,255,94000
-241,241,0,196,255,94125
-242,242,0,200,255,94250
-243,243,0,204,255,94375
-244,244,0,208,255,94500
-245,245,0,212,255,94625
-246,246,0,216,255,94750
-247,247,0,220,255,94875
-248,248,0,224,255,95000
-249,249,0,228,255,95125
-250,250,0,232,255,95250
-251,251,0,236,255,95375
-252,252,0,240,255,95500
-253,253,0,244,255,95625
-254,254,0,248,255,95750
-255,255,0,252,255,95875
-0,255,255,0,0,96000
-1,254,255,4,0,96125
-2,253,255,8,0,96250
-3,252,255,12,0,96375
-4,251,255,16,0,96500
-5,250,255,20,0,96625
-6,249,255,24,0,96750
-7,248,255,28,0,96875
-8,247,255,32,0,97000
-9,246,255,36,0,97125
-10,245,255,40,0,97250
-11,244,255,44,0,97375
-12,243,255,48,0,97500
-13,242,255,52,0,97625
-14,241,255,56,0,97750
-15,240,255,60,0,97875
-16,239,255,64,0,98000
-17,238,255,68,0,98125
-18,237,255,72,0,98250
-19,236,255,76,0,98375
-20,235,255,80,0,98500
-21,234,255,84,0,98625
-22,233,255,88,0,98750
-23,232,255,92,0,98875
-24,231,255,96,0,99000
-25,230,255,100,0,99125
-26,229,255,104,0,99250
-27,228,255,108,0,99375
-28,227,255,112,0,99500
-29,226,255,116,0,99625
-30,225,255,120,0,99750
-31,224,255,124,0,99875
-32,223,255,128,255,100000
-33,222,255,132,255,100125
-34,221,255,136,255,100250
-35,220,255,140,255,100375
-36,219,255,144,255,100500
-37,218,255,148,255,100625
-38,217,255,152,255,100750
-39,216,255,156,255,100875
-40,215,255,160,255,101000
-41,214,255,164,255,101125
-42,213,255,168,255,101250
-43,212,255,172,255,101375
-44,211,255,176,255,101500
-45,210,255,180,255,101625
-46,209,255,184,255,101750
-47,208,255,188,255,101875
-48,207,255,192,255,102000
-49,206,255,196,255,102125
-50,205,255,200,255,102250
-51,204,255,204,255,102375
-52,203,255,208,255,102500
-53,202,255,212,255,102625
-54,201,255,216,255,102750
-55,200,255,220,255,102875
-56,199,255,224,255,103000
-57,198,255,228,255,103125
-58,197,255,232,255,103250
-59,196,255,236,255,103375
-60,195,255,240,255,103500
-61,194,255,244,255,103625
-62,193,255,248,255,103750
-63,192,255,252,255,103875
-64,191,255,0,0,104000
-65,190,255,4,0,104125
-66,189,255,8,0,104250
-67,188,255,12,0,104375
-68,187,255,16,0,104500
-69,186,255,20,0,104625
-70,185,255,24,0,104750
-71,184,255,28,0,104875
-72,183,255,32,0,105000
-73,182,255,36,0,105125
-74,181,255,40,0,105250
-75,180,255,44,0,105375
-76,179,255,48,0,105500
-77,178,255,52,0,105625
-78,177,255,56,0,105750
-79,176,255,60,0,105875
-80,175,255,64,0,106000
-81,174,255,68,0,106125
-82,173,255,72,0,106250
-83,172,255,76,0,106375
-84,171,255,80,0,106500
-85,170,255,84,0,106625
-86,169,255,88,0,106750
-87,168,255,92,0,106875
-88,167,255,96,0,107000
-89,166,255,100,0,107125
-90,165,255,104,0,107250
-91,164,255,108,0,107375
-92,163,255,112,0,107500
-93,162,255,116,0,107625
-94,161,255,120,0,107750
-95,160,255,124,0,107875
-96,159,255,128,255,108000
-97,158,255,132,255,108125
-98,157,255,136,255,108250
-99,156,255,140,255,108375
-100,155,255,144,255,108500
-101,154,255,148,255,108625
-102,153,255,152,255,108750
-103,152,255,156,255,108875
-104,151,255,160,255,109000
-105,150,255,164,255,109125
-106,149,255,168,255,109250
-107,148,255,172,255,109375
-108,147,255,176,255,109500
-109,146,255,180,255,109625
-110,145,255,184,255,109750
-111,144,255,188,255,109875
-112,143,255,192,255,110000
-113,142,255,196,255,110125
-114,141,255,200,255,110250
-115,140,255,204,255,110375
-116,139,255,208,255,110500
-117,138,255,212,255,110625
-118,137,255,216,255,110750
-119,136,255,220,255,110875
-120,135,255,224,255,111000
-121,134,255,228,255,111125
-122,133,255,232,255,111250
-123,132,255,236,255,111375
-124,131,255,240,255,111500
-125,130,255,244,255,111625
-126,129,255,248,255,111750
-127,128,255,252,255,111875
-128,127,255,0,0,112000
-129,126,255,4,0,112125
-130,125,255,8,0,112250
-131,124,255,12,0,112375
-132,123,255,16,0,112500
-133,122,255,20,0,112625
-134,121,255,24,0,112750
-135,120,255,28,0,112875
-136,119,255,32,0,113000
-137,118,255,36,0,113125
-138,117,255,40,0,113250
-139,116,255,44,0,113375
-140,115,255,48,0,113500
-141,114,255,52,0,113625
-142,113,255,56,0,113750
-143,112,255,60,0,113875
-144,111,255,64,0,114000
-145,110,255,68,0,114125
-146,109,255,72,0,114250
-147,108,255,76,0,114375
-148,107,255,80,0,114500
-149,106,255,84,0,114625
-150,105,255,88,0,114750
-151,104,255,92,0,114875
-152,103,255,96,0,115000
-153,102,255,100,0,115125
-154,101,255,104,0,115250
-155,100,255,108,0,115375
-156,99,255,112,0,115500
-157,98,255,116,0,115625
-158,97,255,120,0,115750
-159,96,255,124,0,115875
-160,95,255,128,255,116000
-161,94,255,132,255,116125
-162,93,255,136,255,116250
-163,92,255,140,255,116375
-164,91,255,144,255,116500
-165,90,255,148,255,116625
-166,89,255,152,255,116750
-167,88,255,156,255,116875
-168,87,255,160,255,117000
-169,86,255,164,255,117125
-170,85,255,168,255,117250
-171,84,255,172,255,117375
-172,83,255,176,255,117500
-173,82,255,180,255,117625
-174,81,255,184,255,117750
-175,80,255,188,255,117875
-176,79,255,192,255,118000
-177,78,255,196,255,118125
-178,77,255,200,255,118250
-179,76,255,204,255,118375
-180,75,255,208,255,118500
-181,74,255,212,255,118625
-182,73,255,216,255,118750
-183,72,255,220,255,118875
-184,71,255,224,255,119000
-185,70,255,228,255,119125
-186,69,255,232,255,119250
-187,68,255,236,255,119375
-188,67,255,240,255,119500
-189,66,255,244,255,119625
-190,65,255,248,255,119750
-191,64,255,252,255,119875
-192,63,255,0,0,120000
-193,62,255,4,0,120125
-194,61,255,8,0,120250
-195,60,255,12,0,120375
-196,59,255,16,0,120500
-197,58,255,20,0,120625
-198,57,255,24,0,120750
-199,56,255,28,0,120875
-200,55,255,32,0,121000
-201,54,255,36,0,121125
-202,53,255,40,0,121250
-203,52,255,44,0,121375
-204,51,255,48,0,121500
-205,50,255,52,0,121625
-206,49,255,56,0,121750
-207,48,255,60,0,121875
-208,47,255,64,0,122000
-209,46,255,68,0,122125
-210,45,255,72,0,122250
-211,44,255,76,0,122375
-212,43,255,80,0,122500
-213,42,255,84,0,122625
-214,41,255,88,0,122750
-215,40,255,92,0,122875
-216,39,255,96,0,123000
-217,38,255,100,0,123125
-218,37,255,104,0,123250
-219,36,255,108,0,123375
-220,35,255,112,0,123500
-221,34,255,116,0,123625
-222,33,255,120,0,123750
-223,32,255,124,0,123875
-224,31,255,128,255,124000
-225,30,255,132,255,124125
-226,29,255,136,255,124250
-227,28,255,140,255,124375
-228,27,255,144,255,124500
-229,26,255,148,255,124625
-230,25,255,152,255,124750
-231,24,255,156,255,124875
-232,23,255,160,255,125000
-233,22,255,164,255,125125
-234,21,255,168,255,125250
-235,20,255,172,255,125375
-236,19,255,176,255,125500
-237,18,255,180,255,125625
-238,17,255,184,255,125750
-239,16,255,188,255,125875
-240,15,255,192,255,126000
-241,14,255,196,255,126125
-242,13,255,200,255,126250
-243,12,255,204,255,126375
-244,11,255,208,255,126500
-245,10,255,212,255,126625
-246,9,255,216,255,126750
-247,8,255,220,255,126875
-248,7,255,224,255,127000
-249,6,255,228,255,127125
-250,5,255,232,255,127250
-251,4,255,236,255,127375
-252,3,255,240,255,127500
-253,2,255,244,255,127625
-254,1,255,248,255,127750
-255,0,255,252,255,127875
-0,0,0,0,0,128000
-1,1,0,4,0,128125
-2,2,0,8,0,128250
-3,3,0,12,0,128375
-4,4,0,16,0,128500
-5,5,0,20,0,128625
-6,6,0,24,0,128750
-7,7,0,28,0,128875
-8,8,0,32,0,129000
-9,9,0,36,0,129125
-10,10,0,40,0,129250
-11,11,0,44,0,129375
-12,12,0,48,0,129500
-13,13,0,52,0,129625
-14,14,0,56,0,129750
-15,15,0,60,0,129875
-16,16,0,64,0,130000
-17,17,0,68,0,130125
-18,18,0,72,0,130250
-19,19,0,76,0,130375
-20,20,0,80,0,130500
-21,21,0,84,0,130625
-22,22,0,88,0,130750
-23,23,0,92,0,130875
-24,24,0,96,0,131000
-25,25,0,100,0,131125
-26,26,0,104,0,131250
-27,27,0,108,0,131375
-28,28,0,112,0,131500
-29,29,0,116,0,131625
-30,30,0,120,0,131750
-31,31,0,124,0,131875
-32,32,0,128,255,132000
-33,33,0,132,255,132125
-34,34,0,136,255,132250
-35,35,0,140,255,132375
-36,36,0,144,255,132500
-37,37,0,148,255,132625
-38,38,0,152,255,132750
-39,39,0,156,255,132875
-40,40,0,160,255,133000
-41,41,0,164,255,133125
-42,42,0,168,255,133250
-43,43,0,172,255,133375
-44,44,0,176,255,133500
-45,45,0,180,255,133625
-46,46,0,184,255,133750
-47,47,0,188,255,133875
-48,48,0,192,255,134000
-49,49,0,196,255,134125
-50,50,0,200,255,134250
-51,51,0,204,255,134375
-52,52,0,208,255,134500
-53,53,0,212,255,134625
-54,54,0,216,255,134750
-55,55,0,220,255,134875
-56,56,0,224,255,135000
-57,57,0,228,255,135125
-58,58,0,232,255,135250
-59,59,0,236,255,135375
-60,60,0,240,255,135500
-61,61,0,244,255,135625
-62,62,0,248,255,135750
-63,63,0,252,255,135875
-64,64,0,0,0,136000
-65,65,0,4,0,136125
-66,66,0,8,0,136250
-67,67,0,12,0,136375
-68,68,0,16,0,136500
-69,69,0,20,0,136625
-70,70,0,24,0,136750
-71,71,0,28,0,136875
-72,72,0,32,0,137000
-73,73,0,36,0,137125
-74,74,0,40,0,137250
-75,75,0,44,0,137375
-76,76,0,48,0,137500
-77,77,0,52,0,137625
-78,78,0,56,0,137750
-79,79,0,60,0,137875
-80,80,0,64,0,138000
-81,81,0,68,0,138125
-82,82,0,72,0,138250
-83,83,0,76,0,138375
-84,84,0,80,0,138500
-85,85,0,84,0,138625
-86,86,0,88,0,138750
-87,87,0,92,0,138875
-88,88,0,96,0,139000
-89,89,0,100,0,139125
-90,90,0,104,0,139250
-91,91,0,108,0,139375
-92,92,0,112,0,139500
-93,93,0,116,0,139625
-94,94,0,120,0,139750
-95,95,0,124,0,139875
-96,96,0,128,255,140000
-97,97,0,132,255,140125
-98,98,0,136,255,140250
-99,99,0,140,255,140375
-100,100,0,144,255,140500
-101,101,0,148,255,140625
-102,102,0,152,255,140750
-103,103,0,156,255,140875
-104,104,0,160,255,141000
-105,105,0,164,255,141125
-106,106,0,168,255,141250
-107,107,0,172,255,141375
-108,108,0,176,255,141500
-109,109,0,180,255,141625
-110,110,0,184,255,141750
-111,111,0,188,255,141875
-112,112,0,192,255,142000
-113,113,0,196,255,142125
-114,114,0,200,255,142250
-115,115,0,204,255,142375
-116,116,0,208,255,142500
-117,117,0,212,255,142625
-118,118,0,216,255,142750
-119,119,0,220,255,142875
-120,120,0,224,255,143000
-121,121,0,228,255,143125
-122,122,0,232,255,143250
-123,123,0,236,255,143375
-124,124,0,240,255,143500
-125,125,0,244,255,143625
-126,126,0,248,255,143750
-127,127,0,252,255,143875
-128,128,0,0,0,144000
-129,129,0,4,0,144125
-130,130,0,8,0,144250
-131,131,0,12,0,144375
-132,132,0,16,0,144500
-133,133,0,20,0,144625
-134,134,0,24,0,144750
-135,135,0,28,0,144875
-136,136,0,32,0,145000
-137,137,0,36,0,145125
-138,138,0,40,0,145250
-139,139,0,44,0,145375
-140,140,0,48,0,145500
-141,141,0,52,0,145625
-142,142,0,56,0,145750
-143,143,0,60,0,145875
-144,144,0,64,0,146000
-145,145,0,68,0,146125
-146,146,0,72,0,146250
-147,147,0,76,0,146375
-148,148,0,80,0,146500
-149,149,0,84,0,146625
-150,150,0,88,0,146750
-151,151,0,92,0,146875
-152,152,0,96,0,147000
-153,153,0,100,0,147125
-154,154,0,104,0,147250
-155,155,0,108,0,147375
-156,156,0,112,0,147500
-157,157,0,116,0,147625
-158,158,0,120,0,147750
-159,159,0,124,0,147875
-160,160,0,128,255,148000
-161,161,0,132,255,148125
-162,162,0,136,255,148250
-163,163,0,140,255,148375
-164,164,0,144,255,148500
-165,165,0,148,255,148625
-166,166,0,152,255,148750
-167,167,0,156,255,148875
-168,168,0,160,255,149000
-169,169,0,164,255,149125
-170,170,0,168,255,149250
-171,171,0,172,255,149375
-172,172,0,176,255,149500
-173,173,0,180,255,149625
-174,174,0,184,255,149750
-175,175,0,188,255,149875
-176,176,0,192,255,150000
-177,177,0,196,255,150125
-178,178,0,200,255,150250
-179,179,0,204,255,150375
-180,180,0,208,255,150500
-181,181,0,212,255,150625
-182,182,0,216,255,150750
-183,183,0,220,255,150875
-184,184,0,224,255,151000
-185,185,0,228,255,151125
-186,186,0,232,255,151250
-187,187,0,236,255,151375
-188,188,0,240,255,151500
-189,189,0,244,255,151625
-190,190,0,248,255,151750
-191,191,0,252,255,151875
-192,192,0,0,0,152000
-193,193,0,4,0,152125
-194,194,0,8,0,152250
-195,195,0,12,0,152375
-196,196,0,16,0,152500
-197,197,0,20,0,152625
-198,198,0,24,0,152750
-199,199,0,28,0,152875
-200,200,0,32,0,153000
-201,201,0,36,0,153125
-202,202,0,40,0,153250
-203,203,0,44,0,153375
-204,204,0,48,0,153500
-205,205,0,52,0,153625
-206,206,0,56,0,153750
-207,207,0,60,0,153875
-208,208,0,64,0,154000
-209,209,0,68,0,154125
-210,210,0,72,0,154250
-211,211,0,76,0,154375
-212,212,0,80,0,154500
-213,213,0,84,0,154625
-214,214,0,88,0,154750
-215,215,0,92,0,154875
-216,216,0,96,0,155000
-217,217,0,100,0,155125
-218,218,0,104,0,155250
-219,219,0,108,0,155375
-220,220,0,112,0,155500
-221,221,0,116,0,155625
-222,222,0,120,0,155750
-223,223,0,124,0,155875
-224,224,0,128,255,156000
-225,225,0,132,255,156125
-226,226,0,136,255,156250
-227,227,0,140,255,156375
-228,228,0,144,255,156500
-229,229,0,148,255,156625
-230,230,0,152,255,156750
-231,231,0,156,255,156875
-232,232,0,160,255,157000
-233,233,0,164,255,157125
-234,234,0,168,255,157250
-235,235,0,172,255,157375
-236,236,0,176,255,157500
-237,237,0,180,255,157625
-238,238,0,184,255,157750
-239,239,0,188,255,157875
-240,240,0,192,255,158000
-241,241,0,196,255,158125
-242,242,0,200,255,158250
-243,243,0,204,255,158375
-244,244,0,208,255,158500
-245,245,0,212,255,158625
-246,246,0,216,255,158750
-247,247,0,220,255,158875
-248,248,0,224,255,159000
-249,249,0,228,255,159125
-250,250,0,232,255,159250
-251,251,0,236,255,159375
-252,252,0,240,255,159500
-253,253,0,244,255,159625
-254,254,0,248,255,159750
-255,255,0,252,255,159875
-0,255,255,0,0,160000
-1,254,255,4,0,160125
-2,253,255,8,0,160250
-3,252,255,12,0,160375
-4,251,255,16,0,160500
-5,250,255,20,0,160625
-6,249,255,24,0,160750
-7,248,255,28,0,160875
-8,247,255,32,0,161000
-9,246,255,36,0,161125
-10,245,255,40,0,161250
-11,244,255,44,0,161375
-12,243,255,48,0,161500
-13,242,255,52,0,161625
-14,241,255,56,0,161750
-15,240,255,60,0,161875
-16,239,255,64,0,162000
-17,238,255,68,0,162125
-18,237,255,72,0,162250
-19,236,255,76,0,162375
-20,235,255,80,0,162500
-21,234,255,84,0,162625
-22,233,255,88,0,162750
-23,232,255,92,0,162875
-24,231,255,96,0,163000
-25,230,255,100,0,163125
-26,229,255,104,0,163250
-27,228,255,108,0,163375
-28,227,255,112,0,163500
-29,226,255,116,0,163625
-30,225,255,120,0,163750
-31,224,255,124,0,163875
-32,223,255,128,255,164000
-33,222,255,132,255,164125
-34,221,255,136,255,164250
-35,220,255,140,255,164375
-36,219,255,144,255,164500
-37,218,255,148,255,164625
-38,217,255,152,255,164750
-39,216,255,156,255,164875
-40,215,255,160,255,165000
-41,214,255,164,255,165125
-42,213,255,168,255,165250
-43,212,255,172,255,165375
-44,211,255,176,255,165500
-45,210,255,180,255,165625
-46,209,255,184,255,165750
-47,208,255,188,255,165875
-48,207,255,192,255,166000
-49,206,255,196,255,166125
-50,205,255,200,255,166250
-51,204,255,204,255,166375
-52,203,255,208,255,166500
-53,202,255,212,255,166625
-54,201,255,216,255,166750
-55,200,255,220,255,166875
-56,199,255,224,255,167000
-57,198,255,228,255,167125
-58,197,255,232,255,167250
-59,196,255,236,255,167375
-60,195,255,240,255,167500
-61,194,255,244,255,167625
-62,193,255,248,255,167750
-63,192,255,252,255,167875
-64,191,255,0,0,168000
-65,190,255,4,0,168125
-66,189,255,8,0,168250
-67,188,255,12,0,168375
-68,187,255,16,0,168500
-69,186,255,20,0,168625
-70,185,255,24,0,168750
-71,184,255,28,0,168875
-72,183,255,32,0,169000
-73,182,255,36,0,169125
-74,181,255,40,0,169250
-75,180,255,44,0,169375
-76,179,255,48,0,169500
-77,178,255,52,0,169625
-78,177,255,56,0,169750
-79,176,255,60,0,169875
-80,175,255,64,0,170000
-81,174,255,68,0,170125
-82,173,255,72,0,170250
-83,172,255,76,0,170375
-84,171,255,80,0,170500
-85,170,255,84,0,170625
-86,169,255,88,0,170750
-87,168,255,92,0,170875
-88,167,255,96,0,171000
-89,166,255,100,0,171125
-90,165,255,104,0,171250
-91,164,255,108,0,171375
-92,163,255,112,0,171500
-93,162,255,116,0,171625
-94,161,255,120,0,171750
-95,160,255,124,0,171875
-96,159,255,128,255,172000
-97,158,255,132,255,172125
-98,157,255,136,255,172250
-99,156,255,140,255,172375
-100,155,255,144,255,172500
-101,154,255,148,255,172625
-102,153,255,152,255,172750
-103,152,255,156,255,172875
-104,151,255,160,255,173000
-105,150,255,164,255,173125
-106,149,255,168,255,173250
-107,148,255,172,255,173375
-108,147,255,176,255,173500
-109,146,255,180,255,173625
-110,145,255,184,255,173750
-111,144,255,188,255,173875
-112,143,255,192,255,174000
-113,142,255,196,255,174125
-114,141,255,200,255,174250
-115,140,255,204,255,174375
-116,139,255,208,255,174500
-117,138,255,212,255,174625
-118,137,255,216,255,174750
-119,136,255,220,255,174875
-120,135,255,224,255,175000
-121,134,255,228,255,175125
-122,133,255,232,255,175250
-123,132,255,236,255,175375
-124,131,255,240,255,175500
-125,130,255,244,255,175625
-126,129,255,248,255,175750
-127,128,255,252,255,175875
-128,127,255,0,0,176000
-129,126,255,4,0,176125
-130,125,255,8,0,176250
-131,124,255,12,0,176375
-132,123,255,16,0,176500
-133,122,255,20,0,176625
-134,121,255,24,0,176750
-135,120,255,28,0,176875
-136,119,255,32,0,177000
-137,118,255,36,0,177125
-138,117,255,40,0,177250
-139,116,255,44,0,177375
-140,115,255,48,0,177500
-141,114,255,52,0,177625
-142,113,255,56,0,177750
-143,112,255,60,0,177875
-144,111,255,64,0,178000
-145,110,255,68,0,178125
-146,109,255,72,0,178250
-147,108,255,76,0,178375
-148,107,255,80,0,178500
-149,106,255,84,0,178625
-150,105,255,88,0,178750
-151,104,255,92,0,178875
-152,103,255,96,0,179000
-153,102,255,100,0,179125
-154,101,255,104,0,179250
-155,100,255,108,0,179375
-156,99,255,112,0,179500
-157,98,255,116,0,179625
-158,97,255,120,0,179750
-159,96,255,124,0,179875
-160,95,255,128,255,180000
-161,94,255,132,255,180125
-162,93,255,136,255,180250
-163,92,255,140,255,180375
-164,91,255,144,255,180500
-165,90,255,148,255,180625
-166,89,255,152,255,180750
-167,88,255,156,255,180875
-168,87,255,160,255,181000
-169,86,255,164,255,181125
-170,85,255,168,255,181250
-171,84,255,172,255,181375
-172,83,255,176,255,181500
-173,82,255,180,255,181625
-174,81,255,184,255,181750
-175,80,255,188,255,181875
-176,79,255,192,255,182000
-177,78,255,196,255,182125
-178,77,255,200,255,182250
-179,76,255,204,255,182375
-180,75,255,208,255,182500
-181,74,255,212,255,182625
-182,73,255,216,255,182750
-183,72,255,220,255,182875
-184,71,255,224,255,183000
-185,70,255,228,255,183125
-186,69,255,232,255,183250
-187,68,255,236,255,183375
-188,67,255,240,255,183500
-189,66,255,244,255,183625
-190,65,255,248,255,183750
-191,64,255,252,255,183875
-192,63,255,0,0,184000
-193,62,255,4,0,184125
-194,61,255,8,0,184250
-195,60,255,12,0,184375
-196,59,255,16,0,184500
-197,58,255,20,0,184625
-198,57,255,24,0,184750
-199,56,255,28,0,184875
-200,55,255,32,0,185000
-201,54,255,36,0,185125
-202,53,255,40,0,185250
-203,52,255,44,0,185375
-204,51,255,48,0,185500
-205,50,255,52,0,185625
-206,49,255,56,0,185750
-207,48,255,60,0,185875
-208,47,255,64,0,186000
-209,46,255,68,0,186125
-210,45,255,72,0,186250
-211,44,255,76,0,186375
-212,43,255,80,0,186500
-213,42,255,84,0,186625
-214,41,255,88,0,186750
-215,40,255,92,0,186875
-216,39,255,96,0,187000
-217,38,255,100,0,187125
-218,37,255,104,0,187250
-219,36,255,108,0,187375
-220,35,255,112,0,187500
-221,34,255,116,0,187625
-222,33,255,120,0,187750
-223,32,255,124,0,187875
-224,31,255,128,255,188000
-225,30,255,132,255,188125
-226,29,255,136,255,188250
-227,28,255,140,255,188375
-228,27,255,144,255,188500
-229,26,255,148,255,188625
-230,25,255,152,255,188750
-231,24,255,156,255,188875
-232,23,255,160,255,189000
-233,22,255,164,255,189125
-234,21,255,168,255,189250
-235,20,255,172,255,189375
-236,19,255,176,255,189500
-237,18,255,180,255,189625
-238,17,255,184,255,189750
-239,16,255,188,255,189875
-240,15,255,192,255,190000
-241,14,255,196,255,190125
-242,13,255,200,255,190250
-243,12,255,204,255,190375
-244,11,255,208,255,190500
-245,10,255,212,255,190625
-246,9,255,216,255,190750
-247,8,255,220,255,190875
-248,7,255,224,255,191000
-249,6,255,228,255,191125
-250,5,255,232,255,191250
-251,4,255,236,255,191375
-252,3,255,240,255,191500
-253,2,255,244,255,191625
-254,1,255,248,255,191750
-255,0,255,252,255,191875
-0,0,0,0,0,192000
-1,1,0,4,0,192125
-2,2,0,8,0,192250
-3,3,0,12,0,192375
-4,4,0,16,0,192500
-5,5,0,20,0,192625
-6,6,0,24,0,192750
-7,7,0,28,0,192875
-8,8,0,32,0,193000
-9,9,0,36,0,193125
-10,10,0,40,0,193250
-11,11,0,44,0,193375
-12,12,0,48,0,193500
-13,13,0,52,0,193625
-14,14,0,56,0,193750
-15,15,0,60,0,193875
-16,16,0,64,0,194000
-17,17,0,68,0,194125
-18,18,0,72,0,194250
-19,19,0,76,0,194375
-20,20,0,80,0,194500
-21,21,0,84,0,194625
-22,22,0,88,0,194750
-23,23,0,92,0,194875
-24,24,0,96,0,195000
-25,25,0,100,0,195125
-26,26,0,104,0,195250
-27,27,0,108,0,195375
-28,28,0,112,0,195500
-29,29,0,116,0,195625
-30,30,0,120,0,195750
-31,31,0,124,0,195875
-32,32,0,128,255,196000
-33,33,0,132,255,196125
-34,34,0,136,255,196250
-35,35,0,140,255,196375
-36,36,0,144,255,196500
-37,37,0,148,255,196625
-38,38,0,152,255,196750
-39,39,0,156,255,196875
-40,40,0,160,255,197000
-41,41,0,164,255,197125
-42,42,0,168,255,197250
-43,43,0,172,255,197375
-44,44,0,176,255,197500
-45,45,0,180,255,197625
-46,46,0,184,255,197750
-47,47,0,188,255,197875
-48,48,0,192,255,198000
-49,49,0,196,255,198125
-50,50,0,200,255,198250
-51,51,0,204,255,198375
-52,52,0,208,255,198500
-53,53,0,212,255,198625
-54,54,0,216,255,198750
-55,55,0,220,255,198875
-56,56,0,224,255,199000
-57,57,0,228,255,199125
-58,58,0,232,255,199250
-59,59,0,236,255,199375
-60,60,0,240,255,199500
-61,61,0,244,255,199625
-62,62,0,248,255,199750
-63,63,0,252,255,199875
-64,64,0,0,0,200000
-65,65,0,4,0,200125
-66,66,0,8,0,200250
-67,67,0,12,0,200375
-68,68,0,16,0,200500
-69,69,0,20,0,200625
-70,70,0,24,0,200750
-71,71,0,28,0,200875
-72,72,0,32,0,201000
-73,73,0,36,0,201125
-74,74,0,40,0,201250
-75,75,0,44,0,201375
-76,76,0,48,0,201500
-77,77,0,52,0,201625
-78,78,0,56,0,201750
-79,79,0,60,0,201875
-80,80,0,64,0,202000
-81,81,0,68,0,202125
-82,82,0,72,0,202250
-83,83,0,76,0,202375
-84,84,0,80,0,202500
-85,85,0,84,0,202625
-86,86,0,88,0,202750
-87,87,0,92,0,202875
-88,88,0,96,0,203000
-89,89,0,100,0,203125
-90,90,0,104,0,203250
-91,91,0,108,0,203375
-92,92,0,112,0,203500
-93,93,0,116,0,203625
-94,94,0,120,0,203750
-95,95,0,124,0,203875
-96,96,0,128,255,204000
-97,97,0,132,255,204125
-98,98,0,136,255,204250
-99,99,0,140,255,204375
-100,100,0,144,255,204500
-101,101,0,148,255,204625
-102,102,0,152,255,204750
-103,103,0,156,255,204875
-104,104,0,160,255,205000
-105,105,0,164,255,205125
-106,106,0,168,255,205250
-107,107,0,172,255,205375
-108,108,0,176,255,205500
-109,109,0,180,255,205625
-110,110,0,184,255,205750
-111,111,0,188,255,205875
-112,112,0,192,255,206000
-113,113,0,196,255,206125
-114,114,0,200,255,206250
-115,115,0,204,255,206375
-116,116,0,208,255,206500
-117,117,0,212,255,206625
-118,118,0,216,255,206750
-119,119,0,220,255,206875
-120,120,0,224,255,207000
-121,121,0,228,255,207125
-122,122,0,232,255,207250
-123,123,0,236,255,207375
-124,124,0,240,255,207500
-125,125,0,244,255,207625
-126,126,0,248,255,207750
-127,127,0,252,255,207875
-128,128,0,0,0,208000
-129,129,0,4,0,208125
-130,130,0,8,0,208250
-131,131,0,12,0,208375
-132,132,0,16,0,208500
-133,133,0,20,0,208625
-134,134,0,24,0,208750
-135,135,0,28,0,208875
-136,136,0,32,0,209000
-137,137,0,36,0,209125
-138,138,0,40,0,209250
-139,139,0,44,0,209375
-140,140,0,48,0,209500
-141,141,0,52,0,209625
-142,142,0,56,0,209750
-143,143,0,60,0,209875
-144,144,0,64,0,210000
-145,145,0,68,0,210125
-146,146,0,72,0,210250
-147,147,0,76,0,210375
-148,148,0,80,0,210500
-149,149,0,84,0,210625
-150,150,0,88,0,210750
-151,151,0,92,0,210875
-152,152,0,96,0,211000
-153,153,0,100,0,211125
-154,154,0,104,0,211250
-155,155,0,108,0,211375
-156,156,0,112,0,211500
-157,157,0,116,0,211625
-158,158,0,120,0,211750
-159,159,0,124,0,211875
-160,160,0,128,255,212000
-161,161,0,132,255,212125
-162,162,0,136,255,212250
-163,163,0,140,255,212375
-164,164,0,144,255,212500
-165,165,0,148,255,212625
-166,166,0,152,255,212750
-167,167,0,156,255,212875
-168,168,0,160,255,213000
-169,169,0,164,255,213125
-170,170,0,168,255,213250
-171,171,0,172,255,213375
-172,172,0,176,255,213500
-173,173,0,180,255,213625
-174,174,0,184,255,213750
-175,175,0,188,255,213875
-176,176,0,192,255,214000
-177,177,0,196,255,214125
-178,178,0,200,255,214250
-179,179,0,204,255,214375
-180,180,0,208,255,214500
-181,181,0,212,255,214625
-182,182,0,216,255,214750
-183,183,0,220,255,214875
-184,184,0,224,255,215000
-185,185,0,228,255,215125
-186,186,0,232,255,215250
-187,187,0,236,255,215375
-188,188,0,240,255,215500
-189,189,0,244,255,215625
-190,190,0,248,255,215750
-191,191,0,252,255,215875
-192,192,0,0,0,216000
-193,193,0,4,0,216125
-194,194,0,8,0,216250
-195,195,0,12,0,216375
-196,196,0,16,0,216500
-197,197,0,20,0,216625
-198,198,0,24,0,216750
-199,199,0,28,0,216875
-200,200,0,32,0,217000
-201,201,0,36,0,217125
-202,202,0,40,0,217250
-203,203,0,44,0,217375
-204,204,0,48,0,217500
-205,205,0,52,0,217625
-206,206,0,56,0,217750
-207,207,0,60,0,217875
-208,208,0,64,0,218000
-209,209,0,68,0,218125
-210,210,0,72,0,218250
-211,211,0,76,0,218375
-212,212,0,80,0,218500
-213,213,0,84,0,218625
-214,214,0,88,0,218750
-215,215,0,92,0,218875
-216,216,0,96,0,219000
-217,217,0,100,0,219125
-218,218,0,104,0,219250
-219,219,0,108,0,219375
-220,220,0,112,0,219500
-221,221,0,116,0,219625
-222,222,0,120,0,219750
-223,223,0,124,0,219875
-224,224,0,128,255,220000
-225,225,0,132,255,220125
-226,226,0,136,255,220250
-227,227,0,140,255,220375
-228,228,0,144,255,220500
-229,229,0,148,255,220625
-230,230,0,152,255,220750
-231,231,0,156,255,220875
-232,232,0,160,255,221000
-233,233,0,164,255,221125
-234,234,0,168,255,221250
-235,235,0,172,255,221375
-236,236,0,176,255,221500
-237,237,0,180,255,221625
-238,238,0,184,255,221750
-239,239,0,188,255,221875
-240,240,0,192,255,222000
-241,241,0,196,255,222125
-242,242,0,200,255,222250
-243,243,0,204,255,222375
-244,244,0,208,255,222500
-245,245,0,212,255,222625
-246,246,0,216,255,222750
-247,247,0,220,255,222875
-248,248,0,224,255,223000
-249,249,0,228,255,223125
-250,250,0,232,255,223250
-251,251,0,236,255,223375
-252,252,0,240,255,223500
-253,253,0,244,255,223625
-254,254,0,248,255,223750
-255,255,0,252,255,223875
-0,255,255,0,0,224000
-1,254,255,4,0,224125
-2,253,255,8,0,224250
-3,252,255,12,0,224375
-4,251,255,16,0,224500
-5,250,255,20,0,224625
-6,249,255,24,0,224750
-7,248,255,28,0,224875
-8,247,255,32,0,225000
-9,246,255,36,0,225125
-10,245,255,40,0,225250
-11,244,255,44,0,225375
-12,243,255,48,0,225500
-13,242,255,52,0,225625
-14,241,255,56,0,225750
-15,240,255,60,0,225875
-16,239,255,64,0,226000
-17,238,255,68,0,226125
-18,237,255,72,0,226250
-19,236,255,76,0,226375
-20,235,255,80,0,226500
-21,234,255,84,0,226625
-22,233,255,88,0,226750
-23,232,255,92,0,226875
-24,231,255,96,0,227000
-25,230,255,100,0,227125
-26,229,255,104,0,227250
-27,228,255,108,0,227375
-28,227,255,112,0,227500
-29,226,255,116,0,227625
-30,225,255,120,0,227750
-31,224,255,124,0,227875
-32,223,255,128,255,228000
-33,222,255,132,255,228125
-34,221,255,136,255,228250
-35,220,255,140,255,228375
-36,219,255,144,255,228500
-37,218,255,148,255,228625
-38,217,255,152,255,228750
-39,216,255,156,255,228875
-40,215,255,160,255,229000
-41,214,255,164,255,229125
-42,213,255,168,255,229250
-43,212,255,172,255,229375
-44,211,255,176,255,229500
-45,210,255,180,255,229625
-46,209,255,184,255,229750
-47,208,255,188,255,229875
-48,207,255,192,255,230000
-49,206,255,196,255,230125
-50,205,255,200,255,230250
-51,204,255,204,255,230375
-52,203,255,208,255,230500
-53,202,255,212,255,230625
-54,201,255,216,255,230750
-55,200,255,220,255,230875
-56,199,255,224,255,231000
-57,198,255,228,255,231125
-58,197,255,232,255,231250
-59,196,255,236,255,231375
-60,195,255,240,255,231500
-61,194,255,244,255,231625
-62,193,255,248,255,231750
-63,192,255,252,255,231875
-64,191,255,0,0,232000
-65,190,255,4,0,232125
-66,189,255,8,0,232250
-67,188,255,12,0,232375
-68,187,255,16,0,232500
-69,186,255,20,0,232625
-70,185,255,24,0,232750
-71,184,255,28,0,232875
-72,183,255,32,0,233000
-73,182,255,36,0,233125
-74,181,255,40,0,233250
-75,180,255,44,0,233375
-76,179,255,48,0,233500
-77,178,255,52,0,233625
-78,177,255,56,0,233750
-79,176,255,60,0,233875
-80,175,255,64,0,234000
-81,174,255,68,0,234125
-82,173,255,72,0,234250
-83,172,255,76,0,234375
-84,171,255,80,0,234500
-85,170,255,84,0,234625
-86,169,255,88,0,234750
-87,168,255,92,0,234875
-88,167,255,96,0,235000
-89,166,255,100,0,235125
-90,165,255,104,0,235250
-91,164,255,108,0,235375
-92,163,255,112,0,235500
-93,162,255,116,0,235625
-94,161,255,120,0,235750
-95,160,255,124,0,235875
-96,159,255,128,255,236000
-97,158,255,132,255,236125
-98,157,255,136,255,236250
-99,156,255,140,255,236375
-100,155,255,144,255,236500
-101,154,255,148,255,236625
-102,153,255,152,255,236750
-103,152,255,156,255,236875
-104,151,255,160,255,237000
-105,150,255,164,255,237125
-106,149,255,168,255,237250
-107,148,255,172,255,237375
-108,147,255,176,255,237500
-109,146,255,180,255,237625
-110,145,255,184,255,237750
-111,144,255,188,255,237875
-112,143,255,192,255,238000
-113,142,255,196,255,238125
-114,141,255,200,255,238250
-115,140,255,204,255,238375
-116,139,255,208,255,238500
-117,138,255,212,255,238625
-118,137,255,216,255,238750
-119,136,255,220,255,238875
-120,135,255,224,255,239000
-121,134,255,228,255,239125
-122,133,255,232,255,239250
-123,132,255,236,255,239375
-124,131,255,240,255,239500
-125,130,255,244,255,239625
-126,129,255,248,255,239750
-127,128,255,252,255,239875
-128,127,255,0,0,240000
-129,126,255,4,0,240125
-130,125,255,8,0,240250
-131,124,255,12,0,240375
-132,123,255,16,0,240500
-133,122,255,20,0,240625
-134,121,255,24,0,240750
-135,120,255,28,0,240875
-136,119,255,32,0,241000
-137,118,255,36,0,241125
-138,117,255,40,0,241250
-139,116,255,44,0,241375
-140,115,255,48,0,241500
-141,114,255,52,0,241625
-142,113,255,56,0,241750
-143,112,255,60,0,241875
-144,111,255,64,0,242000
-145,110,255,68,0,242125
-146,109,255,72,0,242250
-147,108,255,76,0,242375
-148,107,255,80,0,242500
-149,106,255,84,0,242625
-150,105,255,88,0,242750
-151,104,255,92,0,242875
-152,103,255,96,0,243000
-153,102,255,100,0,243125
-154,101,255,104,0,243250
-155,100,255,108,0,243375
-156,99,255,112,0,243500
-157,98,255,116,0,243625
-158,97,255,120,0,243750
-159,96,255,124,0,243875
-160,95,255,128,255,244000
-161,94,255,132,255,244125
-162,93,255,136,255,244250
-163,92,255,140,255,244375
-164,91,255,144,255,244500
-165,90,255,148,255,244625
-166,89,255,152,255,244750
-167,88,255,156,255,244875
-168,87,255,160,255,245000
-169,86,255,164,255,245125
-170,85,255,168,255,245250
-171,84,255,172,255,245375
-172,83,255,176,255,245500
-173,82,255,180,255,245625
-174,81,255,184,255,245750
-175,80,255,188,255,245875
-176,79,255,192,255,246000
-177,78,255,196,255,246125
-178,77,255,200,255,246250
-179,76,255,204,255,246375
-180,75,255,208,255,246500
-181,74,255,212,255,246625
-182,73,255,216,255,246750
-183,72,255,220,255,246875
-184,71,255,224,255,247000
-185,70,255,228,255,247125
-186,69,255,232,255,247250
-187,68,255,236,255,247375
-188,67,255,240,255,247500
-189,66,255,244,255,247625
-190,65,255,248,255,247750
-191,64,255,252,255,247875
-192,63,255,0,0,248000
-193,62,255,4,0,248125
-194,61,255,8,0,248250
-195,60,255,12,0,248375
-196,59,255,16,0,248500
-197,58,255,20,0,248625
-198,57,255,24,0,248750
-199,56,255,28,0,248875
-200,55,255,32,0,249000
-201,54,255,36,0,249125
-202,53,255,40,0,249250
-203,52,255,44,0,249375
-204,51,255,48,0,249500
-205,50,255,52,0,249625
-206,49,255,56,0,249750
-207,48,255,60,0,249875
-208,47,255,64,0,250000
-209,46,255,68,0,250125
-210,45,255,72,0,250250
-211,44,255,76,0,250375
-212,43,255,80,0,250500
-213,42,255,84,0,250625
-214,41,255,88,0,250750
-215,40,255,92,0,250875
-216,39,255,96,0,251000
-217,38,255,100,0,251125
-218,37,255,104,0,251250
-219,36,255,108,0,251375
-220,35,255,112,0,251500
-221,34,255,116,0,251625
-222,33,255,120,0,251750
-223,32,255,124,0,251875
-224,31,255,128,255,252000
-225,30,255,132,255,252125
-226,29,255,136,255,252250
-227,28,255,140,255,252375
-228,27,255,144,255,252500
-229,26,255,148,255,252625
-230,25,255,152,255,252750
-231,24,255,156,255,252875
-232,23,255,160,255,253000
-233,22,255,164,255,253125
-234,21,255,168,255,253250
-235,20,255,172,255,253375
-236,19,255,176,255,253500
-237,18,255,180,255,253625
-238,17,255,184,255,253750
-239,16,255,188,255,253875
-240,15,255,192,255,254000
-241,14,255,196,255,254125
-242,13,255,200,255,254250
-243,12,255,204,255,254375
-244,11,255,208,255,254500
-245,10,255,212,255,254625
-246,9,255,216,255,254750
-247,8,255,220,255,254875
-248,7,255,224,255,255000
-249,6,255,228,255,255125
-250,5,255,232,255,255250
-251,4,255,236,255,255375
-252,3,255,240,255,255500
-253,2,255,244,255,255625
-254,1,255,248,255,255750
-255,0,255,252,255,255875
diff --git a/cmpen472hw11_McDonnell/ASM_layout.hwl b/cmpen472hw11_McDonnell/ASM_layout.hwl
new file mode 100644
index 0000000..22795c3
--- /dev/null
+++ b/cmpen472hw11_McDonnell/ASM_layout.hwl
@@ -0,0 +1,27 @@
+OPEN source 0 0 60 42
+Source < attributes TOOLTIP on,TOOLTIP_FORMAT signed,TOOLTIP_MODE details,FREEZE off,MARKS off
+OPEN assembly 60 0 40 30
+Assembly < attributes ADR on,CODE off,ABSADR on,SYMB off,FORMAT Auto,FREEZE off,TOPPC 0x3100
+OPEN procedure 60 60 40 17
+Procedure < attributes VALUES on,TYPES off
+OPEN register 60 30 40 30
+Register < attributes FORMAT AUTO,COMPLEMENT None
+OPEN memory 60 77 40 23
+Memory < attributes FORMAT hex,COMPLEMENT None,WORD 1,ASC on,ADR on,MODE automatic,UPDATERATE 10,ADDRESS 0x80
+OPEN data 0 42 60 28
+Data < attributes SCOPE global,COMPLEMENT None,FORMAT Symb,MODE automatic,SORT NotSort,UPDATERATE 10,NAMEWIDTH 16
+OPEN command 0 70 60 30
+Command < attributes CACHESIZE 1000
+OPEN Terminal 10 20 40 69
+Terminal < attributes CACHESIZE 1000
+Terminal < attributes SCI_DEFAULT_TEXT "Virtual SCI",SCI_CONNECTION 0,1,SCI_CONNECTION 1,0,SCI_CONNECTION 1,3,SCI_CONNECTION 3,1,SCI_PORT COM1,SCI_BAUD 9600,SCI_SHOW_PROTOCOL OFF,SCI_VIRTUAL_IN "Sci:2.SerialOutput",SCI_VIRTUAL_OUT "Sci:2.SerialInput",SCI_FILENAME_IN "",SCI_FILENAME_OUT ""
+OPEN Visualizationtool 76 37 11 29
+VisualizationTool< Attributes [stEditM="0",swRefresh="3",refCycles="1"]
+VisualizationTool< LoadInstrument Seg7[BoundX="26",BoundY="12",Port="0x1",swDM="2"]
+VisualizationTool< LoadInstrument Seg7[BoundX="67",BoundY="14",Port="0x1",swDM="1"]
+VisualizationTool< LoadInstrument DILSwitch[BoundX="25",BoundY="106",Port="0x1"]
+VisualizationTool< ResetVT Undo
+bckcolor 50331647
+font 'Courier New' 9 BLACK
+AUTOSIZE on
+ACTIVATE "Assembly" "Memory" "Register" "Command" "Data" "Source" "Procedure" "Terminal" "VisualizationTool"
diff --git a/cmpen472hw11_McDonnell/Default.mem b/cmpen472hw11_McDonnell/Default.mem
new file mode 100644
index 0000000..bf49148
--- /dev/null
+++ b/cmpen472hw11_McDonnell/Default.mem
Binary files differ
diff --git a/cmpen472hw11_McDonnell/Full_Chip_Simulation.hwc b/cmpen472hw11_McDonnell/Full_Chip_Simulation.hwc
new file mode 100644
index 0000000..f3ce7c9
--- /dev/null
+++ b/cmpen472hw11_McDonnell/Full_Chip_Simulation.hwc
@@ -0,0 +1 @@
+LOADMEM default.mem
diff --git a/cmpen472hw11_McDonnell/Full_Chip_Simulation.ini b/cmpen472hw11_McDonnell/Full_Chip_Simulation.ini
new file mode 100644
index 0000000..ebc46ea
--- /dev/null
+++ b/cmpen472hw11_McDonnell/Full_Chip_Simulation.ini
@@ -0,0 +1,42 @@
+[Environment Variables]
+GENPATH={Project}Sources;{Compiler}lib\hc12c\src;{Compiler}lib\hc12c\include;{Compiler}lib\hc12c\lib;{Compiler}lib\xgatec\src;{Compiler}lib\xgatec\include;{Compiler}lib\xgatec\lib
+LIBPATH={Compiler}lib\hc12c\include;{Compiler}lib\xgatec\include
+OBJPATH={Project}bin
+TEXTPATH={Project}bin
+ABSPATH={Project}bin
+
+[HI-WAVE]
+Target=sim
+Layout=ASM_layout.hwl
+LoadDialogOptions=AUTOERASEANDFLASH NORUNAFTERLOAD
+CPU=HC12
+MainFrame=2,3,-1,-1,-1,-1,-7,68,1745,1084
+Configuration=Full_Chip_Simulation.hwc
+Statusbar=1
+ShowToolbar=1
+Smallborder=0
+Hideheadline=0
+Hidetitle=0
+TOOLBAR=57600 57601 32795 0 57635 57634 57637 0 57671 57669 0 32777 32776 32782 32780 32781 32778 0 32806
+
+
+
+
+
+
+
+
+
+[Simulator]
+CMDFILE0=CMDFILE STARTUP ON ".\cmd\Full_Chip_Simulation_startup.cmd"
+
+[Simulator HC12]
+CMDFILE0=CMDFILE RESET ON ".\cmd\Full_Chip_Simulation_reset.cmd"
+CMDFILE1=CMDFILE PRELOAD ON ".\cmd\Full_Chip_Simulation_preload.cmd"
+CMDFILE2=CMDFILE POSTLOAD ON ".\cmd\Full_Chip_Simulation_postload.cmd"
+CMDFILE3=CMDFILE SETCPU ON ".\cmd\Full_Chip_Simulation_setcpu.cmd"
+HCS12_SUPPORT=1
+FCS=MC9S12C32
+ZEROTIMEATRESET=1
+OSCFREQUENCY=48000000
+DISPLAYTIME=0
diff --git a/cmpen472hw11_McDonnell/Sources/derivative.inc b/cmpen472hw11_McDonnell/Sources/derivative.inc
new file mode 100644
index 0000000..988343b
--- /dev/null
+++ b/cmpen472hw11_McDonnell/Sources/derivative.inc
@@ -0,0 +1,10 @@
+
+ ; Note: This file is recreated by the project wizard whenever the MCU is
+ ; changed and should not be edited by hand
+ ;
+
+ ; include derivative specific macros
+ INCLUDE 'mc9s12c32.inc'
+
+
+
diff --git a/cmpen472hw11_McDonnell/Sources/example.asm b/cmpen472hw11_McDonnell/Sources/example.asm
new file mode 100644
index 0000000..0ab912d
--- /dev/null
+++ b/cmpen472hw11_McDonnell/Sources/example.asm
@@ -0,0 +1,356 @@
+;*******************************************************
+;* CMPEN 472, 2022 Spring
+;* Homework 10: Timer Interrupt Sample Program,
+;* MC9S12C128 Program (set to MC9S12C32 for Simulation/Debug)
+;* CodeWarrior Simulator/Debug edition, not for CSM-12C128 board
+;* Nov. 01, 2021 Kyusun Choi
+;* March 27, 2022 Kyusun Choi
+;* Nov. 07, 2022 Kyusun Choi
+;*
+;* This program is a 1024 data transfer program running on the
+;* CodeWarrior Debugger/Simulator as follows:
+;* 1. Program starts with print messages on the simulator Terminal,
+;* an intro message at 1.5M baud (this program will not work
+;* on the CSM-12C128 board - 1.5M baud too fast).
+;* 2. Then user may hit any key, it's a typewriter program at 1.5M baud.
+;* But hitting the Enter key will terminate the typewriter mode with
+;* the instruction message print.
+;* 3. Two messages are (1) start terminal data capture into a file and
+;* (2) hit Enter key for the 1024 data transfer to begin.
+;* 4. At this time, user setup the Terminal Output file, data capture to a file.
+;* 5. User hits an Enter key to send 1024 data, to the Terminal and
+;* the data saved in to a file named RxData3.txt which may be looked at
+;* or plotted using Excel sheet.
+;* 6. User may repeat the step 3 above as many times as he/she like.
+;* User plots or prints the data to verify the correct data transmit.
+;*
+;* We assumed 24MHz bus clock and 4MHz external resonator clock frequency.
+;*
+;*******************************************************
+;*******************************************************
+
+; export symbols - program starting point
+ XDEF Entry ; export 'Entry' symbol
+ ABSENTRY Entry ; for assembly entry point
+
+; include derivative specific macros
+PORTB EQU $0001
+DDRB EQU $0003
+
+SCIBDH EQU $00C8 ; Serial port (SCI) Baud Register H
+SCIBDL EQU $00C9 ; Serial port (SCI) Baud Register L
+SCICR2 EQU $00CB ; Serial port (SCI) Control Register 2
+SCISR1 EQU $00CC ; Serial port (SCI) Status Register 1
+SCIDRL EQU $00CF ; Serial port (SCI) Data Register
+
+TIOS EQU $0040 ; Timer Input Capture (IC) or Output Compare (OC) select
+TIE EQU $004C ; Timer interrupt enable register
+TCNTH EQU $0044 ; Timer free runing main counter
+TSCR1 EQU $0046 ; Timer system control 1
+TSCR2 EQU $004D ; Timer system control 2
+TFLG1 EQU $004E ; Timer interrupt flag 1
+TC6H EQU $005C ; Timer channel 2 register
+
+CR equ $0d ; carriage return, ASCII 'Return' key
+LF equ $0a ; line feed, ASCII 'next line' character
+
+DATAmax equ 1024 ; Data count maximum, 1024 constant
+
+;*******************************************************
+; variable/data section
+ ORG $3000 ; RAMStart defined as $3000
+ ; in MC9S12C128 chip
+
+ctr125u DS.W 1 ; 16bit interrupt counter for 125 uSec. of time
+
+BUF DS.B 6 ; character buffer for a 16bit number in decimal ASCII
+CTR DS.B 1 ; character buffer fill count
+
+msg1 DC.B 'Hello, this is 1024 data transmit program.', $00
+msg2 DC.B 'When ready, hit Enter key.', $00
+;* more text messages at the End of this program
+
+;*******************************************************
+; interrupt vector section
+
+ ORG $FFE2 ; Timer channel 6 interrupt vector setup, on simulator
+ DC.W oc6isr
+
+;*******************************************************
+; code section
+
+ ORG $3100
+Entry
+ LDS #Entry ; initialize the stack pointer
+
+ LDAA #%11111111 ; Set PORTB bit 0,1,2,3,4,5,6,7
+ STAA DDRB ; as output
+ LDAA #%00000000 ; Clear PORTB bit 0,1,2,3,4,5,6,7
+ STAA PORTB ; Clear all bits of PORTB, initialize
+
+ ldaa #$0C ; Enable SCI port Tx and Rx units
+ staa SCICR2 ; disable SCI interrupts
+
+ ldd #$0001 ; Set SCI Baud Register = $0001 => 1.5M baud at 24MHz (for simulation)
+; ldd #$0002 ; Set SCI Baud Register = $0002 => 750K baud at 24MHz
+; ldd #$000D ; Set SCI Baud Register = $000D => 115200 baud at 24MHz
+; ldd #$009C ; Set SCI Baud Register = $009C => 9600 baud at 24MHz
+ std SCIBDH ; SCI port baud rate change
+
+ ldx #msg1 ; print the first message, '1024 data transmit'
+ jsr printmsg
+ jsr nextline
+
+ ldx #msg2 ; print the second message, user instruction,
+ jsr printmsg ; hit 'Enter'
+ jsr nextline
+
+mloop1
+ jsr getchar
+ cmpa #0
+ beq mloop1
+ jsr putchar ; type writer, with echo print
+ cmpa #CR
+ bne mloop1 ; if Enter/Return key is pressed, move the
+
+ ldaa #LF ; cursor to next line
+ jsr putchar
+
+ ldx #msg3 ; print '> Set Terminal save file RxData3.txt'
+ jsr printmsg
+ jsr nextline
+
+ ldx #msg4 ; print '> Press Enter/Return key to start sawtooth wave'
+ jsr printmsg
+ jsr nextline
+
+ jsr delay1ms ; flush out SCI serial port
+ ; wait to finish sending last characters
+
+mloop2
+ jsr getchar
+ cmpa #0
+ beq mloop2
+ cmpa #CR
+ bne mloop2 ; if Enter/Return key is pressed, move the
+
+ jsr nextline
+ jsr nextline
+ jsr delay1ms ; flush out SCI serial port
+ ; wait to finish sending last characters
+
+ ldx #0 ; Enter/Return key hit
+ stx ctr125u
+ jsr StartTimer6oc
+
+ CLI ; Interrupt enable, for Timer OC6 interrupt start
+
+
+loop1024
+ ldd ctr125u
+ cpd #DATAmax ; 1024 bytes will be sent, the receiver at Windows PC
+ bhs loopTxON ; will only take 1024 bytes.
+ bra loop1024 ; set Terminal Cache Size to 10000 lines, update from 1000 lines
+
+loopTxON
+ LDAA #%00000000
+ STAA TIE ; disable OC6 interrupt
+
+ jsr nextline
+ jsr nextline
+
+ ldx #msg5 ; print '> Done! Close Output file.'
+ jsr printmsg
+ jsr nextline
+
+ ldx #msg6 ; print '> Ready for next data transmission'
+ jsr printmsg
+ jsr nextline
+
+ BRA mloop2
+
+
+;subroutine section below
+
+;***********Timer OC6 interrupt service routine***************
+oc6isr
+ ldd #3000 ; 125usec with (24MHz/1 clock)
+ addd TC6H ; for next interrupt
+ std TC6H ;
+ bset TFLG1,%01000000 ; clear timer CH6 interrupt flag, not needed if fast clear enabled
+ ldd ctr125u
+ ldx ctr125u
+ inx ; update OC6 (125usec) interrupt counter
+ stx ctr125u
+ clra ; print ctr125u, only the last byte
+ jsr pnum10 ; to make the file RxData3.txt with exactly 1024 data
+oc2done RTI
+;***********end of Timer OC6 interrupt service routine********
+
+;***************StartTimer6oc************************
+;* Program: Start the timer interrupt, timer channel 6 output compare
+;* Input: Constants - channel 6 output compare, 125usec at 24MHz
+;* Output: None, only the timer interrupt
+;* Registers modified: D used and CCR modified
+;* Algorithm:
+; initialize TIOS, TIE, TSCR1, TSCR2, TC2H, and TFLG1
+;**********************************************
+StartTimer6oc
+ PSHD
+ LDAA #%01000000
+ STAA TIOS ; set CH6 Output Compare
+ STAA TIE ; set CH6 interrupt Enable
+ LDAA #%10000000 ; enable timer, Fast Flag Clear not set
+ STAA TSCR1
+ LDAA #%00000000 ; TOI Off, TCRE Off, TCLK = BCLK/1
+ STAA TSCR2 ; not needed if started from reset
+
+ LDD #3000 ; 125usec with (24MHz/1 clock)
+ ADDD TCNTH ; for first interrupt
+ STD TC6H ;
+
+ BSET TFLG1,%01000000 ; initial Timer CH6 interrupt flag Clear, not needed if fast clear set
+ LDAA #%01000000
+ STAA TIE ; set CH6 interrupt Enable
+ PULD
+ RTS
+;***************end of StartTimer2oc*****************
+
+
+;***********pnum10***************************
+;* Program: print a word (16bit) in decimal to SCI port
+;* Input: Register D contains a 16 bit number to print in decimal number
+;* Output: decimal number printed on the terminal connected to SCI port
+;*
+;* Registers modified: CCR
+;* Algorithm:
+; Keep divide number by 10 and keep the remainders
+; Then send it out to SCI port
+; Need memory location for counter CTR and buffer BUF(6 byte max)
+;**********************************************
+pnum10 pshd ;Save registers
+ pshx
+ pshy
+ clr CTR ; clear character count of an 8 bit number
+
+ ldy #BUF
+pnum10p1 ldx #10
+ idiv
+ beq pnum10p2
+ stab 1,y+
+ inc CTR
+ tfr x,d
+ bra pnum10p1
+
+pnum10p2 stab 1,y+
+ inc CTR
+;--------------------------------------
+
+pnum10p3 ldaa #$30
+ adda 1,-y
+ jsr putchar
+ dec CTR
+ bne pnum10p3
+ jsr nextline
+ puly
+ pulx
+ puld
+ rts
+;***********end of pnum10********************
+
+;***********printmsg***************************
+;* Program: Output character string to SCI port, print message
+;* Input: Register X points to ASCII characters in memory
+;* Output: message printed on the terminal connected to SCI port
+;*
+;* Registers modified: CCR
+;* Algorithm:
+; Pick up 1 byte from memory where X register is pointing
+; Send it out to SCI port
+; Update X register to point to the next byte
+; Repeat until the byte data $00 is encountered
+; (String is terminated with NULL=$00)
+;**********************************************
+NULL equ $00
+printmsg psha ;Save registers
+ pshx
+printmsgloop ldaa 1,X+ ;pick up an ASCII character from string
+ ; pointed by X register
+ ;then update the X register to point to
+ ; the next byte
+ cmpa #NULL
+ beq printmsgdone ;end of strint yet?
+ bsr putchar ;if not, print character and do next
+ bra printmsgloop
+printmsgdone pulx
+ pula
+ rts
+;***********end of printmsg********************
+
+;***************putchar************************
+;* Program: Send one character to SCI port, terminal
+;* Input: Accumulator A contains an ASCII character, 8bit
+;* Output: Send one character to SCI port, terminal
+;* Registers modified: CCR
+;* Algorithm:
+; Wait for transmit buffer become empty
+; Transmit buffer empty is indicated by TDRE bit
+; TDRE = 1 : empty - Transmit Data Register Empty, ready to transmit
+; TDRE = 0 : not empty, transmission in progress
+;**********************************************
+putchar brclr SCISR1,#%10000000,putchar ; wait for transmit buffer empty
+ staa SCIDRL ; send a character
+ rts
+;***************end of putchar*****************
+
+;****************getchar***********************
+;* Program: Input one character from SCI port (terminal/keyboard)
+;* if a character is received, other wise return NULL
+;* Input: none
+;* Output: Accumulator A containing the received ASCII character
+;* if a character is received.
+;* Otherwise Accumulator A will contain a NULL character, $00.
+;* Registers modified: CCR
+;* Algorithm:
+; Check for receive buffer become full
+; Receive buffer full is indicated by RDRF bit
+; RDRF = 1 : full - Receive Data Register Full, 1 byte received
+; RDRF = 0 : not full, 0 byte received
+;**********************************************
+
+getchar brclr SCISR1,#%00100000,getchar7
+ ldaa SCIDRL
+ rts
+getchar7 clra
+ rts
+;****************end of getchar****************
+
+;****************nextline**********************
+nextline
+ psha
+ ldaa #CR ; move the cursor to beginning of the line
+ jsr putchar ; Cariage Return/Enter key
+ ldaa #LF ; move the cursor to next line, Line Feed
+ jsr putchar
+ pula
+ rts
+;****************end of nextline***************
+
+;****************delay1ms**********************
+delay1ms: pshx
+ ldx #$1000 ; count down X, $8FFF may be more than 10ms
+d1msloop nop ; X <= X - 1
+ dex ; simple loop
+ bne d1msloop
+ pulx
+ rts
+;****************end of delay1ms***************
+
+msg3 DC.B '> Be sure to start saving Terminal data: open Output file = RxData3.txt', $00
+msg4 DC.B '> When ready, hit Enter/Return key for sawtooth wave, 1024 point print.', $00
+msg5 DC.B '> Done! You may close the Output file.', $00
+msg6 DC.B '> Ready for next data transmission, hit Enter key.', $00
+
+ END ; this is end of assembly source file
+ ; lines below are ignored - not assembled
+
diff --git a/cmpen472hw11_McDonnell/Sources/main.asm b/cmpen472hw11_McDonnell/Sources/main.asm
new file mode 100644
index 0000000..e9e65c3
--- /dev/null
+++ b/cmpen472hw11_McDonnell/Sources/main.asm
@@ -0,0 +1,1073 @@
+**************************************************************************
+*
+* Title: Signal Generator
+*
+* Objective: CMPEN 472 Homework 11
+*
+* Revision: V1.0
+*
+* Date: Apr. 11, 2025
+*
+* Programmer: Jacob McDonnell
+*
+* Company: The Pennsylvania State University
+* Department of Computer Science and Engineering
+*
+* Algorithm: Simple Serial I/O, Real Time Interrupts for Time Tracking, and
+* output compare timer for generating functions.
+*
+* Register Use: A & B to current byte, etc,
+* X & Y holds address of strings and length of string,
+* D to hold data for printing, reading, and updating time.
+*
+* Memory Use: RAM Locations from $3000 for data,
+* RAM Locations from $3100 for program
+*
+* Input: Serial Port for User Input
+*
+* Output: Serial Port for String Output
+*
+* Observation: The HC12 will output the time and a command prompt every second.
+* The user can input commands and the program will output a response
+* based on the input.
+*
+* Note: ON CSM-12C128 board,
+*
+* Comments: This program is developed and simulated using CodeWarrior
+* development software and targeted for Axion
+* Manufacturing's CSM-12C128 board running at 24MHz.
+*
+**************************************************************************
+* Parameter Declearation Section
+*
+* Export Symbols
+ xdef pgstart ; export 'pgstart' symbol
+ absentry pgstart ; for assembly entry point
+
+* Symbols and Macros
+PORTA equ $0000 ; i/o port A addresses
+DDRA equ $0002 ; data direction register for PORTA
+PORTB equ $0001 ; i/o port B addresses
+DDRB equ $0003 ; data direction register for PORTB
+
+SCIBDH equ $00C8 ; Serial port (SCI) Baud Register H
+SCIBDL equ $00C9 ; Serial port (SCI) Baud Register L
+SCICR2 equ $00CB ; Serial port (SCI) Control Register 2
+SCISR1 equ $00CC ; Serial port (SCI) Status Register 1
+SCIDRL equ $00CF ; Serial port (SCI) Data Register
+
+CRGFLG EQU $0037 ; Clock and Reset Generator Flags
+CRGINT EQU $0038 ; Clock and Reset Generator Interrupts
+RTICTL EQU $003B ; Real Time Interrupt Control
+
+TIOS EQU $0040 ; Timer Input Capture (IC) or Output Compare (OC) select
+TIE EQU $004C ; Timer interrupt enable register
+TCNTH EQU $0044 ; Timer free runing main counter
+TSCR1 EQU $0046 ; Timer system control 1
+TSCR2 EQU $004D ; Timer system control 2
+TFLG1 EQU $004E ; Timer interrupt flag 1
+TC1H EQU $0052 ; Timer channel 1 register
+
+CR equ $0d ; carriage return, ASCII 'Return' key
+LF equ $0a ; line feed, ASCII 'next line' character
+NULL equ $00 ; NULL Terminator character
+
+**************************************************************************
+* Data Section: address used [ $3000 to $30FF ] RAM Memory
+*
+ org $3000 ; Reserved RAM memory starting address
+ ; for Data for CMPEN 472 class
+buffer ds.b $0010 ; Array of 16 bytes to read a string
+ dc.b NULL ; NULL terminated
+lenBuf dc.w $0010 ; Length of buffer array
+
+buffer2 ds.b $0010 ; Array of 16 bytes for reading and reversal
+ dc.b NULL ; NULL terminated
+lenBuf2 dc.w $0010 ; length of buffer2
+
+hours dc.w $0000 ; Buffer to hold the hours of the time
+
+minutes dc.w $0000 ; Buffer to hold the minutes of the time
+
+seconds dc.w $0000 ; Buffer to hold the seconds of the time
+
+counter dc.w $0000 ; Counter for RTI ISR for 1 second
+
+numBuf dc.b $0000 ; Used by ReadDecimal for reading numbers
+
+operator dc.b $0000 ; Used by ReadDecimal for reading numbers
+
+inputBuffer ds.b $0010 ; Input Buffer Length
+ dc.b NULL
+
+lenInput dc.w $0010 ; Length of the Input Buffer
+
+outputBuf dc.b 's' ; Used to control what to output on 7 segment display
+
+outputVal dc.b $00 ; Used to track the output value of the wave
+
+outputCnt dc.w $0000 ; Used to track how many values have been outputted
+
+interval dc.w 3000 ; Used to set the timer module based on clock cycles
+
+numPoints dc.w 2048 ; Max Number of points for waves
+
+timeTrigger dc.b $00 ; Tracks when timer is triggered
+
+increment dc.w 1 ; Used for increment 31.25Hz -> 1
+ ; 125Hz -> 4
+
+waveType dc.b 'S' ; Used to track wave type 'T' for increasing triangle,
+ ; 't' for decreasing triangle,
+ ; 'Q' for square high
+ ; 'q' for square low
+ ; 'S' for sawtooth
+
+*
+* There is a section Data Section at the end of the file
+**************************************************************************
+* RTI Vector Section: address used [ $FFF0 to $FFF1 ] RAM Memory
+*
+ org $FFF0 ; Memory location for RTI interrupt vector section for simulator
+ dc.w rtiisr ; Real Time Interrupt vector
+*
+**************************************************************************
+* Timer Interrupt Vector Section: address used [ $FFEC to $FFED ] RAM Memory
+*
+ org $FFEC ; Timer channel 1 interrupt vector setup, on simulator
+ dc.w oc1isr
+*
+**************************************************************************
+* Program Section: address used [ $3100 to $3FFF ] RAM Memory
+*
+ org $3100 ; Program start address, in RAM
+pgstart lds #$3100 ; initialize the stack pointer
+
+ ldaa #%11110001 ; LED 1,2,3,4 at PORTB bit 4,5,6,7
+ staa DDRB ; set PORTB bit 4,5,6,7 as output
+
+ ldaa #$0C ; Enable SCI port Tx and Rx units
+ staa SCICR2 ; disable SCI interrupts
+
+ ldd #$0001 ; Set SCI Baud Register = $0001 => 1.5M baud at 24MHz (for simulation)
+ std SCIBDH ; SCI port baud rate change
+
+ ldx #msg ; Load the address of the welcome message into X
+ jsr WriteString ; Write the string to the serial console
+
+ bset RTICTL,%00011001; set RTI: dev=10*(2**10)=2.555msec for C128 board
+ ; 4MHz quartz oscillator clock
+ bset CRGINT,%10000000; enable RTI interrupt
+ bset CRGFLG,%10000000; clear RTI IF (Interrupt Flag)
+
+ ldaa #$FF ; Two 7 segment displays on PORTB
+ staa DDRB ; Set all of PORTB as output
+
+ cli ; Enable interrupts
+mainLoop
+ ldaa #'>' ; Load '>' character
+ jsr putchar ; Print to serial console
+ ldaa #' ' ; Load ' ' character
+ jsr putchar ; Print to serial console
+ ldx #inputBuffer ; Load the address of inputBuffer into X
+ ldy lenInput ; Load the length of inputBuffer into Y
+ jsr ReadString ; Jump to ReadString to read input
+
+ ldx #inputBuffer ; Load the address of inputBuffer into X
+ jsr ExecuteCommand ; Jump to ExecuteCommand
+
+ ldx #inputBuffer ; Load the address of inputBuffer into X
+ ldy lenInput ; Load the length of inputBuffer into Y
+ jsr Zeros ; Zero out input buffer
+
+ bra mainLoop ; Loop back to mainLoop always
+
+TypeWrite
+ sei ; Disable Interrupts
+ bclr CRGINT,%10000000; Disable RTI interrupt
+ ldx #twMsg ; Load the address of twMsg into X
+ jsr WriteString ; Write the string to the serial console
+twLoop jsr getchar ; Read a character from the serial console
+ tsta ; Compare A to 0
+ beq twLoop ; If A == 0, branch to twLoop
+ staa PORTB ; Write A to PORTB
+ jsr putchar ; Write character to serial console
+ bra twLoop ; Branch always to twLoop
+
+**************************************************************************
+* Subroutine Section: address used [ $3100 to $3FFF ] RAM Memory
+*
+
+;*************************************************************************
+; rtiisr subroutine
+;
+; This subroutine will increment the counter, seconds, minutes, & hours counters
+; to track the time. This subroutine will be called ~400 times a second.
+;
+; Input: No input other than the timer to call the isr.
+; Output: The counter, seconds, minutes, & hours buffers will
+; be updated to track the time, the time & prompt will be
+; printed every second.
+; Registers in use: X for adding to the counter, seconds, minutes, & hours buffers.
+; Memory locations in use: Memory Address for serial line, Memory addresses for RTIISR control,
+; Buffer words for counters, seconds, minutes, & hours buffers.
+;
+; Comments: The counter buffer should be compared to 400, but for the simulator,
+; the counter is compared to 200 to better simulate 1 second on my computer.
+;
+
+rtiisr bset CRGFLG,%10000000; Clear RTI Interrupt Flag
+ cli ; Enable interrupts
+ ldx counter ; Load counter into X
+ inx ; Increment counter by 1
+ stx counter ; Save X to counter
+ cpx #200 ; Compare counter to 200, This is about 1 second on my computer
+ bne rtiSkip ; If counter != 200, branch to rtiSkip
+ ldx #0 ; Load 0 into X
+ stx counter ; Save X to counter
+ ldx seconds ; Load the seconds into X
+ inx ; Increment the seconds by 1
+ stx seconds ; Save the new seconds to the location
+ cpx #60 ; Compare X to 60
+ bne rtidone ; If X != 60, exit isr
+ ldx #0 ; Reset the seconds
+ stx seconds ; Save the new seconds to the location
+ ldx minutes ; load the minutes into X
+ inx ; Increment the minutes by 1
+ stx minutes ; Save the updated minutes
+ cpx #60 ; Compare the minutes to 60
+ bne rtidone ; If X != 60, exit isr
+ ldx #0 ; Reset the minutes
+ stx minutes ; Save the updated minutes
+ ldx hours ; Load the hours into X
+ inx ; Increment the hours by 1
+ stx hours ; Save the updated hours
+ cpx #24 ; Compare the hours to 24
+ bne rtidone ; If X != 24, exit the isr
+ ldx #0 ; Reset the hours
+ stx hours ; Save the updated hours
+rtidone jsr PrintTime ; Jump to PrintTime
+rtiSkip RTI ; Return from RTI ISR
+
+;*************************************************************************
+; oc1isr subroutine
+;
+; This subroutine will set a flag after a set number of cycles.
+;
+; Input: interval memory location for the number of cycles between triggers
+; Output: The outputCnt counting the number of triggers, and timeTrigger to
+; signal a timmer trigger.
+; Registers in use: A for setting timeTrigger, D for increasing outputCnt and setting next count.
+; Memory locations in use: Memory Address for oc5 timer, outputCnt, timeTrigger, numPoints, interval
+;
+; Comments: The timer will stop after outputCnt == numPoints
+;
+
+oc1isr ldd interval ; Load the interval for the next clock cycle
+ addd TC1H ; for next interrupt
+ std TC1H ;
+ bset TFLG1,%00100010 ; Clear CH1 interrupt flag
+ ldaa #1 ; Load 1 into A
+ staa timeTrigger ; Signal that timer went off
+ ldd outputCnt ; Load the count of values outputed into D
+ addd #1 ; Increase output count by 1
+ std outputCnt ; Update the count of outputted values
+ cpd numPoints ; Compare D to numPoints
+ blo oc1Done ; If D < numPoints, Done
+ jsr StopTimerCH1 ; Stop Channel 1 Timer
+oc1Done RTI ; Return from interrupt
+
+;*************************************************************************
+; PrintWave subroutine
+;
+; This subroutine will print a one byte decimal value to the serial console.
+; The outputVal will be incremented by increment. It can follow a square wave,
+; a triangle wave, & a sawtooth wave pattern.
+;
+; Input: waveType to denote the patter, increment to increment the outputVal
+; Output: outputVal printed to the serial console
+; Registers in use: A for finding the wave type, B for reading the outputVal,
+; D for math and checking of outputVal
+; Memory locations in use: waveType to set the patter, outputVal for printing
+; the output value
+;
+; Comments: The timer will stop after outputCnt == numPoints
+;
+
+PrintWave
+ pshd ; Save D to the stack
+ pshy ; Save Y to the stack
+ ldaa waveType ; Load the waveType into A
+ cmpa #'T' ; Compare to 'T'
+ lbeq TriangleInc ; If A == 'T', triangle wave increasing
+ cmpa #'t' ; Compare A to 't'
+ lbeq TriangleDec ; If A == 't', triangle wave decreasing
+ cmpa #'Q' ; Compare A to 'Q'
+ lbeq SquareWaveH ; If A == 'Q', square wave high
+ cmpa #'q' ; Compare A to 'q'
+ lbeq SquareWaveL ; If A == 'q', square wave low
+SawToothWav clra ; Clear A
+ ldab outputVal ; Load the output value into B
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintDecimalWord; Print the lower byte of the output value;
+ psha ; Save A to the stack
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Write CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Write LF to serial console
+ pula ; Restore A from the stack
+ addd increment ; Add increment to D
+ cpd #256 ; Compare D to 256
+ lblo DonePrint ; If D < 256, Done
+ clrb ; Reset to Zero
+ lbra DonePrint ; Branch to DonePrint
+SquareWaveH clra ; Clear A
+ ldab #255 ; Load 255 into B
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintDecimalWord; Print the lower byte of the output value;
+ psha ; Save A to the stack
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Write CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Write LF to serial console
+ pula ; Restore A from the stack
+ clra ; Clear A
+ ldab outputVal ; Load the output value into B
+ addd increment ; Add increment to D
+ cpd #256 ; Compare D to 256
+ lblo DonePrint ; If D < 256, done
+ clrb ; Reset B to zero
+ ldaa #'q' ; Load 'q' into A
+ staa waveType ; Update wave type to square wave low
+ bra DonePrint ; Branch to DonePrint
+SquareWaveL clra ; Clear A
+ clrb ; Reset B to zero
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintDecimalWord; Print the lower byte of the output value;
+ psha ; Save A to the stack
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Write CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Write LF to serial console
+ pula ; Restore A from the stack
+ clra ; Clear A
+ ldab outputVal ; Load the output value into B
+ addd increment ; Add increment to D
+ cpd #256 ; Compare D to 256
+ blo DonePrint ; If D < 256, done
+ clrb ; Reset B to zero
+ ldaa #'Q' ; Load 'Q' into A
+ staa waveType ; Update wave type to square wave low
+ bra DonePrint ; Branch to DonePrint
+TriangleInc clra ; Clear A
+ ldab outputVal ; Load the output value into B
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintDecimalWord; Print the lower byte of the output value;
+ psha ; Save A to the stack
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Write CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Write LF to serial console
+ pula ; Restore A from the stack
+ addd increment ; Add increment to D
+ cpd #256 ; Compare D to 256
+ blo DonePrint ; If D < 256, done
+ ldaa #'t' ; Load 't' into A
+ staa waveType ; Update wave type to decreasing triangle
+ subd #1 ; Subtract 1 from D
+ bra DonePrint ; Branch to DonePrint
+TriangleDec clra ; Clear A
+ ldab outputVal ; Load the output value into B
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintDecimalWord; Print the lower byte of the output value;
+ psha ; Save A to the stack
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Write CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Write LF to serial console
+ pula ; Restore A from the stack
+ subd increment ; Subtract increment from D
+ cpd #0 ; Compare D to 0
+ blt DonePrint ; If D < 0, done
+ ldaa #'T' ; Load 'T' into A
+ staa waveType ; Update wave type to increasing triangle
+ clrb ; Clear B
+DonePrint stab outputVal ; Store updated output value
+ puly ; Restore Y from the stack
+ puld ; Restore D from the stack
+ rts ; Return from Caller
+
+;*************************************************************************
+; StartTimer1oc subroutine
+;
+; This subroutine will enable & start the oc1 timer.
+;
+; Input: Interval to set the next clock cycle
+; Output: No output other
+; Registers in use: A used for setting up the oc5 timer, D for setting the next trigger
+; Memory locations in use: All memory locations used for the oc5 timer.
+; interval to set the next cycle.
+;
+; Comments: The timer will be enabled only on channel 1 for output compare.
+;
+
+StartTimer1oc
+ PSHD
+ LDAA #%00000010
+ STAA TIOS ; set CH1 Output Compare
+ STAA TIE ; set CH1 interrupt Enable
+ LDAA #%10000000 ; enable timer, Fast Flag Clear not set
+ STAA TSCR1
+ LDAA #%00000000 ; TOI Off, TCRE Off, TCLK = BCLK/1
+ STAA TSCR2 ; not needed if started from reset
+
+ LDD interval ; 125usec with (24MHz/1 clock)
+ ADDD TCNTH ; for first interrupt
+ STD TC1H ;
+
+ BSET TFLG1,%00000010 ; initial Timer CH5 interrupt flag Clear, not needed if fast clear set
+ LDAA #%00000010
+ STAA TIE ; set CH1 interrupt Enable
+ PULD
+ RTS
+
+;*************************************************************************
+; StopTimerCH1 subroutine
+;
+; This subroutine will stop and disable the timer.
+;
+; Input: No Input
+; Output: No output other
+; Registers in use: A to disable the timer.
+; Memory locations in use: TIE to disable the timer.
+;
+; Comments: The timer will be disabled on all channels.
+;
+
+StopTimerCH1
+ psha ; Save A to the stack
+ clra ; Clear A
+ staa TIE ; Stop Timers
+ pula ; Restore A from the stack
+ rts ; Return
+
+;*************************************************************************
+; GenWave subroutine
+;
+; This subroutine will setup the proper variables to generate a wave and wait
+; for the wave to finish generating.
+;
+; Input: No input but the variables for PrintWave are required.
+; Output: No output except for the output of PrintWave
+; Registers in use: A for reading the timeTrigger variable,
+; D for reading outputCnt.
+; Memory locations in use: outputCnt, outputVal, timeTrigger, numPoints.
+;
+; Comments: This subroutine does not have any direct input or output but calls
+; PrintWave so the inputs for PrintWave should be set and the output
+; of PrintWave should be expected.
+;
+
+GenWave
+ pshd ; Save D to the stack
+ ldd #0 ; Clear D
+ std outputCnt ; Clear outputCnt
+ staa outputVal ; Clear outputVal
+
+ jsr StartTimer1oc ; Start Timer on CH1
+
+genLoop ldaa timeTrigger ; Load timeTrigger into A
+ beq genLoop ; If A == 0, loop
+ clra ; Clear A
+ staa timeTrigger ; Clear timeTrigger
+ jsr PrintWave ; Jump to PrintWave
+ ldd outputCnt ; Load outputCnt into D
+ cpd numPoints ; Compare D to numPoints
+ blo genLoop ; If D < numPoints, Loop
+
+ jsr StopTimerCH1 ; Turn off timer
+ puld ; Restore D from the stack
+ rts ; Return
+
+;*************************************************************************
+; PrintTime subroutine
+;
+; This subroutine will print the time, command prompt, and maybe an error prompt.
+;
+; Input: No input.
+; Output: The time prompt, time, command prompt, the current input,
+; and/or an error on the serial console.
+; Registers in use: A for the characters to print, X for buffer addresses,
+; Y for buffer lengths, D for the seconds/minutes/hours for calling TimeOnPortB
+; Memory locations in use: Memory Address for serial line, Buffer words for counters,
+; seconds, minutes, & hours buffers, and buffer to print time,
+; outputBuf for tracking what to output on PORTB.
+;
+; Comments: This subroutine requires TimeOnPortB subroutine and to be setup. The subroutine
+; will print the current user input if its not finished.
+;
+
+PrintTime
+ pshd ; Save D to the stack
+ ldaa outputBuf ; Load outputBuf into A
+ cmpa #'h' ; Compare A to 'h'
+ bne pTimeIsM ; If A != 'h', branch to pTimeIsM
+ ldd hours ; Load hours into B
+ bra skipRest ; Jump to skipRest
+pTimeIsM cmpa #'m' ; Compare A to 'm'
+ bne pTimeIsS ; If A != 'm', branch to pTimeIsS
+ ldd minutes ; Load Minutes into D
+ bra skipRest ; Jump to skipRest
+pTimeIsS ldd seconds ; Load seconds into D
+skipRest jsr TimeOnPortB ; Call TimeOnPortB to output time
+ puld ; Restore D from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; TimeOnPortB subroutine
+;
+; This subroutine will output the time given on on PORTB for two seven segment displays.
+;
+; Input: Two Digit Decimal number in register D.
+; Output: The given two digit decimal number on PORTB for two 7 segment displays.
+; Registers in use: D for the input, and for math to split the digits, X for math to split digits.
+; Memory locations in use: PORTB memory location.
+;
+; Comments: This subroutine will only work with two digit decimal numbers, and one digit decimal
+; numbers (leading zeros will be added).
+;
+
+TimeOnPortB
+ pshd ; Save D to the stack
+ pshx ; Save X to the stack
+ ldx #10 ; Load 10 into X to get digit
+ idiv ; Divide D by X and save Digit into D
+ pshb ; Save B to the stack (Lower Byte of D)
+ exg x,d ; Swap X and D
+ ldx #10 ; Load 10 into X to get digit
+ lslb ; Shift B left by 1
+ lslb ; Shift B left by 1
+ lslb ; Shift B left by 1
+ lslb ; Shift B left by 1
+ orab 1,sp+ ; Or B with Digit on stack
+ stab PORTB ; Save B to PORTB
+ pulx ; Restore X from the stack
+ puld ; Restore D from the stack
+ rts ; Return from caller
+
+;*************************************************************************
+; ExecuteCommand subroutine
+;
+; This subroutine will parse user input and execute the proper command or error out.
+;
+; Input: An address of a NULL terminated string in X.
+; Output: The output of the proper command or an error message.
+; Registers in use: X for the address of the user input, A for individual characters,
+; D & Y for numbers read from user input.
+; Memory locations in use: Serial console memory locations.
+;
+; Comments: This subroutine will disable interrupts while setting the time and will
+; reenable them after setting the time.
+;
+
+ExecuteCommand
+ pshd ; Save D to the stack
+ pshy ; Save Y to the stack
+ ldaa 1,x+ ; Load the character from X into A
+ lbeq ecDone ; If A == 0, jump to ecDone
+ cmpa #'t' ; Compare A to 't'
+ bne isH ; If A != 't', branch to isH
+skipSpaces ldaa 1,+x ; Load the next character into X
+ cmpa #' ' ; Compare A to ' ' character
+ beq skipSpaces ; If A == ' ', loop to skipSpaces
+ sei ; Disable interrupts
+ ldd hours ; Load hours into D
+ pshd ; Save hours to the stack
+ jsr ReadDecimal ; Read Hour number
+ exg y,d ; Exchange Y and D
+ cpd #24 ; Compare D to 24
+ lbhs badHours ; If D >= 24, badHours
+ cpd #0 ; Compare D to 0
+ lblt badHours ; If D < 0, badHours
+ std hours ; Save D to hours
+ ldaa -1,x ; Load the next character into A
+ cmpa #':' ; Compare A to ':'
+ lbne badHours ; If A != ':', badHours
+ ldd minutes ; Load minutes into D
+ pshd ; Save minutes to the stack
+ jsr ReadDecimal ; Read minute number
+ exg y,d ; Exchange Y and D
+ cpd #60 ; Compare D to 60
+ lbhs badMinutes ; If D >= 60, badMinutes
+ cpd #0 ; Compare D to 0
+ lblt badMinutes ; If D < 0, badMinutes
+ std minutes ; Save D to minutes
+ ldaa -1,x ; Load the next character into A
+ cmpa #':' ; Compare A to ':'
+ lbne badMinutes ; If A != ':', badMinutes
+ ldd seconds ; Load seconds into D
+ pshd ; Save seconds to the stack
+ jsr ReadDecimal ; Read second number
+ exg y,d ; Exchange Y and D
+ cpd #60 ; Compare D to 60
+ lbhs badSeconds ; If D >= 60, badSeconds
+ cpd #0 ; Compare D to 0
+ lblt badSeconds ; If D < 0, badSeconds
+ std seconds ; Save D to seconds
+ ldaa -1,x ; Load the next character into A
+ cmpa #NULL ; Compare A to NULL
+ lbne badSeconds ; If A != ':', badSeconds
+ clra ; Set A to 0
+ staa counter ; Clear Counter
+ cli ; Enable interrupts
+ puld ; Restore D from the stack
+ puld ; Restore D from the stack
+ puld ; Restore D from the stack
+ jsr PrintTime ; Print Time
+ lbra ecDone ; Branch to ecDone
+isH cmpa #'h' ; Compare A to 'h'
+ bne isM ; If A != 'h', branch to isM
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ lbne badCommand ; If B != CR, bad command
+ staa outputBuf ; Store A into outputBuf
+ jsr PrintTime ; Print Time
+ lbra ecDone ; Branch to ecDone
+isM cmpa #'m' ; Compare A to 'm'
+ bne isS ; If A != 'm', branch to isS
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ lbne badCommand ; If B != CR, bad command
+ staa outputBuf ; Store A into outputBuf
+ jsr PrintTime ; Print Time
+ lbra ecDone ; Branch to ecDone
+isS cmpa #'s' ; Compare A to 's'
+ bne isQ ; If A != 's', branch to isQ
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ lbne badCommand ; If B != CR, bad command
+ staa outputBuf ; Store A into outputBuf
+ jsr PrintTime ; Print Time
+ lbra ecDone ; Branch to ecDone
+isQ cmpa #'q' ; Compare A to 'q'
+ bne isGw ; If A != 'q', branch to isGw
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ lbne badCommand ; If B != NULL, branch to ecDone
+ jmp TypeWrite ; Jump to TypeWrite
+isGw cmpa #'g' ; Compare A to 'g'
+ lbne badCommand ; If A != 'g', branch to badCommand
+ ldaa 1,x+ ; Load next character into B
+ cmpa #'w' ; Compare A to 'w'
+ bne isGt ; If A != 'w', branch to isGt
+ ldab 1,x+ ; Load next charater into B
+ cmpb #NULL ; Compare B to NULL
+ bne isGw2 ; If B != NULL, branch to isGw2
+ ldx #swMsg ; Load address of sawtooth message
+ jsr WriteString ; Write string
+ ldaa #'S' ; Load 'S' for sawtooth
+ staa waveType ; Save A to waveType
+ ldd #1 ; Load 1 into D
+ std increment ; Set Increment to 1 -> 31.25Hz
+ jsr GenWave ; Jump to GenWave
+ ldx #doneWave ; Load the address of doneWave
+ jsr WriteString ; Write string
+ lbra ecDone ; Branch always to ecDone
+isGw2 cmpb #'2' ; Compare B to '2'
+ lbne badCommand ; If B != '2', bad
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare to NULL
+ lbne badCommand ; Not NULL? bad
+ ldx #sw2Msg ; Load address of sawtooth 125Hz message
+ jsr WriteString ; Write string
+ ldaa #'S' ; Load 'S' for sawtooth
+ staa waveType ; Save A to waveType
+ ldd #4 ; Load 4 into D
+ std increment ; Set Increment to 4 -> 125Hz
+ jsr GenWave ; Jump to GenWave
+ ldx #doneWave ; Load the address of doneWave
+ jsr WriteString ; Write string
+ lbra ecDone ; Branch always to ecDone
+isGt cmpa #'t' ; Compare A to 't'
+ bne isGq ; If A != 't', branch to isGq
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare to NULL
+ lbne badCommand ; A != NULL? bad
+ ldx #tMsg ; Load address of triangle message
+ jsr WriteString ; Write string
+ ldaa #'T' ; Load 'T' for triangle
+ staa waveType ; Save A to waveType
+ ldd #1 ; Load 1 into D
+ std increment ; Set Increment to 1 -> 31.25Hz
+ jsr GenWave ; Jump to GenWave
+ ldx #doneWave ; Load the address of doneWave
+ jsr WriteString ; Write string
+ lbra ecDone ; Branch always to ecDone
+isGq cmpa #'q' ; Compare A to 'q'
+ lbne badCommand ; A != 'q'? bad
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ bne isGq2 ; B != NULL? isGq2
+ ldx #sqMsg ; Load address of square message
+ jsr WriteString ; Write string
+ ldaa #'q' ; Load 'q' for square
+ staa waveType ; Save A to waveType
+ ldd #1 ; Load 1 into D
+ std increment ; Set Increment to 1 -> 31.25Hz
+ jsr GenWave ; Jump to GenWave
+ ldx #doneWave ; Load the address of doneWave
+ jsr WriteString ; Write string
+ lbra ecDone ; Branch always to ecDone
+isGq2 cmpb #'2' ; Compare B to '2'
+ lbne badCommand ; B != '2'? bad
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ bne badCommand ; B != NULL? bad
+ ldx #sq2Msg ; Load address of square 125Hz message
+ jsr WriteString ; Write string
+ ldaa #'q' ; Load 'q' for square
+ staa waveType ; Save A to waveType
+ ldd #8 ; Load 8 into D
+ std increment ; Set Increment to 4 -> 125Hz
+ jsr GenWave ; Jump to GenWave
+ ldx #doneWave ; Load the address of doneWave
+ jsr WriteString ; Write string
+ lbra ecDone ; Branch always to ecDone
+badSeconds puld ; Restore Seconds from the stack
+ std seconds ; Restore seconds before change
+badMinutes puld ; Restore minutes from the stack
+ std minutes ; Restore minutes before change
+badHours puld ; Restore hours from the stack
+ std hours ; Restore hours before change
+ cli ; Reenable interrupts
+badCommand pshx ; Save X to the stack
+ ldx #badInput ; Load the address of badInput into X
+ jsr WriteString ; Jump to WriteString
+ pulx ; Restore X from the stack
+ecDone puly ; Restore Y from the stack
+ puld ; Restore D from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; ReadDecimal subroutine
+;
+; This subroutine will read an ASCII string of a number in decimal and convert it to
+; its value.
+;
+; Input: A memory address in register X.
+; Output: The value of the number in the Y register, and any errors printed
+; to the serial line. Zero bit is set if error occurs.
+; Registers in use: X for the address of the contents and for a buffer while printing,
+; D for multiplication, B for the character, Y for output value.
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine will return the value in the Y register, and if an error occurs,
+; the Zero bit in the CCR will be set.
+;
+
+ReadDecimal
+ pshd ; Save D to the stack
+ ldy #0 ; Clear Y register
+dHLoop ldab 1,x+ ; Read Next character from X
+ beq dHDone ; If B == 0, exit loop
+ cmpb #'+' ; Compare B to '+'
+ beq dHDone ; If B == '+', end of number
+ cmpb #'-' ; Compare B to '-'
+ beq dHDone ; If B == '-', end of number
+ cmpb #'*' ; Compare B to '*'
+ beq dHDone ; If B == '+', end of number
+ cmpb #'/' ; Compare B to '/'
+ beq dHDone ; If B == '-', end of number
+ cmpb #':' ; Compare B to ':'
+ beq dHDone ; If B == '-', end of number
+ cmpb #' ' ; Compare B to space character
+ beq dHDone ; If B == ' ', exit loop
+ cmpb #'0' ; Compare B to '0' character
+ blt dHError ; If B < '0', bad address, exit loop
+ cmpb #'9' ; Compare B to '9' character
+ bhi dHError ; If B > '9', check if 'A'-'F' characters
+ subb #'0' ; Subtract '0' from B to get true value
+ pshb ; Save B to the stack
+ ldd #10 ; load 10 into D
+ emul ; Multiply Y and D
+ exg d,y ; Transfer data from D to Y
+ pulb ; Restore b from the stack
+ aby ; Add B to Y
+ bra dHLoop ; Branch always to rHLoop
+dHDone clra ; clear A accumulator
+ tap ; Transfer A into CCR to clear zero bit
+ puld ; Restore D from the stack
+ rts ; Return to caller
+dHError ldaa #4 ; Load 4 into A to set zero bit in CCR
+ tap ; Transfer A into CCR to set zero bit and warn error
+ puld ; Restore D from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; strrev subroutine
+;
+; This subroutine will reverse a string from one buffer into another.
+;
+; Input: Address of null terminated string in X, address of a large enough
+; buffer in Y.
+; Output: The string in X reversed in Y.
+; Registers in use: X for the address of the string, Y for the address of the buffer,
+; A to read characters from the string.
+; Memory locations in use: Memory Address for serial line, address of the string & buffer
+;
+; Comments: This subroutine will not check that the output buffer is large enough, that
+; is the job of the caller.
+;
+
+strrev
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ psha ; Save A to the stack
+revLoop ldaa 1,y- ; Load Character from Y into A, decrement Y
+ beq revDone ; If Character is 0, exit loop
+ staa 1,x+ ; Save character in address in X, increment X
+ bra revLoop ; Loop back always
+ clra ; Set A to Zero
+revDone staa 1,x+ ; Copy Null terminator into new string
+ pula ; Restore A from the stack
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; PrintDecimalWord subroutine
+;
+; This subroutine will print a given word of data to the serial in binary.
+;
+; Input: 1 word of data in register D, Buffer Address in Y
+; Output: Decimal representation of the data on the serial console
+; Registers in use: Y for the address of the buffer, X to count the number of bits
+; written and for division, D for the input, A for characters.
+; Memory locations in use: Memory addresses for serial, and operator to hold sign
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintDecimalWord
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ pshd ; Save D (A:B) to the stack
+ cpd #0 ; Compare D to zero
+ beq dIsZero ; Branch to hIsZero
+ blt dIsNegative ; If D < 0, Jump to dIsNegative
+dAfterNeg psha ; Save A to the stack
+ pshy ; Save Y to the stack
+ pshx ; Save x to the stack
+ ldaa #'0' ; Load the '0' character into A
+ ldx #buffer2 ; Load the address of buffer2 into X
+ ldy #5 ; Load 5 into Y
+ jsr memset ; Write '0' to the first 5 bytes in buffer2
+ pulx ; Restore X from the stack
+ puly ; Restore Y from the stack
+ clra ; Set A to zero
+ staa 0,y ; Load Zero into Y for Null Terminator
+ pula ; Restore A from the stack
+dPrintLoop ldx #10 ; Load 10 in X for division
+ idiv ; Divide D / 10 to get Hex Digit
+ cpx #0 ; Compare X to 0
+ beq dCheck ; If X == 0, branch to check D is zero
+dDNotZero addb #'0' ; Add '0' to B to get ASCII Character
+ stab 1,+y ; Save character from B to Y
+ exg X,D ; Swap values in X and D
+ bra dPrintLoop ; Loop to hPrintLoop
+dCheck cpd #0 ; Compare D to 0
+ bne dDNotZero ; If D != 0, branch back to hDNotZero
+dPrintDone ldaa operator ; Load operator into A to see if negative
+ cmpa #'-' ; Compare A to '-'
+ bne dNotNeg ; If A != '-', jump to dNotNeg
+ staa 1,+y ; Save '-' into buffer
+dNotNeg ldx #buffer2 ; Load the address of buffer2 in X
+ jsr strrev ; Reverse string in Y in buffer in X
+ jsr WriteString ; Jump to write string to write the number
+ ldy lenBuf2 ; Load the length of buffer2 into Y
+ ldx #buffer2 ; Load the address of buffer2 into X
+ jsr Zeros ; Fill buffer2 with zeros
+ puld ; Restore D (A:B) from the stack
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+dIsZero ldaa #'0' ; Load '0' character into A
+ jsr putchar ; Print character to the screen
+ puld ; Restore D (A:B) from the stack
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+dIsNegative psha ; Save A to the stack
+ ldaa #'-' ; Load '-' into A
+ staa operator ; Save '-' to operator buffer
+ pula ; Restore A from the stack
+ nega ; Two's complement of A
+ suba #1 ; Subtract 1 from A
+ negb ; Two'complement of B
+ subb #1 ; Subtract 1 from B
+ addd #1 ; Add 1 to D
+ bra dAfterNeg ; Jump back to dAfterNeg
+
+;*************************************************************************
+; Zeros subroutine
+;
+; This subroutine will write zeros to every byte in a given array.
+;
+; Input: Address of an array in X and its length in Y
+; Output: Zeros in every byte of an array.
+; Registers in use: X for the address of the array, Y for the length, and A for 0
+; Memory locations in use: Memory Address of the array
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+Zeros
+ psha ; Save A to the Stack
+ clra ; Clear A
+zerosLoop staa 1,x+ ; Load A into byte at X
+ dbne y,zerosLoop ; Decrement Y and loop if Y != 0
+ pula ; Restore A from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; memset subroutine
+;
+; This subroutine will write a given byte to every byte in a given array.
+;
+; Input: Address of an array in X and its length in Y, the byte in A
+; Output: The given byte in every byte of an array.
+; Registers in use: X for the address of the array, Y for the length, and A for the given byte
+; Memory locations in use: Memory Address of the array
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+memset
+ staa 1,x+ ; Load A into byte at X
+ dbne y,memset ; Decrement Y and loop if Y != 0
+ rts ; Return to caller
+
+;*************************************************************************
+; WriteString subroutine
+;
+; This subroutine will write a given null terminated string to the serial.
+;
+; Input: Address of null terminated string in X
+; Output: Null terminated string written to serial
+; Registers in use: X for the address of the string and A for the current byte
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+WriteString
+ psha ; Save A to the stack
+writeLoop ldaa 1,x+ ; Load the byte at addr in X, then add 1
+ beq doneWrite ; if A == 0, branch to doneWrite
+ jsr putchar ; Jump to putchar to write byte to serial
+ bra writeLoop ; branch always to writeLoop
+doneWrite pula ; restore A from the stack
+ rts ; return to caller
+
+;*************************************************************************
+; ReadString subroutine
+;
+; This subroutine will read a string from the serial line to a given address.
+;
+; Input: Address of an array in X
+; Output: Null terminated string in the given array
+; Registers in use: X for the address of the string Y for the length of the string,
+; and A for the current byte
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine requires serial to be setup and getchar subroutine.
+;
+
+ReadString
+ psha ; Save accumulator A to the stack
+ pshy ; Save Y to the stack
+ pshx ; Save X to the stack
+readLoop jsr getchar ; Jump to putchar to write byte to serial
+ beq readLoop ; While A == 0, loop
+ cmpa #CR ; If A == CR, exit loop
+ beq doneRead ; Branch to doneRead if A == CR
+ staa 1,x+ ; Save the byte to the addr in X, then add 1
+ jsr putchar ; Write Character back to the terminal
+ dey ; Decrement Y by 1
+ beq doneRead ; If Y == 0, no more room, stop reading
+ bra readLoop ; branch always to readLoop
+doneRead ldaa #CR ; Load CR into A
+ jsr putchar ; Print to serial
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Print to serial
+ pulx ; Restore X from the stack
+ pulY ; Restore Y from the stack
+ pula ; restore A from the stack
+ rts ; return to caller
+
+;*************************************************************************
+; putchar subroutine
+;
+; This subroutine writes a single byte to a serial line
+;
+; Input: A single ASCII byte in accumulator A
+; Output: Sends one character to SCI port
+; Registers in use: Accumulator A with input byte
+; Memory locations in use: SCISR1 and SCIDRL status and data registers
+;
+
+putchar brclr SCISR1,#%10000000,putchar ; wait for transmit buffer empty
+ staa SCIDRL ; send a character
+ rts ; Return to caller
+
+;*************************************************************************
+; putchar subroutine
+;
+; This subroutine reads one byte from the SCI port
+;
+; Input: One byte from the SCI port
+; Output: One byte in accumulator A
+; Registers in use: Accumulator A for output byte
+; Memory locations in use: SCISR1 and SCIDRL status and data registers
+;
+
+getchar brclr SCISR1,#%00100000,getchar7 ; If no input on SCI port, return 0
+ ldaa SCIDRL ; Read one byte from SCI port into A
+ rts ; Return to caller
+getchar7 clra ; Set A to 0
+ rts ; Return to caller
+
+*
+**************************************************************************
+* Data Section 2: address used [ $3100 to $3FFF ] RAM Memory
+*
+
+badInput dc.b 'Invalid Input',CR,LF,NULL ; Invalid Input Prompt
+
+; twMsg: welcome message for typewrite
+twMsg dc.b 'Wave Generator and Clock stopped and Typewrite program started.',CR,LF
+ dc.b 'You may type below.',CR,LF,NULL
+
+; Messages for different waveforms
+swMsg dc.b 'sawtooth wave generation...',CR,LF,NULL
+sw2Msg dc.b 'sawtooth wave 125Hz generation...',CR,LF,NULL
+tMsg dc.b 'triangle wave generation...',CR,LF,NULL
+sqMsg dc.b 'square wave generation...',CR,LF,NULL
+sq2Msg dc.b 'square wave 125Hz generation...',CR,LF,NULL
+
+doneWave dc.b 'Done generating wave.',CR,LF,NULL
+
+; msg: this is the main option menu string
+msg dc.b 'Commands:',CR,LF
+ dc.b 'gw: generate sawtooth wave, printing 0 through 255, repeated for total 2048 points',CR,LF
+ dc.b 'gw2: generate sawtooth wave of 125Hz, wave repeated for total 2048 points',CR,LF
+ dc.b 'gt: generate triangle wave, printing 0 through 255, then 255 down to 0, repeated for total 2048 points',CR,LF
+ dc.b 'gq: generate square wave, printing 0 for 255 times, then print 255 for 255 times, then repeated for total 2048 points',CR,LF
+ dc.b 'gq2: generate square wave of 125Hz, wave repeated for total 2048 points',CR,LF
+ dc.b 't: Set the time in format HH:MM:SS',CR,LF
+ dc.b 'h: Display the hours on the 7 segment displays',CR,LF
+ dc.b 'm: Display the minutes on the 7 segment displays',CR,LF
+ dc.b 's: Display the seconds on the 7 segment displays',CR,LF
+ dc.b 'q: Stop the clock and enter typewriter',CR,LF,NULL
+
+ end ; last line of the file
diff --git a/cmpen472hw11_McDonnell/bin/Project.abs b/cmpen472hw11_McDonnell/bin/Project.abs
new file mode 100644
index 0000000..d156a94
--- /dev/null
+++ b/cmpen472hw11_McDonnell/bin/Project.abs
Binary files differ
diff --git a/cmpen472hw11_McDonnell/bin/Project.abs.phy b/cmpen472hw11_McDonnell/bin/Project.abs.phy
new file mode 100644
index 0000000..1545e61
--- /dev/null
+++ b/cmpen472hw11_McDonnell/bin/Project.abs.phy
@@ -0,0 +1,4 @@
+S0590000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731315F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162731D
+S2060FFFEC31B21C
+S2060FFFF0316169
+S9030000FC
diff --git a/cmpen472hw11_McDonnell/bin/Project.abs.s19 b/cmpen472hw11_McDonnell/bin/Project.abs.s19
new file mode 100644
index 0000000..086e6c4
--- /dev/null
+++ b/cmpen472hw11_McDonnell/bin/Project.abs.s19
@@ -0,0 +1,79 @@
+S0590000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731315F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162731D
+S123300000000000000000000000000000000000000010000000000000000000000000009C
+S123302000000000001000000000000000000000000000000000000000000000000000007C
+S1123040000010730000000BB8080000000153DB
+S1233100CF310086F15A03860C5ACBCC00015CC8CE37371635DA4C3B194C38804C378086A1
+S1233120FF5A0310EF863E16360A862016360ACE3030FD30411635E6CE303016333BCE309D
+S123314030FD30411635CB20DC14104D3880CE362A1635DA1636119727FA5A0116360A2059
+S1233160F34C378010EFFE302C087E302C8E00C8263FCE00007E302CFE302A087E302A8EF1
+S1233180003C262ACE00007E302AFE3028087E30288E003C2618CE00007E3028FE302608BD
+S12331A07E30268E00182606CE00007E30261633050BFC3047D3525C524C4E2286017A3037
+S12331C04BFC3045C300017C3045BC304925031632D90B3B35B6304E81541827008A8174BA
+S12331E0182700AC81511827002B81711827005087F63044CD300016355C36860D16360A6F
+S1233200860A16360A32F3304C8C0100182500A4C71820009F87C6FFCD300016355C36866B
+S12332200D16360A860A16360A3287F63044F3304C8C01001825007CC786717A304E20741F
+S123324087C7CD300016355C36860D16360A860A16360A3287F63044F3304C8C01002554DB
+S1233260C786517A304E204C87F63044CD300016355C36860D16360A860A16360A32F33059
+S12332804C8C0100252E86747A304E830001202487F63044CD300016355C36860D16360A90
+S12332A0860A16360A32B3304C8C00002D0686547A304EC77B3044313A3D3B86025A405A1D
+S12332C04C86805A4686005A4DFC3047D3445C524C4E0286025A4C3A3D36875A4C323D3B45
+S12332E0CC00007C30457A30441632BAB6304B27FB877A304B1631D3FC3045BC304925EC7D
+S12333001632D93A3D3BB6304381682605FC3026200C816D2605FC30282003FC302A1633EC
+S1233320233A3D3B34CE000A181037B7D4CE000A58585858EAB05B01303A3D3B35A630188B
+S12333402701C38174267EA620812027FA1410FC30263B163509B7E48C0018182401998CB7
+S12333600000182D01927C3026A61F813A18260187FC30283B163509B7E48C003C182401D6
+S1233380738C0000182D016C7C3028A61F813A18260161FC302A3B163509B7E48C003C1824
+S12333A024014D8C0000182D01467C302AA61F81001826013B877A302C10EF3A3A3A163396
+S12333C0051820014181682612E630C1001826012D7A30431633051820012B816D2612E65B
+S12333E030C100182601177A30431633051820011581732612E630C100182601017A3043C9
+S1233400163305182000FF8171260BE630C100182600EB0631498167182600E2A6308177AA
+S12334202650E630C100261ECE36811635DA86537A304ECC00017C304C1632DFCE371F1656
+S123344035DA182000C0C132182600B2E630C100182600AACE369F1635DA86537A304ECC5A
+S123346000047C304C1632DFCE371F1635DA1820009481742626E630C10018260080CE3636
+S1233480C31635DA86547A304ECC00017C304C1632DFCE371F1635DA1820006A8171182667
+S12334A0005CE630C100261ECE36E11635DA86717A304ECC00017C304C1632DFCE371F1672
+S12334C035DA18200040C13218260032E630C100262CCE36FD1635DA86717A304ECC0008EC
+S12334E07C304C1632DFCE371F1635DA182000163A7C302A3A7C30283A7C302610EF34CEE7
+S1233500361A1635DA30313A3D3BCD0000E630272EC12B272AC12D2726C12A2722C12F2724
+S12335201EC13A271AC1202716C1302D17C1392213C03037CC000A13B7C63319ED20CE8770
+S1233540B7023A3D8604B7023A3D343536A67F27056A3020F8876A303231303D34353B8CBA
+S12335600000274C2D533635348630CE3013CD00051635D43031876A4032CE000A18108EAB
+S123358000002708CB306B60B7D420EE8C000026F3B6302F812D26026A60CE301316354A99
+S12335A01635DAFD3024CE30131635CB3A31303D863016360A3A31303D36862D7A302F32BA
+S12335C040800150C001C30001209B36876A300436FB323D6A300436FB3D36A63027051641
+S12335E0360A20F7323D36353416361127FB810D270A6A3016360A03270220ED860D16361C
+S12336000A860A16360A3031323D4FCC80FC5ACF3D4FCC200396CF3D873D496E76616C69E2
+S12336206420496E7075740D0A00576176652047656E657261746F7220616E6420436C6FF0
+S1233640636B2073746F7070656420616E64205479706577726974652070726F6772616D21
+S123366020737461727465642E0D0A596F75206D617920747970652062656C6F772E0D0AE6
+S123368000736177746F6F746820776176652067656E65726174696F6E2E2E2E0D0A00737A
+S12336A06177746F6F7468207761766520313235487A2067656E65726174696F6E2E2E2EDD
+S12336C00D0A00747269616E676C6520776176652067656E65726174696F6E2E2E2E0D0AB9
+S12336E00073717561726520776176652067656E65726174696F6E2E2E2E0D0A007371751C
+S1233700617265207761766520313235487A2067656E65726174696F6E2E2E2E0D0A0044EF
+S12337206F6E652067656E65726174696E6720776176652E0D0A00436F6D6D616E64733A7B
+S12337400D0A67773A2067656E657261746520736177746F6F746820776176652C20707231
+S1233760696E74696E672030207468726F756768203235352C207265706561746564206673
+S12337806F7220746F74616C203230343820706F696E74730D0A6777323A2067656E6572C3
+S12337A061746520736177746F6F74682077617665206F6620313235487A2C2077617665F1
+S12337C020726570656174656420666F7220746F74616C203230343820706F696E74730D18
+S12337E00A67743A2067656E657261746520747269616E676C6520776176652C207072695B
+S12338006E74696E672030207468726F756768203235352C207468656E2032353520646FAD
+S1233820776E20746F20302C20726570656174656420666F7220746F74616C20323034381D
+S123384020706F696E74730D0A67713A2067656E65726174652073717561726520776176F4
+S1233860652C207072696E74696E67203020666F72203235352074696D65732C20746865E6
+S12338806E207072696E742032353520666F72203235352074696D65732C207468656E202D
+S12338A0726570656174656420666F7220746F74616C203230343820706F696E74730D0A4D
+S12338C06771323A2067656E6572617465207371756172652077617665206F662031323504
+S12338E0487A2C207761766520726570656174656420666F7220746F74616C203230343800
+S123390020706F696E74730D0A743A20536574207468652074696D6520696E20666F726DDA
+S123392061742048483A4D4D3A53530D0A683A20446973706C61792074686520686F75725C
+S123394073206F6E207468652037207365676D656E7420646973706C6179730D0A6D3A20C1
+S1233960446973706C617920746865206D696E75746573206F6E20746865203720736567D3
+S12339806D656E7420646973706C6179730D0A733A20446973706C617920746865207365D3
+S12339A0636F6E6473206F6E207468652037207365676D656E7420646973706C6179730D8E
+S12339C00A713A2053746F702074686520636C6F636B20616E6420656E74657220747970CD
+S10D39E0657772697465720D0A00C0
+S105FFEC31B22C
+S105FFF0316179
+S9030000FC
diff --git a/cmpen472hw11_McDonnell/bin/main.dbg b/cmpen472hw11_McDonnell/bin/main.dbg
new file mode 100644
index 0000000..479f8e9
--- /dev/null
+++ b/cmpen472hw11_McDonnell/bin/main.dbg
@@ -0,0 +1,1072 @@
+**************************************************************************
+*
+* Title: Signal Generator
+*
+* Objective: CMPEN 472 Homework 11
+*
+* Revision: V1.0
+*
+* Date: Apr. 11, 2025
+*
+* Programmer: Jacob McDonnell
+*
+* Company: The Pennsylvania State University
+* Department of Computer Science and Engineering
+*
+* Algorithm: Simple Serial I/O, Real Time Interrupts for Time Tracking, and
+* output compare timer for generating functions.
+*
+* Register Use: A & B to current byte, etc,
+* X & Y holds address of strings and length of string,
+* D to hold data for printing, reading, and updating time.
+*
+* Memory Use: RAM Locations from $3000 for data,
+* RAM Locations from $3100 for program
+*
+* Input: Serial Port for User Input
+*
+* Output: Serial Port for String Output
+*
+* Observation: The HC12 will output the time and a command prompt every second.
+* The user can input commands and the program will output a response
+* based on the input.
+*
+* Note: ON CSM-12C128 board,
+*
+* Comments: This program is developed and simulated using CodeWarrior
+* development software and targeted for Axion
+* Manufacturing's CSM-12C128 board running at 24MHz.
+*
+**************************************************************************
+* Parameter Declearation Section
+*
+* Export Symbols
+ xdef pgstart ; export 'pgstart' symbol
+ absentry pgstart ; for assembly entry point
+
+* Symbols and Macros
+PORTA equ $0000 ; i/o port A addresses
+DDRA equ $0002 ; data direction register for PORTA
+PORTB equ $0001 ; i/o port B addresses
+DDRB equ $0003 ; data direction register for PORTB
+
+SCIBDH equ $00C8 ; Serial port (SCI) Baud Register H
+SCIBDL equ $00C9 ; Serial port (SCI) Baud Register L
+SCICR2 equ $00CB ; Serial port (SCI) Control Register 2
+SCISR1 equ $00CC ; Serial port (SCI) Status Register 1
+SCIDRL equ $00CF ; Serial port (SCI) Data Register
+
+CRGFLG EQU $0037 ; Clock and Reset Generator Flags
+CRGINT EQU $0038 ; Clock and Reset Generator Interrupts
+RTICTL EQU $003B ; Real Time Interrupt Control
+
+TIOS EQU $0040 ; Timer Input Capture (IC) or Output Compare (OC) select
+TIE EQU $004C ; Timer interrupt enable register
+TCNTH EQU $0044 ; Timer free runing main counter
+TSCR1 EQU $0046 ; Timer system control 1
+TSCR2 EQU $004D ; Timer system control 2
+TFLG1 EQU $004E ; Timer interrupt flag 1
+TC1H EQU $0052 ; Timer channel 1 register
+
+CR equ $0d ; carriage return, ASCII 'Return' key
+LF equ $0a ; line feed, ASCII 'next line' character
+NULL equ $00 ; NULL Terminator character
+
+**************************************************************************
+* Data Section: address used [ $3000 to $30FF ] RAM Memory
+*
+ org $3000 ; Reserved RAM memory starting address
+ ; for Data for CMPEN 472 class
+buffer ds.b $0010 ; Array of 16 bytes to read a string
+ dc.b NULL ; NULL terminated
+lenBuf dc.w $0010 ; Length of buffer array
+
+buffer2 ds.b $0010 ; Array of 16 bytes for reading and reversal
+ dc.b NULL ; NULL terminated
+lenBuf2 dc.w $0010 ; length of buffer2
+
+hours dc.w $0000 ; Buffer to hold the hours of the time
+
+minutes dc.w $0000 ; Buffer to hold the minutes of the time
+
+seconds dc.w $0000 ; Buffer to hold the seconds of the time
+
+counter dc.w $0000 ; Counter for RTI ISR for 1 second
+
+numBuf dc.b $0000 ; Used by ReadDecimal for reading numbers
+
+operator dc.b $0000 ; Used by ReadDecimal for reading numbers
+
+inputBuffer ds.b $0010 ; Input Buffer Length
+ dc.b NULL
+
+lenInput dc.w $0010 ; Length of the Input Buffer
+
+outputBuf dc.b 's' ; Used to control what to output on 7 segment display
+
+outputVal dc.b $00 ; Used to track the output value of the wave
+
+outputCnt dc.w $0000 ; Used to track how many values have been outputted
+
+interval dc.w 3000 ; Used to set the timer module based on clock cycles
+
+numPoints dc.w 2048 ; Max Number of points for waves
+
+timeTrigger dc.b $00 ; Tracks when timer is triggered
+
+increment dc.w 1 ; Used for increment 31.25Hz -> 1
+ ; 125Hz -> 4
+
+waveType dc.b 'S' ; Used to track wave type 'T' for increasing triangle,
+ ; 't' for decreasing triangle,
+ ; 'Q' for square high
+ ; 'q' for square low
+ ; 'S' for sawtooth
+
+*
+* There is a section Data Section at the end of the file
+**************************************************************************
+* RTI Vector Section: address used [ $FFF0 to $FFF1 ] RAM Memory
+*
+ org $FFF0 ; Memory location for RTI interrupt vector section for simulator
+ dc.w rtiisr ; Real Time Interrupt vector
+*
+**************************************************************************
+* Timer Interrupt Vector Section: address used [ $FFEC to $FFED ] RAM Memory
+*
+ org $FFEC ; Timer channel 1 interrupt vector setup, on simulator
+ dc.w oc1isr
+*
+**************************************************************************
+* Program Section: address used [ $3100 to $3FFF ] RAM Memory
+*
+ org $3100 ; Program start address, in RAM
+pgstart lds #$3100 ; initialize the stack pointer
+
+ ldaa #%11110001 ; LED 1,2,3,4 at PORTB bit 4,5,6,7
+ staa DDRB ; set PORTB bit 4,5,6,7 as output
+
+ ldaa #$0C ; Enable SCI port Tx and Rx units
+ staa SCICR2 ; disable SCI interrupts
+
+ ldd #$0001 ; Set SCI Baud Register = $0001 => 1.5M baud at 24MHz (for simulation)
+ std SCIBDH ; SCI port baud rate change
+
+ ldx #msg ; Load the address of the welcome message into X
+ jsr WriteString ; Write the string to the serial console
+
+ bset RTICTL,%00011001; set RTI: dev=10*(2**10)=2.555msec for C128 board
+ ; 4MHz quartz oscillator clock
+ bset CRGINT,%10000000; enable RTI interrupt
+ bset CRGFLG,%10000000; clear RTI IF (Interrupt Flag)
+
+ ldaa #$FF ; Two 7 segment displays on PORTB
+ staa DDRB ; Set all of PORTB as output
+
+ cli ; Enable interrupts
+mainLoop
+ ldaa #'>' ; Load '>' character
+ jsr putchar ; Print to serial console
+ ldaa #' ' ; Load ' ' character
+ jsr putchar ; Print to serial console
+ ldx #inputBuffer ; Load the address of inputBuffer into X
+ ldy lenInput ; Load the length of inputBuffer into Y
+ jsr ReadString ; Jump to ReadString to read input
+
+ ldx #inputBuffer ; Load the address of inputBuffer into X
+ jsr ExecuteCommand ; Jump to ExecuteCommand
+
+ ldx #inputBuffer ; Load the address of inputBuffer into X
+ ldy lenInput ; Load the length of inputBuffer into Y
+ jsr Zeros ; Zero out input buffer
+
+ bra mainLoop ; Loop back to mainLoop always
+
+TypeWrite
+ sei ; Disable Interrupts
+ bclr CRGINT,%10000000; Disable RTI interrupt
+ ldx #twMsg ; Load the address of twMsg into X
+ jsr WriteString ; Write the string to the serial console
+twLoop jsr getchar ; Read a character from the serial console
+ tsta ; Compare A to 0
+ beq twLoop ; If A == 0, branch to twLoop
+ staa PORTB ; Write A to PORTB
+ jsr putchar ; Write character to serial console
+ bra twLoop ; Branch always to twLoop
+
+**************************************************************************
+* Subroutine Section: address used [ $3100 to $3FFF ] RAM Memory
+*
+
+;*************************************************************************
+; rtiisr subroutine
+;
+; This subroutine will increment the counter, seconds, minutes, & hours counters
+; to track the time. This subroutine will be called ~400 times a second.
+;
+; Input: No input other than the timer to call the isr.
+; Output: The counter, seconds, minutes, & hours buffers will
+; be updated to track the time, the time & prompt will be
+; printed every second.
+; Registers in use: X for adding to the counter, seconds, minutes, & hours buffers.
+; Memory locations in use: Memory Address for serial line, Memory addresses for RTIISR control,
+; Buffer words for counters, seconds, minutes, & hours buffers.
+;
+; Comments: The counter buffer should be compared to 400, but for the simulator,
+; the counter is compared to 200 to better simulate 1 second on my computer.
+;
+
+rtiisr bset CRGFLG,%10000000; Clear RTI Interrupt Flag
+ cli ; Enable interrupts
+ ldx counter ; Load counter into X
+ inx ; Increment counter by 1
+ stx counter ; Save X to counter
+ cpx #200 ; Compare counter to 200, This is about 1 second on my computer
+ bne rtiSkip ; If counter != 200, branch to rtiSkip
+ ldx #0 ; Load 0 into X
+ stx counter ; Save X to counter
+ ldx seconds ; Load the seconds into X
+ inx ; Increment the seconds by 1
+ stx seconds ; Save the new seconds to the location
+ cpx #60 ; Compare X to 60
+ bne rtidone ; If X != 60, exit isr
+ ldx #0 ; Reset the seconds
+ stx seconds ; Save the new seconds to the location
+ ldx minutes ; load the minutes into X
+ inx ; Increment the minutes by 1
+ stx minutes ; Save the updated minutes
+ cpx #60 ; Compare the minutes to 60
+ bne rtidone ; If X != 60, exit isr
+ ldx #0 ; Reset the minutes
+ stx minutes ; Save the updated minutes
+ ldx hours ; Load the hours into X
+ inx ; Increment the hours by 1
+ stx hours ; Save the updated hours
+ cpx #24 ; Compare the hours to 24
+ bne rtidone ; If X != 24, exit the isr
+ ldx #0 ; Reset the hours
+ stx hours ; Save the updated hours
+rtidone jsr PrintTime ; Jump to PrintTime
+rtiSkip RTI ; Return from RTI ISR
+
+;*************************************************************************
+; oc1isr subroutine
+;
+; This subroutine will set a flag after a set number of cycles.
+;
+; Input: interval memory location for the number of cycles between triggers
+; Output: The outputCnt counting the number of triggers, and timeTrigger to
+; signal a timmer trigger.
+; Registers in use: A for setting timeTrigger, D for increasing outputCnt and setting next count.
+; Memory locations in use: Memory Address for oc5 timer, outputCnt, timeTrigger, numPoints, interval
+;
+; Comments: The timer will stop after outputCnt == numPoints
+;
+
+oc1isr ldd interval ; Load the interval for the next clock cycle
+ addd TC1H ; for next interrupt
+ std TC1H ;
+ bset TFLG1,%00100010 ; Clear CH1 interrupt flag
+ ldaa #1 ; Load 1 into A
+ staa timeTrigger ; Signal that timer went off
+ ldd outputCnt ; Load the count of values outputed into D
+ addd #1 ; Increase output count by 1
+ std outputCnt ; Update the count of outputted values
+ cpd numPoints ; Compare D to numPoints
+ blo oc1Done ; If D < numPoints, Done
+ jsr StopTimerCH1 ; Stop Channel 1 Timer
+oc1Done RTI ; Return from interrupt
+
+;*************************************************************************
+; PrintWave subroutine
+;
+; This subroutine will print a one byte decimal value to the serial console.
+; The outputVal will be incremented by increment. It can follow a square wave,
+; a triangle wave, & a sawtooth wave pattern.
+;
+; Input: waveType to denote the patter, increment to increment the outputVal
+; Output: outputVal printed to the serial console
+; Registers in use: A for finding the wave type, B for reading the outputVal,
+; D for math and checking of outputVal
+; Memory locations in use: waveType to set the patter, outputVal for printing
+; the output value
+;
+; Comments: The timer will stop after outputCnt == numPoints
+;
+
+PrintWave
+ pshd ; Save D to the stack
+ pshy ; Save Y to the stack
+ ldaa waveType ; Load the waveType into A
+ cmpa #'T' ; Compare to 'T'
+ lbeq TriangleInc ; If A == 'T', triangle wave increasing
+ cmpa #'t' ; Compare A to 't'
+ lbeq TriangleDec ; If A == 't', triangle wave decreasing
+ cmpa #'Q' ; Compare A to 'Q'
+ lbeq SquareWaveH ; If A == 'Q', square wave high
+ cmpa #'q' ; Compare A to 'q'
+ lbeq SquareWaveL ; If A == 'q', square wave low
+SawToothWav clra ; Clear A
+ ldab outputVal ; Load the output value into B
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintDecimalWord; Print the lower byte of the output value;
+ psha ; Save A to the stack
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Write CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Write LF to serial console
+ pula ; Restore A from the stack
+ addd increment ; Add increment to D
+ cpd #256 ; Compare D to 256
+ lblo DonePrint ; If D < 256, Done
+ clrb ; Reset to Zero
+ lbra DonePrint ; Branch to DonePrint
+SquareWaveH clra ; Clear A
+ ldab #255 ; Load 255 into B
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintDecimalWord; Print the lower byte of the output value;
+ psha ; Save A to the stack
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Write CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Write LF to serial console
+ pula ; Restore A from the stack
+ clra ; Clear A
+ ldab outputVal ; Load the output value into B
+ addd increment ; Add increment to D
+ cpd #256 ; Compare D to 256
+ lblo DonePrint ; If D < 256, done
+ clrb ; Reset B to zero
+ ldaa #'q' ; Load 'q' into A
+ staa waveType ; Update wave type to square wave low
+ bra DonePrint ; Branch to DonePrint
+SquareWaveL clra ; Clear A
+ clrb ; Reset B to zero
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintDecimalWord; Print the lower byte of the output value;
+ psha ; Save A to the stack
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Write CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Write LF to serial console
+ pula ; Restore A from the stack
+ clra ; Clear A
+ ldab outputVal ; Load the output value into B
+ addd increment ; Add increment to D
+ cpd #256 ; Compare D to 256
+ blo DonePrint ; If D < 256, done
+ clrb ; Reset B to zero
+ ldaa #'Q' ; Load 'Q' into A
+ staa waveType ; Update wave type to square wave low
+ bra DonePrint ; Branch to DonePrint
+TriangleInc clra ; Clear A
+ ldab outputVal ; Load the output value into B
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintDecimalWord; Print the lower byte of the output value;
+ psha ; Save A to the stack
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Write CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Write LF to serial console
+ pula ; Restore A from the stack
+ addd increment ; Add increment to D
+ cpd #256 ; Compare D to 256
+ blo DonePrint ; If D < 256, done
+ ldaa #'t' ; Load 't' into A
+ staa waveType ; Update wave type to decreasing triangle
+ subd #1 ; Subtract 1 from D
+ bra DonePrint ; Branch to DonePrint
+TriangleDec clra ; Clear A
+ ldab outputVal ; Load the output value into B
+ ldy #buffer ; Load the address of buffer into Y
+ jsr PrintDecimalWord; Print the lower byte of the output value;
+ psha ; Save A to the stack
+ ldaa #CR ; Load CR into A
+ jsr putchar ; Write CR to serial console
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Write LF to serial console
+ pula ; Restore A from the stack
+ subd increment ; Subtract increment from D
+ cpd #0 ; Compare D to 0
+ blt DonePrint ; If D < 0, done
+ ldaa #'T' ; Load 'T' into A
+ staa waveType ; Update wave type to increasing triangle
+ clrb ; Clear B
+DonePrint stab outputVal ; Store updated output value
+ puly ; Restore Y from the stack
+ puld ; Restore D from the stack
+ rts ; Return from Caller
+
+;*************************************************************************
+; StartTimer1oc subroutine
+;
+; This subroutine will enable & start the oc1 timer.
+;
+; Input: Interval to set the next clock cycle
+; Output: No output other
+; Registers in use: A used for setting up the oc5 timer, D for setting the next trigger
+; Memory locations in use: All memory locations used for the oc5 timer.
+; interval to set the next cycle.
+;
+; Comments: The timer will be enabled only on channel 1 for output compare.
+;
+
+StartTimer1oc
+ PSHD
+ LDAA #%00000010
+ STAA TIOS ; set CH1 Output Compare
+ STAA TIE ; set CH1 interrupt Enable
+ LDAA #%10000000 ; enable timer, Fast Flag Clear not set
+ STAA TSCR1
+ LDAA #%00000000 ; TOI Off, TCRE Off, TCLK = BCLK/1
+ STAA TSCR2 ; not needed if started from reset
+
+ LDD interval ; 125usec with (24MHz/1 clock)
+ ADDD TCNTH ; for first interrupt
+ STD TC1H ;
+
+ BSET TFLG1,%00000010 ; initial Timer CH5 interrupt flag Clear, not needed if fast clear set
+ LDAA #%00000010
+ STAA TIE ; set CH1 interrupt Enable
+ PULD
+ RTS
+
+;*************************************************************************
+; StopTimerCH1 subroutine
+;
+; This subroutine will stop and disable the timer.
+;
+; Input: No Input
+; Output: No output other
+; Registers in use: A to disable the timer.
+; Memory locations in use: TIE to disable the timer.
+;
+; Comments: The timer will be disabled on all channels.
+;
+
+StopTimerCH1
+ psha ; Save A to the stack
+ clra ; Clear A
+ staa TIE ; Stop Timers
+ pula ; Restore A from the stack
+ rts ; Return
+
+;*************************************************************************
+; GenWave subroutine
+;
+; This subroutine will setup the proper variables to generate a wave and wait
+; for the wave to finish generating.
+;
+; Input: No input but the variables for PrintWave are required.
+; Output: No output except for the output of PrintWave
+; Registers in use: A for reading the timeTrigger variable,
+; D for reading outputCnt.
+; Memory locations in use: outputCnt, outputVal, timeTrigger, numPoints.
+;
+; Comments: This subroutine does not have any direct input or output but calls
+; PrintWave so the inputs for PrintWave should be set and the output
+; of PrintWave should be expected.
+;
+
+GenWave
+ pshd ; Save D to the stack
+ ldd #0 ; Clear D
+ std outputCnt ; Clear outputCnt
+ staa outputVal ; Clear outputVal
+
+ jsr StartTimer1oc ; Start Timer on CH1
+
+genLoop ldaa timeTrigger ; Load timeTrigger into A
+ beq genLoop ; If A == 0, loop
+ clra ; Clear A
+ staa timeTrigger ; Clear timeTrigger
+ jsr PrintWave ; Jump to PrintWave
+ ldd outputCnt ; Load outputCnt into D
+ cpd numPoints ; Compare D to numPoints
+ blo genLoop ; If D < numPoints, Loop
+
+ jsr StopTimerCH1 ; Turn off timer
+ puld ; Restore D from the stack
+ rts ; Return
+
+;*************************************************************************
+; PrintTime subroutine
+;
+; This subroutine will print the time, command prompt, and maybe an error prompt.
+;
+; Input: No input.
+; Output: The time prompt, time, command prompt, the current input,
+; and/or an error on the serial console.
+; Registers in use: A for the characters to print, X for buffer addresses,
+; Y for buffer lengths, D for the seconds/minutes/hours for calling TimeOnPortB
+; Memory locations in use: Memory Address for serial line, Buffer words for counters,
+; seconds, minutes, & hours buffers, and buffer to print time,
+; outputBuf for tracking what to output on PORTB.
+;
+; Comments: This subroutine requires TimeOnPortB subroutine and to be setup. The subroutine
+; will print the current user input if its not finished.
+;
+
+PrintTime
+ pshd ; Save D to the stack
+ ldaa outputBuf ; Load outputBuf into A
+ cmpa #'h' ; Compare A to 'h'
+ bne pTimeIsM ; If A != 'h', branch to pTimeIsM
+ ldd hours ; Load hours into B
+ bra skipRest ; Jump to skipRest
+pTimeIsM cmpa #'m' ; Compare A to 'm'
+ bne pTimeIsS ; If A != 'm', branch to pTimeIsS
+ ldd minutes ; Load Minutes into D
+ bra skipRest ; Jump to skipRest
+pTimeIsS ldd seconds ; Load seconds into D
+skipRest jsr TimeOnPortB ; Call TimeOnPortB to output time
+ puld ; Restore D from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; TimeOnPortB subroutine
+;
+; This subroutine will output the time given on on PORTB for two seven segment displays.
+;
+; Input: Two Digit Decimal number in register D.
+; Output: The given two digit decimal number on PORTB for two 7 segment displays.
+; Registers in use: D for the input, and for math to split the digits, X for math to split digits.
+; Memory locations in use: PORTB memory location.
+;
+; Comments: This subroutine will only work with two digit decimal numbers, and one digit decimal
+; numbers (leading zeros will be added).
+;
+
+TimeOnPortB
+ pshd ; Save D to the stack
+ pshx ; Save X to the stack
+ ldx #10 ; Load 10 into X to get digit
+ idiv ; Divide D by X and save Digit into D
+ pshb ; Save B to the stack (Lower Byte of D)
+ exg x,d ; Swap X and D
+ ldx #10 ; Load 10 into X to get digit
+ lslb ; Shift B left by 1
+ lslb ; Shift B left by 1
+ lslb ; Shift B left by 1
+ lslb ; Shift B left by 1
+ orab 1,sp+ ; Or B with Digit on stack
+ stab PORTB ; Save B to PORTB
+ pulx ; Restore X from the stack
+ puld ; Restore D from the stack
+ rts ; Return from caller
+
+;*************************************************************************
+; ExecuteCommand subroutine
+;
+; This subroutine will parse user input and execute the proper command or error out.
+;
+; Input: An address of a NULL terminated string in X.
+; Output: The output of the proper command or an error message.
+; Registers in use: X for the address of the user input, A for individual characters,
+; D & Y for numbers read from user input.
+; Memory locations in use: Serial console memory locations.
+;
+; Comments: This subroutine will disable interrupts while setting the time and will
+; reenable them after setting the time.
+;
+
+ExecuteCommand
+ pshd ; Save D to the stack
+ pshy ; Save Y to the stack
+ ldaa 1,x+ ; Load the character from X into A
+ lbeq ecDone ; If A == 0, jump to ecDone
+ cmpa #'t' ; Compare A to 't'
+ bne isH ; If A != 't', branch to isH
+skipSpaces ldaa 1,+x ; Load the next character into X
+ cmpa #' ' ; Compare A to ' ' character
+ beq skipSpaces ; If A == ' ', loop to skipSpaces
+ sei ; Disable interrupts
+ ldd hours ; Load hours into D
+ pshd ; Save hours to the stack
+ jsr ReadDecimal ; Read Hour number
+ exg y,d ; Exchange Y and D
+ cpd #24 ; Compare D to 24
+ lbhs badHours ; If D >= 24, badHours
+ cpd #0 ; Compare D to 0
+ lblt badHours ; If D < 0, badHours
+ std hours ; Save D to hours
+ ldaa -1,x ; Load the next character into A
+ cmpa #':' ; Compare A to ':'
+ lbne badHours ; If A != ':', badHours
+ ldd minutes ; Load minutes into D
+ pshd ; Save minutes to the stack
+ jsr ReadDecimal ; Read minute number
+ exg y,d ; Exchange Y and D
+ cpd #60 ; Compare D to 60
+ lbhs badMinutes ; If D >= 60, badMinutes
+ cpd #0 ; Compare D to 0
+ lblt badMinutes ; If D < 0, badMinutes
+ std minutes ; Save D to minutes
+ ldaa -1,x ; Load the next character into A
+ cmpa #':' ; Compare A to ':'
+ lbne badMinutes ; If A != ':', badMinutes
+ ldd seconds ; Load seconds into D
+ pshd ; Save seconds to the stack
+ jsr ReadDecimal ; Read second number
+ exg y,d ; Exchange Y and D
+ cpd #60 ; Compare D to 60
+ lbhs badSeconds ; If D >= 60, badSeconds
+ cpd #0 ; Compare D to 0
+ lblt badSeconds ; If D < 0, badSeconds
+ std seconds ; Save D to seconds
+ ldaa -1,x ; Load the next character into A
+ cmpa #NULL ; Compare A to NULL
+ lbne badSeconds ; If A != ':', badSeconds
+ clra ; Set A to 0
+ staa counter ; Clear Counter
+ cli ; Enable interrupts
+ puld ; Restore D from the stack
+ puld ; Restore D from the stack
+ puld ; Restore D from the stack
+ jsr PrintTime ; Print Time
+ lbra ecDone ; Branch to ecDone
+isH cmpa #'h' ; Compare A to 'h'
+ bne isM ; If A != 'h', branch to isM
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ lbne badCommand ; If B != CR, bad command
+ staa outputBuf ; Store A into outputBuf
+ jsr PrintTime ; Print Time
+ lbra ecDone ; Branch to ecDone
+isM cmpa #'m' ; Compare A to 'm'
+ bne isS ; If A != 'm', branch to isS
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ lbne badCommand ; If B != CR, bad command
+ staa outputBuf ; Store A into outputBuf
+ jsr PrintTime ; Print Time
+ lbra ecDone ; Branch to ecDone
+isS cmpa #'s' ; Compare A to 's'
+ bne isQ ; If A != 's', branch to isQ
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ lbne badCommand ; If B != CR, bad command
+ staa outputBuf ; Store A into outputBuf
+ jsr PrintTime ; Print Time
+ lbra ecDone ; Branch to ecDone
+isQ cmpa #'q' ; Compare A to 'q'
+ bne isGw ; If A != 'q', branch to isGw
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ lbne badCommand ; If B != NULL, branch to ecDone
+ jmp TypeWrite ; Jump to TypeWrite
+isGw cmpa #'g' ; Compare A to 'g'
+ lbne badCommand ; If A != 'g', branch to badCommand
+ ldaa 1,x+ ; Load next character into B
+ cmpa #'w' ; Compare A to 'w'
+ bne isGt ; If A != 'w', branch to isGt
+ ldab 1,x+ ; Load next charater into B
+ cmpb #NULL ; Compare B to NULL
+ bne isGw2 ; If B != NULL, branch to isGw2
+ ldx #swMsg ; Load address of sawtooth message
+ jsr WriteString ; Write string
+ ldaa #'S' ; Load 'S' for sawtooth
+ staa waveType ; Save A to waveType
+ ldd #1 ; Load 1 into D
+ std increment ; Set Increment to 1 -> 31.25Hz
+ jsr GenWave ; Jump to GenWave
+ ldx #doneWave ; Load the address of doneWave
+ jsr WriteString ; Write string
+ lbra ecDone ; Branch always to ecDone
+isGw2 cmpb #'2' ; Compare B to '2'
+ lbne badCommand ; If B != '2', bad
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare to NULL
+ lbne badCommand ; Not NULL? bad
+ ldx #sw2Msg ; Load address of sawtooth 125Hz message
+ jsr WriteString ; Write string
+ ldaa #'S' ; Load 'S' for sawtooth
+ staa waveType ; Save A to waveType
+ ldd #4 ; Load 4 into D
+ std increment ; Set Increment to 4 -> 125Hz
+ jsr GenWave ; Jump to GenWave
+ ldx #doneWave ; Load the address of doneWave
+ jsr WriteString ; Write string
+ lbra ecDone ; Branch always to ecDone
+isGt cmpa #'t' ; Compare A to 't'
+ bne isGq ; If A != 't', branch to isGq
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare to NULL
+ lbne badCommand ; A != NULL? bad
+ ldx #tMsg ; Load address of triangle message
+ jsr WriteString ; Write string
+ ldaa #'T' ; Load 'T' for triangle
+ staa waveType ; Save A to waveType
+ ldd #1 ; Load 1 into D
+ std increment ; Set Increment to 1 -> 31.25Hz
+ jsr GenWave ; Jump to GenWave
+ ldx #doneWave ; Load the address of doneWave
+ jsr WriteString ; Write string
+ lbra ecDone ; Branch always to ecDone
+isGq cmpa #'q' ; Compare A to 'q'
+ lbne badCommand ; A != 'q'? bad
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ bne isGq2 ; B != NULL? isGq2
+ ldx #sqMsg ; Load address of square message
+ jsr WriteString ; Write string
+ ldaa #'q' ; Load 'q' for square
+ staa waveType ; Save A to waveType
+ ldd #1 ; Load 1 into D
+ std increment ; Set Increment to 1 -> 31.25Hz
+ jsr GenWave ; Jump to GenWave
+ ldx #doneWave ; Load the address of doneWave
+ jsr WriteString ; Write string
+ lbra ecDone ; Branch always to ecDone
+isGq2 cmpb #'2' ; Compare B to '2'
+ lbne badCommand ; B != '2'? bad
+ ldab 1,x+ ; Load next character into B
+ cmpb #NULL ; Compare B to NULL
+ bne badCommand ; B != NULL? bad
+ ldx #sq2Msg ; Load address of square 125Hz message
+ jsr WriteString ; Write string
+ ldaa #'q' ; Load 'q' for square
+ staa waveType ; Save A to waveType
+ ldd #8 ; Load 8 into D
+ std increment ; Set Increment to 4 -> 125Hz
+ jsr GenWave ; Jump to GenWave
+ ldx #doneWave ; Load the address of doneWave
+ jsr WriteString ; Write string
+ lbra ecDone ; Branch always to ecDone
+badSeconds puld ; Restore Seconds from the stack
+ std seconds ; Restore seconds before change
+badMinutes puld ; Restore minutes from the stack
+ std minutes ; Restore minutes before change
+badHours puld ; Restore hours from the stack
+ std hours ; Restore hours before change
+ cli ; Reenable interrupts
+badCommand pshx ; Save X to the stack
+ ldx #badInput ; Load the address of badInput into X
+ jsr WriteString ; Jump to WriteString
+ pulx ; Restore X from the stack
+ecDone puly ; Restore Y from the stack
+ puld ; Restore D from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; ReadDecimal subroutine
+;
+; This subroutine will read an ASCII string of a number in decimal and convert it to
+; its value.
+;
+; Input: A memory address in register X.
+; Output: The value of the number in the Y register, and any errors printed
+; to the serial line. Zero bit is set if error occurs.
+; Registers in use: X for the address of the contents and for a buffer while printing,
+; D for multiplication, B for the character, Y for output value.
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine will return the value in the Y register, and if an error occurs,
+; the Zero bit in the CCR will be set.
+;
+
+ReadDecimal
+ pshd ; Save D to the stack
+ ldy #0 ; Clear Y register
+dHLoop ldab 1,x+ ; Read Next character from X
+ beq dHDone ; If B == 0, exit loop
+ cmpb #'+' ; Compare B to '+'
+ beq dHDone ; If B == '+', end of number
+ cmpb #'-' ; Compare B to '-'
+ beq dHDone ; If B == '-', end of number
+ cmpb #'*' ; Compare B to '*'
+ beq dHDone ; If B == '+', end of number
+ cmpb #'/' ; Compare B to '/'
+ beq dHDone ; If B == '-', end of number
+ cmpb #':' ; Compare B to ':'
+ beq dHDone ; If B == '-', end of number
+ cmpb #' ' ; Compare B to space character
+ beq dHDone ; If B == ' ', exit loop
+ cmpb #'0' ; Compare B to '0' character
+ blt dHError ; If B < '0', bad address, exit loop
+ cmpb #'9' ; Compare B to '9' character
+ bhi dHError ; If B > '9', check if 'A'-'F' characters
+ subb #'0' ; Subtract '0' from B to get true value
+ pshb ; Save B to the stack
+ ldd #10 ; load 10 into D
+ emul ; Multiply Y and D
+ exg d,y ; Transfer data from D to Y
+ pulb ; Restore b from the stack
+ aby ; Add B to Y
+ bra dHLoop ; Branch always to rHLoop
+dHDone clra ; clear A accumulator
+ tap ; Transfer A into CCR to clear zero bit
+ puld ; Restore D from the stack
+ rts ; Return to caller
+dHError ldaa #4 ; Load 4 into A to set zero bit in CCR
+ tap ; Transfer A into CCR to set zero bit and warn error
+ puld ; Restore D from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; strrev subroutine
+;
+; This subroutine will reverse a string from one buffer into another.
+;
+; Input: Address of null terminated string in X, address of a large enough
+; buffer in Y.
+; Output: The string in X reversed in Y.
+; Registers in use: X for the address of the string, Y for the address of the buffer,
+; A to read characters from the string.
+; Memory locations in use: Memory Address for serial line, address of the string & buffer
+;
+; Comments: This subroutine will not check that the output buffer is large enough, that
+; is the job of the caller.
+;
+
+strrev
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ psha ; Save A to the stack
+revLoop ldaa 1,y- ; Load Character from Y into A, decrement Y
+ beq revDone ; If Character is 0, exit loop
+ staa 1,x+ ; Save character in address in X, increment X
+ bra revLoop ; Loop back always
+ clra ; Set A to Zero
+revDone staa 1,x+ ; Copy Null terminator into new string
+ pula ; Restore A from the stack
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; PrintDecimalWord subroutine
+;
+; This subroutine will print a given word of data to the serial in binary.
+;
+; Input: 1 word of data in register D, Buffer Address in Y
+; Output: Decimal representation of the data on the serial console
+; Registers in use: Y for the address of the buffer, X to count the number of bits
+; written and for division, D for the input, A for characters.
+; Memory locations in use: Memory addresses for serial, and operator to hold sign
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+PrintDecimalWord
+ pshx ; Save X to the stack
+ pshy ; Save Y to the stack
+ pshd ; Save D (A:B) to the stack
+ cpd #0 ; Compare D to zero
+ beq dIsZero ; Branch to hIsZero
+ blt dIsNegative ; If D < 0, Jump to dIsNegative
+dAfterNeg psha ; Save A to the stack
+ pshy ; Save Y to the stack
+ pshx ; Save x to the stack
+ ldaa #'0' ; Load the '0' character into A
+ ldx #buffer2 ; Load the address of buffer2 into X
+ ldy #5 ; Load 5 into Y
+ jsr memset ; Write '0' to the first 5 bytes in buffer2
+ pulx ; Restore X from the stack
+ puly ; Restore Y from the stack
+ clra ; Set A to zero
+ staa 0,y ; Load Zero into Y for Null Terminator
+ pula ; Restore A from the stack
+dPrintLoop ldx #10 ; Load 10 in X for division
+ idiv ; Divide D / 10 to get Hex Digit
+ cpx #0 ; Compare X to 0
+ beq dCheck ; If X == 0, branch to check D is zero
+dDNotZero addb #'0' ; Add '0' to B to get ASCII Character
+ stab 1,+y ; Save character from B to Y
+ exg X,D ; Swap values in X and D
+ bra dPrintLoop ; Loop to hPrintLoop
+dCheck cpd #0 ; Compare D to 0
+ bne dDNotZero ; If D != 0, branch back to hDNotZero
+dPrintDone ldaa operator ; Load operator into A to see if negative
+ cmpa #'-' ; Compare A to '-'
+ bne dNotNeg ; If A != '-', jump to dNotNeg
+ staa 1,+y ; Save '-' into buffer
+dNotNeg ldx #buffer2 ; Load the address of buffer2 in X
+ jsr strrev ; Reverse string in Y in buffer in X
+ jsr WriteString ; Jump to write string to write the number
+ ldy lenBuf2 ; Load the length of buffer2 into Y
+ ldx #buffer2 ; Load the address of buffer2 into X
+ jsr Zeros ; Fill buffer2 with zeros
+ puld ; Restore D (A:B) from the stack
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+dIsZero ldaa #'0' ; Load '0' character into A
+ jsr putchar ; Print character to the screen
+ puld ; Restore D (A:B) from the stack
+ puly ; Restore Y from the stack
+ pulx ; Restore X from the stack
+ rts ; Return to caller
+dIsNegative psha ; Save A to the stack
+ ldaa #'-' ; Load '-' into A
+ staa operator ; Save '-' to operator buffer
+ pula ; Restore A from the stack
+ nega ; Two's complement of A
+ suba #1 ; Subtract 1 from A
+ negb ; Two'complement of B
+ subb #1 ; Subtract 1 from B
+ addd #1 ; Add 1 to D
+ bra dAfterNeg ; Jump back to dAfterNeg
+
+;*************************************************************************
+; Zeros subroutine
+;
+; This subroutine will write zeros to every byte in a given array.
+;
+; Input: Address of an array in X and its length in Y
+; Output: Zeros in every byte of an array.
+; Registers in use: X for the address of the array, Y for the length, and A for 0
+; Memory locations in use: Memory Address of the array
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+Zeros
+ psha ; Save A to the Stack
+ clra ; Clear A
+zerosLoop staa 1,x+ ; Load A into byte at X
+ dbne y,zerosLoop ; Decrement Y and loop if Y != 0
+ pula ; Restore A from the stack
+ rts ; Return to caller
+
+;*************************************************************************
+; memset subroutine
+;
+; This subroutine will write a given byte to every byte in a given array.
+;
+; Input: Address of an array in X and its length in Y, the byte in A
+; Output: The given byte in every byte of an array.
+; Registers in use: X for the address of the array, Y for the length, and A for the given byte
+; Memory locations in use: Memory Address of the array
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+memset
+ staa 1,x+ ; Load A into byte at X
+ dbne y,memset ; Decrement Y and loop if Y != 0
+ rts ; Return to caller
+
+;*************************************************************************
+; WriteString subroutine
+;
+; This subroutine will write a given null terminated string to the serial.
+;
+; Input: Address of null terminated string in X
+; Output: Null terminated string written to serial
+; Registers in use: X for the address of the string and A for the current byte
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine requires serial to be setup and putchar subroutine.
+;
+
+WriteString
+ psha ; Save A to the stack
+writeLoop ldaa 1,x+ ; Load the byte at addr in X, then add 1
+ beq doneWrite ; if A == 0, branch to doneWrite
+ jsr putchar ; Jump to putchar to write byte to serial
+ bra writeLoop ; branch always to writeLoop
+doneWrite pula ; restore A from the stack
+ rts ; return to caller
+
+;*************************************************************************
+; ReadString subroutine
+;
+; This subroutine will read a string from the serial line to a given address.
+;
+; Input: Address of an array in X
+; Output: Null terminated string in the given array
+; Registers in use: X for the address of the string Y for the length of the string,
+; and A for the current byte
+; Memory locations in use: Memory Address for serial line, address of the string
+;
+; Comments: This subroutine requires serial to be setup and getchar subroutine.
+;
+
+ReadString
+ psha ; Save accumulator A to the stack
+ pshy ; Save Y to the stack
+ pshx ; Save X to the stack
+readLoop jsr getchar ; Jump to putchar to write byte to serial
+ beq readLoop ; While A == 0, loop
+ cmpa #CR ; If A == CR, exit loop
+ beq doneRead ; Branch to doneRead if A == CR
+ staa 1,x+ ; Save the byte to the addr in X, then add 1
+ jsr putchar ; Write Character back to the terminal
+ dey ; Decrement Y by 1
+ beq doneRead ; If Y == 0, no more room, stop reading
+ bra readLoop ; branch always to readLoop
+doneRead ldaa #CR ; Load CR into A
+ jsr putchar ; Print to serial
+ ldaa #LF ; Load LF into A
+ jsr putchar ; Print to serial
+ pulx ; Restore X from the stack
+ pulY ; Restore Y from the stack
+ pula ; restore A from the stack
+ rts ; return to caller
+
+;*************************************************************************
+; putchar subroutine
+;
+; This subroutine writes a single byte to a serial line
+;
+; Input: A single ASCII byte in accumulator A
+; Output: Sends one character to SCI port
+; Registers in use: Accumulator A with input byte
+; Memory locations in use: SCISR1 and SCIDRL status and data registers
+;
+
+putchar brclr SCISR1,#%10000000,putchar ; wait for transmit buffer empty
+ staa SCIDRL ; send a character
+ rts ; Return to caller
+
+;*************************************************************************
+; putchar subroutine
+;
+; This subroutine reads one byte from the SCI port
+;
+; Input: One byte from the SCI port
+; Output: One byte in accumulator A
+; Registers in use: Accumulator A for output byte
+; Memory locations in use: SCISR1 and SCIDRL status and data registers
+;
+
+getchar brclr SCISR1,#%00100000,getchar7 ; If no input on SCI port, return 0
+ ldaa SCIDRL ; Read one byte from SCI port into A
+ rts ; Return to caller
+getchar7 clra ; Set A to 0
+ rts ; Return to caller
+
+*
+**************************************************************************
+* Data Section 2: address used [ $3100 to $3FFF ] RAM Memory
+*
+
+badInput dc.b 'Invalid Input',CR,LF,NULL ; Invalid Input Prompt
+
+; twMsg: welcome message for typewrite
+twMsg dc.b 'Wave Generator and Clock stopped and Typewrite program started.',CR,LF
+ dc.b 'You may type below.',CR,LF,NULL
+
+; Messages for different waveforms
+swMsg dc.b 'sawtooth wave generation...',CR,LF,NULL
+sw2Msg dc.b 'sawtooth wave 125Hz generation...',CR,LF,NULL
+tMsg dc.b 'triangle wave generation...',CR,LF,NULL
+sqMsg dc.b 'square wave generation...',CR,LF,NULL
+sq2Msg dc.b 'square wave 125Hz generation...',CR,LF,NULL
+
+doneWave dc.b 'Done generating wave.',CR,LF,NULL
+
+; msg: this is the main option menu string
+msg dc.b 'Commands:',CR,LF
+ dc.b 'gw: generate sawtooth wave, printing 0 through 255, repeated for total 2048 points',CR,LF
+ dc.b 'gw2: generate sawtooth wave of 125Hz, wave repeated for total 2048 points',CR,LF
+ dc.b 'gt: generate triangle wave, printing 0 through 255, then 255 down to 0, repeated for total 2048 points',CR,LF
+ dc.b 'gq: generate square wave, printing 0 for 255 times, then print 255 for 255 times, then repeated for total 2048 points',CR,LF
+ dc.b 'gq2: generate square wave of 125Hz, wave repeated for total 2048 points',CR,LF
+ dc.b 't: Set the time in format HH:MM:SS',CR,LF
+ dc.b 'h: Display the hours on the 7 segment displays',CR,LF
+ dc.b 'm: Display the minutes on the 7 segment displays',CR,LF
+ dc.b 's: Display the seconds on the 7 segment displays',CR,LF
+ dc.b 'q: Stop the clock and enter typewriter',CR,LF,NULL
+
diff --git a/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd
new file mode 100644
index 0000000..ac4d359
--- /dev/null
+++ b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Postload.cmd
@@ -0,0 +1 @@
+// After load the commands written below will be executed
diff --git a/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd
new file mode 100644
index 0000000..0bed464
--- /dev/null
+++ b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Preload.cmd
@@ -0,0 +1 @@
+// Before load the commands written below will be executed
diff --git a/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd
new file mode 100644
index 0000000..bf55944
--- /dev/null
+++ b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Reset.cmd
@@ -0,0 +1 @@
+// After reset the commands written below will be executed
diff --git a/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd
new file mode 100644
index 0000000..6a1549a
--- /dev/null
+++ b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_SetCPU.cmd
@@ -0,0 +1 @@
+// At startup the commands written below will be executed
diff --git a/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd
new file mode 100644
index 0000000..6a1549a
--- /dev/null
+++ b/cmpen472hw11_McDonnell/cmd/Full_Chip_Simulation_Startup.cmd
@@ -0,0 +1 @@
+// At startup the commands written below will be executed
diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell.mcp b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell.mcp
new file mode 100644
index 0000000..9377caf
--- /dev/null
+++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell.mcp
Binary files differ
diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/CWSettingsWindows.stg b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/CWSettingsWindows.stg
new file mode 100644
index 0000000..80116df
--- /dev/null
+++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/CWSettingsWindows.stg
Binary files differ
diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.o b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.o
new file mode 100644
index 0000000..d156a94
--- /dev/null
+++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.o
Binary files differ
diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.sx b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.sx
new file mode 100644
index 0000000..b5eed13
--- /dev/null
+++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/ObjectCode/main.asm.sx
@@ -0,0 +1,79 @@
+S0860000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E343732687731315F4D63446F6E6E656C6C5C636D70656E343732687731315F4D63446F6E6E656C6C5F446174615C5374616E646172645C4F626A656374436F64655C6D61696E2E61736D2E70726D73
+S123300000000000000000000000000000000000000010000000000000000000000000009C
+S123302000000000001000000000000000000000000000000000000000000000000000007C
+S1123040000010730000000BB8080000000153DB
+S105FFF0316179
+S105FFEC31B22C
+S1233100CF310086F15A03860C5ACBCC00015CC8CE37371635DA4C3B194C38804C378086A1
+S1233120FF5A0310EF863E16360A862016360ACE3030FD30411635E6CE303016333BCE309D
+S123314030FD30411635CB20DC14104D3880CE362A1635DA1636119727FA5A0116360A2059
+S1233160F34C378010EFFE302C087E302C8E00C8263FCE00007E302CFE302A087E302A8EF1
+S1233180003C262ACE00007E302AFE3028087E30288E003C2618CE00007E3028FE302608BD
+S12331A07E30268E00182606CE00007E30261633050BFC3047D3525C524C4E2286017A3037
+S12331C04BFC3045C300017C3045BC304925031632D90B3B35B6304E81541827008A8174BA
+S12331E0182700AC81511827002B81711827005087F63044CD300016355C36860D16360A6F
+S1233200860A16360A32F3304C8C0100182500A4C71820009F87C6FFCD300016355C36866B
+S12332200D16360A860A16360A3287F63044F3304C8C01001825007CC786717A304E20741F
+S123324087C7CD300016355C36860D16360A860A16360A3287F63044F3304C8C01002554DB
+S1233260C786517A304E204C87F63044CD300016355C36860D16360A860A16360A32F33059
+S12332804C8C0100252E86747A304E830001202487F63044CD300016355C36860D16360A90
+S12332A0860A16360A32B3304C8C00002D0686547A304EC77B3044313A3D3B86025A405A1D
+S12332C04C86805A4686005A4DFC3047D3445C524C4E0286025A4C3A3D36875A4C323D3B45
+S12332E0CC00007C30457A30441632BAB6304B27FB877A304B1631D3FC3045BC304925EC7D
+S12333001632D93A3D3BB6304381682605FC3026200C816D2605FC30282003FC302A1633EC
+S1233320233A3D3B34CE000A181037B7D4CE000A58585858EAB05B01303A3D3B35A630188B
+S12333402701C38174267EA620812027FA1410FC30263B163509B7E48C0018182401998CB7
+S12333600000182D01927C3026A61F813A18260187FC30283B163509B7E48C003C182401D6
+S1233380738C0000182D016C7C3028A61F813A18260161FC302A3B163509B7E48C003C1824
+S12333A024014D8C0000182D01467C302AA61F81001826013B877A302C10EF3A3A3A163396
+S12333C0051820014181682612E630C1001826012D7A30431633051820012B816D2612E65B
+S12333E030C100182601177A30431633051820011581732612E630C100182601017A3043C9
+S1233400163305182000FF8171260BE630C100182600EB0631498167182600E2A6308177AA
+S12334202650E630C100261ECE36811635DA86537A304ECC00017C304C1632DFCE371F1656
+S123344035DA182000C0C132182600B2E630C100182600AACE369F1635DA86537A304ECC5A
+S123346000047C304C1632DFCE371F1635DA1820009481742626E630C10018260080CE3636
+S1233480C31635DA86547A304ECC00017C304C1632DFCE371F1635DA1820006A8171182667
+S12334A0005CE630C100261ECE36E11635DA86717A304ECC00017C304C1632DFCE371F1672
+S12334C035DA18200040C13218260032E630C100262CCE36FD1635DA86717A304ECC0008EC
+S12334E07C304C1632DFCE371F1635DA182000163A7C302A3A7C30283A7C302610EF34CEE7
+S1233500361A1635DA30313A3D3BCD0000E630272EC12B272AC12D2726C12A2722C12F2724
+S12335201EC13A271AC1202716C1302D17C1392213C03037CC000A13B7C63319ED20CE8770
+S1233540B7023A3D8604B7023A3D343536A67F27056A3020F8876A303231303D34353B8CBA
+S12335600000274C2D533635348630CE3013CD00051635D43031876A4032CE000A18108EAB
+S123358000002708CB306B60B7D420EE8C000026F3B6302F812D26026A60CE301316354A99
+S12335A01635DAFD3024CE30131635CB3A31303D863016360A3A31303D36862D7A302F32BA
+S12335C040800150C001C30001209B36876A300436FB323D6A300436FB3D36A63027051641
+S12335E0360A20F7323D36353416361127FB810D270A6A3016360A03270220ED860D16361C
+S12336000A860A16360A3031323D4FCC80FC5ACF3D4FCC200396CF3D873D496E76616C69E2
+S12336206420496E7075740D0A00576176652047656E657261746F7220616E6420436C6FF0
+S1233640636B2073746F7070656420616E64205479706577726974652070726F6772616D21
+S123366020737461727465642E0D0A596F75206D617920747970652062656C6F772E0D0AE6
+S123368000736177746F6F746820776176652067656E65726174696F6E2E2E2E0D0A00737A
+S12336A06177746F6F7468207761766520313235487A2067656E65726174696F6E2E2E2EDD
+S12336C00D0A00747269616E676C6520776176652067656E65726174696F6E2E2E2E0D0AB9
+S12336E00073717561726520776176652067656E65726174696F6E2E2E2E0D0A007371751C
+S1233700617265207761766520313235487A2067656E65726174696F6E2E2E2E0D0A0044EF
+S12337206F6E652067656E65726174696E6720776176652E0D0A00436F6D6D616E64733A7B
+S12337400D0A67773A2067656E657261746520736177746F6F746820776176652C20707231
+S1233760696E74696E672030207468726F756768203235352C207265706561746564206673
+S12337806F7220746F74616C203230343820706F696E74730D0A6777323A2067656E6572C3
+S12337A061746520736177746F6F74682077617665206F6620313235487A2C2077617665F1
+S12337C020726570656174656420666F7220746F74616C203230343820706F696E74730D18
+S12337E00A67743A2067656E657261746520747269616E676C6520776176652C207072695B
+S12338006E74696E672030207468726F756768203235352C207468656E2032353520646FAD
+S1233820776E20746F20302C20726570656174656420666F7220746F74616C20323034381D
+S123384020706F696E74730D0A67713A2067656E65726174652073717561726520776176F4
+S1233860652C207072696E74696E67203020666F72203235352074696D65732C20746865E6
+S12338806E207072696E742032353520666F72203235352074696D65732C207468656E202D
+S12338A0726570656174656420666F7220746F74616C203230343820706F696E74730D0A4D
+S12338C06771323A2067656E6572617465207371756172652077617665206F662031323504
+S12338E0487A2C207761766520726570656174656420666F7220746F74616C203230343800
+S123390020706F696E74730D0A743A20536574207468652074696D6520696E20666F726DDA
+S123392061742048483A4D4D3A53530D0A683A20446973706C61792074686520686F75725C
+S123394073206F6E207468652037207365676D656E7420646973706C6179730D0A6D3A20C1
+S1233960446973706C617920746865206D696E75746573206F6E20746865203720736567D3
+S12339806D656E7420646973706C6179730D0A733A20446973706C617920746865207365D3
+S12339A0636F6E6473206F6E207468652037207365676D656E7420646973706C6179730D8E
+S12339C00A713A2053746F702074686520636C6F636B20616E6420656E74657220747970CD
+S10D39E0657772697465720D0A00C0
+S9033100CB
diff --git a/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdt
new file mode 100644
index 0000000..13a37e9
--- /dev/null
+++ b/cmpen472hw11_McDonnell/cmpen472hw11_McDonnell_Data/Standard/TargetDataWindows.tdt
Binary files differ
diff --git a/cmpen472hw11_McDonnell/prm/burner.bbl b/cmpen472hw11_McDonnell/prm/burner.bbl
new file mode 100644
index 0000000..0c57619
--- /dev/null
+++ b/cmpen472hw11_McDonnell/prm/burner.bbl
@@ -0,0 +1,157 @@
+/* logical s-record file */
+OPENFILE "%ABS_FILE%.s19"
+format=motorola
+busWidth=1
+origin=0
+len=0x1000000
+destination=0
+SRECORD=Sx
+SENDBYTE 1 "%ABS_FILE%"
+CLOSE
+
+
+/* physical s-record file */
+OPENFILE "%ABS_FILE%.phy"
+format = motorola
+busWidth = 1
+len = 0x4000
+
+/* logical non banked flash at $4000 and $C000 to physical */
+origin = 0x004000
+destination = 0x0F8000
+SENDBYTE 1 "%ABS_FILE%"
+
+origin = 0x00C000
+destination = 0x0FC000
+SENDBYTE 1 "%ABS_FILE%"
+
+/* physical FTS512K flash window to physical
+origin = 0x008000
+destination = 0x080000
+SENDBYTE 1 "%ABS_FILE%"
+*/
+
+/* physical FTS256K parts flash window to physical
+origin = 0x008000
+destination = 0x0C0000
+SENDBYTE 1 "%ABS_FILE%"
+*/
+
+/* physical FTS128K parts flash window to physical
+origin = 0x008000
+destination = 0x0E0000
+SENDBYTE 1 "%ABS_FILE%"
+*/
+
+/* physical FTS64K parts flash window to physical
+origin = 0x008000
+destination = 0x0F0000
+SENDBYTE 1 "%ABS_FILE%"
+*/
+
+/* physical FTS32K parts flash window to physical
+origin = 0x008000
+destination = 0x0F8000
+SENDBYTE 1 "%ABS_FILE%"
+*/
+
+/* logical 512 kB banked flash to physical */
+origin = 0x208000
+destination = 0x080000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x218000
+destination = 0x084000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x228000
+destination = 0x088000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x238000
+destination = 0x08C000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x248000
+destination = 0x090000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x258000
+destination = 0x094000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x268000
+destination = 0x098000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x278000
+destination = 0x09C000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x288000
+destination = 0x0A0000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x298000
+destination = 0x0A4000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x2A8000
+destination = 0x0A8000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x2B8000
+destination = 0x0AC000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x2C8000
+destination = 0x0B0000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x2D8000
+destination = 0x0B4000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x2E8000
+destination = 0x0B8000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x2F8000
+destination = 0x0BC000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x308000
+destination = 0x0C0000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x318000
+destination = 0x0C4000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x328000
+destination = 0x0C8000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x338000
+destination = 0x0CC000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x348000
+destination = 0x0D0000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x358000
+destination = 0x0D4000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x368000
+destination = 0x0D8000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x378000
+destination = 0x0DC000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x388000
+destination = 0x0E0000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x398000
+destination = 0x0E4000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x3A8000
+destination = 0x0E8000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x3B8000
+destination = 0x0EC000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x3C8000
+destination = 0x0F0000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x3D8000
+destination = 0x0F4000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x3E8000
+destination = 0x0F8000
+SENDBYTE 1 "%ABS_FILE%"
+origin = 0x3F8000
+destination = 0x0FC000
+SENDBYTE 1 "%ABS_FILE%"
+
+CLOSE
+