Former player
Joined: 9/3/2012
Posts: 40
Location: boston
OmnipotentEntity wrote:
The youtube video. The 9 digit is visually shifted to the right a little bit and cut off.
That's actually me being really bad at drawing nines :( Next update I'll get my friend to touch it up so it looks nicer.
Player (36)
Joined: 9/11/2004
Posts: 2630
bortreb wrote:
OmnipotentEntity wrote:
The youtube video. The 9 digit is visually shifted to the right a little bit and cut off.
That's actually me being really bad at drawing nines :( Next update I'll get my friend to touch it up so it looks nicer.
Oh? I thought you read the font from the ROM. Wouldn't it be easier to read the font from the ROM?
Build a man a fire, warm him for a day, Set a man on fire, warm him for the rest of his life.
Player (42)
Joined: 12/27/2008
Posts: 873
Location: Germany
Any updates on this?
Former player
Joined: 9/3/2012
Posts: 40
Location: boston
I'm still alive, but school has prevented me from doing any any significant work on it. I will revisit this later, but for now I don't think I have the time to work on it until school lets up. So, what do you all recommend I do? Should I submit the video as is, then batch up all the improvements I've learned about from you all in another submission sometime in the future, or should I just wait until I can get the item-buying part down by a few minutes?
BigBoct
He/Him
Editor, Former player
Joined: 8/9/2007
Posts: 1692
Location: Tiffin/Republic, OH
Even if the entertainment isn't as good as it could be, I think it's well worth publishing as a Moon at this point, especially considering the technical achievement.
Previous Name: boct1584
Editor, Experienced player (569)
Joined: 11/8/2010
Posts: 4034
Since you're not able to finish the improvement right now, I think you should go ahead and submit it.
Former player
Joined: 9/3/2012
Posts: 40
Location: boston
Alright, I'll submit it as a Moon. When I get some more free time I'll work on making it shorter. Of course, anyone who wants is welcome to work on their own hack using this run and all the automation code I wrote as a base. Thanks everyone for all your help!
Former player
Joined: 9/3/2012
Posts: 40
Location: boston
I have submitted my video. It is at http://tasvideos.org/3767S.html I am not sure why it says that it takes 5 seconds..... Please let me know if I've done anything wrong, since it's my first time. Thanks!
Former player
Joined: 9/3/2012
Posts: 40
Location: boston
I think that It's trying to extract the rerecord count and total length from the header of the vbm file. Since I wrote my own program to output this file, that header is wrong. That's most likely what happened. Can I change the time manually somehow?
Active player (322)
Joined: 1/15/2012
Posts: 343
I think you can hex-edit your .vbm, the number of frame is at 00C, OOD (the 59 01 = 159 hex = 345 dec, it should be replaced by E9 B4 = B4E9 hex = 46313 dec) I think. You can check the wiki about that :) EDIT : That's strange, when I runned the movie in vba, it automatically changed the 59 01 to E8 B4.
Former player
Joined: 9/3/2012
Posts: 40
Location: boston
Thanks! So should I fix it and then update or should I not? And how do I change the submission now that it's already submitted?
Spikestuff
They/Them
Editor, Publisher, Expert player (2630)
Joined: 10/12/2011
Posts: 6435
Location: The land down under.
bortreb wrote:
Thanks! So should I fix it and then update or should I not? And how do I change the submission now that it's already submitted?
Update it.... what you do is link your improvement someone will replace it
WebNations/Sabih wrote:
+fsvgm777 never censoring anything.
Disables Comments and Ratings for the YouTube account. Something better for yourself and also others.
Former player
Joined: 9/3/2012
Posts: 40
Location: boston
It appears that just changing that one part of the header didn't work. Now the total time is much larger :(. Here's my header: 00000000: 5642 4d1a 0100 0000 694a 584f b4e8 0000 VBM.....iJXO.... 00000010: 0000 0000 0001 0270 0000 0000 0000 0000 .......p........ 00000020: 0100 0000 504f 4b45 4d4f 4e20 5945 4c4c ....POKEMON YELL 00000030: 0197 7c04 0300 0000 0000 0000 0001 0000 ..|............. 00000040: 5f5f 5f5f 5f5f 5f5f 5f5f 5f5f 5f5f 5f5f ________________ 00000050: 526f 6265 7274 2020 4d63 496e 7479 7265 Robert McIntyre 00000060: 5f5f 5f5f 5f5f 5f5f 5f5f 5f5f 5f5f 5f5f ________________ 00000070: maybe the 694a should be 0000? I will investigate...
Editor, Expert player (2071)
Joined: 6/15/2005
Posts: 3282
I have already replaced the file with the correct time. Sorry about that.
Former player
Joined: 9/3/2012
Posts: 40
Location: boston
Even stranger --- In my visual boy advance the frames are 46313 and not 16777561 as the submission now reports.....
Former player
Joined: 9/3/2012
Posts: 40
Location: boston
Oh, thanks so much FractalFusion.
Editor, Expert player (2071)
Joined: 6/15/2005
Posts: 3282
No problem. I think VBA reports the true frame time (based on filesize). So VBA gives the correct time.
Active player (322)
Joined: 1/15/2012
Posts: 343
So, if we want to improve the current run, we can : -Use p4wn3r's function, so we don't have to go to Celadon anymore -Use subframe (not supported by VBA yet) -Create a game under 36kb (?). ... I don't know how the GameBoy works, but if we make a game in C using the GBDK and then copy the hex of the executable, would it work ? Or if we directly copy the hex of an already existing ROM ? That sounds wrong, as the GB doesn't have any OS to execute a code like that, but yet again I don't know how the GB works... :/
Spikestuff
They/Them
Editor, Publisher, Expert player (2630)
Joined: 10/12/2011
Posts: 6435
Location: The land down under.
bortreb Can you record how you did it because I cannot even figure out how to do it.
WebNations/Sabih wrote:
+fsvgm777 never censoring anything.
Disables Comments and Ratings for the YouTube account. Something better for yourself and also others.
Former player
Joined: 9/3/2012
Posts: 40
Location: boston
Spikestuff wrote:
bortreb Can you record how you did it because I cannot even figure out how to do it.
First, I have a bot that interacts with the bootstrapping program so that I can copy any code anywhere I want. Then, I write the program at the end in machine language using a primitive macro-based compiler that I wrote in clojure. I thought about using the C development kits to make the program, but ultimately didn't go through with it for two reasons: - You can't control the actual memory position for the output code, which makes it impossible to write non-relocatable/self-modifying code. - You can't use interrupts, so much of the "standard" library is not that useful. So I ended up just using a very basic clojure compiler I wrote myself to output that last program, and then put the machine code through my bot which wrote it to memory. If you wanted to use the development kits, then I'm sure there's a way to grab non-relocatable contiguous object files out of the compiler output and use those. It was just more trouble than it was worth for my small program. Also, copying the ROM/RAM of another game will in general not work too well, since that code is too large and uses interrupts. However, you can certainly copy specific routines/sprites from other game ROMs with no problem. You might also be able to compile a small game targeting a smaller system with much smaller specs, and then translate and copy that image into the gameboy. (I'm thinking something like pong/pacman/tetris here). The problem there is that it would be hard to translate the audio/visual direct accessing parts. Maybe the easiest way to make a bigger program would be to compile that program using the C development kit, then massage that ROM image into a form that can be written to RAM. Then, you can fuse the decompressor with the bootstrapping program and write the compressed image to RAM. Does that help?
Active player (322)
Joined: 1/15/2012
Posts: 343
"- You can't control the actual memory position for the output code, which makes it impossible to write non-relocatable/self-modifying code. - You can't use interrupts, so much of the "standard" library is not that useful. " Can we use go to ? I know that in normal programmation this is never a good idea, but in assembly the jump function is the only way I found to solve these cases : - Create a pointer to an adress - Use jump "this pointer" / go to "this pointer" "You might also be able to compile a small game targeting a smaller system with much smaller specs, and then translate and copy that image into the gameboy. (I'm thinking something like pong/pacman/tetris here)." I was thinking about pong indeed. I'm wondering now... How do you make the music ? Using different frequencies ? If so, it would take ages to make the music of a complexe game :/ But if it's too hard to make a game, we can also try to just make a "wrong ending", like the credits of another game :p Sorry if those are basics question, I'm not an IT engineer (yet), but I'm really interested in how this run works :p
Emulator Coder, Skilled player (1112)
Joined: 5/1/2010
Posts: 1217
STBM wrote:
Can we use go to ? I know that in normal programmation this is never a good idea, but in assembly the jump function is the only way I found to solve these cases : - Create a pointer to an adress - Use jump "this pointer" / go to "this pointer"
Most instructions (those that don't involve interrupts or loads from fixed addresses) are fair game. All jump type instructions except restart (RST) and return&enable interrupts (RETI) are of that type. So the "goto" instruction (JP), and its conditional version (JR) is fair game. The only instructions that seem to be problematic are: * HALT (Halt processor until interrupt: Involves interrupts) * STOP (Halt processor until reset: Crashes) * EI (Enable Interrupts: Involves interrupts) * RST (Call special vector: Vectors are in ROM space) * RETI (Return and enable interrupts: Involves interrupts)
Editor, Emulator Coder, Site Developer
Joined: 5/11/2011
Posts: 1108
Location: Murka
Note that the common "wait for vblank" task can be done without interrupts on a GB: just spin on the appropriate status register. Not so good for battery life, but otherwise fine.
Editor, Expert player (2071)
Joined: 6/15/2005
Posts: 3282
I'm experimenting with making a total control hack using as little time to set up as possible. Noting that it is possible to switch 11-byte blocks (thanks p4wn3r), I've been planning to inject the following byte sequence into D358:
00 21 FF D3 AF 4F 7C F3 E2 F2 BA 28 F9 5F CB 37 AA 32 53 20 F1 58 D3
Notice that this sequence is 23 bytes long, and D359 is the start of an 11-byte block. The byte sequence has to be carefully chosen since not all items are tossable (and some of them crash when selected). I also want the program to be zero-free, except for D358. Explanation:
00            NOP (item hack)
21 FF D3      LD HL D3FF
AF            XOR A (A:=0)
4F            LD C A (C:=A)
input:
7C            LD A H (A:=H, works because D3 has bit 4 on and bit 5 off)
F3            DI (disable interrupts)
E2            LDH (C) A ((FF00):=A)
F2            LDH A (C) (A:=(FF00))
BA            CP D (check input changed)
28 F9         JR Z input (if not, goto input)
5F            LD E A (E:=A)
CB 37         SWAP A (swap nibbles)
AA            XOR D (XOR with last input)
32            LDD (HL), A (write A to memory pointed by HL and decrement HL)
53            LD D E (D:=E, new last input)
20 F1         JR NZ input (goto input; NZ is for item hack)
58 D3         (not executed) (this pointer falls on D36D and jumps to D358) 
This program starts writing from D3FF backwards. It writes a "nibble chain program" in which the low nibble of byte N is the same as the high nibble of byte N+1. Also, the nibbles of a byte cannot be the same. Input is A, B, Select, Start which can write any nibble values from 0x0 to 0xF. The program is set up so that when writing backwards, it will trample D36C (the F1 in "20 F1", or JR NZ input) which would allow jumping to the new program. I still have to check that a valid program can be written but I am confident that it can be done. I made a movie (starting from savestate) showing how the 23 bytes above can be injected into D358 (actually, I made a mistake and used D4 instead of D3 in "21 FF D3", or LD HL D3FF). This is how (after reset and continue): - Switch the 6th and 10th pokemon to overwrite the item counter. - Throw away the 3rd item; this messes up all the game settings and causes text to appear instantly. - Switch the 9th and 11th pokemon; this fills the item area with FF, which is much faster to scroll through (this is why I aim for a zero-free program, since it is not possible to get 0 if the item quantity is 0xFF). - Toss items so that half the bytes of D322-D337 are set to the program above (excluding initial NOP). - Switch the 17th and 18th pokemon; this switches D322-D32C with D32D-D337 to switch item parity. - Toss items to complete D322-D32C and D32D-D337 (these are still switched). - Switch the 17th and 19th pokemon; this sends D322-D32C to D338-D342 so D32D-D342 contains the program (except for the initial NOP) in the correct order. - Switch the 16th and 17th pokemon; since D321 is 0, this sends D317-D321 to D322-D32C so D32C becomes 0, so D32C-D342 contains the above program. - Finally, switch the 11th and 12th pokemon; this sends D32C-D342 to D358-D36E. - Close the menu. Since most of the time is spent scrolling through numbers, it may be possible to optimize further by having a program that may be longer but has numbers closer to 0xFF and 0x00. Numbers close to 0x80 take the longest.
Player (42)
Joined: 12/27/2008
Posts: 873
Location: Germany
Did you consider using the built-in ROM input function? I've read the GBC documentation and it seems that to call it you'd have to attempt to write the value 3 to any address on the range 0x2000-0x3fff (this will switch the 0x4000-0x7fff area to bank 3), and then call 0x4004 or 0x4000 (there's a logic right after 4000 that may cause the routine to not read the input, calling 4004 will make it read for sure). I still have to read more if there's any chance of an NMI coming and switching the bank away, though this likely doesn't happen (unless the guys who designed the architecture want to give headaches to developers). I'm not very sure if this saves time though, since you're already using very few bytes. The biggest advantage of this would be getting 8 bits a frame instead of 4, but the bottleneck is clearly scrolling time. EDIT: It seems things get much simpler if you can just use the instruction HALT, after going back from the HALT, the first thing the game does is read input to FFF5, and it goes back from the halt once per frame, so the logic to check if input changed goes away. What happens when you use a HALT? You're running the code in that region through a function pointer, being able to HALT correctly in that part might be doable, maybe we're just one memory write away from it.