home *** CD-ROM | disk | FTP | other *** search
/ Transactor / Transactor_23_1988_Transactor_Publishing.d64 / algo6510.2 (.txt) < prev    next >
Commodore BASIC  |  2023-02-26  |  1KB  |  42 lines

  1. 100 rem --------- program 2 -----------
  2. 110 rem
  3. 120 n=56: dim op$(n),op(n)
  4. 130 for i=1 to n: read op$(i): next
  5. 140 data adc,and,asl,bcc,bcs,beq,bit,bmi,bne,bpl,brk,bvc,bvs,clc,cld,cli,clv
  6. 150 data cmp,cpx,cpy,dec,dex,dey,eor,inc,inx,iny,jmp,jsr,lda,ldx,ldy,lsr,nop
  7. 160 data ora,pha,php,pla,plp,rol,ror,rti,rts,sbc,sec,sed,sei,sta,stx,sty,tax
  8. 170 data tay,tsx,txa,txs,tya
  9. 180 rem
  10. 190 m=25: dim t1(m),t2(m),t3(m)
  11. 200 for i=0 to m: read t1(i): next
  12. 210 data 6,7,8,9,10,0,0,0,11,12,0,13,0,14,1,2,0,3,4,5,0,0,0,0,0,0
  13. 220 for i=0 to m: read t2(i): next
  14. 230 data 10,11,12,13,14,0,0,15,16,0,0,17,18,1,2,3,0,4,5,6,0,7,0,8,9,0
  15. 240 for i=0 to m: read t3(i): next
  16. 250 data 4,0,5,6,7,0,0,0,8,0,9,10,0,0,0,11,12,13,14,15,0,1,0,2,3,0
  17. 260 rem
  18. 270 rem --- execute the algo
  19. 280 rem
  20. 290 for i=1 to n: op$=op$(i)
  21. 300 a=asc(left$(op$,1))-asc("a")
  22. 310 a=t1(a): if a=0 goto 1000
  23. 320 b=asc(mid$(op$,2,1))-asc("a")
  24. 330 b=t2(b): if b=0 goto 1000
  25. 340 c=asc(right$(op$,1))-asc("a")
  26. 350 c=t3(c): if c=0 goto 1000
  27. 360 x=(a*1 + b*16 + c*4) and 255
  28. 370 op(i) = x: next
  29. 380 rem
  30. 390 rem --- print results
  31. 400 rem
  32. 410 print"[147]       6510 [205]nemonic [193]lgo"
  33. 420 print
  34. 430 for i=1 to 54 step 3
  35. 440 for j=i to i+2
  36. 450 print op$(j)"="right$("  "+str$(op(j)),3)"  ";
  37. 460 next: print: next
  38. 470 print op$(55)"="right$("  "+str$(op(55)),3)"  ";
  39. 480 print op$(56)"="right$("  "+str$(op(56)),3)
  40. 490 end
  41. 1000 rem --- invalid mnemonic
  42.