Issue with as86/ld86 and ORG

Programming, for all ages and all languages.
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Re: Issue with as86/ld86 and ORG

Post by myk »

Jeesh, I've been fighting Qt for like 2 hours now but I FINALLY got x86Lib linking into my project...

It looks like my problem with DumpState went away after downloading your latest changes, not sure if it was just some bad obj file I had or if you changed something...

Ok.. so I'm going to try to get my currently hardly existing LCD code to display into a Text Box in Qt. If I can get that going, I'll do the LEDs and Keypad.
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Re: Issue with as86/ld86 and ORG

Post by myk »

I've been trying to get something going here but I'm just fighting against the code I feel lol. I see you have a MemoryDevices now, anyway of using that?

Is there going to be a way of inheriting from MemoryDevices so that a class outside of x86Lib can act as a memory device? If so that would be amazing. I've been trying to get some Qt working but it's not having it. That, and my knowledge of the inner workings of C++ is not very good.
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Re: Issue with as86/ld86 and ORG

Post by myk »

Ok, the LCD Driver code is working well! I've got a lot of the commands handled, everytime there is a write it pushes everything to the command line, which is a bit crazy (I might try looking into using ncurses, however xcode's debugging console chokes on it). Either way, here's what it looks like!

I've got to say, this is absolutely amazing that a program I wrote 3 years ago is running with your software! This is freakin awesome!

Here's the Menu Loading char by char.

Code: Select all

functionSet
functionSet
functionSet
functionSet
|--------------------|
|                    |
|                    |
|                    |
|                    |
|--------------------|

clearDisplay
entryModeSet
displayOnOffCtrl
returnHome
|--------------------|
|                    |
|                    |
|                    |
|                    |
|--------------------|

clearDisplay
returnHome
setDDRAMAddress = 0(0, 0)
|--------------------|
|+                   |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+-                  |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+--                 |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+---                |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+----               |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+-----              |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+------             |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+-------            |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+--------           |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+---------          |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+----------         |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+-----------        |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------       |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+-------------      |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+--------------     |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+---------------    |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+----------------   |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+-----------------  |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------ |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||                   |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||                   |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||                   |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||                   |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   M               |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mi              |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mik             |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mika            |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikae           |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael          |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael          |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael N        |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Ne       |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nel      |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nels     |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelso    |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson   |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson   |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson   |
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
|                    |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||                   |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||                   |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||                   |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||                   |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||                   |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||                   |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     C             |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CE            |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEE           |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN          |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN          |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4        |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 43       |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 433      |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330     |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330     |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330     |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330     |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330     |
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|                    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+                   |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+-                  |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+--                 |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+---                |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+----               |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+-----              |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+------             |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+-------            |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+--------           |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+---------          |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+----------         |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+-----------        |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+------------       |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+-------------      |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+--------------     |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+---------------    |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+----------------   |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+-----------------  |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+------------------ |
|--------------------|

|--------------------|
|+------------------+|
||   Mikael Nelson  ||
||     CEEN 4330    ||
|+------------------+|
|--------------------|

|--------------------|
|                    |
|                    |
|                    |
|                    |
|--------------------|

clearDisplay
returnHome
|--------------------|
|                    |
|                    |
|                    |
|                    |
|--------------------|

clearDisplay
setDDRAMAddress = 2(2, 0)
setDDRAMAddress = 2(2, 0)
|--------------------|
|  0                 |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|  0.                |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|  0.                |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. R              |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Ru             |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run            |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run            |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run L          |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LE         |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LED        |
|                    |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|                    |
|                    |
|                    |
|--------------------|

setDDRAMAddress = 66(6, 3)
|--------------------|
|  0. Run LEDs       |
|  1                 |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1.                |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1.                |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. M              |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Mo             |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Mov            |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move           |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move           |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move M         |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Me        |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Mem       |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memo      |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memor     |
|                    |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|                    |
|                    |
|--------------------|

setDDRAMAddress = 22(2, 1)
|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2                 |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2.                |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2.                |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. D              |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Du             |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dum            |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump           |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump           |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump M         |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Me        |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Mem       |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memo      |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memor     |
|                    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|                    |
|--------------------|

setDDRAMAddress = 86(6, 4)
|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3                 |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3.                |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3.                |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. S              |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Se             |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Sea            |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Sear           |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Searc          |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Search         |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Search         |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Search M       |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Search Me      |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Search Mem     |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Search Memo    |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Search Memor   |
|--------------------|

|--------------------|
|  0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Search Memory  |
|--------------------|

setDDRAMAddress = 0(0, 0)
|--------------------|
|~ 0. Run LEDs       |
|  1. Move Memory    |
|  2. Dump Memory    |
|  3. Search Memory  |
|--------------------|

earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: Issue with as86/ld86 and ORG

Post by earlz »

Wow... thats freaking awesome.

As for MemoryDevices. Sadly, no you can not use it(yet) as I just added those classes in as templates in 71(there is no real code behind them). I don't think those will work though for how I want it managed..

But I'll get a much better system rolling soon now that I'm working on this again lol.

I think I'll have to get over my fear of virtual functions though even if they are slow and have overhead.. cause there doesn't seem a better way than inheritance+virtual functions..
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Re: Issue with as86/ld86 and ORG

Post by myk »

I just updated the code to use ncurses and it's even better now. Everything overwrites on the same 4x20 area so it acts like the actual LCD now. I'm going to have to do some conditional compiles so debugging prints to stdout and ignores ncurses and so release code uses ncurses since xcode doesn't work with it.

I guess one thing to remember is, you're simulating an 8086 that probably runs at 5MHz (my homebuilt board runs at that) on a 2.0+ GHz PC :) I think optimizing for speed isn't a huge issue, making a simple programming interface is more important.
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Re: Issue with as86/ld86 and ORG

Post by myk »

Ok, now have an LEDDisplay class as well, that was waaaay too simple to make :)

Not sure how to handle input... Is there a way of monitoring for keyboard presses without having to use a getchar type method that blocks until there is input?

I need to be able to get arrow keys, hex digits, and the character q to completely emulate my keypad
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: Issue with as86/ld86 and ORG

Post by earlz »

myk wrote:Ok, now have an LEDDisplay class as well, that was waaaay too simple to make :)

Not sure how to handle input... Is there a way of monitoring for keyboard presses without having to use a getchar type method that blocks until there is input?

I need to be able to get arrow keys, hex digits, and the character q to completely emulate my keypad
yea, look in ncurses. there is something about STDIN line endings. If you turn that off then when you do getchar() it will return 0 if there is no key in the buffer. else it will return the character... [edit] Also, there is something about special keystrokes in ncurses so you can catch keys like ctrl-c and such. ncurses has about everything you can imagine lol

and yea. I'm thinking the same thing. At the time I wrote it I intended for it to be suitable to put in an actual emulator(like a PC emulator). So I was focusing in on speed.. If I intend this to not go further than the 8086(well.. still can shoot for like 286 or something) than this speed bit is not nearly as important. Though you are write. A simple interface is :)

So I'm going to implement a new interface for that(which should be trivial) including an abstract class or two for devices to inherit from.
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Re: Issue with as86/ld86 and ORG

Post by myk »

Awesome! I'm currently looking at the input code with ncurses, I think that should work pretty well. Tomorrow I'd like to get the "Menu" system of my old code going so I can use the arrow keys to navigate. I suppose I'll have to write up a keyboard controller class then.

Btw, is there a way to introduce an external interrupt? The way my code works is it uses an external interrupt for key input. I'd like to be able to trigger that interrupt and then have the ISR read the keypad controller data.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: Issue with as86/ld86 and ORG

Post by earlz »

