6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Apr 29, 2024 7:42 am

All times are UTC




Post new topic Reply to topic  [ 79 posts ]  Go to page Previous  1, 2, 3, 4, 5, 6
Author Message
PostPosted: Sat May 21, 2016 10:08 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1927
Location: Sacramento, CA, USA
Bregalad wrote:
... Now everything is pretty much completed BUT my instruction jump stable still needs to be 2 bytes wide because the critical part (between .block "interpreter_critical" and .endb in the source code) is still 277 bytes long. It needs to reach 255 bytes or less ...

Could you pick one or two instructions, and just put a three-byte "spring-board" jump for each of their handlers inside the critical section, with the handlers themselves placed elsewhere? Getting that table shrunk down should easily pay for that tiny penalty.

Mike B.


Top
 Profile  
Reply with quote  
PostPosted: Sun May 22, 2016 12:27 pm 
Offline

Joined: Sat Mar 27, 2010 7:50 pm
Posts: 149
Location: Chexbres, VD, Switzerland
Yeah, pretty much what I had in mind, but it's hard to describe (in english). Also, if I take the longest instructions out, and replace them with JMP instructions, it'll pay off better as it'll reduce the size of the "critical" section down more, so I'll have to waste less JMP instructions on that. (Hopefully just 2-3).


Top
 Profile  
Reply with quote  
PostPosted: Mon May 23, 2016 10:01 pm 
Offline

Joined: Sat Mar 27, 2010 7:50 pm
Posts: 149
Location: Chexbres, VD, Switzerland
So I updated the thing again (links are the same). Now the instruction set is considered definite, there is two extra instructions added in at last minute, which prove to be EXTREMELY useful. They are equivalent to LDA and STA zero page, but are called LDZP and STZP. So finally it's possible to use zero-page fixed locations without reserving a register for this purpose and waste instructions to load this register to point to the desired operation, which was the main cause of code size bloat for this bytecode.

The interpreter is changed a lot. Code stored in VROM is implemented and confirmed to work (a few fixes were rerquired). I'm back to the old way of NOT doing a "jsr Dispatch", because I counted that this saved barely more bytes than it wasted.

The jump table is finally made one byte, the critical section's size is reduced to 254 (!) bytes, and only one instruction stays outside of this section and is replaced with a "JMP" instruction to it, to compensate the jump table not being able to jump outside the critical section.

Not only that, but the critical section just happens to start exactly 257 bytes ahead the start of the interpreter, so everything is pretty much set in stone... add or remove any single byte and the whole thing could fail.

The documentation is updated as well.


Top
 Profile  
Reply with quote  
PostPosted: Tue Jan 19, 2021 7:38 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1927
Location: Sacramento, CA, USA
[bump] I stumbled across this while I was poking around. I must say that I thoroughly enjoyed revisiting this thread from start to finish, and I wanted to ask Bregalad if any progress or updates can be offered regarding the custom VM or the game that inspired its conception. [/bump]

_________________
Got a kilobyte lying fallow in your 65xx's memory map? Sprinkle some VTL02C on it and see how it grows on you!

Mike B. (about me) (learning how to github)


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

All times are UTC


Who is online

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