From: Kyle Owen: Thursday, September 08, 2016 3:53 PM
How does the following compare to your BSWEMU, by the way? This ensures
that the link bit remains untouched, which may or may not be important in
every case of BSW in my application.

I'm sure I've seen some code before that does this, but I can't seem to
find any now that I'm looking for it. Maybe there's a shorter way. I think
this takes 23 words if you include the (0100), (7700), and (0077), which
may or may not also be used elsewhere in the first page where I put this
subroutine.

Here's my slightly optimized version, for what it's worth:
  1                    *400
  2            /
  3            / BSW emulation
  4            /
  5 00400 0000 bsw,    .-.
  6 00401 3216         dca saveac      / Save AC
  7 00402 7630         szl cla         / Link set?
  8 00403 7140         cll cma         / Yes, remember it
  9 00404 3217         dca savel
 10 00405 1216         tad saveac      / Get 0 xxx xxx yyy yyy
 11 00406 0220         and c7700
 12 00407 1216         tad saveac      / x xx xxx0 yyy yyy
 13 00410 7006         rtl
 14 00411 7006         rtl
 15 00412 7006         rtl             / 0 yyy yyy xxx xxx
 16 00413 2217         isz savel       / Was link set?
 17 00414 7020         cml             / Yes, restore it
 18 00415 5600         jmp i bsw       / return
 19 00416 0000 saveac, .-.
 20 00417 0000 savel,  .-.
 21 00420 7700 c7700,  7700
 22            $

There is a fair chance that each of saveac, savel, and c7700 can be reused elsewhere.

Some assemblers flag the "(" construct when used on page 0, BTW. It's more correct
to use "[" there (or to avoid both).

I'm a "family of 8" guy, so I avoid using BSW to begin with.

Vince

Reply via email to