Who can assemble for me this C file ?
Moderators: simonsunnyboy, Mug UK, Zorro 2, Moderator Team
Who can assemble for me this C file ?
Well,
I need help for assembling the next C file...
It must be executed in medium resolution.
I'm looking for both files if possible (exec creating MORDOR.CNX & MORDOR.CNX itself ).
Who can done the job for me ?
Thanks
I need help for assembling the next C file...
It must be executed in medium resolution.
I'm looking for both files if possible (exec creating MORDOR.CNX & MORDOR.CNX itself ).
Who can done the job for me ?
Thanks
Last edited by Maartau on Wed Oct 18, 2006 12:11 pm, edited 4 times in total.
Edit ; corrected & clean present now
++
++
Code: Select all
#include <osbind>
#include <math>
#define pie 3.14159
int contrl[12],
intin[128],
ptsin[128],
intout[128],
ptsout[128];
int handle,
phys_handle;
int gl_hhbox,gl_hwbox,gl_hhchar,gl_hwchar;
int work_out[57],
work_in[12];
int erreur,
dummy;
int color_buffer[20000];
int colors[15]={0x000,0x001,0x002,0x003,0x004,0x005,0x006,0x007,0x006,0x005,0x004,0x003,0x002,0x001,0x000};
open_work()
{
int i;
handle=phys_handle;
for(i=0;i<10;work_in[i++]=1);
work_in[10]=2;
v_opnvwk(work_in,&handle,work_out);
}
close_work()
{
v_clsvwk(handle);
appl_exit();
}
main()
{
int a,b,ct=0,x[5],y[5],tab[4],interm[400],
y_min,y_max,cx[5],cy[5],lang;
long lenght;
float angle;
appl_init();
phys_handle=graf_handle(&gl_hwchar,&gl_hhchar,
&gl_hwbox,&gl_hhbox);
open_work();
v_clrwk(handle);
graf_mouse(0,01);
vsl_color(handle,1);
for (angle=0;angle<2*pie0.0628318; angle=angle+0.0628318)
{
for(a=0;a<400;a++) interm[a]=0;
x[0]=cos(angle)*90+320;
y[0]=sin(angle)*64+66;
x[1]=cos(anglepie/16)*90+320;
y[1]=sin(anglepie/16)*64+66;
x[2]=cos(anglepie/8)*90+320;
y[2]=sin(anglepie/8)*64+66;
x[3]=cos(angle(3*pie/16))*90+320;
y[3]=sin(angle(3*pie/16))*64+66;
x[4]=cos(anglepie/4)*90+320;
y[4]=sin(anglepie/4)*64+66;
if (y[0]<y>y[2]) y_min=y[2];
if (y_min>y[3]) y_min=y[3];
if (y_min>y[4]) y_min=y[4];
if (y[0]>y[1]) y_max=y[0];
else y_max=y[1];
if (y_max<y[2]) y_max=y[2];
if (y_max<y[3]) y_max=y[3];
if (y_max<y[4]) y_max=y[4];
lang=y_maxy_min+15;
v_hide_c(handle);
tab[0]=tab[2]=(x[0]+x[1]+x[2]+x[3]+x[4])/4;
tab[1]=y_min;
tab[3]=y_max+15;
v_pline(handle,2,tab);
v_show_c(handle,0);
b=0;
do
{
for(a=0;a<5>=x[0] && x[a]>=x[1] && x[a]>x[2]
&& x[a]>=x[3] && x[a]>=x[4] && !=5)
{
cx[4b]=x[a]; cy[4b]=y[a]; x[a]=0; b++;
};
};
} while (b!=5);
a=cy[4]y_min; for (b=a;b<a+15;b++) interm[b]=colors[ba];
a=cy[3]y_min; for (b=a;b<a+15;b++) interm[b]=colors[ba];
a=cy[2]y_min; for (b=a;b<a+15;b++) interm[b]=colors[ba];
a=cy[1]y_min; for (b=a;b<a+15;b++) interm[b]=colors[ba];
a=cy[0]y_min; for (b=a;b<a+15;b++) interm[b]=colors[ba];
color_buffer[ct++]=y_min;
color_buffer[ct++]=lang*2;
for(a=0;a<lang;a++)
{
color_buffer[ct++]=interm[a];
};
};
printf("Press a key to save\n");
gemdos(0x7);
erreur=gemdos(0x3c,"MORDOR.CNX",0);
lenght=ct*2;
gemdos(0x40,erreur,lenght,color_buffer);
gemdos(0x3e,erreur);
v_hide_c(handle);
v_clrwk();
graf_mouse(0,01);
v_show_c(handle,1);
close_work();
}
Last edited by Maartau on Wed Oct 18, 2006 12:09 pm, edited 6 times in total.
Yep, thanks. I found OSbind.h & math.h
I used Lattice C & found bugs in the code. (While the original code was like this one).
I can't made the source running
I used Lattice C & found bugs in the code. (While the original code was like this one).
I can't made the source running
Last edited by Maartau on Mon Oct 16, 2006 6:26 pm, edited 1 time in total.
Maybe you should close the comments on line 24 ( /* Color_buffer contient les donn‚es qui seront sauv‚es */ ) and on line 26 ( /* Colors contient le d‚grad‚ bleu formant les 5 rouleaux */Maartau wrote:Always multierrors in line 58 (See bold line)
). Otherwise the compiler thinks everything is a comment until the for statement on line 58.
Hans Wessels
Ahem, by the way : it's a source code I've typed manually from a french ST Magazine. I can post an excerpt scan.
I don't know at all how to code in C, that's why I really don't understand what's wrong or translating into GFA (as it's said in the mag ). I'm not also a GFA expert
The main reason why I choose this code is due to an assembly source included in the article & this source need this file.
1) I can post scans for those who wants to see further :
this code permits to do 5 blue rasters tubes to move around an axe (effect like a revolver gun I should say...)
2) I can (and would like ) to type the included assembly source
3) As I'm trying to redo some codes, there's explains & clean code so I hope not to be the only one interested
See you...
I don't know at all how to code in C, that's why I really don't understand what's wrong or translating into GFA (as it's said in the mag ). I'm not also a GFA expert
The main reason why I choose this code is due to an assembly source included in the article & this source need this file.
1) I can post scans for those who wants to see further :
this code permits to do 5 blue rasters tubes to move around an axe (effect like a revolver gun I should say...)
2) I can (and would like ) to type the included assembly source
3) As I'm trying to redo some codes, there's explains & clean code so I hope not to be the only one interested
See you...
I cleaned up the code with indent and fixed the obvious errors. Included the right include files so the code compiles with Pure C. IMHO this is a horrible pice of C code. Anyhow there is still one typo left. I don't know what it should be. Here is the cleaned up code:Maartau wrote:Normally, this is EXACTLY the same code now
Now, multi errors with caracters like { } (concerning the beginning of the lines).
Code: Select all
/* #include <osbind> */
#include <aes>
#include <tos>
#include <vdi>
#include <math>
#include <stdio>
#define pie 3.14159
int contrl[12], intin[128], ptsin[128], intout[128], ptsout[128];
int handle, phys_handle;
int gl_hhbox, gl_hwbox, gl_hhchar, gl_hwchar;
int work_out[57], work_in[12];
int erreur, dummy;
int color_buffer[20000];
int colors[15] =
{0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000};
void open_work(void)
{
int i;
handle = phys_handle;
for (i = 0; i < 10; work_in[i++] = 1)
{
;
}
work_in[10] = 2;
v_opnvwk (work_in, &handle, work_out);
}
void close_work (void)
{
v_clsvwk (handle);
appl_exit ();
}
int main (void)
{
int a, b, ct = 0, x[5], y[5], tab[4], interm[400], y_min, y_max, cx[5],
cy[5], lang;
long lenght;
float angle;
appl_init ();
phys_handle = graf_handle (&gl_hwchar, &gl_hhchar,
&gl_hwbox, &gl_hhbox);
open_work ();
v_clrwk (handle);
graf_mouse (0, NULL);
vsl_color (handle, 1);
for (angle = 0; angle < 2 * pie  0.0628318; angle = angle + 0.0628318)
{
for (a = 0; a < 400; a++)
{
interm[a] = 0;
}
x[0] = cos (angle) * 90 + 320;
y[0] = sin (angle) * 64 + 66;
x[1] = cos (angle  pie / 16) * 90 + 320;
y[1] = sin (angle  pie / 16) * 64 + 66;
x[2] = cos (angle  pie / 8) * 90 + 320;
y[2] = sin (angle  pie / 8) * 64 + 66;
x[3] = cos (angle  (3 * pie / 16)) * 90 + 320;
y[3] = sin (angle  (3 * pie / 16)) * 64 + 66;
x[4] = cos (angle  pie / 4) * 90 + 320;
y[4] = sin (angle  pie / 4) * 64 + 66;
if (y[0] <y> y[2])
{
y_min = y[2];
}
if (y_min > y[3])
{
y_min = y[3];
}
if (y_min > y[4])
{
y_min = y[4];
}
if (y[0] > y[1])
{
y_max = y[0];
}
else
{
y_max = y[1];
}
if (y_max < y[2])
{
y_max = y[2];
}
if (y_max < y[3])
{
y_max = y[3];
}
if (y_max < y[4])
{
y_max = y[4];
}
lang = y_max  y_min + 15;
v_hide_c (handle);
tab[0] = tab[2] = (x[0] + x[1] + x[2] + x[3] + x[4]) / 4;
tab[1] = y_min;
tab[3] = y_max + 15;
v_pline (handle, 2, tab);
v_show_c (handle, 0);
b = 0;
do
{
for (a = 0; a <5>= x[0])
&& (x[a] >= x[1])
&& (x[a] >= x[2])
&& (x[a] >= x[3])
&& (x[a] >= x[4])
&& !=5)
/* ^^^^^^^^^^ Error over here. What variable shouldn't be equal to 5? */
{
cx[4  b] = x[a];
cy[4  b] = y[a];
x[a] = 0;
b++;
}
}
} while (b != 5);
a = cy[4]  y_min;
for (b = a; b < a + 15; b++)
{
interm[b] = colors[b  a];
}
a = cy[3]  y_min;
for (b = a; b < a + 15; b++)
{
interm[b] = colors[b  a];
}
a = cy[2]  y_min;
for (b = a; b < a + 15; b++)
{
interm[b] = colors[b  a];
}
a = cy[1]  y_min;
for (b = a; b < a + 15; b++)
{
interm[b] = colors[b  a];
}
a = cy[0]  y_min;
for (b = a; b < a + 15; b++)
{
interm[b] = colors[b  a];
}
color_buffer[ct++] = y_min;
color_buffer[ct++] = lang * 2;
for (a = 0; a < lang; a++)
{
color_buffer[ct++] = interm[a];
}
}
printf ("Press a key to save\n");
gemdos (0x7);
erreur = (int)gemdos (0x3c, "MORDOR.CNX", 0);
lenght = ct * 2;
gemdos (0x40, erreur, lenght, color_buffer);
gemdos (0x3e, erreur);
v_hide_c (handle);
v_clrwk (handle);
graf_mouse (0, NULL);
v_show_c (handle, 1);
close_work ();
return 0;
}
Thanks NYH, but I haven't found Pure C.Nyh wrote:I cleaned up the code with indent and fixed the obvious errors. Included the right include files so the code compiles with Pure C. IMHO this is a horrible pice of C code. Anyhow there is still one typo left. I don't know what it should be. Here is the cleaned up code:Maartau wrote:Normally, this is EXACTLY the same code now
Now, multi errors with caracters like { } (concerning the beginning of the lines).
Could you fill the *!=5* by *a!=5* & compil the file MORDOR.CNX please
Thanks (It's becoming very boring as I spent almost 6 hours on ).

 Obsessive compulsive Atari behavior
 Posts: 103
 Joined: Fri Jan 27, 2006 9:11 pm
 Location: Friceland
I'm not very interested in that code, but I would say the author didn't master it and was even fearful of it at that time.
I would read the test like that:
I would read the test like that:
Code: Select all
b = 0;
do
{
for (a = 0;
a < 5
&& (x[a] >= x[0])
&& (x[a] >= x[1])
&& (x[a] >= x[2])
&& (x[a] >= x[3])
&& (x[a] >= x[4])
&& b !=5;
a++)
...
Nope. You will have to compile it yourself. I have cleant the whole file up, removed the tons of poo, unnecessary code and stupid constructs. Made it a bit more readble. It will compile fine on any ANSI C compiliant compiler and as long as integer size is 2 bytes and the system is BIG endian, I think it will give the correct file too!Maartau wrote:Thanks NYH, but I haven't found Pure C.
Could you fill the *!=5* by *a!=5* & compil the file MORDOR.CNX please :?: :P
Code: Select all
#include <stdio.h>
#include <math.h>
#define pie 3.14159
int color_buffer[20000];
int colors[15] =
{0x000, 0x001, 0x002, 0x003, 0x004, 0x005, 0x006, 0x007, 0x006, 0x005, 0x004, 0x003, 0x002, 0x001, 0x000};
int main (void)
{
int i, j, ct = 0, x[5], y[5], interm[400], y_min, y_max, cy[5], lang;
float angle;
/* one complete revolution is 100 steps */
for (angle = 0; angle < 2 * pie  0.0628318; angle = angle + 0.0628318)
{
for (i = 0; i < 400; i++)
{
interm[i] = 0;
}
/* calculate (x,y) positions of raster bars */
for(i=0; i<5; i++)
{
x[i] = cos (angle  pie*(float)i/16.0) * 90 + 320;
y[i] = sin (angle  pie*(float)i/16.0) * 64 + 66;
}
/* calculate y_min and y_max */
y_min = y[0];
y_max = y[0];
for(i=1; i<5; i++)
{
if (y[i] < y_min)
{
y_min = y[i];
}
else if (y[i] > y_max)
{
y_max = y[i];
}
}
/* sort on x coordinates, store y */
for(i = 0; i < 5; i++)
{
for (j = 0; j < 5; j++)
{
if ((x[j] >= x[0])
&& (x[j] >= x[1])
&& (x[j] >= x[2])
&& (x[j] >= x[3])
&& (x[j] >= x[4]))
{
cy[i] = y[j]  y_min;
x[j] = 0;
}
}
}
/* first draw hindmost raster bars, overlapping is possible */
for (i = 4; i >= 0; i)
{
for(j = 0; j< 15; j++)
{
interm[j + cy[i]] = colors[j];
}
}
lang = y_max  y_min + 15;
color_buffer[ct++] = y_min;
color_buffer[ct++] = lang * 2;
for (i = 0; i < lang; i++)
{
color_buffer[ct++] = interm[i];
}
}
printf ("Saving!\n");
{
FILE* f;
if ((f= fopen("MORDOR.CNX", "wb"))==NULL)
{
printf("File open error!\n");
return 1;
}
fwrite(color_buffer, ct*2 , 1, f);
fclose(f);
}
return 0;
}
Edit: corrected typo
It should compile with any C compiler. For Pure C you have to use the Pure C 'default.prj' to build the file. For gcc I use: "gcc lm o st_cnx st_cnx.c"Maartau wrote:I've tried the first source using PURE C (I found it finally) : doesn't run (too many errors)
Next, I've tried the second source. There's more errors than the first
As I can't succeed, it will stay dead project.
If you can not get this Csource running maybe you have to write your own program for generating the raster infromation in your favorite programming language. It isn't so hard to understand what is done.
Hans Wessels
Thanks Nyh... Hope you did not take personally the comments about errors .Nyh wrote:It should compile with any C compiler. For Pure C you have to use the Pure C 'default.prj' to build the file. For gcc I use: "gcc lm o st_cnx st_cnx.c"Maartau wrote:I've tried the first source using PURE C (I found it finally) : doesn't run (too many errors)
Next, I've tried the second source. There's more errors than the first
As I can't succeed, it will stay dead project.
If you can not get this Csource running maybe you have to write your own program for generating the raster infromation in your favorite programming language. It isn't so hard to understand what is done.
Hans Wessels
You made a great job. To make it run correctly, I must take more time than typing the code. The main source have errors : the author also says it's very easy to convert it in GFA. (With errors too??? ).
I used C languages under STeem to try... And well... The original code was printed on two pages divided by two rows (nearly each line of code is broken ). So errors/mistakes, bad tools, bad source, really get on my nerves.
The last thing I'll try is to made the code running under MATHLAB (I've got the whole package & docs). Now, I'm more a MIDI expert than C.
I'm also sure I can't convert the code in MIDI
Thanks for all
Maartau
 Zorro 2
 Administrator
 Posts: 2226
 Joined: Tue May 21, 2002 12:44 pm
 Location: Saint Cloud (France)
 Contact:
After some demands from mister Maartau, I finally created a C project on Pure C to compil the last code from mister Nyh.
We're waiting now for mister Maartau to say : "Ca marche !"
(Place PRJ folder on C root please to compil...)
We're waiting now for mister Maartau to say : "Ca marche !"
(Place PRJ folder on C root please to compil...)
You do not have the required permissions to view the files attached to this post.
Member of NoExtra Team