Hello everyone. I'm working on my project (a rubik's cube game) in assembler. I'm using TASM. Now, I want to do a record table - order by name, moves, random, time, ect. This data (name moves ect.) is saved in an array of structures at the end of each game (solved cube/giving up), like this -


game struc
GamePlayerName db 9, 11 dup('$')  ; Name - dollars for display
Gamemoves dw ?                    ; Moves till solve
RandomMoves db ?                    ; Moves of scramble
game ends


DATA Segment
thisGame game 30d dup(< , , >)
thisGameLength = ($-thisGame)/(type game)
...
DATA ends


Now, this worked all fine and dandy. But every time I wanted to check whether the array is ordered, displayed, reset - basically every time I wanted to see if an action including the array worked, I had to play the game and fill the array with information. Obviously this is not a way to work (takes AGES), so I wanted to define the array with the information already included, like so -


game struc
GamePlayerName db 9, 11 dup('$')  ; Name
Gamemoves dw ?                    ; Moves till solve
RandomMoves db ?                    ; Moves of scramble
game ends


DATA Segment
thisGame game                <"Shay", 18d, 5d>, <"MojoJojo", 11d, 6d>, <"Kobi", 2d, 1d>, <"Rocko", 54d, 21d>,
<"Zakk", 69d, 69d>, <"Paul", 85d, 14d>, <"Steve", 8d, 5d>, <"Angus", 223d, 12d>,
<"Ziv", 75d, 75d>, <"Bob", 181d, 51d>, <"Bobo", 180d, 50d>, <"Nick", 11d, 1d>
thisGameLength = ($-thisGame)/(type game)
...
DATA ends


This gives me many errors and warnings upon running the code, which are -
**Error** a.ASM(11) Illegal override in structure
*Warning* a.ASM(11) Location counter overflow
*Warning* a.ASM(11) Location counter overflow
*Warning* a.ASM(11) Missing operand - trailing ? assumed
**Error** a.ASM(12) Unknown character
**Error** a.ASM(13) Unknown character


Any ideas on what I'm doing wrong?

TL;DNR -
How to define an array of structurs with the data inside them, no DUP, in the DATA segment?
Posted on 2011-04-26 12:21:57 by TheCoreMan

GamePlayerName db 9
db   11 dup('$')  ; Name - dollars for display
Posted on 2011-04-26 19:14:21 by JimmyClif
try arranging it like:

thisGame			game		<"Shay", 18d, 5d>
game <"MojoJojo", 11d, 6d>
game <"Kobi", 2d, 1d>
game <"Rocko", 54d, 21d>
game <"Zakk", 69d, 69d>
game <"Paul", 85d, 14d>
game <"Steve", 8d, 5d>
game <"Angus", 223d, 12d>
game <"Ziv", 75d, 75d>
game <"Bob", 181d, 51d>
game <"Bobo", 180d, 50d>
game <"Nick", 11d, 1d>
db 0


works for MASM, possibly works for TASM. Might have to just set name as GamePlayerName db 20 dup (0) in structure, id define it something like this:

game struc
GamePlayerName db 20 dup(0) ; Name - dollars for display
Gamemoves dw 0 ; Moves till solve
RandomMoves db 0 ; Moves of scramble
game ends
Posted on 2011-04-28 05:56:39 by keithsrobertson