redbus: implementation of external bus functions

master
Brian Hodgins 12 years ago
parent d68fdf585b
commit 03c7d3d5c9

@ -2,11 +2,11 @@
void rb_enable(void);
void rb_disable(void);
void rb_disable_ext(void);
void __fastcall__ rb_set_window(void* address);
void __fastcall__ rb_set_window_ext(void* address);
void __fastcall__ rb_map_device(unsigned char id);
void rb_enable_ext(void);
// 0x00 Map device in Reg A to redbus window.
@ -31,3 +31,4 @@ void __fastcall__ rb_map_device(unsigned char id);
// 0x86 Get POR address to A
// 0xFF Output A register to MC logfile.

@ -1,6 +1,6 @@
.include "mmu.inc"
.export _rb_enable, _rb_disable, _rb_map_device, _rb_set_window
.export _rb_enable, _rb_disable, _rb_map_device, _rb_set_window, _rb_set_window_ext, _rb_disable_ext
.segment "CODE"
@ -53,3 +53,42 @@ _rb_map_device:
rts
;------------------------------------------
; void __fastcall__ rb_set_window_ext(void* address);
;------------------------------------------
_rb_set_window_ext:
;switch to native 16bit
clc
.byte $FB ; XCE
.byte $C2, $30 ; REP #$30
; init redstone external window:
;.byte $A9, $00, $03 ; LDA #$0300
.byte $EB ; XBA
stx $55
ora $55
.byte $EB ; XBA
mmu $03
;switch to emulated 8bit
.byte $E2, $30 ; SEP #$30
sec
.byte $FB ;XCE
rts
;------------------------------------------
; void __inline__ rb_enable_ext(void);
;------------------------------------------
_rb_enable_ext:
mmu $04
rts
;------------------------------------------
; void __inline__ rb_enable_ext(void);
;------------------------------------------
_rb_disable_ext:
mmu $84
rts

Loading…
Cancel
Save