6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat Apr 27, 2024 2:54 pm

All times are UTC




Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3
Author Message
PostPosted: Sun Nov 12, 2023 10:38 pm 
Offline
User avatar

Joined: Sun Dec 26, 2021 8:27 pm
Posts: 182
Michael wrote:
Thought you might enjoy this. I was wondering if it's possible to fit an ICSP (In-Circuit-Serial-Programming) program into the 128 bytes of RIOT RAM on modified 65duino hardware. The attached file contains clumsy, untested, and probably buggy code, and while the ICSP process has a few limitations and caveats, I'm kinda' geeked to see what you can fit in 128 bytes.

Regards, Mike


Oh that's amazing and very nicely organized code! And it doesn't look like it's hard to make it fit. The way I've got it setup now it's overflowing by 15 bytes because I reserve some RAM for variables at the bottom and some for stack.. But we don't need the variables to survive a programming cycle anyway and I'm not sure it absolutely needs to be defined as a separate memory segment.

I must try this as soon as I have a chance - it looks like it should work :D Thank you for the help!

Alternatively it's possible to make the "dance" by connecting A10->A12->A14 and A11->A13 ... if you're willing to sacrifice even more ROM space of course. It'll look strange if you dump the ROM but you should still have the "full" 4096 bytes of ROM space.. And of course it'll have to be programmed with that in mind initially.

_________________
---
New new new new new video out! Serial Bootloader for my 65uino
Also, check out: I2C on a 6502 Single Board Computer
and Complete hardware overview of my 6502 SBC R1 :)


Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 13, 2023 12:27 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 586
Location: Michigan, USA
Oh... Let me study that address scheme. If you're going to span several sectors I imagine you would need to do a 'chip erase' instead of a 'sector erase', which would require a 100-msec delay instead of a 25-msec delay. Excerpt;

