This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - thepenguin77
Pages: 1 ... 57 58 [59] 60 61 ... 108
871
« on: May 31, 2011, 10:47:17 pm »
Another trio of ideas, this time it's for hooks in the program editor: [On] + [?] = Copy the current line. [On] + [?] = Paste from the cache into the current line. If Ans was a string from copy, it would act like Rcl-ing Ans, but without the quotes. [On] + [?] = Bring up a menu of the current Lbls in the program so you can choose one and jump directly to it, like DCS' instant goto feature. (reference to this.)
EditBuffers are scary, but that sounds good enough to try to implement, so I will probably try eventually. Some bugs to poke you about:
1) APD is enabled for startup programs/RAM clear programs. It should be disabled since when it turns off, bad things happen (TM). 2) You should prevent users from enabling MathPrint in a 2.43 OS, since doing anything top-right-display worthy will show a flicker and disappear from sight. I puzzled over that, and after disabling all the option, I narrowed it down to that little but sinister option.
Feature requests: 1) Allow disabling of the "bypass" key for startup/RAM programs. Yes, I know that sounds dangerous, so you are free to smash a wall of WARNING text all over my screen. (If you're curious, I'm working on a special little program that shouldn't be disabled )
1) I don't see a problem with having APD occur there. I'm pretty sure APD is interrupt based and when it quits, it quits back to the program. I have that enabled for my grayscale pictures and I haven't had a problem with APD's. Besides, I only take action if the calculator is starting up from and OFF, not from an APD. 2) What happens specifically? Because in reality, I don't even think that OS 2.43 even checks that flag. 1) I can't do the bypass key because I can't check the appvar. The reason I put the bypass key in there to start with is so that you could boot your OS normally without even running any zStart code. Essentially, if you are holding [VARS], the OS jp's to zStart, sees that [VARS] is being pressed, then jp's to where the OS needs to go. In order to disable this, I would have to check the appvar first to see if the [VARS] abort should be accepted. But this completely defeats the purpose of the abort. Let's say that you have an archive glitch that is causing faulty VAT entries, even if you left the [VARS] abort enabled, you would still enter a boot loop.
872
« on: May 31, 2011, 03:09:30 pm »
bcall(_dispHL) destroys HL. So store HL back into (num) before you call it. For the most part, you should usually assume that a bcall will destroy all your registers.
873
« on: May 28, 2011, 04:12:26 pm »
Looks good, the last thing you should do to bring it up to optimized is change things like
;4 bytes ld d, 95 ld e, 5
;to
;3 bytes ld de, 95*256+5
And also
;10 bytes ld a, 17 ld (penRow), a ld a, 1 ld (penCol), a
;to
;6 bytes ld hl, 17*256+1 ld (penCol), hl
Of course these are just small things. But in big programs, they can start to add up.
874
« on: May 28, 2011, 09:58:24 am »
Which could be further optimized to:
ld hl, 1*256+1 ;penRow * 256 + penCol ld (penCol), hl
875
« on: May 28, 2011, 09:52:17 am »
Indeed, if you are going to use DCS routines, you should probably throw a DCS header on it. The header ensures that shells that don't support DCS funcions won't try to run it. If they do, it will obviously crash (or do something really interesting.) Also, this line of code made me laugh: ld de,24756 ld h,d ld l,e call VDispHL
I'll let you figure out what's wrong Think of it as an exercise.
876
« on: May 27, 2011, 04:50:34 pm »
Subtract with carry. It subtracts DE and the carry flag. SBC is usually used when you need to do subtraction with 4 bytes and such. ;we will subtract big num 1 from big num 2
ld hl, (bigNum2) ;hl = $0201 ld de, (bigNum1) ;DE = $0605 or a ;this time we don't want the carry flag sbc hl, de ld (result), hl ;DE was bigger than HL, so the carry flag is set
ld hl, (bigNum2+2) ld de, (bigNum1+2) sbc hl, de ;since the last operation carried, (remember 2nd grade math) ld (result+2), hl ;we had to subtract an extra 1 from this result
bigNum1: .db 5, 6, 2, 3 bigNum2: .db 1, 2, 8, 9 result: .db 0, 0, 0, 0
This is what SBC is used for. But, we are forced to use it because SUB HL, DE doesn't exist. I noticed that I have been ninja'd, but I don't care.
877
« on: May 27, 2011, 04:38:03 pm »
Well, I'm not going to make the first routine, either you can do it or find someone else, but don't wait for me to post it As for relative positions, that's easy. There are two ways to go about it, and it depends on how you want your ship to move: 1. Ship is always dead center of screen: For this, we want to first see how the other ship compares relative to your ship. So (opponentX) - (yourX). That will tell you where they are relative to you. Then, just add the location of your ship on the screen. So lets say that your ship is on X=25 of the physical LCD, then you would add the little math problem from up above to 25 to get your location. Example: (yourX) = 190, (opponentX) = 180, Your 50x50 screen is in the top left corner of the LCD. Your ship is displayed at (25,25) 180 - 190 + 25 = 15. So you would display the enemy at X=15. 2. The ship can move freely and the screen scrolls when it gets close to the edge: I'll let you take care of the scrolling, we're only worried about displaying other ships. For this, the equation is just (opponentX) - (scrolledX) + offsetToScreen. It doesn't even matter where (yourX) is. Example: (opponentX) = 180, (scrolledX) = 175, Your 50x50 screen is in the top left corner of the LCD. 180 - 175 + 0 = 5. So you would display the enemy at X=5.
878
« on: May 27, 2011, 04:22:35 pm »
Since it hasn't been mentioned, (though it's been stepped around), here is calc84's CP HL, DE:
or a ;reset carry flag sbc hl, de add hl, de
This one is small enough that it doesn't need it's own call, so just put it inline like you would CP A. And just like SirCmpwn said, this messes with the flags in the exact same way that CP A does.
879
« on: May 26, 2011, 04:22:10 pm »
No, you'll have to do that yourself. You can either convert it to decimal yourself, which is what I do, or you can make it positive, put out a negative sign if needed, then use bcall(_dispHL). But that will look ugly.
880
« on: May 26, 2011, 04:12:34 pm »
As far as I can tell, that will work. Of course you should test it a few times
881
« on: May 26, 2011, 03:48:41 pm »
Yes. It functions just like the NEG z80 instruction, except it operates on HL not A.
882
« on: May 26, 2011, 03:13:10 pm »
Before anything, lets look at unsigned numbers.
All 1 byte numbers: 0 = 00000000 1 = 00000001 57 = 00111001 127 = 01111111 220 = 11011100 253 = 11111101 254 = 11111110 255 = 11111111 256 = 00000000 ;it carried back to 0
So we see that when a number goes past 255 it loops back to 0. Now, if we are going to work with negative numbers, obviously we can't go from -256 to 256 because that is 513 numbers and wouldn't fit into one byte. So instead, we number from -128 to 127.
One byte again: 127 = 01111111 15 = 00001111 2 = 00000010 1 = 00000001 0 = 00000000 -1 = 11111111 ;just like the looping up above, but in reverse -2 = 11111110 -3 = 11111101 -4 = 11111100 -57 = 11000111 -126 = 10000010 -127 = 10000001 -128 = 10000000
Which means that while bit 7 and 15 are the sign bits, there is more to a negative number than just the sign bit. You actually have to convert the rest of the number.
883
« on: May 25, 2011, 09:37:05 pm »
Aww... So close. Assuming the Mul16 works, the only problem I see is that you can't make a number positive by just resetting bit 15. You have to use the NegHL on each of them individually. Or make NegDE and NegBC.
-1 = %11111111 11111111 1 = %0000000 00000001
If you just reset bit 15, you get %01111111 11111111 = 32,767
884
« on: May 23, 2011, 09:22:14 pm »
You need to swap your first bit 7, h and bit 7, d. Then throw a RET at the end of NegHL. But, assuming that that divide routine works, that should give you the right answer.
885
« on: May 22, 2011, 08:15:20 pm »
I did it without memkit for the Psyche's level system using penguin's method, except I just headed everything with $1337 lol. link to dl in sig.
That seems a bit risky. I'm sure your not the first person to head files with $1337. Oh well though, if someone happens to ever have a conflict, I'm sure the results will be amusing.
Pages: 1 ... 57 58 [59] 60 61 ... 108
|