The second and third arguments are horizontal/vertical magnification factor of the sprite. In your first screenshot, these are too large.
Try reducing them (less than 10).
In your self made command, you should define local variables.
In this case, you should write "VAR W,H,A" at the top of GARRAY command as follows.
COMMON DEF GARRAY D
VAR W,H,A :'<-
H=400/LEN(D)
:
:
You need not only "SPCOL 1" but also "SPCOL 2".
I also recommend you to do as follows.
#1: Write "1" instead of "0.001" in line 15-18.
#2: Insert "VSYNC 1" between line 20 and 21.
The method for BG collision detection is quite simple.
When the sprite coordinates on the screen are given as X and Y, the BG tile number is given by "BGGET(L,X,Y,1)". (L stands for BG layer number.)