OSDev.org

The Place to Start for Operating System Developers
It is currently Sun May 28, 2017 10:05 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 71 posts ]  Go to page 1, 2, 3, 4, 5  Next

Which one is the best?
Poll ended at Sat May 30, 2009 8:37 am
Dex's mouse driver 39%  39%  [ 7 ]
Masterkiller's memory browser 11%  11%  [ 2 ]
Inflater's low level formatter 6%  6%  [ 1 ]
scgtrp's etch-a-sketch 11%  11%  [ 2 ]
salil's port access tool 0%  0%  [ 0 ]
Zenith's music/graphics demo 33%  33%  [ 6 ]
Total votes : 18
Author Message
 Post subject: The Third 512-byte OS Contest!
PostPosted: Mon May 11, 2009 7:43 pm 
Offline
Member
Member
User avatar

Joined: Fri Apr 18, 2008 4:40 pm
Posts: 1686
Location: Langley, Vancouver, BC, Canada
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

_________________
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


Last edited by Troy Martin on Mon Jun 01, 2009 8:42 am, edited 9 times in total.

Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Mon May 11, 2009 9:03 pm 
Offline
Member
Member

Joined: Thu Jul 07, 2005 11:00 pm
Posts: 1544
I hope he isn't drinking again rofl

_________________
My new NEW blag


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Mon May 11, 2009 9:51 pm 
Offline
Member
Member
User avatar

Joined: Fri Apr 18, 2008 4:40 pm
Posts: 1686
Location: Langley, Vancouver, BC, Canada
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


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Mon May 11, 2009 10:54 pm 
Offline
Member
Member
User avatar

Joined: Thu Dec 21, 2006 3:03 am
Posts: 1029
Location: Hobart, Australia
<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!

_________________
My Website | My Github Page


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Tue May 12, 2009 8:33 am 
Offline
Member
Member
User avatar

Joined: Fri Apr 18, 2008 4:40 pm
Posts: 1686
Location: Langley, Vancouver, BC, Canada
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


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Tue May 12, 2009 12:57 pm 
Offline
Member
Member
User avatar

Joined: Fri Jun 22, 2007 12:47 pm
Posts: 1597
Location: New Hampshire, USA
TM: what rules would need to change?

I'll probably enter if I have time. hmm.... SSE or C. =)

_________________
Website: https://Joscor.com


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Tue May 12, 2009 1:32 pm 
Offline

Joined: Sun Mar 01, 2009 7:57 pm
Posts: 7
Sounds awesome


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Tue May 12, 2009 4:28 pm 
Offline
Member
Member
User avatar

Joined: Fri Apr 18, 2008 4:40 pm
Posts: 1686
Location: Langley, Vancouver, BC, Canada
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


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Wed May 13, 2009 3:36 pm 
Offline
Member
Member
User avatar

Joined: Fri Jan 27, 2006 12:00 am
Posts: 1444
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:
;************************************
; 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.


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Thu May 14, 2009 5:30 am 
Offline
Member
Member
User avatar

Joined: Mon Feb 19, 2007 10:40 am
Posts: 261
Location: India
Dex: That seems like a cool driver. I think I will translate it to C and put it in my OS.. :D


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Thu May 14, 2009 8:14 am 
Offline
Member
Member

Joined: Fri Jun 10, 2005 11:00 pm
Posts: 116
Finally, a 512byte competition that I did not miss. I'm working on my entry right now!


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Thu May 14, 2009 8:33 am 
Offline
Member
Member
User avatar

Joined: Fri Apr 18, 2008 4:40 pm
Posts: 1686
Location: Langley, Vancouver, BC, Canada
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


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Thu May 14, 2009 11:45 am 
Offline
Member
Member
User avatar

Joined: Fri Jan 27, 2006 12:00 am
Posts: 1444
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.


Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Thu May 14, 2009 2:23 pm 
Offline
Member
Member
User avatar

Joined: Sat Feb 28, 2009 11:43 am
Posts: 80
I'm working on something...

_________________
Current work on a OS: SauOS (project homepage: http://code.google.com/p/sauos/)
Image


Last edited by imate900 on Thu May 14, 2009 6:30 pm, edited 2 times in total.

Top
 Profile  
 
 Post subject: Re: The Third 512-byte OS Contest!
PostPosted: Thu May 14, 2009 4:27 pm 
Offline
Member
Member
User avatar

Joined: Fri Apr 18, 2008 4:40 pm
Posts: 1686
Location: Langley, Vancouver, BC, Canada
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


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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