Error a2013 model must precede this directive

Tinkering around with MASM a bit, and I have no idea what these errors mean, or if I'm writing this code close to correctly. As it is written currently, it should just be greeting the user, asking...

Tinkering around with MASM a bit, and I have no idea what these errors mean, or if I’m writing this code close to correctly. As it is written currently, it should just be greeting the user, asking for two numbers and saying goodbye (trying to get a skeleton working before doing any calculations or anything special).

INCLUDELIB Irvine32.inc ;  Note: line number 7


.data
userName    BYTE    33 DUP(0)   ;string to be entered by user
firstNumber DWORD   ?           ;integer to be entered by user
secondNumber    DWORD     ?         ;integer to be entered by user
intro_1     BYTE        "Elementary Arithmetic by Marshall Todt", 0
intro_2     BYTE        "Enter 2 numbers, and I'll show you the sum, difference,", 0
intro_3     BYTE        "product, quotient, and remainder.", 0
prompt_1        BYTE        "Enter the first integer: ", 0
prompt_2        BYTE        "Enter the second integer: ",0
goodBye     BYTE        "Impressed?  Bye!", 0

.code
main PROC

;Introduction
    mov     edx, OFFSET intro_1 
    call    WriteString
    call    CrLf
    move        edx, OFFSET intro_2
    call WriteString
    call CrLF
    move        edx, OFFSET intro_3
    call WriteString
    call CrLF

;Get the data
    mov     edx, OFFSET prompt_1
    call    WriteString
    call    ReadInt
    mov     firstNumber, eax
    mov     edx, OFFSET prompt_2
    call    WriteString
    call    ReadInt
    mov     secondNumber, eax



;Say "Good-bye"
    mov     edx, OFFSET goodBye
    call    WriteString
    call    CrLf
    exit    ; exit to operating system
main ENDP

END main

These are the errors i am getting:

Error   1   error A2013: .MODEL must precede this directive c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   10  1   Assignment1
Error   2   error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   11  1   Assignment1
Error   3   error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   12  1   Assignment1
Error   4   error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   13  1   Assignment1
Error   5   error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   14  1   Assignment1
Error   6   error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   15  1   Assignment1
Error   7   error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   16  1   Assignment1
Error   8   error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   17  1   Assignment1
Error   9   error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   18  1   Assignment1
Error   10  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   19  1   Assignment1
Error   11  error A2013: .MODEL must precede this directive c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   21  1   Assignment1
Error   12  error A2034: must be in segment block : main    c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   22  1   Assignment1
Error   13  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   25  1   Assignment1
Error   14  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   26  1   Assignment1
Error   15  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   27  1   Assignment1
Error   16  error A2008: syntax error : edx c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   28  1   Assignment1
Error   17  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   29  1   Assignment1
Error   18  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   30  1   Assignment1
Error   19  error A2008: syntax error : edx c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   31  1   Assignment1
Error   20  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   32  1   Assignment1
Error   21  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   33  1   Assignment1
Error   22  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   36  1   Assignment1
Error   23  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   37  1   Assignment1
Error   24  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   38  1   Assignment1
Error   25  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   39  1   Assignment1
Error   26  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   40  1   Assignment1
Error   27  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   41  1   Assignment1
Error   28  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   42  1   Assignment1
Error   29  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   43  1   Assignment1
Error   30  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   48  1   Assignment1
Error   31  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   49  1   Assignment1
Error   32  error A2034: must be in segment block   c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   50  1   Assignment1
Error   33  error A2008: syntax error : exit    c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   51  1   Assignment1
Error   34  error A1010: unmatched block nesting : main c:UsersMarshalldocumentsvisual studio 2010ProjectsSolution1Assignment1Assignment1.asm   52  1   Assignment1
Error   35  error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"DebugAssignment1.obj" /W3 /errorReport:prompt  /TaAssignment1.asm" exited with code 1.   C:Program Files (x86)MSBuildMicrosoft.Cppv4.0BuildCustomizationsmasm.targets  49  6   Assignment1

