Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update mos_api.asm for non-blocking mos_ugetc #67

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/mos_api.asm
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
; 14/04/2023: Added ffs_api_fopen, ffs_api_fclose, ffs_api_stat, ffs_api_fread, ffs_api_fwrite, ffs_api_feof, ffs_api_flseek
; 15/04/2023: Added mos_api_getfil, mos_api_fread, mos_api_fwrite and mos_api_flseek
; 30/05/2023: Fixed mos_api_fgetc to set carry if at end of file
; 02/06/2023: [LuzrBum] redirected mos_ugetc to UART1_serial_RX, to achieve a non-blocking UART1 read. Breaks backwards compatibility for apps that require block

.ASSUME ADL = 1

Expand Down Expand Up @@ -65,6 +66,7 @@

XREF UART1_serial_GETCH ; In serial.asm
XREF UART1_serial_PUTCH
XREF UART1_serial_RX ; For non-blocking read

XREF _keyascii ; In globals.asm
XREF _keycount
Expand Down Expand Up @@ -647,13 +649,13 @@ mos_api_uopen: LEA HL, IX + 0 ; HLU: Pointer to struct
;
mos_api_uclose: JP _close_UART1

; Get a character from UART1
; Get a character from UART1 (non-blocking)
; Returns:
; A: Character read
; F: C if successful
; F: NC if the UART is not open
;
mos_api_ugetc JP UART1_serial_GETCH
mos_api_ugetc JP UART1_serial_RX ; For non-blocking read - original value was UART1_serial_GETCH

; Write a character to UART1
; C: Character to write
Expand Down Expand Up @@ -939,4 +941,4 @@ ffs_api_getfree:
ffs_api_getlabel:
ffs_api_setlabel:
ffs_api_setcp:
RET
RET