I’m trying to write a bootloader for an OS I’m developing.
I’m getting a syntax error on the first line.
Here is my assembly code:
.286 ; CPU Type
.model TINY ; memory of model
;---------------------- EXTERNS -----------------------------
extrn _BootMain:near ; prototype of C func
;------------------------------------------------------------
;------------------------------------------------------------
.code
org 07c00h ; for BootSector
_main:
jmp short _start ; go to main
nop
;----------------------- CODE SEGMENT -----------------------
_start:
cli
mov ax,cs ; Setup segment registers
mov ds,ax ; Make DS correct
mov es,ax ; Make ES correct
mov ss,ax ; Make SS correct
mov bp,7c00h
mov sp,7c00h ; Setup a stack
sti
; start the program
call _BootMain
ret
END _start
END _main ; End of program
Here’s my compile line:
"*location*14.10.25017binHostX86x86ML.EXE" /c StartPoint.asm
The error I’m getting:
StartPoint.asm(1): error A2008: syntax error : .
As far as I know, this line shouldn’t be a problem.
Thanks for the help
Permalink
Cannot retrieve contributors at this time
description | title | ms.date | ms.topic | f1_keywords | helpviewer_keywords | ms.assetid |
---|---|---|---|---|---|---|
Learn more about: ML Nonfatal Error A2008 |
ML Nonfatal Error A2008 |
12/17/2019 |
error-reference |
A2008 |
A2008 |
ca24157f-c88a-4678-ae06-3bc3cd956001 |
syntax error :
A token at the current location caused a syntax error.
One of the following may have occurred:
-
A dot prefix was added to or omitted from a directive.
-
A reserved word (such as C or SIZE) was used as an identifier.
-
An instruction was used that was not available with the current processor or coprocessor selection.
-
A comparison run-time operator (such as
==
) was used in a conditional assembly statement instead of a relational operator (such as EQ). -
An instruction or directive was given too few operands.
-
An obsolete directive was used.
See also
ML Error Messages
Ferreira 1 / 1 / 0 Регистрация: 12.11.2018 Сообщений: 5 |
||||
1 |
||||
MASM 18.09.2019, 23:37. Показов 7091. Ответов 2 Метки нет (Все метки)
Начал изучать книгу «Самоучитель Ассемблера» Александра Крупника, и в первой же программе ошибка.
PowerShall: PS D:Asemblersum> ml /c /coff new.asm Assembling: new.asm
0 |
Programming Эксперт 94731 / 64177 / 26122 Регистрация: 12.04.2006 Сообщений: 116,782 |
18.09.2019, 23:37 |
2 |
Ушел с форума 15893 / 7467 / 1012 Регистрация: 11.11.2010 Сообщений: 13,449 |
|
19.09.2019, 04:01 |
2 |
Ferreira, new.asm(7) : error A2008: syntax error : in instruction в 9 строке после ExitProcess должна быть запятая new.asm(9) : error A2166: structure field expected
2 |
1 / 1 / 0 Регистрация: 12.11.2018 Сообщений: 5 |
|
19.09.2019, 19:20 [ТС] |
3 |
Спасибо, разобрался.
0 |
This says no active RAS connection when there is an internet connection via dial up ??
; Hang_Up.asm Sever POT connection huntingspace,
;
include masm32includemasm32rt.inc
include MASM32includerasapi32.inc
includelib MASM32librasapi32.lib
.data?
lpRasConn dd ?
dwCb dd ?
dwConnections dd ?
l_RASCONN RASCONN 0FFh dup ({})
l_Buffer_Size dd ?
l_Conn_Count dd ?
.code
start:
xor eax,eax
mov dwCb,eax
mov dwConnections,eax
mov lpRasConn,eax
; Call RasEnumConnections with lpRasConn = NULL.
; dwCb is returned with the required buffer size and a return code of ERROR_BUFFER_TOO_SMALL
;invoke RasEnumConnections,lpRasConn, addr dwCb,addr dwConnections
invoke RasEnumConnections, addr l_RASCONN, addr l_Buffer_Size, addr l_Conn_Count
.if (eax== ERROR_BUFFER_TOO_SMALL)
; Allocate the memory needed for the array of RAS structure(s).
invoke GetProcessHeap
mov edi,eax
invoke HeapAlloc,edi,HEAP_ZERO_MEMORY,dwCb
.if !(eax & eax)
printf("HeapAlloc failed!",13,10)
;printf("RegOpenKeyEx %snn", LastError$())
jmp exit0
.endif
mov lpRasConn,eax
; The first RASCONN structure in the array must contain the RASCONN structure size
mov esi,lpRasConn
mov [esi].RASCONN.dwSize,sizeof RASCONN
; Call RasEnumConnections to enumerate active connections
invoke RasEnumConnections,esi,addr dwCb,addr dwConnections
; If successful, print the names of the active connections.
.if !(eax & eax)
printf("The following RAS connections are currently active:",13,10)
xor ebx,ebx
.repeat
lea eax,[esi].RASCONN.szEntryName
;printf("%s",13,10),eax
printf("%sn",eax)
add esi,sizeof RASCONN
inc ebx
.until (ebx>=dwConnections)
.endif
;Deallocate memory for the connection buffer
invoke HeapFree,edi,0,lpRasConn
jmp exit0
.endif
; There was either a problem with RAS or there are no connections to enumerate
.if(dwConnections >= 1)
printf("The operation failed to acquire the buffer size.",13,10)
.else
printf("There are no active RAS connections.",13,10)
.endif
exit0:
; terminate the Remote Access Connection
invoke RasHangUp, l_RASCONN.hrasconn
invoke Sleep,1500 ; give the system enuf time to end the connection
; Don't want to leave the port in an inconsistent state.
invoke ExitProcess,0
end start
;
; i think you need fill some params in your sample before RasEnumConnections API is called:
; CODE
;
; mov l_RASCONN.RASCONN.dwSize, sizeof RASCONN
; mov l_Buffer_Size, sizeof l_RASCONN
hey Max
thanks for the help.
I am using MS compiler to compile from .cpp to .asm.
As per your suggestion i turned the RTC option off and now it doesnt show this error …..BUT now it shows a new error to me
Compiling…
test.cpp
Linking…
test.obj : error LNK2005: «`string'» (??_C@_0M@LACCCNMM@hello?5world?$AA@) already defined in test.obj
test.obj : error LNK2005: _main already defined in test.obj
Debug/test.exe : fatal error LNK1169: one or more multiply defined symbols found
i am pasting my small test.cpp code and the .asm generated
test.cpp
#include «stdafx.h»
int
_tmain(int argc, _TCHAR* argv[])
{
printf(«hello world»);
return 0;
}
test.asm
; Listing generated by Microsoft Optimizing Compiler Version 13.10.3077
TITLE . est.cpp
.386P
include listing.inc
if @Version gt 510
.model FLAT
else
_TEXT SEGMENT PARA USE32 PUBLIC ‘CODE’
_TEXT ENDS
_DATA SEGMENT DWORD USE32 PUBLIC ‘DATA’
_DATA ENDS
CONST SEGMENT DWORD USE32 PUBLIC ‘CONST’
CONST ENDS
_BSS SEGMENT DWORD USE32 PUBLIC ‘BSS’
_BSS ENDS
$$SYMBOLS SEGMENT BYTE USE32 ‘DEBSYM’
$$SYMBOLS ENDS
$$TYPES SEGMENT BYTE USE32 ‘DEBTYP’
$$TYPES ENDS
_TLS SEGMENT DWORD USE32 PUBLIC ‘TLS’
_TLS ENDS
; COMDAT ??_C@_0M@LACCCNMM@hello?5world?$AA@
CONST SEGMENT DWORD USE32 PUBLIC ‘CONST’
CONST ENDS
xdata$x SEGMENT DWORD USE32 PUBLIC ‘CONST’
xdata$x ENDS
; COMDAT _main
_TEXT SEGMENT PARA USE32 PUBLIC ‘CODE’
_TEXT ENDS
; COMDAT ?_Psave@?$_Facetptr@V?$ctype@G@std@@@std@@2PBVfacet@locale@2@B
_DATA SEGMENT DWORD USE32 PUBLIC ‘DATA’
_DATA ENDS
; COMDAT ?_Psave@?$_Facetptr@V?$ctype@D@std@@@std@@2PBVfacet@locale@2@B
_DATA SEGMENT DWORD USE32 PUBLIC ‘DATA’
_DATA ENDS
sxdata SEGMENT DWORD USE32 ‘SXDATA’
sxdata ENDS
FLAT GROUP _DATA, CONST, _BSS
ASSUME CS: FLAT, DS: FLAT, SS: FLAT
endif
INCLUDELIB LIBCD
INCLUDELIB OLDNAMES
PUBLIC _main
PUBLIC ??_C@_0M@LACCCNMM@hello?5world?$AA@ ; `string’
EXTRN _printf:NEAR
; COMDAT ??_C@_0M@LACCCNMM@hello?5world?$AA@
; File c:documents and settingssdesaimy documentsvisual studio projects est est.cpp
CONST SEGMENT
??_C@_0M@LACCCNMM@hello?5world?$AA@ DB ‘hello world’, 00H ; `string’
; Function compile flags: /Odt /ZI
CONST ENDS
; COMDAT _main
_TEXT SEGMENT
_argc$ = 8 ; size = 4
_argv$ = 12 ; size = 4
_main PROC NEAR ; COMDAT
; Line 7
push ebp
mov ebp, esp
sub esp, 64 ; 00000040H
push ebx
push esi
push edi
; Line 8
push OFFSET FLAT:??_C@_0M@LACCCNMM@hello?5world?$AA@
call _printf
add esp, 4
; Line 9
xor eax, eax
; Line 10
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 0
_main ENDP<
/P>
_TEXT ENDS
END
thanks in advance for your help
Shippi