"Programming the Spectrum in Assembly" series in Micro Mart

edited January 2012 in Sinclair Miscellaneous
I see that Shaun Bebbington is starting a series of articles in Micro Mart magazine on how to program in assembly for those who might know a little bit about programming but want to try and develop it. The first part is an overview, and it follows on next week with some examples to try out. Should be interesting - I wonder how long it's been since we've seen that in a magazine!

One point made in this week's overview was regarding the differences between each version of the Speccy. Obviously, it's mainly about memory and the AY chip, but I heard that the Spectrum 128K can be a bit faster than the 48K (one of the Double Dragon games apparently ran faster on a 128K). Yet they all have the same z80 processor at approx 3.5MHz. Have I misunderstood, or is there any truth in this?
Post edited by Spector on
THE RETRO GAMER IRC CHATROOM. EVERY SUNDAY AT 9PM BST. LOG ON USING THE LINK BELOW:
https://discordapp.com/invite/cZt59EQ

Comments

  • edited June 2010
    From the FAQ: the 48K runs at 3.50000MHz and has interrupts at 50.08 Hz, giving 69888 T-states per frame; the 128K runs at 3.54690MHz and has interrupts at 50.01Hz, giving 70908 T-states per frame - so in real terms the 128 is indeed *marginally* faster. However, you could potentially have a program that's synchronised with the interrupts, but contains just slightly too many instructions for the 48K to fit into one frame, in which case the 48K would end up running it at half speed. Maybe this is the case for Double Dragon, I don't know...
  • edited June 2010
    Opps! I didn't quite go as indepth as Gasman did - sorry folks for the lack of accuracy. I'm intending the code to work on 48 machines anyway, though I might change my mind if there's enough interest, that's some way off though.

    If you want to follow this on the Micro Mart forums, point your web browser at tinyurl.com/Speccy-Coding. I'll be posting the example code from the features and so on there. I hope I can do this justice anyway. Sorry in advance for the enevitable poor explanations, typos or general technical mistakes, and thanks for the post here.

    Regards,

    Shaun.
  • edited June 2010
    I don't think it's any problem, as it sounds to me like a difference that is more theoretical than practical. It doesn't have any impact on 99.9% of programs. Certainly, there aren't any other games I can think of that have a difference, but I just thought I would mention it because I swear someone pointed it out many moons ago.
    THE RETRO GAMER IRC CHATROOM. EVERY SUNDAY AT 9PM BST. LOG ON USING THE LINK BELOW:
    https://discordapp.com/invite/cZt59EQ
  • edited June 2010
    A far bigger effect is that the +2A/+3 have less contention than the 48K/128K.
  • edited June 2010
    A far bigger effect is that the +2A/+3 have less contention than the 48K/128K.

    In the +2A/+3 there are less contention situations, but the effect can be worse, up to 7 wait states instead of 6 like in previous models, since every 8 contended states there's only one free for the CPU instead of the usual two.
  • edited June 2010
    Good luck with the articles, Shaun.

    I'd be picking up copies with interest, except I'm thousands of miles from the handy newsagents :)

    Will it ever go up on the web, for those of us that are Ex-Pats?
  • edited June 2010
    Feel free to make use of the tutorial in my sig, which you PM'd me about a good while ago, Shaun. Looking forward to the rest of the series.

    (Off-topic PSA, micromart is also on Part 3 of a series on learn to program in C, which looks really good - happy dayz for a retro programmer)
  • edited June 2010
    Metalbrain wrote: »
    In the +2A/+3 there are less contention situations, but the effect can be worse, up to 7 wait states instead of 6 like in previous models, since every 8 contended states there's only one free for the CPU instead of the usual two.

    Give me a real-world algorithm which experiences more contention on a +2A/+3 than a 48K.

    Here's one that experiences much less contention on a +2A/+3 than a 48K:
    LD HL, 0x4000
    LD DE, 0xc000
    LD BC, 0x1800
    LDIR
    
  • edited June 2010
    Its only a seriers of two articals which is disapointing. I would have thought a series of twelve. As the code could be used on other Z80 machines like the Jupiter Ace which Mirco Mart seem to forget.
  • edited June 2010
    Give me a real-world algorithm which experiences more contention on a +2A/+3 than a 48K

    Define "real-world" algorithm. :razz:

    I used this in King's Valley to find if a 128k model has 128k/+2 , +2A/+3 or Pentagon timings:
    		halt
    		xor	a
    		ld	b,a
    		ld	c,a
    		ld	r,a
    		ld	hl,16384
    test128k:	ld	a,(hl)
    		ld	a,r
    		ld	a,(hl)
    		inc	bc
    		jp	p,test128k
    

    The high bit of R is set in the interrupt routine, and then check C value to differenciate the model (+2A/+3 gives the lowest number, and Pentagon the highest).
  • edited June 2010
    Steve(spt) wrote: »
    Its only a seriers of two articals which is disapointing. I would have thought a series of twelve. As the code could be used on other Z80 machines like the Jupiter Ace which Mirco Mart seem to forget.
    That's funny as I've wrote four parts already. What I meant is that I'm covering the Z80 (Speccy) and then move onto the 6502 (not sure yet, probably Atari 8-bit as it's an easier machine to learn).

    Just out of interest, how active is the Jupiter Ace 'scene' or community nowadays?

    Regards,

    Shaun.
  • edited June 2010
    That's funny as I've wrote four parts already

    Great, I was going on what what printed yesterday (Thursday Issue 1111)
    Just out of interest, how active is the Jupiter Ace 'scene' or community nowadays.

    Very active, come on over for a visit.
    USB storage hardware is being tested, xace emulator (Linux) is back in dev.
    lot of old hardware found, new titles.

    There is plenty of scope for some new Z80 machine code titles,.. any one?
  • edited June 2010
    What I said was...
    I've decided to start a series (well, the first series of two) about programming an old 8-bit computer, using assembly language also known as machine code.
    I was talking about writing two series of articles, not two articles, but sorry for the misunderstanding. My original drafts for these articles are coming in at around 900 words or more and require editing down to no more than 700, so sometimes I might cut too much in order to meet the work limit ;-)

    Regards,

    Shaun.
  • edited June 2010
    I think I should point out that things don't really get going until around part four of the series; in fact, if I had the column inches, weeks one to four would have been part one, and the next lot (five to eight or nine) would have been part two. I think I was being a bit ambitious as to how much I could fit onto a page when I wrote this first installment.

    Regards,

    Shaun.
  • edited June 2010
    The not very exciting second installment of this is available in this week's Micro Mart (issue 1112) including a *cough* deliberate typo if anyone can spot it.

    Regards,

    Shaun.
  • edited June 2010
    Just noticed this... how fantastic is it to have a magazine in 2010 carrying articles on coding in assembler on the Speccy?!

    All the best with this, Shaun.
  • fogfog
    edited June 2010
    What I meant is that I'm covering the Z80 (Speccy) and then move onto the 6502 (not sure yet, probably Atari 8-bit as it's an easier machine to learn).

    emulation wise the 800xl etc would be "ok" to do ASM... but easier would be the 64... IMHO simply due to the tools for it... and less for the atari

    or the BBC micro has ASM from basic prompt..

    if you need c64 code have a look at codebase http://codebase64.org .. and since you know tmr, speak to him maybe about the atari as he's done some stuff.
  • edited June 2010
    fog wrote: »
    emulation wise the 800xl etc would be "ok" to do ASM... but easier would be the 64... IMHO simply due to the tools for it... and less for the atari

    or the BBC micro has ASM from basic prompt..

    if you need c64 code have a look at codebase http://codebase64.org .. and since you know tmr, speak to him maybe about the atari as he's done some stuff.
    I'm certainly not speaking about TMR here, but C64 people are generally more elitist in my opinion and the Atari XE/XL would probably be an easier machine to learn, but I've still not 100% decided which 6502 machine to cover. May be it'll be the BBC afterall.

    Regards,

    Shaun.
  • edited June 2010
    I'm not sure, but if you email the editor (or contact him through the forums) then you may be lucky. www.micromart.co.uk is the place to be.

    However, with the editors permission, I'll be posting previous articles on the official thread on the Micro Mart forums. You don't need to sign up to the forums to read the back articles.

    Regards,

    Shaun.
  • edited July 2010
    This sounds absolutely fantastic!

    You could have another regular Micro Mart reader on your hands if this sort of stuff continues.

    I'll pop out to WHSmith's tomorrow and pick up an issue.

    If you 'can' post the material from previous issues on the Micro Mart site it would be really appreciate by those of us who missed it.
  • edited July 2010
    Just read the latest one. Cool stuff Shaun!
  • edited October 2010
    It's nearly all over - for now at least. I'm to write part 12 this week and then I suppose that I should write something similar for the 65xx CPU though I'm still not 100% sure of my target machine here.

    I know at least two people have got their hands dirty and started programming in assembly because of this series even with its' sedate pace, so I'm really happy about that. I'd like to thank Bob Smith and Jonathan Cauldwell for their help, Jonathan's book available on his site is well written and even I can understand it, so that must say something.

    Next Summer (or maybe in the Spring), I'll probably revisit the bedroom tutorials and delve into more advanced bedroom coding for the Speccy. But I'd just like to thank everyone for their positive comments and feedback. I hope that those who have read it have enjoyed it. The discussion continues over at tinyurl.com/Speccy-Coding for those who are interested.

    Regards,

    Shaun.
  • edited October 2010
    I caught a few 'episodes' of it, will there be a complete 'series' available?
  • edited January 2012
    For those who are interested, I've archived parts I - VIII of the series (with improved types) over on my gaming blog at http://shaunbebbington.blogspot.com/ - the final episode will appear shortly, so keep an eye out at the aforementioned link :-)

    Regards,

    Shaun.
  • edited January 2012
    bookmarked!
  • edited January 2012
    Great! Thanks! :-D
  • edited January 2012
    No problems, I hope it gets people started at the very least.

    Regards,

    Shaun.
Sign In or Register to comment.