The Third 512-byte OS Contest!

This forums is for OS project announcements including project openings, new releases, update notices, test requests, and job openings (both paying and volunteer).

Which one is the best?

Poll ended at Sat May 30, 2009 8:37 am

Dex's mouse driver
7
39%
Masterkiller's memory browser
2
11%
Inflater's low level formatter
1
6%
scgtrp's etch-a-sketch
2
11%
salil's port access tool
0
No votes
Zenith's music/graphics demo
6
33%
 
Total votes: 18

User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

The Third 512-byte OS Contest!

Post by Troy Martin »

Welcome to the third 512-byte operating system creation competition!
Congratz to Dex, the winner of the third 512-byte OS contest!!

The rules are similar to that of last time:
  • Entries must be in by Monday, May 25th, 2009 at midnight PST (GMT-8.) This means you have two weeks to get your OS in!
  • Winner is decided by public vote, polls close Saturday, May 30th and winners are decided.
  • Must be your own code
  • MUST fit in 512 bytes (including 0x55 0xAA)
  • You don't need to keep the previous filesystem and BPB intact
  • Must have some kind of interface or demo something difficult to code in 512 bytes
  • Usage of -Ox or similar optimization flags allowed but must be shown in readme and/or source code.
Entries: Former OS contests:
  1. http://board.flatassembler.net/topic.php?t=2164
  2. http://forum.osdev.org/viewtopic.php?f=2&t=18763
Last edited by Troy Martin on Mon Jun 01, 2009 8:42 am, edited 9 times in total.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: The Third 512-byte OS Contest!

Post by earlz »

I hope he isn't drinking again rofl
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: The Third 512-byte OS Contest!

Post by Troy Martin »

Who, you? Cause you sure sound kinda hammered.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
JackScott
Member
Member
Posts: 1031
Joined: Thu Dec 21, 2006 3:03 am
Location: Hobart, Australia
Contact:

Re: The Third 512-byte OS Contest!

Post by JackScott »

<mod mode="preemptive">Keep it clean guys, 512-byte OSs are serious business.</mod>

I won't be entering, as I have exams and so on, but I look forward to seeing the material produced. All the OSs from the last competition were really good (for 512 bytes, at least). Let's hope there are still some good ideas left!
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: The Third 512-byte OS Contest!

Post by Troy Martin »

I'm not sure if I will be able to enter, but it depends on if someone changes either A) my teacher or B) the rules. Or both.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
01000101
Member
Member
Posts: 1599
Joined: Fri Jun 22, 2007 12:47 pm
Contact:

Re: The Third 512-byte OS Contest!

Post by 01000101 »

TM: what rules would need to change?

I'll probably enter if I have time. hmm.... SSE or C. =)
Sly
Posts: 7
Joined: Sun Mar 01, 2009 7:57 pm

Re: The Third 512-byte OS Contest!

Post by Sly »

Sounds awesome
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: The Third 512-byte OS Contest!

Post by Troy Martin »

01000101 wrote:TM: what rules would need to change?
Well, I mainly just added the optimization rule, as well as "Must have some kind of interface or demo something difficult to code in 512 bytes" (such as SSE or C :D)
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Re: The Third 512-byte OS Contest!

Post by Dex »

Ok just to get things started, here is my entry
http://dex4u.com/Compo/Bmouse.zip
Its a Mouse driver in less than 512b, it work with upto 3 buttons

Code: Select all

;************************************
; By Dex
; Entry for the 512b compo.
;
; Assemble with fasm 
; c:\fasm MouseB.asm MouseB.bin
;
; Use partcopy and the installM.bat
; or rawrite to put it on the
; boot sector of floppy.
;
; Once rebooted move mouse and press
; any one of the 3 buttons to print
; B in the top corner.
;
; Code is freeware
;************************************
org 0x7C00
use16
;====================================================;
; Start.                                             ;
;====================================================;
start:
;====================================================;
; Set the stack etc                                  ;
;====================================================;
	xor   ax,ax
	mov   ds,ax
	mov   ss,ax
	mov   sp,0x7C00
	push  0xb800
	pop   es
	cli
;====================================================;
; Hook into isr.                                     ;
;====================================================;
	mov   WORD[ds:74h*4+0],Mouse_isr
	mov   WORD[ds:74h*4+2],cs
