Andreas Gustafsson's Blog

Monday, March 12, 2012

How a piece of cardboard can improve loading...

I guess I have to stop spamming my blog with so much posts, not even three years have passed since last time, but you will have to try to keep up! ;)

Let's start with the resolution to the ever-so-exciting question of what the code snippet in the last post about Z80 optimizing was:

The answer is the bumpmapper right at the start of this MSX demo!

And now on to other Z80-related stuff. I recently bought a ZX Sinclair +2A, and now I'm trying to finish a demo in time for the Forever party later this week.

I was having a bit of trouble with loading my stuff today though. The +2A doesn't have an external cassette port, so I load from the built in one using one of those crappy MP3-car-cassette adapters. However, it stopped working. After some experimentation I came up with this somewhat MacGyverish solution:



The central thing here is the piece of cardboard wedged down above the play button. It presses just enough on the button that the adapter makes contact with the tape head in the Spectrum, but not too much that the motor starts running (because then it would just stop loading entirely after a while). Empirical studies showed that three layers of cardboard was the sweet spot, two didn't press enough to give contact with the head while four made the motor start.
Sometimes you just got to love old hardware!

Labels: , , ,

Thursday, August 13, 2009

Z80 optimizing

It's funny how you can look at some code and think, yeah, that's as good as it gets, then suddenly you get a bright idea and realize that - no, it wasn't!
I am working on yet another little demo at the moment, on a system that uses the Z80 CPU (not saying any more than that at the moment! :))
For one of the effects, a single iteration of an unrolled loop looked like this:

exx ; 4
ld a,(bc) ; 7
inc bc ; 6
ld l,a ; 4
ld d,(hl) ; 7
ld a,(bc) ; 7
inc bc ; 6
ld l,a ; 4
ld a,(hl) ; 7
sla a ; 8
or d ; 4
exx ; 4
ld (de),a ; 7
inc de ; 6
---
81 T-STATES

That was my first, off-the-top-of-my-head implementation made a couple of days ago. I was convinced that it was possible to do much better, but I couldn't figure anything out.

Then yesterday I made some progress and came up with this, by swapping around some registers and realizing that in this case rlca worked just as well as sla a and saved 4 T-states:

exx ; 4
ld c,(hl) ; 7
inc hl ; 6
ld a,(bc) ; 7
ld d,a ; 4
ld c,(hl) ; 7
inc hl ; 6
ld a,(bc) ; 7
rlca ; 4
or d ; 4
exx ; 4
ld (de),a ; 7
inc de ; 6
---
73 T-STATES

I sat and stared at the solution for a quite long, and thought, yeah, that's optimized!
But today I discovered that by rearranging my data and using the nice ex de,hl instruction, there were cycles to be saved, and I ended up with this:

ld e,(hl) 7
inc hl ; 6
ld a,(de) ; 7
rlca ; 4
ld e,(hl) 7
inc hl ; 6
ex de,hl ; 4
or (hl) ; 7
ex de,hl ; 4
ld (bc),a ; 7
inc bc ; 6
---
65 T-STATES


So NOW it must be as optimized as possible, right? :)

Labels: ,

Thursday, January 01, 2009

2008 in retrospect

Yes, my blog has been woefully neglected the past year, so I better start this year a bit more productively with a look back at 2008.

Major things for me during 2008 was first of all that I added several nice items to my collection of old 80ies computers:

  • Commodore Plus/4

  • Commodore VIC-20

  • Philips NMS-8245 (MSX2)

  • Atari 130XE

  • Commodore 64 (old bread-bin model, I had a C64C before)


I also had a very productive year on the demoscene (after a bit slow start the first months), releasing more stuff than I have ever done any previous year:

  • 407566 - C64 onefile demo, released in April

  • Very Much Useless - Sega VMU demo, winner of mixed compo at LCP2008 in August

  • Pseudocode - C64 demo, 3rd in C64 compo at LCP2008 in August

  • 126b - VIC-20 intro, released in August

  • Ancient School - VIC-20 demo, winner of Sundown oldschool demo competition in September

  • Invasion of the big pixels - MSX1 demo, 2nd place at the Grep White demo competition in December


I'll be very pleased if I can keep the same tempo this year!

Labels:

Monday, August 06, 2007

BFP 2007

A week has passed since the Big Floppy People 2007 demo party, and I have forgotten to write about it!

