Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.sys.apple2.programmer > #2131
| Newsgroups | comp.sys.apple2.programmer |
|---|---|
| Date | 2016-01-16 09:24 -0800 |
| References | <dec2c6fc-3c74-40e8-a655-fca8451d9a1b@googlegroups.com> |
| Message-ID | <f61cbe4b-4103-42f2-bf01-53cc15c1762d@googlegroups.com> (permalink) |
| Subject | Re: cc65: ca65 + ld65 without all the library crap for "pure" assembly programs |
| From | michael.pohoreski@gmail.com |
Aaand I've already run into the dreaded linker "Range error" ...
; The operator '*' is buggy. This will generate a bogusBogus link error:
; ld65: Error: Range error in module `link_bug.s', line 3
__MAIN = $1000 ; Apple DOS 3.3 binary file 4 byte prefix header
.word __MAIN ; 2 byte BLOAD address
.word __END - * ; 2 byte BLOAD size
.org __MAIN ; .org must come after header else offsets are wrong
RTS
__END:
*sigh*
Here is how to fix it:
; Solution 1 is to a pad dummy byte onto the end
; __END:
; .asciiz ""
; Solution 2 is to not use the buggy '*' operator
; .word __END - __MAIN
__MAIN = $1000 ; Apple DOS 3.3 binary file 4 byte prefix header
.word __MAIN ; 2 byte BLOAD address
.word __END - * ; 2 byte BLOAD size
.org __MAIN ; .org must come after header else offsets are wrong
RTS
__END:
"Good news everyone!"
With the buggy '*' operator work-around we can finally use a macro to set the high bit on Apple text.
.macro ASC text
.repeat .strlen(text), I
.byte .strat(text, I) | $80
.endrep
.endmacro
i.e.
MSG:
ASC "Hello world, Apple!"
.byte $00
I've updated barebones.s documenting the bugs and work-arounds:
https://github.com/Michaelangel007/cc65/blob/master/apple2/barebones.s
Back to comp.sys.apple2.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
cc65: ca65 + ld65 without all the library crap for "pure" assembly programs michael.pohoreski@gmail.com - 2016-01-15 21:26 -0800
Re: cc65: ca65 + ld65 without all the library crap for "pure" assembly programs michael.pohoreski@gmail.com - 2016-01-16 09:24 -0800
Re: cc65: ca65 + ld65 without all the library crap for "pure" assembly programs michael.pohoreski@gmail.com - 2016-01-16 16:13 -0800
Re: cc65: ca65 + ld65 without all the library crap for "pure" assembly programs ol.sc@web.de (Oliver Schmidt) - 2016-01-19 19:36 +0000
Re: cc65: ca65 + ld65 without all the library crap for "pure" assembly programs michael.pohoreski@gmail.com - 2016-01-19 22:54 -0800
Re: cc65: ca65 + ld65 without all the library crap for "pure" assembly programs michael.pohoreski@gmail.com - 2016-01-20 07:21 -0800
csiph-web