Problem to add Philips VG5000 target

Discussion about other targets
joaopa
Member
Posts: 46
Joined: Sat Mar 15, 2014 5:42 pm

Problem to add Philips VG5000 target

Post by joaopa »

Hello,
I try to add the Philips VG5000 to the list of targets of z88dk but I have some problems to compile my program.
Here is the files that I modified:
in /libsrc
vg5k.lst
stdio/vg5k/fgetc_cons
stdio/vg5k/fputc_cons
stdio/vg5k/getk
stdio/puts_cons
@z80.lst

Makefile
in all: vg5k_clibs.lib

# Philips VG5000 lib - Joaopa
vg5k_clib.lib:
@echo ''
@echo '--- Building Philips VG5000 Library ---'
@echo ''
cd strings ; $(MAKE) ; cd ..
cd stdlib ; $(MAKE) generic ; cd ..
cd stdio ; $(MAKE) generic ; cd ..
cd printflike ; $(MAKE) ; cd ..
cd setjmp ; $(MAKE) ; cd ..
cd assert ; $(MAKE) ; cd ..
cd psg ; $(MAKE) ; cd ..
$(LIBLINKER) -DFORvg5k -x$(OUTPUT_DIRECTORY)/vg5k_clib @$(LISTFILE_DIRECTORY)/vg5k.lst

stdio/vg5k
fgetc_cons.asm
;
; Philips VG5000
;
; getkey() Wait for keypress
;
; Jun 2014 - Joaopa
;
;
; $Id: fgetc_cons.asm,v 1.1 2014/04/17 06:16:05 david Exp $
;
XLIB fgetc_cons
fgetc_cons:
ret

fputc_cons.asm
;
; Philips VG5000 Routines
;
; Print character to the screen
;
; Jun. 2014 -Joaopa
;
;
; $Id: fputc_cons.asm,v 1.2 2014/05/06 06:23:37 Joaopa Exp $
;

XLIB fputc_cons
;
; Entry: char to print
;
fputc_cons:
ret

getk.asm
;
; Philips VG5000
;
; getk() Read key status
;
; Jun. 2014 - joaopa
;
;
; $Id: getk.asm,v 1.1 2014/04/17 06:16:05 joaopa Exp $
;
XLIB getk
getk:
ret


in lib
config/vg5k.cfg
#
# Target configuration file for z88dk
#

# Asm file which contains the startup code (without suffix)
CRT0 DESTDIR/lib/vg5k_crt0

# Any default options you want - these are options to zcc which are fed
# through to compiler, assembler etc as necessary
OPTIONS -v -O2 -I. -DZ80 -DVG5K -D__VG5000__ -M -clib=default

CLIB default -lvg5k_clib

SUBTYPE default -Cz+vg5k

in vg5k_crt0.opt
INCLUDE "vg5k_crt0.asm

in vg5k_crt0.asm
; CRT0 for the VG5000
;
; Joaopa Jun. 2014


MODULE vg5k_crt0

;-------
; Include zcc_opt.def to find out information about us
;-------

INCLUDE "zcc_opt.def"

;-------
; Some general scope declarations
;-------

XREF _main ;main() is always external to crt0 code

;--------
; Set an origin for the application (-zorg=) default to $5000
;--------

IF !myzorg
defc myzorg = 20480
ENDIF
org myzorg


org myzorg

call _main

So, I do make clean &&build.sh.
Everything compiles fine.

So I try my program. But the compilation fails with the logout

