Commit Graph

195 Commits

Author SHA1 Message Date
Byron Lathi
aa717685e3 Use our own toolchain instead of the one in the image
Now that we are adding our own target we can compile our own toolchain
instead of using the stock one. This does mean that there isn't really a
purpose to using the alpine cc65 image though
2022-04-20 12:41:20 -05:00
Byron Lathi
686630e79f Remove unused code to make code smaller
These might need to be added back eventually.
2022-04-19 15:35:22 -05:00
Byron Lathi
c7ff69a1a0 Update .gitlab-ci.yml file 2022-04-19 20:30:27 +00:00
Byron Lathi
7b84d8a9c2 Update .gitlab-ci.yml file 2022-04-19 20:27:25 +00:00
Byron Lathi
25883aa3cc Update .gitlab-ci.yml file 2022-04-19 20:09:32 +00:00
Byron Lathi
bd748cab86 Update .gitlab-ci.yml file 2022-04-19 20:08:10 +00:00
Byron Lathi
04346ed625 Update .gitlab-ci.yml file
Add bootloader.hex as an artifact for the FPGA build
2022-04-19 20:05:53 +00:00
Byron Lathi
a836643807 Disable in system memory editor for ROM
Now that the ROM is just a bootloader and the kernel is stored on the SD
card, we do not need to be constantly changing the ROM.

Disabling the memory editor dramatically reduces compilation time which
will be useful when implementing FPGA features in the future.
2022-04-19 14:47:19 -05:00
Byron Lathi
ff8078fac7 Program ROM with bootloader
Replaces the ROM image with the bootloader instead of bootrom, which no
longer exists.
2022-04-19 13:46:57 -05:00
Byron Lathi
f3c7ac9696 Replace bios with bootloader, don't use bootsector
Instead of using the bootsector to load a bootloader, just put the
bootloader in the ROM and call it a day. It looks for a file on the SD
card in the root directory named `kernel.bin` and loads it into memory.

This is not a perfect solution, as the kernel will grow larger and the
kernel load address will have to change. At this point I could add back
the bootloader, but that is for later.

Also the bootloader is just a copy of the kernel, so that can be trimmed
down a lot.
2022-04-19 10:34:19 -05:00
Byron Lathi
f664d59497 Copy kernel into root folder after build
This way it gets copied over to the SD card when installing.
2022-04-19 10:33:27 -05:00
Byron Lathi
15a0917bb4 Change kernel to use none target
I forgot that the CI still uses the stock cc65 which doesn't support my
target. The kernel doesn't really need this target though, only the user
programs.
2022-04-18 20:31:11 -05:00
Byron Lathi
4e2e030e52 Add scripts
automates the process of overwriting the boot sector of the SD card and
copying over the filesystem.
2022-04-18 20:29:10 -05:00
Byron Lathi
24d5a8c8ac Add fsdir 2022-04-18 20:29:00 -05:00
Byron Lathi
9f1d527a7c Change kernel link type
Kernel is now compiled and linked into a raw binary instead of intel
hex. This raw binary can be loaded into the correct address by the
bootloader.

I wanted this to be an o65 file, but ld65 kept complaining about it.
Honestly though having this be a straight binary makes it easier to
load, but we can't relocate it.
2022-04-18 20:27:48 -05:00
Byron Lathi
0fadc6a80f Add sw makefile which compiles all subtargets
Usefull now that we have like 4 different folders that need to be
compiled slightly differently
2022-04-18 20:27:05 -05:00
Byron Lathi
72b83d739d Remove unused define 2022-04-18 20:26:59 -05:00
Byron Lathi
9dd460a47f Add preliminary bootloader
This bootloader right now just prints the letter A, but should be
capable of reading blocks from the SD card into memory.
2022-04-18 20:25:08 -05:00
Byron Lathi
54328722ab Rename boot to bios, add sd call
Adds a call that you can make to the BIOS to read sd blocks. Useful for
the bootloader where there is not much space
2022-04-18 20:24:29 -05:00
Byron Lathi
64f6f0b397 Add top level makefile for sw 2022-04-18 12:50:19 -05:00
Byron Lathi
12284d19a9 Create boot environment
The boot environment will read the boot sector from the sd card, verify
that it has the boot signature at the end, then jump to the start of it.

From there, there should be a bootloader written to the boot segment
that can handle the rest.

It might be tight to fit everything into the boot sector but do remember
that you do not have to initialize or select the sd card, and those
functions take up a lot of space.
2022-04-18 12:43:29 -05:00
Byron Lathi
2ff3caccc6 Change user programs to use super6502 target
The target library is a copy of `none` right now but will be built out
later.
2022-04-18 12:12:43 -05:00
Byron Lathi
373fade79f Merge branch 'filesystem' into 'master'
Improve file system code

See merge request bslathi19/super6502!15
2022-04-18 17:10:09 +00:00
Byron Lathi
a9d9bc0619 Allow subdirectories
Can now break apart a filepath into the parent directories and search
for each one of them (not recursively!).
2022-04-17 20:18:43 -05:00
Byron Lathi
52f631e558 Allow finding files in the root directory
This allows you to find the cluster number of a file in the root
directory by name. The main program is a simple demo where you can type
in a filename and it will tell you the cluster number.
2022-04-17 18:12:13 -05:00
Byron Lathi
edd13e9b71 Remove debug information 2022-04-17 18:11:45 -05:00
Byron Lathi
6844c48a3b Update ci 2022-04-16 22:07:19 -05:00
Byron Lathi
8495f1f002 Update ci 2022-04-16 22:02:18 -05:00
Byron Lathi
c6098f2d1f Separate kernel code from test code
Eventually I want the kernel to be loaded from the SD card as well, but
it still needs to separate from user programs.

At some point there should be a folder just for the BIOS, which should
read from the boot block of the SD card and start executing, and thats
it.
2022-04-16 21:58:37 -05:00
Byron Lathi
238a4b6f98 Move devices into devices folder 2022-04-16 21:47:54 -05:00
Byron Lathi
c5f1b64cba Move filesystem code into its own directory
Step one into cleaning up the codebase a little bit.
2022-04-16 21:43:26 -05:00
Byron Lathi
c8ce675d2b Merge branch 'exec' into 'master'
Move code out of main and into their own files

See merge request bslathi19/super6502!14
2022-04-17 02:29:13 +00:00
Byron Lathi
8c9ae78040 Fix file endings 2022-04-16 21:04:39 -05:00
Byron Lathi
f1e71a9461 Move code out of main and into their own files
All of the SD card commands are moved into their own file, with
functions sd_init, sd_get_rca, sd_select_card, sd_get_status, and
sd_readblock.

The FAT functions are movied into fat.c and give functions fat_init and
fat_read. Note that the filename is ignored for now, it always reads the
first file in the root directory.

The loading of o65 files is done in o65.c, and executing is done in
exec.c

This cleans up the main file signifigantly and leaves the project open
to expansion.
2022-04-16 20:52:50 -05:00
Byron Lathi
c02d03bd99 Rename sd_card.s to sd_card_asm.s 2022-04-16 20:52:10 -05:00
Byron Lathi
44fb4cd0d5 Merge branch 'exec' into 'master'
Add reading, parsing, and basic executing of o65 files

See merge request bslathi19/super6502!13
2022-04-17 00:34:40 +00:00
Byron Lathi
a94b26dc3c Change code and data base to be pointers
These are technically pointers, so lets type them as such.
2022-04-16 19:24:21 -05:00
Byron Lathi
2786ec0940 Execute code read from the SD card
This will read the data from the sd card, copy it to the originally
linked address (no relocation), then execute it.

I am lazy and wrote it in C using weird function pointer casting but
this would probably be more efficient if it were to be written in
assembly instead.

The test program simply returns 'A', but that is enough to prove that it
is actually running.
2022-04-16 14:56:41 -05:00
Byron Lathi
585faa023f Remove compilation output files
These were used to help understand the o65 file format, but are not
needed and shouldn't have been commited anyway.
2022-04-16 14:30:34 -05:00
Byron Lathi
4be5366aee Do not track o65 files
These are object files still, which means we do not want to track them.
2022-04-16 14:28:40 -05:00
Byron Lathi
7e7bdd3b4a Use the system cl65, don't use verbose mode
I had used these to try and help figure out the structure of the o65
file but this is not needed anymore
2022-04-16 14:27:18 -05:00
Byron Lathi
016e9edee7 More o65 parsing
Prints out the options now too.
2022-04-16 14:22:26 -05:00
Byron Lathi
e30768d4c2 Rename o65_opt to o65_opt_t 2022-04-16 14:22:16 -05:00
Byron Lathi
f15b7876fe Add parsing of o65 files
Prints out information about the first file found on the SD card, if it
is an o65 file.
2022-04-16 14:10:54 -05:00
Byron Lathi
59da06c509 Add basic test program
This adds a test program which can be loaded and executed by the host.
It simply returns a value in the `a` register.

The linker script is modified so that it will output an o65 file, and
the memory sgments are changed as well. There is no STARTUP segment
defined, so it uses the default `none` crt0, which sets up the stack
and does initialization and deconstruction.

The Makefile is modified to not turn the output into an intel hex file,
and instead keep it as the o65 file.
2022-04-16 14:10:39 -05:00
Byron Lathi
0cecf166c7 Add definitions and structures for o65 files
These can be used to read and parse o65 files.
2022-04-16 14:02:57 -05:00
Byron Lathi
2c6f333966 Remove unused char c 2022-04-16 14:02:43 -05:00
Byron Lathi
7c2aab59dc Merge branch 'sdcard' into 'master'
Read data from a file

See merge request bslathi19/super6502!12
2022-04-14 22:16:28 +00:00
Byron Lathi
246d7a5e6f Print out more information, read a file
Prints out information about the drive, now inside its own function.

Also changes the read function to take in a 32 bit address instead of a
16 bit one.

Attempts to read the first file on the disk
2022-04-14 17:04:47 -05:00
Byron Lathi
380550c77d Add more struct definitions
Adds filesystem info struct and directory entry structs
2022-04-14 17:04:08 -05:00