home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega Magazine 4
/
Mega_Magazine_04_1991___nl_Side_B.atr
/
rambanks.lzh
/
RAMBANKS.SRC
< prev
next >
Wrap
Text File
|
1988-09-01
|
2KB
|
152 lines
* ROUTINE TO CHECK RAM BANKS!
* (C)1991 DONE BY FRANKENSTEIN
* BITS WHICH COULD BE USER FOR
* EXTRA RAM BANK CONTROL:
* PORTA BIT0 - BIT7 (STICK0/1)
* PORTB BIT2
* BIT3
* BIT4 \ USED FOR 130XE AS
* BIT5 / CPU/ANTIC SELECT
* BIT6
* BIT7 (SELF TEST)
* MAX. OF 14 BITS
* THE PROGRAM USES TWO COUNTERS TO
* TEST ALL 14 BIT COMBINATIONS.
COUNTA EQU $F0 ; 0-255
COUNTB EQU $F1 ; 0-63
ORG $0601
* EXTRA BANK COUNTER
EXTRA EQU $0600
* TABLE CONTAINING THE EXISTING BANK
* CONTROL BITS (PORTA/B)
TA EQU $B000
TB EQU $B100
PORTA EQU $D300
PORTB EQU $D301
BRAM EQU $6000 ; BANK RAM
* SAVE NORMAL SETTINGS OF PORTA/B
LDA PORTA
STA NORA
LDA PORTB
STA NORB
* NORMAL SETTINGS = MAIN BANK
LDA #$AA ; MARK!
STA BRAM
* MARK EXTENDED BANKS!
LDA #0
STA COUNTA
STA COUNTB
MARKALL JSR DOMSK
LDA #$AA
STA BRAM
INC COUNTA
BNE MARKALL
INC COUNTB
LDA COUNTB
CMP #64
BNE MARKALL
* SELECT MAIN BANK
JSR MAINBNK
LDA #0
STA BRAM ; CLR MARK
* CHECK EXTRA RAM!
LDA #0
STA COUNTA
STA COUNTB
TAX
CHKALL JSR DOMSK
LDA BRAM
CMP #$AA
BNE SAME
* MARK FOUND => EXTRA BANK!
* SAVE THESE BITS!
LDA PORTA
STA TA,X
LDA PORTB
STA TB,X
LDA #0
STA BRAM ; CLR MARK
INX
BNE SAME
* MAX. 256 ENTRIES
* TABLE FULL! 256 EXTRA BANKS FOUND!
LDA #0
STA 710
JMP END
SAME INC COUNTA
BNE CHKALL
INC COUNTB
LDA COUNTB
CMP #64
BNE CHKALL
* !!IMPORTANT!! MAIN BANK SELECT!!
END STX EXTRA
JSR MAINBNK
RTS
* SUBROUTINES
* SET/RESET BITS
DOMSK LDA COUNTA
STA PORTA
LDA COUNTB
ASL
ASL
STA MASKB
LDA PORTB
AND #%00000011
ORA MASKB
STA PORTB
RTS
* MAIN BANK ON!
MAINBNK LDA NORA
STA PORTA
LDA NORB
STA PORTB
RTS
NORA DFB 0
NORB DFB 0
MASKB DFB 0¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