;====================================================;
; Set mouse up.                                      ;
;====================================================;
	mov   bl,0xa8
	call  KeyboardCommand
	call  KeyboardRead
	mov   bl,0x20
	call  KeyboardCommand
	call  KeyboardRead
	or    al,3
	mov   bl,0x60
	push  ax
	call  KeyboardCommand
	pop   ax
	call  KeyboardWrite
	mov   bl,0xd4
	call  KeyboardCommand
	mov   al,0f4h
	call  KeyboardWrite
	call  KeyboardRead
	mov   bl,0a7h				
	call  KeyboardCommand
	;SetMouseOn
	mov   bl,0a8h
	call  KeyboardCommand
	sti
;====================================================;
;  Clear screen.                                     ;
;====================================================;
	mov   ax,0x0600
	mov   bh,0x07
	mov   cx,0x0000
	mov   dx,0x184f
	int   10h
;====================================================;
; Simulate int.                                      ;
;====================================================;
	int   74h
;====================================================;
; Main loop.                                         ;
;====================================================;
	jmp   $

;====================================================;
; KeyboardRead.                                      ;
;====================================================;
KeyboardRead:
	mov   cx,0xffff
KeyReadLoop:
	in    al,0x64
	test  al,1
	jnz   KeyReadReady
	loop  KeyReadLoop
	mov   ah,1
	jmp   KeyReadExit
KeyReadReady:
	mov   cx,32
KeyReadDelay:
	loop  KeyReadDelay
	in    al,0x60
	xor   ah,ah
KeyReadExit:
	ret

;====================================================;
; keyboardWrite.                                     ;
;====================================================;
KeyboardWrite:
	mov   dl,al
	mov   ch,0xff
KbdWaitLoop1:
	in    al,0x64
	test  al,0x20
	jz    KbdWaitOk1
	loop  KbdWaitLoop1
	mov   ah,1
	jmp   KbdWaitExit
KbdWaitOk1:
	in    al,0x60
KbdWaitLoop:
	in    al,0x64
	test  al,2
	jz    KbdWriteOk
	jmp  KbdWaitLoop
KbdWriteOk:
	mov   al,dl
	out   0x60,al
	mov   ch,0xff
KbdWaitLoop3:
	in    al,64h
	test  al,2
	jz    KbdWriteOk3
	loop  KbdWaitLoop3
	mov   ah,1
	ret
KbdWriteOk3:
KbdWaitLoop4:
	mov   ch,0xff
KbdWaitLoop5:
	in    al,64h
	test  al,1
	jnz   KbdWriteOk4
	loop  KbdWaitLoop5
KbdWriteOk4:
KbdWaitExit:
	ret

;====================================================;
; KeyboardCommand.                                   ;
;====================================================;
KeyboardCommand:
	mov   ch,0xff
CommandWait:
	in    al,64h
	test  al,2
	jz    CommandSend
	loop  CommandWait
	jmp   CommandError
CommandSend:
	mov   al,bl
	out   64h,al
	mov   ch,0xff
CommandAccept:
	in    al,0x64
	test  al,2
	jz    CommandOk
	loop  CommandAccept
CommandError:
	mov   ah,1
	jmp   CommandExit
CommandOk:
CommandExit:
	ret

 ;----------------------------------------------------;
 ; Mouse ISR                                          ;
 ;----------------------------------------------------;
Mouse_isr:
	push  cs
	pop   ds
	mov   byte[es:0000],' '
	mov   bl,0xad
	call  KeyboardCommand
	xor   di,di
	mov   cx,3
PS2MouseISR_ReadPacket: 
	push  cx
	call  KeyboardRead
	pop   cx
	or    ah,ah
	jnz   PS2MouseISR_ExitReadPacket
	mov   byte[ds:buffer+di],al
	inc   di
	loop  PS2MouseISR_ReadPacket
PS2MouseISR_ExitReadPacket:
	mov   al,[ds:buffer]
	and   al,7h
	mov   ah,al
	and   ah,1
	shl   ah,2
	mov   bl,al
	and   bl,6
	shr   bl,1
	or    ah,bl
	mov   al,[buttons]
	mov   [buttons],ah
	xor   ah,al
	shl   ah,1
	or    [eventmsk],ah	
	mov   al,[ds:buffer+1]
	mov   ah,[ds:buffer]
	and   ah,10h
	shr   ah,4
	neg   ah
	add   [current_x],ax	
	or    ax,ax
	setnz bl
	or    [eventmsk],bl
	mov   al,[ds:buffer+2]
	mov   ah,[ds:buffer]
	and   ah,0x20
	shr   ah,5
	neg   ah
	neg   ax
	add   [current_y], ax	
	or    ax,ax
	setnz bl
	or    [eventmsk],bl
 ;----------------------------------------------------;
 ; check boundaries                                   ;
 ;----------------------------------------------------;
	mov   dx,[current_x]
	cmp   dx,[min_x]
	jnl   PS2MouseISR_CheckMaxX
	mov   dx,[min_x]
	jmp   PS2MouseISR_StoreNewX
PS2MouseISR_CheckMaxX:
	cmp   dx,[max_x]
	jl    PS2MouseISR_StoreNewX
	mov   dx,[max_x]
PS2MouseISR_StoreNewX:
	mov   [current_x],dx
	mov   dx,[current_y]
	cmp   dx,[min_y]
	jnl   PS2MouseISR_CheckMaxY
	mov   dx,[min_y]
	jmp   PS2MouseISR_StoreNewY
PS2MouseISR_CheckMaxY:
	cmp   dx,[max_y]
	jl    PS2MouseISR_StoreNewY
	mov   dx,[max_y]
PS2MouseISR_StoreNewY:
	mov   [current_y],dx
	call  PutMousePointer
@@:
	mov   al,[buttons]
	cmp   al,0
	je    NoButton
	mov   byte[es:0000],'B'
NoButton:   
	mov   bl,0aeh
	call  KeyboardCommand
	mov   al, 0x20
	out   0xa0, al
	out   0x20,al
	iret

 ;----------------------------------------------------;
 ; PutMousePointer                                    ;
 ;----------------------------------------------------;
PutMousePointer:
	mov   bx,[current_x1]
	shl   bx,1
	mov   di, bx
	mov   bx,[current_y1]
	mov   ax,0xa0
	mul   bx
	add   di,ax
	mov   ax,[SaveChar]
	mov   [es:di],ax      
	mov   bx,[current_x]
	shl   bx,1
	mov   di, bx
	mov   bx,[current_y]
	mov   ax,0xa0
	mul   bx
	add   di,ax
	mov   ax,word[es:di]
	mov   [SaveChar],ax
	not   ah
	xor   ah,0x80
	mov   [es:di],ax		    
	mov   ax,[current_x]
	mov   [current_x1],ax
	mov   ax,[current_y]
	mov   [current_y1],ax
	ret

;====================================================;
; Data.                                              ;
;====================================================;
min_x		dw	0
max_x		dw	79
min_y		dw	0 
max_y		dw	24
eventmsk	db	0
current_x	dw	40
current_y	dw	12
current_x1	dw	40  
current_y1	dw	12
;====================================================;
;  Make program 510 byte's + 0xaa55                  ;
;====================================================;
times 510- ($-start)  db 0
dw 0xaa55
;====================================================;
; Put uninitialized data here.                       ;
;====================================================;
MouseShow	rb	1
SaveChar	rw	1
buttons 	rb	1
buffer		rb	10
Good luck everyone.
User avatar
salil_bhagurkar
Member
Member
Posts: 261
Joined: Mon Feb 19, 2007 10:40 am
Location: India

Re: The Third 512-byte OS Contest!

Post by salil_bhagurkar »

Dex: That seems like a cool driver. I think I will translate it to C and put it in my OS.. :D
Osbios
Member
Member
Posts: 116
Joined: Fri Jun 10, 2005 11:00 pm

Re: The Third 512-byte OS Contest!

Post by Osbios »

Finally, a 512byte competition that I did not miss. I'm working on my entry right now!
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: The Third 512-byte OS Contest!

Post by Troy Martin »

Woo!
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Re: The Third 512-byte OS Contest!

Post by Dex »

salil_bhagurkar wrote:Dex: That seems like a cool driver. I think I will translate it to C and put it in my OS.. :D
Cool, let me know if you want a link to the unoptimized ( for size ) ver about 1k, as i had to do some tricks to get it to fit in 510 bytes.
User avatar
imate900
Member
Member
Posts: 80
Joined: Sat Feb 28, 2009 11:43 am

Re: The Third 512-byte OS Contest!

Post by imate900 »

I'm working on something...
Last edited by imate900 on Thu May 14, 2009 6:30 pm, edited 2 times in total.
Current work on a OS: SauOS (project homepage: http://code.google.com/p/sauos/)
Image
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: The Third 512-byte OS Contest!

Post by Troy Martin »

I'm working on an animated series called Got BSOD (oh wait, that's not really relevant xD)

I don't know if I'll enter this time around.
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
Post Reply