antoine-source/appleworksgs/Macros/m16.cmp

1 line
14 KiB
Plaintext
Raw Normal View History

2023-03-04 02:45:20 +00:00
;............................................................................; ; ; Compare long word for zero macro ; ; Cpzl addr Cpzl addr:#off ; Cpzl addr:x Cpzl [zp] ; Cpzl addr:y Cpzl [zp]:y ; Cpzl addr:s Cpzl [zp]:off ; Cpzl addr:off Cpzl [zp]:#off ; ;............................................................................; MACRO &lab Cpzl &loc &lab ; lclc &char lcla &offset lclc &rest lclc &disp &char setc &substr(&loc,1,1) &offset seta &pos(':',&loc) IF &offset GOTO .docmpoff IF (&char='[') GOTO .docmpzp lda &loc ora &loc+2 mexit .docmpzp lda &loc ldy #2 ora &loc,y mexit .docmpoff &rest setc &substr(&loc,1,&offset-1) &disp setc &substr(&loc,&offset+1,&len(&loc)-&offset) IF &char='[' GOTO .docmpoffzp IF (&disp='s') or (&disp='x') or (&disp='y') GOTO .docmpoffi ldx &disp &disp setc 'x' .docmpoffi lda &rest,&disp ora &rest+2,&disp mexit .docmpoffzp IF (&disp='y') GOTO .doy ldy &disp .doy lda &rest,y iny iny ora &rest,y mexit MEND *=======================================================================* macro &lab CmpByte &from,&to &lab cmpb &from,&to mend *=======================================================================* macro &lab CmpWord &from,&to &lab cmpw &from,&to mend *=======================================================================* macro &lab CmpLong &from,&to &lab cmpl &from,&to mend *=======================================================================* MACRO &lab Cmpl &from,&to &lab ; lcla &noy1 lcla &noy2 lcla &nox1 lcla &nox2 lcla &ypushed lcla &yinced lcla &xpushed lcla &yhas2 lcla &const1 lcla &addr1 lcla &a1off lcla &a2off lcla &needbra lcla &sameoff lclc &cmpreg lclc &fdisp lclc &tdisp lclc &floc lclc &tloc lclc &fchar lclc &tchar lcla &foffset lcla &toffset lclc &newfrom lclc &newto lcla &num &newfrom setc &from &newto setc &to &fchar setc &substr(&from,1,1) &tchar setc &substr(&to,1,1) &foffset seta &pos(':',&from) &toffset seta &pos(':',&to) IF &foffset=0 GOTO .nofoff &floc setc &substr(&from,1,&foffset-1) &fdisp setc &substr(&from,&foffset+1,&len(&from)-&foffset) .nofoff IF &toffset GOTO .gettoff GOTO .setnox2 .gettoff &tloc setc &substr(&to,1,&toffset-1) &tdisp setc &substr(&to,&toffset+1,&len(&to)-&toffset) IF (&tdisp='s') or (&tdisp='y') or (&tchar='[') GOTO .setnox2 IF (&tdisp='x') GOTO .setnoy2 &a2off seta 1 GOTO .setnoy2 .setnox2 &nox2 seta 1 IF (&tdisp='y') GOTO .notoff .setnoy2 &noy2 seta 1 .notoff IF not (&foffset and &toffset) GOTO .notsame &num seta &pos(&tdisp,&fdisp) IF &num=0 GOTO .notsame IF (&tchar='[') and (&fchar<61>'[') GOTO .notsame IF (&fchar='[') and (&tchar<61>'[') GOTO .notsame &sameoff seta 1 .notsame &cmpreg setc 'a' IF &foffset GOTO .fromoff IF &fchar='[' GOTO .fromzp IF &fchar='#' GOTO .fromimm IF &from='ax' GOTO .fromxhigh IF (&from='ay') or (&from='xy') GOTO .fromyhigh &addr1 seta 1 lda &from+2 GOTO .doto .fromyhigh &cmpreg setc 'y' GOTO .doto .fromxhigh &cmpreg setc 'x' GOTO .doto .fromimm &newfrom setc &substr(&from,2,&len(&from)-1) lda #^&newfrom &const1 seta 1 GOTO .doto .fromzp IF &noy2 GOTO .fromzpnophy phy &ypushed seta 1 .fromzpnophy ldy #2 lda &from,y &yhas2 seta 1 &nox1 seta 1