flat assembler
Message board for the users of flat assembler.

Index > Main > 32bit asm code in 16bit c++ compiler?

Author
Thread Post new topic Reply to topic
cylo



Joined: 06 Nov 2004
Posts: 20
cylo 15 Feb 2005, 17:18
Hello!

A short generall question: Is it possible to compile a 32bit asm code into a object or so and include it in my 16bit borland c++ 3.1 dos compiler?
Post 15 Feb 2005, 17:18
View user's profile Send private message Reply with quote
Matrix



Joined: 04 Sep 2004
Posts: 1166
Location: Overflow
Matrix 15 Feb 2005, 17:58
yes Smile
and you can use 32bit instructions too, in 16 bit mode
for example db $66; stosb; means stosd
only a prefix is the difference
but in 32 bit mode, you have that prefix on the 16 bit instructions
Post 15 Feb 2005, 17:58
View user's profile Send private message Visit poster's website Reply with quote
cylo



Joined: 06 Nov 2004
Posts: 20
cylo 15 Feb 2005, 18:31
my prob is that i have a asm code for my "vesa refresh rate tool" but it uses extended register which are not supported in borland c++ 3.1. inline asm

did i mention i am a asm noob? Laughing
Post 15 Feb 2005, 18:31
View user's profile Send private message Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 15 Feb 2005, 18:46
well there is one more problem. It works with db 66h before instruction (i have been using it too under turbo pascal), but there are several problems:
1. don't forgat to check for 386+ processor
2. If you use constants (immediates), they must be extended to 32 bits:

16 bit code:
mov bx,3210h is ?? 10 32
mov ebx,76543210h is 66 ?? 10 32 54 76 (?? is same as in mov bx, i can't remember now)
so as you see, you also have to add two bytes of constant, so
you need
;mov ebx,765433210h
db 66h
mov bx,3210h
dw 7654h

you can also extend addressing to 32bit with 67h prefix but that is a little bigger problem.
Post 15 Feb 2005, 18:46
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
cylo



Joined: 06 Nov 2004
Posts: 20
cylo 17 Feb 2005, 13:59
havy stuff for me Embarassed

okay.. lets say i want to do this:

Code:
mov ecx, 0x35714000 (requested pixel clock in hz)    


how do i solve this if my compiler does not understand ecx?
Post 17 Feb 2005, 13:59
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 17 Feb 2005, 14:17
The most common and troubles-free answers are:
1. Get new compiler... there are many free 32bit compilers.
2. Waste all these fake HLL compilers and use FASM for writing whole programs - beleave me this is not so awfully as it looks. Smile
Actually the natural way of a programmer is:
Code:
interpreted HLL -> compiled HLL -> fashionable HLL -> any HLL with inline assembler -> more inline ASM -> MASM -> FASM    


Of course, there are exceptions - some of the programmers begin directly with compiled HLL, some of them never reach the FASM level...it is a matter of skills you know. Also, these days, the smartest one simply skip MASM level. Very Happy

Regards.
Post 17 Feb 2005, 14:17
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
cylo



Joined: 06 Nov 2004
Posts: 20
cylo 17 Feb 2005, 15:55
i would if i could... but i have to go the hard way. Mad
Post 17 Feb 2005, 15:55
View user's profile Send private message Reply with quote
f0dder



Joined: 19 Feb 2004
Posts: 3175
Location: Denmark
f0dder 17 Feb 2005, 17:48
You can use FASM to assemble the VESA code, and link with your C project. A (IMHO better) solution would be getting the microsoft visual c++ 2003 toolkit (which is free), produce PE executables, and use a dos extender like WDOSX to have it run under dos.
Post 17 Feb 2005, 17:48
View user's profile Send private message Visit poster's website Reply with quote
cylo



Joined: 06 Nov 2004
Posts: 20
cylo 21 Feb 2005, 13:55
no, i am bound to borland c++ 3.1 Sad

Another short question:

how can i print out the value of a register to dos screen?
Post 21 Feb 2005, 13:55
View user's profile Send private message Reply with quote
Vortex



Joined: 17 Jun 2003
Posts: 318
Vortex 22 Feb 2005, 11:00
Quote:
Also, these days, the smartest one simply skip MASM level.


John, every good man is deserving a chance. Smile

_________________
Code it... That's all...
Post 22 Feb 2005, 11:00
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.