Duoas 1,025 Postaholic Featured Poster

Actually, you've done quite admirably. My score: 1768.

A couple notes though:

  1. main returns int: int main()
  2. Don't use system("pause") and system("cls"). Here are some good replacements:
    void pause()
    {
      cout << "Press ENTER to continue..." << flush;
      cin.clear();  // (assume the user is playing interactively)
      cin.sync();   //
      cin.ignore( numeric_limits<streamsize>::max(), '\n' );
    }
    
    void clearscreen()
    {
      for (int i = 0; i < 100; i++) cout << '\n';
      cout << flush;
    }
  3. Your "a b c d" is off by one space. But I assume this is because you did not use [code] tags to paste your code...
  4. Use complete sentences and avoid 1337/cellphone speak when writing instructions. Also, you did not give instructions on how to enter the position. The other problem is that if the user enters the wrong answer the program crashes.

    You should add a little error checking to validate the user's input, and complain if he enters something wrong. This is a fairly involved subject, so the simplest thing would be simply to wrap everything in a try..catch block and complain if the user enters the wrong thing:

    cout<<"Enter the position: ";
        try {
          if (!(cin>>x_char)) throw 1;
          if (!(cin>>y))      throw 1;
          x=change(x_char); //change char to int
          if (x < 0) throw 1;
          skip=check_skip (pos,x,y); //skip step if pos is ' '
          }
        catch (int) {
          cout << "You must type a letter (A..J) followed by a number (0..9) and then press ENTER.\n";
          pause();
          skip = 1;
          }
  5. To convert the character …
Duoas 1,025 Postaholic Featured Poster

Typed constants are not true constants in TP. If you change it it stays changed.

Which means something else is wrong with your code. Post it and I'll take a look and see if I can find what's wrong.

Duoas 1,025 Postaholic Featured Poster

Break it down into its constituent parts:

int yi = y - i;
  int val = row[ yi ];

  if (val == x) goto return_false_part;
  if (val == x - i) goto return_false_part;
  if (val == x + i) goto return_false_part;

Stick that in the loop, and add return false and return true parts, and you should be able to translate it easily.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster
Duoas 1,025 Postaholic Featured Poster

Yes, but you would still have to have some way of figuring out what the remaining arguments are.

If I were to say printf( "%s", 12 ); it would fail, because it has no way to verify that the second argument is, in fact, a char*. Since it isn't, the program crashes.

Duoas 1,025 Postaholic Featured Poster

You've got that backwards, bub.

What you are saying is that you want your feature even though it wouldn't work or it would break on someone else's computer. Such a functionality doesn't cater to everyone. Just you.

Since this is C++, whatever it is you are trying to do can better be done in other ways:
default arguments, overloaded functions, heck, even the named argument idiom.

Duoas 1,025 Postaholic Featured Poster

That timer event will not work like you expect. The Int10 is not guaranteed to have any specific value. While it may appear to work sometimes (just as a fluke of how the stack works), it will suddenly break and work differently.

In either case, you should not enable the timer in a timer event. Only disable.

The way to do it is:

procedure Form1.sendNsecondsWorthOfBtoNotepad( n: integer );
  // Add this procedure to the private, protected, or public part of your form class.
  begin
  timer1.interval := 100;    // one keypress every 1/10th second
  timer1.tag      := n /10;  // number of timeout events to process
  timer1.enabled  := TRUE
  end;

procedure Form1.Timer1Timer( sender: tObject );
  // This is the timeout event
  begin
  // Send the keystroke
  keybd_event(Ord('B'), 0, 0, 0);

  // One tenth second has passed
  timer1.tag := timer1.tag -100;

  // If time is up, stop sending keystrokes
  if timer1.tag = 0 then timer1.enabled := FALSE
  end;

procedure Form1.Button1Click( sender: tObject );
  // This procedure starts the process
  var ms: integer;
  begin
  // Convert the user's input if possible. (If not, complain.)
  try ms := strToInt( edit1.text )
  except
    showMessage( 'You must specify the number of milliseconds to send keystrokes' );
    edit1.setFocus;
    exit
    end;
  sendNsecondsWorthOfBtoNotepad( ms )
  end;

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

I tested with TP4.

