mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2024-11-22 21:52:31 +03:00
chore(mips.html.markdown): Fixed formatting of comments
This commit is contained in:
parent
4c025bc12b
commit
6f32ec9859
@ -68,27 +68,27 @@ hello_world .asciiz "Hello World\n" # Declare a null terminated string
|
||||
lw $t0, num # From the data section
|
||||
li $t0, 5 # Or from an immediate (constant)
|
||||
li $t1, 6
|
||||
add $t2, $t0, $t1 # $t2 = $t0 + $t1
|
||||
sub $t2, $t0, $t1 # $t2 = $t0 - $t1
|
||||
mul $t2, $t0, $t1 # $t2 = $t0 * $t1
|
||||
div $t2, $t0, $t1 # $t2 = $t0 / $t1 (Might not be supported in some versons of MARS)
|
||||
div $t0, $t1 # Performs $t0 / $t1. Get the quotient using 'mflo' and remainder using 'mfhi'
|
||||
add $t2, $t0, $t1 # $t2 = $t0 + $t1
|
||||
sub $t2, $t0, $t1 # $t2 = $t0 - $t1
|
||||
mul $t2, $t0, $t1 # $t2 = $t0 * $t1
|
||||
div $t2, $t0, $t1 # $t2 = $t0 / $t1 (Might not be supported in some versons of MARS)
|
||||
div $t0, $t1 # Performs $t0 / $t1. Get the quotient using 'mflo' and remainder using 'mfhi'
|
||||
|
||||
# Bitwise Shifting
|
||||
sll $t0, $t0, 2 # Bitwise shift to the left with immediate (constant value) of 2
|
||||
sllv $t0, $t1, $t2 # Shift left by a variable amount in register
|
||||
srl $t0, $t0, 5 # Bitwise shift to the right (does not sign preserve, sign-extends with 0)
|
||||
srlv $t0, $t1, $t2 # Shift right by a variable amount in a register
|
||||
sra $t0, $t0, 7 # Bitwise arithmetic shift to the right (preserves sign)
|
||||
srav $t0, $t1, $t2 # Shift right by a variable amount in a register
|
||||
sll $t0, $t0, 2 # Bitwise shift to the left with immediate (constant value) of 2
|
||||
sllv $t0, $t1, $t2 # Shift left by a variable amount in register
|
||||
srl $t0, $t0, 5 # Bitwise shift to the right (does not sign preserve, sign-extends with 0)
|
||||
srlv $t0, $t1, $t2 # Shift right by a variable amount in a register
|
||||
sra $t0, $t0, 7 # Bitwise arithmetic shift to the right (preserves sign)
|
||||
srav $t0, $t1, $t2 # Shift right by a variable amount in a register
|
||||
|
||||
# Bitwise operators
|
||||
and $t0, $t1, $t2 # Bitwise AND
|
||||
andi $t0, $t1, 0xFFF # Bitwise AND with immediate
|
||||
or $t0, $t1, $t2 # Bitwise OR
|
||||
ori $t0, $t1, 0xFFF # Bitwise OR with immediate
|
||||
xor $t0, $t1, $t2 # Bitwise XOR
|
||||
xori $t0, $t1, 0xFFF # Bitwise XOR with immediate
|
||||
nor $t0, $t1, $t2 # Bitwise NOR
|
||||
and $t0, $t1, $t2 # Bitwise AND
|
||||
andi $t0, $t1, 0xFFF # Bitwise AND with immediate
|
||||
or $t0, $t1, $t2 # Bitwise OR
|
||||
ori $t0, $t1, 0xFFF # Bitwise OR with immediate
|
||||
xor $t0, $t1, $t2 # Bitwise XOR
|
||||
xori $t0, $t1, 0xFFF # Bitwise XOR with immediate
|
||||
nor $t0, $t1, $t2 # Bitwise NOR
|
||||
|
||||
```
|
Loading…
Reference in New Issue
Block a user