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 ... 171 172 [173] 174 175 ... 317
2581
ASM / Re: about hooks..
« on: January 12, 2012, 04:35:02 pm »
Okay, so here is some code I just threw together for Grammer that changes some tokens around:
Code: [Select]

tokenHook:
     .db $83
     push hl
     ld hl,TokenTable
     ld b,0
TokenSearchLoop:
       ld a,e
       cp (hl)
       inc hl
       jr z,ChkByte2
NotTokenMatch:
       inc hl
       ld c,(hl)
       inc c
       add hl,bc
       ld a,(hl)
       or a
       jr nz,TokenSearchLoop
     pop hl
     ret
ChkByte2:
     ld a,d
     cp (hl)
     jr nz,NotTokenMatch
     ex (sp),hl
     pop hl
     ld de,8478h
     push de
     inc hl
     ld c,(hl)
     inc c \ inc c
     dec hl
     ldir
     pop hl
     ret
NoChange:
TokenTable:
 .db $06,0,8,"lFactor",5
 .db $0C,0,7,"WriteM",$C1
 .db $10,0,6,"ReadW("
 .db $20,0,6,"ReadB("
 .db $28,0,7,"Insert("
 .db $36,0,7,"ClrPart"
 .db $38,0,7,"RunPart"
 .db $3A,0,8,"AddPart("
 .db $3C,0,9,"PartType("
 .db $44,0,5,"Misc("
 .db $58,0,1,5Fh
 .db $BE,0,5,"call "
 .db $38,1,5,"Rect("
 .db $3C,1,5,"Tile("
 .db $3E,1,7,"Sprite("
 .db $40,1,8,"TileMap("
 .db $48,1,9,"Contrast("
 .db $4E,1,9,"ShiftBuf("
 .db $62,1,7,"WriteB("
 .db $70,1,4,"Inv("
 .db $72,1,7,"WriteW("
 .db $A6,1,4,"For "
 .db $B4,1,7,"GetInc("
 .db $BC,1,7,"SetBuf "
 .db $C0,1,8,"SetFont "
 .db $CE,1,8,"MakeVar("
 .db $D0,1,8,"FindVar("
 .db 0
