Page 5 of 5

New game uploaded: Core War

Posted: Thu Jul 01, 2021 10:46 pm
by rje

I walked through one of the old redcode assemblers.  I didn't like it -- I felt the parsing was too generic, as if done as a programming exercise.  But it gave me ideas:

1. USE THE STRUCTURE

Redcode programs adhere to a set of rules that suggest a simple parser based on one line = one instruction.

2. TOKENS REQUIRED

Labels require token-like structures, because values are not yet finalized.

3. LOOK AHEAD

The first two tokens on a line, taken together, tell me half of what I need to know.

4. NUMERIC EXPRESSIONS

Don't bother until everything else is done and you're bored.

 


New game uploaded: Core War

Posted: Sat Jul 03, 2021 4:46 pm
by rje

Well, accommodating labels is a significant addition.

LABEL SUPPORT


  1. Tokenizer, with little utility functions.  DONE.  240 lines.


  2. "Compiler", with little utility functions.  IN PROGRESS.  66 lines.


  3. Integrate.


  4. Version "1.0" achieved.


The binary has grown from 14K to to 17K. 

 


New game uploaded: Core War

Posted: Tue Jul 06, 2021 2:11 pm
by rje


LABEL SUPPORT



  1. Tokenizer, with little utility functions.  DONE.  240 lines.


  2. "Compiler", with little utility functions.  DONE.  80 lines.


  3. Integrate.


  4. Version "1.0" achieved.




The binary grew to 18K, then backed off to 17K when I removed the original parsing hack.


I'm surprised how long the tokenizer routines are as a whole.


New game uploaded: Core War

Posted: Tue Jul 06, 2021 2:40 pm
by rje

I've been thinking about how to speed up execution.

Core Wars runs plenty fast -- it doesn't feel labored, and warriors move at a pace that the human eye can keep up with, which is appropriate for visual interfaces.

But I'm always looking for little corners to cut.

 

Obviously the target is the execution loop.

One speedup might be to VERY judiciously assign a register variable.

The next might be some inline assembly, somehow.

 


New game uploaded: Core War

Posted: Tue Jul 06, 2021 5:18 pm
by rje

Labels now work.

However, the X16 bin is eating the first character in the first line of code.  This is AFTER the file load eats its obligatory two characters.

The UNIX bin does NOT eat the first character.   Therefore the bug is in the X16 code that reads bytes from Bank 1 into the char buffer. 

There's an off-by-one error here.

* * *

Found it.


New game uploaded: Core War

Posted: Tue Jul 06, 2021 11:04 pm
by rje

Went 1.0.

Added a "demo" mode for when I click "Try it out!"...

* * *

The code is really picky about file formats.  Special characters do upset us.  I may have to have a better sanitization function.


New game uploaded: Core War

Posted: Wed Jul 07, 2021 7:55 pm
by Snickers11001001

This is a cool project.   Its really cool to see your thought-processes in your updates and the corresponding updates of your code.    Thanks!