There appears to be a 4-cycle difference between the two (SLA and RLCA)...
Which one is the faster of the two?
RLCA (which happens to be the non-carry flag one)
calc84maniac wrote:
RLCA (which happens to be the non-carry flag one)
Fair enough; I'll have to switch over to rlc a then. Smile
Here's an optimized version I whipped up:


Code:
dcsSquish:
  ex de,hl
dscSquishLoop:
  call dcsSquishPutNibble
  call dcsSquishPutNibble
  cpi
  jp pe,dcsSquishLoop
  ex de,hl
  ret
dcsSquishPutNibble:
  call GetArcProgByteDe
  inc de
  cp $3A
  jr c,dcsSquish_DONE
  sub 7
dcsSquish_DONE:
  rld               ;rotates lower nibble only of a into (hl)
  ret


See how much simpler that is? Smile

27 bytes rather than 50, and no pushes or pops. Feel free to use this as the first step of keeping DCS out of 3 app pages Wink
Well done. One of these days I should go through and look at all my unoptimized code from back in the day. :/
I am trying to create a routine to turn on all the pixels and create a black screen. Right now i am having trouble with it though the code i am using only turns about half of the screen black. How would i change my code to make it turn the entire screen black.


Code:

DEFHDR.HDR
LD B,768
LD HL,PLOTSSCREEN
LOOP:
LD A,11111111B
LD (HL),A
INC HL
DJNZ LOOP
BCALL GRBUFCPY
RET
B can only hold numbers up to 255. Make a counter with BC instead. And also

ld (hl),11111111b

is faster and smaller than

ld a,11111111b
ld (hl),a

Edit: I whipped up a small fast one:


Code:
:LD HL,PLOTSSCREEN
:LD BC,768
:LOOP:
:LD (HL),11111111b
:CPI
:>Compares (hl) to a, increases hl, decreases bc, and returns PE if bc is not zero
:JP PE,LOOP
:>There is no jr pe
:BCALL GRBUFCPY
:RET
I realized what i was doing wrong about after an hour of staring at code. Before looking at yours this is what i had come up with,


Code:

:LD BC,768
:LD HL,PLOTSSCREEN
:BLACK:
:LD A,11111111B
:LD (HL),A
:INC HL
:DEC BC
:LD A,C
:OR B
:JR NZ,GILOOP
:BCALL GRBUFCPY
:RET


I will try yours though since it is better. I also have another question though. Since i can clear the graph screen by switching a to 00000000B which area of memory would i have to access to clear both the home and graph screen.
When you write directly to the LCD (and you're on the homescreen), your alterations stay there and are even shifted upwards by Disps.

Also:
Code:
:LD HL,PLOTSSCREEN
:LD BC,767
:LD D,H
:LD E,L
:INC E
:LD (HL),FFH
:LOOP:
:LDI
:DEC HL
:>sets (DE) to the value of (HL), increases DE and HL, decreases BC, and flags its overflowing
:JP PE,LOOP
:BCALL GRBUFCPY
:RET
Less cycles.
Calc84maniac your black screen code is being stupid. It worked yesterday but now it wants to only blacken the first seven pixels or so.

Code:
ld hl,gbuf
push hl
pop de
inc de
ld bc,767
ld (hl),$ff
ldir
This is faster:

Code:
ld hl,gbuf
ld de,gbuf+1
ld bc,767
ld (hl),$ff
ldir
So it is, good call.
I, like haveacalc, have memorized the cc times for most of the commands. Razz
And the black screen was being stupid again, it worked this time. What did the code that you posted do Kerm?
  
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
» View previous topic :: View next topic  
Page 8 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