Jupiter Ace - strange result

Discussion about other targets
Post Reply
Steve(spt)
New member
Posts: 7
Joined: Wed Nov 05, 2008 8:12 pm

Jupiter Ace - strange result

Post by Steve(spt) »

Code: Select all

/ Jupiter Ace example of using C and asm Z80
// with z88dk.
// save this file in the bin folder of z88dk
// compile in DOS with
// zcc +aceansi -o first.bin first.c
// a file called first.bin will be created
// to load the file in 81 use the import memory block
// at address 16384. then in forth '16384 CALL' 
//
// This file first.c

#include <stdio.h>

// Function prototypes:
static void main(void); 
static void yourname(void); 
static void isace(void);

void main()
{
        #asm
        // clear Ace screen
         call 2596 //call JA Forth code for CLS
        #endasm

// Calls our functions:
yourname();
isace();

return;
}

// functions
void yourname()
{
        printf("Your Name ");
}

void isace()
{
        printf("is ace!\n");
}

//
// end
The expected output is corrupted, because the Ace screen position for next location to be printed to is not up dated.

Expected output should be:

Your Name is ace! OK

but we get

OK Name is ace!

Can someone test this to see if they get the same result?
Last edited by Steve(spt) on Sun Jan 29, 2012 4:37 pm, edited 1 time in total.
Steve(spt)
New member
Posts: 7
Joined: Wed Nov 05, 2008 8:12 pm

Post by Steve(spt) »

a work around is below, by adding the line

SET 4,(IX+62) // turn off OK message

Code: Select all

#asm
        // clear Ace screen
         call 2596 //call JA Forth code for CLS
         SET 4,(IX+62) // turn off OK message 
        #endasm
stefano
Well known member
Posts: 2151
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

good to know !
Do you think this flag should be always set on startup ?
Steve(spt)
New member
Posts: 7
Joined: Wed Nov 05, 2008 8:12 pm

Post by Steve(spt) »

no, there is no need.

In Jupiter Ace FORTH you use the command INVIS to turn off the OK message and VIS to turn back on.

But there is no way to use the FORTH words INVIS within Z88dk, unless you use the flag trick.

What happens when you call the FORTH word CLS form the code address in the ROM it resets the print to screen position to 0,0
So when you use a printf("text message") and the code is compiled the message is printed to screen then you are returned to the FORTH system it will output the OK message at screen position 0,0
corrupting your message.

It was just a strange result and I wanted to know what was happening!
stefano
Well known member
Posts: 2151
Joined: Mon Jul 16, 2007 7:39 pm

Post by stefano »

I see.
Note that there are two versions of the stdio libraries; in most of the platforms you get a better integration with the "legacy operating system" when you use the non-ansi lib which, for the ACE, has been updated the last time the 31st may 2010.
"ace_clib.lib" includes already the ROM cls call to 2596 in case you print ascii code 12 (decimal).
The aceansi version probably acts as you described.
Post Reply