Show Posts

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 - Xeda112358

Pages: 1 ... 217 218 [219] 220 221 ... 317
3271
ASM / Re: How to display pixel in certain location
« on: May 03, 2011, 08:54:59 pm »
Here is some sample code for pixel routines... Sorry I didn't add many notes to this :/ I am talking on the phone, programming on my calc and typing this up all at the same time XD
Code: [Select]
;===============================
DrawPixel
;===============================
;Inputs:
;     A is the drawing method:
;        0=Pixel Off
;        1=Pixel On
;        All else=Pixel Invert
;     B is the X coordinate
;     C is the Y coordinate
;===============================
     push af           ;F5
     call GetPixelLoc  ;CD****
     pop bc            ;C1
     inc b             ;04
     djnz PixelOn      ;1004
;Pixel Off
       cpl             ;2F     Inverts A
       and (hl)        ;A6
       ld (hl),a       ;77
       ret             ;C9
     djnz PixelInvert  ;1003
PixelOn:
       or (hl)         ;B6
       ld (hl),a       ;77
       ret             ;C9
PixelInvert:
       xor (hl)        ;AE
       ld (hl),a       ;77
       ret             ;C9
;===============================
GetPixelLoc:
;===============================
;Inputs:
;     B is X coordinate
;     C is Y coordinate
;Outputs:
;     HL points to the byte in plotSScreen
;     A is the mask
;     B is 0
;     C is unchanged
;     DE is C*12 (also BC*12)
;===============================

     ld a,b            ;78
     ld b,0            ;0600
     ld h,b            ;60
     ld l,c            ;69
     add hl,hl         ;29
     add hl,bc         ;09
     add hl,hl         ;29
     add hl,hl         ;29
     ld b,a            ;47
     ld d,h            ;54
     ld e,l            ;5D
     rrca              ;0F
     rrca              ;0F
     rrca              ;0F
     and 1Fh           ;E61F
     add 40h           ;C640
     ld l,a            ;6F
     ld h,93h          ;2693
     add hl,de         ;19
     ld a,b            ;78
     and 7             ;E607
     ld b,a            ;47
     inc b             ;04
     ld a,1            ;3E01
Loop:
     rrca              ;0F
     djnz Loop         ;10FD
     ret               ;C9
EDIT: This can probably be optimised...
EDIT2: Also, I made it Call GetPixelLoc instead of making it inline because GetPixelLoc has other uses, too, for code.
EDIT3: So I figured if it was in your code, it might work better as a call, but if you aren't using it for anything else, place it inline to save 3 bytes.

3272
News / Re: Raylin Demoted
« on: May 03, 2011, 04:10:24 pm »
That sounds like a terrible coincidence :/ It does make sense, though, and I actually think that that is an excellent policy. It is a way to potentially let power cycle and since everything is about politics, lately, it adds to the irony XD

3273
Introduce Yourself! / Re: Hi friends..
« on: May 03, 2011, 10:39:53 am »
Yeah, I am very sure it would pass a Turing Test as it is and if it were tweaked a little, it could make for an excellent competitor in AI competitions. It is more intelligent than cleverbot! XD

3274
Miscellaneous / Re: Osama Bin Laden died
« on: May 02, 2011, 01:29:21 am »
I think May 1st, 2011 is the day Barack Obama won the game.

3275
Miscellaneous / Re: Osama Bin Laden died
« on: May 02, 2011, 01:16:56 am »
This is one of those times that I wish I was taking a history course :/ This is going to be a really interesting topic that I will be able to share with my children in the future :)

3276
ASM / Re: I need help with creating programs..
« on: May 01, 2011, 12:14:29 am »
Yeah, Qwerty has it correct :)

Pretty much, _RclAns does several things:
-Stores the type that Ans is in the "a" register
-Stores the address of the vat entry in HL
-Stores the location of the size bytes in DE

If Ans is a real number, the real number is stored in OP1 and if it is a complex number, it is stored to OP1 and OP2 has the imaginary part.

You will also want to know how variables are stored by the OS. The data itself is stored so that the first two bytes tell the size and the data following is the actual variable data. SO for example, if the hex was 0301454699..., then the size is represented by the 0301 part. Since it is little endian (the little end, in) you need to count it as 0103 which is 259. This means there are 259 bytes of code. Also, because it is little endian, I stored the first byte to c and the second to b. That way, BC contains the total size :)

3277
BatLib / Re: Creepy-Crawlies (Bugs)
« on: April 30, 2011, 05:58:00 pm »
Um, I found a bug with RecallPic in ReCode. The problem? Instead of typing in 78 (ld a,b) I typed 18 which caused everything to mess up x.x Just goes to show how 1 byte can cause a crash XD So, anywho, here is the fixed version...

3278
ASM / Re: I need help with creating programs..
« on: April 30, 2011, 05:48:24 pm »
Well hello there! Welcome to the site! Here is some code for you to play with :) I have it organized so that there are mnemonics, then the hex code, then the explanation :
Code: [Select]
;=========================================================
;    Mnemonic            Hex       Explanation
;=========================================================
     bcall(_RclAns)     ;EFD74A    DE points to size bytes
     cp 4               ;FE04      To make sure Ans is a string
     ret nz             ;C0        Quits if a is not equal to 4
     ex de,hl           ;EB        Swaps hl and de. Now hl points to the size bytes of Ans
     ld c,(hl)          ;4E        loads the LSB (Least Significant Byte) of the size into c
     inc hl             ;23        hl points to the next size byte
;
;As a note, these next two lines can be replaced with
;ld b,0 in this case (because the name shouldn't be >8 bytes)
;but this is the general way to get the size of a variable.
;
     ld b,(hl)          ;46        now the MSB of the size is stored to b. BC is now equal to the size of the string in Ans
     inc hl             ;23        hl now points to the actual data
;
;At this point, HL points to the string in Ans
;and BC is the size of the string. This will be
;useful when we copy to OP1 :)
;
     inc a              ;3C        Since a is 4, this makes a=5 (the type for a program)
     ld de,OP1          ;117884    DE points to OP1
     ld (de),a          ;12        Stores a (which is 5) to the byte at OP1+0
     inc de             ;13        DE now points to the next byte (OP1+1)
     ldir               ;EDBO      Copies BC number of bytes from HL to DE. In other words, it copies the string in Ans to OP1
     xor a              ;AF        This makes A=0. It is an optimisation trick :)
     ld (de),a          ;12        This copies a (0) to (de) which is at the end of the string in OP1
     bcall(_ChkFindSym) ;EFF142    This searches for a var named in OP1
     ret nc             ;D0        This stops if the var already exists
     ld hl,256          ;210001    This is the size you want the program to be
     bcall(_CreateProg) ;EF3943    This creates the program
     ret                ;C9

3279
BatLib / Re: BatLib
« on: April 30, 2011, 02:54:37 pm »
Probably not :/ I have had occasional access to internet while on break, but usually only enough to check in and not enough to actually post updates. Plus, that gives people enough time to master techniques in BatLib! I add so much to it that people have a tough time keeping up :/

3280
BatLib / Re: BatLib
« on: April 30, 2011, 10:05:53 am »
It isn't the size, it is the trade off in limitations... right now, you have only 12 columns, but the sprites can be up to 96 pixels wide, they can still be drawn every pixel down, the sprite drawing is much faster (enough to create grayscale). The other method will be slower and be only for 8 pixels wide and the sprite masks will be limited. You haven't bugged me to finish making this, you have only complained to me that you don't like the current version. There is a reason for the "BatLib Ideas" topic.

Sorry.

EDIT: Also, on another note, I will be without internet for from May 9th to August 29th, so if I don't respond, that is why :/ Also, if for some reason I cannot come back to college, I might not have internet for a long while after that.

3281
BatLib / Re: BatLib
« on: April 29, 2011, 11:22:58 pm »
Yes, currently I only have it with multiples of 8 (I was a big fan of using Celtic 3 before I learned assembly). That method is simply a lot faster to render and it can display sprites a multiple of 8 wide (so 64 pixel wide sprites, for example). If I make a routine that lets you display at any X coordinate, it will probably be only 8x8 sprites to begin with, and maybe eventually multiples of 8 wide.

3282
BatLib / Re: BatLib Demo Programs
« on: April 29, 2011, 11:18:13 pm »
Yes, there is a recallpic function (called PicHandle). The fastest way for creating grayscale with BatLib is to actually use the command that draws sprite directly to the LCD. That isn't the most simple version, though... To give an idea, BatLib has all the tools to store a bunch of pictures in one file, then reading it from archive, you can cycle through each picture rapidly.

Also, ReCode has a RecallPic function, so that could prove pretty useful...

Here is an example I made while trying to make a scaled down main menu:

3283
BatLib / Re: BatLib/ReCode Examples
« on: April 29, 2011, 11:02:54 pm »
Yeah, it is a little complicated to look at, but if you are coding it, it isn't bad. It is like trying to read another person's source x.x On the plus side, the smoothness and speed is pretty noticeable!

3284
Math and Science / Re: Non-linear sequence
« on: April 29, 2011, 10:58:24 pm »
@Xeda: Any polynomial interpolation will be bound to lose accuracy pretty quickly, considering that f(x)>2^(x-1) which is exponential.
I know, but he only asked for an equation for that data XD I would have to study more to figure it out to match that sequence :D

3285
BatLib / Re: BatLib/ReCode Examples
« on: April 29, 2011, 05:02:57 pm »
So, being a lover of patterns, I decided to remake a program that I originally made using xLIB. This one is a bit faster, the graphics are smoother, and doesn't require you to make a picture. So here is the basic concept:
-Copy upper 63 rows of the graphscreen
-XOR one pixel down
-Copy lower 63 pixels of the graphscreen
-XOR one pixel up

This will create some fairly interesting effects on its own, but I decided to add in  some pixel drawing for the first 95 iterations. After that, the pattern continues on its own seeming to scroll right, infinitely.
Code: [Select]
Delvar Bdim(56,4
Repeat Ans=15
If B<95
Then
Pxl-On(0,B
B+1→B
End
dim(53,dim(35,0,0,63,12),63,0,1,2,53,dim(35,0,1,63,12),63,0,0,2,43,99
End

Pages: 1 ... 217 218 [219] 220 221 ... 317