mirror of
https://github.com/antoinevignau/source.git
synced 2024-10-31 22:06:40 +00:00
1 line
5.1 KiB
Plaintext
Executable File
1 line
5.1 KiB
Plaintext
Executable File
*************************************************************************
|
||
* *
|
||
* 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 ¶ms
|
||
lcla &length
|
||
lclc &sset
|
||
lclc &temp
|
||
|
||
¶ms seta &nbr(&syslist)
|
||
&length seta 0
|
||
|
||
WHILE (¶ms) DO
|
||
&temp setc &syslist[¶ms]
|
||
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
|
||
|
||
¶ms seta ¶ms-1
|
||
ENDWHILE
|
||
|
||
DC.B &length
|
||
|
||
&sset SETC &SETTING('STRING')
|
||
STRING ASIS
|
||
|
||
¶ms seta &nbr(&syslist)
|
||
&length seta 1
|
||
WHILE (&length <20> ¶ms) 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
|
||
;...............................................................
|
||
;
|
||
; Set Memory & A register to 16 bits
|
||
;...............................................................
|
||
MACRO
|
||
longm
|
||
rep #%00100000
|
||
longa on
|
||
MEND
|
||
;...............................................................
|
||
;
|
||
; Set X & Y registers to 16 bits
|
||
;...............................................................
|
||
MACRO
|
||
longx
|
||
rep #%00010000
|
||
longi on
|
||
MEND
|
||
;...............................................................
|
||
;
|
||
; Set Memory & registers to 8 bits
|
||
;...............................................................
|
||
MACRO
|
||
short
|
||
sep #%00110000
|
||
longa off
|
||
longi off
|
||
MEND
|
||
;...............................................................
|
||
;
|
||
; Set Memory & A register to 8 bits
|
||
;...............................................................
|
||
MACRO
|
||
shortm
|
||
sep #%00100000
|
||
longa off
|
||
MEND
|
||
;...............................................................
|
||
;
|
||
; Set X & Y registers to 8 bits
|
||
;...............................................................
|
||
MACRO
|
||
shortx
|
||
sep #%00010000
|
||
longi off
|
||
MEND
|
||
|