Got it.
This is a discussion on Converting MINI-BASIC in MASM over to C++? within the Projects and Job Recruitment forums, part of the Community Boards category; Got it....
Got it.
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}
Ok, so this update contains the implementation for 'EvalExpr', and the 'LET' command, plus some other minor changes. Let me know if I broke anything.
Paul, just thought I'd let you know that it still has a way to go before you'll be able to test it out, but it is coming along...
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}
Ok, thanks Sebastiani.
Paul
I took a look at the code... the original is a bad dog.
Before I jump into this, which I may if time allows, may I at least suggest updating the API test to do something useful?
Soma
Code:void mbox_error_handler ( const std::string & from_f, const std::size_t where_f, const bool show_f ) { if(show_f) { const DWORD buffer_length(256); char message_buffer[buffer_length]; const DWORD characters_written = FormatMessageA ( FORMAT_MESSAGE_FROM_SYSTEM, 0, // lpSource (ignored here) GetLastError(), 0, // dwLanguageId (use system defaults) message_buffer, buffer_length, 0 // Arguments (pointless VA_LIST nonsense) ); std::ostringstream message; if(0 == characters_written) { message << "File: " << from_f << '\n' << "Line Number: " << where_f << '\n' << "Error Message:\n" << "unknown exception" ; } else { message_buffer[characters_written - 2] = 0; message << "File: " << from_f << '\n' << "Line Number: " << where_f << '\n' << "Error Message:\n" << message_buffer ; } MessageBoxA ( 0, // hWnd (no owner) message.str().c_str(), "WIN32API Exception", MB_ICONERROR | MB_OK | MB_TASKMODAL ); } } #define WINAPITEST(BADVALUE, RESULT) mbox_error_handler(__FILE__, __LINE__, BADVALUE == RESULT)
>> I took a look at the code... the original is a bad dog.
I couldn't agree more.
>> may I at least suggest updating the API test to do something useful?
That's a good idea. And since API errors are basically fatal, you might as well just have the program die at that point.
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}
Agreed - I was going to do something like that, but I hadn't got round to it.
Can we just do a small change:
By putting names there, it's easier to see what is what.Code:#define WINAPITEST(RESULT, EXPECTED) mbox_error_handler(__FILE__, __LINE__, RESULT == EXPECTED)
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
I'm pretty sure I said something like that when I started the work - it's definitely not easy-to-follow, straight-forward assembly code. Lots of jumps. One of my favourites was a bit that didto skip over a jmp instruction in the calling code. That is hard to achieve in C or C++.Code:pop ebx // get return address add ebx, 2 jmp ebx
I'm going to have a quick look at Sebastianis change's, but do not expect me to do much with it until Monday.
In the mean-time, keep up the good work.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Ok, thanks.
Paul
A couple of comments on the updated code:
1. what is #include <std> for?
2. In VS 2008, the loss of const in RedimWindow() doesn't work.
I also think we should keep the functionality of RedimWindow - there is a "WINDOW" command in the language itself that uses it. I believe existing code would break if you remove that command.
It may well be that some situations do not allow completely free re-sizing of windows, but it should still be there for those apps that can/want to do it.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Oh, the header include was just for debugging purposes. Ignore it.
As far as RedimWindow goes, it just needs to be restructured so that it takes on a default value when the program starts up, and then if the user tries to resize the window and it fails, it just reverts back to the default without causing a fatal error.
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}
For some reason the documentation in MBI.zip doen't list all of the functions (such as WINDOW, LOCATE, etc). Anyone have a complete listing?
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}
Ha! Yeah, I admit it, I was trying to avoid looking at the assembly...![]()
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
BTW, Are PEEK and POKE supposed to refer to the @ variable?
Code:int main(void){srand(time(0));for(double l=rand(),l0=0,l00=0;;l0+=0.1){for(double l000=0;l000 <1;l000+=.001,l+=((double)rand()/RAND_MAX)/0x64,l00+=((sin(l*0x8*atan(l0)*l000-(l0*0x8*atan (l)))*0.5)+0.5)){l00-=floor(l00);for(size_t l0000=0,l00000=(size_t)(0x50*(l00));l0000<l00000;++l0000 )putchar(0x20);putchar(0x61+(int)((double)rand()/RAND_MAX*0x1a));putchar('\n');}}return 0;}