VOGONS


NOT (8088)

Topic actions

First post, by folkert

User metadata
Rank Newbie
Rank
Newbie

Hello,

I wonder: why does the following code not work on real hardware while in e.g. dosbox it does?

jmp test_005_go

test_005:
dw $1199
test_005_go:
mov si,#$0005
not word [test_005]
mov ax,[test_005]
cmp ax,#$ee66
jz test_005_ok
hlt
test_005_ok:

In dosbox, the word at test_005 is NOT'd to $EE66, on real hardware (an OKI 80C88 processor) it (the NOT instruction) is seemingly ignored.

Wait I'm looking for is to find a way where NOT WORD [label] does work.

Reply 1 of 3, by digger

User metadata
Rank Oldbie
Rank
Oldbie

Hello (near) namesake, and welcome to Vogons. 🙂

Kind of weird to see someone use the dollar sign notation for hex values in 8086/8088 assembly.

Sorry I'm not much of help in actually answering your question. 😅

Reply 2 of 3, by Namrok

User metadata
Rank Oldbie
Rank
Oldbie

What assembler are you using? If you are targeting an 8088, in NASM at least, you'll want to include the CPU 8086 directive at the top of your code. You might think the assembler is just directly converting your assembly instructions to their bytecode, but frequently I see it trying to do clever optimizations here and there. So it could be including some unsupported operations inadvertently that way. Plus, without the CPU 8086 directive, you may accidentally find yourself using an instruction that is supported by the 8088, in a form it's not.

Have you stepped through the assembly on either configuration to see what it thinks it's doing?

Win95/DOS 7.1 - P233 MMX (@2.5 x 100 FSB), Diamond Viper V330 AGP, SB16 CT2800
Win98 - K6-2+ 500, GF2 MX, SB AWE 64 CT4500, SBLive CT4780
Win98 - Pentium III 1000, GF2 GTS, SBLive CT4760
WinXP - Athlon 64 3200+, GF 7800 GS, Audigy 2 ZS

Reply 3 of 3, by folkert

User metadata
Rank Newbie
Rank
Newbie
Namrok wrote on 2023-07-23, 12:39:

What assembler are you using? If you are targeting an 8088, in NASM at least, you'll want to include the CPU 8086 directive at the top of your code. You might think the assembler is just directly converting your assembly instructions to their bytecode, but frequently I see it trying to do clever optimizations here and there. So it could be including some unsupported operations inadvertently that way. Plus, without the CPU 8086 directive, you may accidentally find yourself using an instruction that is supported by the 8088, in a form it's not.

Have you stepped through the assembly on either configuration to see what it thinks it's doing?

I'm using as86 with the -0 flag to make sure it produces 86/88 bytecode.

But indeed, stepping through it on real hardware was the solution: I did so on dosbox but apparently doesbox does not produce the trace interrupt. Real hardware does. And I did indeed accidently enabled the tracing bit earlier.
Thanks!