ConorMcPersonal / Toaster

The greatest ever Spectrum game based purely around the toast concept
Apache License 2.0
0 stars 1 forks source link

print numbers flushed right #28

Closed mcmenaminadrian closed 11 months ago

mcmenaminadrian commented 12 months ago

Ensure numbers published flush right

ConorMcPersonal commented 12 months ago

Approved - although controls seem a bit laggy now

ConorMcPersonal commented 12 months ago

I've made a cheeky suggestion - in the form of a commit. This is approved with or without that being adopted.

ConorMcPersonal commented 12 months ago

Every 8x8 "character space" (x,y) on the screen is stacked like this; given we're multiplying by 8 to get to the pixel spots this will therefore work throughout. Screen is split vertically into 3 blocks of 8 character lines each, which can complicate matters, buy that is taken care of by the extra call at the end of the loop (to get to a new character block).

On Wed, 20 Sept 2023, 09:51 Adrian McMenamin, @.***> wrote:

@.**** commented on this pull request.

In SplitFiles/face.c https://github.com/ConorMcPersonal/Toaster/pull/28#discussion_r1331274349 :

@@ -0,0 +1,182 @@ +#include <arch/zx.h> +#include +#include "util.h" +#include "face.h" + +void happyFace(const int x, const int y) +{

  • int px = (x - 1) * 8;
  • int py = (y - 1) * 8;
  • *zx_pxy2saddr(px + 8, py) = 0x0;
  • *zx_pxy2saddr(px, py++) = 0x1;

On the lines: no, in the sense that not all the lines are stacked one on top of the other aiui. Each line itself is linear but - from my understanding of the markdown on the z88dk tutorial they aren't necessarily stacked one on top of the other. But maybe I have misunderstood that?

On the order: Accident of how I coded it up with the unary ++ just.

— Reply to this email directly, view it on GitHub https://github.com/ConorMcPersonal/Toaster/pull/28#discussion_r1331274349, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBJUJT5AYMI6Z2OTP5SD7PDX3KVAZANCNFSM6AAAAAA45DZZBQ . You are receiving this because your review was requested.Message ID: @.***>

ConorMcPersonal commented 12 months ago

If you don't want the loop you can still structure this as a single function being fed a data block, rather than mixing the data and the code in several separate functions

On Wed, 20 Sept 2023, 11:51 Adrian McMenamin, @.***> wrote:

@.**** commented on this pull request.

In SplitFiles/face.c https://github.com/ConorMcPersonal/Toaster/pull/28#discussion_r1331442402 :

@@ -0,0 +1,182 @@ +#include <arch/zx.h> +#include +#include "util.h" +#include "face.h" + +void happyFace(const int x, const int y) +{

  • int px = (x - 1) * 8;
  • int py = (y - 1) * 8;
  • *zx_pxy2saddr(px + 8, py) = 0x0;

Thing to be aware of, though, is that you are, roughly speaking, executing three times as much code with a simple line line loop as with the unrolled version - so we might want to watch performance

— Reply to this email directly, view it on GitHub https://github.com/ConorMcPersonal/Toaster/pull/28#discussion_r1331442402, or unsubscribe https://github.com/notifications/unsubscribe-auth/BBJUJTYFBCESKUV4YKLWSTDX3LDCJANCNFSM6AAAAAA45DZZBQ . You are receiving this because your review was requested.Message ID: @.***>