Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
Well, not officially documented. That link you just put was the only place I could find it.
Then for my part I'd call it documented! Wink

(Documented by WikiTI, not TI)
what is trying to say is that its not official documentation, because it was not supordeb by TI
Here are a few routines i created that are not really "usefull" but they mock rom calls so they would be better. None of them have inputs either.

VHomeup
Same as homeup except on the graph screen

Code:

vhomeup:
 ld hl,0
 ld (pencol),hl
 ret


Homeup
Home up on the regular screen

Code:

homeup:
 ld hl,0
 ld (currow),hl
 ret


Vnewline
Drops down a line on the graph screen

Code:

vnewline:
 xor a
 ld (pencol),a
 ld a,(penrow)
 add 6
 ld (penrow),a
 ret


Newline
Drops down a line on the regular screen

Code:

newline:
 xor a
 ld (curcol),a
 ld a,(currow)
 inc a
 ld (currow),a
 ret
Just to point this out, that should be 'add a,6', not 'add 6'. Wink
Also, the "Newline" one could be optimized to this:


Code:
newline:
 xor a
 ld (curcol),a
 ld hl,currow
 inc (hl)
 ret
haveacalc wrote:
Also, the "Newline" one could be optimized to this:


Code:
newline:
 xor a
 ld (curcol),a
 ld hl,currow
 inc (hl)
 ret
Or, even better:


Code:
newline:
 xor a
 ld hl,currow
 inc (hl)
 inc hl
 ld (hl),a
 ret


8 bytes instead of 9.
calc84maniac wrote:
Just to point this out, that should be 'add a,6', not 'add 6'. Wink


add 6 works just fine for me.
lafferjm wrote:
calc84maniac wrote:
Just to point this out, that should be 'add a,6', not 'add 6'. Wink


add 6 works just fine for me.
It depends on which t80.tab you're using. Most have add 6 as valid syntax, with a assumed.
The Better CP HL,DE
compares hl to de, same flag outputs as 8-bit compare

Code:
or a
sbc hl,de
add hl,de
I wonder what flag bits 3 and 5 (the undocumented ones) would be in this case. I haven't tried them after working with 16-bit registers...
Dunno about those, but there is one flag difference from 8-bit compare...
The add/subtract bit is reset rather than set. This shouldn't matter unless you're using daa right after calling this... Razz
Well, on the same topic of UTI, I posted something were I said:

me wrote:
Also, I just found out why I said the other is faster


Code:

or a          ;4T, 1B
sbc hl,de  ;15T, 2B
add hl,de  ;11T, 1B
                ;Total= 30T, 4B


(a modification from the second version in the post, [rul=http://www.detachedsolutions.com/forum/m/14696/#msg_14696]linky[/url])

Code:

ld a,h    ;4T, 1B
cp d      ;4T, 1B
jr nz,$+4;12/7T, 2B;the $+4 works in ZDS and maybe TASM, just saying the end of routine
ld a,l      ;4T, 1B
cp e      ;4T, 1B
            ;Total 1: 20T, 5B
            ;Total 2: 23T, 5B


And the second works on any side with any 16 bit register and even mixes of 8 bit ones.
Spencer wrote:

Code:
ld a,l
sub e
ld a,h
sbc a,d

16 cycles, 4 bytes
???

the goal is to compare a 16 bit to another 16 bit. not to substract and get no result other than LSB substract.
well here are some more routines that i have created they are not optimized but at the moment i'm withouth the will to do it!!! There are many OR A that can be eliminated because they don't do nothing were they are....

ClearHorizLine:

Quote:

; Draw an horizontal line into the buffer
; inputs : H - xpos1
; : L - ypos
; : D - xpos2

ClearHorizLine:
PUSH HL
PUSH DE
LD A,H
LD H, 0
LD D, H
LD E, L ;// L with the Ypos
ADD HL, HL
ADD HL, DE ;//
ADD HL, HL
ADD HL, HL

LD E, A
SRL E
SRL E
SRL E
ADD HL, DE

LD DE,_plotSScreen
ADD HL, DE
;// now we have the address
LD B,H
LD C,L

POP DE
POP HL


LD A,H ;// BC with address of byte in buffer
;// H with xpos1
AND 7 ;// Xpos1 mod 8
OR A ;// D with Xpos2
JP Z,DrawHorixLeftAlligned
LD E,A
LD A,8
SUB E ;// A with number of bits to plot in that byte
PUSH BC
LD B,A
XOR A
GrabMaskLineLeft:
SCF
RL A
DJNZ GrabMaskLineLeft
LD B,H
LD C,L
POP HL ;// Mask grabbed
PUSH DE

LD E,(HL)
XOR E
AND E ;// we must erase the line in this case
LD (HL),A ;// now write to the buffer
POP DE ;// D with xpos2
;// B with xpos1
LD A,B
AND 7
LD E,A
LD A,8
SUB E
ADD A,B ;// move B to the start of the next byte
LD B,A ;//
;// now we must treat the right part
INC HL ;// HL also pointing to the next Byte
DrawHorizRight:
DrawHorixLeftAlligned_and_set:
LD A,D
SUB B ;// grab how many bytes we must increment

SRL A
SRL A
SRL A

PUSH DE
LD E,A
LD D,0
ADD HL,DE
POP DE ;// HL pointing to the byte now
LD A,D ;// HL with the address
AND 7 ;//
OR A
JR Z,DrawHorixRightAlligned
;// we have the number of the bit in A
PUSH BC
LD B,A
XOR A
GrabMaskLineRight:
SCF
RL A
DJNZ GrabMaskLineRight
;// we have the mask in A
POP BC
LD E,(HL) ;// grab the byte to treat
XOR A
AND E
LD (HL),A ;// nwo we have both parts alligned so we must find ho many intersections to draw
LD A,D ;// D with Xpos2
AND 7
LD E,A
LD A,D
SUB E ;// A with Xpos intersected
LD D,A
DrawHorixRightAlligned:
DEC HL
DrawingInterSections:
LD A,D
SUB B ;// xpos2 - xpos1
SRL A
SRL A
SRL A ;// div by 8
LD B,A
XOR A
InterSectionsLoop:
LD (HL),A ;// clear the middle intersections
DEC HL
DJNZ InterSectionsLoop
RET ;// Line cleared

DrawHorixLeftAlligned:
LD A,H ;// H with xpos1 && B with half of the address
LD H,B
LD B,A ;// B with xpos1 && H with half of the address
LD A,L
LD L,C
LD C,A
JP DrawHorixLeftAlligned_and_set


SoftUpdate

when speed is critical and you don't need to update the entire LCD

Quote:


for people who don't know it this is a somewhat FastCopy with the inputs of PutSprite
Inputs
H -> xpos/8 this value ranges from 0 to 12 this because softupdate only updates bytes not bit's....

L -> ypos
C-> width
B -> height


SoftUpdate:
DI ;// Disable software interrupts
IN A,($20)
PUSH AF
XOR A
OUT ($20),A
LD A,$20
ADD A,H ;// grab Xcoord
OUT ($10),A ;// Set Colum
LD IXH,A ;// IXH with the Xcoord
LD A,$80
ADD A,L ;// grab Ycoord
PUSH HL ;// waste time
POP HL ;// waste time
PUSH HL ;// waste time
POP HL ;// waste time
OUT ($10),A ;// Set Row
LD IXL,A ;// IXL with the Ycoord
;// B with the data to output
;// now grab the address on the buffer
LD A,H ;// save H or Xcoord
LD D,0
LD H,D
LD E,L
ADD HL,HL ;// x2
ADD HL,DE ;// buffer pointer + ycoord
ADD HL,HL ;// x4
ADD HL,HL ;// x8
LD E,A
ADD HL,DE ;// Add Xpos
LD DE,_plotSScreen
ADD HL,DE ;// now we have the address on the buffer
;// Prepare for Starting Writing To Screen
LD A,$07
OUT ($10),A
LD DE,12 ;// at the end of eatch row we add 12 or the address to the next row
WritingColum: ;// we know that at the end of eatch row we must go back and add 12
PUSH HL ;// save HL temporarly
PUSH BC
LD B,C ;// now loop for B
WritingRow:
PUSH DE ;// waste 11
LD A,(HL) ;// 7
INC HL ;// 4
INC HL ;// 4
INC HL ;// 4
DEC HL ;// 4
DEC HL ;// 4
POP DE ;// waste 10
;PUSH HL
;POP HL
;PUSH HL
;POP HL
OUT ($11),A ;// send a command true the port
DJNZ WritingRow ;// 13
LD A,IXH ;// restore Xcoord
PUSH HL
POP HL
nop
nop
nop
nop
OUT ($10),A ;// write it now
POP BC ;// restore BC
POP HL ;// restore DE
ADD HL,DE ;//
;PUSH HL ;// waste time
;POP HL ;// waste time
nop
nop
nop

INC IXL
LD A,IXL
OUT ($10),A
DJNZ WritingColum ;// now write another colum
PUSH HL
POP HL
PUSH HL
POP HL
;PUSH HL
;POP HL
LD A,$05
OUT ($10),A
POP AF
OUT ($20),A
EI ;// enable software interrupts
RET ;// go back screen updated


you are free to use them as long as you give me a little credit for it!!!

I will post more like MacrodieRunApp when i get time for now i have to finish my new version of macrodie

And yes people if you are thinkjng that the new Macrodie will use SofUpdates to the Mouse Routine than i can say it will because it will make it even faster!!!
Hmm, that's actually pretty nice. You should make it maskable, though.
SoftUpdate is not intended to replace PutSprite is only intended to copy small portions of the buffer into the screen... like in the mouse routine when we only need to update the area surronding the mouse....
rayden wrote:
SoftUpdate is not intended to replace PutSprite is only intended to copy small portions of the buffer into the screen... like in the mouse routine when we only need to update the area surronding the mouse....
Fair enough. It could be easily modified to give it a sprite instead and have it mask that onto the LCD, which could speed up something like a mouse even more.
yah but when i done it i only thought of copying the buufer but yah i think it could easily improve even more the speed the way you are talking i may give it a try the only problem will be handling the two things at the same time, the sprite and the screen driver but it's possible...
  
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 2 of 8
» All times are GMT - 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