Skip to content

Commit 7461036

Browse files
committed
Final commit to v10.5, fixed some dead assignments, made anding to work on Amiga (again).
1 parent d4b792e commit 7461036

File tree

10 files changed

+53
-83
lines changed

10 files changed

+53
-83
lines changed

CHANGELOG

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
1... WLA GB-Z80/Z80/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX History
44
----------------------------------------------------------------------------------------------------------
55

6-
v10.5 (19-Jun-2023) [ALL] .DSB, .DSW, .DSL and .DSD produced only one pending
6+
v10.5 (23-Jun-2023) [ALL] .DSB, .DSW, .DSL and .DSD produced only one pending
77
calculation struct when encountered a pending calculation
88
thus the result was wrong.
99
[ALL] Added .ALIGN.
@@ -1483,7 +1483,7 @@ v1.0 (10-Jul-2000) The first public release.
14831483
------------------------------------------------------------------------------
14841484

14851485

1486-
v5.20 (07-May-2022) Added [sectionwriteorder] and [ramsectionwriteorder]
1486+
v5.20 (23-Jun-2023) Added [sectionwriteorder] and [ramsectionwriteorder]
14871487
to linkfile.
14881488
Added -pS and -pR that make WLALINK to ignore .SECTION
14891489
types when writing the .SECTIONs to output, only

