Thank you, I have only just seen this. It is the solution.

On 2025/06/08 23:04, Christopher Evans wrote:
CMP byte ptr vs:[var], 0x18



---
Freelance coder

916-277-5654 @ axiom3...@proton.me

On Sat, May 31, 2025, 10:56 hms--- via Freedos-user <freedos-user@lists.sourceforge.net> wrote:

    Hi there
    Not a specific FreeDos question, but related. I recently
    disassembled a DOS
    .COM utility using "IDA Free", to see if I could make some minor mods.
    I am brand new to 8086 assembly language and looking for an answer.
    In the example test code below, I want to replace the instruction
    "cmp
    byte_369, 18h"
    with "cmp byte ptr [addr], 18h" or similar. I get an error message of
    "Illegal immediate".
    Do I need to use an intermediate instruction to achieve this?
    The assembler is Borland's TASM.
    Any help appreciated.
    Thanks,  John

    ; ------------------------------------------

    SOURCE:

      .386
      .model tiny

    addr equ 369h

    seg000 segment byte public 'CODE' use16
      assume cs:seg000
      org 100h
      assume es:nothing, ss:nothing, ds:seg000, fs:nothing, gs:nothing
      public start

    start proc near
      jmp here

      org 369h
    byte_369 db 18h

      org 1234h
    here:
      cmp byte ptr [addr], 18h
      cmp byte_369, 18h

    start  endp
    seg000 ends
            end start
    ; ------------------------------------------

    EDITED ASSEMBLER OUTPUT: (for brevity)

      8                             org 100h
    13 0100  E9 1131               jmp here
    14
    15                             org 369h
    17 0369  18                  byte_369 db 18h
    18
    19                             org 1234h
    21 1234                      here:

    22 1234  80 3E 0369 18         cmp byte ptr [addr],18h
    **Error** test.ASM(22) Illegal immediate

    23 1239  80 3E 0369r 18        cmp byte_369,18h

    ; end doc



    _______________________________________________
    Freedos-user mailing list
    Freedos-user@lists.sourceforge.net
    https://lists.sourceforge.net/lists/listinfo/freedos-user

_______________________________________________
Freedos-user mailing list
Freedos-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-user

Reply via email to