mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-11 14:30:08 +00:00
refactor PAGE2 switch to C
This commit is contained in:
parent
9ff453be23
commit
8b00636f66
@ -149,63 +149,6 @@
|
||||
enabled.
|
||||
----------------------------------------------------------------- */
|
||||
|
||||
/* PAGE2 off. if 80STORE on then we use main text page1, and if HIRES
|
||||
on we also use main hires page1, regardless of RAMRD and
|
||||
RAMWRT. */
|
||||
E(iie_page2_off)
|
||||
testl $SS_PAGE2, SN(softswitches) # already off?
|
||||
jz ram_nop
|
||||
andl $~(SS_PAGE2|SS_SCREEN), SN(softswitches)
|
||||
testl $SS_80STORE, SN(softswitches)
|
||||
jz _iie_page2_off_hires_off # no 80STORE
|
||||
andl $~(SS_TEXTRD|SS_TEXTWRT), SN(softswitches)
|
||||
movl $SN(apple_ii_64k), SN(base_textrd)
|
||||
movl $SN(apple_ii_64k), SN(base_textwrt)
|
||||
testl $SS_HIRES, SN(softswitches)
|
||||
jz _iie_page2_off_hires_off # no HIRES
|
||||
andl $~(SS_HGRRD|SS_HGRWRT), SN(softswitches)
|
||||
movl $SN(apple_ii_64k), SN(base_hgrrd)
|
||||
movl $SN(apple_ii_64k), SN(base_hgrwrt)
|
||||
_iie_page2_off_hires_off:
|
||||
pushal
|
||||
pushl $0 # page 1 main
|
||||
call SN(video_setpage)
|
||||
addl $4, %esp
|
||||
popal
|
||||
/* call SN(video_redraw)# redraw */
|
||||
ret
|
||||
|
||||
|
||||
/* PAGE2 on. if 80STORE on then we use aux text page 1, and if HIRES
|
||||
on we also use aux hires page 1, regardless of RAMRD and
|
||||
RAMWRT. */
|
||||
E(iie_page2_on)
|
||||
testl $SS_PAGE2, SN(softswitches) # already on?
|
||||
jnz ram_nop
|
||||
orl $SS_PAGE2, SN(softswitches)
|
||||
testl $SS_80STORE, SN(softswitches)
|
||||
jz _iie_page2_on_80store_off # no 80STORE
|
||||
orl $(SS_TEXTRD|SS_TEXTWRT), SN(softswitches)
|
||||
movl $SN(apple_ii_64k)+BANK2, SN(base_textrd)
|
||||
movl $SN(apple_ii_64k)+BANK2, SN(base_textwrt)
|
||||
testl $(SS_HIRES), SN(softswitches)
|
||||
jz _iie_page2_on_cont
|
||||
orl $(SS_HGRRD|SS_HGRWRT), SN(softswitches)
|
||||
movl $SN(apple_ii_64k)+BANK2, SN(base_hgrrd)
|
||||
movl $SN(apple_ii_64k)+BANK2, SN(base_hgrwrt)
|
||||
_iie_page2_on_cont:
|
||||
ret
|
||||
|
||||
_iie_page2_on_80store_off: # no 80STORE
|
||||
orl $SS_SCREEN, SN(softswitches)
|
||||
pushal
|
||||
pushl $1 # page 2 main
|
||||
call SN(video_setpage)
|
||||
addl $4, %esp
|
||||
popal
|
||||
/* call SN(video_redraw)# redraw */
|
||||
ret
|
||||
|
||||
E(read_switch_graphics)
|
||||
testl $SS_TEXT, SN(softswitches)
|
||||
jz ram_nop
|
||||
|
52
src/vm.c
52
src/vm.c
@ -61,3 +61,55 @@ GLUE_C_READ(speaker_toggle)
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Softswitches
|
||||
|
||||
GLUE_C_READ(iie_page2_off)
|
||||
{
|
||||
if (!(softswitches & SS_PAGE2)) {
|
||||
return 0x0; // TODO: no early return?
|
||||
}
|
||||
|
||||
softswitches &= ~(SS_PAGE2|SS_SCREEN);
|
||||
|
||||
if (softswitches & SS_80STORE) {
|
||||
softswitches &= ~(SS_TEXTRD|SS_TEXTWRT);
|
||||
base_textrd = apple_ii_64k[0];
|
||||
base_textwrt = apple_ii_64k[0];
|
||||
if (softswitches & SS_HIRES) {
|
||||
softswitches &= ~(SS_HGRRD|SS_HGRWRT);
|
||||
base_hgrrd = apple_ii_64k[0];
|
||||
base_hgrwrt = apple_ii_64k[0];
|
||||
}
|
||||
}
|
||||
|
||||
video_setpage(0);
|
||||
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
GLUE_C_READ(iie_page2_on)
|
||||
{
|
||||
if (softswitches & SS_PAGE2) {
|
||||
return 0x0; // TODO: no early return?
|
||||
}
|
||||
|
||||
softswitches |= SS_PAGE2;
|
||||
|
||||
if (softswitches & SS_80STORE) {
|
||||
softswitches |= (SS_TEXTRD|SS_TEXTWRT);
|
||||
base_textrd = apple_ii_64k[1];
|
||||
base_textwrt = apple_ii_64k[1];
|
||||
if (softswitches & SS_HIRES) {
|
||||
softswitches |= (SS_HGRRD|SS_HGRWRT);
|
||||
base_hgrrd = apple_ii_64k[1];
|
||||
base_hgrwrt = apple_ii_64k[1];
|
||||
}
|
||||
} else {
|
||||
softswitches |= SS_SCREEN;
|
||||
video_setpage(1);
|
||||
}
|
||||
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user