An interesting use of the 4004 instructions
Paul Koning
paulkoning at comcast.net
Thu Dec 15 18:55:35 CST 2016
> On Dec 15, 2016, at 2:52 PM, dwight <dkelvey at hotmail.com> wrote:
>
> I was looking at some disassembled 4004 code when I came across
>
> a SKIP operation.
>
> It isn't normally an instruction but If you do a JCN with all the CCCC = 0,
>
> it will do a NEVER jump.
>
> This is the equivalent of a SKIP instruction.
>
> I would suppose a JCN with CCCC = $8000 would be an always jump,
>
> on page ( not real useful as JUN takes the same cycles and space ).
>
> I thought at first there was some errors in the code because there
>
> were JMS to the middle of JCN instruction but then I noticed that there
>
> were no conditions specified for the JCN. A little thought and I realized
>
> it was a way to skip over a single byte instruction.
It's a bit like a coding convention I've seen used a lot in PDP-11 code, at least in some programs; RSTS/E is full of them. Consider a function with two entry points, where Carry set or clear is used after entry to distinguish the two cases. The two entry points look like this:
fun1: tst (pc)+
fun2: sec
; common code
bcs case2
; case1...
Or a function that indicates a boolean result (say, success/fail) by Carry clear vs. set:
good: tst (pc)+
fail: sec
rts pc
paul
More information about the cctech
mailing list