6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon May 20, 2024 7:43 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Fri Dec 16, 2022 8:07 am 
Offline

Joined: Tue Apr 20, 2010 4:02 pm
Posts: 31
Hi,

before I embark on the mission of writing this incredible spaghetti code myself :-), has anyone perhaps implemented or stumbled upon some 6502 code that performs line clipping (supporting negative coordinates, if possible)?

Thank you,

Rudla


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 16, 2022 8:42 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10802
Location: England
Perhaps have a look at this disassembly of Acorn's MOS:
https://tobylobster.github.io/mos/mos/S-s8.html#SP22

And perhaps look at Elite's code in this disassembly and write-up:
https://www.bbcelite.com/deep_dives/bre ... rithm.html
https://www.bbcelite.com/deep_dives/line-clipping.html


Top
 Profile  
Reply with quote  
PostPosted: Fri Dec 16, 2022 1:30 pm 
Offline
User avatar

Joined: Wed Feb 14, 2018 2:33 pm
Posts: 1414
Location: Scotland
rudla.kudla wrote:
Hi,

before I embark on the mission of writing this incredible spaghetti code myself :-), has anyone perhaps implemented or stumbled upon some 6502 code that performs line clipping (supporting negative coordinates, if possible)?

Thank you,

Rudla


Look for the "Cohen Sutherland" algorithm. It's quite generic and while very possible to optimise for certain hardwares it will get you off to a good start especially if you already have a good line drawer like Bressenham.

https://en.wikipedia.org/wiki/Cohen%E2%80%93Sutherland_algorithm

-Gordon

_________________
--
Gordon Henderson.
See my Ruby 6502 and 65816 SBC projects here: https://projects.drogon.net/ruby/


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

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