Skip to content

Commit

Permalink
Added support for Z80N. Should fix GitHub issue #401.
Browse files Browse the repository at this point in the history
  • Loading branch information
vhelin committed Aug 19, 2023
1 parent c7cccc8 commit 8dea744
Show file tree
Hide file tree
Showing 38 changed files with 11,133 additions and 202 deletions.
9 changes: 5 additions & 4 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@

----------------------------------------------------------------------------------------------------------
1... WLA GB-Z80/Z80/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX History
----------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
1... WLA GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX History
---------------------------------------------------------------------------------------------------------------

v10.6 (05-Aug-2023) [ALL] Conditions (e.g., "(A > 1 || B < 3)") can now be used
v10.6 (19-Aug-2023) [ALL] Conditions (e.g., "(A > 1 || B < 3)") can now be used
everywhere, outside .IFs.
[ALL] It's not any more possible to create labels and
definitions called "_b" and "_f" as they are reserved names.
Expand All @@ -25,6 +25,7 @@ v10.6 (05-Aug-2023) [ALL] Conditions (e.g., "(A > 1 || B < 3)") can now be used
[ALL] It's now possible to put multiple instructions on the
the same line by separating them with " \ " (whitespace here
is important).
[Z8N] Added support for Z80N.

v10.5 (23-Jun-2023) [ALL] .DSB, .DSW, .DSL and .DSD produced only one pending
calculation struct when encountered a pending calculation
Expand Down
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ set(ARCHS
"huc6280:HUC6280"
"spc700:SPC700"
"z80:Z80"
"z80n:Z80N"
"68000:MC68000"
"6800:MC6800"
"6801:MC6801"
Expand Down Expand Up @@ -190,7 +191,7 @@ endif()

# Packaging via CPack
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"Yet Another GB-Z80/Z80/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX Multi Platform Cross Assembler Package")
"Yet Another GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX Multi Platform Cross Assembler Package")
set(CPACK_PACKAGE_CHECKSUM MD5) # CPack 3.7+
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_GENERATOR ZIP TGZ 7Z)
Expand Down
16 changes: 8 additions & 8 deletions FILE_FORMATS
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ NOTE! integers are in big endian format.



WLA GB-Z80/Z80/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX object file format "WLAk"
WLA GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX object file format "WLAk"


bytes description

header:

4 format information,
"WLAk" - WLA GB-Z80/Z80/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX object file version 36 (02-Apr-2022)
"WLAk" - WLA GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX object file version 36 (02-Apr-2022)
1 empty fill
1 misc bits (bit 0 - sms checksum (1 == compute)
bit 1 - snes rom mode (0 == lorom, 1 == hirom)
Expand Down Expand Up @@ -91,7 +91,7 @@ outside references:
n label (0 terminated)
1 type (0 = direct 16-bit, 1 = relative 8-bit, 2 = direct 8-bit, 3 = direct 24-bit,
4 = relative 16-bit, 5 = direct 13-bit, 6 = direct 32-bit, 7 = bits, 8 = 9-bit short)
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST)
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST, 4 == flip endianess)
4 file id (int)
1 bits starting position (0-7, only present if result type == 7)
1 bits to define (1-32, only present if result type == 7)
Expand All @@ -111,7 +111,7 @@ pending calculations:
1 result type (0 = 8-bit, 1 = 16-bit, 2 = 24-bit, 3 = unknown, 4 = 13-bit, 5 = 32-bit, 6 = bits,
7 = 9-bit short)
if bit 7 == 1, then the label references are relative, else absolute
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST)
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST, 4 == flip endianess)
4 section (0 = no section, 1+ = section id) (int)
4 file id (int)
1 number of stack items
Expand Down Expand Up @@ -194,15 +194,15 @@ section:



WLA-GB/Z80/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX library file format "WLAI"
WLA-GB/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX library file format "WLAI"


bytes description

header:

