SubmenuAdvertiseWallpapersSubmit News




 


Log in Problems?
New User? Sign Up!

Dopewars for the ATMEGA8!!!

Newsimage Posted by k0balt on Friday, November 06, 2009

Ok, I know you've all been dying to play dopewars on your M8 chips, so here it is.

Set it up for 8mhz, standard Uart to port d0 and d1, and pull reset high with a resistor or something. Written in Bascom AVR, it uses almost all of the 8k codespace.

Here is the bascom source, ill try to upload the hex file to my profile somehow, or if you email me ill send it to you. cliff(dot)smyth(at)gmail(dot)com

set it up with some kind of 19200 baud hello world to check your setup, upload, and play.

It is alittle quirky and has some minor bugs, but seems to be completely playable.



-----------------

'--------------------------------------------------------------
' mega8 dopewars
' CT Smyth
'--------------------------------------------------------------
$regfile = "m8def.dat"
$crystal = 8000000
'the internal oscillator of 8 Mhz was choosen in the fusebits
$baud = 19200
Dim A As String * 5
Dim Days As Single
Dim Money As Single
'Dim Health As Single
Dim Jacket As Single
Dim Jacketcap As Single
Dim Rand As Integer
'Dim Gun As Bit
Dim Debt As Single
Dim Scratch As Single
Dim Weed As Single
Dim Acid As Single
Dim Speed As Single
Dim Cocaine As Single
Dim Weedp As Single
Dim Acidp As Single
Dim Speedp As Single
Dim Cocainep As Single
Dim Message As String * 60
Dim Price As Single
Dim Temp As Single
Dim Temp2 As Single
Dim T As Single
Dim Tt As Single
Dim ___rseed As Word


Getseed:
Print
Print "Press any key to start..."
Do
T = T + 1
If T > 253 Then T = 1
'could use a port input here too?
If Inkey() > 0 Then Goto Gotseed
Loop

Gotseed:
___rseed = T

Money = 2000
Debt = 2000
'Health = 100
Jacketcap = 100
Jacket = 0
For T = 1 To 10
Print
Next T


Mainprog:

For Days = 1 To 30

'weed price calculator'

Weedp = 400

Rand = Rnd(200) - 100

Weedp = Weedp + Rand

If Rand < 93 Then Goto Skip1
Message = "Stoners are paying crazy money for weed!"
Gosub Skyhi
Weedp = Weedp * Rand
Skip1:
If Rand > -97 Then Goto Skip2
Message = "Homegrown hash floods the market!"
Gosub Skyhi
Weedp = Weedp / Rand
Skip2:

'Speed price calculator'

Speedp = 300

Rand = Rnd(200) - 100

Speedp = Speedp + Rand

If Rand < 80 Then Goto Skip1a
Message = "Speed freaks are hard up for bennies!"
Gosub Skyhi
Speedp = Speedp * Rand
Skip1a:
If Rand > -90 Then Goto Skip2a
Message = "Cheap christmas trees flood the market!"
Gosub Skyhi
Speedp = Speedp / Rand
Skip2a:

'Cocaine price calculator'

Cocainep = 15000

Rand = Rnd(3000) - 1500

Cocainep = Cocainep + Rand

If Rand < 1450 Then Goto Skip1b
Message = "A big bust sends snow prices through the roof!"
Gosub Skyhi
Cocainep = Cocainep * Rand
Skip1b:
If Rand > -1400 Then Goto Skip2b
Message = "Cheap Crank reduces demand for your triple cut garbage!"
Gosub Skyhi
Cocainep = Cocainep / Rand
Skip2b:

'Acid price calculator'

Acidp = 2000

Rand = Rnd(1000) - 500

Acidp = Acidp + Rand

If Rand < 490 Then Goto Skip1c
Message = "Project MKUltra increases demand for psychedellics!"
Gosub Skyhi
Acidp = Acidp * Rand
Skip1c:
If Rand > -400 Then Goto Skip2c
Message = "Home made liquid acid floors prices!"
Gosub Skyhi
Acidp = Acidp / Rand
Skip2c:



'interest....
Scratch = Debt * .15
Scratch = Int(scratch)
Debt = Debt + Scratch

'Random Event
Rand = Rnd(20)
If Days < 5 Then Goto Beginner
If Money < 10000 Then Goto Fortuna
If Rand > 17 Then Gosub Hardass
If Rand = 17 Then Gosub Robbed
Fortuna:

If Rand = 10 Then Gosub Robbed

Beginner:
If Rand = 5 Then Gosub Foundcash
If Rand = 18 Then Gosub Foundcash




Statustable:

Gosub Aster
Print "The Price On The Street.....Carrying"
Print "LSD : " ; Acidp ; " " ; Acid
Print "Weed : " ; Weedp ; " " ; Weed
Print "Speed : " ; Speedp ; " " ; Speed
Print "Cocaine : " ; Cocainep ; " " ; Cocaine
Gosub Aster

Print

Print "Day " ; Days
Print "You Have $" ; Money;
If Debt > 0 Then Print " and you owe $" ; Debt Else Print ""


Turnchoice:
Print ""
Input "(B)uy, (S)ell, Visit (V)innie, or (W)alk ?" , A
Print
Print
If A = "B" Then Goto Buy
If A = "S" Then Goto Sell
If A = "V" Then Goto Vinnie
If A = "W" Then Goto Turnend
'No Valid Input
Gosub Errormsg
Goto Turnchoice:


Turnend:
Print ""
Next Days


'finish and score
Print
Print
Print
Gosub Aster
Money = Money - Debt
Print " After a month on the street, you made a total of $" ; Money
If Money > 0 Then Print "Congrats, scarface."
If Money < 0 Then Print "..and vinnie isn't happy."
Print
Print
Print
Goto Getseed


Buy:
Gosub Drugchoice
Input "Buy what?" , A
If A = "W" Then
Price = Weedp
Gosub B_howmuch
Weed = Weed + Tt
Goto Statustable
End If

If A = "S" Then
Price = Speedp
Gosub B_howmuch
Speed = Speed + Tt
Goto Statustable
End If

If A = "C" Then
Price = Cocainep
Gosub B_howmuch
Cocaine = Cocaine + Tt
Goto Statustable
End If

If A = "L" Then
Price = Acidp
Gosub B_howmuch
Acid = Acid + Tt
Goto Statustable
End If

If A = "X" Then Goto Turnchoice

Gosub Errormsg
Goto Buy


Sell:
Gosub Drugchoice
Input "Sell what?" , A
If A = "W" Then
T = Weed
Price = Weedp
Gosub S_howmuch
Weed = Weed - Tt
Goto Statustable
End If

If A = "S" Then
T = Speed
Price = Speedp
Gosub S_howmuch
Speed = Speed - Tt
Goto Statustable
End If

If A = "C" Then
T = Cocaine
Price = Cocainep
Gosub S_howmuch
Cocaine = Cocaine - Tt
Goto Statustable
End If

If A = "L" Then
T = Acid
Price = Acidp
Gosub S_howmuch
Acid = Acid - Tt
Goto Statustable
End If

If A = "X" Then Goto Turnchoice

Gosub Errormsg
Goto Sell






Skyhi:
Print
Gosub Aster
Print
Print Message
Rand = Rnd(10)
Gosub Aster
Print
Return


S_howmuch:
Print
Print "You Have " ; T
Print
Input "Sell How Many?" , Tt
If Tt > T Then
Print "thats more than you have, moron - Nice try."
Goto S_howmuch
End If
T = Tt * Price
Money = Money + T
Jacket = Jacket - Tt
Return

B_howmuch:
Temp = Money / Price
Temp = Int(temp)
Print
Print "You Can Afford " ; Temp
Input "Buy How Many?" , Tt
Temp2 = Jacketcap - Jacket
If Tt > Temp2 Then
Print "thats more than you can carry."
Goto B_howmuch
End If
If Tt > Temp Then
Print "You dont have that kind of dough."
Goto B_howmuch
End If

T = Tt * Price
Money = Money - T
Jacket = Jacket + Tt

Return

Vinnie:
If Debt < 1 Then
Print "vinnie dont wanna talk."
Goto Turnend
End If
Print "Vinnie wants his money, plus the vig."
Print
Input "How much ya gonna pay ?" , T

If T > Money Then
Print "Vinnie don't take checks. Or Monopoly money."
Print
Print " What the hell are you thinking?"
Goto Vinnie
End If
Money = Money - T
If T < 500 And Debt > 1000 Then
Debt = Debt + 300
Print "Vinnie says go ***** yourself. And dont waste his time again."
End If
Debt = Debt - T
If Debt > -100 Then Debt = Debt + 300
If Debt > 0 Then
Print "Vinnie says - Good and thanks for the tip."
Print
Print "....Now Bring me the rest."
End If
Goto Turnend


Aster:
Print "******************************************"
Return

Drugchoice:
Print
Print "(L)sd"
Print "(W)eed"
Print "(S)peed"
Print "(C)ocaine"
Print "(X)leave"
Return

Errormsg:
Print "Sorry, jive not spoken here, ya mook!"
Return

Hardass:
Print
Gosub Aster
Print
Print "Officer Hardass is on your tail!"
Print
Gosub Aster

Do
Print
Input "(R)un or (F)ight?" , A
Rand = Rnd(10)
If A = "R" Then
If Rand > 5 Then
Print
Print "You Got Away!"
Return
End If
If Rand = 3 Then
Print
Print " You're Busted!!"
Print
Print " He took half your cash!"
T = Money / 2
Money = Int(temp)
Jacket = Jacket - Cocaine
Cocaine = 0
Return
End If
Print
Print "You Can't shake him!"
End If
If A = "F" Then
If Rand > 3 Then
Print
Print "You beat his fat ass into the ground!"
Return
End If
If Rand = 2 Then
Print
Print " You're Busted!!"
Print
Money = 2000
Debt = 2500
Acid = 0
Weed = 0
Cocaine = 0
Speed = 0
Jacket = 0
Print "He took everything!! Luckily Vinny helped you out..."
Return
End If
Print
Print "He's on you like stink on shit!"
End If

Loop

Return





Foundcash:
Print
Gosub Aster
Print
Print "You found some cash on a dead guy in the subway!"
Print
Gosub Aster
Print
Rand = Rnd(1000)
T = Rand * 1
Money = Money + T
Return

Robbed:
Print
Gosub Aster
Print
Print "You got robbed!"
Print
Gosub Aster
Print
Rand = Rnd(500)
T = Rand * 1
Money = Money - T
If Money < 0 Then
Print
Print "luckily, vinnie is happy to loan you more money..."
Print
Debt = Debt + 1200
Money = Money + 1000
End If
Return




End