Dark Bit Factory & Gravity
PROGRAMMING => Other languages => ASM => Topic started by: rain_storm on May 02, 2008
-
I really wanted to enter this into the procedural compo but since its based on a previous work by me I think its best not to, anyways this is my very first 256 byte intro hope you all like it source and com file included (assembled with FASM)
-
Looking good, would be nice if you can use those spare 44 bytes to shade top image, like this:
(http://web.bitnet.net/johnny/floor.gif)
-
Yeah I was gonna get around to that best I can do is this quick hack but I lose 3/4 of the pallet due to some necessary shift rights otherwise the colours bleed (cycle through 0FFh -> 00h) which dont look so good but I got it in 253b it was a tight fit to get that conversion done in < 256b it requires data to be initialised that was not required before but its worth it
-
I messed around in your source when I was bored, hope you don't mind ;)
Kept some floats in fpu-registers and rearranged some lines for less reloading, making 167 bytes.
Not quite at the limit yet, but probably saved enough to add rotation or something...
...
FLD [DDCAMY]
MAIN:FLD1
FADDP ST1,ST0
MOV WORD[DWY],0
XOR DI,DI
MOV DX,VTRACE
SYNC:IN AL,DX
TEST AL,08h
JZ SYNC
XOR AX,AX
FORY:FLD [DDYMIN]
FIDIV [DWY]
FST [DDW]
FMUL [DDRESX]
FSUB ST0,ST1
FISTP [DWV]
FLD [DDW]
FMUL [DDXMIN]
FADD ST0,ST1
; [DDU] is kept in st0
MOV CX,320
FORX:
FADD [DDW]
FIST [DWU]
MOV AL,BYTE[DWU]
XOR AL,BYTE[DWV]
MUL [DWY]
SHR AX,10 ; okay, this is cheated (256 is not 200), but it's probably cheaper to compensate in the palette setup
STOSB
DEC CX
JNZ FORX
FSTP [DDW] ; remove [DDU]
INC WORD[DWY]
CMP WORD[DWY],200
JB FORY
...
-
now thats a Karmic post if ever I saw one thanks hellfire. I gotta have another play around with this
edit:
TYVM :D its down to 128 bytes no exit check is performed though thats 1/2 the size but double the speed thanx again hellfire
ORG 100h
INIT:MOV AL,13h
INT 10h
PUSH 0A000h
POP ES
MOV DX,03C8h
XOR AX,AX
OUT DX,AL
INC DX
COLR:OUT DX,AL
OUT DX,AL
OUT DX,AL
INC AL
JNZ COLR
FLD DWORD[Y]
MAIN:FLD1
FADDP ST1,ST0
MOV BYTE[Y],200
MOV DI,64000
STD
FORY:;FILD WORD[CENY]
FILD WORD[CENX]
FIDIV WORD[Y]
FST DWORD[W]
FIMUL WORD[RESX]
FSUB ST0,ST1
FISTP WORD[V]
FLD DWORD[W]
FIMUL WORD[CENX]
FADD ST0,ST1
MOV CX,WORD[RESX]
FORX:FADD DWORD[W]
FIST WORD[U]
MOV AL,BYTE[U]
XOR AL,BYTE[V]
MUL BYTE[Y]
SHR AX,10
STOSB
LOOP FORX
FSTP DWORD[W]
DEC BYTE[Y]
JNZ FORY
IN AL,60h
DEC AL
JNZ MAIN
RET
RESX DW 320
CENX DW -160
Y DW 000
U DW 000
V DW 000
W DB 000
-
114 bytes (but i'm seriously out of ideas now):
ORG 100h
PALLET = 03C8h
VTRACE = 03DAh
KEYBRD = 0060h
INIT:MOV AL,13h
INT 10h
PUSH 0A000h
POP ES
MOV DX,PALLET
XOR AX,AX
OUT DX,AL
INC DX
COLR:OUT DX,AL
OUT DX,AL
OUT DX,AL
INC AL
JNZ COLR
FLDZ
MAIN:FLD1
FADDP ST1,ST0
PUSH 56
XOR DI,DI
FORY:FILD WORD[DDXMIN]
FIDIV WORD[ESP]
FLD ST0
PUSH 320
FIMUL WORD[ESP]
FSUB ST0,ST2
FISTP WORD[DWV]
FLD ST0
FIMUL WORD[DDXMIN]
FADD ST0,ST2
POP CX
FORX:FADD ST0,ST1
FIST WORD[DWU]
MOV AL,BYTE[DWU]
XOR AL,BYTE[DWV]
MUL BYTE[ESP]
SHR AX,10
STOSB
LOOP FORX
FISTP WORD[DWU]
FISTP WORD[DWV]
INC BYTE[ESP]
JNZ FORY
EXIT:IN AL,KEYBRD
DEC AL
JNZ MAIN
RET
DWU DW ?
DWV DW ?
DDXMIN DW -160
-
I cant seem to do any better than that without it looking cack nice to see this smaller and running faster
-
I love that. It runs really smooth and does something nice, you cant ask for more from a few dozen bytes :)
-
114 bytes (but i'm seriously out of ideas now):
ORG 100h
PALLET = 03C8h
VTRACE = 03DAh
KEYBRD = 0060h
INIT:MOV AL,13h
INT 10h
PUSH 0A000h
POP ES
MOV DX,PALLET
XOR AX,AX
OUT DX,AL
INC DX
COLR:OUT DX,AL
OUT DX,AL
OUT DX,AL
INC AL
JNZ COLR
FLDZ
MAIN:FLD1
FADDP ST1,ST0
PUSH 56
XOR DI,DI
FORY:FILD WORD[DDXMIN]
FIDIV WORD[ESP]
FLD ST0
PUSH 320
FIMUL WORD[ESP]
FSUB ST0,ST2
FISTP WORD[DWV]
FLD ST0
FIMUL WORD[DDXMIN]
FADD ST0,ST2
POP CX
FORX:FADD ST0,ST1
FIST WORD[DWU]
MOV AL,BYTE[DWU]
XOR AL,BYTE[DWV]
MUL BYTE[ESP]
SHR AX,10
STOSB
LOOP FORX
FISTP WORD[DWU]
FISTP WORD[DWV]
INC BYTE[ESP]
JNZ FORY
EXIT:IN AL,KEYBRD
DEC AL
JNZ MAIN
RET
DWU DW ?
DWV DW ?
DDXMIN DW -160
This one works smoothly here (P4 2.8Ghz) pouet one doesn't
-
Since you own the entire 64kb segment, can't you remove
DWU DW ?
DWV DW ?
which is taking 4 bytes and change them to
DWU=DDXMIN+2
DWV=DDXMIN+4
?
Jim
-
Yeah that was actually thrown in there in one of those versions above but it was not needed any more. the bare bones minimum is like 84b without the greyscale pallet and using label+offset for data.
-
Hello,
I had some time on my hands, and I didn't reach the 84b mentionned above, but 86 bytes whilst keeping the escape key funtion :
; This is a 86-byte modified version of a 114-byte VGA floor Casting code by rain_storm
; by olivier.poudade.free.fr 2013
; cf. http://www.dbfinteractive.com/forum/index.php?topic=3107.0
; C:\128BIN~1>fasm rbz.asm
; flat assembler version 1.70.03 (786431 kilobytes memory)
; 2 passes, 86 bytes.
ORG 100h ; nb : sp equ 65534 at program start
DWU equ 34h ; saves 2 bytes / was DWU DW ?
DWV equ 36h ; saves 2 bytes / was DWV DW ?
INIT: MOV AL,13h
INT 10h
les di,[bx] ;es=9fffh di=20cdh / was PUSH 0A000H POP ES
FLDZ
MAIN: FLD1
FADDP ST1,ST0
mov di,16 ; make up for les di,[bx]
mov si,DWV ; saves 1 byte
PUSH word si ; was PUSH WORD 56 ; we can't use 0038h but 36h (54d)
FORY: mov bp,sp ; adress stack with base ptr
FILD WORD[DDXMIN]
FIDIV WORD[bp] ; was FIDIV WORD[ESP]
FLD ST0
PUSH 320
FIMUL WORD[bp-2] ; was FIMUL WORD[ESP]
FSUB ST0,ST2
fistp word[si] ; DWV
FLD ST0
FIMUL WORD[DDXMIN]
FADD ST0,ST2
POP CX
FORX: FADD ST0,ST1
dec si ; make up for lodsw below and mov si,DWV above
dec si ; make up for lodsw below and mov si,DWV above
fist word[si] ; saves 2 bytes / was FIST WORD[DWU]
lodsw ; saves 1 byte / was MOV AL,BYTE[DWU]
xor al,byte[si] ; saves 1 byte / was XOR AL,BYTE[DWV]
MUL BYTE[si+4] ; was MUL BYTE [ESP]
shr ax,12 ; was SHR AX,10 & make up for VGA default palette 16->31
or al,10h ; was SHR AX,10 & make up for VGA default palette 16->31
STOSB
LOOP FORX
fistp word[si-2] ; saves 3 bytes was FISTP WORD[DWU]
fistp word[si] ; saves 3 bytes was FISTP WORD[DWV]
DDXMIN:INC BYTE[ESP] ; DDXMIN equ $ saves 2 bytes ff67h close to ff60h / was DDXMIN DW -160
JNZ FORY
IN AL,60h ; was equ KEYBRD
dec ax ; saves 1 byte / was DEC AL
JNZ MAIN
RET
-
Hi I finally got a 64 byte textured floorcast :
http://www.pouet.net/prod.php?which=63305
org 100h
mov al,13h
int 10h
les cx,[bx]
frame:mov di,10h
mov si,0fa0fh
mov bp,64h
yloop:mov sp,0a0h
xloop:mov ax,5454h
cwd
div bp
mov bh,al
mul sp
mov al,ah
add bh,cl
xor al,bh
shr al,4
add al,10h
stosb
mov [es:si],al
dec si
dec sp
cmp sp,0ff60h
jnz xloop
dec bp
cmp bp,10h
jnc yloop
in ax,60h
dec ax
loopnz frame
int 20h
-
Hey guys,
Just trying to run this on my new Windows 8 64bit machine and I'm getting an error about it being an 'Unsupported 16-Bit Application'.
I've had a quick search around the internet and haven't found a way to run it. Just wondering if anyone has any bright ideas for me?
-
It works OK in DOSBox under 64-bit windows 7 if you increase the CPU speed with ctrl-f12.
rain_storm: Awesome 256-byte .
-
That is excellent on what you have done and I do know some of Asm commands like add, sub, cmp and not sure about other....
Commets would be helpful...commands with commets next to it on what they are :)
I am sure it help other understand what is what :)
-
Thanks madeyes. I was going to try to avoid having to use emulation but it works for now and at least I can compile it without having to do any kind of emulation.
Probably not a bad thing having dosbox lying around anyway.
Nice demo rain_storm!
-
Thanks staticgerbil but I think baudsurfer just blew it away :D
Very cool demo baud, but it only runs every other time. ( Maybe cx is decrementing to zero too quickly ) but when it runs it looks amazing.