A86: Re: Variables


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

A86: Re: Variables




You're style of typing IS hard to read!  People on this list are not
obligated to help you.  You should be grateful for any help that you do get.
Annoying people and making your messages hard to read isn't the way to get
help from people.  But I'll try to answer your question...

If you've already made games (I assume you intended that to be plural), then
I would figure you know this already.  And you would almost certainly know
that HL/DE are registers (thought they are word sized).  There is nothing
wrong with admitting that you don't know something, everyone has to start
somewhere.  Though there are plenty of beginner tutorials on asm, and people
on the list don't want to hold your hand while you learn how to shuffle
variables around and push and pop stuff.

I will quote from the Assembly Studio 86 help file the definitions of
registers (because I don't want to type a whole page full of
info...everyone, get that file!).  Read after that for an explanation on
ram.

----
Registers

The Z80 CPU contains several onboard memory units called registers.
Registers are used to store numeric values, like variables would in a high
level language.


The 7 8-bit simple registers are:

A General purpose (accumulator)
B General purpose
C     "   "
D     "   "
E     "   "
H     "   "
L     "   "

There is also an F register, which stores flag information. Each bit’s
status provides information on the status of the processor and/or the
instruction that has just been executed.

Two 8-bit registers can also be combined and used as a 16-bit register.

The following 16-bit registers can be used:

AF Used for pushing and popping
BC General purpose
DE General purpose
HL Usually used to store an address or pointer

Other registers also exist, most of which are rarely used by the assembly
programmer.

PC Program Counter – points to the current instruction being executed
SP Stack Pointer – holds the address of the current top of the stack located
in RAM
IX Index pointer
IY Index pointer – points to the start of the system flags area
----

You use registers to hold values in your code while you are working with
them.  However, you will have to have some other place to store data, as
there just aren't enough registers to do that (and it usually seems that
there aren't enough registers as it is!  "just one more register, that's all
I ask...").  You will need to use other memory to do this.

How much and what memory can I use?  Plenty.  On the 86, you are lucky.  TI
has set aside 2 entire ram pages just for scratch space and TI-OS use.  On
the other 3 z80 calcs (well, the one's you can program in asm on), they only
had 2 pages of ram period (a page is 16k), which included variable storage.

On page ram page 0, which is permanently located at $C000 to $FFFF, you have
some free space to work with.  Your program has 8k to fit into, starting at
_asm_exec_ram ($D748).  If you don't use all of it for code or built-in
data, you can use the rest of it for data.

You also have _textShadow and _cmdShadow, which are 168 bytes each.  Then
there's _plotSScreen (also known as graph memory, as it was on the 85).  It
is 1024 bytes, the exact same size as video ram (a coincidence?  of course
not...but it sure is useful).  There are also other places that you can use,
like $F600.  It is safe to use at least 1024 bytes of memory there, but I'm
not too sure of the exact layout of ram page 0 (any info would be greatly
appreciated!).

Then you are gifted with ram page 1.  That _entire_ 16k page is set aside
for the assembly programmer!  Well, all but the first 11 bytes and the last
22 bytes.  But we shouldn't complain.  Ram page 1 is the FPS (floating point
stack, or OP stack).  If you use the FPS stack, you can't use all of ram
page 1.  But if you don't, you can use all of it from $800b to $bfea.
Plenty of room for maps, graphics, self modifying code, etc (though I think
SCaBBy ran out of room with Bomber Bloke, hehe).

Ram page 1 _can_ be swapped out of $8000-$bfff, so that memory could contain
another page if you change them.  But it will always point there whenever
you start your program.

Hope this helps,

--
David Phillips <electrum@tfs.net>
ICQ: 13811951
AOL/AIM: Electrum32
86 Central: http://www.tfs.net/~electrum/

-----Original Message-----
From: god-mail@mailexcite.com <god-mail@mailexcite.com>
To: assembly-86@lists.ticalc.org <assembly-86@lists.ticalc.org>
Date: Sunday, November 22, 1998 5:34 PM
Subject: A86: Variables


>
>I'm A BASIC Programmer Mostly, But Now That I Have Made My First ASM Games,
>How Do I Create Variables For Use In The Game? Or Do I Have To Use hl,de,
>And Other Such Bytes/Words?
>And Please Don't Just say My Method Of Typing Is Hard To Read, That
Provided
>Me With No Help WhatSoEver!
>
>
>
>
>_______________________________________________________
>Get your free, private e-mail at http://mail.excite.com/