Site hosted by Angelfire.com: Build your free website today!
; Wired'98 - Surprise Coding Competition ; Coded By CooL MiND Belgium ; 129 Bytes (25 bytes to go ...) ; The trouble is i'm not familiar with the 486 or Pentium opcodes :( ; The smallest isn't the fastest, i've learned that ; Runs on a 386, second version: 5 bytes gain Segment code assume CS:code org 100H P386 ;P486 begin: PUSH AX ; all normal regs are zero ; dl, cl is not zero ??? POP DS ; set segment to zero MOV CX,DS:[046CH] ; Get timer Counter (18.2 ticks/sec) MOV BH,0A0H ; BL=00H ; Video Segment MOV ES,BX ; ES=0A000H ;push 0A000H ; does the same but 386 ;pop es MOV AL,13H ; AH should be zero INT 10H ; Set in 320x200x256 Graphic mode Repeat: MOV DX,DS:[046CH] SUB DX,CX ; destination screen, was zero the first time :( MOV DI,4*8+32000+150 ; 32, any position ;MOV BL,5 ; displaying 5 digits ? Digit: XCHG AX,DX ; MOV AX,DX ; Load (old) value ;XOR DX,DX ; Needed for div, loop CWD MOV BP,10 ; 0AH, speed doesn't matter DIV BP ; Rest in DX, AX have to be saved ;BSWAP EDI XCHG DX,AX SHL AL,2 ; *4 SHL BX,1 SHL BX,1, mul 3.5=7/2 isn't easy XCHG SI,AX ; MOV SI,AX ;LODSD ; get 4 bytes/8 lines/32 pixels in EAX, SI=SI+4 ;MOV EBX,CS:[SI+BX] ; or SS: MOV ESI,dword ptr CS:[Font+si] MOV AH,7 ; counter line Row: MOV BH,4 ; pixels width Line: SHL ESI,1 ; shift through Carry flag ;JNC short Transp MOV AL,102 ; Color 66H ;JMP short done JC short done Transp: MOV AL,0 ; blank pixel, al was not zero done: STOSB ; one pixel, DI=DI+1 Dec BH JNZ short line ; SHL EAX,8 ; shift 256 color pixels ; STOSD ; Display 4 pixels ADD DI,320-4 ; 316 Dec AH JNZ Short Row ; ESI=0 SUB DI,320*7+4+4; ;DEC BL OR DX,DX JNZ Digit MOV AH,1H INT 16H ; Key pressed ? JZ short Repeat ;MOV AX,ds:[041AH] ; set start and end of keyboard buffer equal ;MOV ds:[041CH],AX ; complete erase buffer (up to 32 characters) MOV AX,3H ; 80x25 16 colors, ah is not zero :( INT 10H ;cbw ;MOV AH,0H ; only one character ... INT 16H ; space=20H=32 RET ; Return to caller/OS DB C3H Font: ; 4x7 pixels mono ; Total size=7*10/2=35 bytes + 5 bytes lost = 40 Bytes ; 0 DD 01101001100100001001100101100110B ; 4 bits lost, DB 66H ; 1 DD 00000001000100000001000100000000B ; 2 DD 01100001000101101000100001100000B ; 3 DD 01100001000101100001000101100000B ; 4 DD 00001001100101100001000100000000B ; 5 DD 01101000100001100001000101100000B ; 6 DD 01101000100001101001100101100000B ; 7 DD 01100001000100000001000100000000B ; 8 DD 01101001100101101001100101100000B ; 9 DD 01101001100101100001000101100000B EndS code end begin