PEEK/POKE Video buffer
#3
Swap over to _MEM, which is the modern version of PEEK/POKE.

It's been ages since I last used PEEK and POKE as your example, so I'm having trouble sorting out what it's supposed to do.

Our screen is 80 * 25 * 2bytes per character in size, so 4000 bytes.

FOR a = 0 TO 4000 STEP 4 <-- this would address every other pixel on the screen
x = INT(RND * 2) + 48 <-- x is either 49 or 50, which is ASC for either "0" or "1"
y = ((INT(RND * 2)) * 8) + 2 <-- y is either 2 or 10... light green and dark green in color?
POKE a, x <-- set the character to CHR$(x)
POKE a + 1, y <-- set the color to y
NEXT

All this does is place 0's and 1's at alternating points of the screen and change their color from light green to dark green? Yes?

I'm thinking this is more-or-less, what you're looking for with modern mem commands:

Code: (Select All)
Screen 0
Dim m As _MEM: m = _MemImage(0) 'modern equiv of DEF SEG.  Point our mem block at our screen image
Dim As _Unsigned _Byte x, y 'make our variable type unsigned bytes
Do
    For a = 0 To 3996 Step 4
        x = Int(Rnd * 2) + 48
        y = ((Int(Rnd * 2)) * 8) + 2
        _MemPut m, m.OFFSET + a, x
        _MemPut m, m.OFFSET + a + 1, y
    Next
Loop Until InKey$ <> ""
System

Edit: OldMoses beat me to it while I was typing up my answer. Wink
Reply


Messages In This Thread
PEEK/POKE Video buffer - by BDS107 - 08-25-2022, 09:31 AM
RE: PEEK/POKE Video buffer - by OldMoses - 08-25-2022, 11:09 AM
RE: PEEK/POKE Video buffer - by SMcNeill - 08-25-2022, 11:19 AM
RE: PEEK/POKE Video buffer - by OldMoses - 08-25-2022, 11:24 AM
RE: PEEK/POKE Video buffer - by BDS107 - 08-25-2022, 11:50 AM
RE: PEEK/POKE Video buffer - by OldMoses - 08-25-2022, 12:34 PM
RE: PEEK/POKE Video buffer - by SMcNeill - 08-25-2022, 11:59 AM
RE: PEEK/POKE Video buffer - by BDS107 - 08-25-2022, 12:05 PM



Users browsing this thread: 3 Guest(s)