-
Notifications
You must be signed in to change notification settings - Fork 2
/
macros_diag.asm
33 lines (28 loc) · 1.3 KB
/
macros_diag.asm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
;===============================================================================
; MACROS - DIAGNOSTICS
;===============================================================================
; Generic, all-purpose, helper macros to shorten repetitive
; tasks and make more readable code
;===============================================================================
.if DO_DIAG=1
;-------------------------------------------------------------------------------
; DIAGBYTE A X
;-------------------------------------------------------------------------------
; mDiagByte <Address>, <X position>
;
; Calls the DiagByte routine to convert a byte into the two-byte,
; hex representation and write this to a position in the
; diagnostic screen memory intended for display on the screen.
;-------------------------------------------------------------------------------
.macro mDiagByte address,xpos_offset
.if :0<>2
.error "DiagByte: 2 arguments (address, screen X position) required."
.else
mRegSave ; Save all CPU registers, so this call does not disrupt program state.
lda :address ; Load byte in address
ldx #:xpos_offset ; Load screen line X offset.
jsr libDiagDisplayByte
mRegRestore ; Restore all registers.
.endif
.endm
.endif ; if DO_DIAG=1