Re: [fpc-devel] FPC and Z80
Am 23.06.2020 um 18:59 schrieb popolon...@popolony2k.com.br: Thanks a lot. Everything is working fine. I compiled my first FPC code (simple hello world) to MSX-DOS2 and is working fine. Good to know. :) The only thing I realized, is something someone here wrote before, that is the size of generated binary (37 Kb considering this simple program) I really don't know what's the reason but if is something about future Z80 code generation optimization please let me know and I can help with it. Nikolay (who had pushed the Z80 port across the finishline) already pointed out some stuff that can be improved. Especially that the RTL is linking in quite some stuff that might not be used is an important point of the bloat (you can use -Xm to have the linker generate a map file so that you can see what is included). We're working on improving things here, but it's a step by step process, especially as the cross platform parts of the RTL need to keep working for other platforms as well. Contributions are however welcome. It might also be interesting to compare the code that FPC generates with the one that TP3 generates. Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
On Tue, 2020-06-23 at 13:59 -0300, popolon...@popolony2k.com.br wrote: > FPC Team. > > > > Thanks a lot. Everything is working fine. I compiled my first FPC > code (simple hello world) to MSX-DOS2 and is working fine. > > The only thing I realized, is something someone here wrote before, > that is the size of generated binary (37 Kb considering this simple > program) I really don't know what's the reason but if is something > about future Z80 code generation optimization please let me know and > I can help with it. There are three areas that would improve code size: 1. Add more optimizations to the Z80 code generator 2. Add Z80-specific asm optimized RTL helpers (see e.g. the .inc files in https://svn.freepascal.org/svn/fpc/trunk/rtl/i386/ to see the i386 asm helpers or https://svn.freepascal.org/svn/fpc/trunk/rtl/i8086/ for the i8086 ones. Similar ones can and should be implemented for the Z80) 3. Rework/improve the RTL, so it provides the same functionality with less code or allow to exclude certain features like widestring/unicodestrings on certain platforms in order to reduce RTL bloat. We're working on it, but, as always, patches are welcome! :) > > Now I have a long path to run, that is porting my legacy code to FPC. > Good luck and enjoy! :) Best regards, Nikolay > > > Thanks > > PopolonY2k > > > > > Em 23/06/2020 12:53, popolon...@popolony2k.com.br escreveu: > > > Hi Sven thank you. > > > > I had read wiki and understood the same as you explained here. Now > > I'm using another machine based on Debian, instead my other machine > > based on Mint and seems that worked like you wrote. > > > > Now I built everything and I checked these generated files on RTL > > and compiler directories and was generated like you mentioned. I'll > > try again on Mint. > > > > "(and I hope you mean OS_TARGET and not OS_VERSION > > ;))"you're right again - my mistake. > > > > Thanks a lot. > > > > PopolonY2k > > > > Em 23/06/2020 12:11, Sven Barth escreveu: > > > > > schrieb am Di., 23. Juni 2020, > > > 15:56: > > > > Hi FPC team. > > > > > > > > I'm trying to compile a FPC 3.2 with support to Z80/MSXDOS, for > > > > linux and almost everything seems to be compiling fine, because > > > > the compiler was generated but RTL was not. > > > > > > > > I'm using the same build script of zxspectrum (I just changed > > > > OS_VERSION to MSXDOS) that can be reached here > > > > https://wiki.freepascal.org/Z80 (follow the Building > > > > paragraph). > > > > > > > > > > > > > > As I've mentioned here: > > > https://wiki.freepascal.org/MSX-DOS#Building_a_program > > > A full build will fail for now (because the Sysutils unit and > > > others are missing), but as long as you get a ppcrossz80 in the > > > compiler directory and at least a system.a and si_prc.a in > > > rtl/units/z80-msxdos you're all set :) (and I hope you mean > > > OS_TARGET and not OS_VERSION ;)) > > > > > > Regards, > > > Sven > > > > > > > ___ > > fpc-devel maillist - fpc-devel@lists.freepascal.org > > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel > > ___ > fpc-devel maillist - fpc-devel@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
FPC Team. Thanks a lot. Everything is working fine. I compiled my first FPC code (simple hello world) to MSX-DOS2 and is working fine. The only thing I realized, is something someone here wrote before, that is the size of generated binary (37 Kb considering this simple program) I really don't know what's the reason but if is something about future Z80 code generation optimization please let me know and I can help with it. Now I have a long path to run, that is porting my legacy code to FPC. Thanks PopolonY2k Em 23/06/2020 12:53, popolon...@popolony2k.com.br escreveu: > Hi Sven thank you. > > I had read wiki and understood the same as you explained here. Now I'm using > another machine based on Debian, instead my other machine based on Mint and > seems that worked like you wrote. > > Now I built everything and I checked these generated files on RTL and > compiler directories and was generated like you mentioned. I'll try again on > Mint. > > "(and I hope you mean OS_TARGET and not OS_VERSION ;))"you're right > again - my mistake. > > Thanks a lot. > > PopolonY2k > > Em 23/06/2020 12:11, Sven Barth escreveu: > > schrieb am Di., 23. Juni 2020, 15:56: > > Hi FPC team. > > I'm trying to compile a FPC 3.2 with support to Z80/MSXDOS, for linux and > almost everything seems to be compiling fine, because the compiler was > generated but RTL was not. > > I'm using the same build script of zxspectrum (I just changed OS_VERSION to > MSXDOS) that can be reached here https://wiki.freepascal.org/Z80 (follow the > Building paragraph). > > As I've mentioned here: > https://wiki.freepascal.org/MSX-DOS#Building_a_program > A full build will fail for now (because the Sysutils unit and others are > missing), but as long as you get a ppcrossz80 in the compiler directory and > at least a system.a and si_prc.a in rtl/units/z80-msxdos you're all set :) > (and I hope you mean OS_TARGET and not OS_VERSION ;)) > > Regards, > Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Hi Sven thank you. I had read wiki and understood the same as you explained here. Now I'm using another machine based on Debian, instead my other machine based on Mint and seems that worked like you wrote. Now I built everything and I checked these generated files on RTL and compiler directories and was generated like you mentioned. I'll try again on Mint. "(and I hope you mean OS_TARGET and not OS_VERSION ;))"you're right again - my mistake. Thanks a lot. PopolonY2k Em 23/06/2020 12:11, Sven Barth escreveu: > schrieb am Di., 23. Juni 2020, 15:56: > >> Hi FPC team. >> >> I'm trying to compile a FPC 3.2 with support to Z80/MSXDOS, for linux and >> almost everything seems to be compiling fine, because the compiler was >> generated but RTL was not. >> >> I'm using the same build script of zxspectrum (I just changed OS_VERSION to >> MSXDOS) that can be reached here https://wiki.freepascal.org/Z80 (follow the >> Building paragraph). > > As I've mentioned here: > https://wiki.freepascal.org/MSX-DOS#Building_a_program > A full build will fail for now (because the Sysutils unit and others are > missing), but as long as you get a ppcrossz80 in the compiler directory and > at least a system.a and si_prc.a in rtl/units/z80-msxdos you're all set :) > (and I hope you mean OS_TARGET and not OS_VERSION ;)) > > Regards, > Sven___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
On Tue, 23 Jun 2020, 17:18 , wrote: > Hi Christo, > > I'm using exactly trunk, as written in article, but for MSXDOS target > isn't working as seen in logs I sent before. But when I build FPC for > spectrum as target, everything works fine (100% compiling successful). > OK, I was confused by the mention of 3.2. :-) ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Yes I'm using trunk. Sorry by my mistake on first email. PopolonY2k Em 23/06/2020 12:12, Sven Barth via fpc-devel escreveu: > Christo Crause schrieb am Di., 23. Juni 2020, > 16:37: > > On Tue, Jun 23, 2020 at 3:56 PM wrote: > > Hi FPC team. > > I'm trying to compile a FPC 3.2 with support to Z80/MSXDOS, for linux and > almost everything seems to be compiling fine, because the compiler was > generated but RTL was not. > > AFAIK Z80 support is not included in the stable release, so you have to use > trunk for Z80. This is also mentioned in the Overview paragraph of the wiki > page you refer to below. It looks like a trunk build, not 3.2.0 as otherwise there wouldn't be a trace of "ppcz80" yet. ;) Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Hi Christo, I'm using exactly trunk, as written in article, but for MSXDOS target isn't working as seen in logs I sent before. But when I build FPC for spectrum as target, everything works fine (100% compiling successful). PopolonY2k Em 23/06/2020 11:37, Christo Crause via fpc-devel escreveu: > On Tue, Jun 23, 2020 at 3:56 PM wrote: > >> Hi FPC team. >> >> I'm trying to compile a FPC 3.2 with support to Z80/MSXDOS, for linux and >> almost everything seems to be compiling fine, because the compiler was >> generated but RTL was not. > > AFAIK Z80 support is not included in the stable release, so you have to use > trunk for Z80. This is also mentioned in the Overview paragraph of the wiki > page you refer to below. > >> I'm using the same build script of zxspectrum (I just changed OS_VERSION to >> MSXDOS) that can be reached here https://wiki.freepascal.org/Z80 (follow the >> Building paragraph). > > ___ > fpc-devel maillist - fpc-devel@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Christo Crause schrieb am Di., 23. Juni 2020, 16:37: > On Tue, Jun 23, 2020 at 3:56 PM wrote: > >> Hi FPC team. >> >> I'm trying to compile a FPC 3.2 with support to Z80/MSXDOS, for linux and >> almost everything seems to be compiling fine, because the compiler was >> generated but RTL was not. >> >> >AFAIK Z80 support is not included in the stable release, so you have to > use trunk for Z80. This is also mentioned in the Overview paragraph of the > wiki page you refer to below. > It looks like a trunk build, not 3.2.0 as otherwise there wouldn't be a trace of "ppcz80" yet. ;) Regards, Sven > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
schrieb am Di., 23. Juni 2020, 15:56: > Hi FPC team. > > I'm trying to compile a FPC 3.2 with support to Z80/MSXDOS, for linux and > almost everything seems to be compiling fine, because the compiler was > generated but RTL was not. > > I'm using the same build script of zxspectrum (I just changed OS_VERSION > to MSXDOS) that can be reached here https://wiki.freepascal.org/Z80 > (follow the Building paragraph). > As I've mentioned here: https://wiki.freepascal.org/MSX-DOS#Building_a_program A full build will fail for now (because the Sysutils unit and others are missing), but as long as you get a ppcrossz80 in the compiler directory and at least a system.a and si_prc.a in rtl/units/z80-msxdos you're all set :) (and I hope you mean OS_TARGET and not OS_VERSION ;)) Regards, Sven > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
On Tue, Jun 23, 2020 at 3:56 PM wrote: > Hi FPC team. > > I'm trying to compile a FPC 3.2 with support to Z80/MSXDOS, for linux and > almost everything seems to be compiling fine, because the compiler was > generated but RTL was not. > > AFAIK Z80 support is not included in the stable release, so you have to use trunk for Z80. This is also mentioned in the Overview paragraph of the wiki page you refer to below. > I'm using the same build script of zxspectrum (I just changed OS_VERSION > to MSXDOS) that can be reached here https://wiki.freepascal.org/Z80 > (follow the Building paragraph). > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Hi FPC team. I'm trying to compile a FPC 3.2 with support to Z80/MSXDOS, for linux and almost everything seems to be compiling fine, because the compiler was generated but RTL was not. I'm using the same build script of zxspectrum (I just changed OS_VERSION to MSXDOS) that can be reached here https://wiki.freepascal.org/Z80 (follow the Building paragraph). These are the messages I got: globals.pas(40,7) Fatal: Can't find unit sysutils used by globals Fatal: Compilation aborted Makefile:4781: recipe for target 'ppcz80.exe' failed make[3]: *** [ppcz80.exe] Error 1 make[3]: Leaving directory '/home/popolony2k/Projects/Pascal/fpc-z80/fpc/compiler' Makefile:4886: recipe for target 'cycle' failed make[2]: *** [cycle] Error 2 make[2]: Leaving directory '/home/popolony2k/Projects/Pascal/fpc-z80/fpc/compiler' Makefile:3023: recipe for target 'compiler_cycle' failed make[1]: *** [compiler_cycle] Error 2 make[1]: Leaving directory '/home/popolony2k/Projects/Pascal/fpc-z80/fpc' Makefile:3055: recipe for target 'build-stamp.z80-msxdos' failed make: *** [build-stamp.z80-msxdos] Error 2 Any ideas ?? PopolonY2k Em 10/06/2020 02:57, Sven Barth escreveu: > PopolonY2K schrieb am Mi., 10. Juni 2020, > 00:38: > >> Thank you. >> >> My library is very complete, 100% MSXBIOS, MSXDOS and MSXDOS2, Memory mapper >> and several others implementations ready, but they are working just with TP3. >> >> Features like Inline code are provided by FPC by using Asm/EndAsm. > > Correct. You'll need to rewrite any assembly code due to FPC having mnemonic > based inline assembly. But to keep compatibility with TP you could use ifdefs > for this (e.g. $ifdef fpc). > >> But how to deal with absolute variables in FPC ? I think in older TP for PC >> is possible using absolute with address notation in the same way as old 16 >> bit style [Seg:Ofs], is this correct ? >> >> But in machine with absolute addressing like Z80, the behavior of absolute >> variables are the same as TP3 ? > > As Z80 doesn't have segmentation like i8086 it's simply the same as for every > other platform we support: > > var > SomeVar: Int8 absolute $1234; > > Regards, > Sven___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
PopolonY2K schrieb am Mi., 10. Juni 2020, 00:38: > Thank you. > > My library is very complete, 100% MSXBIOS, MSXDOS and MSXDOS2, Memory > mapper and several others implementations ready, but they are working just > with TP3. > > Features like Inline code are provided by FPC by using Asm/EndAsm. > Correct. You'll need to rewrite any assembly code due to FPC having mnemonic based inline assembly. But to keep compatibility with TP you could use ifdefs for this (e.g. $ifdef fpc). > But how to deal with absolute variables in FPC ? I think in older TP for > PC is possible using absolute with address notation in the same way as old > 16 bit style [Seg:Ofs], is this correct ? > > But in machine with absolute addressing like Z80, the behavior of absolute > variables are the same as TP3 ? > As Z80 doesn't have segmentation like i8086 it's simply the same as for every other platform we support: var SomeVar: Int8 absolute $1234; Regards, Sven > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Thank you. My library is very complete, 100% MSXBIOS, MSXDOS and MSXDOS2, Memory mapper and several others implementations ready, but they are working just with TP3. Features like Inline code are provided by FPC by using Asm/EndAsm. But how to deal with absolute variables in FPC ? I think in older TP for PC is possible using absolute with address notation in the same way as old 16 bit style [Seg:Ofs], is this correct ? But in machine with absolute addressing like Z80, the behavior of absolute variables are the same as TP3 ? Thanks in advance. Regards PopolonY2k Em 9 de junho de 2020 12:10:57 BRT, Sven Barth escreveu: >PopolonY2K schrieb am Di., 9. Juni 2020, >16:03: > >> Thanks. >> >> I'll start porting all Turbo Pascal 3 library compatible, to FPC >using >> units. >> > >Great! If you find any problems, please don't hesitate to report them >either here or on the bugtracker at bugs.freepascal.org :) >And if you have any questions, please feel free to ask them here (in a >new >thread, please ;) ) > >Regards, >Sven > >> -- Enviado de meu dispositivo Android com K-9 mail. Desculpe-me pela brevidade.___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
PopolonY2K schrieb am Di., 9. Juni 2020, 16:03: > Thanks. > > I'll start porting all Turbo Pascal 3 library compatible, to FPC using > units. > Great! If you find any problems, please don't hesitate to report them either here or on the bugtracker at bugs.freepascal.org :) And if you have any questions, please feel free to ask them here (in a new thread, please ;) ) Regards, Sven > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Thanks. I'll start porting all Turbo Pascal 3 library compatible, to FPC using units. Regards Leidson Campos. Em 7 de junho de 2020 09:39:43 BRT, Sven Barth via fpc-devel escreveu: >Am 16.04.2020 um 11:04 schrieb Guillermo: >> Thanks Swen. >> >> I see last commit was 2 days ago so it is active. I would like to >know >> who is responsible to speak to him. May be I can help with the MSX >> target, but I need gidance about the internals of the compiler (I >tried >> but it is beyond my comprehension right now). > >As you may or may not have noticed FPC now supports MSX-DOS (see also >https://wiki.freepascal.org/MSX-DOS ). This is of course different from > >a "bare" MSX, but it's a first step. If you want you could help start a > >MSX unit that deals with the MSX BIOS and the other low level MSX stuff > >after all it would be useful for the MSX-DOS target after all as well. >;) > >Regards, >Sven (Note the "v" ;) ) >___ >fpc-devel maillist - fpc-devel@lists.freepascal.org >https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel -- Enviado de meu dispositivo Android com K-9 mail. Desculpe-me pela brevidade.___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Am 16.04.2020 um 11:04 schrieb Guillermo: Thanks Swen. I see last commit was 2 days ago so it is active. I would like to know who is responsible to speak to him. May be I can help with the MSX target, but I need gidance about the internals of the compiler (I tried but it is beyond my comprehension right now). As you may or may not have noticed FPC now supports MSX-DOS (see also https://wiki.freepascal.org/MSX-DOS ). This is of course different from a "bare" MSX, but it's a first step. If you want you could help start a MSX unit that deals with the MSX BIOS and the other low level MSX stuff after all it would be useful for the MSX-DOS target after all as well. ;) Regards, Sven (Note the "v" ;) ) ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Op 2020-04-27 om 21:24 schreef Florian Klämpfl: Well, for 6502 working 16-bit ptr indirect via volatile zp memory locations needs to be implemented anyway :-) Does that CPU have no hardware stack at all, or only limited (128/256 bytes or so?) It has a full stack but too little registers to use it efficiently for local variables: it has 3 8 bit registers pair plus accumulator (so 7 8 bit registers), Then you need a parallel software stack for parameters and local vars, and keep the hw stack for return addresses only. But like with the c=64 without 16-bit regs you probably need some form of indirect addressing via zeropage base pointers to access that stack( if>8bit). IIRC the 6502 had very little free ZPs, but a lot more if you can reuse the locations used by the interpreter (e.g. backup/restore if you want to be able to return to basic) two of them can be used as pairs for indirect addressing, so this makes life very hard That is already more than the 6502 has. Afaik the instruction pointer is the only 16-bit one. But if an basic interpreter can do it, so can a compiled program? ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Am 27.04.20 um 21:12 schrieb Marco van de Voort: Op 2020-04-27 om 18:28 schreef Florian Klaempfl: I have no idea, but quickly read through some docs, and it seems the GameBoy CPU doesn't have IX/IY registers, which seems to be very useful to implement some of the more complex references handling, according to what Nikolay wrote earlier. Yes. IX and IY are the key for the FPC Z80 port. Without them it's getting really difficult. And I suspect we need to work without a normal stack but allocate local variables globally, so basically no recursion will be possible. Well, for 6502 working 16-bit ptr indirect via volatile zp memory locations needs to be implemented anyway :-) Does that CPU have no hardware stack at all, or only limited (128/256 bytes or so?) It has a full stack but too little registers to use it efficiently for local variables: it has 3 8 bit registers pair plus accumulator (so 7 8 bit registers), two of them can be used as pairs for indirect addressing, so this makes life very hard, but maybe, when I think about it, doable ;) 8085 assembler was the first assembler I learned, at a certain time I knew the hex. codes for most instructions. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Op 2020-04-27 om 18:28 schreef Florian Klaempfl: I have no idea, but quickly read through some docs, and it seems the GameBoy CPU doesn't have IX/IY registers, which seems to be very useful to implement some of the more complex references handling, according to what Nikolay wrote earlier. Yes. IX and IY are the key for the FPC Z80 port. Without them it's getting really difficult. And I suspect we need to work without a normal stack but allocate local variables globally, so basically no recursion will be possible. Well, for 6502 working 16-bit ptr indirect via volatile zp memory locations needs to be implemented anyway :-) Does that CPU have no hardware stack at all, or only limited (128/256 bytes or so?) ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Florian Klaempfl schrieb am Mo., 27. Apr. 2020, 18:28: > Am 27.04.2020 um 17:52 schrieb Karoly Balogh (Charlie/SGR): > > Hi, > > > > On Mon, 27 Apr 2020, Sven Barth via fpc-devel wrote: > > > >>> Well, I'm surprised and impressed you got it to work at all... > >>> Quite an achievement. > >> > >> Considering that we already support AVR as well I was rather confident > >> here. :D Maybe in the future we can also add GameBoy support which uses > >> some Z80/8080 hybrid? ^^' > > > > I have no idea, but quickly read through some docs, and it seems the > > GameBoy CPU doesn't have IX/IY registers, which seems to be very useful > to > > implement some of the more complex references handling, according to what > > Nikolay wrote earlier. > > Yes. IX and IY are the key for the FPC Z80 port. Without them it's > getting really difficult. And I suspect we need to work without a normal > stack but allocate local variables globally, so basically no recursion > will be possible. > Pity... Oh, well, a topic for another time then :) Regards, Sven > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Am 27.04.2020 um 17:52 schrieb Karoly Balogh (Charlie/SGR): Hi, On Mon, 27 Apr 2020, Sven Barth via fpc-devel wrote: Well, I'm surprised and impressed you got it to work at all... Quite an achievement. Considering that we already support AVR as well I was rather confident here. :D Maybe in the future we can also add GameBoy support which uses some Z80/8080 hybrid? ^^' I have no idea, but quickly read through some docs, and it seems the GameBoy CPU doesn't have IX/IY registers, which seems to be very useful to implement some of the more complex references handling, according to what Nikolay wrote earlier. Yes. IX and IY are the key for the FPC Z80 port. Without them it's getting really difficult. And I suspect we need to work without a normal stack but allocate local variables globally, so basically no recursion will be possible. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
On Mon, 2020-04-27 at 17:52 +0200, Karoly Balogh (Charlie/SGR) wrote: > Hi, > > On Mon, 27 Apr 2020, Sven Barth via fpc-devel wrote: > > >> Well, I'm surprised and impressed you got it to work at all... > >> Quite an achievement. > > > > Considering that we already support AVR as well I was rather > confident > > here. :D Maybe in the future we can also add GameBoy support which > uses > > some Z80/8080 hybrid? ^^' > > I have no idea, but quickly read through some docs, and it seems the > GameBoy CPU doesn't have IX/IY registers, which seems to be very > useful to > implement some of the more complex references handling, according to > what > Nikolay wrote earlier. Also, it seems to be quite a few stuff missing > from > it, as well as it has some extras. The question is, how far it > diverges > from Z80 of course, and how that might violate some basic assumptions > the > Z80 CG currently does about the ISA. Ah, that sucks :( We currently use IX as the frame pointer (similar to BP on i8086), and there's this very convenient (IX+d) addressing. SDCC does the same. So, this would mean the GameBoy would probably be a different architecture, as far as FPC is concerned, with possibly some shared units, like maybe the instruction set info tables, etc. It think SDCC also treats it as a different arch. Nikolay ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
I'm kind of impressed actually that you're going out of your way to support older consoles and workstations. It's certainly good for hobbyist development. It's a shame that so many modern consoles have NDAs and physical measures to prevent homebrew software. I still feel sad that the OUYA flopped, even though I never owned one... I thought the concept of allowing homebrewing was a nice idea. If you can't tell, I have a slight passion for games development, but am stuck on the PC for now. Gareth aka. Kit On 27/04/2020 16:52, Karoly Balogh (Charlie/SGR) wrote: Hi, On Mon, 27 Apr 2020, Sven Barth via fpc-devel wrote: Well, I'm surprised and impressed you got it to work at all... Quite an achievement. Considering that we already support AVR as well I was rather confident here. :D Maybe in the future we can also add GameBoy support which uses some Z80/8080 hybrid? ^^' I have no idea, but quickly read through some docs, and it seems the GameBoy CPU doesn't have IX/IY registers, which seems to be very useful to implement some of the more complex references handling, according to what Nikolay wrote earlier. Also, it seems to be quite a few stuff missing from it, as well as it has some extras. The question is, how far it diverges from Z80 of course, and how that might violate some basic assumptions the Z80 CG currently does about the ISA. I suppose FPC is now probably the compiler working for the biggest number of CPUs/OSes - if it wasn't already. (C excepted, probably) After GCC I'd assume that, too :) GCC doesn't have most of what it supports mainline, rather in an independenly maintained fork, plus the C library is not included in its tree. So as far as "out of box" solutions go, FPC is quite up there. Charlie ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel -- This email has been checked for viruses by Avast antivirus software. https://www.avast.com/antivirus ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Hi, On Mon, 27 Apr 2020, Sven Barth via fpc-devel wrote: >> Well, I'm surprised and impressed you got it to work at all... >> Quite an achievement. > > Considering that we already support AVR as well I was rather confident > here. :D Maybe in the future we can also add GameBoy support which uses > some Z80/8080 hybrid? ^^' I have no idea, but quickly read through some docs, and it seems the GameBoy CPU doesn't have IX/IY registers, which seems to be very useful to implement some of the more complex references handling, according to what Nikolay wrote earlier. Also, it seems to be quite a few stuff missing from it, as well as it has some extras. The question is, how far it diverges from Z80 of course, and how that might violate some basic assumptions the Z80 CG currently does about the ISA. >> I suppose FPC is now probably the compiler working for the biggest >> number of CPUs/OSes - if it wasn't already. (C excepted, probably) > > After GCC I'd assume that, too :) GCC doesn't have most of what it supports mainline, rather in an independenly maintained fork, plus the C library is not included in its tree. So as far as "out of box" solutions go, FPC is quite up there. Charlie___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Michael Van Canneyt schrieb am Mo., 27. Apr. 2020, 15:40: > > > On Mon, 27 Apr 2020, nickysn--- via fpc-devel wrote: > > > Last night, I got the full system unit to compile, including console > > output, so now you can use standard write/writeln. Unfortunately if you > > include both read/readln and write/writeln in your program, the program > > becomes too big to fit in the memory of the 48k ZX Spectrum, so there's > > lots of optimizations left to do... :) However, the fact that the > > system unit compiles fully, means that the code generator is starting > > to become stable and, therefore, you should have little trouble porting > > FPC to other Z80 platforms, such as the MSX - it's a matter of writing > > the platform-specific RTL functions, and implementing the specific > > things (linking and postprocessing the binary), required to produce a > > program, in a format, suitable to run on the MSX. > > Well, I'm surprised and impressed you got it to work at all... > Quite an achievement. > Considering that we already support AVR as well I was rather confident here. :D Maybe in the future we can also add GameBoy support which uses some Z80/8080 hybrid? ^^' > I suppose FPC is now probably the compiler working for the biggest number > of > CPUs/OSes - if it wasn't already. (C excepted, probably) > After GCC I'd assume that, too :) Regards, Sven > ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Am 27.04.2020 um 15:37 schrieb nickysn--- via fpc-devel: On Mon, 2020-04-20 at 17:07 +0300, nick...@gmail.com wrote: On Thu, 2020-04-16 at 11:04 +0200, Guillermo wrote: Thanks Swen. I see last commit was 2 days ago so it is active. I would like to know who is responsible to speak to him. May be I can help with the MSX target, but I need gidance about the internals of the compiler (I tried but it is beyond my comprehension right now). The current state of the Z80 port is that it's partially working, but it's not complete enough in order to be able to compile a full RTL. However, simple stuff like this is working on the ZX Spectrum: program hello; var i: byte; begin PrintChar('F'); PrintChar('P'); PrintChar('C'); for b := 0 to 255 do PrintHexByte(b); end. Last night, I got the full system unit to compile, including console output, so now you can use standard write/writeln. Unfortunately if you include both read/readln and write/writeln in your program, the program becomes too big to fit in the memory of the 48k ZX Spectrum, so there's lots of optimizations left to do... :) Maybe you look in the rtl for the CPUAVR defines. Reducing e.g. the size of textrec helps a lot, also exception handling for io (not sure if it is activated) causes a big share of code being pulled in. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
On Mon, 2020-04-27 at 15:40 +0200, Michael Van Canneyt wrote: > > On Mon, 27 Apr 2020, nickysn--- via fpc-devel wrote: > > > Last night, I got the full system unit to compile, including > > console > > output, so now you can use standard write/writeln. Unfortunately if > > you > > include both read/readln and write/writeln in your program, the > > program > > becomes too big to fit in the memory of the 48k ZX Spectrum, so > > there's > > lots of optimizations left to do... :) However, the fact that the > > system unit compiles fully, means that the code generator is > > starting > > to become stable and, therefore, you should have little trouble > > porting > > FPC to other Z80 platforms, such as the MSX - it's a matter of > > writing > > the platform-specific RTL functions, and implementing the specific > > things (linking and postprocessing the binary), required to produce > > a > > program, in a format, suitable to run on the MSX. > > Well, I'm surprised and impressed you got it to work at all... > Quite an achievement. To be honest, I was also surprised how quickly I reached this point of code generator stability. The i8086 port was much more painful and took a lot of time to get it that stable. But now, things are different, because: 1. I'm much more familiar with the compiler internals, so the learning curve isn't that steep 2. The compiler already has been ported to 16-bit and 8-bit platforms, so there's less work needed in the generic parts of the code generator. 3. There are no special pointer types (near, far) and memory models. It's just 16-bit flat address space. On the other hand, this time: 1. I knew nothing about Z80 assembly when I started. 2. I knew nothing about the ZX Spectrum. So, this time, I had to learn about these things from scratch. I also had to implement the asm backend entirely, almost from scratch (actually Florian had already started it, but it wasn't as complete as the x86 family, which just borrows everything from i386, since i8086 is just a subset of the i386 instructions). > > I suppose FPC is now probably the compiler working for the biggest > number of > CPUs/OSes - if it wasn't already. (C excepted, probably) Yeah, after this port, I'm convinced that FPC can be ported to anything :) I guess, now 6502 becomes the next challenge. :) Btw, I'm also considering the PIC microcontroller family, because I use them in some of my hardware projects - AVR is cool, but sometimes there's a PIC that just has the right peripherals integrated for your project. :) But first, the Z80 target still needs a lot of optimizations, because it produces too many unnecessary moves and the code becomes quite bloated, at least compared to SDCC. Nikolay ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
On Mon, 27 Apr 2020, nickysn--- via fpc-devel wrote: Last night, I got the full system unit to compile, including console output, so now you can use standard write/writeln. Unfortunately if you include both read/readln and write/writeln in your program, the program becomes too big to fit in the memory of the 48k ZX Spectrum, so there's lots of optimizations left to do... :) However, the fact that the system unit compiles fully, means that the code generator is starting to become stable and, therefore, you should have little trouble porting FPC to other Z80 platforms, such as the MSX - it's a matter of writing the platform-specific RTL functions, and implementing the specific things (linking and postprocessing the binary), required to produce a program, in a format, suitable to run on the MSX. Well, I'm surprised and impressed you got it to work at all... Quite an achievement. I suppose FPC is now probably the compiler working for the biggest number of CPUs/OSes - if it wasn't already. (C excepted, probably) Michael. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
On Mon, 2020-04-20 at 17:07 +0300, nick...@gmail.com wrote: > On Thu, 2020-04-16 at 11:04 +0200, Guillermo wrote: > > Thanks Swen. > > > > I see last commit was 2 days ago so it is active. I would like to > > know > > who is responsible to speak to him. May be I can help with the MSX > > target, but I need gidance about the internals of the compiler (I > > tried > > but it is beyond my comprehension right now). > > > The current state of the Z80 port is that it's partially working, but > it's not complete enough in order to be able to compile a full RTL. > However, simple stuff like this is working on the ZX Spectrum: > > program hello; > var > i: byte; > begin > PrintChar('F'); > PrintChar('P'); > PrintChar('C'); > for b := 0 to 255 do > PrintHexByte(b); > end. Last night, I got the full system unit to compile, including console output, so now you can use standard write/writeln. Unfortunately if you include both read/readln and write/writeln in your program, the program becomes too big to fit in the memory of the 48k ZX Spectrum, so there's lots of optimizations left to do... :) However, the fact that the system unit compiles fully, means that the code generator is starting to become stable and, therefore, you should have little trouble porting FPC to other Z80 platforms, such as the MSX - it's a matter of writing the platform-specific RTL functions, and implementing the specific things (linking and postprocessing the binary), required to produce a program, in a format, suitable to run on the MSX. Nikolay ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
On Thu, 2020-04-16 at 11:04 +0200, Guillermo wrote: > Thanks Swen. > > I see last commit was 2 days ago so it is active. I would like to > know > who is responsible to speak to him. May be I can help with the MSX > target, but I need gidance about the internals of the compiler (I > tried > but it is beyond my comprehension right now). I started a wiki page about the Z80 port: https://wiki.freepascal.org/Z80 It should be a good starting point. I'll try to add more information to it as I go along. Nikolay > > Guillermo M. > > El Tue, 14 Apr 2020 22:46:47 +0200 > Sven Barth escribió: > > Am 13.04.2020 um 13:08 schrieb Guillermo: > > > Hi Pascaloids, > > > > > > I've read in the web forums[1] that FPC may include Zylog Z80 as > > > target, specifically Sinclair's micro computers, but looking at > > > the > > > SVN[2] I don't see any Z80 reference. > > It's currently in development in a branch: > > https://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/z80/ > > > > Regards, > > Sven > > ___ > fpc-devel maillist - fpc-devel@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
On Thu, 2020-04-16 at 11:04 +0200, Guillermo wrote: > Thanks Swen. > > I see last commit was 2 days ago so it is active. I would like to > know > who is responsible to speak to him. May be I can help with the MSX > target, but I need gidance about the internals of the compiler (I > tried > but it is beyond my comprehension right now). Hi, The Z80 branch was started by Florian about 2 years ago, but I've recently picked it up and I'm working on it. I'm targeting the ZX Spectrum as a first platform, for no particular reason, other than that's what I could get a working emulator for. Back in the 8-bit era I never had a Z80 computer, only 6502, but that is harder to support, so I decided to work on the Z80 target first, because that was already started by Florian. And besides, I've recently obtained an 8-bit computer that has it. It's a Pravetz 8M, that's a dual cpu (6502+Z80) machine, that is like an Apple II+ clone with a built-in Z80 CP/M card, so later I'm planning to support CP/M as well. The only reason I'm not starting with the CP/M target is that I don't have an emulator for it, and development is much faster when you have an emulator. To run code on the real Z80 computer, I need to write the program to a floppy disk, which is tedious and slow if you're doing it constantly. In theory, any Z80 computer can be easily supported. It's the Z80 code generator that is the hard part. The MSX should be pretty easy to support I think. The current state of the Z80 port is that it's partially working, but it's not complete enough in order to be able to compile a full RTL. However, simple stuff like this is working on the ZX Spectrum: program hello; var i: byte; begin PrintChar('F'); PrintChar('P'); PrintChar('C'); for b := 0 to 255 do PrintHexByte(b); end. So, it's just getting started to become interesting :) I you want to help, feel free to try it and ask any questions that you might have. Just keep in mind it's still very early and immature, so don't expect it to work for serious and complex code yet. But we'll eventually get there as well. :) Btw, I also did the i8086 (i.e. 16-bit x86) port a few years ago and in a way, it was much more difficult, because, at the time, the compiler wasn't really designed to target anything with less than a 32-bit CPU and 32-bit ALU. The 8-bit AVR target had been started, but wasn't mature enough yet, and wasn't really working. Nowadays, FPC supports 8- bit (AVR), 16-bit (i8086), 32-bit and 64-bit architectures, so the work is easier in many ways. However, the Z80 still has some unique challenges, so we'll see how it works out. :) Nikolay > > Guillermo M. > > El Tue, 14 Apr 2020 22:46:47 +0200 > Sven Barth escribió: > > Am 13.04.2020 um 13:08 schrieb Guillermo: > > > Hi Pascaloids, > > > > > > I've read in the web forums[1] that FPC may include Zylog Z80 as > > > target, specifically Sinclair's micro computers, but looking at > > > the > > > SVN[2] I don't see any Z80 reference. > > It's currently in development in a branch: > > https://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/z80/ > > > > Regards, > > Sven > > ___ > fpc-devel maillist - fpc-devel@lists.freepascal.org > https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
I think that you'll find some interesting links on this thread: https://forum.lazarus.freepascal.org/index.php/topic,38569.msg262288.html#msg262288 ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Am 16.04.20 um 11:04 schrieb Guillermo: Thanks Swen. I see last commit was 2 days ago so it is active. I would like to know who is responsible to speak to him. May be I can help with the MSX target, but I need gidance about the internals of the compiler (I tried but it is beyond my comprehension right now). You can ask question here. Learning the compiler internals is only learning by doing (and trying hard :)). ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Thanks Swen. I see last commit was 2 days ago so it is active. I would like to know who is responsible to speak to him. May be I can help with the MSX target, but I need gidance about the internals of the compiler (I tried but it is beyond my comprehension right now). Guillermo M. El Tue, 14 Apr 2020 22:46:47 +0200 Sven Barth escribió: > Am 13.04.2020 um 13:08 schrieb Guillermo: > > Hi Pascaloids, > > > > I've read in the web forums[1] that FPC may include Zylog Z80 as > > target, specifically Sinclair's micro computers, but looking at the > > SVN[2] I don't see any Z80 reference. > It's currently in development in a branch: > https://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/z80/ > > Regards, > Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
Am 13.04.2020 um 13:08 schrieb Guillermo: Hi Pascaloids, I've read in the web forums[1] that FPC may include Zylog Z80 as target, specifically Sinclair's micro computers, but looking at the SVN[2] I don't see any Z80 reference. It's currently in development in a branch: https://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/z80/ Regards, Sven ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
Re: [fpc-devel] FPC and Z80
On Tue, 14 Apr 2020, 08:29 Guillermo, wrote: > Hi Pascaloids, > > I've read in the web forums[1] that FPC may include Zylog Z80 as > target, specifically Sinclair's micro computers, but looking at the > SVN[2] I don't see any Z80 reference. > Look in this branch: https://svn.freepascal.org/cgi-bin/viewvc.cgi/branches/z80/ For the rest of the details Florian and nickysn are likely to know. ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel
[fpc-devel] FPC and Z80
Hi Pascaloids, I've read in the web forums[1] that FPC may include Zylog Z80 as target, specifically Sinclair's micro computers, but looking at the SVN[2] I don't see any Z80 reference. So, is it correct? Would FPC have support for Zylog 8bit microprocessor? Well, it supports 16bit WinAPI, doesn't it? As a MSX fan user I would be interested and even collaborate if I have time (actually I tried to write my very own Pascal compiler[3] but never go beyond planning and few testing). Thanks, Guillermo "Ñuño" Martínez ___ Links: [1] https://forum.lazarus.freepascal.org/index.php/topic,49221.0.html [2] https://svn.freepascal.org/svn/fpc/ [3] https://sf.net/p/z80-pascal/ ___ fpc-devel maillist - fpc-devel@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel