On Tue, 5 Sep 2000, Maarten ter Huurne wrote:
> On Tue, 05 Sep 2000, you wrote:
>
> > The way numbers are written may be
> > different. Here's how my assembler does it:
> > starting with a number 0-9, a hexadecimal number is expected.
> > starting with %, a decimal number is expected.
> > starting with @, an arbitrary base (2-36) number is expected. first
> > character is the base (10-1 in the desired base), the rest is the number.
> > eg to write an octal number, you can use @7nnn. @fxx is an alternative way
> > of writing hexadecimal numbers.
>
>
> That makes sources for your assembler incompatible with every other assembler
> out there...
Hmmmm, ok. I can easily make it user defined. It would indeed be a good
idea.
> Who need numbers in an arbitrary base anyway? Hexadecimal, decimal and
> binary are enough. Octal is supported by many languages, but it is rarely
> used in practice (the only use I know is Unix file permissions).
Arbitrary base is easily implemented and might be useful in some cases. I
don't know when really. But I want to give the possibility.
> > Second thing is that I want header files for use with the assembler. I
> > want it to be used in combination with the gcc preprocessor, so #includes
> > can be made. Those header files should contain system variables, bios
> > addresses, i/o-port numbers, etc. If anyone is interested in writing them
> > (or help improving the source of the assembler), mail me directly or via
> > sourceforge.
>
> I have a couple of header files already (for the BIOS, SubROM and hooks).
> I'll mail them to you.
Thank you.
> Please don't use the C system for header files. It is better to make
> the assembler remember which header files are already included and
> don't process a single header file twice.
I preprocess the source with gcc -E -P -C. Of course this implies that I
do use the C system for header files. I just don't feel like rewriting the
whole preprocessor again, while I do want its full functionality.
Bye,
main(){int c[4] ,x=4 ,l=getpid() ,i;; for( srand(l);c[ x]=- rand
()%6 ,x-- ;);; for( ;44> x;){ char a[9] ,*p=
"%.1f\n", b[9];x=i=0; gets(a);for (l=4 ;l-- ;)x+=-(a[l] -=48)==
(b[l ]=c[ l]); ;for (l=0;16 >i;l =++i %4)x
+=(b[i/4]+ a[l] ?0:( a[l]=b[i/4] =10)) ;printf(p,x *.1) ;};}
****
Problems? contact [EMAIL PROTECTED] See also http://www.faq.msxnet.org/
****