Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
read/data statements
#11
oh- i get it. i thought the data that PP256 saved was supposed to be read into a two-dimensional array so you could print it as a bitmap.

PP256 is better than i thought. thanks AGAIN nathan...

in retrospect, it looks like today i'm been turning this forum into my own debugging group. i'm going to try and solve more of my problems myself from now on.
Reply
#12
grr... something's wrong again, and i've tried to figure it out...
but i can't


Code:
' ///Sub Declarations\\\
DECLARE SUB LoadPUT (File$, Array%())
DECLARE SUB init ()
DECLARE SUB movement ()

DEFINT A-Z     'what is this?

'$DYNAMIC                 'some variables!
DIM SHARED squid%(0)  'the squid array
DIM SHARED squidm%(0) 'the squid mask
DIM SHARED BG1(0)      'background 1
DIM SHARED BG2(0)      'background 2
DIM SHARED BG3(0)      'background 3
DIM SHARED BG4(0)      'background 4
DIM SHARED BG5(0)      'background 5
DIM SHARED xcoor(9)
DIM SHARED ycoor(9)
DIM SHARED bmap(10, 10)   'the map
DIM SHARED grx, gry, ogrx, ogry  'the location on the imaginary grid
DIM SHARED xpos, ypos   'x coordinate, y coordinate
DIM SHARED inky       ' user input



SCREEN 13

CLS
CALL init 'calls some stuff to initiate some stuff


PUT (xpos, ypos), squidm%, AND       'puts the stuff on for the first time
PUT (xpos, ypos), squid%, XOR

DO

PUT (xpos, ypos), squidm%, AND   'puts the stuff on when it is moved
PUT (xpos, ypos), squid%, XOR

      
oxpos = xpos
oypos = ypos
ogrx = grx
ogry = gry

IF inky = 6 THEN        'moves the guy
IF xpos <= 257 THEN
  xpos = xpos + 32
  grx = grx + 1
END IF
END IF
IF inky = 4 THEN
IF xpos >= 33 THEN
  xpos = xpos - 32
  grx = grx - 1
END IF
END IF
IF inky = 8 THEN
IF ypos >= 21 THEN
  ypos = ypos - 20
  gry = gry - 1
END IF
END IF
IF inky = 2 THEN
  IF ypos <= 161 THEN
   ypos = ypos + 20:
   gry = gry + 1
  END IF
END IF

SELECT CASE bmap(ogrx, ogry)                'redraws the BG
CASE 1
  PUT (ogrx * 32 + 1, ogry * 20 + 1), BG1, PSET
CASE 2
  PUT (ogrx * 32 + 1, ogry * 20 + 1), BG2, PSET
CASE 3
  PUT (ogrx * 32 + 1, ogry * 20 + 1), BG3, PSET
CASE 4
  PUT (ogrx * 32 + 1, ogry * 20 + 1), BG4, PSET
CASE 5
  PUT (ogrx * 32 + 1, ogry * 20 + 1), BG5, PSET
END SELECT



LOOP UNTIL inky = 5



DATA 4,5,1,3,1,2,5,4,4,1
DATA 5,1,2,1,1,5,1,5,2,5
DATA 1,5,1,2,1,2,3,1,1,4
DATA 4,2,4,1,2,1,1,4,1,2
DATA 3,3,2,5,3,1,5,2,1,3
DATA 5,1,3,1,4,2,5,1,3,1
DATA 3,2,1,2,3,1,2,1,4,2
DATA 1,3,3,1,2,1,5,4,3,1
DATA 1,4,2,4,1,3,3,1,5,2
DATA 2,1,2,5,2,2,1,5,3,1


'squid
DATA 248,19, 0 ,0 ,0 ,0 ,0 ,0 ,-15678,-15678,-15678,-15678, 0 ,0 , 0 , 0 , 0 , 0 , 0 , 0
DATA 0,0,-15678,-15678,-15678,-15678,-15678,-15678,-15678,0,0,0,0,0,0,0,0,-15678,-15678,-15678
DATA -15678,-15678,-15678,-15678,-15678,0,0,0,0,0,0,0,-15678,-15678,10178,-15833,-15678,10178,-15833,-15678
DATA -15678,0,0,0,0,0,0,-15678,-15678,-15678,39,-15833,10178,9984,-15678,-15678,-15678,0,0,0
DATA 0,0,-15872,-15678,-15678,-15678,10023,-15678,10023,-15678,-15678,-15678,194,0,0,0,0,0,-15678,-15678
DATA -15678,-15678,-15678,-15678,-15678,-15678,-15678,-15678,0,0,0,0,0,-15872,-15678,-15678,-15678,-15678,-15678,-15678
DATA -15678,-15678,-15678,194,0,0,0,0,0,-15872,-15678,-15678,-15837,-15678,-15678,9154,-15678,-15678,194,0
DATA 0,0,0,0,0,-15872,-15678,-15678,8995,8995,8995,-15678,-15678,194,0,0,0,0,0,0
DATA 0,-15872,-15678,-15678,-15678,-15678,-15678,-15678,194,0,0,0,0,0,0,0,0,-15678,-15872,-15678
DATA -15678,-15678,194,-15872,0,0,0,0,0,0,0,0,-15678,0,-15872,194,0,194,0,-15678
DATA 0,0,0,0,0,0,0,-15872,0,-15872,194,0,-15872,0,0,194,0,0,0,0
DATA 0,0,0,-15678,0,194,0,0,194,0,-15872,0,0,0,0,0,0,0,0,-15678
DATA -15872,194,0,-15678,0,0,194,0,0,0,0,0,0,0,0,194,0,194,-15872,0
DATA -15872,-15678,0,0,0,0,0,0,0,0,-15872,0,-15872,194,-15678,194,194,0,0,0
DATA 0,0,0,0,0,-15872,194,0,194,0,-15872,-15872,0,0,0,0,0

'squid mask

DATA 0,0, 255 ,255 ,255 ,255 ,255 ,255 ,0,0,0,0, 255 ,255 , 255 , 255 , 255 , 255 , 255 , 255
DATA 255 ,255 ,0,0,0,0,0,0,0, 255 ,255 ,255 , 255 , 255 , 255 , 255 , 255 ,0,0,0
DATA 0,0,0,0,0, 255 , 255 , 255 , 255 , 255 , 255 , 255 ,0,0,0,0,0,0,0,0
DATA 0, 255 , 255 , 255 , 255 , 255 , 255 ,0,0,0,0,0,0,0,0,0,0, 255 , 255 , 255
DATA 255 , 255 ,0,0,0,0,0,0,0,0,0,0,0, 255 , 255 , 255 , 255 , 255 ,0,0
DATA 0,0,0,0,0,0,0,0, 255 , 255 , 255 , 255 , 255 ,0,0,0,0,0,0,0
DATA 0,0,0,0, 255 , 255 , 255 , 255 , 255 ,0,0,0,0,0,0,0,0,0,0, 255
DATA 255 , 255 , 255 , 255 , 255 ,0,0,0,0,0,0,0,0,0, 255 , 255 , 255 , 255 , 255 , 255
DATA 255,0,0,0,0,0,0,0,0, 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,0,0,0
DATA 0,0,0,0, 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,0,255,0,0, 255 ,0, 255 ,0
DATA 255 , 255 , 255 , 255 , 255 , 255 , 255 ,0, 255 ,0,0, 255 ,0, 255 , 255 ,0, 255 , 255 , 255 , 255
DATA 255 , 255 , 255 ,0, 255 ,0, 255 , 255 ,0, 255 ,0, 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,0
DATA 0,0, 255 ,0, 255 , 255 ,0, 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,0, 255 ,0,0, 255
DATA 0,0, 255 , 255 , 255 , 255 , 255 , 255 , 255 , 255 ,0, 255 ,0,0,0,0,0, 255 , 255 , 255
DATA 255 , 255 , 255 , 255 , 255 ,0,0, 255 ,0, 255 ,0,0, 255 , 255 , 255 , 255 , 255

END
'SYSTEM

REM $STATIC
SUB init

xpos = 1
ypos = 1
grx = 0
gry = 0


FOR y = 0 TO 9
FOR x = 0 TO 9
READ bmap(x, y)       'next loops- gets the big map
NEXT x
NEXT y

READ dimmension%
REDIM squid%(dimmension%)
FOR i% = 0 TO dimmension%    'gets the squid data
   READ squid%(i%)
   NEXT i%


READ dimmension%
REDIM squidm%(dimmension%)
FOR i% = 0 TO dimmension%     'gets the squid mask data
   READ squidm%(i%)
   NEXT i%


'these things below load the background tiles
LoadPUT "BG1.put", BG1()
LoadPUT "BG2.put", BG2()
LoadPUT "BG3.put", BG3()
LoadPUT "BG4.put", BG4()
LoadPUT "BG5.put", BG5()



xcoor(0) = 1
xcoor(1) = 33
xcoor(2) = 65
xcoor(3) = 97
xcoor(4) = 129
xcoor(5) = 161
xcoor(6) = 193
xcoor(7) = 225
xcoor(8) = 257
xcoor(9) = 289

ycoor(0) = 1
ycoor(1) = 21
ycoor(2) = 41
ycoor(3) = 61
ycoor(4) = 81
ycoor(5) = 101
ycoor(6) = 121
ycoor(7) = 141
ycoor(8) = 161
ycoor(9) = 181









FOR y = 0 TO 9
FOR x = 0 TO 9
SELECT CASE bmap(x, y)

CASE 1
PUT (xcoor(x), ycoor(y)), BG1
CASE 2
PUT (xcoor(x), ycoor(y)), BG2
CASE 3
PUT (xcoor(x), ycoor(y)), BG3
CASE 4
PUT (xcoor(x), ycoor(y)), BG4
CASE 5
PUT (xcoor(x), ycoor(y)), BG5

END SELECT
NEXT x
NEXT y

END SUB

SUB LoadPUT (File$, Array())

f = FREEFILE
OPEN File$ FOR BINARY AS #1
memsize = (LOF(1) - 7) / 2 - 1
CLOSE #1


REDIM Array(memsize)

DEF SEG = VARSEG(Array(0))
BLOAD File$, VARPTR(Array(0))

END SUB

when i try to use the PUT statements you gave me, it said illegal function call. did i do something stupid again?
Reply
#13
huh? i get subscript out of range, Ie to many subscripts, not enough memory, not illegal function call...
Reply
#14
that happens to me when i open qbasic, and then go to file, load. i get that error.


but when i double click on the .bas file from my C:\qbasic folder, i don't. i get illegal function call.
Reply
#15
Try passing the whole path to this statement:

Code:
LoadPUT "C:\my_put_files\BG1.put", BG1()
Reply
#16
what? what does that have to do with the illegal function call i get when trying to do read/data?
Reply
#17
I thought it may give you a illegal function call. No harm in trying it =P. BTW Bload will give you a "file not found" error when it doesnt locate the specified file.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)