Re: Euler Project Problems.
"Ray St. Marie" <[email protected]> Fri, 16 May 2008 05:19:56 -0600
| Newsgroups | gmane.comp.lang.forth.colorforth |
|---|---|
| Message-ID | <[email protected]> |
On Fri, May 16, 2008 at 3:43 AM, Nick Maroudas <[email protected]> wrote: > > Nick here, > > I made a USBoot pendrive following the link you posted > above, and it boots my favourite MPE Forth for DOS - no > trouble there; but when I tried to boot OkadWork.cf it > refused with a message: "Athena Forth requires > Windows". So I guess Athene Forth > > ftp://ftp.uu.net/vendor/minerva/uathena.htm > > might be supplying the "Windows wrapper" that Jeff Fox > mentioned in his release announcement for OkadWork. Confirmed! This found in a hex dump 41 54 48 45 4e 41 20 61 6c 6c 6f 63 61 74 6f 72 20 56 65 72 73 69 6f 6e 20 31 2e 30 30 20 66 6f 72 20 57 69 6e 64 6f 77 73 20 4e 54 Lol That says... Athena allocator Version 1.00 for Windows NT > My point was, that OkadWork's block 66 is CF's boot.asm > recast as a Forth block: so, does OkadWork need a > Forth "wrapper" to boot it? It's in the kernel section of OkadWork.cf or with-in the first 6k bytes as the next 12k are fonts I understand. The windows rapper emulates this for windows and most likely skips over the boot section of the OkadWork.cf, I am assuming. > > I am now very pleased with ColorForth; it combines > insightful simplicity of the original FIG Forth for > Z80, with the speed of modern CPU. (Re speed, do your > Euler solutions run equally fast in Windows OkadWork as > in native CF01 or CF02?). I'm certain ( well am I ? ) that the native is faster, but I still haven't worked out setting a clock and then reading it at the end of execution yet. So far the times are imperceptable, either way. This is just the first two solutions though. They should be considered the easiest ones. Some things to note about the first two ... The first one re-calculates the total before each screen print of the answer. This particular program tickles me because I was able to write it in such a way that adding white comments even between code words in a definition made the program also the documentation, and it's readable. For instance: I created a red word called comment and has just white words that follow that say... comment read words between ;. and .; and then one of the words using that idea is called sum where the words between [ and ] are cyan inlined machine code ( for speed). macro sum [ dup u+ ] ; With the comment added it reads sum nn ;. Add [dup] to accum using [u+] .; ; The second one, not quite so "prose-like", but still readable and most likely fine as documentation itself... ...only calculates the answer once and then calls a variable where the total is stored to fetch and display. I like variables for that purpose because they act as a display of such important facts, and right in source! Sweet. In the third i've decided to use the FPU for a 600trillion scale integer. This is so that I can learn to use the FPU. I can see down the road that several of the programs that will be required to solve these "problems" may be simpler in design using the FPU. There is also many programs that could benifit from a proper BIGNUMs implementation. I want to do that as well. Might just re-do Project Euler 3 when the BIGNUM blocks are finished as well. Marcel Hendrix has a great example for BIGNUM ( I'm certain i've mentioned this...) at http://home.iae.nl/users/mhx/bignum.frt All the while I'm keeping in mind that Chuck talks about using scale and proper terms to by pass needing FPU. This is also a challenge to me. Math is many moons ago. :-) I believe I have a solution to PE3. I did it in gForth using the double wordset. I don't want to enter it into Euler until I have a working colorForth solution, which is the point of my challenge. At this point I have a text page of psuedo code where I've mapped out what I wanna do. Now I'm filling that text with the FPU escape opcodes. I know I will need to FNINIT ( although FINIT would be more "user friendly on more machines) , to initiate the FPU, FILD, to enter the integer ( in hex using a quadword) FLD, to save a copy of the bignum in stack for iterations, FIDIV or FDIV depending on how I decide to represent the divisor, ( which I have decided to get from a table of primes from 7 to 101 in the first set of tests). I'll be testing for remainders, and poping the integer answer from the FPU with either FIST or FST depending on how I want to translate the return to the screen. What I have not assertained is if I will use FPREM1 for getting the remainder... OR Might be better to just send all answers out to the memory with FST and then test the answer there with the idea that a float will be in a format that is recognisable, and I should be able to ascertain whether it has a remainder or not. Maybe that's too many times in memory VS. finding the remainder 0 in the FPU and then doing the calculation a second time to get the quotient out to memory. There is a way to send condition codes to the EFLAGS reg in one op for machines like mine, or 3 ops if I want to be compatiable to all pentiums. This could be used to determine the next iteration and the next small prime to test. What I don't know and have not been able to find out is if it is necessary to some how shut the fpu back off. > > Native CF allows direct access to my PC hardware - no > other OS needed. If convenience is important, > OkadWorks smoothly on a nearby Windows box - ready for > the release of those music drivers and video drivers > that Jeff mentioned; and they've even added a QWERTY > keyboard to make Terry happy :-) Lol speaking of qwerty... it's just too slow. I've gone back to ChVorak for everything except long text strings. > > Then there is the 25x pendrive to look forward to .... > > This is true. Lol will I be done with the challenge before or after I have one of these drives in my hand. :-) > Caritas, > > Nick > > **** > > Praise the Lord who supplies us with all the good things > in life; and all he charges is hard work. > - Leonardo da Vinci > "Keep your apples and your bag at home Dr, for an onion a day keeps the Persians away! " Socrates as a soldier. ( not really, well not unless I was Socrates in a previous life.) But it does speak well for choosing the right 'low hanging fruits at the right time". lol Ray, im outie! -- Raymond St. Marie ii, colorforthray.info