[z88dk-dev] It is a macro missing or.. what ?

Bridge to the z88dk-developers mailing list
Post Reply
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

[z88dk-dev] It is a macro missing or.. what ?

Post by stefano »

Quick patch, just to trying to compile it:

Code: Select all

#ifndef getkey
//#include <conio.h>
#define getkey() getchar()
#endif
Then..

zcc +zx -vn -SO3 -startup=31 -clib=sdcc_ix --reserve-regs-iy --max-allocs-per-node200000 adv_a.c -o adv_a -create-app

Errors in source file adv_a.c:
Error at file 'C:/Users/us01580/AppData/Local/Temp\sa8c_.opt' line 1742: syntax error
^ ---- ld de,hl
Error at file 'C:/Users/us01580/AppData/Local/Temp\sa8c_.opt' line 1782: syntax error
^ ---- ld bc,hl
Error at file 'C:/Users/us01580/AppData/Local/Temp\sa8c_.opt' line 1813: syntax error
^ ---- ld bc,hl



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Errors in source file adv_a.c:
Error at file 'C:/Users/us01580/AppData/Local/Temp\sa8c_.opt' line 1742: syntax error
^ ---- ld de,hl
Error at file 'C:/Users/us01580/AppData/Local/Temp\sa8c_.opt' line 1782: syntax error
^ ---- ld bc,hl
Error at file 'C:/Users/us01580/AppData/Local/Temp\sa8c_.opt' line 1813: syntax error
^ ---- ld bc,hl
It looks like there's some bad rules in sdcc_peeph.3 - hopefully Alvin can locate and fix them.



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

Yes it’s peephole z88dk-325, it needs to be qualified with canAssign.


I’ll fix it later this afternoon but in the meantime you can compile at -SO2 setting. The code won’t be quite as good ????
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

It was a quick fix, try updating and compile again.


-startup=4 will put it in 64 column mode, -startup=5 will do 64 columns and understand control codes


I had to change “getch?? for “getchar??


You might also want to try a classic compile using sdcc. I think dom’s got that far enough along now.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

There were two errors in the SO3 peephole rules and the second one took a couple of hours to locate tonight. If you update now and recompile, it will work fine. I also made a change that allows the font used by stdio to be selected on the compile line.

If you compile with this:

zcc +zx -vn -SO3 -startup=9 -clib=sdcc_ix --reserve-regs-iy --max-allocs-per-node200000 adv_a.c -o adv_a -create-app -pragma-redirect:CRT_FONT=_ff_ao_Prefect --fsigned-char

You'll get a the Prefect proportional font used in an fzx terminal. There are around 100 fonts to choose from in z88dk/_DEVELOPMENT/font/fzx/fonts. The terminal is quite sophisticated and you can, eg, set line spacing to 1.5 to improve the look with an appropriate ioctl().

"--fsigned-char" may be required especially with old C code. Often unqualified char is expected by programmers to be signed but sdcc has changed the default to unsigned in order to improve typical output code.

A lot of the programs in the classic examples, including this one, supply their own line editing functions. That's not required in the new c lib as the terminal driver does line buffering and editing for all i/o. So that stuff can be eliminated to reduce the program size further.



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Now it works perfectly, thank you !
At the moment my favourite among the improvements by alvin are the proportional font support (is there a way to extend the line buffer ?) and the zx7 compressed data.. expecially now that it is automatic.
Very very nice !

IMHO the command line is still a bit tricky, but now that we have it all in a single line it is much easier to experiment :)



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

is there a way to extend the line buffer ?
Yes the line buffer size is specified in the crt when stdin is instantiated.

For startup=9, the crt used is z88dk/libsrc/_DEVELOPMENT/target/zx/startup/zx_crt_9.asm which is generated from zx_crt_9.m4 in the same directory. The driver instantiation area of that m4 file is this:

Code: Select all

dnl############################################################
dnl## INSTANTIATE DRIVERS #####################################
dnl############################################################

ifndef CRT_FONT

PUBLIC CRT_FONT
EXTERN _ff_ind_Termino
defc CRT_FONT = _ff_ind_Termino

endif

include(../../clib_instantiate_begin.m4)

include(../driver/terminal/zx_01_input_kbd_inkey.m4)dnl
m4_zx_01_input_kbd_inkey(_stdin, __i_fcntl_fdstruct_1, 0x03b0, 64, 1, 500, 15)dnl

include(../driver/terminal/zx_01_output_fzx_tty_z88dk.m4)dnl
m4_zx_01_output_fzx_tty_z88dk(_stdout, 0x2370, 0, 0, 0, 32, 0, 24, 0, CRT_FONT, 56, 0, 56, 0, 256, 0, 192, 1, 0, 3, 0)dnl

include(../../m4_file_dup.m4)dnl
m4_file_dup(_stderr, 0x80, __i_fcntl_fdstruct_1)dnl

include(../../clib_instantiate_end.m4)
The drivers are listed in fd order, starting with fd=0 so stdin is the first one:

include(../driver/terminal/zx_01_input_kbd_inkey.m4)dnl
m4_zx_01_input_kbd_inkey(_stdin, __i_fcntl_fdstruct_1, 0x03b0, 64, 1, 500, 15)dnl

That "64" is the line buffer size and is a 16-bit quantity. The "1,500,15" are the key debounce, key start repeat and key repeat rates. The flags "0x03b0" sets echo mode, password mode, line/char mode, crlf conversion, etc.

The only quantity that is changeable at compile time is CRT_FONT atm but maybe buffer size is important enough to assign to a compile time quantity too. There are quite a few parameters in the instantiations so I don't know if it makes sense to assign compile time quantities to all of them as it may be preferable just to have the user create a specialized crt if he needs fine control over everything.



------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
Post Reply