comp.lang.ada
 help / color / mirror / Atom feed
* What's wrong with this simple Ada w/ assembly code?
@ 1999-03-03  0:00 Josh Highley
  1999-03-04  0:00 ` Tom Moran
                   ` (3 more replies)
  0 siblings, 4 replies; 27+ messages in thread
From: Josh Highley @ 1999-03-03  0:00 UTC (permalink / raw)


  I'm trying to link some really simple assembly code with Ada.  I 
haven't been able to find any good examples or explanations on how to do 
this.  I didn't want to do it, but I guess this is the quickest way to 
get a solution that I can then work/experiment with.  I think I'm close 
to getting this but I'm not sure what I need to do.  I want to use 
assembly to position the cursor on the screen.  At this point, I've 
hard-coded the location into the code, but after I get this working, 
I'll pass a row and column from the Ada program.  Here's the code I've 
been experimenting with:

; I have A86 on my PC so my assembly code is a .com   I have access to 
; MASM, though, if needed.  "moveto.asm":

page 60, 132
title moveto
codesg segment para 'code'
   assume cs:codesg, ds:codesg, ss:codesg, es:codesg
   org 100h
   jmp moveto
;-------------------
 row db 15
 col db 20
;-------------------
moveto proc near
   mov ah, 02h
   mov bh, 00
   mov dh, row
   mov dl, col
   int 10h

   mov ax, 4C00h
   int 21h
moveto endp
codesg ends
end
-------------------------------------------------------------------
Here's the Ada code.  I'm using GNAT 3.11, AdaGIDE 6.21, and Win95.
-----------------
with ada.text_io;
use ada.text_io;

procedure assembly_test is
    pragma Linker_Options("c:/gnat311/programs/moveto.obj");
        procedure moveto;
        pragma import (Assembler, moveto, "moveto");
begin  -- assembly_test
    moveto;
    put("Here it is.");
end assembly_test;
-------------------------

Everything I have so far is from a response to a less specific assembly 
with Ada question I posed earlier, and from looking at a few packages 
that link C code. I assembled the code using A86 to a .com file which 
also yielded an .obj file and .sym file.  The Ada compiles fine, but 
when I build it, I get the message "c:/gnat311/programs/moveto.obj: file 
not recognized: File format not recognized    gnatmake: *** link failed"
  
What do I need to do to make this code work? Also, are there any books 
or Internet sources that have good explanations and/or examples on 
using assembly from Ada? I hate to keep bothering this newsgroup with 
questions that are no doubt basic to people who know how to do this.

Thanks,

Josh Highley
joshhighley@hotmail.com





^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~1999-03-17  0:00 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-03  0:00 What's wrong with this simple Ada w/ assembly code? Josh Highley
1999-03-04  0:00 ` Tom Moran
1999-03-04  0:00   ` robert_dewar
1999-03-04  0:00 ` robert_dewar
1999-03-04  0:00   ` Mike Silva
1999-03-04  0:00     ` Josh Highley
1999-03-04  0:00     ` Samuel Mize
1999-03-04  0:00       ` Tom Moran
1999-03-05  0:00         ` robert_dewar
1999-03-05  0:00           ` Tom Moran
1999-03-04  0:00     ` robert_dewar
1999-03-05  0:00       ` Mike Silva
1999-03-05  0:00         ` Ed Falis
1999-03-08  0:00     ` Matthew Heaney
1999-03-06  0:00 ` Nick Roberts
1999-03-06  0:00   ` David Botton
1999-03-07  0:00   ` Tom Moran
1999-03-07  0:00 ` Jerry van Dijk
1999-03-07  0:00   ` Tom Moran
1999-03-08  0:00     ` Jerry van Dijk
1999-03-14  0:00   ` Josh Highley
1999-03-14  0:00     ` David C. Hoos, Sr.
1999-03-15  0:00       ` Josh Highley
1999-03-15  0:00     ` Jerry van Dijk
     [not found]       ` <36ef2175.4732984@news.pacbell.net>
1999-03-17  0:00         ` Jerry van Dijk
1999-03-16  0:00     ` Dale Stanbrough
1999-03-16  0:00       ` Jerry van Dijk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox