Part of my program is various ways of clearing the screen. Will these work?



Code:
;################
;Moves to the next slide
;Data Format:
;Byte 1= Fade-out style, 0= simple, 1= left to right, 2= right to left
          3= top to bottom, 4= bottom to top

NextSlide:
   push hl
   inc hl
   ld a,(hl)
   cp 0
   jr z,simplefade
   cp 1
   jr z,ltrfade
   cp 2
   jr z,rtlfade
   cp 3
   jr z,ttbfade
   cp 4
   jr z,bttfade
simplefade:              ;just clear screen
   b_call(_ClrLCDFull)
   jp RenderLoop
ltrfade:                  ;left to right fade out
   ld hl,gbuf
   ld a,$00
   ld c,95
eraserowloop:
   push hl
   call iFastCopy
   ld b,63
erasecolloop:
   ld (hl),a
   add hl,96
   dec b
   jr nz,erasecolloop
   pop hl
   inc hl
   dec c
   jr nz,eraserowloop
   jp RenderLoop
rtlfade:                      ;right to left fade out
   ld hl,gbuf+95
   ld a,$00
   ld c,95
eraserowloop2:
   push hl
   call iFastCopy
   ld b,63
erasecolloop2:
   ld (hl),a
   add hl,96
   dec b
   jr nz,erasecolloop2
   pop hl
   dec hl
   dec c
   jr nz,eraserowloop2
   jp RenderLoop
ttbfade:                   ;top to bottom fade out
   ld hl,gbuf
   ld a,$00
   ld c,63
erasecolloop3:
   push hl
   call iFastCopy
   ld b,95
eraserowloop3:
   ld (hl),a
   inc hl
   dec b
   jr nz,eraserowloop3
   pop hl
   add hl,96
   dec c
   jr nz,erasecolloop3
   jp RenderLoop
bttfade:                            ;bottom to top fade out
   ld hl,gbuf+last row first column
   ld a,$00
   ld c,63
erasecolloop4:
   push hl
   call iFastCopy
   ld b,95
eraserowloop4:
   ld (hl),a
   inc hl
   dec b
   jr nz,eraserowloop3
   pop hl
   push bc
   ld c,96
   ld b,0
   sbc hl,bc
   pop bc
   dec c
   jr nz,erasecolloop3
   jp RenderLoop
A point of etiquette: that code is borderline large enough to qualify to be Pastebinned. Have you tested them? There's no point in asking us if those will work if you haven't tested them yet. Smile I see all kinds of optimizations that can be made, but let's deal with that after you test.
KermMartian wrote:
A point of etiquette: that code is borderline large enough to qualify to be Pastebinned. Have you tested them? There's no point in asking us if those will work if you haven't tested them yet. Smile I see all kinds of optimizations that can be made, but let's deal with that after you test.


Doesn't work... it clears a pixel as a byte...a pixel is 1/8 of a byte. Thus, this corrupts a large sector of memory.
ACagliano wrote:
KermMartian wrote:
A point of etiquette: that code is borderline large enough to qualify to be Pastebinned. Have you tested them? There's no point in asking us if those will work if you haven't tested them yet. Smile I see all kinds of optimizations that can be made, but let's deal with that after you test.


Doesn't work... it clears a pixel as a byte...a pixel is 1/8 of a byte. Thus, this corrupts a large sector of memory.
Then you will have to re-write it. Smile Bit-masking is important for this sort of thing; are you familiar with the concepts of bit masking and manipulation?
No. Sorry. I kind of skipped over that in my self teaching, in favor of byte and word level stuff.
You could use the SET, RES, and BIT opcodes to change individual bits, or AND, OR, and XOR to change multiple bits with bitmasking.
souvik1997 wrote:
You could use the SET, RES, and BIT opcodes to change individual bits, or AND, OR, and XOR to change multiple bits with bitmasking.


Can I get an example?
ACagliano wrote:
souvik1997 wrote:
You could use the SET, RES, and BIT opcodes to change individual bits, or AND, OR, and XOR to change multiple bits with bitmasking.


Can I get an example?

Here:

Code:
 set 2,a ; sets bit 2 of register A
 res 3,b ; resets bit 3 or register B
 bit 4,a ; Here, if bit 4 of A is 1, the zero flag is set
 jr z,Bit4Set
 ld b,3
 and a ; ANDs A and B together, storing the result into A
 ld c,4
 or c ; ORs A and C together and stores the result into A
 ld b,2
 xor b ; XORs A and B together and stores the result into A
ACagliano wrote:
No. Sorry. I kind of skipped over that in my self teaching, in favor of byte and word level stuff.
Try reviewing Days 8 and 9 of ASM in 28 Days, namely Bit Math and Bit Shifting. Both are important here. You'll probably want to repeatedly rotate a byte with a single bit set as a mask.
Too much effort right now. I'll get to it eventually, but for now, I'll stick to a simple transition.
  
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
Page 1 of 1
» 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