Re: [fpc-devel] Questions regarding m68k-atari target

2022-02-01 Thread Karoly Balogh via fpc-devel
Hi,

On Tue, 1 Feb 2022, Thorsten Otto via fpc-devel wrote:

> On Dienstag, 1. Februar 2022 09:11:21 CET Pierre Muller via fpc-devel wrote:
>
> > thus you should use
> > -Aas-out
> > compiler option.
>
> Ah thx. Would make more sense to just use "as" like for other targets,
> but i see that this target is also used for amiga.

The distinction is made for a reason, namely to support GNU as both with
and without section smartlinking. If you want to work on "modern" GNU as
support, just add system_m68k_atari into ag68kgas.pas, line 363. Then both
-Aas-out and -Aas would work, the later producing assembler source with
many sections for section smartlinking.

Back then this wasn't a thing on Amiga, or Atari, therefore they haven't
been added to the assembler list that enables section smartlinking. Also
note there might be small things to tweak here-and-there in the writer to
make this work, but if you want to enable it as a developer, while keeping
the existing a.out support intact, this is the way.

Charlie
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Questions regarding m68k-atari target

2022-02-01 Thread Tomas Hajny via fpc-devel

On 2022-02-01 06:02, Thorsten Otto via fpc-devel wrote:

On Samstag, 29. Januar 2022 16:03:32 CET Tomas Hajny via fpc-devel
wrote:


does it return individual characters, or does it
return the whole line at once (the latter being the case for other FPC
targets as far as I know)?


Just tried with a small test program, and the behaviour is a bit
strange. Fread(0, count, buf) returns when you either press return, or
the count has been reached. However, if you press return, the return
value does not include the CR, nor is that CR written to the buffer.


Right, I expected something like that based on the described behaviour. 
Is the pressed CR never returned then, or is it returned in a following 
fread call?




The Window ReadFile function behaves totally differently there. It
only returns when you press enter, and the buffer and count includes a
CR/LF.


Indeed, that's what I already mentioned. Moreover, the ReadFile function 
on Windows (and similarly the respective equivalents on various other 
platforms) doesn't even allow the user to enter more characters than the 
buffer length _minus_space_for_the_terminating_end_of_line_marker_ when 
reading from console (not necessarily when reading from standard input - 
if the standard input is redirected and gets input from a file, more 
characters are accepted). In other words, reading characters (pressed 
keys) stops when reaching character 253 and nothing except the Enter key 
is accepted (and the Enter key is then stored as #13 and #10 to the end 
of the buffer as correctly mentioned by you). I'm afraid that the 
observed behaviour of fread suggests that you need to modify the do_read 
implementation for atari to do the same if reading from console - in 
other words, you need to call fread with one less character in "len" in 
that case (and add it to the end of the buffer being returned from 
do_read afterwards).


BTW, be careful about distinction between the standard input handle and 
input from console unless either no redirection of input is possible, or 
the handle of such an input changes to a different value in that case 
(as of now, the implementation of do_isdevice for atari works only with 
the handle number rather than checking what the handle refers to using 
some special API function, but that may not be correct).


Tomas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Questions regarding m68k-atari target

2022-02-01 Thread Thorsten Otto via fpc-devel
On Dienstag, 1. Februar 2022 09:11:21 CET Pierre Muller via fpc-devel wrote:
> thus you should use
>-Aas-out
> compiler option.

Ah thx. Would make more sense to just use "as" like for other targets, but i 
see that this target is also used for amiga.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel


Re: [fpc-devel] Questions regarding m68k-atari target

2022-02-01 Thread Pierre Muller via fpc-devel



Le 01/02/2022 à 06:28, Thorsten Otto via fpc-devel a écrit :

On Freitag, 28. Januar 2022 13:55:11 CET Thorsten Otto via fpc-devel wrote:

 > Then i tried -Aas, but then the compiler also complains:

 >

 >

 >

 > Warning: (treated as error) Assembler output selected "AS" is not compatible

 > with "Atari ST/STE"

 >

 > Warning: (treated as error) "VASM" assembler use forced

Bump ;)

Any solution to this? Currently seems to be impossible to use gas at all.


  Sometimes, you need to dig into the sources:
look at compiler/m68k/ag68kgas.pas unit.

  You will see that atari is listed there:
muller@gcc120:~/pas/trunk/fpcsrc/compiler/m68k$ grep -inC7 atari ag68kgas.pas
370-
371-   as_m68k_as_aout_info : tasminfo =
372-  (
373-id : as_m68k_as_aout;
374-idtxt  : 'AS-AOUT';
375-asmbin : 'as';
376-asmcmd : '$ARCH -o $OBJ $EXTRAOPT $ASM';
377:supported_targets : [system_m68k_Amiga,system_m68k_Atari];
378-flags : [af_needar];
379-labelprefix : '.L';
380-labelmaxlen : -1;
381-comment : '# ';
382-dollarsign: '$';
383-  );


The idtxt field is the string you need to use to enable GNU assembler for aout 
format,
thus you should use
  -Aas-out
compiler option. It is true that this entry is missing in
ppc68k -h
output...

Pierre

Pierre

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel