Skip to main content
Commonmark migration
Source Link

#Commodore VIC-20/VC-20/C64 - 95 69 68 67 tokenized BASIC bytes used (obfuscated and minimized)

Commodore VIC-20/VC-20/C64 - 95 69 68 67 tokenized BASIC bytes used (obfuscated and minimized)

0dEfnb(x)=sgn(xandb):fOi=0to10:b=8:fOj=0to3:?rI(stR(fnb(i)),1);:b=b/2:nE:?:nE

Copy and paste the above text into WinVice, for instance. Just about fits onto 80 characters on a Commodore 64.

Here's the non-obfuscated symbolic listing for illustrative purposes:

0 DEF FN B(X)=SGN(X AND B)
1 FOR I=0 TO 10
2  LET B=8
3  FOR J=0 TO 3
4   PRINT RIGHT$(STR$(FN B(I)),1);
5   LET B=B/2
6  NEXT J
7  PRINT
8 NEXT I

Of course this may be minimised and further obfuscated. Explanation:

The DEF FN command in line zero is a simple function which accepts one numeric parameter. This will give the algebraic sign the number passed to it as a parameter, in this case is ANDed with the value B (declared elsewhere, but becomes global once declared).

Line 1 starts the loop counter I

Line 2 sets the value of the 3rd BIT.

Line 3 starts loop counter J (we want bits 0 - 3 essentially).

Line 4 gets the STR$ value (string value) of the function FN B(I), this is then passed to the RIGHT$ command as CBM BASIC auto-pads outputted numbers with a white space, so we get the last character in the string created by STR$.

Line 5 moves the BIT counter down one (like x >> 1 in C I suppose).

Line 6 moves the J loop up one.

Line 7 prints a new line (line echo PHP_EOL; in PHP).

Line 8 moves the I loop up one.

I've 'nested' the listing in the example to better show the loop and loop order.

C64 counting in nybbles

#Commodore VIC-20/VC-20/C64 - 95 69 68 67 tokenized BASIC bytes used (obfuscated and minimized)

0dEfnb(x)=sgn(xandb):fOi=0to10:b=8:fOj=0to3:?rI(stR(fnb(i)),1);:b=b/2:nE:?:nE

Copy and paste the above text into WinVice, for instance. Just about fits onto 80 characters on a Commodore 64.

Here's the non-obfuscated symbolic listing for illustrative purposes:

0 DEF FN B(X)=SGN(X AND B)
1 FOR I=0 TO 10
2  LET B=8
3  FOR J=0 TO 3
4   PRINT RIGHT$(STR$(FN B(I)),1);
5   LET B=B/2
6  NEXT J
7  PRINT
8 NEXT I

Of course this may be minimised and further obfuscated. Explanation:

The DEF FN command in line zero is a simple function which accepts one numeric parameter. This will give the algebraic sign the number passed to it as a parameter, in this case is ANDed with the value B (declared elsewhere, but becomes global once declared).

Line 1 starts the loop counter I

Line 2 sets the value of the 3rd BIT.

Line 3 starts loop counter J (we want bits 0 - 3 essentially).

Line 4 gets the STR$ value (string value) of the function FN B(I), this is then passed to the RIGHT$ command as CBM BASIC auto-pads outputted numbers with a white space, so we get the last character in the string created by STR$.

Line 5 moves the BIT counter down one (like x >> 1 in C I suppose).

Line 6 moves the J loop up one.

Line 7 prints a new line (line echo PHP_EOL; in PHP).

Line 8 moves the I loop up one.

I've 'nested' the listing in the example to better show the loop and loop order.

C64 counting in nybbles

Commodore VIC-20/VC-20/C64 - 95 69 68 67 tokenized BASIC bytes used (obfuscated and minimized)

0dEfnb(x)=sgn(xandb):fOi=0to10:b=8:fOj=0to3:?rI(stR(fnb(i)),1);:b=b/2:nE:?:nE

Copy and paste the above text into WinVice, for instance. Just about fits onto 80 characters on a Commodore 64.

Here's the non-obfuscated symbolic listing for illustrative purposes:

0 DEF FN B(X)=SGN(X AND B)
1 FOR I=0 TO 10
2  LET B=8
3  FOR J=0 TO 3
4   PRINT RIGHT$(STR$(FN B(I)),1);
5   LET B=B/2
6  NEXT J
7  PRINT
8 NEXT I

Of course this may be minimised and further obfuscated. Explanation:

The DEF FN command in line zero is a simple function which accepts one numeric parameter. This will give the algebraic sign the number passed to it as a parameter, in this case is ANDed with the value B (declared elsewhere, but becomes global once declared).

Line 1 starts the loop counter I

Line 2 sets the value of the 3rd BIT.

Line 3 starts loop counter J (we want bits 0 - 3 essentially).

Line 4 gets the STR$ value (string value) of the function FN B(I), this is then passed to the RIGHT$ command as CBM BASIC auto-pads outputted numbers with a white space, so we get the last character in the string created by STR$.

Line 5 moves the BIT counter down one (like x >> 1 in C I suppose).

Line 6 moves the J loop up one.

Line 7 prints a new line (line echo PHP_EOL; in PHP).

Line 8 moves the I loop up one.

I've 'nested' the listing in the example to better show the loop and loop order.

C64 counting in nybbles

Saved one whole bytes
Source Link
Shaun Bebbers
  • 2.3k
  • 16
  • 22

#Commodore VIC-20/VC-20/C64 - 95 69 6868 67 tokenized BASIC bytes used (obfuscated and minimized)

0dEfnb(x)=sgn(xandb):fOi=0to10:b=8:fOj=0to3:?rI(stR(fnb(i)),1);:b=b/2:nEjnE:?:nE

Copy and paste the above text into WinVice, for instance. Just about fits onto 80 characters on a Commodore 64.

Here's the non-obfuscated symbolic listing for illustrative purposes:

0 DEF FN B(X)=SGN(X AND B)
1 FOR I=0 TO 10
2  LET B=8
3  FOR J=0 TO 3
4   PRINT RIGHT$(STR$(FN B(I)),1);
5   LET B=B/2
6  NEXT J
7  PRINT
8 NEXT I

Of course this may be minimised and further obfuscated. Explanation:

The DEF FN command in line zero is a simple function which accepts one numeric parameter. This will give the algebraic sign the number passed to it as a parameter, in this case is ANDed with the value B (declared elsewhere, but becomes global once declared).

Line 1 starts the loop counter I

Line 2 sets the value of the 3rd BIT.

Line 3 starts loop counter J (we want bits 0 - 3 essentially).

Line 4 gets the STR$ value (string value) of the function FN B(I), this is then passed to the RIGHT$ command as CBM BASIC auto-pads outputted numbers with a white space, so we get the last character in the string created by STR$.

Line 5 moves the BIT counter down one (like x >> 1 in C I suppose).

Line 6 moves the J loop up one.

Line 7 prints a new line (line echo PHP_EOL; in PHP).

Line 8 moves the I loop up one.

I've 'nested' the listing in the example to better show the loop and loop order.

C64 counting in nybbles

#Commodore VIC-20/VC-20/C64 - 95 69 68 tokenized BASIC bytes used (obfuscated and minimized)

0dEfnb(x)=sgn(xandb):fOi=0to10:b=8:fOj=0to3:?rI(stR(fnb(i)),1);:b=b/2:nEj:?:nE

Copy and paste the above text into WinVice, for instance. Just about fits onto 80 characters on a Commodore 64.

Here's the non-obfuscated symbolic listing for illustrative purposes:

0 DEF FN B(X)=SGN(X AND B)
1 FOR I=0 TO 10
2  LET B=8
3  FOR J=0 TO 3
4   PRINT RIGHT$(STR$(FN B(I)),1);
5   LET B=B/2
6  NEXT J
7  PRINT
8 NEXT I

Of course this may be minimised and further obfuscated. Explanation:

The DEF FN command in line zero is a simple function which accepts one numeric parameter. This will give the algebraic sign the number passed to it as a parameter, in this case is ANDed with the value B (declared elsewhere, but becomes global once declared).

Line 1 starts the loop counter I

Line 2 sets the value of the 3rd BIT.

Line 3 starts loop counter J (we want bits 0 - 3 essentially).

