plotting point in 13h with Open Watcom inline assembly

  • Permalink
  • submit to reddit
  • Email
  • Follow


Hi

I use Open Watcom to play with 13h mode. It's just for fun :)

To init 13h mode, here is my code :

void initMode13(void)
{
	_asm
	{
		mov ax,13h
		int 10h
	}
}

and to plot :

void main(void)
{
    	initMode13();
    	char far *screen = (char far*)0x0A0000000;
    	*screen = (char) 1;
}

colour 1 is supposed to be red (0xff0000, initialized before 13h mode). But 
when I run, my program hangs. Why ?

I use this command line to compile :

wcl386 /l=dos4g test.c

Someone to help me ?

Thx
Laura

0
Reply Laura 9/21/2003 9:11:23 PM

See related articles to this posting


The screen's address is A000:0000. I'm not familiar with Watcom, but my
guess is that your pointer is 0A00:0000.

-Matt

"Laura Martignas" <lauramarty@libertysurf.fr> wrote in message
news:Xns93FDEBFBDB7B6lauraliberty@213.228.0.196...
> Hi
>
> I use Open Watcom to play with 13h mode. It's just for fun :)
>
> To init 13h mode, here is my code :
>
> void initMode13(void)
> {
> _asm
> {
> mov ax,13h
> int 10h
> }
> }
>
> and to plot :
>
> void main(void)
> {
>     initMode13();
>     char far *screen = (char far*)0x0A0000000;
>     *screen = (char) 1;
> }
>
> colour 1 is supposed to be red (0xff0000, initialized before 13h mode).
But
> when I run, my program hangs. Why ?
>
> I use this command line to compile :
>
> wcl386 /l=dos4g test.c
>
> Someone to help me ?
>
> Thx
> Laura
>
>


0
Reply Matt 9/21/2003 10:46:05 PM

Laura Martignas wrote:

> void main(void)

"int main". Pretty please?

