Math Is Fun Forum

  Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

#351 2012-03-22 08:27:06

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

Hi John;

Good to hear about your hand. Maybe you have a slight touch of Arthritis in there as well.

Have fun designing the game!


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#352 2012-03-22 08:31:28

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

thanks!  i'm writing it all in debug.exe from xp, comes with windows, but i think they discontinued giving the program out in windows 7, based on a rental company in town, and debug wasn't found when i typed it in to a DOS comand window.  Nevertheless, i made a copy of it on a memory stick
for the future if it still works.  So this means i am using assembly language or machine code, they are one and the same, except debug knows the words for the hex values so i can type english commands like mov dx,b800 and mov ds,dx and cmp si,2000, etc...


igloo myrtilles fourmis

Offline

#353 2012-03-22 08:36:17

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

Hi John;

There are other assemblers, at least there used to be. I remember using Masm and Nasm. Clever to grab debug off of another OS.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#354 2012-03-22 19:05:54

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

Another neat command in debug.exe is the "m" command which lets you compact code you have padded with "nop"s (90H) after you have it working.  You have to be careful that the jmp commands still jump to the right places though or fix them. 
"ja" and "jb" seem to be relative so they don't have problems if you "m" (move) them.


igloo myrtilles fourmis

Offline

#355 2012-03-22 19:08:15

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

Hi;

They jump to offsets and not fixed locations.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#356 2012-03-22 19:22:56

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

Oh yeah!! that's what it was.  When I moved a block, the ja's and jb's within the block were fine but the jmp that went to something outside the block moved had to be fixed because it was relative.  Thanks for clearing that up!


igloo myrtilles fourmis

Offline

#357 2012-03-22 19:24:33

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

Nops are typically used as space holders or sometimes for timing. If you remove some from between the jump relative and its offset then that will have to be changed as well.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#358 2012-03-22 19:33:33

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

Good point, thanks.  Sometimes I throw them in to make building the program easier to read, like a newline for a new idea paragraph.  Usually i end up leaving just one "nop" between every 10 to 15 commands just for readability as long as the program still runs fast enough.  I think as the program gets bigger, i might put the locations of various routines in a readmelogfile so i can look back years later and relearn what i did.  Sometimes, i even put in a jmp over an ascii word i put in the code that names a routine so if you use the "d" command (display), then you can read the keyword in the right margin in debug, since the hex is in the middle of the screen with "d" and the alpha readable version ascii is in the right margin.


igloo myrtilles fourmis

Offline

#359 2012-03-22 19:36:39

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

You can also just save the assembly code. It is just pnemonics and can have comments.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#360 2012-03-22 19:48:16

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

Yeah, years ago, i used to "pipe" (with ">>") the assembly code into a debug session and then i had a way to comment.
I once knew a programmer who hated comments because they can get left behind even when the code changes and then become inaccurate, so he just named his routines wisely and changed their names if the routines changed.   That was in C, however.


igloo myrtilles fourmis

Offline

#361 2012-03-22 19:54:28

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

Yes, they say good variable and subroutine naming along with good structure is enough.

It never worked for me.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#362 2012-03-22 20:09:24

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

I actually used to like old comments, even if they weren't valid anymore.
But we used to have a log at the top of each file, that explained the changes we made to it and programmer initials and a date.
But some files had like 15 procedures in them, so it might be wise to have a "log" of all the comments
at the beginning of each routine, and never erase the old ones, just put them in cronological order, or backward order.
But i already have a readme.txt file that briefly describes the program, the kbd interrupt handler, the screen mode,
and what my intentions are, so that was a start.
Putting the unassembled mneumonics in a text file is a good idea i suppose, i'll keep it in mind. 
But for now, I'm enjoying coding straight into memory and "w" (writing) the file back out as a *.com file of 61222 bytes
in length with the stack pointer SP pointed near the very end of the file.  I don't do the "call" command because whenever
i do it crashes, so obviously i am missing something about ss:sp, and don't understand something.


igloo myrtilles fourmis

Offline

#363 2012-03-22 20:13:10

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

Oh heck, crashes are part of assembly language coding. Lockups too!


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#364 2012-03-22 20:27:27

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

maybe i could invent my own calling routine with jmps and have my very own handmade
stack-like structure in memory that tells me where to jump back to.  I could do that i suppose.
I have some 55 or so bytes of memory in the first 200 bytes of the program that i jumped over,
that i can use, but i won't do the stack growing and shinking method.  That is dangerous.  I
will just have certain memory spots for certain return locations, and i could just be careful not
to program any recursion that would mess it up, just hardcode where to jump back and then
have the subroutine grab that memory jump back offset and learn extensively how the jump
command can be used, and i probably will be able to do that in a more stable fashion than
using the stack anyway with "call" commands.


igloo myrtilles fourmis

Offline

#365 2012-03-22 20:30:07

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

You could also use inline code. No jumps or calls. It is often faster.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#366 2012-03-22 20:30:47

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

Well I'm going back to sleep for an hour or two.  just got up in the middle of the night anyway, so talk another day...


igloo myrtilles fourmis

Offline

#367 2012-03-22 20:31:53

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

Okay, John get your rest. The forum will always be here.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#368 2012-03-28 13:01:28

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

I'm down to 230 lbs.  This is pretty good for me.  Now I have to lose 5 to 15 more pounds in the next season or two.  I'm eating healthier now and a lot more veges and fruit, and limiting the deserts and processed foods to a small amount.


igloo myrtilles fourmis

Offline

#369 2012-03-28 18:38:50

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

Good for you that you are eating more vegetables! The weight will come off, remember to drink more water also.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#370 2012-03-29 13:40:39

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

Good Advice.  I'm a tiny bit thirsty, so I'll go do that right now...
...Yeah, national forest spring water, mm..mm..good.
I noticed something neat today on my calculator.
I'll explain by example since it is easier for me.
Take a number and compare it to 100.  Then do
something and multiply and get the next number below (one less).
Here's an example:  Take 87.5, now 87.5 is 700/8 and hence
8/7 times 87.5 is 100.  So now do (100-8/7) and get 98 and 6/7.
Multiply 87.5 by 98 and 6/7 percent and you get 86.5, one less.
This works for any number.  Take 25, 25 times 4 is 100, so
100 - 4 is 96 and 25 times 96% is 24, one less than 25.
It also works for numbers over 100.  Take 200.  200 times 1/2 is 100.
So 100 - 1/2 = 99.5 and 200 times 99.5% is 199, again 1 less than 200.
So I don't know why it works and probably won't understand anyones
formulas, but just thought i'd share that with you...

Last edited by John E. Franklin (2012-03-29 13:42:10)


igloo myrtilles fourmis

Offline

#371 2012-04-01 07:56:40

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

Wow, I just had a reason pop into my head as to why the above number game lessens it by one each time.
It looks easy now that i see it.
Take 25, so 24/25 times 25 is 24, so then (25 - "one")/25 times 25 = 24, so that's where the "one" comes into play.
So now if 25 is 4 times less than 100, then (4/4)(25 - "one")/25 is still the same thing, 24.
So (4x25 - 4x"one")/(4x25) times 25 = 24,  so then (100 - 4)/100 times 25 = 24.
So it is a matter of "applying" or "multiplying" the same ratio, but in a form where 100 is the denominator, like in percents,
where you just "drop" the 100 in the denominator, because % means that.

Wow, I am so happy!!!! smile


igloo myrtilles fourmis

Offline

#372 2012-04-03 18:05:31

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

Hi John;

How are you and how do you feel?


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#373 2012-04-06 12:05:31

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

I feel very happy and particularly stable, and who i want to be, altogether.  It's pretty nice.
How are you and how do you feel?


igloo myrtilles fourmis

Offline

#374 2012-04-06 12:33:24

bobbym
bumpkin
From: Bumpkinland
Registered: 2009-04-12
Posts: 109,606

Re: weight lifting miracle today

Hi John;

I am okay, glad to hear you are fine.


In mathematics, you don't understand things. You just get used to them.
If it ain't broke, fix it until it is.
Always satisfy the Prime Directive of getting the right answer above all else.

Offline

#375 2012-04-07 02:00:56

John E. Franklin
Member
Registered: 2005-08-29
Posts: 3,588

Re: weight lifting miracle today

Yeah, it's been about sixty-one days since a lowering of my meds my 10%, the antipsychotic.
It's been quite a learning experience.  Modern day drugs are unbelievable.  Just a tiny 10%
change and I'm still not used all of the changes that I have seen.  I guess whatever you are
ready to see, life will throw it at you!!


igloo myrtilles fourmis

Offline

Board footer

Powered by FluxBB