OSDev.org

The Place to Start for Operating System Developers
It is currently Wed Apr 24, 2024 11:12 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 51 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Wed Jan 29, 2014 6:31 am 
Offline
Member
Member
User avatar

Joined: Wed Aug 21, 2013 3:53 am
Posts: 449
Location: Asia, Singapore
Code:
mov ax, 0x7202
push ax
popf
pushf
pop bx
cmp ax, bx
je _386_ok
mov si, _386_NF
invoke NT_PRINTF
int 0x20
; Tell the user to get a life
_386_NF db '386+ Processor Not Found, Are you trolling me or.... Its 2014 man, You better get a life', 13, 10, 0

_________________
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Wed Jan 29, 2014 4:44 pm 
Offline
Member
Member

Joined: Sat Nov 21, 2009 5:11 pm
Posts: 852
greyOne wrote:
Black magic and Witchcraft; they are things you encounter in programming.

Witchcraft indeed, not to mention wrong. The return instruction is missing the high byte of the parameter. For a parameter of 0, just use the 1-byte version instead (0xc3). I also wonder why you are using inline assembly instead of just casting to a function pointer?


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Wed Jan 29, 2014 6:57 pm 
Offline
Member
Member
User avatar

Joined: Sat Nov 15, 2008 2:37 pm
Posts: 815
Location: The Fire Nation
sid123 wrote:
_386_NF db '386+ Processor Not Found, Are you trolling me or.... Its 2014 man, You better get a life', 13, 10, 0


That's like saying "get a life" because someone drives an older car.
If they didn't have a life, do you think they would have a vehicle?


His next post shows him being more specific, as i was being overly analytical on his post, as he was on mine in a different thread.


Last edited by VolTeK on Thu Jan 30, 2014 1:14 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Thu Jan 30, 2014 1:09 am 
Offline
Member
Member
User avatar

Joined: Wed Aug 21, 2013 3:53 am
Posts: 449
Location: Asia, Singapore
VolTeK wrote:
sid123 wrote:
_386_NF db '386+ Processor Not Found, Are you trolling me or.... Its 2014 man, You better get a life', 13, 10, 0


That's like saying "get a life" because someone drives an older car.
If they didn't have a life, do you think they would have a vehicle?

Wikipedia wrote:
"Get a life" is an originally American idiom and catch phrase usually intended as a taunt, to indicate that the person being so addressed is devoting an inordinate amount of time to trivial or hopeless matters

Just telling my users not to be obsessed with things like processors who are even older than 80386.

_________________
"In a time of universal deceit - telling the truth is a revolutionary act." -- George Orwell
(R3X Runtime VM)(CHIP8 Interpreter OS)


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Tue Feb 04, 2014 1:15 pm 
Offline
Member
Member

Joined: Sun Feb 03, 2013 10:38 pm
Posts: 58
Location: Canada
Gigasoft wrote:
Witchcraft indeed, not to mention wrong. The return instruction is missing the high byte of the parameter. For a parameter of 0, just use the 1-byte version instead (0xc3). I also wonder why you are using inline assembly instead of just casting to a function pointer?


Despite this, it works with both MSC and GCC on real hardware and a virtual machine. I actually did try using a function pointer, but that resulted in an invalid op code exception when compiled in MSC, when running on real hardware (the problem I do not remember exactly, but it was immediately notable when looking at the disassembly).


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Sun Mar 23, 2014 1:29 am 
Offline

Joined: Sun Mar 23, 2014 1:26 am
Posts: 1
Got some real gems here! I recently launched a site called Inline Comedy to catalog just this type of humor... check it out!


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Tue Apr 22, 2014 1:43 pm 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
It's not really a comment but I once typed this quick note when I thought I had finally deciphered some documentation on my way to the loo:
Quote:
All ISRs are in the kernel code segment.

All segments (everywhere, not just in the IDT) are done with the lower three bits of 0 and the rest giving the value of
the GDT entry of interest (that's the index of the value, meaning 1 per 8 bytes, so no multiclication is nessecary as
the value is not the byte offset into the GDT but the segment index in the GDT, where a segment is 8 bytes).
That's not even correct!!! :shock:

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Thu Apr 24, 2014 1:48 am 
Offline
Member
Member
User avatar

Joined: Fri Jan 16, 2009 8:34 pm
Posts: 284
Location: Louisiana, USA
Funniest thing I have in my OS is the shutdown screen, I did comment out the last part as it required INTs running for timer.

Code:
while(CMD_ACTIVE)
   cmd_handler();
movcur(ROWS - 1, COLS - 1);
movcur_disable ++;
setColor      (0x0F);
cls();
__asm__ __volatile__ ("cli");
puts("So long, farewell\nAuf Wiedersehen, goodnight\n\n");
puts("I hate to go and leave this pretty sight\n\nSo long, farewell\nAuf Wiedersehen, adieu\n\n");
puts("Adieu, adieu\nTo you and you and you\n\n...\n\n");
puts("The sun has gone\nTo bed and so must I\n\n");
puts("So long, farewell\nAuf Wiedersehen, goodbye\n\n");
puts("Goodbye\nGoodbye\nGoodbye\n\nGoodbye");
setColor      (0x0E);
curX = (COLS / 2) - 17;
curY = ((ROWS - 1) / 2) - 1;
puts("        So sad to see you go");
curX = (COLS / 2) - 17;
curY = ((ROWS + 1) / 2) - 1;
puts("It is safe to turn off your computer");
curX = (COLS / 2) - 17;
curY = ROWS - 1;
puts("             GOOD BYE!");
//__asm__ __volatile__ ("sti");
__asm__ __volatile__ ("hlt");
/*   sleep(60);            //wait 60 seconds and display EASTER EGG
__asm__ __volatile__ ("cli");
setColor (0x1F);
cls();
puts("So long and thanks for all the fish\n\
So sad that it should come to this\nWe tried to warn you all but oh dear?\n\n\
You may not share our intellect\nWhich might explain your disrespect\nFor all the natural wonders that grow around you\n\n\
So long, so long and thanks\nfor all the fish\n\n\
The world's about to be destroyed\nThere's no point getting all annoyed\nLie back and let the planet dissolve\n\n\
Despite those nets of tuna fleets\nWe thought that most of you were sweet\nEspecially tiny tots and your pregnant women\n\n\
So long, so long, so long, so long, so long\nSo long, so long, so long, so long, so long\n\n\
So long, so long and thanks\nfor all the fish\n");
__asm__ __volatile__ ("hlt");*/

