13.07.2015 Views

apple-pascal-1.3-manual

apple-pascal-1.3-manual

apple-pascal-1.3-manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

And here is the corresponding 6502 assembly-language source text:sample macro POPs word from evaluation stack.MACRO POPPLASTA %1PLASTA %1+1.ENDMsample macro PUSHes word to evaluation stack.MACRO PUSHLDA "1+1PHALDA "1PHA.ENDMsample function for Pascal, declared:function TIMES2Cdata:integer):integer;.FUNC TIMES2, 1 ;one word of parametersRETURN .mu l1J ;temp store return addrPOP RETURN ;save Pascal re.turn addrPLA;pull 4 bytesPLA;from stackPLA;{only need to doPLA;for .func)PLA;lsb of dataASL A ;times 2TAX;save in xPLA;msb of dataROL A ;times 2. with carryPHA;move msb to evaluation stackTXA;restore lsb to accumPHA;move lsb to evaluation stackPUSH RETURN ; restore Pascal return addressRTS;RETURN to PascalIII-152Chapter 9: Assembly-Language Routines

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!