OSDev.org https://forum.osdev.org/ |
|
The Third 512-byte OS Contest! https://forum.osdev.org/viewtopic.php?f=2&t=20006 |
Page 1 of 5 |
Author: | Troy Martin [ Mon May 11, 2009 7:43 pm ] |
Post subject: | The Third 512-byte OS Contest! |
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:
Former OS contests: |
Author: | earlz [ Mon May 11, 2009 9:03 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
I hope he isn't drinking again rofl |
Author: | Troy Martin [ Mon May 11, 2009 9:51 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
Who, you? Cause you sure sound kinda hammered. |
Author: | JackScott [ Mon May 11, 2009 10:54 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
<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! |
Author: | Troy Martin [ Tue May 12, 2009 8:33 am ] |
Post subject: | Re: The Third 512-byte OS Contest! |
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. |
Author: | 01000101 [ Tue May 12, 2009 12:57 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
TM: what rules would need to change? I'll probably enter if I have time. hmm.... SSE or C. =) |
Author: | Sly [ Tue May 12, 2009 1:32 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
Sounds awesome |
Author: | Troy Martin [ Tue May 12, 2009 4:28 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
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 ) |
Author: | Dex [ Wed May 13, 2009 3:36 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
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. |
Author: | salil_bhagurkar [ Thu May 14, 2009 5:30 am ] |
Post subject: | Re: The Third 512-byte OS Contest! |
Dex: That seems like a cool driver. I think I will translate it to C and put it in my OS.. |
Author: | Osbios [ Thu May 14, 2009 8:14 am ] |
Post subject: | Re: The Third 512-byte OS Contest! |
Finally, a 512byte competition that I did not miss. I'm working on my entry right now! |
Author: | Troy Martin [ Thu May 14, 2009 8:33 am ] |
Post subject: | Re: The Third 512-byte OS Contest! |
Woo! |
Author: | Dex [ Thu May 14, 2009 11:45 am ] |
Post subject: | Re: The Third 512-byte OS Contest! |
salil_bhagurkar wrote: Dex: That seems like a cool driver. I think I will translate it to C and put it in my OS.. 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. |
Author: | imate900 [ Thu May 14, 2009 2:23 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
I'm working on something... |
Author: | Troy Martin [ Thu May 14, 2009 4:27 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
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. |
Page 1 of 5 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |