This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
notes:comporg:spring2024:projects:dapx [2024/03/22 14:15] – [Debug Registers] jwieland | notes:comporg:spring2024:projects:dapx [2024/03/24 23:49] (current) – [Debug Registers] wgates1 | ||
---|---|---|---|
Line 405: | Line 405: | ||
</ | </ | ||
- | To print out the number in the middle, we first need to check if the number is greater than 10. If it is then we print out a 1 then the second value, this wouldn' | + | To print out the number in the middle, we first need to check if the number is greater than 10. If it is then we print out a 1 then subtract 10 from it, this is so we can do a ascii shift with the second number that changes |
<code asm> | <code asm> | ||
Line 425: | Line 425: | ||
_less_than_10: | _less_than_10: | ||
- | iadd R1, 48 | + | iadd R1, 48 ;ascii shift by 48 to print out the number |
out GPU_SelectedRegion, | out GPU_SelectedRegion, | ||
out GPU_DrawingPointX, | out GPU_DrawingPointX, | ||
Line 435: | Line 435: | ||
===Printing registers=== | ===Printing registers=== | ||
+ | |||
+ | ===Debugging our debugregs Subroutine=== | ||
+ | Trying to get your debugregs to have the correct output is challenging, | ||
+ | |||
+ | <code asm> | ||
+ | mov R0, 0x00000000 | ||
+ | mov R1, 0x00000001 | ||
+ | mov R2, 0x00000002 | ||
+ | mov R3, 0x00000003 | ||
+ | mov R4, 0x00000004 | ||
+ | mov R5, 0x00000005 | ||
+ | </ | ||
+ | |||
+ | You repeat this above process for registers from 0 to 13. It is important to note that you do this right before you call the subroutine so the values that you just put in don't get wiped out from your previous ASM code. | ||
+ | |||
+ | |||
+ | |||
+ | ===Calling debugregs=== | ||
+ | As we have worked on these dap projects, the process of calling such debug subroutines has become simpler. With dap0, we had to have the following in our program: | ||
+ | <code asm> | ||
+ | | ||
+ | push TMP | ||
+ | | ||
+ | push TMP | ||
+ | | ||
+ | push TMP | ||
+ | | ||
+ | </ | ||
+ | Then later after the hlt, you'll always have the %include " | ||
+ | |||
+ | Concerning dap2, we have drastically simplified the process of debugging. All that is need is just one line, Not accounting for the include line. Put the following to use your debug registers subroutine: | ||
+ | |||
+ | <code asm> | ||
+ | call _debugregs | ||
+ | </ |