Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another question to keep it going #3

Open
dotmilk opened this issue Jul 31, 2018 · 2 comments
Open

Another question to keep it going #3

dotmilk opened this issue Jul 31, 2018 · 2 comments

Comments

@dotmilk
Copy link

dotmilk commented Jul 31, 2018

First thanks for this wonderful bit of code. I must admit I'm a tad lost when it comes to how the builtin files get into the image, I see you concating all the paths to the various .fs files and then including them with #include "BUILTIN-FILES.S". I am unsure by what means their contents end up assembled into the kernel / as theri dictionary entries are just of the form BUILTIN_WORD_NAME(__core_fs, "@core.fs") which suggests to me they exist as a word __core_fs in the dictionary, but what that word does or how the whole file gets into the image is beyond me.

I'm more of a nasm kind of guy and not the best at it or reading gas and not realizing if I'm missing a directive or something. So any sort of elucidation would be greatly appreciated.

@davazp
Copy link
Owner

davazp commented Jul 31, 2018

The files are included as text into the image. __core_fs is added by the linker, and it is the address of such a content in the image. We just give a convenient name to it @core.fs, so we can load it with require for example. (which will initialize the interpreter in that buffer).

Look at this rule from the GNUmakefile:

%.o: %.fs
	objcopy -I binary -O elf32-i386 -Bi386 $< $@

So, there is no cross-compilation at all. forth.S will start interpreting all those built-in files.

Does it help?

@dotmilk
Copy link
Author

dotmilk commented Aug 1, 2018

Ahhh having followed it into core.fs now it makes much more sense. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants