Re: LF: Graphics and Keys


[Prev][Next][Index][Thread]

Re: LF: Graphics and Keys



Andrew wrote:
> 
> Hello,
>         I was wondering if anyone might be so kind as to give me a little
> example of how to put graphics on the screen (Like say a 16x16 bitmap in the
> middle of the screen)??
> I would also appreciate an example of scanning for keypresses (I read the
> docs and don't understand all of the writing to such and such address and
> reading from another...) Yes, I have read much of the source code out there
> and I am still in the dark.
> Another small request: I have been wondering how you would go about making
> it so that the user can type in something and it appears on the screen as
> the user types it (as in KeepOut and a few other programs) I know there must
> be a spiffy trick because these programs are not big enough to contain the
> code that I would think to use to accomplish this task. (Again I have read
> the sourcecode but don't comprehend the sections that I presume do this)
> 
> I'd appreciate any response(s),
>                         Andrew

As for the first part, all I can say is to check out the boulder-dash
source, since it was done there, and other than that, I don't know
how... I'm no expert yet either

But to get a keypress you simply use the code:
jsr    flib[idle_loop]
it will wait for a key to be pressed and then return it in the register
d0 (registers are like variables, just stuck inside the cpu, incase you
didn't know)

to write something to the screen, you can use the routines in rom,
accessed via the fargo library romlib.  But someone out there was nice
enough to write a macro to do this for you.
at the top of the program type:
include     macros.h
and then in the program use the following
setfont     #2   ; sets to the big sized font
writestr    #30,#40,#2,string  ;prints the string on col 30, row 40,
color 2 (black)
string is defined later after the end of the program as
string      dc.b   "This text will print",0 ;the ",0" is neccessary to
"stop" the string

also put the following at the end

;*************** End of Fargo program ****************
             reloc_open
             add_library     flib
             add_library     romlib
             reloc_close
             end
;*****************************************************
to tell it what "libraries" you used
-- 
Christopher Poole
poole.christopher@paradox.net
http://www.paradox.net/homepages/poole
http://mycorner.home.ml.org
http://poole.home.ml.org


References: