Anonymous (Unregistered) 2002/10/01 19:50
|
C compiler
|
| |
Z88DK now supports some basic i/o for the Sprinter. It's still experimental but a port of Adventure A have been produced.
The Z88DK main site is at http://z88dk.sourceforge.net/ and the Sprinter files should be in the CVS when you read this.
|
Shaos (enthusiast)
2002/10/02 10:38
|
|
When Sprinter support will be at the release Z88DK?
Alexander Shabarshin (shaos@mail.ru)
http://www.shaos.ru
|
dom (stranger
)
2002/10/02 14:16
|
|
It will be in the next full release (whenever that is!), in the mean time
I've prepared a snapshot which can be downloaded from
http://sugarcube.suborbital.org.uk/~dom/z88dk/ since messing around
with CVS isn't everyone's idea of fun.
|
flydream (newbie)
2002/10/02 15:52
|
|
Is it possible to programming using high resolution graphics?
|
liftarn (stranger
)
2002/10/02 17:26
|
|
As far as I know it's currently limited to text only, but I guess graphics will not be far away. You could ofcourse get the source code and code your own functions for high resolution graphics.
|
liftarn (stranger
)
2002/10/04 16:05 Attachment
|
|
I tried both messing around in the CVS and looking in your dump file, but I didn't find the Sprinter files anywhere.
Btw, I attach Adventure A for those who want to try it out.
|
dom (stranger
)
2002/10/04 16:58
|
|
Sprinter specific stuff is in:
z88dk/lib/pps_crt0.asm (startup)
z88dk/libsrc/stdio/sprinter
z88dk/libsrc/fcntl/sprinter
Build the kit (instructions in README.1st) and then compile the program with zcc +pps [file.c]
|
liftarn (stranger
)
2002/10/04 17:42
|
|
Ah, I was looking for z88dk/libsrc/sprinter
|
Shaos (enthusiast)
2002/10/09 15:12
|
|
What kind of functions I may use for Sprinter programs?
printf? fopen? fprintf?
Tell me about memory using in Z88DK, what about code larger 64K. What about big data?
Alexander Shabarshin (shaos@mail.ru)
http://www.shaos.ru
|
dom (stranger
)
2002/10/09 16:13
|
|
I'm going to reference some functions by header files to shorten this message:
assert.h, ctype.h, stdio.h, string.h
Floating point routines, exit, atexit, malloc, free etc
Console stdio is supported. I've implemented file routines, but not fully tested them - I understand that there's a problem with directories on the real hardware - but through SPRINT reading files certainly works.
Graphics isn't supported at all - I've not had time to read through the available source code and docs to implement it.
z88dk supports the concept of far pointers, so in theory far data can be read, however far data support is built upon machine specific libraries which hasn't been implemented for the Sprinter.
Far code is problematic and is something that hasn't been implemented yet, it would certainly be possible to write a wrapper function that takes a far pointer and then calls the function. However, the destination function would have to be in a separately compiled program and you might as well incorporate dll (libman) support into the port. Unfortunately, the assembler used doesn't support the concept of overlays/segments which would make implementing native far code somewhat tricky.
Thoughts have been appearing about replacing the assembler with something like asz80 but at present they're just thoughts and nothing has been done.
|
Shaos (enthusiast)
2002/10/10 14:17
|
|
I had tried compile text adventure adv_a.c
I was need to write zcc +pps adv_a.c -lndos
(I dont know what is lndos, but for zx it was the same name)
else a few errors were printed: unknown FCLOSE, OPEN labels and so on...
So, ADV_A.EXE works :)
But, I have question
How by Z88DK I can use text attributes and cursor location?
Alexander Shabarshin (shaos@mail.ru)
http://www.shaos.ru
|
dom (stranger
)
2002/10/11 00:53
|
|
Looks like that's the first incarnation of the libraries - the ndos libraries contains generic dummy file libraries for those systems with no file i/o or with multiple ones.
I'm working on a port of the ANSI engine over to the Sprinter - this is effectively a vt100 terminal which allows colours and position to happen. Positioning works, but many of the other attributes (colour, dim, inverse, underline etc) are not working too well. I can't seem to find any documentation on the site to specify how to define the attribute parameter to WRCHAR. I'm guessing that it is possible to change the background colour?
|
Shaos (enthusiast)
2002/10/11 12:05
|
|
ADV_A.EXE works only in emulator :(
It's not working at real Sprinter. I can test why it not.
So, you may send me e-mail and we can talk about colors, now I'm adding BIOS text/color features and soon I will public new SPRINT version with new BIOS functions support.
Alexander Shabarshin (shaos@mail.ru)
http://www.shaos.ru
|
Denis Parinov (Sprinter Team)
2002/10/12 02:34
|
|
> I can't seem to find any documentation on the site to specify how to define the attribute parameter to WRCHAR. I'm guessing that it is possible to change the background colour?
The DSS functions (57h) RDCHAR and (58h) WRCHAR used to low-level operations with a Sprinter's text screen. It's not best way for the regular text output. It's a slow method. If you need to print some color text at the part of text screen (window), then I recommend to use DSS function (5Ah) WINREST, which will be output chars and attributes from the buffer. If you need to print color text in terminal mode then I recommend to use BIOS functions for color printing. (81h, 82h, 83h, 85h, 86h, 87h, 88h, 8Bh, 8Ch)
Color attribute:
bit7 - blink
bit6,5,4 - background (0...7) RGB
bit3,2,1,0 - foreground (0..15) IRGB
0 Black
1 Blue
2 Green
3 Cyan
4 Red
5 Magenta
6 Brown
7 White
8 Gray
9 Bright blue
10 Bright green
11 Bright cyan
12 Bright red
13 Bright magenta
14 Yellow
15 Bright white
|
Denis Parinov (Sprinter Team)
2002/10/12 02:41
|
|
> ADV_A.EXE works only in emulator :(
> It's not working at real Sprinter. I can test why it not.
I think that a reason is a lost registers, because DSS do not save it.
|
dom (stranger
)
2002/10/16 15:20
|
|
Thanks for the colour info, I'll add support for the BIOS calls when I can test them on the emulator.
I didn't think I made any assumptions about the state of registers after DSS calls (other than the return values) - cerrtainly fgetc_cons and fputc_cons (which will be the only ones used by adv_a) don't.
|
Denis Parinov (Sprinter Team)
2002/10/17 01:36
|
|
It just my assumption about problem. DSS don't save any registers which used in the function code.
;this don't working on the Sprinter, but working in emulator.
LD IX,something
LD HL,something
LD B,something
LOOP LD A,(HL)
INC HL
LD C,DSS_FUNCTION
RST #10
DJNZ LOOP
LD A,(IX)
;this will work both on the Sprinter and in the emulator.
LD IX,something
PUSH IX
LD HL,something
LD B,something
LOOP LD A,(HL)
INC HL
PUSH HL
PUSH BC
LD C,DSS_FUNCTION
RST #10
POP BC
POP HL
DJNZ LOOP
POP IX
LD A,(IX)
|
liftarn (stranger
)
2002/10/18 13:27
|
|
In reply to:
How by Z88DK I can use text attributes and cursor location?
Roumous say (Ok, it was on the z88dk mailing list) that ANSI now is supported.
|
Shaos (enthusiast)
2002/10/22 07:52
|
|
When we will be able to use Z88DK for file input/output and color text printing in Sprinter? :)
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
liftarn (stranger
)
2002/10/29 17:15
|
|
In reply to:
When we will be able to use Z88DK for file input/output and color text printing in Sprinter?
Colours (using ANSI) is now supported. Fie i/o is in beta.
|
Shaos (enthusiast)
2002/10/30 07:59
|
|
> Colours (using ANSI) is now supported.
If I remember right ANSI-C does not support color text and cursor locating. It's implementations under different OS's. Please, write simple example.
> Fie i/o is in beta.
May I test it?
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
liftarn (stranger
)
2002/10/30 12:41
|
|
In reply to:
If I remember right ANSI-C does not support color text andcursor locating. It's implementations under different OS's.
Sorry, I was talking about ANSI graphics, not ANSI C. ANSI graphics is the type you commonly find in terminal programs.
In reply to:
Please, write simple example.
/*
* Test the ANSI terminal
*
* 15/4/2000 Stefano Bodrato
*
* Compile with zcc +zxansi ansitest.c
*/
#include "stdio.h"
main()
{
int x;
/*
A stupid CSI escape code test
(normally no use uses CSI)
*/
printf ("If you can read this, CSI is not working.\n");
printf ("%c2J",155);
printf ("If this the first thing you can read, CSI is OK.\n");
/*
Set Graphic Rendition test
*/
printf ("%c[1mBold Text\n",27);
printf ("%c[2mDim text\n",27);
printf ("%c[4mUnderlined Text\n",27);
printf ("%c[24mUn-underlined text\n",27);
printf ("%c[7mReverse Text\n",27);
printf ("%c[27mUn-reverse text\n",27);
for (x=37; x>29; x--)
{
printf ("%c[%umFore text color %u.\n",27,x,x);
}
for (x=40; x<48; x++)
{
printf ("%c[%umBack text color %u.\n",27,x,x);
}
/*
Restore default text attributes
*/
printf ("%c[m",27);
/*
Cursor Position test
"Draw" an X
*/
for (x=0; x<11; x++)
{
printf ("%c[%u;%uH*\n",27,10+x,25+x);
printf ("%c[%u;%uH*\n",27,20-x,25+x);
}
}
In reply to:
May I test it?
It's available at http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/z88dk/z88dk/libsrc/fcntl/sprinter/
|
Shaos (enthusiast)
2002/10/30 13:06
|
|
> Sorry, I was talking about ANSI graphics, not ANSI C.
> ANSI graphics is the type you commonly find in terminal programs.
Ok I see
> * Compile with zcc +zxansi ansitest.c
For Sprinter I need to write zcc +ppsansi ansitest.c ???
> It's available at http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/z88dk/z88dk/libsrc/fcntl/sprinter/
It's some strange to download files by one through CVS... When we will see full release (or solid beta)?
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
dom (stranger
)
2002/10/30 16:14
|
|
> For Sprinter I need to write zcc +ppsansi ansitest.c ???
Yup, that's correct.
>It's some strange to download files by one through CVS... When we will see > full release (or solid beta)?
I really want to push out a full release very soon. It looks very bad having a 16 month release as the only downloadable version. Easiest way is to download a snapshot from http://sugarcube.suborbital.org.uk/~dom/z88dk (consider these unofficial betas)
Or if you've got cvs installed then you get the entire source out with the following two commands:
cvs -d:pserver:anonymous@cvs.z88dk.sourceforge.net:/cvsroot/z88dk login
cvs -z3 -d:pserver:anonymous@cvs.z88dk.sourceforge.net:/cvsroot/z88dk co z88dk
and then update it with:
cvs -z3 update -d .
from within the checkout directory
|
Shaos (enthusiast)
2002/10/31 08:02
|
|
> download a snapshot from http://sugarcube.suborbital.org.uk/~dom/z88dk (consider these unofficial betas)
It's better for me. Thank you :)
And tell me what I need to write for use file-operations?
zcc +???? example.c
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
liftarn (stranger
)
2002/10/31 17:14
|
|
As far as I know it would work with either
zcc +pp example.c
or
zcc +ppansi example.c
depending if you want ANSI or not. Then you should
#include <stdio.h>
and it should work.
|
Shaos (enthusiast)
2002/11/06 13:48
|
|
+pp or +pps ???
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
liftarn (stranger
)
2002/11/07 14:56
|
|
Sorry, ofcourse it should be either +pps or +ppsansi depending if you want ANSI or not.
|
Marcelo (stranger
)
2002/11/08 03:08
|
|
Is there any Z88DK Windoze-ready pack anywhere with Sprinter support that one can just download and start coding instead of having to compile/upgrade/massage it? Can anyone tell its URL?
My excuses if I did not understand something in this thread, but it seems to me that there is one pack and then one has to update it with some other things in order to have Sprinter support. Is this so?
Thanks in advance,
Marcelo.
----------------------------------
Speccy rules, its staff is Sprinter.
|
Shaos (enthusiast)
2002/11/10 09:03
|
|
At present I have built it only under Linux. For windows I compile binaries, but I don't know how use .lnx and build libraries... May it near future windows version will come???
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
Shaos (enthusiast)
2002/11/10 09:08
|
|
> it should be either +pps or +ppsansi depending if you want ANSI or not.
Hmmm... It isn't working...
Errors CLOSE and FOPEN printed by compile procedure
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
liftarn (stranger
)
2002/11/11 17:39
|
|
In reply to:
Is there any Z88DK Windoze-ready pack anywhere with Sprinter support that one can just download and start coding instead of having to compile/upgrade/massage it?
Not as such. Have you tried http://sugarcube.suborbital.org.uk/~dom/z88dk/ and http://www.algonet.se/~dennisgr/z88dk.htm Together they should be able to use under Windows.
|
liftarn (stranger
)
2002/11/11 17:41
|
|
Can you post the source here so we can have a look at it.
I haven't tried doing any Sprinter stuff myself so perhaps dom can answer your questions better.
|
Shaos (enthusiast)
2002/11/12 12:24
|
|
I download latest version 20021105
+pps is not working
+ppsansi works!!!
ADV_A.EXE and ANSITEST.EXE are in attached archive
MY1.EXE is this program:
#include <stdio.h>
int main()
{
int k;
FILE *f;
char str[256];
printf("Hello, World!\n");
f = fopen("my1.c","r");
if(f==NULL) return 0;
k = fread(str,256,1,f);
printf("%d read\n",k);
str[255] = 0;
fclose(f);
printf("%s",str);
k = getk();
printf("Key %d\n",k);
return 1;
}
it's print:
Hello, World!
0 read
...
Key 166
Why 0 and 166???
When you will add command line arguments?
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
Shaos (enthusiast)
2002/11/12 12:26 Attachment
|
|
EXAMPLES.ZIP with ADV_A.EXE, ANSITEST.EXE and MY1.EXE binaries for Sprinter
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
dom (stranger
)
2002/11/14 15:39
|
|
>Why 0 and 166???
I'll look into this, could be a simple case of me mis-reading the docs and thinking the return from the Estex read() is the number of read bytes and not the number of unread bytes (or vice versa)
As for 166 - what key did you press? getk() just returns whatever is in the keyboard buffer at the time of the SCANKEY call
>When you will add command line arguments?
Point me in the direction of the docs and I'll try to add it in this weekend
BTW. Are compiled programs now running correctly on a real sprinter?
|
dom (stranger
)
2002/11/14 15:52
|
|
> Why 0 and 166???
Hmmm, I've just tried this in the emulator, the read returns 1 (which is correct) and getk() returns 0.
I'm guessing that this due to the emulation of Estex using native system calls and there might be a slight disparity between what they return and what the real hardware returns.
As for the +pps problem - rather stupidly the makefile forgets to build it. This returns the same results as above.
|
Denis Parinov (Sprinter Team)
2002/11/15 06:41
|
|
>> When you will add command line arguments?
> Point me in the direction of the docs and I'll try to add it in this weekend
Unfortunately, It's not covered by english documentation.
I'll try to quick translate this chapter. And if you will need more information about any DSS features, feel free to ask us here or by email.
Start applications:
The programs stored on the disk in binary executable files.
One of main task for operating system, it's start the programs.
The command line for program has following format:
[device:][\path\]name [parameters]
The device and path specified location on the disk. If they are missed. Then program searching in current directory.
EXE files contain, special prefix and program code.
EXE-file prefix:
+00 2 dw 5845h ; EXE signature
+02 1 db 45h ; Reserved (exe type)
+03 1 db 00h ; Version of EXE-format
+04 4 dd 00000200h ; Begin of program code (bytes offset)
+08 2 dw 0000h ; Size of primary loader or 0
+10 4 dd 00000000h ; Reserved
+14 2 dw 0000h ; Reserved
+16 2 dw ???? ; Load address
+18 2 dw ???? ; Start addres (register PC)
+20 2 dw ???? ; Stack addess (register SP)
+22 490 ds 0 ; Reserved
+512 ; Code of program
40h (64) EXEC (Execute EXE-file)
input:
HL - file specification
B = 0 - load and execute program
C - 40h
output:
A - exit code, if CF=0
error, if CF=1
The following steps used for start a program:
1) Opens exe-file for read;
2) Reads exe-prefix to working buffer;
3) Allocates memory required for loading this file or primary loader,
if size of primary loader != 0;
4) Save STACK
5) Pages allocated memory;
6) Builds Program start prefix and point IX to it;
7) Reading file to the address that specified in field 16 (Load address);
8) Closes exe-file, if it not a primary loader;
9) Sets STACK at value specified in field 20 (Stack address);
10) Jump to program code that specified in field 18 (Start address);
Program start prefix:
-03 1 db ? ; File handle, if exe-file has primary loader
-02 1 db ? ; Memory handle for this exe-file
-01 1 db ? ; Level of current program
+00 1 db ? ; Length of command line parameters
+01 127 ds ? ; Parameters of command line with null-terminated
Example:
LD HL,NAME ;HL point to ASCIIZ string with filename
LD C,40h ;Exec fn.
LD B,00h ;Subfn. load and execute
RST 10h ;Call DSS
RET C ;Return if Error
LD (ENDCODE),A ;Save exit code
NAME DB "\PROG\UTILITY\prog.exe",0
ENDCODE DB 00h
|
Shaos (enthusiast)
2002/11/15 10:35
|
|
> As for 166 - what key did you press?
Nothing
>Point me in the direction of the docs and I'll try to add it in this weekend
It's simple. After start EXE-program you may read prefix by IX and analize arguments inside command line (see old EXEPREFX example).
>BTW. Are compiled programs now running correctly on a real sprinter?
Yes :)
What about very useful function fseek???
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
dom (stranger
)
2002/11/15 15:42
|
|
>>BTW. Are compiled programs now running correctly on a real sprinter?
> Yes :)
Fantastic, must've been that dodgy out I had at one point.
> What about very useful function fseek???
Hmmm, good point. Checks. Ah, not included in the lib and a broken lseek() Fixed, new snapshot available up on sugarcube.
|
dom (stranger
)
2002/11/15 16:09
|
|
Thanks for this info - very helpful! The scheme used is virtually identical to the CP/M command line arguments so the same code worked. This has been placed in the z88dk_20021115_2.tar.gz on sugarcube.
enjoy!
|
Shaos (enthusiast)
2002/11/28 10:51
|
|
fseek is not supported yet
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
dom (stranger
)
2002/11/28 20:13
|
|
> fseek is not supported yet
Should be! - You'll need to rebuild the libs though. In what way isn't it supported?
Other new functions in the 20021121 beta were:
mktime
clock
time
rmdir
mkdir
getwd
getcwd
|
Shaos (enthusiast)
2002/11/29 14:38
|
|
>> fseek is not supported yet
> Should be! - You'll need to rebuild the libs though. In what way isn't it supported?
I did
make
make install
make libs
make install-libs
and tried compile example with fseek with +pps and +ppsansi options - error was wrote about FSEEK not found
> Other new functions in the 20021121 beta were:
very good!
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|
dom (stranger
)
2002/12/01 19:07
|
|
>I did
>make
>make install
>make libs
>make install-libs
Cool, there was a problem with the way things were installing which I've just spotted - if you look in /usr/local/lib there's a clibs directory. This has got copied to the wrong place - it needs to be in /usr/local/lib/z88dk/lib/. The new version up fixes this problem and also allows non-root installs to work correctly.
|
Shaos (enthusiast)
2002/12/09 16:57
|
|
>>make install-libs
>
>Cool, there was a problem with the way things were
>installing which I've just spotted
Now, make makes /home/dom/z88dk... catalog :(
Alexander Shabarshin (shaos@mail.ru)
NedoPC Project
|