VZ200 target

Discussion about other targets
Post Reply
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

VZ200 target

Post by WauloK »

Hi

I'm trying to get zcc to compile with a 0crt.asm file Jeurgen Buchmueller wrote years ago (with a couple of function entries I wrote as well in it).

The top of the file begins:

Code: Select all

;        Run time start off for Small C.
        .module        _crt
        .globl        main
;        This will be at the start location in the final image
.start:
        ld        sp,#.stack; pick up core top
;
;        call main with argc = 1 and argv = [ "main", 0 ]
;
        ld        hl,#1
        push        hl
        ld        hl,#.argv
        push        hl
        ld        a,#2
        call        main                ; call main program
        pop        bc
        pop        bc
        jp        0x1a19                ; return to BASIC

;*****************************************************
;
;        Video Technology library for small C compiler
;
;                Juergen Buchmueller
;
;*****************************************************
There's a lot more code, of course, but if I use zcc with the switch to change the 0crt.asm file I get:
Error at file '0crt.asm' line 15: symbol 'main' not defined
Error at file '0crt.asm' line 85: symbol 'seed' not defined
Error at file '0crt.asm' line 86: symbol 'seed' not defined
Error at file '0crt.asm' line 97: symbol 'seed' not defined
Error at file '0crt.asm' line 98: symbol 'seed' not defined
Error at file '0crt.asm' line 126: symbol 'seed' not defined
Error at file '0crt.asm' line 199: symbol 'scatx' not defined
Error at file '0crt.asm' line 293: symbol 'seed' not defined
Error at file '0crt.asm' line 420: symbol 'numbuf' not defined
Error at file '0crt.asm' line 428: symbol 'radix' not defined
Error at file '0crt.asm' line 442: symbol 'sign' not defined
Error at file '0crt.asm' line 503: symbol 'sign' not defined
Error at file '0crt.asm' line 512: symbol 'zero' not defined
Error at file '0crt.asm' line 565: symbol 'numbuf' not defined
Error at file '0crt.asm' line 566: symbol 'numbuf' not defined
Error at file '0crt.asm' line 574: symbol 'sign' not defined
Error at file '0crt.asm' line 581: symbol 'radix' not defined
Error at file '0crt.asm' line 658: symbol 'counter' not defined
Error at file '0crt.asm' line 676: symbol 'counter' not defined
Error at file '0crt.asm' line 678: symbol 'counter' not defined
Error at file '0crt.asm' line 766: symbol 'countr' not defined
Error at file '0crt.asm' line 790: symbol 'countr' not defined
Error at file '0crt.asm' line 792: symbol 'countr' not defined
Error at file '0crt.asm' line 909: symbol 'scrbase' not defined
Error at file '0crt.asm' line 940: symbol 'scrbase' not defined
Error at file '0crt.asm' line 1069: symbol 'scrbase' not defined
Errors in source file 0crt.asm:
Error at file 'C:/Users/waulo/AppData/Local/Temp/zcc0C912.asm' line 1: syntax error
Error at file '0crt.asm' line 2: syntax error
^ ---- .module _crt
Error at file '0crt.asm' line 3: syntax error
^ ---- .globl main
Error at file '0crt.asm' line 5: syntax error
^ ---- .start:
Error at file '0crt.asm' line 6: syntax error
^ ---- ld sp,#.stack; pick up core top
.. etc ..

My commandline is:

zcc +vz -o arkaball -crt0 0crt.asm Arkaball.c

Where Arkaball.c is a game I wrote in 2000 and compiled with zcc back in the day.

I found someone had created new libraries in about 2006 but when I try to use them I get:
Error: library file 'D:/Dev/VZ/z88dk/lib/clibs/vz_clib.lib' version 1, expected version 12
I cannot re-create these lib files. Is it possible to do something to ignore this error?
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

It looks like 0crt.asm is in asz80 format rather than z80asm which is why you're getting a whole bunch of syntax errors.

The crt0 supplied by z88dk is functionally equivalent if you compile with zcc +vz -subtype=bin so I think to proceed I would:

- Remove the CRT stub that you've got listed there
- Convert the remaining file to z80asm syntax

