6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Nov 22, 2024 3:49 pm

All times are UTC




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Fri Apr 01, 2016 7:32 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
I wrote a program today. It isn't quite working yet but it demonstrates an idea which I hope to make practical. In the meantime, perhaps you'll enjoy puzzling it out(*):

Code:
0100 78       .init SEI
0101 A0 64    LDY #100
0103          .outerhi
0103 A2 30    LDX #48
0105 A9 2A    .innerhi LDA #42
0107 20 3B 01 JSR loop5
010A A9 0E    LDA #14
010C 20 74 01 JSR loop15
010F CA       DEX
0110 D0 F3    BNE innerhi
0112 A2 18    LDX #24
0114 A9 2A    .innerlo LDA #42
0116 20 3B 01 JSR loop5
0119 20 3B 01 JSR loop5
011C A9 0E    LDA #14
011E 20 74 01 JSR loop15
0121 20 74 01 JSR loop15
0124 CA       DEX
0125 D0 ED    BNE innerlo
0127 88       DEY
0128 D0 D9    BNE outerhi
012A 58       CLI
012B 60       RTS
012C 4C 00 00 JMP0
012F 4C 00 00 JMP0
0132 4C 00 00 JMP0
0135 4C 00 00 JMP0
0138 26 00    ROL0
013A 38       .go5 SEC
013B E9 01    .loop5 SBC #1
013D 4C 40 01 JMP skip5
0140 EA       .skip5 NOP
0141 D0 F8    BNE loop5
0143 60       RTS
0144 4C 00 00 JMP0
0147 4C 00 00 JMP0
014A 4C 00 00 JMP0
014D 4C 00 00 JMP0
0150 4C 00 00 JMP0
0153 4C 00 00 JMP0
0156 4C 00 00 JMP0
0159 4C 00 00 JMP0
015C 4C 00 00 JMP0
015F 4C 00 00 JMP0
0162 4C 00 00 JMP0
0165 4C 00 00 JMP0
0168 4C 00 00 JMP0
016B 4C 00 00 JMP0
016E 4C 00 00 JMP0
0171 4C 00 00 JMP0
0174 38       .loop15 SEC
0175 B0 00    BCS skip15a
0177 E9 01    .skip15a SBC #1
0179 4C 7C 01 JMP skip15b
017C EA       .skip15b NOP
017D 4C 80 01 JMP skip15c
0180 EA       .skip15c NOP
0181 4C 84 01 JMP skip15d
0184 EA       .skip15d NOP
0185 4C 88 01 JMP skip15e
0188 EA       .skip15e NOP
0189 D0 E9    BNE loop15
018B 60       RTS


In case you speak BBC Basic, here's the source:

Code:
​NEW
AUTO
FOR pass=0 TO 3 STEP 3
P%=&0100
[OPT pass
.init SEI:LDY #100

.outerhi

LDX #48
.innerhi LDA #42:JSR loop5
LDA #14:JSR loop15
DEX:BNE innerhi

LDX #24
.innerlo LDA #42:JSR loop5:JSR loop5
LDA #14:JSR loop15:JSR loop15
DEX:BNE innerlo

DEY:BNE outerhi:CLI:RTS

JMP0:JMP0:JMP0:JMP0:ROL0

.go5 SEC
.loop5 SBC #1:JMP skip5
.skip5 NOP:BNE loop5:RTS

JMP0:JMP0:JMP0:JMP0:JMP0:JMP0:JMP0:JMP0
JMP0:JMP0:JMP0:JMP0:JMP0:JMP0:JMP0:JMP0

.loop15 SEC:BCS skip15a
.skip15a SBC #1:JMP skip15b
.skip15b NOP:JMP skip15c
.skip15c NOP:JMP skip15d
.skip15d NOP:JMP skip15e
.skip15e NOP:BNE loop15
RTS
]
NEXT pass


(It's an unusual kind of program, but it's not an April Fool - this is the whole thing.)

(*) In the interests of not spoiling anyone else's enjoyment, please use rot13.com or otherwise obfuscate your findings.


