Added DMA clear. Almost working!
This commit is contained in:
parent
ecb49409e7
commit
e3c18cdf4b
1 changed files with 64 additions and 0 deletions
64
src/main.c
64
src/main.c
|
@ -146,6 +146,63 @@
|
||||||
|
|
||||||
#include "a23d2.h"
|
#include "a23d2.h"
|
||||||
|
|
||||||
|
asm (
|
||||||
|
".text\n"
|
||||||
|
// " .cpu mosw65c02\n"
|
||||||
|
// "mos-insns-w65c02\n"
|
||||||
|
// "EF_MOS_ARCH_W65C02 \n"
|
||||||
|
".global dmaClear\n"
|
||||||
|
"dmaClear:\n"
|
||||||
|
"pha\n"
|
||||||
|
// "phx\n"
|
||||||
|
".byte $DA\n"
|
||||||
|
"php \n" // preserver interrupt state + c
|
||||||
|
"sei \n" // disable interrupts
|
||||||
|
"ldy 1 \n" // y = io_ctrl
|
||||||
|
//"phy \n" // save io_ctrl on stack
|
||||||
|
".byte $5A\n"
|
||||||
|
//"stz 1 \n" // map in the dma registers, where we can get them
|
||||||
|
".byte $64,$01 \n"
|
||||||
|
//"stz $DF00 \n" // clear dma control
|
||||||
|
".byte $9c,$00,$DF\n"
|
||||||
|
"ldy #$05 \n" // DMA_CTRL_ENABLE+DMA_CTRL_FILL
|
||||||
|
"sty $DF00 \n"
|
||||||
|
"ldy __rc8 \n" // Fill Color
|
||||||
|
"sty $DF01 \n" // Fill value
|
||||||
|
"sta $DF08 \n" // Addr Low
|
||||||
|
"stx $DF09 \n" // Addr Hi
|
||||||
|
"lda __rc2 \n" // Addr Bank
|
||||||
|
"sta $DF0A \n"
|
||||||
|
"lda __rc4 \n" // length low
|
||||||
|
"sta $DF0C \n"
|
||||||
|
"lda __rc5 \n" // length middle
|
||||||
|
"sta $DF0D \n"
|
||||||
|
"lda __rc6 \n" // length high
|
||||||
|
"sta $DF0E \n"
|
||||||
|
"lda #$80 \n" // DMA_CTRL_START
|
||||||
|
//"tsb $DF00 \n" // DMA_CTRL
|
||||||
|
".byte $0C,$00,$DF\n"
|
||||||
|
"wait: lda $DF01 \n" // DMA_STATUS
|
||||||
|
"bmi wait \n" // Wait for DMA
|
||||||
|
//"stz $DF00 \n" // DMA Off
|
||||||
|
".byte $9c,$00,$DF\n"
|
||||||
|
"nop \n"
|
||||||
|
"nop \n"
|
||||||
|
"nop \n" // wait
|
||||||
|
"nop \n"
|
||||||
|
"nop \n"
|
||||||
|
"nop \n"
|
||||||
|
"pla \n" // restore the io_ctrl
|
||||||
|
"sta 1 \n"
|
||||||
|
"plp \n"
|
||||||
|
// "plx\n"
|
||||||
|
".byte $FA\n"
|
||||||
|
"pla\n"
|
||||||
|
"rts \n"
|
||||||
|
);
|
||||||
|
|
||||||
|
void dmaClear(uint32_t address, uint32_t length, byte color);
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
typedef struct airplaneS {
|
typedef struct airplaneS {
|
||||||
|
@ -346,6 +403,7 @@ float collectZ = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// This flight model is basically the one from "Build Your Own Flight Sim
|
// This flight model is basically the one from "Build Your Own Flight Sim
|
||||||
// in C++" by Michael Radtke and Chris Lampton.
|
// in C++" by Michael Radtke and Chris Lampton.
|
||||||
void lightPlane(void) {
|
void lightPlane(void) {
|
||||||
|
@ -603,11 +661,17 @@ void runSimulation(void) {
|
||||||
_drawlist = DRAWLIST_P0;
|
_drawlist = DRAWLIST_P0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Erase old scene.
|
// Erase old scene.
|
||||||
bitmapSetColor(0);
|
bitmapSetColor(0);
|
||||||
_useColor = false;
|
_useColor = false;
|
||||||
//textPrint("a23d2Draw()\n");
|
//textPrint("a23d2Draw()\n");
|
||||||
a23d2Draw();
|
a23d2Draw();
|
||||||
|
#else
|
||||||
|
|
||||||
|
dmaClear(pageZero ? 0x6c000 : 0x58000, 0x12c00, 0);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
// Draw new scene.
|
// Draw new scene.
|
||||||
//textPrint("a23d2Render()\n");
|
//textPrint("a23d2Render()\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue