Author Topic: JavaCPC Desktop available as BETA!  (Read 60431 times)

0 Members and 1 Guest are viewing this topic.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #100 on: 20:55, 28 May 10 »
Grrrrrr this snp format makes me mad!
Recording works about 95% accurate...
Playback is about 89% accurate!

Grrrrrrrrrrr!
« Last Edit: 01:15, 29 May 10 by Devilmarkus »
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 390
Re: JavaCPC Desktop available as BETA!
« Reply #101 on: 03:27, 29 May 10 »
Grrrrrr this snp format makes me mad!
Recording works about 95% accurate...
Playback is about 89% accurate!

That's why I created the much more complex SNR format. Starts with a V3 snapshot and has various cycle level checks.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #102 on: 18:34, 30 May 10 »
That's why I created the much more complex SNR format. Starts with a V3 snapshot and has various cycle level checks.

Any docs about this format?
Would be cool to know how it works... ;)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 390
Re: JavaCPC Desktop available as BETA!
« Reply #103 on: 09:16, 02 June 10 »
Any docs about this format?
Would be cool to know how it works... ;)

Err... Not really complete. There is a document on the initial SNA Version 3 format here

And then the format is very similar to the SNP format but with some extras. I'll have to hunt for any documentation, or failing that analyse the source code to create it.

Here's the headers from WinAPE which define the SNA V3 format:

Code: [Select]
  { TODO: Save Disc Image names, active ROMs, CPC Plus Raster Int flag }
  { TODO: PS2 Mouse X/Y and Button states in SNR }

const
  HeaderSNA: String = 'MV - SNA';
  HeaderSNP: String = 'MV - SNP';
  HeaderSNR: String = 'RW - SNR';

  CRTC_FLAG_VSYNC_ACTIVE    = $01;
  CRTC_FLAG_HSYNC_ACTIVE    = $02;
  CRTC_FLAG_HDISP_INACTIVE  = $04;
  CRTC_FLAG_VDISP_INACTIVE  = $08;
  CRTC_FLAG_HTOT_REACHED    = $10;
  CRTC_FLAG_VTOT_REACHED    = $20;
  CRTC_FLAG_MAXIMUM_RASTER_COUNT_REACHED = $40;
  CRTC_FLAG_REG8_BLANKING   = $80;

  CRTC_FLAG_VTA_ACTIVE   = $100;
  CRTC_FLAG_WINAPE_ICSR  = $8000;

  SFormatInvalid: String = 'Snapshot format invalid';
 
type
  TSnapshotType = (SNA, SNR, SNP);

  TBankFlag = (c0, c4c7, cccf, d4d7, dcdf, e4e7, ecef, f4f7, fcff);
  TBankFlags = set of TBankFlag;

  TChunkFlag = ( cfROMs, cfDSCA, cfDSCB, cfBreaks, cfDataAreas );
  TChunkFlags = set of TChunkFlag;

  TSnapshotHeader = packed record
    SnapshotID: packed array[0..7] of char;
    pad0            : packed array[0..7] of char;

    Version: Byte;

    {Registers}
    REG_AF,REG_BC,REG_DE,REG_HL: word;
    REG_R,REG_I,REG_IFF0,REG_IFF1: byte;
    REG_IX,REG_IY,REG_SP,REG_PC: word;
    REG_IM: byte;
    REG_AF1,REG_BC1,REG_DE1,REG_HL1: word;

    GA_Pen: byte;
    GA_Inks: packed array[0..16] of byte;
    GA_ROM, GA_RAM: byte;

    CRTC_Reg: byte;
    CRTC_Regs: packed array [0..17] of byte;

    UpperRom: byte;

    PIO_A,PIO_B,PIO_C,PIO_Control: byte;

    PSG_Reg: byte;
    PSG_Regs: packed array[0..15] of byte;

    MemSize: word;

    CPCType: byte;

    InterruptNo: byte;                     // CPCEMU only
    MultiMode: packed array[0..5] of byte; // CPCEMU only

    // Version 3 only
    Empty1: packed array[$75..$9a] of byte;

    FDD_Fast: Boolean;
    FDD_Motor: Boolean;
    FDD_Cyl: packed array[0..3] of byte;

    Printer_Data: byte;

    Monitor_Line: SmallInt;

    CRTC_Type: byte;

    Empty3: packed array [$a5..$a8] of byte;

    CRTC_HCC: byte;

    Empty4: byte;

    CRTC_VCC: byte;
    CRTC_VLC: byte;
    CRTC_VTAC: byte;
    CRTC_HSYNC: byte;
    CRTC_VSYNC: byte;
    CRTC_Flags: word;

    GA_DelayCount: byte;
    GA_ScanCount: byte;
    Z80_IntStat: byte;
    Z80_ICSR: byte;

    DisablePlus: Boolean;
    PlusPPI: Boolean;
    Empty5: packed array [$b8..$df] of byte;

    EmulatorID: packed array [$e0..$ff] of char;
  end;

  TDMARegs = packed record
    Loop: Word;
    Addr: Word;
    Pause: Word;
    PreScale: byte;
  end;

  TPlusChunk = packed record
    SpriteData: packed array [0..$7ff] of byte;
    SpriteAtts: packed array [0..$7f] of byte;
    Palette: packed array [0..$3f] of byte;
    Regs: packed array [0..5] of byte;
    SecROM: Word;
    Analogue: packed array [$08..$0f] of byte;
    DMA: packed array [0..$f] of byte;
    DMARegs: packed array [0..2] of TDMARegs;
    GA_Last: byte;
    GA_UnLocked: byte;
    GA_Sequence: byte;
  end;

The SNR file can contain RIFF sections defining the Disk images and ROM   images active at the time of recording.
The SNR file ends with an SNR RIFF chunk (ID: 'SNR '). This contains all the keystrokes and timing information as well as Symbiface Mouse and RTC information. The following constants are used to define the ID's of these:

Code: [Select]
  { Mouse Bits for SNR recording }
  SNR_MOUSE = $80;
  SNR_MB    = $01;
  SNR_MX    = $60;
  SNR_MX_B  = $20;
  SNR_MX_W  = $40;
  SNR_MY    = $18;
  SNR_MY_B  = $08;
  SNR_MY_W  = $10;
  SNR_MW    = $06;
  SNR_MW_B  = $02;
  SNR_MW_W  = $04;

  { Real-Time Clock IDs }
  SNR_RTC   = $E0;
  SNR_MIN   = $E1;
  SNR_HR    = $E2;
  SNR_DAY   = $E3;
  SNR_MTH   = $E4;
  SNR_YR    = $E5;
  SNR_MIL   = $E6;

The actual SNR format is quite complicated due to limitations of the original SNP format and the work-arounds to get it accurate.  This is by no means complete, but I think it's something along the lines of:

Count (Byte) - Number of frames until next change or 00. If 00, then a further word is used to indicate the number of frames. For example:

05 = 5 frames.
00 01 02 = 513 frames.

After that number of frames has passed, the next byte is read (the block length specifier (BLS)). Bit 7 (and #80) determines if there is a synchronisation block. If this is set, the following data (bytes) are contained in the synch block:

+0: Least significant byte of current Z80 PC (Program Counter)
+1: Vertical Line Count of CRTC.
+2: Horizontal Character Count of CRTC.
+3: Least significant byte of the TotalCycles counter (always reset to zero at the start of the SNR file snapshot).

The following 7 bits of the BLS define the number of bytes that follow unless they are all 1 (ie. BLS and #7f == #7f). This has a special meaning, which is to repeat the same changes as the last frame.

Each byte following for (BLS and #7f bytes) represents either a key number or a Mouse or RTC update.

If the byte (call it CHG) is E0..FF it is treated as an RTC update. The number of following bytes is (CHG and #1F) + 1, so, if CHG is SNR_RTC (#E0) only the RTC second is updated (1 following byte), if CHG is SNR_DAY (#E4), the RTC second, minute, hour, day and day of week is updated. The Day of Week is the fourth byte and #07, the Day (1..31) is the same byte SHL 3 (div 8) .

If the CHG is #80 .. #df it is treated as a Mouse Update.
- If (CHG and SNR_MB) <> 0 the Mouse Button byte is read.
- If (CHG and SNR_MX) <> 0 the Mouse X position is updated (if (CHG and SNR_MX_W) then it's a word else a byte).
- If (CHG and SNR_MY) <> 0 the Mouse Y position is updated (if (CHG and SNR_MY_W) then it's a word else a byte).
- If (CHG and SNR_MW) <> 0 the Mouse Wheel position is updated. (if (CHG and SNR_MW_W) then it's a word else a byte).

...

And that's all there is to it. Really simple eh !

Cheers,
Richard

P.S. I would make a Wiki page about the SNR format from this post but I'm useless at Wiki code and I don't have much time. Anyone else feel free to do so.
« Last Edit: 09:18, 02 June 10 by Executioner »

Offline Executioner

  • Supporter
  • 6128 Plus
  • *
  • Posts: 783
  • Country: au
  • WinAPE Developer
    • WinAPE
  • Liked: 390
Re: JavaCPC Desktop available as BETA!
« Reply #104 on: 09:24, 02 June 10 »
If you're really astute, you may have noticed that the Mouse and RTC messages overlap. ie. If the SNR_MOUSE (#80), SNR_MX_W (#40) and SNR_MX_B (#20) were all set, then the value would be #E0..#FF. Fortunately, the Mouse X can only be either a Byte (SNR_MX_B) or a Word (SNR_MX_W) so this will never happen, but the SNR processing code MUST ALWAYS check for SNR_RTC first, then not process it as a Mouse change if this is the case.

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #105 on: 16:52, 20 June 10 »
Working on lightgun emulation:
http://cpc-live.com/lightgun

If someone could help me to improve that, please contact me.
It's done checking x,y RGB value, then comparing them to some further frames painted and if they are different and not black:
Fire!

But need more accuracy here...
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Online Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 14.726
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 2790
Re: JavaCPC Desktop available as BETA!
« Reply #106 on: 10:06, 21 June 10 »
But... how would this work?

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #107 on: 12:05, 21 June 10 »
The technic is quite simple:
When you trigger fire on lightgun:
Joy-Fire is send to CPC.
The screen turns black for about 1 frame.
Next frame a bright square is painted where a target has been.
When lightgun sensor detects this bright colour, it sends Joy-Fire and Joy-Down signal to CPC.
When your lightgun was over a 2nd target:
Bright square is removed in next frame and a 2nd is painted where the 2nd target has been.
When lightgun detects this frame now it sends Joy-Fire and Joy-Down signal to CPC.

Really simple technic in theory.
But not simple to handle (actually)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Online Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 14.726
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 2790
Re: JavaCPC Desktop available as BETA!
« Reply #108 on: 10:11, 22 June 10 »
No - you're explaining how the light gun works, but I knew this. What I'm asking is, how do you use it in an emulator? What's the use?

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #109 on: 10:32, 22 June 10 »
To play games which were designed for lightgun? ;)
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Cpcmaniaco

  • Supreme Wiki Contributor
  • CPC6128
  • ****
  • Posts: 159
  • Country: es
  • Liked: 37
Re: JavaCPC Desktop available as BETA!
« Reply #110 on: 12:52, 22 June 10 »
Only for Gunstick too.

Online Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 14.726
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 2790
Re: JavaCPC Desktop available as BETA!
« Reply #111 on: 09:59, 23 June 10 »
To play games which were designed for lightgun? ;)

Yes, but how?? You'd need a light gun. A CPC light gun or a PC one? And then, you'd need a CRT screen. So, I'm still a bit skeptical about the practical use of it!

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #112 on: 10:27, 23 June 10 »
Yes, but how?? You'd need a light gun. A CPC light gun or a PC one? And then, you'd need a CRT screen. So, I'm still a bit skeptical about the practical use of it!

Well in JavaCPC the lightgun is replaced by a crossfade mouse cursor. You can use your mouse to aim and shoot. That's it.

In theoretical the lightgun should also work on a CRT screen!
It uses a light sensor to detect targets.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Online Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 14.726
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 2790
Re: JavaCPC Desktop available as BETA!
« Reply #113 on: 16:22, 23 June 10 »
Ah! So you use the mouse. Ok then, now it's clear, though it'll make light gun games extremely easy I guess??

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #114 on: 16:41, 23 June 10 »
Well, yes.
But it's easier to install Windows XP on a CPC 464...
This has all drivers (incl. lightgun plug & pray)


« Last Edit: 09:30, 06 July 10 by Devilmarkus »
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Bryce

  • The Hardware Guy.
  • Supporter
  • 6128 Plus
  • *
  • Posts: 10.521
  • Country: wf
  • It's not broken, it just hasn't been fixed yet.
    • index.php?action=treasury
  • Liked: 3640
Re: JavaCPC Desktop available as BETA!
« Reply #115 on: 17:17, 23 June 10 »
The drivers are on Cassettes 241 to 318 as far as I recall :D

Bryce.

Offline arnoldemu

  • Supporter
  • 6128 Plus
  • *
  • Posts: 5.331
  • Country: gb
    • Unofficial Amstrad WWW Resource
  • Liked: 2238
Re: JavaCPC Desktop available as BETA!
« Reply #116 on: 17:47, 23 June 10 »
The drivers are on Cassettes 241 to 318 as far as I recall :D

Bryce.
Please upload cassette 400 I am missing that one ;)
My games. My Games
My website with coding examples: Unofficial Amstrad WWW Resource

Offline Leonie

  • CPC6128
  • ****
  • Posts: 232
  • Country: de
  • Liked: 0
Re: JavaCPC Desktop available as BETA!
« Reply #117 on: 19:54, 23 June 10 »
Please upload cassette 400 I am missing that one ;)

Just play cassette 200 with Double-Speed backwards.
The resulting data is the same as on cassette 400.
 
 
 

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #118 on: 12:58, 26 June 10 »

Just play cassette 200 with Double-Speed backwards.
The resulting data is the same as on cassette 400.

Good idea!

In co-operation with Loic Daneels I added command-line arguments.
This will be the syntax:

Code: [Select]
Possible arguments:
-amsdos <yes/no>
-autotype <"text">
-boot <drive>
-cpctype <cpctype>
-crtc <1 or 0>
-desktop <yes/no>
-drivea <"file">
-driveb <"file">
-tape <"file">

Example for Windows:
JavaCPC.exe -desktop yes -cpctype SYMBOS -drivea "SymbOS.DSK" -driveb "Sym-Apps.DSK" -autotype "|SYM" -amsdos yes
Example for other OS:
java -jar JavaCPC.jar -desktop no -cpctype SYMBOS -drivea "G:\CPC\SymbOS.DSK" -driveb "G:\CPC\Sym-Apps.DSK" -autotype "|SYM" -amsdos yes

Valid cpctypes:
CPC464        CPC464
CPC664        CPC664
CPC6128        CPC6128
SYMBOS        CPC6128 with SymbOS
FUTUREOS    CPC6128 with Future OS
KCCOMPACT    KC COMPACT
CPC464PARA    CPC464 with PARADOS rom
PARADOS        CPC6128 with PARADOS rom
CPC6128fr    CPC6128 with french roms
CPC6128es    CPC6128 with spanish roms
COMCPC        ;-)

Example for "-boot" argument:
-boot df0
-boot tape

If someone is interested in testing this, please contact me for new beta version...
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #119 on: 21:10, 28 June 10 »
Latest beta is here:
http://retropower.eu/cpc/download.php?type=-emu&fichier=2010_06_28_JavaCPC_Desktop_BETA.zip

Much fun with it!
(Tested under Windows and Mac OS!)
Windows 7 user must run it with administrator rights! 32bit Java is appreciated.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Online Gryzor

  • Administrator
  • 6128 Plus
  • *****
  • Posts: 14.726
  • Country: gr
  • CPC-Wiki maintainer
    • CPCWiki
  • Liked: 2790
Re: JavaCPC Desktop available as BETA!
« Reply #120 on: 12:24, 29 June 10 »
It managed to crash my work PC this morning :D Tho it's probably not its fault but the PC's or Java's...

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #121 on: 15:44, 30 June 10 »
So you can be happy that it causes serious crashes to your PC ;)

Check here for updates:
http://retropower.eu/cpc/index.php?dir=-emu

You will see my updated zips on top.
Check the creation date and so you can always try the latest beta.
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #122 on: 19:30, 05 July 10 »
Working on an "Effectmixer" for JavaCPC-Paint.
It will help you to get the best possible results from converting a photo or an image to CPC.

Example:
Not optimized:


The Effectmixer in action:


Optimized result:
 
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #123 on: 22:40, 05 July 10 »
Demonstration:
[youtube=9I1fdpej2SM]demo[/youtube]
« Last Edit: 14:46, 06 July 10 by Devilmarkus »
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release

Offline Devilmarkus

  • Vivid source of indefiniteness
  • 6128 Plus
  • ******
  • Posts: 4.039
  • Country: de
  • WebCPC / JavaCPC developer
    • index.php?action=treasury
    • CPC-Live website
  • Liked: 1007
Re: JavaCPC Desktop available as BETA!
« Reply #124 on: 12:31, 07 July 10 »
Best: Combine the filters + use the MovieMaker:
[youtube=Vv1DG1TN1eg]video[/youtube]
When you put your ear on a hot stove, you can smell how stupid you are ...

Amstrad CPC games in your webbrowser

JavaCPC Desktop Full Release