> {
>     	initMode13();
>     	char far *screen = (char far*)0x0A0000000;

Looks like too many zeros. Try 0xA0000.

Best,
Frank



0
Reply Frank 9/21/2003 11:26:42 PM

> I use Open Watcom to play with 13h mode. It's just for fun :)
> To init 13h mode, here is my code :
<snip>
> mov ax,13h
> int 10h
<snip>
>     char far *screen = (char far*)0x0A0000000;
>     *screen = (char) 1;
<snip>
> I use this command line to compile :
> wcl386 /l=dos4g test.c

I don't know too much about Open Watcom, but I do know
about the PC's hardware.
For compatibility reasons, the CPU of a PC has several
operating modes. DOS only knows about 16-bit, but DOS extenders
and newer operating systems know 32-bit (or 64-bit :-)
On the lowest software level, 16-bit and 32-bit aren't 100% compatible,
and that's probably what goes wrong here. The code uses 16-bit
DOS programming stuff, while being compiled for 32-bit (looking at the
command line).
I suggest you look into the manual how to target 16-bit DOS, _or_
look for their 32-bit equivalents.

Herman



0
Reply Herman 9/22/2003 9:02:54 PM

"Laura Martignas" <lauramarty@libertysurf.fr> wrote in message
news:Xns93FDEBFBDB7B6lauraliberty@213.228.0.196...
> Hi
>
> I use Open Watcom to play with 13h mode. It's just for fun :)
>
> void main(void)
> {
>     initMode13();
>     char far *screen = (char far*)0x0A0000000;
>     *screen = (char) 1;
> }
>
> colour 1 is supposed to be red (0xff0000, initialized before 13h mode).
But
> when I run, my program hangs. Why ?

I see you're linking into dos4gw.

Welcome to protected mode. You now address memory in a linear fashion.
to convert a seg:off pair to a linear address u do the following:

linear=(segment shl 4)+offset
so quite simply B800:0000 becomes 0xb8000

Segment registers under protected mode arnt used in the say way as they are
under realmode.
They are used in the form of sel:offset

you can use a DPMI call to allocate a selector and set its base address as
0xa0000

all u do is load ES with the selector, and your reference memory location
(pixel) in EDI

thats one approach (not necessarily the best)

if your DS and ES already have a base of 0, they're likely to have a limit
of 4gig, so
you can just address anything inside that space with your ESI/EDI registers

your program is hanging because of an incompatible memory pointer.

cheers
alex



0
Reply alex 9/26/2003 8:01:11 AM

/* 32-bit Watcom C with CauseWay DOS extender */
int main(void) {
    char *screen = (char *)0xA0000;
    initMode13();
    *screen = 1;
    return 0;
}

/* 32-bit Watcom C with DOS/4GW extender
(*** This code is untested ***) */
int main(void) {
    char *screen = (char *)0xA0000;
    initMode13();
    *screen = 1;
    return 0;
}

/* 32-bit Watcom C with PharLap DOS extender
(*** This code is untested ***) */
#include <dos.h> /* MK_FP() */
#define	PHARLAP_CONVMEM_SEL	0x34
int main(void) {
    char far *screen = (char far *)MK_FP(PHARLAP_CONVMEM_SEL, 0xA0000);
    initMode13();
    *screen = 1;
    return 0;
}

/* 16-bit Watcom C (real mode) */
#include <dos.h> /* MK_FP() */
int main(void) {
    char far *screen = (char far *)MK_FP(0xA000, 0);
    initMode13();
    *screen = 1;
    return 0;
}


0
Reply NoEmailAds 9/27/2003 2:43:35 AM

 In comp.lang.asm.x86,    Msg ID: <bl0rji$l4m$1@lust.ihug.co.nz>
 "alex" <no@spam.pls.kthx.com>, wrote:

>"Laura Martignas" <lauramarty@libertysurf.fr> wrote in message
>news:Xns93FDEBFBDB7B6lauraliberty@213.228.0.196...

>> I use Open Watcom to play with 13h mode. It's just for fun :)

I'm new to HLLs, 
I've been resisting it for years.
Now I'm trying to decide which one to learn..

After getting Open Watcom,  and cuz it looks like 
the basics are there,
I decided on "just enough" of C/C++ and Fortran to get a clue.
And the same for win, NT and O/S2.
- Hey .. It rhymes !!!

A few questions for all..
Re: "It's just for fun".
Sounds like an apology - If so for what?


>I see you're linking into dos4gw.

That is what got me to Watcom.

>Welcome to protected mode. You now address memory in a linear fashion.
>to convert a seg:off pair to a linear address u do the following:

Now that I'm there, Have I arrived at a good place to start?
Cuz I think I've also come to the place I want to end too..
What else is there?

OBTW - If it isn't for fun, what's it for? Money? << sucker !!

--
Ray

0
Reply mchiper 9/29/2003 1:56:53 PM
comp.lang.asm.x86 4871 articles. 10 followers. Post

6 Replies
506 Views

Similar Articles

[PageSpeed] 27


  • Permalink
  • submit to reddit
  • Email
  • Follow


Reply:

Similar Artilces:

Need to know how to trap int 21h function 09h using watcom or inline assembly
I am writing a application in which i want to convert the textmode(03h=80x25x16) screen into graphics mode(12h=640x480x16). But while doing this i want to read the textmode buffer from memory address 0xb8000( i m using causeway as a extender). This application is sucessfull to run in windows 98 dos session. But it doesn't works on pure dos versions.so now i want to trap the specific interrupt which writes the buffer to memmory.But i m not getting how to do it.i know that in 21h function 09h does this. can any one give me some hints or any code to know how to trap int 21h function 09h usi...

visual c++ inline assembly migration to gcc inline assembly
Hi everyone! Sorry for bad english you may encounter below. I have some windows visual c++ inline assembly functions to migrate to linux gcc inline assembly. The goal of these functions is to handle big numbers used in RSA encyption/decryption systems. I am not very familiar with gcc inline assembly. I spent two days on migrating ln_copy(DWORD *p, DWORD *q)(copy the value of bignum q to p) and ln_zero(DWORD *p) (set the value of bignum p to zero). I got really frustrated. Now I have some more difficult functions which I just don't know how to migrate. I listed three typical ones h...

3D plots : "points plot" / "nuage de points"
Hello, I'm looking forward to a 3D plot function which would allow to display 3D "points plot" ("nuage de points", en Fran=E7ais...), each point's color beeing indexed by the colormap. Something similar is possible with surf() but facets are drawn... As far as hist3d() is concerned, we have columns... Thank you for your precious help, Gregala param3d1 ...

How to plot a curve point by point?
Hellow! Anyone has the idea about how to show a curve point by point? I use plot(x,y), but all the point of the curve show up at the same time, are there anyway i can control this procedure? thanks! John John wrote: > > > Hellow! > Anyone has the idea about how to show a curve point by point? I use > plot(x,y), but all the point of the curve show up at the same time, > are there anyway i can control this procedure? thanks! > > John several possible approaches: % the data x=1:5; y = rand(size(x)) ; 1) create different line objects for i=1:length(x), plot(x(i),y(i),...

Contour Plot + Points Plot
I found out that Proc Gcontour can produce the contour plot of Z=f(x,y). Normally, the contour plot is superimposed on the plot of points of Y vs X. Can you tell me how to create these two plots at the same time? Thank you Dale proc gcontour data=a; plot y*x=z; run;quit; __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com ...

plotting points in 3d plot??
hello.. how to plot just points in 3d plot if i have three vectors of big size (1500 x 1). I dont want matlab to draw joining lines from these points...i just want to see points in 3d plane...possible?? sohail I think the command is: >> plot3d(x,y,x) where x,y,z are single dimension sohail wrote: > > > hello.. > how to plot just points in 3d plot if i have three vectors of big > size (1500 x 1). > I dont want matlab to draw joining lines from these points...i just > want to see points in 3d plane...possible?? > > sohail sohail wrote: > hello.. > h...

plot a point to a series of points
Hi all, I'm having a little problem to connect one point to several points. I have a point : 1*2 matrix (A) and a 23*2 matrix (B). And I would like to link every points of the 23*2 matrix to my single point (1*2 matrix).. I tried several ways: plot(A,B) .. doesn't work plot(B,A) .. doesn't work plot([A(1),B(1:end)],[A(2),B(2:end)]) .. doesn't work plot([A(1,1),B(1:end,1)],[A(1,2),B(1:end,2)]) .. doesn't work please, need help!!! "Nicolas " <pam5663@hotmail.fr> wrote in message <hkjvgu$l0q$1@fred.mathworks.com>... > Hi all, > > I'm h...

Plot a curve points by points
Hello, (French translation in bottom) First, please excuse my bad english ... I've done a experiment on the resistance of a material, and I would try to trace (plot ?) my results on a curve, I've 12 points and I've done the experiment twice, how can I plot this ? Thx Antohny ---- Bonjour, J'ai fait un test pour evaleur la resistance d'un materiau et je voudrais tracer la courbe qui represente la deformation (en mm) en fonction de la force en N, comment puis-je realiser cela ? Mon pote qui travaille avec moi, utilise Mathlab, mais moi je suis sou...

plot derivative; plot with points
Hi all. I have two different queries on Gnuplot features: (1) Is it possible to plot derivative of a data file? In other words, if I have a data file that gives y-data as a function of x-data, can I plot dy/dx in Gnuplot from the data file? (2) I have a data file with many data points. I plot it 'with points' option. The problem is that where the curve is flat (horizontal), the points are too much dense, giving a thick-line like look, and where the curve is steep, the points look rarer and the plot is ok. If I use the 'every' option, say 'every 2', then the p...

Interpretting plot of two vectors as "multiline plot" with just point each in each plot?
Hi, When we apply the plot command to two matrices X and Y of equal size, matlab constructs a plot for every pair of corresponding columns in the two matrices, and assigns colors to the plots according the order specified in the ColorOrder property of the axes. eg: t = [0:0.01:1]'; rad = [1 2 3 4]; X = cos(2*pi*t)*rad; Y = sin(2*pi*t)*rad; plot(X,Y, '*') If X and Y are vectors instead of matrices, matlab always interprets them as consituting the points of a single plot, no matter whether X and Y are row or column vectors. Is there any (proper) way to force matlab to...

Re: Contour Plot + Points Plot
Hi, I think it can be done by Annotate, something like: data anno; set a; retain xsys '2' ysys '2' when 'a' function 'symbol' text 'circle'; run; proc gcontour data=a annotate=anno; plot y*x=z; run; ...

plot cloud points with rg of each points
I am using 3d laser scanner , and have x,y and z axis from my sensor these three points , now what i want to know is that how can i build 3d point cloud from my these three points and how can i draw the normal to the surface in the resulting point cloud. and also with rgb for each point. Thanks in advanceProvide a detailed description of the issue you are facing. ...

plot and diaplay data point by point
hi, i there a way to display what is being plotted in matlab,point by point, like a oscilloscope. e.g suppose i have an array x=[1:1:5];y=x.^2; i need to plot y values on the graphwithin a for loop,but as the loop goes through each data point, y values should be plotted sample by sample. in debug mode it works, but otherwise, even if i put a delay within loop, the loop first finishes,and then displays the result. code is x=[1:1:5];y=x.^2; for j=1:length(y) stem(x(j),y(j));hold on; conv2(rand(200,200),rand(200,200)); % to slow up the loop end any help? thnks sid "s...

Plot points on the same plot inside a loop
Hello, I have set up a for loop. At the end of each iteration, I end up with a scalar value, which I append to a vector, d. Each iteration takes quite a while, and I would like to see (plot) the values of d as they are calculated. So, - Iteration 1: Calculate the first value of d. Open up a figure. Plot the first point. - Iteration 2: Calculate the second value of d. Plot the second point on the same figure. - ... I would also like to join them with a line as they appear. I was thinking for plotting my vector d at the end of each iteration, and just closing the previous figure b...

plotting a point on a line between two points
Hi Sorry if this is totally elementary, I really should have paid more attention in math class! If I have two points(in 3d space), lets say point 1 is(1,2,5) and point 2 is (4,8, 50), and I want to plot an arbitraray point on a line between the two points but only know the third value, so point 3 is (x,y, 15) what mathematical formula do I use to figure out x and y? Again, sorry as I am sure this is totally elementary, but I have spent the better part of the morning googling this and many other groups to no avail. Thanks Mike Cardeiro mcardeiro@yahoo.com wrote: > If I have two poi...

plot from the end of former plot (point)
Hallo, I need to plot a new curve on the end of the original that i have. I need the new plot to begin at this point. I currently have a curve that finishes at (a,b) for example. this means that I then want to begin my next plot from (a,b) rather than (0,0) or just a change on one axis. Is there a way of doing this without changing the major plot formulas. Thank you for your help and assistance in advance. Cheers Aidan yes first if u want to plot a graph above another u can use hold for example plot(x,y) hold on plot(v,f) hold off and don't forget hold off statement On Jan 15, 1...

is there any function to plot draggable points on plots?
ginput can plot points interactively but the points are not draggable. "Ha" wrote in message <k8636h$8ph$1@newscl01ah.mathworks.com>... > > ginput can plot points interactively but the points are not draggable. No, you have to code that yourself using a series of functions. Here is a simple example: function dragtest figure axes('xlimmode','manual','ylimmode','manual') %<- important line(0.5,0.5,'marker','s','markersize',10,'hittest','on','buttondownfcn',@clickmarker) fun...

Inline assembly and Tasking compiler/assembler
Hello, I'm using the Tasking C compiler/assembler toolchain and I need to do some inline assembly code. What I want to do is copy the SR (status register) to a variable in the C code so I can examine it. However, I haven't been able to get the inline assembly code to recognize the C varable. The only thing I can find for inline assembly is the _ASMLINE, _ASM, and _CASM. Is there a way to do what I want or am I just missing something? Thanks. Mike ...

Plot points on the same plot inside a loop #2
Hello, I have set up a for loop. At the end of each iteration, I end up with a scalar value, which I append to a vector, d. Each iteration takes quite a while, and I would like to see (plot) the values of d as they are calculated. So, - Iteration 1: Calculate the first value of d. Open up a figure. Plot the first point. - Iteration 2: Calculate the second value of d. Plot the second point on the same figure. - ... I would also like to join them with a line as they appear. I was thinking for plotting my vector d at the end of each iteration, and just closing the previous figure b...

Point of defining an inline function and calling it at the same point?
Ok, I'm sure that subject is confusing, but I noticed the following curious code on the main page of the "Vitamin" web developer's page <http://www.thinkvitamin.com/>: <script type="text/javascript"> //<![CDATA[ (function(id) { document.write('<script type="text/javascript" src="' + 'http://www.northmay.com/deck/deck' + id + '_js.php?' + (new Date().getTime()) + '"></' + 'script>'); })("VM"); //]]> </script> The key thing I noticed is that this is def...

how to plot 3d points, each point with grayscale intensity
hi, i have a set of 300 points with 3d coordinates, each point with intensity values. is it possible to plot these points on 3d axes, each point being in a different shade of gray corresponding to their intensity? thanks so much in advance!! no one replied yet, but i just figured it out, so i thought i would post it here for people who might be wondering too. so the plot command takes color values in pseudo-rgb on a scale from 0 to 1 for each rgb number, and the grayscale colors actually run in multiples of [1 1 1] (on the actual rgb scale), so i ended up just scaling my intensities on 1 and...

Plotting data + colouring data points in the plot
Hi, I've got txt files which consist of the columns similar to this: -0.05682 0 0.02609 0.02841 0 0.00379 9.34659 0 0.021 20 0 0.02227 30.69602 0 0.03884 41.06534 0 0.05285 51.34943 0 0.07197 61.33523 0 0.00889 71.20739 0 0.04967 81.16477 0 0.01781 91.13636 0 0.028 101.26421 0 0.04903 111.32102 0 0.021 121.29261 0 0.02163 131.22159 0 0.04393 141.27841 0 0.05859 151.40625 0 0.0433 161.33523 0 0.05668 171.25 0 0.0108 181.22159 0 0.10637 This is just a piece of the data file. The columns are separated by space and the first two columns represent x y position a...

Plotting data and including the ORDER of the points on the plot
thought this would be quite simple, but cant get it to work or see anyone else with a similiar prob. I have a normal 2D graph of data points. (say numbering 20 in total). plot(x,y). great. I would like to see the number of the datapoint displayed on the graph. how? eg X3,Y3=14.167, 17.123. I want to see a small label placed near the X3,Y3 data point, called "3". The order of the datapoints is visually important to me. any ideas? Many Thanks! Hi Hugh, Please try the following: N = 20; x = rand(N,1); y = rand(N,1); plot(x,y); for k = 1:N ...

Plotting points in fainter color on an IDL plot
Hello, I have a scatter plot in which there are some points which represent= more reliable determinations than others. I want to plot both kinds of poi= nts in the same color but the less reliable ones in paler colors. In a sens= e, I want to change the brightness of few points on the plot. Is it possibl= e in IDL? I am using color table 13 and plot and oplot procedure of IDL. Thanks for the help, Kaushal Kaushal Sharma writes: > Hello, I have a scatter plot in which there are some points which represent more reliable determinations than others. I want to plot both kinds of...