Log inRegister an accountBrowse CSDbHelp & documentationFacts & StatisticsThe forumsAvailable RSS-feeds on CSDbSupport CSDb Commodore 64 Scene Database
 Welcome to our latest new user maak ! (Registered 2024-04-18) 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: 31
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
csabanw
Sentinel/Excess/TREX
Brataccas/HF
Alakran_64
Codey/Second Dimension
Danko/Fairlight
hedning/G★P
redcrab/G★P
Guests online: 77
Top Demos
1 Next Level  (9.8)
2 Mojo  (9.7)
3 Coma Light 13  (9.7)
4 Edge of Disgrace  (9.6)
5 Comaland 100%  (9.6)
6 No Bounds  (9.6)
7 Uncensored  (9.6)
8 Wonderland XIV  (9.6)
9 The Ghost  (9.6)
10 Bromance  (9.6)
Top onefile Demos
1 It's More Fun to Com..  (9.8)
2 Party Elk 2  (9.7)
3 Cubic Dream  (9.6)
4 Copper Booze  (9.5)
5 Rainbow Connection  (9.5)
6 Wafer Demo  (9.5)
7 TRSAC, Gabber & Pebe..  (9.5)
8 Onscreen 5k  (9.5)
9 Dawnfall V1.1  (9.5)
10 Quadrants  (9.5)
Top Groups
1 Oxyron  (9.3)
2 Nostalgia  (9.3)
3 Booze Design  (9.3)
4 Censor Design  (9.3)
5 Crest  (9.3)
Top Fullscreen Graphicians
1 Carrion  (9.8)
2 Joe  (9.8)
3 Duce  (9.8)
4 Mirage  (9.7)
5 Facet  (9.7)

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