• Please review our updated Terms and Rules here

Is this how to do a counting loop larger than 16 on i4004?

alank2

Veteran Member
Joined
Aug 3, 2016
Messages
2,264
Location
USA
I don't see a decrement version of isz, so if I want a loop that loops 0x18 times, does it have to be done like this where I calculate the difference between 0x18 and 0x100 and increment instead with the isz instruction?

Or is there a better way? The nop inside the loop is just a representation of what the loop might do, it doesn't do anything currently.

Code:
  fim 1, $e8

loop1
  nop
  isz 3, loop1
  isz 2, loop1

halt
  jun halt
 
Essentially, yes. This is the same way that the DEC PDP-8 works. It only has an ISZ instruction.

You should be able to get the assembler to do the grunt work of dealing with the (essentially) negative number to make reading (and writing) the source code easier.

Dave
 
I've been using the assembler here:


Do you know what other ones are available/recommended?
 
Unfortunately that assembler doesn't appear to support constructs such as $100-$18 or -$18 to give the resulting byte value of $E8.

Dave
 
Back
Top