Coder Social home page Coder Social logo

sbprojects / sbasm3 Goto Github PK

View Code? Open in Web Editor NEW
34.0 6.0 8.0 2.71 MB

SB-Assembler Version 3 - Cross Macro Assembler

Home Page: https://www.sbprojects.net/sbasm

License: Creative Commons Zero v1.0 Universal

Assembly 98.67% Python 1.33% Shell 0.01% Standard ML 0.01%
assembler 6502 6800 6809 1802 8008 8080 8085 8048 8051

sbasm3's Introduction

sbasm3

SB-Assembler Version 3 - Cross platform - Macro Cross Assembler

The SB-Assembler can be used on Linux, Mac and Windows machines. It requires at least Python 3.2 to be installed. Installation of the software is not necessary. Unzip everything into a directory of your choice and make sure the program sbasm (for Linux and Mac) or sbasm.py (for Windows) is in your path. However you may want to move the opcode test files and header files somewhere else. They are a reference only and are not needed for the assembler to run. The only thing that is important for the SB-Assembler is that the sbapack directory remains in the same directory as the sbasm and sbasm.py files.

Here's a list of some of the supported processors:

6502, 65C02, 6800, 6804, 6805, 6809, 68HC11, 8008, 8048, 8051, 8080, 8085, Z80, Z8 Z180 AVR, PIC, ST6, ST7, ACE1101, ACE1202, SC/MP, 1802

I usually simply create a symbolic link in my ~/bin directory to the sbasm executable in this package. That's all there is really to it.

More information, including the user guide of this program can be found on https://www.sbprojects.net/sbasm

Happy coding.

sbasm3's People

Contributors

sbprojects avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

sbasm3's Issues

Cross Reference / MAP file

Is there anyway to produce a list of cross references, or a map if you like, of where symbols were referenced please?

Expression should have more power

I would like to see, that the expression could at least use "(" and ")" to make more complex calculation.
I mainly define textual constants and use these constants in my code, but very often I have to make calculation based on several constants with arithmetics like "*4", "*128" etc ...

sbasm exit code = 0 when error is not fatal?

$ ~/program/sbasm3/sbasm collatz.asm

SB-Cross Assembler version 3.03.07
Please visit www.sbprojects.net for a complete description.

Assembling....

Pass one
Loaded scmp overlay version 3.02.00
Source file: collatz.asm

*** Error: Bad Operand
107 DLY Delay(2)

1 Error found during assembly.
0 Warnings found during assembly.

$ echo $?
0

ERRLVL_PASS1 = 1 # Errors found during pass 1
ERRLVL_PASS2 = 2 # Errors found during pass 2
are never used

Incorrect PC relative codegen for 6809

I may be wrong but I believe that the code generated for the following test cases is incorrect:

LDA $1234,PC
LDA -$1234,PC

03DA-A6 8D 12 34 468 (10) LDA $1234,PC
03DE-A6 8D ED CC 469 (10) LDA -$1234,PC

The offset of $1234 looks incorrect for a PC relative address. I believe that the correct code for test.hex should be:

A6 8D 0E56
A6 8D E9EA

This would be based on a PC of $3DA, and an address target of $1234. Computing the PCR Offset is then $1234 - $3DA - 4 bytes for instruction length = $E56. My own 6809 assembler and EDTASM+ seem to agree. As does the example provided in Barden's TRS-80 Color Computer Assembly Language book p224.

Here is the .hex output file diff from test/motorola/6809.asm from my assembler to yours:

62,63c62,63
< :1003D000ABE6AB96ABB5ABDBABF6A68D0E56A68DFA
< :0203E000E9EA48
---
> :1003D000ABE6AB96ABB5ABDBABF6A68D1234A68D18
> :0203E000EDCC62

If you agree LMK if you'd like me to send a PR.

Address calculations in SC/MP still not working on page wrap

I was pleased to see that you have made changes to the relative addressing on the SC/MP module, and I have been trying to re-assemble the MK14 SCIOS ROM from source.
I installed SBASM from sbasm-master.zip downloaded from here and the scios assembled without errors.
However,there seems to be a problem on negative offsets calculated from P3:

0052-                115        ;                          Tape Interface Routines.
0052-                116        ; ****************************************************************************
00D5-                117        Count   .EQ    0D5h
00D6-                118        Len     .EQ    0D6h
0052-                119        ; ****************************************************************************
0052-                120        ;                 Store to Tape. P1^Data,@Count is the bytes
0052-                121        ; ****************************************************************************
0052-C5 01           122 (  18) ToTape: ld      @1(1)                   ; E := (P1), increment P1
0054-01              123 (   7)         xae
0055-C4 01           124 (  10)         ldi     1                       ; A := 1 (the bit pattern)
0057-CB 00           125 (  18) Next1:  st      Count(3)                ; Save in Count (P3)
0059-C4 01           126 (  10)         ldi     1                       ; set F0 to 1
005B-07              127 (   6)         cas
005C-8F 08           128 ( 13+)         dly     8                       ; Delay 8 Cycles
005E-C3 00           129 (  18)         ld      Count(3)                ; A = Count & E
0060-50              130 (   6)         ane                             ; test if bit is set...
0061-98 07           131 (9/11)         jz      Zero
0063-8F 18           132 ( 13+)         dly     018h                    ; (bit is 1) Delay $18 cycles
0065-C4 00           133 (  10)         ldi     0                       ; set F0 to 0 again
0067-07              134 (   6)         cas
0068-90 05           135 (  11)         jmp     CDone
006A-C4 00           136 (  10) Zero:   ldi     0                       ; bit is zero (set F0 to 0)
006C-07              137 (   6)         cas
006D-8F 18           138 ( 13+)         dly     018h                    ; Delay $18 Cycles

The instruction "sta Count(3)" should generate CB D5 whereas it is generating CB 00.
I compared the output with a listing someone had done with TASM and verified that this was the case.
For your conveience I have attached the source for SCIOS in case it is useful.
scios.zip

double qoute for negative ascii value doesn't work

when I use the " to get a negative ascii value, to set bit 8 to a 1 it does nothing see code output:

9536-83 3378 .DB 83H ; BYE
9537-42 59 3379 .DB 'BY'
9539-45 3380 .DB 'E'
953A-45 3381 .DB "E"
953B-C5 3382 .AS -/E/

Work around is to use .AS -/blabla/

Typo in "cr6800.py"

Thanks for the great software.
I found a typo in "cr6800.py".
Could you Please check it out?

128 - 'BSR' : (Branch, 0x8D, '8', '3', '3'),
    + 'BSR' : (Branch, 0x8D, '8', '6', '5'),

Logical negation

Without thinking, I today used the following construct in an 8048 assembly file.

STROBE .EQ 080H
N_STROBE .EQ ~STROBE

When I assmebled it, I got

*** Error: Bad Operand
I 42 N_STROBE .EQ ~STROBE

I was surprised to see tilde didn't behave as the normal negate operand. In fact, I couldn't find such an operand anywhere in the documentation. Are there any plans for a negate operator please?. I've always found it very useful for making bit set and bit clear constants. Thanks.

Z180 overlay - some mnemonics are wrong

In the Z180 overlay the INO and OUTO commands are available, but they should be named IN0 and OUT0.

This can be changed in the files "crz80.py" and "crz180.py". Look for occurences of OUTO and INO and add/change the corresponding code to cover IN0 and OUT0

Invalid escape sequences and directory not matching instructions

For the escape sequences:

C:\Assembler>C:\Apps\sbasm3\sbasm.py sbasmtest.s
C:\Apps\sbasm3\sbapack\direct.py:504: SyntaxWarning: invalid escape sequence '.'
"""
C:\Apps\sbasm3\sbapack\files.py:92: SyntaxWarning: invalid escape sequence '\ '
"""
SB-Cross Assembler version 3.03.07

The test file from the website built ok with no errors, but I am wondering about the escape sequences error. This is on the latest Python version.

For the directory, the installation instructions say to place the sbasm.py file along with the headers, opcodes and sbapack directories from the installation zip. The thing is, opcodes is a level lower in a directory called "test".. I dragged it out, but there are two other folders in "test" called directives and assem. Are we to leave those folders behind? I just feel if the instructions specifically say to obtain the opcodes folder, it shouldn't be a level lower in a folder named "test" leaving the end-user wondering about the other two..

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.