Problem with amp 
Author Message
 Problem with amp

This is NOT my code, just trying to clean it up.

I can't this to compile under any Tasm version.
It's having a problem with the amp statement.

model tiny
386

jumps

amp       real4     05.0
data

snow    db      255*6 dup (?)

CODESEG
Startup
        ; switch to graphics mode
        mov     al, 013h
        int     10h

        ; initialize es to the video buffer
        push    0A000h
        pop     es



        test    al, 8

        ; clear the display
        xor     di, di
        xor     ax, ax
        mov     cx, 64000 shr 1
        rep     stosw

        ; update position and draw
        mov     si, OFFSET snow

        cmp     byte ptr [si], 200


        fdiv    [amp]
        fsin
        fmul    [amp]
        fild    word ptr [si+4]
        fadd
        lodsw
        fistp   word ptr [si]
        mov     di, ax
        shl     ax, 8
        shl     di, 6
        add     di, ax
        add     di, [si]
        mov     al, 31
        stosb
        add     si, 4

        ; check for key press
        mov     ah, 001h
        int     16h

        ; restore text mode
        mov     al, 003h
        int     10h
        ret

end



Mon, 04 Jul 2005 01:18:03 GMT  
 Problem with amp

Quote:

> This is NOT my code, just trying to clean it up.

Is it known to work?

Quote:
> I can't this to compile under any Tasm version.
> It's having a problem with the amp statement.

> model tiny
> 386

> jumps

> amp       real4     05.0

I got it to assemble by changing the "real4" to "dd" (and a couple of
other minor tweaks... put "amp" in the data segment...) but it crashes.

Quote:
> data

> snow       db      255*6 dup (?)

> CODESEG
> Startup
>    ; switch to graphics mode
>    mov     al, 013h
>    int     10h

>    ; initialize es to the video buffer
>    push    0A000h
>    pop     es

>    ; main loop

>    mov     dx, 3DAh

>    test    al, 8

>    ; clear the display
>    xor     di, di
>    xor     ax, ax
>    mov     cx, 64000 shr 1
>    rep     stosw

>    ; update position and draw
>    mov     si, OFFSET snow
>    not     cx

It looks to me like si is "wrapping around" and overwriting code before
cx loops down to zero. I changed this to "mov cx, 64000 / 6" (seemed
like a lucky number). Now it doesn't crash, but it isn't very impressive
- just a "static" bunch of dots.

- Show quoted text -

Quote:

>    cmp     byte ptr [si], 200

>    mov     byte ptr [si], 0

>    fdiv    [amp]
>    fsin
>    fmul    [amp]
>    fild    word ptr [si+4]
>    fadd
>    lodsw
>    fistp   word ptr [si]
>    mov     di, ax
>    shl     ax, 8
>    shl     di, 6
>    add     di, ax
>    add     di, [si]
>    mov     al, 31
>    stosb
>    add     si, 4

>    ; check for key press
>    mov     ah, 001h
>    int     16h

>    ; restore text mode
>    mov     al, 003h

...and just hope ah is zero? Seems not to work. Changed it to "mov ax,
3" - size be damned!

Quote:
>    int     10h
>    ret

> end

On the whole, I was more impressed with the other snowstorm you posted -
where the snow piled up on top of the letters. That one looked pretty
good - still haven't figured out how it works :)

We don't need any more snow anyway!

Best,
Frank



Mon, 04 Jul 2005 04:31:12 GMT  
 Problem with amp

Quote:


>> This is NOT my code, just trying to clean it up.

>Is it known to work?

>> I can't this to compile under any Tasm version.
>> It's having a problem with the amp statement.

The com that came with it works, and the author (?) tells me to
compile it with Tasm32. I don't have that particular version, but
Tasm 41 and 52. When I have time, I'll use IDA for windows, get
an asm listing and study it's output.

I doubt he's the author, otherwise he is awful lucky his first time around.
:-)



Mon, 04 Jul 2005 05:34:14 GMT  
 Problem with amp

Quote:



>>> This is NOT my code, just trying to clean it up.

>>Is it known to work?

>>> I can't this to compile under any Tasm version.
>>> It's having a problem with the amp statement.

>The com that came with it works, and the author (?) tells me to
>compile it with Tasm32. I don't have that particular version, but
>Tasm 41 and 52. When I have time, I'll use IDA for windows, get
>an asm listing and study it's output.

>I doubt he's the author, otherwise he is awful lucky his first time around.
>:-)

