From 03c7d3d5c93ba36f6e46c5ff6040eb43cb9d8659 Mon Sep 17 00:00:00 2001 From: Brian Hodgins Date: Wed, 9 Jan 2013 09:38:12 -0500 Subject: [PATCH] redbus: implementation of external bus functions --- include/redbus.h | 7 ++++--- lib/rpc8e/redbus.s | 41 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/include/redbus.h b/include/redbus.h index b24807e..aa84097 100644 --- a/include/redbus.h +++ b/include/redbus.h @@ -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. + diff --git a/lib/rpc8e/redbus.s b/lib/rpc8e/redbus.s index 4a6bc3a..2d24605 100644 --- a/lib/rpc8e/redbus.s +++ b/lib/rpc8e/redbus.s @@ -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 +