Prev: Win32 non blocking console input?
Next: hugi compo #29
From: NathanCBaker on 4 Dec 2008 10:34 On Dec 4, 7:06 am, Frank Kotler <fbkot...(a)verizon.net> wrote: > NathanCBa...(a)gmail.com wrote: > > ... > > >> Compiling "sliders.hla" to "sliders.obj" > >> Error in file "os.hhf" at line 5 > >> syntax error, unexpected namespaceTkn, expecting DoOneValStmt. > >> Near: << namespace >> > > > This hints at a copy-N-paste error. { looking back at my original > > post, yep, I goofed! } Add a "program fifteen;" line at the beginning > > just above the "#include" directive. > > Of course!!! Why didn't I figure that out from the error message? :) > > (This is "experience" - "recognizing an error when you make it again". > Like when I got a column of '%' characters from Michael's "maxofthree", > I said to myself "this doesn't look like an assembly language error to > me"...) > Yeah, I had the same sort of gut feeling. Wondered if he was accidentally triggering the C++ parser or something weird like that. I didn't say anything because I am not intimate with C. I don't remember who taught me that. > ... > FILEIO_PUTH8SIZE: > push ebp ; 08049A50 _ 55 > mov ebp, esp ; 08049A51 _ 89. E5 > sub esp, 4116 ; 08049A53 _ > 81. EC, 00001014 > > Kind of a lot, innit? What in hell we need a 4k buffer to display one > hex byte for??? Oh, I see, in case we want to left/right justify it in a HLA is the language that Hydes. > really big field... (speaking of "quiet", hope Wolfgang's okay! He would > consider this "stack abuse", I think.) Yeah, his "brb" wasn't intended to be a disguised "bye", I don't believe. Or... did "moving to a new home" really mean....??? > > I suppose I should look at Herbert's "readable" version, too... > After deciding that this... #define n (('|'<<24)+(' '<<16)+('0'<<8)) ....is magic, and this... feld[i][j]= n + (((k='0'+i*4+j)<='9')?k:k-'0'-10+'a'); ...is more magic, the rest is "pretty much readable" to me. But I need to locate an emulator for the CPU that understands those machine instructions. :) Nathan.
From: NathanCBaker on 4 Dec 2008 11:23 On Dec 4, 5:00 am, "Rod Pemberton" <do_not_h...(a)nohavenot.cmm> wrote: > <NathanCBa...(a)gmail.com> wrote in message > > news:81d0f2a8-5e34-4815-bc29-9aa56349cfe2(a)l39g2000yqn.googlegroups.com... > > > On Dec 2, 5:00 am, "Rod Pemberton" <do_not_h...(a)nohavenot.cmm> wrote: > > > Hmm, dword, boolean, int32... Is there a difference between "dword" and > > > "int32" in HLA? Why?!?!... Why are there both differently sized "words" > > > and differently sized "ints"? I'm assuming both are multiples of 8-bit > > > bytes. Yes? Is one unsigned and the other signed!?!?! (Horror of > horrors! > > > Please don't say "yes"...) If so, which is which? No way to tell from > > > that. > > > dword = dword > > int32 = signed > > uns32 = unsigned > > boolean = dword (if I recall correctly) > > 3 or 4 32-bit types? Why? That completely nullifies the use of a > typesystem. It's like using "void *" to prevent casting in C or to > intentionally bypass the typesystem... > No, this is the typesystem. One must use casting to override it. Except in the case of a variable or parameter that is typed as dword -- since any of the other three (int32, uns32, boolean) will fit in there without issue, casting is not needed. > > > > if( esi = 0 ) then > > > > I'll have to assume equality and not assignment... Use of "=" for > > > assignment is likely to permanently braindamage HLA programmers when > they > > > move on to C or Pascal. Superb syntax choice, not! > > > Assignment in Nasm is: mov eax, 42 > > Sorry, the usage in first sentence was correct. The second should've said > "equality". I.e., equality is "==" or ":=" in C or Pascal, using "=" for > equality instead of assignment will cause mental problems. > CA-Clipper encouraged ":=" for assignment. This meant that not only was the variable declared, it was also typed, and it was also initialized, and we also explicitly provided what that initial value should be. Each variable was a meta-data construct from hell! :) > > A couple months ago, I had the devil of the time attempting to > > enhance a semi-complicated piece of Ruby code when I tried to locate > > the end of a 'while' loop hidden among a bunch of nested if blocks. > > This is what I saw [replacing spaces with "." in case you're not using > > a fixed-width font]: > > > ............end > > ..........end > > ........end > > ......end > > ....end > > ..end > > end > > > One of those in the middle was the 'end' associated with the 'while'. > > So? It looks well indented... You should've been able to align the > columns. If not, before the entire block, set somevar=0. Inside the > "while", set somevar=1. Prior to each "end", check somevar for 1 and if so, > print a message specific to that "end". From past conversations, it seems > that these problems seem to plague you. You need to learn to use "printf" > or it's equivalent as your only debugger. > Your employer sure must enjoy paying you overtime. My solution used a digital computer that I was born with. I simply added a finger for every "begin"-style token and removed a finger for every "end" token as I scanned down the code -- stopped whenever I had the same number of fingers on a "end" as I did for the "while". I guess it is called "Agile programming" for "dexterity" reasons. :) > > I probably would have pulled out my hair if I had to deal with this: > > > )))))))))))))) > }}}}}}}}}}}}}} > > They'd have been indented properly in well written code... > .............} ...........} .........} .......} .....} ...} } They still are not "full talking names" by a long shot. > I.e., you should *either* be able to use the file directly as a file handle: > > myfile.getc(); //Again, is there a need for () on getc here? > That syntax is also allowed. Just declare "myfile" to be a member of the file class. If one is not "jmp"ing to a label, then one needs the () to show that it is a procedure call. Otherwise, it might be interpreted as a variable access within a namespace. For instance, in my code, I have "if ( player.left = true ) then" which accesses the class variable "left" from outside of the object [ allows one to forgo the writing of getter/setter methods ]. > > > Coal for Randall... > > > A programmer's manual for Rod. > > Apparently not, since I still don't know what values "true" and "false" > represent. I don't know whether booleans are logically anded with one. I > don't know how "edx" became a boolean without a declaration as such or why > it would be legal to use it in that way if HLA has any type system at all.. > And, I still don't know why HLA has, apparently, at least 3 32-bit types.... > What you cannot locate in the HLA manual, you can usually find it in "Art of Assembly" and vice versa. Keep looking... Nathan.
From: Herbert Kleebauer on 4 Dec 2008 11:33 NathanCBaker(a)gmail.com wrote: > After deciding that this... > > #define n (('|'<<24)+(' '<<16)+('0'<<8)) > > ...is magic, and this... If I had written #define n 0x7c203000 then you also had claimed, this number is magic. > > feld[i][j]= n + (((k='0'+i*4+j)<='9')?k:k-'0'-10+'a'); > > ..is more magic, the rest is "pretty much readable" to me. But I need more magic? k=i+4*j; if (k<=9) feld[i][j]= n + '0' + k; else feld[i][j]= n + 'a' + k-10; > to locate an emulator for the CPU that understands those machine > instructions. :) This emulator is called "gcc" and really should be installed on any computer.
From: NathanCBaker on 4 Dec 2008 13:00 On Dec 4, 7:06 am, Herbert Kleebauer <k...(a)unibwm.de> wrote: > > > So, you agree with me that 'mov( 0, eax )' is better readable? The 'mov( 0 ... " is self-commenting. > > Why should this be better readable than > > sub.l r0,r0 > eor.l r0,r0 > This requires: sub.l r0,r0 ; store 0 in r0, this is not declaring a sub-routine. eor.l r0,r0 ; store 0 in r0, this is not a tail-less donkey. > No ,I would do it in real assembly (not a single library call): > > The binary: > > @echo off > trap #$21 > ... > trap #$21 > ... > trap #$21 So, those lines do not initiate the execution of *any* library code what-so-ever, huh? Those are magic boxes that the CPU takes care of all by itself, huh? Millions of ASM programmers around the world just learned something new today. :) Nathan.
From: Herbert Kleebauer on 4 Dec 2008 13:29
NathanCBaker(a)gmail.com wrote: > On Dec 4, 7:06 am, Herbert Kleebauer <k...(a)unibwm.de> wrote: > > > > > So, you agree with me that 'mov( 0, eax )' is better readable? > > The 'mov( 0 ... " is self-commenting. > > > > > Why should this be better readable than > > > > sub.l r0,r0 > > eor.l r0,r0 > > > > This requires: > > sub.l r0,r0 ; store 0 in r0, this is not declaring a sub-routine. > eor.l r0,r0 ; store 0 in r0, this is not a tail-less donkey. If it isn't obvious that e.g. "5-5" is the same as "0" then it's better to not do assembly programming. > > No ,I would do it in real assembly (not a single library call): > > > > The binary: > > > > @echo off > > trap #$21 > > ... > > trap #$21 > > ... > > trap #$21 > > So, those lines do not initiate the execution of *any* library code > what-so-ever, huh? Those are magic boxes that the CPU takes care of > all by itself, huh? Millions of ASM programmers around the world just > learned something new today. :) I really hope that not a single one of the Millions of assembly programmer has learned something new (note: a HLA a programmer isn't an assembly programmer). If you call a library routine, then the called code is executed in the same context as the calling code. That means, there is no difference in calling the library routine or embedding the identical instruction sequence directly within your code (all the library code does, is to save you the time to write the code yourself). A software interrupt (trap #$21) changes the CPU mode to supervisor mode so privileged instructions can be executed. You can spend as much time as you like, you will never be able to write a code sequence in your user program which does the same as the interrupt routine, because you are not allowed to execute the necessary privileged instructions. |