As Frank said the pointer [SI] is wrapping around the end of the segment
and overwriting first the stack then the code, I changed it so that
if SI goes above a certain bound (here I used snow+0FC00h which gives
it as much room as possible assuming the code is <0300h bytes) then
it will get wrapped back to the start of the data.

I think that you should at least be initialising the data area
at [snow] first with 0's .... maybe it doesn;t matter, the algorithmn looks
odd really and terribly inefficient (you can use zapppy integars and
tables for this sort of thing ;-) so I haven't tried to work it out., seems
like some sort of chaos thing.

Anyhow I converted it to MASM assembly-able code for you. It will
assemble fine and then link (using /T) to a .COM file. The result
is mildly interesting and different values of [amp] and the value
of the wrap boundary probably will make different effects.

If you don't have MASM to assemble it then I've also included a
batch program at the bottom with the executable in it for at least
until you work things out... :-)

OPTION SEGMENT:USE16
.386

cseg SEGMENT BYTE

ASSUME NOTHING
ORG 0100h

kode PROC NEAR

        ; switch to graphics mode
        mov     al, 013h
        int     10h

        ; initialize es to the video buffer
        push    0A000h
        pop     es



        test    al, 8

        ; clear the display
        xor     di, di
        xor     ax, ax
        mov     cx, 64000 shr 1
        rep     stosw

        ; update position and draw
        mov     si, OFFSET snow
        not     cx



        inc     byte ptr [si]
        cmp     byte ptr [si], 200


        fild    word ptr [si]
        fdiv    DWORD PTR DS:[amp]
        fsin
        fmul    DWORD PTR DS:[amp]
        fild    word ptr [si+4]
        fadd
        lodsw
        fistp   word ptr [si]
        mov     di, ax
        shl     ax, 8
        shl     di, 6
        add     di, ax
        add     di, [si]
        mov     al, 31
        stosb
        add     si, 4        

        ; check for key press
        mov     ah, 001h
        int     16h

        ; restore text mode
        mov     AX, 003h
        int     10h
        ret

amp       real4     05.0

kode ENDP

snow EQU $

cseg ENDS

END FAR PTR kode

Quote:


