mirror of
https://github.com/antoinevignau/source.git
synced 2025-01-02 06:30:17 +00:00
1 line
8.5 KiB
Plaintext
Executable File
1 line
8.5 KiB
Plaintext
Executable File
;--------------------------------------------------------------------------
|
||
;
|
||
; m16.MSL
|
||
;
|
||
;
|
||
;
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; WaitMouse
|
||
;
|
||
; Wait for a click
|
||
|
||
MACRO
|
||
&lab WaitMouse
|
||
&lab ;
|
||
~b&SYSINDEX pha
|
||
pushword #0
|
||
_Button
|
||
pla
|
||
beq ~b&SYSINDEX
|
||
~c&SYSINDEX pha
|
||
pushword #0
|
||
_Button
|
||
pla
|
||
bne ~c&SYSINDEX
|
||
MEND
|
||
|
||
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; Break
|
||
;
|
||
|
||
MACRO
|
||
&lab Break ¶m
|
||
&lab ;
|
||
IF &nbr(&syslist) GOTO .gotone
|
||
|
||
macerr 'Break macro: no input parameter specified.'
|
||
mexit
|
||
|
||
.gotone
|
||
lda >$00C025
|
||
IF (¶m='cap') GOTO .gotcaps
|
||
IF (¶m='caps') GOTO .gotcaps
|
||
IF (¶m='capslock') GOTO .gotcaps
|
||
IF (¶m='opt') GOTO .gotopt
|
||
IF (¶m='option') GOTO .gotopt
|
||
IF (¶m='closedapple') GOTO .gotopt
|
||
IF (¶m='fan') GOTO .gotfan
|
||
IF (¶m='apple') GOTO .gotfan
|
||
IF (¶m='cmd') GOTO .gotfan
|
||
IF (¶m='openapple') GOTO .gotfan
|
||
IF (¶m='shift') GOTO .gotshift
|
||
IF (¶m='ctl') GOTO .gotctl
|
||
IF (¶m='control') GOTO .gotctl
|
||
IF (¶m='ctrl') GOTO .gotctl
|
||
IF (¶m='cntl') GOTO .gotctl
|
||
IF (¶m='cntrl') GOTO .gotctl
|
||
macerr 'Break macro: unable to decipher parameter.'
|
||
|
||
.gotcaps
|
||
and #%00000100
|
||
GOTO .didit
|
||
|
||
.gotopt
|
||
and #%01000000
|
||
GOTO .didit
|
||
|
||
.gotfan
|
||
and #%10000000
|
||
GOTO .didit
|
||
|
||
.gotshift
|
||
and #%00000001
|
||
GOTO .didit
|
||
|
||
.gotctl
|
||
and #%00000010
|
||
|
||
.didit
|
||
beq ~b&SYSINDEX
|
||
|
||
brk
|
||
|
||
~b&SYSINDEX ;
|
||
|
||
MEND
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; IsNil
|
||
;
|
||
; see if a longword is zero
|
||
|
||
MACRO
|
||
&lab IsNil ¶m
|
||
&lab lda ¶m
|
||
ora ¶m+2
|
||
MEND
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; SetBorder <colour>
|
||
;
|
||
; set the border colour
|
||
|
||
MACRO
|
||
&lab SetBorder ¶m
|
||
&lab lda >$E0C034
|
||
IF &nbr(&syslist) GOTO .setit
|
||
and #$000F
|
||
inc a
|
||
and #$000F
|
||
pha
|
||
lda >$E0C034
|
||
and #$FFF0
|
||
ora 1,s
|
||
sta >$E0C034
|
||
pla
|
||
GOTO .exit
|
||
|
||
.setit anop
|
||
and #$FFF0
|
||
ora ¶m
|
||
sta >$E0C034
|
||
.exit anop
|
||
MEND
|
||
|
||
MACRO
|
||
&lab GetBorder &arg
|
||
&lab lda >$e0c034
|
||
and #$f
|
||
sta &arg
|
||
MEND
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; WaitKey <key>
|
||
;
|
||
; Wait for any key or for a specific key
|
||
;
|
||
MACRO
|
||
&lab WaitKey ¶m
|
||
&lab ;
|
||
~b&SYSINDEX lda >$C000
|
||
and #$80
|
||
beq ~b&SYSINDEX
|
||
IF &nbr(&syslist) GOTO .specfic
|
||
sta >$C010
|
||
GOTO .exit
|
||
|
||
.specfic anop
|
||
lda >$C000
|
||
sta >$C010
|
||
and #$7F
|
||
cmp ¶m
|
||
bne ~b&SYSINDEX
|
||
.exit anop
|
||
MEND
|
||
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; Click
|
||
;
|
||
; click the speaker
|
||
|
||
MACRO
|
||
&lab Click
|
||
&lab lda >$00C030
|
||
MEND
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; SetVol
|
||
;
|
||
;
|
||
MACRO
|
||
&lab SetVol ¶m
|
||
&lab lda >$00C03C
|
||
and #$FFF0
|
||
ora ¶m
|
||
sta >$00C03C
|
||
MEND
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; RCall - register Call
|
||
;
|
||
;
|
||
MACRO
|
||
&lab RCall &routine,&in,&out
|
||
&lab ;
|
||
lcla &outnum
|
||
lcla &innum
|
||
lcla &count
|
||
lclc &inreg
|
||
lclc &outreg
|
||
lclc &inp
|
||
lclc &outp
|
||
lclc ®
|
||
|
||
&innum seta &nbr(&in)
|
||
&outnum seta &nbr(&out)
|
||
IF ((&innum = 0) and (&in <20> '')) or ((&outnum = 0) and (&out <20> '')) THEN
|
||
macerr 'RCall macro: all parameters to this macro must be in parentheses.'
|
||
mexit
|
||
ENDIF
|
||
&count seta 1
|
||
|
||
IF &innum=0 GOTO .call
|
||
IF &innum<4 GOTO .inloop
|
||
macerr 'RCall macro: too many inputs (3 maximum)'
|
||
mexit
|
||
|
||
.inloop
|
||
&inreg setc &substr(&in[&count],&len(&in[&count])-2,3)
|
||
IF (&inreg<65>':ax') and (&inreg<65>':xy') and (&inreg<65>':ay') GOTO .in2
|
||
® setc &substr(&in[&count],&len(&in[&count])-1,2)
|
||
&inp setc &substr(&in[&count],1,&len(&in[&count])-3)
|
||
movelong &inp,®
|
||
GOTO .incont
|
||
|
||
.in2
|
||
&inreg setc &substr(&in[&count],&len(&in[&count])-1,2)
|
||
IF (&inreg<65>':a') and (&inreg<65>':x') and (&inreg<65>':y') GOTO .inerr
|
||
® setc &substr(&in[&count],&len(&in[&count]),1)
|
||
&inp setc &substr(&in[&count],1,&len(&in[&count])-2)
|
||
moveword &inp,®
|
||
GOTO .incont
|
||
|
||
|
||
.inerr
|
||
macerr "RCall macro: missing input register specification"
|
||
mexit
|
||
|
||
.incont
|
||
&count seta &count+1
|
||
IF &count<6E>&innum GOTO .inloop
|
||
.call
|
||
jsl &routine
|
||
|
||
&count seta 1
|
||
|
||
IF &outnum=0 GOTO .exit
|
||
IF &outnum<4 GOTO .outloop
|
||
macerr 'RCall macro: too many outputs (3 maximum)'
|
||
GOTO .exit
|
||
|
||
|
||
.outloop
|
||
&outreg setc &substr(&out[&count],&len(&out[&count])-2,3)
|
||
IF (&outreg<65>':ax') and (&outreg<65>':xy') and (&outreg<65>':ay') GOTO .out2
|
||
® setc &substr(&out[&count],&len(&out[&count])-1,2)
|
||
&outp setc &substr(&out[&count],1,&len(&out[&count])-3)
|
||
movelong ®,&outp
|
||
GOTO .outcont
|
||
|
||
.out2
|
||
&outreg setc &substr(&out[&count],&len(&out[&count])-1,2)
|
||
IF (&outreg<65>':a') and (&outreg<65>':x') and (&outreg<65>':y') GOTO .outerr
|
||
® setc &substr(&out[&count],&len(&out[&count]),1)
|
||
&outp setc &substr(&out[&count],1,&len(&out[&count])-2)
|
||
moveword ®,&outp
|
||
GOTO .outcont
|
||
|
||
|
||
.outerr
|
||
macerr 'RCall macro: missing output register specification'
|
||
mexit
|
||
|
||
.outcont
|
||
&count seta &count+1
|
||
IF &count<6E>&outnum GOTO .outloop
|
||
|
||
.exit anop
|
||
MEND
|
||
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; ABS
|
||
;
|
||
;
|
||
MACRO
|
||
&lab ABS &op
|
||
&lab ;
|
||
IF &nbr(&syslist) GOTO .getop
|
||
.aop
|
||
tax
|
||
GOTO .gotop
|
||
|
||
.getop
|
||
IF (&op='a') GOTO .aop
|
||
moveword &op,a
|
||
.gotop
|
||
bpl ~b&SYSINDEX
|
||
|
||
dec a ; NEG
|
||
eor #$FFFF
|
||
IF &nbr(&syslist) GOTO .putop
|
||
GOTO .exit
|
||
|
||
.putop
|
||
moveword a,&op
|
||
.exit
|
||
~b&SYSINDEX ;
|
||
MEND
|
||
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; NEG
|
||
;
|
||
;
|
||
MACRO
|
||
&lab NEG &op
|
||
&lab ;
|
||
IF &nbr(&syslist) GOTO .getop
|
||
GOTO .gotop
|
||
|
||
.getop
|
||
IF (&op='a') GOTO .gotop
|
||
moveword &op,a
|
||
.gotop
|
||
dec a
|
||
eor #$FFFF ; NOT
|
||
IF &nbr(&syslist) GOTO .putop
|
||
GOTO .exit
|
||
|
||
.putop
|
||
moveword a,&op
|
||
.exit
|
||
MEND
|
||
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; Not
|
||
;
|
||
;
|
||
MACRO
|
||
&lab NOT &op
|
||
&lab ;
|
||
IF &nbr(&syslist) GOTO .getop
|
||
GOTO .geta
|
||
|
||
.getop
|
||
IF (&op='a') GOTO .gotop
|
||
moveword &op,a
|
||
GOTO .gotop
|
||
|
||
.geta
|
||
tay
|
||
.gotop
|
||
beq ~b&SYSINDEX
|
||
lda #0
|
||
bra ~c&SYSINDEX
|
||
~b&SYSINDEX ;
|
||
lda #1
|
||
~c&SYSINDEX ;
|
||
IF &nbr(&syslist) GOTO .putop
|
||
GOTO .exit
|
||
|
||
.putop
|
||
moveword a,&op
|
||
.exit
|
||
MEND
|
||
|
||
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; BNot
|
||
;
|
||
;
|
||
MACRO
|
||
&lab BNOT &op
|
||
&lab ;
|
||
IF &nbr(&syslist) GOTO .getop
|
||
GOTO .gotop
|
||
|
||
.getop
|
||
IF (&op='a') GOTO .gotop
|
||
moveword &op,a
|
||
.gotop
|
||
eor #$FFFF
|
||
IF &nbr(&syslist) GOTO .putop
|
||
GOTO .exit
|
||
|
||
.putop
|
||
moveword a,&op
|
||
.exit
|
||
MEND
|
||
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; Swap
|
||
;
|
||
;
|
||
|
||
MACRO
|
||
&lab Swap ¶m1,¶m2
|
||
&lab moveword ¶m1,x
|
||
moveword ¶m2,¶m1
|
||
moveword x,¶m2
|
||
MEND
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; SwapL
|
||
;
|
||
;
|
||
|
||
MACRO
|
||
&lab SwapL ¶m1,¶m2
|
||
&lab pushlong ¶m1
|
||
movelong ¶m2,¶m1
|
||
pulllong ¶m2
|
||
MEND
|
||
|
||
|
||
;---------------------------------------------------------------------------
|
||
;
|
||
; dbg - bizarre debugging method using WDM statements...
|
||
;
|
||
;
|
||
|
||
MACRO
|
||
&lab dbg &num
|
||
&lab ;
|
||
DC.B $42, &num
|
||
MEND
|
||
|
||
|
||
;----------------------------------------------------------------------
|
||
MACRO
|
||
&lab Mull4 &op
|
||
&lab clc
|
||
rol &op
|
||
rol &op+2
|
||
clc
|
||
rol &op
|
||
rol &op+2
|
||
MEND
|
||
|
||
|
||
MACRO
|
||
MacErr
|
||
|
||
lclc &msg
|
||
lcla &num
|
||
lcla &count
|
||
|
||
&num seta &nbr(&syslist)
|
||
|
||
IF (&num = 0) THEN
|
||
mexit
|
||
ENDIF
|
||
&msg setc ''
|
||
|
||
&count seta 1
|
||
WHILE (&count <20> &num) DO
|
||
IF (&substr(&syslist[&count],1,1) = '"') or (&substr(&syslist[&count],1,1) = '''') THEN
|
||
&msg setc &concat(&msg,&substr(&syslist[&count],2,&len(&syslist[&count])-2))
|
||
ELSE
|
||
&msg setc &concat(&msg,&syslist[&count])
|
||
ENDIF
|
||
&count seta &count+1
|
||
ENDWHILE
|
||
|
||
&msg setc &concat(&msg,' Proc: ')
|
||
&msg setc &concat(&msg,&sysmod)
|
||
aerror &msg
|
||
|
||
MEND |