Содержание

  1. Build x86 filament on windows 10 use vs2019,generated a lot of error in bluegl.prox #4780
  2. Comments
  3. Footer
  4. libffi ASM error(s) while building with MSVC 2013 #462
  5. Comments
  6. Footer
  7. Вопрос По Асемблеру\
  8. libffi ASM error(s) while building with MSVC 2013 #462
  9. Comments
  10. Footer
  11. Error a2013 model must precede this directive
  12. Asked by:
  13. Question
  14. All replies

Build x86 filament on windows 10 use vs2019,generated a lot of error in bluegl.prox #4780

Hello,I have to use filament on windows x86.
But I bulid it generated error like that.
E:WYfilamentfilament-mainlibsblueglsrcBlueGLCoreWindowsImpl.S(22): error A2013: .MODEL must precede this directive
1>E:WYfilamentfilament-mainlibsblueglsrcBlueGLCoreWindowsImpl.S(25): error A2034: must be in segment block : bluegl_glProgramUniform1dvEXT
1>E:WYfilamentfilament-mainlibsblueglsrcBlueGLCoreWindowsImpl.S(26): error A2034: must be in segment block
1>E:WYfilamentfilament-mainlibsblueglsrcBlueGLCoreWindowsImpl.S(27): error A2034: must be in segment block
1>E:WYfilamentfilament-mainlibsblueglsrcBlueGLCoreWindowsImpl.S(28): fatal error A1010: unmatched block nesting : bluegl_glProgramUniform1dvEXT
Is there any suggestions?I look forward to receiving your reply,thank u!

The text was updated successfully, but these errors were encountered:

Sorry but we can’t/won’t support x86 on Windows, only x86_64

@romainguy Is any version not supported anymore, including the previous version?

No we’ve never supported x86 on Windows, only on Android (and even there we plan on getting rid of it as soon as possible).

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

libffi ASM error(s) while building with MSVC 2013 #462

The text was updated successfully, but these errors were encountered:

Anyone tried to actually build with MSVC 2013, does it still work?

@Zueuk I have not, are you still getting an error if you use MSVC 2019 instead?

Everything is fine with 2017 and 2019

@nacho and @guruDanny67 maybe we should just drop support for MSVC 2013, and eventually add MSVC 2022. What do you think?

I thought there is something wrong with my VS2013 install, so I redownloaded & reinstalled it from the «VS Community 2013 with update 5» ISO.
Did not get asm errors after that, there were a bunch of C errors in libtiff and fontconfig, fixable by #define inline __inline and #define snprintf _snprintf , but then

All these lines have constexpr in there, and it seems to me that MSVC2013 even «with update 5» does not support it.

Perhaps there is a way to use an older version of this library with MSVC 2013?

@Zueuk Is there a reason why you need to build with a 9 year old version of MSVC? I am trying to figure out if there is a use case for this or we should drop support for these really old versions.

There was (is?) a remote possibility that our project will have to be built on MSVC 2013 for some legacy reasons.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Вопрос По Асемблеру\

У меня в папке C:l11.asm лежит файл на асме код его
.386
.model flat.stdcall
.code
start:
mov eax. 2
add eax. 3
ret
end start

Я хочу превратить его в exe
Компилятор путь C:myasm
Я делаю 2 команды в cmd
C:myasmbinml.exe /c /coff C:l11.asm
C:myasmbinlink.exe /subsystem:windows C:l11.obj
Точнее пока 1 первую и выдаёт следующие

C:Documents and SettingsAdmin>C:myasmbinml.exe /c /coff C:l11.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997. All rights reserved.

Assembling: C:l11.asm
C:l11.asm(2) : error A2008: syntax error : .
C:l11.asm(3) : error A2013: .MODEL must precede this directive
C:l11.asm(4) : error A2034: must be in segment block
C:l11.asm(5) : error A2008: syntax error : in instruction
C:l11.asm(6) : error A2008: syntax error : in instruction
C:l11.asm(7) : error A2034: must be in segment block
C:l11.asm(8) : error A2006: undefined symbol : start
C:l11.asm(8) : error A2148: invalid symbol type in expression : start

C:Documents and SettingsAdmin>

Что делать?( В чём ошибка?? У меня XP

.386
.model flat, stdcall
.code
start proc
mov eax, 2
add eax, 3
ret
start endp
end start

Нужно ставить запятые вместо точек. Возможно, блок исполняемого кода нужно оформить в виде процедуры.
И если не получится, попробуй между директивами .model и .code поставить option casemap: none

Источник

libffi ASM error(s) while building with MSVC 2013 #462

The text was updated successfully, but these errors were encountered:

Anyone tried to actually build with MSVC 2013, does it still work?

@Zueuk I have not, are you still getting an error if you use MSVC 2019 instead?

Everything is fine with 2017 and 2019

@nacho and @guruDanny67 maybe we should just drop support for MSVC 2013, and eventually add MSVC 2022. What do you think?

I thought there is something wrong with my VS2013 install, so I redownloaded & reinstalled it from the «VS Community 2013 with update 5» ISO.
Did not get asm errors after that, there were a bunch of C errors in libtiff and fontconfig, fixable by #define inline __inline and #define snprintf _snprintf , but then

All these lines have constexpr in there, and it seems to me that MSVC2013 even «with update 5» does not support it.

Perhaps there is a way to use an older version of this library with MSVC 2013?

@Zueuk Is there a reason why you need to build with a 9 year old version of MSVC? I am trying to figure out if there is a use case for this or we should drop support for these really old versions.

There was (is?) a remote possibility that our project will have to be built on MSVC 2013 for some legacy reasons.

© 2023 GitHub, Inc.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Error a2013 model must precede this directive

This forum has migrated to Microsoft Q&A. Visit Microsoft Q&A to post new questions.

Asked by:

Question

The following are different code fragments that are using .CODE and SEGMENT in the same listing and in some cases different results occur than the expected results. The name of all the listings are ASSEMBLY1.asm:

Case 1: no errors

.code ;segments created are PUBLIC and alignment is WORD

ASSEMBLY1_TEXT segment ;segments created are PUBLIC and alignment is WORD. This is because .code created the initial definition for ASSEMBLY1_TEXT segment to be PUBLIC and the alignment to be WORD

Case 2: Error occur, as it should

.code ASSEMBLY1_TEXT ;segments created are PUBLIC and alignment is WORD.

ASSEMBLY1_TEXT segment PRIVATE ;A error occurs here because the .CODE directive created this segment as PUBLIC and a alignment of WORD and now you are attempting to change the combine type from PUBLIC to PRIVATE.

CASE 3: NO error occurs BUG??

ASSEMBLY1_TEXT segment PRIVATE ;segments created are PRIVATE and alignment is PARA.

.code ;existing segment named ASSEMBLY1_TEXT that is PUBLIC and alignment of WORD. No error is shown. A error should occur because the combine type and alignments do not match.

Case 4: no error, BUG??

ASSEMBLY1_TEXT segment PRIVATE ;segments created are PRIVATE and alignment is PARA.

.code ; ;a segment named ASSEMBLY1_TEXT that was PRIVATE with a alignment of PARA is now changed to PUBLIC and alignment of WORD. No error is shown. A error should occur because the combine type and alignments do not match.

From the different testing of .CODE and SEGMENT I have determined when a .CODE directive is encountered ANY segments that are created by .CODE have a combine type of PUBLIC and a alignment of WORD. If a SEGMENT instruction is encountered and has no segment options defined then it creates a combine type of PRIVATE and an alignment of PARA.

I was expecting a .CODE directive to inherit the combine type and alignment where the original SEGEMENT instruction was first defined but that is not the case. Is this the way .CODE is suppose to work or is this a bug?

I was hoping to be able to define segments with options using the long form of SEGMENT and then use the .CODE and other directives. Does this not work?

I have not tried this yet for .DATA,.DATA. CONST,.FARDATA,.FARDATA? and .STACK. I expect the same result. Am I correct?

Thanks for any help, David

Well, masm/ml for Visual Studio 2017 doesn’t like the third case.

First you have ASSEMBLY1_TEXT as the start of the segment, but ASSEMBLY2_TEXT as the end of the segment, this results in the error:

Assembling: test.asm
test.asm(2) : fatal error A1010:unmatched block nesting : ASSEMBLY2_TEXT

since the blocks are unmatched. There is also the fact that you have ,code (comma) instead of .code.

Fixing that, so the assembly is:

Assembling: test.asm
test.asm(3) : error A2065:expected : memory model
test.asm(3) : error A2013:.MODEL must precede this directive
test.asm(4) : error A2013:.MODEL must precede this directive
test.asm(5) : error A2034:must be in segment block
test.asm(1) : error A2065:expected : memory model

because .model must have a memory model.

For case 4, the .model directive seems to retroactively affect all sections. So if it isn’t a section made with one of the macros (.code, .data etc.) then it doesn’t matter too much if it assumes something. Because the simple:

will change the alignment on its own, so for case 4, the alignment hasn’t been changed.

I think that for case 4, the retroactive applying of the memory model may also be affecting things. Before the memory model is set, _TEXT is not seen as a special section, so it would be seen as an initialised data section which isn’t executable. For example, if you don’t set the model, or explicitly set it to flat, the section properties are:

SECTION HEADER #3
/19 name (ASSEMBLY2_TEXT)
0 physical address
0 virtual address
0 size of raw data
0 file pointer to raw data
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
C0500040 flags
Initialized Data
16 byte align
Read Write

This is obviously not what a .CODE section should be.

For it to match the memory model, the parameters must change to match code sections. So if you change the memory model after the fact, then it just treats it like that was the one defined right at the start. It is like how you can’t have multiple .model directives in the same file.

So it is possible that the assembler is just ignoring the private when the memory model is applied retroactively.

If you do believe this is a bug, then it is best to contact Microsoft using Visual Studio’s send feedback option, or on the developer community site.

This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

Darran, sorry for the bad typing. Thanks for letting me know. I fixed Case 3 to the way it was suppose to be.

I was hoping that Microsoft would respond here without have to contact them.

The only way you can guarantee that a Microsoft employee will look at this is by contacting them. Employees from the various toolsets don’t come onto these forums very often.

Also, I’m not sure if case 3 is a problem at all. You can only define the memory model for an assembly file once, and the assembler doesn’t support changes in the memory model in the source file. If you try to do this, the assembler with warn you that it has found another .model directive and is ignoring it.

So even though the .model directive comes after the declaration of the segment, the segment cannot be declared with the default flat memory model because that would result with a change in the memory model.

So if you check the object after you assemble:

you will notice that the section properties are the same. So this is treating the .model that is declared after the initial section is influencing the section attributes:

SECTION HEADER #1
/19 name (ASSEMBLY2_TEXT)
0 physical address
0 virtual address
0 size of raw data
0 file pointer to raw data
0 file pointer to relocation table
0 file pointer to line numbers
0 number of relocations
0 number of line numbers
60220020 flags
Code
Purgeable
2 byte align
Execute Read

So while it does have different attributes compared to the default ones with the flat memory model (since this section isn’t special), the assembler treats the .model directive as if it came before all directives.

So the assembler seems to default to flat, and the first .model directive will affect the entire file.

This is also not that crazy when you think that to support the macros, the assembler has to do at least two phases. The directives and macros would be parsed on the first pass, and the rest of it would be parsed on the second pass. This is why you can define sections using segment/ends before the .model directive, but you can’t use .code before the .model directive.

This is a signature. Any samples given are not meant to have error checking or show best practices. They are meant to just illustrate a point. I may also give inefficient code or introduce some problems to discourage copy/paste coding. This is because the major point of my posts is to aid in the learning process.

Источник


  1. Azatique

    Azatique

    New Member

    Публикаций:

    0

    Регистрация:
    1 окт 2011
    Сообщения:
    10

    Первый урок по ассемблеру (http://wasm.ru/article.php?article=1022004), первый исходник, перепечатанный в текстовый редактор, свежеустановленный masm32, стандартная консоль (Win+R, cmd.exe) — ошибка, копирую исходник из статьи, вставляю, удаляю русский комментарий — снова ошибка. В чем может быть дело? Заранее спасибо.

    1. C:Documents and SettingsAdmin>D:masm32binml.exe /c /coff D:1.asm
    2. D:1.asm(1) : error A2044: invalid character in file
    3. D:1.asm(2) : error A2085: instruction or register not accepted in current CPU m
    4. D:1.asm(6) : error A2119: language type must be specified
    5. D:1.asm(8) : error A2013: .MODEL must precede this directive
    6. D:1.asm(10) : error A2034: must be in segment block : WinMain
    7. D:1.asm(12) : error A2034: must be in segment block
    8. D:1.asm(13) : error A2034: must be in segment block
    9. D:1.asm(14) : fatal error A1010: unmatched block nesting : WinMain
    10. C:Documents and SettingsAdmin>D:masm32binml.exe /c /coff D:1.asm
    11. D:1.asm(1) : error A2044: invalid character in file

  2. mutagen

    mutagen

    New Member

    Публикаций:

    0

    Регистрация:
    25 сен 2011
    Сообщения:
    7

    Ошибки в синтаксисе (т.е. грамматические ошибки языка asm )
    сообщения от компилятора (D:1.asm(1) : error A2044: invalid character in file(не допустимый символ в файле и т.д.))

    Попробуй не копировать текст кода, а поработать ручками (т.е. открываешь блокнот/редактор и внимательно прописываешь каждую строку кода)

    (но это только имхо, автор кода «зашил» в текст невидимую, секретную мантру блокирующую функцию копирования) Just funny : )


  3. Azatique

    Azatique

    New Member

    Публикаций:

    0

    Регистрация:
    1 окт 2011
    Сообщения:
    10

    Первое ассемблирование — именно такая перепечатка вручную. Внимательная и вдумчивая. Второй раз скопировал — скопировалось все. Хотя, может, что-то невидимое и лишнее?
    Вопрос в том, какой символ может быть там недопустимым?
    И какие мантры-то, это же с wasm’а статья, одна из, думаю, самых популярных.


  4. Blackbeam

    Blackbeam

    New Member

    Публикаций:

    0

    Регистрация:
    28 дек 2008
    Сообщения:
    965

    1. ;Сырец 1. Минимальное приложение на Assembler’e (minimal.asm)
    2.                                        includelib masm32libkernel32.lib

    отлично компилится. обрати внимание, что папка с проектом находится в папке масм32, а папка масм32 — на диске С


  5. FatMoon

    FatMoon

    New Member

    Публикаций:

    0

    Регистрация:
    28 ноя 2002
    Сообщения:
    954
    Адрес:
    Russia

    это похоже на глюк qeditor’а. Старого. Был какой-то этап в развитии масма32, когда квикэдитор по каким-то своим причинам преобразовывал текст в html. Причем вроде бы как это была «фича» — даже команда в меню существовала — текст в хтмл. Скачайте последнюю версию пакета, там этот маразм устранен.

    Причем тут это? Притом что в хтмл-режиме первый символ — <, то есть открытие хтмл-тэга :))) видите вы на экране все ок, а вот то, что идет компилятору — совсем другое.


