Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
07-02-2024, 12:59 AM
(This post was last modified: 07-02-2024, 01:03 AM by SMcNeill.)
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".)
Posts: 301
Threads: 16
Joined: Apr 2022
Reputation:
51
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
Posts: 3,936
Threads: 175
Joined: Apr 2022
Reputation:
216
(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.
b = b + ...
Posts: 3,936
Threads: 175
Joined: Apr 2022
Reputation:
216
07-02-2024, 02:02 PM
(This post was last modified: 07-02-2024, 02:03 PM by bplus.)
@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.
b = b + ...
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
(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
Posts: 3,936
Threads: 175
Joined: Apr 2022
Reputation:
216
(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?
b = b + ...
Posts: 2,696
Threads: 327
Joined: Apr 2022
Reputation:
217
To prevent screen scrolling from printing on one of the bottom two lines of the screen.
Posts: 3,936
Threads: 175
Joined: Apr 2022
Reputation:
216
hmm... the first line is the last line or 2nd to last... then locate stops the scrolling, interesting.
b = b + ...
Posts: 3,936
Threads: 175
Joined: Apr 2022
Reputation:
216
07-15-2024, 12:07 AM
(This post was last modified: 07-15-2024, 12:10 AM by bplus.)
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
b = b + ...
Posts: 301
Threads: 16
Joined: Apr 2022
Reputation:
51
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
|