|
|
02-08-2011, 03:21 AM
|
#1
|
Yank me.
In-Game Name: -quit-
Current Level: -quit-
Server: Teva
Posts: 1,503
|
So FF is back online!
|
|
|
02-08-2011, 04:24 AM
|
#2
|
O(≧∇≦)O ~♪
In-Game Name: yufu,Vangel
Current Level: 61, 26
Server: West
Posts: 1,814
|
withdrawal symptoms were imminent.
__________________
Quote:
|
96:What's 『マジか』?
97: >>96 are you serious?
98:Yes, I am.
99:that was an answer, not a question
|
Dragon Nest
IGN: leafie, Xiol
Class: Acrobat, Mystic
Guild: Duality
Server: Velskud (West)
|
|
|
02-08-2011, 03:03 PM
|
#7
|
DFO has my heart <3
Tournaments Won: 1
In-Game Name: Yuki ^o^
Current Level: Yuki ^o^
Server: Yuki ^o^
Posts: 2,215
|
Bela was slamming his head on F5 all day long.
|
|
|
02-08-2011, 07:53 PM
|
#8
|
Super Moderator
In-Game Name: Espei
Posts: 8,305
|
Originally Posted by Rightclaw
|
Bela was slamming his head on F5 all day long.
|
Lol
|
|
|
02-08-2011, 08:33 PM
|
#9
|
Yank me.
In-Game Name: -quit-
Current Level: -quit-
Server: Teva
Posts: 1,503
|
Hmm, the server went offline several times during the day. Just curious...
Besides, if you had to choose between assemply programming and surfing FF, the choice would be obvious. Here's some assemply coding to show you what I mean.
The main program:
Quote:
|
.globl Fraction
.globl getNumerator
.globl getDenominator
.globl adding
.globl setNumerator
.globl setDenominator
.text
Fraction:
#--------------------------------------------
add "$"t0, "$"0, "$"a0 # t0 = numerator
add "$"t1, "$"0, "$"a1 # t1 = denominator
x: addi "$"v0, "$"0, 9 # service #9 - specify num of bytes in "$"a0
addi "$"a0, "$"0, 8 # a0 = 8(block of bytes to be allocated in the heap)
syscall
sw "$"t0, 0("$"v0) # store t0 (num) at v0 (starting address)
sw "$"t1, 4("$"v0) # store t1 (denom) at 4 bytes down from v0 (starting address in mem)
jr "$"ra
# store the attributes somewhere in memory and
# return a reference to where they are
getNumerator:
#---------------------------------------------
lw "$"v0, 0("$"a0)
jr "$"ra
# retrieve the numerator of this
# fraction and return it in "$"v0
getDenominator:
#---------------------------------------------
lw "$"v0, 4("$"a0)
jr "$"ra
# retrieve the numerator of this
# fraction and return it in "$"v0
adding:
#---------------------------------------------
lw "$"t0, 0("$"a0) # numerator first fraction
lw "$"t1, 4("$"a0) # denominator first fraction
lw "$"t2, 0("$"a1) # numerator second fraction
lw "$"t3, 4("$"a1) # denominator second fraction
mult "$"t0, "$"t3
mflo "$"t0
mult "$"t1, "$"t2
mflo "$"t2
add "$"t0, "$"t0, "$"t2
mult "$"t1, "$"t3
mflo "$"t1
j x
setNumerator:
#---------------------------------------------
add "$"t0, "$"0, "$"a0 # t0 = numerator
sw "$"t0, 0("$"v0) # store t0 (num) at v0 (starting address)
jr "$"ra
#---------------------------------------------
setDenominator:
#---------------------------------------------
add "$"t1, "$"0, "$"a1 # t0 = numerator
sw "$"t1, 4("$"v0) # store t0 (num) at 4 bytes down v0 (starting address)
jr "$"ra
#---------------------------------------------
|
And the client:
Quote:
|
.text
#-----------------------------------------------
main: sw "$"ra, 0("$"sp) # store ra(return address) in sp(Stack Pointer)
addi "$"sp, "$"sp, -4 # decrement stack pointer by 4 bytes
addi "$"a0, "$"0, 3 # a0 = 3 (argument0)
addi "$"a1, "$"0, 8 # a1 = 8 (argument1)
jal Fraction # jump and link to Fraction
add "$"s0, "$"0, "$"v0 # s0 holds address stored in v0 (3/8)
addi "$"a0, "$"0, 1 # a0 = 1 (argument0)
addi "$"a1, "$"0, 2 # a1 = 2 (argument1)
jal Fraction
add "$"s1, "$"0, "$"v0 # s1 holds address stored in v0 (1/2)
add "$"a0, "$"0, "$"s0
add "$"a1, "$"0, "$"s1
jal adding
add "$"s2, "$"0, "$"v0
#-----------------
add "$"a0, "$"0, "$"s0
jal getNumerator
add "$"a0, "$"0, "$"v0 # store the numerator from v0 in "$"a0 (temp)
addi "$"v0, "$"0, 1
syscall
addi "$"v0, "$"0, 11
addi "$"a0, "$"0, '/'
syscall
add "$"a0, "$"0, "$"s0
jal getDenominator
add "$"a0, "$"0, "$"v0
addi "$"v0, "$"0, 1
syscall
#------------------
addi "$"v0, "$"0, 11
addi "$"a0, "$"0, 10
syscall
#------------------
add "$"a0, "$"0, "$"s1
jal getNumerator
add "$"a0, "$"0, "$"v0 # store the numerator from v0 in "$"a0 (temp)
addi "$"v0, "$"0, 1
syscall
addi "$"v0, "$"0, 11
addi "$"a0, "$"0, '/'
syscall
add "$"a0, "$"0, "$"s1
jal getDenominator
add "$"a0, "$"0, "$"v0
addi "$"v0, "$"0, 1
syscall
#------------------
addi "$"v0, "$"0, 11
addi "$"a0, "$"0, 10
syscall
#------------------
add "$"a0, "$"0, "$"s2
jal getNumerator
add "$"a0, "$"0, "$"v0 # store the numerator from v0 in "$"a0 (temp)
addi "$"v0, "$"0, 1
syscall
addi "$"v0, "$"0, 11
addi "$"a0, "$"0, '/'
syscall
add "$"a0, "$"0, "$"s2
jal getDenominator
add "$"a0, "$"0, "$"v0
addi "$"v0, "$"0, 1
syscall
#------------------
add "$"v0, "$"0, "$"s1
addi "$"a0, "$"0, 7 # a0 = 7 (argument0)
addi "$"a1, "$"0, 9 # a1 = 9 (argument1)
jal setNumerator
jal setDenominator
#------------------
addi "$"v0, "$"0, 11
addi "$"a0, "$"0, 10
syscall
#------------------
add "$"a0, "$"0, "$"s1
jal getNumerator
add "$"a0, "$"0, "$"v0 # store the numerator from v0 in "$"a0 (temp)
addi "$"v0, "$"0, 1
syscall
addi "$"v0, "$"0, 11
addi "$"a0, "$"0, '/'
syscall
add "$"a0, "$"0, "$"s1
jal getDenominator
add "$"a0, "$"0, "$"v0
addi "$"v0, "$"0, 1
syscall
#------------------
addi "$"sp, "$"sp, 4
lw "$"ra, 0("$"sp)
jr "$"ra
|
All this does is print:
3/8
1/2
14/16
7/9
....No really.
EDIT: Had to to put "" around dollar signs, otherwise variables wouldn't parse properly.
Last edited by Belaslav; 02-08-2011 at 08:43 PM..
|
|
|
02-08-2011, 10:31 PM
|
#10
|
Blaaaaaah 2 u 2
In-Game Name: Hraesvelg
Current Level: 6X
Server: Teva
Posts: 1,960
|
Ugh. I hated assembly.
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT. The time now is 07:18 AM.
Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.
Powered by vBulletin® Version 3.8.6 Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
| |
| |