summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-01-14Add bitmasks for reading data from memory, andmrb0nk500
immediate data.
2022-01-14Add bitmask for absolute addressing.mrb0nk500
2022-01-14Add a bitmask generator for the new instruction handlermrb0nk500
macro. This program will help with generating the bitmasks for the instruction handler macro.
2022-01-14Start work on new instruction handler macro.mrb0nk500
This macro will create a function for each opcode, but with only a single block of code for each one. It uses a bitmask (one bit for each opcode) that will evaluate which blocks of code are used by each opcode. The bitmask checks are (usually) evaluated at compile time, which means that each function will only have the blocks that had the bit for that opcode set in the bitmask.
2021-05-09Subtract another 16 from the size in clr_arr.HEADmastermrb0nk500
This fixes a bug where it would zero out the info of the next malloc'd block.
2021-05-09Replace call to memcpy, with call to memcpy_dir.mrb0nk500
This fixes a bug where when shifting the line left, it would overwrite everything after the cursor with the character at the cursor's position. The reason this was happening is because memcpy copies from start to end, and because the destination is more than one byte ahead of the source, it overwrites the next length source bytes, which will repeat until it's copied n bytes.
2021-05-09Add a end to start version of memcpy, and a selectablemrb0nk500
direction version of memcpy. This can help with some subroutines/functions like shftln, which need to copy data in a certain direction depending on the condition.
2021-05-09Add scr_ptr to the list of outputted addresses when inmrb0nk500
debuging mode.
2021-05-08Fixed a bug in print_char caused by not zero extendingmrb0nk500
`b`.
2021-05-08Fixed a bug in print_str to do with clobberedmrb0nk500
registers. This was due to print_char clobbering `d` when calling get_index.
2021-05-08Replace get_ctrlidx with get_index in print_char.mrb0nk500
This helps reduce code duplication, and makes it easier to both read, and add new handlers.
2021-05-08Add a new subroutine called get_index.mrb0nk500
This subroutine gets the index of a given character from a string. This will help in replacing some routines like get_ctrlidx, isdelm, and isdelm2.
2021-05-08Get the pointer from the control code handler tablemrb0nk500
using SIB, rather than with lsl. This doesn't increase, or decrease the code size, but does make it both more compact, and easier to read.
2021-05-08Replace the old string parsing code inmrb0nk500
handle_directive() with a call to parse_quote(). This not only reduces code duplication, but also makes it more robust in the process.
2021-05-08Add support for saving to a string buffer inmrb0nk500
parse_quote(). This allows for replacing the string parsing code in handle_directive() with a call to parse_quote().
2021-05-08Rewrite `clr_arr` to use the ortho extension.mrb0nk500
This makes the code much smaller than the previous version.
2021-05-08Replace all instances of $/0x1B with the escapemrb0nk500
sequence for the escape character.
2021-05-08Start replacing the numbered duplicate local symbolsmrb0nk500
with deeper scope local symbols. This is done to make the code easier to read.
2021-05-08Fixed a bug with how local symbols with a depthmrb0nk500
greater than one are handled. It wasn't getting the correct depth when relative local symbols were used. So to account for that, it adds the relative depth (number of '@'s in a row), with the absolute depth (number of '.'s), to get the true scope depth.
2021-05-08Start implementing whole file lexing.mrb0nk500
This will eventually replace the per-line lexer.
2021-04-04- Fixed a bug to do with how SIB operands were parsedmrb0nk500
in the assembler. - Rewrote more of the SuB Suite to use the new calling convention. - Fixed a bug to do with SIB operands in the emulator's disassembler. - Made the MMV instruction not require a loop prefix for copying data.
2021-02-25- Implemented the multiply expression into the assembler.mrb0nk500
- Implemented support for the SIB addressing mode into the assembler. SIB is short for "Scale Index, and Base", and works much like x86's version of SIB (scale*index+base), although my version supports any scale value between 1, and 256. - Redid the line shifting routine in SuBEditor. It now uses memcpy, and memset to do that, and also supports shifting the line left, or right by any number of characters.
2021-02-13- Reverted back one commit before the previous commit.mrb0nk500
This is because the previous commit actually created a bug, rather than fixing one. - Added JMP, and JSR to the ortho extension, and implemented them both in the assembler, and emulator.
2021-02-11Fixed a bug in the lexer.mrb0nk500
2021-02-11Simplified the expression parser.mrb0nk500
I was finally able to figure out how to implement the expression parser into two functions. It can be done in a single function, but I used two functions to make it easier to read.
2021-02-08Completly rewrote the expression handler.mrb0nk500
It's now separate from the lexer, and was designed to make it both easier to understand, and easier to parse.
2021-01-27- Fixed some bugs in the emulator.mrb0nk500
- Started work on implementing the Super VIA emulation. - Added support for disabling disassembly per instruction, when in debug mode. - Did some more work on rewriting the SuB Suite to work with the new calling convention. - Rewrote the symbol handling code in the emulator's assembler, to make it both simpler, and to add support for arbitrarily deep symbol scopes. - Added support for arbitrarily deep local symbol scopes. For example, to declare a symbol of depth 2, you add two '@' characters to the start of the symbol name. In other words, the number of '@' characters before the symbol name is what determines the scope of that symbol. And to use a symbol thats outside the current scope, you would use the same syntax as using a struct member, so you would do `global.local`.
2020-12-09- Made the emulator's debugger use individual windows.mrb0nk500
I mainly did this to be able to display all 16 main registers, but also to simplify the debugger.
2020-12-09- Made the `set` instruction also set the Zero flag.mrb0nk500
This was done in order to save three bytes whenever you want to immediatly do a conditional branch after the `set` instruction.
2020-12-09- Implemented support for the `set` instruction in themrb0nk500
assembler. The main thing I had to do was implement the parsing of the condition code token, but that wasn't hard to do, since I had already done the lexing part already. The next thing to do, will be to design a calling convention for Sux.
2020-12-08- Fixed yet another bug with the ortho extension.mrb0nk500
2020-12-08- Fixed a bug with the ortho extension implementationmrb0nk500
in the emulator.
2020-12-08- Implemented support for the Orthogonal extension intomrb0nk500
both the assembler, and the emulator. I finally figured out how I could get support for the Ortho extension implemented into the old assembler. The only reason for doing this, is to buy me some while I start work on the new assembler, and to help me get an idea for how to do the same in the new assembler.
2020-11-20- Implemented support for Sux's base extension.mrb0nk500
This is the biggest milestone I've reached for this project, since the base extension changes alot about what Sux can do by default, and now makes it a viable instruction set for modern day use, when compared with other instruction sets.
2020-11-20- Cleaned up a bit of the code.mrb0nk500
- Made the debug print for the CPU flags more readable. - Started work on implementing line number support into SuBAsm.
2020-10-06- Removed some debugging stuff from the SuB Suite.mrb0nk500
2020-10-06- Made the stack pointer 64 bit, rather than 16 bit.mrb0nk500
This is to allow for making the stack bigger for anything that needs to change the size of it. - Made the SuB Suite set the stack pointer to the end of the usable RAM, and allow for changing the stack size. In this case, the size of the stack is currently set to 192K, with the end of the heap being just below the stack.
2020-10-05- Fixed the rotate instructions.mrb0nk500
The carry flag is now set properly, and the rotation now is set properly by the carry flag, even for shift values greater than one. - Added a test program for properly testing the rotate instructions.
2020-10-05- Added a routine for testing the SuB Suite'smrb0nk500
implementation of free(), although it's commented out. - Removed the sbc() function from the emulator, since sbc can be done by just inverting the second operand of adc.
2020-10-04- Added support for reading, and writing outside themrb0nk500
emulator's memory. All reads outside of the emulator's memory give back $/0xFF bytes, while all writes outside of the emulator's memory are ignored. - Implemented malloc(), and free() in the SuB Suite. In order to do this, I had to add support for a heap, which I did by reserving the first 3 banks of the address space (the first 192K), and by adding a routine that finds the end of the RAM. In this case, I set the starting address for the routine at bank 3 (bank 4 with one indexing), but, the routine's starting address isn't hardcoded, and thus, any starting address can be passed as an argument. The routine uses the fact that we can now read/write outside the emulator's memory, and also uses the fact that writing outside the emulator's memory will be ignored, and that reading outside the emulator's memory will always read $/0xFF bytes, and uses that to signal that it's reached the end of the RAM. - Added a test program for getting the size of RAM starting at address $/0x20000.
2020-09-24- Fixed some more bugs with struct, and union handling.mrb0nk500
2020-09-21- Fixed some issues with how structs, and unions weremrb0nk500
handled. - Added a function called fix_symtree(), which when called. will rearrange the symbol tree based on the order they're declared in by the token stream. The reason I wrote this, was to make sure the symbol tree could be printed correctly. - Optimized print_symtree() to now use tail recursion. - Started adding all of the SuB Suite's structs.
2020-09-18- Added support for structs, and unions to themrb0nk500
emulator's assembler. - Make the symbol table a doublely linked list, in both ways. - Optimized the memcopy() function. - Changed the benchmark timing, to now use a timer, and stops once the timer reaches zero. When the timer hits zero, it sends SIGALRM to the main function, which tells the emulator that the benchmark is done.
2020-08-31- Optimized the memory read/write functions a bit more.mrb0nk500
- Added a memcopy() function, for later on.
2020-08-30- Did some more work on SuBAsm's lexer.mrb0nk500
- Optimized the memory read, and write functions. - Made the emulator faster, and cleaner in general.
2020-08-17- Fixed some bugs in the emulator's assembler.mrb0nk500
- Simplified the effective address functions. - Made SuBEditor a bit faster. - JSR, and RTS now support using the RS prefix, which is used to specify the return address size, with an RS prefix of 0 being a return address size of 64 bits, rather than 8 bits.
2020-08-13Refactored get_addr(), and all of the effectivemrb0nk500
address handling. It's now all done using several functions for each addressing mode, with the result being the effective address. I did this to make the codebase cleaner, and more readable.
2020-08-12- Refactored the escape sequence parsing, and handling.mrb0nk500
It now uses a struct to store the escape sequence. Before it handles the escape sequence, it parses it, which includes things like getting any arguments that are supplied, and getting the mode type. - Moved the code that handles control codes to a separate function. The reason for doing this was because I wanted to make the escape sequence handling faster, but also make the code more readable at the same time. I got the idea to do this from st, a terminal emulator created by the suckless.org project.
2020-08-11Refactored the keyboard I/O emulation, again.mrb0nk500
I decided to use keypad now, and create a function to return the actual key sequences. The keyboard I/O is also now being handled by the io emulation function, and not by the main function. This should get rid of any possible deadlocks.
2020-08-11- Changed the spacing format to now store the number ofmrb0nk500
spaces, and tabs before the current token. Along with also now storing a sub-token count which is used in case the token's secondary id is meant to be treated as a sub-token. - Added suppor for saving the number of blank lines before the current tokenized line.