summaryrefslogtreecommitdiff
path: root/programs/utils.s
diff options
context:
space:
mode:
Diffstat (limited to 'programs/utils.s')
-rw-r--r--programs/utils.s46
1 files changed, 23 insertions, 23 deletions
diff --git a/programs/utils.s b/programs/utils.s
index a6a14f3..6032a47 100644
--- a/programs/utils.s
+++ b/programs/utils.s
@@ -30,7 +30,7 @@ print_hi:
print_lo:
lda #0 ; Reset A.
sta idx3 ; Clear the string index.
-pntlo_lp:
+@loop:
ldx #2 ; Set digit count to 2.
pha #1 ; Preserve the nibble offset.
jsr print_hex ; Print the low nibble offset.
@@ -41,14 +41,14 @@ pntlo_lp:
pla #1 ; Get the nibble offset back.
inc ; Increment the offset.
cmp #$10 ; Are we at the last offset?
- bcs pntlo_end ; Yes, so we're done.
-pntlo_lp1:
+ bcs @end ; Yes, so we're done.
+@loop1:
pha #1 ; No, so preserve the nibble offset.
lda #' ' ; Add a space to the string buffer.
jsr charcpy ;
pla #1 ; Get the nibble offset back.
- jmp pntlo_lp ; Keep looping.
-pntlo_end:
+ jmp @loop ; Keep looping.
+@end:
inx ; Increment the index by one.
lda #0 ; Null terminate the string buffer.
sta strbuf, x ;
@@ -61,7 +61,7 @@ print_chunk:
ldx #0 ; Reset X.
phy #2 ; Preserve the screen buffer index.
txy ; Copy the byte index to it.
-pntchnk_lp:
+@loop:
and #0 ; Reset A.
ldx #2 ; Set the digit count to 2.
lda (idx0), y ; Get the byte at that address.
@@ -72,11 +72,11 @@ pntchnk_lp:
jsr charcpy ;
iny ; Increment the byte index.
cpy #$10 ; Have we read 16 bytes?
- beq pntchnk_end ; Yes, so we're done.
+ beq @end ; Yes, so we're done.
lda #' ' ; No, so add a soace to the string buffer.
jsr charcpy ;
- jmp pntchnk_lp ; Keep looping.
-pntchnk_end:
+ jmp @loop ; Keep looping.
+@end:
ply #2 ; Get the screen buffer index back.
inx ; Increment the index by one.
and #0 ; Null terminate the string.
@@ -99,7 +99,7 @@ print_hex:
jsr set_ptr ;
ldb #0 ; Reset B.
pla #8 ; Get the hex value back.
-pnthex_lp:
+@loop:
pha #8 ; Preserve the hex value.
and #$F ; Mask the lowest nibble.
phy #2 ; Preserve the screen buffer position.
@@ -109,23 +109,23 @@ pnthex_lp:
sta (ptr3) ; Save the hex digit character in the string.
ply #2 ; Get back the screen buffer position.
pla #8 ; Get the hex value back.
-pnthex_lp1:
+@isauto:
cpx #1 ; Is the digit count less than one?
- bcc pnthex_lp2 ; Yes, so don't decrement the digit count.
+ bcc @auto ; Yes, so don't decrement the digit count.
dex ; No, but was the digit count zero, when decremented?
- beq pnthex_end ; Yes, so we're done.
- jmp pnthex_lp3 ; No, so get the next nibble.
-pnthex_lp2:
+ beq @end ; Yes, so we're done.
+ jmp @next ; No, so get the next nibble.
+@auto:
ldb #1 ; Enable auto digit count.
-pnthex_lp3:
- lsr #4 ; No, but is the next nibble, a zero?
- beq pnthex_lp4 ; Yes, so check if auto digit count is enabled.
- jmp pnthex_lp ; No, so print the next digit.
-pnthex_lp4:
+@next:
+ lsr #4 ; Is the next nibble, a zero?
+ beq @isauto1 ; Yes, so check if auto digit count is enabled.
+ jmp @loop ; No, so print the next digit.
+@isauto1:
cpb #1 ; Is auto digit count enabled?
- beq pnthex_end ; Yes, so we're done.
- jmp pnthex_lp ; No, so keep printing more digits.
-pnthex_end:
+ beq @end ; Yes, so we're done.
+ jmp @loop ; No, so keep printing more digits.
+@end:
rts ; End of print_hex.