Terraspace / UASM

UASM - Macro Assembler
http://www.terraspace.co.uk/uasm.html
Other
220 stars 49 forks source link

General failure with unicode string literals #110

Closed vid512 closed 4 years ago

vid512 commented 5 years ago

`option stackbase:rsp option frame:auto option literals:on

.code

; works _crash_message dw "Application has crashed!",13,10,13,10, "For details, see the crash dump file: ",13,10

; fails with "General failure" _crash_message dw "Application has crashed!",13,10,13,10 dw "For details, see the crash dump file: ",13,10

end `

mrfearless commented 5 years ago

The CR,LF (13, 10) is not in wide format. should be 13,0,10,0 - might need a double null to zero terminate in wide format, which might be optional in single line usage.

Probably easier to define constants to use:

CRLF EQU 13,10
CRLFW EQU 13,0,10,0
NULLW EQU 0,0
_crash_message dw "Application has crashed!",CRLFW,CRLFW, "For details, see the crash dump file: ",CRLFW, NULLW

This version might need the double null, whereas the single line one probably adds it by default

_crash_message dw "Application has crashed!",13,0,10,0,13,0,10,0
dw "For details, see the crash dump file: ",13,0,10,0
dw 0,0
john-terraspace commented 5 years ago

I’ll have a look at this case and see if there is anything we can do to make it simpler in the general case, at the very least no general failures.

From: fearless notifications@github.com Sent: 18 July 2019 19:44 To: Terraspace/UASM UASM@noreply.github.com Cc: Subscribed subscribed@noreply.github.com Subject: Re: [Terraspace/UASM] General failure with unicode string literals (#110)

The CR,LF (13, 10) is not in wide format. should be 13,0,10,0 - might need a double null to zero terminate in wide format, which might be optional in single line usage.

Probably easier to define constants to use:

CRLF EQU 13,10 CRLFW EQU 13,0,10,0 NULLW EQU 0,0 _crash_message dw "Application has crashed!",CRLFW,CRLFW, "For details, see the crash dump file: ",CRLFW, NULLW

This version might need the double null, whereas the single line one probably adds it by default

_crash_message dw "Application has crashed!",13,0,10,0,13,0,10,0 dw "For details, see the crash dump file: ",13,0,10,0 dw 0,0

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Terraspace/UASM/issues/110?email_source=notifications&email_token=AEAZAVC7DNT6HDN4RMN3ZMDQAC2Y3A5CNFSM4IE5POO2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2JNKAA#issuecomment-512939264 , or mute the thread https://github.com/notifications/unsubscribe-auth/AEAZAVD2Q3GD53BC5ZVIP53QAC2Y3ANCNFSM4IE5POOQ .

vid512 commented 5 years ago

mrfearless: I think you are wrong about that. What you describe is how unicode CRLF is defined with db directive. dw 13, 10 defines two words, with value 13 and 10, as it is supposed to. Equivalent to db 13,0,10,0. I've just checked, the first line correctly produces following data (pasted from IDA):

.text:0000000000000000 unicode 0, <Application has crashed!> .text:0000000000000000 dw 0Dh, 0Ah, 0Dh, 0Ah .text:0000000000000000 unicode 0, <For details, see the crash dump file: > .text:0000000000000000 dw 0Dh, 0Ah

Also note, that the terminating zero is omitted on purpose here. I wasn't trying to define a null-terminated string.

But all that is irrelevant to this bug report. It's about the "general failure".

mrfearless commented 5 years ago

Yes your right, I mistook the 13,10 as being a byte sequence

john-terraspace commented 5 years ago

This is fixed now in 2.50 branch. The issue was the second line doesn't refer to a "symbol" and is just raw data.