Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 15:58 17 Sep 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : dim var as byte

     Page 11 of 16    
Author Message
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4071
Posted: 02:52pm 10 Aug 2022
Copy link to clipboard 
Print this post

  stanleyella said  I think that's not a clear explanation.

What's "not a clear explanation"?

John
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2634
Posted: 03:35pm 10 Aug 2022
Copy link to clipboard 
Print this post

@JohnS
NOT INV invert the logical value on the right (e.g. NOT a=b is a<>b)
or bitwise inversion of the value on the right (e.g. a = INV b)

I'm used to portb.1=not portb.1 to toggle a port on/off
or frame=not frame, which I've used in mmbasic to toggle a variable

is INV a keyword like NOT?
I didn't understand (e.g. NOT a=b is a<>b)
wonder what a=inv a is, I'd have to try it cos it's not explained, imho.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2634
Posted: 03:47pm 10 Aug 2022
Copy link to clipboard 
Print this post

You could use a=a xor 1 to toggle it
if a=0 then a xor 1=1
if a=1 then a xor 1=0 ..... :)
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4071
Posted: 03:47pm 10 Aug 2022
Copy link to clipboard 
Print this post

The manual looks clear.

I can't think why you even wonder if INV is a keyword like NOT. They're together in the manual so why would you think otherwise???

The manual emphasises (bold is) that NOT a=b is a<>b. What more could it say???

It goes on to spell out exactly what INV does so how are you confused what a=inv a is???

Why not try some examples out?  It's soooo easy to try stuff!!

John
Edited 2022-08-11 01:48 by JohnS
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2634
Posted: 04:10pm 10 Aug 2022
Copy link to clipboard 
Print this post

@JohnS
I find NOT a=b is a<>b is where does b come into it?
You understand the explanation , I don't, it's me, I'm too stupid to use mmbasic, everyone else would have understood NOT a=b is a<>b.
please everyone , tell me to get another hobby that I can manage.
this explanation would make more sense to me.
a=not a will make a=1 if it was 0 or 0 if it was 1
a=inv a will invert all bits in a variable ..... which with 64bit variables is new.
 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 4071
Posted: 05:54pm 10 Aug 2022
Copy link to clipboard 
Print this post

You're not stupid, just learning something new. (You could maybe try things on a device more, though.)

So,

NOT a=b

being the same as

a<>b

Simply means anywhere you might in a program put NOT a=b you may as well have written a<>b and it'll overall do the same thing.

I guess in actuality no-one uses NOT a=b (partly because a<>b is better known and a bit shorter).

Further, perhaps anyone using NOT a=b actually means

(NOT a)=b

though I think that's also an unlikely expression (i.e. I can't recall ever seeing it in a program).

John
Edited 2022-08-11 03:55 by JohnS
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2634
Posted: 06:47pm 10 Aug 2022
Copy link to clipboard 
Print this post

@JohnS
at my age I can be stupid. something new is no excuse.
The manual is very,very, good.
but for a new user to mmbasic can be "difficult to relate to" ie previous basics.
yeah. forget previous basics... er.. and all the for/next do/loop sub/end sub er not really. I use all previous basic as a start with mmbasic and lots of the "basic" basic works.
I think using your favourite software with the hardware you want should be "fun"
ie. an enjoyable experience. mmbasic /mmedit/rp2040pico seems easy enough to be an open canvas to do your thing with a ucontroller and enjoy it when your code works :)
please forgive new users ignorance.
I used
               if frame=0 then'which sprite to draw
                 erase_sprite 'erase sprite at last position
                 sprite1 'draw sprite1 at new position

               else
                 erase_sprite 'erase sprite at last position
                 sprite2 'draw sprite2 at new position
               end if
'            end if
'       end if
   next temp
 '
   frame_count=frame_count+1 'when to change sprite
   if frame_count=5 then
     frame=not frame
     frame_count=0
   end if

and it works but as I said could be frame=frame xor 1 ... dunno which fastest
not frame or frame xor 1
 
pwillard
Guru

Joined: 07/06/2022
Location: United States
Posts: 313
Posted: 08:24pm 10 Aug 2022
Copy link to clipboard 
Print this post

You are falling into a trap.  Do not try to optimize your code while you are writing it...

Step 1: Get your code working.
Step 2: Release as an Alpha and get feedback from other people, so you can fix bugs
Step 3: After fixing bugs, call it a Beta release and say it's "DONE"
Step 4: Now... start to optimize your code.
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2634
Posted: 09:20pm 10 Aug 2022
Copy link to clipboard 
Print this post

@gwillard
I got a few basic programs working and transferring a working logic program is to me the best way to learn the difference between mmbasic and other basic.
the "space invaders" logic works so adapt to mmbasic seems the way,not start from scratch. it seems easier to convert and test blocks like I can draw alternating white and blue boxes instead of alternating "sprites" using same code.
This has led me to need to copy sprites to blit buffer which I'm working on.
if I was using vga blit there's a youtube video explaining it's fast and uses dma and the gpio chip ???
but I'm using spi and it "should" be fast enough. Not using pixel for drawing chars each frame but draw once and blit then use the buffer. Totally new to learn but the only way of fast 16x16 "sprites"
I've ran out of projects to do This laser range hasn't been done in mmbasic or no one's boasting about it.  https://www.youtube.com/watch?v=s5-5DNa36jk
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6302
Posted: 10:18pm 10 Aug 2022
Copy link to clipboard 
Print this post

  stanleyella said  @JohnS
I find NOT a=b is a<>b is where does b come into it?
You understand the explanation , I don't,

'
 OPTION EXPLICIT
 OPTION DEFAULT INTEGER
 
 DIM a = 10, b = 9
 
' NOT is used for logical expressions
 IF a=b THEN
   PRINT "equal"
 ELSE
   PRINT "Not equal"
 ENDIF
 
 IF NOT (a=b) THEN
   PRINT "Not equal"
 ENDIF
 
' INV is used for bitwise NOT.
 
 PRINT BIN$(a,64)
 b = INV a
 PRINT BIN$(b,64)
PRINT a, b


>
RUN
Not equal
Not equal
0000000000000000000000000000000000000000000000000000000000001010
1111111111111111111111111111111111111111111111111111111111110101
10    -11
>


Some languages use the same operator for both bitwise and logical.

The brackets around the expression (a=b) is a good idea so you are confident about the precedence.

There are plenty of shortcuts used to speed up the program but as others have advised, get it working first.

Jim
Edited 2022-08-11 08:19 by TassyJim
VK7JH
MMedit
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2634
Posted: 05:07pm 11 Aug 2022
Copy link to clipboard 
Print this post

@vegipete I got it working with blit. It works fast but it says only 8 blit buffers???
Thankyou for your posts, and all the other folk who have spent time to help me use mmbasic. This is a step away from a game  https://www.youtube.com/watch?v=eqhvg-39tgY
please show how to improve code for mmbasic ie variable definitions.

'a simple "sprite" demo... learning mmbasic
OPTION BASE 0        ' 0 based arrays
OPTION EXPLICIT
dim integer dx(7),dy(7),spx(7),spy(7)
dim integer cannon%(119),missile%(15),oldspx%(7),oldspy%(7)
dim integer ptr,hiscore,spw%,spht%,temp%,frame%,frame_count%,spdata%
dim sp1 integer
hiscore=0
CONST bk = RGB(BLack)
const wh = rgb(white)
const bl = rgb(blue)
const gr = rgb(green)
const cy = rgb(cyan)
const re = rgb(red)
const ma = rgb(magenta)
const ye = rgb(yellow)
const br = rgb(brown)
'
restore

cls
udg1 'draws sprite1 on screen
BLIT READ 1,10,10,16,16 'reads sprite1 from screen to blit buffer1
udg1 'draws sprite2 on screen
blit read 2,10,10,16,16 'reads sprite2 from screen to blit buffer2
cls
blit read 3,10,10,16,16 'reads 16x16 background to blit buffer3
'
for temp=0 to 7 'set up start sprite positions and directions
do
 dx(temp)=(int(rnd*8)+1)-4 'set up start sprite positions and directions
loop until dx(temp)<>0
do
 dy(temp)=(int(rnd*8)+1)-4
loop until dy(temp)<>0
 spx(temp)=104+((rnd*16)+1)
 spy(temp)=144+((rnd*16)+1)    
'  sprite_status(temp)=1 'activate sprite
next
'
do 'demo moving sprite
   for temp=0 to 7
'        if sprite_status(temp)=1 then 'is sprite active
           if spx(temp)> 300 then 'check right edge
             dx(temp)= 0-dx(temp)
           end if
           if spx(temp)<8 then 'check left edge
             dx(temp)= 0-dx(temp)
           end if
           if spy(temp)>220 then 'check bottom edge
             dy(temp)= 0-dy(temp)
           end if
           if spy(temp)<32 then 'check top edge
             dy(temp)= 0-dy(temp)
           end if
     '
           oldspx(temp)=spx(temp):oldspy(temp)=spy(temp) 'get last position for erase
           spx(temp)=spx(temp)+dx(temp):spy(temp)=spy(temp)+dy(temp) 'get new position for draw
     '
