6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Sat May 18, 2024 2:09 am

All times are UTC




Post new topic Reply to topic  [ 19 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sat Sep 11, 2021 3:43 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1930
Location: Sacramento, CA, USA
In VTL02 i needed to "move" sections of code in the editor, but I knew that the offset would be less than 256 bytes, so I put the offset in Y and zero in X to allow me to use the same ZP pointer for source and destination:
Code:
...
      lda   (ptr),y
      sta   (ptr,x)
...
I had to leave X and Y alone during the move and update ptr with each byte, so this is not as fast as the two pointer version, but the code is smaller, and that was my primary goal.
I could have coded sta (ptr) and used X for something else but I wanted to allow the 6502 and 6510 to play as well.

_________________
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  
PostPosted: Sat Sep 11, 2021 7:31 pm 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1930
Location: Sacramento, CA, USA
commodorejohn wrote:
In NMOS-ville, you can also leave the LSB of the pointer in memory zeroed, load the real LSB in Y, and do STA ($02),Y instead.

That can also be a useful strategy in CMOS-ville:
Code:
DPL     =   $fd
DPH     =   $fe
primm:
      ply               ; get low part of (string address-1)
      plx               ; get high part of (string address-1)
      stx   DPH
      stz   DPL
      bra   primm3
primm2:
      jsr   COUT        ; output a string char
primm3:
      iny               ; advance the string pointer
      bne   primm4
      inc   DPH
      inx
primm4:
      lda   (DPL),y     ; get string char
      bne   primm2      ; output and continue if not NUL
      phx
      phy
      rts               ; proceed at code following the NUL

_________________
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  
PostPosted: Mon Mar 07, 2022 2:36 pm 
Offline

Joined: Mon Mar 07, 2022 2:31 pm
Posts: 1
J64C wrote:
Thanks guys! 0x92 sta(zpg) worked well.

Currently writing an emulator for my hardware. I am using the mos6502 framework here - https://github.com/gianlucag/mos6502

Unfortunately it only supports 6502 and not W65C02. But I managed to wrangle the 0x92 opcode to it and it seems to be performing as intended. So all is going well.

I might look at adding the other W65C02 opcodes to it at a later date.

Many thanks once again. You guys are legendary!


Hello, I'm the author of the mos6502 emulator. I'd really like to add the W65C02 support to the emulator, could you please send me the changes you made or just create a pull request straight away from GitHub?
Thank you!


Top
 Profile  
Reply with quote  
PostPosted: Mon Mar 07, 2022 3:56 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10800
Location: England
(Welcome, Gianluca!)


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

All times are UTC


Who is online

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