Screen Management

Basic and Machine Language

Moderator: Moderators

Post Reply
mysecretgarden
Vic 20 Newbie
Posts: 16
Joined: Thu Sep 18, 2008 2:10 pm

Screen Management

Post by mysecretgarden »

Hi everyone!
I have a question. I want to design the screen for a video game.
Starting from the decimal address 7680 (initial part of the screen), and having 22 columns x 23 rows, I would have a total of 506 bytes to write.
Now if for example I used:
LDX [screenData]
STA $1E00,X
and I made a cycle, the value of X could not be higher than the fateful 255,
so how can I write the piece of data that I'm missing?

Is there a way to have just one cycle or do I have to break it in two?

Thanks

Davide
User avatar
srowe
Vic 20 Scientist
Posts: 1340
Joined: Mon Jun 16, 2014 3:19 pm

Re: Screen Management

Post by srowe »

mysecretgarden wrote: Sun Mar 03, 2024 6:06 am Starting from the decimal address 7680 (initial part of the screen), and having 22 columns x 23 rows, I would have a total of 506 bytes to write.
Now if for example I used:
LDX [screenData]
STA $1E00,X
and I made a cycle, the value of X could not be higher than the fateful 255,
so how can I write the piece of data that I'm missing?

Is there a way to have just one cycle or do I have to break it in two?
If the value is constant then just write to both pages in a single iteration of the loop

Code: Select all

LDX [screenData]
STA $1E00,X
STA $1F00,X
Otherwise you need to indirect using zero page and increment the page byte when the index wraps.
User avatar
Mike
Herr VC
Posts: 4841
Joined: Wed Dec 01, 2004 1:57 pm
Location: Munich, Germany
Occupation: electrical engineer

Re: Screen Management

Post by Mike »

mysecretgarden wrote:[...] the value of X could not be higher than the fateful 255, [...]
... yet people have managed to work with the 65xx being an 8-bit CPU all the time.

Please check out my VICMON primer thread for standard idioms to address into the screen.

If it's just the matter of initialising the screen contents from yet another buffer, use a two-fold unrolled loop for that (or four times unrolled if you include colour RAM).
Merytsetesh
Vic 20 Amateur
Posts: 40
Joined: Sat Mar 02, 2024 8:57 pm
Location: Canada

Re: Screen Management

Post by Merytsetesh »

Reading this is making my head hurt and spin at the same time. :lol:
Post Reply