ECHO:`h}aXP5y`P]4nP_XW(F4(F6(F=(FF)FH(FL(Fe(FR0FTs*}`A?+,>alm.com

ECHO:1Je~+I}tu(NB,6tqa}XynL0Ifjk$Ow;o]S$NeFSzlqQs'LVO\'x'-I9MlZ>>alm.com
ECHO:;h_S?+'X,6f$N9=I*j\l;=1Q(_`pqq{xsx2Sg)Q~?xeJhh05cr5'UO-w$V>>alm.com
ECHO:[n._1zo'jtGr\$$,vQw8Vd[/\3'3$$$)$#>>alm.com
ALM.COM

(encoded by assembling above source code to COM then running CM3.COM
 COM ->ascii code convertor available on my site http://lf.1accesshost.com
 on the TOOLS page)

bestwishes
laura



Mon, 04 Jul 2005 07:49:28 GMT  
 Problem with amp

Quote:
>Subject: Re: Amp


>bestwishes
>laura

goodluck with that master plan/perfect solution...'kay? ;)

-------

As to cleaning up this group believe me I have been working on that...I have
the perfect solution but it will take a little time to get sorted out but I
will e-mail people on my list here as things progress, :-)

--Madonna Rulez [12-18-02]



Mon, 04 Jul 2005 07:54:11 GMT  
 Problem with amp

Quote:




>>>> This is NOT my code, just trying to clean it up.

>>>Is it known to work?

[]

Quote:
>    ; clear the display
>    xor     di, di
>    xor     ax, ax
>    mov     cx, 64000 shr 1
>    rep     stosw

>    ; update position and draw
>    mov     si, OFFSET snow
>    not     cx



>        SUB SI,0600h           <===

[]
Well you may be able to tell I patched your code very quickly
indeed (eager to get it done before the coffee pot boiled hehe ;-)
and the first wrap around was set to +0600h, the SUB wasn't
updated, not that it really matters but if you change it to
the more correct 0FC00h it makes actually quite a pretty effect
(well it did here I don't know about the uninitialised data
and how that will effect things overall)

wishes
laura



Mon, 04 Jul 2005 07:57:32 GMT  
 Problem with amp

Quote:
>Subject: Re: Amp





You reply to yourself a lot...your ruination is that complete?

-------

As to cleaning up this group believe me I have been working on that...I have
the perfect solution but it will take a little time to get sorted out but I
will e-mail people on my list here as things progress, :-)

--Madonna Rulez [12-18-02]



Mon, 04 Jul 2005 08:00:32 GMT  
 Problem with amp

Quote:

>I think that you should at least be initialising the data area
>at [snow] first with 0's .... maybe it doesn;t matter, the algorithmn looks
>odd really and terribly inefficient (you can use zapppy integars and
>tables for this sort of thing ;-) so I haven't tried to work it out., seems
>like some sort of chaos thing.

Thanks for the help. How do I get link to assemble the com file without all
the prompts. Interesting how you get different screen outputs with ml  and
ml/help.

The snow comes down OK, but there are some white "pillars" that stay on the
screeen. Future project.



Mon, 04 Jul 2005 20:36:35 GMT  
 Problem with amp

Quote:

> How do I get link to assemble the com file without all
> the prompts.

I think I know that one - end the command-line with a semicolon. (or
several commas)

Quote:
> The snow comes down OK,  but there are some white "pillars"

 >  that stay on the screeen. Future project.

What I'm seeing is an occasional "pillar", mostly some "vertical sine
wave" effects - kinda groovy, but it doesn't look a *bit* like a
snowstorm. I'm pretty sure Laura's right, that it's an artifact of
uninitialized memory. A routine to zero that memory (or perhaps some
other value would be interesting???) wouldn't be hard to add.

One wonders what the original author's intention was. (S)He reserves
"255 * 6", and then scribbles all over! Laura's code just does "snow equ
$" after the code. Promoting the code to ".model small" and putting
"snow" in the data section would initialize it to zero, but would bloat
the executable. Maybe ".data?" - not sure how that works with Masm/Tasm...

As you say, a future project. (if I had an "incomplete" directory, it'd
be quite full!)

Best,
Frank



Mon, 04 Jul 2005 22:22:02 GMT  
 Problem with amp

Quote:
>I think I know that one - end the command-line with a semicolon. (or
>several commas)

>> The snow comes down OK,  but there are some white "pillars"
> >  that stay on the screeen. Future project.

>What I'm seeing is an occasional "pillar", mostly some "vertical sine
>wave" effects - kinda groovy, but it doesn't look a *bit* like a
>snowstorm. I'm pretty sure Laura's right, that it's an artifact of
>uninitialized memory. A routine to zero that memory (or perhaps some
>other value would be interesting???) wouldn't be hard to add.

>One wonders what the original author's intention was. (S)He reserves
>"255 * 6", and then scribbles all over! Laura's code just does "snow equ
>$" after the code. Promoting the code to ".model small" and putting
>"snow" in the data section would initialize it to zero, but would bloat
>the executable. Maybe ".data?" - not sure how that works with Masm/Tasm...

That is very handy, uses no room in the .exe. I used in my shredder file
program. 64,000 byte area used to increase speed especially on floppy files.

Quote:
>As you say, a future project. (if I had an "incomplete" directory, it'd
>be quite full!)

That's a GOOD thing. If the directory became empty, we'd have to
get serious about writing Win 32 code. There is no equivalent
Interuppt List for Win 32, though I am collecting everything for when that
day comes.

I used to have a directory with code I wrote that crashed, BSOD,
etc. But some of my code trashed the directory. :-)



Mon, 04 Jul 2005 23:22:49 GMT  
 Problem with amp

Quote:
>Anyhow I converted it to MASM assembly-able code for you. It will
>assemble fine and then link (using /T) to a .COM file. The result
>is mildly interesting and different values of [amp] and the value
>of the wrap boundary probably will make different effects.

>If you don't have MASM to assemble it then I've also included a
>batch program at the bottom with the executable in it for at least
>until you work things out... :-)

Thanks for the help, I'm beginning to like Masm. Should I start
worrying ? I am afraid that there is code in it that detects how times I
have used it, then it would start RBBIOP. (Random Bug Behavior In Other Programs).
It's hard enuf now with many of my
own ones doing it.


Mon, 04 Jul 2005 23:27:36 GMT  
 
 [ 20 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Problem:VRML&Java&Performance

2. Problem with && lazy evaluation

3. 32bit problem - one problem solved & another found

4. problem with &-character and statictext

5. CFD Printing Problem - Novell & W95

6. A few tiny problems - mkdir & file opening

7. problem Win98 & Clipper 87

8. VHDL Problem - Procedures & Processes

9. problems extending & embedding python

10. DVF problem : graphics & Dialog boxes

11. Installation problems DCOracle2 & W2000

12. Problem DLL&C-Connect

 

 
Powered by phpBB® Forum Software