mirror of
https://github.com/pevans/erc-c.git
synced 2024-11-01 04:04:28 +00:00
Add video mode switcher to handle logical sizes
This commit is contained in:
parent
7d62548248
commit
23e113e72a
@ -5,6 +5,13 @@
|
||||
#include "mos6502.h"
|
||||
#include "vm_screen.h"
|
||||
|
||||
enum video_modes {
|
||||
VIDEO_LORES,
|
||||
VIDEO_HIRES,
|
||||
VIDEO_DOUBLE_LORES,
|
||||
VIDEO_DOUBLE_HIRES,
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
/*
|
||||
* The apple 2 hardware used an MOS-6502 processor.
|
||||
@ -23,6 +30,13 @@ typedef struct {
|
||||
*/
|
||||
vm_screen *screen;
|
||||
|
||||
/*
|
||||
* This is the mode in which we must interpret graphics. This will
|
||||
* tell us not only if we're in lo- or hi-res, but also if we are in
|
||||
* single or double view mode.
|
||||
*/
|
||||
int video_mode;
|
||||
|
||||
/*
|
||||
* Our two disk drives.
|
||||
*/
|
||||
@ -37,5 +51,6 @@ extern void apple2_clear_strobe(apple2 *);
|
||||
extern void apple2_release_key(apple2 *);
|
||||
extern int apple2_boot(apple2 *);
|
||||
extern void apple2_run_loop(apple2 *);
|
||||
extern void apple2_set_video(apple2 *, int);
|
||||
|
||||
#endif
|
||||
|
25
src/apple2.c
25
src/apple2.c
@ -156,3 +156,28 @@ apple2_boot(apple2 *mach)
|
||||
|
||||
return OK;
|
||||
}
|
||||
|
||||
void
|
||||
apple2_set_video(apple2 *mach, int mode)
|
||||
{
|
||||
int width, height;
|
||||
|
||||
mach->video_mode = mode;
|
||||
|
||||
// In the traditional video modes that Apple II first came in, you
|
||||
// would have a maximum width of 280 pixels. (In lo-res, you have
|
||||
// fewer pixels, but that is something we have to handle in our
|
||||
// drawing functions rather than by changing the logical size.)
|
||||
width = 280;
|
||||
height = 192;
|
||||
|
||||
// In double video modes, the width is effectively doubled, but the
|
||||
// height is untouched.
|
||||
if (mach->video_mode == VIDEO_DOUBLE_LORES ||
|
||||
mach->video_mode == VIDEO_DOUBLE_HIRES
|
||||
) {
|
||||
width = 560;
|
||||
}
|
||||
|
||||
vm_screen_set_logical_coords(mach->screen, width, height);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user