User Tools

Site Tools


notes:comporg:spring2025:virconref

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:virconref [2025/02/27 16:10] – [CFB] wedgenotes:comporg:spring2025:virconref [2025/03/02 03:43] (current) – [GPU] tkastne1
Line 167: Line 167:
 ^  Type  ^  Port  ^  Name  ^  Description  | ^  Type  ^  Port  ^  Name  ^  Description  |
 |  OUT  |  0x200  |  GPU_Command  |  perform GPU operation  | |  OUT  |  0x200  |  GPU_Command  |  perform GPU operation  |
-|  ???   0x201  |  GPU_RemainingPixels  |  ???  |+|  IN   0x201  |  GPU_RemainingPixels  |  ???  | 
 +|  IN  |  0x202  |  GPU_ClearColor  |  obtain current clear color  |
 |  OUT  |  0x202  |  GPU_ClearColor  |  color to clear the screen with  | |  OUT  |  0x202  |  GPU_ClearColor  |  color to clear the screen with  |
-|  ???   0x203  |  GPU_MultiplyColor  |  ???  | +|  IN   0x203  |  GPU_MultiplyColor  |  obtain current color multiplier  | 
-|  ???   0x204  |  GPU_ActiveBlending  |  ???  |+|  OUT  |  0x203  |  GPU_MultiplyColor  |  color multiplier to draw sprites with  | 
 +|  IN  |  0x204  |  GPU_ActiveBlending  |  obtain current blending mode  | 
 +|  OUT   0x204  |  GPU_ActiveBlending  |  blending method to draw sprites with  |
 |  IN  |  0x204  |  GPU_SelectedTexture  |  obtain current selected texture  | |  IN  |  0x204  |  GPU_SelectedTexture  |  obtain current selected texture  |
 |  OUT  |  0x204  |  GPU_SelectedTexture  |  texture ID to select (-1 for BIOS)  | |  OUT  |  0x204  |  GPU_SelectedTexture  |  texture ID to select (-1 for BIOS)  |
 |  IN  |  0x205  |  GPU_SelectedRegion  |  obtain current selected region  | |  IN  |  0x205  |  GPU_SelectedRegion  |  obtain current selected region  |
 |  OUT  |  0x205  |  GPU_SelectedRegion  |  region ID to select  | |  OUT  |  0x205  |  GPU_SelectedRegion  |  region ID to select  |
 +|  IN  |  0x206  |  GPU_DrawingPointX  |  obtain X position to draw selected region  |
 |  OUT  |  0x206  |  GPU_DrawingPointX  |  set X position to draw selected region  | |  OUT  |  0x206  |  GPU_DrawingPointX  |  set X position to draw selected region  |
 +|  IN  |  0x207  |  GPU_DrawingPointY  |  obtain Y position to draw selected region  |
 |  OUT  |  0x207  |  GPU_DrawingPointY  |  set Y position to draw selected region  | |  OUT  |  0x207  |  GPU_DrawingPointY  |  set Y position to draw selected region  |
-|  ???   0x208  |  GPU_DrawingScaleX  |  sets X scaling with a float as input  | +|  IN  |  0x208  |  GPU_DrawingScaleX  |  obtain X scaling as a float  | 
-|  ???   0x209  |  GPU_DrawingScaleY  |  sets Y scaling with a float as input  | +|  OUT   0x208  |  GPU_DrawingScaleX  |  sets X scaling with a float as input  | 
-|  ???   0x20A  |  GPU_DrawingAngle  |  ???  |+|  IN  |  0x209  |  GPU_DrawingScaleY  |  obtain Y scaling as a float  | 
 +|  OUT   0x209  |  GPU_DrawingScaleY  |  sets Y scaling with a float as input  | 
 +|  IN   0x20A  |  GPU_DrawingAngle  |  obtain the sprite rotation as a float  | 
 +|  OUT  |  0x20A  |  GPU_DrawingAngle  |  sets the sprite rotation with a float as input  | 
 +|  IN  |  0x20B  |  GPU_RegionMinX  |  obtain Min X coordinate for region  |
 |  OUT  |  0x20B  |  GPU_RegionMinX  |  set Min X coordinate for region  | |  OUT  |  0x20B  |  GPU_RegionMinX  |  set Min X coordinate for region  |
 +|  IN  |  0x20C  |  GPU_RegionMinY  |  obtain Min Y coordinate for region  |
 |  OUT  |  0x20C  |  GPU_RegionMinY  |  set Min Y coordinate for region  | |  OUT  |  0x20C  |  GPU_RegionMinY  |  set Min Y coordinate for region  |
 +|  IN  |  0x20D  |  GPU_RegionMaxX  |  obtain Max X coordinate for region  |
 |  OUT  |  0x20D  |  GPU_RegionMaxX  |  set Max X coordinate for region  | |  OUT  |  0x20D  |  GPU_RegionMaxX  |  set Max X coordinate for region  |
 +|  IN  |  0x20E  |  GPU_RegionMaxY  |  obtain Max Y coordinate for region  |
 |  OUT  |  0x20E  |  GPU_RegionMaxY  |  set Max Y coordinate for region  | |  OUT  |  0x20E  |  GPU_RegionMaxY  |  set Max Y coordinate for region  |
 +|  IN  |  0x20F  |  GPU_RegionHotspotX  |  obtain region Hotspot X coordinate  |
 |  OUT  |  0x20F  |  GPU_RegionHotspotX  |  set region Hotspot X coordinate  | |  OUT  |  0x20F  |  GPU_RegionHotspotX  |  set region Hotspot X coordinate  |
 +|  IN  |  0x210  |  GPU_RegionHotspotY  |  obtain region Hotspot Y coordinate  |
 |  OUT  |  0x210  |  GPU_RegionHotspotY  |  set region Hotspot Y coordinate  | |  OUT  |  0x210  |  GPU_RegionHotspotY  |  set region Hotspot Y coordinate  |
                  
Line 361: Line 375:
 JF performs a jump only if its first operand is false, i.e. zero when taken as an integer. In that case its behavior is the same as an unconditional jump. Otherwise it has no effect. JF performs a jump only if its first operand is false, i.e. zero when taken as an integer. In that case its behavior is the same as an unconditional jump. Otherwise it has no effect.
  
-====IEQ==== +====Integer Comparisons====
-Integer Compare Equality: comparisons allow us typically to evaluate two values, in accordance with some relational operation, resulting in a true (1) or false (0) result. +
- +
-Should the first operand contain the same information as the second operand, the result will be true. Otherwise, false. +
- +
-===NOTE===+
 For the purposes of comparisons and conditional jumps on Vircon32: For the purposes of comparisons and conditional jumps on Vircon32:
  
Line 380: Line 389:
   * is greater than   * is greater than
   * is greater than or equal to   * is greater than or equal to
 +
 +====IEQ====
 +Integer Compare Equality: comparisons allow us typically to evaluate two values, in accordance with some relational operation, resulting in a true (1) or false (0) result.
 +
 +Should the first operand contain the same information as the second operand, the result will be true. Otherwise, false.
  
 ===Structure and variants=== ===Structure and variants===
Line 396: Line 410:
  
 Here, we test to see if the first operand is not equal to the second operand. If they are equal, the result is false, otherwise, not being equal yields a result of true. Here, we test to see if the first operand is not equal to the second operand. If they are equal, the result is false, otherwise, not being equal yields a result of true.
- 
-===NOTE=== 
-For the purposes of comparisons and conditional jumps on Vircon32: 
- 
-  * true is 1 (technically non-zero) 
-  * false is 0 
- 
-There are six relational operations: 
- 
-  * is equal to 
-  * is not equal to 
-  * is less than 
-  * is than or equal to 
-  * is greater than 
-  * is greater than or equal to 
  
 ===Structure and variants=== ===Structure and variants===
Line 427: Line 426:
  
 In this case, we are testing if the first operand is greater than the second operand. In this case, we are testing if the first operand is greater than the second operand.
- 
-===NOTE=== 
-For the purposes of comparisons and conditional jumps on Vircon32: 
- 
-  * true is 1 (technically non-zero) 
-  * false is 0 
- 
-There are six relational operations: 
- 
-  * is equal to 
-  * is not equal to 
-  * is less than 
-  * is than or equal to 
-  * is greater than 
-  * is greater than or equal to 
  
 ===Structure and variants=== ===Structure and variants===
Line 459: Line 443:
  
 In this case, we are testing if the first operand is greater than or equal to the second operand. In this case, we are testing if the first operand is greater than or equal to the second operand.
- 
-===NOTE=== 
-For the purposes of comparisons and conditional jumps on Vircon32: 
- 
-  * true is 1 (technically non-zero) 
-  * false is 0 
- 
-There are six relational operations: 
- 
-  * is equal to 
-  * is not equal to 
-  * is less than 
-  * is than or equal to 
-  * is greater than 
-  * is greater than or equal to 
  
 ===Structure and variants=== ===Structure and variants===
Line 490: Line 459:
  
 In this case, we are testing if the first operand is less than the second operand. In this case, we are testing if the first operand is less than the second operand.
- 
-===NOTE=== 
-For the purposes of comparisons and conditional jumps on Vircon32: 
- 
-  * true is 1 (technically non-zero) 
-  * false is 0 
- 
-There are six relational operations: 
- 
-  * is equal to 
-  * is not equal to 
-  * is less than 
-  * is than or equal to 
-  * is greater than 
-  * is greater than or equal to 
  
 ===Structure and variants=== ===Structure and variants===
Line 521: Line 475:
  
 In this case, we are testing if the first operand is less than or equal to the second operand. In this case, we are testing if the first operand is less than or equal to the second operand.
- 
-===NOTE=== 
-For the purposes of comparisons and conditional jumps on Vircon32: 
- 
-  * true is 1 (technically non-zero) 
-  * false is 0 
- 
-There are six relational operations: 
- 
-  * is equal to 
-  * is not equal to 
-  * is less than 
-  * is than or equal to 
-  * is greater than 
-  * is greater than or equal to 
  
 ===Structure and variants=== ===Structure and variants===
 ^  Variant  ^  Form  ^  Action  | ^  Variant  ^  Form  ^  Action  |
-|  1  |<nowiki>ILE DSTREG, ImmediateValue</nowiki>  |<nowiki>if (DSTREG <= ImmediateValue) DSTREG=1; else DSTREG=0;</nowiki>  | +|  1  |<code asm>ILE DSTREG, ImmediateValue</code>  |<code c>if (DSTREG <= ImmediateValue) 
-|  2  |<nowiki>ILE DSTREG, SRCREG</nowiki>  |<nowiki>if (DSTREG <= SRCREG) DSTREG=1; else DSTREG=0;</nowiki>  |+    DSTREG=1; 
 +else 
 +    DSTREG=0;</code>  | 
 +|  2  |<code asm>ILE DSTREG, SRCREG</code>  |<code c>if (DSTREG <= SRCREG) 
 +    DSTREG=1; 
 +else 
 +    DSTREG=0;</code>  |
  
 ===Description=== ===Description===
Line 570: Line 515:
 ===Structure and variants=== ===Structure and variants===
 ^  Variant  ^  Form  ^  Action  | ^  Variant  ^  Form  ^  Action  |
