English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Language > Coders. C/C++

 
 
Thread Tools
Old 15 August 2017, 17:37   #181
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
i made some checks of data read in from within the source:
Code:
char Disk2_rom[] =
		"\xA2\x20\xA0\x00\xA2\x03\x86\x3C\x8A\x0A\x24\x3C\xF0\x10\x05\x3C"
....
;

void DiskLoadRom(LPBYTE pCxRomPeripheral, UINT uSlot)
{
	const UINT DISK2_FW_SIZE = 256;

BYTE* pData = (BYTE*) Disk2_rom;	// NB. Don't need to unlock resource


memcpy(pCxRomPeripheral + uSlot*256, pData, DISK2_FW_SIZE);

    int i;
    printf ("Disk2_rom: pdata\n");
	for( i = 0; i < DISK2_FW_SIZE; i++ ){
  	printf (" %02x", pData[i]);
    }

    printf ("\n\nDisk2_rom: pCxRomPeripheral\n");
	for( i = 0; i < DISK2_FW_SIZE; i++ ){
  	printf (" %02x", (pCxRomPeripheral  + uSlot*256)[i]);
    }
    printf ("\n\n");

	//

	RegisterIoHandler(uSlot, Disk_IORead, Disk_IOWrite, NULL, NULL, NULL, NULL);
}
result in shell output:
Code:
Disk2_rom: pdata
 a2 20 a0 00 a2 03 86 3c 8a 0a 24 3c f0 10 05 ...
...
Disk2_rom: pCxRomPeripheral
 a2 20 a0 00 a2 03 86 3c 8a 0a 24 3c f0 10 05 ...
is this a proof, the byte order thing is ok ?

#1) i did add SDL_BIG_ENDIAN to the preprocessor,
it's a condition in soundcore.cpp and stretch.cpp
Intel vs PPC, but it does not have an impact as of yet.
thats the only occurance of "endian" thing in the whole source.
^^ removed since it was already set in sdl include files.


zoned: updated AmiApple-WIP.lha

Last edited by emufan; 15 August 2017 at 19:28.
emufan is offline  
Old 15 August 2017, 18:01   #182
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 4,249
doesn't prove anything, you just copied an array of bytes and print them. maybe endianness isn't used at all: you can code everything endian agnostic in an emulator.
jotd is online now  
Old 15 August 2017, 18:09   #183
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
Quote:
Originally Posted by jotd View Post
doesn't prove anything, you just copied an array of bytes and print them. maybe endianness isn't used at all: you can code everything endian agnostic in an emulator.
this output is created in a fucntion, i've added the missing parts above, which is called elsewhere in the source.
still no proof?
Code:
Memory.cpp:     DiskLoadRom(pCxRomPeripheral, 6);   // $C600 : Disk][ f/w
zoned: AmiApple-WIP-src_AmiDevCpp.zip
maybe someone can check what is wrong?
maybe it is related to the SDLError: passed a NULL mutex.
noixemul_off.dev is recent project file

alkis, Nova?

Last edited by emufan; 15 August 2017 at 19:24.
emufan is offline  
Old 15 August 2017, 19:32   #184
matthey
Banned
 
Join Date: Jan 2010
Location: Kansas
Posts: 1,284
Quote:
Originally Posted by emufan View Post
result in shell output:
Code:
Disk2_rom: pdata
 a2 20 a0 00 a2 03 86 3c 8a 0a 24 3c f0 10 05 ...
...
Disk2_rom: pCxRomPeripheral
 a2 20 a0 00 a2 03 86 3c 8a 0a 24 3c f0 10 05 ...
is this a proof, the byte order thing is ok ?
Your test shows that the Disk2_rom array endianess did not change by the memcpy(). It is possible for static data to be stored in little endian order but this is unlikely for the ROM of an 8 bit CPU which is likely to be accessed a byte at a time anyway (big and little endian order is the same for byte address accesses). Data read from Disk2_rom pCxRomPeripheral could be endian swapped somewhere in other code but it looks like the pointers are byte pointers which should be ok as long as there are no casts. Any endian swapping of this data should probably be removed. Look for __builtin_bswapxx() or SDL_SWAPxx() but many older programs roll their own. The main reason for accessing data in larger widths than a byte is to improve performance so it may be more likely to occur around display code for an 8 bit emulator.
matthey is offline  
Old 15 August 2017, 19:44   #185
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
thanks for explaining. there are no such swap functions or calls.
maybe we are digging in the wrong pit, could be something endian unrelated after all.
emufan is offline  
Old 16 August 2017, 01:42   #186
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,810
If I get time I'll check the source code archive you uploaded and see if I can help...
NovaCoder is offline  
Old 16 August 2017, 01:49   #187
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 521
One could easily say we are reaching the end for a successful port The apple is right there at visual sight distance, we just need to be able to figure out how to stretch our arm and grab it.
xboxown is offline  
Old 16 August 2017, 02:35   #188
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
Quote:
Originally Posted by NovaCoder View Post
If I get time I'll check the source code archive you uploaded and see if I can help...
thats cool, thanks
Quote:
Originally Posted by xboxown View Post
One could easily say we are reaching the end for a successful port The apple is right there at visual sight distance, we just need to be able to figure out how to stretch our arm and grab it.
yes, just a littlebit left. I hope we find the issue.
emufan is offline  
Old 16 August 2017, 03:44   #189
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 521
Quote:
Originally Posted by emufan View Post
thats cool, thanks

