Release

Shuk’s Challenges #1

4

Shuk 2024-03-27 23:24 (Edited)

Yep I added credits so this won’t be taken down. You’re welcome.
(I added a bit more to make it cheesier and yes, I am so lazy I added just a new fresh look his official name is Shuuk now)

SC2 (Shuk’s Challenge #2) is now out!

Made it shorter.nx | Open in app
2024-03-27 23:36
Made it shorter.nx | Open in app
2024-03-27 23:33
.nx | Open in app
2024-03-27 23:24

Shuk 2024-03-27 23:28

I did this in 5 seconds probably the fastest time to “make” a programme. Try to beat me, I would like to see you try >:D


Shuk 2024-03-27 23:34 (Edited)

BAM new version now with Ctrl C + V Edit: I yanked it from the tutorial technically, making a functional programme. So if you say: “Um actually, you need to code it on your own.” I never ever said that I need to make my own code. But if you won’t budge, check out the first version.


McPepic 2024-03-27 23:45

OK, hear me out:

Made it shorter.nx | Open in app
2024-03-27 23:45

Vilua 2024-03-27 23:46

Are you challenging me?


Shuk 2024-03-27 23:47

McPepic, how long did it take?


McPepic 2024-03-27 23:55

I didn't keep track, but probably a few seconds. I only had to change a couple of lines. On a side note, what's going on with the profiles here? I see a blank username, which means you can't click to go to the programs and in the HTML it's showing two separate users: 1569 and 1546.


Shuk 2024-03-27 23:57 (Edited)

Oh wait I will change it because maybe the website has this bug. Edit: I think it’s because someone already claimed that site-breaking username.


McPepic 2024-03-28 00:00

Yeah, I don't know why the website's having trouble with this post, but the name of it won't show up in my notifications, either.


Shuk 2024-03-28 00:04

I think now you can see what Me did and my username the first two letters of my pet then, uk because most sites have .co.uk.


Timo 2024-03-28 09:09

What is the site-breaking username?? Empty?? Maybe I can easily fix it...


McPepic 2024-03-28 15:36

@Timo It seems to have been resolved by a username and post title change. My notifications from this post are also showing up correctly now, too.


Timo 2024-03-28 17:17

I mean how did the username and title look like before, when it was broken? I could maybe do a simple fix to prevent this in the future.


McPepic 2024-03-28 17:42

@Timo
There was no username displayed over the comment - just the text between the text from the comment between the two separating lines. The name also didn’t appear in notifications. The title showed up on the post, but not in notifications, so when @Shuk posted a comment on this, there was no text to click on for the username or the post in my notifications. The only way to go to @Shuk’s profile was to open up the HTML for the page and click on the link. The website seems to have recognized the username and title, but when it tried to retrieve the name of either, it received a blank string.


was8bit 2024-03-29 00:11

Remixed...


Shuk 2024-03-29 19:57

@was8bit how long that did that thing took ya?


Shuk 2024-03-29 20:02

Timo maybe if you add a massage saying “Sorry, must include letters.” When creating an account and hopefully, fix the bug.


was8bit 2024-03-30 03:36 (Edited)

Shuk, I just enjoy experimenting and remixing code is a fun thing to do… just to see what you can do …

Feel free to experiment and remix anything I have posted… and if you like your remixed version you can share it, just be sure to post it as a REMIX :)


SP4CEBAR 2024-04-03 13:29 (Edited)

This is just as short as the previous record (both have 166 characters excluding spaces), but it works nonetheless, I think I've had fun.

I=0
S=$FE00
G=$FF70
POKE G-80,1
POKE G+6,1
FILL S,2,50
DO
  I=1-I
  POKE I+S,PEEK(I+S)+PEEK($8010+(PEEK(G) AND 3))-1
  ROR G,2
  IF I=0 THEN WAIT 1
LOOP
#2:C
FFFFFFFFFFFFFFFF7F7F7FFFFEB686FE
01000201

Initialization:
Poke both backgrounds off
Poke the gamepad on
Fill sprite zero's position to a visible location on the screen

Loop:
"I" is inverted.
Set sprite zero's X or Y position to its current position plus the direction. The direction is the value given at the ROM location between $8010 and $8010 +3, this ROM value is decremented to make a direction of negative 1 possible. The value within the ROM location is determined by the lowest two bits of the gamepad 0 input register. By default, these are the up and down bits respectively. However, If I use ROR G,2, I can move the left and right bits to this location too. Wait VBL is executed every second loop (because each loop handles one coordinate at a time).

Does anyone know a way to make this shorter?


SP4CEBAR 2024-04-03 13:47 (Edited)

I think I'm getting somewhere: one direction at a time, and it's one character shorter (excluding spaces)

I=0
D=1
S=$FE00
G=$FF70
POKE G-80,1
POKE G+6,1
FILL S,2,50
DO
  D=-D
  POKE I+S,PEEK(I+S)+D*(PEEK(G) AND 1)
  ROR G,1 
  IF D=1 THEN
    I=1-I
    IF I THEN WAIT 1
  END IF
LOOP
#2:C
FFFFFFFFFFFFFFFF7F7F7FFFFEB686FE


SP4CEBAR 2024-04-04 23:35 (Edited)

This custom interpreter can move the box!

W=$8010
DO
A=PEEKW(W)+2^16
G=PEEKW(W+3)+2^16
POKE A,PEEK(A)+PEEK(W+2)*(PEEK(G) AND 1)
ROR G,1
W=PEEK(W+5)+$8010
IF W=$8028 THEN WAIT 1
LOOP
#2:C
FFFFFFFFFFFFFFFF7F7F7FFFFEB686FE
20FFFA008006
76FF0100800C
00FE50008012
01FE50008018
01FEFF70FF1E
01FE0170FF24
00FEFF70FF2A
00FE0170FF18

These 8 instructions occupy 6 bytes each.

W holds the address in memory of the current instruction Each instruction has 4 parameters:

  1. A (found at W+0) is the address of the memory location to modify
  2. (found at W+2) is the value to add to the value at memory location A. You can get the effect of negative numbers (subtracting) within this byte using $100 minus this value as a value.
  3. G (found at W+3) is the address of either the user input register or it points to a sequence of eight 1's to neutralize any effects. And have parameter 2's value be THE value.
  4. (found at W+5) contains the next instruction's address with $8010 subtracted from it so that this address information fits in a single byte. This allows it to run a bit of setup code, and then run a loop

What do the instructions do?

  1. Turn both backgrounds off, and go to 2.
  2. Turn the gamepad on, and go to 3.
  3. Center the sprite's X coordinate, go to 4.
  4. Center the sprite's Y coordinate, go to 5.
  5. Step in negative Y if the up button is pressed, go to 6.
  6. Step in positive Y if the down button is pressed, go to 7.
  7. Step in negative X if the left button is pressed, go to 8.
  8. Step in positive X if the right button is pressed, go to 5.

Detailed description

  1. Turn both backgrounds off. This could be done with NX commands or with "POKE $FF20, 1", but instead, it looks like this: "20FF FA 0080 06". This translates to modifying the value at $FF20, adding $FA (which equates to -6) to it, $8000 can be ignored, and at $8010+6 = $8016 is the next instruction
  2. Turn the gamepad on. This could be done with "POKE $FF76, 1", but it looks like this: 76FF 01 0080 0C This means: add 1 to the value at $FF76, and at $801C is the next instruction
  3. Center the sprite's X coordinate. Instead of "POKE $FE00, 80", it's: 00FE 50 0080 12. This means: add 5 to the value at $FE00, then go to $8022.
  4. Center the sprite's Y coordinate. "POKE $FE01, 80" looks like this "01FE 50 0080 18". Which is very similar to the previous instruction.
  5. Step in negative Y if the up button is pressed looks like "01FE FF 70FF 1E". If the least significant bit of the gamepad register byte at $FF70 is on then $FF (equivalent to -1) is added to the sprite's Y position at $FE01.
  6. Step in positive Y if the down button is pressed. "01FE 01 70FF 24" is similar to the previous but it adds 1 instead of subtracting 1.
  7. Step in negative X if the left button is pressed. "00FE FF 70FF 2A" is similar to 6 but it modifies the sprite's X register instead.
  8. Step in positive X if the right button is pressed. "00FE 01 70FF 18" is similar to the previous one but adds 1 instead of subtracting one. The next instruction is at $8028 which is the fifth operation.

Side note

Location $8000 (the character image data) contains a byte with the data $FF, the code uses this as a dummy byte, to keep the bit shifter and the logical AND busy when they aren't needed without those operations modifying anything.


SP4CEBAR 2024-04-04 23:49 (Edited)

Still... this is shorter

POKE $FF20,1
GAMEPAD 1
FILL $FE00,2,80
DO
  SPRITE 0,SPRITE.X(0)+LEFT(0)-RIGHT(0),SPRITE.Y(0)+UP(0)-DOWN(0),1
  WAIT 1
LOOP
#2:C
FFFFFFFFFFFFFFFF7F7F7FFFFEB686FE


was8bit 2024-04-05 03:34

Wowzers!!!! \(oOo)/


Log in to reply.