mirror of
https://github.com/mauiaaron/apple2.git
synced 2024-06-26 00:29:27 +00:00
refactor RAMRD,RAMWRT switches to C
This commit is contained in:
parent
ba1c2b0451
commit
bb4acc967c
|
@ -152,106 +152,6 @@
|
|||
return80: movb $0x80,%al
|
||||
ret
|
||||
|
||||
/* RAMRD main. if 80STORE off then text/hires display pages are in
|
||||
main memory. */
|
||||
E(iie_ramrd_main)
|
||||
testl $SS_RAMRD, SN(softswitches) # already off?
|
||||
jz ram_nop
|
||||
andl $~SS_RAMRD, SN(softswitches)
|
||||
movl $SN(apple_ii_64k), SN(base_ramrd)
|
||||
testl $SS_80STORE, SN(softswitches) # 80store?
|
||||
jnz iie_ramrd_main_80store_on
|
||||
andl $~(SS_TEXTRD|SS_HGRRD), SN(softswitches)
|
||||
movl $SN(apple_ii_64k), SN(base_textrd)
|
||||
movl $SN(apple_ii_64k), SN(base_hgrrd)
|
||||
/* call SN(video_redraw) # redraw */
|
||||
ret
|
||||
iie_ramrd_main_80store_on:
|
||||
testl $SS_HIRES, SN(softswitches)
|
||||
jnz ram_nop
|
||||
andl $~SS_HGRRD, SN(softswitches)
|
||||
movl $SN(apple_ii_64k), SN(base_hgrrd)
|
||||
/* call SN(video_redraw) # redraw */
|
||||
ret
|
||||
|
||||
/* RAMRD aux. if 80STORE off then text/hires display pages are in aux
|
||||
memory. */
|
||||
E(iie_ramrd_aux)
|
||||
testl $SS_RAMRD, SN(softswitches) # already on?
|
||||
jnz ram_nop
|
||||
orl $SS_RAMRD, SN(softswitches)
|
||||
movl $SN(apple_ii_64k)+BANK2, SN(base_ramrd)
|
||||
testl $SS_80STORE, SN(softswitches) # 80store?
|
||||
jnz iie_ramrd_aux_80store_on
|
||||
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)
|
||||
/* call SN(video_redraw) # redraw */
|
||||
ret
|
||||
iie_ramrd_aux_80store_on:
|
||||
testl $SS_HIRES, SN(softswitches)
|
||||
jnz ram_nop # already set
|
||||
orl $(SS_HGRRD), SN(softswitches)
|
||||
movl $SN(apple_ii_64k)+BANK2, SN(base_hgrrd)
|
||||
/* call SN(video_redraw) # redraw */
|
||||
ret
|
||||
|
||||
E(iie_check_ramrd)
|
||||
testl $SS_RAMRD, SN(softswitches)
|
||||
jnz return80
|
||||
xorb %al,%al
|
||||
ret
|
||||
|
||||
/* RAMWRT main. if 80STORE off then text/hires display pages are in
|
||||
main memory. */
|
||||
E(iie_ramwrt_main)
|
||||
testl $SS_RAMWRT, SN(softswitches) # already off?
|
||||
jz ram_nop
|
||||
andl $~SS_RAMWRT, SN(softswitches)
|
||||
movl $SN(apple_ii_64k), SN(base_ramwrt) # main RAM
|
||||
testl $SS_80STORE, SN(softswitches) # 80store?
|
||||
jnz iie_ramwrt_main_80store_on
|
||||
andl $~(SS_TEXTWRT|SS_HGRWRT), SN(softswitches)
|
||||
movl $SN(apple_ii_64k), SN(base_textwrt)
|
||||
movl $SN(apple_ii_64k), SN(base_hgrwrt)
|
||||
/* call SN(video_redraw) # redraw */
|
||||
ret
|
||||
iie_ramwrt_main_80store_on:
|
||||
testl $SS_HIRES, SN(softswitches)
|
||||
jnz ram_nop
|
||||
andl $~SS_HGRWRT, SN(softswitches)
|
||||
movl $SN(apple_ii_64k), SN(base_hgrwrt)
|
||||
/* call SN(video_redraw) # redraw */
|
||||
ret
|
||||
|
||||
/* RAMWRT aux. if 80STORE off then write to text/hires display pages
|
||||
are in aux memory. */
|
||||
E(iie_ramwrt_aux)
|
||||
testl $SS_RAMWRT, SN(softswitches) # already on?
|
||||
jnz ram_nop
|
||||
orl $SS_RAMWRT, SN(softswitches)
|
||||
movl $SN(apple_ii_64k)+BANK2, SN(base_ramwrt) # aux RAM
|
||||
testl $SS_80STORE, SN(softswitches) # 80store?
|
||||
jnz iie_ramwrt_aux_80store_on
|
||||
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)
|
||||
/* call SN(video_redraw) # redraw */
|
||||
ret
|
||||
iie_ramwrt_aux_80store_on:
|
||||
testl $SS_HIRES, SN(softswitches)
|
||||
jnz ram_nop
|
||||
orl $SS_HGRWRT, SN(softswitches)
|
||||
movl $SN(apple_ii_64k)+BANK2, SN(base_hgrwrt)
|
||||
/* call SN(video_redraw) # redraw */
|
||||
ret
|
||||
|
||||
E(iie_check_ramwrt)
|
||||
testl $SS_RAMWRT, SN(softswitches)
|
||||
jnz return80
|
||||
xorb %al, %al
|
||||
ret
|
||||
|
||||
E(iie_altzp_main)
|
||||
testl $SS_ALTZP, SN(softswitches)
|
||||
jz 1f /* test if ALTZP already off -
|
||||
|
|
102
src/vm.c
102
src/vm.c
|
@ -493,3 +493,105 @@ GLUE_C_READ(iie_check_80store)
|
|||
return (softswitches & SS_80STORE) ? 0x80 : 0x00;
|
||||
}
|
||||
|
||||
GLUE_C_READ(iie_ramrd_main)
|
||||
{
|
||||
if (!(softswitches & SS_RAMRD)) {
|
||||
return 0x0; // TODO: no early return?
|
||||
}
|
||||
|
||||
softswitches &= ~SS_RAMRD;
|
||||
base_ramrd = apple_ii_64k[0];
|
||||
|
||||
if (softswitches & SS_80STORE) {
|
||||
if (!(softswitches & SS_HIRES)) {
|
||||
softswitches &= ~SS_HGRRD;
|
||||
base_hgrrd = apple_ii_64k[0];
|
||||
}
|
||||
} else {
|
||||
softswitches &= ~(SS_TEXTRD|SS_HGRRD);
|
||||
base_textrd = apple_ii_64k[0];
|
||||
base_hgrrd = apple_ii_64k[0];
|
||||
}
|
||||
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
GLUE_C_READ(iie_ramrd_aux)
|
||||
{
|
||||
if (softswitches & SS_RAMRD) {
|
||||
return 0x0; // TODO: no early return?
|
||||
}
|
||||
|
||||
softswitches |= SS_RAMRD;
|
||||
base_ramrd = apple_ii_64k[1];
|
||||
|
||||
if (softswitches & SS_80STORE) {
|
||||
if (!(softswitches & SS_HIRES)) {
|
||||
softswitches |= SS_HGRRD;
|
||||
base_hgrrd = apple_ii_64k[1];
|
||||
}
|
||||
} else {
|
||||
softswitches |= (SS_TEXTRD|SS_HGRRD);
|
||||
base_textrd = apple_ii_64k[1];
|
||||
base_hgrrd = apple_ii_64k[1];
|
||||
}
|
||||
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
GLUE_C_READ(iie_check_ramrd)
|
||||
{
|
||||
return (softswitches & SS_RAMRD) ? 0x80 : 0x00;
|
||||
}
|
||||
|
||||
GLUE_C_READ(iie_ramwrt_main)
|
||||
{
|
||||
if (!(softswitches & SS_RAMWRT)) {
|
||||
return 0x0; // TODO: no early return?
|
||||
}
|
||||
|
||||
softswitches &= ~SS_RAMWRT;
|
||||
base_ramwrt = apple_ii_64k[0];
|
||||
|
||||
if (softswitches & SS_80STORE) {
|
||||
if (!(softswitches & SS_HIRES)) {
|
||||
softswitches &= ~SS_HGRWRT;
|
||||
base_hgrwrt = apple_ii_64k[0];
|
||||
}
|
||||
} else {
|
||||
softswitches &= ~(SS_TEXTWRT|SS_HGRWRT);
|
||||
base_textwrt = apple_ii_64k[0];
|
||||
base_hgrwrt = apple_ii_64k[0];
|
||||
}
|
||||
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
GLUE_C_READ(iie_ramwrt_aux)
|
||||
{
|
||||
if (softswitches & SS_RAMWRT) {
|
||||
return 0x0; // TODO: no early return?
|
||||
}
|
||||
|
||||
softswitches |= SS_RAMWRT;
|
||||
base_ramwrt = apple_ii_64k[1];
|
||||
|
||||
if (softswitches & SS_80STORE) {
|
||||
if (!(softswitches & SS_HIRES)) {
|
||||
softswitches |= SS_HGRWRT;
|
||||
base_hgrwrt = apple_ii_64k[1];
|
||||
}
|
||||
} else {
|
||||
softswitches |= (SS_TEXTWRT|SS_HGRWRT);
|
||||
base_textwrt = apple_ii_64k[1];
|
||||
base_hgrwrt = apple_ii_64k[1];
|
||||
}
|
||||
|
||||
return 0x0;
|
||||
}
|
||||
|
||||
GLUE_C_READ(iie_check_ramwrt)
|
||||
{
|
||||
return (softswitches & SS_RAMWRT) ? 0x80 : 0x00;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user