Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: asm + memory in windows

0 views
Skip to first unread message

Rod Pemberton

unread,
Jul 5, 2008, 6:30:22 AM7/5/08
to
"rio" <a@b.c> wrote in message
news:486f4063$0$40313$4faf...@reader5.news.tin.it...
> "rio" <a@b.c> ha scritto nel messaggio
> news:484a2470$0$40221$4faf...@reader5.news.tin.it...
> > /* ritorna puntatore [<=> CF==0] tutto ok, se ritorna 0 [<=> CF==1]
errore
> > /* u32* Realloc_sys(u32* Pm, i32 sz)
> > /* 0k,4j,8i,12b,16ra,20P_p,24P_sz
> > Realloc_sys:
> > <b,i,j,k
> > b=[s+20]|a=[s+24]|k=[s+24]|a<>0| <?#.e| =#.0
> > b==0#.1
> > [__imp_VirtualQuery](b,Mem_info,28)
> > [Mem_info]!=b#.e|i=a|D[Mem_info+16]==MEM_COMMIT#.1
> ^^^^
> i=[Mem_info+12]
>
> > .0: b#.6
> > .ok: clc|#.f
> > .e: a^=a|stc|#.f
> > .1: [__imp_VirtualAlloc](0,k, _ MEM_COMMIT||MEM_RESERVE _
> > ,PAGE_READWRITE)|a!#.e
> > b==0#.ok|j=k|k<i#.a|j=i
> > .a: k=j|r^=r|j>>=2|#.3
> > .2: c=[b+4*r]|[a+4*r]=c |++r|.3: r<j#.2
> > r<<=2|#.5
> > .4: cl=[b+r] |[a+ r]=cl|++r|.5: r<k#.4
> > /* Esempio nb= 3 r=0, j=3>>2=0 |k=3 r=0
> > r=0,1,2
> > /* Esempio nb=13 r=3, j=13>>2=3, r=0,1,2
> > /* k=13 r=3<<2=12, r=12
> > .6: <a
> > Free_sys(b) /* clc or stc depend from Free_sys
> > >a /* a!=0 means allocated
> > .f:
> >>b,i,j,k
> > ret 8
> > -------------------------------------------
> > /* t3.asm
> > /* assemble with:
> > /* nasm -fobj t2.asm
> > /* link with
> > /* alink -oPE t2
> > /* run with
> > /* t2
> > == Malloc_sys, Free_sys, Realloc_sys == rrdll.dll
> >
> > section code public use32 class=CODE
> >
> > ..start:
> > exestart:
> > [Malloc_sys](90)|a==0#.f
> > D[a]=0xFAFAFAFA
> > <a
> > [Realloc_sys](a,1200000)|a==0#.e
> > r=D[a]
> > [Free_sys](a)|>r|#.f
> > .e: >a|[Free_sys](a)
> > .f:
> > [Realloc_sys](0,12)
> > [Realloc_sys](a,0)
> > [Realloc_sys](0,0)
> > ret
>
>

Rio (et. al...),

I've noticed that every time you post code to a.l.a. you also post
corrections - sometimes many. It's those five or six corrections on this C
equivalent realloc() that makes me wonder... You've stated that your
language is supposed to be simpler than pure C or pure x86 assembly (IIRC,
under other aliases...). Why is it that you must post so many corrections
to code written in a language that _you_ created? Is the code untested? Is
it because the language is too terse or cryptic even for you? Is it because
the language lacks sufficient readability or structure for you (and everyone
else...) to find the errors? Since you're the primary (and likely only...)
user, shouldn't you redesign your language to reduce coding errors?

I already know that Randall Hyde disagrees with me when I say that
"insufficient context from lack of syntax can be confusing" for other terse
languages like FORTH. He's claimed that if "it's confusing and a source of
errors," then "you don't know the language real well." How well do you know
your own language? You're the expert in it, correct? So, why are you
making mistakes? Could Randall be completely wrong?


Rod Pemberton
PS added comp.lang.misc since they like programming language design
issues... ;-)

rio

unread,
Jul 5, 2008, 4:44:54 PM7/5/08
to

"Rod Pemberton" <do_no...@nohavenot.cmm> ha scritto nel messaggio
news:g4nij1$u5g$1...@aioe.org...

ok this last seems a little obfuscated

>>
>
> Rio (et. al...),
>
> I've noticed that every time you post code to a.l.a. you also post
> corrections - sometimes many. It's those five or six corrections on this
> C
> equivalent realloc() that makes me wonder... You've stated that your
> language is supposed to be simpler than pure C or pure x86 assembly (IIRC,
> under other aliases...). Why is it that you must post so many corrections
> to code written in a language that _you_ created? Is the code untested?
> Is
> it because the language is too terse or cryptic even for you? Is it
> because
> the language lacks sufficient readability or structure for you (and
> everyone
> else...) to find the errors? Since you're the primary (and likely
> only...)
> user, shouldn't you redesign your language to reduce coding errors?

so for you is easy write down ***without errors*** *the first time*
a function that eliminate one array value from an array of int of know size

/* u32 TogliElemento(u32* array, u32 size, u32 elemento)
/* ritorna la nuova size
/* 0k, 4j, 8i, 12b, 16ra, 20P_array, 24P_size, 28P_elemento
TogliElemento:
<b,i,j,k
a=[s+20]|b=[s+24]|i=[s+28]|k^=k| #.3
.0: j=&[k+1]|#.2
.1: r=[a+4*j]|[a+4*j-4]=r| ++j| .2: |j<b#.1
--b| #.4
.3: i==[a+4*k]#.0
++k
.4: k<b#.3
a=b
>b,i,j,k
ret 12


> I already know that Randall Hyde disagrees with me when I say that
> "insufficient context from lack of syntax can be confusing" for other
> terse
> languages like FORTH. He's claimed that if "it's confusing and a source
> of
> errors," then "you don't know the language real well." How well do you
> know
> your own language? You're the expert in it, correct? So, why are you
> making mistakes? Could Randall be completely wrong?

there is nothing confusing "a" is eax, "b" is ebx, k is ebp, s is esp, r is
edx ecc
"++a" means "inc eax"
"j=&[k+1]" means "lea edi, [ebp+1]"

i make some mistakes 3-5 for routine in that "assembly" (in the case the
code compile).
i probabily post for correct some of these errors.
Probabily not post the final version that seems to run always ok.
Probabily i'm slow, but not program 12 ours/day.
it seems that when debug realloc i have ended with main memory functions.
Then i have to debug all the remain functions that should i have for files
streams, sockets that need malloc and write all in a dll

Rod Pemberton

unread,
Jul 5, 2008, 5:38:38 PM7/5/08
to
"rio" <a@b.c> wrote in message
news:486fdcdd$0$40155$4faf...@reader1.news.tin.it...

> so for you is easy write down ***without errors*** *the first time*

No, not always. I try to test stuff before I post...

The point was that the way you _promote_ "Rio-asm" and the way it is
_working_ for you don't match.

You promote "Rio-asm" as simpler learn. That it's easier to use. That's
it's less prone to errors. That it's better than C or assembly. That C
programmers should use "Rio-asm" instead of C (posts on a.l.a. such as "Why
use the C language?" and dozens on c.l.c. under other aliases: ros, Rosario,
av, a/b, 柑/b, 柑\\/b, RoSsIaCrIiLoIA, RSoIsCaIrLiIoA, etc.). But, you, the
only _expert_ in the "Rio-asm" language, are having problems writing defect
free code in "Rio-asm". You've demonstrated these problems _repeatedly_.
To me, this is a language design problem. If an expert can't code in
"Rio-asm" without making errors, do you think a non-expert can code in
"Rio-asm" without errors?

(And, to me, you're proof that Randall is incorrect when he claims an expert
shouldn't have trouble programming a language he's an expert in...)


Rod Pemberton

0 new messages