From: Marko Mäkelä (marko.makela_at_hut.fi)
Date: 2004-12-29 23:44:19
Rich,
> I see the idea here. I'm a little confused as to how the file would
> look though. How do I mix in the ASM and BASIC together in a single
> file?
Just use the dc.b, dc.w, .byte, .word or whatever directives of your favourite
assembler. For c2nload and cbmlink, I used André Fachat's xa. You
can find an example in the file basic.s in
http://www.funet.fi/pub/cbm/crossplatform/transfer/C2N232/cbmlink-cbmsrc.tar.gz
Hmm, that one contains a relocator that allows the program to be loaded
anywhere at $xx01 (except on the PET-II, where it will always be loaded
at $0003). A simpler version is in the Veni Vidi Vic! source code
(http://www.funet.fi/pub/cbm/vic20/demos/VVV-src.tar.gz), file basic.i
(written for DASM 2.12.04, also available from the FUNET CBM archive):
#mac basicline
org {1}
word 0$ ; link to next line
word {2} ; line number
byte $9E ; SYS token
; SYS digits
if (* + 8) / 10000
byte $30 + (* + 8) / 10000
endif
if (* + 7) / 1000
byte $30 + (* + 7) % 10000 / 1000
endif
if (* + 6) / 100
byte $30 + (* + 6) % 1000 / 100
endif
if (* + 5) / 10
byte $30 + (* + 5) % 100 / 10
endif
byte $30 + (* + 4) % 10
byte 0 ; end of BASIC line
0$:
word 0 ; end of BASIC program
#endm
> Am I relying on the default load address for a BASIC program
> and counting the bytes for the BASIC tokens as the "header" of my
> assembly code?
Yes, that's the idea. The start of BASIC is rarely relocated, and
when it is, it's usually $xx01. The default is $0401 on the PET.
On the VIC-20, BASIC starts at $0401 when a 3k memory expansion is
installed; at $1001 when no expansion is installed and at $1201 when
at least 8k is installed. On the C128 and the 264 series, using a
graphics mode will relocate the BASIC, unless I'm mistaken.
Marko
Message was sent through the cbm-hackers mailing list
Archive generated by hypermail pre-2.1.8.