zcc +vg5k -lndos -z80-verb -lm echecs.c -verbose
cp /home/david/z88dk/lib/config//../..//lib/vg5k_crt0.opt /tmp/tmpXXXo4R25.opt
cp /tmp/tmpXXXo4R25.opt /tmp/tmpXXXo4R25.asm
zcpp -I. -DZ80 -DVG5K -D__VG5000__ -DSCCZ80 -DSMALL_C -I/home/david/z88dk/lib/config//../..//include echecs.c /tmp/tmpXXr4brMM.i
sccz80 -verbose -asm=z80asm /tmp/tmpXXr4brMM.i
Compiling: /tmp/tmpXXr4brMM.i
Defining function: assembleur
Defining function: attribut_piece
Defining function: affiche_echiquier
Defining function: initialisation_echiquier
Defining function: analyse
Defining function: new_game
Defining function: appelle_D
Defining function: computer_move
Defining function: main
Defining function: tester_echecs
Defining function: tester_prise
Defining function: tester_roque
Defining function: D
Symbol table usage: 327
Structures defined: 4
Members defined: 36
There were 0 errors in compilation.
copt /home/david/z88dk/lib/config//../..//lib/z80rules.2 < /tmp/tmpXXr4brMM.asm > /tmp/tmpXXr4brMM.op1
copt /home/david/z88dk/lib/config//../..//lib/z80rules.1 < /tmp/tmpXXr4brMM.op1 > /tmp/tmpXXr4brMM.opt
z80asm -eopt -v -ns -Mo -I/home/david/z88dk/lib/config//../..//lib /tmp/tmpXXr4brMM.opt
Assemble all files

Assembling '/tmp/tmpXXr4brMM.opt'...
Pass1...
Reading '/tmp/tmpXXr4brMM.opt'...
Reading 'z80_crt0.hdr'...
Pass2...
Size of module 'echecs' is 8592 bytes

z80asm -a -m -Mo -L/home/david/z88dk/lib/config//../..//lib/clibs -I/home/david/z88dk/lib/config//../..//lib -oa.bin -v -ivg5k_clib -igen_math -iz80_crt0 /tmp/tmpXXXo4R25.opt /tmp/tmpXXr4brMM.o
Assemble only updated files
Create symbol table file.sym
Assemble and link/relocate to file.bin
Link library file.lib
Create address map file.map

Assembling '/tmp/tmpXXXo4R25.asm'...
Pass1...
Reading '/tmp/tmpXXXo4R25.asm'...
Reading 'vg5k_crt0.asm'...
Reading 'zcc_opt.def'...
Pass2...
Size of module 'vg5k_crt0' is 3 bytes

linking module(s)...
Pass1...
ORG address for code is 5000
Linking library module <l_gchar>
Linking library module <l_sxt>
Linking library module <l_gint>
Linking library module <l_pint>
Linking library module <l_or>
Linking library module <l_xor>
Linking library module <l_and>
Linking library module <l_eq>
Linking library module <l_ne>
Linking library module <l_gt>
Linking library module <l_ge>
Linking library module <l_lt>
Linking library module <l_ult>
Linking library module <l_asr>
Linking library module <l_neg>
Linking library module <l_lneg>
Linking library module <l_mul>
Linking library module <l_div>
Linking library module <l_div_u>
Linking library module <strlen>
Linking library module <tmpXXlARpWi>
Linking library module <l_gintsp>
Linking library module <l_gintspsp>
Linking library module <l_pint_pop>
Linking library module <getarg>
Linking library module <memset_callee>
Linking library module <abs>
Linking library module <strcpy_callee>
Linking library module <memcpy_callee>
Code size of linked modules is 9006 bytes
Pass2...
Error at file '/tmp/tmpXXlARpWi.opt' line 64: symbol not defined
1 errors occurred during assembly
Key to filenames:
/tmp/tmpXXr4brMM.o = echecs.c
Error at file '/tmp/tmpXXlARpWi.opt' line 64: symbol not defined
Erreur de segmentation (core dumped)



