Well, not officially documented. That link you just put was the only place I could find it.
-
Fallen Ghost
- Advanced Newbie (Posts: 72)
- 05 Feb 2007 12:01:35 pm
- Last edited by Fallen Ghost on 05 Feb 2007 01:03:12 pm; edited 1 time in total
Then for my part I'd call it documented!
(Documented by WikiTI, not TI)
(Documented by WikiTI, not 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:
Homeup
Home up on the regular screen
Code:
Vnewline
Drops down a line on the graph screen
Code:
Newline
Drops down a line on the regular screen
Code:
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
Also, the "Newline" one could be optimized to this:
Code:
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:
Or, even better:
Code:
newline:
xor a
ld (curcol),a
ld hl,currow
inc (hl)
ret
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'.
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'.
add 6 works just fine for me.
The Better CP HL,DE
compares hl to de, same flag outputs as 8-bit compare
Code:
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...
The add/subtract bit is reset rather than set. This shouldn't matter unless you're using daa right after calling this...
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:
(a modification from the second version in the post, [rul=http://www.detachedsolutions.com/forum/m/14696/#msg_14696]linky[/url])
Code:
And the second works on any side with any 16 bit register and even mixes of 8 bit ones.
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.
???
the goal is to compare a 16 bit to another 16 bit. not to substract and get no result other than LSB substract.
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:
; 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
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!!!
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!!!
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. 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
» Go to Registration page
Page 2 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
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