Filling the screen with colors

[Inspired by this article on Bob’s 8-bit blog]

At this stage, you understood that the ZX81 does not have colors. Only a 21 lines by 32 characters screen, each character filled with a  value representing either graphics or letters, digits, or symbols.

So, what if we wanted to fill the screen with, say, black characters? We could try expand our original program like this:

ld HL, (D_FILE)
ld a, 0x80       ; 0x80 is the value for the black square character
INC HL           ; skip the first 0x76
ld (HL), a
INC HL
LD (HL), a
...
LD (HL), a       ; the ld inc sequence is repeated
INC HL           ; 32 times for line one
INC HL           ; skip 0x76 at the end of the line
LD (HL),a

Pretty fastidious right… We know we have 32 characters to fill per line, skip the 0x76 end of line, and repeat for 24 lines. Let’s use loops!
Continue reading “Filling the screen with colors”

Let there be color

[Inspired by this article on Bob’s 8-bit blog]

Misleading title! There is no color on a ZX81, except for black, white and grey… More on this in the next post.

Our first ZX81 program will draw a black square at the top left of the screen. Open your editor, and create a new file – call it zx81001.asm. Now type the following lines:

ld HL, (D_FILE)
ld a, 128
inc HL
ld (HL), a
RET

Save your file, and compile it with pasmo:

pasmo -v zx81001.asm zx81001.p

The -v option stands for verbose and will give you additional information when things go wrong.

Now, execute your program with the emulator:

zesarux zx81001.p

If all goes well, you should see a black square at the top left of your screen!

zx81001

A tribute to Bob

Last year, I started to learn ZX81 assembly language programming. I was a teenager in 1982, when I got my first computer, a ZX81 with 16K extension memory (the original machine comes with 1K, 1024 bytes!). At that time, I was really a novice in computers, and assembly language seemed unreachable to me. In the course of 2016, I cam across games developed in assembly language by Bob, from Bob’s stuff. I was so impressed by what Bob managed to produce out of this little black box, extending its limits beyond what I thought was possible. This gave me the motivation to start learning Z80 assembly language. I’m still very much a beginner in a learning curve. Recently, Bob started a blog, teaching Z80 assembly language on the Spectrum. I’ve read a few articles already, and decided to adapt them to the ZX81. This will be the content of upcoming blog posts on this site.

Hello world

Those of you who have been learning a computer language will recognize the title of this post.  Traditionnally, the very first program you write consists in outputting the sentence “Hello World” on the screen.  So, this post is a tribute to that little tradition.

I would like this blog to be a place where I can gather all my notes on things I like. This goes from gardening, to cooking, , programming, reading, watching movies, and many more topics that come and go as I move forward in life.

So, welcome to my world, and please feel free to comment, protest, encourage, speak out loud.

post