WASM

  • Remove From My Forums
  • Question

  • Need help on this. I am a student but dont know a thing bout this c++..

    .DATA
    
    	val1	SBYTE	-4, -2, 3, 1
    	val2	WORD	1000H, 2000H, 3000H, 4000H
    	val3	SWORD	-16, -14
    	val4	DWORD	1, 2, 3, 4, 5
    
    .CODE
    
    	mov ax, val2
    	mov eax, val4
    	movsx eax, val3
    	mov bx, 0A69BH
    	movzx eax, bx
    	movzx eax, bl
    	movzx ax, bh
    	mov bx, 0A69BH
    	movsx eax, bx
    	movsx ax, bl
    	movsx eax, bh
    	mov eax, 0FABC1234H
    	movsx eax, ah
    	movsx eax, al
    	mov ah, al
    
    .EXIT
    main ENDP
    END main

    The error is..

    1>------ Build started: Project: Assembly01, Configuration: Debug Win32 ------
    1>  Assembling [Inputs]...
    1>Assembly01.asm(1): error A2013: .MODEL must precede this directive
    1>Assembly01.asm(3): error A2034: must be in segment block
    1>Assembly01.asm(4): error A2034: must be in segment block
    1>Assembly01.asm(5): error A2034: must be in segment block
    1>Assembly01.asm(6): error A2034: must be in segment block
    1>Assembly01.asm(8): error A2013: .MODEL must precede this directive
    1>Assembly01.asm(10): error A2034: must be in segment block
    1>Assembly01.asm(11): error A2034: must be in segment block
    1>Assembly01.asm(12): error A2034: must be in segment block
    1>Assembly01.asm(13): error A2034: must be in segment block
    1>Assembly01.asm(14): error A2034: must be in segment block
    1>Assembly01.asm(15): error A2034: must be in segment block
    1>Assembly01.asm(16): error A2034: must be in segment block
    1>Assembly01.asm(17): error A2034: must be in segment block
    1>Assembly01.asm(18): error A2034: must be in segment block
    1>Assembly01.asm(19): error A2034: must be in segment block
    1>Assembly01.asm(20): error A2034: must be in segment block
    1>Assembly01.asm(21): error A2034: must be in segment block
    1>Assembly01.asm(22): error A2034: must be in segment block
    1>Assembly01.asm(23): error A2034: must be in segment block
    1>Assembly01.asm(24): error A2034: must be in segment block
    1>Assembly01.asm(26): error A2034: must be in segment block
    1>Assembly01.asm(27): fatal error A1010: unmatched block nesting : main
    1>C:Program Files (x86)MSBuildMicrosoft.Cppv4.0BuildCustomizationsmasm.targets(49,5): error MSB3721: The command "ml.exe /c /nologo /Zi /Fo"DebugAssembly01.obj" /I "C:Irvine" /W3 /errorReport:prompt  /TaAssembly01.asm" exited with code 1.
    ========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Answers

    • Marked as answer by

      Thursday, January 24, 2013 3:37 PM

