[Coco] Linville's ramblings on assembly vs machine code
Mark McDougall
msmcdoug at iinet.net.au
Tue Jul 11 00:18:37 EDT 2017
On 11/07/2017 12:29 PM, Melanie and John Mark Mobley wrote:
> I got a surprise with I found that the following two instruction did not
> work the same:
> CLRA ; Clear A and the Carry Flag
> LDA #$00 ; Clear A
Not sure this example has much to do with the ASM vs ML debate, but an
interesting side note none-the-less.
When programming for different CPUs you come across similar subtleties
with the Z flag; some clear it on a LOAD, some don't. Seemingly
innocuous until you start porting code between processors. A good
example is common practice on the Z80 with a comparison that then loads
the accumulator with another value before a conditional branch...
> I think that it is important to note that the computer, for the most part,
> cannot distinguish between code and data. Therefore you must jump in a
> valid address where the code is that you want to run.
It's related to the Halting Problem, which is why disassemblers simply
can't get it right in every case.
Regards,
--
Mark McDougall
<http://retroports.blogspot.com.au>
More information about the Coco
mailing list