OSDev.org

The Place to Start for Operating System Developers
It is currently Tue Mar 19, 2024 8:03 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: ClrScn Funtion not working
PostPosted: Tue Mar 22, 2011 10:32 am 
Offline

Joined: Tue Mar 17, 2009 12:43 pm
Posts: 13
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?


Top
 Profile  
 
 Post subject: Re: ClrScn Funtion not working
PostPosted: Tue Mar 22, 2011 10:48 am 
Offline
Member
Member
User avatar

Joined: Thu Nov 16, 2006 12:01 pm
Posts: 7612
Location: Germany
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:
@@ -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.

_________________
Every good solution is obvious once you've found it.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page Previous  1, 2

All times are UTC - 6 hours


Who is online

Users browsing this forum: iansjack and 23 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group