decode.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,8 @@ static int _mc68000_parse_ea(char *code, int *index, int *reg1, int *reg2, int *
453453
if (code[i] == 0xA || code[i] == ',')
454454
break;
455455

456-
c = toupper((int)code[i++]);
456+
c = toupper((int)code[i]);
457+
i++;
457458
if (code[i] >= '0' && code[i] <= '7')
458459
number = code[i++] - '0';
459460
else {
@@ -487,7 +488,8 @@ static int _mc68000_parse_ea(char *code, int *index, int *reg1, int *reg2, int *
487488
/* it's a range! */
488489
i++;
489490

490-
c2 = toupper((int)code[i++]);
491+
c2 = toupper((int)code[i]);
492+
i++;
491493

492494
if (c2 != c) {
493495
/* different register type */
@@ -3779,7 +3781,6 @@ int evaluate_token(void) {
37793781
if (done == NO)
37803782
break;
37813783

3782-
size = s_instruction_tmp->size;
37833784
opcode = s_instruction_tmp->hex;
37843785

37853786
if (_mc68000_parse_ea(g_buffer, &s_parser_source_index, &register_y1, &register_y2, &register_y_mode, &data_y, &data_type_y, label_y, NO) == FAILED)

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
project = u'wla-dx'
1919
copyright = u'1998, vhelin'
2020
version = '10.5' # The short X.Y version, can be used with |version|
21-
release = '10.5a' # The full version, including alpha/beta/rc tags, |release|
21+
release = '10.5' # The full version, including alpha/beta/rc tags, |release|
2222
language = None
2323
#today = ''
2424
#today_fmt = '%B %d, %Y'

main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ FILE *g_file_out_ptr = NULL;
3636
__near long __stack = 200000;
3737
#endif
3838

39-
char g_version_string[] = "$VER: wla-" WLA_NAME " 10.5a (19.6.2023)";
39+
char g_version_string[] = "$VER: wla-" WLA_NAME " 10.5 (23.6.2023)";
4040
char g_wla_version[] = "10.5";
4141

4242
extern struct incbin_file_data *g_incbin_file_data_first, *g_ifd_tmp;
@@ -179,7 +179,7 @@ int main(int argc, char *argv[]) {
179179
}
180180

181181
if (g_output_format == OUTPUT_NONE || parse_flags_result == FAILED) {
182-
char title[] = "WLA " ARCH_STR " Macro Assembler v10.5a";
182+
char title[] = "WLA " ARCH_STR " Macro Assembler v10.5";
183183
int length, left, right;
184184

185185
length = (int)strlen(title);

parse.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,6 @@ int input_number(void) {
980980
g_parsed_int = (g_parsed_int << 4) + e - 'a' + 10;
981981
else if (e == 'h' || e == 'H') {
982982
g_source_index++;
983-
e = g_buffer[g_source_index];
984983
break;
985984
}
986985
else

phase_1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4278,7 +4278,7 @@ int directive_incdir(void) {
42784278

42794279
static int _remember_namespace(char *name) {
42804280

4281-
struct namespace *nspace = NULL;
4281+
struct namespace *nspace;
42824282

42834283
nspace = calloc(sizeof(struct namespace), 1);
42844284
if (nspace == NULL) {
@@ -10827,7 +10827,7 @@ int parse_directive(void) {
1082710827

1082810828
/* get the isolation counter */
1082910829
g_expect_calculations = NO;
10830-
q = input_number();
10830+
input_number();
1083110831
g_expect_calculations = YES;
1083210832

1083310833
g_is_file_isolated_counter = g_parsed_int;

stack.c

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3250,6 +3250,13 @@ static double _round(double d) {
32503250
}
32513251

32523252

3253+
/* we have trouble with "and" on Amiga thus this function - a bug in SAS/C? perhaps issues on other platforms as well? */
3254+
static int _perform_and(int a, int b) {
3255+
3256+
return a & b;
3257+
}
3258+
3259+
32533260
int compute_stack(struct stack *sta, int stack_item_count, double *result) {
32543261

32553262
struct stack_item *s;
@@ -3308,55 +3315,35 @@ int compute_stack(struct stack *sta, int stack_item_count, double *result) {
33083315
break;
33093316
case SI_OP_LOW_BYTE:
33103317
z = (int)v[t - 1];
3311-
#ifdef AMIGA
3312-
/* on Amiga this needs to be done twice - a bug in SAS/C? */
3313-
z = z & 0xFF;
3314-
#endif
3315-
v[t - 1] = z & 0xFF;
3318+
v[t - 1] = _perform_and(z, 0xFF);
33163319
if (s->sign == SI_SIGN_NEGATIVE)
33173320
v[t - 1] = -v[t - 1];
33183321
sp[t - 1] = NULL;
33193322
break;
33203323
case SI_OP_HIGH_BYTE:
33213324
z = ((int)v[t - 1]) >> 8;
3322-
#ifdef AMIGA
3323-
/* on Amiga this needs to be done twice - a bug in SAS/C? */
3324-
z = z & 0xFF;
3325-
#endif
3326-
v[t - 1] = z & 0xFF;
3325+
v[t - 1] = _perform_and(z, 0xFF);
33273326
if (s->sign == SI_SIGN_NEGATIVE)
33283327
v[t - 1] = -v[t - 1];
33293328
sp[t - 1] = NULL;
33303329
break;
33313330
case SI_OP_BANK_BYTE:
33323331
z = ((int)v[t - 1]) >> 16;
3333-
#ifdef AMIGA
3334-
/* on Amiga this needs to be done twice - a bug in SAS/C? */
3335-
z = z & 0xFF;
3336-
#endif
3337-
v[t - 1] = z & 0xFF;
3332+
v[t - 1] = _perform_and(z, 0xFF);
33383333
if (s->sign == SI_SIGN_NEGATIVE)
33393334
v[t - 1] = -v[t - 1];
33403335
sp[t - 1] = NULL;
33413336
break;
33423337
case SI_OP_LOW_WORD:
33433338
z = (int)v[t - 1];
3344-
#ifdef AMIGA
3345-
/* on Amiga this needs to be done twice - a bug in SAS/C? */
3346-
z = z & 0xFFFF;
3347-
#endif
3348-
v[t - 1] = z & 0xFFFF;
3339+
v[t - 1] = _perform_and(z, 0xFFFF);
33493340
if (s->sign == SI_SIGN_NEGATIVE)
33503341
v[t - 1] = -v[t - 1];
33513342
sp[t - 1] = NULL;
33523343
break;
33533344
case SI_OP_HIGH_WORD:
33543345
z = ((int)v[t - 1]) >> 16;
3355-
#ifdef AMIGA
3356-
/* on Amiga this needs to be done twice - a bug in SAS/C? */
3357-
z = z & 0xFFFF;
3358-
#endif
3359-
v[t - 1] = z & 0xFFFF;
3346+
v[t - 1] = _perform_and(z, 0xFFFF);
33603347
if (s->sign == SI_SIGN_NEGATIVE)
33613348
v[t - 1] = -v[t - 1];
33623349
sp[t - 1] = NULL;

wlalink/files.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ int load_files(char *argv[], int argc) {
250250
}
251251
/* section write order? */
252252
else if (state == STATE_SECTION_WRITE_ORDER) {
253-
int statuses[SECTION_TYPES_COUNT_ALL], sum;
253+
int statuses[SECTION_TYPES_COUNT_ALL], sum, j;
254254

255255
if (s_section_write_order_index > 0) {
256256
fprintf(stderr, "%s:%d: LOAD_FILES: Excess data in [sectionwriteorder].\n", argv[argc - 2], line);
@@ -267,9 +267,9 @@ int load_files(char *argv[], int argc) {
267267
for (i = 0; i < SECTION_TYPES_COUNT_ALL; i++)
268268
statuses[i] = 0;
269269

270-
i = SUCCEEDED;
270+
j = SUCCEEDED;
271271

272-
while (i == SUCCEEDED) {
272+
while (j == SUCCEEDED) {
273273
int status;
274274

275275
if (strcaselesscmp(token, "force") == 0)
@@ -326,7 +326,7 @@ int load_files(char *argv[], int argc) {
326326
_process_tmp(tmp);
327327

328328
x = 0;
329-
i = get_next_token(tmp, token, &x);
329+
j = get_next_token(tmp, token, &x);
330330
}
331331

332332
/* count the types */
@@ -346,7 +346,7 @@ int load_files(char *argv[], int argc) {
346346
}
347347
/* ramsection write order? */
348348
else if (state == STATE_RAMSECTION_WRITE_ORDER) {
349-
int statuses[SECTION_TYPES_COUNT_ALL], sum;
349+
int statuses[SECTION_TYPES_COUNT_ALL], sum, j;
350350

351351
if (s_ramsection_write_order_index > 0) {
352352
fprintf(stderr, "%s:%d: LOAD_FILES: Excess data in [ramsectionwriteorder].\n", argv[argc - 2], line);
@@ -363,9 +363,9 @@ int load_files(char *argv[], int argc) {
363363
for (i = 0; i < SECTION_TYPES_COUNT_ALL; i++)
364364
statuses[i] = 0;
365365

366-
i = SUCCEEDED;
366+
j = SUCCEEDED;
367367

368-
while (i == SUCCEEDED) {
368+
while (j == SUCCEEDED) {
369369
int status;
370370

371371
if (strcaselesscmp(token, "force") == 0)
@@ -416,7 +416,7 @@ int load_files(char *argv[], int argc) {
416416
_process_tmp(tmp);
417417

418418
x = 0;
419-
i = get_next_token(tmp, token, &x);
419+
j = get_next_token(tmp, token, &x);
420420
}
421421

422422
/* count the types */

wlalink/main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#define WLALINK_DEBUG 1
3333
*/
3434

35-
char g_version_string[] = "$VER: wlalink 5.20a (7.5.2023)";
35+
char g_version_string[] = "$VER: wlalink 5.20 (23.6.2023)";
3636

3737
#ifdef AMIGA
3838
__near long __stack = 200000;
@@ -353,7 +353,7 @@ int main(int argc, char *argv[]) {
353353
i = FAILED;
354354

355355
if (i == FAILED) {
356-
char title[] = "WLALINK - WLA DX Macro Assembler Linker v5.20a";
356+
char title[] = "WLALINK - WLA DX Macro Assembler Linker v5.20";
357357
int length, left, right;
358358

359359
length = (int)strlen(title);

wlalink/write.c

Lines changed: 20 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -3065,12 +3065,20 @@ static double _round(double d) {
30653065
const char *get_stack_item_operator_name(int operator);
30663066
char *get_stack_item_description(struct stack_item *si, int file_id);
30673067

3068+
3069+
/* we have trouble with "and" on Amiga thus this function - a bug in SAS/C? perhaps issues on other platforms as well? */
3070+
static int _perform_and(int a, int b) {
3071+
3072+
return a & b;
3073+
}
3074+
3075+
30683076
int compute_stack(struct stack *sta, double *result_ram, double *result_rom, int *result_slot, int *result_base, int *result_bank) {
30693077

30703078
int r, t, z, y, x, res_base, res_bank, res_slot, slot[256], base[256], bank[256];
30713079
double v_ram[256], v_rom[256], q, res_ram, res_rom;
3072-
struct stack_item *s = NULL;
3073-
struct stack *st = NULL;
3080+
struct stack_item *s;
3081+
struct stack *st;
30743082

30753083
if (sta->under_work == YES) {
30763084
fprintf(stderr, "%s: %s:%d: COMPUTE_STACK: A loop found in computation.\n", get_file_name(sta->file_id),
@@ -3529,13 +3537,8 @@ int compute_stack(struct stack *sta, double *result_ram, double *result_rom, int
35293537
y += base[t - 1];
35303538
}
35313539

3532-
#ifdef AMIGA
3533-
/* on Amiga this needs to be done twice - a bug in SAS/C? */
3534-
z = z & 0xFF;
3535-
y = y & 0xFF;
3536-
#endif
3537-
v_ram[t - 1] = z & 0xFF;
3538-
v_rom[t - 1] = y & 0xFF;
3540+
v_ram[t - 1] = _perform_and(z, 0xFF);
3541+
v_rom[t - 1] = _perform_and(y, 0xFF);
35393542
if (s->sign == SI_SIGN_NEGATIVE) {
35403543
v_ram[t - 1] = -v_ram[t - 1];
35413544
v_rom[t - 1] = -v_rom[t - 1];
@@ -3544,13 +3547,8 @@ int compute_stack(struct stack *sta, double *result_ram, double *result_rom, int
35443547
case SI_OP_LOW_BYTE:
35453548
z = (int)v_ram[t - 1];
35463549
y = (int)v_rom[t - 1];
3547-
#ifdef AMIGA
3548-
/* on Amiga this needs to be done twice - a bug in SAS/C? */
3549-
z = z & 0xFF;
3550-
y = y & 0xFF;
3551-
#endif
3552-
v_ram[t - 1] = z & 0xFF;
3553-
v_rom[t - 1] = y & 0xFF;
3550+
v_ram[t - 1] = _perform_and(z, 0xFF);
3551+
v_rom[t - 1] = _perform_and(y, 0xFF);
35543552
if (s->sign == SI_SIGN_NEGATIVE) {
35553553
v_ram[t - 1] = -v_ram[t - 1];
35563554
v_rom[t - 1] = -v_rom[t - 1];
@@ -3559,13 +3557,8 @@ int compute_stack(struct stack *sta, double *result_ram, double *result_rom, int
35593557
case SI_OP_HIGH_BYTE:
35603558
z = ((int)v_ram[t - 1]) >> 8;
35613559
y = ((int)v_rom[t - 1]) >> 8;
3562-
#ifdef AMIGA
3563-
/* on Amiga this needs to be done twice - a bug in SAS/C? */
3564-
z = z & 0xFF;
3565-
y = y & 0xFF;
3566-
#endif
3567-
v_ram[t - 1] = z & 0xFF;
3568-
v_rom[t - 1] = y & 0xFF;
3560+
v_ram[t - 1] = _perform_and(z, 0xFF);
3561+
v_rom[t - 1] = _perform_and(y, 0xFF);
35693562
if (s->sign == SI_SIGN_NEGATIVE) {
35703563
v_ram[t - 1] = -v_ram[t - 1];
35713564
v_rom[t - 1] = -v_rom[t - 1];
@@ -3574,13 +3567,8 @@ int compute_stack(struct stack *sta, double *result_ram, double *result_rom, int
35743567
case SI_OP_LOW_WORD:
35753568
z = (int)v_ram[t - 1];
35763569
y = (int)v_rom[t - 1];
3577-
#ifdef AMIGA
3578-
/* on Amiga this needs to be done twice - a bug in SAS/C? */
3579-
z = z & 0xFFFF;
3580-
y = y & 0xFFFF;
3581-
#endif
3582-
v_ram[t - 1] = z & 0xFFFF;
3583-
v_rom[t - 1] = y & 0xFFFF;
3570+
v_ram[t - 1] = _perform_and(z, 0xFFFF);
3571+
v_rom[t - 1] = _perform_and(y, 0xFFFF);
35843572
if (s->sign == SI_SIGN_NEGATIVE) {
35853573
v_ram[t - 1] = -v_ram[t - 1];
35863574
v_rom[t - 1] = -v_rom[t - 1];
@@ -3589,13 +3577,8 @@ int compute_stack(struct stack *sta, double *result_ram, double *result_rom, int
35893577
case SI_OP_HIGH_WORD:
35903578
z = ((int)v_ram[t - 1]) >> 16;
35913579
y = ((int)v_rom[t - 1]) >> 16;
3592-
#ifdef AMIGA
3593-
/* on Amiga this needs to be done twice - a bug in SAS/C? */
3594-
z = z & 0xFFFF;
3595-
y = y & 0xFFFF;
3596-
#endif
3597-
v_ram[t - 1] = z & 0xFFFF;
3598-
v_rom[t - 1] = y & 0xFFFF;
3580+
v_ram[t - 1] = _perform_and(z, 0xFFFF);
3581+
v_rom[t - 1] = _perform_and(y, 0xFFFF);
35993582
if (s->sign == SI_SIGN_NEGATIVE) {
36003583
v_ram[t - 1] = -v_ram[t - 1];
36013584
v_rom[t - 1] = -v_rom[t - 1];

0 commit comments

Comments
 (0)