Advertisement
bladamson

Untitled

Jun 23rd, 2012
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;
  2. ; File generated by cc65 v 2.13.3
  3. ;
  4.     .fopt       compiler,"cc65 v 2.13.3"
  5.     .setcpu     "65816"
  6.     .smart      on
  7.     .autoimport on
  8.     .case       on
  9.     .debuginfo  on
  10.     .importzp   sp, sreg, regsave, regbank, tmp1, ptr1, ptr2
  11.     .macpack    longbranch
  12.     .dbg        file, "test.c", 2398, 1340438471
  13.     .dbg        file, "/usr/lib/cc65/include/stdio.h", 5964, 1340423015
  14.     .dbg        file, "/usr/lib/cc65/include/stddef.h", 2972, 1340423015
  15.     .dbg        file, "/usr/lib/cc65/include/stdarg.h", 2817, 1340423015
  16.     .dbg        file, "/usr/lib/cc65/include/string.h", 4883, 1340423015
  17.     .dbg        file, "/usr/lib/cc65/include/conio.h", 8680, 1340423015
  18.     .dbg        file, "/usr/lib/cc65/include/peekpoke.h", 3108, 1340423015
  19.     .forceimport    __STARTUP__
  20.     .import     _strlen
  21.     .import     _logRegisterA
  22.     .export     _main
  23.  
  24. ; ---------------------------------------------------------------
  25. ; void __near__ main (void)
  26. ; ---------------------------------------------------------------
  27.  
  28. .segment    "CODE"
  29.  
  30. .proc   _main: near
  31.  
  32. .segment    "DATA"
  33.  
  34. L0005:
  35.     .byte   $48,$65,$6C,$6C,$6F,$2C,$20,$77,$6F,$72,$6C,$64,$21,$00
  36. L0007:
  37.     .byte   $0D
  38.  
  39. .segment    "RODATA"
  40.  
  41. L0003:
  42.     .byte   $48,$65,$6C,$6C,$6F,$2C,$20,$77,$6F,$72,$6C,$64,$21,$00
  43.  
  44. .segment    "BSS"
  45.  
  46. L0006:
  47.     .res    1,$00
  48.  
  49. .segment    "CODE"
  50.  
  51. ;
  52. ; char hello[] = "Hello, world!";
  53. ;
  54.     .dbg    line, "test.c", 37
  55.     ldy     #$0E
  56.     jsr     subysp
  57.     ldy     #$0D
  58. L0004:  lda     L0003,y
  59.     sta     (sp),y
  60.     dey
  61.     bpl     L0004
  62. ;
  63. ; goto skip_the_broken_stuff_that_makes_an_endless_loop;
  64. ;
  65.     .dbg    line, "test.c", 44
  66.     jsr     decsp1
  67.     bra     L0010
  68. ;
  69. ; __AX__ = strlen(hello);
  70. ;
  71.     .dbg    line, "test.c", 51
  72. L000D:  inx
  73.     iny
  74.     lda     (sp),y
  75.     bne     L000D
  76. ;
  77. ; logRegisterA(); // This is an asm routine that executes a custom opcode that logs A to the emulator's logfile.
  78. ;
  79.     .dbg    line, "test.c", 52
  80.     jsr     _logRegisterA
  81. ;
  82. ; for( i=0; i<strlen(hello); ++i )
  83. ;
  84.     .dbg    line, "test.c", 53
  85.     lda     #$00
  86. L0036:  sta     (sp)
  87.     lda     (sp)
  88.     jsr     pusha0
  89.     ldx     #$FF
  90.     ldy     #$02
  91. L0017:  inx
  92.     iny
  93.     lda     (sp),y
  94.     bne     L0017
  95.     txa
  96.     jsr     tosicmp0
  97.     bcs     L0010
  98. ;
  99. ; POKE( 0x310+i, hello[i] );
  100. ;
  101.     .dbg    line, "test.c", 55
  102.     lda     (sp)
  103.     clc
  104.     adc     #$10
  105.     pha
  106.     lda     #$00
  107.     adc     #$03
  108.     tax
  109.     pla
  110.     jsr     pushax
  111.     lda     sp
  112.     ldx     sp+1
  113.     clc
  114.     adc     #$03
  115.     bcc     L001F
  116.     inx
  117. L001F:  ldy     #$02
  118.     clc
  119.     adc     (sp),y
  120.     bcc     L0020
  121.     inx
  122. L0020:  sta     ptr1
  123.     stx     ptr1+1
  124.     ldy     #$00
  125.     lda     (ptr1)
  126.     jsr     staspidx
  127. ;
  128. ; __AX__ = hello[i];
  129. ;
  130.     .dbg    line, "test.c", 57
  131.     lda     sp
  132.     clc
  133.     adc     #$01
  134.     clc
  135.     adc     (sp)
  136. ;
  137. ; logRegisterA();
  138. ;
  139.     .dbg    line, "test.c", 58
  140.     jsr     _logRegisterA
  141. ;
  142. ; for( i=0; i<strlen(hello); ++i )
  143. ;
  144.     .dbg    line, "test.c", 53
  145.     clc
  146.     lda     #$01
  147.     adc     (sp)
  148.     bra     L0036
  149. ;
  150. ; for( i_static=0; i_static<len_static; ++i_static )
  151. ;
  152.     .dbg    line, "test.c", 64
  153. L0010:  stz     L0006
  154. L0027:  lda     L0006
  155.     cmp     L0007
  156.     bcs     L0028
  157. ;
  158. ; POKE( 0x310+i_static, hello_static[i_static] );
  159. ;
  160.     .dbg    line, "test.c", 66
  161.     lda     L0006
  162.     clc
  163.     adc     #$10
  164.     sta     ptr1
  165.     lda     #$00
  166.     adc     #$03
  167.     sta     ptr1+1
  168.     ldy     L0006
  169.     lda     L0005,y
  170.     sta     (ptr1)
  171. ;
  172. ; for( i_static=0; i_static<len_static; ++i_static )
  173. ;
  174.     .dbg    line, "test.c", 64
  175.     inc     L0006
  176.     bra     L0027
  177. ;
  178. ; }
  179. ;
  180.     .dbg    line, "test.c", 69
  181. L0028:  ldy     #$0F
  182.     jmp     addysp
  183.     .dbg    line
  184.  
  185. .endproc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement