Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Runer112

Pages: 1 ... 68 69 [70] 71 72 ... 153
1036
The Axe Parser Project / Re: Features Wishlist
« on: September 18, 2011, 06:43:59 pm »
Is your point that you can send data to ports 29 and 2A on an 83+BE without messing anything up, so you don't have to check the calculator type and possibly abort sending? That would be a good point, except for the fact that that when setting 15MHz mode, Axe actually sets mode 11b, not 01b. So port 2C would need to be modified instead of port 2A, but on the 83+BE, that's a shadow of a port that you don't want to be sending random data to.

1037
The Axe Parser Project / Re: Features Wishlist
« on: September 18, 2011, 02:13:58 pm »
Ports 29-2C simply enable or disable the delays defined in port 2E for the 4 different speed modes. If all the delays are turned off in port 2E, it doesn't matter what speed that calculator is running at or if the delay bits are set in ports 29-2C. If ports 29-2C are like circuit breaker switches, port 2E is the master breaker switch. Turn it off, and it doesn't matter what the state of any of the other switches are.

1038
The Axe Parser Project / Re: Features Wishlist
« on: September 18, 2011, 10:30:57 am »
The delay is enabled even in 6MHz mode, calc84maniac. TI dun goof'd.

1039
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: September 18, 2011, 03:15:23 am »
At this rate, I'll have optimized just about every Axe routine eventually! ;)




p_ToHex: 31 cycles faster.

Code: (Old code: 25 bytes, 670 cycles) [Select]
p_ToHex:
.db __ToHexEnd-$-1
ld b,4
ld de,vx_SptBuff
push de
__ToHexLoop:
ld a,$1F
__ToHexShift:
add hl,hl
rla
jr nc,__ToHexShift
daa
add a,$A0
adc a,$40
ld (de),a
inc de
djnz __ToHexLoop
xor a
ld (de),a
pop hl
ret
__ToHexEnd:
       
   
Code: (New code: 25 bytes, 639 cycles) [Select]
p_ToHex:
.db __ToHexEnd-$-1
ld bc,4<<8+$1F
ld de,vx_SptBuff
__ToHexLoop:
ld a,c
__ToHexShift:
add hl,hl
rla
jr nc,__ToHexShift
daa
add a,$A0
adc a,$40
ld (de),a
inc e
djnz __ToHexLoop
ex de,hl
ld (hl),b
ld l,vx_SptBuff&$FF
ret
__ToHexEnd:
       




p_ShiftLeft: 1 byte smaller, 67 cycles faster. You could save an additional 384 cycles by giving up the minor size savings and loading 12<<8+4 into de at the start of the routine and then replacing the immediate data operands in the loop with d and e.

Code: (Old code: 17 bytes, 27542 cycles) [Select]
p_ShiftLeft:
.db __ShiftLeftEnd-1-$
ld hl,plotSScreen+767
ld c,64
__ShiftLeftLoop:
ld b,12
or a
__ShiftLeftShift:
rl (hl)
dec hl
djnz __ShiftLeftShift
dec c
jr nz,__ShiftLeftLoop
ret
__ShiftLeftEnd:
       
   
Code: (New code: 16 bytes, 27475 cycles) [Select]
p_ShiftLeft:
.db __ShiftLeftEnd-1-$
ld hl,plotSScreen+767
xor a
__ShiftLeftLoop:
ld b,12
__ShiftLeftShift:
rl (hl)
dec hl
djnz __ShiftLeftShift
add a,4
jr nz,__ShiftLeftLoop
ret
__ShiftLeftEnd:
       




p_ShiftRight: 1 byte smaller, 67 cycles faster. Same deal as p_ShiftLeft.

Code: (Old code: 17 bytes, 27542 cycles) [Select]
p_ShiftRight:
.db __ShiftRightEnd-1-$
ld hl,plotSScreen
ld c,64
__ShiftRightLoop:
ld b,12
or a
__ShiftRightShift:
rr (hl)
inc hl
djnz __ShiftRightShift
dec c
jr nz,__ShiftRightLoop
ret
__ShiftRightEnd:
       
   
Code: (New code: 16 bytes, 27475 cycles) [Select]
p_ShiftRight:
.db __ShiftRightEnd-1-$
ld hl,plotSScreen
xor a
__ShiftRightLoop:
ld b,12
__ShiftRightShift:
rr (hl)
inc hl
djnz __ShiftRightShift
add a,4
jr nz,__ShiftRightLoop
ret
__ShiftRightEnd:
       




p_FreqOut: 1 byte smaller. Takes advantage of an absolute jump. This is a strange routine to optimize, because optimizing it results in it running about 15% faster which would result in slightly higher pitched and shorter notes. Although this command is rarely used, this augmentation might still make the optimization not worth it. Whether or not you include the optimization, it might be a good idea to change this routine to use p_Safety.

Code: (Old code: 23 bytes) [Select]
p_FreqOut:
.db __FreqOutEnd-1-$
xor a
__FreqOutLoop1:
push bc
ld e,a
__FreqOutLoop2:
ld a,h
or l
jr z,__FreqOutDone
dec hl
dec bc
ld a,b
or c
jr nz,__FreqOutLoop2
ld a,e
xor %00000011
scf
__FreqOutDone:
pop bc
out ($00),a
ret nc
jr __FreqOutLoop1
__FreqOutEnd:
       
   
Code: (New code: 22 bytes) [Select]
p_FreqOut:
.db __FreqOutEnd-1-$
xor a
__FreqOutLoop1:
push bc
ld e,a
__FreqOutLoop2:
ld a,h
or l
jr z,__FreqOutDone
cpd
jp pe,__FreqOutLoop2
ld a,e
xor %00000011
scf
__FreqOutDone:
pop bc
out ($00),a
ret nc
jr __FreqOutLoop1
__FreqOutEnd:
       




p_IntSetup: 4 bytes smaller. I thought this was some pretty impressive work. ;D And regarding interrupts, I still think the port 6 saving and restoring shenanigans aren't necessary for programs. The only reason port 6 would need to be restored to the value it held when interrupts were enabled is if the user is using a shell application in conjugation with their Axe program. In that case, either the designer of the shell application interface system could provide modified interrupt routines in an Axiom, or the user is probably intelligent enough to be able to provide their own interrupt routines. (Actually it wouldn't even need to be their own, they could just copy the one for applications from the Commands.inc file)

Code: (Old code: 42 bytes, a lot of cycles) [Select]
p_IntSetup:
.db __IntEnd-p_IntSetup-1
di
ld de,$8B01
ld a,d
ld i,a
ld a,l
ld hl,$8B00
ld b,e
ld c,l
ld (hl),$8A
ldir

and %00000110
out (4),a
ld a,%00001000
out (3),a
ld a,(hl)
out (3),a

ld d,a
ld e,a
ld c,__IntDataEnd-__IntData
ld hl,$0000
ldir

in a,(6)
ld ($8A8A+__IntDataSMC-__IntData+1),a
__IntEnd:
.db rp_Ans,9
       
   
Code: (New code: 38 bytes, more cycles but who cares?) [Select]
p_IntSetup:
.db __IntEnd-p_IntSetup-1
di
ld a,l
ld hl,$8C06
ld de,$8C05
ld bc,$8C05-$8A8A

and l
out (4),a
ld a,h
out (3),a
dec a
ld i,a
dec a
out (3),a

ld (hl),a
lddr

ld hl,$0000
ld c,__IntDataEnd-__IntData
ldir

in a,(6)
ld ($8A8A+__IntDataSMC-__IntData+1),a
__IntEnd:
.db rp_Ans,11
       




p_DtoF: 2 bytes smaller. Takes advantage of a bcall to do the same thing. It appears that B_CALL(_SetXXXXOP2) always returns OP2+1, which could be used to save an additional 2 bytes, but this bcall could theoretically be changed in future OS versions and break this optimization.

Code: (Old code: 13 bytes, a lot of cycles) [Select]
p_DtoF:
.db 13
ex (sp),hl
B_CALL(_SetXXXXOP2)
ld hl,OP2
pop de
ld bc,9
ldir
       
   
Code: (New code: 11 bytes, a lot plus a few cycles) [Select]
p_DtoF:
.db 11
ex (sp),hl
B_CALL(_SetXXXXOP2)
ld hl,OP2
pop de
B_CALL(_Mov9B)
       

1040
The Axe Parser Project / Re: Features Wishlist
« on: September 18, 2011, 02:12:11 am »
This is less of a feature request and more of a feature no-brainer. I don't know how I forgot about this for so long.

As we all know, TI can be quite idiotic sometimes. And they were very idiotic when they decided to add ports 29h-2Eh. These ports don't do anything on an 83+. But on the 15MHz calculators, they inject an extra cycle into some memory access instructions. The affected instructions are opcode reads from flash and all memory writes. Apparently TI thought certain memory operations required a small delay, but as far as I and other experienced assembly programmers know, these delays aren't necessary. This means that on a 15MHz calc, any applications and OS calls will run about 5-25% slower and routines that write to memory will run perhaps 1-3% slower for no reason.

You may think, why not just have users permanently disable this delay? That sounds like a good idea at first, but you have to take into account all pre-existing programs. They were designed without knowledge of this port, so many of them may actually unknowingly rely on the delay for their program to run at the programmer's desired speed. For compatibility with all existing programs, this port needs to stay at it's original delay-inducing value. If you want your program to run faster on a 15MHz calculator though, ideally you would want to do is (if the calculator isn't an 83+) save the value of [wikiti]83Plus:Ports:2E[/wikiti], set it to 0 for the duration of the program, and then restore it to its original value when returning. This is done easily enough by reading the port, pushing it's value, outputting 0, calling the program, and then restoring the original port value before returning for good.


I guess the only question is how you would want to implement this. I see a few possibilities:
  • Include this as a standard command, but instruct programmers to only call it once at the start of the program and not to use an instant return.
  • Include an option inside the Axe application to automatically add this wrapper to all compiled programs. If the option is enabled, an alternate instant return routine would be used.
  • Give programs the ability to define this option like metadata. If the option is enabled, an alternate instant return routine would be used.
  • Automatically add this wrapper to all compiled programs. The instant return routine would be changed.

My favorite option would be the third one. It would be a good idea to enforce that this command exist before any code.

1041
Axe / Re: Better way?
« on: September 16, 2011, 11:35:38 am »
What are you referring to? I didn't use any square-like symbols in my code. Perhaps your computer is rendering a character wrong? This is what the code should look like:

Spoiler For Code:


1042
Axe / Re: Better way?
« on: September 16, 2011, 10:12:16 am »
If you're not compiling your program as an application, try this:

Code: [Select]
:"vS00"→Str0
:D^10*256+(D/10)+ᴇ3030→{Str0+2}ʳ
:GetCalc(Str0,Y₁)


If you are compiling your program as an application, try this:

Code: [Select]
:"vS00"→Str0
:Copy(Str0,ᴇ984D,5)
:D^10*256+(D/10)+ᴇ3030→{ᴇ984D+2}ʳ
:GetCalc(ᴇ984D,Y₁)

1043
Axe / Re: Can Axe mess with Group files?
« on: September 12, 2011, 05:06:41 pm »
Nope. And I'd personally stay away from group files as much as possible, they're made of pure evil.

1044
Miscellaneous / Re: Coding Font
« on: September 12, 2011, 03:55:02 pm »
Wingdings.

(If you can't see the font properly below, then your computer is too weak to harness the power of Wingdings)


SMulHbyE:
   ld   a,h
   call   MulHbyE

   rlca
   jr   nc,SMulHbyE_Skip
   rrca
   add   a,h
   ld   h,a
   bit   7,e
   ret   z
   add   a,e
   ld   h,a
   ret

SMulHbyE_Skip:
   bit   7,e
   ret   z
   ld   a,h
   add   a,e
   ld   h,a
   ret

1045
Axe / Re: Pictures, etc.
« on: September 11, 2011, 06:14:25 pm »
You can copy a picture to a buffer and then draw whatever you want on top of it. Just copy the picture data to the buffer every frame before drawing anything else with code like this:

Code: [Select]
Copy([Pic1],L₆,768)


And you can't include the value of a variable in a data declaration because all the data is added to the program at compile time, whereas variables only have meaningful values at run time. If you must include a variable in a list of data, you can do something like the following:

Code: [Select]
Data(0,number,number,etc)→GDB0
variable→{GDB0}

1046
TI-Boy SE - Game Boy Emulator For TI-83+SE/84 / Re: pokemon saves
« on: September 11, 2011, 12:21:50 pm »
Here are the four TI-Boy appvars for a completed game of Pokemon Red, which includes Mew of course. These saves will only work if the TI-Boy app you're using is called "Pokemon", but if you want them to work with an app of a different name, I think I can modify them for that. These save files should be compatible with Pokemon Blue too. The graphics may be messed up when you first continue the game though. If so, just walk down a few steps and they should correct themselves when you change areas.

I guess there isn't much exploring left to do with a completed save, but I don't have any saves that are only partially or mostly completed with good Pokemon. It can still be fun to play around with end-game Pokemon, though. They're not even level 100s, so you could work on playing through the Elite Four and training them I guess.

1047
Axe / Re: How to make axe program stores/loads from external var?
« on: September 10, 2011, 05:44:55 pm »
You should always have error handling code when dealing with OS variable reading/creating. Here are routines for both directions, with error handling.


OS float to Axe variable:

Code: [Select]
If GetCalc("varA")  .var is the u token found at 2nd+7
float{}→A           .float{ is the fPart( token
Else
.Not found
End

Axe variable to OS float:

Code: [Select]
A→float{GetCalc("varA",7)}
!If  and 0
.Not enough RAM
End

1048
ASM / Re: Space for Fourth Buffer
« on: September 10, 2011, 02:01:04 pm »
I just ran a program under MirageOS that disables interrupts and then sets 733 bytes starting at statVars to $FF. Upon returning, I notice no errors with MirageOS and no changed options. So it certainly seems like you can trash as much of statVars as you want, just make sure you disable MirageOS's interrupt handler. Maybe MirageOS uses a few bytes for options, like the return location, but setting them to $FF doesn't appear to mess up MirageOS anyways as far as I can tell. Perhaps I need to set a certain byte to a certain value to cause bugs in MirageOS, but I don't know of any such byte.

1049
Axe / Re: Making my code faster
« on: September 09, 2011, 03:50:23 pm »
Pause statements is a crude way, but it works well.

Wouldn't that make the game slower, not faster?


Frameskipping would speed it up. ( So only display every other frame ).

With that, the game speed would remain the same, but it would be even choppier (notes and such would pass at half speed but seemingly at 2 pixels per jump)

Each frame sent to the screen takes about 1/100th of a second, and on top of that there's the time needed to render the frame. Cutting out about 15-20 of these per second would certainly save a lot of processing time, allowing the game to run faster.

1050
TI Z80 / Re: Zedd Physics Library
« on: September 07, 2011, 11:00:30 pm »
Thanks :] I had to first downgrade to 0.5.3 to get all multiplication support, and then directly modify the Zedd engine and bypass all the user friendly stuff that Zedd should be offering, but that couldn't be offered because 0.5.3 doesn't support constants.  I also had to change all the names of the subroutines because I was using 5 characters and 0.5.3 only supports 3 X.X  It looked a lot worse, but still worked pretty well.

Wouldn't Axe 1.0.2 work fine? I'm THINK all the flash corrupting bugs were solved by 1.0.2, although it still sometimes throws bad flash errors when it shouldn't.

Pages: 1 ... 68 69 [70] 71 72 ... 153