'            if sprite_status(temp)=1 then 'is sprite active
               if frame=0 then'which sprite to draw
                 erase_sprite 'erase sprite at last position
                 sprite1 'draw sprite1 at new position
               else
                 erase_sprite 'erase sprite at last position
                 sprite2 'draw sprite2 at new position
               end if
'            end if
'       end if
   next temp
 '
   frame_count=frame_count+1 'when to change sprite
   if frame_count=5 then
     frame=not frame
     frame_count=0
   end if
loop 'end of main program
'-------------------------
sub udg1 'draws 16x16 data on screen
 for spht=0 to 15
   for spw=0 to 15
     read sp1
     pixel spw+10,spht+10,sp1
   next spw
 next spht
end sub
'
sub sprite1 'draws sprite1
 BLIT WRITE 1,spx(temp),spy(temp), 16, 16
end sub
'
sub sprite2 'draws sprite2
 BLIT WRITE 2,spx(temp),spy(temp), 16, 16
end sub
'
sub erase_sprite 'fills window background colour
 BLIT WRITE 3,oldspx(temp),oldspy(temp), 16, 16
end sub
'
'sprite1
data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh
data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk
data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk
data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk
data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk
'sprite2
data bl,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,bl
data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk
data bk,bk,bl,wh,wh,re,bl,bk,bk,bl,re,wh,wh,bl,bk,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,ye,ye,bk,bk,ye,ye,bk,bk,bk,bk,bk
data bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk
data bk,bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk,bk
data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk
data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk
data bk,bk,bk,ye,ye,bk,bk,bk,bk,bk,bk,ye,ye,bk,bk,bk
data bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk
data bk,bk,bk,bk,bk,ye,bk,bk,bk,bk,ye,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,ye,bk,bk,ye,bk,bk,bk,bk,bk,bk
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4321
Posted: 05:11pm 11 Aug 2022
Copy link to clipboard 
Print this post

Hi Stan,

Please start your code snippets with:
   <CODE>

and end them with:
   </CODE>

Replacing the < > with [ ].

Thanks, Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
lizby
Guru

Joined: 17/05/2016
Location: United States
Posts: 3412
Posted: 05:32pm 11 Aug 2022
Copy link to clipboard 
Print this post

Note that "dim sp1 integer" still does not result in sp1 being an integer:

>dim sp1 integer
> sp1=4
> sp1=sp1/3
> ?sp1
1.333333333
> new
> dim integer sp1
> sp1=4
> sp1=sp1/3
> ?sp1
1

It may not alter the displayed outcome, but it could affect the speed of your loop within a loop if "read sp1" results in an integer constant being converted to a float, and "pixel spw+10,spht+10,sp1" results in a float being converted to an integer.
PicoMite, Armmite F4, SensorKits, MMBasic Hardware, Games, etc. on fruitoftheshed
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2634
Posted: 05:58pm 11 Aug 2022
Copy link to clipboard 
Print this post

  lizby said  Note that "dim sp1 integer" still does not result in sp1 being an integer:

>dim sp1 integer
> sp1=4
> sp1=sp1/3
> ?sp1
1.333333333
> new
> dim integer sp1
> sp1=4
> sp1=sp1/3
> ?sp1
1

It may not alter the displayed outcome, but it could affect the speed of your loop within a loop if "read sp1" results in an integer constant being converted to a float, and "pixel spw+10,spht+10,sp1" results in a float being converted to an integer.

dim sp1 integer-dim integer sp1
Thanks lizby sir. I tried but need someone to put me straight how to set variables in mmbasic.. it gave error messages what ever I tried and this code worked with out errors.
it works and fast but open to failure if there's way for it to go wrong.
you got to appreciate the joy of it working after staying up late at night getting nowhere. ok it worked with software sprites but unusably slow. with blit it's usable.
I don't want mmbasic to be difficult to learn but on the forum folk think I'm stupid or I don't read the manual or take advice. That's not true.. except stupid.
It's carp being a new user when you just want to convert existing code that works.
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8080
Posted: 06:30pm 11 Aug 2022
Copy link to clipboard 
Print this post

The section of the manual on DIM (in the Commands section) says nothing about
DIM nbr INTEGER
so I'm not sure where you got that. It's not likely to work, is it?  :)

It does mention
DIM INTEGER nbr(50) 'i.e. the variable is after the type
and
DIM amount AS FLOAT 'i.e. AS lets you put the variable first (Microsoft style)

