Author Topic: CALL instruction with opcode 9Ah  (Read 1570 times)

hutch--

  • Administrator
  • Member
  • ******
  • Posts: 6768
  • Mnemonic Driven API Grinder
    • The MASM32 SDK
Re: CALL instruction with opcode 9Ah
« Reply #15 on: April 24, 2019, 08:59:51 PM »
It would seem to me that the problem is finding a use for such a mnemonic. For assemblers that address a wider range of x86 host platforms, it may be useful but it has long been the case that Intel have stray mnemonics that change from one chip family to another for undisclosed reasons so there may not be any gain in adding the mnemonic to a working assembler.

For test purposes most macro assemblers should be able to code the mnemonic and see if it can be used for anything but in a world that lives between win32 and the coming win64, this may be a task that simply wastes time.
hutch at movsd dot com
http://www.masm32.com    :biggrin:  :skrewy:

habran

  • Member
  • *****
  • Posts: 1210
    • uasm
Re: CALL instruction with opcode 9Ah
« Reply #16 on: April 24, 2019, 09:19:31 PM »
Thanks LiaoMi
I succeeded to assemble it, however linking it is another thing
Code: [Select]
_main   PROC NEAR
        push    ebp                                     ; 0000 _ 55
        mov     ebp, esp                                ; 0001 _ 8B. EC
        add     esp, -8                                 ; 0003 _ 83. C4, F8
        push    -11                                     ; 0006 _ 6A, F5
        call    _GetStdHandle@4                         ; 0008 _ E8, 00000000(rel)
        mov     dword ptr [ebp-8H], eax                 ; 000D _ 89. 45, F8
        push    0                                       ; 0010 _ 6A, 00
        lea     eax, ptr [ebp-4H]                       ; 0012 _ 8D. 45, FC
        push    eax                                     ; 0015 _ 50
        push    17                                      ; 0016 _ 6A, 11
        push    offset FLAT:?_009                       ; 0018 _ 68, 00000000(segrel)
        push    dword ptr [ebp-8H]                      ; 001D _ FF. 75, F8
        call    _WriteConsoleA@20                       ; 0020 _ E8, 00000000(rel)
        int 3    ; breakpoint or filler                 ; 0025 _ CC
        call    far ptr FLAT:?_002                      ; 0026 _ 9A, 000002A4 0000(far)
        call    ?_004                                   ; 002D _ E8, 3FD65AD9


@hutch,

we are working on new codegen.c and we don't want to make it worse but better ;)
so, we needed testing peace for that instruction, which as we can see no one used for long, long, long time

Thanks all of you
Cod-Father

AW

  • Member
  • *****
  • Posts: 2442
  • Let's Make ASM Great Again!
Re: CALL instruction with opcode 9Ah
« Reply #17 on: April 24, 2019, 09:40:13 PM »
Quote
linking it is another thing
You need the Segmented Executable Linker, it is called link16.exe (or I renamed it to link16.exe ).

nidud

  • Member
  • *****
  • Posts: 1800
    • https://github.com/nidud/asmc
Re: CALL instruction with opcode 9Ah
« Reply #18 on: April 24, 2019, 10:09:10 PM »
Here's one with a few (hard) assumptions.
Code: [Select]
; build: uasm -pe call32.asm

    .386
    .model flat, c

    option dllimport:<msvcrt>
    printf proto :ptr, :vararg
    exit   proto :dword

CALL32 macro seg, off
    db 0x9A
    dd off
    dw seg
    endm

    .data
    string db "0x401000 called",10,0
    .code

start:
    invoke printf,addr string
    ret

main proc

    CALL32 0x0023, 0x401000
    invoke exit,0

main endp

    end main

You may test CALL16 with using -mz/-bin.

Should be fairly easy to implement thought: If first arg is const && second colon && third const..

habran

  • Member
  • *****
  • Posts: 1210
    • uasm
Re: CALL instruction with opcode 9Ah
« Reply #19 on: April 24, 2019, 11:52:33 PM »
Thanks AW and nidud :t
Cod-Father

johnsa

  • Member
  • ****
  • Posts: 791
    • Uasm
Re: CALL instruction with opcode 9Ah
« Reply #20 on: April 25, 2019, 01:04:12 AM »
The only time I ever used these specific opcode forms was when writing OS code, DOS extenders etc. They were necessary to force a cache-flush and load a new CS selector. Even then with tasm/dos I think used to manually code in the db 0eah, dd xxx, dw 8 .. and patch it.