Line 4 gets the STR$ value (string value) of the function FN B(I), this is then passed to the RIGHT$ command as CBM BASIC auto-pads outputted numbers with a white space, so we get the last character in the string created by STR$.

Line 5 moves the BIT counter down one (like x >> 1 in C I suppose).

Line 6 moves the J loop up one.

Line 7 prints a new line (line echo PHP_EOL; in PHP).

Line 8 moves the I loop up one.

I've 'nested' the listing in the example to better show the loop and loop order.

C64 counting in nybbles

#Commodore VIC-20/VC-20/C64 - 95 69 68 67 tokenized BASIC bytes used (obfuscated and minimized)

0dEfnb(x)=sgn(xandb):fOi=0to10:b=8:fOj=0to3:?rI(stR(fnb(i)),1);:b=b/2:nE:?:nE

Copy and paste the above text into WinVice, for instance. Just about fits onto 80 characters on a Commodore 64.

Here's the non-obfuscated symbolic listing for illustrative purposes:

0 DEF FN B(X)=SGN(X AND B)
1 FOR I=0 TO 10
2  LET B=8
3  FOR J=0 TO 3
4   PRINT RIGHT$(STR$(FN B(I)),1);
5   LET B=B/2
6  NEXT J
7  PRINT
8 NEXT I

Of course this may be minimised and further obfuscated. Explanation:

The DEF FN command in line zero is a simple function which accepts one numeric parameter. This will give the algebraic sign the number passed to it as a parameter, in this case is ANDed with the value B (declared elsewhere, but becomes global once declared).

Line 1 starts the loop counter I

Line 2 sets the value of the 3rd BIT.

Line 3 starts loop counter J (we want bits 0 - 3 essentially).

Line 4 gets the STR$ value (string value) of the function FN B(I), this is then passed to the RIGHT$ command as CBM BASIC auto-pads outputted numbers with a white space, so we get the last character in the string created by STR$.

Line 5 moves the BIT counter down one (like x >> 1 in C I suppose).

Line 6 moves the J loop up one.

Line 7 prints a new line (line echo PHP_EOL; in PHP).

Line 8 moves the I loop up one.

I've 'nested' the listing in the example to better show the loop and loop order.

C64 counting in nybbles

deleted 16 characters in body
Source Link
The Fifth Marshal
  • 6.3k
  • 1
  • 25
  • 44

#Commodore VIC-20/VC-20/C64 (non-competing) - 95 69 68 tokenized BASIC bytes used (obfuscated and minimized)

0dEfnb(x)=sgn(xandb):fOi=0to10:b=8:fOj=0to3:?rI(stR(fnb(i)),1);:b=b/2:nEj:?:nE

Copy and paste the above text into WinVice, for instance. Just about fits onto 80 characters on a Commodore 64.

Here's the non-obfuscated symbolic listing for illustrative purposes:

0 DEF FN B(X)=SGN(X AND B)
1 FOR I=0 TO 10
2  LET B=8
3  FOR J=0 TO 3
4   PRINT RIGHT$(STR$(FN B(I)),1);
5   LET B=B/2
6  NEXT J
7  PRINT
8 NEXT I

Of course this may be minimised and further obfuscated. Explanation:

The DEF FN command in line zero is a simple function which accepts one numeric parameter. This will give the algebraic sign the number passed to it as a parameter, in this case is ANDed with the value B (declared elsewhere, but becomes global once declared).

Line 1 starts the loop counter I

Line 2 sets the value of the 3rd BIT.

Line 3 starts loop counter J (we want bits 0 - 3 essentially).

Line 4 gets the STR$ value (string value) of the function FN B(I), this is then passed to the RIGHT$ command as CBM BASIC auto-pads outputted numbers with a white space, so we get the last character in the string created by STR$.

Line 5 moves the BIT counter down one (like x >> 1 in C I suppose).

Line 6 moves the J loop up one.

Line 7 prints a new line (line echo PHP_EOL; in PHP).

Line 8 moves the I loop up one.

I've 'nested' the listing in the example to better show the loop and loop order.

C64 counting in nybbles

#Commodore VIC-20/VC-20/C64 (non-competing) - 95 69 68 tokenized BASIC bytes used (obfuscated and minimized)

