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 - Xeda112358

Pages: 1 [2] 3 4 ... 310
16
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: October 20, 2019, 10:47:31 am »
p_EQ0

The current routine is 7 bytes and 36cc:
Code: [Select]
;7 bytes, 36cc
ld a,l
or h
add a,255
sbc hl,hl
inc hl

But we can save 8cc without sacrificing bytes:
Code: [Select]
;7 bytes, 28cc
xor a
cp h
ld h,a
sbc a,l
sbc a,a
ld l,a
inc l

17
ASM / Re: Using APD in your program
« on: October 18, 2019, 11:45:40 am »
Oh, I see what you mean. I know there must be a better way, but maybe set up a context hook that is just
Code: [Select]
.db $83
rst 0
This way it always crashes if the "context" changes.
http://wikiti.brandonw.net/index.php?title=83Plus:BCALLs:502C

The "apps" that it refers to are, for example, the program editor, homescreen, and others. You can find them in the ti83plus.inc file in the section of equates that start with "cx" (not "_cx" !)

18
ASM / Re: Using APD in your program
« on: October 18, 2019, 10:36:34 am »
As long as the user doesn't disable the RAM execution limit, you could `jp $C000` and that automatically crashes the calc.

19
Grammer / Re: Grammer 2-The APP
« on: October 02, 2019, 10:08:44 pm »
I (re)updated the download in the Latest Releases thread with some more bug fixes. Also, I added in the arctangent routine after @E37 bugged me about it. It was a little more work than I was expecting, but it is useful. In fact, if you supply two arguments, it works as an arctan2 routine :)

So bug fixes:
- Another bug in Send( was fixed
- inString( was just plain broken, so I fixed that and had to adjust the Lbl routine to work with the fix.
- Vertical caused some exciting crashes, so I fixed that and even optimized it.

20
I think you want a solve( command. I don't have my nspire on me and won't for a while so I can't tell you how to use solve( on the nspire, but good luck!

21
Axe / Re: Guts of a program editor
« on: September 26, 2019, 06:32:44 pm »
That menu looks so nice in your editor example! I'm about an hour from being able to actually check it out, but it all looks fantastic so far!

22
TI-BASIC / Re: How to obtain the id of a calculator for program security?
« on: September 22, 2019, 09:16:54 am »
I don't believe that there is an easy way. You would need an assembly program, but it would need to enable flash protection (non-trivial) in order to read those bytes. Once that is done, though, it is pretty easy to get in assembly code, see WikiTI.

23
The Axe Parser Project / Re: Assembly Programmers - Help Axe Optimize!
« on: September 21, 2019, 07:19:54 pm »
Here is an optimized p_LineShr routine. NOTE: It flips the meaning of the carry flag on output, so the line routines that use this will need to ret c instead of ret nc.
Original routine
Code: [Select]
p_LineShr:
.db __LineShrEnd-$-1
;; l=y2, ix=buff, (sp)=ret, (sp+2)=ret_2, (sp+4)=x2, (sp+6)=y1, (sp+8)=x1
ld a,l
pop bc
pop hl
pop de
ex (sp),hl
ld d,l
pop hl
ex (sp),hl
push bc

;; a=y2, d=y1, e=x2, l=x1, (sp)=ret, (sp+2)=ret_2
cp 64
ret nc
ld h,a
ld a,d
cp 64
ret nc

ld a,l
cp 96
ret nc
ld a,e
cp 96
ret nc

sub l
jr nc,__LineShrSkipRev
ex de,hl
neg

;; a=dx, d=y1, e=x2, h=y2, l=x1
__LineShrSkipRev:
push af ; Saving DX (it will be popped into HL below)
ld a,l ; IX+=L/8+D*12 (actually D*4+D*4+D*4)
rra
rra
rra
and %00011111
ld c,a
ld b,0
add ix,bc
ld a,d
add a,a
add a,a
ld c,a
add ix,bc
add ix,bc
add ix,bc
ld a,l ; Calculating the starting pixel mask
and %00000111
inc a
ld b,a
ld a,%00000001
__LineShrMaskLoop:
rrca
djnz __LineShrMaskLoop
ld c,a
ld a,h ; Calculating delta Y and negating the Y increment if necessary
sub d ; This is the last instruction for which we need the original data
ld de,12
jr nc,__LineShrSkipNeg
ld de,-12
neg
__LineShrSkipNeg:
pop hl ; Recalling DX
ld l,a ; H=DX, L=DY
cp h
jr nc,__LineVert ; Line is rather vertical than horizontal
ld a,h
__LineVert:
ld b,a ; Pixel counter
inc b
cp l
scf ; Setting up gradient counter
ccf
rra
scf
ret ; c=1, z=vertical major
__LineShrEnd:
   
Optimized routine: -4 bytes, -13cc
Code: [Select]
p_LineShr:
.db __LineShrEnd-$-1
;; l=y2, ix=buff, (sp)=ret, (sp+2)=ret_2, (sp+4)=x2, (sp+6)=y1, (sp+8)=x1
ld a,l
pop bc
pop hl
pop de
ex (sp),hl
ld d,l
pop hl
ex (sp),hl
push bc

;; a=y2, d=y1, e=x2, l=x1, (sp)=ret, (sp+2)=ret_2
ld h,a
ld a,63
cp h
ret c
cp d
ret c

ld a,95
cp l
ret c
cp e
ret c
ld a,e

sub l
jr nc,__LineShrSkipRev
ex de,hl
neg

;; a=dx, d=y1, e=x2, h=y2, l=x1
__LineShrSkipRev:
push af ; Saving DX (it will be popped into HL below)
ld a,d
add a,a
add a,a
ld c,a
ld b,0
add ix,bc
add ix,bc
add ix,bc
ld a,l
and 7
ld e,a
xor l
rra
rra
rra
ld c,a
add ix,bc
ld b,a
inc b
ld a,%00000001
__LineShrMaskLoop:
rrca
djnz __LineShrMaskLoop
ld c,a
ld a,h ; Calculating delta Y and negating the Y increment if necessary
sub d ; This is the last instruction for which we need the original data
ld de,12
jr nc,__LineShrSkipNeg
ld de,-12
neg
__LineShrSkipNeg:
pop hl ; Recalling DX
ld l,a ; H=DX, L=DY
cp h
jr nc,__LineVert ; Line is rather vertical than horizontal
ld a,h
__LineVert:
ld b,a ; Pixel counter
inc b
cp l
res 0,a ; Setting up gradient counter
rrca
ret ; c=0, z=vertical major
__LineShrEnd:



Or this version, it only save 3 bytes, but saves 10 more clock cycles:
Code: [Select]
p_LineShr:
.db __LineShrEnd-$-1
;; l=y2, ix=buff, (sp)=ret, (sp+2)=ret_2, (sp+4)=x2, (sp+6)=y1, (sp+8)=x1
ld a,l
pop bc
pop hl
pop de
ex (sp),hl
ld d,l
pop hl
ex (sp),hl
push bc

;; a=y2, d=y1, e=x2, l=x1, (sp)=ret, (sp+2)=ret_2
ld h,a
ld a,63
cp h
ret c
cp d
ret c

ld a,95
cp l
ret c
cp e
ret c
ld a,e

sub l
jr nc,__LineShrSkipRev
ex de,hl
neg

;; a=dx, d=y1, e=x2, h=y2, l=x1
__LineShrSkipRev:
ld e,a ; Saving DX
ld a,l ; IX+=L/8+D*12 (actually D*4+D*4+D*4)
rra
rra
rra
and %00011111
ld c,a
ld b,0
add ix,bc
ld a,d
add a,a
add a,a
ld c,a
add ix,bc
add ix,bc
add ix,bc
ld a,l ; Calculating the starting pixel mask
and %00000111
inc a
ld b,a
ld a,%00000001
__LineShrMaskLoop:
rrca
djnz __LineShrMaskLoop
ld c,a
ld a,h ; Calculating delta Y and negating the Y increment if necessary
sub d ; This is the last instruction for which we need the original data

ld h,e ; DX
ld l,a ; DY

ld de,12
jr nc,__LineShrSkipNeg
ld de,-12
neg
__LineShrSkipNeg:
cp h
jr nc,__LineVert ; Line is rather vertical than horizontal
ld a,h
__LineVert:
ld b,a ; Pixel counter
inc b
cp l
res 0,a ; Setting up gradient counter
rrca
ret ; c=0, z=vertical major
__LineShrEnd:

24
Grammer / Re: Grammer 2-The APP
« on: September 19, 2019, 07:39:33 pm »
This is just a quick update! I tracked down a critical bug in Grammer that has been around for a few of the mini releases (probably since last year). Send( was returning the wrong pointer, so if you started writing bytes to a file, you would almost certainly end up corrupting variables in RAM. Anyways, the link in the previous post now points to the corrected version :)

25
Grammer / Re: Grammer 2-The APP
« on: September 13, 2019, 08:14:30 pm »
Hey folks, have the first official update in over seven years!
Since the last update, I've optimized some more and added in filled circle routines internally. With that, there are now 12 circle drawing methods, with various borders and fills (between white/black/invert/clear).



Download Grammer v2.50.6.3 :)

26
Grammer / Re: Latest Grammer Updates
« on: September 13, 2019, 08:08:50 pm »
EDIT: Updated this download with a critical bugfix with the Send( command. Was v2.50.6.3.
EDIT2: Yet more important bugs were fixed, now we are graduating to 2.50.6.7 for this update :|

Grammer v2.50.6.4
There have been many updates, importantly the version naming convention. In the past, the Grammer version was identified by the date that it was made. Now it is separated into 2.major.minor.veryminor.

Updates: This is NOT an exhaustive list.

  • Older assembly Grammer programs will NOT be compatible with this version or versions going forward.
  • Grammer is now a 2-page app (32768 bytes), whereas it used to be a 1-page app (16384 bytes).
  • The main menu has been significantly updated, hopefully for the better.
  • Some token replacements have been changed.
  • Fixed various bugs, made various optimizations.

To the language:
  • Grammer programs can now use external modules, via the ▶DMS token.
  • G-T returns the address of the default front buffer.
  • G-T' returns the address of AppBackUpScreen, a typical backbuffer.
  • Wide support for floating point routines.
  • Added stack support and better parameter parsing via Pmt_Bgn, Pmt_End, and Param
  • Added the ▶Nom( ... End block to preserve a set of variables within the block. For example, you can save vars A, B, and C, use them within the block, and they'll be restored when the block ends. This is very useful for subroutines where you may want to use variables without destroying the callee's variables.
  • Input has been changed! It now has a blinking cursor instead of highlighting the text.
  • The Input buffer can now be relocated and you can set a max size! Useful for when you want to limit, say, a player's name. Use →Input and →Input'.
  • The width argument for Pt-Off( is finally meaningful! Sprites can now be drawn to pixel coordinates and be wider (big sprites!).
  • The Menu( command was totally rewritten. It looks similar, but is a lot smoother and will now scroll if there are too many entries (scrolling menu!). It is also much nicer on RAM usage, so you'll be able to fit more options than previously allowed.
  • A new menu method is available via Menu('. You can supply a title, location, width, height, and pointers to two Grammer subroutines. The menu will then call your subroutines to get the string to display and the value to return upon selection. Useful for menus that have many options, but options that can be "computed" in some way (for example, reading lines from an external file and supplying those as options).
  • Added 9 more Circle( methods using filled circles!

Here are some screenshots:


27
ASM / Re: ASM Optimized routines
« on: September 10, 2019, 06:18:29 pm »
Here is a circle routine that I made!
Code: [Select]
;Written by Zeda Thomas, free to use.

;This draws a circle centered at 8-bit coordinates and with radius up to 127.
;IX points to a `plot` routine that takes (B,C)=(x,y) as input and does something
;with it, like plot the pixel a certain color, or plot a "big" pixel, or whatever.
;   plot
;     Takes coordinates, (B,C) = (x,y) and plots the point.
;
;For example, on the TI-83+/84+/SE the plot routine might look like:
; plot:
;   call getpixelloc
;   ret nc            ;Exit if the coordinates are out-of-bounds
;   or (hl)
;   ld (hl),a
;   ret
;
;
; Required subroutines:
;     call_ix:
;       jp (ix)

circle:
;Input:
; (B,C) is the center (x,y)
; D is the radius, unsigned, less than 128 (0 or greater than 128 just quits).
; IX points to a `plot` routine that takes (B,C)=(x,y) as input.
  ld a,d
  add a,a
  ret c
  ret z
  ld l,d
  dec a
  ld e,a
  dec a        ;if the pixel is only 1 wide, just plot the point
  jp z,call_ix ;Jump to the plot routine
  xor a
  ld h,-1
  ld d,1
  scf     ;skip the first plot
circleloop:
  call nc,plot4
  inc h
  sub d
  inc d
  inc d
  jr nc,circleloop
_:
  dec l
  call plot4
  add a,e
  dec e
  ret z
  dec e
  jr nc,-_
  jp circleloop


plot4:
;BC is center
;HL is x,y

  push de
  push af
  push hl
  push bc

;If H is 0, or L is 0, we need to draw only half
  push hl

  ld a,b
  sub h
  ld b,a
  add a,h
  add a,h
  ld h,a

  ld a,c
  sub l
  ld c,a
  add a,l
  add a,l
  ld l,a

;B is x0-x
;C is y0-y
;H is x0+x
;L is y0+y


;plot(x0-x,y0-y)
;plot(x0+x,y0+y)
  push bc
  push hl
  call call_ix    ;call the plot routine
  pop bc
  push bc
  call call_ix    ;call the plot routine

;now swap the y coords
  pop hl
  pop bc
  ld a,l
  ld l,c
  ld c,a
  pop de
  xor a
  cp d
  jr z,+_
  cp e
  jr z,+_


;plot(x0-x,y0+y)
;plot(x0+x,y0-y)
  push hl
  call call_ix    ;call the plot routine
  pop bc
  call call_ix    ;call the plot routine
_:

  pop bc
  pop hl
  pop af
  pop de
  ret
The really cool feature about this is that you can define a custom plot routine pointed to by IX, so it isn't TI-specific, and you can do all sorts of wonky things like:
Draw 2x2 pixels:

Code: [Select]
;calling with `ld ix,pixelOn_2x2`

pixelOn_2x2:
  sla b
  ret c
  sla c
  ret c
  push bc
  call pixelOn
  pop bc
  inc b
  push bc
  call pixelOn
  pop bc
  inc c
  push bc
  call pixelOn
  pop bc
  dec b
  jp pixelOn

Or draw a circle whose "pixels" are circles:

Code: [Select]
;calling with `ld ix,pixelOn_circle`

pixelOn_circle:
  ld a,b
  cp 32
  ret nc
  add a,a
  add a,a
  ld b,a
  ld a,c
  cp 32
  ret nc
  add a,a
  add a,a
  ld c,a
  ld d,4
  push ix    ;need to save IX!
  ld ix,pixelOn
  call circle
  pop ix
  ret
EDIT: I inlined some subroutines because there was no reason to have them called. It was a waste of clock cycles and space!
EDIT: Have a separate, filled rectangle routine!
Note that if you pass the same arguments as the regular circle routine, this only draws the inside part  and skips the border.
Code: [Select]
;Written by Zeda Thomas, free to use.

;This draws the fill of a circle centered at 8-bit coordinates and with radius
;up to 127.
;IX points to a `horizontal line` routine that takes E=x, A=y, D=width as input
;and does something with it, like plot a horizontal line.
;
; For example, on the ti-83+/84+/SE calculators, you might have:
;     horizontal_line:
;       ld b,e
;       ld c,a
;       ld e,1
;       ld hl,gbuf
;       jp rectOR

; Required subroutines:
;     call_ix:
;       jp (ix)

filledcircle:
;Input:
; (B,C) is the center (x,y)
; D is the radius, unsigned, less than 128 (0 or greater than 128 just quits).
; IX points to a `plot` routine that takes (B,C)=(x,y) as input.
  ld a,d
  add a,a
  ret c
  ret z
  ld l,d
  dec a
  ld e,a
  xor a
  ld h,-1
  ld d,1
filledcircleloop:
  ; call c,fillcircle_plot
  inc h
  sub d
  inc d
  inc d
  jr nc,filledcircleloop
_:
  dec l
  call fillcircle_plot
  add a,e
  dec e
  ret z
  dec e
  jr nc,-_
  jp filledcircleloop

fillcircle_plot:
  inc h
  dec h
  ret z
  push hl
  push de
  push bc
  push af
  dec h
  ld a,b
  sub h
  ld e,a
  ld d,h
  sll d   ;aka `slia`, undocumented

  ld a,l
  or a
  ld h,c
  jr z,+_
  add a,h
  push de
  push hl
  call nz,call_ix
  pop hl
  pop de
_:
  ld a,h
  sub l
  call call_ix
  pop af
  pop bc
  pop de
  pop hl
  ret

28
Super Smash Bros. Open / Re: [Axe] Super Smash Bros. Open
« on: September 09, 2019, 09:25:05 pm »
So far as I can tell, the latest version is here, but it is incomplete (they note in the readme that some of the attacks might not work, for example). Hayleia is still around in the calc programming community, but I don't think that they do any calc programming anymore.

29
Grammer / Re: Grammer 2-The APP
« on: September 05, 2019, 08:16:30 pm »
Minor update to the above.
The menu routine is now more efficient on scrolling. I did actually take advantage of the "rectangle shift up/down" routines so now it makes fewer calls to the Grammer routines, improving performance.
Here is what it looks like now:


I also remade the rectangle routines. It is 112 bytes larger, but it is cleaner code, uses 4 bytes of already allocated RAM instead of 24 bytes of specially allocated RAM, and doesn't use shadow registers (so it doesn't need to disable interrupts). As well, I added two new methods-- they both invert the border, but one clears the inside, the other sets it to black. I have no idea why that might ever be desirable, but I have all the other methods of setting the border and fill to black/white/clear/invert, so why not? (and it didn't add much to the code). Now I just need to add in left/right rectangle shifts and world domination will be mine.

Attached is the .8xk for those who need the latest.

30
Other Discussions / Re: Pokemon Amber
« on: September 05, 2019, 06:48:20 pm »
It turns out that I actually used a lot of the code in the OmniRPG project to get a mockup and the source was available for that. The Pokemon Amber project is essentially dead, but I did look through the code and try to get it up and running. The code was super convoluted and poorly documented, so it would have been difficult to expand upon.

However, it did inspire me to work on an RPG engine (also incomplete) if you are ever feeling motivated! Here's an up-to-date .gif of the example for the project:

You can see the coordinates in the upper right that are on for debugging, and the name input leaves a lot to be desired (in fact, it doesn't even work yet :P)

Pages: 1 [2] 3 4 ... 310