home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Loadstar 242
/
242.d81
/
t.bassem
< prev
next >
Wrap
Text File
|
2022-08-26
|
4KB
|
161 lines
u
B A S S E M
by Fernando Sanchez
from Compute! Gazette
This is the assembler that I use
constantly. Once run, you are in an
extended BASIC which includes
everything you need to write ML!
Write BASSEM code just like you
would a BASIC program, with line
numbers on every line. You can even
use colons to separate multiple
instructions on one line.
To simplify things, I have a
program on this disk called "SHELL.BC"
which has all the set-up requirements
pre-coded. After booting BASSEM,
load"shell.bc",dv
List line 60008 and change it to:
60008 n$="myprog"
where "myprog" is your program name.
Do not include any extension. BASSEM
SHELL will do this for you
automatically. A file with *.BC is
Bassem Code. *.ML is the Machine
Language object code generated by
BASSEM. To save your new BC code, type
and <RETURN> GOTO60000
You can write your code anywhere
between lines 50 and 49997. I use
50-99 for assignments:
50 _irq=$314
The <BACK ARROW> indicates a
label. Labels must begin with a
letter, but can be any number of
characters, numbers, or periods. NO
spaces or punctuation!
The $ indicates a hex number.
Decimal has no prefix (and works just
fine). For binary values, use %, as
in:
51 _bit7=%10000000
I use lines 100-199 for the Jump
Table.
100 jmp_setup
The main code usually begins at
line 1000. All standard 6502 assembly
commands are allowed. However, BASSEM
does not have:
lda#<_address
ldx#>_address
Instead, SHELL includes two FNs that
work perfectly:
lda#fnl(_address)
ldx#fnh(_address)
While BASIC commands work during
the assembly, they are NOT assembled
into the code. You can use FOR-NEXT
loops to generate stretches of
repetitive code:
2000 _screencopy
2002 ldy#250
2004 _scloop
2005 dey
2006 :forx=0to3
2008 :lda_from+x*250,y
2010 :sta1024+x*250,y
2012 :next
2014 cpy#0:bne_scloop
2016 rts
This will generate:
ldy#249
_scloop
dey
lda_from,y
sta1024,y
lda_from+250,y
sta1274,y
lda_from+500,y
sta1524,y
lda_from+750,y
sta1774,y
cpy#0:bne_scloop
rts
Assembly of your code is easy.
First, list line 1 and assign the
memory where you want to put the
program. You can have different
locations for immediate memory
assembly and for assembly to disk. For
example, you might be writing
something for $1000, but BASSEM is in
the way. So set the Memory value to
49152 and the Disk value to $1000.
To assemble, just run the program.
You will need to press <1> for Memory
or <2> for Disk. It is best to check
the code in memory first, because you
will get errors! Simply fix the
errors, do a GOTO60000 (scratch and
save), and run again.
The end of the assembled area is
49997. Line 49998 is PASS2, which
markes the end of assembly. 49999 is
END.
Therefore, you can use lines
50000-59999 for text runs of your
code. All labels will work in BASSEM
Basic, so you can have
50000sys_setup
NOTE: Sometimes BASSEM gets confused
and can't find the labels. I hope you
saved your work. Reset your computer,
reboot BASSEM, load your BC code, and
do it again.
Once you have your code working
perfectly, RUN the assembly again,
this time pressing <2>. A file with a
*.ML extension will be written onto
the disk. If you already have
"myprog.ml", it will be scratched and
the new version will be saved.
After doing an assembly to Disk,
BASSEM gets flakey. Reset and reboot
and all is well.
DMM