It was a nice event, and I got to chat with some cool people like Archmage/Andromeda (who showed me stome stuff he was working on for the ASD-demo that won ASM07 this weekend), Zzap69 (a former Noice-member I never met before), Fix/TRSI (a fellow DTV owner who was kind enough to let us use his machine in the compo when mine didn't cooperate with the bigscreen projector) and many others. Best of all, I won the mixed demo competition with my DTV-demo, Uncharted Territory!

Labels: ,

Friday, July 27, 2007

Mad crunchtime!

I've been in completely insane coding crunch mode for almost two weeks now trying to finish my new DTV demo in time for Big Floppy People 2007

The amount of boring work that goes into linking everything together, making sure that parts cooperate nicely etc. is mind-boggling to say the least. I think I've spent about as many hours now just with putting the parts together as I have actually coding the ffects.

Well, now I'm ALMOST there, still some minor bugs, but I'm so damn tired of this that I think I will consider it ready now! :)
Anyway, here's a sneak preview of the intropicture from the demo:





Release should be now on saturday if everything works out!

Labels: ,

Monday, May 07, 2007

The C64DTV - a new "oldschool" demoscene platform?

The C64DTV and Hummer are cheap connect-to-TV-and-play toys. The cool thing is that the hardware implements a good approximation of the classic C64 and also extends it with new features like 256-color mode, 2Mb RAM and a blitter.
For democoders wanting to continue with oldschool productions but looking for new challenges, it is an interesting choice.
I have a background in C64 coding (haven't released anything since early nineties though) and I am excited by it!
Yesterday I released my first little DTV-demo "Hello DTV World".



The demo is very basic, the only DTV-specific things exploited is the 8bpp mode for the intro pic and the 256-color character mode used for the plasma,
but I still got a feel for the platform and what the possibilites are.
Compared to the C64 scene which is very mature and almost all technical tricks have been discovered, the DTV is still uncharted territory (however C64 legend Crossbow/Crest have been doing some DTV stuff, so perhaps he will shock the scene and release a demo exploiting every DTV-trick possible soon... :))

Anyway, I think that sceners that are looking for a new platform should give the DTV a thought.

Pros:
+ New platform (but with oldschool flavor!) with lots of technical tricks to be discovered.
+ Familiar coding environment for those with C64 experience.
+ Good development tools available.
+ Cheap.

Cons:
- Needs hardware modding.
- Production of new units has (to my knowledge) halted.
- Still depends on C64 peripherals (C64 diskdrivers are rather slow and low capacity, aswell as hard to aquire nowadays)
- No established scene yet.
- Uncompatible hardware versions (v1 NTSC lacks almost all the new features, v2 PAL has some blitter bug)

Labels: ,

Thursday, January 11, 2007

More 4k madness!

Yet another world first (I think) - music and 3D in a 4kb J2ME demo!

Check out 4th Dimension

Labels: ,

Monday, November 06, 2006

What you can do with 4096 bytes

Today I finished a little project I started yesterday - Proof of Concept 4k, a J2ME demo in 4kb (4096 bytes). Runs on all cellphones that supports MIDP2.0 and CLDC1.1.



I've also had to move my homepage, and quite a few files went missing in the move, I'll try to recover them as soon as possible.

On a completely unrelated note - I've been playing some Call of Duty 2 HQ matches on Clanbase together with some friends at work. For now we are 0-2, but we are looking to improve! :)

Labels: ,

Monday, August 14, 2006

Long time, no update

My poor blog has been subject to neglect for quite some time now, so I better change that.

I just had four weeks of great vacation, and besides going to the beach, fishing and playing basketball I went on a little roadtrip to Säve with my brother and some friends to check out some great street cars runing the quarter mile.
But ofcourse I still had time to do some hardcore coding. As usual I didn't work on any of the projects I originally had planned to, but instead started something completely different.

The result is World Record, a little demo for the Texas Instruments TI-83 graph calculator, featuring the largest scrolling grayscale picture ever!

Labels:

Sunday, September 18, 2005

Going pro and Podfather porting

I've mostly been working on a J2ME project that I'm considering trying to go commercial with. I've contacted a talented pixel artist regarding the graphics, so we'll see what comes out of it.

But sometimes you need a break and do something else, so I ported Hooy-Program's "Podfather" (the first ever iPod demo) to the GamePark32!

Screenshot:


Download:
Podfather for GP32

Labels:

Thursday, May 26, 2005

ProjectLCD released

ProjectLCD is released! Watch it and mail me your impressions, or leave a comment on pouet.net.

Labels:

Tuesday, April 12, 2005

ProjectLCD

Time for a quick update on what I'm currently working on:
At the moment my limited time for hobby coding is devoted to ProjectLCD (Project Lowest Common Denominator), the first J2ME scene demo intended to run on ANY Midp1.0 device, be it a cellphone, PDA etc.
I've got a couple of effects done, and even some nice little "design" backgrounds. Release date is unknown, and knowing my trackrecord when it comes to finishing stuff, it might be a while.

Labels: