Drawing a rectangle

Jun 18, 2012 at 12:43 AM

I just added the following code to my operating system to draw a rectangle, and I got an error.  It was just working before.  Is there anything wrong with it?

            Dim rectx As Integer = 0
            Dim recty As Integer = 0
            Do Until rectx = 50
                Do Until recty = 50
                    vga.SetPixel(rectx, recty, 1)
                    recty = recty + 1
                Loop
                rectx = rectx + 1
                recty = 0
            Loop

Coordinator
Jun 18, 2012 at 12:45 AM
On 6/17/2012 8:43 PM, qwertyuiop5 wrote:
> I just added the following code to my operating system to draw a
> rectangle, and I got an error. It was just working before. Is there
> anything wrong with it?

Its usually useful you mention what the error is.
Jun 18, 2012 at 12:45 AM

Did u initialize the vga screen? What's the error?

On Jun 17, 2012 8:44 PM, "qwertyuiop5" <notifications@codeplex.com> wrote:

From: qwertyuiop5

I just added the following code to my operating system to draw a rectangle, and I got an error. It was just working before. Is there anything wrong with it?

            Dim rectx As Integer = 0
            Dim recty As Integer = 0
            Do Until rectx = 50
                Do Until recty = 50
                    vga.SetPixel(rectx, recty, 1)
                    recty = recty + 1
                Loop
                rectx = rectx + 1
                recty = 0
            Loop

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jun 18, 2012 at 12:47 AM

Yes, I have this before it.

            Dim vga As New VGAScreen
            vga.SetMode320x200x8()
            vga.SetPaletteEntry(0, 0, 0, 50)
            vga.SetPaletteEntry(1, 0, 50, 0)
            vga.Clear(0)

The error is:

