Skip to content

Commit

Permalink
Fixes for UART version of BASIC
Browse files Browse the repository at this point in the history
  • Loading branch information
visrealm committed Dec 18, 2023
1 parent 79dca01 commit cd88f26
Show file tree
Hide file tree
Showing 13 changed files with 167 additions and 140 deletions.
7 changes: 7 additions & 0 deletions code/6502/basic/basic_hbc56_core.asm
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ LOAD_BYTE = HBC56_USER_ZP_START + 7
IRQ_vec = VEC_SV+2 ; IRQ code vector
NMI_vec = IRQ_vec+$0A ; NMI code vector

FG = TMS_DK_BLUE
BG = TMS_WHITE
BORDER = TMS_DK_BLUE

; -----------------------------------------------------------------------------
; main entry point
; -----------------------------------------------------------------------------
hbc56Main:
RES_vec:
!ifdef HAVE_TMS9918 {
+tmsColorFgBg FG, BG
sta BASIC_COLOR
}

jsr hbc56SetupDisplay

; copy I/O vectors
Expand Down
49 changes: 26 additions & 23 deletions code/6502/basic/basic_uart.asm
Original file line number Diff line number Diff line change
@@ -1,23 +1,26 @@
; Troy's HBC-56 - BASIC
;
; Copyright (c) 2021 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;


!src "basic_hbc56_core.asm" ; core basic

!src "drivers/input_uart.asm" ; input routines
!src "drivers/output_uart.asm" ; output routines


; -----------------------------------------------------------------------------
; metadata for the HBC-56 kernel
; -----------------------------------------------------------------------------
hbc56Meta:
+setHbcMetaTitle "HBC-56 BASIC"
+setHbcMetaNoWait
rts
; Troy's HBC-56 - BASIC
;
; Copyright (c) 2021 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;


!src "basic_hbc56_core.asm" ; core basic

!src "drivers/input_uart.asm" ; input routines
!src "drivers/output_uart.asm" ; output routines


; -----------------------------------------------------------------------------
; metadata for the HBC-56 kernel
; -----------------------------------------------------------------------------
hbc56Meta:
+setHbcMetaTitle "HBC-56 BASIC"
+setHbcMetaNoWait
rts


!src "functions/basic_functions.asm" ; custom functions
4 changes: 0 additions & 4 deletions code/6502/basic/drivers/output_tms9918.asm
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
; https://github.com/visrealm/hbc-56
;

FG = TMS_DK_BLUE
BG = TMS_WHITE
BORDER = TMS_DK_BLUE

; -----------------------------------------------------------------------------
; hbc56SetupDisplay - Setup the display (TMS9918)
; -----------------------------------------------------------------------------
Expand Down
55 changes: 27 additions & 28 deletions code/6502/basic/drivers/output_uart.asm
Original file line number Diff line number Diff line change
@@ -1,28 +1,27 @@
; Troy's HBC-56 - BASIC - Output (UART)
;
; Copyright (c) 2021 Troy Schrapel
;
; This code is licensed under the MIT license
;
; https://github.com/visrealm/hbc-56
;

; -----------------------------------------------------------------------------
; hbc56SetupDisplay - Setup the display (UART)
; -----------------------------------------------------------------------------
hbc56SetupDisplay:
sei
jsr uartInit
+tmsDisableInterrupts
+setIntHandler uartIrq
rts

; -----------------------------------------------------------------------------
; hbc56Out - EhBASIC output subroutine (for HBC-56 TMS9918)
; -----------------------------------------------------------------------------
; Inputs: A - ASCII character (or code) to output
; Outputs: A - must be maintained
; -----------------------------------------------------------------------------
hbc56Out:
jmp uartOut

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

; -----------------------------------------------------------------------------
; hbc56SetupDisplay - Setup the display (UART)
; -----------------------------------------------------------------------------
hbc56SetupDisplay:
sei
jsr uartInit
cli
rts

; -----------------------------------------------------------------------------
; hbc56Out - EhBASIC output subroutine (for HBC-56 TMS9918)
; -----------------------------------------------------------------------------
; Inputs: A - ASCII character (or code) to output
; Outputs: A - must be maintained
; -----------------------------------------------------------------------------
hbc56Out:
jmp uartOut

1 change: 1 addition & 0 deletions code/6502/basic/functions/basic_functions.asm
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ basicDisplay:
asl
tax
jsr doMode
+tmsEnableOutput

lda BASIC_COLOR
jsr tmsInitColorTable
Expand Down
4 changes: 3 additions & 1 deletion code/6502/kernel/interrupts.asm
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,8 @@ hbc56Tms9918Int:

@endConsoleCallback

}

.nullCallbackFunction:
rts
}

10 changes: 9 additions & 1 deletion code/6502/kernel/kernel.asm
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,15 @@ kernelMain:
@noLcd3:
}
cli
jsr kbWaitForScancode
-
lda NES1_IO_ADDR
cmp #$ff
bne .afterInput
lda NES2_IO_ADDR
cmp #$ff
bne .afterInput
jsr kbCheckForScancode
beq -
}

.afterInput
Expand Down
Binary file modified code/6502/kernel/kernel.o
Binary file not shown.
Loading

0 comments on commit cd88f26

Please sign in to comment.