[Coco] ccasm question

Hugo Dufort hugo at seshat.ca
Mon Mar 9 23:15:25 EDT 2015


Hi Robert,
I don't know if it will make any sense or if I'm just being naive 
(perhaps I'm not using ccasm properly?). Here is a code snippet. I 
declare some global variables that will occupy some memory addresses 
once compiled. I can used these variables everywhere in my code, but I 
can't refer to them from a procedure such as HSCREEN. So if I want to 
access these globally defined variables from HSCREEN, I'll have to pass 
all their addresses to HSCREEN as parameters... or perhaps I should 
organize them in a composite structure and pass the structure's base 
address?

=============
     org     3584

hwidth    fdb    #320
hbytes_total    fdb    #160
hbytes_visible    fdb    #160
hheight    fcb    #192
hcolors    fcb    #16
mmu_basepage    fcb    #2
low_addr    fdb    #$4000

procedure HSCREEN
hscreen    proc    width:word,height:byte,colors:byte
     begin    hscreen
     ldx    #$ff98
     lda    ,x
     ora    #%10000000
     sta    $ff98    video mode
testw    ldx    width,u
     lda    colors,u
     sta    hhcolors
[...snip...]
=============


Le 2015-03-09 22:55, Robert Gault a écrit :
> Hugo Dufort wrote:
>> Hi! I have made some progress re-learning 6809 ASM and immerging 
>> myself in the
>> Coco3 hardware/memory map. Not without pain, but it works just fine 
>> in the end.
>>
>> I have been using ccasm within the Phoenix IDE. I have a question 
>> about ccasm
>> though. When I declare a procedure, it handles the parameters nicely, 
>> but what
>> if I want to access some globally defined variables? Is there a 
>> mechanism for
>> that? It seems that global symbols and procedures have mutually 
>> exclusive scope,
>> which is quite unusual. Is there a specific ordre in which they 
>> should be
>> defined? Thanks for the answers and suggestions.
>>
>> Hugo
>>
>
> A look at your code would help, but any variable should be defined 
> before it is used.
>
> Robert
>
>
>
> ---
> This email has been checked for viruses by Avast antivirus software.
> http://www.avast.com
>
>


---
L'absence de virus dans ce courrier électronique a été vérifiée par le logiciel antivirus Avast.
http://www.avast.com



More information about the Coco mailing list