Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  nodelist  faq  login

You had mail. Paul read it, so ask him what it said.


programming / alt.lang.asm / How to modify values placed on the stack?

SubjectAuthor
* How to modify values placed on the stack?Mateusz Viste
`* Re: How to modify values placed on the stack?JJ
 +* Re: How to modify values placed on the stack?Mateusz Viste
 |+* Re: How to modify values placed on the stack?rick.c.hodgin
 ||`* Re: How to modify values placed on the stack?Mateusz Viste
 || `* Re: How to modify values placed on the stack?Rick C. Hodgin
 ||  `* Re: How to modify values placed on the stack?Mateusz Viste
 ||   +- Re: How to modify values placed on the stack?Rick C. Hodgin
 ||   `* Re: How to modify values placed on the stack?src153
 ||    `- Re: How to modify values placed on the stack?Rick C. Hodgin
 |`* Re: How to modify values placed on the stack?Robert Wessel
 | `* Re: How to modify values placed on the stack?Mateusz Viste
 |  +* Re: How to modify values placed on the stack?src153
 |  |`- Re: How to modify values placed on the stack?Mateusz Viste
 |  `* Re: How to modify values placed on the stack?src153
 |   `* Re: How to modify values placed on the stack?Mateusz Viste
 |    `- Re: How to modify values placed on the stack?src153
 `* Re: How to modify values placed on the stack?Rod Pemberton
  +* Re: How to modify values placed on the stack?src153
  |+* Re: How to modify values placed on the stack?src153
  ||`* Re: How to modify values placed on the stack?Mateusz Viste
  || +- Re: How to modify values placed on the stack?Rick C. Hodgin
  || `* Re: How to modify values placed on the stack?src153
  ||  `- Re: How to modify values placed on the stack?src153
  |`* Re: How to modify values placed on the stack?Rod Pemberton
  | `* Re: How to modify values placed on the stack?src153
  |  `- Re: How to modify values placed on the stack?rick.c.hodgin
  +* Re: How to modify values placed on the stack?Mateusz Viste
  |`* Re: How to modify values placed on the stack?src153
  | `* Re: How to modify values placed on the stack?Mateusz Viste
  |  +* Re: How to modify values placed on the stack?Rick C. Hodgin
  |  |+* Re: How to modify values placed on the stack?Mateusz Viste
  |  ||`- Re: How to modify values placed on the stack?Rick C. Hodgin
  |  |`* Re: How to modify values placed on the stack?Rod Pemberton
  |  | `* Re: How to modify values placed on the stack?src153
  |  |  +* Re: How to modify values placed on the stack?Mateusz Viste
  |  |  |`* Re: How to modify values placed on the stack?src153
  |  |  | `* Re: How to modify values placed on the stack?Mateusz Viste
  |  |  |  +* Re: How to modify values placed on the stack?Kerr-Mudd,John
  |  |  |  |+* Re: How to modify values placed on the stack?Mateusz Viste
  |  |  |  ||`* Re: How to modify values placed on the stack?Kerr-Mudd,John
  |  |  |  || `* Re: How to modify values placed on the stack?Mateusz Viste
  |  |  |  ||  `* Re: How to modify values placed on the stack?Martin Str|mberg
  |  |  |  ||   `- Re: How to modify values placed on the stack?Martin Str|mberg
  |  |  |  |`* Re: How to modify values placed on the stack?Martin Str|mberg
  |  |  |  | `* Re: How to modify values placed on the stack?Kerr-Mudd,John
  |  |  |  |  `- Re: How to modify values placed on the stack?Martin Str|mberg
  |  |  |  +- Re: How to modify values placed on the stack?src153
  |  |  |  +- Re: How to modify values placed on the stack?vit$oft
  |  |  |  `* Re: How to modify values placed on the stack?vit$oft
  |  |  |   `- Re: How to modify values placed on the stack?Kerr-Mudd,John
  |  |  +* Re: How to modify values placed on the stack?Rod Pemberton
  |  |  |+- Re: How to modify values placed on the stack?src153
  |  |  |`- Re: How to modify values placed on the stack?Robert Wessel
  |  |  `- Re: How to modify values placed on the stack?Rod Pemberton
  |  `* Re: How to modify values placed on the stack?src153
  |   `* Re: How to modify values placed on the stack?Mateusz Viste
  |    +* Re: How to modify values placed on the stack?Ned Latham
  |    |`* Re: How to modify values placed on the stack?Rod Pemberton
  |    | `* Re: How to modify values placed on the stack?Robert Wessel
  |    |  `* Re: How to modify values placed on the stack?Rod Pemberton
  |    |   `- Re: How to modify values placed on the stack?src153
  |    `* Re: How to modify values placed on the stack?Robert Wessel
  |     `* Re: How to modify values placed on the stack?Mateusz Viste
  |      `- Re: How to modify values placed on the stack?Robert Wessel
  `- Re: How to modify values placed on the stack?JJ

Pages:123
Subject: How to modify values placed on the stack?
From: Mateusz Viste
Newsgroups: alt.lang.asm
Organization: Guest of ProXad - France
Date: Fri, 27 Sep 2019 14:15 UTC
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!proxad.net!feeder1-2.proxad.net!cleanfeed3-b.proxad.net!nnrp3-1.free.fr!not-for-mail
From: mate...@wont.tell (Mateusz Viste)
Subject: How to modify values placed on the stack?
Newsgroups: alt.lang.asm
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: 27 Sep 2019 14:15:05 GMT
Lines: 42
Message-ID: <5d8e1968$0$20332$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 27 Sep 2019 16:15:05 CEST
NNTP-Posting-Host: 82.64.0.151
X-Trace: 1569593705 news-3.free.fr 20332 82.64.0.151:39640
X-Complaints-To: abuse@proxad.net
View all headers
Let's assume that I have something on my stack, at a known position. I
would like to modify this value. How would you do it?
Practical context: setting CF from within an interrupt handler.

Initially, I tried this:

  ; resets the last bit of the 3rd word on the stack
  and [ss:sp+4], word 0xFFFE
  iret

....but this won't assemble. It appears that it is not possible to use SP
as an address offset on an 8086. So instead, I used BX:

  ; resets the last bit of the 3rd word on the stack
  push bx              ; save BX
  mov bx, sp
  and [ss:bx+6], word 0xFFFE
  pop bx               ; restore original BX value
  iret

This solution is ugly, because it uses the stack - and that's something
I'd rather avoid. An alternative would be to save the original BX value
somewhere in memory:

  ; resets the last bit of the 3rd word on the stack
  jmp short SKIPBXBACKUP
  BXBACKUP dw 0                 ; place-holder for BX backup

  SKIPBXBACKUP:
  mov [cs:BXBACKUP], bx         ; save BX
  mov bx, sp
  and [ss:bx+4], word 0xFFFE
  mov, bx, [cs:BXBACKUP]        ; restore original BX value
  iret

I like it more, as it doesn't rely on the stack to modify the stack, but
I still find it ugly - so much fuss just to modify a single bit in memory.

Is there a smaller, faster way to achieve the same effect?


Mateusz


Subject: Re: How to modify values placed on the stack?
From: JJ
Newsgroups: alt.lang.asm
Organization: albasani.net
Date: Fri, 27 Sep 2019 15:03 UTC
References: 1
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!news.albasani.net!.POSTED!not-for-mail
From: jj4pub...@vfemail.net (JJ)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Fri, 27 Sep 2019 22:03:53 +0700
Organization: albasani.net
Lines: 54
Message-ID: <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
X-Trace: news.albasani.net A2BdXKycVppSXSp7BDB62l6B8cDWLmsc2vU7TzTlFsMgmauuGzsiAXcJqqHeIPsOE40nkuLuDL5xvaw5O7verw==
NNTP-Posting-Date: Fri, 27 Sep 2019 15:03:53 +0000 (UTC)
Injection-Info: news.albasani.net; logging-data="3AEAiyDWI4YzhS3owrubnKk2eOFiTnNBhMssibLQn40nXcfBfbYJ6qh8t9n/GJKl/09FY6i+HTJhIAlmhDQn9Aq8UCo+jRHihhty0mjxhlQJTweov2IQqpRfXXoqeVKH"; mail-complaints-to="abuse@albasani.net"
User-Agent: 40tude_Dialog/2.0.15.84
X-Bitcoin: 1LcqwCQBQmhcWfWsVEAeyLchkAY8ZfuMnS
X-Face: \*\`0(1j~VfYC>ebz[&O.]=,Nm\oRM{of,liRO#7Eqi4|!]!(Gs=Akgh{J)605>C9Air?pa d{sSZ09u+A7f<^paR"/NH_#<mE1S"hde\c6PZLUB[t/s5-+Iu5DSc?P0+4%,Hl
Cancel-Lock: sha1:MQprRUiTw5EF/8l/6t4facC4YRg=
View all headers
On 27 Sep 2019 14:15:05 GMT, Mateusz Viste wrote:

Let's assume that I have something on my stack, at a known position. I
would like to modify this value. How would you do it?
Practical context: setting CF from within an interrupt handler.

Initially, I tried this:

  ; resets the last bit of the 3rd word on the stack
  and [ss:sp+4], word 0xFFFE
  iret

....but this won't assemble. It appears that it is not possible to use SP
as an address offset on an 8086. So instead, I used BX:

  ; resets the last bit of the 3rd word on the stack
  push bx              ; save BX
  mov bx, sp
  and [ss:bx+6], word 0xFFFE
  pop bx               ; restore original BX value
  iret

This solution is ugly, because it uses the stack - and that's something
I'd rather avoid. An alternative would be to save the original BX value
somewhere in memory:

  ; resets the last bit of the 3rd word on the stack
  jmp short SKIPBXBACKUP
  BXBACKUP dw 0                 ; place-holder for BX backup

  SKIPBXBACKUP:
  mov [cs:BXBACKUP], bx         ; save BX
  mov bx, sp
  and [ss:bx+4], word 0xFFFE
  mov, bx, [cs:BXBACKUP]        ; restore original BX value
  iret

I like it more, as it doesn't rely on the stack to modify the stack, but
I still find it ugly - so much fuss just to modify a single bit in memory.

Is there a smaller, faster way to achieve the same effect?

Mateusz

Because 16-bit instruction can not use SP for memory access, you have no
choice but to use use other register.

For accessing the stack, I'd suggest using BP, so the SS segment override
won't be needed. And save BP into stack. These will shorten the code. e.g.

  push bp
  mov bp, sp
  mov [bp+4], WORD 0xFFFe
  pop bp


Subject: Re: How to modify values placed on the stack?
From: Mateusz Viste
Newsgroups: alt.lang.asm
Organization: Guest of ProXad - France
Date: Fri, 27 Sep 2019 19:54 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!proxad.net!feeder1-2.proxad.net!cleanfeed2-b.proxad.net!nnrp4-1.free.fr!not-for-mail
From: mate...@wont.tell (Mateusz Viste)
Subject: Re: How to modify values placed on the stack?
Newsgroups: alt.lang.asm
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: 27 Sep 2019 19:54:52 GMT
Lines: 30
Message-ID: <5d8e690c$0$15197$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 27 Sep 2019 21:54:52 CEST
NNTP-Posting-Host: 82.64.0.151
X-Trace: 1569614092 news-3.free.fr 15197 82.64.0.151:42150
X-Complaints-To: abuse@proxad.net
View all headers
On Fri, 27 Sep 2019 22:03:53 +0700, JJ wrote:
Because 16-bit instruction can not use SP for memory access, you have no
choice but to use use other register.

For accessing the stack, I'd suggest using BP, so the SS segment
override won't be needed. And save BP into stack. These will shorten the
code. e.g.

  push bp
  mov bp, sp
  mov [bp+4], WORD 0xFFFe
  pop bp

Thanks for the suggestion - it is shorter by one byte indeed. I really
don't like using the stack in an int handler, though - even if that's
only two bytes, I do not control the stack at entry point, so it may very
well be completely full already. Seems my only alternative is to save BP
in memory, so the "best" version would be this:

BPSAVE dw 0

ENTRYPOINT:
mov [BPSAVE], bp         ; save BP
mov bp, sp
and [bp+4], word 0xFFFE  ; reset CF stored on stack
mov bp, [BPSAVE]         ; restore BP
iret


Mateusz


Subject: Re: How to modify values placed on the stack?
From: rick.c.h...@gmail.com
Newsgroups: alt.lang.asm
Date: Fri, 27 Sep 2019 20:05 UTC
References: 1 2 3
X-Received: by 2002:a37:6190:: with SMTP id v138mr6776207qkb.12.1569614739814;
Fri, 27 Sep 2019 13:05:39 -0700 (PDT)
X-Received: by 2002:a25:d6cc:: with SMTP id n195mr7412805ybg.214.1569614739592;
Fri, 27 Sep 2019 13:05:39 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.am4!peer.am4.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!o24no5608347qtl.0!news-out.google.com!q23ni1237qtl.1!nntp.google.com!o24no5608326qtl.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups: alt.lang.asm
Date: Fri, 27 Sep 2019 13:05:39 -0700 (PDT)
In-Reply-To: <5d8e690c$0$15197$426a74cc@news.free.fr>
Complaints-To: groups-abuse@google.com
Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=2601:800:c002:abc2:69a9:2c30:2d81:5772;
posting-account=BcpLkAoAAACbVwkzAAKP0XXOd-MDREpp
NNTP-Posting-Host: 2601:800:c002:abc2:69a9:2c30:2d81:5772
References: <5d8e1968$0$20332$426a74cc@news.free.fr> <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
<5d8e690c$0$15197$426a74cc@news.free.fr>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <a8d43645-9f24-4cc7-9ebd-b478a5758294@googlegroups.com>
Subject: Re: How to modify values placed on the stack?
From: rick.c.h...@gmail.com
Injection-Date: Fri, 27 Sep 2019 20:05:39 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 3742
X-Received-Body-CRC: 3886357647
View all headers
On Friday, September 27, 2019 at 3:54:53 PM UTC-4, Mateusz Viste wrote:
On Fri, 27 Sep 2019 22:03:53 +0700, JJ wrote:
Because 16-bit instruction can not use SP for memory access, you have no
choice but to use use other register.

For accessing the stack, I'd suggest using BP, so the SS segment
override won't be needed. And save BP into stack. These will shorten the
code. e.g.

  push bp
  mov bp, sp
  mov [bp+4], WORD 0xFFFe
  pop bp

Thanks for the suggestion - it is shorter by one byte indeed. I really
don't like using the stack in an int handler, though - even if that's
only two bytes, I do not control the stack at entry point, so it may very
well be completely full already. Seems my only alternative is to save BP
in memory, so the "best" version would be this:

BPSAVE dw 0

ENTRYPOINT:
mov [BPSAVE], bp         ; save BP
mov bp, sp
and [bp+4], word 0xFFFE  ; reset CF stored on stack
mov bp, [BPSAVE]         ; restore BP
iret

Hi Mateusz,

If you're on the 8086/8088 only, you can use BP to reference
the stack without the SS: prefix.  The syntax for MASM is to
put the stack component before the square brackets, as in:

    mov     ax,ss:[bp+4]

If you use bp it has an implied association with the stack
segment for that very reason (to save code space).  So, you
can simply do:

    mov     ax,[bp+4]

And it will work just fine.

If you move to the 80386 instruction set, you now have a
much wider range of possibilities.  There, the esp and ebp
registers are associated with the stack segment by default,
and you can use them as needed..

Using bp for a stack frame is a good idea on the 8086/8088/
80186/80286, and real mode code.  When you get to the 80386
and higher in protected mode, you no longer need the ebp reg
for a stack frame because you can directly reference through
[esp], which you should also know the value of, which then
gives you one additional register for use in your code.

Consider migrating your projects to the 80386 if you are on
the 8086/8088.  You can make a version that only supports a
flat mode, but the opcodes it provides you, the access to
additional memory, the ability to process 32-bits at a time...
it is a winning combination.

--
Rick C. Hodgin


Subject: Re: How to modify values placed on the stack?
From: Mateusz Viste
Newsgroups: alt.lang.asm
Organization: Guest of ProXad - France
Date: Fri, 27 Sep 2019 20:21 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!proxad.net!feeder1-2.proxad.net!cleanfeed2-a.proxad.net!nnrp1-2.free.fr!not-for-mail
From: mate...@wont.tell (Mateusz Viste)
Subject: Re: How to modify values placed on the stack?
Newsgroups: alt.lang.asm
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
<5d8e690c$0$15197$426a74cc@news.free.fr>
<a8d43645-9f24-4cc7-9ebd-b478a5758294@googlegroups.com>
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: 27 Sep 2019 20:21:16 GMT
Lines: 25
Message-ID: <5d8e6f3c$0$31420$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 27 Sep 2019 22:21:16 CEST
NNTP-Posting-Host: 82.64.0.151
X-Trace: 1569615676 news-3.free.fr 31420 82.64.0.151:42520
X-Complaints-To: abuse@proxad.net
View all headers
On Fri, 27 Sep 2019 13:05:39 -0700, rick.c.hodgin wrote:
If you're on the 8086/8088 only, you can use BP to reference the stack
without the SS: prefix.

Yes, that's exactly what JJ suggested, and that's what I did in my
updated ("best") version.

If you use bp it has an implied association with the stack segment for
that very reason (to save code space).

As soon as JJ posted his answer, I looked it up in my assembly book and
found that very same explanation. I didn't know that peculiarity of BP
before (but I'm no ASM guru, obviously - it's only a hobby). Nonetheless,
thanks for the additional explanation.

If you move to the 80386 instruction set, you now have a much wider
range of possibilities. (...) it is a winning combination.

I understand your point, and it's perfectly valid in any business
environment ("upgrade hardware"). But not in this specific case - my
"project" is retro-computing, the whole point is to create 8086
compatible code, that's what makes it fun. And that's why I reach to
assembly.

Mateusz


Subject: Re: How to modify values placed on the stack?
From: Rick C. Hodgin
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Fri, 27 Sep 2019 20:32 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Fri, 27 Sep 2019 16:32:57 -0400
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <qmlrlp$a7i$1@dont-email.me>
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
<5d8e690c$0$15197$426a74cc@news.free.fr>
<a8d43645-9f24-4cc7-9ebd-b478a5758294@googlegroups.com>
<5d8e6f3c$0$31420$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 27 Sep 2019 20:32:57 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="09c5c346a50ce69c1905b7a9f4e289de";
logging-data="10482"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+rMJFFDIct7vhyPWF/1igExCPCd8CvSrQ="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:bkrMP0uw7mSKxzFP5v13vF90ULM=
In-Reply-To: <5d8e6f3c$0$31420$426a74cc@news.free.fr>
Content-Language: en-US
View all headers
On 9/27/2019 4:21 PM, Mateusz Viste wrote:
On Fri, 27 Sep 2019 13:05:39 -0700, rick.c.hodgin wrote:
If you're on the 8086/8088 only, you can use BP to reference the stack
without the SS: prefix.

Yes, that's exactly what JJ suggested, and that's what I did in my
updated ("best") version.

If you use bp it has an implied association with the stack segment for
that very reason (to save code space).

As soon as JJ posted his answer, I looked it up in my assembly book and
found that very same explanation. I didn't know that peculiarity of BP
before (but I'm no ASM guru, obviously - it's only a hobby). Nonetheless,
thanks for the additional explanation.

If you move to the 80386 instruction set, you now have a much wider
range of possibilities. (...) it is a winning combination.

I understand your point, and it's perfectly valid in any business
environment ("upgrade hardware"). But not in this specific case - my
"project" is retro-computing, the whole point is to create 8086
compatible code, that's what makes it fun. And that's why I reach to
assembly.

Mateusz, something to consider:

     8086/8088 -- Released 1978
     80386     -- Released 1985

Only 7 years separates the original 8086/8088, and the 80386
introduction.  You could still go retro if you limited your
design to the original 16 MHz 80836 CPU.  Also, the 80386 set
of assembly instructions is reduced compared to what we saw
on the 80486, Pentium, and later CPUs.  It is missing a few
that are oft used today, so it still has that limiting retro
feel.

And, by the way, I wholeheartedly admire and support your
desire to follow after the retro technology.  I wish you the
greatest success!

--
Rick C. Hodgin


Subject: Re: How to modify values placed on the stack?
From: Mateusz Viste
Newsgroups: alt.lang.asm
Organization: Guest of ProXad - France
Date: Fri, 27 Sep 2019 21:02 UTC
References: 1 2 3 4 5 6
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed3-a.proxad.net!nnrp1-2.free.fr!not-for-mail
From: mate...@wont.tell (Mateusz Viste)
Subject: Re: How to modify values placed on the stack?
Newsgroups: alt.lang.asm
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
<5d8e690c$0$15197$426a74cc@news.free.fr>
<a8d43645-9f24-4cc7-9ebd-b478a5758294@googlegroups.com>
<5d8e6f3c$0$31420$426a74cc@news.free.fr> <qmlrlp$a7i$1@dont-email.me>
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: 27 Sep 2019 21:02:15 GMT
Lines: 40
Message-ID: <5d8e78d7$0$31420$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 27 Sep 2019 23:02:15 CEST
NNTP-Posting-Host: 82.64.0.151
X-Trace: 1569618135 news-3.free.fr 31420 82.64.0.151:42520
X-Complaints-To: abuse@proxad.net
View all headers
On Fri, 27 Sep 2019 16:32:57 -0400, Rick C. Hodgin wrote:
Mateusz, something to consider:

     8086/8088 -- Released 1978
     80386     -- Released 1985

Only 7 years separates the original 8086/8088, and the 80386
introduction.  You could still go retro if you limited your design to
the original 16 MHz 80836 CPU.

Again - you are certainly correct. But again - hobby. Must be 8086.

More of the story: I am currently working on a driver that emulates a
network-backed floppy drive. The driver is actually done and works very
well, I have yet a few tests to run before publishing it, and I am also
trying to optimize a few details here and there. I was initially hoping
to fit it under 2K, but so far it still requires 2112 bytes of RAM, seems
like it will have to be good enough (there are ways that could make it
smaller, but it would seriously mess up the source code, and that I want
to avoid). It is worth noting that out of the 2112 bytes of memory
footprint, 700 is dedicated for stack and 600 is holding a packet buffer,
so the "real" code is about 800 bytes.

The objective being - the floppy drive on my Toshiba 8086 laptop (T1100)
is slowly dying, so I try to use it only for boot, and nothing else. Some
time ago I created EtherDFS so I could hook the laptop to a multi-
gigabytes NAS: http://etherdfs.sourceforge.net/
And it's cool, but it's a little bit of a cow - requires 7K of RAM.
That's almost 4% of the available (free) memory on this PC. I figured
that a block-level diskette emulator would also solve my needs, while
being much smaller.

All this to say - no, I will not trash my 8086 laptop. I will continue
wasting time developing code for it, so I can continue fiddling with it,
so it continues giving me more reasons to waste time over it... :-)

Mateusz
--
"I am not the only person who uses his computer mainly for the purpose of
diddling with his computer."  -- Dave Barry


Subject: Re: How to modify values placed on the stack?
From: Rick C. Hodgin
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Fri, 27 Sep 2019 21:27 UTC
References: 1 2 3 4 5 6 7
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Fri, 27 Sep 2019 17:27:24 -0400
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <qmluru$sip$1@dont-email.me>
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
<5d8e690c$0$15197$426a74cc@news.free.fr>
<a8d43645-9f24-4cc7-9ebd-b478a5758294@googlegroups.com>
<5d8e6f3c$0$31420$426a74cc@news.free.fr> <qmlrlp$a7i$1@dont-email.me>
<5d8e78d7$0$31420$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 27 Sep 2019 21:27:26 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="09c5c346a50ce69c1905b7a9f4e289de";
logging-data="29273"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/5YvKaBcujyELS4GZXVrZAPmwbVEGbj+0="
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:nygayjaQSKLiyzzuycqpHr5pQvw=
In-Reply-To: <5d8e78d7$0$31420$426a74cc@news.free.fr>
Content-Language: en-US
View all headers
On 9/27/2019 5:02 PM, Mateusz Viste wrote:
On Fri, 27 Sep 2019 16:32:57 -0400, Rick C. Hodgin wrote:
Mateusz, something to consider:

      8086/8088 -- Released 1978
      80386     -- Released 1985

Only 7 years separates the original 8086/8088, and the 80386
introduction.  You could still go retro if you limited your design to
the original 16 MHz 80836 CPU.

Again - you are certainly correct. But again - hobby. Must be 8086.

Understand.  And I support your goal.  Just wanted to make sure you
recognize the difference between the 8086 and 80386.  The step for-
ward was a masterpiece.  To maintain full backward compatibility,
and to extend the ISA into a totally new realm with far more flexi-
bility ... genius across the board.

More of the story: I am currently working on a driver that emulates a
network-backed floppy drive. The driver is actually done and works very
well, I have yet a few tests to run before publishing it, and I am also
trying to optimize a few details here and there. I was initially hoping
to fit it under 2K, but so far it still requires 2112 bytes of RAM, seems
like it will have to be good enough (there are ways that could make it
smaller, but it would seriously mess up the source code, and that I want
to avoid). It is worth noting that out of the 2112 bytes of memory
footprint, 700 is dedicated for stack and 600 is holding a packet buffer,
so the "real" code is about 800 bytes.

Tight.  Sounds good.  I expect Kerr to soon post a 582 byte version
saying that's as small as he could get it. :-)

The objective being - the floppy drive on my Toshiba 8086 laptop (T1100)
is slowly dying, so I try to use it only for boot, and nothing else. Some
time ago I created EtherDFS so I could hook the laptop to a multi-
gigabytes NAS: http://etherdfs.sourceforge.net/
And it's cool, but it's a little bit of a cow - requires 7K of RAM.
That's almost 4% of the available (free) memory on this PC. I figured
that a block-level diskette emulator would also solve my needs, while
being much smaller.

All this to say - no, I will not trash my 8086 laptop. I will continue
wasting time developing code for it, so I can continue fiddling with it,
so it continues giving me more reasons to waste time over it... :-)

It's not wasting if it's your hobby.  Gibbs built boats in his
basement.  People do all manner of interesting things.

I fully support your goals.  And I enjoy reading about them.

--
Rick C. Hodgin


Subject: Re: How to modify values placed on the stack?
From: Robert Wessel
Newsgroups: alt.lang.asm
Organization: Forte - www.forteinc.com
Date: Fri, 27 Sep 2019 21:55 UTC
References: 1 2 3
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!newsreader4.netcologne.de!news.netcologne.de!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!85.12.16.68.MISMATCH!peer01.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.fr7!futter-mich.highwinds-media.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx03.iad.POSTED!not-for-mail
From: robertwe...@yahoo.com (Robert Wessel)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Message-ID: <ik0toehtgeir5co6fduqgntot1q95tesp6@4ax.com>
References: <5d8e1968$0$20332$426a74cc@news.free.fr> <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <5d8e690c$0$15197$426a74cc@news.free.fr>
User-Agent: ForteAgent/7.20.32.1218
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Lines: 47
X-Complaints-To: abuse@easynews.com
Organization: Forte - www.forteinc.com
X-Complaints-Info: Please be sure to forward a copy of ALL headers otherwise we will be unable to process your complaint properly.
Date: Fri, 27 Sep 2019 16:55:00 -0500
X-Received-Bytes: 2740
X-Received-Body-CRC: 3041111514
X-Original-Bytes: 2443
View all headers
On 27 Sep 2019 19:54:52 GMT, Mateusz Viste <mateusz@wont.tell> wrote:

On Fri, 27 Sep 2019 22:03:53 +0700, JJ wrote:
Because 16-bit instruction can not use SP for memory access, you have no
choice but to use use other register.

For accessing the stack, I'd suggest using BP, so the SS segment
override won't be needed. And save BP into stack. These will shorten the
code. e.g.

  push bp
  mov bp, sp
  mov [bp+4], WORD 0xFFFe
  pop bp

Thanks for the suggestion - it is shorter by one byte indeed. I really
don't like using the stack in an int handler, though - even if that's
only two bytes, I do not control the stack at entry point, so it may very
well be completely full already. Seems my only alternative is to save BP
in memory, so the "best" version would be this:

BPSAVE dw 0

ENTRYPOINT:
mov [BPSAVE], bp         ; save BP
mov bp, sp
and [bp+4], word 0xFFFE  ; reset CF stored on stack
mov bp, [BPSAVE]         ; restore BP
iret


Is this the entire interrupt handler?  If so, needing one extra word
of space on the stack is typically not going to be an issue - most
interrupt handlers assume considerably more room than that.

If this is really a longer routine, and you're worried about stack
space, switch to a private stack at entry, and switch back just before
returning.  You'll have all the stack space you want.

Or redefine the API* so that it puts a return code in a register, then
use that register to save BP during the carry flag modification, and
then plunk a zero (or whatever) into there for the return code.


*Clearly this is for an API, and not a hardware interrupt, modifying
the saved  carry for a hardware interrupt would be a bad thing,
besides, you're doing an EOI.


Subject: Re: How to modify values placed on the stack?
From: Mateusz Viste
Newsgroups: alt.lang.asm
Organization: Guest of ProXad - France
Date: Sat, 28 Sep 2019 00:12 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed3-a.proxad.net!nnrp4-2.free.fr!not-for-mail
From: mate...@wont.tell (Mateusz Viste)
Subject: Re: How to modify values placed on the stack?
Newsgroups: alt.lang.asm
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
<5d8e690c$0$15197$426a74cc@news.free.fr>
<ik0toehtgeir5co6fduqgntot1q95tesp6@4ax.com>
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: 28 Sep 2019 00:12:35 GMT
Lines: 46
Message-ID: <5d8ea573$0$6455$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 28 Sep 2019 02:12:35 CEST
NNTP-Posting-Host: 82.64.0.151
X-Trace: 1569629555 news-3.free.fr 6455 82.64.0.151:43876
X-Complaints-To: abuse@proxad.net
View all headers
On Fri, 27 Sep 2019 16:55:00 -0500, Robert Wessel wrote:

Is this the entire interrupt handler?

I only provided here the short extract that was needed to demonstrate the
issue at hand (modifying a value on stack). I didn't want to complicate
things unnecessarily.

 If so, needing one extra word of space on the stack is typically not
going to be an issue - most interrupt handlers assume considerably more
room than that.

It may or may not be an issue. While I agree that it is statistically
unlikely to happen, it still is something I can't predict. I do not know
what kind of application will run at the time my interrupt handler is
called - this application might very well be crazy enough to have
tailored its stack very tightly. The interrupt process itself will
consume a few bytes already, putting IP, CS and flags on stack. Not sure
what will be left - if anything - for me. If I'm out of luck, it will be
zero bytes and with a single push I will wreak havoc.

If this is really a longer routine, and you're worried about stack
space, switch to a private stack at entry, and switch back just before
returning.  You'll have all the stack space you want.

I am doing that, but it's beside the point. At the time I need to modify
the carry flag, my private stack is not yet in action. Are you suggesting
I could switch to my private stack earlier, and THEN modify the value on
the previous stack? Well, yes indeed I could, but that's even more messy
than the solution I have worked out (and improved with JJ's help) so far.

Or redefine the API* so that it puts a return code in a register, then
use that register to save BP during the carry flag modification, and
then plunk a zero (or whatever) into there for the return code.

I cannot redefine the API, it has been around for 40 years already: this
is about an int 13h handler. The idea of misusing the return code
register as temporary storage for BP won't work either, since the result
is returned through AH. That's 8 bits too short.

I understand now, after all the replies of this thread, that - yet again
- I was expecting too much from the 8086 design. The problem I have
simply has no "good" solution - one must accept some amount of ugliness
in one form or another.

Mateusz


Subject: Re: How to modify values placed on the stack?
From: src153
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Sat, 28 Sep 2019 13:29 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: src...@protocol.invalid (src153)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Sat, 28 Sep 2019 13:29:48 +0000
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <d4nuoelbq99hsqponpdq7j0vqp8vg3uk57@4ax.com>
References: <5d8e1968$0$20332$426a74cc@news.free.fr> <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <5d8e690c$0$15197$426a74cc@news.free.fr> <ik0toehtgeir5co6fduqgntot1q95tesp6@4ax.com> <5d8ea573$0$6455$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="fe448c738bcaa98120abdb26de0a5346";
logging-data="16986"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/LRhb9Vh+JehAxRHRzBLaAtsXGKeW8X1I="
Cancel-Lock: sha1:lH/LknIVp6fEP9xVNPaC7qSVLCE=
X-Newsreader: Forte Agent 1.93/32.576 English (American)
View all headers
On 28 Sep 2019 00:12:35 GMT, Mateusz Viste wrote:

I cannot redefine the API, it has been around for 40 years already: this
is about an int 13h handler.

What does your int13 handler do? Just curious.


I understand now, after all the replies of this thread, that - yet again
- I was expecting too much from the 8086 design.

Microsoft C has stack overflow checking code, but they say disable it
for interrupt handlers.

On 8086 that's as good as it gets.




Subject: Re: How to modify values placed on the stack?
From: src153
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Sat, 28 Sep 2019 14:20 UTC
References: 1 2 3 4 5 6 7
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: src...@protocol.invalid (src153)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Sat, 28 Sep 2019 14:20:59 +0000
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <liquoe1hsv3srpdqc20g0ii6tq8dnruh3k@4ax.com>
References: <5d8e1968$0$20332$426a74cc@news.free.fr> <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <5d8e690c$0$15197$426a74cc@news.free.fr> <a8d43645-9f24-4cc7-9ebd-b478a5758294@googlegroups.com> <5d8e6f3c$0$31420$426a74cc@news.free.fr> <qmlrlp$a7i$1@dont-email.me> <5d8e78d7$0$31420$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="fe448c738bcaa98120abdb26de0a5346";
logging-data="3331"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18RyQH9FdESk56UoPF7O6VJoXU1UWoraXE="
Cancel-Lock: sha1:fgnjdr0/eKHWXtS/Vwiw6ss1t3I=
X-Newsreader: Forte Agent 1.93/32.576 English (American)
View all headers
On 27 Sep 2019 21:02:15 GMT, Mateusz Viste wrote:

On Fri, 27 Sep 2019 16:32:57 -0400, Rick C. Hodgin wrote:
Mateusz, something to consider:

     8086/8088 -- Released 1978
     80386     -- Released 1985

Only 7 years separates the original 8086/8088, and the 80386
introduction.  You could still go retro if you limited your design to
the original 16 MHz 80836 CPU.

Tricky Ricky. The 386 cost a small fortune at introduction. There was a
lot of life left in the 8086 market. The market winners had to get going
in those early years. By 1990 it was too late. Timing was everything.


Again - you are certainly correct. But again - hobby. Must be 8086.

Never mind my question about your handler. I skipped that post earlier,
but I see it now.




Subject: Re: How to modify values placed on the stack?
From: src153
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Sun, 29 Sep 2019 13:21 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: src...@protocol.invalid (src153)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Sun, 29 Sep 2019 13:21:21 +0000
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <u1b1pelc8onksi1v8h11j5d2b3su0ffbgj@4ax.com>
References: <5d8e1968$0$20332$426a74cc@news.free.fr> <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <5d8e690c$0$15197$426a74cc@news.free.fr> <ik0toehtgeir5co6fduqgntot1q95tesp6@4ax.com> <5d8ea573$0$6455$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="3e189aef6d3e884e015bb1bb8a4935cc";
logging-data="12281"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19IFRdcspIeeDoAv8ma+USxRUYNOcv3qqQ="
Cancel-Lock: sha1:2gtUzPkXUCQ3ECDlP5XBmnYOKEM=
X-Newsreader: Forte Agent 1.93/32.576 English (American)
View all headers
On 28 Sep 2019 00:12:35 GMT, Mateusz Viste wrote:

If so, needing one extra word of space on the stack is typically not
going to be an issue - most interrupt handlers assume considerably more
room than that.

It may or may not be an issue. While I agree that it is statistically
unlikely to happen, it still is something I can't predict. I do not know
what kind of application will run at the time my interrupt handler is
called - this application might very well be crazy enough to have
tailored its stack very tightly. The interrupt process itself will
consume a few bytes already, putting IP, CS and flags on stack. Not sure
what will be left - if anything - for me. If I'm out of luck, it will be
zero bytes and with a single push I will wreak havoc.

Defensive programming is good. Programmers should.

But why worry about 2 extra bytes of stack space for BP. Any application
providing less, I would consider broken and not use it.

You can't know everything (Heisenberg).




Subject: Re: How to modify values placed on the stack?
From: Mateusz Viste
Newsgroups: alt.lang.asm
Organization: Guest of ProXad - France
Date: Sun, 29 Sep 2019 19:33 UTC
References: 1 2 3 4 5 6
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed2-a.proxad.net!nnrp4-2.free.fr!not-for-mail
From: mate...@wont.tell (Mateusz Viste)
Subject: Re: How to modify values placed on the stack?
Newsgroups: alt.lang.asm
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
<5d8e690c$0$15197$426a74cc@news.free.fr>
<ik0toehtgeir5co6fduqgntot1q95tesp6@4ax.com>
<5d8ea573$0$6455$426a74cc@news.free.fr>
<d4nuoelbq99hsqponpdq7j0vqp8vg3uk57@4ax.com>
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: 29 Sep 2019 19:33:55 GMT
Lines: 17
Message-ID: <5d910723$0$6452$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 29 Sep 2019 21:33:55 CEST
NNTP-Posting-Host: 82.64.0.151
X-Trace: 1569785635 news-1.free.fr 6452 82.64.0.151:55356
X-Complaints-To: abuse@proxad.net
View all headers
On Sat, 28 Sep 2019 13:29:48 +0000, src153 wrote:

On 28 Sep 2019 00:12:35 GMT, Mateusz Viste wrote:

I cannot redefine the API, it has been around for 40 years already: this
is about an int 13h handler.

What does your int13 handler do? Just curious.

You found the answer already, but nonetheless - should anyone be curious
about the implementation, here it is:
  https://sourceforge.net/p/ethflop/code/HEAD/tree/trunk/ethflop.asm

I still need to perform a few tests before publishing a formal version,
but so far things look very good, so I'm not expecting major changes.

Mateusz


Subject: Re: How to modify values placed on the stack?
From: Mateusz Viste
Newsgroups: alt.lang.asm
Organization: Guest of ProXad - France
Date: Sun, 29 Sep 2019 19:39 UTC
References: 1 2 3 4 5 6
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!cleanfeed3-a.proxad.net!nnrp4-2.free.fr!not-for-mail
From: mate...@wont.tell (Mateusz Viste)
Subject: Re: How to modify values placed on the stack?
Newsgroups: alt.lang.asm
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
<5d8e690c$0$15197$426a74cc@news.free.fr>
<ik0toehtgeir5co6fduqgntot1q95tesp6@4ax.com>
<5d8ea573$0$6455$426a74cc@news.free.fr>
<u1b1pelc8onksi1v8h11j5d2b3su0ffbgj@4ax.com>
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: 29 Sep 2019 19:39:52 GMT
Lines: 19
Message-ID: <5d910888$0$6452$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 29 Sep 2019 21:39:52 CEST
NNTP-Posting-Host: 82.64.0.151
X-Trace: 1569785992 news-1.free.fr 6452 82.64.0.151:55356
X-Complaints-To: abuse@proxad.net
View all headers
On Sun, 29 Sep 2019 13:21:21 +0000, src153 wrote:

But why worry about 2 extra bytes of stack space for BP. Any application
providing less, I would consider broken and not use it.

Indeed, but let me ask this: are there any formal rules stating how much
stack an application must make sure to leave free for potential interrupt
handlers? 6 bytes is enough for the CPU to perform process the interrupt.

But even considering your statement as true (application providing less
than 8 bytes of available stack = bad, broken), the user point of view
may differ. What the user would see is: as soon as I run this shitty TSR,
the Awesome Application(tm) crashes.

You can't know everything (Heisenberg).

This was 100 years ago. They didn't had TSRs yet. :)

Mateusz


Subject: Re: How to modify values placed on the stack?
From: src153
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Sun, 29 Sep 2019 20:21 UTC
References: 1 2 3 4 5 6 7
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: src...@protocol.invalid (src153)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Sun, 29 Sep 2019 20:21:20 +0000
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <ms32pe5og4fv4b5qpt2qon6i40npa1ihs4@4ax.com>
References: <5d8e1968$0$20332$426a74cc@news.free.fr> <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <5d8e690c$0$15197$426a74cc@news.free.fr> <ik0toehtgeir5co6fduqgntot1q95tesp6@4ax.com> <5d8ea573$0$6455$426a74cc@news.free.fr> <u1b1pelc8onksi1v8h11j5d2b3su0ffbgj@4ax.com> <5d910888$0$6452$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="3e189aef6d3e884e015bb1bb8a4935cc";
logging-data="10296"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18M1i0BTaeUllB35WWcJi7QhKp5/Q+LHNA="
Cancel-Lock: sha1:qxGisBkzYw3+p2IA4Yx7WJYyutg=
X-Newsreader: Forte Agent 1.93/32.576 English (American)
View all headers
On 29 Sep 2019 19:39:52 GMT, Mateusz Viste wrote:

Indeed, but let me ask this: are there any formal rules stating how much
stack an application must make sure to leave free for potential interrupt
handlers?

No.


But even considering your statement as true (application providing less
than 8 bytes of available stack = bad, broken), the user point of view
may differ. What the user would see is: as soon as I run this shitty TSR,
the Awesome Application(tm) crashes.

You can't be a perfect programmer in a imperfect world. God cursed the
ground and there's nothing atheists can do about it.




Subject: Re: How to modify values placed on the stack?
From: Rod Pemberton
Newsgroups: alt.lang.asm
Organization: Aioe.org NNTP Server
Date: Tue, 1 Oct 2019 12:18 UTC
References: 1 2
Path: i2pn2.org!i2pn.org!aioe.org!.POSTED.+15yR2JuBIwiofOqK4kSZw.user.gioia.aioe.org!not-for-mail
From: inva...@lkntrgzxc.com (Rod Pemberton)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Tue, 1 Oct 2019 08:18:06 -0400
Organization: Aioe.org NNTP Server
Lines: 58
Message-ID: <qmvg0t$1aq5$5@gioia.aioe.org>
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
NNTP-Posting-Host: +15yR2JuBIwiofOqK4kSZw.user.gioia.aioe.org
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Complaints-To: abuse@aioe.org
X-Notice: Filtered by postfilter v. 0.9.2
View all headers
On Fri, 27 Sep 2019 22:03:53 +0700
JJ <jj4public@vfemail.net> wrote:

On 27 Sep 2019 14:15:05 GMT, Mateusz Viste wrote:

Let's assume that I have something on my stack, at a known
position. I would like to modify this value. How would you do it?
Practical context: setting CF from within an interrupt handler.

Initially, I tried this:

  ; resets the last bit of the 3rd word on the stack
  and [ss:sp+4], word 0xFFFE
  iret

....but this won't assemble. It appears that it is not possible to
use SP as an address offset on an 8086. So instead, I used BX:

  ; resets the last bit of the 3rd word on the stack
  push bx              ; save BX
  mov bx, sp
  and [ss:bx+6], word 0xFFFE
  pop bx               ; restore original BX value
  iret

This solution is ugly, because it uses the stack
[snip]
Is there a smaller, faster way to achieve the same effect?


Because 16-bit instruction can not use SP for memory access, you have
no choice but to use use other register.

For accessing the stack, I'd suggest using BP, so the SS segment
override won't be needed. And save BP into stack. These will shorten
the code. e.g.

  push bp
  mov bp, sp
  mov [bp+4], WORD 0xFFFe
  pop bp

Is there a reason why you guys didn't use the XCHG instruction twice?
Best I can tell, you're not modifying either BP or SP.  Correct?

   xchg bp,sp
   and [ss:bp+4], word 0xFFFE
   xchg bp,sp
   iret

Also, Mateusz used AND instruction while JJ used MOV.


Rod Pemberton
--
Facebook privacy is like a leaky bucket of water.




Subject: Re: How to modify values placed on the stack?
From: src153
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Tue, 1 Oct 2019 14:04 UTC
References: 1 2 3
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: src...@protocol.invalid (src153)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Tue, 01 Oct 2019 14:04:13 +0000
Organization: A noiseless patient Spider
Lines: 13
Message-ID: <d4n6pelkcihj53hs6qk6ajf08a1csvm340@4ax.com>
References: <5d8e1968$0$20332$426a74cc@news.free.fr> <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <qmvg0t$1aq5$5@gioia.aioe.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="0cb993d28fba92143d33dd55341a7e9d";
logging-data="16498"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/cLp/q2cZV60lMu0wPjdg+nl6INZFo0Kg="
Cancel-Lock: sha1:uxOOXgT/Lh5ImtYjEYRK4IntVYU=
X-Newsreader: Forte Agent 1.93/32.576 English (American)
View all headers
On Tue, 1 Oct 2019 08:18:06 -0400, Rod Pemberton wrote:

Is there a reason why you guys didn't use the XCHG instruction twice?
Best I can tell, you're not modifying either BP or SP.  Correct?

  xchg bp,sp
  and [ss:bp+4], word 0xFFFE
  xchg bp,sp
  iret

What assembler? MASM 5.1.rejects the and.




Subject: Re: How to modify values placed on the stack?
From: Mateusz Viste
Newsgroups: alt.lang.asm
Organization: Guest of ProXad - France
Date: Tue, 1 Oct 2019 15:28 UTC
References: 1 2 3
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!proxad.net!feeder1-2.proxad.net!cleanfeed1-b.proxad.net!nnrp1-1.free.fr!not-for-mail
From: mate...@wont.tell (Mateusz Viste)
Subject: Re: How to modify values placed on the stack?
Newsgroups: alt.lang.asm
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <qmvg0t$1aq5$5@gioia.aioe.org>
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: 01 Oct 2019 15:28:46 GMT
Lines: 20
Message-ID: <5d9370ae$0$21611$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 01 Oct 2019 17:28:46 CEST
NNTP-Posting-Host: 82.64.0.151
X-Trace: 1569943726 news-3.free.fr 21611 82.64.0.151:48242
X-Complaints-To: abuse@proxad.net
View all headers
On Tue, 01 Oct 2019 08:18:06 -0400, Rod Pemberton wrote:
Is there a reason why you guys didn't use the XCHG instruction twice?
Best I can tell, you're not modifying either BP or SP.  Correct?

   xchg bp,sp
   and [ss:bp+4], word 0xFFFE
   xchg bp,sp
   iret

That is an excellent idea. Somehow it never occurred to me.
This is definitely the best option, as it requires neither any stack nor
any extra memory variable. The resulting code is pretty packed, too!

   87EC                    xchg bp, sp
   836604FE                and [bp+4], word 0xFFFE
   87EC                    xchg bp, sp

Thank you!

Mateusz


Subject: Re: How to modify values placed on the stack?
From: src153
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Tue, 1 Oct 2019 15:31 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: src...@protocol.invalid (src153)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Tue, 01 Oct 2019 15:31:27 +0000
Organization: A noiseless patient Spider
Lines: 30
Message-ID: <ier6petmookn4rl4b2q4a6s7hhvt852fph@4ax.com>
References: <5d8e1968$0$20332$426a74cc@news.free.fr> <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <qmvg0t$1aq5$5@gioia.aioe.org> <d4n6pelkcihj53hs6qk6ajf08a1csvm340@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="0cb993d28fba92143d33dd55341a7e9d";
logging-data="17698"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19SJCQmY6eiYcRB6uFKDeH77AU6By0uyQU="
Cancel-Lock: sha1:PV2sPP60J6uWGhyQ8Fu/Y3VRwzY=
X-Newsreader: Forte Agent 1.93/32.576 English (American)
View all headers
On Tue, 01 Oct 2019 14:04:13 +0000, src153 wrote:

On Tue, 1 Oct 2019 08:18:06 -0400, Rod Pemberton wrote:

Is there a reason why you guys didn't use the XCHG instruction twice?
Best I can tell, you're not modifying either BP or SP.  Correct?

  xchg bp,sp
  and [ss:bp+4], word 0xFFFE
  xchg bp,sp
  iret

What assembler? MASM 5.1.rejects the and.

Until now I did not notice the C style constant. And "word" is a problem
too. MASM 5.1 accepts this:

    and    word ptr [bp+4], 0FFFEh


No need for an ss:override on bp.

However, what if you are interrupted after the first xchg, before the
and?  SP has some random value taken from BP. The interruptor pushes 6
bytes on what it thinks is the top of stack, but is really some random
place the bogus SP points to.

Uh-oh.




Subject: Re: How to modify values placed on the stack?
From: src153
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Tue, 1 Oct 2019 15:36 UTC
References: 1 2 3 4
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: src...@protocol.invalid (src153)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Tue, 01 Oct 2019 15:36:58 +0000
Organization: A noiseless patient Spider
Lines: 17
Message-ID: <tes6peh5v9il5e5udm4n0nu47e3j3jpoj1@4ax.com>
References: <5d8e1968$0$20332$426a74cc@news.free.fr> <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <qmvg0t$1aq5$5@gioia.aioe.org> <5d9370ae$0$21611$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="0cb993d28fba92143d33dd55341a7e9d";
logging-data="17698"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18bmqnQ/K8cH6kO45HlLoGYrQjtMlBoMp8="
Cancel-Lock: sha1:432CQZtpX/6zz1veiyFHZ92MApM=
X-Newsreader: Forte Agent 1.93/32.576 English (American)
View all headers
On 01 Oct 2019 15:28:46 GMT, Mateusz Viste wrote:

On Tue, 01 Oct 2019 08:18:06 -0400, Rod Pemberton wrote:
Is there a reason why you guys didn't use the XCHG instruction twice?
Best I can tell, you're not modifying either BP or SP.  Correct?

   xchg bp,sp
   and [ss:bp+4], word 0xFFFE
   xchg bp,sp
   iret

That is an excellent idea.

When it looks too good to be true, I step back and think about it.





Subject: Re: How to modify values placed on the stack?
From: Mateusz Viste
Newsgroups: alt.lang.asm
Organization: Guest of ProXad - France
Date: Tue, 1 Oct 2019 15:51 UTC
References: 1 2 3 4 5
Path: i2pn2.org!i2pn.org!weretis.net!feeder7.news.weretis.net!proxad.net!feeder1-2.proxad.net!cleanfeed2-b.proxad.net!nnrp1-1.free.fr!not-for-mail
From: mate...@wont.tell (Mateusz Viste)
Subject: Re: How to modify values placed on the stack?
Newsgroups: alt.lang.asm
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <qmvg0t$1aq5$5@gioia.aioe.org>
<d4n6pelkcihj53hs6qk6ajf08a1csvm340@4ax.com>
<ier6petmookn4rl4b2q4a6s7hhvt852fph@4ax.com>
User-Agent: Pan/0.145 (Duplicitous mercenary valetism; d7e168a
git.gnome.org/pan2)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Date: 01 Oct 2019 15:51:53 GMT
Lines: 15
Message-ID: <5d937619$0$21611$426a74cc@news.free.fr>
Organization: Guest of ProXad - France
NNTP-Posting-Date: 01 Oct 2019 17:51:53 CEST
NNTP-Posting-Host: 82.64.0.151
X-Trace: 1569945113 news-3.free.fr 21611 82.64.0.151:48242
X-Complaints-To: abuse@proxad.net
View all headers
On Tue, 01 Oct 2019 15:31:27 +0000, src153 wrote:

However, what if you are interrupted after the first xchg, before the
and?  SP has some random value taken from BP. The interruptor pushes 6
bytes on what it thinks is the top of stack, but is really some random
place the bogus SP points to.

Uh-oh.

That may be a stupid question but - can an interrupt handler be itself
interrupted? Until now I was thinking that "obviously not, since the
current int wasn't acknowledged yet", but now I am in doubt. Will have to
reach out to my 8086 architecture book again.

Mateusz


Subject: Re: How to modify values placed on the stack?
From: Rick C. Hodgin
Newsgroups: alt.lang.asm
Organization: Liberty Software Foundation
Date: Tue, 1 Oct 2019 15:58 UTC
References: 1 2 3 4 5 6
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Tue, 1 Oct 2019 11:58:49 -0400
Organization: Liberty Software Foundation
Lines: 27
Message-ID: <qmvt37$qtb$1@dont-email.me>
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <qmvg0t$1aq5$5@gioia.aioe.org>
<d4n6pelkcihj53hs6qk6ajf08a1csvm340@4ax.com>
<ier6petmookn4rl4b2q4a6s7hhvt852fph@4ax.com>
<5d937619$0$21611$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 1 Oct 2019 15:58:31 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4eb5e6cf6d180746a8a27f2a31eb63df";
logging-data="27563"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19n3vuj6Whq7Cg5quQWLe/Co/sMJ0RKkPc="
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:rTYvAqap8RnVcLqZyVaoGbEQMK4=
In-Reply-To: <5d937619$0$21611$426a74cc@news.free.fr>
Content-Language: en-US
View all headers
On 10/1/2019 11:51 AM, Mateusz Viste wrote:
On Tue, 01 Oct 2019 15:31:27 +0000, src153 wrote:

However, what if you are interrupted after the first xchg, before the
and?  SP has some random value taken from BP. The interruptor pushes 6
bytes on what it thinks is the top of stack, but is really some random
place the bogus SP points to.

Uh-oh.

That may be a stupid question but - can an interrupt handler be itself
interrupted? Until now I was thinking that "obviously not, since the
current int wasn't acknowledged yet", but now I am in doubt. Will have to
reach out to my 8086 architecture book again.

Yes.  There are flags which mask maskable interrupts, but non-maskable
interrupts can still signal, such as divide-by-zero in the midst of an
interrupt handler.

It's a bad solution.  bp will point to either a prior stack frame if
stack frames are used, or some contain some random value, but regard-
less, if a non-maskable interrupt occurs during that time it will
overwrite data on the stack causing the system to likely crash.

--
Rick C. Hodgin



Subject: Re: How to modify values placed on the stack?
From: src153
Newsgroups: alt.lang.asm
Organization: A noiseless patient Spider
Date: Tue, 1 Oct 2019 16:13 UTC
References: 1 2 3 4 5 6
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: src...@protocol.invalid (src153)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Tue, 01 Oct 2019 16:13:29 +0000
Organization: A noiseless patient Spider
Lines: 23
Message-ID: <k1u6pe1kd5ut19cgjeddfr2l30od8pud59@4ax.com>
References: <5d8e1968$0$20332$426a74cc@news.free.fr> <16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net> <qmvg0t$1aq5$5@gioia.aioe.org> <d4n6pelkcihj53hs6qk6ajf08a1csvm340@4ax.com> <ier6petmookn4rl4b2q4a6s7hhvt852fph@4ax.com> <5d937619$0$21611$426a74cc@news.free.fr>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: reader02.eternal-september.org; posting-host="0cb993d28fba92143d33dd55341a7e9d";
logging-data="2035"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fGHMuGaNSQURqdyXVo+B9Jy/tu0jRk1c="
Cancel-Lock: sha1:jStRMQgbx2Q9GhwL9NAd00wVWD4=
X-Newsreader: Forte Agent 1.93/32.576 English (American)
View all headers
On 01 Oct 2019 15:51:53 GMT, Mateusz Viste wrote:

That may be a stupid question but - can an interrupt handler be itself
interrupted?

A frequent question.


Until now I was thinking that "obviously not, since the
current int wasn't acknowledged yet", but now I am in doubt. Will have to
reach out to my 8086 architecture book again.

Any interrupt, software or hardware IRQ, clears the interrupt flag. So
your code is safe from further interrupts. However, the usual practice
is to STI within your handler, so that it CAN be interrupted by higher
priority interrupts. The EOI business only blocks equal or lower at the
PIC. That's completely separate from the CPU interrupt flag.

So you could use Rod's code, by leaving CPU interrupts disabled, but I
wouldn't. It's ugly, and messing around with SP is risky. If you do, be
very careful.




Subject: Re: How to modify values placed on the stack?
From: Rick C. Hodgin
Newsgroups: alt.lang.asm
Organization: Liberty Software Foundation
Date: Tue, 1 Oct 2019 16:42 UTC
References: 1 2 3 4 5 6 7 8
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: rick.c.h...@gmail.com (Rick C. Hodgin)
Newsgroups: alt.lang.asm
Subject: Re: How to modify values placed on the stack?
Date: Tue, 1 Oct 2019 12:42:54 -0400
Organization: Liberty Software Foundation
Lines: 83
Message-ID: <qmvvlt$e5l$1@dont-email.me>
References: <5d8e1968$0$20332$426a74cc@news.free.fr>
<16z1e0ug2tiau.1sk01zskfu764$.dlg@40tude.net>
<5d8e690c$0$15197$426a74cc@news.free.fr>
<a8d43645-9f24-4cc7-9ebd-b478a5758294@googlegroups.com>
<5d8e6f3c$0$31420$426a74cc@news.free.fr> <qmlrlp$a7i$1@dont-email.me>
<5d8e78d7$0$31420$426a74cc@news.free.fr>
<liquoe1hsv3srpdqc20g0ii6tq8dnruh3k@4ax.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 1 Oct 2019 16:42:37 -0000 (UTC)
Injection-Info: reader02.eternal-september.org; posting-host="4eb5e6cf6d180746a8a27f2a31eb63df";
logging-data="14517"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18u3kxRA0PpE1Udn8623FJVw4AYwCjlxLk="
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101
Thunderbird/60.9.0
Cancel-Lock: sha1:cIbNMesN3e1Q6VxHlWLCVkrfSNM=
In-Reply-To: <liquoe1hsv3srpdqc20g0ii6tq8dnruh3k@4ax.com>
Content-Language: en-US
View all headers
On 9/28/2019 10:20 AM, src153 wrote:
On 27 Sep 2019 21:02:15 GMT, Mateusz Viste wrote:

On Fri, 27 Sep 2019 16:32:57 -0400, Rick C. Hodgin wrote:
Mateusz, something to consider:

      8086/8088 -- Released 1978
      80386     -- Released 1985

Only 7 years separates the original 8086/8088, and the 80386
introduction.  You could still go retro if you limited your design to
the original 16 MHz 80836 CPU.

Tricky Ricky.

My mother used to call me that. :-)  Also Rikky-Tikky-Tavi, which
is an 1890s story about a strapping young mongoose out on adventure.

The 386 cost a small fortune at introduction. There was a
lot of life left in the 8086 market. The market winners had to get going
in those early years. By 1990 it was too late. Timing was everything.

I didn't have an 80386 until 1992.  Had 80286s until then.

But, we live in 2019 and the past is the past.  Regardless of cost
then, the technology is commonplace and commodity now.  Emulators
like Bochs are available and can run the simulation fully in soft-
ware without any real hardware use apart from running the C/C++ code
Bochs is written in.

The 80386 is such a freeing revision of coding ability.  I cannot
see any reason to go back to the 8086 and the strong limitations
of real-mode, save nostalgia and a desire to be historical, which
it seems is the goal of Mateusz.  For such an endeavor I am fully
on board.

There's a YouTube channel I watch called The 8-Bit Guy.  He's working
on a Commodore 64 replacement, called Commander X16.  He's building
it from scratch, based around the 6502 or later revision that is fully
backward compatible, a better memory model (more like the VIC 20), and
a better sound system.  He's targeting 2 MB of RAM using an 8KB banked
section that switches between four 512 KB banks broken into 8KB blocks.

It's an interesting project:

     Building My Dream Computer (Part 2)
     https://www.youtube.com/watch?v=sg-6Cjzzg8s

     Part 1:
     https://www.youtube.com/watch?v=ayh0qebfD2g

There's another channel I watch, and the guy is creating an NES emul-
ator from scratch.  It has some interesting bits:

     NES Emulator part 1 Bitwise Basics & Overview
     https://www.youtube.com/watch?v=F8kx56OZQhg

     Part 2 The 6502 CPU
     https://www.youtube.com/watch?v=8XmxKPJDGU0

     Part 3 Buses, RAMs, ROMs & Mappers
     https://www.youtube.com/watch?v=xdzOvpYPmGE

     Part 4 PPU - Background Rendering
     https://www.youtube.com/watch?v=-THeUXqR3zY

There's also a truly excellent presentation on reverse-engineering
the inner workings of the 6502.  It's one of the most interesting
hardware-related videos I've ever seen:

     Reverse Engineering the 6502
     https://www.youtube.com/watch?v=4NZlrrAOxRU

The presenter in that video is writing the kernel code for The 8-Bit
Guy's Dream Computer.

Such a beautiful retro ecosystem exists.  So many people offering
their talents and time for the benefit and enjoyment of others.
I love such efforts top to bottom.

--
Rick C. Hodgin



Pages:123
rocksolid light 0.7.2
clearneti2ptor