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: 102
-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: 10
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: 102
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
iAN CooG/HVSC
grip/Onslaught
hedning/G★P
Mike
Randall
Raffox/ASURA/Magic C..
Archmage/SHAPE
Rebok
grasstust/Hoaxers
Hend/Protovision (ptv)
Mibri/HF
Guests online: 40
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 We Come in Peace  (9.6)
7 Lunatico  (9.6)
8 Incoherent Nightmare  (9.5)
9 Wonderland XII  (9.5)
10 Wonderland XIII  (9.5)
Top onefile Demos
1 Dawnfall V1.1  (9.5)
2 Synthesis  (9.5)
3 FMX Music Demo  (9.5)
4 Pandemoniac Part 2 o..  (9.5)
5 Daah, Those Acid Pil..  (9.5)
6 Treu Love [reu]  (9.5)
7 Merry Xmas 2017  (9.4)
8 Dawnfall  (9.4)
9 Gubbdata 2017 Invite  (9.3)
10 SidRok  (9.3)
Top Groups
1 Oxyron  (9.4)
2 Booze Design  (9.4)
3 Censor Design  (9.4)
4 Finnish Gold  (9.4)
5 Crest  (9.3)
Top Hardware-Gurus
1 Soci  (9.9)
2 Wiesel  (9.9)
3 Grue  (9.8)
4 Zer0-X  (9.8)
5 Lemming  (9.7)

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