Oh, okay. Thanks for the tip.
aeTIos wrote:
Oh, okay. Thanks for the tip.
Including that piece of code so I can look over it for you. Razz Here it is properly formatted:


Code:
x=saferam1
y=x+1
   ld a,0
   ld (x),a
   ld (y),a
   ld hl,map ;The map data
   ld b,3
outerloop:
   push bc
      ld b,4
innerloop:
      ld ix,tiles
      push bc
         push hl
            ld a,(hl)
            cp 0
            jp z,drw_map
            ld b,a
            ld de,8
loop:
            add ix,de
            djnz loop
drw:
            ld a,(y)
            ld l,a
            ld a,(x)
            ld b,8
            call iputsprite
            pop hl
         inc hl
         pop bc
      ld a,(x)
      add a,8
      ld (x),a
      djnz innerloop
      ld a,0
      ld (x),a
      ld a,(y)
      add a,8
      ld (y),a
      pop bc
   djnz outerloop
   call fastcopys ;cuz it saves all registers :)
   b_call GetKey
   ret
See how much easier that is to read? Smile There's a lot of optimizations that could be made there, but it is indeed more or less functionally identical to what I had written. Good job!
Nice, thanks for confirming!
I would like to know how to do 3- and 4-lv grayscale.
aeTIos wrote:
I would like to know how to do 3- and 4-lv grayscale.
Well, you need a bunch of things, then:

1) A grayscale engine. This is in the form of an interrupt that periodically copies from one of two buffers to the LCD, plus routines to set up and tear down the interrupt. I'm partial to Jim E's Grayscale Programming Package 1.1.
2) Two buffers, 768 bytes each
3) Sprite routines that are capable of copying to both buffers
4) Other grayscale-aware graphics routines
5) Understanding that you lose 50-80% of the CPU time to the grayscale routines
ouch. thats a lot of things. how do you do copying to both buffers?
aeTIos wrote:
ouch. thats a lot of things. how do you do copying to both buffers?
Well, Jim E's GPP comes with PutSprite and LargeSprite routines that do it for you, but you have to use your own routines if you want to do other tricks.
Thanks.
Can you use set 4,A to set bit 4 of register A?
aeTIos wrote:
Can you use set 4,A to set bit 4 of register A?
That's exactly what it's for! And res 4,a resets bit 4, and bit 4,a sets the z flag if bit 4 of a was zero.
Thanks! I thought it was only for flags. (But they are effectively the same Smile)
aeTIos wrote:
Thanks! I thought it was only for flags. (But they are effectively the same Smile)
They are exactly the same, in fact! The only difference is that the bytes that store flags are offsets in memory from the iy register instead of registers like a. Smile
How do I draw a 16x16 clipped sprite?
Gah! Stop double posting. If you have new content to add, just edit your previous post if it hasn't been at least 24 hours.

To answer your question, to be quite honest, I haven't done this yet (correctly). I would look at the iPutSprite routine (the one with clipping) and see how it checks for bounds, and then try and extend it for 2 bytes width. Or, the better answer that doesn't involve reinventing the wheel, use the iLargeSprite routine. (Protip: This one is easier Razz)
_player1537 wrote:
Gah! Stop double posting. If you have new content to add, just edit your previous post if it hasn't been at least 24 hours.
Heartily seconded. It gets very tedious to merge people's posts together, and I wouldn't blame Tanner if he started just deleting double-posts from repeat offenders.

Quote:
To answer your question, to be quite honest, I haven't done this yet (correctly). I would look at the iPutSprite routine (the one with clipping) and see how it checks for bounds, and then try and extend it for 2 bytes width. Or, the better answer that doesn't involve reinventing the wheel, use the iLargeSprite routine. (Protip: This one is easier Razz)
Neither iPutSprite nor iLargeSprite does clipping. Vertical clipping is easy: if you're close to the bottom, you just lower the number of rows specified for display; if you're above the top, you offset the beginning of the sprite as you lower the number of rows until the top is onscreen. Left and right are harder, and can be done with techniques such as bitshifting the sprite or doing careful bitmasking.
Okay, thanks. I'll take care not to double-post again Razz
About vertical clipping, I discovered this myself. The horizontal will get harder, though...

Edit: also, I already use Ilargesprite.

Edit2: I want to create a direct input routine like this:
Pseudocode:

Code:

;inputs: A is the scancode of the key to be tested
;outputs: zero flag is set/reset (set: key pressed)
If a<=4
arrow key check
if key pressed
set zero flag
end
end
repeat for all key groups

Imo, this is the best way to do it. any suggestions to do it better?
Okay, I have this code and when I compile it it gives a freaking huge file (37.5 kB Shock)
I opened the file and it was just 's.
This code:

Code:
.nolist
#define TASM
#include "ti83plus.inc" 
#include "dcs7.inc" 
#include "Useful_Routines_.inc"
.list 
   .org progstart
   .db $BB,$6D 
Init: 
   xor d 
   ret 
   jr Start 
   .dw $0000 ;No Description 
   .db $07,$00 ;always this string 
   .dw $0000 ;No Icon 
   .dw $0000 ;No ALEs 
Start:
   ld a,KgrpEnt    ;KgrpEnt .equ %11111101
   out ($01),a
   nop
   in a,($01)
   bit 7,a
   ret z
   ld a,KgrpArrows
   out ($01),a
   nop
   in a,($01)
   bit 1,a
   jp nz,Start
   ld hl, TextDown
   B_CALL(_PutS)
   jp Start   
TextDown:
   .db "Down"

Any clue what I did wrong?
Thanks!
What's #define TASM for?
Uh, I ripped it from another source code (docde7)
I'll see if removing it works.
Edit: did not work, still 39.5 kB of compiled code Razz
What's in "Useful_Routines_.inc"?
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
» Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
» View previous topic :: View next topic  
Page 6 of 8
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement