mirror of
https://github.com/Pecusx/scorch_src.git
synced 2026-05-21 06:39:40 +02:00
5200 compiles
This commit is contained in:
+146
@@ -0,0 +1,146 @@
|
||||
;-------------------------------------
|
||||
.MACRO ROLW
|
||||
ROL :1
|
||||
ROL :1+1
|
||||
.ENDM
|
||||
;-------------------------------------
|
||||
.MACRO ASLW
|
||||
ASL :1
|
||||
ROL :1+1
|
||||
.ENDM
|
||||
;-------------------------------------
|
||||
.MACRO RORW
|
||||
ROR :1+1
|
||||
ROR :1
|
||||
.ENDM
|
||||
;-------------------------------------
|
||||
.MACRO LSRW
|
||||
LSR :1+1
|
||||
ROR :1
|
||||
.ENDM
|
||||
|
||||
;-------------------------------------
|
||||
.MACRO VMAIN
|
||||
; VMAIN #WORD,interrupt.vector
|
||||
; interrupt.vector:
|
||||
; 0 - VIMIRQ
|
||||
; 1 - TIMCNT1
|
||||
; 2 - TIMCNT2
|
||||
; 3 - TIMCNT3
|
||||
; 4 - TIMCNT4
|
||||
; 5 - TIMCNT5
|
||||
; 6 - VVBLKI
|
||||
; 7 - VVBLKD
|
||||
; 8 - TIMVEC1
|
||||
; 9 - TIMVEC2
|
||||
; Initialises Vertical Blank Interrupts
|
||||
; (works only with system interrupts ON)
|
||||
LDY # <:1
|
||||
LDX # >:1
|
||||
LDA #:2
|
||||
JSR SETVBV
|
||||
.ENDM
|
||||
;-------------------------------------
|
||||
.MACRO VDLI
|
||||
; VDLI #WORD
|
||||
; Initialises Display List Interrupts
|
||||
LDY # <:1
|
||||
LDX # >:1
|
||||
LDA #$C0
|
||||
STY $0200
|
||||
STX $0201
|
||||
STA NMIEN
|
||||
.ENDM
|
||||
;-------------------------------------
|
||||
.MACRO halt
|
||||
?stop
|
||||
lda RANDOM
|
||||
and #$05
|
||||
sta COLBAK
|
||||
jmp ?stop
|
||||
.ENDM
|
||||
;-------------------------------------
|
||||
.MACRO KEY
|
||||
; KEY
|
||||
; waits for releasing and pressing "any key"
|
||||
PHA
|
||||
?CK1 LDA SKSTAT
|
||||
AND #$04
|
||||
BEQ ?CK1
|
||||
?CK LDA SKSTAT
|
||||
AND #$04
|
||||
BNE ?CK
|
||||
PLA
|
||||
.ENDM
|
||||
;-------------------------------------
|
||||
.MACRO WAIT
|
||||
; WAIT
|
||||
; waits one frame (1/50 s(PAL) or 1/60s(NTSC))
|
||||
?zero LDA VCOUNT
|
||||
beq ?zero
|
||||
bpl ?WA
|
||||
sbc #10 ; last lines correction
|
||||
?WA cmp VCOUNT
|
||||
beq ?WA
|
||||
bcc ?WA
|
||||
?WFRAME cmp VCOUNT
|
||||
beq ?nowait
|
||||
bcs ?WFRAME
|
||||
?nowait
|
||||
.ENDM
|
||||
;-------------------------------------
|
||||
.macro negw
|
||||
; negate the given word (0-a)
|
||||
;-------------------------------------
|
||||
sec
|
||||
lda #$00
|
||||
sbc :1
|
||||
sta :1
|
||||
lda #$00
|
||||
sbc :1+1
|
||||
sta :1+1
|
||||
.endm
|
||||
;-------------------------------------
|
||||
.macro randomize
|
||||
;usage: randomize floor ceiling
|
||||
;returns (in A) a random .byte between "floor" and "ceiling"
|
||||
.if :2 < :1
|
||||
.error "floor higher than ceiling"
|
||||
.endif
|
||||
?rand
|
||||
lda random
|
||||
cmp #:1 ;floor
|
||||
bcc ?rand
|
||||
cmp #:2+1 ;ceiling
|
||||
bcs ?rand
|
||||
.endm
|
||||
;-------------------------------------
|
||||
.macro phx
|
||||
txa
|
||||
pha
|
||||
.endm
|
||||
;-------------------------------------
|
||||
.macro phy
|
||||
tya
|
||||
pha
|
||||
.endm
|
||||
;-------------------------------------
|
||||
.macro plx
|
||||
pla
|
||||
tax
|
||||
.endm
|
||||
;-------------------------------------
|
||||
.macro ply
|
||||
pla
|
||||
tay
|
||||
.endm
|
||||
;-------------------------------------
|
||||
.macro pause
|
||||
;waits :1 number (byte) of frames
|
||||
ldx #:1
|
||||
?PAUSELOOP
|
||||
wait
|
||||
dex
|
||||
bne ?PAUSELOOP
|
||||
.ENDM
|
||||
|
||||
Reference in New Issue
Block a user