4 format information,
"WLAI" - WLA-GB/Z80/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX library file version 29 (02-Apr-2022)
"WLAI" - WLA-GB/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HuC6280/SPC-700/SuperFX library file version 29 (02-Apr-2022)
1 misc bits (bit 0 - endianess (1 = big endian)
bit 1 - 65816 indicator (1 == 65816)
bit 2 - 65ce02 indicator (1 == 65ce02))
Expand Down Expand Up @@ -242,7 +242,7 @@ outside references:
n label (0 terminated)
1 type (0 = direct 16-bit, 1 = relative 8-bit, 2 = direct 8-bit, 3 = direct 24-bit,
4 = relative 16-bit, 5 = direct 13-bit, 6 = direct 32-bit, 7 = bits, 8 = 9-bit short)
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST)
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST, 4 == flip endianess)
4 section (1+ = section id) (int)
4 file id (int)
1 bits starting position (0-7, only present if result type == 7)
Expand All @@ -259,7 +259,7 @@ pending calculations:
1 result type (0 = 8-bit, 1 = 16-bit, 2 = 24-bit, 3 = unknown, 4 = 13-bit, 5 = 32-bit, 6 = bits,
7 = 9-bit short)
if bit 7 == 1, then the label references are relative, else absolute
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST)
1 special case ID (0 == not a special case, 1 == Z80/GB-Z80 RST, 2 == 8008 RST, 3 == 8080 RST, 4 == flip endianess)
4 section (1+ = section id) (int)
4 file id (int)
1 number of stack items
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SPDX-URL: https://spdx.org/licenses/GPL-2.0-or-later.html
SPDX-License-Identifier: GPL-2.0-or-later


WLA DX - Yet Another GB-Z80/Z80/6502/65C02/65CE02/65816/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX Multi Platform Cross Assembler Package
WLA DX - Yet Another GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX Multi Platform Cross Assembler Package
Copyright (C) 1998-2022 Ville Helin and other contributors @ https://github.com/vhelin/wla-dx

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ WLA DX (Wzonka-Lad Assembler Deluxe)
====================================

WLA DX - Yet Another
GB-Z80/Z80/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX
GB-Z80/Z80/Z80N/6502/65C02/65CE02/65816/68000/6800/6801/6809/8008/8080/HUC6280/SPC-700/SuperFX
Multi Platform Cross Assembler Package

Azure Pipelines CI:
Expand All @@ -21,6 +21,7 @@ memory map (that should be shared across all object and library files).
Supported architectures are:

* Z80
* Z80N
* GB (GB-Z80)
* 6502
* 65C02
Expand Down
4 changes: 2 additions & 2 deletions byte_tester/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#define MAX_BYTES_PER_TEST 1024


#ifdef AMIGACPU
#if defined(AMIGACPU)
__near long __stack = 200000;
#endif

Expand Down Expand Up @@ -237,7 +237,7 @@ int main(int argc, char *argv[]) {

if (argc < 2 || argc > 3 || argv == NULL) {
fprintf(stderr, "\n");
#ifdef AMIGACPU
#if defined(AMIGACPU)
fprintf(stderr, "Byte tester 2.1 (" AMIGACPU ")\n");
#else
fprintf(stderr, "Byte tester 2.1\n");
Expand Down
77 changes: 48 additions & 29 deletions decode.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ extern int g_xbit_size, g_accu_size, g_index_size;
extern int g_use_wdc_standard;
#endif

#ifdef SPC700
#if defined(SPC700)
extern int g_input_number_expects_dot;
#endif

Expand All @@ -56,7 +56,7 @@ static void _output_assembled_instruction(struct instruction *instruction, const
va_start(ap, format);

vfprintf(g_file_out_ptr, format, ap);
#ifdef WLA_DEBUG
#if defined(WLA_DEBUG)
{
char ttt[256];

Expand Down Expand Up @@ -242,7 +242,7 @@ static int _parse_exg_tfr_registers(void) {
#endif


#ifdef SUPERFX
#if defined(SUPERFX)

/* parse a number [min, max] */
int _parse_tiny_int(int min, int max) {
Expand All @@ -269,7 +269,7 @@ int _parse_tiny_int(int min, int max) {
#endif


#ifdef MC68000
#if defined(MC68000)

static int _mc68000_size_check(int data, int size) {

Expand Down Expand Up @@ -997,7 +997,7 @@ static int _mc68000_parse_register(char *code, int *index, int *reg, int *mode)
int evaluate_token(void) {

int f, x, y, last_stack_id_backup, instruction_i;
#if defined(Z80) || defined(SPC700) || defined(W65816) || defined(WDC65C02) || defined(CSG65CE02) || defined(HUC6280)
#if defined(Z80) || defined(Z80N) || defined(SPC700) || defined(W65816) || defined(WDC65C02) || defined(CSG65CE02) || defined(HUC6280)
int e, v, h;
char labelx[MAX_NAME_LENGTH + 1];
#endif
Expand Down Expand Up @@ -1127,15 +1127,15 @@ int evaluate_token(void) {
after this stack id... */
last_stack_id_backup = g_last_stack_id;

#ifdef SPC700
#if defined(SPC700)
/* does the instruction contain a dot? */
/* NOTE: as instruction decoders call return, we'll need to set this variable later back to NO */
g_input_number_expects_dot = s_instruction_tmp->has_dot;
#endif

switch (s_instruction_tmp->type) {

#ifdef GB
#if defined(GB)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -1362,12 +1362,12 @@ int evaluate_token(void) {

#endif

#ifdef Z80
#if defined(Z80) || defined(Z80N)

/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/* <Z80> */
/* <Z80/Z80N> */
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -1594,12 +1594,31 @@ int evaluate_token(void) {

for (x++; x < INSTRUCTION_STRING_LENGTH_MAX; s_parser_source_index++, x++) {
if (IS_THE_MATCH_COMPLETE(x)) {
if (z == SUCCEEDED)
_output_assembled_instruction(s_instruction_tmp, "y%d y%d ", s_instruction_tmp->hex, g_parsed_int);
else if (z == INPUT_NUMBER_ADDRESS_LABEL)
_output_assembled_instruction(s_instruction_tmp, "k%d y%d r%s ", g_active_file_info_last->line_current, s_instruction_tmp->hex, g_label);
else
_output_assembled_instruction(s_instruction_tmp, "y%d C%d ", s_instruction_tmp->hex, g_latest_stack);
/* "PUSH ?" hack */
if (s_instruction_tmp->hex == 0x8AED) {
/* high bytes comes first */
if (z == SUCCEEDED)
_output_assembled_instruction(s_instruction_tmp, "y%d d%d d%d ", s_instruction_tmp->hex, ((g_parsed_int) >> 8) & 0xFF, g_parsed_int & 0xFF);
else if (z == INPUT_NUMBER_ADDRESS_LABEL)
_output_assembled_instruction(s_instruction_tmp, "k%d y%d . r%s ", g_active_file_info_last->line_current, s_instruction_tmp->hex, g_label);
else {
struct stack *stack = find_stack_calculation(g_latest_stack, YES);

if (stack == NULL)
return FAILED;
stack->special_id = 4;

_output_assembled_instruction(s_instruction_tmp, "y%d C%d ", s_instruction_tmp->hex, g_latest_stack);
}
}
else {
if (z == SUCCEEDED)
_output_assembled_instruction(s_instruction_tmp, "y%d y%d ", s_instruction_tmp->hex, g_parsed_int);
else if (z == INPUT_NUMBER_ADDRESS_LABEL)
_output_assembled_instruction(s_instruction_tmp, "k%d y%d r%s ", g_active_file_info_last->line_current, s_instruction_tmp->hex, g_label);
else
_output_assembled_instruction(s_instruction_tmp, "y%d C%d ", s_instruction_tmp->hex, g_latest_stack);
}

g_source_index = s_parser_source_index;
return SUCCEEDED;
Expand Down Expand Up @@ -1828,14 +1847,14 @@ int evaluate_token(void) {
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/
/* </Z80> */
/* </Z80/Z80N> */
/*************************************************************************************************/
/*************************************************************************************************/
/*************************************************************************************************/

#endif

#ifdef MCS6502
#if defined(MCS6502)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -2006,7 +2025,7 @@ int evaluate_token(void) {

#endif

#ifdef WDC65C02
#if defined(WDC65C02)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -2251,7 +2270,7 @@ int evaluate_token(void) {

#endif

#ifdef CSG65CE02
#if defined(CSG65CE02)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -2544,7 +2563,7 @@ int evaluate_token(void) {

#endif

#ifdef W65816
#if defined(W65816)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -3061,7 +3080,7 @@ int evaluate_token(void) {

#endif

#ifdef MC68000
#if defined(MC68000)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -5618,7 +5637,7 @@ int evaluate_token(void) {

#endif

#ifdef MC6800
#if defined(MC6800)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -5794,7 +5813,7 @@ int evaluate_token(void) {

#endif

#ifdef MC6801
#if defined(MC6801)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -5970,7 +5989,7 @@ int evaluate_token(void) {

#endif

#ifdef MC6809
#if defined(MC6809)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -6436,7 +6455,7 @@ int evaluate_token(void) {

#endif

#ifdef I8008
#if defined(I8008)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -6617,7 +6636,7 @@ int evaluate_token(void) {

#endif

#ifdef I8080
#if defined(I8080)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -6798,7 +6817,7 @@ int evaluate_token(void) {

#endif

#ifdef SPC700
#if defined(SPC700)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -7485,7 +7504,7 @@ int evaluate_token(void) {

#endif

#ifdef HUC6280
#if defined(HUC6280)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down Expand Up @@ -7997,7 +8016,7 @@ int evaluate_token(void) {

#endif

#ifdef SUPERFX
#if defined(SUPERFX)

/*************************************************************************************************/
/*************************************************************************************************/
Expand Down

0 comments on commit 8dea744

Please sign in to comment.