User Tools

Site Tools


notes:comporg:spring2025:projects:dapx

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
notes:comporg:spring2025:projects:dapx [2025/03/09 15:42] – [debugmemory function] tkastne1notes:comporg:spring2025:projects:dapx [2025/03/20 03:15] (current) – [Debug Registers] tkastne1
Line 135: Line 135:
  
 <code> <code>
-   mov   R1,   0xF0000000  ; Creating the mask +mov   R1,   0xF0000000  ; Creating the mask 
-   and   R1,   R0          ; R0 is the original value+and   R1,   R0          ; R0 is the original value
 </code> </code>
  
Line 144: Line 144:
  
 <code> <code>
-   mov   R2,   R3          ; R3 is the loop count +mov   R2,   R3          ; R3 is the loop count 
-   imul  R2,   -4          ; Left shift bits per nibble+imul  R2,   -4          ; Left shift bits per nibble
  
-   mov   R1,   0xF0000000  ; Creating the mask +mov   R1,   0xF0000000  ; Creating the mask 
-   shl   R1,   R2+shl   R1,   R2
        
-   and   R1,   R0          ; R0 is the original value+and   R1,   R0          ; R0 is the original value
 </code> </code>
 ====Shifting==== ====Shifting====
Line 228: 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 'R' then the register number then ':' 
 + 
 +For registers 10-13 we print 'R' & '1' then the register number minus 10 then ':'
  
 ===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:
 +
 +<code>
 +mov   R0,   [BP - 1] ; Get the value of R0
 +push  R0
 +mov   R0,  Xpos
 +push  R0
 +mov   R0,  Ypos
 +push  R0
 +call  _debug         ; Print out the value of R0 wherever we want
 +</code>
 +
 +This process can be repeated for all registers
  
 ===Debugging our debugregs Subroutine=== ===Debugging our debugregs Subroutine===
notes/comporg/spring2025/projects/dapx.1741534976.txt.gz · Last modified: 2025/03/09 15:42 by tkastne1