rjd@nancy (Rob DeMillo) (05/30/87)
For some reason I am having trouble doing the following:
I need to write a MASM routine that is callable from a higher level
MS language. (C or ForTran preferred...) The routine should just
accept three values: a screen coordinate (x,y) and a color. The
routine should then turn on the pixel at the approriate point in the
appropriate color. Thats all. I have written in MASM for quite a while
now, and have been regularly using it to write low lever routines for
some ohf my high level languages...but this has been giving me problems
for a few weeks.
Does anyone out there have such a routine in the PD? Or any suggestions?
For reference I am using:
An IBM XT
DOS 3.10
MASM 1.0
MS C 3.00
MS Fortran (don't have version handy, but its three years old)
Thanks for any help...
- Rob DeMillo
Brown University - Planetary Science Group
UUCP: ...{seismo!harpo}!ihnp4!brunix!rjd -- or --
...{seismo!harpo}!ihnp4!brunix!europa!demillo
BITNET: GE702025@BROWNVM
SPAN: BRNPSG::DEMILLO
CompuServe: 73537,2737
------
"...I am not so sure what you want me for!
Either your machine is a fool, or me..." -- "WarGames", CSN
phco@ecsvax.UUCP (John Miller) (06/03/87)
Here's one for Microsoft Pascal. I'm not sure about the differences in
parameter passing, but I think Microsoft C can use this.
; wr_pixel.asm
; calls the IBM PC rom BIOS video service to write a pixel dot
; to call from MS-PASCAL:
; procedure wr_pixel(x,y,color: integer); extern;
; x and y are horizontal and vertical coordinates (0,0 at upper left)
; color depends on screen mode and color palette (see DOS manual)
;
; ----- John Miller 10/23/86
WRPIXS SEGMENT 'CODE'
PUBLIC WR_PIXEL
WR_PIXEL PROC FAR
PUSH BP ; SAVE BASE POINTER
MOV BP,SP
MOV AL,6[BP] ; GET COLOR
MOV DL,8[BP] ; GET Y
MOV CX,10[BP] ; GET X
MOV AH,12
INT 16 ; CALL BIOS WRITE PIXEL
POP BP
RET 6 ; REMOVE PARAMETERS FROM STACK
WR_PIXEL ENDP
WRPIXS ENDS
END
--
John Miller (ecsvax!phco)
Dept. of Pharmacology, Univ. of N.C.-Chapel Hill
Chapel Hill, NC 27514 (919) 966-4343leder@ihlpm.ATT.COM (Leder) (06/03/87)
In article <15963@brunix.UUCP>, rjd@nancy (Rob DeMillo) writes: > For some reason I am having trouble doing the following: > > I need to write a MASM routine that is callable from a higher level > MS language. (C or ForTran preferred...) The routine should just > accept three values: a screen coordinate (x,y) and a color. The > routine should then turn on the pixel at the approriate point in the > appropriate color. Please don't take this for a flame, but why not just use MSC to call INT 10, i.e. int86() or int86x or use a "far" pointer to the memory block of the screen and use & and | to twiddle the bits. Bob Leder