Just copy the code snippit I gave you to a text file (like "foo.pas") and compile it. (Don't change it in any way.)

Tell me what errors it gives you.

Duoas 1,025 Postaholic Featured Poster

If you google the fork() command you'll learn why.

t_pid pid;

pid = fork();

if (pid > 0) {
  printf( "I am the parent. My child's PID is %u\n", pid );
  }
else if (pid == 0) {
  puts( "I am the child." );
  }
else {
  puts( "I am the parent. I lost my fork." );
  }

Now you can look back and see what the difference is.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Ah, your talk of drop-down boxes and windows made me think you were using a GUI environment. The code I posted is for Delphi, which is Object Pascal.

In Turbo Pascal, start up the editor and press F1 twice. Then highlight the "Crt" item and press ENTER. All the stuff to play with colors is in there. You can specify a color directly with the TextAttr variable.


For constants, you'll have to use "typed constants", which are writable in TP4+.

const price: real = 12.99;
begin
  write( 'Price was: ', price:0:2, ', but now it is: ' );
  price := 5.99;
  writeln( price:0:2, '! What a deal!' )
end.

I hope this helps.


Oh yeah, before I forget. You can do windowing stuff if you get the Turbo Vision text GUI. I think you can google it. It gives you combo boxes and the like. For simple projects, though, it isn't worth the grief...


I don't know if you can close the window when you quit... I'll have to think about it a bit.

Duoas 1,025 Postaholic Featured Poster

Yes to all.

However:

  1. How do you mean? What colors and where?
  2. Again, how do you mean?
  3. Constants should be constant..., but a quirk of early Turbo Pascal dialects is retained as an option to make typed constants pretty much the same thing as initialized variables.
    You should, in new code, keep constants constant and use initialized variables for mutable things.
  4. Windows provides a control for that. In Delphi, just drop a tComboBox on the form.
  5. What exactly do you want to do to the keyboard?
  6. Write a OnKeyPress or OnKeyDown event handler method (use the first for normal keys, and the second for special keys like F1 and arrow keys):
    procedure Form1.OnKeyDown(
      sender:  tObject;
      var key: word;
      shift:   tShiftState
      );
      begin
      // Tell the form to close if F10 is pressed
      if (key = VK_F10) and (shift = []) then close
      end;

    For this to work make sure to use the Object Inspector to set the form's KeyPreview property to true.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Hmm, that's right. (Stupid grid controls are poorly designed... they give everyone and everything grief...)

You'll have to help it along. This is what I did. (I used a tStringGrid to test.)

Set DragMode to dmManual. (Sorry about that earlier.)
Set Options.goRangeSelect to FALSE.

procedure Form1.stringGrid1MouseMove(
  sender: tObject;
  shift:  tShiftState;
  x, y:   integer
  );
  begin
  // If we should be dragging, then start
  if ssLeft in shift then stringGrid1.beginDrag( TRUE )
  end;

I also used OnStartDrag to create a custom tDragObject (which you'll probably want to do also...). The source argument to OnDragOver and OnDragDrop is the object you create.

My custom object looked like this:

type
  TMyDragObject = class( TDragObject )
    // Tracks which cell we are dragging, so when we drop
    // it we can append its contents to the target cell's text.
  public
    sCol, sRow: integer;  // start col, row
    valid:      boolean;  // convenience
    constructor create( aCol, aRow: integer; aValid: boolean );
  end;

constructor TMyDragObject.create(
  aCol, aRow: integer;
  aValid:     boolean
  );
  begin
  inherited create;
  sCol  := aCol;
  sRow  := aRow;
  valid := aValid
  end;

And the way I used it:

procedure TForm1.StringGrid1DblClick( Sender: TObject );
  begin
  // Double-clicks just append an X to the cell's text.
  with stringgrid1 do
    cells[ col, row ] := cells[ col, row ] +'X';
  end;

procedure TForm1.StringGrid1DragDrop(
  Sender, Source: TObject;
  X,      Y:      Integer
  );
  var dCol, dRow: integer;
  begin
  // Drop the source object onto the cell under the mouse cursor.
  // Note that since I used 'OnDragOver' …
RoryGren commented: Very helpful! Thank you! +1
Duoas 1,025 Postaholic Featured Poster

Ah, ye olde rodent...

Remember, a (basic) mouse only does two things: move and click (single click, that is).

So, Windows and Delphi and whatever else have to make some basic assumptions about how the user will manipulate the mouse to distinguish things like drag and double-click from normal movement and single clicks.

Unfortunately, you have told Delphi to throw all that out the window and do it your way... (alas!)

To fix it, get rid of all special MouseDown and MouseUp event handler methods.

To handle a double click, provide an event method only for OnDblClick.

To handle dragging, you need to provide for at least the first of the following three:
OnDragDrop
OnStartDrag
OnDragOver
Leave the drag mode as automatic.

In the Object Inspector, switch to the events tab, (single) click on one of those events, and press F1 for more information.

You can also give the control a popup menu, which will be properly (and automatically, so you don't need to worry about it) handled when the user right-clicks with the mouse.

If you want to do anything unusual (like respond to single left-clicks with the Shift key held down, or handle middle-clicks, etc) you can do that too, just don't do anything on a normal left-click.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

You are clobbering a pointer or freeing memory too soon somewhere. Then, when the delete operator tries to free the memory, you crash.

Check that you aren't deleting something twice, or assigning a value to a pointer previously assigned a value with new.

If you can't find it, post your code and we'll take a look.

Duoas 1,025 Postaholic Featured Poster

Wow, I learned something.

I've always understood literals in scanf() to be read, matched, and discarded. Apparently that doesn't count for whitespace characters...

Duoas 1,025 Postaholic Featured Poster

Replace every occurrence of %*c with

\n
[inlinecode]
, and down at lines 39 and 41 change it to

[inlinecode]
scanf( "%lf\n", &cost );

and

scanf( "%lf\n", &price );/inlinecode]

Every time you ask the user for something you can expect him to press ENTER. You need to get rid of that enter key from the input each time you read something. That's what the "\n" does.

Hope this helps.

[EDIT] > Nonstandard!?!?!?

Yoinks! You're right! It is standard.

[EDIT #2] If you know this is the C++ forum, why are you posting C code here?[inlinecode]
scanf( "%lf\n", &price );/inlinecode]

Every time you ask the user for something you can expect him to press ENTER. You need to get rid of that enter key from the input each time you read something. That's what the "\n" does.

Hope this helps.

[EDIT]
> Nonstandard!?!?!?


Yoinks! You're right! It is standard.


[EDIT #2]
If you know this is the C++ forum, why are you posting C code here?

Duoas 1,025 Postaholic Featured Poster

That %*c is nonstandard. I suspect that you are trying to get rid of the newline.

Instead, get rid of the newline with: scanf( "%d\n", &my_int ); Hope this helps.


BTW, this is the C++ forum.

Duoas 1,025 Postaholic Featured Poster

If you haven't learned to use vectors yet, don't worry about it. (A vector is the STL class that implements a dynamic array.)

What is important is the algorithm suggested to answer your problem. I suggested that you simply read a line at a time. If the line is empty (because the user just pressed ENTER) then you are done getting elements. If the line is not empty, then convert it to an integer (or whatever you asked for) and add it to your array/linked list/whatever.

Duoas 1,025 Postaholic Featured Poster

If you are willing to play with the Windows Shell, you could probably get it to do what you want.

Something like this (starturl.vbs):

' Make sure that the URL to display is specified. Complain if not.
If WScript.Arguments.Count < 1 Then
  WScript.Echo "You must call the script with the name of the web page to display"
  WScript.Quit
End If

' Double quote the URL if it has spaces in it.
' (This is too stupid here to notice if the URL has double quotes in it already.)
url = WScript.Arguments.Item( 0 )
If InStr( url, " " ) Then
  url = """" & url & """"
End If

' Create the shell and start each browser to display the URL
Set Shell = CreateObject( "WScript.Shell" )
Shell.Run( """C:\Program Files\MultipleIEs\IE6\IEXPLORE.exe"" " & url, , False )
Shell.Run( """C:\Program Files\MultipleIEs\IE55\IEXPLORE.exe"" " & url, , False )
Shell.Run( """C:\Program Files\Mozilla Firefox\mozilla.exe"" " & url, , False )

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Hi angelie and welcome to the forums.

We won't give you code here, but we'll be glad to help you with your own code.

There are two things you need to think about for this assignment:

  1. How to convert an ASCII digit character to a number. '0' to 0, '1' to 1, etc, and back.
  2. What is the difference between 1 and 10 and 100. Google "radix" for more. In decimal, the radix is 10. In hexadecimal, the radix is 16, using the ASCII digits 0123456789ABCDEF.

No matter how you represent a number (decimal, hexadecimal, binary, etc.) it is still the same number and it is stored the same way in a machine word.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Alt-F4 is used by the system to terminate an application. Users expect this. (Don't do things that users don't expect.)

You might want to look at the OnClose and OnCanClose events if you just want to do cleanup before the application terminates or to prevent the application from terminating under some circumstances.

Be warned, though. Programs that can't be stopped make people very angry.

Good luck.

Duoas 1,025 Postaholic Featured Poster

As no one has responded yet...

Batch files wait for each command to finish before continuing on to the next.

I am, however, surprised that start "C:\Program Files\Mozilla Firefox\firefox.exe" w[I][/I]w[I][/I]w.google.c[I][/I]om will cause IE to start.

Duoas 1,025 Postaholic Featured Poster

Outside of a little Windows Shell scripting I know nothing about .NET. Sorry.

Duoas 1,025 Postaholic Featured Poster

The correct answer is that the question is absurd.

No programmer worth his salt would waste his company's time on some trivia like this. Yes, it is possible to do an overlapped transpose and paste without using extra memory, but there is no need. Can you really believe anyone to be using your spreadsheet on a system so limited in resources that it can't duplicate itself? Access itself wouldn't run.

Just allocate memory for the transposed array, transpose into it, copy it back in the new location (possibly overlapped), and free the memory. Anything more than that is not cost-effective, sure to be error prone (especially when other people start messing with it), and a maintenance nightmare. Keep code simple.

So, to reiterate, writing specialized cases is a waste of time (money) and resources (money) in development, production, and maintenance when there is no quantifiable gain in function, speed, use of target system resources, and/or etc.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

You used the wrong bb code. When inserting code in your post place
[code]
before it and
[/code]
after it. Then it will look pretty and preserve whitespace.

Your power program works perfectly for me.

For the other, you need a somewhat tricky loop. Here's a help:

for num_tries := 3 downto 1 do 
  begin
  write( 'Username: ' );
  readln( username );

  write( 'Password: ' );
  readln( password );

  if (username = 'admin') and (password = 'admin')
    then break
    else begin
         writeln( 'You have ', num_tries -1, ' tries left.' )
         end
  end;

if (username <> 'admin') or (password <> 'admin') then
  begin
  writeln( 'Access denied!' );
  exit
  end;

writeln( 'Access granted!' );
...

You don't have to limit the number of tries. You could just loop until the username and password match. However you need it.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

The windres program doesn't like pathnames with spaces in them.

It is also possible that the Dev IDE is not properly quoting pathnames with spaces in them... but even if it does the windres program is surprisingly broken on this point.

Sorry.

Duoas 1,025 Postaholic Featured Poster

If it isn't in your coursebook and wasn't mentioned by your professor, you probably are wasting time messing with it. Just stick to the assignment.

Duoas 1,025 Postaholic Featured Poster

You're kidding, right?

Go to Google, type "exe2com" and click "I'm Feeling Lucky".

Duoas 1,025 Postaholic Featured Poster

This isn't an IIRC, and no one here is going to respond very well to demands for help. You are very much closer. What you need to do now is two things.

Take a look at the available C++ operators and use the correct ones. (The GPA problem is fine, but the others need help.)
C++ Operators

The other thing you need to do is review some logic tables.
Logical Conjunction

OK, three. Fix that ll to use || like AD instructed you.

Do those things and you'll fix your problems easily.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

I said <stringstream> when I should have said <sstream> . If you had googled "stringstream" like I asked you to you would have found that to use a stringstream you need to include <sstream>.

This is standard C++ code. If your compiler can't handle it you need to upgrade to a better/newer version compiler.

Since this all seems to be going straight over your head, just use the ^Z method. You can check to see if the stream is closed using an if statement.

vector<int> ints;
int i;
while (cin) {  // while not at the end of the stream
  cin >> i;  // get an integer
  ints.push_back( i );  // add the integer to the "array" of integers
  }

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

It is the input.

This question has nothing to do with C++. It belongs in the Computer Science forum (which includes Theory of Computation).

You might want to read up on NP complexity at Wikipedia.

Duoas 1,025 Postaholic Featured Poster

It won't be an infinite loop if you break out at some point.

Google the rest of your questions. "string::empty()" and "stringstream" and "vector::push_back".

Sorry I forgot the headers. They are

#include <iostream>
#include <string>
#include <stringstream>
#include <vector>

Enjoy!

Duoas 1,025 Postaholic Featured Poster

Show us what you've tried to do and we'll help you fix it.

Duoas 1,025 Postaholic Featured Poster

What!!??

This thread is two years old.

Duoas 1,025 Postaholic Featured Poster

1. Get your own thread.

2. Post what you've done to try to do the HW assignment. Then we'll help.

Duoas 1,025 Postaholic Featured Poster

Whenever I want the user to enter an array of elements (and this is pretty common too) I always just ask for an extra ENTER at the end (a blank line).

So the program might run something like this:

Please enter the elements of the array.
Press ENTER after each element.
Press ENTER on a blank line to stop.
1
2
3
4

Thank you. The array you entered is: 1 2 3 4.

The way to code this is to use getline() to read each line entered by the user. If it is blank, then stop. If not, use a stringstream to convert the element to whatever you want it to be.

vector<int> ints;
string line;

cout << "Please ...";
while (true)
{
    getline( cin, line );
    if (line.empty()) break;

    stringstream ss( line );
    int value;
    ss >> value;

    ints.push_back( value );
}

cout << "Thank ...";
for (int i = 0; i < ints.size(); i++) cout << ints[ i ];
cout << endl;

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

zhelih
First off, don't just give people code. The whole point of homework is so that the student has to use his brain.

Second off, it doesn't work, because the user can't input the first three numbers properly and it doesn't calculate the average.

sfurlow2
Remember, the average is (sum of numbers entered) / (count of numbers entered).
In C and C++, remember that / is integer division on integers, and floating point division on floats. So int / int is an int. Whereas float / int is a float. You can fix it by casting:

int sum;
int count;
float average;
...
average = float( sum ) / count;

For handling the special cases, consider them separately:

one number entered
the average of one number is itself. (x / 1 = x)

two numbers entered
the average of two numbers is the sum over two. (x + y) / 2

three or more numbers entered
the average is the sum of all the numbers entered over the number of numbers entered:
(x + y + z) / 3
(w + x + y + z) / 4
(v + w + x + y + z) / 4
etc.

Looking at this, you'll recognize that "two numbers entered" is not a special case at all...

In fact, one number entered isn't either.

So you only really need three things:

Duoas 1,025 Postaholic Featured Poster

Alas, you've got a couple of serious errors...

1) Get a string syscall
When you use the systrap to get a string, the returned string has that NL character there at the end... So if I enter "1 2 3" the returned string is (in C parlance) 1 2 3\n . Your code checks for the string ending with zero (which is correct and which it does) and it checks for the space character, but it doesn't check for the newline character, which is then treated like an ascii digit (which it isn't) and converted to a value by subtracting '0' (48). Since NL is 10, 10-48 = -38, which gets added into your number.

So, you'll have to test for it.

beq	$t2,	$zero,	exit	# exit if p* is null char at end of string
	li	$t9,	'\n'		# or if p* is '\n' char at end of string
	beq	$t2,	$t9,	exit	#

As a side note, you should generally avoid using ASCII constants directly.
Use ' ' for space and '\n' for newline and '0' for the first digit character, etc.

2) Structure
This problem and the next are related, but you need to think about this above that. In other words, fixing the next problem depends on how you fix this problem.

I would have written the algorithm using two loops (one for the line of numbers, and one for each individual number). You have combined them into …

Duoas 1,025 Postaholic Featured Poster

Ah. It works because it is standard Pascal... :)

Duoas 1,025 Postaholic Featured Poster

Yes. For some oddball reason it isn't in any of the Delphi docs that I've ever seen, but you can specify width and precision for floating point variables:

var foo: real = 41.99;
begin
  writeln( 'The answer is ', foo:0:1 )
end.

Notice how it will automatically round for you. The second number is the precision field, which specifies the number of digits to have after the decimal point. The first number is the width field. You should generally leave it as zero.

Hope this helps.

[EDIT] Oh yeah, you can use variables for the width and precision fields too...

Duoas 1,025 Postaholic Featured Poster

Yes. The GCC is a wonderfully well-ported compiler system. (One of the reasons I like it so much.)

You can also get IDEs that use the GCC as the backend compiler.

Duoas 1,025 Postaholic Featured Poster

You need a loop. Like repeat..until or while..do.

You can also check your answers using a case statement.

Duoas 1,025 Postaholic Featured Poster

Read the manual.

You don't usually have to care where your compiler keeps lib files. If you link with the -l switch it will find it. -lm math library -lcurses terminal library -lglut -lglut32 -lglaux -lopengl32 various OpenGL libraries -lwinmm Windows multimedia library

etc.

Duoas 1,025 Postaholic Featured Poster

Yes, but on Win32 systems you can just rename any executable file to .COM and it will run properly...

Duoas 1,025 Postaholic Featured Poster

Forget Java. If you can do it in C you can do it in MIPS.

Remember, a power of two is a number that has only one bit set (all the rest are zeroes), and that bit cannot be bit 0 (the least-significant bit).

Your C solution looks fine. In MIPS, you can use the sll instruction so shift left.

I like the Wikipeda: MIPS Assembly Language reference. There are good links at the bottom for learning more.

A simple MIPS program looks like:

.data
hello: .asciiz "Hello world!"

.text
main:
	# print "Hello world!"
	la	$a0,	hello
	li	$2,	4
	syscall

	# terminate
	li	$2,	10
	syscall

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

Oh yeah, almost forgot. He's mixing SAL and MAL. You can mention that, but there is no need to "fix" it.

Your professor should have given you three sheets, listing SAL, MAL, and TAL instructions, and/or you should have them listed in your textbook. Instructions like move are SAL. Instructions like addi are TAL.

Duoas 1,025 Postaholic Featured Poster

The first problem this person had is that he did not comment his code very well. The second problem is that his comments don't match his code. The third (and most important) problem is that he did not write down what he was trying to do before doing anything.

For example, on lines 16..18 his comments say, basically, "get integer into $s0". However, what he does is stick the integer in $a0. The very next thing he does is clobber $a0 (and $v0) in order to print promptY, so the integer that the user entered is lost forever.

The commentary might better run like this:

.text

# variables
#  $s0 = X
#  $s1 = Y

main:
	# Ask user to "Enter a number for X: "
	li	$v0,	4
	la	$a0,	promptX
	syscall

	# Get X --> $s0
	li	$v0,	5
	syscall
	move	$s0,	$v0

	...

	# $v0 = exponential( $s0, $s1 )
	move	$a0,	$s0	# see note [1]
	move	$a1,	$s1
	jal	exponential

	# print the result
	move	$a0,	$v0
	li	$v0,	1
	syscall

	# terminate the program
	li	$v0,	10
	syscall

[1] Argument passing conventions
The registers $a0..$a3 are typically used as arguments to functions. The exponential() function takes two arguments, so the first argument is $a0 and the second argument is $a1.

We could design the function to take $s0 and $s1 as arguments, then we wouldn't have to move anything around before jal -ing to the function. However, I chose …

Duoas 1,025 Postaholic Featured Poster

Shift "forgets" the bits shifted out.
Roll takes the bit shifted out and sticks it back in on the other end.

Examples:

01101010 start (one byte)
11010100 shifted left by one
10101000 shifted left by one
01010000 shifted left by one
etc.

01101010 start (one byte)
[B]1[/B]1010100 rolled left by one (red bit goes out left and back in right side)
[B]1[/B]010100[B]1[/B] rolled left by one (green bit ...)
0101001[B]1[/B] rolled left by one (black bit ...)
10100110 rolled left by one (etc.)
etc.

Hope this helps.

Duoas 1,025 Postaholic Featured Poster

I've been looking around. Your best bet is to start VC++ and start a 16-bit project. Make sure to compile with a "small" memory model. Once you have your EXE, google for programs like "exe2com" or "bin2obj", which will help you. It is been a very long time since I've made COM programs, so I don't remember all the details of how to do it.

Good luck.

Duoas 1,025 Postaholic Featured Poster

Do you need the output to be an old COM file or can you live with a 16-bit EXE?

(COM is really ancient. You'd need some old tools to create such a file.)