Page 2 of 2

Re: Linker problem

Posted: Wed Jul 06, 2005 11:00 pm
by rexlunae
Mikkel wrote:I've just tried to comment some of the lines out, and it's this that makes the error:

unsigned char kbdus[128] = { 0, 27, '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '-', '=', '\b', '\t', 'q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', '[', ']', '\n', 0, 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', ';', '\'', '`', 0, '\\', 'z', 'x', 'c', 'v', 'b', 'n', 'm', ',', '.', '/', 0, '*', 0, ' ', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '-', 0, 0, 0, '+', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };

(same as the other kbdus, just made to a single line).

without it, there's no errors (except this ofcourse dosn't work: kar=kbdus[readkey()];) but with it:

kb.o(.text+0x20): In function `scanf':
: undefined reference to `memcpy'
That's not the same error you were talking about, right. You last said it was just rebooting, not failing to link.

Anyway, it looks like your compiler is resorting to calling memcpy to initialize such a huge local array. I recommend making it static, so that it does not need to be reinitialized each time the function is run. This should avoid the call to memcpy that the compiler is doing, and it's probably better anyway. On the other hand, at some point it would probably be a good idea to implement the memcpy function, since it is really easy to implement and really useful.

Re: Linker problem

Posted: Wed Jul 06, 2005 11:00 pm
by Mikkel
Yeah, it restarted before i changed the assembly in low_kb.s

I've just made the array static. Now I am not getting any errors, though when I run the OS, nothing happens when i'm using the keyboard. No compile errors and the system dosn't restart, but nothing happens when I press a key.

Is it me thats wrong? Dosn't this code get the scancodes:

Code: Select all

[bits 16]

[global readkey]
readkey:
	in al,64h		; read status byte
	and al,01h	; wait for OBF==1
	jz readkey
	in al,60h		; read scancode byte
ret
When i'm not using the array to translate it to ascii, when im pressing a key, then two weird signs show on the screen.