YakYak

Llamasoft baanter and moosings - It's like Deliverance with Sheep
It is currently Wed Sep 08, 2010 1:59 am 0

All times are UTC




Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Speccy programming in the 21st Century!
PostPosted: Sat Jan 30, 2010 8:18 pm 0 
Baaaaaaa!
Baaaaaaa!
User avatar

Joined: Fri Dec 17, 2004 1:53 pm 0
Posts: 6866
Hello!

I would like to try and make something that would run on a real Spectrum +2 128k. In the modern day world of super-computers, is there an easy way to do this?

Are there a bunch of tools for Windows that could cross-compile some z80 assembly (or whatever's used, really) stuff into a binary, then lop something on it that turns it into a loadable tape image. (Special bonus kudos if there's a script that'll turn a prepared image into one of those images while the tape loads.)

Is there a good guide somewhere that'll go through simple graphics and stuff?

_________________
[www.mrdictionary.net] - [Blast Arena Advance - No Carts. :(] - [Lemmings DS]


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Sat Jan 30, 2010 8:44 pm 0 
Baaa!
Baaa!
User avatar

Joined: Thu Aug 31, 2006 10:16 am 0
Posts: 407
http://www.worldofspectrum.org/documentation.html

has

A page about Program Transfers between an emulator and a Spectrum or audio cassette.

The ZX Spectrum on Your PC, by Colin Woodcock.
A complete, detailed, guide to ZX Spectrum emulation for both starting and advanced users. [24/06/04]

and manuals and Z80 links.

screen started at 16384 and was 256x192 (colours were 32x24 resolution). byte order was a bit odd though - top line of each character of the top 3rd of the screen, then second line, then 3rd, all the way up to 8th. then the middle third, then the bottom third. then the colours. probably easiest to work out by downloading a spectrum screenshot and deciphering it. this was just saved on tape and loaded straight into screen memory.


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Sat Jan 30, 2010 8:59 pm 0 
Sheepie Whore
Sheepie Whore
User avatar

Joined: Wed Apr 24, 2002 9:44 am 0
Posts: 20926
Location: Not here
koogy wrote:
screen started at 16384 and was 256x192 (colours were 32x24 resolution). byte order was a bit odd though - top line of each character of the top 3rd of the screen, then second line, then 3rd, all the way up to 8th. then the middle third, then the bottom third. then the colours. probably easiest to work out by downloading a spectrum screenshot and deciphering it. this was just saved on tape and loaded straight into screen memory.


And it made a very distinctive sound while loading. I could tell screen$ data loading without looking at the screen.


_________________
exit(1);


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Sat Jan 30, 2010 9:41 pm 0 
Baaaaaa!
Baaaaaa!
User avatar

Joined: Sun Sep 22, 2002 9:35 am 0
Posts: 3932
Location: Nessy's Bra
Calling Evilpaul :D

_________________
"Don't go into a trance boys..." :: My Sets at Mixdepot :: Radio K Podcast & Blog :: BallZup! For Mac, iPhone and iPod Touch. Get it you thumb jockeys!


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Sat Jan 30, 2010 10:01 pm 0 
Sheepie Whore
Sheepie Whore
User avatar

Joined: Mon May 31, 2004 12:08 pm 0
Posts: 12561
Location: Newcastle UK
I use sjAsmPlus which is a modern-standard Z80 assembler that happily compiles to generate .SNA format snapshots for loading into your emulator of choice. Easy to setup any IDE to build and run.

Debugging is an interesting one; I use my own emulator, because I'm most familiar with its debugger, and if I find I need any special support I can wire that in (e.g. debugger string channels or timing devices). Not sure what the alternatives might be.

For generating tapes, it's easy to make the SNA call the Spectrum ROM save routines.


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Sun Jan 31, 2010 11:27 am 0 
Baaaa!
Baaaa!
User avatar

Joined: Tue Aug 23, 2005 6:59 pm 0
Posts: 885
Location: UK, Broughton, Brigg
I would suggest that asking on WorldOfSpectrum's forums is the best idea, but I hate that place so I won't :)

_________________
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Sun Jan 31, 2010 1:37 pm 0 
Baaaaaaa!
Baaaaaaa!
User avatar

Joined: Fri Apr 26, 2002 5:15 pm 0
Posts: 8456
Location: Sheffield
Dio wrote:
Debugging is an interesting one; I use my own emulator, because I'm most familiar with its debugger, and if I find I need any special support I can wire that in (e.g. debugger string channels or timing devices).

Hehe, I remember that when I was doing some retro coding a few years back I thought, "this really would be a lot easier if the Spectrum had a debug serial port or a FIFO or something..." and then a lightbulb suddenly went *ting* above my head, and half an hour later I'd hacked one into Fuse. :)

_________________
"I hope not you take over our operation?"


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Sun Jan 31, 2010 8:40 pm 0 
Baaaa!
Baaaa!
User avatar

Joined: Wed Sep 29, 2004 1:01 pm 0
Posts: 678
Location: #ukscene, london branch
korruptor wrote:
Calling Evilpaul :D

Haha. Yeah, I've written one or two things on the Speccy ;)

My current setup is Pasmo, ZXSpin and makefiles with a bunch of custom command line tools. For smaller projects (256byte and 1k demos) I usually just use Pasmo on its own.

The screen is indeed weird, but there are a few tricks for navigating around the pixels. Trick 1 is:
Code:
; in: current screen line in DE
; out: next screen line in DE
getNextDE
      inc      d
      ld      a,d
      and      7
      ret      nz
      ld      a,e
      add      a,32
      ld      e,a
      ret      c
      ld      a,d
      sub      8
      ld      d,a
      ret

Trick 2 is to build a table of the start address of each screen line, aligned on a page boundary for quick access of course..
Trick 3 is that it's actually only hard to jump down every 8th line, for the other seven you just need to add 256 to the current address. So if HL holds the current line, doing INC H will jump down one line..

There's so much stuff like this that doesn't seem to be documented anywhere. There are efforts like the ZX Technical Wiki but that's still looking pretty pointless. Learning to code a Speccy is all a bit trial and error really. I think I learned most of my most useful Z80 tricks by reading MSX dev sites. If you want, I can give you a few useful bits of code and some header files. Maybe even post them in here for other people to see?

Like Barney I might also suggest asking on WOS, but I don't think you'll get a decent answer, so don't bother :D

Oh, and as for checking on a real Speccy, I have to admit that I don't bother any more - the emulators are more than good enough for most things. If I *have* to test something I have a +2 and a divIDE up in the loft but, more often than not, I ask someone else to test it for me ;)

_________________
[My inspiration - http://bitethis.org] [My blog - http://evilpaul.org] [My demos - http://atebit.org]


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Mon Feb 01, 2010 1:17 am 0 
Baaaa!
Baaaa!
User avatar

Joined: Fri Apr 26, 2002 9:58 pm 0
Posts: 971
Location: Leicestershire, UK
evilpaul wrote:
Oh, and as for checking on a real Speccy, I have to admit that I don't bother any more - the emulators are more than good enough for most things. If I *have* to test something I have a +2 and a divIDE up in the loft but, more often than not, I ask someone else to test it for me ;)

8O

+2 != Real Speccy

It's not even black! :P

_________________
b(H)

----


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Mon Feb 01, 2010 2:13 am 0 
Sheepie Whore
Sheepie Whore
User avatar

Joined: Wed Sep 03, 2003 6:54 am 0
Posts: 12471
Location: Monfalcone, Italy
koogy wrote:
http://www.worldofspectrum.org/documentation.html

has

A page about Program Transfers between an emulator and a Spectrum or audio cassette.

The ZX Spectrum on Your PC, by Colin Woodcock.
A complete, detailed, guide to ZX Spectrum emulation for both starting and advanced users. [24/06/04]

and manuals and Z80 links.

screen started at 16384 and was 256x192 (colours were 32x24 resolution). byte order was a bit odd though - top line of each character of the top 3rd of the screen, then second line, then 3rd, all the way up to 8th. then the middle third, then the bottom third. then the colours. probably easiest to work out by downloading a spectrum screenshot and deciphering it. this was just saved on tape and loaded straight into screen memory.


... and if you want to know why that "weird order" is because the refresh cycle of the dynamic ram of that time, by the
time the cycle is completed so much time passed that you already lost all those scanlines, that is why they had to
"jump" like that and then "back".

I must be one of the few people in the world that has an original copy of "The Complete Spectrum Rom Disassembly"
purchased live on an electronic fair so many years ago .. :wink:

ZX forever.

_________________
Giles the billy goat
"Baa"


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Mon Feb 01, 2010 8:28 am 0 
Baaaaaaa!
Baaaaaaa!
User avatar

Joined: Fri May 10, 2002 3:13 pm 0
Posts: 5974
Location: Watford
there is a commandline app which you give a program and a .scr to and it'll spit out a .tap file with a turboloader and the .scr as a loading screen - just be careful because it'll turn out something too fast to actually load from a real tape if you let it :)

It only allows for 48k loads though IIRC - I'll dig it out later

_________________
currently listening to: http://rescuedbywolves.bandcamp.com/


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Mon Feb 01, 2010 12:23 pm 0 
Baaaaa!
Baaaaa!
User avatar

Joined: Sat Sep 07, 2002 1:17 pm 0
Posts: 1378
Location: Guisborough, UK
gilesgoat wrote:
I must be one of the few people in the world that has an original copy of "The Complete Spectrum Rom Disassembly"
purchased live on an electronic fair so many years ago .. :wink:

On my "current" project list is a Speccy emulator (as I've probably mentioned in here somewhere before) and funnily enough, recently a non-programmer (who works with my wife) heard (from her) that I was doing this and gave me a mint copy of that book! Result!!

Haven't read it yet (or made any real progress on the emulator). Spending too much of my spare time doing stuff to try and earn money and I don't think there much of a market, at least not financially, for a poorly-written Speccy emulator! 8)


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Mon Feb 01, 2010 12:32 pm 0 
Sheepie Whore
Sheepie Whore
User avatar

Joined: Mon May 31, 2004 12:08 pm 0
Posts: 12561
Location: Newcastle UK
gilesgoat wrote:
... and if you want to know why that "weird order" is because the refresh cycle of the dynamic ram of that time, by the time the cycle is completed so much time passed that you already lost all those scanlines, that is why they had to
"jump" like that and then "back".

My understanding was that the main reason was so the attributes could be read without changing the memory page; it can therefore read 2 attr and 2 screen bytes in 4 cycles and leave the other 4 cycles to the Z80.

Can't remember the exact permutation but the absolutely required column bits for this are A0 and A8-A12.


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Sat Feb 06, 2010 4:12 am 0 
Baaaaaaa!
Baaaaaaa!
User avatar

Joined: Fri Dec 17, 2004 1:53 pm 0
Posts: 6866
Thanks to the magic of z88dk, I now have my completed game! Hooray!

All I need to do now is figure out how you combine a converted SCR and my game TAP together to make a single game with a loading screen.

Any ideas? ;-;

As far as I know, I have to convert the SCR into a TAP (making it a 3dos entry), and then combine the two so that when the tape loads, it loads the loading screen into 16384, making it visible, then it loads the game afterwards. Maybe. :/

_________________
[www.mrdictionary.net] - [Blast Arena Advance - No Carts. :(] - [Lemmings DS]


Top
 Profile  
 
 Post subject: Re: Speccy programming in the 21st Century!
PostPosted: Sat Feb 06, 2010 9:37 am 0 
Baaaa!
Baaaa!
User avatar

Joined: Tue Aug 23, 2005 6:59 pm 0
Posts: 885
Location: UK, Broughton, Brigg
If you have your game as a CODE block on a tape image, then might I suggest BASin? It has a lot of tools for creating things for the speccy (including an assembler, screen painter, tape manager, BASIC front IDE, debugger etc).

You can use the SCREEN$ paintbox to import your screen image and dump that to your tape. You'll need a loader -

The BASIC would likely be:

Code:
10 BORDER 0: PAPER 0: INK 0: CLS
20 POKE 23739,111: LOAD "" SCREEN$
30 LOAD "" CODE <address>
40 PRINT AT 0,0;USR <address>


Which you can use BASin's editor to create and save to a tape using the tape creator.

You can find BASin here: http://sites.google.com/site/pauldunn/BASin_15.6.zip

D.

_________________
"Oh dear lord, I slightly soiled myself. Oxfam won’t be pleased."


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 23 posts ]  Go to page 1, 2  Next

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group