Strange letter displays before string [ACTUALLY SOLVED]
Re: Strange letter displays before string (Closed, fixed)
If you think you have fixed the bug, try doing a WriteChar() to position 0, 0.
Re: Strange letter displays before string (Closed, fixed)
Woooorks. I already said i changed the math for it to become correct.iansjack wrote:If you think you have fixed the bug, try doing a WriteChar() to position 0, 0.
Code used:
Code: Select all
terminal_clrscr();
terminal_writestring("[", WHITE, BLACK, 0, 0);
terminal_writestring("Dixium OS", WHITE, LIGHT_BLUE, 1, 0);
terminal_writestring("]", WHITE, BLACK, 10, 0);
terminal_writestring(" Write string succesful.", WHITE, BLACK, 11, 0);
-
- Member
- Posts: 5587
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Strange letter displays before string (Closed, fixed)
Did you read iansjack's post? He said writechar(), not writestring().
Re: Strange letter displays before string (Closed, fixed)
Oh, okay, i'll try that.Octocontrabass wrote:Did you read iansjack's post? He said writechar(), not writestring().
EDIT: It doesn't work.
Re: Strange letter displays before string (Closed, fixed)
DixiumOS wrote:That isn't a bugOctocontrabass wrote:This bug.
Read through it again, or check the values with a debugger to see the value that you're actually passinig to terminal_writechar.DixiumOS wrote:EDIT: It doesn't work.
Anyway, didn't we go through all of this already in your old project?
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum
Compiler Development Forum
Re: Strange letter displays before string (Closed, fixed)
" 10007d: 66 89 94 1b fe 7f 0b mov %dx,0xb7ffe(%ebx,%ebx,1)"zenzizenzicube wrote:DixiumOS wrote:That isn't a bugOctocontrabass wrote:This bug.Read through it again, or check the values with a debugger to see the value that you're actually passinig to terminal_writechar.DixiumOS wrote:EDIT: It doesn't work.
Anyway, didn't we go through all of this already in your old project?
The hell are you doing with 0xB7FFE, GCC?
B8000 - 1 does not equal B7FFE.
Let's see if this changes if i change B8000 to B8001.
Nahh...
EDIT: Finally got it working. Ya' little..
Code: Select all
void terminal_writechar(unsigned char c, unsigned char fc, unsigned char bc, int x, int y)
{
if (x == 80) {
x = 0;
y++;
}
if (x == 0) {
x++;
}
uint16_t attribute = (bc << 4) | (fc & 0x0F);
volatile uint16_t * loc;
loc = (volatile uint16_t *)0xB8000 + (y * 80 + x - 1);
*loc = c | (attribute << 8);
}
Oh, wait, now terminal_writestring doesn't work.
EDIT: It does, just that i tried writing to line 25. It's 24, not 25.
Last edited by DixiumOS on Wed Jan 11, 2017 4:28 am, edited 2 times in total.
Re: Strange letter displays before string (Closed, fixed)
Pointer math. If the type you're using for the pointer is short*, "-1" means it subtracts sizeof(short) from the pointer value (and likewise with any other pointer - for t*, -1 subtracts sizeof(t)).DixiumOS wrote: The hell are you doing with 0xB7FFE, GCC?
B8000 - 1 does not equal B7FFE.
-
- Member
- Posts: 5587
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Strange letter displays before string (Closed, fixed)
No, you just added more bugs.DixiumOS wrote:EDIT: Finally got it working. Ya' little..
Use terminal_writechar() to put a character at 0,0 and at 1,1. They won't show up at the correct locations.
Re: Strange letter displays before string (Closed, fixed)
1,1 displays in 0,1, but 0,0 does display in 0,0. I just...Octocontrabass wrote:No, you just added more bugs.DixiumOS wrote:EDIT: Finally got it working. Ya' little..
Use terminal_writechar() to put a character at 0,0 and at 1,1. They won't show up at the correct locations.
Format is x,y by the way.
EDIT: Just add a x++ and everything will be fine
Code used:
Code: Select all
terminal_clrscr();
terminal_writechar_freestanding('a', WHITE, BLUE, 0, 0);
terminal_writechar_freestanding('b', BLUE, WHITE, 1, 1);
terminal_writestring_freestanding("I like potato!", BLUE, WHITE, 12, 12);
EDIT: After doing some testing, it seems the tty.c forgot something that incremented the value yet again by one. Now i need to remove 2 for it to work.
Re: Strange letter displays before string (Closed, fixed)
DixiumOS wrote:EDIT: After doing some testing, it seems the tty.c forgot something that incremented the value yet again by one. Now i need to remove 2 for it to work.
Code: Select all
for (size_t i = 0; i < len; i++) {
x++;
terminal_writechar(data[i], fc, bc, x, y);
}
com.sun.java.swing.plaf.nimbus.InternalFrameInternalFrameTitlePaneInternalFrameTitlePaneMaximizeButtonWindowNotFocusedState
Compiler Development Forum
Compiler Development Forum
Re: Strange letter displays before string [ACTUALLY SOLVED]
And now i just tested. It should say exactly what my real machine just put there:
http://i.imgur.com/wcPmWCf.jpg
http://i.imgur.com/wcPmWCf.jpg
Last edited by thepowersgang on Thu Jan 12, 2017 1:04 am, edited 1 time in total.
Reason: removed obnoxiously large image
Reason: removed obnoxiously large image
-
- Member
- Posts: 27
- Joined: Thu Oct 13, 2016 2:07 pm
Re: Strange letter displays before string [ACTUALLY SOLVED]
Now I know who NunoLava1998 is... You're him! DixiumOS, you're NunoLava1998. Your GitHub page has NunoLava1998. Everyone calls me it all the time.
- Love4Boobies
- Member
- Posts: 2111
- Joined: Fri Mar 07, 2008 5:36 pm
- Location: Bucharest, Romania
Re: Strange letter displays before string [ACTUALLY SOLVED]
Yeah, we know who he is. But somehow you managed to occupy the same space in our minds. That's not his fault.
"Computers in the future may weigh no more than 1.5 tons.", Popular Mechanics (1949)
[ Project UDI ]
[ Project UDI ]
Re: Strange letter displays before string [ACTUALLY SOLVED]
Hello again, NunoLava1998. I need to update my ignore list again. Please refrain from updating your nickname in the future. Thank you very much!
Learn to read.
-
- Member
- Posts: 27
- Joined: Thu Oct 13, 2016 2:07 pm
Re: Strange letter displays before string [ACTUALLY SOLVED]
Forums are nuts these days... Are you this guy? Are you that guy?! Everything you've done is all wrong. Ugh... Ugh... Ugh!