flat assembler
Message board for the users of flat assembler.
Index
> DOS > Can this be optimized any further? |
Author |
|
eek 09 Apr 2007, 00:15
Very impressive.
I replaced ret with mov ax,4C int 21 because it blew my computer up when I tried to exit. 41 bytes ALT-ENTER cycles it in from Window to fullscreen. Many bytes are boilerplate once you get to this level, like with HELLOWORLD at 16 to 25 bytes. |
|||
09 Apr 2007, 00:15 |
|
eek 09 Apr 2007, 00:27
The video superiority of DOS compared to WINDOWS is phenomenal.
|
|||
09 Apr 2007, 00:27 |
|
rain_storm 09 Apr 2007, 02:31
you can shave two more byte off it by removing dec cx altogether since the CPU will decrease it at the loop before checking for zero. and the second byte can be earned by replacing mov ax,03 with mov al,03 since ah is already garaunteed to be zero that will bring it down to 29b
very good optimisations what I found impressive for a 32b was the fact that you not only included an exit but also went that little bit further and exited cleanly in text mode edit - I just noticed you have mov ax,13h if you replace that with mov al,13h you get 28b |
|||
09 Apr 2007, 02:31 |
|
JMGK 09 Apr 2007, 14:24
hi,
you can terminate the program with a INT 20h altought is 1 byte bigger than the RET, is garanteed to work, and is 2 bytes shorter than MOV AH,4C/INT 21h jmgk |
|||
09 Apr 2007, 14:24 |
|
Hayden 09 Apr 2007, 17:48
hardware i/o is way too slow over 65535 irritations. try this instead
Code: ;Created April 5,2007 by windwakr ;assembled size is 31 bytes org 100h ;make it a .com program ; - modified by me - hayden mckay ; les si,[bx] ;small way to put 0a000h into es mov ax,13h ;video mode int 10h ;video mode push word 0A000h push word 00040h pop ds pop es mov si, 006Ch xor di, di main: ; in ax,40h ;random number (i think its counter on clock?) ; try each of theese ; lodsw ; looks way too fast ( need a wait retrace for this one ) lodsb ; looks ok ; mod ends... hayden mckay add di,ax ;without this the static looks like crap and al,0fh ;make color greyscale add al,10h ;same as above stosb ;write color to screen loop main ;loop 65535 times keycheck: dec cx ;easy way to make cx ffffh when it is at 0.... in ax,60h ;get key dec al ;decrease it jnz main ;if it is not zero jump to main mov ax,03h ;text mode int 10h ;text mode ret ;clean exit int 20h off topic someone pointed out to use mov al, 13h. I think you should stick to mov ax, 13h as it guard against some bios bugs. also you should always initiate required registers instead of putting trust into command.com to preset registers for you. _________________ New User.. Hayden McKay. |
|||
09 Apr 2007, 17:48 |
|
rain_storm 09 Apr 2007, 19:41
Quote: les si,[bx] ;small way to put 0a000h into es Quote:
this implies that windwakr is optimisng for size not performance my guese is that this is a 32byte demo in which every byte that can be shaved off is a blessing and hard won. what makes mov al,13h unstable? ax has not been touched prior to setting the video mode so it is still zero |
|||
09 Apr 2007, 19:41 |
|
Hayden 10 Apr 2007, 03:43
The code ran realy slow on my Pii400mHz ( about ~1-2 secs between frames). I assumed he was looking for speed.
Usualy ax, bx are init to zero but other registers seem to vary. I hav'nt seen any standards before describing the state of general registers for com files except that all segment registers are init to point to start of psp. Can anyone point me com reference that describes the gerneral registers? |
|||
10 Apr 2007, 03:43 |
|
rugxulo 24 May 2007, 06:33
Hayden, I assume this is what you want:
http://www.frontiernet.net/~fys/yourhelp.htm EDIT: I can indeed confirm that some demo programs assume registers that aren't correct for e.g. DR-DOS 7.03 (like chut.rar, the 253-byte, Winnie-the-Pooh-drawing .COM ... only works upon tweak / reassemble with DEBUG equ 1). Code: # WINNIE.SED (for CHUT.RAR from http://www.256b.com) -- converts to FASM s/\t/ /g /^\.model tiny/s/^/;/ /^\.code/s/^/;/ /^\.486/s/^/;/ /^ *END /s/^/;/ s/ENDIF/end if/ s/\(o *EQU\).*/\1/ s/\([a-zA-Z0-9_][a-zA-Z0-9_]*\) *\(MACRO\)/\2 \1/ /MACRO/s/;.*/{/ s/ENDM/}/ /STOP *EQU/!{ /s *EQU/!s/ EQU /=/ } # for DR-DOS 7.03 only (adds 20 bytes) /\(DEBUG *=\).*/s//\1 1/ Last edited by rugxulo on 05 Jun 2007, 13:39; edited 1 time in total |
|||
24 May 2007, 06:33 |
|
Goplat 24 May 2007, 14:57
AX and BX can be nonzero at startup. If your first command line argument is a filename with an invalid drive letter (like "Z:\blah") then AL and BL are 0FFh. If the second argument is, then AH and BH are.
|
|||
24 May 2007, 14:57 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.