ok this is my code
i don't know how to make it smaller....
so i gave up and now it's your turn if you wanna help me
the prog prints 'codeguru' on the screen in big letters....

;written by gil dabah
;thanks to uri yanover for helping
;compile with nasm - 40 bytes
;using rom char set.....

[bits 16]
[org 0x100]

; es = rom char set segment
push word 0xf000
pop es

; count from -8 to 0
mov bx, -8 ; char height

;count from 10 downto 0
mov si, 10

;count from 8 downto 0
mov cl, 8 ; char width

; read a byte from the string
movzx di, [si + start_msg - 1]
; multiple di by 8 so we point to the beginning of the character's bitmap
shl di, 3
; put bit number cx in carry, reads it from the rom char set + off, bx = y_char, cx = x_char
bt [es:di+bx+0xfa6e+8], cx
db 0xd6 ; setalc, if carry were set, al=-1 else al=0
dec ax ; so now we get 254(viewable) or 255(not viewable)
int 0x29 ; print what in al on the screen and move to next character
loop xloop ; scan width of the character

dec si
jnz strlen ; scan string

inc bx
jnz yloop ; scan height of the character

start_msg db ' uruGedoC'


Posted on 2002-05-24 14:33:13 by arkon
come on, anyone :)
Posted on 2002-05-25 03:00:25 by arkon
Dear arkon,

do you really think this an interesting problem? Will there be any benefits in speeding up this code?
Posted on 2002-05-25 03:40:50 by japheth
U might want to go to http://titiasm.cjb.net and download PeReb ( a great tool ).
Plus download UPX, the greatest exe packer i saw from http://upx.sourceforge.net
Posted on 2002-05-25 09:33:11 by ViperV`
i was trying to make it smaller not faster there's a big difference...

thanks anyways!
Posted on 2002-05-25 12:36:24 by arkon
If you can always use byte ptr or dword ptr instead of word ptr.
It saves you a prefix!

So instead of inc bx try inc ebx

Posted on 2002-05-25 13:00:33 by Axial
He's not coding 32 bit but 16 bit, I should think. Looks like real mode to me. So inc ebx, would waste a byte, exactly due to the prefix ;)

Posted on 2002-05-25 14:32:08 by Fake51
arkon, try the Hugi Compo Forum!

I get 49 bytes with FASM?
Posted on 2002-05-25 14:40:46 by bitRAKE
yeah i know,
because the string is there

btw-i made it 37 bytes right now! :)

and the code is in 16 bits, real mode

Posted on 2002-05-26 11:46:16 by arkon
I shaved off a couple bytes myself.
Do you pass the string on the command line?
I like size optimizing - just don't get much time to spend on it. :)

IDA gives a very nice view:
seg0:0100                start           proc near

seg0:100 6A A7 push 0FFA7h
seg0:102 07 pop es
seg0:103 assume es:nothing
seg0:103 BB F9 FF mov bx, 0FFF9h
seg0:106 loc_10106:
seg0:106 BE F6 FF mov si, 0FFF6h
seg0:109 loc_10109:
seg0:109 B1 08 mov cl, 8
seg0:10B 0F B6 BC 2F 01 movzx di, byte ptr [si+12Fh]
seg0:110 C1 E7 03 shl di, 3
seg0:113 loc_10113:
seg0:113 26 0F A3 49 05 bt es:[bx+di+5], cx
seg0:118 D6 setalc
seg0:119 48 dec ax
seg0:11A CD 29 int 29h ; DOS 2+ internal - FAST PUTCHAR
seg0:11A ; AL = character to display
seg0:11C E2 F5 loop loc_10113
seg0:11E 46 inc si
seg0:11F 75 E8 jnz loc_10109
seg0:121 43 inc bx
seg0:122 7E E2 jle loc_10106
seg0:124 C3 retn
seg0:124 start endp
seg0:124 ; ---------------------------------------------------------------------------
seg0:125 20 43 6F 64 65 aCodeguru db ' CodeGuru '
seg0:125 47 75 72 75 20
Posted on 2002-05-26 11:52:32 by bitRAKE
arkon :
from israel ?
are you doing it for www.codeguru.co.il
Posted on 2002-05-26 17:31:56 by eko
Here is another 37 byte solution:
; di = FFFE

; bx = 00xx

push 0FFA7h
pop es
inc di
mov bl,100h - 10
movzx cx, [bx - 74h]
shl cx,6
dec cx
bt [es:di], cx
dec ax ; aam 18 ; extra byte, but prettier!
int 029h
test cl,7
jne xbit
inc bl
js char
cmp di,4 ;5
jle yloop
...there are many variants of this size.
I think this can be optimized further.
C:\FASM\Projects\CodeGuru>CodeGuru ~CodeGuru~

( might be the best I can do? )

; BX = 00??
; CX = 00??
; SI = 01??

:100: 6A A7 push 0FFA7h
:102: 07 pop es
:103: B3 76 loc_103: mov bl, 76h
:105: B1 08 loc_105: mov cl, 8
:107: 0F B6 6F 0C movzx bp, byte ptr [bx+0Ch]
:10B: C1 E5 03 shl bp, 3
:10E: 26 0F A3 0B loc_10E: bt es:[bp+di], cx
:112: D6 setalc
:113: 48 dec ax
:114: CD 29 int 29h
:116: E2 F6 loop loc_10E
:118: FE C3 inc bl
:11A: 79 E9 jns loc_105
:11C: 47 inc di
:11D: D1 E6 shl si, 1
:11F: 73 E2 jnb loc_103
:121: C3 retn
I'll stop here. Average 2 bytes per instruction.
15% reduction in size from start.
Posted on 2002-05-26 21:27:49 by bitRAKE
nice idea with es and di....
i did something else
i was reading the value of es from the psp
mov es,

then it would load 0xf01d.....
Posted on 2002-05-27 12:41:38 by arkon