ZXSpin Assembler

The place for codemasters or beginners to talk about programming any language for the Spectrum.
User avatar
Ast A. Moore
Dizzy
Posts: 79
Joined: Mon Nov 13, 2017 3:16 pm

Re: ZXSpin Assembler

Post by Ast A. Moore » Tue Dec 05, 2017 9:18 pm

PeterJ wrote:
Tue Dec 05, 2017 8:41 pm
But the "Print At" and RST routines uses lines then columns which I would have said in Y,X as you say. Then Jonathan refers to them as X,Y.
As I mentioned, it’s not a good idea to think of the print position as having coordinates in the conventional sense. Jonathan’s tutorial is probably reflective of his peculiar paradigm. No need to rack your brain over it. Just remember that it’s “at row R, column C.” Forget the X and Y. Leave them strictly to pixel coordinates.

Another important aspect regarding coordinates on the Spectrum is that the graph in your picture is, well, also misleading. While you could set up an arbitrary origin point in your code (and, in fact, the BASIC PLOT routine does just that), the easiest and most natural way is to pin it to the top left corner. This way, increasing an address in the display file will also naturally increase the coordinates.
0 x
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.

User avatar
PeterJ
Site Admin
Posts: 123
Joined: Thu Nov 09, 2017 7:19 pm
Location: Surrey, UK

Re: ZXSpin Assembler

Post by PeterJ » Tue Dec 05, 2017 9:28 pm

Thanks for that. The graph was just to illustrate the tradition x,y and I appreciate the Spectrum print at coordinates start in the top left. Thanks for all the detail.
0 x

User avatar
Seven.FFF
Berk
Posts: 43
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: ZXSpin Assembler

Post by Seven.FFF » Wed Dec 06, 2017 1:44 am

I never really bothered with any ROM routines. I just checked my commit history, and the first thing I wrote before the initial commit was a table-based level renderer.

It was a little different because Nirvana has a well-optimised character print routine. In that respect it was a little like R-Tape’s “call but don't worry about yet” idea. But having the source accessible actually encouraged me to pore over the code endlessly, until I was able to understand it well enough to write my own specialised adaptations.

I gave some thought to how I wanted to store level data compactly, and being a db programmer in real life it was interesting to Approach it that way. I ended up with some kind of almost relational structure that stored characters and multicolour attributes in their own tables, and composed combinations of those plus coordinates into another table, then added another table referencing a set of those records for each level.

It’s still serving me well now. I even extended it other day in a new project to allow the data to be split up across RAM banks.
0 x
Robin Verhagen-Guest
colonel32
seven-fff.com/blog
threetwosevensixseven.com

Post Reply