diff --git a/src/mos6502.c b/src/mos6502.c index 9e7f4af..9346f32 100644 --- a/src/mos6502.c +++ b/src/mos6502.c @@ -446,6 +446,10 @@ mos6502_would_jump(int inst_code) inst_code == JSR; } +/* + * Here we copy the segment directly into the cpu memory, to essentially + * "flash" memory with the contents of another segment. + */ void mos6502_flash_memory(mos6502 *cpu, vm_segment *segment) { diff --git a/src/mos6502.dis.c b/src/mos6502.dis.c index d98db3f..7036ab3 100644 --- a/src/mos6502.dis.c +++ b/src/mos6502.dis.c @@ -309,6 +309,10 @@ mos6502_dis_opcode(mos6502 *cpu, FILE *stream, int address) return expected + 1; } +/* + * Scan the CPU memory, from a given position until a given end, and + * print the results into a given file stream. + */ void mos6502_dis_scan(mos6502 *cpu, FILE *stream, int pos, int end) { @@ -317,6 +321,12 @@ mos6502_dis_scan(mos6502 *cpu, FILE *stream, int pos, int end) } } +/* + * Associate a label with a given address or operand, depending on the + * address mode. For example, with REL, the jump label will be based on + * the address but added to or subtracted with the operand. Whereas in + * IND, the address is wholly dependent on the operand. + */ void mos6502_dis_jump_label(mos6502 *cpu, vm_16bit operand, @@ -355,18 +365,29 @@ mos6502_dis_jump_label(mos6502 *cpu, jump_table[jump_loc] = 1; } +/* + * Print out the form of our label to the given file stream. This is + * fairly dumb; it'll print out whatever address you give to it. + */ inline void mos6502_dis_label(FILE *stream, int address) { fprintf(stream, "ADDR_%d", address); } +/* + * Remove the previously-set label in the jump table for a given + * address. + */ inline void mos6502_dis_jump_unlabel(int address) { jump_table[address] = 0; } +/* + * Return true if the given address has a jump label associated with it. + */ inline bool mos6502_dis_is_jump_label(int address) { diff --git a/src/objstore.c b/src/objstore.c index eb249b6..ad6cde0 100644 --- a/src/objstore.c +++ b/src/objstore.c @@ -51,6 +51,9 @@ objstore_init() return OK; } +/* + * Return true if the object store is ready to be used. + */ bool objstore_ready() { diff --git a/src/option.c b/src/option.c index 41d11e7..2cad49f 100644 --- a/src/option.c +++ b/src/option.c @@ -280,6 +280,9 @@ option_get_height() return height; } +/* + * Return true if the given option flag is set. + */ bool option_flag(int flag) { diff --git a/src/vm_screen.c b/src/vm_screen.c index 5fdd0fa..9ca1002 100644 --- a/src/vm_screen.c +++ b/src/vm_screen.c @@ -211,6 +211,10 @@ vm_screen_draw_rect(vm_screen *screen, vm_area *area) SDL_RenderFillRect(screen->render, &rect); } +/* + * Assign the values of an area, which are an x and y offset plus a + * width and height. + */ inline void vm_area_set(vm_area *area, int xoff, int yoff, int width, int height) {