waht ist error : gal ?

All aspects of programming on the Commander X16.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

waht ist error : gal ?

Post by funkheld »

Hi good afternoon.

what is error: gal please?

Thanks.
greeting

Code: Select all


I=40
POKE $9F37,I

START:
  GET A$ 
  B=ASC(A$)
  IF B=82 THEN GOSUB SCRLINKS
  IF B=84 THEN GOSUB SCRRECHTS
  SLEEP 1
GOTO START

SCRRECHTS:
  I=(I-1) AND 255
  IF I=0 THEN
    U=U-1
    POKE $9F38,U 
    I=255
  END IF	
  POKE $9F37,I
RETURN	

SCRLINKS:
  I=(I+1) AND 255
  IF I=0 THEN
    U=U+1
    POKE $9F38,U
  END IF		 	
  POKE $9F37,I	  
RETURN
Attachments
gal.jpg
gal.jpg (30.74 KiB) Viewed 2050 times
User avatar
desertfish
Posts: 1101
Joined: Tue Aug 25, 2020 8:27 pm
Location: Netherlands

Re: waht ist error : gal ?

Post by desertfish »

you sneaky sneaky scrolled the error message outside of the visible screen I guess!

It's part of ILLEGAL QUANTITY ERROR.
hstubbs3
Posts: 72
Joined: Thu Oct 26, 2023 12:14 pm

Re: waht ist error : gal ?

Post by hstubbs3 »

Man, I hate when I get GAL QUANTITY ERRORs .... There's just never the right amount of femininity when you need it most.

?ILLEGAL

Each letter is 8 pixels wide..
You scrolled ? I L L E => 5x8 = 40 pixels and then got the error..

I tried just copy/paste that code into the online emulator and got illegal quantity error for POKE $9F38,U


The bit of code provded never sets a value for U ?

I=40 is at the start ..

but how can I U=U-1 or POKE $9F38,U if U isn't set???


If that doesn't help please fill in more details about the code in question.
Edmond D
Posts: 491
Joined: Thu Aug 19, 2021 1:42 am

Re: waht ist error : gal ?

Post by Edmond D »

hstubbs3 wrote: Tue Mar 26, 2024 10:49 pm Man, I hate when I get GAL QUANTITY ERRORs .... There's just never the right amount of femininity when you need it most.
GAL can also stand for "Get A Life", which I'm sure some people may tell me after I talk about the retro computer movement and the CX16. :D

Or it could also stand for Generic Array Logic - https://en.wikipedia.org/wiki/Generic_Array_Logic

That being said, given the butterfly is chopped in half in the original screen capture, dessertfish has provided the correct answer.
hstubbs3
Posts: 72
Joined: Thu Oct 26, 2023 12:14 pm

Re: waht ist error : gal ?

Post by hstubbs3 »

Edmond D wrote: Tue Mar 26, 2024 11:18 pm
hstubbs3 wrote: Tue Mar 26, 2024 10:49 pm Man, I hate when I get GAL QUANTITY ERRORs .... There's just never the right amount of femininity when you need it most.
GAL can also stand for "Get A Life", which I'm sure some people may tell me after I talk about the retro computer movement and the CX16. :D

Or it could also stand for Generic Array Logic - https://en.wikipedia.org/wiki/Generic_Array_Logic

That being said, given the butterfly is chopped in half in the original screen capture, dessertfish has provided the correct answer.
Indeed, I was actually more concerned with which line of the code was giving the error..
I'm still an impulsive nerd so of course I has to make some attempt at humor in the process.


Funkheld, U=U-1 ...

is U allowed to go negative and still be POKEd into some location in memory?

You may need to instead have U count UP to 256 and then POKE $9F38,256-U

or... actually, the scroll registers wrap at 1024, which is larger than 1 BYTE ... to make negative would be something like
POKE $9F38,U+256
POKE $9F39,$FF

can only POKE 0-255 ... fractional and negative POKEs are not allowed. Imaginary or Complex POKEs are strictly prohibited.
DAng it I think I already made a Holy Hand Grenade reference this week...
User avatar
ahenry3068
Posts: 1151
Joined: Tue Apr 04, 2023 9:57 pm

Re: waht ist error : gal ?

Post by ahenry3068 »

BASIC will not raise an error on the following.

POKE $400, 3.9


However what is happening is it's just discarding everything after the Decimal. So the above is the same as POKE $400, 3
kelli217
Posts: 535
Joined: Sun Jul 05, 2020 11:27 pm

Re: waht ist error : gal ?

Post by kelli217 »

It is forbidden to POKE a negative number into any address; POKE is only valid for unsigned values that fit into a single byte. Your U=U-1 statement reaches a value of 0 and then goes below it, and this causes the error. You should have bounds checking in your code to prevent this, such as:

U = U - 1 : IF U < 0 THEN U = 0
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: waht ist error : gal ?

Post by funkheld »

You can scroll the screen the textmode : 128 bytes right and left and 60 bytes up and down.
1 ascii has 2 bytes

Here you can scroll infinitely to the right and left.
U will not be minus because U is a byte in prog8 .
the program with prog8 works.
That's why my question was with byte, which changes the value at 255.

greeting

Code: Select all

%import graphics
%import math
%import textio
%import palette
%import syslib
%import diskio

main {
        ubyte background_color
	ubyte radius
	ubyte color
	ubyte z
	ubyte u
	ubyte x
	ubyte y
	
    sub start() {
	
	   cx16.screen_mode(128, false)
           graphics.enable_bitmap_mode()
		
	   void diskio.vload_raw("funkpal.pal", 1, $fa00 )
            void diskio.vload_raw("test.raw", 0, 0)
		
	    draw_circles()
	    txt.plot(6,10)
	    txt.print("schiebe screen")
		
	    z=40
	    poke($9F37,z) 

    waitkey:	  
	  sys.waitvsync()
	  ubyte key=cbm.GETIN()
          keypress(key)
	  goto waitkey
	
    }	
	
	sub keypress(ubyte key) {
        when key {
		  'r' -> sl()
		  't' -> sr()
        }
    }

    sub draw_circles() {
          x=100
	  y=100
	  radius=30	
      color = 7
	  
      graphics.colors(color, 0)
      graphics.disc(x, y , radius)
	  
      x=200 
      y=100
      radius=30	
      color = 189
	  
      graphics.colors(color, 0)
      graphics.disc(x, y , radius)
    }
	
	sub sr() {
	   z=z-1
	   if z==0 {
	     u=u-1
             poke($9F38,u) 
	     z=255
          } 	
	  poke($9F37,z)
    }
	
	sub sl() {
	    z=z+1
	    if z==0 {
	      u=u+1
              poke($9F38,u) 
            } 	
            poke($9F37,z) 	  
       }
	    
}
Attachments
text.jpg
text.jpg (35.13 KiB) Viewed 1907 times
scroll.jpg
scroll.jpg (53.96 KiB) Viewed 1910 times
schiebe.jpg
schiebe.jpg (67.38 KiB) Viewed 1921 times
Last edited by funkheld on Wed Mar 27, 2024 8:21 am, edited 10 times in total.
funkheld
Posts: 322
Joined: Mon Feb 26, 2024 11:11 am

Re: waht ist error : gal ?

Post by funkheld »

------------------------------------
but how can I U=U-1 or POKE $9F38,U if U isn't set???
-------------------------------------
U does not need to be set in basic, it is 0

bas basic program is ready above.

Thanks.
greeting
hstubbs3
Posts: 72
Joined: Thu Oct 26, 2023 12:14 pm

Re: waht ist error : gal ?

Post by hstubbs3 »

funkheld wrote: Wed Mar 27, 2024 7:46 am ------------------------------------
but how can I U=U-1 or POKE $9F38,U if U isn't set???
-------------------------------------
U does not need to be set in basic, it is 0

bas basic program is ready above.

Thanks.
greeting
Then your basic code is trying to POKE $9F39, -1
and can't poke negative...

In prog8 it would almost work.. -1 represented in a BYTE would be $FF => 255 ...
scrolling horizontally to 255 would not be same as -1 unless the screen width was 256 though..
for 320x240 screen.. say..

say the tile map is 64 tiles wide - 512 pixels..
The loop could be something like this -

U = U-1
IF U<0 :
U=512-1

IF U>255:
POKE $9F38,U-256
POKE $9F39,1
ELSE:
POKE $9F38,U
POKE $9F39,0
Post Reply