Lab 3 solution
With the help of many classmates
and professor, I have finally came up with the full solution to lab 3.
My solution turn out to be very
long even after converting it into sudo code, I wanted to shorten it or think
of another solution, but since I spend too much time on it I must shift my
focus on other labs.
My method is function based, I wrap
each section of the code in function form and call them for each situations
The following are sudo codes with
the attempt to short the solution
Initialize settings:
Set display to zero zero
set 0 (LSD) to storage
set 0 (MSD) to storage
Loop-input:
check $ff (which is user input) for
+/- input
compare for + input
Jmp to + subroutine
compare for – input
Jmp to – subroutine
clear $ff
Infinite loop: Loop-input
Check/draw:
Cmp MSD with each of the 10 digites
and draw based on each compared
Cmp LSD with each of the 10 digites
and draw based on each compared
Return from subroutine
++:
Cmp LSD if 9
Jmp to +
Return from subroutine
Increment LSD
Set LSD to 0
Jmp to check/draw
Return from subroutine
|
--:
Cmp LSD if 0
Jmp to –
Return from subroutine
Decrement LSD
Set MSD to 0
Jmp to check/draw
Return from subroutine
|
+:
Cmp MSDif 9
Jmp to ++
Return from subroutine
Increment MSD
Jmp check/draw
Return from subroutine
|
-:
Cmp MSD if 0
Jmp to –
Return from subroutine
Decrement MSD
Jmp to check/draw
Return from subroutine
|
Digit 0-9
Create each of
10 single digits with DCB
Match each
with a storage number of its graphic represented
Comments
Post a Comment