yes, just a littlebit left. I hope we find the issue.
emufan please forgive me for asking this one request..please please please....but...when this project is finished...is it possible you can tackle kegs32 and have that port to Amiga 68k? This way we can port two of the best Apple //gs and Apple // emulator in history. I don't care for kegs32 being able to run apple // mode seeing as this little baby will do it even better . But the current kegs I have made arczi port (if he is reading this, thanks man) have issues with mouse interaction and the emulator....the mouse pointer in the emulator doesn't synch with the Amiga mouse and jumps like 10 steps to the left, right or up when I move the mouse around in my Amiga making it impossible to click or interact with the interface. This issue is also in the windows version...I was using a very buggy emulator to have it port it. But if we can port kegs32 A) we get a windows interface to add disks, remove disks, etc and B) have proper mouse interaction into the interface of kegs.

What do you think? This is just a suggestion you could easily say no and I understand 100%.
xboxown is offline  
Old 16 August 2017, 06:53   #190
NovaCoder
Registered User
NovaCoder's Avatar
 
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 3,810
Quote:
Originally Posted by emufan View Post
thats cool, thanks

yes, just a littlebit left. I hope we find the issue.

This code is not very well written

It will be hard to get this running on 68K as it doesn't do proper error handling and includes lots of Unix OS function calls which won't work well on Amiga 68K.

For my old Amiga ports I'd normally replace all the Unix calls with Amiga OS functions.


Looking at the nasty Timer code I think it would be better to just remove the entire Timer.cpp file from the project and replace the Timer.h with this:

Code:
#pragma once

static inline void SysClk_WaitTimer() {}
static inline bool SysClk_InitTimer() { return true; }
static inline void SysClk_UninitTimer() {}
static inline void SysClk_StartTimerUsec(DWORD dwUsecPeriod) {}
static inline void SysClk_StopTimer() {}
NovaCoder is offline  
Old 16 August 2017, 12:58   #191
Marlon_
AmigaDev.com

Marlon_'s Avatar
 
Join Date: Mar 2016
Location: Sundsvall, Sweden
Age: 31
Posts: 609
Quote:
Originally Posted by NovaCoder View Post
This code is not very well written
Yeah, I've stated this earlier in the thread and I'm surprised they've gotten this far even though the code is an absolute mess.
Marlon_ is online now  
Old 16 August 2017, 20:53   #192
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
@xboxown: of course i would try, but depends on result of AmiApple

Quote:
Originally Posted by Marlon_ View Post
Yeah, I've stated this earlier in the thread and I'm surprised they've gotten this far even though the code is an absolute mess.
there were other things judged as impossible, so why not this one too

and there is a OS4 port by drHirudo, we still wait for the source, which would make things easier.
Quote:
Originally Posted by NovaCoder View Post
Looking at the nasty Timer code I think it would be better to just remove the entire Timer.cpp file from the project and replace the Timer.h with this:
I did so, not much changed, but now, after starting the emulation (F2) it seems not to crash.
it reacts to input F3, etc, choose another disk, and u can exit the emulator with
the close button.
i've tested with ixemul v48 ( was using v63 ) does not make any difference.

since using ixemul.library, using shift-F2 - doing a full emu reset, it gives a ixemul, error,
before it loads the apple rom - something in memory.cpp

zoned: AmiApple-Wip.lha (updated)

Last edited by emufan; 16 August 2017 at 21:00.
emufan is offline  
Old 16 August 2017, 22:08   #193
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 521
drHirudo PLEASE have mercy on us and release the source code!! Please be merciful and release the code! At least email it privately to emufan so that he can look at it and do the modification!
DRHIRUDO! PLEASE help us!!!
xboxown is offline  
Old 16 August 2017, 22:13   #194
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
#0) btw. it does use valid dsk files only
if you choose a .bmp it says not recognized format.

#1)
i added some printf, just to see where it does idle.
it does loop after F2 , entering MODE_RUNNING
Code:
while ((g_nAppMode == MODE_RUNNING) || (g_nAppMode == MODE_STEPPING))
{
            printf("Applewin: g_nAppMode == MODE_RUNNING \n");
		if(SDL_PollEvent(&event)) {
            printf("Applewin: if(SDL_PollEvent(&event) \n");
		if(event.type == SDL_QUIT && event.key.keysym.sym != SDLK_F4) return;
		FrameDispatchMessage(&event);
		printf("Applewin: FrameDispatchMessage(&event) \n");
}
in the shell:
Code:
...
Applewin: g_nAppMode == MODE_RUNNING 
Applewin: if(SDL_PollEvent(&event) 
Applewin: FrameDispatchMessage(&event) 
Applewin: g_nAppMode == MODE_RUNNING 
Applewin: if(SDL_PollEvent(&event) 
Applewin: FrameDispatchMessage(&event) 
...
what event does it waiting for?

#2) hmm:
Code:
Applewin.cpp:   SDL_Event event;
DiskChoose.cpp: SDL_Event event;        // event
DiskFTP.cpp:            SDL_Event event;        // event
DiskFTP.cpp:    SDL_Event event;        // event
Frame.cpp:         SDL_Event event;     // event
i'll have a look into it.

#3)
Code:
DiskChoose.cpp:                         SDL_PollEvent(&event);
DiskFTP.cpp:                                    SDL_PollEvent(&event);
DiskFTP.cpp:                            SDL_PollEvent(&event);
Frame.cpp:                 SDL_PollEvent(&event);
these poll event do work, F3 for example exit the loop and you get the DiskChooser event.

i still need to check, what it actually does, entering the F2 Mode_Running.

#4) updated AmiApple-WIP.lha (alot debug shell output)

Last edited by emufan; 16 August 2017 at 22:48.
emufan is offline  
Old 16 August 2017, 23:02   #195
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 521
emufan I salute you! You are the only one who is actually going out of your way and making this work when all odds are against you! Thank you! Thank you for everything! I swear ones you get it working I want to donate to you for your time and effort! You deserve all the credit for your effort, thank you!

Also thank you for not quitting and giving up when the odds are pushing you to quit and give up.
xboxown is offline  
Old 16 August 2017, 23:39   #196
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
there is good help from the ppl arround, and a bit of motivation is good too

i'm stuck now with not knowing what it does when entering the emulation mode (MODE_RUNNING).
I cannot find a link to starting apple code, or the emulated apple cpu.

it goes into a main loop checking keyinputs, but where is the start of the apple stuff ?!
and i'm not able to find the issue with the weird chars vs black screen when using F2, *sigh*

#1) added some more printf. something emulation related is working already:
CpuReset(), CpuIrqReset(), CpuNmireset(), CpuInitialize()

#2) main loop in Applewin.cpp: void ContinueExecution()

#3) thats a bit strange - maybe nothing:
Code:
Memory.cpp:     const UINT Apple2RomSize = 12*1024;
Memory.cpp:     const UINT Apple2eRomSize = Apple2RomSize+CxRomSize;
those downloaded from website were 20kb or 32kb size, so 12*1024 doesnt fit that size. *hmmm*

Last edited by emufan; 17 August 2017 at 01:02.
emufan is offline  
Old 17 August 2017, 00:58   #197
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 521
That is good right, right??!
xboxown is offline  
Old 17 August 2017, 01:07   #198
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
Quote:
Originally Posted by xboxown View Post
That is good right, right??!
at least something to look at. we still get that weird chars when starting the emulation,
maybe it is related to the ROMs provided within the src code.

zone updated: AmiApple-WIP.lha

Last edited by emufan; 17 August 2017 at 01:19.
emufan is offline  
Old 17 August 2017, 01:13   #199
xboxown
Registered User
 
Join Date: Dec 2012
Location: Vancouver/Canada
Posts: 521
How hard is it to allow the program to add ROM from the apple2e.rom file in the hard drive?
xboxown is offline  
Old 17 August 2017, 01:18   #200
emufan
Registered User
 
Join Date: Feb 2012
Location: #DrainTheSwamp
Posts: 4,545
Quote:
Originally Posted by xboxown View Post
How hard is it to allow the program to add ROM from the apple2e.rom file in the hard drive?
there is still some unused code left in the source, loading ROMs from files.
dunno if it's worth enabling it.

#1) wincompat.h does those type definitions: are those defintions valid for 68k Amiga OS?
attached wincompat.h.
Attached Files
File Type: txt wincompat.h.txt (6.4 KB, 17 views)
emufan is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Porting SDL2 to Amiga copse request.Other 3 30 November 2017 17:46
Porting an Amiga game to PC CYBER_SLUNK Coders. General 4 31 January 2017 19:14
Porting Photoshop to Amiga KONEY Coders. General 25 29 December 2016 23:49
Porting PhotoChrome ST/e to Amiga. pandy71 request.Other 0 09 February 2015 15:12
Porting Qt Framework to Amiga OS enviroments Pyromania Coders. General 2 24 July 2013 06:42

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:28.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.13474 seconds with 16 queries