-|  1  |<nowiki>MOV DSTREG, ImmediateValue</nowiki>  |<nowiki>DSTREG = ImmediateValue;</nowiki>  | +|  1  |<code asm>MOV DSTREG, ImmediateValue</code>  |<code c>DSTREG = ImmediateValue;</code>  | 
-|  2  |<nowiki>MOV DSTREG, SRCREG</nowiki>  |<nowiki>DSTREG = SRCREG;</nowiki>  | +|  2  |<code asm>MOV DSTREG, SRCREG</code>  |<code c>DSTREG = SRCREG;</code>  | 
-|  3  |<nowiki>MOV DSTREG, [ImmediateValue]</nowiki>  |<nowiki>DSTREG = Memory[ImmediateValue];</nowiki>  | +|  3  |<code asm>MOV DSTREG, [ImmediateValue]</code>  |<code c>DSTREG = Memory[ImmediateValue];</code>  | 
-|  4  |<nowiki>MOV DSTREG, [SRCREG]</nowiki>  |<nowiki>DSTREG = Memory[SRCREG];</nowiki>  | +|  4  |<code asm>MOV DSTREG, [SRCREG]</code>  |<code c>DSTREG = Memory[SRCREG];</code>  | 
-|  5  |<nowiki>MOV DSTREG, [SRCREG+ImmediateValue]</nowiki>  |<nowiki>DSTREG = Memory[SRCREG+ImmediateValue];</nowiki>  | +|  5  |<code asm>MOV DSTREG, [SRCREG+ImmediateValue]</code>  |<code c>DSTREG = Memory[SRCREG+ImmediateValue];</code>  | 
-|  6  |<nowiki>MOV [ImmediateValue], SRCREG</nowiki>  |<nowiki>Memory[ImmediateValue] = SRCREG;</nowiki>  | +|  6  |<code asm>MOV [ImmediateValue], SRCREG</code>  |<code c>Memory[ImmediateValue] = SRCREG;</code>  | 
-|  7  |<nowiki>MOV [DSTREG], SRCREG</nowiki>  |<nowiki>Memory[DSTREG] = SRCREG;</nowiki>  | +|  7  |<code asm>MOV [DSTREG], SRCREG</code>  |<code c>Memory[DSTREG] = SRCREG;</code>  | 
-|  8  |<nowiki>MOV [DSTREG+ImmediateValue], SRCREG</nowiki>  |<nowiki>Memory[DSTREG+ImmediateValue] = SRCREG;</nowiki>  | +|  8  |<code asm>MOV [DSTREG+ImmediateValue], SRCREG</code>  |<code c>Memory[DSTREG+ImmediateValue] = SRCREG;</code>  |
- +
-===Processing actions=== +
- +
-==Register Destination== +
-  * Immediate: <code>Register1 = ImmediateValue</code> +
-  * Register: <code>Register1 = Register2</code> +
-  * Indirect with Immediate reference: <code>Register1 = Memory[ImmediateValue]</code> +
-  * Indirect with Register reference: <code>Register1 = Memory[Register2]</code> +
-  * Indirect Indexed with Register: <code>Register1 = Memory[Register2 + ImmediateValue]</code> +
- +
-==Memory Destination== +
-  * Indirect with Immediate reference: <code>Memory[ImmediateValue] = Register2</code> +
-  * Indirect with Register reference: <code>Memory[Register1] = Register2</code> +
-  * Indirect with Indexed reference: <code>Memory[Register1 + ImmediateValue] = Register2</code>+
  
 ===Description=== ===Description===
Line 601: Line 532:
  
 ^  Binary  ^  Destination  ^  Source  | ^  Binary  ^  Destination  ^  Source  |
