@SpaceCat noice Fibonacci sequence you got there m8, really confusing kek.
I could post my last project from my college ASM course.
Actually yeah, why not (it's not like I agreed not to lol).
though it might be a little easy because it uses a pre-compiled library. All the information concerning the external library will be below the code block.
Also it isn't really, well obfuscated, any ASM coders would easily be able to pick it apart lol.
I left all the comments in because i can't be bothered to remove them. and due to the size of the code I decided to leave in any and all flavor text so you aren't completely lost (though at least try to make an effort to not use the comments as hinting to the algorithms at play kek.
Oh lastly, spoiler alert, it's a game, called Gunchy Dice... have fun trying to explain to me what it does lol (I honestly don't remember so i'll take your word for it)
Difficulty: it all depends on you bud.
I apologize for the cheesy jokes, and or references, and or puns contained in this mess...
.data
WelcomeQ:
.ascii "Welcome to the Daystar Casino,\nthe planet Ahakista's number one casino"
.ascii "\nwill you become ultimate champion of [current year]!?!\n"
.ascii "You'll never know if you don't try!\n\n"
.ascii "But first... How much cash you got in your wallet?! (bills only please):\n\0"
NoMonyz:
#How about you try coming in with a balance of $0, only to be rejected, what a shame.
.ascii "Get out... you're poor!\n\0"
Bal:
.ascii "\nYou have $\0 (in the pot, on the chopping block :)\n\0" #12
EnterBet:
.ascii "Enter your bet: $\0"
Dreamer:
.ascii "You.. haven't been paying much attention, or you're just really dumb.\n"
.ascii "Try again, and pay attention this time!\n\0"
You:
.ascii "You \0"
House:
.ascii "House \0"
Rolled:
.ascii "rolled both a \0"
RolledC:
.ascii " and a \0"
RolledF:
.ascii ", amassing a total of \0"
YouWin1:
.ascii "YOU WIN!\n\0"
YouWin2:
.ascii "I TOTALLY KNEW YOU COULD DO IT!\n\0"
YouWin3:
.ascii "WOOT! HOUSE SUCKS!\n\0"
HouseWin1:
.ascii "YOU LOSE!\n\0"
HouseWin2:
.ascii "YOU ARE REALLY UNFORTUNATE!\n\0"
HouseWin3:
.ascii "YOU SUCK!\n\0"
Broke:
.ascii "\nWell, You're Broke Sooo....\n\0"
Done1:
.ascii "\nYou're Done, Wasn't That Fun!?!\n\n\0"
Done2:
.ascii "\nYou're Finnish-- Uhh, I Mean Finished!\n\n\0"
Done3:
.ascii "\nYou've Been Fired From Your Old Job For Frivilous Spending Of Company Money!\n"
.ascii "Though If You Want... YOUR HIRED!\n\n\0"
NL:
.ascii "\n\0"
Dlr:
.ascii "$\0"
.text
.global _start
_start:
#Welcome and set balance
mov $WelcomeQ, %eax
call PrintStringC
mov $2, %ebx
call C
mov $Dlr, %eax
call PrintStringC
call ScanInt
call FC
cmp $0, %eax
jle NM #poor people check
mov %eax, %edx #EDX set to be running balance
Play:
mov $2, %ebx
call C
mov $Bal, %eax
call PrintStringC
mov %edx, %eax
call PrintInt
call FC
mov $12, %ebx
lea Bal(%ebx), %eax # Yeah, it's not recommended, but lea is so cool!
call PrintStringC
Redo: #Enter a possible bet, or face being berated by the game haha! :D
mov $2, %ebx
call C
mov $EnterBet, %eax
call PrintStringC
call ScanInt
cmp $0, %eax
jl DREM
cmp %eax, %edx
jge Correct
DREM:
call FC
mov $Dreamer, %eax
call PrintStringC
jmp Redo
Correct:
call FC
push %eax #store Bet
mov $NL, %eax
call PrintStringC
movl $0, %esi
#2 random rolls, player
Recycle:#recycled, 2 random rolls, house
inc %esi #1, then 2 and done.
mov $6, %eax
call Random
inc %eax
mov %eax, %ebx
mov $6, %eax
call Random
inc %eax
mov %eax, %ecx
#EBX = first roll, ECX = second roll.
cmp $2, %esi
je Second
mov $You, %eax
jmp First
Second:
mov $House, %eax
First:
call PrintStringC
mov $Rolled, %eax
call PrintStringC
call CC
mov %ebx, %eax
call PrintInt
call FC
mov $RolledC, %eax
call PrintStringC
call CC
mov %ecx, %eax
call PrintInt
call FC
mov $RolledF, %eax
call PrintStringC
call CC
add %ebx, %ecx
mov %ecx, %eax
call PrintInt
call FC
#EDI = Your total, eax = House total
cmp $2, %esi
je SV
mov %eax, %edi
jmp FV
SV:
push %eax #store House Total
FV:
mov $NL, %eax
call PrintStringC
cmp $1, %esi
je Recycle #No way am i writing this wall of text a second time!
#Now for the comparisons
pop %eax #pop house total
mov %edi, %ebx
cmp %ebx, %eax
jge HWin
pop %eax #pop bet
add %eax, %edx #add victory moneyz
# Winning
mov $3, %eax
call Random
cmp $1, %eax
jl Fw
jg Tw
#Second
mov $YouWin2, %eax
jmp SW
Fw:#first
mov $YouWin1, %eax
jmp SW
Tw:#third
mov $YouWin3, %eax
jmp SW
HWin:
pop %eax
sub %eax, %edx #sub victory moneyz
# Random Loser MSGS!
mov $3, %eax
call Random
cmp $1, %eax
jl F
jg T
#Second
mov $HouseWin2, %eax
jmp SW
F:#first
mov $HouseWin1, %eax
jmp SW
T:#third
mov $HouseWin3, %eax
SW: #skip to end of win block
call PrintStringC
cmp $0, %edx
jg Play
jmp End
NM: #Dialog for the true total losers...
mov $NoMonyz, %eax
jmp EP
End:
mov $Broke, %eax
call PrintStringC
mov $3, %eax
call Random
cmp $1, %eax
jl Frst
jg Thrd
#Second
mov $Done2, %eax
jmp EP
Frst:
mov $Done1, %eax
jmp EP
Thrd:
mov $Done3, %eax
EP:
call PrintStringC
call EndProgram
#Conditional Color
CC:
push %eax
cmp $1, %esi
je Y
mov $1, %eax
jmp H
Y:
mov $4, %eax
H:
call VTSetForeColor
pop %eax
RET
#Colors, Uses ECX
C:
push %eax
mov %ebx, %eax
call VTSetForeColor
pop %eax
RET
#Fix Colors
FC:
push %eax
mov $7, %eax
call VTSetForeColor
pop %eax
RET
Here's all that gud external library info that you may or may not need