Debian Codegraph @

machines/atari7800/macro.h

raw symbols SCIP
1 ; MACRO.H
2
3 ; Based on the 2600 macro.h file.
4 ; Macros irrelevant to the 7800 have been removed, and the sleep macro
5 ; has been adapted to give accurate results on the 7800.
6
7 ; Version 1.0 2019/12/11 (based on the 2600 Version 1.05, 13/NOVEMBER/2003)
8
9 ; Available macros...
10 ; SLEEP n - sleep for n cycles
11 ; SET_POINTER - load a 16-bit absolute to a 16-bit variable
12
13 ;-------------------------------------------------------------------------------
14 ; SLEEP duration
15 ; Original author: Thomas Jentzsch
16 ; Inserts code which takes the specified number of cycles to execute. This is
17 ; useful for code where precise timing is required.
18 ; ILLEGAL-OPCODE VERSION DOES NOT AFFECT FLAGS OR REGISTERS.
19 ; LEGAL OPCODE VERSION MAY AFFECT FLAGS
20 ; Uses illegal opcode (DASM 2.20.01 onwards).
21
22 MAC SLEEP ;usage: SLEEP n (n>1)
23 .CYCLES SET {1}
24
25 IF .CYCLES < 2
26 ECHO "MACRO ERROR: 'SLEEP': Duration must be > 1"
27 ERR
28 ENDIF
29
30 IF .CYCLES & 1
31 IFNCONST NO_ILLEGAL_OPCODES
32 nop $80
33 ELSE
34 bit $80
35 ENDIF
36 .CYCLES SET .CYCLES - 3
37 ENDIF
38
39 REPEAT .CYCLES / 2
40 nop
41 REPEND
42 ENDM
43
44 ;-------------------------------------------------------
45 ; SET_POINTER
46 ; Original author: Manuel Rotschkar
47 ;
48 ; Sets a 2 byte RAM pointer to an absolute address.
49 ;
50 ; Usage: SET_POINTER pointer, address
51 ; Example: SET_POINTER SpritePTR, SpriteData
52 ;
53 ; Note: Alters the accumulator, NZ flags
54 ; IN 1: 2 byte RAM location reserved for pointer
55 ; IN 2: absolute address
56
57 MAC SET_POINTER
58 .POINTER SET {1}
59 .ADDRESS SET {2}
60
61 LDA #<.ADDRESS ; Get Lowbyte of Address
62 STA .POINTER ; Store in pointer
63 LDA #>.ADDRESS ; Get Hibyte of Address
64 STA .POINTER+1 ; Store in pointer+1
65
66 ENDM
67
68 ; EOF