RE: Proggies - SMcNeill - 07-02-2024
Code: (Select All)
_TITLE"Carnivore's Text Message"' b+ 2024-07-01
SCREEN _NEWIMAGE(4, 1, 0) 'Steve mod for SCREEN 0
f& = _LOADFONT("arial.ttf", 128, "MONOSPACE")
_FONT f&
COLOR 31: LOCATE 1, 1: PRINT "M";
COLOR 15: LOCATE 1, 2: PRINT "EAT";
a$ = INPUT$(1)
(I've got to say, that's one of the oddest ways I've seen for a Toggle for some time. Usually it's just "Toggle = NOT Toggle".)
RE: Proggies - vince - 07-02-2024
yeah nice toggle, B+. reminds me of the old assembly optimization of SUB ax,ax (ie x = x - x) or XOR ax,ax (ie x = x xor x) in order to set a value to zero because it was slightly faster than a MOV ax, 0. As Steve pointed out, there's a kind of duality between arithmetic and boolean
a tip for when you want to toggle between two values is to just XOR it by (a XOR b) ie
Code: (Select All) value1 = 49
value2 = 21
x = value1
for i=0 to 5
print x
x = x xor (value1 xor value2)
next
RE: Proggies - bplus - 07-02-2024
(07-02-2024, 12:59 AM)SMcNeill Wrote: Code: (Select All)
_TITLE"Carnivore's Text Message"' b+ 2024-07-01
SCREEN _NEWIMAGE(4, 1, 0) 'Steve mod for SCREEN 0
f& = _LOADFONT("arial.ttf", 128, "MONOSPACE")
_FONT f&
COLOR 31: LOCATE 1, 1: PRINT "M";
COLOR 15: LOCATE 1, 2: PRINT "EAT";
a$ = INPUT$(1)
(I've got to say, that's one of the oddest ways I've seen for a Toggle for some time. Usually it's just "Toggle = NOT Toggle".)
that's very interesting as well, I did try screen 0 first, nothing but trouble
Code: (Select All) _Title "Carnivore message" ' b+ 2024-07-01
'Screen _NewImage(500, 130, 32)
f& = _LoadFont("arial.ttf", 128, "MONOSPACE")
_Font f&
While _KeyDown(27) = 0
Cls
toggle = 1 - toggle
If toggle = 0 Then Print " EAT"; Else Print "MEAT";
_Display
_Limit 1
Wend
do not attempt above code unless you know Alt+F4, apparently the font changes the default screen size to gigantic.
RE: Proggies - bplus - 07-02-2024
@vince you old dog, thats pretty cool too!
Funny I didn't think anyone would reply to this little ditty, I was just getting bored with You Tubes in Carnivore community they all have the one BASIC message
BTW I think I got that method of toggle either from R Frost AKA ChiaPet but he was going for 0, -1 or tsh73 a Russian computer teacher at JB, probably both. I have been using it for quite awhile.
RE: Proggies - SMcNeill - 07-02-2024
(07-02-2024, 01:53 PM)bplus Wrote: (07-02-2024, 12:59 AM)SMcNeill Wrote: Code: (Select All)
_TITLE"Carnivore's Text Message"' b+ 2024-07-01
SCREEN _NEWIMAGE(4, 1, 0) 'Steve mod for SCREEN 0
f& = _LOADFONT("arial.ttf", 128, "MONOSPACE")
_FONT f&
COLOR 31: LOCATE 1, 1: PRINT "M";
COLOR 15: LOCATE 1, 2: PRINT "EAT";
a$ = INPUT$(1)
(I've got to say, that's one of the oddest ways I've seen for a Toggle for some time. Usually it's just "Toggle = NOT Toggle".)
that's very interesting as well, I did try screen 0 first, nothing but trouble
Code: (Select All) _Title "Carnivore message" ' b+ 2024-07-01
'Screen _NewImage(500, 130, 32)
f& = _LoadFont("arial.ttf", 128, "MONOSPACE")
_Font f&
While _KeyDown(27) = 0
Cls
toggle = 1 - toggle
If toggle = 0 Then Print " EAT"; Else Print "MEAT";
_Display
_Limit 1
Wend
do not attempt above code unless you know Alt+F4, apparently the font changes the default screen size to gigantic.
Here's what you were looking for, with the above:
Code: (Select All)
_TITLE "Carnivore message" ' b+ 2024-07-01
'Screen _NewImage(500, 130, 32)
WIDTH 4, 1
f& = _LOADFONT("arial.ttf", 128, "MONOSPACE")
_FONT f&
WHILE _KEYDOWN(27) = 0
CLS
toggle = 1 - toggle
LOCATE 1, 1
IF toggle = 0 THEN PRINT " EAT"; ELSE PRINT "MEAT";
_DISPLAY
_LIMIT 1
WEND
RE: Proggies - bplus - 07-02-2024
(07-02-2024, 03:07 PM)SMcNeill Wrote: (07-02-2024, 01:53 PM)bplus Wrote: (07-02-2024, 12:59 AM)SMcNeill Wrote: Code: (Select All)
_TITLE"Carnivore's Text Message"' b+ 2024-07-01
SCREEN _NEWIMAGE(4, 1, 0) 'Steve mod for SCREEN 0
f& = _LOADFONT("arial.ttf", 128, "MONOSPACE")
_FONT f&
COLOR 31: LOCATE 1, 1: PRINT "M";
COLOR 15: LOCATE 1, 2: PRINT "EAT";
a$ = INPUT$(1)
(I've got to say, that's one of the oddest ways I've seen for a Toggle for some time. Usually it's just "Toggle = NOT Toggle".)
that's very interesting as well, I did try screen 0 first, nothing but trouble
Code: (Select All) _Title "Carnivore message" ' b+ 2024-07-01
'Screen _NewImage(500, 130, 32)
f& = _LoadFont("arial.ttf", 128, "MONOSPACE")
_Font f&
While _KeyDown(27) = 0
Cls
toggle = 1 - toggle
If toggle = 0 Then Print " EAT"; Else Print "MEAT";
_Display
_Limit 1
Wend
do not attempt above code unless you know Alt+F4, apparently the font changes the default screen size to gigantic.
Here's what you were looking for, with the above:
Code: (Select All)
_TITLE "Carnivore message" ' b+ 2024-07-01
'Screen _NewImage(500, 130, 32)
WIDTH 4, 1
f& = _LOADFONT("arial.ttf", 128, "MONOSPACE")
_FONT f&
WHILE _KEYDOWN(27) = 0
CLS
toggle = 1 - toggle
LOCATE 1, 1
IF toggle = 0 THEN PRINT " EAT"; ELSE PRINT "MEAT";
_DISPLAY
_LIMIT 1
WEND
Curious why I need a LOCATE 1, 1 each time after a CLS?
RE: Proggies - SMcNeill - 07-02-2024
To prevent screen scrolling from printing on one of the bottom two lines of the screen.
RE: Proggies - bplus - 07-02-2024
hmm... the first line is the last line or 2nd to last... then locate stops the scrolling, interesting.
RE: Proggies - bplus - 07-15-2024
Simple Pattern
Code: (Select All) _Title "Simple Patterns" ' B+ 2020-08-12
' rework Simple Pattern from SmallBASIC
Screen _NewImage(1024, 700, 32)
_Delay .25
_ScreenMove _Middle
s = 145: cd = 2
While 1
flip = 1 - flip
If flip Then
For k = .005 To .995 Step .005
GoSub drawIt
Next
Else
For k = .995 To .005 Step -.005
GoSub drawIt
Next
End If
cd = cd * .987654321
Wend
drawIt:
Cls
For i = 0 To 1024
For j = 0 To 700
x = i * s / 600: y = j * s / 600
c = x * x + y * y
d = c / cd
d = d - Int(d)
If d < k Then PSet (i, j)
Next
Next
_Display
_Limit 20
Return
RE: Proggies - vince - 07-17-2024
nice mod, B+, the
Code: (Select All)
c = x * x + y * y
is what creates the circles
check out this mod
Code: (Select All)
_Title "Simple Patterns" ' B++ 2020-08-12
' rework Simple Pattern from SmallBASIC
Screen _NewImage(1024, 700, 256)
_Delay .25
_ScreenMove _Middle
s = 145: cd = 2
While 1
flip = 1 - flip
If flip Then
For k = .005 To .995 Step .005
GoSub drawIt
Next
Else
For k = .995 To .005 Step -.005
GoSub drawIt
Next
End If
cd = cd * .987654321
Wend
drawIt:
Cls
For i = 0 To 1024
For j = 0 To 700
x = i * s / 600: y = j * s / 600
'circles
c = x * x + y * y
'tiles
c = x and y
'd = c / cd
'd = d - Int(d)
'If d < k Then PSet (i, j)
pset (i, j), c
Next
Next
_Display
_Limit 20
Return
|