That system routines file is amazing! It has everything!
I have a question. There seems to be a ROM call for everything there is in BASIC, like PixelTest and tons of other stuff, which makes me suspicious. Do ROM calls slow down the program a lot? Because in most source codes I've looked at, they don't use all these seemingly wonderful ROM calls.
- Kllrnohj
- ☢ PH34R |\/|3 (Posts: 8196)
- Re: Are ROM calls really that good?
- 30 Sep 2006 06:10:32 pm
- Last edited by Kllrnohj on 30 Sep 2006 07:53:21 pm; edited 1 time in total
MDR Falcon wrote:
I have a question. There seems to be a ROM call for everything there is in BASIC, like PixelTest and tons of other stuff, which makes me suspicious. Do ROM calls slow down the program a lot? Because in most source codes I've looked at, they don't use all these seemingly wonderful ROM calls.
1) No triple posting, use that "edit" button
2) ROM calls aren't necessarily the fastest. Some of them can be very slow, and since you have direct access to the screen, you don't need to go through the bulky bcall interface. Also, some of those "BASIC bcall's" may be using floating point numbers, which would be extremely slow. (the op1-op6 "registers")
ROM calls are indeed exceedingly slow. Most of the time, it's not even the bcall() wrapper that makes them so inefficient; it's just that TI writes some amazingly unoptimized code.
Not to mention that incredibly annoying TI invention, the Floating Point Stack. 10/10 for style, but minus several million for bad execution, eh?
I'm trying to do a pixel test in asm, but my routine isn't working and I'm not sure why. Here's my code:
Code:
So basically I'm trying to test the pixel in row y and column x. According to IonGuru, ionGetPixel loads the offset (on or off, right?) to hl. Everything assembles properly, but when a pixel is hit in my game, nothing happens, and other times the program just randomly acts as if a pixel was hit.
Thanks
Code:
ld a,(y)
ld e,a ;loads y coordinate to e
ld a,(x) ;loads x coordinate to a
call ionGetPixel
ld (test),hl ;loads hl to test
ld a,(test) ;loads test to a
cp 1 ;if a=1 (pixel is on)
jp z,hit ;then jump to hit
So basically I'm trying to test the pixel in row y and column x. According to IonGuru, ionGetPixel loads the offset (on or off, right?) to hl. Everything assembles properly, but when a pixel is hit in my game, nothing happens, and other times the program just randomly acts as if a pixel was hit.
Thanks
no. You are using the output of ionGetPixel incorrectly; specifically, this code is nonsensical in this context:
Code:
What you need to do instead:
Code:
Code:
ld (test),hl ;loads hl to test
ld a,(test) ;loads test to a
What you need to do instead:
Code:
ld a,(y)
ld e,a ;loads y coordinate to e
ld a,(x) ;loads x coordinate to a
call ionGetPixel
ld b,(hl)
and a
or a ;if a=0 (pixel is off)
jp nz,hit ;then jump to hit
No, its not always best. If it is speed critical, then use direct input, otherwise just use the _get routines and save some memory and programming time
I wanted to write a program that allowed me to get a users initials for a highscore and i think i have found i way that i would do it. would this work, find where the alphabet starts and stops and than load whatever the begining is into a and do putc than if up or down is pressed just increment or decrement where a points to.
You *could* do that, or you could just enable the Alpha cursor and do a getkey (whichever one waits for input before returning) so that people can just type their initials using the alpha buttons
Or do a getCSC loop ( getCSC \ halt \ or a \ jr z,getCSC ) with a lookup table, eliminating things like being able to force quit the program with OFF or QUIT (exit, whatever it is).
Oh, and with your original idea, you'd want to use a putMap, not putC.
Oh, and with your original idea, you'd want to use a putMap, not putC.
alright i tried to get this done right but i am having problems when i press a key it does not display anything but once you hit three buttons which is the required length it stops just like it is supposed to. How can i make this show the button that was pressed.
Code:
Code:
#include "begin.inc"
#define length $8270
.org $9327
ld a,1
ld (length),a
call _runindicoff
call _clrlcdfull
set shiftalock,(iy+shiftflags)
ld hl,0*256+0
ld (pencol),hl
input:
call _getkey
ld a,(length)
inc a
cp 4
jp z,done
ld (length),a
jp input
done:
ret
.end
END
Adding a bcall(_putc) in there would help you a heck of a lot... I can't recall off the top of my head if getKey requires a lookup table to convert the keycode into alphanumeric, but I believe it does.
yeah it does i tried it with a putc and got different calc symbols. Where can i find documentation on jump tables?
*lookup tables
Just create a list of values using .db where the first character is when key=0, the second is when key=1, etc etc etc. For example, pretend a (key) = 0 means 'A' and a=1 means 'B':
Code:
Then, after call _getkey, add:
Code:
Just create a list of values using .db where the first character is when key=0, the second is when key=1, etc etc etc. For example, pretend a (key) = 0 means 'A' and a=1 means 'B':
Code:
jumptable:
.db 'A','B',etc
Then, after call _getkey, add:
Code:
ld e,a
ld d,0
ld hl,jumptable
add hl,de
ld a,(hl)
call _putc
i updated my code to this:
Code:
and it still does not work right. now it just displays numbers.
Code:
#include "begin.inc"
#define length $8270
.org $9327
ld a,1
ld (length),a
call _runindicoff
call _clrlcdfull
set shiftalock,(iy+shiftflags)
ld hl,0*256+0
ld (pencol),hl
input:
call _getkey
ld e,a
ld d,0
ld hl,jumptable
add hl,de
ld a,(hl)
call _putc
ld a,(length)
inc a
cp 4
jp z,done
ld (length),a
jp input
jumptable:
.db 'A','B','C','D','E','F','G','H','I','J','K','L','M'
.db 'N','O','P','Q','R','S','T','U','V','W','X','Y','Z'
done:
ret
.end
END
and it still does not work right. now it just displays numbers.
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 5 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