Skip to content

Instantly share code, notes, and snippets.

View tremblerz's full-sized avatar
💭
I may be slow to respond.

Abhishek Singh tremblerz

💭
I may be slow to respond.
View GitHub Profile
@tremblerz
tremblerz / 3.asm
Created February 11, 2016 19:20 — forked from voter101/3.asm
Mips exercise 3
main:
addi $t7, $zero, 128
li $v0, 13
la $a0, filename
li $a1, 0
li $a2, 0
syscall
addi $s0, $v0, 0
readFromFile:
# print_msg function takes three arguments and is equivalent to
# snprintf(“Move disk %d from %d to %d.”, $a0, $a1, $a2);
hanoi:
slti $t0, $a0, 2
bne $t0, $0, caseOne
addiu $sp, $sp, -20
sw $a0, 0($sp)
sw $a1, 4($sp)
@tremblerz
tremblerz / guess.asm
Created February 11, 2016 19:15 — forked from charlesrubach/guess.asm
Guessing game in MIPS
.include "macros.asm"
.data
# arrays
variables: .space 16 # [random number][low][high][guesses]
range: .byte 100 # Set the range [0 t0 range]
# Constant strings
guess1: .asciiz "Guess a number between "
guess2: .asciiz " and "
@tremblerz
tremblerz / bubblesort.mips.s
Created February 11, 2016 19:14 — forked from manudatta/bubblesort.mips.s
Bubble sort in MIPS assembly.
# Copyright 2002 Manu Datta (gmail.com ID Manu dot Datta)
# All rights reserved
.data
msg1: .asciiz "\nEnter integer values followed by return (-1 terminates input): \n"
msg2: .asciiz ","
msg3: .asciiz "Bubble Sort"
msg4: .asciiz "#########pass#########"
msg5: .asciiz "\n"
msg6: .asciiz "\nNumber list has been sorted\n"
@tremblerz
tremblerz / prime_numbers.asm
Created February 11, 2016 19:14 — forked from Nicotico/prime_numbers.asm
verifica numeri primi in MIPS
.data
.text
.globl main
main:
#li $v0, 5
#syscall
move $a0, $v0 #sposto l'intero in a0
@tremblerz
tremblerz / palindrome.asm
Created February 11, 2016 19:14 — forked from computercolin/palindrome.asm
Palindrome Checking Algorithm in MIPS assembly
# Joseph Meyer
# Colin Zwiebel
# 3 Oct 2011
# Palindrome
# Recursive implimentation of Palindrome checking algorithm
.data
input: .asciiz "racecar"
input_len: .word 7
@tremblerz
tremblerz / gist:ba49bd7a320c4597df40
Created February 11, 2016 19:14 — forked from MicBrain/gist:679724000d4bb87663aa
Recursive Method of Fibonacci numbers in MIPS
.text
main:
li $a0, 5
jal fib
move $a0, $v0
jal print_int
jal print_newline
fib:
addiu $sp, $sp, -12
@tremblerz
tremblerz / fparray.s
Created February 11, 2016 19:13 — forked from vaskaloidis/fparray.s
Mips Single Precision Floating Point Unit (FPU) Array
.data
break: .asciiz "\n"
ask: .asciiz "Please enter a random 4 digit number for a seed: "
input: .float 4
list : .word 100
@tremblerz
tremblerz / mergesort.asm
Created February 11, 2016 19:13 — forked from jmc734/mergesort.asm
Merge Sorting an Indirect Array in MIPS Assembly
.text
la $a0, info # Load the start address of the array
lw $t0, length # Load the array length
sll $t0, $t0, 2 # Multiple the array length by 4 (the size of the elements)
add $a1, $a0, $t0 # Calculate the array end address
jal mergesort # Call the merge sort function
b sortend # We are finished sorting
##
@tremblerz
tremblerz / str.asm
Created February 11, 2016 19:12 — forked from montycheese/str.asm
map a char freq in MIPS assembly lang
.data
str1: .asciiz "Enter String: "
#.align 2
getc: .asciiz "Enter char: "
#.align 2
ret: .asciiz "Character <ch> occurs in string <string> <n> times"
buffer: .space 100 #space to store our string
L1: .space 2 #space for our char
L2: .space 4 #space for our char’s frequency in string