0dEfnb(x)=sgn(xandb):fOi=0to10:b=8:fOj=0to3:?rI(stR(fnb(i)),1);:b=b/2:nEj:?:nE

Copy and paste the above text into WinVice, for instance. Just about fits onto 80 characters on a Commodore 64.

Here's the non-obfuscated symbolic listing for illustrative purposes:

0 DEF FN B(X)=SGN(X AND B)
1 FOR I=0 TO 10
2  LET B=8
3  FOR J=0 TO 3
4   PRINT RIGHT$(STR$(FN B(I)),1);
5   LET B=B/2
6  NEXT J
7  PRINT
8 NEXT I

Of course this may be minimised and further obfuscated. Explanation:

The DEF FN command in line zero is a simple function which accepts one numeric parameter. This will give the algebraic sign the number passed to it as a parameter, in this case is ANDed with the value B (declared elsewhere, but becomes global once declared).

Line 1 starts the loop counter I

Line 2 sets the value of the 3rd BIT.

Line 3 starts loop counter J (we want bits 0 - 3 essentially).

Line 4 gets the STR$ value (string value) of the function FN B(I), this is then passed to the RIGHT$ command as CBM BASIC auto-pads outputted numbers with a white space, so we get the last character in the string created by STR$.

Line 5 moves the BIT counter down one (like x >> 1 in C I suppose).

Line 6 moves the J loop up one.

Line 7 prints a new line (line echo PHP_EOL; in PHP).

Line 8 moves the I loop up one.

I've 'nested' the listing in the example to better show the loop and loop order.

C64 counting in nybbles

#Commodore VIC-20/VC-20/C64 - 95 69 68 tokenized BASIC bytes used (obfuscated and minimized)

0dEfnb(x)=sgn(xandb):fOi=0to10:b=8:fOj=0to3:?rI(stR(fnb(i)),1);:b=b/2:nEj:?:nE

Copy and paste the above text into WinVice, for instance. Just about fits onto 80 characters on a Commodore 64.

Here's the non-obfuscated symbolic listing for illustrative purposes:

0 DEF FN B(X)=SGN(X AND B)
1 FOR I=0 TO 10
2  LET B=8
3  FOR J=0 TO 3
4   PRINT RIGHT$(STR$(FN B(I)),1);
5   LET B=B/2
6  NEXT J
7  PRINT
8 NEXT I

Of course this may be minimised and further obfuscated. Explanation:

The DEF FN command in line zero is a simple function which accepts one numeric parameter. This will give the algebraic sign the number passed to it as a parameter, in this case is ANDed with the value B (declared elsewhere, but becomes global once declared).

Line 1 starts the loop counter I

Line 2 sets the value of the 3rd BIT.

Line 3 starts loop counter J (we want bits 0 - 3 essentially).

Line 4 gets the STR$ value (string value) of the function FN B(I), this is then passed to the RIGHT$ command as CBM BASIC auto-pads outputted numbers with a white space, so we get the last character in the string created by STR$.

Line 5 moves the BIT counter down one (like x >> 1 in C I suppose).

Line 6 moves the J loop up one.

Line 7 prints a new line (line echo PHP_EOL; in PHP).

Line 8 moves the I loop up one.

I've 'nested' the listing in the example to better show the loop and loop order.

C64 counting in nybbles

Added screen shot and small typo corrected
Source Link
Shaun Bebbers
  • 2.3k
  • 16
  • 22
Loading
I finally got around to explaining the CBM BASIC listing (i.e., got fed up with PHP a bit) + small amend
Source Link
Shaun Bebbers
  • 2.3k
  • 16
  • 22
Loading
Added in that it's a non-competing entry, which should be obvious but just in case it isn't.
Source Link
Shaun Bebbers
  • 2.3k
  • 16
  • 22
Loading
A further saving of one whole BASIC token
Source Link
Shaun Bebbers
  • 2.3k
  • 16
  • 22
Loading
BASIC tokens saved edition
Source Link
Shaun Bebbers
  • 2.3k
  • 16
  • 22
Loading
Source Link
Shaun Bebbers
  • 2.3k
  • 16
  • 22
Loading