The syntax for the token names is the value of DE (little endian), followed by the name size and then the name. So the last token on that list is E8 (the Get( token). DE will be 1D0h, so I do .db $D0,1
EDIT: Add this to the start of the hook (after .db 83h) so that 2-byte tokens don't interfere:
Code: [Select]
     ld a,b
     or a
     ret nz

2582
ASM / Re: about hooks..
« on: January 12, 2012, 02:34:29 pm »
No, change several names, sorry ^^
Ah, well you have a few options, there. The section that checks which token you have is this:
Code: [Select]
push hl
ld hl, $C8*2
or a
sbc hl, de
add hl, de ;essentially, cp DE
pop hl
This returns Z if you have the right token, NZ if you don't. If you are changing a lot of token names, you would be better off using a look-up table. In your case, though, I think you are only changing a few tokens, so you can try to test like this:
Code: [Select]
ld hl, tokenHook
ld de, smallEditRam ;nothing touches this, ever
ld bc, tokenHookEnd-tokenHook
ldir ;copy it to a place where it won't get destroyed

ld a, 1 ;1 means ram
ld hl, smallEditRam
bcall(_enableTokenHook)
ret

tokenHook:
.db $83 ;necessary for hooks, indicates that it hasn't been overwritten
push hl
;Test the first token
;DE contains the token
ld hl, $C8*2 ;sinh(
or a
sbc hl, de
add hl, de ;essentially, cp DE
        jr z, cscToken
;Test the next token
ld hl, $CA*2 ;cosh(
or a
sbc hl, de
add hl, de ;essentially, cp DE
pop hl
ret nz
secToken:
ld hl, secText-tokenHook+smallEditRam-1
        ret
cscToken:
pop hl
ld hl, cscText-tokenHook+smallEditRam-1
ret
cscText:
.db 4, "csc(" ;length, then string
SecToken:
.db 4, "sec("

tokenHookEnd:

2583
ASM / Re: about hooks..
« on: January 12, 2012, 11:58:47 am »
Wow, I am glad you posted here because I find this useful, too ! I do have experience with hokks, so what do you mean by several hooks? Do you mean like changing several names and commands or do you mean like a font hook, parser hook, and token hook in one app?

2584
Grammer / Re: Grayscale in Grammer
« on: January 12, 2012, 11:52:58 am »
Thanks :) And I now have a command for grayscale sprites and tilemaps o.o That should help folks, I think :)

2585
Grammer / Re: Grammer 2-The APP
« on: January 12, 2012, 11:37:32 am »
Okay, so here is an update :) I cannot remember everything that I have added or fixed, so sorry :/ What I do remember:
Vertical has been fixed. Apparently it is so unused, nobody found that it wasn't working for probably a month or two XD
Pt-On( and Pt-Change have two more tile drawing methods. Method 6 is now Mask and Method 7 is now Gray. The way the sprite data is setup is like this:
First byte is the first drawn layer and the second byte is the second drawn layer.

For Masked sprites, the first layer is the mask. For the mask, leave pixels off where you want the screen erased. The second layer is drawn over top with OR logic.

For Gray sprites, the first layer is the gray layer. Leave pixels on for gray, off for white. The second layer is the black layer. Leave pixels on for black and off for white. So if a pixel is on in the black layer, it will be black. If it is off in both layers, it will be white. If it is on in only the gray layer, it will be gray.

For gray sprites, you will constantly need to redraw it and display the screen to get the effect (otherwise, you will notice the sudden freeze in gray on whatever frame it is on).

As another note, the screenie is about what you should get on your calc (it is what I get).

2586
Other Calculators / Re: zcontest basic judges headquarter
« on: January 11, 2012, 09:51:37 pm »
Thanks much, Deep Thought!

2587
Grammer / Re: Grammer Feature Requests
« on: January 11, 2012, 02:48:21 pm »
Hmm, so now I have a question because I am feature requesting 2 more sprite options for Pt-On(:
Masked sprites
Gray sprites

The question is, should I have an extra argument for the pointer to the mask or should I have the mask built in to the data? And if the latter is the case, it would be faster and easier to use every other byte as the mask.

So what should I use? If I do the latter option, I can easily make a sprite editor to handle those two types and then you can use grayscale options for tilemapping :D

2588
Grammer / Grayscale in Grammer
« on: January 11, 2012, 11:49:10 am »
I finally learned how to do grayscale properly and now I want to pass on that knowledge for Grammer programmers. This has been possible with Grammer for a while, I just never understood the theory behind making it flickerless and beautiful looking. So here goes:

For three level grayscale, we have it very easy. You have a gray buffer and a black buffer In the gray buffer, you set any gray pixels to on and leave the rest alone. In the black buffer, you set the black pixels on and leave the rest alone. Now you need to display it and this is where it gets fun.

Normally, you would have flicker and if you have ever attempted and failed grayscale like me, you know what I am talking about. So how do you get around this? You set any gray pixels on an alternating cycle. How is this achieved? You use a checkerboard pattern and use AND logic on the buffer. So every other cycle, a gray pixel is displayed, but you want to display black pixels every cycle. So you OR the black buffer with that buffer, too. So here is an example using a tilemap:
Code: [Select]
!E→E                               ;This makes E alternate between 0 and 1. This tells us the cycle we are on.
Fill(+2                              ;This uses one of the checkerboard patterns. It alternates with E
Pt-Change(0,M,G,W,X,Y,1   ;Draws a tilemap using the gray tileset with AND logic
Pt-Change(0,M,B,W,X,Y,3    ;Draws the same tilemap with the blcak tileset with OR logic
DispGraph                         ;Now display
As long as you display it enough, this will make rather beautiful 3 level grayscale. I am currently working on other levels of grayscale as well as additions for grayscale drawing (possibly).

Anyways, here are some programs to play with. I would show a screenie, but WabbitEmu cannot capture it nearly as well as it looks on an actual calculator.

EDIT: Posted a pic and that is pretty accurate with how it look on an actual calc :)

2589
ASM / Re: 68K ASM Help
« on: January 11, 2012, 09:56:35 am »
There are data registers and address registers, from what I see. pretty much, traditionally the D registers contain data for intermediary operations whereas the A registers contain addresses to calls, jump tables, et cetera. A7 is indeed the stack and A6 is the stack frame (I do not understand what a "stack frame" is).

So if I was going to make a routine to multiply two, 96-bit numbers, I would use D0D1D3 for the first number and D4D5D6 for the second. Or, if it was stored in memory (the two numbers), I would store the location of the numbers in A0 and A1 and the output location in A2.

2590
TI Z80 / Re: [Grammer(xlib first)] The Reign of Legends 3 Port
« on: January 10, 2012, 06:38:37 pm »
Well, I am talking to Runer about it right now... Grayscale? I posted an example of a grayscale tilemapper before and it works quickly. Also, I think I might have made the tilemapper faster >.>

2591
ASM / Re: So what next?
« on: January 10, 2012, 06:19:53 pm »
SRL will shift a register right and load a 0 into bit 7. the original bit 0 will now be in the carry flag :)

Also, Thepenguin77: Great advice and that is too true :)

Also, for a tunnel game, shifting the screen up or down a pixel is rather simple if you use lddr. To shift down and not at all change the first line:
Code: [Select]
    ld de,plotSScreen+2FFh      ;DE points to the last byte of the graphscreen
     ld hl,plotSScreen+2FFh-12  ;HL now points to the last byte in the second to last row
     ld bc,300h-12                   ;this is the size of 63 rows
     lddr                                 ;copies BC bytes at HL to DE going backwards
     ret

EDIT: Aw, ninja'd D:
:D

2592
TI Z80 / Re: [Grammer(xlib first)] The Reign of Legends 3 Port
« on: January 10, 2012, 12:47:38 pm »
And I would also point out that the HUD is almost certainly being redrawn every time the character moves o.o I am working on a routine that will draw tilemaps to a section of the screen, so if he uses that, he won't have to redraw every time. However, that will only speed it up more. I think yeong may need something in to add a delay...
Xeda112358 has an idea...

2593
ASM / Re: So what next?
« on: January 10, 2012, 12:13:42 pm »
Wow, there isn't a sprite tutorial yet? Well I will say that I much prefer aligned sprites as they are a lot simpler, smaller, and faster. You have a few ways to draw aligned sprites. You can draw them directly to the LCD or to the buffer. Drawing to the buffer is faster, so in this explanation, we will draw there. The screen buffer is set up with 12 bytes per row and 64 rows. If you want to draw 8x8 tiles you will have 12 to fit across and 8 down. So here is a routine I will call DrawTile and it will use a mask of OR (it draws on top of the data like the OS RecallPic ):
Code: [Select]
DrawTile:
;Inputs:
;     A is the tile number (0 to 95, draws columns, then rows)
;     DE points to the sprite data
     sub 96               ;this will set the c flag if the result is negative
     ret nc               ;Exits if the sprite is out of range
     ld bc,96             ;there are 96 bytes in 8 rows
     ld hl,plotSScreen-96 ;the graph buffer minus 96
       add hl,bc          ;Next row down
       add a,12           ;We are eliminating rows
       jr nc,$-3          ;
     ld c,a               ;b is already 0, so do not worry
     add hl,bc            ;BC is the X offset
;HL points to where to draw the sprite
;DE points to the sprite data
     ld bc,080Ch          ;sets C to 12 and B to 8 (the height of th sprite
TileLoop:
        ld a,(de)         ;gets the next byte of the sprite
        or (hl)           ;performs OR logic witht he buffer
        ld (hl),a         ;copies the data to the buffer
        inc de            ;points to the next sprite byte
        ld a,b            ;we are saving B
        ld b,0            ;now BC is 12
        add hl,bc         ;Now HL points tot he next row
        ld b,a            ;restores b
        djnz TileLoop     ;Decrements B, if it is not 0, loop again
      ret
with the "or (hl)" part, you can change that to other forms of logic. Some examples are:
To overwrite the screen data, remove the or (hl)
To use AND logic, replace or (hl) with and (hl)
To use XOR logic, replace or (hl) with xor (hl)
To erase, you need to invert the sprite data and use it asa mask. replace or (hl) with cpl \ and (hl)
Draw the sprite inverted and overwrite the screen data, replace or (hl) with cpl
EDIT: Also, you can easily incorporate that as a subroutine for drawing a tilemap, if you wanted to :)

2594
TI Z80 / Re: [Grammer(xlib first)] The Reign of Legends 3 Port
« on: January 09, 2012, 11:51:24 pm »
Holy, wow that is great! o.o
First, when it copies the portion of the appvar, does it copy entire appvars into RAM, copy portion, and deletes it?
When you copy a portion, it only copies that portion. It doesn't copy the whole thing and delete portions.
Also, is there a way to save front buffer to back buffer? It will be nice. :D
You will specifically want Fill(8,b. You can either create your own 768-byte buffer (in an appvar) or you can use 9872h if you aren't going to use the default particle buffer. Also, using those Fill( commands, you can use logic to combine two buffers on the screen. For example, you can use OR logic as well as AND logic.

Also, Yeong, I think I am going to work on the next tilemap option as one to draw to a portion of the screen. This way, an HUD is more easily done(you won't have to redraw it every time you move).

2595
TI Z80 / Re: Checkers (Grammer)
« on: January 09, 2012, 05:49:05 pm »
o.o Cool! And I know there have suddenly been a lot of TI-89 or other 68K developers suddenly around, so maybe we can make it for all platforms :D We can be the Board Game Makers Guild :D

Pages: 1 ... 171 172 [173] 174 175 ... 317