From dd7a4efc643c20c56b845aa11af1fec4b0760d92 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Sun, 3 Dec 2023 07:45:53 +0100 Subject: First day of advent of code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- include/globals.s | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 include/globals.s (limited to 'include/globals.s') diff --git a/include/globals.s b/include/globals.s new file mode 100644 index 0000000..41d3e6c --- /dev/null +++ b/include/globals.s @@ -0,0 +1,39 @@ +.scope Globals + ;;; + ;; Temporary values. + + m_tmp_1 = $00 + m_tmp_2 = $01 + m_tmp_3 = $02 + m_tmp_4 = $03 + m_tmp_5 = $04 + + ;; Bit map to be used as flags during execution. + m_flags = $20 + + ;; Initialize global variables. + .proc init + lda #0 + sta m_tmp_1 + sta m_tmp_2 + sta m_tmp_3 + sta m_tmp_4 + sta m_tmp_5 + sta m_flags + rts + .endproc +.endscope + +;; SET_RENDER_FLAG sets the render bit on Globals::m_flags to 1. +.macro SET_RENDER_FLAG + lda #%10000000 + ora Globals::m_flags + sta Globals::m_flags +.endmacro + +;; UNSET_RENDER_FLAG sets the render bit on Globals::m_flags to 0. +.macro UNSET_RENDER_FLAG + lda #%01111111 + and Globals::m_flags + sta Globals::m_flags +.endmacro -- cgit v1.2.3