I've taken the comments out.
The code is:
Code: Select all
#define inbox(c,mx,my) (mx)>(c.x-c.r) and (mx)<(c.x+c.r) and (my)>(c.y-c.r) and (my)<(c.y+c.r)
type box
as integer x,y,r
end type
dim as integer mx,my
screen 19,,2
screenset 1,0
dim as box b1,b2
b1.x=200
b1.y=200
b1.r=50
b2.x=500
b2.y=200
b2.r=50
do
getmouse mx,my
cls
line(b1.x-b1.r,b1.y-b1.r)-(b1.x+b1.r,b1.y+b1.r),3,bf
line(b2.x-b2.r,b2.y-b2.r)-(b2.x+b2.r,b2.y+b2.r),3,bf
if inbox(b1,mx,my) or inbox(b2,mx,my) then
beep
end if
flip
sleep 1,1
loop until len(inkey)
The hexdump is:
Code: Select all
E:\hexdunp>sfk172 hexdump -showle testmacro.bas
:file testmacro.bas
>0D0A2364 6566696E 6520696E 626F7828< ..#define inbox( 00000000
>632C6D78 2C6D7929 20286D78 293E2863< c,mx,my) (mx)>(c 00000010
>2E782D63 2E722920 616E6420 286D7829< .x-c.r) and (mx) 00000020
>3C28632E 782B632E 72292061 6E642028< <(c.x+c.r) and ( 00000030
>6D79293E 28632E79 2D632E72 2920616E< my)>(c.y-c.r) an 00000040
>6420286D 79293C28 632E792B 632E7229< d (my)<(c.y+c.r) 00000050
>200D0A0D 0A747970 6520626F 780D0A20< ....type box.. 00000060
>20202061 7320696E 74656765 7220782C< as integer x, 00000070
>792C720D 0A656E64 20747970 650D0A0D< y,r..end type... 00000080
>0A64696D 20617320 696E7465 67657220< .dim as integer 00000090
>6D782C6D 790D0A0D 0A736372 65656E20< mx,my....screen 000000A0
>31392C2C 320D0A73 63726565 6E736574< 19,,2..screenset 000000B0
>20312C30 0D0A6469 6D206173 20626F78< 1,0..dim as box 000000C0
>2062312C 62320D0A 62312E78 3D323030< b1,b2..b1.x=200 000000D0
>0D0A6231 2E793D32 30300D0A 62312E72< ..b1.y=200..b1.r 000000E0
>3D35300D 0A0D0A62 322E783D 3530300D< =50....b2.x=500. 000000F0
>0A62322E 793D3230 300D0A62 322E723D< .b2.y=200..b2.r= 00000100
>35300D0A 646F0D0A 20202020 6765746D< 50..do.. getm 00000110
>6F757365 206D782C 6D790D0A 20202020< ouse mx,my.. 00000120
>636C730D 0A202020 206C696E 65286231< cls.. line(b1 00000130
>2E782D62 312E722C 62312E79 2D62312E< .x-b1.r,b1.y-b1. 00000140
>72292D28 62312E78 2B62312E 722C6231< r)-(b1.x+b1.r,b1 00000150
>2E792B62 312E7229 2C332C62 660D0A20< .y+b1.r),3,bf.. 00000160
>2020206C 696E6528 62322E78 2D62322E< line(b2.x-b2. 00000170
>722C6232 2E792D62 322E7229 2D286232< r,b2.y-b2.r)-(b2 00000180
>2E782B62 322E722C 62322E79 2B62322E< .x+b2.r,b2.y+b2. 00000190
>72292C33 2C62660D 0A202020 200D0A20< r),3,bf.. .. 000001A0
>20202069 6620696E 626F7828 62312C6D< if inbox(b1,m 000001B0
>782C6D79 2920206F 72202069 6E626F78< x,my) or inbox 000001C0
>2862322C 6D782C6D 79292074 68656E20< (b2,mx,my) then 000001D0
>0D0A2020 20206265 65700D0A 20202020< .. beep.. 000001E0
>656E6420 69660D0A 20202020 666C6970< end if.. flip 000001F0
>0D0A2020 2020736C 65657020 312C310D< .. sleep 1,1. 00000200
>0A202020 206C6F6F 7020756E 74696C20< . loop until 00000210
>6C656E28 696E6B65 7929< len(inkey) 00000220
I got the hexdump console from:
http://www.stahlworks.com/dev/index.php?tool=hexdump
I popped it on to a usb pen and ran it from there.