Advertisement
alextrevisan

ASM read byte (gcc)

Apr 29th, 2020
1,779
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     .feature at_in_identifiers
  2.     .feature dollar_in_identifiers
  3.     .autoimport +
  4.     .pc02
  5.     .importzp _sp0, _sp1, _fp0, _fp1
  6.     .importzp _r0, _r1, _r2, _r3, _r4, _r5, _r6, _r7
  7.     .importzp _s0, _s1, _s2, _s3, _s4, _s5, _s6, _s7
  8.     .importzp _e0, _e1, _e2, _e3, _e4, _e5, _e6, _e7
  9.     .importzp _e8, _e9, _e10, _e11, _e12, _e13, _e14, _e15
  10.     .importzp _e16, _e17, _e18, _e19, _e20, _e21, _e22, _e23
  11.     .importzp _e24, _e25, _e26, _e27, _e28, _e29, _e30, _e31
  12.     .importzp _tmp0, _tmp1
  13.     .importzp _sa, _sx, _sy
  14.     .code
  15.     .segment "CODE"
  16.     .segment "RODATA"
  17. LC@0:
  18.     .byte "ARQUIVO3.BIN", $0
  19. LC@1:
  20.     .byte "error %D", $0
  21.     .segment "CODE"
  22.     .export main
  23. main:
  24. ; frame size 0, pretend size 0, outgoing size 0
  25.     stz $0002
  26.     lda #$b0
  27.     sta $0003
  28.     lda #$01
  29.     sta _r2
  30.     lda #$08
  31.     sta _r1
  32.     lda #$01
  33.     sta _r0
  34.     jsr cbm_k_setlfs
  35.     lda #<(LC@0)
  36.     sta _r0
  37.     lda #>(LC@0)
  38.     sta _r1
  39.     jsr cbm_k_setnam
  40.     jsr cbm_k_open
  41.     lda #$01
  42.     sta _r0
  43.     jsr cbm_k_chkin
  44.     jsr cbm_k_readst
  45.     lda _r0
  46.     bne L@10
  47.     jsr cbm_k_basin
  48. ;# 119 "gcc_cx16.h" 1
  49.     lda _r0
  50. ;# 120 "gcc_cx16.h" 1
  51.     jsr $FFD2
  52.     rts
  53. L@10:
  54.     sta _r2
  55.     stz _r3
  56.     lda #<(LC@1)
  57.     sta _r0
  58.     lda #>(LC@1)
  59.     sta _r1
  60.     jsr printf
  61.     rts
Advertisement
RAW Paste Data Copied
Advertisement