Mercurial > repos > blastem
comparison vdp.c @ 2009:4ace0fef6f8f
Add support for the parts of the KMod debug ports used by SGDK
author | Mike Pavone <pavone@retrodev.com> |
---|---|
date | Mon, 19 Oct 2020 15:46:16 -0700 |
parents | 0740d90812ee |
children | 19957e7353a4 |
comparison
equal
deleted
inserted
replaced
2008:a8e3e816a50d | 2009:4ace0fef6f8f |
---|---|
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <string.h> | 9 #include <string.h> |
10 #include "render.h" | 10 #include "render.h" |
11 #include "util.h" | 11 #include "util.h" |
12 #include "event_log.h" | 12 #include "event_log.h" |
13 #include "terminal.h" | |
13 | 14 |
14 #define NTSC_INACTIVE_START 224 | 15 #define NTSC_INACTIVE_START 224 |
15 #define PAL_INACTIVE_START 240 | 16 #define PAL_INACTIVE_START 240 |
16 #define MODE4_INACTIVE_START 192 | 17 #define MODE4_INACTIVE_START 192 |
17 #define BUF_BIT_PRIORITY 0x40 | 18 #define BUF_BIT_PRIORITY 0x40 |
3780 } | 3781 } |
3781 } | 3782 } |
3782 if (reg == REG_MODE_1 || reg == REG_MODE_2 || reg == REG_MODE_4) { | 3783 if (reg == REG_MODE_1 || reg == REG_MODE_2 || reg == REG_MODE_4) { |
3783 update_video_params(context); | 3784 update_video_params(context); |
3784 } | 3785 } |
3786 } else if (reg == REG_KMOD_CTRL) { | |
3787 if (!(value & 0xFF)) { | |
3788 context->system->enter_debugger = 1; | |
3789 } | |
3790 } else if (reg == REG_KMOD_MSG) { | |
3791 char c = value; | |
3792 if (c) { | |
3793 context->kmod_buffer_length++; | |
3794 if ((context->kmod_buffer_length + 1) > context->kmod_buffer_storage) { | |
3795 context->kmod_buffer_storage = context->kmod_buffer_length ? 128 : context->kmod_buffer_length * 2; | |
3796 context->kmod_msg_buffer = realloc(context->kmod_msg_buffer, context->kmod_buffer_storage); | |
3797 } | |
3798 context->kmod_msg_buffer[context->kmod_buffer_length - 1] = c; | |
3799 } else if (context->kmod_buffer_length) { | |
3800 context->kmod_msg_buffer[context->kmod_buffer_length] = 0; | |
3801 init_terminal(); | |
3802 printf("KDEBUG MESSAGE: %s\n", context->kmod_msg_buffer); | |
3803 context->kmod_buffer_length = 0; | |
3804 } | |
3805 } else if (reg == REG_KMOD_TIMER) { | |
3806 if (!(value & 0x80)) { | |
3807 init_terminal(); | |
3808 printf("KDEBUG TIMER: %d\n", (context->cycles - context->timer_start_cycle) / 7); | |
3809 } | |
3810 if (value & 0xC0) { | |
3811 context->timer_start_cycle = context->cycles; | |
3812 } | |
3785 } | 3813 } |
3786 } else if (mode_5) { | 3814 } else if (mode_5) { |
3787 context->flags |= FLAG_PENDING; | 3815 context->flags |= FLAG_PENDING; |
3788 //Should these be taken care of here or after the second write? | 3816 //Should these be taken care of here or after the second write? |
3789 //context->flags &= ~FLAG_READ_FETCHED; | 3817 //context->flags &= ~FLAG_READ_FETCHED; |