Crap 0.1 first assembly project

Show us what you're working on, (preferably with screenshots).
User avatar
Ast A. Moore
Manic Miner
Posts: 671
Joined: Mon Nov 13, 2017 3:16 pm

Re: Crap 0.1 first assembly project

Post by Ast A. Moore » Thu Mar 15, 2018 12:35 pm

Nomad wrote:
Thu Mar 15, 2018 12:10 pm
This was a combination of machine code + basic. Not as claimed in the magazine reviews as 'just a program written in BASIC'. Had they looked at the source they would have seen that on the first few lines you have a machine code portion (to load the map.)

Code: Select all

60 POKE 23658,0
70 LET A=A+1
75 IF A<58603 THEN GO TO 60
80 DATA 33,0,64,17,238,228,1,0,27,237,176,201,33,238,228,17,0,64,1,0,27,237,176,201
90 RANDOMIZE USR 58580
Just a BASIC game eh... facepalm...
To be fair, these are just two harmless snippets of machine code. One copies the screen to another memory location, the other copies it from that location back.
0 x
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.

User avatar
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad » Thu Mar 15, 2018 1:06 pm

True but it shows that the program was not just written in basic. :lol: Ok I am being pedantic but still.

It clocks in at 401 lines of basic, with a sprinkling of machine code and pokes.

It's begging for a make over. But then that kind of makes sense it was a very early program judging by the style. Having reviewed the code. I wonder why the author didn't do the input routine & screen update in machine code. It would have made a huge difference... Hmmm... mysterious.
0 x

User avatar
Seven.FFF
Manic Miner
Posts: 283
Joined: Sat Nov 25, 2017 10:50 pm
Location: USA

Re: Crap 0.1 first assembly project

Post by Seven.FFF » Thu Mar 15, 2018 1:41 pm

I bet he got those screen copy routines from somebody else, and used them without knowing assembly.
1 x
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
seven-fff.com/blog

User avatar
Ast A. Moore
Manic Miner
Posts: 671
Joined: Mon Nov 13, 2017 3:16 pm

Re: Crap 0.1 first assembly project

Post by Ast A. Moore » Thu Mar 15, 2018 2:18 pm

Seven.FFF wrote:
Thu Mar 15, 2018 1:41 pm
I bet he got those screen copy routines from somebody else, and used them without knowing assembly.
Heh. Possibly. Then again, those are just LDIRs, preceded by setting up the HL, DE, and BC register pairs. It’s also possible he set out to write the whole thing in BASIC, realized some aspects were painfully slow, and sped them up with morsels of machine code.
0 x
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.

User avatar
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad » Thu Mar 15, 2018 2:35 pm

I get the feeling if he knew machine code he would have done all the INK, PAPER, BORDER stuff with pokes, even if it was a BASIC program.

But if he was getting help you would have thought they would have done the input routine - but I can kind of see why they didn't if they were pushed for time and especially if it was not the author who was doing the assembly.

There again, this was 1982 so.. hmmm.
Last edited by Nomad on Thu Mar 15, 2018 2:37 pm, edited 1 time in total.
0 x

User avatar
R-Tape
Site Admin
Posts: 1552
Joined: Thu Nov 09, 2017 11:46 am

Re: Crap 0.1 first assembly project

Post by R-Tape » Thu Mar 15, 2018 2:36 pm

Ast A. Moore wrote:
Thu Mar 15, 2018 2:18 pm
morsels of machine code.
Now there's a cracking name for a coding book.
1 x

User avatar
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad » Thu Mar 15, 2018 2:39 pm

R-Tape wrote:
Thu Mar 15, 2018 2:36 pm
Ast A. Moore wrote:
Thu Mar 15, 2018 2:18 pm
morsels of machine code.
Now there's a cracking name for a coding book.
Byte in to Spectrum machine code...

Ok I'll get my coat :lol:
0 x

User avatar
Ast A. Moore
Manic Miner
Posts: 671
Joined: Mon Nov 13, 2017 3:16 pm

Re: Crap 0.1 first assembly project

Post by Ast A. Moore » Thu Mar 15, 2018 2:52 pm

R-Tape wrote:
Thu Mar 15, 2018 2:36 pm
Ast A. Moore wrote:
Thu Mar 15, 2018 2:18 pm
morsels of machine code.
Now there's a cracking name for a coding book.
Morsels of Machine Code

Chapter 1. BCD: How to Nibble Away at Your Bytes
1 x
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.

User avatar
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad » Fri Mar 16, 2018 12:47 pm

To give some insight to the curious..

What I decided to do was to understand the battle of britan code better was to transcribe it to a legal pad. This gave me time to think about each line and what it did within the program. And try and get a handle on how the guy that wrote the program was thinking. I think its harder when you are just looking at a listing screen.

At the end I finish with hand cramps and 30 pages of legal papers. :lol: What I can say so far is its almost all BASIC code. its structure is really just a stack of if statements comparing various arrays against a few magic numbers. There are random values that plug into a model to handle stuff like movement, damage. And each unit has fule consumption tracked.

The code seems to have been worked on in a number of stages. By the line numbering the guy started by using a skeleton then expanded/edited as he went. Pretty standard stuff. The only weird part is the way that the map code sticks out like a sore thumb. Can't be 100% but it would appear this came from a different source.

The enemy will attack one of three targets. I never really thought about how limiting this is to game play.

There only being one map is also another interesting design decision. It just seems sad that with what would have been a few more months of development this could have been a very nice game.

Anyway enough speculation on what could have been. :lol: The variables are what you would expect from this period - they are sparse but functional. The use of magic numbers is not 100% there was an effort to make the code readable as some program tasks are assigned variables for the line numbers to use in the code. I thought that was quite progressive for 82'.

Next up will be putting this onto +3 disk. Luckily there is no complicated protection scheme to worry about. It's just a matter of copying the screen data, the code onto the disk. (well the memory disk first then the real disk).

After that (assuming I didn't screw it up) I will go through and replace as much as the basic with pokes.) If it makes seance to go further down the rabbit hole and actually start implementing parts of it in machine code then will have a go.
1 x

User avatar
Nomad
Manic Miner
Posts: 600
Joined: Thu Dec 28, 2017 12:38 pm

Re: Crap 0.1 first assembly project

Post by Nomad » Sun Mar 18, 2018 4:00 pm

Update:

Well battle of Britain is progressing well...

But talk is cheap perhaps some screen shots. :lol: Still at the rough prototype stage but one of the things that really let this program down was the interface. As I wanted to learn more about vector type graphics I thought this would be a good chance to figure out the assembly draw/plot routines.

At the moment its still a hot mess of basic/assembly. but this was the fastest way to figure out the table values. Next will be get it all generated in assembly, the loop code. This should speed things up.

Really I want to make hexagon tiles but circles are ok at a push I guess... anyway you can see what I am getting at.

The red team (Germans) you always have the data to the right, same as blue team (Brits). With the targets bombed also this takes away the need to call up the data from the input, thus we shorten the input loop giving a much tighter input routine. Given this is one of the programs bottlenecks I think its worth loosing a little bit of screen real estate to this.

My idea is having two maps, the first is wide area, then a local map. One thing that is very realistic is you don't get to micromanage the patrols. This was probably first a limitation of the program but it added to the realism. However it got panned for this in reviews (quite unfairly).

I am hesitant to putting a third screen (battle screen) where it would switch you to pilot view where you could attack the escorts/bombers instead of it being a algo result. This would take away from the realism of being in bomber command. But on the other hand by offering the player the chance to 'switch roles' and take the place of the patrol for encounters it would fix what was according to the reviews a major failing of the game 'its boring you can't fight the enemy yourself..'

I guess its one of those do you sacrifice realism for gameplay kinda deals.

Another thing I often thought was lacking in the game was being able to play the other side. This would enhance the replay factor and you could try some new strategy (instead of targeting civilians - target the airfields.. making Sea lion possible). I often thought this would have made the game 10x better as it got a bit boring because you knew that the red team was always going to attack the civilian targets.

I would need to have a think how to do this but this would just require extension of the enemy targeting (the computer only has 3 possible targets as the red team.. to enable a switch to bombing RAF airfields you open up the targets.. making the game much more difficult as a defender but also much better inmo.)

Image
0 x

Post Reply