Discussion about a 4004/4040 SKIP instruction feature of JCN 0 Herb Johnson, Dwight Elvey last edit Nov 6 2024 https://forum.vcfed.org/index.php?threads/interest-in-i4004.63354/ [An email in a vintage computing forum, subject "Interest in i4004". Edits by Herb Johnson are in square-brackets.] Mar 7, 2018 Dwight Elvey One 4004 coding I've found, that has another useful instruction. It is the SKIP instruction. It is most useful for causing the execution of multiple [possible] values into a subroutine. It is a JCN [Jump on condition] instruction that has no condition, [opcode 10H]. Instead of an address, you use a LDM instruction (or similar [one byte instruction]). [The SKIP] is an Always Don't Jump instruction, [which effectively ignores and skips over the second address byte. Thus the second byte could be executed as a single-byte instruction, if addressed by a jump.] Say you had a PRINT subroutine. You could precede it with multiple of these skips [for multiple entry points]. You'd need to add this SKIP instruction to your assembler or do it as a DB 10 [statement]. Something [assembled] like 0033 10 SKIP 0034 DA LINEFEED: LDM $0A 0035 10 SKIP 0036 DD RETURN: LDM $0D 0037 XX PRINT: [code follows] [Explanation by Herb: The value in the accumulator when executing PRINT, depends on where you enter the PRINT code. Enter from LINEFEED or RETURN, and one LDM instruction is executed, loading that nibble into the accum; followed by "JCN XX" (no result) operations if any follow. If you fall in from 0033 or earlier, the code is executed as: 0033: 10 DA JCN 0A ;no result 0035: 10 DD JCN 0D ;no result 0037: PRINT: ;accum has whatever value it had from 0032 - end explanation by Herb] [Dwight:] I was decoding some code on a [4004] board the fellow in Norway found, and it had a few locations where I found these encoded SKIPs in it. It didn't make sense at first because it had these JCN instructions without any condition to check. Then I realized it was a clever trick to have a repeated parameter to [enter into] a subroutine. If you used those parameters more than once it made sense to have them as multiple skips at the beginning. There was one subroutine with 5 of these in a row. - Dwight Herb's discussions with Dwight Elvey, Oct-Nov 2024 [I provided Dwight with an example use of a SKIP instruction, as below. Dwight explained why it was likely not a good use. - Herb Johnson] This one is not a correct useage, sorry. C0075 FIM P6 D0040 ;0075-2C 40 SKIP ;0077-10 C0077 FIM P6 D0000 ;0078-2C 00 JMS C0061 ;007A-50 61 You should treat SKIP as a single byte instruction. Since it is a never jump instruction, it should be followed [when coding it] by any single byte instruction. [You] should have used the [one byte] LDM and not the [2 byte] FIM. [You] could have used a clear carry instruction or such. Instead of thinking of it as a JCN, just think of it as a SKIP. If it was followed by a two byte instruction, then I don't know how one might [choose to assemble] it. [Some] assembler might flag it as a suspected error. Still, [SKIP followed by a two-byte instruction] could do something intended. I'd consider it poor coding but otherwise SKIP has some useful purposes. [On the other hand] Tom [Pittman] intentionally over flows the 4004 stack [in his 4004 assemmbler]. So I guess all is fair. - Dwight Elvey [edits by Herb Johnson]