mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-12-24 02:33:19 +00:00
refactor 80STORE switch to C
This commit is contained in:
parent
5249248aaa
commit
ba1c2b0451
@ -149,89 +149,9 @@
|
||||
enabled.
|
||||
----------------------------------------------------------------- */
|
||||
|
||||
/* -------------------------------------------------------------------------
|
||||
* misc //e functions
|
||||
* ------------------------------------------------------------------------- */
|
||||
|
||||
|
||||
/* 80STORE off. use RAMRD/RAMWRT for text/hires display page 1 */
|
||||
E(iie_80store_off)
|
||||
testl $SS_80STORE, SN(softswitches) # already off?
|
||||
jz ram_nop
|
||||
andl $~(SS_80STORE|SS_TEXTRD|SS_TEXTWRT|SS_HGRRD|SS_HGRWRT), SN(softswitches)
|
||||
movl $SN(apple_ii_64k),SN(base_textrd)
|
||||
movl $SN(apple_ii_64k),SN(base_textwrt)
|
||||
movl $SN(apple_ii_64k),SN(base_hgrrd)
|
||||
movl $SN(apple_ii_64k),SN(base_hgrwrt)
|
||||
testl $SS_RAMRD, SN(softswitches)
|
||||
jz iie_80store_off_noramrd
|
||||
orl $(SS_TEXTRD|SS_HGRRD),SN(softswitches)
|
||||
movl $SN(apple_ii_64k)+BANK2,SN(base_textrd)
|
||||
movl $SN(apple_ii_64k)+BANK2,SN(base_hgrrd)
|
||||
iie_80store_off_noramrd:
|
||||
testl $SS_RAMWRT, SN(softswitches)
|
||||
jz iie_80store_off_noramwrt
|
||||
orl $(SS_TEXTWRT|SS_HGRWRT),SN(softswitches)
|
||||
movl $SN(apple_ii_64k)+BANK2,SN(base_textwrt)
|
||||
movl $SN(apple_ii_64k)+BANK2,SN(base_hgrwrt)
|
||||
iie_80store_off_noramwrt:
|
||||
testl $SS_PAGE2, SN(softswitches)
|
||||
jz ram_nop
|
||||
orl $SS_SCREEN, SN(softswitches)
|
||||
pushal
|
||||
pushl $1
|
||||
call SN(video_setpage)
|
||||
addl $4, %esp
|
||||
popal
|
||||
/* call SN(video_redraw) # redraw */
|
||||
ret
|
||||
|
||||
/* 80STORE on. we use PAGE2 offset to access text page 1. if HIRES on
|
||||
we also use PAGE2 offset to access hires page 1 */
|
||||
E(iie_80store_on)
|
||||
testl $SS_80STORE, SN(softswitches) # already on?
|
||||
jnz ram_nop
|
||||
orl $SS_80STORE, SN(softswitches)
|
||||
testl $SS_PAGE2, SN(softswitches)
|
||||
jnz iie_80store_on_page2_on
|
||||
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_80store_on_cont
|
||||
andl $~(SS_HGRRD|SS_HGRWRT), SN(softswitches)
|
||||
movl $SN(apple_ii_64k), SN(base_hgrrd)
|
||||
movl $SN(apple_ii_64k), SN(base_hgrwrt)
|
||||
jmp iie_80store_on_cont
|
||||
|
||||
iie_80store_on_page2_on:
|
||||
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_80store_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_80store_on_cont:
|
||||
andl $~SS_SCREEN, SN(softswitches)
|
||||
pushal
|
||||
pushl $0 # page 1
|
||||
call SN(video_setpage)
|
||||
addl $4, %esp
|
||||
popal
|
||||
/* call SN(video_redraw) # redraw */
|
||||
ret
|
||||
|
||||
return80: movb $0x80,%al
|
||||
ret
|
||||
|
||||
E(iie_check_80store)
|
||||
testl $SS_80STORE,SN(softswitches)
|
||||
jnz return80
|
||||
xorb %al,%al
|
||||
ret
|
||||
|
||||
/* RAMRD main. if 80STORE off then text/hires display pages are in
|
||||
main memory. */
|
||||
E(iie_ramrd_main)
|
||||
|
74
src/vm.c
74
src/vm.c
@ -419,3 +419,77 @@ GLUE_C_READ(iie_c08b)
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
// Misc //e softswitches and vm routines
|
||||
|
||||
GLUE_C_READ(iie_80store_off)
|
||||
{
|
||||
if (!(softswitches & SS_80STORE)) {
|
||||
return 0x0; // TODO: no early return?
|
||||
}
|
||||
|
||||
softswitches &= ~(SS_80STORE|SS_TEXTRD|SS_TEXTWRT|SS_HGRRD|SS_HGRWRT);
|
||||
|
||||
base_textrd = apple_ii_64k[0];
|
||||
base_textwrt = apple_ii_64k[0];
|
||||
base_hgrrd = apple_ii_64k[0];
|
||||
base_hgrwrt = apple_ii_64k[0];
|
||||
|
||||
if (softswitches & SS_RAMRD) {
|
||||
softswitches |= (SS_TEXTRD|SS_HGRRD);
|
||||
base_textrd = apple_ii_64k[1];
|
||||
base_hgrrd = apple_ii_64k[1];
|
||||
}
|
||||
|
||||
if (softswitches & SS_RAMWRT) {
|
||||
softswitches |= (SS_TEXTWRT|SS_HGRWRT);
|
||||
base_textwrt = apple_ii_64k[1];
|
||||
base_hgrwrt = apple_ii_64k[1];
|
||||
}
|
||||
|
||||
if (softswitches & SS_PAGE2) {
|
||||
softswitches |= SS_SCREEN;
|
||||
video_setpage(1);
|
||||
}
|
||||
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
GLUE_C_READ(iie_80store_on)
|
||||
{
|
||||
if (softswitches & SS_80STORE) {
|
||||
return 0x0; // TODO: no early return?
|
||||
}
|
||||
|
||||
softswitches |= SS_80STORE;
|
||||
|
||||
if (softswitches & SS_PAGE2) {
|
||||
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_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];
|
||||
}
|
||||
}
|
||||
|
||||
softswitches &= ~SS_SCREEN;
|
||||
video_setpage(0);
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
GLUE_C_READ(iie_check_80store)
|
||||
{
|
||||
return (softswitches & SS_80STORE) ? 0x80 : 0x00;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user