OSDev.org https://forum.osdev.org/ |
|
The Third 512-byte OS Contest! https://forum.osdev.org/viewtopic.php?f=2&t=20006 |
Page 5 of 5 |
Author: | Masterkiller [ Mon Jun 01, 2009 4:42 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
Coddy wrote: well, when I disassembled it I got a total of 33 lines of ??? so I am guessing that meens it does not know It seems the code is 0xF5 (245) bytes. The rest are strings and probably the melody itself Quite impressive! P.S. He sets ES to 0, not using it as 0, then sets it to 0xB800 for video memory. Suppressing MOV ES, ax where ax=0 will free 2 more bytes Code: seg000:0000 ;
seg000:0000 ; ã=========================================================================¬ seg000:0000 ; ¦ This file is generated by The Interactive Disassembler (IDA) ¦ seg000:0000 ; ¦ Copyright (c) 2006 by DataRescue sa/nv, <[email protected]> ¦ seg000:0000 ; ¦ Licensed to: Freeware version ¦ seg000:0000 ; L=========================================================================- seg000:0000 ; seg000:0000 ; --------------------------------------------------------------------------- seg000:0000 ; File Name : C:\512OS\1.bin seg000:0000 ; Format : Binary file seg000:0000 ; Base Address: 0000h Range: 0000h - 0200h Loaded length: 0200h seg000:0000 seg000:0000 .686p seg000:0000 .mmx seg000:0000 .model flat seg000:0000 seg000:0000 ; =========================================================================== seg000:0000 seg000:0000 ; Segment type: Regular seg000:0000 seg000 segment byte public '' use16 seg000:0000 assume cs:seg000 seg000:0000 assume es:nothing, ss:nothing, ds:nothing, fs:nothing, gs:nothing seg000:0000 xor ax, ax seg000:0002 mov ds, ax seg000:0004 mov es, ax seg000:0006 mov ss, ax seg000:0008 mov sp, 7C00h seg000:000B mov di, 0FC00h seg000:000E stosd seg000:0010 mov ax, 0B800h seg000:0013 mov es, ax seg000:0015 assume es:nothing seg000:0015 mov ax, 3 seg000:0018 int 10h ; - VIDEO - SET VIDEO MODE seg000:0018 ; AL = mode seg000:001A inc ah seg000:001C mov cx, 2000h seg000:001F int 10h ; - VIDEO - SET CURSOR CHARACTERISTICS seg000:001F ; CH bits 0-4 = start line for cursor in character cell seg000:001F ; bits 5-6 = blink attribute seg000:001F ; CL bits 0-4 = end line for cursor in character cell seg000:0021 mov al, 0B6h ; '¦' seg000:0023 out 43h, al ; Timer 8253-5 (AT: 8254.2). seg000:0025 mov word ptr ds:0FC04h, 7D0Dh seg000:002B mov si, 7D26h seg000:002E xor edi, edi seg000:0031 jmp short loc_AF seg000:0033 ; --------------------------------------------------------------------------- seg000:0033 seg000:0033 loc_33: ; CODE XREF: seg000:00D1j seg000:0033 movzx edi, al seg000:0037 and al, 0Fh seg000:0039 and di, 0F0h seg000:003D shl al, 1 seg000:003F shr di, 3 ; DATA XREF: seg000:0018r seg000:003F ; seg000:001Fr seg000:0042 push edi seg000:0044 movzx bp, al seg000:0047 mov bx, [bp+7D16h] seg000:004B mov al, bl seg000:004D out 42h, al ; Timer 8253-5 (AT: 8254.2). seg000:004F mov al, bh seg000:0051 out 42h, al ; Timer 8253-5 (AT: 8254.2). seg000:0053 in al, 61h ; PC/XT PPI port B bits: seg000:0053 ; 0: Tmr 2 gate =T= OR 03H=spkr ON seg000:0053 ; 1: Tmr 2 data =- AND 0fcH=spkr OFF seg000:0053 ; 3: 1=read high switches seg000:0053 ; 4: 0=enable RAM parity checking seg000:0053 ; 5: 0=enable I/O channel check seg000:0053 ; 6: 0=hold keyboard clock low seg000:0053 ; 7: 0=enable kbrd seg000:0055 or al, 3 seg000:0057 out 61h, al ; PC/XT PPI port B bits: seg000:0057 ; 0: Tmr 2 gate =T= OR 03H=spkr ON seg000:0057 ; 1: Tmr 2 data =- AND 0fcH=spkr OFF seg000:0057 ; 3: 1=read high switches seg000:0057 ; 4: 0=enable RAM parity checking seg000:0057 ; 5: 0=enable I/O channel check seg000:0057 ; 6: 0=hold keyboard clock low seg000:0057 ; 7: 0=enable kbrd seg000:0059 xor di, di seg000:005B mov cx, 7D0h seg000:005E mov ax, 0F20h seg000:0061 rep stosw seg000:0063 mov ax, bp seg000:0065 mov bl, 0Ah seg000:0067 mul bl ; DATA XREF: seg000:00B2r seg000:0069 mov di, ax seg000:006B mov ax, bp seg000:006D shl ax, 0Bh seg000:0070 add ah, 20h ; ' ' seg000:0073 mov al, 20h ; ' ' seg000:0075 mov cx, 19h seg000:0078 seg000:0078 loc_78: ; CODE XREF: seg000:0083j seg000:0078 pusha seg000:0079 mov cx, 0Ah seg000:007C rep stosw seg000:007E popa seg000:007F add di, 0A0h ; 'à' seg000:0083 loop loc_78 seg000:0085 pusha seg000:0086 mov si, 7CF6h seg000:0089 mov di, 7BAh seg000:008C call sub_E8 seg000:008F mov si, ds:0FC04h seg000:0093 mov di, 95Ah seg000:0096 lodsb seg000:0097 xor ah, ah seg000:0099 add di, ax seg000:009B push si seg000:009C mov si, 7D09h seg000:009F call sub_E8 seg000:00A2 pop si seg000:00A3 call sub_E8 seg000:00A6 mov si, 7D09h seg000:00A9 call sub_E8 seg000:00AC popa seg000:00AD pop edi seg000:00AF seg000:00AF loc_AF: ; CODE XREF: seg000:0031j seg000:00AF ; seg000:00C7j seg000:00AF xor eax, eax seg000:00B2 int 1Ah ; CLOCK - GET TIME OF DAY seg000:00B2 ; Return: CX:DX = clock count seg000:00B2 ; AL = 00h if clock was read or written (via AH=0,1) since the previous seg000:00B2 ; midnight seg000:00B2 ; Otherwise, AL > 0 seg000:00B4 mov ax, cx seg000:00B6 shl eax, 10h seg000:00BA mov ax, dx seg000:00BC mov ebx, eax seg000:00BF sub eax, ds:0FC00h seg000:00C4 cmp eax, edi seg000:00C7 jl short loc_AF seg000:00C9 mov ds:0FC00h, ebx seg000:00CE seg000:00CE loc_CE: ; CODE XREF: seg000:00E1j seg000:00CE ; seg000:00E6j seg000:00CE lodsb seg000:00CF or al, al seg000:00D1 jnz loc_33 seg000:00D5 mov ds:0FC04h, si seg000:00D9 lodsb seg000:00DA or al, al seg000:00DC jz short loc_E3 seg000:00DE call sub_E8 seg000:00E1 jmp short loc_CE seg000:00E3 ; --------------------------------------------------------------------------- seg000:00E3 seg000:00E3 loc_E3: ; CODE XREF: seg000:00DCj seg000:00E3 mov si, 7D35h seg000:00E6 jmp short loc_CE seg000:00E8 seg000:00E8 ; --------------- S U B R O U T I N E --------------------------------------- seg000:00E8 seg000:00E8 seg000:00E8 sub_E8 proc near ; CODE XREF: seg000:008Cp seg000:00E8 ; seg000:009Fp ... seg000:00E8 lodsb seg000:00E9 or al, al seg000:00EB jz short locret_F5 seg000:00ED stosb seg000:00EE or byte ptr es:[di], 0Fh seg000:00F2 inc di seg000:00F3 jmp short sub_E8 seg000:00F5 ; --------------------------------------------------------------------------- seg000:00F5 seg000:00F5 locret_F5: ; CODE XREF: sub_E8+3j seg000:00F5 retn seg000:00F5 sub_E8 endp seg000:00F5 seg000:00F5 ; --------------------------------------------------------------------------- seg000:00F6 aYouGotRickroll db 'You Got Rickroll',27h,'d',0 seg000:0109 dd 200E20h seg000:010D aDIntro db 'D(Intro)',0 seg000:0116 db 0E3h ; ó seg000:0117 db 0Bh seg000:0118 db 97h ; × seg000:0119 db 0Ah seg000:011A db 6Fh ; o seg000:011B db 9 seg000:011C db 0E9h ; ù seg000:011D db 8 seg000:011E db 0F0h ; ¨ seg000:011F db 7 seg000:0120 db 12h seg000:0121 db 7 seg000:0122 db 0ADh ; í seg000:0123 db 6 seg000:0124 db 0F1h ; ¸ seg000:0125 db 5 seg000:0126 db 83h ; Ã seg000:0127 db 84h ; Ä seg000:0128 db 60h ; ` seg000:0129 db 84h ; Ä seg000:012A db 85h ; Å seg000:012B db 17h seg000:012C db 16h seg000:012D db 15h seg000:012E db 14h seg000:012F db 83h ; Ã seg000:0130 db 84h ; Ä seg000:0131 db 60h ; ` seg000:0132 db 35h ; 5 seg000:0133 db 37h ; 7 seg000:0134 db 85h ; Å seg000:0135 db 0 seg000:0136 db 32h ; 2 seg000:0137 aWeReNoStranger db 'We',27h,'re no strangers to love',0 seg000:0152 db 31h ; 1 seg000:0153 db 32h ; 2 seg000:0154 db 33h ; 3 seg000:0155 db 33h ; 3 seg000:0156 db 34h ; 4 seg000:0157 db 62h ; b seg000:0158 db 61h ; a seg000:0159 db 0F0h ; ¨ seg000:015A db 0 seg000:015B ; a___Verse_ seg000:015B a___Verse___ db '>...(Verse)...',0 seg000:016A db 31h ; 1 seg000:016B db 31h ; 1 seg000:016C db 32h ; 2 seg000:016D db 93h ; Ó seg000:016E db 30h ; 0 seg000:016F db 67h ; g seg000:0170 db 37h ; 7 seg000:0171 db 0F4h ; ¯ seg000:0172 db 31h ; 1 seg000:0173 db 31h ; 1 seg000:0174 db 32h ; 2 seg000:0175 db 33h ; 3 seg000:0176 db 31h ; 1 seg000:0177 db 33h ; 3 seg000:0178 db 64h ; d seg000:0179 db 32h ; 2 seg000:017A db 31h ; 1 seg000:017B db 0F0h ; ¨ seg000:017C db 31h ; 1 seg000:017D db 31h ; 1 seg000:017E db 32h ; 2 seg000:017F db 33h ; 3 seg000:0180 db 31h ; 1 seg000:0181 db 60h ; ` seg000:0182 db 34h ; 4 seg000:0183 db 34h ; 4 seg000:0184 db 34h ; 4 seg000:0185 db 35h ; 5 seg000:0186 db 0F4h ; ¯ seg000:0187 db 0E3h ; ó seg000:0188 db 34h ; 4 seg000:0189 db 35h ; 5 seg000:018A db 33h ; 3 seg000:018B db 34h ; 4 seg000:018C db 34h ; 4 seg000:018D db 34h ; 4 seg000:018E db 35h ; 5 seg000:018F db 64h ; d seg000:0190 db 0F0h ; ¨ seg000:0191 db 31h ; 1 seg000:0192 db 32h ; 2 seg000:0193 db 33h ; 3 seg000:0194 db 61h ; a seg000:0195 db 34h ; 4 seg000:0196 db 35h ; 5 seg000:0197 db 94h ; Ô seg000:0198 db 0 seg000:0199 db 34h ; 4 seg000:019A aNeverGonnaGive db 'Never gonna give you up',0 seg000:01B2 db 10h seg000:01B3 db 11h seg000:01B4 db 13h seg000:01B5 db 11h seg000:01B6 db 45h ; E seg000:01B7 db 45h ; E seg000:01B8 db 94h ; Ô seg000:01B9 db 0 seg000:01BA ; a___Chorus_ seg000:01BA a___Chorus___ db '>...(Chorus)...',0 seg000:01CA db 10h seg000:01CB db 11h seg000:01CC db 13h seg000:01CD db 11h seg000:01CE db 44h ; D seg000:01CF db 44h ; D seg000:01D0 db 93h ; Ó seg000:01D1 db 10h seg000:01D2 db 11h seg000:01D3 db 13h seg000:01D4 db 11h seg000:01D5 db 63h ; c seg000:01D6 db 34h ; 4 seg000:01D7 db 62h ; b seg000:01D8 db 60h ; ` seg000:01D9 db 30h ; 0 seg000:01DA db 64h ; d seg000:01DB db 0C3h ; + seg000:01DC db 10h seg000:01DD db 11h seg000:01DE db 13h seg000:01DF db 11h seg000:01E0 db 65h ; e seg000:01E1 db 35h ; 5 seg000:01E2 db 94h ; Ô seg000:01E3 db 10h seg000:01E4 db 11h seg000:01E5 db 13h seg000:01E6 db 11h seg000:01E7 db 67h ; g seg000:01E8 db 32h ; 2 seg000:01E9 db 93h ; Ó seg000:01EA db 10h seg000:01EB db 11h seg000:01EC db 13h seg000:01ED db 11h seg000:01EE db 63h ; c seg000:01EF db 34h ; 4 seg000:01F0 db 0C2h ; T seg000:01F1 db 31h ; 1 seg000:01F2 db 30h ; 0 seg000:01F3 db 64h ; d seg000:01F4 db 0F3h ; º seg000:01F5 db 0 seg000:01F6 db 0 seg000:01F7 db 0 seg000:01F8 db 0 seg000:01F9 db 0 seg000:01FA db 0 seg000:01FB db 0 seg000:01FC db 0 seg000:01FD db 0 seg000:01FE dw 0AA55h seg000:01FE seg000 ends seg000:01FE seg000:01FE seg000:01FE end |
Author: | Coty [ Mon Jun 01, 2009 5:04 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
hmm... something tells me I need to get a new disassembler... here is what I got on the first 20 lines when I disassembled it: Code: skeq v1,C0 ??? mov v14,v12 jmi C00 add v12,BF scdown 14 mov v6,AB jmi 88E rand v0,0B8 scdown 0 rand v13,D10 ??? jmi 900 jsr 0CD jmp 0B0 jmi 6E6 skne v3,C7 scdown 4 add v14,D Messed up huh? @Zenith: thanks, now my collection is complete |
Author: | Zenith [ Mon Jun 01, 2009 5:08 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
Masterkiller wrote: It seems the code is 0xF5 (245) bytes. The rest are strings and probably the melody itself Quite impressive! P.S. He sets ES to 0, not using it as 0, then sets it to 0xB800 for video memory. Suppressing MOV ES, ax where ax=0 will free 2 more bytes Well actually, setting ES to 0 allows me to use stosd instead of something like mov dword [0x00:0xFC00], 0. (Oh well, I'll check which method takes up less space sometime). And in case you missed it, I posted the code for my demo right before you posted your disassembly . @Coddy: Whoa! I think you've got a disassembler for a completely different architecture there. (Did some research and it seems to be output for CHIP-8 VM opcodes - back in the good old days... See here and here.) |
Author: | Coty [ Mon Jun 01, 2009 5:20 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
sweet, its pong time beep........beep....beep.beep......beep.....beeeep woo! I lost I thought that site looked old |
Author: | Troy Martin [ Mon Jun 01, 2009 8:17 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
Coddy wrote: hmm... something tells me I need to get a new disassembler... here is what I got on the first 20 lines when I disassembled it: Code: <snip> Messed up huh? @Zenith: thanks, now my collection is complete ... that's not an x86 disassembler... what the hell program is that? EDIT: thanks Zenith. |
Author: | Dex [ Tue Jun 02, 2009 4:46 am ] |
Post subject: | Re: The Third 512-byte OS Contest! |
Nice code Zenith, you had my vote. Coddy you can add this "AI pong" to your collection, its only 265 byte. Code: ; small AI game demo, compile with fasm. ; Original written by Luks, for nasm. ; c:\fasm game.asm game.com org 0x100 use16 START: mov al,0x13 int 0x10 MAIN: push word 0x8000 pop es push cs pop ds mov cx,0xFFFF mov al,0 rep stosb mov si,BALLYI call PutLine mov bx,[si-6] mov dx,[si-4] cmp dx,195 jb CMPY jmp NEGY CMPY: cmp dx,1 jg ADDY NEGY: neg word[si] ADDY: add dx,[si] dec si dec si cmp bx,310 jb CMPX jmp NEGX CMPX: cmp bx,6 jg ADDX NEGX: neg word[si] ADDX: add bx,[si] sub si,8 mov di,dx imul di,320 add di,bx mov cl,4 BALL: mov [es:di], dword 0x0f0f0f0f add di,320 loop BALL mov [si+4],bx mov [si+6],dx ; PADS mov bp,si cmp [si+9],byte 0 je PAD2 PAD1: call PADCHK jmp PADS PAD2: add bp,2 call PADCHK PADS: mov ax,[si] mov di,2 call DRAWPAD mov ax,[si+2] mov di,314 call DRAWPAD push es pop ds push word 0xA000 pop es mov cx,32000 xor si,si mov di,si rep movsw mov ah,0x11 int 0x16 jz MAIN mov ax,0x0003 int 0x10 DRAWPAD: imul ax,320 add di,ax mov cx,16 PAD: mov [es:di], dword 0x0f0f0f0f add di,320 loop PAD ret PADCHK: cmp dx,[bp] jge PADDOWN dec word [bp] jmp ENDCHK PADDOWN: sub dx,12 cmp dx,[bp] jbe ENDCHK inc word [bp] ENDCHK: ret PutLine: mov al,15 mov di,158 mov cl,198 @@: add di,319 stosb loop @b xor di,di call Hline xor dx,dx xor di,di mov cl,199 Gridlp3: stosb add di,318 stosb loop Gridlp3 call Hline ret Hline: mov al,15 mov cx,320 rep stosb ret PAD1Y dw 100 PAD2Y dw 100 BALLX dw 160 BALLY dw 100 BALLXI dw -1 BALLYI dw -1 I did not write it, i just converted it. |
Author: | Coty [ Tue Jun 02, 2009 6:49 am ] |
Post subject: | Re: The Third 512-byte OS Contest! |
that cool, hmm... It gives me an inspiration for...... bootible pong |
Author: | a427 [ Mon Jun 29, 2009 5:22 am ] |
Post subject: | Re: The Third 512-byte OS Contest! |
Any chances to see a fourth 512-byte asm compo organized ? (I managed to successfully miss the first three editions, and hence still have got a potential entry ready and waiting.. grumble..) |
Author: | earlz [ Mon Jun 29, 2009 9:11 am ] |
Post subject: | Re: The Third 512-byte OS Contest! |
What? I missed it again? |
Author: | Troy Martin [ Mon Jun 29, 2009 9:46 am ] |
Post subject: | Re: The Third 512-byte OS Contest! |
We're still "discussing" the next one in some other thread somewhere. Not sure when it will pop into existence though. EDIT: spelling fail. |
Author: | Coty [ Tue Jun 30, 2009 3:54 pm ] |
Post subject: | Re: The Third 512-byte OS Contest! |
I can't wait, maybe I can finely get a fourth folder on my site directory |
Page 5 of 5 | All times are UTC - 6 hours |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |