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/04 04:28] – [Masking] tkastne1notes:comporg:spring2025:projects:dapx [2025/03/09 15:44] (current) – [Masking] Made asm code format consistent tkastne1
Line 46: Line 46:
 ====OR==== ====OR====
 ====AND==== ====AND====
 +The AND op code will do an and comparison of two values
 +<code>
 +mov  R0,  0x00F00000
 +mov  R1,  0x12689649
 +and  R0,  R1
 +</code>
 +This code will leave us with 0x00600000 because every other value was put into and with a zero.
 ====NOT==== ====NOT====
 ====NAND==== ====NAND====
Line 53: Line 60:
        
 ====SHIFT==== ====SHIFT====
-===Shift Right==== 
 ===Shift Left=== ===Shift Left===
 +A shift left can be done with the op code SHL
 +<code>
 +mov  R0,  0x00F00000
 +mov  R1,  4
 +shl  R0,  R1
 +</code>
 +This code will give R0 the value 0x0F000000 because the original value was left-shifted by 4 bits.
 +===Shift Right====
 +There isn't an op code provided by Vircon32 for right shifts, so we must shift left by a negative value.
 +<code>
 +mov  R0,  0x00F00000
 +mov  R1,  -4
 +shl  R0,  R1
 +</code>
 +This code will give R0 the value 0x000F0000 because we shifted the original value to the left by -4 bits.
 =====pseudocode===== =====pseudocode=====
  
Line 87: Line 108:
 ASCII code for 0 --> decimal 48, hexadecimal 0x30 ASCII code for 0 --> decimal 48, hexadecimal 0x30
 ASCII code for x --> 120 ASCII code for x --> 120
-ASCII code for [ --> 92+ASCII code for [ --> 91
 ASCII code for ] --> 93 ASCII code for ] --> 93
 ASCII code for : --> 58 ASCII code for : --> 58
Line 114: 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 123: Line 144:
  
 <code> <code>
-   mov   R2,   R3          ; R3 is the loop count +mov   R2,   R3          ; R3 is the loop count 
-   imux  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 138: 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]:value
 +
 +We can print the brackets and colon manually and leave the address and values to the debug function
 +
 +<code>
 +mov   R3,         91          ;ASCII code for '['
 +out   GPUREGION,  R3
 +mov   R3,                   ;Xpos
 +out   XDRAWINGP,  R5
 +out   GPUCOMMAND, DRAWREGION  ;Draw
 +</code>
 +
 +Repeat this for ']' and ':' changing the Xpos and accounting for the address width
 +
 +Utilize the debug function to print the address and value as shown in the following
 +
 +<code>
 +push  R2                      ;R2 is the current address
 +mov   R3,         10          ;Xpos
 +push  R3
 +push  R4                      ;Ypos
 +call  _debug
 +
 +mov   R3,         [R2]        ;Get the value
 +push  R3
 +mov   R3,         130         ;Xpos
 +push  R3
 +push  R4                      ;Ypos
 +call  _debug
 +</code>
 +
 +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===
 +<code>
 +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
 +   DISPLAY THE ADDRESS AND VALUE
 +   INCREMENT THE YPOS
 +   INCREMENT THE ADDRESS
 +REPEAT
 +</code>
 ======debugregister function====== ======debugregister function======
 =====dapX imagery=====  =====dapX imagery===== 
Line 148: Line 217:
 {{:notes:comporg:spring2024:projects:3.jpg?400|}} {{:notes:comporg:spring2024:projects:3.jpg?400|}}
 {{:notes:comporg:spring2024:projects:4.jpg?400|}} {{:notes:comporg:spring2024:projects:4.jpg?400|}}
 +
 +====dap1====
 +{{:notes:comporg:spring2024:projects:3.jpg?400|}}
 +{{:notes:comporg:spring2024:projects:4.jpg?400|}}
 +
 +====dap2====
 +{{:notes:comporg:spring2024:projects:5.jpg?400|}}
 +{{:notes:comporg:spring2024:projects:6.jpg?400|}}
  
 ======Debug Registers====== ======Debug Registers======
notes/comporg/spring2025/projects/dapx.1741062529.txt.gz · Last modified: 2025/03/04 04:28 by tkastne1