myk wrote:Awesome! I'm currently looking at the input code with ncurses, I think that should work pretty well. Tomorrow I'd like to get the "Menu" system of my old code going so I can use the arrow keys to navigate. I suppose I'll have to write up a keyboard controller class then.

Btw, is there a way to introduce an external interrupt? The way my code works is it uses an external interrupt for key input. I'd like to be able to trigger that interrupt and then have the ISR read the keypad controller data.

Code: Select all

	//! Cause a CPU interrupt
	/*! This will cause a CPU interrupt(unless interrupt flag is cleared)
		Note! This does not resolve IRQs! This takes normal interrupt numbers(0-255)
	\param num Interrupt number
	*/
	void Int(uint8_t num);
that is in x86CPU.

So just do like

Code: Select all

x86CPU cpu;
.....
cpu.Int(KEYBOARD_INT);
cpu.Cycle();
....
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Re: Issue with as86/ld86 and ORG

Post by myk »

Thanks!

I'm going to try coding up a very simple keyboard controller and then go have a nice relaxing (and apparently a very foggy here in Kansas City) labor day!
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: Issue with as86/ld86 and ORG

Post by earlz »

myk wrote:Thanks!

I'm going to try coding up a very simple keyboard controller and then go have a nice relaxing (and apparently a very foggy here in Kansas City) labor day!
rofl. Real programmers slave through holidays lol jk. I had my labor day yesterday so maybe I'll implement some of the new device system today..
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Re: Issue with as86/ld86 and ORG

Post by myk »

Ok, I think the keyboard controller is implemented enough to work. I did notice an issue with the Interrupt Handling. The IVT is Offset first then Segment, and x86Lib goes Segment first then Offset.
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Re: Issue with as86/ld86 and ORG

Post by earlz »

myk wrote:Ok, I think the keyboard controller is implemented enough to work. I did notice an issue with the Interrupt Handling. The IVT is Offset first then Segment, and x86Lib goes Segment first then Offset.
Ok, I'll fix that.. I couldn't remember when I was writing it and my docs didn't quite make sense at that part..

[edit]

Hey, do you think if I made such a library(recycling this new device system I make) for say Z80 and ARM and such embeddable processors, that it would be used? Really, I wanted have such a library for ARM when I started this project, but I x86 was(and still basically is) the only CPU arch. that I know well enough to create an emulator.
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Re: Issue with as86/ld86 and ORG

Post by myk »

Hmm, honestly I'm not sure. If you were to do one, I would say do ARM. The people who will probably be using your code are going to be hobbyists and I have a feeling we will see the ARM platform emerge as the new platform for hobbyists in the next year or two. Currently it seems like the AVRs are top dog, but they just don't seem to have enough power for some big projects that people are starting to do, I think ARM will take over at that level.
myk
Member
Member
Posts: 49
Joined: Tue Jun 27, 2006 10:20 am

Re: Issue with as86/ld86 and ORG

Post by myk »

I also think I'm seeing an issue with eIP getting off by one after an IRET. I need to look into it more, but it seems like after I handle an interrupt I get a bunch of garbage instructions until the CPU crashes.

Edit: I take that back, it seems to be fine after IRET, somewhere the IP is getting off though...

Edit2: I think I found whats happening.

In the ASM I have a JMP to address 0x0BDC

After executing the instruction, eIP is 0xBDB so I guess we're subtracting when we shouldnt?


Ok, here's the instruction that it's having issues with

Opcode: E97500

According to microsoft's debug this is a JMP 0BDC
current eIP is 0x0B64

So, 0x75 is our offset to the next instruction, 0x0B64 + 0x75 gives us 0xBD9

In jmp16_near16 we do the add, then ++ eip, so now we're at 0xBDA. Next cycle goes around, add 1, we have 0xBDB, we need +1 to get to the right instruction at 0xBDC

Now I know that Jmp16_near16 happens all the time so why is it this one time it's messing up? The actual assembly is just a Jump to a label so it shouldn't be that big of a deal...
Post Reply