flat assembler
Message board for the users of flat assembler.

flat assembler > DOS > Para512 - 512 byte paratrooper (with sources)

Goto page 1, 2  Next
Author
Thread Post new topic Reply to topic
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
At least i found some time to release this somewhat old thingy.

Sources are included so you can maybe learn few tricks from that.

have fun and spread it over the world Laughing

[edit] This was originally Para513. It was changed to Para512 after optimization idea by ATV


Description:
Download
Filename: para512.zip
Filesize: 7.42 KB
Downloaded: 188 Time(s)



Last edited by vid on 24 Oct 2006, 13:54; edited 1 time in total
Post 24 Oct 2006, 00:44
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3172
Location: Denmark
Hehe - it needs to be ONE byte smaller though Wink
Post 24 Oct 2006, 06:52
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
no it doesn't!

read the docs and comments in source code Razz Wink
Post 24 Oct 2006, 10:11
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
Very easy 2 bytes remove
Move end_objects: (lines 484-490) before line 323 then one jnb 32bit -> jb 8bit
Then it have 511 bytes
Post 24 Oct 2006, 13:04
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
great, why didn't i think about it? Smile
so i am migrating to Para512 Wink
Post 24 Oct 2006, 13:54
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
rugxulo



Joined: 09 Aug 2005
Posts: 2302
Location: Usono (aka, USA)
One quick comment: the above .ZIP is made by which compressor? I'm just curious as to why the compressed size of the .COM is 516 bytes (uses Deflate even though Stored would be better!).

In other words, Info-Zip would compress smaller.
Post 24 Oct 2006, 16:26
View user's profile Send private message Visit poster's website Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
Total Commander builtin ZIP
Post 24 Oct 2006, 17:13
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
sylwek32



Joined: 27 Apr 2006
Posts: 340
hey vid, maybe you should publish it to pouet.net ?
Post 24 Oct 2006, 21:09
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
it's public domain, feel free to send anywhere for me. i don't know many sites on this
Post 24 Oct 2006, 21:46
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
sylwek32



Joined: 27 Apr 2006
Posts: 340
Post 24 Oct 2006, 23:41
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
thx
Post 25 Oct 2006, 00:27
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
sylwek32



Joined: 27 Apr 2006
Posts: 340
no problem..

I am currently working on a 32byte program in fasm..
Maybe you can help me.. Very Happy
Post 25 Oct 2006, 00:55
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
just post your question(s)
Post 25 Oct 2006, 09:33
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
sylwek32



Joined: 27 Apr 2006
Posts: 340
org 100h
MOV AL, 13H
INT 10H
UX:
INC BYTE [2]
MOV DX, " "
MOV AH, 10H
INT 21H
;MOV CX,"k"
LES BP, [BX]
PUSH DI
ADD DI, CX
MOV AL, BYTE [2]
MOV [ES:DI], AL
POP CX

ADD DX,DI
JMP UX
dummy db '1'


how to make it smaller Razz ?
Post 25 Oct 2006, 09:48
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
"mov [es:di],al" -> stosb

why do you call int 21h/ah=10/dx=" " ???
Post 25 Oct 2006, 11:59
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
Second look of paratrooper
Code:
line 97 save 1 byte
 inc al -> inc ax
line 152-
  movzx dx,byte [bp + angletab-BPVAL + si]
  shld bx,dx,12   ;BL = high 4 bits (y gun size)
  and dl,0Fh      ;DL = low 4 bits (x gun size), DH=0 (counter of y overlap)
  mov bh,bl       ;BH = y size (counter of Y loops)
new 152- save 2 bytes
  mov al,byte [bp + angletab-BPVAL + si]
  aam 10h
  movzx dx,al     ;DL = low 4 bits (x gun size), DH=0 (counter of y overlap)
  xchg ax,bx      ;BH = y size (counter of Y loops)
  mov bl,bh       ;BL = high 4 bits (y gun size)
line 215-
  mov al,ah
  cbw
  ;------------------------------------------------------------------
  ;ESC
  dec ax
  jz exit
  ;-----------------------------------------------------------------
  ;check left key
  mov cl,byte [bp+dir-BPVAL]
  sub al,4Bh-1
  jz change_gun_angle
new 216- save 3 bytes (and uses keys j,k,l = works also in laptop)
  cbw
  ;------------------------------------------------------------------
  ;ESC
  cmp al,27
  jnz dont_exit   ;expensive 4byte jz removed
  ret            
  dont_exit:
  ;-----------------------------------------------------------------
  ;check left key
  mov cl,byte [bp+dir-BPVAL]
  sub al,'k'-1
  jz change_gun_angle
lines 358,360,364,366,505 mov can be replace with xchg (save 5 bytes)

total 512-11=501 bytes (soon there is room for score handling)
    
Post 26 Oct 2006, 07:05
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
about first: i knew i shold study "AAM", it is used in every optimizing compo. i was just too lazy Smile

second: matter of taste, i wanted not to affect playability

xchg ax: great idea!

seems you've done some optimizations before Wink
Post 26 Oct 2006, 10:20
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7109
Location: Slovakia
so, i tried your tricks, work well. By the way, moving to JKL only saves one byte, so i will keep numeric arrow keys for now, until that one byte is strongly needed.

thx for interest.

do you have any idea HOW could the score work? There could be end-after-4-parachutist-on-ground, similar to original.
Post 26 Oct 2006, 10:36
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
ATV



Joined: 31 Aug 2004
Posts: 109
Location: Finland
Tetris like game in Hugi Compo 22
http://www.hugi.scene.org/compo/compoold.htm#compo22
has score handling, maybe little over 20 bytes.
Post 26 Oct 2006, 11:04
View user's profile Send private message Reply with quote
sylwek32



Joined: 27 Apr 2006
Posts: 340
vid:
why do you call int 21h/ah=10/dx=" " ???

it was dx=" x"
i forgot to write a x behind of that


Code:
org 100h             ; .COM                 + 0 Byte
MOV AL, 13H          ;                      + 2 Bytes
INT 10H              ;                      + 2 Bytes
UX:                  ;
INC BYTE [2]         ;                      + 4 Bytes
MOV DX, " x"         ;                      + 3 Bytes
MOV AH, 10H          ;                      + 2 Bytes
INT 21H              ;                      + 2 Bytes
LES BP, [BX]         ;                      + 2 Bytes
PUSH DI              ;                      + 1 Byte
ADD DI, CX           ;                      + 2 Bytes
MOV AL, BYTE [2]     ;                      + 3 Bytes
;MOV [ES:DI], AL     ;                      + 3 Bytes
stosb                ; /Upper Line/         + 1  Byte
POP CX               ;                      + 1 Byte
ADD DX,DI            ;                      + 2 Bytes
JMP UX               ;                      + 2 Bytes     

Is current code..


Last edited by sylwek32 on 26 Oct 2006, 11:23; edited 2 times in total
Post 26 Oct 2006, 11:06
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  
Goto page 1, 2  Next

< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2018, Tomasz Grysztar.

Powered by rwasa.