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

Create a serial port in the Vectrex address space #50

Open
phillipeaton opened this issue Apr 15, 2020 · 3 comments
Open

Create a serial port in the Vectrex address space #50

phillipeaton opened this issue Apr 15, 2020 · 3 comments
Labels
feature New feature request

Comments

@phillipeaton
Copy link

phillipeaton commented Apr 15, 2020

A serial port connected to a terminal emulator on a PC is handy for debugging and allows interactive environments like Forth or BASIC to run.

I'd like a serial port to run something similar to my serial port handler that works on a VecFever (code below is in Forth):

HEX

\ VecFever UART serial port interface. VecFever provides buffering (256 bytes each way?)
7FFB EQU v4eTxStatReg \ Read, negative if transmit buffer is in use, positive otherwise
7FFB EQU v4eTxByteReg \ Write
7FFC EQU v4eRxStatReg \ Read, zero if no data received, otherwise != 0
7FFD EQU v4eRxByteReg \ Read, upon reading, 7FFC is automatically cleared
7FFE EQU v4eLEDReg \ LED Register, probably read/write?

CODE KEY? \ -- f return true if char waiting
6 # ( D) PSHS, CLRA, v4eRxStatReg LDB,
NE IF, -1 # LDB, THEN, NEXT ;C

CODE KEY \ -- c get char from serial port
6 # ( D) PSHS, BEGIN, v4eRxStatReg LDB, NE UNTIL,
v4eRxByteReg LDB, CLRA, NEXT ;C

CODE EMIT \ c -- output character to serial port
BEGIN, v4eTxStatReg LDA, MI UNTIL,
v4eTxByteReg STB, 6 # ( D) PULS, NEXT ;C

Describe alternatives you've considered
Other alternatives are available, but a VEXTREME is cheaper than the other alternatives and/or potentially provides a lot more functionally.

@phillipeaton phillipeaton added the feature New feature request label Apr 15, 2020
@gtoal
Copy link

gtoal commented Apr 17, 2020

This - and any other virtual devices added by the vextreme - might be placed in the C000-C7FF space so as not to interfere with the rom space (0000-BFFF). Although I'm not sure why a virtual device interface is better than the existing RPC mechanism for calls to the Vextreme?

@phillipeaton
Copy link
Author

phillipeaton commented Apr 17, 2020 via email

@gtoal
Copy link

gtoal commented Apr 17, 2020

All I know about RPC is that it can mean Remote Procedure Call. How would I use that in place of a serial terminal? Can you point me to the code?

It's not in place of a serial terminal - it's in place of a memory mapped device register.

here's the led test which sends commands to the vextreme arm by rpc - look for rpcfn near the end of the file:
https://github.com/technobly/vextreme/blob/master/code/led/led-test1/led-test1.asm

the implemented calls are in doHandleEvent, in
https://github.com/technobly/VEXTREME/blob/master/code/stm32/main.c#L527

I would suggest adding serial get/put/test in there... maybe also have it support an interrupt-driven buffer?

Interestingly, it appears your request is already half implemented!

// Writes to 0x0000 will have the data byte immediately forwarded to the serial TX pin for debugging
// ------------------------------------------------------------------------
// Is it a write to addr #$0000 = serial port addr
// TODO: avoid addr 0 because Polar Rescue writes there occassionally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature request
Projects
None yet
Development

No branches or pull requests

2 participants