Jump to content
Sign in to follow this  
Nateo

Little Assembly question

Recommended Posts

I am currently learning (struggling) to program the 8088 processor. Later on, I hope to program a VCS game. I was hoping that this assembly was similar to that of the 6502, or it would make learning 6502 a tad easier.

Share this post


Link to post
Share on other sites

Yes it will help...

 

once you learn the basic of 8088 assemley programming.. you can eazly learn how to program in 6502..

 

my knowlage of 6502 programming helped me a lot went i went to school to learn 8088..

Share this post


Link to post
Share on other sites

It's like switching from one higher language (e.g. Delphi/Pascal) to another one (C,C++).

 

And both CPUs are a bit similar too, because both have only a very limited number of registers and the registers are not universal usable. So you always have to keep those limitations in your mind.

Share this post


Link to post
Share on other sites

I also started off on the 8088. One of the hardest things starting off with 6502 that I remember was their method of accessing the 16-bit memory using two 8-bit memory addresses. The 6502 code:

 

code:


LDA ($80,Y)


 

is similar to this double dereference in 8088 (if BH=00):

 

code:


MOV SI,[0080h] ; get real offset from word at 0080h

MOV AL,[sI+BX] ; read a byte from offset+BX


 

To match Y the BX really should be something like BL to make it an 8-bit offset, but that's not valid 8088.

 

I also had lots of problems with the 6502 branch statements, but that was my own fault for misunderstanding signed vs. unsigned comparisons even on the 8088 (for example BPL/BMI vs. BCS/BCC).

 

Since there is no plain ADD/SUB for 6502, you have to use ADC/SBC. Well, to do a "regular" add, you would use CLC then ADC. But, for a subtract you'll need to use SEC then SBC. Otherwise, you get the wrong results on your subtractions. Good luck with MUL/DIV. For multiplication use shifts with add, for division I recommend a binary division routine.

 

The 6502 will set flags on more instructions than the 8088, which is pretty handy sometimes. For example, even right after doing a LDA/LDX/LDY you can branch on a zero/non-zero condition.

 

Hope this info. was helpful,

calamari

 

[ 05-23-2002: Message edited by: calamari ]

Share this post


Link to post
Share on other sites

When I was in High School I used to play w/ 6502 Assembly on my 800 & z80 assembly on my Bally but never really did anything big. More often then not I would get a dump of an existing program and just modify the data segments to change the colors & graphics of a few games. I then took an 8088 assembler class in college (do they still teach assembler? Most of the younger developers we've been hiring don't seem to know it at all) and it taught me quite a bit. When I first started working at our company I had to write quite a few assembler routines & modules in order to "break the rules" of DOS programming. I'm now working on a game for the Lynx and have found that the knowledge from the 8088 ports over very nicely.

 

The original reason I started this, before I started rambling was to say that if you're going to look at 6502 assembly language programming a great book is "6502 Assembly Language Programming" by Lance A. Leventhal. It was published by McGraw Hill in 1979 but you can still find it around if you look. It starts w/ a good section on Assembly semantics. It then moves on to detailed descriptions of all the different instructions w/ simple examples. The last half of the book is all very detailed coding examples for real world situations. It also has very good sections on 6502 interrupts, coding styles and optimizations. Overall I've found this book to be invaluable. I wish I had had it when I was working with the assembler editor on my 800.

 

I'm sure there are other books that are just as good if not better but I've been very happy with this one.

 

-----------------------------------

Someday I'll think of a good sig

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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...