1 / 1 / 0

Регистрация: 14.10.2010

Сообщений: 23

1

Работа с сопроцессором

22.03.2012, 20:31. Показов 10378. Ответов 3


Подскажите пожалуйста, каким образом можно с помощью команд сопроцессора вычислить такое выражение: 10*ln(x-1)? Особенно не могу разобраться с логарифмом.

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



Mikl___

Ушел с форума

Автор FAQ

15703 / 7377 / 980

Регистрация: 11.11.2010

Сообщений: 13,321

23.03.2012, 07:04

2

Kayako,

Assembler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
.data
x dd 3.1415926535897932384626433832795
ten dd 10.0
result dd ?
.code
    finit;инициализирую FPU
    fld1;загружаю 1
    fld x;загружаю Х
    fsub st(0),st(1); st(0)=X-1
    fyl2x;Computes ST(1)*log2(ST(0)), stores the result in register ST(1), 
;and pops the FPU register stack. The source operand in ST(0) must be a non-zero positive number.
    fldln2;загружает константу натурального логарифма 2 в вершину стека сопроцессора.
    fmul;Процессор может вычислить только логарифм по основанию 2.
;поэтому полученное значение умножаем на натуральный логарифм от 2. 
;И получаем натуральный логарифм от исходного числа.
    fmul ten; то что получилось умножаем на 10
    fstp result; результат в переменную