Top
 Profile  
Reply with quote  
PostPosted: Fri Apr 01, 2016 11:02 pm 
Offline

Joined: Tue Jul 24, 2012 2:27 am
Posts: 679
Jung'f gur vavgvny inyhr bs gur fgnpx cbvagre?

_________________
WFDis Interactive 6502 Disassembler
AcheronVM: A Reconfigurable 16-bit Virtual CPU for the 6502 Microprocessor


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 02, 2016 1:04 am 
Offline
User avatar

Joined: Sun Jun 30, 2013 10:26 pm
Posts: 1949
Location: Sacramento, CA, USA
Juvgr Synzr unf n inyvq dhrfgvba. Jura V frr rkrphgnoyr pbqr pbagnvavat ybbcrq WFEf erfvqvat vafvqr gur fgnpx cntr, V vzzrqvngryl fgneg gb fhfcrpg frys-zbqvslvat pbqr, ohg V arrq gb xabj zber guna V qb nobhg gur Orro'f eha-gvzr raivebazrag.

Mike B.


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 02, 2016 1:23 am 
Offline
User avatar

Joined: Fri Dec 11, 2009 3:50 pm
Posts: 3367
Location: Ontario, Canada
barrym95838 wrote:
rkrphgnoyr pbqr [...] erfvqvat vafvqr gur fgnpx cntr
Somehow I failed to notice this, which is pretty embarrassing. :oops: Luckily, vg gheaf bhg abg gb or cregvarag.

I did PM Ed with a correction to his not-quite-finished code. :mrgreen:
I wrote:
I suspect you've omitted 2 instructions, as shown:
Code:
.innerlo
A9 2A    LDA #42
20 3B 01 JSR loop5
A9 2A    LDA #42 ; <----
20 3B 01 JSR loop5
A9 0E    LDA #14
20 74 01 JSR loop15
A9 2A    LDA #14 ; <----
20 74 01 JSR loop15

_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 02, 2016 9:03 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Thanks for the fix Jeff - this is presently a half-baked program, but I can truthfully call it a proof of concept. I believe it shows I'm on the right track.

Using rot13.com:

Lrf, nf Wrss fnlf, gur fgnpx vf vagraqrq gb or jryy njnl sebz gur pbqr. V purpxrq ba gur Orro, naq gur fgnpx cbvagre ng bar gvzr jnf RQ (nccebcevngryl rabhtu)

Hint 1: V jnfa'g fher jurgure gb chg guvf va uneqjner be fbsgjner fhosbehz

Hint 2: V'z hfvat cntr bar orpnhfr V xabj gurer vf n cntr bar

Hint 3: Gur orro ehaf ng gjb zrtnuregm

Hint 4: Gur ynoryf ner anzrq gb uryc cbeg gur cebtenz gb n znpuvar ehaavat ng bar zrtnuregm


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 02, 2016 8:47 pm 
Offline

Joined: Sun Jul 28, 2013 12:59 am
Posts: 235
Bxnl, fb vg'f tvira gb or n hfrshy cebtenz, vg'f qrcraqrag ba gur
PCH fcrrq, vg ehaf jvgu vagreehcgf ybpxrq bhg (be nz V sbetrggvat
gur frafr bs gur V synt ntnva?), vg ehaf ragveryl jvguva gur
ertvfgre frg, vg qbrf ab boivbhf V/B, vg unf n fbzrjung
bqq-frrzvat fgehpgher jvgu dhvgr n ovg bs cnqqvat, naq vg pbhyq
unir orra va gur uneqjner fhosbehz. Bu, naq gurer'f na FRP
vafgehpgvba orgjrra ".tb5" naq ".ybbc5" gung qbrfa'g frrz gb trg
rkrphgrq sbe fbzr ernfba.

