100 Days of Code Day 29
Why do logins insist on timing out a login after a few weeks. I have seen both exercism and wordpress do it. Well today exercism did it. I thought I could just login with my github credentials but that just made a completely new blank account. I thought I lost everything for a minute.
Then I logged out and logged back in with the correct credentials. Crisis averted, but they almost lost a user about password pedancy. Maybe just let me tell you if I am not at home, and don’t make me jump through hoops when I am at home.
Anyway, today’s exercise was Matrix. Given a string with rows separated by newline characters and numbers separated by spaces create a NxM array for that matrix (technically mine is a ragged array). Then you want to be able to return the data in row order or column order. For the column order I also made a transposed version and just return that.
This was more difficult than expected. Maybe that was just me trying to be fancy with things like map() instead of using a plain old for loop. Also for in, is not the same as for of. One of them breaks on arrays the other doesn’t.
Onto the GameBoy programming side of things. Another day, another round of constant changed from the book to current version in the hardware include file.
| Book | CURRENT |
|---|---|
| P1F_GET_DPAD | JOYP_GET_CTRL_PAD |
| P1F_GET_BTN | JOYP_GET_BUTTONS |
| P1F_GET_NONE | JOYP_GET_NONE |
| _RAM | Not Found |
| PADF_START | PAD_START |
| PADF_SELECT | PAD_SELECT |
| PADF_A | PAD_A |
| PADF_B | PAD_B |
| PADF_UP | PAD_UP |
| PADF_DOWN | PAD_DOWN |
| PADF_LEFT | PAD_LEFT |
| PADF_RIGHT | PAD_RIGHT |
| IEF_HILO | IF_JOYPAD |
| _SRCN0 | TILEMAP0 |
| SCRN_VX_B | TILEMAP_WIDTH |
By the way, you can use rJOYP instead of rP1, but rP1 still works fine. I like the naming of rJOYP so I used that instead.
Anyway today I got through the input chapter (Chapter 8). The author doesn’t like reading the input by interrupt. I thought surely the bits marked selector would say if we were getting the input from the joypad or the buttons.
To test this I changed his example code to add two more bits. Guess what, I was totally wrong. Those bits never changed one bit, and the author was completely right, the interrupt method stinks.
Sound is the next chapter. It is a long one I expect it to take a few days.
