97 lines
2.6 KiB
C
97 lines
2.6 KiB
C
/*
|
|
* Copyright (c) 2024 Scott Duensing, scott@kangaroopunch.com
|
|
*
|
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
* of this software and associated documentation files (the "Software"), to deal
|
|
* in the Software without restriction, including without limitation the rights
|
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
* copies of the Software, and to permit persons to whom the Software is
|
|
* furnished to do so, subject to the following conditions:
|
|
*
|
|
* The above copyright notice and this permission notice shall be included in
|
|
* all copies or substantial portions of the Software.
|
|
*
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
* SOFTWARE.
|
|
*/
|
|
|
|
|
|
#include "f256.h"
|
|
|
|
#include "kernel.c"
|
|
#include "dma.c"
|
|
#include "math.c"
|
|
#include "random.c"
|
|
#include "text.c"
|
|
#include "bitmap.c"
|
|
#include "tile.c"
|
|
#include "graphics.c"
|
|
#include "sprite.c"
|
|
#include "file.c"
|
|
|
|
|
|
void f256Init(void) {
|
|
// Swap I/O page 0 into bank 6. This is our normal state.
|
|
POKE(MMU_IO_CTRL, MMU_IO_PAGE_0);
|
|
|
|
POKE(VKY_MSTR_CTRL_0, 63); // Enable text and all graphics.
|
|
|
|
POKE(MMU_MEM_CTRL, 0xb3); // MLUT editing enabled, editing 3, 3 is active.
|
|
|
|
// Set all memory slots to be CPU memory.
|
|
POKE(MMU_MEM_BANK_0, 0);
|
|
POKE(MMU_MEM_BANK_1, 1);
|
|
POKE(MMU_MEM_BANK_2, 2);
|
|
POKE(MMU_MEM_BANK_3, 3);
|
|
POKE(MMU_MEM_BANK_4, 4);
|
|
POKE(MMU_MEM_BANK_5, 5);
|
|
//POKE(MMU_MEM_BANK_6, 6); // Don't use this - it's for the micro kernel.
|
|
//POKE(MMU_MEM_BANK_7, 7); // Don't use this - it's for the micro kernel.
|
|
|
|
kernelReset();
|
|
graphicsReset();
|
|
textReset();
|
|
bitmapReset();
|
|
tileReset();
|
|
spriteReset();
|
|
fileReset();
|
|
|
|
randomSeed(0); //***TODO*** Use clock or something.
|
|
}
|
|
|
|
|
|
byte FAR_PEEK(uint32_t address) {
|
|
byte block;
|
|
byte result;
|
|
|
|
SWAP_IO_SETUP();
|
|
|
|
block = address / EIGHTK;
|
|
address &= 0x1FFF; // Find offset into this block.
|
|
POKE(SWAP_SLOT, block);
|
|
result = PEEK(SWAP_ADDR + address);
|
|
|
|
SWAP_IO_SHUTDOWN();
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
|
|
void FAR_POKE(uint32_t address, byte value) {
|
|
byte block;
|
|
|
|
SWAP_IO_SETUP();
|
|
|
|
block = address / EIGHTK;
|
|
address &= 0x1FFF; // Find offset into this block.
|
|
POKE(SWAP_SLOT, block);
|
|
POKE(SWAP_ADDR + address, value);
|
|
|
|
SWAP_IO_SHUTDOWN();
|
|
}
|