not relocating TS2068 BASIC

ZX80, ZX 81, ZX Spectrum, TS2068 and other clones
Post Reply
swensont
Member
Posts: 14
Joined: Wed Oct 23, 2013 3:26 am

not relocating TS2068 BASIC

Post by swensont »

I have a fairly recent copy of z88dk (fresh install). I've got it working for the zx81. I'm trying the T/S 2068 and I'm getting an error. Here is the command line for compiling:
zcc +ts2068 -subtype=nohrg -create-app -o hello hello.c
This is the message I get:
Info: Position 32768 is too low, not relocating TS2068 BASIC.
If I take out the "-subtype=nohrg" then the compile works fine (but does show text in HRG font). I'd like to get things working with the regular T/S 2068 mode / font.

I've tried to compile a simple "Hello, World" program and another short C program, but I get the message on both.

I'm not sure if I am doing something wrong or if z88dk is. Hoping someone has a clue.

Tim
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: not relocating TS2068 BASIC

Post by dom »

That is a bit odd, I think with nohrg then there's no need to do the relocation magic so the invocation of appmake is incorrect.

I've corrected/changed the .cfg file so you shouldn't run into that error again.
swensont
Member
Posts: 14
Joined: Wed Oct 23, 2013 3:26 am

Re: not relocating TS2068 BASIC

Post by swensont »

What was the change that was made and to what cfg file? I'd like to make the change on my local system.

Tim
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: not relocating TS2068 BASIC

Post by dom »

swensont
Member
Posts: 14
Joined: Wed Oct 23, 2013 3:26 am

Re: not relocating TS2068 BASIC

Post by swensont »

After being distracted by another programming project, I got back to this one.. I added the change. The compiler with -subtype=nohrg is no longer generating an error. The problem is that nohrg is really hrg. The screen output with nohrg is the same as leaving that option out.
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: not relocating TS2068 BASIC

Post by dom »

You have to explicitly change the screenmode - using ts_vmod or console_ioctl()

I’m not sure why we need to have that option - hires display works even with nohrg (at least in my limited tests) - it may be needed to support calling some rom routines.

@stefano can you shed any light on adding that option 20 or so years ago :)
stefano
Well known member
Posts: 2137
Joined: Mon Jul 16, 2007 7:39 pm

Re: not relocating TS2068 BASIC

Post by stefano »

I think that initially ts_vmod() was just a tiny initial stub for a ts2068 specific library.
Originally the ts2068 graphics were intended to run and stay in hr, monochrome only.
My thought was that the classic zx graphics was already available in Spectrum mode or in a specific library.
[EDIT] ... obviously I'm not criticizing the current library evolution, it is a reasonable upgrade, especially now that the Spectrum Next is a reality
swensont
Member
Posts: 14
Joined: Wed Oct 23, 2013 3:26 am

Re: not relocating TS2068 BASIC

Post by swensont »

Now that there is an active ts2068 group in the US, I'm getting back to this issue. I've tried the various options for ts_vmod() with -subtype=nohrg. What I've tried is:
VMOD_SPEC
VMOD_HCLR
VMOD_HIRES

HCLR and HIRES don't give a normal video mode. With SPEC, the listing is in normal 32 column mode, but the program text is in hires mode (even when using nohrg option). I'm still looking for a way to get normal 32-column mode.

Thanks
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: not relocating TS2068 BASIC

Post by dom »

I've lost track of what the issue is etc, however...

There are two things that affect the number of columns shown on screen:

1. The screenmode (set via console_ioctl, ts_vmod, -pragma-define:CLIB_DEFAULT_SCREEN_MODE)
2. The 64/32 column toggle (set via CLIB_ZX_CONIO=0/1 or an escape sequence)

CLIB_DEFAULT_SCREEN_MODE has only been recently added, but you can obviously set it in the other ways.

32 columns in ZX screen mode @16384: zcc +ts2068 world.c -create-app -pragma-define:CLIB_ZX_CONIO32=1 -pragma-define:CLIB_DEFAULT_SCREEN_MODE=0

64 columns in ZX screen mode @16384: zcc +ts2068 world.c -create-app -pragma-define:CLIB_ZX_CONIO32=0 -pragma-define:CLIB_DEFAULT_SCREEN_MODE=0

32 columns in ZX screen mode @24576: zcc +ts2068 world.c -create-app -pragma-define:CLIB_ZX_CONIO32=1 -pragma-define:CLIB_DEFAULT_SCREEN_MODE=1

64 columns in ZX screen mode @24576: zcc +ts2068 world.c -create-app -pragma-define:CLIB_ZX_CONIO32=0 -pragma-define:CLIB_DEFAULT_SCREEN_MODE=1

32 columns in hi colour screen mode: zcc +ts2068 world.c -create-app -pragma-define:CLIB_ZX_CONIO32=1 -pragma-define:CLIB_DEFAULT_SCREEN_MODE=2

64 columns in hi colour screen mode: zcc +ts2068 world.c -create-app -pragma-define:CLIB_ZX_CONIO32=0 -pragma-define:CLIB_DEFAULT_SCREEN_MODE=2

Using hires mode doubles the horizontal pixels, so:

64 columns in high res screen mode: zcc +ts2068 world.c -create-app -pragma-define:CLIB_ZX_CONIO32=1 -pragma-define:CLIB_DEFAULT_SCREEN_MODE=6

128 columns in hires screen mode: zcc +ts2068 world.c -create-app -pragma-define:CLIB_ZX_CONIO32=0 -pragma-define:CLIB_DEFAULT_SCREEN_MODE=6

With -subtype=nohrg, only CLIB_DEFAULT_SCREEN_MODE=0 will work, unless the stack is moved.
swensont
Member
Posts: 14
Joined: Wed Oct 23, 2013 3:26 am

Re: not relocating TS2068 BASIC

Post by swensont »

Thanks for that information. I'll give a few of those a try and see what I get.

Tim
swensont
Member
Posts: 14
Joined: Wed Oct 23, 2013 3:26 am

Re: not relocating TS2068 BASIC

Post by swensont »

I'm still not able to get out of HRG mode. I made sure to grab the latest release (version 2.1). The hello.c is:

#include <stdio.h>
#include <ts2068.h>

main() {
ts_vmod(VMOD_SPEC);
zx_cls();
printf("Hello, World \n");
}

I've tried compiling with the following command lines:

zcc +ts2068 -subtype=nohrg -create-app -o hello hello.c
zcc +ts2068 -subtype=nohrg -create-app -o hello hello.c -pragma-define:CLOB_ZX_CONIO32=1 -pragma-define:CLIB_DEFAULT_SCREEN_MODE=0
zcc +ts2068 -create-app -o hello hello.c -pragma-define:CLOB_ZX_CONIO32=1 -pragma-define:CLIB_DEFAULT_SCREEN_MODE=0
zcc +ts2068 -subtype=nohrg -create-app -o hello hello.c -pragma-define:CLIB_DEFAULT_SCREEN_MODE=0

When I run the .tap file in ZEsarUX, the "hello, world" is shown in hires mode. Am I doing something wrong?

Tim
User avatar
dom
Well known member
Posts: 2076
Joined: Sun Jul 15, 2007 10:01 pm

Re: not relocating TS2068 BASIC

Post by dom »

I've gone back in time to 2.1 and tried things out there. Since I can't remember when the command line pragmas were added, I've just explicitly invoked ts_vmod etc

Code: Select all

#include <stdio.h>
#include <ts2068.h>


main()
{
        ts_vmod(VMOD_SPEC);

        printf("%cHello world!\n",12);
        fgetc_cons();
}
Compiling with: zcc +ts2068 world.c -subtype=nohrg -create-app

yields this screen:
Screenshot 2021-11-16 at 20.31.49.png
Which as expected is 256 pixels wide, printing in 64 column mode.

Using screen mode VMOD_HIRES and moving the stack yields this screen (512 pixels wide, 128 columns):
Screenshot 2021-11-16 at 20.32.10.png
So, the screenmode switching is working as expected.

The TS2068 wiki page here: https://github.com/z88dk/z88dk/wiki/Pla ... mex-TS2068 suggests looking at the ZX Spectrum page since most things are shared. I think the relevant section is here: https://github.com/z88dk/z88dk/wiki/Pla ... ole-driver. So lets try this program switching to 8 pixel wide characters (so 32 column mode for a non-hires screen:

Code: Select all

#include <stdio.h>
#include <ts2068.h>


main()
{
        ts_vmod(VMOD_SPEC);

        printf("%c%c Hello world!\n",12,1);
        fgetc_cons();
}
And see what we get:
Screenshot 2021-11-16 at 20.37.25.png
You do not have the required permissions to view the files attached to this post.
Post Reply