X-Git-Url: http://shamusworld.gotdns.org/cgi-bin/gitweb.cgi?p=rmac;a=blobdiff_plain;f=direct.c;fp=direct.c;h=65a119d3211e5063fb9a58d05b957dd86f17a54f;hp=585764aa151aad87bc054d3385e329aca9e81083;hb=253a4352d61d123a20ebb8999127a58498543e8d;hpb=db581e2d9efe477db3a70fb8e947f3d009545d09 diff --git a/direct.c b/direct.c index 585764a..65a119d 100644 --- a/direct.c +++ b/direct.c @@ -90,6 +90,7 @@ int d_prgflags(void); int d_opt(void); int d_dsp(void); int d_objproc(void); +int d_align(void); void SetLargestAlignment(int); // Directive handler table @@ -163,6 +164,7 @@ int (*dirtab[])() = { d_opt, // 66 .opt d_objproc, // 67 .objproc (void *)d_dsm, // 68 .dsm + d_align // 69 .align }; @@ -842,6 +844,48 @@ int d_qphrase(void) } +// +// Adjust location to bytes +// +int d_align(void) +{ + unsigned bytesToSkip; + uint64_t eval; + + if (abs_expr(&eval) != OK) + return 0; + + if (eval < 2) + { + return error("Invalid .align value specified"); + } + + if (dsp56001) + { + bytesToSkip = eval - sloc % eval; + D_ZEROFILL(bytesToSkip*3); + return 0; + } + + bytesToSkip = eval - (rgpu || rdsp ? orgaddr : sloc) % eval; + if ( bytesToSkip != eval ) + { + if ((scattr & SBSS) == 0) + { + D_ZEROFILL(bytesToSkip); + } + else + { + sloc += bytesToSkip; + + if (orgactive) + orgaddr += bytesToSkip; + } + } + return 0; +} + + // // Do auto-even. This must be called ONLY if 'sloc' is odd. //