Has a discussion with Ped to how to best solve the problem that the same data area (in assembler) could be used for different purposes.
I.e. the example was that a message is received and the contents is differently interpreted depending on the sent message.
Ped's proposal was to use STRUCTs and alias labels.
See here:
https://github.com/z00m128/sjasmplus/blob/master/tests/macro_examples/union_like_structures.asm
STRUCT RECEIVE_BUFFER_CMD_READ_REGS, RECEIVE_BUFFER_HEADER
register_number BYTE 0
ENDS
STRUCT RECEIVE_BUFFER_CMD_CONTINUE, RECEIVE_BUFFER_HEADER
bp1_enable BYTE 0
bp1_address WORD 0
bp2_enable BYTE 0
bp2_address WORD 0
ENDS
STRUCT RECEIVE_BUFFER_CMD_PED_TEST, RECEIVE_BUFFER_HEADER
pattern BLOCK 256
ENDS
; find the structure with maximum size to define how long the receive_buffer should be
RB_MAX_SIZE = RECEIVE_BUFFER_HEADER
RB_MAX_SIZE = RB_MAX_SIZE >? RECEIVE_BUFFER_CMD_READ_REGS
RB_MAX_SIZE = RB_MAX_SIZE >? RECEIVE_BUFFER_CMD_CONTINUE
RB_MAX_SIZE = RB_MAX_SIZE >? RECEIVE_BUFFER_CMD_PED_TEST
; reserve the memory for the receive_buffer (one buffer for all)
ORG $8000
receive_buffer RECEIVE_BUFFER_HEADER
.data BLOCK RB_MAX_SIZE - RECEIVE_BUFFER_HEADER, 0
; definie alias labels for "receive_buffer" to access specific-command fields
rb_read_regs RECEIVE_BUFFER_CMD_READ_REGS = receive_buffer
rb_continue RECEIVE_BUFFER_CMD_CONTINUE = receive_buffer
rb_ped_test RECEIVE_BUFFER_CMD_PED_TEST = receive_buffer
Value Label
------ - -----------------------------------------------------------
0x0006 RECEIVE_BUFFER_HEADER
0x0000 X RECEIVE_BUFFER_HEADER.length
0x0004 X RECEIVE_BUFFER_HEADER.seq_no
0x0005 X RECEIVE_BUFFER_HEADER.command
0x0007 RECEIVE_BUFFER_CMD_READ_REGS
0x0006 X RECEIVE_BUFFER_CMD_READ_REGS.register_number
0x000C RECEIVE_BUFFER_CMD_CONTINUE
0x0006 X RECEIVE_BUFFER_CMD_CONTINUE.bp1_enable
0x0007 X RECEIVE_BUFFER_CMD_CONTINUE.bp1_address
0x0009 X RECEIVE_BUFFER_CMD_CONTINUE.bp2_enable
0x000A X RECEIVE_BUFFER_CMD_CONTINUE.bp2_address
0x0106 RECEIVE_BUFFER_CMD_PED_TEST
0x0006 X RECEIVE_BUFFER_CMD_PED_TEST.pattern
0x0106 RB_MAX_SIZE
0x8000 receive_buffer
0x8000 X receive_buffer.length
0x8004 X receive_buffer.seq_no
0x8005 receive_buffer.command
0x8006 X receive_buffer.command.data
0x8000 X rb_read_regs
0x8006 rb_read_regs.register_number
0x8000 X rb_continue
0x8006 rb_continue.bp1_enable
0x8007 rb_continue.bp1_address
0x8009 rb_continue.bp2_enable
0x800A rb_continue.bp2_address
0x8000 X rb_ped_test
0x8006 rb_ped_test.pattern
0xC000 X process_command
0xC00B process_command.not_read_regs
0xC01F process_command.not_continue
This would serve my purpose but DeZog cannot parse this at the moment.
I should extend the parsing also to the labels section.
Or maybe I should not parse the list file anymore but instead the SLD file and the labels file.
Should be easier and more complete.
Has a discussion with Ped to how to best solve the problem that the same data area (in assembler) could be used for different purposes. I.e. the example was that a message is received and the contents is differently interpreted depending on the sent message. Ped's proposal was to use STRUCTs and alias labels. See here: https://github.com/z00m128/sjasmplus/blob/master/tests/macro_examples/union_like_structures.asm
https://github.com/z00m128/sjasmplus/blob/master/tests/macro_examples/union_like_structures.lst
This would serve my purpose but DeZog cannot parse this at the moment.
I should extend the parsing also to the labels section.
Or maybe I should not parse the list file anymore but instead the SLD file and the labels file. Should be easier and more complete.