Path: blob/master/BizHawk.Emulation.Cores/Consoles/Atari/2600/Mappers/scrom.asm
2 views
;;============================================================================1;;2;; SSSS tt lll lll3;; SS SS tt ll ll4;; SS tttttt eeee ll ll aaaa5;; SSSS tt ee ee ll ll aa6;; SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"7;; SS SS tt ee ll ll aa aa8;; SSSS ttt eeeee llll llll aaaaa9;;10;; Copyright (c) 1995-2012 by Bradford W. Mott, Stephen Anthony11;; and the Stella Team12;;13;; See the file "License.txt" for information on usage and redistribution of14;; this file, and for a DISCLAIMER OF ALL WARRANTIES.15;;16;; $Id: scrom.asm,v 1.3 2005-06-16 01:11:29 stephena Exp $17;;============================================================================18;;19;; This file contains a "dummy" Supercharger BIOS for Stella. It is based20;; on routines developed by Eckhard Stolberg.21;;22;;============================================================================2324processor 65022526VSYNC equ $0027VBLANK equ $0128WSYNC equ $0229COLUPF equ $0830COLUBK equ $0931CTRLPF equ $0a32PF0 equ $0d33PF1 equ $0e34PF2 equ $0f35RESP0 equ $1036RESP1 equ $1137AUDC0 equ $1538AUDF0 equ $1739AUDV0 equ $1940AUDV1 equ $1a41GRP0 equ $1b42GRP1 equ $1c43ENAM0 equ $1d44ENAM1 equ $1e45ENABL equ $1f46HMP0 equ $2047HMP1 equ $2148HMOVE equ $2a4950;;51;; Entry point for multi-load reading52;;53org $F8005455LDA $FA ; Grab the load number and store it in $80 where the56STA $80 ; emulator will grab it when it does the loading57JMP clrp7 ; Go clear page 7 of RAM bank 1 like the real SC5859;;60;; Entry point for initial load (invoked when the system is reset)61;;62org $F80A6364start SEI65CLD6667;;68;; Clear page zero routine for initial load (e.g., RAM and TIA registers)69;;70LDY #$0071LDX #$0072ilclr STY $00,X73INX74BNE ilclr7576JMP load7778;;79;; Clear page 7 of RAM bank 1 (used for stars in the real SC)80;;81clrp7 LDX #$0082LDA $F006,X83LDA $FFF884LDX #$0085mlclr3 LDA $F00086NOP87LDA $F700,X88DEX89BNE mlclr390JMP load9192;;93;; NOTE: The emulator does the actual reading of the new load when the94;; next instruction is accessed. The emulator expects the load number to95;; to be stored in location $80. As a side-effect the emulator sets $8096;; to contain the bank selection byte from the load's header and sets97;; $FE and $FF to contain the starting address from the load's header.98;;99load org $F850100101;;102;; Copy code into page zero to do the bank switching103;;104LDX #$03105copy LDY code,X106STY $FA,X107DEX108BPL copy109110;;111;; Clear some of the 2600's RAM and TIA registers like the real SC BIOS does112;;113LDY #$00114LDX #$28115mlclr1 STY $04,X116DEX117BPL mlclr1118119LDX #$1C120mlclr2 STY $81,X121DEX122BPL mlclr2123124;;125;; Display the "emulated" Supercharger loading progress bar126;;127;; Check if we should skip the loading progress bar128;; Note that the following code seems to never do a jump129;; However, the comparison value can be patched outside this code130;;131LDA #$FF132CMP #$00 ; patch this value to $FF outside ROM to do a jump133BNE startbars134JMP skipbars135136;; Otherwise we display them137startbars:138LDA #$00139STA GRP0140STA GRP1141STA ENAM0142STA ENAM1143STA ENABL144STA AUDV0145STA AUDV1146STA COLUPF147STA VBLANK148149LDA #$10150STA HMP1151STA WSYNC152LDX #$07153DEX154pos DEX155BNE pos156LDA #$00157STA HMP0158STA RESP0159STA RESP1160STA WSYNC161STA HMOVE162163LDA #%00000101164STA CTRLPF165LDA #$FF166STA PF0167STA PF1168STA PF2169STA $84170STA $85171LDA #$F0172STA $83173LDA #$74174STA COLUBK175LDA #$0C176STA AUDC0177LDA #$1F178STA AUDF0179STA $82180LDA #$07181STA AUDV0182a1183LDX #$08184LDY #$00185a2186STA WSYNC187DEY188BNE a2189STA WSYNC190STA WSYNC191LDA #$02192STA WSYNC193STA VSYNC194STA WSYNC195STA WSYNC196STA WSYNC197LDA #$00198STA VSYNC199DEX200BPL a2201ASL $83202ROR $84203ROL $85204LDA $83205STA PF0206LDA $84207STA PF1208LDA $85209STA PF2210LDX $82211DEX212STX $82213STX AUDF0214CPX #$0A215BNE a1216217LDA #%00000010218STA VBLANK219220LDX #$1C221LDY #$00222STY AUDV0223STY COLUBK224clear:225STY $81,x226DEX227BPL clear228skipbars:229230;;231;; Setup value to be stored in the bank switching control register232;;233LDX $80234CMP $F000,X235236;;237;; Initialize A, X, Y, and SP registers238;;239LDA #$9a ;; This is patched outside the ROM to a random value240LDX #$FF241LDY #$00242TXS243244;;245;; Execute the code to do bank switch and start running cartridge code246;;247JMP $FA248249code dc.b $cd, $f8, $ff ;; CMP $fff8250dc.b $4c ;; JMP $????251252253254