From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,28db79a4b238c104,start X-Google-Attributes: gid103376,public From: joshhighley@hotmail.com (Josh Highley) Subject: What's wrong with this simple Ada w/ assembly code? Date: 1999/03/03 Message-ID: <36ddb9aa.0@silver.truman.edu>#1/1 X-Deja-AN: 451032075 Content-Type: Text/Plain; charset=US-ASCII Organization: Missouri Research and Education Network Mime-Version: 1.0 Newsgroups: comp.lang.ada Date: 1999-03-03T00:00:00+00:00 List-Id: 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