Board index » off-topic » how to create assembly code using Tasm that can be used with the Borland C++ 5.5

how to create assembly code using Tasm that can be used with the Borland C++ 5.5


2003-08-04 12:55:20 AM
off-topic19
Hello,
I've had problems compiling assembly code with C code using the Borland C++
5.5 linker. The problem specifically was the error "Unsupported 16 bit
segment(s) in module xxx.asm". I've been creating assembly code for
real-mode DOS (which I've read is 16 bit). My code looks assembly is this:
.MODEL SMALL
.STACK 100H
_DATA SEGMENT WORD 'DATA'
ROW equ [bp + 4]
COL equ [bp + 6]
_DATA ENDS
.386
;_TEXT SEGMENT BYTE PUBLIC 'CODE'
.code
DGROUP GROUP _DATA
ASSUME CS:_TEXT, DS:DGROUP, SS:DGROUP
PUBLIC _set_curs
_set_curs PROC FAR
PUSH BP
MOV BP,SP
MOV AH,02H
MOV BX,0
MOV DH,ROW
MOV DL,COL
INT 10H
POP BP
RETF
_set_curs ENDP
;_TEXT ENDS
END
That's the entire assembly module (who's purpose is to call the int routine
to move the cursor according to the rows and columns the C interface tells
it to). If anyone can give me suggestions, it would be greatly appreciated.
Many thanks.
 
 

Re:how to create assembly code using Tasm that can be used with the Borland C++ 5.5

32 bit programs run in flat model. They do not use small model. The stack
is specified in the code for 16 bit DOS programs but not for Windows
programs.
Direct int 10H control of the video card is not compatible with 32 bit
Windows.
The Win32 programming spec states that application programs are banned from
use of interrupts (other than the breakpoint interrupt).
Why don't you let the compiler itself show you what an assembly program
intended for Win32 looks like? Here is an example:
-------------------------------------------
C:\Lookat\temp
Quote
type temp55.cpp
#include <stdio.h>
int main()
{
printf("Hello World");
return 0;
}
C:\Lookat\temp
Quote
bcc32 -WCR -S temp55
Borland C++ 5.6.4 for Win32 Copyright (c) 1993, 2002 Borland
TEMP55.CPP:
C:\Lookat\temp
Quote

-------------------------------------------
--Contents of TEMP55.ASM---
---(I have manually removed the debug macros and debug declarations)---
.386p
model flat
_TEXT segment dword public use32 'CODE'
_TEXT ends
_DATA segment dword public use32 'DATA'
_DATA ends
_BSS segment dword public use32 'BSS'
_BSS ends
DGROUP group _BSS,_DATA
_TEXT segment dword public use32 'CODE'
_main segment virtual
@_main proc near
?live16385@0:
;
; int main()
;
push ebp
mov ebp,esp
;
; {
; printf("Hello World");
;
@1:
push offset s@
call @_printf
pop ecx
;
; return 0;
;
xor eax,eax
;
; }
;
@3:
@2:
pop ebp
ret
@_main endp
_main ends
_TEXT ends
_DATA segment dword public use32 'DATA'
s@ label byte
; s@+0:
db "Hello World",0
align 4
_DATA ends
_TEXT segment dword public use32 'CODE'
_TEXT ends
@_printf equ _printf
end
--End Of Contents of TEMP55.ASM---
. Ed
Quote
Fernando wrote in message
news:3f2d3e7c$ XXXX@XXXXX.COM ...