Re: Why I stop attacking HLA



Randy wrote:
>
> anonymous wrote:
>
>> I still fail
>> to see how HLL-syntax would make people program earlier.
>
> Because they already *know* the HLL programming paradigm involving
> IF/WHILE/FOR/etc. That's one thing they *have* learned from their HLL
> course. Therefore, they can apply that knowledge to create working
> "assembly" programs in just a short time (i.e., during the first week)
> because they *do* have the prerequisites for these things.
Yes, I understand they would know the IF/WHILE/FOR/etc. syntax already, but
I don't see how that helps... Yes they would be able to apply that
knowledge, but they would have nothing to apply it to, they don't know
anything.

> Clearly, if they've never learned about IF/WHILE/etc., this this
> approach *won't* work. But it's a fairly safe assumption that they know
> how to use the basic control structures and procedures/functions if
> they've finished at least one term in a HLL programming course.
>
>> Besides, one
>> doesent need to understand the flags, in order to understand the cmp/jcc
>> instructions that would replace IF/ELSE. eg. "jump if (not) equal" "jumb
>> if
>> (not) above" and "jump if (not) below" should make perfect sense.
>
> The problem is *not* one of understanding what a single instruction
> like "JA" does. You can teach them that "fact" (as Herbert puts it) in
> a few days, even covering the appropriate prerequisite material
> (assuming teaching this was your priority). The problem, however, is
> teaching the programming *paradigm* that goes along with using
> statements like CMP/JA. Students have *not* be taught to solve problems
> that way, and throwing this stuff out at them causes confusion. The
> absolute *best* way I've found to teach these concepts is to use the
> explanation:
I know this is part of every programming course, learning to solve problems,
but I have never understood the use of it (I've never taken a programming
class), perhaps this is why I also don't understand why one would use
HLL-style??

To me using instructions like cmp and the basic jcc is pure logic, but then
again I've always been told I saw things to over-logically, so perhaps other
people wouldn't understand the logic in it?

> "This is how you do it in C, and this is how you do the same thing in
> assembly." In the case of IFs and WHILEs, for example, see:
>http://webster.cs.ucr.edu/AoA/Windows/HTML/LowLevelControlStructs.html#998258
>
> But it is still the case that it is *far* more efficient to cover lots
> of prerequisite material first. You can always *push* one subject
> earlier into the quarter if covering that subject is extremely
> important to you. But in the end, you'll probably cover *less* assembly
> concepts if you don't have a well-organized teaching plan. My goal has
> always been to optimize the teaching plan in order to get the students
> to learn the maximum amount of information per quarter.
Naturally that would (or at least should) be the objective for any teacher
(making sure "learning" is actually "learning" not just "teaching" ;) )

>Relying on
> HLL-like control structures early in the quarter allows me to put off
> the discussion of those concepts until later in the term, allowing
> better coverage of prerequisite material first.
>
> And it's not like I decided one day 15 years ago to do it this way. The
> educational plan I came up with was determined via lots of
> experimentation; including many failures as well as successes. And of
> all the things I've tried, two approaches produced a *tremendous* jump
> in the productivity of the students: the use of a "standardized"
> library for the students (e.g., the "UCR Standard Library for 80x86
> Assembly Language Programmers" and the "HLA Standard Library"), and the
> use of HLA (including the use of HLL-like control structures early in
> the term). I've taught x86 assembly classes using several different
> assemblers. And I've used Herbert's "Throw out a bunch of facts and try
> and explain them all later approach" Indeed, from
> http://webster.cs.ucr.edu/AoA/DOS/ch06/CH06-1.html:
>
> "Until now, there has been little discussion of the instructions
> available on the 80x86 microprocessor. This chapter rectifies this
> situation. Note that this chapter is mainly for reference. It explains
> what each instruction does, it does not explain how to combine these
> instructions to form complete assembly language programs. The rest of
> this book will explain how to do that."
You should not explain so many instructions without giving students the
ability to use them straight away. I would suggest as solution to that
problem, to teach them push, mov, call and ret in addition to the basic
syntax of the used assembler.
eg. the first program would be: (in masm syntax)
-------------------------------------------------------
..386
..model flat, stdcall
option casemap :none
..data
string db "Hello"
..code
start:
push GET_STD_HANDLE
call GetStdHandle

push 0
push ebx ;NumberOfBytesWritten
push 5 ;length
push offset string
push eax
call WriteFile
ret
end start
---------------------------------------------------
In order to get a basic understanding of this one would require:

knowledge of memory addresses and the difference between the addresss itself
and the value at that address.

basic understanding of the concept of procedures/functions.

an understanding of labels

the understanding that some things such as ".386" and ".model flat ..." just
have to be there, just as they would always have a main(){} in a C program
(without taking the analogy any further).

an understanding of the concept of registers.

and last but not least they would need to know that 'push' transfers a value
to a function and 'call' calls that function.

The next lesson would then include the cmp/j(n)e/j(n)a/j(n)b, the mov
instruction and dword ptr[var] and one would explain dwords/words/bytes. The
rest of the lesson I would use going in depth with one of the topics: Stack,
registers, hex/bin/dec or memory addressing. Then I would give them as a
home assignment to write a program using the program above, the cmp/jcc and
the dword ptr[var] to make a program to print various strings on various
staticly coded conditions.

third lesson would include an introduction to input using readfile, and
hex2string converting using wsprintfile, and a few new asm instructions.


> This approach *always* created problems and confusion and after several
> meetings with my department chair, I decided to give the HLL-like
> statement approach a try (well, it took three years after that to write
> HLA, but...) The results were *amazingly* successful. The course
> covered about 25% more material in the same 10 weeks and the final
> projects in the course were *far* better than those I'd seen in the
> past when using MASM or some other x86 assembler. Any arguments about a
> "HLL detour" when using HLA is complete nonsense. Experience indicates
> that by starting with the HLL-like statements in HLA, the students
> learn faster and cover more ground than was possible with using the
> traditional approach. And we're not talking about students writing
> "assembly" code containing WHILEs/IFs/FORs/etc. We're talking about
> students writing pure assembly programs at the end of the quarter. The
> improvement was *too* phenomenal to ignore. And mind you, these courses
> were taught in the 1999-2000 time frame, when the quality of students
> was lower (because of the huge dot-com bubble at the time, lots of
> students were entering CS programs in search of sky-high salaries,
> including many unqualified students).
Talking about quality of students seems a very abstract thing to me, I guess
the "quality" of a student would interpret as how much of what
(s)he is supposed to learn during the course they know already? would that
be a student fair quality judgement?

greetz,
Jakob Wrigley


.



Relevant Pages

  • Re: Helpful Practical Uses of Conditional Assembly
    ... But the argument doesn't apply to HLA because the functions ... an assembler needs to be *extremely* powerful. ... Herbert may think that forcing students to write "Hello World" ... instructions rather than futzing around writing "string print ...
    (alt.lang.asm)
  • Re: Question about jumps
    ... when you see an IF statement in HLA, you're going to need very little ... as you already know the machine instructions. ... How many students have you taught? ... Running the actual assembler is fairly trivial. ...
    (alt.lang.asm)
  • Re: Why I stop attacking HLA
    ... mastering other concepts in assembly language (such as how to do ... students crying about "busy work" and nonsensical assignments because ... instructions, then they're going to be more ... far as when they've started with a high-level assembler. ...
    (alt.lang.asm)
  • Re: Linux, X, ld, gcc, linking, shared libraries and stuff
    ... >> to solve the problem with the two different push instructions. ... But here the answer maybe is: I will show you that RosAsm ... a 32 bit offset or simple a "br" if the assembler should decide. ...
    (alt.lang.asm)
  • Re: x86-64 assembly problems
    ... addressing modes) assembly programing has nothing to do with DOS. ... We're not expecting students to write GUI apps in an assembly class. ... that teach assembly programming with DOS do segmentation. ... Learning the DOS API necessary to write simple assembler ...
    (alt.lang.asm)