Author Topic: Portal Prelude  (Read 258002 times)

0 Members and 1 Guest are viewing this topic.

Offline Builderboy

  • Physics Guru
  • Project Author
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Portal X
« Reply #195 on: May 07, 2010, 12:52:20 am »
Alright i was experimenting with self modifying code and actually got it to work a little! :D I managed to change a 123->A into a 255->A ;D So theoretically if i needed to i could do some code swapping for different sections of the game, like game vs main menu.  I want to automate it though, so i dont have to count byes.  Maybe like 12345->A and then have the sub search for 12345 in the program.  I need to do some more experimentation though...  this stuff is weird ;D Is there any way to find the current location of program  execution?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Portal X
« Reply #196 on: May 07, 2010, 12:54:51 am »
Did you use inline assembly for this? I think SirCmpwn wrote a routine for SMC IIRC.

Offline Builderboy

  • Physics Guru
  • Project Author
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Portal X
« Reply #197 on: May 07, 2010, 12:55:53 am »
Nope, you can write to memory using the brackets {} so its all still in Axe :) You just have to figure out where your program is ;)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Portal X
« Reply #198 on: May 07, 2010, 01:28:43 am »
OOOH I see! yay for memory addresses

I guess you really need to figure out the exact thing to modify in the code, though. You should post a tutorial on how to do this (especially figuring out where's located the program) at one point. It might be nice for people who don't want external save files

Also, is everything going OK about fitting the game in 8.1 KB?
« Last Edit: May 07, 2010, 01:29:24 am by DJ Omnimaga »

Offline Builderboy

  • Physics Guru
  • Project Author
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Portal X
« Reply #199 on: May 07, 2010, 01:35:59 am »
Yeah, i did some mad optimizing, and got all the executable code down to 7400 bytes right now, so that leaves me about 1400 bytes for all the other features i am planning.  I just finished a major code reworking, where i moved things into subs and moved pieces of code around, and i optimized the heck out of everything ;D so i am hopeful.  Also this new version of Axe should hopefully cut down on a lot of the size  *crosses fingers*

This self modifying code is weird though, because at some point you have to say "switch these two places of code" and you have to make sure you arn't in either of those places, or else bad things happen :P and you also have to make sure you know how to get back... I definetaly will post a tutorial once i figure it out :)

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Portal X
« Reply #200 on: May 07, 2010, 02:06:10 am »
cool to hear ^^

Offline Builderboy

  • Physics Guru
  • Project Author
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Portal X
« Reply #201 on: May 13, 2010, 10:42:36 pm »
So i have reworked a lot of the code to make the portal code general, so that other objects will be able to travel through Portals as well.  Once i finished that, i was able to put together a basic plasma ball screenie! Enjoy! :)

I am also running our of memory fast D: I need to move the map code into another page, as soon as i figure out how to fix the page switching, and i have about 1000 bytes left to code in boxes, plasma, and other things D: I will probably email some of my code to Quigibo too and we can optimize together maybe.
« Last Edit: March 01, 2011, 09:12:38 pm by Builderboy »

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: Portal X
« Reply #202 on: May 13, 2010, 10:48:08 pm »
That's awesome Builderboy!  Great job!  I can't wait to see more. :D

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Portal X
« Reply #203 on: May 14, 2010, 12:31:00 am »
wow awesome to see projectiles moving! Nice job again!

Good luck on the memory issue

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Portal X
« Reply #204 on: May 14, 2010, 12:40:03 am »
I'd definitely like to help you optimize.  I haven't been programming in Axe as much as I should, I really should see what repeated actions programmers do the most and try to make optimized assembly routines for both those due to readability in the source as well as smaller faster execution.
« Last Edit: May 14, 2010, 12:40:38 am by Quigibo »
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline meishe91

  • Super Ninja
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2946
  • Rating: +115/-11
    • View Profile
    • DeviantArt
Re: Portal X
« Reply #205 on: May 14, 2010, 12:58:13 am »
That looks really awesome, Builder. I hope things go well with the optimizations and page switching!
Spoiler For Spoiler:



For the 51st time, that is not my card! (Magic Joke)

Offline Galandros

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1140
  • Rating: +42/-10
    • View Profile
Re: Portal X
« Reply #206 on: May 14, 2010, 08:54:49 am »
Interesting SMC in Axe Parser... Quigibo, you could give documentation on how to do SMC in Axe Parser. For example in this case:
:Lbl AA
:255->A
:123->{AA+0}
Is it 0 or other offset? I also I don't know if AA is usable in indirection but you get the point.

The SMC writeback that SirCmpwn did is if you want to store save data permanently in the original program. When you run an assembly program, you are actually executing a copy of it into a fixed address.
« Last Edit: May 14, 2010, 08:58:28 am by Galandros »
Hobbing in calculator projects.

Offline calcdude84se

  • Needs Motivation
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2272
  • Rating: +78/-13
  • Wondering where their free time went...
    • View Profile
Re: Portal X
« Reply #207 on: May 14, 2010, 09:07:05 pm »
Depending on how the program is compiled, that might not work. For example, if the compiled code is: (var_a is the pointer to A)
Code: [Select]
AA:
ld hl,255
ld (var_a),hl
ld a,123
ld (AA),a
That doesn't work, and changes the ld hl part of the instruction, not the 255.
123->{AA} should be 123->{AA+1}r for the above to work correctly, making the ASM
Code: [Select]
AA:
ld hl,255
ld (var_a),hl
ld hl,123
ld (AA+1),hl
To do SMC would require anticipating the resulting ASM, a rather difficult task. I don't even know if that's how the program would compile. :)
"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Spoiler For "PartesOS links":
I'll put it online when it does something.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Portal X
« Reply #208 on: May 14, 2010, 09:22:14 pm »
Ya, smc would most likely not be supported.  There is very little gain in terms of size or speed that you get with smc.  I'm also not supporting using labels as numbers, becasue you have no idea how the code is going to compile and it can always change in the future when I start doing more optimizations.  It would be too version specific becasue I anticipate changes in how the executables are made (not the syntax itself).
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Portal X
« Reply #209 on: May 14, 2010, 09:23:27 pm »
Yeah I agree. Personally I would rather rely on external data for save file storage