started solving
This commit is contained in:
+69
-1
@@ -47,18 +47,43 @@ main PROC
|
||||
read_dipsw ; Read operands into R0 and R1 and display on LEDs
|
||||
; STUDENTS: To be programmed
|
||||
|
||||
LDR R0, =ADDR_DIP_SWITCH_15_0
|
||||
LDRH R0, [R0] ; Load Values of DIP Switches 15-0 in R0
|
||||
|
||||
LDR R2, =ADDR_LED_15_0
|
||||
STRH R0, [R2] ; Display R0 on LEDs 15-0
|
||||
|
||||
MOVS R1, R0 ; Coppy Bits to R1
|
||||
LSRS R0, R0, #8 ; Shift Bits in R0 right to only have DIP SWITCH 15-8
|
||||
LDR R2, =0xff ; Bitmask to get only lower Byte
|
||||
ANDS R1, R1, R2 ; Only keep lower Byte in R1
|
||||
|
||||
LDR R2, =ADDR_LED_15_0
|
||||
STRH R0, [R2]
|
||||
|
||||
; END: To be programmed
|
||||
|
||||
read_hexsw ; Read operation into R2 and display on 7seg.
|
||||
; STUDENTS: To be programmed
|
||||
|
||||
LDR R2, =ADDR_HEX_SWITCH
|
||||
LDRB R2, [R2]
|
||||
|
||||
LDR R3, =ADDR_7_SEG_BIN_DS1_0
|
||||
STRB R2, [R3]
|
||||
|
||||
; END: To be programmed
|
||||
|
||||
case_switch ; Implement switch statement as shown on lecture slide
|
||||
; STUDENTS: To be programmed
|
||||
|
||||
|
||||
LDR R3, =0x0a
|
||||
CMP R2, R3
|
||||
BHI case_bright
|
||||
|
||||
LDR R3, =jump_table ; Get Address of Jumptable
|
||||
LDRB R3, [R3, R2] ; Load Label Address from J
|
||||
BX R3 ; GOTO Speified label
|
||||
|
||||
; END: To be programmed
|
||||
|
||||
@@ -78,6 +103,49 @@ case_add
|
||||
|
||||
; STUDENTS: To be programmed
|
||||
|
||||
case_bright
|
||||
LDR R0, =0xFFFF
|
||||
B display_result
|
||||
|
||||
case_sub
|
||||
SUBS R0, R0, R1
|
||||
B display_result
|
||||
|
||||
case_mult
|
||||
MULS R0, R1, R0
|
||||
B display_result
|
||||
|
||||
case_and
|
||||
ANDS R0, R0, R1
|
||||
B display_result
|
||||
|
||||
case_or
|
||||
ORRS R0, R0, R1
|
||||
B display_result
|
||||
|
||||
case_xor
|
||||
EORS R0, R0, R1
|
||||
B display_result
|
||||
|
||||
case_not
|
||||
MVNS R0, R0
|
||||
B display_result
|
||||
|
||||
case_nand
|
||||
ANDS R0, R0, R1
|
||||
MVNS R0, R0
|
||||
B display_result
|
||||
|
||||
case_nor
|
||||
ORRS R0, R0, R1
|
||||
MVNS R0, R0
|
||||
B display_result
|
||||
|
||||
case_xnor
|
||||
EORS R0, R0, R1
|
||||
MVNS R0, R0
|
||||
B display_result
|
||||
|
||||
|
||||
; END: To be programmed
|
||||
|
||||
|
||||
Reference in New Issue
Block a user