antoine-source/appleworksgs/Macros/M16.UTILITY

1 line
5.1 KiB
Plaintext
Raw Normal View History

2023-03-04 02:45:20 +00:00
************************************************************************* * * * Apple //GS Utility Macros * * by * * Lou Infeld * * * * Copyright Apple Computer, Inc. 1986-1988 * * All Rights Reserved * ************************************************************************* ;............................................................... ; IncLong - our name for incl - SP - 4/27/89 ;............................................................... MACRO &lab IncLong &address &lab incl &address MEND ;............................................................... ; ; Inc Long word ;............................................................... MACRO &lab incl &address &lab inc &address bne ~t&sysindex inc &address+2 ~t&sysindex MEND ;............................................................... ; DecLong - our name for decl - SP - 4/27/89 ;............................................................... MACRO &lab DecLong &address &lab decl &address MEND ;............................................................... ; ; Dec Long word ;............................................................... MACRO &lab decl &address &lab lda &address bne ~t&sysindex dec &address+2 ~t&sysindex dec &address MEND ;............................................................... ; ; Define string ; ; Generates a Pascal type of string ;............................................................... MACRO str &string lcla &params lcla &length lclc &sset lclc &temp &params seta &nbr(&syslist) &length seta 0 WHILE (&params) DO &temp setc &syslist[&params] IF (&substr(&temp,1,1) = '''') THEN IF (&substr(&temp,&len(&temp),1) = '''') THEN &length seta &length+&len(&temp)-2 ELSE AERROR "STR macro: Mismatched string delimiters" ENDIF ELSE &length seta &length+1 ENDIF &temp setc &substr(&temp,2,&len(&temp)) WHILE (&pos('''''',&temp) > 0) DO &length seta &length-1 &temp setc &substr(&temp,&pos('''''',&temp)+2,&len(&temp)) ENDWHILE &params seta &params-1 ENDWHILE DC.B &length &sset SETC &SETTING('STRING') STRING ASIS &params seta &nbr(&syslist) &length seta 1 WHILE (&length <20> &params) DO DC.B &syslist[&length] &length seta &length+1 ENDWHILE STRING &sset MEND MACRO hexdata &op lcla &length lcla &index lcla &count lclc &thestr &thestr setc '' &length seta &len(&op) &index seta 1 &count seta 0 WHILE (&length) DO &thestr setc &concat(&thestr,',$',&substr(&op,&index,2)) IF (&count = 20) THEN &count seta 0 DC.B &substr(&thestr,2,&len(&thestr)-1) &thestr setc '' ENDIF &count seta &count+1 &index seta &index+2 &length seta &length-2 IF (&length<0) THEN aerror 'hexdata: operand has an odd number of nibbles' MEXIT ENDIF ENDWHILE IF (&count <20> 1) THEN DC.B &substr(&thestr,2,&len(&thestr)-1) ENDIF MEND ;............................................................... ; ; Turn on native mode ; ; The processor is put into 'native' mode. 8 bit or 16 bit ; mode can be specified by using 'short' or 'long' as the ; parameter. If no parameter is specified, 'long' is assumed ;............................................................... MACRO native &mode clc xce IF &mode<64>'' THEN &mode ELSE long ENDIF MEND ;............................................................... ; ; Turn on emulation mode ; ; The processor is put into 'emulation' mode. ;............................................................... MACRO emulation sec xce longa off longi off MEND ;............................................................... ; ; Set Memory & registers to 16 bits ;............................................................... MACRO long rep #%00110000 longa on longi on MEND ;.........