Page 2 of 2

Re: ClrScn Funtion not working

Posted: Tue Mar 22, 2011 10:32 am
by terry
jal wrote:
trinopoty wrote:You have to replace [some code] with [some code]
Apart from the fact that there's only a single change, in a single line that could easily have been communicated in a better format than a copy/paste of an entire routine with one change, this doesn't teach anyone anything.
Do you always criticize new posters that are trying to help?

Re: ClrScn Funtion not working

Posted: Tue Mar 22, 2011 10:48 am
by Solar
terry wrote:Do you always criticize new posters that are trying to help?
Criticism is not negative per se. Unfortunately several people here - including myself on more than one occassion - have become somewhat irritated by some of the "usual suspects" - bad behaviour that occurs again and again and AGAIN as new people join the board, and are prone to overreaction when they (re)appear.

One of these "usual suspects" is what I would call "here's a piece of ASM code that works".

trinopoty's post was a bordercase, but apparently enough to set off jal's trigger reflex. (Note how jal, in his criticism, even missed one of trinopoty's corrections due to their poor presentation.)

To make the criticism constructive: A diff is always best when correcting someone else's code, as it shows clearly what has changed. Having correct code that one could copy & paste is good (for a certain definition of "good"), but understanding what was wrong is much better.

Code: Select all

@@ -7,9 +7,9 @@
    mov   es, cx
    mov   di, 0      ; starting location (upper left corner)
    mov   ax, 0x0720   ; ASCII <space> character
-   mov   cx, 0x1920   ; # of chars on the screen (80x24)
+   mov   cx, 0x0780   ; # of chars on the screen (80x24)
    rep   stosw
-   mov   byte [cursor],0   ; move cursor to the top of the screen
+   mov   word [cursor], 0   ; move cursor to the top of the screen
    call   set_hwcursor
    pop   ax
    pop   di
In this case, the uncommented diff should already be enough, as the errors fixed are somewhat obvious. In more difficult cases, a short explanation as to why the original code was broken and how you fixed it is helpful.