mads 2.1.0 build 8 (23 Dec 19) Source: options.s 1 icl 'library.s' Source: library.s 1 ; Altirra AcidOS test suite 2 ; Copyright (C) 2013 Avery Lee, All Rights Reserved. 3 ; 4 ; Permission is hereby granted, free of charge, to any person obtaining a copy 5 ; of this software and associated documentation files (the "Software"), to deal 6 ; in the Software without restriction, including without limitation the rights 7 ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 ; copies of the Software, and to permit persons to whom the Software is 9 ; furnished to do so, subject to the following conditions: 10 ; 11 ; The above copyright notice and this permission notice shall be included in 12 ; all copies or substantial portions of the Software. 13 ; 14 ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 ; SOFTWARE. 21 22 ;========================================================================== 23 ; MEMORY MAP 24 ; 25 ; 0480-04FF Line buffer 26 ; 0500-21FF Reserved for DOS 27 ; 2200-25FF Test display 28 ; 2600-2BFF Library code 29 ; 30 ;========================================================================== 31 32 icl 'hardware.inc' Source: hardware.inc 1 ; Altirra AcidOS test suite 2 ; Copyright (C) 2013 Avery Lee, All Rights Reserved. 3 ; 4 ; Permission is hereby granted, free of charge, to any person obtaining a copy 5 ; of this software and associated documentation files (the "Software"), to deal 6 ; in the Software without restriction, including without limitation the rights 7 ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 ; copies of the Software, and to permit persons to whom the Software is 9 ; furnished to do so, subject to the following conditions: 10 ; 11 ; The above copyright notice and this permission notice shall be included in 12 ; all copies or substantial portions of the Software. 13 ; 14 ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 ; SOFTWARE. 21 22 .ifndef f_HARDWARE_INC 23 .def f_HARDWARE_INC 24 25 ;========================================================================== 26 ; GTIA 27 ; 28 hposp0 equ $d000 29 hposp1 equ $d001 30 hposp2 equ $d002 31 hposp3 equ $d003 32 hposm0 equ $d004 33 hposm1 equ $d005 34 hposm2 equ $d006 35 hposm3 equ $d007 36 sizep0 equ $d008 37 sizep1 equ $d009 38 sizep2 equ $d00a 39 sizep3 equ $d00b 40 sizem equ $d00c 41 trig0 equ $d010 42 trig1 equ $d011 43 trig2 equ $d012 44 colpm0 equ $d012 45 trig3 equ $d013 46 colpm1 equ $d013 47 pal equ $d014 48 colpm2 equ $d014 49 colpm3 equ $d015 50 colpf0 equ $d016 51 colpf1 equ $d017 52 colpf2 equ $d018 53 colpf3 equ $d019 54 colbk equ $d01a 55 prior equ $d01b 56 gractl equ $d01d 57 consol equ $d01f 58 59 ;========================================================================== 60 ; POKEY 61 ; 62 pot0 equ $d200 63 audf1 equ $d200 64 pot1 equ $d201 65 audc1 equ $d201 66 pot2 equ $d202 67 audf2 equ $d202 68 pot3 equ $d203 69 audc2 equ $d203 70 pot4 equ $d204 71 audf3 equ $d204 72 pot5 equ $d205 73 audc3 equ $d205 74 pot6 equ $d206 75 audf4 equ $d206 76 pot7 equ $d207 77 audc4 equ $d207 78 audctl equ $d208 79 kbcode equ $d209 80 stimer equ $d209 81 skres equ $d20a 82 potgo equ $d20b 83 serin equ $d20d 84 serout equ $d20d 85 irqen equ $d20e 86 irqst equ $d20e 87 skctl equ $d20f 88 skstat equ $d20f 89 90 ;========================================================================== 91 ; PIA 92 ; 93 porta equ $d300 94 portb equ $d301 95 pactl equ $d302 96 pbctl equ $d303 97 98 ;========================================================================== 99 ; ANTIC 100 ; 101 dmactl equ $d400 102 chactl equ $d401 103 dlistl equ $d402 104 dlisth equ $d403 105 hscrol equ $d404 106 vscrol equ $d405 107 pmbase equ $d407 108 chbase equ $d409 109 wsync equ $d40a 110 vcount equ $d40b 111 penh equ $d40c 112 penv equ $d40d 113 nmien equ $d40e 114 nmist equ $d40f 115 nmires equ $d40f 116 117 ;========================================================================== 118 ; 6502 119 ; 120 nmivec equ $fffa 121 resvec equ $fffc 122 irqvec equ $fffe 123 124 .endif 33 icl 'kerneldb.inc' Source: kerneldb.inc 1 ; Altirra AcidOS test suite 2 ; Copyright (C) 2013 Avery Lee, All Rights Reserved. 3 ; 4 ; Permission is hereby granted, free of charge, to any person obtaining a copy 5 ; of this software and associated documentation files (the "Software"), to deal 6 ; in the Software without restriction, including without limitation the rights 7 ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 ; copies of the Software, and to permit persons to whom the Software is 9 ; furnished to do so, subject to the following conditions: 10 ; 11 ; The above copyright notice and this permission notice shall be included in 12 ; all copies or substantial portions of the Software. 13 ; 14 ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 ; SOFTWARE. 21 22 .ifndef f_KERNELDB_INC 23 .def f_KERNELDB_INC 24 25 casini = $0002 ;cassette initialization vector 26 ramlo = $0004 ; 27 tramsz = $0006 ;temporary ram size / cart A flag 28 tstdat = $0007 ;RAM test data register / cart B flag 29 warmst = $0008 ;warmstart flag 30 boot? = $0009 ;boot flag; 0 if none, 1 for disk, 2 for cassette 31 dosvec = $000a 32 dosini = $000c 33 appmhi = $000e 34 pokmsk = $0010 35 brkkey = $0011 ;set on [BREAK] 36 rtclok = $0012 37 bufadr = $0015 ;indirect buffer address pointer (temp for disk buffer) 38 ; $0016 39 iccomt = $0017 ;CIO: command byte 40 ziocb = $0020 ;zero-page IOCB 41 ichidz = $0020 ;Zero page IOCB: device index ($FF = not open) 42 icdnoz = $0021 ;Zero page IOCB: device number 43 iccomz = $0022 ;Zero page IOCB: command byte 44 icstaz = $0023 ;Zero page IOCB: status byte 45 icbalz = $0024 ;Zero page IOCB: address of device/filename spec lo 46 icbahz = $0025 ;Zero page IOCB: address of device/filename spec hi 47 icptlz = $0026 ;Zero page IOCB: put byte address lo (-1) 48 icpthz = $0027 ;Zero page IOCB: put byte address hi (-1) 49 icbllz = $0028 ;Zero page IOCB: buffer length/byte count lo (-1) 50 icblhz = $0029 ;Zero page IOCB: buffer length/byte count hi (-1) 51 icax1z = $002a ;Zero page IOCB: device-specific information 1 52 icax2z = $002b ;Zero page IOCB: device-specific information 2 53 icax3z = $002c ;Zero page IOCB: device-specific information 3 54 icax4z = $002d ;Zero page IOCB: device-specific information 4 55 icax5z = $002e ;Zero page IOCB: device-specific information 5 56 icidno = $002e ;CIO: call X register save/restore 57 icax6z = $002f ;Zero page IOCB: device-specific information 6 58 ciochr = $002f ;CIO: call A register save/restore 59 status = $0030 ;SIO: temporay status byte 60 chksum = $0031 ;SIO: temporary checksum byte (used by IRQ routines) 61 bufrlo = $0032 ;SIO: buffer pointer lo (incremented by IRQ routines) 62 bufrhi = $0033 ;SIO: buffer pointer hi (incremented by IRQ routines) 63 bfenlo = $0034 ;SIO: buffer end lo 64 bfenhi = $0035 ;SIO: buffer end hi 65 ltemp = $0036 ;Relocating loader: loader temp address (XL/XE) 66 ; $0037 67 bufrfl = $0038 ;SIO: buffer full flag 68 recvdn = $0039 ;SIO: receive completed flag 69 xmtdon = $003a ;SIO: transmit completed flag 70 chksnt = $003b ;SIO: checksum sent flag 71 nocksm = $003c ;SIO: no-checksum flag 72 bptr = $003d ;Cassette: Buffer pointer 73 ftype = $003e ;Cassette: Interrecord gap (IRG) type; bit7=1 means continuous mode 74 feof = $003f ;Cassette: EOF flag 75 soundr = $0041 ;SIO: noisy audio flag 76 critic = $0042 ;critical flag for vbi 77 zchain = $004a ;Peripheral Handler: zero-page chain address 78 ; $004b 79 atract = $004d ;screen attract counter 80 drkmsk = $004e ;screen attract mask 81 colrsh = $004f ;screen attract color shift 82 tmpchr = $0050 ;Screen Editor 83 hold1 = $0051 ;Display/Editor: temporary storage 84 lmargn = $0052 ;left margin column 85 rmargn = $0053 ;right margin column 86 rowcrs = $0054 ;cursor row 87 colcrs = $0055 ;cursor column 88 ; $0056 89 dindex = $0057 ;display mode index 90 savmsc = $0058 ;lowest address of screen region 91 oldrow = $005a ; 92 oldcol = $005b ; 93 oldchr = $005d ;cursor character save/restore 94 oldadr = $005e ;cursor memory address 95 ; $005f 96 palnts = $0062 ;PAL/NTSC flag 97 logcol = $0063 ;Display/Editor: Logical column (0-119) 98 adress = $0064 ;temporary storage (display code) 99 ; $0065 100 toadr = $0066 ;temporary storage (display code) 101 ; $0067 102 frmadr = $0068 ;temporary storage (display code) 103 ; $0069 104 ramtop = $006a ;ram size 105 bufcnt = $006b 106 bufstr = $006c ;row/column of start of logical line 107 bitmsk = $006e ;Screen Editor 108 shfamt = $006f ;Screen Editor 109 rowac = $0070 ;Screen Editor: line drawing 110 ; $0071 ; 111 colac = $0072 ;Screen Editor: line drawing 112 ; $0073 ; 113 endpt = $0074 ;Screen Editor: line drawing 114 ; $0075 ; 115 deltar = $0076 ;Screen Editor: delta row (line drawing) 116 deltac = $0077 ;Screen Editor: delta column (line drawing) 117 ; $0078 ; 118 keydef = $0079 ;XL/XE: Keyboard definition table 119 ; $007a 120 swpflg = $007b ;current display var state ($00 = main, $FF = split screen) 121 holdch = $007c ;temporary key hold area prior to shift/control lock logic 122 countr = $007e ;Screen Editor: line length 123 ; $007f 124 fr0 = $00d4 ;FP: Accumulator 0 125 _fr3 = $00da ;FP: Accumulator 4 126 fr1 = $00e0 ;FP: Accumulator 1 127 _fr2 = $00e6 ;FP: Accumulator 2 128 _fpres2 = $00ef ;BASIC: Used in sqr() routine -- must not be touched by FP code 129 _fpres = $00f0 ;BASIC: Used in sin() routine -- must not be touched by FP code 130 cix = $00f2 ;FP: Character index 131 inbuff = $00f3 ;FP: ASCII conversion buffer 132 ; $00f4 133 _fpcount= $00f5 134 _fptemp0= $00f6 135 _fptemp1= $00f7 136 flptr = $00fc ;FP: pointer for floating-point loads and stores 137 _flptr2 = $00fe 138 139 vdslst = $0200 ;display list interrupt vector 140 vprced = $0202 ;serial bus proceed interrupt vector 141 vinter = $0204 ;serial bus interrupt vector 142 vbreak = $0206 ;BRK instruction vector 143 vkeybd = $0208 ;keyboard interrupt vector 144 vserin = $020a ;serial input ready interrupt vector 145 vseror = $020c ;serial output ready interrupt vector 146 vseroc = $020e ;serial output completed interrupt vector 147 vtimr1 = $0210 ;pokey timer 1 interrupt vector 148 vtimr2 = $0212 ;pokey timer 2 interrupt vector 149 vtimr4 = $0214 ;pokey timer 4 interrupt vector 150 vimirq = $0216 ;immediate IRQ vector 151 cdtmv1 = $0218 ;countdown timer 1 152 cdtmv2 = $021a ;countdown timer 2 153 cdtmv3 = $021c ;countdown timer 3 154 cdtmv4 = $021e ;countdown timer 4 155 cdtmv5 = $0220 ;countdown timer 5 156 vvblki = $0222 ;vertical blank immediate vector 157 vvblkd = $0224 ;vertical blank deferred vector 158 cdtma1 = $0226 ;timer 1 vector 159 cdtma2 = $0228 ;timer 2 vector 160 cdtmf3 = $022a ;timer 3 flag 161 srtimr = $022b ;autorepeat timer 162 cdtmf4 = $022c ;timer 4 flag 163 intemp = $022d ;temp value used by SETVBV 164 cdtmf5 = $022e ;timer 5 flag 165 sdmctl = $022f ;shadow for DMACTL ($D400) 166 sdlstl = $0230 ;shadow for DLISTL ($D402) 167 sdlsth = $0231 ;shadow for DLISTH ($D403) 168 sskctl = $0232 ;shadow for SKCTL ($D20F) 169 lcount = $0233 ;Relocating loader: (XL/XE) 170 lpenh = $0234 ;light pen horizontal pos 171 lpenv = $0235 ;light pen vertical pos 172 brkky = $0236 ;break key interrupt vector (OS B+ only) 173 reladr = $0238 ;Relocating loader: temp address (XL/XE) 174 ; $0239 175 cdevic = $023a ;SIO: command frame device ID 176 ccomnd = $023b ;SIO: command frame command ID 177 caux1 = $023c ;SIO: command aux byte 1 178 caux2 = $023d ;SIO: command aux byte 2 179 temp = $023e ;SIO: temp space 180 errflg = $023f ;SIO: error flag 181 dflags = $0240 ;disk boot flags 182 dbsect = $0241 ;disk boot sector count 183 bootad = $0242 ;disk boot address 184 coldst = $0244 ;cold start flag 185 reclen = $0245 ;Relocating loader: record length (XL/XE) 186 dsktim = $0246 ;Disk Handler: Disk operation timeout 187 pdvmsk = $0247 ;PBI device mask (XL/XE) 188 shpdvs = $0248 ;PBI device selection register shadow ($D1FF) (XL/XE) 189 fine = $026e ;fine scrolling flag (XL/XE) 190 gprior = $026f ;shadow for PRIOR ($D01B) 191 paddl0 = $0270 ;shadow for POT0 ($D200) 192 paddl1 = $0271 ;shadow for POT1 ($D201) 193 paddl2 = $0272 ;shadow for POT2 ($D202) 194 paddl3 = $0273 ;shadow for POT3 ($D203) 195 paddl4 = $0274 ;shadow for POT4 ($D204) 196 paddl5 = $0275 ;shadow for POT5 ($D205) 197 paddl6 = $0276 ;shadow for POT6 ($D206) 198 paddl7 = $0277 ;shadow for POT7 ($D207) 199 stick0 = $0278 ;shadow for PORTA lo ($D300) 200 stick1 = $0279 ;shadow for PORTA hi ($D300) 201 stick2 = $027A ;shadow for PORTB lo ($D302) 202 stick3 = $027B ;shadow for PORTB hih ($D302) 203 ptrig0 = $027c ;paddle trigger 0 204 ptrig1 = $027d ;paddle trigger 1 205 ptrig2 = $027e ;paddle trigger 2 206 ptrig3 = $027f ;paddle trigger 3 207 ptrig4 = $0280 ;paddle trigger 4 208 ptrig5 = $0281 ;paddle trigger 5 209 ptrig6 = $0282 ;paddle trigger 6 210 ptrig7 = $0283 ;paddle trigger 7 211 strig0 = $0284 ;shadow for TRIG0 ($D001) 212 strig1 = $0285 ;shadow for TRIG1 ($D002) 213 strig2 = $0286 ;shadow for TRIG2 ($D003) 214 strig3 = $0287 ;shadow for TRIG3 ($D004) 215 hibyte = $0288 ;Relocating loader (XL/XE) 216 wmode = $0289 ;Cassette: Write mode (00 = read, 80 = write) 217 blim = $028a ;Cassette: Buffer limit 218 jveck = $028c ;XL/XE: IRQ jump vector 219 newadr = $028e ;Relocating loader (XL/XE) 220 txtrow = $0290 221 txtcol = $0291 222 ; $0292 223 tindex = $0293 ;text mode index 224 txtmsc = $0294 ;text window pointer 225 ; $0295 226 cretry = $029c ;SIO: command retries (XL/XE) 227 hold3 = $029d ;Screen Editor 228 hold2 = $029f ;Screen Editor 229 dmask = $02a0 ;Display/Editor: Graphics merge mask 230 tmplbt = $02a1 231 escflg = $02a2 ;Display/Editor: Escape next character 232 tabmap = $02a3 ;Display/Editor: Bitfield indicating tabs (note reversed bit positions) 233 logmap = $02b2 ;Display/Editor: Logical line start map (4 bytes) 234 tmprow = $02b8 ;Screen Editor 235 tmpcol = $02b9 ;Screen Editor 236 ; $02ba 237 scrflg = $02bb ;Display/Editor: Scroll counter 238 hold4 = $02bc ;Screen Editor 239 dretry = $02bd ;SIO: device retries (XL/XE) 240 shflok = $02be ;shift/control lock flags 241 botscr = $02bf ;number of text rows in text window 242 pcolr0 = $02c0 ;shadow for COLPM0 ($D012) 243 pcolr1 = $02c1 ;shadow for COLPM1 ($D013) 244 pcolr2 = $02c2 ;shadow for COLPM2 ($D014) 245 pcolr3 = $02c3 ;shadow for COLPM3 ($D015) 246 color0 = $02c4 ;shadow for COLPF0 ($D016) 247 color1 = $02c5 ;shadow for COLPF1 ($D017) 248 color2 = $02c6 ;shadow for COLPF2 ($D018) 249 color3 = $02c7 ;shadow for COLPF3 ($D019) 250 color4 = $02c8 ;shadow for COLBK ($D01A) 251 runadr = $02c9 ;Relocating loader: run address (XL/XE) 252 ; $02ca 253 hiused = $02cb ;Relocating loader: Next available memory location (out) (XL/XE) 254 ; $02cc 255 zhiuse = $02cd ;Relocating loader: Next available zero-page address (out) (XL/XE) 256 ; $02ce 257 gbytea = $02cf ;Relocating loader: GET BYTE address (XL/XE) 258 ; $02d0 259 loadad = $02d1 ;Relocating loader: Load address (XL/XE) 260 ; $02d2 261 zloada = $02d3 ;Relocating loader: Zero-page load address (XL/XE) 262 ; $02d4 263 dsctln = $02d5 ;Disk sector size (XL/XE) 264 pbpnt = $02de ;Printer: Buffer index (XL/XE location) 265 pbufsz = $02df ;Printer: Record size (XL/XE location) 266 runad = $02e0 267 initad = $02e2 268 ramsiz = $02e4 ;ram size in pages 269 memtop = $02e5 ;highest location for programs and data 270 memlo = $02e7 ;base of application memory 271 hndlod = $02e9 ;CIO: Handler load flag (XL/XE) 272 dvstat = $02ea ;DISK: Status request buffer area (4 bytes) 273 ; $02eb 274 ; $02ec 275 ; $02ed 276 crsinh = $02f0 ;Display/Editor: cursor inhibit flag 277 keydel = $02f1 ;keyboard debounce delay (set to 3 vblanks per key) 278 ch1 = $02f2 ;last keyboard code read 279 chact = $02f3 ;shadow for CHACTL ($D401) 280 chbas = $02f4 ;shadow for CHBASE ($D409) 281 rowinc = $02f8 ;Screen Editor: row direction (XL/XE location) 282 colinc = $02f9 ;Screen Editor: col direction (XL/XE location) 283 atachr = $02fb ;Screen Editor 284 ch = $02fc ;keyboard FIFO byte 285 fildat = $02fd ;Screen Editor: fill color 286 dspflg = $02fe ;enable/disable of control codes by screen editor (E:) 287 ssflag = $02ff ;display/screen editor suspend flag 288 ddevic = $0300 ;serial bus ID 289 dunit = $0301 ;device number 290 dcomnd = $0302 ;command byte 291 dstats = $0303 ;status byte 292 dbuflo = $0304 ;buffer address lo 293 dbufhi = $0305 ;buffer address hi 294 dtimlo = $0306 ;disk timeout value 295 dbytlo = $0308 ;byte count lo 296 dbythi = $0309 ;byte count hi 297 daux1 = $030a ;sector number lo 298 daux2 = $030b ;sector number hi 299 timer1 = $030c ;SIO: baud rate determination - first timer value 300 addcor = $030e ;SIO: baud rate determination - correction value 301 casflg = $030f ;SIO: cassette I/O flag (0=normal, nonzero=cassette) 302 timer2 = $0310 ;SIO: baud rate determination - second timer value 303 temp1 = $0312 ;SIO: baud rate determination - temp 304 ; $0313 305 ptimot = $0314 ;Printer: Timeout (XL/XE location) 306 temp3 = $0315 ;SIO: baud rate determination - temp 307 timflg = $0317 ;SIO: operation timeout flag (set by countdown timer 1 IRQ) 308 stackp = $0318 ;SIO: stack pointer save 309 hatabs = $031a ;handler table 310 pupbt1 = $033d ;(XL/XE) Power-up boot flag #1 - $5C 311 pupbt2 = $033e ;(XL/XE) Power-up boot flag #2 - $93 312 pupbt3 = $033f ;(XL/XE) Power-up boot flag #3 - $25 313 ichid = $0340 ;IOCB #0 handler ID 314 icdno = $0341 ;IOCB #0 device number 315 iccmd = $0342 ;IOCB #0 command byte 316 icsta = $0343 ;IOCB #0 status 317 icbal = $0344 ;IOCB #0 buffer address lo 318 icbah = $0345 ;IOCB #0 buffer address hi 319 icptl = $0346 ;IOCB #0 PUT address lo 320 icpth = $0347 ;IOCB #0 PUT address hi 321 icbll = $0348 ;IOCB #0 buffer length/byte count lo 322 icblh = $0349 ;IOCB #0 buffer length/byte count hi 323 icax1 = $034a ;IOCB #0 auxiliary information lo 324 icax2 = $034b ;IOCB #0 auxiliary information hi 325 icax3 = $034c ; 326 icax4 = $034d ; 327 icax5 = $034e ; 328 icax6 = $034f ; 329 prnbuf = $03c0 ;printer buffer 330 ckey = $03e9 ;cassette boot key 331 basicf = $03f8 ;XL/XE: ROM BASIC flag. 0 = enabled 332 gintlk = $03fa ;XL/XE: Cartridge interlock (clone of TRIG3). 333 chlink = $03fb ;XL/XE: Relocated loader chain 334 casbuf = $03fd ;Cassette buffer (03FD-047F) 335 lbuff = $0580 ; 336 plyarg = $05e0 ;FP: Polynomial evaluation temp register 337 338 afp equ $d800 339 fasc equ $d8e6 340 ipf equ $d9aa 341 fpi equ $d9d2 342 zfr0 equ $da44 343 zf1 equ $da46 344 fsub equ $da60 345 fadd equ $da66 346 fmul equ $dadb 347 fdiv equ $db28 348 plyevl equ $dd40 349 fld0r equ $dd89 350 fld0p equ $dd8d 351 fld1r equ $dd98 352 fld1p equ $dd9c 353 fst0r equ $dda7 354 fst0p equ $ddab 355 fmove equ $ddb6 356 exp equ $ddc0 357 exp10 equ $ddcc 358 log equ $decd 359 log10 equ $ded1 360 361 dskinv = $e453 362 ciov = $e456 363 setvbv = $e45c 364 sysvbv = $e45f 365 xitvbv = $e462 366 367 .endif 34 35 opt o- 36 37 org $b0 38 d0 dta 0 39 d1 dta 0 40 d2 dta 0 41 d3 dta 0 42 d4 dta 0 43 d5 dta 0 44 d6 dta 0 45 d7 dta 0 46 a0 dta a(0) 47 a1 dta a(0) 48 a2 dta a(0) 49 a3 dta a(0) 50 51 org $c0 52 53 _log_curx dta 0 54 _log_curln dta a(0) 55 _log_srcptr dta a(0) 56 _log_lncnt dta 0 57 58 = 0080 LOGF_PAGING = $80 59 _log_flags dta 0 60 61 _test_sp dta 0 62 _test_exit dta 0 63 64 .if *>$d4 65 .error 'Library zero-page intrudes upon FP region: ',* 66 .endif 67 68 ;======================================================================= 69 70 .macro _TEST_ENTRY 71 .ifdef STANDALONE 72 icl 'init.s' 73 run __init 74 .else 75 run main 76 .endif 77 .endm 78 79 ;======================================================================= 80 81 org $2200 82 83 .ifdef GENLIBRARY 84 opt o+ 85 .else 86 opt o- 87 .endif 88 89 _log_dlist: 90 :3 dta $70 91 dta $42,a(_log_display_start) 92 dta $00 93 :23 dta $02 94 dta $41,a(_log_dlist) 95 96 org $2240 97 _log_display_start: 98 dta " AcidOS output - Ctrl+A to toggle "* 99 _log_display: 100 ;$2258-25FF 101 = 2600 _log_displayend equ $2600 102 103 org $2600 104 105 ;======================================================================= 106 _cpu_mode dta 0 107 _opt_wait dta 0 108 _opt_waitfail dta 0 109 _test_exitfn dta a(0) 110 _test_passed dta 0 111 _test_failed dta 0 112 _test_skipped dta 0 113 _test_testidx dta 0 114 _menu_2ndtime dta 0 115 _log_visible dta $ff 116 _log_dlsave dta a(0) 117 118 ;======================================================================= 119 _hexdig dta '0123456789ABCDEF' 120 121 ;======================================================================= 122 .nowarn .proc _log_keyboardirq 123 lda #>next 124 pha 125 lda #_log_dlist 162 beq dl_ok 163 dl_replaced: 164 sta _log_dlsave 165 stx _log_dlsave+1 166 php 167 sei 168 lda #<_log_dlist 169 sta sdlstl 170 lda #>_log_dlist 171 sta sdlsth 172 plp 173 dl_ok: 174 jmp xitvbv 175 .endp 176 177 ;======================================================================= 178 ; A = column 179 ; X = row 180 .nowarn .proc _log_gotoxy 181 ;save new X 182 pha 183 184 ;erase existing cursor 185 ldy _log_curx 186 lda (_log_curln),y 187 eor #$80 188 sta (_log_curln),y 189 190 ;recompute line addr 191 mva #>[_log_display/2] _log_curln+1 192 lda pos_table,x 193 asl 194 rol _log_curln+1 195 asl 196 rol _log_curln+1 197 sta _log_curln 198 199 ;update X and redraw cursor 200 pla 201 tay 202 sty _log_curx 203 lda (_log_curln),y 204 eor #$80 205 sta (_log_curln),y 206 rts 207 208 pos_table: 209 :22 dta [#*40+(<_log_display)]/4 210 .endp 211 212 ;======================================================================= 213 .nowarn .proc _log_cls 214 ldy #0 215 sty _log_lncnt 216 tya 217 clearloop: 218 sta _log_display,y 219 sta _log_displayend-$300,y 220 sta _log_displayend-$200,y 221 sta _log_displayend-$100,y 222 iny 223 bne clearloop 224 mwa #_log_display _log_curln 225 bne _log_clearline.xit 226 .endp 227 228 ;======================================================================= 229 .nowarn .proc _log_clearline 230 ldy #39 231 lda #0 232 sta:rpl (_log_curln),y- 233 xit: 234 ldy #2 235 sty _log_curx 236 lda #$80 237 sta (_log_curln),y 238 rts 239 .endp 240 241 ;======================================================================= 242 ; Modified: 243 ; A, Y 244 ; 245 ; Preserved: 246 ; X 247 ; 248 ; Control codes handled: 249 ; $7D clear 250 ; $9B end of line 251 ; $9C clear line 252 ; 253 .nowarn .proc _log_putchar 254 ;check for EOL 255 cmp #$9b 256 bne not_eol 257 ldy _log_curx 258 lda #0 259 sta (_log_curln),y 260 beq wrap 261 not_eol: 262 ;check for clear 263 cmp #$7d 264 beq _log_cls 265 266 ;check for clear line 267 cmp #$9c 268 beq _log_clearline 269 270 ;convert ATASCII to INTERNAL 271 pha 272 rol 273 rol 274 rol 275 rol 276 and #$03 277 tay 278 pla 279 eor conv_tab,y 280 281 ldy _log_curx 282 sta (_log_curln),y 283 iny 284 cpy #40 285 bcs wrap 286 sty _log_curx 287 done: 288 lda #$80 289 sta (_log_curln),y 290 rts 291 wrap: 292 ldy #2 293 sty _log_curx 294 lda _log_curln 295 adc #39 296 sta _log_curln 297 scc:inc _log_curln+1 298 299 lda _log_curln+1 300 cmp #>_log_displayend 301 bne no_scroll 302 scroll: 303 ldy #<(_log_display+40) 304 mva:rne _log_display&$ff00,y +(_log_display&$ff00)-40,y+ 305 mva:rne $100+(_log_display&$ff00),y $100+(_log_display&$ff00)-40,y+ 306 mva:rne $200+(_log_display&$ff00),y $200+(_log_display&$ff00)-40,y+ 307 mva:rne $300+(_log_display&$ff00),y $300+(_log_display&$ff00)-40,y+ 308 309 mva #$d8 _log_curln 310 dec _log_curln+1 311 312 jsr _log_clearline 313 no_scroll: 314 ;check if paging is enabled 315 bit _log_flags 316 bpl done 317 318 ;check if we've done a page 319 inc _log_lncnt 320 lda _log_lncnt 321 cmp #21 322 bcc done 323 mva #0 _log_lncnt 324 325 ldy #9 326 more_loop: 327 lda more_msg-2,y 328 sta (_log_curln),y 329 dey 330 cpy #1 331 bne more_loop 332 333 jsr _waitKey 334 jsr _log_clearline 335 jmp done 336 337 more_msg: 338 dta "--More--" 339 340 conv_tab: 341 dta $40 342 dta $20 343 dta $60 344 dta $00 345 .endp 346 347 ;======================================================================= 348 .nowarn .proc _log_imprint 349 pla 350 sta _log_srcptr 351 pla 352 sta _log_srcptr+1 353 print_entry: 354 jsr _log_printm1 355 lda _log_srcptr+1 356 pha 357 lda _log_srcptr 358 pha 359 rts 360 .endp 361 362 ;======================================================================= 363 = 27A2 _log_print = _log_printm1.alt_entry 364 365 .nowarn .proc _log_printm1 366 ldx #0 367 prloop: 368 inw _log_srcptr 369 prloop1: 370 lda (_log_srcptr,x) 371 beq done 372 jsr _log_putchar 373 jmp prloop 374 alt_entry: 375 ldx #0 376 beq prloop1 377 done: 378 rts 379 .endp 380 381 ;======================================================================= 382 .nowarn .proc _log_imprintf 383 pla 384 tax 385 pla 386 tay 387 inx 388 sne:iny 389 txa 390 jsr _log_printf 391 lda a0+1 392 pha 393 lda a0 394 pha 395 rts 396 .endp 397 398 ;======================================================================= 399 .nowarn .proc _log_printf 400 sta a0 401 sty a0+1 402 ldy #0 403 sty d0 404 405 charloop: 406 lda (a0),y 407 beq done 408 inw a0 409 cmp #'%' 410 beq special 411 escaped: 412 jsr _log_putchar 413 nextchar: 414 ldy #0 415 beq charloop 416 417 done: 418 rts 419 420 special: 421 inc d0 422 ldx d0 423 lda (a0),y 424 inw a0 425 cmp #'d' 426 bne notdec 427 tya 428 sty a1 429 ldy #6 430 sei 431 sed 432 decloop1: 433 rol d0,x 434 adc a1 435 sta a1 436 dey 437 bne decloop1 438 sty a1+1 439 ldy #2 440 decloop2: 441 rol d0,x 442 adc a1 443 sta a1 444 rol a1+1 445 dey 446 bne decloop2 447 cld 448 cli 449 lda a1+1 450 beq decdigit2 451 tax 452 lda _hexdig,x 453 jsr putbyte 454 lda a1 455 jmp puthex_nextchar 456 457 decdigit2: 458 lda a1 459 cmp #$10 460 bcc decdigit1 461 jmp puthex_nextchar 462 463 decdigit1: 464 tax 465 lda _hexdig,x 466 jmp escaped 467 468 notdec: 469 cmp #'x' 470 bne nothex 471 lda d0,x 472 jmp puthex_nextchar 473 474 nothex: 475 cmp #'X' 476 bne nothexword 477 inc d0 478 lda d1,x 479 jsr puthex 480 ldx d0 481 lda d0-1,x 482 jmp puthex_nextchar 483 484 nothexword: 485 cmp #'D' 486 bne notdecword 487 488 ldy #8 489 lda #0 490 sta a1 491 sta a1+1 492 sta a2 493 sei 494 sed 495 decword1: 496 rol d1,x 497 lda a1 498 adc a1 499 sta a1 500 lda a1+1 501 adc a1+1 502 sta a1+1 503 dey 504 bne decword1 505 506 ldy #8 507 decword2: 508 rol d0,x 509 lda a1 510 adc a1 511 sta a1 512 lda a1+1 513 adc a1+1 514 sta a1+1 515 lda a2 516 adc a2 517 sta a2 518 dey 519 bne decword2 520 cld 521 cli 522 523 tax 524 beq decword3 525 jsr puthexcond 526 527 lda a1+1 528 jsr puthex 529 lda a1 530 jmp puthex_nextchar 531 532 decword3: 533 lda a1+1 534 beq decword4 535 jsr puthexcond 536 lda a1 537 puthex_nextchar: 538 jsr puthex 539 jmp nextchar 540 541 decword4: 542 lda a1 543 jsr puthexcond 544 jmp nextchar 545 546 notdecword: 547 cmp #'c' 548 bne notchar 549 lda d0,x 550 jsr putbyte 551 strdone: 552 jmp nextchar 553 554 notchar: 555 cmp #'s' 556 bne notstr 557 558 inc d0 559 lda d0,x 560 sta a1 561 lda d0+1,x 562 sta a1+1 563 564 strloop: 565 ldy #0 566 lda (a1),y 567 beq strdone 568 jsr _log_putchar 569 inw a1 570 jmp strloop 571 572 notstr: 573 cmp #'f' 574 bne notfloat 575 576 inc d0 577 lda d0+1,x 578 tay 579 lda d0,x 580 tax 581 jsr fld0r 582 jsr fasc 583 ldx inbuff 584 nextfloatchar: 585 lda +(lbuff&$ff00),x 586 inx 587 pha 588 and #$7f 589 jsr _log_putchar 590 pla 591 bpl nextfloatchar 592 jmp nextchar 593 594 notfloat: 595 dec d0 596 jmp escaped 597 598 puthexcond: 599 cmp #$10 600 bcs puthex 601 tax 602 lda _hexdig,x 603 jmp putbyte 604 605 puthex: 606 pha 607 lsr 608 lsr 609 lsr 610 lsr 611 tax 612 lda _hexdig,x 613 jsr putbyte 614 pla 615 and #$0f 616 tax 617 lda _hexdig,x 618 putbyte: 619 tax 620 jsr _log_putchar 621 txa 622 rts 623 .endp 624 625 ;========================================================================== 626 .nowarn .proc _waitKey 627 lda #$ff 628 sta ch 629 sta ch1 630 cmp:req ch 631 rts 632 .endp 633 634 ;========================================================================== 635 .nowarn .proc _waitKeyPrompt 636 jsr _log_imprint 637 dta c"Press a key...",0 638 jsr _waitKey 639 jsr _log_imprint 640 dta $9c,0 641 rts 642 .endp 643 644 ;========================================================================== 645 ; _load_seg 646 ; 647 ; Module loader. 648 ; 649 ; X:A = address of filename to load 650 ; 651 .nowarn .proc _load_seg 652 ;open IOCB #1 653 sta icbal+$10 654 stx icbah+$10 655 lda #$04 656 sta icax1+$10 657 lda #CIOCmdOpen 658 jsr do_io 659 bmi other_fail 660 661 ;begin relocation 662 mwa #definit runad 663 664 relocloop: 665 ;load starting address 666 mwa #a0 icbal+$10 667 jsr load_two 668 bmi startaddr_fail 669 670 ;check for $FFFF signature 671 lda a0 672 and a0+1 673 cmp #$ff 674 beq relocloop 675 676 ;load ending address 677 mwa #a1 icbal+$10 678 jsr load_two 679 bmi other_fail 680 681 ;compute length and load 682 sbw a1 a0 icbll+$10 683 inw icbll+$10 684 mwa a0 icbal+$10 685 jsr load_bytes 686 bmi other_fail 687 688 ;init a segment 689 mwa #definit initad 690 jsr doinit 691 jmp relocloop 692 693 startaddr_fail: 694 cpy #CIOStatEndOfFile 695 bne other_fail 696 ldy #1 697 other_fail: 698 ;save status 699 sty a0 700 701 ;close IOCB #1 702 lda #CIOCmdClose 703 jsr do_io 704 705 ;restore status and exit 706 ldy a0 707 rts 708 709 load_two: 710 mwa #2 icbll+$10 711 load_bytes: 712 lda #CIOCmdGetChars 713 do_io: 714 sta iccmd+$10 715 ldx #$10 716 jmp ciov 717 718 doinit: 719 jmp (initad) 720 721 definit: 722 rts 723 724 .endp 725 726 ;========================================================================== 727 ; _run_seg 728 ; 729 ; Module relocator and executor. 730 ; 731 ; The last segment loaded by _load_seg is relocated and executed. 732 ; 733 .nowarn .proc _run_seg 734 jmp (runad) 735 .endp 736 737 ;======================================================================= 738 .nowarn .proc _Exec 739 jsr _load_seg 740 jmp _run_seg 741 .endp 742 743 ;======================================================================= 744 .nowarn .proc _ExecMenu 745 ldx #>menu_exe 746 lda #$2c00 810 .error 'Library too long: ',*,' > $2C00' 811 .endif 812 813 opt o+ 2 icl 'kerneldb.inc' Source: kerneldb.inc 1 ; Altirra AcidOS test suite 2 ; Copyright (C) 2013 Avery Lee, All Rights Reserved. 3 ; 4 ; Permission is hereby granted, free of charge, to any person obtaining a copy 5 ; of this software and associated documentation files (the "Software"), to deal 6 ; in the Software without restriction, including without limitation the rights 7 ; to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 ; copies of the Software, and to permit persons to whom the Software is 9 ; furnished to do so, subject to the following conditions: 10 ; 11 ; The above copyright notice and this permission notice shall be included in 12 ; all copies or substantial portions of the Software. 13 ; 14 ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 ; IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 ; FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 ; AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 ; LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 ; OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 ; SOFTWARE. 21 22 .ifndef f_KERNELDB_INC 23 .def f_KERNELDB_INC 24 25 casini = $0002 ;cassette initialization vector 26 ramlo = $0004 ; 27 tramsz = $0006 ;temporary ram size / cart A flag 28 tstdat = $0007 ;RAM test data register / cart B flag 29 warmst = $0008 ;warmstart flag 30 boot? = $0009 ;boot flag; 0 if none, 1 for disk, 2 for cassette 31 dosvec = $000a 32 dosini = $000c 33 appmhi = $000e 34 pokmsk = $0010 35 brkkey = $0011 ;set on [BREAK] 36 rtclok = $0012 37 bufadr = $0015 ;indirect buffer address pointer (temp for disk buffer) 38 ; $0016 39 iccomt = $0017 ;CIO: command byte 40 ziocb = $0020 ;zero-page IOCB 41 ichidz = $0020 ;Zero page IOCB: device index ($FF = not open) 42 icdnoz = $0021 ;Zero page IOCB: device number 43 iccomz = $0022 ;Zero page IOCB: command byte 44 icstaz = $0023 ;Zero page IOCB: status byte 45 icbalz = $0024 ;Zero page IOCB: address of device/filename spec lo 46 icbahz = $0025 ;Zero page IOCB: address of device/filename spec hi 47 icptlz = $0026 ;Zero page IOCB: put byte address lo (-1) 48 icpthz = $0027 ;Zero page IOCB: put byte address hi (-1) 49 icbllz = $0028 ;Zero page IOCB: buffer length/byte count lo (-1) 50 icblhz = $0029 ;Zero page IOCB: buffer length/byte count hi (-1) 51 icax1z = $002a ;Zero page IOCB: device-specific information 1 52 icax2z = $002b ;Zero page IOCB: device-specific information 2 53 icax3z = $002c ;Zero page IOCB: device-specific information 3 54 icax4z = $002d ;Zero page IOCB: device-specific information 4 55 icax5z = $002e ;Zero page IOCB: device-specific information 5 56 icidno = $002e ;CIO: call X register save/restore 57 icax6z = $002f ;Zero page IOCB: device-specific information 6 58 ciochr = $002f ;CIO: call A register save/restore 59 status = $0030 ;SIO: temporay status byte 60 chksum = $0031 ;SIO: temporary checksum byte (used by IRQ routines) 61 bufrlo = $0032 ;SIO: buffer pointer lo (incremented by IRQ routines) 62 bufrhi = $0033 ;SIO: buffer pointer hi (incremented by IRQ routines) 63 bfenlo = $0034 ;SIO: buffer end lo 64 bfenhi = $0035 ;SIO: buffer end hi 65 ltemp = $0036 ;Relocating loader: loader temp address (XL/XE) 66 ; $0037 67 bufrfl = $0038 ;SIO: buffer full flag 68 recvdn = $0039 ;SIO: receive completed flag 69 xmtdon = $003a ;SIO: transmit completed flag 70 chksnt = $003b ;SIO: checksum sent flag 71 nocksm = $003c ;SIO: no-checksum flag 72 bptr = $003d ;Cassette: Buffer pointer 73 ftype = $003e ;Cassette: Interrecord gap (IRG) type; bit7=1 means continuous mode 74 feof = $003f ;Cassette: EOF flag 75 soundr = $0041 ;SIO: noisy audio flag 76 critic = $0042 ;critical flag for vbi 77 zchain = $004a ;Peripheral Handler: zero-page chain address 78 ; $004b 79 atract = $004d ;screen attract counter 80 drkmsk = $004e ;screen attract mask 81 colrsh = $004f ;screen attract color shift 82 tmpchr = $0050 ;Screen Editor 83 hold1 = $0051 ;Display/Editor: temporary storage 84 lmargn = $0052 ;left margin column 85 rmargn = $0053 ;right margin column 86 rowcrs = $0054 ;cursor row 87 colcrs = $0055 ;cursor column 88 ; $0056 89 dindex = $0057 ;display mode index 90 savmsc = $0058 ;lowest address of screen region 91 oldrow = $005a ; 92 oldcol = $005b ; 93 oldchr = $005d ;cursor character save/restore 94 oldadr = $005e ;cursor memory address 95 ; $005f 96 palnts = $0062 ;PAL/NTSC flag 97 logcol = $0063 ;Display/Editor: Logical column (0-119) 98 adress = $0064 ;temporary storage (display code) 99 ; $0065 100 toadr = $0066 ;temporary storage (display code) 101 ; $0067 102 frmadr = $0068 ;temporary storage (display code) 103 ; $0069 104 ramtop = $006a ;ram size 105 bufcnt = $006b 106 bufstr = $006c ;row/column of start of logical line 107 bitmsk = $006e ;Screen Editor 108 shfamt = $006f ;Screen Editor 109 rowac = $0070 ;Screen Editor: line drawing 110 ; $0071 ; 111 colac = $0072 ;Screen Editor: line drawing 112 ; $0073 ; 113 endpt = $0074 ;Screen Editor: line drawing 114 ; $0075 ; 115 deltar = $0076 ;Screen Editor: delta row (line drawing) 116 deltac = $0077 ;Screen Editor: delta column (line drawing) 117 ; $0078 ; 118 keydef = $0079 ;XL/XE: Keyboard definition table 119 ; $007a 120 swpflg = $007b ;current display var state ($00 = main, $FF = split screen) 121 holdch = $007c ;temporary key hold area prior to shift/control lock logic 122 countr = $007e ;Screen Editor: line length 123 ; $007f 124 fr0 = $00d4 ;FP: Accumulator 0 125 _fr3 = $00da ;FP: Accumulator 4 126 fr1 = $00e0 ;FP: Accumulator 1 127 _fr2 = $00e6 ;FP: Accumulator 2 128 _fpres2 = $00ef ;BASIC: Used in sqr() routine -- must not be touched by FP code 129 _fpres = $00f0 ;BASIC: Used in sin() routine -- must not be touched by FP code 130 cix = $00f2 ;FP: Character index 131 inbuff = $00f3 ;FP: ASCII conversion buffer 132 ; $00f4 133 _fpcount= $00f5 134 _fptemp0= $00f6 135 _fptemp1= $00f7 136 flptr = $00fc ;FP: pointer for floating-point loads and stores 137 _flptr2 = $00fe 138 139 vdslst = $0200 ;display list interrupt vector 140 vprced = $0202 ;serial bus proceed interrupt vector 141 vinter = $0204 ;serial bus interrupt vector 142 vbreak = $0206 ;BRK instruction vector 143 vkeybd = $0208 ;keyboard interrupt vector 144 vserin = $020a ;serial input ready interrupt vector 145 vseror = $020c ;serial output ready interrupt vector 146 vseroc = $020e ;serial output completed interrupt vector 147 vtimr1 = $0210 ;pokey timer 1 interrupt vector 148 vtimr2 = $0212 ;pokey timer 2 interrupt vector 149 vtimr4 = $0214 ;pokey timer 4 interrupt vector 150 vimirq = $0216 ;immediate IRQ vector 151 cdtmv1 = $0218 ;countdown timer 1 152 cdtmv2 = $021a ;countdown timer 2 153 cdtmv3 = $021c ;countdown timer 3 154 cdtmv4 = $021e ;countdown timer 4 155 cdtmv5 = $0220 ;countdown timer 5 156 vvblki = $0222 ;vertical blank immediate vector 157 vvblkd = $0224 ;vertical blank deferred vector 158 cdtma1 = $0226 ;timer 1 vector 159 cdtma2 = $0228 ;timer 2 vector 160 cdtmf3 = $022a ;timer 3 flag 161 srtimr = $022b ;autorepeat timer 162 cdtmf4 = $022c ;timer 4 flag 163 intemp = $022d ;temp value used by SETVBV 164 cdtmf5 = $022e ;timer 5 flag 165 sdmctl = $022f ;shadow for DMACTL ($D400) 166 sdlstl = $0230 ;shadow for DLISTL ($D402) 167 sdlsth = $0231 ;shadow for DLISTH ($D403) 168 sskctl = $0232 ;shadow for SKCTL ($D20F) 169 lcount = $0233 ;Relocating loader: (XL/XE) 170 lpenh = $0234 ;light pen horizontal pos 171 lpenv = $0235 ;light pen vertical pos 172 brkky = $0236 ;break key interrupt vector (OS B+ only) 173 reladr = $0238 ;Relocating loader: temp address (XL/XE) 174 ; $0239 175 cdevic = $023a ;SIO: command frame device ID 176 ccomnd = $023b ;SIO: command frame command ID 177 caux1 = $023c ;SIO: command aux byte 1 178 caux2 = $023d ;SIO: command aux byte 2 179 temp = $023e ;SIO: temp space 180 errflg = $023f ;SIO: error flag 181 dflags = $0240 ;disk boot flags 182 dbsect = $0241 ;disk boot sector count 183 bootad = $0242 ;disk boot address 184 coldst = $0244 ;cold start flag 185 reclen = $0245 ;Relocating loader: record length (XL/XE) 186 dsktim = $0246 ;Disk Handler: Disk operation timeout 187 pdvmsk = $0247 ;PBI device mask (XL/XE) 188 shpdvs = $0248 ;PBI device selection register shadow ($D1FF) (XL/XE) 189 fine = $026e ;fine scrolling flag (XL/XE) 190 gprior = $026f ;shadow for PRIOR ($D01B) 191 paddl0 = $0270 ;shadow for POT0 ($D200) 192 paddl1 = $0271 ;shadow for POT1 ($D201) 193 paddl2 = $0272 ;shadow for POT2 ($D202) 194 paddl3 = $0273 ;shadow for POT3 ($D203) 195 paddl4 = $0274 ;shadow for POT4 ($D204) 196 paddl5 = $0275 ;shadow for POT5 ($D205) 197 paddl6 = $0276 ;shadow for POT6 ($D206) 198 paddl7 = $0277 ;shadow for POT7 ($D207) 199 stick0 = $0278 ;shadow for PORTA lo ($D300) 200 stick1 = $0279 ;shadow for PORTA hi ($D300) 201 stick2 = $027A ;shadow for PORTB lo ($D302) 202 stick3 = $027B ;shadow for PORTB hih ($D302) 203 ptrig0 = $027c ;paddle trigger 0 204 ptrig1 = $027d ;paddle trigger 1 205 ptrig2 = $027e ;paddle trigger 2 206 ptrig3 = $027f ;paddle trigger 3 207 ptrig4 = $0280 ;paddle trigger 4 208 ptrig5 = $0281 ;paddle trigger 5 209 ptrig6 = $0282 ;paddle trigger 6 210 ptrig7 = $0283 ;paddle trigger 7 211 strig0 = $0284 ;shadow for TRIG0 ($D001) 212 strig1 = $0285 ;shadow for TRIG1 ($D002) 213 strig2 = $0286 ;shadow for TRIG2 ($D003) 214 strig3 = $0287 ;shadow for TRIG3 ($D004) 215 hibyte = $0288 ;Relocating loader (XL/XE) 216 wmode = $0289 ;Cassette: Write mode (00 = read, 80 = write) 217 blim = $028a ;Cassette: Buffer limit 218 jveck = $028c ;XL/XE: IRQ jump vector 219 newadr = $028e ;Relocating loader (XL/XE) 220 txtrow = $0290 221 txtcol = $0291 222 ; $0292 223 tindex = $0293 ;text mode index 224 txtmsc = $0294 ;text window pointer 225 ; $0295 226 cretry = $029c ;SIO: command retries (XL/XE) 227 hold3 = $029d ;Screen Editor 228 hold2 = $029f ;Screen Editor 229 dmask = $02a0 ;Display/Editor: Graphics merge mask 230 tmplbt = $02a1 231 escflg = $02a2 ;Display/Editor: Escape next character 232 tabmap = $02a3 ;Display/Editor: Bitfield indicating tabs (note reversed bit positions) 233 logmap = $02b2 ;Display/Editor: Logical line start map (4 bytes) 234 tmprow = $02b8 ;Screen Editor 235 tmpcol = $02b9 ;Screen Editor 236 ; $02ba 237 scrflg = $02bb ;Display/Editor: Scroll counter 238 hold4 = $02bc ;Screen Editor 239 dretry = $02bd ;SIO: device retries (XL/XE) 240 shflok = $02be ;shift/control lock flags 241 botscr = $02bf ;number of text rows in text window 242 pcolr0 = $02c0 ;shadow for COLPM0 ($D012) 243 pcolr1 = $02c1 ;shadow for COLPM1 ($D013) 244 pcolr2 = $02c2 ;shadow for COLPM2 ($D014) 245 pcolr3 = $02c3 ;shadow for COLPM3 ($D015) 246 color0 = $02c4 ;shadow for COLPF0 ($D016) 247 color1 = $02c5 ;shadow for COLPF1 ($D017) 248 color2 = $02c6 ;shadow for COLPF2 ($D018) 249 color3 = $02c7 ;shadow for COLPF3 ($D019) 250 color4 = $02c8 ;shadow for COLBK ($D01A) 251 runadr = $02c9 ;Relocating loader: run address (XL/XE) 252 ; $02ca 253 hiused = $02cb ;Relocating loader: Next available memory location (out) (XL/XE) 254 ; $02cc 255 zhiuse = $02cd ;Relocating loader: Next available zero-page address (out) (XL/XE) 256 ; $02ce 257 gbytea = $02cf ;Relocating loader: GET BYTE address (XL/XE) 258 ; $02d0 259 loadad = $02d1 ;Relocating loader: Load address (XL/XE) 260 ; $02d2 261 zloada = $02d3 ;Relocating loader: Zero-page load address (XL/XE) 262 ; $02d4 263 dsctln = $02d5 ;Disk sector size (XL/XE) 264 pbpnt = $02de ;Printer: Buffer index (XL/XE location) 265 pbufsz = $02df ;Printer: Record size (XL/XE location) 266 runad = $02e0 267 initad = $02e2 268 ramsiz = $02e4 ;ram size in pages 269 memtop = $02e5 ;highest location for programs and data 270 memlo = $02e7 ;base of application memory 271 hndlod = $02e9 ;CIO: Handler load flag (XL/XE) 272 dvstat = $02ea ;DISK: Status request buffer area (4 bytes) 273 ; $02eb 274 ; $02ec 275 ; $02ed 276 crsinh = $02f0 ;Display/Editor: cursor inhibit flag 277 keydel = $02f1 ;keyboard debounce delay (set to 3 vblanks per key) 278 ch1 = $02f2 ;last keyboard code read 279 chact = $02f3 ;shadow for CHACTL ($D401) 280 chbas = $02f4 ;shadow for CHBASE ($D409) 281 rowinc = $02f8 ;Screen Editor: row direction (XL/XE location) 282 colinc = $02f9 ;Screen Editor: col direction (XL/XE location) 283 atachr = $02fb ;Screen Editor 284 ch = $02fc ;keyboard FIFO byte 285 fildat = $02fd ;Screen Editor: fill color 286 dspflg = $02fe ;enable/disable of control codes by screen editor (E:) 287 ssflag = $02ff ;display/screen editor suspend flag 288 ddevic = $0300 ;serial bus ID 289 dunit = $0301 ;device number 290 dcomnd = $0302 ;command byte 291 dstats = $0303 ;status byte 292 dbuflo = $0304 ;buffer address lo 293 dbufhi = $0305 ;buffer address hi 294 dtimlo = $0306 ;disk timeout value 295 dbytlo = $0308 ;byte count lo 296 dbythi = $0309 ;byte count hi 297 daux1 = $030a ;sector number lo 298 daux2 = $030b ;sector number hi 299 timer1 = $030c ;SIO: baud rate determination - first timer value 300 addcor = $030e ;SIO: baud rate determination - correction value 301 casflg = $030f ;SIO: cassette I/O flag (0=normal, nonzero=cassette) 302 timer2 = $0310 ;SIO: baud rate determination - second timer value 303 temp1 = $0312 ;SIO: baud rate determination - temp 304 ; $0313 305 ptimot = $0314 ;Printer: Timeout (XL/XE location) 306 temp3 = $0315 ;SIO: baud rate determination - temp 307 timflg = $0317 ;SIO: operation timeout flag (set by countdown timer 1 IRQ) 308 stackp = $0318 ;SIO: stack pointer save 309 hatabs = $031a ;handler table 310 pupbt1 = $033d ;(XL/XE) Power-up boot flag #1 - $5C 311 pupbt2 = $033e ;(XL/XE) Power-up boot flag #2 - $93 312 pupbt3 = $033f ;(XL/XE) Power-up boot flag #3 - $25 313 ichid = $0340 ;IOCB #0 handler ID 314 icdno = $0341 ;IOCB #0 device number 315 iccmd = $0342 ;IOCB #0 command byte 316 icsta = $0343 ;IOCB #0 status 317 icbal = $0344 ;IOCB #0 buffer address lo 318 icbah = $0345 ;IOCB #0 buffer address hi 319 icptl = $0346 ;IOCB #0 PUT address lo 320 icpth = $0347 ;IOCB #0 PUT address hi 321 icbll = $0348 ;IOCB #0 buffer length/byte count lo 322 icblh = $0349 ;IOCB #0 buffer length/byte count hi 323 icax1 = $034a ;IOCB #0 auxiliary information lo 324 icax2 = $034b ;IOCB #0 auxiliary information hi 325 icax3 = $034c ; 326 icax4 = $034d ; 327 icax5 = $034e ; 328 icax6 = $034f ; 329 prnbuf = $03c0 ;printer buffer 330 ckey = $03e9 ;cassette boot key 331 basicf = $03f8 ;XL/XE: ROM BASIC flag. 0 = enabled 332 gintlk = $03fa ;XL/XE: Cartridge interlock (clone of TRIG3). 333 chlink = $03fb ;XL/XE: Relocated loader chain 334 casbuf = $03fd ;Cassette buffer (03FD-047F) 335 lbuff = $0580 ; 336 plyarg = $05e0 ;FP: Polynomial evaluation temp register 337 338 afp equ $d800 339 fasc equ $d8e6 340 ipf equ $d9aa 341 fpi equ $d9d2 342 zfr0 equ $da44 343 zf1 equ $da46 344 fsub equ $da60 345 fadd equ $da66 346 fmul equ $dadb 347 fdiv equ $db28 348 plyevl equ $dd40 349 fld0r equ $dd89 350 fld0p equ $dd8d 351 fld1r equ $dd98 352 fld1p equ $dd9c 353 fst0r equ $dda7 354 fst0p equ $ddab 355 fmove equ $ddb6 356 exp equ $ddc0 357 exp10 equ $ddcc 358 log equ $decd 359 log10 equ $ded1 360 361 dskinv = $e453 362 ciov = $e456 363 setvbv = $e45c 364 sysvbv = $e45f 365 xitvbv = $e462 366 367 .endif 3 icl 'cio.inc' Source: cio.inc 1 ; Altirra - Atari 800/800XL/5200 emulator 2 ; Modular Kernel ROM - Character Input/Output Definitions 3 ; Copyright (C) 2008-2012 Avery Lee 4 ; 5 ; This program is free software; you can redistribute it and/or modify 6 ; it under the terms of the GNU General Public License as published by 7 ; the Free Software Foundation; either version 2 of the License, or 8 ; (at your option) any later version. 9 ; 10 ; This program is distributed in the hope that it will be useful, 11 ; but WITHOUT ANY WARRANTY; without even the implied warranty of 12 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 ; GNU General Public License for more details. 14 ; 15 ; You should have received a copy of the GNU General Public License 16 ; along with this program; if not, write to the Free Software 17 ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 18 19 .ifndef f_CIO_INC 20 .def f_CIO_INC 21 22 CIOStatBreak = $80 ;break key abort 23 CIOStatIOCBInUse = $81 ;IOCB in use 24 CIOStatUnkDevice = $82 ;unknown device 25 CIOStatWriteOnly = $83 ;opened for write only 26 CIOStatInvalidCmd = $84 ;invalid command 27 CIOStatNotOpen = $85 ;device or file not open 28 CIOStatInvalidIOCB = $86 ;invalid IOCB number 29 CIOStatReadOnly = $87 ;opened for read only 30 CIOStatEndOfFile = $88 ;end of file reached 31 CIOStatTruncRecord = $89 ;record truncated 32 CIOStatTimeout = $8A ;device timeout 33 CIOStatNAK = $8B ;device NAK 34 CIOStatSerFrameErr = $8C ;serial bus framing error 35 CIOStatCursorRange = $8D ;cursor out of range 36 CIOStatSerOverrun = $8E ;serial frame overrun error 37 CIOStatSerChecksum = $8F ;serial checksum error 38 CIOStatDeviceDone = $90 ;device done error 39 CIOStatBadScrnMode = $91 ;bad screen mode 40 CIOStatNotSupported = $92 ;function not supported by handler 41 CIOStatOutOfMemory = $93 ;not enough memory 42 CIOStatDriveNumErr = $A0 ;disk drive # error 43 CIOStatTooManyFiles = $A1 ;too many open disk files 44 CIOStatDiskFull = $A2 ;disk full 45 CIOStatFatalDiskIO = $A3 ;fatal disk I/O error 46 CIOStatFileNumDiff = $A4 ;internal file # mismatch 47 CIOStatFileNameErr = $A5 ;filename error 48 CIOStatPointDLen = $A6 ;point data length error 49 CIOStatFileLocked = $A7 ;file locked 50 CIOStatInvDiskCmd = $A8 ;invalid command for disk 51 CIOStatDirFull = $A9 ;directory full (64 files) 52 CIOStatFileNotFound = $AA ;file not found 53 CIOStatInvPoint = $AB ;invalid point 54 55 CIOCmdOpen = $03 56 CIOCmdGetRecord = $05 57 CIOCmdGetChars = $07 58 CIOCmdPutRecord = $09 59 ; $0A ;PUT CHARS alias (required by K-Razy Shoot Out) 60 CIOCmdPutChars = $0B 61 CIOCmdClose = $0C 62 CIOCmdGetStatus = $0D 63 CIOCmdSpecial = $0E ;$0E and up is escape 64 65 .endif 4 5 org $2c00 6 7 ;========================================================================== 8 .proc main 9 FFFF> 2C00-2D55> 20 80 + jsr _log_imprint 10 2C03 7D dta $7d 11 2C04 C1 E3 E9 E4 CF D3 + dta 'AcidOS test options'*,$9B 12 2C18 4D 20 2D 20 4D 61 + dta 'M - Manual tests',$9B 13 2C29 50 20 2D 20 50 61 + dta 'P - Paged display [' 14 2C3C 00 dta 0 15 16 2C3D A2 00 ldx #0 17 2C3F A9 80 lda #LOGF_PAGING 18 2C41 24 C6 bit _log_flags 19 2C43 F0 01 E8 seq:inx 20 21 2C46 BD 4B 2D 85 C3 mva msg_on_off_lo,x _log_srcptr 22 2C4B BD 4D 2D 85 C4 mva msg_on_off_hi,x _log_srcptr+1 23 2C50 20 A2 27 jsr _log_print 24 25 2C53 20 80 27 jsr _log_imprint 26 2C56 5D 9B dta ']',$9B 27 2C58 58 20 2D 20 45 78 + dta 'X - Exit and run tests',$9B 28 2C6F 9B dta $9B 29 2C70 00 dta 0 30 31 2C71 20 26 2D jsr Getchar 32 2C74 29 DF and #$df 33 2C76 C9 4D cmp #'M' 34 2C78 D0 06 bne not_m 35 2C7A 20 94 2C jsr ManualTestMenu 36 2C7D 4C 00 2C jmp main 37 2C80 not_m: 38 2C80 C9 58 cmp #'X' 39 2C82 D0 03 bne not_x 40 2C84 4C F2 29 jmp _ExecMenu 41 2C87 not_x: 42 2C87 C9 50 cmp #'P' 43 2C89 D0 06 bne not_p 44 2C8B A9 80 lda #LOGF_PAGING 45 2C8D 45 C6 eor _log_flags 46 2C8F 85 C6 sta _log_flags 47 2C91 not_p: 48 2C91 4C 00 2C jmp main 49 .endp 50 51 ;========================================================================== 52 2C94 .proc ManualTestMenu 53 2C94 20 80 27 jsr _log_imprint 54 2C97 7D dta $7D 55 2C98 C1 E3 E9 E4 CF D3 + dta 'AcidOS manual tests'*,$9B 56 2CAC 43 20 2D 20 43 6F + dta 'C - Controller',$9B 57 2CBB 44 20 2D 20 44 69 + dta 'D - Disk',$9B 58 2CC4 58 20 2D 20 45 78 + dta 'X - Exit',$9B 59 2CCD 9B dta $9B 60 2CCE 00 dta 0 61 62 2CCF 20 26 2D jsr Getchar 63 2CD2 29 DF and #$df 64 2CD4 C9 58 cmp #'X' 65 2CD6 D0 01 bne not_x 66 2CD8 60 rts 67 2CD9 not_x: 68 2CD9 A2 01 ldx #comtab_end-comtab-1 69 2CDB scan_loop: 70 2CDB DD 05 2D cmp comtab,x 71 2CDE F0 06 beq found_test 72 2CE0 CA dex 73 2CE1 10 F8 bpl scan_loop 74 2CE3 4C 94 2C jmp ManualTestMenu 75 76 2CE6 found_test: 77 2CE6 8A txa 78 2CE7 48 pha 79 2CE8 20 80 27 jsr _log_imprint 80 2CEB 9B dta $9B 81 2CEC 4C 6F 61 64 69 6E + dta 'Loading...',$9B 82 2CF7 00 dta 0 83 84 2CF8 68 pla 85 2CF9 AA tax 86 2CFA BC 07 2D ldy namlotab,x 87 2CFD BD 09 2D lda namhitab,x 88 2D00 AA tax 89 2D01 98 tya 90 2D02 4C EC 29 jmp _Exec 91 92 2D05 comtab: 93 2D05 43 dta 'C' 94 2D06 44 dta 'D' 95 2D07 comtab_end: 96 97 2D07 namlotab: 98 2D07 0B dta name_controller 103 2D0A 2D dta >name_disk 104 105 2D0B name_controller: 106 2D0B 44 3A 4D 43 4E 54 + dta 'D:MCNTROLR.EXE',$9B 107 108 2D1A name_disk: 109 2D1A 44 3A 4D 44 49 53 + dta 'D:MDISK.EXE',$9B 110 .endp 111 112 ;========================================================================== 113 2D26 .proc Getchar 114 2D26 20 80 27 jsr _log_imprint 115 2D29 41 63 69 64 4F 53 + dta 'AcidOS>' 116 2D30 00 dta 0 117 118 2D31 A2 40 ldx #$40 119 2D33 A9 00 lda #0 120 2D35 9D 48 03 sta icbll,x 121 2D38 9D 49 03 sta icblh,x 122 2D3B A9 07 9D 42 03 mva #CIOCmdGetChars iccmd,x 123 2D40 20 56 E4 jsr ciov 124 2D43 48 pha 125 2D44 20 80 27 jsr _log_imprint 126 2D47 9C 00 dta $9C,0 127 2D49 68 pla 128 2D4A 60 rts 129 .endp 130 131 ;========================================================================== 132 2D4B msg_on_off_lo: 133 2D4B 52 dta msg_off 138 2D4E 2D dta >msg_on 139 140 2D4F msg_on: 141 2D4F 4F 4E 00 dta 'ON',0 142 2D52 msg_off: 143 2D52 4F 46 46 00 dta 'OFF',0 144 145 ;========================================================================== 146 147 ;========================================================================== 148 149 02E0-02E1> 00 2C run main