Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
24 May, 2013, 04:19:20 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1] 2   Go Down
  Print  
Author Topic: Constructive and Creative uses of RLD and RRD -  (Read 1157 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
ralphdspam
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 14 May, 2013, 09:10:11
Date Registered: 01 February, 2011, 07:58:40
Location: California, USA
Posts: 841


Topic starter
Total Post Ratings: +36

View Profile
« on: 26 August, 2011, 03:06:44 »
0

I saw the topic "Constructive and Creative uses of IX and IY," and I liked the idea of brainstorming creative uses for commands. 

Two commands that always perplex me are RLD and RRD.  I cannot think of many practical uses of them. 
Logged

ld a, 0
ld a, a
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Online Online

Gender: Male
Last Login: Today at 04:09:00
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #1 on: 26 August, 2011, 05:11:00 »
0

I use one of those in TI-Boy to emulate the SWAP (HL) instruction, which swaps the upper and lower nibbles of (HL).
It works like ld a,(hl) \ rrd.
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
DrDnar
LV6 Super Member (Next: 500)
******
Offline Offline

Last Login: Today at 00:39:46
Date Registered: 29 October, 2010, 00:08:46
Posts: 460

Total Post Ratings: +76

View Profile
« Reply #2 on: 26 August, 2011, 08:20:18 »
0

As far as I can tell, the instructions are intended for use with BCD. They appear to allow multiplying and dividing by ten. Or sixteen, if you're using binary.
Logged

"The tools which would teach men their own use would be beyond price."—The Republic
thepenguin77
z80 Assembly Master
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: Today at 03:20:50
Date Registered: 14 December, 2009, 04:21:52
Location: Purdue
Posts: 1484


Total Post Ratings: +778

View Profile
« Reply #3 on: 26 August, 2011, 21:12:08 »
0

Indeed, the only time I've ever used it was for BCD. It's useful if you need to recover a number from TI's floating points. For instance:


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
turnTheEntireOp1ToADecimalStringRegardlessOfSignificateFigures:
ld hl, op1+2
ld c, 7
outerLoop:
ld b, 2
innerLoop:
ld a, $30
rld
ld (de), a
inc de
djnz innerLoop
inc hl
dec c
jr nz, outerLoop
xor a
ld (de), a
ret
Logged

zStart v1.3.011 4-29-2013  zStart fully works on 83+BE's (except custom font)
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112
ralphdspam
LV8 Addict (Next: 1000)
********
Offline Offline

Gender: Male
Last Login: 14 May, 2013, 09:10:11
Date Registered: 01 February, 2011, 07:58:40
Location: California, USA
Posts: 841


Topic starter
Total Post Ratings: +36

View Profile
« Reply #4 on: 27 August, 2011, 00:01:52 »
0

I'm glad there are actually uses for that command.  I like the idea of manipulating nibbles, but I don't like the fact that it modifies the source data.  Can you use it on ROM code without any problems? 
Logged

ld a, 0
ld a, a
calcdude84se
Needs Motivation
Members
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 14 May, 2013, 16:12:14
Date Registered: 21 April, 2010, 04:20:59
Posts: 2207


Total Post Ratings: +62

View Profile
« Reply #5 on: 27 August, 2011, 03:01:12 »
0

I'm glad there are actually uses for that command.  I like the idea of manipulating nibbles, but I don't like the fact that it modifies the source data.  Can you use it on ROM code without any problems? 
You probably shouldn't be manipulating code by nibble Tongue Anyway, A contains the correct result even if (HL) can't be changed, IIRC.
Logged

"People think computers will keep them from making mistakes. They're wrong. With computers you make mistakes faster."
-Adam Osborne
Bug me about PartesOS. I might just need reminding.
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Online Online

Gender: Male
Last Login: Today at 04:09:00
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #6 on: 27 August, 2011, 04:30:15 »
0

* calc84maniac uses OPTIMIZATION

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
turnTheEntireOp1ToADecimalStringRegardlessOfSignificateFigures:
ld hl, op1+2
ld b, 7
ld a, $30
loop:
rld
ld (de), a
inc de
rld
ld (de), a
inc de
inc hl
djnz loop
xor a
ld (de), a
ret

Edit:
Ooh, even better!

1
2
3
4
5
6
7
8
9
10
11
12
13
turnTheEntireOp1ToADecimalStringRegardlessOfSignificateFigures:
ld hl, op1+2
ld bc, 7
loop:
ld a, $33
rrd
ldi
ld (de), a
inc de
jp pe, loop
xor a
ld (de), a
ret
« Last Edit: 27 August, 2011, 04:40:08 by calc84maniac » Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
Xeda112358
Xombie. I am it.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Last Login: Yesterday at 22:01:23
Date Registered: 31 October, 2010, 08:46:36
Location: Land of Little Cubes and Tea, NY
Posts: 3760


Total Post Ratings: +610

View Profile
« Reply #7 on: 31 December, 2011, 06:40:38 »
0

Ooh, rrd and rld are some of my favorite instructions! When I was describing what it does in my pocket asm tutorial was this:
Quote
rrd/rld the two nibbles from (hl) and the last nibble of 'a' make three nibbles. rrd                
           rotates them right and rld rotates them left.
As for a way to use them, I have a few codes that make excellent use of them. This one is from my program BSPRT. It uses hexadecimal sprite data, so instead of converting the hex string to a location in RAM and then copying it to the screen, I just did both at once (here is the sprite display part):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
;Inputs:
;     HL points to the buffer location to draw to
;     DE points to the sprite data

     ld bc,080Ch     ;010C08
Loop:
     call PutNibble  ;CD****
     call PutNibble  ;CD****
     ld a,b          ;78
     ld b,0          ;0600
     add hl,bc       ;09
     ld b,a          ;47
     djnz Loop       ;10F3
     ret             ;C9
PutNibble:
     ld a,(de)       ;1A
     add $C0         ;C6C0
     jr nc,$+4       ;3002
       sub 7         ;D607
     rld             ;ED6F
     inc de          ;13
     ret             ;C9
This is my favorite one, though. When I made a graph shifting routine, I made these to shift 4 pixels very quickly:

1
2
3
4
5
6
7
8
9
10
11
12
ShiftLeft4:
     ld hl,GraphBuf+767
     ld c,64
       xor a
       ld b,12
         rld
         dec hl
         djnz $-3
       dec c
       jr nz,$-9
       ret

1
2
3
4
5
6
7
8
9
10
11
12
ShiftRight4:
     ld hl,GraphBuf
     ld c,64
       xor a
       ld b,12
         rrd
         inc hl
         djnz $-3
       dec c
       jr nz,$-9
       ret
I feel pretty proud of these Smiley I think the first can be optimised more, but it is still nice, I think Smiley
Logged



Grammer Download (2.29.04.12)
Latest update (possibly incomplete)
My pastebin
Spoiler for FileSyst:
FileSyst is an application that provides a folder and filesystem for the TI-83+/84+ calculators. It is designed to be easy to access and use in BASIC, and it can be used to access game files and save data, or to create a command prompt, among other things:

Spoiler for Graphiti:
This is a graph explorer for graph theory. It will require lots of work to finish. Currently you can:
Add/delete vertices
Add edges (direction not shown, but they are directed)
Arrange vertices in a circle (in the future, you will be able to define levels of rings and the number of nodes in each)
Create complete graphs quickly

Plans:
Add adjacency matrix viewer
Deleting edges
Multiple graphs support
Arrows for directed graphs
Planarity testing
Matrix operations
Weighted edges
Chromatic polynomials
Chromatic numbers

Spoiler for Stats:

Samocal             [o---------]
Virtual Processor   [o---------]
EnG                 [oo--------]
Grammer             [ooo-------]
AsmComp             [ooo-------]
Partex              [oooo------]
BatLib              [oooooooo--]
Grammer82           [----------]
Grammer68000        [----------]


Pseudonyms:  Zeda, Xeda, Thunderbolt
Languages:   English, français
Programming: z80 Assmebly
             Grammer
             TI-BASIC (83/84/+/SE, 89/89t/92)
Known For:   -Creator of the Grammer programming language
              (Winning program of zContest2011)
             -BatLib- One of the most feature packed libraries for BASIC programmers available
              with over 100 functions and a simple programming language
             -Learning to program z80 in hexadecimal before using an assembler (no computer was
              available!)
╔═╦╗░╠═╬╣▒║ ║║▓╚═╩╝█


chickendude
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Female
Last Login: 21 May, 2013, 19:04:07
Date Registered: 06 September, 2008, 11:27:30
Posts: 435

Total Post Ratings: +66

View Profile
« Reply #8 on: 31 December, 2011, 12:32:36 »
0

Unless i'm missing something, the first just says "Array", maybe you pasted the wrong thing?
Logged
Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Yesterday at 19:39:26
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2055


Total Post Ratings: +256

View Profile
« Reply #9 on: 31 December, 2011, 13:49:29 »
0

It is because she wrote [code=something].
Here is what she meant Smiley


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
;Inputs:
;     HL points to the buffer location to draw to
;     DE points to the sprite data

     ld bc,080Ch     ;010C08
Loop:
     call PutNibble  ;CD****
     call PutNibble  ;CD****
     ld a,b          ;78
     ld b,0          ;0600
     add hl,bc       ;09
     ld b,a          ;47
     djnz Loop       ;10F3
     ret             ;C9
PutNibble:
     ld a,(de)       ;1A
     add $C0         ;C6C0
     jr nc,$+4       ;3002
       sub 7         ;D607
     rld             ;ED6F
     inc de          ;13
     ret             ;C9
Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
Xeda112358
Xombie. I am it.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Last Login: Yesterday at 22:01:23
Date Registered: 31 October, 2010, 08:46:36
Location: Land of Little Cubes and Tea, NY
Posts: 3760


Total Post Ratings: +610

View Profile
« Reply #10 on: 31 December, 2011, 17:21:06 »
0

Unless i'm missing something, the first just says "Array", maybe you pasted the wrong thing?
I am not seeing that... On mine, Hayleia and I have the same thing...
Logged



Grammer Download (2.29.04.12)
Latest update (possibly incomplete)
My pastebin
Spoiler for FileSyst:
FileSyst is an application that provides a folder and filesystem for the TI-83+/84+ calculators. It is designed to be easy to access and use in BASIC, and it can be used to access game files and save data, or to create a command prompt, among other things:

Spoiler for Graphiti:
This is a graph explorer for graph theory. It will require lots of work to finish. Currently you can:
Add/delete vertices
Add edges (direction not shown, but they are directed)
Arrange vertices in a circle (in the future, you will be able to define levels of rings and the number of nodes in each)
Create complete graphs quickly

Plans:
Add adjacency matrix viewer
Deleting edges
Multiple graphs support
Arrows for directed graphs
Planarity testing
Matrix operations
Weighted edges
Chromatic polynomials
Chromatic numbers

Spoiler for Stats:

Samocal             [o---------]
Virtual Processor   [o---------]
EnG                 [oo--------]
Grammer             [ooo-------]
AsmComp             [ooo-------]
Partex              [oooo------]
BatLib              [oooooooo--]
Grammer82           [----------]
Grammer68000        [----------]


Pseudonyms:  Zeda, Xeda, Thunderbolt
Languages:   English, français
Programming: z80 Assmebly
             Grammer
             TI-BASIC (83/84/+/SE, 89/89t/92)
Known For:   -Creator of the Grammer programming language
              (Winning program of zContest2011)
             -BatLib- One of the most feature packed libraries for BASIC programmers available
              with over 100 functions and a simple programming language
             -Learning to program z80 in hexadecimal before using an assembler (no computer was
              available!)
╔═╦╗░╠═╬╣▒║ ║║▓╚═╩╝█


Hayleia
Programming Absol
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Last Login: Yesterday at 19:39:26
Date Registered: 01 June, 2011, 20:12:47
Location: ud-ud ?
Posts: 2055


Total Post Ratings: +256

View Profile
« Reply #11 on: 31 December, 2011, 17:23:43 »
0

Unless i'm missing something, the first just says "Array", maybe you pasted the wrong thing?
I am not seeing that... On mine, Hayleia and I have the same thing...
Huh? I see "Array" too on yours. Maybe it depends on the browser.
But do you see "BSPRT" next to "code" ? (I don't see it, I had to quote you to see it should be here Wink)
« Last Edit: 02 January, 2012, 19:27:43 by Hayleia » Logged





Spoiler for what I am according to...:
me: useless
Pokemon Test: an Absol
turiqwalrus: an eggplant
p2: A HUMAN BEING !
Blackpilar and p2: iplantonlyplantwantplanttoplantknowplantifplantyouplantareplantaplantboyplantorplantaplantgirlplant
click here to know where you got your last +1s
chickendude
LV6 Super Member (Next: 500)
******
Offline Offline

Gender: Female
Last Login: 21 May, 2013, 19:04:07
Date Registered: 06 September, 2008, 11:27:30
Posts: 435

Total Post Ratings: +66

View Profile
« Reply #12 on: 31 December, 2011, 18:00:35 »
0

Well, it doesn't really matter now as i see what code you were talking about in Hayleia's post. Btw, what exactly do you mean by "hexidecimal sprites"? I'm trying to figure out what exactly your code does.
Logged
Xeda112358
Xombie. I am it.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Last Login: Yesterday at 22:01:23
Date Registered: 31 October, 2010, 08:46:36
Location: Land of Little Cubes and Tea, NY
Posts: 3760


Total Post Ratings: +610

View Profile
« Reply #13 on: 31 December, 2011, 21:10:01 »
0

Ah, well with that code, will draw a sprite with hexadecimal data input. By that, I mean . db "3C4281818181423C" as opposed to .db 3Ch,42h,81h,81h,81h,81h,42h,3Ch

The first is what a TI-BASIC string would be like and the program that code is in is designed for TI-BASIC programmers to use.
Logged



Grammer Download (2.29.04.12)
Latest update (possibly incomplete)
My pastebin
Spoiler for FileSyst:
FileSyst is an application that provides a folder and filesystem for the TI-83+/84+ calculators. It is designed to be easy to access and use in BASIC, and it can be used to access game files and save data, or to create a command prompt, among other things:

Spoiler for Graphiti:
This is a graph explorer for graph theory. It will require lots of work to finish. Currently you can:
Add/delete vertices
Add edges (direction not shown, but they are directed)
Arrange vertices in a circle (in the future, you will be able to define levels of rings and the number of nodes in each)
Create complete graphs quickly

Plans:
Add adjacency matrix viewer
Deleting edges
Multiple graphs support
Arrows for directed graphs
Planarity testing
Matrix operations
Weighted edges
Chromatic polynomials
Chromatic numbers

Spoiler for Stats:

Samocal             [o---------]
Virtual Processor   [o---------]
EnG                 [oo--------]
Grammer             [ooo-------]
AsmComp             [ooo-------]
Partex              [oooo------]
BatLib              [oooooooo--]
Grammer82           [----------]
Grammer68000        [----------]


Pseudonyms:  Zeda, Xeda, Thunderbolt
Languages:   English, français
Programming: z80 Assmebly
             Grammer
             TI-BASIC (83/84/+/SE, 89/89t/92)
Known For:   -Creator of the Grammer programming language
              (Winning program of zContest2011)
             -BatLib- One of the most feature packed libraries for BASIC programmers available
              with over 100 functions and a simple programming language
             -Learning to program z80 in hexadecimal before using an assembler (no computer was
              available!)
╔═╦╗░╠═╬╣▒║ ║║▓╚═╩╝█


Quigibo
The Executioner
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 21 May, 2013, 02:03:21
Date Registered: 22 January, 2010, 05:02:37
Location: Los Angeles
Posts: 2022


Total Post Ratings: +1019

View Profile
« Reply #14 on: 02 January, 2012, 13:07:01 »
0

Axe uses RRD and RLD for nibble storing.  I've never used them anywhere else, they are definitely very uncommon.  Get Ninja'd


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
;hl = Nth nibble after address $8000
;e = Nibble to store there
NibSto:
scf
rr h
rr l
jr nc,__NibStoHigh
rrd
ld a,e
rld
ret
__NibStoHigh:
rld
ld a,e
rrd
ret
__NibStoEnd:
« Last Edit: 02 January, 2012, 13:07:40 by Quigibo » Logged

___Axe_Parser___
Today the calculator, tomorrow the world!
Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.326 seconds with 30 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.