6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Thu Nov 21, 2024 1:37 pm

All times are UTC




Post new topic Reply to topic  [ 57 posts ]  Go to page Previous  1, 2, 3, 4
Author Message
PostPosted: Sun Jul 02, 2017 7:14 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Surely Klaus, if the interrupt service routine only needs to accept a character and put it in a buffer, that's enough cycles to deal with an incoming character. The time that the application needs to process the character isn't part of the equation - provided there are gaps in the incoming, or some flow control.

(115200 is still impressively fast, mind, but it doesn't seem such a miracle)

(My Compukit ran a Microsoft Basic, and did save and load by spooling to/from the cassette. Clearly no flow control. So it had an option to put a number of NUL characters in with each end of line, which gave the interpreter time to deal with the line just terminated. A sort of open-loop rate adjustment.)


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 02, 2017 9:45 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
I am not saying that it doesn't work. I am just saying that it is completely out of balance and it shows an exaggerated expectation level (similar to the crappy zeropage usage of EhBASIC).

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 02, 2017 9:56 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
For sure, it's a rather high rate. But when you're loading code, faster seems better - after all, you'd like to approximate disk speeds. The 2MHz Acorn BBC Micro can only support 19200 serial using the OS, but there's a bit-banged loader which runs at 115200 (simplex) and that's both impressive and convenient.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 02, 2017 10:24 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
Yes, a sequential binary loader would work at 115200 baud for a 2 MHz machine but directly to memory without buffering. Buffering actually adds overhead but cannot be avoided, if flow control is needed. The expectation that buffering increases performance in all cases is false. The more frequent you have to tell the other side to shut up the more overhead is generated by buffering. It is better to have a reasonable baudrate even with buffering and your application does not come to a screeching halt every time a series of characters is received through the USART.

19200 baud at 2 MHz seems very reasonable. On my 2 MHz rated emulator I use 38400 baud but the buffering is done on the host CPU at 16MHz with mostly 1 cycle instructions.

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 02, 2017 10:47 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
I have a recollection that one of the findings was that different USB-to-serial adaptors, and serial ports, had different reactions to the RTS/CTS flow control. In particular, some were slow to stop when told to stop. In a case like that, buffering makes the difference between success and failure.


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 02, 2017 11:19 am 
Offline

Joined: Sat Jul 28, 2012 11:41 am
Posts: 442
Location: Wiesbaden, Germany
Even when connected to a genuine USART with FIFO you must be prepared to receive the remainder of the FIFO after telling the other side to stop. Some margin is always needed. Of course the buffer in a USB adapter may be bigger...

_________________
6502 sources on GitHub: https://github.com/Klaus2m5


Top
 Profile  
Reply with quote  
PostPosted: Sun Jul 02, 2017 2:57 pm 
Offline

Joined: Mon Jan 09, 2017 3:50 pm
Posts: 39
BigEd has a point that a lot of modern FTDI-style interfaces don't stop the flow immediately on RTS deassertion. With an autoflow control capable 16C550, I have the watermark at 50% (8 characters). The code that I put together yesterday uses a 1/3-2/3 low/high watermark.

Proper design is key here. The Z80 RC2014 folks have seen that the use of a buffer alone doesn't save the day if it's not properly done e.g. the original BIOS (Grant's) buffer/RTS implementation still results in character overruns (with a 7+MHz CPU at 115200 baud). A couple of us on that community implemented page-size buffers (255-char) which seem to be pretty rock solid so far (knock on wood).

The use of the 1MHz CPU is to test how well this works. With a logic probe on the RTS line, I can see RTS being toggled quite a fair bit especially with BASIC (both Enhanced and MS).

I'm waiting for my 6551 RC2014 board to come back from the fab and will build a buffered console BIOS for that. It'll be interesting to see if my buffer size will work without a preceding 16-byte h/w fifo.

_________________
Blog: http://ancientcomputing.blogspot.com/
GitHub: https://github.com/ancientcomputing


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 26, 2018 6:12 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
I'm a 6502 newbie. I'm bring up a new 6502 SBC that's also related to RC2014. It is a RAM-only design that uses a serial port to load a small bootstrap that is basically an Intel Hex loader. The bootstrap loader is working and I am able to load and execute a small program, so now I like to try EhBasic.

My hardware has a simple serial port of my own design. Its interrupt function is not checked out and not turned on right now. I have no other interrupting devices. I have 64K of RAM, So is the hardware ready for EhBasic? I downloaded the patched 2.22 version from here:
https://github.com/Klaus2m5/6502_EhBASI ... er/patched

I'm using ca65 assembler. Assembling the patched V2.22 with the "labels_without_colons" feature enabled, it still have a few errors. Hopefully I can fix them by looking up the ca65 manual. My bigger question is what routines I need to replace with my custom serial I/O driver? and can I run EhBasic without interrupts?
Bill


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 26, 2018 7:14 pm 
Offline

Joined: Mon May 21, 2018 8:09 pm
Posts: 1462
You need to customise ACIAin and ACIAout in min_mon.asm to match your console hardware (serial port). If they don't need interrupts to work, then neither does EhBASIC.


Top
 Profile  
Reply with quote  
PostPosted: Wed Dec 26, 2018 11:50 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
Thanks for the tips. I didn't think of looking into min_mon.asm.

After replacing the ACIAin and ACIAout with my serial drivers and correcting a few assembly syntax that ca65 didn't like, I was able to assemble, load and run it. I need to read more about cl65 directives so I can link min_mon to the correct block of memory, but it works well enough that I can load the ASCII Mandelbrot benchmark and run it. My SBC CPU clock is 3.68MHz and the benchmark took 5 minutes and 55 seconds to run. I believe that's the correct time because Martin_H reported 21 minutes and 48 seconds on a 1MHz 6502.
viewtopic.php?f=5&t=4354&hilit=mandelbrot

Bill


Code:
6502 EhBASIC [C]old/[W]arm ?

Memory size ?

48383 Bytes free

Enhanced BASIC 2.22p4


Ready
10 MAXITER=20
20 LET C$=" .,'~!^:;[/<&?oxOX#  "
30 FOR Y=-39 TO 39
40 FOR X=-39 TO 39
50 CREAL=X/20
70 CIMAG=Y/20
80 ZREAL = CREAL
90 ZIMAG = CIMAG
95 COUNT = 1
100 ZM = ZREAL*ZREAL
105 ZN = ZIMAG*ZIMAG
107 ZL = ZM+ZN
110 IF ZL>4 THEN GOTO 170
120 ZR2=ZM-ZN+CREAL
130 ZIMAG=ZREAL*ZIMAG*2+CIMAG
140 ZREAL=ZR2
150 COUNT=COUNT+1
160 IF COUNT<MAXITER THEN GOTO 100
170 PRINT MID$(C$,1+COUNT,1);
180 NEXT X
185 PRINT ""
190 NEXT Y
200 END
RUN
...............................,,,,,,,,,,,,,,,,,...............................
...........................,,,,,,,,,,,,,,,,,,,,,,,,,...........................
........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,........................
......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................
....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................
..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,~~..................
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,';~~'.................
................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~''~................
..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~''~',,..............
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~~''~',,,,.............
............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'^~~~''~',,,,,,............
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'!~~~''!'',,,,,,,...........
..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~!~~!'';'',,,,,,,,,..........
.........''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,''^!~~:~~^!',,,,,,,,,,,.........
........''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~:!~~^~~!^'',,,,,,,,,,,,........
........''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,'':!!~~^~~^!'',,,,,,,,,,,,,........
.......!^~''''''',,,,,,,,,,,,,,,,,,,,,,,,,''~[!!~!;~~^!'',,,,,,,,,,,,,,,.......
......''!:~''''''''',,,,,,,,,,,,,,,,,,,'''~//!!!!:~~^:~'',,,,,,,,,,,,,,,,......
.....'''^!:~~'''''''''',,,,,,,,,,,,,''''~<;^!!!;:~~^!;'',,,,,,,,,,,,,,,,,,.....
.....''''^!:~~~''''''''''''''''''''''~~ : :!!!#:!~;!:''',,,,,,,,,,,,,,,,,,.....
....''''''^![!~~~~'''''''''''''''~~~~?[ &&::;/:^!:O!~'',,,,,,,,,,,,,,,,,,,,....
....''''''';![!~~~~~~~~~~~~~~~~~~~~/x       ?; /:/ &''',,,,,,,,,,,,,,,,,,,,....
...,'''''''':![^~~~~~~~~~~~~~~~~! O         <  :?<[~''',,,,,,,,,,,,,,,,,,,,,...
...,''''''''<:!<^!~~~~~~~~~~~~!:             [x?X^ '''',,,,,,,,,,,,,,,,,,,,,...
..,,,''''''''<:!?^!~~~~~~~~~!^;                 /[&''',,,,,,,,,,,,,,,,,,,,,,,..
..,,,''''''''<::!?;^!!~~~~!!^^                  /:^''',,,,,,,,,,,,,,,,,,,,,,,..
..,,,''''''''':::! /^^^!!!^^^[                  [:;''',,,,,,,,,,,,,,,,,,,,,,,..
.,,,''''''''''!: :: ?;^^^^^:/                    : ~''',,,,,,,,,,,,,,,,,,,,,,,.
.,,,''''''''''!x[ :/<<[;;;;&                      : ~'',,,,,,,,,,,,,,,,,,,,,,,.
.,,,'''''''''''<     <?<//&                       <^</!,,,,,,,,,,,,,,,,,,,,,,,.
.,,'''''''''''!:      xxOx                         [ :^!,,,,,,,,,,,,,,,,,,,,,,.
,,,'''''''''''![                                    &:!~,,,,,,,,,,,,,,,,,,,,,,,
,,'''''''''''~!                                   [ ~~''',,,,,,,,,,,,,,,,,,,,,,
,,''''''''''~!!                                  X/~~'''',,,,,,,,,,,,,,,,,,,,,,
,~~~~~~'~~~~!!                                     ~'''''',,,,,,,,,,,,,,,,,,,,,
,~^~~~~~~~!!!                                       '''''',,,,,,,,,,,,,,,,,,,,,
~~~&^~~~!!!!?                                    &!!''''''',,,,,,,,,,,,,,,,,,,,
~~~^:^^!!!:<                                     <~~''''''',,,,,,,,,,,,,,,,,,,,
!![^&:;;::?                                    [!!~~~'''''',,,,,,,,,,,,,,,,,,,,
                                             &;:^!~~~''''''',,,,,,,,,,,,,,,,,,,
!![^&:;;::?                                    [!!~~~'''''',,,,,,,,,,,,,,,,,,,,
~~~^:^^!!!:<                                     <~~''''''',,,,,,,,,,,,,,,,,,,,
~~~&^~~~!!!!?                                    &!!''''''',,,,,,,,,,,,,,,,,,,,
,~^~~~~~~~!!!                                       '''''',,,,,,,,,,,,,,,,,,,,,
,~~~~~~'~~~~!!                                     ~'''''',,,,,,,,,,,,,,,,,,,,,
,,''''''''''~!!                                  X/~~'''',,,,,,,,,,,,,,,,,,,,,,
,,'''''''''''~!                                   [ ~~''',,,,,,,,,,,,,,,,,,,,,,
,,,'''''''''''![                                    &:!~,,,,,,,,,,,,,,,,,,,,,,,
.,,'''''''''''!:      xxOx                         [ :^!,,,,,,,,,,,,,,,,,,,,,,.
.,,,'''''''''''<     <?<//&                       <^</!,,,,,,,,,,,,,,,,,,,,,,,.
.,,,''''''''''!x[ :/<<[;;;;&                      : ~'',,,,,,,,,,,,,,,,,,,,,,,.
.,,,''''''''''!: :: ?;^^^^^:/                    : ~''',,,,,,,,,,,,,,,,,,,,,,,.
..,,,''''''''':::! /^^^!!!^^^[                  [:;''',,,,,,,,,,,,,,,,,,,,,,,..
..,,,''''''''<::!?;^!!~~~~!!^^                  /:^''',,,,,,,,,,,,,,,,,,,,,,,..
..,,,''''''''<:!?^!~~~~~~~~~!^;                 /[&''',,,,,,,,,,,,,,,,,,,,,,,..
...,''''''''<:!<^!~~~~~~~~~~~~!:             [x?X^ '''',,,,,,,,,,,,,,,,,,,,,...
...,'''''''':![^~~~~~~~~~~~~~~~~! O         <  :?<[~''',,,,,,,,,,,,,,,,,,,,,...
....''''''';![!~~~~~~~~~~~~~~~~~~~~/x       ?; /:/ &''',,,,,,,,,,,,,,,,,,,,....
....''''''^![!~~~~'''''''''''''''~~~~?[ &&::;/:^!:O!~'',,,,,,,,,,,,,,,,,,,,....
.....''''^!:~~~''''''''''''''''''''''~~ : :!!!#:!~;!:''',,,,,,,,,,,,,,,,,,.....
.....'''^!:~~'''''''''',,,,,,,,,,,,,''''~<;^!!!;:~~^!;'',,,,,,,,,,,,,,,,,,.....
......''!:~''''''''',,,,,,,,,,,,,,,,,,,'''~//!!!!:~~^:~'',,,,,,,,,,,,,,,,......
.......!^~''''''',,,,,,,,,,,,,,,,,,,,,,,,,''~[!!~!;~~^!'',,,,,,,,,,,,,,,.......
........''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,'':!!~~^~~^!'',,,,,,,,,,,,,........
........''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~:!~~^~~!^'',,,,,,,,,,,,........
.........''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,''^!~~:~~^!',,,,,,,,,,,.........
..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~!~~!'';'',,,,,,,,,..........
...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'!~~~''!'',,,,,,,...........
............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'^~~~''~',,,,,,............
.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~~''~',,,,.............
..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~''~',,..............
................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,'~~~''~................
.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,';~~'.................
..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,~~..................
....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,....................
......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,......................
........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,........................
...........................,,,,,,,,,,,,,,,,,,,,,,,,,...........................
...............................,,,,,,,,,,,,,,,,,...............................

Ready


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 27, 2018 7:01 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
A good milestone!


Top
 Profile  
Reply with quote  
PostPosted: Thu Dec 27, 2018 2:42 pm 
Offline

Joined: Fri Dec 21, 2018 1:05 am
Posts: 1117
Location: Albuquerque NM USA
Thank you. EhBasic is indeed the goal for the 6502 SBC. The board has a compact flash connector currently not populated and a small prototype area remaining for RTC, I2C controller, etc. The CPLD still have some unused logic gates. Can you suggest another goal?
Bil

Edit: The RAM is 512K. I used 64K of it and another 16K set aside for protected bootstrap monitor, so there are 432K of battery-backed RAM available.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 57 posts ]  Go to page Previous  1, 2, 3, 4

All times are UTC


Who is online

Users browsing this forum: No registered users and 24 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: