Welcome, Guest. Please login or register.


Author Topic: Enterprise program: Bricky Prise (Read 7603 times)

Offline szipucsu

  • EP addict
  • *
  • Posts: 8167
  • Country: hu
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Firefox 49.0 Firefox 49.0
    • View Profile
    • Webnyelv.hu - Tanuljunk nyelveket!
Re: Enterprise program: Bricky Prise
« Reply #30 on: 2016.November.16. 23:50:37 »
újabb emu-s snapshotot légyszi :)
People who speak Hungarian here will be fined. :ds_icon_cheesygrin:
Unfortunately the snapshot didn't load in my PC either. But the other new snapshots did so far.
SOUND SOURCE 3,STYLE 16,LEFT 16,RIGHT 64,SYNC 2
SOUND SOURCE 2,STYLE 128,PITCH 25.2,SYNC 2
SOUND PITCH 25,SYNC 2
Videos

Offline IstvanV

  • EP addict
  • *
  • Posts: 4806
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 49.0 Firefox 49.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #31 on: 2016.November.17. 10:11:18 »
Unfortunately the snapshot didn't load in my PC either. But the other new snapshots did so far.

The snapshot was saved with ep128emu 2.0.10 (not beta; by the way, I wonder why "ep128emu-2.0.10_cmos-x86_64.tar.xz" is downloaded so much?). The snapshot format is compatible between different operating systems and CPU architectures, a snapshot saved on Linux should load on Windows, which I tested as well. You may be using an old (beta) version of the emulator, or it could be some Windows problem.

I like your ugly hack!

With  +-4 it seems more or less as difficult as the joystick controller.

The main difficulty is in finding free space for the mouse code, there does not seem to be any that I am sure it is really unused on the segments visible at the time when keyboard/joystick input is read. The hacked version temporarily pages in the system segment (FFh), and the new code is on a part of the EXOS stack that I hope is not used by Bricky Prise (but even that assumption might not be correct). Of course, code running in video RAM is much slower, and because the memory paging is changed, I disable interrupts, but this breaks digital sample playback which needs interrupts at a high frequency. There are also some other issues I did not debug yet.

Offline geco

  • Moderator
  • EP addict
  • *
  • Posts: 5457
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 45.0 Firefox 45.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #32 on: 2016.November.17. 10:15:29 »
I do not remember either where are empty areas in the memory, I think there should be just enough for mouse driver.

Offline gflorez

  • EP addict
  • *
  • Posts: 2703
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 49.0 Firefox 49.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #33 on: 2016.November.17. 10:59:56 »
Another free hint:

For an horizontal movement like of this bat, you only need the X movement, the first two nibbles that are read. Nothing happens if the third and fourth nibbles are not read, at the following cycle at the next frame the first and second nibbles will be X again. The Mouse or the EnterMice interface restarts every cycle. You only have to ensure that you leave the RTS signal high.

This way the routine last only a little more than half the total time, as you still have to read the button. Also you can process 1, 2 or none buttons if necessary.

Also you can easily fuse the Joystick reading routine with the mouse routine to gain space and time. I did it on the SWAP game modification.
« Last Edit: 2016.November.17. 11:03:29 by gflorez »

Offline IstvanV

  • EP addict
  • *
  • Posts: 4806
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 49.0 Firefox 49.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #34 on: 2016.November.17. 11:11:16 »
I do not remember either where are empty areas in the memory, I think there should be just enough for mouse driver.

Perhaps I can use the space of the decompress_m0 routine (2829h-2A04h) when it is not needed, it is 1DCh bytes, which is plenty enough. And when decompressing needs to be done, I temporarily copy the decompressor from the EXOS stack (is FFh:AC00-AFFFh really unused in Bricky Prise?), then the new code is copied back again. Also, the original drawing routine at 216Fh-21BDh can be overwritten with other code, since it will be moved to the place of the decompressor as well, with changes to support movement greater than +/- 2.

Offline geco

  • Moderator
  • EP addict
  • *
  • Posts: 5457
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 45.0 Firefox 45.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #35 on: 2016.November.17. 13:29:52 »
I can send you the sources, if you do not get heart attack when you see it :D

Offline endi

  • EP addict
  • *
  • Posts: 7305
  • Country: hu
  • grafikus, játékfejlesztõ, programozás, scifi, tudományok, vallás
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 54.0.2840.87 Chrome 54.0.2840.87
    • View Profile
    • Honlapom
Re: Enterprise program: Bricky Prise
« Reply #36 on: 2016.November.17. 15:54:44 »
nekem ez a snapshot se megy, és a futatható program se, kell hozzá valami rom-ot berakni?
Vigyázat! Szektás vagyok! :)

Offline geco

  • Moderator
  • EP addict
  • *
  • Posts: 5457
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 45.0 Firefox 45.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #37 on: 2016.November.17. 16:07:48 »
(original package, hopefully it is up to date)
I checked, this is the latest release, date of the program is 10.11.2016

Offline IstvanV

  • EP addict
  • *
  • Posts: 4806
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 49.0 Firefox 49.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #38 on: 2016.November.18. 12:01:12 »
I found and fixed some problems with the extras that use self-modifying code, there will be an updated version soon. I also made it possible to use the mouse to enter the name in the high scores, the only place where it does not work now is to start the game.

Offline gflorez

  • EP addict
  • *
  • Posts: 2703
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 49.0 Firefox 49.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #39 on: 2016.November.18. 12:30:54 »
The EnterMice "wired" buttons don't reflect their status if RTS is not moved. It is just because the Atmel chip converts the PS2  data to MSX protocol only when the RTS is triggered. On the Original Boxsoft interface the two buttons are really wired.

Try this.

Offline geco

  • Moderator
  • EP addict
  • *
  • Posts: 5457
  • Country: hu
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 45.0 Firefox 45.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #40 on: 2016.November.18. 13:29:54 »
I found and fixed some problems with the extras that use self-modifying code, there will be an updated version soon. I also made it possible to use the mouse to enter the name in the high scores, the only place where it does not work now is to start the game.
Was it in the original also, or just after mouse implementation?
Do not need you the source?

Offline IstvanV

  • EP addict
  • *
  • Posts: 4806
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 49.0 Firefox 49.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #41 on: 2016.November.18. 13:49:22 »
Was it in the original also, or just after mouse implementation?

It was not a problem in the original. I changed various bits of code that I was not aware of being modified from elsewhere in the program (mostly when the various extras are activated by the "?" bricks), so that caused crashes in the mouse enabled version. I fixed these where I found them, but I could still have missed some. The specific extras that I patched are the one that inverts movement direction (it writes into the input code), and another that allows the player to shoot the bricks (this modifies and calls the drawing code, where I also made changes). However, if there are no more bugs to be fixed, I think the source is not needed now.

The EnterMice "wired" buttons don't reflect their status if RTS is not moved. It is just because the Atmel chip converts the PS2  data to MSX protocol only when the RTS is triggered. On the Original Boxsoft interface the two buttons are really wired.

The reason why the current version of the game with my modifications cannot be started with the mouse is that this part of the game uses a separate routine for reading the input, while everywhere else the one at 1B00h is called, and I patched that. For the title screen, additional patching would be needed, but it also seems the digital music playback really slows down the code there, only a few Z80 instructions can be executed on a 4 MHz machine before another IRQ occurs. I wonder if this would cause problems with the timing or performance if I tried to add mouse input there.

By the way, in the EnterMice documentation, what does the standby time mean exactly?
Quote
Time from change state of RTS signal to issue data (nibble) for reading    25 μs
Standby time for the next reading (counting from data issue)    14 μs
Does it mean that there has to be at least 39 us (25 + 14) between RTS state changes, or 14 us (if the nibble data is ignored), or something else?

Offline IstvanV

  • EP addict
  • *
  • Posts: 4806
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 49.0 Firefox 49.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #42 on: 2016.November.18. 15:34:39 »
Another new change is that the mouse timing will be configured according to the speed of the machine (number of 1 kHz DAVE interrupts per video interrupt). This currently sets somewhat conservative timings because of the simple arithmetic used and all the rounding done in the direction of waiting more, but it is still better at 4 or 6 MHz than a version with hardcoded wait loops for some high frequency like 10 MHz, and in theory it works at up to 20 MHz. :)

Offline gflorez

  • EP addict
  • *
  • Posts: 2703
  • Country: es
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Firefox 49.0 Firefox 49.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #43 on: 2016.November.18. 19:11:09 »
By the way, in the EnterMice documentation, what does the standby time mean exactly?Does it mean that there has to be at least 39 us (25 + 14) between RTS state changes, or 14 us (if the nibble data is ignored), or something else?

Pear can answer it better, but you must think EnterMice like a car's engine.

-If no RTS signal, the interface stops to work.

-If found RTS but not sync, the interface is on Idle but at least the "wired" buttons are send.

-If RTS is in sync, the interface is running and the "wired" buttons, X and Y deltas, and all the other software buttons and wheel (if present), are send.
« Last Edit: 2016.November.18. 19:18:16 by gflorez »

Offline IstvanV

  • EP addict
  • *
  • Posts: 4806
  • OS:
  • Linux Linux
  • Browser:
  • Firefox 49.0 Firefox 49.0
    • View Profile
Re: Enterprise program: Bricky Prise
« Reply #44 on: 2016.November.18. 20:18:29 »
Updated mouse hack, it still needs more testing, but it works better:
* BRICKY.COM (1.53 kB. 18x6 - viewed 94 times.)
* BRICKY.PRG (76.79 kB - downloaded 92 times.)
* bricky_mouse.ep128s (110.92 kB - downloaded 68 times.)
* bricky_mouse.tap (993.5 kB - downloaded 68 times.)        (tape version for those with loading problems :razz:)

Source files:
* Bricky Prise.zip (70.68 kB - downloaded 75 times.)        (original package)
* bricky_patch.s (10.56 kB - downloaded 76 times.)
* decompress_m0.s (11.11 kB - downloaded 68 times.)
* bricky_patch.lua (3.24 kB - downloaded 70 times.)

How to create the patched version:
- unpack the .zip file
- compile bricky_patch.s (sjasm 0.39g6)
- run the Lua script in ep128emu (requires >= 128K configuration), the file I/O directory (Alt+F) should point to the location of all the source and program files
- BRICKY.COM and BRICKY.PRG are now patched with mouse support

Changes:
- fixed bugs that caused crashes in some extras, but there might still be more issues
- the mouse can be used to continue after "game over" and to enter your name in the high scores
- optimized mouse I/O, timings are configured according to the CPU speed (> 20 MHz is not supported), only one data byte is read during gameplay; this needs to be tested on a real machine