Yes, by one, but it's also an easy way to remember to do an EI before a HALT where your design needs it so you don't deliberately hang your own code.
Suggestions on formatting of code
Re: Suggestions on formatting of code
Re: Suggestions on formatting of code
That's a bit like the perpetually cryptic (to me at least!) RRCA and RRA etc. I can never can remember which one does what with the carry and always have to look it up. Maybe some macros to clearly differentiate these would be helpful to?
Cosmium
https://cosmium.itch.io/
https://cosmium.itch.io/
- Einar Saukas
- Bugaboo
- Posts: 3139
- Joined: Wed Nov 15, 2017 2:48 pm
Re: Suggestions on formatting of code
I could never remember it either, that's one of the reasons I did this:
https://www.ime.usp.br/~einar/z80table/index.html
Click on "MISC" at the bottom of that page.
Re: Suggestions on formatting of code
as we started talking about remembering commands... i'm often looking into Zymosis code to remember details on some instructions. there cannot be a better reference than a working Z80 emulator! ;-)
Re: Suggestions on formatting of code
Good point. I might add RR8 and RR9 to my macros file to remember how many bits are used, as I think RR and RRC are defined the wrong way round.
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Suggestions on formatting of code
. . . to say nothing of the logical and arithmetic shifts.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Re: Suggestions on formatting of code
A round of appreciation for Einar's z80table! Opening that up is pretty much always my first action when doing any serious Z80 coding.
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Suggestions on formatting of code
I use a copy an offline copy of this. I made a few corrections to it.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Re: Suggestions on formatting of code
Nice to see everyone's approach.
I'm putting labels on a separate line to be more flexible with using descriptive names.
I'm putting labels on a separate line to be more flexible with using descriptive names.
Code: Select all
call clearPlayArea
announceLvl2:
xor a
ld (flagSkipSegment),a
Re: Suggestions on formatting of code
XoRRoX wrote: ↑Sun Jul 05, 2020 9:46 pm Nice to see everyone's approach.
I'm putting labels on a separate line to be more flexible with using descriptive names.
Code: Select all
call clearPlayArea announceLvl2: xor a ld (flagSkipSegment),a
...So just out of interest (for someone who doesn't do a lot of 'modern' development), what is it about camel case that you like/prefer?andydansby wrote: ↑Thu Jul 02, 2020 5:57 pm My preference has been for camelCase, just easier on my eyes.
Or is it a habit thing that's been learned (e.g. Javascript)?
My Speccy site: thirdharmoniser.com
- Einar Saukas
- Bugaboo
- Posts: 3139
- Joined: Wed Nov 15, 2017 2:48 pm
Re: Suggestions on formatting of code
RRC means "Rotate Right Circular".
A bad name choice indeed.
-
- Microbot
- Posts: 147
- Joined: Fri Nov 24, 2017 5:09 pm
- Location: Syracuse, NY, USA
- Contact:
Re: Suggestions on formatting of code
For me it comes to when I write multi-word long variable names. If you had a choice between myvariablename or my_variable_name vs myVariableName, I can read the camel case much easier. It became more of a habit after studying other people’s C code and influenced me.Morkin wrote: ↑Mon Jul 06, 2020 2:28 pmXoRRoX wrote: ↑Sun Jul 05, 2020 9:46 pm Nice to see everyone's approach.
I'm putting labels on a separate line to be more flexible with using descriptive names.
Code: Select all
call clearPlayArea announceLvl2: xor a ld (flagSkipSegment),a
...So just out of interest (for someone who doesn't do a lot of 'modern' development), what is it about camel case that you like/prefer?andydansby wrote: ↑Thu Jul 02, 2020 5:57 pm My preference has been for camelCase, just easier on my eyes.
Or is it a habit thing that's been learned (e.g. Javascript)?
Re: Suggestions on formatting of code
Same reason as Andy wrote. It visually breaks up multi-word expressions where one cannot use spaces without having to type underscores, which also makes them longer; waitForAnyKey, showBossDefeated.
I started doing that from the very beginning in my coding adventures way back in Turbo Pascal.
To let them start with a lowercase character is just something I saw recently in someone else's code and for some reason thought looked cool
Re: Suggestions on formatting of code
I do empty line after djnz, jr or jpTurtle_Quality wrote: ↑Thu Jul 02, 2020 9:33 pm So no-one indenting for loops, conditional code etc ???
One call (or even several call's) is surrounded by empty line before and after.
Last edited by Bedazzle on Mon Jul 20, 2020 2:11 pm, edited 1 time in total.
Re: Suggestions on formatting of code
What kind of corrections?Ast A. Moore wrote: ↑Sat Jul 04, 2020 4:29 pm I use a copy an offline copy of this. I made a few corrections to it.
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Suggestions on formatting of code
It’s been a while; I don’t remember the details exactly, but some instruction descriptions were incorrect (or maybe it was the case of incorrectly indicated states of the flags). No showstoppers, though.Bedazzle wrote: ↑Mon Jul 20, 2020 2:10 pmWhat kind of corrections?Ast A. Moore wrote: ↑Sat Jul 04, 2020 4:29 pm I use a copy an offline copy of this. I made a few corrections to it.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.