You can do multiple DIMs on a line. e.g.
DIM INTEGER num1, num2, x, y, z
or
DIM AS1 AS STRING, I2 AS INTEGER, F11 AS FLOAT, array(5) AS INTEGER

You can also DIM an array to a variable number of elements:
CONST number_of_fields = 9
DIM field_array(number_of_fields) AS STRING, field_flags(number_of_fields) AS INTEGER


May I ask which versions of BASIC you've been familiar with? I have a feeling that they weren't based on GWBASIC.
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2634
Posted: 07:40pm 11 Aug 2022
Copy link to clipboard 
Print this post

I tried
OPTION BASE 0        ' 0 based arrays
OPTION EXPLICIT
dim dx%(7),dy%(7),spx%(7),spy%(7)
dim cannon%(119),missile%(15),oldspx%(7),oldspy%(7)
dim ptr%,hiscore%,spw%,spht%,temp%,frame%,frame_count%,spdata%,sp1%
hiscore%=0
I got rid of subs
               if frame%=0 then'which sprite to draw
                 BLIT WRITE 3,oldspx%(temp%),oldspy%(temp%), 16, 16 'erase sprite at last position
                 BLIT WRITE 1,spx%(temp%),spy%(temp%), 16, 16 'draw sprite1 at new position
               else
                 BLIT WRITE 3,oldspx%(temp%),oldspy%(temp%), 16, 16 'erase sprite at last position
                 BLIT WRITE 2,spx%(temp%),spy%(temp%), 16, 16 'draw sprite2 at new position
               end if

all variables have% is that the way? My "sprites" now move fast,maybe faster.
are my variables ok now?
<code>
'a simple way of moving 8 user defined graphics as fast as possible.
OPTION BASE 0        ' 0 based arrays
OPTION EXPLICIT
dim dx%(7),dy%(7),spx%(7),spy%(7)
dim cannon%(119),missile%(15),oldspx%(7),oldspy%(7)
dim ptr%,hiscore%,spw%,spht%,temp%,frame%,frame_count%,spdata%,sp1%
hiscore%=0
CONST bk = RGB(BLack)
const wh = rgb(white)
const bl = rgb(blue)
const gr = rgb(green)
const cy = rgb(cyan)
const re = rgb(red)
const ma = rgb(magenta)
const ye = rgb(yellow)
const br = rgb(brown)
'
restore

cls
udg1 'draws sprite1 on screen at 10,10
BLIT READ 1,10,10,16,16 'reads sprite1 from screen to blit buffer1
udg1 'draws sprite2 on screen at 10,10
blit read 2,10,10,16,16 'reads sprite2 from screen to blit buffer2
cls
blit read 3,10,10,16,16 'reads 16x16 background to blit buffer3
'
for temp%=0 to 7 'set up start sprite positions and directions
do
 dx%(temp%)=(int(rnd*8)+1)-4 'set up start sprite positions and directions
loop until dx%(temp%)<>0
do
 dy%(temp%)=(int(rnd*8)+1)-4
loop until dy%(temp%)<>0
 spx%(temp%)=104+((rnd*16)+1)
 spy%(temp%)=144+((rnd*16)+1)    
next
'
do 'demo moving sprite
   for temp%=0 to 7
'        if sprite_status(temp)=1 then 'is sprite active
           if spx%(temp%)> 300 then 'check right edge
             dx%(temp%)= 0-dx%(temp%)
           end if
           if spx%(temp%)<8 then 'check left edge
             dx%(temp%)= 0-dx%(temp%)
           end if
           if spy%(temp%)>220 then 'check bottom edge
             dy%(temp%)= 0-dy%(temp%)
           end if
           if spy%(temp%)<32 then 'check top edge
             dy%(temp%)= 0-dy%(temp%)
           end if
     '
           oldspx%(temp%)=spx%(temp%):oldspy%(temp%)=spy%(temp%) 'get last position for erase
           spx%(temp%)=spx%(temp%)+dx%(temp%):spy%(temp%)=spy%(temp%)+dy%(temp%) 'get new position for draw
     '
               if frame%=0 then'which sprite to draw
                 BLIT WRITE 3,oldspx%(temp%),oldspy%(temp%), 16, 16 'erase sprite at last position
                 BLIT WRITE 1,spx%(temp%),spy%(temp%), 16, 16 'draw sprite1 at new position
               else
                 BLIT WRITE 3,oldspx%(temp%),oldspy%(temp%), 16, 16 'erase sprite at last position
                 BLIT WRITE 2,spx%(temp%),spy%(temp%), 16, 16 'draw sprite2 at new position
               end if
   next temp%
 '
   frame_count%=frame_count%+1 'when to change sprite
   if frame_count%=5 then
     frame%=not frame%
     frame_count%=0
   end if
loop
'
sub udg1 'draws 16x16 data
 for spht%=0 to 15
   for spw%=0 to 15
     read sp1%
     pixel spw%+10,spht%+10,sp1%
   next spw%
 next spht%
end sub
'
'sprite1
data wh,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,wh
data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk
data bk,bk,bk,bk,ye,ye,ye,bk,bk,ye,ye,ye,bk,bk,bk,bk
data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk
data bk,ye,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,ye,bk
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bl,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye
data bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk
data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk
'sprite2
data bl,bl,bl,bl,bl,bk,bk,bk,bk,bk,bk,bl,bl,bl,bl,bl
data bk,bl,re,re,re,bl,bl,bk,bk,bl,bl,re,re,re,bl,bk
data bk,bk,bl,wh,wh,re,bl,bk,bk,bl,re,wh,wh,bl,bk,bk
data bk,bk,bk,bl,re,wh,bl,bk,bk,bl,wh,re,bl,bk,bk,bk
data bk,bk,bk,bk,bl,wh,bl,bk,bk,bl,wh,bl,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bl,bl,bk,bk,bl,bl,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,ye,ye,bk,bk,ye,ye,bk,bk,bk,bk,bk
data bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk
data bk,bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk,bk
data bk,bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk,bk
data bk,bk,ye,bk,bk,bk,bk,bk,bk,bk,bk,bk,bk,ye,bk,bk
data bk,bk,bk,ye,ye,bk,bk,bk,bk,bk,bk,ye,ye,bk,bk,bk
data bk,bk,bk,bk,ye,ye,bk,bk,bk,bk,ye,ye,bk,bk,bk,bk
data bk,bk,bk,bk,bk,ye,bk,bk,bk,bk,ye,bk,bk,bk,bk,bk
data bk,bk,bk,bk,bk,bk,ye,bk,bk,ye,bk,bk,bk,bk,bk,bk
</CODE>
I couldn't have got even this far without the help from the forum,
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4321
Posted: 07:52pm 11 Aug 2022
Copy link to clipboard 
Print this post

Oh for Pete's sake, Gizmo are there admin privileges I could have so I can edit the formatting in some of these posts ? .

Sorry Stan, I know you tried. The CODE and /CODE markers need to be in [SQUARE] brackets, I can't show you that literally because it will then be rendered as code instead of showing the markers.

Best wishes,

Tom
Edited 2022-08-12 05:53 by thwill
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
Mixtel90

Guru

Joined: 05/10/2019
Location: United Kingdom
Posts: 8080
Posted: 08:09pm 11 Aug 2022
Copy link to clipboard 
Print this post

Stan:  If you put CODE and /CODE in square brackets at the beginning and end you get this:

'This is code

for I=1 to 5
print i
next


The SQUARE brackets are an instruction to the forum page to display the enclosed text in a special manner.
Edited 2022-08-12 06:24 by Mixtel90
Mick

Zilog Inside! nascom.info for Nascom & Gemini
Preliminary MMBasic docs & my PCB designs
 
thwill

Guru

Joined: 16/09/2019
Location: United Kingdom
Posts: 4321
Posted: 08:11pm 11 Aug 2022
Copy link to clipboard 
Print this post

There is also a [Preview Post] button that you can use before [Save Post] so you can see if it's being formatted correctly .

Best wishes,

Tom
MMBasic for Linux, Game*Mite, CMM2 Welcome Tape, Creaky old text adventures
 
stanleyella

Guru

Joined: 25/06/2022
Location: United Kingdom
Posts: 2634
Posted: 08:32pm 11 Aug 2022
Copy link to clipboard 
Print this post

[
              if frame%=0 then'which sprite to draw
                BLIT WRITE 3,oldspx%(temp%),oldspy%(temp%), 16, 16 'erase sprite at last position
                BLIT WRITE 1,spx%(temp%),spy%(temp%), 16, 16 'draw sprite1 at new position
              else
                BLIT WRITE 3,oldspx%(temp%),oldspy%(temp%), 16, 16 'erase sprite at last position
                BLIT WRITE 2,spx%(temp%),spy%(temp%), 16, 16 'draw sprite2 at new position
              end if
]

what's that do?
 
     Page 11 of 16    
Print this page
The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025