summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmpen472hw5_McDonnell/Full_Chip_Simulation.ini2
-rw-r--r--cmpen472hw5_McDonnell/Sources/main.asm12
-rw-r--r--cmpen472hw5_McDonnell/bin/Project.absbin6442 -> 6466 bytes
-rw-r--r--cmpen472hw5_McDonnell/bin/Project.abs.s1952
-rw-r--r--cmpen472hw5_McDonnell/bin/main.dbg23
-rw-r--r--cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.obin6442 -> 6466 bytes
-rw-r--r--cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx52
-rw-r--r--cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdtbin64353 -> 64365 bytes
8 files changed, 78 insertions, 63 deletions
diff --git a/cmpen472hw5_McDonnell/Full_Chip_Simulation.ini b/cmpen472hw5_McDonnell/Full_Chip_Simulation.ini
index 508e9c0..192e8f6 100644
--- a/cmpen472hw5_McDonnell/Full_Chip_Simulation.ini
+++ b/cmpen472hw5_McDonnell/Full_Chip_Simulation.ini
@@ -10,7 +10,7 @@ Target=sim
Layout=ASM_layout.hwl
LoadDialogOptions=AUTOERASEANDFLASH NORUNAFTERLOAD
CPU=HC12
-MainFrame=0,1,-1,-1,-1,-1,454,107,2374,1130
+MainFrame=0,1,-1,-1,-1,-1,593,167,1886,1190
Configuration=Full_Chip_Simulation.hwc
Statusbar=1
ShowToolbar=1
diff --git a/cmpen472hw5_McDonnell/Sources/main.asm b/cmpen472hw5_McDonnell/Sources/main.asm
index 1ca3e7e..8eef62d 100644
--- a/cmpen472hw5_McDonnell/Sources/main.asm
+++ b/cmpen472hw5_McDonnell/Sources/main.asm
@@ -77,9 +77,9 @@ Counter dc.w $0036 ; X register count number for time Delay
LEVEL dc.b $0005 ; Light Level that the LED should be
-str ds.b $0005 ; Array of 5 bytes to read a string
+str ds.b $000F ; Array of 16 bytes to read a string
dc.b NULL
-lenStr dc.w $0005 ; Length of str array
+lenStr dc.w $000F ; Length of str array
* There is a second Data Section at the end of the file.
*
**************************************************************************
@@ -107,6 +107,7 @@ mainLoop
jsr Zeros ; jump to Zeros to zero out str
ldx #str ; Reload address of str into X
+ ldy lenStr ; Load the length of the string into Y
jsr ReadString ; Jump to ReadString to read user input into str
ldx #str ; Reload Address of str into X
@@ -246,7 +247,8 @@ doneWrite pula ; restore A from the stack
;
; 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 and A for the current byte
+; 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.
@@ -254,6 +256,7 @@ doneWrite pula ; restore A from the stack
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
@@ -261,10 +264,13 @@ readLoop jsr getchar ; Jump to putchar to write byte to seria
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 #LF ; Load Line Feed into A
jsr putchar ; Write LF to terminal
pulx ; Restore X from the stack
+ pulY ; Restore Y from the stack
pula ; restore A from the stack
rts ; return to caller
diff --git a/cmpen472hw5_McDonnell/bin/Project.abs b/cmpen472hw5_McDonnell/bin/Project.abs
index f21f859..20846cf 100644
--- a/cmpen472hw5_McDonnell/bin/Project.abs
+++ b/cmpen472hw5_McDonnell/bin/Project.abs
Binary files differ
diff --git a/cmpen472hw5_McDonnell/bin/Project.abs.s19 b/cmpen472hw5_McDonnell/bin/Project.abs.s19
index 4326354..a7c9e25 100644
--- a/cmpen472hw5_McDonnell/bin/Project.abs.s19
+++ b/cmpen472hw5_McDonnell/bin/Project.abs.s19
@@ -1,28 +1,28 @@
S0580000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877355F4D63446F6E6E656C6C5C62696E5C50726F6A6563742E6162734B
-S10E3000003605000000000000000581
-S1233100CF310086F15A03860C5ACBCC00015CC8CE32E01631B2CE3003FD30091631A9CE61
-S123312030031631BECE300316313F20E3CE328F1631B216326D27FB1632665A0120F43617
-S123314037E630C1512740C14C261CA630E630264F8134270D80302F47810424431631D8DB
-S1233160204416321E203FC1462635A630E630262F8134270D80302F27810424231631EE8F
-S12331802024163204201FA63081552613A6308149260DA63081542607A630260306312D69
-S12331A0CE32761631B233323D36876A300436FB323D36A630270516326620F7323D363429
-S12331C016326D27FB810D27076A3016326620F0860A16326630323D810126054C011020F9
-S12331E00C810226054C012020034C01403D810126054D0110200C810226054D0120200341
-S12332004D01403D3686640440127A30021632391632391632391632394320EB323D368640
-S123322000816427127A30021632391632391632391632394220EA323D4C018036B6300216
-S123324004400616325C4320F74D01808664B0300204400616325C4320F7323D34FE30006F
-S12332600926FD30A73D4FCC80FC5ACF3D4FCC200396CF3D873D4572726F723A20556E6BD7
-S12332806E6F776E20436F6D6D616E640D0A0057656C636F6D6520746F205479706520576A
-S12332A072697465722C20796F75206D617920747970652062656C6F772E0D0A52657374D6
-S12332C061727420746F20656E746572206D61696E206D656E7520616761696E2E0D0A0063
-S12332E04C313A205475726E206F6E204C4544310D0A46313A205475726E206F6666204CCF
-S12333004544310D0A4C323A205475726E206F6E204C4544320D0A46323A205475726E2081
-S12333206F6666204C4544320D0A4C333A205475726E206F6E204C4544330D0A46333A207F
-S12333405475726E206F6666204C4544330D0A4C343A204C45443420676F65732066726F0E
-S12333606D203025206C69676874206C6576656C20746F2031303025206C69676874206C5A
-S12333806576656C20696E20302E34207365636F6E64730D0A46343A204C45443420676FDB
-S12333A065732066726F6D2031303025206C69676874206C6576656C20746F203025206C13
-S12333C069676874206C6576656C20696E20302E34207365636F6E64730D0A515549543AB9
-S12333E02051756974206D656E752070726F6772616D2C2072756E20547970652077726944
-S11234007465722070726F6772616D2E0D0A0011
+S118300000360500000000000000000000000000000000000F6D
+S1233100CF310086F15A03860C5ACBCC00015CC8CE32E81631B5CE3003FD30131631ACCE49
+S12331203003FD30131631C1CE300316314220E0CE32971631B516327527FB16326E5A0103
+S123314020F43637E630C1512740C14C261CA630E630264F8134270D80302F4781042443B0
+S12331601631E02044163226203FC1462635A630E630262F8134270D80302F278104242395
+S12331801631F6202416320C201FA63081552613A6308149260DA63081542607A630260388
+S12331A0063130CE327E1631B533323D36876A300436FB323D36A630270516326E20F73256
+S12331C03D36353416327527FB810D270A6A3016326E03270220ED860A16326E3031323DD2
+S12331E0810126054C0110200C810226054C012020034C01403D810126054D0110200C81D5
+S12332000226054D012020034D01403D3686640440127A300216324116324116324116321C
+S1233220414320EB323D368600816427127A30021632411632411632411632414220EA3264
+S12332403D4C018036B630020440061632644320F74D01808664B03002044006163264431F
+S123326020F7323D34FE30000926FD30A73D4FCC80FC5ACF3D4FCC200396CF3D873D4572CA
+S1233280726F723A20556E6B6E6F776E20436F6D6D616E640D0A0057656C636F6D65207437
+S12332A06F2054797065205772697465722C20796F75206D617920747970652062656C6F88
+S12332C0772E0D0A5265737461727420746F20656E746572206D61696E206D656E752061ED
+S12332E06761696E2E0D0A004C313A205475726E206F6E204C4544310D0A46313A20547592
+S1233300726E206F6666204C4544310D0A4C323A205475726E206F6E204C4544320D0A462F
+S1233320323A205475726E206F6666204C4544320D0A4C333A205475726E206F6E204C458B
+S123334044330D0A46333A205475726E206F6666204C4544330D0A4C343A204C45443420C2
+S1233360676F65732066726F6D203025206C69676874206C6576656C20746F203130302509
+S1233380206C69676874206C6576656C20696E20302E34207365636F6E64730D0A46343A36
+S12333A0204C45443420676F65732066726F6D2031303025206C69676874206C6576656CF8
+S12333C020746F203025206C69676874206C6576656C20696E20302E34207365636F6E64BC
+S12333E0730D0A515549543A2051756974206D656E752070726F6772616D2C2072756E2051
+S11A340054797065207772697465722070726F6772616D2E0D0A00F5
S9030000FC
diff --git a/cmpen472hw5_McDonnell/bin/main.dbg b/cmpen472hw5_McDonnell/bin/main.dbg
index 92a558c..8c52b13 100644
--- a/cmpen472hw5_McDonnell/bin/main.dbg
+++ b/cmpen472hw5_McDonnell/bin/main.dbg
@@ -77,9 +77,9 @@ Counter dc.w $0036 ; X register count number for time Delay
LEVEL dc.b $0005 ; Light Level that the LED should be
-str ds.b $0005 ; Array of 5 bytes to read a string
+str ds.b $000F ; Array of 16 bytes to read a string
dc.b NULL
-lenStr dc.w $0005 ; Length of str array
+lenStr dc.w $000F ; Length of str array
* There is a second Data Section at the end of the file.
*
**************************************************************************
@@ -107,6 +107,7 @@ mainLoop
jsr Zeros ; jump to Zeros to zero out str
ldx #str ; Reload address of str into X
+ ldy lenStr ; Load the length of the string into Y
jsr ReadString ; Jump to ReadString to read user input into str
ldx #str ; Reload Address of str into X
@@ -153,6 +154,7 @@ CheckInput
cmpa #'4' ; Compare Character in A to '4'
beq L4Check ; If A == '4', branch to L4Check
suba #'0' ; Subtract character '0' from A
+ ; This allows the number in A to be the LED number (if correct)
ble none ; If A < '0', branch to none (unknown string)
cmpa #4 ; Compare A to 4
bhs none ; Branch to None if A > 3
@@ -245,7 +247,8 @@ doneWrite pula ; restore A from the stack
;
; 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 and A for the current byte
+; 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.
@@ -253,6 +256,7 @@ doneWrite pula ; restore A from the stack
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
@@ -260,10 +264,13 @@ readLoop jsr getchar ; Jump to putchar to write byte to seria
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 #LF ; Load Line Feed into A
jsr putchar ; Write LF to terminal
pulx ; Restore X from the stack
+ pulY ; Restore Y from the stack
pula ; restore A from the stack
rts ; return to caller
@@ -345,14 +352,15 @@ doneDec pula ; Restore A from the stack
rts ; Return to caller
;*************************************************************************
-; HighToLow subroutine
+; LowToHigh subroutine
;
-; This subroutine will dim LED4 from 100% to 0% in 400ms
+; This subroutine will dim LED4 from 0% to 100% in 400ms
;
; Input: No Input, all parameters are hard coded
-; Output: LED4 dimmed from 100% to 0% in 400ms, wasted cycles
+; Output: LED4 dimmed from 0% to 100% in 400ms, wasted cycles
; Registers in use: A accumulator to control the light level of the LED
; Memory locations in use: PORTB memory location associated with PORTB on the chip
+; LEVEL memory location for byte of light level.
;
; Comments: This subroutine requires dimmer subroutine
;
@@ -381,7 +389,8 @@ doneInc pula ; Restore A from the stack
; LED4 should be on and off for.
; Output: LED4 dimmed to a given level, wasted cycles
; Registers in use: A accumulator to counter number of times looped
-; Memory locations in use: Two bytes ONN and OFF used to dim the LED4 to a given level
+; Memory locations in use: PORTB memory location associated with PORTB on the chip
+; LEVEL memory location for byte of light level.
;
; Comments: This subroutine requires delay10usec subroutine
;
diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o
index f21f859..20846cf 100644
--- a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o
+++ b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.o
Binary files differ
diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx
index 0edfa2c..5f7da42 100644
--- a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx
+++ b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/ObjectCode/main.asm.sx
@@ -1,28 +1,28 @@
S0840000433A5C55736572735C4A61636F62204D63446F6E6E656C6C5C446F63756D656E74735C434D50454E2D3437322D48575C636D70656E3437326877355F4D63446F6E6E656C6C5C636D70656E3437326877355F4D63446F6E6E656C6C5F446174615C5374616E646172645C4F626A656374436F64655C6D61696E2E61736D2E70726DCF
-S10E3000003605000000000000000581
-S1233100CF310086F15A03860C5ACBCC00015CC8CE32E01631B2CE3003FD30091631A9CE61
-S123312030031631BECE300316313F20E3CE328F1631B216326D27FB1632665A0120F43617
-S123314037E630C1512740C14C261CA630E630264F8134270D80302F47810424431631D8DB
-S1233160204416321E203FC1462635A630E630262F8134270D80302F27810424231631EE8F
-S12331802024163204201FA63081552613A6308149260DA63081542607A630260306312D69
-S12331A0CE32761631B233323D36876A300436FB323D36A630270516326620F7323D363429
-S12331C016326D27FB810D27076A3016326620F0860A16326630323D810126054C011020F9
-S12331E00C810226054C012020034C01403D810126054D0110200C810226054D0120200341
-S12332004D01403D3686640440127A30021632391632391632391632394320EB323D368640
-S123322000816427127A30021632391632391632391632394220EA323D4C018036B6300216
-S123324004400616325C4320F74D01808664B0300204400616325C4320F7323D34FE30006F
-S12332600926FD30A73D4FCC80FC5ACF3D4FCC200396CF3D873D4572726F723A20556E6BD7
-S12332806E6F776E20436F6D6D616E640D0A0057656C636F6D6520746F205479706520576A
-S12332A072697465722C20796F75206D617920747970652062656C6F772E0D0A52657374D6
-S12332C061727420746F20656E746572206D61696E206D656E7520616761696E2E0D0A0063
-S12332E04C313A205475726E206F6E204C4544310D0A46313A205475726E206F6666204CCF
-S12333004544310D0A4C323A205475726E206F6E204C4544320D0A46323A205475726E2081
-S12333206F6666204C4544320D0A4C333A205475726E206F6E204C4544330D0A46333A207F
-S12333405475726E206F6666204C4544330D0A4C343A204C45443420676F65732066726F0E
-S12333606D203025206C69676874206C6576656C20746F2031303025206C69676874206C5A
-S12333806576656C20696E20302E34207365636F6E64730D0A46343A204C45443420676FDB
-S12333A065732066726F6D2031303025206C69676874206C6576656C20746F203025206C13
-S12333C069676874206C6576656C20696E20302E34207365636F6E64730D0A515549543AB9
-S12333E02051756974206D656E752070726F6772616D2C2072756E20547970652077726944
-S11234007465722070726F6772616D2E0D0A0011
+S118300000360500000000000000000000000000000000000F6D
+S1233100CF310086F15A03860C5ACBCC00015CC8CE32E81631B5CE3003FD30131631ACCE49
+S12331203003FD30131631C1CE300316314220E0CE32971631B516327527FB16326E5A0103
+S123314020F43637E630C1512740C14C261CA630E630264F8134270D80302F4781042443B0
+S12331601631E02044163226203FC1462635A630E630262F8134270D80302F278104242395
+S12331801631F6202416320C201FA63081552613A6308149260DA63081542607A630260388
+S12331A0063130CE327E1631B533323D36876A300436FB323D36A630270516326E20F73256
+S12331C03D36353416327527FB810D270A6A3016326E03270220ED860A16326E3031323DD2
+S12331E0810126054C0110200C810226054C012020034C01403D810126054D0110200C81D5
+S12332000226054D012020034D01403D3686640440127A300216324116324116324116321C
+S1233220414320EB323D368600816427127A30021632411632411632411632414220EA3264
+S12332403D4C018036B630020440061632644320F74D01808664B03002044006163264431F
+S123326020F7323D34FE30000926FD30A73D4FCC80FC5ACF3D4FCC200396CF3D873D4572CA
+S1233280726F723A20556E6B6E6F776E20436F6D6D616E640D0A0057656C636F6D65207437
+S12332A06F2054797065205772697465722C20796F75206D617920747970652062656C6F88
+S12332C0772E0D0A5265737461727420746F20656E746572206D61696E206D656E752061ED
+S12332E06761696E2E0D0A004C313A205475726E206F6E204C4544310D0A46313A20547592
+S1233300726E206F6666204C4544310D0A4C323A205475726E206F6E204C4544320D0A462F
+S1233320323A205475726E206F6666204C4544320D0A4C333A205475726E206F6E204C458B
+S123334044330D0A46333A205475726E206F6666204C4544330D0A4C343A204C45443420C2
+S1233360676F65732066726F6D203025206C69676874206C6576656C20746F203130302509
+S1233380206C69676874206C6576656C20696E20302E34207365636F6E64730D0A46343A36
+S12333A0204C45443420676F65732066726F6D2031303025206C69676874206C6576656CF8
+S12333C020746F203025206C69676874206C6576656C20696E20302E34207365636F6E64BC
+S12333E0730D0A515549543A2051756974206D656E752070726F6772616D2C2072756E2051
+S11A340054797065207772697465722070726F6772616D2E0D0A00F5
S9033100CB
diff --git a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt
index 1253cd2..f03dd86 100644
--- a/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt
+++ b/cmpen472hw5_McDonnell/cmpen472hw5_McDonnell_Data/Standard/TargetDataWindows.tdt
Binary files differ