abc80.inc 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. ;; -*- mode: asm; comment-column: 36; comment-start: ";; "; -*-
  2. ;;
  3. ;; abc80.bxh
  4. ;;
  5. ;; Constants and some function definitions for ABC80
  6. ;;
  7. ;; System variables
  8. defc CLOCK = 65008 ;; Clock (3 bytes)
  9. defc CLOCK1 = 65009 ;; Second two bytes of clock
  10. defc CURY = 65011 ;; Row
  11. defc CURX = 65012 ;; Column
  12. defc KEYFLAG = 65013 ;; Bit 7 = key pressed
  13. defc KEYTIMER = 65014 ;; Keyboard repeat timer
  14. defc CASBUF = 65017 ;; Pointer to current casbuf
  15. defc ALTINPUT = 65019 ;; "Pointer to alternate input getline"?
  16. defc CASBLK = 65021 ;; Current cassette block number
  17. defc CASPTR = 65023 ;; Pointer into current CASBUF
  18. defc CASBYTE = 65025 ;; Cassette byte in
  19. defc CASBITCNT = 65026 ;; Cassette bit count in
  20. defc CASCALLBK = 65027 ;; Callback after cassette byte read
  21. defc CASCSUM = 65029 ;; Cassette checksum
  22. defc CTRL_C = 65031 ;; Bit 7 = Ctrl-C pressed
  23. defc DEVLIST = 65034 ;; Device list start
  24. defc BACVER = 65036 ;; BASIC version number (new BASIC only)
  25. defc BASICERR = 65039 ;; BASICERR.SYS open
  26. defc IYBASE = 65046 ;; IY points here
  27. defc BOFA = 65052 ;; Start of BASIC program
  28. defc EOFA = 65054 ;; Last byte of BASIC program (01h)
  29. defc HEAP = 65056 ;; Current top of BASIC heap
  30. defc CURFILE = 65059 ;; Current BASIC file (PRINT/INPUT)
  31. defc RUNMODE = 65060 ;; 0 = run mode, 1 = command mode
  32. defc PROGFL = 65061 ;; Bit 4 = trace, 5 = run only
  33. defc FIXUP = 65062 ;; Program fixed up flag
  34. defc STACK = 65063 ;; Initial BASIC stack
  35. defc VARLIST = 65065 ;; Variable list start
  36. defc SELECT = 65067 ;; Currently selected bus device
  37. defc LINEADDR = 65069 ;; Address of current BASIC line
  38. defc DATAPTR = 65070 ;; Current DATA pointer
  39. defc DATALINE = 65072 ;; Current DATA line pointer
  40. defc FILELIST = 65074 ;; Open file list
  41. defc ONERROR = 65076 ;; ON ERROR GOTO address
  42. defc RUNSTACK = 65078 ;; Runtime stack pointer
  43. defc ERRCODE = 65080 ;; Current ERRCODE
  44. defc RNDSEED = 65081 ;; RND seed buffer (5 bytes)
  45. defc FNARGS = 65086 ;; FN function arguments on stack
  46. defc LINE_BUF = 65088 ;; Line input buffer
  47. defc LINE_SIZE = 120 ;; Size of LINEBUF
  48. defc PCODE_BUF = 65208 ;; Compilation time buffer
  49. defc PCODE_SIZE = 208 ;; Size of PCODE_BUF
  50. defc POKE_BUF = 65408 ;; Free POKE area
  51. defc POKE_LEN = 128 ;; Size of POKE_BUF
  52. ;; Clock info
  53. defc TICK = CLOCK ;; Fastest ticking byte
  54. defc HZ = 50 ;; Tick frequency
  55. ;; BASIC subroutines (valid for all BASIC versions)
  56. defc S_ERROR = 0x0012 ;; Error routine (A=error)
  57. defc S_NEW = 0x00c6 ;; Delete program then command line
  58. defc S_CMD = 0x00cc ;; Go to command line
  59. defc S_RUNCMD = 0x00f4 ;; Run command in HL -> RADBUF
  60. ;; RUNMODE must = 1 and CTRLC flag clear
  61. defc S_INLINE = 0x0015 ;; Stock INPUT for a device with BLKRD
  62. defc S_OUTLI = 0x001b ;; Stock PRINT for a device with BLKWR
  63. defc S_CLOSEF = 0x0023 ;; Stock CLOSE for a block device?
  64. defc S_OPENF = 0x002d ;; OPEN with filename convert
  65. defc S_OPENCMD = 0x003e ;; OPEN helper for commands
  66. defc S_FIXNAM = 0x0041 ;; Format a variable name
  67. defc S_END = 0x00c9 ;; Jump here to END
  68. defc S_CUR_MAX_X = 0x0338 ;; A = current column, E = max column
  69. defc S_CHECKCTRLC = 0x033e ;; Checks (Z=0) and clears Ctrl-C flag
  70. ;; clobbers A
  71. defc S_CHAINPTR = 0x0e64 ;; *Pointer* to executing CHAIN
  72. defc S_FNDLIN = 0x0f39 ;; DE = line number -> HL = address
  73. defc S_CLOSEFILE = 0x087f ;; Close BASIC file from IX
  74. defc S_SCRATCH = 0x0a70 ;; Delete program, clear runstate
  75. ;; Error stubs (issue ERR xx)
  76. defc ERR_53 = 0x06F7 ;; Felaktig rad
  77. defc ERR_0 = 0x06F9 ;; Ej tillåtet öka DIM
  78. defc ERR_1 = 0x06FB ;; Fel antal index
  79. defc ERR_2 = 0x06FD ;; Ej tillåtet som kommand
  80. defc ERR_3 = 0x06FF ;; Minnet fullt
  81. defc ERR_4 = 0x0701 ;; För stort flyttal
  82. defc ERR_5 = 0x0703 ;; För stort index
  83. defc ERR_6 = 0x0705 ;; Hittar ej detta radnummber
  84. defc ERR_7 = 0x0707 ;; För stort heltal
  85. defc ERR_8 = 0x0709 ;; Finns ej i detta system
  86. defc ERR_9 = 0x070B ;; Index utanför strängen
  87. defc ERR_10 = 0x070D ;; Texten får ej plats i strängen
  88. defc ERR_21 = 0x070F ;; Hittar ej filen
  89. defc ERR_22 = 0x0711 ;; Otillåten sats
  90. defc ERR_12 = 0x0713 ;; Felaktigt tal
  91. defc ERR_24 = 0x0715 ;; NEXT saknas
  92. defc ERR_28 = 0x0717 ;; Felaktig variabel efter NEXT
  93. defc ERR_27 = 0x0719 ;; NEXT utan FOR
  94. defc ERR_29 = 0x071B ;; RETURN utan GOSUB
  95. defc ERR_26 = 0x071D ;; Fel i ON-uttryck
  96. defc ERR_30 = 0x071F ;; DATA slut
  97. defc ERR_31 = 0x0721 ;; Fel data till kommando
  98. defc ERR_32 = 0x0723 ;; Filen ej öppnad
  99. defc ERR_50 = 0x0725 ;; Kvadratrot ur negativt tal
  100. defc ERR_52 = 0x0727 ;; Ej till denna enhet
  101. defc ERR_57 = 0x0729 ;; Funktionen ej definierad
  102. defc ERR_60 = 0x072B ;; Bit address > 16 bitar
  103. ;; Console subroutines
  104. defc CON_GET = 0x0002 ;; Console get character
  105. defc CON_INPUT = 0x0005 ;; Console INPUT LINE
  106. defc CON_PRINT = 0x000b ;; Console PRINT
  107. defc CON_CRLF = 0x0742 ;; Print CR LF to console
  108. ;; File I/O jump table calls (indirect via IX)
  109. defc IX_OPEN = 0x088a + 3*0
  110. defc IX_PREPARE = 0x088a + 3*1
  111. defc IX_CLOSE = 0x088a + 3*2
  112. defc IX_INPUT = 0x088a + 3*3
  113. defc IX_PRINT = 0x088a + 3*4
  114. defc IX_BLKRD = 0x088a + 3*5
  115. defc IX_BLKWR = 0x088a + 3*6
  116. defc IX_KILL = 0x088a + 3*7
  117. defc IX_NAME = 0x088a + 3*8
  118. ;; Entry points in the IEC ROM
  119. defc IEC_CCMD = 0x7000 ;; Compile CMD to byte code
  120. defc IEC_ECMD = 0x7003 ;; Execute CMD byte code
  121. defc IEC_EIEC = 0x7006 ;; Evaluate IEC$(x)
  122. defc IEC_JPTABLE = 0x7009 ;; IEC: device jump table
  123. ;; BASIC data structures (all BASIC versions)
  124. defc SCRN_ROWTBL = 0x0374 ;; Table of addresses for screen rows
  125. defc SCRN_WIDTH = 0x033c ;; Inside S_CUR_MAX_X routine
  126. ;; ROM init vector offset, matches DOS
  127. defc INIT_OFFS = 0x4b