проверяем на калькуляторе 10*ln(x-1)=7,6154978288089441781804536122328

или можно так

Assembler
1
2
3
4
5
6
7
    fld ten; st(0)=10
        fld x;st(0)=X st(1)=10
        fld1;st(0)=1 st(1)=X st(2)=10
        fsubp st(1),st(0); st(0)=X-1 st(1)=10
        fyl2x;st(0)=st(1)*log2(st(0))
        fldln2;st(0)=ln(2) st(1)=10*log2(x-1)
        fmul;st(0)=st(0)*st(1)=10*ln(x-1)

Добавлено через 17 минут
или использовать команду FYL2XP1—Compute y * log2(x +1) предварительно отняв у Х два



2



preproger

0 / 0 / 0

Регистрация: 29.01.2013

Сообщений: 24

15.01.2014, 12:49

3

Mikl___, попробовал скомпилировать Ваш пример (MASM) и получил такие вот ошибки:

Assembler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
D:masm32bin>ml /c proga2.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.
 
 Assembling: proga2.asm
proga2.asm(1) : error A2013: .MODEL must precede this directive
proga2.asm(2) : error A2034: must be in segment block
proga2.asm(3) : error A2034: must be in segment block
proga2.asm(4) : error A2034: must be in segment block
proga2.asm(5) : error A2013: .MODEL must precede this directive
proga2.asm(6) : error A2034: must be in segment block
proga2.asm(7) : error A2034: must be in segment block
proga2.asm(8) : error A2034: must be in segment block
proga2.asm(9) : error A2034: must be in segment block
proga2.asm(10) : error A2034: must be in segment block
proga2.asm(12) : error A2034: must be in segment block
proga2.asm(13) : error A2034: must be in segment block
proga2.asm(16) : error A2034: must be in segment block
proga2.asm(17) : error A2034: must be in segment block
proga2.asm(17) : error A2088: END directive required at end of file

