This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:comporg:spring2025:projects:dapx [2025/03/07 19:55] – Fixed ASCII code for '[' tkastne1 | notes:comporg:spring2025:projects:dapx [2025/03/20 03:15] (current) – [Debug Registers] tkastne1 | ||
---|---|---|---|
Line 135: | Line 135: | ||
< | < | ||
- | mov | + | mov |
- | | + | and |
</ | </ | ||
Line 144: | Line 144: | ||
< | < | ||
- | mov | + | mov |
- | | + | imul R2, |
- | mov | + | mov |
- | | + | shl |
- | and | + | and |
</ | </ | ||
====Shifting==== | ====Shifting==== | ||
Line 159: | Line 159: | ||
===Displaying=== | ===Displaying=== | ||
+ | Because we already have the debug function, we can use that to display all of the hex values needed | ||
+ | |||
+ | The format is identical for every address, and goes as the following: [address]: | ||
+ | |||
+ | We can print the brackets and colon manually and leave the address and values to the debug function | ||
+ | |||
+ | < | ||
+ | mov | ||
+ | out | ||
+ | mov | ||
+ | out | ||
+ | out | ||
+ | </ | ||
+ | |||
+ | Repeat this for ' | ||
+ | |||
+ | Utilize the debug function to print the address and value as shown in the following | ||
+ | |||
+ | < | ||
+ | push R2 ;R2 is the current address | ||
+ | mov | ||
+ | push R3 | ||
+ | push R4 ;Ypos | ||
+ | call _debug | ||
+ | |||
+ | mov | ||
+ | push R3 | ||
+ | mov | ||
+ | push R3 | ||
+ | push R4 ;Ypos | ||
+ | call _debug | ||
+ | </ | ||
+ | |||
+ | All of this code should be run for every address, stepping from the start value to the end value | ||
+ | |||
+ | We will need to setup a loop with an exit condition | ||
+ | |||
+ | ===pseudocode=== | ||
+ | < | ||
+ | MOVE THE STARTING ADDRESS INTO A DEDICATED REGISTER (current address) | ||
+ | UNTIL WE HAVE PASSED THE FINAL ADDRESS: | ||
+ | TEST IF THE CURRENT ADDRESS IS GREATER THAN THE FINAL ADDRESS | ||
+ | SHOULD IT BE GREATER SKIP TO AFTER THIS LOOP | ||
+ | | ||
+ | | ||
+ | | ||
+ | REPEAT | ||
+ | </ | ||
======debugregister function====== | ======debugregister function====== | ||
=====dapX imagery===== | =====dapX imagery===== | ||
Line 180: | Line 228: | ||
======Debug Registers====== | ======Debug Registers====== | ||
- | ===Printing out R:=== | + | ===Printing out R#:=== |
+ | The simplest way to print out the register label would be to separate the singe and double digit registers into to groups | ||
+ | |||
+ | For registers 0-9 we print ' | ||
+ | |||
+ | For registers 10-13 we print ' | ||
===Printing registers=== | ===Printing registers=== | ||
+ | |||
+ | Since we want to preserve all of the register values, we push them onto the stack at the start | ||
+ | |||
+ | Using this we can get the value for each register to print out | ||
+ | |||
+ | Assuming we push the register 0-13 directly after saving the base pointer we can do the following to get R0: | ||
+ | |||
+ | < | ||
+ | mov | ||
+ | push R0 | ||
+ | mov | ||
+ | push R0 | ||
+ | mov | ||
+ | push R0 | ||
+ | call _debug | ||
+ | </ | ||
+ | |||
+ | This process can be repeated for all registers | ||
===Debugging our debugregs Subroutine=== | ===Debugging our debugregs Subroutine=== |