| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Force close a MDOS sessi |
David Noon wrote in a message to Mike Bilow:
MB> However, you have an endian bug here, since the image
MB> equivalent of "DB 02h,0FDh" is correctly "DW 0FD02h".
DN> Hi Mike,
DN> My copy of MASM doesn't reverse bytes when coding in hex.
DN> Neither did BCAF 3.1, which uses TASM.
DN> I converted these instructions into a clone of EXIT_VDM.COM.
DN> I attach an assembly listing of this instruction sequence
DN> from MASM 6.11. The DW in question is at location 0103.
DN> Perhaps Microsoft, Borland and I are all wrong.
No, it's just you! :-)
DN> Regards
DN> Dave
DN>
DN> ============================================================
DN> Microsoft (R) Macro Assembler Version 6.11
DN> 06/06/96 23:17:29 EXIT_VMB.ASM Page 1 - 1
DN> ; Cobbled version of
DN> EXIT_VDM.COM, called EXIT_VMB.COM
DN> .MODEL TINY
DN> 0000 .CODE
DN> .STARTUP
DN> 0100 *{at}Startup:
DN> 0100 3 33 C0 XOR AX,AX
DN> 0102 2 F4 HLT
DN> 0103 02FD DW 02FDH
DN> .EXIT
DN> 0105 4 B4 4C * mov ah, 04Ch
DN> 0107 51 CD 21 * int 021h
DN> END
DN> ============================================================
I don't know how to break the news to you, but "02FDh" appears as
"02FDh" in the listing output of the assembler for human
convenience. "Well," the assembler thinks, "the programmer
wrote '02FDh,' so he expects to see '02FDh.'"
In reality, the bytes are ordered in memory as "FD 02" by the
assembler. Note that the listing subtly signals this by leaving no space
between the bytes.
C:\OS2\MDOS>debug exit_vdm.com
-u100,106
0EB1:0100 33C0 XOR AX,AX
0EB1:0102 F4 HLT
0EB1:0103 02FD ADD BH,CH
0EB1:0105 CD20 INT 20
-d100,106
0EB1:0100 33 C0 F4 02 FD CD 20 3.....
-a103
0EB1:0103 dw fd02
0EB1:0105
-u100,106
0EB1:0100 33C0 XOR AX,AX
0EB1:0102 F4 HLT
0EB1:0103 02FD ADD BH,CH
0EB1:0105 CD20 INT 20
-d100,106
0EB1:0100 33 C0 F4 02 FD CD 20 3.....
Junk is produced by doing it the other way:
-a103
0EB1:0103 dw 02fd
0EB1:0105
-u100,106
0EB1:0100 33C0 XOR AX,AX
0EB1:0102 F4 HLT
0EB1:0103 FD STD
0EB1:0104 02CD ADD CL,CH
0EB1:0106 206572 AND [DI+72],AH
-d100,106
0EB1:0100 33 C0 F4 FD 02 CD 20 3.....
I encourage you to load your own COM file under DEBUG and look at the raw
bytes with the "d" command in order to convince yourself.
-- Mike
---
* Origin: N1BEE BBS +1 401 944 8498 V.34/V.FC/V.32bis/HST16.8 (1:323/107)SEEN-BY: 50/99 270/101 620/243 625/100 711/401 409 410 413 430 808 809 934 SEEN-BY: 711/955 712/407 515 517 628 713/888 800/1 @PATH: 323/107 396/1 270/101 712/515 711/808 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.