-|  000  |  Register 1   Immediate Value  | +|  000  |  DSTREG   Immediate Value  | 
-|  001  |  Register 1  |  Register 2  | +|  001  |  DSTREG  |  SRCREG  | 
-|  010  |  Register 1   Memory <nowiki>[Immediate Value]</nowiki> +|  010  |  DSTREG   Memory <nowiki>[Immediate Value]</nowiki> 
-|  011  |  Register 1   Memory <nowiki>[Register 2]</nowiki> +|  011  |  DSTREG   Memory <nowiki>[SRCREG]</nowiki> 
-|  100  |  Register 1   Memory <nowiki>[Register 2 + Immediate Value]</nowiki> +|  100  |  DSTREG   Memory <nowiki>[SRCREG + Immediate Value]</nowiki> 
-|  101  |  <nowiki>Memory[Immediate Value]</nowiki>  |  Register 2  | +|  101  |  <nowiki>Memory[Immediate Value]</nowiki>  |  SRCREG  | 
-|  110  |  <nowiki>Memory[Register 1]</nowiki>  |  Register 2  | +|  110  |  <nowiki>Memory[DSTREG]</nowiki>  |  SRCREG  | 
-|  111  |  <nowiki>Memory[Register 1 + Immediate Value]</nowiki>  |  Register 2  |+|  111  |  <nowiki>Memory[DSTREG + Immediate Value]</nowiki>  |  SRCREG  |
  
 ====LEA==== ====LEA====
 Load Effective Address of a memory position. Load Effective Address of a memory position.
