Programmerare, skeptiker, sekulärhumanist, antirasist.
Författare till bok om C64 och senbliven lantis.
Röstar pirat.
2011-03-29
The skills of using PEEK, POKE and logical operators that I write about for the Commodore PET here, can be used to create graphics on the Commodore 128, in 40-column mode. Before you begin, you might want to clear the screen using the SCNCLR command. Odd name, I know.
The C128 has a built in sprite engine. A sprite is a 2 dimensional area with its own memory area that can be handled separately from the rest of the screen. The C128 sprite engine supports eight sprites. Use the SPRITE command to activate a sprite. Here, I have activated the first of eight sprites:
SPRITE 1, 1, 1, 0
The first sprite is now activated. The default position is up to the right of the screen. However, the sprite might be invisible. If there is junk data in the address space of the sprite, you will see some obscure pixels. The sprite data is located in the memory at 3584 (0E00). Each sprite is 3 bytes (or 24 pixels) wide and 21 pixels high. Each sprite consumes 63 bytes. This information is enough to clear the sprite. In the machine code monitor, use In the machine code monitor, use M 0E00 0E3E to see the sprite data. Note that the monitor displays eight bytes at a time, so it will actually display 0E00 to 0E3F. To clear the sprite, type:
F 0E00 0E3E 0
Leave the monitor using X. Make sure the sprite is visible by typing in SPRITE 1, 1, 1, 0 again. Now, use the POKE statement to control which pixels should be visible and which should be hidden, according to the rules I demonstrated here.
Categories: Geeky
Tags: C128
Bjud mig på en kopp kaffe (20:-) som tack för bra innehåll!
Leave a Reply