Conversion to z80asm syntax involves:

- .globl -> GLOBAL
- Remove the # before numbers
- Remove the "." before labels (both in declaration and usage)
- Replace the "::" after global labels with ":"
- Rename the asxxx local labels with proper names (z80asm doesn't automatically generate labels like asz80)
- Correct the ix relative syntax from NN (ix) to (ix+NN)

However, I suspect that you may not need the 0crt.asm file at all - Alvin imported the common vz functions from the yahoo group back in 2007 so they're available already in z88dk and the builds by default, so it might be worth just doing the following:

Code: Select all

zcc +vz  Arkaball.c
And seeing if anything is missing
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

Ah ok. A friend discovered we need to change the naming conventions to be the same as z88dk:
'plot' to 'vz_plot' 'setbase' to 'vz_setbase' 'line' to 'vz_line' 'poke' to 'bpoke' etc.

The last error I have to work on is:
Error at file 'vz/vz_shape.asm' line 41: symbol 'scrbase' not defined
Errors in source file D:\Dev\VZ\z88dk\lib\config\..\..\\lib\target\vz\classic\vz_crt0.asm:
Error at file 'vz/vz_shape.asm' line 41: symbol 'scrbase' not defined
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

Hmm maybe just had to add:
#include <conio.h>
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

That?s good news! I think scrbase was renamed but we missed that reference.

I?ll push a fix tomorrow but I think the option -pragma-redirect:scrbase=base_graphics might work as a temporary patch.
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

Hi!

That seems to let me compile nicely. For some reason the code doesn't work as it did back then and crashes the emulator now after the titlescreen so something else going on, but at least I can compile now. Thanks!
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

I'm trying another application Flappy Bird and get this error:
sccz80:"main.c" L:60 Warning:Implicit definition of function 'trigger_titlescreen' it will return an int. Prototype it explicitly if this is not what you want. [-Wimplicit-function-definition]
sccz80:"main.c" L:273 Error:Definition of 'trigger_titlescreen': void trigger_titlescreen() - does not match declaration at "main.c":60 : int trigger_titlescreen()
The function is defined void:

Code: Select all

void __FASTCALL__ trigger_titlescreen(void)
{
        switch_mode(0);
        printf("FLAPPY BIRD\n\n");
        printf("By gameblabla\n\n");
        printf("HIGHSCORE : %d\n\n", highscore);
        printf("PRESS S KEY TO START\n\n");
        printf("INGAME, PRESS F TO FLY\n");
}
Adding -Wimplicit-function-definition to zcc.exe commandline does not help.
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

Line #60:

Code: Select all

trigger_titlescreen();
bushy555
Member
Posts: 13
Joined: Tue Jul 16, 2013 9:31 am

Post by bushy555 »

...we worked out that this specific warning issue was just a function being reference before main(). Move main() and away we go.
Compiled with no warnings; ran for a few seconds in an emulator fine, but then crashed. Needs a bit more work on it.
bushy555
Member
Posts: 13
Joined: Tue Jul 16, 2013 9:31 am

Post by bushy555 »

Hi Dom,
Following on from WauloK's above issue :
[ 'Error at file 'vz/vz_shape.asm' line 41: symbol 'scrbase' not defined' ]
I have just tested the next nightly build with the standard command line params on the above shown ARKY.C file. Happy to advise that this is fixed - it compiles without error, and without needing the -pragma option --- using either of the further below shown compilation command-lines.
Still having execution issues - but it may or may not be a separate issue. Still requires further followup.


However, following on from this SETBASE missed reference that may have been a left over bug from years ago, there does seem to be a very similiar issue with another one of the early migrated VZ functions; "vz_soundcopy".

Error at file 'target/vz/vz_soundcopy_callee.asm' line 44: symbol '_std_seed' not defined
Errors in source file C:\progra~1\Z88DK\lib\config\\..\..\\lib\target\vz\classic\vz_crt0.asm:

=====================
; ----- void __CALLEE__ vz_soundcopy_callee(char *dst, char *src, int size, int sound1, int sound2);

SECTION code_clib
PUBLIC vz_soundcopy_callee
PUBLIC _vz_soundcopy_callee
PUBLIC ASMDISP_VZ_SOUNDCOPY_CALLEE
EXTERN _std_seed
*snip*
ld e,c
ld d,b
ld hl,(_std_seed)
=====================

...am speculating here, but is it an issue to the external reference for the random seed for white noise within soundcopy?
Apologies; I can't get my head around it / wish I could understand it.


Currently am receiving this error upon compiling anything with VZ_Soundcopy (). (using the current build)
I use either of these two compilation scripts:
zcc +vz -create-app -O3 -vn %1.c -o %1.vz
zcc +vz -create-app -lm %1.c -o %1.vz


thanks for any pointers.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

I've updated that one to use the renamed variable name.

I think this means that we don't have an example that uses the vz libraries, or we'd have picked them up beforehand. If you could donate a program that does use the routines then we can use it as a sanity check and avoid this happening again in a few years time!

I've just tried out flappy bird from GitHub and after a bit of a juggle around with header files it compiles, gets past the title page and seems to work, I guess I might be using a different source to you though.
bushy555
Member
Posts: 13
Joined: Tue Jul 16, 2013 9:31 am

Post by bushy555 »

Hi Dom,
Thanks heaps for your reply; you are so quick; and here I am ten days later only just reading your reply. Apologies for the lateness! I'm letting the team down!

Here is Jerguen's original source for Defence Command from the 2000 era, which used the originally VZ library that was then the initial start point (I believe) for the VZ's library within Z88dk.
https://pastebin.com/wNLE2PPd

Here is Defence with the current updates for Z88. Has both VZ_Setbase() and VZ_Soundcopy() for testing.
VZ_Setbase() appeared to be working ~ten days ago when I last tried it. Have not yet tried VZ_Soundcopy() with the current nightly build, but this is a good starting and testing point.

https://pastebin.com/rHr2mYuT


Here is a start of a game that I attempted way back in 2002. Please don't laugh (No, I'm serious, it is that bad)
It could also be used for testing of VZ_SHAPE() and VZ_SETBASE().

Waulok may have something else for testing purposes.
Cheers heaps.
bushy555
Member
Posts: 13
Joined: Tue Jul 16, 2013 9:31 am

Post by bushy555 »

* Forgot to paste the last link.
Galactic Raiders. https://pastebin.com/nRxLB365
bushy555
Member
Posts: 13
Joined: Tue Jul 16, 2013 9:31 am

Post by bushy555 »

Waulok has advised that his Arkyball game source is shareable. https://pastebin.com/1ZmB5HPY
I've only quickly just added the VZ's Z88 library naming convention to the source. I may have missed something somewhere. It may be buggy --- I can't guarantee anything here unfortunately, however, it did once upon a time compile nicely with the old ZCC compiler and original library.
There may also be double-ups in functions; I think I picked something weird up ten days ago when I was playing with it.
Cheers.
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

By the way, does the fzx font library only work on Spectrum or can others use it? I can see it says everywhere it was 'primarly' created for Spectrum but no info on use other than that.

I was also hoping someone had made a generic tilemap library for z88dk but it looks like I may have to write my own.
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

I just tested some soundfx. Most seem to be really good except this doesn't work:

Code: Select all

#include <stdio.h>
#include <games.h>
#include <vz.h>

int main(void)
{
        bit_play("2A--A-B-CDEFGAB5C+");
        sleep(2);
}
Error:
Error at file 'crt0_fp/fa.asm' line 12: symbol 'init_floatpack' not defined
Errors in source file D:\Dev\VZ\z88dk\lib\config\..\..\\lib\target\vz\classic\vz_crt0.asm:
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

Adding -lm to your compile zcc command should solve
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Post by dom »

Thanks for the examples donation - I'll pull it in over the week or so.

As far as I know, FZX is still only for the Spectrum - I've not seen any implementations for other targets.

For character based games, using conio (and --generic-console) seems to be quite successful - on the VZ it only supports the default character set but on other targets you get redefinable fonts and UDGs.
WauloK
Member
Posts: 63
Joined: Thu Oct 10, 2019 10:45 am

Post by WauloK »

Thanks guys
Post Reply