When I use +zx, everything is ok :rolleyes:
zcc +zx -lndos -lm echecs.c -verbose
cp /home/david/z88dk/lib/config//../..//lib/spec_crt0.opt /tmp/tmpXXpiN68e.opt
cp /tmp/tmpXXpiN68e.opt /tmp/tmpXXpiN68e.asm
zcpp -I. -DZ80 -DSPECTRUM -D__SPECTRUM__ -DSCCZ80 -DSMALL_C -I/home/david/z88dk/lib/config//../..//include echecs.c /tmp/tmpXXsOA690.i
sccz80 -verbose -asm=z80asm /tmp/tmpXXsOA690.i
Compiling: /tmp/tmpXXsOA690.i
Defining function: assembleur
Defining function: attribut_piece
Defining function: affiche_echiquier
Defining function: initialisation_echiquier
Defining function: analyse
Defining function: new_game
Defining function: appelle_D
Defining function: computer_move
Defining function: main
Defining function: tester_echecs
Defining function: tester_prise
Defining function: tester_roque
Defining function: D
Symbol table usage: 435
Structures defined: 5
Members defined: 41
There were 0 errors in compilation.
copt /home/david/z88dk/lib/config//../..//lib/z80rules.2 < /tmp/tmpXXsOA690.asm > /tmp/tmpXXsOA690.op1
copt /home/david/z88dk/lib/config//../..//lib/z80rules.1 < /tmp/tmpXXsOA690.op1 > /tmp/tmpXXsOA690.opt
z80asm -eopt -ns -Mo -I/home/david/z88dk/lib/config//../..//lib /tmp/tmpXXsOA690.opt
z80asm -a -m -Mo -L/home/david/z88dk/lib/config//../..//lib/clibs -I/home/david/z88dk/lib/config//../..//lib -oa.bin -izx_clib -igen_math -indos -iz80_crt0 /tmp/tmpXXpiN68e.opt /tmp/tmpXXsOA690.o


Does anyone see the culprit?
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

joaopa wrote:Error at file '/tmp/tmpXXlARpWi.opt' line 64: symbol not defined
1 errors occurred during assembly
Key to filenames:
/tmp/tmpXXr4brMM.o = echecs.c
Error at file '/tmp/tmpXXlARpWi.opt' line 64: symbol not defined
Erreur de segmentation (core dumped)
What's the code around line 64 in ehecs.c?
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

If the getc/putc stuff is not empty (no matter if it isn't tested, just I'd prefer to avoid empty placeholders), I'll be glad to add a "working" skeleton for the new target. Would you like to send me a zip file with the new stuff ?
joaopa
Member
Posts: 46
Joined: Sat Mar 15, 2014 5:42 pm

Post by joaopa »

I put the requested new-stuff at the following address (I did not manage to obtain your email address Stephano). Hope you can do a working skeleton, for VG5000 platform.

https://docs.google.com/uc?export=downl ... UtoS3pQTlk
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Got it. Sorry I've been away for few days, I'll add the new target as soon as possible.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

CVS is now updated.
I put in those adjustments necessary to make the examples in the 'console' being built correctly, but it is all untested.
Joaopa, was the ORG address set to 20480 for some specific reason or it is just a guess ?
joaopa
Member
Posts: 46
Joined: Sat Mar 15, 2014 5:42 pm

Post by joaopa »

The addressees until 49ff are used by the system (rom and variables system addresses). So most of professional softwares used the address 20480 (=5000h) to store the program. It is become a usual place for everybody working for vg5000 to store the program there.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Good to know, are there sample cassette images showing how a machine code program was loaded and run? And.. Wave examples too?
joaopa
Member
Posts: 46
Joined: Sat Mar 15, 2014 5:42 pm

Post by joaopa »

The ultimate website for vg5000 is Daniel COulom website (the writer of DCVG5K, the vg5000 emulator).
The address of the website is dcvg5k.free.fr/
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Ok appmake is ready. The lib isn't ready yet, but you can try the following:

zcc +vg5k -subtype=wav -create-app world.c

Both the K7 and the WAV formats should work, the hello message shows for a very short moment.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

One more question, is there a ROM location to get a scrren scroll up ? I'm close to get a minimal working console but accessing the video memory gives odd results and only one of the documented ROM calls is working as expected, I suspect I broke some memory location.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

