sharp pc-g850v
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
sharp pc-g850v
hi friend.
How do I reproduce this code on the Z88 ?
i have sharp g850vs
void main() {
gcursor(10, 8);
gprint("F8280800F828F800F800F88080");
}
i need some graphics but i have error.
thaks.
How do I reproduce this code on the Z88 ?
i have sharp g850vs
void main() {
gcursor(10, 8);
gprint("F8280800F828F800F800F88080");
}
i need some graphics but i have error.
thaks.
Re: sharp pc-g850v
This is our way to do something similar with z88dk:
It is different than GPRINT but it is portable 
EDIT - the editor
https://github.com/z88dk/z88dk-ext/tree ... hics/tools
Code: Select all
#include <graphics.h>
#include <games.h>
unsigned char picture[] = {8,13, 0xF8,0x28,0x08,0x00,0xF8,0x28,0xF8,0x00,0xF8,0x00,0xF8,0x80,0x80};
void main() {
clg();
putsprite(spr_or,10,1, picture);
}

EDIT - the editor
https://github.com/z88dk/z88dk-ext/tree ... hics/tools
You do not have the required permissions to view the files attached to this post.
Re: sharp pc-g850v
Quick and dirty GPRINT implementation in C (slow)
Code: Select all
#include <graphics.h>
#include <games.h>
#include <string.h>
void gprint(char *gfx) {
int x,y,i;
int xx,yy;
xx=getx();
yy=gety();
for (x=0; x<strlen(gfx); x+=2) {
i = (gfx[x] % 32 + 9) % 25 * 16 + (gfx[x+1] % 32 + 9) % 25;
for (y=0; y<8; y++) {
if (i&1)
plot(xx,yy+y);
else
unplot(xx,yy+y);
i/=2;
}
xx++;
}
setpos(xx,yy);
}
void main() {
clg();
setpos(10,8);
gprint ("F8280800F828F800F800F88080");
// gprint ("7C7C7D7D1117393D3917117D7D7C7C");
}
Re: sharp pc-g850v
You are welcome.
putsprite() allows pictures of any size, but it doesn't clean the square area of the picture, it places it "transparently" over any existing picture.
The "spr_and" option uses the pattern in your picture to clean the pixels, you can, in example, print it shifted to create a white border and then print it again with "spr_or".
This new gprint() should be identical to the one you expected. In z88dk we used smaller fonts, so using GPRINT to add your custom characters will need a bit of alignment.
putsprite() allows pictures of any size, but it doesn't clean the square area of the picture, it places it "transparently" over any existing picture.
The "spr_and" option uses the pattern in your picture to clean the pixels, you can, in example, print it shifted to create a white border and then print it again with "spr_or".
This new gprint() should be identical to the one you expected. In z88dk we used smaller fonts, so using GPRINT to add your custom characters will need a bit of alignment.
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
thanks and need only 2 more question draw a line and draw a square.
this is my working code:
this is a line i draw in g850V
CC=65535;
line(jugadorPosx[objetivo] * 16 - 16, jugadorPosy[objetivo] + 10, jugadorPosx[objetivo] * 16 - 16 + defensor->hp, jugadorPosy[objetivo] + 10, 0, CC, 2);
and this is square:
line(4,2,57,28,0,CC,1)
and this is explain in manual:
line:
Format: int line (int x, int y, int x2, int y2, int reverse, unsigned short mask, int rectangle);
Description: Draws a line or a rectangle.
x,y :coordinates of first point (corner)
x2,y2 :coordinates of second point (opposite corner)
reverse
: 0-Set point
: 1-Delete point
: 2-Invert point
mask : Line style (See the description of the Basic command):
rectangle
: 0-draws a line
: 1-draws a rectangle
: 2-draws a filled rectangle
i try DRAW(15,10,21,10);
but i get error.
can you halpme?
thank.
this is my working code:
this is a line i draw in g850V
CC=65535;
line(jugadorPosx[objetivo] * 16 - 16, jugadorPosy[objetivo] + 10, jugadorPosx[objetivo] * 16 - 16 + defensor->hp, jugadorPosy[objetivo] + 10, 0, CC, 2);
and this is square:
line(4,2,57,28,0,CC,1)
and this is explain in manual:
line:
Format: int line (int x, int y, int x2, int y2, int reverse, unsigned short mask, int rectangle);
Description: Draws a line or a rectangle.
x,y :coordinates of first point (corner)
x2,y2 :coordinates of second point (opposite corner)
reverse
: 0-Set point
: 1-Delete point
: 2-Invert point
mask : Line style (See the description of the Basic command):
rectangle
: 0-draws a line
: 1-draws a rectangle
: 2-draws a filled rectangle
i try DRAW(15,10,21,10);
but i get error.
can you halpme?
thank.
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
ok draw work for line and drawb for square.
now how i draw square whit some patterns like some point black?
now how i draw square whit some patterns like some point black?
Re: sharp pc-g850v
https://github.com/z88dk/z88dk/wiki/Cla ... e-Graphics
e.g.
line(4,2,57,28,0,CC,1) -> drawb(4, 2, 53, 26);
Patterns on z88dk are an average progamming level, xorborder() could help in doing some magic.
If you work with fixed size squares, you can use the monochrome sprites together with clga().
Otherwise you can use "stencils". You need to reserve two vectors and draw your shapes in memory. The final picture can be "rendered" with a pattern. See this example (the picture positioning is not correct on the g800, but it gives you a rough idea):
https://github.com/z88dk/z88dk/blob/mas ... s/carpet.c
You can edit it to get a small enough picture on a G800:
int do_carpet( void )
{
int n = 3, x = 20, y = 0, l = 50;
carpet( n, x, y, l );
return !0;
}
The vector size can be reduced:
unsigned char stencil[MAXXY * 2];
A box is carved in the area you are preparing by "drawing" the right and left sides only.
'n' defines the dithering pattern, IIRC between 0 and 7
void box (x,y,x1,y1,n)
{
stencil_init(stencil);
stencil_add_side(x,y,x,y1,stencil);
stencil_add_side(x1,y,x1,y1,stencil);
stencil_render(stencil, n);
}
You can change it with other shapes, e.g. a single "stencil_add_circle" would carve a circular area.
The area is NOT precise, it is delimited only by the right/left coordinates, but it is a good compromise to limit the memory usage and keep the code fast enough. You can draw complex pictures drawing many smaller regions.
EDIT: they are not the best graphics APIs ever, but we are doing our best to support them on a good number of targets.
EDIT2: the dither levels are 11
e.g.
line(4,2,57,28,0,CC,1) -> drawb(4, 2, 53, 26);
Patterns on z88dk are an average progamming level, xorborder() could help in doing some magic.
If you work with fixed size squares, you can use the monochrome sprites together with clga().
Otherwise you can use "stencils". You need to reserve two vectors and draw your shapes in memory. The final picture can be "rendered" with a pattern. See this example (the picture positioning is not correct on the g800, but it gives you a rough idea):
https://github.com/z88dk/z88dk/blob/mas ... s/carpet.c
You can edit it to get a small enough picture on a G800:
int do_carpet( void )
{
int n = 3, x = 20, y = 0, l = 50;
carpet( n, x, y, l );
return !0;
}
The vector size can be reduced:
unsigned char stencil[MAXXY * 2];
A box is carved in the area you are preparing by "drawing" the right and left sides only.
'n' defines the dithering pattern, IIRC between 0 and 7
void box (x,y,x1,y1,n)
{
stencil_init(stencil);
stencil_add_side(x,y,x,y1,stencil);
stencil_add_side(x1,y,x1,y1,stencil);
stencil_render(stencil, n);
}
You can change it with other shapes, e.g. a single "stencil_add_circle" would carve a circular area.
The area is NOT precise, it is delimited only by the right/left coordinates, but it is a good compromise to limit the memory usage and keep the code fast enough. You can draw complex pictures drawing many smaller regions.
EDIT: they are not the best graphics APIs ever, but we are doing our best to support them on a good number of targets.
EDIT2: the dither levels are 11
Code: Select all
#include <graphics.h>
unsigned char stencil[192 * 2];
int i;
main()
{
clg();
for (i = 0; i < 12; i++) {
// now a filled diamond via stencil
stencil_init(stencil);
stencil_add_side(10 + i * 7, 30, 30 + i * 7, 0, stencil);
stencil_add_side(30 + i * 7, 0, 50 + i * 7, 20, stencil);
stencil_add_side(50 + i * 7, 20, 30 + i * 7, 40, stencil);
stencil_add_side(10 + i * 7, 20, 30 + i * 7, 40, stencil);
stencil_render(stencil, i);
}
// Sort of 3d ball
for (i = 4; i > 0; i--) {
stencil_init(stencil);
stencil_add_circle(30 - i, 22 + i, i * 3 + 5, 1, stencil);
stencil_render(stencil, 14 - (i * 2));
}
}
You do not have the required permissions to view the files attached to this post.
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
thanks i try later but i have now a strange behavior.
#include <graphics.h>
#include <games.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <stdlib.h>
int main() {
clrscr();
clg();
drawb(1, 1, 20, 20);
return 0;
}
I'm testing with the square and I have strange behavior.
The first time I run it it comes out fine at 1.1 but the following times it moves down if I hit ENTER several times before running it the square is created either up or down, I have to run it several times for it to go at 1.1.
It must be something on the scroll but I can't figure out what it is.
for example this with gotoxy u printf does not always happen, it always sets it to 0.5 every time I run it
gotoxy(0,5);printf("PRESS ANY KEY...");
What could be causing the graphics to run in different positions every time I run the program?
Do I still have to control the scroll or something?
i compile whit this :
zcc +g800 -create-app -clib=g850b -bn cuadrado.ihx cuadrado.c
#include <graphics.h>
#include <games.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <stdlib.h>
int main() {
clrscr();
clg();
drawb(1, 1, 20, 20);
return 0;
}
I'm testing with the square and I have strange behavior.
The first time I run it it comes out fine at 1.1 but the following times it moves down if I hit ENTER several times before running it the square is created either up or down, I have to run it several times for it to go at 1.1.
It must be something on the scroll but I can't figure out what it is.
for example this with gotoxy u printf does not always happen, it always sets it to 0.5 every time I run it
gotoxy(0,5);printf("PRESS ANY KEY...");
What could be causing the graphics to run in different positions every time I run the program?
Do I still have to control the scroll or something?
i compile whit this :
zcc +g800 -create-app -clib=g850b -bn cuadrado.ihx cuadrado.c
Re: sharp pc-g850v
I can't get the same effect. Are you making it happen on the emulator or on the real Sharp ?
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
i use real sharp
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
ok i download emulator and have same error i put a video.
https://www.dropbox.com/scl/fi/kvaua70g ... 3qpff&dl=0
the first run is correct.
then i press enter and run again and you see the error.
https://www.dropbox.com/scl/fi/kvaua70g ... 3qpff&dl=0
the first run is correct.
then i press enter and run again and you see the error.
Re: sharp pc-g850v
I see. Strangely my code is not doing the same. Is it on a recent z88dk version? I'm using the latest 'nightly' build.
Why are you comparing getk() to LF ?
Please try scanning another key (eg SPACE)
Honestly I don't understand what's going on, Try also removing plot ()
EDIT Try also building for another Sharp model, e.g. zcc +g800 -create-app gfx2.c
Why are you comparing getk() to LF ?
Please try scanning another key (eg SPACE)
Honestly I don't understand what's going on, Try also removing plot ()
EDIT Try also building for another Sharp model, e.g. zcc +g800 -create-app gfx2.c
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
the while is for this code i found:
clg();
plot(0,24);
for (x = 0; x < 1; x++) {
y = (int)(24 * (1.0 - sin(x / 144.0 * 3.14 * 8)));
drawto(x, y);
}
while (getk() != 10) {};
i download last version and i try again.
ok.
I downloaded the latest version and it's still the same, maybe I'm doing something wrong, I unzip the file and then I go into the binx86 folder and execute the command from CMD.
Also try running it in the bin folder, I have tried the 2 ihx and they work the same.
I don't know if I have to do something or install something else.
clg();
plot(0,24);
for (x = 0; x < 1; x++) {
y = (int)(24 * (1.0 - sin(x / 144.0 * 3.14 * 8)));
drawto(x, y);
}
while (getk() != 10) {};
i download last version and i try again.
ok.
I downloaded the latest version and it's still the same, maybe I'm doing something wrong, I unzip the file and then I go into the binx86 folder and execute the command from CMD.
Also try running it in the bin folder, I have tried the 2 ihx and they work the same.
I don't know if I have to do something or install something else.
Re: sharp pc-g850v
Well if you get the binary code built and you are using the updated libraries, you have everything set up correctly.
Please paste the exact code and the build command you are using, I should get your same result
Please paste the exact code and the build command you are using, I should get your same result
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
Ok, I restarted the PC and the square always comes out fine.
But now the messages move from top to bottom, this is crazy.
I put the video for you.
https://www.dropbox.com/scl/fi/5scnb0rw ... t3oef&dl=0
But now the messages move from top to bottom, this is crazy.
I put the video for you.
https://www.dropbox.com/scl/fi/5scnb0rw ... t3oef&dl=0
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
the code:
#include <graphics.h>
#include <games.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
clrscr();
clg();
plot(0,0);
;gotoxy(10,0);printf("inicio.");
drawb(1, 1, 20, 20);
sleep(5);
clrscr();gotoxy(0,0);printf("Juego terminado.");
return 0;
}
the cmd:
zcc +g800 -create-app -clib=g850b -bn aleatorio.ihx aleatorio.c
#include <graphics.h>
#include <games.h>
#include <string.h>
#include <stdio.h>
#include <conio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
clrscr();
clg();
plot(0,0);
;gotoxy(10,0);printf("inicio.");
drawb(1, 1, 20, 20);
sleep(5);
clrscr();gotoxy(0,0);printf("Juego terminado.");
return 0;
}
the cmd:
zcc +g800 -create-app -clib=g850b -bn aleatorio.ihx aleatorio.c
Re: sharp pc-g850v
I confirm it works fine here, I'm now suspecting it could be a different G800/850 ROM.
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
ok. where you download emulator?
i try use your emulator of g850v.
i try use your emulator of g850v.
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
stefano look i need this square to make walls
download/file.php?id=201
is the number 11.
This is the pattern I have on the sharp with line.
how i create?
thanks.
download/file.php?id=201
is the number 11.
This is the pattern I have on the sharp with line.
how i create?
thanks.
Re: sharp pc-g850v
I think the pattern is number 1 (0=blank, 11=black).
You need to allocate the vector, do stencil_init() on it, draw your elements and then stencil_render() using 1 as dither depth
https://ver0.sakura.ne.jp/pc/index.html#g800
You need to allocate the vector, do stencil_init() on it, draw your elements and then stencil_render() using 1 as dither depth
https://ver0.sakura.ne.jp/pc/index.html#g800
Re: sharp pc-g850v
I'm still wondering what could be happening with your version of z88dk.
the way you launch the program is just G 100, right?
the way you launch the program is just G 100, right?
-
- Member
- Posts: 15
- Joined: Tue May 21, 2024 10:43 am
Re: sharp pc-g850v
Hello again, sorry for the delay. if I just run g100. but I have a problem that cannot be solved: the ihx occupies 52k and does not let me load it in the sharp, which is 32k, so what I did was transfer everything to BASIC and that way I can enter it in the SHARP. When I finish the game I will try again to program a shorter one with Z88Dk. I haven't finished it yet but a preview is up today.
https://x.com/ph03n1x71/status/1799026535107871205?s=46
And
https://x.com/ph03n1x71/status/1799029872851050786?s=46
https://x.com/ph03n1x71/status/1799026535107871205?s=46
And
https://x.com/ph03n1x71/status/1799029872851050786?s=46