Having some trouble with my multitasking system
I would suggest writing the code in assembly. Theres still a lot you are missing. Re-read the links. Just use some assembly (not inline, as gcc chooses which registers to use).
Also, I know the string declaration is legal and not related to the problem, but it's always better to use a safe method anyways. (better safe than sorry)
Also, I know the string declaration is legal and not related to the problem, but it's always better to use a safe method anyways. (better safe than sorry)
I think i have the problem nailed. The iret skips over the code that acknowledges the interrupt which explains why it freezes.
Now i've added this code
But GAS chokes on it with Error: suffix or operands invalid for `out'
And unless i'm mistaken that is proper syntax.
Now i've added this code
Code: Select all
out $0x20, $0x20
And unless i'm mistaken that is proper syntax.
this doesn't work either
Code: Select all
mov $0x20, %dx
out $0x20, %dx
The out instruction may not use proper AT&T syntax.
Try ALL of the following:
Oh, and don't you have to put out.b in stupid AT&T syntax? Does it default to byte size?
And then write a nasty email to the gcc people, and tell them to drop the stupid AT&T syntax, and switch to nice intel syntax. Or turn on the intel syntax asm flag in gcc.
Try ALL of the following:
Code: Select all
mov $0x20, %al
out $0x20, %al
mov $0x20, %dx
out %dx, $0x20
mov $0x20, %al
out %al, $0x20
And then write a nasty email to the gcc people, and tell them to drop the stupid AT&T syntax, and switch to nice intel syntax. Or turn on the intel syntax asm flag in gcc.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Simple:
It's logical, mov "source" to "destination" - unlike the unappealing look of mov "dst" to "src".
bewing, stop attacking the syntax... it's pretty.
If you use an immediate operand for the IO address, you'll have valid range of 0 to 0xff, otherwise, use the dx register.
Code: Select all
movb <data>, %al
outb %al, $0x20
bewing, stop attacking the syntax... it's pretty.
The out instruction doesn't support 2 immediate operands, regardless of the syntax.Pyrofan1 wrote:But GAS chokes on it with Error: suffix or operands invalid for `out'Code: Select all
out $0x20, $0x20
And unless i'm mistaken that is proper syntax.
If you use an immediate operand for the IO address, you'll have valid range of 0 to 0xff, otherwise, use the dx register.
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
The key thing is that you need to suffix b/w/l on the out to make it work.
i.e. use outb, outw or outl (as Brynet-Inc did)
i.e. use outb, outw or outl (as Brynet-Inc did)
You're starting a holy war here. Many people are more comfortable with dst = src over src = dst notation.It's logical, mov "source" to "destination" - unlike the unappealing look of mov "dst" to "src".
bewing, stop attacking the syntax... it's pretty.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Heh. I was just kidding.
And intel syntax is not dest = src, is is "register/address being modified, data". It is a small philosophical difference, that leads to a different paradigm. I just think that extraneous punctuation is the farthest thing from "pretty". And in this particular case (assuming -- as is reasonable -- that Combuster is right), it is precisely that extraneneous punctuation that caused Pyrofan1's code to fail. This is Not a Good Thing.
And intel syntax is not dest = src, is is "register/address being modified, data". It is a small philosophical difference, that leads to a different paradigm. I just think that extraneous punctuation is the farthest thing from "pretty". And in this particular case (assuming -- as is reasonable -- that Combuster is right), it is precisely that extraneneous punctuation that caused Pyrofan1's code to fail. This is Not a Good Thing.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
I meant from a visual perspective.bewing wrote:Heh. I was just kidding.
And intel syntax is not dest = src, is is "register/address being modified, data". It is a small philosophical difference, that leads to a different paradigm. I just think that extraneous punctuation is the farthest thing from "pretty". And in this particular case (assuming -- as is reasonable -- that Combuster is right), it is precisely that extraneneous punctuation that caused Pyrofan1's code to fail. This is Not a Good Thing.
mov eax, 5 for example, could look very confusing to a beginner...
I guess now that I think about it more.. from the eyes of someone deeply intimate with the "mv" command, it's scary, but from a C programmer it's simply "var = 5".
I'll just shut up now... resist the urge to purge
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Whoops, I missed this portion of your reply..bewing wrote:.And in this particular case (assuming -- as is reasonable -- that Combuster is right), it is precisely that extraneneous punctuation that caused Pyrofan1's code to fail. This is Not a Good Thing.
That's incorrect, I only included the suffixes for added clarity... habit.
Code: Select all
movb $0x20, %al
outb %al, $0x20
Code: Select all
mov $0x20, %al
out %al, $0x20