12-05-2004, 06:39 AM
I've started to port my work to fb, and I've run into a problem.
spits out the error
The error is on the pset line. I changed it from pset x,y,255-clr,255-clr,255-clr to pset x,y,clr,clr,clr and the error appeared.
Code:
defint a-z
'option explicit
'$include: "sdl\sdl.bi"
declare sub PSET ( x as integer , y as integer, R as UBYTE , G as UBYTE, B as UBYTE )
declare sub flipScreen()
dim shared screen as SDL_Surface ptr
dim tim as integer
'dim a as string
'Dim X as integer
'Dim Y as integer
Dim T as UBYTE
dim shared MouseX as integer
dim shared MouseY as integer
dim oldtimer as double
DIM a AS SINGLE
DIM ang AS SINGLE
DIM map(0 TO 11, 0 TO 11)
DIM colrs(0 TO 150)
FOR a = 0 TO 5
colrs(a) = 31 - ((a / 50) * 16)
NEXT a
DIM angle
DIM x, y
CONST pi = 3.141579
DIM lin(0 TO 320) AS INTEGER
DIM z(0 TO 320) AS INTEGER
screen = SDL_SetVideoMode( 320, 240, 32, SDL_HWSURFACE or SDL_DOUBLEBUF)
if screen = 0 then
SDL_Quit
end 1
end if
oldtimer = timer
tim = 0
FOR a = 1 TO 10
linvar = linvar + 1
FOR b = 1 TO 10
IF INT(RND(1) * 5) = 1 THEN map(a, b) = INT(RND(1) * 5)
NEXT b
NEXT a
x = 50
y = 50
linvar = 0
WHILE k$ <> " "
linvar = 0
FOR b = 1 TO 200
bb! = b / 4
FOR a = 1 TO 320
aa! = a / 4
clr = 0
IF lin(aa!) > 0 AND bb! > z(aa!) AND bb! < (-z(aa!) + 50) THEN
'IF aa! > 50 THEN aa! = 50
'clr = 31 - (z(aa!) / 50) * z(aa!)
clr = 31 - colrs(z(aa!))'31 - (z(aa!) / 50) * z(aa!)
END IF
pset a,b,clr,clr,clr
NEXT a
NEXT b
k$ = INKEY$
IF k$ = "a" THEN ang = ang - (pi / 18)
IF k$ = "d" THEN ang = ang + (pi / 18)
IF k$ = "s" THEN x = 0! + x + (2 * COS(ang + (pi / 8))): y = y + (2 * COS(ang + (pi / 8)))
IF k$ = "w" THEN x = 0! + x - (2 * COS(ang + (pi / 8))): y = y - (2 * COS(ang + (pi / 8)))
lastb = 100
lowestb = 30000
IF initb = 3000 THEN initc = 0 ELSE initc = initb
FOR a = (pi) + ang TO (1.5 * pi) + ang STEP pi / (180)
lin(linvar) = 0
z(linvar) = 1
FOR b = initc TO lastb STEP 2
x1 = x + (b * COS(a))
y1 = y + (b * SIN(a))
IF x1 > 100 THEN EXIT FOR
IF y1 > 100 THEN EXIT FOR
IF x1 < 0 THEN EXIT FOR
IF y1 < 0 THEN EXIT FOR
'PSET (x1, y1), 1
IF (map(x1 / 10, y1 / 10) > 0) THEN
lin(linvar) = map(x1 / 10, y1 / 10)
z(linvar) = b / 2
IF b < lowestb THEN lowestb = b
EXIT FOR
END IF
NEXT b
linvar = linvar + 1
NEXT a
FlipScreen ()
'IF chengeb THEN lastb = lastb + 4 ELSE lastb = lastb - 1
'initb = lowestb * .8
'tim = tim + 1
'IF tim = 3 THEN initb = 2: lowestb = 1: tim = 0
'initb = initb + initb MOD 2
'oldlowestb = lowestb
LOCATE 1, 1
PRINT "initb"; initb
WEND
SDL_Quit
end
sub FlipScreen ()
SDL_unlocksurface screen
'SDL_PollEvent ( event )
SDL_Flip screen
SDL_LockSurface (screen)
SDL_PumpEvents
end sub
sub PSET ( x as integer , y as integer, R as UBYTE , G as UBYTE, B as UBYTE) 'A as UBYTE
dim cl as uinteger ptr
dim colkey as uinteger
dim Colptr as UBYTE ptr
colptr = @colkey : *colptr = R
colptr = @colkey + 1 : *colptr = G
colptr = @colkey + 2 : *colptr = B
'colptr = @colkey + 3 : *colptr = A
cl = screen->pixels + y * screen->pitch + x * len( integer )
*cl = colkey
end sub
spits out the error
Code:
C:\freeBASIC\hello.asm: Assembler messages:
C:\freeBASIC\hello.asm:297: Error: `%dl' not allowed with `movl'
C:\freeBASIC\hello.asm:303: Error: `%dl' not allowed with `movl'
C:\freeBASIC\hello.asm:309: Error: `%dl' not allowed with `movl'
The error is on the pset line. I changed it from pset x,y,255-clr,255-clr,255-clr to pset x,y,clr,clr,clr and the error appeared.