Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
You are not logged in - nap
CSDb User Forums


Forums > C64 Coding > -Using .weak in tass64
2018-01-08 12:35
Trash

Registered: Jan 2002
Posts: 122
-Using .weak in tass64

I've got a problem, I'd like to do #ifdef / #ifndef behaviour in tass64 using .weak but I cant get i to work:
setup_and_run
sei
jsr init ; commenting this row out should make the assembler throw an error and refuse to compile, now it happens all the time?

-
lda #$fb
cmp $d012
bne *-3

jsr routine

jmp -

init .proc
initiated = 1
; do stuff
rts
.pend
use_initiated_memory_area .proc
; using init.initiated instead of gives a duplicate definition error, why, the scopes are different and they are not strongly defined i several places
.weak
initiated = 0 ; default to 0
.endweak
.if initiated = 0
.error "you must call init"
.fi
; do stuff
rts
.endp

routine
jsr use_initiated_memory_area
rts
2018-01-08 13:37
BiGFooT

Registered: Mar 2002
Posts: 33
First, use .pend instead of .endp and second, in .proc/.block the scope is different.

Try this:

config .block
.weak
initiated = 0
.endweak
.bend

...

init .proc
config.initiated = 1
; do stuff
rts
.pend

use_initiated_memory_area .proc

.if config.initiated = 0
.error "you must call init"
.fi
; do stuff
rts
.pend

...


You can't use init.initiated as it will generate the whole init .proc even if it's not executed (via the label).
2018-01-08 15:44
Trash

Registered: Jan 2002
Posts: 122
That worked like a charm, big thanks!
RefreshSubscribe to this thread:

You need to be logged in to post in the forum.

Search the forum:
Search   for   in  
All times are CET.
Search CSDb
Advanced
Users Online
Dr.j/Delysid
Vent
wacek/arise
Guests online: 84
Top Demos
1 Next Level  (9.7)
2 13:37  (9.7)
3 Mojo  (9.7)
4 Coma Light 13  (9.6)
5 Edge of Disgrace  (9.6)
6 What Is The Matrix 2  (9.6)
7 The Demo Coder  (9.6)
8 Uncensored  (9.6)
9 Comaland 100%  (9.6)
10 Wonderland XIV  (9.6)
Top onefile Demos
1 Layers  (9.6)
2 No Listen  (9.6)
3 Cubic Dream  (9.6)
4 Party Elk 2  (9.6)
5 Copper Booze  (9.6)
6 Rainbow Connection  (9.5)
7 Dawnfall V1.1  (9.5)
8 Onscreen 5k  (9.5)
9 Morph  (9.5)
10 Libertongo  (9.5)
Top Groups
1 Performers  (9.3)
2 Booze Design  (9.3)
3 Oxyron  (9.3)
4 Triad  (9.3)
5 Censor Design  (9.3)
Top Organizers
1 Burglar  (9.9)
2 Sixx  (9.8)
3 hedning  (9.7)
4 Irata  (9.7)
5 Tim  (9.7)

Home - Disclaimer
Copyright © No Name 2001-2024
Page generated in: 0.149 sec.