Funny comments in your OS's Source code?

All off topic discussions go here. Everything from the funny thing your cat did to your favorite tv shows. Non-programming computer questions are ok too.
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: Funny comments in your OS's Source code?

Post by Bender »

Code: Select all

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)
Gigasoft
Member
Member
Posts: 855
Joined: Sat Nov 21, 2009 5:11 pm

Re: Funny comments in your OS's Source code?

Post by Gigasoft »

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?
User avatar
VolTeK
Member
Member
Posts: 815
Joined: Sat Nov 15, 2008 2:37 pm
Location: The Fire Nation

Re: Funny comments in your OS's Source code?

Post by VolTeK »

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.
User avatar
Bender
Member
Member
Posts: 449
Joined: Wed Aug 21, 2013 3:53 am
Libera.chat IRC: bender|
Location: Asia, Singapore

Re: Funny comments in your OS's Source code?

Post by Bender »

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)
greyOne
Member
Member
Posts: 58
Joined: Sun Feb 03, 2013 10:38 pm
Location: Canada

Re: Funny comments in your OS's Source code?

Post by greyOne »

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).
ghost1227
Posts: 1
Joined: Sun Mar 23, 2014 1:26 am

Re: Funny comments in your OS's Source code?

Post by ghost1227 »

Got some real gems here! I recently launched a site called Inline Comedy to catalog just this type of humor... check it out!
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Funny comments in your OS's Source code?

Post by onlyonemac »

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:
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
User avatar
BASICFreak
Member
Member
Posts: 284
Joined: Fri Jan 16, 2009 8:34 pm
Location: Louisiana, USA

Re: Funny comments in your OS's Source code?

Post by BASICFreak »

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: Select all

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.
User avatar
max
Member
Member
Posts: 616
Joined: Mon Mar 05, 2012 11:23 am
Libera.chat IRC: maxdev
Location: Germany
Contact:

Re: Funny comments in your OS's Source code?

Post by max »

Haha, I've got one, too. This is my exception handler for everything except divide-by-zero, gpfs or page faults :D

Code: Select all

// 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;
}
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Funny comments in your OS's Source code?

Post by onlyonemac »

I've got the following block (or a variation of it) at the start of every software interrupt handler:
;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
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: Funny comments in your OS's Source code?

Post by DavidCooper »

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
onlyonemac
Member
Member
Posts: 1146
Joined: Sat Mar 01, 2014 2:59 pm

Re: Funny comments in your OS's Source code?

Post by onlyonemac »

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
User avatar
iansjack
Member
Member
Posts: 4685
Joined: Sat Mar 31, 2012 3:07 am
Location: Chichester, UK

Re: Funny comments in your OS's Source code?

Post by iansjack »

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.
User avatar
DavidCooper
Member
Member
Posts: 1150
Joined: Wed Oct 27, 2010 4:53 pm
Location: Scotland

Re: Funny comments in your OS's Source code?

Post by DavidCooper »

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
thomasloven
Member
Member
Posts: 89
Joined: Tue Feb 26, 2008 10:47 am
Location: Sweden

Re: Funny comments in your OS's Source code?

Post by thomasloven »

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: Select all

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.
Post Reply