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


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

Registered: Jan 2002
Posts: 98
-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 14:37
BiGFooT

Registered: Mar 2002
Posts: 9
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 16:44
Trash

Registered: Jan 2002
Posts: 98
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
E$G/I-IokutO ForcE
iAN CooG/HVSC
Stablizer/ExCeSs/DMX
iceout/Avatar
HCL/Booze Design
Guests online: 41
Top Demos
1 Uncensored  (9.7)
2 Edge of Disgrace  (9.7)
3 Coma Light 13  (9.6)
4 The Shores of Reflec..  (9.6)
5 Comaland 100%  (9.6)
6 Lunatico  (9.6)
7 Incoherent Nightmare  (9.5)
8 Wonderland XII  (9.5)
9 Comaland  (9.5)
10 Wonderland XIII  (9.5)
Top onefile Demos
1 FMX Music Demo  (9.6)
2 Merry Xmas 2017  (9.5)
3 Synthesis  (9.5)
4 Pandemoniac Part 2 o..  (9.5)
5 Daah, Those Acid Pil..  (9.5)
6 Dawnfall V1.1  (9.5)
7 Dawnfall  (9.4)
8 Treu Love [reu]  (9.4)
9 Field Sort  (9.4)
10 KAOS 64  (9.3)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.3)
4 The Judges  (9.3)
5 Crest  (9.3)
Top Crackers
1 Mr. Z  (9.9)
2 Mr Zero Page  (9.9)
3 Mitch  (9.8)
4 Snacky  (9.8)
5 MWS  (9.8)

Home - Disclaimer
Copyright © No Name 2001-2018
Page generated in: 1.563 sec.