Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
h5n1xp authored Mar 28, 2019
1 parent 96ef285 commit 01df11a
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 42 deletions.
2 changes: 1 addition & 1 deletion Blitter.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ void blitter_execute(Chipset_t* chipset){
int octCode = (chipset->bltcon1 >> 2) & 7;
int length = chipset->bltsizv;
int inc1 = chipset->bltamod; // 4(dy - dx)
int D = (int16_t)chipset->bltapt; // start value of 4dy - 2dx
int D = (int16_t)chipset->bltapt;// start value of 4dy - 2dx
uint16_t* chipramW = internal.chipramW;

int planeAddr = chipset->bltcpt & 0x1FFFFE;//word address
Expand Down
95 changes: 78 additions & 17 deletions Chipset.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ int planeMask[]={

void ChipsetInit(){

internal.LOF = 0;
internal.chipramW =(uint16_t*)low16Meg;
chipset.deniseid = 15; //set DeniseID to OCS
chipset.dmaconr = 0;
Expand Down Expand Up @@ -1120,55 +1121,115 @@ uint8_t noReadB(void){
return 0;
}

uint8_t dmaconrB(){ // 0x1
uint8_t dmaconrBH(){
return chipset.dmaconr >> 8; // only read the top 8bits
}

uint8_t vposrB(){
uint8_t dmaconrBL(){
return chipset.dmaconr & 0xFF; // only read the bottom 8bits
}

uint8_t vposrBH(){
return chipset.vposr >> 8;
}

uint8_t vhposrB(){ // 0x3
return chipset.vhposr >> 8; //internal.vPos; //vPos is the equilivent to the top byte
uint8_t vposrBL(){
return chipset.vposr & 0xFF;
}

uint8_t joy0datB(){ // 0x5
uint8_t vhposrBH(){
return chipset.vhposr >> 8;
}

uint8_t vhposrBL(){
return chipset.vhposr & 0xFF;
}

uint8_t joy0datBH(){
return chipset.joy0dat >> 8; // only read the top 8bits
}

uint8_t joy1datB(){ // 0x6
uint8_t joy0datBL(){
return chipset.joy0dat & 0xFF; // only read the bottom 8bits
}

uint8_t joy1datBH(){
return chipset.joy1dat >> 8; // only read the top 8bits
}

uint8_t potgorB(){ // 0xB
uint8_t joy1datBL(){
return chipset.joy1dat & 0xFF; // only read the bottom 8bits
}

uint8_t potgorBH(){
return chipset.potinp >> 8; // only read the top 8bits
}

uint8_t intenarB(){ //0xE
uint8_t potgorBL(){ // 0xB
return chipset.potinp & 0xFF; // only read the bottom 8bits
}

uint8_t intenarBH(){ //0xE
return chipset.intenar >> 8;
}

uint8_t intreqrB(){ //0xE
uint8_t intenarBL(){ //0xE
return chipset.intenar & 0xFF;
}

uint8_t intreqrBH(){ //0xE
return chipset.intreqr >> 8;
}

uint8_t intreqrBL(){ //0xE
return chipset.intreqr & 0xFF;
}













uint8_t (*getChipReg8[])() = {
noReadB,
dmaconrB,
vposrB,
vhposrB,
noReadB,
joy0datB,
joy1datB,
dmaconrBH,
dmaconrBL,
vposrBH,
vposrBL,
vhposrBH,
vhposrBL,
noReadB,
noReadB,
joy0datBH,
joy0datBL,
joy1datBH,
joy1datBL,
noReadB,
noReadB,
noReadB,
noReadB,
noReadB,
noReadB,
noReadB,
noReadB,
potgorBH,
potgorBL,
noReadB,
noReadB,
potgorB,
noReadB,
noReadB,
intenarB,
intreqrB,
intenarBH,
intenarBL,
intreqrBH,
intreqrBL
};

uint32_t (*getChipReg32[])() = {
Expand Down
6 changes: 3 additions & 3 deletions DMA.c
Original file line number Diff line number Diff line change
Expand Up @@ -587,15 +587,15 @@ int lastFetchCycle;

void dma_execute(){

chipset.vposr = (internal.LOF | 0x1000) | internal.vPos >> 8; //0x1000 is for NTSC / 0x0000 is for PAL
chipset.vposr = (0x1000) | internal.vPos >> 8; //the internal.LOF might be needed, 0x1000 is for NTSC / 0x0000 is for PAL
chipset.vhposr = internal.vPos << 8;
chipset.vhposr |= internal.hPos;


SDL_AtomicSet(&cpuWait, 1);
if(chipset.bplcon0 & 0x8000){

lastFetchCycle = chipset.ddfstrt+160;
lastFetchCycle = chipset.ddfstrt+168;
//lastFetchCycle = chipset.ddfstop+4;

DMAHires[internal.hPos]();
Expand Down Expand Up @@ -667,7 +667,7 @@ void dma_execute(){
//VBL Time
if(internal.vPos > 0x106 ){ //0x106 is the propper ntsc vbl
internal.vPos = 0;

//chipset.vposr = (internal.LOF | 0x1000); //0x1000 is for NTSC / 0x0000 is for PAL

//Reset Copper.
putChipReg16[COPJMP1](0);
Expand Down
19 changes: 9 additions & 10 deletions Floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,14 @@ void floppyInsert(int drive){
//Only Vaild drives have an ID Mode == 0
return;
}
df[drive].pra |= 0x4;

if( (df[drive].pra & 0x4) == 0x4){
df[drive].pra &= 0xFB; // eject disk;
printf("Disk ejected from df%d:\n",drive);
}else{
df[drive].pra |= 0x04; // insert disk
printf("Disk inserted in df%d:\n",drive);
}

}

Expand All @@ -298,14 +304,6 @@ void floppySetState(){ //To be called when Writes to CIAB prb happen.
static uint8_t PRB;
static int count = 0;

/*
// No point doing anything if nothing has changed.
if(PRB == CIAB.prb){
PRB = CIAB.prb;
return;
}
*/

PRB = CIAB.prb;

switch (PRB & 0x78) {
Expand Down Expand Up @@ -351,6 +349,7 @@ void floppySetState(){ //To be called when Writes to CIAB prb happen.

// If no change in state just return
if(PRB == df[driveSelected].prb){
floppyState();
//printf("---\n");
return;
}
Expand Down Expand Up @@ -385,7 +384,7 @@ void floppySetState(){ //To be called when Writes to CIAB prb happen.

//Step head (don't step again if we've already stepped)
if( (PRB & 0x1) && !(df[driveSelected].prb & 0x1) ){
//printf("%04x - DF%d Click\n",count,driveSelected);
printf("%04x - DF%d Click\n",count,driveSelected);

if(PRB & 0x2){
df[driveSelected].cylinder -=1;
Expand Down
3 changes: 1 addition & 2 deletions Memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ unsigned int chipReadByte(unsigned int address){

//Chipregs
if(address>0xDFEFFF){
address = (address - 0xDFF000) >> 1;
//return ChipsetReadByte(&chipset, address);
address = (address - 0xDFF000);
debugChipAddress = address;
return getChipReg8[address]();
}
Expand Down
14 changes: 5 additions & 9 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ int main(int argc, char * argv[]) {
if(argc>1){
fd = open(argv[1],O_RDWR);
}else{
fd = open("/Users/Shared/uae/roms/Kick13.rom",O_RDONLY); //"/Users/Shared/uae/roms/Kick12.rom" "/Users/Shared/uae/roms/DiagROM" "/Users/Shared/uae/roms/Kick3.rom"
fd = open("/Users/Shared/uae/roms/Kick2.rom",O_RDONLY); //"/Users/Shared/uae/roms/Kick12.rom" "/Users/Shared/uae/roms/DiagROM" "/Users/Shared/uae/roms/Kick3.rom"
if(fd<1){
printf("Usage: zorro <kickstart.rom> <raw adf image>\n");
return 0;
Expand Down Expand Up @@ -108,15 +108,15 @@ int main(int argc, char * argv[]) {
//fd = open("/Users/Shared/uae/WORKBENCH/WB-1.3.adf",O_RDONLY);
//fd = open("/Users/Shared/uae/WORKBENCH/WB-2_05.ADF",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/Blitz2-1.ADF",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/Blitz2-1-2.ADF",O_RDONLY);
fd = open("/Users/Shared/uae/DosUae/Blitz2-1-2.ADF",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/DLXP4.ADF",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/DISK1.ADF",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/Fright Night.adf",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/JUGGLER.ADF",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/amiga_500a_Tutorial_Disk.ADF",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/CuAmiga15.adf",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/LEMM1.ADF",O_RDONLY);
fd =open("/Users/Shared/uae/ADF/Defender of the Crown (1986)(Mindscape)(Disk 1 of 2).adf",O_RDONLY);
//fd =open("/Users/Shared/uae/ADF/Defender of the Crown (1986)(Mindscape)(Disk 1 of 2).adf",O_RDONLY);
//fd = open("/Users/Shared/uae/ADF/AmigaTestKit.adf",O_RDONLY);
}

Expand Down Expand Up @@ -154,8 +154,8 @@ int main(int argc, char * argv[]) {
//fd = open("/Users/Shared/uae/DosUae/af025_1991_08_d025.adf",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/CuAmiga15.adf",O_RDONLY);
//fd = open("/Users/Shared/uae/WORKBENCH/EX-1_3.adf",O_RDONLY);
//fd = open("/Users/Shared/uae/DosUae/Blitz2-2.ADF",O_RDONLY);
fd =open("/Users/Shared/uae/ADF/Defender of the Crown (1986)(Mindscape)(Disk 2 of 2).adf",O_RDONLY);
fd = open("/Users/Shared/uae/DosUae/Blitz2-2.ADF",O_RDONLY);
//fd =open("/Users/Shared/uae/ADF/Defender of the Crown (1986)(Mindscape)(Disk 2 of 2).adf",O_RDONLY);
}


Expand Down Expand Up @@ -299,25 +299,21 @@ int main(int argc, char * argv[]) {

if(host.event.key.keysym.sym==SDLK_F1){
floppyInsert(0);
printf("Disk inserted in df0:\n");
break;
}

if(host.event.key.keysym.sym==SDLK_F2){
floppyInsert(1);
printf("Disk inserted in df1:\n");
break;
}

if(host.event.key.keysym.sym==SDLK_F3){
floppyInsert(2);
printf("Disk inserted in df2:\n");
break;
}

if(host.event.key.keysym.sym==SDLK_F4){
floppyInsert(3);
printf("Disk inserted in df3:\n");
break;
}

Expand Down

0 comments on commit 01df11a

Please sign in to comment.