_________________
BOS Source Thanks to GitHub
BOS Expanded Commentary
Both under active development!
Sortie wrote:
  • Don't play the role of an operating systems developer, be one.
  • Be truly afraid of undefined [behavior].
  • Your operating system should be itself, not fight what it is.


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Thu Apr 24, 2014 1:56 am 
Offline
Member
Member
User avatar

Joined: Mon Mar 05, 2012 11:23 am
Posts: 616
Location: Germany
Haha, I've got one, too. This is my exception handler for everything except divide-by-zero, gpfs or page faults :D

Code:
// Other exceptions:
// Theres on easy way out
// Theres no shortcut home
// Theres no easy way out
// Giving in cant be wrong
default: {
   debug_consoleVideo_out("PANIC - An unhandled error occured.");
   debug_consoleVideo_out(" Interrupt number: ");
   debug_consoleVideo_outHex(r->intr);
   debug_consoleVideo_out(" Exception name: ");
   if (r->intr < 32) {
      debug_consoleVideo_out(EXCEPTION_NAMES[r->intr]);
   } else {
      debug_consoleVideo_out("<unknown error>");
   }
   debug_consoleVideo_out("No detailed information available");
   break;
}

_________________
Ghost OS - GitHub


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Thu Apr 24, 2014 5:15 am 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
I've got the following block (or a variation of it) at the start of every software interrupt handler:
Quote:
;Interrupt 0x70 handler (Open file)
.ascii "HANDLERINT112" ;ID string used by the IDT auto-compiler
The "IDT auto-compiler" is the worst C program I have ever written with the sole task of preparing an IDT file for writing to disk (it can't even prepare the IDT itself; it produces an assembler source file full of data macros which then has to be assembled separately).

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Fri Apr 25, 2014 11:40 am 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1150
Location: Scotland
This thread would work better if it was called "funny comments you've found in someone else's OS's source code".

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Sat Apr 26, 2014 9:06 am 
Offline
Member
Member

Joined: Sat Mar 01, 2014 2:59 pm
Posts: 1146
The comments are in our source code, not other people's source code, so no that would not be a good idea.

Are you trolling us because I think we've copied and pasted?

_________________
When you start writing an OS you do the minimum possible to get the x86 processor in a usable state, then you try to get as far away from it as possible.

Syntax checkup:
Wrong: OS's, IRQ's, zero'ing
Right: OSes, IRQs, zeroing


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Sat Apr 26, 2014 9:37 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 4594
Location: Chichester, UK
I suspect that David means that if we were looking for funny comments in other people's code we might find some that were actually funny. If that's what he meant then I agree with him; it's always more pleasing to read about how funny other people can be than to read about how funny people imagine themselves to be.


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Sat Apr 26, 2014 1:02 pm 
Offline
Member
Member
User avatar

Joined: Wed Oct 27, 2010 4:53 pm
Posts: 1150
Location: Scotland
onlyonemac wrote:
Are you trolling us because I think we've copied and pasted?

Sorry if you thought that, but no: it never crossed my mind that anyone might have pinched them from anywhere else. I just think a relatively short thread with a high rate of funny comments in it would be better than a long thread with a low success rate. I'm not saying this thread's a dud one - I wouldn't keep looking at new posts in it if I thought there was no potential here at all - but it's a lot easier for outsiders to determine what's funny than the person who wrote any particular "funny" comment.

_________________
Help the people of Laos by liking - https://www.facebook.com/TheSBInitiative/?ref=py_c

MSB-OS: http://www.magicschoolbook.com/computing/os-project - direct machine code programming


Top
 Profile  
 
 Post subject: Re: Funny comments in your OS's Source code?
PostPosted: Mon Apr 28, 2014 2:32 am 
Offline
Member
Member

Joined: Tue Feb 26, 2008 10:47 am
Posts: 89
Location: Sweden
I agree with the above discussion, but thought I should share a bit on an anecdote around a piece of my own code anyway.

At university, we were supposed to include code dumps in reports for a certain course. Obviously, I never expected anyone to actually READ page after page of badly formated MATLAB code from more than 30 students every other week. But then one day it happened.

On the middle of a page, I got a small remark from the TA in red ink, next to the line:
Code:
epsilon = 1e-4; % Note to self: Do Not Ever Name A Variable eps !!! (Debugging time 4.5 hours)


The comment was: "Yeah... been there :("

In MATLAB, eps is the floating point accuracy indicator and is overwritten without warning. Messing with it messes with EVERYTHING.

_________________
Blawg


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 136 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:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group