From 1a74e6a1856673072a61abd0861759901bc2d939 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 10 Mar 2025 22:52:15 +0100 Subject: Bring code style to better standards MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Be more careful on everything and try to follow along style.nes from my repository. This might change in the future, but it's in a much better state now. Signed-off-by: Miquel Sabaté Solà --- basics/input.s | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) (limited to 'basics/input.s') diff --git a/basics/input.s b/basics/input.s index b773fd7..df49a66 100644 --- a/basics/input.s +++ b/basics/input.s @@ -13,12 +13,10 @@ ;; which brings some other considerations when reading from controllers. That ;; is, the algorithm shown below is not entirely "safe" due to a hardware bug ;; which might give unreliable inputs on some spikes. -;;; ;;; ;; You can safely ignore all of this up until the `ReadController` subroutine. ;; This is boilerplate that is explained on the `sprite.s` example. -;;; .segment "HEADER" .byte 'N', 'E', 'S', $1A @@ -34,17 +32,23 @@ .segment "CODE" -nmi: -irq: - rti +;; Unused +.proc nmi + rti +.endproc + +;; Unused +.proc irq + rti +.endproc -reset: +.proc reset sei cld ldx #$40 stx $4017 - ldx #$ff + ldx #$FF txs inx @@ -75,6 +79,7 @@ reset: bpl @vblankwait2 jmp main +.endproc .proc ReadController ;; The status of the eight buttons fits into a single byte. We start the whole @@ -117,7 +122,7 @@ reset: ;; `rol` instruction. At this point, we have already read the full byte. read_loop: lda $4016 - lsr a + lsr rol $20 bcc read_loop @@ -166,8 +171,6 @@ pressed: ;; There and back again. jmp loop - - rts .endproc .segment "CHARS" -- cgit v1.2.3