- 
-===Addressing=== 
-LEA, like other data-centric instructions, makes use of various addressing modes: 
- 
-  * **register**: source/destination is an inbuilt CPU register 
-  * **immediate**: some literal constant (be it data or a memory address) 
-  * **indirect**: value isn't the data, but a memory address to where the data is. Think pointer dereference. It comes in 3 varieties: 
-  * **indexed**: an offset to some existing piece of data. 
-      * **immediate**: a literal constant (data or memory address) 
-      * **indexed**: used with immediate/register, but we can do additional math to get an offset from the address. Think pointer dereference on an array. 
-      * **register**: a CPU register 
- 
-Indirect processing is accomplished with the **<nowiki>[ ]</nowiki>** (square brackets) surrounding the value we wish to dereference (we're not interested in the direct thing, but indirectly in what that thing contains). 
  
 ===Structure and variants=== ===Structure and variants===
Line 783: Line 701:
 ===Structure and variants=== ===Structure and variants===
 ^  Variant  ^  Form  ^  Action  | ^  Variant  ^  Form  ^  Action  |
-|  1  |<code asm>CIB DSTREG</code>  |<code c>if (DSTREG != 0) DSTREG = 1;</code>  |+|  1  |<code asm>CIB DSTREG</code>  |<code c>if (DSTREG != 0) 
 +    DSTREG = 1
 +else 
 +    DSTREG = 0;</code>  |
  
  
Line 797: Line 718:
 ^  Variant  ^  Form  ^  Action  | ^  Variant  ^  Form  ^  Action  |
 |  1  |<code asm>CFB DSTREG</code>  |<code c>if (DSTREG != 0.0) |  1  |<code asm>CFB DSTREG</code>  |<code c>if (DSTREG != 0.0)
-DSTREG = 1; else DSTREG = 0;</code>  |+    DSTREG = 1; 
 +else 
 +    DSTREG = 0;</code>  |
  
 ===Description=== ===Description===
Line 828: Line 751:
 ===Structure and variants=== ===Structure and variants===
 ^  Variant  ^  Form  ^  Action  | ^  Variant  ^  Form  ^  Action  |
-|  1  |<nowiki>AND DSTREG, ImmediateValue</nowiki>  |<nowiki>DSTREG = DSTREG & ImmediateValue;</nowiki>  | +|  1  |<code asm>AND DSTREG, ImmediateValue</code>  |<code c>DSTREG = DSTREG & ImmediateValue;</code>  | 
-|  2  |<nowiki>AND DSTREG, SRCREG</nowiki>  |<nowiki>DSTREG = DSTREG & SRCREG;</nowiki>  |+|  2  |<code asm>AND DSTREG, SRCREG</code>  |<code c>DSTREG = DSTREG & SRCREG;</code>  |
  
 ===Description=== ===Description===
Line 848: Line 771:
 ===Structure and variants=== ===Structure and variants===
 ^  Variant  ^  Form  ^  Action  | ^  Variant  ^  Form  ^  Action  |
-|  1  |<nowiki>OR DSTREG, ImmediateValue</nowiki>  |<nowiki>DSTREG = DSTREG | ImmediateValue;</nowiki>  | +|  1  |<code asm>OR DSTREG, ImmediateValue</code>  |<code c>DSTREG = DSTREG | ImmediateValue;</code>  | 
-|  2  |<nowiki>OR DSTREG, SRCREG</nowiki>  |<nowiki>DSTREG = DSTREG | SRCREG;</nowiki>  |+|  2  |<code asm>OR DSTREG, SRCREG</code>  |<code c>DSTREG = DSTREG | SRCREG;</code>  |
  
 ===Description=== ===Description===
-OR performs a **Bitwise iOR** between each pair of respective bits in the 2 specified +OR performs a **Bitwise INCLUSIVE OR** between each pair of respective bits in the 2 specified operands. The result is stored in the first of them, which is always a register.
-operands. The result is stored in the first of them, which is always a register.+
  
 ====XOR==== ====XOR====
Line 868: Line 790:
 ===Structure and variants=== ===Structure and variants===
 ^  Variant  ^  Form  ^  Action  | ^  Variant  ^  Form  ^  Action  |
-|  1  |<nowiki>XOR DSTREG, ImmediateValue</nowiki>  |<nowiki>DSTREG = DSTREG ^ ImmediateValue;</nowiki>  | +|  1  |<code asm>XOR DSTREG, ImmediateValue</code>  |<code c>DSTREG = DSTREG ^ ImmediateValue;</code>  | 
-|  2  |<nowiki>XOR DSTREG, SRCREG</nowiki>  |<nowiki>DSTREG = DSTREG ^ SRCREG;</nowiki>  |+|  2  |<code asm>XOR DSTREG, SRCREG</code>  |<code c>DSTREG = DSTREG ^ SRCREG;</code>  |
  
 ===Description=== ===Description===
Line 892: Line 814:
  
 ===Structure and variants=== ===Structure and variants===
-  * <code>(Variant 1): SHL { Register1 }ImmediateValue }</code> +^  Variant  ^  Form  ^  Action 
-  <code>(Variant 2): SHL { Register1 }, { Register2 }</code> +|  1  |<code asm>SHL DSTREG, ImmediateValue</code>  |<code c>DSTREG = DSTREG << ImmediateValue;</code>  | 
- + 2  |<code asm>SHL DSTREG, SRCREG</code>  |<code c>DSTREG DSTREG << SRCREG;</code>  |
-===Processing actions=== +
-  <code>(Variant 1): Register1 = Register1 << ImmediateValue</code> +
-  <code>(Variant 2): Register1 Register1 << Register2</code>+
  
 ===Description=== ===Description===
 SHL performs an bit shift to the left in the specified register. The second operand is SHL performs an bit shift to the left in the specified register. The second operand is
-taken as an integer number of positions to shift. Shifting 0 positions has no effect, while +taken as an integer number of positions to shift. 
-negative values result in shifting right. The shift type is logical: in shifts left, overflow is + 
-discarded and zeroes are introduced as least significant bits. In shifts right, underflow is +Shifting 0 positions has no effect, while negative values result in shifting right. 
-discarded and zeroes are introduced as most significant bits.+ 
 +The shift type is logical: in shifts left, overflow is discarded and zeroes are introduced as least significant bits. 
 + 
 +In shifts right, underflow is discarded and zeroes are introduced as most significant bits.
  
  
notes/comporg/spring2025/virconref.1740672622.txt.gz · Last modified: 2025/02/27 16:10 by wedge