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

  1. 100 rem --------- program 3 -----------
  2. 110 rem
  3. 120 rem pal64 format source
  4. 130 rem
  5. 140 open 2,8,1,"0:output"
  6. 150 sys700
  7. 160 .opt o2
  8. 170 *=$c000
  9. 180 jmp begin
  10. 190 ;
  11. 200 ; table of mnemonics
  12. 210 ;
  13. 225 mnem  .asc "adcandaslbccbcsbeqbitbmibnebplbrk"
  14. 230 .asc "bvcbvsclccldcliclvcmpcpxcpydecdex"
  15. 235 .asc "deyeorincinxinyjmpjsrldaldxldylsr"
  16. 240 .asc "noporaphaphpplaplprolrorrtirtssbc"
  17. 250 .asc "secsedseistastxstytaxtaytsxtxatxstya"
  18. 260 ;
  19. 270 ; resulting op-codes
  20. 280 ;
  21. 290 ops *=*+56
  22. 300 ;
  23. 310 ; tables for transformations
  24. 320 ;
  25. 330 table1 .byte 6,7,8,9,10,0,0,0,11,12,0,13,0
  26. 335 .byte 14,1,2,0,3,4,5,0,0,0,0,0,0
  27. 340 table2 .byte 10,11,12,13,14,0,0,15,16,0,0,17,18,1
  28. 345 .byte 2,3,0,4,5,6,0,7,0,8,9,0
  29. 350 table3 .byte 4,0,5,6,7,0,0,0,8,0,9,10,0
  30. 355 .byte 0,0,11,12,13,14,15,0,1,0,2,3,0
  31. 360 ;
  32. 370 ; execute the al(NULL)
  33. 380 ;
  34. 390 begin ldy #0: sty opsx
  35. 400 loop1 lda mnem+0,y: sec: sbc asca: tax: lda table1,x: beq error
  36. 410 sta temp ; (left-)*1
  37. 420 lda mnem+1,y: sec: sbc asca: tax: lda table2,x: beq error
  38. 430 lsr: lsr: lsr: lsr: clc: adc temp: sta temp ; +(mid-)*16
  39. 440 lda mnem+2,y: sec: sbc asca: tax: lda table3,x: beq error
  40. 450 lsr: lsr: clc: adc temp ; +(right-)*4
  41. 460 ldx opsx: sta ops,x: inx: stx opsx
  42. 470 iny: iny: iny: cpy #168: bne loop1
  43. 480 beq cont1
  44. 490 ;
  45. 500 ; error routine
  46. 510 ;
  47. 520 error = *
  48. 530 ;
  49. 540 ; print results/process code byte
  50. 550 ;
  51. 560 cont1 = *
  52. 570 ;
  53. 580 ; data areas
  54. 590 ;
  55. 600 opsx .byte 0
  56. 610 asca .byte "a"
  57. 620 temp .byte 0
  58. 630 .end
  59.