Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Assembly x86 > Re: Am I on the...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 10 of 11 Topic 4608 of 4729
Post > Topic >>

Re: Am I on the right track?

by Frank Kotler <spamtrap@[EMAIL PROTECTED] > Apr 10, 2008 at 12:46 AM

mark r rivet wrote:
> On Tue, 08 Apr 2008 02:32:13 GMT, Frank Kotler  <spamtrap@[EMAIL PROTECTED]
>
> wrote:
> 
>> mark r rivet wrote:
>>> I'm new to assembly programming except for z80 coarse I took  in the
>>> 80's. So I downloaded: Nasm, Nasmide, Alink and have the book
>>> "Assembly Language step by step with Dos and Linux". Is this good or
>>> do I need something else.
> Or start off "Step by Step" and see where it takes you!
>> Best,
>> Frank
> 
> 
> Thanks alot Frank. Let me explain the reason for my new interest in
> assembly. I have been running this really old dos screen saver called
> "Dazzle"

Ah! We've "spoken" before on the Nasm forum!

> you can find it on the net by searching for Dazzle50.zip.

Yup, okay, got it, and between boots for "other purposes", I took a 
quick look. Pretty nice, alright! I didn't investigate all of its 
possibilities - there seem to be many. I've seen a lot of "demos" and 
"screensavers", some "equally" impressive, perhaps. Seems "worth 
preserving".

> I
> have run this most amazing program since the days of the 286, 1980  or
> so.Anyway 20 years later I am still amazed when I look at it. I need
> to know what makes it tick. I don't have the source code, so I want to
> disassemble the .exe and study it. I have the disassembler IDA. it
> disassembled nicely.

Really? As you've discussed, this would be illegal (which bothers me not 
at all). Also possibly unethical, which would bother me more. The guy 
seems to have really put his heart into it. Also, it's probably the hard 
way...

However, if you're interested in "studying" the code, rather than 
"stealing" it... in "honoring" him rather than "ripping him off"... I 
don't see any problem with that. Still probably the hard way...

> Now I just need a crash course in assembly.

Oh, we can show ya how to make your assembly crash!!! :)

> But
> from what Ican gather from the disassembly, it's a sixteen bit
> program.

Yeah... It's possible to use some 32-bit instructions in 16-bit code, 
also possible to use a "dos extender" to use 32-bit code from dos. But 
it's kinda old for that... if you've run it on a 286, it's 16-bit.

> It would make me very happy to understand this code and ****t
> it to 32bit and help to immortalize this freaking great code. Maybe
> you could download this program and give me some help with this. One
> way or another, I have to understand this code. I just have to!

Okay... from your latest post, you understand that disassembling the 
code may not be the best way to do this. At least not at first. Probably 
start with some simple graphics demos first - something we *do* have 
source code for... maybe try ****ting a 16-bit example to 32-bit. As 
you'll see, the "bitness" isn't much of a problem (32-bit code is 
*easier* in many ways), but we're dealing with a different OS and *have* 
to do things differently. This can be a blessing or a curse, or both... 
I don't have many graphics examples for Windows - a couple. A few more 
for dos - nothing as impressive as dazzle, but may have some ideas on 
how dazzle might do it.

Besides being a skilled (probably determined, too) programmer, the 
author of dazzle is artistic. It's one thing to know how to alter the 
palette, another thing to chose pleasing colors. One thing to know how 
to do fades and pans and wipes, another thing to string 'em together 
into a fluid, pleasing whole. I can't help you with the artistic part... 
if you haven't got it, you may *have* to copy dazzle! :)

This probably isn't a good "first" one to work with. As I recall, I 
found it "impressive" (very different from dazzle)... but it's obsessed 
with being short (256 bytes, IIRC), not "clear". I just happened to 
remember the name of this one. I'm a little "booted out" right now, but 
when I get to it, I'll try out a few and see if I can find something 
that'll "work up to" something vaguely "dazzle-like".

