Jump to content
Wally1

Assembly Language

Recommended Posts

The only problem I had/have with 68k assembly are the 405 variations of branch instructions for signed and unsigned data.  Or at least it seemed that way when I first started learning it years ago.

 

I came back to it this year to play around with hi res graphics and for the most part it was a piece of cake...except for the branch instructions.  :)

Share this post


Link to post
Share on other sites

In beginning it may be hard, but there is not so much branch condition - 16. Same is with Set instruction - Scc .

2 is not real condition - bt (true) or bra is always 1, so branch. bf (false) is not used, of course. But sf is used.

EQ - equal

NE - not eq.

CC - carry clear - would be not less unsigned. Or greater or eq. unsigned

CS - carry set - less unsigned

GE - greater or equal, signed

GT - greater ...

LE - less or equal, signed

LT - less ...

PL - plus

MI - minus

VS - overflow set

VC - no overflow

HI - high

LO - low

 

Share this post


Link to post
Share on other sites
On 12/20/2019 at 1:02 PM, ParanoidLittleMan said:

In beginning it may be hard, but there is not so much branch condition - 16.

 

 

Amen to that.  They only seem too many until you start using them.

 

Earlier in the year, I started implementing clones of the old Space Voyage game for the SWTPC 6800 on other platforms.

 

In the original 6800 version,

 

Quote

 0180 BD 1045           [9] 00374    SETUP0   jsr       RANDOM    ; Setup number of Klingons
 0183 81 FC               [2] 00375                  cmpa   #$FC         ;   in each quadrant
 0185 23 04 (018B)    [4] 00376                  bls       SETUP1     ; Probability low for 4

 

has to be written on the 6502,

 

Quote

 0399 20 15B0              [6] 00238    SETUP0    jsr      RANDOM        ; Setup number of Klingons
 039C C9 FD                 [2] 00239                   cmp    #$FC+1         ;   in each quadrant
 039E 90 05  (03A5)   [2/3] 00240                   bcc     SETUP1         ; Probability low for 4

 

due to the lack of a bls instruction.

Share this post


Link to post
Share on other sites

Well, it is known that 68000 is much faster than some 8 bit, and that code with same function is longer. If nothing else because min. opcode len is 2 bytes. But code may be shorter in some cases.  I wrote back in time, in 1991 LZH type packer for Sinclair Spectrum, so Z80 CPU and for Atari ST. Something simple, mostly to pack games for Spectrum hard disk. And packing on ST was about 4x faster, what was expected. Code for packing was shorter in 68000 version for some 20-25%. Main reason was more registers, so almost everything could solve with registers, while in case of Z80 needed to write/read RAM a lot.

 

Share this post


Link to post
Share on other sites
Posted (edited)

Intel had a utility to convert 8080 (any maybe Z80) source code to 8088/8086 code. Part of the reason that SAHF and LAHF instructions exist is for this conversion. This allowed a large library of CP/M based code to be converted over to initially CP/M 86, and for the PC, what was going to be either DRDOS/PCDOS/QDOS (it ended up being PCDOS).

 

I'm an old guy that started programming back in 1968 in High School on IBM 1130 (assembly, Fortran, APL), and some Fortran IV for IBM 360. In 1969, assembly language for CDC 3150 and IBM 360. My first job was back in 1973, a multi-tasking multi-computer server / data base system using HP 2100 mini-computers (server code was assembly, offline code Fortran IV). Then through a series of mini computers, mostly working on operating systems. I started with the 68000 and assembly in 1980, where a 68000 based hardware was replacing old custom processors based on AMD 2901's. A few of the programmers at that company bought Atari STs when the 1 meg versions for $1000 came out (1987?). The group also bought Atari 400s for $20 ($70 with $50 rebate), around 1987, and I learned 6502 assembler. One guy made alarm systems based on Atari 400s, using the 20 pins of input for the joystick controllers connected to the sensors. Other processors, Z80, Z8 (unusual in that it had 128 registers). Worst instruction set was Data General Nova 1100, a "risc" machine with only 4 registers. Later I started work on embedded systems using ARM processors, working on operating systems again until the OS's became commonly available. 

 

Edited by rcgldr
  • Like 1

Share this post


Link to post
Share on other sites
1 hour ago, rcgldr said:

Intel had a utility to convert 8080 (any maybe Z80) source code to 8088/8086 code. Part of the reason that SAHF and LAHF instructions exist is for this conversion. This allowed a large library of CP/M based code to be converted over to initially CP/M 86, and for the PC, what was going to be either DRDOS/PCDOS/QDOS (it ended up being PCDOS).

 

I'm an old guy that started programming back in 1968 in High School on IBM 1130 (assembly, Fortran, APL), and some Fortran IV for IBM 360. In 1969, assembly language for CDC 3150 and IBM 360. My first job was back in 1973, a multi-tasking multi-computer server / data base system using HP 2100 mini-computers (server code was assembly, offline code Fortran IV). Then through a series of mini computers, mostly working on operating systems. I started with the 68000 and assembly in 1980, where a 68000 based hardware was replacing old custom processors based on AMD 2901's. A few of the programmers at that company bought Atari STs when the 1 meg versions for $1000 came out (1987?). The group also bought Atari 400s for $20 ($70 with $50 rebate), around 1987, and I learned 6502 assembler. One guy made alarm systems based on Atari 400s, using the 20 pins of input for the joystick controllers connected to the sensors. Other processors, Z80, Z8 (unusual in that it had 128 registers). Worst instruction set was Data General Nova 1100, a "risc" machine with only 4 registers. Later I started work on embedded systems using ARM processors, working on operating systems again until the OS's became commonly available. 

 

 

interesting piece of history

 

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...