Skip to content

Commit

Permalink
Updated Monitor for UART
Browse files Browse the repository at this point in the history
  • Loading branch information
visrealm committed Dec 18, 2023
1 parent cd88f26 commit c99cf4b
Show file tree
Hide file tree
Showing 5 changed files with 603 additions and 582 deletions.
190 changes: 95 additions & 95 deletions code/6502/monitor/commands/dump.asm
Original file line number Diff line number Diff line change
@@ -1,95 +1,95 @@
; Troy's HBC-56 - Monitor
;
; Copyright (c) 2022 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;
;

; -----------------------------------------------------------------------------
; dump a page of data from the current address
; -----------------------------------------------------------------------------
dumpCommand:
phx
+outputStringAddr dumpHeader
plx

ldy #0
stz TMP_C

lda CURR_ADDR
and #$f0
sta DUMP_ROW_START_L
lda CURR_ADDR_H
sta DUMP_ROW_START_H

;ldx #1
; cpx COMMAND_LEN
; beq @newLine
;; jsr readHexByte
; jsr hexToAcc
; sta TMP_C

@newLine
lda #$0d
+outputA
lda #'$'
+outputA
tya
clc
adc CURR_ADDR
sta TEMP_ADDR
lda CURR_ADDR_H
bcc +
inc
sta TEMP_ADDR_H
+
jsr outHex8
lda TEMP_ADDR
jsr outHex8
lda #':'
+outputA
ldx #0

@nextByte
lda #' '
+outputA
lda (CURR_ADDR),y
sta COMMAND_BUFFER,x
inx
jsr outHex8
iny
cpy TMP_C
beq @doRaw
tya
and #$0f
bne @nextByte

@doRaw
lda #' '
+outputA
ldx #0
-
lda COMMAND_BUFFER,x
cmp #' '
bcs +
lda #'.'
+
cmp #'~'
bcc +
lda #'.'
+
+outputA
inx
cpx #16
bne -
cpy TMP_C
bne @newLine

@endDump
lda #$0d
+outputA
jmp commandLoop

; Troy's HBC-56 - Monitor
;
; Copyright (c) 2022 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;
;

; -----------------------------------------------------------------------------
; dump a page of data from the current address
; -----------------------------------------------------------------------------
dumpCommand:
phx
+outputStringAddr dumpHeader
plx

ldy #0
stz TMP_C

lda CURR_ADDR
and #$f8
sta DUMP_ROW_START_L
lda CURR_ADDR_H
sta DUMP_ROW_START_H

ldx #1
cpx COMMAND_LEN
beq @newLine
jsr readHexByte
jsr hexToAcc
sta TMP_C

@newLine
lda #$0d
+outputA
lda #'$'
+outputA
tya
clc
adc CURR_ADDR
sta TEMP_ADDR
lda CURR_ADDR_H
bcc +
inc
sta TEMP_ADDR_H
+
jsr outHex8
lda TEMP_ADDR
jsr outHex8
lda #':'
+outputA
ldx #0

@nextByte
lda #' '
+outputA
lda (CURR_ADDR),y
sta COMMAND_BUFFER,x
inx
jsr outHex8
iny
cpy TMP_C
beq @doRaw
tya
and #$07
bne @nextByte

@doRaw
lda #' '
+outputA
ldx #0
-
lda COMMAND_BUFFER,x
cmp #' '
bcs +
lda #'.'
+
cmp #'~'
bcc +
lda #'.'
+
+outputA
inx
cpx #8
bne -
cpy TMP_C
bne @newLine

@endDump
lda #$0d
+outputA
jmp commandLoop

64 changes: 34 additions & 30 deletions code/6502/monitor/commands/help.asm
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
; Troy's HBC-56 - Monitor
;
; Copyright (c) 2022 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;
;

; -----------------------------------------------------------------------------
; output the help message
; -----------------------------------------------------------------------------
helpCommand:
+outputStringAddr helpMessage
+outputStringAddr helpMessage2
jmp commandLoop


helpMessage:
!text "HBC-56 - Monitor Help\n\n"
!text " c - clear screen\n"
!text " d [#] - output # bytes from current address\n"
!text " e - execute code from current address\n",0
helpMessage2:
!text " h - help\n"
!text " q - quit\n"
!text " w <xx>[+] - write value(s) and increment address if +\n"
!text " s <xx> - send value(s) to current address\n"
!text " $ <xxxx> - set current address\n", 0
; Troy's HBC-56 - Monitor
;
; Copyright (c) 2022 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;
;

; -----------------------------------------------------------------------------
; output the help message
; -----------------------------------------------------------------------------
helpCommand:
+outputStringAddr helpMessage
+outputStringAddr helpMessage2
jmp commandLoop


helpMessage:
!text "HBC-56 - Monitor Help\n\n"
!text " c - clear screen\n"
!text " d [#] - output # bytes from current"
!text " address\n"
!text " e - execute code from current "
!text " address\n",0
helpMessage2:
!text " h - help\n"
!text " q - quit\n"
!text " w <xx>[+] - write value(s) and\n"
!text " increment address if +\n"
!text " s <xx> - send value(s) to current\n"
!text " address\n"
!text " $ <xxxx> - set current address\n", 0
104 changes: 54 additions & 50 deletions code/6502/monitor/commands/write.asm
Original file line number Diff line number Diff line change
@@ -1,50 +1,54 @@
; Troy's HBC-56 - Monitor
;
; Copyright (c) 2022 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;
;

; -----------------------------------------------------------------------------
; write contiguous bytes to a range of addresses
; -----------------------------------------------------------------------------
writeCommand:
lda CURR_ADDR
sta TEMP_ADDR
lda CURR_ADDR + 1
sta TEMP_ADDR + 1
@nextByte
lda #'+'
cmp COMMAND_BUFFER,x
beq @updateCurrent

jsr readHexByte

jsr hexToAcc
sta (TEMP_ADDR)
+inc16 TEMP_ADDR
cpx COMMAND_LEN
bcc @nextByte
jmp commandLoop

@updateCurrent
lda TEMP_ADDR
sta CURR_ADDR
lda TEMP_ADDR + 1
sta CURR_ADDR + 1
jmp commandLoop


; -----------------------------------------------------------------------------
; send bytes to a single address (port)
; -----------------------------------------------------------------------------
sendCommand:
jsr readHexByte
jsr hexToAcc
sta (CURR_ADDR)
cpx COMMAND_LEN
bcc sendCommand
jmp commandLoop
; Troy's HBC-56 - Monitor
;
; Copyright (c) 2022 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;
;

; -----------------------------------------------------------------------------
; write contiguous bytes to a range of addresses
; -----------------------------------------------------------------------------
writeCommand:
lda CURR_ADDR
sta TEMP_ADDR
lda CURR_ADDR + 1
sta TEMP_ADDR + 1
@nextByte
lda #'+'
cmp COMMAND_BUFFER,x
beq @updateCurrent

jsr readHexByte

jsr hexToAcc
sta (TEMP_ADDR)
+inc16 TEMP_ADDR
cpx COMMAND_LEN
bcc @nextByte
jmp commandLoop

@updateCurrent
lda TEMP_ADDR
sta CURR_ADDR
lda TEMP_ADDR + 1
sta CURR_ADDR + 1
jmp commandLoop


; -----------------------------------------------------------------------------
; send bytes to a single address (port)
; -----------------------------------------------------------------------------
sendCommand:
php
sei
sendCommandLoop:
jsr readHexByte
jsr hexToAcc
sta (CURR_ADDR)
cpx COMMAND_LEN
bcc sendCommandLoop
plp
jmp commandLoop
Loading

0 comments on commit c99cf4b

Please sign in to comment.