Code:
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
; ~  wrByte() ~ programming ROM on a modified 65uino design   ~
; ~                                                           ~
; ~  force ROM writes to the decoded $1XXX address space and  ~
; ~  set A12/A13/A14 ROM address lines to 'spoof' the $2AAA   ~
; ~  and $5555 command addresses using RIOT PB0 to drive A12  ~
; ~  and A14 and PB1 to drive A13.  The 4K $0XXX ROM sector   ~
; ~  is used for data and is mapped to $1XXX address space.   ~
; ~                                                           ~
; ~  first entry performs 'erase sector' operation while all  ~
; ~  subsequent entries perform 'program byte' operations.    ~
; ~                                                           ~
; ~      erase sector      erase chip      program byte       ~
; ~     wr($5555,#$AA)   wr($5555,#$AA)   wr($5555,#$AA)      ~
; ~     wr($2AAA,#$55)   wr($2AAA,#$55)   wr($2AAA,#$55)      ~
; ~     wr($5555,#$80)   wr($5555,#$80)   wr($5555,#$A0)      ~
; ~     wr($5555,#$AA)   wr($5555,#$AA)   wr($addr,data)      ~
; ~     wr($2AAA,#$55)   wr($2AAA,#$55)   delay 20 usecs      ~
; ~     wr($addr,#$30)   wr($5555,#$10)                       ~
; ~     delay 25 msecs   delay 100 msecs                      ~
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


Last edited by Michael on Tue Nov 14, 2023 1:46 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 13, 2023 1:43 am 
Offline
User avatar

Joined: Wed Feb 13, 2013 1:38 pm
Posts: 586
Location: Michigan, USA
AndersNielsen wrote:
Alternatively it's possible to make the "dance" by connecting A10->A12->A14 and A11->A13 ... if you're willing to sacrifice even more ROM space of course. It'll look strange if you dump the ROM but you should still have the "full" 4096 bytes of ROM space.. And of course it'll have to be programmed with that in mind initially.

If I understand correctly, this method is actually "genius". It eliminates the need for any RIOT I/O pins (yay!) and should significantly reduce ICSP code 'overhead'. As for programming... all write operations go into ROM address space ($1000..$1FFF) or shadows ($3xxx, $5xxx,...$Fxxx). Write to $1AAA for $2AAA and write to $1555 for $5555. Do not try to write to $2AAA because that address is a shadow of the 4K RIOT address space (decodes to $0AAA).

Cheerful regards, Mike

<added>
BTW, revised code is 99 bytes which is kinda' cool but the fragmented ROM is a bit too exotic for me.

Please don't get carried away trying that code. I exit the serial Rx routine after sampling the middle of the 8th bit and I need to make sure that a little more than another half-bit time elapses before re-entering that routine. Some other subtle considerations, too. I apologize. I was initially just interested to see if example code could fit in 128 bytes. The program will need more work if someone actually wants to try and use it.

Code:
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;   Ander's suggestion to connect A10->A12->A14 and A11->A13
;   reduces 'overhead' considerably by spreading the 4kB ROM
;   address space across 4 ROM sectors ($0XXX, $2XXX, $5XXX,
;   and $7XXX) in a way that allows the ROM to recognize the
;   $2AAA and $5555 command addresses by writing to $1AAA &
;   $1555 in normal decoded ROM address space (or shadows).
;
;    ---ADDR---   A14 A13 A12  A11 A10 A09 A08   -ROM SEES-
;    1000..13FF    0   0   0    0   0   x   x    0000..03FF
;    1400..17FF    1   0   1    0   1   x   x    5400..57FF
;    1800..1BFF    0   1   0    1   0   x   x    2800..2BFF
;    1C00..1FFF    1   1   1    1   1   x   x    7C00..7FFF
;


Last edited by Michael on Thu Nov 30, 2023 8:08 am, edited 2 times in total.

Top
 Profile  
Reply with quote  
PostPosted: Mon Nov 13, 2023 8:45 am 
Offline
User avatar

Joined: Sun Dec 26, 2021 8:27 pm
Posts: 182
Michael wrote:
AndersNielsen wrote:
Alternatively it's possible to make the "dance" by connecting A10->A12->A14 and A11->A13 ... if you're willing to sacrifice even more ROM space of course. It'll look strange if you dump the ROM but you should still have the "full" 4096 bytes of ROM space.. And of course it'll have to be programmed with that in mind initially.

If I understand correctly, this method is actually "genius". It eliminates the need for any RIOT I/O pins (yay!) and should significantly reduce ICSP code 'overhead'. As for programming... all write operations go into ROM address space ($1000..$1FFF) or shadows. Write to $1AAA for $2AAA and write to $1555 for $5555. Do not try to write to $2AAA because that address is a shadow of the 4K RIOT address space (decodes to $0AAA).

Cheerful regards, Mike

<added>
BTW, revised code is 99 bytes which is kinda' cool but the fragmented ROM is a bit too exotic for me.

Please don't get carried away trying that code. I exit the serial Rx routine after sampling the middle of the 8th bit and I need to make sure that a little more than another half-bit time elapses before re-entering that routine. Some other subtle considerations, too. I apologize. I was initially just interested to see if example code could fit in 128 bytes. The program will need more work if someone actually wants to try and use it.

Code:
; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;   Ander's suggestion to connect A10->A12->A14 and A11->A13
;   reduces 'overhead' considerably by spreading the 4kB ROM
;   address space across 4 ROM sectors ($0XXX, $2XXX, $5XXX,
;   and $7XXX) in a way that allows the ROM to recognize the
;   $2AAA and $5555 command addresses by writing to $1AAA &
;   $1555 in the normal decoded ROM address space.
;
;    ---ADDR---   A14 A13 A12  A11 A10 A09 A08   -ROM SEES-
;    1000..13FF    0   0   0    0   0   x   x    0000..03FF
;    1400..17FF    1   0   1    0   1   x   x    5400..57FF
;    1800..1BFF    0   1   0    1   0   x   x    2800..2BFF
;    1C00..1FFF    1   1   1    1   1   x   x    7C00..7FFF
;


Yeah, it's a funky way of doing it and when the 6507 tries to access FFFC (from 1FFC) ROM needs to have the code available there initially. I guess the easy way is to just duplicate the whole ROM 8 times initially - and when doing ICSP erase the four sectors and the 650X will automatically write it in the right sectors. I guess?

It shouldn't be too hard to mod a rev 0 65uino to do it - and for the next revision it wont be too hard to stuff a '00 underneath one of the DIPs.

_________________
---
New new new new new video out! Serial Bootloader for my 65uino
Also, check out: I2C on a 6502 Single Board Computer
and Complete hardware overview of my 6502 SBC R1 :)


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

All times are UTC


Who is online

Users browsing this forum: No registered users and 30 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:  
cron