Error    3    The method or operation is not implemented.
   at Cosmos.IL2CPU.X86.IL.Conv_Ovf_U4.Execute(MethodInfo aMethod, ILOpCode aOpCode) in d:\source\Cosmos\source2\IL2CPU\Cosmos.IL2CPU.X86\IL\Conv_Ovf_U4.cs:line 13
   at Cosmos.IL2CPU.AppAssembler.ProcessMethod(MethodInfo aMethod, List`1 aOpCodes) in D:\source\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\AppAssembler.cs:line 155
   at Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) in D:\source\Cosmos\source2\IL2CPU\Cosmos.IL2CPU\ILScanner.cs:line 433
   at Cosmos.Build.MSBuild.IL2CPUTask.Execute() in d:\source\Cosmos\source2\Build\Cosmos.Build.MSBuild\IL2CPUTask.cs:line 231    C:\Program Files (x86)\MSBuild\Cosmos\Cosmos.targets    32    10    Cosmos126

Jun 18, 2012 at 12:50 AM

Try SetPixel320x200x8

On Jun 17, 2012 8:45 PM, "kudzu" <notifications@codeplex.com> wrote:

From: kudzu

On 6/17/2012 8:43 PM, qwertyuiop5 wrote:
> I just added the following code to my operating system to draw a
> rectangle, and I got an error. It was just working before. Is there
> anything wrong with it?

Its usually useful you mention what the error is.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Coordinator
Jun 18, 2012 at 12:50 AM
On 6/17/2012 8:47 PM, qwertyuiop5 wrote:
> Yes, I have this before it.
>
> Dim vgaAs New VGAScreen
> vga.SetMode320x200x8()
> vga.SetPaletteEntry(0, 0, 0, 50)
> vga.SetPaletteEntry(1, 0, 50, 0)
> vga.Clear(0)
>
> The error is:
>
> Error 3 The method or operation is not implemented.
> at Cosmos.IL2CPU.X86.IL.Conv_Ovf_U4.Execute(MethodInfo aMethod, ILOpCode

Thats overflow. VB sometimes compiles code differently than C#. Maybe
someone can test this in C# and see if it works or not.
Jun 18, 2012 at 12:53 AM

I'm used to C# and this would work..

On Jun 17, 2012 8:51 PM, "kudzu" <notifications@codeplex.com> wrote:

From: kudzu

On 6/17/2012 8:47 PM, qwertyuiop5 wrote:
> Yes, I have this before it.
>
> Dim vgaAs New VGAScreen
> vga.SetMode320x200x8()
> vga.SetPaletteEntry(0, 0, 0, 50)
> vga.SetPaletteEntry(1, 0, 50, 0)
> vga.Clear(0)
>
> The error is:
>
> Error 3 The method or operation is not implemented.
> at Cosmos.IL2CPU.X86.IL.Conv_Ovf_U4.Execute(MethodInfo aMethod, ILOpCode

Thats overflow. VB sometimes compiles code differently than C#. Maybe
someone can test this in C# and see if it works or not.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jun 18, 2012 at 12:59 AM
Edited Jun 18, 2012 at 12:59 AM

How would I code this in c#?

The code is:

            Dim vga As New VGAScreen
            vga.SetMode320x200x8()
            vga.SetPaletteEntry(0, 0, 0, 50)
            vga.SetPaletteEntry(1, 0, 50, 0)
            vga.Clear(0)
            Dim rectx As Integer = 0
            Dim recty As Integer = 0
            Do Until rectx = 50
                Do Until recty = 50
                    vga.SetPixel(rectx, recty, 1)
                    recty = recty + 1
                Loop
                rectx = rectx + 1
                recty = 0
            Loop

Jun 18, 2012 at 1:01 AM

There's a couple tutorials if your interested. Still try SetPixel320x200x8 in VB

On Jun 17, 2012 8:59 PM, "qwertyuiop5" <notifications@codeplex.com> wrote:

From: qwertyuiop5

How would I code this in c#?

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jun 18, 2012 at 1:04 AM

I still get the same error with SetPixel320x200x8.

Jun 18, 2012 at 1:06 AM

I definately recommend c# then

On Jun 17, 2012 9:04 PM, "qwertyuiop5" <notifications@codeplex.com> wrote:

From: qwertyuiop5

I still get the same error with SetPixel320x200x8.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jun 18, 2012 at 1:18 AM

I converted the code into c#, but I only get a blue screen.

            var vga = new VGAScreen();
            vga.SetPaletteEntry(0, 0, 0, 50);
            vga.SetPaletteEntry(1, 0, 50, 0);
            vga.Clear(0);
            uint rectx = 0;
            uint recty = 0;
            while (rectx != 50);
            {
                while (recty != 50);
                {
                    vga.SetPixel(rectx, recty, 1);
                    recty = recty + 1;
                }
                rectx = rectx + 1;
            }

Jun 18, 2012 at 1:26 AM

Use SetPixel320x200x8

On Jun 17, 2012 9:18 PM, "qwertyuiop5" <notifications@codeplex.com> wrote:

From: qwertyuiop5

I converted the code into c#, but I only get a blue screen.

            var vga = new VGAScreen();
            vga.SetPaletteEntry(0, 0, 0, 50);
            vga.SetPaletteEntry(1, 0, 50, 0);
            vga.Clear(0);
            uint rectx = 0;
            uint recty = 0;
            while (rectx != 50);
            {
                while (recty != 50);
                {
                    vga.SetPixel(rectx, recty, 1);
                    recty = recty + 1;
                }
                rectx = rectx + 1;
            }

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jun 18, 2012 at 1:27 AM

And don't forget to do SetMode320x200x8

On Jun 17, 2012 9:18 PM, "qwertyuiop5" <notifications@codeplex.com> wrote:

From: qwertyuiop5

I converted the code into c#, but I only get a blue screen.

            var vga = new VGAScreen();
            vga.SetPaletteEntry(0, 0, 0, 50);
            vga.SetPaletteEntry(1, 0, 50, 0);
            vga.Clear(0);
            uint rectx = 0;
            uint recty = 0;
            while (rectx != 50);
            {
                while (recty != 50);
                {
                    vga.SetPixel(rectx, recty, 1);
                    recty = recty + 1;
                }
                rectx = rectx + 1;
            }

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jun 18, 2012 at 1:33 AM

Even after adding SetMode320x200x8, it is still a blue screen.

Jun 18, 2012 at 1:42 AM

Did u use SetPixel320x200x8?
Also check and see if u can set a pixel.

On Jun 17, 2012 9:33 PM, "qwertyuiop5" <notifications@codeplex.com> wrote:

From: qwertyuiop5

Even after adding SetMode320x200x8, it is still a blue screen.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Developer
Jun 18, 2012 at 1:45 AM

Use a for loop instead of a while loop.

Jun 18, 2012 at 1:47 AM

Setting a pixel does work.  Would the problem have to do with the loop?

Jun 18, 2012 at 1:49 AM

+1 josh

On Jun 17, 2012 9:45 PM, "joshbeitler" <notifications@codeplex.com> wrote:

From: joshbeitler

Use a for loop instead of a while loop.

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jun 18, 2012 at 1:50 AM

Yes. If you want I can give you a method for drawing a rectangle.

On Jun 17, 2012 9:47 PM, "qwertyuiop5" <notifications@codeplex.com> wrote:

From: qwertyuiop5

Setting a pixel does work. Would the problem have to do with the loop?

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Jun 18, 2012 at 1:50 AM

How do you use a for loop?

Jun 18, 2012 at 2:10 AM
Edited Jun 18, 2012 at 2:11 AM

How would you draw a rectangle?

Jun 18, 2012 at 5:29 AM
qwertyuiop5 wrote:

How would you draw a rectangle?

Look at PearOs under Core > Libraries > Graphics > RectangleF and Rectangle. Hope it helps - Matt

Jun 18, 2012 at 1:17 PM

Problem solved.  I used a for loop in visual basic.

            For x As UInteger = 0 To 50
                For y As UInteger = 0 To 50
                    vga.SetPixel(x, y, 1)
                Next
            Next

Jun 18, 2012 at 1:20 PM

Congrats. Ill remember this if I use VB and Cosmos together

On Jun 18, 2012 9:17 AM, "qwertyuiop5" <notifications@codeplex.com> wrote:

From: qwertyuiop5

Problem solved. I used a for loop in visual basic.

            For x As UInteger = 0 To 50
                For y As UInteger = 0 To 50
                    vga.SetPixel(x, y, 1)
                Next
            Next

Read the full discussion online.

To add a post to this discussion, reply to this email (Cosmos@discussions.codeplex.com)

To start a new discussion for this project, email Cosmos@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com