Author Topic: ASM Command of the Week  (Read 20377 times)

0 Members and 1 Guest are viewing this topic.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: ASM Command of the Week
« Reply #30 on: March 14, 2012, 04:43:20 am »
The hidden flags only exist on the old models of the TI-83+, though (the ones with real Zilog chips)
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline ZippyDee

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 729
  • Rating: +83/-8
  • Why not zoidberg?
    • View Profile
Re: ASM Command of the Week
« Reply #31 on: March 14, 2012, 06:08:07 am »
But is there actually any use for the hidden flags? Are the values documented?
There's something about Tuesday...


Pushpins 'n' stuff...


Offline Hot_Dog

  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3006
  • Rating: +445/-10
    • View Profile
Re: ASM Command of the Week
« Reply #32 on: April 03, 2012, 10:59:53 am »
EXX

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: ASM Command of the Week
« Reply #33 on: April 03, 2012, 11:12:32 am »
That is a pretty useful command, especially if you need more registers, or you need to preserve some and you don't use interrupts. I personally rarely use interrupts, so super complicated math functions get to use b'c'd'e'h'l' :D

So details:
4 cycles, 1 byte, hex code: D9
Swaps registers with shadow registers


So as a really poor example, say I need to copy some data to memory somewhere, but I need to preserve all registers for some reason. Also, assume you don't need interrupts :P

Code: [Select]
di
exx
ld bc,768
ld hl,BufData
ld de,plotSScreen
ldir
exx
And yay, your registers are preserved :D

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: ASM Command of the Week
« Reply #34 on: April 03, 2012, 11:13:46 am »
I use shadow BC, DE, HL in all of my intense rendering methods: Project M parallax tilemapper, F-Zero mode7 engine, and TI-Boy tilemapping. (I rarely find a need to use shadow AF, which I would usually give to interrupts).

Also, shadow registers play a crucial role in TI-Boy's CPU emulator, as they hold the Game Boy's BC,DE,HL registers. This allows me to execute many GBZ80 opcodes almost directly, by doing something like exx \ add a,e \ exx in order to emulate add a,e, etc.
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: ASM Command of the Week
« Reply #35 on: April 03, 2012, 11:14:29 am »
Wow, nice, now I see why it is so fast o.o

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: ASM Command of the Week
« Reply #36 on: April 03, 2012, 06:40:52 pm »
@calc84:That's pretty cool. =)

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: ASM Command of the Week
« Reply #37 on: September 03, 2012, 03:43:43 am »
Can anyone think of a good use for otd/oti? I just saw JimE's Keyin routine which has a pretty interesting use of ini to store all DI keypresses into saferam that you can access using "bit key,(iy+keygroup)". It's a pretty interesting idea i might implement into some of my programs, especially since you don't have to worry about registers getting overwritten :)

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: ASM Command of the Week
« Reply #38 on: September 03, 2012, 08:23:15 am »
I have used these commands to read/write data to the LCD ports.

EDIT: For example, if I wanted to draw a simple sprite, assuming the LCD coordinates are already loaded:
Code: [Select]
     ld bc,0811h       ;b=8, size of the sprite, c=11h, the LCD Data port
     ld hl,SpriteData
DrawLoop:
     <<any code to provide a proper delay>>
     outi
     jr nz,DrawLoop
     ret
SpriteData:
     .db 3Ch,42h,81h,81h,81h,81h,42h,3Ch    ;ball

Offline chickendude

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 817
  • Rating: +90/-1
  • Pro-Riot Squad
    • View Profile
Re: ASM Command of the Week
« Reply #39 on: September 03, 2012, 01:37:01 pm »
That's what i figured they could be used for, though i was thinking more along the lines of a fastcopy routine. Thanks for the sample.

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: ASM Command of the Week
« Reply #40 on: September 03, 2012, 05:58:41 pm »
Let's not forget USB.

Code: [Select]
send8BytesBitsOverPipe0:
ld hl, bytesToSend
ld bc, 8*256+$A0
otir
ret

Code: [Select]
;#######################################
;take in all the bytes from a port
;input: c = port
;output: b = bytes received
importBytes:
ld b, 0
importLoop:
in a, ($96)
or a
ret z
ini ;this dec's b
inc b
inc b
jr importLoop


Every USB program includes some form of ini/inir and oti/otir. The reason you can do this is because the USB driver has internal buffers and does not need a delay when you write to it.
zStart v1.3.013 9-20-2013 
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

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: ASM Command of the Week
« Reply #41 on: September 05, 2012, 12:33:48 pm »
Hmm, so if I am reading your post properly, the first code sends 8 bytes to port $A0, and the second writes all the bytes being received, to HL, and then returns the number of bytes that were received? Is USB control that easy?

Offline thepenguin77

  • z80 Assembly Master
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1594
  • Rating: +823/-5
  • The game in my avatar is bit.ly/p0zPWu
    • View Profile
Re: ASM Command of the Week
« Reply #42 on: September 05, 2012, 01:51:46 pm »
Hmm, so if I am reading your post properly, the first code sends 8 bytes to port $A0, and the second writes all the bytes being received, to HL, and then returns the number of bytes that were received? Is USB control that easy?

The one that reads all of the data is that easy. The driver basically says, "I got some data for you" and you read it all.

The output one is super simplified, but this small section of code does appear in most data transfer code.


USB is super hard.
« Last Edit: September 05, 2012, 01:52:19 pm by thepenguin77 »
zStart v1.3.013 9-20-2013 
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

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: ASM Command of the Week
« Reply #43 on: September 07, 2012, 09:07:38 am »
Okay, I will have to experiment a little with that, then. I don't care to use a standard USB protocol, anyways.

Offline shmibs

  • しらす丼
  • Administrator
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2132
  • Rating: +281/-3
  • try to be ok, ok?
    • View Profile
    • shmibbles.me
Re: ASM Command of the Week
« Reply #44 on: September 07, 2012, 10:11:17 am »
ooh, are you going to be using it for direct linking between calcs?