Ok, here I will be posting code which I would like help to convert from TI-BASIC to Z-80 Assembly code. The first program which I want to re-write in Assembly is PAZAAK.
Code:
I know it's SUPER long, but this game is very well worth re-writing... If done correctly... Thanks in advance!
Code:
:1→∟SE(1
:prgmSTARTEND
:30→dim(∟P
:If ∟P(6)=0
:Then
:0→∟P(1
:0→∟P(2
:0→∟P(3
:0→∟P(4
:200→∟P(5
:1→∟P(6
:End
:If ∟P(1)<0 or ∟P(1)>5
:0→∟P(1
:If ∟P(2)<0 or ∟P(2)>5
:0→∟P(2
:If ∟P(3)<0 or ∟P(3)>5
:0→∟P(3
:If ∟P(4)<0 or ∟P(4)>5
:0→∟P(4
:Horizontal 55
:Text(0,0,"Pazaak
:Text(9,0,"This is a mock of the Pazaak
:Text(15,0,"mini-game from Star Wars:
:Text(21,0,"Knights of the Old Republic
:Text(57,0,"Version: 8.7.11
:Pause
:Lbl 1
:ClrDraw
:Horizontal 55
:"Menu→Str0
:"Play Pazaak→Str1
:"Manage Cards→Str2
:"Statistics→Str3
:"Instructions→Str4
:"Key Functions→Str5
:"Exit→Str6
:9→∟MENU(2
:6→∟MENU(1
:prgmMENU
:If W=39
:Then
:0→∟SE(1
:prgmSTARTEND
:End
:If W=33
:Then
:ClrDraw
:Horizontal 55
:Text(0,0,"Key Functions
:Text(9,0,"Key: Function
:Line(0,‾11,12,‾11
:Line(28,‾11,55,‾11
:Text(18,0,"2ND: End Turn
:Text(24,0,"MODE: Pass
:Text(30,0,"DEL: Stand
:Text(36,0,"1-4: Select Cards 1-4
:Text(42,0,"CLEAR: Exit Game
:Pause
:Goto 1
:End
:If W=27
:Then
:ClrDraw
:Horizontal 55
:Text(0,0,"Instructions
:Text(9,0,"Get as close to 20 as you can
:Text(15,0,"without going over
:Text(27,0,"Win 3 rounds to beat the game
:Text(33,0,"and get a free Saved Card
:Pause
:Goto 1
:End
:If W=21
:Then
:ClrDraw
:Horizontal 55
:Text(0,0,"Statistics
:Text(9,0,"Saved Cards
:Line(0,‾11,38,‾11
:If ∟P(1)=0
:Text(18,0,"Card 1: None
:If ∟P(1)≠0
:Text(18,0,"Card 1: +",∟P(1
:If ∟P(2)=0
:Text(24,0,"Card 2: None
:If ∟P(2)≠0
:Text(24,0,"Card 2: +",∟P(2
:If ∟P(3)=0
:Text(30,0,"Card 3: None
:If ∟P(3)≠0
:Text(30,0,"Card 3: +",∟P(3
:If ∟P(4)=0
:Text(36,0,"Card 4: None
:If ∟P(4)≠0
:Text(36,0,"Card 4: +",∟P(4
:Text(48,0,"Credits: ",∟P(5
:Text(57,0,"Press CLEAR to reset
:Lbl 2
:getKey→X
:If X=0
:Goto 2
:If X=105
:Goto 1
:If X=45
:Then
:ClrDraw
:Horizontal 55
:"Reset Statistics→Str0
:Text(9,0,"Reset all statistics?
:Text(21,0,"Saved Cards and Credits will
:Text(27,0,"be reset
:"Yes→Str1
:"No→Str2
:2→∟MENU(1
:39→∟MENU(2
:prgmMENU
:If W=45
:Goto 1
:If W=39
:Then
:0→∟P(1
:0→∟P(2
:0→∟P(3
:0→∟P(4
:200→∟P(5
:ClrDraw
:Horizontal 55
:Text(0,0,"Statistics Reset
:Text(9,0,"Your statistics have been
:Text(15,0,"reset
:Pause
:Goto 1
:End
:End
:If X≠45 or 105
:Goto 2
:End
:If W=15
:Then
:ClrDraw
:"Manage Cards→Str0
:"Purchase Cards→Str1
:"Sell Cards→Str2
:2→∟MENU(1
:9→∟MENU(2
:prgmMENU
:If W=9
:Then
:ClrDraw
:Horizontal 55
:"Purchase Cards→Str0
:Text(9,0,"Pay 100 Credits and receive a
:Text(15,0,"random Saved Card?
:"Yes→Str1
:"No→Str2
:2→∟MENU(1
:27→∟MENU(2
:prgmMENU
:If W=33
:Goto 1
:If W=27
:Then
:If ∟P(5)<100
:Then
:ClrDraw
:Horizontal 55
:Text(0,0,"Error
:Text(9,0,"You do not have enough
:Text(15,0,"credits to continue
:Pause
:Goto 1
:End
:If ∟P(5)≥100
:Then
:∟P(5)-100→∟P(5
:randInt(1,5→B
:ClrDraw
:"Random Card→Str0
:Text(9,0,"Random Card: ",B
:Text(21,0,"Accept?
:"Yes→Str1
:"No→Str2
:2→∟MENU(1
:33→∟MENU(2
:prgmMENU
:If W=39
:Goto 1
:If W=33
:Then
:Lbl 10
:ClrDraw
:"Save Card→Str0
:Text(9,0,"Which card slot do you want
:Text(15,0,"to save it to?
:"Card Slot 1: (→Str1
:"Card Slot 2: (→Str2
:"Card Slot 3: (→Str3
:"Card Slot 4: (→Str4
:If ∟P(1)=0
:Text(27,47,"Empty)
:If ∟P(2)=0
:Text(33,47,"Empty)
:If ∟P(3)=0
:Text(39,47,"Empty)
:If ∟P(4)=0
:Text(45,47,"Empty)
:If ∟P(1)≠0
:Text(27,47,"+",∟P(1),")
:If ∟P(2)≠0
:Text(33,47,"+",∟P(2),")
:If ∟P(3)≠0
:Text(39,47,"+",∟P(3),")
:If ∟P(4)≠0
:Text(45,47,"+",∟P(4),")
:Text(57,0,"Offered Card: +",B
:4→∟MENU(1
:27→∟MENU(2
:prgmMENU
:If W=27
:Then
:B→∟P(1
:1→C
:End
:If W=33
:Then
:B→∟P(2
:2→C
:End
:If W=39
:Then
:B→∟P(3
:3→C
:End
:If W=45
:Then
:B→∟P(4
:4→C
:End
:ClrDraw
:Horizontal 55
:Text(0,0,"Card Saved
:Text(9,0,"Card saved to Card Slot ",C
:Pause
:Goto 1
:End
:End
:End
:End
:If W=15
:Then
:Lbl 3
:ClrDraw
:"Sell Cards→Str0
:Text(9,0,"Which card do you want to
:Text(15,0,"sell?
:"Card Slot 1: (→Str1
:"Card Slot 2: (→Str2
:"Card Slot 3: (→Str3
:"Card Slot 4: (→Str4
:"Cancel→Str5
:If ∟P(1)=0
:Text(27,47,"Empty)
:If ∟P(2)=0
:Text(33,47,"Empty)
:If ∟P(3)=0
:Text(39,47,"Empty)
:If ∟P(4)=0
:Text(45,47,"Empty)
:If ∟P(1)≠0
:Text(27,47,"+",∟P(1),")
:If ∟P(2)≠0
:Text(33,47,"+",∟P(2),")
:If ∟P(3)≠0
:Text(39,47,"+",∟P(3),")
:If ∟P(4)≠0
:Text(45,47,"+",∟P(4),")
:27→∟MENU(2
:5→∟MENU(1
:prgmMENU
:If W=27
:Then
:If ∟P(1)=0
:Goto 4
:If ∟P(1)≠0
:Then
:1→C
:Goto 5
:End
:End
:If W=33
:Then
:If ∟P(2)=0
:Goto 4
:If ∟P(2)≠0
:Then
:2→C
:Goto 5
:End
:End
:If W=39
:Then
:If ∟P(3)=0
:Goto 4
:If ∟P(3)≠0
:Then
:3→C
:Goto 5
:End
:End
:If W=45
:Then
:If ∟P(4)=0
:Goto 4
:If ∟P(4)≠0
:Then
:4→C
:Goto 5
:End
:End
:If W=51
:Goto 1
:Lbl 4
:ClrDraw
:Horizontal 55
:Text(0,0,"Error
:Text(9,0,"There is no card in this slot
:Pause
:Goto 3
:Lbl 5
:ClrDraw
:Horizontal 55
:Text(9,0,"Card will be sold for 50
:Text(15,0,"Credits
:Text(27,0,"Continue?
:"Yes→Str1
:"No→Str2
:2→∟MENU(1
:33→∟MENU(2
:prgmMENU
:If W=39
:Goto 1
:If W=33
:Then
:If C=1
:0→∟P(1
:If C=2
:0→∟P(2
:If C=3
:0→∟P(3
:If C=4
:0→∟P(4
:∟P(5)+50→∟P(5
:ClrDraw
:Horizontal 55
:Text(0,0,"Card Sold
:Text(9,0,"Card has been sold for 50
:Text(15,0,"Credits
:Pause
:Goto 1
:End
:End
:End
:If W=9
:Then
:If ∟P(5)<10
:Then
:ClrDraw
:Horizontal 55
:Text(0,0,"Error
:Text(9,0,"You do not have enough
:Text(15,0,"Credits to play
:Text(27,0,"Reset you statistics to return
:Text(33,0,"to default
:Pause
:Goto 1
:End
:Lbl 6
:ClrDraw
:Horizontal 55
:Text(0,0,"Place Bet
:Text(9,0,"Place a bet
:Text(57,0,"Credits: ",∟P(5
:"Bet→Str0
:21→∟INPUT(1
:prgmINPUT
:expr(Str1→Z
:If Z<10
:Then
:ClrDraw
:Horizontal 55
:Text(0,0,"Error
:Text(9,0,"Your bet needs to be at least
:Text(15,0,"10 Credits
:Pause
:Goto 6
:End
:If Z>∟P(5
:Then
:ClrDraw
:Horizontal 55
:Text(0,0,"Error
:Text(9,0,"Your bet cannot be higher
:Text(15,0,"than your amount of Credits
:Pause
:Goto 6
:End
:If fPart(Z)≠0
:Then
:ClrDraw
:Horizontal 55
:Text(0,0,"Error
:Text(9,0,"Your bet cannot contain
:Text(15,0,"decimals
:Pause
:Goto 6
:End
:ClrDraw
:Horizontal 55
:Text(0,0,"Your Bet
:Text(9,0,"You bet ",Z," Credits
:Text(21,0,"Press ENTER to play Pazaak
:Pause
:If ∟P(1)=0
:1→D
:If ∟P(2)=0
:1→E
:If ∟P(3)=0
:1→F
:If ∟P(4)=0
:1→G
:ClrDraw
:Horizontal 52
:Horizontal 39
:Horizontal 37
:Horizontal 24
:Horizontal 22
:Horizontal 9
:Horizontal 7
:Horizontal 6
:Horizontal 5
:Horizontal 4
:Horizontal 3
:Horizontal 2
:Horizontal 1
:Vertical 3
:Vertical 14
:Vertical 17
:Vertical 28
:Vertical 31
:Vertical 42
:Vertical 52
:Vertical 63
:Vertical 66
:Vertical 77
:Vertical 80
:Vertical 91
:Line(0,55,94,55,0
:Line(0,53,94,53,0
:Line(0,38,94,38,0
:Line(0,23,94,23,0
:Line(0,8,94,8,0
:Line(0,6,94,6,0
:Line(0,5,94,5,0
:Line(0,4,94,4,0
:Line(0,3,94,3,0
:Line(0,2,94,2,0
:Line(0,1,94,1,0
:Line(1,53,1,8,0
:Line(2,53,2,8,0
:Line(15,53,15,8,0
:Line(16,53,16,8,0
:Line(28,62,28,56,0
:Line(31,62,31,56,0
:Line(29,53,29,8,0
:Line(30,53,30,8,0
:Line(42,62,42,56,0
:Line(52,62,52,56,0
:For(A,43,51
:Line(A,53,A,8,0
:End
:Line(63,62,63,56,0
:Line(64,53,64,8,0
:Line(65,53,65,8,0
:Line(66,62,66,56,0
:Line(78,53,78,8,0
:Line(79,53,79,8,0
:Line(92,53,92,8,0
:Line(93,53,93,8,0
:Line(1,7,1,1
:Line(12,7,12,1
:Line(23,7,23,1
:Line(34,7,34,1
:Line(45,7,45,1
:Line(49,7,49,1
:Line(93,7,93,1
:Horizontal 62
:Horizontal 54
:Horizontal 0
:Vertical 0
:Vertical 46
:Vertical 47
:Vertical 48
:Vertical 94
:Text(1,2,"Player
:Text(1,70,"TI Calc
:StorePic 9
:0→∟P(7
:0→∟P(8
:∟P(5)-Z→∟P(5
:Lbl 7
:For(A,9,30
:0→∟P(A
:End
:1→H
:0→I
:0→J
:Lbl 8
:sum({∟P(11),∟P(12),∟P(13),∟P(14),∟P(15),∟P(16),∟P(17),∟P(18),∟P(19)}→∟P(9
:sum({∟P(20),∟P(21),∟P(22),∟P(23),∟P(24),∟P(25),∟P(26),∟P(27),∟P(28)}→∟P(10
:If ∟P(9)>9
:Text(1,38,∟P(9
:If ∟P(9)<10
:Text(1,38," ",∟P(9
:If ∟P(10)>9
:Text(1,50,∟P(10
:If ∟P(10)<10
:Text(1,50," ",∟P(10
:If ∟P(9)=20 and I≠1
:3→H
:If ∟P(9)=20 and I=1
:Goto 9
:If ∟P(9)>20
:Then
:Text(56,51,"TI Wins
:∟P(8)+1→∟P(8
:RecallPic 9
:Pause
:ClrDraw
:Goto 7
:End
:If ∟P(7)≥1
:Text(1,34,"□
:If ∟P(7)≥2
:Text(1,30,"□
:If ∟P(8)≥1
:Text(1,58,"□
:If ∟P(8)≥2
:Text(1,62,"□
:If ∟P(11)>0
:Text(16,6,"+",∟P(11
:If ∟P(12)>0
:Text(16,20,"+",∟P(12
:If ∟P(13)>0
:Text(16,34,"+",∟P(13
:If ∟P(14)>0
:Text(31,6,"+",∟P(14
:If ∟P(15)>0
:Text(31,20,"+",∟P(15
:If ∟P(16)>0
:Text(31,34,"+",∟P(16
:If ∟P(17)>0
:Text(46,6,"+",∟P(17
:If ∟P(18)>0
:Text(46,20,"+",∟P(18
:If ∟P(19)>0
:Text(46,34,"+",∟P(19
:If ∟P(20)>0
:Text(16,55,"+",∟P(20
:If ∟P(21)>0
:Text(16,69,"+",∟P(21
:If ∟P(22)>0
:Text(16,83,"+",∟P(22
:If ∟P(23)>0
:Text(31,55,"+",∟P(23
:If ∟P(24)>0
:Text(31,69,"+",∟P(24
:If ∟P(25)>0
:Text(31,83,"+",∟P(25
:If ∟P(26)>0
:Text(46,55,"+",∟P(26
:If ∟P(27)>0
:Text(46,69,"+",∟P(27
:If ∟P(28)>0
:Text(46,83,"+",∟P(28
:If D=1
:Then
:For(A,‾56,‾51
:Line(2,A,11,A,0
:End
:End
:If E=1
:Then
:For(A,‾56,‾51
:Line(13,A,22,A,0
:End
:End
:If F=1
:Then
:For(A,‾56,‾51
:Line(24,A,33,A,0
:End
:End
:If G=1
:Then
:For(A,‾56,‾51
:Line(35,A,44,A,0
:End
:End
:If D=0
:Text(56,4,"+",∟P(1
:If E=0
:Text(56,15,"+",∟P(2
:If F=0
:Text(56,26,"+",∟P(3
:If G=0
:Text(56,37,"+",∟P(4
:RecallPic 9
:If H=1
:Then
:Repeat A=21 or A=22 or A=23 or A=45 or A=82 or A=92 or A=93 or A=94
:getKey→A
:End
:If A=21
:Then
:randInt(1,5→B
:∟P(29)+1→∟P(29
:If ∟P(29)=1
:B→∟P(11
:If ∟P(29)=2
:B→∟P(12
:If ∟P(29)=3
:B→∟P(13
:If ∟P(29)=4
:B→∟P(14
:If ∟P(29)=5
:B→∟P(15
:If ∟P(29)=6
:B→∟P(16
:If ∟P(29)=7
:B→∟P(17
:If ∟P(29)=8
:B→∟P(18
:If ∟P(29)=9
:B→∟P(19
:2→H
:End
:If A=22
:Then
:If J=0
:2→H
:1→J
:End
:If A=23
:3→H
:If A=45
:Then
:0→∟SE(1
:prgmSTARTEND
:End
:If A=82
:Then
:If G=0
:∟P(29)+1→∟P(29
:If ∟P(29)=1
:∟P(4→∟P(11
:If ∟P(29)=2
:∟P(4→∟P(12
:If ∟P(29)=3
:∟P(4→∟P(13
:If ∟P(29)=4
:∟P(4→∟P(14
:If ∟P(29)=5
:∟P(4→∟P(15
:If ∟P(29)=6
:∟P(4→∟P(16
:If ∟P(29)=7
:∟P(4→∟P(17
:If ∟P(29)=8
:∟P(4→∟P(18
:If ∟P(29)=9
:∟P(4→∟P(19
:1→G
:End
:If A=92
:Then
:If D=0
:∟P(29)+1→∟P(29
:If ∟P(29)=1
:∟P(1→∟P(11
:If ∟P(29)=2
:∟P(1→∟P(12
:If ∟P(29)=3
:∟P(1→∟P(13
:If ∟P(29)=4
:∟P(1→∟P(14
:If ∟P(29)=5
:∟P(1→∟P(15
:If ∟P(29)=6
:∟P(1→∟P(16
:If ∟P(29)=7
:∟P(1→∟P(17
:If ∟P(29)=8
:∟P(1→∟P(18
:If ∟P(29)=9
:∟P(1→∟P(19
:1→D
:End
:If A=93
:Then
:If E=0
:∟P(29)+1→∟P(29
:If ∟P(29)=1
:∟P(2→∟P(11
:If ∟P(29)=2
:∟P(2→∟P(12
:If ∟P(29)=3
:∟P(2→∟P(13
:If ∟P(29)=4
:∟P(2→∟P(14
:If ∟P(29)=5
:∟P(2→∟P(15
:If ∟P(29)=6
:∟P(2→∟P(16
:If ∟P(29)=7
:∟P(2→∟P(17
:If ∟P(29)=8
:∟P(2→∟P(18
:If ∟P(29)=9
:∟P(2→∟P(19
:1→E
:End
:If A=94
:Then
:If F=0
:∟P(29)+1→∟P(29
:If ∟P(29)=1
:∟P(3→∟P(11
:If ∟P(29)=2
:∟P(3→∟P(12
:If ∟P(29)=3
:∟P(3→∟P(13
:If ∟P(29)=4
:∟P(3→∟P(14
:If ∟P(29)=5
:∟P(3→∟P(15
:If ∟P(29)=6
:∟P(3→∟P(16
:If ∟P(29)=7
:∟P(3→∟P(17
:If ∟P(29)=8
:∟P(3→∟P(18
:If ∟P(29)=9
:∟P(3→∟P(19
:1→F
:End
:Goto 8
:End
:If H=2 or 3
:Then
:If I=1 and H≠3
:1→H
:If ∟P(10)<16
:Then
:randInt(1,5→B
:∟P(30)+1→∟P(30
:If ∟P(30)=1
:B→∟P(20
:If ∟P(30)=2
:B→∟P(21
:If ∟P(30)=3
:B→∟P(22
:If ∟P(30)=4
:B→∟P(23
:If ∟P(30)=5
:B→∟P(24
:If ∟P(30)=6
:B→∟P(25
:If ∟P(30)=7
:B→∟P(26
:If ∟P(30)=8
:B→∟P(27
:If ∟P(30)=9
:B→∟P(28
:If H≠3
:1→H
:End
:If ∟P(10)≥6 and ∟P(10)≤20
:1→I
:If H=3 and I=1
:Then
:Lbl 9
:If ∟P(9)>∟P(10
:Then
:Text(56,51,"You Win
:∟P(7)+1→∟P(7
:If ∟P(7)=3
:Then
:ClrDraw
:∟P(5)+2Z→∟P(5
:"You Win→Str0
:Text(9,0,"You have defeated TI Calc
:randInt(1,5→B
:Text(21,0,"TI offered a Saved Card (+",B,")
:Text(33,0,"Accept?
:"Yes→Str1
:"No→Str2
:2→∟MENU(1
:45→∟MENU(2
:prgmMENU
:If W=51
:Goto 1
:If W=45
:Goto 10
:End
:End
:If ∟P(9)=∟P(10
:Text(56,51,"Tied
:If ∟P(9)<∟P(10
:Then
:Text(56,51,"TI Wins
:∟P(8)+1→∟P(8
:If ∟P(8)=3
:Then
:ClrDraw
:Horizontal 55
:Text(0,0,"You Lose
:Text(9,0,"TI Calc beat you
:Pause
:Goto 1
:End
:End
:RecallPic 9
:Pause
:ClrDraw
:Goto 7
:End
:Goto 8
:End
I know it's SUPER long, but this game is very well worth re-writing... If done correctly... Thanks in advance!