hi again:
i have a file in "s19" format that i need to convert to a "fcb" statement for an assembler to compile. the s19 file starts with S1, followed by the hex number of bytes in the line (13h = 19d), a 4 byte address, and then 16 data bytes, ending with a checksum.
one line is shown as an example:
S1130840CF0BFF4DF4014DF501160969CE0800CC1C
the assembler directive format i need is to place the text "fcb" at the start of a line followed by the 16 data bytes (2 characters per byte) prefaced with a dollar sign and followed by a comma. the s1, number of bytes and checksum must not appear in the line.
below is the format required.
fcb $cf,$0b,$ff,$4d,$f4,$01,$4d,$f5,$01,$16,$09,$69,$ce,$08,$00,$cc
i would prefer to compile a line of text and write it to the target file using write_line(), but i'm stymied on how to create the line. or should i be using a loop and just write the characters one at a time using .write?
dim num_char as n
dim test_text as c
dim line_hold as c
dim s_data as c
s_source=file.open("d:\convs19\flasher.s19",file_ro_shared) 'open the dada source
s_target=file.create("d:\convs19\flasher.asm",file_rw_exclusive) 'create the output file
debug(1)
s_data=s_source.read_line() 'skip the header record
' while .not. s_source.eof()
s_data=s_source.read_line()
num_char=hex_to_dec(substr(s_data,3,2))-3 'get the record length less the address and checksum
'need to create a "form hex byte" string
' for i = 1 to var->num_char 'cycle through the line
line_hold="123456abcdef"
s_target.write_line("fcb"+" "+var->line_hold) 'write the compiled line
s_data=s_target.read_line()
s_source.close()
s_target.close()
debug(0)
end
thanks in advance (one more time)!!
best regards,
ed
i have a file in "s19" format that i need to convert to a "fcb" statement for an assembler to compile. the s19 file starts with S1, followed by the hex number of bytes in the line (13h = 19d), a 4 byte address, and then 16 data bytes, ending with a checksum.
one line is shown as an example:
S1130840CF0BFF4DF4014DF501160969CE0800CC1C
the assembler directive format i need is to place the text "fcb" at the start of a line followed by the 16 data bytes (2 characters per byte) prefaced with a dollar sign and followed by a comma. the s1, number of bytes and checksum must not appear in the line.
below is the format required.
fcb $cf,$0b,$ff,$4d,$f4,$01,$4d,$f5,$01,$16,$09,$69,$ce,$08,$00,$cc
i would prefer to compile a line of text and write it to the target file using write_line(), but i'm stymied on how to create the line. or should i be using a loop and just write the characters one at a time using .write?
dim num_char as n
dim test_text as c
dim line_hold as c
dim s_data as c
s_source=file.open("d:\convs19\flasher.s19",file_ro_shared) 'open the dada source
s_target=file.create("d:\convs19\flasher.asm",file_rw_exclusive) 'create the output file
debug(1)
s_data=s_source.read_line() 'skip the header record
' while .not. s_source.eof()
s_data=s_source.read_line()
num_char=hex_to_dec(substr(s_data,3,2))-3 'get the record length less the address and checksum
'need to create a "form hex byte" string
' for i = 1 to var->num_char 'cycle through the line
line_hold="123456abcdef"
s_target.write_line("fcb"+" "+var->line_hold) 'write the compiled line
s_data=s_target.read_line()
s_source.close()
s_target.close()
debug(0)
end
thanks in advance (one more time)!!
best regards,
ed
Comment