Содержимое файла:

Assembler
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
.data
x dd 3.1415926535897932384626433832795
ten dd 10.0
result dd ?
.code
    finit;инициализирую FPU
    fld1;загружаю 1
    fld x;загружаю Х
    fsub st(0),st(1); st(0)=X-1
    fyl2x;Computes ST(1)*log2(ST(0)), stores the result in register ST(1), 
;and pops the FPU register stack. The source operand in ST(0) must be a non-zero positive number.
    fldln2;загружает константу натурального логарифма 2 в вершину стека сопроцессора.
    fmul;Процессор может вычислить только логарифм по основанию 2.
;поэтому полученное значение умножаем на натуральный логарифм от 2. 
;И получаем натуральный логарифм от исходного числа.
    fmul ten; то что получилось умножаем на 10
    fstp result; результат в переменную

Не могу найти рабочий пример решения Любого математического уравнения сопроцессором с Выводом результата,
чтобы выполнить нужные мне задания на его основе.
Помогите, пожалуйста.



0



Ушел с форума

Автор FAQ

15703 / 7377 / 980

Регистрация: 11.11.2010

Сообщений: 13,321

15.01.2014, 13:25

4

preproger,

  1. это фрагмент программы, а не рабочий пример, судя по тому, что даже не пытаетешся разобраться с ошибками, которые выдал компилятор, я честно говоря не вижу смысла в «моей помощи»
  2. как выводить данные есть в закрепленной теме



0



Понравилась статья? Поделить с друзьями:

Читайте также:

  • Error a2006 undefined symbol messagebox
  • Error a2006 undefined symbol dgroup
  • Error a2005 symbol redefinition
  • Error a2004 symbol type conflict
  • Error a12 warning

  • 0 0 голоса
    Рейтинг статьи
    Подписаться
    Уведомить о
    guest

    0 комментариев
    Старые
    Новые Популярные
    Межтекстовые Отзывы
    Посмотреть все комментарии