<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>
Date   : Tue, 16 Nov 2010 13:21:30 +0000
From   : jgh@... (J.G.Harston)
Subject: Hints'n'Tips: Assembling non-ARM code on ARM BASIC

When using John Kortink's Basic6502 (ARM BASIC V with 6502 assembler[1])
putting the following line at the start of a BASIC assembly program lets
the program run on both 6502 BASIC and ARM BASIC, ensuring it runs on
Basic6502 in the latter case:

IF  
PAGE>&8000:SYS"OS_GetEnv"TOA$:IFLEFT$(A$,5)<>"B6502":OS."B6502"+MID$(A$,INSTR(A$,"
 
"))

(See http://mdfs.net/tube/6502/CoPro/Client.src)

Similarly, the following does the same for Z80 code:

IF PAGE>&8000:SYS "OS_GetEnv" TO A$:OSCLI"Z80 "+MID$(A$,INSTR(A$,"  
",1+INSTR(A$," ")))

(See http://mdfs.net/tube/Serial/Z80.src)

Yes, the IF PAGE>&8000 is a quick'n'dirty way of deciding that you're
running on ARM BASIC, but I haven't been able to work out a succinct
better way of testing it.

[1]http://web.inter.nl.net/users/J.Kortink/home/software/basic6502

-- 
J.G.Harston - jgh@...     
<< Previous Message Main Index Next Message >>
<< Previous Message in Thread This Month Next Message in Thread >>