I don't know who originally wrote this. Just something I found on the 
web. Presumably the winner - an entry, at least - (I'd vote for it) in 
some "demo contest". I think it'll run in a dos-box under Windows... try 
it and see...

Best,
Frank


; from flashdaddee.com
; nasm -f bin -o osk.com osk.asm

[org 100h]
[segment .text]

SCREEN	equ	160
PIXBUF	equ	204h

	mov	al,13h
	int	10h
; set mode 13h - 320 * 200 * 256

	push	word 0A000h
	pop	es
; es is video memory

	mov	ax,cs
	add	ah,10h
; short way to add ax, 1000h get above our code
	mov	fs,ax
; fs is a buffer above our program - hopefully, dos
; isn't using it :)

	xor	cx,cx
; zero loop counter - loop 64k times

; set palette colors - the default ones suffer

PAL1:   mov     dx,3C8h
; PEL (write) address register
; this tells us which color we're setting

	mov	ax,cx
	out	dx,al
; out to the ****t

	inc	dx
; 3C9h is the PEL data register

	sar	al,1
	js	PAL2
	out	dx,al
; set red component

	mul	al
	shr	ax,6
	out	dx,al
; set green component

PAL2:   mov     al,0
	out	dx,al
; set blue if we jumped, red if we didn't?

	jns	PAL3
; flag set by "shr ax, 6"?

	sub	al,cl
	shr	al,1
	out	dx,al
; set ??? green?

	shr	al,1
	out	dx,al
; set ??? blue?

PAL3:   mov     bx,cx
	mov	[fs:bx],bl
; store in our buffer

	loop	PAL1
; this is way too many loops to set palette colors, and
; we're not using all that buffer(?)

; cx is zero from loop above...
TEX:    mov     bx,cx
	add	ax,cx
	rol	ax,cl
	mov	dh,al
	sar	dh,5
	adc	dl,dh
	adc	dl,[fs:bx+255]
	shr	dl,1
	mov	[fs:bx],dl
	not	bh
	mov	[fs:bx],dl
	loop	TEX

	fninit
	fldz

MAIN:   add     bh,8
	mov	di,PIXBUF
	fadd	dword [byte di-PIXBUF+TEXUV-4]
	push	di

	mov	dx,-80
TUBEY:  mov     bp,-160
TUBEX:  mov     si,TEXUV
	fild	word [byte si-TEXUV+EYE]

	mov	[si],bp
	fild	word [si]
	mov	[si],dx
	fild	word [si]

	mov	cl,2
ROTATE: fld     st3
	fsincos
	fld	st2
	fmul	st0,st1
	fld	st4
	fmul	st0,st3
	fsubp	st1,st0
	fxch	st0,st3
	fmulp	st2,st0
	fmulp	st3,st0
	faddp	st2,st0
	fxch	st0,st2
	loop	ROTATE

	fld	st1
	fmul	st0,st0
	fld	st1
	fmul	st0,st0
	faddp	st1,st0
	fsqrt
	fdivp	st3,st0
	fpatan
	fimul	word [si-4]
	fistp	word [si]
	fimul	word [si-4]
	fistp	word [si+1]
	mov	si,[si]

	lea	ax,[bx+si]
	add	al,ah
	and	al,64
	mov	al,-5
	jz	STORE

	shl	si,2
	lea	ax,[bx+si]
	sub	al,ah
	mov	al,-16
	jns	STORE

	shl	si,1
	mov	al,-48
STORE	add	al,[fs:bx+si]
	add	[di],al
	inc	di

	inc	bp
	cmp	bp,160
EYE	equ	$-2
	jnz	TUBEX

	inc	dx
	cmp	dx,byte 80
	jnz	TUBEY

	pop	si
	mov	di,(100-SCREEN/2)*320
	mov	ch,(SCREEN/2)*320/256
	rep	movsw
;mov ah, 0
;int 16h

	mov	ch,SCREEN*320/256
BLUR	dec	si
	sar	byte [si],2
	loop	BLUR
;mov ah, 0
;int 16h

	in	al,60h
	cbw
	dec	ax
	jnz	near MAIN

	mov	al,03h
	int	10h

	db	41,0,0C3h,3Ch
TEXUV   db      0FFh, 0FFh, 0FFh, 0FFh  ;"xxxx"   ;"baze"
 




 11 Posts in Topic:
Am I on the right track?
mark r rivet <spamtra  2008-04-07 23:11:59 
Re: Am I on the right track?
Frank Kotler <spamtra  2008-04-08 02:32:13 
Re: Am I on the right track?
mark r rivet <spamtra  2008-04-09 02:07:36 
Re: Am I on the right track?
ArarghMail804NOSPAM <s  2008-04-08 22:41:27 
Re: Am I on the right track?
mark r rivet <spamtra  2008-04-09 10:47:33 
Re: Am I on the right track?
Dirk Wolfgang Glomp <  2008-04-09 08:39:06 
Re: Am I on the right track?
mark r rivet <spamtra  2008-04-09 10:59:30 
Re: Am I on the right track?
Frank Kotler <spamtra  2008-04-10 00:38:15 
Re: Am I on the right track?
Frank Kotler <spamtra  2008-04-10 00:39:45 
Re: Am I on the right track?
Frank Kotler <spamtra  2008-04-10 00:46:49 
Re: Am I on the right track?
Cranky <spamtrap@[EMA  2008-04-09 13:38:28 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 15:13:36 CDT 2008.