1
0
mirror of https://github.com/cc65/cc65.git synced 2025-04-07 11:38:02 +00:00
Sidney Cadot ceac9f87ba Temporary fix for fgets() not using target-specific newline.
This patch provides a temporary fix for the issue where the fgets()
function did not use the target-specific newline character to
decide if it has reached the end of the line. It defaulted to the
value $0a, which is the newline character on only some targets.
The Atari, for example, has newline character $9b instead.

This patch is ugly, because the ca65 assembler that is used for
fgets doesn't currently accept C-type character escape sequences
as values. Ideally we'd be able to write:

		cmp #'\n'

And this would end up being translated to a compare-immediate
to the target-specific newline character.

Since that is impossible, this patch substitutes the equivalent,
but ugly, code:

		.byte $c9, "\n"

This works because $c9 is the opcode for cmp #imm, and the "\n"
string /is/ translated to the platform-specific newline character,
at least when the 'string_escapes' feature is enabled.
2024-12-18 07:44:52 +01:00
..
2024-01-24 09:58:09 +01:00
2020-02-03 20:45:09 +01:00
2023-02-26 20:03:41 +01:00
2024-09-07 18:51:20 +02:00
2023-02-26 20:03:41 +01:00
2023-09-07 07:14:01 +02:00
2024-09-07 19:17:00 +02:00
2024-01-24 09:58:09 +01:00
2023-09-07 07:14:01 +02:00
2023-09-07 07:14:01 +02:00
2023-09-02 12:44:53 +02:00
2024-06-19 23:52:25 -05:00
2022-07-21 03:20:44 +02:00
2023-02-26 20:03:41 +01:00
2022-07-21 03:20:44 +02:00
2023-02-26 20:03:41 +01:00
2024-01-24 16:32:45 +01:00
2023-02-26 20:03:41 +01:00
2023-09-15 10:35:36 +02:00
2024-02-11 23:12:27 +00:00
2023-02-26 20:03:41 +01:00
2023-02-26 20:03:41 +01:00
2020-02-03 20:45:09 +01:00
2023-02-26 20:03:41 +01:00
2024-09-07 19:14:59 +02:00
2023-09-07 07:14:01 +02:00
2024-02-17 16:02:57 -08:00
2022-07-21 03:20:44 +02:00
2023-05-25 18:09:03 +02:00
2022-09-02 11:55:54 +02:00
2023-02-26 20:03:41 +01:00
2023-11-16 18:46:16 -08:00