Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


chjmartin2 last won the day on February 28 2012

chjmartin2 had the most liked content!

Community Reputation

103 Excellent

About chjmartin2

  • Rank
  • Birthday 02/06/1978

Profile Information

  • Gender
  • Location

Recent Profile Visitors

7,287 profile views
  1. Here are some examples of the output from the latest "engine." The lowest left is the brute force result and the lower right is the gradient output result.
  2. Hi, As I am coming back to the Aquarius after a long hiatus, mostly due to the fact that MESS is providing a very good development tool, it will be even more so if @Pernod emulates @Bruce Abbott's Mini-Expander. With support for @jaybird3rd's Super Cart in MESS and with Matt Pilz's Aquarius Draw tool we now have a lot of tools at our disposal for the lowly Aquarius. Anyway, I went back and looked at a lot of the stuff I spent time on now more than a decade ago, and I am so thankful for everything that this forum has enabled me to learn. It forced me to learn Freebasic (a powerful development tool that compiles Window 10 compatible code and is pretty fast), forced me to learn a bit of Z80 assembly and therefore got me a lot closer to the processer, and forced me to learn a lot about image manipulation. My work on the Aquarius spawned a number of other cool bits here and there and some of that passion continues. Anyway, when I saw that even now some people use the BMP2AQ tool and thinking through all of the things I have learned since then, I have decided to modernize the tool, make a proper Windows GUI for it and have a myriad of use selectable options. In an ideal setup I would like to output files that can natively be pulled into Matt P's on-line editor for touch up and finalization. This project is going to take me quite some time. I will confess that I write really lazy code. I have never made an application that makes calls to Windows routines outside of the file open dialog box. I do not use proper subroutines. I overuse the goto statement. I write code in "FBLite" mode. I'm not even really sure exactly what a pointer is, except that it "points" to a memory location. In short, my code is an absolute jumbled mess - but it works. For this project my goal is to do everything right. Have a proper set of functions and sub-routines. Utilize the Windows GUI. Allow scalable windows. Pop-up dialogues for important tasks. A true "File, Options, About" menu bar. Good solid commented code, AND, for the first time I am going to try to use GITHub as a repository for the code and the project with version control. (That's another thing I am absolutely horrible at...) In order to step up my game, I need some advice from the small but passionate Aquarius community. (By the way, can you convince your Facebook Aquarius group friends to come hang out here, I don't have a Facebook, and I know the yahoo group used to be "the place" but it seems the FB group is the most active Aquarius users.) Anyway, here are the features that I plan to implement and would like feedback, feature set asks. I'll also post GUI mock ups, etc. Here are my preliminary design features that I would like to implement: Open Image Formats JPG PNG BMP GIF Preprocessing Brightness Contrast Red/Green/Blue (adjust RGB levels) Bit Reduction (reduce incoming bit-depth) Scale/Crop/Reposition (zoom in on a face for example) Scaling Nearest Neighbor (pixels!) Averaging (smooth downsample) HQX (for upscaling) Character Options Full Character Set 2x3 Bloxel Set 2x2 Bloxel Set Graphics Set (all non-alpha-numeric, symbolic characters) Gradient Set (blank, full, checkerboard, two stochastic chars) Processing Options Full Brute Force (Cycle through each 8x8 pixel block and determine lowest sum or squared differences of RGB values to every char/col combination) Character Averaging (Downscale Input Image to 40x24, take average color of target character set, match closest) Bloxel 2x3 Scale & Render (Downscale Input Image to 80x72 and use 2x3 bloxels) Bloxel 2x2 Scale & Render (Downscale Input Image to 80x48 and use 2x2 bloxels) Black and White (Convert to 1 bit image) Color & Character Two Pass (Choose Colors first, then characters) 60 Hz Flicker (Create two screens when flickers at 60 Hz, somewhat 320x192x136 color mode) Dither Enabled/Disabled Diffusion (Floyd-Steinburg, Atkinson, Jarvis, Stucki, Burkes, Sierra) Pattern (Small Checkerboard, Large Checkerboard, 2x3 Bloxel) Bayer (2x2, 4x4, 8x8) Output Options Basic Code Data Statements Uncompressed Basic Code Data Statements RLE .ASM Code .CAQ Output .BIN Output .JSON for use in Aquarius Draw In many ways this is a very ambitious project for me. I would like to contribute a better tool to help development and to improve the quality of images on the aquarius. In my next comment I will share a bit of a teaser showing how I have already improved on the image conversion algorithm used in the BMP2AQ and post a few examples of output using the Brute Force and Gradient methodologies mentioned above. Thanks, Chris
  3. So where is @Bruce Abbott, as I think he would be excited to see you work in developing Mame to support the Mini-expander! I know that I am. All this Aquarius activity has be itching to pull my Aquarius out - it is super small - I have to be able to find a way to get it on my desk.
  4. Yeah, so I have not used the stack at all in any of my programs and this is an application I want to get better at. I think I will try to create a 4x3 frame animation demo to see exactly how fast I can get it to run. 190 t-states is MUCH faster (like 60%) than my unrolled loop code.
  5. So help me with that because I am very interested in it. I don't know what stack blasting is, nor do I know how to auto-modify code. Is there somewhere I can read about it?
  6. I need to revisit BMP2AQ and see if I can do a better job with it. I have learned a lot since I wrote it. Discrete Cosine Transform instead of Brute force RGB distance. Anyway, love it!
  7. I would need to either implement an even higher order Sigma Delta Modulator (I tried, went unstable and/or gave me garbage output) or figure out how to get an even higher bit rate. I am at 123 KHz which is 29 t-states per sample. main: ld bc, 8191 ; (10) number of bytes of samples ld hl, $C000 ; (10) Memory Location to ROM Sample ld a, (hl) ; (7) load first sample set into A rlc b ; (8) set up b to be rotated, waste cycles replay: out ($fc), a ; (11) send out the sample ld de, 13312 ; (10) Load the border memory location (and waste cycles) rlca ; (4) rotate the PWM model left nop ; (4) waste cycles ; 29 out ($fc), a ; (11) send out the sample inc hl ; (6) Move up the Rom sample location rlca ; (4) rotate the PWM model left rrc b ; (8) unrotate b from previous rotate ; 29 out ($fc), a ; (11) send out the sample rlca ; (4) rotate the PWM model left ld (de),a ; (7) waste cycles ld (de),a ; (7) waste cycles ; 29 out ($fc), a ; (11) send out the sample rlca ; (4) rotate the PWM model left ld (de),a ; (7) change border color ld (de),a ; (7) waste cycles ; 29 out ($fc), a ; (11) send out the sample rlca ; (4) rotate the PWM model left jp skiplou ; (10) waste cycles skiplou: nop ; (4) waste cycles ; 29 out ($fc), a ; (11) send out the sample rlca ; (4) rotate the PWM model left ld d, (hl) ; (7) load next sample into d ld d, (hl) ; (7) waste cycles ; 29 out ($fc), a ; (11) send out the sample rlca ; (4) rotate the PWM model left dec bc ; (6) Reduce the byte counter rlc b ; (8) see if loop counter went negative ; 29 out ($fc), a ; (11) send out the sample ld a, d ; (4) next first sample set into A nop ; (4) waste cycles jp p, replay ; (10) do it again until we are done! ; 29 [/CODE] The above is my main player loop and it has to be exactly the same number of t-states between samples. I do have to waste some cycles in some steps and the cycle accuracy isn't SUPER important between 8k blocks when I switch banks. So it essentially reads a sample, sends it out (the last bit gets sent to the speaker port) and then rotates the bits to play the next bit. One way I know I could make the player faster would be to use a full byte per sample but then I would be wasting 7 bits of ROM storage per sample. I may do that just to show how high quality we could get. It would be 170 kHZ but only 6 seconds of audio for a full megabyte ROM. Again, my guess is that somebody who is really good with Z80 ASM could figure out how to reduce the t-states needed and still use every bit of ROM we have, but that person isn't me. Anyway, the 2nd order sigma delta modulator itself produces CD quality noise free audio at 384 kHZ. OUTPUT.wav This Wave file will play if your system supports direct output of 384 kHZ (mine does, and I have a pretty old PC now) and if you look at the file you will see that it only contains two output values either all the way on or all the way off. The challenge is that the out command itself takes 11 t-states which if it were only that instruction is 325 kHZ but we have to get the value in the accumulator first, so yeah, that's it for that.
  8. Any ZX Spectrum code should be a straightforward port to Aquarius. I think it would be fun to figure out how to use 1tracker to output to Aquarius. Now we need MAME to support the Bruce's SD Card reader and then we'd be able to make a general purpose tracker player, a la Aquarius Juke Box. Hmmmm.... I like this idea.
  9. Thanks - apparently the audio fidelity was good enough that the copyright filter picked it up on Youtube which I took as a compliment.
  10. Hi, I can't thank @Pernod enough for his work enhancing MAME to support bank switching. I have really had a lot of fun this weekend creating this new demo. It is not very different from the Portal demo but has some new features and better audio quality. I also have to thank Matt for writing Aquarius Draw because it really helped with graphics, although I am 90% sure I have found a bug. I even sent him a tip asking him to email me so I can explain, but it's ok, I was able to use the output regardless. Anyway, two big changes as well. The audio on this player is vastly superior to the audio on the portal demo, not only did I squeeze down the t-state between samples to 29 adding 20% speed clocking in at 123 kHz, I also implemented a 2nd order Sigma Delta Modulator. I tried to implement a 3rd order and a multi-stage but both of those had garbage output. I added "dancing Aquamen" but they do not really dance, you'll notice a bit of a pop when they move so I did not move them much. I believe that this is the best audio output quality that I will be able to achieve using the 1-bit DAC on the Aquarius. Thank you everyone here as this journey started for me on the forum and I didn't know a single line of assembler. I don't have my Aquarius set up at the moment, so I can't run it on real hardware. Video of Demo Here Here is the file if you want to run it yourself. BitPlay.zip I explored trying to put a text scroller and blinking lights but it had too much of an impact on the audio quality. I'll have to learn how to use the AY to do something like that. Not sure where to go next but I'll be doing something. Thanks, Chris
  11. Hi, It was funny as I went back and read about stuff I started now 10 years ago (wow @jaybird3rd it has been more than a decade) and realized how much more I know now, and then sad at how little I have progressed. I am super excited about having MAME, as it has really sped up my development cycle. I am working on a quick demo that I think everyone will find fun. Here is my question. It is really easy to update a section of a screen if you want to update the whole line, just set up HL, BC and DE, have your screen data labelled .db style and LDIR your way to success. Here is the rub, I am very cycle starved in my current program and I only want to update a SECTION of the screen and not the whole line. I have several THEORIES of the best way to do this using the fewest t-states but am frustrated because this is clearly a solved problem that SOMEBODY knows the best way. I have a "graphics" that is 4 characters wide by 6 characters tall with both colors and characters. The total graphic is 48 bytes. I have a few versions of it and want to use it to make an animation. So let's say I wanted to load it in the bottom left side of the screen. 12,930 is the starting memory position upper left and 13,133 is the ending memory position lower right. Color is 13,954 down to 14,157. Here are the methods I think I can use, but again feel like this something that somebody else has optimized and why reinvent the wheel. Anyway... I could: ld de, 12930 ; 10 t-states ld hl, IMAGECHARLINEONE ; 10 t-states ld bc, 4 ; 10 t-states LDIR ; 21, 21, 21, 15 t-states ld de, 12970 ld hl, IMAGECHARLINETWO ld bc, 4 LDIR ... It will be like 648 t-states - an eternity and then double it for the color. This just seems like an awfully inefficient way of doing it and doesn't PUSH, POP use IX/IY or anything else. My alternative is just: ld hl, 12930 ;10 t-states ld (hl), nn ;10 t-states inc hl ;11 t-states ld (hl), nn ;10 t-states inc hl ;11 t-states ld (hl),nn ;10 t-states inc hl ;11 t-states ld (hl),nn ;10 t-states ld hl, 12970 ... This would be 498 t-states, better than LDIR but still quite a bit but still again doubled for the color. Is this a solved problem and ideally I would have a more generic routine where I specify the upper left corner and point to the ROM location of the character/color data and it draws it to screen. Any thoughts would be appreciated. Sorry if it is a basic obvious question. Thanks, Chris
  12. Clearly I do not understand how the sound emulation works. At some point we would hit the limit of the sound card on the system. I know my sound card can play up to 384 Khz. I can't get near that anyway, only getting up to 120KHz and not feeling like I have the Z80 talent to do better than that, so merely an academic question clearly.
  13. Woot... Great news. What is the max audio rate output by the emulator? So if we are running audio at 100khz and it is working, if we were to up that to a higher rate, at what rate would we break the emulator?
  14. Yes, 8k of player data and the image, and then 1016k of audio data. It is exactly 82.489 seconds of audio and a bit rate of 100,899 or 12.32 kbytes per second.
  15. Hi, I haven't really had time or space to work on anything fun for the Aquarius in a really long time. Recently I saw there was a new emulator available and then I found out that @Pernod has been hard at work updating MAME to have better Aquarius support including Supercart I bankswitching compatibility. I couldn't contain my excitement! (I am not on Facebook, so sadly, can't share this work there but maybe somebody could cross post.) Anyway, with @jaybird3rd's and @Pernod's help I was able to update my Portal demo to be compatible with MAME 0.232. I am so excited because it completely works including a faithful reproduction of the 1 bit audio engine and border audio sensitive effect. The only odd result is that it seems to be going a bit too fast versus the hardware result, it isn't too off-putting but for sure there is something going on there. I remember on real hardware I had to count t-states and tweak the 1 bit sampling rate to get it just right, technically it is a 1 bit audio stream running at 100,889 HZ. I use a program on a PC to perform the 16 bit 100kHZ audio to 1 bit conversion using Sigma Delta Modulation and then have to t-state count to get a balanced audio output. Here is a Youtube video of the demo running on original hardware back in the day (I seem to remember being able to embed Youtube videos here but can't see how to do it, so I'll use a link): Portal Demo Version 2 Here is a Mame Direct Capture of the latest version of the Demo: Portal Demo Direct MAME Capture Finally here is the ROM itself for you to try on MAME 0.232. Important tip, grab the ROM set here. It goes into the MAME ROM directory. When you run MAME you get a menu and if all you have is Aquarius then you can select Available and it will show up when you have the ROM set correct. Then run it selecting Start Empty, and here is where I got tripped up, you have to hit SCROLL LOCK to enable the menu, then TAB and then go to File Manager, select the Cartridge port and then the .BIN file to run. I left those steps in the capture video in case you want to see visually what to do. PortalDemo.zip Future plans include creating a generic audio conversion tool for use that will allow output at various ROM sizes instead of just the full megabyte, conversion of my movie player to be compatible with MAME 0.232, and other things that I likely haven't thought of yet. I am excited to get back to doing some work on the Aquarius, which for now will have to be through emulation because having two young twin girls (both turned 3 in March) I just do not have the space for on-machine development. Words of encouragement certainly help with motivation. Thanks, Chris
  • Create New...