1. Help on Assembler

This question is to all who used some asm code in Euphoria.
 I know that to use asm in EU, we need to take some object code and poke,
and finally call it, but my question is about some details, like some
commands (.MODEL SMALL, .STACK), that I found in a tutorial, and I can't
understand how to do it in Euphoria, can I simply use the asm code without
these instructions ?
 Thanks

Eduardo Uemura Okada
e-mail: cool at mii.nutecnet.com.br

new topic     » topic index » view message » categorize

2. Re: Help on Assembler

At 13:44 27-01-98 -0200, you wrote:
> This question is to all who used some asm code in Euphoria.
> I know that to use asm in EU, we need to take some object code and poke,
>and finally call it, but my question is about some details, like some
>commands (.MODEL SMALL, .STACK), that I found in a tutorial, and I can't
>understand how to do it in Euphoria, can I simply use the asm code without
>these instructions ?
> Thanks
>
>Eduardo Uemura Okada
>e-mail: cool at mii.nutecnet.com.br
>
   Those instructions are not relevant to euphoria assembler programming. The
 important is to instruct the assembler to code for 32 bits. Personnaly I use
 TASM 3.0 and source code look like this:

--------------------------------------
; coder written to be used in euphoria program
; copy a block of memory skipping 1 byte.
page 54,255  ; just instruction for the listing file nothing to see with
 assembler
P386         ; instruct the assembler to use 80386 instructions.
radix 16     ; the number in this file are in hexadecimal

assume cs:code, ds:data ; declare segment name
segment data use32      ; instruct to assemble for 32 bits code.
  source dd ?           ; this segment define the variables
  dest   dd ?
  count  dd ?
  dir    db 0
ends                    ; end for this segment.

segment code use32      ; this the code segment 32 bits code.
left equ 1
proc copy_skip  ;procedure begin here
    pushad
    push es
    pushf
    push ds
    pop  es
    mov  esi, [source]
    mov  edi, [dest]
    mov  ecx, [count]
    mov  [dir], 0
    jcxz   exit
    cld
    cmp esi, edi
    jae  loop1
    std
    mov eax, ecx
    shl eax
    sub eax, 2
    add esi, eax
    add edi, eax
    inc [dir]
loop1:
    lodsw
    stosb
    test [dir], left
    jnz decrement
    inc edi
    jmp control
decrement:
    dec edi
control:
    loop loop1
exit:
    popf
    pop es
    popad
    ret
endp  ;procedure end here

ends  ; segment end here
end   ; assembler code end here
---------------------------------------------------

the <use32> declaration instruct the assembler to code 32 bits instructions this
what it is needed for euphoria.
As you see there his no need for model declaration (TINY,SMALL or whatever).

Regards,




Jacques Deschenes
Baie-Comeau, Quebec
Canada
desja at globetrotter.qc.ca

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu