Maya Grab [Day 12] – Drawing PETSCII

Yesterday and today I’ve wanted to setup a couple of rooms, to get the game started and to see how long does it take to draw everything manually. I’ve managed to do the title and rip screens, and the first three rooms with all their states. I’ve thought I’ll be bored after just two or three screens, but it’s actually fun. Again, before I get to the main topic, let’s see some changes in the code:

1540 L$=CHR$(127): R$=CHR$(169)

This is really funny. Two new variables with special C64 characters that I couldn’t find on my keyboard. They are often used, and if I ever find the right key combination to display them, this line will be removed.

10500 :
10505 REM – INIT SCREEN —————
10510 :
10515 PRINT CHR$(147)
10520 POKE 53280,0: POKE 53281,0
10525 RETURN
10530 :
10600 PRINT CHR$(147)
10605 POKE 53280,CB: POKE 53281,CF
10610 RETURN

The init screen subroutine now sets the border to black (needed for the title screen), and there is another one beginning at line 10600 which sets the colors for the game. Lot’s of similar code, I know.

30000 :
30005 REM *****************************
30010 REM * ROOM DRAWING              *
30015 REM *****************************
30020 :
30025 IF PR=0 THEN 30500
30030 IF PR=1 THEN 31000
30035 IF PR=2 THEN 32000
30040 IF PR=3 THEN 33000
30045 IF PR=4 THEN 34000

Another part that will be optimized later. Depending on the room the player is in, the correct drawing subroutine is called.

There’s no point showing the code for drawing the screens, it’s just a bunch of PRINT commands. Also it would take ages to “convert” the code into normal ASCII and display it in HTML with the correct C64 font. So, if you look at the source code and the room drawing subroutines, you’ll find just an RETURN command, which means that this room is finished and already in the game.

The thing that’s bothering me is free memory. Not so many bytes left, and I did only one third of the rooms; still have to do the sprites and write the complete interpreter. I’ll focus on the rooms in the next couple of days and keep an eye on those bytes.

Program size: 21688 bytes, on disk 19050 bytes or 75 blocks
Free BASIC memory: 17223 bytes
Used BASIC commands: –

Source code

* * * * *