Click here to Skip to main content
15,881,173 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: From my crossassembler's manual Pin
glennPattonWork35-Dec-20 10:24
professionalglennPattonWork35-Dec-20 10:24 
GeneralRe: From my crossassembler's manual Pin
OriginalGriff5-Dec-20 10:50
mveOriginalGriff5-Dec-20 10:50 
GeneralRe: From my crossassembler's manual Pin
glennPattonWork35-Dec-20 10:58
professionalglennPattonWork35-Dec-20 10:58 
GeneralRe: From my crossassembler's manual Pin
CodeWraith5-Dec-20 11:42
CodeWraith5-Dec-20 11:42 
GeneralRe: From my crossassembler's manual Pin
OriginalGriff5-Dec-20 20:20
mveOriginalGriff5-Dec-20 20:20 
GeneralRe: From my crossassembler's manual Pin
trønderen5-Dec-20 13:40
trønderen5-Dec-20 13:40 
GeneralRe: From my crossassembler's manual Pin
CodeWraith5-Dec-20 14:40
CodeWraith5-Dec-20 14:40 
GeneralRe: From my crossassembler's manual Pin
trønderen5-Dec-20 17:25
trønderen5-Dec-20 17:25 
CodeWraith wrote:
Wrong algorithm = slow program. No compiler can optimize that away. That's where most of the optimization happens.
Amen. So code that algorithm in a HLL. I can't think of an algorithm that can be coded in assembly only. All algorithms can equally well be coded in a HLL.

Re discussions with professors: When I was teaching at a tech college, "readable" code was one of my main focuses. The basic "Computer Architecture" course was the only one with assembly coding, so that the students could see stuff like registers and instruction sets in real use. To zero AX, you move a zero into AX, right? MOV AX, 0. One of the students insisted that "no real programmers" would do it that way; they would rather use XOR AX, AX, which is faster! That he knew for sure - he wouldn't sacrifice performance for readability! So I dug up the timing diagrams to show him that although he was right for the 8086, that less readable code could save you a single clock cycle, for the 186, 286 and 386 (which was state of the art at that time), the two instructions required the same number of clock cycles. That didn't move him: He insisted on writing code that would run at maximum speed on the 8086, even though the 8086 at that time was beyond obsolete.

For the hand-ins, this student provided two solutions: One large comment block with some of the dirtiest assembly code I have seen, headed by the text "This is how a REAL programmer would do it:", followed by a block of (not commented out) assembly code that was neat and readable, headed by "But this is how we are forced to write the code in this course:".

I found it kind of cute. Deep down in my old "archives", I still have a photocopy of that hand-in.
GeneralRe: From my crossassembler's manual Pin
CodeWraith5-Dec-20 23:21
CodeWraith5-Dec-20 23:21 
GeneralRe: From my crossassembler's manual Pin
trønderen6-Dec-20 8:20
trønderen6-Dec-20 8:20 
GeneralRe: From my crossassembler's manual Pin
CodeWraith6-Dec-20 14:39
CodeWraith6-Dec-20 14:39 
GeneralRe: From my crossassembler's manual Pin
trønderen7-Dec-20 11:28
trønderen7-Dec-20 11:28 
GeneralRe: From my crossassembler's manual Pin
CodeWraith7-Dec-20 13:03
CodeWraith7-Dec-20 13:03 
GeneralRe: From my crossassembler's manual Pin
den2k886-Dec-20 6:05
professionalden2k886-Dec-20 6:05 
GeneralRe: From my crossassembler's manual Pin
trønderen6-Dec-20 8:36
trønderen6-Dec-20 8:36 
GeneralRe: From my crossassembler's manual Pin
den2k886-Dec-20 11:18
professionalden2k886-Dec-20 11:18 
GeneralRe: From my crossassembler's manual Pin
Richard MacCutchan5-Dec-20 21:35
mveRichard MacCutchan5-Dec-20 21:35 
GeneralRe: From my crossassembler's manual Pin
CodeWraith5-Dec-20 23:29
CodeWraith5-Dec-20 23:29 
GeneralRe: From my crossassembler's manual Pin
Richard MacCutchan6-Dec-20 1:25
mveRichard MacCutchan6-Dec-20 1:25 
GeneralRe: From my crossassembler's manual Pin
dandy726-Dec-20 3:24
dandy726-Dec-20 3:24 
GeneralRe: From my crossassembler's manual Pin
CodeWraith6-Dec-20 3:54
CodeWraith6-Dec-20 3:54 
GeneralRe: From my crossassembler's manual Pin
dandy727-Dec-20 9:24
dandy727-Dec-20 9:24 
GeneralRe: From my crossassembler's manual Pin
den2k886-Dec-20 5:53
professionalden2k886-Dec-20 5:53 
JokeAin't it the truth PinPopular
Mike Hankey5-Dec-20 8:19
mveMike Hankey5-Dec-20 8:19 
GeneralRe: Ain't it the truth Pin
OriginalGriff5-Dec-20 9:46
mveOriginalGriff5-Dec-20 9:46 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.