In the meantime I commited a working lib prototype.
It features the 1-bit sound implementation and a bit crappy console in standard and VT-ANSI emulation mode; scroll is not implemented and the text output is based on the ROM calls but it is a good starting point for you to make it evolve as you prefer.

I couldn't get the video memory access methods work in a stable way but if you understand what's wrong the existing monochrome graphics lib may follow quite easily.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

joaopa
Member
Posts: 46
Joined: Sat Mar 15, 2014 5:42 pm

Post by joaopa »

Very impressive work. I will give it a try as soon as I can compile z88dk on my 64 bits linux box.
joaopa
Member
Posts: 46
Joined: Sat Mar 15, 2014 5:42 pm

Post by joaopa »

I dowloaded the latest cvs of z88dk. I did not find the files for VG5000 inside. So when trying to compile a program, I obtain an error

zcc +vg5k -lndos -create-app othello.cpp game.cpp minimax.cpp board.cpp
Can't open config file /home/joaopa/z88dk/lib/config/vg5k.cfg
Makefile:5: recipe for target 'othello' failed
make: *** [othello] Error 1


Is it normal?
Last edited by joaopa on Sun Sep 06, 2015 7:53 am, edited 1 time in total.
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

The vg5k target is in the nightly and I've just successfully compiled othello.c for it from the examples directory. I did have to fix the crt because it contained two identical ORG statements and that fix will be present in the next nightly.

Which nightly did you download (win, macos, ..)?

I'm thinking maybe you don't have the path variables set?

http://www.z88dk.org/wiki/doku.php?id=t ... stallation
joaopa
Member
Posts: 46
Joined: Sat Mar 15, 2014 5:42 pm

Post by joaopa »

I see my mistake. I downloaded the latest cvs from Sourceforge. It is pretty old. The latest night-build is correct. I could compile a test programm with the VG5000 as target.
Thank you
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

joaopa wrote:I see my mistake. I downloaded the latest cvs from Sourceforge. It is pretty old. The latest night-build is correct. I could compile a test programm with the VG5000 as target.
Thank you
Ok good. Yes the sourceforge link is very old and a lot has changed since. We're hopefully going to do a beta release soon -- we're just trying to fill in some documentation first.
joaopa
Member
Posts: 46
Joined: Sat Mar 15, 2014 5:42 pm

Post by joaopa »

Good news. Many distributions of linux use official releases only. For example, ubuntu use a very old version of z8dk. Ubuntu will use surely this new version for the next Ubuntu.
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

On some distribution I noticed that it is also consequence of the increasing z88dk complexity.
The package mantainers are a bit in trouble in keeping their work updated.. and to have our prompt answer when a user submits a bug (sorry guys, believe me your work is highly appreciated, though !!)
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

If the nightly process won't hang, you should have a working console driver for the VG5000 by tomorrow :)
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Lo-rez monochrome graphics added too
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

VT 100 emulation fixed.. sorry for the slow scroll implementation everywhere, it is cumbersome and slow but saves some memory and development time. Now it is up to the VG5000 specialists to squeeze out more from the machine ;)
joaopa
Member
Posts: 46
Joined: Sat Mar 15, 2014 5:42 pm

Post by joaopa »

How do you define lo-rez graphics?
alvin
Well known member
Posts: 1872
Joined: Mon Jul 16, 2007 7:39 pm

Post by alvin »

joaopa wrote:How do you define lo-rez graphics?
A better answer would probably come from stef but what usually happens is the target is able to plot hi-resolution pixels but then it's also able to create graphics in another lower resolution way, for example by printing characters with block patterns or by lowering the pixel resolution in order to obtain a higher colour resolution. So the name lo-rez has meaning dependent on the target.

On the zx target, eg, there is a normal resolution mode that is 256x192 in pixels and 32x24 in colour so that pixel and colour resolution do not match. The lo-rez implementation is 64x24 pixels (I think!) but each pixel can be any colour.

I don't know what stef did for the vg5000.
Post Reply