V'z guvaxvat gung guvf vf fbzr fbeg bs fvtany trarengbe gung hfrf
nqqerff yvarf sbe bhgchg. V guvax gung gur arkg fgrc gb svthevat
bhg jung guvf qbrf jbhyq or gb jbex bhg gur rknpg cnggreaf ba gur
nqqerff ohf sbe ".ybbc5" naq "ybbc15". Fbzrguvat qrsvavgryl
srryf bqq nobhg gur WZC / ABC / WZC / ABC frdhraprf gurer.


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 02, 2016 8:50 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
> V'z guvaxvat gung guvf vf fbzr fbeg bs fvtany trarengbe
> gung hfrf nqqerff yvarf sbe bhgchg.

Gung'f vg!


Top
 Profile  
Reply with quote  
PostPosted: Sat Apr 02, 2016 11:52 pm 
Offline
User avatar

Joined: Thu May 28, 2009 9:46 pm
Posts: 8505
Location: Midwestern USA
BigEd wrote:
(*) In the interests of not spoiling anyone else's enjoyment, please use rot13.com or otherwise obfuscate your findings.

V sbetbg nyy nobhg ebg13.pbz. Jura V svefg ernq nyy guvf tvoorevfu V gubhtu obgu rlrf unq tbar fbhgu ba zr! :D

_________________
x86?  We ain't got no x86.  We don't NEED no stinking x86!


Top
 Profile  
Reply with quote  
PostPosted: Mon Apr 11, 2016 6:15 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8543
Location: Southern California
Any updates?

_________________
http://WilsonMinesCo.com/ lots of 6502 resources
The "second front page" is http://wilsonminesco.com/links.html .
What's an additional VIA among friends, anyhow?


Top
 Profile  
Reply with quote  
PostPosted: Tue Apr 12, 2016 5:56 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
> Any updates?
Sorry, I put this down and haven't yet picked it up. Give me another 10 days then nag me again!


Top
 Profile  
Reply with quote  
PostPosted: Sat May 28, 2016 8:14 pm 
Offline
User avatar

Joined: Mon May 04, 2015 10:55 am
Posts: 26
Location: UK
BigEd wrote:
> V'z guvaxvat gung guvf vf fbzr fbeg bs fvtany trarengbe
> gung hfrf nqqerff yvarf sbe bhgchg.

Gung'f vg!


Guvf vf n irel vagevthvat pbaprcg. V npghnyyl hfrq fbzrguvat fvzvyne jura V jnf grfgvat zl FOP, gb oyvax na YRQ sebz bar bs gur nqqerff yvarf (jvgu n ohssre, bs pbhefr).

Qb lbh unir n fcrpvsvp hfr sbe guvf va zvaq, be vf vg whfg n cebbs-bs-pbaprcg?


Top
 Profile  
Reply with quote  
PostPosted: Sat May 28, 2016 9:45 pm 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Zl vqrn jnf gb genafzvg na nzcyvghqr zbqhyngrq enqvb fvtany - ybat jnir, nobhg gjb uhaqerq xvyburegm - juvpu jbhyq nyybj fbzrbar jvgu n fvzcyr fvatyr obneq pbzchgre naq ab crevcurenyf gb qhzc gurve ernq bayl zrzbel - qrpbqvat gur nhqvb jbhyq or na rkrepvfr sbe gur yvfgrare. Vagrerfgvat vqrn gb hfr n yvtug rzvggvat qvbqr sbe gung xvaq bs checbfr. Vg unf orra qbar orsber jvgu nhqvb - naq vaqrrq, vs lbh ubbx hc n fcrnxre gb gur nqqerff yvarf, vg jvyy tvir lbh gur nhqvb pbeerfcbaqvat gb gur nzcyvghqr zbqhyngvba orpnhfr vg npgf nf n ybj cnff svygre gb gur enqvb serdhrapl...


Top
 Profile  
Reply with quote  
PostPosted: Sat Feb 11, 2017 8:28 am 
Offline
User avatar

Joined: Thu Dec 11, 2008 1:28 pm
Posts: 10985
Location: England
Here's the follow-up post where I explain my thinking and describe my results:
viewtopic.php?f=1&t=4411


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

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 21 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: