From 85885001b133e2dc320b6f6459259afa69784ca8 Mon Sep 17 00:00:00 2001 From: Oliver Schmidt Date: Thu, 9 May 2013 13:56:54 +0200 Subject: [PATCH] Removed (pretty inconsistently used) tab chars from source code base. --- asminc/apple2.inc | 74 +- asminc/atari.inc | 1584 +-- asminc/c128.inc | 246 +- asminc/c64.inc | 246 +- asminc/cbm510.inc | 142 +- asminc/cbm610.inc | 18 +- asminc/ctype.inc | 26 +- asminc/em-kernel.inc | 64 +- asminc/errno.inc | 30 +- asminc/fcntl.inc | 12 +- asminc/joy-kernel.inc | 28 +- asminc/modload.inc | 2 +- asminc/mouse-kernel.inc | 60 +- asminc/nes.inc | 76 +- asminc/o65.inc | 20 +- asminc/pet.inc | 40 +- asminc/plus4.inc | 82 +- asminc/ser-kernel.inc | 70 +- asminc/smc.inc | 136 +- asminc/stdio.inc | 26 +- asminc/tgi-error.inc | 2 +- asminc/tgi-kernel.inc | 24 +- asminc/time.inc | 2 +- asminc/vic20.inc | 62 +- include/6502.h | 54 +- include/_6522.h | 34 +- include/_6525.h | 20 +- include/_6526.h | 36 +- include/_6545.h | 8 +- include/_6551.h | 12 +- include/_gtia.h | 4 +- include/_heap.h | 16 +- include/_mikey.h | 2 +- include/_pbi.h | 22 +- include/_pia.h | 4 +- include/_pokey.h | 4 +- include/_sid.h | 34 +- include/_suzy.h | 2 +- include/_ted.h | 4 +- include/_vdc.h | 8 +- include/_vic.h | 34 +- include/ace.h | 50 +- include/apple2.h | 8 +- include/apple2enh.h | 46 +- include/assert.h | 6 +- include/atari.h | 84 +- include/atmos.h | 100 +- include/c128.h | 94 +- include/c16.h | 4 +- include/c64.h | 100 +- include/cbm.h | 82 +- include/cbm264.h | 104 +- include/cbm510.h | 94 +- include/cbm610.h | 14 +- include/cc65.h | 2 +- include/conio.h | 6 +- include/ctype.h | 96 +- include/dbg.h | 10 +- include/dirent.h | 14 +- include/em.h | 2 +- include/em/em-kernel.h | 4 +- include/errno.h | 36 +- include/fcntl.h | 8 +- include/geos.h | 120 +- include/geos/gconst.h | 80 +- include/geos/gdisk.h | 68 +- include/geos/gdlgbox.h | 94 +- include/geos/gfile.h | 52 +- include/geos/ggraph.h | 196 +- include/geos/gmemory.h | 2 +- include/geos/gmenu.h | 58 +- include/geos/gprocess.h | 2 +- include/geos/gsprite.h | 110 +- include/geos/gstruct.h | 216 +- include/geos/gsym.h | 570 +- include/geos/gsys.h | 22 +- include/iso646.h | 26 +- include/joystick.h | 10 +- include/joystick/joy-kernel.h | 2 +- include/limits.h | 34 +- include/locale.h | 54 +- include/lynx.h | 2 +- include/mouse.h | 30 +- include/mouse/mouse-kernel.h | 2 +- include/nes.h | 4 +- include/o65.h | 38 +- include/pet.h | 6 +- include/plus4.h | 4 +- include/serial.h | 78 +- include/setjmp.h | 6 +- include/stdarg.h | 10 +- include/stdbool.h | 30 +- include/stddef.h | 8 +- include/stdio.h | 42 +- include/stdlib.h | 14 +- include/string.h | 6 +- include/supervision.h | 30 +- include/sys/types.h | 4 +- include/sys/utsname.h | 4 +- include/tgi.h | 2 +- include/tgi/tgi-error.h | 4 +- include/tgi/tgi-kernel.h | 4 +- include/tgi/tgi-vectorfont.h | 4 +- include/time.h | 36 +- include/unistd.h | 14 +- include/vic20.h | 62 +- libsrc/apple2/_scrsize.s | 8 +- libsrc/apple2/break.s | 114 +- libsrc/apple2/cclear.s | 16 +- libsrc/apple2/cgetc.s | 10 +- libsrc/apple2/chline.s | 42 +- libsrc/apple2/close.s | 30 +- libsrc/apple2/closedir.c | 2 +- libsrc/apple2/clrscr.s | 4 +- libsrc/apple2/color.s | 4 +- libsrc/apple2/cout.s | 18 +- libsrc/apple2/cputc.s | 2 +- libsrc/apple2/ctype.s | 260 +- libsrc/apple2/cvline.s | 36 +- libsrc/apple2/devicedir.s | 84 +- libsrc/apple2/dioclose.s | 8 +- libsrc/apple2/diocommon.s | 28 +- libsrc/apple2/dioopen.s | 30 +- libsrc/apple2/dioread.s | 12 +- libsrc/apple2/diosectcount.s | 82 +- libsrc/apple2/diosectsize.s | 10 +- libsrc/apple2/diowrite.s | 12 +- libsrc/apple2/dir.h | 16 +- libsrc/apple2/dosdetect.s | 6 +- libsrc/apple2/emd/a2.auxmem.s | 254 +- libsrc/apple2/exec.s | 216 +- libsrc/apple2/exehdr.s | 8 +- libsrc/apple2/extra/iobuf-0800.s | 36 +- libsrc/apple2/filedes.s | 40 +- libsrc/apple2/filename.s | 102 +- libsrc/apple2/get_ostype.s | 48 +- libsrc/apple2/gotoxy.s | 6 +- libsrc/apple2/gotoy.s | 2 +- libsrc/apple2/home.s | 18 +- libsrc/apple2/initcwd.s | 38 +- libsrc/apple2/iobuf.s | 4 +- libsrc/apple2/joy/a2.stdjoy.s | 72 +- libsrc/apple2/joy_stat_stddrv.s | 10 +- libsrc/apple2/joy_stddrv.s | 8 +- libsrc/apple2/mainargs.s | 116 +- libsrc/apple2/mcbdefault.s | 148 +- libsrc/apple2/mli.inc | 20 +- libsrc/apple2/mli.s | 4 +- libsrc/apple2/mou/a2.stdmou.s | 594 +- libsrc/apple2/mouse_stat_stddrv.s | 10 +- libsrc/apple2/mouse_stddrv.s | 8 +- libsrc/apple2/open.s | 242 +- libsrc/apple2/opendir.c | 48 +- libsrc/apple2/oserrlist.s | 60 +- libsrc/apple2/oserror.s | 80 +- libsrc/apple2/randomize.s | 4 +- libsrc/apple2/rdkey.s | 18 +- libsrc/apple2/read.s | 110 +- libsrc/apple2/readdir.c | 36 +- libsrc/apple2/revers.s | 22 +- libsrc/apple2/rewinddir.c | 20 +- libsrc/apple2/rwcommon.s | 64 +- libsrc/apple2/ser/a2.ssc.s | 590 +- libsrc/apple2/syschdir.s | 36 +- libsrc/apple2/sysmkdir.s | 54 +- libsrc/apple2/sysremove.s | 28 +- libsrc/apple2/sysrename.s | 66 +- libsrc/apple2/sysrmdir.s | 2 +- libsrc/apple2/systime.s | 86 +- libsrc/apple2/targetutil/loader.cfg | 2 +- libsrc/apple2/targetutil/loader.s | 340 +- libsrc/apple2/textframe.s | 102 +- libsrc/apple2/tgi/a2.hi.s | 504 +- libsrc/apple2/tgi/a2.lo.s | 362 +- libsrc/apple2/tgi_colors.s | 6 +- libsrc/apple2/tgi_stat_stddrv.s | 10 +- libsrc/apple2/tgi_stddrv.s | 8 +- libsrc/apple2/toascii.s | 2 +- libsrc/apple2/videomode.s | 2 +- libsrc/apple2/vtabz.s | 18 +- libsrc/apple2/wherex.s | 6 +- libsrc/apple2/wherey.s | 8 +- libsrc/apple2/write.s | 118 +- libsrc/atari/_scrsize.s | 4 +- libsrc/atari/break.s | 124 +- libsrc/atari/cclear.s | 30 +- libsrc/atari/cgetc.s | 90 +- libsrc/atari/chline.s | 30 +- libsrc/atari/clock.s | 44 +- libsrc/atari/close.s | 36 +- libsrc/atari/clrscr.s | 56 +- libsrc/atari/color.s | 42 +- libsrc/atari/cputc.s | 136 +- libsrc/atari/crt0.s | 164 +- libsrc/atari/ctype.s | 514 +- libsrc/atari/cvline.s | 44 +- libsrc/atari/dio_cts.s | 72 +- libsrc/atari/dio_stc.s | 84 +- libsrc/atari/diopncls.s | 200 +- libsrc/atari/dioqsize.s | 30 +- libsrc/atari/dioread.s | 16 +- libsrc/atari/diowrite.s | 16 +- libsrc/atari/diowritev.s | 16 +- libsrc/atari/do_oserr.s | 8 +- libsrc/atari/dosdetect.s | 64 +- libsrc/atari/emd/atr130xe.s | 546 +- libsrc/atari/fd.inc | 26 +- libsrc/atari/fdtab.s | 32 +- libsrc/atari/fdtable.s | 514 +- libsrc/atari/fdtoiocb.s | 50 +- libsrc/atari/getargs.s | 178 +- libsrc/atari/getdefdev.s | 84 +- libsrc/atari/getfd.s | 70 +- libsrc/atari/gotox.s | 14 +- libsrc/atari/gotoxy.s | 22 +- libsrc/atari/gotoy.s | 10 +- libsrc/atari/graphics.s | 148 +- libsrc/atari/initcwd.s | 46 +- libsrc/atari/inviocb.s | 8 +- libsrc/atari/irq.s | 46 +- libsrc/atari/joy/atarimj8.s | 94 +- libsrc/atari/joy/ataristd.s | 88 +- libsrc/atari/joy_stat_stddrv.s | 4 +- libsrc/atari/joy_stddrv.s | 4 +- libsrc/atari/kbhit.s | 14 +- libsrc/atari/lseek.s | 320 +- libsrc/atari/mul40.s | 46 +- libsrc/atari/open.s | 244 +- libsrc/atari/oserrlist.s | 76 +- libsrc/atari/oserror.s | 158 +- libsrc/atari/ostype.s | 178 +- libsrc/atari/posixdirent.s | 258 +- libsrc/atari/randomize.s | 14 +- libsrc/atari/read.s | 256 +- libsrc/atari/revers.s | 36 +- libsrc/atari/rs232.s_ | 458 +- libsrc/atari/rwcommon.s | 62 +- libsrc/atari/savevec.s | 146 +- libsrc/atari/scroll.s | 268 +- libsrc/atari/setcolor.s | 54 +- libsrc/atari/siocall.s | 118 +- libsrc/atari/syschdir.s | 128 +- libsrc/atari/sysmkdir.s | 128 +- libsrc/atari/sysremove.s | 114 +- libsrc/atari/sysrmdir.s | 4 +- libsrc/atari/systime.s | 2 +- libsrc/atari/tgi/atari10.s | 80 +- libsrc/atari/tgi/atari11.s | 66 +- libsrc/atari/tgi/atari14.s | 88 +- libsrc/atari/tgi/atari15.s | 96 +- libsrc/atari/tgi/atari3.s | 96 +- libsrc/atari/tgi/atari4.s | 88 +- libsrc/atari/tgi/atari5.s | 96 +- libsrc/atari/tgi/atari6.s | 88 +- libsrc/atari/tgi/atari7.s | 96 +- libsrc/atari/tgi/atari8.s | 88 +- libsrc/atari/tgi/atari9.s | 66 +- libsrc/atari/tgi/atari_tgi_common.inc | 2142 ++-- libsrc/atari/tgi/atr10p2.s | 80 +- libsrc/atari/tgi/atr15p2.s | 96 +- libsrc/atari/tgi/atr8p2.s | 88 +- libsrc/atari/tgi/atr9p2.s | 66 +- libsrc/atari/tgi_colors.s | 6 +- libsrc/atari/tgi_stat_stddrv.s | 4 +- libsrc/atari/tgi_stddrv.s | 4 +- libsrc/atari/toascii.s | 6 +- libsrc/atari/tvtype.s | 22 +- libsrc/atari/ucase_fn.s | 130 +- libsrc/atari/wherex.s | 10 +- libsrc/atari/wherey.s | 10 +- libsrc/atari/write.s | 42 +- libsrc/atmos/_scrsize.s | 2 +- libsrc/atmos/atmos_load.s | 30 +- libsrc/atmos/atmos_save.s | 36 +- libsrc/atmos/cclear.s | 16 +- libsrc/atmos/cgetc.s | 6 +- libsrc/atmos/chline.s | 16 +- libsrc/atmos/clock.s | 8 +- libsrc/atmos/clrscr.s | 6 +- libsrc/atmos/color.s | 8 +- libsrc/atmos/cputc.s | 52 +- libsrc/atmos/crt0.s | 112 +- libsrc/atmos/ctype.s | 514 +- libsrc/atmos/cvline.s | 16 +- libsrc/atmos/gotox.s | 4 +- libsrc/atmos/gotoxy.s | 10 +- libsrc/atmos/gotoy.s | 4 +- libsrc/atmos/irq.s | 66 +- libsrc/atmos/joy/atmos-pase.s | 120 +- libsrc/atmos/joy_stat_stddrv.s | 4 +- libsrc/atmos/joy_stddrv.s | 4 +- libsrc/atmos/kbhit.s | 4 +- libsrc/atmos/mainargs.s | 116 +- libsrc/atmos/oserrlist.s | 60 +- libsrc/atmos/oserror.s | 12 +- libsrc/atmos/revers.s | 26 +- libsrc/atmos/ser/atmos-acia.s | 486 +- libsrc/atmos/store_filename.s | 20 +- libsrc/atmos/systime.s | 2 +- libsrc/atmos/sysuname.s | 54 +- libsrc/atmos/tgi/atmos-228-200-3.s | 386 +- libsrc/atmos/tgi/atmos-240-200-2.s | 344 +- libsrc/atmos/tgi_colors.s | 6 +- libsrc/atmos/tgi_stat_stddrv.s | 4 +- libsrc/atmos/tgi_stddrv.s | 4 +- libsrc/atmos/toascii.s | 8 +- libsrc/atmos/wherex.s | 4 +- libsrc/atmos/wherey.s | 4 +- libsrc/atmos/write.s | 36 +- libsrc/c128/_scrsize.s | 2 +- libsrc/c128/break.s | 142 +- libsrc/c128/c64mode.s | 4 +- libsrc/c128/cgetc.s | 58 +- libsrc/c128/clrscr.s | 6 +- libsrc/c128/color.s | 58 +- libsrc/c128/conio.s | 4 +- libsrc/c128/cputc.s | 72 +- libsrc/c128/crt0.s | 106 +- libsrc/c128/dbgbreak.s_ | 24 +- libsrc/c128/devnum.s | 4 +- libsrc/c128/emd/c128-georam.s | 124 +- libsrc/c128/emd/c128-ram.s | 32 +- libsrc/c128/emd/c128-ram2.s | 24 +- libsrc/c128/emd/c128-ramcart.s | 114 +- libsrc/c128/emd/c128-reu.s | 34 +- libsrc/c128/emd/c128-vdc.s | 338 +- libsrc/c128/fast.s | 12 +- libsrc/c128/get_tv.s | 4 +- libsrc/c128/irq.s | 58 +- libsrc/c128/joy/c128-ptvjoy.s | 28 +- libsrc/c128/joy/c128-stdjoy.s | 52 +- libsrc/c128/joy_stat_stddrv.s | 4 +- libsrc/c128/joy_stddrv.s | 4 +- libsrc/c128/kbhit.s | 8 +- libsrc/c128/kernal.s | 82 +- libsrc/c128/mainargs.s | 70 +- libsrc/c128/mcbdefault.s | 12 +- libsrc/c128/mou/c128-1351.s | 222 +- libsrc/c128/mou/c128-joy.s | 180 +- libsrc/c128/mou/c128-pot.s | 376 +- libsrc/c128/mouse_stat_stddrv.s | 4 +- libsrc/c128/mouse_stddrv.s | 4 +- libsrc/c128/randomize.s | 6 +- libsrc/c128/revers.s | 26 +- libsrc/c128/ser/c128-swlink.s | 274 +- libsrc/c128/slow.s | 12 +- libsrc/c128/status.s | 2 +- libsrc/c128/systime.s | 68 +- libsrc/c128/tgi/c128-vdc.s | 698 +- libsrc/c128/tgi/c128-vdc2.s | 726 +- libsrc/c128/tgi_colors.s | 6 +- libsrc/c128/tgi_stat_stddrv.s | 4 +- libsrc/c128/tgi_stddrv.s | 4 +- libsrc/c128/toggle_videomode.s | 6 +- libsrc/c128/videomode.s | 6 +- libsrc/c16/_scrsize.s | 2 +- libsrc/c16/break.s | 128 +- libsrc/c16/cgetc.s | 100 +- libsrc/c16/clrscr.s | 6 +- libsrc/c16/color.s | 28 +- libsrc/c16/conio.s | 4 +- libsrc/c16/cputc.s | 112 +- libsrc/c16/crt0.s | 88 +- libsrc/c16/devnum.s | 4 +- libsrc/c16/emd/c16-ram.s | 58 +- libsrc/c16/get_tv.s | 4 +- libsrc/c16/irq.s | 46 +- libsrc/c16/joy/c16-stdjoy.s | 2 +- libsrc/c16/joy_stat_stddrv.s | 4 +- libsrc/c16/joy_stddrv.s | 4 +- libsrc/c16/kbhit.s | 8 +- libsrc/c16/kclose.s | 4 +- libsrc/c16/kernal.s | 78 +- libsrc/c16/mainargs.s | 72 +- libsrc/c16/randomize.s | 6 +- libsrc/c16/revers.s | 26 +- libsrc/c16/status.s | 2 +- libsrc/c16/systime.s | 2 +- libsrc/c64/_scrsize.s | 2 +- libsrc/c64/break.s | 128 +- libsrc/c64/cgetc.s | 82 +- libsrc/c64/clrscr.s | 4 +- libsrc/c64/color.s | 28 +- libsrc/c64/conio.s | 4 +- libsrc/c64/cputc.s | 126 +- libsrc/c64/crt0.s | 106 +- libsrc/c64/devnum.s | 4 +- libsrc/c64/emd/c64-c256k.s | 412 +- libsrc/c64/emd/c64-dqbb.s | 288 +- libsrc/c64/emd/c64-georam.s | 126 +- libsrc/c64/emd/c64-isepic.s | 186 +- libsrc/c64/emd/c64-ram.s | 74 +- libsrc/c64/emd/c64-ramcart.s | 114 +- libsrc/c64/emd/c64-reu.s | 34 +- libsrc/c64/emd/c64-vdc.s | 346 +- libsrc/c64/emd/dtv-himem.s | 16 +- libsrc/c64/get_ostype.s | 32 +- libsrc/c64/get_tv.s | 2 +- libsrc/c64/irq.s | 46 +- libsrc/c64/joy/c64-hitjoy.s | 28 +- libsrc/c64/joy/c64-numpad.s | 88 +- libsrc/c64/joy/c64-ptvjoy.s | 30 +- libsrc/c64/joy/c64-stdjoy.s | 52 +- libsrc/c64/joy_stat_stddrv.s | 4 +- libsrc/c64/joy_stddrv.s | 4 +- libsrc/c64/kbhit.s | 6 +- libsrc/c64/kernal.s | 76 +- libsrc/c64/mainargs.s | 72 +- libsrc/c64/mcbdefault.s | 10 +- libsrc/c64/mou/c64-1351.s | 238 +- libsrc/c64/mou/c64-joy.s | 190 +- libsrc/c64/mou/c64-pot.s | 376 +- libsrc/c64/mouse_stat_stddrv.s | 4 +- libsrc/c64/mouse_stddrv.s | 4 +- libsrc/c64/randomize.s | 6 +- libsrc/c64/revers.s | 26 +- libsrc/c64/ser/c64-swlink.s | 292 +- libsrc/c64/status.s | 2 +- libsrc/c64/systime.s | 74 +- libsrc/c64/tgi/c64-hi.s | 66 +- libsrc/c64/tgi_colors.s | 6 +- libsrc/c64/tgi_stat_stddrv.s | 4 +- libsrc/c64/tgi_stddrv.s | 4 +- libsrc/cbm/c_acptr.s | 8 +- libsrc/cbm/c_basin.s | 10 +- libsrc/cbm/c_bsout.s | 2 +- libsrc/cbm/c_chkin.s | 12 +- libsrc/cbm/c_ciout.s | 2 +- libsrc/cbm/c_ckout.s | 12 +- libsrc/cbm/c_clall.s | 2 +- libsrc/cbm/c_close.s | 6 +- libsrc/cbm/c_clrch.s | 2 +- libsrc/cbm/c_getin.s | 8 +- libsrc/cbm/c_iobase.s | 16 +- libsrc/cbm/c_listen.s | 2 +- libsrc/cbm/c_load.s | 20 +- libsrc/cbm/c_open.s | 8 +- libsrc/cbm/c_readst.s | 10 +- libsrc/cbm/c_save.s | 6 +- libsrc/cbm/c_setlfs.s | 22 +- libsrc/cbm/c_setnam.s | 24 +- libsrc/cbm/c_talk.s | 2 +- libsrc/cbm/c_unlsn.s | 2 +- libsrc/cbm/c_untlk.s | 2 +- libsrc/cbm/cbm.inc | 78 +- libsrc/cbm/cbm_dir.c | 18 +- libsrc/cbm/cbm_open.s | 4 +- libsrc/cbm/cbm_read.s | 4 +- libsrc/cbm/cbm_write.s | 4 +- libsrc/cbm/cclear.s | 30 +- libsrc/cbm/chline.s | 30 +- libsrc/cbm/clock.s | 16 +- libsrc/cbm/ctype.s | 516 +- libsrc/cbm/cvline.s | 32 +- libsrc/cbm/dir.h | 6 +- libsrc/cbm/filename.s | 2 +- libsrc/cbm/gotox.s | 10 +- libsrc/cbm/gotoxy.s | 14 +- libsrc/cbm/gotoy.s | 10 +- libsrc/cbm/initcwd.s | 54 +- libsrc/cbm/open.s | 12 +- libsrc/cbm/oserrlist.s | 78 +- libsrc/cbm/oserror.s | 106 +- libsrc/cbm/toascii.s | 2 +- libsrc/cbm/wherex.s | 4 +- libsrc/cbm/wherey.s | 4 +- libsrc/cbm510/_scrsize.s | 2 +- libsrc/cbm510/banking.s | 48 +- libsrc/cbm510/break.s | 134 +- libsrc/cbm510/cgetc.s | 152 +- libsrc/cbm510/clrscr.s | 82 +- libsrc/cbm510/color.s | 56 +- libsrc/cbm510/cputc.s | 130 +- libsrc/cbm510/crt0.s | 320 +- libsrc/cbm510/devnum.s | 4 +- libsrc/cbm510/emd/cbm510-ram.s | 26 +- libsrc/cbm510/extzp.s | 24 +- libsrc/cbm510/irq.s | 4 +- libsrc/cbm510/joy/cbm510-std.s | 48 +- libsrc/cbm510/joy_stat_stddrv.s | 4 +- libsrc/cbm510/joy_stddrv.s | 4 +- libsrc/cbm510/kbhit.s | 4 +- libsrc/cbm510/kernal.s | 78 +- libsrc/cbm510/kiobase.s | 6 +- libsrc/cbm510/krdtim.s | 12 +- libsrc/cbm510/kscnkey.s | 114 +- libsrc/cbm510/kscreen.s | 6 +- libsrc/cbm510/ksetnam.s | 6 +- libsrc/cbm510/ksettim.s | 12 +- libsrc/cbm510/kudtim.s | 18 +- libsrc/cbm510/mainargs.s | 4 +- libsrc/cbm510/peeksys.s | 58 +- libsrc/cbm510/pokesys.s | 52 +- libsrc/cbm510/randomize.s | 4 +- libsrc/cbm510/revers.s | 26 +- libsrc/cbm510/ser/cbm510-std.s | 234 +- libsrc/cbm510/systime.s | 70 +- libsrc/cbm610/_scrsize.s | 2 +- libsrc/cbm610/banking.s | 48 +- libsrc/cbm610/break.s | 134 +- libsrc/cbm610/cgetc.s | 58 +- libsrc/cbm610/clrscr.s | 48 +- libsrc/cbm610/color.s | 12 +- libsrc/cbm610/cputc.s | 176 +- libsrc/cbm610/crt0.s | 200 +- libsrc/cbm610/crtc.s | 80 +- libsrc/cbm610/devnum.s | 4 +- libsrc/cbm610/emd/cbm610-ram.s | 26 +- libsrc/cbm610/extzp.s | 24 +- libsrc/cbm610/get_tv.s | 10 +- libsrc/cbm610/irq.s | 4 +- libsrc/cbm610/kbhit.s | 4 +- libsrc/cbm610/kernal.s | 78 +- libsrc/cbm610/kiobase.s | 6 +- libsrc/cbm610/krdtim.s | 12 +- libsrc/cbm610/kscnkey.s | 114 +- libsrc/cbm610/kscreen.s | 6 +- libsrc/cbm610/ksetnam.s | 6 +- libsrc/cbm610/ksettim.s | 12 +- libsrc/cbm610/kudtim.s | 18 +- libsrc/cbm610/mainargs.s | 4 +- libsrc/cbm610/peeksys.s | 58 +- libsrc/cbm610/pokesys.s | 48 +- libsrc/cbm610/randomize.s | 4 +- libsrc/cbm610/revers.s | 26 +- libsrc/cbm610/ser/cbm610-std.s | 234 +- libsrc/cbm610/systime.s | 70 +- libsrc/common/_cwd.s | 4 +- libsrc/common/_environ.s | 10 +- libsrc/common/_fdesc.s | 18 +- libsrc/common/_file.h | 12 +- libsrc/common/_file.s | 8 +- libsrc/common/_heap.s | 32 +- libsrc/common/_heapadd.s | 44 +- libsrc/common/_heapblocksize.s | 4 +- libsrc/common/_heapmaxavail.s | 6 +- libsrc/common/_heapmemavail.s | 6 +- libsrc/common/_oserror.s | 4 +- libsrc/common/_printf.h | 8 +- libsrc/common/_printf.s | 880 +- libsrc/common/_scanf.c | 242 +- libsrc/common/_scanf.h | 6 +- libsrc/common/_seterrno.s | 2 +- libsrc/common/_swap.s | 42 +- libsrc/common/_sys.s | 80 +- libsrc/common/abs.s | 12 +- libsrc/common/atexit.s | 74 +- libsrc/common/atoi.s | 160 +- libsrc/common/bsearch.c | 30 +- libsrc/common/calloc.s | 36 +- libsrc/common/cc65_idiv32by16r16.s | 2 +- libsrc/common/cc65_udiv32by16r16.s | 2 +- libsrc/common/copydata.s | 32 +- libsrc/common/ctime.s | 2 +- libsrc/common/divt.s | 20 +- libsrc/common/errno.s | 2 +- libsrc/common/fdopen.c | 6 +- libsrc/common/fgetc.c | 20 +- libsrc/common/fgetpos.c | 2 +- libsrc/common/fgets.c | 34 +- libsrc/common/fmisc.s | 62 +- libsrc/common/fprintf.s | 48 +- libsrc/common/fputc.c | 10 +- libsrc/common/fputs.c | 2 +- libsrc/common/fread.s | 22 +- libsrc/common/free.s | 602 +- libsrc/common/freopen.c | 6 +- libsrc/common/fscanf.s | 48 +- libsrc/common/fseek.c | 2 +- libsrc/common/fsetpos.c | 2 +- libsrc/common/ftell.c | 2 +- libsrc/common/fwrite.s | 26 +- libsrc/common/getchar.c | 4 +- libsrc/common/getcpu.s | 24 +- libsrc/common/gets.c | 36 +- libsrc/common/interrupt.s | 112 +- libsrc/common/isalnum.s | 22 +- libsrc/common/isalpha.s | 22 +- libsrc/common/isblank.s | 22 +- libsrc/common/iscntrl.s | 22 +- libsrc/common/isdigit.s | 22 +- libsrc/common/isgraph.s | 28 +- libsrc/common/islower.s | 22 +- libsrc/common/isprint.s | 24 +- libsrc/common/ispunct.s | 28 +- libsrc/common/isspace.s | 22 +- libsrc/common/isupper.s | 22 +- libsrc/common/isxdigit.s | 22 +- libsrc/common/itoa.s | 164 +- libsrc/common/labs.s | 14 +- libsrc/common/locale.c | 48 +- libsrc/common/longjmp.s | 62 +- libsrc/common/ltoa.s | 186 +- libsrc/common/malloc.s | 288 +- libsrc/common/memchr.s | 34 +- libsrc/common/memcmp.s | 68 +- libsrc/common/memcpy.s | 90 +- libsrc/common/memmove.s | 80 +- libsrc/common/memset.s | 102 +- libsrc/common/mkdir.s | 2 +- libsrc/common/modfree.s | 2 +- libsrc/common/pmemalign.c | 6 +- libsrc/common/printf.s | 56 +- libsrc/common/putchar.s | 2 +- libsrc/common/putenv.s | 10 +- libsrc/common/puts.c | 8 +- libsrc/common/qsort.c | 56 +- libsrc/common/rand.s | 68 +- libsrc/common/realloc.c | 46 +- libsrc/common/rewind.c | 4 +- libsrc/common/scanf.s | 48 +- libsrc/common/searchenv.s | 6 +- libsrc/common/setjmp.s | 58 +- libsrc/common/signal.s | 4 +- libsrc/common/snprintf.s | 48 +- libsrc/common/sprintf.s | 48 +- libsrc/common/sscanf.s | 48 +- libsrc/common/strcat.s | 66 +- libsrc/common/strchr.s | 56 +- libsrc/common/strcmp.s | 48 +- libsrc/common/strcoll.s | 6 +- libsrc/common/strcpy.s | 38 +- libsrc/common/strcspn.s | 66 +- libsrc/common/strdup.s | 68 +- libsrc/common/strerror.s | 26 +- libsrc/common/strftime.c | 6 +- libsrc/common/stricmp.s | 90 +- libsrc/common/strlen.s | 30 +- libsrc/common/strlower.s | 52 +- libsrc/common/strncat.s | 96 +- libsrc/common/strncmp.s | 74 +- libsrc/common/strncpy.s | 22 +- libsrc/common/strnicmp.s | 110 +- libsrc/common/stroserr.s | 4 +- libsrc/common/strpbrk.s | 76 +- libsrc/common/strrchr.s | 58 +- libsrc/common/strspn.s | 66 +- libsrc/common/strstr.s | 100 +- libsrc/common/strtoimax.s | 2 +- libsrc/common/strtok.c | 26 +- libsrc/common/strtoumax.s | 2 +- libsrc/common/strupper.s | 52 +- libsrc/common/time.s | 2 +- libsrc/common/tolower.s | 20 +- libsrc/common/toupper.s | 20 +- libsrc/common/ungetc.s | 8 +- libsrc/common/vfprintf.s | 62 +- libsrc/common/vfscanf.s | 6 +- libsrc/common/vprintf.s | 6 +- libsrc/common/vscanf.s | 2 +- libsrc/common/vsnprintf.s | 30 +- libsrc/common/vsprintf.s | 8 +- libsrc/common/vsscanf.s | 8 +- libsrc/common/zerobss.s | 46 +- libsrc/conio/_cursor.s | 4 +- libsrc/conio/cprintf.s | 52 +- libsrc/conio/cputhex.s | 40 +- libsrc/conio/cputs.s | 44 +- libsrc/conio/cscanf.s | 42 +- libsrc/conio/cursor.s | 16 +- libsrc/conio/scrsize.s | 18 +- libsrc/conio/vcprintf.s | 146 +- libsrc/conio/vcscanf.s | 56 +- libsrc/dbg/asmtab.s | 66 +- libsrc/dbg/dbg.c | 1000 +- libsrc/dbg/dbgdasm.s | 412 +- libsrc/dbg/dbgdump.s | 120 +- libsrc/dbg/dbgisram.s | 56 +- libsrc/dbg/dbgsupp.s | 268 +- libsrc/em/em-kernel.s | 18 +- libsrc/em/em_commit.s | 2 +- libsrc/em/em_copyfrom.s | 2 +- libsrc/em/em_copyto.s | 2 +- libsrc/em/em_map.s | 2 +- libsrc/em/em_pagecount.s | 2 +- libsrc/em/em_unload.s | 14 +- libsrc/em/em_use.s | 2 +- libsrc/geos-apple/disk/enterturbo.s | 6 +- libsrc/geos-apple/disk/exitturbo.s | 10 +- libsrc/geos-apple/disk/purgeturbo.s | 6 +- libsrc/geos-apple/diskdrv.inc | 114 +- libsrc/geos-apple/geossym.inc | 352 +- libsrc/geos-apple/jumptab.inc | 320 +- libsrc/geos-cbm/dio.inc | 18 +- libsrc/geos-cbm/disk/changediskdevice.s | 12 +- libsrc/geos-cbm/disk/chkdkgeos.s | 18 +- libsrc/geos-cbm/disk/dio_cts.s | 292 +- libsrc/geos-cbm/disk/dio_openclose.s | 108 +- libsrc/geos-cbm/disk/dio_params.s | 64 +- libsrc/geos-cbm/disk/dio_qcount.s | 14 +- libsrc/geos-cbm/disk/dio_qsize.s | 12 +- libsrc/geos-cbm/disk/dio_read.s | 18 +- libsrc/geos-cbm/disk/dio_stc.s | 274 +- libsrc/geos-cbm/disk/dio_write.s | 14 +- libsrc/geos-cbm/disk/dio_writev.s | 18 +- libsrc/geos-cbm/disk/enterturbo.s | 8 +- libsrc/geos-cbm/disk/exitturbo.s | 8 +- libsrc/geos-cbm/disk/findbambit.s | 26 +- libsrc/geos-cbm/disk/newdisk.s | 12 +- libsrc/geos-cbm/disk/purgeturbo.s | 8 +- libsrc/geos-cbm/disk/readblock.s | 28 +- libsrc/geos-cbm/disk/readbuff.s | 22 +- libsrc/geos-cbm/disk/setgeosdisk.s | 10 +- libsrc/geos-cbm/disk/verwriteblock.s | 28 +- libsrc/geos-cbm/disk/writeblock.s | 28 +- libsrc/geos-cbm/disk/writebuff.s | 22 +- libsrc/geos-cbm/diskdrv.inc | 64 +- libsrc/geos-cbm/emd/geos-vdc.s | 546 +- libsrc/geos-cbm/file/followchain.s | 28 +- libsrc/geos-cbm/geossym.inc | 576 +- libsrc/geos-cbm/geossym2.inc | 12 +- libsrc/geos-cbm/inputdrv.inc | 16 +- libsrc/geos-cbm/joy/geos-stdjoy.s | 112 +- libsrc/geos-cbm/jumptab.inc | 340 +- libsrc/geos-cbm/memory/fetchram.s | 12 +- libsrc/geos-cbm/memory/reuregs.s | 22 +- libsrc/geos-cbm/memory/stashram.s | 12 +- libsrc/geos-cbm/memory/swapram.s | 14 +- libsrc/geos-cbm/memory/verifyram.s | 18 +- libsrc/geos-cbm/printdrv.inc | 16 +- libsrc/geos-cbm/system/get_ostype.s | 130 +- libsrc/geos-cbm/system/getserialnumber.s | 14 +- libsrc/geos-cbm/system/initdoneio.s | 10 +- libsrc/geos-cbm/system/setdevice.s | 8 +- libsrc/geos-cbm/system/tobasic.s | 6 +- libsrc/geos-cbm/tgi/geos-tgi.s | 756 +- libsrc/geos-common/common/_poserror.c | 4 +- libsrc/geos-common/common/copydata.s | 34 +- libsrc/geos-common/common/memcpy.s | 6 +- libsrc/geos-common/common/memmove.s | 6 +- libsrc/geos-common/common/memset.s | 10 +- libsrc/geos-common/common/perror.c | 4 +- libsrc/geos-common/common/sleep.c | 4 +- libsrc/geos-common/common/zerobss.s | 28 +- libsrc/geos-common/conio/_scrsize.s | 56 +- libsrc/geos-common/conio/cclear.s | 90 +- libsrc/geos-common/conio/cgetc.s | 48 +- libsrc/geos-common/conio/chline.s | 82 +- libsrc/geos-common/conio/clrscr.s | 70 +- libsrc/geos-common/conio/cputc.s | 108 +- libsrc/geos-common/conio/cvline.s | 70 +- libsrc/geos-common/conio/dummies.s | 12 +- libsrc/geos-common/conio/gotoxy.s | 48 +- libsrc/geos-common/conio/kbhit.s | 16 +- libsrc/geos-common/conio/where.s | 16 +- libsrc/geos-common/const.inc | 740 +- libsrc/geos-common/disk/blkalloc.s | 26 +- libsrc/geos-common/disk/calcblksfree.s | 22 +- libsrc/geos-common/disk/freeblock.s | 22 +- libsrc/geos-common/disk/getblock.s | 30 +- libsrc/geos-common/disk/getdirhead.s | 12 +- libsrc/geos-common/disk/getptrcurdknm.s | 50 +- libsrc/geos-common/disk/gettrse.s | 20 +- libsrc/geos-common/disk/nxtblkalloc.s | 38 +- libsrc/geos-common/disk/opendisk.s | 14 +- libsrc/geos-common/disk/putblock.s | 30 +- libsrc/geos-common/disk/putdirhead.s | 14 +- libsrc/geos-common/disk/setnextfree.s | 30 +- libsrc/geos-common/dlgbox/dbget2lines.s | 42 +- libsrc/geos-common/dlgbox/dlgboxfileselect.s | 72 +- libsrc/geos-common/dlgbox/dlgboxgetstring.s | 44 +- libsrc/geos-common/dlgbox/dlgboxok.s | 28 +- libsrc/geos-common/dlgbox/dlgboxokcancel.s | 30 +- libsrc/geos-common/dlgbox/dlgboxyesno.s | 30 +- libsrc/geos-common/dlgbox/dodlgbox.s | 18 +- libsrc/geos-common/dlgbox/messagebox.c | 50 +- libsrc/geos-common/dlgbox/rstrfrmdialogue.s | 6 +- libsrc/geos-common/drivers/fio_module.s | 272 +- libsrc/geos-common/drivers/geos-stdmou.s | 186 +- libsrc/geos-common/drivers/mcbdefault.s | 8 +- libsrc/geos-common/drivers/mouse_stddrv.s | 4 +- libsrc/geos-common/file/appendrecord.s | 14 +- libsrc/geos-common/file/closerecordfile.s | 14 +- libsrc/geos-common/file/deletefile.s | 20 +- libsrc/geos-common/file/deleterecord.s | 16 +- libsrc/geos-common/file/findfile.s | 20 +- libsrc/geos-common/file/findftypes.s | 44 +- libsrc/geos-common/file/freefile.s | 20 +- libsrc/geos-common/file/get1stdirentry.s | 18 +- libsrc/geos-common/file/getfhdrinfo.s | 20 +- libsrc/geos-common/file/getfile.s | 46 +- libsrc/geos-common/file/getnxtdirentry.s | 18 +- libsrc/geos-common/file/insertrecord.s | 12 +- libsrc/geos-common/file/nextrecord.s | 12 +- libsrc/geos-common/file/openrecordfile.s | 20 +- libsrc/geos-common/file/pointrecord.s | 14 +- libsrc/geos-common/file/previousrecord.s | 12 +- libsrc/geos-common/file/readbyte.s | 14 +- libsrc/geos-common/file/readfile.s | 36 +- libsrc/geos-common/file/readrecord.s | 26 +- libsrc/geos-common/file/renamefile.s | 24 +- libsrc/geos-common/file/savefile.s | 24 +- libsrc/geos-common/file/sysremove.s | 20 +- libsrc/geos-common/file/sysrename.s | 28 +- libsrc/geos-common/file/updaterecordfile.s | 12 +- libsrc/geos-common/file/writerecord.s | 26 +- libsrc/geos-common/geosmac.inc | 338 +- libsrc/geos-common/graph/bitmapclip.s | 30 +- libsrc/geos-common/graph/bitmapregs.s | 26 +- libsrc/geos-common/graph/bitmapup.s | 12 +- libsrc/geos-common/graph/bitotherclip.s | 48 +- libsrc/geos-common/graph/drawline.s | 40 +- libsrc/geos-common/graph/drawpoint.s | 28 +- libsrc/geos-common/graph/framerectangle.s | 8 +- libsrc/geos-common/graph/getcharwidth.s | 10 +- libsrc/geos-common/graph/getintcharint.s | 22 +- libsrc/geos-common/graph/graphicsstring.s | 12 +- libsrc/geos-common/graph/hlineregs.s | 22 +- libsrc/geos-common/graph/horizontalline.s | 14 +- libsrc/geos-common/graph/imprintrectangle.s | 8 +- libsrc/geos-common/graph/initdrawwindow.s | 24 +- libsrc/geos-common/graph/invertline.s | 12 +- libsrc/geos-common/graph/invertrectangle.s | 6 +- libsrc/geos-common/graph/loadcharset.s | 12 +- libsrc/geos-common/graph/pointregs.s | 32 +- libsrc/geos-common/graph/put_char.s | 20 +- libsrc/geos-common/graph/putdecimal.s | 14 +- libsrc/geos-common/graph/putstring.s | 14 +- libsrc/geos-common/graph/recoverline.s | 12 +- libsrc/geos-common/graph/recoverrectangle.s | 8 +- libsrc/geos-common/graph/rectangle.s | 8 +- libsrc/geos-common/graph/setpattern.s | 6 +- libsrc/geos-common/graph/testpoint.s | 20 +- libsrc/geos-common/graph/usesystemfont.s | 6 +- libsrc/geos-common/graph/verticalline.s | 26 +- libsrc/geos-common/memory/clearram.s | 26 +- libsrc/geos-common/memory/cmpfstring.s | 22 +- libsrc/geos-common/memory/cmpstring.s | 18 +- libsrc/geos-common/memory/copyfstring.s | 16 +- libsrc/geos-common/memory/copystring.s | 10 +- libsrc/geos-common/memory/crc.s | 20 +- libsrc/geos-common/memory/doublepop.s | 18 +- libsrc/geos-common/memory/doublespop.s | 28 +- libsrc/geos-common/memory/fillram.s | 38 +- libsrc/geos-common/memory/initram.s | 12 +- libsrc/geos-common/memory/movedata.s | 32 +- libsrc/geos-common/menuicon/doicons.s | 12 +- libsrc/geos-common/menuicon/domenu.s | 14 +- libsrc/geos-common/menuicon/dopreviousmenu.s | 6 +- libsrc/geos-common/menuicon/gotofirstmenu.s | 6 +- libsrc/geos-common/menuicon/recoverallmenus.s | 4 +- libsrc/geos-common/menuicon/recovermenu.s | 6 +- libsrc/geos-common/menuicon/redomenu.s | 6 +- .../geos-common/mousesprite/clearmousemode.s | 6 +- libsrc/geos-common/mousesprite/disablsprite.s | 10 +- libsrc/geos-common/mousesprite/drawsprite.s | 18 +- libsrc/geos-common/mousesprite/enablsprite.s | 10 +- libsrc/geos-common/mousesprite/getnextchar.s | 14 +- .../geos-common/mousesprite/inittextprompt.s | 6 +- .../geos-common/mousesprite/ismseinregion.s | 16 +- libsrc/geos-common/mousesprite/mouseoff.s | 6 +- libsrc/geos-common/mousesprite/mouseup.s | 6 +- libsrc/geos-common/mousesprite/possprite.s | 38 +- libsrc/geos-common/mousesprite/promptoff.s | 20 +- libsrc/geos-common/mousesprite/prompton.s | 26 +- .../geos-common/mousesprite/startmousemode.s | 8 +- libsrc/geos-common/process/processblock.s | 24 +- libsrc/geos-common/process/processfreeze.s | 22 +- .../process/processinitrestartenable.s | 38 +- libsrc/geos-common/process/processsleep.s | 44 +- libsrc/geos-common/runtime/call.s | 4 +- libsrc/geos-common/system/callroutine.s | 6 +- libsrc/geos-common/system/crt0.s | 62 +- libsrc/geos-common/system/ctype.s | 514 +- libsrc/geos-common/system/enterdesktop.s | 10 +- libsrc/geos-common/system/extzp.s | 14 +- libsrc/geos-common/system/firstinit.s | 6 +- libsrc/geos-common/system/getrandom.s | 10 +- libsrc/geos-common/system/joy_stddrv.s | 4 +- libsrc/geos-common/system/mainargs.s | 72 +- libsrc/geos-common/system/mainloop.s | 6 +- libsrc/geos-common/system/oserrlist.s | 110 +- libsrc/geos-common/system/oserror.s | 122 +- libsrc/geos-common/system/panic.s | 6 +- libsrc/geos-common/system/randomize.s | 12 +- libsrc/geos-common/system/setoserror.s | 14 +- libsrc/geos-common/system/systime.c | 2 +- libsrc/geos-common/system/sysuname.s | 34 +- libsrc/geos-common/system/tgi_colors.s | 6 +- libsrc/geos-common/system/tgi_stddrv.s | 4 +- libsrc/joystick/joy-kernel.s | 26 +- libsrc/joystick/joy_count.s | 2 +- libsrc/joystick/joy_read.s | 2 +- libsrc/joystick/joy_unload.s | 24 +- libsrc/lynx/bllhdr.s | 18 +- libsrc/lynx/bootldr.s | 240 +- libsrc/lynx/cgetc.s | 88 +- libsrc/lynx/clock.s | 92 +- libsrc/lynx/crt0.s | 128 +- libsrc/lynx/ctype.s | 258 +- libsrc/lynx/defdir.s | 16 +- libsrc/lynx/eeprom.s | 4 +- libsrc/lynx/eeprom46.s | 222 +- libsrc/lynx/eeprom66.s | 256 +- libsrc/lynx/eeprom86.s | 272 +- libsrc/lynx/exec.s | 24 +- libsrc/lynx/exehdr.s | 24 +- libsrc/lynx/extzp.inc | 28 +- libsrc/lynx/extzp.s | 2 +- libsrc/lynx/irq.s | 50 +- libsrc/lynx/joy/lynx-stdjoy.s | 10 +- libsrc/lynx/joy_stat_stddrv.s | 4 +- libsrc/lynx/joy_stddrv.s | 4 +- libsrc/lynx/kbhit.s | 68 +- libsrc/lynx/load.s | 42 +- libsrc/lynx/lseek.s | 76 +- libsrc/lynx/lynx-cart.s | 116 +- libsrc/lynx/lynx-snd.s | 1214 +-- libsrc/lynx/mainargs.s | 4 +- libsrc/lynx/open.s | 182 +- libsrc/lynx/oserror.s | 4 +- libsrc/lynx/read.s | 44 +- libsrc/lynx/ser/lynx-comlynx.s | 514 +- libsrc/lynx/tgi/lynx-160-102-16.s | 1134 +- libsrc/lynx/tgi_colors.s | 6 +- libsrc/lynx/tgi_stat_stddrv.s | 4 +- libsrc/lynx/tgi_stddrv.s | 4 +- libsrc/lynx/toascii.s | 4 +- libsrc/lynx/uploader.s | 46 +- libsrc/mouse/mouse-kernel.s | 28 +- libsrc/mouse/mouse_hide.s | 10 +- libsrc/mouse/mouse_setbox.s | 8 +- libsrc/mouse/mouse_show.s | 10 +- libsrc/mouse/mouse_unload.s | 24 +- libsrc/nes/Makefile.inc | 2 +- libsrc/nes/_scrsize.s | 22 +- libsrc/nes/cclear.s | 30 +- libsrc/nes/chline.s | 30 +- libsrc/nes/clock.s | 14 +- libsrc/nes/clrscr.s | 12 +- libsrc/nes/color.s | 86 +- libsrc/nes/cputc.s | 72 +- libsrc/nes/crt0.s | 70 +- libsrc/nes/ctype.s | 258 +- libsrc/nes/cvline.s | 32 +- libsrc/nes/get_tv.s | 46 +- libsrc/nes/gotox.s | 8 +- libsrc/nes/gotoxy.s | 12 +- libsrc/nes/gotoy.s | 8 +- libsrc/nes/joy/nes-stdjoy.s | 76 +- libsrc/nes/joy_stat_stddrv.s | 4 +- libsrc/nes/joy_stddrv.s | 4 +- libsrc/nes/mainargs.s | 4 +- libsrc/nes/neschar.inc | 9214 ++++++++--------- libsrc/nes/ppu.s | 218 +- libsrc/nes/ppubuf.s | 8 +- libsrc/nes/randomize.s | 6 +- libsrc/nes/revers.s | 26 +- libsrc/nes/setcursor.s | 26 +- libsrc/nes/tgi/nes-64-56-2.s | 502 +- libsrc/nes/tgi_colors.s | 6 +- libsrc/nes/tgi_stat_stddrv.s | 4 +- libsrc/nes/tgi_stddrv.s | 4 +- libsrc/nes/waitvblank.s | 4 +- libsrc/nes/wherex.s | 4 +- libsrc/nes/wherey.s | 4 +- libsrc/pet/_scrsize.s | 12 +- libsrc/pet/break.s | 128 +- libsrc/pet/cgetc.s | 96 +- libsrc/pet/clrscr.s | 52 +- libsrc/pet/color.s | 10 +- libsrc/pet/conio.s | 4 +- libsrc/pet/cputc.s | 126 +- libsrc/pet/crt0.s | 96 +- libsrc/pet/devnum.s | 4 +- libsrc/pet/get_tv.s | 2 +- libsrc/pet/irq.s | 46 +- libsrc/pet/joy/pet-ptvjoy.s | 104 +- libsrc/pet/joy/pet-stdjoy.s | 112 +- libsrc/pet/joy_stat_stddrv.s | 4 +- libsrc/pet/joy_stddrv.s | 4 +- libsrc/pet/kbhit.s | 6 +- libsrc/pet/kernal.s | 12 +- libsrc/pet/mainargs.s | 122 +- libsrc/pet/randomize.s | 6 +- libsrc/pet/revers.s | 26 +- libsrc/pet/status.s | 2 +- libsrc/plus4/_scrsize.s | 2 +- libsrc/plus4/break.s | 94 +- libsrc/plus4/cgetc.s | 102 +- libsrc/plus4/clrscr.s | 4 +- libsrc/plus4/color.s | 28 +- libsrc/plus4/conio.s | 4 +- libsrc/plus4/cputc.s | 112 +- libsrc/plus4/crt0.s | 98 +- libsrc/plus4/devnum.s | 4 +- libsrc/plus4/get_tv.s | 4 +- libsrc/plus4/irq.s | 4 +- libsrc/plus4/joy/plus4-stdjoy.s | 32 +- libsrc/plus4/joy_stat_stddrv.s | 4 +- libsrc/plus4/joy_stddrv.s | 4 +- libsrc/plus4/kbhit.s | 8 +- libsrc/plus4/kclose.s | 2 +- libsrc/plus4/ksetnam.s | 2 +- libsrc/plus4/mainargs.s | 72 +- libsrc/plus4/randomize.s | 6 +- libsrc/plus4/revers.s | 26 +- libsrc/plus4/ser/plus4-stdser.s | 252 +- libsrc/plus4/status.s | 2 +- libsrc/plus4/systime.s | 2 +- libsrc/runtime/add.s | 42 +- libsrc/runtime/addeqsp.s | 28 +- libsrc/runtime/addysp.s | 24 +- libsrc/runtime/along.s | 24 +- libsrc/runtime/and.s | 30 +- libsrc/runtime/aslax1.s | 16 +- libsrc/runtime/aslax2.s | 18 +- libsrc/runtime/aslax3.s | 22 +- libsrc/runtime/aslax4.s | 26 +- libsrc/runtime/asleax1.s | 18 +- libsrc/runtime/asleax2.s | 26 +- libsrc/runtime/asleax3.s | 34 +- libsrc/runtime/asleax4.s | 24 +- libsrc/runtime/asr.s | 10 +- libsrc/runtime/asrax1.s | 16 +- libsrc/runtime/asrax2.s | 22 +- libsrc/runtime/asrax3.s | 28 +- libsrc/runtime/asrax4.s | 34 +- libsrc/runtime/asreax1.s | 22 +- libsrc/runtime/asreax2.s | 32 +- libsrc/runtime/asreax3.s | 42 +- libsrc/runtime/asreax4.s | 28 +- libsrc/runtime/axlong.s | 24 +- libsrc/runtime/bneg.s | 22 +- libsrc/runtime/bpushbsp.s | 12 +- libsrc/runtime/call.s | 10 +- libsrc/runtime/callmain.s | 6 +- libsrc/runtime/compl.s | 16 +- libsrc/runtime/condes.s | 48 +- libsrc/runtime/decax1.s | 14 +- libsrc/runtime/decax2.s | 14 +- libsrc/runtime/decax3.s | 14 +- libsrc/runtime/decax4.s | 14 +- libsrc/runtime/decax5.s | 14 +- libsrc/runtime/decax6.s | 14 +- libsrc/runtime/decax7.s | 14 +- libsrc/runtime/decax8.s | 14 +- libsrc/runtime/decaxy.s | 18 +- libsrc/runtime/decsp1.s | 18 +- libsrc/runtime/decsp2.s | 22 +- libsrc/runtime/decsp3.s | 22 +- libsrc/runtime/decsp4.s | 22 +- libsrc/runtime/decsp5.s | 22 +- libsrc/runtime/decsp6.s | 22 +- libsrc/runtime/decsp7.s | 22 +- libsrc/runtime/decsp8.s | 22 +- libsrc/runtime/div.s | 12 +- libsrc/runtime/enter.s | 20 +- libsrc/runtime/eq.s | 14 +- libsrc/runtime/ge.s | 12 +- libsrc/runtime/gt.s | 12 +- libsrc/runtime/icmp.s | 52 +- libsrc/runtime/idiv32by16r16.s | 2 +- libsrc/runtime/incax1.s | 18 +- libsrc/runtime/incax2.s | 14 +- libsrc/runtime/incax3.s | 10 +- libsrc/runtime/incax5.s | 10 +- libsrc/runtime/incax6.s | 10 +- libsrc/runtime/incax7.s | 10 +- libsrc/runtime/incax8.s | 10 +- libsrc/runtime/incaxy.s | 18 +- libsrc/runtime/incsp1.s | 16 +- libsrc/runtime/incsp2.s | 22 +- libsrc/runtime/incsp3.s | 12 +- libsrc/runtime/incsp4.s | 12 +- libsrc/runtime/incsp5.s | 12 +- libsrc/runtime/incsp6.s | 12 +- libsrc/runtime/incsp7.s | 12 +- libsrc/runtime/incsp8.s | 10 +- libsrc/runtime/jmpvec.s | 4 +- libsrc/runtime/ladd.s | 46 +- libsrc/runtime/laddeq.s | 58 +- libsrc/runtime/laddeqsp.s | 48 +- libsrc/runtime/land.s | 40 +- libsrc/runtime/lasr.s | 8 +- libsrc/runtime/lbneg.s | 24 +- libsrc/runtime/lcmp.s | 74 +- libsrc/runtime/lcompl.s | 30 +- libsrc/runtime/ldai.s | 20 +- libsrc/runtime/ldau0sp.s | 24 +- libsrc/runtime/ldaui.s | 16 +- libsrc/runtime/ldauisp.s | 28 +- libsrc/runtime/ldaxi.s | 20 +- libsrc/runtime/ldaxsp.s | 16 +- libsrc/runtime/ldeaxi.s | 32 +- libsrc/runtime/ldeaxysp.s | 30 +- libsrc/runtime/ldec.s | 34 +- libsrc/runtime/ldiv.s | 14 +- libsrc/runtime/le.s | 12 +- libsrc/runtime/leaaxsp.s | 4 +- libsrc/runtime/leave.s | 40 +- libsrc/runtime/leq.s | 10 +- libsrc/runtime/lge.s | 8 +- libsrc/runtime/lgt.s | 8 +- libsrc/runtime/linc.s | 26 +- libsrc/runtime/lle.s | 8 +- libsrc/runtime/llt.s | 8 +- libsrc/runtime/lmod.s | 20 +- libsrc/runtime/lmul.s | 100 +- libsrc/runtime/lne.s | 8 +- libsrc/runtime/lneg.s | 40 +- libsrc/runtime/lor.s | 40 +- libsrc/runtime/lpop.s | 30 +- libsrc/runtime/lpush.s | 42 +- libsrc/runtime/lrsub.s | 42 +- libsrc/runtime/lsave.s | 34 +- libsrc/runtime/lshelp.s | 86 +- libsrc/runtime/lshl.s | 16 +- libsrc/runtime/lshr.s | 12 +- libsrc/runtime/lsub.s | 50 +- libsrc/runtime/lsubeq.s | 64 +- libsrc/runtime/lsubeqsp.s | 52 +- libsrc/runtime/lt.s | 12 +- libsrc/runtime/ltest.s | 22 +- libsrc/runtime/ludiv.s | 132 +- libsrc/runtime/luge.s | 8 +- libsrc/runtime/lugt.s | 8 +- libsrc/runtime/lule.s | 8 +- libsrc/runtime/lult.s | 8 +- libsrc/runtime/lumod.s | 24 +- libsrc/runtime/lxor.s | 40 +- libsrc/runtime/makebool.s | 66 +- libsrc/runtime/mod.s | 14 +- libsrc/runtime/mul.s | 46 +- libsrc/runtime/mul8.s | 42 +- libsrc/runtime/mulax10.s | 38 +- libsrc/runtime/mulax3.s | 32 +- libsrc/runtime/mulax5.s | 34 +- libsrc/runtime/mulax6.s | 34 +- libsrc/runtime/mulax7.s | 40 +- libsrc/runtime/mulax9.s | 38 +- libsrc/runtime/ne.s | 12 +- libsrc/runtime/neg.s | 22 +- libsrc/runtime/or.s | 26 +- libsrc/runtime/popa.s | 22 +- libsrc/runtime/popsreg.s | 26 +- libsrc/runtime/push1.s | 10 +- libsrc/runtime/push2.s | 10 +- libsrc/runtime/push3.s | 10 +- libsrc/runtime/push4.s | 10 +- libsrc/runtime/push5.s | 10 +- libsrc/runtime/push6.s | 10 +- libsrc/runtime/push7.s | 10 +- libsrc/runtime/pusha.s | 28 +- libsrc/runtime/pushaff.s | 12 +- libsrc/runtime/pushax.s | 38 +- libsrc/runtime/pushb.s | 32 +- libsrc/runtime/pushbsp.s | 12 +- libsrc/runtime/pushc0.s | 10 +- libsrc/runtime/pushc1.s | 10 +- libsrc/runtime/pushc2.s | 10 +- libsrc/runtime/pushlysp.s | 36 +- libsrc/runtime/pushw.s | 20 +- libsrc/runtime/pushwsp.s | 38 +- libsrc/runtime/regswap.s | 8 +- libsrc/runtime/regswap1.s | 8 +- libsrc/runtime/regswap2.s | 8 +- libsrc/runtime/return0.s | 12 +- libsrc/runtime/return1.s | 12 +- libsrc/runtime/rsub.s | 28 +- libsrc/runtime/shelp.s | 32 +- libsrc/runtime/shr.s | 10 +- libsrc/runtime/shrax1.s | 14 +- libsrc/runtime/shrax2.s | 18 +- libsrc/runtime/shrax3.s | 22 +- libsrc/runtime/shrax4.s | 26 +- libsrc/runtime/shreax1.s | 18 +- libsrc/runtime/shreax2.s | 26 +- libsrc/runtime/shreax3.s | 34 +- libsrc/runtime/shreax4.s | 24 +- libsrc/runtime/staspidx.s | 32 +- libsrc/runtime/staxsp.s | 20 +- libsrc/runtime/staxspi.s | 40 +- libsrc/runtime/steaxsp.s | 32 +- libsrc/runtime/steaxspi.s | 50 +- libsrc/runtime/stkchk.s | 80 +- libsrc/runtime/sub.s | 34 +- libsrc/runtime/subeqsp.s | 32 +- libsrc/runtime/subysp.s | 22 +- libsrc/runtime/swap.s | 32 +- libsrc/runtime/tosint.s | 32 +- libsrc/runtime/toslong.s | 74 +- libsrc/runtime/udiv.s | 86 +- libsrc/runtime/udiv32by16r16.s | 40 +- libsrc/runtime/uge.s | 12 +- libsrc/runtime/ugt.s | 12 +- libsrc/runtime/ule.s | 12 +- libsrc/runtime/ult.s | 12 +- libsrc/runtime/umod.s | 24 +- libsrc/runtime/umul16x16r32.s | 32 +- libsrc/runtime/umul8x16r24.s | 12 +- libsrc/runtime/umul8x8r16.s | 12 +- libsrc/runtime/xor.s | 26 +- libsrc/runtime/zeropage.s | 24 +- libsrc/serial/ser-kernel.s | 26 +- libsrc/serial/ser_unload.s | 24 +- libsrc/supervision/crt0.s | 64 +- libsrc/supervision/ctype.s | 260 +- libsrc/tgi/tgi-kernel.s | 36 +- libsrc/tgi/tgi_init.s | 8 +- libsrc/tgi/tgidrv_line.inc | 496 +- libsrc/vic20/_scrsize.s | 2 +- libsrc/vic20/break.s | 128 +- libsrc/vic20/cgetc.s | 82 +- libsrc/vic20/clrscr.s | 4 +- libsrc/vic20/color.s | 72 +- libsrc/vic20/conio.s | 4 +- libsrc/vic20/cputc.s | 126 +- libsrc/vic20/crt0.s | 86 +- libsrc/vic20/devnum.s | 4 +- libsrc/vic20/get_tv.s | 30 +- libsrc/vic20/irq.s | 46 +- libsrc/vic20/joy/vic20-ptvjoy.s | 140 +- libsrc/vic20/joy/vic20-stdjoy.s | 10 +- libsrc/vic20/joy_stat_stddrv.s | 4 +- libsrc/vic20/joy_stddrv.s | 4 +- libsrc/vic20/kbhit.s | 6 +- libsrc/vic20/kernal.s | 76 +- libsrc/vic20/mainargs.s | 72 +- libsrc/vic20/randomize.s | 6 +- libsrc/vic20/revers.s | 26 +- libsrc/vic20/status.s | 2 +- libsrc/zlib/adler32.s | 126 +- libsrc/zlib/crc32.s | 204 +- libsrc/zlib/inflatemem.s | 738 +- libsrc/zlib/uncompress.c | 48 +- samples/README | 148 +- samples/ascii.c | 90 +- samples/fire.c | 8 +- samples/geos/hello1.c | 4 +- samples/geos/hello2.c | 2 +- samples/gunzip65.c | 242 +- samples/hello.c | 4 +- samples/mandelbrot.c | 26 +- samples/mousedemo.c | 10 +- samples/nachtm.c | 190 +- samples/plasma.c | 54 +- samples/sieve.c | 54 +- samples/tgidemo.c | 10 +- samples/tutorial/hello.c | 2 +- samples/tutorial/text.s | 4 +- src/ar65/add.c | 14 +- src/ar65/add.h | 6 +- src/ar65/del.c | 16 +- src/ar65/del.h | 8 +- src/ar65/error.c | 6 +- src/ar65/error.h | 6 +- src/ar65/exports.c | 58 +- src/ar65/exports.h | 6 +- src/ar65/extract.c | 14 +- src/ar65/extract.h | 6 +- src/ar65/fileio.c | 38 +- src/ar65/fileio.h | 6 +- src/ar65/global.c | 6 +- src/ar65/global.h | 6 +- src/ar65/library.c | 172 +- src/ar65/library.h | 10 +- src/ar65/list.c | 12 +- src/ar65/list.h | 6 +- src/ar65/main.c | 104 +- src/ar65/objdata.c | 36 +- src/ar65/objdata.h | 22 +- src/ar65/objfile.c | 110 +- src/ar65/objfile.h | 6 +- src/ca65/anonname.c | 6 +- src/ca65/anonname.h | 4 +- src/ca65/asserts.c | 4 +- src/ca65/asserts.h | 4 +- src/ca65/condasm.c | 338 +- src/ca65/condasm.h | 6 +- src/ca65/dbginfo.c | 52 +- src/ca65/dbginfo.h | 8 +- src/ca65/ea.h | 4 +- src/ca65/ea65.c | 128 +- src/ca65/ea65.h | 4 +- src/ca65/easw16.c | 12 +- src/ca65/easw16.h | 4 +- src/ca65/enum.c | 2 +- src/ca65/enum.h | 2 +- src/ca65/error.c | 18 +- src/ca65/error.h | 8 +- src/ca65/expr.c | 448 +- src/ca65/expr.h | 6 +- src/ca65/feature.c | 34 +- src/ca65/feature.h | 12 +- src/ca65/filetab.c | 64 +- src/ca65/filetab.h | 10 +- src/ca65/fragment.c | 10 +- src/ca65/fragment.h | 18 +- src/ca65/global.c | 28 +- src/ca65/global.h | 38 +- src/ca65/incpath.c | 8 +- src/ca65/incpath.h | 8 +- src/ca65/instr.c | 1246 +-- src/ca65/instr.h | 52 +- src/ca65/istack.c | 34 +- src/ca65/istack.h | 6 +- src/ca65/lineinfo.c | 8 +- src/ca65/lineinfo.h | 6 +- src/ca65/listing.c | 380 +- src/ca65/listing.h | 46 +- src/ca65/macro.c | 572 +- src/ca65/macro.h | 12 +- src/ca65/main.c | 356 +- src/ca65/nexttok.c | 180 +- src/ca65/nexttok.h | 6 +- src/ca65/objcode.c | 42 +- src/ca65/objcode.h | 6 +- src/ca65/objfile.c | 46 +- src/ca65/objfile.h | 6 +- src/ca65/options.c | 26 +- src/ca65/options.h | 6 +- src/ca65/pseudo.c | 932 +- src/ca65/pseudo.h | 6 +- src/ca65/repeat.c | 76 +- src/ca65/repeat.h | 6 +- src/ca65/scanner.c | 958 +- src/ca65/scanner.h | 10 +- src/ca65/segdef.c | 6 +- src/ca65/segdef.h | 8 +- src/ca65/segment.c | 268 +- src/ca65/segment.h | 14 +- src/ca65/sizeof.c | 4 +- src/ca65/sizeof.h | 2 +- src/ca65/span.h | 6 +- src/ca65/spool.c | 4 +- src/ca65/spool.h | 4 +- src/ca65/struct.c | 6 +- src/ca65/struct.h | 4 +- src/ca65/studyexpr.c | 30 +- src/ca65/studyexpr.h | 6 +- src/ca65/symbol.c | 2 +- src/ca65/symbol.h | 2 +- src/ca65/symentry.c | 82 +- src/ca65/symentry.h | 44 +- src/ca65/symtab.c | 298 +- src/ca65/symtab.h | 24 +- src/ca65/token.c | 2 +- src/ca65/token.h | 102 +- src/ca65/toklist.c | 72 +- src/ca65/toklist.h | 32 +- src/ca65/ulabel.c | 56 +- src/ca65/ulabel.h | 6 +- src/ca65html/ca65html | 834 +- src/cc65/anonname.c | 8 +- src/cc65/anonname.h | 6 +- src/cc65/asmcode.c | 14 +- src/cc65/asmcode.h | 8 +- src/cc65/asmlabel.c | 6 +- src/cc65/asmlabel.h | 6 +- src/cc65/asmstmt.c | 152 +- src/cc65/asmstmt.h | 8 +- src/cc65/assignment.c | 46 +- src/cc65/assignment.h | 2 +- src/cc65/casenode.c | 96 +- src/cc65/casenode.h | 8 +- src/cc65/codeent.c | 1694 +-- src/cc65/codeent.h | 48 +- src/cc65/codegen.c | 666 +- src/cc65/codegen.h | 80 +- src/cc65/codeinfo.c | 726 +- src/cc65/codeinfo.h | 34 +- src/cc65/codelab.c | 20 +- src/cc65/codelab.h | 24 +- src/cc65/codeopt.c | 754 +- src/cc65/codeopt.h | 6 +- src/cc65/codeseg.c | 1190 +-- src/cc65/codeseg.h | 30 +- src/cc65/compile.c | 234 +- src/cc65/compile.h | 6 +- src/cc65/coptadd.c | 374 +- src/cc65/coptadd.h | 26 +- src/cc65/coptc02.c | 88 +- src/cc65/coptc02.h | 6 +- src/cc65/coptcmp.c | 918 +- src/cc65/coptcmp.h | 58 +- src/cc65/coptind.c | 1234 +-- src/cc65/coptind.h | 6 +- src/cc65/coptneg.c | 434 +- src/cc65/coptneg.h | 66 +- src/cc65/coptptrload.c | 814 +- src/cc65/coptptrload.h | 18 +- src/cc65/coptptrstore.c | 218 +- src/cc65/coptptrstore.h | 24 +- src/cc65/coptpush.c | 90 +- src/cc65/coptpush.h | 6 +- src/cc65/coptshift.c | 128 +- src/cc65/coptshift.h | 4 +- src/cc65/coptsize.c | 160 +- src/cc65/coptsize.h | 4 +- src/cc65/coptstop.c | 158 +- src/cc65/coptstop.h | 6 +- src/cc65/coptstore.c | 120 +- src/cc65/coptstore.h | 2 +- src/cc65/coptsub.c | 158 +- src/cc65/coptsub.h | 16 +- src/cc65/copttest.c | 100 +- src/cc65/copttest.h | 6 +- src/cc65/dataseg.c | 18 +- src/cc65/dataseg.h | 14 +- src/cc65/datatype.c | 282 +- src/cc65/datatype.h | 70 +- src/cc65/declare.c | 1044 +- src/cc65/declare.h | 26 +- src/cc65/declattr.c | 22 +- src/cc65/declattr.h | 10 +- src/cc65/error.c | 40 +- src/cc65/error.h | 8 +- src/cc65/expr.c | 2134 ++-- src/cc65/expr.h | 2 +- src/cc65/exprdesc.c | 26 +- src/cc65/exprdesc.h | 12 +- src/cc65/funcdesc.c | 12 +- src/cc65/funcdesc.h | 34 +- src/cc65/function.c | 106 +- src/cc65/function.h | 8 +- src/cc65/global.c | 14 +- src/cc65/global.h | 30 +- src/cc65/goto.c | 16 +- src/cc65/goto.h | 6 +- src/cc65/hexval.c | 8 +- src/cc65/hexval.h | 2 +- src/cc65/ident.c | 8 +- src/cc65/ident.h | 12 +- src/cc65/incpath.c | 8 +- src/cc65/incpath.h | 8 +- src/cc65/input.c | 130 +- src/cc65/input.h | 8 +- src/cc65/lineinfo.c | 32 +- src/cc65/lineinfo.h | 12 +- src/cc65/litpool.c | 12 +- src/cc65/litpool.h | 8 +- src/cc65/loadexpr.c | 74 +- src/cc65/loadexpr.h | 2 +- src/cc65/locals.c | 94 +- src/cc65/locals.h | 6 +- src/cc65/loop.c | 12 +- src/cc65/loop.h | 16 +- src/cc65/macrotab.c | 110 +- src/cc65/macrotab.h | 18 +- src/cc65/main.c | 496 +- src/cc65/opcodes.c | 1130 +- src/cc65/opcodes.h | 64 +- src/cc65/output.c | 4 +- src/cc65/output.h | 4 +- src/cc65/pragma.c | 142 +- src/cc65/pragma.h | 6 +- src/cc65/preproc.c | 654 +- src/cc65/preproc.h | 4 +- src/cc65/reginfo.c | 18 +- src/cc65/reginfo.h | 16 +- src/cc65/scanner.c | 792 +- src/cc65/scanner.h | 30 +- src/cc65/scanstrbuf.c | 106 +- src/cc65/scanstrbuf.h | 2 +- src/cc65/segments.c | 32 +- src/cc65/segments.h | 22 +- src/cc65/shiftexpr.c | 60 +- src/cc65/shiftexpr.h | 4 +- src/cc65/stackptr.c | 4 +- src/cc65/stackptr.h | 4 +- src/cc65/standard.c | 10 +- src/cc65/standard.h | 4 +- src/cc65/stdfunc.c | 28 +- src/cc65/stdfunc.h | 6 +- src/cc65/stdnames.c | 2 +- src/cc65/stdnames.h | 2 +- src/cc65/stmt.c | 132 +- src/cc65/stmt.h | 6 +- src/cc65/swstmt.c | 16 +- src/cc65/swstmt.h | 6 +- src/cc65/symentry.c | 72 +- src/cc65/symentry.h | 94 +- src/cc65/symtab.c | 468 +- src/cc65/symtab.h | 30 +- src/cc65/testexpr.c | 16 +- src/cc65/testexpr.h | 2 +- src/cc65/textseg.c | 12 +- src/cc65/textseg.h | 12 +- src/cc65/typecmp.c | 326 +- src/cc65/typecmp.h | 20 +- src/cc65/typeconv.c | 76 +- src/cc65/typeconv.h | 2 +- src/cc65/util.c | 14 +- src/cc65/util.h | 6 +- src/chrcvt/error.c | 4 +- src/chrcvt/error.h | 4 +- src/chrcvt/main.c | 102 +- src/cl65/error.c | 8 +- src/cl65/error.h | 6 +- src/cl65/global.c | 8 +- src/cl65/global.h | 8 +- src/cl65/main.c | 576 +- src/cl65/spawn-amiga.inc | 6 +- src/cl65/spawn-unix.inc | 34 +- src/cl65/spawn.h | 10 +- src/co65/convert.c | 4 +- src/co65/convert.h | 4 +- src/co65/error.c | 4 +- src/co65/error.h | 4 +- src/co65/fileio.c | 12 +- src/co65/fileio.h | 4 +- src/co65/global.c | 4 +- src/co65/global.h | 10 +- src/co65/main.c | 122 +- src/co65/model.c | 4 +- src/co65/model.h | 4 +- src/co65/o65.c | 4 +- src/co65/o65.h | 26 +- src/common/abend.c | 6 +- src/common/abend.h | 6 +- src/common/addrsize.c | 2 +- src/common/addrsize.h | 4 +- src/common/attrib.h | 6 +- src/common/bitops.c | 62 +- src/common/bitops.h | 6 +- src/common/cddefs.h | 30 +- src/common/chartype.c | 6 +- src/common/chartype.h | 8 +- src/common/check.c | 26 +- src/common/check.h | 18 +- src/common/cmdline.c | 164 +- src/common/cmdline.h | 16 +- src/common/coll.c | 120 +- src/common/coll.h | 26 +- src/common/cpu.c | 10 +- src/common/cpu.h | 8 +- src/common/debugflag.c | 2 +- src/common/debugflag.h | 2 +- src/common/exprdefs.c | 220 +- src/common/exprdefs.h | 112 +- src/common/fileid.c | 4 +- src/common/fileid.h | 6 +- src/common/filepos.c | 6 +- src/common/filepos.h | 8 +- src/common/filestat.c | 2 +- src/common/filestat.h | 2 +- src/common/filetime.c | 4 +- src/common/filetime.h | 2 +- src/common/filetype.c | 40 +- src/common/filetype.h | 6 +- src/common/fname.c | 30 +- src/common/fname.h | 6 +- src/common/fp.c | 2 +- src/common/fp.h | 4 +- src/common/fragdefs.h | 32 +- src/common/gentype.h | 2 +- src/common/hashfunc.c | 6 +- src/common/hashfunc.h | 2 +- src/common/hashtab.h | 2 +- src/common/hlldbgsym.h | 2 +- src/common/inline.h | 10 +- src/common/libdefs.h | 20 +- src/common/lidefs.h | 4 +- src/common/matchpat.c | 172 +- src/common/matchpat.h | 2 +- src/common/mmodel.c | 10 +- src/common/mmodel.h | 4 +- src/common/objdefs.h | 44 +- src/common/optdefs.h | 30 +- src/common/print.c | 16 +- src/common/print.h | 14 +- src/common/scopedefs.h | 4 +- src/common/searchpath.c | 36 +- src/common/searchpath.h | 4 +- src/common/segdefs.h | 4 +- src/common/segnames.c | 10 +- src/common/segnames.h | 4 +- src/common/shift.c | 2 +- src/common/shift.h | 2 +- src/common/strbuf.c | 34 +- src/common/strbuf.h | 12 +- src/common/strutil.c | 10 +- src/common/strutil.h | 6 +- src/common/symdefs.h | 20 +- src/common/target.c | 8 +- src/common/target.h | 20 +- src/common/tgttrans.c | 12 +- src/common/tgttrans.h | 6 +- src/common/version.c | 44 +- src/common/version.h | 38 +- src/common/xmalloc.c | 52 +- src/common/xmalloc.h | 6 +- src/common/xsprintf.c | 6 +- src/common/xsprintf.h | 14 +- src/da65/asminc.c | 26 +- src/da65/asminc.h | 2 +- src/da65/attrtab.c | 46 +- src/da65/attrtab.h | 34 +- src/da65/code.c | 48 +- src/da65/code.h | 16 +- src/da65/comments.c | 4 +- src/da65/comments.h | 2 +- src/da65/data.c | 228 +- src/da65/data.h | 6 +- src/da65/error.c | 6 +- src/da65/error.h | 6 +- src/da65/global.c | 34 +- src/da65/global.h | 38 +- src/da65/handler.c | 114 +- src/da65/handler.h | 6 +- src/da65/infofile.c | 602 +- src/da65/infofile.h | 2 +- src/da65/labels.c | 50 +- src/da65/labels.h | 2 +- src/da65/main.c | 230 +- src/da65/opc6502.c | 4 +- src/da65/opc6502.h | 4 +- src/da65/opc6502x.c | 4 +- src/da65/opc6502x.h | 4 +- src/da65/opc65816.c | 4 +- src/da65/opc65816.h | 4 +- src/da65/opc65c02.c | 4 +- src/da65/opc65c02.h | 4 +- src/da65/opc65sc02.c | 4 +- src/da65/opc65sc02.h | 4 +- src/da65/opcdesc.h | 20 +- src/da65/opchuc6280.c | 4 +- src/da65/opchuc6280.h | 4 +- src/da65/opcm740.c | 2 +- src/da65/opcm740.h | 2 +- src/da65/opctable.c | 8 +- src/da65/opctable.h | 8 +- src/da65/output.c | 146 +- src/da65/output.h | 6 +- src/da65/scanner.c | 294 +- src/da65/scanner.h | 24 +- src/da65/segment.c | 2 +- src/da65/segment.h | 2 +- src/dbginfo/dbginfo.c | 214 +- src/dbginfo/dbginfo.h | 2 +- src/ld65/asserts.c | 4 +- src/ld65/asserts.h | 4 +- src/ld65/bin.c | 98 +- src/ld65/bin.h | 8 +- src/ld65/binfmt.c | 28 +- src/ld65/binfmt.h | 8 +- src/ld65/cfgexpr.c | 28 +- src/ld65/cfgexpr.h | 2 +- src/ld65/condes.c | 72 +- src/ld65/condes.h | 14 +- src/ld65/config.c | 1326 +-- src/ld65/config.h | 38 +- src/ld65/dbgfile.c | 8 +- src/ld65/dbgfile.h | 4 +- src/ld65/dbgsyms.c | 56 +- src/ld65/dbgsyms.h | 8 +- src/ld65/error.c | 6 +- src/ld65/error.h | 6 +- src/ld65/exports.c | 340 +- src/ld65/exports.h | 34 +- src/ld65/expr.c | 498 +- src/ld65/expr.h | 10 +- src/ld65/extsyms.c | 62 +- src/ld65/extsyms.h | 8 +- src/ld65/fileinfo.c | 6 +- src/ld65/fileinfo.h | 10 +- src/ld65/fileio.c | 80 +- src/ld65/fileio.h | 6 +- src/ld65/filepath.c | 6 +- src/ld65/filepath.h | 6 +- src/ld65/fragment.c | 12 +- src/ld65/fragment.h | 22 +- src/ld65/global.c | 14 +- src/ld65/global.h | 16 +- src/ld65/library.c | 80 +- src/ld65/library.h | 4 +- src/ld65/lineinfo.c | 6 +- src/ld65/lineinfo.h | 12 +- src/ld65/main.c | 266 +- src/ld65/mapfile.c | 20 +- src/ld65/mapfile.h | 8 +- src/ld65/memarea.c | 2 +- src/ld65/memarea.h | 26 +- src/ld65/o65.c | 674 +- src/ld65/o65.h | 22 +- src/ld65/objdata.c | 26 +- src/ld65/objdata.h | 30 +- src/ld65/objfile.c | 66 +- src/ld65/objfile.h | 6 +- src/ld65/scanner.c | 266 +- src/ld65/scanner.h | 18 +- src/ld65/scopes.c | 2 +- src/ld65/scopes.h | 6 +- src/ld65/segments.c | 388 +- src/ld65/segments.h | 50 +- src/ld65/span.c | 4 +- src/ld65/span.h | 6 +- src/ld65/spool.c | 4 +- src/ld65/spool.h | 4 +- src/ld65/tpool.c | 4 +- src/ld65/tpool.h | 4 +- src/od65/dump.c | 416 +- src/od65/dump.h | 6 +- src/od65/error.c | 6 +- src/od65/error.h | 6 +- src/od65/fileio.c | 50 +- src/od65/fileio.h | 6 +- src/od65/global.c | 8 +- src/od65/global.h | 24 +- src/od65/main.c | 236 +- src/sim65/addrspace.c | 2 +- src/sim65/addrspace.h | 4 +- src/sim65/callback.c | 26 +- src/sim65/callback.h | 4 +- src/sim65/cfgdata.c | 4 +- src/sim65/cfgdata.h | 16 +- src/sim65/chip.c | 30 +- src/sim65/chip.h | 2 +- src/sim65/chipdata.h | 2 +- src/sim65/chipif.h | 2 +- src/sim65/chippath.c | 4 +- src/sim65/chippath.h | 4 +- src/sim65/chips/console.c | 4 +- src/sim65/chips/ram.c | 8 +- src/sim65/chips/rom.c | 8 +- src/sim65/chips/stdio.c | 6 +- src/sim65/chips/vic2.c | 14 +- src/sim65/config.c | 54 +- src/sim65/config.h | 4 +- src/sim65/cpucore.c | 2 +- src/sim65/cpucore.h | 4 +- src/sim65/cpudata.h | 2 +- src/sim65/cpus/6502.c | 36 +- src/sim65/cputype.c | 6 +- src/sim65/cputype.h | 6 +- src/sim65/error.c | 4 +- src/sim65/error.h | 4 +- src/sim65/global.c | 6 +- src/sim65/global.h | 6 +- src/sim65/location.c | 4 +- src/sim65/location.h | 2 +- src/sim65/main.c | 134 +- src/sim65/memory.c | 8 +- src/sim65/memory.h | 8 +- src/sim65/scanner.c | 300 +- src/sim65/scanner.h | 22 +- src/sim65/simdata.h | 8 +- src/sim65/system.c | 2 +- src/sim65/system.h | 2 +- src/sp65/error.c | 2 +- src/sp65/error.h | 2 +- src/sp65/fileio.c | 16 +- src/sp65/fileio.h | 4 +- src/sp65/main.c | 92 +- testcode/compiler/pptest1.c | 10 +- testcode/compiler/pptest2.c | 28 +- testcode/compiler/pptest3.c | 20 +- testcode/compiler/pptest4.c | 4 +- testcode/compiler/pptest5.c | 2 +- testcode/grc/vlir0.s | 96 +- testcode/grc/vlir1.s | 44 +- testcode/grc/vlir2.s | 44 +- testcode/lib/atari/defdev.c | 6 +- testcode/lib/atari/scrcode.s | 58 +- testcode/lib/cprintf.c | 20 +- testcode/lib/cursor.c | 20 +- testcode/lib/dir-test.c | 24 +- testcode/lib/div-test.c | 42 +- testcode/lib/em-test.c | 16 +- testcode/lib/getsp.s | 12 +- testcode/lib/heaptest.c | 96 +- testcode/lib/joy-test.c | 28 +- testcode/lib/mul-test.c | 12 +- testcode/lib/rename-test.c | 78 +- testcode/lib/scanf-test.c | 8 +- testcode/lib/ser-test.c | 10 +- testcode/lib/strchr-test.c | 34 +- testcode/lib/strdup-test.c | 46 +- testcode/lib/strncmp-test.c | 2 +- util/atari/ataricvt.c | 14 +- util/cbm/cbmcvt.c | 30 +- util/zlib/deflater.c | 132 +- 1773 files changed, 62864 insertions(+), 62868 deletions(-) diff --git a/asminc/apple2.inc b/asminc/apple2.inc index 3ef6a3725..536a1d851 100644 --- a/asminc/apple2.inc +++ b/asminc/apple2.inc @@ -2,39 +2,39 @@ ;----------------------------------------------------------------------------- ; Zero page stuff -WNDLFT := $20 ; Text window left -WNDWDTH := $21 ; Text window width -WNDTOP := $22 ; Text window top -WNDBTM := $23 ; Text window bottom+1 -CH := $24 ; Cursor horizontal position -CV := $25 ; Cursor vertical position -BASL := $28 ; Text base address low -BASH := $29 ; Text base address high -INVFLG := $32 ; Normal/inverse(/flash) -PROMPT := $33 ; Used by GETLN -RNDL := $4E ; Random counter low -RNDH := $4F ; Random counter high -HIMEM := $73 ; Highest available memory address+1 +WNDLFT := $20 ; Text window left +WNDWDTH := $21 ; Text window width +WNDTOP := $22 ; Text window top +WNDBTM := $23 ; Text window bottom+1 +CH := $24 ; Cursor horizontal position +CV := $25 ; Cursor vertical position +BASL := $28 ; Text base address low +BASH := $29 ; Text base address high +INVFLG := $32 ; Normal/inverse(/flash) +PROMPT := $33 ; Used by GETLN +RNDL := $4E ; Random counter low +RNDH := $4F ; Random counter high +HIMEM := $73 ; Highest available memory address+1 ;----------------------------------------------------------------------------- ; Vectors -DOSWARM := $03D0 ; DOS warmstart vector -BRKVec := $03F0 ; Break vector -SOFTEV := $03F2 ; Vector for warm start -PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1 +DOSWARM := $03D0 ; DOS warmstart vector +BRKVec := $03F0 ; Break vector +SOFTEV := $03F2 ; Vector for warm start +PWREDUP := $03F4 ; This must be = EOR #$A5 of SOFTEV+1 ;----------------------------------------------------------------------------- ; Hardware ; Keyboard input -KBD := $C000 ; Read keyboard -KBDSTRB := $C010 ; Clear keyboard strobe +KBD := $C000 ; Read keyboard +KBDSTRB := $C010 ; Clear keyboard strobe ; 80 column video switches -CLR80COL:= $C000 ; Disable 80 column store -SET80COL:= $C001 ; Enable 80 column store -RD80COL := $C018 ; >127 if 80 column store enabled +CLR80COL:= $C000 ; Disable 80 column store +SET80COL:= $C001 ; Enable 80 column store +RD80COL := $C018 ; >127 if 80 column store enabled RD80VID := $C01F ; >127 if 80 column video enabled ; Character set switches @@ -43,22 +43,22 @@ SETALTCHAR := $C00F ; Norm/inv LC, no flash ALTCHARSET := $C01E ; >127 if alt charset switched in ; Language card switches -RDLCBNK2:= $C011 ; >127 if LC bank 2 in use -RDLCRAM := $C012 ; >127 if LC is read enabled -ROMIN := $C081 ; Swap in D000-FFFF ROM -LCBANK2 := $C083 ; Swap in LC bank 2 -LCBANK1 := $C08B ; Swap in LC bank 1 +RDLCBNK2:= $C011 ; >127 if LC bank 2 in use +RDLCRAM := $C012 ; >127 if LC is read enabled +ROMIN := $C081 ; Swap in D000-FFFF ROM +LCBANK2 := $C083 ; Swap in LC bank 2 +LCBANK1 := $C08B ; Swap in LC bank 1 ; Video mode switches -TXTCLR := $C050 ; Display graphics -TXTSET := $C051 ; Display text -MIXCLR := $C052 ; Disable 4 lines of text -MIXSET := $C053 ; Enable 4 lines of text -LOWSCR := $C054 ; Page 1 -HISCR := $C055 ; Page 2 -LORES := $C056 ; Lores graphics -HIRES := $C057 ; Hires graphics +TXTCLR := $C050 ; Display graphics +TXTSET := $C051 ; Display text +MIXCLR := $C052 ; Disable 4 lines of text +MIXSET := $C053 ; Enable 4 lines of text +LOWSCR := $C054 ; Page 1 +HISCR := $C055 ; Page 2 +LORES := $C056 ; Lores graphics +HIRES := $C057 ; Hires graphics ; Game controller -BUTN0 := $C061 ; Open-Apple Key -BUTN1 := $C062 ; Closed-Apple Key +BUTN0 := $C061 ; Open-Apple Key +BUTN1 := $C062 ; Closed-Apple Key diff --git a/asminc/atari.inc b/asminc/atari.inc index 912da1b54..29159a177 100644 --- a/asminc/atari.inc +++ b/asminc/atari.inc @@ -8,975 +8,975 @@ ; - Atari XL/XE rev.2 source code, Atari 1984 ; - Mapping the Atari - revised edition, Ian Chadwick 1985 ; -; ##old## old OS rev.B label - moved or deleted -; ##1200xl## new label introduced in 1200XL OS (rev.10/11) -; ##rev2## new label introduced in XL/XE OS rev.2 +; ##old## old OS rev.B label - moved or deleted +; ##1200xl## new label introduced in 1200XL OS (rev.10/11) +; ##rev2## new label introduced in XL/XE OS rev.2 ;------------------------------------------------------------------------- ;------------------------------------------------------------------------- ; Configuration Equates ;------------------------------------------------------------------------- -MAXDEV = 33 ;offset to last possible entry of HATABS -IOCBSZ = 16 ;length of IOCB +MAXDEV = 33 ;offset to last possible entry of HATABS +IOCBSZ = 16 ;length of IOCB -SEIOCB = 0*IOCBSZ ;##rev2## screen editor IOCB index -MAXIOC = 8*IOCBSZ ;first invalid IOCB index +SEIOCB = 0*IOCBSZ ;##rev2## screen editor IOCB index +MAXIOC = 8*IOCBSZ ;first invalid IOCB index -DSCTSZ = 128 ;##rev2## disk sector size +DSCTSZ = 128 ;##rev2## disk sector size -LEDGE = 2 ;left edge -REDGE = 39 ;right edge +LEDGE = 2 ;left edge +REDGE = 39 ;right edge -INIML = $0700 ;##rev2## initial MEMLO +INIML = $0700 ;##rev2## initial MEMLO -ICSORG = $CC00 ;##rev2## international character set origin -DCSORG = $E000 ;##rev2## domestic character set origin +ICSORG = $CC00 ;##rev2## international character set origin +DCSORG = $E000 ;##rev2## domestic character set origin ; IOCB Command Code Equates -OPEN = $03 ;open -GETREC = $05 ;get record -GETCHR = $07 ;get character(s) -PUTREC = $09 ;put record -PUTCHR = $0B ;put character(s) -CLOSE = $0C ;close -STATIS = $0D ;status -SPECIL = $0E ;special +OPEN = $03 ;open +GETREC = $05 ;get record +GETCHR = $07 ;get character(s) +PUTREC = $09 ;put record +PUTCHR = $0B ;put character(s) +CLOSE = $0C ;close +STATIS = $0D ;status +SPECIL = $0E ;special ; Special Entry Command Equates ; Screen Commands -DRAWLN = $11 ;draw line -FILLIN = $12 ;draw line with right fill +DRAWLN = $11 ;draw line +FILLIN = $12 ;draw line with right fill ; ICAX1 Auxiliary Byte 1 Equates -APPEND = $01 ;open write append (D:) -DIRECT = $02 ;open for directory access (D:) -OPNIN = $04 ;open for input (all devices) -OPNOT = $08 ;open for output (all devices) -MXDMOD = $10 ;open for mixed mode (E:, S:) -INSCLR = $20 ;open for input without clearing screen +APPEND = $01 ;open write append (D:) +DIRECT = $02 ;open for directory access (D:) +OPNIN = $04 ;open for input (all devices) +OPNOT = $08 ;open for output (all devices) +MXDMOD = $10 ;open for mixed mode (E:, S:) +INSCLR = $20 ;open for input without clearing screen ; Device Code Equates -CASSET = 'C' ;cassette -DISK = 'D' ;disk -SCREDT = 'E' ;screen editor -KBD = 'K' ;keyboard -PRINTR = 'P' ;printer -DISPLY = 'S' ;screen display +CASSET = 'C' ;cassette +DISK = 'D' ;disk +SCREDT = 'E' ;screen editor +KBD = 'K' ;keyboard +PRINTR = 'P' ;printer +DISPLY = 'S' ;screen display ; SIO Command Code Equates -SIO_FORMAT = $21 ;format disk (default density) -SIO_FORMATS = $22 ;1050: format medium density -SIO_CONFIG = $44 ;configure drive -SIO_CONFIGSF = $4B ;slow/fast configure drive?? -SIO_WRITE = $50 ;write sector -SIO_READ = $52 ;read sector -SIO_STAT = $53 ;get status information -SIO_VERIFY = $56 ;verify sector -SIO_WRITEV = $57 ;write sector with verify +SIO_FORMAT = $21 ;format disk (default density) +SIO_FORMATS = $22 ;1050: format medium density +SIO_CONFIG = $44 ;configure drive +SIO_CONFIGSF = $4B ;slow/fast configure drive?? +SIO_WRITE = $50 ;write sector +SIO_READ = $52 ;read sector +SIO_STAT = $53 ;get status information +SIO_VERIFY = $56 ;verify sector +SIO_WRITEV = $57 ;write sector with verify ; Character and Key Code Equates -CLS = $7D ;##rev2## clear screen -EOL = $9B ;end of line (RETURN) +CLS = $7D ;##rev2## clear screen +EOL = $9B ;end of line (RETURN) -HELP = $11 ;##1200xl## key code for HELP -CNTLF1 = $83 ;##1200xl## key code for CTRL-F1 -CNTLF2 = $84 ;##1200xl## key code for CTRL-F2 -CNTLF3 = $93 ;##1200xl## key code for CTRL-F3 -CNTLF4 = $94 ;##1200xl## key code for CTRL-F4 -CNTL1 = $9F ;##1200xl## key code for CTRL-1 +HELP = $11 ;##1200xl## key code for HELP +CNTLF1 = $83 ;##1200xl## key code for CTRL-F1 +CNTLF2 = $84 ;##1200xl## key code for CTRL-F2 +CNTLF3 = $93 ;##1200xl## key code for CTRL-F3 +CNTLF4 = $94 ;##1200xl## key code for CTRL-F4 +CNTL1 = $9F ;##1200xl## key code for CTRL-1 ; Status Code Equates -SUCCES = 1 ;($01) succesful operation +SUCCES = 1 ;($01) succesful operation -BRKABT = 128 ;($80) BREAK key abort -PRVOPN = 129 ;($81) IOCB already open error -NONDEV = 130 ;($82) nonexistent device error -WRONLY = 131 ;($83) IOCB opened for write only error -NVALID = 132 ;($84) invalid command error -NOTOPN = 133 ;($85) device/file not open error -BADIOC = 134 ;($86) invalid IOCB index error -RDONLY = 135 ;($87) IOCB opened for read only error -EOFERR = 136 ;($88) end of file error -TRNRCD = 137 ;($89) truncated record error -TIMOUT = 138 ;($8A) peripheral device timeout error -DNACK = 139 ;($8B) device does not acknowledge command -FRMERR = 140 ;($8C) serial bus framing error -CRSROR = 141 ;($8D) cursor overrange error -OVRRUN = 142 ;($8E) serial bus data overrun error -CHKERR = 143 ;($8F) serial bus checksum error -DERROR = 144 ;($90) device done (operation incomplete) -BADMOD = 145 ;($91) bad screen mode number error -FNCNOT = 146 ;($92) function not implemented in handler -SCRMEM = 147 ;($93) insufficient memory for screen mode +BRKABT = 128 ;($80) BREAK key abort +PRVOPN = 129 ;($81) IOCB already open error +NONDEV = 130 ;($82) nonexistent device error +WRONLY = 131 ;($83) IOCB opened for write only error +NVALID = 132 ;($84) invalid command error +NOTOPN = 133 ;($85) device/file not open error +BADIOC = 134 ;($86) invalid IOCB index error +RDONLY = 135 ;($87) IOCB opened for read only error +EOFERR = 136 ;($88) end of file error +TRNRCD = 137 ;($89) truncated record error +TIMOUT = 138 ;($8A) peripheral device timeout error +DNACK = 139 ;($8B) device does not acknowledge command +FRMERR = 140 ;($8C) serial bus framing error +CRSROR = 141 ;($8D) cursor overrange error +OVRRUN = 142 ;($8E) serial bus data overrun error +CHKERR = 143 ;($8F) serial bus checksum error +DERROR = 144 ;($90) device done (operation incomplete) +BADMOD = 145 ;($91) bad screen mode number error +FNCNOT = 146 ;($92) function not implemented in handler +SCRMEM = 147 ;($93) insufficient memory for screen mode -DSKFMT = 148 ;($94) SpartaDOS: unrecognized disk format -INCVER = 149 ;($95) SpartaDOS: disk was made with incompat. version -DIRNFD = 150 ;($96) SpartaDOS: directory not found -FEXIST = 151 ;($97) SpartaDOS: file exists -NOTBIN = 152 ;($98) SpartaDOS: file not binary -LSYMND = 154 ;($9A) SDX: loader symbol not defined -BADPRM = 156 ;($9C) SDX: bad parameter -OUTOFM = 158 ;($9E) SDX: out of memory -INVDEV = 160 ;($A0) invalid device number -TMOF = 161 ;($A1) too many open files -DSKFLL = 162 ;($A2) disk full -FATLIO = 163 ;($A3) fatal I/O error -FNMSMT = 164 ;($A4) internal file number mismatch -INVFNM = 165 ;($A5) invalid file name -PDLERR = 166 ;($A6) point data length error -EPERM = 167 ;($A7) permission denied -DINVCM = 168 ;($A8) command invalid for disk -DIRFLL = 169 ;($A9) directory full -FNTFND = 170 ;($AA) file not found -PNTINV = 171 ;($AB) point invalid -BADDSK = 173 ;($AD) bad disk -INCFMT = 176 ;($B0) DOS 3: incompatible file system +DSKFMT = 148 ;($94) SpartaDOS: unrecognized disk format +INCVER = 149 ;($95) SpartaDOS: disk was made with incompat. version +DIRNFD = 150 ;($96) SpartaDOS: directory not found +FEXIST = 151 ;($97) SpartaDOS: file exists +NOTBIN = 152 ;($98) SpartaDOS: file not binary +LSYMND = 154 ;($9A) SDX: loader symbol not defined +BADPRM = 156 ;($9C) SDX: bad parameter +OUTOFM = 158 ;($9E) SDX: out of memory +INVDEV = 160 ;($A0) invalid device number +TMOF = 161 ;($A1) too many open files +DSKFLL = 162 ;($A2) disk full +FATLIO = 163 ;($A3) fatal I/O error +FNMSMT = 164 ;($A4) internal file number mismatch +INVFNM = 165 ;($A5) invalid file name +PDLERR = 166 ;($A6) point data length error +EPERM = 167 ;($A7) permission denied +DINVCM = 168 ;($A8) command invalid for disk +DIRFLL = 169 ;($A9) directory full +FNTFND = 170 ;($AA) file not found +PNTINV = 171 ;($AB) point invalid +BADDSK = 173 ;($AD) bad disk +INCFMT = 176 ;($B0) DOS 3: incompatible file system ; DCB Device Bus Equates -DISKID = $31 ;##rev2## disk bus ID -PDEVN = $40 ;##rev2## printer bus ID -CASET = $60 ;##rev2## cassette bus ID +DISKID = $31 ;##rev2## disk bus ID +PDEVN = $40 ;##rev2## printer bus ID +CASET = $60 ;##rev2## cassette bus ID ; Bus Command Equates -FOMAT = '!' ;##rev2## format command -PUTSEC = 'P' ;##rev2## put sector command -READ = 'R' ;##rev2## read command -STATC = 'S' ;##rev2## status command -WRITE = 'W' ;##rev2## write command +FOMAT = '!' ;##rev2## format command +PUTSEC = 'P' ;##rev2## put sector command +READ = 'R' ;##rev2## read command +STATC = 'S' ;##rev2## status command +WRITE = 'W' ;##rev2## write command ; Command Auxiliary Byte Equates -DOUBLE = 'D' ;##rev2## print 20 characters double width -NORMAL = 'N' ;##rev2## print 40 characters normally -PLOT = 'P' ;##rev2## plot -SIDWAY = 'S' ;##rev2## print 16 characters sideways +DOUBLE = 'D' ;##rev2## print 20 characters double width +NORMAL = 'N' ;##rev2## print 40 characters normally +PLOT = 'P' ;##rev2## plot +SIDWAY = 'S' ;##rev2## print 16 characters sideways ; Bus Response Equates -ACK = 'A' ;##rev2## device acknowledged -COMPLT = 'C' ;##rev2## device succesfully completed operation -ERROR = 'E' ;##rev2## device incurred error -NACK = 'N' ;##rev2## device did not understand +ACK = 'A' ;##rev2## device acknowledged +COMPLT = 'C' ;##rev2## device succesfully completed operation +ERROR = 'E' ;##rev2## device incurred error +NACK = 'N' ;##rev2## device did not understand ; Floating Point Miscellaneous Equates -FPREC = 6 ;precision +FPREC = 6 ;precision -FMPREC = FPREC-1 ;##rev2## length of mantissa +FMPREC = FPREC-1 ;##rev2## length of mantissa ; Cassette Record Type Equates -HDR = $FB ;##rev2## header -DTA = $FC ;##rev2## data record -DT1 = $FA ;##rev2## last data record -EOT = $FE ;##rev2## end of tape (file) +HDR = $FB ;##rev2## header +DTA = $FC ;##rev2## data record +DT1 = $FA ;##rev2## last data record +EOT = $FE ;##rev2## end of tape (file) -TONE1 = 2 ;##rev2## record -TONE2 = 1 ;##rev2## playback +TONE1 = 2 ;##rev2## record +TONE2 = 1 ;##rev2## playback ; Cassette Timing Equates -WLEADN = 1152 ;##rev2## NTSC 19.2 second WRITE file leader -RLEADN = 576 ;##rev2## NTSC 9.6 second READ file leader -WIRGLN = 180 ;##rev2## NTSC 3.0 second WRITE IRG -RIRGLN = 120 ;##rev2## NTSC 2.0 second READ IRG -WSIRGN = 15 ;##rev2## NTSC 0.25 second WRITE short IRG -RSIRGN = 10 ;##rev2## NTSC 0.16 second READ short IRG -BEEPNN = 30 ;##rev2## NTSC 0.5 second beep duration -BEEPFN = 10 ;##rev2## NTSC 0.16 seconrd beep duration +WLEADN = 1152 ;##rev2## NTSC 19.2 second WRITE file leader +RLEADN = 576 ;##rev2## NTSC 9.6 second READ file leader +WIRGLN = 180 ;##rev2## NTSC 3.0 second WRITE IRG +RIRGLN = 120 ;##rev2## NTSC 2.0 second READ IRG +WSIRGN = 15 ;##rev2## NTSC 0.25 second WRITE short IRG +RSIRGN = 10 ;##rev2## NTSC 0.16 second READ short IRG +BEEPNN = 30 ;##rev2## NTSC 0.5 second beep duration +BEEPFN = 10 ;##rev2## NTSC 0.16 seconrd beep duration -WLEADP = 960 ;##rev2## PAL 19.2 second WRITE file leader -RLEADP = 480 ;##rev2## PAL 9.6 second READ file leader -WIRGLP = 150 ;##rev2## PAL 3.0 second WRITE IRG -RIRGLP = 100 ;##rev2## PAL 2.0 second READ IRG -WSIRGP = 13 ;##rev2## PAL 0.25 second WRITE short IRG -RSIRGP = 8 ;##rev2## PAL 0.16 second READ short IRG -BEEPNP = 25 ;##rev2## PAL 0.5 second beep duration -BEEPFP = 8 ;##rev2## PAL 0.16 seconrd beep duration +WLEADP = 960 ;##rev2## PAL 19.2 second WRITE file leader +RLEADP = 480 ;##rev2## PAL 9.6 second READ file leader +WIRGLP = 150 ;##rev2## PAL 3.0 second WRITE IRG +RIRGLP = 100 ;##rev2## PAL 2.0 second READ IRG +WSIRGP = 13 ;##rev2## PAL 0.25 second WRITE short IRG +RSIRGP = 8 ;##rev2## PAL 0.16 second READ short IRG +BEEPNP = 25 ;##rev2## PAL 0.5 second beep duration +BEEPFP = 8 ;##rev2## PAL 0.16 seconrd beep duration -WIRGHI = 0 ;##rev2## high WRITE IRG -RIRGHI = 0 ;##rev2## high READ IRG +WIRGHI = 0 ;##rev2## high WRITE IRG +RIRGHI = 0 ;##rev2## high READ IRG ; Power-up Validation Byte Value Equates -PUPVL1 = $5C ;##rev2## power-up validation value 1 -PUPVL2 = $93 ;##rev2## power-up validation value 2 -PUPVL3 = $25 ;##rev2## power-up validation value 3 +PUPVL1 = $5C ;##rev2## power-up validation value 1 +PUPVL2 = $93 ;##rev2## power-up validation value 2 +PUPVL3 = $25 ;##rev2## power-up validation value 3 ; Relocating Loader Miscellaneous Equates -DATAER = 156 ;##rev2## end of record appears before END -MEMERR = 157 ;##rev2## memory insufficient for load error +DATAER = 156 ;##rev2## end of record appears before END +MEMERR = 157 ;##rev2## memory insufficient for load error ; Miscellaneous Equates -IOCFRE = $FF ;IOCB free indication +IOCFRE = $FF ;IOCB free indication -B19200 = $0028 ;##rev2## 19200 baud POKEY counter value -B00600 = $05CC ;##rev2## 600 baud POKEY counter value +B19200 = $0028 ;##rev2## 19200 baud POKEY counter value +B00600 = $05CC ;##rev2## 600 baud POKEY counter value -HITONE = $05 ;##rev2## FSK high freq. POKEY counter value -LOTONE = $07 ;##rev2## FSK low freq. POKEY counter value +HITONE = $05 ;##rev2## FSK high freq. POKEY counter value +LOTONE = $07 ;##rev2## FSK low freq. POKEY counter value -NCOMLO = $34 ;##rev2## PIA lower NOT COMMAND line command -NCOMHI = $3C ;##rev2## PIA raise NOT COMMAND line command +NCOMLO = $34 ;##rev2## PIA lower NOT COMMAND line command +NCOMHI = $3C ;##rev2## PIA raise NOT COMMAND line command -MOTRGO = $34 ;##rev2## PIA cassette motor ON command -MOTRST = $3C ;##rev2## PIA cassette motor OFF command +MOTRGO = $34 ;##rev2## PIA cassette motor ON command +MOTRST = $3C ;##rev2## PIA cassette motor OFF command -NODAT = $00 ;##rev2## SIO immediate operation -GETDAT = $40 ;##rev2## SIO read data frame -PUTDAT = $80 ;##rev2## SIO write data frame +NODAT = $00 ;##rev2## SIO immediate operation +GETDAT = $40 ;##rev2## SIO read data frame +PUTDAT = $80 ;##rev2## SIO write data frame -CRETRI = 13 ;##rev2## number of command frame retries -DRETRI = 1 ;##rev2## number of device retries -CTIM = 2 ;##rev2## command frame ACK timeout +CRETRI = 13 ;##rev2## number of command frame retries +DRETRI = 1 ;##rev2## number of device retries +CTIM = 2 ;##rev2## command frame ACK timeout -NBUFSZ = 40 ;##rev2## print normal buffer size -DBUFSZ = 20 ;##rev2## print double buffer size -SBUFSZ = 29 ;##rev2## print sideways buffer size +NBUFSZ = 40 ;##rev2## print normal buffer size +DBUFSZ = 20 ;##rev2## print double buffer size +SBUFSZ = 29 ;##rev2## print sideways buffer size ;------------------------------------------------------------------------- ; Page Zero Address Equates ;------------------------------------------------------------------------- -LINZBS = $00 ;LINBUG RAM (WILL BE REPLACED BY MONITOR RAM) -LNFLG = $00 ;##1200xl## 1-byte LNBUG flag (0 = not LNBUG) -NGFLAG = $01 ;##1200xl## 1-byte memory status (0 = failure) +LINZBS = $00 ;LINBUG RAM (WILL BE REPLACED BY MONITOR RAM) +LNFLG = $00 ;##1200xl## 1-byte LNBUG flag (0 = not LNBUG) +NGFLAG = $01 ;##1200xl## 1-byte memory status (0 = failure) ; Not Cleared -CASINI = $02 ;CASSETTE INIT LOCATION -RAMLO = $04 ;RAM POINTER FOR MEMORY TEST -TRAMSZ = $06 ;TEMPORARY REGISTER FOR RAM SIZE -;TSTDAT = $07 ;##old## RAM TEST DATA REGISTER -CMCMD = $07 ;##rev2## 1-byte command communications +CASINI = $02 ;CASSETTE INIT LOCATION +RAMLO = $04 ;RAM POINTER FOR MEMORY TEST +TRAMSZ = $06 ;TEMPORARY REGISTER FOR RAM SIZE +;TSTDAT = $07 ;##old## RAM TEST DATA REGISTER +CMCMD = $07 ;##rev2## 1-byte command communications ; Cleared upon Coldstart only -WARMST = $08 ;WARM START FLAG -BOOTQ = $09 ;SUCCESSFUL BOOT FLAG -DOSVEC = $0A ;DISK SOFTWARE START VECTOR -DOSINI = $0C ;DISK SOFTWARE INIT ADDRESS -APPMHI = $0E ;APPLICATIONS MEMORY HI LIMIT +WARMST = $08 ;WARM START FLAG +BOOTQ = $09 ;SUCCESSFUL BOOT FLAG +DOSVEC = $0A ;DISK SOFTWARE START VECTOR +DOSINI = $0C ;DISK SOFTWARE INIT ADDRESS +APPMHI = $0E ;APPLICATIONS MEMORY HI LIMIT ; Cleared upon Coldstart or Warmstart -INTZBS = $10 ;INTERRUPT HANDLER +INTZBS = $10 ;INTERRUPT HANDLER -POKMSK = $10 ;SYSTEM MASK FOR POKEY IRG ENABLE -BRKKEY = $11 ;BREAK KEY FLAG -RTCLOK = $12 ;REAL TIME CLOCK (IN 16 MSEC UNITS> -BUFADR = $15 ;INDIRECT BUFFER ADDRESS REGISTER -ICCOMT = $17 ;COMMAND FOR VECTOR -DSKFMS = $18 ;DISK FILE MANAGER POINTER -DSKUTL = $1A ;DISK UTILITIES POINTER -ABUFPT = $1C ;##1200xl## 4-byte ACMI buffer pointer area +POKMSK = $10 ;SYSTEM MASK FOR POKEY IRG ENABLE +BRKKEY = $11 ;BREAK KEY FLAG +RTCLOK = $12 ;REAL TIME CLOCK (IN 16 MSEC UNITS> +BUFADR = $15 ;INDIRECT BUFFER ADDRESS REGISTER +ICCOMT = $17 ;COMMAND FOR VECTOR +DSKFMS = $18 ;DISK FILE MANAGER POINTER +DSKUTL = $1A ;DISK UTILITIES POINTER +ABUFPT = $1C ;##1200xl## 4-byte ACMI buffer pointer area -;PTIMOT = $1C ;##old## PRINTER TIME OUT REGISTER -;PBPNT = $1D ;##old## PRINT BUFFER POINTER -;PBUFSZ = $1E ;##old## PRINT BUFFER SIZE -;PTEMP = $1F ;##old## TEMPORARY REGISTER +;PTIMOT = $1C ;##old## PRINTER TIME OUT REGISTER +;PBPNT = $1D ;##old## PRINT BUFFER POINTER +;PBUFSZ = $1E ;##old## PRINT BUFFER SIZE +;PTEMP = $1F ;##old## TEMPORARY REGISTER -ZIOCB = $20 ;ZERO PAGE I/O CONTROL BLOCK -IOCBAS = $20 ;16-byte page zero IOCB -ICHIDZ = $20 ;HANDLER INDEX NUMBER (FF = IOCB FREE) -ICDNOZ = $21 ;DEVICE NUMBER (DRIVE NUMBER) -ICCOMZ = $22 ;COMMAND CODE -ICSTAZ = $23 ;STATUS OF LAST IOCB ACTION -ICBALZ = $24 ;BUFFER ADDRESS LOW BYTE -ICBAHZ = $25 ;1-byte high buffer address -ICPTLZ = $26 ;PUT BYTE ROUTINE ADDRESS -1 -ICPTHZ = $27 ;1-byte high PUT-BYTE routine address -ICBLLZ = $28 ;BUFFER LENGTH LOW BYTE -ICBLHZ = $29 ;1-byte high buffer length -ICAX1Z = $2A ;AUXILIARY INFORMATION FIRST BYTE -ICAX2Z = $2B ;1-byte second auxiliary information -ICSPRZ = $2C ;4-byte spares +ZIOCB = $20 ;ZERO PAGE I/O CONTROL BLOCK +IOCBAS = $20 ;16-byte page zero IOCB +ICHIDZ = $20 ;HANDLER INDEX NUMBER (FF = IOCB FREE) +ICDNOZ = $21 ;DEVICE NUMBER (DRIVE NUMBER) +ICCOMZ = $22 ;COMMAND CODE +ICSTAZ = $23 ;STATUS OF LAST IOCB ACTION +ICBALZ = $24 ;BUFFER ADDRESS LOW BYTE +ICBAHZ = $25 ;1-byte high buffer address +ICPTLZ = $26 ;PUT BYTE ROUTINE ADDRESS -1 +ICPTHZ = $27 ;1-byte high PUT-BYTE routine address +ICBLLZ = $28 ;BUFFER LENGTH LOW BYTE +ICBLHZ = $29 ;1-byte high buffer length +ICAX1Z = $2A ;AUXILIARY INFORMATION FIRST BYTE +ICAX2Z = $2B ;1-byte second auxiliary information +ICSPRZ = $2C ;4-byte spares -ENTVEC = $2C ;##rev2## 2-byte (not used) -ICIDNO = $2E ;IOCB NUMBER X 16 -CIOCHR = $2F ;CHARACTER BYTE FOR CURRENT OPERATION +ENTVEC = $2C ;##rev2## 2-byte (not used) +ICIDNO = $2E ;IOCB NUMBER X 16 +CIOCHR = $2F ;CHARACTER BYTE FOR CURRENT OPERATION -STATUS = $30 ;INTERNAL STATUS STORAGE -CHKSUM = $31 ;CHECKSUM (SINGLE BYTE SUM WITH CARRY) -BUFRLO = $32 ;POINTER TO DATA BUFFER (LO BYTE) -BUFRHI = $33 ;POINTER TO DATA BUFFER (HI BYTE) -BFENLO = $34 ;NEXT BYTE PAST END OF THE DATA BUFFER LO -BFENHI = $35 ;NEXT BYTE PAST END OF THE DATA BUFFER HI -;CRETRY = $36 ;##old## NUMBER OF COMMAND FRAME RETRIES -;DRETRY = $37 ;##old## NUMBER OF DEVICE RETRIES -LTEMP = $36 ;##1200xl## 2-byte loader temporary -BUFRFL = $38 ;DATA BUFFER FULL FLAG -RECVDN = $39 ;RECEIVE DONE FLAG -XMTDON = $3A ;TRANSMISSION DONE FLAG -CHKSNT = $3B ;CHECKSUM SENT FLAG -NOCKSM = $3C ;NO CHECKSUM FOLLOWS DATA FLAG -BPTR = $3D ;1-byte cassette buffer pointer -FTYPE = $3E ;1-byte cassette IRG type -FEOF = $3F ;1-byte cassette EOF flag (0 = quiet) -FREQ = $40 ;1-byte cassette beep counter -SOUNDR = $41 ;NOISY I/0 FLAG. (ZERO IS QUIET) +STATUS = $30 ;INTERNAL STATUS STORAGE +CHKSUM = $31 ;CHECKSUM (SINGLE BYTE SUM WITH CARRY) +BUFRLO = $32 ;POINTER TO DATA BUFFER (LO BYTE) +BUFRHI = $33 ;POINTER TO DATA BUFFER (HI BYTE) +BFENLO = $34 ;NEXT BYTE PAST END OF THE DATA BUFFER LO +BFENHI = $35 ;NEXT BYTE PAST END OF THE DATA BUFFER HI +;CRETRY = $36 ;##old## NUMBER OF COMMAND FRAME RETRIES +;DRETRY = $37 ;##old## NUMBER OF DEVICE RETRIES +LTEMP = $36 ;##1200xl## 2-byte loader temporary +BUFRFL = $38 ;DATA BUFFER FULL FLAG +RECVDN = $39 ;RECEIVE DONE FLAG +XMTDON = $3A ;TRANSMISSION DONE FLAG +CHKSNT = $3B ;CHECKSUM SENT FLAG +NOCKSM = $3C ;NO CHECKSUM FOLLOWS DATA FLAG +BPTR = $3D ;1-byte cassette buffer pointer +FTYPE = $3E ;1-byte cassette IRG type +FEOF = $3F ;1-byte cassette EOF flag (0 = quiet) +FREQ = $40 ;1-byte cassette beep counter +SOUNDR = $41 ;NOISY I/0 FLAG. (ZERO IS QUIET) -CRITIC = $42 ;DEFINES CRITICAL SECTION (CRITICAL IF NON-Z) +CRITIC = $42 ;DEFINES CRITICAL SECTION (CRITICAL IF NON-Z) -FMSZPG = $43 ;DISK FILE MANAGER SYSTEM ZERO PAGE +FMSZPG = $43 ;DISK FILE MANAGER SYSTEM ZERO PAGE -;CKEY = $4A ;##old## FLAG SET WHEN GAME START PRESSED -ZCHAIN = $4A ;##1200xl## 2-byte handler linkage chain pointer -;CASSBT = $4B ;##old## CASSETTE BOOT FLAG -DSTAT = $4C ;DISPLAY STATUS -ATRACT = $4D ;ATRACT FLAG -DRKMSK = $4E ;DARK ATRACT MASK -COLRSH = $4F ;ATRACT COLOR SHIFTER (EOR'ED WITH PLAYFIELD +;CKEY = $4A ;##old## FLAG SET WHEN GAME START PRESSED +ZCHAIN = $4A ;##1200xl## 2-byte handler linkage chain pointer +;CASSBT = $4B ;##old## CASSETTE BOOT FLAG +DSTAT = $4C ;DISPLAY STATUS +ATRACT = $4D ;ATRACT FLAG +DRKMSK = $4E ;DARK ATRACT MASK +COLRSH = $4F ;ATRACT COLOR SHIFTER (EOR'ED WITH PLAYFIELD -TMPCHR = $50 ;1-byte temporary character -HOLD1 = $51 ;1-byte temporary -LMARGN = $52 ;left margin (normally 2, cc65 C startup code sets it to 0) -RMARGN = $53 ;right margin (normally 39 if no XEP80 is used) -ROWCRS = $54 ;1-byte cursor row -COLCRS = $55 ;2-byte cursor column -DINDEX = $57 ;1-byte display mode -SAVMSC = $58 ;2-byte saved memory scan counter -OLDROW = $5A ;1-byte prior row -OLDCOL = $5B ;2-byte prior column -OLDCHR = $5D ;DATA UNDER CURSOR -OLDADR = $5E ;2-byte saved cursor memory address -FKDEF = $60 ;##1200xl## 2-byte function key definition table -;NEWROW = $60 ;##old## POINT DRAW GOES TO -;NEWCOL = $61 ;##old## -PALNTS = $62 ;##1200xl## 1-byte PAL/NTSC indicator (0 = NTSC) -LOGCOL = $63 ;POINTS AT COLUMN IN LOGICAL LINE -ADRESS = $64 ;2-byte temporary address +TMPCHR = $50 ;1-byte temporary character +HOLD1 = $51 ;1-byte temporary +LMARGN = $52 ;left margin (normally 2, cc65 C startup code sets it to 0) +RMARGN = $53 ;right margin (normally 39 if no XEP80 is used) +ROWCRS = $54 ;1-byte cursor row +COLCRS = $55 ;2-byte cursor column +DINDEX = $57 ;1-byte display mode +SAVMSC = $58 ;2-byte saved memory scan counter +OLDROW = $5A ;1-byte prior row +OLDCOL = $5B ;2-byte prior column +OLDCHR = $5D ;DATA UNDER CURSOR +OLDADR = $5E ;2-byte saved cursor memory address +FKDEF = $60 ;##1200xl## 2-byte function key definition table +;NEWROW = $60 ;##old## POINT DRAW GOES TO +;NEWCOL = $61 ;##old## +PALNTS = $62 ;##1200xl## 1-byte PAL/NTSC indicator (0 = NTSC) +LOGCOL = $63 ;POINTS AT COLUMN IN LOGICAL LINE +ADRESS = $64 ;2-byte temporary address -MLTTMP = $66 ;1-byte temporary -OPNTMP = $66 ;FIRST BYTE IS USED IN OPEN AS TEMP -TOADR = $66 ;##rev2## 2-byte destination address +MLTTMP = $66 ;1-byte temporary +OPNTMP = $66 ;FIRST BYTE IS USED IN OPEN AS TEMP +TOADR = $66 ;##rev2## 2-byte destination address -SAVADR = $68 ;2-byte saved address -FRMADR = $68 ;##rev2## 2-byte source address +SAVADR = $68 ;2-byte saved address +FRMADR = $68 ;##rev2## 2-byte source address -RAMTOP = $6A ;RAM SIZE DEFINED BY POWER ON LOGIC -BUFCNT = $6B ;BUFFER COUNT -BUFSTR = $6C ;EDITOR GETCH POINTER -BITMSK = $6E ;BIT MASK -SHFAMT = $6F ;1-byte shift amount for pixel justifucation -ROWAC = $70 ;2-byte draw working row -COLAC = $72 ;2-byte draw working column -ENDPT = $74 ;2-byte end point -DELTAR = $76 ;1-byte row difference -DELTAC = $77 ;2-byte column difference -KEYDEF = $79 ;##1200xl## 2-byte key definition table address -;ROWINC = $79 ;##old## -;COLINC = $7A ;##old## -SWPFLG = $7B ;NON-0 1F TXT AND REGULAR RAM IS SWAPPED -HOLDCH = $7C ;CH IS MOVED HERE IN KGETCH BEFORE CNTL & SH -INSDAT = $7D ;1-byte temporary -COUNTR = $7E ;2-byte draw iteration count +RAMTOP = $6A ;RAM SIZE DEFINED BY POWER ON LOGIC +BUFCNT = $6B ;BUFFER COUNT +BUFSTR = $6C ;EDITOR GETCH POINTER +BITMSK = $6E ;BIT MASK +SHFAMT = $6F ;1-byte shift amount for pixel justifucation +ROWAC = $70 ;2-byte draw working row +COLAC = $72 ;2-byte draw working column +ENDPT = $74 ;2-byte end point +DELTAR = $76 ;1-byte row difference +DELTAC = $77 ;2-byte column difference +KEYDEF = $79 ;##1200xl## 2-byte key definition table address +;ROWINC = $79 ;##old## +;COLINC = $7A ;##old## +SWPFLG = $7B ;NON-0 1F TXT AND REGULAR RAM IS SWAPPED +HOLDCH = $7C ;CH IS MOVED HERE IN KGETCH BEFORE CNTL & SH +INSDAT = $7D ;1-byte temporary +COUNTR = $7E ;2-byte draw iteration count ; Floating Point Package Page Zero Address Equates -FR0 = $D4 ;6-byte register 0 -FR0M = $D5 ;##rev2## 5-byte register 0 mantissa -QTEMP = $D9 ;##rev2## 1-byte temporary +FR0 = $D4 ;6-byte register 0 +FR0M = $D5 ;##rev2## 5-byte register 0 mantissa +QTEMP = $D9 ;##rev2## 1-byte temporary -FRE = $DA ;6-byte (internal) register E +FRE = $DA ;6-byte (internal) register E -FR1 = $E0 ;FP REG1 -FR1M = $E1 ;##rev2## 5-byte register 1 mantissa +FR1 = $E0 ;FP REG1 +FR1M = $E1 ;##rev2## 5-byte register 1 mantissa -FR2 = $E6 ;6-byte (internal) register 2 +FR2 = $E6 ;6-byte (internal) register 2 -FRX = $EC ;1-byte temporary +FRX = $EC ;1-byte temporary -EEXP = $ED ;VALUE OF E +EEXP = $ED ;VALUE OF E -FRSIGN = $EE ;##rev2## 1-byte floating point sign -NSIGN = $EE ;SIGN OF # +FRSIGN = $EE ;##rev2## 1-byte floating point sign +NSIGN = $EE ;SIGN OF # -PLYCNT = $EF ;##rev2## 1-byte polynomial degree -ESIGN = $EF ;SIGN OF EXPONENT +PLYCNT = $EF ;##rev2## 1-byte polynomial degree +ESIGN = $EF ;SIGN OF EXPONENT -SGNFLG = $F0 ;##rev2## 1-byte sign flag -FCHRFLG = $F0 ;1ST CHAR FLAG +SGNFLG = $F0 ;##rev2## 1-byte sign flag +FCHRFLG = $F0 ;1ST CHAR FLAG -XFMFLG = $F1 ;##rev2## 1-byte transform flag -DIGRT = $F1 ;# OF DIGITS RIGHT OF DECIMAL +XFMFLG = $F1 ;##rev2## 1-byte transform flag +DIGRT = $F1 ;# OF DIGITS RIGHT OF DECIMAL -CIX = $F2 ;CURRENT INPUT INDEX -INBUFF = $F3 ;POINTS TO USER'S LINE INPUT BUFFER +CIX = $F2 ;CURRENT INPUT INDEX +INBUFF = $F3 ;POINTS TO USER'S LINE INPUT BUFFER -ZTEMP1 = $F5 ;2-byte temporary -ZTEMP4 = $F7 ;2-byte temporary -ZTEMP3 = $F9 ;2-byte temporary +ZTEMP1 = $F5 ;2-byte temporary +ZTEMP4 = $F7 ;2-byte temporary +ZTEMP3 = $F9 ;2-byte temporary -;DEGFLG = $FB ;##old## same as RADFLG -;RADFLG = $FB ;##old## 0=RADIANS, 6=DEGREES +;DEGFLG = $FB ;##old## same as RADFLG +;RADFLG = $FB ;##old## 0=RADIANS, 6=DEGREES -FLPTR = $FC ;2-byte floating point number pointer -FPTR2 = $FE ;2-byte floating point number pointer +FLPTR = $FC ;2-byte floating point number pointer +FPTR2 = $FE ;2-byte floating point number pointer ;------------------------------------------------------------------------- ; Page Two Address Equates ;------------------------------------------------------------------------- -INTABS = $0200 ;INTERRUPT RAM +INTABS = $0200 ;INTERRUPT RAM -VDSLST = $0200 ;DISPLAY LIST NMI VECTOR -VPRCED = $0202 ;PROCEED LINE IRQ VECTOR -VINTER = $0204 ;INTERRUPT LINE IRQ VECTOR -VBREAK = $0206 ;SOFTWARE BREAK (00) INSTRUCTION IRQ VECTOR -VKEYBD = $0208 ;POKEY KEYBOARD IRQ VECTOR -VSERIN = $020A ;POKEY SERIAL INPUT READY IRQ -VSEROR = $020C ;POKEY SERIAL OUTPUT READY IRQ -VSEROC = $020E ;POKEY SERIAL OUTPUT COMPLETE IRQ -VTIMR1 = $0210 ;POKEY TIMER 1 IRG -VTIMR2 = $0212 ;POKEY TIMER 2 IRG -VTIMR4 = $0214 ;POKEY TIMER 4 IRG -VIMIRQ = $0216 ;IMMEDIATE IRG VECTOR -CDTMV1 = $0218 ;COUNT DOWN TIMER 1 -CDTMV2 = $021A ;COUNT DOWN TIMER 2 -CDTMV3 = $021C ;COUNT DOWN TIMER 3 -CDTMV4 = $021E ;COUNT DOWN TIMER 4 -CDTMV5 = $0220 ;COUNT DOWN TIMER 5 -VVBLKI = $0222 ;IMMEDIATE VERTICAL BLANK NMI VECTOR -VVBLKD = $0224 ;DEFERRED VERTICAL BLANK NMI VECTOR -CDTMA1 = $0226 ;COUNT DOWN TIMER 1 JSR ADDRESS -CDTMA2 = $0228 ;COUNT DOWN TIMER 2 JSR ADDRESS -CDTMF3 = $022A ;COUNT DOWN TIMER 3 FLAG -SRTIMR = $022B ;SOFTWARE REPEAT TIMER -CDTMF4 = $022C ;COUNT DOWN TIMER 4 FLAG -INTEMP = $022D ;IAN'S TEMP -CDTMF5 = $022E ;COUNT DOWN TIMER FLAG 5 -SDMCTL = $022F ;SAVE DMACTL REGISTER -SDLSTL = $0230 ;SAVE DISPLAY LIST LOW BYTE -SDLSTH = $0231 ;SAVE DISPLAY LIST HI BYTE -SSKCTL = $0232 ;SKCTL REGISTER RAM -LCOUNT = $0233 ;##1200xl## 1-byte relocating loader record -LPENH = $0234 ;LIGHT PEN HORIZONTAL VALUE -LPENV = $0235 ;LIGHT PEN VERTICAL VALUE -BRKKY = $0236 ;BREAK KEY VECTOR -;RELADR = $0238 ;##1200xl## 2-byte relocatable loader address -VPIRQ = $0238 ;##rev2## 2-byte parallel device IRQ vector -CDEVIC = $023A ;COMMAND FRAME BUFFER - DEVICE -CCOMND = $023B ;COMMAND -CAUX1 = $023C ;COMMAND AUX BYTE 1 -CAUX2 = $023D ;COMMAND AUX BYTE 2 +VDSLST = $0200 ;DISPLAY LIST NMI VECTOR +VPRCED = $0202 ;PROCEED LINE IRQ VECTOR +VINTER = $0204 ;INTERRUPT LINE IRQ VECTOR +VBREAK = $0206 ;SOFTWARE BREAK (00) INSTRUCTION IRQ VECTOR +VKEYBD = $0208 ;POKEY KEYBOARD IRQ VECTOR +VSERIN = $020A ;POKEY SERIAL INPUT READY IRQ +VSEROR = $020C ;POKEY SERIAL OUTPUT READY IRQ +VSEROC = $020E ;POKEY SERIAL OUTPUT COMPLETE IRQ +VTIMR1 = $0210 ;POKEY TIMER 1 IRG +VTIMR2 = $0212 ;POKEY TIMER 2 IRG +VTIMR4 = $0214 ;POKEY TIMER 4 IRG +VIMIRQ = $0216 ;IMMEDIATE IRG VECTOR +CDTMV1 = $0218 ;COUNT DOWN TIMER 1 +CDTMV2 = $021A ;COUNT DOWN TIMER 2 +CDTMV3 = $021C ;COUNT DOWN TIMER 3 +CDTMV4 = $021E ;COUNT DOWN TIMER 4 +CDTMV5 = $0220 ;COUNT DOWN TIMER 5 +VVBLKI = $0222 ;IMMEDIATE VERTICAL BLANK NMI VECTOR +VVBLKD = $0224 ;DEFERRED VERTICAL BLANK NMI VECTOR +CDTMA1 = $0226 ;COUNT DOWN TIMER 1 JSR ADDRESS +CDTMA2 = $0228 ;COUNT DOWN TIMER 2 JSR ADDRESS +CDTMF3 = $022A ;COUNT DOWN TIMER 3 FLAG +SRTIMR = $022B ;SOFTWARE REPEAT TIMER +CDTMF4 = $022C ;COUNT DOWN TIMER 4 FLAG +INTEMP = $022D ;IAN'S TEMP +CDTMF5 = $022E ;COUNT DOWN TIMER FLAG 5 +SDMCTL = $022F ;SAVE DMACTL REGISTER +SDLSTL = $0230 ;SAVE DISPLAY LIST LOW BYTE +SDLSTH = $0231 ;SAVE DISPLAY LIST HI BYTE +SSKCTL = $0232 ;SKCTL REGISTER RAM +LCOUNT = $0233 ;##1200xl## 1-byte relocating loader record +LPENH = $0234 ;LIGHT PEN HORIZONTAL VALUE +LPENV = $0235 ;LIGHT PEN VERTICAL VALUE +BRKKY = $0236 ;BREAK KEY VECTOR +;RELADR = $0238 ;##1200xl## 2-byte relocatable loader address +VPIRQ = $0238 ;##rev2## 2-byte parallel device IRQ vector +CDEVIC = $023A ;COMMAND FRAME BUFFER - DEVICE +CCOMND = $023B ;COMMAND +CAUX1 = $023C ;COMMAND AUX BYTE 1 +CAUX2 = $023D ;COMMAND AUX BYTE 2 -TEMP = $023E ;TEMPORARY RAM CELL +TEMP = $023E ;TEMPORARY RAM CELL -ERRFLG = $023F ;ERROR FLAG - ANY DEVICE ERROR EXCEPT TIME OUT +ERRFLG = $023F ;ERROR FLAG - ANY DEVICE ERROR EXCEPT TIME OUT -DFLAGS = $0240 ;DISK FLAGS FROM SECTOR ONE -DBSECT = $0241 ;NUMBER OF DISK BOOT SECTORS -BOOTAD = $0242 ;ADDRESS WHERE DISK BOOT LOADER WILL BE PUT -COLDST = $0244 ;COLDSTART FLAG (1=IN MIDDLE OF COLDSTART> -RECLEN = $0245 ;##1200xl## 1-byte relocating loader record length -DSKTIM = $0246 ;DISK TIME OUT REGISTER -;LINBUF = $0247 ;##old## CHAR LINE BUFFER -PDVMSK = $0247 ;##rev2## 1-byte parallel device selection mask -SHPDVS = $0248 ;##rev2## 1-byte PDVS (parallel device select) -PDIMSK = $0249 ;##rev2## 1-byte parallel device IRQ selection -RELADR = $024A ;##rev2## 2-byte relocating loader relative adr. -PPTMPA = $024C ;##rev2## 1-byte parallel device handler temporary -PPTMPX = $024D ;##rev2## 1-byte parallel device handler temporary +DFLAGS = $0240 ;DISK FLAGS FROM SECTOR ONE +DBSECT = $0241 ;NUMBER OF DISK BOOT SECTORS +BOOTAD = $0242 ;ADDRESS WHERE DISK BOOT LOADER WILL BE PUT +COLDST = $0244 ;COLDSTART FLAG (1=IN MIDDLE OF COLDSTART> +RECLEN = $0245 ;##1200xl## 1-byte relocating loader record length +DSKTIM = $0246 ;DISK TIME OUT REGISTER +;LINBUF = $0247 ;##old## CHAR LINE BUFFER +PDVMSK = $0247 ;##rev2## 1-byte parallel device selection mask +SHPDVS = $0248 ;##rev2## 1-byte PDVS (parallel device select) +PDIMSK = $0249 ;##rev2## 1-byte parallel device IRQ selection +RELADR = $024A ;##rev2## 2-byte relocating loader relative adr. +PPTMPA = $024C ;##rev2## 1-byte parallel device handler temporary +PPTMPX = $024D ;##rev2## 1-byte parallel device handler temporary -CHSALT = $026B ;##1200xl## 1-byte character set alternate -VSFLAG = $026C ;##1200xl## 1-byte fine vertical scroll count -KEYDIS = $026D ;##1200xl## 1-byte keyboard disable -FINE = $026E ;##1200xl## 1-byte fine scrolling mode -GPRIOR = $026F ;GLOBAL PRIORITY CELL +CHSALT = $026B ;##1200xl## 1-byte character set alternate +VSFLAG = $026C ;##1200xl## 1-byte fine vertical scroll count +KEYDIS = $026D ;##1200xl## 1-byte keyboard disable +FINE = $026E ;##1200xl## 1-byte fine scrolling mode +GPRIOR = $026F ;GLOBAL PRIORITY CELL -PADDL0 = $0270 ;1-byte potentiometer 0 -PADDL1 = $0271 ;1-byte potentiometer 1 -PADDL2 = $0272 ;1-byte potentiometer 2 -PADDL3 = $0273 ;1-byte potentiometer 3 -PADDL4 = $0274 ;1-byte potentiometer 4 -PADDL5 = $0275 ;1-byte potentiometer 5 -PADDL6 = $0276 ;1-byte potentiometer 6 -PADDL7 = $0277 ;1-byte potentiometer 7 +PADDL0 = $0270 ;1-byte potentiometer 0 +PADDL1 = $0271 ;1-byte potentiometer 1 +PADDL2 = $0272 ;1-byte potentiometer 2 +PADDL3 = $0273 ;1-byte potentiometer 3 +PADDL4 = $0274 ;1-byte potentiometer 4 +PADDL5 = $0275 ;1-byte potentiometer 5 +PADDL6 = $0276 ;1-byte potentiometer 6 +PADDL7 = $0277 ;1-byte potentiometer 7 -STICK0 = $0278 ;1-byte joystick 0 -STICK1 = $0279 ;1-byte joystick 1 -STICK2 = $027A ;1-byte joystick 2 -STICK3 = $027B ;1-byte joystick 3 +STICK0 = $0278 ;1-byte joystick 0 +STICK1 = $0279 ;1-byte joystick 1 +STICK2 = $027A ;1-byte joystick 2 +STICK3 = $027B ;1-byte joystick 3 -PTRIG0 = $027C ;1-byte paddle trigger 0 -PTRIG1 = $027D ;1-byte paddle trigger 1 -PTRIG2 = $027E ;1-byte paddle trigger 2 -PTRIG3 = $027F ;1-byte paddle trigger 3 -PTRIG4 = $0280 ;1-byte paddle trigger 4 -PTRIG5 = $0281 ;1-byte paddle trigger 5 -PTRIG6 = $0281 ;1-byte paddle trigger 6 -PTRIG7 = $0283 ;1-byte paddle trigger 7 +PTRIG0 = $027C ;1-byte paddle trigger 0 +PTRIG1 = $027D ;1-byte paddle trigger 1 +PTRIG2 = $027E ;1-byte paddle trigger 2 +PTRIG3 = $027F ;1-byte paddle trigger 3 +PTRIG4 = $0280 ;1-byte paddle trigger 4 +PTRIG5 = $0281 ;1-byte paddle trigger 5 +PTRIG6 = $0281 ;1-byte paddle trigger 6 +PTRIG7 = $0283 ;1-byte paddle trigger 7 -STRIG0 = $0284 ;1-byte joystick trigger 0 -STRIG1 = $0285 ;1-byte joystick trigger 1 -STRIG2 = $0286 ;1-byte joystick trigger 2 -STRIG3 = $0287 ;1-byte joystick trigger 3 +STRIG0 = $0284 ;1-byte joystick trigger 0 +STRIG1 = $0285 ;1-byte joystick trigger 1 +STRIG2 = $0286 ;1-byte joystick trigger 2 +STRIG3 = $0287 ;1-byte joystick trigger 3 -;CSTAT = $0288 ;##old## cassette status register -HIBYTE = $0288 ;##1200xl## 1-byte relocating loader high byte -WMODE = $0289 ;1-byte cassette WRITE mode -BLIM = $028A ;1-byte cassette buffer limit -IMASK = $028B ;##rev2## (not used) -JVECK = $028C ;2-byte jump vector or temporary -NEWADR = $028E ;##1200xl## 2-byte relocating address -TXTROW = $0290 ;TEXT ROWCRS -TXTCOL = $0291 ;TEXT COLCRS -TINDEX = $0293 ;TEXT INDEX -TXTMSC = $0294 ;FOOLS CONVRT INTO NEW MSC -TXTOLD = $0296 ;OLDROW & OLDCOL FOR TEXT (AND THEN SOME) -;TMPX1 = $029C ;##old## 1-byte temporary register -CRETRY = $029C ;##1200xl## 1-byte number of command frame retries -HOLD3 = $029D ;1-byte temporary -SUBTMP = $029E ;1-byte temporary -HOLD2 = $029F ;1-byte (not used) -DMASK = $02A0 ;1-byte display (pixel location) mask -TMPLBT = $02A1 ;1-byte (not used) -ESCFLG = $02A2 ;ESCAPE FLAG -TABMAP = $02A3 ;15-byte (120 bit) tab stop bit map -LOGMAP = $02B2 ;LOGICAL LINE START BIT MAP -INVFLG = $02B6 ;INVERSE VIDEO FLAG (TOGGLED BY ATARI KEY) -FILFLG = $02B7 ;RIGHT FILL FLAG FOR DRAW -TMPROW = $02B8 ;1-byte temporary row -TMPCOL = $02B9 ;2-byte temporary column -SCRFLG = $02BB ;SET IF SCROLL OCCURS -HOLD4 = $02BC ;TEMP CELL USED IN DRAW ONLY -;HOLD5 = $02BD ;##old## DITTO -DRETRY = $02BD ;##1200xl## 1-byte number of device retries -SHFLOK = $02BE ;1-byte shift/control lock flags -BOTSCR = $02BF ;BOTTOM OF SCREEN 24 NORM 4 SPLIT +;CSTAT = $0288 ;##old## cassette status register +HIBYTE = $0288 ;##1200xl## 1-byte relocating loader high byte +WMODE = $0289 ;1-byte cassette WRITE mode +BLIM = $028A ;1-byte cassette buffer limit +IMASK = $028B ;##rev2## (not used) +JVECK = $028C ;2-byte jump vector or temporary +NEWADR = $028E ;##1200xl## 2-byte relocating address +TXTROW = $0290 ;TEXT ROWCRS +TXTCOL = $0291 ;TEXT COLCRS +TINDEX = $0293 ;TEXT INDEX +TXTMSC = $0294 ;FOOLS CONVRT INTO NEW MSC +TXTOLD = $0296 ;OLDROW & OLDCOL FOR TEXT (AND THEN SOME) +;TMPX1 = $029C ;##old## 1-byte temporary register +CRETRY = $029C ;##1200xl## 1-byte number of command frame retries +HOLD3 = $029D ;1-byte temporary +SUBTMP = $029E ;1-byte temporary +HOLD2 = $029F ;1-byte (not used) +DMASK = $02A0 ;1-byte display (pixel location) mask +TMPLBT = $02A1 ;1-byte (not used) +ESCFLG = $02A2 ;ESCAPE FLAG +TABMAP = $02A3 ;15-byte (120 bit) tab stop bit map +LOGMAP = $02B2 ;LOGICAL LINE START BIT MAP +INVFLG = $02B6 ;INVERSE VIDEO FLAG (TOGGLED BY ATARI KEY) +FILFLG = $02B7 ;RIGHT FILL FLAG FOR DRAW +TMPROW = $02B8 ;1-byte temporary row +TMPCOL = $02B9 ;2-byte temporary column +SCRFLG = $02BB ;SET IF SCROLL OCCURS +HOLD4 = $02BC ;TEMP CELL USED IN DRAW ONLY +;HOLD5 = $02BD ;##old## DITTO +DRETRY = $02BD ;##1200xl## 1-byte number of device retries +SHFLOK = $02BE ;1-byte shift/control lock flags +BOTSCR = $02BF ;BOTTOM OF SCREEN 24 NORM 4 SPLIT -PCOLR0 = $02C0 ;1-byte player-missile 0 color/luminance -PCOLR1 = $02C1 ;1-byte player-missile 1 color/luminance -PCOLR2 = $02C2 ;1-byte player-missile 2 color/luminance -PCOLR3 = $02C3 ;1-byte player-missile 3 color/luminance +PCOLR0 = $02C0 ;1-byte player-missile 0 color/luminance +PCOLR1 = $02C1 ;1-byte player-missile 1 color/luminance +PCOLR2 = $02C2 ;1-byte player-missile 2 color/luminance +PCOLR3 = $02C3 ;1-byte player-missile 3 color/luminance -COLOR0 = $02C4 ;1-byte playfield 0 color/luminance -COLOR1 = $02C5 ;1-byte playfield 1 color/luminance -COLOR2 = $02C6 ;1-byte playfield 2 color/luminance -COLOR3 = $02C7 ;1-byte playfield 3 color/luminance +COLOR0 = $02C4 ;1-byte playfield 0 color/luminance +COLOR1 = $02C5 ;1-byte playfield 1 color/luminance +COLOR2 = $02C6 ;1-byte playfield 2 color/luminance +COLOR3 = $02C7 ;1-byte playfield 3 color/luminance -COLOR4 = $02C8 ;1-byte background color/luminance +COLOR4 = $02C8 ;1-byte background color/luminance -PARMBL = $02C9 ;##rev2## 6-byte relocating loader parameter -RUNADR = $02C9 ;##1200xl## 2-byte run address -HIUSED = $02CB ;##1200xl## 2-byte highest non-zero page address -ZHIUSE = $02CD ;##1200xl## 2-byte highest zero page address +PARMBL = $02C9 ;##rev2## 6-byte relocating loader parameter +RUNADR = $02C9 ;##1200xl## 2-byte run address +HIUSED = $02CB ;##1200xl## 2-byte highest non-zero page address +ZHIUSE = $02CD ;##1200xl## 2-byte highest zero page address -OLDPAR = $02CF ;##rev2## 6-byte relocating loader parameter -GBYTEA = $02CF ;##1200xl## 2-byte GET-BYTE routine address -LOADAD = $02D1 ;##1200xl## 2-byte non-zero page load address -ZLOADA = $02D3 ;##1200xl## 2-byte zero page load address +OLDPAR = $02CF ;##rev2## 6-byte relocating loader parameter +GBYTEA = $02CF ;##1200xl## 2-byte GET-BYTE routine address +LOADAD = $02D1 ;##1200xl## 2-byte non-zero page load address +ZLOADA = $02D3 ;##1200xl## 2-byte zero page load address -DSCTLN = $02D5 ;##1200xl## 2-byte disk sector length -ACMISR = $02D7 ;##1200xl## 2-byte ACMI interrupt service routine -KRPDEL = $02D9 ;##1200xl## 1-byte auto-repeat delay -KEYREP = $02DA ;##1200xl## 1-byte auto-repeat rate -NOCLIK = $02DB ;##1200xl## 1-byte key click disable -HELPFG = $02DC ;##1200xl## 1-byte HELP key flag (0 = no HELP) -DMASAV = $02DD ;##1200xl## 1-byte SDMCTL save/restore -PBPNT = $02DE ;##1200xl## 1-byte printer buffer pointer -PBUFSZ = $02DF ;##1200xl## 1-byte printer buffer size +DSCTLN = $02D5 ;##1200xl## 2-byte disk sector length +ACMISR = $02D7 ;##1200xl## 2-byte ACMI interrupt service routine +KRPDEL = $02D9 ;##1200xl## 1-byte auto-repeat delay +KEYREP = $02DA ;##1200xl## 1-byte auto-repeat rate +NOCLIK = $02DB ;##1200xl## 1-byte key click disable +HELPFG = $02DC ;##1200xl## 1-byte HELP key flag (0 = no HELP) +DMASAV = $02DD ;##1200xl## 1-byte SDMCTL save/restore +PBPNT = $02DE ;##1200xl## 1-byte printer buffer pointer +PBUFSZ = $02DF ;##1200xl## 1-byte printer buffer size -GLBABS = $02E0 ;4-byte global variables for non-DOS users -RUNAD = $02E0 ;##map## 2-byte binary file run address -INITAD = $02E2 ;##map## 2-byte binary file initialization address +GLBABS = $02E0 ;4-byte global variables for non-DOS users +RUNAD = $02E0 ;##map## 2-byte binary file run address +INITAD = $02E2 ;##map## 2-byte binary file initialization address -RAMSIZ = $02E4 ;RAM SIZE (HI BYTE ONLY) -MEMTOP = $02E5 ;TOP OF AVAILABLE USER MEMORY -MEMLO = $02E7 ;BOTTOM OF AVAILABLE USER MEMORY -HNDLOD = $02E9 ;##1200xl## 1-byte user load flag -DVSTAT = $02EA ;STATUS BUFFER -CBAUDL = $02EE ;1-byte low cassette baud rate -CBAUDH = $02EF ;1-byte high cassette baud rate -CRSINH = $02F0 ;CURSOR INHIBIT (00 = CURSOR ON) -KEYDEL = $02F1 ;KEY DELAY -CH1 = $02F2 ;1-byte prior keyboard character -CHACT = $02F3 ;CHACTL REGISTER RAM -CHBAS = $02F4 ;CHBAS REGISTER RAM +RAMSIZ = $02E4 ;RAM SIZE (HI BYTE ONLY) +MEMTOP = $02E5 ;TOP OF AVAILABLE USER MEMORY +MEMLO = $02E7 ;BOTTOM OF AVAILABLE USER MEMORY +HNDLOD = $02E9 ;##1200xl## 1-byte user load flag +DVSTAT = $02EA ;STATUS BUFFER +CBAUDL = $02EE ;1-byte low cassette baud rate +CBAUDH = $02EF ;1-byte high cassette baud rate +CRSINH = $02F0 ;CURSOR INHIBIT (00 = CURSOR ON) +KEYDEL = $02F1 ;KEY DELAY +CH1 = $02F2 ;1-byte prior keyboard character +CHACT = $02F3 ;CHACTL REGISTER RAM +CHBAS = $02F4 ;CHBAS REGISTER RAM -NEWROW = $02F5 ;##1200xl## 1-byte draw destination row -NEWCOL = $02F6 ;##1200xl## 2-byte draw destination column -ROWINC = $02F8 ;##1200xl## 1-byte draw row increment -COLINC = $02F9 ;##1200xl## 1-byte draw column increment +NEWROW = $02F5 ;##1200xl## 1-byte draw destination row +NEWCOL = $02F6 ;##1200xl## 2-byte draw destination column +ROWINC = $02F8 ;##1200xl## 1-byte draw row increment +COLINC = $02F9 ;##1200xl## 1-byte draw column increment -CHAR = $02FA ;1-byte internal character -ATACHR = $02FB ;ATASCII CHARACTER -CH = $02FC ;GLOBAL VARIABLE FOR KEYBOARD -FILDAT = $02FD ;RIGHT FILL DATA -DSPFLG = $02FE ;DISPLAY FLAG DISPLAY CNTLS IF NON-ZERO -SSFLAG = $02FF ;START/STOP FLAG FOR PAGING (CNTL 1). CLEARE +CHAR = $02FA ;1-byte internal character +ATACHR = $02FB ;ATASCII CHARACTER +CH = $02FC ;GLOBAL VARIABLE FOR KEYBOARD +FILDAT = $02FD ;RIGHT FILL DATA +DSPFLG = $02FE ;DISPLAY FLAG DISPLAY CNTLS IF NON-ZERO +SSFLAG = $02FF ;START/STOP FLAG FOR PAGING (CNTL 1). CLEARE ;------------------------------------------------------------------------- ; Page Three Address Equates ;------------------------------------------------------------------------- -DCB = $0300 ;DEVICE CONTROL BLOCK -DDEVIC = $0300 ;PERIPHERAL UNIT 1 BUS I.D. NUMBER -DUNIT = $0301 ;UNIT NUMBER -DCOMND = $0302 ;BUS COMMAND -DSTATS = $0303 ;COMMAND TYPE/STATUS RETURN -DBUFLO = $0304 ;1-byte low data buffer address -DBUFHI = $0305 ;1-byte high data buffer address -DTIMLO = $0306 ;DEVICE TIME OUT IN 1 SECOND UNITS -DUNUSE = $0307 ;UNUSED BYTE -DBYTLO = $0308 ;1-byte low number of bytes to transfer -DBYTHI = $0309 ;1-byte high number of bytes to transfer -DAUX1 = $030A ;1-byte first command auxiliary -DAUX2 = $030B ;1-byte second command auxiliary +DCB = $0300 ;DEVICE CONTROL BLOCK +DDEVIC = $0300 ;PERIPHERAL UNIT 1 BUS I.D. NUMBER +DUNIT = $0301 ;UNIT NUMBER +DCOMND = $0302 ;BUS COMMAND +DSTATS = $0303 ;COMMAND TYPE/STATUS RETURN +DBUFLO = $0304 ;1-byte low data buffer address +DBUFHI = $0305 ;1-byte high data buffer address +DTIMLO = $0306 ;DEVICE TIME OUT IN 1 SECOND UNITS +DUNUSE = $0307 ;UNUSED BYTE +DBYTLO = $0308 ;1-byte low number of bytes to transfer +DBYTHI = $0309 ;1-byte high number of bytes to transfer +DAUX1 = $030A ;1-byte first command auxiliary +DAUX2 = $030B ;1-byte second command auxiliary -TIMER1 = $030C ;INITIAL TIMER VALUE -;ADDCOR = $030E ;##old## ADDITION CORRECTION -JMPERS = $030E ;##1200xl## 1-byte jumper options -CASFLG = $030F ;CASSETTE MODE WHEN SET -TIMER2 = $0310 ;2-byte final baud rate timer value -TEMP1 = $0312 ;TEMPORARY STORAGE REGISTER -;TEMP2 = $0314 ;##old## TEMPORARY STORAGE REGISTER -TEMP2 = $0313 ;##1200xl## 1-byte temporary -PTIMOT = $0314 ;##1200xl## 1-byte printer timeout -TEMP3 = $0315 ;TEMPORARY STORAGE REGISTER -SAVIO = $0316 ;SAVE SERIAL IN DATA PORT -TIMFLG = $0317 ;TIME OUT FLAG FOR BAUD RATE CORRECTION -STACKP = $0318 ;SIO STACK POINTER SAVE CELL -TSTAT = $0319 ;TEMPORARY STATUS HOLDER +TIMER1 = $030C ;INITIAL TIMER VALUE +;ADDCOR = $030E ;##old## ADDITION CORRECTION +JMPERS = $030E ;##1200xl## 1-byte jumper options +CASFLG = $030F ;CASSETTE MODE WHEN SET +TIMER2 = $0310 ;2-byte final baud rate timer value +TEMP1 = $0312 ;TEMPORARY STORAGE REGISTER +;TEMP2 = $0314 ;##old## TEMPORARY STORAGE REGISTER +TEMP2 = $0313 ;##1200xl## 1-byte temporary +PTIMOT = $0314 ;##1200xl## 1-byte printer timeout +TEMP3 = $0315 ;TEMPORARY STORAGE REGISTER +SAVIO = $0316 ;SAVE SERIAL IN DATA PORT +TIMFLG = $0317 ;TIME OUT FLAG FOR BAUD RATE CORRECTION +STACKP = $0318 ;SIO STACK POINTER SAVE CELL +TSTAT = $0319 ;TEMPORARY STATUS HOLDER -HATABS = $031A ;35-byte handler address table (was 38 bytes) -PUPBT1 = $033D ;##1200xl## 1-byte power-up validation byte 1 -PUPBT2 = $033E ;##1200xl## 1-byte power-up validation byte 2 -PUPBT3 = $033F ;##1200xl## 1-byte power-up validation byte 3 +HATABS = $031A ;35-byte handler address table (was 38 bytes) +PUPBT1 = $033D ;##1200xl## 1-byte power-up validation byte 1 +PUPBT2 = $033E ;##1200xl## 1-byte power-up validation byte 2 +PUPBT3 = $033F ;##1200xl## 1-byte power-up validation byte 3 -IOCB = $0340 ;I/O CONTROL BLOCKS -ICHID = $0340 ;HANDLER INDEX NUMBER (FF=IOCB FREE) -ICDNO = $0341 ;DEVICE NUMBER (DRIVE NUMBER) -ICCOM = $0342 ;COMMAND CODE -ICSTA = $0343 ;STATUS OF LAST IOCB ACTION -ICBAL = $0344 ;1-byte low buffer address -ICBAH = $0345 ;1-byte high buffer address -ICPTL = $0346 ;1-byte low PUT-BYTE routine address - 1 -ICPTH = $0347 ;1-byte high PUT-BYTE routine address - 1 -ICBLL = $0348 ;1-byte low buffer length -ICBLH = $0349 ;1-byte high buffer length -ICAX1 = $034A ;1-byte first auxiliary information -ICAX2 = $034B ;1-byte second auxiliary information -ICAX3 = $034C ;1-byte third auxiliary information -ICAX4 = $034D ;1-byte fourth auxiliary information -ICAX5 = $034E ;1-byte fifth auxiliary information -ICSPR = $034F ;SPARE BYTE +IOCB = $0340 ;I/O CONTROL BLOCKS +ICHID = $0340 ;HANDLER INDEX NUMBER (FF=IOCB FREE) +ICDNO = $0341 ;DEVICE NUMBER (DRIVE NUMBER) +ICCOM = $0342 ;COMMAND CODE +ICSTA = $0343 ;STATUS OF LAST IOCB ACTION +ICBAL = $0344 ;1-byte low buffer address +ICBAH = $0345 ;1-byte high buffer address +ICPTL = $0346 ;1-byte low PUT-BYTE routine address - 1 +ICPTH = $0347 ;1-byte high PUT-BYTE routine address - 1 +ICBLL = $0348 ;1-byte low buffer length +ICBLH = $0349 ;1-byte high buffer length +ICAX1 = $034A ;1-byte first auxiliary information +ICAX2 = $034B ;1-byte second auxiliary information +ICAX3 = $034C ;1-byte third auxiliary information +ICAX4 = $034D ;1-byte fourth auxiliary information +ICAX5 = $034E ;1-byte fifth auxiliary information +ICSPR = $034F ;SPARE BYTE -PRNBUF = $03C0 ;PRINTER BUFFER -SUPERF = $03E8 ;##1200xl## 1-byte editor super function flag -CKEY = $03E9 ;##1200xl## 1-byte cassette boot request flag -CASSBT = $03EA ;##1200xl## 1-byte cassette boot flag -CARTCK = $03EB ;##1200xl## 1-byte cartridge equivalence check -DERRF = $03EC ;##rev2## 1-byte screen OPEN error flag +PRNBUF = $03C0 ;PRINTER BUFFER +SUPERF = $03E8 ;##1200xl## 1-byte editor super function flag +CKEY = $03E9 ;##1200xl## 1-byte cassette boot request flag +CASSBT = $03EA ;##1200xl## 1-byte cassette boot flag +CARTCK = $03EB ;##1200xl## 1-byte cartridge equivalence check +DERRF = $03EC ;##rev2## 1-byte screen OPEN error flag ; Remainder of Page Three Not Cleared upon Reset -ACMVAR = $03ED ;##1200xl## 11 bytes reserved for ACMI -BASICF = $03F8 ;##rev2## 1-byte BASIC switch flag -MINTLK = $03F9 ;##1200xl## 1-byte ACMI module interlock -GINTLK = $03FA ;##1200xl## 1-byte cartridge interlock -CHLINK = $03FB ;##1200xl## 2-byte loaded handler chain link -CASBUF = $03FD ;CASSETTE BUFFER +ACMVAR = $03ED ;##1200xl## 11 bytes reserved for ACMI +BASICF = $03F8 ;##rev2## 1-byte BASIC switch flag +MINTLK = $03F9 ;##1200xl## 1-byte ACMI module interlock +GINTLK = $03FA ;##1200xl## 1-byte cartridge interlock +CHLINK = $03FB ;##1200xl## 2-byte loaded handler chain link +CASBUF = $03FD ;CASSETTE BUFFER ;------------------------------------------------------------------------- ; Page Four/Five Address Equates ;------------------------------------------------------------------------- ; USER AREA STARTS HERE AND GOES TO END OF PAGE FIVE -USAREA = $0480 ;128 bytes reserved for application +USAREA = $0480 ;128 bytes reserved for application -LBPR1 = $057E ;LBUFF PREFIX 1 -LBPR2 = $057F ;LBUFF PREFIX 2 -LBUFF = $0580 ;128-byte line buffer +LBPR1 = $057E ;LBUFF PREFIX 1 +LBPR2 = $057F ;LBUFF PREFIX 2 +LBUFF = $0580 ;128-byte line buffer -PLYARG = $05E0 ;6-byte floating point polynomial argument -FPSCR = $05E6 ;6-byte floating point temporary -FPSCR1 = $05EC ;6-byte floating point temporary +PLYARG = $05E0 ;6-byte floating point polynomial argument +FPSCR = $05E6 ;6-byte floating point temporary +FPSCR1 = $05EC ;6-byte floating point temporary -;LBFEND = $05FF ;##old## END OF LBUFF +;LBFEND = $05FF ;##old## END OF LBUFF ;------------------------------------------------------------------------- ; Cartridge Address Equates ;------------------------------------------------------------------------- -CARTCS = $BFFA ;##rev2## 2-byte cartridge coldstart address -CART = $BFFC ;##rev2## 1-byte cartridge present indicator -CARTFG = $BFFD ;##rev2## 1-byte cartridge flags -CARTAD = $BFFE ;##rev2## 2-byte cartridge start vector +CARTCS = $BFFA ;##rev2## 2-byte cartridge coldstart address +CART = $BFFC ;##rev2## 1-byte cartridge present indicator +CARTFG = $BFFD ;##rev2## 1-byte cartridge flags +CARTAD = $BFFE ;##rev2## 2-byte cartridge start vector ;------------------------------------------------------------------------- ; CTIA/GTIA Address Equates ;------------------------------------------------------------------------- -GTIA = $D000 ;CTIA/GTIA area +GTIA = $D000 ;CTIA/GTIA area ; Read/Write Addresses -CONSOL = $D01F ;console switches and speaker control +CONSOL = $D01F ;console switches and speaker control ; Read Addresses -M0PF = $D000 ;missile 0 and playfield collision -M1PF = $D001 ;missile 1 and playfield collision -M2PF = $D002 ;missile 2 and playfield collision -M3PF = $D003 ;missile 3 and playfield collision +M0PF = $D000 ;missile 0 and playfield collision +M1PF = $D001 ;missile 1 and playfield collision +M2PF = $D002 ;missile 2 and playfield collision +M3PF = $D003 ;missile 3 and playfield collision -P0PF = $D004 ;player 0 and playfield collision -P1PF = $D005 ;player 1 and playfield collision -P2PF = $D006 ;player 2 and playfield collision -P3PF = $D007 ;player 3 and playfield collision +P0PF = $D004 ;player 0 and playfield collision +P1PF = $D005 ;player 1 and playfield collision +P2PF = $D006 ;player 2 and playfield collision +P3PF = $D007 ;player 3 and playfield collision -M0PL = $D008 ;missile 0 and player collision -M1PL = $D009 ;missile 1 and player collision -M2PL = $D00A ;missile 2 and player collision -M3PL = $D00B ;missile 3 and player collision +M0PL = $D008 ;missile 0 and player collision +M1PL = $D009 ;missile 1 and player collision +M2PL = $D00A ;missile 2 and player collision +M3PL = $D00B ;missile 3 and player collision -P0PL = $D00C ;player 0 and player collision -P1PL = $D00D ;player 1 and player collision -P2PL = $D00E ;player 2 and player collision -P3PL = $D00F ;player 3 and player collision +P0PL = $D00C ;player 0 and player collision +P1PL = $D00D ;player 1 and player collision +P2PL = $D00E ;player 2 and player collision +P3PL = $D00F ;player 3 and player collision -TRIG0 = $D010 ;joystick trigger 0 -TRIG1 = $D011 ;joystick trigger 1 +TRIG0 = $D010 ;joystick trigger 0 +TRIG1 = $D011 ;joystick trigger 1 -TRIG2 = $D012 ;cartridge interlock -TRIG3 = $D013 ;ACMI module interlock +TRIG2 = $D012 ;cartridge interlock +TRIG3 = $D013 ;ACMI module interlock -PAL = $D014 ;##rev2## PAL/NTSC indicator +PAL = $D014 ;##rev2## PAL/NTSC indicator ; Write Addresses -HPOSP0 = $D000 ;player 0 horizontal position -HPOSP1 = $D001 ;player 1 horizontal position -HPOSP2 = $D002 ;player 2 horizontal position -HPOSP3 = $D003 ;player 3 horizontal position +HPOSP0 = $D000 ;player 0 horizontal position +HPOSP1 = $D001 ;player 1 horizontal position +HPOSP2 = $D002 ;player 2 horizontal position +HPOSP3 = $D003 ;player 3 horizontal position -HPOSM0 = $D004 ;missile 0 horizontal position -HPOSM1 = $D005 ;missile 1 horizontal position -HPOSM2 = $D006 ;missile 2 horizontal position -HPOSM3 = $D007 ;missile 3 horizontal position +HPOSM0 = $D004 ;missile 0 horizontal position +HPOSM1 = $D005 ;missile 1 horizontal position +HPOSM2 = $D006 ;missile 2 horizontal position +HPOSM3 = $D007 ;missile 3 horizontal position -SIZEP0 = $D008 ;player 0 size -SIZEP1 = $D009 ;player 1 size -SIZEP2 = $D00A ;player 2 size -SIZEP3 = $D00B ;player 3 size +SIZEP0 = $D008 ;player 0 size +SIZEP1 = $D009 ;player 1 size +SIZEP2 = $D00A ;player 2 size +SIZEP3 = $D00B ;player 3 size -SIZEM = $D00C ;missile sizes +SIZEM = $D00C ;missile sizes -GRAFP0 = $D00D ;player 0 graphics -GRAFP1 = $D00E ;player 1 graphics -GRAFP2 = $D00F ;player 2 graphics -GRAFP3 = $D010 ;player 3 graphics +GRAFP0 = $D00D ;player 0 graphics +GRAFP1 = $D00E ;player 1 graphics +GRAFP2 = $D00F ;player 2 graphics +GRAFP3 = $D010 ;player 3 graphics -GRAFM = $D011 ;missile graphics +GRAFM = $D011 ;missile graphics -COLPM0 = $D012 ;player-missile 0 color/luminance -COLPM1 = $D013 ;player-missile 1 color/luminance -COLPM2 = $D014 ;player-missile 2 color/luminance -COLPM3 = $D015 ;player-missile 3 color/luminance +COLPM0 = $D012 ;player-missile 0 color/luminance +COLPM1 = $D013 ;player-missile 1 color/luminance +COLPM2 = $D014 ;player-missile 2 color/luminance +COLPM3 = $D015 ;player-missile 3 color/luminance -COLPF0 = $D016 ;playfield 0 color/luminance -COLPF1 = $D017 ;playfield 1 color/luminance -COLPF2 = $D018 ;playfield 2 color/luminance -COLPF3 = $D019 ;playfield 3 color/luminance +COLPF0 = $D016 ;playfield 0 color/luminance +COLPF1 = $D017 ;playfield 1 color/luminance +COLPF2 = $D018 ;playfield 2 color/luminance +COLPF3 = $D019 ;playfield 3 color/luminance -COLBK = $D01A ;background color/luminance +COLBK = $D01A ;background color/luminance -PRIOR = $D01B ;priority select -VDELAY = $D01C ;vertical delay -GRACTL = $D01D ;graphic control -HITCLR = $D01E ;collision clear +PRIOR = $D01B ;priority select +VDELAY = $D01C ;vertical delay +GRACTL = $D01D ;graphic control +HITCLR = $D01E ;collision clear ;------------------------------------------------------------------------- ; PBI Address Equates ;------------------------------------------------------------------------- -PBI = $D100 ;##rev2## parallel bus interface area +PBI = $D100 ;##rev2## parallel bus interface area ; Read Addresses -PDVI = $D1FF ;##rev2## parallel device IRQ status +PDVI = $D1FF ;##rev2## parallel device IRQ status ; Write Addresses -PDVS = $D1FF ;##rev2## parallel device select +PDVS = $D1FF ;##rev2## parallel device select ; PBI RAM Address Equates -PBIRAM = $D600 ;##rev2## parallel bus interface RAM area +PBIRAM = $D600 ;##rev2## parallel bus interface RAM area ; Parallel Device Address Equates -PDID1 = $D803 ;##rev2## parallel device ID 1 -PDIDV = $D805 ;##rev2## parallel device I/O vector -PDIRQV = $D808 ;##rev2## parallel device IRQ vector -PDID2 = $D80B ;##rev2## parallel device ID 2 -PDVV = $D80D ;##rev2## parallel device vector table +PDID1 = $D803 ;##rev2## parallel device ID 1 +PDIDV = $D805 ;##rev2## parallel device I/O vector +PDIRQV = $D808 ;##rev2## parallel device IRQ vector +PDID2 = $D80B ;##rev2## parallel device ID 2 +PDVV = $D80D ;##rev2## parallel device vector table ;------------------------------------------------------------------------- ; POKEY Address Equates ;------------------------------------------------------------------------- -POKEY = $D200 ;POKEY area +POKEY = $D200 ;POKEY area ; Read Addresses -POT0 = $D200 ;potentiometer 0 -POT1 = $D201 ;potentiometer 1 -POT2 = $D202 ;potentiometer 2 -POT3 = $D203 ;potentiometer 3 -POT4 = $D204 ;potentiometer 4 -POT5 = $D205 ;potentiometer 5 -POT6 = $D206 ;potentiometer 6 -POT7 = $D207 ;potentiometer 7 +POT0 = $D200 ;potentiometer 0 +POT1 = $D201 ;potentiometer 1 +POT2 = $D202 ;potentiometer 2 +POT3 = $D203 ;potentiometer 3 +POT4 = $D204 ;potentiometer 4 +POT5 = $D205 ;potentiometer 5 +POT6 = $D206 ;potentiometer 6 +POT7 = $D207 ;potentiometer 7 -ALLPOT = $D208 ;potentiometer port status -KBCODE = $D209 ;keyboard code -RANDOM = $D20A ;random number generator -SERIN = $D20D ;serial port input -IRQST = $D20E ;IRQ interrupt status -SKSTAT = $D20F ;serial port and keyboard status +ALLPOT = $D208 ;potentiometer port status +KBCODE = $D209 ;keyboard code +RANDOM = $D20A ;random number generator +SERIN = $D20D ;serial port input +IRQST = $D20E ;IRQ interrupt status +SKSTAT = $D20F ;serial port and keyboard status ; Write Addresses -AUDF1 = $D200 ;channel 1 audio frequency -AUDC1 = $D201 ;channel 1 audio control +AUDF1 = $D200 ;channel 1 audio frequency +AUDC1 = $D201 ;channel 1 audio control -AUDF2 = $D202 ;channel 2 audio frequency -AUDC2 = $D203 ;channel 2 audio control +AUDF2 = $D202 ;channel 2 audio frequency +AUDC2 = $D203 ;channel 2 audio control -AUDF3 = $D204 ;channel 3 audio frequency -AUDC3 = $D205 ;channel 3 audio control +AUDF3 = $D204 ;channel 3 audio frequency +AUDC3 = $D205 ;channel 3 audio control -AUDF4 = $D206 ;channel 4 audio frequency -AUDC4 = $D207 ;channel 4 audio control +AUDF4 = $D206 ;channel 4 audio frequency +AUDC4 = $D207 ;channel 4 audio control -AUDCTL = $D208 ;audio control -STIMER = $D209 ;start timers -SKRES = $D20A ;reset SKSTAT status -POTGO = $D20B ;start potentiometer scan sequence -SEROUT = $D20D ;serial port output -IRQEN = $D20E ;IRQ interrupt enable -SKCTL = $D20F ;serial port and keyboard control +AUDCTL = $D208 ;audio control +STIMER = $D209 ;start timers +SKRES = $D20A ;reset SKSTAT status +POTGO = $D20B ;start potentiometer scan sequence +SEROUT = $D20D ;serial port output +IRQEN = $D20E ;IRQ interrupt enable +SKCTL = $D20F ;serial port and keyboard control ;------------------------------------------------------------------------- ; PIA Address Equates ;------------------------------------------------------------------------- -PIA = $D300 ;PIA area +PIA = $D300 ;PIA area -PORTA = $D300 ;port A direction register or jacks one/two -PORTB = $D301 ;port B direction register or memory management +PORTA = $D300 ;port A direction register or jacks one/two +PORTB = $D301 ;port B direction register or memory management -PACTL = $D302 ;port A control -PBCTL = $D303 ;port B control +PACTL = $D302 ;port A control +PBCTL = $D303 ;port B control ;------------------------------------------------------------------------- ; ANTIC Address Equates ;------------------------------------------------------------------------- -ANTIC = $D400 ;ANTIC area +ANTIC = $D400 ;ANTIC area ; Read Addresses -VCOUNT = $D40B ;vertical line counter -PENH = $D40C ;light pen horizontal position -PENV = $D40D ;light pen vertical position -NMIST = $D40F ;NMI interrupt status +VCOUNT = $D40B ;vertical line counter +PENH = $D40C ;light pen horizontal position +PENV = $D40D ;light pen vertical position +NMIST = $D40F ;NMI interrupt status ; Write Addresses -DMACTL = $D400 ;DMA control -CHACTL = $D401 ;character control -DLISTL = $D402 ;low display list address -DLISTH = $D403 ;high display list address -HSCROL = $D404 ;horizontal scroll -VSCROL = $D405 ;vertical scroll -PMBASE = $D407 ;player-missile base address -CHBASE = $D409 ;character base address -WSYNC = $D40A ;wait for HBLANK synchronization -NMIEN = $D40E ;NMI enable -NMIRES = $D40F ;NMI interrupt reset +DMACTL = $D400 ;DMA control +CHACTL = $D401 ;character control +DLISTL = $D402 ;low display list address +DLISTH = $D403 ;high display list address +HSCROL = $D404 ;horizontal scroll +VSCROL = $D405 ;vertical scroll +PMBASE = $D407 ;player-missile base address +CHBASE = $D409 ;character base address +WSYNC = $D40A ;wait for HBLANK synchronization +NMIEN = $D40E ;NMI enable +NMIRES = $D40F ;NMI interrupt reset ;------------------------------------------------------------------------- ; Floating Point Package Address Equates ;------------------------------------------------------------------------- -AFP = $D800 ;convert ASCII to floating point -FASC = $D8E6 ;convert floating point to ASCII -IFP = $D9AA ;convert integer to floating point -FPI = $D9D2 ;convert floating point to integer -ZFR0 = $DA44 ;zero FR0 -ZF1 = $DA46 ;zero floating point number -FSUB = $DA60 ;subtract floating point numbers -FADD = $DA66 ;add floating point numbers -FMUL = $DADB ;multiply floating point numbers -FDIV = $DB28 ;divide floating point numbers -PLYEVL = $DD40 ;evaluate floating point polynomial -FLD0R = $DD89 ;load floating point number -FLD0P = $DD8D ;load floating point number -FLD1R = $DD98 ;load floating point number -PLD1P = $DD9C ;load floating point number -FST0R = $DDA7 ;store floating point number -FST0P = $DDAB ;store floating point number -FMOVE = $DDB6 ;move floating point number -LOG = $DECD ;calculate floating point logarithm -LOG10 = $DED1 ;calculate floating point base 10 logarithm -EXP = $DDC0 ;calculate floating point exponential -EXP10 = $DDCC ;calculate floating point base 10 exponential +AFP = $D800 ;convert ASCII to floating point +FASC = $D8E6 ;convert floating point to ASCII +IFP = $D9AA ;convert integer to floating point +FPI = $D9D2 ;convert floating point to integer +ZFR0 = $DA44 ;zero FR0 +ZF1 = $DA46 ;zero floating point number +FSUB = $DA60 ;subtract floating point numbers +FADD = $DA66 ;add floating point numbers +FMUL = $DADB ;multiply floating point numbers +FDIV = $DB28 ;divide floating point numbers +PLYEVL = $DD40 ;evaluate floating point polynomial +FLD0R = $DD89 ;load floating point number +FLD0P = $DD8D ;load floating point number +FLD1R = $DD98 ;load floating point number +PLD1P = $DD9C ;load floating point number +FST0R = $DDA7 ;store floating point number +FST0P = $DDAB ;store floating point number +FMOVE = $DDB6 ;move floating point number +LOG = $DECD ;calculate floating point logarithm +LOG10 = $DED1 ;calculate floating point base 10 logarithm +EXP = $DDC0 ;calculate floating point exponential +EXP10 = $DDCC ;calculate floating point base 10 exponential ;------------------------------------------------------------------------- ; Device Handler Vector Table Address Equates ;------------------------------------------------------------------------- -EDITRV = $E400 ;editor handler vector table -SCRENV = $E410 ;screen handler vector table -KEYBDV = $E420 ;keyboard handler vector table -PRINTV = $E430 ;printer handler vector table -CASETV = $E440 ;cassette handler vector table +EDITRV = $E400 ;editor handler vector table +SCRENV = $E410 ;screen handler vector table +KEYBDV = $E420 ;keyboard handler vector table +PRINTV = $E430 ;printer handler vector table +CASETV = $E440 ;cassette handler vector table ;------------------------------------------------------------------------- ; Jump Vector Address Equates ;------------------------------------------------------------------------- -DISKIV = $E450 ;vector to initialize DIO -DSKINV = $E453 ;vector to DIO -CIOV = $E456 ;vector to CIO -SIOV = $E459 ;vector to SIO -SETVBV = $E45C ;vector to set VBLANK parameters -SYSVBV = $E45F ;vector to process immediate VBLANK -XITVBV = $E462 ;vector to process deferred VBLANK -SIOINV = $E465 ;vector to initialize SIO -SENDEV = $E468 ;vector to enable SEND -INTINV = $E46B ;vector to initialize interrupt handler -CIOINV = $E46E ;vector to initialize CIO -BLKBDV = $E471 ;vector to power-up display -WARMSV = $E474 ;vector to warmstart -COLDSV = $E477 ;vector to coldstart -RBLOKV = $E47A ;vector to read cassette block -CSOPIV = $E47D ;vector to open cassette for input -VCTABL = $E480 ;RAM vector initial value table -PUPDIV = $E480 ;##rev2## vector to power-up display -SLFTSV = $E483 ;##rev2## vector to self-test -PHENTV = $E486 ;##rev2## vector to enter peripheral handler -PHUNLV = $E489 ;##rev2## vector to unlink peripheral handler -PHINIV = $E48C ;##rev2## vector to initialize peripheral handler -GPDVV = $E48F ;##rev2## generic parallel device handler vector +DISKIV = $E450 ;vector to initialize DIO +DSKINV = $E453 ;vector to DIO +CIOV = $E456 ;vector to CIO +SIOV = $E459 ;vector to SIO +SETVBV = $E45C ;vector to set VBLANK parameters +SYSVBV = $E45F ;vector to process immediate VBLANK +XITVBV = $E462 ;vector to process deferred VBLANK +SIOINV = $E465 ;vector to initialize SIO +SENDEV = $E468 ;vector to enable SEND +INTINV = $E46B ;vector to initialize interrupt handler +CIOINV = $E46E ;vector to initialize CIO +BLKBDV = $E471 ;vector to power-up display +WARMSV = $E474 ;vector to warmstart +COLDSV = $E477 ;vector to coldstart +RBLOKV = $E47A ;vector to read cassette block +CSOPIV = $E47D ;vector to open cassette for input +VCTABL = $E480 ;RAM vector initial value table +PUPDIV = $E480 ;##rev2## vector to power-up display +SLFTSV = $E483 ;##rev2## vector to self-test +PHENTV = $E486 ;##rev2## vector to enter peripheral handler +PHUNLV = $E489 ;##rev2## vector to unlink peripheral handler +PHINIV = $E48C ;##rev2## vector to initialize peripheral handler +GPDVV = $E48F ;##rev2## generic parallel device handler vector ; NOTE: OS rom self-test labels are not included in this file @@ -985,105 +985,105 @@ GPDVV = $E48F ;##rev2## generic parallel device handler vector ;------------------------------------------------------------------------- ; THE FOLLOWING ARE IN BASIC CARTRIDGE: -SIN = $BD81 ;FR0 <- SIN (FR0) DEGFLG (0=RAD,6=DEG) CARRY -COS = $BD73 ;FR0 <- COS (FR0) CARRY -ATAN = $BE43 ;FR0 <- ATAN(FR0) CARRY -SQR = $BEB1 ;FR0 <- ROOT(FR0) CARRY +SIN = $BD81 ;FR0 <- SIN (FR0) DEGFLG (0=RAD,6=DEG) CARRY +COS = $BD73 ;FR0 <- COS (FR0) CARRY +ATAN = $BE43 ;FR0 <- ATAN(FR0) CARRY +SQR = $BEB1 ;FR0 <- ROOT(FR0) CARRY -RADON = 0 ;INDICATES RADIANS -DEGON = 6 ;INDICATES DEGREES +RADON = 0 ;INDICATES RADIANS +DEGON = 6 ;INDICATES DEGREES -ASCZER = '0' ;ASCII ZERO -COLON = $3A ;ASCII COLON -CR = $9B ;SYSTEM EOL (CARRIAGE RETURN) +ASCZER = '0' ;ASCII ZERO +COLON = $3A ;ASCII COLON +CR = $9B ;SYSTEM EOL (CARRIAGE RETURN) ;------------------------------------------------------------------------- ; 6502 ;------------------------------------------------------------------------- -NMIVEC = $FFFA -RESVEC = $FFFC -IRQVEC = $FFFE +NMIVEC = $FFFA +RESVEC = $FFFC +IRQVEC = $FFFE ;------------------------------------------------------------------------- ; BASIC ;------------------------------------------------------------------------- -LOMEM = $80 ;2-byte low memory pointer -VNTP = $82 ;2-byte variable name table address -VNTD = $84 ;2-byte variable name table end + 1 -VVTP = $86 ;2-byte variable value table -STMTAB = $88 ;2-byte statement table address -STMCUR = $8A ;2-byte current statement pointer -STARP = $8C ;2-byte string and array table pointer -RUNSTK = $8E ;2-byte runtime stack address -BMEMTOP = $90 ;2-byte top of memory pointer -STOPLN = $BA ;2-byte stopped line number -ERRSAVE = $C3 ;1-byte error code -PTABW = $C9 ;1-byte tab width +LOMEM = $80 ;2-byte low memory pointer +VNTP = $82 ;2-byte variable name table address +VNTD = $84 ;2-byte variable name table end + 1 +VVTP = $86 ;2-byte variable value table +STMTAB = $88 ;2-byte statement table address +STMCUR = $8A ;2-byte current statement pointer +STARP = $8C ;2-byte string and array table pointer +RUNSTK = $8E ;2-byte runtime stack address +BMEMTOP = $90 ;2-byte top of memory pointer +STOPLN = $BA ;2-byte stopped line number +ERRSAVE = $C3 ;1-byte error code +PTABW = $C9 ;1-byte tab width ;------------------------------------------------------------------------- ; DOS ;------------------------------------------------------------------------- -DOS = $0700 +DOS = $0700 -RENAME = $20 ;RENAME DISK FILE -DELETE = $21 ;DELETE DISK FILE -LOCKFL = $23 ;LOCK FILE TO READ ONLY -UNLOCK = $24 ;UNLOCK LOCKED FILE -POINT = $25 ;POINT SECTOR -NOTE = $26 ;NOTE SECTOR -FORMAT = $FE ;FORMAT +RENAME = $20 ;RENAME DISK FILE +DELETE = $21 ;DELETE DISK FILE +LOCKFL = $23 ;LOCK FILE TO READ ONLY +UNLOCK = $24 ;UNLOCK LOCKED FILE +POINT = $25 ;POINT SECTOR +NOTE = $26 ;NOTE SECTOR +FORMAT = $FE ;FORMAT ; Command line table, Index values for (DOSVEC),Y -- COMTAB ; Compatible with OS/A+, DOS XL and SpartaDOS -COMTAB = 0 ;DOS entry jump vector -ZCRNAME = 3 ;file name crunch routine jump vector -BUFOFF = 10 ;next parameter buffer offset -COMFNAM = 33 ;destination buffer for crunch routine -LBUF = 63 ;command line input buffer +COMTAB = 0 ;DOS entry jump vector +ZCRNAME = 3 ;file name crunch routine jump vector +BUFOFF = 10 ;next parameter buffer offset +COMFNAM = 33 ;destination buffer for crunch routine +LBUF = 63 ;command line input buffer ;------------------------------------------------------------------------- ; ATASCII CHARACTER DEFS ;------------------------------------------------------------------------- -ATCLR = $7D ;CLEAR SCREEN CHARACTER -ATRUB = $7E ;BACK SPACE (RUBOUT) -ATTAB = $7F ;TAB -ATEOL = $9B ;END-OF-LINE -ATDELL = $9C ;delete line -ATINSL = $9D ;insert line -ATCTAB = $9E ;clear TAB -ATSTAB = $9F ;set TAB -ATBEL = $FD ;CONSOLE BELL -ATDEL = $FE ;delete char. -ATINS = $FF ;insert char. -ATURW = $1C ;UP-ARROW -ATDRW = $1D ;DOWN-ARROW -ATLRW = $1E ;LEFT-ARROW -ATRRW = $1F ;RIGHT-ARROW -ATESC = $1B ;ESCAPE +ATCLR = $7D ;CLEAR SCREEN CHARACTER +ATRUB = $7E ;BACK SPACE (RUBOUT) +ATTAB = $7F ;TAB +ATEOL = $9B ;END-OF-LINE +ATDELL = $9C ;delete line +ATINSL = $9D ;insert line +ATCTAB = $9E ;clear TAB +ATSTAB = $9F ;set TAB +ATBEL = $FD ;CONSOLE BELL +ATDEL = $FE ;delete char. +ATINS = $FF ;insert char. +ATURW = $1C ;UP-ARROW +ATDRW = $1D ;DOWN-ARROW +ATLRW = $1E ;LEFT-ARROW +ATRRW = $1F ;RIGHT-ARROW +ATESC = $1B ;ESCAPE ;------------------------------------------------------------------------- ; OFFSETS INTO SECTSIZETAB (DIO functions) ;------------------------------------------------------------------------- -sst_flag = 0 ; length 1 -sst_sectsize = 1 ; 2 -sst_driveno = 3 ; 1 (drive #) -sst_size = 4 ; size of one entry - ; if changed, adapt diopncls.s +sst_flag = 0 ; length 1 +sst_sectsize = 1 ; 2 +sst_driveno = 3 ; 1 (drive #) +sst_size = 4 ; size of one entry + ; if changed, adapt diopncls.s ;------------------------------------------------------------------------- ; OFFSETS INTO dio_phys_pos ;------------------------------------------------------------------------- -diopp_head = 0 ; head -diopp_track = 1 ; track / cylinder -diopp_sector = 3 ; sector -diopp_size = 5 ; size of structure +diopp_head = 0 ; head +diopp_track = 1 ; track / cylinder +diopp_sector = 3 ; sector +diopp_size = 5 ; size of structure ;------------------------------------------------------------------------- ; VALUES for dos_type @@ -1091,7 +1091,7 @@ diopp_size = 5 ; size of structure ATARIDOS = 0 SPARTADOS = 1 -OSADOS = 2 ; OS/A+ +OSADOS = 2 ; OS/A+ MYDOS = 3 XDOS = 4 NODOS = 255 @@ -1103,28 +1103,28 @@ NODOS = 255 ; usage example: ; ; ScreenDL: -; .byte DL_BLK8 -; .byte DL_BLK8 +; .byte DL_BLK8 +; .byte DL_BLK8 ; .byte DL_CHR40x8x1 + DL_LMS + DL_DLI -; .word ScreenAlignment -; .byte DL_BLK1 + DL_DLI -; .byte DL_MAP320x1x1 + DL_LMS -; .word Screen +; .word ScreenAlignment +; .byte DL_BLK1 + DL_DLI +; .byte DL_MAP320x1x1 + DL_LMS +; .word Screen ; ; .repeat 99 -; .byte DL_MAP320x1x1 +; .byte DL_MAP320x1x1 ; .endrepeat -; .byte DL_MAP320x1x1 + DL_LMS -; .word Screen + 40 * 100 ; 100 lines a 40 byte, 'Screen' has to be aligned correctly! +; .byte DL_MAP320x1x1 + DL_LMS +; .word Screen + 40 * 100 ; 100 lines a 40 byte, 'Screen' has to be aligned correctly! ; .repeat 92 -; .byte DL_MAP320x1x1 +; .byte DL_MAP320x1x1 ; .endrepeat ; -; .byte DL_JVB +; .byte DL_JVB ; absolute instructions (non mode lines) -DL_JMP = 1 +DL_JMP = 1 DL_JVB = 65 DL_BLK1 = 0 @@ -1138,21 +1138,21 @@ DL_BLK8 = 112 ; absolute instructions (mode lines) -DL_CHR40x8x1 = 2 ; monochrome, 40 character & 8 scanlines per mode line (GR. 0) -DL_CHR40x10x1 = 3 ; monochrome, 40 character & 10 scanlines per mode line -DL_CHR40x8x4 = 4 ; colour, 40 character & 8 scanlines per mode line (GR. 12) -DL_CHR40x16x4 = 5 ; colour, 40 character & 16 scanlines per mode line (GR. 13) -DL_CHR20x8x2 = 6 ; colour (duochrome per character), 20 character & 8 scanlines per mode line (GR. 1) -DL_CHR20x16x2 = 7 ; colour (duochrome per character), 20 character & 16 scanlines per mode line (GR. 2) +DL_CHR40x8x1 = 2 ; monochrome, 40 character & 8 scanlines per mode line (GR. 0) +DL_CHR40x10x1 = 3 ; monochrome, 40 character & 10 scanlines per mode line +DL_CHR40x8x4 = 4 ; colour, 40 character & 8 scanlines per mode line (GR. 12) +DL_CHR40x16x4 = 5 ; colour, 40 character & 16 scanlines per mode line (GR. 13) +DL_CHR20x8x2 = 6 ; colour (duochrome per character), 20 character & 8 scanlines per mode line (GR. 1) +DL_CHR20x16x2 = 7 ; colour (duochrome per character), 20 character & 16 scanlines per mode line (GR. 2) -DL_MAP40x8x4 = 8 ; colour, 40 pixel & 8 scanlines per mode line (GR. 3) -DL_MAP80x4x2 = 9 ; 'duochrome', 80 pixel & 4 scanlines per mode line (GR.4) -DL_MAP80x4x4 = 10 ; colour, 80 pixel & 4 scanlines per mode line (GR.5) -DL_MAP160x2x2 = 11 ; 'duochrome', 160 pixel & 2 scanlines per mode line (GR.6) -DL_MAP160x1x2 = 12 ; 'duochrome', 160 pixel & 1 scanline per mode line (GR.14) -DL_MAP160x2x4 = 13 ; 4 colours, 160 pixel & 2 scanlines per mode line (GR.7) -DL_MAP160x1x4 = 14 ; 4 colours, 160 pixel & 1 scanline per mode line (GR.15) -DL_MAP320x1x1 = 15 ; monochrome, 320 pixel & 1 scanline per mode line (GR.8) +DL_MAP40x8x4 = 8 ; colour, 40 pixel & 8 scanlines per mode line (GR. 3) +DL_MAP80x4x2 = 9 ; 'duochrome', 80 pixel & 4 scanlines per mode line (GR.4) +DL_MAP80x4x4 = 10 ; colour, 80 pixel & 4 scanlines per mode line (GR.5) +DL_MAP160x2x2 = 11 ; 'duochrome', 160 pixel & 2 scanlines per mode line (GR.6) +DL_MAP160x1x2 = 12 ; 'duochrome', 160 pixel & 1 scanline per mode line (GR.14) +DL_MAP160x2x4 = 13 ; 4 colours, 160 pixel & 2 scanlines per mode line (GR.7) +DL_MAP160x1x4 = 14 ; 4 colours, 160 pixel & 1 scanline per mode line (GR.15) +DL_MAP320x1x1 = 15 ; monochrome, 320 pixel & 1 scanline per mode line (GR.8) ; modifiers on mode lines... @@ -1162,7 +1162,7 @@ DL_LMS = 64 ; general modifier... -DL_DLI = 128 +DL_DLI = 128 ;------------------------------------------------------------------------- ; End of atari.inc diff --git a/asminc/c128.inc b/asminc/c128.inc index 079c4b4da..8ec72a172 100644 --- a/asminc/c128.inc +++ b/asminc/c128.inc @@ -7,193 +7,193 @@ ; Zero page, Commodore stuff TIME := $A0 ; 60HZ clock -FNAM_LEN := $B7 ; Length of filename -SECADR := $B9 ; Secondary address -DEVNUM := $BA ; Device number -FNAM := $BB ; Address of filename -FNAM_BANK := $C7 ; Bank for filename -KEY_COUNT := $D0 ; Number of keys in input buffer -FKEY_COUNT := $D1 ; Characters for function key -MODE := $D7 ; 40/80 column mode flag -CURS_X := $EC ; Cursor column -CURS_Y := $EB ; Cursor row -SCREEN_PTR := $E0 ; Pointer to current char in text screen -CRAM_PTR := $E2 ; Pointer to current char in color RAM +FNAM_LEN := $B7 ; Length of filename +SECADR := $B9 ; Secondary address +DEVNUM := $BA ; Device number +FNAM := $BB ; Address of filename +FNAM_BANK := $C7 ; Bank for filename +KEY_COUNT := $D0 ; Number of keys in input buffer +FKEY_COUNT := $D1 ; Characters for function key +MODE := $D7 ; 40/80 column mode flag +CURS_X := $EC ; Cursor column +CURS_Y := $EB ; Cursor row +SCREEN_PTR := $E0 ; Pointer to current char in text screen +CRAM_PTR := $E2 ; Pointer to current char in color RAM CHARCOLOR := $F1 RVS := $F3 ; Reverse output flag -SCROLL := $F8 ; Disable scrolling flag +SCROLL := $F8 ; Disable scrolling flag -BASIC_BUF := $200 ; Location of command-line -BASIC_BUF_LEN = 162 ; Maximum length of command-line +BASIC_BUF := $200 ; Location of command-line +BASIC_BUF_LEN = 162 ; Maximum length of command-line FETCH := $2A2 ; Fetch subroutine in RAM FETVEC := $2AA ; Vector patch location for FETCH STASH := $2AF ; Stash routine in RAM STAVEC := $2B9 ; Vector patch location for STASH PALFLAG := $A03 ; $FF=PAL, $00=NTSC -INIT_STATUS := $A04 ; Flag: Reset/NMI Status -FKEY_LEN := $1000 ; Function key lengths -FKEY_TEXT := $100A ; Function key texts +INIT_STATUS := $A04 ; Flag: Reset/NMI Status +FKEY_LEN := $1000 ; Function key lengths +FKEY_TEXT := $100A ; Function key texts ; --------------------------------------------------------------------------- ; Kernal routines ; Direct entries -CURS_SET := $CD57 -CURS_ON := $CD6F +CURS_SET := $CD57 +CURS_ON := $CD6F CURS_OFF := $CD9F -CLRSCR := $C142 -KBDREAD := $C006 -NEWLINE := $C363 -PRINT := $C322 +CLRSCR := $C142 +KBDREAD := $C006 +NEWLINE := $C363 +PRINT := $C322 NMIEXIT := $FF33 INDFET := $FF74 ; --------------------------------------------------------------------------- ; Vectors -IRQVec := $0314 -BRKVec := $0316 -NMIVec := $0318 -KeyStoreVec := $033C +IRQVec := $0314 +BRKVec := $0316 +NMIVec := $0318 +KeyStoreVec := $033C ; --------------------------------------------------------------------------- ; I/O: VIC -VIC := $D000 -VIC_SPR0_X := $D000 -VIC_SPR0_Y := $D001 -VIC_SPR1_X := $D002 -VIC_SPR1_Y := $D003 -VIC_SPR2_X := $D004 -VIC_SPR2_Y := $D005 -VIC_SPR3_X := $D006 -VIC_SPR3_Y := $D007 -VIC_SPR4_X := $D008 -VIC_SPR4_Y := $D009 -VIC_SPR5_X := $D00A -VIC_SPR5_Y := $D00B -VIC_SPR6_X := $D00C -VIC_SPR6_Y := $D00D -VIC_SPR7_X := $D00E -VIC_SPR7_Y := $D00F -VIC_SPR_HI_X := $D010 -VIC_SPR_ENA := $D015 -VIC_SPR_EXP_Y := $D017 -VIC_SPR_EXP_X := $D01D -VIC_SPR_MCOLOR := $D01C +VIC := $D000 +VIC_SPR0_X := $D000 +VIC_SPR0_Y := $D001 +VIC_SPR1_X := $D002 +VIC_SPR1_Y := $D003 +VIC_SPR2_X := $D004 +VIC_SPR2_Y := $D005 +VIC_SPR3_X := $D006 +VIC_SPR3_Y := $D007 +VIC_SPR4_X := $D008 +VIC_SPR4_Y := $D009 +VIC_SPR5_X := $D00A +VIC_SPR5_Y := $D00B +VIC_SPR6_X := $D00C +VIC_SPR6_Y := $D00D +VIC_SPR7_X := $D00E +VIC_SPR7_Y := $D00F +VIC_SPR_HI_X := $D010 +VIC_SPR_ENA := $D015 +VIC_SPR_EXP_Y := $D017 +VIC_SPR_EXP_X := $D01D +VIC_SPR_MCOLOR := $D01C VIC_SPR_BG_PRIO := $D01B VIC_SPR_MCOLOR0 := $D025 VIC_SPR_MCOLOR1 := $D026 -VIC_SPR0_COLOR := $D027 -VIC_SPR1_COLOR := $D028 -VIC_SPR2_COLOR := $D029 -VIC_SPR3_COLOR := $D02A -VIC_SPR4_COLOR := $D02B -VIC_SPR5_COLOR := $D02C -VIC_SPR6_COLOR := $D02D -VIC_SPR7_COLOR := $D02E +VIC_SPR0_COLOR := $D027 +VIC_SPR1_COLOR := $D028 +VIC_SPR2_COLOR := $D029 +VIC_SPR3_COLOR := $D02A +VIC_SPR4_COLOR := $D02B +VIC_SPR5_COLOR := $D02C +VIC_SPR6_COLOR := $D02D +VIC_SPR7_COLOR := $D02E -VIC_CTRL1 := $D011 -VIC_CTRL2 := $D016 +VIC_CTRL1 := $D011 +VIC_CTRL2 := $D016 -VIC_HLINE := $D012 +VIC_HLINE := $D012 -VIC_VIDEO_ADR := $D018 +VIC_VIDEO_ADR := $D018 -VIC_IRR := $D019 ; Interrupt request register -VIC_IMR := $D01A ; Interrupt mask register +VIC_IRR := $D019 ; Interrupt request register +VIC_IMR := $D01A ; Interrupt mask register VIC_BORDERCOLOR := $D020 -VIC_BG_COLOR0 := $D021 -VIC_BG_COLOR1 := $D022 -VIC_BG_COLOR2 := $D023 -VIC_BG_COLOR3 := $D024 +VIC_BG_COLOR0 := $D021 +VIC_BG_COLOR1 := $D022 +VIC_BG_COLOR2 := $D023 +VIC_BG_COLOR3 := $D024 ; 128 stuff: -VIC_KBD_128 := $D02F ; Extended kbd bits (visible in 64 mode) -VIC_CLK_128 := $D030 ; Clock rate register (visible in 64 mode) +VIC_KBD_128 := $D02F ; Extended kbd bits (visible in 64 mode) +VIC_CLK_128 := $D030 ; Clock rate register (visible in 64 mode) ; --------------------------------------------------------------------------- ; I/O: SID -SID := $D400 -SID_S1Lo := $D400 -SID_S1Hi := $D401 -SID_PB1Lo := $D402 -SID_PB1Hi := $D403 -SID_Ctl1 := $D404 -SID_AD1 := $D405 -SID_SUR1 := $D406 +SID := $D400 +SID_S1Lo := $D400 +SID_S1Hi := $D401 +SID_PB1Lo := $D402 +SID_PB1Hi := $D403 +SID_Ctl1 := $D404 +SID_AD1 := $D405 +SID_SUR1 := $D406 -SID_S2Lo := $D407 -SID_S2Hi := $D408 -SID_PB2Lo := $D409 -SID_PB2Hi := $D40A -SID_Ctl2 := $D40B -SID_AD2 := $D40C -SID_SUR2 := $D40D +SID_S2Lo := $D407 +SID_S2Hi := $D408 +SID_PB2Lo := $D409 +SID_PB2Hi := $D40A +SID_Ctl2 := $D40B +SID_AD2 := $D40C +SID_SUR2 := $D40D -SID_S3Lo := $D40E -SID_S3Hi := $D40F -SID_PB3Lo := $D410 -SID_PB3Hi := $D411 -SID_Ctl3 := $D412 -SID_AD3 := $D413 -SID_SUR3 := $D414 +SID_S3Lo := $D40E +SID_S3Hi := $D40F +SID_PB3Lo := $D410 +SID_PB3Hi := $D411 +SID_Ctl3 := $D412 +SID_AD3 := $D413 +SID_SUR3 := $D414 -SID_FltLo := $D415 -SID_FltHi := $D416 -SID_FltCtl := $D417 -SID_Amp := $D418 -SID_ADConv1 := $D419 -SID_ADConv2 := $D41A -SID_Noise := $D41B -SID_Read3 := $D41C +SID_FltLo := $D415 +SID_FltHi := $D416 +SID_FltCtl := $D417 +SID_Amp := $D418 +SID_ADConv1 := $D419 +SID_ADConv2 := $D41A +SID_Noise := $D41B +SID_Read3 := $D41C ; --------------------------------------------------------------------------- ; I/O: VDC (128 only) -VDC_INDEX := $D600 -VDC_DATA := $D601 +VDC_INDEX := $D600 +VDC_DATA := $D601 ; --------------------------------------------------------------------------- ; I/O: CIAs -CIA1 := $DC00 -CIA1_PRA := $DC00 -CIA1_PRB := $DC01 -CIA1_DDRA := $DC02 -CIA1_DDRB := $DC03 +CIA1 := $DC00 +CIA1_PRA := $DC00 +CIA1_PRB := $DC01 +CIA1_DDRA := $DC02 +CIA1_DDRB := $DC03 CIA1_TOD10 := $DC08 CIA1_TODSEC := $DC09 CIA1_TODMIN := $DC0A CIA1_TODHR := $DC0B -CIA1_ICR := $DC0D -CIA1_CRA := $DC0E -CIA1_CRB := $DC0F +CIA1_ICR := $DC0D +CIA1_CRA := $DC0E +CIA1_CRB := $DC0F -CIA2 := $DD00 -CIA2_PRA := $DD00 -CIA2_PRB := $DD01 -CIA2_DDRA := $DD02 -CIA2_DDRB := $DD03 +CIA2 := $DD00 +CIA2_PRA := $DD00 +CIA2_PRB := $DD01 +CIA2_DDRA := $DD02 +CIA2_DDRB := $DD03 CIA2_TOD10 := $DD08 CIA2_TODSEC := $DD09 CIA2_TODMIN := $DD0A CIA2_TODHR := $DD0B -CIA2_ICR := $DD0D -CIA2_CRA := $DD0E -CIA2_CRB := $DD0F +CIA2_ICR := $DD0D +CIA2_CRA := $DD0E +CIA2_CRB := $DD0F ; --------------------------------------------------------------------------- ; I/O: MMU -MMU_CR := $FF00 +MMU_CR := $FF00 MMU_CFG_CC65 := %00001110 ; Bank 0 with kernal ROM MMU_CFG_RAM0 := %00111111 ; Bank 0 full RAM MMU_CFG_RAM1 := %01111111 ; Bank 1 full RAM @@ -203,9 +203,9 @@ MMU_CFG_RAM3 := %11111111 ; Bank 3 full RAM ; --------------------------------------------------------------------------- ; Super CPU -SCPU_VIC_Bank1 := $D075 -SCPU_Slow := $D07A -SCPU_Fast := $D07B +SCPU_VIC_Bank1 := $D075 +SCPU_Slow := $D07A +SCPU_Fast := $D07B SCPU_EnableRegs := $D07E SCPU_DisableRegs:= $D07F -SCPU_Detect := $D0BC +SCPU_Detect := $D0BC diff --git a/asminc/c64.inc b/asminc/c64.inc index 710c5b273..6823403c5 100644 --- a/asminc/c64.inc +++ b/asminc/c64.inc @@ -7,43 +7,43 @@ ; Zero page, Commodore stuff TIME := $A0 ; 60 HZ clock -FNAM_LEN := $B7 ; Length of filename -SECADR := $B9 ; Secondary address -DEVNUM := $BA ; Device number +FNAM_LEN := $B7 ; Length of filename +SECADR := $B9 ; Secondary address +DEVNUM := $BA ; Device number FNAM := $BB ; Pointer to filename -KEY_COUNT := $C6 ; Number of keys in input buffer +KEY_COUNT := $C6 ; Number of keys in input buffer RVS := $C7 ; Reverse flag -CURS_FLAG := $CC ; 1 = cursor off -CURS_BLINK := $CD ; Blink counter -CURS_CHAR := $CE ; Character under the cursor -CURS_STATE := $CF ; Cursor blink state -SCREEN_PTR := $D1 ; Pointer to current char in text screen -CURS_X := $D3 ; Cursor column -CURS_Y := $D6 ; Cursor row -CRAM_PTR := $F3 ; Pointer to current char in color RAM +CURS_FLAG := $CC ; 1 = cursor off +CURS_BLINK := $CD ; Blink counter +CURS_CHAR := $CE ; Character under the cursor +CURS_STATE := $CF ; Cursor blink state +SCREEN_PTR := $D1 ; Pointer to current char in text screen +CURS_X := $D3 ; Cursor column +CURS_Y := $D6 ; Cursor row +CRAM_PTR := $F3 ; Pointer to current char in color RAM -BASIC_BUF := $200 ; Location of command-line -BASIC_BUF_LEN = 89 ; Maximum length of command-line +BASIC_BUF := $200 ; Location of command-line +BASIC_BUF_LEN = 89 ; Maximum length of command-line CHARCOLOR := $286 -CURS_COLOR := $287 ; Color under the cursor -PALFLAG := $2A6 ; $01 = PAL, $00 = NTSC +CURS_COLOR := $287 ; Color under the cursor +PALFLAG := $2A6 ; $01 = PAL, $00 = NTSC ; --------------------------------------------------------------------------- ; Kernal routines ; Direct entries -CLRSCR := $E544 -KBDREAD := $E5B4 +CLRSCR := $E544 +KBDREAD := $E5B4 NMIEXIT := $FEBC ; --------------------------------------------------------------------------- ; Vector and other locations -IRQVec := $0314 -BRKVec := $0316 -NMIVec := $0318 +IRQVec := $0314 +BRKVec := $0316 +NMIVec := $0318 ; --------------------------------------------------------------------------- ; Screen size @@ -54,157 +54,157 @@ YSIZE = 25 ; --------------------------------------------------------------------------- ; I/O: VIC -VIC := $D000 -VIC_SPR0_X := $D000 -VIC_SPR0_Y := $D001 -VIC_SPR1_X := $D002 -VIC_SPR1_Y := $D003 -VIC_SPR2_X := $D004 -VIC_SPR2_Y := $D005 -VIC_SPR3_X := $D006 -VIC_SPR3_Y := $D007 -VIC_SPR4_X := $D008 -VIC_SPR4_Y := $D009 -VIC_SPR5_X := $D00A -VIC_SPR5_Y := $D00B -VIC_SPR6_X := $D00C -VIC_SPR6_Y := $D00D -VIC_SPR7_X := $D00E -VIC_SPR7_Y := $D00F -VIC_SPR_HI_X := $D010 -VIC_SPR_ENA := $D015 -VIC_SPR_EXP_Y := $D017 -VIC_SPR_EXP_X := $D01D -VIC_SPR_MCOLOR := $D01C +VIC := $D000 +VIC_SPR0_X := $D000 +VIC_SPR0_Y := $D001 +VIC_SPR1_X := $D002 +VIC_SPR1_Y := $D003 +VIC_SPR2_X := $D004 +VIC_SPR2_Y := $D005 +VIC_SPR3_X := $D006 +VIC_SPR3_Y := $D007 +VIC_SPR4_X := $D008 +VIC_SPR4_Y := $D009 +VIC_SPR5_X := $D00A +VIC_SPR5_Y := $D00B +VIC_SPR6_X := $D00C +VIC_SPR6_Y := $D00D +VIC_SPR7_X := $D00E +VIC_SPR7_Y := $D00F +VIC_SPR_HI_X := $D010 +VIC_SPR_ENA := $D015 +VIC_SPR_EXP_Y := $D017 +VIC_SPR_EXP_X := $D01D +VIC_SPR_MCOLOR := $D01C VIC_SPR_BG_PRIO := $D01B VIC_SPR_MCOLOR0 := $D025 VIC_SPR_MCOLOR1 := $D026 -VIC_SPR0_COLOR := $D027 -VIC_SPR1_COLOR := $D028 -VIC_SPR2_COLOR := $D029 -VIC_SPR3_COLOR := $D02A -VIC_SPR4_COLOR := $D02B -VIC_SPR5_COLOR := $D02C -VIC_SPR6_COLOR := $D02D -VIC_SPR7_COLOR := $D02E +VIC_SPR0_COLOR := $D027 +VIC_SPR1_COLOR := $D028 +VIC_SPR2_COLOR := $D029 +VIC_SPR3_COLOR := $D02A +VIC_SPR4_COLOR := $D02B +VIC_SPR5_COLOR := $D02C +VIC_SPR6_COLOR := $D02D +VIC_SPR7_COLOR := $D02E -VIC_CTRL1 := $D011 -VIC_CTRL2 := $D016 +VIC_CTRL1 := $D011 +VIC_CTRL2 := $D016 -VIC_HLINE := $D012 +VIC_HLINE := $D012 -VIC_VIDEO_ADR := $D018 +VIC_VIDEO_ADR := $D018 -VIC_IRR := $D019 ; Interrupt request register -VIC_IMR := $D01A ; Interrupt mask register +VIC_IRR := $D019 ; Interrupt request register +VIC_IMR := $D01A ; Interrupt mask register VIC_BORDERCOLOR := $D020 -VIC_BG_COLOR0 := $D021 -VIC_BG_COLOR1 := $D022 -VIC_BG_COLOR2 := $D023 -VIC_BG_COLOR3 := $D024 +VIC_BG_COLOR0 := $D021 +VIC_BG_COLOR1 := $D022 +VIC_BG_COLOR2 := $D023 +VIC_BG_COLOR3 := $D024 ; 128 stuff: -VIC_KBD_128 := $D02F ; Extended kbd bits (visible in 64 mode) -VIC_CLK_128 := $D030 ; Clock rate register (visible in 64 mode) +VIC_KBD_128 := $D02F ; Extended kbd bits (visible in 64 mode) +VIC_CLK_128 := $D030 ; Clock rate register (visible in 64 mode) ; --------------------------------------------------------------------------- ; I/O: SID -SID := $D400 -SID_S1Lo := $D400 -SID_S1Hi := $D401 -SID_PB1Lo := $D402 -SID_PB1Hi := $D403 -SID_Ctl1 := $D404 -SID_AD1 := $D405 -SID_SUR1 := $D406 +SID := $D400 +SID_S1Lo := $D400 +SID_S1Hi := $D401 +SID_PB1Lo := $D402 +SID_PB1Hi := $D403 +SID_Ctl1 := $D404 +SID_AD1 := $D405 +SID_SUR1 := $D406 -SID_S2Lo := $D407 -SID_S2Hi := $D408 -SID_PB2Lo := $D409 -SID_PB2Hi := $D40A -SID_Ctl2 := $D40B -SID_AD2 := $D40C -SID_SUR2 := $D40D +SID_S2Lo := $D407 +SID_S2Hi := $D408 +SID_PB2Lo := $D409 +SID_PB2Hi := $D40A +SID_Ctl2 := $D40B +SID_AD2 := $D40C +SID_SUR2 := $D40D -SID_S3Lo := $D40E -SID_S3Hi := $D40F -SID_PB3Lo := $D410 -SID_PB3Hi := $D411 -SID_Ctl3 := $D412 -SID_AD3 := $D413 -SID_SUR3 := $D414 +SID_S3Lo := $D40E +SID_S3Hi := $D40F +SID_PB3Lo := $D410 +SID_PB3Hi := $D411 +SID_Ctl3 := $D412 +SID_AD3 := $D413 +SID_SUR3 := $D414 -SID_FltLo := $D415 -SID_FltHi := $D416 -SID_FltCtl := $D417 -SID_Amp := $D418 -SID_ADConv1 := $D419 -SID_ADConv2 := $D41A -SID_Noise := $D41B -SID_Read3 := $D41C +SID_FltLo := $D415 +SID_FltHi := $D416 +SID_FltCtl := $D417 +SID_Amp := $D418 +SID_ADConv1 := $D419 +SID_ADConv2 := $D41A +SID_Noise := $D41B +SID_Read3 := $D41C ; --------------------------------------------------------------------------- ; I/O: VDC (128 only) -VDC_INDEX := $D600 -VDC_DATA := $D601 +VDC_INDEX := $D600 +VDC_DATA := $D601 ; --------------------------------------------------------------------------- ; I/O: CIAs -CIA1 := $DC00 -CIA1_PRA := $DC00 -CIA1_PRB := $DC01 -CIA1_DDRA := $DC02 -CIA1_DDRB := $DC03 +CIA1 := $DC00 +CIA1_PRA := $DC00 +CIA1_PRB := $DC01 +CIA1_DDRA := $DC02 +CIA1_DDRB := $DC03 CIA1_TOD10 := $DC08 CIA1_TODSEC := $DC09 CIA1_TODMIN := $DC0A CIA1_TODHR := $DC0B -CIA1_ICR := $DC0D -CIA1_CRA := $DC0E -CIA1_CRB := $DC0F +CIA1_ICR := $DC0D +CIA1_CRA := $DC0E +CIA1_CRB := $DC0F -CIA2 := $DD00 -CIA2_PRA := $DD00 -CIA2_PRB := $DD01 -CIA2_DDRA := $DD02 -CIA2_DDRB := $DD03 +CIA2 := $DD00 +CIA2_PRA := $DD00 +CIA2_PRB := $DD01 +CIA2_DDRA := $DD02 +CIA2_DDRB := $DD03 CIA2_TOD10 := $DD08 CIA2_TODSEC := $DD09 CIA2_TODMIN := $DD0A CIA2_TODHR := $DD0B -CIA2_ICR := $DD0D -CIA2_CRA := $DD0E -CIA2_CRB := $DD0F +CIA2_ICR := $DD0D +CIA2_CRA := $DD0E +CIA2_CRB := $DD0F ; --------------------------------------------------------------------------- ; Super CPU -SCPU_VIC_Bank1 := $D075 -SCPU_Slow := $D07A -SCPU_Fast := $D07B +SCPU_VIC_Bank1 := $D075 +SCPU_Slow := $D07A +SCPU_Fast := $D07B SCPU_EnableRegs := $D07E SCPU_DisableRegs:= $D07F -SCPU_Detect := $D0BC +SCPU_Detect := $D0BC ; --------------------------------------------------------------------------- ; Processor Port at $01 -LORAM = $01 ; Enable the basic rom -HIRAM = $02 ; Enable the kernal rom -IOEN = $04 ; Enable I/O -CASSDATA = $08 ; Cassette data -CASSPLAY = $10 ; Cassette: Play -CASSMOT = $20 ; Cassette motor on -TP_FAST = $80 ; Switch Rossmoeller TurboProcess to fast mode +LORAM = $01 ; Enable the basic rom +HIRAM = $02 ; Enable the kernal rom +IOEN = $04 ; Enable I/O +CASSDATA = $08 ; Cassette data +CASSPLAY = $10 ; Cassette: Play +CASSMOT = $20 ; Cassette motor on +TP_FAST = $80 ; Switch Rossmoeller TurboProcess to fast mode -RAMONLY = $F8 ; (~(LORAM | HIRAM | IOEN)) & $FF +RAMONLY = $F8 ; (~(LORAM | HIRAM | IOEN)) & $FF diff --git a/asminc/cbm510.inc b/asminc/cbm510.inc index c4476c2e1..827c507fc 100644 --- a/asminc/cbm510.inc +++ b/asminc/cbm510.inc @@ -9,8 +9,8 @@ ;----------------------------------------------------------------------------- ; Zeropage stuff -ExecReg = $00 -IndReg = $01 +ExecReg = $00 +IndReg = $01 ; --------------------------------------------------------------------------- ; Screen size @@ -23,93 +23,93 @@ YSIZE = 25 ; I/O $d800: VIC -VIC_SPR0_X = $00 -VIC_SPR0_Y = $01 -VIC_SPR1_X = $02 -VIC_SPR1_Y = $03 -VIC_SPR2_X = $04 -VIC_SPR2_Y = $05 -VIC_SPR3_X = $06 -VIC_SPR3_Y = $07 -VIC_SPR4_X = $08 -VIC_SPR4_Y = $09 -VIC_SPR5_X = $0A -VIC_SPR5_Y = $0B -VIC_SPR6_X = $0C -VIC_SPR6_Y = $0D -VIC_SPR7_X = $0E -VIC_SPR7_Y = $0F -VIC_SPR_HI_X = $10 -VIC_SPR_ENA = $15 -VIC_SPR_EXP_Y = $17 -VIC_SPR_EXP_X = $1D -VIC_SPR_MCOLOR = $1C +VIC_SPR0_X = $00 +VIC_SPR0_Y = $01 +VIC_SPR1_X = $02 +VIC_SPR1_Y = $03 +VIC_SPR2_X = $04 +VIC_SPR2_Y = $05 +VIC_SPR3_X = $06 +VIC_SPR3_Y = $07 +VIC_SPR4_X = $08 +VIC_SPR4_Y = $09 +VIC_SPR5_X = $0A +VIC_SPR5_Y = $0B +VIC_SPR6_X = $0C +VIC_SPR6_Y = $0D +VIC_SPR7_X = $0E +VIC_SPR7_Y = $0F +VIC_SPR_HI_X = $10 +VIC_SPR_ENA = $15 +VIC_SPR_EXP_Y = $17 +VIC_SPR_EXP_X = $1D +VIC_SPR_MCOLOR = $1C VIC_SPR_BG_PRIO = $1B VIC_SPR_MCOLOR0 = $25 VIC_SPR_MCOLOR1 = $26 -VIC_SPR0_COLOR = $27 -VIC_SPR1_COLOR = $28 -VIC_SPR2_COLOR = $29 -VIC_SPR3_COLOR = $2A -VIC_SPR4_COLOR = $2B -VIC_SPR5_COLOR = $2C -VIC_SPR6_COLOR = $2D -VIC_SPR7_COLOR = $2E +VIC_SPR0_COLOR = $27 +VIC_SPR1_COLOR = $28 +VIC_SPR2_COLOR = $29 +VIC_SPR3_COLOR = $2A +VIC_SPR4_COLOR = $2B +VIC_SPR5_COLOR = $2C +VIC_SPR6_COLOR = $2D +VIC_SPR7_COLOR = $2E -VIC_CTRL1 = $11 -VIC_CTRL2 = $16 +VIC_CTRL1 = $11 +VIC_CTRL2 = $16 -VIC_HLINE = $12 +VIC_HLINE = $12 -VIC_VIDEO_ADR = $18 +VIC_VIDEO_ADR = $18 -VIC_IRR = $19 ; Interrupt request register -VIC_IMR = $1A ; Interrupt mask register +VIC_IRR = $19 ; Interrupt request register +VIC_IMR = $1A ; Interrupt mask register VIC_BORDERCOLOR = $20 -VIC_BG_COLOR0 = $21 -VIC_BG_COLOR1 = $22 -VIC_BG_COLOR2 = $23 -VIC_BG_COLOR3 = $24 +VIC_BG_COLOR0 = $21 +VIC_BG_COLOR1 = $22 +VIC_BG_COLOR2 = $23 +VIC_BG_COLOR3 = $24 ; I/O $da00: SID 6581 -SID_S1Lo = $00 -SID_S1Hi = $01 -SID_PB1Lo = $02 -SID_PB1Hi = $03 -SID_Ctl1 = $04 -SID_AD1 = $05 -SID_SUR1 = $06 +SID_S1Lo = $00 +SID_S1Hi = $01 +SID_PB1Lo = $02 +SID_PB1Hi = $03 +SID_Ctl1 = $04 +SID_AD1 = $05 +SID_SUR1 = $06 -SID_S2Lo = $07 -SID_S2Hi = $08 -SID_PB2Lo = $09 -SID_PB2Hi = $0A -SID_Ctl2 = $0B -SID_AD2 = $0C -SID_SUR2 = $0D +SID_S2Lo = $07 +SID_S2Hi = $08 +SID_PB2Lo = $09 +SID_PB2Hi = $0A +SID_Ctl2 = $0B +SID_AD2 = $0C +SID_SUR2 = $0D -SID_S3Lo = $0E -SID_S3Hi = $0F -SID_PB3Lo = $10 -SID_PB3Hi = $11 -SID_Ctl3 = $12 -SID_AD3 = $13 -SID_SUR3 = $14 +SID_S3Lo = $0E +SID_S3Hi = $0F +SID_PB3Lo = $10 +SID_PB3Hi = $11 +SID_Ctl3 = $12 +SID_AD3 = $13 +SID_SUR3 = $14 -SID_FltLo = $15 -SID_FltHi = $16 -SID_FltCtl = $17 -SID_Amp = $18 -SID_ADConv1 = $19 -SID_ADConv2 = $1A -SID_Noise = $1B -SID_Read3 = $1C +SID_FltLo = $15 +SID_FltHi = $16 +SID_FltCtl = $17 +SID_Amp = $18 +SID_ADConv1 = $19 +SID_ADConv2 = $1A +SID_Noise = $1B +SID_Read3 = $1C ; I/O $db00: CIA 6526 Inter Process Communication @@ -178,5 +178,5 @@ SID_Read3 = $1C ; Out video memory address -COLOR_RAM = $D400 ; System bank +COLOR_RAM = $D400 ; System bank diff --git a/asminc/cbm610.inc b/asminc/cbm610.inc index 14bbb3d69..94256eeb1 100644 --- a/asminc/cbm610.inc +++ b/asminc/cbm610.inc @@ -9,8 +9,8 @@ ; --------------------------------------------------------------------------- ; Zeropage stuff -ExecReg = $00 -IndReg = $01 +ExecReg = $00 +IndReg = $01 ; --------------------------------------------------------------------------- ; Screen size @@ -25,13 +25,13 @@ YSIZE = 25 ; I/O $d800: CRTC 6545 .struct CRTC - ADDR .byte - DATA .byte + ADDR .byte + DATA .byte .endstruct ; I/O $db00: CIA 6526 Inter Process Communication ; -; IPCcia = $db00 +; IPCcia = $db00 .struct CIA PRA .byte @@ -65,13 +65,13 @@ YSIZE = 25 ; I/O $dc00: CIA 6526 ; -; cia = $dc00 +; cia = $dc00 ; I/O $dd00: ACIA 6551 ; -; acia = $dd00 +; acia = $dd00 .struct ACIA DATA .byte @@ -83,7 +83,7 @@ YSIZE = 25 ; I/O $de00: Triport #1 6525 ; -; tpi1 = $de00 +; tpi1 = $de00 .struct TPI PRA .byte @@ -105,6 +105,6 @@ YSIZE = 25 ; I/O $df00: Triport #2 6525 -; tpi2 = $df00 +; tpi2 = $df00 diff --git a/asminc/ctype.inc b/asminc/ctype.inc index 2e29c7293..d6b0ccf46 100644 --- a/asminc/ctype.inc +++ b/asminc/ctype.inc @@ -6,24 +6,24 @@ ; Make the __ctype table an exported/imported symbol - .global __ctype + .global __ctype ; Define bitmapped constants for the table entries CT_NONE = $00 ; Nothing special -CT_LOWER = $01 ; 0 - Lower case char -CT_UPPER = $02 ; 1 - Upper case char -CT_DIGIT = $04 ; 2 - Numeric digit -CT_XDIGIT = $08 ; 3 - Hex digit (both, lower and upper) -CT_CTRL = $10 ; 4 - Control character -CT_SPACE = $20 ; 5 - The space character itself -CT_OTHER_WS = $40 ; 6 - Other whitespace ('\f', '\n', '\r', '\t' and '\v') -CT_SPACE_TAB = $80 ; 7 - Space or tab character +CT_LOWER = $01 ; 0 - Lower case char +CT_UPPER = $02 ; 1 - Upper case char +CT_DIGIT = $04 ; 2 - Numeric digit +CT_XDIGIT = $08 ; 3 - Hex digit (both, lower and upper) +CT_CTRL = $10 ; 4 - Control character +CT_SPACE = $20 ; 5 - The space character itself +CT_OTHER_WS = $40 ; 6 - Other whitespace ('\f', '\n', '\r', '\t' and '\v') +CT_SPACE_TAB = $80 ; 7 - Space or tab character ; Combined stuff -CT_ALNUM = (CT_LOWER | CT_UPPER | CT_DIGIT) -CT_ALPHA = (CT_LOWER | CT_UPPER) -CT_CTRL_SPACE = (CT_CTRL | CT_SPACE) -CT_NOT_PUNCT = (CT_SPACE | CT_CTRL | CT_DIGIT | CT_UPPER | CT_LOWER) +CT_ALNUM = (CT_LOWER | CT_UPPER | CT_DIGIT) +CT_ALPHA = (CT_LOWER | CT_UPPER) +CT_CTRL_SPACE = (CT_CTRL | CT_SPACE) +CT_NOT_PUNCT = (CT_SPACE | CT_CTRL | CT_DIGIT | CT_UPPER | CT_LOWER) diff --git a/asminc/em-kernel.inc b/asminc/em-kernel.inc index e17b9c6be..1df969225 100644 --- a/asminc/em-kernel.inc +++ b/asminc/em-kernel.inc @@ -36,19 +36,19 @@ ;------------------------------------------------------------------------------ ; The driver header -.struct EMD_HDR - ID .byte 3 ; Contains 0x65, 0x6d, 0x64 ("emd") - VERSION .byte 1 ; Interface version - JUMPTAB .struct - INSTALL .word ; INSTALL routine - UNINSTALL .word ; UNINSTALL routine - PAGECOUNT .word ; PAGECOUNT routine - MAP .word ; MAP routine - USE .word ; USE routine - MAPCLEAN .word ; MAPCLEAN routine - COPYFROM .word ; COPYFROM routine - COPYTO .word ; COPYTO routine - .endstruct +.struct EMD_HDR + ID .byte 3 ; Contains 0x65, 0x6d, 0x64 ("emd") + VERSION .byte 1 ; Interface version + JUMPTAB .struct + INSTALL .word ; INSTALL routine + UNINSTALL .word ; UNINSTALL routine + PAGECOUNT .word ; PAGECOUNT routine + MAP .word ; MAP routine + USE .word ; USE routine + MAPCLEAN .word ; MAPCLEAN routine + COPYFROM .word ; COPYFROM routine + COPYTO .word ; COPYTO routine + .endstruct .endstruct ;------------------------------------------------------------------------------ @@ -59,18 +59,18 @@ EMD_API_VERSION = $00 ;------------------------------------------------------------------------------ ; The asm equivalent to the C em_copy structure -.struct EM_COPY - BUF .word ; Memory buffer to copy from or to - OFFS .byte ; Offset into page - PAGE .word ; Starting page to copy from or to - COUNT .word ; Number of bytes to copy - UNUSED .byte ; Make the size 8 bytes +.struct EM_COPY + BUF .word ; Memory buffer to copy from or to + OFFS .byte ; Offset into page + PAGE .word ; Starting page to copy from or to + COUNT .word ; Number of bytes to copy + UNUSED .byte ; Make the size 8 bytes .endstruct ;------------------------------------------------------------------------------ ; Variables - .global _em_drv ; Pointer to driver + .global _em_drv ; Pointer to driver ;------------------------------------------------------------------------------ ; Driver entry points @@ -81,25 +81,25 @@ EMD_API_VERSION = $00 .global emd_map .global emd_use .global emd_commit - .global emd_copyfrom + .global emd_copyfrom .global emd_copyto ;------------------------------------------------------------------------------ ; ASM functions - .global em_clear_ptr + .global em_clear_ptr ;------------------------------------------------------------------------------ ; C callable functions - .global _em_load_driver - .global _em_unload - .global _em_install - .global _em_uninstall - .global _em_pagecount - .global _em_map - .global _em_use - .global _em_commit - .global _em_copyfrom - .global _em_copyto + .global _em_load_driver + .global _em_unload + .global _em_install + .global _em_uninstall + .global _em_pagecount + .global _em_map + .global _em_use + .global _em_commit + .global _em_copyfrom + .global _em_copyto diff --git a/asminc/errno.inc b/asminc/errno.inc index 733671973..83cd9a75d 100644 --- a/asminc/errno.inc +++ b/asminc/errno.inc @@ -12,23 +12,23 @@ ; Error codes, must match the values in the C headers .enum EOK ; No error - ENOENT ; No such file or directory - ENOMEM ; Out of memory - EACCES ; Permission denied - ENODEV ; No such device - EMFILE ; Too many open files - EBUSY ; Device or resource busy - EINVAL ; Invalid argument - ENOSPC ; No space left on device - EEXIST ; File exists - EAGAIN ; Try again - EIO ; I/O error - EINTR ; Interrupted system call - ENOSYS ; Function not implemented - ESPIPE ; Illegal seek + ENOENT ; No such file or directory + ENOMEM ; Out of memory + EACCES ; Permission denied + ENODEV ; No such device + EMFILE ; Too many open files + EBUSY ; Device or resource busy + EINVAL ; Invalid argument + ENOSPC ; No space left on device + EEXIST ; File exists + EAGAIN ; Try again + EIO ; I/O error + EINTR ; Interrupted system call + ENOSYS ; Function not implemented + ESPIPE ; Illegal seek ERANGE ; Range error EBADF ; Bad file number - EUNKNOWN ; Unknown OS specific error - must be last! + EUNKNOWN ; Unknown OS specific error - must be last! EMAX = EUNKNOWN ; Highest error code .endenum diff --git a/asminc/fcntl.inc b/asminc/fcntl.inc index 49c11a9b5..5e6333d91 100644 --- a/asminc/fcntl.inc +++ b/asminc/fcntl.inc @@ -8,12 +8,12 @@ STDOUT_FILENO = 1 STDERR_FILENO = 2 ; File mode constants, must match the values in the C headers -O_RDONLY = $01 -O_WRONLY = $02 -O_RDWR = $03 -O_CREAT = $10 -O_TRUNC = $20 -O_APPEND = $40 +O_RDONLY = $01 +O_WRONLY = $02 +O_RDWR = $03 +O_CREAT = $10 +O_TRUNC = $20 +O_APPEND = $40 O_EXCL = $80 diff --git a/asminc/joy-kernel.inc b/asminc/joy-kernel.inc index 8f890f141..6c360dd43 100644 --- a/asminc/joy-kernel.inc +++ b/asminc/joy-kernel.inc @@ -40,16 +40,16 @@ ; Driver header stuff .struct JOY_HDR - ID .byte 3 ; $6A, $6F, $79 ("joy") - VERSION .byte 1 ; Interface version - MASKS .byte 8 ; Joystick state mask array - JUMPTAB .struct - INSTALL .word ; INSTALL routine - UNINSTALL .word ; UNINSTALL routine - COUNT .word ; COUNT routine - READ .word ; READ routine + ID .byte 3 ; $6A, $6F, $79 ("joy") + VERSION .byte 1 ; Interface version + MASKS .byte 8 ; Joystick state mask array + JUMPTAB .struct + INSTALL .word ; INSTALL routine + UNINSTALL .word ; UNINSTALL routine + COUNT .word ; COUNT routine + READ .word ; READ routine IRQ .word ; IRQ routine - .endstruct + .endstruct .endstruct ;------------------------------------------------------------------------------ @@ -60,7 +60,7 @@ JOY_API_VERSION = $01 ;------------------------------------------------------------------------------ ; Variables - .global _joy_drv ; Pointer to driver + .global _joy_drv ; Pointer to driver .global _joy_masks ;------------------------------------------------------------------------------ @@ -76,10 +76,10 @@ JOY_API_VERSION = $01 .global _joy_load_driver .global _joy_unload - .global _joy_install - .global _joy_uninstall - .global _joy_count - .global _joy_read + .global _joy_install + .global _joy_uninstall + .global _joy_count + .global _joy_read .global _joy_clear_ptr diff --git a/asminc/modload.inc b/asminc/modload.inc index 07c052c08..168dd679d 100644 --- a/asminc/modload.inc +++ b/asminc/modload.inc @@ -63,7 +63,7 @@ ; /* Free a loaded module. Note: The given pointer is the pointer to the ; * module memory, not a pointer to a control structure. ; */ -.global _mod_free +.global _mod_free ; Errors .enum diff --git a/asminc/mouse-kernel.inc b/asminc/mouse-kernel.inc index 91d84e06e..24a9f7632 100644 --- a/asminc/mouse-kernel.inc +++ b/asminc/mouse-kernel.inc @@ -2,7 +2,7 @@ ;/* */ ;/* mouse-kernel.inc */ ;/* */ -;/* Mouse API */ +;/* Mouse API */ ;/* */ ;/* */ ;/* */ @@ -53,23 +53,23 @@ ;------------------------------------------------------------------------------ ; The driver header -.struct MOUSE_HDR - ID .byte 3 ; Contains 0x6D, 0x6F, 0x75 ("mou") - VERSION .byte 1 ; Interface version - JUMPTAB .struct - INSTALL .addr - UNINSTALL .addr - HIDE .addr - SHOW .addr - SETBOX .addr - GETBOX .addr - MOVE .addr - BUTTONS .addr - POS .addr +.struct MOUSE_HDR + ID .byte 3 ; Contains 0x6D, 0x6F, 0x75 ("mou") + VERSION .byte 1 ; Interface version + JUMPTAB .struct + INSTALL .addr + UNINSTALL .addr + HIDE .addr + SHOW .addr + SETBOX .addr + GETBOX .addr + MOVE .addr + BUTTONS .addr + POS .addr INFO .addr IOCTL .addr - IRQ .addr - .endstruct + IRQ .addr + .endstruct FLAGS .byte ; Mouse driver flags CALLBACKS .struct ; Jump instructions .byte ; JMP opcode @@ -86,10 +86,10 @@ ;------------------------------------------------------------------------------ ; The mouse callback structure -.struct MOUSE_CALLBACKS - HIDE .addr ; Hide the mouse cursor - SHOW .addr ; Show the mouse cursor - MOVEX .addr ; Move the mouse cursor +.struct MOUSE_CALLBACKS + HIDE .addr ; Hide the mouse cursor + SHOW .addr ; Show the mouse cursor + MOVEX .addr ; Move the mouse cursor MOVEY .addr ; Dito for Y .endstruct @@ -112,7 +112,7 @@ MOUSE_FLAG_LATE_IRQ = $80 ; Enable IRQ *after* calling INSTALL ;------------------------------------------------------------------------------ ; Mouse button definitions -MOUSE_BTN_LEFT = $10 +MOUSE_BTN_LEFT = $10 MOUSE_BTN_RIGHT = $01 ;------------------------------------------------------------------------------ @@ -129,16 +129,16 @@ MOUSE_BTN_RIGHT = $01 .endstruct .struct MOUSE_BOX - MINX .word - MINY .word - MAXX .word - MAXY .word + MINX .word + MINY .word + MAXX .word + MAXY .word .endstruct ;------------------------------------------------------------------------------ ; Variables - .global _mouse_drv ; Pointer to driver + .global _mouse_drv ; Pointer to driver .global _mouse_hidden ; Counter, 0 = mouse is visible ;------------------------------------------------------------------------------ @@ -152,14 +152,14 @@ MOUSE_BTN_RIGHT = $01 .global _mouse_hide .global _mouse_show .global _mouse_setbox - .global _mouse_getbox + .global _mouse_getbox .global _mouse_move .global _mouse_buttons .global _mouse_pos .global _mouse_info .global _mouse_ioctl - .global _mouse_clear_ptr + .global _mouse_clear_ptr ;------------------------------------------------------------------------------ ; Driver entry points (asm callable) @@ -168,8 +168,8 @@ MOUSE_BTN_RIGHT = $01 .global mouse_uninstall .global mouse_hide .global mouse_show - .global mouse_setbox - .global mouse_getbox + .global mouse_setbox + .global mouse_getbox .global mouse_move .global mouse_buttons .global mouse_pos diff --git a/asminc/nes.inc b/asminc/nes.inc index 1ee5ebc8f..cc83d7cea 100644 --- a/asminc/nes.inc +++ b/asminc/nes.inc @@ -5,17 +5,17 @@ ;; FIXME: optimize zeropage usage -SCREEN_PTR = $62 ;2 +SCREEN_PTR = $62 ;2 CRAM_PTR = $64 ;2 -CHARCOLOR = $66 -BGCOLOR = $67 -RVS = $68 -CURS_X = $69 -CURS_Y = $6a +CHARCOLOR = $66 +BGCOLOR = $67 +RVS = $68 +CURS_X = $69 +CURS_Y = $6a tickcount = $6b ;2 -VBLANK_FLAG = $70 +VBLANK_FLAG = $70 ringbuff = $0200 ringwrite = $71 @@ -26,20 +26,20 @@ ppuhi = $74 ppulo = $75 ppuval = $76 -screenrows = (30-1) +screenrows = (30-1) charsperline = 32 xsize = charsperline ;; PPU defines -PPU_CTRL1 = $2000 -PPU_CTRL2 = $2001 -PPU_STATUS = $2002 -PPU_SPR_ADDR = $2003 -PPU_SPR_IO = $2004 -PPU_VRAM_ADDR1 = $2005 -PPU_VRAM_ADDR2 = $2006 -PPU_VRAM_IO = $2007 +PPU_CTRL1 = $2000 +PPU_CTRL2 = $2001 +PPU_STATUS = $2002 +PPU_SPR_ADDR = $2003 +PPU_SPR_IO = $2004 +PPU_VRAM_ADDR1 = $2005 +PPU_VRAM_ADDR2 = $2006 +PPU_VRAM_IO = $2007 ;; APU defines @@ -63,30 +63,30 @@ APU_MODCTRL = $4010 ; Delta Modulation Control Register (W) APU_MODDA = $4011 ; Delta Modulation D/A Register (W) APU_MODADDR = $4012 ; Delta Modulation Address Register (W) APU_MODLEN = $4013 ; Delta Modulation Data Length Register (W) -APU_SPR_DMA = $4014 ; Sprite DMA Register (W) -APU_CHANCTRL = $4015 ; Sound/Vertical Clock Signal Register (R) -APU_PAD1 = $4016 ; Joypad #1 (RW) -APU_PAD2 = $4017 ; Joypad #2/SOFTCLK (RW) +APU_SPR_DMA = $4014 ; Sprite DMA Register (W) +APU_CHANCTRL = $4015 ; Sound/Vertical Clock Signal Register (R) +APU_PAD1 = $4016 ; Joypad #1 (RW) +APU_PAD2 = $4017 ; Joypad #2/SOFTCLK (RW) -CH_HLINE = 11 -CH_VLINE = 14 -CH_ULCORNER = 176 -CH_URCORNER = 174 -CH_LLCORNER = 173 -CH_LRCORNER = 189 -CH_TTEE = 178 -CH_RTEE = 179 -CH_BTEE = 177 -CH_LTEE = 171 -CH_CROSS = 123 -CH_CURS_UP = 145 -CH_CURS_DOWN = 17 -CH_CURS_LEFT = 157 -CH_CURS_RIGHT = 29 -CH_PI = 126 -CH_DEL = 20 -CH_INS = 148 +CH_HLINE = 11 +CH_VLINE = 14 +CH_ULCORNER = 176 +CH_URCORNER = 174 +CH_LLCORNER = 173 +CH_LRCORNER = 189 +CH_TTEE = 178 +CH_RTEE = 179 +CH_BTEE = 177 +CH_LTEE = 171 +CH_CROSS = 123 +CH_CURS_UP = 145 +CH_CURS_DOWN = 17 +CH_CURS_LEFT = 157 +CH_CURS_RIGHT = 29 +CH_PI = 126 +CH_DEL = 20 +CH_INS = 148 CH_ENTER = 10 CH_STOP = 3 CH_ESC = 27 diff --git a/asminc/o65.inc b/asminc/o65.inc index 5bdbe05cb..6e0caa76b 100644 --- a/asminc/o65.inc +++ b/asminc/o65.inc @@ -1,8 +1,8 @@ ;*****************************************************************************/ ;* */ -;* o65.inc */ +;* o65.inc */ ;* */ -;* Definitions for the o65 file format */ +;* Definitions for the o65 file format */ ;* */ ;* */ ;* */ @@ -64,7 +64,7 @@ O65_MAGIC_2 = $35 ; '5' O65_VERSION = $00 ; Defines for the mode word -O65_CPU_65816 = $8000 ; Executable is for 65816 +O65_CPU_65816 = $8000 ; Executable is for 65816 O65_CPU_6502 = $0000 ; Executable is for the 6502 O65_CPU_MASK = $8000 ; Mask to extract CPU type @@ -91,7 +91,7 @@ O65_BSSZERO = $0200 ; BSS segment must be zeroed O65_BSSZERO_MASK = $0200 ; Mask to extract bss zero flag ; The following is used if O65_CPU == 6502 -O65_CPU2_6502 = $0000 ; Executable is for 6502 +O65_CPU2_6502 = $0000 ; Executable is for 6502 O65_CPU2_65C02 = $0010 ; Executable is for 65C02 O65_CPU2_65SC02 = $0020 ; Executable is for 65SC02 O65_CPU2_65CE02 = $0030 ; Executable is for 65CE02 @@ -127,14 +127,14 @@ O65_SEGID_MASK = $07 ; Option tags O65_OPT_FILENAME = 0 -O65_OPT_OS = 1 -O65_OPT_ASM = 2 -O65_OPT_AUTHOR = 3 -O65_OPT_TIMESTAMP = 4 +O65_OPT_OS = 1 +O65_OPT_ASM = 2 +O65_OPT_AUTHOR = 3 +O65_OPT_TIMESTAMP = 4 ; Operating system codes for O65_OPT_OS -O65_OS_OSA65 = 1 -O65_OS_LUNIX = 2 +O65_OS_OSA65 = 1 +O65_OS_LUNIX = 2 O65_OS_CC65 = 3 O65_OS_OPENCBM = 4 diff --git a/asminc/pet.inc b/asminc/pet.inc index 1950046cc..a3dadf48d 100644 --- a/asminc/pet.inc +++ b/asminc/pet.inc @@ -6,25 +6,25 @@ ; --------------------------------------------------------------------------- ; Zero page, Commodore stuff -MEMSIZE := $34 ; Size of memory installed +MEMSIZE := $34 ; Size of memory installed TIME := $8D ; 60HZ clock -KEY_COUNT := $9E ; Number of keys in input buffer -RVS := $9F ; Reverse flag -CURS_FLAG := $A7 ; 1 = cursor off -CURS_BLINK := $A8 ; Blink counter -CURS_CHAR := $A9 ; Character under the cursor -CURS_STATE := $AA ; Cursor blink state -SCREEN_PTR := $C4 ; Pointer to current char in text screen -CURS_X := $C6 ; Cursor column +KEY_COUNT := $9E ; Number of keys in input buffer +RVS := $9F ; Reverse flag +CURS_FLAG := $A7 ; 1 = cursor off +CURS_BLINK := $A8 ; Blink counter +CURS_CHAR := $A9 ; Character under the cursor +CURS_STATE := $AA ; Cursor blink state +SCREEN_PTR := $C4 ; Pointer to current char in text screen +CURS_X := $C6 ; Cursor column FNLEN := $D1 ; Length of filename LFN := $D2 ; Current Logical File Number -SECADR := $D3 ; Secondary address -DEVNUM := $D4 ; Device number -SCR_LINELEN := $D5 ; Screen line length -CURS_Y := $D8 ; Cursor row +SECADR := $D3 ; Secondary address +DEVNUM := $D4 ; Device number +SCR_LINELEN := $D5 ; Screen line length +CURS_Y := $D8 ; Cursor row FNADR := $DA ; Pointer to file name -KEY_BUF := $26F ; Keyboard buffer +KEY_BUF := $26F ; Keyboard buffer ;---------------------------------------------------------------------------- ; PET ROM type detection @@ -38,17 +38,17 @@ PET_4000 = $FD ;---------------------------------------------------------------------------- ; Vector and other locations -IRQVec := $0090 -BRKVec := $0092 -NMIVec := $0094 +IRQVec := $0090 +BRKVec := $0092 +NMIVec := $0094 ; --------------------------------------------------------------------------- ; I/O: 6522 VIA2 -VIA := $E840 +VIA := $E840 VIA_PRB := $E840 VIA_PRA := $E841 -VIA_DDRB := $E842 -VIA_DDRA := $E843 +VIA_DDRB := $E842 +VIA_DDRA := $E843 diff --git a/asminc/plus4.inc b/asminc/plus4.inc index 8d07731b2..014c18e60 100644 --- a/asminc/plus4.inc +++ b/asminc/plus4.inc @@ -8,41 +8,41 @@ TMPPTR := $22 ; Temporary ptr used by BASIC TIME := $A3 ; 60HZ clock -FNAM_LEN := $AB ; Length of filename +FNAM_LEN := $AB ; Length of filename LFN := $AC ; Logical file number -SECADR := $AD ; Secondary address -DEVNUM := $AE ; Device number +SECADR := $AD ; Secondary address +DEVNUM := $AE ; Device number FNAM := $AF ; Pointer to filename for OPEN -KEY_COUNT := $EF ; Number of keys in input buffer +KEY_COUNT := $EF ; Number of keys in input buffer RVS := $C2 ; Reverse flag -CURS_X := $CA ; Cursor column -CURS_Y := $CD ; Cursor row -SCREEN_PTR := $C8 ; Pointer to current char in text screen -CRAM_PTR := $EA ; Pointer to current char in color RAM +CURS_X := $CA ; Cursor column +CURS_Y := $CD ; Cursor row +SCREEN_PTR := $C8 ; Pointer to current char in text screen +CRAM_PTR := $EA ; Pointer to current char in color RAM -BASIC_BUF := $200 ; Location of command-line -BASIC_BUF_LEN = 89 ; Maximum length of command-line +BASIC_BUF := $200 ; Location of command-line +BASIC_BUF_LEN = 89 ; Maximum length of command-line -FNBUF := $25E ; Buffer for filename +FNBUF := $25E ; Buffer for filename FETCH := $494 ; lda (zp),y from RAM CHARCOLOR := $53B -FKEY_COUNT := $55D ; Characters for function key -FKEY_SPACE := $55F ; Function key definitions -FKEY_ORIG := $F3D2 ; Original definitions +FKEY_COUNT := $55D ; Characters for function key +FKEY_SPACE := $55F ; Function key definitions +FKEY_ORIG := $F3D2 ; Original definitions ; --------------------------------------------------------------------------- ; Kernal routines ; Direct entries -CLRSCR := $D88B -KBDREAD := $D8C1 +CLRSCR := $D88B +KBDREAD := $D8C1 ; --------------------------------------------------------------------------- ; Vector and other locations -IRQVec := $0314 -BRKVec := $0316 -NMIVec := $0318 +IRQVec := $0314 +BRKVec := $0316 +NMIVec := $0318 ; --------------------------------------------------------------------------- ; Screen size @@ -53,29 +53,29 @@ YSIZE = 25 ; --------------------------------------------------------------------------- ; I/O -TED_T1LO := $FF00 -TED_T1HI := $FF01 -TED_T2LO := $FF02 -TED_T2HI := $FF03 -TED_T3LO := $FF04 -TED_T4HI := $FF05 +TED_T1LO := $FF00 +TED_T1HI := $FF01 +TED_T2LO := $FF02 +TED_T2HI := $FF03 +TED_T3LO := $FF04 +TED_T4HI := $FF05 TED_MULTI1 := $FF07 -TED_KBD := $FF08 -TED_CURSHI := $FF0C -TED_CURSLO := $FF0D -TED_V1FRQLO := $FF0E -TED_V2FRQLO := $FF0F -TED_V2FRQHI := $FF10 -TED_BGCOLOR := $FF15 -TED_COLOR1 := $FF16 -TED_COLOR2 := $FF17 -TED_COLOR3 := $FF18 -TED_BORDERCOLOR := $FF19 -TED_VLINEHI := $FF1C -TED_VLINELO := $FF1D -TED_HPOS := $FF1E -TED_ROMSEL := $FF3E -TED_RAMSEL := $FF3F +TED_KBD := $FF08 +TED_CURSHI := $FF0C +TED_CURSLO := $FF0D +TED_V1FRQLO := $FF0E +TED_V2FRQLO := $FF0F +TED_V2FRQHI := $FF10 +TED_BGCOLOR := $FF15 +TED_COLOR1 := $FF16 +TED_COLOR2 := $FF17 +TED_COLOR3 := $FF18 +TED_BORDERCOLOR := $FF19 +TED_VLINEHI := $FF1C +TED_VLINELO := $FF1D +TED_HPOS := $FF1E +TED_ROMSEL := $FF3E +TED_RAMSEL := $FF3F ; --------------------------------------------------------------------------- ; RAM/ROM selection addresses diff --git a/asminc/ser-kernel.inc b/asminc/ser-kernel.inc index c8eab707a..7fc5bf9c2 100644 --- a/asminc/ser-kernel.inc +++ b/asminc/ser-kernel.inc @@ -48,7 +48,7 @@ PUT .word ; PUT routine STATUS .word ; STATUS routine IOCTL .word ; IOCTL routine - IRQ .word ; IRQ routine + IRQ .word ; IRQ routine .endstruct .endstruct @@ -74,44 +74,44 @@ SER_API_VERSION = $00 ; Baudrate SER_BAUD_45_5 = $00 -SER_BAUD_50 = $01 +SER_BAUD_50 = $01 SER_BAUD_75 = $02 -SER_BAUD_110 = $03 -SER_BAUD_134_5 = $04 +SER_BAUD_110 = $03 +SER_BAUD_134_5 = $04 SER_BAUD_150 = $05 -SER_BAUD_300 = $06 -SER_BAUD_600 = $07 -SER_BAUD_1200 = $08 +SER_BAUD_300 = $06 +SER_BAUD_600 = $07 +SER_BAUD_1200 = $08 SER_BAUD_1800 = $09 -SER_BAUD_2400 = $0A +SER_BAUD_2400 = $0A SER_BAUD_3600 = $0B -SER_BAUD_4800 = $0C +SER_BAUD_4800 = $0C SER_BAUD_7200 = $0D -SER_BAUD_9600 = $0E -SER_BAUD_19200 = $0F -SER_BAUD_38400 = $10 -SER_BAUD_57600 = $11 -SER_BAUD_115200 = $12 -SER_BAUD_230400 = $13 -SER_BAUD_31250 = $14 -SER_BAUD_62500 = $15 +SER_BAUD_9600 = $0E +SER_BAUD_19200 = $0F +SER_BAUD_38400 = $10 +SER_BAUD_57600 = $11 +SER_BAUD_115200 = $12 +SER_BAUD_230400 = $13 +SER_BAUD_31250 = $14 +SER_BAUD_62500 = $15 ; Data bit settings -SER_BITS_5 = $00 -SER_BITS_6 = $01 -SER_BITS_7 = $02 -SER_BITS_8 = $03 +SER_BITS_5 = $00 +SER_BITS_6 = $01 +SER_BITS_7 = $02 +SER_BITS_8 = $03 ; Stop bit settings -SER_STOP_1 = $00 -SER_STOP_2 = $01 +SER_STOP_1 = $00 +SER_STOP_2 = $01 ; Parity -SER_PAR_NONE = $00 -SER_PAR_ODD = $01 -SER_PAR_EVEN = $02 -SER_PAR_MARK = $03 -SER_PAR_SPACE = $04 +SER_PAR_NONE = $00 +SER_PAR_ODD = $01 +SER_PAR_EVEN = $02 +SER_PAR_MARK = $03 +SER_PAR_SPACE = $04 ; Handshake SER_HS_NONE = $00 ; No handshake @@ -119,16 +119,16 @@ SER_HS_HW = $01 ; Hardware (RTS/CTS) handshake SER_HS_SW = $02 ; Software handshake ; Bit masks to mask out things from the status returned by ser_status -SER_STATUS_PE = $01 ; Parity error -SER_STATUS_FE = $02 ; Framing error -SER_STATUS_OE = $04 ; Overrun error -SER_STATUS_DCD = $20 ; NOT data carrier detect -SER_STATUS_DSR = $40 ; NOT data set ready +SER_STATUS_PE = $01 ; Parity error +SER_STATUS_FE = $02 ; Framing error +SER_STATUS_OE = $04 ; Overrun error +SER_STATUS_DCD = $20 ; NOT data carrier detect +SER_STATUS_DSR = $40 ; NOT data set ready ;------------------------------------------------------------------------------ ; Variables - .global _ser_drv ; Pointer to driver + .global _ser_drv ; Pointer to driver ;------------------------------------------------------------------------------ ; Driver entry points @@ -141,7 +141,7 @@ SER_STATUS_DSR = $40 ; NOT data set ready .global ser_put .global ser_status .global ser_ioctl - .global ser_irq + .global ser_irq ;------------------------------------------------------------------------------ ; C callable functions diff --git a/asminc/smc.inc b/asminc/smc.inc index ef710a30e..383417c3d 100644 --- a/asminc/smc.inc +++ b/asminc/smc.inc @@ -21,12 +21,12 @@ ; distribution. ; -.define _SMCDesignator .mid(0, .tcount(label) - 1, label) .ident(.concat(.string(.right(1, label)), "_SMC")) -.define _SMCAlias .mid(0, .tcount(alias) - 1, alias) .ident(.concat(.string(.right(1, alias)), "_SMC")) +.define _SMCDesignator .mid(0, .tcount(label) - 1, label) .ident(.concat(.string(.right(1, label)), "_SMC")) +.define _SMCAlias .mid(0, .tcount(alias) - 1, alias) .ident(.concat(.string(.right(1, alias)), "_SMC")) .define SMC_AbsAdr $FADE -.define SMC_ZpAdr $00 +.define SMC_ZpAdr $00 .define SMC_Opcode nop -.define SMC_Value $42 +.define SMC_Value $42 .macro SMC_OperateOnValue opcode, label opcode _SMCDesignator+1 @@ -48,86 +48,86 @@ .export _SMCAlias := _SMCDesignator .endmacro -.macro SMC label, statement +.macro SMC label, statement _SMCDesignator: statement .endmacro .macro SMC_TransferOpcode label, opcode, register .if .paramcount = 2 .or .match ({register}, a) - lda #opcode - sta _SMCDesignator + lda #opcode + sta _SMCDesignator .elseif .match ({register}, x) - ldx #opcode - stx _SMCDesignator + ldx #opcode + stx _SMCDesignator .elseif .match ({register}, y) - ldy #opcode - sty _SMCDesignator + ldy #opcode + sty _SMCDesignator .endif .endmacro .macro SMC_LoadOpcode label, register .if .paramcount = 1 .or .match ({register}, a) - lda _SMCDesignator + lda _SMCDesignator .elseif .match ({register}, x) - ldx _SMCDesignator + ldx _SMCDesignator .elseif .match ({register}, y) - ldy _SMCDesignator + ldy _SMCDesignator .endif .endmacro .macro SMC_StoreOpcode label, register .if .paramcount = 1 .or .match ({register}, a) - sta _SMCDesignator + sta _SMCDesignator .elseif .match ({register}, x) - stx _SMCDesignator + stx _SMCDesignator .elseif .match ({register}, y) - sty _SMCDesignator + sty _SMCDesignator .endif .endmacro .macro SMC_ChangeBranch label, destination, register .if .paramcount = 2 .or .match ({register}, a) - lda #(destination - _SMCDesignator -2) - sta _SMCDesignator+1 + lda #(destination - _SMCDesignator -2) + sta _SMCDesignator+1 .elseif .match ({register}, x) - ldx #(destination - _SMCDesignator - 2) - stx _SMCDesignator+1 + ldx #(destination - _SMCDesignator - 2) + stx _SMCDesignator+1 .elseif .match ({register}, y) - ldy #(destination - _SMCDesignator - 2) - sty _SMCDesignator+1 + ldy #(destination - _SMCDesignator - 2) + sty _SMCDesignator+1 .endif .endmacro .macro SMC_TransferValue label, value, register .if .paramcount = 2 .or .match ({register}, a) - lda value - sta _SMCDesignator+1 + lda value + sta _SMCDesignator+1 .elseif .match ({register}, x) - ldx value - stx _SMCDesignator+1 + ldx value + stx _SMCDesignator+1 .elseif .match ({register}, y) - ldy value - sty _SMCDesignator+1 + ldy value + sty _SMCDesignator+1 .endif .endmacro .macro SMC_LoadValue label, register .if .paramcount = 1 .or .match ({register}, a) - lda _SMCDesignator+1 + lda _SMCDesignator+1 .elseif .match ({register}, x) - ldx _SMCDesignator+1 + ldx _SMCDesignator+1 .elseif .match ({register}, y) - ldy _SMCDesignator+1 + ldy _SMCDesignator+1 .endif .endmacro .macro SMC_StoreValue label, register .if .paramcount = 1 .or .match ({register}, a) - sta _SMCDesignator+1 + sta _SMCDesignator+1 .elseif .match ({register}, x) - stx _SMCDesignator+1 + stx _SMCDesignator+1 .elseif .match ({register}, y) - sty _SMCDesignator+1 + sty _SMCDesignator+1 .endif .endmacro @@ -146,49 +146,48 @@ SMC_StoreValue label, register .macro SMC_TransferHighByte label, value, register .if .paramcount = 2 .or .match ({register}, a) - lda value - sta _SMCDesignator+2 + lda value + sta _SMCDesignator+2 .elseif .match ({register}, x) - ldx value - stx _SMCDesignator+2 + ldx value + stx _SMCDesignator+2 .elseif .match ({register}, y) - ldy value - sty _SMCDesignator+2 + ldy value + sty _SMCDesignator+2 .endif .endmacro .macro SMC_LoadHighByte label, register .if .paramcount = 1 .or .match ({register}, a) - lda _SMCDesignator+2 + lda _SMCDesignator+2 .elseif .match ({register}, x) - ldx _SMCDesignator+2 + ldx _SMCDesignator+2 .elseif .match ({register}, y) - ldy _SMCDesignator+2 + ldy _SMCDesignator+2 .endif .endmacro .macro SMC_StoreHighByte label, register .if .paramcount = 1 .or .match ({register}, a) - sta _SMCDesignator+2 + sta _SMCDesignator+2 .elseif .match ({register}, x) - stx _SMCDesignator+2 + stx _SMCDesignator+2 .elseif .match ({register}, y) - sty _SMCDesignator+2 + sty _SMCDesignator+2 .endif .endmacro - .macro SMC_TransferAddressSingle label, address, register .if .paramcount = 2 .or .match ((register), a) .if (.match (.left (1, {address}), #)) ; immediate mode - lda #<(.right (.tcount ({address})-1, {address})) + lda #<(.right (.tcount ({address})-1, {address})) sta _SMCDesignator+1 - lda #>(.right (.tcount ({address})-1, {address})) + lda #>(.right (.tcount ({address})-1, {address})) sta _SMCDesignator+2 - .else - ; assume absolute or zero page - lda address + .else + ; assume absolute or zero page + lda address sta _SMCDesignator+1 lda 1+(address) sta _SMCDesignator+2 @@ -196,13 +195,13 @@ SMC_StoreValue label, register .elseif .match ((register), x) .if (.match (.left (1, {address}), #)) ; immediate mode - ldx #<(.right (.tcount ({address})-1, {address})) + ldx #<(.right (.tcount ({address})-1, {address})) stx _SMCDesignator+1 - ldx #>(.right (.tcount ({address})-1, {address})) + ldx #>(.right (.tcount ({address})-1, {address})) stx _SMCDesignator+2 - .else - ; assume absolute or zero page - ldx address + .else + ; assume absolute or zero page + ldx address stx _SMCDesignator+1 ldx 1+(address) stx _SMCDesignator+2 @@ -210,13 +209,13 @@ SMC_StoreValue label, register .elseif .match ((register), y) .if (.match (.left (1, {address}), #)) ; immediate mode - ldy #<(.right (.tcount ({address})-1, {address})) + ldy #<(.right (.tcount ({address})-1, {address})) sty _SMCDesignator+1 - ldy #>(.right (.tcount ({address})-1, {address})) + ldy #>(.right (.tcount ({address})-1, {address})) sty _SMCDesignator+2 - .else - ; assume absolute or zero page - ldy address + .else + ; assume absolute or zero page + ldy address sty _SMCDesignator+1 ldy 1+(address) sty _SMCDesignator+2 @@ -224,17 +223,16 @@ SMC_StoreValue label, register .endif .endmacro - .macro SMC_TransferAddress label, address .if (.match (.left (1, {address}), #)) ; immediate mode - lda #<(.right (.tcount ({address})-1, {address})) + lda #<(.right (.tcount ({address})-1, {address})) sta _SMCDesignator+1 ldx #>(.right (.tcount ({address})-1, {address})) stx _SMCDesignator+2 .else ; assume absolute or zero page - lda {address} + lda {address} sta _SMCDesignator+1 ldx 1+{address} stx _SMCDesignator)+2 @@ -242,8 +240,6 @@ SMC_StoreValue label, register .endmacro .macro SMC_StoreAddress label - sta _SMCDesignator+1 - stx _SMCDesignator+2 + sta _SMCDesignator+1 + stx _SMCDesignator+2 .endmacro - - diff --git a/asminc/stdio.inc b/asminc/stdio.inc index ab9d86d2c..fc75238cf 100644 --- a/asminc/stdio.inc +++ b/asminc/stdio.inc @@ -36,25 +36,25 @@ ;---------------------------------------------------------------------------- ; Constants -_IOFBF = 0 -_IOLBF = 1 -_IONBF = 2 -BUFSIZ = 256 -EOF = -1 +_IOFBF = 0 +_IOLBF = 1 +_IONBF = 2 +BUFSIZ = 256 +EOF = -1 .if .defined(__APPLE2__) .or .defined(__APPLE2ENH__) -FILENAME_MAX = 64+1 +FILENAME_MAX = 64+1 .elseif .defined(__ATARI__) -FILENAME_MAX = 12+1 +FILENAME_MAX = 12+1 .elseif .defined(__LUNIX__) FILENAME_MAX = 80+1 .else -FILENAME_MAX = 16+1 +FILENAME_MAX = 16+1 .endif -L_tmpnam = FILENAME_MAX -SEEK_CUR = 0 -SEEK_END = 1 -SEEK_SET = 2 -TMP_MAX = 256 +L_tmpnam = FILENAME_MAX +SEEK_CUR = 0 +SEEK_END = 1 +SEEK_SET = 2 +TMP_MAX = 256 ; Maximum number of open files (size of the file table) FOPEN_MAX = 8 diff --git a/asminc/tgi-error.inc b/asminc/tgi-error.inc index 0e026ee1b..a4559bb2a 100644 --- a/asminc/tgi-error.inc +++ b/asminc/tgi-error.inc @@ -41,7 +41,7 @@ TGI_ERR_INV_DRIVER ; Invalid driver TGI_ERR_INV_MODE ; Mode not supported by driver TGI_ERR_INV_ARG ; Invalid function argument - TGI_ERR_INV_FUNC ; Function not supported + TGI_ERR_INV_FUNC ; Function not supported TGI_ERR_INV_FONT ; Font file is invalid TGI_ERR_NO_RES ; Out of resources (memory, handles, ...) TGI_ERR_UNKNOWN ; Unknown error diff --git a/asminc/tgi-kernel.inc b/asminc/tgi-kernel.inc index 9061fe9af..c1182d371 100644 --- a/asminc/tgi-kernel.inc +++ b/asminc/tgi-kernel.inc @@ -54,7 +54,7 @@ UNINSTALL .addr ; UNINSTALL routine INIT .addr ; INIT routine DONE .addr ; DONE routine - GETERROR .addr ; GETERROR routine + GETERROR .addr ; GETERROR routine CONTROL .addr ; CONTROL routine CLEAR .addr ; CLEAR routine SETVIEWPAGE .addr ; SETVIEWPAGE routine @@ -106,14 +106,14 @@ TGI_CLIP_TOP = $08 ;------------------------------------------------------------------------------ ; ASM accessible color constants - .global tgi_color_black:zp ; Target-specific value for black - .global tgi_color_white:zp ; Target-specific value for white + .global tgi_color_black:zp ; Target-specific value for black + .global tgi_color_white:zp ; Target-specific value for white ;------------------------------------------------------------------------------ ; C accessible variables - .global _tgi_drv ; Pointer to driver - .global _tgi_error ; Last error code + .global _tgi_drv ; Pointer to driver + .global _tgi_error ; Last error code .global _tgi_gmode ; Flag: graphics mode active .global _tgi_curx ; Current drawing cursor X .global _tgi_cury ; Current drawing cursor Y @@ -139,10 +139,10 @@ TGI_CLIP_TOP = $08 ;------------------------------------------------------------------------------ ; ASM accessible variables - .global tgi_clip_x1 ; Coordinate for line clipper - .global tgi_clip_y1 ; Coordinate for line clipper - .global tgi_clip_x2 ; Coordinate for line clipper - .global tgi_clip_y2 ; Coordinate for line clipper + .global tgi_clip_x1 ; Coordinate for line clipper + .global tgi_clip_y1 ; Coordinate for line clipper + .global tgi_clip_x2 ; Coordinate for line clipper + .global tgi_clip_y2 ; Coordinate for line clipper ;------------------------------------------------------------------------------ ; Driver entry points @@ -151,7 +151,7 @@ TGI_CLIP_TOP = $08 .global tgi_uninstall .global tgi_init .global tgi_done - .global tgi_geterror + .global tgi_geterror .global tgi_control .global tgi_clear .global tgi_setviewpage @@ -192,7 +192,7 @@ TGI_CLIP_TOP = $08 .global _tgi_clear .global _tgi_done .global _tgi_ellipse - .global _tgi_getaspectratio + .global _tgi_getaspectratio .global _tgi_getcolor .global _tgi_getcolorcount .global _tgi_getdefpalette @@ -220,7 +220,7 @@ TGI_CLIP_TOP = $08 .global _tgi_outtext .global _tgi_outtextxy .global _tgi_pieslice - .global _tgi_setaspectratio + .global _tgi_setaspectratio .global _tgi_setcolor .global _tgi_setdrawpage .global _tgi_setpalette diff --git a/asminc/time.inc b/asminc/time.inc index dcc4877aa..16858471d 100644 --- a/asminc/time.inc +++ b/asminc/time.inc @@ -2,7 +2,7 @@ ;/* */ ;/* time.inc */ ;/* */ -;/* Date and time */ +;/* Date and time */ ;/* */ ;/* */ ;/* */ diff --git a/asminc/vic20.inc b/asminc/vic20.inc index 3331b95f6..6780d067d 100644 --- a/asminc/vic20.inc +++ b/asminc/vic20.inc @@ -7,26 +7,26 @@ ; Zero page, Commodore stuff TIME := $A0 ; 60HZ clock -FNAM_LEN := $B7 ; Length of filename -SECADR := $B9 ; Secondary address -DEVNUM := $BA ; Device number +FNAM_LEN := $B7 ; Length of filename +SECADR := $B9 ; Secondary address +DEVNUM := $BA ; Device number FNAM := $BB ; Pointer to filename -KEY_COUNT := $C6 ; Number of keys in input buffer -RVS := $C7 ; Reverse flag -CURS_FLAG := $CC ; 1 = cursor off -CURS_BLINK := $CD ; Blink counter -CURS_CHAR := $CE ; Character under the cursor -CURS_STATE := $CF ; Cursor blink state -SCREEN_PTR := $D1 ; Pointer to current char in text screen -CURS_X := $D3 ; Cursor column -CURS_Y := $D6 ; Cursor row -CRAM_PTR := $F3 ; Pointer to current char in color RAM +KEY_COUNT := $C6 ; Number of keys in input buffer +RVS := $C7 ; Reverse flag +CURS_FLAG := $CC ; 1 = cursor off +CURS_BLINK := $CD ; Blink counter +CURS_CHAR := $CE ; Character under the cursor +CURS_STATE := $CF ; Cursor blink state +SCREEN_PTR := $D1 ; Pointer to current char in text screen +CURS_X := $D3 ; Cursor column +CURS_Y := $D6 ; Cursor row +CRAM_PTR := $F3 ; Pointer to current char in color RAM -BASIC_BUF := $200 ; Location of command-line -BASIC_BUF_LEN = 89 ; Maximum length of command-line +BASIC_BUF := $200 ; Location of command-line +BASIC_BUF_LEN = 89 ; Maximum length of command-line CHARCOLOR := $286 -CURS_COLOR := $287 ; Color under the cursor +CURS_COLOR := $287 ; Color under the cursor ; --------------------------------------------------------------------------- @@ -39,37 +39,37 @@ YSIZE = 23 ; Kernal routines ; Direct entries -CLRSCR := $E55F -KBDREAD := $E5CF +CLRSCR := $E55F +KBDREAD := $E5CF ; --------------------------------------------------------------------------- ; Vector and other locations -IRQVec := $0314 -BRKVec := $0316 -NMIVec := $0318 +IRQVec := $0314 +BRKVec := $0316 +NMIVec := $0318 ; --------------------------------------------------------------------------- ; I/O: 6560 VIC -VIC := $9000 +VIC := $9000 VIC_LINES := $9003 ; Screen lines, bit 7 is bit 0 from VIC_HLINE VIC_HLINE := $9004 ; Rasterline, bits 1-8 -VIC_COLOR := $900F ; Border and background color +VIC_COLOR := $900F ; Border and background color ; --------------------------------------------------------------------------- ; I/O: 6522 VIA1 -VIA1 := $9110 -VIA1_JOY := $9111 -VIA1_DDRB := $9112 -VIA1_DDRA := $9113 +VIA1 := $9110 +VIA1_JOY := $9111 +VIA1_DDRB := $9112 +VIA1_DDRA := $9113 ; --------------------------------------------------------------------------- ; I/O: 6522 VIA2 -VIA2 := $9120 -VIA2_JOY := $9120 -VIA2_DDRB := $9122 -VIA2_DDRA := $9123 +VIA2 := $9120 +VIA2_JOY := $9120 +VIA2_DDRB := $9122 +VIA2_DDRA := $9123 diff --git a/include/6502.h b/include/6502.h index 99014ffb5..706418516 100644 --- a/include/6502.h +++ b/include/6502.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* 6502.h */ +/* 6502.h */ /* */ -/* 6502 specific declarations */ +/* 6502 specific declarations */ /* */ /* */ /* */ @@ -47,9 +47,9 @@ typedef unsigned size_t; /* Possible returns of getcpu() */ -#define CPU_6502 0 -#define CPU_65C02 1 -#define CPU_65816 2 +#define CPU_6502 0 +#define CPU_65C02 1 +#define CPU_65816 2 unsigned char getcpu (void); /* Detect the CPU the program is running on */ @@ -57,29 +57,29 @@ unsigned char getcpu (void); /* Macros for CPU instructions */ -#define BRK() __asm__ ("brk") -#define CLI() __asm__ ("cli") -#define SEI() __asm__ ("sei") +#define BRK() __asm__ ("brk") +#define CLI() __asm__ ("cli") +#define SEI() __asm__ ("sei") /* Struct that holds the registers for the sys function */ struct regs { - unsigned char a; /* A register value */ - unsigned char x; /* X register value */ - unsigned char y; /* Y register value */ - unsigned char flags; /* Flags value */ - unsigned pc; /* Program counter */ + unsigned char a; /* A register value */ + unsigned char x; /* X register value */ + unsigned char y; /* Y register value */ + unsigned char flags; /* Flags value */ + unsigned pc; /* Program counter */ }; /* Defines for the flags in the regs structure */ -#define F6502_N 0x80 /* N flag */ -#define F6502_V 0x40 /* V flag */ -#define F6502_B 0x10 /* B flag */ -#define F6502_D 0x08 /* D flag */ -#define F6502_I 0x04 /* I flag */ -#define F6502_Z 0x02 /* Z flag */ -#define F6502_C 0x01 /* C flag */ +#define F6502_N 0x80 /* N flag */ +#define F6502_V 0x40 /* V flag */ +#define F6502_B 0x10 /* B flag */ +#define F6502_D 0x08 /* D flag */ +#define F6502_I 0x04 /* I flag */ +#define F6502_Z 0x02 /* Z flag */ +#define F6502_C 0x01 /* C flag */ /* Function to call any machine language subroutine. All registers in the * regs structure are passed into the routine and the results are passed @@ -98,11 +98,11 @@ void __fastcall__ _sys (struct regs* r); * vector if the program ends. */ -extern unsigned char brk_a; /* A register value */ -extern unsigned char brk_x; /* X register value */ -extern unsigned char brk_y; /* Y register value */ -extern unsigned char brk_sr; /* Status register */ -extern unsigned brk_pc; /* PC value */ +extern unsigned char brk_a; /* A register value */ +extern unsigned char brk_x; /* X register value */ +extern unsigned char brk_y; /* Y register value */ +extern unsigned char brk_sr; /* Status register */ +extern unsigned brk_pc; /* PC value */ typedef void (*brk_handler) (void); /* Type of the break handler */ @@ -116,8 +116,8 @@ void reset_brk (void); /* Possible returns for irq_handler() */ -#define IRQ_NOT_HANDLED 0 -#define IRQ_HANDLED 1 +#define IRQ_NOT_HANDLED 0 +#define IRQ_HANDLED 1 typedef unsigned char (*irq_handler) (void); /* Type of the C level interrupt request handler */ diff --git a/include/_6522.h b/include/_6522.h index d5dbc5f75..1072e6779 100644 --- a/include/_6522.h +++ b/include/_6522.h @@ -2,7 +2,7 @@ /* */ /* _6522.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ @@ -41,22 +41,22 @@ * the compiler doesn't guarantee any order when writing 16 bit values. */ struct __6522 { - unsigned char prb; /* Port register B */ - unsigned char pra; /* Port register A */ - unsigned char ddrb; /* Data direction register B */ - unsigned char ddra; /* Data direction register A */ - unsigned char t1_lo; /* Timer 1, low byte */ - unsigned char t1_hi; /* Timer 1, high byte */ - unsigned char t1l_lo; /* Timer 1 latch, low byte */ - unsigned char t1l_hi; /* Timer 1 latch, high byte */ - unsigned char t2_lo; /* Timer 2, low byte */ - unsigned char t2_hi; /* Timer 2, high byte */ - unsigned char sr; /* Shift register */ - unsigned char acr; /* Auxiliary control register */ - unsigned char pcr; /* Peripheral control register */ - unsigned char ifr; /* Interrupt flag register */ - unsigned char ier; /* Interrupt enable register */ - unsigned char pra2; /* Port register A w/o handshake */ + unsigned char prb; /* Port register B */ + unsigned char pra; /* Port register A */ + unsigned char ddrb; /* Data direction register B */ + unsigned char ddra; /* Data direction register A */ + unsigned char t1_lo; /* Timer 1, low byte */ + unsigned char t1_hi; /* Timer 1, high byte */ + unsigned char t1l_lo; /* Timer 1 latch, low byte */ + unsigned char t1l_hi; /* Timer 1 latch, high byte */ + unsigned char t2_lo; /* Timer 2, low byte */ + unsigned char t2_hi; /* Timer 2, high byte */ + unsigned char sr; /* Shift register */ + unsigned char acr; /* Auxiliary control register */ + unsigned char pcr; /* Peripheral control register */ + unsigned char ifr; /* Interrupt flag register */ + unsigned char ier; /* Interrupt enable register */ + unsigned char pra2; /* Port register A w/o handshake */ }; diff --git a/include/_6525.h b/include/_6525.h index e4f539478..dee0ba459 100644 --- a/include/_6525.h +++ b/include/_6525.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _6525.h */ +/* _6525.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ @@ -43,14 +43,14 @@ * union to do that, however that would introduce an additional name. */ struct __6525 { - unsigned char pra; /* Port register A */ - unsigned char prb; /* Port register B */ - unsigned char prc; /* Port register C */ - unsigned char ddra; /* Data direction register A */ - unsigned char ddrb; /* Data direction register B */ - unsigned char ddrc; /* Data direction register C */ - unsigned char cr; /* Control register */ - unsigned char air; /* Active interrupt register */ + unsigned char pra; /* Port register A */ + unsigned char prb; /* Port register B */ + unsigned char prc; /* Port register C */ + unsigned char ddra; /* Data direction register A */ + unsigned char ddrb; /* Data direction register B */ + unsigned char ddrc; /* Data direction register C */ + unsigned char cr; /* Control register */ + unsigned char air; /* Active interrupt register */ }; diff --git a/include/_6526.h b/include/_6526.h index c04b26d68..5f8cb7d10 100644 --- a/include/_6526.h +++ b/include/_6526.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _6526.h */ +/* _6526.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ @@ -44,22 +44,22 @@ * the compiler doesn't guarantee any order when writing 16 bit values. */ struct __6526 { - unsigned char pra; /* Port register A */ - unsigned char prb; /* Port register B */ - unsigned char ddra; /* Data direction register A */ - unsigned char ddrb; /* Data direction register B */ - unsigned char ta_lo; /* Timer A, low byte */ - unsigned char ta_hi; /* Timer A, high byte */ - unsigned char tb_lo; /* Timer B, low byte */ - unsigned char tb_hi; /* Timer B, high byte */ - unsigned char tod_10; /* TOD, 1/10 sec. */ - unsigned char tod_sec; /* TOD, seconds */ - unsigned char tod_min; /* TOD, minutes */ - unsigned char tod_hour; /* TOD, hours */ - unsigned char sdr; /* Serial data register */ - unsigned char icr; /* Interrupt control register */ - unsigned char cra; /* Control register A */ - unsigned char crb; /* Control register B */ + unsigned char pra; /* Port register A */ + unsigned char prb; /* Port register B */ + unsigned char ddra; /* Data direction register A */ + unsigned char ddrb; /* Data direction register B */ + unsigned char ta_lo; /* Timer A, low byte */ + unsigned char ta_hi; /* Timer A, high byte */ + unsigned char tb_lo; /* Timer B, low byte */ + unsigned char tb_hi; /* Timer B, high byte */ + unsigned char tod_10; /* TOD, 1/10 sec. */ + unsigned char tod_sec; /* TOD, seconds */ + unsigned char tod_min; /* TOD, minutes */ + unsigned char tod_hour; /* TOD, hours */ + unsigned char sdr; /* Serial data register */ + unsigned char icr; /* Interrupt control register */ + unsigned char cra; /* Control register A */ + unsigned char crb; /* Control register B */ }; diff --git a/include/_6545.h b/include/_6545.h index 7dc79a371..ea7c8597b 100644 --- a/include/_6545.h +++ b/include/_6545.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _6545.h */ +/* _6545.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ @@ -40,8 +40,8 @@ /* Define a structure with the 6545 register offsets */ struct __6545 { - unsigned char ctrl; /* Control register */ - unsigned char data; /* Data register */ + unsigned char ctrl; /* Control register */ + unsigned char data; /* Data register */ }; diff --git a/include/_6551.h b/include/_6551.h index 73a82243d..cdf766d60 100644 --- a/include/_6551.h +++ b/include/_6551.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _6551.h */ +/* _6551.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ @@ -40,10 +40,10 @@ /* Define a structure with the 6551 register offsets */ struct __6551 { - unsigned char data; /* Data register */ - unsigned char status; /* Status register */ - unsigned char cmd; /* Command register */ - unsigned char ctrl; /* Control register */ + unsigned char data; /* Data register */ + unsigned char status; /* Status register */ + unsigned char cmd; /* Command register */ + unsigned char ctrl; /* Control register */ }; diff --git a/include/_gtia.h b/include/_gtia.h index f3257e32f..424628f19 100644 --- a/include/_gtia.h +++ b/include/_gtia.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _gtia.h */ +/* _gtia.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ diff --git a/include/_heap.h b/include/_heap.h index 8ac9064c3..76bad35c3 100644 --- a/include/_heap.h +++ b/include/_heap.h @@ -29,19 +29,19 @@ struct usedblock { * Beware: Field order is significant! */ struct freeblock { - unsigned size; - struct freeblock* next; - struct freeblock* prev; + unsigned size; + struct freeblock* next; + struct freeblock* prev; }; /* Variables that describe the heap */ -extern unsigned* _heaporg; /* Bottom of heap */ -extern unsigned* _heapptr; /* Current top */ -extern unsigned* _heapend; /* Upper limit */ -extern struct freeblock* _heapfirst; /* First free block in list */ -extern struct freeblock* _heaplast; /* Last free block in list */ +extern unsigned* _heaporg; /* Bottom of heap */ +extern unsigned* _heapptr; /* Current top */ +extern unsigned* _heapend; /* Upper limit */ +extern struct freeblock* _heapfirst; /* First free block in list */ +extern struct freeblock* _heaplast; /* Last free block in list */ diff --git a/include/_mikey.h b/include/_mikey.h index 2e7ef12c5..b9b7f6906 100644 --- a/include/_mikey.h +++ b/include/_mikey.h @@ -98,7 +98,7 @@ struct __mikey { unsigned char mtest2; // 0xFD9E unsigned char unused5; // 0xFD9F not used unsigned char palette[32]; // 0xFDA0 - 0xFDBF palette 32 bytes - // 0xFDC0 - 0xFDFF not used + // 0xFDC0 - 0xFDFF not used }; diff --git a/include/_pbi.h b/include/_pbi.h index 4bc3314db..f74262f4c 100644 --- a/include/_pbi.h +++ b/include/_pbi.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _pbi.h */ +/* _pbi.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ @@ -32,31 +32,31 @@ #define __PBI_H /* parallel bus interface area */ -#define PBI ((unsigned char*)0xD100) +#define PBI ((unsigned char*)0xD100) /* parallel device IRQ status */ -#define PDVI ((unsigned char*)0xD1FF) +#define PDVI ((unsigned char*)0xD1FF) /* parallel device select */ -#define PDVS ((unsigned char*)0xD1FF) +#define PDVS ((unsigned char*)0xD1FF) /* parallel bus interface RAM area */ -#define PBIRAM ((unsigned char*)0xD600) +#define PBIRAM ((unsigned char*)0xD600) /* parallel device ID 1 */ -#define PDID1 ((unsigned char*)0xD803) +#define PDID1 ((unsigned char*)0xD803) /* parallel device I/O vector */ -#define PDIDV ((unsigned char*)0xD805) +#define PDIDV ((unsigned char*)0xD805) /* parallel device IRQ vector */ -#define PDIRQV ((unsigned char*)0xD808) +#define PDIRQV ((unsigned char*)0xD808) /* parallel device ID 2 */ -#define PDID2 ((unsigned char*)0xD80B) +#define PDID2 ((unsigned char*)0xD80B) /* parallel device vector table */ -#define PDVV ((unsigned char*)0xD80D) +#define PDVV ((unsigned char*)0xD80D) /* End of _pbi.h */ #endif /* #ifndef __PBI_H */ diff --git a/include/_pia.h b/include/_pia.h index 582b84275..867c8f8a5 100644 --- a/include/_pia.h +++ b/include/_pia.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _pia.h */ +/* _pia.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ diff --git a/include/_pokey.h b/include/_pokey.h index a6a0338f8..df10eac3f 100644 --- a/include/_pokey.h +++ b/include/_pokey.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _pokey.h */ +/* _pokey.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ diff --git a/include/_sid.h b/include/_sid.h index b7978ac1a..0aa61b294 100644 --- a/include/_sid.h +++ b/include/_sid.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _sid.h */ +/* _sid.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ @@ -40,23 +40,23 @@ /* Define a structure with the sid register offsets */ struct __sid_voice { - unsigned freq; /* Frequency */ - unsigned pw; /* Pulse width */ - unsigned char ctrl; /* Control register */ - unsigned char ad; /* Attack/decay */ - unsigned char sr; /* Sustain/release */ + unsigned freq; /* Frequency */ + unsigned pw; /* Pulse width */ + unsigned char ctrl; /* Control register */ + unsigned char ad; /* Attack/decay */ + unsigned char sr; /* Sustain/release */ }; struct __sid { - struct __sid_voice v1; /* Voice 1 */ - struct __sid_voice v2; /* Voice 2 */ - struct __sid_voice v3; /* Voice 3 */ - unsigned flt_freq; /* Filter frequency */ - unsigned char flt_ctrl; /* Filter control register */ - unsigned char amp; /* Amplitude */ - unsigned char ad1; /* A/D converter 1 */ - unsigned char ad2; /* A/D converter 2 */ - unsigned char noise; /* Noise generator */ - unsigned char read3; /* Value of voice 3 */ + struct __sid_voice v1; /* Voice 1 */ + struct __sid_voice v2; /* Voice 2 */ + struct __sid_voice v3; /* Voice 3 */ + unsigned flt_freq; /* Filter frequency */ + unsigned char flt_ctrl; /* Filter control register */ + unsigned char amp; /* Amplitude */ + unsigned char ad1; /* A/D converter 1 */ + unsigned char ad2; /* A/D converter 2 */ + unsigned char noise; /* Noise generator */ + unsigned char read3; /* Value of voice 3 */ }; diff --git a/include/_suzy.h b/include/_suzy.h index 3bdf9c708..8ab7f68dd 100644 --- a/include/_suzy.h +++ b/include/_suzy.h @@ -310,7 +310,7 @@ struct __suzy { unsigned char parstat; // 0xFCC2 parallel port status unsigned char pardata; // 0xFCC3 parallel port data unsigned char howie; // 0xFCC4 howie (?) - // 0xFCC5 - 0xFCFF unused + // 0xFCC5 - 0xFCFF unused }; diff --git a/include/_ted.h b/include/_ted.h index d4401a4ad..68b59d706 100644 --- a/include/_ted.h +++ b/include/_ted.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _ted.h */ +/* _ted.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ diff --git a/include/_vdc.h b/include/_vdc.h index adabe01e5..161721d7a 100644 --- a/include/_vdc.h +++ b/include/_vdc.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _vdc.h */ +/* _vdc.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ @@ -40,8 +40,8 @@ /* Define a structure with the vdc register offsets */ struct __vdc { - unsigned char ctrl; /* Control register */ - unsigned char data; /* Data register */ + unsigned char ctrl; /* Control register */ + unsigned char data; /* Data register */ }; diff --git a/include/_vic.h b/include/_vic.h index 7074aedba..ac4d8a2ca 100644 --- a/include/_vic.h +++ b/include/_vic.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* _vic.h */ +/* _vic.h */ /* */ -/* Internal include file, do not use directly */ +/* Internal include file, do not use directly */ /* */ /* */ /* */ @@ -40,21 +40,21 @@ /* Define a structure with the vic register offsets */ struct __vic { - unsigned char leftborder; - unsigned char upperborder; - unsigned char charsperline; /* Characters per line */ - unsigned char linecount; /* Number of lines */ - unsigned char rasterline; /* Current raster line */ - unsigned char addr; /* Address of chargen and video ram */ - unsigned char strobe_x; /* Light pen, X position */ - unsigned char strobe_y; /* Light pen, Y position */ - unsigned char analog_x; /* Analog input X */ - unsigned char analog_y; /* Analog input Y */ - unsigned char voice1; /* Sound generator #1 */ - unsigned char voice2; /* Sound generator #2 */ - unsigned char voice3; /* Sound generator #3 */ - unsigned char noise; /* Noise generator */ - unsigned char volume_color; /* Bits 0..3: volume, 4..7: color */ + unsigned char leftborder; + unsigned char upperborder; + unsigned char charsperline; /* Characters per line */ + unsigned char linecount; /* Number of lines */ + unsigned char rasterline; /* Current raster line */ + unsigned char addr; /* Address of chargen and video ram */ + unsigned char strobe_x; /* Light pen, X position */ + unsigned char strobe_y; /* Light pen, Y position */ + unsigned char analog_x; /* Analog input X */ + unsigned char analog_y; /* Analog input Y */ + unsigned char voice1; /* Sound generator #1 */ + unsigned char voice2; /* Sound generator #2 */ + unsigned char voice3; /* Sound generator #3 */ + unsigned char noise; /* Noise generator */ + unsigned char volume_color; /* Bits 0..3: volume, 4..7: color */ unsigned char bg_border_color;/* Background and border color */ }; diff --git a/include/ace.h b/include/ace.h index cb5df1f69..8d9130085 100644 --- a/include/ace.h +++ b/include/ace.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* ace.h */ +/* ace.h */ /* */ -/* ACE system specific definitions */ +/* ACE system specific definitions */ /* */ /* */ /* */ @@ -52,10 +52,10 @@ struct aceDirentBuf { - unsigned long ad_size; /* Size in bytes */ - unsigned char ad_date [8]; /* YY:YY:MM:DD:HH:MM:SS:TW */ - char ad_type [4]; /* File type as ASCIIZ string */ - unsigned char ad_flags; /* File flags */ + unsigned long ad_size; /* Size in bytes */ + unsigned char ad_date [8]; /* YY:YY:MM:DD:HH:MM:SS:TW */ + char ad_type [4]; /* File type as ASCIIZ string */ + unsigned char ad_flags; /* File flags */ unsigned char ad_usage; /* More flags */ unsigned char ad_namelen; /* Length of name */ char ad_name [17]; /* Name itself, ASCIIZ */ @@ -69,27 +69,27 @@ int aceDirRead (int handle, struct aceDirentBuf* buf); typedef unsigned int aceKey; /* #defines for the shift mask returned by aceConGetKey */ -#define aceSH_KEY 0x00FF /* Mask key itself */ -#define aceSH_MASK 0xFF00 /* Mask shift mask */ -#define aceSH_EXT 0x2000 /* Extended key */ -#define aceSH_CAPS 0x1000 /* Caps lock key */ -#define aceSH_ALT 0x0800 /* Alternate key */ -#define aceSH_CTRL 0x0400 /* Ctrl key */ -#define aceSH_CBM 0x0200 /* Commodore key */ -#define aceSH_SHIFT 0x0100 /* Shift key */ +#define aceSH_KEY 0x00FF /* Mask key itself */ +#define aceSH_MASK 0xFF00 /* Mask shift mask */ +#define aceSH_EXT 0x2000 /* Extended key */ +#define aceSH_CAPS 0x1000 /* Caps lock key */ +#define aceSH_ALT 0x0800 /* Alternate key */ +#define aceSH_CTRL 0x0400 /* Ctrl key */ +#define aceSH_CBM 0x0200 /* Commodore key */ +#define aceSH_SHIFT 0x0100 /* Shift key */ /* #defines for the options in aceConSetOpt/aceConGetOpt */ -#define aceOP_PUTMASK 1 /* Console put mask */ -#define aceOP_CHARCOLOR 2 /* Character color */ -#define aceOP_CHARATTR 3 /* Character attribute */ -#define aceOP_FILLCOLOR 4 /* Fill color */ -#define aceOP_FILLATTR 5 /* Fill attribute */ -#define aceOP_CRSCOLOR 6 /* Cursor color */ -#define aceOP_CRSWRAP 7 /* Force cursor wrap */ -#define aceOP_SHSCROLL 8 /* Shift keys for scrolling */ -#define aceOP_MOUSCALE 9 /* Mouse scaling */ -#define aceOP_RPTDELAY 10 /* Key repeat delay */ -#define aceOP_RPTRATE 11 /* Key repeat rate */ +#define aceOP_PUTMASK 1 /* Console put mask */ +#define aceOP_CHARCOLOR 2 /* Character color */ +#define aceOP_CHARATTR 3 /* Character attribute */ +#define aceOP_FILLCOLOR 4 /* Fill color */ +#define aceOP_FILLATTR 5 /* Fill attribute */ +#define aceOP_CRSCOLOR 6 /* Cursor color */ +#define aceOP_CRSWRAP 7 /* Force cursor wrap */ +#define aceOP_SHSCROLL 8 /* Shift keys for scrolling */ +#define aceOP_MOUSCALE 9 /* Mouse scaling */ +#define aceOP_RPTDELAY 10 /* Key repeat delay */ +#define aceOP_RPTRATE 11 /* Key repeat rate */ /* Console functions */ void aceConWrite (char* buf, size_t count); diff --git a/include/apple2.h b/include/apple2.h index f5dcff0ae..177159e46 100644 --- a/include/apple2.h +++ b/include/apple2.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* apple2.h */ +/* apple2.h */ /* */ -/* Apple ][ system specific definitions */ +/* Apple ][ system specific definitions */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -154,7 +154,7 @@ extern void a2_lo_tgi[]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/apple2enh.h b/include/apple2enh.h index 112522117..9fb093b45 100644 --- a/include/apple2enh.h +++ b/include/apple2enh.h @@ -1,31 +1,31 @@ /*****************************************************************************/ -/* */ -/* apple2enh.h */ -/* */ -/* enhanced Apple //e system specific definitions */ -/* */ -/* */ -/* */ +/* */ +/* apple2enh.h */ +/* */ +/* enhanced Apple //e system specific definitions */ +/* */ +/* */ +/* */ /* (C) 2004 Oliver Schmidt, */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -73,8 +73,8 @@ #define CH_F10 0xB0 /* Styles for textframe */ -#define TEXTFRAME_WIDE 0x00 -#define TEXTFRAME_TALL 0x04 +#define TEXTFRAME_WIDE 0x00 +#define TEXTFRAME_TALL 0x04 /* Video modes */ #define VIDEOMODE_40x24 0x0011 @@ -101,7 +101,7 @@ extern void a2e_lo_tgi[]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/assert.h b/include/assert.h index bd58e2068..87bc4ff02 100644 --- a/include/assert.h +++ b/include/assert.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* assert.h */ +/* assert.h */ /* */ -/* Diagnostics */ +/* Diagnostics */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ # define assert(expr) #else extern void _afailed (const char*, unsigned); -# define assert(expr) ((expr)? (void)0 : _afailed(__FILE__, __LINE__)) +# define assert(expr) ((expr)? (void)0 : _afailed(__FILE__, __LINE__)) #endif diff --git a/include/atari.h b/include/atari.h index 555dc9a93..26c555cc4 100644 --- a/include/atari.h +++ b/include/atari.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* atari.h */ +/* atari.h */ /* */ -/* Atari system specific definitions */ +/* Atari system specific definitions */ /* */ /* */ /* */ @@ -45,11 +45,11 @@ /* Character codes */ -#define CH_DELCHR 0xFE /* delete char under the cursor */ -#define CH_ENTER 0x9B -#define CH_ESC 0x1B -#define CH_CURS_UP 28 -#define CH_CURS_DOWN 29 +#define CH_DELCHR 0xFE /* delete char under the cursor */ +#define CH_ENTER 0x9B +#define CH_ESC 0x1B +#define CH_CURS_UP 28 +#define CH_CURS_DOWN 29 #define CH_CURS_LEFT 30 #define CH_CURS_RIGHT 31 @@ -63,26 +63,26 @@ #define CH_INSLINE 0x9D /* insert line */ /* These are defined to be Atari + NumberKey */ -#define CH_F1 177 -#define CH_F2 178 -#define CH_F3 179 -#define CH_F4 180 -#define CH_F5 181 -#define CH_F6 182 -#define CH_F7 183 -#define CH_F8 184 -#define CH_F9 185 -#define CH_F10 176 +#define CH_F1 177 +#define CH_F2 178 +#define CH_F3 179 +#define CH_F4 180 +#define CH_F5 181 +#define CH_F6 182 +#define CH_F7 183 +#define CH_F8 184 +#define CH_F9 185 +#define CH_F10 176 -#define CH_ULCORNER 0x11 -#define CH_URCORNER 0x05 -#define CH_LLCORNER 0x1A -#define CH_LRCORNER 0x03 -#define CH_TTEE 0x17 -#define CH_BTEE 0x18 -#define CH_LTEE 0x01 -#define CH_RTEE 0x04 -#define CH_CROSS 0x13 +#define CH_ULCORNER 0x11 +#define CH_URCORNER 0x05 +#define CH_LLCORNER 0x1A +#define CH_LRCORNER 0x03 +#define CH_TTEE 0x17 +#define CH_BTEE 0x18 +#define CH_LTEE 0x01 +#define CH_RTEE 0x04 +#define CH_CROSS 0x13 #define CH_HLINE 0x12 #define CH_VLINE 0x7C @@ -114,22 +114,22 @@ /* Color defines, similar to c64 colors (untested) */ /* Note that the conio color implementation is monochrome (bgcolor and textcolor are only placeholders) */ /* Use the defines with the setcolor() or _atari_xxxcolor() functions */ -#define COLOR_BLACK _gtia_mkcolor(HUE_GREY,0) -#define COLOR_WHITE _gtia_mkcolor(HUE_GREY,7) -#define COLOR_RED _gtia_mkcolor(HUE_REDORANGE,1) -#define COLOR_CYAN _gtia_mkcolor(HUE_CYAN,3) -#define COLOR_VIOLET _gtia_mkcolor(HUE_PURPLE,4) -#define COLOR_GREEN _gtia_mkcolor(HUE_GREEN,2) -#define COLOR_BLUE _gtia_mkcolor(HUE_BLUE,2) -#define COLOR_YELLOW _gtia_mkcolor(HUE_YELLOW,7) -#define COLOR_ORANGE _gtia_mkcolor(HUE_ORANGE,5) -#define COLOR_BROWN _gtia_mkcolor(HUE_YELLOW,2) -#define COLOR_LIGHTRED _gtia_mkcolor(HUE_REDORANGE,6) -#define COLOR_GRAY1 _gtia_mkcolor(HUE_GREY,2) -#define COLOR_GRAY2 _gtia_mkcolor(HUE_GREY,3) -#define COLOR_LIGHTGREEN _gtia_mkcolor(HUE_GREEN,6) -#define COLOR_LIGHTBLUE _gtia_mkcolor(HUE_BLUE,6) -#define COLOR_GRAY3 _gtia_mkcolor(HUE_GREY,5) +#define COLOR_BLACK _gtia_mkcolor(HUE_GREY,0) +#define COLOR_WHITE _gtia_mkcolor(HUE_GREY,7) +#define COLOR_RED _gtia_mkcolor(HUE_REDORANGE,1) +#define COLOR_CYAN _gtia_mkcolor(HUE_CYAN,3) +#define COLOR_VIOLET _gtia_mkcolor(HUE_PURPLE,4) +#define COLOR_GREEN _gtia_mkcolor(HUE_GREEN,2) +#define COLOR_BLUE _gtia_mkcolor(HUE_BLUE,2) +#define COLOR_YELLOW _gtia_mkcolor(HUE_YELLOW,7) +#define COLOR_ORANGE _gtia_mkcolor(HUE_ORANGE,5) +#define COLOR_BROWN _gtia_mkcolor(HUE_YELLOW,2) +#define COLOR_LIGHTRED _gtia_mkcolor(HUE_REDORANGE,6) +#define COLOR_GRAY1 _gtia_mkcolor(HUE_GREY,2) +#define COLOR_GRAY2 _gtia_mkcolor(HUE_GREY,3) +#define COLOR_LIGHTGREEN _gtia_mkcolor(HUE_GREEN,6) +#define COLOR_LIGHTBLUE _gtia_mkcolor(HUE_BLUE,6) +#define COLOR_GRAY3 _gtia_mkcolor(HUE_GREY,5) /* color register functions */ extern void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminace); diff --git a/include/atmos.h b/include/atmos.h index e4c2af9b2..eed6d7564 100644 --- a/include/atmos.h +++ b/include/atmos.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* atmos.h */ +/* atmos.h */ /* */ -/* Oric Atmos system-specific definitions */ +/* Oric Atmos system-specific definitions */ /* */ /* */ /* */ @@ -47,82 +47,82 @@ /* Color defines */ -#define COLOR_BLACK 0x00 -#define COLOR_RED 0x01 -#define COLOR_GREEN 0x02 -#define COLOR_YELLOW 0x03 -#define COLOR_BLUE 0x04 -#define COLOR_MAGENTA 0x05 -#define COLOR_CYAN 0x06 -#define COLOR_WHITE 0x07 +#define COLOR_BLACK 0x00 +#define COLOR_RED 0x01 +#define COLOR_GREEN 0x02 +#define COLOR_YELLOW 0x03 +#define COLOR_BLUE 0x04 +#define COLOR_MAGENTA 0x05 +#define COLOR_CYAN 0x06 +#define COLOR_WHITE 0x07 /* TGI color defines */ /* White and red are swapped, so that the pallete ** driver is compatible with black-and-white drivers. */ -#define TGI_COLOR_BLACK COLOR_BLACK -#define TGI_COLOR_WHITE 1 -#define TGI_COLOR_GREEN COLOR_GREEN -#define TGI_COLOR_YELLOW COLOR_YELLOW -#define TGI_COLOR_BLUE COLOR_BLUE -#define TGI_COLOR_MAGENTA COLOR_MAGENTA -#define TGI_COLOR_CYAN COLOR_CYAN -#define TGI_COLOR_RED 7 +#define TGI_COLOR_BLACK COLOR_BLACK +#define TGI_COLOR_WHITE 1 +#define TGI_COLOR_GREEN COLOR_GREEN +#define TGI_COLOR_YELLOW COLOR_YELLOW +#define TGI_COLOR_BLUE COLOR_BLUE +#define TGI_COLOR_MAGENTA COLOR_MAGENTA +#define TGI_COLOR_CYAN COLOR_CYAN +#define TGI_COLOR_RED 7 /* Define hardware */ #include <_6522.h> -#define VIA (*(struct __6522*)0x300) +#define VIA (*(struct __6522*)0x300) /* These are defined to be FUNCT + NumberKey */ -#define CH_F1 0xB1 -#define CH_F2 0xB2 -#define CH_F3 0xB3 -#define CH_F4 0xB4 -#define CH_F5 0xB5 -#define CH_F6 0xB6 -#define CH_F7 0xB7 -#define CH_F8 0xB8 -#define CH_F9 0xB9 -#define CH_F10 0xB0 +#define CH_F1 0xB1 +#define CH_F2 0xB2 +#define CH_F3 0xB3 +#define CH_F4 0xB4 +#define CH_F5 0xB5 +#define CH_F6 0xB6 +#define CH_F7 0xB7 +#define CH_F8 0xB8 +#define CH_F9 0xB9 +#define CH_F10 0xB0 /* Character codes */ -#define CH_ULCORNER '+' -#define CH_URCORNER '+' -#define CH_LLCORNER '+' -#define CH_LRCORNER '+' -#define CH_TTEE '+' -#define CH_BTEE '+' -#define CH_LTEE '+' -#define CH_RTEE '+' -#define CH_CROSS '+' -#define CH_CURS_UP 11 -#define CH_CURS_DOWN 10 -#define CH_CURS_LEFT 8 -#define CH_CURS_RIGHT 9 -#define CH_DEL 127 -#define CH_ENTER 13 -#define CH_STOP 3 -#define CH_LIRA 95 -#define CH_ESC 27 +#define CH_ULCORNER '+' +#define CH_URCORNER '+' +#define CH_LLCORNER '+' +#define CH_LRCORNER '+' +#define CH_TTEE '+' +#define CH_BTEE '+' +#define CH_LTEE '+' +#define CH_RTEE '+' +#define CH_CROSS '+' +#define CH_CURS_UP 11 +#define CH_CURS_DOWN 10 +#define CH_CURS_LEFT 8 +#define CH_CURS_RIGHT 9 +#define CH_DEL 127 +#define CH_ENTER 13 +#define CH_STOP 3 +#define CH_LIRA 95 +#define CH_ESC 27 /* No support for dynamically loadable drivers */ -#define DYN_DRV 0 +#define DYN_DRV 0 /* The addresses of the static drivers */ -extern void atmos_pase_joy[]; /* Referred to by joy_static_stddrv[] */ +extern void atmos_pase_joy[]; /* Referred to by joy_static_stddrv[] */ extern void atmos_acia_ser[]; extern void atmos_228_200_3_tgi[]; -extern void atmos_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */ +extern void atmos_240_200_2_tgi[]; /* Referred to by tgi_static_stddrv[] */ diff --git a/include/c128.h b/include/c128.h index 26fb25274..0b005bce0 100644 --- a/include/c128.h +++ b/include/c128.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* c128.h */ +/* c128.h */ /* */ -/* C128 system specific definitions */ +/* C128 system specific definitions */ /* */ /* */ /* */ @@ -46,50 +46,50 @@ /* Additional key defines */ -#define CH_F1 133 -#define CH_F2 137 -#define CH_F3 134 -#define CH_F4 138 -#define CH_F5 135 -#define CH_F6 139 -#define CH_F7 136 -#define CH_F8 140 +#define CH_F1 133 +#define CH_F2 137 +#define CH_F3 134 +#define CH_F4 138 +#define CH_F5 135 +#define CH_F6 139 +#define CH_F7 136 +#define CH_F8 140 /* Color defines */ -#define COLOR_BLACK 0x00 -#define COLOR_WHITE 0x01 -#define COLOR_RED 0x02 -#define COLOR_CYAN 0x03 -#define COLOR_VIOLET 0x04 -#define COLOR_GREEN 0x05 -#define COLOR_BLUE 0x06 -#define COLOR_YELLOW 0x07 -#define COLOR_ORANGE 0x08 -#define COLOR_BROWN 0x09 -#define COLOR_LIGHTRED 0x0A -#define COLOR_GRAY1 0x0B -#define COLOR_GRAY2 0x0C -#define COLOR_LIGHTGREEN 0x0D -#define COLOR_LIGHTBLUE 0x0E -#define COLOR_GRAY3 0x0F +#define COLOR_BLACK 0x00 +#define COLOR_WHITE 0x01 +#define COLOR_RED 0x02 +#define COLOR_CYAN 0x03 +#define COLOR_VIOLET 0x04 +#define COLOR_GREEN 0x05 +#define COLOR_BLUE 0x06 +#define COLOR_YELLOW 0x07 +#define COLOR_ORANGE 0x08 +#define COLOR_BROWN 0x09 +#define COLOR_LIGHTRED 0x0A +#define COLOR_GRAY1 0x0B +#define COLOR_GRAY2 0x0C +#define COLOR_LIGHTGREEN 0x0D +#define COLOR_LIGHTBLUE 0x0E +#define COLOR_GRAY3 0x0F /* TGI color defines */ -#define TGI_COLOR_BLACK COLOR_BLACK -#define TGI_COLOR_WHITE COLOR_WHITE -#define TGI_COLOR_RED COLOR_RED -#define TGI_COLOR_CYAN COLOR_CYAN -#define TGI_COLOR_VIOLET COLOR_VIOLET -#define TGI_COLOR_GREEN COLOR_GREEN -#define TGI_COLOR_BLUE COLOR_BLUE -#define TGI_COLOR_YELLOW COLOR_YELLOW -#define TGI_COLOR_ORANGE COLOR_ORANGE -#define TGI_COLOR_BROWN COLOR_BROWN +#define TGI_COLOR_BLACK COLOR_BLACK +#define TGI_COLOR_WHITE COLOR_WHITE +#define TGI_COLOR_RED COLOR_RED +#define TGI_COLOR_CYAN COLOR_CYAN +#define TGI_COLOR_VIOLET COLOR_VIOLET +#define TGI_COLOR_GREEN COLOR_GREEN +#define TGI_COLOR_BLUE COLOR_BLUE +#define TGI_COLOR_YELLOW COLOR_YELLOW +#define TGI_COLOR_ORANGE COLOR_ORANGE +#define TGI_COLOR_BROWN COLOR_BROWN #define TGI_COLOR_LIGHTRED COLOR_LIGHTRED -#define TGI_COLOR_GRAY1 COLOR_GRAY1 -#define TGI_COLOR_GRAY2 COLOR_GRAY2 +#define TGI_COLOR_GRAY1 COLOR_GRAY1 +#define TGI_COLOR_GRAY2 COLOR_GRAY2 #define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN #define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE -#define TGI_COLOR_GRAY3 COLOR_GRAY3 +#define TGI_COLOR_GRAY3 COLOR_GRAY3 /* Video mode defines */ #define VIDEOMODE_40x25 0x00 @@ -101,22 +101,22 @@ /* Define hardware */ #include <_vic2.h> -#define VIC (*(struct __vic2*)0xD000) +#define VIC (*(struct __vic2*)0xD000) #include <_sid.h> -#define SID (*(struct __sid*)0xD400) +#define SID (*(struct __sid*)0xD400) #include <_vdc.h> #define VDC (*(struct __vdc*)0xD600) #include <_6526.h> -#define CIA1 (*(struct __6526*)0xDC00) -#define CIA2 (*(struct __6526*)0xDD00) +#define CIA1 (*(struct __6526*)0xDC00) +#define CIA2 (*(struct __6526*)0xDD00) /* Define special memory areas */ -#define COLOR_RAM ((unsigned char*)0xD800) +#define COLOR_RAM ((unsigned char*)0xD800) @@ -128,12 +128,12 @@ extern void c128_ramcart_emd[]; extern void c128_reu_emd[]; extern void c128_vdc_emd[]; extern void c128_ptvjoy_joy[]; -extern void c128_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ -extern void c128_1351_mous[]; /* Referred to by mouse_static_stddrv[] */ +extern void c128_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ +extern void c128_1351_mous[]; /* Referred to by mouse_static_stddrv[] */ extern void c128_joy_mou[]; extern void c128_pot_mou[]; extern void c128_swlink_ser[]; -extern void c128_vdc_tgi[]; /* Referred to by tgi_static_stddrv[] */ +extern void c128_vdc_tgi[]; /* Referred to by tgi_static_stddrv[] */ extern void c128_vdc2_tgi[]; diff --git a/include/c16.h b/include/c16.h index 35124a709..d49ca6fd4 100644 --- a/include/c16.h +++ b/include/c16.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* c16.h */ +/* c16.h */ /* */ -/* C16 system specific definitions */ +/* C16 system specific definitions */ /* */ /* */ /* */ diff --git a/include/c64.h b/include/c64.h index 5cc2bd08e..0a4ebaf97 100644 --- a/include/c64.h +++ b/include/c64.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* c64.h */ +/* c64.h */ /* */ -/* C64 system specific definitions */ +/* C64 system specific definitions */ /* */ /* */ /* */ @@ -46,72 +46,72 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Additional key defines */ -#define CH_F1 133 -#define CH_F2 137 -#define CH_F3 134 -#define CH_F4 138 -#define CH_F5 135 -#define CH_F6 139 -#define CH_F7 136 -#define CH_F8 140 +#define CH_F1 133 +#define CH_F2 137 +#define CH_F3 134 +#define CH_F4 138 +#define CH_F5 135 +#define CH_F6 139 +#define CH_F7 136 +#define CH_F8 140 /* Color defines */ -#define COLOR_BLACK 0x00 -#define COLOR_WHITE 0x01 -#define COLOR_RED 0x02 -#define COLOR_CYAN 0x03 -#define COLOR_VIOLET 0x04 +#define COLOR_BLACK 0x00 +#define COLOR_WHITE 0x01 +#define COLOR_RED 0x02 +#define COLOR_CYAN 0x03 +#define COLOR_VIOLET 0x04 #define COLOR_PURPLE COLOR_VIOLET -#define COLOR_GREEN 0x05 -#define COLOR_BLUE 0x06 -#define COLOR_YELLOW 0x07 -#define COLOR_ORANGE 0x08 -#define COLOR_BROWN 0x09 -#define COLOR_LIGHTRED 0x0A -#define COLOR_GRAY1 0x0B -#define COLOR_GRAY2 0x0C -#define COLOR_LIGHTGREEN 0x0D -#define COLOR_LIGHTBLUE 0x0E -#define COLOR_GRAY3 0x0F +#define COLOR_GREEN 0x05 +#define COLOR_BLUE 0x06 +#define COLOR_YELLOW 0x07 +#define COLOR_ORANGE 0x08 +#define COLOR_BROWN 0x09 +#define COLOR_LIGHTRED 0x0A +#define COLOR_GRAY1 0x0B +#define COLOR_GRAY2 0x0C +#define COLOR_LIGHTGREEN 0x0D +#define COLOR_LIGHTBLUE 0x0E +#define COLOR_GRAY3 0x0F /* TGI color defines */ -#define TGI_COLOR_BLACK COLOR_BLACK -#define TGI_COLOR_WHITE COLOR_WHITE -#define TGI_COLOR_RED COLOR_RED -#define TGI_COLOR_CYAN COLOR_CYAN -#define TGI_COLOR_VIOLET COLOR_VIOLET -#define TGI_COLOR_PURPLE COLOR_PURPLE -#define TGI_COLOR_GREEN COLOR_GREEN -#define TGI_COLOR_BLUE COLOR_BLUE -#define TGI_COLOR_YELLOW COLOR_YELLOW -#define TGI_COLOR_ORANGE COLOR_ORANGE -#define TGI_COLOR_BROWN COLOR_BROWN -#define TGI_COLOR_LIGHTRED COLOR_LIGHTRED -#define TGI_COLOR_GRAY1 COLOR_GRAY1 -#define TGI_COLOR_GRAY2 COLOR_GRAY2 -#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN -#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE -#define TGI_COLOR_GRAY3 COLOR_GRAY3 +#define TGI_COLOR_BLACK COLOR_BLACK +#define TGI_COLOR_WHITE COLOR_WHITE +#define TGI_COLOR_RED COLOR_RED +#define TGI_COLOR_CYAN COLOR_CYAN +#define TGI_COLOR_VIOLET COLOR_VIOLET +#define TGI_COLOR_PURPLE COLOR_PURPLE +#define TGI_COLOR_GREEN COLOR_GREEN +#define TGI_COLOR_BLUE COLOR_BLUE +#define TGI_COLOR_YELLOW COLOR_YELLOW +#define TGI_COLOR_ORANGE COLOR_ORANGE +#define TGI_COLOR_BROWN COLOR_BROWN +#define TGI_COLOR_LIGHTRED COLOR_LIGHTRED +#define TGI_COLOR_GRAY1 COLOR_GRAY1 +#define TGI_COLOR_GRAY2 COLOR_GRAY2 +#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN +#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE +#define TGI_COLOR_GRAY3 COLOR_GRAY3 /* Define hardware */ #include <_vic2.h> -#define VIC (*(struct __vic2*)0xD000) +#define VIC (*(struct __vic2*)0xD000) #include <_sid.h> -#define SID (*(struct __sid*)0xD400) +#define SID (*(struct __sid*)0xD400) #include <_6526.h> -#define CIA1 (*(struct __6526*)0xDC00) -#define CIA2 (*(struct __6526*)0xDD00) +#define CIA1 (*(struct __6526*)0xDC00) +#define CIA2 (*(struct __6526*)0xDD00) /* Define special memory areas */ -#define COLOR_RAM ((unsigned char*)0xD800) +#define COLOR_RAM ((unsigned char*)0xD800) /* Return codes for get_ostype */ #define C64_OS_US 0xAA /* US version */ @@ -152,7 +152,7 @@ extern void c64_hi_tgi[]; /* Referred to by tgi_static_stddrv[] */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/cbm.h b/include/cbm.h index 5a422806a..ed7397849 100644 --- a/include/cbm.h +++ b/include/cbm.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* cbm.h */ +/* cbm.h */ /* */ -/* CBM system-specific definitions */ +/* CBM system-specific definitions */ /* */ /* */ /* */ @@ -94,29 +94,29 @@ extern char _filetype; /* Defaults to 's' */ -#define CH_HLINE 192 -#define CH_VLINE 221 -#define CH_ULCORNER 176 -#define CH_URCORNER 174 -#define CH_LLCORNER 173 -#define CH_LRCORNER 189 -#define CH_TTEE 178 -#define CH_BTEE 177 -#define CH_LTEE 171 -#define CH_RTEE 179 -#define CH_CROSS 219 -#define CH_CURS_UP 145 -#define CH_CURS_DOWN 17 -#define CH_CURS_LEFT 157 -#define CH_CURS_RIGHT 29 -#define CH_PI 222 -#define CH_HOME 19 -#define CH_DEL 20 -#define CH_INS 148 -#define CH_ENTER 13 -#define CH_STOP 3 -#define CH_LIRA 92 -#define CH_ESC 27 +#define CH_HLINE 192 +#define CH_VLINE 221 +#define CH_ULCORNER 176 +#define CH_URCORNER 174 +#define CH_LLCORNER 173 +#define CH_LRCORNER 189 +#define CH_TTEE 178 +#define CH_BTEE 177 +#define CH_LTEE 171 +#define CH_RTEE 179 +#define CH_CROSS 219 +#define CH_CURS_UP 145 +#define CH_CURS_DOWN 17 +#define CH_CURS_LEFT 157 +#define CH_CURS_RIGHT 29 +#define CH_PI 222 +#define CH_HOME 19 +#define CH_DEL 20 +#define CH_INS 148 +#define CH_ENTER 13 +#define CH_STOP 3 +#define CH_LIRA 92 +#define CH_ESC 27 @@ -166,9 +166,9 @@ unsigned char get_tv (void); * * e.g., cbm_open(2, 8, CBM_READ, "0:data,s"); */ -#define CBM_READ 0 /* default is ",p" */ -#define CBM_WRITE 1 /* ditto */ -#define CBM_SEQ 2 /* default is ",r" -- or ",s" when writing */ +#define CBM_READ 0 /* default is ",p" */ +#define CBM_WRITE 1 /* ditto */ +#define CBM_SEQ 2 /* default is ",r" -- or ",s" when writing */ /* Kernal-level functions */ unsigned char cbm_k_acptr (void); @@ -204,20 +204,20 @@ void cbm_k_unlsn (void); /* The cbm_* I/O functions below set _oserror (see errno.h), * in case of an error. * - * error-code BASIC error - * ---------- ----------- - * 1 = too many files - * 2 = file open - * 3 = file not open - * 4 = file not found - * 5 = device not present - * 6 = not input-file - * 7 = not output-file - * 8 = missing file-name - * 9 = illegal device-number + * error-code BASIC error + * ---------- ----------- + * 1 = too many files + * 2 = file open + * 3 = file not open + * 4 = file not found + * 5 = device not present + * 6 = not input-file + * 7 = not output-file + * 8 = missing file-name + * 9 = illegal device-number * - * 10 = STOP-key pushed - * 11 = general I/O-error + * 10 = STOP-key pushed + * 11 = general I/O-error */ diff --git a/include/cbm264.h b/include/cbm264.h index 961701700..9ede10f47 100644 --- a/include/cbm264.h +++ b/include/cbm264.h @@ -46,83 +46,83 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Additional key defines */ -#define CH_F1 133 -#define CH_F2 137 -#define CH_F3 134 -#define CH_F4 138 -#define CH_F5 135 -#define CH_F6 139 -#define CH_F7 136 -#define CH_F8 140 +#define CH_F1 133 +#define CH_F2 137 +#define CH_F3 134 +#define CH_F4 138 +#define CH_F5 135 +#define CH_F6 139 +#define CH_F7 136 +#define CH_F8 140 /* Color attributes */ -#define CATTR_LUMA0 0x00 -#define CATTR_LUMA1 0x10 -#define CATTR_LUMA2 0x20 -#define CATTR_LUMA3 0x30 -#define CATTR_LUMA4 0x40 -#define CATTR_LUMA5 0x50 -#define CATTR_LUMA6 0x60 -#define CATTR_LUMA7 0x70 -#define CATTR_BLINK 0x80 +#define CATTR_LUMA0 0x00 +#define CATTR_LUMA1 0x10 +#define CATTR_LUMA2 0x20 +#define CATTR_LUMA3 0x30 +#define CATTR_LUMA4 0x40 +#define CATTR_LUMA5 0x50 +#define CATTR_LUMA6 0x60 +#define CATTR_LUMA7 0x70 +#define CATTR_BLINK 0x80 /* Base colors */ -#define BCOLOR_BLACK 0x00 -#define BCOLOR_WHITE 0x01 -#define BCOLOR_RED 0x02 -#define BCOLOR_CYAN 0x03 -#define BCOLOR_VIOLET 0x04 +#define BCOLOR_BLACK 0x00 +#define BCOLOR_WHITE 0x01 +#define BCOLOR_RED 0x02 +#define BCOLOR_CYAN 0x03 +#define BCOLOR_VIOLET 0x04 #define BCOLOR_PURPLE BCOLOR_VIOLET -#define BCOLOR_GREEN 0x05 -#define BCOLOR_BLUE 0x06 -#define BCOLOR_YELLOW 0x07 -#define BCOLOR_ORANGE 0x08 -#define BCOLOR_BROWN 0x09 -#define BCOLOR_LEMON 0x0A /* What's that color? */ -#define BCOLOR_LIGHTVIOLET 0x0B -#define BCOLOR_BLUEGREEN 0x0C -#define BCOLOR_LIGHTBLUE 0x0D -#define BCOLOR_DARKBLUE 0x0E -#define BCOLOR_LIGHTGREEN 0x0F +#define BCOLOR_GREEN 0x05 +#define BCOLOR_BLUE 0x06 +#define BCOLOR_YELLOW 0x07 +#define BCOLOR_ORANGE 0x08 +#define BCOLOR_BROWN 0x09 +#define BCOLOR_LEMON 0x0A /* What's that color? */ +#define BCOLOR_LIGHTVIOLET 0x0B +#define BCOLOR_BLUEGREEN 0x0C +#define BCOLOR_LIGHTBLUE 0x0D +#define BCOLOR_DARKBLUE 0x0E +#define BCOLOR_LIGHTGREEN 0x0F /* Now try to mix up a C64/C128 compatible palette */ -#define COLOR_BLACK (BCOLOR_BLACK) -#define COLOR_WHITE (BCOLOR_WHITE | CATTR_LUMA7) -#define COLOR_RED (BCOLOR_RED | CATTR_LUMA4) -#define COLOR_CYAN (BCOLOR_CYAN | CATTR_LUMA7) -#define COLOR_VIOLET (BCOLOR_VIOLET | CATTR_LUMA7) +#define COLOR_BLACK (BCOLOR_BLACK) +#define COLOR_WHITE (BCOLOR_WHITE | CATTR_LUMA7) +#define COLOR_RED (BCOLOR_RED | CATTR_LUMA4) +#define COLOR_CYAN (BCOLOR_CYAN | CATTR_LUMA7) +#define COLOR_VIOLET (BCOLOR_VIOLET | CATTR_LUMA7) #define COLOR_PURPLE COLOR_VIOLET -#define COLOR_GREEN (BCOLOR_GREEN | CATTR_LUMA7) -#define COLOR_BLUE (BCOLOR_BLUE | CATTR_LUMA7) -#define COLOR_YELLOW (BCOLOR_YELLOW | CATTR_LUMA7) -#define COLOR_ORANGE (BCOLOR_ORANGE | CATTR_LUMA7) -#define COLOR_BROWN (BCOLOR_BROWN | CATTR_LUMA7) -#define COLOR_LIGHTRED (BCOLOR_RED | CATTR_LUMA7) -#define COLOR_GRAY1 (BCOLOR_WHITE | CATTR_LUMA1) -#define COLOR_GRAY2 (BCOLOR_WHITE | CATTR_LUMA3) -#define COLOR_LIGHTGREEN (BCOLOR_LIGHTGREEN | CATTR_LUMA7) -#define COLOR_LIGHTBLUE (BCOLOR_LIGHTBLUE | CATTR_LUMA7) -#define COLOR_GRAY3 (BCOLOR_WHITE | CATTR_LUMA5) +#define COLOR_GREEN (BCOLOR_GREEN | CATTR_LUMA7) +#define COLOR_BLUE (BCOLOR_BLUE | CATTR_LUMA7) +#define COLOR_YELLOW (BCOLOR_YELLOW | CATTR_LUMA7) +#define COLOR_ORANGE (BCOLOR_ORANGE | CATTR_LUMA7) +#define COLOR_BROWN (BCOLOR_BROWN | CATTR_LUMA7) +#define COLOR_LIGHTRED (BCOLOR_RED | CATTR_LUMA7) +#define COLOR_GRAY1 (BCOLOR_WHITE | CATTR_LUMA1) +#define COLOR_GRAY2 (BCOLOR_WHITE | CATTR_LUMA3) +#define COLOR_LIGHTGREEN (BCOLOR_LIGHTGREEN | CATTR_LUMA7) +#define COLOR_LIGHTBLUE (BCOLOR_LIGHTBLUE | CATTR_LUMA7) +#define COLOR_GRAY3 (BCOLOR_WHITE | CATTR_LUMA5) /* Define hardware */ #include <_ted.h> #define TED (*(struct __ted*)0xFF00) /* Define special memory areas */ -#define COLOR_RAM ((unsigned char*)0x0800) +#define COLOR_RAM ((unsigned char*)0x0800) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/cbm510.h b/include/cbm510.h index 19370d818..350527c89 100644 --- a/include/cbm510.h +++ b/include/cbm510.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* cbm510.h */ +/* cbm510.h */ /* */ -/* System specific definitions for the CBM5x0 / P500 */ +/* System specific definitions for the CBM5x0 / P500 */ /* */ /* */ /* */ @@ -46,68 +46,68 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Additional key defines */ -#define CH_F1 224 -#define CH_F2 225 -#define CH_F3 226 -#define CH_F4 227 -#define CH_F5 228 -#define CH_F6 229 -#define CH_F7 230 -#define CH_F8 231 -#define CH_F9 232 -#define CH_F10 233 -#define CH_F11 234 -#define CH_F12 235 -#define CH_F13 236 -#define CH_F14 237 -#define CH_F15 238 -#define CH_F16 239 -#define CH_F17 240 -#define CH_F18 241 -#define CH_F19 242 -#define CH_F20 243 +#define CH_F1 224 +#define CH_F2 225 +#define CH_F3 226 +#define CH_F4 227 +#define CH_F5 228 +#define CH_F6 229 +#define CH_F7 230 +#define CH_F8 231 +#define CH_F9 232 +#define CH_F10 233 +#define CH_F11 234 +#define CH_F12 235 +#define CH_F13 236 +#define CH_F14 237 +#define CH_F15 238 +#define CH_F16 239 +#define CH_F17 240 +#define CH_F18 241 +#define CH_F19 242 +#define CH_F20 243 /* Color defines */ -#define COLOR_BLACK 0x00 -#define COLOR_WHITE 0x01 -#define COLOR_RED 0x02 -#define COLOR_CYAN 0x03 -#define COLOR_VIOLET 0x04 +#define COLOR_BLACK 0x00 +#define COLOR_WHITE 0x01 +#define COLOR_RED 0x02 +#define COLOR_CYAN 0x03 +#define COLOR_VIOLET 0x04 #define COLOR_PURPLE COLOR_VIOLET -#define COLOR_GREEN 0x05 -#define COLOR_BLUE 0x06 -#define COLOR_YELLOW 0x07 -#define COLOR_ORANGE 0x08 -#define COLOR_BROWN 0x09 -#define COLOR_LIGHTRED 0x0A -#define COLOR_GRAY1 0x0B -#define COLOR_GRAY2 0x0C -#define COLOR_LIGHTGREEN 0x0D -#define COLOR_LIGHTBLUE 0x0E -#define COLOR_GRAY3 0x0F +#define COLOR_GREEN 0x05 +#define COLOR_BLUE 0x06 +#define COLOR_YELLOW 0x07 +#define COLOR_ORANGE 0x08 +#define COLOR_BROWN 0x09 +#define COLOR_LIGHTRED 0x0A +#define COLOR_GRAY1 0x0B +#define COLOR_GRAY2 0x0C +#define COLOR_LIGHTGREEN 0x0D +#define COLOR_LIGHTBLUE 0x0E +#define COLOR_GRAY3 0x0F /* Define hardware */ #include <_vic2.h> -#define VIC (*(struct __vic2*)0xD800) +#define VIC (*(struct __vic2*)0xD800) #include <_sid.h> -#define SID (*(struct __sid*)0xDA00) +#define SID (*(struct __sid*)0xDA00) #include <_6526.h> -#define CIA (*(struct __6526*)0xDC00) +#define CIA (*(struct __6526*)0xDC00) #include <_6551.h> -#define ACIA (*(struct __6551*)0xDD00) +#define ACIA (*(struct __6551*)0xDD00) #include <_6525.h> -#define TPI1 (*(struct __6525*)0xDE00) -#define TPI2 (*(struct __6525*)0xDF00) +#define TPI1 (*(struct __6525*)0xDE00) +#define TPI2 (*(struct __6525*)0xDF00) @@ -119,13 +119,13 @@ /* The addresses of the static drivers */ extern void cbm510_ram_emd[]; -extern void cbm510_std_joy[]; /* Referred to by joy_static_stddrv[] */ +extern void cbm510_std_joy[]; /* Referred to by joy_static_stddrv[] */ extern void cbm510_std_ser[]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/cbm610.h b/include/cbm610.h index 523b49577..84ea12ece 100644 --- a/include/cbm610.h +++ b/include/cbm610.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* cbm610.h */ +/* cbm610.h */ /* */ -/* CBM610 system specific definitions */ +/* CBM610 system specific definitions */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -74,15 +74,15 @@ #define CH_F20 243 /* Color defines */ -#define COLOR_BLACK 0x00 -#define COLOR_WHITE 0x01 +#define COLOR_BLACK 0x00 +#define COLOR_WHITE 0x01 /* Define hardware */ #include <_6545.h> #define CRTC (*(struct __6545)0xD800) #include <_sid.h> -#define SID (*(struct __sid*)0xDA00) +#define SID (*(struct __sid*)0xDA00) #include <_6526.h> #define CIA (*(struct __6526*)0xDC00) @@ -109,7 +109,7 @@ extern void cbm610_std_ser[]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/cc65.h b/include/cc65.h index e1c23e1bc..5607eab7b 100644 --- a/include/cc65.h +++ b/include/cc65.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/conio.h b/include/conio.h index 21a0c1ea7..ab446ad42 100644 --- a/include/conio.h +++ b/include/conio.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* conio.h */ +/* conio.h */ /* */ -/* Direct console I/O */ +/* Direct console I/O */ /* */ /* */ /* */ @@ -82,7 +82,7 @@ /*****************************************************************************/ -/* Functions */ +/* Functions */ /*****************************************************************************/ diff --git a/include/ctype.h b/include/ctype.h index 8437e2c2c..4c7f976d2 100644 --- a/include/ctype.h +++ b/include/ctype.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* ctype.h */ +/* ctype.h */ /* */ -/* Character handling */ +/* Character handling */ /* */ /* */ /* */ @@ -41,21 +41,21 @@ extern unsigned char _ctype[256]; /* Bits used to specify character classes */ -#define _CT_LOWER 0x01 /* 0 - Lower case char */ -#define _CT_UPPER 0x02 /* 1 - Upper case char */ -#define _CT_DIGIT 0x04 /* 2 - Numeric digit */ -#define _CT_XDIGIT 0x08 /* 3 - Hex digit (both lower and upper) */ -#define _CT_CNTRL 0x10 /* 4 - Control character */ -#define _CT_SPACE 0x20 /* 5 - The space character itself */ -#define _CT_OTHER_WS 0x40 /* 6 - Other whitespace ('\f', '\n', '\r', '\t', and '\v') */ -#define _CT_SPACE_TAB 0x80 /* 7 - Space or tab character */ +#define _CT_LOWER 0x01 /* 0 - Lower case char */ +#define _CT_UPPER 0x02 /* 1 - Upper case char */ +#define _CT_DIGIT 0x04 /* 2 - Numeric digit */ +#define _CT_XDIGIT 0x08 /* 3 - Hex digit (both lower and upper) */ +#define _CT_CNTRL 0x10 /* 4 - Control character */ +#define _CT_SPACE 0x20 /* 5 - The space character itself */ +#define _CT_OTHER_WS 0x40 /* 6 - Other whitespace ('\f', '\n', '\r', '\t', and '\v') */ +#define _CT_SPACE_TAB 0x80 /* 7 - Space or tab character */ /* Bit combinations */ -#define _CT_ALNUM (_CT_LOWER | _CT_UPPER | _CT_DIGIT) -#define _CT_ALPHA (_CT_LOWER | _CT_UPPER) -#define _CT_NOT_GRAPH (_CT_CNTRL | _CT_SPACE) +#define _CT_ALNUM (_CT_LOWER | _CT_UPPER | _CT_DIGIT) +#define _CT_ALPHA (_CT_LOWER | _CT_UPPER) +#define _CT_NOT_GRAPH (_CT_CNTRL | _CT_SPACE) #define _CT_NOT_PRINT (_CT_CNTRL) -#define _CT_NOT_PUNCT (_CT_SPACE | _CT_CNTRL | _CT_DIGIT | _CT_UPPER | _CT_LOWER) +#define _CT_NOT_PUNCT (_CT_SPACE | _CT_CNTRL | _CT_DIGIT | _CT_UPPER | _CT_LOWER) #define _CT_WS (_CT_SPACE | _CT_OTHER_WS) /* Character classification functions */ @@ -71,11 +71,11 @@ int __fastcall__ isspace (int c); int __fastcall__ isupper (int c); int __fastcall__ isxdigit (int c); #if __CC65_STD__ >= __CC65_STD_C99__ -int __fastcall__ isblank (int c); /* New in C99 */ +int __fastcall__ isblank (int c); /* New in C99 */ #endif -int __fastcall__ toupper (int c); /* Always external */ -int __fastcall__ tolower (int c); /* Always external */ +int __fastcall__ toupper (int c); /* Always external */ +int __fastcall__ tolower (int c); /* Always external */ #if __CC65_STD__ >= __CC65_STD_CC65__ unsigned char __fastcall__ toascii (unsigned char c); @@ -95,83 +95,83 @@ unsigned char __fastcall__ toascii (unsigned char c); #define isalnum(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_ALNUM), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_ALNUM), \ __AX__) #define isalpha(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_ALPHA), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_ALPHA), \ __AX__) #if __CC65_STD__ >= __CC65_STD_C99__ #define isblank(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_SPACE_TAB), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_SPACE_TAB), \ __AX__) #endif #define iscntrl(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_CNTRL), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_CNTRL), \ __AX__) #define isdigit(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_DIGIT), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_DIGIT), \ __AX__) #define isgraph(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_NOT_GRAPH), \ - __asm__ ("cmp #1"), \ - __asm__ ("lda #1"), \ - __asm__ ("sbc #1"), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_NOT_GRAPH), \ + __asm__ ("cmp #1"), \ + __asm__ ("lda #1"), \ + __asm__ ("sbc #1"), \ __AX__) #define islower(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_LOWER), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_LOWER), \ __AX__) #define isprint(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_NOT_PRINT), \ - __asm__ ("eor #%b", _CT_NOT_PRINT), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_NOT_PRINT), \ + __asm__ ("eor #%b", _CT_NOT_PRINT), \ __AX__) #define ispunct(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_NOT_PUNCT), \ - __asm__ ("cmp #1"), \ - __asm__ ("lda #1"), \ - __asm__ ("sbc #1"), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_NOT_PUNCT), \ + __asm__ ("cmp #1"), \ + __asm__ ("lda #1"), \ + __asm__ ("sbc #1"), \ __AX__) #define isspace(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_WS), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_WS), \ __AX__) #define isupper(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_UPPER), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_UPPER), \ __AX__) #define isxdigit(c) (__AX__ = (c), \ __asm__ ("tay"), \ - __asm__ ("lda %v,y", _ctype), \ - __asm__ ("and #%b", _CT_XDIGIT), \ + __asm__ ("lda %v,y", _ctype), \ + __asm__ ("and #%b", _CT_XDIGIT), \ __AX__) #endif diff --git a/include/dbg.h b/include/dbg.h index 4749b18be..5156658f0 100644 --- a/include/dbg.h +++ b/include/dbg.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* dbg.h */ +/* dbg.h */ /* */ -/* Debugger module interface */ +/* Debugger module interface */ /* */ /* */ /* */ @@ -61,7 +61,7 @@ /*****************************************************************************/ -/* Utility functions */ +/* Utility functions */ /*****************************************************************************/ @@ -101,7 +101,7 @@ char* DbgMemDump (unsigned Addr, char* Buf, unsigned char Len); /*****************************************************************************/ -/* High level user interface */ +/* High level user interface */ /*****************************************************************************/ @@ -111,7 +111,7 @@ void __fastcall__ DbgInit (unsigned unused); * next brk encountered. */ -#define BREAK() __asm__ ("brk") +#define BREAK() __asm__ ("brk") /* Use this to insert breakpoints into your code */ diff --git a/include/dirent.h b/include/dirent.h index 010db6a11..993036a1b 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -36,7 +36,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -113,11 +113,11 @@ struct dirent { #elif defined(__LYNX__) struct dirent { - unsigned char d_blocks; - unsigned int d_offset; - char d_type; - void *d_address; - unsigned int d_size; + unsigned char d_blocks; + unsigned int d_offset; + char d_type; + void *d_address; + unsigned int d_size; }; extern struct dirent FileEntry; @@ -144,7 +144,7 @@ struct dirent { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/em.h b/include/em.h index 8b409cac2..28836f2b1 100644 --- a/include/em.h +++ b/include/em.h @@ -71,7 +71,7 @@ struct em_copy { /*****************************************************************************/ -/* Functions */ +/* Functions */ /*****************************************************************************/ diff --git a/include/em/em-kernel.h b/include/em/em-kernel.h index 04757499c..48cbbe8f7 100644 --- a/include/em/em-kernel.h +++ b/include/em/em-kernel.h @@ -60,7 +60,7 @@ typedef struct { void* map; /* MAP routine */ void* use; /* USE routine */ void* mapclean; /* MAPCLEAN routine */ - void* copyfrom; /* COPYFROM routine */ + void* copyfrom; /* COPYFROM routine */ void* copyto; /* COPYTO routine */ } em_drv_header; @@ -68,7 +68,7 @@ typedef struct { /* EM kernel variables */ -extern em_drv_header* em_drv; /* Pointer to driver */ +extern em_drv_header* em_drv; /* Pointer to driver */ diff --git a/include/errno.h b/include/errno.h index 60f069dac..468e7d4ea 100644 --- a/include/errno.h +++ b/include/errno.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* errno.h */ +/* errno.h */ /* */ -/* Error codes */ +/* Error codes */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -56,23 +56,23 @@ extern int _errno; /* Possible error codes */ -#define ENOENT 1 /* No such file or directory */ -#define ENOMEM 2 /* Out of memory */ -#define EACCES 3 /* Permission denied */ -#define ENODEV 4 /* No such device */ -#define EMFILE 5 /* Too many open files */ -#define EBUSY 6 /* Device or resource busy */ -#define EINVAL 7 /* Invalid argument */ -#define ENOSPC 8 /* No space left on device */ -#define EEXIST 9 /* File exists */ -#define EAGAIN 10 /* Try again */ -#define EIO 11 /* I/O error */ -#define EINTR 12 /* Interrupted system call */ -#define ENOSYS 13 /* Function not implemented */ -#define ESPIPE 14 /* Illegal seek */ +#define ENOENT 1 /* No such file or directory */ +#define ENOMEM 2 /* Out of memory */ +#define EACCES 3 /* Permission denied */ +#define ENODEV 4 /* No such device */ +#define EMFILE 5 /* Too many open files */ +#define EBUSY 6 /* Device or resource busy */ +#define EINVAL 7 /* Invalid argument */ +#define ENOSPC 8 /* No space left on device */ +#define EEXIST 9 /* File exists */ +#define EAGAIN 10 /* Try again */ +#define EIO 11 /* I/O error */ +#define EINTR 12 /* Interrupted system call */ +#define ENOSYS 13 /* Function not implemented */ +#define ESPIPE 14 /* Illegal seek */ #define ERANGE 15 /* Range error */ #define EBADF 16 /* Bad file number */ -#define EUNKNOWN 17 /* Unknown OS specific error */ +#define EUNKNOWN 17 /* Unknown OS specific error */ diff --git a/include/fcntl.h b/include/fcntl.h index fd86c7a19..0d2398315 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* fcntl.h */ +/* fcntl.h */ /* */ /* File control operations */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -56,13 +56,13 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ /* Functions */ -int open (const char* name, int flags, ...); /* May take a mode argument */ +int open (const char* name, int flags, ...); /* May take a mode argument */ int __fastcall__ close (int fd); int __fastcall__ creat (const char* name, unsigned mode); diff --git a/include/geos.h b/include/geos.h index 2491d2f09..65b85cd59 100644 --- a/include/geos.h +++ b/include/geos.h @@ -68,70 +68,70 @@ #endif -#define CH_ULCORNER '+' -#define CH_URCORNER '+' -#define CH_LLCORNER '+' -#define CH_LRCORNER '+' -#define CH_TTEE '+' -#define CH_RTEE '+' -#define CH_BTEE '+' -#define CH_LTEE '+' -#define CH_CROSS '+' +#define CH_ULCORNER '+' +#define CH_URCORNER '+' +#define CH_LLCORNER '+' +#define CH_LRCORNER '+' +#define CH_TTEE '+' +#define CH_RTEE '+' +#define CH_BTEE '+' +#define CH_LTEE '+' +#define CH_CROSS '+' -#define CH_F1 KEY_F1 -#define CH_F2 KEY_F2 -#define CH_F3 KEY_F3 -#define CH_F4 KEY_F4 -#define CH_F5 KEY_F5 -#define CH_F6 KEY_F6 -#define CH_F7 KEY_F7 -#define CH_F8 KEY_F8 +#define CH_F1 KEY_F1 +#define CH_F2 KEY_F2 +#define CH_F3 KEY_F3 +#define CH_F4 KEY_F4 +#define CH_F5 KEY_F5 +#define CH_F6 KEY_F6 +#define CH_F7 KEY_F7 +#define CH_F8 KEY_F8 -#define CH_CURS_UP KEY_UP -#define CH_CURS_DOWN KEY_DOWN -#define CH_CURS_LEFT KEY_LEFT -#define CH_CURS_RIGHT KEY_RIGHT -#define CH_DEL KEY_DELETE -#define CH_INS KEY_INSERT -#define CH_ENTER KEY_ENTER -#define CH_STOP KEY_STOP -#define CH_ESC KEY_ESC +#define CH_CURS_UP KEY_UP +#define CH_CURS_DOWN KEY_DOWN +#define CH_CURS_LEFT KEY_LEFT +#define CH_CURS_RIGHT KEY_RIGHT +#define CH_DEL KEY_DELETE +#define CH_INS KEY_INSERT +#define CH_ENTER KEY_ENTER +#define CH_STOP KEY_STOP +#define CH_ESC KEY_ESC -#define COLOR_BLACK BLACK -#define COLOR_WHITE WHITE -#define COLOR_RED RED -#define COLOR_CYAN CYAN -#define COLOR_VIOLET PURPLE -#define COLOR_PURPLE PURPLE -#define COLOR_GREEN GREEN -#define COLOR_BLUE BLUE -#define COLOR_YELLOW YELLOW -#define COLOR_ORANGE ORANGE -#define COLOR_BROWN BROWN -#define COLOR_LIGHTRED LTRED -#define COLOR_GRAY1 DKGREY -#define COLOR_GRAY2 MEDGREY -#define COLOR_LIGHTGREEN LTGREEN -#define COLOR_LIGHTBLUE LTBLUE -#define COLOR_GRAY3 LTGREY +#define COLOR_BLACK BLACK +#define COLOR_WHITE WHITE +#define COLOR_RED RED +#define COLOR_CYAN CYAN +#define COLOR_VIOLET PURPLE +#define COLOR_PURPLE PURPLE +#define COLOR_GREEN GREEN +#define COLOR_BLUE BLUE +#define COLOR_YELLOW YELLOW +#define COLOR_ORANGE ORANGE +#define COLOR_BROWN BROWN +#define COLOR_LIGHTRED LTRED +#define COLOR_GRAY1 DKGREY +#define COLOR_GRAY2 MEDGREY +#define COLOR_LIGHTGREEN LTGREEN +#define COLOR_LIGHTBLUE LTBLUE +#define COLOR_GRAY3 LTGREY -#define TGI_COLOR_BLACK COLOR_BLACK -#define TGI_COLOR_WHITE COLOR_WHITE -#define TGI_COLOR_RED COLOR_RED -#define TGI_COLOR_CYAN COLOR_CYAN -#define TGI_COLOR_VIOLET COLOR_VIOLET -#define TGI_COLOR_PURPLE COLOR_PURPLE -#define TGI_COLOR_GREEN COLOR_GREEN -#define TGI_COLOR_BLUE COLOR_BLUE -#define TGI_COLOR_YELLOW COLOR_YELLOW -#define TGI_COLOR_ORANGE COLOR_ORANGE -#define TGI_COLOR_BROWN COLOR_BROWN -#define TGI_COLOR_LIGHTRED COLOR_LIGHTRED -#define TGI_COLOR_GRAY1 COLOR_GRAY1 -#define TGI_COLOR_GRAY2 COLOR_GRAY2 -#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN -#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE -#define TGI_COLOR_GRAY3 COLOR_GRAY3 +#define TGI_COLOR_BLACK COLOR_BLACK +#define TGI_COLOR_WHITE COLOR_WHITE +#define TGI_COLOR_RED COLOR_RED +#define TGI_COLOR_CYAN COLOR_CYAN +#define TGI_COLOR_VIOLET COLOR_VIOLET +#define TGI_COLOR_PURPLE COLOR_PURPLE +#define TGI_COLOR_GREEN COLOR_GREEN +#define TGI_COLOR_BLUE COLOR_BLUE +#define TGI_COLOR_YELLOW COLOR_YELLOW +#define TGI_COLOR_ORANGE COLOR_ORANGE +#define TGI_COLOR_BROWN COLOR_BROWN +#define TGI_COLOR_LIGHTRED COLOR_LIGHTRED +#define TGI_COLOR_GRAY1 COLOR_GRAY1 +#define TGI_COLOR_GRAY2 COLOR_GRAY2 +#define TGI_COLOR_LIGHTGREEN COLOR_LIGHTGREEN +#define TGI_COLOR_LIGHTBLUE COLOR_LIGHTBLUE +#define TGI_COLOR_GRAY3 COLOR_GRAY3 /* End of geos.h */ diff --git a/include/geos/gconst.h b/include/geos/gconst.h index 4847c3286..e70eb9304 100644 --- a/include/geos/gconst.h +++ b/include/geos/gconst.h @@ -9,59 +9,59 @@ #ifndef _GCONST_H #define _GCONST_H -#define NULL 0 -#define FALSE NULL -#define TRUE 0xff -#define MOUSE_SPRNUM 0 -#define DISK_DRV_LGH 0x0d80 +#define NULL 0 +#define FALSE NULL +#define TRUE 0xff +#define MOUSE_SPRNUM 0 +#define DISK_DRV_LGH 0x0d80 /* drivetypes */ -#define DRV_NULL 0 -#define DRV_1541 1 -#define DRV_1571 2 -#define DRV_1581 3 -#define DRV_NETWORK 15 +#define DRV_NULL 0 +#define DRV_1541 1 +#define DRV_1571 2 +#define DRV_1581 3 +#define DRV_NETWORK 15 /* various disk constants */ -#define REL_FILE_NUM 9 -#define CMND_FILE_NUM 15 -#define MAX_CMND_STR 32 -#define DIR_1581_TRACK 40 -#define DIR_ACC_CHAN 13 -#define DIR_TRACK 18 -#define N_TRACKS 35 -#define DK_NM_ID_LEN 18 -#define TRACK 9 -#define SECTOR 12 -#define TOTAL_BLOCKS 664 +#define REL_FILE_NUM 9 +#define CMND_FILE_NUM 15 +#define MAX_CMND_STR 32 +#define DIR_1581_TRACK 40 +#define DIR_ACC_CHAN 13 +#define DIR_TRACK 18 +#define N_TRACKS 35 +#define DK_NM_ID_LEN 18 +#define TRACK 9 +#define SECTOR 12 +#define TOTAL_BLOCKS 664 /* offset to something */ -#define OFF_INDEX_PTR 1 +#define OFF_INDEX_PTR 1 /* values for CPU_DATA memory config - C64 */ -#define IO_IN 0x35 -#define KRNL_IO_IN 0x36 -#define KRNL_BAS_IO_IN 0x37 +#define IO_IN 0x35 +#define KRNL_IO_IN 0x36 +#define KRNL_BAS_IO_IN 0x37 /* values for MMU config - C128 */ -#define CIOIN 0x7E -#define CRAM64K 0x7F -#define CKRNLBASIOIN 0x40 -#define CKRNLIOIN 0x4E +#define CIOIN 0x7E +#define CRAM64K 0x7F +#define CKRNLBASIOIN 0x40 +#define CKRNLIOIN 0x4E /* alarmSetFlag */ -#define ALARMMASK 4 +#define ALARMMASK 4 -#define CLR_SAVE 0x40 -#define CONSTRAINED 0x40 -#define UN_CONSTRAINED 0 -#define FG_SAVE 0x80 +#define CLR_SAVE 0x40 +#define CONSTRAINED 0x40 +#define UN_CONSTRAINED 0 +#define FG_SAVE 0x80 -#define FUTURE1 7 -#define FUTURE2 8 -#define FUTURE3 9 -#define FUTURE4 10 -#define USELAST 127 -#define SHORTCUT 128 +#define FUTURE1 7 +#define FUTURE2 8 +#define FUTURE3 9 +#define FUTURE4 10 +#define USELAST 127 +#define SHORTCUT 128 #endif diff --git a/include/geos/gdisk.h b/include/geos/gdisk.h index ac6438117..f65d7d301 100644 --- a/include/geos/gdisk.h +++ b/include/geos/gdisk.h @@ -4,7 +4,7 @@ by Maciej 'YTM/Elysium' Witkowiak */ -#ifndef _GDISK_H +#ifndef _GDISK_H #define _GDISK_H #ifndef _GSTRUCT_H @@ -29,7 +29,7 @@ char OpenDisk(void); char __fastcall__ FindBAMBit(struct tr_se *myTrSe); char __fastcall__ BlkAlloc(struct tr_se output[], unsigned length); char __fastcall__ NxtBlkAlloc(struct tr_se *startTrSe, - struct tr_se output[], unsigned length); + struct tr_se output[], unsigned length); char __fastcall__ FreeBlock(struct tr_se *myTrSe); struct tr_se __fastcall__ SetNextFree(struct tr_se *myTrSe); // above needs (unsigned) casts on both sides of '=' @@ -44,38 +44,38 @@ void PurgeTurbo(void); char __fastcall__ ChangeDiskDevice(char newdev); -/* disk header offsets i.e. index curDirHead with these */ -#define OFF_TO_BAM 4 -#define OFF_DISK_NAME 144 -#define OFF_GS_DTYPE 189 -#define OFF_OP_TR_SC 171 -#define OFF_GS_ID 173 +/* disk header offsets i.e. index curDirHead with these */ +#define OFF_TO_BAM 4 +#define OFF_DISK_NAME 144 +#define OFF_GS_DTYPE 189 +#define OFF_OP_TR_SC 171 +#define OFF_GS_ID 173 /* disk errors reported in _oserror */ -#define ANY_FAULT 0xf0 -#define G_EOF 0 -#define NO_BLOCKS 1 -#define INV_TRACK 2 -#define INSUFF_SPACE 3 -#define FULL_DIRECTORY 4 -#define FILE_NOT_FOUND 5 -#define BAD_BAM 6 -#define UNOPENED_VLIR 7 -#define INV_RECORD 8 -#define OUT_OF_RECORDS 9 -#define STRUCT_MISMAT 10 -#define BFR_OVERFLOW 11 -#define CANCEL_ERR 12 -#define DEV_NOT_FOUND 13 -#define INCOMPATIBLE 14 -#define HDR_NOT_THERE 0x20 -#define NO_SYNC 0x21 -#define DBLK_NOT_THERE 0x22 -#define DAT_CHKSUM_ERR 0x23 -#define WR_VER_ERR 0x25 -#define WR_PR_ON 0x26 -#define HDR_CHKSUM_ERR 0x27 -#define DSK_ID_MISMAT 0x29 -#define BYTE_DEC_ERR 0x2e -#define DOS_MISMATCH 0x73 +#define ANY_FAULT 0xf0 +#define G_EOF 0 +#define NO_BLOCKS 1 +#define INV_TRACK 2 +#define INSUFF_SPACE 3 +#define FULL_DIRECTORY 4 +#define FILE_NOT_FOUND 5 +#define BAD_BAM 6 +#define UNOPENED_VLIR 7 +#define INV_RECORD 8 +#define OUT_OF_RECORDS 9 +#define STRUCT_MISMAT 10 +#define BFR_OVERFLOW 11 +#define CANCEL_ERR 12 +#define DEV_NOT_FOUND 13 +#define INCOMPATIBLE 14 +#define HDR_NOT_THERE 0x20 +#define NO_SYNC 0x21 +#define DBLK_NOT_THERE 0x22 +#define DAT_CHKSUM_ERR 0x23 +#define WR_VER_ERR 0x25 +#define WR_PR_ON 0x26 +#define HDR_CHKSUM_ERR 0x27 +#define DSK_ID_MISMAT 0x29 +#define BYTE_DEC_ERR 0x2e +#define DOS_MISMATCH 0x73 #endif diff --git a/include/geos/gdlgbox.h b/include/geos/gdlgbox.h index b1433fea4..bca890383 100644 --- a/include/geos/gdlgbox.h +++ b/include/geos/gdlgbox.h @@ -4,22 +4,22 @@ by Maciej 'YTM/Elysium' Witkowiak */ -#ifndef _GDLGBOX_H +#ifndef _GDLGBOX_H #define _GDLGBOX_H char __fastcall__ DoDlgBox(const char *dboxstring); char RstrFrmDialogue(void); /* These are custom, predefined dialog boxes, I'm sure you'll find them usable - Most of them show 2 lines of text */ + Most of them show 2 lines of text */ char __fastcall__ DlgBoxYesNo(const char *line1, const char *line2); char __fastcall__ DlgBoxOkCancel(const char *line1, const char *line2); void __fastcall__ DlgBoxOk(const char *line1, const char *line2); char __fastcall__ DlgBoxGetString(char *myString, char strLength, - const char *line1, const char *line2); + const char *line1, const char *line2); char __fastcall__ DlgBoxFileSelect(const char *classtxt, char ftype, - char *fname); + char *fname); /* This is a more general dialog box, works like printf in a window */ char MessageBox(char mode, const char *format, ...); @@ -40,8 +40,8 @@ typedef void dlgBoxStr; #define DB_DEFPOS(pattern) (char)(DEF_DB_POS | (pattern)) #define DB_SETPOS(pattern,top,bot,left,right) \ - (char)(SET_DB_POS | (pattern)), (char)(top), (char)(bot), \ - (unsigned)(left), (unsigned)(right) + (char)(SET_DB_POS | (pattern)), (char)(top), (char)(bot), \ + (unsigned)(left), (unsigned)(right) #define DB_ICON(i,x,y) (char)(i), (char)(x), (char)(y) #define DB_TXTSTR(x,y,text) (char)DBTXTSTR, (char)(x), (char)(y), (text) #define DB_VARSTR(x,y,ptr) (char)DBVARSTR, (char)(x), (char)(y), (char)(ptr) @@ -59,52 +59,52 @@ typedef void dlgBoxStr; */ /* icons for DB_ICON */ -#define OK 1 -#define CANCEL 2 -#define YES 3 -#define NO 4 -#define OPEN 5 -#define DISK 6 +#define OK 1 +#define CANCEL 2 +#define YES 3 +#define NO 4 +#define OPEN 5 +#define DISK 6 /* commands - internally used by command macros */ -#define DBTXTSTR 11 -#define DBVARSTR 12 -#define DBGETSTRING 13 -#define DBSYSOPV 14 -#define DBGRPHSTR 15 -#define DBGETFILES 16 -#define DBOPVEC 17 -#define DBUSRICON 18 -#define DB_USR_ROUT 19 +#define DBTXTSTR 11 +#define DBVARSTR 12 +#define DBGETSTRING 13 +#define DBSYSOPV 14 +#define DBGRPHSTR 15 +#define DBGETFILES 16 +#define DBOPVEC 17 +#define DBUSRICON 18 +#define DB_USR_ROUT 19 /* icons tabulation in standard window */ -#define DBI_X_0 1 -#define DBI_X_1 9 -#define DBI_X_2 17 -#define DBI_Y_0 8 -#define DBI_Y_1 40 -#define DBI_Y_2 72 +#define DBI_X_0 1 +#define DBI_X_1 9 +#define DBI_X_2 17 +#define DBI_Y_0 8 +#define DBI_Y_1 40 +#define DBI_Y_2 72 /* standard window size defaults */ -#define SET_DB_POS 0 -#define DEF_DB_POS 0x80 -#define DEF_DB_TOP 32 -#define DEF_DB_BOT 127 -#define DEF_DB_LEFT 64 -#define DEF_DB_RIGHT 255 +#define SET_DB_POS 0 +#define DEF_DB_POS 0x80 +#define DEF_DB_TOP 32 +#define DEF_DB_BOT 127 +#define DEF_DB_LEFT 64 +#define DEF_DB_RIGHT 255 /* text tabulation in standard window */ -#define TXT_LN_1_Y 16 -#define TXT_LN_2_Y 32 -#define TXT_LN_3_Y 48 -#define TXT_LN_4_Y 64 -#define TXT_LN_5_Y 80 -#define TXT_LN_X 16 +#define TXT_LN_1_Y 16 +#define TXT_LN_2_Y 32 +#define TXT_LN_3_Y 48 +#define TXT_LN_4_Y 64 +#define TXT_LN_5_Y 80 +#define TXT_LN_X 16 /* system icons size */ -#define SYSDBI_HEIGHT 16 -#define SYSDBI_WIDTH 6 +#define SYSDBI_HEIGHT 16 +#define SYSDBI_WIDTH 6 /* dialogbox string offsets */ -#define OFF_DB_FORM 0 -#define OFF_DB_TOP 1 -#define OFF_DB_BOT 2 -#define OFF_DB_LEFT 3 -#define OFF_DB_RIGHT 5 -#define OFF_DB_1STCMD 7 +#define OFF_DB_FORM 0 +#define OFF_DB_TOP 1 +#define OFF_DB_BOT 2 +#define OFF_DB_LEFT 3 +#define OFF_DB_RIGHT 5 +#define OFF_DB_1STCMD 7 #endif diff --git a/include/geos/gfile.h b/include/geos/gfile.h index e574e4418..d7667d8ec 100644 --- a/include/geos/gfile.h +++ b/include/geos/gfile.h @@ -4,7 +4,7 @@ by Maciej 'YTM/Elysium' Witkowiak */ -#ifndef _GFILE_H +#ifndef _GFILE_H #define _GFILE_H #ifndef _GSTRUCT_H @@ -43,32 +43,32 @@ char __fastcall__ WriteRecord(const char *buffer, unsigned flength); char UpdateRecordFile(void); /* GEOS filetypes */ -#define NOT_GEOS 0 -#define BASIC 1 -#define ASSEMBLY 2 -#define DATA 3 -#define SYSTEM 4 -#define DESK_ACC 5 -#define APPLICATION 6 -#define APPL_DATA 7 -#define FONT 8 -#define PRINTER 9 -#define INPUT_DEVICE 10 -#define DISK_DEVICE 11 -#define SYSTEM_BOOT 12 -#define TEMPORARY 13 -#define AUTO_EXEC 14 -#define INPUT_128 15 -#define NUMFILETYPES 16 +#define NOT_GEOS 0 +#define BASIC 1 +#define ASSEMBLY 2 +#define DATA 3 +#define SYSTEM 4 +#define DESK_ACC 5 +#define APPLICATION 6 +#define APPL_DATA 7 +#define FONT 8 +#define PRINTER 9 +#define INPUT_DEVICE 10 +#define DISK_DEVICE 11 +#define SYSTEM_BOOT 12 +#define TEMPORARY 13 +#define AUTO_EXEC 14 +#define INPUT_128 15 +#define NUMFILETYPES 16 /* supported structures */ -#define SEQUENTIAL 0 -#define VLIR 1 +#define SEQUENTIAL 0 +#define VLIR 1 /* DOS filetypes */ -#define DEL 0 -#define SEQ 1 -#define PRG 2 -#define USR 3 -#define REL 4 -#define CBM 5 +#define DEL 0 +#define SEQ 1 +#define PRG 2 +#define USR 3 +#define REL 4 +#define CBM 5 #endif diff --git a/include/geos/ggraph.h b/include/geos/ggraph.h index 184ec4e1d..961ec2d80 100644 --- a/include/geos/ggraph.h +++ b/include/geos/ggraph.h @@ -4,7 +4,7 @@ by Maciej 'YTM/Elysium' Witkowiak */ -#ifndef _GGRAPH_H +#ifndef _GGRAPH_H #define _GGRAPH_H #ifndef _GSTRUCT_H @@ -40,125 +40,125 @@ void UseSystemFont(void); void __fastcall__ BitmapUp(struct iconpic *myIcon); void __fastcall__ BitmapClip(char skipl, char skipr, unsigned skiptop, - struct iconpic *myIcon); + struct iconpic *myIcon); void __fastcall__ BitOtherClip(void *proc1, void *proc2, char skipl, - char skipr, unsigned skiptop, - struct iconpic *myIcon); + char skipr, unsigned skiptop, + struct iconpic *myIcon); void __fastcall__ GraphicsString(char *myGfxString); /* VIC colour constants */ -#define BLACK 0 -#define WHITE 1 -#define RED 2 -#define CYAN 3 -#define PURPLE 4 -#define GREEN 5 -#define BLUE 6 -#define YELLOW 7 -#define ORANGE 8 -#define BROWN 9 -#define LTRED 10 -#define DKGREY 11 -#define GREY 12 -#define MEDGREY 12 -#define LTGREEN 13 -#define LTBLUE 14 -#define LTGREY 15 +#define BLACK 0 +#define WHITE 1 +#define RED 2 +#define CYAN 3 +#define PURPLE 4 +#define GREEN 5 +#define BLUE 6 +#define YELLOW 7 +#define ORANGE 8 +#define BROWN 9 +#define LTRED 10 +#define DKGREY 11 +#define GREY 12 +#define MEDGREY 12 +#define LTGREEN 13 +#define LTBLUE 14 +#define LTGREY 15 /* VIC memory banks - lowest 2 bits of cia2base+0 */ -#define GRBANK0 3 -#define GRBANK1 2 -#define GRBANK2 1 -#define GRBANK3 0 +#define GRBANK0 3 +#define GRBANK1 2 +#define GRBANK2 1 +#define GRBANK3 0 /* VIC screen sizes */ -#define VIC_X_POS_OFF 24 -#define VIC_Y_POS_OFF 50 +#define VIC_X_POS_OFF 24 +#define VIC_Y_POS_OFF 50 #ifdef __GEOS_CBM__ -#define SC_BYTE_WIDTH 40 -#define SC_PIX_HEIGHT 200 -#define SC_PIX_WIDTH 320 -#define SC_SIZE 8000 +#define SC_BYTE_WIDTH 40 +#define SC_PIX_HEIGHT 200 +#define SC_PIX_WIDTH 320 +#define SC_SIZE 8000 #else -#define SC_BYTE_WIDTH 70 -#define SC_PIX_HEIGHT 192 -#define SC_PIX_WIDTH 560 -#define SC_SIZE 13440 +#define SC_BYTE_WIDTH 70 +#define SC_PIX_HEIGHT 192 +#define SC_PIX_WIDTH 560 +#define SC_SIZE 13440 #endif -/* VDC screen constants */ -#define SCREENBYTEWIDTH 80 -#define SCREENPIXELWIDTH 640 +/* VDC screen constants */ +#define SCREENBYTEWIDTH 80 +#define SCREENPIXELWIDTH 640 /* control characters for use as numbers, not characters */ -#define BACKSPACE 8 -#define FORWARDSPACE 9 -#define TAB 9 -#define LF 10 -#define HOME 11 -#define PAGE_BREAK 12 -#define UPLINE 12 -#define CR 13 -#define ULINEON 14 -#define ULINEOFF 15 -#define ESC_GRAPHICS 16 -#define ESC_RULER 17 -#define REV_ON 18 -#define REV_OFF 19 -#define GOTOX 20 -#define GOTOY 21 -#define GOTOXY 22 -#define NEWCARDSET 23 -#define BOLDON 24 -#define ITALICON 25 -#define OUTLINEON 26 -#define PLAINTEXT 27 +#define BACKSPACE 8 +#define FORWARDSPACE 9 +#define TAB 9 +#define LF 10 +#define HOME 11 +#define PAGE_BREAK 12 +#define UPLINE 12 +#define CR 13 +#define ULINEON 14 +#define ULINEOFF 15 +#define ESC_GRAPHICS 16 +#define ESC_RULER 17 +#define REV_ON 18 +#define REV_OFF 19 +#define GOTOX 20 +#define GOTOY 21 +#define GOTOXY 22 +#define NEWCARDSET 23 +#define BOLDON 24 +#define ITALICON 25 +#define OUTLINEON 26 +#define PLAINTEXT 27 /* control characters for use in strings: eg: str[10]=CBOLDON "Hello"; */ -#define CCR "\015" -#define CULINEON "\016" -#define CULINEOFF "\017" -#define CREV_ON "\022" -#define CREV_OFF "\023" -#define CBOLDON "\030" -#define CITALICON "\031" -#define COUTLINEON "\032" -#define CPLAINTEXT "\033" +#define CCR "\015" +#define CULINEON "\016" +#define CULINEOFF "\017" +#define CREV_ON "\022" +#define CREV_OFF "\023" +#define CBOLDON "\030" +#define CITALICON "\031" +#define COUTLINEON "\032" +#define CPLAINTEXT "\033" -/*values of currentMode */ +/*values of currentMode */ /* bitNumbers */ -#define UNDERLINE_BIT 7 -#define BOLD_BIT 6 -#define REVERSE_BIT 5 -#define ITALIC_BIT 4 -#define OUTLINE_BIT 3 -#define SUPERSCRIPT_BIT 2 -#define SUBSCRIPT_BIT 1 +#define UNDERLINE_BIT 7 +#define BOLD_BIT 6 +#define REVERSE_BIT 5 +#define ITALIC_BIT 4 +#define OUTLINE_BIT 3 +#define SUPERSCRIPT_BIT 2 +#define SUBSCRIPT_BIT 1 /* bitMasks */ -#define SET_UNDERLINE 0x80 -#define SET_BOLD 0x40 -#define SET_REVERSE 0x20 -#define SET_ITALIC 0x10 -#define SET_OUTLINE 0x08 -#define SET_SUPERSCRIPT 0x04 -#define SET_SUBSCRIPT 0x02 -#define SET_PLAINTEXT 0 +#define SET_UNDERLINE 0x80 +#define SET_BOLD 0x40 +#define SET_REVERSE 0x20 +#define SET_ITALIC 0x10 +#define SET_OUTLINE 0x08 +#define SET_SUPERSCRIPT 0x04 +#define SET_SUBSCRIPT 0x02 +#define SET_PLAINTEXT 0 /* values of dispBufferOn */ -#define ST_WRGS_FORE 0x20 -#define ST_WR_BACK 0x40 -#define ST_WR_FORE 0x80 +#define ST_WRGS_FORE 0x20 +#define ST_WR_BACK 0x40 +#define ST_WR_FORE 0x80 /* PutDecimal parameters */ /* leading zeros? */ -#define SET_NOSURPRESS 0 -#define SET_SURPRESS 0x40 +#define SET_NOSURPRESS 0 +#define SET_SURPRESS 0x40 /* justification */ -#define SET_RIGHTJUST 0 -#define SET_LEFTJUST 0x80 +#define SET_RIGHTJUST 0 +#define SET_LEFTJUST 0x80 /* C128 x-extension flags */ -#define ADD1_W 0x2000 -#define DOUBLE_B 0x80 -#define DOUBLE_W 0x8000 +#define ADD1_W 0x2000 +#define DOUBLE_B 0x80 +#define DOUBLE_W 0x8000 /* DrawLine/DrawPoint mode values */ -#define DRAW_ERASE 0x00 -#define DRAW_DRAW 0x40 -#define DRAW_COPY 0x80 +#define DRAW_ERASE 0x00 +#define DRAW_DRAW 0x40 +#define DRAW_COPY 0x80 typedef void graphicStr; diff --git a/include/geos/gmemory.h b/include/geos/gmemory.h index 87be6c1e8..3fba5cb5b 100644 --- a/include/geos/gmemory.h +++ b/include/geos/gmemory.h @@ -4,7 +4,7 @@ by Maciej 'YTM/Elysium' Witkowiak */ -#ifndef _GMEMORY_H +#ifndef _GMEMORY_H #define _GMEMORY_H #ifndef _GSTRUCT_H diff --git a/include/geos/gmenu.h b/include/geos/gmenu.h index b579aef5b..3175b6cf3 100644 --- a/include/geos/gmenu.h +++ b/include/geos/gmenu.h @@ -4,7 +4,7 @@ by Maciej 'YTM/Elysium' Witkowiak */ -#ifndef _GMENU_H +#ifndef _GMENU_H #define _GMENU_H #ifndef _GSTRUCT_H @@ -21,35 +21,35 @@ void GotoFirstMenu(void); void __fastcall__ DoIcons(struct icontab *myIconTab); /* DoMenu - menutypes */ -#define MENU_ACTION 0x00 -#define DYN_SUB_MENU 0x40 -#define SUB_MENU 0x80 -#define HORIZONTAL 0x00 -#define VERTICAL 0x80 +#define MENU_ACTION 0x00 +#define DYN_SUB_MENU 0x40 +#define SUB_MENU 0x80 +#define HORIZONTAL 0x00 +#define VERTICAL 0x80 /* menu string offsets */ -#define OFF_MY_TOP 0 -#define OFF_MY_BOT 1 -#define OFF_MX_LEFT 2 -#define OFF_MX_RIGHT 4 -#define OFF_NUM_M_ITEMS 6 -#define OFF_1ST_M_ITEM 7 +#define OFF_MY_TOP 0 +#define OFF_MY_BOT 1 +#define OFF_MX_LEFT 2 +#define OFF_MX_RIGHT 4 +#define OFF_NUM_M_ITEMS 6 +#define OFF_1ST_M_ITEM 7 /* icon string offsets */ -#define OFF_NM_ICNS 0 -#define OFF_IC_XMOUSE 1 -#define OFF_IC_YMOUSE 3 -#define OFF_PIC_ICON 0 -#define OFF_X_ICON_POS 2 -#define OFF_Y_ICON_POS 3 -#define OFF_WDTH_ICON 4 -#define OFF_HEIGHT_ICON 5 -#define OFF_SRV_RT_ICON 6 -#define OFF_NX_ICON 8 -/* icons, menus status flags */ -#define ST_FLASH 0x80 -#define ST_INVERT 0x40 -#define ST_LD_AT_ADDR 0x01 -#define ST_LD_DATA 0x80 -#define ST_PR_DATA 0x40 -#define ST_WR_PR 0x40 +#define OFF_NM_ICNS 0 +#define OFF_IC_XMOUSE 1 +#define OFF_IC_YMOUSE 3 +#define OFF_PIC_ICON 0 +#define OFF_X_ICON_POS 2 +#define OFF_Y_ICON_POS 3 +#define OFF_WDTH_ICON 4 +#define OFF_HEIGHT_ICON 5 +#define OFF_SRV_RT_ICON 6 +#define OFF_NX_ICON 8 +/* icons, menus status flags */ +#define ST_FLASH 0x80 +#define ST_INVERT 0x40 +#define ST_LD_AT_ADDR 0x01 +#define ST_LD_DATA 0x80 +#define ST_PR_DATA 0x40 +#define ST_WR_PR 0x40 #endif diff --git a/include/geos/gprocess.h b/include/geos/gprocess.h index d784a2cc6..6fab2ecfa 100644 --- a/include/geos/gprocess.h +++ b/include/geos/gprocess.h @@ -4,7 +4,7 @@ by Maciej 'YTM/Elysium' Witkowiak */ -#ifndef _GPROCESS_H +#ifndef _GPROCESS_H #define _GPROCESS_H #ifndef _GSTRUCT_H diff --git a/include/geos/gsprite.h b/include/geos/gsprite.h index 470cfb27b..9679e9f59 100644 --- a/include/geos/gsprite.h +++ b/include/geos/gsprite.h @@ -4,7 +4,7 @@ by Maciej 'YTM/Elysium' Witkowiak */ -#ifndef _GSPRITE_H +#ifndef _GSPRITE_H #define _GSPRITE_H void StartMouseMode(void); @@ -24,73 +24,73 @@ void PromptOff(void); char GetNextChar(void); /* keyboard constants */ -#define KEY_F1 1 -#define KEY_F2 2 -#define KEY_F3 3 -#define KEY_F4 4 -#define KEY_F5 5 -#define KEY_F6 6 -#define KEY_NOSCRL 7 -#define KEY_ENTER 13 -#define KEY_F7 14 -#define KEY_F8 15 -#define KEY_HOME 18 -#define KEY_CLEAR 19 -#define KEY_LARROW 20 -#define KEY_UPARROW 21 -#define KEY_STOP 22 -#define KEY_RUN 23 -#define KEY_BPS 24 -#define KEY_HELP 25 -#define KEY_ALT 26 -#define KEY_ESC 27 -#define KEY_INSERT 28 -#define KEY_INVALID 31 -#define KEY_LEFT BACKSPACE +#define KEY_F1 1 +#define KEY_F2 2 +#define KEY_F3 3 +#define KEY_F4 4 +#define KEY_F5 5 +#define KEY_F6 6 +#define KEY_NOSCRL 7 +#define KEY_ENTER 13 +#define KEY_F7 14 +#define KEY_F8 15 +#define KEY_HOME 18 +#define KEY_CLEAR 19 +#define KEY_LARROW 20 +#define KEY_UPARROW 21 +#define KEY_STOP 22 +#define KEY_RUN 23 +#define KEY_BPS 24 +#define KEY_HELP 25 +#define KEY_ALT 26 +#define KEY_ESC 27 +#define KEY_INSERT 28 +#define KEY_INVALID 31 +#define KEY_LEFT BACKSPACE #ifdef __GEOS_CBM__ -#define KEY_UP 16 -#define KEY_DOWN 17 -#define KEY_DELETE 29 -#define KEY_RIGHT 30 +#define KEY_UP 16 +#define KEY_DOWN 17 +#define KEY_DELETE 29 +#define KEY_RIGHT 30 #else -#define KEY_UP 11 -#define KEY_DOWN 10 -#define KEY_DELETE 127 -#define KEY_RIGHT 21 +#define KEY_UP 11 +#define KEY_DOWN 10 +#define KEY_DELETE 127 +#define KEY_RIGHT 21 #endif /* values of faultData - pointer position vs. mouseWindow */ /* bit numbers */ -#define OFFTOP_BIT 7 -#define OFFBOTTOM_BIT 6 -#define OFFLEFT_BIT 5 -#define OFFRIGHT_BIT 4 -#define OFFMENU_BIT 3 +#define OFFTOP_BIT 7 +#define OFFBOTTOM_BIT 6 +#define OFFLEFT_BIT 5 +#define OFFRIGHT_BIT 4 +#define OFFMENU_BIT 3 /* bit masks */ -#define SET_OFFTOP 0x80 -#define SET_OFFBOTTOM 0x40 -#define SET_OFFLEFT 0x20 -#define SET_OFFRIGHT 0x10 -#define SET_OFFMENU 0x08 +#define SET_OFFTOP 0x80 +#define SET_OFFBOTTOM 0x40 +#define SET_OFFLEFT 0x20 +#define SET_OFFRIGHT 0x10 +#define SET_OFFMENU 0x08 /* mouseOn */ /* bit numbers */ -#define MOUSEON_BIT 7 -#define MENUON_BIT 6 -#define ICONSON_BIT 5 +#define MOUSEON_BIT 7 +#define MENUON_BIT 6 +#define ICONSON_BIT 5 /* bit masks */ -#define SET_MSE_ON 0x80 -#define SET_MENUON 0x40 -#define SET_ICONSON 0x20 +#define SET_MSE_ON 0x80 +#define SET_MENUON 0x40 +#define SET_ICONSON 0x20 /* pressFlag */ /* bit numbers */ -#define KEYPRESS_BIT 7 -#define INPUT_BIT 6 -#define MOUSE_BIT 5 +#define KEYPRESS_BIT 7 +#define INPUT_BIT 6 +#define MOUSE_BIT 5 /* bit masks */ -#define SET_KEYPRESS 0x80 -#define SET_INPUTCHG 0x40 -#define SET_MOUSE 0x20 - +#define SET_KEYPRESS 0x80 +#define SET_INPUTCHG 0x40 +#define SET_MOUSE 0x20 + #endif diff --git a/include/geos/gstruct.h b/include/geos/gstruct.h index ecb2e7714..9e5f0ddda 100644 --- a/include/geos/gstruct.h +++ b/include/geos/gstruct.h @@ -18,157 +18,157 @@ typedef void (*void_func) (void); -struct s_date { /* system date & time */ - char s_year; - char s_month; - char s_day; - char s_hour; - char s_minutes; - char s_seconds; +struct s_date { /* system date & time */ + char s_year; + char s_month; + char s_day; + char s_hour; + char s_minutes; + char s_seconds; }; -struct tr_se { /* track and sector */ - char track; - char sector; +struct tr_se { /* track and sector */ + char track; + char sector; }; -struct fileheader { /* header block (like fileHeader) */ - struct tr_se n_block; - char icon_desc[3]; - char icon_pic[63]; - char dostype; - char type; - char structure; - unsigned load_address; - unsigned end_address; - unsigned exec_address; - char class_name[19]; - char column_flag; - char author[63]; - char note[96]; +struct fileheader { /* header block (like fileHeader) */ + struct tr_se n_block; + char icon_desc[3]; + char icon_pic[63]; + char dostype; + char type; + char structure; + unsigned load_address; + unsigned end_address; + unsigned exec_address; + char class_name[19]; + char column_flag; + char author[63]; + char note[96]; }; #ifdef __GEOS_CBM__ -struct f_date { /* date in filedesctiptor */ - char f_year; - char f_month; - char f_day; - char f_hour; - char f_minute; +struct f_date { /* date in filedesctiptor */ + char f_year; + char f_month; + char f_day; + char f_hour; + char f_minute; }; -struct filehandle { /* filehandle in directory sectors */ - char dostype; /* or in dirEntryBuf */ - struct tr_se n_block; - char name[16]; - struct tr_se header; - char structure; - char type; - struct f_date date; - unsigned size; +struct filehandle { /* filehandle in directory sectors */ + char dostype; /* or in dirEntryBuf */ + struct tr_se n_block; + char name[16]; + struct tr_se header; + char structure; + char type; + struct f_date date; + unsigned size; }; #else /* #ifdef __GEOS_CBM__ */ -struct f_date { /* date in filedesctiptor */ - unsigned f_day:5; - unsigned f_month:4; - unsigned f_year:7; - char f_minute; - char f_hour; +struct f_date { /* date in filedesctiptor */ + unsigned f_day:5; + unsigned f_month:4; + unsigned f_year:7; + char f_minute; + char f_hour; }; -struct filehandle { /* filehandle in directory sectors */ - unsigned name_len:4; /* or in dirEntryBuf */ - unsigned structure:4; - char name[15]; - char type; - struct tr_se n_block; - unsigned size; - char byte_size[3]; - struct f_date date; - char version; - char min_version; - char access; - struct tr_se header; - struct f_date mod_date; - struct tr_se dir_head; +struct filehandle { /* filehandle in directory sectors */ + unsigned name_len:4; /* or in dirEntryBuf */ + unsigned structure:4; + char name[15]; + char type; + struct tr_se n_block; + unsigned size; + char byte_size[3]; + struct f_date date; + char version; + char min_version; + char access; + struct tr_se header; + struct f_date mod_date; + struct tr_se dir_head; }; #endif /* #ifdef __GEOS_CBM__ */ -struct pixel { /* describes point */ - unsigned x; - char y; +struct pixel { /* describes point */ + unsigned x; + char y; }; -struct fontdesc { /* describes font */ - char baseline; - char width; - char height; - char *index_tbl; - char *data_ptr; +struct fontdesc { /* describes font */ + char baseline; + char width; + char height; + char *index_tbl; + char *data_ptr; }; -struct window { /* describes screen region */ - char top; - char bot; - unsigned left; - unsigned right; +struct window { /* describes screen region */ + char top; + char bot; + unsigned left; + unsigned right; }; -struct VLIR_info { /* VLIR information */ - char curRecord; /* currently only used in VLIR */ - char usedRecords; /* as system info (curRecord is mainly of your interest */ - char fileWritten; - unsigned fileSize; +struct VLIR_info { /* VLIR information */ + char curRecord; /* currently only used in VLIR */ + char usedRecords; /* as system info (curRecord is mainly of your interest */ + char fileWritten; + unsigned fileSize; }; -struct process { /* process info, declare table of that type */ - unsigned pointer; /* (like: struct process proctab[2]=... */ - unsigned jiffies; /* last entry HAVE TO BE {0,0} */ +struct process { /* process info, declare table of that type */ + unsigned pointer; /* (like: struct process proctab[2]=... */ + unsigned jiffies; /* last entry HAVE TO BE {0,0} */ }; -struct iconpic { /* icon/encoded bitmap description */ - char *pic_ptr; /* ptr to a photo scrap (or encoded bitmap) */ - char x; /* position in cards (*8 pixels) */ - char y; - char width; /* in cards */ - char heigth; /* in lines (pixels) */ +struct iconpic { /* icon/encoded bitmap description */ + char *pic_ptr; /* ptr to a photo scrap (or encoded bitmap) */ + char x; /* position in cards (*8 pixels) */ + char y; + char width; /* in cards */ + char heigth; /* in lines (pixels) */ }; -struct icondef { /* icon definition for DoIcons */ - char *pic_ptr; /* ptr to a photo scrap (or encoded bitmap) */ - char x; /* position in cards (*8 pixels) */ - char y; - char width; /* of icon (in cards) */ - char heigth; /* of icon in lines (pixels) */ - unsigned proc_ptr; /* pointer to function handling that icon */ +struct icondef { /* icon definition for DoIcons */ + char *pic_ptr; /* ptr to a photo scrap (or encoded bitmap) */ + char x; /* position in cards (*8 pixels) */ + char y; + char width; /* of icon (in cards) */ + char heigth; /* of icon in lines (pixels) */ + unsigned proc_ptr; /* pointer to function handling that icon */ }; struct icontab { - char number; /* number of declared icons */ - struct pixel mousepos; /* position of mouse after DoIcons */ - struct icondef tab[]; /* table of size declared by icontab.number */ + char number; /* number of declared icons */ + struct pixel mousepos; /* position of mouse after DoIcons */ + struct icondef tab[]; /* table of size declared by icontab.number */ }; struct menuitem { - char *name; - char type; - void *rest; /* may be ptr to function, or ptr to struct menu (submenu) */ + char *name; + char type; + void *rest; /* may be ptr to function, or ptr to struct menu (submenu) */ }; struct menu { - struct window size; - char number; - struct menuitem items[]; + struct window size; + char number; + struct menuitem items[]; }; -struct inittab { /* use struct inittab mytab[n] for initram */ - unsigned ptr; /* ptr to 1st byte */ - char number; /* number of following bytes */ - char values[]; /* actual string of bytes */ +struct inittab { /* use struct inittab mytab[n] for initram */ + unsigned ptr; /* ptr to 1st byte */ + char number; /* number of following bytes */ + char values[]; /* actual string of bytes */ }; #endif diff --git a/include/geos/gsym.h b/include/geos/gsym.h index 13a29f9da..085046674 100644 --- a/include/geos/gsym.h +++ b/include/geos/gsym.h @@ -11,331 +11,331 @@ #include #endif -#define r0 (*(unsigned*)(R_BASE + 0x00)) -#define r0L (*(char*)(R_BASE + 0x00)) -#define r0H (*(char*)(R_BASE + 0x01)) -#define r1 (*(unsigned*)(R_BASE + 0x02)) -#define r1L (*(char*)(R_BASE + 0x02)) -#define r1H (*(char*)(R_BASE + 0x03)) -#define drawWindow (*(struct window*)(R_BASE + 0x04)) -#define r2 (*(unsigned*)(R_BASE + 0x04)) -#define r2L (*(char*)(R_BASE + 0x04)) -#define r2H (*(char*)(R_BASE + 0x05)) -#define r3 (*(unsigned*)(R_BASE + 0x06)) -#define r3L (*(char*)(R_BASE + 0x06)) -#define r3H (*(char*)(R_BASE + 0x07)) -#define r4 (*(unsigned*)(R_BASE + 0x08)) -#define r4L (*(char*)(R_BASE + 0x08)) -#define r4H (*(char*)(R_BASE + 0x09)) -#define r5 (*(unsigned*)(R_BASE + 0x0a)) -#define r5L (*(char*)(R_BASE + 0x0a)) -#define r5H (*(char*)(R_BASE + 0x0b)) -#define r6 (*(unsigned*)(R_BASE + 0x0c)) -#define r6L (*(char*)(R_BASE + 0x0c)) -#define r6H (*(char*)(R_BASE + 0x0d)) -#define r7 (*(unsigned*)(R_BASE + 0x0e)) -#define r7L (*(char*)(R_BASE + 0x0e)) -#define r7H (*(char*)(R_BASE + 0x0f)) -#define r8 (*(unsigned*)(R_BASE + 0x10)) -#define r8L (*(char*)(R_BASE + 0x10)) -#define r8H (*(char*)(R_BASE + 0x11)) -#define r9 (*(unsigned*)(R_BASE + 0x12)) -#define r9L (*(char*)(R_BASE + 0x12)) -#define r9H (*(char*)(R_BASE + 0x13)) -#define r10 (*(unsigned*)(R_BASE + 0x14)) -#define r10L (*(char*)(R_BASE + 0x14)) -#define r10H (*(char*)(R_BASE + 0x15)) -#define r11 (*(unsigned*)(R_BASE + 0x16)) -#define r11L (*(char*)(R_BASE + 0x16)) -#define r11H (*(char*)(R_BASE + 0x17)) -#define r12 (*(unsigned*)(R_BASE + 0x18)) -#define r12L (*(char*)(R_BASE + 0x18)) -#define r12H (*(char*)(R_BASE + 0x19)) -#define r13 (*(unsigned*)(R_BASE + 0x1a)) -#define r13L (*(char*)(R_BASE + 0x1a)) -#define r13H (*(char*)(R_BASE + 0x1b)) -#define r14 (*(unsigned*)(R_BASE + 0x1c)) -#define r14L (*(char*)(R_BASE + 0x1c)) -#define r14H (*(char*)(R_BASE + 0x1d)) -#define r15 (*(unsigned*)(R_BASE + 0x1e)) -#define r15L (*(char*)(R_BASE + 0x1e)) -#define r15H (*(char*)(R_BASE + 0x1f)) +#define r0 (*(unsigned*)(R_BASE + 0x00)) +#define r0L (*(char*)(R_BASE + 0x00)) +#define r0H (*(char*)(R_BASE + 0x01)) +#define r1 (*(unsigned*)(R_BASE + 0x02)) +#define r1L (*(char*)(R_BASE + 0x02)) +#define r1H (*(char*)(R_BASE + 0x03)) +#define drawWindow (*(struct window*)(R_BASE + 0x04)) +#define r2 (*(unsigned*)(R_BASE + 0x04)) +#define r2L (*(char*)(R_BASE + 0x04)) +#define r2H (*(char*)(R_BASE + 0x05)) +#define r3 (*(unsigned*)(R_BASE + 0x06)) +#define r3L (*(char*)(R_BASE + 0x06)) +#define r3H (*(char*)(R_BASE + 0x07)) +#define r4 (*(unsigned*)(R_BASE + 0x08)) +#define r4L (*(char*)(R_BASE + 0x08)) +#define r4H (*(char*)(R_BASE + 0x09)) +#define r5 (*(unsigned*)(R_BASE + 0x0a)) +#define r5L (*(char*)(R_BASE + 0x0a)) +#define r5H (*(char*)(R_BASE + 0x0b)) +#define r6 (*(unsigned*)(R_BASE + 0x0c)) +#define r6L (*(char*)(R_BASE + 0x0c)) +#define r6H (*(char*)(R_BASE + 0x0d)) +#define r7 (*(unsigned*)(R_BASE + 0x0e)) +#define r7L (*(char*)(R_BASE + 0x0e)) +#define r7H (*(char*)(R_BASE + 0x0f)) +#define r8 (*(unsigned*)(R_BASE + 0x10)) +#define r8L (*(char*)(R_BASE + 0x10)) +#define r8H (*(char*)(R_BASE + 0x11)) +#define r9 (*(unsigned*)(R_BASE + 0x12)) +#define r9L (*(char*)(R_BASE + 0x12)) +#define r9H (*(char*)(R_BASE + 0x13)) +#define r10 (*(unsigned*)(R_BASE + 0x14)) +#define r10L (*(char*)(R_BASE + 0x14)) +#define r10H (*(char*)(R_BASE + 0x15)) +#define r11 (*(unsigned*)(R_BASE + 0x16)) +#define r11L (*(char*)(R_BASE + 0x16)) +#define r11H (*(char*)(R_BASE + 0x17)) +#define r12 (*(unsigned*)(R_BASE + 0x18)) +#define r12L (*(char*)(R_BASE + 0x18)) +#define r12H (*(char*)(R_BASE + 0x19)) +#define r13 (*(unsigned*)(R_BASE + 0x1a)) +#define r13L (*(char*)(R_BASE + 0x1a)) +#define r13H (*(char*)(R_BASE + 0x1b)) +#define r14 (*(unsigned*)(R_BASE + 0x1c)) +#define r14L (*(char*)(R_BASE + 0x1c)) +#define r14H (*(char*)(R_BASE + 0x1d)) +#define r15 (*(unsigned*)(R_BASE + 0x1e)) +#define r15L (*(char*)(R_BASE + 0x1e)) +#define r15H (*(char*)(R_BASE + 0x1f)) #ifdef __GEOS_CBM__ -#define nameBuf char[17] -#define blockBuf char[256] +#define nameBuf char[17] +#define blockBuf char[256] -#define CPU_DDR (*(char*)0x00) -#define CPU_DATA (*(char*)0x01) +#define CPU_DDR (*(char*)0x00) +#define CPU_DATA (*(char*)0x01) -#define R_BASE 0x02 +#define R_BASE 0x02 -#define curPattern (*(unsigned*)0x22) -#define string (*(unsigned*)0x24) -#define curFontDesc (*(struct fontdesc*)0x26) -#define currentMode (*(char*)0x2e) -#define dispBufferOn (*(char*)0x2f) -#define mouseOn (*(char*)0x30) -#define msePicPtr (*(unsigned*)0x31) -#define curWindow (*(struct window*)0x33) -#define pressFlag (*(char*)0x39) -#define mousePos (*(struct pixel*)0x3a) -#define returnAddress (*(unsigned*)0x3d) -#define graphMode (*(char*)0x3f) -#define STATUS (*(char*)0x90) -#define curDevice (*(char*)0xba) +#define curPattern (*(unsigned*)0x22) +#define string (*(unsigned*)0x24) +#define curFontDesc (*(struct fontdesc*)0x26) +#define currentMode (*(char*)0x2e) +#define dispBufferOn (*(char*)0x2f) +#define mouseOn (*(char*)0x30) +#define msePicPtr (*(unsigned*)0x31) +#define curWindow (*(struct window*)0x33) +#define pressFlag (*(char*)0x39) +#define mousePos (*(struct pixel*)0x3a) +#define returnAddress (*(unsigned*)0x3d) +#define graphMode (*(char*)0x3f) +#define STATUS (*(char*)0x90) +#define curDevice (*(char*)0xba) -#define irqvec (*(void_func*)0x0314) -#define bkvec (*(void_func*)0x0316) -#define nmivec (*(void_func*)0x0318) +#define irqvec (*(void_func*)0x0314) +#define bkvec (*(void_func*)0x0316) +#define nmivec (*(void_func*)0x0318) -#define APP_RAM ((char*)0x0400) -#define BACK_SCR_BASE ((char*)0x6000) -#define PRINTBASE ((char*)0x7900) -#define OS_VARS ((char*)0x8000) +#define APP_RAM ((char*)0x0400) +#define BACK_SCR_BASE ((char*)0x6000) +#define PRINTBASE ((char*)0x7900) +#define OS_VARS ((char*)0x8000) -#define diskBlkBuf ((blockBuf)0x8000) -#define fileHeader (*(struct fileheader*)0x8100) -#define curDirHead ((blockBuf)0x8200) -#define fileTrScTab ((struct tr_se[128])0x8300) -#define dirEntryBuf (*(struct filehandle*)0x8400) +#define diskBlkBuf ((blockBuf)0x8000) +#define fileHeader (*(struct fileheader*)0x8100) +#define curDirHead ((blockBuf)0x8200) +#define fileTrScTab ((struct tr_se[128])0x8300) +#define dirEntryBuf (*(struct filehandle*)0x8400) -#define DrACurDkNm ((nameBuf)0x841e) -#define DrBCurDkNm ((nameBuf)0x8430) -#define dataFileName ((nameBuf)0x8442) -#define dataDiskName ((nameBuf)0x8453) -#define PrntFileName ((nameBuf)0x8465) -#define PrntDiskName ((nameBuf)0x8476) +#define DrACurDkNm ((nameBuf)0x841e) +#define DrBCurDkNm ((nameBuf)0x8430) +#define dataFileName ((nameBuf)0x8442) +#define dataDiskName ((nameBuf)0x8453) +#define PrntFileName ((nameBuf)0x8465) +#define PrntDiskName ((nameBuf)0x8476) -#define curDrive (*(char*)0x8489) -#define diskOpenFlg (*(char*)0x848a) -#define isGEOS (*(char*)0x848b) -#define interleave (*(char*)0x848c) -#define NUMDRV (*(char*)0x848d) +#define curDrive (*(char*)0x8489) +#define diskOpenFlg (*(char*)0x848a) +#define isGEOS (*(char*)0x848b) +#define interleave (*(char*)0x848c) +#define NUMDRV (*(char*)0x848d) -#define driveType ((char[4])0x848e) -#define turboFlags ((char[4])0x8492) +#define driveType ((char[4])0x848e) +#define turboFlags ((char[4])0x8492) -#define VLIRInfo (*(struct VLIR_info*)0x8496) +#define VLIRInfo (*(struct VLIR_info*)0x8496) -#define appMain (*(void_func*)0x849b) -#define intTopVector (*(void_func*)0x849d) -#define intBotVector (*(void_func*)0x849f) -#define mouseVector (*(void_func*)0x84a1) -#define keyVector (*(void_func*)0x84a3) -#define inputVector (*(void_func*)0x84a5) -#define mouseFaultVec (*(void_func*)0x84a7) -#define otherPressVec (*(void_func*)0x84a9) -#define StringFaultVec (*(void_func*)0x84ab) -#define alarmTmtVector (*(void_func*)0x84ad) -#define BRKVector (*(void_func*)0x84af) -#define RecoverVector (*(void_func*)0x84b1) +#define appMain (*(void_func*)0x849b) +#define intTopVector (*(void_func*)0x849d) +#define intBotVector (*(void_func*)0x849f) +#define mouseVector (*(void_func*)0x84a1) +#define keyVector (*(void_func*)0x84a3) +#define inputVector (*(void_func*)0x84a5) +#define mouseFaultVec (*(void_func*)0x84a7) +#define otherPressVec (*(void_func*)0x84a9) +#define StringFaultVec (*(void_func*)0x84ab) +#define alarmTmtVector (*(void_func*)0x84ad) +#define BRKVector (*(void_func*)0x84af) +#define RecoverVector (*(void_func*)0x84b1) -#define selectionFlash (*(char*)0x84b3) -#define alphaFlag (*(char*)0x84b4) -#define iconSelFlg (*(char*)0x84b5) -#define faultData (*(char*)0x84b6) -#define menuNumber (*(char*)0x84b7) -#define mouseWindow (*(struct window*)0x84b8) -#define stringXY (*(struct pixel*)0x84be) -#define mousePicData (*(char*)0x84c1) +#define selectionFlash (*(char*)0x84b3) +#define alphaFlag (*(char*)0x84b4) +#define iconSelFlg (*(char*)0x84b5) +#define faultData (*(char*)0x84b6) +#define menuNumber (*(char*)0x84b7) +#define mouseWindow (*(struct window*)0x84b8) +#define stringXY (*(struct pixel*)0x84be) +#define mousePicData (*(char*)0x84c1) -#define maxMouseSpeed (*(char*)0x8501) -#define minMouseSpeed (*(char*)0x8502) -#define mouseAccel (*(char*)0x8503) -#define keyData (*(char*)0x8504) -#define mouseData (*(char*)0x8505) -#define inputData (*(char*)0x8506) -#define mouseSpeed (*(char*)0x8507) -#define random (*(char*)0x850a) -#define saveFontTab (*(struct fontdesc*)0x850c) +#define maxMouseSpeed (*(char*)0x8501) +#define minMouseSpeed (*(char*)0x8502) +#define mouseAccel (*(char*)0x8503) +#define keyData (*(char*)0x8504) +#define mouseData (*(char*)0x8505) +#define inputData (*(char*)0x8506) +#define mouseSpeed (*(char*)0x8507) +#define random (*(char*)0x850a) +#define saveFontTab (*(struct fontdesc*)0x850c) -#define dblClickCount (*(char*)0x8515) -#define system_date (*(struct s_date*)0x8516) -#define alarmSetFlag (*(char*)0x851c) -#define sysDBData (*(char*)0x851d) -#define screencolors (*(char*)0x851e) -#define dlgBoxRamBuf (*(char*)0x851f) +#define dblClickCount (*(char*)0x8515) +#define system_date (*(struct s_date*)0x8516) +#define alarmSetFlag (*(char*)0x851c) +#define sysDBData (*(char*)0x851d) +#define screencolors (*(char*)0x851e) +#define dlgBoxRamBuf (*(char*)0x851f) -#define savedmoby2 (*(char*)0x88bb) -#define scr80polar (*(char*)0x88bc) -#define scr80colors (*(char*)0x88bd) -#define vdcClrMode (*(char*)0x88be) -#define driveData ((char[4])0x88bf) -#define ramExpSize (*(char*)0x88c3) -#define sysRAMFlg (*(char*)0x88c4) -#define firstBoot (*(char*)0x88c5) -#define curType (*(char*)0x88c6) -#define ramBase (*(char*)0x88c7) -#define inputDevName ((nameBuf)0x88cb) -#define DrCCurDkNm ((nameBuf)0x88dc) -#define DrDCurDkNm ((nameBuf)0x88ee) -#define dir2Head ((blockBuf)0x8900) -#define SPRITE_PICS ((char*)0x8a00) -#define sprpic ((char[8][64])0x8a00) -#define COLOR_MATRIX ((char[1000])0x8c00) -#define objPointer ((char[8])0x8ff8) +#define savedmoby2 (*(char*)0x88bb) +#define scr80polar (*(char*)0x88bc) +#define scr80colors (*(char*)0x88bd) +#define vdcClrMode (*(char*)0x88be) +#define driveData ((char[4])0x88bf) +#define ramExpSize (*(char*)0x88c3) +#define sysRAMFlg (*(char*)0x88c4) +#define firstBoot (*(char*)0x88c5) +#define curType (*(char*)0x88c6) +#define ramBase (*(char*)0x88c7) +#define inputDevName ((nameBuf)0x88cb) +#define DrCCurDkNm ((nameBuf)0x88dc) +#define DrDCurDkNm ((nameBuf)0x88ee) +#define dir2Head ((blockBuf)0x8900) +#define SPRITE_PICS ((char*)0x8a00) +#define sprpic ((char[8][64])0x8a00) +#define COLOR_MATRIX ((char[1000])0x8c00) +#define objPointer ((char[8])0x8ff8) -#define DISK_BASE ((char*)0x9000) -#define SCREEN_BASE ((char*)0xa000) -#define OS_ROM ((char*)0xc000) -#define OS_JUMPTAB ((char*)0xc100) -#define EXP_BASE ((char*)0xdf00) -#define MOUSE_BASE_128 ((char*)0xfd00) -#define MOUSE_JMP_128 ((char*)0xfd00) -#define END_MOUSE_128 ((char*)0xfe80) -#define MOUSE_BASE ((char*)0xfe80) -#define MOUSE_JMP ((char*)0xfe80) +#define DISK_BASE ((char*)0x9000) +#define SCREEN_BASE ((char*)0xa000) +#define OS_ROM ((char*)0xc000) +#define OS_JUMPTAB ((char*)0xc100) +#define EXP_BASE ((char*)0xdf00) +#define MOUSE_BASE_128 ((char*)0xfd00) +#define MOUSE_JMP_128 ((char*)0xfd00) +#define END_MOUSE_128 ((char*)0xfe80) +#define MOUSE_BASE ((char*)0xfe80) +#define MOUSE_JMP ((char*)0xfe80) -#define config (*(char*)0xff00) -#define END_MOUSE ((char*)0xfffa) +#define config (*(char*)0xff00) +#define END_MOUSE ((char*)0xfffa) -#define NMI_VECTOR (*(void_func*)0xfffa) -#define RESET_VECTOR (*(void_func*)0xfffc) -#define IRQ_VECTOR (*(void_func*)0xfffe) +#define NMI_VECTOR (*(void_func*)0xfffa) +#define RESET_VECTOR (*(void_func*)0xfffc) +#define IRQ_VECTOR (*(void_func*)0xfffe) -#define vicbase ((char*)0xd000) -#define sidbase ((char*)0xd400) -#define mmu ((char*)0xd500) -#define VDC ((char*)0xd600) -#define ctab ((char*)0xd800) -#define cia1base ((char*)0xdc00) -#define cia2base ((char*)0xdd00) +#define vicbase ((char*)0xd000) +#define sidbase ((char*)0xd400) +#define mmu ((char*)0xd500) +#define VDC ((char*)0xd600) +#define ctab ((char*)0xd800) +#define cia1base ((char*)0xdc00) +#define cia2base ((char*)0xdd00) -#define mob0xpos (*(char*)0xd000) -#define mob0ypos (*(char*)0xd001) -#define mob1xpos (*(char*)0xd002) -#define mob1ypos (*(char*)0xd003) -#define mob2xpos (*(char*)0xd004) -#define mob2ypos (*(char*)0xd005) -#define mob3xpos (*(char*)0xd006) -#define mob3ypos (*(char*)0xd007) -#define mob4xpos (*(char*)0xd008) -#define mob4ypos (*(char*)0xd009) -#define mob5xpos (*(char*)0xd00a) -#define mob5ypos (*(char*)0xd00b) -#define mob6xpos (*(char*)0xd00c) -#define mob6ypos (*(char*)0xd00d) -#define mob7xpos (*(char*)0xd00e) -#define mob7ypos (*(char*)0xd00f) -#define msbxpos (*(char*)0xd010) -#define grcntrl1 (*(char*)0xd011) -#define rasreg (*(char*)0xd012) -#define lpxpos (*(char*)0xd013) -#define lpypos (*(char*)0xd014) -#define mobenble (*(char*)0xd015) -#define grcntrl2 (*(char*)0xd016) -#define grmemptr (*(char*)0xd018) -#define grirq (*(char*)0xd019) -#define grirqen (*(char*)0xd01a) -#define moby2 (*(char*)0xd017) -#define mobprior (*(char*)0xd01b) -#define mobmcm (*(char*)0xd01c) -#define mobx2 (*(char*)0xd01d) -#define mobmobcol (*(char*)0xd01e) -#define mobbakcol (*(char*)0xd01f) -#define extclr (*(char*)0xd020) -#define bakclr0 (*(char*)0xd021) -#define bakclr1 (*(char*)0xd022) -#define bakclr2 (*(char*)0xd023) -#define bakclr3 (*(char*)0xd024) -#define mcmclr0 (*(char*)0xd025) -#define mcmclr1 (*(char*)0xd026) -#define mob0clr (*(char*)0xd027) -#define mob1clr (*(char*)0xd028) -#define mob2clr (*(char*)0xd029) -#define mob3clr (*(char*)0xd02a) -#define mob4clr (*(char*)0xd02b) -#define mob5clr (*(char*)0xd02c) -#define mob6clr (*(char*)0xd02d) -#define mob7clr (*(char*)0xd02e) -#define keyreg (*(char*)0xd02f) -#define clkreg (*(char*)0xd030) +#define mob0xpos (*(char*)0xd000) +#define mob0ypos (*(char*)0xd001) +#define mob1xpos (*(char*)0xd002) +#define mob1ypos (*(char*)0xd003) +#define mob2xpos (*(char*)0xd004) +#define mob2ypos (*(char*)0xd005) +#define mob3xpos (*(char*)0xd006) +#define mob3ypos (*(char*)0xd007) +#define mob4xpos (*(char*)0xd008) +#define mob4ypos (*(char*)0xd009) +#define mob5xpos (*(char*)0xd00a) +#define mob5ypos (*(char*)0xd00b) +#define mob6xpos (*(char*)0xd00c) +#define mob6ypos (*(char*)0xd00d) +#define mob7xpos (*(char*)0xd00e) +#define mob7ypos (*(char*)0xd00f) +#define msbxpos (*(char*)0xd010) +#define grcntrl1 (*(char*)0xd011) +#define rasreg (*(char*)0xd012) +#define lpxpos (*(char*)0xd013) +#define lpypos (*(char*)0xd014) +#define mobenble (*(char*)0xd015) +#define grcntrl2 (*(char*)0xd016) +#define grmemptr (*(char*)0xd018) +#define grirq (*(char*)0xd019) +#define grirqen (*(char*)0xd01a) +#define moby2 (*(char*)0xd017) +#define mobprior (*(char*)0xd01b) +#define mobmcm (*(char*)0xd01c) +#define mobx2 (*(char*)0xd01d) +#define mobmobcol (*(char*)0xd01e) +#define mobbakcol (*(char*)0xd01f) +#define extclr (*(char*)0xd020) +#define bakclr0 (*(char*)0xd021) +#define bakclr1 (*(char*)0xd022) +#define bakclr2 (*(char*)0xd023) +#define bakclr3 (*(char*)0xd024) +#define mcmclr0 (*(char*)0xd025) +#define mcmclr1 (*(char*)0xd026) +#define mob0clr (*(char*)0xd027) +#define mob1clr (*(char*)0xd028) +#define mob2clr (*(char*)0xd029) +#define mob3clr (*(char*)0xd02a) +#define mob4clr (*(char*)0xd02b) +#define mob5clr (*(char*)0xd02c) +#define mob6clr (*(char*)0xd02d) +#define mob7clr (*(char*)0xd02e) +#define keyreg (*(char*)0xd02f) +#define clkreg (*(char*)0xd030) -#define vdcreg (*(char*)0xd600) -#define vdcdata (*(char*)0xd601) +#define vdcreg (*(char*)0xd600) +#define vdcdata (*(char*)0xd601) #else /* #ifdef __GEOS_CBM__ */ -#define nameBuf char[16] -#define blockBuf char[512] +#define nameBuf char[16] +#define blockBuf char[512] -#define R_BASE 0x00 +#define R_BASE 0x00 -#define curPattern (*(unsigned*)0x022c) -#define string (*(unsigned*)0x53) -#define curFontDesc (*(struct fontdesc*)0x0218) -#define currentMode (*(char*)0x021c) -#define dispBufferOn (*(char*)0x021d) -#define mouseOn (*(char*)0x5d) -#define curWindow (*(struct window*)0x021e) -#define pressFlag (*(char*)0x08fe) -#define mousePos (*(struct pixel*)0x0241) -#define returnAddress (*(unsigned*)0x64) +#define curPattern (*(unsigned*)0x022c) +#define string (*(unsigned*)0x53) +#define curFontDesc (*(struct fontdesc*)0x0218) +#define currentMode (*(char*)0x021c) +#define dispBufferOn (*(char*)0x021d) +#define mouseOn (*(char*)0x5d) +#define curWindow (*(struct window*)0x021e) +#define pressFlag (*(char*)0x08fe) +#define mousePos (*(struct pixel*)0x0241) +#define returnAddress (*(unsigned*)0x64) -#define diskBlkBuf ((blockBuf)0xf659) -#define fileHeader (*(struct fileheader*)0xf859) -#define curDirHead ((char[39])0xfa80) -#define dirEntryBuf (*(struct filehandle*)0xfa59) +#define diskBlkBuf ((blockBuf)0xf659) +#define fileHeader (*(struct fileheader*)0xf859) +#define curDirHead ((char[39])0xfa80) +#define dirEntryBuf (*(struct filehandle*)0xfa59) -#define DrACurDkNm ((nameBuf)0xfaa7) -#define DrBCurDkNm ((nameBuf)0xfab7) -#define dataFileName ((nameBuf)0x02a4) -#define dataDiskName ((nameBuf)0x02b4) -#define PrntFileName ((nameBuf)0x08ac) +#define DrACurDkNm ((nameBuf)0xfaa7) +#define DrBCurDkNm ((nameBuf)0xfab7) +#define dataFileName ((nameBuf)0x02a4) +#define dataDiskName ((nameBuf)0x02b4) +#define PrntFileName ((nameBuf)0x08ac) -#define curDrive (*(char*)0xf60d) -#define diskOpenFlg (*(char*)0xf617) -#define NUMDRV (*(char*)0xf60e) +#define curDrive (*(char*)0xf60d) +#define diskOpenFlg (*(char*)0xf617) +#define NUMDRV (*(char*)0xf60e) -#define driveType ((char[4])0xfaf3) +#define driveType ((char[4])0xfaf3) -#define VLIRInfo (*(struct VLIR_info*)0xf618) +#define VLIRInfo (*(struct VLIR_info*)0xf618) -#define appMain (*(void_func*)0x0200) -#define intTopVector (*(void_func*)0x0202) -#define intBotVector (*(void_func*)0x0204) -#define mouseVector (*(void_func*)0x0206) -#define keyVector (*(void_func*)0x0208) -#define inputVector (*(void_func*)0x020a) -#define mouseFaultVec (*(void_func*)0x020c) -#define otherPressVec (*(void_func*)0x020e) -#define StringFaultVec (*(void_func*)0x0210) -#define alarmTmtVector (*(void_func*)0x0212) -#define BRKVector (*(void_func*)0x0214) -#define RecoverVector (*(void_func*)0x0216) +#define appMain (*(void_func*)0x0200) +#define intTopVector (*(void_func*)0x0202) +#define intBotVector (*(void_func*)0x0204) +#define mouseVector (*(void_func*)0x0206) +#define keyVector (*(void_func*)0x0208) +#define inputVector (*(void_func*)0x020a) +#define mouseFaultVec (*(void_func*)0x020c) +#define otherPressVec (*(void_func*)0x020e) +#define StringFaultVec (*(void_func*)0x0210) +#define alarmTmtVector (*(void_func*)0x0212) +#define BRKVector (*(void_func*)0x0214) +#define RecoverVector (*(void_func*)0x0216) -#define selectionFlash (*(char*)0x0224) -#define alphaFlag (*(char*)0x0225) -#define iconSelFlg (*(char*)0x0226) -#define faultData (*(char*)0x0227) -#define menuNumber (*(char*)0x0228) -#define mouseWindow (*(struct window*)0x57) -#define stringXY (*(struct pixel*)0x022e) +#define selectionFlash (*(char*)0x0224) +#define alphaFlag (*(char*)0x0225) +#define iconSelFlg (*(char*)0x0226) +#define faultData (*(char*)0x0227) +#define menuNumber (*(char*)0x0228) +#define mouseWindow (*(struct window*)0x57) +#define stringXY (*(struct pixel*)0x022e) -#define maxMouseSpeed (*(char*)0x027d) -#define minMouseSpeed (*(char*)0x027e) -#define mouseAccel (*(char*)0x027f) -#define keyData (*(char*)0x0245) -#define mouseData (*(char*)0x0246) -#define inputData (*(char*)0x0247) -#define random (*(char*)0x024c) -#define saveFontTab (*(struct fontdesc*)0x024e) +#define maxMouseSpeed (*(char*)0x027d) +#define minMouseSpeed (*(char*)0x027e) +#define mouseAccel (*(char*)0x027f) +#define keyData (*(char*)0x0245) +#define mouseData (*(char*)0x0246) +#define inputData (*(char*)0x0247) +#define random (*(char*)0x024c) +#define saveFontTab (*(struct fontdesc*)0x024e) -#define dblClickCount (*(char*)0x0258) -#define system_date (*(struct s_date*)0xf200) -#define sysDBData (*(char*)0x0259) -#define dlgBoxRamBuf (*(char*)0xf381) +#define dblClickCount (*(char*)0x0258) +#define system_date (*(struct s_date*)0xf200) +#define sysDBData (*(char*)0x0259) +#define dlgBoxRamBuf (*(char*)0xf381) -#define firstBoot (*(char*)0x0281) -#define inputDevName ((nameBuf)0x08cc) -#define DrCCurDkNm ((nameBuf)0xfac7) -#define DrDCurDkNm ((nameBuf)0xfad7) +#define firstBoot (*(char*)0x0281) +#define inputDevName ((nameBuf)0x08cc) +#define DrCCurDkNm ((nameBuf)0xfac7) +#define DrDCurDkNm ((nameBuf)0xfad7) -#define mobenble (*(char*)0x0818) -#define moby2 (*(char*)0x081a) -#define mobx2 (*(char*)0x0819) +#define mobenble (*(char*)0x0818) +#define moby2 (*(char*)0x081a) +#define mobx2 (*(char*)0x0819) #endif /* #ifdef __GEOS_CBM__ */ diff --git a/include/geos/gsys.h b/include/geos/gsys.h index 493c2609f..284c38b63 100644 --- a/include/geos/gsys.h +++ b/include/geos/gsys.h @@ -4,7 +4,7 @@ by Maciej 'YTM/Elysium' Witkowiak */ -#ifndef _GSYS_H +#ifndef _GSYS_H #define _GSYS_H void FirstInit(void); @@ -27,24 +27,24 @@ char get_ostype(void); /* possible return values of get_ostype, machine and version flags will be combined with OR */ /* machine flags */ -#define GEOS64 0x00 +#define GEOS64 0x00 #define GEOS4 0x04 /* plus4 geos is not or'ed with version */ -#define GEOS128 0x80 +#define GEOS128 0x80 /* version flags */ -#define GEOS_V10 0x10 +#define GEOS_V10 0x10 #define GEOS_V11 0x11 -#define GEOS_V12 0x12 /* ??? not sure */ -#define GEOS_V20 0x20 -#define WHEELS 0x40 /* only Wheels? */ +#define GEOS_V12 0x12 /* ??? not sure */ +#define GEOS_V20 0x20 +#define WHEELS 0x40 /* only Wheels? */ char get_tv(void); /* possible return values of get_tv, these flags will be combined note that columns state can be changed during runtime and get_tv always returns the current state */ -#define COLUMNS40 0x00 -#define COLUMNS80 0x01 -#define TV_PAL 0x00 -#define TV_NTSC 0x80 +#define COLUMNS40 0x00 +#define COLUMNS80 0x01 +#define TV_PAL 0x00 +#define TV_NTSC 0x80 #endif diff --git a/include/iso646.h b/include/iso646.h index 287bddc3b..18cf6e50d 100644 --- a/include/iso646.h +++ b/include/iso646.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* iso646.h */ +/* iso646.h */ /* */ -/* Alternative spellings */ +/* Alternative spellings */ /* */ /* */ /* */ @@ -39,17 +39,17 @@ /* Operator tokens */ -#define and && -#define and_eq &= -#define bitand & -#define bitor | -#define compl ~ -#define not ! -#define not_eq != -#define or || -#define or_eq |= -#define xor ^ -#define xor_eq ^= +#define and && +#define and_eq &= +#define bitand & +#define bitor | +#define compl ~ +#define not ! +#define not_eq != +#define or || +#define or_eq |= +#define xor ^ +#define xor_eq ^= diff --git a/include/joystick.h b/include/joystick.h index 2e6a3fefe..18b552f08 100644 --- a/include/joystick.h +++ b/include/joystick.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* joystick.h */ +/* joystick.h */ /* */ -/* Read the joystick on systems that support it */ +/* Read the joystick on systems that support it */ /* */ /* */ /* */ @@ -52,8 +52,8 @@ #define JOY_ERR_NO_DEVICE 4 /* Device (hardware) not found */ /* Argument for the joy_read function */ -#define JOY_1 0 -#define JOY_2 1 +#define JOY_1 0 +#define JOY_2 1 /* The following codes are *indices* into the joy_masks array */ #define JOY_UP 0 @@ -83,7 +83,7 @@ extern const void joy_static_stddrv[]; /*****************************************************************************/ -/* Functions */ +/* Functions */ /*****************************************************************************/ diff --git a/include/joystick/joy-kernel.h b/include/joystick/joy-kernel.h index d57ad5dc7..e617a43c5 100644 --- a/include/joystick/joy-kernel.h +++ b/include/joystick/joy-kernel.h @@ -68,7 +68,7 @@ typedef struct { /* JOY kernel variables */ -extern joy_drv_header* joy_drv; /* Pointer to driver */ +extern joy_drv_header* joy_drv; /* Pointer to driver */ diff --git a/include/limits.h b/include/limits.h index d02d52dca..23474c78c 100644 --- a/include/limits.h +++ b/include/limits.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* limits.h */ +/* limits.h */ /* */ -/* Sizes of integer types */ +/* Sizes of integer types */ /* */ /* */ /* */ @@ -38,30 +38,30 @@ -#define CHAR_BIT 8 +#define CHAR_BIT 8 -#define SCHAR_MIN ((signed char) 0x80) -#define SCHAR_MAX 127 +#define SCHAR_MIN ((signed char) 0x80) +#define SCHAR_MAX 127 -#define UCHAR_MAX 255 +#define UCHAR_MAX 255 -#define CHAR_MIN 0 -#define CHAR_MAX 255 +#define CHAR_MIN 0 +#define CHAR_MAX 255 -#define SHRT_MIN ((short) 0x8000) -#define SHRT_MAX 32767 +#define SHRT_MIN ((short) 0x8000) +#define SHRT_MAX 32767 -#define USHRT_MAX 65535U +#define USHRT_MAX 65535U -#define INT_MIN ((int) 0x8000) -#define INT_MAX 32767 +#define INT_MIN ((int) 0x8000) +#define INT_MAX 32767 -#define UINT_MAX 65535U +#define UINT_MAX 65535U -#define LONG_MAX 2147483647L -#define LONG_MIN ((long) 0x80000000) +#define LONG_MAX 2147483647L +#define LONG_MIN ((long) 0x80000000) -#define ULONG_MAX 4294967295UL +#define ULONG_MAX 4294967295UL diff --git a/include/locale.h b/include/locale.h index f099ad1d2..4134dd5db 100644 --- a/include/locale.h +++ b/include/locale.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* locale.h */ +/* locale.h */ /* */ -/* Localization */ +/* Localization */ /* */ /* */ /* */ @@ -40,38 +40,38 @@ /* NULL pointer */ #ifndef _HAVE_NULL -#define NULL 0 +#define NULL 0 #define _HAVE_NULL #endif /* Locale information constants */ -#define LC_ALL 0 -#define LC_COLLATE 1 -#define LC_CTYPE 2 -#define LC_MONETARY 3 -#define LC_NUMERIC 4 -#define LC_TIME 5 +#define LC_ALL 0 +#define LC_COLLATE 1 +#define LC_CTYPE 2 +#define LC_MONETARY 3 +#define LC_NUMERIC 4 +#define LC_TIME 5 /* Struct containing locale settings */ struct lconv { - char* currency_symbol; - char* decimal_point; - char* grouping; - char* int_curr_symbol; - char* mon_decimal_point; - char* mon_grouping; - char* mon_thousands_sep; - char* negative_sign; - char* positive_sign; - char* thousands_sep; - char frac_digits; - char int_frac_digits; - char n_cs_precedes; - char n_sep_by_space; - char n_sign_posn; - char p_cs_precedes; - char p_sep_by_space; - char p_sign_posn; + char* currency_symbol; + char* decimal_point; + char* grouping; + char* int_curr_symbol; + char* mon_decimal_point; + char* mon_grouping; + char* mon_thousands_sep; + char* negative_sign; + char* positive_sign; + char* thousands_sep; + char frac_digits; + char int_frac_digits; + char n_cs_precedes; + char n_sep_by_space; + char n_sign_posn; + char p_cs_precedes; + char p_sep_by_space; + char p_sign_posn; }; /* Function prototypes */ diff --git a/include/lynx.h b/include/lynx.h index ec1a8c464..e9c702994 100644 --- a/include/lynx.h +++ b/include/lynx.h @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/include/mouse.h b/include/mouse.h index bfb0acad3..bc90263cf 100644 --- a/include/mouse.h +++ b/include/mouse.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* mouse.h */ +/* mouse.h */ /* */ -/* Mouse API */ +/* Mouse API */ /* */ /* */ /* */ @@ -41,7 +41,7 @@ /*****************************************************************************/ -/* Definitions */ +/* Definitions */ /*****************************************************************************/ @@ -55,13 +55,13 @@ #define MOUSE_ERR_INV_IOCTL 5 /* Invalid ioctl code */ /* Mouse button masks */ -#define MOUSE_BTN_LEFT 0x10 +#define MOUSE_BTN_LEFT 0x10 #define MOUSE_BTN_RIGHT 0x01 /* Structure containing the mouse coordinates */ struct mouse_pos { - int x; - int y; + int x; + int y; }; /* Structure containing information about the mouse */ @@ -72,10 +72,10 @@ struct mouse_info { /* Structure used for getbox/setbox */ struct mouse_box { - int minx; - int miny; - int maxx; - int maxy; + int minx; + int miny; + int maxx; + int maxy; }; /* Structure containing mouse callback functions. These functions are declared @@ -113,7 +113,7 @@ extern const void mouse_static_stddrv[]; /*****************************************************************************/ -/* Functions */ +/* Functions */ /*****************************************************************************/ @@ -150,10 +150,10 @@ void __fastcall__ mouse_setbox (const struct mouse_box* box); * NOTE: The function does *not* check if the mouse is currently inside the * given margins. The proper way to use this function therefore is: * - * - Hide the mouse - * - Set the bounding box - * - Place the mouse at the desired position - * - Show the mouse again. + * - Hide the mouse + * - Set the bounding box + * - Place the mouse at the desired position + * - Show the mouse again. * * NOTE2: When setting the box to something that is larger than the actual * screen, the positioning of the mouse cursor can fail. If such margins diff --git a/include/mouse/mouse-kernel.h b/include/mouse/mouse-kernel.h index 1bcac64d5..f024b0926 100644 --- a/include/mouse/mouse-kernel.h +++ b/include/mouse/mouse-kernel.h @@ -45,7 +45,7 @@ /* Mouse kernel variables */ -extern void* mouse_drv; /* Pointer to driver */ +extern void* mouse_drv; /* Pointer to driver */ diff --git a/include/nes.h b/include/nes.h index 46219b3de..3ad442280 100644 --- a/include/nes.h +++ b/include/nes.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* nes.h */ +/* nes.h */ /* */ -/* NES system specific definitions */ +/* NES system specific definitions */ /* */ /* */ /* */ diff --git a/include/o65.h b/include/o65.h index e33f98d97..2321cfe10 100644 --- a/include/o65.h +++ b/include/o65.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* o65.h */ +/* o65.h */ /* */ -/* Definitions for the o65 file format */ +/* Definitions for the o65 file format */ /* */ /* */ /* */ @@ -57,9 +57,9 @@ typedef struct o65_header o65_header; struct o65_header { char marker[2]; /* Non-C64 marker */ char magic[3]; /* o65 magic */ - char version; /* Version number */ + char version; /* Version number */ unsigned mode; /* Mode word */ - o65_size tbase; /* Original text (code) segment address */ + o65_size tbase; /* Original text (code) segment address */ o65_size tlen; /* Size of text (code) segment */ o65_size dbase; /* Original data segment address */ o65_size dlen; /* Size of data segment */ @@ -81,7 +81,7 @@ struct o65_header { #define O65_VERSION 0x00 /* Defines for the mode word */ -#define O65_CPU_65816 0x8000 /* Executable is for 65816 */ +#define O65_CPU_65816 0x8000 /* Executable is for 65816 */ #define O65_CPU_6502 0x0000 /* Executable is for the 6502 */ #define O65_CPU_MASK 0x8000 /* Mask to extract CPU type */ @@ -89,7 +89,7 @@ struct o65_header { #define O65_RELOC_BYTE 0x0000 /* Byte wise relocation */ #define O65_RELOC_MASK 0x4000 /* Mask to extract relocation type */ -#define O65_SIZE_32BIT 0x2000 /* All size words are 32bit */ +#define O65_SIZE_32BIT 0x2000 /* All size words are 32bit */ #define O65_SIZE_16BIT 0x0000 /* All size words are 16bit */ #define O65_SIZE_MASK 0x2000 /* Mask to extract size */ @@ -108,7 +108,7 @@ struct o65_header { #define O65_BSSZERO_MASK 0x0200 /* Mask to extract bss zero flag */ /* The following is used if O65_CPU == 6502 */ -#define O65_CPU2_6502 0x0000 /* Executable is for 6502 */ +#define O65_CPU2_6502 0x0000 /* Executable is for 6502 */ #define O65_CPU2_65C02 0x0010 /* Executable is for 65C02 */ #define O65_CPU2_65SC02 0x0020 /* Executable is for 65SC02 */ #define O65_CPU2_65CE02 0x0030 /* Executable is for 65CE02 */ @@ -131,12 +131,12 @@ struct o65_header { O65_ALIGN_1) /* The four o65 segment types. */ -#define O65_SEGID_UNDEF 0x00 -#define O65_SEGID_ABS 0x01 -#define O65_SEGID_TEXT 0x02 -#define O65_SEGID_DATA 0x03 -#define O65_SEGID_BSS 0x04 -#define O65_SEGID_ZP 0x05 +#define O65_SEGID_UNDEF 0x00 +#define O65_SEGID_ABS 0x01 +#define O65_SEGID_TEXT 0x02 +#define O65_SEGID_DATA 0x03 +#define O65_SEGID_BSS 0x04 +#define O65_SEGID_ZP 0x05 #define O65_SEGID_MASK 0x07 /* Relocation type codes */ @@ -158,14 +158,14 @@ struct o65_header { /* Option tags */ #define O65_OPT_FILENAME 0 -#define O65_OPT_OS 1 -#define O65_OPT_ASM 2 -#define O65_OPT_AUTHOR 3 -#define O65_OPT_TIMESTAMP 4 +#define O65_OPT_OS 1 +#define O65_OPT_ASM 2 +#define O65_OPT_AUTHOR 3 +#define O65_OPT_TIMESTAMP 4 /* Operating system codes for O65_OPT_OS */ -#define O65_OS_OSA65 1 -#define O65_OS_LUNIX 2 +#define O65_OS_OSA65 1 +#define O65_OS_LUNIX 2 #define O65_OS_CC65 3 #define O65_OS_OPENCBM 4 diff --git a/include/pet.h b/include/pet.h index 24e937c5a..0588ee8bf 100644 --- a/include/pet.h +++ b/include/pet.h @@ -2,7 +2,7 @@ /* */ /* pet.h */ /* */ -/* PET system specific definitions */ +/* PET system specific definitions */ /* */ /* */ /* */ @@ -52,8 +52,8 @@ /* Color defines */ -#define COLOR_BLACK 0x00 -#define COLOR_WHITE 0x01 +#define COLOR_BLACK 0x00 +#define COLOR_WHITE 0x01 /* Define hardware */ #include <_pia.h> diff --git a/include/plus4.h b/include/plus4.h index 3a764b984..840e8b342 100644 --- a/include/plus4.h +++ b/include/plus4.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* plus4.h */ +/* plus4.h */ /* */ -/* Plus/4 system specific definitions */ +/* Plus/4 system specific definitions */ /* */ /* */ /* */ diff --git a/include/serial.h b/include/serial.h index b5601170e..f88ab114e 100644 --- a/include/serial.h +++ b/include/serial.h @@ -39,51 +39,51 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Baudrate settings */ #define SER_BAUD_45_5 0x00 -#define SER_BAUD_50 0x01 +#define SER_BAUD_50 0x01 #define SER_BAUD_75 0x02 -#define SER_BAUD_110 0x03 -#define SER_BAUD_134_5 0x04 +#define SER_BAUD_110 0x03 +#define SER_BAUD_134_5 0x04 #define SER_BAUD_150 0x05 -#define SER_BAUD_300 0x06 -#define SER_BAUD_600 0x07 -#define SER_BAUD_1200 0x08 +#define SER_BAUD_300 0x06 +#define SER_BAUD_600 0x07 +#define SER_BAUD_1200 0x08 #define SER_BAUD_1800 0x09 -#define SER_BAUD_2400 0x0A +#define SER_BAUD_2400 0x0A #define SER_BAUD_3600 0x0B -#define SER_BAUD_4800 0x0C +#define SER_BAUD_4800 0x0C #define SER_BAUD_7200 0x0D -#define SER_BAUD_9600 0x0E -#define SER_BAUD_19200 0x0F -#define SER_BAUD_38400 0x10 -#define SER_BAUD_57600 0x11 -#define SER_BAUD_115200 0x12 -#define SER_BAUD_230400 0x13 -#define SER_BAUD_31250 0x14 -#define SER_BAUD_62500 0x15 +#define SER_BAUD_9600 0x0E +#define SER_BAUD_19200 0x0F +#define SER_BAUD_38400 0x10 +#define SER_BAUD_57600 0x11 +#define SER_BAUD_115200 0x12 +#define SER_BAUD_230400 0x13 +#define SER_BAUD_31250 0x14 +#define SER_BAUD_62500 0x15 /* Data bit settings */ -#define SER_BITS_5 0x00 -#define SER_BITS_6 0x01 -#define SER_BITS_7 0x02 -#define SER_BITS_8 0x03 +#define SER_BITS_5 0x00 +#define SER_BITS_6 0x01 +#define SER_BITS_7 0x02 +#define SER_BITS_8 0x03 /* Stop bit settings */ -#define SER_STOP_1 0x00 /* One stop bit */ -#define SER_STOP_2 0x01 /* Two stop bits */ +#define SER_STOP_1 0x00 /* One stop bit */ +#define SER_STOP_2 0x01 /* Two stop bits */ /* Parity settings */ -#define SER_PAR_NONE 0x00 -#define SER_PAR_ODD 0x01 -#define SER_PAR_EVEN 0x02 -#define SER_PAR_MARK 0x03 -#define SER_PAR_SPACE 0x04 +#define SER_PAR_NONE 0x00 +#define SER_PAR_ODD 0x01 +#define SER_PAR_EVEN 0x02 +#define SER_PAR_MARK 0x03 +#define SER_PAR_SPACE 0x04 /* Handshake settings. The latter two may be combined. */ #define SER_HS_NONE 0x00 /* No handshake */ @@ -93,22 +93,22 @@ /* Bit masks to mask out things from the status returned by ser_status. * These are 6551 specific and must be mapped by drivers for other chips. */ -#define SER_STATUS_PE 0x01 /* Parity error */ -#define SER_STATUS_FE 0x02 /* Framing error */ -#define SER_STATUS_OE 0x04 /* Overrun error */ -#define SER_STATUS_DCD 0x20 /* NOT data carrier detect */ -#define SER_STATUS_DSR 0x40 /* NOT data set ready */ +#define SER_STATUS_PE 0x01 /* Parity error */ +#define SER_STATUS_FE 0x02 /* Framing error */ +#define SER_STATUS_OE 0x04 /* Overrun error */ +#define SER_STATUS_DCD 0x20 /* NOT data carrier detect */ +#define SER_STATUS_DSR 0x40 /* NOT data set ready */ /* Error codes returned by all functions */ -#define SER_ERR_OK 0x00 /* Not an error - relax */ +#define SER_ERR_OK 0x00 /* Not an error - relax */ #define SER_ERR_NO_DRIVER 0x01 /* No driver available */ #define SER_ERR_CANNOT_LOAD 0x02 /* Error loading driver */ #define SER_ERR_INV_DRIVER 0x03 /* Invalid driver */ #define SER_ERR_NO_DEVICE 0x04 /* Device (hardware) not found */ -#define SER_ERR_BAUD_UNAVAIL 0x05 /* Baud rate not available */ -#define SER_ERR_NO_DATA 0x06 /* Nothing to read */ -#define SER_ERR_OVERFLOW 0x07 /* No room in send buffer */ -#define SER_ERR_INIT_FAILED 0x08 /* Initialization failed */ +#define SER_ERR_BAUD_UNAVAIL 0x05 /* Baud rate not available */ +#define SER_ERR_NO_DATA 0x06 /* Nothing to read */ +#define SER_ERR_OVERFLOW 0x07 /* No room in send buffer */ +#define SER_ERR_INIT_FAILED 0x08 /* Initialization failed */ #define SER_ERR_INV_IOCTL 0x09 /* IOCTL not supported */ #define SER_ERR_INSTALLED 0x0A /* A driver is already installed */ @@ -123,7 +123,7 @@ struct ser_params { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/setjmp.h b/include/setjmp.h index 0befe8163..460829e38 100644 --- a/include/setjmp.h +++ b/include/setjmp.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* setjmp.h */ +/* setjmp.h */ /* */ -/* Nonlocal jumps */ +/* Nonlocal jumps */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ typedef char jmp_buf [5]; int __fastcall__ _setjmp (jmp_buf buf); -#define setjmp _setjmp /* ISO insists on a macro */ +#define setjmp _setjmp /* ISO insists on a macro */ void __fastcall__ longjmp (jmp_buf buf, int retval) __attribute__((noreturn)); diff --git a/include/stdarg.h b/include/stdarg.h index 4fd822b2a..adf73483c 100644 --- a/include/stdarg.h +++ b/include/stdarg.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* stdarg.h */ +/* stdarg.h */ /* */ -/* Variable arguments */ +/* Variable arguments */ /* */ /* */ /* */ @@ -40,10 +40,10 @@ typedef unsigned char* va_list; -#define va_start(ap, fix) ap = ((va_list)&(fix)) -#define va_arg(ap,type) (*(type*)(ap -= ((sizeof (type) + 1) & ~1))) +#define va_start(ap, fix) ap = ((va_list)&(fix)) +#define va_arg(ap,type) (*(type*)(ap -= ((sizeof (type) + 1) & ~1))) #if __CC65_STD__ >= __CC65_STD_C99__ -#define va_copy(dest, src) ((dest)=(src)) +#define va_copy(dest, src) ((dest)=(src)) #endif #define va_end(ap) diff --git a/include/stdbool.h b/include/stdbool.h index 638d35a58..137dde708 100644 --- a/include/stdbool.h +++ b/include/stdbool.h @@ -1,9 +1,9 @@ /*****************************************************************************/ /* */ -/* stdbool.h */ -/* */ -/* C99 Boolean definitions */ -/* */ +/* stdbool.h */ +/* */ +/* C99 Boolean definitions */ +/* */ /* */ /* */ /* (C) 2002 Greg King */ @@ -11,20 +11,20 @@ /* */ /* This software is provided "as-is," without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ -/* including commercial applications, and to alter and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* including commercial applications, and to alter and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ -/* in a product, an acknowledgment, in the product's documentation, */ -/* would be appreciated, but is not required. */ -/* 2. Alterred source versions must be marked plainly as such, */ -/* and must not be misrepresented as being the original software. */ -/* 3. This notice may not be removed or alterred */ -/* from any source distribution. */ +/* in a product, an acknowledgment, in the product's documentation, */ +/* would be appreciated, but is not required. */ +/* 2. Alterred source versions must be marked plainly as such, */ +/* and must not be misrepresented as being the original software. */ +/* 3. This notice may not be removed or alterred */ +/* from any source distribution. */ /*****************************************************************************/ diff --git a/include/stddef.h b/include/stddef.h index eff0c55bd..3230a32b0 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* stddef.h */ +/* stddef.h */ /* */ -/* Common definitions */ +/* Common definitions */ /* */ /* */ /* */ @@ -54,12 +54,12 @@ typedef unsigned size_t; /* NULL pointer */ #ifndef _HAVE_NULL -#define NULL 0 +#define NULL 0 #define _HAVE_NULL #endif /* offsetof macro */ -#define offsetof(type, member) (size_t) (&((type*) 0)->member) +#define offsetof(type, member) (size_t) (&((type*) 0)->member) diff --git a/include/stdio.h b/include/stdio.h index c29fa4901..6f2f9c3f8 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* stdio.h */ +/* stdio.h */ /* */ -/* Input/output */ +/* Input/output */ /* */ /* */ /* */ @@ -57,33 +57,33 @@ extern FILE* stdout; extern FILE* stderr; /* Standard defines */ -#define _IOFBF 0 -#define _IOLBF 1 -#define _IONBF 2 -#define BUFSIZ 256 -#define EOF -1 -#define FOPEN_MAX 8 -#define SEEK_CUR 0 -#define SEEK_END 1 -#define SEEK_SET 2 -#define TMP_MAX 256 +#define _IOFBF 0 +#define _IOLBF 1 +#define _IONBF 2 +#define BUFSIZ 256 +#define EOF -1 +#define FOPEN_MAX 8 +#define SEEK_CUR 0 +#define SEEK_END 1 +#define SEEK_SET 2 +#define TMP_MAX 256 /* Standard defines that are platform dependent */ #if defined(__APPLE2__) || defined(__APPLE2ENH__) -# define FILENAME_MAX (64+1) +# define FILENAME_MAX (64+1) #elif defined(__ATARI__) -# define FILENAME_MAX (12+1) +# define FILENAME_MAX (12+1) #elif defined(__LUNIX__) # define FILENAME_MAX (80+1) #else # define FILENAME_MAX (16+1) #endif -#define L_tmpnam FILENAME_MAX +#define L_tmpnam FILENAME_MAX /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -132,14 +132,14 @@ int __fastcall__ vsscanf (const char* s, const char* format, va_list ap); int __fastcall__ vfscanf (FILE* f, const char* format, va_list ap); #if __CC65_STD__ == __CC65_STD_CC65__ -FILE* __fastcall__ fdopen (int fd, const char* mode); /* Unix */ -int __fastcall__ fileno (FILE* f); /* Unix */ +FILE* __fastcall__ fdopen (int fd, const char* mode); /* Unix */ +int __fastcall__ fileno (FILE* f); /* Unix */ #endif -void __fastcall__ _poserror (const char* msg); /* cc65 */ +void __fastcall__ _poserror (const char* msg); /* cc65 */ /* Masking macros for some functions */ -#define getc(f) fgetc (f) /* ANSI */ -#define putc(c, f) fputc (c, f) /* ANSI */ +#define getc(f) fgetc (f) /* ANSI */ +#define putc(c, f) fputc (c, f) /* ANSI */ diff --git a/include/stdlib.h b/include/stdlib.h index 57e7f6166..026e19198 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* stdlib.h */ +/* stdlib.h */ /* */ -/* General utilities */ +/* General utilities */ /* */ /* */ /* */ @@ -45,8 +45,8 @@ typedef unsigned size_t; #endif /* Standard exit codes */ -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 /* Return type of the div function */ typedef struct { @@ -94,7 +94,7 @@ size_t _heapmaxavail (void); /* Random numbers */ -#define RAND_MAX 0x7FFF +#define RAND_MAX 0x7FFF int rand (void); void __fastcall__ srand (unsigned seed); void _randomize (void); /* Non-standard */ @@ -107,12 +107,12 @@ int __fastcall__ atoi (const char* s); long __fastcall__ atol (const char* s); int __fastcall__ atexit (void (*exitfunc) (void)); void* __fastcall__ bsearch (const void* key, const void* base, size_t n, - size_t size, int (*cmp) (const void*, const void*)); + size_t size, int (*cmp) (const void*, const void*)); div_t __fastcall__ div (int numer, int denom); void __fastcall__ exit (int ret) __attribute__ ((noreturn)); char* __fastcall__ getenv (const char* name); void __fastcall__ qsort (void* base, size_t count, size_t size, - int (*compare) (const void*, const void*)); + int (*compare) (const void*, const void*)); long __fastcall__ strtol (const char* nptr, char** endptr, int base); unsigned long __fastcall__ strtoul (const char* nptr, char** endptr, int base); int __fastcall__ system (const char* s); diff --git a/include/string.h b/include/string.h index 7eb69959c..19cfba27e 100644 --- a/include/string.h +++ b/include/string.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* string.h */ +/* string.h */ /* */ -/* String handling */ +/* String handling */ /* */ /* */ /* */ @@ -72,7 +72,7 @@ void* __fastcall__ _bzero (void* ptr, size_t n); /* Non standard: */ #if __CC65_STD__ == __CC65_STD_CC65__ void __fastcall__ bzero (void* ptr, size_t n); /* BSD */ -char* __fastcall__ strdup (const char* s); /* SYSV/BSD */ +char* __fastcall__ strdup (const char* s); /* SYSV/BSD */ int __fastcall__ stricmp (const char* s1, const char* s2); /* DOS/Windows */ int __fastcall__ strcasecmp (const char* s1, const char* s2); /* Same for Unix */ int __fastcall__ strnicmp (const char* s1, const char* s2, size_t count); /* DOS/Windows */ diff --git a/include/supervision.h b/include/supervision.h index 85748e0a2..332fe973b 100644 --- a/include/supervision.h +++ b/include/supervision.h @@ -2,7 +2,7 @@ /* */ /* supervision.h */ /* */ -/* Supervision specific definitions */ +/* Supervision specific definitions */ /* */ /* */ /* */ @@ -11,20 +11,20 @@ /* */ /* This software is provided "as-is," without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ -/* including commercial applications, and to alter and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* including commercial applications, and to alter and redistribute it */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ -/* in a product, an acknowledgment, in the product's documentation, */ -/* would be appreciated, but is not required. */ -/* 2. Alterred source versions must be marked plainly as such, */ -/* and must not be misrepresented as being the original software. */ -/* 3. This notice may not be removed or alterred */ -/* from any source distribution. */ +/* in a product, an acknowledgment, in the product's documentation, */ +/* would be appreciated, but is not required. */ +/* 2. Alterred source versions must be marked plainly as such, */ +/* and must not be misrepresented as being the original software. */ +/* 3. This notice may not be removed or alterred */ +/* from any source distribution. */ /* */ /*****************************************************************************/ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -89,8 +89,8 @@ struct __sv_dma { #define SV_BANK (*(unsigned char*)0x2026) #define SV_BANK_COMBINE(nmi,irq_timer,irq_dma,lcd_on, timer_prescale, bank) \ - ((nmi)?1:0)|((irq_timer)?2:0)|((irq_dma)?4:0)|((lcd_on)?8:0) \ - |((timer_prescale)?0x10:0)|((bank)<<5) + ((nmi)?1:0)|((irq_timer)?2:0)|((irq_dma)?4:0)|((lcd_on)?8:0) \ + |((timer_prescale)?0x10:0)|((bank)<<5) #define SV_VIDEO ((unsigned char*)0x4000) #define SV_TIMER_COUNT (*(unsigned char*)0x2023) diff --git a/include/sys/types.h b/include/sys/types.h index 087bff5d8..9b1e9610f 100644 --- a/include/sys/types.h +++ b/include/sys/types.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -53,7 +53,7 @@ typedef long int off_t; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/sys/utsname.h b/include/sys/utsname.h index 0cf2cc4b4..28feecc46 100644 --- a/include/sys/utsname.h +++ b/include/sys/utsname.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -80,7 +80,7 @@ struct utsname { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/tgi.h b/include/tgi.h index 661403370..a43eb0cc3 100644 --- a/include/tgi.h +++ b/include/tgi.h @@ -70,7 +70,7 @@ typedef struct tgi_vectorfont tgi_vectorfont; /*****************************************************************************/ -/* Functions */ +/* Functions */ /*****************************************************************************/ diff --git a/include/tgi/tgi-error.h b/include/tgi/tgi-error.h index e8dd9c236..334feaa1f 100644 --- a/include/tgi/tgi-error.h +++ b/include/tgi/tgi-error.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -50,7 +50,7 @@ #define TGI_ERR_INV_DRIVER 3 /* Invalid driver */ #define TGI_ERR_INV_MODE 4 /* Mode not supported by driver */ #define TGI_ERR_INV_ARG 5 /* Invalid function argument */ -#define TGI_ERR_INV_FUNC 6 /* Function not supported */ +#define TGI_ERR_INV_FUNC 6 /* Function not supported */ #define TGI_ERR_INV_FONT 7 /* Font file is invalid */ #define TGI_ERR_NO_RES 8 /* Out of resources */ #define TGI_ERR_INSTALLED 9 /* A driver is already installed */ diff --git a/include/tgi/tgi-kernel.h b/include/tgi/tgi-kernel.h index 3d0bbda84..8367e4453 100644 --- a/include/tgi/tgi-kernel.h +++ b/include/tgi/tgi-kernel.h @@ -39,13 +39,13 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* TGI kernel variables */ -extern void* tgi_drv; /* Pointer to driver */ +extern void* tgi_drv; /* Pointer to driver */ extern unsigned char tgi_error; /* Last error code */ extern unsigned char tgi_gmode; /* Flag: Graphics mode active */ extern int tgi_curx; /* Current drawing cursor X */ diff --git a/include/tgi/tgi-vectorfont.h b/include/tgi/tgi-vectorfont.h index bf36f8b0b..82513b271 100644 --- a/include/tgi/tgi-vectorfont.h +++ b/include/tgi/tgi-vectorfont.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -71,7 +71,7 @@ struct tgi_vectorfont { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/include/time.h b/include/time.h index a38508000..507d7e29a 100644 --- a/include/time.h +++ b/include/time.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* time.h */ +/* time.h */ /* */ -/* Date and time */ +/* Date and time */ /* */ /* */ /* */ @@ -40,7 +40,7 @@ /* NULL pointer */ #ifndef _HAVE_NULL -#define NULL 0 +#define NULL 0 #define _HAVE_NULL #endif @@ -55,7 +55,7 @@ typedef unsigned long clock_t; /* Structure for broken down time */ struct tm { - int tm_sec; + int tm_sec; int tm_min; int tm_hour; int tm_mday; @@ -79,32 +79,32 @@ extern struct _timezone { #if defined(__ATARI__) /* The clock depends on the video standard, so read it at runtime */ unsigned _clocks_per_sec (void); -# define CLK_TCK _clocks_per_sec() -# define CLOCKS_PER_SEC _clocks_per_sec() +# define CLK_TCK _clocks_per_sec() +# define CLOCKS_PER_SEC _clocks_per_sec() #elif defined(__ATMOS__) -# define CLK_TCK 100 /* POSIX */ -# define CLOCKS_PER_SEC 100 /* ANSI */ +# define CLK_TCK 100 /* POSIX */ +# define CLOCKS_PER_SEC 100 /* ANSI */ #elif defined(__CBM__) # if defined(__CBM510__) || defined(__CBM610__) /* The 510/610 gets its clock from the AC current */ -# define CLK_TCK 50 /* POSIX */ -# define CLOCKS_PER_SEC 50 /* ANSI */ +# define CLK_TCK 50 /* POSIX */ +# define CLOCKS_PER_SEC 50 /* ANSI */ # else -# define CLK_TCK 60 /* POSIX */ -# define CLOCKS_PER_SEC 60 /* ANSI */ +# define CLK_TCK 60 /* POSIX */ +# define CLOCKS_PER_SEC 60 /* ANSI */ # endif #elif defined(__NES__) -# define CLK_TCK 50 /* POSIX */ -# define CLOCKS_PER_SEC 50 /* ANSI */ +# define CLK_TCK 50 /* POSIX */ +# define CLOCKS_PER_SEC 50 /* ANSI */ #elif defined(__GEOS__) -# define CLK_TCK 1 /* POSIX */ -# define CLOCKS_PER_SEC 1 /* ANSI */ +# define CLK_TCK 1 /* POSIX */ +# define CLOCKS_PER_SEC 1 /* ANSI */ #elif defined(__LYNX__) /* The clock-rate depends on the video scan-rate; ** so, read it at run-time. */ extern clock_t _clk_tck (void); -# define CLK_TCK _clk_tck() -# define CLOCKS_PER_SEC _clk_tck() +# define CLK_TCK _clk_tck() +# define CLOCKS_PER_SEC _clk_tck() #endif diff --git a/include/unistd.h b/include/unistd.h index fb401be89..05b60f1fd 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -39,15 +39,15 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Predefined file handles */ -#define STDIN_FILENO 0 -#define STDOUT_FILENO 1 -#define STDERR_FILENO 2 +#define STDIN_FILENO 0 +#define STDOUT_FILENO 1 +#define STDERR_FILENO 2 /* WE need size_t */ #ifndef _HAVE_size_t @@ -68,7 +68,7 @@ extern int optind, opterr, optopt; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -77,12 +77,12 @@ extern int optind, opterr, optopt; int __fastcall__ write (int fd, const void* buf, unsigned count); int __fastcall__ read (int fd, void* buf, unsigned count); off_t __fastcall__ lseek (int fd, off_t offset, int whence); -int __fastcall__ unlink (const char* name); /* Same as remove() */ +int __fastcall__ unlink (const char* name); /* Same as remove() */ /* Directories */ int __fastcall__ chdir (const char* name); char* __fastcall__ getcwd (char* buf, size_t size); -int mkdir (const char* name, ...); /* May take a mode argument */ +int mkdir (const char* name, ...); /* May take a mode argument */ int __fastcall__ rmdir (const char* name); /* Others */ diff --git a/include/vic20.h b/include/vic20.h index 378e32b4e..c675de6d2 100644 --- a/include/vic20.h +++ b/include/vic20.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* vic20.h */ +/* vic20.h */ /* */ -/* vic20 system specific definitions */ +/* vic20 system specific definitions */ /* */ /* */ /* */ @@ -46,55 +46,55 @@ /* Additional key defines */ -#define CH_F1 133 -#define CH_F2 137 -#define CH_F3 134 -#define CH_F4 138 -#define CH_F5 135 -#define CH_F6 139 -#define CH_F7 136 -#define CH_F8 140 +#define CH_F1 133 +#define CH_F2 137 +#define CH_F3 134 +#define CH_F4 138 +#define CH_F5 135 +#define CH_F6 139 +#define CH_F7 136 +#define CH_F8 140 /* Color defines */ -#define COLOR_BLACK 0x00 -#define COLOR_WHITE 0x01 -#define COLOR_RED 0x02 -#define COLOR_CYAN 0x03 -#define COLOR_VIOLET 0x04 -#define COLOR_GREEN 0x05 -#define COLOR_BLUE 0x06 -#define COLOR_YELLOW 0x07 -#define COLOR_ORANGE 0x08 -#define COLOR_BROWN 0x09 -#define COLOR_LIGHTRED 0x0A -#define COLOR_GRAY1 0x0B -#define COLOR_GRAY2 0x0C -#define COLOR_LIGHTGREEN 0x0D -#define COLOR_LIGHTBLUE 0x0E -#define COLOR_GRAY3 0x0F +#define COLOR_BLACK 0x00 +#define COLOR_WHITE 0x01 +#define COLOR_RED 0x02 +#define COLOR_CYAN 0x03 +#define COLOR_VIOLET 0x04 +#define COLOR_GREEN 0x05 +#define COLOR_BLUE 0x06 +#define COLOR_YELLOW 0x07 +#define COLOR_ORANGE 0x08 +#define COLOR_BROWN 0x09 +#define COLOR_LIGHTRED 0x0A +#define COLOR_GRAY1 0x0B +#define COLOR_GRAY2 0x0C +#define COLOR_LIGHTGREEN 0x0D +#define COLOR_LIGHTBLUE 0x0E +#define COLOR_GRAY3 0x0F /* Define hardware */ #include <_vic.h> -#define VIC (*(struct __vic*)0x9000) +#define VIC (*(struct __vic*)0x9000) #include <_6522.h> -#define VIA1 (*(struct __6522*)0x9110) -#define VIA2 (*(struct __6522*)0x9120) +#define VIA1 (*(struct __6522*)0x9110) +#define VIA2 (*(struct __6522*)0x9120) /* Define special memory areas */ -#define COLOR_RAM ((unsigned char*)0x9600) +#define COLOR_RAM ((unsigned char*)0x9600) /* The addresses of the static drivers */ extern void vic20_ptvjoy_joy[]; -extern void vic20_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ +extern void vic20_stdjoy_joy[]; /* Referred to by joy_static_stddrv[] */ diff --git a/libsrc/apple2/_scrsize.s b/libsrc/apple2/_scrsize.s index 62988ae16..7d1079e15 100644 --- a/libsrc/apple2/_scrsize.s +++ b/libsrc/apple2/_scrsize.s @@ -4,14 +4,14 @@ ; Screen size variables ; - .export screensize + .export screensize .include "apple2.inc" screensize: - ldx WNDWDTH - lda WNDBTM + ldx WNDWDTH + lda WNDBTM sec - sbc WNDTOP + sbc WNDTOP tay rts diff --git a/libsrc/apple2/break.s b/libsrc/apple2/break.s index e645bfde9..9129dde96 100644 --- a/libsrc/apple2/break.s +++ b/libsrc/apple2/break.s @@ -5,14 +5,14 @@ ; void reset_brk (void); ; - .export _set_brk, _reset_brk - .destructor _reset_brk + .export _set_brk, _reset_brk + .destructor _reset_brk ; Be sure to export the following variables absolute - .export _brk_a: abs, _brk_x: abs, _brk_y: abs + .export _brk_a: abs, _brk_x: abs, _brk_y: abs .export _brk_sr: abs, _brk_pc: abs - .include "apple2.inc" + .include "apple2.inc" _brk_a = $45 _brk_x = $46 @@ -22,51 +22,51 @@ _brk_sp = $49 _brk_pc = $3A .bss -oldvec: .res 2 ; Old vector +oldvec: .res 2 ; Old vector .data -uservec: jmp $FFFF ; Patched at runtime +uservec: jmp $FFFF ; Patched at runtime .code ; Set the break vector -.proc _set_brk +.proc _set_brk - sta uservec+1 - stx uservec+2 ; Set the user vector + sta uservec+1 + stx uservec+2 ; Set the user vector - lda oldvec - ora oldvec+1 ; Did we save the vector already? - bne L1 ; Jump if we installed the handler already + lda oldvec + ora oldvec+1 ; Did we save the vector already? + bne L1 ; Jump if we installed the handler already - lda BRKVec - sta oldvec - lda BRKVec+1 - sta oldvec+1 ; Save the old vector + lda BRKVec + sta oldvec + lda BRKVec+1 + sta oldvec+1 ; Save the old vector -L1: lda #brk_handler - sta BRKVec - stx BRKVec+1 - rts +L1: lda #brk_handler + sta BRKVec + stx BRKVec+1 + rts .endproc ; Reset the break vector -.proc _reset_brk +.proc _reset_brk - lda oldvec - ldx oldvec+1 - beq @L9 ; Jump if vector not installed - sta BRKVec - stx BRKVec+1 - lda #$00 - sta oldvec ; Clear the old vector - stx oldvec+1 -@L9: rts + lda oldvec + ldx oldvec+1 + beq @L9 ; Jump if vector not installed + sta BRKVec + stx BRKVec+1 + lda #$00 + sta oldvec ; Clear the old vector + stx oldvec+1 +@L9: rts .endproc @@ -74,39 +74,39 @@ L1: lda #_____ - .byte CT_NONE ; 63/3f _____?_____ + .byte CT_CTRL ; 0/00 ___ctrl_@___ + .byte CT_CTRL ; 1/01 ___ctrl_A___ + .byte CT_CTRL ; 2/02 ___ctrl_B___ + .byte CT_CTRL ; 3/03 ___ctrl_C___ + .byte CT_CTRL ; 4/04 ___ctrl_D___ + .byte CT_CTRL ; 5/05 ___ctrl_E___ + .byte CT_CTRL ; 6/06 ___ctrl_F___ + .byte CT_CTRL ; 7/07 ___ctrl_G___ + .byte CT_CTRL ; 8/08 ___ctrl_H___ + .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB + ; 9/09 ___ctrl_I___ + .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___ + .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___ + .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___ + .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___ + .byte CT_CTRL ; 14/0e ___ctrl_N___ + .byte CT_CTRL ; 15/0f ___ctrl_O___ + .byte CT_CTRL ; 16/10 ___ctrl_P___ + .byte CT_CTRL ; 17/11 ___ctrl_Q___ + .byte CT_CTRL ; 18/12 ___ctrl_R___ + .byte CT_CTRL ; 19/13 ___ctrl_S___ + .byte CT_CTRL ; 20/14 ___ctrl_T___ + .byte CT_CTRL ; 21/15 ___ctrl_U___ + .byte CT_CTRL ; 22/16 ___ctrl_V___ + .byte CT_CTRL ; 23/17 ___ctrl_W___ + .byte CT_CTRL ; 24/18 ___ctrl_X___ + .byte CT_CTRL ; 25/19 ___ctrl_Y___ + .byte CT_CTRL ; 26/1a ___ctrl_Z___ + .byte CT_CTRL ; 27/1b ___ctrl_[___ + .byte CT_CTRL ; 28/1c ___ctrl_\___ + .byte CT_CTRL ; 29/1d ___ctrl_]___ + .byte CT_CTRL ; 30/1e ___ctrl_^___ + .byte CT_CTRL ; 31/1f ___ctrl_____ + .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___ + .byte CT_NONE ; 33/21 _____!_____ + .byte CT_NONE ; 34/22 _____"_____ + .byte CT_NONE ; 35/23 _____#_____ + .byte CT_NONE ; 36/24 _____$_____ + .byte CT_NONE ; 37/25 _____%_____ + .byte CT_NONE ; 38/26 _____&_____ + .byte CT_NONE ; 39/27 _____'_____ + .byte CT_NONE ; 40/28 _____(_____ + .byte CT_NONE ; 41/29 _____)_____ + .byte CT_NONE ; 42/2a _____*_____ + .byte CT_NONE ; 43/2b _____+_____ + .byte CT_NONE ; 44/2c _____,_____ + .byte CT_NONE ; 45/2d _____-_____ + .byte CT_NONE ; 46/2e _____._____ + .byte CT_NONE ; 47/2f _____/_____ + .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ + .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ + .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ + .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ + .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ + .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ + .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ + .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ + .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ + .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ + .byte CT_NONE ; 58/3a _____:_____ + .byte CT_NONE ; 59/3b _____;_____ + .byte CT_NONE ; 60/3c _____<_____ + .byte CT_NONE ; 61/3d _____=_____ + .byte CT_NONE ; 62/3e _____>_____ + .byte CT_NONE ; 63/3f _____?_____ - .byte CT_NONE ; 64/40 _____@_____ - .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____ - .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____ - .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____ - .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____ - .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____ - .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____ - .byte CT_UPPER ; 71/47 _____G_____ - .byte CT_UPPER ; 72/48 _____H_____ - .byte CT_UPPER ; 73/49 _____I_____ - .byte CT_UPPER ; 74/4a _____J_____ - .byte CT_UPPER ; 75/4b _____K_____ - .byte CT_UPPER ; 76/4c _____L_____ - .byte CT_UPPER ; 77/4d _____M_____ - .byte CT_UPPER ; 78/4e _____N_____ - .byte CT_UPPER ; 79/4f _____O_____ - .byte CT_UPPER ; 80/50 _____P_____ - .byte CT_UPPER ; 81/51 _____Q_____ - .byte CT_UPPER ; 82/52 _____R_____ - .byte CT_UPPER ; 83/53 _____S_____ - .byte CT_UPPER ; 84/54 _____T_____ - .byte CT_UPPER ; 85/55 _____U_____ - .byte CT_UPPER ; 86/56 _____V_____ - .byte CT_UPPER ; 87/57 _____W_____ - .byte CT_UPPER ; 88/58 _____X_____ - .byte CT_UPPER ; 89/59 _____Y_____ - .byte CT_UPPER ; 90/5a _____Z_____ - .byte CT_NONE ; 91/5b _____[_____ - .byte CT_NONE ; 92/5c _____\_____ - .byte CT_NONE ; 93/5d _____]_____ - .byte CT_NONE ; 94/5e _____^_____ - .byte CT_NONE ; 95/5f _UNDERLINE_ - .byte CT_NONE ; 96/60 ___grave___ - .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____ - .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____ - .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____ - .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____ - .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____ - .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____ - .byte CT_LOWER ; 103/67 _____g_____ - .byte CT_LOWER ; 104/68 _____h_____ - .byte CT_LOWER ; 105/69 _____i_____ - .byte CT_LOWER ; 106/6a _____j_____ - .byte CT_LOWER ; 107/6b _____k_____ - .byte CT_LOWER ; 108/6c _____l_____ - .byte CT_LOWER ; 109/6d _____m_____ - .byte CT_LOWER ; 110/6e _____n_____ - .byte CT_LOWER ; 111/6f _____o_____ - .byte CT_LOWER ; 112/70 _____p_____ - .byte CT_LOWER ; 113/71 _____q_____ - .byte CT_LOWER ; 114/72 _____r_____ - .byte CT_LOWER ; 115/73 _____s_____ - .byte CT_LOWER ; 116/74 _____t_____ - .byte CT_LOWER ; 117/75 _____u_____ - .byte CT_LOWER ; 118/76 _____v_____ - .byte CT_LOWER ; 119/77 _____w_____ - .byte CT_LOWER ; 120/78 _____x_____ - .byte CT_LOWER ; 121/79 _____y_____ - .byte CT_LOWER ; 122/7a _____z_____ - .byte CT_NONE ; 123/7b _____{_____ - .byte CT_NONE ; 124/7c _____|_____ - .byte CT_NONE ; 125/7d _____}_____ - .byte CT_NONE ; 126/7e _____~_____ - .byte CT_OTHER_WS ; 127/7f ____DEL____ + .byte CT_NONE ; 64/40 _____@_____ + .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____ + .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____ + .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____ + .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____ + .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____ + .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____ + .byte CT_UPPER ; 71/47 _____G_____ + .byte CT_UPPER ; 72/48 _____H_____ + .byte CT_UPPER ; 73/49 _____I_____ + .byte CT_UPPER ; 74/4a _____J_____ + .byte CT_UPPER ; 75/4b _____K_____ + .byte CT_UPPER ; 76/4c _____L_____ + .byte CT_UPPER ; 77/4d _____M_____ + .byte CT_UPPER ; 78/4e _____N_____ + .byte CT_UPPER ; 79/4f _____O_____ + .byte CT_UPPER ; 80/50 _____P_____ + .byte CT_UPPER ; 81/51 _____Q_____ + .byte CT_UPPER ; 82/52 _____R_____ + .byte CT_UPPER ; 83/53 _____S_____ + .byte CT_UPPER ; 84/54 _____T_____ + .byte CT_UPPER ; 85/55 _____U_____ + .byte CT_UPPER ; 86/56 _____V_____ + .byte CT_UPPER ; 87/57 _____W_____ + .byte CT_UPPER ; 88/58 _____X_____ + .byte CT_UPPER ; 89/59 _____Y_____ + .byte CT_UPPER ; 90/5a _____Z_____ + .byte CT_NONE ; 91/5b _____[_____ + .byte CT_NONE ; 92/5c _____\_____ + .byte CT_NONE ; 93/5d _____]_____ + .byte CT_NONE ; 94/5e _____^_____ + .byte CT_NONE ; 95/5f _UNDERLINE_ + .byte CT_NONE ; 96/60 ___grave___ + .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____ + .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____ + .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____ + .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____ + .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____ + .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____ + .byte CT_LOWER ; 103/67 _____g_____ + .byte CT_LOWER ; 104/68 _____h_____ + .byte CT_LOWER ; 105/69 _____i_____ + .byte CT_LOWER ; 106/6a _____j_____ + .byte CT_LOWER ; 107/6b _____k_____ + .byte CT_LOWER ; 108/6c _____l_____ + .byte CT_LOWER ; 109/6d _____m_____ + .byte CT_LOWER ; 110/6e _____n_____ + .byte CT_LOWER ; 111/6f _____o_____ + .byte CT_LOWER ; 112/70 _____p_____ + .byte CT_LOWER ; 113/71 _____q_____ + .byte CT_LOWER ; 114/72 _____r_____ + .byte CT_LOWER ; 115/73 _____s_____ + .byte CT_LOWER ; 116/74 _____t_____ + .byte CT_LOWER ; 117/75 _____u_____ + .byte CT_LOWER ; 118/76 _____v_____ + .byte CT_LOWER ; 119/77 _____w_____ + .byte CT_LOWER ; 120/78 _____x_____ + .byte CT_LOWER ; 121/79 _____y_____ + .byte CT_LOWER ; 122/7a _____z_____ + .byte CT_NONE ; 123/7b _____{_____ + .byte CT_NONE ; 124/7c _____|_____ + .byte CT_NONE ; 125/7d _____}_____ + .byte CT_NONE ; 126/7e _____~_____ + .byte CT_OTHER_WS ; 127/7f ____DEL____ .endrepeat diff --git a/libsrc/apple2/cvline.s b/libsrc/apple2/cvline.s index 280e4ced3..1ac3fad74 100644 --- a/libsrc/apple2/cvline.s +++ b/libsrc/apple2/cvline.s @@ -5,31 +5,31 @@ ; void __fastcall__ cvline (unsigned char length); ; - .export _cvlinexy, _cvline, cvlinedirect - .import popa, _gotoxy, putchar, newline + .export _cvlinexy, _cvline, cvlinedirect + .import popa, _gotoxy, putchar, newline - .include "zeropage.inc" + .include "zeropage.inc" _cvlinexy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length and run into _cvline + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length and run into _cvline _cvline: - .ifdef __APPLE2ENH__ - ldx #'|' | $80 ; Vertical line, screen code + .ifdef __APPLE2ENH__ + ldx #'|' | $80 ; Vertical line, screen code .else - ldx #'!' | $80 ; Vertical line, screen code + ldx #'!' | $80 ; Vertical line, screen code .endif cvlinedirect: - cmp #$00 ; Is the length zero? - beq done ; Jump if done - sta tmp1 -: txa ; Screen code - jsr putchar ; Write, no cursor advance - jsr newline ; Advance cursor to next line - dec tmp1 - bne :- + cmp #$00 ; Is the length zero? + beq done ; Jump if done + sta tmp1 +: txa ; Screen code + jsr putchar ; Write, no cursor advance + jsr newline ; Advance cursor to next line + dec tmp1 + bne :- done: rts diff --git a/libsrc/apple2/devicedir.s b/libsrc/apple2/devicedir.s index b2a6382f8..dea2ba8c5 100644 --- a/libsrc/apple2/devicedir.s +++ b/libsrc/apple2/devicedir.s @@ -4,79 +4,79 @@ ; char* __fastcall__ getdevicedir (unsigned char device, char* buf, size_t size); ; - .export _getdevicedir - .import popax, popa + .export _getdevicedir + .import popax, popa - .include "zeropage.inc" - .include "errno.inc" - .include "mli.inc" + .include "zeropage.inc" + .include "errno.inc" + .include "mli.inc" _getdevicedir: ; Save size - sta ptr2 - stx ptr2+1 + sta ptr2 + stx ptr2+1 ; Save buf - jsr popax - sta ptr1 - stx ptr1+1 + jsr popax + sta ptr1 + stx ptr1+1 ; Set buf - sta mliparam + MLI::ON_LINE::DATA_BUFFER - stx mliparam + MLI::ON_LINE::DATA_BUFFER+1 + sta mliparam + MLI::ON_LINE::DATA_BUFFER + stx mliparam + MLI::ON_LINE::DATA_BUFFER+1 ; Set device - jsr popa + jsr popa asl asl asl asl - sta mliparam + MLI::ON_LINE::UNIT_NUM + sta mliparam + MLI::ON_LINE::UNIT_NUM ; Check for valid slot - and #$70 - beq erange + and #$70 + beq erange ; Check for sufficient buf size - lda ptr2+1 - bne :++ ; Buf >= 256 - lda ptr2 - cmp #17 - bcs :++ ; Buf >= 17 + lda ptr2+1 + bne :++ ; Buf >= 256 + lda ptr2 + cmp #17 + bcs :++ ; Buf >= 17 ; Handle errors -erange: lda #280 + lda #>280 pha - bne done ; Branch always + bne done ; Branch always diff --git a/libsrc/apple2/diosectsize.s b/libsrc/apple2/diosectsize.s index f9737cdd5..d3ece3779 100644 --- a/libsrc/apple2/diosectsize.s +++ b/libsrc/apple2/diosectsize.s @@ -4,15 +4,15 @@ ; unsigned __fastcall__ dio_query_sectsize (dhandle_t handle); ; - .export _dio_query_sectsize + .export _dio_query_sectsize - .include "errno.inc" + .include "errno.inc" _dio_query_sectsize: ; Clear error - stx __oserror ; X = 0 + stx __oserror ; X = 0 ; Return ProDOS 8 block size - txa ; X = 0 - ldx #>512 + txa ; X = 0 + ldx #>512 rts diff --git a/libsrc/apple2/diowrite.s b/libsrc/apple2/diowrite.s index 6deb754f2..d031c49d0 100644 --- a/libsrc/apple2/diowrite.s +++ b/libsrc/apple2/diowrite.s @@ -4,12 +4,12 @@ ; unsigned char __fastcall__ dio_write (dhandle_t handle, unsigned sect_num, const void *buffer); ; - .export _dio_write - .import dioprolog, diocommon + .export _dio_write + .import dioprolog, diocommon - .include "mli.inc" + .include "mli.inc" _dio_write: - jsr dioprolog - lda #WRITE_BLOCK_CALL - jmp diocommon + jsr dioprolog + lda #WRITE_BLOCK_CALL + jmp diocommon diff --git a/libsrc/apple2/dir.h b/libsrc/apple2/dir.h index 0faffd634..369080c47 100644 --- a/libsrc/apple2/dir.h +++ b/libsrc/apple2/dir.h @@ -36,23 +36,23 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ struct DIR { - int fd; + int fd; unsigned char entry_length; unsigned char entries_per_block; unsigned char current_entry; union { - unsigned char bytes[512]; - struct { - unsigned prev_block; - unsigned next_block; - unsigned char entries[1]; - } content; + unsigned char bytes[512]; + struct { + unsigned prev_block; + unsigned next_block; + unsigned char entries[1]; + } content; } block; }; diff --git a/libsrc/apple2/dosdetect.s b/libsrc/apple2/dosdetect.s index 5dcda07a9..68910e3da 100644 --- a/libsrc/apple2/dosdetect.s +++ b/libsrc/apple2/dosdetect.s @@ -34,12 +34,12 @@ initdostype: lda $BF00 - cmp #$4C ; Is MLI present? (JMP opcode) + cmp #$4C ; Is MLI present? (JMP opcode) bne done - lda KVERSION ; ProDOS 8 kernel version + lda KVERSION ; ProDOS 8 kernel version cmp #$10 bcs :+ - ora #$10 ; Make high nibble match major version + ora #$10 ; Make high nibble match major version : sta __dos_type done: rts diff --git a/libsrc/apple2/emd/a2.auxmem.s b/libsrc/apple2/emd/a2.auxmem.s index 7a72cfc85..ecf78fc37 100644 --- a/libsrc/apple2/emd/a2.auxmem.s +++ b/libsrc/apple2/emd/a2.auxmem.s @@ -5,48 +5,48 @@ ; Ullrich von Bassewitz, 2002-12-02 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" - .include "em-error.inc" + .include "em-kernel.inc" + .include "em-error.inc" ; ------------------------------------------------------------------------ ; Header. Includes jump table -.segment "JUMPTABLE" +.segment "JUMPTABLE" ; Driver signature - .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte $65, $6d, $64 ; "emd" + .byte EMD_API_VERSION ; EM API version number ; Jump table. - .word INSTALL - .word DEINSTALL - .word PAGECOUNT - .word MAP - .word USE - .word COMMIT - .word COPYFROM - .word COPYTO + .word INSTALL + .word DEINSTALL + .word PAGECOUNT + .word MAP + .word USE + .word COMMIT + .word COPYFROM + .word COPYTO ; ------------------------------------------------------------------------ ; Constants -BASE = $0200 -AUXCARD = $C30C ; Card signature -AUXMOVE = $C311 ; Auxiliary move routine -PAGES = ($C000 - BASE) / 256 +BASE = $0200 +AUXCARD = $C30C ; Card signature +AUXMOVE = $C311 ; Auxiliary move routine +PAGES = ($C000 - BASE) / 256 ; ------------------------------------------------------------------------ ; Data. .data -curpage: .byte $FF ; Current page number (invalid) +curpage: .byte $FF ; Current page number (invalid) .bss -window: .res 256 ; Memory "window" +window: .res 256 ; Memory "window" .code @@ -58,15 +58,15 @@ window: .res 256 ; Memory "window" ; INSTALL: - ldx #0 - lda AUXCARD - and #$f0 - cmp #$80 - bne @L1 - lda #EM_ERR_OK - rts -@L1: lda #EM_ERR_NO_DEVICE -; rts + ldx #0 + lda AUXCARD + and #$f0 + cmp #$80 + bne @L1 + lda #EM_ERR_OK + rts +@L1: lda #EM_ERR_NO_DEVICE +; rts ; ------------------------------------------------------------------------ ; DEINSTALL routine. Is called before the driver is removed from memory. @@ -74,7 +74,7 @@ INSTALL: ; DEINSTALL: - rts + rts ; ------------------------------------------------------------------------ @@ -82,9 +82,9 @@ DEINSTALL: ; PAGECOUNT: - lda #PAGES - rts + lda #PAGES + rts ; ------------------------------------------------------------------------ ; MAP: Map the page in a/x into memory and return a pointer to the page in @@ -92,83 +92,83 @@ PAGECOUNT: ; by the driver. ; -MAP: sta curpage ; Remember the new page +MAP: sta curpage ; Remember the new page - clc - adc #>BASE - sta ptr1+1 - ldy #$00 - sty ptr1 + clc + adc #>BASE + sta ptr1+1 + ldy #$00 + sty ptr1 - lda #window - sta ptr2+1 + lda #window + sta ptr2+1 ; Transfer one page - clc ; Direction flag - jsr transfer ; Transfer one page + clc ; Direction flag + jsr transfer ; Transfer one page ; Return the memory window - lda #window ; Return the window address + lda #window ; Return the window address ; Done -done: rts +done: rts ; ------------------------------------------------------------------------ ; USE: Tell the driver that the window is now associated with a given page. -USE: sta curpage ; Remember the page - lda #window ; Return the window - rts +USE: sta curpage ; Remember the page + lda #window ; Return the window + rts ; ------------------------------------------------------------------------ ; COMMIT: Commit changes in the memory window to extended storage. -COMMIT: lda curpage ; Get the current page - cmp #$FF - beq done ; Jump if no page mapped +COMMIT: lda curpage ; Get the current page + cmp #$FF + beq done ; Jump if no page mapped - clc - adc #>BASE - sta ptr2+1 - ldy #$00 - sty ptr2 + clc + adc #>BASE + sta ptr2+1 + ldy #$00 + sty ptr2 - lda #window - sta ptr1+1 - lda #<$FF - sta ptr4 - lda #>$FF - sta ptr4+1 - sec ; Direction flag + lda #window + sta ptr1+1 + lda #<$FF + sta ptr4 + lda #>$FF + sta ptr4+1 + sec ; Direction flag ; Transfer one page/all bytes transfer: - php - clc - lda ptr1 - sta $3C - adc ptr4 - sta $3E - lda ptr1+1 - sta $3D - adc ptr4+1 - sta $3F - lda ptr2 - sta $42 - lda ptr2+1 - sta $43 - plp - jmp AUXMOVE + php + clc + lda ptr1 + sta $3C + adc ptr4 + sta $3E + lda ptr1+1 + sta $3D + adc ptr4+1 + sta $3F + lda ptr2 + sta $42 + lda ptr2+1 + sta $43 + plp + jmp AUXMOVE ; ------------------------------------------------------------------------ ; COPYFROM: Copy from extended into linear memory. A pointer to a structure @@ -177,34 +177,34 @@ transfer: ; COPYFROM: - sta ptr3 - stx ptr3+1 ; Save the passed em_copy pointer + sta ptr3 + stx ptr3+1 ; Save the passed em_copy pointer - ldy #EM_COPY::OFFS - lda (ptr3),y - sta ptr1 - ldy #EM_COPY::PAGE - lda (ptr3),y - clc - adc #>BASE - sta ptr1+1 ; From + ldy #EM_COPY::OFFS + lda (ptr3),y + sta ptr1 + ldy #EM_COPY::PAGE + lda (ptr3),y + clc + adc #>BASE + sta ptr1+1 ; From - ldy #EM_COPY::BUF - lda (ptr3),y - sta ptr2 - iny - lda (ptr3),y - sta ptr2+1 ; To - clc ; Direction flag + ldy #EM_COPY::BUF + lda (ptr3),y + sta ptr2 + iny + lda (ptr3),y + sta ptr2+1 ; To + clc ; Direction flag -common: ldy #EM_COPY::COUNT - lda (ptr3),y ; Get bytes in last page - sta ptr4 - iny - lda (ptr3),y ; Get number of pages - sta ptr4+1 +common: ldy #EM_COPY::COUNT + lda (ptr3),y ; Get bytes in last page + sta ptr4 + iny + lda (ptr3),y ; Get number of pages + sta ptr4+1 - jmp transfer + jmp transfer ; ------------------------------------------------------------------------ ; COPYTO: Copy from linear into extended memory. A pointer to a structure @@ -212,24 +212,24 @@ common: ldy #EM_COPY::COUNT ; The function must not return anything. ; -COPYTO: sta ptr3 - stx ptr3+1 ; Save the passed em_copy pointer +COPYTO: sta ptr3 + stx ptr3+1 ; Save the passed em_copy pointer - ldy #EM_COPY::OFFS - lda (ptr3),y - sta ptr2 - ldy #EM_COPY::PAGE - lda (ptr3),y - clc - adc #>BASE - sta ptr2+1 ; To + ldy #EM_COPY::OFFS + lda (ptr3),y + sta ptr2 + ldy #EM_COPY::PAGE + lda (ptr3),y + clc + adc #>BASE + sta ptr2+1 ; To - ldy #EM_COPY::BUF - lda (ptr3),y - sta ptr1 - iny - lda (ptr3),y - sta ptr1+1 ; From + ldy #EM_COPY::BUF + lda (ptr3),y + sta ptr1 + iny + lda (ptr3),y + sta ptr1+1 ; From - sec ; Direction flag - jmp common + sec ; Direction flag + jmp common diff --git a/libsrc/apple2/exec.s b/libsrc/apple2/exec.s index 2660b6f86..914e10c50 100644 --- a/libsrc/apple2/exec.s +++ b/libsrc/apple2/exec.s @@ -4,108 +4,108 @@ ; int __fastcall__ exec (const char* progname, const char* cmdline); ; - .export _exec - .import pushname, popname - .import popax, done, _exit + .export _exec + .import pushname, popname + .import popax, done, _exit - .include "zeropage.inc" - .include "errno.inc" - .include "apple2.inc" - .include "mli.inc" + .include "zeropage.inc" + .include "errno.inc" + .include "apple2.inc" + .include "mli.inc" ; Wrong file type -typerr: lda #$4A ; "Incompatible file format" +typerr: lda #$4A ; "Incompatible file format" ; Cleanup name -oserr: jsr popname ; Preserves A +oserr: jsr popname ; Preserves A ; Set __oserror - jmp __mappederrno + jmp __mappederrno _exec: ; Get and push name - jsr popax - jsr pushname - bne oserr + jsr popax + jsr pushname + bne oserr ; Set pushed name - lda sp - ldx sp+1 - sta mliparam + MLI::INFO::PATHNAME - stx mliparam + MLI::INFO::PATHNAME+1 + lda sp + ldx sp+1 + sta mliparam + MLI::INFO::PATHNAME + stx mliparam + MLI::INFO::PATHNAME+1 ; Get file_type and aux_type - lda #GET_INFO_CALL - ldx #GET_INFO_COUNT - jsr callmli - bcs oserr + lda #GET_INFO_CALL + ldx #GET_INFO_COUNT + jsr callmli + bcs oserr ; If we get here the program file at least exists so we copy ; the loader stub right now and patch it later to set params - ldx #size - 1 -: lda source,x - sta target,x + ldx #size - 1 +: lda source,x + sta target,x dex - bpl :- + bpl :- ; Check program file type - lda mliparam + MLI::INFO::FILE_TYPE - cmp #$FF ; SYS file? - bne binary ; No, check for BIN file + lda mliparam + MLI::INFO::FILE_TYPE + cmp #$FF ; SYS file? + bne binary ; No, check for BIN file ; ProDOS TechRefMan, chapter 5.1.5.1: ; "The complete or partial pathname of the system program ; is stored at $280, starting with a length byte." - ldy #$00 - lda (sp),y + ldy #$00 + lda (sp),y tay -: lda (sp),y - sta $0280,y +: lda (sp),y + sta $0280,y dey - bpl :- + bpl :- ; SYS programs replace BASIC.SYSTEM so set in the ProDOS system bit map ; protection for pages $80 - $BF just in case BASIC.SYSTEM is there now - ldx #$0F ; Start with protection for pages $B8 - $BF - lda #%00000001 ; Protect only system global page -: sta $BF60,x ; Set protection for 8 pages - lda #$00 ; Protect no page + ldx #$0F ; Start with protection for pages $B8 - $BF + lda #%00000001 ; Protect only system global page +: sta $BF60,x ; Set protection for 8 pages + lda #$00 ; Protect no page dex - bpl :- - bmi prodos ; Branch always + bpl :- + bmi prodos ; Branch always -binary: cmp #$06 ; BIN file? - bne typerr ; No, wrong file type +binary: cmp #$06 ; BIN file? + bne typerr ; No, wrong file type ; Set BIN program load addr - lda mliparam + MLI::INFO::AUX_TYPE - ldx mliparam + MLI::INFO::AUX_TYPE+1 - sta data_buffer - stx data_buffer+1 + lda mliparam + MLI::INFO::AUX_TYPE + ldx mliparam + MLI::INFO::AUX_TYPE+1 + sta data_buffer + stx data_buffer+1 ; Check ProDOS system bit map for presence of BASIC.SYSTEM - lda $BF6F ; Protection for pages $B8 - $BF - cmp #%00000001 ; Exactly system global page is protected - beq setvec + lda $BF6F ; Protection for pages $B8 - $BF + cmp #%00000001 ; Exactly system global page is protected + beq setvec ; Get highest available mem addr from BASIC.SYSTEM - ldx HIMEM+1 ; High byte - bne setbuf ; Branch always + ldx HIMEM+1 ; High byte + bne setbuf ; Branch always ; BIN programs are supposed to quit through one of the two DOS ; vectors so we set up those to point to the ProDOS dispatcher -setvec: ldx #$03 - 1 ; Size of JMP opcode -: lda dosvec,x - sta DOSWARM,x ; DOS warm start - sta DOSWARM + 3,x ; DOS cold start +setvec: ldx #$03 - 1 ; Size of JMP opcode +: lda dosvec,x + sta DOSWARM,x ; DOS warm start + sta DOSWARM + 3,x ; DOS cold start dex - bpl :- + bpl :- ; No BASIC.SYSTEM so use addr of ProDOS system global page -prodos: ldx #>$BF00 ; High byte +prodos: ldx #>$BF00 ; High byte ; The I/O buffer needs to be page aligned -setbuf: lda #$00 ; Low byte +setbuf: lda #$00 ; Low byte ; The I/O buffer needs four pages dex @@ -114,109 +114,109 @@ setbuf: lda #$00 ; Low byte dex ; Set I/O buffer - sta mliparam + MLI::OPEN::IO_BUFFER - stx mliparam + MLI::OPEN::IO_BUFFER+1 + sta mliparam + MLI::OPEN::IO_BUFFER + stx mliparam + MLI::OPEN::IO_BUFFER+1 ; PATHNAME already set .assert MLI::OPEN::PATHNAME = MLI::INFO::PATHNAME, error ; Lower file level to avoid program file ; being closed by C libary shutdown code - ldx LEVEL - stx level - beq :+ - dec LEVEL + ldx LEVEL + stx level + beq :+ + dec LEVEL ; Open file -: lda #OPEN_CALL - ldx #OPEN_COUNT - jsr callmli +: lda #OPEN_CALL + ldx #OPEN_COUNT + jsr callmli ; Restore file level - ldx level - stx LEVEL - bcc :+ - jmp oserr + ldx level + stx LEVEL + bcc :+ + jmp oserr ; Get and save fd -: lda mliparam + MLI::OPEN::REF_NUM - sta read_ref - sta close_ref +: lda mliparam + MLI::OPEN::REF_NUM + sta read_ref + sta close_ref .ifdef __APPLE2ENH__ ; Calling the 80 column firmware needs the ROM switched ; in, otherwise it copies the F8 ROM to the LC (@ $CEF4) - bit $C082 + bit $C082 ; ProDOS TechRefMan, chapter 5.3.1.3: ; "80-column text cards -- and other Apple IIe features -- can ; be turned off using the following sequence of instructions:" - lda #$15 - jsr $C300 + lda #$15 + jsr $C300 ; Switch in LC bank 2 for R/O - bit $C080 + bit $C080 .endif ; Call loader stub after C libary shutdown - lda #target - sta done - stx done+1 + lda #target + sta done + stx done+1 ; Initiate C libary shutdown - jmp _exit + jmp _exit .bss -level : .res 1 +level : .res 1 .rodata ; Read whole program file -source: jsr $BF00 - .byte READ_CALL - .word read_param - bcs :+ +source: jsr $BF00 + .byte READ_CALL + .word read_param + bcs :+ ; Close program file - jsr $BF00 - .byte CLOSE_CALL - .word close_param - bcs :+ + jsr $BF00 + .byte CLOSE_CALL + .word close_param + bcs :+ ; Go for it ... - jmp (data_buffer) + jmp (data_buffer) read_param = * - source + target - .byte $04 ; PARAM_COUNT + .byte $04 ; PARAM_COUNT read_ref = * - source + target - .byte $00 ; REF_NUM + .byte $00 ; REF_NUM data_buffer = * - source + target - .addr $2000 ; DATA_BUFFER - .word $FFFF ; REQUEST_COUNT - .word $0000 ; TRANS_COUNT + .addr $2000 ; DATA_BUFFER + .word $FFFF ; REQUEST_COUNT + .word $0000 ; TRANS_COUNT close_param = * - source + target - .byte $01 ; PARAM_COUNT + .byte $01 ; PARAM_COUNT close_ref = * - source + target - .byte $00 ; REF_NUM + .byte $00 ; REF_NUM ; Quit to ProDOS dispatcher quit = * - source + target -: jsr $BF00 - .byte $65 ; QUIT - .word quit_param +: jsr $BF00 + .byte $65 ; QUIT + .word quit_param quit_param = * - source + target - .byte $04 ; PARAM_COUNT - .byte $00 ; QUIT_TYPE - .word $0000 ; RESERVED - .byte $00 ; RESERVED - .word $0000 ; RESERVED + .byte $04 ; PARAM_COUNT + .byte $00 ; QUIT_TYPE + .word $0000 ; RESERVED + .byte $00 ; RESERVED + .word $0000 ; RESERVED size = * - source target = DOSWARM - size -dosvec: jmp quit +dosvec: jmp quit diff --git a/libsrc/apple2/exehdr.s b/libsrc/apple2/exehdr.s index f66b14a5c..eb05e66be 100644 --- a/libsrc/apple2/exehdr.s +++ b/libsrc/apple2/exehdr.s @@ -5,12 +5,12 @@ ; containing the load address and load length. ; - .export __EXEHDR__ : absolute = 1 ; Linker referenced - .import __LOADADDR__, __LOADSIZE__ ; Linker generated + .export __EXEHDR__ : absolute = 1 ; Linker referenced + .import __LOADADDR__, __LOADSIZE__ ; Linker generated ; ------------------------------------------------------------------------ .segment "EXEHDR" - .addr __LOADADDR__ ; Load address - .word __LOADSIZE__ ; Load length + .addr __LOADADDR__ ; Load address + .word __LOADSIZE__ ; Load length diff --git a/libsrc/apple2/extra/iobuf-0800.s b/libsrc/apple2/extra/iobuf-0800.s index 69fd6a657..7951ccbb0 100644 --- a/libsrc/apple2/extra/iobuf-0800.s +++ b/libsrc/apple2/extra/iobuf-0800.s @@ -5,16 +5,16 @@ ; location $0800 and the cc65 program start address ; - .constructor initiobuf - .export iobuf_alloc, iobuf_free - .import __STARTUP_RUN__ - .import incsp2, popax + .constructor initiobuf + .export iobuf_alloc, iobuf_free + .import __STARTUP_RUN__ + .import incsp2, popax - .include "zeropage.inc" - .include "errno.inc" - .include "../filedes.inc" + .include "zeropage.inc" + .include "errno.inc" + .include "../filedes.inc" - .segment "INIT" + .segment "INIT" initiobuf: ; Convert end address highbyte to table index @@ -40,10 +40,10 @@ initiobuf: iobuf_alloc: ; Get and save "memptr" - jsr incsp2 - jsr popax - sta ptr1 - stx ptr1+1 + jsr incsp2 + jsr popax + sta ptr1 + stx ptr1+1 ; Search table for free entry ldx #$00 @@ -67,11 +67,11 @@ iobuf_alloc: adc #>$0800 ; Store address in "memptr" - ldy #$01 - sta (ptr1),y - dey - tya - sta (ptr1),y + ldy #$01 + sta (ptr1),y + dey + tya + sta (ptr1),y rts iobuf_free: @@ -86,7 +86,7 @@ iobuf_free: tax lda #$00 sta table,x - rts + rts ; ------------------------------------------------------------------------ diff --git a/libsrc/apple2/filedes.s b/libsrc/apple2/filedes.s index e177acbe4..04b4416e9 100644 --- a/libsrc/apple2/filedes.s +++ b/libsrc/apple2/filedes.s @@ -4,18 +4,18 @@ ; File descriptor management for the POSIX I/O routines ; - .include "errno.inc" - .include "fcntl.inc" - .include "filedes.inc" + .include "errno.inc" + .include "fcntl.inc" + .include "filedes.inc" getfd: ; Check for handle >= 256 - cpx #$00 - bne error + cpx #$00 + bne error ; Check for handle >= MAX_FDS - cmp #MAX_FDS - bcs error + cmp #MAX_FDS + bcs error ; Convert handle to fdtab slot .assert .sizeof(FD) = 4, error @@ -24,15 +24,15 @@ getfd: ; Check for fdtab slot in use tay - lda fdtab + FD::REF_NUM,y - beq error + lda fdtab + FD::REF_NUM,y + beq error ; Return success clc rts ; Load errno code and return error -error: lda #EINVAL +error: lda #EINVAL sec rts @@ -40,16 +40,16 @@ error: lda #EINVAL fdtab: .assert .sizeof(FD) = 4, error - .byte $80 ; STDIN_FILENO ::REF_NUM - .byte O_RDONLY ; STDIN_FILENO ::FLAGS - .addr $0000 ; STDIN_FILENO ::BUFFER + .byte $80 ; STDIN_FILENO ::REF_NUM + .byte O_RDONLY ; STDIN_FILENO ::FLAGS + .addr $0000 ; STDIN_FILENO ::BUFFER - .byte $80 ; STDOUT_FILENO::REF_NUM - .byte O_WRONLY ; STDOUT_FILENO::FLAGS - .addr $0000 ; STDOUT_FILENO::BUFFER + .byte $80 ; STDOUT_FILENO::REF_NUM + .byte O_WRONLY ; STDOUT_FILENO::FLAGS + .addr $0000 ; STDOUT_FILENO::BUFFER - .byte $80 ; STDERR_FILENO::REF_NUM - .byte O_WRONLY ; STDERR_FILENO::FLAGS - .addr $0000 ; STDERR_FILENO::BUFFER + .byte $80 ; STDERR_FILENO::REF_NUM + .byte O_WRONLY ; STDERR_FILENO::FLAGS + .addr $0000 ; STDERR_FILENO::BUFFER - .res (MAX_FDS - 3) * .sizeof(FD) + .res (MAX_FDS - 3) * .sizeof(FD) diff --git a/libsrc/apple2/filename.s b/libsrc/apple2/filename.s index 1bf17af50..aaef6ec2d 100644 --- a/libsrc/apple2/filename.s +++ b/libsrc/apple2/filename.s @@ -4,88 +4,88 @@ ; File name handling for ProDOS 8 file I/O ; - .export pushname, popname - .import subysp, addysp, decsp1 + .export pushname, popname + .import subysp, addysp, decsp1 - .include "zeropage.inc" - .include "mli.inc" + .include "zeropage.inc" + .include "mli.inc" pushname: - sta ptr1 - stx ptr1+1 + sta ptr1 + stx ptr1+1 ; Alloc pathname buffer - ldy #64+1 ; Max pathname length + zero - jsr subysp + ldy #64+1 ; Max pathname length + zero + jsr subysp ; Check for full pathname - ldy #$00 - lda (ptr1),y - cmp #'/' - beq copy + ldy #$00 + lda (ptr1),y + cmp #'/' + beq copy ; Check for system prefix - lda PFIXPTR - bne copy + lda PFIXPTR + bne copy ; Use unit number of most recent accessed device - lda DEVNUM - sta mliparam + MLI::ON_LINE::UNIT_NUM + lda DEVNUM + sta mliparam + MLI::ON_LINE::UNIT_NUM ; Use allocated pathname buffer - lda sp - ldx sp+1 - sta mliparam + MLI::ON_LINE::DATA_BUFFER - stx mliparam + MLI::ON_LINE::DATA_BUFFER+1 + lda sp + ldx sp+1 + sta mliparam + MLI::ON_LINE::DATA_BUFFER + stx mliparam + MLI::ON_LINE::DATA_BUFFER+1 ; Get volume name - lda #ON_LINE_CALL - ldx #ON_LINE_COUNT - jsr callmli - bcs addsp65 + lda #ON_LINE_CALL + ldx #ON_LINE_COUNT + jsr callmli + bcs addsp65 ; Get volume name length - lda (sp),y - and #15 ; Max volume name length + lda (sp),y + and #15 ; Max volume name length ; Bracket volume name with slashes to form prefix - sta tmp1 - lda #'/' - sta (sp),y - ldy tmp1 - iny ; Leading slash - sta (sp),y - iny ; Trailing slash + sta tmp1 + lda #'/' + sta (sp),y + ldy tmp1 + iny ; Leading slash + sta (sp),y + iny ; Trailing slash ; Adjust source pointer for copy - sty tmp1 - lda ptr1 + sty tmp1 + lda ptr1 sec - sbc tmp1 - bcs :+ - dec ptr1+1 -: sta ptr1 + sbc tmp1 + bcs :+ + dec ptr1+1 +: sta ptr1 ; Copy source to allocated pathname buffer -copy: lda (ptr1),y - sta (sp),y - beq setlen +copy: lda (ptr1),y + sta (sp),y + beq setlen iny - cpy #64+1 ; Max pathname length + zero - bcc copy + cpy #64+1 ; Max pathname length + zero + bcc copy ; Load oserror code - lda #$40 ; "Invalid pathname" + lda #$40 ; "Invalid pathname" ; Free pathname buffer addsp65:ldy #64+1 - bne addsp ; Branch always + bne addsp ; Branch always ; Alloc and set length byte setlen: tya - jsr decsp1 ; Preserves A - ldy #$00 - sta (sp),y + jsr decsp1 ; Preserves A + ldy #$00 + sta (sp),y ; Return success tya @@ -93,5 +93,5 @@ setlen: tya popname: ; Cleanup stack - ldy #1 + 64+1 ; Length byte + max pathname length + zero -addsp: jmp addysp ; Preserves A + ldy #1 + 64+1 ; Length byte + max pathname length + zero +addsp: jmp addysp ; Preserves A diff --git a/libsrc/apple2/get_ostype.s b/libsrc/apple2/get_ostype.s index a041c3477..68ae865ac 100644 --- a/libsrc/apple2/get_ostype.s +++ b/libsrc/apple2/get_ostype.s @@ -24,38 +24,38 @@ nogs: ldx #$FF next: inx lda value,x ldy index,x - beq done ; $00 is no valid index + beq done ; $00 is no valid index cmp $FB00,y beq next : inx ldy index,x bne :- - beq next ; Branch always + beq next ; Branch always -index: .byte $B3, $00 ; Apple ][ - .byte $B3, $1E, $00 ; Apple ][+ - .byte $B3, $1E, $00 ; Apple /// (emulation) - .byte $B3, $C0, $00 ; Apple //e - .byte $B3, $C0, $DD, $BE, $00 ; Apple //e Option Card - .byte $B3, $C0, $00 ; Apple //e (enhanced) - .byte $B3, $C0, $BF, $00 ; Apple //c - .byte $B3, $C0, $BF, $00 ; Apple //c (3.5 ROM) - .byte $B3, $C0, $BF, $00 ; Apple //c (Mem. Exp.) - .byte $B3, $C0, $BF, $00 ; Apple //c (Rev. Mem. Exp.) - .byte $B3, $C0, $BF, $00 ; Apple //c Plus +index: .byte $B3, $00 ; Apple ][ + .byte $B3, $1E, $00 ; Apple ][+ + .byte $B3, $1E, $00 ; Apple /// (emulation) + .byte $B3, $C0, $00 ; Apple //e + .byte $B3, $C0, $DD, $BE, $00 ; Apple //e Option Card + .byte $B3, $C0, $00 ; Apple //e (enhanced) + .byte $B3, $C0, $BF, $00 ; Apple //c + .byte $B3, $C0, $BF, $00 ; Apple //c (3.5 ROM) + .byte $B3, $C0, $BF, $00 ; Apple //c (Mem. Exp.) + .byte $B3, $C0, $BF, $00 ; Apple //c (Rev. Mem. Exp.) + .byte $B3, $C0, $BF, $00 ; Apple //c Plus .byte $00 -value: .byte $38, $10 ; Apple ][ - .byte $EA, $AD, $11 ; Apple ][+ - .byte $EA, $8A, $20 ; Apple /// (emulation) - .byte $06, $EA, $30 ; Apple //e - .byte $06, $E0, $02, $00, $40 ; Apple //e Option Card - .byte $06, $E0, $31 ; Apple //e (enhanced) - .byte $06, $00, $FF, $50 ; Apple //c - .byte $06, $00, $00, $51 ; Apple //c (3.5 ROM) - .byte $06, $00, $03, $53 ; Apple //c (Mem. Exp.) - .byte $06, $00, $04, $54 ; Apple //c (Rev. Mem. Exp.) - .byte $06, $00, $05, $55 ; Apple //c Plus +value: .byte $38, $10 ; Apple ][ + .byte $EA, $AD, $11 ; Apple ][+ + .byte $EA, $8A, $20 ; Apple /// (emulation) + .byte $06, $EA, $30 ; Apple //e + .byte $06, $E0, $02, $00, $40 ; Apple //e Option Card + .byte $06, $E0, $31 ; Apple //e (enhanced) + .byte $06, $00, $FF, $50 ; Apple //c + .byte $06, $00, $00, $51 ; Apple //c (3.5 ROM) + .byte $06, $00, $03, $53 ; Apple //c (Mem. Exp.) + .byte $06, $00, $04, $54 ; Apple //c (Rev. Mem. Exp.) + .byte $06, $00, $05, $55 ; Apple //c Plus .byte $00 .code diff --git a/libsrc/apple2/gotoxy.s b/libsrc/apple2/gotoxy.s index 0c6c800be..dc96ac75e 100644 --- a/libsrc/apple2/gotoxy.s +++ b/libsrc/apple2/gotoxy.s @@ -13,10 +13,10 @@ _gotoxy: clc adc WNDTOP - sta CV ; Store Y + sta CV ; Store Y jsr VTABZ - jsr popa ; Get X + jsr popa ; Get X _gotox: - sta CH ; Store X + sta CH ; Store X rts diff --git a/libsrc/apple2/gotoy.s b/libsrc/apple2/gotoy.s index 66d929c34..707b8fc50 100644 --- a/libsrc/apple2/gotoy.s +++ b/libsrc/apple2/gotoy.s @@ -12,7 +12,7 @@ _gotoy: clc adc WNDTOP - sta CV ; Store Y + sta CV ; Store Y jmp VTABZ diff --git a/libsrc/apple2/home.s b/libsrc/apple2/home.s index de5334c93..02899beb4 100644 --- a/libsrc/apple2/home.s +++ b/libsrc/apple2/home.s @@ -4,17 +4,17 @@ ; HOME routine ; - .export HOME + .export HOME - .include "apple2.inc" + .include "apple2.inc" - .segment "LOWCODE" + .segment "LOWCODE" HOME: - ; Switch in ROM and call HOME - bit $C082 - jsr $FC58 ; Clear current text screen + ; Switch in ROM and call HOME + bit $C082 + jsr $FC58 ; Clear current text screen - ; Switch in LC bank 2 for R/O and return - bit $C080 - rts + ; Switch in LC bank 2 for R/O and return + bit $C080 + rts diff --git a/libsrc/apple2/initcwd.s b/libsrc/apple2/initcwd.s index 6ed914ca6..044076e3f 100644 --- a/libsrc/apple2/initcwd.s +++ b/libsrc/apple2/initcwd.s @@ -3,15 +3,15 @@ ; .export initcwd - .import __cwd + .import __cwd - .include "zeropage.inc" + .include "zeropage.inc" .include "mli.inc" initcwd: ; Set static prefix buffer - lda #<__cwd - ldx #>__cwd + lda #<__cwd + ldx #>__cwd sta mliparam + MLI::PREFIX::PATHNAME stx mliparam + MLI::PREFIX::PATHNAME+1 @@ -21,20 +21,20 @@ initcwd: jsr callmli ; Check for null prefix - lda __cwd - beq done + lda __cwd + beq done - ; Remove length byte and trailing slash - sta tmp1 - ldx #$01 -: lda __cwd,x - sta __cwd - 1,x - inx - cpx tmp1 - bcc :- + ; Remove length byte and trailing slash + sta tmp1 + ldx #$01 +: lda __cwd,x + sta __cwd - 1,x + inx + cpx tmp1 + bcc :- - ; Add terminating zero - lda #$00 - sta __cwd - 1,x - -done: rts + ; Add terminating zero + lda #$00 + sta __cwd - 1,x + +done: rts diff --git a/libsrc/apple2/iobuf.s b/libsrc/apple2/iobuf.s index 88a4503d0..77433ce61 100644 --- a/libsrc/apple2/iobuf.s +++ b/libsrc/apple2/iobuf.s @@ -4,8 +4,8 @@ ; Default ProDOS 8 I/O buffer management ; - .export iobuf_alloc, iobuf_free - .import _posix_memalign, _free + .export iobuf_alloc, iobuf_free + .import _posix_memalign, _free iobuf_alloc := _posix_memalign iobuf_free := _free diff --git a/libsrc/apple2/joy/a2.stdjoy.s b/libsrc/apple2/joy/a2.stdjoy.s index 1608f5acc..eecdd6a8a 100644 --- a/libsrc/apple2/joy/a2.stdjoy.s +++ b/libsrc/apple2/joy/a2.stdjoy.s @@ -7,9 +7,9 @@ ; Using the readjoy code from Stefan Haubenthal ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" + .include "joy-kernel.inc" .include "joy-error.inc" .include "apple2.inc" @@ -17,24 +17,24 @@ ; Constants -THRESHOLD = 20 ; Deviation from center triggering movement +THRESHOLD = 20 ; Deviation from center triggering movement ; ------------------------------------------------------------------------ ; ROM entry points -PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y +PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y ; ------------------------------------------------------------------------ ; Header. Includes jump table. - .segment "JUMPTABLE" + .segment "JUMPTABLE" ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) @@ -57,7 +57,7 @@ PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y ; ------------------------------------------------------------------------ - .code + .code ; INSTALL routine. Is called after the driver is loaded into memory. If ; possible, check if the hardware is present and determine the amount of @@ -66,7 +66,7 @@ PREAD := $FB1E ; Read paddle in X, return AD conv. value in Y INSTALL: lda #JOY_ERR_OK - ; Fall through + ; Fall through ; UNINSTALL routine. Is called before the driver is removed from memory. ; Can do cleanup or whatever. Must not return anything. @@ -75,55 +75,55 @@ UNINSTALL: ; COUNT: Return the total number of available joysticks in a/x. COUNT: - lda #$02 ; Number of joysticks we support + lda #$02 ; Number of joysticks we support ldx #$00 rts ; READ: Read a particular joystick passed in A. READJOY: - bit $C082 ; Switch in ROM - and #$01 ; Restrict joystick number + bit $C082 ; Switch in ROM + and #$01 ; Restrict joystick number - ; Read horizontal paddle - asl ; Joystick number -> paddle number - tax ; Set paddle number (0, 2) + ; Read horizontal paddle + asl ; Joystick number -> paddle number + tax ; Set paddle number (0, 2) jsr PREAD ; Read paddle value - lda #$00 ; 0 0 0 0 0 0 0 0 + lda #$00 ; 0 0 0 0 0 0 0 0 cpy #127 - THRESHOLD - ror ; !LEFT 0 0 0 0 0 0 0 + ror ; !LEFT 0 0 0 0 0 0 0 cpy #127 + THRESHOLD - ror ; RIGHT !LEFT 0 0 0 0 0 0 + ror ; RIGHT !LEFT 0 0 0 0 0 0 - ; Read vertical paddle + ; Read vertical paddle pha - inx ; Set paddle number (1, 3) + inx ; Set paddle number (1, 3) jsr PREAD ; Read paddle value pla cpy #127 - THRESHOLD - ror ; !UP RIGHT !LEFT 0 0 0 0 0 + ror ; !UP RIGHT !LEFT 0 0 0 0 0 cpy #127 + THRESHOLD - ror ; DOWN !UP RIGHT !LEFT 0 0 0 0 + ror ; DOWN !UP RIGHT !LEFT 0 0 0 0 - ; Read primary button - tay - lda BUTN0-1,x ; Check button (1, 3) + ; Read primary button + tay + lda BUTN0-1,x ; Check button (1, 3) asl tya - ror ; FIRE DOWN !UP RIGHT !LEFT 0 0 0 + ror ; FIRE DOWN !UP RIGHT !LEFT 0 0 0 - ; Read secondary button - tay - inx - txa - and #$03 ; IIgs has fourth button at TAPEIN - tax - lda BUTN0-1,x ; Check button (2, 0) + ; Read secondary button + tay + inx + txa + and #$03 ; IIgs has fourth button at TAPEIN + tax + lda BUTN0-1,x ; Check button (2, 0) asl tya - ror ; FIRE2 FIRE DOWN !UP RIGHT !LEFT 0 0 + ror ; FIRE2 FIRE DOWN !UP RIGHT !LEFT 0 0 - ; Finalize + ; Finalize eor #%00010100 ; FIRE2 FIRE DOWN UP RIGHT LEFT 0 0 ldx #$00 - bit $C080 ; Switch in LC bank 2 for R/O + bit $C080 ; Switch in LC bank 2 for R/O rts diff --git a/libsrc/apple2/joy_stat_stddrv.s b/libsrc/apple2/joy_stat_stddrv.s index bf6b0f53c..d129020bd 100644 --- a/libsrc/apple2/joy_stat_stddrv.s +++ b/libsrc/apple2/joy_stat_stddrv.s @@ -6,16 +6,16 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .ifdef __APPLE2ENH__ - .import _a2e_stdjoy_joy + .export _joy_static_stddrv + .ifdef __APPLE2ENH__ + .import _a2e_stdjoy_joy .else - .import _a2_stdjoy_joy + .import _a2_stdjoy_joy .endif .rodata - .ifdef __APPLE2ENH__ + .ifdef __APPLE2ENH__ _joy_static_stddrv := _a2e_stdjoy_joy .else _joy_static_stddrv := _a2_stdjoy_joy diff --git a/libsrc/apple2/joy_stddrv.s b/libsrc/apple2/joy_stddrv.s index e4a360dab..0c3bf677b 100644 --- a/libsrc/apple2/joy_stddrv.s +++ b/libsrc/apple2/joy_stddrv.s @@ -6,14 +6,14 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata _joy_stddrv: - .ifdef __APPLE2ENH__ - .asciiz "A2E.STDJOY.JOY" + .ifdef __APPLE2ENH__ + .asciiz "A2E.STDJOY.JOY" .else - .asciiz "A2.STDJOY.JOY" + .asciiz "A2.STDJOY.JOY" .endif diff --git a/libsrc/apple2/mainargs.s b/libsrc/apple2/mainargs.s index 2de10bd53..6b0df4ded 100644 --- a/libsrc/apple2/mainargs.s +++ b/libsrc/apple2/mainargs.s @@ -22,11 +22,11 @@ ; TO-DO: ; Add a control-character quoting mechanism. - .constructor initmainargs, 24 - .import __argc, __argv, __dos_type + .constructor initmainargs, 24 + .import __argc, __argv, __dos_type - .include "zeropage.inc" - .include "apple2.inc" + .include "zeropage.inc" + .include "apple2.inc" ; Maximum number of arguments allowed in the argument table. ; (An argument contains a comma, at least.) @@ -44,7 +44,7 @@ BUF_LEN = 122 BASIC_BUF = $200 FNAM_LEN = $280 FNAM = $281 -REM = $B2 ; BASIC token-code +REM = $B2 ; BASIC token-code ; Get possible command-line arguments. Goes into the special INIT segment, ; which may be reused after the startup code is run. @@ -56,25 +56,25 @@ initmainargs: ; Assume that the program was loaded, a moment ago, by the traditional BLOAD ; statement of BASIC.SYSTEM. Save the filename as argument #0 if available. - ldx __dos_type ; No ProDOS -> argv[0] = "" - beq :+ + ldx __dos_type ; No ProDOS -> argv[0] = "" + beq :+ ; Terminate the filename with a zero to make it a valid C string. - ldx FNAM_LEN -: lda #$00 - sta FNAM,x + ldx FNAM_LEN +: lda #$00 + sta FNAM,x - inc __argc ; argc always is equal to, at least, 1 + inc __argc ; argc always is equal to, at least, 1 ; Find the "rem" token. - ldx #$00 -: lda BASIC_BUF,x - beq done ; No "rem" -> no args + ldx #$00 +: lda BASIC_BUF,x + beq done ; No "rem" -> no args inx - cmp #REM - bne :- + cmp #REM + bne :- ; If a clock is present it is called by ProDOS on file operations. On machines ; with a slot-based clock (like the Thunder Clock) the clock firmware places @@ -82,18 +82,18 @@ initmainargs: ; of the command-line in a different buffer before the original is potentially ; destroyed. - ldy #$00 -: lda BASIC_BUF,x - sta buffer,y - inx - iny - cpy #BUF_LEN - 1 ; Keep the terminating zero intact - bcc :- + ldy #$00 +: lda BASIC_BUF,x + sta buffer,y + inx + iny + cpy #BUF_LEN - 1 ; Keep the terminating zero intact + bcc :- ; Start processing the arguments. - ldx #$00 - ldy #$01 * 2 ; Start with argv[1] + ldx #$00 + ldy #$01 * 2 ; Start with argv[1] ; Find the next argument. Stop if the end of the string or a character with the ; hibit set is reached. The later is true if the string isn't already parsed by @@ -105,65 +105,65 @@ initmainargs: ; for the REM token we stumbled across the first '2' character ($32+$80 = $B2) ; and interpreted the rest of the date as a spurious command-line parameter. -next: lda buffer,x - beq done - bmi done +next: lda buffer,x + beq done + bmi done inx - cmp #' ' ; Skip leading spaces - beq next + cmp #' ' ; Skip leading spaces + beq next ; Found start of next argument. We've incremented the pointer in X already, so ; it points to the second character of the argument. This is useful since we ; will check now for a quoted argument, in which case we will have to skip this ; first character. - cmp #'"' ; Is the argument quoted? - beq :+ ; Jump if so - dex ; Reset pointer to first argument character - lda #' ' ; A space ends the argument -: sta tmp1 ; Set end of argument marker + cmp #'"' ; Is the argument quoted? + beq :+ ; Jump if so + dex ; Reset pointer to first argument character + lda #' ' ; A space ends the argument +: sta tmp1 ; Set end of argument marker ; Now store a pointer to the argument into the next slot. - txa ; Get low byte + txa ; Get low byte clc - adc #buffer - sta argv,y + lda #$00 + adc #>buffer + sta argv,y iny - inc __argc ; Found another arg + inc __argc ; Found another arg ; Search for the end of the argument. : lda buffer,x - beq done + beq done inx - cmp tmp1 - bne :- + cmp tmp1 + bne :- ; We've found the end of the argument. X points one character behind it, and ; A contains the terminating character. To make the argument a valid C string, ; replace the terminating character by a zero. - lda #$00 - sta buffer-1,x + lda #$00 + sta buffer-1,x ; Check if the maximum number of command-line arguments is reached. If not, ; parse the next one. - lda __argc ; Get low byte of argument count - cmp #MAXARGS ; Maximum number of arguments reached? - bcc next ; Parse next one if not + lda __argc ; Get low byte of argument count + cmp #MAXARGS ; Maximum number of arguments reached? + bcc next ; Parse next one if not ; (The last vector in argv[] already is NULL.) -done: lda #argv - sta __argv - stx __argv+1 +done: lda #argv + sta __argv + stx __argv+1 rts ; This array is zeroed before initmainargs is called. @@ -171,9 +171,9 @@ done: lda #$0400 ; 000001CD - sta getscr+2 - sta setscr+2 - txa ; ABCDExxx - ror ; EABCDExx - and #%11100000 ; EAB00000 - ora getscr+1 ; EABABCDE - and #%11111000 ; EABAB000 - sta getscr+1 - sta setscr+1 - rts + tax ; ABCDExxx + lsr ; 0ABCDExx + lsr ; 00ABCDEx + lsr ; 000ABCDE + sta getscr+1 + lsr ; 0000ABCD + and #%00000011 ; 000000CD + ora #>$0400 ; 000001CD + sta getscr+2 + sta setscr+2 + txa ; ABCDExxx + ror ; EABCDExx + and #%11100000 ; EAB00000 + ora getscr+1 ; EABABCDE + and #%11111000 ; EABAB000 + sta getscr+1 + sta setscr+1 + rts diff --git a/libsrc/apple2/mli.inc b/libsrc/apple2/mli.inc index 86950fbc4..42363d9c9 100644 --- a/libsrc/apple2/mli.inc +++ b/libsrc/apple2/mli.inc @@ -94,8 +94,8 @@ EOF_COUNT = 2 DATA_BUFFER .addr .endstruct .struct PREFIX - PARAM_COUNT .byte - PATHNAME .addr + PARAM_COUNT .byte + PATHNAME .addr .endstruct .struct OPEN PARAM_COUNT .byte @@ -130,12 +130,12 @@ EOF_COUNT = 2 .global mliparam .global callmli -DEVNUM := $BF30 ; Most recent accessed device -DEVCNT := $BF31 ; Number of on-line devices (minus 1) -DEVLST := $BF32 ; Up to 14 units may be active -DATELO := $BF90 ; Bits 15-9 = year, 8-5 = month, 4-0 = day -TIMELO := $BF92 ; Bits 12-8 = hour, 5-0 = minute -LEVEL := $BF94 ; File level: used in open, flush, close -MACHID := $BF98 ; Machine identification -PFIXPTR := $BF9A ; If = 0, no prefix active +DEVNUM := $BF30 ; Most recent accessed device +DEVCNT := $BF31 ; Number of on-line devices (minus 1) +DEVLST := $BF32 ; Up to 14 units may be active +DATELO := $BF90 ; Bits 15-9 = year, 8-5 = month, 4-0 = day +TIMELO := $BF92 ; Bits 12-8 = hour, 5-0 = minute +LEVEL := $BF94 ; File level: used in open, flush, close +MACHID := $BF98 ; Machine identification +PFIXPTR := $BF9A ; If = 0, no prefix active KVERSION:= $BFFF ; Kernel version number diff --git a/libsrc/apple2/mli.s b/libsrc/apple2/mli.s index fa826cc61..3e4771400 100644 --- a/libsrc/apple2/mli.s +++ b/libsrc/apple2/mli.s @@ -24,12 +24,12 @@ callmli: beq oserr ; Call MLI and return - jsr $BF00 ; MLI call entry point + jsr $BF00 ; MLI call entry point call: .byte $00 .addr mliparam rts ; Load oserror code and return -oserr: lda #$01 ; "Bad system call number" +oserr: lda #$01 ; "Bad system call number" sec rts diff --git a/libsrc/apple2/mou/a2.stdmou.s b/libsrc/apple2/mou/a2.stdmou.s index af44a48ff..30ef85c54 100644 --- a/libsrc/apple2/mou/a2.stdmou.s +++ b/libsrc/apple2/mou/a2.stdmou.s @@ -4,219 +4,219 @@ ; Oliver Schmidt, 03.09.2005 ; - .include "zeropage.inc" - .include "mouse-kernel.inc" - .include "apple2.inc" + .include "zeropage.inc" + .include "mouse-kernel.inc" + .include "apple2.inc" ; ------------------------------------------------------------------------ -SETMOUSE = $12 ; Sets mouse mode -SERVEMOUSE = $13 ; Services mouse interrupt -READMOUSE = $14 ; Reads mouse position -CLEARMOUSE = $15 ; Clears mouse position to 0 (for delta mode) -POSMOUSE = $16 ; Sets mouse position to a user-defined pos -CLAMPMOUSE = $17 ; Sets mouse bounds in a window -HOMEMOUSE = $18 ; Sets mouse to upper-left corner of clamp win -INITMOUSE = $19 ; Resets mouse clamps to default values and - ; sets mouse position to 0,0 +SETMOUSE = $12 ; Sets mouse mode +SERVEMOUSE = $13 ; Services mouse interrupt +READMOUSE = $14 ; Reads mouse position +CLEARMOUSE = $15 ; Clears mouse position to 0 (for delta mode) +POSMOUSE = $16 ; Sets mouse position to a user-defined pos +CLAMPMOUSE = $17 ; Sets mouse bounds in a window +HOMEMOUSE = $18 ; Sets mouse to upper-left corner of clamp win +INITMOUSE = $19 ; Resets mouse clamps to default values and + ; sets mouse position to 0,0 -pos1_lo := $0478 -pos1_hi := $0578 -pos2_lo := $04F8 -pos2_hi := $05F8 -status := $0778 +pos1_lo := $0478 +pos1_hi := $0578 +pos2_lo := $04F8 +pos2_hi := $05F8 +status := $0778 ; ------------------------------------------------------------------------ - .segment "JUMPTABLE" + .segment "JUMPTABLE" - ; Driver signature - .byte $6D, $6F, $75 ; "mou" - .byte MOUSE_API_VERSION ; Mouse driver API version number + ; Driver signature + .byte $6D, $6F, $75 ; "mou" + .byte MOUSE_API_VERSION ; Mouse driver API version number - ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr HIDE - .addr SHOW - .addr SETBOX - .addr GETBOX - .addr MOVE - .addr BUTTONS - .addr POS - .addr INFO - .addr IOCTL - .addr IRQ + ; Jump table. + .addr INSTALL + .addr UNINSTALL + .addr HIDE + .addr SHOW + .addr SETBOX + .addr GETBOX + .addr MOVE + .addr BUTTONS + .addr POS + .addr INFO + .addr IOCTL + .addr IRQ ; Mouse driver flags .byte MOUSE_FLAG_EARLY_IRQ - ; Callback table, set by the kernel before INSTALL is called -CHIDE: jmp $0000 ; Hide the cursor -CSHOW: jmp $0000 ; Show the cursor -CMOVEX: jmp $0000 ; Move the cursor to X coord -CMOVEY: jmp $0000 ; Move the cursor to Y coord + ; Callback table, set by the kernel before INSTALL is called +CHIDE: jmp $0000 ; Hide the cursor +CSHOW: jmp $0000 ; Show the cursor +CMOVEX: jmp $0000 ; Move the cursor to X coord +CMOVEY: jmp $0000 ; Move the cursor to Y coord ; ------------------------------------------------------------------------ - .bss + .bss -box: .tag MOUSE_BOX -info: .tag MOUSE_INFO -slot: .res 1 -visible:.res 1 +box: .tag MOUSE_BOX +info: .tag MOUSE_INFO +slot: .res 1 +visible:.res 1 ; ------------------------------------------------------------------------ - .rodata + .rodata -offsets:.byte $05 ; Pascal 1.0 ID byte - .byte $07 ; Pascal 1.0 ID byte - .byte $0B ; Pascal 1.1 generic signature byte - .byte $0C ; Device signature byte +offsets:.byte $05 ; Pascal 1.0 ID byte + .byte $07 ; Pascal 1.0 ID byte + .byte $0B ; Pascal 1.1 generic signature byte + .byte $0C ; Device signature byte -values: .byte $38 ; Fixed - .byte $18 ; Fixed - .byte $01 ; Fixed - .byte $20 ; X-Y pointing device type 0 +values: .byte $38 ; Fixed + .byte $18 ; Fixed + .byte $01 ; Fixed + .byte $20 ; X-Y pointing device type 0 -size = * - values +size = * - values -inibox: .word 0 ; MinX - .word 0 ; MinY - .word 279 ; MaxX - .word 191 ; MaxY +inibox: .word 0 ; MinX + .word 0 ; MinY + .word 279 ; MaxX + .word 191 ; MaxY ; ------------------------------------------------------------------------ - .data + .data firmware: - ; Lookup and patch firmware address lobyte -lookup: ldy $FF00,x ; Patched at runtime - sty jump+1 ; Modify code below + ; Lookup and patch firmware address lobyte +lookup: ldy $FF00,x ; Patched at runtime + sty jump+1 ; Modify code below - ; Apple II Mouse TechNote #1, Interrupt Environment with the Mouse: - ; "Enter all mouse routines (...) with the X register set to $Cn - ; and Y register set to $n0, where n = the slot number." -xparam: ldx #$FF ; Patched at runtime -yparam: ldy #$FF ; Patched at runtime + ; Apple II Mouse TechNote #1, Interrupt Environment with the Mouse: + ; "Enter all mouse routines (...) with the X register set to $Cn + ; and Y register set to $n0, where n = the slot number." +xparam: ldx #$FF ; Patched at runtime +yparam: ldy #$FF ; Patched at runtime -jump: jmp $FFFF ; Patched at runtime +jump: jmp $FFFF ; Patched at runtime ; ------------------------------------------------------------------------ - .code + .code ; INSTALL: Is called after the driver is loaded into memory. If possible, ; check if the hardware is present. Must return an MOUSE_ERR_xx code in A/X. INSTALL: - lda #<$C000 - sta ptr1 - lda #>$C000 - sta ptr1+1 + lda #<$C000 + sta ptr1 + lda #>$C000 + sta ptr1+1 - ; Search for AppleMouse II firmware in slots 1 - 7 -next: inc ptr1+1 - lda ptr1+1 - cmp #>$C800 - bcc :+ + ; Search for AppleMouse II firmware in slots 1 - 7 +next: inc ptr1+1 + lda ptr1+1 + cmp #>$C800 + bcc :+ - ; Mouse firmware not found - lda #MOUSE_ERR_NO_DEVICE - rts + ; Mouse firmware not found + lda #MOUSE_ERR_NO_DEVICE + rts - ; Check Pascal 1.1 Firmware Protocol ID bytes -: ldx #size - 1 -: ldy offsets,x - lda values,x - cmp (ptr1),y - bne next - dex - bpl :- + ; Check Pascal 1.1 Firmware Protocol ID bytes +: ldx #size - 1 +: ldy offsets,x + lda values,x + cmp (ptr1),y + bne next + dex + bpl :- - ; Get and patch firmware address hibyte - lda ptr1+1 - sta lookup+2 - sta xparam+1 - sta jump+2 + ; Get and patch firmware address hibyte + lda ptr1+1 + sta lookup+2 + sta xparam+1 + sta jump+2 - ; Disable interrupts now because setting the slot number makes - ; the IRQ handler (maybe called due to some non-mouse IRQ) try - ; calling the firmware which isn't correctly set up yet - sei + ; Disable interrupts now because setting the slot number makes + ; the IRQ handler (maybe called due to some non-mouse IRQ) try + ; calling the firmware which isn't correctly set up yet + sei - ; Convert to and save slot number - and #$0F - sta slot + ; Convert to and save slot number + and #$0F + sta slot - ; Convert to and patch I/O register index - asl - asl - asl - asl - sta yparam+1 - - ; The AppleMouse II Card needs the ROM switched in - ; to be able to detect an Apple //e and use RDVBL - bit $C082 + ; Convert to and patch I/O register index + asl + asl + asl + asl + sta yparam+1 + + ; The AppleMouse II Card needs the ROM switched in + ; to be able to detect an Apple //e and use RDVBL + bit $C082 - ; Reset mouse hardware - ldx #INITMOUSE - jsr firmware - - ; Switch in LC bank 2 for R/O - bit $C080 + ; Reset mouse hardware + ldx #INITMOUSE + jsr firmware + + ; Switch in LC bank 2 for R/O + bit $C080 - ; Turn mouse on - lda #%00000001 - ldx #SETMOUSE - jsr firmware + ; Turn mouse on + lda #%00000001 + ldx #SETMOUSE + jsr firmware - ; Set initial mouse clamps - lda #inibox - jsr SETBOX + ; Set initial mouse clamps + lda #inibox + jsr SETBOX - ; Set initial mouse position - ldx slot - lda #<(279 / 2) - sta pos1_lo,x - lda #>(279 / 2) - sta pos1_hi,x - lda #<(191 / 2) - sta pos2_lo,x - lda #>(191 / 2) - sta pos2_hi,x - ldx #POSMOUSE - jsr firmware + ; Set initial mouse position + ldx slot + lda #<(279 / 2) + sta pos1_lo,x + lda #>(279 / 2) + sta pos1_hi,x + lda #<(191 / 2) + sta pos2_lo,x + lda #>(191 / 2) + sta pos2_hi,x + ldx #POSMOUSE + jsr firmware - ; Update cursor - jsr update + ; Update cursor + jsr update - ; Turn VBL interrupt on - lda #%00001001 - ldx #SETMOUSE -common: jsr firmware + ; Turn VBL interrupt on + lda #%00001001 + ldx #SETMOUSE +common: jsr firmware - ; Enable interrupts and return success - cli - lda #MOUSE_ERR_OK - rts + ; Enable interrupts and return success + cli + lda #MOUSE_ERR_OK + rts ; UNINSTALL: Is called before the driver is removed from memory. ; No return code required (the driver is removed from memory on return). UNINSTALL: - ; Hide cursor - sei - jsr CHIDE + ; Hide cursor + sei + jsr CHIDE - ; Turn mouse off - lda #%00000000 - ldx #SETMOUSE - bne common ; Branch always + ; Turn mouse off + lda #%00000000 + ldx #SETMOUSE + bne common ; Branch always ; SETBOX: Set the mouse bounding box. The parameters are passed as they come ; from the C program, that is, a pointer to a mouse_box struct in A/X. @@ -224,62 +224,62 @@ UNINSTALL: ; of the caller. It is not necessary to validate the parameters, trust the ; caller and save some code here. No return code required. SETBOX: - sta ptr1 - stx ptr1+1 + sta ptr1 + stx ptr1+1 - ; Set x clamps - ldx #$00 - ldy #MOUSE_BOX::MINX - jsr :+ - - ; Set y clamps - ldx #$01 - ldy #MOUSE_BOX::MINY + ; Set x clamps + ldx #$00 + ldy #MOUSE_BOX::MINX + jsr :+ + + ; Set y clamps + ldx #$01 + ldy #MOUSE_BOX::MINY - ; Apple II Mouse TechNote #1, Interrupt Environment with the Mouse: - ; "Disable interrupts before placing position information in the - ; screen holes." -: sei + ; Apple II Mouse TechNote #1, Interrupt Environment with the Mouse: + ; "Disable interrupts before placing position information in the + ; screen holes." +: sei - ; Set low clamp - lda (ptr1),y - sta box,y - sta pos1_lo - iny - lda (ptr1),y - sta box,y - sta pos1_hi + ; Set low clamp + lda (ptr1),y + sta box,y + sta pos1_lo + iny + lda (ptr1),y + sta box,y + sta pos1_hi - ; Skip one word - iny - iny + ; Skip one word + iny + iny - ; Set high clamp - iny - lda (ptr1),y - sta box,y - sta pos2_lo - iny - lda (ptr1),y - sta box,y - sta pos2_hi + ; Set high clamp + iny + lda (ptr1),y + sta box,y + sta pos2_lo + iny + lda (ptr1),y + sta box,y + sta pos2_hi - txa - ldx #CLAMPMOUSE - bne common ; Branch always + txa + ldx #CLAMPMOUSE + bne common ; Branch always ; GETBOX: Return the mouse bounding box. The parameters are passed as they ; come from the C program, that is, a pointer to a mouse_box struct in A/X. GETBOX: - sta ptr1 - stx ptr1+1 + sta ptr1 + stx ptr1+1 - ldy #.sizeof(MOUSE_BOX)-1 -: lda box,y - sta (ptr1),y - dey - bpl :- - rts + ldy #.sizeof(MOUSE_BOX)-1 +: lda box,y + sta (ptr1),y + dey + bpl :- + rts ; MOVE: Move the mouse to a new position. The position is passed as it comes ; from the C program, that is: x on the stack and y in A/X. The C wrapper will @@ -287,148 +287,148 @@ GETBOX: ; No checks are done if the new position is valid (within the bounding box or ; the screen). No return code required. MOVE: - ldy slot - sei + ldy slot + sei - ; Set y - sta pos2_lo,y - txa - sta pos2_hi,y + ; Set y + sta pos2_lo,y + txa + sta pos2_hi,y - tya - tax - ldy #$00 ; Start at top of stack + tya + tax + ldy #$00 ; Start at top of stack - ; Set x - lda (sp),y - iny - sta pos1_lo,x - lda (sp),y - sta pos1_hi,x + ; Set x + lda (sp),y + iny + sta pos1_lo,x + lda (sp),y + sta pos1_hi,x - ; Update cursor - jsr update + ; Update cursor + jsr update - ldx #POSMOUSE - bne common ; Branch always + ldx #POSMOUSE + bne common ; Branch always ; HIDE: Is called to hide the mouse cursor. The mouse kernel manages a ; counter for calls to show/hide, and the driver entry point is only called ; if the mouse is currently visible and should get hidden. For most drivers, -; no special action is required besides hiding the mouse cursor. +; no special action is required besides hiding the mouse cursor. ; No return code required. HIDE: - dec visible - sei - jsr CHIDE - cli - rts + dec visible + sei + jsr CHIDE + cli + rts -; SHOW: Is called to show the mouse cursor. The mouse kernel manages a +; SHOW: Is called to show the mouse cursor. The mouse kernel manages a ; counter for calls to show/hide, and the driver entry point is only called ; if the mouse is currently hidden and should become visible. For most drivers, -; no special action is required besides enabling the mouse cursor. +; no special action is required besides enabling the mouse cursor. ; No return code required. SHOW: - inc visible - rts + inc visible + rts ; BUTTONS: Return the button mask in A/X. BUTTONS: - lda info + MOUSE_INFO::BUTTONS - ldx #$00 - rts + lda info + MOUSE_INFO::BUTTONS + ldx #$00 + rts ; POS: Return the mouse position in the MOUSE_POS struct pointed to by ptr1. ; No return code required. POS: - ldy #.sizeof(MOUSE_POS)-1 - bne copy ; Branch always + ldy #.sizeof(MOUSE_POS)-1 + bne copy ; Branch always ; INFO: Returns mouse position and current button mask in the MOUSE_INFO ; struct pointed to by ptr1. No return code required. INFO: - ldy #.sizeof(MOUSE_INFO)-1 -copy: sei -: lda info,y - sta (ptr1),y - dey - bpl :- - cli - rts + ldy #.sizeof(MOUSE_INFO)-1 +copy: sei +: lda info,y + sta (ptr1),y + dey + bpl :- + cli + rts ; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl ; specific data in ptr1, and the ioctl code in A. ; Must return an MOUSE_ERR_xx code in A/X. IOCTL: - lda #MOUSE_ERR_INV_IOCTL - rts + lda #MOUSE_ERR_INV_IOCTL + rts ; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All ; registers are already saved, no parameters are passed, but the carry flag ; is clear on entry. The routine must return with carry set if the interrupt ; was handled, otherwise with carry clear. IRQ: - ; Check for installed mouse - lda slot - beq done + ; Check for installed mouse + lda slot + beq done - ; Check for mouse interrupt - ldx #SERVEMOUSE - jsr firmware - bcc :+ - clc ; Interrupt not handled -done: rts + ; Check for mouse interrupt + ldx #SERVEMOUSE + jsr firmware + bcc :+ + clc ; Interrupt not handled +done: rts -: ldx #READMOUSE - jsr firmware +: ldx #READMOUSE + jsr firmware - ; Get status - ldy slot - lda status,y - tax ; Save status + ; Get status + ldy slot + lda status,y + tax ; Save status - ; Extract button down values - asl ; C = Button 0 is currently down - and #%00100000 ; !Z = Button 1 is currently down + ; Extract button down values + asl ; C = Button 0 is currently down + and #%00100000 ; !Z = Button 1 is currently down - ; Set button mask - beq :+ - lda #MOUSE_BTN_RIGHT -: bcc :+ - ora #MOUSE_BTN_LEFT -: sta info + MOUSE_INFO::BUTTONS + ; Set button mask + beq :+ + lda #MOUSE_BTN_RIGHT +: bcc :+ + ora #MOUSE_BTN_LEFT +: sta info + MOUSE_INFO::BUTTONS - ; Check for mouse movement - txa ; Restore status - and #%00100000 ; X or Y changed since last READMOUSE - beq :+ + ; Check for mouse movement + txa ; Restore status + and #%00100000 ; X or Y changed since last READMOUSE + beq :+ - ; Remove the cursor at the old position -update: jsr CHIDE + ; Remove the cursor at the old position +update: jsr CHIDE - ; Get and set the new X position - ldy slot - lda pos1_lo,y - ldx pos1_hi,y - sta info + MOUSE_POS::XCOORD - stx info + MOUSE_POS::XCOORD+1 - jsr CMOVEX + ; Get and set the new X position + ldy slot + lda pos1_lo,y + ldx pos1_hi,y + sta info + MOUSE_POS::XCOORD + stx info + MOUSE_POS::XCOORD+1 + jsr CMOVEX - ; Get and set the new Y position - ldy slot - lda pos2_lo,y - ldx pos2_hi,y - sta info + MOUSE_POS::YCOORD - stx info + MOUSE_POS::YCOORD+1 - jsr CMOVEY + ; Get and set the new Y position + ldy slot + lda pos2_lo,y + ldx pos2_hi,y + sta info + MOUSE_POS::YCOORD + stx info + MOUSE_POS::YCOORD+1 + jsr CMOVEY - ; Check for visibility -: lda visible - beq :+ + ; Check for visibility +: lda visible + beq :+ - ; Draw the cursor at the new position - jsr CSHOW -: sec ; Interrupt handled - rts + ; Draw the cursor at the new position + jsr CSHOW +: sec ; Interrupt handled + rts diff --git a/libsrc/apple2/mouse_stat_stddrv.s b/libsrc/apple2/mouse_stat_stddrv.s index 4ca1e7f04..dcb3be9ca 100644 --- a/libsrc/apple2/mouse_stat_stddrv.s +++ b/libsrc/apple2/mouse_stat_stddrv.s @@ -6,16 +6,16 @@ ; const void mouse_static_stddrv[]; ; - .export _mouse_static_stddrv - .ifdef __APPLE2ENH__ - .import _a2e_stdmou_mou + .export _mouse_static_stddrv + .ifdef __APPLE2ENH__ + .import _a2e_stdmou_mou .else - .import _a2_stdmou_mou + .import _a2_stdmou_mou .endif .rodata - .ifdef __APPLE2ENH__ + .ifdef __APPLE2ENH__ _mouse_static_stddrv := _a2e_stdmou_mou .else _mouse_static_stddrv := _a2_stdmou_mou diff --git a/libsrc/apple2/mouse_stddrv.s b/libsrc/apple2/mouse_stddrv.s index a58767e0d..876fbb4af 100644 --- a/libsrc/apple2/mouse_stddrv.s +++ b/libsrc/apple2/mouse_stddrv.s @@ -6,13 +6,13 @@ ; const char mouse_stddrv[]; ; - .export _mouse_stddrv + .export _mouse_stddrv .rodata _mouse_stddrv: - .ifdef __APPLE2ENH__ - .asciiz "A2E.STDMOU.MOU" + .ifdef __APPLE2ENH__ + .asciiz "A2E.STDMOU.MOU" .else - .asciiz "A2.STDMOU.MOU" + .asciiz "A2.STDMOU.MOU" .endif diff --git a/libsrc/apple2/open.s b/libsrc/apple2/open.s index 078cfdd48..db40c3c74 100644 --- a/libsrc/apple2/open.s +++ b/libsrc/apple2/open.s @@ -4,28 +4,28 @@ ; int open (const char* name, int flags, ...); ; - .export _open, closedirect, freebuffer - .export __filetype, __auxtype - .constructor raisefilelevel - .destructor closeallfiles, 5 + .export _open, closedirect, freebuffer + .export __filetype, __auxtype + .constructor raisefilelevel + .destructor closeallfiles, 5 - .import pushname, popname, __dos_type - .import iobuf_alloc, iobuf_free - .import addysp, incsp4, incaxy, pushax, popax + .import pushname, popname, __dos_type + .import iobuf_alloc, iobuf_free + .import addysp, incsp4, incaxy, pushax, popax - .include "zeropage.inc" - .include "errno.inc" - .include "fcntl.inc" - .include "mli.inc" - .include "filedes.inc" + .include "zeropage.inc" + .include "errno.inc" + .include "fcntl.inc" + .include "mli.inc" + .include "filedes.inc" - .segment "INIT" + .segment "INIT" raisefilelevel: ; Raise file level - lda __dos_type - beq :+ - inc LEVEL + lda __dos_type + beq :+ + inc LEVEL : rts .code @@ -37,14 +37,14 @@ _open: dey dey dey - jsr addysp + jsr addysp ; Start with first fdtab slot - ldy #$00 + ldy #$00 ; Check for free fdtab slot -: lda fdtab + FD::REF_NUM,y - beq found +: lda fdtab + FD::REF_NUM,y + beq found ; Advance to next fdtab slot .assert .sizeof(FD) = 4, error @@ -54,149 +54,149 @@ _open: iny ; Check for end of fdtab - cpy #MAX_FDS * .sizeof(FD) - bcc :- + cpy #MAX_FDS * .sizeof(FD) + bcc :- ; Load errno code - lda #EMFILE + lda #EMFILE ; Cleanup stack -errno: jsr incsp4 ; Preserves A +errno: jsr incsp4 ; Preserves A ; Set __errno - jmp __directerrno + jmp __directerrno ; Save fdtab slot found: tya pha ; Alloc I/O buffer - lda #<(fdtab + FD::BUFFER) - ldx #>(fdtab + FD::BUFFER) - jsr incaxy - jsr pushax - lda #$00 - ldx #>$0100 - jsr pushax ; Preserves A - ldx #>$0400 - jsr iobuf_alloc - tay ; Save errno code + lda #<(fdtab + FD::BUFFER) + ldx #>(fdtab + FD::BUFFER) + jsr incaxy + jsr pushax + lda #$00 + ldx #>$0100 + jsr pushax ; Preserves A + ldx #>$0400 + jsr iobuf_alloc + tay ; Save errno code ; Restore fdtab slot pla - sta tmp2 ; Save fdtab slot + sta tmp2 ; Save fdtab slot ; Check for error - tya ; Restore errno code - bne errno + tya ; Restore errno code + bne errno ; Get and save flags - jsr popax - sta tmp3 + jsr popax + sta tmp3 ; Get and push name - jsr popax - jsr pushname - bne oserr1 + jsr popax + jsr pushname + bne oserr1 ; Set pushed name - lda sp - ldx sp+1 - sta mliparam + MLI::OPEN::PATHNAME - stx mliparam + MLI::OPEN::PATHNAME+1 + lda sp + ldx sp+1 + sta mliparam + MLI::OPEN::PATHNAME + stx mliparam + MLI::OPEN::PATHNAME+1 ; Check for create flag - lda tmp3 ; Restore flags - and #O_CREAT - beq open + lda tmp3 ; Restore flags + and #O_CREAT + beq open ; PATHNAME already set .assert MLI::CREATE::PATHNAME = MLI::OPEN::PATHNAME, error ; Set all other parameters from template - ldx #(MLI::CREATE::CREATE_TIME+1) - (MLI::CREATE::PATHNAME+1) - 1 -: lda CREATE,x - sta mliparam + MLI::CREATE::ACCESS,x + ldx #(MLI::CREATE::CREATE_TIME+1) - (MLI::CREATE::PATHNAME+1) - 1 +: lda CREATE,x + sta mliparam + MLI::CREATE::ACCESS,x dex - bpl :- + bpl :- ; Create file - lda #CREATE_CALL - ldx #CREATE_COUNT - jsr callmli - bcc open + lda #CREATE_CALL + ldx #CREATE_COUNT + jsr callmli + bcc open ; Check for ordinary errors - cmp #$47 ; "Duplicate filename" - bne oserr2 + cmp #$47 ; "Duplicate filename" + bne oserr2 ; Check for exclusive flag - lda tmp3 ; Restore flags - and #O_EXCL - beq open + lda tmp3 ; Restore flags + and #O_EXCL + beq open - lda #$47 ; "Duplicate filename" + lda #$47 ; "Duplicate filename" ; Cleanup name -oserr2: jsr popname ; Preserves A +oserr2: jsr popname ; Preserves A -oserr1: ldy tmp2 ; Restore fdtab slot +oserr1: ldy tmp2 ; Restore fdtab slot ; Cleanup I/O buffer - pha ; Save oserror code - jsr freebuffer - pla ; Restore oserror code + pha ; Save oserror code + jsr freebuffer + pla ; Restore oserror code ; Set __oserror - jmp __mappederrno + jmp __mappederrno -open: ldy tmp2 ; Restore fdtab slot +open: ldy tmp2 ; Restore fdtab slot ; Set allocated I/O buffer - ldx fdtab + FD::BUFFER+1,y - sta mliparam + MLI::OPEN::IO_BUFFER ; A = 0 - stx mliparam + MLI::OPEN::IO_BUFFER+1 + ldx fdtab + FD::BUFFER+1,y + sta mliparam + MLI::OPEN::IO_BUFFER ; A = 0 + stx mliparam + MLI::OPEN::IO_BUFFER+1 ; Open file - lda #OPEN_CALL - ldx #OPEN_COUNT - jsr callmli - bcs oserr2 + lda #OPEN_CALL + ldx #OPEN_COUNT + jsr callmli + bcs oserr2 ; Get and save fd - ldx mliparam + MLI::OPEN::REF_NUM - stx tmp1 ; Save fd + ldx mliparam + MLI::OPEN::REF_NUM + stx tmp1 ; Save fd ; Set flags and check for truncate flag - lda tmp3 ; Restore flags - sta fdtab + FD::FLAGS,y - and #O_TRUNC - beq done + lda tmp3 ; Restore flags + sta fdtab + FD::FLAGS,y + and #O_TRUNC + beq done ; Set fd and zero size - stx mliparam + MLI::EOF::REF_NUM - ldx #$02 - lda #$00 -: sta mliparam + MLI::EOF::EOF,x + stx mliparam + MLI::EOF::REF_NUM + ldx #$02 + lda #$00 +: sta mliparam + MLI::EOF::EOF,x dex - bpl :- + bpl :- ; Set file size - lda #SET_EOF_CALL - ldx #EOF_COUNT - jsr callmli - bcc done + lda #SET_EOF_CALL + ldx #EOF_COUNT + jsr callmli + bcc done ; Cleanup file - pha ; Save oserror code - lda tmp1 ; Restore fd - jsr closedirect - pla ; Restore oserror code - bne oserr2 ; Branch always + pha ; Save oserror code + lda tmp1 ; Restore fd + jsr closedirect + pla ; Restore oserror code + bne oserr2 ; Branch always ; Store fd -done: lda tmp1 ; Restore fd - sta fdtab + FD::REF_NUM,y +done: lda tmp1 ; Restore fd + sta fdtab + FD::REF_NUM,y ; Convert fdtab slot to handle .assert .sizeof(FD) = 4, error @@ -205,46 +205,46 @@ done: lda tmp1 ; Restore fd lsr ; Cleanup name - jsr popname ; Preserves A + jsr popname ; Preserves A ; Return success - ldx #$00 - stx __oserror + ldx #$00 + stx __oserror rts freebuffer: ; Free I/O buffer - lda #$00 - ldx fdtab + FD::BUFFER+1,y - jmp iobuf_free + lda #$00 + ldx fdtab + FD::BUFFER+1,y + jmp iobuf_free closedirect: ; Set fd - sta mliparam + MLI::CLOSE::REF_NUM + sta mliparam + MLI::CLOSE::REF_NUM ; Call close - lda #CLOSE_CALL - ldx #CLOSE_COUNT - jmp callmli + lda #CLOSE_CALL + ldx #CLOSE_COUNT + jmp callmli closeallfiles: ; All open files with current level (or higher) - lda #$00 - jsr closedirect + lda #$00 + jsr closedirect ; Restore original file level - lda __dos_type - beq :+ - dec LEVEL + lda __dos_type + beq :+ + dec LEVEL : rts .data -CREATE: .byte %11000011 ; ACCESS: Standard full access +CREATE: .byte %11000011 ; ACCESS: Standard full access __filetype: - .byte $06 ; FILE_TYPE: Standard binary file + .byte $06 ; FILE_TYPE: Standard binary file __auxtype: - .word $0000 ; AUX_TYPE: Load address N/A - .byte $01 ; STORAGE_TYPE: Standard seedling file - .word $0000 ; CREATE_DATE: Current date - .word $0000 ; CREATE_TIME: Current time + .word $0000 ; AUX_TYPE: Load address N/A + .byte $01 ; STORAGE_TYPE: Standard seedling file + .word $0000 ; CREATE_DATE: Current date + .word $0000 ; CREATE_TIME: Current time diff --git a/libsrc/apple2/opendir.c b/libsrc/apple2/opendir.c index 3b6c45d94..040593118 100644 --- a/libsrc/apple2/opendir.c +++ b/libsrc/apple2/opendir.c @@ -52,7 +52,7 @@ extern char _cwd[FILENAME_MAX]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -64,44 +64,44 @@ DIR* __fastcall__ opendir (register const char* name) /* Alloc DIR */ if ((dir = malloc (sizeof (*dir))) == NULL) { - /* May not have been done by malloc() */ - _directerrno (ENOMEM); + /* May not have been done by malloc() */ + _directerrno (ENOMEM); - /* Return failure */ - return NULL; + /* Return failure */ + return NULL; } /* Interpret dot as current working directory */ if (*name == '.') { - name = _cwd; + name = _cwd; } /* Open directory file */ if ((dir->fd = open (name, O_RDONLY)) != -1) { - /* Read directory key block */ - if (read (dir->fd, - dir->block.bytes, - sizeof (dir->block)) == sizeof (dir->block)) { + /* Read directory key block */ + if (read (dir->fd, + dir->block.bytes, + sizeof (dir->block)) == sizeof (dir->block)) { - /* Get directory entry infos from directory header */ - dir->entry_length = dir->block.bytes[0x23]; - dir->entries_per_block = dir->block.bytes[0x24]; + /* Get directory entry infos from directory header */ + dir->entry_length = dir->block.bytes[0x23]; + dir->entries_per_block = dir->block.bytes[0x24]; - /* Skip directory header entry */ - dir->current_entry = 1; + /* Skip directory header entry */ + dir->current_entry = 1; - /* Return success */ - return dir; - } + /* Return success */ + return dir; + } - /* EOF: Most probably no directory file at all */ - if (_oserror == 0) { - _directerrno (EINVAL); - } + /* EOF: Most probably no directory file at all */ + if (_oserror == 0) { + _directerrno (EINVAL); + } - /* Cleanup directory file */ - close (dir->fd); + /* Cleanup directory file */ + close (dir->fd); } /* Cleanup DIR */ diff --git a/libsrc/apple2/oserrlist.s b/libsrc/apple2/oserrlist.s index 2ec5c6f19..6fd711ee8 100644 --- a/libsrc/apple2/oserrlist.s +++ b/libsrc/apple2/oserrlist.s @@ -41,36 +41,36 @@ End: .rodata __sys_oserrlist: - sys_oserr_entry $01, "Bad system call number" - sys_oserr_entry $04, "Bad system call parameter count" - sys_oserr_entry $25, "Interrupt table full" - sys_oserr_entry $27, "I/O error" - sys_oserr_entry $28, "No device connected" - sys_oserr_entry $2B, "Disk write protected" - sys_oserr_entry $2E, "Disk switched" - sys_oserr_entry $2F, "Device off-line" - sys_oserr_entry $40, "Invalid pathname" - sys_oserr_entry $42, "Maximum number of files open" - sys_oserr_entry $43, "Invalid reference number" - sys_oserr_entry $44, "Directory not found" - sys_oserr_entry $45, "Volume not found" - sys_oserr_entry $46, "File not found" - sys_oserr_entry $47, "Duplicate filename" - sys_oserr_entry $48, "Volume full" - sys_oserr_entry $49, "Volume directory full" - sys_oserr_entry $4A, "Incompatible file format" - sys_oserr_entry $4B, "Unsupported storage_type" - sys_oserr_entry $4C, "End of file encountered" - sys_oserr_entry $4D, "Position out of range" - sys_oserr_entry $4E, "File access error" - sys_oserr_entry $50, "File is open" - sys_oserr_entry $51, "Directory structure damaged" - sys_oserr_entry $52, "Not a ProDOS disk" - sys_oserr_entry $53, "Invalid system call parameter" - sys_oserr_entry $55, "Volume Control Block table full" - sys_oserr_entry $56, "Bad buffer address" - sys_oserr_entry $57, "Duplicate volume" - sys_oserr_entry $5A, "File structure damaged" + sys_oserr_entry $01, "Bad system call number" + sys_oserr_entry $04, "Bad system call parameter count" + sys_oserr_entry $25, "Interrupt table full" + sys_oserr_entry $27, "I/O error" + sys_oserr_entry $28, "No device connected" + sys_oserr_entry $2B, "Disk write protected" + sys_oserr_entry $2E, "Disk switched" + sys_oserr_entry $2F, "Device off-line" + sys_oserr_entry $40, "Invalid pathname" + sys_oserr_entry $42, "Maximum number of files open" + sys_oserr_entry $43, "Invalid reference number" + sys_oserr_entry $44, "Directory not found" + sys_oserr_entry $45, "Volume not found" + sys_oserr_entry $46, "File not found" + sys_oserr_entry $47, "Duplicate filename" + sys_oserr_entry $48, "Volume full" + sys_oserr_entry $49, "Volume directory full" + sys_oserr_entry $4A, "Incompatible file format" + sys_oserr_entry $4B, "Unsupported storage_type" + sys_oserr_entry $4C, "End of file encountered" + sys_oserr_entry $4D, "Position out of range" + sys_oserr_entry $4E, "File access error" + sys_oserr_entry $50, "File is open" + sys_oserr_entry $51, "Directory structure damaged" + sys_oserr_entry $52, "Not a ProDOS disk" + sys_oserr_entry $53, "Invalid system call parameter" + sys_oserr_entry $55, "Volume Control Block table full" + sys_oserr_entry $56, "Bad buffer address" + sys_oserr_entry $57, "Duplicate volume" + sys_oserr_entry $5A, "File structure damaged" sys_oserr_sentinel "Unknown error" diff --git a/libsrc/apple2/oserror.s b/libsrc/apple2/oserror.s index 293c4c866..f16aa4960 100644 --- a/libsrc/apple2/oserror.s +++ b/libsrc/apple2/oserror.s @@ -4,59 +4,59 @@ ; int __fastcall__ _osmaperrno (unsigned char oserror); ; - .export __osmaperrno + .export __osmaperrno - .include "errno.inc" + .include "errno.inc" __osmaperrno: - ldx #ErrTabSize -: cmp ErrTab-2,x ; Search for the error code - beq :+ ; Jump if found + ldx #ErrTabSize +: cmp ErrTab-2,x ; Search for the error code + beq :+ ; Jump if found dex dex - bne :- ; Next entry + bne :- ; Next entry ; Code not found, return EUNKNOWN - lda #EUNKNOWN + lda #EUNKNOWN rts ; Found the code -: lda ErrTab-1,x - ldx #$00 ; High byte always zero +: lda ErrTab-1,x + ldx #$00 ; High byte always zero rts .rodata -ErrTab: .byte $01, ENOSYS ; Bad system call number - .byte $04, EINVAL ; Bad system call parameter count - .byte $25, ENOMEM ; Interrupt table full - .byte $27, EIO ; I/O error - .byte $28, ENODEV ; No device connected - .byte $2B, EACCES ; Disk write protected -; .byte $2E, EUNKNOWN ; Disk switched - .byte $2F, ENODEV ; Device off-line - .byte $40, EINVAL ; Invalid pathname - .byte $42, EMFILE ; Maximum number of files open - .byte $43, EINVAL ; Invalid reference number - .byte $44, ENOENT ; Directory not found - .byte $45, ENOENT ; Volume not found - .byte $46, ENOENT ; File not found - .byte $47, EEXIST ; Duplicate filename - .byte $48, ENOSPC ; Volume full - .byte $49, ENOSPC ; Volume directory full -; .byte $4A, EUNKNOWN ; Incompatible file format - .byte $4B, EINVAL ; Unsupported storage_type -; .byte $4C, EUNKNOWN ; End of file encountered - .byte $4D, ESPIPE ; Position out of range - .byte $4E, EACCES ; File access error - .byte $50, EINVAL ; File is open -; .byte $51, EUNKNOWN ; Directory structure damaged - .byte $52, ENODEV ; Not a ProDOS volume - .byte $53, ERANGE ; Invalid system call parameter - .byte $55, EMFILE ; Volume Control Block table full - .byte $56, EINVAL ; Bad buffer address -; .byte $57, EUNKNOWN ; Duplicate volume -; .byte $5A, EUNKNOWN ; File structure damaged +ErrTab: .byte $01, ENOSYS ; Bad system call number + .byte $04, EINVAL ; Bad system call parameter count + .byte $25, ENOMEM ; Interrupt table full + .byte $27, EIO ; I/O error + .byte $28, ENODEV ; No device connected + .byte $2B, EACCES ; Disk write protected +; .byte $2E, EUNKNOWN ; Disk switched + .byte $2F, ENODEV ; Device off-line + .byte $40, EINVAL ; Invalid pathname + .byte $42, EMFILE ; Maximum number of files open + .byte $43, EINVAL ; Invalid reference number + .byte $44, ENOENT ; Directory not found + .byte $45, ENOENT ; Volume not found + .byte $46, ENOENT ; File not found + .byte $47, EEXIST ; Duplicate filename + .byte $48, ENOSPC ; Volume full + .byte $49, ENOSPC ; Volume directory full +; .byte $4A, EUNKNOWN ; Incompatible file format + .byte $4B, EINVAL ; Unsupported storage_type +; .byte $4C, EUNKNOWN ; End of file encountered + .byte $4D, ESPIPE ; Position out of range + .byte $4E, EACCES ; File access error + .byte $50, EINVAL ; File is open +; .byte $51, EUNKNOWN ; Directory structure damaged + .byte $52, ENODEV ; Not a ProDOS volume + .byte $53, ERANGE ; Invalid system call parameter + .byte $55, EMFILE ; Volume Control Block table full + .byte $56, EINVAL ; Bad buffer address +; .byte $57, EUNKNOWN ; Duplicate volume +; .byte $5A, EUNKNOWN ; File structure damaged ErrTabSize = (* - ErrTab) diff --git a/libsrc/apple2/randomize.s b/libsrc/apple2/randomize.s index 76e8dd60f..1558d85a7 100644 --- a/libsrc/apple2/randomize.s +++ b/libsrc/apple2/randomize.s @@ -5,8 +5,8 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand .include "apple2.inc" diff --git a/libsrc/apple2/rdkey.s b/libsrc/apple2/rdkey.s index d07888844..15ba4b345 100644 --- a/libsrc/apple2/rdkey.s +++ b/libsrc/apple2/rdkey.s @@ -4,17 +4,17 @@ ; RDKEY routine ; - .export RDKEY + .export RDKEY - .include "apple2.inc" + .include "apple2.inc" - .segment "LOWCODE" + .segment "LOWCODE" RDKEY: - ; Switch in ROM and call RDKEY - bit $C082 - jsr $FD0C ; Display prompt and read key from user input routine + ; Switch in ROM and call RDKEY + bit $C082 + jsr $FD0C ; Display prompt and read key from user input routine - ; Switch in LC bank 2 for R/O and return - bit $C080 - rts + ; Switch in LC bank 2 for R/O and return + bit $C080 + rts diff --git a/libsrc/apple2/read.s b/libsrc/apple2/read.s index dccde611f..ef994d6aa 100644 --- a/libsrc/apple2/read.s +++ b/libsrc/apple2/read.s @@ -4,104 +4,104 @@ ; int __fastcall__ read (int fd, void* buf, unsigned count); ; - .constructor initprompt - .export _read - .import rwprolog, rwcommon - .import RDKEY, COUT + .constructor initprompt + .export _read + .import rwprolog, rwcommon + .import RDKEY, COUT - .include "zeropage.inc" - .include "errno.inc" - .include "fcntl.inc" - .include "mli.inc" - .include "filedes.inc" - .include "apple2.inc" + .include "zeropage.inc" + .include "errno.inc" + .include "fcntl.inc" + .include "mli.inc" + .include "filedes.inc" + .include "apple2.inc" - .segment "INIT" + .segment "INIT" initprompt: ; Set prompt <> ']' to let DOS 3.3 know that we're ; not in Applesoft immediate mode and thus keep it ; from scanning our device I/O for DOS commands. - lda #$80 ; Same value used at $D52C - sta PROMPT + lda #$80 ; Same value used at $D52C + sta PROMPT rts .code _read: ; Get parameters - jsr rwprolog - bcs errno - tax ; Save fd + jsr rwprolog + bcs errno + tax ; Save fd ; Check for read access - lda fdtab + FD::FLAGS,y - and #O_RDONLY - beq einval + lda fdtab + FD::FLAGS,y + and #O_RDONLY + beq einval ; Check for device - txa ; Restore fd - bmi device + txa ; Restore fd + bmi device ; Do read - ldy #READ_CALL - jmp rwcommon + ldy #READ_CALL + jmp rwcommon ; Device succeeds always -device: lda #$00 - sta __oserror +device: lda #$00 + sta __oserror ; Set counter to zero - sta ptr3 - sta ptr3+1 + sta ptr3 + sta ptr3+1 ; Check for zero count - lda ptr2 - ora ptr2+1 - beq check + lda ptr2 + ora ptr2+1 + beq check ; Read from device and echo to device -next: jsr RDKEY - jsr COUT +next: jsr RDKEY + jsr COUT ; Clear hi bit and check for '\r' - and #$7F - cmp #$0D - bne :+ + and #$7F + cmp #$0D + bne :+ ; Replace with '\n' and set count to zero - lda #$0A - ldy #$00 - sty ptr2 - sty ptr2+1 + lda #$0A + ldy #$00 + sty ptr2 + sty ptr2+1 ; Put char into buf -: ldy #$00 - sta (ptr1),y +: ldy #$00 + sta (ptr1),y ; Increment pointer - inc ptr1 - bne :+ - inc ptr1+1 + inc ptr1 + bne :+ + inc ptr1+1 ; Increment counter -: inc ptr3 - bne check - inc ptr3+1 +: inc ptr3 + bne check + inc ptr3+1 ; Check for counter less than count -check: lda ptr3 - cmp ptr2 - bcc next - ldx ptr3+1 - cpx ptr2+1 - bcc next +check: lda ptr3 + cmp ptr2 + bcc next + ldx ptr3+1 + cpx ptr2+1 + bcc next ; Return success, AX already set rts ; Load errno code -einval: lda #EINVAL +einval: lda #EINVAL ; Set __errno -errno: jmp __directerrno +errno: jmp __directerrno diff --git a/libsrc/apple2/readdir.c b/libsrc/apple2/readdir.c index 84c782ea1..8acfbbe8b 100644 --- a/libsrc/apple2/readdir.c +++ b/libsrc/apple2/readdir.c @@ -38,7 +38,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -50,27 +50,27 @@ struct dirent* __fastcall__ readdir (register DIR* dir) /* Search for the next active directory entry */ do { - /* Read next directory block if necessary */ - if (dir->current_entry == dir->entries_per_block) { - if (read (dir->fd, - dir->block.bytes, - sizeof (dir->block)) != sizeof (dir->block)) { + /* Read next directory block if necessary */ + if (dir->current_entry == dir->entries_per_block) { + if (read (dir->fd, + dir->block.bytes, + sizeof (dir->block)) != sizeof (dir->block)) { - /* Just return failure as read() has */ - /* set errno if (and only if) no EOF */ - return NULL; - } + /* Just return failure as read() has */ + /* set errno if (and only if) no EOF */ + return NULL; + } - /* Start with first entry in next block */ - dir->current_entry = 0; - } + /* Start with first entry in next block */ + dir->current_entry = 0; + } - /* Compute pointer to current entry */ - entry = dir->block.content.entries + - dir->current_entry * dir->entry_length; + /* Compute pointer to current entry */ + entry = dir->block.content.entries + + dir->current_entry * dir->entry_length; - /* Switch to next entry */ - ++dir->current_entry; + /* Switch to next entry */ + ++dir->current_entry; } while (entry[0x00] == 0); /* Move creation date/time to allow for next step below */ diff --git a/libsrc/apple2/revers.s b/libsrc/apple2/revers.s index 474bf5760..83fcb2ae7 100644 --- a/libsrc/apple2/revers.s +++ b/libsrc/apple2/revers.s @@ -4,19 +4,19 @@ ; unsigned char __fastcall__ revers (unsigned char onoff) ; - .export _revers + .export _revers - .include "apple2.inc" + .include "apple2.inc" _revers: - tax ; Test onoff - beq normal ; If zero, "normal" must be set - ldx #$3F+1 ; Set "inverse" + tax ; Test onoff + beq normal ; If zero, "normal" must be set + ldx #$3F+1 ; Set "inverse" normal: dex ; $00->$FF, $40->$3F - lda #$00 ; Preload return code for "normal" - ldy INVFLG ; Load current flag value - stx INVFLG ; Save new flag value - bmi :+ ; Jump if current value is $FF (normal) - lda #$01 ; Return "inverse" -: ldx #$00 + lda #$00 ; Preload return code for "normal" + ldy INVFLG ; Load current flag value + stx INVFLG ; Save new flag value + bmi :+ ; Jump if current value is $FF (normal) + lda #$01 ; Return "inverse" +: ldx #$00 rts diff --git a/libsrc/apple2/rewinddir.c b/libsrc/apple2/rewinddir.c index 7ff0cd70d..3329852d8 100644 --- a/libsrc/apple2/rewinddir.c +++ b/libsrc/apple2/rewinddir.c @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -49,17 +49,17 @@ void __fastcall__ rewinddir (register DIR* dir) /* Rewind directory file */ if (lseek (dir->fd, 0, SEEK_SET)) { - /* Read directory key block */ - if (read (dir->fd, - dir->block.bytes, - sizeof (dir->block)) == sizeof (dir->block)) { + /* Read directory key block */ + if (read (dir->fd, + dir->block.bytes, + sizeof (dir->block)) == sizeof (dir->block)) { - /* Skip directory header entry */ - dir->current_entry = 1; + /* Skip directory header entry */ + dir->current_entry = 1; - /* Return success */ - return; - } + /* Return success */ + return; + } } /* Assert that no subsequent readdir() finds an active entry */ diff --git a/libsrc/apple2/rwcommon.s b/libsrc/apple2/rwcommon.s index c74ed1377..3180a875d 100644 --- a/libsrc/apple2/rwcommon.s +++ b/libsrc/apple2/rwcommon.s @@ -2,59 +2,59 @@ ; Oliver Schmidt, 12.01.2005 ; - .export rwprolog, rwcommon, rwepilog - .import popax + .export rwprolog, rwcommon, rwepilog + .import popax - .include "zeropage.inc" - .include "errno.inc" - .include "fcntl.inc" - .include "mli.inc" - .include "filedes.inc" + .include "zeropage.inc" + .include "errno.inc" + .include "fcntl.inc" + .include "mli.inc" + .include "filedes.inc" rwprolog: ; Save count - sta ptr2 - stx ptr2+1 + sta ptr2 + stx ptr2+1 ; Get and save buf - jsr popax - sta ptr1 - stx ptr1+1 + jsr popax + sta ptr1 + stx ptr1+1 ; Get and process fd - jsr popax - jmp getfd ; Returns A, Y and C + jsr popax + jmp getfd ; Returns A, Y and C rwcommon: ; Set fd - sta mliparam + MLI::RW::REF_NUM + sta mliparam + MLI::RW::REF_NUM ; Set buf - lda ptr1 - ldx ptr1+1 - sta mliparam + MLI::RW::DATA_BUFFER - stx mliparam + MLI::RW::DATA_BUFFER+1 + lda ptr1 + ldx ptr1+1 + sta mliparam + MLI::RW::DATA_BUFFER + stx mliparam + MLI::RW::DATA_BUFFER+1 ; Set count - lda ptr2 - ldx ptr2+1 - sta mliparam + MLI::RW::REQUEST_COUNT - stx mliparam + MLI::RW::REQUEST_COUNT+1 + lda ptr2 + ldx ptr2+1 + sta mliparam + MLI::RW::REQUEST_COUNT + stx mliparam + MLI::RW::REQUEST_COUNT+1 ; Call read or write tya - ldx #RW_COUNT - jsr callmli - bcc rwepilog - cmp #$4C ; "End of file encountered" - bne oserr + ldx #RW_COUNT + jsr callmli + bcc rwepilog + cmp #$4C ; "End of file encountered" + bne oserr rwepilog: ; Return success - sta __oserror ; A = 0 - lda mliparam + MLI::RW::TRANS_COUNT - ldx mliparam + MLI::RW::TRANS_COUNT+1 + sta __oserror ; A = 0 + lda mliparam + MLI::RW::TRANS_COUNT + ldx mliparam + MLI::RW::TRANS_COUNT+1 rts ; Set __oserror -oserr: jmp __mappederrno +oserr: jmp __mappederrno diff --git a/libsrc/apple2/ser/a2.ssc.s b/libsrc/apple2/ser/a2.ssc.s index cb9ff2ec1..374505638 100644 --- a/libsrc/apple2/ser/a2.ssc.s +++ b/libsrc/apple2/ser/a2.ssc.s @@ -21,115 +21,115 @@ ; interrupt handling assumes that the 65816 is in 6502-emulation mode. ; - .include "zeropage.inc" - .include "ser-kernel.inc" - .include "ser-error.inc" + .include "zeropage.inc" + .include "ser-kernel.inc" + .include "ser-error.inc" ; ------------------------------------------------------------------------ ; Header. Includes jump table - .segment "JUMPTABLE" + .segment "JUMPTABLE" - ; Driver signature - .byte $73, $65, $72 ; "ser" - .byte SER_API_VERSION ; Serial API version number + ; Driver signature + .byte $73, $65, $72 ; "ser" + .byte SER_API_VERSION ; Serial API version number - ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr OPEN - .addr CLOSE - .addr GET - .addr PUT - .addr STATUS - .addr IOCTL - .addr IRQ + ; Jump table. + .addr INSTALL + .addr UNINSTALL + .addr OPEN + .addr CLOSE + .addr GET + .addr PUT + .addr STATUS + .addr IOCTL + .addr IRQ ;---------------------------------------------------------------------------- ; I/O definitions -ACIA = $C088 -ACIA_DATA = ACIA+0 ; Data register -ACIA_STATUS = ACIA+1 ; Status register -ACIA_CMD = ACIA+2 ; Command register -ACIA_CTRL = ACIA+3 ; Control register +ACIA = $C088 +ACIA_DATA = ACIA+0 ; Data register +ACIA_STATUS = ACIA+1 ; Status register +ACIA_CMD = ACIA+2 ; Command register +ACIA_CTRL = ACIA+3 ; Control register ;---------------------------------------------------------------------------- ; Global variables - .bss + .bss -RecvHead: .res 1 ; Head of receive buffer -RecvTail: .res 1 ; Tail of receive buffer -RecvFreeCnt: .res 1 ; Number of bytes in receive buffer -SendHead: .res 1 ; Head of send buffer -SendTail: .res 1 ; Tail of send buffer -SendFreeCnt: .res 1 ; Number of bytes in send buffer +RecvHead: .res 1 ; Head of receive buffer +RecvTail: .res 1 ; Tail of receive buffer +RecvFreeCnt: .res 1 ; Number of bytes in receive buffer +SendHead: .res 1 ; Head of send buffer +SendTail: .res 1 ; Tail of send buffer +SendFreeCnt: .res 1 ; Number of bytes in send buffer -Stopped: .res 1 ; Flow-stopped flag -RtsOff: .res 1 ; +Stopped: .res 1 ; Flow-stopped flag +RtsOff: .res 1 ; -RecvBuf: .res 256 ; Receive buffers: 256 bytes -SendBuf: .res 256 ; Send buffers: 256 bytes +RecvBuf: .res 256 ; Receive buffers: 256 bytes +SendBuf: .res 256 ; Send buffers: 256 bytes -Index: .res 1 ; I/O register index +Index: .res 1 ; I/O register index - .data + .data -Slot: .byte $02 ; Default to SSC in slot 2 +Slot: .byte $02 ; Default to SSC in slot 2 - .rodata + .rodata - ; Tables used to translate RS232 params into register values -BaudTable: ; bit7 = 1 means setting is invalid - .byte $FF ; SER_BAUD_45_5 - .byte $01 ; SER_BAUD_50 - .byte $02 ; SER_BAUD_75 - .byte $03 ; SER_BAUD_110 - .byte $04 ; SER_BAUD_134_5 - .byte $05 ; SER_BAUD_150 - .byte $06 ; SER_BAUD_300 - .byte $07 ; SER_BAUD_600 - .byte $08 ; SER_BAUD_1200 - .byte $09 ; SER_BAUD_1800 - .byte $0A ; SER_BAUD_2400 - .byte $0B ; SER_BAUD_3600 - .byte $0C ; SER_BAUD_4800 - .byte $0D ; SER_BAUD_7200 - .byte $0E ; SER_BAUD_9600 - .byte $0F ; SER_BAUD_19200 - .byte $FF ; SER_BAUD_38400 - .byte $FF ; SER_BAUD_57600 - .byte $FF ; SER_BAUD_115200 - .byte $FF ; SER_BAUD_230400 + ; Tables used to translate RS232 params into register values +BaudTable: ; bit7 = 1 means setting is invalid + .byte $FF ; SER_BAUD_45_5 + .byte $01 ; SER_BAUD_50 + .byte $02 ; SER_BAUD_75 + .byte $03 ; SER_BAUD_110 + .byte $04 ; SER_BAUD_134_5 + .byte $05 ; SER_BAUD_150 + .byte $06 ; SER_BAUD_300 + .byte $07 ; SER_BAUD_600 + .byte $08 ; SER_BAUD_1200 + .byte $09 ; SER_BAUD_1800 + .byte $0A ; SER_BAUD_2400 + .byte $0B ; SER_BAUD_3600 + .byte $0C ; SER_BAUD_4800 + .byte $0D ; SER_BAUD_7200 + .byte $0E ; SER_BAUD_9600 + .byte $0F ; SER_BAUD_19200 + .byte $FF ; SER_BAUD_38400 + .byte $FF ; SER_BAUD_57600 + .byte $FF ; SER_BAUD_115200 + .byte $FF ; SER_BAUD_230400 BitTable: - .byte $60 ; SER_BITS_5 - .byte $40 ; SER_BITS_6 - .byte $20 ; SER_BITS_7 - .byte $00 ; SER_BITS_8 + .byte $60 ; SER_BITS_5 + .byte $40 ; SER_BITS_6 + .byte $20 ; SER_BITS_7 + .byte $00 ; SER_BITS_8 StopTable: - .byte $00 ; SER_STOP_1 - .byte $80 ; SER_STOP_2 + .byte $00 ; SER_STOP_1 + .byte $80 ; SER_STOP_2 ParityTable: - .byte $00 ; SER_PAR_NONE - .byte $20 ; SER_PAR_ODD - .byte $60 ; SER_PAR_EVEN - .byte $A0 ; SER_PAR_MARK - .byte $E0 ; SER_PAR_SPACE + .byte $00 ; SER_PAR_NONE + .byte $20 ; SER_PAR_ODD + .byte $60 ; SER_PAR_EVEN + .byte $A0 ; SER_PAR_MARK + .byte $E0 ; SER_PAR_SPACE IdOfsTable: - .byte $05 ; Pascal 1.0 ID byte - .byte $07 ; Pascal 1.0 ID byte - .byte $0B ; Pascal 1.1 generic signature byte - .byte $0C ; Device signature byte + .byte $05 ; Pascal 1.0 ID byte + .byte $07 ; Pascal 1.0 ID byte + .byte $0B ; Pascal 1.1 generic signature byte + .byte $0C ; Device signature byte IdValTable: - .byte $38 ; Fixed - .byte $18 ; Fixed - .byte $01 ; Fixed - .byte $31 ; Serial or parallel I/O card type 1 + .byte $38 ; Fixed + .byte $18 ; Fixed + .byte $01 ; Fixed + .byte $31 ; Serial or parallel I/O card type 1 -IdTableLen = * - IdValTable +IdTableLen = * - IdValTable - .code + .code ;---------------------------------------------------------------------------- ; INSTALL: Is called after the driver is loaded into memory. If possible, @@ -149,119 +149,119 @@ IdTableLen = * - IdValTable INSTALL: UNINSTALL: CLOSE: - ldx Index ; Check for open port - beq :+ + ldx Index ; Check for open port + beq :+ - ; Deactivate DTR and disable 6551 interrupts - lda #%00001010 - sta ACIA_CMD,x + ; Deactivate DTR and disable 6551 interrupts + lda #%00001010 + sta ACIA_CMD,x - ; Done, return an error code -: lda #$C000 - ora Slot - sta ptr2+1 - - ; Check Pascal 1.1 Firmware Protocol ID bytes -: ldy IdOfsTable,x - lda IdValTable,x - cmp (ptr2),y - bne NoDevice - inx - cpx #IdTableLen - bcc :- - - ; Convert slot to I/O register index - lda Slot - asl - asl - asl - asl - tax +OPEN: + ldx #<$C000 + stx ptr2 + lda #>$C000 + ora Slot + sta ptr2+1 + + ; Check Pascal 1.1 Firmware Protocol ID bytes +: ldy IdOfsTable,x + lda IdValTable,x + cmp (ptr2),y + bne NoDevice + inx + cpx #IdTableLen + bcc :- + + ; Convert slot to I/O register index + lda Slot + asl + asl + asl + asl + tax - ; Check if the handshake setting is valid - ldy #SER_PARAMS::HANDSHAKE ; Handshake - lda (ptr1),y - cmp #SER_HS_HW ; This is all we support - bne InvParam + ; Check if the handshake setting is valid + ldy #SER_PARAMS::HANDSHAKE ; Handshake + lda (ptr1),y + cmp #SER_HS_HW ; This is all we support + bne InvParam - ; Initialize buffers - ldy #$00 - sty Stopped - sty RecvHead - sty RecvTail - sty SendHead - sty SendTail - dey ; Y = 255 - sty RecvFreeCnt - sty SendFreeCnt + ; Initialize buffers + ldy #$00 + sty Stopped + sty RecvHead + sty RecvTail + sty SendHead + sty SendTail + dey ; Y = 255 + sty RecvFreeCnt + sty SendFreeCnt - ; Set the value for the control register, which contains stop bits, - ; word length and the baud rate. - ldy #SER_PARAMS::BAUDRATE - lda (ptr1),y ; Baudrate index - tay - lda BaudTable,y ; Get 6551 value - bmi InvBaud ; Branch if rate not supported - sta tmp1 + ; Set the value for the control register, which contains stop bits, + ; word length and the baud rate. + ldy #SER_PARAMS::BAUDRATE + lda (ptr1),y ; Baudrate index + tay + lda BaudTable,y ; Get 6551 value + bmi InvBaud ; Branch if rate not supported + sta tmp1 - ldy #SER_PARAMS::DATABITS ; Databits - lda (ptr1),y - tay - lda BitTable,y - ora tmp1 - sta tmp1 + ldy #SER_PARAMS::DATABITS ; Databits + lda (ptr1),y + tay + lda BitTable,y + ora tmp1 + sta tmp1 - ldy #SER_PARAMS::STOPBITS ; Stopbits - lda (ptr1),y - tay - lda StopTable,y - ora tmp1 - ora #%00010000 ; Receiver clock source = baudrate - sta ACIA_CTRL,x + ldy #SER_PARAMS::STOPBITS ; Stopbits + lda (ptr1),y + tay + lda StopTable,y + ora tmp1 + ora #%00010000 ; Receiver clock source = baudrate + sta ACIA_CTRL,x - ; Set the value for the command register. We remember the base value - ; in RtsOff, since we will have to manipulate ACIA_CMD often. - ldy #SER_PARAMS::PARITY ; Parity - lda (ptr1),y - tay - lda ParityTable,y - ora #%00000001 ; DTR active - sta RtsOff - ora #%00001000 ; Enable receive interrupts - sta ACIA_CMD,x + ; Set the value for the command register. We remember the base value + ; in RtsOff, since we will have to manipulate ACIA_CMD often. + ldy #SER_PARAMS::PARITY ; Parity + lda (ptr1),y + tay + lda ParityTable,y + ora #%00000001 ; DTR active + sta RtsOff + ora #%00001000 ; Enable receive interrupts + sta ACIA_CMD,x - ; Done - stx Index ; Mark port as open - lda #SER_ERR_NO_DEVICE - rts + ; Device (hardware) not found +NoDevice:lda #SER_ERR_NO_DEVICE + rts - ; Invalid parameter -InvParam:lda #SER_ERR_INIT_FAILED - rts + ; Invalid parameter +InvParam:lda #SER_ERR_INIT_FAILED + rts - ; Baud rate not available -InvBaud:lda #SER_ERR_BAUD_UNAVAIL - rts + ; Baud rate not available +InvBaud:lda #SER_ERR_BAUD_UNAVAIL + rts ;---------------------------------------------------------------------------- ; GET: Will fetch a character from the receive buffer and store it into the @@ -269,86 +269,86 @@ InvBaud:lda #SER_ERR_NO_DATA - rts + ; Check for buffer empty +: lda RecvFreeCnt ; (25) + cmp #$FF + bne :+ + lda #SER_ERR_NO_DATA + rts - ; Check for flow stopped & enough free: release flow control -: ldy Stopped ; (34) - beq :+ - cmp #63 - bcc :+ - lda #$00 - sta Stopped - lda RtsOff - ora #%00001000 - sta ACIA_CMD,x + ; Check for flow stopped & enough free: release flow control +: ldy Stopped ; (34) + beq :+ + cmp #63 + bcc :+ + lda #$00 + sta Stopped + lda RtsOff + ora #%00001000 + sta ACIA_CMD,x - ; Get byte from buffer -: ldy RecvHead ; (41) - lda RecvBuf,y - inc RecvHead - inc RecvFreeCnt - ldx #$00 ; (59) - sta (ptr1,x) - txa ; Return code = 0 - rts + ; Get byte from buffer +: ldy RecvHead ; (41) + lda RecvBuf,y + inc RecvHead + inc RecvFreeCnt + ldx #$00 ; (59) + sta (ptr1,x) + txa ; Return code = 0 + rts ;---------------------------------------------------------------------------- ; PUT: Output character in A. ; Must return an SER_ERR_xx code in a/x. PUT: - ldx Index + ldx Index - ; Try to send - ldy SendFreeCnt - iny ; Y = $FF? - beq :+ - pha - lda #$00 ; TryHard = false - jsr TryToSend - pla + ; Try to send + ldy SendFreeCnt + iny ; Y = $FF? + beq :+ + pha + lda #$00 ; TryHard = false + jsr TryToSend + pla - ; Put byte into send buffer & send -: ldy SendFreeCnt - bne :+ - lda #SER_ERR_OVERFLOW - rts + ; Put byte into send buffer & send +: ldy SendFreeCnt + bne :+ + lda #SER_ERR_OVERFLOW + rts -: ldy SendTail - sta SendBuf,y - inc SendTail - dec SendFreeCnt - lda #$FF ; TryHard = true - jsr TryToSend - lda #SER_ERR_INV_IOCTL - rts +: lda #SER_ERR_INV_IOCTL + rts ;---------------------------------------------------------------------------- ; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All @@ -381,55 +381,55 @@ IOCTL: ; was handled, otherwise with carry clear. IRQ: - ldx Index ; Check for open port - beq Done - lda ACIA_STATUS,x ; Check ACIA status for receive interrupt - and #$08 - beq Done ; Jump if no ACIA interrupt - lda ACIA_DATA,x ; Get byte from ACIA - ldy RecvFreeCnt ; Check if we have free space left - beq Flow ; Jump if no space in receive buffer - ldy RecvTail ; Load buffer pointer - sta RecvBuf,y ; Store received byte in buffer - inc RecvTail ; Increment buffer pointer - dec RecvFreeCnt ; Decrement free space counter - ldy RecvFreeCnt ; Check for buffer space low - cpy #33 - bcc Flow ; Assert flow control if buffer space low - rts ; Interrupt handled (carry already set) + ldx Index ; Check for open port + beq Done + lda ACIA_STATUS,x ; Check ACIA status for receive interrupt + and #$08 + beq Done ; Jump if no ACIA interrupt + lda ACIA_DATA,x ; Get byte from ACIA + ldy RecvFreeCnt ; Check if we have free space left + beq Flow ; Jump if no space in receive buffer + ldy RecvTail ; Load buffer pointer + sta RecvBuf,y ; Store received byte in buffer + inc RecvTail ; Increment buffer pointer + dec RecvFreeCnt ; Decrement free space counter + ldy RecvFreeCnt ; Check for buffer space low + cpy #33 + bcc Flow ; Assert flow control if buffer space low + rts ; Interrupt handled (carry already set) - ; Assert flow control if buffer space too low -Flow: lda RtsOff - sta ACIA_CMD,x - sta Stopped - sec ; Interrupt handled -Done: rts + ; Assert flow control if buffer space too low +Flow: lda RtsOff + sta ACIA_CMD,x + sta Stopped + sec ; Interrupt handled +Done: rts ;---------------------------------------------------------------------------- ; Try to send a byte. Internal routine. A = TryHard TryToSend: - sta tmp1 ; Remember tryHard flag -Again: lda SendFreeCnt - cmp #$FF - beq Quit ; Bail out + sta tmp1 ; Remember tryHard flag +Again: lda SendFreeCnt + cmp #$FF + beq Quit ; Bail out - ; Check for flow stopped - lda Stopped - bne Quit ; Bail out + ; Check for flow stopped + lda Stopped + bne Quit ; Bail out - ; Check that ACIA is ready to send - lda ACIA_STATUS,x - and #$10 - bne Send - bit tmp1 ; Keep trying if must try hard - bmi Again -Quit: rts + ; Check that ACIA is ready to send + lda ACIA_STATUS,x + and #$10 + bne Send + bit tmp1 ; Keep trying if must try hard + bmi Again +Quit: rts - ; Send byte and try again -Send: ldy SendHead - lda SendBuf,y - sta ACIA_DATA,x - inc SendHead - inc SendFreeCnt - jmp Again + ; Send byte and try again +Send: ldy SendHead + lda SendBuf,y + sta ACIA_DATA,x + inc SendHead + inc SendFreeCnt + jmp Again diff --git a/libsrc/apple2/syschdir.s b/libsrc/apple2/syschdir.s index 7eb67e1ab..8afc3af0b 100644 --- a/libsrc/apple2/syschdir.s +++ b/libsrc/apple2/syschdir.s @@ -5,33 +5,33 @@ ; .export __syschdir - .import pushname, popname - .import initcwd + .import pushname, popname + .import initcwd - .include "zeropage.inc" - .include "mli.inc" + .include "zeropage.inc" + .include "mli.inc" __syschdir: ; Push name - jsr pushname - bne oserr + jsr pushname + bne oserr ; Set pushed name - lda sp - ldx sp+1 - sta mliparam + MLI::PREFIX::PATHNAME - stx mliparam + MLI::PREFIX::PATHNAME+1 + lda sp + ldx sp+1 + sta mliparam + MLI::PREFIX::PATHNAME + stx mliparam + MLI::PREFIX::PATHNAME+1 ; Change directory - lda #SET_PREFIX_CALL - ldx #PREFIX_COUNT - jsr callmli - bcs cleanup + lda #SET_PREFIX_CALL + ldx #PREFIX_COUNT + jsr callmli + bcs cleanup - ; Update current working directory - jsr initcwd ; Returns with A = 0 + ; Update current working directory + jsr initcwd ; Returns with A = 0 ; Cleanup name -cleanup:jsr popname ; Preserves A +cleanup:jsr popname ; Preserves A -oserr: rts +oserr: rts diff --git a/libsrc/apple2/sysmkdir.s b/libsrc/apple2/sysmkdir.s index 1281fc5ae..7759da260 100644 --- a/libsrc/apple2/sysmkdir.s +++ b/libsrc/apple2/sysmkdir.s @@ -5,51 +5,51 @@ ; .export __sysmkdir - .import pushname, popname - .import addysp, popax + .import pushname, popname + .import addysp, popax - .include "zeropage.inc" - .include "mli.inc" + .include "zeropage.inc" + .include "mli.inc" __sysmkdir: ; Throw away all parameters except the name dey dey - jsr addysp + jsr addysp ; Get and push name - jsr popax - jsr pushname - bne oserr + jsr popax + jsr pushname + bne oserr ; Set pushed name - lda sp - ldx sp+1 - sta mliparam + MLI::CREATE::PATHNAME - stx mliparam + MLI::CREATE::PATHNAME+1 + lda sp + ldx sp+1 + sta mliparam + MLI::CREATE::PATHNAME + stx mliparam + MLI::CREATE::PATHNAME+1 ; Set all other parameters from template - ldx #(MLI::CREATE::CREATE_TIME+1) - (MLI::CREATE::PATHNAME+1) - 1 -: lda CREATE,x - sta mliparam + MLI::CREATE::ACCESS,x + ldx #(MLI::CREATE::CREATE_TIME+1) - (MLI::CREATE::PATHNAME+1) - 1 +: lda CREATE,x + sta mliparam + MLI::CREATE::ACCESS,x dex - bpl :- + bpl :- ; Make directory - lda #CREATE_CALL - ldx #CREATE_COUNT - jsr callmli + lda #CREATE_CALL + ldx #CREATE_COUNT + jsr callmli ; Cleanup name - jsr popname ; Preserves A + jsr popname ; Preserves A -oserr: rts +oserr: rts .rodata -CREATE: .byte %11000011 ; ACCESS: Standard full access - .byte $0F ; FILE_TYPE: Directory file - .word $0000 ; AUX_TYPE: N/A - .byte $0D ; STORAGE_TYPE: Linked directory file - .word $0000 ; CREATE_DATE: Current date - .word $0000 ; CREATE_TIME: Current time +CREATE: .byte %11000011 ; ACCESS: Standard full access + .byte $0F ; FILE_TYPE: Directory file + .word $0000 ; AUX_TYPE: N/A + .byte $0D ; STORAGE_TYPE: Linked directory file + .word $0000 ; CREATE_DATE: Current date + .word $0000 ; CREATE_TIME: Current time diff --git a/libsrc/apple2/sysremove.s b/libsrc/apple2/sysremove.s index 7483b9320..08c4dff68 100644 --- a/libsrc/apple2/sysremove.s +++ b/libsrc/apple2/sysremove.s @@ -5,28 +5,28 @@ ; .export __sysremove - .import pushname, popname + .import pushname, popname - .include "zeropage.inc" - .include "mli.inc" + .include "zeropage.inc" + .include "mli.inc" __sysremove: ; Push name - jsr pushname - bne oserr + jsr pushname + bne oserr ; Set pushed name - lda sp - ldx sp+1 - sta mliparam + MLI::DESTROY::PATHNAME - stx mliparam + MLI::DESTROY::PATHNAME+1 + lda sp + ldx sp+1 + sta mliparam + MLI::DESTROY::PATHNAME + stx mliparam + MLI::DESTROY::PATHNAME+1 ; Remove file - lda #DESTROY_CALL - ldx #DESTROY_COUNT - jsr callmli + lda #DESTROY_CALL + ldx #DESTROY_COUNT + jsr callmli ; Cleanup name - jsr popname ; Preserves A + jsr popname ; Preserves A -oserr: rts +oserr: rts diff --git a/libsrc/apple2/sysrename.s b/libsrc/apple2/sysrename.s index af57e1405..0fe8dd7b1 100644 --- a/libsrc/apple2/sysrename.s +++ b/libsrc/apple2/sysrename.s @@ -5,55 +5,55 @@ ; .export __sysrename - .import pushname, popname - .import popax + .import pushname, popname + .import popax - .include "zeropage.inc" - .include "mli.inc" + .include "zeropage.inc" + .include "mli.inc" __sysrename: - ; Save newname - sta ptr2 - stx ptr2+1 + ; Save newname + sta ptr2 + stx ptr2+1 ; Get and push oldname - jsr popax - jsr pushname - bne oserr1 + jsr popax + jsr pushname + bne oserr1 - ; Save pushed oldname - lda sp - ldx sp+1 - sta ptr3 - stx ptr3+1 + ; Save pushed oldname + lda sp + ldx sp+1 + sta ptr3 + stx ptr3+1 ; Restore and push newname - lda ptr2 - ldx ptr2+1 - jsr pushname - bne oserr2 + lda ptr2 + ldx ptr2+1 + jsr pushname + bne oserr2 ; Restore and set pushed oldname - lda ptr3 - ldx ptr3+1 - sta mliparam + MLI::RENAME::PATHNAME - stx mliparam + MLI::RENAME::PATHNAME+1 + lda ptr3 + ldx ptr3+1 + sta mliparam + MLI::RENAME::PATHNAME + stx mliparam + MLI::RENAME::PATHNAME+1 ; Set pushed newname - lda sp - ldx sp+1 - sta mliparam + MLI::RENAME::NEW_PATHNAME - stx mliparam + MLI::RENAME::NEW_PATHNAME+1 + lda sp + ldx sp+1 + sta mliparam + MLI::RENAME::NEW_PATHNAME + stx mliparam + MLI::RENAME::NEW_PATHNAME+1 ; Rename file - lda #RENAME_CALL - ldx #RENAME_COUNT - jsr callmli + lda #RENAME_CALL + ldx #RENAME_COUNT + jsr callmli ; Cleanup newname - jsr popname ; Preserves A + jsr popname ; Preserves A ; Cleanup oldname -oserr2: jmp popname ; Preserves A +oserr2: jmp popname ; Preserves A -oserr1: rts +oserr1: rts diff --git a/libsrc/apple2/sysrmdir.s b/libsrc/apple2/sysrmdir.s index 668be1208..11ac1f7e7 100644 --- a/libsrc/apple2/sysrmdir.s +++ b/libsrc/apple2/sysrmdir.s @@ -5,6 +5,6 @@ ; .export __sysrmdir - .import __sysremove + .import __sysremove __sysrmdir := __sysremove diff --git a/libsrc/apple2/systime.s b/libsrc/apple2/systime.s index 0a5f530ba..98d39a278 100644 --- a/libsrc/apple2/systime.s +++ b/libsrc/apple2/systime.s @@ -10,54 +10,54 @@ ; .include "time.inc" - .include "zeropage.inc" - .include "mli.inc" + .include "zeropage.inc" + .include "mli.inc" __systime: - ; Update time - lda #GET_TIME_CALL - ldx #GET_TIME_COUNT - jsr callmli - bcs err + ; Update time + lda #GET_TIME_CALL + ldx #GET_TIME_COUNT + jsr callmli + bcs err - lda DATELO+1 - lsr - php ; Save month msb - cmp #70 ; Year < 70? - bcs :+ ; No, leave alone - adc #100 ; Move 19xx to 20xx -: sta TM + tm::tm_year - lda DATELO - tax ; Save day - plp ; Restore month msb - ror - lsr - lsr - lsr - lsr - beq err ; [1..12] allows for validity check - tay - dey ; Move [1..12] to [0..11] - sty TM + tm::tm_mon - txa ; Restore day - and #%00011111 - sta TM + tm::tm_mday + lda DATELO+1 + lsr + php ; Save month msb + cmp #70 ; Year < 70? + bcs :+ ; No, leave alone + adc #100 ; Move 19xx to 20xx +: sta TM + tm::tm_year + lda DATELO + tax ; Save day + plp ; Restore month msb + ror + lsr + lsr + lsr + lsr + beq err ; [1..12] allows for validity check + tay + dey ; Move [1..12] to [0..11] + sty TM + tm::tm_mon + txa ; Restore day + and #%00011111 + sta TM + tm::tm_mday - lda TIMELO+1 - sta TM + tm::tm_hour - lda TIMELO - sta TM + tm::tm_min + lda TIMELO+1 + sta TM + tm::tm_hour + lda TIMELO + sta TM + tm::tm_min - lda #TM - jmp _mktime + lda #TM + jmp _mktime -err: lda #$FF - tax - sta sreg - sta sreg+1 - rts ; Return -1 +err: lda #$FF + tax + sta sreg + sta sreg+1 + rts ; Return -1 - .bss + .bss -TM: .tag tm +TM: .tag tm diff --git a/libsrc/apple2/targetutil/loader.cfg b/libsrc/apple2/targetutil/loader.cfg index aa7a8c437..ead1dca39 100644 --- a/libsrc/apple2/targetutil/loader.cfg +++ b/libsrc/apple2/targetutil/loader.cfg @@ -1,5 +1,5 @@ ################################################################################# -# # +# # # LOADER.SYSTEM - an Apple][ ProDOS 8 loader for cc65 programs (Oliver Schmidt) # # # ################################################################################# diff --git a/libsrc/apple2/targetutil/loader.s b/libsrc/apple2/targetutil/loader.s index 71d79140e..0173f6105 100644 --- a/libsrc/apple2/targetutil/loader.s +++ b/libsrc/apple2/targetutil/loader.s @@ -4,231 +4,231 @@ ; ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -A1L := $3C -A1H := $3D -STACK := $0100 -BUF := $0200 -PATHNAME := $0280 -MLI := $BF00 -VERSION := $FBB3 -RDKEY := $FD0C -PRBYTE := $FDDA -COUT := $FDED +A1L := $3C +A1H := $3D +STACK := $0100 +BUF := $0200 +PATHNAME := $0280 +MLI := $BF00 +VERSION := $FBB3 +RDKEY := $FD0C +PRBYTE := $FDDA +COUT := $FDED -QUIT_CALL = $65 +QUIT_CALL = $65 GET_FILE_INFO_CALL = $C4 -OPEN_CALL = $C8 -READ_CALL = $CA -CLOSE_CALL = $CC +OPEN_CALL = $C8 +READ_CALL = $CA +CLOSE_CALL = $CC FILE_NOT_FOUND_ERR = $46 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - .import __CODE_0300_SIZE__, __DATA_0300_SIZE__ - .import __CODE_0300_LOAD__, __CODE_0300_RUN__ + .import __CODE_0300_SIZE__, __DATA_0300_SIZE__ + .import __CODE_0300_LOAD__, __CODE_0300_RUN__ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -.segment "DATA_2000" +.segment "DATA_2000" GET_FILE_INFO_PARAM: - .byte $0A ;PARAM_COUNT - .addr PATHNAME ;PATHNAME - .byte $00 ;ACCESS - .byte $00 ;FILE_TYPE -FILE_INFO_ADDR: .word $0000 ;AUX_TYPE - .byte $00 ;STORAGE_TYPE - .word $0000 ;BLOCKS_USED - .word $0000 ;MOD_DATE - .word $0000 ;MOD_TIME - .word $0000 ;CREATE_DATE - .word $0000 ;CREATE_TIME + .byte $0A ;PARAM_COUNT + .addr PATHNAME ;PATHNAME + .byte $00 ;ACCESS + .byte $00 ;FILE_TYPE +FILE_INFO_ADDR: .word $0000 ;AUX_TYPE + .byte $00 ;STORAGE_TYPE + .word $0000 ;BLOCKS_USED + .word $0000 ;MOD_DATE + .word $0000 ;MOD_TIME + .word $0000 ;CREATE_DATE + .word $0000 ;CREATE_TIME OPEN_PARAM: - .byte $03 ;PARAM_COUNT - .addr PATHNAME ;PATHNAME - .addr MLI - 1024 ;IO_BUFFER -OPEN_REF: .byte $00 ;REF_NUM + .byte $03 ;PARAM_COUNT + .addr PATHNAME ;PATHNAME + .addr MLI - 1024 ;IO_BUFFER +OPEN_REF: .byte $00 ;REF_NUM LOADING: - .byte $0D - .asciiz "Loading " + .byte $0D + .asciiz "Loading " ELLIPSES: - .byte " ...", $0D, $0D, $00 + .byte " ...", $0D, $0D, $00 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -.segment "DATA_0300" +.segment "DATA_0300" READ_PARAM: - .byte $04 ;PARAM_COUNT -READ_REF: .byte $00 ;REF_NUM -READ_ADDR: .addr $0000 ;DATA_BUFFER - .word $FFFF ;REQUEST_COUNT - .word $0000 ;TRANS_COUNT + .byte $04 ;PARAM_COUNT +READ_REF: .byte $00 ;REF_NUM +READ_ADDR: .addr $0000 ;DATA_BUFFER + .word $FFFF ;REQUEST_COUNT + .word $0000 ;TRANS_COUNT CLOSE_PARAM: - .byte $01 ;PARAM_COUNT -CLOSE_REF: .byte $00 ;REF_NUM + .byte $01 ;PARAM_COUNT +CLOSE_REF: .byte $00 ;REF_NUM QUIT_PARAM: - .byte $04 ;PARAM_COUNT - .byte $00 ;QUIT_TYPE - .word $0000 ;RESERVED - .byte $00 ;RESERVED - .word $0000 ;RESERVED + .byte $04 ;PARAM_COUNT + .byte $00 ;QUIT_TYPE + .word $0000 ;RESERVED + .byte $00 ;RESERVED + .word $0000 ;RESERVED FILE_NOT_FOUND: - .asciiz "... File Not Found" - + .asciiz "... File Not Found" + ERROR_NUMBER: - .asciiz "... Error $" + .asciiz "... Error $" PRESS_ANY_KEY: - .asciiz " - Press Any Key " + .asciiz " - Press Any Key " ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -.segment "CODE_2000" +.segment "CODE_2000" - jmp :+ - .byte $EE - .byte $EE - .byte 65 -STARTUP:.res 65 + jmp :+ + .byte $EE + .byte $EE + .byte 65 +STARTUP:.res 65 - ; Reset stack -: ldx #$FF - txs + ; Reset stack +: ldx #$FF + txs - ; Relocate CODE_0300 and DATA_0300 - ldx #<(__CODE_0300_SIZE__ + __DATA_0300_SIZE__) -: lda __CODE_0300_LOAD__ - 1,x - sta __CODE_0300_RUN__ - 1,x - dex - bne :- + ; Relocate CODE_0300 and DATA_0300 + ldx #<(__CODE_0300_SIZE__ + __DATA_0300_SIZE__) +: lda __CODE_0300_LOAD__ - 1,x + sta __CODE_0300_RUN__ - 1,x + dex + bne :- - ; Remove ".SYSTEM" from pathname - lda PATHNAME - sec - sbc #.strlen(".SYSTEM") - sta PATHNAME + ; Remove ".SYSTEM" from pathname + lda PATHNAME + sec + sbc #.strlen(".SYSTEM") + sta PATHNAME - ; Add trailing '\0' to pathname - tax - lda #$00 - sta PATHNAME + 1,x + ; Add trailing '\0' to pathname + tax + lda #$00 + sta PATHNAME + 1,x - ; Copy ProDOS startup filename and trailing '\0' to stack - ldx STARTUP - lda #$00 - beq :++ ; bra -: lda STARTUP + 1,x -: sta STACK,x - dex - bpl :-- + ; Copy ProDOS startup filename and trailing '\0' to stack + ldx STARTUP + lda #$00 + beq :++ ; bra +: lda STARTUP + 1,x +: sta STACK,x + dex + bpl :-- - ; Provide some user feedback - lda #LOADING - jsr PRINT - lda #<(PATHNAME + 1) - ldx #>(PATHNAME + 1) - jsr PRINT - lda #ELLIPSES - jsr PRINT + ; Provide some user feedback + lda #LOADING + jsr PRINT + lda #<(PATHNAME + 1) + ldx #>(PATHNAME + 1) + jsr PRINT + lda #ELLIPSES + jsr PRINT - jsr MLI - .byte GET_FILE_INFO_CALL - .word GET_FILE_INFO_PARAM - bcc :+ - jmp ERROR + jsr MLI + .byte GET_FILE_INFO_CALL + .word GET_FILE_INFO_PARAM + bcc :+ + jmp ERROR -: jsr MLI - .byte OPEN_CALL - .word OPEN_PARAM - bcc :+ - jmp ERROR +: jsr MLI + .byte OPEN_CALL + .word OPEN_PARAM + bcc :+ + jmp ERROR - ; Copy file reference number -: lda OPEN_REF - sta READ_REF - sta CLOSE_REF + ; Copy file reference number +: lda OPEN_REF + sta READ_REF + sta CLOSE_REF - ; Get load address from aux-type - lda FILE_INFO_ADDR - ldx FILE_INFO_ADDR + 1 - sta READ_ADDR - stx READ_ADDR + 1 + ; Get load address from aux-type + lda FILE_INFO_ADDR + ldx FILE_INFO_ADDR + 1 + sta READ_ADDR + stx READ_ADDR + 1 - ; It's high time to leave this place - jmp __CODE_0300_RUN__ + ; It's high time to leave this place + jmp __CODE_0300_RUN__ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -.segment "CODE_0300" +.segment "CODE_0300" - jsr MLI - .byte READ_CALL - .word READ_PARAM - bcs ERROR + jsr MLI + .byte READ_CALL + .word READ_PARAM + bcs ERROR - jsr MLI - .byte CLOSE_CALL - .word CLOSE_PARAM - bcs ERROR + jsr MLI + .byte CLOSE_CALL + .word CLOSE_PARAM + bcs ERROR - ; Copy REM token and startup filename to BASIC input buffer - ldx #$00 - lda #$B2 - bne :++ ; bra -: inx - lda a:STACK - 1,x -: sta BUF,x - bne :-- - - ; Go for it ... - jmp (READ_ADDR) + ; Copy REM token and startup filename to BASIC input buffer + ldx #$00 + lda #$B2 + bne :++ ; bra +: inx + lda a:STACK - 1,x +: sta BUF,x + bne :-- + + ; Go for it ... + jmp (READ_ADDR) PRINT: - sta A1L - stx A1H - ldx VERSION - ldy #$00 -: lda (A1L),y - beq :++ - cpx #$06 ; //e ? - beq :+ - cmp #$60 ; lowercase ? - bcc :+ - and #$5F ; -> uppercase -: ora #$80 - jsr COUT - iny - bne :-- ; bra -: rts + sta A1L + stx A1H + ldx VERSION + ldy #$00 +: lda (A1L),y + beq :++ + cpx #$06 ; //e ? + beq :+ + cmp #$60 ; lowercase ? + bcc :+ + and #$5F ; -> uppercase +: ora #$80 + jsr COUT + iny + bne :-- ; bra +: rts ERROR: - cmp #FILE_NOT_FOUND_ERR - bne :+ - lda #FILE_NOT_FOUND - jsr PRINT - beq :++ ; bra -: pha - lda #ERROR_NUMBER - jsr PRINT - pla - jsr PRBYTE -: lda #PRESS_ANY_KEY - jsr PRINT - jsr RDKEY - jsr MLI - .byte QUIT_CALL - .word QUIT_PARAM + cmp #FILE_NOT_FOUND_ERR + bne :+ + lda #FILE_NOT_FOUND + jsr PRINT + beq :++ ; bra +: pha + lda #ERROR_NUMBER + jsr PRINT + pla + jsr PRBYTE +: lda #PRESS_ANY_KEY + jsr PRINT + jsr RDKEY + jsr MLI + .byte QUIT_CALL + .word QUIT_PARAM ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/libsrc/apple2/textframe.s b/libsrc/apple2/textframe.s index e57337e92..d5e9b80d7 100644 --- a/libsrc/apple2/textframe.s +++ b/libsrc/apple2/textframe.s @@ -9,12 +9,12 @@ ; .ifdef __APPLE2ENH__ - .export _textframexy, _textframe - .import popa, pusha, _gotoxy - .import chlinedirect, cvlinedirect + .export _textframexy, _textframe + .import popa, pusha, _gotoxy + .import chlinedirect, cvlinedirect - .include "zeropage.inc" - .include "apple2.inc" + .include "zeropage.inc" + .include "apple2.inc" WIDTH = tmp2 HEIGHT = tmp3 @@ -23,60 +23,60 @@ YORIGIN = ptr1 _textframexy: sec - bra :+ + bra :+ _textframe: clc -: ldx INVFLG - phx ; Save character display mode - ldx #$FF - stx INVFLG ; Set normal character display mode - pha ; Save index - jsr popa ; Get height - sta HEIGHT - jsr popa ; Get width - sta WIDTH - lda CH - ldx CV - bcc noxy - jsr popa ; Get y +: ldx INVFLG + phx ; Save character display mode + ldx #$FF + stx INVFLG ; Set normal character display mode + pha ; Save index + jsr popa ; Get height + sta HEIGHT + jsr popa ; Get width + sta WIDTH + lda CH + ldx CV + bcc noxy + jsr popa ; Get y tax - jsr popa ; Get x -noxy: sta XORIGIN - stx YORIGIN - plx ; Restore index -loop: lda XOFFS,x + jsr popa ; Get x +noxy: sta XORIGIN + stx YORIGIN + plx ; Restore index +loop: lda XOFFS,x clc - bpl :+ ; Relative to left edge? - adc WIDTH -: adc XORIGIN - jsr pusha - lda YOFFS,x + bpl :+ ; Relative to left edge? + adc WIDTH +: adc XORIGIN + jsr pusha + lda YOFFS,x clc - bpl :+ ; Relative to top? - adc HEIGHT -: adc YORIGIN - jsr _gotoxy ; Call this one, will pop params + bpl :+ ; Relative to top? + adc HEIGHT +: adc YORIGIN + jsr _gotoxy ; Call this one, will pop params txa tay - lsr ; Get bit 0 (vline) into carry - lda LENGTH,x - phx ; Save index - ldx CHAR,y - bcc hline + lsr ; Get bit 0 (vline) into carry + lda LENGTH,x + phx ; Save index + ldx CHAR,y + bcc hline clc - adc HEIGHT - jsr cvlinedirect - bra next -hline: adc WIDTH - jsr chlinedirect -next: plx ; Restore index + adc HEIGHT + jsr cvlinedirect + bra next +hline: adc WIDTH + jsr chlinedirect +next: plx ; Restore index inx txa - and #$03 ; Mask style - bne loop + and #$03 ; Mask style + bne loop pla - sta INVFLG ; Restore character display mode + sta INVFLG ; Restore character display mode rts .rodata @@ -88,21 +88,21 @@ next: plx ; Restore index ; x offset for the line starting point ; - a positive value means relative to the frame left edge ; - a negative value menas relative to the frame right edge -XOFFS: .byte 0, 0, 0, <-2, 1, 0, 1, <-2 +XOFFS: .byte 0, 0, 0, <-2, 1, 0, 1, <-2 ; y offset for the line starting point ; - a positive value means relative to the frame top ; - a negative value menas relative to the frame bottom -YOFFS: .byte 0, 1, <-2, 1, 0, 0, <-2, 0 +YOFFS: .byte 0, 1, <-2, 1, 0, 0, <-2, 0 ; length of the line relative to the frame size ; - a negative value for hlines means shorter than the width ; - a negative value for vlines menas shorter than the height -LENGTH: .byte 0, <-2, 0, <-2, <-2, 0, <-2, 0 +LENGTH: .byte 0, <-2, 0, <-2, <-2, 0, <-2, 0 ; character to use for drawing the line ; - hibit set means normal printable character ; - hibit clear means MouseText character -CHAR: .byte '_'|$80, '_', 'L', 'Z', 'L', 'Z', '_'|$80, '_' +CHAR: .byte '_'|$80, '_', 'L', 'Z', 'L', 'Z', '_'|$80, '_' .endif ; __APPLE2ENH__ diff --git a/libsrc/apple2/tgi/a2.hi.s b/libsrc/apple2/tgi/a2.hi.s index ce2814a1c..145b78e4a 100644 --- a/libsrc/apple2/tgi/a2.hi.s +++ b/libsrc/apple2/tgi/a2.hi.s @@ -5,55 +5,55 @@ ; Oliver Schmidt ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" - .include "apple2.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" + .include "apple2.inc" ; ------------------------------------------------------------------------ ; Zero page stuff -HBASL := $26 -HMASK := $30 -PAGE := $E6 -SCALE := $E7 -ROT := $F9 +HBASL := $26 +HMASK := $30 +PAGE := $E6 +SCALE := $E7 +ROT := $F9 ; Graphics entry points, by cbmnut (applenut??) cbmnut@hushmail.com -TEXT := $F399 ; Return to text screen -HGR2 := $F3D8 ; Initialize and clear hi-res page 2. -HGR := $F3E2 ; Initialize and clear hi-res page 1. -HCLR := $F3F2 ; Clear the current hi-res screen to black. -BKGND := $F3F6 ; Clear the current hi-res screen to the +TEXT := $F399 ; Return to text screen +HGR2 := $F3D8 ; Initialize and clear hi-res page 2. +HGR := $F3E2 ; Initialize and clear hi-res page 1. +HCLR := $F3F2 ; Clear the current hi-res screen to black. +BKGND := $F3F6 ; Clear the current hi-res screen to the ; last plotted color (from ($1C). -HPOSN := $F411 ; Positions the hi-res cursor without +HPOSN := $F411 ; Positions the hi-res cursor without ; plotting a point. ; Enter with (A) = Y-coordinate, and ; (Y,X) = X-coordinate. -HPLOT := $F457 ; Calls HPOSN and tries to plot a dot at +HPLOT := $F457 ; Calls HPOSN and tries to plot a dot at ; the cursor's position. If you are ; trying to plot a non-white color at ; a complementary color position, no ; dot will be plotted. -HLIN := $F53A ; Draws a line from the last plotted +HLIN := $F53A ; Draws a line from the last plotted ; point or line destination to: ; (X,A) = X-coordinate, and ; (Y) = Y-coordinate. -HFIND := $F5CB ; Converts the hi-res coursor's position +HFIND := $F5CB ; Converts the hi-res coursor's position ; back to X- and Y-coordinates; stores ; X-coordinate at $E0,E1 and Y-coordinate ; at $E2. -DRAW := $F601 ; Draws a shape. Enter with (Y,X) = the +DRAW := $F601 ; Draws a shape. Enter with (Y,X) = the ; address of the shape table, and (A) = ; the rotation factor. Uses the current ; color. -XDRAW := $F65D ; Draws a shape by inverting the existing +XDRAW := $F65D ; Draws a shape by inverting the existing ; color of the dots the shape draws over. ; Same entry parameters as DRAW. -SETHCOL := $F6EC ; Set the hi-res color to (X), where (X) +SETHCOL := $F6EC ; Set the hi-res color to (X), where (X) ; must be between 0 and 7. ; ------------------------------------------------------------------------ @@ -61,100 +61,100 @@ SETHCOL := $F6EC ; Set the hi-res color to (X), where (X) ; Variables mapped to the zero page segment variables. Some of these are ; used for passing parameters to the driver. -X1 := ptr1 -Y1 := ptr2 -X2 := ptr3 -Y2 := ptr4 +X1 := ptr1 +Y1 := ptr2 +X2 := ptr3 +Y2 := ptr4 ; ------------------------------------------------------------------------ - .segment "JUMPTABLE" + .segment "JUMPTABLE" ; Header. Includes jump table and constants. ; First part of the header is a structure that has a magic and defines the ; capabilities of the driver - .byte $74, $67, $69 ; "tgi" - .byte TGI_API_VERSION ; TGI API version number - .word 280 ; X resolution - .word 192 ; Y resolution - .byte 8 ; Number of drawing colors -pages: .byte 2 ; Number of screens available - .byte 7 ; System font X size - .byte 8 ; System font Y size - .word $00EA ; Aspect ratio (based on 4/3 display) + .byte $74, $67, $69 ; "tgi" + .byte TGI_API_VERSION ; TGI API version number + .word 280 ; X resolution + .word 192 ; Y resolution + .byte 8 ; Number of drawing colors +pages: .byte 2 ; Number of screens available + .byte 7 ; System font X size + .byte 8 ; System font Y size + .word $00EA ; Aspect ratio (based on 4/3 display) .byte 0 ; TGI driver flags ; Next comes the jump table. With the exception of IRQ, all entries must be ; valid and may point to an RTS for test versions (function not implemented). - .addr INSTALL - .addr UNINSTALL - .addr INIT - .addr DONE - .addr GETERROR - .addr CONTROL - .addr CLEAR - .addr SETVIEWPAGE - .addr SETDRAWPAGE - .addr SETCOLOR - .addr SETPALETTE - .addr GETPALETTE - .addr GETDEFPALETTE - .addr SETPIXEL - .addr GETPIXEL - .addr LINE - .addr BAR - .addr TEXTSTYLE - .addr OUTTEXT + .addr INSTALL + .addr UNINSTALL + .addr INIT + .addr DONE + .addr GETERROR + .addr CONTROL + .addr CLEAR + .addr SETVIEWPAGE + .addr SETDRAWPAGE + .addr SETCOLOR + .addr SETPALETTE + .addr GETPALETTE + .addr GETDEFPALETTE + .addr SETPIXEL + .addr GETPIXEL + .addr LINE + .addr BAR + .addr TEXTSTYLE + .addr OUTTEXT .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ - .bss + .bss ; Absolute variables used in the code -ERROR: .res 1 ; Error code +ERROR: .res 1 ; Error code ; ------------------------------------------------------------------------ - .rodata + .rodata ; Constants and tables DEFPALETTE: .byte $00, $01, $02, $03, $04, $05, $06, $07 FONT: - ; Beagle Bros Shape Mechanic font F.ASCII.SMALL - ; modified to exactly reproduce the text glyphs - .incbin "a2.hi.fnt" + ; Beagle Bros Shape Mechanic font F.ASCII.SMALL + ; modified to exactly reproduce the text glyphs + .incbin "a2.hi.fnt" ; ------------------------------------------------------------------------ - .code + .code ; INSTALL routine. Is called after the driver is loaded into memory. May ; initialize anything that has to be done just once. Is probably empty ; most of the time. ; Must set an error code: NO INSTALL: - .ifdef __APPLE2ENH__ - ; No page switching if 80 column store is enabled - bit RD80COL - bpl :+ - lda #$01 - sta pages -: .endif + .ifdef __APPLE2ENH__ + ; No page switching if 80 column store is enabled + bit RD80COL + bpl :+ + lda #$01 + sta pages +: .endif - ; Fall through + ; Fall through ; UNINSTALL routine. Is called before the driver is removed from memory. May ; clean up anything done by INSTALL but is probably empty most of the time. ; Must set an error code: NO UNINSTALL: - rts + rts ; INIT: Changes an already installed device from text mode to graphics mode. ; Note that INIT/DONE may be called multiple times while the driver @@ -166,132 +166,132 @@ UNINSTALL: ; active, so there is no need to protect against that. ; Must set an error code: YES INIT: - ; Switch into graphics mode - bit MIXCLR - bit HIRES - bit TXTCLR + ; Switch into graphics mode + bit MIXCLR + bit HIRES + bit TXTCLR - ; Beagle Bros Shape Mechanic fonts don't - ; scale well so use fixed scaling factor - lda #$01 - sta SCALE + ; Beagle Bros Shape Mechanic fonts don't + ; scale well so use fixed scaling factor + lda #$01 + sta SCALE - ; Done, reset the error code - lda #TGI_ERR_OK - sta ERROR - rts + ; Done, reset the error code + lda #TGI_ERR_OK + sta ERROR + rts ; DONE: Will be called to switch the graphics device back into text mode. ; The graphics kernel will never call DONE when no graphics mode is active, ; so there is no need to protect against that. ; Must set an error code: NO DONE: - ; Switch into text mode - bit TXTSET - bit LOWSCR + ; Switch into text mode + bit TXTSET + bit LOWSCR - .ifdef __APPLE2ENH__ - ; Limit SET80COL-HISCR to text - bit LORES - .endif + .ifdef __APPLE2ENH__ + ; Limit SET80COL-HISCR to text + bit LORES + .endif - ; Reset the text window top - lda #$00 - sta WNDTOP - rts + ; Reset the text window top + lda #$00 + sta WNDTOP + rts ; GETERROR: Return the error code in A and clear it. GETERROR: - lda ERROR - ldx #TGI_ERR_OK - stx ERROR - rts + lda ERROR + ldx #TGI_ERR_OK + stx ERROR + rts ; CONTROL: Platform/driver specific entry point. ; Must set an error code: YES CONTROL: - ; Check data msb and code to be 0 - ora ptr1+1 - bne err + ; Check data msb and code to be 0 + ora ptr1+1 + bne err - ; Check data lsb to be [0..1] - lda ptr1 - cmp #1+1 - bcs err + ; Check data lsb to be [0..1] + lda ptr1 + cmp #1+1 + bcs err - ; Set text window top - tax - beq :+ - lda #20 -: sta WNDTOP + ; Set text window top + tax + beq :+ + lda #20 +: sta WNDTOP - ; Switch 4 lines of text - .assert MIXCLR + 1 = MIXSET, error - lda MIXCLR,x ; No BIT absolute,X available + ; Switch 4 lines of text + .assert MIXCLR + 1 = MIXSET, error + lda MIXCLR,x ; No BIT absolute,X available - ; Done, reset the error code - lda #TGI_ERR_OK - beq :+ ; Branch always + ; Done, reset the error code + lda #TGI_ERR_OK + beq :+ ; Branch always - ; Done, set the error code -err: lda #TGI_ERR_INV_ARG -: sta ERROR - rts + ; Done, set the error code +err: lda #TGI_ERR_INV_ARG +: sta ERROR + rts ; CLEAR: Clears the screen. ; Must set an error code: NO CLEAR: - bit $C082 ; Switch in ROM - jsr HCLR - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + jsr HCLR + bit $C080 ; Switch in LC bank 2 for R/O + rts ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). ; The page number is already checked to be valid by the graphics kernel. ; Must set an error code: NO (will only be called if page ok) SETVIEWPAGE: - tax - .assert LOWSCR + 1 = HISCR, error - lda LOWSCR,x ; No BIT absolute,X available - rts + tax + .assert LOWSCR + 1 = HISCR, error + lda LOWSCR,x ; No BIT absolute,X available + rts ; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n). ; The page number is already checked to be valid by the graphics kernel. ; Must set an error code: NO (will only be called if page ok) SETDRAWPAGE: - tax - beq :+ - lda #>$4000 ; Page 2 - .byte $2C ; BIT absolute -: lda #>$2000 ; Page 1 - sta PAGE - rts + tax + beq :+ + lda #>$4000 ; Page 2 + .byte $2C ; BIT absolute +: lda #>$2000 ; Page 1 + sta PAGE + rts ; SETCOLOR: Set the drawing color (in A). The new color is already checked ; to be in a valid range (0..maxcolor-1). ; Must set an error code: NO (will only be called if color ok) SETCOLOR: - bit $C082 ; Switch in ROM - tax - jsr SETHCOL - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + tax + jsr SETHCOL + bit $C080 ; Switch in LC bank 2 for R/O + rts ; SETPALETTE: Set the palette (not available with all drivers/hardware). ; A pointer to the palette is passed in ptr1. Must set an error if palettes ; are not supported ; Must set an error code: YES SETPALETTE: - lda #TGI_ERR_INV_FUNC - sta ERROR - rts + lda #TGI_ERR_INV_FUNC + sta ERROR + rts ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot ; set the palette should return the default palette here, so there's no ; way for this function to fail. ; Must set an error code: NO GETPALETTE: - ; Fall through + ; Fall through ; GETDEFPALETTE: Return the default palette for the driver in A/X. All ; drivers should return something reasonable here, even drivers that don't @@ -299,147 +299,147 @@ GETPALETTE: ; of the (not changeable) palette. ; Must set an error code: NO (all drivers must have a default palette) GETDEFPALETTE: - lda #DEFPALETTE - rts + lda #DEFPALETTE + rts ; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing ; color. The coordinates passed to this function are never outside the ; visible screen area, so there is no need for clipping inside this function. ; Must set an error code: NO SETPIXEL: - bit $C082 ; Switch in ROM - ldx X1 - ldy X1+1 - lda Y1 - jsr HPLOT - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + ldx X1 + ldy X1+1 + lda Y1 + jsr HPLOT + bit $C080 ; Switch in LC bank 2 for R/O + rts ; GETPIXEL: Read the color value of a pixel and return it in A/X. The ; coordinates passed to this function are never outside the visible screen ; area, so there is no need for clipping inside this function. GETPIXEL: - bit $C082 ; Switch in ROM - ldx X1 - ldy X1+1 - lda Y1 - jsr HPOSN - lda (HBASL),y - and HMASK - asl - beq :+ ; 0 (black) - lda #$03 ; 3 (white) -: bcc :+ - adc #$03 ; += 4 (black -> black2, white -> white2) -: ldx #$00 - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + ldx X1 + ldy X1+1 + lda Y1 + jsr HPOSN + lda (HBASL),y + and HMASK + asl + beq :+ ; 0 (black) + lda #$03 ; 3 (white) +: bcc :+ + adc #$03 ; += 4 (black -> black2, white -> white2) +: ldx #$00 + bit $C080 ; Switch in LC bank 2 for R/O + rts ; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and ; X2/Y2 = ptr3/ptr4 using the current drawing color. ; Must set an error code: NO LINE: - bit $C082 ; Switch in ROM - ldx X1 - ldy X1+1 - lda Y1 - jsr HPOSN - lda X2 - ldx X2+1 - ldy Y2 - jsr HLIN - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + ldx X1 + ldy X1+1 + lda Y1 + jsr HPOSN + lda X2 + ldx X2+1 + ldy Y2 + jsr HLIN + bit $C080 ; Switch in LC bank 2 for R/O + rts ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4 using the current drawing color. ; Contrary to most other functions, the graphics kernel will sort and clip ; the coordinates before calling the driver, so on entry the following ; conditions are valid: -; X1 <= X2 -; Y1 <= Y2 -; (X1 >= 0) && (X1 < XRES) -; (X2 >= 0) && (X2 < XRES) -; (Y1 >= 0) && (Y1 < YRES) -; (Y2 >= 0) && (Y2 < YRES) +; X1 <= X2 +; Y1 <= Y2 +; (X1 >= 0) && (X1 < XRES) +; (X2 >= 0) && (X2 < XRES) +; (Y1 >= 0) && (Y1 < YRES) +; (Y2 >= 0) && (Y2 < YRES) ; Must set an error code: NO BAR: - inc Y2 -: lda Y2 - pha - lda Y1 - sta Y2 - jsr LINE - pla - sta Y2 - inc Y1 - cmp Y1 - bne :- - rts + inc Y2 +: lda Y2 + pha + lda Y1 + sta Y2 + jsr LINE + pla + sta Y2 + inc Y1 + cmp Y1 + bne :- + rts ; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y ; direction is passend in X/Y, the text direction is passed in A. ; Must set an error code: NO TEXTSTYLE: - cmp #TGI_TEXT_VERTICAL - bne :+ - lda #48 -: sta ROT - rts + cmp #TGI_TEXT_VERTICAL + bne :+ + lda #48 +: sta ROT + rts ; OUTTEXT: Output text at X/Y = ptr1/ptr2 using the current color and the ; current text style. The text to output is given as a zero terminated ; string with address in ptr3. ; Must set an error code: NO OUTTEXT: - bit $C082 ; Switch in ROM - lda X1 - ldy X1+1 - ldx ROT - php ; Save Z flag - beq :+ ; Not horizontal - sec - sbc #$07 ; Adjust X - bcs :+ - dey -: tax - lda Y1 - plp ; Restore Z flag - bne :+ ; Not vertical - sec - sbc #$07 ; Adjust Y -: jsr HPOSN - clc - lda FONT+2*99 ; "connection char" - adc #FONT - sta ptr4+1 - ldy #$00 -: lda (ptr3),y - beq :+ - sty tmp1 ; Save string index - sec - sbc #$1F ; No control chars - asl ; Offset * 2 - tay - clc - lda FONT,y - adc #FONT - tay - lda ROT - jsr DRAW ; Draw char from string - ldx ptr4 - ldy ptr4+1 - lda ROT - jsr DRAW ; Draw "connection char" - ldy tmp1 ; Restore string index - iny - bne :- ; Branch always -: bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + lda X1 + ldy X1+1 + ldx ROT + php ; Save Z flag + beq :+ ; Not horizontal + sec + sbc #$07 ; Adjust X + bcs :+ + dey +: tax + lda Y1 + plp ; Restore Z flag + bne :+ ; Not vertical + sec + sbc #$07 ; Adjust Y +: jsr HPOSN + clc + lda FONT+2*99 ; "connection char" + adc #FONT + sta ptr4+1 + ldy #$00 +: lda (ptr3),y + beq :+ + sty tmp1 ; Save string index + sec + sbc #$1F ; No control chars + asl ; Offset * 2 + tay + clc + lda FONT,y + adc #FONT + tay + lda ROT + jsr DRAW ; Draw char from string + ldx ptr4 + ldy ptr4+1 + lda ROT + jsr DRAW ; Draw "connection char" + ldy tmp1 ; Restore string index + iny + bne :- ; Branch always +: bit $C080 ; Switch in LC bank 2 for R/O + rts diff --git a/libsrc/apple2/tgi/a2.lo.s b/libsrc/apple2/tgi/a2.lo.s index edea841be..7ac43e6cc 100644 --- a/libsrc/apple2/tgi/a2.lo.s +++ b/libsrc/apple2/tgi/a2.lo.s @@ -5,106 +5,106 @@ ; Oliver Schmidt ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" - .include "apple2.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" + .include "apple2.inc" ; ------------------------------------------------------------------------ ; Zero page stuff -H2 := $2C -COLOR := $30 +H2 := $2C +COLOR := $30 ; ROM entry points -TEXT := $F399 -PLOT := $F800 -HLINE := $F819 -CLRSC2 := $F838 -SETCOL := $F864 -SCRN := $F871 -SETGR := $FB40 -HOME := $FC58 +TEXT := $F399 +PLOT := $F800 +HLINE := $F819 +CLRSC2 := $F838 +SETCOL := $F864 +SCRN := $F871 +SETGR := $FB40 +HOME := $FC58 ; Used for passing parameters to the driver -X1 := ptr1 -Y1 := ptr2 -X2 := ptr3 -Y2 := ptr4 +X1 := ptr1 +Y1 := ptr2 +X2 := ptr3 +Y2 := ptr4 ; ------------------------------------------------------------------------ - .segment "JUMPTABLE" + .segment "JUMPTABLE" ; Header. Includes jump table and constants. ; First part of the header is a structure that has a magic and defines the ; capabilities of the driver - .byte $74, $67, $69 ; "tgi" - .byte TGI_API_VERSION ; TGI API version number - .word 40 ; X resolution - .word 48 ; Y resolution - .byte 16 ; Number of drawing colors - .byte 1 ; Number of screens available - .byte 8 ; System font X size - .byte 8 ; System font Y size - .word $0198 ; Aspect ratio (based on 4/3 display) + .byte $74, $67, $69 ; "tgi" + .byte TGI_API_VERSION ; TGI API version number + .word 40 ; X resolution + .word 48 ; Y resolution + .byte 16 ; Number of drawing colors + .byte 1 ; Number of screens available + .byte 8 ; System font X size + .byte 8 ; System font Y size + .word $0198 ; Aspect ratio (based on 4/3 display) .byte 0 ; TGI driver flags ; Next comes the jump table. With the exception of IRQ, all entries must be ; valid and may point to an RTS for test versions (function not implemented). - .addr INSTALL - .addr UNINSTALL - .addr INIT - .addr DONE - .addr GETERROR - .addr CONTROL - .addr CLEAR - .addr SETVIEWPAGE - .addr SETDRAWPAGE - .addr SETCOLOR - .addr SETPALETTE - .addr GETPALETTE - .addr GETDEFPALETTE - .addr SETPIXEL - .addr GETPIXEL - .addr LINE - .addr BAR - .addr TEXTSTYLE - .addr OUTTEXT + .addr INSTALL + .addr UNINSTALL + .addr INIT + .addr DONE + .addr GETERROR + .addr CONTROL + .addr CLEAR + .addr SETVIEWPAGE + .addr SETDRAWPAGE + .addr SETCOLOR + .addr SETPALETTE + .addr GETPALETTE + .addr GETDEFPALETTE + .addr SETPIXEL + .addr GETPIXEL + .addr LINE + .addr BAR + .addr TEXTSTYLE + .addr OUTTEXT .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ - .bss + .bss -ERROR: .res 1 ; Error code -MIX: .res 1 ; 4 lines of text +ERROR: .res 1 ; Error code +MIX: .res 1 ; 4 lines of text ; ------------------------------------------------------------------------ - .rodata + .rodata DEFPALETTE: .byte $00, $01, $02, $03, $04, $05, $06, $07 - .byte $08, $09, $0A, $0B, $0C, $0D, $0E, $0F + .byte $08, $09, $0A, $0B, $0C, $0D, $0E, $0F TGI2COL: .byte $00, $0C, $03, $0F, $01, $09, $06, $02 - .byte $04, $05, $07, $08, $0A, $0B, $0D, $0E + .byte $04, $05, $07, $08, $0A, $0B, $0D, $0E COL2TGI: .byte $00, $04, $07, $02, $08, $09, $06, $0A - .byte $0B, $05, $0C, $0D, $01, $0E, $0F, $03 + .byte $0B, $05, $0C, $0D, $01, $0E, $0F, $03 -MAXY: .byte 47, 39 +MAXY: .byte 47, 39 ; ------------------------------------------------------------------------ - .code + .code ; INIT: Changes an already installed device from text mode to graphics mode. ; Note that INIT/DONE may be called multiple times while the driver @@ -116,168 +116,168 @@ MAXY: .byte 47, 39 ; active, so there is no need to protect against that. ; Must set an error code: YES INIT: - ; Switch into graphics mode - bit $C082 ; Switch in ROM - jsr SETGR - bit MIXCLR - bit $C080 ; Switch in LC bank 2 for R/O + ; Switch into graphics mode + bit $C082 ; Switch in ROM + jsr SETGR + bit MIXCLR + bit $C080 ; Switch in LC bank 2 for R/O - ; Done, reset the error code - lda #TGI_ERR_OK - sta ERROR - sta MIX + ; Done, reset the error code + lda #TGI_ERR_OK + sta ERROR + sta MIX - ; Fall through + ; Fall through ; INSTALL routine. Is called after the driver is loaded into memory. May ; initialize anything that has to be done just once. Is probably empty ; most of the time. ; Must set an error code: NO INSTALL: - ; Fall through + ; Fall through ; UNINSTALL routine. Is called before the driver is removed from memory. May ; clean up anything done by INSTALL but is probably empty most of the time. ; Must set an error code: NO UNINSTALL: - ; Fall through + ; Fall through ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). ; The page number is already checked to be valid by the graphics kernel. ; Must set an error code: NO (will only be called if page ok) SETVIEWPAGE: - ; Fall through + ; Fall through ; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n). ; The page number is already checked to be valid by the graphics kernel. ; Must set an error code: NO (will only be called if page ok) SETDRAWPAGE: - ; Fall through + ; Fall through ; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y ; direction is passend in X/Y, the text direction is passed in A. ; Must set an error code: NO TEXTSTYLE: - ; Fall through + ; Fall through ; OUTTEXT: Output text at X/Y = ptr1/ptr2 using the current color and the ; current text style. The text to output is given as a zero terminated ; string with address in ptr3. ; Must set an error code: NO OUTTEXT: - rts + rts ; DONE: Will be called to switch the graphics device back into text mode. ; The graphics kernel will never call DONE when no graphics mode is active, ; so there is no need to protect against that. ; Must set an error code: NO DONE: - bit $C082 ; Switch in ROM - jsr TEXT - jsr HOME - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + jsr TEXT + jsr HOME + bit $C080 ; Switch in LC bank 2 for R/O + rts ; GETERROR: Return the error code in A and clear it. GETERROR: - lda ERROR - ldx #TGI_ERR_OK - stx ERROR - rts + lda ERROR + ldx #TGI_ERR_OK + stx ERROR + rts ; CLEAR: Clears the screen. ; Must set an error code: NO CLEAR: - bit $C082 ; Switch in ROM - lda COLOR ; Save current drawing color - pha - ldx MIX - ldy MAXY,x ; Max Y depends on 4 lines of text - jsr CLRSC2 - pla - sta COLOR ; Restore current drawing color - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + lda COLOR ; Save current drawing color + pha + ldx MIX + ldy MAXY,x ; Max Y depends on 4 lines of text + jsr CLRSC2 + pla + sta COLOR ; Restore current drawing color + bit $C080 ; Switch in LC bank 2 for R/O + rts ; SETCOLOR: Set the drawing color (in A). The new color is already checked ; to be in a valid range (0..maxcolor-1). ; Must set an error code: NO (will only be called if color ok) SETCOLOR: - bit $C082 ; Switch in ROM - tax - lda TGI2COL,x - jsr SETCOL - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + tax + lda TGI2COL,x + jsr SETCOL + bit $C080 ; Switch in LC bank 2 for R/O + rts ; CONTROL: Platform/driver specific entry point. ; Must set an error code: YES CONTROL: - ; Check data msb and code to be 0 - ora ptr1+1 - bne err + ; Check data msb and code to be 0 + ora ptr1+1 + bne err - ; Check data lsb to be [0..1] - lda ptr1 - cmp #1+1 - bcs err - bit $C082 ; Switch in ROM + ; Check data lsb to be [0..1] + lda ptr1 + cmp #1+1 + bcs err + bit $C082 ; Switch in ROM - ; Switch 4 lines of text - tax - .assert MIXCLR + 1 = MIXSET, error - lda MIXCLR,x ; No BIT absolute,X available + ; Switch 4 lines of text + tax + .assert MIXCLR + 1 = MIXSET, error + lda MIXCLR,x ; No BIT absolute,X available - ; Save current switch setting - txa - sta MIX - bne text + ; Save current switch setting + txa + sta MIX + bne text - ; Clear 8 lines of graphics - lda COLOR ; Save current drawing color - pha - lda #39 ; Rightmost column - sta H2 - ldx #40 ; First line -: txa - ldy #$00 ; Leftmost column - sty COLOR ; Black - jsr HLINE ; Preserves X - inx - cpx #47+1 ; Last line - bcc :- - pla - sta COLOR ; Restore current drawing color - bcs :+ ; Branch always + ; Clear 8 lines of graphics + lda COLOR ; Save current drawing color + pha + lda #39 ; Rightmost column + sta H2 + ldx #40 ; First line +: txa + ldy #$00 ; Leftmost column + sty COLOR ; Black + jsr HLINE ; Preserves X + inx + cpx #47+1 ; Last line + bcc :- + pla + sta COLOR ; Restore current drawing color + bcs :+ ; Branch always - ; Clear 4 lines of text -text: jsr HOME -: bit $C080 ; Switch in LC bank 2 for R/O + ; Clear 4 lines of text +text: jsr HOME +: bit $C080 ; Switch in LC bank 2 for R/O - ; Done, reset the error code - lda #TGI_ERR_OK - beq :+ ; Branch always + ; Done, reset the error code + lda #TGI_ERR_OK + beq :+ ; Branch always - ; Done, set the error code -err: lda #TGI_ERR_INV_ARG -: sta ERROR - rts + ; Done, set the error code +err: lda #TGI_ERR_INV_ARG +: sta ERROR + rts ; SETPALETTE: Set the palette (not available with all drivers/hardware). ; A pointer to the palette is passed in ptr1. Must set an error if palettes ; are not supported ; Must set an error code: YES SETPALETTE: - lda #TGI_ERR_INV_FUNC - sta ERROR - rts + lda #TGI_ERR_INV_FUNC + sta ERROR + rts ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot ; set the palette should return the default palette here, so there's no ; way for this function to fail. ; Must set an error code: NO GETPALETTE: - ; Fall through + ; Fall through ; GETDEFPALETTE: Return the default palette for the driver in A/X. All ; drivers should return something reasonable here, even drivers that don't @@ -285,63 +285,63 @@ GETPALETTE: ; of the (not changeable) palette. ; Must set an error code: NO (all drivers must have a default palette) GETDEFPALETTE: - lda #DEFPALETTE - rts + lda #DEFPALETTE + rts ; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing ; color. The coordinates passed to this function are never outside the ; visible screen area, so there is no need for clipping inside this function. ; Must set an error code: NO SETPIXEL: - bit $C082 ; Switch in ROM - ldy X1 - lda Y1 - jsr PLOT - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + ldy X1 + lda Y1 + jsr PLOT + bit $C080 ; Switch in LC bank 2 for R/O + rts ; GETPIXEL: Read the color value of a pixel and return it in A/X. The ; coordinates passed to this function are never outside the visible screen ; area, so there is no need for clipping inside this function. GETPIXEL: - bit $C082 ; Switch in ROM - ldy X1 - lda Y1 - jsr SCRN - tax - lda COL2TGI,x - ldx #$00 - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + ldy X1 + lda Y1 + jsr SCRN + tax + lda COL2TGI,x + ldx #$00 + bit $C080 ; Switch in LC bank 2 for R/O + rts ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where ; X1/Y1 = ptr1/ptr2 and X2/Y2 = ptr3/ptr4 using the current drawing color. ; Contrary to most other functions, the graphics kernel will sort and clip ; the coordinates before calling the driver, so on entry the following ; conditions are valid: -; X1 <= X2 -; Y1 <= Y2 -; (X1 >= 0) && (X1 < XRES) -; (X2 >= 0) && (X2 < XRES) -; (Y1 >= 0) && (Y1 < YRES) -; (Y2 >= 0) && (Y2 < YRES) +; X1 <= X2 +; Y1 <= Y2 +; (X1 >= 0) && (X1 < XRES) +; (X2 >= 0) && (X2 < XRES) +; (Y1 >= 0) && (Y1 < YRES) +; (Y2 >= 0) && (Y2 < YRES) ; Must set an error code: NO BAR: - bit $C082 ; Switch in ROM - lda X2 - sta H2 - inc Y2 - ldx Y1 -: txa - ldy X1 - jsr HLINE ; Preserves X - inx - cpx Y2 - bcc :- - bit $C080 ; Switch in LC bank 2 for R/O - rts + bit $C082 ; Switch in ROM + lda X2 + sta H2 + inc Y2 + ldx Y1 +: txa + ldy X1 + jsr HLINE ; Preserves X + inx + cpx Y2 + bcc :- + bit $C080 ; Switch in LC bank 2 for R/O + rts ; ------------------------------------------------------------------------ -.include "../../tgi/tgidrv_line.inc" +.include "../../tgi/tgidrv_line.inc" diff --git a/libsrc/apple2/tgi_colors.s b/libsrc/apple2/tgi_colors.s index 8bc369809..53505b33d 100644 --- a/libsrc/apple2/tgi_colors.s +++ b/libsrc/apple2/tgi_colors.s @@ -2,7 +2,7 @@ ; Target-specific black & white values for use by the target-shared TGI kernel ; - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $03 + .export tgi_color_black:zp = $00 + .export tgi_color_white:zp = $03 diff --git a/libsrc/apple2/tgi_stat_stddrv.s b/libsrc/apple2/tgi_stat_stddrv.s index e9affe3b3..9fc1ca902 100644 --- a/libsrc/apple2/tgi_stat_stddrv.s +++ b/libsrc/apple2/tgi_stat_stddrv.s @@ -6,16 +6,16 @@ ; const void tgi_static_stddrv[]; ; - .export _tgi_static_stddrv - .ifdef __APPLE2ENH__ - .import _a2e_hi_tgi + .export _tgi_static_stddrv + .ifdef __APPLE2ENH__ + .import _a2e_hi_tgi .else - .import _a2_hi_tgi + .import _a2_hi_tgi .endif .rodata - .ifdef __APPLE2ENH__ + .ifdef __APPLE2ENH__ _tgi_static_stddrv := _a2e_hi_tgi .else _tgi_static_stddrv := _a2_hi_tgi diff --git a/libsrc/apple2/tgi_stddrv.s b/libsrc/apple2/tgi_stddrv.s index 15d56127c..451b4c2fa 100644 --- a/libsrc/apple2/tgi_stddrv.s +++ b/libsrc/apple2/tgi_stddrv.s @@ -6,13 +6,13 @@ ; const char tgi_stddrv[]; ; - .export _tgi_stddrv + .export _tgi_stddrv .rodata _tgi_stddrv: - .ifdef __APPLE2ENH__ - .asciiz "A2E.HI.TGI" + .ifdef __APPLE2ENH__ + .asciiz "A2E.HI.TGI" .else - .asciiz "A2.HI.TGI" + .asciiz "A2.HI.TGI" .endif diff --git a/libsrc/apple2/toascii.s b/libsrc/apple2/toascii.s index 586606553..a3f946e64 100644 --- a/libsrc/apple2/toascii.s +++ b/libsrc/apple2/toascii.s @@ -3,7 +3,7 @@ ; /* Convert a target specific character to ascii */ ; - .export _toascii + .export _toascii _toascii: ldx #$00 diff --git a/libsrc/apple2/videomode.s b/libsrc/apple2/videomode.s index 7a0493384..1da997472 100644 --- a/libsrc/apple2/videomode.s +++ b/libsrc/apple2/videomode.s @@ -5,7 +5,7 @@ ; .ifdef __APPLE2ENH__ - .export _videomode + .export _videomode .import COUT .include "apple2.inc" diff --git a/libsrc/apple2/vtabz.s b/libsrc/apple2/vtabz.s index 5ad350598..31de544c7 100644 --- a/libsrc/apple2/vtabz.s +++ b/libsrc/apple2/vtabz.s @@ -4,17 +4,17 @@ ; VTABZ routine ; - .export VTABZ + .export VTABZ - .include "apple2.inc" + .include "apple2.inc" - .segment "LOWCODE" + .segment "LOWCODE" VTABZ: - ; Switch in ROM and call VTABZ - bit $C082 - jsr $FC24 ; Generate text base address + ; Switch in ROM and call VTABZ + bit $C082 + jsr $FC24 ; Generate text base address - ; Switch in LC bank 2 and return - bit $C080 - rts + ; Switch in LC bank 2 and return + bit $C080 + rts diff --git a/libsrc/apple2/wherex.s b/libsrc/apple2/wherex.s index 1d67a2fd9..bd717a22b 100644 --- a/libsrc/apple2/wherex.s +++ b/libsrc/apple2/wherex.s @@ -4,11 +4,11 @@ ; unsigned char wherex (void); ; - .export _wherex + .export _wherex - .include "apple2.inc" + .include "apple2.inc" _wherex: - lda CH + lda CH ldx #$00 rts diff --git a/libsrc/apple2/wherey.s b/libsrc/apple2/wherey.s index 1ac7b6a75..daacaaba7 100644 --- a/libsrc/apple2/wherey.s +++ b/libsrc/apple2/wherey.s @@ -4,13 +4,13 @@ ; unsigned char wherey (void); ; - .export _wherey + .export _wherey - .include "apple2.inc" + .include "apple2.inc" _wherey: - lda CV + lda CV sec - sbc WNDTOP + sbc WNDTOP ldx #$00 rts diff --git a/libsrc/apple2/write.s b/libsrc/apple2/write.s index d8f7fcd84..21f4a45a4 100644 --- a/libsrc/apple2/write.s +++ b/libsrc/apple2/write.s @@ -4,44 +4,44 @@ ; int __fastcall__ write (int fd, const void* buf, unsigned count); ; - .export _write - .import rwprolog, rwcommon, rwepilog - .import COUT + .export _write + .import rwprolog, rwcommon, rwepilog + .import COUT - .include "zeropage.inc" - .include "errno.inc" - .include "fcntl.inc" - .include "mli.inc" - .include "filedes.inc" + .include "zeropage.inc" + .include "errno.inc" + .include "fcntl.inc" + .include "mli.inc" + .include "filedes.inc" _write: ; Get parameters - jsr rwprolog - bcs errno - tax ; Save fd + jsr rwprolog + bcs errno + tax ; Save fd ; Check for write access - lda fdtab + FD::FLAGS,y - and #O_WRONLY - beq einval + lda fdtab + FD::FLAGS,y + and #O_WRONLY + beq einval ; Check for device - txa ; Restore fd - bmi device + txa ; Restore fd + bmi device - ; Check for append flag - lda fdtab + FD::FLAGS,y - and #O_APPEND - beq write + ; Check for append flag + lda fdtab + FD::FLAGS,y + and #O_APPEND + beq write ; Set fd - stx mliparam + MLI::EOF::REF_NUM + stx mliparam + MLI::EOF::REF_NUM ; Get file size - lda #GET_EOF_CALL - ldx #EOF_COUNT - jsr callmli - bcs oserr + lda #GET_EOF_CALL + ldx #EOF_COUNT + jsr callmli + bcs oserr ; REF_NUM already set .assert MLI::MARK::REF_NUM = MLI::EOF::REF_NUM, error @@ -50,65 +50,65 @@ _write: .assert MLI::MARK::POSITION = MLI::EOF::EOF, error ; Set file pointer - lda #SET_MARK_CALL - ldx #MARK_COUNT - jsr callmli - bcs oserr + lda #SET_MARK_CALL + ldx #MARK_COUNT + jsr callmli + bcs oserr ; Do write -write: lda fdtab + FD::REF_NUM,y - ldy #WRITE_CALL - jmp rwcommon +write: lda fdtab + FD::REF_NUM,y + ldy #WRITE_CALL + jmp rwcommon ; Save count for epilog -device: ldx ptr2 - lda ptr2+1 - stx mliparam + MLI::RW::TRANS_COUNT - sta mliparam + MLI::RW::TRANS_COUNT+1 +device: ldx ptr2 + lda ptr2+1 + stx mliparam + MLI::RW::TRANS_COUNT + sta mliparam + MLI::RW::TRANS_COUNT+1 ; Check for zero count - ora ptr2 - beq done + ora ptr2 + beq done ; Get char from buf - ldy #$00 -next: lda (ptr1),y + ldy #$00 +next: lda (ptr1),y ; Replace '\n' with '\r' - cmp #$0A - bne :+ - lda #$0D + cmp #$0A + bne :+ + lda #$0D ; Set hi bit and write to device -: ora #$80 - .ifndef __APPLE2ENH__ - cmp #$E0 ; Test for lowercase - bcc output - and #$DF ; Convert to uppercase +: ora #$80 + .ifndef __APPLE2ENH__ + cmp #$E0 ; Test for lowercase + bcc output + and #$DF ; Convert to uppercase .endif -output: jsr COUT ; Preserves X and Y +output: jsr COUT ; Preserves X and Y ; Increment pointer iny - bne :+ - inc ptr1+1 + bne :+ + inc ptr1+1 ; Decrement count : dex - bne next - dec ptr2+1 - bpl next + bne next + dec ptr2+1 + bpl next ; Return success -done: lda #$00 - jmp rwepilog +done: lda #$00 + jmp rwepilog ; Load errno code -einval: lda #EINVAL +einval: lda #EINVAL ; Set __errno -errno: jmp __directerrno +errno: jmp __directerrno ; Set __oserror -oserr: jmp __mappederrno +oserr: jmp __mappederrno diff --git a/libsrc/atari/_scrsize.s b/libsrc/atari/_scrsize.s index 2d69d669e..c827ba397 100644 --- a/libsrc/atari/_scrsize.s +++ b/libsrc/atari/_scrsize.s @@ -4,8 +4,8 @@ ; Screen size variables ; - .export screensize - .include "atari.inc" + .export screensize + .include "atari.inc" .proc screensize diff --git a/libsrc/atari/break.s b/libsrc/atari/break.s index ebad1cb3d..a53ed9803 100644 --- a/libsrc/atari/break.s +++ b/libsrc/atari/break.s @@ -5,65 +5,65 @@ ; void reset_brk (void); ; - .export _set_brk, _reset_brk - .destructor _reset_brk - .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc + .export _set_brk, _reset_brk + .destructor _reset_brk + .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc - .include "atari.inc" + .include "atari.inc" .bss -_brk_a: .res 1 -_brk_x: .res 1 -_brk_y: .res 1 -_brk_sr: .res 1 -_brk_pc: .res 2 +_brk_a: .res 1 +_brk_x: .res 1 +_brk_y: .res 1 +_brk_sr: .res 1 +_brk_pc: .res 2 -oldvec: .res 2 ; Old vector +oldvec: .res 2 ; Old vector .data -uservec: jmp $FFFF ; Patched at runtime +uservec: jmp $FFFF ; Patched at runtime .code ; Set the break vector -.proc _set_brk +.proc _set_brk - sta uservec+1 - stx uservec+2 ; Set the user vector + sta uservec+1 + stx uservec+2 ; Set the user vector - lda oldvec - ora oldvec+1 ; Did we save the vector already? - bne L1 ; Jump if we installed the handler already + lda oldvec + ora oldvec+1 ; Did we save the vector already? + bne L1 ; Jump if we installed the handler already - lda VBREAK - sta oldvec - lda VBREAK+1 - sta oldvec+1 ; Save the old vector + lda VBREAK + sta oldvec + lda VBREAK+1 + sta oldvec+1 ; Save the old vector -L1: lda #brk_handler - sta VBREAK+1 - rts +L1: lda #brk_handler + sta VBREAK+1 + rts .endproc ; Reset the break vector -.proc _reset_brk +.proc _reset_brk - lda oldvec - ldx oldvec+1 - beq @L9 ; Jump if vector not installed - sta VBREAK - stx VBREAK+1 - lda #$00 - sta oldvec ; Clear the old vector - stx oldvec+1 -@L9: rts + lda oldvec + ldx oldvec+1 + beq @L9 ; Jump if vector not installed + sta VBREAK + stx VBREAK+1 + lda #$00 + sta oldvec ; Clear the old vector + stx oldvec+1 +@L9: rts .endproc @@ -71,35 +71,35 @@ L1: lda # don't close yet - lda #CLOSE - sta ICCOM,x - jsr CIOV - bmi closerr -ok: ldx #0 - stx __oserror ; clear system specific error code - txa - rts +.proc _close + jsr fdtoiocb_down ; get iocb index into X and decr. usage count + bmi inverr + bne ok ; not last one -> don't close yet + lda #CLOSE + sta ICCOM,x + jsr CIOV + bmi closerr +ok: ldx #0 + stx __oserror ; clear system specific error code + txa + rts -inverr: jmp __inviocb -closerr:jmp __do_oserror +inverr: jmp __inviocb +closerr:jmp __do_oserror .endproc diff --git a/libsrc/atari/clrscr.s b/libsrc/atari/clrscr.s index b352a83de..58fb63137 100644 --- a/libsrc/atari/clrscr.s +++ b/libsrc/atari/clrscr.s @@ -4,33 +4,33 @@ ; void clrscr (void); ; - .export _clrscr - .include "atari.inc" - .importzp ptr1 - .import setcursor + .export _clrscr + .include "atari.inc" + .importzp ptr1 + .import setcursor -_clrscr:lda SAVMSC ; screen memory - sta ptr1 - lda SAVMSC+1 - clc - adc #>(40*24) - sta ptr1+1 - lda #0 ; screen code of space char - sta OLDCHR - ldy #<(40*24) ; 40x24: size of default atari screen - ldx #>(40*24) -_clr1: sta (ptr1),y - dey - bne _clr1 - sta (ptr1),y - dex - bmi done - ldy ptr1+1 - dey - sty ptr1+1 - ldy #255 - jmp _clr1 +_clrscr:lda SAVMSC ; screen memory + sta ptr1 + lda SAVMSC+1 + clc + adc #>(40*24) + sta ptr1+1 + lda #0 ; screen code of space char + sta OLDCHR + ldy #<(40*24) ; 40x24: size of default atari screen + ldx #>(40*24) +_clr1: sta (ptr1),y + dey + bne _clr1 + sta (ptr1),y + dex + bmi done + ldy ptr1+1 + dey + sty ptr1+1 + ldy #255 + jmp _clr1 -done: sta COLCRS - sta ROWCRS - jmp setcursor +done: sta COLCRS + sta ROWCRS + jmp setcursor diff --git a/libsrc/atari/color.s b/libsrc/atari/color.s index 52432499d..57d0036c9 100644 --- a/libsrc/atari/color.s +++ b/libsrc/atari/color.s @@ -2,33 +2,33 @@ ; Christian Groessler, 27-Dec-2002 ; - .export _textcolor, _bgcolor, _bordercolor - .import return1 + .export _textcolor, _bgcolor, _bordercolor + .import return1 - .include "atari.inc" + .include "atari.inc" -_textcolor = return1 +_textcolor = return1 _bgcolor: - ldx COLOR2 ; get old value - sta COLOR2 ; set new value - and #$0e - cmp #8 - bcs bright - lda #$0e - .byte $2c ; bit opcode, eats the next 2 bytes -bright: lda #0 - sta COLOR1 - txa - ldx #0 ; fix X - rts + ldx COLOR2 ; get old value + sta COLOR2 ; set new value + and #$0e + cmp #8 + bcs bright + lda #$0e + .byte $2c ; bit opcode, eats the next 2 bytes +bright: lda #0 + sta COLOR1 + txa + ldx #0 ; fix X + rts _bordercolor: - ldx COLOR4 ; get old value - sta COLOR4 ; set new value - txa - ldx #0 ; fix X - rts + ldx COLOR4 ; get old value + sta COLOR4 ; set new value + txa + ldx #0 ; fix X + rts diff --git a/libsrc/atari/cputc.s b/libsrc/atari/cputc.s index 906a79282..cd2aefe79 100644 --- a/libsrc/atari/cputc.s +++ b/libsrc/atari/cputc.s @@ -5,91 +5,91 @@ ; void cputc (char c); ; - .export _cputcxy, _cputc - .export plot, cputdirect, putchar - .import popa, _gotoxy, mul40 - .importzp tmp4,ptr4 - .import _revflag,setcursor + .export _cputcxy, _cputc + .export plot, cputdirect, putchar + .import popa, _gotoxy, mul40 + .importzp tmp4,ptr4 + .import _revflag,setcursor - .include "atari.inc" + .include "atari.inc" _cputcxy: - pha ; Save C - jsr popa ; Get Y - jsr _gotoxy ; Set cursor, drop x - pla ; Restore C + pha ; Save C + jsr popa ; Get Y + jsr _gotoxy ; Set cursor, drop x + pla ; Restore C _cputc: - cmp #$0D ; CR - bne L4 - lda #0 - sta COLCRS - beq plot ; return + cmp #$0D ; CR + bne L4 + lda #0 + sta COLCRS + beq plot ; return -L4: cmp #$0A ; LF - beq newline - cmp #ATEOL ; Atari-EOL? - beq newline +L4: cmp #$0A ; LF + beq newline + cmp #ATEOL ; Atari-EOL? + beq newline - tay - rol a - rol a - rol a - rol a - and #3 - tax - tya - and #$9f - ora ataint,x + tay + rol a + rol a + rol a + rol a + and #3 + tax + tya + and #$9f + ora ataint,x -cputdirect: ; accepts screen code - jsr putchar +cputdirect: ; accepts screen code + jsr putchar ; advance cursor - inc COLCRS - lda COLCRS - cmp #40 - bcc plot - lda #0 - sta COLCRS + inc COLCRS + lda COLCRS + cmp #40 + bcc plot + lda #0 + sta COLCRS - .export newline + .export newline newline: - inc ROWCRS - lda ROWCRS - cmp #24 - bne plot - lda #0 - sta ROWCRS -plot: jsr setcursor - ldy COLCRS - ldx ROWCRS - rts + inc ROWCRS + lda ROWCRS + cmp #24 + bne plot + lda #0 + sta ROWCRS +plot: jsr setcursor + ldy COLCRS + ldx ROWCRS + rts ; turn off cursor, update screen, turn on cursor putchar: - pha ; save char + pha ; save char - ldy #0 - lda OLDCHR - sta (OLDADR),y + ldy #0 + lda OLDCHR + sta (OLDADR),y - lda ROWCRS - jsr mul40 ; destroys tmp4 - clc - adc SAVMSC ; add start of screen memory - sta ptr4 - txa - adc SAVMSC+1 - sta ptr4+1 - pla ; get char again + lda ROWCRS + jsr mul40 ; destroys tmp4 + clc + adc SAVMSC ; add start of screen memory + sta ptr4 + txa + adc SAVMSC+1 + sta ptr4+1 + pla ; get char again - ora _revflag - sta OLDCHR + ora _revflag + sta OLDCHR - ldy COLCRS - sta (ptr4),y - jmp setcursor + ldy COLCRS + sta (ptr4),y + jmp setcursor - .rodata -ataint: .byte 64,0,32,96 + .rodata +ataint: .byte 64,0,32,96 diff --git a/libsrc/atari/crt0.s b/libsrc/atari/crt0.s index 1a404f021..f007e64ad 100644 --- a/libsrc/atari/crt0.s +++ b/libsrc/atari/crt0.s @@ -2,165 +2,165 @@ ; Startup code for cc65 (ATARI version) ; ; Contributing authors: -; Mark Keates -; Freddy Offenga -; Christian Groessler -; Stefan Haubenthal +; Mark Keates +; Freddy Offenga +; Christian Groessler +; Stefan Haubenthal ; - .export _exit - .export __STARTUP__ : absolute = 1 ; Mark as startup + .export _exit + .export __STARTUP__ : absolute = 1 ; Mark as startup - .import initlib, donelib - .import callmain, zerobss - .import __STARTUP_LOAD__, __ZPSAVE_LOAD__ - .import __RESERVED_MEMORY__ + .import initlib, donelib + .import callmain, zerobss + .import __STARTUP_LOAD__, __ZPSAVE_LOAD__ + .import __RESERVED_MEMORY__ - .include "zeropage.inc" - .include "atari.inc" + .include "zeropage.inc" + .include "atari.inc" ; ------------------------------------------------------------------------ ; EXE header -.segment "EXEHDR" +.segment "EXEHDR" - .word $FFFF - .word __STARTUP_LOAD__ - .word __ZPSAVE_LOAD__ - 1 + .word $FFFF + .word __STARTUP_LOAD__ + .word __ZPSAVE_LOAD__ - 1 ; ------------------------------------------------------------------------ ; Actual code -.segment "STARTUP" +.segment "STARTUP" - rts ; fix for SpartaDOS / OS/A+ - ; they first call the entry point from AUTOSTRT and - ; then the load addess (this rts here). - ; We point AUTOSTRT directly after the rts. + rts ; fix for SpartaDOS / OS/A+ + ; they first call the entry point from AUTOSTRT and + ; then the load addess (this rts here). + ; We point AUTOSTRT directly after the rts. ; Real entry point: ; Save the zero page locations we need - ldx #zpspace-1 -L1: lda sp,x - sta zpsave,x - dex - bpl L1 + ldx #zpspace-1 +L1: lda sp,x + sta zpsave,x + dex + bpl L1 ; Clear the BSS data - jsr zerobss + jsr zerobss ; Setup the stack - tsx - stx spsave + tsx + stx spsave ; Report memory usage - lda APPMHI - sta appmsav ; remember old APPMHI value - lda APPMHI+1 - sta appmsav+1 + lda APPMHI + sta appmsav ; remember old APPMHI value + lda APPMHI+1 + sta appmsav+1 - sec - lda MEMTOP - sbc #<__RESERVED_MEMORY__ - sta APPMHI ; initialize our APPMHI value - sta sp ; setup runtime stack part 1 - lda MEMTOP+1 - sbc #>__RESERVED_MEMORY__ - sta APPMHI+1 - sta sp+1 ; setup runtime stack part 2 + sec + lda MEMTOP + sbc #<__RESERVED_MEMORY__ + sta APPMHI ; initialize our APPMHI value + sta sp ; setup runtime stack part 1 + lda MEMTOP+1 + sbc #>__RESERVED_MEMORY__ + sta APPMHI+1 + sta sp+1 ; setup runtime stack part 2 ; Call module constructors - jsr initlib + jsr initlib ; Set left margin to 0 - lda LMARGN - sta old_lmargin - ldy #0 - sty LMARGN + lda LMARGN + sta old_lmargin + ldy #0 + sty LMARGN ; Set keyb to upper/lowercase mode - ldx SHFLOK - stx old_shflok - sty SHFLOK + ldx SHFLOK + stx old_shflok + sty SHFLOK ; Initialize conio stuff - dey ; Set X to $FF - sty CH + dey ; Set X to $FF + sty CH ; Push arguments and call main - jsr callmain + jsr callmain ; Call module destructors. This is also the _exit entry. -_exit: jsr donelib ; Run module destructors +_exit: jsr donelib ; Run module destructors ; Restore system stuff - ldx spsave - txs ; Restore stack pointer + ldx spsave + txs ; Restore stack pointer ; Restore left margin - lda old_lmargin - sta LMARGN + lda old_lmargin + sta LMARGN ; Restore kb mode - lda old_shflok - sta SHFLOK + lda old_shflok + sta SHFLOK ; Restore APPMHI - lda appmsav - sta APPMHI - lda appmsav+1 - sta APPMHI+1 + lda appmsav + sta APPMHI + lda appmsav+1 + sta APPMHI+1 ; Copy back the zero page stuff - ldx #zpspace-1 -L2: lda zpsave,x - sta sp,x - dex - bpl L2 + ldx #zpspace-1 +L2: lda zpsave,x + sta sp,x + dex + bpl L2 ; Turn on cursor - inx - stx CRSINH + inx + stx CRSINH ; Back to DOS - rts + rts ; *** end of main startup code ; ------------------------------------------------------------------------ -.segment "ZPSAVE" +.segment "ZPSAVE" -zpsave: .res zpspace +zpsave: .res zpspace ; ------------------------------------------------------------------------ .bss -spsave: .res 1 -appmsav: .res 1 -old_shflok: .res 1 -old_lmargin: .res 1 +spsave: .res 1 +appmsav: .res 1 +old_shflok: .res 1 +old_lmargin: .res 1 - .segment "AUTOSTRT" - .word RUNAD ; defined in atari.h - .word RUNAD+1 - .word __STARTUP_LOAD__ + 1 + .segment "AUTOSTRT" + .word RUNAD ; defined in atari.h + .word RUNAD+1 + .word __STARTUP_LOAD__ + 1 diff --git a/libsrc/atari/ctype.s b/libsrc/atari/ctype.s index 8dbed2700..73553dc15 100644 --- a/libsrc/atari/ctype.s +++ b/libsrc/atari/ctype.s @@ -35,267 +35,267 @@ ; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v') ; 7 - Space or tab character - .export __ctype + .export __ctype __ctype: - .byte $00 ; 0/00 ___heart____ - .byte $00 ; 1/01 ___l_tee____ - .byte $00 ; 2/02 ___ctrl_B___ - .byte $00 ; 3/03 ___ctrl_C___ - .byte $00 ; 4/04 ___r_tee____ - .byte $00 ; 5/05 ___ctrl_E___ - .byte $00 ; 6/06 ___ctrl_F___ - .byte $00 ; 7/07 ___ctrl_G___ - .byte $00 ; 8/08 ___ctrl_H___ - .byte $00 ; 9/09 ___ctrl_I___ - .byte $00 ; 10/0a ___ctrl_J___ - .byte $00 ; 11/0b ___ctrl_K___ - .byte $00 ; 12/0c ___ctrl_L___ - .byte $00 ; 13/0d ___ctrl_M___ - .byte $00 ; 14/0e ___ctrl_N___ - .byte $00 ; 15/0f ___ctrl_O___ - .byte $00 ; 16/10 ____club____ - .byte $00 ; 17/11 ___ctrl_Q___ - .byte $00 ; 18/12 ___h_line___ - .byte $00 ; 19/13 ___ctrl_S___ - .byte $00 ; 20/14 ____ball____ - .byte $00 ; 21/15 ___ctrl_U___ - .byte $00 ; 22/16 ___ctrl_V___ - .byte $00 ; 23/17 ___t_tee____ - .byte $00 ; 24/18 ___b_tee____ - .byte $00 ; 25/19 ___ctrl_Y___ - .byte $00 ; 26/1a ___ctrl_Z___ - .byte $10 ; 27/1b ____ESC_____ - .byte $10 ; 28/1c ___crsr_up__ - .byte $10 ; 29/1d ___crsr_dn__ - .byte $10 ; 30/1e ___crsr_lf__ - .byte $10 ; 31/1f ___crsr_rg__ - .byte $A0 ; 32/20 ___SPACE___ - .byte $00 ; 33/21 _____!_____ - .byte $00 ; 34/22 _____"_____ - .byte $00 ; 35/23 _____#_____ - .byte $00 ; 36/24 _____$_____ - .byte $00 ; 37/25 _____%_____ - .byte $00 ; 38/26 _____&_____ - .byte $00 ; 39/27 _____'_____ - .byte $00 ; 40/28 _____(_____ - .byte $00 ; 41/29 _____)_____ - .byte $00 ; 42/2a _____*_____ - .byte $00 ; 43/2b _____+_____ - .byte $00 ; 44/2c _____,_____ - .byte $00 ; 45/2d _____-_____ - .byte $00 ; 46/2e _____._____ - .byte $00 ; 47/2f _____/_____ - .byte $0C ; 48/30 _____0_____ - .byte $0C ; 49/31 _____1_____ - .byte $0C ; 50/32 _____2_____ - .byte $0C ; 51/33 _____3_____ - .byte $0C ; 52/34 _____4_____ - .byte $0C ; 53/35 _____5_____ - .byte $0C ; 54/36 _____6_____ - .byte $0C ; 55/37 _____7_____ - .byte $0C ; 56/38 _____8_____ - .byte $0C ; 57/39 _____9_____ - .byte $00 ; 58/3a _____:_____ - .byte $00 ; 59/3b _____;_____ - .byte $00 ; 60/3c _____<_____ - .byte $00 ; 61/3d _____=_____ - .byte $00 ; 62/3e _____>_____ - .byte $00 ; 63/3f _____?_____ + .byte $00 ; 0/00 ___heart____ + .byte $00 ; 1/01 ___l_tee____ + .byte $00 ; 2/02 ___ctrl_B___ + .byte $00 ; 3/03 ___ctrl_C___ + .byte $00 ; 4/04 ___r_tee____ + .byte $00 ; 5/05 ___ctrl_E___ + .byte $00 ; 6/06 ___ctrl_F___ + .byte $00 ; 7/07 ___ctrl_G___ + .byte $00 ; 8/08 ___ctrl_H___ + .byte $00 ; 9/09 ___ctrl_I___ + .byte $00 ; 10/0a ___ctrl_J___ + .byte $00 ; 11/0b ___ctrl_K___ + .byte $00 ; 12/0c ___ctrl_L___ + .byte $00 ; 13/0d ___ctrl_M___ + .byte $00 ; 14/0e ___ctrl_N___ + .byte $00 ; 15/0f ___ctrl_O___ + .byte $00 ; 16/10 ____club____ + .byte $00 ; 17/11 ___ctrl_Q___ + .byte $00 ; 18/12 ___h_line___ + .byte $00 ; 19/13 ___ctrl_S___ + .byte $00 ; 20/14 ____ball____ + .byte $00 ; 21/15 ___ctrl_U___ + .byte $00 ; 22/16 ___ctrl_V___ + .byte $00 ; 23/17 ___t_tee____ + .byte $00 ; 24/18 ___b_tee____ + .byte $00 ; 25/19 ___ctrl_Y___ + .byte $00 ; 26/1a ___ctrl_Z___ + .byte $10 ; 27/1b ____ESC_____ + .byte $10 ; 28/1c ___crsr_up__ + .byte $10 ; 29/1d ___crsr_dn__ + .byte $10 ; 30/1e ___crsr_lf__ + .byte $10 ; 31/1f ___crsr_rg__ + .byte $A0 ; 32/20 ___SPACE___ + .byte $00 ; 33/21 _____!_____ + .byte $00 ; 34/22 _____"_____ + .byte $00 ; 35/23 _____#_____ + .byte $00 ; 36/24 _____$_____ + .byte $00 ; 37/25 _____%_____ + .byte $00 ; 38/26 _____&_____ + .byte $00 ; 39/27 _____'_____ + .byte $00 ; 40/28 _____(_____ + .byte $00 ; 41/29 _____)_____ + .byte $00 ; 42/2a _____*_____ + .byte $00 ; 43/2b _____+_____ + .byte $00 ; 44/2c _____,_____ + .byte $00 ; 45/2d _____-_____ + .byte $00 ; 46/2e _____._____ + .byte $00 ; 47/2f _____/_____ + .byte $0C ; 48/30 _____0_____ + .byte $0C ; 49/31 _____1_____ + .byte $0C ; 50/32 _____2_____ + .byte $0C ; 51/33 _____3_____ + .byte $0C ; 52/34 _____4_____ + .byte $0C ; 53/35 _____5_____ + .byte $0C ; 54/36 _____6_____ + .byte $0C ; 55/37 _____7_____ + .byte $0C ; 56/38 _____8_____ + .byte $0C ; 57/39 _____9_____ + .byte $00 ; 58/3a _____:_____ + .byte $00 ; 59/3b _____;_____ + .byte $00 ; 60/3c _____<_____ + .byte $00 ; 61/3d _____=_____ + .byte $00 ; 62/3e _____>_____ + .byte $00 ; 63/3f _____?_____ - .byte $00 ; 64/40 _____@_____ - .byte $0A ; 65/41 _____A_____ - .byte $0A ; 66/42 _____B_____ - .byte $0A ; 67/43 _____C_____ - .byte $0A ; 68/44 _____D_____ - .byte $0A ; 69/45 _____E_____ - .byte $0A ; 70/46 _____F_____ - .byte $02 ; 71/47 _____G_____ - .byte $02 ; 72/48 _____H_____ - .byte $02 ; 73/49 _____I_____ - .byte $02 ; 74/4a _____J_____ - .byte $02 ; 75/4b _____K_____ - .byte $02 ; 76/4c _____L_____ - .byte $02 ; 77/4d _____M_____ - .byte $02 ; 78/4e _____N_____ - .byte $02 ; 79/4f _____O_____ - .byte $02 ; 80/50 _____P_____ - .byte $02 ; 81/51 _____Q_____ - .byte $02 ; 82/52 _____R_____ - .byte $02 ; 83/53 _____S_____ - .byte $02 ; 84/54 _____T_____ - .byte $02 ; 85/55 _____U_____ - .byte $02 ; 86/56 _____V_____ - .byte $02 ; 87/57 _____W_____ - .byte $02 ; 88/58 _____X_____ - .byte $02 ; 89/59 _____Y_____ - .byte $02 ; 90/5a _____Z_____ - .byte $00 ; 91/5b _____[_____ - .byte $00 ; 92/5c _____\_____ - .byte $00 ; 93/5d _____]_____ - .byte $00 ; 94/5e _____^_____ - .byte $00 ; 95/5f _UNDERLINE_ - .byte $00 ; 96/60 __diamond__ - .byte $09 ; 97/61 _____a_____ - .byte $09 ; 98/62 _____b_____ - .byte $09 ; 99/63 _____c_____ - .byte $09 ; 100/64 _____d_____ - .byte $09 ; 101/65 _____e_____ - .byte $09 ; 102/66 _____f_____ - .byte $01 ; 103/67 _____g_____ - .byte $01 ; 104/68 _____h_____ - .byte $01 ; 105/69 _____i_____ - .byte $01 ; 106/6a _____j_____ - .byte $01 ; 107/6b _____k_____ - .byte $01 ; 108/6c _____l_____ - .byte $01 ; 109/6d _____m_____ - .byte $01 ; 110/6e _____n_____ - .byte $01 ; 111/6f _____o_____ - .byte $01 ; 112/70 _____p_____ - .byte $01 ; 113/71 _____q_____ - .byte $01 ; 114/72 _____r_____ - .byte $01 ; 115/73 _____s_____ - .byte $01 ; 116/74 _____t_____ - .byte $01 ; 117/75 _____u_____ - .byte $01 ; 118/76 _____v_____ - .byte $01 ; 119/77 _____w_____ - .byte $01 ; 120/78 _____x_____ - .byte $01 ; 121/79 _____y_____ - .byte $01 ; 122/7a _____z_____ - .byte $00 ; 123/7b ___spade___ - .byte $00 ; 124/7c __v_line___ - .byte $10 ; 125/7d __CLRSCR___ - .byte $D0 ; 126/7e __backtab__ - .byte $D0 ; 127/7f ____tab____ + .byte $00 ; 64/40 _____@_____ + .byte $0A ; 65/41 _____A_____ + .byte $0A ; 66/42 _____B_____ + .byte $0A ; 67/43 _____C_____ + .byte $0A ; 68/44 _____D_____ + .byte $0A ; 69/45 _____E_____ + .byte $0A ; 70/46 _____F_____ + .byte $02 ; 71/47 _____G_____ + .byte $02 ; 72/48 _____H_____ + .byte $02 ; 73/49 _____I_____ + .byte $02 ; 74/4a _____J_____ + .byte $02 ; 75/4b _____K_____ + .byte $02 ; 76/4c _____L_____ + .byte $02 ; 77/4d _____M_____ + .byte $02 ; 78/4e _____N_____ + .byte $02 ; 79/4f _____O_____ + .byte $02 ; 80/50 _____P_____ + .byte $02 ; 81/51 _____Q_____ + .byte $02 ; 82/52 _____R_____ + .byte $02 ; 83/53 _____S_____ + .byte $02 ; 84/54 _____T_____ + .byte $02 ; 85/55 _____U_____ + .byte $02 ; 86/56 _____V_____ + .byte $02 ; 87/57 _____W_____ + .byte $02 ; 88/58 _____X_____ + .byte $02 ; 89/59 _____Y_____ + .byte $02 ; 90/5a _____Z_____ + .byte $00 ; 91/5b _____[_____ + .byte $00 ; 92/5c _____\_____ + .byte $00 ; 93/5d _____]_____ + .byte $00 ; 94/5e _____^_____ + .byte $00 ; 95/5f _UNDERLINE_ + .byte $00 ; 96/60 __diamond__ + .byte $09 ; 97/61 _____a_____ + .byte $09 ; 98/62 _____b_____ + .byte $09 ; 99/63 _____c_____ + .byte $09 ; 100/64 _____d_____ + .byte $09 ; 101/65 _____e_____ + .byte $09 ; 102/66 _____f_____ + .byte $01 ; 103/67 _____g_____ + .byte $01 ; 104/68 _____h_____ + .byte $01 ; 105/69 _____i_____ + .byte $01 ; 106/6a _____j_____ + .byte $01 ; 107/6b _____k_____ + .byte $01 ; 108/6c _____l_____ + .byte $01 ; 109/6d _____m_____ + .byte $01 ; 110/6e _____n_____ + .byte $01 ; 111/6f _____o_____ + .byte $01 ; 112/70 _____p_____ + .byte $01 ; 113/71 _____q_____ + .byte $01 ; 114/72 _____r_____ + .byte $01 ; 115/73 _____s_____ + .byte $01 ; 116/74 _____t_____ + .byte $01 ; 117/75 _____u_____ + .byte $01 ; 118/76 _____v_____ + .byte $01 ; 119/77 _____w_____ + .byte $01 ; 120/78 _____x_____ + .byte $01 ; 121/79 _____y_____ + .byte $01 ; 122/7a _____z_____ + .byte $00 ; 123/7b ___spade___ + .byte $00 ; 124/7c __v_line___ + .byte $10 ; 125/7d __CLRSCR___ + .byte $D0 ; 126/7e __backtab__ + .byte $D0 ; 127/7f ____tab____ - .byte $00 ; 128/80 _inv_heart___ - .byte $00 ; 129/81 _inv_l_tee___ - .byte $00 ; 130/82 _inv_ctrl_B__ - .byte $00 ; 131/83 _inv_ctrl_C__ - .byte $00 ; 132/84 _inv_r_tee___ - .byte $00 ; 133/85 _inv_ctrl_E__ - .byte $00 ; 134/86 _inv_ctrl_F__ - .byte $00 ; 135/87 _inv_ctrl_G__ - .byte $00 ; 136/88 _inv_ctrl_H__ - .byte $00 ; 137/89 _inv_ctrl_I__ - .byte $00 ; 138/8a _inv_ctrl_J__ - .byte $00 ; 139/8b _inv_ctrl_K__ - .byte $00 ; 140/8c _inv_ctrl_L__ - .byte $00 ; 141/8d _inv_ctrl_M__ - .byte $00 ; 142/8e _inv_ctrl_N__ - .byte $00 ; 143/8f _inv_ctrl_O__ - .byte $00 ; 144/90 __inv__club__ - .byte $00 ; 145/91 _inv_ctrl_Q__ - .byte $00 ; 146/92 _inv_h_line__ - .byte $00 ; 147/93 _inv_ctrl_S__ - .byte $00 ; 148/94 __inv__ball__ - .byte $00 ; 149/95 _inv_ctrl_U__ - .byte $00 ; 150/96 _inv_ctrl_V__ - .byte $00 ; 151/97 __inv_t_tee__ - .byte $00 ; 152/98 __inv_b_tee__ - .byte $00 ; 153/99 _inv_ctrl_Y__ - .byte $00 ; 154/9a _inv_ctrl_Z__ - .byte $50 ; 155/9b _____EOL_____ - .byte $10 ; 156/9c ___CLRLINE___ - .byte $10 ; 157/9d ___INSLINE___ - .byte $10 ; 158/9e ____CLRTAB___ - .byte $10 ; 159/9f ____INSTAB___ - .byte $A0 ; 160/a0 __inv_SPACE__ - .byte $00 ; 161/a1 ___inv_!_____ - .byte $00 ; 162/a2 ___inv_"_____ - .byte $00 ; 163/a3 ___inv_#_____ - .byte $00 ; 164/a4 ___inv_$_____ - .byte $00 ; 165/a5 ___inv_%_____ - .byte $00 ; 166/a6 ___inv_&_____ - .byte $00 ; 167/a7 ___inv_'_____ - .byte $00 ; 168/a8 ___inv_(_____ - .byte $00 ; 169/a9 ___inv_)_____ - .byte $00 ; 170/aa ___inv_*_____ - .byte $00 ; 171/ab ___inv_+_____ - .byte $00 ; 172/ac ___inv_,_____ - .byte $00 ; 173/ad ___inv_-_____ - .byte $00 ; 174/ae ___inv_._____ - .byte $00 ; 175/af ___inv_/_____ - .byte $0C ; 176/b0 ___inv_0_____ - .byte $0C ; 177/b1 ___inv_1_____ - .byte $0C ; 178/b2 ___inv_2_____ - .byte $0C ; 179/b3 ___inv_3_____ - .byte $0C ; 180/b4 ___inv_4_____ - .byte $0C ; 181/b5 ___inv_5_____ - .byte $0C ; 182/b6 ___inv_6_____ - .byte $0C ; 183/b7 ___inv_7_____ - .byte $0C ; 184/b8 ___inv_8_____ - .byte $0C ; 185/b9 ___inv_9_____ - .byte $00 ; 186/ba ___inv_:_____ - .byte $00 ; 187/bb ___inv_;_____ - .byte $00 ; 188/bc ___inv_<_____ - .byte $00 ; 189/bd ___inv_=_____ - .byte $00 ; 190/be ___inv_>_____ - .byte $00 ; 191/bf ___inv_?_____ + .byte $00 ; 128/80 _inv_heart___ + .byte $00 ; 129/81 _inv_l_tee___ + .byte $00 ; 130/82 _inv_ctrl_B__ + .byte $00 ; 131/83 _inv_ctrl_C__ + .byte $00 ; 132/84 _inv_r_tee___ + .byte $00 ; 133/85 _inv_ctrl_E__ + .byte $00 ; 134/86 _inv_ctrl_F__ + .byte $00 ; 135/87 _inv_ctrl_G__ + .byte $00 ; 136/88 _inv_ctrl_H__ + .byte $00 ; 137/89 _inv_ctrl_I__ + .byte $00 ; 138/8a _inv_ctrl_J__ + .byte $00 ; 139/8b _inv_ctrl_K__ + .byte $00 ; 140/8c _inv_ctrl_L__ + .byte $00 ; 141/8d _inv_ctrl_M__ + .byte $00 ; 142/8e _inv_ctrl_N__ + .byte $00 ; 143/8f _inv_ctrl_O__ + .byte $00 ; 144/90 __inv__club__ + .byte $00 ; 145/91 _inv_ctrl_Q__ + .byte $00 ; 146/92 _inv_h_line__ + .byte $00 ; 147/93 _inv_ctrl_S__ + .byte $00 ; 148/94 __inv__ball__ + .byte $00 ; 149/95 _inv_ctrl_U__ + .byte $00 ; 150/96 _inv_ctrl_V__ + .byte $00 ; 151/97 __inv_t_tee__ + .byte $00 ; 152/98 __inv_b_tee__ + .byte $00 ; 153/99 _inv_ctrl_Y__ + .byte $00 ; 154/9a _inv_ctrl_Z__ + .byte $50 ; 155/9b _____EOL_____ + .byte $10 ; 156/9c ___CLRLINE___ + .byte $10 ; 157/9d ___INSLINE___ + .byte $10 ; 158/9e ____CLRTAB___ + .byte $10 ; 159/9f ____INSTAB___ + .byte $A0 ; 160/a0 __inv_SPACE__ + .byte $00 ; 161/a1 ___inv_!_____ + .byte $00 ; 162/a2 ___inv_"_____ + .byte $00 ; 163/a3 ___inv_#_____ + .byte $00 ; 164/a4 ___inv_$_____ + .byte $00 ; 165/a5 ___inv_%_____ + .byte $00 ; 166/a6 ___inv_&_____ + .byte $00 ; 167/a7 ___inv_'_____ + .byte $00 ; 168/a8 ___inv_(_____ + .byte $00 ; 169/a9 ___inv_)_____ + .byte $00 ; 170/aa ___inv_*_____ + .byte $00 ; 171/ab ___inv_+_____ + .byte $00 ; 172/ac ___inv_,_____ + .byte $00 ; 173/ad ___inv_-_____ + .byte $00 ; 174/ae ___inv_._____ + .byte $00 ; 175/af ___inv_/_____ + .byte $0C ; 176/b0 ___inv_0_____ + .byte $0C ; 177/b1 ___inv_1_____ + .byte $0C ; 178/b2 ___inv_2_____ + .byte $0C ; 179/b3 ___inv_3_____ + .byte $0C ; 180/b4 ___inv_4_____ + .byte $0C ; 181/b5 ___inv_5_____ + .byte $0C ; 182/b6 ___inv_6_____ + .byte $0C ; 183/b7 ___inv_7_____ + .byte $0C ; 184/b8 ___inv_8_____ + .byte $0C ; 185/b9 ___inv_9_____ + .byte $00 ; 186/ba ___inv_:_____ + .byte $00 ; 187/bb ___inv_;_____ + .byte $00 ; 188/bc ___inv_<_____ + .byte $00 ; 189/bd ___inv_=_____ + .byte $00 ; 190/be ___inv_>_____ + .byte $00 ; 191/bf ___inv_?_____ - .byte $00 ; 192/c0 ___inv_@_____ - .byte $0A ; 193/c1 ___inv_A_____ - .byte $0A ; 194/c2 ___inv_B_____ - .byte $0A ; 195/c3 ___inv_C_____ - .byte $0A ; 196/c4 ___inv_D_____ - .byte $0A ; 197/c5 ___inv_E_____ - .byte $0A ; 198/c6 ___inv_F_____ - .byte $02 ; 199/c7 ___inv_G_____ - .byte $02 ; 200/c8 ___inv_H_____ - .byte $02 ; 201/c9 ___inv_I_____ - .byte $02 ; 202/ca ___inv_J_____ - .byte $02 ; 203/cb ___inv_K_____ - .byte $02 ; 204/cc ___inv_L_____ - .byte $02 ; 205/cd ___inv_M_____ - .byte $02 ; 206/ce ___inv_N_____ - .byte $02 ; 207/cf ___inv_O_____ - .byte $02 ; 208/d0 ___inv_P_____ - .byte $02 ; 209/d1 ___inv_Q_____ - .byte $02 ; 210/d2 ___inv_R_____ - .byte $02 ; 211/d3 ___inv_S_____ - .byte $02 ; 212/d4 ___inv_T_____ - .byte $02 ; 213/d5 ___inv_U_____ - .byte $02 ; 214/d6 ___inv_V_____ - .byte $02 ; 215/d7 ___inv_W_____ - .byte $02 ; 216/d8 ___inv_X_____ - .byte $02 ; 217/d9 ___inv_Y_____ - .byte $02 ; 218/da ___inv_Z_____ - .byte $00 ; 219/db ___inv_[_____ - .byte $00 ; 220/dc ___inv_\_____ - .byte $00 ; 221/dd ___inv_]_____ - .byte $00 ; 222/de ___inv_^_____ - .byte $00 ; 223/df _inv_UNDRLIN_ - .byte $00 ; 224/e0 _inv_diamond_ - .byte $09 ; 225/e1 ___inv_a_____ - .byte $09 ; 226/e2 ___inv_b_____ - .byte $09 ; 227/e3 ___inv_c_____ - .byte $09 ; 228/e4 ___inv_d_____ - .byte $09 ; 229/e5 ___inv_e_____ - .byte $09 ; 230/e6 ___inv_f_____ - .byte $01 ; 231/e7 ___inv_g_____ - .byte $01 ; 232/e8 ___inv_h_____ - .byte $01 ; 233/e9 ___inv_i_____ - .byte $01 ; 234/ea ___inv_j_____ - .byte $01 ; 235/eb ___inv_k_____ - .byte $01 ; 236/ec ___inv_l_____ - .byte $01 ; 237/ed ___inv_m_____ - .byte $01 ; 238/ee ___inv_n_____ - .byte $01 ; 239/ef ___inv_o_____ - .byte $01 ; 240/f0 ___inv_p_____ - .byte $01 ; 241/f1 ___inv_q_____ - .byte $01 ; 242/f2 ___inv_r_____ - .byte $01 ; 243/f3 ___inv_s_____ - .byte $01 ; 244/f4 ___inv_t_____ - .byte $01 ; 245/f5 ___inv_u_____ - .byte $01 ; 246/f6 ___inv_v_____ - .byte $01 ; 247/f7 ___inv_w_____ - .byte $01 ; 248/f8 ___inv_x_____ - .byte $01 ; 249/f9 ___inv_y_____ - .byte $01 ; 250/fa ___inv_z_____ - .byte $00 ; 251/fb __inv_spade__ - .byte $00 ; 252/fc __inv_v_line_ - .byte $10 ; 253/fd ____BEEP_____ - .byte $10 ; 254/fe ____DELBS____ - .byte $10 ; 255/ff ___INSERT____ + .byte $00 ; 192/c0 ___inv_@_____ + .byte $0A ; 193/c1 ___inv_A_____ + .byte $0A ; 194/c2 ___inv_B_____ + .byte $0A ; 195/c3 ___inv_C_____ + .byte $0A ; 196/c4 ___inv_D_____ + .byte $0A ; 197/c5 ___inv_E_____ + .byte $0A ; 198/c6 ___inv_F_____ + .byte $02 ; 199/c7 ___inv_G_____ + .byte $02 ; 200/c8 ___inv_H_____ + .byte $02 ; 201/c9 ___inv_I_____ + .byte $02 ; 202/ca ___inv_J_____ + .byte $02 ; 203/cb ___inv_K_____ + .byte $02 ; 204/cc ___inv_L_____ + .byte $02 ; 205/cd ___inv_M_____ + .byte $02 ; 206/ce ___inv_N_____ + .byte $02 ; 207/cf ___inv_O_____ + .byte $02 ; 208/d0 ___inv_P_____ + .byte $02 ; 209/d1 ___inv_Q_____ + .byte $02 ; 210/d2 ___inv_R_____ + .byte $02 ; 211/d3 ___inv_S_____ + .byte $02 ; 212/d4 ___inv_T_____ + .byte $02 ; 213/d5 ___inv_U_____ + .byte $02 ; 214/d6 ___inv_V_____ + .byte $02 ; 215/d7 ___inv_W_____ + .byte $02 ; 216/d8 ___inv_X_____ + .byte $02 ; 217/d9 ___inv_Y_____ + .byte $02 ; 218/da ___inv_Z_____ + .byte $00 ; 219/db ___inv_[_____ + .byte $00 ; 220/dc ___inv_\_____ + .byte $00 ; 221/dd ___inv_]_____ + .byte $00 ; 222/de ___inv_^_____ + .byte $00 ; 223/df _inv_UNDRLIN_ + .byte $00 ; 224/e0 _inv_diamond_ + .byte $09 ; 225/e1 ___inv_a_____ + .byte $09 ; 226/e2 ___inv_b_____ + .byte $09 ; 227/e3 ___inv_c_____ + .byte $09 ; 228/e4 ___inv_d_____ + .byte $09 ; 229/e5 ___inv_e_____ + .byte $09 ; 230/e6 ___inv_f_____ + .byte $01 ; 231/e7 ___inv_g_____ + .byte $01 ; 232/e8 ___inv_h_____ + .byte $01 ; 233/e9 ___inv_i_____ + .byte $01 ; 234/ea ___inv_j_____ + .byte $01 ; 235/eb ___inv_k_____ + .byte $01 ; 236/ec ___inv_l_____ + .byte $01 ; 237/ed ___inv_m_____ + .byte $01 ; 238/ee ___inv_n_____ + .byte $01 ; 239/ef ___inv_o_____ + .byte $01 ; 240/f0 ___inv_p_____ + .byte $01 ; 241/f1 ___inv_q_____ + .byte $01 ; 242/f2 ___inv_r_____ + .byte $01 ; 243/f3 ___inv_s_____ + .byte $01 ; 244/f4 ___inv_t_____ + .byte $01 ; 245/f5 ___inv_u_____ + .byte $01 ; 246/f6 ___inv_v_____ + .byte $01 ; 247/f7 ___inv_w_____ + .byte $01 ; 248/f8 ___inv_x_____ + .byte $01 ; 249/f9 ___inv_y_____ + .byte $01 ; 250/fa ___inv_z_____ + .byte $00 ; 251/fb __inv_spade__ + .byte $00 ; 252/fc __inv_v_line_ + .byte $10 ; 253/fd ____BEEP_____ + .byte $10 ; 254/fe ____DELBS____ + .byte $10 ; 255/ff ___INSERT____ diff --git a/libsrc/atari/cvline.s b/libsrc/atari/cvline.s index ca3795aca..608da23de 100644 --- a/libsrc/atari/cvline.s +++ b/libsrc/atari/cvline.s @@ -4,32 +4,32 @@ ; void cvlinexy (unsigned char x, unsigned char y, unsigned char length); ; void cvline (unsigned char length); ; - .include "atari.inc" - - .export _cvlinexy, _cvline - .import popa, _gotoxy, putchar, setcursor - .importzp tmp1 + .include "atari.inc" + + .export _cvlinexy, _cvline + .import popa, _gotoxy, putchar, setcursor + .importzp tmp1 _cvlinexy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length and run into _cvline + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length and run into _cvline _cvline: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - sta tmp1 -L1: lda COLCRS - pha - lda #$7C ; Vertical bar - jsr putchar ; Write, no cursor advance - pla - sta COLCRS - inc ROWCRS - dec tmp1 - bne L1 -L9: jmp setcursor + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + sta tmp1 +L1: lda COLCRS + pha + lda #$7C ; Vertical bar + jsr putchar ; Write, no cursor advance + pla + sta COLCRS + inc ROWCRS + dec tmp1 + bne L1 +L9: jmp setcursor diff --git a/libsrc/atari/dio_cts.s b/libsrc/atari/dio_cts.s index f76a06b8a..551b9c0f6 100644 --- a/libsrc/atari/dio_cts.s +++ b/libsrc/atari/dio_cts.s @@ -9,60 +9,60 @@ ; sector number it got ; ; unsigned char __fastcall__ dio_phys_to_log(dhandle_t handle, -; dio_phys_pos *physpos, /* input */ -; unsigned *sectnum); /* output */ +; dio_phys_pos *physpos, /* input */ +; unsigned *sectnum); /* output */ ; ; dhandle_t - 16bit (ptr) ; - .export _dio_phys_to_log - .import popax,__oserror - .importzp ptr1,ptr2,ptr3 - .include "atari.inc" + .export _dio_phys_to_log + .import popax,__oserror + .importzp ptr1,ptr2,ptr3 + .include "atari.inc" -.proc _dio_phys_to_log +.proc _dio_phys_to_log - sta ptr1 - stx ptr1+1 ; pointer to result + sta ptr1 + stx ptr1+1 ; pointer to result - jsr popax - sta ptr2 - stx ptr2+1 ; pointer to input structure + jsr popax + sta ptr2 + stx ptr2+1 ; pointer to input structure - jsr popax - sta ptr3 - stx ptr3+1 ; pointer to handle + jsr popax + sta ptr3 + stx ptr3+1 ; pointer to handle - ldy #sst_flag - lda (ptr3),y - and #128 - beq _inv_hand ; handle not open or invalid + ldy #sst_flag + lda (ptr3),y + and #128 + beq _inv_hand ; handle not open or invalid ; ignore head and track and return the sector value - ldy #diopp_sector - lda (ptr2),y - tax - iny - lda (ptr2),y - ldy #1 - sta (ptr1),y - dey - txa - sta (ptr1),y + ldy #diopp_sector + lda (ptr2),y + tax + iny + lda (ptr2),y + ldy #1 + sta (ptr1),y + dey + txa + sta (ptr1),y - ldx #0 - txa + ldx #0 + txa ret: - sta __oserror - rts ; return success + sta __oserror + rts ; return success ; invalid handle _inv_hand: - ldx #0 - lda #BADIOC - bne ret + ldx #0 + lda #BADIOC + bne ret .endproc diff --git a/libsrc/atari/dio_stc.s b/libsrc/atari/dio_stc.s index 617989cbd..52b3af4a6 100644 --- a/libsrc/atari/dio_stc.s +++ b/libsrc/atari/dio_stc.s @@ -8,65 +8,65 @@ ; cylinder and head 0 and as sector the sectnum it got ; ; unsigned char __fastcall__ dio_log_to_phys(dhandle_t handle, -; unsigned *sectnum, /* input */ -; dio_phys_pos *physpos); /* output */ +; unsigned *sectnum, /* input */ +; dio_phys_pos *physpos); /* output */ ; ; dhandle_t - 16bit (ptr) ; - .export _dio_log_to_phys - .include "atari.inc" - .importzp ptr1,ptr2,ptr3 - .import popax,__oserror + .export _dio_log_to_phys + .include "atari.inc" + .importzp ptr1,ptr2,ptr3 + .import popax,__oserror -.proc _dio_log_to_phys +.proc _dio_log_to_phys - sta ptr2 - stx ptr2+1 ; pointer to output structure + sta ptr2 + stx ptr2+1 ; pointer to output structure - jsr popax - sta ptr1 - stx ptr1+1 ; save pointer to input data + jsr popax + sta ptr1 + stx ptr1+1 ; save pointer to input data - jsr popax - sta ptr3 - stx ptr3+1 ; pointer to handle + jsr popax + sta ptr3 + stx ptr3+1 ; pointer to handle - ldy #sst_flag - lda (ptr3),y - and #128 - beq _inv_hand ; handle not open or invalid + ldy #sst_flag + lda (ptr3),y + and #128 + beq _inv_hand ; handle not open or invalid - lda #0 - tay - tax - sta (ptr2),y ; head - iny - sta (ptr2),y ; track (low) - iny - sta (ptr2),y ; track (high) - iny + lda #0 + tay + tax + sta (ptr2),y ; head + iny + sta (ptr2),y ; track (low) + iny + sta (ptr2),y ; track (high) + iny - lda (ptr1,x) - sta (ptr2),y - iny - inc ptr1 - bne _l1 - inc ptr1+1 -_l1: lda (ptr1,x) - sta (ptr2),y + lda (ptr1,x) + sta (ptr2),y + iny + inc ptr1 + bne _l1 + inc ptr1+1 +_l1: lda (ptr1,x) + sta (ptr2),y - txa + txa ret: - sta __oserror - rts ; return success + sta __oserror + rts ; return success ; invalid handle _inv_hand: - ldx #0 - lda #BADIOC - bne ret + ldx #0 + lda #BADIOC + bne ret .endproc diff --git a/libsrc/atari/diopncls.s b/libsrc/atari/diopncls.s index f4c806076..2cdeba78b 100644 --- a/libsrc/atari/diopncls.s +++ b/libsrc/atari/diopncls.s @@ -8,156 +8,156 @@ ; _dio_write functions. To query the sector size, the _dio_open ; accesses the disk drive. ; -; dhandle_t __fastcall__ dio_open (unsigned char device); +; dhandle_t __fastcall__ dio_open (unsigned char device); ; unsigned char __fastcall__ dio_close (dhandle_t handle); ; - .export _dio_open, _dio_close - .export sectsizetab - .import __oserror, __sio_call, _dio_read - .import pushax, addysp, subysp - .importzp ptr2, sp - .include "atari.inc" + .export _dio_open, _dio_close + .export sectsizetab + .import __oserror, __sio_call, _dio_read + .import pushax, addysp, subysp + .importzp ptr2, sp + .include "atari.inc" .bss sectsizetab: - .res NUMDRVS * sst_size + .res NUMDRVS * sst_size .code ; code for _dio_open _inv_drive: - lda #NONDEV ; non-existent device - sta __oserror - lda #0 - tax - rts ; return NULL + lda #NONDEV ; non-existent device + sta __oserror + lda #0 + tax + rts ; return NULL _dio_open: - cmp #NUMDRVS ; valid drive id? - bcs _inv_drive - tay ; drive # - asl a ; make index from drive id - asl a - tax - lda #128 ; preset sectsize - sta sectsizetab+sst_sectsize,x - sta sectsizetab+sst_flag,x ; set flag that drive is "open" - lda #0 - sta sectsizetab+sst_sectsize+1,x - sta __oserror ; success - tya - sta sectsizetab+sst_driveno,x - stx ptr2 - lda #sectsizetab - adc #0 - tax - stx ptr2+1 ; ptr2: pointer to sectsizetab entry + cmp #NUMDRVS ; valid drive id? + bcs _inv_drive + tay ; drive # + asl a ; make index from drive id + asl a + tax + lda #128 ; preset sectsize + sta sectsizetab+sst_sectsize,x + sta sectsizetab+sst_flag,x ; set flag that drive is "open" + lda #0 + sta sectsizetab+sst_sectsize+1,x + sta __oserror ; success + tya + sta sectsizetab+sst_driveno,x + stx ptr2 + lda #sectsizetab + adc #0 + tax + stx ptr2+1 ; ptr2: pointer to sectsizetab entry ; query drive for current sector size ; procedure: ; - read sector #4 (SIO command $54) to update drive status; ; read length is 128 bytes, buffer is allocated on the stack, -; sector data is ignored; +; sector data is ignored; ; returned command status is ignored, we will get an error with -; a DD disk anyway (read size 128 vs. sector size 256); +; a DD disk anyway (read size 128 vs. sector size 256); ; - issue SIO command $53 (get status) to retrieve the sector size; ; use the DVSTAT system area as return buffer; ; if the command returns with an error, set sector size to 128 -; bytes; +; bytes; ; - ldy #128 - jsr subysp ; allocate buffer on the stack + ldy #128 + jsr subysp ; allocate buffer on the stack - lda sp - pha - lda sp+1 - pha ; save sp (buffer address) on processor stack + lda sp + pha + lda sp+1 + pha ; save sp (buffer address) on processor stack - lda ptr2 - ldx ptr2+1 - jsr pushax ; handle + lda ptr2 + ldx ptr2+1 + jsr pushax ; handle - ldx #0 - lda #4 - jsr pushax ; sect_num + ldx #0 + lda #4 + jsr pushax ; sect_num - pla - tax - pla ; AX - buffer address + pla + tax + pla ; AX - buffer address - ; sst_sectsize currently 128 - jsr _dio_read ; read sector to update status + ; sst_sectsize currently 128 + jsr _dio_read ; read sector to update status - ldy #128 - jsr addysp ; discard stack buffer + ldy #128 + jsr addysp ; discard stack buffer - lda ptr2 - ldx ptr2+1 - jsr pushax ; handle + lda ptr2 + ldx ptr2+1 + jsr pushax ; handle - ldx #0 - lda #4 - jsr pushax ; dummy sector #, ignored by this SIO command, - ; but set to circumvent the special 1-3 sector - ; handling in __sio_call + ldx #0 + lda #4 + jsr pushax ; dummy sector #, ignored by this SIO command, + ; but set to circumvent the special 1-3 sector + ; handling in __sio_call - ldx #>DVSTAT - lda #DVSTAT + lda # + ldy #6 ; OS/A+ has a jmp here + cmp (DOSVEC),y + beq done + lda #OSADOS + .byte $2C ; BIT -spdos: lda #SPARTADOS - .byte $2C ; BIT +spdos: lda #SPARTADOS + .byte $2C ; BIT -mydos: lda #MYDOS - .byte $2C ; BIT +mydos: lda #MYDOS + .byte $2C ; BIT -xdos: lda #XDOS - sta __dos_type -done: rts +xdos: lda #XDOS + sta __dos_type +done: rts ; ------------------------------------------------------------------------ ; Data - .bss + .bss -__dos_type: .res 1 ; default to ATARIDOS +__dos_type: .res 1 ; default to ATARIDOS diff --git a/libsrc/atari/emd/atr130xe.s b/libsrc/atari/emd/atr130xe.s index 6951bd346..b3c31a205 100644 --- a/libsrc/atari/emd/atr130xe.s +++ b/libsrc/atari/emd/atr130xe.s @@ -24,13 +24,13 @@ ; Ullrich von Bassewitz, 2002-12-02 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" - .include "em-error.inc" + .include "em-kernel.inc" + .include "em-error.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ @@ -40,19 +40,19 @@ ; Driver signature - .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte $65, $6d, $64 ; "emd" + .byte EMD_API_VERSION ; EM API version number ; Jump table. - .word INSTALL - .word DEINSTALL - .word PAGECOUNT - .word MAP - .word USE - .word COMMIT - .word COPYFROM - .word COPYTO + .word INSTALL + .word DEINSTALL + .word PAGECOUNT + .word MAP + .word USE + .word COMMIT + .word COPYFROM + .word COPYTO ; ------------------------------------------------------------------------ ; Constants @@ -69,50 +69,50 @@ PAGES = 256 ; 4 x 16k banks banks: .byte $E3,$E7,$EB,$EF ; 130XE banks for cpu banking stacktest: sei - ldy banks - sty $D301 - tax ; A is set by caller - inx - stx $4000 ; change $4000 - ldy #$FF ; STACK+13 - sty $D301 - cmp $4000 ; changed? - beq @1 - sec ; error - bcs @2 + ldy banks + sty $D301 + tax ; A is set by caller + inx + stx $4000 ; change $4000 + ldy #$FF ; STACK+13 + sty $D301 + cmp $4000 ; changed? + beq @1 + sec ; error + bcs @2 @1: clc @2: sta $4000 ; restore - cli - rts + cli + rts stacktest_end: stackcopy: sei ; disable interrupts @1: dex ; pre-decrement (full page x=0) - ldy #$FF ; this will be replaced STACK+3 - sty $D301 ; set bank - lda $FF00,x ; address to copy from STACK+8,+9 - ldy #$FF ; this will be replaced STACK+11 - sty $D301 - sta $FF00,x ; address to copy to STACK+16,+17 - cpx #0 - bne @1 - ldy #$FF ; portb_save STACK+23 - sty $D301 - cli ; enable interrupts - rts + ldy #$FF ; this will be replaced STACK+3 + sty $D301 ; set bank + lda $FF00,x ; address to copy from STACK+8,+9 + ldy #$FF ; this will be replaced STACK+11 + sty $D301 + sta $FF00,x ; address to copy to STACK+16,+17 + cpx #0 + bne @1 + ldy #$FF ; portb_save STACK+23 + sty $D301 + cli ; enable interrupts + rts stackcopy_end: stackcopy_byte: sei - ldy #$FF ; STACK+2 - sty $D301 - lda $FFFF ; STACK+7 +8 - ldy #$FF ; STACK+10 - sty $D301 - sta $FFFF ; STACK+15 +16 - ldy #$FF ; STACK+18 - sty $D301 - cli - rts + ldy #$FF ; STACK+2 + sty $D301 + lda $FFFF ; STACK+7 +8 + ldy #$FF ; STACK+10 + sty $D301 + sta $FFFF ; STACK+15 +16 + ldy #$FF ; STACK+18 + sty $D301 + cli + rts stackcopy_byte_end: @@ -127,44 +127,44 @@ portb_save: .res 1 ; portb state .code install_transfer: - ldx #stackcopy_end - stackcopy - 1 + ldx #stackcopy_end - stackcopy - 1 @1: lda stackcopy,x - sta STACK,x - dex - bpl @1 - rts + sta STACK,x + dex + bpl @1 + rts install_byte_transfer: - ldx #stackcopy_byte_end - stackcopy_byte - 1 + ldx #stackcopy_byte_end - stackcopy_byte - 1 @2: lda stackcopy_byte,x - sta STACK,x - dex - bpl @2 - rts + sta STACK,x + dex + bpl @2 + rts install_test: - ldx #stacktest_end - stacktest - 1 + ldx #stacktest_end - stacktest - 1 @3: lda stacktest,x - sta STACK,x - dex - bpl @3 - rts + sta STACK,x + dex + bpl @3 + rts setpage: - tax ; save page - and #$C0 ; mask out bank - clc - ror - ror ; divide by 64 - ror ; 64 pages in each bank - ror - ror - ror - sta curbank ; Remember the new bank - txa ; bring back page - and #$3F ; mask out page - sta curpage ; curpage in bank - rts + tax ; save page + and #$C0 ; mask out bank + clc + ror + ror ; divide by 64 + ror ; 64 pages in each bank + ror + ror + ror + sta curbank ; Remember the new bank + txa ; bring back page + and #$3F ; mask out page + sta curpage ; curpage in bank + rts ; ------------------------------------------------------------------------ @@ -175,20 +175,20 @@ setpage: ; INSTALL: - lda $D301 ; save state of portb - sta portb_save - tay + lda $D301 ; save state of portb + sta portb_save + tay - jsr install_test ; doesn't touch Y - sty STACK+13 + jsr install_test ; doesn't touch Y + sty STACK+13 - lda $4000 ; test for extended memory - jsr STACK - bcs @1 - lda #EM_ERR_OK - rts + lda $4000 ; test for extended memory + jsr STACK + bcs @1 + lda #EM_ERR_OK + rts @1: lda #EM_ERR_NO_DEVICE - rts + rts ; ------------------------------------------------------------------------ ; DEINSTALL routine. Is called before the driver is removed from memory. @@ -196,7 +196,7 @@ INSTALL: ; DEINSTALL: - rts + rts ; ------------------------------------------------------------------------ @@ -204,9 +204,9 @@ DEINSTALL: ; PAGECOUNT: - lda #PAGES - rts + lda #PAGES + rts ; ------------------------------------------------------------------------ ; MAP: Map the page in a/x into memory and return a pointer to the page in @@ -215,96 +215,96 @@ PAGECOUNT: ; MAP: jsr setpage ; extract the bank/page - add #>BANK ; $4000 + page (carry is cleared) - sta ptr1+1 - ;ldy #$00 - ;sty ptr1 + add #>BANK ; $4000 + page (carry is cleared) + sta ptr1+1 + ;ldy #$00 + ;sty ptr1 - lda #window - sta ptr2+1 + lda #window + sta ptr2+1 ; Transfer one page - jsr install_transfer ; Transfer one page + jsr install_transfer ; Transfer one page - ldx curbank - lda banks,x - sta STACK+3 ; set bank to copy from + ldx curbank + lda banks,x + sta STACK+3 ; set bank to copy from ; lda ptr1 ; sta STACK+8 - lda ptr1+1 - sta STACK+9 ; set copy from address - lda portb_save - sta STACK+11 ; set portb restore - sta STACK+23 ; set final portb restore - lda ptr2 - sta STACK+16 - lda ptr2+1 - sta STACK+17 ; set copy to address + lda ptr1+1 + sta STACK+9 ; set copy from address + lda portb_save + sta STACK+11 ; set portb restore + sta STACK+23 ; set final portb restore + lda ptr2 + sta STACK+16 + lda ptr2+1 + sta STACK+17 ; set copy to address - ldx #0 ; full page copy - jsr STACK ; do the copy! + ldx #0 ; full page copy + jsr STACK ; do the copy! ; Return the memory window - lda #window ; Return the window address + lda #window ; Return the window address - rts + rts ; ------------------------------------------------------------------------ ; USE: Tell the driver that the window is now associated with a given page. USE: ;sta curpage ; Remember the page - jsr setpage ; extract bank/page - lda #window ; Return the window - rts + jsr setpage ; extract bank/page + lda #window ; Return the window + rts ; ------------------------------------------------------------------------ ; COMMIT: Commit changes in the memory window to extended storage. COMMIT: lda curpage ; Get the current page - cmp #$FF - beq commit_done ; Jump if no page mapped + cmp #$FF + beq commit_done ; Jump if no page mapped - clc - add #>BANK - sta ptr2+1 - ;ldy #$00 - ;sty ptr2 + clc + add #>BANK + sta ptr2+1 + ;ldy #$00 + ;sty ptr2 - lda #window - sta ptr1+1 + lda #window + sta ptr1+1 ; Transfer one page/all bytes - jsr install_transfer ; Transfer one page + jsr install_transfer ; Transfer one page - lda portb_save - sta STACK+3 ; set bank to copy from - sta STACK+23 ; set final portb restore - lda ptr1 - sta STACK+8 - lda ptr1+1 - sta STACK+9 ; set copy from address - ldx curbank - lda banks,x - sta STACK+11 ; set bank to copy to - ;lda ptr2 - ;sta STACK+16 - lda ptr2+1 - sta STACK+17 ; set copy to address + lda portb_save + sta STACK+3 ; set bank to copy from + sta STACK+23 ; set final portb restore + lda ptr1 + sta STACK+8 + lda ptr1+1 + sta STACK+9 ; set copy from address + ldx curbank + lda banks,x + sta STACK+11 ; set bank to copy to + ;lda ptr2 + ;sta STACK+16 + lda ptr2+1 + sta STACK+17 ; set copy to address - ldx #0 ; full page copy - jsr STACK ; do the copy! + ldx #0 ; full page copy + jsr STACK ; do the copy! commit_done: - rts + rts ; ------------------------------------------------------------------------ @@ -313,87 +313,87 @@ commit_done: ; The function must not return anything. ; COPYFROM: - sta ptr3 - stx ptr3+1 ; Save the passed em_copy pointer + sta ptr3 + stx ptr3+1 ; Save the passed em_copy pointer - jsr install_byte_transfer ; install the stack copy routine + jsr install_byte_transfer ; install the stack copy routine - ldy #EM_COPY::OFFS - lda (ptr3),y - sta STACK+7 ; offset goes into BANK low + ldy #EM_COPY::OFFS + lda (ptr3),y + sta STACK+7 ; offset goes into BANK low - ldy #EM_COPY::PAGE - lda (ptr3),y - sta tmp1 ; save page for later - ;add #>BANK - ;sta STACK+8 ; BANK + page goes into BANK high + ldy #EM_COPY::PAGE + lda (ptr3),y + sta tmp1 ; save page for later + ;add #>BANK + ;sta STACK+8 ; BANK + page goes into BANK high - ldy #EM_COPY::BUF - lda (ptr3),y - sta STACK+15 ; buffer goes into dest low - iny - lda (ptr3),y - sta STACK+16 ; buffer goes into dest high + ldy #EM_COPY::BUF + lda (ptr3),y + sta STACK+15 ; buffer goes into dest low + iny + lda (ptr3),y + sta STACK+16 ; buffer goes into dest high - ldy #EM_COPY::COUNT - lda (ptr3),y ; Get bytes in last page - sta ptr4 - iny - lda (ptr3),y ; Get number of pages - sta ptr4+1 + ldy #EM_COPY::COUNT + lda (ptr3),y ; Get bytes in last page + sta ptr4 + iny + lda (ptr3),y ; Get number of pages + sta ptr4+1 - lda tmp1 ; extract bank/page - jsr setpage ; sets curbank/curpage - lda curpage - add #>BANK ; add to BANK address - sta STACK+8 ; current page in bank - ldx curbank - lda banks,x - sta STACK+2 ; set bank in stack - lda portb_save - sta STACK+10 ; set bank restore in stack - sta STACK+18 ; set final restore too + lda tmp1 ; extract bank/page + jsr setpage ; sets curbank/curpage + lda curpage + add #>BANK ; add to BANK address + sta STACK+8 ; current page in bank + ldx curbank + lda banks,x + sta STACK+2 ; set bank in stack + lda portb_save + sta STACK+10 ; set bank restore in stack + sta STACK+18 ; set final restore too copyfrom_copy: - lda ptr4 ; check if count is zero - bne @4 - lda ptr4+1 - beq done + lda ptr4 ; check if count is zero + bne @4 + lda ptr4+1 + beq done @4: jsr STACK ; copy one byte - sec - lda ptr4 - sub #1 - sta ptr4 - bcs @1 - lda ptr4+1 - beq @1 - sub #1 - sta ptr4+1 + sec + lda ptr4 + sub #1 + sta ptr4 + bcs @1 + lda ptr4+1 + beq @1 + sub #1 + sta ptr4+1 @1: inc STACK+7 ; increment address in BANK - bne @2 - inc STACK+8 - lda STACK+8 - cmp #$80 ; we stepped outside bank - bne @2 + bne @2 + inc STACK+8 + lda STACK+8 + cmp #$80 ; we stepped outside bank + bne @2 - inc curbank ; get next bank - ldx curbank - lda banks,x - sta STACK+2 ; set new bank - lda #$40 ; set address back to $4000 - sta STACK+8 + inc curbank ; get next bank + ldx curbank + lda banks,x + sta STACK+2 ; set new bank + lda #$40 ; set address back to $4000 + sta STACK+8 @2: inc STACK+15 ; increment buffer address - bne @3 - inc STACK+16 + bne @3 + inc STACK+16 @3: jmp copyfrom_copy ; copy another byte done: - rts + rts ; ------------------------------------------------------------------------ ; COPYTO: Copy from linear into extended memory. A pointer to a structure @@ -402,82 +402,82 @@ done: ; COPYTO: - sta ptr3 - stx ptr3+1 ; Save the passed em_copy pointer + sta ptr3 + stx ptr3+1 ; Save the passed em_copy pointer - jsr install_byte_transfer ; install the stack copy routine + jsr install_byte_transfer ; install the stack copy routine - ldy #EM_COPY::OFFS - lda (ptr3),y - sta STACK+15 ; offset goes into BANK low + ldy #EM_COPY::OFFS + lda (ptr3),y + sta STACK+15 ; offset goes into BANK low - ldy #EM_COPY::PAGE - lda (ptr3),y - sta tmp1 ; save page for later - ;add #>BANK - ;sta STACK+16 ; BANK + page goes into BANK high + ldy #EM_COPY::PAGE + lda (ptr3),y + sta tmp1 ; save page for later + ;add #>BANK + ;sta STACK+16 ; BANK + page goes into BANK high - ldy #EM_COPY::BUF - lda (ptr3),y - sta STACK+7 ; buffer goes into dest low - iny - lda (ptr3),y - sta STACK+8 ; buffer goes into dest high + ldy #EM_COPY::BUF + lda (ptr3),y + sta STACK+7 ; buffer goes into dest low + iny + lda (ptr3),y + sta STACK+8 ; buffer goes into dest high - ldy #EM_COPY::COUNT - lda (ptr3),y ; Get bytes in last page - sta ptr4 - iny - lda (ptr3),y ; Get number of pages - sta ptr4+1 + ldy #EM_COPY::COUNT + lda (ptr3),y ; Get bytes in last page + sta ptr4 + iny + lda (ptr3),y ; Get number of pages + sta ptr4+1 - lda tmp1 ; extract bank/page - jsr setpage ; sets curbank/curpage - lda curpage - add #>BANK ; add to BANK address - sta STACK+16 ; current page in bank - ldx curbank - lda banks,x - sta STACK+10 ; set bank in stack - lda portb_save - sta STACK+2 ; set bank restore in stack - sta STACK+18 ; set final restore too + lda tmp1 ; extract bank/page + jsr setpage ; sets curbank/curpage + lda curpage + add #>BANK ; add to BANK address + sta STACK+16 ; current page in bank + ldx curbank + lda banks,x + sta STACK+10 ; set bank in stack + lda portb_save + sta STACK+2 ; set bank restore in stack + sta STACK+18 ; set final restore too copyto_copy: - lda ptr4 ; check if count is zero - bne @4 - lda ptr4+1 - beq done + lda ptr4 ; check if count is zero + bne @4 + lda ptr4+1 + beq done @4: jsr STACK ; copy one byte - sec - lda ptr4 - sub #1 - sta ptr4 - bcs @1 - lda ptr4+1 - beq @1 - sub #1 - sta ptr4+1 + sec + lda ptr4 + sub #1 + sta ptr4 + bcs @1 + lda ptr4+1 + beq @1 + sub #1 + sta ptr4+1 @1: inc STACK+15 ; increment address in BANK - bne @2 - inc STACK+16 - lda STACK+16 - cmp #$80 ; we stepped outside bank - bne @2 + bne @2 + inc STACK+16 + lda STACK+16 + cmp #$80 ; we stepped outside bank + bne @2 - inc curbank ; get next bank - ldx curbank - lda banks,x - sta STACK+10 ; set new bank - lda #$40 ; set address back to $4000 - sta STACK+16 + inc curbank ; get next bank + ldx curbank + lda banks,x + sta STACK+10 ; set new bank + lda #$40 ; set address back to $4000 + sta STACK+16 @2: inc STACK+7 ; increment buffer address - bne @3 - inc STACK+8 + bne @3 + inc STACK+8 @3: jmp copyto_copy ; copy another byte diff --git a/libsrc/atari/fd.inc b/libsrc/atari/fd.inc index 31175b3ca..aefc802c5 100644 --- a/libsrc/atari/fd.inc +++ b/libsrc/atari/fd.inc @@ -4,18 +4,18 @@ ; offsets and defines for fdtable (internal use only) ; -MAX_FD_INDEX = 12 ; max. # of open fds -MAX_FD_VAL = 8 ; we have 8 IOCBs +MAX_FD_INDEX = 12 ; max. # of open fds +MAX_FD_VAL = 8 ; we have 8 IOCBs -ft_entrylen = 4 ; length of table entry (it's not sufficient to change here! - ; the code sometimes does two bit shifts to multiply/divide by - ; this length) +ft_entrylen = 4 ; length of table entry (it's not sufficient to change here! + ; the code sometimes does two bit shifts to multiply/divide by + ; this length) -ft_usa = 0 ; usage counter -ft_iocb = 1 ; iocb index (0,$10,$20,etc.), $ff for empty entry -ft_dev = 2 ; device of open iocb (0 - device not remembered, eg. filename specified) -ft_flag = 3 ; flags - ; lower 3 bits: device number (for R: and D:) - ; bit 3 - seeking supported by DOS/disk combination - ; bit 4 - indicates a fd opened by the program as apposed to the - ; inherited ones from program start (fd 0 to fd 2) +ft_usa = 0 ; usage counter +ft_iocb = 1 ; iocb index (0,$10,$20,etc.), $ff for empty entry +ft_dev = 2 ; device of open iocb (0 - device not remembered, eg. filename specified) +ft_flag = 3 ; flags + ; lower 3 bits: device number (for R: and D:) + ; bit 3 - seeking supported by DOS/disk combination + ; bit 4 - indicates a fd opened by the program as apposed to the + ; inherited ones from program start (fd 0 to fd 2) diff --git a/libsrc/atari/fdtab.s b/libsrc/atari/fdtab.s index 57598b600..0c90aefad 100644 --- a/libsrc/atari/fdtab.s +++ b/libsrc/atari/fdtab.s @@ -5,26 +5,26 @@ ; the fdtable itself is defined here ; - .include "fd.inc" + .include "fd.inc" - .export fd_table,fd_index - .export ___fd_table,___fd_index ; for test(debug purposes only + .export fd_table,fd_index + .export ___fd_table,___fd_index ; for test(debug purposes only - .data + .data ___fd_index: -fd_index: ; fd number is index into this table, entry's value specifies the fd_table entry - .byte 0,0,0 ; at start, three first files are stdin/stdout/stderr. - .res MAX_FD_INDEX-3,$ff +fd_index: ; fd number is index into this table, entry's value specifies the fd_table entry + .byte 0,0,0 ; at start, three first files are stdin/stdout/stderr. + .res MAX_FD_INDEX-3,$ff ___fd_table: -fd_table: ; each entry represents an open iocb - .byte 3,0,'E',0 ; system console, app starts with opened iocb #0 for E: - .byte 0,$ff,0,0 - .byte 0,$ff,0,0 - .byte 0,$ff,0,0 - .byte 0,$ff,0,0 - .byte 0,$ff,0,0 - .byte 0,$ff,0,0 - .byte 0,$ff,0,0 +fd_table: ; each entry represents an open iocb + .byte 3,0,'E',0 ; system console, app starts with opened iocb #0 for E: + .byte 0,$ff,0,0 + .byte 0,$ff,0,0 + .byte 0,$ff,0,0 + .byte 0,$ff,0,0 + .byte 0,$ff,0,0 + .byte 0,$ff,0,0 + .byte 0,$ff,0,0 diff --git a/libsrc/atari/fdtable.s b/libsrc/atari/fdtable.s index 111f340d0..7e3325055 100644 --- a/libsrc/atari/fdtable.s +++ b/libsrc/atari/fdtable.s @@ -4,85 +4,85 @@ ; fd indirection table & helper functions ; - .include "atari.inc" - .include "fd.inc" - .importzp tmp1,tmp2,tmp3,ptr4,sp - .import fd_table,fd_index - .import fdt_to_fdi - .export clriocb - .export fdtoiocb_down - .export findfreeiocb - .export fddecusage - .export newfd + .include "atari.inc" + .include "fd.inc" + .importzp tmp1,tmp2,tmp3,ptr4,sp + .import fd_table,fd_index + .import fdt_to_fdi + .export clriocb + .export fdtoiocb_down + .export findfreeiocb + .export fddecusage + .export newfd - .code + .code ; gets fd in ax, decrements usage counter ; return iocb index in X ; return N bit set for invalid fd ; return Z bit set if last user ; all registers destroyed -.proc fdtoiocb_down +.proc fdtoiocb_down - cpx #0 - bne inval - cmp #MAX_FD_INDEX - bcs inval - tax - lda fd_index,x ; get index - tay - lda #$ff - sta fd_index,x ; clear entry - tya - asl a ; create index into fd table - asl a - tax - lda #$ff - cmp fd_table+ft_iocb,x ; entry in use? - beq inval ; no, return error - lda fd_table+ft_usa,x ; get usage counter - beq ok_notlast ; 0? (shouldn't happen) - sec - sbc #1 ; decr usage counter - sta fd_table+ft_usa,x + cpx #0 + bne inval + cmp #MAX_FD_INDEX + bcs inval + tax + lda fd_index,x ; get index + tay + lda #$ff + sta fd_index,x ; clear entry + tya + asl a ; create index into fd table + asl a + tax + lda #$ff + cmp fd_table+ft_iocb,x ; entry in use? + beq inval ; no, return error + lda fd_table+ft_usa,x ; get usage counter + beq ok_notlast ; 0? (shouldn't happen) + sec + sbc #1 ; decr usage counter + sta fd_table+ft_usa,x retiocb:php - txa - tay - lda fd_table+ft_iocb,x ; get iocb - tax - plp - bne cont - lda #$ff - sta fd_table+ft_iocb,y ; clear table entry - lda fd_table+ft_flag,y - and #16 ; opened by app? - eor #16 ; return set Z if yes -cont: rts + txa + tay + lda fd_table+ft_iocb,x ; get iocb + tax + plp + bne cont + lda #$ff + sta fd_table+ft_iocb,y ; clear table entry + lda fd_table+ft_flag,y + and #16 ; opened by app? + eor #16 ; return set Z if yes +cont: rts ok_notlast: - lda #1 ; clears Z - jmp retiocb + lda #1 ; clears Z + jmp retiocb -.endproc ; fdtoiocb_down +.endproc ; fdtoiocb_down -inval: ldx #$ff ; sets N - rts +inval: ldx #$ff ; sets N + rts ; clear iocb except for ICHID field ; expects X to be index to IOCB (0,$10,$20,etc.) ; all registers destroyed -.proc clriocb +.proc clriocb - inx ; don't clear ICHID - ldy #15 - lda #0 -loop: sta ICHID,x - inx - dey - bne loop - rts + inx ; don't clear ICHID + ldy #15 + lda #0 +loop: sta ICHID,x + inx + dey + bne loop + rts .endproc @@ -93,57 +93,57 @@ loop: sta ICHID,x ; index in X if found ; all registers destroyed -.proc findfreeiocb +.proc findfreeiocb - ldx #0 - ldy #$FF -loop: tya - cmp ICHID,x - beq found - txa - clc - adc #$10 - tax - cmp #$80 - bcc loop - inx ; return ZF cleared -found: rts + ldx #0 + ldy #$FF +loop: tya + cmp ICHID,x + beq found + txa + clc + adc #$10 + tax + cmp #$80 + bcc loop + inx ; return ZF cleared +found: rts -.endproc ; findfreeiocb +.endproc ; findfreeiocb ; decrements usage counter for fd ; if 0 reached, it's marked as unused ; get fd index in tmp2 ; Y register preserved -.proc fddecusage +.proc fddecusage - lda tmp2 ; get fd - cmp #MAX_FD_INDEX - bcs ret ; invalid index, do nothing - tax - lda fd_index,x - pha - lda #$ff - sta fd_index,x - pla - asl a ; create index into fd table - asl a - tax - lda #$ff - cmp fd_table+ft_iocb,x ; entry in use? - beq ret ; no, do nothing - lda fd_table+ft_usa,x ; get usage counter - beq ret ; 0? should not happen - sec - sbc #1 ; decrement by one - sta fd_table+ft_usa,x - bne ret ; not 0 - lda #$ff ; 0, table entry unused now - sta fd_table+ft_iocb,x ; clear table entry -ret: rts + lda tmp2 ; get fd + cmp #MAX_FD_INDEX + bcs ret ; invalid index, do nothing + tax + lda fd_index,x + pha + lda #$ff + sta fd_index,x + pla + asl a ; create index into fd table + asl a + tax + lda #$ff + cmp fd_table+ft_iocb,x ; entry in use? + beq ret ; no, do nothing + lda fd_table+ft_usa,x ; get usage counter + beq ret ; 0? should not happen + sec + sbc #1 ; decrement by one + sta fd_table+ft_usa,x + bne ret ; not 0 + lda #$ff ; 0, table entry unused now + sta fd_table+ft_iocb,x ; clear table entry +ret: rts -.endproc ; fddecusage +.endproc ; fddecusage ; newfd @@ -156,198 +156,198 @@ ret: rts ; a link to this open device is returned ; ; Calling parameters: -; tmp3 - length of filename + 1 -; AX - points to filename -; Y - iocb to use (if we need a new open) +; tmp3 - length of filename + 1 +; AX - points to filename +; Y - iocb to use (if we need a new open) ; Return parameters: -; tmp2 - fd num ($ff and C=0 in case of error - no free slot) -; C - 0/1 for no open needed/open should be performed +; tmp2 - fd num ($ff and C=0 in case of error - no free slot) +; C - 0/1 for no open needed/open should be performed ; all registers preserved! - .bss + .bss ; local variables: -loc_Y: .res 1 -loc_ptr4_l: .res 1 -loc_ptr4_h: .res 1 -loc_tmp1: .res 1 -loc_devnum: .res 1 -loc_size: .res 1 +loc_Y: .res 1 +loc_ptr4_l: .res 1 +loc_ptr4_h: .res 1 +loc_tmp1: .res 1 +loc_devnum: .res 1 +loc_size: .res 1 - .code + .code -.proc newfd +.proc newfd - pha - txa - pha - tya - pha + pha + txa + pha + tya + pha - ldx #0 - stx loc_devnum - lda tmp1 - sta loc_tmp1 - stx tmp1 ; init tmp1 - stx tmp2 ; init tmp2 - lda ptr4+1 - sta loc_ptr4_h - lda ptr4 - sta loc_ptr4_l - pla - sta loc_Y - pla - sta ptr4+1 - pla - sta ptr4 + ldx #0 + stx loc_devnum + lda tmp1 + sta loc_tmp1 + stx tmp1 ; init tmp1 + stx tmp2 ; init tmp2 + lda ptr4+1 + sta loc_ptr4_h + lda ptr4 + sta loc_ptr4_l + pla + sta loc_Y + pla + sta ptr4+1 + pla + sta ptr4 - ; ptr4 points to filename + ; ptr4 points to filename - ldy #1 - lda #':' - cmp (ptr4),y ; "X:" - beq colon1 - iny - cmp (ptr4),y ; "Xn:" - beq colon2 + ldy #1 + lda #':' + cmp (ptr4),y ; "X:" + beq colon1 + iny + cmp (ptr4),y ; "Xn:" + beq colon2 - ; no colon there!? OK, then we use a fresh iocb.... - ; return error here? no, the subsequent open call should fail + ; no colon there!? OK, then we use a fresh iocb.... + ; return error here? no, the subsequent open call should fail -do_open_nd: ; do open and don't remember device - lda #2 - sta tmp1 -do_open:lda tmp1 - ora #1 - sta tmp1 ; set flag to return 'open needed' : C = 1 - ldx #ft_iocb - ldy #$ff +do_open_nd: ; do open and don't remember device + lda #2 + sta tmp1 +do_open:lda tmp1 + ora #1 + sta tmp1 ; set flag to return 'open needed' : C = 1 + ldx #ft_iocb + ldy #$ff srchfree: - tya - cmp fd_table,x ; check ft_iocb field for $ff - beq freefnd ; found a free slot - txa - clc - adc #ft_entrylen - tax - cmp #(MAX_FD_VAL*4)+ft_iocb ; end of table reached? - bcc srchfree + tya + cmp fd_table,x ; check ft_iocb field for $ff + beq freefnd ; found a free slot + txa + clc + adc #ft_entrylen + tax + cmp #(MAX_FD_VAL*4)+ft_iocb ; end of table reached? + bcc srchfree ; error: no free slot found -noslot: ldx #0 - stx tmp1 ; return with C = 0 - dex - stx tmp2 ; iocb: $ff marks error - jmp finish +noslot: ldx #0 + stx tmp1 ; return with C = 0 + dex + stx tmp2 ; iocb: $ff marks error + jmp finish ; found a free slot freefnd:txa - sec - sbc #ft_iocb ; normalize - tax - lsr a - lsr a - sta tmp2 ; return fd - lda #2 - bit tmp1 ; remember device? - beq l1 ; yes - lda #0 ; no, put 0 in field - beq l2 + sec + sbc #ft_iocb ; normalize + tax + lsr a + lsr a + sta tmp2 ; return fd + lda #2 + bit tmp1 ; remember device? + beq l1 ; yes + lda #0 ; no, put 0 in field + beq l2 -l1: ldy #0 - lda (sp),y ; get device -l2: sta fd_table+ft_dev,x ; set device - lda #1 - sta fd_table+ft_usa,x ; set usage counter - lda loc_Y - sta fd_table+ft_iocb,x ; set iocb index - lda loc_devnum - and #7 ; device number is 3 bits - ora #16 ; indicated a fd actively opened by the app - sta fd_table+ft_flag,x - lda tmp2 - jsr fdt_to_fdi ; get new index -noslot1:bcs noslot ; no one available (noslot1: helper label for branch out of range) - ;cmp #$ff ; no one available - ;beq noslot ;@@@ cleanup needed - sta tmp2 ; return index - jmp finish +l1: ldy #0 + lda (sp),y ; get device +l2: sta fd_table+ft_dev,x ; set device + lda #1 + sta fd_table+ft_usa,x ; set usage counter + lda loc_Y + sta fd_table+ft_iocb,x ; set iocb index + lda loc_devnum + and #7 ; device number is 3 bits + ora #16 ; indicated a fd actively opened by the app + sta fd_table+ft_flag,x + lda tmp2 + jsr fdt_to_fdi ; get new index +noslot1:bcs noslot ; no one available (noslot1: helper label for branch out of range) + ;cmp #$ff ; no one available + ;beq noslot ;@@@ cleanup needed + sta tmp2 ; return index + jmp finish ; string in "Xn:xxx" format -colon2: dey - lda (ptr4),y ; get device number - sec - sbc #'0' - and #7 - sta loc_devnum - sta tmp2 ; save it for speed later here also - lda #4 ; max. length if only device + number ("Xn:") - cmp tmp3 - bcc do_open_nd ; string is longer -> contains filename - bcs check_dev ; handle device only string +colon2: dey + lda (ptr4),y ; get device number + sec + sbc #'0' + and #7 + sta loc_devnum + sta tmp2 ; save it for speed later here also + lda #4 ; max. length if only device + number ("Xn:") + cmp tmp3 + bcc do_open_nd ; string is longer -> contains filename + bcs check_dev ; handle device only string ; string in "X:xxx" format -colon1: lda #3 ; max. length if device only ("X:") - cmp tmp3 - bcc do_open_nd ; string is longer -> contains filename +colon1: lda #3 ; max. length if device only ("X:") + cmp tmp3 + bcc do_open_nd ; string is longer -> contains filename ; get device and search it in fd table check_dev: - ldy #0 - lda (ptr4),y ; get device id - tay - ldx #(MAX_FD_VAL*4) - ft_entrylen -srchdev:lda #$ff - cmp fd_table+ft_iocb,x ; is entry valid? - beq srch2 ; no, skip this entry - tya - cmp fd_table+ft_dev,x - beq fnddev -srch2: txa - sec - sbc #ft_entrylen+1 - tax - bpl srchdev + ldy #0 + lda (ptr4),y ; get device id + tay + ldx #(MAX_FD_VAL*4) - ft_entrylen +srchdev:lda #$ff + cmp fd_table+ft_iocb,x ; is entry valid? + beq srch2 ; no, skip this entry + tya + cmp fd_table+ft_dev,x + beq fnddev +srch2: txa + sec + sbc #ft_entrylen+1 + tax + bpl srchdev ; not found, open new iocb - jmp do_open + jmp do_open ; found device in table, check device number (e.g R0 - R3) -fnddev: lda fd_table+ft_flag,x - and #7 - cmp tmp2 ; contains devnum - bne srch2 ; different device numbers +fnddev: lda fd_table+ft_flag,x + and #7 + cmp tmp2 ; contains devnum + bne srch2 ; different device numbers ; found existing open iocb with same device - txa - lsr a - lsr a - sta tmp2 - inc fd_table+ft_usa,x ; increment usage counter - jsr fdt_to_fdi ; get new index - bcs noslot1 ; no one available - sta tmp2 ; return index + txa + lsr a + lsr a + sta tmp2 + inc fd_table+ft_usa,x ; increment usage counter + jsr fdt_to_fdi ; get new index + bcs noslot1 ; no one available + sta tmp2 ; return index ; clean up and go home -finish: lda ptr4 - pha - lda ptr4+1 - pha - lda loc_Y - pha - lda tmp1 - pha - lda loc_tmp1 - sta tmp1 - pla - lsr a ; set C as needed +finish: lda ptr4 + pha + lda ptr4+1 + pha + lda loc_Y + pha + lda tmp1 + pha + lda loc_tmp1 + sta tmp1 + pla + lsr a ; set C as needed - pla - tay - pla - tax - pla - rts + pla + tay + pla + tax + pla + rts -.endproc ; newfd +.endproc ; newfd diff --git a/libsrc/atari/fdtoiocb.s b/libsrc/atari/fdtoiocb.s index 710ef9009..bd8c92dae 100644 --- a/libsrc/atari/fdtoiocb.s +++ b/libsrc/atari/fdtoiocb.s @@ -5,37 +5,37 @@ ; Convert file descriptor to IOCB number ; - .include "atari.inc" - .include "fd.inc" - .import fd_table,fd_index - .export fdtoiocb + .include "atari.inc" + .include "fd.inc" + .import fd_table,fd_index + .export fdtoiocb - .code + .code ; gets fd in ax ; return iocb index in A, fd_table index in X ; return N bit set for invalid fd ; all registers destroyed -.proc fdtoiocb +.proc fdtoiocb - cpx #0 - bne inval - cmp #MAX_FD_INDEX - bcs inval - tax - lda fd_index,x - asl a ; create index into fd table - asl a - tax - lda #$ff - cmp fd_table+ft_iocb,x ; entry in use? - beq inval ; no, return error - lda fd_table+ft_usa,x ; get usage counter - beq inval ; 0? should not happen - lda fd_table+ft_iocb,x ; get iocb - rts + cpx #0 + bne inval + cmp #MAX_FD_INDEX + bcs inval + tax + lda fd_index,x + asl a ; create index into fd table + asl a + tax + lda #$ff + cmp fd_table+ft_iocb,x ; entry in use? + beq inval ; no, return error + lda fd_table+ft_usa,x ; get usage counter + beq inval ; 0? should not happen + lda fd_table+ft_iocb,x ; get iocb + rts -inval: ldx #$ff ; sets N - rts +inval: ldx #$ff ; sets N + rts -.endproc ; fdtoiocb +.endproc ; fdtoiocb diff --git a/libsrc/atari/getargs.s b/libsrc/atari/getargs.s index da7fd73aa..fdae55364 100644 --- a/libsrc/atari/getargs.s +++ b/libsrc/atari/getargs.s @@ -7,15 +7,15 @@ ; startup code but is nevertheless included in the compiled program when ; needed. -MAXARGS = 16 ; max. amount of arguments in arg. table -CL_SIZE = 64 ; command line buffer size -SPACE = 32 ; SPACE char. +MAXARGS = 16 ; max. amount of arguments in arg. table +CL_SIZE = 64 ; command line buffer size +SPACE = 32 ; SPACE char. - .include "atari.inc" - .import __argc, __argv - .importzp ptr1 - .import __dos_type - .constructor initmainargs,25 + .include "atari.inc" + .import __argc, __argv + .importzp ptr1 + .import __dos_type + .constructor initmainargs,25 ; -------------------------------------------------------------------------- ; Get command line @@ -23,121 +23,121 @@ SPACE = 32 ; SPACE char. .segment "INIT" initmainargs: - lda #0 - sta __argc - sta __argc+1 - sta __argv - sta __argv+1 + lda #0 + sta __argc + sta __argc+1 + sta __argv + sta __argv+1 - lda __dos_type ; which DOS? - cmp #ATARIDOS - beq nargdos ; DOS does not support arguments - cmp #MYDOS - bne argdos ; DOS supports arguments + lda __dos_type ; which DOS? + cmp #ATARIDOS + beq nargdos ; DOS does not support arguments + cmp #MYDOS + bne argdos ; DOS supports arguments nargdos:rts ; Initialize ourcl buffer -argdos: lda #ATEOL - sta ourcl+CL_SIZE +argdos: lda #ATEOL + sta ourcl+CL_SIZE ; Move SpartaDOS command line to our own buffer - lda DOSVEC - clc - adc #LBUF - sta ptr1+1 + lda DOSVEC + clc + adc #LBUF + sta ptr1+1 - ldy #0 -cpcl: lda (ptr1),y - sta ourcl,y - iny - cmp #ATEOL - beq movdon - cpy #CL_SIZE - bne cpcl + ldy #0 +cpcl: lda (ptr1),y + sta ourcl,y + iny + cmp #ATEOL + beq movdon + cpy #CL_SIZE + bne cpcl -movdon: lda #0 - sta ourcl,y ; null terminate behind ATEOL +movdon: lda #0 + sta ourcl,y ; null terminate behind ATEOL ; Turn command line into argv table - ;ldy #0 - tay -eatspc: lda ourcl,y ; eat spaces - cmp #ATEOL - beq finargs - cmp #SPACE - bne rpar ; begin of argument found - iny - cpy #CL_SIZE - bne eatspc - beq finargs ; only spaces is no argument + ;ldy #0 + tay +eatspc: lda ourcl,y ; eat spaces + cmp #ATEOL + beq finargs + cmp #SPACE + bne rpar ; begin of argument found + iny + cpy #CL_SIZE + bne eatspc + beq finargs ; only spaces is no argument ; Store argument vector -rpar: lda __argc ; low-byte - asl - tax ; table index - tya ; ourcl index - clc - adc #ourcl - adc #0 - sta argv+1,x - ldx __argc - inx - stx __argc - cpx #MAXARGS - beq finargs +rpar: lda __argc ; low-byte + asl + tax ; table index + tya ; ourcl index + clc + adc #ourcl + adc #0 + sta argv+1,x + ldx __argc + inx + stx __argc + cpx #MAXARGS + beq finargs ; Skip this arg. skiparg: - ldx ourcl,y - cpx #ATEOL ; end of line? - beq eopar - cpx #SPACE - beq eopar - iny - cpy #CL_SIZE - bne skiparg + ldx ourcl,y + cpx #ATEOL ; end of line? + beq eopar + cpx #SPACE + beq eopar + iny + cpy #CL_SIZE + bne skiparg ; End of arg. -> place 0 eopar: - lda #0 - sta ourcl,y - iny ; y behind arg. - cpx #ATEOL ; was it the last arg? - bne eatspc + lda #0 + sta ourcl,y + iny ; y behind arg. + cpx #ATEOL ; was it the last arg? + bne eatspc ; Finish args finargs: - lda __argc - asl - tax - lda #0 - sta argv,x - sta argv+1,x - lda #argv - sta __argv - stx __argv+1 - rts + lda __argc + asl + tax + lda #0 + sta argv,x + sta argv+1,x + lda #argv + sta __argv + stx __argv+1 + rts ; -------------------------------------------------------------------------- ; Data .bss -argv: .res (1 + MAXARGS) * 2 +argv: .res (1 + MAXARGS) * 2 ; Buffer for command line / argv strings -ourcl: .res CL_SIZE+1 +ourcl: .res CL_SIZE+1 diff --git a/libsrc/atari/getdefdev.s b/libsrc/atari/getdefdev.s index a6d13e86e..13aa12e04 100644 --- a/libsrc/atari/getdefdev.s +++ b/libsrc/atari/getdefdev.s @@ -14,77 +14,77 @@ ; ZCRNAME is slightly different from SpartaDOS. It will convert D: ; into Dn: where n is the default drive. - .include "atari.inc" - .import __dos_type - .export __getdefdev ; get default device - .export __defdev ; this is the default device string (e.g. "D1:") -.ifdef DYNAMIC_DD - .constructor __getdefdev,24 + .include "atari.inc" + .import __dos_type + .export __getdefdev ; get default device + .export __defdev ; this is the default device string (e.g. "D1:") +.ifdef DYNAMIC_DD + .constructor __getdefdev,24 .endif ; Get default device (LBUF will be destroyed!!) __getdefdev: - lda __dos_type ; which DOS? - cmp #ATARIDOS - beq finish - cmp #MYDOS - beq finish + lda __dos_type ; which DOS? + cmp #ATARIDOS + beq finish + cmp #MYDOS + beq finish - ldy #BUFOFF - lda #0 - sta (DOSVEC),y ; reset buffer offset + ldy #BUFOFF + lda #0 + sta (DOSVEC),y ; reset buffer offset ; Store dummy argument - ldy #LBUF - lda #'X' - sta (DOSVEC),y - iny - lda #ATEOL - sta (DOSVEC),y + ldy #LBUF + lda #'X' + sta (DOSVEC),y + iny + lda #ATEOL + sta (DOSVEC),y ; One extra store to avoid the buggy sequence from OS/A+ DOS: ; <:> => drive number = - iny - sta (DOSVEC),y + iny + sta (DOSVEC),y ; Create crunch vector - ldy #ZCRNAME+1 - lda (DOSVEC),y - sta crvec+1 - iny - lda (DOSVEC),y - sta crvec+2 + ldy #ZCRNAME+1 + lda (DOSVEC),y + sta crvec+1 + iny + lda (DOSVEC),y + sta crvec+2 -crvec: jsr $FFFF ; will be set to crunch vector +crvec: jsr $FFFF ; will be set to crunch vector ; Get default device - ldy #COMFNAM ; COMFNAM is always "Dn:" - lda (DOSVEC),y - sta __defdev - iny - lda (DOSVEC),y - sta __defdev+1 + ldy #COMFNAM ; COMFNAM is always "Dn:" + lda (DOSVEC),y + sta __defdev + iny + lda (DOSVEC),y + sta __defdev+1 ; Return pointer to default device -finish: lda #<__defdev - ldx #>__defdev - rts +finish: lda #<__defdev + ldx #>__defdev + rts - .data + .data ; Default device __defdev: -.ifdef DEFAULT_DEVICE - .byte 'D', '0'+DEFAULT_DEVICE, ':', 0 +.ifdef DEFAULT_DEVICE + .byte 'D', '0'+DEFAULT_DEVICE, ':', 0 .else - .byte "D1:", 0 + .byte "D1:", 0 .endif diff --git a/libsrc/atari/getfd.s b/libsrc/atari/getfd.s index 8327e24ac..a4e34833b 100644 --- a/libsrc/atari/getfd.s +++ b/libsrc/atari/getfd.s @@ -4,15 +4,15 @@ ; allocates a new fd in the indirection table ; - .include "atari.inc" - .include "fd.inc" - .include "_file.inc" - .importzp tmp1 - .import fd_table, fd_index + .include "atari.inc" + .include "fd.inc" + .include "_file.inc" + .importzp tmp1 + .import fd_table, fd_index - .export fdt_to_fdi,getfd + .export fdt_to_fdi,getfd - .code + .code ; fdt_to_fdi ; returns a fd_index entry pointing to the given ft_table entry @@ -20,24 +20,24 @@ ; return C = 0/1 for OK/error ; return fd_index entry in A if OK ; registers destroyed -.proc fdt_to_fdi +.proc fdt_to_fdi - tay - lda #$ff - tax - inx -loop: cmp fd_index,x - beq found - inx - cpx #MAX_FD_INDEX - bcc loop - rts + tay + lda #$ff + tax + inx +loop: cmp fd_index,x + beq found + inx + cpx #MAX_FD_INDEX + bcc loop + rts -found: tya - sta fd_index,x - txa - clc - rts +found: tya + sta fd_index,x + txa + clc + rts .endproc @@ -48,19 +48,19 @@ found: tya ; return C = 0/1 for OK/error ; returns fd in A if OK ; registers destroyed, tmp1 destroyed -.proc getfd +.proc getfd - sta tmp1 ; save fd_table entry - jsr fdt_to_fdi - bcs error + sta tmp1 ; save fd_table entry + jsr fdt_to_fdi + bcs error - pha - lda tmp1 - asl a - asl a ; also clears C - tax - inc fd_table+ft_usa,x ; increment usage counter - pla -error: rts + pha + lda tmp1 + asl a + asl a ; also clears C + tax + inc fd_table+ft_usa,x ; increment usage counter + pla +error: rts .endproc diff --git a/libsrc/atari/gotox.s b/libsrc/atari/gotox.s index 385eead2b..d849bc71a 100644 --- a/libsrc/atari/gotox.s +++ b/libsrc/atari/gotox.s @@ -4,12 +4,12 @@ ; void gotox (unsigned char x); ; - .include "atari.inc" - .export _gotox - .import setcursor + .include "atari.inc" + .export _gotox + .import setcursor _gotox: - sta COLCRS ; Set X - lda #0 - sta COLCRS+1 - jmp setcursor + sta COLCRS ; Set X + lda #0 + sta COLCRS+1 + jmp setcursor diff --git a/libsrc/atari/gotoxy.s b/libsrc/atari/gotoxy.s index 47342d74b..1f00c3b23 100644 --- a/libsrc/atari/gotoxy.s +++ b/libsrc/atari/gotoxy.s @@ -4,16 +4,16 @@ ; void gotoxy (unsigned char x, unsigned char y); ; - .include "atari.inc" + .include "atari.inc" - .export _gotoxy - .import popa - .import setcursor + .export _gotoxy + .import popa + .import setcursor -_gotoxy: ; Set the cursor position - sta ROWCRS ; Set Y - jsr popa ; Get X - sta COLCRS ; Set X - lda #0 - sta COLCRS+1 ; - jmp setcursor +_gotoxy: ; Set the cursor position + sta ROWCRS ; Set Y + jsr popa ; Get X + sta COLCRS ; Set X + lda #0 + sta COLCRS+1 ; + jmp setcursor diff --git a/libsrc/atari/gotoy.s b/libsrc/atari/gotoy.s index 229ba95db..8a17096c6 100644 --- a/libsrc/atari/gotoy.s +++ b/libsrc/atari/gotoy.s @@ -4,10 +4,10 @@ ; void gotoy (unsigned char y); ; - .include "atari.inc" - .export _gotoy - .import setcursor + .include "atari.inc" + .export _gotoy + .import setcursor _gotoy: - sta ROWCRS ; Set Y - jmp setcursor + sta ROWCRS ; Set Y + jmp setcursor diff --git a/libsrc/atari/graphics.s b/libsrc/atari/graphics.s index 120865f82..60f2ff789 100644 --- a/libsrc/atari/graphics.s +++ b/libsrc/atari/graphics.s @@ -7,101 +7,101 @@ ; ; - .export __graphics + .export __graphics - .import findfreeiocb - .import __do_oserror,__oserror - .import fddecusage - .import clriocb - .import fdtoiocb - .import newfd - .importzp tmp1,tmp2,tmp3 + .import findfreeiocb + .import __do_oserror,__oserror + .import fddecusage + .import clriocb + .import fdtoiocb + .import newfd + .importzp tmp1,tmp2,tmp3 - .include "atari.inc" - .include "errno.inc" + .include "atari.inc" + .include "errno.inc" - .code + .code ; set new grapics mode ; gets new mode in A ; returns handle or -1 on error ; uses tmp1, tmp2, tmp3, tmp4 (in subroutines) -.proc __graphics +.proc __graphics -; tax -; and #15 ; get required graphics mode -; cmp #12 -; bcs invmode ; invalid mode -; txa -; and #$c0 ; invalid bits set? -; bne invmode +; tax +; and #15 ; get required graphics mode +; cmp #12 +; bcs invmode ; invalid mode +; txa +; and #$c0 ; invalid bits set? +; bne invmode -; stx tmp1 - sta tmp1 ; remember graphics mode +; stx tmp1 + sta tmp1 ; remember graphics mode -parmok: jsr findfreeiocb - beq iocbok ; we found one +parmok: jsr findfreeiocb + beq iocbok ; we found one - lda #EINVAL -; lda #EINVAL +; lda #scrdev - jsr newfd - tya - tax - bcs doopen ; C set: open needed +iocbok: txa + tay ; move iocb # into Y + lda #3 + sta tmp3 ; name length + 1 + lda #scrdev + jsr newfd + tya + tax + bcs doopen ; C set: open needed - ldx #0 - lda tmp2 ; get fd used - jsr fdtoiocb - tax + ldx #0 + lda tmp2 ; get fd used + jsr fdtoiocb + tax -doopen: txa - ;brk - pha - jsr clriocb - pla - tax - lda #scrdev - sta ICBAH,x - lda #OPEN - sta ICCOM,x - lda tmp1 ; get requested graphics mode - and #15 - sta ICAX2,x - lda tmp1 - and #$30 - eor #$10 - ora #12 - sta ICAX1,x +doopen: txa + ;brk + pha + jsr clriocb + pla + tax + lda #scrdev + sta ICBAH,x + lda #OPEN + sta ICCOM,x + lda tmp1 ; get requested graphics mode + and #15 + sta ICAX2,x + lda tmp1 + and #$30 + eor #$10 + ora #12 + sta ICAX1,x - jsr CIOV - bmi cioerr + jsr CIOV + bmi cioerr - lda tmp2 ; get fd - ldx #0 - stx __oserror - rts + lda tmp2 ; get fd + ldx #0 + stx __oserror + rts -cioerr: jsr fddecusage ; decrement usage counter of fd as open failed - jmp __do_oserror +cioerr: jsr fddecusage ; decrement usage counter of fd as open failed + jmp __do_oserror -.endproc ; __graphics +.endproc ; __graphics - .rodata + .rodata -scrdev: .byte "S:", 0 +scrdev: .byte "S:", 0 diff --git a/libsrc/atari/initcwd.s b/libsrc/atari/initcwd.s index 64009995f..19df6a5a4 100644 --- a/libsrc/atari/initcwd.s +++ b/libsrc/atari/initcwd.s @@ -2,30 +2,30 @@ ; Stefan Haubenthal, 2008-04-29 ; - .export initcwd - .import findfreeiocb - .import __cwd - .include "atari.inc" + .export initcwd + .import findfreeiocb + .import __cwd + .include "atari.inc" -.proc initcwd +.proc initcwd - jsr findfreeiocb - bne oserr - lda #48 - sta ICCOM,x - lda #<__cwd - sta ICBLL,x - lda #>__cwd - sta ICBLH,x - jsr CIOV - bmi oserr - ldx #0 ; ATEOL -> \0 -: lda __cwd,x - inx - cmp #ATEOL - bne :- - lda #0 - sta __cwd-1,x -oserr: rts + jsr findfreeiocb + bne oserr + lda #48 + sta ICCOM,x + lda #<__cwd + sta ICBLL,x + lda #>__cwd + sta ICBLH,x + jsr CIOV + bmi oserr + ldx #0 ; ATEOL -> \0 +: lda __cwd,x + inx + cmp #ATEOL + bne :- + lda #0 + sta __cwd-1,x +oserr: rts .endproc diff --git a/libsrc/atari/inviocb.s b/libsrc/atari/inviocb.s index b7954dd11..c1c27ee03 100644 --- a/libsrc/atari/inviocb.s +++ b/libsrc/atari/inviocb.s @@ -1,10 +1,10 @@ ; ; set EINVAL error code and returns -1 ; - .include "errno.inc" + .include "errno.inc" - .export __inviocb + .export __inviocb __inviocb: - lda #IRQStub - jsr SETVBV - rts + lda VVBLKI + ldx VVBLKI+1 + sta IRQInd+1 + stx IRQInd+2 + lda #6 + ldy #IRQStub + jsr SETVBV + rts ; ------------------------------------------------------------------------ .code doneirq: - lda #6 - ldy IRQInd+1 - ldx IRQInd+2 - jsr SETVBV - rts + lda #6 + ldy IRQInd+1 + ldx IRQInd+2 + jsr SETVBV + rts ; ------------------------------------------------------------------------ -.segment "LOWCODE" +.segment "LOWCODE" IRQStub: - cld ; Just to be sure - jsr callirq ; Call the functions - jmp IRQInd ; Jump to the saved IRQ vector + cld ; Just to be sure + jsr callirq ; Call the functions + jmp IRQInd ; Jump to the saved IRQ vector ; ------------------------------------------------------------------------ .data -IRQInd: jmp $0000 +IRQInd: jmp $0000 diff --git a/libsrc/atari/joy/atarimj8.s b/libsrc/atari/joy/atarimj8.s index 863737beb..777a52615 100644 --- a/libsrc/atari/joy/atarimj8.s +++ b/libsrc/atari/joy/atarimj8.s @@ -7,48 +7,48 @@ ; Using code from Carsten Strotmann and help from Christian Groessler ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" - .include "joy-error.inc" - .include "atari.inc" + .include "joy-kernel.inc" + .include "joy-error.inc" + .include "atari.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ ; Header. Includes jump table -.segment "JUMPTABLE" +.segment "JUMPTABLE" ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) - .byte $02 ; JOY_UP - .byte $04 ; JOY_DOWN - .byte $08 ; JOY_LEFT - .byte $10 ; JOY_RIGHT - .byte $01 ; JOY_FIRE - .byte $00 ; JOY_FIRE2 not available - .byte $00 ; Future expansion - .byte $00 ; Future expansion + .byte $02 ; JOY_UP + .byte $04 ; JOY_DOWN + .byte $08 ; JOY_LEFT + .byte $10 ; JOY_RIGHT + .byte $01 ; JOY_FIRE + .byte $00 ; JOY_FIRE2 not available + .byte $00 ; Future expansion + .byte $00 ; Future expansion ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr COUNT - .addr READJOY - .addr 0 ; IRQ entry not used + .addr INSTALL + .addr UNINSTALL + .addr COUNT + .addr READJOY + .addr 0 ; IRQ entry not used ; ------------------------------------------------------------------------ ; Constants -JOY_COUNT = 8 ; Number of joysticks we support +JOY_COUNT = 8 ; Number of joysticks we support ; ------------------------------------------------------------------------ @@ -65,15 +65,15 @@ JOY_COUNT = 8 ; Number of joysticks we support ; INSTALL: - lda #$30 - sta PACTL - lda #$F0 - sta PORTA - lda #$34 - sta PACTL - lda #JOY_ERR_OK - ldx #0 -; rts ; Run into UNINSTALL instead + lda #$30 + sta PACTL + lda #$F0 + sta PORTA + lda #$34 + sta PACTL + lda #JOY_ERR_OK + ldx #0 +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -81,7 +81,7 @@ INSTALL: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ @@ -89,27 +89,27 @@ UNINSTALL: ; COUNT: - lda #JOY_COUNT - ldx #0 - rts + lda #JOY_COUNT + ldx #0 + rts ; ------------------------------------------------------------------------ ; READ: Read a particular joystick passed in A. ; READJOY: - asl a - asl a - asl a - asl a - sta PORTA + asl a + asl a + asl a + asl a + sta PORTA ; Read joystick - lda PORTA ; get position - and #%00001111 - asl a - ora TRIG0 ; add button information - eor #%00011111 - ldx #0 ; fix X - rts + lda PORTA ; get position + and #%00001111 + asl a + ora TRIG0 ; add button information + eor #%00011111 + ldx #0 ; fix X + rts diff --git a/libsrc/atari/joy/ataristd.s b/libsrc/atari/joy/ataristd.s index 53eff79fe..caca34cc5 100644 --- a/libsrc/atari/joy/ataristd.s +++ b/libsrc/atari/joy/ataristd.s @@ -6,48 +6,48 @@ ; Using the readjoy code from Christian Groessler ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" - .include "joy-error.inc" - .include "atari.inc" + .include "joy-kernel.inc" + .include "joy-error.inc" + .include "atari.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ ; Header. Includes jump table -.segment "JUMPTABLE" +.segment "JUMPTABLE" ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) - .byte $01 ; JOY_UP - .byte $02 ; JOY_DOWN - .byte $04 ; JOY_LEFT - .byte $08 ; JOY_RIGHT - .byte $10 ; JOY_FIRE - .byte $00 ; JOY_FIRE2 not available - .byte $00 ; Future expansion - .byte $00 ; Future expansion + .byte $01 ; JOY_UP + .byte $02 ; JOY_DOWN + .byte $04 ; JOY_LEFT + .byte $08 ; JOY_RIGHT + .byte $10 ; JOY_FIRE + .byte $00 ; JOY_FIRE2 not available + .byte $00 ; Future expansion + .byte $00 ; Future expansion ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr COUNT - .addr READJOY - .addr 0 ; IRQ entry not used + .addr INSTALL + .addr UNINSTALL + .addr COUNT + .addr READJOY + .addr 0 ; IRQ entry not used ; ------------------------------------------------------------------------ ; Constants -JOY_COUNT = 4 ; Number of joysticks we support +JOY_COUNT = 4 ; Number of joysticks we support ; ------------------------------------------------------------------------ @@ -64,9 +64,9 @@ JOY_COUNT = 4 ; Number of joysticks we support ; INSTALL: - lda #JOY_ERR_OK - ldx #0 -; rts ; Run into UNINSTALL instead + lda #JOY_ERR_OK + ldx #0 +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -74,7 +74,7 @@ INSTALL: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ @@ -82,31 +82,31 @@ UNINSTALL: ; COUNT: - lda #JOY_COUNT - ldx $fcd8 - cpx #$a2 - beq _400800 - lsr a ; XL and newer machines only have 2 ports + lda #JOY_COUNT + ldx $fcd8 + cpx #$a2 + beq _400800 + lsr a ; XL and newer machines only have 2 ports _400800: - ldx #0 - rts + ldx #0 + rts ; ------------------------------------------------------------------------ ; READ: Read a particular joystick passed in A. ; READJOY: - and #3 ; fix joystick number - tax ; Joystick number (0-3) into X + and #3 ; fix joystick number + tax ; Joystick number (0-3) into X ; Read joystick - lda STRIG0,x ; get button - asl a - asl a - asl a - asl a - ora STICK0,x ; add position information - eor #$1F - ldx #0 ; fix X - rts + lda STRIG0,x ; get button + asl a + asl a + asl a + asl a + ora STICK0,x ; add position information + eor #$1F + ldx #0 ; fix X + rts diff --git a/libsrc/atari/joy_stat_stddrv.s b/libsrc/atari/joy_stat_stddrv.s index 2eca6d6b4..dffe40ebf 100644 --- a/libsrc/atari/joy_stat_stddrv.s +++ b/libsrc/atari/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _ataristd_joy + .export _joy_static_stddrv + .import _ataristd_joy .rodata diff --git a/libsrc/atari/joy_stddrv.s b/libsrc/atari/joy_stddrv.s index 8be458b85..aec33bf57 100644 --- a/libsrc/atari/joy_stddrv.s +++ b/libsrc/atari/joy_stddrv.s @@ -6,8 +6,8 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "ataristd.joy" +_joy_stddrv: .asciiz "ataristd.joy" diff --git a/libsrc/atari/kbhit.s b/libsrc/atari/kbhit.s index 2aff6dad3..09ea8a905 100644 --- a/libsrc/atari/kbhit.s +++ b/libsrc/atari/kbhit.s @@ -4,19 +4,19 @@ ; unsigned char kbhit (void); ; - .export _kbhit - .import return1 + .export _kbhit + .import return1 - .include "atari.inc" + .include "atari.inc" .proc _kbhit - ldx CH ; last pressed key - inx ; 255 means "no key" - bne L1 + ldx CH ; last pressed key + inx ; 255 means "no key" + bne L1 txa ; X = A = 0 rts -L1: jmp return1 +L1: jmp return1 .endproc diff --git a/libsrc/atari/lseek.s b/libsrc/atari/lseek.s index 244095969..bf934294c 100644 --- a/libsrc/atari/lseek.s +++ b/libsrc/atari/lseek.s @@ -7,178 +7,178 @@ ; - .export _lseek - .import incsp6,__oserror - .import __inviocb,ldax0sp,ldaxysp,fdtoiocb - .import __dos_type - .import fd_table - .importzp sreg,ptr1,ptr2,ptr3,ptr4 - .importzp tmp1,tmp2,tmp3 - .include "atari.inc" - .include "errno.inc" - .include "fd.inc" + .export _lseek + .import incsp6,__oserror + .import __inviocb,ldax0sp,ldaxysp,fdtoiocb + .import __dos_type + .import fd_table + .importzp sreg,ptr1,ptr2,ptr3,ptr4 + .importzp tmp1,tmp2,tmp3 + .include "atari.inc" + .include "errno.inc" + .include "fd.inc" ; seeking not supported, return -1 and ENOSYS errno value -no_supp:jsr incsp6 - lda #EUNKNOWN - rts +inverr: lda #EUNKNOWN + rts .endproc .rodata maptable: - .byte EINTR ;BRKABT = 128 ;($80) BREAK key abort - .byte EBUSY ;PRVOPN = 129 ;($81) IOCB already open error - .byte ENODEV ;NONDEV = 130 ;($82) nonexistent device error - .byte EACCES ;WRONLY = 131 ;($83) IOCB opened for write only error - .byte ENOSYS ;NVALID = 132 ;($84) invalid command error - .byte EINVAL ;NOTOPN = 133 ;($85) device/file not open error - .byte EINVAL ;BADIOC = 134 ;($86) invalid IOCB index error - .byte EACCES ;RDONLY = 135 ;($87) IOCB opened for read only error - .byte EINVAL ;EOFERR = 136 ;($88) end of file error (should never come, - ; specially handled by read.s) - .byte EIO ;TRNRCD = 137 ;($89) truncated record error - .byte EIO ;TIMOUT = 138 ;($8A) peripheral device timeout error - .byte EIO ;DNACK = 139 ;($8B) device does not acknowledge command - .byte EIO ;FRMERR = 140 ;($8C) serial bus framing error - .byte EINVAL ;CRSROR = 141 ;($8D) cursor out of range error - .byte EIO ;OVRRUN = 142 ;($8E) serial bus data overrun error - .byte EIO ;CHKERR = 143 ;($8F) serial bus checksum error - .byte EIO ;DERROR = 144 ;($90) general device failure - .byte EINVAL ;BADMOD = 145 ;($91) bad screen mode number error - .byte ENOSYS ;FNCNOT = 146 ;($92) function not implemented in handler - .byte ENOMEM ;SCRMEM = 147 ;($93) insufficient memory for screen mode + .byte EINTR ;BRKABT = 128 ;($80) BREAK key abort + .byte EBUSY ;PRVOPN = 129 ;($81) IOCB already open error + .byte ENODEV ;NONDEV = 130 ;($82) nonexistent device error + .byte EACCES ;WRONLY = 131 ;($83) IOCB opened for write only error + .byte ENOSYS ;NVALID = 132 ;($84) invalid command error + .byte EINVAL ;NOTOPN = 133 ;($85) device/file not open error + .byte EINVAL ;BADIOC = 134 ;($86) invalid IOCB index error + .byte EACCES ;RDONLY = 135 ;($87) IOCB opened for read only error + .byte EINVAL ;EOFERR = 136 ;($88) end of file error (should never come, + ; specially handled by read.s) + .byte EIO ;TRNRCD = 137 ;($89) truncated record error + .byte EIO ;TIMOUT = 138 ;($8A) peripheral device timeout error + .byte EIO ;DNACK = 139 ;($8B) device does not acknowledge command + .byte EIO ;FRMERR = 140 ;($8C) serial bus framing error + .byte EINVAL ;CRSROR = 141 ;($8D) cursor out of range error + .byte EIO ;OVRRUN = 142 ;($8E) serial bus data overrun error + .byte EIO ;CHKERR = 143 ;($8F) serial bus checksum error + .byte EIO ;DERROR = 144 ;($90) general device failure + .byte EINVAL ;BADMOD = 145 ;($91) bad screen mode number error + .byte ENOSYS ;FNCNOT = 146 ;($92) function not implemented in handler + .byte ENOMEM ;SCRMEM = 147 ;($93) insufficient memory for screen mode ; codes below taken from "Mein Atari Computer" (german version of "Your Atari Computer") ; also SpartaDOS codes from http://www.atari-central.com/programming/cio_errors.txt ; MyDOS and XDOS codes from Stefan Haubenthal - .byte EUNKNOWN ; 148 - [SpartaDOS] unrecognized disk format - .byte EUNKNOWN ; 149 - [SpartaDOS] disk created by incompatible version of SD - .byte EBUSY ; 150 - serial port already open - ; [SpartaDOS] directory not found - .byte EACCES ; 151 - concurrent mode I/O not enabled (serial) - ; [SpartaDOS] file exists - .byte EINVAL ; 152 - invalid buffer address for concurrent mode - ; [SpartaDOS] not binary format - .byte EAGAIN ; 153 - concurrent mode enabled (and another access tried) - .byte EACCES ; 154 - concurrent mode I/O not active (serial) - ; [SpartaDOS X] loader symbol not defined - .byte EUNKNOWN ; 155 - haven't found documentation - .byte EUNKNOWN ; 156 - [SpartaDOS X] bad parameter - .byte EUNKNOWN ; 157 - haven't found documentation - .byte EUNKNOWN ; 158 - [SpartaDOS X] out of memory - .byte EUNKNOWN ; 159 - haven't found documentation - .byte ENOENT ; 160 - drive number error (DOS) - .byte EMFILE ; 161 - too many open files - .byte ENOSPC ; 162 - disk full - .byte EIO ; 163 - unrecoverable system data I/O error - .byte ESPIPE ; 164 - file number mismatch (inv. seek or disk data strucs damaged) - .byte ENOENT ; 165 - invalid file name (e.g. lowercase) - .byte ESPIPE ; 166 - point data length error - .byte EACCES ; 167 - file locked (read-only) - .byte ENOSYS ; 168 - command invalid for disk - .byte ENOSPC ; 169 - directory full - .byte ENOENT ; 170 - file not found - .byte ESPIPE ; 171 - point command invalid - .byte EEXIST ; 172 - [MYDOS] already exists in parent directory - .byte EUNKNOWN ; 173 - bad disk - format couldn't complete - .byte EUNKNOWN ; 174 - [MYDOS] directory not in parent directory - .byte EUNKNOWN ; 175 - [MYDOS] directory not empty - .byte EUNKNOWN ; 176 - [DOS 3] incompatible file system - .byte EUNKNOWN ; 177 - haven't found documentation - .byte EUNKNOWN ; 178 - haven't found documentation - .byte EUNKNOWN ; 179 - haven't found documentation - .byte EUNKNOWN ; 180 - not a binary file - .byte EUNKNOWN ; 181 - [MYDOS] invalid address range - .byte EUNKNOWN ; 182 - [XDOS] invalid parameter + .byte EUNKNOWN ; 148 - [SpartaDOS] unrecognized disk format + .byte EUNKNOWN ; 149 - [SpartaDOS] disk created by incompatible version of SD + .byte EBUSY ; 150 - serial port already open + ; [SpartaDOS] directory not found + .byte EACCES ; 151 - concurrent mode I/O not enabled (serial) + ; [SpartaDOS] file exists + .byte EINVAL ; 152 - invalid buffer address for concurrent mode + ; [SpartaDOS] not binary format + .byte EAGAIN ; 153 - concurrent mode enabled (and another access tried) + .byte EACCES ; 154 - concurrent mode I/O not active (serial) + ; [SpartaDOS X] loader symbol not defined + .byte EUNKNOWN ; 155 - haven't found documentation + .byte EUNKNOWN ; 156 - [SpartaDOS X] bad parameter + .byte EUNKNOWN ; 157 - haven't found documentation + .byte EUNKNOWN ; 158 - [SpartaDOS X] out of memory + .byte EUNKNOWN ; 159 - haven't found documentation + .byte ENOENT ; 160 - drive number error (DOS) + .byte EMFILE ; 161 - too many open files + .byte ENOSPC ; 162 - disk full + .byte EIO ; 163 - unrecoverable system data I/O error + .byte ESPIPE ; 164 - file number mismatch (inv. seek or disk data strucs damaged) + .byte ENOENT ; 165 - invalid file name (e.g. lowercase) + .byte ESPIPE ; 166 - point data length error + .byte EACCES ; 167 - file locked (read-only) + .byte ENOSYS ; 168 - command invalid for disk + .byte ENOSPC ; 169 - directory full + .byte ENOENT ; 170 - file not found + .byte ESPIPE ; 171 - point command invalid + .byte EEXIST ; 172 - [MYDOS] already exists in parent directory + .byte EUNKNOWN ; 173 - bad disk - format couldn't complete + .byte EUNKNOWN ; 174 - [MYDOS] directory not in parent directory + .byte EUNKNOWN ; 175 - [MYDOS] directory not empty + .byte EUNKNOWN ; 176 - [DOS 3] incompatible file system + .byte EUNKNOWN ; 177 - haven't found documentation + .byte EUNKNOWN ; 178 - haven't found documentation + .byte EUNKNOWN ; 179 - haven't found documentation + .byte EUNKNOWN ; 180 - not a binary file + .byte EUNKNOWN ; 181 - [MYDOS] invalid address range + .byte EUNKNOWN ; 182 - [XDOS] invalid parameter - .byte EINVAL ; 183 - dummy (used by cc65 rtl, see sysremove.s) + .byte EINVAL ; 183 - dummy (used by cc65 rtl, see sysremove.s) MAX_OSERR_VAL = (* - maptable) diff --git a/libsrc/atari/ostype.s b/libsrc/atari/ostype.s index 86e88811d..d93b3ab88 100644 --- a/libsrc/atari/ostype.s +++ b/libsrc/atari/ostype.s @@ -4,149 +4,149 @@ ; ; unsigned char get_ostype(void) ; -; x x x x x x x x - 8 bit flag +; x x x x x x x x - 8 bit flag ; | | | | | | | | ; | | | | | +-+-+-- main OS rev. ; | | +-+-+-------- minor OS rev. ; +-+-------------- unused ; ; main OS rev.: -; 000 - unknown -; 001 - 400/800 ROM -; 010 - 1200XL ROM -; 011 - XL/XE ROM -; 1xx - unassigned +; 000 - unknown +; 001 - 400/800 ROM +; 010 - 1200XL ROM +; 011 - XL/XE ROM +; 1xx - unassigned ; minor OS rev.: (depending on main OS rev.); -; 400/800: -; 000 - unknown -; 001 - Rev. A PAL -; 010 - Rev. B PAL -; 011 - Rev. A NTSC -; 100 - Rev. B NTSC -; 101 - unassigned (up to 111) -; 1200XL: -; 000 - unknown -; 001 - Rev. 10 -; 010 - Rev. 11 -; 011 - unassigned (up to 111) -; XL/XE: -; 000 - unknown -; 001 - Rev. 1 -; 010 - Rev. 2 -; 011 - Rev. 3 -; 100 - Rev. 4 -; 101 - unassigned (up to 111) +; 400/800: +; 000 - unknown +; 001 - Rev. A PAL +; 010 - Rev. B PAL +; 011 - Rev. A NTSC +; 100 - Rev. B NTSC +; 101 - unassigned (up to 111) +; 1200XL: +; 000 - unknown +; 001 - Rev. 10 +; 010 - Rev. 11 +; 011 - unassigned (up to 111) +; XL/XE: +; 000 - unknown +; 001 - Rev. 1 +; 010 - Rev. 2 +; 011 - Rev. 3 +; 100 - Rev. 4 +; 101 - unassigned (up to 111) ; - .export _get_ostype + .export _get_ostype -.proc _get_ostype +.proc _get_ostype - lda $fcd8 - cmp #$a2 - beq _400800 - lda $fff1 - cmp #1 - beq _1200xl - lda $fff7 - cmp #1 - bcc _unknown - cmp #5 - bcs _unknown + lda $fcd8 + cmp #$a2 + beq _400800 + lda $fff1 + cmp #1 + beq _1200xl + lda $fff7 + cmp #1 + bcc _unknown + cmp #5 + bcs _unknown ;XL/XE ROM - sec - asl a - asl a - asl a - and #%00111000 - ora #%11 -_fin: ldx #0 - rts + sec + asl a + asl a + asl a + and #%00111000 + ora #%11 +_fin: ldx #0 + rts ; unknown ROM _unknown: - lda #0 - tax - rts + lda #0 + tax + rts ; 1200XL ROM _1200xl: - lda $fff7 ; revision # - cmp #10 - beq _1200_10 - cmp #11 - beq _1200_11 - lda #0 ; for unknown - beq _1200_fin + lda $fff7 ; revision # + cmp #10 + beq _1200_10 + cmp #11 + beq _1200_11 + lda #0 ; for unknown + beq _1200_fin _1200_10: - lda #%00001000 - bne _1200_fin + lda #%00001000 + bne _1200_fin _1200_11: - lda #%00010000 + lda #%00010000 _1200_fin: - ora #%010 - bne _fin + ora #%010 + bne _fin ; 400/800 ROM _400800: - lda $fff8 - ldx $fff9 - cmp #$dd - bne _400800_1 - cpx #$57 - bne _400800_unknown + lda $fff8 + ldx $fff9 + cmp #$dd + bne _400800_1 + cpx #$57 + bne _400800_unknown ; 400/800 NTSC Rev. A - lda #%00011001 - bne _fin + lda #%00011001 + bne _fin ; 400/800 unknown _400800_unknown: - lda #%00000001 - bne _fin + lda #%00000001 + bne _fin _400800_1: - cmp #$d6 - bne _400800_2 - cpx #$57 - bne _400800_unknown + cmp #$d6 + bne _400800_2 + cpx #$57 + bne _400800_unknown ; 400/800 PAL Rev. A - lda #%00001001 - bne _fin + lda #%00001001 + bne _fin _400800_2: - cmp #$f3 - bne _400800_3 - cpx #$e6 - bne _400800_unknown + cmp #$f3 + bne _400800_3 + cpx #$e6 + bne _400800_unknown ; 400/800 NTSC Rev. B - lda #%00100001 - bne _fin + lda #%00100001 + bne _fin _400800_3: - cmp #$22 - bne _400800_unknown - cpx #$58 - bne _400800_unknown + cmp #$22 + bne _400800_unknown + cpx #$58 + bne _400800_unknown ; 400/800 PAL Rev. B - lda #%00010001 - bne _fin + lda #%00010001 + bne _fin .endproc diff --git a/libsrc/atari/posixdirent.s b/libsrc/atari/posixdirent.s index cb84fca71..3417e4bfc 100644 --- a/libsrc/atari/posixdirent.s +++ b/libsrc/atari/posixdirent.s @@ -1,161 +1,161 @@ ; Native: Shawn Jefferson, December 2005 ; POSIX: Stefan Haubenthal, April 2008 - .include "atari.inc" - .export _opendir, _readdir, _closedir - .import findfreeiocb, clriocb - .import __oserror, return0, __do_oserror - .importzp ptr1, tmp1 + .include "atari.inc" + .export _opendir, _readdir, _closedir + .import findfreeiocb, clriocb + .import __oserror, return0, __do_oserror + .importzp ptr1, tmp1 .ifdef DEFAULT_DEVICE - .import __defdev + .import __defdev .endif -.proc _opendir - sta ptr1 - stx ptr1+1 - jsr findfreeiocb - beq @iocbok - bne cioerr -@iocbok: stx diriocb - jsr clriocb - ldx diriocb - ldy #0 ; '.' -> "D:*.*" - lda (ptr1),y - cmp #'.' - bne @use_parm +.proc _opendir + sta ptr1 + stx ptr1+1 + jsr findfreeiocb + beq @iocbok + bne cioerr +@iocbok: stx diriocb + jsr clriocb + ldx diriocb + ldy #0 ; '.' -> "D:*.*" + lda (ptr1),y + cmp #'.' + bne @use_parm ; "." was given as parameter, use default device/dir .ifdef DEFAULT_DEVICE - ; construct a "Dn:*.*" like string from the default drive - lda __defdev+1 - sta dddefdev+1 ; copy drive number (overwrite 2nd 'D') - lda #dddefdev - sta ICBAH,x - bne @cont + ; construct a "Dn:*.*" like string from the default drive + lda __defdev+1 + sta dddefdev+1 ; copy drive number (overwrite 2nd 'D') + lda #dddefdev + sta ICBAH,x + bne @cont .else - lda #defdev - sta ICBAH,x - bne @cont + lda #defdev + sta ICBAH,x + bne @cont .endif -@use_parm: lda ptr1 - sta ICBAL,x - lda ptr1+1 - sta ICBAH,x +@use_parm: lda ptr1 + sta ICBAL,x + lda ptr1+1 + sta ICBAH,x -@cont: lda #OPEN - sta ICCOM,x - lda #OPNIN|DIRECT - sta ICAX1,x - jsr CIOV - bmi cioerr - lda #0 - sta __oserror - tax - lda diriocb - rts +@cont: lda #OPEN + sta ICCOM,x + lda #OPNIN|DIRECT + sta ICAX1,x + jsr CIOV + bmi cioerr + lda #0 + sta __oserror + tax + lda diriocb + rts .endproc -cioerr: sty __oserror - jmp return0 +cioerr: sty __oserror + jmp return0 -.proc _readdir - tax - lda #GETREC - sta ICCOM,x - lda #entry - sta ICBAH,x - sta ptr1+1 - lda #DSCTSZ - sta ICBLL,x - lda #0 - sta ICBLH,x - jsr CIOV - bmi cioerr - ldy #0 ; FREE SECTORS - lda (ptr1),y - cmp #'0' - bcs cioerr - dey -@next: iny ; remove trailing spaces - iny - iny - lda (ptr1),y - dey - dey - sta (ptr1),y - cpy #8 - bcs @break - cmp #' ' - bne @next +.proc _readdir + tax + lda #GETREC + sta ICCOM,x + lda #entry + sta ICBAH,x + sta ptr1+1 + lda #DSCTSZ + sta ICBLL,x + lda #0 + sta ICBLH,x + jsr CIOV + bmi cioerr + ldy #0 ; FREE SECTORS + lda (ptr1),y + cmp #'0' + bcs cioerr + dey +@next: iny ; remove trailing spaces + iny + iny + lda (ptr1),y + dey + dey + sta (ptr1),y + cpy #8 + bcs @break + cmp #' ' + bne @next -@break: lda #'.' ; extension dot - sta (ptr1),y - iny ; copy extension - sty tmp1 - ldy #10 - lda (ptr1),y - cmp #' ' - bne @hasext +@break: lda #'.' ; extension dot + sta (ptr1),y + iny ; copy extension + sty tmp1 + ldy #10 + lda (ptr1),y + cmp #' ' + bne @hasext ; no extension present: remove the trailing dot and be done - ldy tmp1 - dey - bne @done + ldy tmp1 + dey + bne @done -@hasext: jsr copychar - ldy #13 ; d_type - sta (ptr1),y - ldy #11 - jsr copychar - ldy #12 - jsr copychar +@hasext: jsr copychar + ldy #13 ; d_type + sta (ptr1),y + ldy #11 + jsr copychar + ldy #12 + jsr copychar -@done: lda #0 ; end of string - sta (ptr1),y - lda ptr1 - ldx ptr1+1 - rts +@done: lda #0 ; end of string + sta (ptr1),y + lda ptr1 + ldx ptr1+1 + rts -copychar: lda (ptr1),y ; src=y dest=tmp1 - ldy tmp1 - cmp #' ' - beq @break - sta (ptr1),y - iny - sty tmp1 -@break: rts +copychar: lda (ptr1),y ; src=y dest=tmp1 + ldy tmp1 + cmp #' ' + beq @break + sta (ptr1),y + iny + sty tmp1 +@break: rts .endproc -.proc _closedir - tax - lda #CLOSE - sta ICCOM,x - jsr CIOV - bmi @cioerr - ldx #0 - stx __oserror ; clear system specific error code - txa - rts -@cioerr: jmp __do_oserror +.proc _closedir + tax + lda #CLOSE + sta ICCOM,x + jsr CIOV + bmi @cioerr + ldx #0 + stx __oserror ; clear system specific error code + txa + rts +@cioerr: jmp __do_oserror .endproc - .data + .data .ifdef DEFAULT_DEVICE -dddefdev: .byte "D" +dddefdev: .byte "D" .endif -defdev: .asciiz "D:*.*" +defdev: .asciiz "D:*.*" - .bss -diriocb: .res 1 -entry: .res DSCTSZ + .bss +diriocb: .res 1 +entry: .res DSCTSZ diff --git a/libsrc/atari/randomize.s b/libsrc/atari/randomize.s index 067bcc151..ed4400b55 100644 --- a/libsrc/atari/randomize.s +++ b/libsrc/atari/randomize.s @@ -5,13 +5,13 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand - .include "atari.inc" + .include "atari.inc" -__randomize: - ldx VCOUNT ; Use vertical line counter as high byte - lda RTCLOK+2 ; Use clock as low byte - jmp _srand ; Initialize generator +__randomize: + ldx VCOUNT ; Use vertical line counter as high byte + lda RTCLOK+2 ; Use clock as low byte + jmp _srand ; Initialize generator diff --git a/libsrc/atari/read.s b/libsrc/atari/read.s index 19d33cb66..acb415efd 100644 --- a/libsrc/atari/read.s +++ b/libsrc/atari/read.s @@ -4,120 +4,120 @@ ; int __fastcall__ read(int fd,void *buf,int count) ; - .include "atari.inc" - .import __rwsetup,__do_oserror,__inviocb,__oserror - .export _read + .include "atari.inc" + .import __rwsetup,__do_oserror,__inviocb,__oserror + .export _read -_read: jsr __rwsetup ; do common setup for read and write - beq done ; if size 0, it's a no-op - cpx #$FF ; invalid iocb? - beq _inviocb +_read: jsr __rwsetup ; do common setup for read and write + beq done ; if size 0, it's a no-op + cpx #$FF ; invalid iocb? + beq _inviocb -.ifdef LINEBUF - ; E: should be always at IOCB #0 - ; fixme: what happens when user closes and reopens stdin? - cpx #0 ; E: handler (line oriented keyboard input)? - beq do_line +.ifdef LINEBUF + ; E: should be always at IOCB #0 + ; fixme: what happens when user closes and reopens stdin? + cpx #0 ; E: handler (line oriented keyboard input)? + beq do_line .endif - lda #GETCHR ; iocb command code - sta ICCOM,x - jsr CIOV ; read it - bpl done - cpy #EOFERR ; eof is treated specially - beq done - jmp __do_oserror ; update errno + lda #GETCHR ; iocb command code + sta ICCOM,x + jsr CIOV ; read it + bpl done + cpy #EOFERR ; eof is treated specially + beq done + jmp __do_oserror ; update errno -done: lda ICBLL,x ; buf len lo - pha ; save - lda ICBLH,x ; get buf len hi - tax ; to X -okdone: lda #0 - sta __oserror ; clear system dependend error code - pla ; get buf len lo - rts +done: lda ICBLL,x ; buf len lo + pha ; save + lda ICBLH,x ; get buf len hi + tax ; to X +okdone: lda #0 + sta __oserror ; clear system dependend error code + pla ; get buf len lo + rts _inviocb: - jmp __inviocb + jmp __inviocb -.ifdef LINEBUF +.ifdef LINEBUF ; line oriented input - .segment "EXTZP" : zeropage + .segment "EXTZP" : zeropage -index: .res 1 ; index into line buffer -buflen: .res 1 ; length of used part of buffer -cbs: .res 1 ; current buffer size: buflen - index -dataptr:.res 2 ; temp pointer to user buffer -copylen:.res 1 ; temp counter +index: .res 1 ; index into line buffer +buflen: .res 1 ; length of used part of buffer +cbs: .res 1 ; current buffer size: buflen - index +dataptr:.res 2 ; temp pointer to user buffer +copylen:.res 1 ; temp counter - .bss + .bss -linebuf:.res LINEBUF ; the line buffer +linebuf:.res LINEBUF ; the line buffer .code do_line: - lda buflen ; line buffer active? - bne use_buf ; yes, get data from there + lda buflen ; line buffer active? + bne use_buf ; yes, get data from there - ; save user buffer address & length - ; update IOCB to point to line buffer - lda ICBLL,x - pha - lda #LINEBUF - sta ICBLL,x - ;-------- - lda ICBLH,x - pha - lda #0 - sta ICBLH,x - ;-------- - lda ICBAL,x - pha - lda #linebuf - sta ICBAH,x + ; save user buffer address & length + ; update IOCB to point to line buffer + lda ICBLL,x + pha + lda #LINEBUF + sta ICBLL,x + ;-------- + lda ICBLH,x + pha + lda #0 + sta ICBLH,x + ;-------- + lda ICBAL,x + pha + lda #linebuf + sta ICBAH,x - lda #GETREC - sta ICCOM,x - jsr CIOV ; read input data - bpl newbuf - cpy #EOFERR ; eof is treated specially - beq newbuf - pla ; fix stack - pla - pla - pla - jmp __do_oserror ; update errno + lda #GETREC + sta ICCOM,x + jsr CIOV ; read input data + bpl newbuf + cpy #EOFERR ; eof is treated specially + beq newbuf + pla ; fix stack + pla + pla + pla + jmp __do_oserror ; update errno newbuf: - lda ICBLL,x ; get # of bytes read - sta buflen - lda #0 - sta index ; fresh buffer + lda ICBLL,x ; get # of bytes read + sta buflen + lda #0 + sta index ; fresh buffer - ; restore user buffer address & length - pla - sta ICBAH,x - ;-------- - pla - sta ICBAL,x - ;-------- - pla - sta ICBLH,x - ;-------- - pla - sta ICBLL,x + ; restore user buffer address & length + pla + sta ICBAH,x + ;-------- + pla + sta ICBAL,x + ;-------- + pla + sta ICBLH,x + ;-------- + pla + sta ICBLL,x - ; fall into use_buf - lda buflen + ; fall into use_buf + lda buflen ; return bytes from line buffer ; use buflen and index to access buffer @@ -125,58 +125,58 @@ newbuf: ; use dataptr as a temporary pointer use_buf: - sec - sbc index ; size of unread data in the buffer - sta cbs + sec + sbc index ; size of unread data in the buffer + sta cbs - lda ICBLL,x ; buf len lo - cmp cbs ; larger than buffer size? - beq bl1 - bcs btsmall ; yes, adjust length + lda ICBLL,x ; buf len lo + cmp cbs ; larger than buffer size? + beq bl1 + bcs btsmall ; yes, adjust length -bl1: lda ICBLH,x ; get buf len hi - bne btsmall ; buffer too small: buffer contents < read size +bl1: lda ICBLH,x ; get buf len hi + bne btsmall ; buffer too small: buffer contents < read size ; copy ICBLL,x bytes icbll_copy: - lda ICBAL,x ; buffer address - sta dataptr - lda ICBAH,x ; buffer address - sta dataptr+1 - lda ICBLL,x - sta copylen - pha ; remember for return value - ldy #0 - ldx index + lda ICBAL,x ; buffer address + sta dataptr + lda ICBAH,x ; buffer address + sta dataptr+1 + lda ICBLL,x + sta copylen + pha ; remember for return value + ldy #0 + ldx index -copy: lda linebuf,x - sta (dataptr),y - iny - inx - dec copylen - bne copy +copy: lda linebuf,x + sta (dataptr),y + iny + inx + dec copylen + bne copy - pla ; length - pha ; save length to return at okdone + pla ; length + pha ; save length to return at okdone - clc - adc index - sta index - cmp buflen ; buffer used up? - bcc c1 ; not yet + clc + adc index + sta index + cmp buflen ; buffer used up? + bcc c1 ; not yet - lda #0 - sta buflen ; indicate empty line buffer + lda #0 + sta buflen ; indicate empty line buffer -c1: ldx #0 - jmp okdone ; return to caller +c1: ldx #0 + jmp okdone ; return to caller btsmall: - lda cbs - sta ICBLL,x - bpl icbll_copy + lda cbs + sta ICBLL,x + bpl icbll_copy -.endif ; .ifdef LINEBUF +.endif ; .ifdef LINEBUF diff --git a/libsrc/atari/revers.s b/libsrc/atari/revers.s index ff22dbf28..719503940 100644 --- a/libsrc/atari/revers.s +++ b/libsrc/atari/revers.s @@ -3,26 +3,26 @@ ; ; unsigned char revers (unsigned char onoff); ; - .include "atari.inc" - - .export _revers - .export _revflag + .include "atari.inc" + + .export _revers + .export _revflag _revers: - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value -L1: ldy #$00 ; Assume old value is zero - lda _revflag ; Load old value - stx _revflag ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value +L1: ldy #$00 ; Assume old value is zero + lda _revflag ; Load old value + stx _revflag ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts - .bss + .bss _revflag: - .res 1 + .res 1 diff --git a/libsrc/atari/rs232.s_ b/libsrc/atari/rs232.s_ index 843827fb6..35f20ca4f 100644 --- a/libsrc/atari/rs232.s_ +++ b/libsrc/atari/rs232.s_ @@ -11,43 +11,43 @@ ; unsigned char __fastcall__ rs232_pause (void); [TODO] ; unsigned char __fastcall__ rs232_unpause (void); [TODO] ; unsigned char __fastcall__ rs232_status (unsigned char* status, -; unsigned char* errors); [TODO] +; unsigned char* errors); [TODO] ; - .import findfreeiocb - .import __do_oserror - .import fddecusage - .import fdtoiocb - .import __inviocb - .import clriocb - .import newfd - .import _close, pushax, popax, popa - .importzp ptr1, tmp2, tmp3 + .import findfreeiocb + .import __do_oserror + .import fddecusage + .import fdtoiocb + .import __inviocb + .import clriocb + .import newfd + .import _close, pushax, popax, popa + .importzp ptr1, tmp2, tmp3 - .export _rs232_init, _rs232_params, _rs232_done, _rs232_get - .export _rs232_put, _rs232_pause, _rs232_unpause, _rs232_status + .export _rs232_init, _rs232_params, _rs232_done, _rs232_get + .export _rs232_put, _rs232_pause, _rs232_unpause, _rs232_status - .include "atari.inc" - .include "errno.inc" + .include "atari.inc" + .include "errno.inc" .include "rs232.inc" - .rodata + .rodata -rdev: .byte "R:", ATEOL, 0 +rdev: .byte "R:", ATEOL, 0 - .bss + .bss ; receive buffer RECVBUF_SZ = 256 -recv_buf: .res RECVBUF_SZ +recv_buf: .res RECVBUF_SZ -cm_run: .res 1 ; concurrent mode running? +cm_run: .res 1 ; concurrent mode running? - .data + .data -rshand: .word $ffff +rshand: .word $ffff - .code + .code ;---------------------------------------------------------------------------- ; @@ -57,60 +57,60 @@ rshand: .word $ffff ; */ ; -.proc _rs232_init +.proc _rs232_init - jsr findfreeiocb - bne init_err - txa - tay ; move iocb # into Y - lda #3 - sta tmp3 ; name length + 1 - lda #rdev - jsr newfd - tya - bcs doopen ; C set: open needed / device not already open + jsr findfreeiocb + bne init_err + txa + tay ; move iocb # into Y + lda #3 + sta tmp3 ; name length + 1 + lda #rdev + jsr newfd + tya + bcs doopen ; C set: open needed / device not already open - pha - jsr _rs232_done ;** shut down if started @@@TODO check this out!! - pla + pha + jsr _rs232_done ;** shut down if started @@@TODO check this out!! + pla -doopen: tax - pha - jsr clriocb - pla - tax - lda #rdev - sta ICBAH,x - lda #OPEN - sta ICCOM,x +doopen: tax + pha + jsr clriocb + pla + tax + lda #rdev + sta ICBAH,x + lda #OPEN + sta ICCOM,x - lda #$0D ; mode in+out+concurrent - sta ICAX1,x - lda #0 - sta ICAX2,x - sta ICBLL,x ; zap buf len - sta ICBLH,x - jsr CIOV - bmi cioerr1 + lda #$0D ; mode in+out+concurrent + sta ICAX1,x + lda #0 + sta ICAX2,x + sta ICBLL,x ; zap buf len + sta ICBLH,x + jsr CIOV + bmi cioerr1 - lda tmp2 ; get fd - sta rshand - ldx #0 - stx rshand+1 - txa - rts + lda tmp2 ; get fd + sta rshand + ldx #0 + stx rshand+1 + txa + rts -cioerr1:jsr fddecusage ; decrement usage counter of fd as open failed +cioerr1:jsr fddecusage ; decrement usage counter of fd as open failed init_err: - ldx #0 - lda #RS_ERR_INIT_FAILED - rts + ldx #0 + lda #RS_ERR_INIT_FAILED + rts -.endproc ; _rs232_init +.endproc ; _rs232_init ;---------------------------------------------------------------------------- @@ -126,64 +126,64 @@ init_err: ; using 8 bit word size. So only 8 bit is currently tested. ; -.proc _rs232_params +.proc _rs232_params - sta tmp2 - lda rshand - cmp #$ff - bne work ; work only if initialized - lda #RS_ERR_NOT_INITIALIZED - bne done -work: lda rshand - ldx #0 - jsr fdtoiocb ; get iocb index into X - bmi inverr ; shouldn't happen - tax + sta tmp2 + lda rshand + cmp #$ff + bne work ; work only if initialized + lda #RS_ERR_NOT_INITIALIZED + bne done +work: lda rshand + ldx #0 + jsr fdtoiocb ; get iocb index into X + bmi inverr ; shouldn't happen + tax - ; set handshake lines + ; set handshake lines - lda #34 ; xio 34, set cts, dtr etc - sta ICCOM,x - lda #192+48+3 ; DTR on, RTS on, XMT on - sta ICAX1,x - lda #0 - sta ICBLL,x - sta ICBLH,x - sta ICBAL,x - sta ICBAH,x - sta ICAX2,x - jsr CIOV - bmi cioerr + lda #34 ; xio 34, set cts, dtr etc + sta ICCOM,x + lda #192+48+3 ; DTR on, RTS on, XMT on + sta ICAX1,x + lda #0 + sta ICBLL,x + sta ICBLH,x + sta ICBAL,x + sta ICBAH,x + sta ICAX2,x + jsr CIOV + bmi cioerr - ; set baud rate, word size, stop bits and ready monitoring + ; set baud rate, word size, stop bits and ready monitoring - lda #36 ; xio 36, baud rate - sta ICCOM,x - jsr popa ; get parameter - sta ICAX1,x - ;ICAX2 = 0, monitor nothing - jsr CIOV - bmi cioerr + lda #36 ; xio 36, baud rate + sta ICCOM,x + jsr popa ; get parameter + sta ICAX1,x + ;ICAX2 = 0, monitor nothing + jsr CIOV + bmi cioerr - ; set translation and parity + ; set translation and parity - lda #38 ; xio 38, translation and parity - sta ICCOM,x - lda tmp2 - ora #32 ; no translation - sta ICAX1,x - jsr CIOV - bmi cioerr + lda #38 ; xio 38, translation and parity + sta ICCOM,x + lda tmp2 + ora #32 ; no translation + sta ICAX1,x + jsr CIOV + bmi cioerr - lda #0 -done: ldx #0 - rts + lda #0 +done: ldx #0 + rts -inverr: jmp __inviocb +inverr: jmp __inviocb -.endproc ;_rs232_params +.endproc ;_rs232_params -cioerr: jmp __do_oserror +cioerr: jmp __do_oserror ;---------------------------------------------------------------------------- @@ -196,28 +196,28 @@ cioerr: jmp __do_oserror ; */ ; -.proc _rs232_done +.proc _rs232_done - lda rshand - cmp #$ff - beq done -work: ldx rshand+1 - jsr pushax - jsr _close - pha - txa - pha - ldx #$ff - stx rshand - stx rshand+1 - inx - stx cm_run - pla - tax - pla -done: rts + lda rshand + cmp #$ff + beq done +work: ldx rshand+1 + jsr pushax + jsr _close + pha + txa + pha + ldx #$ff + stx rshand + stx rshand+1 + inx + stx cm_run + pla + tax + pla +done: rts -.endproc ;rs232_done +.endproc ;rs232_done ;---------------------------------------------------------------------------- @@ -228,61 +228,61 @@ done: rts ; */ ; -.proc _rs232_get +.proc _rs232_get - ldy rshand - cpy #$ff - bne work ; work only if initialized - lda #RS_ERR_NOT_INITIALIZED - bne nierr + ldy rshand + cpy #$ff + bne work ; work only if initialized + lda #RS_ERR_NOT_INITIALIZED + bne nierr -work: sta ptr1 - stx ptr1+1 ; store pointer to received char +work: sta ptr1 + stx ptr1+1 ; store pointer to received char - lda rshand - ldx #0 - jsr fdtoiocb - tax - lda cm_run ; concurrent mode already running? - bne go - jsr ena_cm ; turn on concurrent mode + lda rshand + ldx #0 + jsr fdtoiocb + tax + lda cm_run ; concurrent mode already running? + bne go + jsr ena_cm ; turn on concurrent mode -go: ; check whether there is any input available +go: ; check whether there is any input available - lda #STATIS ; status request, returns bytes pending - sta ICCOM,x - jsr CIOV - bmi cioerr ; @@@ error handling + lda #STATIS ; status request, returns bytes pending + sta ICCOM,x + jsr CIOV + bmi cioerr ; @@@ error handling - lda DVSTAT+1 ; get byte count pending - ora DVSTAT+2 - beq nix_da ; no input waiting... + lda DVSTAT+1 ; get byte count pending + ora DVSTAT+2 + beq nix_da ; no input waiting... - ; input is available: get it! + ; input is available: get it! - lda #GETCHR ; get raw bytes - sta ICCOM,x ; in command code - lda #0 - sta ICBLL,x - sta ICBLH,x - sta ICBAL,x - sta ICBAH,x - jsr CIOV ; go get it - bmi cioerr ; @@@ error handling + lda #GETCHR ; get raw bytes + sta ICCOM,x ; in command code + lda #0 + sta ICBLL,x + sta ICBLH,x + sta ICBAL,x + sta ICBAH,x + jsr CIOV ; go get it + bmi cioerr ; @@@ error handling - ldx #0 - sta (ptr1,x) ; return received byte - txa - rts + ldx #0 + sta (ptr1,x) ; return received byte + txa + rts -nierr: ldx #0 - rts +nierr: ldx #0 + rts -nix_da: lda #RS_ERR_NO_DATA - ldx #0 - rts +nix_da: lda #RS_ERR_NO_DATA + ldx #0 + rts -.endproc ;_rs232_get +.endproc ;_rs232_get ;---------------------------------------------------------------------------- @@ -294,39 +294,39 @@ nix_da: lda #RS_ERR_NO_DATA ; */ ; -.proc _rs232_put +.proc _rs232_put - ldy rshand - cpy #$ff - bne work ; work only if initialized - lda #RS_ERR_NOT_INITIALIZED - bne nierr + ldy rshand + cpy #$ff + bne work ; work only if initialized + lda #RS_ERR_NOT_INITIALIZED + bne nierr -work: pha - lda rshand - ldx #0 - jsr fdtoiocb - tax - lda cm_run ; concurrent mode already running? - bne go - jsr ena_cm ; turn on concurrent mode +work: pha + lda rshand + ldx #0 + jsr fdtoiocb + tax + lda cm_run ; concurrent mode already running? + bne go + jsr ena_cm ; turn on concurrent mode - ; @@@TODO: check output buffer overflow -go: lda #PUTCHR ; put raw bytes - sta ICCOM,x ; in command code - lda #0 - sta ICBLL,x - sta ICBLH,x - sta ICBAL,x - sta ICBAH,x - pla ; get the char back - jsr CIOV ; go do it - rts + ; @@@TODO: check output buffer overflow +go: lda #PUTCHR ; put raw bytes + sta ICCOM,x ; in command code + lda #0 + sta ICBLL,x + sta ICBLH,x + sta ICBAL,x + sta ICBAH,x + pla ; get the char back + jsr CIOV ; go do it + rts -nierr: ldx #0 - rts +nierr: ldx #0 + rts -.endproc ;_rs232_put +.endproc ;_rs232_put ;---------------------------------------------------------------------------- ; @@ -349,41 +349,41 @@ _rs232_unpause: ;---------------------------------------------------------------------------- ; ; unsigned char __fastcall__ rs232_status (unsigned char* status, -; unsigned char* errors); +; unsigned char* errors); ; /* Return the serial port status. */ ; _rs232_status: - lda #255 - tax - rts + lda #255 + tax + rts ; enable concurrent rs232 mode ; gets iocb index in X ; all registers destroyed -.proc ena_cm +.proc ena_cm - lda #40 ; XIO 40, start concurrent IO - sta ICCOM,x - sta cm_run ; indicate concurrent mode is running - lda #0 - sta ICAX1,x - sta ICAX2,x - lda #recv_buf - sta ICBAH,x - lda #RECVBUF_SZ - sta ICBLH,x - lda #$0D ; value from 850 man, p62. must be 0D?, - sta ICAX1,x ; or any non-zero? - jmp CIOV + lda #40 ; XIO 40, start concurrent IO + sta ICCOM,x + sta cm_run ; indicate concurrent mode is running + lda #0 + sta ICAX1,x + sta ICAX2,x + lda #recv_buf + sta ICBAH,x + lda #RECVBUF_SZ + sta ICBLH,x + lda #$0D ; value from 850 man, p62. must be 0D?, + sta ICAX1,x ; or any non-zero? + jmp CIOV -.endproc ;ena_cm +.endproc ;ena_cm - .end + .end diff --git a/libsrc/atari/rwcommon.s b/libsrc/atari/rwcommon.s index 349c7be01..5f51cc5f7 100644 --- a/libsrc/atari/rwcommon.s +++ b/libsrc/atari/rwcommon.s @@ -2,42 +2,42 @@ ; common iocb setup routine for read, write ; expects __fastcall__ parameters (int fd, void *buf, int count) ; - .include "atari.inc" - .include "errno.inc" - .import popax - .import fdtoiocb + .include "atari.inc" + .include "errno.inc" + .import popax + .import fdtoiocb - .export __rwsetup + .export __rwsetup __rwsetup: - pha ; push size in stack - txa - pha - jsr popax ; get buffer address - pha - txa - pha - jsr popax ; get handle - jsr fdtoiocb ; convert to iocb - bmi iocberr ; negative (X=$FF or A>$7F) on error. - tax - pla ; store address - sta ICBAH,x - pla - sta ICBAL,x - pla ; store length - sta ICBLH,x - pla - sta ICBLL,x - ora ICBLH,x ; returns Z if length is 0 - rts + pha ; push size in stack + txa + pha + jsr popax ; get buffer address + pha + txa + pha + jsr popax ; get handle + jsr fdtoiocb ; convert to iocb + bmi iocberr ; negative (X=$FF or A>$7F) on error. + tax + pla ; store address + sta ICBAH,x + pla + sta ICBAL,x + pla ; store length + sta ICBLH,x + pla + sta ICBLL,x + ora ICBLH,x ; returns Z if length is 0 + rts iocberr:pla - pla - pla - pla - ldx #$FF ; indicate error + clear ZF - rts + pla + pla + pla + ldx #$FF ; indicate error + clear ZF + rts diff --git a/libsrc/atari/savevec.s b/libsrc/atari/savevec.s index d2de4ef30..dd6dda125 100644 --- a/libsrc/atari/savevec.s +++ b/libsrc/atari/savevec.s @@ -6,10 +6,10 @@ ; void _rest_vecs(void); ; - .export __save_vecs,__rest_vecs -.include "atari.inc" + .export __save_vecs,__rest_vecs +.include "atari.inc" - .bss + .bss old_dli: .res 2 old_dlist: .res 2 @@ -20,86 +20,86 @@ old_dma: .res 1 old_prior: .res 1 old_cols: .res 8 old_set: .res 1 -old_rmargin: .res 1 ; lmargin saved in startup code +old_rmargin: .res 1 ; lmargin saved in startup code - .code + .code -.proc __save_vecs +.proc __save_vecs - lda VDSLST - sta old_dli - lda VDSLST+1 - sta old_dli+1 - lda SDLSTL - sta old_dlist - lda SDLSTL+1 - sta old_dlist+1 - lda VVBLKI - sta old_vbi - lda VVBLKI+1 - sta old_vbi+1 - lda VVBLKD - sta old_vbd - lda VVBLKD+1 - sta old_vbd+1 - lda GRACTL - sta old_gra - lda SDMCTL - sta old_dma - lda GPRIOR - sta old_prior - lda CHBAS - sta old_set - lda RMARGN - sta old_rmargin + lda VDSLST + sta old_dli + lda VDSLST+1 + sta old_dli+1 + lda SDLSTL + sta old_dlist + lda SDLSTL+1 + sta old_dlist+1 + lda VVBLKI + sta old_vbi + lda VVBLKI+1 + sta old_vbi+1 + lda VVBLKD + sta old_vbd + lda VVBLKD+1 + sta old_vbd+1 + lda GRACTL + sta old_gra + lda SDMCTL + sta old_dma + lda GPRIOR + sta old_prior + lda CHBAS + sta old_set + lda RMARGN + sta old_rmargin - ldy #7 + ldy #7 SETUP1: - lda PCOLR0,y - sta old_cols,y - dey - bpl SETUP1 - rts + lda PCOLR0,y + sta old_cols,y + dey + bpl SETUP1 + rts .endproc -.proc __rest_vecs +.proc __rest_vecs - lda #6 - ldx old_vbi+1 - ldy old_vbi - jsr SETVBV - lda #7 - ldx old_vbd+1 - ldy old_vbd - jsr SETVBV - lda old_dli - sta VDSLST - lda old_dli+1 - sta VDSLST+1 - lda old_dlist - sta SDLSTL - lda old_dlist+1 - sta SDLSTL+1 - lda old_gra - sta GRACTL - lda old_prior - sta GPRIOR - lda old_dma - sta SDMCTL - lda old_set - sta CHBAS - lda old_rmargin - sta RMARGN - lda #$FF - sta CH - ldy #7 + lda #6 + ldx old_vbi+1 + ldy old_vbi + jsr SETVBV + lda #7 + ldx old_vbd+1 + ldy old_vbd + jsr SETVBV + lda old_dli + sta VDSLST + lda old_dli+1 + sta VDSLST+1 + lda old_dlist + sta SDLSTL + lda old_dlist+1 + sta SDLSTL+1 + lda old_gra + sta GRACTL + lda old_prior + sta GPRIOR + lda old_dma + sta SDMCTL + lda old_set + sta CHBAS + lda old_rmargin + sta RMARGN + lda #$FF + sta CH + ldy #7 SETUP2: - lda old_cols,Y - sta PCOLR0,Y - dey - bpl SETUP2 - rts + lda old_cols,Y + sta PCOLR0,Y + dey + bpl SETUP2 + rts .endproc diff --git a/libsrc/atari/scroll.s b/libsrc/atari/scroll.s index 8f58e190c..5e8428cc2 100644 --- a/libsrc/atari/scroll.s +++ b/libsrc/atari/scroll.s @@ -6,159 +6,159 @@ ; numlines < 0 scrolls down ; - .include "atari.inc" - .importzp tmp1,tmp4,ptr1,ptr2 - .import mul40,_clrscr - .export __scroll + .include "atari.inc" + .importzp tmp1,tmp4,ptr1,ptr2 + .import mul40,_clrscr + .export __scroll -.proc __scroll +.proc __scroll - cmp #0 - beq jmpfin -; cmp #$80 -; bcc up - bpl up + cmp #0 + beq jmpfin +; cmp #$80 +; bcc up + bpl up ;scroll down - eor #$ff - clc - adc #1 ; make positive - sta tmp1 + eor #$ff + clc + adc #1 ; make positive + sta tmp1 - cmp #24 ; scroll >= the whole screen? - bcc down_ok - jmp _clrscr + cmp #24 ; scroll >= the whole screen? + bcc down_ok + jmp _clrscr -down_ok:lda SAVMSC - clc - adc #<(40*23) - sta ptr1 - sta ptr2 - lda SAVMSC+1 - adc #>(40*23) - sta ptr1+1 ; point to last line on screen - sta ptr2+1 +down_ok:lda SAVMSC + clc + adc #<(40*23) + sta ptr1 + sta ptr2 + lda SAVMSC+1 + adc #>(40*23) + sta ptr1+1 ; point to last line on screen + sta ptr2+1 - lda tmp1 - jsr mul40 - sta tmp4 - lda ptr2 - sec - sbc tmp4 - sta ptr2 - stx tmp4 - lda ptr2+1 - sbc tmp4 - sta ptr2+1 + lda tmp1 + jsr mul40 + sta tmp4 + lda ptr2 + sec + sbc tmp4 + sta ptr2 + stx tmp4 + lda ptr2+1 + sbc tmp4 + sta ptr2+1 - lda #24 ; # of lines on screen - sec - sbc tmp1 ; # of lines to move - tax + lda #24 ; # of lines on screen + sec + sbc tmp1 ; # of lines to move + tax - ;very simple, could be improved + ;very simple, could be improved -scrold: ldy #39 ; # of chars on a line - 1 -copy_d: lda (ptr2),y - sta (ptr1),y - dey - bpl copy_d - lda ptr1 - sec - sbc #40 - sta ptr1 - bcs u1 - dec ptr1+1 -u1: lda ptr2 - sec - sbc #40 - sta ptr2 - bcs u2 - dec ptr2+1 -u2: dex - bne scrold +scrold: ldy #39 ; # of chars on a line - 1 +copy_d: lda (ptr2),y + sta (ptr1),y + dey + bpl copy_d + lda ptr1 + sec + sbc #40 + sta ptr1 + bcs u1 + dec ptr1+1 +u1: lda ptr2 + sec + sbc #40 + sta ptr2 + bcs u2 + dec ptr2+1 +u2: dex + bne scrold - ; fill new scrolled in lines with space + ; fill new scrolled in lines with space - ldx tmp1 ; # of new lines -fild: lda #0 - ldy #39 -fill_d: sta (ptr1),y - dey - bpl fill_d - dex -jmpfin: beq finish - lda ptr1 - sec - sbc #40 - sta ptr1 - bcs u3 - dec ptr1+1 -u3: jmp fild + ldx tmp1 ; # of new lines +fild: lda #0 + ldy #39 +fill_d: sta (ptr1),y + dey + bpl fill_d + dex +jmpfin: beq finish + lda ptr1 + sec + sbc #40 + sta ptr1 + bcs u3 + dec ptr1+1 +u3: jmp fild ;scroll up -up: sta tmp1 ; # of lines to scroll - cmp #24 ; scroll >= the whole screen? - bcc up_ok - jmp _clrscr +up: sta tmp1 ; # of lines to scroll + cmp #24 ; scroll >= the whole screen? + bcc up_ok + jmp _clrscr - ;multiply by 40 (xsize) -up_ok: jsr mul40 - clc - adc SAVMSC ; add start of screen mem - sta ptr2 - txa - adc SAVMSC+1 - sta ptr2+1 - lda SAVMSC+1 - sta ptr1+1 - lda SAVMSC - sta ptr1 - lda #24 ; # of lines on screen - sec - sbc tmp1 ; # of lines to move - tax + ;multiply by 40 (xsize) +up_ok: jsr mul40 + clc + adc SAVMSC ; add start of screen mem + sta ptr2 + txa + adc SAVMSC+1 + sta ptr2+1 + lda SAVMSC+1 + sta ptr1+1 + lda SAVMSC + sta ptr1 + lda #24 ; # of lines on screen + sec + sbc tmp1 ; # of lines to move + tax - ;very simple, could be improved + ;very simple, could be improved -scroll: ldy #39 ; # of chars on a line - 1 -copy_l: lda (ptr2),y - sta (ptr1),y - dey - bpl copy_l - lda #40 - clc - adc ptr1 - sta ptr1 - bcc l1 - inc ptr1+1 -l1: lda #40 - clc - adc ptr2 - sta ptr2 - bcc l2 - inc ptr2+1 -l2: dex - bne scroll +scroll: ldy #39 ; # of chars on a line - 1 +copy_l: lda (ptr2),y + sta (ptr1),y + dey + bpl copy_l + lda #40 + clc + adc ptr1 + sta ptr1 + bcc l1 + inc ptr1+1 +l1: lda #40 + clc + adc ptr2 + sta ptr2 + bcc l2 + inc ptr2+1 +l2: dex + bne scroll - ; fill new scrolled in lines with space + ; fill new scrolled in lines with space - ldx tmp1 ; # of new lines -fill: lda #0 - ldy #39 -fill_l: sta (ptr1),y - dey - bpl fill_l - dex - beq finish - lda #40 - clc - adc ptr1 - sta ptr1 - bcc l3 - inc ptr1+1 -l3: jmp fill + ldx tmp1 ; # of new lines +fill: lda #0 + ldy #39 +fill_l: sta (ptr1),y + dey + bpl fill_l + dex + beq finish + lda #40 + clc + adc ptr1 + sta ptr1 + bcc l3 + inc ptr1+1 +l3: jmp fill -finish: rts +finish: rts .endproc diff --git a/libsrc/atari/setcolor.s b/libsrc/atari/setcolor.s index 355921011..bf3b89572 100644 --- a/libsrc/atari/setcolor.s +++ b/libsrc/atari/setcolor.s @@ -9,43 +9,43 @@ ; - .export __setcolor, __setcolor_low, __getcolor - .import popa - .include "atari.inc" + .export __setcolor, __setcolor_low, __getcolor + .import popa + .include "atari.inc" -.proc __getcolor +.proc __getcolor - tax - lda COLOR0,x ; get current value - ldx #0 - rts + tax + lda COLOR0,x ; get current value + ldx #0 + rts .endproc -.proc __setcolor +.proc __setcolor -; asl a ; not -> BASIC compatible - sta lum ; remember luminance - jsr popa ; get hue - asl a - asl a - asl a - asl a - ora lum -; jmp __setcolor_low +; asl a ; not -> BASIC compatible + sta lum ; remember luminance + jsr popa ; get hue + asl a + asl a + asl a + asl a + ora lum +; jmp __setcolor_low .endproc -.proc __setcolor_low +.proc __setcolor_low - pha - jsr popa - tax - pla - sta COLOR0,x - rts + pha + jsr popa + tax + pla + sta COLOR0,x + rts .endproc - .bss -lum: .res 1 + .bss +lum: .res 1 diff --git a/libsrc/atari/siocall.s b/libsrc/atari/siocall.s index eea3f040a..3db37753f 100644 --- a/libsrc/atari/siocall.s +++ b/libsrc/atari/siocall.s @@ -7,83 +7,83 @@ ; to save space with _dio_read and _dio_write functions. ; ; unsigned char __fastcall__ _sio_call(dhandle_t handle, -; unsigned sect_num, -; void *buffer, -; unsigned sio_val); +; unsigned sect_num, +; void *buffer, +; unsigned sio_val); ; dhandle_t - 16bit (ptr) ; sio_val is (sio_command | sio_direction << 8) ; - .export __sio_call - .include "atari.inc" - .import popa,popax - .import sectsizetab,__oserror - .importzp ptr1 + .export __sio_call + .include "atari.inc" + .import popa,popax + .import sectsizetab,__oserror + .importzp ptr1 -.proc __sio_call +.proc __sio_call - sta DCOMND ; set command into DCB - stx DSTATS ; set data flow directon - jsr popax ; get buffer address - sta DBUFLO ; set buffer address into DCB - stx DBUFHI - jsr popax - sta DAUX1 ; set sector # - stx DAUX2 + sta DCOMND ; set command into DCB + stx DSTATS ; set data flow directon + jsr popax ; get buffer address + sta DBUFLO ; set buffer address into DCB + stx DBUFHI + jsr popax + sta DAUX1 ; set sector # + stx DAUX2 - jsr popax - sta ptr1 - stx ptr1+1 + jsr popax + sta ptr1 + stx ptr1+1 - ldy #sst_flag - lda (ptr1),y - and #128 - beq _inv_hand ; handle not open or invalid + ldy #sst_flag + lda (ptr1),y + and #128 + beq _inv_hand ; handle not open or invalid - ldy #sst_driveno - lda (ptr1),y + ldy #sst_driveno + lda (ptr1),y - clc - adc #1 - sta DUNIT ; unit number (d1,d2,d3,...) + clc + adc #1 + sta DUNIT ; unit number (d1,d2,d3,...) - lda DAUX2 ; high byte sector # - bne _realsz - lda DAUX1 - cmp #4 ; sectors 1 to 3 are special (always 128 bytes) - bcs _realsz + lda DAUX2 ; high byte sector # + bne _realsz + lda DAUX1 + cmp #4 ; sectors 1 to 3 are special (always 128 bytes) + bcs _realsz - lda #$80 - sta DBYTLO - asl a - sta DBYTHI - beq _cont + lda #$80 + sta DBYTLO + asl a + sta DBYTHI + beq _cont -_realsz:ldy #sst_sectsize - lda (ptr1),y - sta DBYTLO - iny - lda (ptr1),y - sta DBYTHI +_realsz:ldy #sst_sectsize + lda (ptr1),y + sta DBYTLO + iny + lda (ptr1),y + sta DBYTHI -_cont: lda #DISKID ; SIO bus ID of diskette drive - sta DDEVIC - lda #15 - sta DTIMLO ; value got from DOS source +_cont: lda #DISKID ; SIO bus ID of diskette drive + sta DDEVIC + lda #15 + sta DTIMLO ; value got from DOS source - jsr SIOV ; execute + jsr SIOV ; execute - ldx #0 - lda DSTATS - bmi _req_err ; error occurred - txa ; no error occurred + ldx #0 + lda DSTATS + bmi _req_err ; error occurred + txa ; no error occurred _req_err: - sta __oserror - rts + sta __oserror + rts _inv_hand: - ldx #0 - lda #BADIOC - bne _req_err + ldx #0 + lda #BADIOC + bne _req_err .endproc diff --git a/libsrc/atari/syschdir.s b/libsrc/atari/syschdir.s index e91d7c83b..9fc45edbd 100644 --- a/libsrc/atari/syschdir.s +++ b/libsrc/atari/syschdir.s @@ -6,83 +6,83 @@ ; for SpartaDOS and MyDOS ; - .include "atari.inc" - .import findfreeiocb - .import __dos_type - .import initcwd - .importzp tmp4 -.ifdef UCASE_FILENAME - .importzp tmp3 - .import addysp - .import ucase_fn + .include "atari.inc" + .import findfreeiocb + .import __dos_type + .import initcwd + .importzp tmp4 +.ifdef UCASE_FILENAME + .importzp tmp3 + .import addysp + .import ucase_fn .endif - .export __syschdir + .export __syschdir -.proc __syschdir +.proc __syschdir - pha ; save input parameter - txa - pha + pha ; save input parameter + txa + pha - jsr findfreeiocb - beq iocbok ; we found one + jsr findfreeiocb + beq iocbok ; we found one - pla - pla ; fix up stack + pla + pla ; fix up stack - lda #TMOF ; too many open files - rts + lda #TMOF ; too many open files + rts -iocbok: stx tmp4 ; remember IOCB index - pla - tax - pla ; get argument again +iocbok: stx tmp4 ; remember IOCB index + pla + tax + pla ; get argument again -.ifdef UCASE_FILENAME +.ifdef UCASE_FILENAME - jsr ucase_fn - bcc ucok1 + jsr ucase_fn + bcc ucok1 - lda #183 ; see oserror.s - rts + lda #183 ; see oserror.s + rts ucok1: -.endif ; defined UCASE_FILENAME +.endif ; defined UCASE_FILENAME - ldy tmp4 ; IOCB index - sta ICBAL,y ; store pointer to filename - txa - sta ICBAH,y - tya - tax - lda __dos_type - cmp #SPARTADOS - beq :+ - lda #41 - .byte $2C ; BIT -: lda #44 - sta ICCOM,x - lda #0 - sta ICAX1,x - sta ICAX2,x - sta ICBLL,x - sta ICBLH,x - jsr CIOV + ldy tmp4 ; IOCB index + sta ICBAL,y ; store pointer to filename + txa + sta ICBAH,y + tya + tax + lda __dos_type + cmp #SPARTADOS + beq :+ + lda #41 + .byte $2C ; BIT +: lda #44 + sta ICCOM,x + lda #0 + sta ICAX1,x + sta ICAX2,x + sta ICBLL,x + sta ICBLH,x + jsr CIOV -.ifdef UCASE_FILENAME - tya - pha - ldy tmp3 ; get size - jsr addysp ; free used space on the stack - pla - tay -.endif ; defined UCASE_FILENAME +.ifdef UCASE_FILENAME + tya + pha + ldy tmp3 ; get size + jsr addysp ; free used space on the stack + pla + tay +.endif ; defined UCASE_FILENAME - bmi cioerr - jsr initcwd - lda #0 - rts -cioerr: tya - rts + bmi cioerr + jsr initcwd + lda #0 + rts +cioerr: tya + rts -.endproc ; __syschdir +.endproc ; __syschdir diff --git a/libsrc/atari/sysmkdir.s b/libsrc/atari/sysmkdir.s index 68f1a5087..de3252ced 100644 --- a/libsrc/atari/sysmkdir.s +++ b/libsrc/atari/sysmkdir.s @@ -6,84 +6,84 @@ ; for SpartaDOS and MYDOS ; - .include "atari.inc" - .include "errno.inc" - .import addysp - .import popax - .import findfreeiocb - .importzp tmp4 -.ifdef UCASE_FILENAME - .importzp tmp3 - .import ucase_fn + .include "atari.inc" + .include "errno.inc" + .import addysp + .import popax + .import findfreeiocb + .importzp tmp4 +.ifdef UCASE_FILENAME + .importzp tmp3 + .import ucase_fn .endif - .export __sysmkdir + .export __sysmkdir -.proc __sysmkdir +.proc __sysmkdir - dey ; parm count < 2 shouldn't be needed to be... - dey ; ...checked (it generates a C compiler warning) - beq parmok ; branch if parameter count ok - jsr addysp ; fix stack, throw away unused parameters + dey ; parm count < 2 shouldn't be needed to be... + dey ; ...checked (it generates a C compiler warning) + beq parmok ; branch if parameter count ok + jsr addysp ; fix stack, throw away unused parameters -parmok: jsr popax ; get name - pha ; save input parameter - txa - pha +parmok: jsr popax ; get name + pha ; save input parameter + txa + pha - jsr findfreeiocb - beq iocbok ; we found one + jsr findfreeiocb + beq iocbok ; we found one - pla - pla ; fix up stack + pla + pla ; fix up stack - lda #TMOF ; too many open files - rts + lda #TMOF ; too many open files + rts -iocbok: stx tmp4 ; remember IOCB index - pla - tax - pla ; get argument again +iocbok: stx tmp4 ; remember IOCB index + pla + tax + pla ; get argument again -.ifdef UCASE_FILENAME +.ifdef UCASE_FILENAME - jsr ucase_fn - bcc ucok1 + jsr ucase_fn + bcc ucok1 - lda #183 ; see oserror.s - rts + lda #183 ; see oserror.s + rts ucok1: -.endif ; defined UCASE_FILENAME +.endif ; defined UCASE_FILENAME - ldy tmp4 ; IOCB index - sta ICBAL,y ; store pointer to filename - txa - sta ICBAH,y - tya - tax - lda #42 - sta ICCOM,x - lda #8 - sta ICAX1,x - lda #0 - sta ICAX2,x - sta ICBLL,x - sta ICBLH,x - jsr CIOV + ldy tmp4 ; IOCB index + sta ICBAL,y ; store pointer to filename + txa + sta ICBAH,y + tya + tax + lda #42 + sta ICCOM,x + lda #8 + sta ICAX1,x + lda #0 + sta ICAX2,x + sta ICBLL,x + sta ICBLH,x + jsr CIOV -.ifdef UCASE_FILENAME - tya - pha - ldy tmp3 ; get size - jsr addysp ; free used space on the stack - pla - tay -.endif ; defined UCASE_FILENAME +.ifdef UCASE_FILENAME + tya + pha + ldy tmp3 ; get size + jsr addysp ; free used space on the stack + pla + tay +.endif ; defined UCASE_FILENAME - bmi cioerr - lda #0 - rts -cioerr: tya - rts + bmi cioerr + lda #0 + rts +cioerr: tya + rts -.endproc ; __sysmkdir +.endproc ; __sysmkdir diff --git a/libsrc/atari/sysremove.s b/libsrc/atari/sysremove.s index 581cbd945..1e7b4760f 100644 --- a/libsrc/atari/sysremove.s +++ b/libsrc/atari/sysremove.s @@ -4,76 +4,76 @@ ; int remove (const char* name); ; - .include "atari.inc" - .include "errno.inc" - .import findfreeiocb - .importzp tmp4 -.ifdef UCASE_FILENAME - .importzp tmp3 - .import addysp - .import ucase_fn + .include "atari.inc" + .include "errno.inc" + .import findfreeiocb + .importzp tmp4 +.ifdef UCASE_FILENAME + .importzp tmp3 + .import addysp + .import ucase_fn .endif - .export __sysremove + .export __sysremove -.proc __sysremove +.proc __sysremove - pha ; save input parameter - txa - pha + pha ; save input parameter + txa + pha - jsr findfreeiocb - beq iocbok ; we found one + jsr findfreeiocb + beq iocbok ; we found one - pla - pla ; fix up stack + pla + pla ; fix up stack - lda #TMOF ; too many open files - rts + lda #TMOF ; too many open files + rts -iocbok: stx tmp4 ; remember IOCB index - pla - tax - pla ; get argument again +iocbok: stx tmp4 ; remember IOCB index + pla + tax + pla ; get argument again -.ifdef UCASE_FILENAME +.ifdef UCASE_FILENAME - jsr ucase_fn - bcc ucok1 + jsr ucase_fn + bcc ucok1 - lda #183 ; see oserror.s - rts + lda #183 ; see oserror.s + rts ucok1: -.endif ; defined UCASE_FILENAME +.endif ; defined UCASE_FILENAME - ldy tmp4 ; IOCB index - sta ICBAL,y ; store pointer to filename - txa - sta ICBAH,y - tya - tax - lda #DELETE - sta ICCOM,x - lda #0 - sta ICAX1,x - sta ICAX2,x - sta ICBLL,x - sta ICBLH,x - jsr CIOV + ldy tmp4 ; IOCB index + sta ICBAL,y ; store pointer to filename + txa + sta ICBAH,y + tya + tax + lda #DELETE + sta ICCOM,x + lda #0 + sta ICAX1,x + sta ICAX2,x + sta ICBLL,x + sta ICBLH,x + jsr CIOV -.ifdef UCASE_FILENAME - tya - pha - ldy tmp3 ; get size - jsr addysp ; free used space on the stack - pla - tay -.endif ; defined UCASE_FILENAME +.ifdef UCASE_FILENAME + tya + pha + ldy tmp3 ; get size + jsr addysp ; free used space on the stack + pla + tay +.endif ; defined UCASE_FILENAME - bmi cioerr - lda #0 - rts -cioerr: tya - rts + bmi cioerr + lda #0 + rts +cioerr: tya + rts -.endproc ; __sysremove +.endproc ; __sysremove diff --git a/libsrc/atari/sysrmdir.s b/libsrc/atari/sysrmdir.s index d3b2cf3f1..9c057ba44 100644 --- a/libsrc/atari/sysrmdir.s +++ b/libsrc/atari/sysrmdir.s @@ -4,7 +4,7 @@ ; unsigned char __fastcall__ _sysrmdir (const char* name); ; - .export __sysrmdir - .import __sysremove + .export __sysrmdir + .import __sysremove __sysrmdir := __sysremove diff --git a/libsrc/atari/systime.s b/libsrc/atari/systime.s index 1d039e80e..d22b8c596 100644 --- a/libsrc/atari/systime.s +++ b/libsrc/atari/systime.s @@ -9,7 +9,7 @@ ; */ ; - .export __systime + .export __systime .importzp sreg diff --git a/libsrc/atari/tgi/atari10.s b/libsrc/atari/tgi/atari10.s index a7da93b97..10271b7f0 100644 --- a/libsrc/atari/tgi/atari10.s +++ b/libsrc/atari/tgi/atari10.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 10 + grmode = 10 ; X resolution - x_res = 80 + x_res = 80 ; Y resolution - y_res = 192 + y_res = 192 ; Number of colors - colors = 9 + colors = 9 ; Pixels per byte - ppb = 2 + ppb = 2 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $0330 ; based on 4/3 display + aspect = $0330 ; based on 4/3 display ; Free memory needed - mem_needed = 7147 + mem_needed = 7147 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %11110000, %00001111 - masks: ; Color masks - .byte $00, $11, $22, $33, $44, $55, $66, $77, $88 - bar_table: ; Mask table for BAR - .byte %11111111, %00001111, %00000000 - default_palette: - .byte $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A + mask_table: ; Mask table to set pixels + .byte %11110000, %00001111 + masks: ; Color masks + .byte $00, $11, $22, $33, $44, $55, $66, $77, $88 + bar_table: ; Mask table for BAR + .byte %11111111, %00001111, %00000000 + default_palette: + .byte $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A .code @@ -55,22 +55,22 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - sta PCOLR0,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + sta PCOLR0,y + dey + bpl loop - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atari11.s b/libsrc/atari/tgi/atari11.s index 2e2dfd842..74b7db3b9 100644 --- a/libsrc/atari/tgi/atari11.s +++ b/libsrc/atari/tgi/atari11.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 11 + grmode = 11 ; X resolution - x_res = 80 + x_res = 80 ; Y resolution - y_res = 192 + y_res = 192 ; Number of colors - colors = 16 + colors = 16 ; Pixels per byte - ppb = 2 + ppb = 2 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $0330 ; based on 4/3 display + aspect = $0330 ; based on 4/3 display ; Free memory needed - mem_needed = 7147 + mem_needed = 7147 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %11110000, %00001111 - masks: ; Color masks - .byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff - bar_table: ; Mask table for BAR - .byte %11111111, %00001111, %00000000 - default_palette: - .byte $00, $10, $20, $30, $40, $50, $60, $70, $80, $90, $A0, $B0, $C0, $D0, $E0, $F0 + mask_table: ; Mask table to set pixels + .byte %11110000, %00001111 + masks: ; Color masks + .byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff + bar_table: ; Mask table for BAR + .byte %11111111, %00001111, %00000000 + default_palette: + .byte $00, $10, $20, $30, $40, $50, $60, $70, $80, $90, $A0, $B0, $C0, $D0, $E0, $F0 .code @@ -55,14 +55,14 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; No palettes + ; No palettes lda #TGI_ERR_INV_FUNC sta error rts diff --git a/libsrc/atari/tgi/atari14.s b/libsrc/atari/tgi/atari14.s index ebd243067..e0ae9b579 100644 --- a/libsrc/atari/tgi/atari14.s +++ b/libsrc/atari/tgi/atari14.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 14 + grmode = 14 ; X resolution - x_res = 160 + x_res = 160 ; Y resolution - y_res = 192 + y_res = 192 ; Number of colors - colors = 2 + colors = 2 ; Pixels per byte - ppb = 8 + ppb = 8 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $0198 ; based on 4/3 display + aspect = $0198 ; based on 4/3 display ; Free memory needed - mem_needed = 3305 + mem_needed = 3305 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001 - masks: ; Color masks - .byte %00000000, %11111111 - bar_table: ; Mask table for BAR - .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000 - default_palette: - .byte $00, $0E + mask_table: ; Mask table to set pixels + .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001 + masks: ; Color masks + .byte %00000000, %11111111 + bar_table: ; Mask table for BAR + .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000 + default_palette: + .byte $00, $0E .code @@ -55,27 +55,27 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + dey + bpl loop - ; Get the color entries from the palette - lda palette - sta COLOR4 - lda palette + 1 - sta COLOR0 + ; Get the color entries from the palette + lda palette + sta COLOR4 + lda palette + 1 + sta COLOR0 - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atari15.s b/libsrc/atari/tgi/atari15.s index 08497db37..d1b85f39a 100644 --- a/libsrc/atari/tgi/atari15.s +++ b/libsrc/atari/tgi/atari15.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 15 + grmode = 15 ; X resolution - x_res = 160 + x_res = 160 ; Y resolution - y_res = 192 + y_res = 192 ; Number of colors - colors = 4 + colors = 4 ; Pixels per byte - ppb = 4 + ppb = 4 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $0198 ; based on 4/3 display + aspect = $0198 ; based on 4/3 display ; Free memory needed - mem_needed = 7147 + mem_needed = 7147 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %11000000, %00110000, %00001100, %00000011 - masks: ; Color masks - .byte %00000000, %01010101, %10101010, %11111111 - bar_table: ; Mask table for BAR - .byte %11111111, %00111111, %00001111, %00000011, %00000000 - default_palette: - .byte $00, $0E, $32, $96 + mask_table: ; Mask table to set pixels + .byte %11000000, %00110000, %00001100, %00000011 + masks: ; Color masks + .byte %00000000, %01010101, %10101010, %11111111 + bar_table: ; Mask table for BAR + .byte %11111111, %00111111, %00001111, %00000011, %00000000 + default_palette: + .byte $00, $0E, $32, $96 .code @@ -55,31 +55,31 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + dey + bpl loop - ; Get the color entries from the palette - lda palette - sta COLOR4 - lda palette + 1 - sta COLOR0 - lda palette + 2 - sta COLOR1 - lda palette + 3 - sta COLOR2 + ; Get the color entries from the palette + lda palette + sta COLOR4 + lda palette + 1 + sta COLOR0 + lda palette + 2 + sta COLOR1 + lda palette + 3 + sta COLOR2 - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atari3.s b/libsrc/atari/tgi/atari3.s index 24dca69de..7cacc185b 100644 --- a/libsrc/atari/tgi/atari3.s +++ b/libsrc/atari/tgi/atari3.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 3 + grmode = 3 ; X resolution - x_res = 40 + x_res = 40 ; Y resolution - y_res = 24 + y_res = 24 ; Number of colors - colors = 4 + colors = 4 ; Pixels per byte - ppb = 4 + ppb = 4 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $00CC ; based on 4/3 display + aspect = $00CC ; based on 4/3 display ; Free memory needed - mem_needed = 1 + mem_needed = 1 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %11000000, %00110000, %00001100, %00000011 - masks: ; Color masks - .byte %00000000, %01010101, %10101010, %11111111 - bar_table: ; Mask table for BAR - .byte %11111111, %00111111, %00001111, %00000011, %00000000 - default_palette: - .byte $00, $0E, $32, $96 + mask_table: ; Mask table to set pixels + .byte %11000000, %00110000, %00001100, %00000011 + masks: ; Color masks + .byte %00000000, %01010101, %10101010, %11111111 + bar_table: ; Mask table for BAR + .byte %11111111, %00111111, %00001111, %00000011, %00000000 + default_palette: + .byte $00, $0E, $32, $96 .code @@ -55,31 +55,31 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + dey + bpl loop - ; Get the color entries from the palette - lda palette - sta COLOR4 - lda palette + 1 - sta COLOR0 - lda palette + 2 - sta COLOR1 - lda palette + 3 - sta COLOR2 + ; Get the color entries from the palette + lda palette + sta COLOR4 + lda palette + 1 + sta COLOR0 + lda palette + 2 + sta COLOR1 + lda palette + 3 + sta COLOR2 - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atari4.s b/libsrc/atari/tgi/atari4.s index 785e742e5..a37ec2fa3 100644 --- a/libsrc/atari/tgi/atari4.s +++ b/libsrc/atari/tgi/atari4.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 4 + grmode = 4 ; X resolution - x_res = 80 + x_res = 80 ; Y resolution - y_res = 48 + y_res = 48 ; Number of colors - colors = 2 + colors = 2 ; Pixels per byte - ppb = 8 + ppb = 8 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $00CC ; based on 4/3 display + aspect = $00CC ; based on 4/3 display ; Free memory needed - mem_needed = 1 + mem_needed = 1 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001 - masks: ; Color masks - .byte %00000000, %11111111 - bar_table: ; Mask table for BAR - .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000 - default_palette: - .byte $00, $0E + mask_table: ; Mask table to set pixels + .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001 + masks: ; Color masks + .byte %00000000, %11111111 + bar_table: ; Mask table for BAR + .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000 + default_palette: + .byte $00, $0E .code @@ -55,27 +55,27 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + dey + bpl loop - ; Get the color entries from the palette - lda palette - sta COLOR4 - lda palette + 1 - sta COLOR0 + ; Get the color entries from the palette + lda palette + sta COLOR4 + lda palette + 1 + sta COLOR0 - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atari5.s b/libsrc/atari/tgi/atari5.s index c8c699753..cf917d573 100644 --- a/libsrc/atari/tgi/atari5.s +++ b/libsrc/atari/tgi/atari5.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 5 + grmode = 5 ; X resolution - x_res = 80 + x_res = 80 ; Y resolution - y_res = 48 + y_res = 48 ; Number of colors - colors = 4 + colors = 4 ; Pixels per byte - ppb = 4 + ppb = 4 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $00CC ; based on 4/3 display + aspect = $00CC ; based on 4/3 display ; Free memory needed - mem_needed = 185 + mem_needed = 185 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %11000000, %00110000, %00001100, %00000011 - masks: ; Color masks - .byte %00000000, %01010101, %10101010, %11111111 - bar_table: ; Mask table for BAR - .byte %11111111, %00111111, %00001111, %00000011, %00000000 - default_palette: - .byte $00, $0E, $32, $96 + mask_table: ; Mask table to set pixels + .byte %11000000, %00110000, %00001100, %00000011 + masks: ; Color masks + .byte %00000000, %01010101, %10101010, %11111111 + bar_table: ; Mask table for BAR + .byte %11111111, %00111111, %00001111, %00000011, %00000000 + default_palette: + .byte $00, $0E, $32, $96 .code @@ -55,31 +55,31 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + dey + bpl loop - ; Get the color entries from the palette - lda palette - sta COLOR4 - lda palette + 1 - sta COLOR0 - lda palette + 2 - sta COLOR1 - lda palette + 3 - sta COLOR2 + ; Get the color entries from the palette + lda palette + sta COLOR4 + lda palette + 1 + sta COLOR0 + lda palette + 2 + sta COLOR1 + lda palette + 3 + sta COLOR2 - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atari6.s b/libsrc/atari/tgi/atari6.s index 091b698d4..be9f6b779 100644 --- a/libsrc/atari/tgi/atari6.s +++ b/libsrc/atari/tgi/atari6.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 6 + grmode = 6 ; X resolution - x_res = 160 + x_res = 160 ; Y resolution - y_res = 96 + y_res = 96 ; Number of colors - colors = 2 + colors = 2 ; Pixels per byte - ppb = 8 + ppb = 8 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $00CC ; based on 4/3 display + aspect = $00CC ; based on 4/3 display ; Free memory needed - mem_needed = 1193 + mem_needed = 1193 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001 - masks: ; Color masks - .byte %00000000, %11111111 - bar_table: ; Mask table for BAR - .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000 - default_palette: - .byte $00, $0E + mask_table: ; Mask table to set pixels + .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001 + masks: ; Color masks + .byte %00000000, %11111111 + bar_table: ; Mask table for BAR + .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000 + default_palette: + .byte $00, $0E .code @@ -55,27 +55,27 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + dey + bpl loop - ; Get the color entries from the palette - lda palette - sta COLOR4 - lda palette + 1 - sta COLOR0 + ; Get the color entries from the palette + lda palette + sta COLOR4 + lda palette + 1 + sta COLOR0 - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atari7.s b/libsrc/atari/tgi/atari7.s index 95a05d4e8..6e9d49acb 100644 --- a/libsrc/atari/tgi/atari7.s +++ b/libsrc/atari/tgi/atari7.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 7 + grmode = 7 ; X resolution - x_res = 160 + x_res = 160 ; Y resolution - y_res = 96 + y_res = 96 ; Number of colors - colors = 4 + colors = 4 ; Pixels per byte - ppb = 4 + ppb = 4 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $00CC ; based on 4/3 display + aspect = $00CC ; based on 4/3 display ; Free memory needed - mem_needed = 3209 + mem_needed = 3209 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %11000000, %00110000, %00001100, %00000011 - masks: ; Color masks - .byte %00000000, %01010101, %10101010, %11111111 - bar_table: ; Mask table for BAR - .byte %11111111, %00111111, %00001111, %00000011, %00000000 - default_palette: - .byte $00, $0E, $32, $96 + mask_table: ; Mask table to set pixels + .byte %11000000, %00110000, %00001100, %00000011 + masks: ; Color masks + .byte %00000000, %01010101, %10101010, %11111111 + bar_table: ; Mask table for BAR + .byte %11111111, %00111111, %00001111, %00000011, %00000000 + default_palette: + .byte $00, $0E, $32, $96 .code @@ -55,31 +55,31 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + dey + bpl loop - ; Get the color entries from the palette - lda palette - sta COLOR4 - lda palette + 1 - sta COLOR0 - lda palette + 2 - sta COLOR1 - lda palette + 3 - sta COLOR2 + ; Get the color entries from the palette + lda palette + sta COLOR4 + lda palette + 1 + sta COLOR0 + lda palette + 2 + sta COLOR1 + lda palette + 3 + sta COLOR2 - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atari8.s b/libsrc/atari/tgi/atari8.s index fe97a5a0a..7d2a63863 100644 --- a/libsrc/atari/tgi/atari8.s +++ b/libsrc/atari/tgi/atari8.s @@ -4,77 +4,77 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 8 + grmode = 8 ; X resolution - x_res = 320 + x_res = 320 ; Y resolution - y_res = 192 + y_res = 192 ; Number of colors - colors = 2 + colors = 2 ; Pixels per byte - ppb = 8 + ppb = 8 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $00CC ; based on 4/3 display + aspect = $00CC ; based on 4/3 display ; Free memory needed - mem_needed = 7147 + mem_needed = 7147 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001 - masks: ; Color masks - .byte %00000000, %11111111 - bar_table: ; Mask table for BAR - .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000 - default_palette: - .byte $00, $0E + mask_table: ; Mask table to set pixels + .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001 + masks: ; Color masks + .byte %00000000, %11111111 + bar_table: ; Mask table for BAR + .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000 + default_palette: + .byte $00, $0E .code ; ****************************************************************************** .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + dey + bpl loop - ; Get the color entries from the palette - lda palette - sta COLOR2 - lda palette + 1 - sta COLOR1 + ; Get the color entries from the palette + lda palette + sta COLOR2 + lda palette + 1 + sta COLOR1 - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atari9.s b/libsrc/atari/tgi/atari9.s index 38e23702a..41c783de1 100644 --- a/libsrc/atari/tgi/atari9.s +++ b/libsrc/atari/tgi/atari9.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 9 + grmode = 9 ; X resolution - x_res = 80 + x_res = 80 ; Y resolution - y_res = 192 + y_res = 192 ; Number of colors - colors = 16 + colors = 16 ; Pixels per byte - ppb = 2 + ppb = 2 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $0330 ; based on 4/3 display + aspect = $0330 ; based on 4/3 display ; Free memory needed - mem_needed = 7147 + mem_needed = 7147 ; Number of screen pages - pages = 1 + pages = 1 .rodata - mask_table: ; Mask table to set pixels - .byte %11110000, %00001111 - masks: ; Color masks - .byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff - bar_table: ; Mask table for BAR - .byte %11111111, %00001111, %00000000 - default_palette: - .byte $00, $0F, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E + mask_table: ; Mask table to set pixels + .byte %11110000, %00001111 + masks: ; Color masks + .byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff + bar_table: ; Mask table for BAR + .byte %11111111, %00001111, %00000000 + default_palette: + .byte $00, $0F, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E .code @@ -55,14 +55,14 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; No palettes + ; No palettes lda #TGI_ERR_INV_FUNC sta error rts diff --git a/libsrc/atari/tgi/atari_tgi_common.inc b/libsrc/atari/tgi/atari_tgi_common.inc index 9e9f74aa4..9190fe8c8 100644 --- a/libsrc/atari/tgi/atari_tgi_common.inc +++ b/libsrc/atari/tgi/atari_tgi_common.inc @@ -6,240 +6,240 @@ ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Header. Includes jump table and constants. - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Header. Includes jump table and constants. + ; + ; ---------------------------------------------------------------------- .segment "JUMPTABLE" ; Header - .byte $74, $67, $69 ; "tgi" - .byte TGI_API_VERSION ; TGI API version number - .word x_res ; X resolution - .word y_res ; Y resolution - .byte colors ; Number of drawing colors - .byte pages ; Number of screens available - .byte 8 ; System font X size - .byte 8 ; System font Y size - .word aspect ; Aspect ratio + .byte $74, $67, $69 ; "tgi" + .byte TGI_API_VERSION ; TGI API version number + .word x_res ; X resolution + .word y_res ; Y resolution + .byte colors ; Number of drawing colors + .byte pages ; Number of screens available + .byte 8 ; System font X size + .byte 8 ; System font Y size + .word aspect ; Aspect ratio .byte 0 ; TGI driver flags ; Function table - .addr INSTALL - .addr UNINSTALL - .addr INIT - .addr DONE - .addr GETERROR - .addr CONTROL - .addr CLEAR - .addr SETVIEWPAGE - .addr SETDRAWPAGE - .addr SETCOLOR - .addr SETPALETTE - .addr GETPALETTE - .addr GETDEFPALETTE - .addr SETPIXEL - .addr GETPIXEL - .addr LINE - .addr BAR - .addr TEXTSTYLE - .addr OUTTEXT - .addr 0 ; IRQ entry is unused + .addr INSTALL + .addr UNINSTALL + .addr INIT + .addr DONE + .addr GETERROR + .addr CONTROL + .addr CLEAR + .addr SETVIEWPAGE + .addr SETDRAWPAGE + .addr SETCOLOR + .addr SETPALETTE + .addr GETPALETTE + .addr GETDEFPALETTE + .addr SETPIXEL + .addr GETPIXEL + .addr LINE + .addr BAR + .addr TEXTSTYLE + .addr OUTTEXT + .addr 0 ; IRQ entry is unused ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Parameters - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Parameters + ; + ; ---------------------------------------------------------------------- - x1 := ptr1 - y1 := ptr2 - x2 := ptr3 - y2 := ptr4 - radius := tmp1 + x1 := ptr1 + y1 := ptr2 + x2 := ptr3 + y2 := ptr4 + radius := tmp1 ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Global variables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Global variables + ; + ; ---------------------------------------------------------------------- - sptr := regsave + 2 + sptr := regsave + 2 .bss - error: - .res 1 ; Error code + error: + .res 1 ; Error code .if ::grmode = 9 || ::grmode = 11 - palette = default_palette + palette = default_palette .else - palette: - .res colors ; The current palette + palette: + .res colors ; The current palette .endif - mask: - .res 1 ; Current pixel mask - griocb: - .res 1 ; IOCB channel number for graphics + mask: + .res 1 ; Current pixel mask + griocb: + .res 1 ; IOCB channel number for graphics .if pages = 2 - p0scr: - .res 1 ; High byte of screen address for screen page 0 - p0dls: - .res 1 ; High byte of display list address for screen page 0 - ; Page 1's addresses are 8K higher + p0scr: + .res 1 ; High byte of screen address for screen page 0 + p0dls: + .res 1 ; High byte of display list address for screen page 0 + ; Page 1's addresses are 8K higher .endif .data - mag_x: - .byte 1 ; Horizontal text scaling factor - mag_y: - .byte 1 ; Vertical text scaling factor - mag_x8: - .word 8 ; Horizontal text scaling factor * 8 - mag_y8: - .word 8 ; Vertical text scaling factor * 8 - text_dir: - .byte 0 ; Text direction, + mag_x: + .byte 1 ; Horizontal text scaling factor + mag_y: + .byte 1 ; Vertical text scaling factor + mag_x8: + .word 8 ; Horizontal text scaling factor * 8 + mag_y8: + .word 8 ; Vertical text scaling factor * 8 + text_dir: + .byte 0 ; Text direction, .code ; ****************************************************************************** -.macro put_pixel +.macro put_pixel - ; ---------------------------------------------------------------------- - ; - ; Put a pixel at (sptr),y using x as the bit mask offset - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Put a pixel at (sptr),y using x as the bit mask offset + ; + ; ---------------------------------------------------------------------- - lda (sptr),y - eor mask - and mask_table,x - eor (sptr),y - sta (sptr),y + lda (sptr),y + eor mask + and mask_table,x + eor (sptr),y + sta (sptr),y .endmacro ; ****************************************************************************** .rodata screen_device: - .byte "S:",$9B ; Device code for screen + .byte "S:",$9B ; Device code for screen screen_device_length := * - screen_device .code .proc INIT - ; ---------------------------------------------------------------------- - ; - ; INIT: Switch to graphics mode - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; INIT: Switch to graphics mode + ; + ; ---------------------------------------------------------------------- .code - ; Initialize drawing color + ; Initialize drawing color .if ::ppb = 8 - ldx #$FF + ldx #$FF .elseif ::ppb = 4 - ldx #$55 + ldx #$55 .elseif ::ppb = 2 - ldx #$11 + ldx #$11 .endif - stx mask + stx mask - ; Find a free IOCB - lda #$70 + ; Find a free IOCB + lda #$70 search: tax - ldy ICHID,x - cpy #$FF - beq found - sub #$10 - bcs search + ldy ICHID,x + cpy #$FF + beq found + sub #$10 + bcs search - ; Not enough resources available (free IOCB or memory) - ; enter with C cleared! -nores: lda #TGI_ERR_NO_RES - bcc exit + ; Not enough resources available (free IOCB or memory) + ; enter with C cleared! +nores: lda #TGI_ERR_NO_RES + bcc exit -found: ; Check if enough RAM is available - lda #0 - sub #mem_needed - cmp APPMHI + 1 - bcc nores - bne switch - cpy APPMHI - bcc nores ; not enough memory +found: ; Check if enough RAM is available + lda #0 + sub #mem_needed + cmp APPMHI + 1 + bcc nores + bne switch + cpy APPMHI + bcc nores ; not enough memory - ; Switch into graphics mode -switch: lda #OPEN - sta ICCOM,x - lda #OPNIN | OPNOT - sta ICAX1,x - lda #::grmode - sta ICAX2,x - lda #screen_device - sta ICBAH,x - lda #screen_device_length - sta ICBLH,x - jsr CIOV + ; Switch into graphics mode +switch: lda #OPEN + sta ICCOM,x + lda #OPNIN | OPNOT + sta ICAX1,x + lda #::grmode + sta ICAX2,x + lda #screen_device + sta ICBAH,x + lda #screen_device_length + sta ICBLH,x + jsr CIOV .if ::pages = 2 - ; Reserve 8K of high memory - lda RAMTOP - sub #32 - sta RAMTOP - ; Close and reopen graphics - lda #CLOSE - sta ICCOM,x - jsr CIOV - ; Reopen graphics - lda #OPEN - sta ICCOM,x - lda #OPNIN | OPNOT - sta ICAX1,x - lda #::grmode - sta ICAX2,x - lda #screen_device - sta ICBAH,x - lda #screen_device_length - sta ICBLH,x - jsr CIOV - ; Save screen pointers - lda SAVMSC + 1 - sta p0scr - lda SDLSTH - sta p0dls + ; Reserve 8K of high memory + lda RAMTOP + sub #32 + sta RAMTOP + ; Close and reopen graphics + lda #CLOSE + sta ICCOM,x + jsr CIOV + ; Reopen graphics + lda #OPEN + sta ICCOM,x + lda #OPNIN | OPNOT + sta ICAX1,x + lda #::grmode + sta ICAX2,x + lda #screen_device + sta ICBAH,x + lda #screen_device_length + sta ICBLH,x + jsr CIOV + ; Save screen pointers + lda SAVMSC + 1 + sta p0scr + lda SDLSTH + sta p0dls .endif ; ::pages = 2 - stx griocb + stx griocb - ; Reset the error code and return + ; Reset the error code and return lda #TGI_ERR_OK -exit: sta error +exit: sta error rts .endproc @@ -247,109 +247,109 @@ exit: sta error .proc DONE - ; ---------------------------------------------------------------------- - ; - ; DONE: Switch back to text mode - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; DONE: Switch back to text mode + ; + ; ---------------------------------------------------------------------- .code .if ::pages = 2 - ; Free 8K of high memory - lda RAMTOP - add #32 - sta RAMTOP + ; Free 8K of high memory + lda RAMTOP + add #32 + sta RAMTOP .endif - ; Clear griocb - lda #$FF - ldx griocb - sta griocb + ; Clear griocb + lda #$FF + ldx griocb + sta griocb - ; Close the S: device - lda #CLOSE - sta ICCOM,x - jsr CIOV + ; Close the S: device + lda #CLOSE + sta ICCOM,x + jsr CIOV - ; Reopen it in Graphics 0 - lda #OPEN - sta ICCOM,x - lda #OPNIN | OPNOT - sta ICAX1,x - lda #0 - sta ICAX2,x - lda #screen_device - sta ICBAH,x - lda #screen_device_length - sta ICBLH,x - jsr CIOV + ; Reopen it in Graphics 0 + lda #OPEN + sta ICCOM,x + lda #OPNIN | OPNOT + sta ICAX1,x + lda #0 + sta ICAX2,x + lda #screen_device + sta ICBAH,x + lda #screen_device_length + sta ICBLH,x + jsr CIOV - ; Now close it again; we don't need it anymore :) - lda #CLOSE - sta ICCOM,x - jmp CIOV + ; Now close it again; we don't need it anymore :) + lda #CLOSE + sta ICCOM,x + jmp CIOV .endproc ; ****************************************************************************** .proc GETERROR - ; ---------------------------------------------------------------------- - ; - ; GETERROR: Return the error code in A and clear it - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; GETERROR: Return the error code in A and clear it + ; + ; ---------------------------------------------------------------------- .code - ldx #TGI_ERR_OK - lda error - stx error - rts + ldx #TGI_ERR_OK + lda error + stx error + rts .endproc ; ****************************************************************************** .proc CLEAR - ; ---------------------------------------------------------------------- - ; - ; CLEAR: Clear the screen - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; CLEAR: Clear the screen + ; + ; ---------------------------------------------------------------------- .code - ; Load the screen address in sptr - lda SAVMSC - sta sptr - lda SAVMSC + 1 - sta sptr + 1 + ; Load the screen address in sptr + lda SAVMSC + sta sptr + lda SAVMSC + 1 + sta sptr + 1 - ; Fill with zero - lda #0 - tay + ; Fill with zero + lda #0 + tay .if >::scrsize > 0 - ; Clear full pages if any - ldx #>::scrsize -loop1: sta (sptr),y - iny - bne loop1 - inc sptr + 1 - dex - bne loop1 + ; Clear full pages if any + ldx #>::scrsize +loop1: sta (sptr),y + iny + bne loop1 + inc sptr + 1 + dex + bne loop1 .endif .if <::scrsize > 0 - ; Clear the rest, if any -loop2: sta (sptr),y - iny - cpy #<::scrsize - bne loop2 + ; Clear the rest, if any +loop2: sta (sptr),y + iny + cpy #<::scrsize + bne loop2 .endif rts @@ -359,11 +359,11 @@ loop2: sta (sptr),y .proc GETPALETTE - ; ---------------------------------------------------------------------- - ; - ; GETPALETTE: Return the current palette in A/X - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; GETPALETTE: Return the current palette in A/X + ; + ; ---------------------------------------------------------------------- .code lda # 0, 1 -> 15, 2 -> 1, 3 -> 2 etc. - beq cont - cpx #1 - bne map - ldx #16 -map: dex + ; Map colors like this: 0 -> 0, 1 -> 15, 2 -> 1, 3 -> 2 etc. + beq cont + cpx #1 + bne map + ldx #16 +map: dex cont: .endif - lda masks,x - sta mask - rts + lda masks,x + sta mask + rts .endproc ; ****************************************************************************** .proc CALC - ; ---------------------------------------------------------------------- - ; - ; CALC: Calculate the screen address - ; in - ; x1 (ptr1) x coordinate - ; y1 (ptr2) y coordinate - ; out - ; sptr + y screen address - ; x bit mask index - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; CALC: Calculate the screen address + ; in + ; x1 (ptr1) x coordinate + ; y1 (ptr2) y coordinate + ; out + ; sptr + y screen address + ; x bit mask index + ; + ; ---------------------------------------------------------------------- .bss - temp: .res 1 + temp: .res 1 .code - ; calculate line offset - lda y1 + 1 - sta temp - lda y1 + ; calculate line offset + lda y1 + 1 + sta temp + lda y1 .if ::x_res / ::ppb = 40 - yrep = 3 + yrep = 3 .elseif ::x_res / ::ppb = 20 - yrep = 2 + yrep = 2 .elseif ::x_res / ::ppb = 10 - yrep = 1 + yrep = 1 .endif -.repeat yrep - asl a - rol temp +.repeat yrep + asl a + rol temp .endrepeat - sta sptr - ldx temp - stx sptr + 1 + sta sptr + ldx temp + stx sptr + 1 -.repeat 2 - asl a - rol temp +.repeat 2 + asl a + rol temp .endrepeat - add sptr - sta sptr - lda temp - adc sptr + 1 - sta sptr + 1 + add sptr + sta sptr + lda temp + adc sptr + 1 + sta sptr + 1 - ; calculate bit mask offset - lda x1 - and #ppb - 1 - tax + ; calculate bit mask offset + lda x1 + and #ppb - 1 + tax - ; calculate row offset - lda x1 + 1 - sta temp - lda x1 + ; calculate row offset + lda x1 + 1 + sta temp + lda x1 .if ::ppb = 8 - xrep = 3 + xrep = 3 .elseif ::ppb = 4 - xrep = 2 + xrep = 2 .elseif ::ppb = 2 - xrep = 1 + xrep = 1 .endif -.repeat xrep - lsr temp - ror a +.repeat xrep + lsr temp + ror a .endrepeat - tay + tay - ; sptr += SAVMSC - lda SAVMSC - add sptr - sta sptr - lda SAVMSC + 1 - adc sptr + 1 - sta sptr + 1 + ; sptr += SAVMSC + lda SAVMSC + add sptr + sta sptr + lda SAVMSC + 1 + adc sptr + 1 + sta sptr + 1 - ; We're done! - rts + ; We're done! + rts .endproc ; ****************************************************************************** .proc SETPIXEL - ; ---------------------------------------------------------------------- - ; - ; Draw one pixel at x1, y1 - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Draw one pixel at x1, y1 + ; + ; ---------------------------------------------------------------------- .code - jsr CALC - put_pixel - rts + jsr CALC + put_pixel + rts .endproc ; ****************************************************************************** .proc GETPIXEL - ; ---------------------------------------------------------------------- - ; - ; GETPIXEL: Read the color value of a pixel and return it in A/X - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; GETPIXEL: Read the color value of a pixel and return it in A/X + ; + ; ---------------------------------------------------------------------- .code - jsr CALC - lda (sptr),y - and mask_table,x + jsr CALC + lda (sptr),y + and mask_table,x .if ::ppb = 8 - beq zero - lda #1 -zero: ldx #0 - rts + beq zero + lda #1 +zero: ldx #0 + rts .elseif ::ppb = 4 -loop: cpx #3 - beq done4 - lsr a - lsr a - inx - bne loop -done4: and #$03 - ldx #0 - rts +loop: cpx #3 + beq done4 + lsr a + lsr a + inx + bne loop +done4: and #$03 + ldx #0 + rts .elseif ::ppb = 2 - dex - bne shift - and #$0F - jmp exit -shift: lsr a - lsr a - lsr a - lsr a + dex + bne shift + and #$0F + jmp exit +shift: lsr a + lsr a + lsr a + lsr a exit: .if ::grmode = 9 - ; Mode 9 mapping - ; Map colors like this: 0 -> 0, 15 -> 1, 2 -> 3, 3 -> 4 etc. - beq done9 - cmp #15 - bne map9 - lda #0 -map9: add #1 + ; Mode 9 mapping + ; Map colors like this: 0 -> 0, 15 -> 1, 2 -> 3, 3 -> 4 etc. + beq done9 + cmp #15 + bne map9 + lda #0 +map9: add #1 done9: .endif .if ::grmode = 10 - ; Mode 10 mapping - ; Map out of range colors like this: - ; 9 -> 8 - ; 10 -> 8 - ; 11 -> 8 - ; 12 -> 0 - ; 13 -> 1 - ; 14 -> 2 - ; 15 -> 3 - cmp #9 - bcc done10 - sub #12 - bcs done10 - lda #8 + ; Mode 10 mapping + ; Map out of range colors like this: + ; 9 -> 8 + ; 10 -> 8 + ; 11 -> 8 + ; 12 -> 0 + ; 13 -> 1 + ; 14 -> 2 + ; 15 -> 3 + cmp #9 + bcc done10 + sub #12 + bcs done10 + lda #8 done10: .endif ; ::grmode = 10 - ; Done! - ldx #0 - rts -.endif ; ::ppb = 2 + ; Done! + ldx #0 + rts +.endif ; ::ppb = 2 .endproc @@ -602,422 +602,422 @@ done10: .proc LINE - ; ---------------------------------------------------------------------- - ; - ; LINE: Draw a line from x1,y1 to x2,y2 - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; LINE: Draw a line from x1,y1 to x2,y2 + ; + ; ---------------------------------------------------------------------- .ifdef USE_CIO_LINE - ; position ptr1, ptr2 - lda x1 - sta OLDCOL - lda x1 + 1 - sta OLDCOL + 1 - lda y1 - sta OLDROW - ; plot - jsr SETPIXEL - ; position ptr3,ptr4 - lda x2 - sta COLCRS - lda x2 + 1 - sta COLCRS + 1 - lda y2 - sta ROWCRS - ; drawto - ldx griocb - lda #DRAWLN - sta ICCOM,x - lda mask + ; position ptr1, ptr2 + lda x1 + sta OLDCOL + lda x1 + 1 + sta OLDCOL + 1 + lda y1 + sta OLDROW + ; plot + jsr SETPIXEL + ; position ptr3,ptr4 + lda x2 + sta COLCRS + lda x2 + 1 + sta COLCRS + 1 + lda y2 + sta ROWCRS + ; drawto + ldx griocb + lda #DRAWLN + sta ICCOM,x + lda mask .if ::grmode = 10 - and #$0f + and #$0f .else - and #colors - 1 + and #colors - 1 .endif - sta ATACHR - jmp CIOV + sta ATACHR + jmp CIOV -.else ; USE_CIO_LINE +.else ; USE_CIO_LINE ; locals - dx := sreg - dy := y1 - dx2 := x2 - dy2 := y2 - iy := tmp1 - err := tmp3 + dx := sreg + dy := y1 + dx2 := x2 + dy2 := y2 + iy := tmp1 + err := tmp3 .code - ; dx = x2 - x1 - lda x2 - sub x1 - sta dx - lda x2 + 1 - sbc x1 + 1 - sta dx + 1 - ; if dx is positive, no problem - bcs dx_positive + ; dx = x2 - x1 + lda x2 + sub x1 + sta dx + lda x2 + 1 + sbc x1 + 1 + sta dx + 1 + ; if dx is positive, no problem + bcs dx_positive - ; if dx is negative, swap x1,y1 with x2,y2 - lda x1 ; x1 <-> x2, low byte - ldx x2 - sta x2 - stx x1 - lda x1 + 1 ; x1 <-> x2, high byte - ldx x2 + 1 - sta x2 + 1 - stx x1 + 1 - lda y1 ; y1 <-> y2, low byte - ldx y2 - sta y2 - stx y1 - lda y1 + 1 ; y1 <-> y2, high byte - ldx y2 + 1 - sta y2 + 1 - stx y1 + 1 - ; Calculate again - jmp LINE + ; if dx is negative, swap x1,y1 with x2,y2 + lda x1 ; x1 <-> x2, low byte + ldx x2 + sta x2 + stx x1 + lda x1 + 1 ; x1 <-> x2, high byte + ldx x2 + 1 + sta x2 + 1 + stx x1 + 1 + lda y1 ; y1 <-> y2, low byte + ldx y2 + sta y2 + stx y1 + lda y1 + 1 ; y1 <-> y2, high byte + ldx y2 + 1 + sta y2 + 1 + stx y1 + 1 + ; Calculate again + jmp LINE dx_positive: - ; Calculate coords - jsr CALC + ; Calculate coords + jsr CALC - ; dy = y2 - y1 - lda y2 - sub y1 - sta dy - lda y2 + 1 - sbc y1 + 1 - sta dy + 1 + ; dy = y2 - y1 + lda y2 + sub y1 + sta dy + lda y2 + 1 + sbc y1 + 1 + sta dy + 1 - ; if dy is negative - bcs dy_positive - ; dy = -dy - lda #0 - sub dy - sta dy - lda #0 - sbc dy + 1 - sta dy + 1 - ; iy = -row_size - lda #<(65536 - x_res / ppb) - sta iy - lda #>(65536 - x_res / ppb) - sta iy + 1 - bne skip_iy_1 ; always + ; if dy is negative + bcs dy_positive + ; dy = -dy + lda #0 + sub dy + sta dy + lda #0 + sbc dy + 1 + sta dy + 1 + ; iy = -row_size + lda #<(65536 - x_res / ppb) + sta iy + lda #>(65536 - x_res / ppb) + sta iy + 1 + bne skip_iy_1 ; always dy_positive: - ; iy = row_size - lda #<(x_res / ppb) - sta iy - lda #>(x_res / ppb) - sta iy + 1 + ; iy = row_size + lda #<(x_res / ppb) + sta iy + lda #>(x_res / ppb) + sta iy + 1 skip_iy_1: - ; dx2 = dx * 2 - lda dx - asl a - sta dx2 - lda dx + 1 - rol a - sta dx2 + 1 + ; dx2 = dx * 2 + lda dx + asl a + sta dx2 + lda dx + 1 + rol a + sta dx2 + 1 - ; dy2 = dy * 2 - lda dy - asl a - sta dy2 - lda dy + 1 - rol a - sta dy2 + 1 + ; dy2 = dy * 2 + lda dy + asl a + sta dy2 + lda dy + 1 + rol a + sta dy2 + 1 - ; if dx >= dy - lda dx - cmp dy - lda dx + 1 - sbc dy + 1 - bcc dy_major + ; if dx >= dy + lda dx + cmp dy + lda dx + 1 + sbc dy + 1 + bcc dy_major - ; dx is the major axis + ; dx is the major axis - ; err = dy2 - dx - lda dy2 - sub dx - sta err - lda dy2 + 1 - sbc dx + 1 - sta err + 1 + ; err = dy2 - dx + lda dy2 + sub dx + sta err + lda dy2 + 1 + sbc dx + 1 + sta err + 1 - .scope -loop: ; main loop - put_pixel - ; if err >= 0 - lda err + 1 - bmi err_neg - ; err -= dx2 - lda err - sub dx2 - sta err - lda err + 1 - sbc dx2 + 1 - sta err + 1 - ; move_vertical (iy) - lda sptr - add iy - sta sptr - lda sptr + 1 - adc iy + 1 - sta sptr + 1 + .scope +loop: ; main loop + put_pixel + ; if err >= 0 + lda err + 1 + bmi err_neg + ; err -= dx2 + lda err + sub dx2 + sta err + lda err + 1 + sbc dx2 + 1 + sta err + 1 + ; move_vertical (iy) + lda sptr + add iy + sta sptr + lda sptr + 1 + adc iy + 1 + sta sptr + 1 err_neg: - ; err += dy2 - lda err - add dy2 - sta err - lda err + 1 - adc dy2 + 1 - sta err + 1 - ; move_right - inx - cpx #ppb - bne end_move - ldx #0 - iny - bne end_move - inc sptr + 1 + ; err += dy2 + lda err + add dy2 + sta err + lda err + 1 + adc dy2 + 1 + sta err + 1 + ; move_right + inx + cpx #ppb + bne end_move + ldx #0 + iny + bne end_move + inc sptr + 1 end_move: - ; loop while dx-- >= 0 - lda dx - ora dx + 1 - beq exit - dec dx - lda dx - cmp #$FF - bne loop - dec dx + 1 - jmp loop -exit: rts - .endscope + ; loop while dx-- >= 0 + lda dx + ora dx + 1 + beq exit + dec dx + lda dx + cmp #$FF + bne loop + dec dx + 1 + jmp loop +exit: rts + .endscope dy_major: - ; dy is the major axis + ; dy is the major axis - ; err = dx2 - dy; - lda dx2 - sub dy - sta err - lda dx2 + 1 - sbc dy + 1 - sta err + 1 + ; err = dx2 - dy; + lda dx2 + sub dy + sta err + lda dx2 + 1 + sbc dy + 1 + sta err + 1 - .scope -loop: ; main loop - put_pixel - ; if err >= 0 - lda err + 1 - bmi end_move - ; err -= dy2 - lda err - sub dy2 - sta err - lda err + 1 - sbc dy2 + 1 - sta err + 1 - ; move_right - inx - cpx #ppb - bne end_move - ldx #0 - iny - bne end_move - inc sptr + 1 + .scope +loop: ; main loop + put_pixel + ; if err >= 0 + lda err + 1 + bmi end_move + ; err -= dy2 + lda err + sub dy2 + sta err + lda err + 1 + sbc dy2 + 1 + sta err + 1 + ; move_right + inx + cpx #ppb + bne end_move + ldx #0 + iny + bne end_move + inc sptr + 1 end_move: - ; err += dx2 - lda err - add dx2 - sta err - lda err + 1 - adc dx2 + 1 - sta err + 1 - ; move_vertical(iy) - lda sptr - add iy - sta sptr - lda sptr + 1 - adc iy + 1 - sta sptr + 1 - ; loop while dy-- >= 0 - lda dy - ora dy + 1 - beq exit - dec dy - lda dy - cmp #$FF - bne loop - dec dy + 1 - jmp loop -exit: rts - .endscope -.endif ; USE_CIO_LINE + ; err += dx2 + lda err + add dx2 + sta err + lda err + 1 + adc dx2 + 1 + sta err + 1 + ; move_vertical(iy) + lda sptr + add iy + sta sptr + lda sptr + 1 + adc iy + 1 + sta sptr + 1 + ; loop while dy-- >= 0 + lda dy + ora dy + 1 + beq exit + dec dy + lda dy + cmp #$FF + bne loop + dec dy + 1 + jmp loop +exit: rts + .endscope +.endif ; USE_CIO_LINE .endproc ; ****************************************************************************** .proc clipped_bar - ; ---------------------------------------------------------------------- - ; - ; Clip and draw bar, this function will disappear when text clipping - ; will be done int the TGI kernel - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Clip and draw bar, this function will disappear when text clipping + ; will be done int the TGI kernel + ; + ; ---------------------------------------------------------------------- .code - lda y1 + 1 - bne off - lda y1 - cmp #y_res - bcs off + lda y1 + 1 + bne off + lda y1 + cmp #y_res + bcs off - lda x1 + 1 + lda x1 + 1 .if >(::x_res - 1) > 0 - cmp #>x_res - bcc check2 + cmp #>x_res + bcc check2 .endif - bne off - lda x1 - cmp #(::x_res - 1) > 0 - cmp #>x_res - bcc BAR + cmp #>x_res + bcc BAR .endif - bne off - lda x2 - cmp #(::x_res - 1) > 0 - lda x2 + 1 - sta x1 + 1 + lda x2 + 1 + sta x1 + 1 .endif - jsr CALC - ; Save the values - tya - add sptr - sta sptr - bcc skips - inc sptr + 1 -skips: inx - lda bar_table,x - eor #$FF - sta rmask - ; Calculate memory difference between x1 and x2 - lda sptr - sub lmem - sta dx -loop: ; Main loop - ldy #0 - ldx dx - beq same - ; Left - lda (lmem),y - eor mask - and lmask - eor (lmem),y - sta (lmem),y - iny - ; Between - lda mask - jmp next -btwn: sta (lmem),y - iny -next: dex - bne btwn - ; Right - lda (lmem),y - eor mask - and rmask - eor (lmem),y - sta (lmem),y - jmp cont -same: ; Same byte - lda lmask - and rmask - sta fmask - lda (lmem),y - eor mask - and fmask - eor (lmem),y - sta (lmem),y -cont: ; Go to next row - lda lmem - add #<(x_res / ppb) - sta lmem - bcc skipm - inc lmem + 1 -skipm: ; Loop while --dy > 0 - dec dy - bne loop + jsr CALC + ; Save the values + tya + add sptr + sta sptr + bcc skips + inc sptr + 1 +skips: inx + lda bar_table,x + eor #$FF + sta rmask + ; Calculate memory difference between x1 and x2 + lda sptr + sub lmem + sta dx +loop: ; Main loop + ldy #0 + ldx dx + beq same + ; Left + lda (lmem),y + eor mask + and lmask + eor (lmem),y + sta (lmem),y + iny + ; Between + lda mask + jmp next +btwn: sta (lmem),y + iny +next: dex + bne btwn + ; Right + lda (lmem),y + eor mask + and rmask + eor (lmem),y + sta (lmem),y + jmp cont +same: ; Same byte + lda lmask + and rmask + sta fmask + lda (lmem),y + eor mask + and fmask + eor (lmem),y + sta (lmem),y +cont: ; Go to next row + lda lmem + add #<(x_res / ppb) + sta lmem + bcc skipm + inc lmem + 1 +skipm: ; Loop while --dy > 0 + dec dy + bne loop - rts + rts .endproc @@ -1025,378 +1025,378 @@ skipm: ; Loop while --dy > 0 .proc TEXTSTYLE - ; ---------------------------------------------------------------------- - ; - ; TEXTSTYLE: Set text style. Scale factors in X and Y and direction in A - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; TEXTSTYLE: Set text style. Scale factors in X and Y and direction in A + ; + ; ---------------------------------------------------------------------- .code - stx mag_x - sty mag_y - ; Save text direction in bit 8 so that we can use BIT instruction later - lsr a - ror a - sta text_dir - ; Save 8 * scaling factors - lda #0 - sta mag_x8 + 1 - sta mag_y8 + 1 - ; Save 8 * mag_x - txa + stx mag_x + sty mag_y + ; Save text direction in bit 8 so that we can use BIT instruction later + lsr a + ror a + sta text_dir + ; Save 8 * scaling factors + lda #0 + sta mag_x8 + 1 + sta mag_y8 + 1 + ; Save 8 * mag_x + txa - .repeat 3 - asl a - rol mag_x8 + 1 - .endrepeat + .repeat 3 + asl a + rol mag_x8 + 1 + .endrepeat - sta mag_x8 - ; Save 8 * mag_y - tya + sta mag_x8 + ; Save 8 * mag_y + tya - .repeat 3 - asl a - rol mag_y8 + 1 - .endrepeat + .repeat 3 + asl a + rol mag_y8 + 1 + .endrepeat - sta mag_y8 - ; Done! - rts + sta mag_y8 + ; Done! + rts .endproc ; ****************************************************************************** .proc OUTTEXT - ; ---------------------------------------------------------------------- - ; - ; OUTTEXT: Draw text at x1, y1. String is in ptr3 - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; OUTTEXT: Draw text at x1, y1. String is in ptr3 + ; + ; ---------------------------------------------------------------------- ; locals - string := tmp1 - cols := tmp3 - pixels := tmp4 - font := regsave + string := tmp1 + cols := tmp3 + pixels := tmp4 + font := regsave .rodata - ataint: .byte 64,0,32,96 + ataint: .byte 64,0,32,96 .bss - rows: .res 1 + rows: .res 1 .if >(::x_res - 1) > 0 - oldx1: .res 2 - oldx2: .res 2 + oldx1: .res 2 + oldx2: .res 2 .else - oldx1: .res 1 - oldx2: .res 1 + oldx1: .res 1 + oldx2: .res 1 .endif - oldy1: .res 1 - oldy2: .res 1 - inv: .res 1 + oldy1: .res 1 + oldy2: .res 1 + inv: .res 1 .code - ; Don't draw zero sized characters - lda mag_x - ora mag_y - bne not0 - rts + ; Don't draw zero sized characters + lda mag_x + ora mag_y + bne not0 + rts -not0: ; Save string address, ptr3 is needed by BAR - lda ptr3 - sta string - lda ptr3 + 1 - sta string + 1 +not0: ; Save string address, ptr3 is needed by BAR + lda ptr3 + sta string + lda ptr3 + 1 + sta string + 1 - bit text_dir - bmi vert + bit text_dir + bmi vert - ; Calculate x2 - lda mag_x - sub #1 - add x1 - sta x2 + ; Calculate x2 + lda mag_x + sub #1 + add x1 + sta x2 .if >(::x_res - 1) > 0 - lda x1 + 1 - adc #0 - sta x2 + 1 + lda x1 + 1 + adc #0 + sta x2 + 1 .else - lda #0 - sta x2 + 1 + lda #0 + sta x2 + 1 .endif - ; Calculate y2 and adjust y1 - dec y1 - lda y1 - sta y2 - sub mag_y - add #1 - sta y1 - lda #0 - sta y2 + 1 + ; Calculate y2 and adjust y1 + dec y1 + lda y1 + sta y2 + sub mag_y + add #1 + sta y1 + lda #0 + sta y2 + 1 - jmp while + jmp while - ; Calculate for vertical text -vert: lda x1 - sub #1 - sta x2 - lda x1 + 1 - sbc #0 - sta x2 + 1 - lda x1 - sub mag_y - sta x1 - lda x1 + 1 - sbc #0 - sta x1 + 1 + ; Calculate for vertical text +vert: lda x1 + sub #1 + sta x2 + lda x1 + 1 + sbc #0 + sta x2 + 1 + lda x1 + sub mag_y + sta x1 + lda x1 + 1 + sbc #0 + sta x1 + 1 - lda mag_x - sub #1 - add y1 - sta y2 - lda #0 - sta y2 + 1 - jmp while + lda mag_x + sub #1 + add y1 + sta y2 + lda #0 + sta y2 + 1 + jmp while - ; Main loop -loop: inc string - bne skiph - inc string + 1 -skiph: ; Save coords - bit text_dir - bmi scvert + ; Main loop +loop: inc string + bne skiph + inc string + 1 +skiph: ; Save coords + bit text_dir + bmi scvert - ldx y1 - stx oldy1 - ldx y2 - stx oldy2 - jmp draw + ldx y1 + stx oldy1 + ldx y2 + stx oldy2 + jmp draw -scvert: ldx x1 - stx oldx1 - ldx x2 - stx oldx2 +scvert: ldx x1 + stx oldx1 + ldx x2 + stx oldx2 .if >(::x_res - 1) > 0 - ldx x1 + 1 - stx oldx1 + 1 - ldx x2 + 1 - stx oldx2 + 1 + ldx x1 + 1 + stx oldx1 + 1 + ldx x2 + 1 + stx oldx2 + 1 .endif - ; Draw one character - ; Convert to ANTIC code -draw: tay - rol a - rol a - rol a - rol a - and #3 - tax - tya - and #$9f - ora ataint,x - ; Save and clear inverse video bit - sta inv - and #$7F - ; Calculate font data address - sta font - lda #0 - sta font + 1 + ; Draw one character + ; Convert to ANTIC code +draw: tay + rol a + rol a + rol a + rol a + and #3 + tax + tya + and #$9f + ora ataint,x + ; Save and clear inverse video bit + sta inv + and #$7F + ; Calculate font data address + sta font + lda #0 + sta font + 1 - .repeat 3 - asl font - rol a - .endrepeat + .repeat 3 + asl font + rol a + .endrepeat - adc CHBAS - sta font + 1 - ; Save old coords - bit text_dir - bpl hor - lda y1 - sta oldy1 - lda y2 - sta oldy2 - jmp cont -hor: lda x1 - sta oldx1 - lda x2 - sta oldx2 + adc CHBAS + sta font + 1 + ; Save old coords + bit text_dir + bpl hor + lda y1 + sta oldy1 + lda y2 + sta oldy2 + jmp cont +hor: lda x1 + sta oldx1 + lda x2 + sta oldx2 .if >(::x_res - 1) > 0 - lda x1 + 1 - sta oldx1 + 1 - lda x2 + 1 - sta oldx2 + 1 + lda x1 + 1 + sta oldx1 + 1 + lda x2 + 1 + sta oldx2 + 1 .endif - ; Get glyph pixels -cont: ldy #7 - ; Put one row of the glyph -putrow: sty rows - lda (font),y - bit inv - bpl noinv - eor #$FF -noinv: sta pixels - lda #7 - sta cols - ; Put one column of the row -putcol: asl pixels - bcc next_col - lda x1 - pha - lda x1 + 1 - pha - jsr clipped_bar - pla - sta x1 + 1 - pla - sta x1 + ; Get glyph pixels +cont: ldy #7 + ; Put one row of the glyph +putrow: sty rows + lda (font),y + bit inv + bpl noinv + eor #$FF +noinv: sta pixels + lda #7 + sta cols + ; Put one column of the row +putcol: asl pixels + bcc next_col + lda x1 + pha + lda x1 + 1 + pha + jsr clipped_bar + pla + sta x1 + 1 + pla + sta x1 next_col: - ; Go to next column - ; increase x coords - bit text_dir - bmi vertinc + ; Go to next column + ; increase x coords + bit text_dir + bmi vertinc - lda mag_x - add x1 - sta x1 - bcc L1 - inc x1 + 1 -L1: lda mag_x - add x2 - sta x2 - bcc L2 - inc x2 + 1 - jmp L2 + lda mag_x + add x1 + sta x1 + bcc L1 + inc x1 + 1 +L1: lda mag_x + add x2 + sta x2 + bcc L2 + inc x2 + 1 + jmp L2 vertinc: - lda y1 - sub mag_x - sta y1 - lda y2 - sub mag_x - sta y2 + lda y1 + sub mag_x + sta y1 + lda y2 + sub mag_x + sta y2 L2: - dec cols - bpl putcol + dec cols + bpl putcol next_row: - ; Go to next row - bit text_dir - bmi verty + ; Go to next row + bit text_dir + bmi verty - lda y1 - sub mag_y - sta y1 - bcs L3 - dec y1 + 1 -L3: lda y2 - sub mag_y - sta y2 - bcs L6 - dec y2 + 1 -L4: jmp L6 + lda y1 + sub mag_y + sta y1 + bcs L3 + dec y1 + 1 +L3: lda y2 + sub mag_y + sta y2 + bcs L6 + dec y2 + 1 +L4: jmp L6 -verty: lda x1 - sub mag_y - sta x1 - bcs L5 - dec x1 + 1 -L5: lda x2 - sub mag_y - sta x2 - bcs L6 - dec x2 + 1 +verty: lda x1 + sub mag_y + sta x1 + bcs L5 + dec x1 + 1 +L5: lda x2 + sub mag_y + sta x2 + bcs L6 + dec x2 + 1 L6: - ; Restore old values - bit text_dir - bpl reshor - lda oldy1 - sta y1 - lda oldy2 - sta y2 - jmp nextrow -reshor: lda oldx1 - sta x1 - lda oldx2 - sta x2 + ; Restore old values + bit text_dir + bpl reshor + lda oldy1 + sta y1 + lda oldy2 + sta y2 + jmp nextrow +reshor: lda oldx1 + sta x1 + lda oldx2 + sta x2 .if >(::x_res - 1) > 0 - lda oldx1 + 1 - sta x1 + 1 - lda oldx2 + 1 - sta x2 + 1 + lda oldx1 + 1 + sta x1 + 1 + lda oldx2 + 1 + sta x2 + 1 .endif - ; Next row + ; Next row nextrow: - ldy rows - dey - jpl putrow + ldy rows + dey + jpl putrow - ; Restore coords - bit text_dir - bmi resvert + ; Restore coords + bit text_dir + bmi resvert - ldx oldy1 - stx y1 - ldx oldy2 - stx y2 - ldx #0 - stx y1 + 1 - stx y2 + 1 + ldx oldy1 + stx y1 + ldx oldy2 + stx y2 + ldx #0 + stx y1 + 1 + stx y2 + 1 - lda mag_x8 - add x1 - sta x1 - lda mag_x8 + 1 - adc x1 + 1 - sta x1 + 1 - lda mag_x8 - add x2 - sta x2 - lda mag_x8 + 1 - adc x2 + 1 - sta x2 + 1 + lda mag_x8 + add x1 + sta x1 + lda mag_x8 + 1 + adc x1 + 1 + sta x1 + 1 + lda mag_x8 + add x2 + sta x2 + lda mag_x8 + 1 + adc x2 + 1 + sta x2 + 1 - jmp while + jmp while resvert: - ldx oldx1 - stx x1 - ldx oldx2 - stx x2 + ldx oldx1 + stx x1 + ldx oldx2 + stx x2 .if >(::x_res - 1) > 0 - ldx oldx1 + 1 - stx x1 + 1 - ldx oldx2 + 1 - stx x2 + 1 + ldx oldx1 + 1 + stx x1 + 1 + ldx oldx2 + 1 + stx x2 + 1 .endif - lda y1 - sub mag_x8 - sta y1 - lda y1 +1 - sbc mag_x8 + 1 - sta y1 + 1 - lda y2 - sub mag_x8 - sta y2 - lda y2 +1 - sbc mag_x8 + 1 - sta y2 + 1 + lda y1 + sub mag_x8 + sta y1 + lda y1 +1 + sbc mag_x8 + 1 + sta y1 + 1 + lda y2 + sub mag_x8 + sta y2 + lda y2 +1 + sbc mag_x8 + 1 + sta y2 + 1 - ; End of loop -while: ldy #0 - lda (string),y - jne loop ; Check for null character - rts + ; End of loop +while: ldy #0 + lda (string),y + jne loop ; Check for null character + rts .endproc @@ -1405,72 +1405,72 @@ while: ldy #0 .proc SETVIEWPAGE - ; ---------------------------------------------------------------------- - ; - ; SETVIEWPAGE, page in A - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETVIEWPAGE, page in A + ; + ; ---------------------------------------------------------------------- .code - tax - beq cont - lda #32 + tax + beq cont + lda #32 -cont: add p0dls - cmp SDLSTH - beq done ; We're already in the desired page +cont: add p0dls + cmp SDLSTH + beq done ; We're already in the desired page - ldx RTCLOK + 2 - sta SDLSTH + ldx RTCLOK + 2 + sta SDLSTH - ; Wait until next VBLANK -wait: cpx RTCLOK + 2 - beq wait + ; Wait until next VBLANK +wait: cpx RTCLOK + 2 + beq wait - ; Done -done: rts + ; Done +done: rts .endproc ; ****************************************************************************** .proc SETDRAWPAGE - ; ---------------------------------------------------------------------- - ; - ; SETDRAWPAGE, page in A - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETDRAWPAGE, page in A + ; + ; ---------------------------------------------------------------------- .code - tax - beq cont - lda #32 -cont: add p0scr - sta SAVMSC + 1 - rts + tax + beq cont + lda #32 +cont: add p0scr + sta SAVMSC + 1 + rts .endproc .endif ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Unimplemented functions that require an error code - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Unimplemented functions that require an error code + ; + ; ---------------------------------------------------------------------- CONTROL: - lda #TGI_ERR_INV_FUNC - sta error - ; fall through + lda #TGI_ERR_INV_FUNC + sta error + ; fall through ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Unimplemented functions that don't require an error code - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Unimplemented functions that don't require an error code + ; + ; ---------------------------------------------------------------------- INSTALL: UNINSTALL: diff --git a/libsrc/atari/tgi/atr10p2.s b/libsrc/atari/tgi/atr10p2.s index e29ff601c..aa3a6fcee 100644 --- a/libsrc/atari/tgi/atr10p2.s +++ b/libsrc/atari/tgi/atr10p2.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 10 + grmode = 10 ; X resolution - x_res = 80 + x_res = 80 ; Y resolution - y_res = 192 + y_res = 192 ; Number of colors - colors = 9 + colors = 9 ; Pixels per byte - ppb = 2 + ppb = 2 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $0330 ; based on 4/3 display + aspect = $0330 ; based on 4/3 display ; Free memory needed - mem_needed = 15339 + mem_needed = 15339 ; Number of screen pages - pages = 2 + pages = 2 .rodata - mask_table: ; Mask table to set pixels - .byte %11110000, %00001111 - masks: ; Color masks - .byte $00, $11, $22, $33, $44, $55, $66, $77, $88 - bar_table: ; Mask table for BAR - .byte %11111111, %00001111, %00000000 - default_palette: - .byte $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A + mask_table: ; Mask table to set pixels + .byte %11110000, %00001111 + masks: ; Color masks + .byte $00, $11, $22, $33, $44, $55, $66, $77, $88 + bar_table: ; Mask table for BAR + .byte %11111111, %00001111, %00000000 + default_palette: + .byte $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A .code @@ -55,22 +55,22 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - sta PCOLR0,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + sta PCOLR0,y + dey + bpl loop - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atr15p2.s b/libsrc/atari/tgi/atr15p2.s index a3cdd7726..7692d0699 100644 --- a/libsrc/atari/tgi/atr15p2.s +++ b/libsrc/atari/tgi/atr15p2.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 15 + grmode = 15 ; X resolution - x_res = 160 + x_res = 160 ; Y resolution - y_res = 192 + y_res = 192 ; Number of colors - colors = 4 + colors = 4 ; Pixels per byte - ppb = 4 + ppb = 4 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $0198 ; based on 4/3 display + aspect = $0198 ; based on 4/3 display ; Free memory needed - mem_needed = 15339 + mem_needed = 15339 ; Number of screen pages - pages = 2 + pages = 2 .rodata - mask_table: ; Mask table to set pixels - .byte %11000000, %00110000, %00001100, %00000011 - masks: ; Color masks - .byte %00000000, %01010101, %10101010, %11111111 - bar_table: ; Mask table for BAR - .byte %11111111, %00111111, %00001111, %00000011, %00000000 - default_palette: - .byte $00, $0E, $32, $96 + mask_table: ; Mask table to set pixels + .byte %11000000, %00110000, %00001100, %00000011 + masks: ; Color masks + .byte %00000000, %01010101, %10101010, %11111111 + bar_table: ; Mask table for BAR + .byte %11111111, %00111111, %00001111, %00000011, %00000000 + default_palette: + .byte $00, $0E, $32, $96 .code @@ -55,31 +55,31 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + dey + bpl loop - ; Get the color entries from the palette - lda palette - sta COLOR4 - lda palette + 1 - sta COLOR0 - lda palette + 2 - sta COLOR1 - lda palette + 3 - sta COLOR2 + ; Get the color entries from the palette + lda palette + sta COLOR4 + lda palette + 1 + sta COLOR0 + lda palette + 2 + sta COLOR1 + lda palette + 3 + sta COLOR2 - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atr8p2.s b/libsrc/atari/tgi/atr8p2.s index 162aa4460..f292f3787 100644 --- a/libsrc/atari/tgi/atr8p2.s +++ b/libsrc/atari/tgi/atr8p2.s @@ -4,77 +4,77 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 8 + grmode = 8 ; X resolution - x_res = 320 + x_res = 320 ; Y resolution - y_res = 192 + y_res = 192 ; Number of colors - colors = 2 + colors = 2 ; Pixels per byte - ppb = 8 + ppb = 8 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $00CC ; based on 4/3 display + aspect = $00CC ; based on 4/3 display ; Free memory needed - mem_needed = 15339 + mem_needed = 15339 ; Number of screen pages - pages = 2 + pages = 2 .rodata - mask_table: ; Mask table to set pixels - .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001 - masks: ; Color masks - .byte %00000000, %11111111 - bar_table: ; Mask table for BAR - .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000 - default_palette: - .byte $00, $0E + mask_table: ; Mask table to set pixels + .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001 + masks: ; Color masks + .byte %00000000, %11111111 + bar_table: ; Mask table for BAR + .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000 + default_palette: + .byte $00, $0E .code ; ****************************************************************************** .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; Copy the palette - ldy #colors - 1 -loop: lda (ptr1),y - sta palette,y - dey - bpl loop + ; Copy the palette + ldy #colors - 1 +loop: lda (ptr1),y + sta palette,y + dey + bpl loop - ; Get the color entries from the palette - lda palette - sta COLOR2 - lda palette + 1 - sta COLOR1 + ; Get the color entries from the palette + lda palette + sta COLOR2 + lda palette + 1 + sta COLOR1 - ; Done, reset the error code + ; Done, reset the error code lda #TGI_ERR_OK sta error rts diff --git a/libsrc/atari/tgi/atr9p2.s b/libsrc/atari/tgi/atr9p2.s index f8418f112..750df3ad7 100644 --- a/libsrc/atari/tgi/atr9p2.s +++ b/libsrc/atari/tgi/atr9p2.s @@ -4,50 +4,50 @@ ; Fatih Aygun (2009) ; - .include "atari.inc" - .include "zeropage.inc" + .include "atari.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" - .macpack generic + .macpack generic ; ****************************************************************************** - ; ---------------------------------------------------------------------- - ; - ; Constants and tables - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; Constants and tables + ; + ; ---------------------------------------------------------------------- ; Graphics mode - grmode = 9 + grmode = 9 ; X resolution - x_res = 80 + x_res = 80 ; Y resolution - y_res = 192 + y_res = 192 ; Number of colors - colors = 16 + colors = 16 ; Pixels per byte - ppb = 2 + ppb = 2 ; Screen memory size in bytes - scrsize = x_res * y_res / ppb + scrsize = x_res * y_res / ppb ; Pixel aspect ratio - aspect = $0330 ; based on 4/3 display + aspect = $0330 ; based on 4/3 display ; Free memory needed - mem_needed = 15339 + mem_needed = 15339 ; Number of screen pages - pages = 2 + pages = 2 .rodata - mask_table: ; Mask table to set pixels - .byte %11110000, %00001111 - masks: ; Color masks - .byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff - bar_table: ; Mask table for BAR - .byte %11111111, %00001111, %00000000 - default_palette: - .byte $00, $0F, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E + mask_table: ; Mask table to set pixels + .byte %11110000, %00001111 + masks: ; Color masks + .byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff + bar_table: ; Mask table for BAR + .byte %11111111, %00001111, %00000000 + default_palette: + .byte $00, $0F, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E .code @@ -55,14 +55,14 @@ .proc SETPALETTE - ; ---------------------------------------------------------------------- - ; - ; SETPALETTE: Set the palette (in ptr1) - ; - ; ---------------------------------------------------------------------- + ; ---------------------------------------------------------------------- + ; + ; SETPALETTE: Set the palette (in ptr1) + ; + ; ---------------------------------------------------------------------- .code - ; No palettes + ; No palettes lda #TGI_ERR_INV_FUNC sta error rts diff --git a/libsrc/atari/tgi_colors.s b/libsrc/atari/tgi_colors.s index 4dab483e2..6ef3729b4 100644 --- a/libsrc/atari/tgi_colors.s +++ b/libsrc/atari/tgi_colors.s @@ -2,7 +2,7 @@ ; Target-specific black & white values for use by the target-shared TGI kernel ; - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $01 + .export tgi_color_black:zp = $00 + .export tgi_color_white:zp = $01 diff --git a/libsrc/atari/tgi_stat_stddrv.s b/libsrc/atari/tgi_stat_stddrv.s index 015eb6318..05c570d7a 100644 --- a/libsrc/atari/tgi_stat_stddrv.s +++ b/libsrc/atari/tgi_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void tgi_static_stddrv[]; ; - .export _tgi_static_stddrv - .import _atari8_tgi + .export _tgi_static_stddrv + .import _atari8_tgi .rodata diff --git a/libsrc/atari/tgi_stddrv.s b/libsrc/atari/tgi_stddrv.s index 219842b08..94ced91d4 100644 --- a/libsrc/atari/tgi_stddrv.s +++ b/libsrc/atari/tgi_stddrv.s @@ -6,8 +6,8 @@ ; const char tgi_stddrv[]; ; - .export _tgi_stddrv + .export _tgi_stddrv .rodata -_tgi_stddrv: .asciiz "atari8.tgi" +_tgi_stddrv: .asciiz "atari8.tgi" diff --git a/libsrc/atari/toascii.s b/libsrc/atari/toascii.s index 328f1f486..39de0d746 100644 --- a/libsrc/atari/toascii.s +++ b/libsrc/atari/toascii.s @@ -8,12 +8,12 @@ .proc _toascii ; Clear the inverse video bit - and #$7F + and #$7F ; X must be zero on return - ldx #0 + ldx #0 ; Done! - rts + rts .endproc diff --git a/libsrc/atari/tvtype.s b/libsrc/atari/tvtype.s index 84540b898..76661bf72 100644 --- a/libsrc/atari/tvtype.s +++ b/libsrc/atari/tvtype.s @@ -9,18 +9,18 @@ ; - .include "atari.inc" - .include "get_tv.inc" + .include "atari.inc" + .include "get_tv.inc" -.proc _get_tv +.proc _get_tv - ldx #TV::NTSC ; Assume NTSC - lda PAL ; use hw register, PALNTS is only supported on XL/XE ROM - and #$0e - bne @NTSC - inx ; = TV::PAL -@NTSC: txa - ldx #0 ; Expand to int - rts + ldx #TV::NTSC ; Assume NTSC + lda PAL ; use hw register, PALNTS is only supported on XL/XE ROM + and #$0e + bne @NTSC + inx ; = TV::PAL +@NTSC: txa + ldx #0 ; Expand to int + rts .endproc diff --git a/libsrc/atari/ucase_fn.s b/libsrc/atari/ucase_fn.s index 79f16167f..a32ddce23 100644 --- a/libsrc/atari/ucase_fn.s +++ b/libsrc/atari/ucase_fn.s @@ -6,97 +6,97 @@ ; used by open.s and remove.s ; ; Calling parameters: -; AX - points to filename +; AX - points to filename ; Return parameters: -; C - 0/1 for OK/Error (filename too long) -; AX - points to uppercased version of the filename on the stack -; tmp3 - amount of bytes used on the stack (needed for cleanup) +; C - 0/1 for OK/Error (filename too long) +; AX - points to uppercased version of the filename on the stack +; tmp3 - amount of bytes used on the stack (needed for cleanup) ; Uses: ; ptr4 - scratch pointer used to remember original AX pointer ; ; - .include "atari.inc" + .include "atari.inc" -.ifdef DEFAULT_DEVICE - .importzp tmp2 - .import __defdev +.ifdef DEFAULT_DEVICE + .importzp tmp2 + .import __defdev .endif - .importzp tmp3,ptr4,sp - .import subysp,addysp - .export ucase_fn + .importzp tmp3,ptr4,sp + .import subysp,addysp + .export ucase_fn .proc ucase_fn - ; we make sure that the filename doesn't contain lowercase letters - ; we copy the filename we got onto the stack, uppercase it and use this - ; one to open the iocb - ; we're using tmp3, ptr4 + ; we make sure that the filename doesn't contain lowercase letters + ; we copy the filename we got onto the stack, uppercase it and use this + ; one to open the iocb + ; we're using tmp3, ptr4 - ; save the original pointer - sta ptr4 - stx ptr4+1 + ; save the original pointer + sta ptr4 + stx ptr4+1 -.ifdef DEFAULT_DEVICE - ldy #1 - sty tmp2 ; initialize flag: device present in passed string - lda #':' - cmp (ptr4),y - beq hasdev - iny - cmp (ptr4),y - beq hasdev - sta tmp2 ; set flag: no device in passed string +.ifdef DEFAULT_DEVICE + ldy #1 + sty tmp2 ; initialize flag: device present in passed string + lda #':' + cmp (ptr4),y + beq hasdev + iny + cmp (ptr4),y + beq hasdev + sta tmp2 ; set flag: no device in passed string hasdev: .endif - ldy #128 - sty tmp3 ; save size - jsr subysp ; make room on the stack + ldy #128 + sty tmp3 ; save size + jsr subysp ; make room on the stack - ; copy filename to the temp. place on the stack, also uppercasing it - ldy #0 + ; copy filename to the temp. place on the stack, also uppercasing it + ldy #0 -loop2: lda (ptr4),y - sta (sp),y - beq copy_end - bmi L1 ; Not lowercase (also, invalid, should reject) - cmp #'a' - bcc L1 ; Not lowercase - and #$DF ; make upper case char, assume ASCII chars - sta (sp),y ; store back +loop2: lda (ptr4),y + sta (sp),y + beq copy_end + bmi L1 ; Not lowercase (also, invalid, should reject) + cmp #'a' + bcc L1 ; Not lowercase + and #$DF ; make upper case char, assume ASCII chars + sta (sp),y ; store back L1: - iny - bpl loop2 ; bpl: this way we only support a max. length of 127 + iny + bpl loop2 ; bpl: this way we only support a max. length of 127 - ; Filename too long - jsr addysp ; restore the stack - sec ; indicate error - rts + ; Filename too long + jsr addysp ; restore the stack + sec ; indicate error + rts copy_end: -.ifdef DEFAULT_DEVICE - lda tmp2 - cmp #1 ; was device present in passed string? - beq hasdev2 ; yes, don't prepend something +.ifdef DEFAULT_DEVICE + lda tmp2 + cmp #1 ; was device present in passed string? + beq hasdev2 ; yes, don't prepend something - ldy #128+3 ; no, prepend "D:" (or other device) - sty tmp3 ; adjust stack size used - ldy #3 - jsr subysp ; adjust stack pointer - dey -cpdev: lda __defdev,y - sta (sp),y ; insert device name, number and ':' - dey - bpl cpdev + ldy #128+3 ; no, prepend "D:" (or other device) + sty tmp3 ; adjust stack size used + ldy #3 + jsr subysp ; adjust stack pointer + dey +cpdev: lda __defdev,y + sta (sp),y ; insert device name, number and ':' + dey + bpl cpdev hasdev2: .endif - ; leave A and X pointing to the modified filename - lda sp - ldx sp+1 - clc ; indicate success - rts + ; leave A and X pointing to the modified filename + lda sp + ldx sp+1 + clc ; indicate success + rts .endproc diff --git a/libsrc/atari/wherex.s b/libsrc/atari/wherex.s index c3e24c50e..1b72199a2 100644 --- a/libsrc/atari/wherex.s +++ b/libsrc/atari/wherex.s @@ -4,10 +4,10 @@ ; unsigned char wherex (void); ; - .export _wherex - .include "atari.inc" + .export _wherex + .include "atari.inc" _wherex: - lda COLCRS - ldx #0 - rts + lda COLCRS + ldx #0 + rts diff --git a/libsrc/atari/wherey.s b/libsrc/atari/wherey.s index de672b7af..f391eec17 100644 --- a/libsrc/atari/wherey.s +++ b/libsrc/atari/wherey.s @@ -4,10 +4,10 @@ ; unsigned char wherey (void); ; - .export _wherey - .include "atari.inc" + .export _wherey + .include "atari.inc" _wherey: - lda ROWCRS - ldx #0 - rts + lda ROWCRS + ldx #0 + rts diff --git a/libsrc/atari/write.s b/libsrc/atari/write.s index 645f0f934..1452b2eee 100644 --- a/libsrc/atari/write.s +++ b/libsrc/atari/write.s @@ -1,29 +1,29 @@ ; ; int __fastcall__ write (int fd, const void* buf, unsigned count); ; - .include "atari.inc" - .import __rwsetup,__do_oserror,__inviocb,__oserror - .export _write + .include "atari.inc" + .import __rwsetup,__do_oserror,__inviocb,__oserror + .export _write _write: - jsr __rwsetup ; do common setup - beq write9 ; if size 0, it's a no-op - cpx #$FF ; invalid iocb? - beq _inviocb - lda #PUTCHR - sta ICCOM,x - jsr CIOV - bpl write9 - jmp __do_oserror ; update errno + jsr __rwsetup ; do common setup + beq write9 ; if size 0, it's a no-op + cpx #$FF ; invalid iocb? + beq _inviocb + lda #PUTCHR + sta ICCOM,x + jsr CIOV + bpl write9 + jmp __do_oserror ; update errno write9: - lda ICBLL,x ; get buf len low - pha - lda ICBLH,x ; buf len high - tax - lda #0 - sta __oserror ; clear system dependend error code - pla - rts + lda ICBLL,x ; get buf len low + pha + lda ICBLH,x ; buf len high + tax + lda #0 + sta __oserror ; clear system dependend error code + pla + rts _inviocb: - jmp __inviocb + jmp __inviocb diff --git a/libsrc/atmos/_scrsize.s b/libsrc/atmos/_scrsize.s index 24eec248f..2dd58399d 100644 --- a/libsrc/atmos/_scrsize.s +++ b/libsrc/atmos/_scrsize.s @@ -4,7 +4,7 @@ ; Screen size variables ; - .export screensize + .export screensize .proc screensize diff --git a/libsrc/atmos/atmos_load.s b/libsrc/atmos/atmos_load.s index 30d67ab93..9e86373f3 100644 --- a/libsrc/atmos/atmos_load.s +++ b/libsrc/atmos/atmos_load.s @@ -2,24 +2,24 @@ ; based on code by Twilighte ; void __fastcall__ atmos_load(const char* name); - .export _atmos_load - .import store_filename + .export _atmos_load + .import store_filename -.proc _atmos_load +.proc _atmos_load - sei - jsr store_filename - ldx #$00 - stx $02ad - stx $02ae - stx $025a - stx $025b - jsr cload_bit - cli - rts + sei + jsr store_filename + ldx #$00 + stx $02ad + stx $02ae + stx $025a + stx $025b + jsr cload_bit + cli + rts cload_bit: - pha - jmp $e874 + pha + jmp $e874 .endproc diff --git a/libsrc/atmos/atmos_save.s b/libsrc/atmos/atmos_save.s index 7a4e68aae..0bd9e29cc 100644 --- a/libsrc/atmos/atmos_save.s +++ b/libsrc/atmos/atmos_save.s @@ -2,27 +2,27 @@ ; based on code by Twilighte ; void __fastcall__ atmos_save(const char* name, const void* start, const void* end); - .export _atmos_save - .import popax, store_filename + .export _atmos_save + .import popax, store_filename -.proc _atmos_save +.proc _atmos_save - sei - sta $02ab ; file end lo - stx $02ac ; file end hi - jsr popax - sta $02a9 ; file start lo - stx $02aa ; file start hi - jsr popax - jsr store_filename - lda #00 - sta $02ad - jsr csave_bit - cli - rts + sei + sta $02ab ; file end lo + stx $02ac ; file end hi + jsr popax + sta $02a9 ; file start lo + stx $02aa ; file start hi + jsr popax + jsr store_filename + lda #00 + sta $02ad + jsr csave_bit + cli + rts csave_bit: - php - jmp $e92c + php + jmp $e92c .endproc diff --git a/libsrc/atmos/cclear.s b/libsrc/atmos/cclear.s index 107696788..9d356a8ab 100644 --- a/libsrc/atmos/cclear.s +++ b/libsrc/atmos/cclear.s @@ -5,25 +5,25 @@ ; void cclear (unsigned char length); ; - .export _cclearxy, _cclear + .export _cclearxy, _cclear .import setscrptr .import rvs - .import popax + .import popax .importzp ptr2 .include "atmos.inc" _cclearxy: - pha ; Save the length - jsr popax ; Get X and Y + pha ; Save the length + jsr popax ; Get X and Y sta CURS_Y ; Store Y stx CURS_X ; Store X - pla ; Restore the length and run into _cclear + pla ; Restore the length and run into _cclear _cclear: - tax ; Is the length zero? - beq @L9 ; Jump if done + tax ; Is the length zero? + beq @L9 ; Jump if done jsr setscrptr ; Set ptr2 to screen, won't use X lda #' ' ora rvs @@ -33,6 +33,6 @@ _cclear: inc ptr2+1 ; Bump high byte of screen pointer @L2: dex bne @L1 -@L9: rts +@L9: rts diff --git a/libsrc/atmos/cgetc.s b/libsrc/atmos/cgetc.s index e64734719..38e7aa873 100644 --- a/libsrc/atmos/cgetc.s +++ b/libsrc/atmos/cgetc.s @@ -4,11 +4,11 @@ ; char cgetc (void); ; - .export _cgetc + .export _cgetc .constructor initcgetc - .import cursor + .import cursor - .include "atmos.inc" + .include "atmos.inc" diff --git a/libsrc/atmos/chline.s b/libsrc/atmos/chline.s index 85c7b58d2..61d0f394c 100644 --- a/libsrc/atmos/chline.s +++ b/libsrc/atmos/chline.s @@ -5,25 +5,25 @@ ; void chline (unsigned char length); ; - .export _chlinexy, _chline + .export _chlinexy, _chline .import setscrptr .import rvs - .import popax + .import popax .importzp ptr2 .include "atmos.inc" _chlinexy: - pha ; Save the length - jsr popax ; Get X and Y + pha ; Save the length + jsr popax ; Get X and Y sta CURS_Y ; Store Y stx CURS_X ; Store X - pla ; Restore the length and run into _chline + pla ; Restore the length and run into _chline _chline: - tax ; Is the length zero? - beq @L9 ; Jump if done + tax ; Is the length zero? + beq @L9 ; Jump if done jsr setscrptr ; Set ptr2 to screen, won't use X txa ; Length into A clc @@ -37,5 +37,5 @@ _chline: inc ptr2+1 ; Bump high byte of screen pointer @L2: dex bne @L1 -@L9: rts +@L9: rts diff --git a/libsrc/atmos/clock.s b/libsrc/atmos/clock.s index 56573a56a..4440f557d 100644 --- a/libsrc/atmos/clock.s +++ b/libsrc/atmos/clock.s @@ -4,14 +4,14 @@ ; clock_t clock (void); ; - .export _clock + .export _clock .import negax - .importzp sreg + .importzp sreg - .include "atmos.inc" + .include "atmos.inc" -.proc _clock +.proc _clock ; Clear the timer high 16 bits diff --git a/libsrc/atmos/clrscr.s b/libsrc/atmos/clrscr.s index 4f9a3486a..9dce665e9 100644 --- a/libsrc/atmos/clrscr.s +++ b/libsrc/atmos/clrscr.s @@ -2,15 +2,15 @@ ; Ullrich von Bassewitz, 2003-04-13 ; - .export _clrscr + .export _clrscr .importzp ptr2 - .include "atmos.inc" + .include "atmos.inc" ; ------------------------------------------------------------------------ ; void clrscr (void); -.proc _clrscr +.proc _clrscr ; Set the cursor to top left cursor position diff --git a/libsrc/atmos/color.s b/libsrc/atmos/color.s index 3a73ee5f2..8c9dfba9e 100644 --- a/libsrc/atmos/color.s +++ b/libsrc/atmos/color.s @@ -6,13 +6,13 @@ ; unsigned char __fastcall__ bordercolor (unsigned char color); ; - .export _textcolor, _bgcolor, _bordercolor + .export _textcolor, _bgcolor, _bordercolor .import return0, return1 -_textcolor = return1 +_textcolor = return1 -_bgcolor = return0 +_bgcolor = return0 -_bordercolor = return0 +_bordercolor = return0 diff --git a/libsrc/atmos/cputc.s b/libsrc/atmos/cputc.s index 6d4f17bdb..9f65be500 100644 --- a/libsrc/atmos/cputc.s +++ b/libsrc/atmos/cputc.s @@ -5,34 +5,34 @@ ; void cputc (char c); ; - .export _cputcxy, _cputc - .export setscrptr, putchar + .export _cputcxy, _cputc + .export setscrptr, putchar .import rvs - .import popax + .import popax .importzp ptr2 - .include "atmos.inc" + .include "atmos.inc" _cputcxy: - pha ; Save C - jsr popax ; Get X and Y + pha ; Save C + jsr popax ; Get X and Y sta CURS_Y ; Store Y stx CURS_X ; Store X - pla ; Restore C + pla ; Restore C ; Plot a character - also used as internal function -_cputc: cmp #$0D ; CR? - bne L1 - lda #0 - sta CURS_X ; Carriage return +_cputc: cmp #$0D ; CR? + bne L1 + lda #0 + sta CURS_X ; Carriage return rts -L1: cmp #$0A ; LF? - bne output - inc CURS_Y ; Newline - rts +L1: cmp #$0A ; LF? + bne output + inc CURS_Y ; Newline + rts ; Output the character, then advance the cursor position @@ -40,13 +40,13 @@ output: jsr putchar advance: - iny - cpy #40 - bne L3 - inc CURS_Y ; new line - ldy #0 ; + cr -L3: sty CURS_X - rts + iny + cpy #40 + bne L3 + inc CURS_Y ; new line + ldy #0 ; + cr +L3: sty CURS_X + rts ; ------------------------------------------------------------------------ ; Set ptr2 to the screen, load the X offset into Y @@ -59,7 +59,7 @@ L3: sty CURS_X sta ptr2 lda ScrTabHi,y ; Get high byte of line address sta ptr2+1 - ldy CURS_X ; Get X offset + ldy CURS_X ; Get X offset rts .endproc @@ -71,12 +71,12 @@ L3: sty CURS_X .code .proc putchar - ora rvs ; Set revers bit + ora rvs ; Set revers bit pha ; And save jsr setscrptr ; Set ptr2 to the screen pla ; Restore the character - sta (ptr2),y ; Set char - rts + sta (ptr2),y ; Set char + rts .endproc diff --git a/libsrc/atmos/crt0.s b/libsrc/atmos/crt0.s index d88e4c3ff..1588cbec0 100644 --- a/libsrc/atmos/crt0.s +++ b/libsrc/atmos/crt0.s @@ -4,110 +4,110 @@ ; By Debrune Jérôme and Ullrich von Bassewitz ; - .export _exit - .export __STARTUP__ : absolute = 1 ; Mark as startup - .import initlib, donelib - .import callmain, zerobss - .import __RAM_START__, __RAM_SIZE__ - .import __ZPSAVE_LOAD__, __STACKSIZE__ + .export _exit + .export __STARTUP__ : absolute = 1 ; Mark as startup + .import initlib, donelib + .import callmain, zerobss + .import __RAM_START__, __RAM_SIZE__ + .import __ZPSAVE_LOAD__, __STACKSIZE__ - .include "zeropage.inc" - .include "atmos.inc" + .include "zeropage.inc" + .include "atmos.inc" ; ------------------------------------------------------------------------ ; Oric tape header -.segment "TAPEHDR" +.segment "TAPEHDR" - .byte $16, $16, $16 ; Sync bytes - .byte $24 ; End of header marker + .byte $16, $16, $16 ; Sync bytes + .byte $24 ; End of header marker - .byte $00 ; $2B0 - .byte $00 ; $2AF - .byte $80 ; $2AE Machine code flag - .byte $C7 ; $2AD Autoload flag - .dbyt __ZPSAVE_LOAD__ - 1 ; $2AB - .dbyt __RAM_START__ ; $2A9 - .byte $00 ; $2A8 - .byte ((.VERSION >> 8) & $0F) + '0' - .byte ((.VERSION >> 4) & $0F) + '0' - .byte (.VERSION & $0F) + '0' - .byte $00 ; Zero terminated compiler version + .byte $00 ; $2B0 + .byte $00 ; $2AF + .byte $80 ; $2AE Machine code flag + .byte $C7 ; $2AD Autoload flag + .dbyt __ZPSAVE_LOAD__ - 1 ; $2AB + .dbyt __RAM_START__ ; $2A9 + .byte $00 ; $2A8 + .byte ((.VERSION >> 8) & $0F) + '0' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte (.VERSION & $0F) + '0' + .byte $00 ; Zero terminated compiler version ; ------------------------------------------------------------------------ ; Place the startup code in a special segment. -.segment "STARTUP" +.segment "STARTUP" ; Save the zero page area we're about to use - ldx #zpspace-1 -L1: lda sp,x - sta zpsave,x ; Save the zero page locations we need - dex - bpl L1 + ldx #zpspace-1 +L1: lda sp,x + sta zpsave,x ; Save the zero page locations we need + dex + bpl L1 ; Clear the BSS data - jsr zerobss + jsr zerobss ; Unprotect columns 0 and 1 - lda STATUS - sta stsave - and #%11011111 - sta STATUS + lda STATUS + sta stsave + and #%11011111 + sta STATUS ; Save system stuff and setup the stack - tsx - stx spsave ; Save system stk ptr + tsx + stx spsave ; Save system stk ptr - lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - sta sp - lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - sta sp+1 ; Set argument stack ptr + lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp + lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp+1 ; Set argument stack ptr ; Call module constructors - jsr initlib + jsr initlib ; Push arguments and call main() - jsr callmain + jsr callmain ; Call module destructors. This is also the _exit entry. -_exit: jsr donelib ; Run module destructors +_exit: jsr donelib ; Run module destructors ; Restore system stuff - ldx spsave - txs - lda stsave - sta STATUS + ldx spsave + txs + lda stsave + sta STATUS ; Copy back the zero page stuff - ldx #zpspace-1 -L2: lda zpsave,x - sta sp,x - dex - bpl L2 + ldx #zpspace-1 +L2: lda zpsave,x + sta sp,x + dex + bpl L2 ; Back to BASIC - rts + rts ; ------------------------------------------------------------------------ -.segment "ZPSAVE" +.segment "ZPSAVE" -zpsave: .res zpspace +zpsave: .res zpspace ; ------------------------------------------------------------------------ .bss -spsave: .res 1 -stsave: .res 1 +spsave: .res 1 +stsave: .res 1 diff --git a/libsrc/atmos/ctype.s b/libsrc/atmos/ctype.s index 15b7ea935..79edafbb2 100644 --- a/libsrc/atmos/ctype.s +++ b/libsrc/atmos/ctype.s @@ -33,267 +33,267 @@ ; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v') ; 7 - Space or tab character - .export __ctype + .export __ctype __ctype: - .byte $10 ; 0/00 ___ctrl_@___ - .byte $10 ; 1/01 ___ctrl_A___ - .byte $10 ; 2/02 ___ctrl_B___ - .byte $10 ; 3/03 ___ctrl_C___ - .byte $10 ; 4/04 ___ctrl_D___ - .byte $10 ; 5/05 ___ctrl_E___ - .byte $10 ; 6/06 ___ctrl_F___ - .byte $10 ; 7/07 ___ctrl_G___ - .byte $10 ; 8/08 ___ctrl_H___ - .byte $D0 ; 9/09 ___ctrl_I___ - .byte $50 ; 10/0a ___ctrl_J___ - .byte $50 ; 11/0b ___ctrl_K___ - .byte $50 ; 12/0c ___ctrl_L___ - .byte $50 ; 13/0d ___ctrl_M___ - .byte $10 ; 14/0e ___ctrl_N___ - .byte $10 ; 15/0f ___ctrl_O___ - .byte $10 ; 16/10 ___ctrl_P___ - .byte $10 ; 17/11 ___ctrl_Q___ - .byte $10 ; 18/12 ___ctrl_R___ - .byte $10 ; 19/13 ___ctrl_S___ - .byte $10 ; 20/14 ___ctrl_T___ - .byte $10 ; 21/15 ___ctrl_U___ - .byte $10 ; 22/16 ___ctrl_V___ - .byte $10 ; 23/17 ___ctrl_W___ - .byte $10 ; 24/18 ___ctrl_X___ - .byte $10 ; 25/19 ___ctrl_Y___ - .byte $10 ; 26/1a ___ctrl_Z___ - .byte $10 ; 27/1b ___ctrl_[___ - .byte $10 ; 28/1c ___ctrl_\___ - .byte $10 ; 29/1d ___ctrl_]___ - .byte $10 ; 30/1e ___ctrl_^___ - .byte $10 ; 31/1f ___ctrl_____ - .byte $A0 ; 32/20 ___SPACE___ - .byte $00 ; 33/21 _____!_____ - .byte $00 ; 34/22 _____"_____ - .byte $00 ; 35/23 _____#_____ - .byte $00 ; 36/24 _____$_____ - .byte $00 ; 37/25 _____%_____ - .byte $00 ; 38/26 _____&_____ - .byte $00 ; 39/27 _____'_____ - .byte $00 ; 40/28 _____(_____ - .byte $00 ; 41/29 _____)_____ - .byte $00 ; 42/2a _____*_____ - .byte $00 ; 43/2b _____+_____ - .byte $00 ; 44/2c _____,_____ - .byte $00 ; 45/2d _____-_____ - .byte $00 ; 46/2e _____._____ - .byte $00 ; 47/2f _____/_____ - .byte $0C ; 48/30 _____0_____ - .byte $0C ; 49/31 _____1_____ - .byte $0C ; 50/32 _____2_____ - .byte $0C ; 51/33 _____3_____ - .byte $0C ; 52/34 _____4_____ - .byte $0C ; 53/35 _____5_____ - .byte $0C ; 54/36 _____6_____ - .byte $0C ; 55/37 _____7_____ - .byte $0C ; 56/38 _____8_____ - .byte $0C ; 57/39 _____9_____ - .byte $00 ; 58/3a _____:_____ - .byte $00 ; 59/3b _____;_____ - .byte $00 ; 60/3c _____<_____ - .byte $00 ; 61/3d _____=_____ - .byte $00 ; 62/3e _____>_____ - .byte $00 ; 63/3f _____?_____ + .byte $10 ; 0/00 ___ctrl_@___ + .byte $10 ; 1/01 ___ctrl_A___ + .byte $10 ; 2/02 ___ctrl_B___ + .byte $10 ; 3/03 ___ctrl_C___ + .byte $10 ; 4/04 ___ctrl_D___ + .byte $10 ; 5/05 ___ctrl_E___ + .byte $10 ; 6/06 ___ctrl_F___ + .byte $10 ; 7/07 ___ctrl_G___ + .byte $10 ; 8/08 ___ctrl_H___ + .byte $D0 ; 9/09 ___ctrl_I___ + .byte $50 ; 10/0a ___ctrl_J___ + .byte $50 ; 11/0b ___ctrl_K___ + .byte $50 ; 12/0c ___ctrl_L___ + .byte $50 ; 13/0d ___ctrl_M___ + .byte $10 ; 14/0e ___ctrl_N___ + .byte $10 ; 15/0f ___ctrl_O___ + .byte $10 ; 16/10 ___ctrl_P___ + .byte $10 ; 17/11 ___ctrl_Q___ + .byte $10 ; 18/12 ___ctrl_R___ + .byte $10 ; 19/13 ___ctrl_S___ + .byte $10 ; 20/14 ___ctrl_T___ + .byte $10 ; 21/15 ___ctrl_U___ + .byte $10 ; 22/16 ___ctrl_V___ + .byte $10 ; 23/17 ___ctrl_W___ + .byte $10 ; 24/18 ___ctrl_X___ + .byte $10 ; 25/19 ___ctrl_Y___ + .byte $10 ; 26/1a ___ctrl_Z___ + .byte $10 ; 27/1b ___ctrl_[___ + .byte $10 ; 28/1c ___ctrl_\___ + .byte $10 ; 29/1d ___ctrl_]___ + .byte $10 ; 30/1e ___ctrl_^___ + .byte $10 ; 31/1f ___ctrl_____ + .byte $A0 ; 32/20 ___SPACE___ + .byte $00 ; 33/21 _____!_____ + .byte $00 ; 34/22 _____"_____ + .byte $00 ; 35/23 _____#_____ + .byte $00 ; 36/24 _____$_____ + .byte $00 ; 37/25 _____%_____ + .byte $00 ; 38/26 _____&_____ + .byte $00 ; 39/27 _____'_____ + .byte $00 ; 40/28 _____(_____ + .byte $00 ; 41/29 _____)_____ + .byte $00 ; 42/2a _____*_____ + .byte $00 ; 43/2b _____+_____ + .byte $00 ; 44/2c _____,_____ + .byte $00 ; 45/2d _____-_____ + .byte $00 ; 46/2e _____._____ + .byte $00 ; 47/2f _____/_____ + .byte $0C ; 48/30 _____0_____ + .byte $0C ; 49/31 _____1_____ + .byte $0C ; 50/32 _____2_____ + .byte $0C ; 51/33 _____3_____ + .byte $0C ; 52/34 _____4_____ + .byte $0C ; 53/35 _____5_____ + .byte $0C ; 54/36 _____6_____ + .byte $0C ; 55/37 _____7_____ + .byte $0C ; 56/38 _____8_____ + .byte $0C ; 57/39 _____9_____ + .byte $00 ; 58/3a _____:_____ + .byte $00 ; 59/3b _____;_____ + .byte $00 ; 60/3c _____<_____ + .byte $00 ; 61/3d _____=_____ + .byte $00 ; 62/3e _____>_____ + .byte $00 ; 63/3f _____?_____ - .byte $00 ; 64/40 _____@_____ - .byte $0A ; 65/41 _____A_____ - .byte $0A ; 66/42 _____B_____ - .byte $0A ; 67/43 _____C_____ - .byte $0A ; 68/44 _____D_____ - .byte $0A ; 69/45 _____E_____ - .byte $0A ; 70/46 _____F_____ - .byte $02 ; 71/47 _____G_____ - .byte $02 ; 72/48 _____H_____ - .byte $02 ; 73/49 _____I_____ - .byte $02 ; 74/4a _____J_____ - .byte $02 ; 75/4b _____K_____ - .byte $02 ; 76/4c _____L_____ - .byte $02 ; 77/4d _____M_____ - .byte $02 ; 78/4e _____N_____ - .byte $02 ; 79/4f _____O_____ - .byte $02 ; 80/50 _____P_____ - .byte $02 ; 81/51 _____Q_____ - .byte $02 ; 82/52 _____R_____ - .byte $02 ; 83/53 _____S_____ - .byte $02 ; 84/54 _____T_____ - .byte $02 ; 85/55 _____U_____ - .byte $02 ; 86/56 _____V_____ - .byte $02 ; 87/57 _____W_____ - .byte $02 ; 88/58 _____X_____ - .byte $02 ; 89/59 _____Y_____ - .byte $02 ; 90/5a _____Z_____ - .byte $00 ; 91/5b _____[_____ - .byte $00 ; 92/5c _____\_____ - .byte $00 ; 93/5d _____]_____ - .byte $00 ; 94/5e _____^_____ - .byte $00 ; 95/5f _UNDERLINE_ - .byte $00 ; 96/60 ___grave___ - .byte $09 ; 97/61 _____a_____ - .byte $09 ; 98/62 _____b_____ - .byte $09 ; 99/63 _____c_____ - .byte $09 ; 100/64 _____d_____ - .byte $09 ; 101/65 _____e_____ - .byte $09 ; 102/66 _____f_____ - .byte $01 ; 103/67 _____g_____ - .byte $01 ; 104/68 _____h_____ - .byte $01 ; 105/69 _____i_____ - .byte $01 ; 106/6a _____j_____ - .byte $01 ; 107/6b _____k_____ - .byte $01 ; 108/6c _____l_____ - .byte $01 ; 109/6d _____m_____ - .byte $01 ; 110/6e _____n_____ - .byte $01 ; 111/6f _____o_____ - .byte $01 ; 112/70 _____p_____ - .byte $01 ; 113/71 _____q_____ - .byte $01 ; 114/72 _____r_____ - .byte $01 ; 115/73 _____s_____ - .byte $01 ; 116/74 _____t_____ - .byte $01 ; 117/75 _____u_____ - .byte $01 ; 118/76 _____v_____ - .byte $01 ; 119/77 _____w_____ - .byte $01 ; 120/78 _____x_____ - .byte $01 ; 121/79 _____y_____ - .byte $01 ; 122/7a _____z_____ - .byte $00 ; 123/7b _____{_____ - .byte $00 ; 124/7c _____|_____ - .byte $00 ; 125/7d _____}_____ - .byte $00 ; 126/7e _____~_____ - .byte $40 ; 127/7f ____DEL____ + .byte $00 ; 64/40 _____@_____ + .byte $0A ; 65/41 _____A_____ + .byte $0A ; 66/42 _____B_____ + .byte $0A ; 67/43 _____C_____ + .byte $0A ; 68/44 _____D_____ + .byte $0A ; 69/45 _____E_____ + .byte $0A ; 70/46 _____F_____ + .byte $02 ; 71/47 _____G_____ + .byte $02 ; 72/48 _____H_____ + .byte $02 ; 73/49 _____I_____ + .byte $02 ; 74/4a _____J_____ + .byte $02 ; 75/4b _____K_____ + .byte $02 ; 76/4c _____L_____ + .byte $02 ; 77/4d _____M_____ + .byte $02 ; 78/4e _____N_____ + .byte $02 ; 79/4f _____O_____ + .byte $02 ; 80/50 _____P_____ + .byte $02 ; 81/51 _____Q_____ + .byte $02 ; 82/52 _____R_____ + .byte $02 ; 83/53 _____S_____ + .byte $02 ; 84/54 _____T_____ + .byte $02 ; 85/55 _____U_____ + .byte $02 ; 86/56 _____V_____ + .byte $02 ; 87/57 _____W_____ + .byte $02 ; 88/58 _____X_____ + .byte $02 ; 89/59 _____Y_____ + .byte $02 ; 90/5a _____Z_____ + .byte $00 ; 91/5b _____[_____ + .byte $00 ; 92/5c _____\_____ + .byte $00 ; 93/5d _____]_____ + .byte $00 ; 94/5e _____^_____ + .byte $00 ; 95/5f _UNDERLINE_ + .byte $00 ; 96/60 ___grave___ + .byte $09 ; 97/61 _____a_____ + .byte $09 ; 98/62 _____b_____ + .byte $09 ; 99/63 _____c_____ + .byte $09 ; 100/64 _____d_____ + .byte $09 ; 101/65 _____e_____ + .byte $09 ; 102/66 _____f_____ + .byte $01 ; 103/67 _____g_____ + .byte $01 ; 104/68 _____h_____ + .byte $01 ; 105/69 _____i_____ + .byte $01 ; 106/6a _____j_____ + .byte $01 ; 107/6b _____k_____ + .byte $01 ; 108/6c _____l_____ + .byte $01 ; 109/6d _____m_____ + .byte $01 ; 110/6e _____n_____ + .byte $01 ; 111/6f _____o_____ + .byte $01 ; 112/70 _____p_____ + .byte $01 ; 113/71 _____q_____ + .byte $01 ; 114/72 _____r_____ + .byte $01 ; 115/73 _____s_____ + .byte $01 ; 116/74 _____t_____ + .byte $01 ; 117/75 _____u_____ + .byte $01 ; 118/76 _____v_____ + .byte $01 ; 119/77 _____w_____ + .byte $01 ; 120/78 _____x_____ + .byte $01 ; 121/79 _____y_____ + .byte $01 ; 122/7a _____z_____ + .byte $00 ; 123/7b _____{_____ + .byte $00 ; 124/7c _____|_____ + .byte $00 ; 125/7d _____}_____ + .byte $00 ; 126/7e _____~_____ + .byte $40 ; 127/7f ____DEL____ - .byte $00 ; 128/80 ___________ - .byte $00 ; 129/81 ___________ - .byte $00 ; 130/82 ___________ - .byte $00 ; 131/83 ___________ - .byte $00 ; 132/84 ___________ - .byte $00 ; 133/85 ___________ - .byte $00 ; 134/86 ___________ - .byte $00 ; 135/87 ___________ - .byte $00 ; 136/88 ___________ - .byte $00 ; 137/89 ___________ - .byte $00 ; 138/8a ___________ - .byte $00 ; 139/8b ___________ - .byte $00 ; 140/8c ___________ - .byte $00 ; 141/8d ___________ - .byte $00 ; 142/8e ___________ - .byte $00 ; 143/8f ___________ - .byte $00 ; 144/90 ___________ - .byte $00 ; 145/91 ___________ - .byte $00 ; 146/92 ___________ - .byte $10 ; 147/93 ___________ - .byte $00 ; 148/94 ___________ - .byte $00 ; 149/95 ___________ - .byte $00 ; 150/96 ___________ - .byte $00 ; 151/97 ___________ - .byte $00 ; 152/98 ___________ - .byte $00 ; 153/99 ___________ - .byte $00 ; 154/9a ___________ - .byte $00 ; 155/9b ___________ - .byte $00 ; 156/9c ___________ - .byte $00 ; 157/9d ___________ - .byte $00 ; 158/9e ___________ - .byte $00 ; 159/9f ___________ + .byte $00 ; 128/80 ___________ + .byte $00 ; 129/81 ___________ + .byte $00 ; 130/82 ___________ + .byte $00 ; 131/83 ___________ + .byte $00 ; 132/84 ___________ + .byte $00 ; 133/85 ___________ + .byte $00 ; 134/86 ___________ + .byte $00 ; 135/87 ___________ + .byte $00 ; 136/88 ___________ + .byte $00 ; 137/89 ___________ + .byte $00 ; 138/8a ___________ + .byte $00 ; 139/8b ___________ + .byte $00 ; 140/8c ___________ + .byte $00 ; 141/8d ___________ + .byte $00 ; 142/8e ___________ + .byte $00 ; 143/8f ___________ + .byte $00 ; 144/90 ___________ + .byte $00 ; 145/91 ___________ + .byte $00 ; 146/92 ___________ + .byte $10 ; 147/93 ___________ + .byte $00 ; 148/94 ___________ + .byte $00 ; 149/95 ___________ + .byte $00 ; 150/96 ___________ + .byte $00 ; 151/97 ___________ + .byte $00 ; 152/98 ___________ + .byte $00 ; 153/99 ___________ + .byte $00 ; 154/9a ___________ + .byte $00 ; 155/9b ___________ + .byte $00 ; 156/9c ___________ + .byte $00 ; 157/9d ___________ + .byte $00 ; 158/9e ___________ + .byte $00 ; 159/9f ___________ - .byte $00 ; 160/a0 ___________ - .byte $00 ; 161/a1 ___________ - .byte $00 ; 162/a2 ___________ - .byte $00 ; 163/a3 ___________ - .byte $00 ; 164/a4 ___________ - .byte $00 ; 165/a5 ___________ - .byte $00 ; 166/a6 ___________ - .byte $00 ; 167/a7 ___________ - .byte $00 ; 168/a8 ___________ - .byte $00 ; 169/a9 ___________ - .byte $00 ; 170/aa ___________ - .byte $00 ; 171/ab ___________ - .byte $00 ; 172/ac ___________ - .byte $00 ; 173/ad ___________ - .byte $00 ; 174/ae ___________ - .byte $00 ; 175/af ___________ - .byte $00 ; 176/b0 ___________ - .byte $00 ; 177/b1 ___________ - .byte $00 ; 178/b2 ___________ - .byte $00 ; 179/b3 ___________ - .byte $00 ; 180/b4 ___________ - .byte $00 ; 181/b5 ___________ - .byte $00 ; 182/b6 ___________ - .byte $00 ; 183/b7 ___________ - .byte $00 ; 184/b8 ___________ - .byte $00 ; 185/b9 ___________ - .byte $00 ; 186/ba ___________ - .byte $00 ; 187/bb ___________ - .byte $00 ; 188/bc ___________ - .byte $00 ; 189/bd ___________ - .byte $00 ; 190/be ___________ - .byte $00 ; 191/bf ___________ + .byte $00 ; 160/a0 ___________ + .byte $00 ; 161/a1 ___________ + .byte $00 ; 162/a2 ___________ + .byte $00 ; 163/a3 ___________ + .byte $00 ; 164/a4 ___________ + .byte $00 ; 165/a5 ___________ + .byte $00 ; 166/a6 ___________ + .byte $00 ; 167/a7 ___________ + .byte $00 ; 168/a8 ___________ + .byte $00 ; 169/a9 ___________ + .byte $00 ; 170/aa ___________ + .byte $00 ; 171/ab ___________ + .byte $00 ; 172/ac ___________ + .byte $00 ; 173/ad ___________ + .byte $00 ; 174/ae ___________ + .byte $00 ; 175/af ___________ + .byte $00 ; 176/b0 ___________ + .byte $00 ; 177/b1 ___________ + .byte $00 ; 178/b2 ___________ + .byte $00 ; 179/b3 ___________ + .byte $00 ; 180/b4 ___________ + .byte $00 ; 181/b5 ___________ + .byte $00 ; 182/b6 ___________ + .byte $00 ; 183/b7 ___________ + .byte $00 ; 184/b8 ___________ + .byte $00 ; 185/b9 ___________ + .byte $00 ; 186/ba ___________ + .byte $00 ; 187/bb ___________ + .byte $00 ; 188/bc ___________ + .byte $00 ; 189/bd ___________ + .byte $00 ; 190/be ___________ + .byte $00 ; 191/bf ___________ - .byte $02 ; 192/c0 ___________ - .byte $02 ; 193/c1 ___________ - .byte $02 ; 194/c2 ___________ - .byte $02 ; 195/c3 ___________ - .byte $02 ; 196/c4 ___________ - .byte $02 ; 197/c5 ___________ - .byte $02 ; 198/c6 ___________ - .byte $02 ; 199/c7 ___________ - .byte $02 ; 200/c8 ___________ - .byte $02 ; 201/c9 ___________ - .byte $02 ; 202/ca ___________ - .byte $02 ; 203/cb ___________ - .byte $02 ; 204/cc ___________ - .byte $02 ; 205/cd ___________ - .byte $02 ; 206/ce ___________ - .byte $02 ; 207/cf ___________ - .byte $02 ; 208/d0 ___________ - .byte $02 ; 209/d1 ___________ - .byte $02 ; 210/d2 ___________ - .byte $02 ; 211/d3 ___________ - .byte $02 ; 212/d4 ___________ - .byte $02 ; 213/d5 ___________ - .byte $02 ; 214/d6 ___________ - .byte $02 ; 215/d7 ___________ - .byte $02 ; 216/d8 ___________ - .byte $02 ; 217/d9 ___________ - .byte $02 ; 218/da ___________ - .byte $02 ; 219/db ___________ - .byte $02 ; 220/dc ___________ - .byte $02 ; 221/dd ___________ - .byte $02 ; 222/de ___________ - .byte $00 ; 223/df ___________ - .byte $01 ; 224/e0 ___________ - .byte $01 ; 225/e1 ___________ - .byte $01 ; 226/e2 ___________ - .byte $01 ; 227/e3 ___________ - .byte $01 ; 228/e4 ___________ - .byte $01 ; 229/e5 ___________ - .byte $01 ; 230/e6 ___________ - .byte $01 ; 231/e7 ___________ - .byte $01 ; 232/e8 ___________ - .byte $01 ; 233/e9 ___________ - .byte $01 ; 234/ea ___________ - .byte $01 ; 235/eb ___________ - .byte $01 ; 236/ec ___________ - .byte $01 ; 237/ed ___________ - .byte $01 ; 238/ee ___________ - .byte $01 ; 239/ef ___________ - .byte $01 ; 240/f0 ___________ - .byte $01 ; 241/f1 ___________ - .byte $01 ; 242/f2 ___________ - .byte $01 ; 243/f3 ___________ - .byte $01 ; 244/f4 ___________ - .byte $01 ; 245/f5 ___________ - .byte $01 ; 246/f6 ___________ - .byte $01 ; 247/f7 ___________ - .byte $01 ; 248/f8 ___________ - .byte $01 ; 249/f9 ___________ - .byte $01 ; 250/fa ___________ - .byte $01 ; 251/fb ___________ - .byte $01 ; 252/fc ___________ - .byte $01 ; 253/fd ___________ - .byte $01 ; 254/fe ___________ - .byte $00 ; 255/ff ___________ + .byte $02 ; 192/c0 ___________ + .byte $02 ; 193/c1 ___________ + .byte $02 ; 194/c2 ___________ + .byte $02 ; 195/c3 ___________ + .byte $02 ; 196/c4 ___________ + .byte $02 ; 197/c5 ___________ + .byte $02 ; 198/c6 ___________ + .byte $02 ; 199/c7 ___________ + .byte $02 ; 200/c8 ___________ + .byte $02 ; 201/c9 ___________ + .byte $02 ; 202/ca ___________ + .byte $02 ; 203/cb ___________ + .byte $02 ; 204/cc ___________ + .byte $02 ; 205/cd ___________ + .byte $02 ; 206/ce ___________ + .byte $02 ; 207/cf ___________ + .byte $02 ; 208/d0 ___________ + .byte $02 ; 209/d1 ___________ + .byte $02 ; 210/d2 ___________ + .byte $02 ; 211/d3 ___________ + .byte $02 ; 212/d4 ___________ + .byte $02 ; 213/d5 ___________ + .byte $02 ; 214/d6 ___________ + .byte $02 ; 215/d7 ___________ + .byte $02 ; 216/d8 ___________ + .byte $02 ; 217/d9 ___________ + .byte $02 ; 218/da ___________ + .byte $02 ; 219/db ___________ + .byte $02 ; 220/dc ___________ + .byte $02 ; 221/dd ___________ + .byte $02 ; 222/de ___________ + .byte $00 ; 223/df ___________ + .byte $01 ; 224/e0 ___________ + .byte $01 ; 225/e1 ___________ + .byte $01 ; 226/e2 ___________ + .byte $01 ; 227/e3 ___________ + .byte $01 ; 228/e4 ___________ + .byte $01 ; 229/e5 ___________ + .byte $01 ; 230/e6 ___________ + .byte $01 ; 231/e7 ___________ + .byte $01 ; 232/e8 ___________ + .byte $01 ; 233/e9 ___________ + .byte $01 ; 234/ea ___________ + .byte $01 ; 235/eb ___________ + .byte $01 ; 236/ec ___________ + .byte $01 ; 237/ed ___________ + .byte $01 ; 238/ee ___________ + .byte $01 ; 239/ef ___________ + .byte $01 ; 240/f0 ___________ + .byte $01 ; 241/f1 ___________ + .byte $01 ; 242/f2 ___________ + .byte $01 ; 243/f3 ___________ + .byte $01 ; 244/f4 ___________ + .byte $01 ; 245/f5 ___________ + .byte $01 ; 246/f6 ___________ + .byte $01 ; 247/f7 ___________ + .byte $01 ; 248/f8 ___________ + .byte $01 ; 249/f9 ___________ + .byte $01 ; 250/fa ___________ + .byte $01 ; 251/fb ___________ + .byte $01 ; 252/fc ___________ + .byte $01 ; 253/fd ___________ + .byte $01 ; 254/fe ___________ + .byte $00 ; 255/ff ___________ diff --git a/libsrc/atmos/cvline.s b/libsrc/atmos/cvline.s index 09eea4caa..ca41502c2 100644 --- a/libsrc/atmos/cvline.s +++ b/libsrc/atmos/cvline.s @@ -5,25 +5,25 @@ ; void cvline (unsigned char length); ; - .export _cvlinexy, _cvline + .export _cvlinexy, _cvline .import setscrptr .import rvs - .import popax + .import popax .importzp ptr2 .include "atmos.inc" _cvlinexy: - pha ; Save the length - jsr popax ; Get X and Y + pha ; Save the length + jsr popax ; Get X and Y sta CURS_Y ; Store Y stx CURS_X ; Store X - pla ; Restore the length and run into _cvline + pla ; Restore the length and run into _cvline _cvline: - tax ; Is the length zero? - beq @L9 ; Jump if done + tax ; Is the length zero? + beq @L9 ; Jump if done @L1: jsr setscrptr ; Set ptr2 to screen, won't use X lda #'|' ora rvs @@ -31,6 +31,6 @@ _cvline: inc CURS_Y @L2: dex bne @L1 -@L9: rts +@L9: rts diff --git a/libsrc/atmos/gotox.s b/libsrc/atmos/gotox.s index 25ed7fbf2..6f8682722 100644 --- a/libsrc/atmos/gotox.s +++ b/libsrc/atmos/gotox.s @@ -4,13 +4,13 @@ ; void gotox (unsigned char x); ; - .export _gotox + .export _gotox .include "atmos.inc" .proc _gotox - sta CURS_X ; Set X + sta CURS_X ; Set X rts .endproc diff --git a/libsrc/atmos/gotoxy.s b/libsrc/atmos/gotoxy.s index 26a16bb21..80d4d5251 100644 --- a/libsrc/atmos/gotoxy.s +++ b/libsrc/atmos/gotoxy.s @@ -4,16 +4,16 @@ ; void gotoxy (unsigned char x, unsigned char y); ; - .export _gotoxy - .import popa + .export _gotoxy + .import popa .include "atmos.inc" .proc _gotoxy - sta CURS_Y ; Set Y - jsr popa ; Get X - sta CURS_X ; Set X + sta CURS_Y ; Set Y + jsr popa ; Get X + sta CURS_X ; Set X rts .endproc diff --git a/libsrc/atmos/gotoy.s b/libsrc/atmos/gotoy.s index baa95a773..4db577755 100644 --- a/libsrc/atmos/gotoy.s +++ b/libsrc/atmos/gotoy.s @@ -4,13 +4,13 @@ ; void gotoy (unsigned char y); ; - .export _gotoy + .export _gotoy .include "atmos.inc" .proc _gotoy - sta CURS_Y ; Set Y + sta CURS_Y ; Set Y rts .endproc diff --git a/libsrc/atmos/irq.s b/libsrc/atmos/irq.s index c022eccd4..ed443caae 100644 --- a/libsrc/atmos/irq.s +++ b/libsrc/atmos/irq.s @@ -2,58 +2,58 @@ ; IRQ handling (Oric version) ; - .export initirq, doneirq - .import callirq + .export initirq, doneirq + .import callirq - .include "atmos.inc" + .include "atmos.inc" ; ------------------------------------------------------------------------ -.segment "INIT" +.segment "INIT" initirq: - lda IRQVec - ldx IRQVec+1 - sta IRQInd+1 - stx IRQInd+2 - lda #IRQStub - jmp setvec + lda IRQVec + ldx IRQVec+1 + sta IRQInd+1 + stx IRQInd+2 + lda #IRQStub + jmp setvec ; ------------------------------------------------------------------------ .code doneirq: - lda IRQInd+1 - ldx IRQInd+2 -setvec: sei - sta IRQVec - stx IRQVec+1 - cli - rts + lda IRQInd+1 + ldx IRQInd+2 +setvec: sei + sta IRQVec + stx IRQVec+1 + cli + rts ; ------------------------------------------------------------------------ -.segment "LOWCODE" +.segment "LOWCODE" IRQStub: - cld ; Just to be sure - pha - txa - pha - tya - pha - jsr callirq ; Call the functions - pla - tay - pla - tax - pla - jmp IRQInd ; Jump to the saved IRQ vector + cld ; Just to be sure + pha + txa + pha + tya + pha + jsr callirq ; Call the functions + pla + tay + pla + tax + pla + jmp IRQInd ; Jump to the saved IRQ vector ; ------------------------------------------------------------------------ .data -IRQInd: jmp $0000 +IRQInd: jmp $0000 diff --git a/libsrc/atmos/joy/atmos-pase.s b/libsrc/atmos/joy/atmos-pase.s index 18ac7b887..81dba394a 100644 --- a/libsrc/atmos/joy/atmos-pase.s +++ b/libsrc/atmos/joy/atmos-pase.s @@ -6,55 +6,55 @@ ; Based on Ullrich von Bassewitz, 2002-12-20 ; - .include "joy-kernel.inc" - .include "joy-error.inc" -; .include "atmos.inc" + .include "joy-kernel.inc" + .include "joy-error.inc" +; .include "atmos.inc" ; ------------------------------------------------------------------------ ; Header. Includes jump table -.segment "JUMPTABLE" +.segment "JUMPTABLE" ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) - .byte $10 ; JOY_UP - .byte $08 ; JOY_DOWN - .byte $01 ; JOY_LEFT - .byte $02 ; JOY_RIGHT - .byte $20 ; JOY_FIRE - .byte $00 ; Future expansion - .byte $00 ; Future expansion - .byte $00 ; Future expansion + .byte $10 ; JOY_UP + .byte $08 ; JOY_DOWN + .byte $01 ; JOY_LEFT + .byte $02 ; JOY_RIGHT + .byte $20 ; JOY_FIRE + .byte $00 ; Future expansion + .byte $00 ; Future expansion + .byte $00 ; Future expansion ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr COUNT - .addr READ - .addr 0 ; IRQ entry unused + .addr INSTALL + .addr UNINSTALL + .addr COUNT + .addr READ + .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants -JOY_COUNT = 2 ; Number of joysticks we support +JOY_COUNT = 2 ; Number of joysticks we support -PRA = $0301 -DDRA = $0303 -PRA2 = $030F +PRA = $0301 +DDRA = $0303 +PRA2 = $030F ; ------------------------------------------------------------------------ ; Data. .bss -temp1: .byte $00 -temp2: .byte $00 +temp1: .byte $00 +temp2: .byte $00 .code @@ -66,9 +66,9 @@ temp2: .byte $00 ; INSTALL: - lda #JOY_ERR_OK - ldx #0 -; rts ; Run into UNINSTALL instead + lda #JOY_ERR_OK + ldx #0 +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -76,7 +76,7 @@ INSTALL: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ @@ -84,42 +84,42 @@ UNINSTALL: ; COUNT: - lda #JOY_COUNT - ldx #0 - rts + lda #JOY_COUNT + ldx #0 + rts ; ------------------------------------------------------------------------ ; READ: Read a particular joystick passed in A. ; READ: - tay + tay - lda PRA - pha - lda DDRA - pha - lda #%11000000 - sta DDRA - lda #%10000000 - sta PRA2 - lda PRA2 - sta temp1 - lda #%01000000 - sta PRA2 - lda PRA - sta temp2 - pla - sta DDRA - pla - sta PRA2 + lda PRA + pha + lda DDRA + pha + lda #%11000000 + sta DDRA + lda #%10000000 + sta PRA2 + lda PRA2 + sta temp1 + lda #%01000000 + sta PRA2 + lda PRA + sta temp2 + pla + sta DDRA + pla + sta PRA2 - ldx #0 - tya - bne @L1 - lda temp1 - eor #$FF - rts -@L1: lda temp2 - eor #$FF - rts + ldx #0 + tya + bne @L1 + lda temp1 + eor #$FF + rts +@L1: lda temp2 + eor #$FF + rts diff --git a/libsrc/atmos/joy_stat_stddrv.s b/libsrc/atmos/joy_stat_stddrv.s index c94405c3c..2ac2259d5 100644 --- a/libsrc/atmos/joy_stat_stddrv.s +++ b/libsrc/atmos/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _atmos_pase_joy + .export _joy_static_stddrv + .import _atmos_pase_joy .rodata diff --git a/libsrc/atmos/joy_stddrv.s b/libsrc/atmos/joy_stddrv.s index 77c9e0ea9..6ed83f445 100644 --- a/libsrc/atmos/joy_stddrv.s +++ b/libsrc/atmos/joy_stddrv.s @@ -6,8 +6,8 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "atmos-pase.joy" +_joy_stddrv: .asciiz "atmos-pase.joy" diff --git a/libsrc/atmos/kbhit.s b/libsrc/atmos/kbhit.s index df36226f6..1b18b6cb7 100644 --- a/libsrc/atmos/kbhit.s +++ b/libsrc/atmos/kbhit.s @@ -4,9 +4,9 @@ ; int kbhit (void); ; - .export _kbhit + .export _kbhit - .include "atmos.inc" + .include "atmos.inc" _kbhit: ldx #$00 ; Load high byte diff --git a/libsrc/atmos/mainargs.s b/libsrc/atmos/mainargs.s index 54fdb61e9..3e1f6467b 100644 --- a/libsrc/atmos/mainargs.s +++ b/libsrc/atmos/mainargs.s @@ -5,117 +5,117 @@ ; Setup arguments for main ; - .constructor initmainargs, 24 - .import __argc, __argv - .macpack generic + .constructor initmainargs, 24 + .import __argc, __argv + .macpack generic -MAXARGS = 10 ; Maximum number of arguments allowed -REM = $9d ; BASIC token-code -NAME_LEN = 16 ; maximum length of command-name +MAXARGS = 10 ; Maximum number of arguments allowed +REM = $9d ; BASIC token-code +NAME_LEN = 16 ; maximum length of command-name BASIC_BUF = $35 -FNAM = $293 +FNAM = $293 ;--------------------------------------------------------------------------- ; Get possible command-line arguments. Goes into the special INIT segment, ; which may be reused after the startup code is run -.segment "INIT" +.segment "INIT" -.proc initmainargs +.proc initmainargs ; Assume that the program was loaded, a moment ago, by the traditional LOAD ; statement. Save the "most-recent filename" as argument #0. ; Because the buffer, that we're copying into, was zeroed out, ; we don't need to add a NUL character. ; - ldy #NAME_LEN - 1 ; limit the length -L0: lda FNAM,y - sta name,y - dey - bpl L0 - inc __argc ; argc always is equal to, at least, 1 + ldy #NAME_LEN - 1 ; limit the length +L0: lda FNAM,y + sta name,y + dey + bpl L0 + inc __argc ; argc always is equal to, at least, 1 ; Find the "rem" token. ; - ldx #0 -L2: lda BASIC_BUF,x - beq done ; no "rem," no args. - inx - cmp #REM - bne L2 - ldy #1 * 2 + ldx #0 +L2: lda BASIC_BUF,x + beq done ; no "rem," no args. + inx + cmp #REM + bne L2 + ldy #1 * 2 ; Find the next argument -next: lda BASIC_BUF,x - beq done ; End of line reached - inx - cmp #' ' ; Skip leading spaces - beq next ; +next: lda BASIC_BUF,x + beq done ; End of line reached + inx + cmp #' ' ; Skip leading spaces + beq next ; ; Found start of next argument. We've incremented the pointer in X already, so ; it points to the second character of the argument. This is useful since we ; will check now for a quoted argument, in which case we will have to skip this ; first character. -found: cmp #'"' ; Is the argument quoted? - beq setterm ; Jump if so - dex ; Reset pointer to first argument character - lda #' ' ; A space ends the argument -setterm:sta term ; Set end of argument marker +found: cmp #'"' ; Is the argument quoted? + beq setterm ; Jump if so + dex ; Reset pointer to first argument character + lda #' ' ; A space ends the argument +setterm:sta term ; Set end of argument marker ; Now store a pointer to the argument into the next slot. Since the BASIC ; input buffer is located at the zero page, no calculations are necessary. - txa ; Get low byte - add #argv - sta __argv - stx __argv + 1 +done: lda #argv + sta __argv + stx __argv + 1 - rts + rts .endproc ; These arrays are zeroed before initmainargs is called. -; char name[16+1]; +; char name[16+1]; ; char* argv[MAXARGS+1]={name}; ; .bss -term: .res 1 -name: .res NAME_LEN + 1 +term: .res 1 +name: .res NAME_LEN + 1 .data -argv: .addr name - .res MAXARGS * 2 +argv: .addr name + .res MAXARGS * 2 diff --git a/libsrc/atmos/oserrlist.s b/libsrc/atmos/oserrlist.s index ebdb531f8..8ec41de6d 100644 --- a/libsrc/atmos/oserrlist.s +++ b/libsrc/atmos/oserrlist.s @@ -41,35 +41,35 @@ End: .rodata __sys_oserrlist: - sys_oserr_entry 1, "File not found" - sys_oserr_entry 2, "Invalid command end" - sys_oserr_entry 3, "No drive number" - sys_oserr_entry 4, "Bad drive number" - sys_oserr_entry 5, "Invalid filename" - sys_oserr_entry 6, "fderr=(error number)" - sys_oserr_entry 7, "Illegal attribute" - sys_oserr_entry 8, "Wildcard(s) not allowed" - sys_oserr_entry 9, "File already exists" - sys_oserr_entry 10, "Insufficient disc space" - sys_oserr_entry 11, "File open" - sys_oserr_entry 12, "Illegal quantity" - sys_oserr_entry 13, "End address missing" - sys_oserr_entry 14, "Start address > end address" - sys_oserr_entry 15, "Missing 'to'" - sys_oserr_entry 16, "Renamed file not on same disc" - sys_oserr_entry 17, "Unknown array" - sys_oserr_entry 18, "Target drive not source drive" - sys_oserr_entry 19, "Destination not specified" - sys_oserr_entry 20, "Cannot merge and overwrite" - sys_oserr_entry 21, "Single target file illegal" - sys_oserr_entry 22, "Syntax" - sys_oserr_entry 23, "Filename missing" - sys_oserr_entry 24, "Source file missing" - sys_oserr_entry 25, "Type mismatch" - sys_oserr_entry 26, "Disc write-protected" - sys_oserr_entry 27, "Incompatible drives" - sys_oserr_entry 28, "File not open" - sys_oserr_entry 29, "File end" - sys_oserr_sentinel "Unknown error" + sys_oserr_entry 1, "File not found" + sys_oserr_entry 2, "Invalid command end" + sys_oserr_entry 3, "No drive number" + sys_oserr_entry 4, "Bad drive number" + sys_oserr_entry 5, "Invalid filename" + sys_oserr_entry 6, "fderr=(error number)" + sys_oserr_entry 7, "Illegal attribute" + sys_oserr_entry 8, "Wildcard(s) not allowed" + sys_oserr_entry 9, "File already exists" + sys_oserr_entry 10, "Insufficient disc space" + sys_oserr_entry 11, "File open" + sys_oserr_entry 12, "Illegal quantity" + sys_oserr_entry 13, "End address missing" + sys_oserr_entry 14, "Start address > end address" + sys_oserr_entry 15, "Missing 'to'" + sys_oserr_entry 16, "Renamed file not on same disc" + sys_oserr_entry 17, "Unknown array" + sys_oserr_entry 18, "Target drive not source drive" + sys_oserr_entry 19, "Destination not specified" + sys_oserr_entry 20, "Cannot merge and overwrite" + sys_oserr_entry 21, "Single target file illegal" + sys_oserr_entry 22, "Syntax" + sys_oserr_entry 23, "Filename missing" + sys_oserr_entry 24, "Source file missing" + sys_oserr_entry 25, "Type mismatch" + sys_oserr_entry 26, "Disc write-protected" + sys_oserr_entry 27, "Incompatible drives" + sys_oserr_entry 28, "File not open" + sys_oserr_entry 29, "File end" + sys_oserr_sentinel "Unknown error" diff --git a/libsrc/atmos/oserror.s b/libsrc/atmos/oserror.s index aa54ea585..37c9bd7fc 100644 --- a/libsrc/atmos/oserror.s +++ b/libsrc/atmos/oserror.s @@ -5,13 +5,13 @@ ; /* Map a system specific error into a system independent code */ ; - .include "errno.inc" - .export __osmaperrno + .include "errno.inc" + .export __osmaperrno -.proc __osmaperrno +.proc __osmaperrno - lda #EUNKNOWN - rts + lda #EUNKNOWN + rts .endproc diff --git a/libsrc/atmos/revers.s b/libsrc/atmos/revers.s index 07334af15..ad3e1f909 100644 --- a/libsrc/atmos/revers.s +++ b/libsrc/atmos/revers.s @@ -4,7 +4,7 @@ ; unsigned char revers (unsigned char onoff); ; - .export _revers + .export _revers .export rvs ; ------------------------------------------------------------------------ @@ -13,18 +13,18 @@ .code .proc _revers - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value - ldy #$00 ; Assume old value is zero -L1: lda rvs ; Load old value - stx rvs ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value + ldy #$00 ; Assume old value is zero +L1: lda rvs ; Load old value + stx rvs ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts .endproc diff --git a/libsrc/atmos/ser/atmos-acia.s b/libsrc/atmos/ser/atmos-acia.s index c2b48c9fc..36071c32a 100644 --- a/libsrc/atmos/ser/atmos-acia.s +++ b/libsrc/atmos/ser/atmos-acia.s @@ -22,99 +22,99 @@ ; interrupt handling assumes that the 65816 is in 6502-emulation mode. ; - .include "zeropage.inc" - .include "ser-kernel.inc" - .include "ser-error.inc" + .include "zeropage.inc" + .include "ser-kernel.inc" + .include "ser-error.inc" ; ------------------------------------------------------------------------ ; Header. Includes jump table - .segment "JUMPTABLE" + .segment "JUMPTABLE" - ; Driver signature - .byte $73, $65, $72 ; "ser" - .byte SER_API_VERSION ; Serial API version number + ; Driver signature + .byte $73, $65, $72 ; "ser" + .byte SER_API_VERSION ; Serial API version number - ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr OPEN - .addr CLOSE - .addr GET - .addr PUT - .addr STATUS - .addr IOCTL - .addr IRQ + ; Jump table. + .addr INSTALL + .addr UNINSTALL + .addr OPEN + .addr CLOSE + .addr GET + .addr PUT + .addr STATUS + .addr IOCTL + .addr IRQ ;---------------------------------------------------------------------------- ; I/O definitions -ACIA = $031C -ACIA_DATA = ACIA+0 ; Data register -ACIA_STATUS = ACIA+1 ; Status register -ACIA_CMD = ACIA+2 ; Command register -ACIA_CTRL = ACIA+3 ; Control register +ACIA = $031C +ACIA_DATA = ACIA+0 ; Data register +ACIA_STATUS = ACIA+1 ; Status register +ACIA_CMD = ACIA+2 ; Command register +ACIA_CTRL = ACIA+3 ; Control register ;---------------------------------------------------------------------------- ; Global variables - .bss + .bss -RecvHead: .res 1 ; Head of receive buffer -RecvTail: .res 1 ; Tail of receive buffer -RecvFreeCnt: .res 1 ; Number of bytes in receive buffer -SendHead: .res 1 ; Head of send buffer -SendTail: .res 1 ; Tail of send buffer -SendFreeCnt: .res 1 ; Number of bytes in send buffer +RecvHead: .res 1 ; Head of receive buffer +RecvTail: .res 1 ; Tail of receive buffer +RecvFreeCnt: .res 1 ; Number of bytes in receive buffer +SendHead: .res 1 ; Head of send buffer +SendTail: .res 1 ; Tail of send buffer +SendFreeCnt: .res 1 ; Number of bytes in send buffer -Stopped: .res 1 ; Flow-stopped flag -RtsOff: .res 1 ; +Stopped: .res 1 ; Flow-stopped flag +RtsOff: .res 1 ; -RecvBuf: .res 256 ; Receive buffers: 256 bytes -SendBuf: .res 256 ; Send buffers: 256 bytes +RecvBuf: .res 256 ; Receive buffers: 256 bytes +SendBuf: .res 256 ; Send buffers: 256 bytes -Index: .res 1 ; I/O register index +Index: .res 1 ; I/O register index - .rodata + .rodata - ; Tables used to translate RS232 params into register values -BaudTable: ; bit7 = 1 means setting is invalid - .byte $FF ; SER_BAUD_45_5 - .byte $01 ; SER_BAUD_50 - .byte $02 ; SER_BAUD_75 - .byte $03 ; SER_BAUD_110 - .byte $04 ; SER_BAUD_134_5 - .byte $05 ; SER_BAUD_150 - .byte $06 ; SER_BAUD_300 - .byte $07 ; SER_BAUD_600 - .byte $08 ; SER_BAUD_1200 - .byte $09 ; SER_BAUD_1800 - .byte $0A ; SER_BAUD_2400 - .byte $0B ; SER_BAUD_3600 - .byte $0C ; SER_BAUD_4800 - .byte $0D ; SER_BAUD_7200 - .byte $0E ; SER_BAUD_9600 - .byte $0F ; SER_BAUD_19200 - .byte $FF ; SER_BAUD_38400 - .byte $FF ; SER_BAUD_57600 - .byte $FF ; SER_BAUD_115200 - .byte $FF ; SER_BAUD_230400 + ; Tables used to translate RS232 params into register values +BaudTable: ; bit7 = 1 means setting is invalid + .byte $FF ; SER_BAUD_45_5 + .byte $01 ; SER_BAUD_50 + .byte $02 ; SER_BAUD_75 + .byte $03 ; SER_BAUD_110 + .byte $04 ; SER_BAUD_134_5 + .byte $05 ; SER_BAUD_150 + .byte $06 ; SER_BAUD_300 + .byte $07 ; SER_BAUD_600 + .byte $08 ; SER_BAUD_1200 + .byte $09 ; SER_BAUD_1800 + .byte $0A ; SER_BAUD_2400 + .byte $0B ; SER_BAUD_3600 + .byte $0C ; SER_BAUD_4800 + .byte $0D ; SER_BAUD_7200 + .byte $0E ; SER_BAUD_9600 + .byte $0F ; SER_BAUD_19200 + .byte $FF ; SER_BAUD_38400 + .byte $FF ; SER_BAUD_57600 + .byte $FF ; SER_BAUD_115200 + .byte $FF ; SER_BAUD_230400 BitTable: - .byte $60 ; SER_BITS_5 - .byte $40 ; SER_BITS_6 - .byte $20 ; SER_BITS_7 - .byte $00 ; SER_BITS_8 + .byte $60 ; SER_BITS_5 + .byte $40 ; SER_BITS_6 + .byte $20 ; SER_BITS_7 + .byte $00 ; SER_BITS_8 StopTable: - .byte $00 ; SER_STOP_1 - .byte $80 ; SER_STOP_2 + .byte $00 ; SER_STOP_1 + .byte $80 ; SER_STOP_2 ParityTable: - .byte $00 ; SER_PAR_NONE - .byte $20 ; SER_PAR_ODD - .byte $60 ; SER_PAR_EVEN - .byte $A0 ; SER_PAR_MARK - .byte $E0 ; SER_PAR_SPACE + .byte $00 ; SER_PAR_NONE + .byte $20 ; SER_PAR_ODD + .byte $60 ; SER_PAR_EVEN + .byte $A0 ; SER_PAR_MARK + .byte $E0 ; SER_PAR_SPACE - .code + .code ;---------------------------------------------------------------------------- ; INSTALL: Is called after the driver is loaded into memory. If possible, @@ -134,91 +134,91 @@ ParityTable: INSTALL: UNINSTALL: CLOSE: - ldx Index ; Check for open port - beq :+ + ldx Index ; Check for open port + beq :+ - ; Deactivate DTR and disable 6551 interrupts - lda #%00001010 - sta ACIA_CMD,x + ; Deactivate DTR and disable 6551 interrupts + lda #%00001010 + sta ACIA_CMD,x - ; Done, return an error code -: lda #SER_ERR_INIT_FAILED - rts + ; Invalid parameter +InvParam:lda #SER_ERR_INIT_FAILED + rts - ; Baud rate not available -InvBaud:lda #SER_ERR_BAUD_UNAVAIL - rts + ; Baud rate not available +InvBaud:lda #SER_ERR_BAUD_UNAVAIL + rts ;---------------------------------------------------------------------------- ; GET: Will fetch a character from the receive buffer and store it into the @@ -226,82 +226,82 @@ InvBaud:lda #SER_ERR_NO_DATA - rts + ; Check for buffer empty +: lda RecvFreeCnt ; (25) + cmp #$FF + bne :+ + lda #SER_ERR_NO_DATA + rts - ; Check for flow stopped & enough free: release flow control -: ldy Stopped ; (34) - beq :+ - cmp #63 - bcc :+ - lda #$00 - sta Stopped - lda RtsOff - ora #%00001000 - sta ACIA_CMD + ; Check for flow stopped & enough free: release flow control +: ldy Stopped ; (34) + beq :+ + cmp #63 + bcc :+ + lda #$00 + sta Stopped + lda RtsOff + ora #%00001000 + sta ACIA_CMD - ; Get byte from buffer -: ldy RecvHead ; (41) - lda RecvBuf,y - inc RecvHead - inc RecvFreeCnt - ldx #$00 ; (59) - sta (ptr1,x) - txa ; Return code = 0 - rts + ; Get byte from buffer +: ldy RecvHead ; (41) + lda RecvBuf,y + inc RecvHead + inc RecvFreeCnt + ldx #$00 ; (59) + sta (ptr1,x) + txa ; Return code = 0 + rts ;---------------------------------------------------------------------------- ; PUT: Output character in A. ; Must return an SER_ERR_xx code in a/x. PUT: - ; Try to send - ldy SendFreeCnt - iny ; Y = $FF? - beq :+ - pha - lda #$00 ; TryHard = false - jsr TryToSend - pla + ; Try to send + ldy SendFreeCnt + iny ; Y = $FF? + beq :+ + pha + lda #$00 ; TryHard = false + jsr TryToSend + pla - ; Put byte into send buffer & send -: ldy SendFreeCnt - bne :+ - lda #SER_ERR_OVERFLOW - rts + ; Put byte into send buffer & send +: ldy SendFreeCnt + bne :+ + lda #SER_ERR_OVERFLOW + rts -: ldy SendTail - sta SendBuf,y - inc SendTail - dec SendFreeCnt - lda #$FF ; TryHard = true - jsr TryToSend - lda #SER_ERR_INV_IOCTL - rts + lda #SER_ERR_INV_IOCTL + rts ;---------------------------------------------------------------------------- ; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All @@ -320,55 +320,55 @@ IOCTL: ; was handled, otherwise with carry clear. IRQ: - ldx Index ; Check for open port - beq Done - lda ACIA_STATUS,x ; Check ACIA status for receive interrupt - and #$08 - beq Done ; Jump if no ACIA interrupt - lda ACIA_DATA,x ; Get byte from ACIA - ldy RecvFreeCnt ; Check if we have free space left - beq Flow ; Jump if no space in receive buffer - ldy RecvTail ; Load buffer pointer - sta RecvBuf,y ; Store received byte in buffer - inc RecvTail ; Increment buffer pointer - dec RecvFreeCnt ; Decrement free space counter - ldy RecvFreeCnt ; Check for buffer space low - cpy #33 - bcc Flow ; Assert flow control if buffer space low - rts ; Interrupt handled (carry already set) + ldx Index ; Check for open port + beq Done + lda ACIA_STATUS,x ; Check ACIA status for receive interrupt + and #$08 + beq Done ; Jump if no ACIA interrupt + lda ACIA_DATA,x ; Get byte from ACIA + ldy RecvFreeCnt ; Check if we have free space left + beq Flow ; Jump if no space in receive buffer + ldy RecvTail ; Load buffer pointer + sta RecvBuf,y ; Store received byte in buffer + inc RecvTail ; Increment buffer pointer + dec RecvFreeCnt ; Decrement free space counter + ldy RecvFreeCnt ; Check for buffer space low + cpy #33 + bcc Flow ; Assert flow control if buffer space low + rts ; Interrupt handled (carry already set) - ; Assert flow control if buffer space too low -Flow: lda RtsOff - sta ACIA_CMD,x - sta Stopped - sec ; Interrupt handled -Done: rts + ; Assert flow control if buffer space too low +Flow: lda RtsOff + sta ACIA_CMD,x + sta Stopped + sec ; Interrupt handled +Done: rts ;---------------------------------------------------------------------------- ; Try to send a byte. Internal routine. A = TryHard TryToSend: - sta tmp1 ; Remember tryHard flag -Again: lda SendFreeCnt - cmp #$FF - beq Quit ; Bail out + sta tmp1 ; Remember tryHard flag +Again: lda SendFreeCnt + cmp #$FF + beq Quit ; Bail out - ; Check for flow stopped - lda Stopped - bne Quit ; Bail out + ; Check for flow stopped + lda Stopped + bne Quit ; Bail out - ; Check that ACIA is ready to send - lda ACIA_STATUS - and #$10 - bne Send - bit tmp1 ; Keep trying if must try hard - bmi Again -Quit: rts + ; Check that ACIA is ready to send + lda ACIA_STATUS + and #$10 + bne Send + bit tmp1 ; Keep trying if must try hard + bmi Again +Quit: rts - ; Send byte and try again -Send: ldy SendHead - lda SendBuf,y - sta ACIA_DATA - inc SendHead - inc SendFreeCnt - jmp Again + ; Send byte and try again +Send: ldy SendHead + lda SendBuf,y + sta ACIA_DATA + inc SendHead + inc SendFreeCnt + jmp Again diff --git a/libsrc/atmos/store_filename.s b/libsrc/atmos/store_filename.s index a909bcf15..cb6d8b933 100644 --- a/libsrc/atmos/store_filename.s +++ b/libsrc/atmos/store_filename.s @@ -1,12 +1,12 @@ - .export store_filename - .importzp ptr1 + .export store_filename + .importzp ptr1 store_filename: - sta ptr1 - stx ptr1+1 - ldy #$0f ;store filename -: lda (ptr1),y - sta $027f,y - dey - bpl :- - rts + sta ptr1 + stx ptr1+1 + ldy #$0f ;store filename +: lda (ptr1),y + sta $027f,y + dey + bpl :- + rts diff --git a/libsrc/atmos/systime.s b/libsrc/atmos/systime.s index 1d039e80e..d22b8c596 100644 --- a/libsrc/atmos/systime.s +++ b/libsrc/atmos/systime.s @@ -9,7 +9,7 @@ ; */ ; - .export __systime + .export __systime .importzp sreg diff --git a/libsrc/atmos/sysuname.s b/libsrc/atmos/sysuname.s index d86ce5047..546f942ab 100644 --- a/libsrc/atmos/sysuname.s +++ b/libsrc/atmos/sysuname.s @@ -4,11 +4,11 @@ ; unsigned char __fastcall__ _sysuname (struct utsname* buf); ; - .export __sysuname, utsdata + .export __sysuname, utsdata - .import utscopy + .import utscopy - __sysuname = utscopy + __sysuname = utscopy ;-------------------------------------------------------------------------- ; Data. We define a fixed utsname struct here and just copy it. @@ -16,31 +16,31 @@ .rodata utsdata: - ; sysname - .asciiz "cc65" + ; sysname + .asciiz "cc65" - ; nodename - .asciiz "" + ; nodename + .asciiz "" - ; release - .byte ((.VERSION >> 8) & $0F) + '0' - .byte '.' - .if ((.VERSION >> 4) & $0F) > 9 - .byte ((.VERSION >> 4) & $0F) / 10 + '0' - .byte ((.VERSION >> 4) & $0F) .MOD 10 + '0' - .else - .byte ((.VERSION >> 4) & $0F) + '0' - .endif - .byte $00 + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .if ((.VERSION >> 4) & $0F) > 9 + .byte ((.VERSION >> 4) & $0F) / 10 + '0' + .byte ((.VERSION >> 4) & $0F) .MOD 10 + '0' + .else + .byte ((.VERSION >> 4) & $0F) + '0' + .endif + .byte $00 - ; version - .if (.VERSION & $0F) > 9 - .byte (.VERSION & $0F) / 10 + '0' - .byte (.VERSION & $0F) .MOD 10 + '0' - .else - .byte (.VERSION & $0F) + '0' - .endif - .byte $00 + ; version + .if (.VERSION & $0F) > 9 + .byte (.VERSION & $0F) / 10 + '0' + .byte (.VERSION & $0F) .MOD 10 + '0' + .else + .byte (.VERSION & $0F) + '0' + .endif + .byte $00 - ; machine - .asciiz "Oric Atmos" + ; machine + .asciiz "Oric Atmos" diff --git a/libsrc/atmos/tgi/atmos-228-200-3.s b/libsrc/atmos/tgi/atmos-228-200-3.s index 03a9ce7df..9417fff0d 100644 --- a/libsrc/atmos/tgi/atmos-228-200-3.s +++ b/libsrc/atmos/tgi/atmos-228-200-3.s @@ -5,59 +5,59 @@ ; 2012-08-11, Greg King ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" - .include "atmos.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" + .include "atmos.inc" - .macpack generic + .macpack generic -XSIZE = 6 ; System font width -YSIZE = 8 ; System font height +XSIZE = 6 ; System font width +YSIZE = 8 ; System font height ; ------------------------------------------------------------------------ ; Header. Includes jump table and constants. -.segment "JUMPTABLE" +.segment "JUMPTABLE" ; The first part of the header is a structure that has a signature, ; and defines the capabilities of the driver. - .byte "tgi" - .byte TGI_API_VERSION ; TGI API version number - .word 228 ; x resolution - .word 200 ; y resolution - .byte 3 ; Number of drawing colors - .byte 1 ; Number of screens available - .byte XSIZE ; System font x size - .byte YSIZE ; System font y size - .word $011C ; Aspect ratio (based on 4/3 display) - .byte 0 ; TGI driver flags + .byte "tgi" + .byte TGI_API_VERSION ; TGI API version number + .word 228 ; x resolution + .word 200 ; y resolution + .byte 3 ; Number of drawing colors + .byte 1 ; Number of screens available + .byte XSIZE ; System font x size + .byte YSIZE ; System font y size + .word $011C ; Aspect ratio (based on 4/3 display) + .byte 0 ; TGI driver flags ; Next comes the jump table. Currently, all entries must be valid; ; and, may point to an RTS, for test versions (function not implemented). - .addr INSTALL - .addr UNINSTALL - .addr INIT - .addr DONE - .addr GETERROR - .addr CONTROL - .addr CLEAR - .addr SETVIEWPAGE - .addr SETDRAWPAGE - .addr SETCOLOR - .addr SETPALETTE - .addr GETPALETTE - .addr GETDEFPALETTE - .addr SETPIXEL - .addr GETPIXEL - .addr LINE - .addr BAR - .addr TEXTSTYLE - .addr OUTTEXT - .addr 0 ; IRQ entry is unused + .addr INSTALL + .addr UNINSTALL + .addr INIT + .addr DONE + .addr GETERROR + .addr CONTROL + .addr CLEAR + .addr SETVIEWPAGE + .addr SETDRAWPAGE + .addr SETCOLOR + .addr SETPALETTE + .addr GETPALETTE + .addr GETDEFPALETTE + .addr SETPIXEL + .addr GETPIXEL + .addr LINE + .addr BAR + .addr TEXTSTYLE + .addr OUTTEXT + .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. @@ -65,34 +65,34 @@ YSIZE = 8 ; System font height ; Variables mapped to the zero-page segment variables. These are ; used for passing parameters to the driver. -X1 := ptr1 -Y1 := ptr2 -X2 := ptr3 -Y2 := ptr4 +X1 := ptr1 +Y1 := ptr2 +X2 := ptr3 +Y2 := ptr4 ; Absolute variables used in the code .bss -ERROR: .res 1 ; Error code -MODE: .res 1 ; Graphics mode -PALETTE: .res 2 +ERROR: .res 1 ; Error code +MODE: .res 1 ; Graphics mode +PALETTE: .res 2 ; Constants and table ; BASIC 1.1 addresses -PATTERN := $213 -PARAM1 := $2E1 ; & $2E2 -PARAM2 := $2E3 ; & $2E4 -PARAM3 := $2E5 ; & $2E6 -TEXT := $EC21 -HIRES := $EC33 -CURSET := $F0C8 -CURMOV := $F0FD -DRAW := $F110 -CHAR := $F12D -POINT := $F1C8 -PAPER := $F204 -INK := $F210 +PATTERN := $213 +PARAM1 := $2E1 ; & $2E2 +PARAM2 := $2E3 ; & $2E4 +PARAM3 := $2E5 ; & $2E6 +TEXT := $EC21 +HIRES := $EC33 +CURSET := $F0C8 +CURMOV := $F0FD +DRAW := $F110 +CHAR := $F12D +POINT := $F1C8 +PAPER := $F204 +INK := $F210 .rodata @@ -100,7 +100,7 @@ INK := $F210 ; (The third "color" actually flips a pixel ; between the foreground and background colors.) ; -DEFPALETTE: .byte 0, 1 +DEFPALETTE: .byte 0, 1 .code @@ -121,7 +121,7 @@ INIT: ; Switch into graphics mode. - jsr HIRES + jsr HIRES ; Done, reset the error code. @@ -129,9 +129,9 @@ INIT: ; GETERROR: Return the error code in A, and clear it. GETERROR: - ldx #TGI_ERR_OK - lda ERROR - stx ERROR + ldx #TGI_ERR_OK + lda ERROR + stx ERROR ; ------------------------------------------------------------------------ ; INSTALL routine. Is called after the driver is loaded into memory. May @@ -151,7 +151,7 @@ INSTALL: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ ; DONE: Will be called to switch the graphics device back into text mode. @@ -161,7 +161,7 @@ UNINSTALL: ; Must set an error code: NO ; -DONE := TEXT +DONE := TEXT ; ------------------------------------------------------------------------ ; CONTROL: Platform-/driver-specific entry point. @@ -170,10 +170,10 @@ DONE := TEXT ; CONTROL: - sta PATTERN - lda #TGI_ERR_OK - sta ERROR - rts + sta PATTERN + lda #TGI_ERR_OK + sta ERROR + rts ; ------------------------------------------------------------------------ ; CLEAR: Clears the screen. @@ -181,7 +181,7 @@ CONTROL: ; Must set an error code: NO ; -CLEAR := HIRES +CLEAR := HIRES ; ------------------------------------------------------------------------ ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). @@ -200,7 +200,7 @@ SETVIEWPAGE: ; SETDRAWPAGE: - rts + rts ; ------------------------------------------------------------------------ ; SETCOLOR: Set the drawing color (in A). The new color already is checked @@ -210,8 +210,8 @@ SETDRAWPAGE: ; SETCOLOR: - sta MODE - rts + sta MODE + rts ; ------------------------------------------------------------------------ ; SETPALETTE: Set the palette (not available with all drivers/hardware). @@ -222,27 +222,27 @@ SETCOLOR: ; SETPALETTE: - ldy #0 - jsr flipcolor - sty PARAM1+1 - jsr PAPER - ldy #1 - jsr flipcolor - dey ; TGI_ERR_OK - sty ERROR - sty PARAM1+1 - jmp INK + ldy #0 + jsr flipcolor + sty PARAM1+1 + jsr PAPER + ldy #1 + jsr flipcolor + dey ; TGI_ERR_OK + sty ERROR + sty PARAM1+1 + jmp INK flipcolor: - lda (ptr1),y - sta PALETTE,y - cmp #1 - beq @flip - cmp #7 - bne @keep -@flip: eor #1 ^ 7 -@keep: sta PARAM1 - rts + lda (ptr1),y + sta PALETTE,y + cmp #1 + beq @flip + cmp #7 + bne @keep +@flip: eor #1 ^ 7 +@keep: sta PARAM1 + rts ; ------------------------------------------------------------------------ ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot @@ -253,9 +253,9 @@ flipcolor: ; GETPALETTE: - lda #PALETTE - rts + lda #PALETTE + rts ; ------------------------------------------------------------------------ ; GETDEFPALETTE: Return the default palette for the driver in A/X. All @@ -267,9 +267,9 @@ GETPALETTE: ; GETDEFPALETTE: - lda #DEFPALETTE - rts + lda #DEFPALETTE + rts ; ------------------------------------------------------------------------ ; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing @@ -280,18 +280,18 @@ GETDEFPALETTE: ; SETPIXEL: - lda Y1 - sta PARAM2 - lda MODE -mymode: sta PARAM3 - lda X1 - add #2 * XSIZE ; Skip screen attribute columns - sta PARAM1 - lda #0 - sta PARAM1+1 - sta PARAM2+1 - sta PARAM3+1 - jmp CURSET + lda Y1 + sta PARAM2 + lda MODE +mymode: sta PARAM3 + lda X1 + add #2 * XSIZE ; Skip screen attribute columns + sta PARAM1 + lda #0 + sta PARAM1+1 + sta PARAM2+1 + sta PARAM3+1 + jmp CURSET ; ------------------------------------------------------------------------ ; GETPIXEL: Read the color value of a pixel, and return it in A/X. The @@ -299,18 +299,18 @@ mymode: sta PARAM3 ; area, so there is no need for clipping inside this function. GETPIXEL: - lda X1 - sta PARAM1 - lda Y1 - sta PARAM2 - lda #0 - sta PARAM1+1 - sta PARAM2+1 - jsr POINT - lda PARAM1 - and #%00000001 - ldx #0 - rts + lda X1 + sta PARAM1 + lda Y1 + sta PARAM2 + lda #0 + sta PARAM1+1 + sta PARAM2+1 + jsr POINT + lda PARAM1 + and #%00000001 + ldx #0 + rts ; ------------------------------------------------------------------------ ; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and @@ -320,24 +320,24 @@ GETPIXEL: ; LINE: - jsr SETPIXEL - lda X2 - sub X1 - sta PARAM1 - lda X2+1 - sbc X1+1 - sta PARAM1+1 - lda Y2 - sub Y1 - sta PARAM2 - lda Y2+1 - sbc Y1+1 - sta PARAM2+1 - lda MODE - sta PARAM3 - ldx #>0 - stx PARAM3+1 - jmp DRAW + jsr SETPIXEL + lda X2 + sub X1 + sta PARAM1 + lda X2+1 + sbc X1+1 + sta PARAM1+1 + lda Y2 + sub Y1 + sta PARAM2 + lda Y2+1 + sbc Y1+1 + sta PARAM2+1 + lda MODE + sta PARAM3 + ldx #>0 + stx PARAM3+1 + jmp DRAW ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where @@ -345,29 +345,29 @@ LINE: ; Contrary to most other functions, the graphics kernel will sort and clip ; the co-ordinates before calling the driver; so, on entry, the following ; conditions are valid: -; X1 <= X2 -; Y1 <= Y2 -; (X1 >= 0) && (X1 < XRES) -; (X2 >= 0) && (X2 < XRES) -; (Y1 >= 0) && (Y1 < YRES) -; (Y2 >= 0) && (Y2 < YRES) +; X1 <= X2 +; Y1 <= Y2 +; (X1 >= 0) && (X1 < XRES) +; (X2 >= 0) && (X2 < XRES) +; (Y1 >= 0) && (Y1 < YRES) +; (Y2 >= 0) && (Y2 < YRES) ; ; Must set an error code: NO ; BAR: - inc Y2 -@L1: lda Y2 - pha - lda Y1 - sta Y2 - jsr LINE - pla - sta Y2 - inc Y1 - cmp Y1 - bne @L1 - rts + inc Y2 +@L1: lda Y2 + pha + lda Y1 + sta Y2 + jsr LINE + pla + sta Y2 + inc Y1 + cmp Y1 + bne @L1 + rts ; ------------------------------------------------------------------------ ; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in the x @@ -377,7 +377,7 @@ BAR: ; TEXTSTYLE: - rts + rts ; ------------------------------------------------------------------------ @@ -389,38 +389,38 @@ TEXTSTYLE: ; OUTTEXT: - lda Y1 - sub #(YSIZE - 1) - sta PARAM2 - lda #3 ; (Move graphics cursor; don't draw) - jsr mymode + lda Y1 + sub #(YSIZE - 1) + sta PARAM2 + lda #3 ; (Move graphics cursor; don't draw) + jsr mymode - ldy #0 -@next: lda (ptr3),y - beq @end - sta PARAM1 - lda #0 - sta PARAM2 - sta PARAM1+1 - sta PARAM2+1 - sta PARAM3+1 - lda MODE - sta PARAM3 - tya - pha - jsr CHAR - lda #XSIZE - sta PARAM1 - lda #0 - sta PARAM2 - sta PARAM1+1 - sta PARAM2+1 - sta PARAM3+1 - lda #3 - sta PARAM3 - jsr CURMOV - pla - tay - iny - bne @next -@end: rts + ldy #0 +@next: lda (ptr3),y + beq @end + sta PARAM1 + lda #0 + sta PARAM2 + sta PARAM1+1 + sta PARAM2+1 + sta PARAM3+1 + lda MODE + sta PARAM3 + tya + pha + jsr CHAR + lda #XSIZE + sta PARAM1 + lda #0 + sta PARAM2 + sta PARAM1+1 + sta PARAM2+1 + sta PARAM3+1 + lda #3 + sta PARAM3 + jsr CURMOV + pla + tay + iny + bne @next +@end: rts diff --git a/libsrc/atmos/tgi/atmos-240-200-2.s b/libsrc/atmos/tgi/atmos-240-200-2.s index 9027b3340..735d75f93 100644 --- a/libsrc/atmos/tgi/atmos-240-200-2.s +++ b/libsrc/atmos/tgi/atmos-240-200-2.s @@ -5,58 +5,58 @@ ; 2012-08-11, Greg King ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" - .include "atmos.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" + .include "atmos.inc" - .macpack generic + .macpack generic -XSIZE = 6 ; System font width -YSIZE = 8 ; System font height +XSIZE = 6 ; System font width +YSIZE = 8 ; System font height ; ------------------------------------------------------------------------ ; Header. Includes jump table and constants. -.segment "JUMPTABLE" +.segment "JUMPTABLE" ; First part of the header is a structure that has a magic and defines the ; capabilities of the driver - .byte $74, $67, $69 ; "tgi" - .byte TGI_API_VERSION ; TGI API version number - .word 240 ; X resolution - .word 200 ; Y resolution - .byte 2 ; Number of drawing colors - .byte 1 ; Number of screens available - .byte XSIZE ; System font X size - .byte YSIZE ; System font Y size + .byte $74, $67, $69 ; "tgi" + .byte TGI_API_VERSION ; TGI API version number + .word 240 ; X resolution + .word 200 ; Y resolution + .byte 2 ; Number of drawing colors + .byte 1 ; Number of screens available + .byte XSIZE ; System font X size + .byte YSIZE ; System font Y size .word $011C ; Aspect ratio (based on 4/3 display) .byte 0 ; TGI driver flags ; Next comes the jump table. Currently all entries must be valid and may point ; to an RTS for test versions (function not implemented). - .addr INSTALL - .addr UNINSTALL - .addr INIT - .addr DONE - .addr GETERROR - .addr CONTROL - .addr CLEAR - .addr SETVIEWPAGE - .addr SETDRAWPAGE - .addr SETCOLOR - .addr SETPALETTE - .addr GETPALETTE - .addr GETDEFPALETTE - .addr SETPIXEL - .addr GETPIXEL - .addr LINE - .addr BAR - .addr TEXTSTYLE - .addr OUTTEXT + .addr INSTALL + .addr UNINSTALL + .addr INIT + .addr DONE + .addr GETERROR + .addr CONTROL + .addr CLEAR + .addr SETVIEWPAGE + .addr SETDRAWPAGE + .addr SETCOLOR + .addr SETPALETTE + .addr GETPALETTE + .addr GETDEFPALETTE + .addr SETPIXEL + .addr GETPIXEL + .addr LINE + .addr BAR + .addr TEXTSTYLE + .addr OUTTEXT .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ @@ -65,35 +65,35 @@ YSIZE = 8 ; System font height ; Variables mapped to the zero page segment variables. Some of these are ; used for passing parameters to the driver. -X1 = ptr1 -Y1 = ptr2 -X2 = ptr3 -Y2 = ptr4 +X1 = ptr1 +Y1 = ptr2 +X2 = ptr3 +Y2 = ptr4 ; Absolute variables used in the code .bss -ERROR: .res 1 ; Error code -MODE: .res 1 ; Graphics mode +ERROR: .res 1 ; Error code +MODE: .res 1 ; Graphics mode ; Constants and tables -PARAM1 = $2E1 -PARAM2 = $2E3 -PARAM3 = $2E5 -TEXT = $EC21 -HIRES = $EC33 -CURSET = $F0C8 -CURMOV = $F0FD -DRAW = $F110 -CHAR = $F12D -POINT = $F1C8 -PAPER = $F204 -INK = $F210 +PARAM1 = $2E1 +PARAM2 = $2E3 +PARAM3 = $2E5 +TEXT = $EC21 +HIRES = $EC33 +CURSET = $F0C8 +CURMOV = $F0FD +DRAW = $F110 +CHAR = $F12D +POINT = $F1C8 +PAPER = $F204 +INK = $F210 .rodata -DEFPALETTE: .byte 0, 1 +DEFPALETTE: .byte 0, 1 .code @@ -115,7 +115,7 @@ INSTALL: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ ; INIT: Changes an already installed device from text mode to graphics @@ -135,13 +135,13 @@ INIT: ; Switch into graphics mode - jsr HIRES + jsr HIRES ; Done, reset the error code - lda #TGI_ERR_OK - sta ERROR - rts + lda #TGI_ERR_OK + sta ERROR + rts ; ------------------------------------------------------------------------ ; DONE: Will be called to switch the graphics device back into text mode. @@ -151,16 +151,16 @@ INIT: ; Must set an error code: NO ; -DONE = TEXT +DONE = TEXT ; ------------------------------------------------------------------------ ; GETERROR: Return the error code in A and clear it. GETERROR: - ldx #TGI_ERR_OK - lda ERROR - stx ERROR - rts + ldx #TGI_ERR_OK + lda ERROR + stx ERROR + rts ; ------------------------------------------------------------------------ ; CONTROL: Platform/driver specific entry point. @@ -169,10 +169,10 @@ GETERROR: ; CONTROL: - sta $213 - lda #TGI_ERR_OK - sta ERROR - rts + sta $213 + lda #TGI_ERR_OK + sta ERROR + rts ; ------------------------------------------------------------------------ ; CLEAR: Clears the screen. @@ -180,7 +180,7 @@ CONTROL: ; Must set an error code: NO ; -CLEAR = HIRES +CLEAR = HIRES ; ------------------------------------------------------------------------ ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). @@ -199,7 +199,7 @@ SETVIEWPAGE: ; SETDRAWPAGE: - rts + rts ; ------------------------------------------------------------------------ ; SETCOLOR: Set the drawing color (in A). The new color is already checked @@ -209,8 +209,8 @@ SETDRAWPAGE: ; SETCOLOR: - sta MODE - rts + sta MODE + rts ; ------------------------------------------------------------------------ ; SETPALETTE: Set the palette (not available with all drivers/hardware). @@ -221,9 +221,9 @@ SETCOLOR: ; SETPALETTE: - lda #TGI_ERR_INV_FUNC ; This resolution has no palette - sta ERROR - rts + lda #TGI_ERR_INV_FUNC ; This resolution has no palette + sta ERROR + rts ; ------------------------------------------------------------------------ ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot @@ -245,9 +245,9 @@ GETPALETTE: ; GETDEFPALETTE: - lda #DEFPALETTE - rts + lda #DEFPALETTE + rts ; ------------------------------------------------------------------------ ; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing @@ -258,17 +258,17 @@ GETDEFPALETTE: ; SETPIXEL: - lda Y1 - sta PARAM2 - lda MODE -mymode: sta PARAM3 - lda X1 - sta PARAM1 - lda #0 - sta PARAM1+1 - sta PARAM2+1 - sta PARAM3+1 - jmp CURSET + lda Y1 + sta PARAM2 + lda MODE +mymode: sta PARAM3 + lda X1 + sta PARAM1 + lda #0 + sta PARAM1+1 + sta PARAM2+1 + sta PARAM3+1 + jmp CURSET ; ------------------------------------------------------------------------ ; GETPIXEL: Read the color value of a pixel and return it in A/X. The @@ -276,18 +276,18 @@ mymode: sta PARAM3 ; area, so there is no need for clipping inside this function. GETPIXEL: - lda X1 - sta PARAM1 - lda Y1 - sta PARAM2 - lda #0 - sta PARAM1+1 - sta PARAM2+1 - jsr POINT - lda PARAM1 - and #%00000001 - ldx #0 - rts + lda X1 + sta PARAM1 + lda Y1 + sta PARAM2 + lda #0 + sta PARAM1+1 + sta PARAM2+1 + jsr POINT + lda PARAM1 + and #%00000001 + ldx #0 + rts ; ------------------------------------------------------------------------ ; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and @@ -297,24 +297,24 @@ GETPIXEL: ; LINE: - jsr SETPIXEL - lda X2 - sub X1 - sta PARAM1 - lda X2+1 - sbc X1+1 - sta PARAM1+1 - lda Y2 - sub Y1 - sta PARAM2 - lda Y2+1 - sbc Y1+1 - sta PARAM2+1 - lda MODE - sta PARAM3 - ldx #>0 - stx PARAM3+1 - jmp DRAW + jsr SETPIXEL + lda X2 + sub X1 + sta PARAM1 + lda X2+1 + sbc X1+1 + sta PARAM1+1 + lda Y2 + sub Y1 + sta PARAM2 + lda Y2+1 + sbc Y1+1 + sta PARAM2+1 + lda MODE + sta PARAM3 + ldx #>0 + stx PARAM3+1 + jmp DRAW ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where @@ -322,29 +322,29 @@ LINE: ; Contrary to most other functions, the graphics kernel will sort and clip ; the coordinates before calling the driver, so on entry the following ; conditions are valid: -; X1 <= X2 -; Y1 <= Y2 -; (X1 >= 0) && (X1 < XRES) -; (X2 >= 0) && (X2 < XRES) -; (Y1 >= 0) && (Y1 < YRES) -; (Y2 >= 0) && (Y2 < YRES) +; X1 <= X2 +; Y1 <= Y2 +; (X1 >= 0) && (X1 < XRES) +; (X2 >= 0) && (X2 < XRES) +; (Y1 >= 0) && (Y1 < YRES) +; (Y2 >= 0) && (Y2 < YRES) ; ; Must set an error code: NO ; BAR: - inc Y2 -@L1: lda Y2 - pha - lda Y1 - sta Y2 - jsr LINE - pla - sta Y2 - inc Y1 - cmp Y1 - bne @L1 - rts + inc Y2 +@L1: lda Y2 + pha + lda Y1 + sta Y2 + jsr LINE + pla + sta Y2 + inc Y1 + cmp Y1 + bne @L1 + rts ; ------------------------------------------------------------------------ ; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y @@ -354,7 +354,7 @@ BAR: ; TEXTSTYLE: - rts + rts ; ------------------------------------------------------------------------ @@ -366,38 +366,38 @@ TEXTSTYLE: ; OUTTEXT: - lda Y1 - sub #(YSIZE - 1) - sta PARAM2 - lda #3 ; (Move graphics cursor; don't draw) - jsr mymode + lda Y1 + sub #(YSIZE - 1) + sta PARAM2 + lda #3 ; (Move graphics cursor; don't draw) + jsr mymode - ldy #0 -@next: lda (ptr3),y - beq @end - sta PARAM1 - lda #0 - sta PARAM2 - sta PARAM1+1 - sta PARAM2+1 - sta PARAM3+1 - lda MODE - sta PARAM3 - tya - pha - jsr CHAR - lda #XSIZE - sta PARAM1 - lda #0 - sta PARAM2 - sta PARAM1+1 - sta PARAM2+1 - sta PARAM3+1 - lda #3 - sta PARAM3 - jsr CURMOV - pla - tay - iny - bne @next -@end: rts + ldy #0 +@next: lda (ptr3),y + beq @end + sta PARAM1 + lda #0 + sta PARAM2 + sta PARAM1+1 + sta PARAM2+1 + sta PARAM3+1 + lda MODE + sta PARAM3 + tya + pha + jsr CHAR + lda #XSIZE + sta PARAM1 + lda #0 + sta PARAM2 + sta PARAM1+1 + sta PARAM2+1 + sta PARAM3+1 + lda #3 + sta PARAM3 + jsr CURMOV + pla + tay + iny + bne @next +@end: rts diff --git a/libsrc/atmos/tgi_colors.s b/libsrc/atmos/tgi_colors.s index 4dab483e2..6ef3729b4 100644 --- a/libsrc/atmos/tgi_colors.s +++ b/libsrc/atmos/tgi_colors.s @@ -2,7 +2,7 @@ ; Target-specific black & white values for use by the target-shared TGI kernel ; - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $01 + .export tgi_color_black:zp = $00 + .export tgi_color_white:zp = $01 diff --git a/libsrc/atmos/tgi_stat_stddrv.s b/libsrc/atmos/tgi_stat_stddrv.s index 89aef440f..7411f6276 100644 --- a/libsrc/atmos/tgi_stat_stddrv.s +++ b/libsrc/atmos/tgi_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void tgi_static_stddrv[]; ; - .export _tgi_static_stddrv - .import _atmos_240_200_2_tgi + .export _tgi_static_stddrv + .import _atmos_240_200_2_tgi .rodata diff --git a/libsrc/atmos/tgi_stddrv.s b/libsrc/atmos/tgi_stddrv.s index 905380bcd..d5c1a8eba 100644 --- a/libsrc/atmos/tgi_stddrv.s +++ b/libsrc/atmos/tgi_stddrv.s @@ -6,8 +6,8 @@ ; const char tgi_stddrv[]; ; - .export _tgi_stddrv + .export _tgi_stddrv .rodata -_tgi_stddrv: .asciiz "atmos-240-200-2.tgi" +_tgi_stddrv: .asciiz "atmos-240-200-2.tgi" diff --git a/libsrc/atmos/toascii.s b/libsrc/atmos/toascii.s index 606fb0b6b..69e0cf07a 100644 --- a/libsrc/atmos/toascii.s +++ b/libsrc/atmos/toascii.s @@ -3,12 +3,12 @@ ; /* Convert a target-specific character to ASCII. */ ; -.export _toascii +.export _toascii -.proc _toascii +.proc _toascii ; .X must be zero, on return. - ldx #>0 - rts + ldx #>0 + rts .endproc diff --git a/libsrc/atmos/wherex.s b/libsrc/atmos/wherex.s index 649f1adfe..7a2dbadc1 100644 --- a/libsrc/atmos/wherex.s +++ b/libsrc/atmos/wherex.s @@ -4,7 +4,7 @@ ; unsigned char wherex (void); ; - .export _wherex + .export _wherex .include "atmos.inc" @@ -12,7 +12,7 @@ ldx #$00 lda CURS_X - rts + rts .endproc diff --git a/libsrc/atmos/wherey.s b/libsrc/atmos/wherey.s index 3a940c581..8a2b3443f 100644 --- a/libsrc/atmos/wherey.s +++ b/libsrc/atmos/wherey.s @@ -4,7 +4,7 @@ ; unsigned char wherey (void); ; - .export _wherey + .export _wherey .include "atmos.inc" @@ -12,7 +12,7 @@ ldx #$00 lda CURS_Y - rts + rts .endproc diff --git a/libsrc/atmos/write.s b/libsrc/atmos/write.s index b7129dd1a..c6399f2bf 100644 --- a/libsrc/atmos/write.s +++ b/libsrc/atmos/write.s @@ -6,16 +6,16 @@ ; This function is a hack! ; - .export _write - .import popax - .importzp ptr1, ptr2, ptr3, tmp1 + .export _write + .import popax + .importzp ptr1, ptr2, ptr3, tmp1 - .include "atmos.inc" + .include "atmos.inc" .proc _write - sta ptr3 - stx ptr3+1 ; save count as result + sta ptr3 + stx ptr3+1 ; save count as result eor #$FF sta ptr2 @@ -23,32 +23,32 @@ eor #$FF sta ptr2+1 ; Remember -count-1 - jsr popax ; get buf - sta ptr1 - stx ptr1+1 - jsr popax ; get fd and discard -L1: inc ptr2 + jsr popax ; get buf + sta ptr1 + stx ptr1+1 + jsr popax ; get fd and discard +L1: inc ptr2 bne L2 inc ptr2+1 beq L9 L2: ldy #0 - lda (ptr1),y + lda (ptr1),y tax cpx #$0A ; Check for \n bne L3 jsr PRINT ldx #$0D L3: jsr PRINT - inc ptr1 - bne L1 - inc ptr1+1 + inc ptr1 + bne L1 + inc ptr1+1 jmp L1 ; No error, return count -L9: lda ptr3 - ldx ptr3+1 - rts +L9: lda ptr3 + ldx ptr3+1 + rts .endproc diff --git a/libsrc/c128/_scrsize.s b/libsrc/c128/_scrsize.s index 1f38ea65c..ad01f402c 100644 --- a/libsrc/c128/_scrsize.s +++ b/libsrc/c128/_scrsize.s @@ -4,7 +4,7 @@ ; Screen size variables ; - .export screensize + .export screensize .include "c128.inc" diff --git a/libsrc/c128/break.s b/libsrc/c128/break.s index 4cb349444..f2f872be8 100644 --- a/libsrc/c128/break.s +++ b/libsrc/c128/break.s @@ -5,69 +5,69 @@ ; void reset_brk (void); ; - .export _set_brk, _reset_brk - .destructor _reset_brk - .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc - .importzp ptr1 + .export _set_brk, _reset_brk + .destructor _reset_brk + .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc + .importzp ptr1 - .include "c128.inc" + .include "c128.inc" .bss -_brk_a: .res 1 -_brk_x: .res 1 -_brk_y: .res 1 -_brk_sr: .res 1 -_brk_pc: .res 2 +_brk_a: .res 1 +_brk_x: .res 1 +_brk_y: .res 1 +_brk_sr: .res 1 +_brk_pc: .res 2 .data -uservec: jmp $FFFF ; Patched at runtime +uservec: jmp $FFFF ; Patched at runtime .code ; Set the break vector -.proc _set_brk +.proc _set_brk - sta uservec+1 - stx uservec+2 ; Set the user vector + sta uservec+1 + stx uservec+2 ; Set the user vector - lda brk_old+1 - ora brk_old+2 ; Did we save the vector already? - bne @L1 ; Jump if we installed the handler already + lda brk_old+1 + ora brk_old+2 ; Did we save the vector already? + bne @L1 ; Jump if we installed the handler already - lda BRKVec ; Save the old vector - sta brk_old+1 - lda BRKVec+1 - sta brk_old+2 + lda BRKVec ; Save the old vector + sta brk_old+1 + lda BRKVec+1 + sta brk_old+2 - lda #brk_stub - sta BRKVec - stx BRKVec+1 + lda #brk_stub + sta BRKVec + stx BRKVec+1 - lda #brk_handler - sta brk_ind+1 - stx brk_ind+2 + lda #brk_handler + sta brk_ind+1 + stx brk_ind+2 -@L1: rts +@L1: rts .endproc ; Reset the break vector -.proc _reset_brk +.proc _reset_brk - lda brk_old+1 - ldx brk_old+2 - beq @L9 ; Jump if vector not installed - sta BRKVec - stx BRKVec+1 - lda #$00 - sta brk_old+1 ; Clear the saved vector - sta brk_old+2 -@L9: rts + lda brk_old+1 + ldx brk_old+2 + beq @L9 ; Jump if vector not installed + sta BRKVec + stx BRKVec+1 + lda #$00 + sta brk_old+1 ; Clear the saved vector + sta brk_old+2 +@L9: rts .endproc @@ -75,37 +75,37 @@ uservec: jmp $FFFF ; Patched at runtime ; Break handler, called if a break occurs -.proc brk_handler +.proc brk_handler - pla - sta _brk_y - pla - sta _brk_x - pla - sta _brk_a - pla - and #$EF ; Clear break bit - sta _brk_sr - pla ; PC low - sec - sbc #2 ; Point to start of brk - sta _brk_pc - pla ; PC high - sbc #0 - sta _brk_pc+1 + pla + sta _brk_y + pla + sta _brk_x + pla + sta _brk_a + pla + and #$EF ; Clear break bit + sta _brk_sr + pla ; PC low + sec + sbc #2 ; Point to start of brk + sta _brk_pc + pla ; PC high + sbc #0 + sta _brk_pc+1 - jsr uservec ; Call the user's routine + jsr uservec ; Call the user's routine - lda _brk_pc+1 - pha - lda _brk_pc - pha - lda _brk_sr - pha - ldx _brk_x - ldy _brk_y - lda _brk_a - rti ; Jump back... + lda _brk_pc+1 + pha + lda _brk_pc + pha + lda _brk_sr + pha + ldx _brk_x + ldy _brk_y + lda _brk_a + rti ; Jump back... .endproc @@ -115,9 +115,9 @@ uservec: jmp $FFFF ; Patched at runtime .segment "LOWCODE" .proc brk_stub - pla ; Get original MMU_CR value - sta MMU_CR ; And set it - jmp brk_ind ; Jump indirect to break + pla ; Get original MMU_CR value + sta MMU_CR ; And set it + jmp brk_ind ; Jump indirect to break .endproc ; ------------------------------------------------------------------------ diff --git a/libsrc/c128/c64mode.s b/libsrc/c128/c64mode.s index bc3f9d36c..053e67dfc 100644 --- a/libsrc/c128/c64mode.s +++ b/libsrc/c128/c64mode.s @@ -5,8 +5,8 @@ ; /* Switch the C128 into C64 mode. Note: This function will not return! */ ; - .export _c64mode + .export _c64mode .import C64MODE - _c64mode = C64MODE + _c64mode = C64MODE diff --git a/libsrc/c128/cgetc.s b/libsrc/c128/cgetc.s index 78e06b1eb..46f13d197 100644 --- a/libsrc/c128/cgetc.s +++ b/libsrc/c128/cgetc.s @@ -4,18 +4,18 @@ ; char cgetc (void); ; - .export _cgetc + .export _cgetc .constructor initcgetc .destructor donecgetc - .import cursor + .import cursor - .include "c128.inc" + .include "c128.inc" ;-------------------------------------------------------------------------- -_cgetc: lda KEY_COUNT ; Get number of characters - bne L2 ; Jump if there are already chars waiting +_cgetc: lda KEY_COUNT ; Get number of characters + bne L2 ; Jump if there are already chars waiting ; Switch on the cursor if needed. We MUST always switch the cursor on, ; before switching it off, because switching it off will restore the @@ -23,50 +23,50 @@ _cgetc: lda KEY_COUNT ; Get number of characters ; it off will restore the wrong character attribute. jsr CURS_SET ; Set cursor to current position - jsr CURS_ON - lda cursor - bne L1 - lda #$01 - jsr CURS_OFF -L1: lda KEY_COUNT ; Check characters again - beq L1 - jsr CURS_OFF ; Switch cursor off, if characters available + jsr CURS_ON + lda cursor + bne L1 + lda #$01 + jsr CURS_OFF +L1: lda KEY_COUNT ; Check characters again + beq L1 + jsr CURS_OFF ; Switch cursor off, if characters available -L2: jsr KBDREAD ; Read char and return in A +L2: jsr KBDREAD ; Read char and return in A ldx #0 - rts + rts ;-------------------------------------------------------------------------- ; Module constructor/destructor .bss -keyvec: .res 2 +keyvec: .res 2 .segment "INIT" initcgetc: ; Save the old vector - lda KeyStoreVec - sta keyvec - lda KeyStoreVec+1 - sta keyvec+1 + lda KeyStoreVec + sta keyvec + lda KeyStoreVec+1 + sta keyvec+1 ; Set the new vector. I can only hope that this works for other C128 ; versions... - lda #<$C6B7 - ldx #>$C6B7 + lda #<$C6B7 + ldx #>$C6B7 jmp SetVec .code donecgetc: - lda keyvec - ldx keyvec+1 -SetVec: sei - sta KeyStoreVec - stx KeyStoreVec+1 - cli - rts + lda keyvec + ldx keyvec+1 +SetVec: sei + sta KeyStoreVec + stx KeyStoreVec+1 + cli + rts diff --git a/libsrc/c128/clrscr.s b/libsrc/c128/clrscr.s index 54219b007..2213be0cd 100644 --- a/libsrc/c128/clrscr.s +++ b/libsrc/c128/clrscr.s @@ -4,11 +4,11 @@ ; void clrscr (void); ; - .export _clrscr + .export _clrscr - .include "c128.inc" + .include "c128.inc" -_clrscr = CLRSCR +_clrscr = CLRSCR diff --git a/libsrc/c128/color.s b/libsrc/c128/color.s index 5ee12431b..9e6b8537f 100644 --- a/libsrc/c128/color.s +++ b/libsrc/c128/color.s @@ -6,15 +6,15 @@ ; unsigned char __fastcall__ bordercolor (unsigned char color); ; - .export _textcolor, _bgcolor, _bordercolor + .export _textcolor, _bgcolor, _bordercolor .import return0 - .include "c128.inc" + .include "c128.inc" _textcolor: - bit MODE ; Check 80/40 column mode - bmi @L1 ; Jump if 80 columns + bit MODE ; Check 80/40 column mode + bmi @L1 ; Jump if 80 columns ; 40 column mode @@ -29,7 +29,7 @@ _textcolor: @L1: tax ; Move new color to X lda CHARCOLOR ; Get old color + attributes and #$F0 ; Keep old attributes - ora $CE5C,x ; Translate VIC color -> VDC color + ora $CE5C,x ; Translate VIC color -> VDC color ldx CHARCOLOR ; Get the old color sta CHARCOLOR ; Set the new color + old attributes txa ; Old color -> A @@ -39,13 +39,13 @@ _textcolor: ; translate vdc->vic colour vdctovic: - ldy #16 -@L2: cmp $CE5C-1,y - beq @L3 + ldy #16 +@L2: cmp $CE5C-1,y + beq @L3 dey bne @L2 -@L3: tya - rts +@L3: tya + rts _bgcolor: @@ -54,27 +54,27 @@ _bgcolor: ; 40 column mode - ldx VIC_BG_COLOR0 ; get old value - sta VIC_BG_COLOR0 ; set new value - txa + ldx VIC_BG_COLOR0 ; get old value + sta VIC_BG_COLOR0 ; set new value + txa ldx #$00 - rts + rts ; 80 column mode @L1: tax ; Move new color to X - lda $CE5C,x ; Translate VIC color -> VDC color - pha - ldx #26 - jsr $CDDA ; Read vdc register 26 - jsr vdctovic - tay - pla - ldx #26 - jsr $CDCC ; Write vdc register 26 - tya + lda $CE5C,x ; Translate VIC color -> VDC color + pha + ldx #26 + jsr $CDDA ; Read vdc register 26 + jsr vdctovic + tay + pla + ldx #26 + jsr $CDCC ; Write vdc register 26 + tya ldx #$00 - rts + rts _bordercolor: @@ -83,11 +83,11 @@ _bordercolor: ; 40 column mode - ldx VIC_BORDERCOLOR ; get old value - sta VIC_BORDERCOLOR ; set new value - txa + ldx VIC_BORDERCOLOR ; get old value + sta VIC_BORDERCOLOR ; set new value + txa ldx #$00 - rts + rts ; 80 column mode diff --git a/libsrc/c128/conio.s b/libsrc/c128/conio.s index 42df1437a..5193fb807 100644 --- a/libsrc/c128/conio.s +++ b/libsrc/c128/conio.s @@ -4,7 +4,7 @@ ; Low level stuff for screen output/console input ; - .exportzp CURS_X, CURS_Y + .exportzp CURS_X, CURS_Y - .include "c128.inc" + .include "c128.inc" diff --git a/libsrc/c128/cputc.s b/libsrc/c128/cputc.s index 73abdec52..e906c242a 100644 --- a/libsrc/c128/cputc.s +++ b/libsrc/c128/cputc.s @@ -6,12 +6,12 @@ ; void cputc (char c); ; - .export _cputcxy, _cputc, cputdirect, putchar - .export newline, plot - .import popa, _gotoxy + .export _cputcxy, _cputc, cputdirect, putchar + .export newline, plot + .import popa, _gotoxy .import PLOT - .include "c128.inc" + .include "c128.inc" newline = NEWLINE @@ -20,31 +20,31 @@ newline = NEWLINE .code _cputcxy: - pha ; Save C - jsr popa ; Get Y - jsr _gotoxy ; Set cursor, drop x - pla ; Restore C + pha ; Save C + jsr popa ; Get Y + jsr _gotoxy ; Set cursor, drop x + pla ; Restore C ; Plot a character - also used as internal function -_cputc: cmp #$0A ; CR? - beq cr ; Output a cr +_cputc: cmp #$0A ; CR? + beq cr ; Output a cr - cmp #$0D ; LF? - bne L2 - jmp NEWLINE ; Update cursor position + cmp #$0D ; LF? + bne L2 + jmp NEWLINE ; Update cursor position ; Printable char of some sort -L2: cmp #' ' - bcc cputdirect ; Other control char - tay - bmi L5 - cmp #$60 - bcc L3 - and #$DF - bne cputdirect ; Branch always -L3: and #$3F +L2: cmp #' ' + bcc cputdirect ; Other control char + tay + bmi L5 + cmp #$60 + bcc L3 + and #$DF + bne cputdirect ; Branch always +L3: and #$3F ; Output one character to the screen. We will disable scrolling while doing so @@ -62,28 +62,28 @@ cputdirect: ; Handle character if high bit set -L5: and #$7F - cmp #$7E ; PI? - bne L6 - lda #$5E ; Load screen code for PI - bne cputdirect -L6: ora #$40 - bne cputdirect ; Branch always +L5: and #$7F + cmp #$7E ; PI? + bne L6 + lda #$5E ; Load screen code for PI + bne cputdirect +L6: ora #$40 + bne cputdirect ; Branch always ; Carriage return -cr: lda #0 - sta CURS_X +cr: lda #0 + sta CURS_X ; Set cursor position, calculate RAM pointers -plot: ldy CURS_X - ldx CURS_Y - clc - jmp PLOT ; Set the new cursor +plot: ldy CURS_X + ldx CURS_Y + clc + jmp PLOT ; Set the new cursor ; Write one character to the screen without doing anything else, return X ; position in Y -putchar = $CC2F +putchar = $CC2F diff --git a/libsrc/c128/crt0.s b/libsrc/c128/crt0.s index 4315947e1..cd104decd 100644 --- a/libsrc/c128/crt0.s +++ b/libsrc/c128/crt0.s @@ -2,119 +2,119 @@ ; Startup code for cc65 (C128 version) ; - .export _exit - .export __STARTUP__ : absolute = 1 ; Mark as startup - .import initlib, donelib - .import zerobss - .import push0, callmain - .import RESTOR, BSOUT, CLRCH - .import __RAM_START__, __RAM_SIZE__, __STACKSIZE__ - .importzp ST + .export _exit + .export __STARTUP__ : absolute = 1 ; Mark as startup + .import initlib, donelib + .import zerobss + .import push0, callmain + .import RESTOR, BSOUT, CLRCH + .import __RAM_START__, __RAM_SIZE__, __STACKSIZE__ + .importzp ST - .include "zeropage.inc" - .include "c128.inc" + .include "zeropage.inc" + .include "c128.inc" ; ------------------------------------------------------------------------ ; Startup code -.segment "STARTUP" +.segment "STARTUP" Start: ; Switch to the second charset - lda #14 - jsr BSOUT + lda #14 + jsr BSOUT ; Before doing anything else, we have to setup our banking configuration. ; Otherwise just the lowest 16K are actually RAM. Writing through the ROM ; to the underlying RAM works, but it is bad style. - lda MMU_CR ; Get current memory configuration... - pha ; ...and save it for later - lda #MMU_CFG_CC65 ; Bank0 with kernal ROM - sta MMU_CR + lda MMU_CR ; Get current memory configuration... + pha ; ...and save it for later + lda #MMU_CFG_CC65 ; Bank0 with kernal ROM + sta MMU_CR ; Save the zero page locations we need - ldx #zpspace-1 -L1: lda sp,x - sta zpsave,x - dex - bpl L1 + ldx #zpspace-1 +L1: lda sp,x + sta zpsave,x + dex + bpl L1 ; Clear the BSS data - jsr zerobss + jsr zerobss ; Save system stuff and setup the stack - pla ; Get MMU setting - sta mmusave + pla ; Get MMU setting + sta mmusave - tsx - stx spsave ; Save the system stack pointer + tsx + stx spsave ; Save the system stack pointer - lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - sta sp - lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - sta sp+1 ; Set argument stack ptr + lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp + lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp+1 ; Set argument stack ptr ; Call module constructors - jsr initlib + jsr initlib ; Set the bank for the file name to our execution bank. We must do this, ; *after* calling constructors, because some of them may depend on the ; original value of this register. - lda #0 - sta FNAM_BANK + lda #0 + sta FNAM_BANK ; Push arguments and call main() - jsr callmain + jsr callmain ; Back from main (this is also the _exit entry). Run module destructors -_exit: pha ; Save the return code on stack - jsr donelib +_exit: pha ; Save the return code on stack + jsr donelib ; Copy back the zero page stuff - ldx #zpspace-1 -L2: lda zpsave,x - sta sp,x - dex - bpl L2 + ldx #zpspace-1 +L2: lda zpsave,x + sta sp,x + dex + bpl L2 ; Place the program return code into ST - pla - sta ST + pla + sta ST ; Reset the stack and the memory configuration - ldx spsave - txs - ldx mmusave - stx MMU_CR + ldx spsave + txs + ldx mmusave + stx MMU_CR ; Done, return to BASIC - rts + rts ; ------------------------------------------------------------------------ ; Data -.segment "ZPSAVE" +.segment "ZPSAVE" -zpsave: .res zpspace +zpsave: .res zpspace ; ------------------------------------------------------------------------ .bss -spsave: .res 1 -mmusave:.res 1 +spsave: .res 1 +mmusave:.res 1 diff --git a/libsrc/c128/dbgbreak.s_ b/libsrc/c128/dbgbreak.s_ index 472d800fe..a99071786 100644 --- a/libsrc/c128/dbgbreak.s_ +++ b/libsrc/c128/dbgbreak.s_ @@ -4,20 +4,20 @@ ; unsigned DbgSetBreakVec (unsigned Addr); ; - .export _DbgSetBreakVec - .import popax, utstax - - .include "../cbm/cbm.inc" + .export _DbgSetBreakVec + .import popax, utstax + + .include "../cbm/cbm.inc" _DbgSetBreakVec: - jsr popax ; Get the new address - ldy BRKVec - sta BRKVec - lda BRKVec+1 - stx BRKVec+1 - tax - tya - jmp utstax + jsr popax ; Get the new address + ldy BRKVec + sta BRKVec + lda BRKVec+1 + stx BRKVec+1 + tax + tya + jmp utstax diff --git a/libsrc/c128/devnum.s b/libsrc/c128/devnum.s index 72007a516..91d0ccc07 100644 --- a/libsrc/c128/devnum.s +++ b/libsrc/c128/devnum.s @@ -2,6 +2,6 @@ ; Oliver Schmidt, 2010-02-14 ; - .include "c128.inc" + .include "c128.inc" - .exportzp devnum := DEVNUM + .exportzp devnum := DEVNUM diff --git a/libsrc/c128/emd/c128-georam.s b/libsrc/c128/emd/c128-georam.s index 23c3469c5..0c106f406 100644 --- a/libsrc/c128/emd/c128-georam.s +++ b/libsrc/c128/emd/c128-georam.s @@ -8,9 +8,9 @@ ; Marco van den Heuvel, 2010-01-21 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" + .include "em-kernel.inc" .include "em-error.inc" @@ -25,7 +25,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -62,83 +62,83 @@ pagecount: .res 2 ; Number of available pages ; INSTALL: - ldx GR_WINDOW + ldx GR_WINDOW cpx GR_WINDOW bne @notpresent inc GR_WINDOW - cpx GR_WINDOW - beq @notpresent + cpx GR_WINDOW + beq @notpresent - lda #4 - jsr check - cpy GR_WINDOW - beq @has64k - lda #8 - jsr check - cpy GR_WINDOW - beq @has128k - lda #16 - jsr check - cpy GR_WINDOW - beq @has256k - lda #32 - jsr check - cpy GR_WINDOW - beq @has512k - lda #64 - jsr check - cpy GR_WINDOW - beq @has1024k - lda #128 - jsr check - cpy GR_WINDOW - beq @has2048k - ldx #>16384 + lda #4 + jsr check + cpy GR_WINDOW + beq @has64k + lda #8 + jsr check + cpy GR_WINDOW + beq @has128k + lda #16 + jsr check + cpy GR_WINDOW + beq @has256k + lda #32 + jsr check + cpy GR_WINDOW + beq @has512k + lda #64 + jsr check + cpy GR_WINDOW + beq @has1024k + lda #128 + jsr check + cpy GR_WINDOW + beq @has2048k + ldx #>16384 bne @setok @has64k: - ldx #>256 - bne @setok + ldx #>256 + bne @setok @has128k: - ldx #>512 - bne @setok + ldx #>512 + bne @setok @has256k: - ldx #>1024 - bne @setok + ldx #>1024 + bne @setok @has512k: - ldx #>2048 - bne @setok + ldx #>2048 + bne @setok @has1024k: - ldx #>4096 - bne @setok + ldx #>4096 + bne @setok @has2048k: - ldx #>8192 - bne @setok + ldx #>8192 + bne @setok @notpresent: - lda #EM_ERR_NO_DEVICE - rts + lda #EM_ERR_NO_DEVICE + rts @setok: - lda #0 - sta pagecount - stx pagecount+1 - lda #EM_ERR_OK - rts + lda #0 + sta pagecount + stx pagecount+1 + lda #EM_ERR_OK + rts check: - ldx #0 - stx GR_PAGE_LO - stx GR_PAGE_HI - ldy GR_WINDOW - iny - sta GR_PAGE_HI - sty GR_WINDOW - ldx #0 - stx GR_PAGE_HI -; rts ; Run into UNINSTALL instead + ldx #0 + stx GR_PAGE_LO + stx GR_PAGE_HI + ldy GR_WINDOW + iny + sta GR_PAGE_HI + sty GR_WINDOW + ldx #0 + stx GR_PAGE_HI +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. diff --git a/libsrc/c128/emd/c128-ram.s b/libsrc/c128/emd/c128-ram.s index 1211c444d..02979a6dc 100644 --- a/libsrc/c128/emd/c128-ram.s +++ b/libsrc/c128/emd/c128-ram.s @@ -5,9 +5,9 @@ ; Ullrich von Bassewitz, 2002-12-04 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" + .include "em-kernel.inc" .include "em-error.inc" .include "c128.inc" @@ -23,7 +23,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -33,15 +33,15 @@ .word MAP .word USE .word COMMIT - .word COPYFROM + .word COPYFROM .word COPYTO ; ------------------------------------------------------------------------ ; Constants -BASE = $400 +BASE = $400 TOPMEM = $FF00 -PAGES = (TOPMEM - BASE) / 256 +PAGES = (TOPMEM - BASE) / 256 ; ------------------------------------------------------------------------ ; Data. @@ -96,10 +96,10 @@ MAP: sta curpage stx curpage+1 ; Remember the new page clc - adc #>BASE - sta ptr1+1 - ldy #$00 - sty ptr1 + adc #>BASE + sta ptr1+1 + ldy #$00 + sty ptr1 lda #BASE - sta ptr1+1 - ldy #$00 - sty ptr1 + adc #>BASE + sta ptr1+1 + ldy #$00 + sty ptr1 lda #BASE - sta ptr1+1 - ldy #$00 + adc #>BASE + sta ptr1+1 + ldy #$00 sty ptr1 lda #512 - bne @setsize -@rc64: ldx #>256 + lda #0 + sta RAMC_PAGE_LO + sta RAMC_PAGE_HI + ldx RAMC_WINDOW + cpx RAMC_WINDOW + bne @notpresent + lda #2 + sta RAMC_WINDOW + cmp RAMC_WINDOW + beq @cont + cpx RAMC_WINDOW + beq @readonly +@cont: ldy #1 + sty RAMC_PAGE_HI + sty RAMC_WINDOW + dey + sty RAMC_PAGE_HI + iny + cpy RAMC_WINDOW + beq @rc64 + ; we're on rc128 + ldx #>512 + bne @setsize +@rc64: ldx #>256 @setsize: - lda #0 - sta pagecount - stx pagecount+1 + lda #0 + sta pagecount + stx pagecount+1 lda #EM_ERR_OK rts @notpresent: @readonly: - lda #EM_ERR_NO_DEVICE -; rts ; Run into UNINSTALL instead + lda #EM_ERR_NO_DEVICE +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -134,8 +134,8 @@ USE = MAP ; by the driver. ; -MAP: sta RAMC_PAGE_LO - stx RAMC_PAGE_HI +MAP: sta RAMC_PAGE_LO + stx RAMC_PAGE_HI lda #RAMC_WINDOW @@ -185,14 +185,14 @@ COPYFROM: ; Bump page register -@L4: inc tmp1 - bne @L5 - inc tmp2 -@L5: lda tmp1 - sta RAMC_PAGE_LO - lda tmp2 - sta RAMC_PAGE_HI - jmp @L3 +@L4: inc tmp1 + bne @L5 + inc tmp2 +@L5: lda tmp1 + sta RAMC_PAGE_LO + lda tmp2 + sta RAMC_PAGE_HI + jmp @L3 ; ------------------------------------------------------------------------ ; COPYTO: Copy from linear into extended memory. A pointer to a structure @@ -233,14 +233,14 @@ COPYTO: ; Bump page register -@L4: inc tmp1 - bne @L5 - inc tmp2 -@L5: lda tmp1 - sta RAMC_PAGE_LO - lda tmp2 - sta RAMC_PAGE_HI - jmp @L3 +@L4: inc tmp1 + bne @L5 + inc tmp2 +@L5: lda tmp1 + sta RAMC_PAGE_LO + lda tmp2 + sta RAMC_PAGE_HI + jmp @L3 ; ------------------------------------------------------------------------ ; Helper function for COPYFROM and COPYTO: Store the pointer to the request diff --git a/libsrc/c128/emd/c128-reu.s b/libsrc/c128/emd/c128-reu.s index 4f86f6aee..b1a979cb5 100644 --- a/libsrc/c128/emd/c128-reu.s +++ b/libsrc/c128/emd/c128-reu.s @@ -5,11 +5,11 @@ ; Ullrich von Bassewitz, 2002-11-29 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" + .include "em-kernel.inc" .include "em-error.inc" - .include "c128.inc" + .include "c128.inc" .macpack generic @@ -23,7 +23,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -33,7 +33,7 @@ .word MAP .word USE .word COMMIT - .word COPYFROM + .word COPYFROM .word COPYTO ; ------------------------------------------------------------------------ @@ -61,12 +61,12 @@ curpage: .res 2 ; Current page number window: .res 256 ; Memory "window" -reu_params: .word $0000 ; Host address, lo, hi - .word $0000 ; Exp address, lo, hi - .byte $00 ; Expansion bank no. - .word $0000 ; # bytes to move, lo, hi - .byte $00 ; Interrupt mask reg. - .byte $00 ; Adress control reg. +reu_params: .word $0000 ; Host address, lo, hi + .word $0000 ; Exp address, lo, hi + .byte $00 ; Expansion bank no. + .word $0000 ; # bytes to move, lo, hi + .byte $00 ; Interrupt mask reg. + .byte $00 ; Adress control reg. .code @@ -221,14 +221,14 @@ transfer1: ; Transfer subroutine for the REU. Expects command in Y. transfer: - sty REU_COMMAND ; Issue command + sty REU_COMMAND ; Issue command - ldy MMU_CR ; Save the current MMU settings - lda #MMU_CFG_RAM0 ; - sei ; - sta MMU_CR ; Enable RAM in bank #0 + ldy MMU_CR ; Save the current MMU settings + lda #MMU_CFG_RAM0 ; + sei ; + sta MMU_CR ; Enable RAM in bank #0 lda REU_TRIGGER ; Don't change $FF00 - sta REU_TRIGGER ; Start the transfer... + sta REU_TRIGGER ; Start the transfer... sty MMU_CR ; Restore the old configuration cli diff --git a/libsrc/c128/emd/c128-vdc.s b/libsrc/c128/emd/c128-vdc.s index d2b6b9d8b..29dbb4569 100644 --- a/libsrc/c128/emd/c128-vdc.s +++ b/libsrc/c128/emd/c128-vdc.s @@ -4,10 +4,10 @@ ; Maciej 'YTM/Elysium' Witkowiak ; 06,20.12.2002 - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" - .include "em-error.inc" + .include "em-kernel.inc" + .include "em-error.inc" .macpack generic @@ -21,7 +21,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -29,33 +29,33 @@ .word DEINSTALL .word PAGECOUNT .word MAP - .word USE + .word USE .word COMMIT - .word COPYFROM + .word COPYFROM .word COPYTO ; ------------------------------------------------------------------------ ; Constants -VDC_ADDR_REG = $D600 ; VDC address -VDC_DATA_REG = $D601 ; VDC data +VDC_ADDR_REG = $D600 ; VDC address +VDC_DATA_REG = $D601 ; VDC data -VDC_DATA_HI = 18 ; used registers -VDC_DATA_LO = 19 -VDC_CSET = 28 -VDC_DATA = 31 +VDC_DATA_HI = 18 ; used registers +VDC_DATA_LO = 19 +VDC_CSET = 28 +VDC_DATA = 31 ; ------------------------------------------------------------------------ ; Data. .data -pagecount: .word 64 ; $0000-$3fff as 16k default -curpage: .word $ffff ; currently mapped-in page (invalid) +pagecount: .word 64 ; $0000-$3fff as 16k default +curpage: .word $ffff ; currently mapped-in page (invalid) .bss -window: .res 256 ; memory window +window: .res 256 ; memory window .code @@ -67,78 +67,78 @@ window: .res 256 ; memory window ; INSTALL: - ; do test for VDC presence here??? + ; do test for VDC presence here??? - ldx #VDC_CSET ; determine size of RAM... - jsr vdcgetreg - sta tmp1 - ora #%00010000 - jsr vdcputreg ; turn on 64k + ldx #VDC_CSET ; determine size of RAM... + jsr vdcgetreg + sta tmp1 + ora #%00010000 + jsr vdcputreg ; turn on 64k - jsr settestadr1 ; save original value of test byte - jsr vdcgetbyte - sta tmp2 + jsr settestadr1 ; save original value of test byte + jsr vdcgetbyte + sta tmp2 - lda #$55 ; write $55 here - ldy #ptr1 - jsr test64k ; read it here and there - lda #$aa ; write $aa here - ldy #ptr2 - jsr test64k ; read it here and there + lda #$55 ; write $55 here + ldy #ptr1 + jsr test64k ; read it here and there + lda #$aa ; write $aa here + ldy #ptr2 + jsr test64k ; read it here and there - jsr settestadr1 - lda tmp2 - jsr vdcputbyte ; restore original value of test byte + jsr settestadr1 + lda tmp2 + jsr vdcputbyte ; restore original value of test byte - lda ptr1 ; do bytes match? - cmp ptr1+1 - bne @have64k - lda ptr2 - cmp ptr2+1 - bne @have64k + lda ptr1 ; do bytes match? + cmp ptr1+1 + bne @have64k + lda ptr2 + cmp ptr2+1 + bne @have64k - ldx #VDC_CSET - lda tmp1 - jsr vdcputreg ; restore 16/64k flag - jmp @endok ; and leave default values for 16k + ldx #VDC_CSET + lda tmp1 + jsr vdcputreg ; restore 16/64k flag + jmp @endok ; and leave default values for 16k @have64k: - lda #<256 - ldx #>256 - sta pagecount - stx pagecount+1 + lda #<256 + ldx #>256 + sta pagecount + stx pagecount+1 @endok: - lda #EM_ERR_OK rts test64k: - sta tmp1 - sty ptr3 - lda #0 - sta ptr3+1 - jsr settestadr1 - lda tmp1 - jsr vdcputbyte ; write $55 - jsr settestadr1 - jsr vdcgetbyte ; read here - pha - jsr settestadr2 - jsr vdcgetbyte ; and there - ldy #1 - sta (ptr3),y - pla - dey - sta (ptr3),y - rts + sta tmp1 + sty ptr3 + lda #0 + sta ptr3+1 + jsr settestadr1 + lda tmp1 + jsr vdcputbyte ; write $55 + jsr settestadr1 + jsr vdcgetbyte ; read here + pha + jsr settestadr2 + jsr vdcgetbyte ; and there + ldy #1 + sta (ptr3),y + pla + dey + sta (ptr3),y + rts settestadr1: - ldy #$02 ; test page 2 (here) - .byte $2c + ldy #$02 ; test page 2 (here) + .byte $2c settestadr2: - ldy #$42 ; or page 64+2 (there) - lda #0 - jmp vdcsetsrcaddr + ldy #$42 ; or page 64+2 (there) + lda #0 + jmp vdcsetsrcaddr ; ------------------------------------------------------------------------ ; DEINSTALL routine. Is called before the driver is removed from memory. @@ -146,7 +146,7 @@ settestadr2: ; DEINSTALL: - ;on C128 restore font and clear the screen? + ;on C128 restore font and clear the screen? rts ; ------------------------------------------------------------------------ @@ -164,42 +164,42 @@ PAGECOUNT: ; by the driver. ; -MAP: sta curpage - stx curpage+1 - sta ptr1+1 - ldy #0 - sty ptr1 +MAP: sta curpage + stx curpage+1 + sta ptr1+1 + ldy #0 + sty ptr1 - lda #window - sta ptr2+1 + lda #window + sta ptr2+1 - jsr transferin + jsr transferin lda #window - rts + rts ; copy a single page from (ptr1):VDCRAM to (ptr2):RAM transferin: - lda ptr1 - ldy ptr1+1 - jsr vdcsetsrcaddr ; set source address in VDC - ldy #0 - ldx #VDC_DATA - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda VDC_DATA_REG ; get 2 bytes at a time to speed-up - sta (ptr2),y ; (in fact up to 8 bytes could be fetched with special VDC config) - iny - lda VDC_DATA_REG - sta (ptr2),y - iny - bne @L0 - rts + lda ptr1 + ldy ptr1+1 + jsr vdcsetsrcaddr ; set source address in VDC + ldy #0 + ldx #VDC_DATA + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda VDC_DATA_REG ; get 2 bytes at a time to speed-up + sta (ptr2),y ; (in fact up to 8 bytes could be fetched with special VDC config) + iny + lda VDC_DATA_REG + sta (ptr2),y + iny + bne @L0 + rts ; ------------------------------------------------------------------------ ; USE: Tell the driver that the window is now associated with a given page. @@ -214,36 +214,36 @@ done: rts ; COMMIT: Commit changes in the memory window to extended storage. COMMIT: - lda curpage ; jump if no page mapped - ldx curpage+1 - bmi done - sta ptr1+1 - ldy #0 - sty ptr1 + lda curpage ; jump if no page mapped + ldx curpage+1 + bmi done + sta ptr1+1 + ldy #0 + sty ptr1 - lda #window - sta ptr2+1 + lda #window + sta ptr2+1 ; fall through to transferout ; copy a single page from (ptr2):RAM to (ptr1):VDCRAM transferout: - lda ptr1 - ldy ptr1+1 - jsr vdcsetsrcaddr ; set source address in VDC - ldy #0 - ldx #VDC_DATA - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda (ptr2),y ; speedup does not work for writing - sta VDC_DATA_REG - iny - bne @L0 - rts + lda ptr1 + ldy ptr1+1 + jsr vdcsetsrcaddr ; set source address in VDC + ldy #0 + ldx #VDC_DATA + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda (ptr2),y ; speedup does not work for writing + sta VDC_DATA_REG + iny + bne @L0 + rts ; ------------------------------------------------------------------------ ; COPYFROM: Copy from extended into linear memory. A pointer to a structure @@ -252,8 +252,8 @@ transferout: ; COPYFROM: - jsr setup - beq @L2 ; Skip if no full pages + jsr setup + beq @L2 ; Skip if no full pages ; Copy full pages @@ -268,18 +268,18 @@ COPYFROM: @L2: ldy #EM_COPY::COUNT lda (ptr3),y ; Get bytes in last page beq @L4 - sta tmp1 + sta tmp1 ; Transfer the bytes in the last page - ldy #0 -@L3: jsr vdcgetbyte - sta (ptr2),y - iny - dec tmp1 - lda tmp1 - bne @L3 -@L4: rts + ldy #0 +@L3: jsr vdcgetbyte + sta (ptr2),y + iny + dec tmp1 + lda tmp1 + bne @L3 +@L4: rts ; ------------------------------------------------------------------------ ; COPYTO: Copy from linear into extended memory. A pointer to a structure @@ -288,8 +288,8 @@ COPYFROM: ; COPYTO: - jsr setup - beq @L2 ; Skip if no full pages + jsr setup + beq @L2 ; Skip if no full pages ; Copy full pages @@ -304,52 +304,52 @@ COPYTO: @L2: ldy #EM_COPY::COUNT lda (ptr3),y ; Get bytes in last page beq @L4 - sta tmp1 + sta tmp1 ; Transfer the bytes in the last page - ldy #0 -@L3: lda (ptr2),y - jsr vdcputbyte - iny - dec tmp1 - lda tmp1 - bne @L3 -@L4: rts + ldy #0 +@L3: lda (ptr2),y + jsr vdcputbyte + iny + dec tmp1 + lda tmp1 + bne @L3 +@L4: rts ;------------------------------------------------------------------------- ; Helper functions to handle VDC ram ; vdcsetsrcaddr: - ldx #VDC_DATA_LO - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - sta VDC_DATA_REG - dex - tya - stx VDC_ADDR_REG - sta VDC_DATA_REG - rts + ldx #VDC_DATA_LO + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + sta VDC_DATA_REG + dex + tya + stx VDC_ADDR_REG + sta VDC_DATA_REG + rts vdcgetbyte: - ldx #VDC_DATA + ldx #VDC_DATA vdcgetreg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda VDC_DATA_REG + rts vdcputbyte: - ldx #VDC_DATA + ldx #VDC_DATA vdcputreg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - sta VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + sta VDC_DATA_REG + rts ; ------------------------------------------------------------------------ ; Helper function for COPYFROM and COPYTO: Store the pointer to the request @@ -357,7 +357,7 @@ vdcputreg: ; setup: - sta ptr3 + sta ptr3 stx ptr3+1 ; Save the passed em_copy pointer ldy #EM_COPY::OFFS @@ -374,8 +374,8 @@ setup: lda (ptr3),y sta ptr2+1 ; To - ldy #EM_COPY::COUNT+1 + ldy #EM_COPY::COUNT+1 lda (ptr3),y ; Get number of pages sta tmp1 - rts + rts diff --git a/libsrc/c128/fast.s b/libsrc/c128/fast.s index abb32d2be..9e032f915 100644 --- a/libsrc/c128/fast.s +++ b/libsrc/c128/fast.s @@ -7,16 +7,16 @@ ; */ ; - .export _fast + .export _fast - .include "c128.inc" + .include "c128.inc" -.proc _fast +.proc _fast - lda #$01 - sta VIC_CLK_128 - rts + lda #$01 + sta VIC_CLK_128 + rts .endproc diff --git a/libsrc/c128/get_tv.s b/libsrc/c128/get_tv.s index 084876d11..d85c9a650 100644 --- a/libsrc/c128/get_tv.s +++ b/libsrc/c128/get_tv.s @@ -5,7 +5,7 @@ ; /* Return the video mode the machine is using */ ; - .include "get_tv.inc" + .include "get_tv.inc" .include "c128.inc" @@ -14,7 +14,7 @@ .proc _get_tv - ldx #TV::PAL ; Assume PAL + ldx #TV::PAL ; Assume PAL lda PALFLAG bne pal dex ; NTSC diff --git a/libsrc/c128/irq.s b/libsrc/c128/irq.s index d468eeaaa..aed1f3a25 100644 --- a/libsrc/c128/irq.s +++ b/libsrc/c128/irq.s @@ -2,38 +2,38 @@ ; IRQ handling (C128 version) ; - .export initirq, doneirq - .import callirq + .export initirq, doneirq + .import callirq - .include "c128.inc" + .include "c128.inc" -IRQInd = $2FD ; JMP $0000 - used as indirect IRQ vector +IRQInd = $2FD ; JMP $0000 - used as indirect IRQ vector ; ------------------------------------------------------------------------ -.segment "INIT" +.segment "INIT" initirq: - lda IRQVec - ldx IRQVec+1 - sta IRQInd+1 - stx IRQInd+2 - lda #IRQStub - jmp setvec + lda IRQVec + ldx IRQVec+1 + sta IRQInd+1 + stx IRQInd+2 + lda #IRQStub + jmp setvec ; ------------------------------------------------------------------------ .code doneirq: - lda IRQInd+1 - ldx IRQInd+2 -setvec: sei - sta IRQVec - stx IRQVec+1 - cli - rts + lda IRQInd+1 + ldx IRQInd+2 +setvec: sei + sta IRQVec + stx IRQVec+1 + cli + rts ; ------------------------------------------------------------------------ ; The C128 has ROM parallel to the RAM starting from $4000. The startup code @@ -45,15 +45,15 @@ setvec: sei ; placed just above the startup code, so it goes into a RAM area that is ; not banked. -.segment "LOWCODE" +.segment "LOWCODE" IRQStub: - cld ; Just to be sure - lda MMU_CR ; Get old register value - pha ; And save on stack - lda #MMU_CFG_CC65 ; Bank 0 with kernal ROM - sta MMU_CR - jsr callirq ; Call the functions - pla ; Get old register value - sta MMU_CR - jmp IRQInd ; Jump to the saved IRQ vector + cld ; Just to be sure + lda MMU_CR ; Get old register value + pha ; And save on stack + lda #MMU_CFG_CC65 ; Bank 0 with kernal ROM + sta MMU_CR + jsr callirq ; Call the functions + pla ; Get old register value + sta MMU_CR + jmp IRQInd ; Jump to the saved IRQ vector diff --git a/libsrc/c128/joy/c128-ptvjoy.s b/libsrc/c128/joy/c128-ptvjoy.s index e101997f1..5763fbe2d 100644 --- a/libsrc/c128/joy/c128-ptvjoy.s +++ b/libsrc/c128/joy/c128-ptvjoy.s @@ -61,7 +61,7 @@ JOY_COUNT = 4 ; Number of joysticks we support INSTALL: lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -85,18 +85,18 @@ COUNT: ; READ: Read a particular joystick passed in A. ; -READ: tax ; Joystick number into X +READ: tax ; Joystick number into X bne joy2 ; Read joystick 1 -joy1: lda #$7F +joy1: lda #$7F sei - sta CIA1_PRA - lda CIA1_PRB + sta CIA1_PRA + lda CIA1_PRB cli - and #$1F - eor #$1F + and #$1F + eor #$1F rts ; Read joystick 2 @@ -104,15 +104,15 @@ joy1: lda #$7F joy2: dex bne joy3 - lda #$E0 - ldy #$FF + lda #$E0 + ldy #$FF sei - sta CIA1_DDRA - lda CIA1_PRA - sty CIA1_DDRA + sta CIA1_DDRA + lda CIA1_PRA + sty CIA1_DDRA cli - and #$1F - eor #$1F + and #$1F + eor #$1F rts ; Read joystick 3 diff --git a/libsrc/c128/joy/c128-stdjoy.s b/libsrc/c128/joy/c128-stdjoy.s index 241e223e7..f86853a81 100644 --- a/libsrc/c128/joy/c128-stdjoy.s +++ b/libsrc/c128/joy/c128-stdjoy.s @@ -6,9 +6,9 @@ ; Ullrich von Bassewitz, 2002-12-21 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" + .include "joy-kernel.inc" .include "joy-error.inc" .include "c128.inc" @@ -22,8 +22,8 @@ ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) @@ -66,7 +66,7 @@ JOY_COUNT = 2 ; Number of joysticks we support INSTALL: lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -90,32 +90,32 @@ COUNT: ; READ: Read a particular joystick passed in A. ; -READ: tax ; Joystick number into X - bne joy2 +READ: tax ; Joystick number into X + bne joy2 ; Read joystick 1 -joy1: lda #$7F - sei - sta CIA1_PRA - lda CIA1_PRB - cli - and #$1F - eor #$1F - rts +joy1: lda #$7F + sei + sta CIA1_PRA + lda CIA1_PRB + cli + and #$1F + eor #$1F + rts ; Read joystick 2 -joy2: ldx #0 - lda #$E0 - ldy #$FF - sei - sta CIA1_DDRA - lda CIA1_PRA - sty CIA1_DDRA - cli - and #$1F - eor #$1F - rts +joy2: ldx #0 + lda #$E0 + ldy #$FF + sei + sta CIA1_DDRA + lda CIA1_PRA + sty CIA1_DDRA + cli + and #$1F + eor #$1F + rts diff --git a/libsrc/c128/joy_stat_stddrv.s b/libsrc/c128/joy_stat_stddrv.s index 6a70a8fd2..d6d695347 100644 --- a/libsrc/c128/joy_stat_stddrv.s +++ b/libsrc/c128/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _c128_stdjoy_joy + .export _joy_static_stddrv + .import _c128_stdjoy_joy .rodata diff --git a/libsrc/c128/joy_stddrv.s b/libsrc/c128/joy_stddrv.s index 4cfd4b9a1..acbd0bdfa 100644 --- a/libsrc/c128/joy_stddrv.s +++ b/libsrc/c128/joy_stddrv.s @@ -6,9 +6,9 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "c128-stdjoy.joy" +_joy_stddrv: .asciiz "c128-stdjoy.joy" diff --git a/libsrc/c128/kbhit.s b/libsrc/c128/kbhit.s index 28ee2d4de..c1bca2416 100644 --- a/libsrc/c128/kbhit.s +++ b/libsrc/c128/kbhit.s @@ -4,16 +4,16 @@ ; unsigned char kbhit (void); ; - .export _kbhit + .export _kbhit - .include "c128.inc" + .include "c128.inc" .proc _kbhit ldx #0 ; High byte of return is always zero - lda KEY_COUNT ; Get number of characters -; ora FKEY_COUNT ; Or with number of chars from function keys + lda KEY_COUNT ; Get number of characters +; ora FKEY_COUNT ; Or with number of chars from function keys beq L9 lda #1 L9: rts diff --git a/libsrc/c128/kernal.s b/libsrc/c128/kernal.s index 7a6ff2822..f3b78d00b 100644 --- a/libsrc/c128/kernal.s +++ b/libsrc/c128/kernal.s @@ -53,48 +53,48 @@ ; All functions are available in the kernal jump table ; Extended jump table -C64MODE = $FF4D -SWAPPER = $FF5F +C64MODE = $FF4D +SWAPPER = $FF5F SETBNK = $FF68 ; -CINT = $FF81 -IOINIT = $FF84 -RAMTAS = $FF87 -RESTOR = $FF8A -VECTOR = $FF8D -SETMSG = $FF90 -SECOND = $FF93 -TKSA = $FF96 -MEMTOP = $FF99 -MEMBOT = $FF9C -SCNKEY = $FF9F -SETTMO = $FFA2 -ACPTR = $FFA5 -CIOUT = $FFA8 -UNTLK = $FFAB -UNLSN = $FFAE -LISTEN = $FFB1 -TALK = $FFB4 -READST = $FFB7 -SETLFS = $FFBA -SETNAM = $FFBD -OPEN = $FFC0 -CLOSE = $FFC3 -CHKIN = $FFC6 -CKOUT = $FFC9 -CLRCH = $FFCC -BASIN = $FFCF -BSOUT = $FFD2 -LOAD = $FFD5 -SAVE = $FFD8 -SETTIM = $FFDB -RDTIM = $FFDE -STOP = $FFE1 -GETIN = $FFE4 -CLALL = $FFE7 -UDTIM = $FFEA -SCREEN = $FFED -PLOT = $FFF0 -IOBASE = $FFF3 +CINT = $FF81 +IOINIT = $FF84 +RAMTAS = $FF87 +RESTOR = $FF8A +VECTOR = $FF8D +SETMSG = $FF90 +SECOND = $FF93 +TKSA = $FF96 +MEMTOP = $FF99 +MEMBOT = $FF9C +SCNKEY = $FF9F +SETTMO = $FFA2 +ACPTR = $FFA5 +CIOUT = $FFA8 +UNTLK = $FFAB +UNLSN = $FFAE +LISTEN = $FFB1 +TALK = $FFB4 +READST = $FFB7 +SETLFS = $FFBA +SETNAM = $FFBD +OPEN = $FFC0 +CLOSE = $FFC3 +CHKIN = $FFC6 +CKOUT = $FFC9 +CLRCH = $FFCC +BASIN = $FFCF +BSOUT = $FFD2 +LOAD = $FFD5 +SAVE = $FFD8 +SETTIM = $FFDB +RDTIM = $FFDE +STOP = $FFE1 +GETIN = $FFE4 +CLALL = $FFE7 +UDTIM = $FFEA +SCREEN = $FFED +PLOT = $FFF0 +IOBASE = $FFF3 diff --git a/libsrc/c128/mainargs.s b/libsrc/c128/mainargs.s index 3bacd2934..fb5fd1554 100644 --- a/libsrc/c128/mainargs.s +++ b/libsrc/c128/mainargs.s @@ -22,15 +22,15 @@ ; - The "file-name" might be a path-name; don't copy the directory-components. ; - Add a control-character quoting mechanism. - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv - .include "c128.inc" + .include "c128.inc" -MAXARGS = 10 ; Maximum number of arguments allowed -REM = $8f ; BASIC token-code -NAME_LEN = 16 ; maximum length of command-name +MAXARGS = 10 ; Maximum number of arguments allowed +REM = $8f ; BASIC token-code +NAME_LEN = 16 ; maximum length of command-name ; Get possible command-line arguments. Goes into the special INIT segment, @@ -45,27 +45,27 @@ initmainargs: ; Because the buffer, that we're copying into, was zeroed out, ; we don't need to add a NUL character. ; - ldy FNAM_LEN - cpy #NAME_LEN + 1 - bcc L1 - ldy #NAME_LEN - 1 ; limit the length + ldy FNAM_LEN + cpy #NAME_LEN + 1 + bcc L1 + ldy #NAME_LEN - 1 ; limit the length L0: lda #FNAM ; Load vector address for FETCH routine ldx FNAM_BANK ; Load bank for FETCH routine jsr INDFET ; Load byte from (FETVEC),y - sta name,y ; Save byte from filename -L1: dey - bpl L0 - inc __argc ; argc always is equal to, at least, 1 + sta name,y ; Save byte from filename +L1: dey + bpl L0 + inc __argc ; argc always is equal to, at least, 1 ; Find the "rem" token. ; - ldx #0 -L2: lda BASIC_BUF,x - beq done ; no "rem," no args. - inx - cmp #REM - bne L2 - ldy #1 * 2 + ldx #0 +L2: lda BASIC_BUF,x + beq done ; no "rem," no args. + inx + cmp #REM + bne L2 + ldy #1 * 2 ; Find the next argument @@ -91,11 +91,11 @@ setterm:sta term ; Set end of argument marker ; necessary. txa ; Get low byte - sta argv,y ; argv[y]= &arg - iny - lda #>BASIC_BUF - sta argv,y - iny + sta argv,y ; argv[y]= &arg + iny + lda #>BASIC_BUF + sta argv,y + iny inc __argc ; Found another arg ; Search for the end of the argument @@ -122,21 +122,21 @@ argloop:lda BASIC_BUF,x ; (The last vector in argv[] already is NULL.) -done: lda #argv - sta __argv - stx __argv + 1 - rts +done: lda #argv + sta __argv + stx __argv + 1 + rts ; These arrays are zeroed before initmainargs is called. -; char name[16+1]; +; char name[16+1]; ; char* argv[MAXARGS+1]={name}; ; .bss -term: .res 1 -name: .res NAME_LEN + 1 +term: .res 1 +name: .res NAME_LEN + 1 .data argv: .addr name - .res MAXARGS * 2 + .res MAXARGS * 2 diff --git a/libsrc/c128/mcbdefault.s b/libsrc/c128/mcbdefault.s index d5a91f923..cdedf4904 100644 --- a/libsrc/c128/mcbdefault.s +++ b/libsrc/c128/mcbdefault.s @@ -64,13 +64,13 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register txa adc #0 bne @L1 ; Branch if high byte not zero - lda VIC_SPR_HI_X ; Get high X bits of all sprites - and #MOUSE_SPR_NMASK ; Clear high bit for sprite + lda VIC_SPR_HI_X ; Get high X bits of all sprites + and #MOUSE_SPR_NMASK ; Clear high bit for sprite sta VIC_SPR_HI_X rts -@L1: lda VIC_SPR_HI_X ; Get high X bits of all sprites - ora #MOUSE_SPR_MASK ; Set high bit for sprite +@L1: lda VIC_SPR_HI_X ; Get high X bits of all sprites + ora #MOUSE_SPR_MASK ; Set high bit for sprite sta VIC_SPR_HI_X rts @@ -86,11 +86,11 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register ldx PALFLAG bne @L1 adc #50 ; FIXME: Should be NTSC, is PAL value - sta VIC_SPR_Y ; Set Y position + sta VIC_SPR_Y ; Set Y position rts @L1: adc #50 ; Add PAL correction - sta VIC_SPR_Y ; Set Y position + sta VIC_SPR_Y ; Set Y position rts .endproc diff --git a/libsrc/c128/mou/c128-1351.s b/libsrc/c128/mou/c128-1351.s index 999c57090..f7c74d3cb 100644 --- a/libsrc/c128/mou/c128-1351.s +++ b/libsrc/c128/mou/c128-1351.s @@ -7,7 +7,7 @@ .include "zeropage.inc" .include "mouse-kernel.inc" - .include "c128.inc" + .include "c128.inc" .macpack generic @@ -64,18 +64,18 @@ SCREEN_WIDTH = 320 .bss Vars: -OldPotX: .res 1 ; Old hw counter values -OldPotY: .res 1 +OldPotX: .res 1 ; Old hw counter values +OldPotY: .res 1 YPos: .res 2 ; Current mouse position, Y XPos: .res 2 ; Current mouse position, X -XMin: .res 2 ; X1 value of bounding box -YMin: .res 2 ; Y1 value of bounding box -XMax: .res 2 ; X2 value of bounding box -YMax: .res 2 ; Y2 value of bounding box +XMin: .res 2 ; X1 value of bounding box +YMin: .res 2 ; Y1 value of bounding box +XMax: .res 2 ; X2 value of bounding box +YMax: .res 2 ; Y2 value of bounding box -OldValue: .res 1 ; Temp for MoveCheck routine -NewValue: .res 1 ; Temp for MoveCheck routine +OldValue: .res 1 ; Temp for MoveCheck routine +NewValue: .res 1 ; Temp for MoveCheck routine ; Default values for above variables @@ -177,7 +177,7 @@ SETBOX: sta ptr1 bpl @L1 cli - rts + rts ;---------------------------------------------------------------------------- ; GETBOX: Return the mouse bounding box. The parameters are passed as they @@ -195,7 +195,7 @@ GETBOX: sta ptr1 bpl @L1 cli - rts + rts ;---------------------------------------------------------------------------- ; MOVE: Move the mouse to a new position. The position is passed as it comes @@ -219,47 +219,47 @@ MOVE: sei ; No interrupts lda (sp),y sta XPos ; New X position - jsr CMOVEX ; Move the cursor + jsr CMOVEX ; Move the cursor - cli ; Allow interrupts - rts + cli ; Allow interrupts + rts ;---------------------------------------------------------------------------- ; BUTTONS: Return the button mask in a/x. BUTTONS: - lda #$7F - sei - sta CIA1_PRA - lda CIA1_PRB ; Read joystick #0 - cli + lda #$7F + sei + sta CIA1_PRA + lda CIA1_PRB ; Read joystick #0 + cli ldx #0 - and #$1F - eor #$1F + and #$1F + eor #$1F rts ;---------------------------------------------------------------------------- ; POS: Return the mouse position in the MOUSE_POS struct pointed to by ptr1. ; No return code required. -POS: ldy #MOUSE_POS::XCOORD ; Structure offset +POS: ldy #MOUSE_POS::XCOORD ; Structure offset - sei ; Disable interrupts - lda XPos ; Transfer the position - sta (ptr1),y - lda XPos+1 - iny - sta (ptr1),y - lda YPos + sei ; Disable interrupts + lda XPos ; Transfer the position + sta (ptr1),y + lda XPos+1 iny sta (ptr1),y - lda YPos+1 - cli ; Enable interrupts + lda YPos + iny + sta (ptr1),y + lda YPos+1 + cli ; Enable interrupts iny sta (ptr1),y ; Store last byte - rts ; Done + rts ; Done ;---------------------------------------------------------------------------- ; INFO: Returns mouse position and current button mask in the MOUSE_INFO @@ -270,15 +270,15 @@ POS: ldy #MOUSE_POS::XCOORD ; Structure offset ; call _mouse_pos to initialize the struct pointer and fill the position ; fields. -INFO: jsr POS +INFO: jsr POS ; Fill in the button state - jsr BUTTONS ; Will not touch ptr1 - ldy #MOUSE_INFO::BUTTONS - sta (ptr1),y + jsr BUTTONS ; Will not touch ptr1 + ldy #MOUSE_INFO::BUTTONS + sta (ptr1),y - rts + rts ;---------------------------------------------------------------------------- ; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl @@ -297,10 +297,10 @@ IOCTL: lda # a/y) - add XPos - tay ; Remember low byte - txa - adc XPos+1 - tax + add XPos + tay ; Remember low byte + txa + adc XPos+1 + tax ; Limit the X coordinate to the bounding box - cpy XMin - sbc XMin+1 - bpl @L1 - ldy XMin - ldx XMin+1 - jmp @L2 -@L1: txa + cpy XMin + sbc XMin+1 + bpl @L1 + ldy XMin + ldx XMin+1 + jmp @L2 +@L1: txa - cpy XMax - sbc XMax+1 - bmi @L2 - ldy XMax - ldx XMax+1 -@L2: sty XPos - stx XPos+1 + cpy XMax + sbc XMax+1 + bmi @L2 + ldy XMax + ldx XMax+1 +@L2: sty XPos + stx XPos+1 ; Move the mouse pointer to the new X pos @@ -339,10 +339,10 @@ IRQ: lda SID_ADConv1 ; Get mouse X movement ; Calculate the Y movement vector -@SkipX: lda SID_ADConv2 ; Get mouse Y movement - ldy OldPotY - jsr MoveCheck ; Calculate movement - sty OldPotY +@SkipX: lda SID_ADConv2 ; Get mouse Y movement + ldy OldPotY + jsr MoveCheck ; Calculate movement + sty OldPotY ; Skip processing if nothing has changed @@ -350,32 +350,32 @@ IRQ: lda SID_ADConv1 ; Get mouse X movement ; Calculate the new Y coordinate (--> a/y) - sta OldValue - lda YPos - sub OldValue - tay - stx OldValue - lda YPos+1 - sbc OldValue - tax + sta OldValue + lda YPos + sub OldValue + tay + stx OldValue + lda YPos+1 + sbc OldValue + tax ; Limit the Y coordinate to the bounding box - cpy YMin - sbc YMin+1 - bpl @L3 - ldy YMin - ldx YMin+1 - jmp @L4 -@L3: txa + cpy YMin + sbc YMin+1 + bpl @L3 + ldy YMin + ldx YMin+1 + jmp @L4 +@L3: txa - cpy YMax - sbc YMax+1 - bmi @L4 - ldy YMax - ldx YMax+1 -@L4: sty YPos - stx YPos+1 + cpy YMax + sbc YMax+1 + bmi @L4 + ldy YMax + ldx YMax+1 +@L4: sty YPos + stx YPos+1 ; Move the mouse pointer to the new X pos @@ -391,38 +391,38 @@ IRQ: lda SID_ADConv1 ; Get mouse X movement ; ; Move check routine, called for both coordinates. ; -; Entry: y = old value of pot register -; a = current value of pot register -; Exit: y = value to use for old value -; x/a = delta value for position +; Entry: y = old value of pot register +; a = current value of pot register +; Exit: y = value to use for old value +; x/a = delta value for position ; MoveCheck: - sty OldValue - sta NewValue - ldx #$00 + sty OldValue + sta NewValue + ldx #$00 - sub OldValue ; a = mod64 (new - old) - and #%01111111 - cmp #%01000000 ; if (a > 0) - bcs @L1 ; - lsr a ; a /= 2; - beq @L2 ; if (a != 0) - ldy NewValue ; y = NewValue + sub OldValue ; a = mod64 (new - old) + and #%01111111 + cmp #%01000000 ; if (a > 0) + bcs @L1 ; + lsr a ; a /= 2; + beq @L2 ; if (a != 0) + ldy NewValue ; y = NewValue sec - rts ; return + rts ; return -@L1: ora #%11000000 ; else or in high order bits - cmp #$FF ; if (a != -1) - beq @L2 - sec - ror a ; a /= 2 - dex ; high byte = -1 (X = $FF) - ldy NewValue +@L1: ora #%11000000 ; else or in high order bits + cmp #$FF ; if (a != -1) + beq @L2 sec - rts + ror a ; a /= 2 + dex ; high byte = -1 (X = $FF) + ldy NewValue + sec + rts -@L2: txa ; A = $00 +@L2: txa ; A = $00 clc - rts + rts diff --git a/libsrc/c128/mou/c128-joy.s b/libsrc/c128/mou/c128-joy.s index 0cceaa7f1..3ac7b5ee3 100644 --- a/libsrc/c128/mou/c128-joy.s +++ b/libsrc/c128/mou/c128-joy.s @@ -6,7 +6,7 @@ .include "zeropage.inc" .include "mouse-kernel.inc" - .include "c128.inc" + .include "c128.inc" .macpack generic @@ -73,11 +73,11 @@ SCREEN_WIDTH = 320 Vars: YPos: .res 2 ; Current mouse position, Y XPos: .res 2 ; Current mouse position, X -XMin: .res 2 ; X1 value of bounding box -YMin: .res 2 ; Y1 value of bounding box -XMax: .res 2 ; X2 value of bounding box -YMax: .res 2 ; Y2 value of bounding box -Buttons: .res 1 ; Button mask +XMin: .res 2 ; X1 value of bounding box +YMin: .res 2 ; Y1 value of bounding box +XMax: .res 2 ; X2 value of bounding box +YMax: .res 2 ; Y2 value of bounding box +Buttons: .res 1 ; Button mask ; Temporary value used in the int handler @@ -94,7 +94,7 @@ Temp: .res 1 .word 0 ; YMin .word SCREEN_WIDTH ; XMax .word SCREEN_HEIGHT ; YMax - .byte 0 ; Buttons + .byte 0 ; Buttons .endproc .code @@ -183,7 +183,7 @@ SETBOX: sta ptr1 bpl @L1 cli - rts + rts ;---------------------------------------------------------------------------- ; GETBOX: Return the mouse bounding box. The parameters are passed as they @@ -201,7 +201,7 @@ GETBOX: sta ptr1 bpl @L1 cli - rts + rts ;---------------------------------------------------------------------------- ; MOVE: Move the mouse to a new position. The position is passed as it comes @@ -225,41 +225,41 @@ MOVE: sei ; No interrupts lda (sp),y sta XPos ; New X position - jsr CMOVEX ; Move the cursor + jsr CMOVEX ; Move the cursor - cli ; Allow interrupts - rts + cli ; Allow interrupts + rts ;---------------------------------------------------------------------------- ; BUTTONS: Return the button mask in a/x. BUTTONS: - lda Buttons - ldx #$00 - rts + lda Buttons + ldx #$00 + rts ;---------------------------------------------------------------------------- ; POS: Return the mouse position in the MOUSE_POS struct pointed to by ptr1. ; No return code required. -POS: ldy #MOUSE_POS::XCOORD ; Structure offset +POS: ldy #MOUSE_POS::XCOORD ; Structure offset - sei ; Disable interrupts - lda XPos ; Transfer the position - sta (ptr1),y - lda XPos+1 - iny - sta (ptr1),y - lda YPos + sei ; Disable interrupts + lda XPos ; Transfer the position + sta (ptr1),y + lda XPos+1 iny sta (ptr1),y - lda YPos+1 - cli ; Enable interrupts + lda YPos + iny + sta (ptr1),y + lda YPos+1 + cli ; Enable interrupts iny sta (ptr1),y ; Store last byte - rts ; Done + rts ; Done ;---------------------------------------------------------------------------- ; INFO: Returns mouse position and current button mask in the MOUSE_INFO @@ -270,15 +270,15 @@ POS: ldy #MOUSE_POS::XCOORD ; Structure offset ; call _mouse_pos to initialize the struct pointer and fill the position ; fields. -INFO: jsr POS +INFO: jsr POS ; Fill in the button state - lda Buttons - ldy #MOUSE_INFO::BUTTONS - sta (ptr1),y + lda Buttons + ldy #MOUSE_INFO::BUTTONS + sta (ptr1),y - rts + rts ;---------------------------------------------------------------------------- ; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl @@ -297,11 +297,11 @@ IOCTL: lda # a/y) @AddX: add XPos - tay ; Remember low byte - txa - adc XPos+1 - tax + tay ; Remember low byte + txa + adc XPos+1 + tax ; Limit the X coordinate to the bounding box - cpy XMin - sbc XMin+1 - bpl @L1 - ldy XMin - ldx XMin+1 - jmp @L2 -@L1: txa + cpy XMin + sbc XMin+1 + bpl @L1 + ldy XMin + ldx XMin+1 + jmp @L2 +@L1: txa - cpy XMax - sbc XMax+1 - bmi @L2 - ldy XMax - ldx XMax+1 -@L2: sty XPos - stx XPos+1 + cpy XMax + sbc XMax+1 + bmi @L2 + ldy XMax + ldx XMax+1 +@L2: sty XPos + stx XPos+1 ; Move the mouse pointer to the new X pos @@ -363,45 +363,45 @@ IRQ: lda #$7F ; Calculate the Y movement vector @SkipX: lda Temp ; Read joystick #0 - and #(JOY::UP | JOY::DOWN) ; Check up/down - beq @SkipY ; + and #(JOY::UP | JOY::DOWN) ; Check up/down + beq @SkipY ; ; We will cheat here and rely on the fact that either the up, OR the down ; bit can be active - lsr a ; Check UP bit - bcc @Down - lda #$FF - tax - bne @AddY -@Down: lda #$01 - ldx #$00 + lsr a ; Check UP bit + bcc @Down + lda #$FF + tax + bne @AddY +@Down: lda #$01 + ldx #$00 ; Calculate the new Y coordinate (--> a/y) -@AddY: add YPos - tay ; Remember low byte - txa - adc YPos+1 - tax +@AddY: add YPos + tay ; Remember low byte + txa + adc YPos+1 + tax ; Limit the Y coordinate to the bounding box - cpy YMin - sbc YMin+1 - bpl @L3 - ldy YMin - ldx YMin+1 - jmp @L4 -@L3: txa + cpy YMin + sbc YMin+1 + bpl @L3 + ldy YMin + ldx YMin+1 + jmp @L4 +@L3: txa - cpy YMax - sbc YMax+1 - bmi @L4 - ldy YMax - ldx YMax+1 -@L4: sty YPos - stx YPos+1 + cpy YMax + sbc YMax+1 + bmi @L4 + ldy YMax + ldx YMax+1 +@L4: sty YPos + stx YPos+1 ; Move the mouse pointer to the new X pos diff --git a/libsrc/c128/mou/c128-pot.s b/libsrc/c128/mou/c128-pot.s index c6f7a1f86..2713e3f4f 100644 --- a/libsrc/c128/mou/c128-pot.s +++ b/libsrc/c128/mou/c128-pot.s @@ -5,59 +5,59 @@ ; Stefan Haubenthal, 2006-08-20 ; - .include "zeropage.inc" - .include "mouse-kernel.inc" - .include "c128.inc" + .include "zeropage.inc" + .include "mouse-kernel.inc" + .include "c128.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ ; Header. Includes jump table -.segment "JUMPTABLE" +.segment "JUMPTABLE" HEADER: ; Driver signature - .byte $6d, $6f, $75 ; "mou" - .byte MOUSE_API_VERSION ; Mouse driver API version number + .byte $6d, $6f, $75 ; "mou" + .byte MOUSE_API_VERSION ; Mouse driver API version number ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr HIDE - .addr SHOW - .addr SETBOX + .addr INSTALL + .addr UNINSTALL + .addr HIDE + .addr SHOW + .addr SETBOX .addr GETBOX - .addr MOVE - .addr BUTTONS - .addr POS - .addr INFO - .addr IOCTL - .addr IRQ + .addr MOVE + .addr BUTTONS + .addr POS + .addr INFO + .addr IOCTL + .addr IRQ ; Callback table, set by the kernel before INSTALL is called -CHIDE: jmp $0000 ; Hide the cursor -CSHOW: jmp $0000 ; Show the cursor -CMOVEX: jmp $0000 ; Move the cursor to X coord -CMOVEY: jmp $0000 ; Move the cursor to Y coord +CHIDE: jmp $0000 ; Hide the cursor +CSHOW: jmp $0000 ; Show the cursor +CMOVEX: jmp $0000 ; Move the cursor to X coord +CMOVEY: jmp $0000 ; Move the cursor to Y coord ;---------------------------------------------------------------------------- ; Constants -SCREEN_HEIGHT = 200 -SCREEN_WIDTH = 320 +SCREEN_HEIGHT = 200 +SCREEN_WIDTH = 320 -.enum JOY - UP = $01 - DOWN = $02 - LEFT = $04 - RIGHT = $08 - FIRE = $10 +.enum JOY + UP = $01 + DOWN = $02 + LEFT = $04 + RIGHT = $08 + FIRE = $10 .endenum ;---------------------------------------------------------------------------- @@ -68,30 +68,30 @@ SCREEN_WIDTH = 320 .bss Vars: -YPos: .res 2 ; Current mouse position, Y -XPos: .res 2 ; Current mouse position, X -XMin: .res 2 ; X1 value of bounding box -YMin: .res 2 ; Y1 value of bounding box -XMax: .res 2 ; X2 value of bounding box -YMax: .res 2 ; Y2 value of bounding box -Buttons: .res 1 ; Button mask +YPos: .res 2 ; Current mouse position, Y +XPos: .res 2 ; Current mouse position, X +XMin: .res 2 ; X1 value of bounding box +YMin: .res 2 ; Y1 value of bounding box +XMax: .res 2 ; X2 value of bounding box +YMax: .res 2 ; Y2 value of bounding box +Buttons: .res 1 ; Button mask ; Temporary value used in the int handler -Temp: .res 1 +Temp: .res 1 ; Default values for above variables .rodata -.proc DefVars - .word SCREEN_HEIGHT/2 ; YPos - .word SCREEN_WIDTH/2 ; XPos - .word 0 ; XMin - .word 0 ; YMin - .word SCREEN_WIDTH ; XMax - .word SCREEN_HEIGHT ; YMax - .byte 0 ; Buttons +.proc DefVars + .word SCREEN_HEIGHT/2 ; YPos + .word SCREEN_WIDTH/2 ; XPos + .word 0 ; XMin + .word 0 ; YMin + .word SCREEN_WIDTH ; XMax + .word SCREEN_HEIGHT ; YMax + .byte 0 ; Buttons .endproc .code @@ -105,37 +105,37 @@ INSTALL: ; Initialize variables. Just copy the default stuff over - ldx #.sizeof(DefVars)-1 -@L1: lda DefVars,x - sta Vars,x - dex - bpl @L1 + ldx #.sizeof(DefVars)-1 +@L1: lda DefVars,x + sta Vars,x + dex + bpl @L1 ; Be sure the mouse cursor is invisible and at the default location. We ; need to do that here, because our mouse interrupt handler doesn't set the ; mouse position if it hasn't changed. - sei - jsr CHIDE - lda XPos - ldx XPos+1 - jsr CMOVEX - lda YPos - ldx YPos+1 - jsr CMOVEY - cli + sei + jsr CHIDE + lda XPos + ldx XPos+1 + jsr CMOVEX + lda YPos + ldx YPos+1 + jsr CMOVEY + cli ; Done, return zero (= MOUSE_ERR_OK) - ldx #$00 - txa - rts + ldx #$00 + txa + rts ;---------------------------------------------------------------------------- ; UNINSTALL routine. Is called before the driver is removed from memory. ; No return code required (the driver is removed from memory on return). -UNINSTALL = HIDE ; Hide cursor on exit +UNINSTALL = HIDE ; Hide cursor on exit ;---------------------------------------------------------------------------- ; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages @@ -144,10 +144,10 @@ UNINSTALL = HIDE ; Hide cursor on exit ; no special action is required besides hiding the mouse cursor. ; No return code required. -HIDE: sei - jsr CHIDE - cli - rts +HIDE: sei + jsr CHIDE + cli + rts ;---------------------------------------------------------------------------- ; SHOW routine. Is called to show the mouse pointer. The mouse kernel manages @@ -156,10 +156,10 @@ HIDE: sei ; no special action is required besides enabling the mouse cursor. ; No return code required. -SHOW: sei - jsr CSHOW - cli - rts +SHOW: sei + jsr CSHOW + cli + rts ;---------------------------------------------------------------------------- ; SETBOX: Set the mouse bounding box. The parameters are passed as they come @@ -180,7 +180,7 @@ SETBOX: sta ptr1 bpl @L1 cli - rts + rts ;---------------------------------------------------------------------------- ; GETBOX: Return the mouse bounding box. The parameters are passed as they @@ -198,7 +198,7 @@ GETBOX: sta ptr1 bpl @L1 cli - rts + rts ;---------------------------------------------------------------------------- ; MOVE: Move the mouse to a new position. The position is passed as it comes @@ -208,55 +208,55 @@ GETBOX: sta ptr1 ; the screen). No return code required. ; -MOVE: sei ; No interrupts +MOVE: sei ; No interrupts - sta YPos - stx YPos+1 ; New Y position - jsr CMOVEY ; Set it + sta YPos + stx YPos+1 ; New Y position + jsr CMOVEY ; Set it - ldy #$01 - lda (sp),y - sta XPos+1 - tax - dey - lda (sp),y - sta XPos ; New X position + ldy #$01 + lda (sp),y + sta XPos+1 + tax + dey + lda (sp),y + sta XPos ; New X position - jsr CMOVEX ; Move the cursor + jsr CMOVEX ; Move the cursor - cli ; Allow interrupts - rts + cli ; Allow interrupts + rts ;---------------------------------------------------------------------------- ; BUTTONS: Return the button mask in a/x. BUTTONS: - lda Buttons - ldx #$00 - rts + lda Buttons + ldx #$00 + rts ;---------------------------------------------------------------------------- ; POS: Return the mouse position in the MOUSE_POS struct pointed to by ptr1. ; No return code required. -POS: ldy #MOUSE_POS::XCOORD ; Structure offset +POS: ldy #MOUSE_POS::XCOORD ; Structure offset - sei ; Disable interrupts - lda XPos ; Transfer the position - sta (ptr1),y - lda XPos+1 - iny - sta (ptr1),y - lda YPos - iny - sta (ptr1),y - lda YPos+1 - cli ; Enable interrupts + sei ; Disable interrupts + lda XPos ; Transfer the position + sta (ptr1),y + lda XPos+1 + iny + sta (ptr1),y + lda YPos + iny + sta (ptr1),y + lda YPos+1 + cli ; Enable interrupts - iny - sta (ptr1),y ; Store last byte + iny + sta (ptr1),y ; Store last byte - rts ; Done + rts ; Done ;---------------------------------------------------------------------------- ; INFO: Returns mouse position and current button mask in the MOUSE_INFO @@ -267,15 +267,15 @@ POS: ldy #MOUSE_POS::XCOORD ; Structure offset ; call _mouse_pos to initialize the struct pointer and fill the position ; fields. -INFO: jsr POS +INFO: jsr POS ; Fill in the button state - lda Buttons - ldy #MOUSE_INFO::BUTTONS - sta (ptr1),y + lda Buttons + ldy #MOUSE_INFO::BUTTONS + sta (ptr1),y - rts + rts ;---------------------------------------------------------------------------- ; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl @@ -283,108 +283,108 @@ INFO: jsr POS ; Must return an error code in a/x. ; -IOCTL: lda #MOUSE_ERR_INV_IOCTL - rts +IOCTL: lda #MOUSE_ERR_INV_IOCTL + rts ;---------------------------------------------------------------------------- ; IRQ: Irq handler entry point. Called as a subroutine but in IRQ context ; (so be careful). ; -IRQ: lda #$7F - sta CIA1_PRA - lda CIA1_PRB ; Read port #1 - and #%00001100 - eor #%00001100 ; Make all bits active high - asl - sta Buttons - lsr - lsr - lsr - and #%00000001 - ora Buttons - sta Buttons - ldx #%01000000 - stx CIA1_PRA - ldy #0 -: dey - bne :- - ldx SID_ADConv1 - stx XPos - ldx SID_ADConv2 - stx YPos +IRQ: lda #$7F + sta CIA1_PRA + lda CIA1_PRB ; Read port #1 + and #%00001100 + eor #%00001100 ; Make all bits active high + asl + sta Buttons + lsr + lsr + lsr + and #%00000001 + ora Buttons + sta Buttons + ldx #%01000000 + stx CIA1_PRA + ldy #0 +: dey + bne :- + ldx SID_ADConv1 + stx XPos + ldx SID_ADConv2 + stx YPos - lda #$FF - tax - bne @AddX ; Branch always - lda #$01 - ldx #$00 + lda #$FF + tax + bne @AddX ; Branch always + lda #$01 + ldx #$00 ; Calculate the new X coordinate (--> a/y) -@AddX: add XPos - tay ; Remember low byte - txa - adc XPos+1 - tax +@AddX: add XPos + tay ; Remember low byte + txa + adc XPos+1 + tax ; Limit the X coordinate to the bounding box - cpy XMin - sbc XMin+1 - bpl @L1 - ldy XMin - ldx XMin+1 - jmp @L2 -@L1: txa + cpy XMin + sbc XMin+1 + bpl @L1 + ldy XMin + ldx XMin+1 + jmp @L2 +@L1: txa - cpy XMax - sbc XMax+1 - bmi @L2 - ldy XMax - ldx XMax+1 -@L2: sty XPos - stx XPos+1 + cpy XMax + sbc XMax+1 + bmi @L2 + ldy XMax + ldx XMax+1 +@L2: sty XPos + stx XPos+1 ; Move the mouse pointer to the new X pos - tya - jsr CMOVEX + tya + jsr CMOVEX - lda #$FF - tax - bne @AddY -@Down: lda #$01 - ldx #$00 + lda #$FF + tax + bne @AddY +@Down: lda #$01 + ldx #$00 ; Calculate the new Y coordinate (--> a/y) -@AddY: add YPos - tay ; Remember low byte - txa - adc YPos+1 - tax +@AddY: add YPos + tay ; Remember low byte + txa + adc YPos+1 + tax ; Limit the Y coordinate to the bounding box - cpy YMin - sbc YMin+1 - bpl @L3 - ldy YMin - ldx YMin+1 - jmp @L4 -@L3: txa + cpy YMin + sbc YMin+1 + bpl @L3 + ldy YMin + ldx YMin+1 + jmp @L4 +@L3: txa - cpy YMax - sbc YMax+1 - bmi @L4 - ldy YMax - ldx YMax+1 -@L4: sty YPos - stx YPos+1 + cpy YMax + sbc YMax+1 + bmi @L4 + ldy YMax + ldx YMax+1 +@L4: sty YPos + stx YPos+1 ; Move the mouse pointer to the new X pos - tya - jmp CMOVEY + tya + jmp CMOVEY diff --git a/libsrc/c128/mouse_stat_stddrv.s b/libsrc/c128/mouse_stat_stddrv.s index 24f40a54f..29f2c6392 100644 --- a/libsrc/c128/mouse_stat_stddrv.s +++ b/libsrc/c128/mouse_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void mouse_static_stddrv[]; ; - .export _mouse_static_stddrv - .import _c128_1351_mou + .export _mouse_static_stddrv + .import _c128_1351_mou .rodata diff --git a/libsrc/c128/mouse_stddrv.s b/libsrc/c128/mouse_stddrv.s index 09c607ea3..a9777a057 100644 --- a/libsrc/c128/mouse_stddrv.s +++ b/libsrc/c128/mouse_stddrv.s @@ -6,10 +6,10 @@ ; const char mouse_stddrv[]; ; - .export _mouse_stddrv + .export _mouse_stddrv .rodata -_mouse_stddrv: .asciiz "c128-1351.mou" +_mouse_stddrv: .asciiz "c128-1351.mou" diff --git a/libsrc/c128/randomize.s b/libsrc/c128/randomize.s index a4599e97b..5c57e04be 100644 --- a/libsrc/c128/randomize.s +++ b/libsrc/c128/randomize.s @@ -5,10 +5,10 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand - .include "c128.inc" + .include "c128.inc" __randomize: ldx VIC_HLINE ; Use VIC rasterline as high byte diff --git a/libsrc/c128/revers.s b/libsrc/c128/revers.s index f722c84a8..f19400b9a 100644 --- a/libsrc/c128/revers.s +++ b/libsrc/c128/revers.s @@ -4,24 +4,24 @@ ; unsigned char revers (unsigned char onoff); ; - .export _revers + .export _revers .include "c128.inc" .proc _revers - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value - ldy #$00 ; Assume old value is zero -L1: lda RVS ; Load old value - stx RVS ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value + ldy #$00 ; Assume old value is zero +L1: lda RVS ; Load old value + stx RVS ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts .endproc diff --git a/libsrc/c128/ser/c128-swlink.s b/libsrc/c128/ser/c128-swlink.s index 558d80db8..347452e85 100644 --- a/libsrc/c128/ser/c128-swlink.s +++ b/libsrc/c128/ser/c128-swlink.s @@ -24,7 +24,7 @@ .include "zeropage.inc" .include "ser-kernel.inc" .include "ser-error.inc" - .include "c128.inc" + .include "c128.inc" ; ------------------------------------------------------------------------ @@ -47,12 +47,12 @@ .word PUT .word STATUS .word IOCTL - .word IRQ + .word IRQ ;---------------------------------------------------------------------------- ; I/O definitions -ACIA = $DE00 +ACIA = $DE00 ACIA_DATA = ACIA+0 ; Data register ACIA_STATUS = ACIA+1 ; Status register ACIA_CMD = ACIA+2 ; Command register @@ -137,11 +137,11 @@ NmiStubOrig := * .org $1150 ; BASIC graphics area .proc NmiStub - lda #MMU_CFG_CC65 ; Bank 0 with kernal ROM... - sta MMU_CR ; ...enable + lda #MMU_CFG_CC65 ; Bank 0 with kernal ROM... + sta MMU_CR ; ...enable jsr NmiHandler ; Call the actual NMI handler - lda #$00 ; Get ROM config... - sta MMU_CR ; ...and enable it + lda #$00 ; Get ROM config... + sta MMU_CR ; ...and enable it Vector := *+1 .byte $4C ; Jump to the saved IRQ vector @@ -157,8 +157,8 @@ INSTALL: ; Deactivate DTR and disable 6551 interrupts - lda #%00001010 - sta ACIA_CMD + lda #%00001010 + sta ACIA_CMD ; Copy the NMI stub into low memory @@ -170,20 +170,20 @@ INSTALL: ; Set up the nmi vector - lda NMIVec - ldy NMIVec+1 - sta NmiStub::Vector+0 - sty NmiStub::Vector+1 - lda #NmiStub -SetNMI: sta NMIVec - sty NMIVec+1 + lda NMIVec + ldy NMIVec+1 + sta NmiStub::Vector+0 + sty NmiStub::Vector+1 + lda #NmiStub +SetNMI: sta NMIVec + sty NMIVec+1 ; Done, return an error code lda #SER_ERR_INIT_FAILED - rts + lda #SER_ERR_INIT_FAILED + rts ; Baud rate not available @@ -285,8 +285,8 @@ CLOSE: ; Stop interrupts, drop DTR - lda #%00001010 - sta ACIA_CMD + lda #%00001010 + sta ACIA_CMD ; Initalize buffers. Returns zero in a @@ -296,7 +296,7 @@ CLOSE: lda #SER_ERR_NO_DATA - rts +@L1: lda RecvFreeCnt ; (25) + cmp #$ff + bne @L2 + lda #SER_ERR_NO_DATA + rts ; Check for flow stopped & enough free: release flow control -@L2: ldx Stopped ; (34) - beq @L3 - cmp #63 - bcc @L3 - lda #$00 - sta Stopped - lda RtsOff - ora #%00001000 - sta ACIA_CMD +@L2: ldx Stopped ; (34) + beq @L3 + cmp #63 + bcc @L3 + lda #$00 + sta Stopped + lda RtsOff + ora #%00001000 + sta ACIA_CMD ; Get byte from buffer -@L3: ldx RecvHead ; (41) - lda RecvBuf,x - inc RecvHead - inc RecvFreeCnt - ldx #$00 ; (59) - sta (ptr1,x) - txa ; Return code = 0 - rts +@L3: ldx RecvHead ; (41) + lda RecvBuf,x + inc RecvHead + inc RecvFreeCnt + ldx #$00 ; (59) + sta (ptr1,x) + txa ; Return code = 0 + rts ;---------------------------------------------------------------------------- ; PUT: Output character in A. @@ -351,40 +351,40 @@ PUT: ; Try to send - ldx SendFreeCnt - inx ; X = $ff? - beq @L2 - pha - lda #$00 - jsr TryToSend - pla + ldx SendFreeCnt + inx ; X = $ff? + beq @L2 + pha + lda #$00 + jsr TryToSend + pla ; Put byte into send buffer & send -@L2: ldx SendFreeCnt - bne @L3 - lda #TM - jmp _mktime + lda CIA1_TODHR + bpl AM + and #%01111111 + sed + clc + adc #$12 + cld +AM: jsr BCD2dec + sta TM + tm::tm_hour + lda CIA1_TODMIN + jsr BCD2dec + sta TM + tm::tm_min + lda CIA1_TODSEC + jsr BCD2dec + sta TM + tm::tm_sec + lda CIA1_TOD10 ; Dummy read to unfreeze + lda #TM + jmp _mktime ; dec = (((BCD>>4)*10) + (BCD&0xf)) BCD2dec:tax - and #%00001111 - sta tmp1 - txa + and #%00001111 + sta tmp1 + txa and #%11110000 ; *16 lsr ; *8 sta tmp2 @@ -68,13 +68,13 @@ BCD2dec:tax lda CIA1_TOD10 sta CIA1_TOD10 - jsr _get_tv - cmp #TV::PAL - bne @60Hz - lda CIA1_CRA - ora #$80 - sta CIA1_CRA -@60Hz: rts + jsr _get_tv + cmp #TV::PAL + bne @60Hz + lda CIA1_CRA + ora #$80 + sta CIA1_CRA +@60Hz: rts .endproc @@ -83,7 +83,7 @@ BCD2dec:tax ; TM struct with date set to 1970-01-01 .data -TM: .word 0 ; tm_sec +TM: .word 0 ; tm_sec .word 0 ; tm_min .word 0 ; tm_hour .word 1 ; tm_mday diff --git a/libsrc/c128/tgi/c128-vdc.s b/libsrc/c128/tgi/c128-vdc.s index e497a5942..226d2aea2 100644 --- a/libsrc/c128/tgi/c128-vdc.s +++ b/libsrc/c128/tgi/c128-vdc.s @@ -20,9 +20,9 @@ ; Register 25 ($19) is said to require different value for VDC v1, but I ; couldn't find what it should be. - .include "zeropage.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" .include "tgi-error.inc" @@ -31,19 +31,19 @@ ; ------------------------------------------------------------------------ ; Constants -VDC_ADDR_REG = $D600 ; VDC address -VDC_DATA_REG = $D601 ; VDC data +VDC_ADDR_REG = $D600 ; VDC address +VDC_DATA_REG = $D601 ; VDC data -VDC_DSP_HI = 12 ; registers used -VDC_DSP_LO = 13 -VDC_DATA_HI = 18 -VDC_DATA_LO = 19 -VDC_VSCROLL = 24 -VDC_HSCROLL = 25 -VDC_COLORS = 26 -VDC_CSET = 28 -VDC_COUNT = 30 -VDC_DATA = 31 +VDC_DSP_HI = 12 ; registers used +VDC_DSP_LO = 13 +VDC_DATA_HI = 18 +VDC_DATA_LO = 19 +VDC_VSCROLL = 24 +VDC_HSCROLL = 25 +VDC_COLORS = 26 +VDC_CSET = 28 +VDC_COUNT = 30 +VDC_DATA = 31 ; ------------------------------------------------------------------------ ; Header. Includes jump table and constants. @@ -58,7 +58,7 @@ VDC_DATA = 31 xres: .word 640 ; X resolution yres: .word 200 ; Y resolution .byte 2 ; Number of drawing colors -pages: .byte 1 ; Number of screens available +pages: .byte 1 ; Number of screens available .byte 8 ; System font X size .byte 8 ; System font Y size .word $006A ; Aspect ratio (based on 4/3 display) @@ -71,7 +71,7 @@ pages: .byte 1 ; Number of screens available .addr UNINSTALL .addr INIT .addr DONE - .addr GETERROR + .addr GETERROR .addr CONTROL .addr CLEAR .addr SETVIEWPAGE @@ -99,23 +99,23 @@ Y1 = ptr2 X2 = ptr3 Y2 = ptr4 -ADDR = tmp1 -TEMP = tmp3 -TEMP2 = tmp4 ; HORLINE -TEMP3 = sreg ; HORLINE +ADDR = tmp1 +TEMP = tmp3 +TEMP2 = tmp4 ; HORLINE +TEMP3 = sreg ; HORLINE ; Absolute variables used in the code .bss -SCRBASE: .res 1 ; High byte of screen base +SCRBASE: .res 1 ; High byte of screen base -ERROR: .res 1 ; Error code +ERROR: .res 1 ; Error code PALETTE: .res 2 ; The current palette BITMASK: .res 1 ; $00 = clear, $FF = set pixels -OLDCOLOR: .res 1 ; colors before entering gfx mode +OLDCOLOR: .res 1 ; colors before entering gfx mode ; Text output stuff TEXTMAGX: .res 1 @@ -131,25 +131,25 @@ PALETTESIZE = * - DEFPALETTE BITTAB: .byte $80,$40,$20,$10,$08,$04,$02,$01 -BITMASKL: .byte %11111111, %01111111, %00111111, %00011111 - .byte %00001111, %00000111, %00000011, %00000001 +BITMASKL: .byte %11111111, %01111111, %00111111, %00011111 + .byte %00001111, %00000111, %00000011, %00000001 -BITMASKR: .byte %10000000, %11000000, %11100000, %11110000 - .byte %11111000, %11111100, %11111110, %11111111 +BITMASKR: .byte %10000000, %11000000, %11100000, %11110000 + .byte %11111000, %11111100, %11111110, %11111111 ; color translation table (indexed by VIC color) -COLTRANS: .byte $00, $0f, $08, $06, $0a, $04, $02, $0c - .byte $0d, $0b, $09, $01, $0e, $05, $03, $07 - ; colors BROWN and GRAY3 are wrong +COLTRANS: .byte $00, $0f, $08, $06, $0a, $04, $02, $0c + .byte $0d, $0b, $09, $01, $0e, $05, $03, $07 + ; colors BROWN and GRAY3 are wrong ; VDC initialization table (reg),(val),...,$ff InitVDCTab: - .byte VDC_DSP_HI, 0 ; viewpage 0 as default - .byte VDC_DSP_LO, 0 - .byte VDC_HSCROLL, $87 - .byte $ff + .byte VDC_DSP_HI, 0 ; viewpage 0 as default + .byte VDC_DSP_LO, 0 + .byte VDC_HSCROLL, $87 + .byte $ff -SCN80CLR: .byte 27,88,147,27,88,0 +SCN80CLR: .byte 27,88,147,27,88,0 .code @@ -162,78 +162,78 @@ SCN80CLR: .byte 27,88,147,27,88,0 ; INSTALL: - ; check for VDC version and update register $19 value + ; check for VDC version and update register $19 value - ; check for VDC ram size and update number of available screens + ; check for VDC ram size and update number of available screens - ldx #VDC_CSET ; determine size of RAM... - jsr VDCReadReg - sta tmp1 - ora #%00010000 - jsr VDCWriteReg ; turn on 64k + ldx #VDC_CSET ; determine size of RAM... + jsr VDCReadReg + sta tmp1 + ora #%00010000 + jsr VDCWriteReg ; turn on 64k - jsr settestadr1 ; save original value of test byte - jsr VDCReadByte - sta tmp2 + jsr settestadr1 ; save original value of test byte + jsr VDCReadByte + sta tmp2 - lda #$55 ; write $55 here - ldy #ptr1 - jsr test64k ; read it here and there - lda #$aa ; write $aa here - ldy #ptr2 - jsr test64k ; read it here and there + lda #$55 ; write $55 here + ldy #ptr1 + jsr test64k ; read it here and there + lda #$aa ; write $aa here + ldy #ptr2 + jsr test64k ; read it here and there - jsr settestadr1 - lda tmp2 - jsr VDCWriteByte ; restore original value of test byte + jsr settestadr1 + lda tmp2 + jsr VDCWriteByte ; restore original value of test byte - lda ptr1 ; do bytes match? - cmp ptr1+1 - bne @have64k - lda ptr2 - cmp ptr2+1 - bne @have64k + lda ptr1 ; do bytes match? + cmp ptr1+1 + bne @have64k + lda ptr2 + cmp ptr2+1 + bne @have64k - ldx #VDC_CSET - lda tmp1 - jsr VDCWriteReg ; restore 16/64k flag - jmp @endok ; and leave default values for 16k + ldx #VDC_CSET + lda tmp1 + jsr VDCWriteReg ; restore 16/64k flag + jmp @endok ; and leave default values for 16k @have64k: - lda #4 - sta pages + lda #4 + sta pages @endok: - lda #0 - sta SCRBASE ; draw page 0 as default + lda #0 + sta SCRBASE ; draw page 0 as default rts test64k: - sta tmp1 - sty ptr3 - lda #0 - sta ptr3+1 - jsr settestadr1 - lda tmp1 - jsr VDCWriteByte ; write $55 - jsr settestadr1 - jsr VDCReadByte ; read here - pha - jsr settestadr2 - jsr VDCReadByte ; and there - ldy #1 - sta (ptr3),y - pla - dey - sta (ptr3),y - rts + sta tmp1 + sty ptr3 + lda #0 + sta ptr3+1 + jsr settestadr1 + lda tmp1 + jsr VDCWriteByte ; write $55 + jsr settestadr1 + jsr VDCReadByte ; read here + pha + jsr settestadr2 + jsr VDCReadByte ; and there + ldy #1 + sta (ptr3),y + pla + dey + sta (ptr3),y + rts settestadr1: - ldy #$02 ; test page 2 (here) - .byte $2c + ldy #$02 ; test page 2 (here) + .byte $2c settestadr2: - ldy #$42 ; or page 64+2 (there) - lda #0 - jmp VDCSetSourceAddr + ldy #$42 ; or page 64+2 (there) + lda #0 + jmp VDCSetSourceAddr ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. May @@ -268,20 +268,20 @@ INIT: stx BITMASK ; Remeber current color value - ldx #VDC_COLORS - jsr VDCReadReg - sta OLDCOLOR + ldx #VDC_COLORS + jsr VDCReadReg + sta OLDCOLOR ; Switch into graphics mode (set view page 0) - ldy #0 -@L2: ldx InitVDCTab,y - bmi @L3 - iny - lda InitVDCTab,y - jsr VDCWriteReg - iny - bne @L2 + ldy #0 +@L2: ldx InitVDCTab,y + bmi @L3 + iny + lda InitVDCTab,y + jsr VDCWriteReg + iny + bne @L2 @L3: ; Done, reset the error code @@ -299,35 +299,35 @@ INIT: ; DONE: - ; This part is C128-mode specific - jsr $e179 ; reload character set and setup VDC - jsr $ff62 - lda $d7 ; in 80-columns? - bne @L01 -@L0: lda SCN80CLR,y - beq @L1 - jsr $ffd2 ; print \xe,clr,\xe - iny - bne @L0 -@L01: lda #147 - jsr $ffd2 ; print clr -@L1: lda #0 ; restore view page - ldx #VDC_DSP_HI - jsr VDCWriteReg - lda OLDCOLOR - ldx #VDC_COLORS - jsr VDCWriteReg ; restore color (background) - lda #$47 - ldx #VDC_HSCROLL - jmp VDCWriteReg ; switch to text screen + ; This part is C128-mode specific + jsr $e179 ; reload character set and setup VDC + jsr $ff62 + lda $d7 ; in 80-columns? + bne @L01 +@L0: lda SCN80CLR,y + beq @L1 + jsr $ffd2 ; print \xe,clr,\xe + iny + bne @L0 +@L01: lda #147 + jsr $ffd2 ; print clr +@L1: lda #0 ; restore view page + ldx #VDC_DSP_HI + jsr VDCWriteReg + lda OLDCOLOR + ldx #VDC_COLORS + jsr VDCWriteReg ; restore color (background) + lda #$47 + ldx #VDC_HSCROLL + jmp VDCWriteReg ; switch to text screen ; ------------------------------------------------------------------------ ; GETERROR: Return the error code in A and clear it. GETERROR: - ldx #TGI_ERR_OK - lda ERROR - stx ERROR + ldx #TGI_ERR_OK + lda ERROR + stx ERROR rts ; ------------------------------------------------------------------------ @@ -337,8 +337,8 @@ GETERROR: ; CONTROL: - lda #TGI_ERR_INV_FUNC - sta ERROR + lda #TGI_ERR_INV_FUNC + sta ERROR rts ; ------------------------------------------------------------------------ @@ -348,22 +348,22 @@ CONTROL: ; CLEAR: - lda #0 - ldy SCRBASE - jsr VDCSetSourceAddr - lda #0 - ldx #VDC_VSCROLL - jsr VDCWriteReg ; set fill mode - lda #0 - jsr VDCWriteByte ; put 1rst byte (fill value) - ldy #62 ; 62 times - lda #0 ; 256 bytes - ldx #VDC_COUNT -@L1: jsr VDCWriteReg - dey - bne @L1 - lda #127 - jmp VDCWriteReg ; 1+62*256+127=16000=(640*256)/8 + lda #0 + ldy SCRBASE + jsr VDCSetSourceAddr + lda #0 + ldx #VDC_VSCROLL + jsr VDCWriteReg ; set fill mode + lda #0 + jsr VDCWriteByte ; put 1rst byte (fill value) + ldy #62 ; 62 times + lda #0 ; 256 bytes + ldx #VDC_COUNT +@L1: jsr VDCWriteReg + dey + bne @L1 + lda #127 + jmp VDCWriteReg ; 1+62*256+127=16000=(640*256)/8 ; ------------------------------------------------------------------------ ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). @@ -373,12 +373,12 @@ CLEAR: ; SETVIEWPAGE: - clc - ror - ror - ror - ldx #VDC_DSP_HI - jmp VDCWriteReg + clc + ror + ror + ror + ldx #VDC_DSP_HI + jmp VDCWriteReg ; ------------------------------------------------------------------------ ; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n). @@ -388,12 +388,12 @@ SETVIEWPAGE: ; SETDRAWPAGE: - clc - ror - ror - ror - sta SCRBASE - rts + clc + ror + ror + ror + sta SCRBASE + rts ; ------------------------------------------------------------------------ ; SETCOLOR: Set the drawing color (in A). The new color is already checked @@ -428,16 +428,16 @@ SETPALETTE: ; Get the color entries from the palette ldy PALETTE+1 ; Foreground color - lda COLTRANS,y + lda COLTRANS,y asl a asl a asl a asl a ldy PALETTE ; Background color - ora COLTRANS,y + ora COLTRANS,y - ldx #VDC_COLORS - jsr VDCWriteReg + ldx #VDC_COLORS + jsr VDCWriteReg lda #TGI_ERR_OK ; Clear error code sta ERROR rts @@ -480,23 +480,23 @@ GETDEFPALETTE: SETPIXEL: jsr CALC ; Calculate coordinates - stx TEMP - lda ADDR - ldy ADDR+1 - jsr VDCSetSourceAddr - jsr VDCReadByte - ldx TEMP + stx TEMP + lda ADDR + ldy ADDR+1 + jsr VDCSetSourceAddr + jsr VDCReadByte + ldx TEMP - sta TEMP + sta TEMP eor BITMASK and BITTAB,X - eor TEMP - pha - lda ADDR - ldy ADDR+1 - jsr VDCSetSourceAddr - pla - jsr VDCWriteByte + eor TEMP + pha + lda ADDR + ldy ADDR+1 + jsr VDCSetSourceAddr + pla + jsr VDCWriteByte @L9: rts @@ -509,12 +509,12 @@ SETPIXEL: GETPIXEL: jsr CALC ; Calculate coordinates - stx TEMP ; preserve X - lda ADDR - ldy ADDR+1 - jsr VDCSetSourceAddr - jsr VDCReadByte - ldx TEMP + stx TEMP ; preserve X + lda ADDR + ldy ADDR+1 + jsr VDCSetSourceAddr + jsr VDCReadByte + ldx TEMP ldy #$00 and BITTAB,X @@ -542,127 +542,127 @@ GETPIXEL: ; BAR: - inc Y2 - bne HORLINE - inc Y2+1 + inc Y2 + bne HORLINE + inc Y2+1 ; Original code for a horizontal line HORLINE: - lda X1 - pha - lda X1+1 - pha - jsr CALC ; get data for LEFT - lda BITMASKL,x ; remember left address and bitmask - pha - lda ADDR - pha - lda ADDR+1 - pha + lda X1 + pha + lda X1+1 + pha + jsr CALC ; get data for LEFT + lda BITMASKL,x ; remember left address and bitmask + pha + lda ADDR + pha + lda ADDR+1 + pha - lda X2 - sta X1 - lda X2+1 - sta X1+1 - jsr CALC ; get data for RIGHT - lda BITMASKR,x - sta TEMP3 + lda X2 + sta X1 + lda X2+1 + sta X1+1 + jsr CALC ; get data for RIGHT + lda BITMASKR,x + sta TEMP3 - pla ; recall data for LEFT - sta X1+1 - pla - sta X1 ; put left address into X1 - pla + pla ; recall data for LEFT + sta X1+1 + pla + sta X1 ; put left address into X1 + pla - cmp #%11111111 ; if left bit <> 0 - beq @L1 - sta TEMP2 ; do left byte only... - lda X1 - ldy X1+1 - jsr VDCSetSourceAddr - jsr VDCReadByte - sta TEMP - eor BITMASK - and TEMP2 - eor TEMP - pha - lda X1 - ldy X1+1 - jsr VDCSetSourceAddr - pla - jsr VDCWriteByte - inc X1 ; ... and proceed - bne @L1 - inc X1+1 + cmp #%11111111 ; if left bit <> 0 + beq @L1 + sta TEMP2 ; do left byte only... + lda X1 + ldy X1+1 + jsr VDCSetSourceAddr + jsr VDCReadByte + sta TEMP + eor BITMASK + and TEMP2 + eor TEMP + pha + lda X1 + ldy X1+1 + jsr VDCSetSourceAddr + pla + jsr VDCWriteByte + inc X1 ; ... and proceed + bne @L1 + inc X1+1 - ; do right byte (if Y2=0 ++ADDR and skip) -@L1: lda TEMP3 - cmp #%11111111 ; if right bit <> 7 - bne @L11 - inc ADDR ; right bit = 7 - the next one is the last - bne @L10 - inc ADDR+1 -@L10: bne @L2 + ; do right byte (if Y2=0 ++ADDR and skip) +@L1: lda TEMP3 + cmp #%11111111 ; if right bit <> 7 + bne @L11 + inc ADDR ; right bit = 7 - the next one is the last + bne @L10 + inc ADDR+1 +@L10: bne @L2 -@L11: lda ADDR ; do right byte only... - ldy ADDR+1 - jsr VDCSetSourceAddr - jsr VDCReadByte - sta TEMP - eor BITMASK - and TEMP3 - eor TEMP - pha - lda ADDR - ldy ADDR+1 - jsr VDCSetSourceAddr - pla - jsr VDCWriteByte +@L11: lda ADDR ; do right byte only... + ldy ADDR+1 + jsr VDCSetSourceAddr + jsr VDCReadByte + sta TEMP + eor BITMASK + and TEMP3 + eor TEMP + pha + lda ADDR + ldy ADDR+1 + jsr VDCSetSourceAddr + pla + jsr VDCWriteByte -@L2: ; do the fill in the middle - lda ADDR ; calculate offset in full bytes - sec - sbc X1 - beq @L3 ; if equal - there are no more bytes - sta ADDR +@L2: ; do the fill in the middle + lda ADDR ; calculate offset in full bytes + sec + sbc X1 + beq @L3 ; if equal - there are no more bytes + sta ADDR - lda X1 ; setup for the left side - ldy X1+1 - jsr VDCSetSourceAddr - lda BITMASK ; get color - jsr VDCWriteByte ; put 1st value - ldx ADDR - dex - beq @L3 ; 1 byte already written + lda X1 ; setup for the left side + ldy X1+1 + jsr VDCSetSourceAddr + lda BITMASK ; get color + jsr VDCWriteByte ; put 1st value + ldx ADDR + dex + beq @L3 ; 1 byte already written - stx ADDR ; if there are more bytes - fill them... - ldx #VDC_VSCROLL - lda #0 - jsr VDCWriteReg ; setup for fill - ldx #VDC_COUNT - lda ADDR - jsr VDCWriteReg ; ... fill them NOW! + stx ADDR ; if there are more bytes - fill them... + ldx #VDC_VSCROLL + lda #0 + jsr VDCWriteReg ; setup for fill + ldx #VDC_COUNT + lda ADDR + jsr VDCWriteReg ; ... fill them NOW! -@L3: pla - sta X1+1 - pla - sta X1 +@L3: pla + sta X1+1 + pla + sta X1 ; End of horizontal line code - inc Y1 - bne @L4 - inc Y1+1 -@L4: lda Y1 - cmp Y2 - bne @L5 - lda Y1+1 - cmp Y2+1 - bne @L5 - rts + inc Y1 + bne @L4 + inc Y1+1 +@L4: lda Y1 + cmp Y2 + bne @L5 + lda Y1+1 + cmp Y2+1 + bne @L5 + rts -@L5: jmp HORLINE +@L5: jmp HORLINE ; ------------------------------------------------------------------------ @@ -697,82 +697,82 @@ OUTTEXT: ;> ADDR - address of card ;> X - bit number (X1 & 7) CALC: - lda Y1+1 - sta ADDR+1 - lda Y1 - asl - rol ADDR+1 - asl - rol ADDR+1 ; Y*4 - clc - adc Y1 - sta ADDR - lda Y1+1 - adc ADDR+1 - sta ADDR+1 ; Y*4+Y=Y*5 - lda ADDR - asl - rol ADDR+1 - asl - rol ADDR+1 - asl - rol ADDR+1 - asl - rol ADDR+1 - sta ADDR ; Y*5*16=Y*80 - lda X1+1 - sta TEMP - lda X1 - lsr TEMP - ror - lsr TEMP - ror - lsr TEMP - ror - clc - adc ADDR - sta ADDR - lda ADDR+1 ; ADDR = Y*80+x/8 - adc TEMP - sta ADDR+1 - lda ADDR+1 - adc SCRBASE - sta ADDR+1 - lda X1 - and #7 - tax - rts + lda Y1+1 + sta ADDR+1 + lda Y1 + asl + rol ADDR+1 + asl + rol ADDR+1 ; Y*4 + clc + adc Y1 + sta ADDR + lda Y1+1 + adc ADDR+1 + sta ADDR+1 ; Y*4+Y=Y*5 + lda ADDR + asl + rol ADDR+1 + asl + rol ADDR+1 + asl + rol ADDR+1 + asl + rol ADDR+1 + sta ADDR ; Y*5*16=Y*80 + lda X1+1 + sta TEMP + lda X1 + lsr TEMP + ror + lsr TEMP + ror + lsr TEMP + ror + clc + adc ADDR + sta ADDR + lda ADDR+1 ; ADDR = Y*80+x/8 + adc TEMP + sta ADDR+1 + lda ADDR+1 + adc SCRBASE + sta ADDR+1 + lda X1 + and #7 + tax + rts ;------------- ; VDC helpers VDCSetSourceAddr: - pha - tya - ldx #VDC_DATA_HI - jsr VDCWriteReg - pla - ldx #VDC_DATA_LO - bne VDCWriteReg + pha + tya + ldx #VDC_DATA_HI + jsr VDCWriteReg + pla + ldx #VDC_DATA_LO + bne VDCWriteReg VDCReadByte: - ldx #VDC_DATA + ldx #VDC_DATA VDCReadReg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda VDC_DATA_REG + rts VDCWriteByte: - ldx #VDC_DATA + ldx #VDC_DATA VDCWriteReg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - sta VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + sta VDC_DATA_REG + rts ; ------------------------------------------------------------------------ - .include "../../tgi/tgidrv_line.inc" + .include "../../tgi/tgidrv_line.inc" diff --git a/libsrc/c128/tgi/c128-vdc2.s b/libsrc/c128/tgi/c128-vdc2.s index 7f2dbdf5c..e3c08037f 100644 --- a/libsrc/c128/tgi/c128-vdc2.s +++ b/libsrc/c128/tgi/c128-vdc2.s @@ -21,9 +21,9 @@ ; Register 25 ($19) is said to require different value for VDC v1, but I ; couldn't find what it should be. - .include "zeropage.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" .include "tgi-error.inc" @@ -32,19 +32,19 @@ ; ------------------------------------------------------------------------ ; Constants -VDC_ADDR_REG = $D600 ; VDC address -VDC_DATA_REG = $D601 ; VDC data +VDC_ADDR_REG = $D600 ; VDC address +VDC_DATA_REG = $D601 ; VDC data -VDC_DSP_HI = 12 ; registers used -VDC_DSP_LO = 13 -VDC_DATA_HI = 18 -VDC_DATA_LO = 19 -VDC_VSCROLL = 24 -VDC_HSCROLL = 25 -VDC_COLORS = 26 -VDC_CSET = 28 -VDC_COUNT = 30 -VDC_DATA = 31 +VDC_DSP_HI = 12 ; registers used +VDC_DSP_LO = 13 +VDC_DATA_HI = 18 +VDC_DATA_LO = 19 +VDC_VSCROLL = 24 +VDC_HSCROLL = 25 +VDC_COLORS = 26 +VDC_CSET = 28 +VDC_COUNT = 30 +VDC_DATA = 31 ; ------------------------------------------------------------------------ ; Header. Includes jump table and constants. @@ -59,7 +59,7 @@ VDC_DATA = 31 xres: .word 640 ; X resolution yres: .word 480 ; Y resolution .byte 2 ; Number of drawing colors -pages: .byte 0 ; Number of screens available +pages: .byte 0 ; Number of screens available .byte 8 ; System font X size .byte 8 ; System font Y size .word $0100 ; Aspect ratio (based on 4/3 display) @@ -72,7 +72,7 @@ pages: .byte 0 ; Number of screens available .addr UNINSTALL .addr INIT .addr DONE - .addr GETERROR + .addr GETERROR .addr CONTROL .addr CLEAR .addr SETVIEWPAGE @@ -100,21 +100,21 @@ Y1 = ptr2 X2 = ptr3 Y2 = ptr4 -ADDR = tmp1 -TEMP = tmp3 -TEMP2 = tmp4 ; HORLINE -TEMP3 = sreg ; HORLINE +ADDR = tmp1 +TEMP = tmp3 +TEMP2 = tmp4 ; HORLINE +TEMP3 = sreg ; HORLINE ; Absolute variables used in the code .bss -ERROR: .res 1 ; Error code +ERROR: .res 1 ; Error code PALETTE: .res 2 ; The current palette BITMASK: .res 1 ; $00 = clear, $FF = set pixels -OLDCOLOR: .res 1 ; colors before entering gfx mode +OLDCOLOR: .res 1 ; colors before entering gfx mode ; Text output stuff TEXTMAGX: .res 1 @@ -130,33 +130,33 @@ PALETTESIZE = * - DEFPALETTE BITTAB: .byte $80,$40,$20,$10,$08,$04,$02,$01 -BITMASKL: .byte %11111111, %01111111, %00111111, %00011111 - .byte %00001111, %00000111, %00000011, %00000001 +BITMASKL: .byte %11111111, %01111111, %00111111, %00011111 + .byte %00001111, %00000111, %00000011, %00000001 -BITMASKR: .byte %10000000, %11000000, %11100000, %11110000 - .byte %11111000, %11111100, %11111110, %11111111 +BITMASKR: .byte %10000000, %11000000, %11100000, %11110000 + .byte %11111000, %11111100, %11111110, %11111111 ; color translation table (indexed by VIC color) -COLTRANS: .byte $00, $0f, $08, $06, $0a, $04, $02, $0c - .byte $0d, $0b, $09, $01, $0e, $05, $03, $07 - ; colors BROWN and GRAY3 are wrong +COLTRANS: .byte $00, $0f, $08, $06, $0a, $04, $02, $0c + .byte $0d, $0b, $09, $01, $0e, $05, $03, $07 + ; colors BROWN and GRAY3 are wrong ; VDC initialization table (reg),(val),...,$ff InitVDCTab: - .byte VDC_DSP_HI, 0 ; viewpage 0 as default - .byte VDC_DSP_LO, 0 - .byte VDC_HSCROLL, $87 - .byte 2, $66 - .byte 4, $4c - .byte 5, $06 - .byte 6, $4c - .byte 7, $47 - .byte 8, $03 - .byte 9, $06 - .byte 27, $00 - .byte $ff + .byte VDC_DSP_HI, 0 ; viewpage 0 as default + .byte VDC_DSP_LO, 0 + .byte VDC_HSCROLL, $87 + .byte 2, $66 + .byte 4, $4c + .byte 5, $06 + .byte 6, $4c + .byte 7, $47 + .byte 8, $03 + .byte 9, $06 + .byte 27, $00 + .byte $ff -SCN80CLR: .byte 27,88,147,27,88,0 +SCN80CLR: .byte 27,88,147,27,88,0 .code @@ -169,76 +169,76 @@ SCN80CLR: .byte 27,88,147,27,88,0 ; INSTALL: - ; check for VDC version and update register $19 value + ; check for VDC version and update register $19 value - ; check for VDC ram size and update number of available screens + ; check for VDC ram size and update number of available screens - ldx #VDC_CSET ; determine size of RAM... - jsr VDCReadReg - sta tmp1 - ora #%00010000 - jsr VDCWriteReg ; turn on 64k + ldx #VDC_CSET ; determine size of RAM... + jsr VDCReadReg + sta tmp1 + ora #%00010000 + jsr VDCWriteReg ; turn on 64k - jsr settestadr1 ; save original value of test byte - jsr VDCReadByte - sta tmp2 + jsr settestadr1 ; save original value of test byte + jsr VDCReadByte + sta tmp2 - lda #$55 ; write $55 here - ldy #ptr1 - jsr test64k ; read it here and there - lda #$aa ; write $aa here - ldy #ptr2 - jsr test64k ; read it here and there + lda #$55 ; write $55 here + ldy #ptr1 + jsr test64k ; read it here and there + lda #$aa ; write $aa here + ldy #ptr2 + jsr test64k ; read it here and there - jsr settestadr1 - lda tmp2 - jsr VDCWriteByte ; restore original value of test byte + jsr settestadr1 + lda tmp2 + jsr VDCWriteByte ; restore original value of test byte - lda ptr1 ; do bytes match? - cmp ptr1+1 - bne @have64k - lda ptr2 - cmp ptr2+1 - bne @have64k + lda ptr1 ; do bytes match? + cmp ptr1+1 + bne @have64k + lda ptr2 + cmp ptr2+1 + bne @have64k - ldx #VDC_CSET - lda tmp1 - jsr VDCWriteReg ; restore 16/64k flag - jmp @endok ; and leave default values for 16k + ldx #VDC_CSET + lda tmp1 + jsr VDCWriteReg ; restore 16/64k flag + jmp @endok ; and leave default values for 16k @have64k: - lda #1 - sta pages + lda #1 + sta pages @endok: rts test64k: - sta tmp1 - sty ptr3 - lda #0 - sta ptr3+1 - jsr settestadr1 - lda tmp1 - jsr VDCWriteByte ; write $55 - jsr settestadr1 - jsr VDCReadByte ; read here - pha - jsr settestadr2 - jsr VDCReadByte ; and there - ldy #1 - sta (ptr3),y - pla - dey - sta (ptr3),y - rts + sta tmp1 + sty ptr3 + lda #0 + sta ptr3+1 + jsr settestadr1 + lda tmp1 + jsr VDCWriteByte ; write $55 + jsr settestadr1 + jsr VDCReadByte ; read here + pha + jsr settestadr2 + jsr VDCReadByte ; and there + ldy #1 + sta (ptr3),y + pla + dey + sta (ptr3),y + rts settestadr1: - ldy #$02 ; test page 2 (here) - .byte $2c + ldy #$02 ; test page 2 (here) + .byte $2c settestadr2: - ldy #$42 ; or page 64+2 (there) - lda #0 - jmp VDCSetSourceAddr + ldy #$42 ; or page 64+2 (there) + lda #0 + jmp VDCSetSourceAddr ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. May @@ -266,10 +266,10 @@ UNINSTALL: ; INIT: - lda pages ; is there enough memory? - bne @L1 ; Jump if there is one screen - lda #TGI_ERR_INV_MODE ; Error - bne @L9 + lda pages ; is there enough memory? + bne @L1 ; Jump if there is one screen + lda #TGI_ERR_INV_MODE ; Error + bne @L9 ; Initialize variables @@ -277,20 +277,20 @@ INIT: stx BITMASK ; Remeber current color value - ldx #VDC_COLORS - jsr VDCReadReg - sta OLDCOLOR + ldx #VDC_COLORS + jsr VDCReadReg + sta OLDCOLOR ; Switch into graphics mode (set view page 0) - ldy #0 -@L2: ldx InitVDCTab,y - bmi @L3 - iny - lda InitVDCTab,y - jsr VDCWriteReg - iny - bne @L2 + ldy #0 +@L2: ldx InitVDCTab,y + bmi @L3 + iny + lda InitVDCTab,y + jsr VDCWriteReg + iny + bne @L2 @L3: ; Done, reset the error code @@ -308,35 +308,35 @@ INIT: ; DONE: - ; This part is C128-mode specific - jsr $e179 ; reload character set and setup VDC - jsr $ff62 - lda $d7 ; in 80-columns? - bne @L01 -@L0: lda SCN80CLR,y - beq @L1 - jsr $ffd2 ; print \xe,clr,\xe - iny - bne @L0 -@L01: lda #147 - jsr $ffd2 ; print clr -@L1: lda #0 ; restore view page - ldx #VDC_DSP_HI - jsr VDCWriteReg - lda OLDCOLOR - ldx #VDC_COLORS - jsr VDCWriteReg ; restore color (background) - lda #$47 - ldx #VDC_HSCROLL - jmp VDCWriteReg ; switch to text screen + ; This part is C128-mode specific + jsr $e179 ; reload character set and setup VDC + jsr $ff62 + lda $d7 ; in 80-columns? + bne @L01 +@L0: lda SCN80CLR,y + beq @L1 + jsr $ffd2 ; print \xe,clr,\xe + iny + bne @L0 +@L01: lda #147 + jsr $ffd2 ; print clr +@L1: lda #0 ; restore view page + ldx #VDC_DSP_HI + jsr VDCWriteReg + lda OLDCOLOR + ldx #VDC_COLORS + jsr VDCWriteReg ; restore color (background) + lda #$47 + ldx #VDC_HSCROLL + jmp VDCWriteReg ; switch to text screen ; ------------------------------------------------------------------------ ; GETERROR: Return the error code in A and clear it. GETERROR: - ldx #TGI_ERR_OK - lda ERROR - stx ERROR + ldx #TGI_ERR_OK + lda ERROR + stx ERROR rts ; ------------------------------------------------------------------------ @@ -346,8 +346,8 @@ GETERROR: ; CONTROL: - lda #TGI_ERR_INV_FUNC - sta ERROR + lda #TGI_ERR_INV_FUNC + sta ERROR rts ; ------------------------------------------------------------------------ @@ -357,21 +357,21 @@ CONTROL: ; CLEAR: - lda #0 - tay - jsr VDCSetSourceAddr - lda #0 - ldx #VDC_VSCROLL - jsr VDCWriteReg ; set fill mode - lda #0 - jsr VDCWriteByte ; put 1rst byte (fill value) - ldy #159 ; 159 times - lda #0 ; 256 bytes - ldx #VDC_COUNT -@L1: jsr VDCWriteReg - dey - bne @L1 - rts + lda #0 + tay + jsr VDCSetSourceAddr + lda #0 + ldx #VDC_VSCROLL + jsr VDCWriteReg ; set fill mode + lda #0 + jsr VDCWriteByte ; put 1rst byte (fill value) + ldy #159 ; 159 times + lda #0 ; 256 bytes + ldx #VDC_COUNT +@L1: jsr VDCWriteReg + dey + bne @L1 + rts ; ------------------------------------------------------------------------ ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). @@ -381,7 +381,7 @@ CLEAR: ; SETVIEWPAGE: - rts + rts ; ------------------------------------------------------------------------ ; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n). @@ -391,7 +391,7 @@ SETVIEWPAGE: ; SETDRAWPAGE: - rts + rts ; ------------------------------------------------------------------------ ; SETCOLOR: Set the drawing color (in A). The new color is already checked @@ -426,16 +426,16 @@ SETPALETTE: ; Get the color entries from the palette ldy PALETTE+1 ; Foreground color - lda COLTRANS,y + lda COLTRANS,y asl a asl a asl a asl a ldy PALETTE ; Background color - ora COLTRANS,y + ora COLTRANS,y - ldx #VDC_COLORS - jsr VDCWriteReg + ldx #VDC_COLORS + jsr VDCWriteReg lda #TGI_ERR_OK ; Clear error code sta ERROR rts @@ -478,23 +478,23 @@ GETDEFPALETTE: SETPIXEL: jsr CALC ; Calculate coordinates - stx TEMP - lda ADDR - ldy ADDR+1 - jsr VDCSetSourceAddr - jsr VDCReadByte - ldx TEMP + stx TEMP + lda ADDR + ldy ADDR+1 + jsr VDCSetSourceAddr + jsr VDCReadByte + ldx TEMP - sta TEMP + sta TEMP eor BITMASK and BITTAB,X - eor TEMP - pha - lda ADDR - ldy ADDR+1 - jsr VDCSetSourceAddr - pla - jsr VDCWriteByte + eor TEMP + pha + lda ADDR + ldy ADDR+1 + jsr VDCSetSourceAddr + pla + jsr VDCWriteByte @L9: rts @@ -507,12 +507,12 @@ SETPIXEL: GETPIXEL: jsr CALC ; Calculate coordinates - stx TEMP ; preserve X - lda ADDR - ldy ADDR+1 - jsr VDCSetSourceAddr - jsr VDCReadByte - ldx TEMP + stx TEMP ; preserve X + lda ADDR + ldy ADDR+1 + jsr VDCSetSourceAddr + jsr VDCReadByte + ldx TEMP ldy #$00 and BITTAB,X @@ -540,127 +540,127 @@ GETPIXEL: ; BAR: - inc Y2 - bne HORLINE - inc Y2+1 + inc Y2 + bne HORLINE + inc Y2+1 ; Original code for a horizontal line HORLINE: - lda X1 - pha - lda X1+1 - pha - jsr CALC ; get data for LEFT - lda BITMASKL,x ; remember left address and bitmask - pha - lda ADDR - pha - lda ADDR+1 - pha + lda X1 + pha + lda X1+1 + pha + jsr CALC ; get data for LEFT + lda BITMASKL,x ; remember left address and bitmask + pha + lda ADDR + pha + lda ADDR+1 + pha - lda X2 - sta X1 - lda X2+1 - sta X1+1 - jsr CALC ; get data for RIGHT - lda BITMASKR,x - sta TEMP3 + lda X2 + sta X1 + lda X2+1 + sta X1+1 + jsr CALC ; get data for RIGHT + lda BITMASKR,x + sta TEMP3 - pla ; recall data for LEFT - sta X1+1 - pla - sta X1 ; put left address into X1 - pla + pla ; recall data for LEFT + sta X1+1 + pla + sta X1 ; put left address into X1 + pla - cmp #%11111111 ; if left bit <> 0 - beq @L1 - sta TEMP2 ; do left byte only... - lda X1 - ldy X1+1 - jsr VDCSetSourceAddr - jsr VDCReadByte - sta TEMP - eor BITMASK - and TEMP2 - eor TEMP - pha - lda X1 - ldy X1+1 - jsr VDCSetSourceAddr - pla - jsr VDCWriteByte - inc X1 ; ... and proceed - bne @L1 - inc X1+1 + cmp #%11111111 ; if left bit <> 0 + beq @L1 + sta TEMP2 ; do left byte only... + lda X1 + ldy X1+1 + jsr VDCSetSourceAddr + jsr VDCReadByte + sta TEMP + eor BITMASK + and TEMP2 + eor TEMP + pha + lda X1 + ldy X1+1 + jsr VDCSetSourceAddr + pla + jsr VDCWriteByte + inc X1 ; ... and proceed + bne @L1 + inc X1+1 - ; do right byte (if Y2=0 ++ADDR and skip) -@L1: lda TEMP3 - cmp #%11111111 ; if right bit <> 7 - bne @L11 - inc ADDR ; right bit = 7 - the next one is the last - bne @L10 - inc ADDR+1 -@L10: bne @L2 + ; do right byte (if Y2=0 ++ADDR and skip) +@L1: lda TEMP3 + cmp #%11111111 ; if right bit <> 7 + bne @L11 + inc ADDR ; right bit = 7 - the next one is the last + bne @L10 + inc ADDR+1 +@L10: bne @L2 -@L11: lda ADDR ; do right byte only... - ldy ADDR+1 - jsr VDCSetSourceAddr - jsr VDCReadByte - sta TEMP - eor BITMASK - and TEMP3 - eor TEMP - pha - lda ADDR - ldy ADDR+1 - jsr VDCSetSourceAddr - pla - jsr VDCWriteByte +@L11: lda ADDR ; do right byte only... + ldy ADDR+1 + jsr VDCSetSourceAddr + jsr VDCReadByte + sta TEMP + eor BITMASK + and TEMP3 + eor TEMP + pha + lda ADDR + ldy ADDR+1 + jsr VDCSetSourceAddr + pla + jsr VDCWriteByte -@L2: ; do the fill in the middle - lda ADDR ; calculate offset in full bytes - sec - sbc X1 - beq @L3 ; if equal - there are no more bytes - sta ADDR +@L2: ; do the fill in the middle + lda ADDR ; calculate offset in full bytes + sec + sbc X1 + beq @L3 ; if equal - there are no more bytes + sta ADDR - lda X1 ; setup for the left side - ldy X1+1 - jsr VDCSetSourceAddr - lda BITMASK ; get color - jsr VDCWriteByte ; put 1st value - ldx ADDR - dex - beq @L3 ; 1 byte already written + lda X1 ; setup for the left side + ldy X1+1 + jsr VDCSetSourceAddr + lda BITMASK ; get color + jsr VDCWriteByte ; put 1st value + ldx ADDR + dex + beq @L3 ; 1 byte already written - stx ADDR ; if there are more bytes - fill them... - ldx #VDC_VSCROLL - lda #0 - jsr VDCWriteReg ; setup for fill - ldx #VDC_COUNT - lda ADDR - jsr VDCWriteReg ; ... fill them NOW! + stx ADDR ; if there are more bytes - fill them... + ldx #VDC_VSCROLL + lda #0 + jsr VDCWriteReg ; setup for fill + ldx #VDC_COUNT + lda ADDR + jsr VDCWriteReg ; ... fill them NOW! -@L3: pla - sta X1+1 - pla - sta X1 +@L3: pla + sta X1+1 + pla + sta X1 ; End of horizontal line code - inc Y1 - bne @L4 - inc Y1+1 -@L4: lda Y1 - cmp Y2 - bne @L5 - lda Y1+1 - cmp Y2+1 - bne @L5 - rts + inc Y1 + bne @L4 + inc Y1+1 +@L4: lda Y1 + cmp Y2 + bne @L5 + lda Y1+1 + cmp Y2+1 + bne @L5 + rts -@L5: jmp HORLINE +@L5: jmp HORLINE ; ------------------------------------------------------------------------ @@ -695,98 +695,98 @@ OUTTEXT: ;> ADDR - address of card ;> X - bit number (X1 & 7) CALC: - lda Y1 - pha - lda Y1+1 - pha - lsr - ror Y1 ; Y=Y/2 - sta Y1+1 - sta ADDR+1 - lda Y1 - asl - rol ADDR+1 - asl - rol ADDR+1 ; Y*4 - clc - adc Y1 - sta ADDR - lda Y1+1 - adc ADDR+1 - sta ADDR+1 ; Y*4+Y=Y*5 - lda ADDR - asl - rol ADDR+1 - asl - rol ADDR+1 - asl - rol ADDR+1 - asl - rol ADDR+1 - sta ADDR ; Y*5*16=Y*80 - lda X1+1 - sta TEMP - lda X1 - lsr TEMP - ror - lsr TEMP - ror - lsr TEMP - ror - clc - adc ADDR - sta ADDR - lda ADDR+1 ; ADDR = Y*80+x/8 - adc TEMP - sta ADDR+1 - pla - sta Y1+1 - pla - sta Y1 - and #1 - beq @even ; even line - no offset - lda ADDR - clc - adc #<21360 - sta ADDR - lda ADDR+1 - adc #>21360 - sta ADDR+1 ; odd lines are 21360 bytes farther -@even: lda X1 - and #7 - tax - rts + lda Y1 + pha + lda Y1+1 + pha + lsr + ror Y1 ; Y=Y/2 + sta Y1+1 + sta ADDR+1 + lda Y1 + asl + rol ADDR+1 + asl + rol ADDR+1 ; Y*4 + clc + adc Y1 + sta ADDR + lda Y1+1 + adc ADDR+1 + sta ADDR+1 ; Y*4+Y=Y*5 + lda ADDR + asl + rol ADDR+1 + asl + rol ADDR+1 + asl + rol ADDR+1 + asl + rol ADDR+1 + sta ADDR ; Y*5*16=Y*80 + lda X1+1 + sta TEMP + lda X1 + lsr TEMP + ror + lsr TEMP + ror + lsr TEMP + ror + clc + adc ADDR + sta ADDR + lda ADDR+1 ; ADDR = Y*80+x/8 + adc TEMP + sta ADDR+1 + pla + sta Y1+1 + pla + sta Y1 + and #1 + beq @even ; even line - no offset + lda ADDR + clc + adc #<21360 + sta ADDR + lda ADDR+1 + adc #>21360 + sta ADDR+1 ; odd lines are 21360 bytes farther +@even: lda X1 + and #7 + tax + rts ;------------- ; VDC helpers VDCSetSourceAddr: - pha - tya - ldx #VDC_DATA_HI - jsr VDCWriteReg - pla - ldx #VDC_DATA_LO - bne VDCWriteReg + pha + tya + ldx #VDC_DATA_HI + jsr VDCWriteReg + pla + ldx #VDC_DATA_LO + bne VDCWriteReg VDCReadByte: - ldx #VDC_DATA + ldx #VDC_DATA VDCReadReg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda VDC_DATA_REG + rts VDCWriteByte: - ldx #VDC_DATA + ldx #VDC_DATA VDCWriteReg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - sta VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + sta VDC_DATA_REG + rts ; ------------------------------------------------------------------------ - .include "../../tgi/tgidrv_line.inc" + .include "../../tgi/tgidrv_line.inc" diff --git a/libsrc/c128/tgi_colors.s b/libsrc/c128/tgi_colors.s index 4dab483e2..6ef3729b4 100644 --- a/libsrc/c128/tgi_colors.s +++ b/libsrc/c128/tgi_colors.s @@ -2,7 +2,7 @@ ; Target-specific black & white values for use by the target-shared TGI kernel ; - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $01 + .export tgi_color_black:zp = $00 + .export tgi_color_white:zp = $01 diff --git a/libsrc/c128/tgi_stat_stddrv.s b/libsrc/c128/tgi_stat_stddrv.s index e6c2874d3..62f515d4e 100644 --- a/libsrc/c128/tgi_stat_stddrv.s +++ b/libsrc/c128/tgi_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void tgi_static_stddrv[]; ; - .export _tgi_static_stddrv - .import _c128_vdc_tgi + .export _tgi_static_stddrv + .import _c128_vdc_tgi .rodata diff --git a/libsrc/c128/tgi_stddrv.s b/libsrc/c128/tgi_stddrv.s index 70dadde67..6efd0854f 100644 --- a/libsrc/c128/tgi_stddrv.s +++ b/libsrc/c128/tgi_stddrv.s @@ -6,8 +6,8 @@ ; const char tgi_stddrv[]; ; - .export _tgi_stddrv + .export _tgi_stddrv .rodata -_tgi_stddrv: .asciiz "c128-vdc.tgi" +_tgi_stddrv: .asciiz "c128-vdc.tgi" diff --git a/libsrc/c128/toggle_videomode.s b/libsrc/c128/toggle_videomode.s index a94e416ee..e09a16cab 100644 --- a/libsrc/c128/toggle_videomode.s +++ b/libsrc/c128/toggle_videomode.s @@ -5,7 +5,7 @@ ; /* Toggle the video mode between 40 and 80 chars (calls SWAPPER) */ ; - .export _toggle_videomode + .export _toggle_videomode .import SWAPPER, BSOUT ; This function is deprecated @@ -16,8 +16,8 @@ .proc _toggle_videomode jsr SWAPPER ; Toggle the mode - lda #14 - jmp BSOUT ; Switch to lower case chars + lda #14 + jmp BSOUT ; Switch to lower case chars .endproc diff --git a/libsrc/c128/videomode.s b/libsrc/c128/videomode.s index d07df5160..dc7df0fc2 100644 --- a/libsrc/c128/videomode.s +++ b/libsrc/c128/videomode.s @@ -5,7 +5,7 @@ ; /* Set the video mode, return the old mode */ ; - .export _videomode + .export _videomode .import SWAPPER, BSOUT .include "c128.inc" @@ -20,8 +20,8 @@ pha ; ... and save it jsr SWAPPER ; Toggle the mode - lda #14 - jsr BSOUT ; Switch to lower case chars + lda #14 + jsr BSOUT ; Switch to lower case chars pla ; Get old mode into A diff --git a/libsrc/c16/_scrsize.s b/libsrc/c16/_scrsize.s index c0a746198..57ad4f30f 100644 --- a/libsrc/c16/_scrsize.s +++ b/libsrc/c16/_scrsize.s @@ -4,7 +4,7 @@ ; Screen size variables ; - .export screensize + .export screensize .import SCREEN screensize = SCREEN diff --git a/libsrc/c16/break.s b/libsrc/c16/break.s index c51cc4b07..e143ac6d5 100644 --- a/libsrc/c16/break.s +++ b/libsrc/c16/break.s @@ -5,65 +5,65 @@ ; void reset_brk (void); ; - .export _set_brk, _reset_brk - .destructor _reset_brk - .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc + .export _set_brk, _reset_brk + .destructor _reset_brk + .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc - .include "plus4.inc" + .include "plus4.inc" .bss -_brk_a: .res 1 -_brk_x: .res 1 -_brk_y: .res 1 -_brk_sr: .res 1 -_brk_pc: .res 2 +_brk_a: .res 1 +_brk_x: .res 1 +_brk_y: .res 1 +_brk_sr: .res 1 +_brk_pc: .res 2 -oldvec: .res 2 ; Old vector +oldvec: .res 2 ; Old vector .data -uservec: jmp $FFFF ; Patched at runtime +uservec: jmp $FFFF ; Patched at runtime .code ; Set the break vector -.proc _set_brk +.proc _set_brk - sta uservec+1 - stx uservec+2 ; Set the user vector + sta uservec+1 + stx uservec+2 ; Set the user vector - lda oldvec - ora oldvec+1 ; Did we save the vector already? - bne L1 ; Jump if we installed the handler already + lda oldvec + ora oldvec+1 ; Did we save the vector already? + bne L1 ; Jump if we installed the handler already - lda BRKVec - sta oldvec - lda BRKVec+1 - sta oldvec+1 ; Save the old vector + lda BRKVec + sta oldvec + lda BRKVec+1 + sta oldvec+1 ; Save the old vector -L1: lda #brk_handler - sta BRKVec - stx BRKVec+1 - rts +L1: lda #brk_handler + sta BRKVec + stx BRKVec+1 + rts .endproc ; Reset the break vector -.proc _reset_brk +.proc _reset_brk - lda oldvec - ldx oldvec+1 - beq @L9 ; Jump if vector not installed - sta BRKVec - stx BRKVec+1 - lda #$00 - sta oldvec ; Clear the old vector - stx oldvec+1 -@L9: rts + lda oldvec + ldx oldvec+1 + beq @L9 ; Jump if vector not installed + sta BRKVec + stx BRKVec+1 + lda #$00 + sta oldvec ; Clear the old vector + stx oldvec+1 +@L9: rts .endproc @@ -71,37 +71,37 @@ L1: lda #BASE ; Low 32 K are used bcc nomem @@ -104,17 +104,17 @@ PAGECOUNT: ; by the driver. ; -MAP: sta curpage ; Remember the new page +MAP: sta curpage ; Remember the new page add #>BASE - sta ptr1+1 - ldy #$00 - sty ptr1 + sta ptr1+1 + ldy #$00 + sty ptr1 - lda #window - sta ptr2+1 + lda #window + sta ptr2+1 ; Transfer one page @@ -137,18 +137,18 @@ USE: sta curpage ; Remember the page ; ------------------------------------------------------------------------ ; COMMIT: Commit changes in the memory window to extended storage. -COMMIT: lda curpage ; Get the current page +COMMIT: lda curpage ; Get the current page bmi done ; Jump if no page mapped add #>BASE - sta ptr2+1 - ldy #$00 - sty ptr2 + sta ptr2+1 + ldy #$00 + sty ptr2 - lda #window - sta ptr1+1 + lda #window + sta ptr1+1 ; Transfer one page. Y must be zero on entry. Because we bank out the ; kernal, we will run the routine with interrupts disabled but leave @@ -158,11 +158,11 @@ transfer: sei sta ENABLE_RAM - .repeat 8 - lda (ptr1),y - sta (ptr2),y + .repeat 8 + lda (ptr1),y + sta (ptr2),y iny - .endrepeat + .endrepeat sta ENABLE_ROM cli @@ -225,8 +225,8 @@ common: ldy #EM_COPY::COUNT+1 ; Transfer the bytes in the last page ldy #$00 -@L3: lda (ptr1),y - sta (ptr2),y +@L3: lda (ptr1),y + sta (ptr2),y iny dex bne @L3 diff --git a/libsrc/c16/get_tv.s b/libsrc/c16/get_tv.s index 84f09b12c..f6d82a351 100644 --- a/libsrc/c16/get_tv.s +++ b/libsrc/c16/get_tv.s @@ -6,7 +6,7 @@ ; .include "plus4.inc" - .include "get_tv.inc" + .include "get_tv.inc" ;-------------------------------------------------------------------------- @@ -14,7 +14,7 @@ .proc _get_tv - ldx #TV::PAL ; Assume PAL + ldx #TV::PAL ; Assume PAL bit TED_MULTI1 ; Test bit 6 bvc pal dex ; NTSC diff --git a/libsrc/c16/irq.s b/libsrc/c16/irq.s index 224f5745d..46dd75fe8 100644 --- a/libsrc/c16/irq.s +++ b/libsrc/c16/irq.s @@ -2,48 +2,48 @@ ; IRQ handling (C16 version) ; - .export initirq, doneirq - .import callirq + .export initirq, doneirq + .import callirq - .include "plus4.inc" + .include "plus4.inc" ; ------------------------------------------------------------------------ -.segment "INIT" +.segment "INIT" initirq: - lda IRQVec - ldx IRQVec+1 - sta IRQInd+1 - stx IRQInd+2 - lda #IRQStub - jmp setvec + lda IRQVec + ldx IRQVec+1 + sta IRQInd+1 + stx IRQInd+2 + lda #IRQStub + jmp setvec ; ------------------------------------------------------------------------ .code doneirq: - lda IRQInd+1 - ldx IRQInd+2 -setvec: sei - sta IRQVec - stx IRQVec+1 - cli - rts + lda IRQInd+1 + ldx IRQInd+2 +setvec: sei + sta IRQVec + stx IRQVec+1 + cli + rts ; ------------------------------------------------------------------------ -.segment "LOWCODE" +.segment "LOWCODE" IRQStub: - cld ; Just to be sure - jsr callirq ; Call the functions - jmp IRQInd ; Jump to the saved IRQ vector + cld ; Just to be sure + jsr callirq ; Call the functions + jmp IRQInd ; Jump to the saved IRQ vector ; ------------------------------------------------------------------------ .data -IRQInd: jmp $0000 +IRQInd: jmp $0000 diff --git a/libsrc/c16/joy/c16-stdjoy.s b/libsrc/c16/joy/c16-stdjoy.s index a448f30e8..54ba47e19 100644 --- a/libsrc/c16/joy/c16-stdjoy.s +++ b/libsrc/c16/joy/c16-stdjoy.s @@ -5,5 +5,5 @@ ; Ullrich von Bassewitz, 2002-12-21 ; - .include "../../plus4/joy/plus4-stdjoy.s" + .include "../../plus4/joy/plus4-stdjoy.s" diff --git a/libsrc/c16/joy_stat_stddrv.s b/libsrc/c16/joy_stat_stddrv.s index 68d67403d..2dea36be6 100644 --- a/libsrc/c16/joy_stat_stddrv.s +++ b/libsrc/c16/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _c16_stdjoy_joy + .export _joy_static_stddrv + .import _c16_stdjoy_joy .rodata diff --git a/libsrc/c16/joy_stddrv.s b/libsrc/c16/joy_stddrv.s index a55eefeb0..10aa8c63d 100644 --- a/libsrc/c16/joy_stddrv.s +++ b/libsrc/c16/joy_stddrv.s @@ -6,9 +6,9 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "c16-stdjoy.joy" +_joy_stddrv: .asciiz "c16-stdjoy.joy" diff --git a/libsrc/c16/kbhit.s b/libsrc/c16/kbhit.s index f408c4e51..bb88beea8 100644 --- a/libsrc/c16/kbhit.s +++ b/libsrc/c16/kbhit.s @@ -4,16 +4,16 @@ ; unsigned char kbhit (void); ; - .export _kbhit + .export _kbhit - .include "plus4.inc" + .include "plus4.inc" .proc _kbhit ldx #0 ; High byte of return is always zero - lda KEY_COUNT ; Get number of characters - ora FKEY_COUNT ; Or with number of chars from function keys + lda KEY_COUNT ; Get number of characters + ora FKEY_COUNT ; Or with number of chars from function keys beq L9 lda #1 L9: rts diff --git a/libsrc/c16/kclose.s b/libsrc/c16/kclose.s index e957117c5..ef7004732 100644 --- a/libsrc/c16/kclose.s +++ b/libsrc/c16/kclose.s @@ -7,8 +7,8 @@ .export CLOSE .proc CLOSE - clc ; Force C64 compatible behaviour - jmp $FFC3 ; Call the ROM routine + clc ; Force C64 compatible behaviour + jmp $FFC3 ; Call the ROM routine .endproc diff --git a/libsrc/c16/kernal.s b/libsrc/c16/kernal.s index 376f82506..7ba27b62c 100644 --- a/libsrc/c16/kernal.s +++ b/libsrc/c16/kernal.s @@ -47,43 +47,43 @@ ;----------------------------------------------------------------------------- ; All functions are available in the kernal jump table -CINT = $FF81 -IOINIT = $FF84 -RAMTAS = $FF87 -RESTOR = $FF8A -VECTOR = $FF8D -SETMSG = $FF90 -SECOND = $FF93 -TKSA = $FF96 -MEMTOP = $FF99 -MEMBOT = $FF9C -SCNKEY = $FF9F -SETTMO = $FFA2 -ACPTR = $FFA5 -CIOUT = $FFA8 -UNTLK = $FFAB -UNLSN = $FFAE -LISTEN = $FFB1 -TALK = $FFB4 -READST = $FFB7 -SETLFS = $FFBA -SETNAM = $FFBD -OPEN = $FFC0 -;CLOSE = $FFC3 -CHKIN = $FFC6 -CKOUT = $FFC9 -CLRCH = $FFCC -BASIN = $FFCF -BSOUT = $FFD2 -LOAD = $FFD5 -SAVE = $FFD8 -SETTIM = $FFDB -RDTIM = $FFDE -STOP = $FFE1 -GETIN = $FFE4 -CLALL = $FFE7 -UDTIM = $FFEA -SCREEN = $FFED -PLOT = $FFF0 -IOBASE = $FFF3 +CINT = $FF81 +IOINIT = $FF84 +RAMTAS = $FF87 +RESTOR = $FF8A +VECTOR = $FF8D +SETMSG = $FF90 +SECOND = $FF93 +TKSA = $FF96 +MEMTOP = $FF99 +MEMBOT = $FF9C +SCNKEY = $FF9F +SETTMO = $FFA2 +ACPTR = $FFA5 +CIOUT = $FFA8 +UNTLK = $FFAB +UNLSN = $FFAE +LISTEN = $FFB1 +TALK = $FFB4 +READST = $FFB7 +SETLFS = $FFBA +SETNAM = $FFBD +OPEN = $FFC0 +;CLOSE = $FFC3 +CHKIN = $FFC6 +CKOUT = $FFC9 +CLRCH = $FFCC +BASIN = $FFCF +BSOUT = $FFD2 +LOAD = $FFD5 +SAVE = $FFD8 +SETTIM = $FFDB +RDTIM = $FFDE +STOP = $FFE1 +GETIN = $FFE4 +CLALL = $FFE7 +UDTIM = $FFEA +SCREEN = $FFED +PLOT = $FFF0 +IOBASE = $FFF3 diff --git a/libsrc/c16/mainargs.s b/libsrc/c16/mainargs.s index 418bfe90f..0a402d27d 100644 --- a/libsrc/c16/mainargs.s +++ b/libsrc/c16/mainargs.s @@ -22,16 +22,16 @@ ; - The "file-name" might be a path-name; don't copy the directory-components. ; - Add a control-character quoting mechanism. - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv - .include "plus4.inc" + .include "plus4.inc" -MAXARGS = 10 ; Maximum number of arguments allowed -REM = $8f ; BASIC token-code -NAME_LEN = 16 ; maximum length of command-name +MAXARGS = 10 ; Maximum number of arguments allowed +REM = $8f ; BASIC token-code +NAME_LEN = 16 ; maximum length of command-name ; Get possible command-line arguments. Goes into the special INIT segment, ; which may be reused after the startup code is run @@ -45,26 +45,26 @@ initmainargs: ; Because the buffer, that we're copying into, was zeroed out, ; we don't need to add a NUL character. ; - ldy FNAM_LEN - cpy #NAME_LEN + 1 - bcc L1 - ldy #NAME_LEN - 1 ; limit the length -L0: lda #FNAM ; Vector address + ldy FNAM_LEN + cpy #NAME_LEN + 1 + bcc L1 + ldy #NAME_LEN - 1 ; limit the length +L0: lda #FNAM ; Vector address jsr FETCH ; Load byte from RAM - sta name,y -L1: dey - bpl L0 - inc __argc ; argc always is equal to, at least, 1 + sta name,y +L1: dey + bpl L0 + inc __argc ; argc always is equal to, at least, 1 ; Find the "rem" token. ; - ldx #0 -L2: lda BASIC_BUF,x - beq done ; no "rem," no args. - inx - cmp #REM - bne L2 - ldy #1 * 2 + ldx #0 +L2: lda BASIC_BUF,x + beq done ; no "rem," no args. + inx + cmp #REM + bne L2 + ldy #1 * 2 ; Find the next argument @@ -90,11 +90,11 @@ setterm:sta term ; Set end of argument marker ; necessary. txa ; Get low byte - sta argv,y ; argv[y]= &arg - iny - lda #>BASIC_BUF - sta argv,y - iny + sta argv,y ; argv[y]= &arg + iny + lda #>BASIC_BUF + sta argv,y + iny inc __argc ; Found another arg ; Search for the end of the argument @@ -121,21 +121,21 @@ argloop:lda BASIC_BUF,x ; (The last vector in argv[] already is NULL.) -done: lda #argv - sta __argv - stx __argv + 1 - rts +done: lda #argv + sta __argv + stx __argv + 1 + rts ; These arrays are zeroed before initmainargs is called. -; char name[16+1]; +; char name[16+1]; ; char* argv[MAXARGS+1]={name}; ; .bss -term: .res 1 -name: .res NAME_LEN + 1 +term: .res 1 +name: .res NAME_LEN + 1 .data argv: .addr name - .res MAXARGS * 2 + .res MAXARGS * 2 diff --git a/libsrc/c16/randomize.s b/libsrc/c16/randomize.s index e65fd4dab..903a0809a 100644 --- a/libsrc/c16/randomize.s +++ b/libsrc/c16/randomize.s @@ -5,10 +5,10 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand - .include "plus4.inc" + .include "plus4.inc" __randomize: ldx TED_VLINELO ; Use TED rasterline as high byte diff --git a/libsrc/c16/revers.s b/libsrc/c16/revers.s index c48ff9862..f1c0b4d64 100644 --- a/libsrc/c16/revers.s +++ b/libsrc/c16/revers.s @@ -4,24 +4,24 @@ ; unsigned char revers (unsigned char onoff); ; - .export _revers + .export _revers .include "plus4.inc" .proc _revers - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value - ldy #$00 ; Assume old value is zero -L1: lda RVS ; Load old value - stx RVS ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value + ldy #$00 ; Assume old value is zero +L1: lda RVS ; Load old value + stx RVS ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts .endproc diff --git a/libsrc/c16/status.s b/libsrc/c16/status.s index 3620c9107..c6f279230 100644 --- a/libsrc/c16/status.s +++ b/libsrc/c16/status.s @@ -2,4 +2,4 @@ ; Oliver Schmidt, 2012-09-30 ; - .exportzp ST := $90 ; IEC status byte + .exportzp ST := $90 ; IEC status byte diff --git a/libsrc/c16/systime.s b/libsrc/c16/systime.s index 1d039e80e..d22b8c596 100644 --- a/libsrc/c16/systime.s +++ b/libsrc/c16/systime.s @@ -9,7 +9,7 @@ ; */ ; - .export __systime + .export __systime .importzp sreg diff --git a/libsrc/c64/_scrsize.s b/libsrc/c64/_scrsize.s index c0a746198..57ad4f30f 100644 --- a/libsrc/c64/_scrsize.s +++ b/libsrc/c64/_scrsize.s @@ -4,7 +4,7 @@ ; Screen size variables ; - .export screensize + .export screensize .import SCREEN screensize = SCREEN diff --git a/libsrc/c64/break.s b/libsrc/c64/break.s index 76315b7b9..1c44c59a0 100644 --- a/libsrc/c64/break.s +++ b/libsrc/c64/break.s @@ -5,65 +5,65 @@ ; void reset_brk (void); ; - .export _set_brk, _reset_brk - .destructor _reset_brk - .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc + .export _set_brk, _reset_brk + .destructor _reset_brk + .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc - .include "c64.inc" + .include "c64.inc" .bss -_brk_a: .res 1 -_brk_x: .res 1 -_brk_y: .res 1 -_brk_sr: .res 1 -_brk_pc: .res 2 +_brk_a: .res 1 +_brk_x: .res 1 +_brk_y: .res 1 +_brk_sr: .res 1 +_brk_pc: .res 2 -oldvec: .res 2 ; Old vector +oldvec: .res 2 ; Old vector .data -uservec: jmp $FFFF ; Patched at runtime +uservec: jmp $FFFF ; Patched at runtime .code ; Set the break vector -.proc _set_brk +.proc _set_brk - sta uservec+1 - stx uservec+2 ; Set the user vector + sta uservec+1 + stx uservec+2 ; Set the user vector - lda oldvec - ora oldvec+1 ; Did we save the vector already? - bne L1 ; Jump if we installed the handler already + lda oldvec + ora oldvec+1 ; Did we save the vector already? + bne L1 ; Jump if we installed the handler already - lda BRKVec - sta oldvec - lda BRKVec+1 - sta oldvec+1 ; Save the old vector + lda BRKVec + sta oldvec + lda BRKVec+1 + sta oldvec+1 ; Save the old vector -L1: lda #brk_handler - sta BRKVec - stx BRKVec+1 - rts +L1: lda #brk_handler + sta BRKVec + stx BRKVec+1 + rts .endproc ; Reset the break vector -.proc _reset_brk +.proc _reset_brk - lda oldvec - ldx oldvec+1 - beq @L9 ; Jump if vector not installed - sta BRKVec - stx BRKVec+1 - lda #$00 - sta oldvec ; Clear the old vector - stx oldvec+1 -@L9: rts + lda oldvec + ldx oldvec+1 + beq @L9 ; Jump if vector not installed + sta BRKVec + stx BRKVec+1 + lda #$00 + sta oldvec ; Clear the old vector + stx oldvec+1 +@L9: rts .endproc @@ -71,37 +71,37 @@ L1: lda #(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - sta sp+1 ; Set argument stack ptr + lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp + lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp+1 ; Set argument stack ptr ; Call module constructors - jsr initlib + jsr initlib ; Push arguments and call main - jsr callmain + jsr callmain ; Back from main (This is also the _exit entry). Run module destructors -_exit: pha ; Save the return code on stack - jsr donelib +_exit: pha ; Save the return code on stack + jsr donelib ; Copy back the zero page stuff - ldx #zpspace-1 -L2: lda zpsave,x - sta sp,x - dex - bpl L2 + ldx #zpspace-1 +L2: lda zpsave,x + sta sp,x + dex + bpl L2 ; Place the program return code into ST - pla - sta ST + pla + sta ST ; Restore system stuff - ldx spsave - txs ; Restore stack pointer - ldx mmusave - stx $01 ; Restore memory configuration + ldx spsave + txs ; Restore stack pointer + ldx mmusave + stx $01 ; Restore memory configuration ; Back to basic - rts + rts ; ------------------------------------------------------------------------ ; Data -.segment "ZPSAVE" +.segment "ZPSAVE" -zpsave: .res zpspace +zpsave: .res zpspace .bss -spsave: .res 1 -mmusave:.res 1 +spsave: .res 1 +mmusave:.res 1 diff --git a/libsrc/c64/devnum.s b/libsrc/c64/devnum.s index e7b5f94b2..33c0461bc 100644 --- a/libsrc/c64/devnum.s +++ b/libsrc/c64/devnum.s @@ -2,6 +2,6 @@ ; Oliver Schmidt, 2010-02-14 ; - .include "c64.inc" + .include "c64.inc" - .exportzp devnum := DEVNUM + .exportzp devnum := DEVNUM diff --git a/libsrc/c64/emd/c64-c256k.s b/libsrc/c64/emd/c64-c256k.s index ed8bf7732..f559bf7f3 100644 --- a/libsrc/c64/emd/c64-c256k.s +++ b/libsrc/c64/emd/c64-c256k.s @@ -3,13 +3,13 @@ ; Marco van den Heuvel, 2010-01-27 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" - .include "em-error.inc" + .include "em-kernel.inc" + .include "em-error.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ @@ -19,19 +19,19 @@ ; Driver signature - .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte $65, $6d, $64 ; "emd" + .byte EMD_API_VERSION ; EM API version number ; Jump table. - .word INSTALL - .word UNINSTALL - .word PAGECOUNT - .word MAP - .word USE - .word COMMIT - .word COPYFROM - .word COPYTO + .word INSTALL + .word UNINSTALL + .word PAGECOUNT + .word MAP + .word USE + .word COMMIT + .word COPYFROM + .word COPYTO ; ------------------------------------------------------------------------ ; Constants @@ -96,13 +96,13 @@ done: stx $01 .bss -curpage: .res 2 ; Current page number -curbank: .res 1 ; Current bank -window: .res 256 ; Memory "window" +curpage: .res 2 ; Current page number +curbank: .res 1 ; Current bank +window: .res 256 ; Memory "window" ; Since the functions above are copied to $200, the current contents of this ; memory area must be saved into backup storage. Allocate enough space. -backup: .res .max (.sizeof (copy), .sizeof (check)) +backup: .res .max (.sizeof (copy), .sizeof (check)) @@ -115,52 +115,52 @@ backup: .res .max (.sizeof (copy), .sizeof (check)) ; INSTALL: - lda PIA+1 ; Select Peripheral Registers - ora #4 - sta PIA+1 + lda PIA+1 ; Select Peripheral Registers + ora #4 + sta PIA+1 tax - lda PIA+3 - ora #4 - sta PIA+3 + lda PIA+3 + ora #4 + sta PIA+3 tay - lda #$DC ; Set the default memory bank data - sta PIA - lda #$FE - sta PIA+2 + lda #$DC ; Set the default memory bank data + sta PIA + lda #$FE + sta PIA+2 - txa ; Select Data Direction Registers - and #$FB - sta PIA+1 + txa ; Select Data Direction Registers + and #$FB + sta PIA+1 tya - and #$FB - sta PIA+3 + and #$FB + sta PIA+3 - lda #$FF ; Set the ports to output - sta PIA - sta PIA+2 + lda #$FF ; Set the ports to output + sta PIA + sta PIA+2 txa - and #$C7 - ora #$30 ; Set CA1 and - sta PIA+1 ; select Peripheral Registers - sty PIA+3 + and #$C7 + ora #$30 ; Set CA1 and + sta PIA+1 ; select Peripheral Registers + sty PIA+3 - jsr backup_and_setup_check_routine - jsr check::entry + jsr backup_and_setup_check_routine + jsr check::entry cli - ldx #.sizeof (check) - 1 - jsr restore_data - cpy #$01 - beq @present - lda #EM_ERR_NO_DEVICE + ldx #.sizeof (check) - 1 + jsr restore_data + cpy #$01 + beq @present + lda #EM_ERR_NO_DEVICE rts @present: - lda #EM_ERR_OK -; rts ; Run into UNINSTALL instead + lda #EM_ERR_OK +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -176,8 +176,8 @@ UNINSTALL: ; PAGECOUNT: - lda #PAGES + lda #PAGES rts ; ------------------------------------------------------------------------ @@ -188,41 +188,41 @@ PAGECOUNT: MAP: sei - sta curpage ; Remember the new page - stx curpage+1 - jsr adjust_page_and_bank - stx curbank + sta curpage ; Remember the new page + stx curpage+1 + jsr adjust_page_and_bank + stx curbank clc - adc #>BASE - sta ptr1+1 - ldy #0 - sty ptr1 - jsr backup_and_setup_copy_routine - ldx #BASE + sta ptr1+1 + ldy #0 + sty ptr1 + jsr backup_and_setup_copy_routine + ldx #window ; Return the window address + jsr restore_copy_routine + lda #window ; Return the window address cli rts ; ------------------------------------------------------------------------ ; USE: Tell the driver that the window is now associated with a given page. -USE: sta curpage ; Remember the page - stx curpage+1 - lda #window ; Return the window +USE: sta curpage ; Remember the page + stx curpage+1 + lda #window ; Return the window rts ; ------------------------------------------------------------------------ @@ -230,32 +230,32 @@ USE: sta curpage ; Remember the page COMMIT: sei - lda curpage ; Get the current page - ldx curpage+1 + lda curpage ; Get the current page + ldx curpage+1 - jsr adjust_page_and_bank - stx curbank + jsr adjust_page_and_bank + stx curbank clc - adc #>BASE - sta ptr1+1 - ldy #0 - sty ptr1 - jsr backup_and_setup_copy_routine - ldx #BASE + sta ptr1+1 + ldy #0 + sty ptr1 + jsr backup_and_setup_copy_routine + ldx #BASE - sta ptr4+1 - lda tmp2 + inc ptr4+1 + lda ptr4+1 + cmp #$80 + bne @L3 + lda #>BASE + sta ptr4+1 + lda tmp2 clc - adc #$10 - sta tmp2 - jmp @L3 + adc #$10 + sta tmp2 + jmp @L3 ; ------------------------------------------------------------------------ ; COPYTO: Copy from linear into extended memory. A pointer to a structure @@ -332,8 +332,8 @@ COPYFROM: COPYTO: sei - jsr setup - jsr backup_and_setup_copy_routine + jsr setup + jsr backup_and_setup_copy_routine ; Setup is: ; @@ -344,101 +344,101 @@ COPYTO: ; - tmp1 contains zero (to be used for linear memory buffer offset) ; - tmp2 contains the bank value - lda #BASE - sta ptr4+1 - lda tmp2 + bne @L3 + lda #>BASE + sta ptr4+1 + lda tmp2 clc - adc #$10 - sta tmp2 - jmp @L3 + adc #$10 + sta tmp2 + jmp @L3 ; ------------------------------------------------------------------------ ; Helper function for COPYFROM and COPYTO: Store the pointer to the request ; structure and prepare data for the copy setup: - sta ptr1 - stx ptr1+1 ; Save passed pointer + sta ptr1 + stx ptr1+1 ; Save passed pointer ; Get the page number from the struct and adjust it so that it may be used ; with the hardware. That is: ptr4 has the page address and page offset ; tmp2 will hold the bank value - ldy #EM_COPY::PAGE+1 - lda (ptr1),y + ldy #EM_COPY::PAGE+1 + lda (ptr1),y tax - ldy #EM_COPY::PAGE - lda (ptr1),y - jsr adjust_page_and_bank + ldy #EM_COPY::PAGE + lda (ptr1),y + jsr adjust_page_and_bank clc - adc #>BASE - sta ptr4+1 - stx tmp2 + adc #>BASE + sta ptr4+1 + stx tmp2 ; Get the buffer pointer into ptr2 - ldy #EM_COPY::BUF - lda (ptr1),y - sta ptr2 + ldy #EM_COPY::BUF + lda (ptr1),y + sta ptr2 iny - lda (ptr1),y - sta ptr2+1 + lda (ptr1),y + sta ptr2+1 ; Get the count, calculate -(count-1) and store it into ptr3 - ldy #EM_COPY::COUNT - lda (ptr1),y - eor #$FF - sta ptr3 + ldy #EM_COPY::COUNT + lda (ptr1),y + eor #$FF + sta ptr3 iny - lda (ptr1),y - eor #$FF - sta ptr3+1 + lda (ptr1),y + eor #$FF + sta ptr3+1 ; Get the page offset into ptr4 and clear tmp1 - ldy #EM_COPY::OFFS - lda (ptr1),y - sta ptr4 - lda #0 - sta tmp1 + ldy #EM_COPY::OFFS + lda (ptr1),y + sta ptr4 + lda #0 + sta tmp1 ; Done @@ -447,47 +447,47 @@ setup: ; Helper routines for copying to and from the +256k ram backup_and_setup_copy_routine: - ldx #.sizeof (copy) - 1 + ldx #.sizeof (copy) - 1 @L1: - lda copy::entry,x - sta backup,x - lda copy::template,x - sta copy::entry,x + lda copy::entry,x + sta backup,x + lda copy::template,x + sta copy::entry,x dex - bpl @L1 + bpl @L1 rts backup_and_setup_check_routine: - ldx #.sizeof (check) - 1 + ldx #.sizeof (check) - 1 @L1: - lda check::entry,x - sta backup,x - lda check::template,x - sta check::entry,x + lda check::entry,x + sta backup,x + lda check::template,x + sta check::entry,x dex - bpl @L1 + bpl @L1 rts restore_copy_routine: - ldx #.sizeof (copy) - 1 + ldx #.sizeof (copy) - 1 restore_data: - lda backup,x - sta TARGETLOC,x + lda backup,x + sta TARGETLOC,x dex - bpl restore_data + bpl restore_data rts ; Helper routine to correct for the bank and page adjust_page_and_bank: - sta tmp4 - lda #$0C + sta tmp4 + lda #$0C sta tmp3 - lda tmp4 - and #$c0 + lda tmp4 + and #$c0 lsr lsr - ora tmp3 - sta tmp3 + ora tmp3 + sta tmp3 txa asl asl @@ -495,8 +495,8 @@ adjust_page_and_bank: asl asl asl - ora tmp3 + ora tmp3 tax - lda tmp4 - and #$3f + lda tmp4 + and #$3f rts diff --git a/libsrc/c64/emd/c64-dqbb.s b/libsrc/c64/emd/c64-dqbb.s index 3f581e11a..fcfeaeb9b 100644 --- a/libsrc/c64/emd/c64-dqbb.s +++ b/libsrc/c64/emd/c64-dqbb.s @@ -3,13 +3,13 @@ ; Marco van den Heuvel, 2010-01-27 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" - .include "em-error.inc" + .include "em-kernel.inc" + .include "em-error.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ @@ -19,19 +19,19 @@ ; Driver signature - .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte $65, $6d, $64 ; "emd" + .byte EMD_API_VERSION ; EM API version number ; Jump table. - .word INSTALL - .word UNINSTALL - .word PAGECOUNT - .word MAP - .word USE - .word COMMIT - .word COPYFROM - .word COPYTO + .word INSTALL + .word UNINSTALL + .word PAGECOUNT + .word MAP + .word USE + .word COMMIT + .word COPYFROM + .word COPYTO ; ------------------------------------------------------------------------ ; Constants @@ -115,12 +115,12 @@ address := *+1 ; Patched at runtime .bss -curpage: .res 1 ; Current page number -window: .res 256 ; Memory "window" +curpage: .res 1 ; Current page number +window: .res 256 ; Memory "window" ; Since the functions above are copied to $200, the current contents of this ; memory area must be saved into backup storage. Allocate enough space. -backup: .res .max (.sizeof (copy), .sizeof (check)) +backup: .res .max (.sizeof (copy), .sizeof (check)) @@ -135,21 +135,21 @@ backup: .res .max (.sizeof (copy), .sizeof (check)) INSTALL: sei - jsr backup_and_setup_check_routine - jsr check::entry + jsr backup_and_setup_check_routine + jsr check::entry cli - ldx #.sizeof (check) - 1 - jsr restore_data - cpy #$01 - beq @present - lda #EM_ERR_NO_DEVICE + ldx #.sizeof (check) - 1 + jsr restore_data + cpy #$01 + beq @present + lda #EM_ERR_NO_DEVICE rts @present: - lda #EM_ERR_OK -; rts ; Run into UNINSTALL instead + lda #EM_ERR_OK +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -165,8 +165,8 @@ UNINSTALL: ; PAGECOUNT: - lda #PAGES + lda #PAGES rts ; ------------------------------------------------------------------------ @@ -177,37 +177,37 @@ PAGECOUNT: MAP: sei - sta curpage ; Remember the new page + sta curpage ; Remember the new page clc - adc #>BASE - sta ptr1+1 - ldy #0 - sty ptr1 - jsr backup_and_setup_copy_routine - ldx #BASE + sta ptr1+1 + ldy #0 + sty ptr1 + jsr backup_and_setup_copy_routine + ldx #window ; Return the window address + jsr restore_copy_routine + lda #window ; Return the window address cli rts ; ------------------------------------------------------------------------ ; USE: Tell the driver that the window is now associated with a given page. -USE: sta curpage ; Remember the page - lda #window ; Return the window +USE: sta curpage ; Remember the page + lda #window ; Return the window rts ; ------------------------------------------------------------------------ @@ -215,26 +215,26 @@ USE: sta curpage ; Remember the page COMMIT: sei - lda curpage ; Get the current page + lda curpage ; Get the current page clc - adc #>BASE - sta ptr1+1 - ldy #0 - sty ptr1 - jsr backup_and_setup_copy_routine - ldx #BASE + sta ptr1+1 + ldy #0 + sty ptr1 + jsr backup_and_setup_copy_routine + ldx #BASE - sta ptr4+1 + adc #>BASE + sta ptr4+1 ; Get the buffer pointer into ptr2 - ldy #EM_COPY::BUF - lda (ptr1),y - sta ptr2 + ldy #EM_COPY::BUF + lda (ptr1),y + sta ptr2 iny - lda (ptr1),y - sta ptr2+1 + lda (ptr1),y + sta ptr2+1 ; Get the count, calculate -(count-1) and store it into ptr3 - ldy #EM_COPY::COUNT - lda (ptr1),y - eor #$FF - sta ptr3 + ldy #EM_COPY::COUNT + lda (ptr1),y + eor #$FF + sta ptr3 iny - lda (ptr1),y - eor #$FF - sta ptr3+1 + lda (ptr1),y + eor #$FF + sta ptr3+1 ; Get the page offset into ptr4 and clear tmp1 - ldy #EM_COPY::OFFS - lda (ptr1),y - sta ptr4 - lda #0 - sta tmp1 + ldy #EM_COPY::OFFS + lda (ptr1),y + sta ptr4 + lda #0 + sta tmp1 ; Done @@ -410,32 +410,32 @@ setup: ; Helper routines for copying to and from the +256k ram backup_and_setup_copy_routine: - ldx #.sizeof (copy) - 1 + ldx #.sizeof (copy) - 1 @L1: - lda copy::entry,x - sta backup,x - lda copy::template,x - sta copy::entry,x + lda copy::entry,x + sta backup,x + lda copy::template,x + sta copy::entry,x dex - bpl @L1 + bpl @L1 rts backup_and_setup_check_routine: - ldx #.sizeof (check) - 1 + ldx #.sizeof (check) - 1 @L1: - lda check::entry,x - sta backup,x - lda check::template,x - sta check::entry,x + lda check::entry,x + sta backup,x + lda check::template,x + sta check::entry,x dex - bpl @L1 + bpl @L1 rts restore_copy_routine: - ldx #.sizeof (copy) - 1 + ldx #.sizeof (copy) - 1 restore_data: - lda backup,x - sta TARGETLOC,x + lda backup,x + sta TARGETLOC,x dex - bpl restore_data + bpl restore_data rts diff --git a/libsrc/c64/emd/c64-georam.s b/libsrc/c64/emd/c64-georam.s index 5b1f64b8c..0c106f406 100644 --- a/libsrc/c64/emd/c64-georam.s +++ b/libsrc/c64/emd/c64-georam.s @@ -8,9 +8,9 @@ ; Marco van den Heuvel, 2010-01-21 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" + .include "em-kernel.inc" .include "em-error.inc" @@ -25,7 +25,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -35,7 +35,7 @@ .word MAP .word USE .word COMMIT - .word COPYFROM + .word COPYFROM .word COPYTO ; ------------------------------------------------------------------------ @@ -62,83 +62,83 @@ pagecount: .res 2 ; Number of available pages ; INSTALL: - ldx GR_WINDOW + ldx GR_WINDOW cpx GR_WINDOW bne @notpresent inc GR_WINDOW - cpx GR_WINDOW - beq @notpresent + cpx GR_WINDOW + beq @notpresent - lda #4 - jsr check - cpy GR_WINDOW - beq @has64k - lda #8 - jsr check - cpy GR_WINDOW - beq @has128k - lda #16 - jsr check - cpy GR_WINDOW - beq @has256k - lda #32 - jsr check - cpy GR_WINDOW - beq @has512k - lda #64 - jsr check - cpy GR_WINDOW - beq @has1024k - lda #128 - jsr check - cpy GR_WINDOW - beq @has2048k - ldx #>16384 + lda #4 + jsr check + cpy GR_WINDOW + beq @has64k + lda #8 + jsr check + cpy GR_WINDOW + beq @has128k + lda #16 + jsr check + cpy GR_WINDOW + beq @has256k + lda #32 + jsr check + cpy GR_WINDOW + beq @has512k + lda #64 + jsr check + cpy GR_WINDOW + beq @has1024k + lda #128 + jsr check + cpy GR_WINDOW + beq @has2048k + ldx #>16384 bne @setok @has64k: - ldx #>256 - bne @setok + ldx #>256 + bne @setok @has128k: - ldx #>512 - bne @setok + ldx #>512 + bne @setok @has256k: - ldx #>1024 - bne @setok + ldx #>1024 + bne @setok @has512k: - ldx #>2048 - bne @setok + ldx #>2048 + bne @setok @has1024k: - ldx #>4096 - bne @setok + ldx #>4096 + bne @setok @has2048k: - ldx #>8192 - bne @setok + ldx #>8192 + bne @setok @notpresent: - lda #EM_ERR_NO_DEVICE - rts + lda #EM_ERR_NO_DEVICE + rts @setok: - lda #0 - sta pagecount - stx pagecount+1 - lda #EM_ERR_OK - rts + lda #0 + sta pagecount + stx pagecount+1 + lda #EM_ERR_OK + rts check: - ldx #0 - stx GR_PAGE_LO - stx GR_PAGE_HI - ldy GR_WINDOW - iny - sta GR_PAGE_HI - sty GR_WINDOW - ldx #0 - stx GR_PAGE_HI -; rts ; Run into UNINSTALL instead + ldx #0 + stx GR_PAGE_LO + stx GR_PAGE_HI + ldy GR_WINDOW + iny + sta GR_PAGE_HI + sty GR_WINDOW + ldx #0 + stx GR_PAGE_HI +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. diff --git a/libsrc/c64/emd/c64-isepic.s b/libsrc/c64/emd/c64-isepic.s index 533dfaffa..a2a2e4783 100644 --- a/libsrc/c64/emd/c64-isepic.s +++ b/libsrc/c64/emd/c64-isepic.s @@ -3,13 +3,13 @@ ; Marco van den Heuvel, 2010-01-24 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" - .include "em-error.inc" + .include "em-kernel.inc" + .include "em-error.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ @@ -19,24 +19,24 @@ ; Driver signature - .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte $65, $6d, $64 ; "emd" + .byte EMD_API_VERSION ; EM API version number ; Jump table. - .word INSTALL - .word UNINSTALL - .word PAGECOUNT - .word MAP - .word USE - .word COMMIT - .word COPYFROM - .word COPYTO + .word INSTALL + .word UNINSTALL + .word PAGECOUNT + .word MAP + .word USE + .word COMMIT + .word COPYFROM + .word COPYTO ; ------------------------------------------------------------------------ ; Constants -IP_WINDOW = $DF00 ; Address of ISEPIC window +IP_WINDOW = $DF00 ; Address of ISEPIC window IP_CTRL_BASE = $DE00 PAGES = 8 @@ -53,32 +53,32 @@ PAGES = 8 ; INSTALL: - lda #0 - sta IP_CTRL_BASE - ldx IP_WINDOW - cpx IP_WINDOW - bne @notpresent - inc IP_WINDOW - cpx IP_WINDOW - beq @notpresent - ldx IP_WINDOW - sta IP_CTRL_BASE+1 + lda #0 + sta IP_CTRL_BASE + ldx IP_WINDOW + cpx IP_WINDOW + bne @notpresent + inc IP_WINDOW + cpx IP_WINDOW + beq @notpresent + ldx IP_WINDOW + sta IP_CTRL_BASE+1 inx - stx IP_WINDOW + stx IP_WINDOW dex - sta IP_CTRL_BASE - cpx IP_WINDOW - beq @setok + sta IP_CTRL_BASE + cpx IP_WINDOW + beq @setok @notpresent: - lda #EM_ERR_NO_DEVICE + lda #EM_ERR_NO_DEVICE rts @setok: - lda #EM_ERR_OK -; rts ; Run into UNINSTALL instead + lda #EM_ERR_OK +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -93,8 +93,8 @@ UNINSTALL: ; PAGECOUNT: - lda #PAGES + lda #PAGES rts ; ------------------------------------------------------------------------ @@ -112,9 +112,9 @@ USE := MAP MAP: tax - sta IP_CTRL_BASE,x - lda #IP_WINDOW + sta IP_CTRL_BASE,x + lda #IP_WINDOW ; Use the RTS from COMMIT below to save a precious byte of storage @@ -131,7 +131,7 @@ COMMIT: ; COPYFROM: - jsr setup + jsr setup ; Setup is: ; @@ -142,37 +142,37 @@ COPYFROM: ; - X contains the page offset ; - Y contains zero - jmp @L5 + jmp @L5 @L1: - lda IP_WINDOW,x - sta (ptr2),y + lda IP_WINDOW,x + sta (ptr2),y iny - bne @L2 - inc ptr2+1 + bne @L2 + inc ptr2+1 @L2: inx - beq @L4 + beq @L4 ; Bump count and repeat @L3: - inc ptr3 - bne @L1 - inc ptr3+1 - bne @L1 + inc ptr3 + bne @L1 + inc ptr3+1 + bne @L1 rts ; Bump page register @L4: - inc tmp1 ; Bump low page register + inc tmp1 ; Bump low page register @L5: - stx tmp2 - ldx tmp1 - sta IP_CTRL_BASE,x - ldx tmp2 - jmp @L3 + stx tmp2 + ldx tmp1 + sta IP_CTRL_BASE,x + ldx tmp2 + jmp @L3 ; ------------------------------------------------------------------------ ; COPYTO: Copy from linear into extended memory. A pointer to a structure @@ -181,7 +181,7 @@ COPYFROM: ; COPYTO: - jsr setup + jsr setup ; Setup is: ; @@ -192,78 +192,78 @@ COPYTO: ; - X contains the page offset ; - Y contains zero - jmp @L5 + jmp @L5 @L1: - lda (ptr2),y - sta IP_WINDOW,x + lda (ptr2),y + sta IP_WINDOW,x iny - bne @L2 - inc ptr2+1 + bne @L2 + inc ptr2+1 @L2: inx - beq @L4 + beq @L4 ; Bump count and repeat @L3: - inc ptr3 - bne @L1 - inc ptr3+1 - bne @L1 + inc ptr3 + bne @L1 + inc ptr3+1 + bne @L1 rts ; Bump page register @L4: - inc tmp1 ; Bump page register + inc tmp1 ; Bump page register @L5: - stx tmp2 - ldx tmp1 - sta IP_CTRL_BASE,x - ldx tmp2 - jmp @L3 + stx tmp2 + ldx tmp1 + sta IP_CTRL_BASE,x + ldx tmp2 + jmp @L3 ; ------------------------------------------------------------------------ ; Helper function for COPYFROM and COPYTO: Store the pointer to the request ; structure and prepare data for the copy setup: - sta ptr1 - stx ptr1+1 ; Save passed pointer + sta ptr1 + stx ptr1+1 ; Save passed pointer ; Get the page number from the struct and remember it. - ldy #EM_COPY::PAGE - lda (ptr1),y - sta tmp1 + ldy #EM_COPY::PAGE + lda (ptr1),y + sta tmp1 ; Get the buffer pointer into ptr2 - ldy #EM_COPY::BUF - lda (ptr1),y - sta ptr2 + ldy #EM_COPY::BUF + lda (ptr1),y + sta ptr2 iny - lda (ptr1),y - sta ptr2+1 + lda (ptr1),y + sta ptr2+1 ; Get the count, calculate -(count-1) and store it into ptr3 - ldy #EM_COPY::COUNT - lda (ptr1),y - eor #$FF - sta ptr3 + ldy #EM_COPY::COUNT + lda (ptr1),y + eor #$FF + sta ptr3 iny - lda (ptr1),y - eor #$FF - sta ptr3+1 + lda (ptr1),y + eor #$FF + sta ptr3+1 ; Get the page offset into X and clear Y - ldy #EM_COPY::OFFS - lda (ptr1),y + ldy #EM_COPY::OFFS + lda (ptr1),y tax - ldy #0 + ldy #0 ; Done diff --git a/libsrc/c64/emd/c64-ram.s b/libsrc/c64/emd/c64-ram.s index f176eda49..1c2961591 100644 --- a/libsrc/c64/emd/c64-ram.s +++ b/libsrc/c64/emd/c64-ram.s @@ -5,9 +5,9 @@ ; Ullrich von Bassewitz, 2002-12-02 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" + .include "em-kernel.inc" .include "em-error.inc" @@ -22,7 +22,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -32,14 +32,14 @@ .word MAP .word USE .word COMMIT - .word COPYFROM + .word COPYFROM .word COPYTO ; ------------------------------------------------------------------------ ; Constants -BASE = $D000 -PAGES = ($10000 - BASE) / 256 +BASE = $D000 +PAGES = ($10000 - BASE) / 256 ; ------------------------------------------------------------------------ ; Data. @@ -88,18 +88,18 @@ PAGECOUNT: ; by the driver. ; -MAP: sta curpage ; Remember the new page +MAP: sta curpage ; Remember the new page clc - adc #>BASE - sta ptr1+1 - ldy #$00 - sty ptr1 + adc #>BASE + sta ptr1+1 + ldy #$00 + sty ptr1 - lda #window - sta ptr2+1 + lda #window + sta ptr2+1 ; Transfer one page @@ -122,36 +122,36 @@ USE: sta curpage ; Remember the page ; ------------------------------------------------------------------------ ; COMMIT: Commit changes in the memory window to extended storage. -COMMIT: lda curpage ; Get the current page +COMMIT: lda curpage ; Get the current page bmi done ; Jump if no page mapped clc - adc #>BASE - sta ptr2+1 - ldy #$00 - sty ptr2 + adc #>BASE + sta ptr2+1 + ldy #$00 + sty ptr2 - lda #window - sta ptr1+1 + lda #window + sta ptr1+1 ; Transfer one page. Y must be zero on entry transfer: - ldx $01 ; Remember c64 control port + ldx $01 ; Remember c64 control port txa - and #$F8 ; Bank out ROMs, I/O + and #$F8 ; Bank out ROMs, I/O sei - sta $01 + sta $01 ; Unroll the following loop -loop: .repeat 8 - lda (ptr1),y - sta (ptr2),y +loop: .repeat 8 + lda (ptr1),y + sta (ptr2),y iny - .endrepeat + .endrepeat bne loop @@ -162,7 +162,7 @@ loop: .repeat 8 ; Done -done: rts +done: rts ; ------------------------------------------------------------------------ ; COPYFROM: Copy from extended into linear memory. A pointer to a structure @@ -173,7 +173,7 @@ done: rts COPYFROM: sta ptr3 stx ptr3+1 ; Save the passed em_copy pointer - + ldy #EM_COPY::OFFS lda (ptr3),y sta ptr1 @@ -213,15 +213,15 @@ common: ldy #EM_COPY::COUNT+1 lda $01 ; Remember c64 control port pha - and #$F8 ; Bank out ROMs, I/O + and #$F8 ; Bank out ROMs, I/O sei - sta $01 + sta $01 ; Transfer the bytes in the last page ldy #$00 -@L3: lda (ptr1),y - sta (ptr2),y +@L3: lda (ptr1),y + sta (ptr2),y iny dex bne @L3 diff --git a/libsrc/c64/emd/c64-ramcart.s b/libsrc/c64/emd/c64-ramcart.s index 43e42af3b..b4192e74b 100644 --- a/libsrc/c64/emd/c64-ramcart.s +++ b/libsrc/c64/emd/c64-ramcart.s @@ -7,10 +7,10 @@ ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" - .include "em-error.inc" + .include "em-kernel.inc" + .include "em-error.inc" .macpack generic @@ -24,7 +24,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -32,9 +32,9 @@ .word UNINSTALL .word PAGECOUNT .word MAP - .word USE + .word USE .word COMMIT - .word COPYFROM + .word COPYFROM .word COPYTO ; ------------------------------------------------------------------------ @@ -61,46 +61,46 @@ pagecount: .res 2 ; Number of available pages ; INSTALL: - ldx RAMC_WINDOW - cpx RAMC_WINDOW - bne @notpresent + ldx RAMC_WINDOW + cpx RAMC_WINDOW + bne @notpresent - lda #0 - sta RAMC_PAGE_LO - sta RAMC_PAGE_HI - ldx RAMC_WINDOW - cpx RAMC_WINDOW - bne @notpresent - lda #2 - sta RAMC_WINDOW - cmp RAMC_WINDOW - beq @cont - cpx RAMC_WINDOW - beq @readonly -@cont: ldy #1 - sty RAMC_PAGE_HI - sty RAMC_WINDOW - dey - sty RAMC_PAGE_HI - iny - cpy RAMC_WINDOW - beq @rc64 - ; we're on rc128 - ldx #>512 - bne @setsize -@rc64: ldx #>256 + lda #0 + sta RAMC_PAGE_LO + sta RAMC_PAGE_HI + ldx RAMC_WINDOW + cpx RAMC_WINDOW + bne @notpresent + lda #2 + sta RAMC_WINDOW + cmp RAMC_WINDOW + beq @cont + cpx RAMC_WINDOW + beq @readonly +@cont: ldy #1 + sty RAMC_PAGE_HI + sty RAMC_WINDOW + dey + sty RAMC_PAGE_HI + iny + cpy RAMC_WINDOW + beq @rc64 + ; we're on rc128 + ldx #>512 + bne @setsize +@rc64: ldx #>256 @setsize: - lda #0 - sta pagecount - stx pagecount+1 + lda #0 + sta pagecount + stx pagecount+1 lda #EM_ERR_OK rts @notpresent: @readonly: - lda #EM_ERR_NO_DEVICE -; rts ; Run into UNINSTALL instead + lda #EM_ERR_NO_DEVICE +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -134,8 +134,8 @@ USE = MAP ; by the driver. ; -MAP: sta RAMC_PAGE_LO - stx RAMC_PAGE_HI +MAP: sta RAMC_PAGE_LO + stx RAMC_PAGE_HI lda #RAMC_WINDOW @@ -185,14 +185,14 @@ COPYFROM: ; Bump page register -@L4: inc tmp1 - bne @L5 - inc tmp2 -@L5: lda tmp1 - sta RAMC_PAGE_LO - lda tmp2 - sta RAMC_PAGE_HI - jmp @L3 +@L4: inc tmp1 + bne @L5 + inc tmp2 +@L5: lda tmp1 + sta RAMC_PAGE_LO + lda tmp2 + sta RAMC_PAGE_HI + jmp @L3 ; ------------------------------------------------------------------------ ; COPYTO: Copy from linear into extended memory. A pointer to a structure @@ -233,14 +233,14 @@ COPYTO: ; Bump page register -@L4: inc tmp1 - bne @L5 - inc tmp2 -@L5: lda tmp1 - sta RAMC_PAGE_LO - lda tmp2 - sta RAMC_PAGE_HI - jmp @L3 +@L4: inc tmp1 + bne @L5 + inc tmp2 +@L5: lda tmp1 + sta RAMC_PAGE_LO + lda tmp2 + sta RAMC_PAGE_HI + jmp @L3 ; ------------------------------------------------------------------------ ; Helper function for COPYFROM and COPYTO: Store the pointer to the request diff --git a/libsrc/c64/emd/c64-reu.s b/libsrc/c64/emd/c64-reu.s index 59dbb7913..133e0af03 100644 --- a/libsrc/c64/emd/c64-reu.s +++ b/libsrc/c64/emd/c64-reu.s @@ -5,9 +5,9 @@ ; Ullrich von Bassewitz, 2002-11-29 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" + .include "em-kernel.inc" .include "em-error.inc" @@ -22,7 +22,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -32,7 +32,7 @@ .word MAP .word USE .word COMMIT - .word COPYFROM + .word COPYFROM .word COPYTO ; ------------------------------------------------------------------------ @@ -60,12 +60,12 @@ curpage: .res 2 ; Current page number window: .res 256 ; Memory "window" -reu_params: .word $0000 ; Host address, lo, hi - .word $0000 ; Exp address, lo, hi - .byte $00 ; Expansion bank no. - .word $0000 ; # bytes to move, lo, hi - .byte $00 ; Interrupt mask reg. - .byte $00 ; Adress control reg. +reu_params: .word $0000 ; Host address, lo, hi + .word $0000 ; Exp address, lo, hi + .byte $00 ; Expansion bank no. + .word $0000 ; # bytes to move, lo, hi + .byte $00 ; Interrupt mask reg. + .byte $00 ; Adress control reg. .code @@ -142,7 +142,7 @@ done: rts ; ------------------------------------------------------------------------ ; USE: Tell the driver that the window is now associated with a given page. - + USE: sta curpage stx curpage+1 ; Remember the page lda #EM_ERR_NO_DEVICE - rts + lda #EM_ERR_NO_DEVICE + rts @present: - ldx #VDC_CSET ; determine size of RAM... - jsr vdcgetreg - sta tmp1 - ora #%00010000 - jsr vdcputreg ; turn on 64k + ldx #VDC_CSET ; determine size of RAM... + jsr vdcgetreg + sta tmp1 + ora #%00010000 + jsr vdcputreg ; turn on 64k - jsr settestadr1 ; save original value of test byte - jsr vdcgetbyte - sta tmp2 + jsr settestadr1 ; save original value of test byte + jsr vdcgetbyte + sta tmp2 - lda #$55 ; write $55 here - ldy #ptr1 - jsr test64k ; read it here and there - lda #$aa ; write $aa here - ldy #ptr2 - jsr test64k ; read it here and there + lda #$55 ; write $55 here + ldy #ptr1 + jsr test64k ; read it here and there + lda #$aa ; write $aa here + ldy #ptr2 + jsr test64k ; read it here and there - jsr settestadr1 - lda tmp2 - jsr vdcputbyte ; restore original value of test byte + jsr settestadr1 + lda tmp2 + jsr vdcputbyte ; restore original value of test byte - lda ptr1 ; do bytes match? - cmp ptr1+1 - bne @have64k - lda ptr2 - cmp ptr2+1 - bne @have64k + lda ptr1 ; do bytes match? + cmp ptr1+1 + bne @have64k + lda ptr2 + cmp ptr2+1 + bne @have64k - ldx #VDC_CSET - lda tmp1 - jsr vdcputreg ; restore 16/64k flag - jmp @endok ; and leave default values for 16k + ldx #VDC_CSET + lda tmp1 + jsr vdcputreg ; restore 16/64k flag + jmp @endok ; and leave default values for 16k @have64k: - lda #<256 - ldx #>256 - sta pagecount - stx pagecount+1 + lda #<256 + ldx #>256 + sta pagecount + stx pagecount+1 @endok: - lda #EM_ERR_OK rts test64k: - sta tmp1 - sty ptr3 - lda #0 - sta ptr3+1 - jsr settestadr1 - lda tmp1 - jsr vdcputbyte ; write $55 - jsr settestadr1 - jsr vdcgetbyte ; read here - pha - jsr settestadr2 - jsr vdcgetbyte ; and there - ldy #1 - sta (ptr3),y - pla - dey - sta (ptr3),y - rts + sta tmp1 + sty ptr3 + lda #0 + sta ptr3+1 + jsr settestadr1 + lda tmp1 + jsr vdcputbyte ; write $55 + jsr settestadr1 + jsr vdcgetbyte ; read here + pha + jsr settestadr2 + jsr vdcgetbyte ; and there + ldy #1 + sta (ptr3),y + pla + dey + sta (ptr3),y + rts settestadr1: - ldy #$02 ; test page 2 (here) - .byte $2c + ldy #$02 ; test page 2 (here) + .byte $2c settestadr2: - ldy #$42 ; or page 64+2 (there) - lda #0 - jmp vdcsetsrcaddr + ldy #$42 ; or page 64+2 (there) + lda #0 + jmp vdcsetsrcaddr ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -164,7 +164,7 @@ settestadr2: ; UNINSTALL: - ;on C128 restore font and clear the screen? + ;on C128 restore font and clear the screen? rts ; ------------------------------------------------------------------------ @@ -182,42 +182,42 @@ PAGECOUNT: ; by the driver. ; -MAP: sta curpage - stx curpage+1 - sta ptr1+1 - ldy #0 - sty ptr1 +MAP: sta curpage + stx curpage+1 + sta ptr1+1 + ldy #0 + sty ptr1 - lda #window - sta ptr2+1 + lda #window + sta ptr2+1 - jsr transferin + jsr transferin lda #window - rts + rts ; copy a single page from (ptr1):VDCRAM to (ptr2):RAM transferin: - lda ptr1 - ldy ptr1+1 - jsr vdcsetsrcaddr ; set source address in VDC - ldy #0 - ldx #VDC_DATA - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda VDC_DATA_REG ; get 2 bytes at a time to speed-up - sta (ptr2),y ; (in fact up to 8 bytes could be fetched with special VDC config) - iny - lda VDC_DATA_REG - sta (ptr2),y - iny - bne @L0 - rts + lda ptr1 + ldy ptr1+1 + jsr vdcsetsrcaddr ; set source address in VDC + ldy #0 + ldx #VDC_DATA + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda VDC_DATA_REG ; get 2 bytes at a time to speed-up + sta (ptr2),y ; (in fact up to 8 bytes could be fetched with special VDC config) + iny + lda VDC_DATA_REG + sta (ptr2),y + iny + bne @L0 + rts ; ------------------------------------------------------------------------ ; USE: Tell the driver that the window is now associated with a given page. @@ -232,36 +232,36 @@ done: rts ; COMMIT: Commit changes in the memory window to extended storage. COMMIT: - lda curpage ; jump if no page mapped - ldx curpage+1 - bmi done - sta ptr1+1 - ldy #0 - sty ptr1 + lda curpage ; jump if no page mapped + ldx curpage+1 + bmi done + sta ptr1+1 + ldy #0 + sty ptr1 - lda #window - sta ptr2+1 + lda #window + sta ptr2+1 ; fall through to transferout ; copy a single page from (ptr2):RAM to (ptr1):VDCRAM transferout: - lda ptr1 - ldy ptr1+1 - jsr vdcsetsrcaddr ; set source address in VDC - ldy #0 - ldx #VDC_DATA - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda (ptr2),y ; speedup does not work for writing - sta VDC_DATA_REG - iny - bne @L0 - rts + lda ptr1 + ldy ptr1+1 + jsr vdcsetsrcaddr ; set source address in VDC + ldy #0 + ldx #VDC_DATA + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda (ptr2),y ; speedup does not work for writing + sta VDC_DATA_REG + iny + bne @L0 + rts ; ------------------------------------------------------------------------ ; COPYFROM: Copy from extended into linear memory. A pointer to a structure @@ -270,8 +270,8 @@ transferout: ; COPYFROM: - jsr setup - beq @L2 ; Skip if no full pages + jsr setup + beq @L2 ; Skip if no full pages ; Copy full pages @@ -286,18 +286,18 @@ COPYFROM: @L2: ldy #EM_COPY::COUNT lda (ptr3),y ; Get bytes in last page beq @L4 - sta tmp1 + sta tmp1 ; Transfer the bytes in the last page - ldy #0 -@L3: jsr vdcgetbyte - sta (ptr2),y - iny - dec tmp1 - lda tmp1 - bne @L3 -@L4: rts + ldy #0 +@L3: jsr vdcgetbyte + sta (ptr2),y + iny + dec tmp1 + lda tmp1 + bne @L3 +@L4: rts ; ------------------------------------------------------------------------ ; COPYTO: Copy from linear into extended memory. A pointer to a structure @@ -306,8 +306,8 @@ COPYFROM: ; COPYTO: - jsr setup - beq @L2 ; Skip if no full pages + jsr setup + beq @L2 ; Skip if no full pages ; Copy full pages @@ -322,52 +322,52 @@ COPYTO: @L2: ldy #EM_COPY::COUNT lda (ptr3),y ; Get bytes in last page beq @L4 - sta tmp1 + sta tmp1 ; Transfer the bytes in the last page - ldy #0 -@L3: lda (ptr2),y - jsr vdcputbyte - iny - dec tmp1 - lda tmp1 - bne @L3 -@L4: rts + ldy #0 +@L3: lda (ptr2),y + jsr vdcputbyte + iny + dec tmp1 + lda tmp1 + bne @L3 +@L4: rts ;------------------------------------------------------------------------- ; Helper functions to handle VDC ram ; vdcsetsrcaddr: - ldx #VDC_DATA_LO - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - sta VDC_DATA_REG - dex - tya - stx VDC_ADDR_REG - sta VDC_DATA_REG - rts + ldx #VDC_DATA_LO + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + sta VDC_DATA_REG + dex + tya + stx VDC_ADDR_REG + sta VDC_DATA_REG + rts vdcgetbyte: - ldx #VDC_DATA + ldx #VDC_DATA vdcgetreg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda VDC_DATA_REG + rts vdcputbyte: - ldx #VDC_DATA + ldx #VDC_DATA vdcputreg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - sta VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + sta VDC_DATA_REG + rts ; ------------------------------------------------------------------------ ; Helper function for COPYFROM and COPYTO: Store the pointer to the request @@ -375,7 +375,7 @@ vdcputreg: ; setup: - sta ptr3 + sta ptr3 stx ptr3+1 ; Save the passed em_copy pointer ldy #EM_COPY::OFFS @@ -392,8 +392,8 @@ setup: lda (ptr3),y sta ptr2+1 ; To - ldy #EM_COPY::COUNT+1 + ldy #EM_COPY::COUNT+1 lda (ptr3),y ; Get number of pages sta tmp1 - rts + rts diff --git a/libsrc/c64/emd/dtv-himem.s b/libsrc/c64/emd/dtv-himem.s index 72a6bdc7a..555b0b95a 100644 --- a/libsrc/c64/emd/dtv-himem.s +++ b/libsrc/c64/emd/dtv-himem.s @@ -6,11 +6,11 @@ ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" + .include "em-kernel.inc" .include "em-error.inc" - .import _get_ostype + .import _get_ostype .macpack generic @@ -24,7 +24,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -34,7 +34,7 @@ .word MAP .word USE .word COMMIT - .word COPYFROM + .word COPYFROM .word COPYTO ; ------------------------------------------------------------------------ @@ -58,10 +58,10 @@ window: .res 256 ; Memory "window" ; The MAP and COMMIT entries will actually call COPYFROM/COPYTO with ; a pointer to the following data structure: -dma_params: .word window ; Host address +dma_params: .word window ; Host address .byte 0 ; Offset in page -curpage: .word $0000 ; Page - .word .sizeof (window); # bytes to move, lo, hi +curpage: .word $0000 ; Page + .word .sizeof (window); # bytes to move, lo, hi .code diff --git a/libsrc/c64/get_ostype.s b/libsrc/c64/get_ostype.s index 4058e116e..cddb5842a 100644 --- a/libsrc/c64/get_ostype.s +++ b/libsrc/c64/get_ostype.s @@ -14,30 +14,30 @@ ; $FF C64DTV ; - .export _get_ostype + .export _get_ostype -.proc _get_ostype +.proc _get_ostype - ldx #0 ; Clear high byte + ldx #0 ; Clear high byte - ldy #1 - sty $d03f - ldy $d040 - cpy $d000 - bne @c64dtv - inc $d000 - cpy $d040 - beq @c64dtv + ldy #1 + sty $d03f + ldy $d040 + cpy $d000 + bne @c64dtv + inc $d000 + cpy $d040 + beq @c64dtv ; Normal C64 - lda $ff80 - rts + lda $ff80 + rts ; C64 DTV @c64dtv: - stx $d03f - lda #$ff - rts + stx $d03f + lda #$ff + rts .endproc diff --git a/libsrc/c64/get_tv.s b/libsrc/c64/get_tv.s index 97d53b698..4f46b8d64 100644 --- a/libsrc/c64/get_tv.s +++ b/libsrc/c64/get_tv.s @@ -6,7 +6,7 @@ ; .include "c64.inc" - .include "get_tv.inc" + .include "get_tv.inc" ;-------------------------------------------------------------------------- ; _get_tv diff --git a/libsrc/c64/irq.s b/libsrc/c64/irq.s index 64e80c18e..10d03aa2c 100644 --- a/libsrc/c64/irq.s +++ b/libsrc/c64/irq.s @@ -2,48 +2,48 @@ ; IRQ handling (C64 version) ; - .export initirq, doneirq - .import callirq + .export initirq, doneirq + .import callirq - .include "c64.inc" + .include "c64.inc" ; ------------------------------------------------------------------------ -.segment "INIT" +.segment "INIT" initirq: - lda IRQVec - ldx IRQVec+1 - sta IRQInd+1 - stx IRQInd+2 - lda #IRQStub - jmp setvec + lda IRQVec + ldx IRQVec+1 + sta IRQInd+1 + stx IRQInd+2 + lda #IRQStub + jmp setvec ; ------------------------------------------------------------------------ .code doneirq: - lda IRQInd+1 - ldx IRQInd+2 -setvec: sei - sta IRQVec - stx IRQVec+1 - cli - rts + lda IRQInd+1 + ldx IRQInd+2 +setvec: sei + sta IRQVec + stx IRQVec+1 + cli + rts ; ------------------------------------------------------------------------ -.segment "LOWCODE" +.segment "LOWCODE" IRQStub: - cld ; Just to be sure - jsr callirq ; Call the functions - jmp IRQInd ; Jump to the saved IRQ vector + cld ; Just to be sure + jsr callirq ; Call the functions + jmp IRQInd ; Jump to the saved IRQ vector ; ------------------------------------------------------------------------ .data -IRQInd: jmp $0000 +IRQInd: jmp $0000 diff --git a/libsrc/c64/joy/c64-hitjoy.s b/libsrc/c64/joy/c64-hitjoy.s index ae09182dc..637244b87 100644 --- a/libsrc/c64/joy/c64-hitjoy.s +++ b/libsrc/c64/joy/c64-hitjoy.s @@ -20,8 +20,8 @@ ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) @@ -52,8 +52,8 @@ JOY_COUNT = 4 ; Number of joysticks we support .bss -temp3: .byte 0 -temp4: .byte 0 +temp3: .byte 0 +temp4: .byte 0 .code @@ -193,16 +193,16 @@ joy1: lda #$7F joy2: dex bne joy3 - ; ldx #0 - lda #$E0 - ldy #$FF + ; ldx #0 + lda #$E0 + ldy #$FF sei - sta CIA1_DDRA - lda CIA1_PRA - sty CIA1_DDRA + sta CIA1_DDRA + lda CIA1_PRA + sty CIA1_DDRA cli - and #$1F - eor #$1F + and #$1F + eor #$1F rts ; Read joystick 3 @@ -211,13 +211,13 @@ joy3: dex bne joy4 lda temp3 - eor #$1F + eor #$1F rts ; Read joystick 4 joy4: lda temp4 - eor #$1F + eor #$1F ldx #0 rts diff --git a/libsrc/c64/joy/c64-numpad.s b/libsrc/c64/joy/c64-numpad.s index a224be57a..28fd7e2b0 100644 --- a/libsrc/c64/joy/c64-numpad.s +++ b/libsrc/c64/joy/c64-numpad.s @@ -6,48 +6,48 @@ ; Based on Ullrich von Bassewitz, 2002-12-20 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" - .include "joy-error.inc" - .include "c64.inc" + .include "joy-kernel.inc" + .include "joy-error.inc" + .include "c64.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ ; Header. Includes jump table -.segment "JUMPTABLE" +.segment "JUMPTABLE" ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) - .byte $02 ; JOY_UP "8" - .byte $10 ; JOY_DOWN "2" - .byte $20 ; JOY_LEFT "4" - .byte $08 ; JOY_RIGHT "6" - .byte $04 ; JOY_FIRE "5" ENTER - .byte $00 ; JOY_FIRE2 unavailable - .byte $00 ; Future expansion - .byte $00 ; Future expansion + .byte $02 ; JOY_UP "8" + .byte $10 ; JOY_DOWN "2" + .byte $20 ; JOY_LEFT "4" + .byte $08 ; JOY_RIGHT "6" + .byte $04 ; JOY_FIRE "5" ENTER + .byte $00 ; JOY_FIRE2 unavailable + .byte $00 ; Future expansion + .byte $00 ; Future expansion ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr COUNT - .addr READ + .addr INSTALL + .addr UNINSTALL + .addr COUNT + .addr READ .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants -JOY_COUNT = 1 ; Number of joysticks we support +JOY_COUNT = 1 ; Number of joysticks we support ; ------------------------------------------------------------------------ @@ -71,7 +71,7 @@ INSTALL: lda #JOY_ERR_NO_DEVICE ; No C128 -> no numpad @C128: ldx #0 ; Set high byte -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -79,37 +79,37 @@ INSTALL: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ ; COUNT: Return the total number of available joysticks in a/x. ; -COUNT: lda #JOY_COUNT - ldx #0 - rts +COUNT: lda #JOY_COUNT + ldx #0 + rts ; ------------------------------------------------------------------------ ; READ: Read a particular joystick passed in A. ; -READ: tax ; Clear high byte - lda #$FD - ldy #$FE - sei - sta VIC_KBD_128 - lda CIA1_PRB - and #%00110000 - eor #%00110000 - lsr - lsr - sty VIC_KBD_128 - eor CIA1_PRB - iny - sty VIC_KBD_128 ; Reset to $FF - cli - and #%11111110 - eor #%11111110 - rts +READ: tax ; Clear high byte + lda #$FD + ldy #$FE + sei + sta VIC_KBD_128 + lda CIA1_PRB + and #%00110000 + eor #%00110000 + lsr + lsr + sty VIC_KBD_128 + eor CIA1_PRB + iny + sty VIC_KBD_128 ; Reset to $FF + cli + and #%11111110 + eor #%11111110 + rts diff --git a/libsrc/c64/joy/c64-ptvjoy.s b/libsrc/c64/joy/c64-ptvjoy.s index b4314968e..0b0e80e62 100644 --- a/libsrc/c64/joy/c64-ptvjoy.s +++ b/libsrc/c64/joy/c64-ptvjoy.s @@ -21,7 +21,7 @@ ; Driver signature .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) @@ -60,7 +60,7 @@ JOY_COUNT = 4 ; Number of joysticks we support INSTALL: lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -84,18 +84,18 @@ COUNT: ; READ: Read a particular joystick passed in A. ; -READ: tax ; Joystick number into X +READ: tax ; Joystick number into X bne joy2 ; Read joystick 1 -joy1: lda #$7F +joy1: lda #$7F sei - sta CIA1_PRA - lda CIA1_PRB + sta CIA1_PRA + lda CIA1_PRB cli - and #$1F - eor #$1F + and #$1F + eor #$1F rts ; Read joystick 2 @@ -103,15 +103,15 @@ joy1: lda #$7F joy2: dex bne joy3 - lda #$E0 - ldy #$FF + lda #$E0 + ldy #$FF sei - sta CIA1_DDRA - lda CIA1_PRA - sty CIA1_DDRA + sta CIA1_DDRA + lda CIA1_PRA + sty CIA1_DDRA cli - and #$1F - eor #$1F + and #$1F + eor #$1F rts ; Read joystick 3 diff --git a/libsrc/c64/joy/c64-stdjoy.s b/libsrc/c64/joy/c64-stdjoy.s index 8bbd7bbf8..dc9434f4c 100644 --- a/libsrc/c64/joy/c64-stdjoy.s +++ b/libsrc/c64/joy/c64-stdjoy.s @@ -5,9 +5,9 @@ ; Ullrich von Bassewitz, 2002-12-20 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" + .include "joy-kernel.inc" .include "joy-error.inc" .include "c64.inc" @@ -21,8 +21,8 @@ ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) @@ -66,7 +66,7 @@ INSTALL: lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -90,32 +90,32 @@ COUNT: ; READ: Read a particular joystick passed in A. ; -READ: tax ; Joystick number into X - bne joy2 +READ: tax ; Joystick number into X + bne joy2 ; Read joystick 1 -joy1: lda #$7F - sei - sta CIA1_PRA - lda CIA1_PRB - cli - and #$1F - eor #$1F - rts +joy1: lda #$7F + sei + sta CIA1_PRA + lda CIA1_PRB + cli + and #$1F + eor #$1F + rts ; Read joystick 2 -joy2: ldx #0 - lda #$E0 - ldy #$FF - sei - sta CIA1_DDRA - lda CIA1_PRA - sty CIA1_DDRA - cli - and #$1F - eor #$1F - rts +joy2: ldx #0 + lda #$E0 + ldy #$FF + sei + sta CIA1_DDRA + lda CIA1_PRA + sty CIA1_DDRA + cli + and #$1F + eor #$1F + rts diff --git a/libsrc/c64/joy_stat_stddrv.s b/libsrc/c64/joy_stat_stddrv.s index 7de5c7a1f..60a063035 100644 --- a/libsrc/c64/joy_stat_stddrv.s +++ b/libsrc/c64/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _c64_stdjoy_joy + .export _joy_static_stddrv + .import _c64_stdjoy_joy .rodata diff --git a/libsrc/c64/joy_stddrv.s b/libsrc/c64/joy_stddrv.s index 01f5c9c39..5845437ed 100644 --- a/libsrc/c64/joy_stddrv.s +++ b/libsrc/c64/joy_stddrv.s @@ -6,9 +6,9 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "c64-stdjoy.joy" +_joy_stddrv: .asciiz "c64-stdjoy.joy" diff --git a/libsrc/c64/kbhit.s b/libsrc/c64/kbhit.s index 9fa04b550..17e5c6fc1 100644 --- a/libsrc/c64/kbhit.s +++ b/libsrc/c64/kbhit.s @@ -4,15 +4,15 @@ ; unsigned char kbhit (void); ; - .export _kbhit + .export _kbhit - .include "c64.inc" + .include "c64.inc" .proc _kbhit ldx #0 ; High byte of return is always zero - lda KEY_COUNT ; Get number of characters + lda KEY_COUNT ; Get number of characters beq L9 lda #1 L9: rts diff --git a/libsrc/c64/kernal.s b/libsrc/c64/kernal.s index 22160c911..a4eaad0d7 100644 --- a/libsrc/c64/kernal.s +++ b/libsrc/c64/kernal.s @@ -47,42 +47,42 @@ ;----------------------------------------------------------------------------- ; All functions are available in the kernal jump table -CINT = $FF81 -IOINIT = $FF84 -RAMTAS = $FF87 -RESTOR = $FF8A -VECTOR = $FF8D -SETMSG = $FF90 -SECOND = $FF93 -TKSA = $FF96 -MEMTOP = $FF99 -MEMBOT = $FF9C -SCNKEY = $FF9F -SETTMO = $FFA2 -ACPTR = $FFA5 -CIOUT = $FFA8 -UNTLK = $FFAB -UNLSN = $FFAE -LISTEN = $FFB1 -TALK = $FFB4 -READST = $FFB7 -SETLFS = $FFBA -SETNAM = $FFBD -OPEN = $FFC0 -CLOSE = $FFC3 -CHKIN = $FFC6 -CKOUT = $FFC9 -CLRCH = $FFCC -BASIN = $FFCF -BSOUT = $FFD2 -LOAD = $FFD5 -SAVE = $FFD8 -SETTIM = $FFDB -RDTIM = $FFDE -STOP = $FFE1 -GETIN = $FFE4 -CLALL = $FFE7 -UDTIM = $FFEA -SCREEN = $FFED -IOBASE = $FFF3 +CINT = $FF81 +IOINIT = $FF84 +RAMTAS = $FF87 +RESTOR = $FF8A +VECTOR = $FF8D +SETMSG = $FF90 +SECOND = $FF93 +TKSA = $FF96 +MEMTOP = $FF99 +MEMBOT = $FF9C +SCNKEY = $FF9F +SETTMO = $FFA2 +ACPTR = $FFA5 +CIOUT = $FFA8 +UNTLK = $FFAB +UNLSN = $FFAE +LISTEN = $FFB1 +TALK = $FFB4 +READST = $FFB7 +SETLFS = $FFBA +SETNAM = $FFBD +OPEN = $FFC0 +CLOSE = $FFC3 +CHKIN = $FFC6 +CKOUT = $FFC9 +CLRCH = $FFCC +BASIN = $FFCF +BSOUT = $FFD2 +LOAD = $FFD5 +SAVE = $FFD8 +SETTIM = $FFDB +RDTIM = $FFDE +STOP = $FFE1 +GETIN = $FFE4 +CLALL = $FFE7 +UDTIM = $FFEA +SCREEN = $FFED +IOBASE = $FFF3 diff --git a/libsrc/c64/mainargs.s b/libsrc/c64/mainargs.s index 6b2f624bf..1c9031eb0 100644 --- a/libsrc/c64/mainargs.s +++ b/libsrc/c64/mainargs.s @@ -22,16 +22,16 @@ ; - The "file-name" might be a path-name; don't copy the directory-components. ; - Add a control-character quoting mechanism. - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv - .include "c64.inc" + .include "c64.inc" -MAXARGS = 10 ; Maximum number of arguments allowed -REM = $8f ; BASIC token-code -NAME_LEN = 16 ; maximum length of command-name +MAXARGS = 10 ; Maximum number of arguments allowed +REM = $8f ; BASIC token-code +NAME_LEN = 16 ; maximum length of command-name ; Get possible command-line arguments. Goes into the special INIT segment, ; which may be reused after the startup code is run @@ -45,25 +45,25 @@ initmainargs: ; Because the buffer, that we're copying into, was zeroed out, ; we don't need to add a NUL character. ; - ldy FNAM_LEN - cpy #NAME_LEN + 1 - bcc L1 - ldy #NAME_LEN - 1 ; limit the length -L0: lda (FNAM),y - sta name,y -L1: dey - bpl L0 - inc __argc ; argc always is equal to, at least, 1 + ldy FNAM_LEN + cpy #NAME_LEN + 1 + bcc L1 + ldy #NAME_LEN - 1 ; limit the length +L0: lda (FNAM),y + sta name,y +L1: dey + bpl L0 + inc __argc ; argc always is equal to, at least, 1 ; Find the "rem" token. ; - ldx #0 -L2: lda BASIC_BUF,x - beq done ; no "rem," no args. - inx - cmp #REM - bne L2 - ldy #1 * 2 + ldx #0 +L2: lda BASIC_BUF,x + beq done ; no "rem," no args. + inx + cmp #REM + bne L2 + ldy #1 * 2 ; Find the next argument @@ -89,11 +89,11 @@ setterm:sta term ; Set end of argument marker ; necessary. txa ; Get low byte - sta argv,y ; argv[y]= &arg - iny - lda #>BASIC_BUF - sta argv,y - iny + sta argv,y ; argv[y]= &arg + iny + lda #>BASIC_BUF + sta argv,y + iny inc __argc ; Found another arg ; Search for the end of the argument @@ -120,21 +120,21 @@ argloop:lda BASIC_BUF,x ; (The last vector in argv[] already is NULL.) -done: lda #argv - sta __argv - stx __argv + 1 - rts +done: lda #argv + sta __argv + stx __argv + 1 + rts ; These arrays are zeroed before initmainargs is called. -; char name[16+1]; +; char name[16+1]; ; char* argv[MAXARGS+1]={name}; ; .bss -term: .res 1 -name: .res NAME_LEN + 1 +term: .res 1 +name: .res NAME_LEN + 1 .data argv: .addr name - .res MAXARGS * 2 + .res MAXARGS * 2 diff --git a/libsrc/c64/mcbdefault.s b/libsrc/c64/mcbdefault.s index f9af34f78..96c7c9ef4 100644 --- a/libsrc/c64/mcbdefault.s +++ b/libsrc/c64/mcbdefault.s @@ -64,13 +64,13 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register txa adc #0 bne @L1 ; Branch if high byte not zero - lda VIC_SPR_HI_X ; Get high X bits of all sprites - and #MOUSE_SPR_NMASK ; Clear high bit for sprite + lda VIC_SPR_HI_X ; Get high X bits of all sprites + and #MOUSE_SPR_NMASK ; Clear high bit for sprite sta VIC_SPR_HI_X rts -@L1: lda VIC_SPR_HI_X ; Get high X bits of all sprites - ora #MOUSE_SPR_MASK ; Set high bit for sprite +@L1: lda VIC_SPR_HI_X ; Get high X bits of all sprites + ora #MOUSE_SPR_MASK ; Set high bit for sprite sta VIC_SPR_HI_X rts @@ -83,7 +83,7 @@ VIC_SPR_Y = (VIC_SPR0_Y + 2*MOUSE_SPR) ; Sprite Y register .proc movey add #50 ; Y correction (first visible line) - sta VIC_SPR_Y ; Set Y position + sta VIC_SPR_Y ; Set Y position rts .endproc diff --git a/libsrc/c64/mou/c64-1351.s b/libsrc/c64/mou/c64-1351.s index 8dd5c012c..7ffc0510e 100644 --- a/libsrc/c64/mou/c64-1351.s +++ b/libsrc/c64/mou/c64-1351.s @@ -26,7 +26,7 @@ .include "zeropage.inc" .include "mouse-kernel.inc" - .include "c64.inc" + .include "c64.inc" .macpack generic @@ -72,7 +72,7 @@ CMOVEY: jmp $0000 ; Move the cursor to Y coord ;---------------------------------------------------------------------------- ; Constants -SCREEN_HEIGHT = YSIZE * 8 - 1 ; (origin is zero) +SCREEN_HEIGHT = YSIZE * 8 - 1 ; (origin is zero) SCREEN_WIDTH = XSIZE * 8 - 1 ;---------------------------------------------------------------------------- @@ -83,19 +83,19 @@ SCREEN_WIDTH = XSIZE * 8 - 1 .bss Vars: -OldPotX: .res 1 ; Old hw counter values -OldPotY: .res 1 +OldPotX: .res 1 ; Old hw counter values +OldPotY: .res 1 XPos: .res 2 ; Current mouse position, X YPos: .res 2 ; Current mouse position, Y -XMin: .res 2 ; X1 value of bounding box -YMin: .res 2 ; Y1 value of bounding box -XMax: .res 2 ; X2 value of bounding box -YMax: .res 2 ; Y2 value of bounding box -Buttons: .res 1 ; button status bits +XMin: .res 2 ; X1 value of bounding box +YMin: .res 2 ; Y1 value of bounding box +XMax: .res 2 ; X2 value of bounding box +YMax: .res 2 ; Y2 value of bounding box +Buttons: .res 1 ; button status bits -OldValue: .res 1 ; Temp for MoveCheck routine -NewValue: .res 1 ; Temp for MoveCheck routine +OldValue: .res 1 ; Temp for MoveCheck routine +NewValue: .res 1 ; Temp for MoveCheck routine ; Default values for above variables @@ -111,7 +111,7 @@ NewValue: .res 1 ; Temp for MoveCheck routine .word 0 ; YMin .word SCREEN_WIDTH ; XMax .word SCREEN_HEIGHT ; YMax - .byte %00000000 ; Buttons + .byte %00000000 ; Buttons .endproc .code @@ -200,7 +200,7 @@ SETBOX: sta ptr1 bpl @L1 cli - rts + rts ;---------------------------------------------------------------------------- ; GETBOX: Return the mouse bounding box. The parameters are passed as they @@ -214,7 +214,7 @@ GETBOX: sta ptr1 sta (ptr1),y dey bpl @L1 - rts + rts ;---------------------------------------------------------------------------- ; MOVE: Move the mouse to a new position. The position is passed as it comes @@ -238,42 +238,42 @@ MOVE: sei ; No interrupts lda (sp),y sta XPos ; New X position - jsr CMOVEX ; Move the cursor + jsr CMOVEX ; Move the cursor - cli ; Allow interrupts - rts + cli ; Allow interrupts + rts ;---------------------------------------------------------------------------- ; BUTTONS: Return the button mask in a/x. BUTTONS: - lda Buttons + lda Buttons ldx #0 - and #$1F + and #$1F rts ;---------------------------------------------------------------------------- ; POS: Return the mouse position in the MOUSE_POS struct pointed to by ptr1. ; No return code required. -POS: ldy #MOUSE_POS::XCOORD ; Structure offset +POS: ldy #MOUSE_POS::XCOORD ; Structure offset - sei ; Disable interrupts - lda XPos ; Transfer the position - sta (ptr1),y - lda XPos+1 - iny - sta (ptr1),y - lda YPos + sei ; Disable interrupts + lda XPos ; Transfer the position + sta (ptr1),y + lda XPos+1 iny sta (ptr1),y - lda YPos+1 - cli ; Enable interrupts + lda YPos + iny + sta (ptr1),y + lda YPos+1 + cli ; Enable interrupts iny sta (ptr1),y ; Store last byte - rts ; Done + rts ; Done ;---------------------------------------------------------------------------- ; INFO: Returns mouse position and current button mask in the MOUSE_INFO @@ -284,15 +284,15 @@ POS: ldy #MOUSE_POS::XCOORD ; Structure offset ; call _mouse_pos to initialize the struct pointer and fill the position ; fields. -INFO: jsr POS +INFO: jsr POS ; Fill in the button state - jsr BUTTONS ; Will not touch ptr1 - ldy #MOUSE_INFO::BUTTONS - sta (ptr1),y + jsr BUTTONS ; Will not touch ptr1 + ldy #MOUSE_INFO::BUTTONS + sta (ptr1),y - rts + rts ;---------------------------------------------------------------------------- ; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl @@ -316,51 +316,51 @@ IRQ: ; Record the state of the buttons. ; Avoid crosstalk between the keyboard and the mouse. - ldy #%00000000 ; Set ports A and B to input - sty CIA1_DDRB - sty CIA1_DDRA ; Keyboard won't look like mouse - lda CIA1_PRB ; Read Control-Port 1 - dec CIA1_DDRA ; Set port A back to output - eor #%11111111 ; Bit goes up when button goes down - sta Buttons - beq @L0 ;(bze) - dec CIA1_DDRB ; Mouse won't look like keyboard - sty CIA1_PRB ; Set "all keys pushed" + ldy #%00000000 ; Set ports A and B to input + sty CIA1_DDRB + sty CIA1_DDRA ; Keyboard won't look like mouse + lda CIA1_PRB ; Read Control-Port 1 + dec CIA1_DDRA ; Set port A back to output + eor #%11111111 ; Bit goes up when button goes down + sta Buttons + beq @L0 ;(bze) + dec CIA1_DDRB ; Mouse won't look like keyboard + sty CIA1_PRB ; Set "all keys pushed" -@L0: lda SID_ADConv1 ; Get mouse X movement - ldy OldPotX - jsr MoveCheck ; Calculate movement vector +@L0: lda SID_ADConv1 ; Get mouse X movement + ldy OldPotX + jsr MoveCheck ; Calculate movement vector ; Skip processing if nothing has changed bcc @SkipX - sty OldPotX + sty OldPotX ; Calculate the new X coordinate (--> a/y) - add XPos - tay ; Remember low byte - txa - adc XPos+1 - tax + add XPos + tay ; Remember low byte + txa + adc XPos+1 + tax ; Limit the X coordinate to the bounding box - cpy XMin - sbc XMin+1 - bpl @L1 - ldy XMin - ldx XMin+1 - jmp @L2 -@L1: txa + cpy XMin + sbc XMin+1 + bpl @L1 + ldy XMin + ldx XMin+1 + jmp @L2 +@L1: txa - cpy XMax - sbc XMax+1 - bmi @L2 - ldy XMax - ldx XMax+1 -@L2: sty XPos - stx XPos+1 + cpy XMax + sbc XMax+1 + bmi @L2 + ldy XMax + ldx XMax+1 +@L2: sty XPos + stx XPos+1 ; Move the mouse pointer to the new X pos @@ -369,43 +369,43 @@ IRQ: ; Calculate the Y movement vector -@SkipX: lda SID_ADConv2 ; Get mouse Y movement - ldy OldPotY - jsr MoveCheck ; Calculate movement +@SkipX: lda SID_ADConv2 ; Get mouse Y movement + ldy OldPotY + jsr MoveCheck ; Calculate movement ; Skip processing if nothing has changed bcc @SkipY - sty OldPotY + sty OldPotY ; Calculate the new Y coordinate (--> a/y) - sta OldValue - lda YPos - sub OldValue - tay - stx OldValue - lda YPos+1 - sbc OldValue - tax + sta OldValue + lda YPos + sub OldValue + tay + stx OldValue + lda YPos+1 + sbc OldValue + tax ; Limit the Y coordinate to the bounding box - cpy YMin - sbc YMin+1 - bpl @L3 - ldy YMin - ldx YMin+1 - jmp @L4 -@L3: txa + cpy YMin + sbc YMin+1 + bpl @L3 + ldy YMin + ldx YMin+1 + jmp @L4 +@L3: txa - cpy YMax - sbc YMax+1 - bmi @L4 - ldy YMax - ldx YMax+1 -@L4: sty YPos - stx YPos+1 + cpy YMax + sbc YMax+1 + bmi @L4 + ldy YMax + ldx YMax+1 +@L4: sty YPos + stx YPos+1 ; Move the mouse pointer to the new Y pos @@ -421,38 +421,38 @@ IRQ: ; ; Move check routine, called for both coordinates. ; -; Entry: y = old value of pot register -; a = current value of pot register -; Exit: y = value to use for old value -; x/a = delta value for position +; Entry: y = old value of pot register +; a = current value of pot register +; Exit: y = value to use for old value +; x/a = delta value for position ; MoveCheck: - sty OldValue - sta NewValue - ldx #$00 + sty OldValue + sta NewValue + ldx #$00 - sub OldValue ; a = mod64 (new - old) - and #%01111111 - cmp #%01000000 ; if (a > 0) - bcs @L1 ; - lsr a ; a /= 2; - beq @L2 ; if (a != 0) - ldy NewValue ; y = NewValue + sub OldValue ; a = mod64 (new - old) + and #%01111111 + cmp #%01000000 ; if (a > 0) + bcs @L1 ; + lsr a ; a /= 2; + beq @L2 ; if (a != 0) + ldy NewValue ; y = NewValue sec - rts ; return + rts ; return -@L1: ora #%11000000 ; else, "or" in high-order bits - cmp #$FF ; if (a != -1) - beq @L2 - sec - ror a ; a /= 2 - dex ; high byte = -1 (X = $FF) - ldy NewValue +@L1: ora #%11000000 ; else, "or" in high-order bits + cmp #$FF ; if (a != -1) + beq @L2 sec - rts + ror a ; a /= 2 + dex ; high byte = -1 (X = $FF) + ldy NewValue + sec + rts -@L2: txa ; A = $00 +@L2: txa ; A = $00 clc - rts + rts diff --git a/libsrc/c64/mou/c64-joy.s b/libsrc/c64/mou/c64-joy.s index bd3236129..8390aa37d 100644 --- a/libsrc/c64/mou/c64-joy.s +++ b/libsrc/c64/mou/c64-joy.s @@ -25,7 +25,7 @@ .include "zeropage.inc" .include "mouse-kernel.inc" - .include "c64.inc" + .include "c64.inc" .macpack generic @@ -92,11 +92,11 @@ SCREEN_WIDTH = 320 Vars: YPos: .res 2 ; Current mouse position, Y XPos: .res 2 ; Current mouse position, X -XMin: .res 2 ; X1 value of bounding box -YMin: .res 2 ; Y1 value of bounding box -XMax: .res 2 ; X2 value of bounding box -YMax: .res 2 ; Y2 value of bounding box -Buttons: .res 1 ; Button mask +XMin: .res 2 ; X1 value of bounding box +YMin: .res 2 ; Y1 value of bounding box +XMax: .res 2 ; X2 value of bounding box +YMax: .res 2 ; Y2 value of bounding box +Buttons: .res 1 ; Button mask ; Temporary value used in the int handler @@ -113,7 +113,7 @@ Temp: .res 1 .word 0 ; YMin .word SCREEN_WIDTH ; XMax .word SCREEN_HEIGHT ; YMax - .byte 0 ; Buttons + .byte 0 ; Buttons .endproc .code @@ -202,7 +202,7 @@ SETBOX: sta ptr1 bpl @L1 cli - rts + rts ;---------------------------------------------------------------------------- ; GETBOX: Return the mouse bounding box. The parameters are passed as they @@ -218,7 +218,7 @@ GETBOX: sta ptr1 dey bpl @L1 - rts + rts ;---------------------------------------------------------------------------- ; MOVE: Move the mouse to a new position. The position is passed as it comes @@ -242,41 +242,41 @@ MOVE: sei ; No interrupts lda (sp),y sta XPos ; New X position - jsr CMOVEX ; Move the cursor + jsr CMOVEX ; Move the cursor - cli ; Allow interrupts - rts + cli ; Allow interrupts + rts ;---------------------------------------------------------------------------- ; BUTTONS: Return the button mask in a/x. BUTTONS: - lda Buttons - ldx #$00 - rts + lda Buttons + ldx #$00 + rts ;---------------------------------------------------------------------------- ; POS: Return the mouse position in the MOUSE_POS struct pointed to by ptr1. ; No return code required. -POS: ldy #MOUSE_POS::XCOORD ; Structure offset +POS: ldy #MOUSE_POS::XCOORD ; Structure offset - sei ; Disable interrupts - lda XPos ; Transfer the position - sta (ptr1),y - lda XPos+1 - iny - sta (ptr1),y - lda YPos + sei ; Disable interrupts + lda XPos ; Transfer the position + sta (ptr1),y + lda XPos+1 iny sta (ptr1),y - lda YPos+1 - cli ; Enable interrupts + lda YPos + iny + sta (ptr1),y + lda YPos+1 + cli ; Enable interrupts iny sta (ptr1),y ; Store last byte - rts ; Done + rts ; Done ;---------------------------------------------------------------------------- ; INFO: Returns mouse position and current button mask in the MOUSE_INFO @@ -287,15 +287,15 @@ POS: ldy #MOUSE_POS::XCOORD ; Structure offset ; call _mouse_pos to initialize the struct pointer and fill the position ; fields. -INFO: jsr POS +INFO: jsr POS ; Fill in the button state - lda Buttons - ldy #MOUSE_INFO::BUTTONS - sta (ptr1),y + lda Buttons + ldy #MOUSE_INFO::BUTTONS + sta (ptr1),y - rts + rts ;---------------------------------------------------------------------------- ; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl @@ -316,15 +316,15 @@ IOCTL: lda # a/y) @AddX: add XPos - tay ; Remember low byte - txa - adc XPos+1 - tax + tay ; Remember low byte + txa + adc XPos+1 + tax ; Limit the X coordinate to the bounding box - cpy XMin - sbc XMin+1 - bpl @L1 - ldy XMin - ldx XMin+1 - jmp @L2 -@L1: txa + cpy XMin + sbc XMin+1 + bpl @L1 + ldy XMin + ldx XMin+1 + jmp @L2 +@L1: txa - cpy XMax - sbc XMax+1 - bmi @L2 - ldy XMax - ldx XMax+1 -@L2: sty XPos - stx XPos+1 + cpy XMax + sbc XMax+1 + bmi @L2 + ldy XMax + ldx XMax+1 +@L2: sty XPos + stx XPos+1 ; Move the mouse pointer to the new X pos @@ -386,45 +386,45 @@ IRQ: ldy #%00000000 ; Set ports A and B to input ; Calculate the Y movement vector @SkipX: lda Temp ; Read joystick #0 - and #(JOY::UP | JOY::DOWN) ; Check up/down - beq @SkipY ; + and #(JOY::UP | JOY::DOWN) ; Check up/down + beq @SkipY ; ; We will cheat here and rely on the fact that either the up, OR the down ; bit can be active - lsr a ; Check UP bit - bcc @Down - lda #$FF - tax - bne @AddY -@Down: lda #$01 - ldx #$00 + lsr a ; Check UP bit + bcc @Down + lda #$FF + tax + bne @AddY +@Down: lda #$01 + ldx #$00 ; Calculate the new Y coordinate (--> a/y) -@AddY: add YPos - tay ; Remember low byte - txa - adc YPos+1 - tax +@AddY: add YPos + tay ; Remember low byte + txa + adc YPos+1 + tax ; Limit the Y coordinate to the bounding box - cpy YMin - sbc YMin+1 - bpl @L3 - ldy YMin - ldx YMin+1 - jmp @L4 -@L3: txa + cpy YMin + sbc YMin+1 + bpl @L3 + ldy YMin + ldx YMin+1 + jmp @L4 +@L3: txa - cpy YMax - sbc YMax+1 - bmi @L4 - ldy YMax - ldx YMax+1 -@L4: sty YPos - stx YPos+1 + cpy YMax + sbc YMax+1 + bmi @L4 + ldy YMax + ldx YMax+1 +@L4: sty YPos + stx YPos+1 ; Move the mouse pointer to the new X pos diff --git a/libsrc/c64/mou/c64-pot.s b/libsrc/c64/mou/c64-pot.s index b49552ae8..8ee0266e7 100644 --- a/libsrc/c64/mou/c64-pot.s +++ b/libsrc/c64/mou/c64-pot.s @@ -5,59 +5,59 @@ ; Stefan Haubenthal, 2006-08-20 ; - .include "zeropage.inc" - .include "mouse-kernel.inc" - .include "c64.inc" + .include "zeropage.inc" + .include "mouse-kernel.inc" + .include "c64.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ ; Header. Includes jump table -.segment "JUMPTABLE" +.segment "JUMPTABLE" HEADER: ; Driver signature - .byte $6d, $6f, $75 ; "mou" - .byte MOUSE_API_VERSION ; Mouse driver API version number + .byte $6d, $6f, $75 ; "mou" + .byte MOUSE_API_VERSION ; Mouse driver API version number ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr HIDE - .addr SHOW - .addr SETBOX + .addr INSTALL + .addr UNINSTALL + .addr HIDE + .addr SHOW + .addr SETBOX .addr GETBOX - .addr MOVE - .addr BUTTONS - .addr POS - .addr INFO - .addr IOCTL - .addr IRQ + .addr MOVE + .addr BUTTONS + .addr POS + .addr INFO + .addr IOCTL + .addr IRQ ; Callback table, set by the kernel before INSTALL is called -CHIDE: jmp $0000 ; Hide the cursor -CSHOW: jmp $0000 ; Show the cursor -CMOVEX: jmp $0000 ; Move the cursor to X coord -CMOVEY: jmp $0000 ; Move the cursor to Y coord +CHIDE: jmp $0000 ; Hide the cursor +CSHOW: jmp $0000 ; Show the cursor +CMOVEX: jmp $0000 ; Move the cursor to X coord +CMOVEY: jmp $0000 ; Move the cursor to Y coord ;---------------------------------------------------------------------------- ; Constants -SCREEN_HEIGHT = 200 -SCREEN_WIDTH = 320 +SCREEN_HEIGHT = 200 +SCREEN_WIDTH = 320 -.enum JOY - UP = $01 - DOWN = $02 - LEFT = $04 - RIGHT = $08 - FIRE = $10 +.enum JOY + UP = $01 + DOWN = $02 + LEFT = $04 + RIGHT = $08 + FIRE = $10 .endenum ;---------------------------------------------------------------------------- @@ -68,30 +68,30 @@ SCREEN_WIDTH = 320 .bss Vars: -YPos: .res 2 ; Current mouse position, Y -XPos: .res 2 ; Current mouse position, X -XMin: .res 2 ; X1 value of bounding box -YMin: .res 2 ; Y1 value of bounding box -XMax: .res 2 ; X2 value of bounding box -YMax: .res 2 ; Y2 value of bounding box -Buttons: .res 1 ; Button mask +YPos: .res 2 ; Current mouse position, Y +XPos: .res 2 ; Current mouse position, X +XMin: .res 2 ; X1 value of bounding box +YMin: .res 2 ; Y1 value of bounding box +XMax: .res 2 ; X2 value of bounding box +YMax: .res 2 ; Y2 value of bounding box +Buttons: .res 1 ; Button mask ; Temporary value used in the int handler -Temp: .res 1 +Temp: .res 1 ; Default values for above variables .rodata -.proc DefVars - .word SCREEN_HEIGHT/2 ; YPos - .word SCREEN_WIDTH/2 ; XPos - .word 0 ; XMin - .word 0 ; YMin - .word SCREEN_WIDTH ; XMax - .word SCREEN_HEIGHT ; YMax - .byte 0 ; Buttons +.proc DefVars + .word SCREEN_HEIGHT/2 ; YPos + .word SCREEN_WIDTH/2 ; XPos + .word 0 ; XMin + .word 0 ; YMin + .word SCREEN_WIDTH ; XMax + .word SCREEN_HEIGHT ; YMax + .byte 0 ; Buttons .endproc .code @@ -105,37 +105,37 @@ INSTALL: ; Initialize variables. Just copy the default stuff over - ldx #.sizeof(DefVars)-1 -@L1: lda DefVars,x - sta Vars,x - dex - bpl @L1 + ldx #.sizeof(DefVars)-1 +@L1: lda DefVars,x + sta Vars,x + dex + bpl @L1 ; Be sure the mouse cursor is invisible and at the default location. We ; need to do that here, because our mouse interrupt handler doesn't set the ; mouse position if it hasn't changed. - sei - jsr CHIDE - lda XPos - ldx XPos+1 - jsr CMOVEX - lda YPos - ldx YPos+1 - jsr CMOVEY - cli + sei + jsr CHIDE + lda XPos + ldx XPos+1 + jsr CMOVEX + lda YPos + ldx YPos+1 + jsr CMOVEY + cli ; Done, return zero (= MOUSE_ERR_OK) - ldx #$00 - txa - rts + ldx #$00 + txa + rts ;---------------------------------------------------------------------------- ; UNINSTALL routine. Is called before the driver is removed from memory. ; No return code required (the driver is removed from memory on return). -UNINSTALL = HIDE ; Hide cursor on exit +UNINSTALL = HIDE ; Hide cursor on exit ;---------------------------------------------------------------------------- ; HIDE routine. Is called to hide the mouse pointer. The mouse kernel manages @@ -144,10 +144,10 @@ UNINSTALL = HIDE ; Hide cursor on exit ; no special action is required besides hiding the mouse cursor. ; No return code required. -HIDE: sei - jsr CHIDE - cli - rts +HIDE: sei + jsr CHIDE + cli + rts ;---------------------------------------------------------------------------- ; SHOW routine. Is called to show the mouse pointer. The mouse kernel manages @@ -156,10 +156,10 @@ HIDE: sei ; no special action is required besides enabling the mouse cursor. ; No return code required. -SHOW: sei - jsr CSHOW - cli - rts +SHOW: sei + jsr CSHOW + cli + rts ;---------------------------------------------------------------------------- ; SETBOX: Set the mouse bounding box. The parameters are passed as they come @@ -180,7 +180,7 @@ SETBOX: sta ptr1 bpl @L1 cli - rts + rts ;---------------------------------------------------------------------------- ; GETBOX: Return the mouse bounding box. The parameters are passed as they @@ -198,7 +198,7 @@ GETBOX: sta ptr1 bpl @L1 cli - rts + rts ;---------------------------------------------------------------------------- ; MOVE: Move the mouse to a new position. The position is passed as it comes @@ -208,55 +208,55 @@ GETBOX: sta ptr1 ; the screen). No return code required. ; -MOVE: sei ; No interrupts +MOVE: sei ; No interrupts - sta YPos - stx YPos+1 ; New Y position - jsr CMOVEY ; Set it + sta YPos + stx YPos+1 ; New Y position + jsr CMOVEY ; Set it - ldy #$01 - lda (sp),y - sta XPos+1 - tax - dey - lda (sp),y - sta XPos ; New X position + ldy #$01 + lda (sp),y + sta XPos+1 + tax + dey + lda (sp),y + sta XPos ; New X position - jsr CMOVEX ; Move the cursor + jsr CMOVEX ; Move the cursor - cli ; Allow interrupts - rts + cli ; Allow interrupts + rts ;---------------------------------------------------------------------------- ; BUTTONS: Return the button mask in a/x. BUTTONS: - lda Buttons - ldx #$00 - rts + lda Buttons + ldx #$00 + rts ;---------------------------------------------------------------------------- ; POS: Return the mouse position in the MOUSE_POS struct pointed to by ptr1. ; No return code required. -POS: ldy #MOUSE_POS::XCOORD ; Structure offset +POS: ldy #MOUSE_POS::XCOORD ; Structure offset - sei ; Disable interrupts - lda XPos ; Transfer the position - sta (ptr1),y - lda XPos+1 - iny - sta (ptr1),y - lda YPos - iny - sta (ptr1),y - lda YPos+1 - cli ; Enable interrupts + sei ; Disable interrupts + lda XPos ; Transfer the position + sta (ptr1),y + lda XPos+1 + iny + sta (ptr1),y + lda YPos + iny + sta (ptr1),y + lda YPos+1 + cli ; Enable interrupts - iny - sta (ptr1),y ; Store last byte + iny + sta (ptr1),y ; Store last byte - rts ; Done + rts ; Done ;---------------------------------------------------------------------------- ; INFO: Returns mouse position and current button mask in the MOUSE_INFO @@ -267,15 +267,15 @@ POS: ldy #MOUSE_POS::XCOORD ; Structure offset ; call _mouse_pos to initialize the struct pointer and fill the position ; fields. -INFO: jsr POS +INFO: jsr POS ; Fill in the button state - lda Buttons - ldy #MOUSE_INFO::BUTTONS - sta (ptr1),y + lda Buttons + ldy #MOUSE_INFO::BUTTONS + sta (ptr1),y - rts + rts ;---------------------------------------------------------------------------- ; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl @@ -283,108 +283,108 @@ INFO: jsr POS ; Must return an error code in a/x. ; -IOCTL: lda #MOUSE_ERR_INV_IOCTL - rts +IOCTL: lda #MOUSE_ERR_INV_IOCTL + rts ;---------------------------------------------------------------------------- ; IRQ: Irq handler entry point. Called as a subroutine but in IRQ context ; (so be careful). ; -IRQ: lda #$7F - sta CIA1_PRA - lda CIA1_PRB ; Read port #1 - and #%00001100 - eor #%00001100 ; Make all bits active high - asl - sta Buttons - lsr - lsr - lsr - and #%00000001 - ora Buttons - sta Buttons - ldx #%01000000 - stx CIA1_PRA - ldy #0 -: dey - bne :- - ldx SID_ADConv1 - stx XPos - ldx SID_ADConv2 - stx YPos +IRQ: lda #$7F + sta CIA1_PRA + lda CIA1_PRB ; Read port #1 + and #%00001100 + eor #%00001100 ; Make all bits active high + asl + sta Buttons + lsr + lsr + lsr + and #%00000001 + ora Buttons + sta Buttons + ldx #%01000000 + stx CIA1_PRA + ldy #0 +: dey + bne :- + ldx SID_ADConv1 + stx XPos + ldx SID_ADConv2 + stx YPos - lda #$FF - tax - bne @AddX ; Branch always - lda #$01 - ldx #$00 + lda #$FF + tax + bne @AddX ; Branch always + lda #$01 + ldx #$00 ; Calculate the new X coordinate (--> a/y) -@AddX: add XPos - tay ; Remember low byte - txa - adc XPos+1 - tax +@AddX: add XPos + tay ; Remember low byte + txa + adc XPos+1 + tax ; Limit the X coordinate to the bounding box - cpy XMin - sbc XMin+1 - bpl @L1 - ldy XMin - ldx XMin+1 - jmp @L2 -@L1: txa + cpy XMin + sbc XMin+1 + bpl @L1 + ldy XMin + ldx XMin+1 + jmp @L2 +@L1: txa - cpy XMax - sbc XMax+1 - bmi @L2 - ldy XMax - ldx XMax+1 -@L2: sty XPos - stx XPos+1 + cpy XMax + sbc XMax+1 + bmi @L2 + ldy XMax + ldx XMax+1 +@L2: sty XPos + stx XPos+1 ; Move the mouse pointer to the new X pos - tya - jsr CMOVEX + tya + jsr CMOVEX - lda #$FF - tax - bne @AddY -@Down: lda #$01 - ldx #$00 + lda #$FF + tax + bne @AddY +@Down: lda #$01 + ldx #$00 ; Calculate the new Y coordinate (--> a/y) -@AddY: add YPos - tay ; Remember low byte - txa - adc YPos+1 - tax +@AddY: add YPos + tay ; Remember low byte + txa + adc YPos+1 + tax ; Limit the Y coordinate to the bounding box - cpy YMin - sbc YMin+1 - bpl @L3 - ldy YMin - ldx YMin+1 - jmp @L4 -@L3: txa + cpy YMin + sbc YMin+1 + bpl @L3 + ldy YMin + ldx YMin+1 + jmp @L4 +@L3: txa - cpy YMax - sbc YMax+1 - bmi @L4 - ldy YMax - ldx YMax+1 -@L4: sty YPos - stx YPos+1 + cpy YMax + sbc YMax+1 + bmi @L4 + ldy YMax + ldx YMax+1 +@L4: sty YPos + stx YPos+1 ; Move the mouse pointer to the new X pos - tya - jmp CMOVEY + tya + jmp CMOVEY diff --git a/libsrc/c64/mouse_stat_stddrv.s b/libsrc/c64/mouse_stat_stddrv.s index 61e3121af..12db7edf3 100644 --- a/libsrc/c64/mouse_stat_stddrv.s +++ b/libsrc/c64/mouse_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void mouse_static_stddrv[]; ; - .export _mouse_static_stddrv - .import _c64_1351_mou + .export _mouse_static_stddrv + .import _c64_1351_mou .rodata diff --git a/libsrc/c64/mouse_stddrv.s b/libsrc/c64/mouse_stddrv.s index 87c4c3d4d..b53440a52 100644 --- a/libsrc/c64/mouse_stddrv.s +++ b/libsrc/c64/mouse_stddrv.s @@ -6,10 +6,10 @@ ; const char mouse_stddrv[]; ; - .export _mouse_stddrv + .export _mouse_stddrv .rodata -_mouse_stddrv: .asciiz "c64-1351.mou" +_mouse_stddrv: .asciiz "c64-1351.mou" diff --git a/libsrc/c64/randomize.s b/libsrc/c64/randomize.s index c92cd51c7..c77d6b411 100644 --- a/libsrc/c64/randomize.s +++ b/libsrc/c64/randomize.s @@ -5,10 +5,10 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand - .include "c64.inc" + .include "c64.inc" __randomize: ldx VIC_HLINE ; Use VIC rasterline as high byte diff --git a/libsrc/c64/revers.s b/libsrc/c64/revers.s index b6afa9cd0..da4ecce81 100644 --- a/libsrc/c64/revers.s +++ b/libsrc/c64/revers.s @@ -4,24 +4,24 @@ ; unsigned char revers (unsigned char onoff); ; - .export _revers + .export _revers .include "c64.inc" .proc _revers - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value - ldy #$00 ; Assume old value is zero -L1: lda RVS ; Load old value - stx RVS ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value + ldy #$00 ; Assume old value is zero +L1: lda RVS ; Load old value + stx RVS ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts .endproc diff --git a/libsrc/c64/ser/c64-swlink.s b/libsrc/c64/ser/c64-swlink.s index 9f1b23c5b..f9121b8b6 100644 --- a/libsrc/c64/ser/c64-swlink.s +++ b/libsrc/c64/ser/c64-swlink.s @@ -24,7 +24,7 @@ .include "zeropage.inc" .include "ser-kernel.inc" .include "ser-error.inc" - .include "c64.inc" + .include "c64.inc" ; ------------------------------------------------------------------------ @@ -52,7 +52,7 @@ ;---------------------------------------------------------------------------- ; I/O definitions -ACIA = $DE00 +ACIA = $DE00 ACIA_DATA = ACIA+0 ; Data register ACIA_STATUS = ACIA+1 ; Status register ACIA_CMD = ACIA+2 ; Command register @@ -73,16 +73,16 @@ SendTail = $F9 ; Tail of send buffer SendFreeCnt = $FA ; Number of bytes free in send buffer .bss -Stopped: .res 1 ; Flow-stopped flag -RtsOff: .res 1 ; +Stopped: .res 1 ; Flow-stopped flag +RtsOff: .res 1 ; ; Send and receive buffers: 256 bytes each -RecvBuf: .res 256 -SendBuf: .res 256 +RecvBuf: .res 256 +SendBuf: .res 256 .data -NmiContinue: .byte $4c ; JMP instruction for NMI save -- continue -NmiSave: .res 2 ; normal NMI handler +NmiContinue: .byte $4c ; JMP instruction for NMI save -- continue +NmiSave: .res 2 ; normal NMI handler .rodata @@ -138,25 +138,25 @@ INSTALL: ; Deactivate DTR and disable 6551 interrupts - lda #%00001010 - sta ACIA_CMD + lda #%00001010 + sta ACIA_CMD ; Set up the nmi vector - lda NMIVec - ldy NMIVec+1 - sta NmiSave+0 - sty NmiSave+1 - lda #NmiHandler -SetNMI: sta NMIVec - sty NMIVec+1 + lda NMIVec + ldy NMIVec+1 + sta NmiSave+0 + sty NmiSave+1 + lda #NmiHandler +SetNMI: sta NMIVec + sty NMIVec+1 ; Done, return an error code lda #SER_ERR_INIT_FAILED - rts + lda #SER_ERR_INIT_FAILED + rts ; Baud rate not available @@ -258,8 +258,8 @@ CLOSE: ; Stop interrupts, drop DTR - lda #%00001010 - sta ACIA_CMD + lda #%00001010 + sta ACIA_CMD ; Initalize buffers. Returns zero in a @@ -269,7 +269,7 @@ CLOSE: lda #SER_ERR_NO_DATA - rts +@L1: lda RecvFreeCnt ; (25) + cmp #$ff + bne @L2 + lda #SER_ERR_NO_DATA + rts ; Check for flow stopped & enough free: release flow control -@L2: ldx Stopped ; (34) - beq @L3 - cmp #63 - bcc @L3 - lda #$00 - sta Stopped - lda RtsOff - ora #%00001000 - sta ACIA_CMD +@L2: ldx Stopped ; (34) + beq @L3 + cmp #63 + bcc @L3 + lda #$00 + sta Stopped + lda RtsOff + ora #%00001000 + sta ACIA_CMD ; Get byte from buffer -@L3: ldx RecvHead ; (41) - lda RecvBuf,x - inc RecvHead - inc RecvFreeCnt - ldx #$00 ; (59) - sta (ptr1,x) - txa ; Return code = 0 - rts +@L3: ldx RecvHead ; (41) + lda RecvBuf,x + inc RecvHead + inc RecvFreeCnt + ldx #$00 ; (59) + sta (ptr1,x) + txa ; Return code = 0 + rts ;---------------------------------------------------------------------------- ; PUT: Output character in A. @@ -324,40 +324,40 @@ PUT: ; Try to send - ldx SendFreeCnt - inx ; X = $ff? - beq @L2 - pha - lda #$00 - jsr TryToSend - pla + ldx SendFreeCnt + inx ; X = $ff? + beq @L2 + pha + lda #$00 + jsr TryToSend + pla ; Put byte into send buffer & send -@L2: ldx SendFreeCnt - bne @L3 - lda #TM - jmp _mktime + lda CIA1_TODHR + bpl AM + and #%01111111 + sed + clc + adc #$12 + cld +AM: jsr BCD2dec + sta TM + tm::tm_hour + lda CIA1_TODMIN + jsr BCD2dec + sta TM + tm::tm_min + lda CIA1_TODSEC + jsr BCD2dec + sta TM + tm::tm_sec + lda CIA1_TOD10 ; Dummy read to unfreeze + lda #TM + jmp _mktime ; dec = (((BCD>>4)*10) + (BCD&0xf)) BCD2dec:tax - and #%00001111 - sta tmp1 - txa + and #%00001111 + sta tmp1 + txa and #%11110000 ; *16 lsr ; *8 sta tmp2 @@ -68,16 +68,16 @@ BCD2dec:tax lda CIA1_TOD10 sta CIA1_TOD10 - jsr _get_tv - cmp #TV::PAL - bne @60Hz - jsr _get_ostype - cmp #$43 - beq @60Hz - lda CIA1_CRA - ora #$80 - sta CIA1_CRA -@60Hz: rts + jsr _get_tv + cmp #TV::PAL + bne @60Hz + jsr _get_ostype + cmp #$43 + beq @60Hz + lda CIA1_CRA + ora #$80 + sta CIA1_CRA +@60Hz: rts .endproc @@ -86,7 +86,7 @@ BCD2dec:tax ; TM struct with date set to 1970-01-01 .data -TM: .word 0 ; tm_sec +TM: .word 0 ; tm_sec .word 0 ; tm_min .word 0 ; tm_hour .word 1 ; tm_mday diff --git a/libsrc/c64/tgi/c64-hi.s b/libsrc/c64/tgi/c64-hi.s index 8a206341c..1e829d274 100644 --- a/libsrc/c64/tgi/c64-hi.s +++ b/libsrc/c64/tgi/c64-hi.s @@ -4,9 +4,9 @@ ; Based on Stephen L. Judds GRLIB code ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" .include "tgi-error.inc" @@ -39,7 +39,7 @@ .addr UNINSTALL .addr INIT .addr DONE - .addr GETERROR + .addr GETERROR .addr CONTROL .addr CLEAR .addr SETVIEWPAGE @@ -82,7 +82,7 @@ OLDCHUNK := X2+1 ; Dito .bss -ERROR: .res 1 ; Error code +ERROR: .res 1 ; Error code PALETTE: .res 2 ; The current palette BITMASK: .res 1 ; $00 = clear, $FF = set pixels @@ -117,7 +117,7 @@ BITCHUNK: .byte $FF,$7F,$3F,$1F,$0F,$07,$03,$01 CHARROM := $D000 ; Character rom base address CBASE := $D000 ; Color memory base address -VBASE := $E000 ; Video memory base address +VBASE := $E000 ; Video memory base address .code @@ -177,10 +177,10 @@ INIT: lda $D018 sta OLDD018 - lda #$48 ; Set color map to $D000, screen to $E000 + lda #$48 ; Set color map to $D000, screen to $E000 sta $D018 - lda $D011 ; And turn on bitmap + lda $D011 ; And turn on bitmap ora #$20 DONE1: sta $D011 @@ -217,9 +217,9 @@ DONE: lda $DD02 ; Set the data direction regs ; GETERROR: Return the error code in A and clear it. GETERROR: - ldx #TGI_ERR_OK - lda ERROR - stx ERROR + ldx #TGI_ERR_OK + lda ERROR + stx ERROR rts ; ------------------------------------------------------------------------ @@ -229,8 +229,8 @@ GETERROR: ; CONTROL: - lda #TGI_ERR_INV_FUNC - sta ERROR + lda #TGI_ERR_INV_FUNC + sta ERROR rts ; ------------------------------------------------------------------------ @@ -340,22 +340,22 @@ SETPALETTE: ; Initialize the color map with the new color settings (it is below the ; I/O area) - ldy #$00 - sei - lda $01 ; Get ROM config - pha ; Save it - and #%11111100 ; Clear bit 0 and 1 - sta $01 - txa ; Load color code -@L2: sta CBASE+$0000,y - sta CBASE+$0100,y - sta CBASE+$0200,y - sta CBASE+$0300,y - iny - bne @L2 - pla - sta $01 - cli + ldy #$00 + sei + lda $01 ; Get ROM config + pha ; Save it + and #%11111100 ; Clear bit 0 and 1 + sta $01 + txa ; Load color code +@L2: sta CBASE+$0000,y + sta CBASE+$0100,y + sta CBASE+$0200,y + sta CBASE+$0300,y + iny + bne @L2 + pla + sta $01 + cli ; Done, reset the error code @@ -664,7 +664,7 @@ XFIXC: sta TEMP bmi @C1 ;Skip if column is negative cmp #39 ;End if move past end of screen bcs EXIT -@C1: lda POINT +@C1: lda POINT adc #8 sta POINT bcc @CONT @@ -734,7 +734,7 @@ FIXY: cpy #255 ;Y=255 or Y=8 bmi @C1 ;If negative, then don't update cmp #24 bcs @TOAST ;If at bottom of screen then quit -@C1: lda POINT +@C1: lda POINT adc #<320 sta POINT lda POINT+1 @@ -790,7 +790,7 @@ FIXY: cpy #255 ;Y=255 or Y=8 ; the original C wrapper and could be written much smaller (besides that, ; calling LINE is not a good idea either). -BAR: lda Y2 +BAR: lda Y2 sta Y2SAVE lda Y2+1 sta Y2SAVE+1 @@ -810,11 +810,11 @@ BAR: lda Y2 lda X1+1 sta X1SAVE+1 -@L1: lda Y1 +@L1: lda Y1 sta Y2 lda Y1+1 sta Y2+1 - jsr LINE + jsr LINE lda Y1SAVE cmp Y2SAVE diff --git a/libsrc/c64/tgi_colors.s b/libsrc/c64/tgi_colors.s index 4dab483e2..6ef3729b4 100644 --- a/libsrc/c64/tgi_colors.s +++ b/libsrc/c64/tgi_colors.s @@ -2,7 +2,7 @@ ; Target-specific black & white values for use by the target-shared TGI kernel ; - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $01 + .export tgi_color_black:zp = $00 + .export tgi_color_white:zp = $01 diff --git a/libsrc/c64/tgi_stat_stddrv.s b/libsrc/c64/tgi_stat_stddrv.s index 1ef9b3267..03ef91b39 100644 --- a/libsrc/c64/tgi_stat_stddrv.s +++ b/libsrc/c64/tgi_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void tgi_static_stddrv[]; ; - .export _tgi_static_stddrv - .import _c64_hi_tgi + .export _tgi_static_stddrv + .import _c64_hi_tgi .rodata diff --git a/libsrc/c64/tgi_stddrv.s b/libsrc/c64/tgi_stddrv.s index 4a8e49db8..c87fed359 100644 --- a/libsrc/c64/tgi_stddrv.s +++ b/libsrc/c64/tgi_stddrv.s @@ -6,8 +6,8 @@ ; const char tgi_stddrv[]; ; - .export _tgi_stddrv + .export _tgi_stddrv .rodata -_tgi_stddrv: .asciiz "c64-hi.tgi" +_tgi_stddrv: .asciiz "c64-hi.tgi" diff --git a/libsrc/cbm/c_acptr.s b/libsrc/cbm/c_acptr.s index 6a56659bf..87f063a07 100644 --- a/libsrc/cbm/c_acptr.s +++ b/libsrc/cbm/c_acptr.s @@ -4,11 +4,11 @@ ; unsigned char cbm_k_acptr (void); ; - .export _cbm_k_acptr + .export _cbm_k_acptr .import ACPTR _cbm_k_acptr: - jsr ACPTR - ldx #0 - rts + jsr ACPTR + ldx #0 + rts diff --git a/libsrc/cbm/c_basin.s b/libsrc/cbm/c_basin.s index 9b2a985df..15d7e7f5c 100644 --- a/libsrc/cbm/c_basin.s +++ b/libsrc/cbm/c_basin.s @@ -4,11 +4,11 @@ ; unsigned char cbm_k_basin (void); ; - .export _cbm_k_basin - .import BASIN + .export _cbm_k_basin + .import BASIN _cbm_k_basin: - jsr BASIN - ldx #0 ; Clear high byte - rts + jsr BASIN + ldx #0 ; Clear high byte + rts diff --git a/libsrc/cbm/c_bsout.s b/libsrc/cbm/c_bsout.s index 14b1252a6..8b9f44037 100644 --- a/libsrc/cbm/c_bsout.s +++ b/libsrc/cbm/c_bsout.s @@ -4,7 +4,7 @@ ; void __fastcall__ cbm_k_bsout (unsigned char C); ; - .export _cbm_k_bsout + .export _cbm_k_bsout .import BSOUT _cbm_k_bsout = BSOUT diff --git a/libsrc/cbm/c_chkin.s b/libsrc/cbm/c_chkin.s index 4565e6fb9..4ed8c1bff 100644 --- a/libsrc/cbm/c_chkin.s +++ b/libsrc/cbm/c_chkin.s @@ -4,14 +4,14 @@ ; unsigned char __fastcall__ cbm_k_chkin (unsigned char FN); ; - .export _cbm_k_chkin + .export _cbm_k_chkin .import CHKIN _cbm_k_chkin: - tax - jsr CHKIN - ldx #0 ; Clear high byte - bcs @NotOk + tax + jsr CHKIN + ldx #0 ; Clear high byte + bcs @NotOk txa -@NotOk: rts +@NotOk: rts diff --git a/libsrc/cbm/c_ciout.s b/libsrc/cbm/c_ciout.s index fd8a48380..9906e0658 100644 --- a/libsrc/cbm/c_ciout.s +++ b/libsrc/cbm/c_ciout.s @@ -5,6 +5,6 @@ ; .import CIOUT - .export _cbm_k_ciout := CIOUT + .export _cbm_k_ciout := CIOUT diff --git a/libsrc/cbm/c_ckout.s b/libsrc/cbm/c_ckout.s index faeee4b70..380d7170a 100644 --- a/libsrc/cbm/c_ckout.s +++ b/libsrc/cbm/c_ckout.s @@ -4,14 +4,14 @@ ; unsigned char __fastcall__ cbm_k_ckout (unsigned char FN); ; - .export _cbm_k_ckout + .export _cbm_k_ckout .import CKOUT _cbm_k_ckout: - tax - jsr CKOUT - ldx #0 ; Clear high byte - bcs @NotOk + tax + jsr CKOUT + ldx #0 ; Clear high byte + bcs @NotOk txa -@NotOk: rts +@NotOk: rts diff --git a/libsrc/cbm/c_clall.s b/libsrc/cbm/c_clall.s index c2bb93e34..cdd7d4ddc 100644 --- a/libsrc/cbm/c_clall.s +++ b/libsrc/cbm/c_clall.s @@ -5,4 +5,4 @@ ; .import CLALL - .export _cbm_k_clall := CLALL + .export _cbm_k_clall := CLALL diff --git a/libsrc/cbm/c_close.s b/libsrc/cbm/c_close.s index 5a99f5057..9582baca2 100644 --- a/libsrc/cbm/c_close.s +++ b/libsrc/cbm/c_close.s @@ -4,11 +4,11 @@ ; void __fastcall__ cbm_k_close (unsigned char FN); ; - .export _cbm_k_close + .export _cbm_k_close .import CLOSE _cbm_k_close: - clc - jmp CLOSE + clc + jmp CLOSE diff --git a/libsrc/cbm/c_clrch.s b/libsrc/cbm/c_clrch.s index d2ef11c60..7c0506a1c 100644 --- a/libsrc/cbm/c_clrch.s +++ b/libsrc/cbm/c_clrch.s @@ -4,7 +4,7 @@ ; void cbm_k_clrch (void); ; - .export _cbm_k_clrch + .export _cbm_k_clrch .import CLRCH _cbm_k_clrch = CLRCH diff --git a/libsrc/cbm/c_getin.s b/libsrc/cbm/c_getin.s index db7c7bc56..b4cb34f76 100644 --- a/libsrc/cbm/c_getin.s +++ b/libsrc/cbm/c_getin.s @@ -4,11 +4,11 @@ ; unsigned char cbm_k_getin (void); ; - .export _cbm_k_getin + .export _cbm_k_getin .import GETIN _cbm_k_getin: - jsr GETIN - ldx #0 - rts + jsr GETIN + ldx #0 + rts diff --git a/libsrc/cbm/c_iobase.s b/libsrc/cbm/c_iobase.s index c4dc4cb6f..254879017 100644 --- a/libsrc/cbm/c_iobase.s +++ b/libsrc/cbm/c_iobase.s @@ -4,14 +4,14 @@ ; unsigned cbm_k_iobase (void); ; - .export _cbm_k_iobase + .export _cbm_k_iobase .import IOBASE _cbm_k_iobase: - jsr IOBASE - txa - pha - tya - tax - pla - rts + jsr IOBASE + txa + pha + tya + tax + pla + rts diff --git a/libsrc/cbm/c_listen.s b/libsrc/cbm/c_listen.s index b80813529..85ef8b7fa 100644 --- a/libsrc/cbm/c_listen.s +++ b/libsrc/cbm/c_listen.s @@ -5,7 +5,7 @@ ; .import LISTEN - .export _cbm_k_listen := LISTEN + .export _cbm_k_listen := LISTEN diff --git a/libsrc/cbm/c_load.s b/libsrc/cbm/c_load.s index 821330704..f2b5b0c89 100644 --- a/libsrc/cbm/c_load.s +++ b/libsrc/cbm/c_load.s @@ -4,20 +4,20 @@ ; unsigned int __fastcall__ cbm_k_load (unsigned char flag, unsigned addr); ; - .export _cbm_k_load + .export _cbm_k_load .import LOAD .import __oserror - .import popa - .importzp ptr1 + .import popa + .importzp ptr1 _cbm_k_load: - sta ptr1 - stx ptr1+1 - jsr popa ; get flag - ldx ptr1 - ldy ptr1+1 - jsr LOAD - bcc @Ok + sta ptr1 + stx ptr1+1 + jsr popa ; get flag + ldx ptr1 + ldy ptr1+1 + jsr LOAD + bcc @Ok sta __oserror ldx ptr1 ldy ptr1+1 diff --git a/libsrc/cbm/c_open.s b/libsrc/cbm/c_open.s index 9a1e08f91..6461ffedf 100644 --- a/libsrc/cbm/c_open.s +++ b/libsrc/cbm/c_open.s @@ -4,13 +4,13 @@ ; unsigned char cbm_k_open (void); ; - .export _cbm_k_open + .export _cbm_k_open .import OPEN _cbm_k_open: - jsr OPEN - ldx #0 ; Clear high byte - bcs @NotOk + jsr OPEN + ldx #0 ; Clear high byte + bcs @NotOk txa @NotOk: rts diff --git a/libsrc/cbm/c_readst.s b/libsrc/cbm/c_readst.s index 6e4f02dea..301cd9b42 100644 --- a/libsrc/cbm/c_readst.s +++ b/libsrc/cbm/c_readst.s @@ -4,11 +4,11 @@ ; unsigned char cbm_k_readst (void); ; - .export _cbm_k_readst - .import READST + .export _cbm_k_readst + .import READST _cbm_k_readst: - jsr READST - ldx #0 ; Clear high byte - rts + jsr READST + ldx #0 ; Clear high byte + rts diff --git a/libsrc/cbm/c_save.s b/libsrc/cbm/c_save.s index 115d89242..dfdb7df42 100644 --- a/libsrc/cbm/c_save.s +++ b/libsrc/cbm/c_save.s @@ -20,7 +20,7 @@ _cbm_k_save: ldx tmp1 ldy tmp1+1 jsr SAVE - ldx #0 ; Clear high byte - bcs @NotOk + ldx #0 ; Clear high byte + bcs @NotOk txa -@NotOk: rts +@NotOk: rts diff --git a/libsrc/cbm/c_setlfs.s b/libsrc/cbm/c_setlfs.s index 5277cf453..00ebfae7a 100644 --- a/libsrc/cbm/c_setlfs.s +++ b/libsrc/cbm/c_setlfs.s @@ -2,22 +2,22 @@ ; Ullrich von Bassewitz, 03.06.1999 ; ; void __fastcall__ cbm_k_setlfs (unsigned char LFN, -; unsigned char DEV, -; unsigned char SA); +; unsigned char DEV, +; unsigned char SA); ; - .export _cbm_k_setlfs + .export _cbm_k_setlfs .import SETLFS - .import popa - .importzp tmp1 + .import popa + .importzp tmp1 _cbm_k_setlfs: - sta tmp1 ; Save SA - jsr popa ; Get DEV - tax - jsr popa ; Get LFN - ldy tmp1 ; Get SA - jmp SETLFS + sta tmp1 ; Save SA + jsr popa ; Get DEV + tax + jsr popa ; Get LFN + ldy tmp1 ; Get SA + jmp SETLFS diff --git a/libsrc/cbm/c_setnam.s b/libsrc/cbm/c_setnam.s index 8f35d37fb..3249d8539 100644 --- a/libsrc/cbm/c_setnam.s +++ b/libsrc/cbm/c_setnam.s @@ -4,21 +4,21 @@ ; void __fastcall__ cbm_k_setnam (const char* Name); ; - .export _cbm_k_setnam + .export _cbm_k_setnam .import SETNAM - .importzp ptr1 + .importzp ptr1 _cbm_k_setnam: - sta ptr1 ; Store pointer to file name - stx ptr1+1 - ldy #$FF -@Loop: iny ; Get length of name - lda (ptr1),y - bne @Loop + sta ptr1 ; Store pointer to file name + stx ptr1+1 + ldy #$FF +@Loop: iny ; Get length of name + lda (ptr1),y + bne @Loop - tya ; Length - ldx ptr1 - ldy ptr1+1 - jmp SETNAM + tya ; Length + ldx ptr1 + ldy ptr1+1 + jmp SETNAM diff --git a/libsrc/cbm/c_talk.s b/libsrc/cbm/c_talk.s index 05a1b1cba..ff80b3499 100644 --- a/libsrc/cbm/c_talk.s +++ b/libsrc/cbm/c_talk.s @@ -5,7 +5,7 @@ ; .import TALK - .export _cbm_k_talk := TALK + .export _cbm_k_talk := TALK diff --git a/libsrc/cbm/c_unlsn.s b/libsrc/cbm/c_unlsn.s index 011755f39..fd6b1b074 100644 --- a/libsrc/cbm/c_unlsn.s +++ b/libsrc/cbm/c_unlsn.s @@ -5,4 +5,4 @@ ; .import UNLSN - .export _cbm_k_unlsn := UNLSN + .export _cbm_k_unlsn := UNLSN diff --git a/libsrc/cbm/c_untlk.s b/libsrc/cbm/c_untlk.s index 6a309406c..1d71c168b 100644 --- a/libsrc/cbm/c_untlk.s +++ b/libsrc/cbm/c_untlk.s @@ -4,7 +4,7 @@ ; void cbm_untlk (void); ; - .export _cbm_untlk + .export _cbm_untlk .import UNTLK diff --git a/libsrc/cbm/cbm.inc b/libsrc/cbm/cbm.inc index 25e48a72f..0e513ffe8 100644 --- a/libsrc/cbm/cbm.inc +++ b/libsrc/cbm/cbm.inc @@ -7,45 +7,45 @@ ; Subroutines available in the CBM jump table ; -;CINT = $FF81 -;IOINIT = $FF84 -;RAMTAS = $FF87 -;RESTOR = $FF8A -;VECTOR = $FF8D -;SETMSG = $FF90 -;SECOND = $FF93 -;TKSA = $FF96 -;MEMTOP = $FF99 -;MEMBOT = $FF9C -;SCNKEY = $FF9F -;SETTMO = $FFA2 -;ACPTR = $FFA5 -;CIOUT = $FFA8 -;UNTLK = $FFAB -;UNLSN = $FFAE -;LISTEN = $FFB1 -;TALK = $FFB4 -;READST = $FFB7 -;SETLFS = $FFBA -;SETNAM = $FFBD -;OPEN = $FFC0 -;CLOSE = $FFC3 -;CHKIN = $FFC6 -;CKOUT = $FFC9 -;CLRCH = $FFCC -;BASIN = $FFCF -;BSOUT = $FFD2 -;LOAD = $FFD5 -;SAVE = $FFD8 -;SETTIM = $FFDB -;RDTIM = $FFDE -;STOP = $FFE1 -;GETIN = $FFE4 -;CLALL = $FFE7 -;UDTIM = $FFEA -;SCREEN = $FFED -;PLOT = $FFF0 -;IOBASE = $FFF3 +;CINT = $FF81 +;IOINIT = $FF84 +;RAMTAS = $FF87 +;RESTOR = $FF8A +;VECTOR = $FF8D +;SETMSG = $FF90 +;SECOND = $FF93 +;TKSA = $FF96 +;MEMTOP = $FF99 +;MEMBOT = $FF9C +;SCNKEY = $FF9F +;SETTMO = $FFA2 +;ACPTR = $FFA5 +;CIOUT = $FFA8 +;UNTLK = $FFAB +;UNLSN = $FFAE +;LISTEN = $FFB1 +;TALK = $FFB4 +;READST = $FFB7 +;SETLFS = $FFBA +;SETNAM = $FFBD +;OPEN = $FFC0 +;CLOSE = $FFC3 +;CHKIN = $FFC6 +;CKOUT = $FFC9 +;CLRCH = $FFCC +;BASIN = $FFCF +;BSOUT = $FFD2 +;LOAD = $FFD5 +;SAVE = $FFD8 +;SETTIM = $FFDB +;RDTIM = $FFDE +;STOP = $FFE1 +;GETIN = $FFE4 +;CLALL = $FFE7 +;UDTIM = $FFEA +;SCREEN = $FFED +;PLOT = $FFF0 +;IOBASE = $FFF3 ;----------------------------------------------------------------------------- diff --git a/libsrc/cbm/cbm_dir.c b/libsrc/cbm/cbm_dir.c index df3d21cb5..8f31c502a 100644 --- a/libsrc/cbm/cbm_dir.c +++ b/libsrc/cbm/cbm_dir.c @@ -117,11 +117,11 @@ unsigned char __fastcall__ cbm_readdir (unsigned char lfn, register struct cbm_d if (is_header) { l_dirent->type = CBM_T_HEADER; - /* Get the disk-format code. */ - i = 6; - do { - l_dirent->access = byte = cbm_k_basin(); - } while (--i != 0); + /* Get the disk-format code. */ + i = 6; + do { + l_dirent->access = byte = cbm_k_basin(); + } while (--i != 0); } else { /* Go to the file-type column. */ @@ -144,10 +144,10 @@ unsigned char __fastcall__ cbm_readdir (unsigned char lfn, register struct cbm_d /* Determine the file type */ l_dirent->type = _cbm_filetype (byte); - /* Notice whether it's a directory or a deleted file. */ - if (cbm_k_basin() == 'i' && byte == 'd') { - l_dirent->type = CBM_T_DIR; - } + /* Notice whether it's a directory or a deleted file. */ + if (cbm_k_basin() == 'i' && byte == 'd') { + l_dirent->type = CBM_T_DIR; + } cbm_k_basin(); /* Locked files shouldn't be written. */ diff --git a/libsrc/cbm/cbm_open.s b/libsrc/cbm/cbm_open.s index 055df9b42..4d1cec040 100644 --- a/libsrc/cbm/cbm_open.s +++ b/libsrc/cbm/cbm_open.s @@ -18,8 +18,8 @@ ; } ; - .export _cbm_open - .import popa + .export _cbm_open + .import popa .import _cbm_k_setlfs, _cbm_k_setnam, _cbm_k_open .import __oserror diff --git a/libsrc/cbm/cbm_read.s b/libsrc/cbm/cbm_read.s index 5df18e34d..d97ccbd8b 100644 --- a/libsrc/cbm/cbm_read.s +++ b/libsrc/cbm/cbm_read.s @@ -37,10 +37,10 @@ .include "cbm.inc" - .export _cbm_read + .export _cbm_read .import CHKIN, READST, BASIN, CLRCH .importzp ptr1, ptr2, ptr3, tmp1 - .import popax, popa + .import popax, popa .import __oserror diff --git a/libsrc/cbm/cbm_write.s b/libsrc/cbm/cbm_write.s index 295ff2cd0..0b709dff8 100644 --- a/libsrc/cbm/cbm_write.s +++ b/libsrc/cbm/cbm_write.s @@ -30,10 +30,10 @@ .include "cbm.inc" - .export _cbm_write + .export _cbm_write .import CKOUT, READST, BSOUT, CLRCH .importzp ptr1, ptr2, ptr3 - .import popax, popa + .import popax, popa .import __oserror diff --git a/libsrc/cbm/cclear.s b/libsrc/cbm/cclear.s index 586459cb0..233c112c6 100644 --- a/libsrc/cbm/cclear.s +++ b/libsrc/cbm/cclear.s @@ -5,25 +5,25 @@ ; void cclear (unsigned char length); ; - .export _cclearxy, _cclear - .import popa, _gotoxy, cputdirect - .importzp tmp1 + .export _cclearxy, _cclear + .import popa, _gotoxy, cputdirect + .importzp tmp1 _cclearxy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length and run into _cclear + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length and run into _cclear _cclear: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - sta tmp1 -L1: lda #$20 ; Blank - screen code - jsr cputdirect ; Direct output - dec tmp1 - bne L1 -L9: rts + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + sta tmp1 +L1: lda #$20 ; Blank - screen code + jsr cputdirect ; Direct output + dec tmp1 + bne L1 +L9: rts diff --git a/libsrc/cbm/chline.s b/libsrc/cbm/chline.s index 26be1c7a1..26603b2fe 100644 --- a/libsrc/cbm/chline.s +++ b/libsrc/cbm/chline.s @@ -5,25 +5,25 @@ ; void chline (unsigned char length); ; - .export _chlinexy, _chline - .import popa, _gotoxy, cputdirect - .importzp tmp1 + .export _chlinexy, _chline + .import popa, _gotoxy, cputdirect + .importzp tmp1 _chlinexy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length _chline: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - sta tmp1 -L1: lda #64 ; Horizontal line, screen code - jsr cputdirect ; Direct output - dec tmp1 - bne L1 -L9: rts + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + sta tmp1 +L1: lda #64 ; Horizontal line, screen code + jsr cputdirect ; Direct output + dec tmp1 + bne L1 +L9: rts diff --git a/libsrc/cbm/clock.s b/libsrc/cbm/clock.s index 71fa40336..ce36e3af5 100644 --- a/libsrc/cbm/clock.s +++ b/libsrc/cbm/clock.s @@ -4,19 +4,19 @@ ; clock_t clock (void); ; - .export _clock + .export _clock .import RDTIM - .importzp sreg + .importzp sreg -.proc _clock +.proc _clock - lda #0 ; Byte 3 is always zero - sta sreg+1 - jsr RDTIM - sty sreg - rts + lda #0 ; Byte 3 is always zero + sta sreg+1 + jsr RDTIM + sty sreg + rts .endproc diff --git a/libsrc/cbm/ctype.s b/libsrc/cbm/ctype.s index e485881b3..ba096bb13 100644 --- a/libsrc/cbm/ctype.s +++ b/libsrc/cbm/ctype.s @@ -20,270 +20,270 @@ ; This table is taken from Craig S. Bruce's technical docs. for the ACE OS. - .include "ctype.inc" + .include "ctype.inc" ; The table is read-only, put it into the RODATA segment. - .rodata + .rodata __ctype: - .byte CT_CTRL ; 0/00 ___rvs_@___ - .byte CT_CTRL ; 1/01 ___rvs_a___ - .byte CT_CTRL ; 2/02 ___rvs_b___ - .byte CT_CTRL ; 3/03 ___rvs_c___ - .byte CT_CTRL ; 4/04 ___rvs_d___ - .byte CT_CTRL ; 5/05 ___rvs_e___ - .byte CT_CTRL ; 6/06 ___rvs_f___ - .byte CT_CTRL ; 7/07 _BEL/rvs_g_ - .byte CT_CTRL ; 8/08 ___rvs_h___ - .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB ; 9/09 _TAB/rvs_i_ - .byte CT_CTRL | CT_OTHER_WS ; 10/0a _BOL/rvs_j_ - .byte CT_CTRL ; 11/0b ___rvs_k___ - .byte CT_CTRL ; 12/0c ___rvs_l___ - .byte CT_CTRL | CT_OTHER_WS ; 13/0d _CR_/rvs_m_ - .byte CT_CTRL ; 14/0e ___rvs_n___ - .byte CT_CTRL ; 15/0f ___rvs_o___ - .byte CT_CTRL ; 16/10 ___rvs_p___ - .byte CT_CTRL | CT_OTHER_WS ; 17/11 _VT_/rvs_q_ - .byte CT_CTRL ; 18/12 ___rvs_r___ - .byte CT_CTRL | CT_OTHER_WS ; 19/13 HOME/rvs_s_ - .byte CT_CTRL | CT_OTHER_WS ; 20/14 _BS_/rvs_t_ - .byte CT_CTRL ; 21/15 ___rvs_u___ - .byte CT_CTRL ; 22/16 ___rvs_v___ - .byte CT_CTRL ; 23/17 ___rvs_w___ - .byte CT_CTRL ; 24/18 ___rvs_x___ - .byte CT_CTRL ; 25/19 ___rvs_y___ - .byte CT_CTRL ; 26/1a ___rvs_z___ - .byte CT_CTRL ; 27/1b ___rvs_[___ - .byte CT_CTRL ; 28/1c ___rvs_\___ - .byte CT_CTRL | CT_OTHER_WS ; 29/1d cursr-right - .byte CT_CTRL ; 30/1e ___rvs_^___ - .byte CT_CTRL ; 31/1f _rvs_under_ - .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___ - .byte $00 ; 33/21 _____!_____ - .byte $00 ; 34/22 _____"_____ - .byte $00 ; 35/23 _____#_____ - .byte $00 ; 36/24 _____$_____ - .byte $00 ; 37/25 _____%_____ - .byte $00 ; 38/26 _____&_____ - .byte $00 ; 39/27 _____'_____ - .byte $00 ; 40/28 _____(_____ - .byte $00 ; 41/29 _____)_____ - .byte $00 ; 42/2a _____*_____ - .byte $00 ; 43/2b _____+_____ - .byte $00 ; 44/2c _____,_____ - .byte $00 ; 45/2d _____-_____ - .byte $00 ; 46/2e _____._____ - .byte $00 ; 47/2f _____/_____ - .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ - .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ - .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ - .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ - .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ - .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ - .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ - .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ - .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ - .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ - .byte $00 ; 58/3a _____:_____ - .byte $00 ; 59/3b _____;_____ - .byte $00 ; 60/3c _____<_____ - .byte $00 ; 61/3d _____=_____ - .byte $00 ; 62/3e _____>_____ - .byte $00 ; 63/3f _____?_____ + .byte CT_CTRL ; 0/00 ___rvs_@___ + .byte CT_CTRL ; 1/01 ___rvs_a___ + .byte CT_CTRL ; 2/02 ___rvs_b___ + .byte CT_CTRL ; 3/03 ___rvs_c___ + .byte CT_CTRL ; 4/04 ___rvs_d___ + .byte CT_CTRL ; 5/05 ___rvs_e___ + .byte CT_CTRL ; 6/06 ___rvs_f___ + .byte CT_CTRL ; 7/07 _BEL/rvs_g_ + .byte CT_CTRL ; 8/08 ___rvs_h___ + .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB ; 9/09 _TAB/rvs_i_ + .byte CT_CTRL | CT_OTHER_WS ; 10/0a _BOL/rvs_j_ + .byte CT_CTRL ; 11/0b ___rvs_k___ + .byte CT_CTRL ; 12/0c ___rvs_l___ + .byte CT_CTRL | CT_OTHER_WS ; 13/0d _CR_/rvs_m_ + .byte CT_CTRL ; 14/0e ___rvs_n___ + .byte CT_CTRL ; 15/0f ___rvs_o___ + .byte CT_CTRL ; 16/10 ___rvs_p___ + .byte CT_CTRL | CT_OTHER_WS ; 17/11 _VT_/rvs_q_ + .byte CT_CTRL ; 18/12 ___rvs_r___ + .byte CT_CTRL | CT_OTHER_WS ; 19/13 HOME/rvs_s_ + .byte CT_CTRL | CT_OTHER_WS ; 20/14 _BS_/rvs_t_ + .byte CT_CTRL ; 21/15 ___rvs_u___ + .byte CT_CTRL ; 22/16 ___rvs_v___ + .byte CT_CTRL ; 23/17 ___rvs_w___ + .byte CT_CTRL ; 24/18 ___rvs_x___ + .byte CT_CTRL ; 25/19 ___rvs_y___ + .byte CT_CTRL ; 26/1a ___rvs_z___ + .byte CT_CTRL ; 27/1b ___rvs_[___ + .byte CT_CTRL ; 28/1c ___rvs_\___ + .byte CT_CTRL | CT_OTHER_WS ; 29/1d cursr-right + .byte CT_CTRL ; 30/1e ___rvs_^___ + .byte CT_CTRL ; 31/1f _rvs_under_ + .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___ + .byte $00 ; 33/21 _____!_____ + .byte $00 ; 34/22 _____"_____ + .byte $00 ; 35/23 _____#_____ + .byte $00 ; 36/24 _____$_____ + .byte $00 ; 37/25 _____%_____ + .byte $00 ; 38/26 _____&_____ + .byte $00 ; 39/27 _____'_____ + .byte $00 ; 40/28 _____(_____ + .byte $00 ; 41/29 _____)_____ + .byte $00 ; 42/2a _____*_____ + .byte $00 ; 43/2b _____+_____ + .byte $00 ; 44/2c _____,_____ + .byte $00 ; 45/2d _____-_____ + .byte $00 ; 46/2e _____._____ + .byte $00 ; 47/2f _____/_____ + .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ + .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ + .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ + .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ + .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ + .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ + .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ + .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ + .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ + .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ + .byte $00 ; 58/3a _____:_____ + .byte $00 ; 59/3b _____;_____ + .byte $00 ; 60/3c _____<_____ + .byte $00 ; 61/3d _____=_____ + .byte $00 ; 62/3e _____>_____ + .byte $00 ; 63/3f _____?_____ - .byte $00 ; 64/40 _____@_____ - .byte CT_LOWER | CT_XDIGIT ; 65/41 _____a_____ - .byte CT_LOWER | CT_XDIGIT ; 66/42 _____b_____ - .byte CT_LOWER | CT_XDIGIT ; 67/43 _____c_____ - .byte CT_LOWER | CT_XDIGIT ; 68/44 _____d_____ - .byte CT_LOWER | CT_XDIGIT ; 69/45 _____e_____ - .byte CT_LOWER | CT_XDIGIT ; 70/46 _____f_____ - .byte CT_LOWER ; 71/47 _____g_____ - .byte CT_LOWER ; 72/48 _____h_____ - .byte CT_LOWER ; 73/49 _____i_____ - .byte CT_LOWER ; 74/4a _____j_____ - .byte CT_LOWER ; 75/4b _____k_____ - .byte CT_LOWER ; 76/4c _____l_____ - .byte CT_LOWER ; 77/4d _____m_____ - .byte CT_LOWER ; 78/4e _____n_____ - .byte CT_LOWER ; 79/4f _____o_____ - .byte CT_LOWER ; 80/50 _____p_____ - .byte CT_LOWER ; 81/51 _____q_____ - .byte CT_LOWER ; 82/52 _____r_____ - .byte CT_LOWER ; 83/53 _____s_____ - .byte CT_LOWER ; 84/54 _____t_____ - .byte CT_LOWER ; 85/55 _____u_____ - .byte CT_LOWER ; 86/56 _____v_____ - .byte CT_LOWER ; 87/57 _____w_____ - .byte CT_LOWER ; 88/58 _____x_____ - .byte CT_LOWER ; 89/59 _____y_____ - .byte CT_LOWER ; 90/5a _____z_____ - .byte $00 ; 91/5b _____[_____ - .byte $00 ; 92/5c _____\_____ - .byte $00 ; 93/5d _____]_____ - .byte $00 ; 94/5e _____^_____ - .byte $00 ; 95/5f _UNDERLINE_ - .byte $00 ; 96/60 _A`_grave__ - .byte $00 ; 97/61 _A'_acute__ - .byte $00 ; 98/62 _A^_circum_ - .byte $00 ; 99/63 _A~_tilde__ - .byte $00 ; 100/64 _A"_dieres_ - .byte $00 ; 101/65 _A__ring___ - .byte $00 ; 102/66 _AE________ - .byte $00 ; 103/67 _C,cedilla_ - .byte $00 ; 104/68 _E`_grave__ - .byte $00 ; 105/69 _E'_acute__ - .byte $00 ; 106/6a _E^_circum_ - .byte $00 ; 107/6b _E"_dieres_ - .byte $00 ; 108/6c _I`_grave__ - .byte $00 ; 109/6d _I'_acute__ - .byte $00 ; 110/6e _I^_circum_ - .byte $00 ; 111/6f _I"_dieres_ - .byte $00 ; 112/70 _D-_Eth_lr_ - .byte $00 ; 113/71 _N~_tilde__ - .byte $00 ; 114/72 _O`_grave__ - .byte $00 ; 115/73 _O'_acute__ - .byte $00 ; 116/74 _O^_circum_ - .byte $00 ; 117/75 _O~_tilde__ - .byte $00 ; 118/76 _O"_dieres_ - .byte $00 ; 119/77 __multiply_ - .byte $00 ; 120/78 _O/_slash__ - .byte $00 ; 121/79 _U`_grave__ - .byte $00 ; 122/7a _U'_acute__ - .byte $00 ; 123/7b _U^_circum_ - .byte $00 ; 124/7c _U"_dieres_ - .byte $00 ; 125/7d _Y'_acute__ - .byte $00 ; 126/7e _cap_thorn_ - .byte $00 ; 127/7f _Es-sed_B__ + .byte $00 ; 64/40 _____@_____ + .byte CT_LOWER | CT_XDIGIT ; 65/41 _____a_____ + .byte CT_LOWER | CT_XDIGIT ; 66/42 _____b_____ + .byte CT_LOWER | CT_XDIGIT ; 67/43 _____c_____ + .byte CT_LOWER | CT_XDIGIT ; 68/44 _____d_____ + .byte CT_LOWER | CT_XDIGIT ; 69/45 _____e_____ + .byte CT_LOWER | CT_XDIGIT ; 70/46 _____f_____ + .byte CT_LOWER ; 71/47 _____g_____ + .byte CT_LOWER ; 72/48 _____h_____ + .byte CT_LOWER ; 73/49 _____i_____ + .byte CT_LOWER ; 74/4a _____j_____ + .byte CT_LOWER ; 75/4b _____k_____ + .byte CT_LOWER ; 76/4c _____l_____ + .byte CT_LOWER ; 77/4d _____m_____ + .byte CT_LOWER ; 78/4e _____n_____ + .byte CT_LOWER ; 79/4f _____o_____ + .byte CT_LOWER ; 80/50 _____p_____ + .byte CT_LOWER ; 81/51 _____q_____ + .byte CT_LOWER ; 82/52 _____r_____ + .byte CT_LOWER ; 83/53 _____s_____ + .byte CT_LOWER ; 84/54 _____t_____ + .byte CT_LOWER ; 85/55 _____u_____ + .byte CT_LOWER ; 86/56 _____v_____ + .byte CT_LOWER ; 87/57 _____w_____ + .byte CT_LOWER ; 88/58 _____x_____ + .byte CT_LOWER ; 89/59 _____y_____ + .byte CT_LOWER ; 90/5a _____z_____ + .byte $00 ; 91/5b _____[_____ + .byte $00 ; 92/5c _____\_____ + .byte $00 ; 93/5d _____]_____ + .byte $00 ; 94/5e _____^_____ + .byte $00 ; 95/5f _UNDERLINE_ + .byte $00 ; 96/60 _A`_grave__ + .byte $00 ; 97/61 _A'_acute__ + .byte $00 ; 98/62 _A^_circum_ + .byte $00 ; 99/63 _A~_tilde__ + .byte $00 ; 100/64 _A"_dieres_ + .byte $00 ; 101/65 _A__ring___ + .byte $00 ; 102/66 _AE________ + .byte $00 ; 103/67 _C,cedilla_ + .byte $00 ; 104/68 _E`_grave__ + .byte $00 ; 105/69 _E'_acute__ + .byte $00 ; 106/6a _E^_circum_ + .byte $00 ; 107/6b _E"_dieres_ + .byte $00 ; 108/6c _I`_grave__ + .byte $00 ; 109/6d _I'_acute__ + .byte $00 ; 110/6e _I^_circum_ + .byte $00 ; 111/6f _I"_dieres_ + .byte $00 ; 112/70 _D-_Eth_lr_ + .byte $00 ; 113/71 _N~_tilde__ + .byte $00 ; 114/72 _O`_grave__ + .byte $00 ; 115/73 _O'_acute__ + .byte $00 ; 116/74 _O^_circum_ + .byte $00 ; 117/75 _O~_tilde__ + .byte $00 ; 118/76 _O"_dieres_ + .byte $00 ; 119/77 __multiply_ + .byte $00 ; 120/78 _O/_slash__ + .byte $00 ; 121/79 _U`_grave__ + .byte $00 ; 122/7a _U'_acute__ + .byte $00 ; 123/7b _U^_circum_ + .byte $00 ; 124/7c _U"_dieres_ + .byte $00 ; 125/7d _Y'_acute__ + .byte $00 ; 126/7e _cap_thorn_ + .byte $00 ; 127/7f _Es-sed_B__ - .byte CT_CTRL ; 128/80 __bullet___ - .byte CT_CTRL ; 129/81 __v_line___ - .byte CT_CTRL ; 130/82 __h_line___ - .byte CT_CTRL ; 131/83 ___cross___ - .byte CT_CTRL ; 132/84 _tl_corner_ - .byte CT_CTRL ; 133/85 _tr_corner_ - .byte CT_CTRL ; 134/86 _bl_corner_ - .byte CT_CTRL ; 135/87 _br_corner_ - .byte CT_CTRL ; 136/88 ___l_tee___ - .byte CT_CTRL ; 137/89 ___r_tee___ - .byte CT_CTRL ; 138/8a ___t_tee___ - .byte CT_CTRL ; 139/8b ___b_tee___ - .byte CT_CTRL ; 140/8c ___heart___ - .byte CT_CTRL | CT_OTHER_WS ; 141/8d _CR/diamond - .byte CT_CTRL ; 142/8e ___club____ - .byte CT_CTRL ; 143/8f ___spade___ - .byte CT_CTRL ; 144/90 _s_circle__ - .byte CT_CTRL | CT_OTHER_WS ; 145/91 _cursor-up_ - .byte CT_CTRL ; 146/92 ___pound___ - .byte CT_CTRL | CT_OTHER_WS ; 147/93 _CLS/check_ - .byte CT_CTRL | CT_OTHER_WS ; 148/94 __INSert___ - .byte CT_CTRL ; 149/95 ____+/-____ - .byte CT_CTRL ; 150/96 __divide___ - .byte CT_CTRL ; 151/97 __degree___ - .byte CT_CTRL ; 152/98 _c_checker_ - .byte CT_CTRL ; 153/99 _f_checker_ - .byte CT_CTRL ; 154/9a _solid_sq__ - .byte CT_CTRL ; 155/9b __cr_char__ - .byte CT_CTRL ; 156/9c _up_arrow__ - .byte CT_CTRL | CT_OTHER_WS ; 157/9d cursor-left - .byte CT_CTRL ; 158/9e _left_arro_ - .byte CT_CTRL ; 159/9f _right_arr_ - .byte CT_SPACE | CT_SPACE_TAB ; 160/a0 _req space_ - .byte $00 ; 161/a1 _!_invertd_ - .byte $00 ; 162/a2 ___cent____ - .byte $00 ; 163/a3 ___pound___ - .byte $00 ; 164/a4 __currency_ - .byte $00 ; 165/a5 ____yen____ - .byte $00 ; 166/a6 _|_broken__ - .byte $00 ; 167/a7 __section__ - .byte $00 ; 168/a8 __umulaut__ - .byte $00 ; 169/a9 _copyright_ - .byte $00 ; 170/aa __fem_ord__ - .byte $00 ; 171/ab _l_ang_quo_ - .byte $00 ; 172/ac ____not____ - .byte $00 ; 173/ad _syl_hyphn_ - .byte $00 ; 174/ae _registerd_ - .byte $00 ; 175/af _overline__ - .byte $00 ; 176/b0 __degrees__ - .byte $00 ; 177/b1 ____+/-____ - .byte $00 ; 178/b2 _2_supersc_ - .byte $00 ; 179/b3 _3_supersc_ - .byte $00 ; 180/b4 ___acute___ - .byte $00 ; 181/b5 ____mu_____ - .byte $00 ; 182/b6 _paragraph_ - .byte $00 ; 183/b7 __mid_dot__ - .byte $00 ; 184/b8 __cedilla__ - .byte $00 ; 185/b9 _1_supersc_ - .byte $00 ; 186/ba __mas_ord__ - .byte $00 ; 187/bb _r_ang_quo_ - .byte $00 ; 188/bc ____1/4____ - .byte $00 ; 189/bd ____1/2____ - .byte $00 ; 190/be ____3/4____ - .byte $00 ; 191/bf _?_invertd_ + .byte CT_CTRL ; 128/80 __bullet___ + .byte CT_CTRL ; 129/81 __v_line___ + .byte CT_CTRL ; 130/82 __h_line___ + .byte CT_CTRL ; 131/83 ___cross___ + .byte CT_CTRL ; 132/84 _tl_corner_ + .byte CT_CTRL ; 133/85 _tr_corner_ + .byte CT_CTRL ; 134/86 _bl_corner_ + .byte CT_CTRL ; 135/87 _br_corner_ + .byte CT_CTRL ; 136/88 ___l_tee___ + .byte CT_CTRL ; 137/89 ___r_tee___ + .byte CT_CTRL ; 138/8a ___t_tee___ + .byte CT_CTRL ; 139/8b ___b_tee___ + .byte CT_CTRL ; 140/8c ___heart___ + .byte CT_CTRL | CT_OTHER_WS ; 141/8d _CR/diamond + .byte CT_CTRL ; 142/8e ___club____ + .byte CT_CTRL ; 143/8f ___spade___ + .byte CT_CTRL ; 144/90 _s_circle__ + .byte CT_CTRL | CT_OTHER_WS ; 145/91 _cursor-up_ + .byte CT_CTRL ; 146/92 ___pound___ + .byte CT_CTRL | CT_OTHER_WS ; 147/93 _CLS/check_ + .byte CT_CTRL | CT_OTHER_WS ; 148/94 __INSert___ + .byte CT_CTRL ; 149/95 ____+/-____ + .byte CT_CTRL ; 150/96 __divide___ + .byte CT_CTRL ; 151/97 __degree___ + .byte CT_CTRL ; 152/98 _c_checker_ + .byte CT_CTRL ; 153/99 _f_checker_ + .byte CT_CTRL ; 154/9a _solid_sq__ + .byte CT_CTRL ; 155/9b __cr_char__ + .byte CT_CTRL ; 156/9c _up_arrow__ + .byte CT_CTRL | CT_OTHER_WS ; 157/9d cursor-left + .byte CT_CTRL ; 158/9e _left_arro_ + .byte CT_CTRL ; 159/9f _right_arr_ + .byte CT_SPACE | CT_SPACE_TAB ; 160/a0 _req space_ + .byte $00 ; 161/a1 _!_invertd_ + .byte $00 ; 162/a2 ___cent____ + .byte $00 ; 163/a3 ___pound___ + .byte $00 ; 164/a4 __currency_ + .byte $00 ; 165/a5 ____yen____ + .byte $00 ; 166/a6 _|_broken__ + .byte $00 ; 167/a7 __section__ + .byte $00 ; 168/a8 __umulaut__ + .byte $00 ; 169/a9 _copyright_ + .byte $00 ; 170/aa __fem_ord__ + .byte $00 ; 171/ab _l_ang_quo_ + .byte $00 ; 172/ac ____not____ + .byte $00 ; 173/ad _syl_hyphn_ + .byte $00 ; 174/ae _registerd_ + .byte $00 ; 175/af _overline__ + .byte $00 ; 176/b0 __degrees__ + .byte $00 ; 177/b1 ____+/-____ + .byte $00 ; 178/b2 _2_supersc_ + .byte $00 ; 179/b3 _3_supersc_ + .byte $00 ; 180/b4 ___acute___ + .byte $00 ; 181/b5 ____mu_____ + .byte $00 ; 182/b6 _paragraph_ + .byte $00 ; 183/b7 __mid_dot__ + .byte $00 ; 184/b8 __cedilla__ + .byte $00 ; 185/b9 _1_supersc_ + .byte $00 ; 186/ba __mas_ord__ + .byte $00 ; 187/bb _r_ang_quo_ + .byte $00 ; 188/bc ____1/4____ + .byte $00 ; 189/bd ____1/2____ + .byte $00 ; 190/be ____3/4____ + .byte $00 ; 191/bf _?_invertd_ - .byte $00 ; 192/c0 _____`_____ - .byte CT_UPPER | CT_XDIGIT ; 193/c1 _____A_____ - .byte CT_UPPER | CT_XDIGIT ; 194/c2 _____B_____ - .byte CT_UPPER | CT_XDIGIT ; 195/c3 _____C_____ - .byte CT_UPPER | CT_XDIGIT ; 196/c4 _____D_____ - .byte CT_UPPER | CT_XDIGIT ; 197/c5 _____E_____ - .byte CT_UPPER | CT_XDIGIT ; 198/c6 _____F_____ - .byte CT_UPPER ; 199/c7 _____G_____ - .byte CT_UPPER ; 200/c8 _____H_____ - .byte CT_UPPER ; 201/c9 _____I_____ - .byte CT_UPPER ; 202/ca _____J_____ - .byte CT_UPPER ; 203/cb _____K_____ - .byte CT_UPPER ; 204/cc _____L_____ - .byte CT_UPPER ; 205/cd _____M_____ - .byte CT_UPPER ; 206/ce _____N_____ - .byte CT_UPPER ; 207/cf _____O_____ - .byte CT_UPPER ; 208/d0 _____P_____ - .byte CT_UPPER ; 209/d1 _____Q_____ - .byte CT_UPPER ; 210/d2 _____R_____ - .byte CT_UPPER ; 211/d3 _____S_____ - .byte CT_UPPER ; 212/d4 _____T_____ - .byte CT_UPPER ; 213/d5 _____U_____ - .byte CT_UPPER ; 214/d6 _____V_____ - .byte CT_UPPER ; 215/d7 _____W_____ - .byte CT_UPPER ; 216/d8 _____X_____ - .byte CT_UPPER ; 217/d9 _____Y_____ - .byte CT_UPPER ; 218/da _____Z_____ - .byte $00 ; 219/db _____{_____ - .byte $00 ; 220/dc _____|_____ - .byte $00 ; 221/dd _____}_____ - .byte $00 ; 222/de _____~_____ - .byte $00 ; 223/df ___HOUSE___ - .byte $00 ; 224/e0 _a`_grave__ - .byte $00 ; 225/e1 _a'_acute__ - .byte $00 ; 226/e2 _a^_circum_ - .byte $00 ; 227/e3 _a~_tilde__ - .byte $00 ; 228/e4 _a"_dieres_ - .byte $00 ; 229/e5 _a__ring___ - .byte $00 ; 230/e6 _ae________ - .byte $00 ; 231/e7 _c,cedilla_ - .byte $00 ; 232/e8 _e`_grave__ - .byte $00 ; 233/e9 _e'_acute__ - .byte $00 ; 234/ea _e^_circum_ - .byte $00 ; 235/eb _e"_dieres_ - .byte $00 ; 236/ec _i`_grave__ - .byte $00 ; 237/ed _i'_acute__ - .byte $00 ; 238/ee _i^_circum_ - .byte $00 ; 239/ef _i"_dieres_ - .byte $00 ; 240/f0 _o^x_Eth_s_ - .byte $00 ; 241/f1 _n~_tilda__ - .byte $00 ; 242/f2 _o`_grave__ - .byte $00 ; 243/f3 _o'_acute__ - .byte $00 ; 244/f4 _o^_circum_ - .byte $00 ; 245/f5 _o~_tilde__ - .byte $00 ; 246/f6 _o"_dieres_ - .byte $00 ; 247/f7 __divide___ - .byte $00 ; 248/f8 _o/_slash__ - .byte $00 ; 249/f9 _u`_grave__ - .byte $00 ; 250/fa _u'_acute__ - .byte $00 ; 251/fb _u^_circum_ - .byte $00 ; 252/fc _u"_dieres_ - .byte $00 ; 253/fd _y'_acute__ - .byte $00 ; 254/fe _sm_thorn__ - .byte $00 ; 255/ff _y"_dieres_ + .byte $00 ; 192/c0 _____`_____ + .byte CT_UPPER | CT_XDIGIT ; 193/c1 _____A_____ + .byte CT_UPPER | CT_XDIGIT ; 194/c2 _____B_____ + .byte CT_UPPER | CT_XDIGIT ; 195/c3 _____C_____ + .byte CT_UPPER | CT_XDIGIT ; 196/c4 _____D_____ + .byte CT_UPPER | CT_XDIGIT ; 197/c5 _____E_____ + .byte CT_UPPER | CT_XDIGIT ; 198/c6 _____F_____ + .byte CT_UPPER ; 199/c7 _____G_____ + .byte CT_UPPER ; 200/c8 _____H_____ + .byte CT_UPPER ; 201/c9 _____I_____ + .byte CT_UPPER ; 202/ca _____J_____ + .byte CT_UPPER ; 203/cb _____K_____ + .byte CT_UPPER ; 204/cc _____L_____ + .byte CT_UPPER ; 205/cd _____M_____ + .byte CT_UPPER ; 206/ce _____N_____ + .byte CT_UPPER ; 207/cf _____O_____ + .byte CT_UPPER ; 208/d0 _____P_____ + .byte CT_UPPER ; 209/d1 _____Q_____ + .byte CT_UPPER ; 210/d2 _____R_____ + .byte CT_UPPER ; 211/d3 _____S_____ + .byte CT_UPPER ; 212/d4 _____T_____ + .byte CT_UPPER ; 213/d5 _____U_____ + .byte CT_UPPER ; 214/d6 _____V_____ + .byte CT_UPPER ; 215/d7 _____W_____ + .byte CT_UPPER ; 216/d8 _____X_____ + .byte CT_UPPER ; 217/d9 _____Y_____ + .byte CT_UPPER ; 218/da _____Z_____ + .byte $00 ; 219/db _____{_____ + .byte $00 ; 220/dc _____|_____ + .byte $00 ; 221/dd _____}_____ + .byte $00 ; 222/de _____~_____ + .byte $00 ; 223/df ___HOUSE___ + .byte $00 ; 224/e0 _a`_grave__ + .byte $00 ; 225/e1 _a'_acute__ + .byte $00 ; 226/e2 _a^_circum_ + .byte $00 ; 227/e3 _a~_tilde__ + .byte $00 ; 228/e4 _a"_dieres_ + .byte $00 ; 229/e5 _a__ring___ + .byte $00 ; 230/e6 _ae________ + .byte $00 ; 231/e7 _c,cedilla_ + .byte $00 ; 232/e8 _e`_grave__ + .byte $00 ; 233/e9 _e'_acute__ + .byte $00 ; 234/ea _e^_circum_ + .byte $00 ; 235/eb _e"_dieres_ + .byte $00 ; 236/ec _i`_grave__ + .byte $00 ; 237/ed _i'_acute__ + .byte $00 ; 238/ee _i^_circum_ + .byte $00 ; 239/ef _i"_dieres_ + .byte $00 ; 240/f0 _o^x_Eth_s_ + .byte $00 ; 241/f1 _n~_tilda__ + .byte $00 ; 242/f2 _o`_grave__ + .byte $00 ; 243/f3 _o'_acute__ + .byte $00 ; 244/f4 _o^_circum_ + .byte $00 ; 245/f5 _o~_tilde__ + .byte $00 ; 246/f6 _o"_dieres_ + .byte $00 ; 247/f7 __divide___ + .byte $00 ; 248/f8 _o/_slash__ + .byte $00 ; 249/f9 _u`_grave__ + .byte $00 ; 250/fa _u'_acute__ + .byte $00 ; 251/fb _u^_circum_ + .byte $00 ; 252/fc _u"_dieres_ + .byte $00 ; 253/fd _y'_acute__ + .byte $00 ; 254/fe _sm_thorn__ + .byte $00 ; 255/ff _y"_dieres_ diff --git a/libsrc/cbm/cvline.s b/libsrc/cbm/cvline.s index 151a4925a..f310e4322 100644 --- a/libsrc/cbm/cvline.s +++ b/libsrc/cbm/cvline.s @@ -5,26 +5,26 @@ ; void cvline (unsigned char length); ; - .export _cvlinexy, _cvline - .import popa, _gotoxy, putchar, newline - .importzp tmp1 + .export _cvlinexy, _cvline + .import popa, _gotoxy, putchar, newline + .importzp tmp1 _cvlinexy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length and run into _cvline + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length and run into _cvline _cvline: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - sta tmp1 -L1: lda #93 ; Vertical bar - jsr putchar ; Write, no cursor advance - jsr newline ; Advance cursor to next line - dec tmp1 - bne L1 -L9: rts + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + sta tmp1 +L1: lda #93 ; Vertical bar + jsr putchar ; Write, no cursor advance + jsr newline ; Advance cursor to next line + dec tmp1 + bne L1 +L9: rts diff --git a/libsrc/cbm/dir.h b/libsrc/cbm/dir.h index f3239c4aa..c206e6ed9 100644 --- a/libsrc/cbm/dir.h +++ b/libsrc/cbm/dir.h @@ -15,13 +15,13 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ struct DIR { - int fd; /* File descriptor for directory */ + int fd; /* File descriptor for directory */ unsigned off; /* Current byte offset in directory */ char name[16+1]; /* Name passed to opendir */ }; @@ -29,7 +29,7 @@ struct DIR { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/libsrc/cbm/filename.s b/libsrc/cbm/filename.s index e5884bbdf..a2b8aab5a 100644 --- a/libsrc/cbm/filename.s +++ b/libsrc/cbm/filename.s @@ -172,7 +172,7 @@ drivedone: ; fnaddmode: Add ",m" to a filename, where "m" is passed in A fncomplete: - pha ; Save mode + pha ; Save mode lda __filetype jsr fnaddmode ; Add the type pla diff --git a/libsrc/cbm/gotox.s b/libsrc/cbm/gotox.s index 25de6c3f4..f122a276c 100644 --- a/libsrc/cbm/gotox.s +++ b/libsrc/cbm/gotox.s @@ -4,12 +4,12 @@ ; void gotox (unsigned char x); ; - .export _gotox - .import plot - .importzp CURS_X + .export _gotox + .import plot + .importzp CURS_X -_gotox: sta CURS_X ; Set new position - jmp plot ; And activate it +_gotox: sta CURS_X ; Set new position + jmp plot ; And activate it diff --git a/libsrc/cbm/gotoxy.s b/libsrc/cbm/gotoxy.s index cce95aee5..64c6bd21d 100644 --- a/libsrc/cbm/gotoxy.s +++ b/libsrc/cbm/gotoxy.s @@ -4,14 +4,14 @@ ; void gotoxy (unsigned char x, unsigned char y); ; - .export _gotoxy - .import popa, plot - .importzp CURS_X, CURS_Y + .export _gotoxy + .import popa, plot + .importzp CURS_X, CURS_Y _gotoxy: - sta CURS_Y ; Set Y - jsr popa ; Get X - sta CURS_X ; Set X - jmp plot ; Set the cursor position + sta CURS_Y ; Set Y + jsr popa ; Get X + sta CURS_X ; Set X + jmp plot ; Set the cursor position diff --git a/libsrc/cbm/gotoy.s b/libsrc/cbm/gotoy.s index 7779b54f9..6a7ee87bd 100644 --- a/libsrc/cbm/gotoy.s +++ b/libsrc/cbm/gotoy.s @@ -4,10 +4,10 @@ ; void gotoy (unsigned char y); ; - .export _gotoy - .import plot - .importzp CURS_Y + .export _gotoy + .import plot + .importzp CURS_Y -_gotoy: sta CURS_Y ; Set the new position - jmp plot ; And activate it +_gotoy: sta CURS_Y ; Set the new position + jmp plot ; And activate it diff --git a/libsrc/cbm/initcwd.s b/libsrc/cbm/initcwd.s index 1289b71dc..d5e5b9296 100644 --- a/libsrc/cbm/initcwd.s +++ b/libsrc/cbm/initcwd.s @@ -4,38 +4,38 @@ ; CBM _curunit to _cwd ; - .export initcwd, devicestr - .import curunit, __cwd - .import pusha0, tosudiva0 - .importzp sreg, ptr1, ptr2 + .export initcwd, devicestr + .import curunit, __cwd + .import pusha0, tosudiva0 + .importzp sreg, ptr1, ptr2 - .macpack generic + .macpack generic initcwd: - lda #<__cwd - ldx #>__cwd - sta ptr2 - stx ptr2+1 - lda curunit - ; Fall through + lda #<__cwd + ldx #>__cwd + sta ptr2 + stx ptr2+1 + lda curunit + ; Fall through ;------------------------------------------------------------------------------ ; Convert unit number in A into string representation pointed to by ptr2. devicestr: - jsr pusha0 - lda #10 - jsr tosudiva0 - ldy #0 - lda sreg - beq @L0 ; >=10 - add #'0' - sta (ptr2),y - iny -@L0: lda ptr1 ; rem - add #'0' - sta (ptr2),y - iny - lda #0 - sta (ptr2),y - rts + jsr pusha0 + lda #10 + jsr tosudiva0 + ldy #0 + lda sreg + beq @L0 ; >=10 + add #'0' + sta (ptr2),y + iny +@L0: lda ptr1 ; rem + add #'0' + sta (ptr2),y + iny + lda #0 + sta (ptr2),y + rts diff --git a/libsrc/cbm/open.s b/libsrc/cbm/open.s index dadf82d33..4e57f5efc 100644 --- a/libsrc/cbm/open.s +++ b/libsrc/cbm/open.s @@ -1,7 +1,7 @@ ; ; Ullrich von Bassewitz, 16.11.2002 ; -; int open (const char* name, int flags, ...); /* May take a mode argument */ +; int open (const char* name, int flags, ...); /* May take a mode argument */ ; ; Be sure to keep the value priority of closeallfiles lower than that of ; closeallstreams (which is the high level C file I/O counterpart and must be @@ -58,12 +58,12 @@ next: dex ; Throw away any additional parameters passed through the ellipsis - dey ; Parm count < 4 shouldn't be needed to be... - dey ; ...checked (it generates a c compiler warning) + dey ; Parm count < 4 shouldn't be needed to be... + dey ; ...checked (it generates a c compiler warning) dey - dey - beq parmok ; Branch if parameter count ok - jsr addysp ; Fix stack, throw away unused parameters + dey + beq parmok ; Branch if parameter count ok + jsr addysp ; Fix stack, throw away unused parameters ; Parameters ok. Pop the flags and save them into tmp3 diff --git a/libsrc/cbm/oserrlist.s b/libsrc/cbm/oserrlist.s index b48f90970..c85723910 100644 --- a/libsrc/cbm/oserrlist.s +++ b/libsrc/cbm/oserrlist.s @@ -41,45 +41,45 @@ End: __sys_oserrlist: sys_oserr_entry 1, "Too many open files" - sys_oserr_entry 2, "File is open" - sys_oserr_entry 3, "File not open" - sys_oserr_entry 4, "File not found" - sys_oserr_entry 5, "Device not present" - sys_oserr_entry 6, "File not input" - sys_oserr_entry 7, "File not output" - sys_oserr_entry 8, "Filename missing" - sys_oserr_entry 9, "Ilegal device" - sys_oserr_entry 20, "Read error" - sys_oserr_entry 21, "Read error" - sys_oserr_entry 22, "Read error" - sys_oserr_entry 23, "Read error" - sys_oserr_entry 24, "Read error" - sys_oserr_entry 25, "Write error" - sys_oserr_entry 26, "Write protect on" - sys_oserr_entry 27, "Read error" - sys_oserr_entry 28, "Write error" - sys_oserr_entry 29, "Disk ID mismatch" - sys_oserr_entry 30, "Syntax error" - sys_oserr_entry 31, "Syntax error" - sys_oserr_entry 32, "Syntax error" - sys_oserr_entry 33, "Syntax error (invalid file name)" - sys_oserr_entry 34, "Syntax error (no file given)" - sys_oserr_entry 39, "Syntax error" - sys_oserr_entry 50, "Record not present" - sys_oserr_entry 51, "Overflow in record" - sys_oserr_entry 52, "File too large" - sys_oserr_entry 60, "Write file open" - sys_oserr_entry 61, "File not open" - sys_oserr_entry 62, "File not found" - sys_oserr_entry 63, "File exists" - sys_oserr_entry 64, "File type mismatch" - sys_oserr_entry 65, "No block" - sys_oserr_entry 66, "Illegal track or sector" - sys_oserr_entry 67, "Illegal system track or sector" - sys_oserr_entry 70, "No channel" - sys_oserr_entry 71, "Directory error" - sys_oserr_entry 72, "Disk full" - sys_oserr_entry 73, "DOS version mismatch" + sys_oserr_entry 2, "File is open" + sys_oserr_entry 3, "File not open" + sys_oserr_entry 4, "File not found" + sys_oserr_entry 5, "Device not present" + sys_oserr_entry 6, "File not input" + sys_oserr_entry 7, "File not output" + sys_oserr_entry 8, "Filename missing" + sys_oserr_entry 9, "Ilegal device" + sys_oserr_entry 20, "Read error" + sys_oserr_entry 21, "Read error" + sys_oserr_entry 22, "Read error" + sys_oserr_entry 23, "Read error" + sys_oserr_entry 24, "Read error" + sys_oserr_entry 25, "Write error" + sys_oserr_entry 26, "Write protect on" + sys_oserr_entry 27, "Read error" + sys_oserr_entry 28, "Write error" + sys_oserr_entry 29, "Disk ID mismatch" + sys_oserr_entry 30, "Syntax error" + sys_oserr_entry 31, "Syntax error" + sys_oserr_entry 32, "Syntax error" + sys_oserr_entry 33, "Syntax error (invalid file name)" + sys_oserr_entry 34, "Syntax error (no file given)" + sys_oserr_entry 39, "Syntax error" + sys_oserr_entry 50, "Record not present" + sys_oserr_entry 51, "Overflow in record" + sys_oserr_entry 52, "File too large" + sys_oserr_entry 60, "Write file open" + sys_oserr_entry 61, "File not open" + sys_oserr_entry 62, "File not found" + sys_oserr_entry 63, "File exists" + sys_oserr_entry 64, "File type mismatch" + sys_oserr_entry 65, "No block" + sys_oserr_entry 66, "Illegal track or sector" + sys_oserr_entry 67, "Illegal system track or sector" + sys_oserr_entry 70, "No channel" + sys_oserr_entry 71, "Directory error" + sys_oserr_entry 72, "Disk full" + sys_oserr_entry 73, "DOS version mismatch" sys_oserr_entry 74, "Drive not ready" sys_oserr_sentinel "Unknown error" diff --git a/libsrc/cbm/oserror.s b/libsrc/cbm/oserror.s index de1b08c0d..29980548a 100644 --- a/libsrc/cbm/oserror.s +++ b/libsrc/cbm/oserror.s @@ -5,73 +5,73 @@ ; /* Map a system specific error into a system independent code */ ; - .include "errno.inc" + .include "errno.inc" .code __osmaperrno: - ldx #ErrTabSize -@L1: cmp ErrTab-2,x ; Search for the error code - beq @L2 ; Jump if found - dex - dex - bne @L1 ; Next entry + ldx #ErrTabSize +@L1: cmp ErrTab-2,x ; Search for the error code + beq @L2 ; Jump if found + dex + dex + bne @L1 ; Next entry ; Code not found, return EUNKNOWN - lda #EUNKNOWN - rts + lda #EUNKNOWN + rts ; Found the code -@L2: lda ErrTab-1,x - ldx #$00 ; High byte always zero - rts +@L2: lda ErrTab-1,x + ldx #$00 ; High byte always zero + rts .rodata ErrTab: - .byte 1, EMFILE ; Too many open files - .byte 2, EINVAL ; File is open - .byte 3, EINVAL ; File not open - .byte 4, ENOENT ; File not found - .byte 5, ENODEV ; Device not present - .byte 6, EINVAL ; File not input - .byte 7, EINVAL ; File not output - .byte 8, EINVAL ; Filename missing - .byte 9, ENODEV ; Ilegal device -; .byte 20, ; Read error -; .byte 21, ; Read error -; .byte 22, ; Read error -; .byte 23, ; Read error -; .byte 24, ; Read error -; .byte 25, ; Write error - .byte 26, EACCES ; Write protect on -; .byte 27, ; Read error -; .byte 28, ; Write error -; .byte 29, ; Disk ID mismatch -; .byte 30, ; Syntax error -; .byte 31, ; Syntax error -; .byte 32, ; Syntax error - .byte 33, EINVAL ; Syntax error (invalid file name) - .byte 34, EINVAL ; Syntax error (no file given) -; .byte 39, ; Syntax error -; .byte 50, ; Record not present -; .byte 51, ; Overflow in record -; .byte 52, ; File too large - .byte 60, EINVAL ; Write file open - .byte 61, EINVAL ; File not open - .byte 62, ENOENT ; File not found - .byte 63, EEXIST ; File exists - .byte 64, EINVAL ; File type mismatch -; .byte 65, ; No block -; .byte 66, ; Illegal track or sector -; .byte 67, ; Illegal system track or sector - .byte 70, EBUSY ; No channel -; .byte 71, ; Directory error -; .byte 72, ; Disk full -; .byte 73, ; DOS version mismatch + .byte 1, EMFILE ; Too many open files + .byte 2, EINVAL ; File is open + .byte 3, EINVAL ; File not open + .byte 4, ENOENT ; File not found + .byte 5, ENODEV ; Device not present + .byte 6, EINVAL ; File not input + .byte 7, EINVAL ; File not output + .byte 8, EINVAL ; Filename missing + .byte 9, ENODEV ; Ilegal device +; .byte 20, ; Read error +; .byte 21, ; Read error +; .byte 22, ; Read error +; .byte 23, ; Read error +; .byte 24, ; Read error +; .byte 25, ; Write error + .byte 26, EACCES ; Write protect on +; .byte 27, ; Read error +; .byte 28, ; Write error +; .byte 29, ; Disk ID mismatch +; .byte 30, ; Syntax error +; .byte 31, ; Syntax error +; .byte 32, ; Syntax error + .byte 33, EINVAL ; Syntax error (invalid file name) + .byte 34, EINVAL ; Syntax error (no file given) +; .byte 39, ; Syntax error +; .byte 50, ; Record not present +; .byte 51, ; Overflow in record +; .byte 52, ; File too large + .byte 60, EINVAL ; Write file open + .byte 61, EINVAL ; File not open + .byte 62, ENOENT ; File not found + .byte 63, EEXIST ; File exists + .byte 64, EINVAL ; File type mismatch +; .byte 65, ; No block +; .byte 66, ; Illegal track or sector +; .byte 67, ; Illegal system track or sector + .byte 70, EBUSY ; No channel +; .byte 71, ; Directory error +; .byte 72, ; Disk full +; .byte 73, ; DOS version mismatch .byte 74, ENODEV ; Drive not ready ErrTabSize = (* - ErrTab) diff --git a/libsrc/cbm/toascii.s b/libsrc/cbm/toascii.s index c44a93278..e491263af 100644 --- a/libsrc/cbm/toascii.s +++ b/libsrc/cbm/toascii.s @@ -5,7 +5,7 @@ ; /* Convert a target specific character to ascii */ ; - .export _toascii + .export _toascii .macpack generic diff --git a/libsrc/cbm/wherex.s b/libsrc/cbm/wherex.s index b8f5e16d4..29cf06fa3 100644 --- a/libsrc/cbm/wherex.s +++ b/libsrc/cbm/wherex.s @@ -4,13 +4,13 @@ ; unsigned char wherex (void); ; - .export _wherex + .export _wherex .import CURS_X: zp .proc _wherex lda CURS_X ldx #$00 - rts + rts .endproc diff --git a/libsrc/cbm/wherey.s b/libsrc/cbm/wherey.s index 53c5b4f6d..9bc74730a 100644 --- a/libsrc/cbm/wherey.s +++ b/libsrc/cbm/wherey.s @@ -4,13 +4,13 @@ ; unsigned char wherey (void); ; - .export _wherey + .export _wherey .import CURS_Y: zp .proc _wherey lda CURS_Y ldx #$00 - rts + rts .endproc diff --git a/libsrc/cbm510/_scrsize.s b/libsrc/cbm510/_scrsize.s index b97c3d226..8b68b8cdc 100644 --- a/libsrc/cbm510/_scrsize.s +++ b/libsrc/cbm510/_scrsize.s @@ -4,7 +4,7 @@ ; Screen size variables ; - .export screensize + .export screensize .import SCREEN screensize = SCREEN diff --git a/libsrc/cbm510/banking.s b/libsrc/cbm510/banking.s index 385f5d5c8..8ed72d02b 100644 --- a/libsrc/cbm510/banking.s +++ b/libsrc/cbm510/banking.s @@ -4,38 +4,38 @@ ; Banking routines for the 610. ; - .export set_bank, sys_bank, restore_bank - .importzp ptr1, segsave + .export set_bank, sys_bank, restore_bank + .importzp ptr1, segsave - .include "cbm510.inc" + .include "cbm510.inc" .code -.proc sys_bank - pha - lda IndReg - sta segsave - lda #$0F - sta IndReg - pla - rts +.proc sys_bank + pha + lda IndReg + sta segsave + lda #$0F + sta IndReg + pla + rts .endproc -.proc set_bank - pha - lda IndReg - sta segsave - pla - sta IndReg - rts +.proc set_bank + pha + lda IndReg + sta segsave + pla + sta IndReg + rts .endproc -.proc restore_bank - pha - lda segsave - sta IndReg - pla - rts +.proc restore_bank + pha + lda segsave + sta IndReg + pla + rts .endproc diff --git a/libsrc/cbm510/break.s b/libsrc/cbm510/break.s index 2c23e77ed..b58db068e 100644 --- a/libsrc/cbm510/break.s +++ b/libsrc/cbm510/break.s @@ -5,66 +5,66 @@ ; void reset_brk (void); ; - .export _set_brk, _reset_brk - .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc - .import _atexit, BRKVec + .export _set_brk, _reset_brk + .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc + .import _atexit, BRKVec - .include "cbm510.inc" + .include "cbm510.inc" .bss -_brk_a: .res 1 -_brk_x: .res 1 -_brk_y: .res 1 -_brk_sr: .res 1 -_brk_pc: .res 2 -_brk_01: .res 1 +_brk_a: .res 1 +_brk_x: .res 1 +_brk_y: .res 1 +_brk_sr: .res 1 +_brk_pc: .res 2 +_brk_01: .res 1 -oldvec: .res 2 ; Old vector +oldvec: .res 2 ; Old vector .data -uservec: jmp $FFFF ; Patched at runtime +uservec: jmp $FFFF ; Patched at runtime .code ; Set the break vector -.proc _set_brk +.proc _set_brk - sta uservec+1 - stx uservec+2 ; Set the user vector + sta uservec+1 + stx uservec+2 ; Set the user vector - lda oldvec - ora oldvec+1 ; Did we save the vector already? - bne L1 ; Jump if we installed the handler already + lda oldvec + ora oldvec+1 ; Did we save the vector already? + bne L1 ; Jump if we installed the handler already - lda BRKVec - sta oldvec - lda BRKVec+1 - sta oldvec+1 ; Save the old vector + lda BRKVec + sta oldvec + lda BRKVec+1 + sta oldvec+1 ; Save the old vector -L1: lda #brk_handler - sta BRKVec - stx BRKVec+1 - rts +L1: lda #brk_handler + sta BRKVec + stx BRKVec+1 + rts .endproc ; Reset the break vector -.proc _reset_brk +.proc _reset_brk - lda oldvec - ldx oldvec+1 - beq @L9 ; Jump if vector not installed - sta BRKVec - stx BRKVec+1 - lda #$00 - sta oldvec ; Clear the old vector - stx oldvec+1 -@L9: rts + lda oldvec + ldx oldvec+1 + beq @L9 ; Jump if vector not installed + sta BRKVec + stx BRKVec+1 + lda #$00 + sta oldvec ; Clear the old vector + stx oldvec+1 +@L9: rts .endproc @@ -72,42 +72,42 @@ L1: lda #__BSS_RUN__ - sta ptr1+1 - lda #0 - tay + lda #<__BSS_RUN__ + sta ptr1 + lda #>__BSS_RUN__ + sta ptr1+1 + lda #0 + tay ; Clear full pages - ldx #>__BSS_SIZE__ - beq Z2 -Z1: sta (ptr1),y - iny - bne Z1 - inc ptr1+1 ; Next page - dex - bne Z1 + ldx #>__BSS_SIZE__ + beq Z2 +Z1: sta (ptr1),y + iny + bne Z1 + inc ptr1+1 ; Next page + dex + bne Z1 ; Clear the remaining page -Z2: ldx #<__BSS_SIZE__ - beq Z4 -Z3: sta (ptr1),y - iny - dex - bne Z3 +Z2: ldx #<__BSS_SIZE__ + beq Z4 +Z3: sta (ptr1),y + iny + dex + bne Z3 Z4: jmp Init ; ------------------------------------------------------------------------ @@ -349,32 +349,32 @@ Z4: jmp Init ; Copy the character rom from the system bank into the execution bank Init: lda #<$C000 - sta ptr1 - lda #>$C000 - sta ptr1+1 - lda #<__CHARRAM_START__ - sta ptr2 - lda #>__CHARRAM_START__ - sta ptr2+1 - lda #>__CHARRAM_SIZE__ ; 16 * 256 bytes to copy - sta tmp1 - ldy #$00 -ccopy: lda #$0F - sta IndReg ; Access the system bank -ccopy1: lda (ptr1),y - sta __VIDRAM_START__,y - iny - bne ccopy1 - lda ExecReg - sta IndReg -ccopy2: lda __VIDRAM_START__,y - sta (ptr2),y - iny - bne ccopy2 - inc ptr1+1 - inc ptr2+1 ; Bump high pointer bytes - dec tmp1 - bne ccopy + sta ptr1 + lda #>$C000 + sta ptr1+1 + lda #<__CHARRAM_START__ + sta ptr2 + lda #>__CHARRAM_START__ + sta ptr2+1 + lda #>__CHARRAM_SIZE__ ; 16 * 256 bytes to copy + sta tmp1 + ldy #$00 +ccopy: lda #$0F + sta IndReg ; Access the system bank +ccopy1: lda (ptr1),y + sta __VIDRAM_START__,y + iny + bne ccopy1 + lda ExecReg + sta IndReg +ccopy2: lda __VIDRAM_START__,y + sta (ptr2),y + iny + bne ccopy2 + inc ptr1+1 + inc ptr2+1 ; Bump high pointer bytes + dec tmp1 + bne ccopy ; Clear the video memory. We will do this before switching the video to bank 0 ; to avoid garbage when doing so. @@ -384,67 +384,67 @@ ccopy2: lda __VIDRAM_START__,y ; Reprogram the VIC so that the text screen and the character ROM is in the ; execution bank. This is done in three steps: - lda #$0F ; We need access to the system bank - sta IndReg + lda #$0F ; We need access to the system bank + sta IndReg ; Place the VIC video RAM into bank 0 ; CA (STATVID) = 0 ; CB (VICDOTSEL) = 0 - ldy #TPI::CR - lda (tpi1),y - sta vidsave+0 - and #%00001111 - ora #%10100000 - sta (tpi1),y + ldy #TPI::CR + lda (tpi1),y + sta vidsave+0 + and #%00001111 + ora #%10100000 + sta (tpi1),y ; Set bit 14/15 of the VIC address range to the high bits of __VIDRAM_START__ ; PC6/PC7 (VICBANKSEL 0/1) = 11 - ldy #TPI::PRC - lda (tpi2),y - sta vidsave+1 - and #$3F - ora #<((>__VIDRAM_START__) & $C0) - sta (tpi2),y + ldy #TPI::PRC + lda (tpi2),y + sta vidsave+1 + and #$3F + ora #<((>__VIDRAM_START__) & $C0) + sta (tpi2),y ; Set the VIC base address register to the addresses of the video and ; character RAM. - ldy #VIC_VIDEO_ADR - lda (vic),y - sta vidsave+2 - and #$01 - ora #<(((__VIDRAM_START__ >> 6) & $F0) | ((__CHARRAM_START__ >> 10) & $0E) | $02) -; and #$0F -; ora #<(((>__VIDRAM_START__) << 2) & $F0) - sta (vic),y + ldy #VIC_VIDEO_ADR + lda (vic),y + sta vidsave+2 + and #$01 + ora #<(((__VIDRAM_START__ >> 6) & $F0) | ((__CHARRAM_START__ >> 10) & $0E) | $02) +; and #$0F +; ora #<(((>__VIDRAM_START__) << 2) & $F0) + sta (vic),y ; Switch back to the execution bank lda ExecReg - sta IndReg + sta IndReg ; Activate chained interrupt handlers, then enable interrupts. lda #.lobyte(__INTERRUPTOR_COUNT__*2) sta irqcount - cli + cli ; Call module constructors. - jsr initlib + jsr initlib ; Push arguments and call main() - jsr callmain + jsr callmain ; Call module destructors. This is also the _exit entry and the default entry ; point for the break vector. -_exit: pha ; Save the return code on stack - jsr donelib ; Run module destructors - lda #$00 +_exit: pha ; Save the return code on stack + jsr donelib ; Run module destructors + lda #$00 sta irqcount ; Disable custom irq handlers ; Address the system bank @@ -454,17 +454,17 @@ _exit: pha ; Save the return code on stack ; Switch back the video to the system bank - ldy #TPI::CR - lda vidsave+0 - sta (tpi1),y + ldy #TPI::CR + lda vidsave+0 + sta (tpi1),y - ldy #TPI::PRC - lda vidsave+1 - sta (tpi2),y + ldy #TPI::PRC + lda vidsave+1 + sta (tpi2),y - ldy #VIC_VIDEO_ADR - lda vidsave+2 - sta (vic),y + ldy #VIC_VIDEO_ADR + lda vidsave+2 + sta (vic),y ; Copy stuff back from our zeropage to the systems @@ -484,9 +484,9 @@ _exit: pha ; Save the return code on stack ; Place the program return code into ST - pla - ldy #$9C ; ST - sta (sysp0),y + pla + ldy #$9C ; ST + sta (sysp0),y ; Setup the welcome code at the stack bottom in the system bank. @@ -499,9 +499,9 @@ _exit: pha ; Save the return code on stack iny lda #$60 ; RTS opcode sta (sysp1),y - lda IndReg + lda IndReg sei - txs + txs jmp Back ; ------------------------------------------------------------------------- @@ -509,7 +509,7 @@ _exit: pha ; Save the return code on stack ; easier chaining, we do handle the IRQs in the execution bank (instead of ; passing them to the system bank). -; This is the mapping of the active irq register of the 6525 (tpi1): +; This is the mapping of the active irq register of the 6525 (tpi1): ; ; Bit 7 6 5 4 3 2 1 0 ; | | | | ^ 50 Hz @@ -527,10 +527,10 @@ irq: pha pha lda ExecReg sta IndReg ; Be sure to address our segment - tsx - lda $105,x ; Get the flags from the stack - and #$10 ; Test break flag - bne dobrk + tsx + lda $105,x ; Get the flags from the stack + and #$10 ; Test break flag + bne dobrk ; It's an IRQ @@ -538,46 +538,46 @@ irq: pha ; Call chained IRQ handlers - ldy irqcount + ldy irqcount beq irqskip - jsr callirq_y ; Call the functions + jsr callirq_y ; Call the functions ; Done with chained IRQ handlers, check the TPI for IRQs and handle them -irqskip:lda #$0F - sta IndReg - ldy #TPI::AIR - lda (tpi1),y ; Interrupt Register 6525 - beq noirq +irqskip:lda #$0F + sta IndReg + ldy #TPI::AIR + lda (tpi1),y ; Interrupt Register 6525 + beq noirq ; 50/60Hz interrupt - cmp #%00000001 ; ticker irq? - bne irqend - jsr scnkey ; Poll the keyboard - jsr UDTIM ; Bump the time + cmp #%00000001 ; ticker irq? + bne irqend + jsr scnkey ; Poll the keyboard + jsr UDTIM ; Bump the time ; Done -irqend: ldy #TPI::AIR - sta (tpi1),y ; Clear interrupt +irqend: ldy #TPI::AIR + sta (tpi1),y ; Clear interrupt -noirq: pla +noirq: pla sta IndReg pla tay pla tax pla -nmi: rti +nmi: rti -dobrk: jmp (BRKVec) +dobrk: jmp (BRKVec) ; ------------------------------------------------------------------------- ; Data area .data -vidsave:.res 3 +vidsave:.res 3 .bss irqcount: .byte 0 diff --git a/libsrc/cbm510/devnum.s b/libsrc/cbm510/devnum.s index a10004e85..d678a2a92 100644 --- a/libsrc/cbm510/devnum.s +++ b/libsrc/cbm510/devnum.s @@ -2,6 +2,6 @@ ; Oliver Schmidt, 2010-02-14 ; - .include "extzp.inc" + .include "extzp.inc" - .exportzp devnum := DEVNUM + .exportzp devnum := DEVNUM diff --git a/libsrc/cbm510/emd/cbm510-ram.s b/libsrc/cbm510/emd/cbm510-ram.s index 42474b051..65ebbddf8 100644 --- a/libsrc/cbm510/emd/cbm510-ram.s +++ b/libsrc/cbm510/emd/cbm510-ram.s @@ -5,9 +5,9 @@ ; Ullrich von Bassewitz, 2002-12-09, 2003-12-27 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" + .include "em-kernel.inc" .include "em-error.inc" .include "cbm510.inc" @@ -22,7 +22,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -32,7 +32,7 @@ .word MAP .word USE .word COMMIT - .word COPYFROM + .word COPYFROM .word COPYTO ; ------------------------------------------------------------------------ @@ -48,7 +48,7 @@ OFFS = 2 curpage: .res 1 ; Current page number window: .res 256 ; Memory "window" -pagecount: .res 1 ; Number of available pages +pagecount: .res 1 ; Number of available pages .code @@ -61,14 +61,14 @@ pagecount: .res 1 ; Number of available pages ; INSTALL: - lda #$FF + lda #$FF sta curpage ; Invalidate the current page sta pagecount ; Assume all memory available sec jsr $FF99 ; MEMTOP - cmp #RAMBANK ; Top of memory in bank 2? + cmp #RAMBANK ; Top of memory in bank 2? bne @L1 ; No: We can use all the memory txa sub #OFFS @@ -78,7 +78,7 @@ INSTALL: @L1: lda #EM_ERR_OK -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -104,11 +104,11 @@ PAGECOUNT: ; by the driver. ; -MAP: sta curpage ; Remember the new page +MAP: sta curpage ; Remember the new page - sta ptr1+1 - lda #OFFS - sta ptr1 + sta ptr1+1 + lda #OFFS + sta ptr1 ; Transfer one page @@ -143,7 +143,7 @@ USE: sta curpage ; Remember the page ; ------------------------------------------------------------------------ ; COMMIT: Commit changes in the memory window to extended storage. -COMMIT: lda curpage ; Get the current page +COMMIT: lda curpage ; Get the current page cmp #$FF beq done ; Jump if no page mapped diff --git a/libsrc/cbm510/extzp.s b/libsrc/cbm510/extzp.s index abbfd2c43..a1ad6b673 100644 --- a/libsrc/cbm510/extzp.s +++ b/libsrc/cbm510/extzp.s @@ -19,20 +19,20 @@ ; initializer table sysp1: .res 2 sysp3: .res 2 -vic: .res 2 -sid: .res 2 -cia1: .res 2 -cia2: .res 2 -acia: .res 2 -tpi1: .res 2 -tpi2: .res 2 -ktab1: .res 2 -ktab2: .res 2 -ktab3: .res 2 -ktab4: .res 2 +vic: .res 2 +sid: .res 2 +cia1: .res 2 +cia2: .res 2 +acia: .res 2 +tpi1: .res 2 +tpi2: .res 2 +ktab1: .res 2 +ktab2: .res 2 +ktab3: .res 2 +ktab4: .res 2 sysp0: .word $0000 -time: .dword $0000 +time: .dword $0000 segsave: .byte 0 ktmp: .byte 0 CURS_X: .byte 0 diff --git a/libsrc/cbm510/irq.s b/libsrc/cbm510/irq.s index 34294b841..1f5a48b20 100644 --- a/libsrc/cbm510/irq.s +++ b/libsrc/cbm510/irq.s @@ -2,8 +2,8 @@ ; IRQ handling (CBM 500 version) ; - .export initirq, doneirq + .export initirq, doneirq initirq: doneirq: - rts + rts diff --git a/libsrc/cbm510/joy/cbm510-std.s b/libsrc/cbm510/joy/cbm510-std.s index 42f9696a7..8a24dcbbb 100644 --- a/libsrc/cbm510/joy/cbm510-std.s +++ b/libsrc/cbm510/joy/cbm510-std.s @@ -5,10 +5,10 @@ ; Ullrich von Bassewitz, 2003-02-16 ; - .include "zeropage.inc" + .include "zeropage.inc" .include "../extzp.inc" - .include "joy-kernel.inc" + .include "joy-kernel.inc" .include "joy-error.inc" .include "cbm510.inc" @@ -22,7 +22,7 @@ ; Driver signature - .byte $6A, $6F, $79 ; "joy" + .byte $6A, $6F, $79 ; "joy" .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) @@ -66,7 +66,7 @@ JOY_COUNT = 2 ; Number of joysticks we support INSTALL: lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -92,45 +92,45 @@ COUNT: READ: ldx #$0F ; Switch to the system bank stx IndReg - tax ; Save joystick number + tax ; Save joystick number ; Get the direction bits - ldy #CIA::PRB - lda (cia2),y ; Read joystick inputs - sta tmp1 + ldy #CIA::PRB + lda (cia2),y ; Read joystick inputs + sta tmp1 ; Get the fire bits ldy #CIA::PRA - lda (cia2),y + lda (cia2),y ; Make the result value - cpx #$00 ; Joystick 0? - bne @L1 ; Jump if no + cpx #$00 ; Joystick 0? + bne @L1 ; Jump if no ; Joystick 1, fire is in bit 6, direction in bit 0-3 - asl a - jmp @L2 + asl a + jmp @L2 ; Joystick 2, fire is in bit 7, direction in bit 5-7 -@L1: ldx #$00 ; High byte of return value - lsr tmp1 - lsr tmp1 - lsr tmp1 - lsr tmp1 +@L1: ldx #$00 ; High byte of return value + lsr tmp1 + lsr tmp1 + lsr tmp1 + lsr tmp1 ; Mask the relavant bits, get the fire bit -@L2: asl a ; Fire bit into carry - lda tmp1 - and #$0F - bcc @L3 - ora #$10 -@L3: eor #$1F ; All bits are inverted +@L2: asl a ; Fire bit into carry + lda tmp1 + and #$0F + bcc @L3 + ora #$10 +@L3: eor #$1F ; All bits are inverted ; Switch back to the execution bank and return the joystick mask in a/x diff --git a/libsrc/cbm510/joy_stat_stddrv.s b/libsrc/cbm510/joy_stat_stddrv.s index 476ca65ad..a38a5bd13 100644 --- a/libsrc/cbm510/joy_stat_stddrv.s +++ b/libsrc/cbm510/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _cbm510_std_joy + .export _joy_static_stddrv + .import _cbm510_std_joy .rodata diff --git a/libsrc/cbm510/joy_stddrv.s b/libsrc/cbm510/joy_stddrv.s index dc7d30f42..e07cb57e3 100644 --- a/libsrc/cbm510/joy_stddrv.s +++ b/libsrc/cbm510/joy_stddrv.s @@ -6,8 +6,8 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "cbm510-std.joy" +_joy_stddrv: .asciiz "cbm510-std.joy" diff --git a/libsrc/cbm510/kbhit.s b/libsrc/cbm510/kbhit.s index 8a94db66e..92c83e795 100644 --- a/libsrc/cbm510/kbhit.s +++ b/libsrc/cbm510/kbhit.s @@ -4,14 +4,14 @@ ; unsigned char kbhit (void); ; - .export _kbhit + .export _kbhit .import keyidx: zp .proc _kbhit ldx #0 ; High byte of return is always zero - lda keyidx ; Get number of characters + lda keyidx ; Get number of characters beq L9 lda #1 L9: rts diff --git a/libsrc/cbm510/kernal.s b/libsrc/cbm510/kernal.s index db9d852eb..9ea4f0e96 100644 --- a/libsrc/cbm510/kernal.s +++ b/libsrc/cbm510/kernal.s @@ -41,43 +41,43 @@ ; replacements (usually short ones where the overhead of the cross bank call ; is not worth the trouble) are commented out. -CINT = $FF81 -IOINIT = $FF84 -RAMTAS = $FF87 -RESTOR = $FF8A -VECTOR = $FF8D -SETMSG = $FF90 -SECOND = $FF93 -TKSA = $FF96 -MEMTOP = $FF99 -MEMBOT = $FF9C -SCNKEY = $FF9F -SETTMO = $FFA2 -ACPTR = $FFA5 -CIOUT = $FFA8 -UNTLK = $FFAB -UNLSN = $FFAE -LISTEN = $FFB1 -TALK = $FFB4 -;READST = $FFB7 -SETLFS = $FFBA -;SETNAM = $FFBD -;OPEN = $FFC0 -;CLOSE = $FFC3 -CHKIN = $FFC6 -CKOUT = $FFC9 -CLRCH = $FFCC -BASIN = $FFCF -BSOUT = $FFD2 -LOAD = $FFD5 -SAVE = $FFD8 -;SETTIM = $FFDB -;RDTIM = $FFDE -STOP = $FFE1 -GETIN = $FFE4 -CLALL = $FFE7 -;UDTIM = $FFEA -;SCREEN = $FFED -PLOT = $FFF0 -;IOBASE = $FFF3 +CINT = $FF81 +IOINIT = $FF84 +RAMTAS = $FF87 +RESTOR = $FF8A +VECTOR = $FF8D +SETMSG = $FF90 +SECOND = $FF93 +TKSA = $FF96 +MEMTOP = $FF99 +MEMBOT = $FF9C +SCNKEY = $FF9F +SETTMO = $FFA2 +ACPTR = $FFA5 +CIOUT = $FFA8 +UNTLK = $FFAB +UNLSN = $FFAE +LISTEN = $FFB1 +TALK = $FFB4 +;READST = $FFB7 +SETLFS = $FFBA +;SETNAM = $FFBD +;OPEN = $FFC0 +;CLOSE = $FFC3 +CHKIN = $FFC6 +CKOUT = $FFC9 +CLRCH = $FFCC +BASIN = $FFCF +BSOUT = $FFD2 +LOAD = $FFD5 +SAVE = $FFD8 +;SETTIM = $FFDB +;RDTIM = $FFDE +STOP = $FFE1 +GETIN = $FFE4 +CLALL = $FFE7 +;UDTIM = $FFEA +;SCREEN = $FFED +PLOT = $FFF0 +;IOBASE = $FFF3 diff --git a/libsrc/cbm510/kiobase.s b/libsrc/cbm510/kiobase.s index 1f21f0249..55e5ba57c 100644 --- a/libsrc/cbm510/kiobase.s +++ b/libsrc/cbm510/kiobase.s @@ -11,9 +11,9 @@ .proc IOBASE - ldx cia - ldy cia+1 - rts + ldx cia + ldy cia+1 + rts .endproc diff --git a/libsrc/cbm510/krdtim.s b/libsrc/cbm510/krdtim.s index 85e2f5a0c..241c6389e 100644 --- a/libsrc/cbm510/krdtim.s +++ b/libsrc/cbm510/krdtim.s @@ -10,12 +10,12 @@ .proc RDTIM - sei - lda time+0 - ldx time+1 - ldy time+2 - cli - rts + sei + lda time+0 + ldx time+1 + ldy time+2 + cli + rts .endproc diff --git a/libsrc/cbm510/kscnkey.s b/libsrc/cbm510/kscnkey.s index 3413c6b80..37af3b1e4 100644 --- a/libsrc/cbm510/kscnkey.s +++ b/libsrc/cbm510/kscnkey.s @@ -4,83 +4,83 @@ ; Keyboard polling stuff for the 510. ; - .export scnkey - .importzp tpi2, ktab1, ktab2, ktab3, ktab4 + .export scnkey + .importzp tpi2, ktab1, ktab2, ktab3, ktab4 .importzp keyidx, keybuf, keyscanbuf, keysave, modkey, norkey .importzp graphmode, lastidx, rptdelay, rptcount - .include "cbm510.inc" + .include "cbm510.inc" -.proc scnkey +.proc scnkey lda #$FF sta modkey sta norkey - lda #$00 - sta keyscanbuf - ldy #TPI::PRB - sta (tpi2),y - ldy #TPI::PRA - sta (tpi2),y + lda #$00 + sta keyscanbuf + ldy #TPI::PRB + sta (tpi2),y + ldy #TPI::PRA + sta (tpi2),y jsr Poll and #$3F eor #$3F bne L1 jmp NoKey -L1: lda #$FF - ldy #TPI::PRA - sta (tpi2),y +L1: lda #$FF + ldy #TPI::PRA + sta (tpi2),y asl a - ldy #TPI::PRB - sta (tpi2),y + ldy #TPI::PRB + sta (tpi2),y jsr Poll pha sta modkey ora #$30 - bne L3 ; Branch always + bne L3 ; Branch always -L2: jsr Poll -L3: ldx #$05 - ldy #$00 -L4: lsr a +L2: jsr Poll +L3: ldx #$05 + ldy #$00 +L4: lsr a bcc L5 - inc keyscanbuf + inc keyscanbuf dex bpl L4 sec - ldy #TPI::PRB - lda (tpi2),y - rol a - sta (tpi2),y - ldy #TPI::PRA - lda (tpi2),y - rol a - sta (tpi2),y + ldy #TPI::PRB + lda (tpi2),y + rol a + sta (tpi2),y + ldy #TPI::PRA + lda (tpi2),y + rol a + sta (tpi2),y bcs L2 pla - bcc NoKey ; Branch always + bcc NoKey ; Branch always -L5: ldy keyscanbuf - sty norkey +L5: ldy keyscanbuf + sty norkey pla asl a asl a asl a bcc L6 bmi L7 - lda (ktab2),y ; Shifted normal key + lda (ktab2),y ; Shifted normal key ldx graphmode beq L8 - lda (ktab3),y ; Shifted key in graph mode + lda (ktab3),y ; Shifted key in graph mode bne L8 -L6: lda (ktab4),y ; Key with ctrl pressed - bne L8 -L7: lda (ktab1),y ; Normal key -L8: tax - cpx #$FF ; Valid key? +L6: lda (ktab4),y ; Key with ctrl pressed + bne L8 +L7: lda (ktab1),y ; Normal key +L8: tax + cpx #$FF ; Valid key? beq Done cpy lastidx beq Repeat @@ -97,17 +97,17 @@ L8: tax inx bne PutKey -NoKey: ldy #$FF -Done: sty lastidx -End: lda #$7F - ldy #TPI::PRA - sta (tpi2),y - ldy #TPI::PRB - lda #$FF - sta (tpi2),y +NoKey: ldy #$FF +Done: sty lastidx +End: lda #$7F + ldy #TPI::PRA + sta (tpi2),y + ldy #TPI::PRB + lda #$FF + sta (tpi2),y rts -Repeat: dec rptdelay +Repeat: dec rptdelay bpl End inc rptdelay dec rptcount @@ -116,7 +116,7 @@ Repeat: dec rptdelay ldx keyidx bne End -PutKey: sta keybuf,x +PutKey: sta keybuf,x inx stx keyidx ldx #$03 @@ -128,14 +128,14 @@ PutKey: sta keybuf,x ; Poll the keyboard port until it's stable -.proc Poll - ldy #TPI::PRC -L1: lda (tpi2),y - sta keysave - lda (tpi2),y - cmp keysave - bne L1 - rts +.proc Poll + ldy #TPI::PRC +L1: lda (tpi2),y + sta keysave + lda (tpi2),y + cmp keysave + bne L1 + rts .endproc diff --git a/libsrc/cbm510/kscreen.s b/libsrc/cbm510/kscreen.s index 87b91c1aa..cab5cbd64 100644 --- a/libsrc/cbm510/kscreen.s +++ b/libsrc/cbm510/kscreen.s @@ -9,8 +9,8 @@ .proc SCREEN - ldx #40 ; Columns - ldy #25 ; Lines - rts + ldx #40 ; Columns + ldy #25 ; Lines + rts .endproc diff --git a/libsrc/cbm510/ksetnam.s b/libsrc/cbm510/ksetnam.s index 8de8f1c49..c338c0de4 100644 --- a/libsrc/cbm510/ksetnam.s +++ b/libsrc/cbm510/ksetnam.s @@ -29,9 +29,9 @@ iny sta (sysp0),y - lda ExecReg ; Assume name is always in this segment - ldy #$92 ; FNAM_SEG - sta (sysp0),y + lda ExecReg ; Assume name is always in this segment + ldy #$92 ; FNAM_SEG + sta (sysp0),y ldy #$9D ; FNAM_LEN pla diff --git a/libsrc/cbm510/ksettim.s b/libsrc/cbm510/ksettim.s index dab570fe6..69f01b4c2 100644 --- a/libsrc/cbm510/ksettim.s +++ b/libsrc/cbm510/ksettim.s @@ -10,12 +10,12 @@ .proc SETTIM - sei - sta time+0 - stx time+1 - sty time+2 - cli - rts + sei + sta time+0 + stx time+1 + sty time+2 + cli + rts .endproc diff --git a/libsrc/cbm510/kudtim.s b/libsrc/cbm510/kudtim.s index 4653d8148..6862787fb 100644 --- a/libsrc/cbm510/kudtim.s +++ b/libsrc/cbm510/kudtim.s @@ -8,16 +8,16 @@ .export UDTIM .import time: zp -.proc UDTIM +.proc UDTIM - inc time - bne L9 - inc time+1 - bne L9 - inc time+2 - bne L9 - inc time+3 -L9: rts + inc time + bne L9 + inc time+1 + bne L9 + inc time+2 + bne L9 + inc time+3 +L9: rts .endproc diff --git a/libsrc/cbm510/mainargs.s b/libsrc/cbm510/mainargs.s index a9233382f..7ed8d46f4 100644 --- a/libsrc/cbm510/mainargs.s +++ b/libsrc/cbm510/mainargs.s @@ -5,8 +5,8 @@ ; - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv ;--------------------------------------------------------------------------- diff --git a/libsrc/cbm510/peeksys.s b/libsrc/cbm510/peeksys.s index 3d551e75c..ea3ed7134 100644 --- a/libsrc/cbm510/peeksys.s +++ b/libsrc/cbm510/peeksys.s @@ -2,49 +2,49 @@ ; Ullrich von Bassewitz, 14.09.2001 ; - .export _peekbsys, _peekwsys - .importzp ptr1 + .export _peekbsys, _peekwsys + .importzp ptr1 - .include "cbm510.inc" + .include "cbm510.inc" ; ------------------------------------------------------------------------ ; unsigned char __fastcall__ peekbsys (unsigned addr); -.proc _peekbsys +.proc _peekbsys - sta ptr1 ; Store argument pointer - stx ptr1+1 - ldx IndReg - lda #$0F - sta IndReg - ldy #$00 - lda (ptr1),y - stx IndReg - ldx #$00 ; Extend to word - rts + sta ptr1 ; Store argument pointer + stx ptr1+1 + ldx IndReg + lda #$0F + sta IndReg + ldy #$00 + lda (ptr1),y + stx IndReg + ldx #$00 ; Extend to word + rts .endproc ; ------------------------------------------------------------------------ ; unsigned __fastcall__ peekwsys (unsigned addr); -.proc _peekwsys +.proc _peekwsys - sta ptr1 ; Store argument pointer - stx ptr1+1 - ldx IndReg - lda #$0F - sta IndReg - ldy #$00 - lda (ptr1),y ; Get low byte - pha - iny - lda (ptr1),y ; Get high byte - stx IndReg - tax ; High byte -> X - pla ; Low byte -> A - rts + sta ptr1 ; Store argument pointer + stx ptr1+1 + ldx IndReg + lda #$0F + sta IndReg + ldy #$00 + lda (ptr1),y ; Get low byte + pha + iny + lda (ptr1),y ; Get high byte + stx IndReg + tax ; High byte -> X + pla ; Low byte -> A + rts .endproc diff --git a/libsrc/cbm510/pokesys.s b/libsrc/cbm510/pokesys.s index 41b456706..ea9c5f45f 100644 --- a/libsrc/cbm510/pokesys.s +++ b/libsrc/cbm510/pokesys.s @@ -4,46 +4,46 @@ ; void pokebsys (unsigned Addr, unsigned char Val); ; void pokewsys (unsigned Addr, unsigned Val); - .export _pokebsys, _pokewsys - .import popsreg - .importzp sreg, tmp1 + .export _pokebsys, _pokewsys + .import popsreg + .importzp sreg, tmp1 - .include "cbm510.inc" + .include "cbm510.inc" ; ------------------------------------------------------------------------ ; -.proc _pokebsys +.proc _pokebsys - jsr popsreg ; Get the address - ldx IndReg - ldy #$0F - sty IndReg ; Switch to the system bank - ldy #$00 - sta (sreg),y - stx IndReg - rts + jsr popsreg ; Get the address + ldx IndReg + ldy #$0F + sty IndReg ; Switch to the system bank + ldy #$00 + sta (sreg),y + stx IndReg + rts .endproc ; ------------------------------------------------------------------------ ; -.proc _pokewsys +.proc _pokewsys - stx tmp1 ; Save high byte - jsr popsreg ; Get the address - ldx IndReg - ldy #$0F - sty IndReg ; Switch to the system bank - ldy #$00 - sta (sreg),y - iny - lda tmp1 - sta (sreg),y - stx IndReg - rts + stx tmp1 ; Save high byte + jsr popsreg ; Get the address + ldx IndReg + ldy #$0F + sty IndReg ; Switch to the system bank + ldy #$00 + sta (sreg),y + iny + lda tmp1 + sta (sreg),y + stx IndReg + rts .endproc diff --git a/libsrc/cbm510/randomize.s b/libsrc/cbm510/randomize.s index ea8d29efd..d5420165c 100644 --- a/libsrc/cbm510/randomize.s +++ b/libsrc/cbm510/randomize.s @@ -5,8 +5,8 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand .importzp time __randomize: diff --git a/libsrc/cbm510/revers.s b/libsrc/cbm510/revers.s index 3d21c9771..1cef04588 100644 --- a/libsrc/cbm510/revers.s +++ b/libsrc/cbm510/revers.s @@ -4,24 +4,24 @@ ; unsigned char revers (unsigned char onoff); ; - .export _revers + .export _revers .import RVS: zp .proc _revers - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value - ldy #$00 ; Assume old value is zero -L1: lda RVS ; Load old value - stx RVS ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value + ldy #$00 ; Assume old value is zero +L1: lda RVS ; Load old value + stx RVS ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts .endproc diff --git a/libsrc/cbm510/ser/cbm510-std.s b/libsrc/cbm510/ser/cbm510-std.s index eeaddaf68..9b721bd41 100644 --- a/libsrc/cbm510/ser/cbm510-std.s +++ b/libsrc/cbm510/ser/cbm510-std.s @@ -25,7 +25,7 @@ .include "../extzp.inc" .include "ser-kernel.inc" .include "ser-error.inc" - .include "cbm510.inc" + .include "cbm510.inc" ; ------------------------------------------------------------------------ @@ -48,7 +48,7 @@ .word PUT .word STATUS .word IOCTL - .word IRQ + .word IRQ ;---------------------------------------------------------------------------- ; @@ -56,19 +56,19 @@ ; .bss -RecvHead: .res 1 ; Head of receive buffer -RecvTail: .res 1 ; Tail of receive buffer -RecvFreeCnt: .res 1 ; Number of bytes in receive buffer -SendHead: .res 1 ; Head of send buffer -SendTail: .res 1 ; Tail of send buffer -SendFreeCnt: .res 1 ; Number of bytes in send buffer +RecvHead: .res 1 ; Head of receive buffer +RecvTail: .res 1 ; Tail of receive buffer +RecvFreeCnt: .res 1 ; Number of bytes in receive buffer +SendHead: .res 1 ; Head of send buffer +SendTail: .res 1 ; Tail of send buffer +SendFreeCnt: .res 1 ; Number of bytes in send buffer -Stopped: .res 1 ; Flow-stopped flag -RtsOff: .res 1 ; +Stopped: .res 1 ; Flow-stopped flag +RtsOff: .res 1 ; ; Send and receive buffers: 256 bytes each -RecvBuf: .res 256 -SendBuf: .res 256 +RecvBuf: .res 256 +SendBuf: .res 256 .rodata @@ -137,14 +137,14 @@ CLOSE: ; Deactivate DTR and disable 6551 interrupts - lda #%00001010 + lda #%00001010 jsr write_cmd ; Done, return an error code lda #SER_ERR_INIT_FAILED - rts + lda #SER_ERR_INIT_FAILED + rts ; Baud rate not available @@ -235,43 +235,43 @@ InvBaud: ; return. ; -GET: ldx SendFreeCnt ; Send data if necessary - inx ; X == $FF? - beq @L1 - lda #$00 - jsr TryToSend +GET: ldx SendFreeCnt ; Send data if necessary + inx ; X == $FF? + beq @L1 + lda #$00 + jsr TryToSend ; Check for buffer empty -@L1: lda RecvFreeCnt - cmp #$ff - bne @L2 - lda #SER_ERR_NO_DATA - rts +@L1: lda RecvFreeCnt + cmp #$ff + bne @L2 + lda #SER_ERR_NO_DATA + rts ; Check for flow stopped & enough free: release flow control -@L2: ldx Stopped - beq @L3 - cmp #63 - bcc @L3 - lda #$00 - sta Stopped - lda RtsOff - ora #%00001000 +@L2: ldx Stopped + beq @L3 + cmp #63 + bcc @L3 + lda #$00 + sta Stopped + lda RtsOff + ora #%00001000 jsr write_cmd ; Get byte from buffer -@L3: ldx RecvHead - lda RecvBuf,x - inc RecvHead - inc RecvFreeCnt - ldx #$00 - sta (ptr1,x) - txa ; Return code = 0 - rts +@L3: ldx RecvHead + lda RecvBuf,x + inc RecvHead + inc RecvFreeCnt + ldx #$00 + sta (ptr1,x) + txa ; Return code = 0 + rts ;---------------------------------------------------------------------------- ; PUT: Output character in A. @@ -282,30 +282,30 @@ PUT: ; Try to send - ldx SendFreeCnt - inx ; X = $ff? - beq @L2 - pha - lda #$00 - jsr TryToSend - pla + ldx SendFreeCnt + inx ; X = $ff? + beq @L2 + pha + lda #$00 + jsr TryToSend + pla ; Put byte into send buffer & send -@L2: ldx SendFreeCnt - bne @L3 - lda #TM - jmp _mktime + lda #TM + jmp _mktime .endproc ;---------------------------------------------------------------------------- ; dec = (((BCD>>4)*10) + (BCD&0xf)) -.proc BCD2dec +.proc BCD2dec - tax - and #%00001111 - sta tmp1 - txa + tax + and #%00001111 + sta tmp1 + txa and #%11110000 ; *16 lsr ; *8 sta tmp2 @@ -86,7 +86,7 @@ AM: jsr BCD2dec ; TM struct with date set to 1970-01-01 .data -TM: .word 0 ; tm_sec +TM: .word 0 ; tm_sec .word 0 ; tm_min .word 0 ; tm_hour .word 1 ; tm_mday diff --git a/libsrc/cbm610/_scrsize.s b/libsrc/cbm610/_scrsize.s index b97c3d226..8b68b8cdc 100644 --- a/libsrc/cbm610/_scrsize.s +++ b/libsrc/cbm610/_scrsize.s @@ -4,7 +4,7 @@ ; Screen size variables ; - .export screensize + .export screensize .import SCREEN screensize = SCREEN diff --git a/libsrc/cbm610/banking.s b/libsrc/cbm610/banking.s index 18e64523f..51316cf8d 100644 --- a/libsrc/cbm610/banking.s +++ b/libsrc/cbm610/banking.s @@ -4,38 +4,38 @@ ; Banking routines for the 610. ; - .export set_bank, sys_bank, restore_bank - .importzp ptr1, segsave + .export set_bank, sys_bank, restore_bank + .importzp ptr1, segsave - .include "cbm610.inc" + .include "cbm610.inc" .code -.proc sys_bank - pha - lda IndReg - sta segsave - lda #$0F - sta IndReg - pla - rts +.proc sys_bank + pha + lda IndReg + sta segsave + lda #$0F + sta IndReg + pla + rts .endproc -.proc set_bank - pha - lda IndReg - sta segsave - pla - sta IndReg - rts +.proc set_bank + pha + lda IndReg + sta segsave + pla + sta IndReg + rts .endproc -.proc restore_bank - pha - lda segsave - sta IndReg - pla - rts +.proc restore_bank + pha + lda segsave + sta IndReg + pla + rts .endproc diff --git a/libsrc/cbm610/break.s b/libsrc/cbm610/break.s index 114ecbfde..03927fa70 100644 --- a/libsrc/cbm610/break.s +++ b/libsrc/cbm610/break.s @@ -5,66 +5,66 @@ ; void reset_brk (void); ; - .export _set_brk, _reset_brk - .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc - .import _atexit, BRKVec + .export _set_brk, _reset_brk + .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc + .import _atexit, BRKVec - .include "cbm610.inc" + .include "cbm610.inc" .bss -_brk_a: .res 1 -_brk_x: .res 1 -_brk_y: .res 1 -_brk_sr: .res 1 -_brk_pc: .res 2 -_brk_01: .res 1 +_brk_a: .res 1 +_brk_x: .res 1 +_brk_y: .res 1 +_brk_sr: .res 1 +_brk_pc: .res 2 +_brk_01: .res 1 -oldvec: .res 2 ; Old vector +oldvec: .res 2 ; Old vector .data -uservec: jmp $FFFF ; Patched at runtime +uservec: jmp $FFFF ; Patched at runtime .code ; Set the break vector -.proc _set_brk +.proc _set_brk - sta uservec+1 - stx uservec+2 ; Set the user vector + sta uservec+1 + stx uservec+2 ; Set the user vector - lda oldvec - ora oldvec+1 ; Did we save the vector already? - bne L1 ; Jump if we installed the handler already + lda oldvec + ora oldvec+1 ; Did we save the vector already? + bne L1 ; Jump if we installed the handler already - lda BRKVec - sta oldvec - lda BRKVec+1 - sta oldvec+1 ; Save the old vector + lda BRKVec + sta oldvec + lda BRKVec+1 + sta oldvec+1 ; Save the old vector -L1: lda #brk_handler - sta BRKVec - stx BRKVec+1 - rts +L1: lda #brk_handler + sta BRKVec + stx BRKVec+1 + rts .endproc ; Reset the break vector -.proc _reset_brk +.proc _reset_brk - lda oldvec - ldx oldvec+1 - beq @L9 ; Jump if vector not installed - sta BRKVec - stx BRKVec+1 - lda #$00 - sta oldvec ; Clear the old vector - stx oldvec+1 -@L9: rts + lda oldvec + ldx oldvec+1 + beq @L9 ; Jump if vector not installed + sta BRKVec + stx BRKVec+1 + lda #$00 + sta oldvec ; Clear the old vector + stx oldvec+1 +@L9: rts .endproc @@ -72,42 +72,42 @@ L1: lda #__BSS_RUN__ - sta ptr1+1 - lda #0 - tay + lda #<__BSS_RUN__ + sta ptr1 + lda #>__BSS_RUN__ + sta ptr1+1 + lda #0 + tay ; Clear full pages - ldx #>__BSS_SIZE__ - beq Z2 -Z1: sta (ptr1),y - iny - bne Z1 - inc ptr1+1 ; Next page - dex - bne Z1 + ldx #>__BSS_SIZE__ + beq Z2 +Z1: sta (ptr1),y + iny + bne Z1 + inc ptr1+1 ; Next page + dex + bne Z1 ; Clear the remaining page -Z2: ldx #<__BSS_SIZE__ - beq Z4 -Z3: sta (ptr1),y - iny - dex - bne Z3 +Z2: ldx #<__BSS_SIZE__ + beq Z4 +Z3: sta (ptr1),y + iny + dex + bne Z3 Z4: jmp Init ; ------------------------------------------------------------------------ @@ -350,22 +350,22 @@ Z4: jmp Init Init: lda #.lobyte(__INTERRUPTOR_COUNT__*2) sta irqcount - cli + cli ; Call module constructors. - jsr initlib + jsr initlib ; Push arguments and call main() - jsr callmain + jsr callmain ; Call module destructors. This is also the _exit entry and the default entry ; point for the break vector. -_exit: pha ; Save the return code - jsr donelib ; Run module destructors - lda #$00 +_exit: pha ; Save the return code + jsr donelib ; Run module destructors + lda #$00 sta irqcount ; Disable custom irq handlers ; Address the system bank @@ -391,9 +391,9 @@ _exit: pha ; Save the return code ; Place the program return code into ST - pla - ldy #$9C ; ST - sta (sysp0),y + pla + ldy #$9C ; ST + sta (sysp0),y ; Setup the welcome code at the stack bottom in the system bank. @@ -406,9 +406,9 @@ _exit: pha ; Save the return code iny lda #$60 ; RTS opcode sta (sysp1),y - lda IndReg + lda IndReg sei - txs + txs jmp Back ; ------------------------------------------------------------------------- @@ -416,7 +416,7 @@ _exit: pha ; Save the return code ; easier chaining, we do handle the IRQs in the execution bank (instead of ; passing them to the system bank). -; This is the mapping of the active irq register of the 6525 (tpi1): +; This is the mapping of the active irq register of the 6525 (tpi1): ; ; Bit 7 6 5 4 3 2 1 0 ; | | | | ^ 50 Hz @@ -434,10 +434,10 @@ irq: pha pha lda ExecReg sta IndReg ; Be sure to address our segment - tsx - lda $105,x ; Get the flags from the stack - and #$10 ; Test break flag - bne dobrk + tsx + lda $105,x ; Get the flags from the stack + and #$10 ; Test break flag + bne dobrk ; It's an IRQ @@ -445,40 +445,40 @@ irq: pha ; Call chained IRQ handlers - ldy irqcount + ldy irqcount beq irqskip - jsr callirq_y ; Call the functions + jsr callirq_y ; Call the functions ; Done with chained IRQ handlers, check the TPI for IRQs and handle them -irqskip:lda #$0F - sta IndReg - ldy #TPI::AIR - lda (tpi1),y ; Interrupt Register 6525 - beq noirq +irqskip:lda #$0F + sta IndReg + ldy #TPI::AIR + lda (tpi1),y ; Interrupt Register 6525 + beq noirq ; 50/60Hz interrupt - cmp #%00000001 ; ticker irq? - bne irqend - jsr scnkey ; Poll the keyboard - jsr UDTIM ; Bump the time + cmp #%00000001 ; ticker irq? + bne irqend + jsr scnkey ; Poll the keyboard + jsr UDTIM ; Bump the time ; Done -irqend: ldy #TPI::AIR - sta (tpi1),y ; Clear interrupt +irqend: ldy #TPI::AIR + sta (tpi1),y ; Clear interrupt -noirq: pla +noirq: pla sta IndReg pla tay pla tax pla -nmi: rti +nmi: rti -dobrk: jmp (BRKVec) +dobrk: jmp (BRKVec) ; ------------------------------------------------------------------------- ; Data area. diff --git a/libsrc/cbm610/crtc.s b/libsrc/cbm610/crtc.s index f7b018409..ad9ddefb5 100644 --- a/libsrc/cbm610/crtc.s +++ b/libsrc/cbm610/crtc.s @@ -4,54 +4,54 @@ ; Write to the CRTC. ; - .export write_crtc, read_crtc - .importzp crtc, ktmp + .export write_crtc, read_crtc + .importzp crtc, ktmp - .include "cbm610.inc" + .include "cbm610.inc" ; Write a value to the CRTC. The index is in Y, the value in A -.proc write_crtc - sta ktmp - lda IndReg - pha - lda #$0F - sta IndReg - tya - ldy #$00 - sei - sta (crtc),y - iny - lda ktmp - sta (crtc),y - cli - pla - sta IndReg - lda ktmp - rts +.proc write_crtc + sta ktmp + lda IndReg + pha + lda #$0F + sta IndReg + tya + ldy #$00 + sei + sta (crtc),y + iny + lda ktmp + sta (crtc),y + cli + pla + sta IndReg + lda ktmp + rts .endproc -.proc read_crtc - sty ktmp - lda IndReg - pha - lda #$0F - sta IndReg - lda ktmp - ldy #$00 - sei - sta (crtc),y - iny - lda (crtc),y - cli - tay - pla - sta IndReg - tya - ldy ktmp - rts +.proc read_crtc + sty ktmp + lda IndReg + pha + lda #$0F + sta IndReg + lda ktmp + ldy #$00 + sei + sta (crtc),y + iny + lda (crtc),y + cli + tay + pla + sta IndReg + tya + ldy ktmp + rts .endproc diff --git a/libsrc/cbm610/devnum.s b/libsrc/cbm610/devnum.s index a10004e85..d678a2a92 100644 --- a/libsrc/cbm610/devnum.s +++ b/libsrc/cbm610/devnum.s @@ -2,6 +2,6 @@ ; Oliver Schmidt, 2010-02-14 ; - .include "extzp.inc" + .include "extzp.inc" - .exportzp devnum := DEVNUM + .exportzp devnum := DEVNUM diff --git a/libsrc/cbm610/emd/cbm610-ram.s b/libsrc/cbm610/emd/cbm610-ram.s index ccdcb4290..8f71e405c 100644 --- a/libsrc/cbm610/emd/cbm610-ram.s +++ b/libsrc/cbm610/emd/cbm610-ram.s @@ -5,9 +5,9 @@ ; Ullrich von Bassewitz, 2002-12-09, 2003-12-20 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "em-kernel.inc" + .include "em-kernel.inc" .include "em-error.inc" .include "cbm610.inc" @@ -22,7 +22,7 @@ ; Driver signature .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte EMD_API_VERSION ; EM API version number ; Jump table. @@ -32,7 +32,7 @@ .word MAP .word USE .word COMMIT - .word COPYFROM + .word COPYFROM .word COPYTO ; ------------------------------------------------------------------------ @@ -48,7 +48,7 @@ OFFS = 2 curpage: .res 1 ; Current page number window: .res 256 ; Memory "window" -pagecount: .res 1 ; Number of available pages +pagecount: .res 1 ; Number of available pages .code @@ -61,14 +61,14 @@ pagecount: .res 1 ; Number of available pages ; INSTALL: - lda #$FF + lda #$FF sta curpage ; Invalidate the current page sta pagecount ; Assume all memory available sec jsr $FF99 ; MEMTOP - cmp #RAMBANK ; Top of memory in bank 2? + cmp #RAMBANK ; Top of memory in bank 2? bne @L1 ; No: We can use all the memory txa sub #OFFS @@ -78,7 +78,7 @@ INSTALL: @L1: lda #EM_ERR_OK -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -104,11 +104,11 @@ PAGECOUNT: ; by the driver. ; -MAP: sta curpage ; Remember the new page +MAP: sta curpage ; Remember the new page - sta ptr1+1 - lda #OFFS - sta ptr1 + sta ptr1+1 + lda #OFFS + sta ptr1 ; Transfer one page @@ -143,7 +143,7 @@ USE: sta curpage ; Remember the page ; ------------------------------------------------------------------------ ; COMMIT: Commit changes in the memory window to extended storage. -COMMIT: lda curpage ; Get the current page +COMMIT: lda curpage ; Get the current page cmp #$FF beq done ; Jump if no page mapped diff --git a/libsrc/cbm610/extzp.s b/libsrc/cbm610/extzp.s index b0f3e7688..0adda5483 100644 --- a/libsrc/cbm610/extzp.s +++ b/libsrc/cbm610/extzp.s @@ -18,20 +18,20 @@ ; initializer table sysp1: .word $0000 sysp3: .word $0000 -crtc: .word $0000 -sid: .word $0000 -ipccia: .word $0000 -cia: .word $0000 -acia: .word $0000 -tpi1: .word $0000 -tpi2: .word $0000 -ktab1: .word $0000 -ktab2: .word $0000 -ktab3: .word $0000 -ktab4: .word $0000 +crtc: .word $0000 +sid: .word $0000 +ipccia: .word $0000 +cia: .word $0000 +acia: .word $0000 +tpi1: .word $0000 +tpi2: .word $0000 +ktab1: .word $0000 +ktab2: .word $0000 +ktab3: .word $0000 +ktab4: .word $0000 sysp0: .word $0000 -time: .dword $0000 +time: .dword $0000 segsave: .byte 0 ktmp: .byte 0 CURS_X: .byte 0 diff --git a/libsrc/cbm610/get_tv.s b/libsrc/cbm610/get_tv.s index 2edc05399..50f909a59 100644 --- a/libsrc/cbm610/get_tv.s +++ b/libsrc/cbm610/get_tv.s @@ -5,16 +5,16 @@ ; /* Return the video mode the machine is using */ ; - .include "get_tv.inc" + .include "get_tv.inc" ;-------------------------------------------------------------------------- ; _get_tv -.proc _get_tv +.proc _get_tv - lda #TV::OTHER - rts + lda #TV::OTHER + rts .endproc diff --git a/libsrc/cbm610/irq.s b/libsrc/cbm610/irq.s index 7b570888c..7003fa58a 100644 --- a/libsrc/cbm610/irq.s +++ b/libsrc/cbm610/irq.s @@ -2,8 +2,8 @@ ; IRQ handling (CBM 600/700 version) ; - .export initirq, doneirq + .export initirq, doneirq initirq: doneirq: - rts + rts diff --git a/libsrc/cbm610/kbhit.s b/libsrc/cbm610/kbhit.s index 09b724b8d..dc66a390b 100644 --- a/libsrc/cbm610/kbhit.s +++ b/libsrc/cbm610/kbhit.s @@ -4,14 +4,14 @@ ; unsigned char kbhit (void); ; - .export _kbhit + .export _kbhit .import keyidx: zp .proc _kbhit ldx #0 ; High byte of return is always zero - lda keyidx ; Get number of characters + lda keyidx ; Get number of characters beq L9 lda #1 L9: rts diff --git a/libsrc/cbm610/kernal.s b/libsrc/cbm610/kernal.s index db9d852eb..9ea4f0e96 100644 --- a/libsrc/cbm610/kernal.s +++ b/libsrc/cbm610/kernal.s @@ -41,43 +41,43 @@ ; replacements (usually short ones where the overhead of the cross bank call ; is not worth the trouble) are commented out. -CINT = $FF81 -IOINIT = $FF84 -RAMTAS = $FF87 -RESTOR = $FF8A -VECTOR = $FF8D -SETMSG = $FF90 -SECOND = $FF93 -TKSA = $FF96 -MEMTOP = $FF99 -MEMBOT = $FF9C -SCNKEY = $FF9F -SETTMO = $FFA2 -ACPTR = $FFA5 -CIOUT = $FFA8 -UNTLK = $FFAB -UNLSN = $FFAE -LISTEN = $FFB1 -TALK = $FFB4 -;READST = $FFB7 -SETLFS = $FFBA -;SETNAM = $FFBD -;OPEN = $FFC0 -;CLOSE = $FFC3 -CHKIN = $FFC6 -CKOUT = $FFC9 -CLRCH = $FFCC -BASIN = $FFCF -BSOUT = $FFD2 -LOAD = $FFD5 -SAVE = $FFD8 -;SETTIM = $FFDB -;RDTIM = $FFDE -STOP = $FFE1 -GETIN = $FFE4 -CLALL = $FFE7 -;UDTIM = $FFEA -;SCREEN = $FFED -PLOT = $FFF0 -;IOBASE = $FFF3 +CINT = $FF81 +IOINIT = $FF84 +RAMTAS = $FF87 +RESTOR = $FF8A +VECTOR = $FF8D +SETMSG = $FF90 +SECOND = $FF93 +TKSA = $FF96 +MEMTOP = $FF99 +MEMBOT = $FF9C +SCNKEY = $FF9F +SETTMO = $FFA2 +ACPTR = $FFA5 +CIOUT = $FFA8 +UNTLK = $FFAB +UNLSN = $FFAE +LISTEN = $FFB1 +TALK = $FFB4 +;READST = $FFB7 +SETLFS = $FFBA +;SETNAM = $FFBD +;OPEN = $FFC0 +;CLOSE = $FFC3 +CHKIN = $FFC6 +CKOUT = $FFC9 +CLRCH = $FFCC +BASIN = $FFCF +BSOUT = $FFD2 +LOAD = $FFD5 +SAVE = $FFD8 +;SETTIM = $FFDB +;RDTIM = $FFDE +STOP = $FFE1 +GETIN = $FFE4 +CLALL = $FFE7 +;UDTIM = $FFEA +;SCREEN = $FFED +PLOT = $FFF0 +;IOBASE = $FFF3 diff --git a/libsrc/cbm610/kiobase.s b/libsrc/cbm610/kiobase.s index 1f21f0249..55e5ba57c 100644 --- a/libsrc/cbm610/kiobase.s +++ b/libsrc/cbm610/kiobase.s @@ -11,9 +11,9 @@ .proc IOBASE - ldx cia - ldy cia+1 - rts + ldx cia + ldy cia+1 + rts .endproc diff --git a/libsrc/cbm610/krdtim.s b/libsrc/cbm610/krdtim.s index 85e2f5a0c..241c6389e 100644 --- a/libsrc/cbm610/krdtim.s +++ b/libsrc/cbm610/krdtim.s @@ -10,12 +10,12 @@ .proc RDTIM - sei - lda time+0 - ldx time+1 - ldy time+2 - cli - rts + sei + lda time+0 + ldx time+1 + ldy time+2 + cli + rts .endproc diff --git a/libsrc/cbm610/kscnkey.s b/libsrc/cbm610/kscnkey.s index 7e637540e..23909b742 100644 --- a/libsrc/cbm610/kscnkey.s +++ b/libsrc/cbm610/kscnkey.s @@ -4,82 +4,82 @@ ; Keyboard polling stuff for the 610. ; - .export scnkey - .importzp tpi2, ktab1, ktab2, ktab3, ktab4 + .export scnkey + .importzp tpi2, ktab1, ktab2, ktab3, ktab4 .importzp keyidx, keybuf, keyscanbuf, keysave, modkey, norkey .importzp graphmode, lastidx, rptdelay, rptcount - .include "cbm610.inc" + .include "cbm610.inc" -.proc scnkey +.proc scnkey lda #$FF sta modkey sta norkey - lda #$00 - sta keyscanbuf - ldy #TPI::PRB - sta (tpi2),y - ldy #TPI::PRA - sta (tpi2),y + lda #$00 + sta keyscanbuf + ldy #TPI::PRB + sta (tpi2),y + ldy #TPI::PRA + sta (tpi2),y jsr Poll and #$3F eor #$3F bne L1 jmp NoKey -L1: lda #$FF - ldy #TPI::PRA - sta (tpi2),y +L1: lda #$FF + ldy #TPI::PRA + sta (tpi2),y asl a - ldy #TPI::PRB - sta (tpi2),y + ldy #TPI::PRB + sta (tpi2),y jsr Poll pha sta modkey ora #$30 - bne L3 ; Branch always + bne L3 ; Branch always -L2: jsr Poll -L3: ldx #$05 - ldy #$00 -L4: lsr a +L2: jsr Poll +L3: ldx #$05 + ldy #$00 +L4: lsr a bcc L5 - inc keyscanbuf + inc keyscanbuf dex bpl L4 sec - ldy #TPI::PRB - lda (tpi2),y - rol a - sta (tpi2),y - ldy #TPI::PRA - lda (tpi2),y - rol a - sta (tpi2),y + ldy #TPI::PRB + lda (tpi2),y + rol a + sta (tpi2),y + ldy #TPI::PRA + lda (tpi2),y + rol a + sta (tpi2),y bcs L2 pla - bcc NoKey ; Branch always + bcc NoKey ; Branch always -L5: ldy keyscanbuf - sty norkey +L5: ldy keyscanbuf + sty norkey pla asl a asl a asl a bcc L6 bmi L7 - lda (ktab2),y ; Shifted normal key + lda (ktab2),y ; Shifted normal key ldx graphmode beq L8 - lda (ktab3),y ; Shifted key in graph mode + lda (ktab3),y ; Shifted key in graph mode bne L8 -L6: lda (ktab4),y ; Key with ctrl pressed - bne L8 -L7: lda (ktab1),y ; Normal key -L8: tax - cpx #$FF ; Valid key? +L6: lda (ktab4),y ; Key with ctrl pressed + bne L8 +L7: lda (ktab1),y ; Normal key +L8: tax + cpx #$FF ; Valid key? beq Done cpy lastidx beq Repeat @@ -96,17 +96,17 @@ L8: tax inx bne PutKey -NoKey: ldy #$FF -Done: sty lastidx -End: lda #$7F - ldy #TPI::PRA - sta (tpi2),y - ldy #TPI::PRB - lda #$FF - sta (tpi2),y +NoKey: ldy #$FF +Done: sty lastidx +End: lda #$7F + ldy #TPI::PRA + sta (tpi2),y + ldy #TPI::PRB + lda #$FF + sta (tpi2),y rts -Repeat: dec rptdelay +Repeat: dec rptdelay bpl End inc rptdelay dec rptcount @@ -115,7 +115,7 @@ Repeat: dec rptdelay ldx keyidx bne End -PutKey: sta keybuf,x +PutKey: sta keybuf,x inx stx keyidx ldx #$03 @@ -130,14 +130,14 @@ PutKey: sta keybuf,x .segment "PAGE2" -.proc Poll - ldy #TPI::PRC -L1: lda (tpi2),y - sta keysave - lda (tpi2),y - cmp keysave - bne L1 - rts +.proc Poll + ldy #TPI::PRC +L1: lda (tpi2),y + sta keysave + lda (tpi2),y + cmp keysave + bne L1 + rts .endproc diff --git a/libsrc/cbm610/kscreen.s b/libsrc/cbm610/kscreen.s index c25d192bc..fab55b618 100644 --- a/libsrc/cbm610/kscreen.s +++ b/libsrc/cbm610/kscreen.s @@ -9,8 +9,8 @@ .proc SCREEN - ldx #80 ; Columns - ldy #25 ; Lines - rts + ldx #80 ; Columns + ldy #25 ; Lines + rts .endproc diff --git a/libsrc/cbm610/ksetnam.s b/libsrc/cbm610/ksetnam.s index aeb72bd0b..ab5c6d730 100644 --- a/libsrc/cbm610/ksetnam.s +++ b/libsrc/cbm610/ksetnam.s @@ -29,9 +29,9 @@ iny sta (sysp0),y - lda ExecReg ; Assume name is always in this segment - ldy #$92 ; FNAM_SEG - sta (sysp0),y + lda ExecReg ; Assume name is always in this segment + ldy #$92 ; FNAM_SEG + sta (sysp0),y ldy #$9D ; FNAM_LEN pla diff --git a/libsrc/cbm610/ksettim.s b/libsrc/cbm610/ksettim.s index dab570fe6..69f01b4c2 100644 --- a/libsrc/cbm610/ksettim.s +++ b/libsrc/cbm610/ksettim.s @@ -10,12 +10,12 @@ .proc SETTIM - sei - sta time+0 - stx time+1 - sty time+2 - cli - rts + sei + sta time+0 + stx time+1 + sty time+2 + cli + rts .endproc diff --git a/libsrc/cbm610/kudtim.s b/libsrc/cbm610/kudtim.s index 4653d8148..6862787fb 100644 --- a/libsrc/cbm610/kudtim.s +++ b/libsrc/cbm610/kudtim.s @@ -8,16 +8,16 @@ .export UDTIM .import time: zp -.proc UDTIM +.proc UDTIM - inc time - bne L9 - inc time+1 - bne L9 - inc time+2 - bne L9 - inc time+3 -L9: rts + inc time + bne L9 + inc time+1 + bne L9 + inc time+2 + bne L9 + inc time+3 +L9: rts .endproc diff --git a/libsrc/cbm610/mainargs.s b/libsrc/cbm610/mainargs.s index a9233382f..7ed8d46f4 100644 --- a/libsrc/cbm610/mainargs.s +++ b/libsrc/cbm610/mainargs.s @@ -5,8 +5,8 @@ ; - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv ;--------------------------------------------------------------------------- diff --git a/libsrc/cbm610/peeksys.s b/libsrc/cbm610/peeksys.s index 4002b26bc..face70258 100644 --- a/libsrc/cbm610/peeksys.s +++ b/libsrc/cbm610/peeksys.s @@ -2,49 +2,49 @@ ; Ullrich von Bassewitz, 14.09.2001 ; - .export _peekbsys, _peekwsys - .importzp ptr1 + .export _peekbsys, _peekwsys + .importzp ptr1 - .include "cbm610.inc" + .include "cbm610.inc" ; ------------------------------------------------------------------------ ; unsigned char __fastcall__ peekbsys (unsigned addr); -.proc _peekbsys +.proc _peekbsys - sta ptr1 ; Store argument pointer - stx ptr1+1 - ldx IndReg - lda #$0F - sta IndReg - ldy #$00 - lda (ptr1),y - stx IndReg - ldx #$00 ; Extend to word - rts + sta ptr1 ; Store argument pointer + stx ptr1+1 + ldx IndReg + lda #$0F + sta IndReg + ldy #$00 + lda (ptr1),y + stx IndReg + ldx #$00 ; Extend to word + rts .endproc ; ------------------------------------------------------------------------ ; unsigned __fastcall__ peekwsys (unsigned addr); -.proc _peekwsys +.proc _peekwsys - sta ptr1 ; Store argument pointer - stx ptr1+1 - ldx IndReg - lda #$0F - sta IndReg - ldy #$00 - lda (ptr1),y ; Get low byte - pha - iny - lda (ptr1),y ; Get high byte - stx IndReg - tax ; High byte -> X - pla ; Low byte -> A - rts + sta ptr1 ; Store argument pointer + stx ptr1+1 + ldx IndReg + lda #$0F + sta IndReg + ldy #$00 + lda (ptr1),y ; Get low byte + pha + iny + lda (ptr1),y ; Get high byte + stx IndReg + tax ; High byte -> X + pla ; Low byte -> A + rts .endproc diff --git a/libsrc/cbm610/pokesys.s b/libsrc/cbm610/pokesys.s index 96cad928e..fa690fb6e 100644 --- a/libsrc/cbm610/pokesys.s +++ b/libsrc/cbm610/pokesys.s @@ -4,35 +4,35 @@ ; void pokebsys (unsigned Addr, unsigned char Val); ; void pokewsys (unsigned Addr, unsigned Val); - .export _pokebsys, _pokewsys - .import popsreg - .importzp sreg, tmp1 + .export _pokebsys, _pokewsys + .import popsreg + .importzp sreg, tmp1 - .include "cbm610.inc" + .include "cbm610.inc" _pokebsys: - jsr popsreg ; Get the address - ldx IndReg - ldy #$0F - sty IndReg ; Switch to the system bank - ldy #$00 - sta (sreg),y - stx IndReg - rts + jsr popsreg ; Get the address + ldx IndReg + ldy #$0F + sty IndReg ; Switch to the system bank + ldy #$00 + sta (sreg),y + stx IndReg + rts _pokewsys: - stx tmp1 ; Save high byte - jsr popsreg ; Get the address - ldx IndReg - ldy #$0F - sty IndReg ; Switch to the system bank - ldy #$00 - sta (sreg),y - iny - lda tmp1 - sta (sreg),y - stx IndReg - rts + stx tmp1 ; Save high byte + jsr popsreg ; Get the address + ldx IndReg + ldy #$0F + sty IndReg ; Switch to the system bank + ldy #$00 + sta (sreg),y + iny + lda tmp1 + sta (sreg),y + stx IndReg + rts diff --git a/libsrc/cbm610/randomize.s b/libsrc/cbm610/randomize.s index 08168aa67..a936f8a2f 100644 --- a/libsrc/cbm610/randomize.s +++ b/libsrc/cbm610/randomize.s @@ -5,8 +5,8 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand .importzp time __randomize: diff --git a/libsrc/cbm610/revers.s b/libsrc/cbm610/revers.s index 10dba117e..eb44f0282 100644 --- a/libsrc/cbm610/revers.s +++ b/libsrc/cbm610/revers.s @@ -4,7 +4,7 @@ ; unsigned char revers (unsigned char onoff); ; - .export _revers + .export _revers .import RVS: zp @@ -13,18 +13,18 @@ .proc _revers - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value - ldy #$00 ; Assume old value is zero -L1: lda RVS ; Load old value - stx RVS ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value + ldy #$00 ; Assume old value is zero +L1: lda RVS ; Load old value + stx RVS ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts .endproc diff --git a/libsrc/cbm610/ser/cbm610-std.s b/libsrc/cbm610/ser/cbm610-std.s index a5da97e4d..671698a28 100644 --- a/libsrc/cbm610/ser/cbm610-std.s +++ b/libsrc/cbm610/ser/cbm610-std.s @@ -25,7 +25,7 @@ .include "../extzp.inc" .include "ser-kernel.inc" .include "ser-error.inc" - .include "cbm610.inc" + .include "cbm610.inc" ; ------------------------------------------------------------------------ @@ -48,7 +48,7 @@ .word PUT .word STATUS .word IOCTL - .word IRQ + .word IRQ ;---------------------------------------------------------------------------- ; @@ -56,19 +56,19 @@ ; .bss -RecvHead: .res 1 ; Head of receive buffer -RecvTail: .res 1 ; Tail of receive buffer -RecvFreeCnt: .res 1 ; Number of bytes in receive buffer -SendHead: .res 1 ; Head of send buffer -SendTail: .res 1 ; Tail of send buffer -SendFreeCnt: .res 1 ; Number of bytes in send buffer +RecvHead: .res 1 ; Head of receive buffer +RecvTail: .res 1 ; Tail of receive buffer +RecvFreeCnt: .res 1 ; Number of bytes in receive buffer +SendHead: .res 1 ; Head of send buffer +SendTail: .res 1 ; Tail of send buffer +SendFreeCnt: .res 1 ; Number of bytes in send buffer -Stopped: .res 1 ; Flow-stopped flag -RtsOff: .res 1 ; +Stopped: .res 1 ; Flow-stopped flag +RtsOff: .res 1 ; ; Send and receive buffers: 256 bytes each -RecvBuf: .res 256 -SendBuf: .res 256 +RecvBuf: .res 256 +SendBuf: .res 256 .rodata @@ -138,14 +138,14 @@ CLOSE: ; Deactivate DTR and disable 6551 interrupts - lda #%00001010 + lda #%00001010 jsr write_cmd ; Done, return an error code lda #SER_ERR_INIT_FAILED - rts + lda #SER_ERR_INIT_FAILED + rts ; Baud rate not available @@ -236,43 +236,43 @@ InvBaud: ; return. ; -GET: ldx SendFreeCnt ; Send data if necessary - inx ; X == $FF? - beq @L1 - lda #$00 - jsr TryToSend +GET: ldx SendFreeCnt ; Send data if necessary + inx ; X == $FF? + beq @L1 + lda #$00 + jsr TryToSend ; Check for buffer empty -@L1: lda RecvFreeCnt - cmp #$ff - bne @L2 - lda #SER_ERR_NO_DATA - rts +@L1: lda RecvFreeCnt + cmp #$ff + bne @L2 + lda #SER_ERR_NO_DATA + rts ; Check for flow stopped & enough free: release flow control -@L2: ldx Stopped - beq @L3 - cmp #63 - bcc @L3 - lda #$00 - sta Stopped - lda RtsOff - ora #%00001000 +@L2: ldx Stopped + beq @L3 + cmp #63 + bcc @L3 + lda #$00 + sta Stopped + lda RtsOff + ora #%00001000 jsr write_cmd ; Get byte from buffer -@L3: ldx RecvHead - lda RecvBuf,x - inc RecvHead - inc RecvFreeCnt - ldx #$00 - sta (ptr1,x) - txa ; Return code = 0 - rts +@L3: ldx RecvHead + lda RecvBuf,x + inc RecvHead + inc RecvFreeCnt + ldx #$00 + sta (ptr1,x) + txa ; Return code = 0 + rts ;---------------------------------------------------------------------------- ; PUT: Output character in A. @@ -283,30 +283,30 @@ PUT: ; Try to send - ldx SendFreeCnt - inx ; X = $ff? - beq @L2 - pha - lda #$00 - jsr TryToSend - pla + ldx SendFreeCnt + inx ; X = $ff? + beq @L2 + pha + lda #$00 + jsr TryToSend + pla ; Put byte into send buffer & send -@L2: ldx SendFreeCnt - bne @L3 - lda #TM - jmp _mktime + lda #TM + jmp _mktime .endproc ;---------------------------------------------------------------------------- ; dec = (((BCD>>4)*10) + (BCD&0xf)) -.proc BCD2dec +.proc BCD2dec - tax - and #%00001111 - sta tmp1 - txa + tax + and #%00001111 + sta tmp1 + txa and #%11110000 ; *16 lsr ; *8 sta tmp2 @@ -86,7 +86,7 @@ AM: jsr BCD2dec ; TM struct with date set to 1970-01-01 .data -TM: .word 0 ; tm_sec +TM: .word 0 ; tm_sec .word 0 ; tm_min .word 0 ; tm_hour .word 1 ; tm_mday diff --git a/libsrc/common/_cwd.s b/libsrc/common/_cwd.s index a3ee362f6..eeda10f1d 100644 --- a/libsrc/common/_cwd.s +++ b/libsrc/common/_cwd.s @@ -7,7 +7,7 @@ ; by the constructor defined in this module. ; - .export __cwd + .export __cwd .export __cwd_buf_size .constructor cwd_init @@ -21,7 +21,7 @@ .bss -__cwd: .res __cwd_buf_size +__cwd: .res __cwd_buf_size ; NOTE: Some of the code working with directories is not able to handle diff --git a/libsrc/common/_environ.s b/libsrc/common/_environ.s index 3df9cb7ef..6a53f80a8 100644 --- a/libsrc/common/_environ.s +++ b/libsrc/common/_environ.s @@ -13,11 +13,11 @@ ; .export __environ, __envcount, __envsize - .import initenv - .constructor env_init - - env_init := initenv - + .import initenv + .constructor env_init + + env_init := initenv + .bss __environ: diff --git a/libsrc/common/_fdesc.s b/libsrc/common/_fdesc.s index 682bcb78e..4905c0100 100644 --- a/libsrc/common/_fdesc.s +++ b/libsrc/common/_fdesc.s @@ -5,27 +5,27 @@ ; /* Find a free descriptor slot */ - .export __fdesc - .import return0 + .export __fdesc + .import return0 .include "stdio.inc" .include "_file.inc" .proc __fdesc - ldy #0 + ldy #0 lda #_FOPEN -Loop: and __filetab + _FILE::f_flags,y ; load flags - beq Found ; jump if closed +Loop: and __filetab + _FILE::f_flags,y ; load flags + beq Found ; jump if closed .repeat .sizeof(_FILE) - iny + iny .endrepeat - cpy #(FOPEN_MAX * .sizeof(_FILE)) ; Done? - bne Loop + cpy #(FOPEN_MAX * .sizeof(_FILE)) ; Done? + bne Loop ; File table is full - jmp return0 + jmp return0 ; Free slot found, get address diff --git a/libsrc/common/_file.h b/libsrc/common/_file.h index 8ee46ff2a..66c8af828 100644 --- a/libsrc/common/_file.h +++ b/libsrc/common/_file.h @@ -18,8 +18,8 @@ /* Definition of struct _FILE */ struct _FILE { - char f_fd; - char f_flags; + char f_fd; + char f_flags; unsigned char f_pushback; }; @@ -27,10 +27,10 @@ struct _FILE { extern FILE _filetab[FOPEN_MAX]; /* Flags field */ -#define _FCLOSED 0x00 -#define _FOPEN 0x01 -#define _FEOF 0x02 -#define _FERROR 0x04 +#define _FCLOSED 0x00 +#define _FOPEN 0x01 +#define _FEOF 0x02 +#define _FERROR 0x04 #define _FPUSHBACK 0x08 diff --git a/libsrc/common/_file.s b/libsrc/common/_file.s index 84686a062..db46943d0 100644 --- a/libsrc/common/_file.s +++ b/libsrc/common/_file.s @@ -4,7 +4,7 @@ ; Data for the stdio file stream. ; - .export __filetab + .export __filetab .include "stdio.inc" .include "fcntl.inc" @@ -27,12 +27,12 @@ __filetab: ; Standard file descriptors _stdin: - .word __filetab + (STDIN_FILENO * .sizeof(_FILE)) + .word __filetab + (STDIN_FILENO * .sizeof(_FILE)) _stdout: - .word __filetab + (STDOUT_FILENO * .sizeof(_FILE)) + .word __filetab + (STDOUT_FILENO * .sizeof(_FILE)) _stderr: - .word __filetab + (STDERR_FILENO * .sizeof(_FILE)) + .word __filetab + (STDERR_FILENO * .sizeof(_FILE)) diff --git a/libsrc/common/_heap.s b/libsrc/common/_heap.s index 5b45b85cc..5af434050 100644 --- a/libsrc/common/_heap.s +++ b/libsrc/common/_heap.s @@ -4,9 +4,9 @@ ; Heap variables and initialization. ; - .constructor initheap, 24 - .import __BSS_RUN__, __BSS_SIZE__, __STACKSIZE__ - .importzp sp + .constructor initheap, 24 + .import __BSS_RUN__, __BSS_SIZE__, __STACKSIZE__ + .importzp sp .include "_heap.inc" @@ -14,15 +14,15 @@ .data __heaporg: - .word __BSS_RUN__+__BSS_SIZE__ ; Linker calculates this symbol + .word __BSS_RUN__+__BSS_SIZE__ ; Linker calculates this symbol __heapptr: - .word __BSS_RUN__+__BSS_SIZE__ ; Dito + .word __BSS_RUN__+__BSS_SIZE__ ; Dito __heapend: - .word __BSS_RUN__+__BSS_SIZE__ + .word __BSS_RUN__+__BSS_SIZE__ __heapfirst: - .word 0 + .word 0 __heaplast: - .word 0 + .word 0 ; Initialization. Will be called from startup! @@ -30,13 +30,13 @@ __heaplast: .segment "INIT" initheap: - sec - lda sp - sbc #<__STACKSIZE__ - sta __heapend - lda sp+1 - sbc #>__STACKSIZE__ - sta __heapend+1 - rts + sec + lda sp + sbc #<__STACKSIZE__ + sta __heapend + lda sp+1 + sbc #>__STACKSIZE__ + sta __heapend+1 + rts diff --git a/libsrc/common/_heapadd.s b/libsrc/common/_heapadd.s index 547e0478b..14080cb5e 100644 --- a/libsrc/common/_heapadd.s +++ b/libsrc/common/_heapadd.s @@ -7,46 +7,46 @@ ; ; - .importzp ptr1, ptr2 - .import popax - .import heapadd - .export __heapadd + .importzp ptr1, ptr2 + .import popax + .import heapadd + .export __heapadd .include "_heap.inc" - .macpack generic + .macpack generic ;----------------------------------------------------------------------------- ; Code __heapadd: - sta ptr1 ; Store size in ptr1 - stx ptr1+1 - jsr popax ; Get the block pointer - sta ptr2 - stx ptr2+1 ; Store block pointer in ptr2 + sta ptr1 ; Store size in ptr1 + stx ptr1+1 + jsr popax ; Get the block pointer + sta ptr2 + stx ptr2+1 ; Store block pointer in ptr2 ; Check if size is greater or equal than min_size. Otherwise we don't care ; about the block (this may only happen for user supplied blocks, blocks ; from the heap are always large enough to hold a freeblock structure). - lda ptr1 ; Load low byte - ldx ptr1+1 ; Load/check high byte - bne @L1 - cmp #HEAP_MIN_BLOCKSIZE - bcs @L1 + lda ptr1 ; Load low byte + ldx ptr1+1 ; Load/check high byte + bne @L1 + cmp #HEAP_MIN_BLOCKSIZE + bcs @L1 - rts ; Block not large enough + rts ; Block not large enough ; The block is large enough. Set the size field in the block. -@L1: ldy #usedblock::size - sta (ptr2),y - iny - txa - sta (ptr2),y +@L1: ldy #usedblock::size + sta (ptr2),y + iny + txa + sta (ptr2),y ; Call the internal function since variables are now setup correctly - jmp heapadd + jmp heapadd diff --git a/libsrc/common/_heapblocksize.s b/libsrc/common/_heapblocksize.s index b7458479c..db33f594c 100644 --- a/libsrc/common/_heapblocksize.s +++ b/libsrc/common/_heapblocksize.s @@ -6,8 +6,8 @@ ; Return the size of an allocated block. ; - .importzp ptr1, ptr2 - .export __heapblocksize + .importzp ptr1, ptr2 + .export __heapblocksize .include "_heap.inc" diff --git a/libsrc/common/_heapmaxavail.s b/libsrc/common/_heapmaxavail.s index 1fe5e0606..16fc10dde 100644 --- a/libsrc/common/_heapmaxavail.s +++ b/libsrc/common/_heapmaxavail.s @@ -7,12 +7,12 @@ ; ; - .importzp ptr1, ptr2 - .export __heapmaxavail + .importzp ptr1, ptr2 + .export __heapmaxavail .include "_heap.inc" - .macpack generic + .macpack generic ;----------------------------------------------------------------------------- ; Code diff --git a/libsrc/common/_heapmemavail.s b/libsrc/common/_heapmemavail.s index b7a05a087..69aa75f8a 100644 --- a/libsrc/common/_heapmemavail.s +++ b/libsrc/common/_heapmemavail.s @@ -7,12 +7,12 @@ ; ; - .importzp ptr1, ptr2 - .export __heapmemavail + .importzp ptr1, ptr2 + .export __heapmemavail .include "_heap.inc" - .macpack generic + .macpack generic ;----------------------------------------------------------------------------- ; Code diff --git a/libsrc/common/_oserror.s b/libsrc/common/_oserror.s index 19073933a..256d89658 100644 --- a/libsrc/common/_oserror.s +++ b/libsrc/common/_oserror.s @@ -5,10 +5,10 @@ ; /* Operating system specific errors from the low level functions */ - .export __oserror + .export __oserror .bss __oserror: - .res 1 + .res 1 diff --git a/libsrc/common/_printf.h b/libsrc/common/_printf.h index 038697478..e965b0d85 100644 --- a/libsrc/common/_printf.h +++ b/libsrc/common/_printf.h @@ -25,10 +25,10 @@ typedef void (*outfunc) (struct outdesc* desc, const char* buf, unsigned count); * so check this when altering the structure. */ struct outdesc { - int ccount; /* Character counter */ - outfunc fout; /* Routine used to output data */ - void* ptr; /* Data internal to print routine */ - unsigned uns; /* Data internal to print routine */ + int ccount; /* Character counter */ + outfunc fout; /* Routine used to output data */ + void* ptr; /* Data internal to print routine */ + unsigned uns; /* Data internal to print routine */ }; diff --git a/libsrc/common/_printf.s b/libsrc/common/_printf.s index 2169896ba..f5d1784ec 100644 --- a/libsrc/common/_printf.s +++ b/libsrc/common/_printf.s @@ -6,28 +6,28 @@ .include "zeropage.inc" - .export __printf + .export __printf - .import popax, pushax, pusheax, decsp6, push1, axlong, axulong - .import _ltoa, _ultoa - .import _strlower, _strlen + .import popax, pushax, pusheax, decsp6, push1, axlong, axulong + .import _ltoa, _ultoa + .import _strlower, _strlen - .macpack generic + .macpack generic ; ---------------------------------------------------------------------------- ; We will store variables into the register bank in the zeropage. Define ; equates for these variables. -ArgList = regbank+0 ; Argument list pointer -Format = regbank+2 ; Format string -OutData = regbank+4 ; Function parameters +ArgList = regbank+0 ; Argument list pointer +Format = regbank+2 ; Format string +OutData = regbank+4 ; Function parameters ; ---------------------------------------------------------------------------- ; Other zero page cells -Base = ptr1 -FSave = ptr1 -FCount = ptr2 +Base = ptr1 +FSave = ptr1 +FCount = ptr2 .code @@ -36,68 +36,68 @@ FCount = ptr2 ; return zero in Y. GetFormatChar: - ldy #0 - lda (Format),y + ldy #0 + lda (Format),y IncFormatPtr: - inc Format - bne @L1 - inc Format+1 -@L1: rts + inc Format + bne @L1 + inc Format+1 +@L1: rts ; ---------------------------------------------------------------------------- ; Output a pad character: outfunc (d, &padchar, 1) OutputPadChar: - lda PadChar + lda PadChar ; ---------------------------------------------------------------------------- ; Call the output function with one character in A Output1: - sta CharArg - jsr PushOutData - lda #CharArg - jsr pushax - jsr push1 - jmp CallOutFunc ; fout (OutData, &CharArg, 1) + sta CharArg + jsr PushOutData + lda #CharArg + jsr pushax + jsr push1 + jmp CallOutFunc ; fout (OutData, &CharArg, 1) ; ---------------------------------------------------------------------------- ; Decrement the argument list pointer by 2 DecArgList2: - lda ArgList - sub #2 - sta ArgList - bcs @L1 - dec ArgList+1 -@L1: rts + lda ArgList + sub #2 + sta ArgList + bcs @L1 + dec ArgList+1 +@L1: rts ; ---------------------------------------------------------------------------- ; Get an unsigned int or long argument depending on the IsLong flag. GetUnsignedArg: - lda IsLong ; Check flag - bne GetLongArg ; Long sets all - jsr GetIntArg ; Get an integer argument - jmp axulong ; Convert to unsigned long + lda IsLong ; Check flag + bne GetLongArg ; Long sets all + jsr GetIntArg ; Get an integer argument + jmp axulong ; Convert to unsigned long ; ---------------------------------------------------------------------------- ; Get an signed int or long argument depending on the IsLong flag. GetSignedArg: - lda IsLong ; Check flag - bne GetLongArg ; Long sets all - jsr GetIntArg ; Get an integer argument - jmp axlong ; Convert to long + lda IsLong ; Check flag + bne GetLongArg ; Long sets all + jsr GetIntArg ; Get an integer argument + jmp axlong ; Convert to long ; ---------------------------------------------------------------------------- ; Get a long argument from the argument list. Returns 0 in Y. GetLongArg: - jsr GetIntArg ; Get high word - sta sreg - stx sreg+1 + jsr GetIntArg ; Get high word + sta sreg + stx sreg+1 ; Run into GetIntArg fetching the low word @@ -105,133 +105,133 @@ GetLongArg: ; Get an integer argument from the argument list. Returns 0 in Y. GetIntArg: - jsr DecArgList2 - ldy #1 - lda (ArgList),y - tax - dey - lda (ArgList),y - rts + jsr DecArgList2 + ldy #1 + lda (ArgList),y + tax + dey + lda (ArgList),y + rts ; ---------------------------------------------------------------------------- ; Read an integer from the format string. Will return zero in Y. ReadInt: - ldy #0 - sty ptr1 - sty ptr1+1 ; Start with zero -@Loop: lda (Format),y ; Get format string character - sub #'0' ; Make number from ascii digit - bcc @L9 ; Jump if done - cmp #9+1 - bcs @L9 ; Jump if done + ldy #0 + sty ptr1 + sty ptr1+1 ; Start with zero +@Loop: lda (Format),y ; Get format string character + sub #'0' ; Make number from ascii digit + bcc @L9 ; Jump if done + cmp #9+1 + bcs @L9 ; Jump if done ; Skip the digit character - jsr IncFormatPtr + jsr IncFormatPtr ; Add the digit to the value we have in ptr1 - pha ; Save digit value - lda ptr1 - ldx ptr1+1 - asl ptr1 - rol ptr1+1 ; * 2 - asl ptr1 - rol ptr1+1 ; * 4, assume carry clear - adc ptr1 - sta ptr1 - txa - adc ptr1+1 - sta ptr1+1 ; * 5 - asl ptr1 - rol ptr1+1 ; * 10, assume carry clear - pla - adc ptr1 ; Add digit value - sta ptr1 - bcc @Loop - inc ptr1+1 - bcs @Loop ; Branch always + pha ; Save digit value + lda ptr1 + ldx ptr1+1 + asl ptr1 + rol ptr1+1 ; * 2 + asl ptr1 + rol ptr1+1 ; * 4, assume carry clear + adc ptr1 + sta ptr1 + txa + adc ptr1+1 + sta ptr1+1 ; * 5 + asl ptr1 + rol ptr1+1 ; * 10, assume carry clear + pla + adc ptr1 ; Add digit value + sta ptr1 + bcc @Loop + inc ptr1+1 + bcs @Loop ; Branch always ; We're done converting -@L9: lda ptr1 - ldx ptr1+1 ; Load result - rts +@L9: lda ptr1 + ldx ptr1+1 ; Load result + rts ; ---------------------------------------------------------------------------- ; Put a character into the argument buffer and increment the buffer index -PutBuf: ldy BufIdx - inc BufIdx - sta Buf,y - rts +PutBuf: ldy BufIdx + inc BufIdx + sta Buf,y + rts ; ---------------------------------------------------------------------------- ; Get a pointer to the current buffer end and push it onto the stack PushBufPtr: - lda #Buf - add BufIdx - bcc @L1 - inx -@L1: jmp pushax + lda #Buf + add BufIdx + bcc @L1 + inx +@L1: jmp pushax ; ---------------------------------------------------------------------------- ; Push OutData onto the software stack PushOutData: - lda OutData - ldx OutData+1 - jmp pushax + lda OutData + ldx OutData+1 + jmp pushax ; ---------------------------------------------------------------------------- ; Output Width pad characters ; PadLoop: - jsr OutputPadChar + jsr OutputPadChar OutputPadding: - inc Width - bne PadLoop - inc Width+1 - bne PadLoop - rts + inc Width + bne PadLoop + inc Width+1 + bne PadLoop + rts ; ---------------------------------------------------------------------------- ; Output the argument itself: outfunc (d, str, arglen); ; OutputArg: - jsr PushOutData - lda Str - ldx Str+1 - jsr pushax - lda ArgLen - ldx ArgLen+1 - jsr pushax - jmp CallOutFunc + jsr PushOutData + lda Str + ldx Str+1 + jsr pushax + lda ArgLen + ldx ArgLen+1 + jsr pushax + jmp CallOutFunc ; ---------------------------------------------------------------------------- ; ltoa: Wrapper for _ltoa that pushes all arguments -ltoa: sty Base ; Save base - jsr pusheax ; Push value - jsr PushBufPtr ; Push the buffer pointer... - lda Base ; Restore base - jmp _ltoa ; ultoa (l, s, base); +ltoa: sty Base ; Save base + jsr pusheax ; Push value + jsr PushBufPtr ; Push the buffer pointer... + lda Base ; Restore base + jmp _ltoa ; ultoa (l, s, base); ; ---------------------------------------------------------------------------- ; ultoa: Wrapper for _ultoa that pushes all arguments -ultoa: sty Base ; Save base - jsr pusheax ; Push value - jsr PushBufPtr ; Push the buffer pointer... - lda Base ; Restore base - jmp _ultoa ; ultoa (l, s, base); +ultoa: sty Base ; Save base + jsr pusheax ; Push value + jsr PushBufPtr ; Push the buffer pointer... + lda Base ; Restore base + jmp _ultoa ; ultoa (l, s, base); ; ---------------------------------------------------------------------------- @@ -241,133 +241,133 @@ __printf: ; Save the register bank variables into the save area - pha ; Save low byte of ap - ldy #5 -Save: lda regbank,y - sta RegSave,y - dey - bpl Save + pha ; Save low byte of ap + ldy #5 +Save: lda regbank,y + sta RegSave,y + dey + bpl Save ; Get the parameters from the stack - pla ; Restore low byte of ap - sta ArgList ; Argument list pointer - stx ArgList+1 + pla ; Restore low byte of ap + sta ArgList ; Argument list pointer + stx ArgList+1 - jsr popax ; Format string - sta Format - stx Format+1 + jsr popax ; Format string + sta Format + stx Format+1 - jsr popax ; Output descriptor - sta OutData - stx OutData+1 + jsr popax ; Output descriptor + sta OutData + stx OutData+1 ; Initialize the output counter in the output descriptor to zero - lda #0 - tay - sta (OutData),y - iny - sta (OutData),y + lda #0 + tay + sta (OutData),y + iny + sta (OutData),y ; Get the output function from the output descriptor and remember it - iny - lda (OutData),y - sta CallOutFunc+1 - iny - lda (OutData),y - sta CallOutFunc+2 + iny + lda (OutData),y + sta CallOutFunc+1 + iny + lda (OutData),y + sta CallOutFunc+2 ; Start parsing the format string MainLoop: - lda Format ; Remember current format pointer - sta FSave - lda Format+1 - sta FSave+1 + lda Format ; Remember current format pointer + sta FSave + lda Format+1 + sta FSave+1 - ldy #0 ; Index -@L1: lda (Format),y ; Get next char - beq @L2 ; Jump on end of string - cmp #'%' ; Format spec? - beq @L2 - iny ; Bump pointer - bne @L1 - inc Format+1 ; Bump high byte of pointer - bne @L1 ; Branch always + ldy #0 ; Index +@L1: lda (Format),y ; Get next char + beq @L2 ; Jump on end of string + cmp #'%' ; Format spec? + beq @L2 + iny ; Bump pointer + bne @L1 + inc Format+1 ; Bump high byte of pointer + bne @L1 ; Branch always ; Found a '%' character or end of string. Update the Format pointer so it is ; current (points to this character). -@L2: tya ; Low byte of offset - add Format - sta Format - bcc @L3 - inc Format+1 +@L2: tya ; Low byte of offset + add Format + sta Format + bcc @L3 + inc Format+1 ; Calculate, how many characters must be output. Beware: This number may ; be zero. A still contains the low byte of the pointer. -@L3: sub FSave - sta FCount - lda Format+1 - sbc FSave+1 - sta FCount+1 - ora FCount ; Is the result zero? - beq @L4 ; Jump if yes +@L3: sub FSave + sta FCount + lda Format+1 + sbc FSave+1 + sta FCount+1 + ora FCount ; Is the result zero? + beq @L4 ; Jump if yes ; Output the characters that we have until now. To make the call to out ; faster, build the stack frame by hand (don't use pushax) - jsr decsp6 ; 3 args - ldy #5 - lda OutData+1 - sta (sp),y - dey - lda OutData - sta (sp),y - dey - lda FSave+1 - sta (sp),y - dey - lda FSave - sta (sp),y - dey - lda FCount+1 - sta (sp),y - dey - lda FCount - sta (sp),y - jsr CallOutFunc ; Call the output function + jsr decsp6 ; 3 args + ldy #5 + lda OutData+1 + sta (sp),y + dey + lda OutData + sta (sp),y + dey + lda FSave+1 + sta (sp),y + dey + lda FSave + sta (sp),y + dey + lda FCount+1 + sta (sp),y + dey + lda FCount + sta (sp),y + jsr CallOutFunc ; Call the output function ; We're back from out(), or we didn't call it. Check for end of string. -@L4: jsr GetFormatChar ; Get one char, zero in Y - tax ; End of format string reached? - bne NotDone ; End not reached +@L4: jsr GetFormatChar ; Get one char, zero in Y + tax ; End of format string reached? + bne NotDone ; End not reached ; End of format string reached. Restore the zeropage registers and return. - ldx #5 -Rest: lda RegSave,x - sta regbank,x - dex - bpl Rest - rts + ldx #5 +Rest: lda RegSave,x + sta regbank,x + dex + bpl Rest + rts ; Still a valid format character. Check for '%' and a '%%' sequence. Output ; anything that is not a format specifier. On intro, Y is zero. NotDone: - cmp #'%' - bne @L1 - lda (Format),y ; Check for "%%" - cmp #'%' - bne FormatSpec ; Jump if really a format specifier - jsr IncFormatPtr ; Skip the second '%' -@L1: jsr Output1 ; Output the character... - jmp MainLoop ; ...and continue + cmp #'%' + bne @L1 + lda (Format),y ; Check for "%%" + cmp #'%' + bne FormatSpec ; Jump if really a format specifier + jsr IncFormatPtr ; Skip the second '%' +@L1: jsr Output1 ; Output the character... + jmp MainLoop ; ...and continue ; We have a real format specifier ; Format is: %[flags][width][.precision][mod]type @@ -377,105 +377,105 @@ FormatSpec: ; Initialize the flags - lda #0 - ldx #FormatVarSize-1 -@L1: sta FormatVars,x - dex - bpl @L1 + lda #0 + ldx #FormatVarSize-1 +@L1: sta FormatVars,x + dex + bpl @L1 ; Start with reading the flags if there are any. X is $FF which is used ; for "true" ReadFlags: - lda (Format),y ; Get next char... - cmp #'-' - bne @L1 - stx LeftJust - beq @L4 + lda (Format),y ; Get next char... + cmp #'-' + bne @L1 + stx LeftJust + beq @L4 -@L1: cmp #'+' - bne @L2 - stx AddSign - beq @L4 +@L1: cmp #'+' + bne @L2 + stx AddSign + beq @L4 -@L2: cmp #' ' - bne @L3 - stx AddBlank - beq @L4 +@L2: cmp #' ' + bne @L3 + stx AddBlank + beq @L4 -@L3: cmp #'#' - bne ReadPadding - stx AltForm +@L3: cmp #'#' + bne ReadPadding + stx AltForm -@L4: jsr IncFormatPtr - jmp ReadFlags ; ...and start over +@L4: jsr IncFormatPtr + jmp ReadFlags ; ...and start over ; Done with flags, read the pad char. Y is still zero if we come here. ReadPadding: - ldx #' ' ; PadChar - cmp #'0' - bne @L1 - tax ; PadChar is '0' - jsr IncFormatPtr - lda (Format),y ; Read current for later -@L1: stx PadChar + ldx #' ' ; PadChar + cmp #'0' + bne @L1 + tax ; PadChar is '0' + jsr IncFormatPtr + lda (Format),y ; Read current for later +@L1: stx PadChar ; Read the width. Even here, Y is still zero. A contains the current character ; from the format string ReadWidth: - cmp #'*' - bne @L1 - jsr IncFormatPtr - jsr GetIntArg ; Width is an additional argument - jmp @L2 + cmp #'*' + bne @L1 + jsr IncFormatPtr + jsr GetIntArg ; Width is an additional argument + jmp @L2 -@L1: jsr ReadInt ; Read integer from format string... -@L2: sta Width - stx Width+1 ; ...and remember in Width +@L1: jsr ReadInt ; Read integer from format string... +@L2: sta Width + stx Width+1 ; ...and remember in Width ; Read the precision. Even here, Y is still zero. - sty Prec ; Assume Precision is zero - sty Prec+1 - lda (Format),y ; Load next format string char - cmp #'.' ; Precision given? - bne ReadMod ; Branch if no precision given + sty Prec ; Assume Precision is zero + sty Prec+1 + lda (Format),y ; Load next format string char + cmp #'.' ; Precision given? + bne ReadMod ; Branch if no precision given ReadPrec: - jsr IncFormatPtr ; Skip the '.' - lda (Format),y - cmp #'*' ; Variable precision? - bne @L1 - jsr IncFormatPtr ; Skip the '*' - jsr GetIntArg ; Get integer argument - jmp @L2 + jsr IncFormatPtr ; Skip the '.' + lda (Format),y + cmp #'*' ; Variable precision? + bne @L1 + jsr IncFormatPtr ; Skip the '*' + jsr GetIntArg ; Get integer argument + jmp @L2 -@L1: jsr ReadInt ; Read integer from format string -@L2: sta Prec - stx Prec+1 +@L1: jsr ReadInt ; Read integer from format string +@L2: sta Prec + stx Prec+1 ; Read the modifiers. Y is still zero. ReadMod: - lda (Format),y - cmp #'z' ; size_t - same as unsigned - beq @L2 - cmp #'h' ; short - same as int - beq @L2 + lda (Format),y + cmp #'z' ; size_t - same as unsigned + beq @L2 + cmp #'h' ; short - same as int + beq @L2 cmp #'t' ; ptrdiff_t - same as int beq @L2 cmp #'j' ; intmax_t/uintmax_t - same as long beq @L1 - cmp #'L' ; long double - beq @L1 - cmp #'l' ; long int - bne DoFormat -@L1: lda #$FF - sta IsLong -@L2: jsr IncFormatPtr - jmp ReadMod + cmp #'L' ; long double + beq @L1 + cmp #'l' ; long int + bne DoFormat +@L1: lda #$FF + sta IsLong +@L2: jsr IncFormatPtr + jmp ReadMod ; Initialize the argument buffer pointers. We use a static buffer (ArgBuf) to ; assemble strings. A zero page index (BufIdx) is used to keep the current @@ -484,183 +484,183 @@ ReadMod: ; Y is zero when we come here. DoFormat: - sty BufIdx ; Clear BufIdx - ldx #Buf - stx Str+1 + sty BufIdx ; Clear BufIdx + ldx #Buf + stx Str+1 ; Skip the current format character, then check it (current char in A) - jsr IncFormatPtr + jsr IncFormatPtr ; Is it a character? - cmp #'c' - bne CheckInt + cmp #'c' + bne CheckInt ; It is a character - jsr GetIntArg ; Get the argument (promoted to int) - sta Buf ; Place it as zero terminated string... - lda #0 - sta Buf+1 ; ...into the buffer - jmp HaveArg ; Done + jsr GetIntArg ; Get the argument (promoted to int) + sta Buf ; Place it as zero terminated string... + lda #0 + sta Buf+1 ; ...into the buffer + jmp HaveArg ; Done ; Is it an integer? CheckInt: - cmp #'d' - beq @L1 - cmp #'i' - bne CheckCount + cmp #'d' + beq @L1 + cmp #'i' + bne CheckCount ; It is an integer -@L1: ldx #0 - lda AddBlank ; Add a blank for positives? - beq @L2 ; Jump if no - ldx #' ' -@L2: lda AddSign ; Add a plus for positives (precedence)? - beq @L3 - ldx #'+' -@L3: stx Leader +@L1: ldx #0 + lda AddBlank ; Add a blank for positives? + beq @L2 ; Jump if no + ldx #' ' +@L2: lda AddSign ; Add a plus for positives (precedence)? + beq @L3 + ldx #'+' +@L3: stx Leader ; Integer argument - jsr GetSignedArg ; Get argument as a long - ldy sreg+1 ; Check sign - bmi @Int1 - ldy Leader - beq @Int1 - sty Buf - inc BufIdx + jsr GetSignedArg ; Get argument as a long + ldy sreg+1 ; Check sign + bmi @Int1 + ldy Leader + beq @Int1 + sty Buf + inc BufIdx -@Int1: ldy #10 ; Base - jsr ltoa ; Push arguments, call _ltoa - jmp HaveArg +@Int1: ldy #10 ; Base + jsr ltoa ; Push arguments, call _ltoa + jmp HaveArg ; Is it a count pseudo format? CheckCount: - cmp #'n' - bne CheckOctal + cmp #'n' + bne CheckOctal ; It is a count pseudo argument - jsr GetIntArg - sta ptr1 - stx ptr1+1 ; Get user supplied pointer - ldy #0 - lda (OutData),y ; Low byte of OutData->ccount - sta (ptr1),y - iny - lda (OutData),y ; High byte of OutData->ccount - sta (ptr1),y - jmp MainLoop ; Done + jsr GetIntArg + sta ptr1 + stx ptr1+1 ; Get user supplied pointer + ldy #0 + lda (OutData),y ; Low byte of OutData->ccount + sta (ptr1),y + iny + lda (OutData),y ; High byte of OutData->ccount + sta (ptr1),y + jmp MainLoop ; Done ; Check for an octal digit CheckOctal: - cmp #'o' - bne CheckPointer + cmp #'o' + bne CheckPointer ; Integer in octal representation - jsr GetSignedArg ; Get argument as a long - ldy AltForm ; Alternative form? - beq @Oct1 ; Jump if no - pha ; Save low byte of value - stx tmp1 - ora tmp1 - ora sreg - ora sreg+1 - ora Prec - ora Prec+1 ; Check if value or Prec != 0 - beq @Oct1 - lda #'0' - jsr PutBuf - pla ; Restore low byte + jsr GetSignedArg ; Get argument as a long + ldy AltForm ; Alternative form? + beq @Oct1 ; Jump if no + pha ; Save low byte of value + stx tmp1 + ora tmp1 + ora sreg + ora sreg+1 + ora Prec + ora Prec+1 ; Check if value or Prec != 0 + beq @Oct1 + lda #'0' + jsr PutBuf + pla ; Restore low byte -@Oct1: ldy #8 ; Load base - jsr ltoa ; Push arguments, call _ltoa - jmp HaveArg +@Oct1: ldy #8 ; Load base + jsr ltoa ; Push arguments, call _ltoa + jmp HaveArg ; Check for a pointer specifier (%p) CheckPointer: - cmp #'p' - bne CheckString + cmp #'p' + bne CheckString ; It's a pointer. Use %#x conversion - ldx #0 - stx IsLong ; IsLong = 0; - inx - stx AltForm ; AltForm = 1; - lda #'x' - bne IsHex ; Branch always + ldx #0 + stx IsLong ; IsLong = 0; + inx + stx AltForm ; AltForm = 1; + lda #'x' + bne IsHex ; Branch always ; Check for a string specifier (%s) CheckString: - cmp #'s' - bne CheckUnsigned + cmp #'s' + bne CheckUnsigned ; It's a string - jsr GetIntArg ; Get 16bit argument - sta Str - stx Str+1 - jmp HaveArg + jsr GetIntArg ; Get 16bit argument + sta Str + stx Str+1 + jmp HaveArg ; Check for an unsigned integer (%u) CheckUnsigned: - cmp #'u' - bne CheckHex + cmp #'u' + bne CheckHex ; It's an unsigned integer - jsr GetUnsignedArg ; Get argument as unsigned long - ldy #10 ; Load base - jsr ultoa ; Push arguments, call _ultoa - jmp HaveArg + jsr GetUnsignedArg ; Get argument as unsigned long + ldy #10 ; Load base + jsr ultoa ; Push arguments, call _ultoa + jmp HaveArg ; Check for a hexadecimal integer (%x) CheckHex: - cmp #'x' - beq IsHex - cmp #'X' - bne UnknownFormat + cmp #'x' + beq IsHex + cmp #'X' + bne UnknownFormat ; Hexadecimal integer -IsHex: pha ; Save the format spec - lda AltForm - beq @L1 - lda #'0' - jsr PutBuf - lda #'X' - jsr PutBuf +IsHex: pha ; Save the format spec + lda AltForm + beq @L1 + lda #'0' + jsr PutBuf + lda #'X' + jsr PutBuf -@L1: jsr GetUnsignedArg ; Get argument as an unsigned long - ldy #16 ; Load base - jsr ultoa ; Push arguments, call _ultoa +@L1: jsr GetUnsignedArg ; Get argument as an unsigned long + ldy #16 ; Load base + jsr ultoa ; Push arguments, call _ultoa - pla ; Get the format spec - cmp #'x' ; Lower case? - bne @L2 - lda Str - ldx Str+1 - jsr _strlower ; Make characters lower case -@L2: jmp HaveArg + pla ; Get the format spec + cmp #'x' ; Lower case? + bne @L2 + lda Str + ldx Str+1 + jsr _strlower ; Make characters lower case +@L2: jmp HaveArg ; Unknown format character, skip it UnknownFormat: - jmp MainLoop + jmp MainLoop ; We have the argument, do argument string formatting @@ -668,81 +668,81 @@ HaveArg: ; ArgLen = strlen (Str); - lda Str - ldx Str+1 - jsr _strlen ; Get length of argument - sta ArgLen - stx ArgLen+1 + lda Str + ldx Str+1 + jsr _strlen ; Get length of argument + sta ArgLen + stx ArgLen+1 ; if (Prec && Prec < ArgLen) ArgLen = Prec; - lda Prec - ora Prec+1 - beq @L1 - ldx Prec - cpx ArgLen - lda Prec+1 - tay - sbc ArgLen+1 - bcs @L1 - stx ArgLen - sty ArgLen+1 + lda Prec + ora Prec+1 + beq @L1 + ldx Prec + cpx ArgLen + lda Prec+1 + tay + sbc ArgLen+1 + bcs @L1 + stx ArgLen + sty ArgLen+1 ; if (Width > ArgLen) { -; Width -= ArgLen; /* padcount */ +; Width -= ArgLen; /* padcount */ ; } else { ; Width = 0; ; } ; Since width is used as a counter below, calculate -(width+1) -@L1: sec - lda Width - sbc ArgLen - tax - lda Width+1 - sbc ArgLen+1 - bcs @L2 - lda #0 - tax -@L2: eor #$FF - sta Width+1 - txa - eor #$FF - sta Width +@L1: sec + lda Width + sbc ArgLen + tax + lda Width+1 + sbc ArgLen+1 + bcs @L2 + lda #0 + tax +@L2: eor #$FF + sta Width+1 + txa + eor #$FF + sta Width ; /* Do padding on the left side if needed */ ; if (!leftjust) { ; /* argument right justified */ ; while (width) { -; fout (d, &padchar, 1); -; --width; +; fout (d, &padchar, 1); +; --width; ; } ; } - lda LeftJust - bne @L3 - jsr OutputPadding + lda LeftJust + bne @L3 + jsr OutputPadding ; Output the argument itself -@L3: jsr OutputArg +@L3: jsr OutputArg ; /* Output right padding bytes if needed */ ; if (leftjust) { ; /* argument left justified */ ; while (width) { -; fout (d, &padchar, 1); -; --width; +; fout (d, &padchar, 1); +; --width; ; } ; } - lda LeftJust - beq @L4 - jsr OutputPadding + lda LeftJust + beq @L4 + jsr OutputPadding ; Done, parse next chars from format string -@L4: jmp MainLoop +@L4: jmp MainLoop ; ---------------------------------------------------------------------------- @@ -751,34 +751,34 @@ HaveArg: .bss ; Save area for the zero page registers -RegSave: .res regbanksize +RegSave: .res regbanksize ; One character argument for OutFunc -CharArg: .byte 0 +CharArg: .byte 0 ; Format variables FormatVars: -LeftJust: .byte 0 -AddSign: .byte 0 -AddBlank: .byte 0 -AltForm: .byte 0 -PadChar: .byte 0 -Width: .word 0 -Prec: .word 0 -IsLong: .byte 0 -Leader: .byte 0 -BufIdx: .byte 0 ; Argument string pointer -FormatVarSize = * - FormatVars +LeftJust: .byte 0 +AddSign: .byte 0 +AddBlank: .byte 0 +AltForm: .byte 0 +PadChar: .byte 0 +Width: .word 0 +Prec: .word 0 +IsLong: .byte 0 +Leader: .byte 0 +BufIdx: .byte 0 ; Argument string pointer +FormatVarSize = * - FormatVars ; Argument buffer and pointer -Buf: .res 20 -Str: .word 0 -ArgLen: .res 2 +Buf: .res 20 +Str: .word 0 +ArgLen: .res 2 .data ; Stuff from OutData. Is used as a vector and must be aligned -CallOutFunc: jmp $0000 +CallOutFunc: jmp $0000 diff --git a/libsrc/common/_scanf.c b/libsrc/common/_scanf.c index 34728f8dd..108fc6095 100644 --- a/libsrc/common/_scanf.c +++ b/libsrc/common/_scanf.c @@ -34,7 +34,7 @@ /*****************************************************************************/ -/* SetJmp return codes */ +/* SetJmp return codes */ /*****************************************************************************/ @@ -48,28 +48,28 @@ enum { /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ static const char* format; /* Copy of function argument */ static const struct scanfdata* D_; /* Copy of function argument */ -static va_list ap; /* Copy of function argument */ -static jmp_buf JumpBuf; /* "Label" that is used for failures */ -static char F; /* Character from format string */ +static va_list ap; /* Copy of function argument */ +static jmp_buf JumpBuf; /* "Label" that is used for failures */ +static char F; /* Character from format string */ static unsigned CharCount; /* Characters read so far */ -static int C; /* Character from input */ -static unsigned Width; /* Maximum field width */ -static long IntVal; /* Converted int value */ -static int Assignments; /* Number of assignments */ +static int C; /* Character from input */ +static unsigned Width; /* Maximum field width */ +static long IntVal; /* Converted int value */ +static int Assignments; /* Number of assignments */ static unsigned char IntBytes; /* Number of bytes-1 for int conversions */ /* Flags */ -static bool Converted; /* Some object was converted */ -static bool Positive; /* Flag for positive value */ -static bool NoAssign; /* Suppress assignment */ -static bool Invert; /* Do we need to invert the charset? */ +static bool Converted; /* Some object was converted */ +static bool Positive; /* Flag for positive value */ +static bool NoAssign; /* Suppress assignment */ +static bool Invert; /* Do we need to invert the charset? */ static unsigned char CharSet[(1+UCHAR_MAX)/CHAR_BIT]; static const unsigned char Bits[CHAR_BIT] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 @@ -87,7 +87,7 @@ static const unsigned char Bits[CHAR_BIT] = { /*****************************************************************************/ -/* Character sets */ +/* Character sets */ /*****************************************************************************/ @@ -137,7 +137,7 @@ static unsigned char IsCharInSet (void) /* Get the character from C. */ asm ("lda #$00"); asm ("ldx %v+1", C); - asm ("bne L1"); /* EOF never is in the set */ + asm ("bne L1"); /* EOF never is in the set */ asm ("lda %v", C); FindBit(); asm ("and %v,x", CharSet); @@ -165,7 +165,7 @@ static void InvertCharSet (void) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -433,7 +433,7 @@ static void __fastcall__ ScanInt (unsigned char Base) case 'x': case 'X': Base = 16; - Converted = true; + Converted = true; ReadChar (); break; default: @@ -481,7 +481,7 @@ static char GetFormat (void) int __fastcall__ _scanf (const struct scanfdata* D, - const char* format_, va_list ap_) + const char* format_, va_list ap_) /* This is the routine used to do the actual work. It is called from several * types of wrappers to implement the actual ISO xxscanf functions. */ @@ -519,16 +519,16 @@ Again: /* Check for a conversion */ if (F != '%') { - /* Check for a match */ - if ((bool) isspace ((int) F)) { + /* Check for a match */ + if ((bool) isspace ((int) F)) { - /* Special white space handling: Any whitespace in the + /* Special white space handling: Any whitespace in the * format string matches any amount of whitespace including * none(!). So this match will never fail. - */ - SkipWhite (); - continue; - } + */ + SkipWhite (); + continue; + } Percent: /* ### Note: The opposite test (C == F) @@ -540,27 +540,27 @@ Percent: * and return the number of assigned conversions. */ goto NoConv; - } + } /* A match -- get the next input character, and continue. */ goto Again; } else { - /* A conversion. Skip the percent sign. */ - /* 0. Check for %% */ - if (GetFormat () == '%') { - goto Percent; - } + /* A conversion. Skip the percent sign. */ + /* 0. Check for %% */ + if (GetFormat () == '%') { + goto Percent; + } - /* 1. Assignment suppression */ + /* 1. Assignment suppression */ NoAssign = (F == '*'); if (NoAssign) { GetFormat (); } /* 2. Maximum field width */ - Width = UINT_MAX; + Width = UINT_MAX; HaveWidth = (bool) isdigit (F); if (HaveWidth) { Width = 0; @@ -594,7 +594,7 @@ Percent: IntBytes = sizeof(char) - 1; ++format; } - GetFormat (); + GetFormat (); break; case 'l': @@ -605,14 +605,14 @@ Percent: /* FALLTHROUGH */ case 'j': /* intmax_t */ IntBytes = sizeof(long) - 1; - /* FALLTHROUGH */ + /* FALLTHROUGH */ case 'z': /* size_t */ case 't': /* ptrdiff_t */ - /* Same size as int */ + /* Same size as int */ case 'L': /* long double - ignore this one */ - GetFormat (); + GetFormat (); } /* 4. Conversion specifier */ @@ -621,92 +621,92 @@ Percent: * standard says that even the 'u' modifier allows an * optionally signed integer. */ - case 'd': /* Optionally signed decimal integer */ + case 'd': /* Optionally signed decimal integer */ case 'u': - ScanInt (10); - break; + ScanInt (10); + break; - case 'i': - /* Optionally signed integer with a base */ - ScanInt (0); - break; + case 'i': + /* Optionally signed integer with a base */ + ScanInt (0); + break; - case 'o': - /* Optionally signed octal integer */ - ScanInt (8); - break; + case 'o': + /* Optionally signed octal integer */ + ScanInt (8); + break; - case 'x': - case 'X': - /* Optionally signed hexadecimal integer */ - ScanInt (16); - break; + case 'x': + case 'X': + /* Optionally signed hexadecimal integer */ + ScanInt (16); + break; - case 's': - /* Whitespace-terminated string */ - SkipWhite (); - CheckEnd (); /* Is it an input failure? */ + case 's': + /* Whitespace-terminated string */ + SkipWhite (); + CheckEnd (); /* Is it an input failure? */ Converted = true; /* No, conversion will succeed */ - if (NoAssign == false) { - S = va_arg (ap, char*); - } - while (C != EOF - && (bool) isspace (C) == false - && ++Width) { - if (NoAssign == false) { - *S++ = C; - } - ReadChar (); - } - /* Terminate the string just read */ - if (NoAssign == false) { - *S = '\0'; - ++Assignments; - } - break; + if (NoAssign == false) { + S = va_arg (ap, char*); + } + while (C != EOF + && (bool) isspace (C) == false + && ++Width) { + if (NoAssign == false) { + *S++ = C; + } + ReadChar (); + } + /* Terminate the string just read */ + if (NoAssign == false) { + *S = '\0'; + ++Assignments; + } + break; case 'c': - /* Fixed-length string, NOT zero-terminated */ - if (HaveWidth == false) { - /* No width given, default is 1 */ - Width = ~1u; - } - CheckEnd (); /* Is it an input failure? */ - Converted = true; /* No, at least 1 char. available */ - if (NoAssign == false) { - S = va_arg (ap, char*); - /* ## This loop is convenient for us, but it isn't - * standard C. The standard implies that a failure - * shouldn't put anything into the array argument. - */ + /* Fixed-length string, NOT zero-terminated */ + if (HaveWidth == false) { + /* No width given, default is 1 */ + Width = ~1u; + } + CheckEnd (); /* Is it an input failure? */ + Converted = true; /* No, at least 1 char. available */ + if (NoAssign == false) { + S = va_arg (ap, char*); + /* ## This loop is convenient for us, but it isn't + * standard C. The standard implies that a failure + * shouldn't put anything into the array argument. + */ while (++Width) { - CheckEnd (); /* Is it a matching failure? */ + CheckEnd (); /* Is it a matching failure? */ *S++ = C; ReadChar (); } - ++Assignments; - } else { + ++Assignments; + } else { /* Just skip as many chars as given */ while (++Width) { - CheckEnd (); /* Is it a matching failure? */ + CheckEnd (); /* Is it a matching failure? */ ReadChar (); } } - break; + break; case '[': - /* String using characters from a set */ + /* String using characters from a set */ /* Clear the set */ memset (CharSet, 0, sizeof (CharSet)); - /* Skip the left-bracket, and test for inversion. */ - Invert = (GetFormat () == '^'); + /* Skip the left-bracket, and test for inversion. */ + Invert = (GetFormat () == '^'); if (Invert) { GetFormat (); } if (F == ']') { - /* Empty sets aren't allowed; so, a right-bracket - * at the beginning must be a member of the set. - */ + /* Empty sets aren't allowed; so, a right-bracket + * at the beginning must be a member of the set. + */ AddCharToSet (F); GetFormat (); } @@ -761,10 +761,10 @@ Percent: */ Match = false; if (NoAssign == false) { - S = va_arg (ap, char*); + S = va_arg (ap, char*); } while (IsCharInSet () && ++Width) { - if (NoAssign == false) { + if (NoAssign == false) { *S++ = C; } Match = Converted = true; @@ -778,17 +778,17 @@ Percent: *S = '\0'; ++Assignments; } - break; + break; case 'p': - /* Pointer, general format is 0xABCD. + /* Pointer, general format is 0xABCD. * %hhp --> zero-page pointer * %hp --> near pointer * %lp --> far pointer - */ - SkipWhite (); + */ + SkipWhite (); if (CHAR (C) != '0') { - goto NoConv; + goto NoConv; } Converted = true; ReadChar (); @@ -809,32 +809,32 @@ Percent: * (the read-ahead character hasn't been consumed). */ IntVal = (long) (CharCount - (C == EOF ? 0u : 1u)); - AssignInt (); + AssignInt (); /* Don't count it. */ if (NoAssign == false) { - --Assignments; + --Assignments; } break; - case 'S': - case 'C': + case 'S': + case 'C': /* Wide characters */ - case 'a': - case 'A': - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - /* Optionally signed float */ + case 'a': + case 'A': + case 'e': + case 'E': + case 'f': + case 'F': + case 'g': + case 'G': + /* Optionally signed float */ /* Those 2 groups aren't implemented. */ _seterrno (ENOSYS); Assignments = EOF; - PushBack (); - return Assignments; + PushBack (); + return Assignments; default: /* Invalid specification */ @@ -853,7 +853,7 @@ NoConv: * the number of assignments is returned (the default behaviour). */ if (C == EOF && Converted == false) { - Assignments = EOF; /* Special case: error */ + Assignments = EOF; /* Special case: error */ } } diff --git a/libsrc/common/_scanf.h b/libsrc/common/_scanf.h index f8aad5be3..0a8b09b7d 100644 --- a/libsrc/common/_scanf.h +++ b/libsrc/common/_scanf.h @@ -27,9 +27,9 @@ typedef int __fastcall__ (*ungetfunc) (int c, void* data); * file, so check this when altering the structure. */ struct scanfdata { - getfunc get; /* Pointer to input routine */ - ungetfunc unget; /* Pointer to pushback routine */ - void* data; /* Pointer to struct. used outside of _scanf() */ + getfunc get; /* Pointer to input routine */ + ungetfunc unget; /* Pointer to pushback routine */ + void* data; /* Pointer to struct. used outside of _scanf() */ }; diff --git a/libsrc/common/_seterrno.s b/libsrc/common/_seterrno.s index 4321252be..e35c0b342 100644 --- a/libsrc/common/_seterrno.s +++ b/libsrc/common/_seterrno.s @@ -6,7 +6,7 @@ ; currently only called from asm code. ; - .include "errno.inc" + .include "errno.inc" .code diff --git a/libsrc/common/_swap.s b/libsrc/common/_swap.s index 7f0b59e94..a16aecc52 100644 --- a/libsrc/common/_swap.s +++ b/libsrc/common/_swap.s @@ -4,42 +4,42 @@ ; void __fastcall__ _swap (void* p, void* q, size_t size); ; - .export __swap - .import popax - .importzp ptr1, ptr2, ptr3 + .export __swap + .import popax + .importzp ptr1, ptr2, ptr3 -__swap: eor #$FF - sta ptr3 +__swap: eor #$FF + sta ptr3 txa eor #$FF - sta ptr3+1 ; Save -(size+1) into ptr3 + sta ptr3+1 ; Save -(size+1) into ptr3 - jsr popax ; Get q - sta ptr2 - stx ptr2+1 + jsr popax ; Get q + sta ptr2 + stx ptr2+1 - jsr popax ; Get p - sta ptr1 - stx ptr1+1 + jsr popax ; Get p + sta ptr1 + stx ptr1+1 ; Prepare for swap - ldy #$00 + ldy #$00 ; Swap loop @L1: inc ptr3 ; Bump counter low byte beq @L3 ; Branch on overflow -@L2: lda (ptr1),y - tax - lda (ptr2),y - sta (ptr1),y - txa - sta (ptr2),y - iny - bne @L1 +@L2: lda (ptr1),y + tax + lda (ptr2),y + sta (ptr1),y + txa + sta (ptr2),y + iny + bne @L1 inc ptr1+1 inc ptr2+1 bne @L1 ; Branch always (hopefully) diff --git a/libsrc/common/_sys.s b/libsrc/common/_sys.s index 12c28adee..492e85673 100644 --- a/libsrc/common/_sys.s +++ b/libsrc/common/_sys.s @@ -4,22 +4,22 @@ ; Ullrich von Bassewitz, 16.12.1998 ; - .export __sys - .import jmpvec - .importzp ptr1 + .export __sys + .import jmpvec + .importzp ptr1 -__sys: sta ptr1 - stx ptr1+1 ; Save the pointer to r +__sys: sta ptr1 + stx ptr1+1 ; Save the pointer to r ; Fetch the PC and store it into the jump vector - ldy #5 - lda (ptr1),y - sta jmpvec+2 - dey - lda (ptr1),y - sta jmpvec+1 + ldy #5 + lda (ptr1),y + sta jmpvec+2 + dey + lda (ptr1),y + sta jmpvec+1 ; Remember the flags so we can restore them to a known state after calling the ; routine @@ -29,51 +29,51 @@ __sys: sta ptr1 ; Get the flags, keep the state of bit 4 and 5 using the other flags from ; the flags value passed by the caller. Push the new flags and push A. - dey + dey php pla ; Current flags -> A eor (ptr1),y and #%00110000 eor (ptr1),y - pha ; Push new flags value - ldy #0 - lda (ptr1),y - pha + pha ; Push new flags value + ldy #0 + lda (ptr1),y + pha ; Get and assign X and Y - iny - lda (ptr1),y - tax - iny - lda (ptr1),y - tay + iny + lda (ptr1),y + tax + iny + lda (ptr1),y + tay ; Set a and the flags, call the machine code routine - pla - plp - jsr jmpvec + pla + plp + jsr jmpvec ; Back from the routine. Save the flags and A. - php - pha + php + pha ; Put the register values into the regs structure - tya - ldy #2 - sta (ptr1),y - dey - txa - sta (ptr1),y - dey - pla - sta (ptr1),y - ldy #3 - pla - sta (ptr1),y + tya + ldy #2 + sta (ptr1),y + dey + txa + sta (ptr1),y + dey + pla + sta (ptr1),y + ldy #3 + pla + sta (ptr1),y ; Restore the old flags value @@ -81,5 +81,5 @@ __sys: sta ptr1 ; Done - rts + rts diff --git a/libsrc/common/abs.s b/libsrc/common/abs.s index 273ec1c9a..5daa8a14a 100644 --- a/libsrc/common/abs.s +++ b/libsrc/common/abs.s @@ -4,13 +4,13 @@ ; int abs (int x); ; - .export _abs - .import negax + .export _abs + .import negax -_abs: cpx #$00 ; test hi byte - bpl L1 - jmp negax ; Negate if negative -L1: rts +_abs: cpx #$00 ; test hi byte + bpl L1 + jmp negax ; Negate if negative +L1: rts diff --git a/libsrc/common/atexit.s b/libsrc/common/atexit.s index 7bb063306..6edfd4a5d 100644 --- a/libsrc/common/atexit.s +++ b/libsrc/common/atexit.s @@ -4,44 +4,44 @@ ; int atexit (void (*f) (void)); ; - .export _atexit - .destructor doatexit, 17 - .import callax + .export _atexit + .destructor doatexit, 17 + .import callax - .include "errno.inc" + .include "errno.inc" .macpack cpu ; --------------------------------------------------------------------------- -.proc _atexit +.proc _atexit - ldy exitfunc_index - cpy #exitfunc_max ; Slot available? - beq @Error ; Jump if no + ldy exitfunc_index + cpy #exitfunc_max ; Slot available? + beq @Error ; Jump if no ; Enter the function into the table - sta exitfunc_table,y - iny - txa - sta exitfunc_table,y - iny - sty exitfunc_index + sta exitfunc_table,y + iny + txa + sta exitfunc_table,y + iny + sty exitfunc_index ; Done, return zero - lda #0 - tax - rts + lda #0 + tax + rts ; Error, no space left -@Error: lda #ENOSPC ; No space left +@Error: lda #ENOSPC ; No space left jsr __seterrno - ldx #$FF ; Return -1 - txa - rts + ldx #$FF ; Return -1 + txa + rts .endproc @@ -51,24 +51,24 @@ .code -.proc doatexit +.proc doatexit - ldy exitfunc_index ; Get index - beq @L9 ; Jump if done - dey - lda exitfunc_table,y - tax - dey - lda exitfunc_table,y - sty exitfunc_index - jsr callax ; Call the function + ldy exitfunc_index ; Get index + beq @L9 ; Jump if done + dey + lda exitfunc_table,y + tax + dey + lda exitfunc_table,y + sty exitfunc_index + jsr callax ; Call the function .if (.cpu .bitand ::CPU_ISET_65SC02) - bra doatexit + bra doatexit .else - jmp doatexit ; Next one + jmp doatexit ; Next one .endif -@L9: rts +@L9: rts .endproc @@ -77,8 +77,8 @@ ; --------------------------------------------------------------------------- .bss -exitfunc_index: .res 1 ; Index into table, inc'ed by 2 -exitfunc_table: .res 10 ; 5 exit functions -exitfunc_max = <(* - exitfunc_table) +exitfunc_index: .res 1 ; Index into table, inc'ed by 2 +exitfunc_table: .res 10 ; 5 exit functions +exitfunc_max = <(* - exitfunc_table) diff --git a/libsrc/common/atoi.s b/libsrc/common/atoi.s index d55ddb9e8..cb598f719 100644 --- a/libsrc/common/atoi.s +++ b/libsrc/common/atoi.s @@ -5,9 +5,9 @@ ; long atol (const char* s); ; - .export _atoi, _atol - .import negeax, __ctype - .importzp sreg, ptr1, ptr2, tmp1 + .export _atoi, _atol + .import negeax, __ctype + .importzp sreg, ptr1, ptr2, tmp1 .include "ctype.inc" @@ -16,100 +16,100 @@ ; _atoi: -_atol: sta ptr1 ; Store s - stx ptr1+1 - ldy #0 - sty ptr2 - sty ptr2+1 ; initial value (32 bit) - sty sreg - sty sreg+1 +_atol: sta ptr1 ; Store s + stx ptr1+1 + ldy #0 + sty ptr2 + sty ptr2+1 ; initial value (32 bit) + sty sreg + sty sreg+1 ; Skip whitespace -L1: lda (ptr1),y - tax - lda __ctype,x ; get character classification - and #CT_SPACE_TAB ; tab or space? - beq L2 ; jump if no - iny - bne L1 - inc ptr1+1 - bne L1 ; branch always +L1: lda (ptr1),y + tax + lda __ctype,x ; get character classification + and #CT_SPACE_TAB ; tab or space? + beq L2 ; jump if no + iny + bne L1 + inc ptr1+1 + bne L1 ; branch always ; Check for a sign. The character is in X -L2: txa ; get char - ldx #0 ; flag: positive - cmp #'+' ; ### portable? - beq L3 - cmp #'-' ; ### portable? - bne L5 - dex ; flag: negative +L2: txa ; get char + ldx #0 ; flag: positive + cmp #'+' ; ### portable? + beq L3 + cmp #'-' ; ### portable? + bne L5 + dex ; flag: negative L3: iny - bne L5 - inc ptr1+1 + bne L5 + inc ptr1+1 ; Store the sign flag and setup for conversion -L5: stx tmp1 ; remember sign flag +L5: stx tmp1 ; remember sign flag -L6: lda (ptr1),y ; get next char - tax - lda __ctype,x ; get character classification - and #$04 ; digit? - beq L8 ; done +L6: lda (ptr1),y ; get next char + tax + lda __ctype,x ; get character classification + and #$04 ; digit? + beq L8 ; done ; Multiply ptr2 (the converted value) by 10 - jsr mul2 ; * 2 + jsr mul2 ; * 2 - lda sreg+1 - pha - lda sreg - pha - lda ptr2+1 - pha - lda ptr2 - pha ; Save value + lda sreg+1 + pha + lda sreg + pha + lda ptr2+1 + pha + lda ptr2 + pha ; Save value - jsr mul2 ; * 4 - jsr mul2 ; * 8 + jsr mul2 ; * 4 + jsr mul2 ; * 8 - clc - pla - adc ptr2 - sta ptr2 - pla - adc ptr2+1 - sta ptr2+1 - pla - adc sreg - sta sreg - pla - adc sreg+1 - sta sreg+1 ; x*2 + x*8 = x*10 + clc + pla + adc ptr2 + sta ptr2 + pla + adc ptr2+1 + sta ptr2+1 + pla + adc sreg + sta sreg + pla + adc sreg+1 + sta sreg+1 ; x*2 + x*8 = x*10 ; Get the character back and add it - txa ; get char back - sec - sbc #'0' ; make numeric value - clc - adc ptr2 - sta ptr2 - bcc L7 - inc ptr2+1 - bne L7 - inc sreg - bne L7 - inc sreg+1 + txa ; get char back + sec + sbc #'0' ; make numeric value + clc + adc ptr2 + sta ptr2 + bcc L7 + inc ptr2+1 + bne L7 + inc sreg + bne L7 + inc sreg+1 ; Next character -L7: iny - bne L6 - inc ptr1+1 - bne L6 +L7: iny + bne L6 + inc ptr1+1 + bne L6 ; Conversion done. Load the low 16 bit into A/X @@ -118,8 +118,8 @@ L8: lda ptr2 ; Negate the value if necessary, otherwise we're done - ldy tmp1 ; sign - beq L9 ; Branch if positive + ldy tmp1 ; sign + beq L9 ; Branch if positive ; Negate the 32 bit value in ptr2/sreg @@ -129,10 +129,10 @@ L8: lda ptr2 ; Helper functions ; -mul2: asl ptr2 - rol ptr2+1 - rol sreg - rol sreg+1 ; * 2 +mul2: asl ptr2 + rol ptr2+1 + rol sreg + rol sreg+1 ; * 2 L9: rts diff --git a/libsrc/common/bsearch.c b/libsrc/common/bsearch.c index bc609be2c..7d64dbbe9 100644 --- a/libsrc/common/bsearch.c +++ b/libsrc/common/bsearch.c @@ -22,23 +22,23 @@ void* __fastcall__ bsearch (const void* key, const void* base, size_t n, /* Binary search */ while (first <= last) { - /* Set current to mid of range */ - current = (last + first) / 2; + /* Set current to mid of range */ + current = (last + first) / 2; - /* Do a compare */ - result = cmp ((void*) (((int) base) + current*size), key); + /* Do a compare */ + result = cmp ((void*) (((int) base) + current*size), key); if (result < 0) { - first = current + 1; - } else { - last = current - 1; - if (result == 0) { - /* Found one entry that matches the search key. However there may be - * more than one entry with the same key value and ANSI guarantees - * that we return the first of a row of items with the same key. - */ - found = 1; - } - } + first = current + 1; + } else { + last = current - 1; + if (result == 0) { + /* Found one entry that matches the search key. However there may be + * more than one entry with the same key value and ANSI guarantees + * that we return the first of a row of items with the same key. + */ + found = 1; + } + } } /* Did we find the entry? */ diff --git a/libsrc/common/calloc.s b/libsrc/common/calloc.s index 2a66a7d1b..6e3e1bd3f 100644 --- a/libsrc/common/calloc.s +++ b/libsrc/common/calloc.s @@ -6,49 +6,49 @@ ; void* __fastcall__ calloc (size_t count, size_t size); ; - .export _calloc - .import _malloc, __bzero - .import tosumulax, pushax + .export _calloc + .import _malloc, __bzero + .import tosumulax, pushax ; ------------------------------------------------------------------------- -.proc _calloc +.proc _calloc ; We have the first argument in a/x and the second on the stack. Calling ; tosumulax will give the product of both in a/x. - jsr tosumulax + jsr tosumulax ; Save size for later - sta Size - stx Size+1 + sta Size + stx Size+1 ; malloc() is a fastcall function, so we do already have the argument in ; the right place - jsr _malloc + jsr _malloc ; Check for a NULL pointer - cpx #0 - bne ClearBlock - cmp #0 - bne ClearBlock + cpx #0 + bne ClearBlock + cmp #0 + bne ClearBlock ; We have a NULL pointer, bail out - rts + rts ; No NULL pointer, clear the block. _bzero will return a pointer to the ; block which is exactly what we want. ClearBlock: - jsr pushax ; ptr - lda Size - ldx Size+1 ; Size - jmp __bzero + jsr pushax ; ptr + lda Size + ldx Size+1 ; Size + jmp __bzero .endproc @@ -57,7 +57,7 @@ ClearBlock: .bss -Size: .res 2 +Size: .res 2 diff --git a/libsrc/common/cc65_idiv32by16r16.s b/libsrc/common/cc65_idiv32by16r16.s index 74394672b..9c30984b8 100644 --- a/libsrc/common/cc65_idiv32by16r16.s +++ b/libsrc/common/cc65_idiv32by16r16.s @@ -4,7 +4,7 @@ ; CC65 library: 32by16 => 16 signed division ; - .export _cc65_idiv32by16r16 + .export _cc65_idiv32by16r16 .import idiv32by16r16, incsp4 .include "zeropage.inc" diff --git a/libsrc/common/cc65_udiv32by16r16.s b/libsrc/common/cc65_udiv32by16r16.s index 23fcbbe17..9cad63bd4 100644 --- a/libsrc/common/cc65_udiv32by16r16.s +++ b/libsrc/common/cc65_udiv32by16r16.s @@ -4,7 +4,7 @@ ; CC65 library: 32by16 => 16 unsigned division ; - .export _cc65_udiv32by16r16 + .export _cc65_udiv32by16r16 .import udiv32by16r16m, incsp4 .include "zeropage.inc" diff --git a/libsrc/common/copydata.s b/libsrc/common/copydata.s index b0a9987fd..fec0204ea 100644 --- a/libsrc/common/copydata.s +++ b/libsrc/common/copydata.s @@ -4,21 +4,21 @@ ; Copy the data segment from the LOAD to the RUN location ; - .export copydata - .import __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__ - .importzp ptr1, ptr2, tmp1 + .export copydata + .import __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__ + .importzp ptr1, ptr2, tmp1 copydata: - lda #<__DATA_LOAD__ ; Source pointer - sta ptr1 - lda #>__DATA_LOAD__ - sta ptr1+1 + lda #<__DATA_LOAD__ ; Source pointer + sta ptr1 + lda #>__DATA_LOAD__ + sta ptr1+1 - lda #<__DATA_RUN__ ; Target pointer - sta ptr2 - lda #>__DATA_RUN__ - sta ptr2+1 + lda #<__DATA_RUN__ ; Target pointer + sta ptr2 + lda #>__DATA_RUN__ + sta ptr2+1 ldx #<~__DATA_SIZE__ lda #>~__DATA_SIZE__ ; Use -(__DATASIZE__+1) @@ -30,13 +30,13 @@ copydata: @L1: inx beq @L3 -@L2: lda (ptr1),y - sta (ptr2),y +@L2: lda (ptr1),y + sta (ptr2),y iny bne @L1 - inc ptr1+1 - inc ptr2+1 ; Bump pointers - bne @L1 ; Branch always (hopefully) + inc ptr1+1 + inc ptr2+1 ; Bump pointers + bne @L1 ; Branch always (hopefully) ; Bump the high counter byte diff --git a/libsrc/common/ctime.s b/libsrc/common/ctime.s index d15df3c9a..ace1c09ff 100644 --- a/libsrc/common/ctime.s +++ b/libsrc/common/ctime.s @@ -4,7 +4,7 @@ ; char* __fastcall__ ctime (time_t* timep); ; - .export _ctime + .export _ctime .import _localtime, _asctime diff --git a/libsrc/common/divt.s b/libsrc/common/divt.s index 034394a9a..b532f6f95 100644 --- a/libsrc/common/divt.s +++ b/libsrc/common/divt.s @@ -12,23 +12,23 @@ ; div_t __fastcall__ div (int numer, int denom); ; - .export _div + .export _div - .import tosdivax, negax - .importzp sreg, ptr1, tmp1 + .import tosdivax, negax + .importzp sreg, ptr1, tmp1 -_div: jsr tosdivax ; Division-operator does most of the work - sta sreg ; Quotient is in sreg +_div: jsr tosdivax ; Division-operator does most of the work + sta sreg ; Quotient is in sreg stx sreg+1 - lda ptr1 ; Unsigned remainder is in ptr1 + lda ptr1 ; Unsigned remainder is in ptr1 ldx ptr1+1 ; Adjust the sign of the remainder. ; It must be the same as the sign of the dividend. ; - bit tmp1 ; Load high-byte of left argument - bpl Pos ; Jump if sign-of-result is positive - jmp negax ; Result is negative, adjust the sign + bit tmp1 ; Load high-byte of left argument + bpl Pos ; Jump if sign-of-result is positive + jmp negax ; Result is negative, adjust the sign -Pos: rts +Pos: rts diff --git a/libsrc/common/errno.s b/libsrc/common/errno.s index 2ab1ad86b..5c2bf288e 100644 --- a/libsrc/common/errno.s +++ b/libsrc/common/errno.s @@ -43,5 +43,5 @@ ok: rts .bss __errno: - .word 0 + .word 0 diff --git a/libsrc/common/fdopen.c b/libsrc/common/fdopen.c index fc8d0f776..43559ce8b 100644 --- a/libsrc/common/fdopen.c +++ b/libsrc/common/fdopen.c @@ -14,7 +14,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -29,8 +29,8 @@ FILE* __fastcall__ fdopen (int handle, const char* /*mode*/) f->f_fd = handle; f->f_flags = _FOPEN; } else { - /* No slots */ - _seterrno (EMFILE); /* Too many files */ + /* No slots */ + _seterrno (EMFILE); /* Too many files */ } /* Return the file descriptor */ diff --git a/libsrc/common/fgetc.c b/libsrc/common/fgetc.c index 7e6a4db9c..c873cd1d0 100644 --- a/libsrc/common/fgetc.c +++ b/libsrc/common/fgetc.c @@ -14,7 +14,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -25,7 +25,7 @@ int __fastcall__ fgetc (register FILE* f) /* Check if the file is open or if there is an error condition */ if ((f->f_flags & _FOPEN) == 0 || (f->f_flags & (_FERROR | _FEOF)) != 0) { - return EOF; + return EOF; } /* If we have a pushed back character, return it */ @@ -38,18 +38,18 @@ int __fastcall__ fgetc (register FILE* f) switch (read (f->f_fd, &c, 1)) { case -1: - /* Error */ - f->f_flags |= _FERROR; - return EOF; + /* Error */ + f->f_flags |= _FERROR; + return EOF; case 0: - /* EOF */ - f->f_flags |= _FEOF; - return EOF; + /* EOF */ + f->f_flags |= _FEOF; + return EOF; default: - /* Char read */ - return c; + /* Char read */ + return c; } } diff --git a/libsrc/common/fgetpos.c b/libsrc/common/fgetpos.c index e3851f873..796792afa 100644 --- a/libsrc/common/fgetpos.c +++ b/libsrc/common/fgetpos.c @@ -11,7 +11,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/libsrc/common/fgets.c b/libsrc/common/fgets.c index d2e2c72e4..259f3904e 100644 --- a/libsrc/common/fgets.c +++ b/libsrc/common/fgets.c @@ -13,7 +13,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -33,28 +33,28 @@ char* __fastcall__ fgets (char* s, unsigned size, register FILE* f) i = 0; while (--size) { - /* Get next character */ - if ((c = fgetc (f)) == EOF) { - /* Error or EOF */ - if ((f->f_flags & _FERROR) != 0 || i == 0) { - /* ERROR or EOF on first char */ + /* Get next character */ + if ((c = fgetc (f)) == EOF) { + /* Error or EOF */ + if ((f->f_flags & _FERROR) != 0 || i == 0) { + /* ERROR or EOF on first char */ *p = '\0'; - return 0; - } else { - /* EOF with data already read */ + return 0; + } else { + /* EOF with data already read */ break; - } - } + } + } - /* One char more */ - *p = c; + /* One char more */ + *p = c; ++p; ++i; - /* Stop at end of line */ - if ((char)c == '\n') { - break; - } + /* Stop at end of line */ + if ((char)c == '\n') { + break; + } } /* Terminate the string */ diff --git a/libsrc/common/fmisc.s b/libsrc/common/fmisc.s index 481be4176..156a80dbc 100644 --- a/libsrc/common/fmisc.s +++ b/libsrc/common/fmisc.s @@ -4,9 +4,9 @@ ; Several small file stream functions ; - .export _clearerr, _feof, _ferror, _fileno, _fflush - .import return0 - .importzp ptr1 + .export _clearerr, _feof, _ferror, _fileno, _fflush + .import return0 + .importzp ptr1 .include "_file.inc" .include "errno.inc" @@ -16,12 +16,12 @@ ; and zero flag set in case of an error. .proc getf - sta ptr1 - stx ptr1+1 - ldy #_FILE::f_flags - lda (ptr1),y ; get f->f_flags - and #_FOPEN ; file open? - rts + sta ptr1 + stx ptr1+1 + ldy #_FILE::f_flags + lda (ptr1),y ; get f->f_flags + and #_FOPEN ; file open? + rts .endproc ; @@ -29,12 +29,12 @@ ; .proc _clearerr - jsr getf - beq err - lda (ptr1),y - and #<~(_FEOF | _FERROR) - sta (ptr1),y -err: rts + jsr getf + beq err + lda (ptr1),y + and #<~(_FEOF | _FERROR) + sta (ptr1),y +err: rts .endproc ; @@ -42,12 +42,12 @@ err: rts ; .proc _feof - jsr getf + jsr getf beq @L1 ; Return 0 on error - lda (ptr1),y - and #_FEOF -@L1: ldx #0 - rts + lda (ptr1),y + and #_FEOF +@L1: ldx #0 + rts .endproc ; @@ -55,12 +55,12 @@ err: rts ; .proc _ferror - jsr getf + jsr getf beq @L1 ; Return 0 on error - lda (ptr1),y - and #_FERROR -@L1: ldx #0 - rts + lda (ptr1),y + and #_FERROR +@L1: ldx #0 + rts .endproc ; @@ -68,12 +68,12 @@ err: rts ; .proc _fileno - jsr getf + jsr getf beq error - ldy #_FILE::f_fd - lda (ptr1),y - ldx #0 - rts + ldy #_FILE::f_fd + lda (ptr1),y + ldx #0 + rts ; If the file is not valid, fileno must set errno and return -1 @@ -88,6 +88,6 @@ error: lda #f_flags & _FOPEN) == 0 || (f->f_flags & (_FERROR | _FEOF)) != 0) { - goto ReturnEOF; + goto ReturnEOF; } /* Write the byte */ if (write (f->f_fd, &c, 1) != 1) { - /* Error */ - f->f_flags |= _FERROR; + /* Error */ + f->f_flags |= _FERROR; ReturnEOF: - return EOF; + return EOF; } /* Return the byte written */ diff --git a/libsrc/common/fputs.c b/libsrc/common/fputs.c index c4c87eaa3..26c20cbe2 100644 --- a/libsrc/common/fputs.c +++ b/libsrc/common/fputs.c @@ -17,7 +17,7 @@ int __fastcall__ fputs (const char* s, register FILE* f) { /* Check if the file is open or if there is an error condition */ if ((f->f_flags & _FOPEN) == 0 || (f->f_flags & (_FERROR | _FEOF)) != 0) { - return EOF; + return EOF; } /* Write the string */ diff --git a/libsrc/common/fread.s b/libsrc/common/fread.s index 8e065ff0b..91d692985 100644 --- a/libsrc/common/fread.s +++ b/libsrc/common/fread.s @@ -40,25 +40,25 @@ ; Save the file pointer into the register bank - sta file - stx file+1 + sta file + stx file+1 ; Check if the file is open - ldy #_FILE::f_flags - lda (file),y - and #_FOPEN ; Is the file open? - beq @L1 ; Branch if no + ldy #_FILE::f_flags + lda (file),y + and #_FOPEN ; Is the file open? + beq @L1 ; Branch if no ; Check if the stream is in an error state - lda (file),y ; get file->f_flags again - and #_FERROR - beq @L2 + lda (file),y ; get file->f_flags again + and #_FERROR + beq @L2 ; File not open or in error state -@L1: lda #EINVAL +@L1: lda #EINVAL jsr __seterrno ; Set __errno, return zero in A tax ; a/x = 0 jmp @L99 ; Bail out @@ -208,6 +208,6 @@ ; Data .bss -save: .res 2 +save: .res 2 pb: .res 1 diff --git a/libsrc/common/free.s b/libsrc/common/free.s index 4ac96f1af..b6b77aae8 100644 --- a/libsrc/common/free.s +++ b/libsrc/common/free.s @@ -41,7 +41,7 @@ ; /* Remove the last block */ ; _hptr = (unsigned*) (((int) _hptr) - f->size); ; if (_hlast = f->prev) { -; /* Block before is now last block */ +; /* Block before is now last block */ ; f->prev->next = 0; ; } else { ; /* The freelist is empty now */ @@ -52,30 +52,30 @@ ; ; } else { ; -; /* Not at heap top, enter the block into the free list */ -; _hadd (b, size); +; /* Not at heap top, enter the block into the free list */ +; _hadd (b, size); ; ; } ; } ; - .importzp ptr1, ptr2, ptr3, ptr4 - .export _free, heapadd + .importzp ptr1, ptr2, ptr3, ptr4 + .export _free, heapadd .include "_heap.inc" - .macpack generic + .macpack generic ;----------------------------------------------------------------------------- ; Code -_free: sta ptr2 - stx ptr2+1 ; Save block +_free: sta ptr2 + stx ptr2+1 ; Save block ; Is the argument NULL? If so, bail out. - ora ptr2+1 ; Is the argument NULL? - bne @L1 ; Jump if no + ora ptr2+1 ; Is the argument NULL? + bne @L1 ; Jump if no rts ; Bail out if yes ; There's a pointer below the user space that points to the real start of the @@ -84,7 +84,7 @@ _free: sta ptr2 ; block. Remember the block size in ptr1. @L1: dec ptr2+1 ; Decrement high pointer byte - ldy #$FF + ldy #$FF lda (ptr2),y ; High byte of real block address tax dey @@ -93,91 +93,91 @@ _free: sta ptr2 sta ptr2 ; Set ptr2 to start of real block ldy #usedblock::size+1 - lda (ptr2),y ; High byte of size - sta ptr1+1 ; Save it - dey - lda (ptr2),y - sta ptr1 + lda (ptr2),y ; High byte of size + sta ptr1+1 ; Save it + dey + lda (ptr2),y + sta ptr1 ; Check if the block is on top of the heap - add ptr2 - tay - lda ptr2+1 - adc ptr1+1 - cpy __heapptr - bne heapadd ; Add to free list - cmp __heapptr+1 - bne heapadd + add ptr2 + tay + lda ptr2+1 + adc ptr1+1 + cpy __heapptr + bne heapadd ; Add to free list + cmp __heapptr+1 + bne heapadd ; The pointer is located at the heap top. Lower the heap top pointer to ; release the block. -@L3: lda ptr2 - sta __heapptr - lda ptr2+1 - sta __heapptr+1 +@L3: lda ptr2 + sta __heapptr + lda ptr2+1 + sta __heapptr+1 ; Check if the last block in the freelist is now at heap top. If so, remove ; this block from the freelist. - lda __heaplast - sta ptr1 - ora __heaplast+1 - beq @L9 ; Jump if free list empty - lda __heaplast+1 - sta ptr1+1 ; Pointer to last block now in ptr1 + lda __heaplast + sta ptr1 + ora __heaplast+1 + beq @L9 ; Jump if free list empty + lda __heaplast+1 + sta ptr1+1 ; Pointer to last block now in ptr1 - ldy #freeblock::size - lda (ptr1),y ; Low byte of block size - add ptr1 - tax - iny ; High byte of block size - lda (ptr1),y - adc ptr1+1 + ldy #freeblock::size + lda (ptr1),y ; Low byte of block size + add ptr1 + tax + iny ; High byte of block size + lda (ptr1),y + adc ptr1+1 - cmp __heapptr+1 - bne @L9 ; Jump if last block not on top of heap - cpx __heapptr - bne @L9 ; Jump if last block not on top of heap + cmp __heapptr+1 + bne @L9 ; Jump if last block not on top of heap + cpx __heapptr + bne @L9 ; Jump if last block not on top of heap ; Remove the last block - lda ptr1 - sta __heapptr - lda ptr1+1 - sta __heapptr+1 + lda ptr1 + sta __heapptr + lda ptr1+1 + sta __heapptr+1 ; Correct the next pointer of the now last block - ldy #freeblock::prev+1 ; Offset of ->prev field - lda (ptr1),y - sta ptr2+1 ; Remember f->prev in ptr2 - sta __heaplast+1 - dey - lda (ptr1),y - sta ptr2 ; Remember f->prev in ptr2 - sta __heaplast - ora __heaplast+1 ; -> prev == 0? - bne @L8 ; Jump if free list not empty + ldy #freeblock::prev+1 ; Offset of ->prev field + lda (ptr1),y + sta ptr2+1 ; Remember f->prev in ptr2 + sta __heaplast+1 + dey + lda (ptr1),y + sta ptr2 ; Remember f->prev in ptr2 + sta __heaplast + ora __heaplast+1 ; -> prev == 0? + bne @L8 ; Jump if free list not empty ; Free list is now empty (A = 0) - sta __heapfirst - sta __heapfirst+1 + sta __heapfirst + sta __heapfirst+1 ; Done -@L9: rts +@L9: rts ; Block before is now last block. ptr2 points to f->prev. -@L8: lda #$00 - dey ; Points to high byte of ->next - sta (ptr2),y - dey ; Low byte of f->prev->next - sta (ptr2),y - rts ; Done +@L8: lda #$00 + dey ; Points to high byte of ->next + sta (ptr2),y + dey ; Low byte of f->prev->next + sta (ptr2),y + rts ; Done ; The block is not on top of the heap. Add it to the free list. This was ; formerly a separate function called __hadd that was implemented in C as @@ -196,81 +196,81 @@ _free: sta ptr2 ; ; if (size >= sizeof (struct freeblock)) { ; -; /* Set the admin data */ -; f = (struct freeblock*) mem; -; f->size = size; +; /* Set the admin data */ +; f = (struct freeblock*) mem; +; f->size = size; ; -; /* Check if the freelist is empty */ -; if (_hfirst == 0) { +; /* Check if the freelist is empty */ +; if (_hfirst == 0) { ; -; /* The freelist is empty until now, insert the block */ -; f->prev = 0; -; f->next = 0; -; _hfirst = f; -; _hlast = f; +; /* The freelist is empty until now, insert the block */ +; f->prev = 0; +; f->next = 0; +; _hfirst = f; +; _hlast = f; ; -; } else { +; } else { ; -; /* We have to search the free list. As we are doing so, we check -; * if it is possible to combine this block with another already -; * existing block. Beware: The block may be the "missing link" +; /* We have to search the free list. As we are doing so, we check +; * if it is possible to combine this block with another already +; * existing block. Beware: The block may be the "missing link" ; * between *two* other blocks. -; */ -; left = 0; -; right = _hfirst; -; while (right && f > right) { -; left = right; -; right = right->next; -; } +; */ +; left = 0; +; right = _hfirst; +; while (right && f > right) { +; left = right; +; right = right->next; +; } ; ; -; /* Ok, the current block must be inserted between left and right (but -; * beware: one of the two may be zero!). Also check for the condition -; * that we have to merge two or three blocks. -; */ -; if (right) { -; /* Check if we must merge the block with the right one */ -; if (((unsigned) f) + size == (unsigned) right) { -; /* Merge with the right block */ -; f->size += right->size; -; if (f->next = right->next) { -; f->next->prev = f; -; } else { -; /* This is now the last block */ -; _hlast = f; -; } -; } else { -; /* No merge, just set the link */ -; f->next = right; -; right->prev = f; -; } -; } else { -; f->next = 0; -; /* Special case: This is the new freelist end */ -; _hlast = f; -; } -; if (left) { -; /* Check if we must merge the block with the left one */ -; if ((unsigned) f == ((unsigned) left) + left->size) { -; /* Merge with the left block */ -; left->size += f->size; -; if (left->next = f->next) { -; left->next->prev = left; -; } else { -; /* This is now the last block */ -; _hlast = left; -; } -; } else { -; /* No merge, just set the link */ -; left->next = f; -; f->prev = left; -; } -; } else { -; f->prev = 0; -; /* Special case: This is the new freelist start */ -; _hfirst = f; -; } -; } +; /* Ok, the current block must be inserted between left and right (but +; * beware: one of the two may be zero!). Also check for the condition +; * that we have to merge two or three blocks. +; */ +; if (right) { +; /* Check if we must merge the block with the right one */ +; if (((unsigned) f) + size == (unsigned) right) { +; /* Merge with the right block */ +; f->size += right->size; +; if (f->next = right->next) { +; f->next->prev = f; +; } else { +; /* This is now the last block */ +; _hlast = f; +; } +; } else { +; /* No merge, just set the link */ +; f->next = right; +; right->prev = f; +; } +; } else { +; f->next = 0; +; /* Special case: This is the new freelist end */ +; _hlast = f; +; } +; if (left) { +; /* Check if we must merge the block with the left one */ +; if ((unsigned) f == ((unsigned) left) + left->size) { +; /* Merge with the left block */ +; left->size += f->size; +; if (left->next = f->next) { +; left->next->prev = left; +; } else { +; /* This is now the last block */ +; _hlast = left; +; } +; } else { +; /* No merge, just set the link */ +; left->next = f; +; f->prev = left; +; } +; } else { +; f->prev = 0; +; /* Special case: This is the new freelist start */ +; _hfirst = f; +; } +; } ; } ; } ; @@ -283,30 +283,30 @@ _free: sta ptr2 ; Check if the free list is empty, storing _hfirst into ptr3 for later heapadd: - lda __heapfirst - sta ptr3 - lda __heapfirst+1 - sta ptr3+1 - ora ptr3 - bne SearchFreeList + lda __heapfirst + sta ptr3 + lda __heapfirst+1 + sta ptr3+1 + ora ptr3 + bne SearchFreeList ; The free list is empty, so this is the first and only block. A contains ; zero if we come here. - ldy #freeblock::next-1 -@L2: iny ; f->next = f->prev = 0; - sta (ptr2),y - cpy #freeblock::prev+1 ; Done? - bne @L2 + ldy #freeblock::next-1 +@L2: iny ; f->next = f->prev = 0; + sta (ptr2),y + cpy #freeblock::prev+1 ; Done? + bne @L2 - lda ptr2 - ldx ptr2+1 - sta __heapfirst - stx __heapfirst+1 ; _heapfirst = f; - sta __heaplast - stx __heaplast+1 ; _heaplast = f; + lda ptr2 + ldx ptr2+1 + sta __heapfirst + stx __heapfirst+1 ; _heapfirst = f; + sta __heaplast + stx __heaplast+1 ; _heaplast = f; - rts ; Done + rts ; Done ; We have to search the free list. As we are doing so, check if it is possible ; to combine this block with another, already existing block. Beware: The @@ -316,225 +316,225 @@ heapadd: ; ptr3) is not zero on entry. SearchFreeList: - lda #0 - sta ptr4 - sta ptr4+1 ; left = 0; - ldy #freeblock::next+1 - ldx ptr3 + lda #0 + sta ptr4 + sta ptr4+1 ; left = 0; + ldy #freeblock::next+1 + ldx ptr3 -@Loop: lda ptr3+1 ; High byte of right - cmp ptr2+1 - bne @L1 - cpx ptr2 - beq @L2 -@L1: bcs CheckRightMerge +@Loop: lda ptr3+1 ; High byte of right + cmp ptr2+1 + bne @L1 + cpx ptr2 + beq @L2 +@L1: bcs CheckRightMerge -@L2: stx ptr4 ; left = right; - sta ptr4+1 +@L2: stx ptr4 ; left = right; + sta ptr4+1 - dey ; Points to next - lda (ptr3),y ; right = right->next; - tax - iny ; Points to next+1 - lda (ptr3),y - stx ptr3 - sta ptr3+1 - ora ptr3 - bne @Loop + dey ; Points to next + lda (ptr3),y ; right = right->next; + tax + iny ; Points to next+1 + lda (ptr3),y + stx ptr3 + sta ptr3+1 + ora ptr3 + bne @Loop ; If we come here, the right pointer is zero, so we don't need to check for ; a merge. The new block is the new freelist end. ; A is zero when we come here, Y points to next+1 - sta (ptr2),y ; Clear high byte of f->next - dey - sta (ptr2),y ; Clear low byte of f->next + sta (ptr2),y ; Clear high byte of f->next + dey + sta (ptr2),y ; Clear low byte of f->next - lda ptr2 ; _heaplast = f; - sta __heaplast - lda ptr2+1 - sta __heaplast+1 + lda ptr2 ; _heaplast = f; + sta __heaplast + lda ptr2+1 + sta __heaplast+1 ; Since we have checked the case that the freelist is empty before, if the ; right pointer is NULL, the left *cannot* be NULL here. So skip the ; pointer check and jump right to the left block merge - jmp CheckLeftMerge2 + jmp CheckLeftMerge2 ; The given block must be inserted between left and right, and right is not ; zero. CheckRightMerge: - lda ptr2 - add ptr1 ; f + size - tax - lda ptr2+1 - adc ptr1+1 + lda ptr2 + add ptr1 ; f + size + tax + lda ptr2+1 + adc ptr1+1 - cpx ptr3 - bne NoRightMerge - cmp ptr3+1 - bne NoRightMerge + cpx ptr3 + bne NoRightMerge + cmp ptr3+1 + bne NoRightMerge ; Merge with the right block. Do f->size += right->size; - ldy #freeblock::size - lda ptr1 - add (ptr3),y - sta (ptr2),y - iny ; Points to size+1 - lda ptr1+1 - adc (ptr3),y - sta (ptr2),y + ldy #freeblock::size + lda ptr1 + add (ptr3),y + sta (ptr2),y + iny ; Points to size+1 + lda ptr1+1 + adc (ptr3),y + sta (ptr2),y ; Set f->next = right->next and remember f->next in ptr1 (we don't need the ; size stored there any longer) - iny ; Points to next - lda (ptr3),y ; Low byte of right->next - sta (ptr2),y ; Store to low byte of f->next - sta ptr1 - iny ; Points to next+1 - lda (ptr3),y ; High byte of right->next - sta (ptr2),y ; Store to high byte of f->next - sta ptr1+1 - ora ptr1 - beq @L1 ; Jump if f->next zero + iny ; Points to next + lda (ptr3),y ; Low byte of right->next + sta (ptr2),y ; Store to low byte of f->next + sta ptr1 + iny ; Points to next+1 + lda (ptr3),y ; High byte of right->next + sta (ptr2),y ; Store to high byte of f->next + sta ptr1+1 + ora ptr1 + beq @L1 ; Jump if f->next zero ; f->next->prev = f; - iny ; Points to prev - lda ptr2 ; Low byte of f - sta (ptr1),y ; Low byte of f->next->prev - iny ; Points to prev+1 - lda ptr2+1 ; High byte of f - sta (ptr1),y ; High byte of f->next->prev - jmp CheckLeftMerge ; Done + iny ; Points to prev + lda ptr2 ; Low byte of f + sta (ptr1),y ; Low byte of f->next->prev + iny ; Points to prev+1 + lda ptr2+1 ; High byte of f + sta (ptr1),y ; High byte of f->next->prev + jmp CheckLeftMerge ; Done ; f->next is zero, this is now the last block -@L1: lda ptr2 ; _heaplast = f; - sta __heaplast - lda ptr2+1 - sta __heaplast+1 - jmp CheckLeftMerge +@L1: lda ptr2 ; _heaplast = f; + sta __heaplast + lda ptr2+1 + sta __heaplast+1 + jmp CheckLeftMerge ; No right merge, just set the link. NoRightMerge: - ldy #freeblock::next ; f->next = right; - lda ptr3 - sta (ptr2),y - iny ; Points to next+1 - lda ptr3+1 - sta (ptr2),y + ldy #freeblock::next ; f->next = right; + lda ptr3 + sta (ptr2),y + iny ; Points to next+1 + lda ptr3+1 + sta (ptr2),y - iny ; Points to prev - lda ptr2 ; right->prev = f; - sta (ptr3),y - iny ; Points to prev+1 - lda ptr2+1 - sta (ptr3),y + iny ; Points to prev + lda ptr2 ; right->prev = f; + sta (ptr3),y + iny ; Points to prev+1 + lda ptr2+1 + sta (ptr3),y ; Check if the left pointer is zero CheckLeftMerge: - lda ptr4 ; left == NULL? - ora ptr4+1 - bne CheckLeftMerge2 ; Jump if there is a left block + lda ptr4 ; left == NULL? + ora ptr4+1 + bne CheckLeftMerge2 ; Jump if there is a left block ; We don't have a left block, so f is actually the new freelist start - ldy #freeblock::prev - sta (ptr2),y ; f->prev = 0; - iny - sta (ptr2),y + ldy #freeblock::prev + sta (ptr2),y ; f->prev = 0; + iny + sta (ptr2),y - lda ptr2 ; _heapfirst = f; - sta __heapfirst - lda ptr2+1 - sta __heapfirst+1 + lda ptr2 ; _heapfirst = f; + sta __heapfirst + lda ptr2+1 + sta __heapfirst+1 - rts ; Done + rts ; Done ; Check if the left block is adjacent to the following one CheckLeftMerge2: - ldy #freeblock::size ; Calculate left + left->size - lda (ptr4),y ; Low byte of left->size - add ptr4 - tax - iny ; Points to size+1 - lda (ptr4),y ; High byte of left->size - adc ptr4+1 + ldy #freeblock::size ; Calculate left + left->size + lda (ptr4),y ; Low byte of left->size + add ptr4 + tax + iny ; Points to size+1 + lda (ptr4),y ; High byte of left->size + adc ptr4+1 - cpx ptr2 - bne NoLeftMerge - cmp ptr2+1 - bne NoLeftMerge ; Jump if blocks not adjacent + cpx ptr2 + bne NoLeftMerge + cmp ptr2+1 + bne NoLeftMerge ; Jump if blocks not adjacent ; Merge with the left block. Do left->size += f->size; - dey ; Points to size - lda (ptr4),y - add (ptr2),y - sta (ptr4),y - iny ; Points to size+1 - lda (ptr4),y - adc (ptr2),y - sta (ptr4),y + dey ; Points to size + lda (ptr4),y + add (ptr2),y + sta (ptr4),y + iny ; Points to size+1 + lda (ptr4),y + adc (ptr2),y + sta (ptr4),y ; Set left->next = f->next and remember left->next in ptr1. - iny ; Points to next - lda (ptr2),y ; Low byte of f->next - sta (ptr4),y - sta ptr1 - iny ; Points to next+1 - lda (ptr2),y ; High byte of f->next - sta (ptr4),y - sta ptr1+1 - ora ptr1 ; left->next == NULL? - beq @L1 + iny ; Points to next + lda (ptr2),y ; Low byte of f->next + sta (ptr4),y + sta ptr1 + iny ; Points to next+1 + lda (ptr2),y ; High byte of f->next + sta (ptr4),y + sta ptr1+1 + ora ptr1 ; left->next == NULL? + beq @L1 ; Do left->next->prev = left - iny ; Points to prev - lda ptr4 ; Low byte of left - sta (ptr1),y - iny - lda ptr4+1 ; High byte of left - sta (ptr1),y - rts ; Done + iny ; Points to prev + lda ptr4 ; Low byte of left + sta (ptr1),y + iny + lda ptr4+1 ; High byte of left + sta (ptr1),y + rts ; Done ; This is now the last block, do _heaplast = left -@L1: lda ptr4 - sta __heaplast - lda ptr4+1 - sta __heaplast+1 - rts ; Done +@L1: lda ptr4 + sta __heaplast + lda ptr4+1 + sta __heaplast+1 + rts ; Done ; No merge of the left block, just set the link. Y points to size+1 if ; we come here. Do left->next = f. NoLeftMerge: - iny ; Points to next - lda ptr2 ; Low byte of left - sta (ptr4),y - iny - lda ptr2+1 ; High byte of left - sta (ptr4),y + iny ; Points to next + lda ptr2 ; Low byte of left + sta (ptr4),y + iny + lda ptr2+1 ; High byte of left + sta (ptr4),y ; Do f->prev = left - iny ; Points to prev - lda ptr4 - sta (ptr2),y - iny - lda ptr4+1 - sta (ptr2),y - rts ; Done + iny ; Points to prev + lda ptr4 + sta (ptr2),y + iny + lda ptr4+1 + sta (ptr2),y + rts ; Done diff --git a/libsrc/common/freopen.c b/libsrc/common/freopen.c index e03cd9868..3c4d92ee0 100644 --- a/libsrc/common/freopen.c +++ b/libsrc/common/freopen.c @@ -14,7 +14,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -23,7 +23,7 @@ FILE* __fastcall__ freopen (const char* name, const char* mode, FILE* f) { /* Check if the file is open, if so, close it */ if ((f->f_flags & _FOPEN) == 0) { - /* File is not open */ + /* File is not open */ return (FILE*) _seterrno (EINVAL); /* File not input */ } @@ -32,7 +32,7 @@ FILE* __fastcall__ freopen (const char* name, const char* mode, FILE* f) */ if (close (f->f_fd) < 0) { /* An error occured, errno is already set */ - return 0; + return 0; } /* Open the file and return the descriptor */ diff --git a/libsrc/common/fscanf.s b/libsrc/common/fscanf.s index 2411f742c..e519fbdd8 100644 --- a/libsrc/common/fscanf.s +++ b/libsrc/common/fscanf.s @@ -4,18 +4,18 @@ ; Ullrich von Bassewitz, 2004-11-28 ; - .export _fscanf - .import addysp, decsp4, _vfscanf - .importzp sp, ptr1 + .export _fscanf + .import addysp, decsp4, _vfscanf + .importzp sp, ptr1 - .macpack generic + .macpack generic ; ---------------------------------------------------------------------------- ; Data .bss -ParamSize: .res 1 ; Number of parameter bytes +ParamSize: .res 1 ; Number of parameter bytes ; ---------------------------------------------------------------------------- ; int fscanf (FILE* f, const char* format, ...) @@ -36,7 +36,7 @@ ParamSize: .res 1 ; Number of parameter bytes .code _fscanf: - sty ParamSize ; Number of param bytes passed in Y + sty ParamSize ; Number of param bytes passed in Y ; We have to push f and format, both in the order they already have on stack. ; To make this somewhat more efficient, we will create space on the stack and @@ -45,37 +45,37 @@ _fscanf: ; of the fixed arguments, this will allow us to calculate the pointer to the ; fixed size arguments easier (they're just ParamSize bytes away). - jsr decsp4 + jsr decsp4 ; Calculate a pointer to the Format argument - lda ParamSize - add sp - sta ptr1 - ldx sp+1 - bcc @L1 - inx -@L1: stx ptr1+1 + lda ParamSize + add sp + sta ptr1 + ldx sp+1 + bcc @L1 + inx +@L1: stx ptr1+1 ; Now copy both, f and format - ldy #4-1 -@L2: lda (ptr1),y - sta (sp),y - dey - bpl @L2 + ldy #4-1 +@L2: lda (ptr1),y + sta (sp),y + dey + bpl @L2 ; Load va_list (last and __fastcall__ parameter to vfscanf) - lda ptr1 - ldx ptr1+1 + lda ptr1 + ldx ptr1+1 ; Call vfscanf - jsr _vfscanf + jsr _vfscanf ; Cleanup the stack. We will return what we got from vfscanf - ldy ParamSize - jmp addysp + ldy ParamSize + jmp addysp diff --git a/libsrc/common/fseek.c b/libsrc/common/fseek.c index 0616fc101..bd47383fd 100644 --- a/libsrc/common/fseek.c +++ b/libsrc/common/fseek.c @@ -15,7 +15,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/libsrc/common/fsetpos.c b/libsrc/common/fsetpos.c index 6194a109c..9f57ca415 100644 --- a/libsrc/common/fsetpos.c +++ b/libsrc/common/fsetpos.c @@ -11,7 +11,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/libsrc/common/ftell.c b/libsrc/common/ftell.c index 9882cfc05..efc2e7ce0 100644 --- a/libsrc/common/ftell.c +++ b/libsrc/common/ftell.c @@ -15,7 +15,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/libsrc/common/fwrite.s b/libsrc/common/fwrite.s index 37cf81015..dc0bad1b6 100644 --- a/libsrc/common/fwrite.s +++ b/libsrc/common/fwrite.s @@ -24,30 +24,30 @@ ; Save file and place it into ptr1 - sta file - sta ptr1 - stx file+1 - stx ptr1+1 + sta file + sta ptr1 + stx file+1 + stx ptr1+1 ; Check if the file is open - ldy #_FILE::f_flags - lda (ptr1),y - and #_FOPEN ; Is the file open? - bne @L2 ; Branch if yes + ldy #_FILE::f_flags + lda (ptr1),y + and #_FOPEN ; Is the file open? + bne @L2 ; Branch if yes ; File not open -@L1: lda #EBADF +@L1: lda #EBADF jsr __seterrno ; Returns with A = 0 tax ; A = X = 0 jmp incsp6 ; Check if the stream is in an error state -@L2: lda (ptr1),y ; get file->f_flags again - and #_FERROR - bne @L1 +@L2: lda (ptr1),y ; get file->f_flags again + and #_FERROR + bne @L1 ; Build the stackframe for write() @@ -122,5 +122,5 @@ ; Data .bss -file: .res 2 +file: .res 2 diff --git a/libsrc/common/getchar.c b/libsrc/common/getchar.c index 5c80b9b36..363be0200 100644 --- a/libsrc/common/getchar.c +++ b/libsrc/common/getchar.c @@ -7,12 +7,12 @@ #include -#undef getchar /* This is usually declared as a macro */ +#undef getchar /* This is usually declared as a macro */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/libsrc/common/getcpu.s b/libsrc/common/getcpu.s index a65aac376..b7954f52f 100644 --- a/libsrc/common/getcpu.s +++ b/libsrc/common/getcpu.s @@ -4,7 +4,7 @@ ; unsigned char getcpu (void); ; - .export _getcpu + .export _getcpu ; --------------------------------------------------------------------------- ; Subroutine to detect an 816. Returns @@ -18,20 +18,20 @@ ; of the 6502, but all of them interpret unknown opcodes as NOP so this is ; just what we want. -.p816 ; Enable 65816 instructions +.p816 ; Enable 65816 instructions _getcpu: - lda #0 - inc a ; .byte $1A - cmp #1 - bcc @L9 + lda #0 + inc a ; .byte $1A + cmp #1 + bcc @L9 ; This is at least a 65C02, check for a 65816 - xba ; .byte $eb, put $01 in B accu - dec a ; .byte $3a, A=$00 if 65C02 - xba ; .byte $eb, get $01 back if 65816 - inc a ; .byte $1a, make $01/$02 -@L9: ldx #0 ; Load high byte of word - rts + xba ; .byte $eb, put $01 in B accu + dec a ; .byte $3a, A=$00 if 65C02 + xba ; .byte $eb, get $01 back if 65816 + inc a ; .byte $1a, make $01/$02 +@L9: ldx #0 ; Load high byte of word + rts diff --git a/libsrc/common/gets.c b/libsrc/common/gets.c index 66690bab3..4da352430 100644 --- a/libsrc/common/gets.c +++ b/libsrc/common/gets.c @@ -12,7 +12,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -25,24 +25,24 @@ char* __fastcall__ gets (char* s) while (1) { - /* Get next character */ - if ((c = fgetc (stdin)) == EOF) { - /* Error or EOF */ - *p = '\0'; - if (stdin->f_flags & _FERROR) { - /* ERROR */ - return 0; - } else { - /* EOF */ - if (i) { - return s; - } else { - return 0; - } - } - } + /* Get next character */ + if ((c = fgetc (stdin)) == EOF) { + /* Error or EOF */ + *p = '\0'; + if (stdin->f_flags & _FERROR) { + /* ERROR */ + return 0; + } else { + /* EOF */ + if (i) { + return s; + } else { + return 0; + } + } + } - /* One char more. Newline ends the input */ + /* One char more. Newline ends the input */ if ((char) c == '\n') { *p = '\0'; break; diff --git a/libsrc/common/interrupt.s b/libsrc/common/interrupt.s index c7d0d896c..e1d53d6dc 100644 --- a/libsrc/common/interrupt.s +++ b/libsrc/common/interrupt.s @@ -5,102 +5,102 @@ ; void reset_irq (void); ; - .export _set_irq, _reset_irq - .interruptor clevel_irq, 1 ; Export as low priority IRQ handler - .import popax + .export _set_irq, _reset_irq + .interruptor clevel_irq, 1 ; Export as low priority IRQ handler + .import popax .importzp __ZP_START__ - .include "zeropage.inc" + .include "zeropage.inc" - .macpack generic + .macpack generic ; --------------------------------------------------------------------------- .data -irqvec: jmp $00FF ; Patched at runtime +irqvec: jmp $00FF ; Patched at runtime ; --------------------------------------------------------------------------- .bss -irqsp: .res 2 +irqsp: .res 2 zpsave: .res zpsavespace ; --------------------------------------------------------------------------- -.proc _set_irq +.proc _set_irq - ; Keep clevel_irq from being called right now - sei + ; Keep clevel_irq from being called right now + sei - ; Set irq stack pointer to stack_addr + stack_size - sta irqsp - stx irqsp+1 - jsr popax - add irqsp - sta irqsp - txa - adc irqsp+1 - sta irqsp+1 + ; Set irq stack pointer to stack_addr + stack_size + sta irqsp + stx irqsp+1 + jsr popax + add irqsp + sta irqsp + txa + adc irqsp+1 + sta irqsp+1 - ; Set irq vector to irq_handler - jsr popax - sta irqvec+1 - stx irqvec+2 ; Set the user vector + ; Set irq vector to irq_handler + jsr popax + sta irqvec+1 + stx irqvec+2 ; Set the user vector - ; Restore interrupt requests and return - cli - rts + ; Restore interrupt requests and return + cli + rts .endproc -.proc _reset_irq +.proc _reset_irq - lda #$00 - sta irqvec+2 ; High byte is enough - rts + lda #$00 + sta irqvec+2 ; High byte is enough + rts .endproc -.proc clevel_irq +.proc clevel_irq - ; Is C level interrupt request vector set? - lda irqvec+2 ; High byte is enough - bne @L1 - clc ; Interrupt not handled - rts + ; Is C level interrupt request vector set? + lda irqvec+2 ; High byte is enough + bne @L1 + clc ; Interrupt not handled + rts - ; Save our zero page locations -@L1: ldx #.sizeof(::zpsave)-1 + ; Save our zero page locations +@L1: ldx #.sizeof(::zpsave)-1 @L2: lda __ZP_START__,x - sta zpsave,x - dex - bpl @L2 + sta zpsave,x + dex + bpl @L2 - ; Set C level interrupt stack - lda irqsp - ldx irqsp+1 - sta sp - stx sp+1 + ; Set C level interrupt stack + lda irqsp + ldx irqsp+1 + sta sp + stx sp+1 - ; Call C level interrupt request handler - jsr irqvec + ; Call C level interrupt request handler + jsr irqvec - ; Copy back our zero page content - ldx #.sizeof(::zpsave)-1 + ; Copy back our zero page content + ldx #.sizeof(::zpsave)-1 @L3: ldy zpsave,x - sty __ZP_START__,x - dex - bpl @L3 + sty __ZP_START__,x + dex + bpl @L3 - ; Mark interrupt handled / not handled and return - lsr - rts + ; Mark interrupt handled / not handled and return + lsr + rts .endproc diff --git a/libsrc/common/isalnum.s b/libsrc/common/isalnum.s index 26fd7a24c..33497a30c 100644 --- a/libsrc/common/isalnum.s +++ b/libsrc/common/isalnum.s @@ -4,18 +4,18 @@ ; int isalnum (int c); ; - .export _isalnum - .include "ctype.inc" + .export _isalnum + .include "ctype.inc" _isalnum: - cpx #$00 ; Char range ok? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #CT_ALNUM ; Mask character/digit bits - rts + cpx #$00 ; Char range ok? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #CT_ALNUM ; Mask character/digit bits + rts -@L1: lda #$00 ; Return false - tax - rts +@L1: lda #$00 ; Return false + tax + rts diff --git a/libsrc/common/isalpha.s b/libsrc/common/isalpha.s index 093b3d006..2ab9bf269 100644 --- a/libsrc/common/isalpha.s +++ b/libsrc/common/isalpha.s @@ -4,18 +4,18 @@ ; int isalpha (int c); ; - .export _isalpha - .include "ctype.inc" + .export _isalpha + .include "ctype.inc" _isalpha: - cpx #$00 ; Char range ok? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #CT_ALPHA ; Mask character bits - rts + cpx #$00 ; Char range ok? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #CT_ALPHA ; Mask character bits + rts -@L1: lda #$00 ; Return false - tax - rts +@L1: lda #$00 ; Return false + tax + rts diff --git a/libsrc/common/isblank.s b/libsrc/common/isblank.s index 6da645a92..6babe8853 100644 --- a/libsrc/common/isblank.s +++ b/libsrc/common/isblank.s @@ -6,18 +6,18 @@ ; cc65 (and GNU) extension. ; - .export _isblank - .include "ctype.inc" + .export _isblank + .include "ctype.inc" _isblank: - cpx #$00 ; Char range ok? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #CT_SPACE_TAB ; Mask blank bit - rts + cpx #$00 ; Char range ok? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #CT_SPACE_TAB ; Mask blank bit + rts -@L1: lda #$00 ; Return false - tax - rts +@L1: lda #$00 ; Return false + tax + rts diff --git a/libsrc/common/iscntrl.s b/libsrc/common/iscntrl.s index d94fddc27..728716450 100644 --- a/libsrc/common/iscntrl.s +++ b/libsrc/common/iscntrl.s @@ -4,18 +4,18 @@ ; int iscntrl (int c); ; - .export _iscntrl - .include "ctype.inc" + .export _iscntrl + .include "ctype.inc" _iscntrl: - cpx #$00 ; Char range ok? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #CT_CTRL ; Mask control character bit - rts + cpx #$00 ; Char range ok? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #CT_CTRL ; Mask control character bit + rts -@L1: lda #$00 ; Return false - tax - rts +@L1: lda #$00 ; Return false + tax + rts diff --git a/libsrc/common/isdigit.s b/libsrc/common/isdigit.s index 61dd637bb..2972c8941 100644 --- a/libsrc/common/isdigit.s +++ b/libsrc/common/isdigit.s @@ -4,18 +4,18 @@ ; int isdigit (int c); ; - .export _isdigit - .include "ctype.inc" + .export _isdigit + .include "ctype.inc" _isdigit: - cpx #$00 ; Char range ok? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #CT_DIGIT ; Mask digit bit - rts + cpx #$00 ; Char range ok? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #CT_DIGIT ; Mask digit bit + rts -@L1: lda #$00 ; Return false - tax - rts +@L1: lda #$00 ; Return false + tax + rts diff --git a/libsrc/common/isgraph.s b/libsrc/common/isgraph.s index 504cbd180..7b1daa62e 100644 --- a/libsrc/common/isgraph.s +++ b/libsrc/common/isgraph.s @@ -5,21 +5,21 @@ ; int isgraph (int c); ; - .export _isgraph - .include "ctype.inc" + .export _isgraph + .include "ctype.inc" _isgraph: - cpx #>0 ; Char range OK? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #CT_CTRL_SPACE ; Mask character bits - cmp #1 ; If false, then set "borrow" flag - lda #0 - sbc #0 ; Invert logic - rts ; Return NOT control and NOT space + cpx #>0 ; Char range OK? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #CT_CTRL_SPACE ; Mask character bits + cmp #1 ; If false, then set "borrow" flag + lda #0 + sbc #0 ; Invert logic + rts ; Return NOT control and NOT space -@L1: lda #<0 ; Return false - tax - rts +@L1: lda #<0 ; Return false + tax + rts diff --git a/libsrc/common/islower.s b/libsrc/common/islower.s index 0078366b8..32e00fbd6 100644 --- a/libsrc/common/islower.s +++ b/libsrc/common/islower.s @@ -4,18 +4,18 @@ ; int islower (int c); ; - .export _islower - .include "ctype.inc" + .export _islower + .include "ctype.inc" _islower: - cpx #$00 ; Char range ok? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #CT_LOWER ; Mask lower char bit - rts + cpx #$00 ; Char range ok? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #CT_LOWER ; Mask lower char bit + rts -@L1: lda #$00 ; Return false - tax - rts +@L1: lda #$00 ; Return false + tax + rts diff --git a/libsrc/common/isprint.s b/libsrc/common/isprint.s index 956b54b88..1511753fd 100644 --- a/libsrc/common/isprint.s +++ b/libsrc/common/isprint.s @@ -4,19 +4,19 @@ ; int isprint (int c); ; - .export _isprint - .include "ctype.inc" + .export _isprint + .include "ctype.inc" _isprint: - cpx #$00 ; Char range ok? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - eor #CT_CTRL ; NOT a control char - and #CT_CTRL ; Mask control char bit - rts + cpx #$00 ; Char range ok? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + eor #CT_CTRL ; NOT a control char + and #CT_CTRL ; Mask control char bit + rts -@L1: lda #$00 ; Return false - tax - rts +@L1: lda #$00 ; Return false + tax + rts diff --git a/libsrc/common/ispunct.s b/libsrc/common/ispunct.s index 8b1240541..bf31efb1a 100644 --- a/libsrc/common/ispunct.s +++ b/libsrc/common/ispunct.s @@ -5,21 +5,21 @@ ; int ispunct (int c); ; - .export _ispunct - .include "ctype.inc" + .export _ispunct + .include "ctype.inc" _ispunct: - cpx #>0 ; Char range OK? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #CT_NOT_PUNCT ; Mask relevant bits - cmp #1 ; If false, then set "borrow" flag - lda #0 - sbc #0 ; Invert logic - rts ; Return NOT (space | control | digit | alpha) + cpx #>0 ; Char range OK? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #CT_NOT_PUNCT ; Mask relevant bits + cmp #1 ; If false, then set "borrow" flag + lda #0 + sbc #0 ; Invert logic + rts ; Return NOT (space | control | digit | alpha) -@L1: lda #<0 ; Return false - tax - rts +@L1: lda #<0 ; Return false + tax + rts diff --git a/libsrc/common/isspace.s b/libsrc/common/isspace.s index 67530c95e..64849f7f7 100644 --- a/libsrc/common/isspace.s +++ b/libsrc/common/isspace.s @@ -4,18 +4,18 @@ ; int isspace (int c); ; - .export _isspace - .include "ctype.inc" + .export _isspace + .include "ctype.inc" _isspace: - cpx #$00 ; Char range ok? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #(CT_SPACE | CT_OTHER_WS) ; Mask space bits - rts + cpx #$00 ; Char range ok? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #(CT_SPACE | CT_OTHER_WS) ; Mask space bits + rts -@L1: lda #$00 ; Return false - tax - rts +@L1: lda #$00 ; Return false + tax + rts diff --git a/libsrc/common/isupper.s b/libsrc/common/isupper.s index b9d53a614..698983ec8 100644 --- a/libsrc/common/isupper.s +++ b/libsrc/common/isupper.s @@ -4,18 +4,18 @@ ; int isupper (int c); ; - .export _isupper - .include "ctype.inc" + .export _isupper + .include "ctype.inc" _isupper: - cpx #$00 ; Char range ok? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #CT_UPPER ; Mask upper char bit - rts + cpx #$00 ; Char range ok? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #CT_UPPER ; Mask upper char bit + rts -@L1: lda #$00 ; Return false - tax - rts +@L1: lda #$00 ; Return false + tax + rts diff --git a/libsrc/common/isxdigit.s b/libsrc/common/isxdigit.s index 50146e82e..36f86ef19 100644 --- a/libsrc/common/isxdigit.s +++ b/libsrc/common/isxdigit.s @@ -4,18 +4,18 @@ ; int isxdigit (int c); ; - .export _isxdigit - .include "ctype.inc" + .export _isxdigit + .include "ctype.inc" _isxdigit: - cpx #$00 ; Char range ok? - bne @L1 ; Jump if no - tay - lda __ctype,y ; Get character classification - and #CT_XDIGIT ; Mask xdigit bit - rts + cpx #$00 ; Char range ok? + bne @L1 ; Jump if no + tay + lda __ctype,y ; Get character classification + and #CT_XDIGIT ; Mask xdigit bit + rts -@L1: lda #$00 ; Return false - tax - rts +@L1: lda #$00 ; Return false + tax + rts diff --git a/libsrc/common/itoa.s b/libsrc/common/itoa.s index 37544c434..176bc2ddd 100644 --- a/libsrc/common/itoa.s +++ b/libsrc/common/itoa.s @@ -5,131 +5,131 @@ ; char* utoa (unsigned value, char* s, int radix); ; - .export _itoa, _utoa - .import addysp1 - .import __hextab - .importzp sp, sreg, ptr2, ptr3, tmp1 + .export _itoa, _utoa + .import addysp1 + .import __hextab + .importzp sp, sreg, ptr2, ptr3, tmp1 .rodata specval: - .byte '-', '3', '2', '7', '6', '8', 0 + .byte '-', '3', '2', '7', '6', '8', 0 .code ; ; Common subroutine to pop the parameters and put them into core ; -dopop: sta tmp1 ; will loose high byte - ldy #0 - lda (sp),y - sta ptr2 - sta ptr3 - iny - lda (sp),y - sta ptr2+1 - sta ptr3+1 - iny - lda (sp),y - sta sreg - iny - lda (sp),y - sta sreg+1 - jmp addysp1 ; Bump stack pointer +dopop: sta tmp1 ; will loose high byte + ldy #0 + lda (sp),y + sta ptr2 + sta ptr3 + iny + lda (sp),y + sta ptr2+1 + sta ptr3+1 + iny + lda (sp),y + sta sreg + iny + lda (sp),y + sta sreg+1 + jmp addysp1 ; Bump stack pointer ; ; itoa ; -_itoa: jsr dopop ; pop the arguments +_itoa: jsr dopop ; pop the arguments ; We must handle $8000 in a special way, since it is the only negative ; number that has no positive 16-bit counterpart - ldy tmp1 ; get radix - cpy #10 - bne utoa - cmp #$00 - bne L2 - cpx #$80 - bne L2 + ldy tmp1 ; get radix + cpy #10 + bne utoa + cmp #$00 + bne L2 + cpx #$80 + bne L2 - ldy #6 -L1: lda specval,y ; copy -32768 - sta (ptr2),y - dey - bpl L1 - jmp L10 + ldy #6 +L1: lda specval,y ; copy -32768 + sta (ptr2),y + dey + bpl L1 + jmp L10 ; Check if the value is negative. If so, write a - sign and negate the ; number. -L2: lda sreg+1 ; get high byte - bpl utoa - lda #'-' - ldy #0 - sta (ptr2),y ; store sign - inc ptr2 - bne L3 - inc ptr2+1 +L2: lda sreg+1 ; get high byte + bpl utoa + lda #'-' + ldy #0 + sta (ptr2),y ; store sign + inc ptr2 + bne L3 + inc ptr2+1 -L3: lda sreg - eor #$FF - clc - adc #$01 - sta sreg - lda sreg+1 - eor #$FF - adc #$00 - sta sreg+1 - jmp utoa +L3: lda sreg + eor #$FF + clc + adc #$01 + sta sreg + lda sreg+1 + eor #$FF + adc #$00 + sta sreg+1 + jmp utoa ; ; utoa ; -_utoa: jsr dopop ; pop the arguments +_utoa: jsr dopop ; pop the arguments ; Convert to string by dividing and push the result onto the stack -utoa: lda #$00 - pha ; sentinel +utoa: lda #$00 + pha ; sentinel ; Divide sreg/tmp1 -> sreg, remainder in a -L5: ldy #16 ; 16 bit - lda #0 ; remainder -L6: asl sreg - rol sreg+1 - rol a - cmp tmp1 - bcc L7 - sbc tmp1 - inc sreg -L7: dey - bne L6 +L5: ldy #16 ; 16 bit + lda #0 ; remainder +L6: asl sreg + rol sreg+1 + rol a + cmp tmp1 + bcc L7 + sbc tmp1 + inc sreg +L7: dey + bne L6 - tay ; get remainder into y - lda __hextab,y ; get hex character - pha ; save char value on stack + tay ; get remainder into y + lda __hextab,y ; get hex character + pha ; save char value on stack - lda sreg - ora sreg+1 - bne L5 + lda sreg + ora sreg+1 + bne L5 ; Get the characters from the stack into the string - ldy #0 -L9: pla - sta (ptr2),y - beq L10 ; jump if sentinel - iny - bne L9 ; jump always + ldy #0 +L9: pla + sta (ptr2),y + beq L10 ; jump if sentinel + iny + bne L9 ; jump always ; Done! Return the target string -L10: lda ptr3 - ldx ptr3+1 - rts +L10: lda ptr3 + ldx ptr3+1 + rts diff --git a/libsrc/common/labs.s b/libsrc/common/labs.s index 753e9f99d..544ce9951 100644 --- a/libsrc/common/labs.s +++ b/libsrc/common/labs.s @@ -5,15 +5,15 @@ ; intmax_t __fastcall imaxabs (intmax_t val); ; - .export _labs, _imaxabs - .import negeax - .importzp sreg + .export _labs, _imaxabs + .import negeax + .importzp sreg _labs: _imaxabs: - ldy sreg+1 ; test hi byte - bpl L1 - jmp negeax ; Negate if negative -L1: rts + ldy sreg+1 ; test hi byte + bpl L1 + jmp negeax ; Negate if negative +L1: rts diff --git a/libsrc/common/locale.c b/libsrc/common/locale.c index f03a68e6f..3b9c7506a 100644 --- a/libsrc/common/locale.c +++ b/libsrc/common/locale.c @@ -12,7 +12,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -21,30 +21,30 @@ static char EmptyString [] = ""; static struct lconv lc = { - EmptyString, /* currency_symbol */ - ".", /* decimal_point */ - EmptyString, /* grouping */ - EmptyString, /* int_curr_symbol */ - EmptyString, /* mon_decimal_point */ - EmptyString, /* mon_grouping */ - EmptyString, /* mon_thousands_sep */ - EmptyString, /* negative_sign */ - EmptyString, /* positive_sign */ - EmptyString, /* thousands_sep */ - CHAR_MAX, /* frac_digits */ - CHAR_MAX, /* int_frac_digits */ - CHAR_MAX, /* n_cs_precedes */ - CHAR_MAX, /* n_sep_by_space */ - CHAR_MAX, /* n_sign_posn */ - CHAR_MAX, /* p_cs_precedes */ - CHAR_MAX, /* p_sep_by_space */ - CHAR_MAX, /* p_sign_posn */ + EmptyString, /* currency_symbol */ + ".", /* decimal_point */ + EmptyString, /* grouping */ + EmptyString, /* int_curr_symbol */ + EmptyString, /* mon_decimal_point */ + EmptyString, /* mon_grouping */ + EmptyString, /* mon_thousands_sep */ + EmptyString, /* negative_sign */ + EmptyString, /* positive_sign */ + EmptyString, /* thousands_sep */ + CHAR_MAX, /* frac_digits */ + CHAR_MAX, /* int_frac_digits */ + CHAR_MAX, /* n_cs_precedes */ + CHAR_MAX, /* n_sep_by_space */ + CHAR_MAX, /* n_sign_posn */ + CHAR_MAX, /* p_cs_precedes */ + CHAR_MAX, /* p_sep_by_space */ + CHAR_MAX, /* p_sign_posn */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -59,11 +59,11 @@ struct lconv* localeconv (void) char* __fastcall__ setlocale (int, const char* locale) { if (locale == 0 || (locale [0] == 'C' && locale [1] == '\0') || locale [0] == '\0') { - /* No change, or value already set, our locale is the "C" locale */ - return "C"; + /* No change, or value already set, our locale is the "C" locale */ + return "C"; } else { - /* Cannot set this one */ - return 0; + /* Cannot set this one */ + return 0; } } diff --git a/libsrc/common/longjmp.s b/libsrc/common/longjmp.s index 5941fbfae..a89f97fa0 100644 --- a/libsrc/common/longjmp.s +++ b/libsrc/common/longjmp.s @@ -4,49 +4,49 @@ ; void longjmp (jmp_buf buf, int retval); ; - .export _longjmp - .import popax - .importzp sp, ptr1, ptr2 + .export _longjmp + .import popax + .importzp sp, ptr1, ptr2 _longjmp: - sta ptr2 ; Save retval - stx ptr2+1 - ora ptr2+1 ; Check for 0 - bne @L1 - lda #1 ; 0 is illegal according to the standard... - sta ptr2 ; ... and must be replaced by 1 -@L1: jsr popax ; get buf - sta ptr1 - stx ptr1+1 - ldy #0 + sta ptr2 ; Save retval + stx ptr2+1 + ora ptr2+1 ; Check for 0 + bne @L1 + lda #1 ; 0 is illegal according to the standard... + sta ptr2 ; ... and must be replaced by 1 +@L1: jsr popax ; get buf + sta ptr1 + stx ptr1+1 + ldy #0 ; Get the old parameter stack - lda (ptr1),y - iny - sta sp - lda (ptr1),y - iny - sta sp+1 + lda (ptr1),y + iny + sta sp + lda (ptr1),y + iny + sta sp+1 ; Get the old stack pointer - lda (ptr1),y - iny - tax - txs + lda (ptr1),y + iny + tax + txs ; Get the return address and push it on the stack - lda (ptr1),y - iny - pha - lda (ptr1),y - pha + lda (ptr1),y + iny + pha + lda (ptr1),y + pha ; Load the return value and return to the caller - lda ptr2 - ldx ptr2+1 - rts + lda ptr2 + ldx ptr2+1 + rts diff --git a/libsrc/common/ltoa.s b/libsrc/common/ltoa.s index 65d6ca420..5dc215bd1 100644 --- a/libsrc/common/ltoa.s +++ b/libsrc/common/ltoa.s @@ -5,10 +5,10 @@ ; char* ultoa (unsigned long value, char* s, int radix); ; - .export _ltoa, _ultoa - .import popax - .import __hextab, __longminstr - .importzp sreg, ptr1, ptr2, ptr3, tmp1 + .export _ltoa, _ultoa + .import popax + .import __hextab, __longminstr + .importzp sreg, ptr1, ptr2, ptr3, tmp1 @@ -18,129 +18,129 @@ ; Common subroutine to pop the parameters and put them into core ; -dopop: sta tmp1 ; will loose high byte - jsr popax ; get s - sta ptr1 - stx ptr1+1 - sta sreg ; save for return - stx sreg+1 - jsr popax ; get low word of value - sta ptr2 - stx ptr2+1 - jsr popax ; get high word of value - sta ptr3 - stx ptr3+1 - rts +dopop: sta tmp1 ; will loose high byte + jsr popax ; get s + sta ptr1 + stx ptr1+1 + sta sreg ; save for return + stx sreg+1 + jsr popax ; get low word of value + sta ptr2 + stx ptr2+1 + jsr popax ; get high word of value + sta ptr3 + stx ptr3+1 + rts ; ; ltoa ; -_ltoa: jsr dopop ; pop the arguments +_ltoa: jsr dopop ; pop the arguments ; We must handle $80000000 in a special way, since it is the only negative ; number that has no positive 32-bit counterpart - ldx ptr3+1 ; get high byte - ldy tmp1 ; get radix - cpy #10 - bne ultoa - lda ptr3 - ora ptr2+1 - ora ptr2 - bne L2 - cpx #$80 - bne L2 + ldx ptr3+1 ; get high byte + ldy tmp1 ; get radix + cpy #10 + bne ultoa + lda ptr3 + ora ptr2+1 + ora ptr2 + bne L2 + cpx #$80 + bne L2 - ldy #11 -L1: lda __longminstr,y ; copy -2147483648 - sta (ptr1),y - dey - bpl L1 - jmp L10 + ldy #11 +L1: lda __longminstr,y ; copy -2147483648 + sta (ptr1),y + dey + bpl L1 + jmp L10 ; Check if the value is negative. If so, write a - sign and negate the ; number. -L2: txa ; get high byte - bpl ultoa - lda #'-' - ldy #0 - sta (ptr1),y ; store sign - inc ptr1 - bne L3 - inc ptr1+1 +L2: txa ; get high byte + bpl ultoa + lda #'-' + ldy #0 + sta (ptr1),y ; store sign + inc ptr1 + bne L3 + inc ptr1+1 -L3: lda ptr2 ; negate val - eor #$FF - clc - adc #$01 - sta ptr2 - lda ptr2+1 - eor #$FF - adc #$00 - sta ptr2+1 - lda ptr3 - eor #$FF - adc #$00 - sta ptr3 - lda ptr3+1 - eor #$FF - adc #$00 - sta ptr3+1 - jmp ultoa +L3: lda ptr2 ; negate val + eor #$FF + clc + adc #$01 + sta ptr2 + lda ptr2+1 + eor #$FF + adc #$00 + sta ptr2+1 + lda ptr3 + eor #$FF + adc #$00 + sta ptr3 + lda ptr3+1 + eor #$FF + adc #$00 + sta ptr3+1 + jmp ultoa ; ; utoa ; -_ultoa: jsr dopop ; pop the arguments +_ultoa: jsr dopop ; pop the arguments ; Convert to string by dividing and push the result onto the stack -ultoa: lda #$00 - pha ; sentinel +ultoa: lda #$00 + pha ; sentinel ; Divide val/tmp1 -> val, remainder in a -L5: ldy #32 ; 32 bit - lda #0 ; remainder -L6: asl ptr2 - rol ptr2+1 - rol ptr3 - rol ptr3+1 - rol a - cmp tmp1 - bcc L7 - sbc tmp1 - inc ptr2 -L7: dey - bne L6 +L5: ldy #32 ; 32 bit + lda #0 ; remainder +L6: asl ptr2 + rol ptr2+1 + rol ptr3 + rol ptr3+1 + rol a + cmp tmp1 + bcc L7 + sbc tmp1 + inc ptr2 +L7: dey + bne L6 - tay ; get remainder into y - lda __hextab,y ; get hex character - pha ; save char value on stack + tay ; get remainder into y + lda __hextab,y ; get hex character + pha ; save char value on stack - lda ptr2 - ora ptr2+1 - ora ptr3 - ora ptr3+1 - bne L5 + lda ptr2 + ora ptr2+1 + ora ptr3 + ora ptr3+1 + bne L5 ; Get the characters from the stack into the string - ldy #0 -L9: pla - sta (ptr1),y - beq L10 ; jump if sentinel - iny - bne L9 ; jump always + ldy #0 +L9: pla + sta (ptr1),y + beq L10 ; jump if sentinel + iny + bne L9 ; jump always ; Done! Return the target string -L10: lda sreg - ldx sreg+1 - rts +L10: lda sreg + ldx sreg+1 + rts diff --git a/libsrc/common/malloc.s b/libsrc/common/malloc.s index 0f22090bb..19add25a7 100644 --- a/libsrc/common/malloc.s +++ b/libsrc/common/malloc.s @@ -22,7 +22,7 @@ ; * up the size if needed. ; */ ; if (size == 0) { -; return 0; +; return 0; ; } ; size += HEAP_ADMIN_SPACE; ; if (size < sizeof (struct freeblock)) { @@ -67,14 +67,14 @@ ; } else { ; ; /* We must slice the block found. Cut off space from the upper -; * end, so we can leave the actual free block chain intact. -; */ +; * end, so we can leave the actual free block chain intact. +; */ ; -; /* Decrement the size of the block */ -; f->size -= size; +; /* Decrement the size of the block */ +; f->size -= size; ; -; /* Set f to the now unused space above the current block */ -; f = (struct freeblock*) (((unsigned) f) + f->size); +; /* Set f to the now unused space above the current block */ +; f = (struct freeblock*) (((unsigned) f) + f->size); ; ; } ; @@ -86,15 +86,15 @@ ; /* We did not find a block big enough. Try to use new space from the ; * heap top. ; */ -; if (((unsigned) _hend) - ((unsigned) _hptr) < size) { +; if (((unsigned) _hend) - ((unsigned) _hptr) < size) { ; /* Out of heap space */ ; return 0; -; } +; } ; ; -; /* There is enough space left, take it from the heap top */ -; p = _hptr; -; _hptr = (unsigned*) (((unsigned) _hptr) + size); +; /* There is enough space left, take it from the heap top */ +; p = _hptr; +; _hptr = (unsigned*) (((unsigned) _hptr) + size); ; ; } ; @@ -105,105 +105,105 @@ ; - .importzp ptr1, ptr2, ptr3 - .export _malloc + .importzp ptr1, ptr2, ptr3 + .export _malloc .include "_heap.inc" - .macpack generic + .macpack generic ;----------------------------------------------------------------------------- ; Code _malloc: - sta ptr1 ; Store size in ptr1 - stx ptr1+1 + sta ptr1 ; Store size in ptr1 + stx ptr1+1 ; Check for a size of zero, if so, return NULL - ora ptr1+1 - beq Done ; a/x already contains zero + ora ptr1+1 + beq Done ; a/x already contains zero ; Add the administration space and round up the size if needed - lda ptr1 - add #HEAP_ADMIN_SPACE - sta ptr1 - bcc @L1 - inc ptr1+1 -@L1: ldx ptr1+1 - bne @L2 - cmp #HEAP_MIN_BLOCKSIZE+1 - bcs @L2 - lda #HEAP_MIN_BLOCKSIZE - sta ptr1 ; High byte is already zero + lda ptr1 + add #HEAP_ADMIN_SPACE + sta ptr1 + bcc @L1 + inc ptr1+1 +@L1: ldx ptr1+1 + bne @L2 + cmp #HEAP_MIN_BLOCKSIZE+1 + bcs @L2 + lda #HEAP_MIN_BLOCKSIZE + sta ptr1 ; High byte is already zero ; Load a pointer to the freelist into ptr2 -@L2: lda __heapfirst - sta ptr2 - lda __heapfirst+1 - sta ptr2+1 +@L2: lda __heapfirst + sta ptr2 + lda __heapfirst+1 + sta ptr2+1 ; Search the freelist for a block that is big enough. We will calculate ; (f->size - size) here and keep it, since we need the value later. - jmp @L4 + jmp @L4 -@L3: ldy #freeblock::size - lda (ptr2),y - sub ptr1 - tax ; Remember low byte for later - iny ; Y points to freeblock::size+1 - lda (ptr2),y - sbc ptr1+1 - bcs BlockFound ; Beware: Contents of a/x/y are known! +@L3: ldy #freeblock::size + lda (ptr2),y + sub ptr1 + tax ; Remember low byte for later + iny ; Y points to freeblock::size+1 + lda (ptr2),y + sbc ptr1+1 + bcs BlockFound ; Beware: Contents of a/x/y are known! ; Next block in list - iny ; Points to freeblock::next - lda (ptr2),y - tax - iny ; Points to freeblock::next+1 - lda (ptr2),y - stx ptr2 - sta ptr2+1 -@L4: ora ptr2 - bne @L3 + iny ; Points to freeblock::next + lda (ptr2),y + tax + iny ; Points to freeblock::next+1 + lda (ptr2),y + stx ptr2 + sta ptr2+1 +@L4: ora ptr2 + bne @L3 ; We did not find a block big enough. Try to use new space from the heap top. - lda __heapptr - add ptr1 ; _heapptr + size - tay - lda __heapptr+1 - adc ptr1+1 - bcs OutOfHeapSpace ; On overflow, we're surely out of space + lda __heapptr + add ptr1 ; _heapptr + size + tay + lda __heapptr+1 + adc ptr1+1 + bcs OutOfHeapSpace ; On overflow, we're surely out of space - cmp __heapend+1 - bne @L5 - cpy __heapend -@L5: bcc TakeFromTop - beq TakeFromTop + cmp __heapend+1 + bne @L5 + cpy __heapend +@L5: bcc TakeFromTop + beq TakeFromTop ; Out of heap space OutOfHeapSpace: - lda #0 - tax -Done: rts + lda #0 + tax +Done: rts ; There is enough space left, take it from the heap top TakeFromTop: - ldx __heapptr ; p = _heapptr; - stx ptr2 - ldx __heapptr+1 - stx ptr2+1 + ldx __heapptr ; p = _heapptr; + stx ptr2 + ldx __heapptr+1 + stx ptr2+1 - sty __heapptr ; _heapptr += size; - sta __heapptr+1 - jmp FillSizeAndRet ; Done + sty __heapptr ; _heapptr += size; + sta __heapptr+1 + jmp FillSizeAndRet ; Done ; We found a block big enough. If the block can hold just the ; requested size, use the block in full. Beware: When slicing blocks, @@ -213,73 +213,73 @@ TakeFromTop: ; flag is set if the high byte of this remaining size is zero. BlockFound: - bne SliceBlock ; Block is large enough to slice - cpx #HEAP_MIN_BLOCKSIZE ; Check low byte - bcs SliceBlock ; Jump if block is large enough to slice + bne SliceBlock ; Block is large enough to slice + cpx #HEAP_MIN_BLOCKSIZE ; Check low byte + bcs SliceBlock ; Jump if block is large enough to slice ; The block is too small to slice it. Use the block in full. The block ; does already contain the correct size word, all we have to do is to ; remove it from the free list. - ldy #freeblock::prev+1 ; Load f->prev - lda (ptr2),y - sta ptr3+1 - dey - lda (ptr2),y - sta ptr3 - dey ; Points to freeblock::next+1 - ora ptr3+1 - beq @L1 ; Jump if f->prev zero + ldy #freeblock::prev+1 ; Load f->prev + lda (ptr2),y + sta ptr3+1 + dey + lda (ptr2),y + sta ptr3 + dey ; Points to freeblock::next+1 + ora ptr3+1 + beq @L1 ; Jump if f->prev zero ; We have a previous block, ptr3 contains its address. ; Do f->prev->next = f->next - lda (ptr2),y ; Load high byte of f->next - sta (ptr3),y ; Store high byte of f->prev->next - dey ; Points to next - lda (ptr2),y ; Load low byte of f->next - sta (ptr3),y ; Store low byte of f->prev->next - jmp @L2 + lda (ptr2),y ; Load high byte of f->next + sta (ptr3),y ; Store high byte of f->prev->next + dey ; Points to next + lda (ptr2),y ; Load low byte of f->next + sta (ptr3),y ; Store low byte of f->prev->next + jmp @L2 ; This is the first block, correct the freelist pointer ; Do _hfirst = f->next -@L1: lda (ptr2),y ; Load high byte of f->next - sta __heapfirst+1 - dey ; Points to next - lda (ptr2),y ; Load low byte of f->next - sta __heapfirst +@L1: lda (ptr2),y ; Load high byte of f->next + sta __heapfirst+1 + dey ; Points to next + lda (ptr2),y ; Load low byte of f->next + sta __heapfirst ; Check f->next. Y points always to next if we come here -@L2: lda (ptr2),y ; Load low byte of f->next - sta ptr3 - iny ; Points to next+1 - lda (ptr2),y ; Load high byte of f->next - sta ptr3+1 - iny ; Points to prev - ora ptr3 - beq @L3 ; Jump if f->next zero +@L2: lda (ptr2),y ; Load low byte of f->next + sta ptr3 + iny ; Points to next+1 + lda (ptr2),y ; Load high byte of f->next + sta ptr3+1 + iny ; Points to prev + ora ptr3 + beq @L3 ; Jump if f->next zero ; We have a next block, ptr3 contains its address. ; Do f->next->prev = f->prev - lda (ptr2),y ; Load low byte of f->prev - sta (ptr3),y ; Store low byte of f->next->prev - iny ; Points to prev+1 - lda (ptr2),y ; Load high byte of f->prev - sta (ptr3),y ; Store high byte of f->prev->next - jmp RetUserPtr ; Done + lda (ptr2),y ; Load low byte of f->prev + sta (ptr3),y ; Store low byte of f->next->prev + iny ; Points to prev+1 + lda (ptr2),y ; Load high byte of f->prev + sta (ptr3),y ; Store high byte of f->prev->next + jmp RetUserPtr ; Done ; This is the last block, correct the freelist pointer. ; Do _hlast = f->prev -@L3: lda (ptr2),y ; Load low byte of f->prev - sta __heaplast - iny ; Points to prev+1 - lda (ptr2),y ; Load high byte of f->prev - sta __heaplast+1 - jmp RetUserPtr ; Done +@L3: lda (ptr2),y ; Load low byte of f->prev + sta __heaplast + iny ; Points to prev+1 + lda (ptr2),y ; Load high byte of f->prev + sta __heaplast+1 + jmp RetUserPtr ; Done ; We must slice the block found. Cut off space from the upper end, so we ; can leave the actual free block chain intact. @@ -288,37 +288,37 @@ SliceBlock: ; Decrement the size of the block. Y points to size+1. - dey ; Points to size - lda (ptr2),y ; Low byte of f->size - sub ptr1 - sta (ptr2),y - tax ; Save low byte of f->size in X - iny ; Points to size+1 - lda (ptr2),y ; High byte of f->size - sbc ptr1+1 - sta (ptr2),y + dey ; Points to size + lda (ptr2),y ; Low byte of f->size + sub ptr1 + sta (ptr2),y + tax ; Save low byte of f->size in X + iny ; Points to size+1 + lda (ptr2),y ; High byte of f->size + sbc ptr1+1 + sta (ptr2),y ; Set f to the space above the current block, which is the new block returned ; to the caller. - txa ; Get low byte of f->size - add ptr2 - tax - lda (ptr2),y ; Get high byte of f->size - adc ptr2+1 - stx ptr2 - sta ptr2+1 + txa ; Get low byte of f->size + add ptr2 + tax + lda (ptr2),y ; Get high byte of f->size + adc ptr2+1 + stx ptr2 + sta ptr2+1 ; Fill the size and start address into the admin space of the block ; (struct usedblock) and return the user pointer FillSizeAndRet: - ldy #usedblock::size ; p->size = size; - lda ptr1 ; Low byte of block size - sta (ptr2),y - iny ; Points to freeblock::size+1 - lda ptr1+1 - sta (ptr2),y + ldy #usedblock::size ; p->size = size; + lda ptr1 ; Low byte of block size + sta (ptr2),y + iny ; Points to freeblock::size+1 + lda ptr1+1 + sta (ptr2),y RetUserPtr: ldy #usedblock::start ; p->start = p @@ -330,10 +330,10 @@ RetUserPtr: ; Return the user pointer, which points behind the struct usedblock - lda ptr2 ; return ++p; - ldx ptr2+1 - add #HEAP_ADMIN_SPACE - bcc @L9 - inx -@L9: rts + lda ptr2 ; return ++p; + ldx ptr2+1 + add #HEAP_ADMIN_SPACE + bcc @L9 + inx +@L9: rts diff --git a/libsrc/common/memchr.s b/libsrc/common/memchr.s index c4556370f..1b60cbf73 100644 --- a/libsrc/common/memchr.s +++ b/libsrc/common/memchr.s @@ -4,23 +4,23 @@ ; void* __fastcall__ memchr (const void* p, int c, size_t n); ; - .export _memchr - .import popax, return0 - .importzp ptr1, ptr2 + .export _memchr + .import popax, return0 + .importzp ptr1, ptr2 .proc _memchr eor #$FF - sta ptr2 + sta ptr2 txa eor #$FF - sta ptr2+1 ; Save ones complement of n - jsr popax ; get c - pha - jsr popax ; get p - sta ptr1 - stx ptr1+1 + sta ptr2+1 ; Save ones complement of n + jsr popax ; get c + pha + jsr popax ; get p + sta ptr1 + stx ptr1+1 ldy #$00 pla ; Get c @@ -45,13 +45,13 @@ notfound: ; Found, return pointer to char -found: ldx ptr1+1 ; get high byte of pointer - tya ; low byte offset - clc - adc ptr1 - bcc L9 - inx -L9: rts +found: ldx ptr1+1 ; get high byte of pointer + tya ; low byte offset + clc + adc ptr1 + bcc L9 + inx +L9: rts .endproc diff --git a/libsrc/common/memcmp.s b/libsrc/common/memcmp.s index 5d82aa6d8..25628127a 100644 --- a/libsrc/common/memcmp.s +++ b/libsrc/common/memcmp.s @@ -4,69 +4,69 @@ ; int memcmp (const void* p1, const void* p2, size_t count); ; - .export _memcmp - .import popax, return0 - .importzp ptr1, ptr2, ptr3 + .export _memcmp + .import popax, return0 + .importzp ptr1, ptr2, ptr3 _memcmp: ; Calculate (-count-1) and store it into ptr3. This is some overhead here but ; saves time in the compare loop - eor #$FF - sta ptr3 - txa - eor #$FF - sta ptr3+1 + eor #$FF + sta ptr3 + txa + eor #$FF + sta ptr3+1 ; Get the pointer parameters - jsr popax ; Get p2 - sta ptr2 - stx ptr2+1 - jsr popax ; Get p1 - sta ptr1 - stx ptr1+1 + jsr popax ; Get p2 + sta ptr2 + stx ptr2+1 + jsr popax ; Get p1 + sta ptr1 + stx ptr1+1 ; Loop initialization - ldx ptr3 ; Load low counter byte into X - ldy #$00 ; Initialize pointer + ldx ptr3 ; Load low counter byte into X + ldy #$00 ; Initialize pointer ; Head of compare loop: Test for the end condition -Loop: inx ; Bump low byte of (-count-1) - beq BumpHiCnt ; Jump on overflow +Loop: inx ; Bump low byte of (-count-1) + beq BumpHiCnt ; Jump on overflow ; Do the compare -Comp: lda (ptr1),y - cmp (ptr2),y - bne NotEqual ; Jump if bytes not equal +Comp: lda (ptr1),y + cmp (ptr2),y + bne NotEqual ; Jump if bytes not equal ; Bump the pointers - iny ; Increment pointer - bne Loop - inc ptr1+1 ; Increment high bytes - inc ptr2+1 - bne Loop ; Branch always (pointer wrap is illegal) + iny ; Increment pointer + bne Loop + inc ptr1+1 ; Increment high bytes + inc ptr2+1 + bne Loop ; Branch always (pointer wrap is illegal) ; Entry on low counter byte overflow BumpHiCnt: - inc ptr3+1 ; Bump high byte of (-count-1) - bne Comp ; Jump if not done - jmp return0 ; Count is zero, areas are identical + inc ptr3+1 ; Bump high byte of (-count-1) + bne Comp ; Jump if not done + jmp return0 ; Count is zero, areas are identical ; Not equal, check which one is greater NotEqual: - bcs Greater - ldx #$FF ; Make result negative - rts + bcs Greater + ldx #$FF ; Make result negative + rts Greater: - ldx #$01 ; Make result positive - rts + ldx #$01 ; Make result positive + rts diff --git a/libsrc/common/memcpy.s b/libsrc/common/memcpy.s index d432ffa0e..c0c5e56d0 100644 --- a/libsrc/common/memcpy.s +++ b/libsrc/common/memcpy.s @@ -10,71 +10,71 @@ ; at memmove! ; - .export _memcpy, memcpy_upwards, memcpy_getparams - .import popax - .importzp sp, ptr1, ptr2, ptr3 + .export _memcpy, memcpy_upwards, memcpy_getparams + .import popax + .importzp sp, ptr1, ptr2, ptr3 ; ---------------------------------------------------------------------- _memcpy: jsr memcpy_getparams -memcpy_upwards: ; assert Y = 0 - ldx ptr3+1 ; Get high byte of n - beq L2 ; Jump if zero +memcpy_upwards: ; assert Y = 0 + ldx ptr3+1 ; Get high byte of n + beq L2 ; Jump if zero -L1: .repeat 2 ; Unroll this a bit to make it faster... - lda (ptr1),Y ; copy a byte - sta (ptr2),Y - iny - .endrepeat - bne L1 - inc ptr1+1 - inc ptr2+1 - dex ; Next 256 byte block - bne L1 ; Repeat if any +L1: .repeat 2 ; Unroll this a bit to make it faster... + lda (ptr1),Y ; copy a byte + sta (ptr2),Y + iny + .endrepeat + bne L1 + inc ptr1+1 + inc ptr2+1 + dex ; Next 256 byte block + bne L1 ; Repeat if any - ; the following section could be 10% faster if we were able to copy - ; back to front - unfortunately we are forced to copy strict from - ; low to high since this function is also used for - ; memmove and blocks could be overlapping! - ; { -L2: ; assert Y = 0 - ldx ptr3 ; Get the low byte of n - beq done ; something to copy + ; the following section could be 10% faster if we were able to copy + ; back to front - unfortunately we are forced to copy strict from + ; low to high since this function is also used for + ; memmove and blocks could be overlapping! + ; { +L2: ; assert Y = 0 + ldx ptr3 ; Get the low byte of n + beq done ; something to copy -L3: lda (ptr1),Y ; copy a byte - sta (ptr2),Y - iny - dex - bne L3 +L3: lda (ptr1),Y ; copy a byte + sta (ptr2),Y + iny + dex + bne L3 - ; } + ; } -done: jmp popax ; Pop ptr and return as result +done: jmp popax ; Pop ptr and return as result ; ---------------------------------------------------------------------- ; Get the parameters from stack as follows: ; -; size --> ptr3 +; size --> ptr3 ; src --> ptr1 ; dest --> ptr2 -; First argument (dest) will remain on stack and is returned in a/x! +; First argument (dest) will remain on stack and is returned in a/x! -memcpy_getparams: ; IMPORTANT! Function has to leave with Y=0! - sta ptr3 +memcpy_getparams: ; IMPORTANT! Function has to leave with Y=0! + sta ptr3 stx ptr3+1 ; save n to ptr3 - jsr popax - sta ptr1 - stx ptr1+1 ; save src to ptr1 + jsr popax + sta ptr1 + stx ptr1+1 ; save src to ptr1 - ; save dest to ptr2 - ldy #1 ; (direct stack access is three cycles faster + ; save dest to ptr2 + ldy #1 ; (direct stack access is three cycles faster ; (total cycle count with return)) lda (sp),y - tax - stx ptr2+1 ; save high byte of ptr2 - dey ; Y = 0 + tax + stx ptr2+1 ; save high byte of ptr2 + dey ; Y = 0 lda (sp),y ; Get ptr2 low - sta ptr2 - rts + sta ptr2 + rts diff --git a/libsrc/common/memmove.s b/libsrc/common/memmove.s index 983b97277..94ad7d102 100644 --- a/libsrc/common/memmove.s +++ b/libsrc/common/memmove.s @@ -8,9 +8,9 @@ ; NOTE: This function uses entry points from memcpy! ; - .export _memmove + .export _memmove .import memcpy_getparams, memcpy_upwards, popax - .importzp ptr1, ptr2, ptr3, ptr4, tmp1 + .importzp ptr1, ptr2, ptr3, ptr4, tmp1 .macpack generic .macpack longbranch @@ -31,54 +31,54 @@ _memmove: ; Copy downwards. Adjust the pointers to the end of the memory regions. - lda ptr1+1 - add ptr3+1 - sta ptr1+1 + lda ptr1+1 + add ptr3+1 + sta ptr1+1 - lda ptr2+1 - add ptr3+1 - sta ptr2+1 + lda ptr2+1 + add ptr3+1 + sta ptr2+1 ; handle fractions of a page size first - ldy ptr3 ; count, low byte - bne @entry ; something to copy? - beq PageSizeCopy ; here like bra... + ldy ptr3 ; count, low byte + bne @entry ; something to copy? + beq PageSizeCopy ; here like bra... @copyByte: - lda (ptr1),y - sta (ptr2),y -@entry: - dey - bne @copyByte - lda (ptr1),y ; copy remaining byte - sta (ptr2),y - -PageSizeCopy: ; assert Y = 0 - ldx ptr3+1 ; number of pages - beq done ; none? -> done - -@initBase: - dec ptr1+1 ; adjust base... - dec ptr2+1 - dey ; in entry case: 0 -> FF - lda (ptr1),y ; need to copy this 'intro byte' - sta (ptr2),y ; to 'land' later on Y=0! (as a result of the '.repeat'-block!) - dey ; FF ->FE -@copyBytes: - .repeat 2 ; Unroll this a bit to make it faster... lda (ptr1),y sta (ptr2),y - dey - .endrepeat -@copyEntry: ; in entry case: 0 -> FF - bne @copyBytes - lda (ptr1),y ; Y = 0, copy last byte +@entry: + dey + bne @copyByte + lda (ptr1),y ; copy remaining byte sta (ptr2),y - dex ; one page to copy less - bne @initBase ; still a page to copy? + +PageSizeCopy: ; assert Y = 0 + ldx ptr3+1 ; number of pages + beq done ; none? -> done + +@initBase: + dec ptr1+1 ; adjust base... + dec ptr2+1 + dey ; in entry case: 0 -> FF + lda (ptr1),y ; need to copy this 'intro byte' + sta (ptr2),y ; to 'land' later on Y=0! (as a result of the '.repeat'-block!) + dey ; FF ->FE +@copyBytes: + .repeat 2 ; Unroll this a bit to make it faster... + lda (ptr1),y + sta (ptr2),y + dey + .endrepeat +@copyEntry: ; in entry case: 0 -> FF + bne @copyBytes + lda (ptr1),y ; Y = 0, copy last byte + sta (ptr2),y + dex ; one page to copy less + bne @initBase ; still a page to copy? ; Done, return dest -done: jmp popax ; Pop ptr and return as result +done: jmp popax ; Pop ptr and return as result diff --git a/libsrc/common/memset.s b/libsrc/common/memset.s index 6634e8fb7..96f5d9e11 100644 --- a/libsrc/common/memset.s +++ b/libsrc/common/memset.s @@ -15,79 +15,79 @@ ; in a/x is of any use. ; - .export _memset, _bzero, __bzero - .import popax - .importzp sp, ptr1, ptr2, ptr3 + .export _memset, _bzero, __bzero + .import popax + .importzp sp, ptr1, ptr2, ptr3 _bzero: __bzero: sta ptr3 stx ptr3+1 ; Save n - ldx #0 ; Fill with zeros + ldx #0 ; Fill with zeros beq common _memset: - sta ptr3 ; Save n - stx ptr3+1 - jsr popax ; Get c - tax + sta ptr3 ; Save n + stx ptr3+1 + jsr popax ; Get c + tax ; Common stuff for memset and bzero from here -common: ; Fill value is in X! - ldy #1 +common: ; Fill value is in X! + ldy #1 lda (sp),y - sta ptr1+1 ; save high byte of ptr - dey ; Y = 0 + sta ptr1+1 ; save high byte of ptr + dey ; Y = 0 lda (sp),y ; Get ptr - sta ptr1 + sta ptr1 - lsr ptr3+1 ; divide number of - ror ptr3 ; bytes by two to increase - bcc evenCount ; speed (ptr3 = ptr3/2) + lsr ptr3+1 ; divide number of + ror ptr3 ; bytes by two to increase + bcc evenCount ; speed (ptr3 = ptr3/2) oddCount: - ; y is still 0 here - txa ; restore fill value - sta (ptr1),y ; save value and increase - inc ptr1 ; dest. pointer - bne evenCount - inc ptr1+1 + ; y is still 0 here + txa ; restore fill value + sta (ptr1),y ; save value and increase + inc ptr1 ; dest. pointer + bne evenCount + inc ptr1+1 evenCount: - lda ptr1 ; build second pointer section - clc - adc ptr3 ; ptr2 = ptr1 + (length/2) <- ptr3 - sta ptr2 - lda ptr1+1 - adc ptr3+1 - sta ptr2+1 + lda ptr1 ; build second pointer section + clc + adc ptr3 ; ptr2 = ptr1 + (length/2) <- ptr3 + sta ptr2 + lda ptr1+1 + adc ptr3+1 + sta ptr2+1 - txa ; restore fill value - ldx ptr3+1 ; Get high byte of n - beq L2 ; Jump if zero + txa ; restore fill value + ldx ptr3+1 ; Get high byte of n + beq L2 ; Jump if zero ; Set 256/512 byte blocks - ; y is still 0 here -L1: .repeat 2 ; Unroll this a bit to make it faster - sta (ptr1),y ; Set byte in lower section - sta (ptr2),y ; Set byte in upper section - iny - .endrepeat - bne L1 - inc ptr1+1 - inc ptr2+1 - dex ; Next 256 byte block - bne L1 ; Repeat if any + ; y is still 0 here +L1: .repeat 2 ; Unroll this a bit to make it faster + sta (ptr1),y ; Set byte in lower section + sta (ptr2),y ; Set byte in upper section + iny + .endrepeat + bne L1 + inc ptr1+1 + inc ptr2+1 + dex ; Next 256 byte block + bne L1 ; Repeat if any ; Set the remaining bytes if any -L2: ldy ptr3 ; Get the low byte of n - beq leave ; something to set? No -> leave +L2: ldy ptr3 ; Get the low byte of n + beq leave ; something to set? No -> leave -L3: dey - sta (ptr1),y ; set bytes in low - sta (ptr2),y ; and high section - bne L3 ; flags still up to date from dey! -leave: - jmp popax ; Pop ptr and return as result +L3: dey + sta (ptr1),y ; set bytes in low + sta (ptr2),y ; and high section + bne L3 ; flags still up to date from dey! +leave: + jmp popax ; Pop ptr and return as result diff --git a/libsrc/common/mkdir.s b/libsrc/common/mkdir.s index 55a98f058..1144983aa 100644 --- a/libsrc/common/mkdir.s +++ b/libsrc/common/mkdir.s @@ -1,7 +1,7 @@ ; ; Oliver Schmidt, 2005-08-30 ; -; int mkdir (const char* name, ...); /* May take a mode argument */ +; int mkdir (const char* name, ...); /* May take a mode argument */ ; .export _mkdir diff --git a/libsrc/common/modfree.s b/libsrc/common/modfree.s index 762e0bb94..c3ced33f6 100644 --- a/libsrc/common/modfree.s +++ b/libsrc/common/modfree.s @@ -2,7 +2,7 @@ ;* */ ;* modfree.s */ ;* */ -;* Free loaded o65 modules */ +;* Free loaded o65 modules */ ;* */ ;* */ ;* */ diff --git a/libsrc/common/pmemalign.c b/libsrc/common/pmemalign.c index a8f34f7f6..e1dc497a2 100644 --- a/libsrc/common/pmemalign.c +++ b/libsrc/common/pmemalign.c @@ -33,12 +33,12 @@ -#include /* define NULL */ -#include /* declare function's prototype */ +#include /* define NULL */ +#include /* declare function's prototype */ #include <_heap.h> #include -#define EOK 0 /* No errors (non-standard name) */ +#define EOK 0 /* No errors (non-standard name) */ diff --git a/libsrc/common/printf.s b/libsrc/common/printf.s index b164e887d..8d645dfa2 100644 --- a/libsrc/common/printf.s +++ b/libsrc/common/printf.s @@ -4,18 +4,18 @@ ; Ullrich von Bassewitz, 1.12.2000 ; - .export _printf - .import _stdout, pushax, addysp, _vfprintf - .importzp sp, ptr1 + .export _printf + .import _stdout, pushax, addysp, _vfprintf + .importzp sp, ptr1 - .macpack generic + .macpack generic ; ---------------------------------------------------------------------------- ; Data .bss -ParamSize: .res 1 ; Number of parameter bytes +ParamSize: .res 1 ; Number of parameter bytes ; ---------------------------------------------------------------------------- ; Code @@ -24,10 +24,10 @@ ParamSize: .res 1 ; Number of parameter bytes _printf: - sty ParamSize ; Number of param bytes passed in Y + sty ParamSize ; Number of param bytes passed in Y ; We are using a (hopefully) clever trick here to reduce code size. On entry, -; the stack pointer points to the last pushed parameter of the variable +; the stack pointer points to the last pushed parameter of the variable ; parameter list. Adding the number of parameter bytes, would result in a ; pointer that points *after* the Format parameter. ; Since we have to push stdout anyway, we will do that here, so @@ -37,40 +37,40 @@ _printf: ; be pushed next. ; - lda _stdout - ldx _stdout+1 - jsr pushax + lda _stdout + ldx _stdout+1 + jsr pushax ; Now calculate the va_list pointer, which does points to Format - lda sp - ldx sp+1 - add ParamSize - bcc @L1 - inx -@L1: sta ptr1 - stx ptr1+1 + lda sp + ldx sp+1 + add ParamSize + bcc @L1 + inx +@L1: sta ptr1 + stx ptr1+1 ; Push Format - ldy #1 - lda (ptr1),y - tax - dey - lda (ptr1),y - jsr pushax + ldy #1 + lda (ptr1),y + tax + dey + lda (ptr1),y + jsr pushax ; Load va_list (last and __fastcall__ parameter to vfprintf) - lda ptr1 - ldx ptr1+1 + lda ptr1 + ldx ptr1+1 ; Call vfprintf - jsr _vfprintf + jsr _vfprintf ; Cleanup the stack. We will return what we got from vfprintf - ldy ParamSize - jmp addysp + ldy ParamSize + jmp addysp diff --git a/libsrc/common/putchar.s b/libsrc/common/putchar.s index 7270ee5be..1de1a54ab 100644 --- a/libsrc/common/putchar.s +++ b/libsrc/common/putchar.s @@ -4,7 +4,7 @@ ; int __fastcall__ putchar (int c); ; - .export _putchar + .export _putchar .import pushax .import _stdout .import _fputc diff --git a/libsrc/common/putenv.s b/libsrc/common/putenv.s index 6f7982fcd..7e44a7cd8 100644 --- a/libsrc/common/putenv.s +++ b/libsrc/common/putenv.s @@ -130,7 +130,7 @@ ; Since free() has destroyed ptr2, we need another copy ... - jsr copyenvptr ; Copy __environ to ptr2 + jsr copyenvptr ; Copy __environ to ptr2 ; Bump the environment count and remember it in X. Add the final NULL entry. @@ -169,10 +169,10 @@ addentry: ; Error entries nomem: lda #ENOMEM -error: jsr __seterrno - lda #$FF ; Return -1 - tax - rts +error: jsr __seterrno + lda #$FF ; Return -1 + tax + rts .endproc diff --git a/libsrc/common/puts.c b/libsrc/common/puts.c index 85b8cc315..b0ad5180f 100644 --- a/libsrc/common/puts.c +++ b/libsrc/common/puts.c @@ -14,7 +14,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -25,9 +25,9 @@ int __fastcall__ puts (const char* s) /* Assume stdout is always open */ if (write (stdout->f_fd, s, strlen (s)) < 0 || - write (stdout->f_fd, &nl, 1) < 0) { - stdout->f_flags |= _FERROR; - return -1; + write (stdout->f_fd, &nl, 1) < 0) { + stdout->f_flags |= _FERROR; + return -1; } /* Done */ diff --git a/libsrc/common/qsort.c b/libsrc/common/qsort.c index e05fdfc35..383962934 100644 --- a/libsrc/common/qsort.c +++ b/libsrc/common/qsort.c @@ -12,7 +12,7 @@ static void QuickSort (register unsigned char* Base, int Lo, int Hi, register size_t Size, - int (*Compare)(const void*, const void*)) + int (*Compare)(const void*, const void*)) /* Internal recursive function. Works with ints, but this shouldn't be * a problem. */ @@ -21,42 +21,42 @@ static void QuickSort (register unsigned char* Base, int Lo, int Hi, /* Quicksort */ while (Hi > Lo) { - I = Lo + Size; - J = Hi; - while (I <= J) { - while (I <= J && Compare (Base + Lo, Base + I) >= 0) { - I += Size; - } - while (I <= J && Compare (Base + Lo, Base + J) < 0) { - J -= Size; - } - if (I <= J) { - _swap (Base + I, Base + J, Size); - I += Size; - J -= Size; - } - } - if (J != Lo) { - _swap (Base + J, Base + Lo, Size); - } - if (((unsigned) J) * 2 > (Hi + Lo)) { - QuickSort (Base, J + Size, Hi, Size, Compare); - Hi = J - Size; - } else { - QuickSort (Base, Lo, J - Size, Size, Compare); - Lo = J + Size; - } + I = Lo + Size; + J = Hi; + while (I <= J) { + while (I <= J && Compare (Base + Lo, Base + I) >= 0) { + I += Size; + } + while (I <= J && Compare (Base + Lo, Base + J) < 0) { + J -= Size; + } + if (I <= J) { + _swap (Base + I, Base + J, Size); + I += Size; + J -= Size; + } + } + if (J != Lo) { + _swap (Base + J, Base + Lo, Size); + } + if (((unsigned) J) * 2 > (Hi + Lo)) { + QuickSort (Base, J + Size, Hi, Size, Compare); + Hi = J - Size; + } else { + QuickSort (Base, Lo, J - Size, Size, Compare); + Lo = J + Size; + } } } void __fastcall__ qsort (void* base, size_t nmemb, size_t size, - int (*compare)(const void*, const void*)) + int (*compare)(const void*, const void*)) /* Quicksort implementation */ { if (nmemb > 1) { - QuickSort (base, 0, (nmemb-1) * size, size, compare); + QuickSort (base, 0, (nmemb-1) * size, size, compare); } } diff --git a/libsrc/common/rand.s b/libsrc/common/rand.s index 0ed52aa8b..48a88b7c4 100644 --- a/libsrc/common/rand.s +++ b/libsrc/common/rand.s @@ -19,48 +19,48 @@ ; detectable patterns. ; - .export _rand, _srand + .export _rand, _srand .data ; The seed. When srand() is not called, the C standard says that that rand() ; should behave as if srand() was called with an argument of 1 before. -rand: .dword 1 +rand: .dword 1 .code -_rand: clc - lda rand+0 ; SEED *= $01010101 - adc rand+1 - sta rand+1 - adc rand+2 - sta rand+2 - adc rand+3 - sta rand+3 - clc - lda rand+0 ; SEED += $31415927 - adc #$27 - sta rand+0 - lda rand+1 - adc #$59 - sta rand+1 - pha - lda rand+2 - adc #$41 - sta rand+2 - and #$7f ; Suppress sign bit (make it positive) - tax - lda rand+3 - adc #$31 - sta rand+3 - pla ; return bit 8-22 in (X,A) - rts +_rand: clc + lda rand+0 ; SEED *= $01010101 + adc rand+1 + sta rand+1 + adc rand+2 + sta rand+2 + adc rand+3 + sta rand+3 + clc + lda rand+0 ; SEED += $31415927 + adc #$27 + sta rand+0 + lda rand+1 + adc #$59 + sta rand+1 + pha + lda rand+2 + adc #$41 + sta rand+2 + and #$7f ; Suppress sign bit (make it positive) + tax + lda rand+3 + adc #$31 + sta rand+3 + pla ; return bit 8-22 in (X,A) + rts -_srand: sta rand+0 ; Store the seed - stx rand+1 - lda #0 - sta rand+2 ; Set MSW to zero - sta rand+3 - rts +_srand: sta rand+0 ; Store the seed + stx rand+1 + lda #0 + sta rand+2 ; Set MSW to zero + sta rand+3 + rts diff --git a/libsrc/common/realloc.c b/libsrc/common/realloc.c index 2bbc16d9f..d9850b591 100644 --- a/libsrc/common/realloc.c +++ b/libsrc/common/realloc.c @@ -48,15 +48,15 @@ void* __fastcall__ realloc (void* block, register size_t size) /* Check the block parameter */ if (!block) { - /* Block is NULL, same as malloc */ - return malloc (size); + /* Block is NULL, same as malloc */ + return malloc (size); } /* Check the size parameter */ if (size == 0) { - /* Block is not NULL, but size is: free the block */ - free (block); - return 0; + /* Block is not NULL, but size is: free the block */ + free (block); + return 0; } /* Make the internal used size from the given size */ @@ -75,15 +75,15 @@ void* __fastcall__ realloc (void* block, register size_t size) /* Is the block at the current heap top? */ if (((unsigned) b) + oldsize == ((unsigned) _heapptr)) { - /* Check if we've enough memory at the heap top */ - newhptr = ((unsigned) _heapptr) - oldsize + size; - if (newhptr <= ((unsigned) _heapend)) { - /* Ok, there's space enough */ - _heapptr = (unsigned*) newhptr; + /* Check if we've enough memory at the heap top */ + newhptr = ((unsigned) _heapptr) - oldsize + size; + if (newhptr <= ((unsigned) _heapend)) { + /* Ok, there's space enough */ + _heapptr = (unsigned*) newhptr; b->size = size; b->start = b; - return block; - } + return block; + } } /* The given block was not located on top of the heap, or there's no @@ -91,19 +91,19 @@ void* __fastcall__ realloc (void* block, register size_t size) */ if (newblock = malloc (size)) { - /* Adjust the old size to the user visible portion */ - oldsize -= HEAP_ADMIN_SPACE; + /* Adjust the old size to the user visible portion */ + oldsize -= HEAP_ADMIN_SPACE; - /* If the new block is larger than the old one, copy the old - * data only - */ - if (size > oldsize) { - size = oldsize; - } + /* If the new block is larger than the old one, copy the old + * data only + */ + if (size > oldsize) { + size = oldsize; + } - /* Copy the block data */ - memcpy (newblock, block, size); - free (block); + /* Copy the block data */ + memcpy (newblock, block, size); + free (block); } return newblock; } diff --git a/libsrc/common/rewind.c b/libsrc/common/rewind.c index b6055ece5..583b779f9 100644 --- a/libsrc/common/rewind.c +++ b/libsrc/common/rewind.c @@ -11,7 +11,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -22,4 +22,4 @@ void __fastcall__ rewind (FILE* f) clearerr(f); } - + diff --git a/libsrc/common/scanf.s b/libsrc/common/scanf.s index e75c92327..dd6c16ad1 100644 --- a/libsrc/common/scanf.s +++ b/libsrc/common/scanf.s @@ -5,18 +5,18 @@ ; 2004-12-31, Greg King ; - .export _scanf + .export _scanf - .import _stdin, pushax, addysp, _vfscanf - .import sp:zp, ptr1:zp + .import _stdin, pushax, addysp, _vfscanf + .import sp:zp, ptr1:zp - .macpack generic + .macpack generic ; ---------------------------------------------------------------------------- ; Code ; _scanf: - sty ArgSize ; Number of argument bytes passed in .Y + sty ArgSize ; Number of argument bytes passed in .Y ; We are using a (hopefully) clever trick here to reduce code size. On entry, ; the stack pointer points to the last pushed argument of the variable @@ -28,47 +28,47 @@ _scanf: ; * we will have the address of the Format argument which needs to ; be pushed next. - lda _stdin - ldx _stdin+1 - jsr pushax + lda _stdin + ldx _stdin+1 + jsr pushax ; Now, calculate the va_list pointer, which does point to Format. - lda sp - ldx sp+1 - add ArgSize - bcc @L1 + lda sp + ldx sp+1 + add ArgSize + bcc @L1 inx -@L1: sta ptr1 - stx ptr1+1 +@L1: sta ptr1 + stx ptr1+1 ; Push a copy of Format. - ldy #1 - lda (ptr1),y + ldy #1 + lda (ptr1),y tax dey - lda (ptr1),y - jsr pushax + lda (ptr1),y + jsr pushax ; Load va_list [last and __fastcall__ argument to vfscanf()]. - lda ptr1 - ldx ptr1+1 + lda ptr1 + ldx ptr1+1 ; Call vfscanf(). - jsr _vfscanf + jsr _vfscanf ; Clean up the stack. We will return what we got from vfscanf(). - ldy ArgSize - jmp addysp + ldy ArgSize + jmp addysp ; ---------------------------------------------------------------------------- ; Data ; .bss ArgSize: - .res 1 ; Number of argument bytes + .res 1 ; Number of argument bytes diff --git a/libsrc/common/searchenv.s b/libsrc/common/searchenv.s index 585133386..7a48a3a52 100644 --- a/libsrc/common/searchenv.s +++ b/libsrc/common/searchenv.s @@ -23,7 +23,7 @@ ; Copy the pointer to the environment to the zero page - jsr copyenvptr + jsr copyenvptr ; Loop over all environment entries trying to find the requested one. @@ -71,13 +71,13 @@ ; copyenvptr: Copy _environ to ptr2 ; -.proc copyenvptr +.proc copyenvptr lda __environ sta ptr2 lda __environ+1 sta ptr2+1 - rts + rts .endproc diff --git a/libsrc/common/setjmp.s b/libsrc/common/setjmp.s index 38ca80e68..a6448b29f 100644 --- a/libsrc/common/setjmp.s +++ b/libsrc/common/setjmp.s @@ -4,49 +4,49 @@ ; int setjmp (jmp_buf buf); ; - .export __setjmp - .importzp sp, ptr1 + .export __setjmp + .importzp sp, ptr1 __setjmp: - sta ptr1 ; Save buf - stx ptr1+1 - ldy #0 + sta ptr1 ; Save buf + stx ptr1+1 + ldy #0 ; The parameter stack is now empty, put it into buf - lda sp - sta (ptr1),y - iny - lda sp+1 - sta (ptr1),y - iny + lda sp + sta (ptr1),y + iny + lda sp+1 + sta (ptr1),y + iny ; Put the return stack pointer next - tsx - inx - inx ; drop return address - txa - sta (ptr1),y - iny + tsx + inx + inx ; drop return address + txa + sta (ptr1),y + iny ; Last thing is the return address. - pla - tax - pla - sta (ptr1),y ; high byte first - iny - pha - txa - sta (ptr1),y - pha + pla + tax + pla + sta (ptr1),y ; high byte first + iny + pha + txa + sta (ptr1),y + pha ; Return zero - lda #0 - tax - rts + lda #0 + tax + rts diff --git a/libsrc/common/signal.s b/libsrc/common/signal.s index 9327ca89c..333072801 100644 --- a/libsrc/common/signal.s +++ b/libsrc/common/signal.s @@ -4,8 +4,8 @@ ; __sigfunc __fastcall__ signal (int sig, __sigfunc func); ; - .import popax - .importzp ptr1 + .import popax + .importzp ptr1 .include "signal.inc" .include "errno.inc" diff --git a/libsrc/common/snprintf.s b/libsrc/common/snprintf.s index 33ce4b1c9..33afb434d 100644 --- a/libsrc/common/snprintf.s +++ b/libsrc/common/snprintf.s @@ -4,18 +4,18 @@ ; Ullrich von Bassewitz, 2009-09-26 ; - .export _snprintf - .import pushax, addysp, decsp6, _vsnprintf - .importzp sp, ptr1 + .export _snprintf + .import pushax, addysp, decsp6, _vsnprintf + .importzp sp, ptr1 - .macpack generic + .macpack generic ; ---------------------------------------------------------------------------- ; Data .bss -ParamSize: .res 1 ; Number of parameter bytes +ParamSize: .res 1 ; Number of parameter bytes ; ---------------------------------------------------------------------------- ; Code @@ -24,7 +24,7 @@ ParamSize: .res 1 ; Number of parameter bytes _snprintf: - sty ParamSize ; Number of param bytes passed in Y + sty ParamSize ; Number of param bytes passed in Y ; We have to push buf/size/format, both in the order they already have on stack. ; To make this somewhat more efficient, we will create space on the stack and @@ -33,37 +33,37 @@ _snprintf: ; of the fixed arguments, this will allow us to calculate the pointer to the ; fixed size arguments easier (they're just ParamSize bytes away). - jsr decsp6 + jsr decsp6 ; Calculate a pointer to the Format argument - lda ParamSize - add sp - sta ptr1 - ldx sp+1 - bcc @L1 - inx -@L1: stx ptr1+1 + lda ParamSize + add sp + sta ptr1 + ldx sp+1 + bcc @L1 + inx +@L1: stx ptr1+1 ; Now copy buf/size/format - ldy #6-1 -@L2: lda (ptr1),y - sta (sp),y - dey - bpl @L2 + ldy #6-1 +@L2: lda (ptr1),y + sta (sp),y + dey + bpl @L2 ; Load va_list (last and __fastcall__ parameter to vsprintf) - lda ptr1 - ldx ptr1+1 + lda ptr1 + ldx ptr1+1 ; Call vsnprintf - jsr _vsnprintf + jsr _vsnprintf ; Cleanup the stack. We will return what we got from vsprintf - ldy ParamSize - jmp addysp + ldy ParamSize + jmp addysp diff --git a/libsrc/common/sprintf.s b/libsrc/common/sprintf.s index 1b196450a..d502d8638 100644 --- a/libsrc/common/sprintf.s +++ b/libsrc/common/sprintf.s @@ -4,18 +4,18 @@ ; Ullrich von Bassewitz, 1.12.2000 ; - .export _sprintf - .import pushax, addysp, decsp4, _vsprintf - .importzp sp, ptr1 + .export _sprintf + .import pushax, addysp, decsp4, _vsprintf + .importzp sp, ptr1 - .macpack generic + .macpack generic ; ---------------------------------------------------------------------------- ; Data .bss -ParamSize: .res 1 ; Number of parameter bytes +ParamSize: .res 1 ; Number of parameter bytes ; ---------------------------------------------------------------------------- ; Code @@ -24,7 +24,7 @@ ParamSize: .res 1 ; Number of parameter bytes _sprintf: - sty ParamSize ; Number of param bytes passed in Y + sty ParamSize ; Number of param bytes passed in Y ; We have to push buf and format, both in the order they already have on stack. ; To make this somewhat more efficient, we will create space on the stack and @@ -33,37 +33,37 @@ _sprintf: ; of the fixed arguments, this will allow us to calculate the pointer to the ; fixed size arguments easier (they're just ParamSize bytes away). - jsr decsp4 + jsr decsp4 ; Calculate a pointer to the Format argument - lda ParamSize - add sp - sta ptr1 - ldx sp+1 - bcc @L1 - inx -@L1: stx ptr1+1 + lda ParamSize + add sp + sta ptr1 + ldx sp+1 + bcc @L1 + inx +@L1: stx ptr1+1 ; Now copy both, buf and format - ldy #4-1 -@L2: lda (ptr1),y - sta (sp),y - dey - bpl @L2 + ldy #4-1 +@L2: lda (ptr1),y + sta (sp),y + dey + bpl @L2 ; Load va_list (last and __fastcall__ parameter to vsprintf) - lda ptr1 - ldx ptr1+1 + lda ptr1 + ldx ptr1+1 ; Call vsprintf - jsr _vsprintf + jsr _vsprintf ; Cleanup the stack. We will return what we got from vsprintf - ldy ParamSize - jmp addysp + ldy ParamSize + jmp addysp diff --git a/libsrc/common/sscanf.s b/libsrc/common/sscanf.s index 025e317a6..5e580e91f 100644 --- a/libsrc/common/sscanf.s +++ b/libsrc/common/sscanf.s @@ -4,18 +4,18 @@ ; Ullrich von Bassewitz, 2004-11-28 ; - .export _sscanf - .import addysp, decsp4, _vsscanf - .importzp sp, ptr1 + .export _sscanf + .import addysp, decsp4, _vsscanf + .importzp sp, ptr1 - .macpack generic + .macpack generic ; ---------------------------------------------------------------------------- ; Data .bss -ParamSize: .res 1 ; Number of parameter bytes +ParamSize: .res 1 ; Number of parameter bytes ; ---------------------------------------------------------------------------- ; Code @@ -37,7 +37,7 @@ ParamSize: .res 1 ; Number of parameter bytes .code _sscanf: - sty ParamSize ; Number of param bytes passed in Y + sty ParamSize ; Number of param bytes passed in Y ; We have to push buf and format, both in the order they already have on stack. ; To make this somewhat more efficient, we will create space on the stack and @@ -46,37 +46,37 @@ _sscanf: ; of the fixed arguments, this will allow us to calculate the pointer to the ; fixed size arguments easier (they're just ParamSize bytes away). - jsr decsp4 + jsr decsp4 ; Calculate a pointer to the fixed parameters - lda ParamSize - add sp - sta ptr1 - ldx sp+1 - bcc @L1 - inx -@L1: stx ptr1+1 + lda ParamSize + add sp + sta ptr1 + ldx sp+1 + bcc @L1 + inx +@L1: stx ptr1+1 ; Now copy both, str and format - ldy #4-1 -@L2: lda (ptr1),y - sta (sp),y - dey - bpl @L2 + ldy #4-1 +@L2: lda (ptr1),y + sta (sp),y + dey + bpl @L2 ; Load va_list (last and __fastcall__ parameter to vsscanf) - lda ptr1 - ldx ptr1+1 + lda ptr1 + ldx ptr1+1 ; Call vsscanf - jsr _vsscanf + jsr _vsscanf ; Cleanup the stack. We will return what we got from vsscanf - ldy ParamSize - jmp addysp + ldy ParamSize + jmp addysp diff --git a/libsrc/common/strcat.s b/libsrc/common/strcat.s index 8640626f3..7784d89f7 100644 --- a/libsrc/common/strcat.s +++ b/libsrc/common/strcat.s @@ -4,52 +4,52 @@ ; char* strcat (char* dest, const char* src); ; - .export _strcat - .import popax - .importzp ptr1, ptr2, tmp3 + .export _strcat + .import popax + .importzp ptr1, ptr2, tmp3 _strcat: - sta ptr1 ; Save src - stx ptr1+1 - jsr popax ; Get dest - sta ptr2 - stx ptr2+1 - sta tmp3 ; Remember for function return - ldy #0 + sta ptr1 ; Save src + stx ptr1+1 + jsr popax ; Get dest + sta ptr2 + stx ptr2+1 + sta tmp3 ; Remember for function return + ldy #0 ; find end of dest -sc1: lda (ptr2),y - beq sc2 - iny - bne sc1 - inc ptr2+1 - bne sc1 +sc1: lda (ptr2),y + beq sc2 + iny + bne sc1 + inc ptr2+1 + bne sc1 ; end found, get offset in y into pointer -sc2: tya - clc - adc ptr2 - sta ptr2 - bcc sc3 - inc ptr2+1 +sc2: tya + clc + adc ptr2 + sta ptr2 + bcc sc3 + inc ptr2+1 ; copy src -sc3: ldy #0 -sc4: lda (ptr1),y - sta (ptr2),y - beq sc5 - iny - bne sc4 - inc ptr1+1 - inc ptr2+1 - bne sc4 +sc3: ldy #0 +sc4: lda (ptr1),y + sta (ptr2),y + beq sc5 + iny + bne sc4 + inc ptr1+1 + inc ptr2+1 + bne sc4 ; done, return pointer to dest -sc5: lda tmp3 ; X does still contain high byte - rts +sc5: lda tmp3 ; X does still contain high byte + rts diff --git a/libsrc/common/strchr.s b/libsrc/common/strchr.s index d1761b905..308381b06 100644 --- a/libsrc/common/strchr.s +++ b/libsrc/common/strchr.s @@ -4,45 +4,45 @@ ; const char* strchr (const char* s, int c); ; - .export _strchr - .import popax - .importzp ptr1, tmp1 + .export _strchr + .import popax + .importzp ptr1, tmp1 _strchr: - sta tmp1 ; Save c - jsr popax ; get s - sta ptr1 - stx ptr1+1 - ldy #0 + sta tmp1 ; Save c + jsr popax ; get s + sta ptr1 + stx ptr1+1 + ldy #0 -Loop: lda (ptr1),y ; Get next char - beq EOS ; Jump on end of string - cmp tmp1 ; Found? - beq Found ; Jump if yes - iny - bne Loop - inc ptr1+1 - bne Loop ; Branch always +Loop: lda (ptr1),y ; Get next char + beq EOS ; Jump on end of string + cmp tmp1 ; Found? + beq Found ; Jump if yes + iny + bne Loop + inc ptr1+1 + bne Loop ; Branch always ; End of string. Check if we're searching for the terminating zero -EOS: lda tmp1 ; Get the char we're searching for - bne NotFound ; Jump if not searching for terminator +EOS: lda tmp1 ; Get the char we're searching for + bne NotFound ; Jump if not searching for terminator ; Found. Calculate pointer to c. -Found: ldx ptr1+1 ; Load high byte of pointer - tya ; Low byte offset - clc - adc ptr1 - bcc Found1 - inx -Found1: rts +Found: ldx ptr1+1 ; Load high byte of pointer + tya ; Low byte offset + clc + adc ptr1 + bcc Found1 + inx +Found1: rts ; Not found, return NULL NotFound: - lda #0 - tax - rts + lda #0 + tax + rts diff --git a/libsrc/common/strcmp.s b/libsrc/common/strcmp.s index db85d9bc3..189ce8fa7 100644 --- a/libsrc/common/strcmp.s +++ b/libsrc/common/strcmp.s @@ -4,32 +4,32 @@ ; int strcmp (const char* s1, const char* s2); ; - .export _strcmp - .import popax - .importzp ptr1, ptr2 + .export _strcmp + .import popax + .importzp ptr1, ptr2 _strcmp: - sta ptr2 ; Save s2 - stx ptr2+1 - jsr popax ; Get s1 - sta ptr1 - stx ptr1+1 - ldy #0 + sta ptr2 ; Save s2 + stx ptr2+1 + jsr popax ; Get s1 + sta ptr1 + stx ptr1+1 + ldy #0 -loop: lda (ptr1),y - cmp (ptr2),y - bne L1 - tax ; end of strings? - beq L3 - iny - bne loop - inc ptr1+1 - inc ptr2+1 - bne loop +loop: lda (ptr1),y + cmp (ptr2),y + bne L1 + tax ; end of strings? + beq L3 + iny + bne loop + inc ptr1+1 + inc ptr2+1 + bne loop -L1: bcs L2 - ldx #$FF - rts +L1: bcs L2 + ldx #$FF + rts -L2: ldx #$01 -L3: rts +L2: ldx #$01 +L3: rts diff --git a/libsrc/common/strcoll.s b/libsrc/common/strcoll.s index 664d1f483..9b2db2893 100644 --- a/libsrc/common/strcoll.s +++ b/libsrc/common/strcoll.s @@ -6,8 +6,8 @@ ; Since we don't have locales, this function is equivalent to strcmp. ; - .export _strcoll - .import _strcmp + .export _strcoll + .import _strcmp -_strcoll = _strcmp +_strcoll = _strcmp diff --git a/libsrc/common/strcpy.s b/libsrc/common/strcpy.s index a48f0e35a..77b39fe76 100644 --- a/libsrc/common/strcpy.s +++ b/libsrc/common/strcpy.s @@ -4,27 +4,27 @@ ; char* strcpy (char* dest, const char* src); ; - .export _strcpy - .import popax - .importzp ptr1, ptr2 + .export _strcpy + .import popax + .importzp ptr1, ptr2 _strcpy: - sta ptr1 ; Save src - stx ptr1+1 - jsr popax ; Get dest - sta ptr2 - stx ptr2+1 - ldy #$00 + sta ptr1 ; Save src + stx ptr1+1 + jsr popax ; Get dest + sta ptr2 + stx ptr2+1 + ldy #$00 -L1: lda (ptr1),y - sta (ptr2),y - beq L9 - iny - bne L1 - inc ptr1+1 - inc ptr2+1 - bne L1 +L1: lda (ptr1),y + sta (ptr2),y + beq L9 + iny + bne L1 + inc ptr1+1 + inc ptr2+1 + bne L1 -L9: lda ptr2 ; X still contains high byte - rts +L9: lda ptr2 ; X still contains high byte + rts diff --git a/libsrc/common/strcspn.s b/libsrc/common/strcspn.s index 6c1256101..8fd567ae4 100644 --- a/libsrc/common/strcspn.s +++ b/libsrc/common/strcspn.s @@ -4,50 +4,50 @@ ; size_t strcspn (const char* s1, const char* s2); ; - .export _strcspn - .import popax - .importzp ptr1, ptr2, tmp1, tmp2, tmp3 + .export _strcspn + .import popax + .importzp ptr1, ptr2, tmp1, tmp2, tmp3 _strcspn: - sta ptr2 ; Save s2 - stx ptr2+1 - jsr popax ; Get s1 - sta ptr1 - stx ptr1+1 - ldx #0 ; low counter byte - stx tmp1 ; high counter byte - ldy #$00 + sta ptr2 ; Save s2 + stx ptr2+1 + jsr popax ; Get s1 + sta ptr1 + stx ptr1+1 + ldx #0 ; low counter byte + stx tmp1 ; high counter byte + ldy #$00 -L1: lda (ptr1),y ; get next char from s1 - beq L6 ; jump if done - sta tmp2 ; save char - iny - bne L2 - inc ptr1+1 -L2: sty tmp3 ; save index into s1 +L1: lda (ptr1),y ; get next char from s1 + beq L6 ; jump if done + sta tmp2 ; save char + iny + bne L2 + inc ptr1+1 +L2: sty tmp3 ; save index into s1 - ldy #0 ; get index into s2 -L3: lda (ptr2),y ; - beq L4 ; jump if done - cmp tmp2 - beq L6 - iny - bne L3 + ldy #0 ; get index into s2 +L3: lda (ptr2),y ; + beq L4 ; jump if done + cmp tmp2 + beq L6 + iny + bne L3 ; The character was not found in s2. Increment the counter and start over -L4: ldy tmp3 ; reload index - inx - bne L1 - inc tmp1 - bne L1 +L4: ldy tmp3 ; reload index + inx + bne L1 + inc tmp1 + bne L1 ; The character was found, or we reached the end of s1. Return count of ; characters -L6: txa ; get low counter byte - ldx tmp1 ; get high counter byte - rts +L6: txa ; get low counter byte + ldx tmp1 ; get high counter byte + rts diff --git a/libsrc/common/strdup.s b/libsrc/common/strdup.s index 57cf91488..3ab07bda1 100644 --- a/libsrc/common/strdup.s +++ b/libsrc/common/strdup.s @@ -6,13 +6,13 @@ ; Note: The code knowns which zero page locations are used by malloc. ; - .importzp sp, tmp1, ptr4 - .import pushax, decsp4, incsp4 - .import _strlen, _malloc, _memcpy - .export _strdup + .importzp sp, tmp1, ptr4 + .import pushax, decsp4, incsp4 + .import _strlen, _malloc, _memcpy + .export _strdup .macpack cpu - .macpack generic + .macpack generic _strdup: @@ -20,66 +20,66 @@ _strdup: ; stack frame. To make this somewhat more efficient, create the stackframe ; as needed for the final call to the memcpy function. - pha ; decsp will destroy A (but not X) - jsr decsp4 ; Target/source + pha ; decsp will destroy A (but not X) + jsr decsp4 ; Target/source ; Store the pointer into the source slot - ldy #1 - txa - sta (sp),y - pla + ldy #1 + txa + sta (sp),y + pla .if (.cpu .bitand CPU_ISET_65SC02) - sta (sp) + sta (sp) .else - dey - sta (sp),y + dey + sta (sp),y .endif ; Get length of S (which is still in a/x) - jsr _strlen + jsr _strlen ; Calculate strlen(S)+1 (the space needed) - add #1 - bcc @L1 - inx + add #1 + bcc @L1 + inx ; Save the space we're about to allocate in ptr4 -@L1: sta ptr4 - stx ptr4+1 +@L1: sta ptr4 + stx ptr4+1 ; Allocate memory. _malloc will not use ptr4 - jsr _malloc + jsr _malloc ; Store the result into the target stack slot - ldy #2 - sta (sp),y ; Store low byte - sta tmp1 - txa ; Get high byte - iny - sta (sp),y ; Store high byte + ldy #2 + sta (sp),y ; Store low byte + sta tmp1 + txa ; Get high byte + iny + sta (sp),y ; Store high byte ; Check for a NULL pointer - ora tmp1 - beq OutOfMemory + ora tmp1 + beq OutOfMemory ; Copy the string. memcpy will return the target string which is exactly ; what we need here. It will also drop the allocated stack frame. - lda ptr4 - ldx ptr4+1 ; Load size - jmp _memcpy ; Copy string, drop stackframe + lda ptr4 + ldx ptr4+1 ; Load size + jmp _memcpy ; Copy string, drop stackframe ; Out of memory, return NULL (A = 0) OutOfMemory: - tax - jmp incsp4 ; Drop stack frame + tax + jmp incsp4 ; Drop stack frame diff --git a/libsrc/common/strerror.s b/libsrc/common/strerror.s index 98a5725b1..0f41331ea 100644 --- a/libsrc/common/strerror.s +++ b/libsrc/common/strerror.s @@ -5,16 +5,16 @@ ; /* Map an error number to an error message */ ; - .export _strerror - .import __sys_errlist + .export _strerror + .import __sys_errlist - .include "errno.inc" + .include "errno.inc" _strerror: - cpx #$00 ; High byte must be zero - bne @L1 ; Jump if invalid error - cmp #EMAX ; Valid error code (map EUNKNOWN to 0)? - bcc @L2 ; Jump if ok + cpx #$00 ; High byte must be zero + bne @L1 ; Jump if invalid error + cmp #EMAX ; Valid error code (map EUNKNOWN to 0)? + bcc @L2 ; Jump if ok ; The given error code is invalid @@ -22,14 +22,14 @@ _strerror: sta __errno lda #>EINVAL ; = 0 sta __errno+1 -; lda #$00 ; A contains zero: "Unknown error" +; lda #$00 ; A contains zero: "Unknown error" ; Load the pointer to the error message and return -@L2: asl a ; * 2 - tay - ldx __sys_errlist+1,y - lda __sys_errlist,y - rts +@L2: asl a ; * 2 + tay + ldx __sys_errlist+1,y + lda __sys_errlist,y + rts diff --git a/libsrc/common/strftime.c b/libsrc/common/strftime.c index baaa6fbe8..49d2677cf 100644 --- a/libsrc/common/strftime.c +++ b/libsrc/common/strftime.c @@ -162,9 +162,9 @@ size_t __fastcall__ strftime (char* buf, size_t bufsize, const char* format, case 'c': sprintf (arg, "%.3s %.3s%3d %02d:%02d:%02d %d", - days[tm->tm_wday], months[tm->tm_mon], - tm->tm_mday, tm->tm_hour, tm->tm_min, - tm->tm_sec, tm->tm_year + 1900); + days[tm->tm_wday], months[tm->tm_mon], + tm->tm_mday, tm->tm_hour, tm->tm_min, + tm->tm_sec, tm->tm_year + 1900); break; case 'd': diff --git a/libsrc/common/stricmp.s b/libsrc/common/stricmp.s index 03638c8e2..501d0b625 100644 --- a/libsrc/common/stricmp.s +++ b/libsrc/common/stricmp.s @@ -1,60 +1,60 @@ ; ; Ullrich von Bassewitz, 03.06.1998 ; -; int stricmp (const char* s1, const char* s2); /* DOS way */ -; int strcasecmp (const char* s1, const char* s2); /* UNIX way */ +; int stricmp (const char* s1, const char* s2); /* DOS way */ +; int strcasecmp (const char* s1, const char* s2); /* UNIX way */ ; - .export _stricmp, _strcasecmp - .import popax - .import __ctype - .importzp ptr1, ptr2, tmp1 + .export _stricmp, _strcasecmp + .import popax + .import __ctype + .importzp ptr1, ptr2, tmp1 .include "ctype.inc" _stricmp: _strcasecmp: - sta ptr2 ; Save s2 - stx ptr2+1 - jsr popax ; get s1 - sta ptr1 - stx ptr1+1 - ldy #0 + sta ptr2 ; Save s2 + stx ptr2+1 + jsr popax ; get s1 + sta ptr1 + stx ptr1+1 + ldy #0 -loop: lda (ptr2),y ; get char from second string - tax - lda __ctype,x ; get character classification - and #CT_LOWER ; lower case char? - beq L1 ; jump if no - txa ; get character back - clc - adc #<('A'-'a') ; make upper case char - tax ; -L1: stx tmp1 ; remember upper case equivalent +loop: lda (ptr2),y ; get char from second string + tax + lda __ctype,x ; get character classification + and #CT_LOWER ; lower case char? + beq L1 ; jump if no + txa ; get character back + clc + adc #<('A'-'a') ; make upper case char + tax ; +L1: stx tmp1 ; remember upper case equivalent - lda (ptr1),y ; get character from first string - tax - lda __ctype,x ; get character classification - and #CT_LOWER ; lower case char? - beq L2 ; jump if no - txa ; get character back - clc - adc #<('A'-'a') ; make upper case char - tax + lda (ptr1),y ; get character from first string + tax + lda __ctype,x ; get character classification + and #CT_LOWER ; lower case char? + beq L2 ; jump if no + txa ; get character back + clc + adc #<('A'-'a') ; make upper case char + tax -L2: cpx tmp1 ; compare characters - bne L3 - txa ; end of strings? - beq L5 ; a/x both zero - iny - bne loop - inc ptr1+1 - inc ptr2+1 - bne loop +L2: cpx tmp1 ; compare characters + bne L3 + txa ; end of strings? + beq L5 ; a/x both zero + iny + bne loop + inc ptr1+1 + inc ptr2+1 + bne loop -L3: bcs L4 - ldx #$FF - rts +L3: bcs L4 + ldx #$FF + rts -L4: ldx #$01 -L5: rts +L4: ldx #$01 +L5: rts diff --git a/libsrc/common/strlen.s b/libsrc/common/strlen.s index 6cef2eaf5..b583eea50 100644 --- a/libsrc/common/strlen.s +++ b/libsrc/common/strlen.s @@ -4,23 +4,23 @@ ; int strlen (const char* s); ; - .export _strlen - .importzp ptr1 + .export _strlen + .importzp ptr1 _strlen: - sta ptr1 ; Save s - stx ptr1+1 - ldx #0 ; YX used as counter - ldy #0 + sta ptr1 ; Save s + stx ptr1+1 + ldx #0 ; YX used as counter + ldy #0 -L1: lda (ptr1),y - beq L9 - iny - bne L1 - inc ptr1+1 - inx - bne L1 +L1: lda (ptr1),y + beq L9 + iny + bne L1 + inc ptr1+1 + inx + bne L1 -L9: tya ; get low byte of counter, hi's all set - rts +L9: tya ; get low byte of counter, hi's all set + rts diff --git a/libsrc/common/strlower.s b/libsrc/common/strlower.s index 28214b990..9df79b732 100644 --- a/libsrc/common/strlower.s +++ b/libsrc/common/strlower.s @@ -7,41 +7,41 @@ ; Non-ANSI ; - .export _strlower, _strlwr - .import popax - .import __ctype - .importzp ptr1, ptr2 + .export _strlower, _strlwr + .import popax + .import __ctype + .importzp ptr1, ptr2 .include "ctype.inc" _strlower: _strlwr: - sta ptr1 ; Save s (working copy) - stx ptr1+1 - sta ptr2 - sta ptr2+1 ; save function result - ldy #0 + sta ptr1 ; Save s (working copy) + stx ptr1+1 + sta ptr2 + sta ptr2+1 ; save function result + ldy #0 -loop: lda (ptr1),y ; get character - beq L9 ; jump if done - tax - lda __ctype,x ; get character classification - and #CT_UPPER ; upper case char? - beq L1 ; jump if no - txa ; get character back into accu - sec - sbc #<('A'-'a') ; make lower case char - sta (ptr1),y ; store back -L1: iny ; next char - bne loop - inc ptr1+1 ; handle offset overflow - bne loop ; branch always +loop: lda (ptr1),y ; get character + beq L9 ; jump if done + tax + lda __ctype,x ; get character classification + and #CT_UPPER ; upper case char? + beq L1 ; jump if no + txa ; get character back into accu + sec + sbc #<('A'-'a') ; make lower case char + sta (ptr1),y ; store back +L1: iny ; next char + bne loop + inc ptr1+1 ; handle offset overflow + bne loop ; branch always ; Done, return the argument string -L9: lda ptr2 - ldx ptr2+1 - rts +L9: lda ptr2 + ldx ptr2+1 + rts diff --git a/libsrc/common/strncat.s b/libsrc/common/strncat.s index 5171ad9b4..b7bb04b2a 100644 --- a/libsrc/common/strncat.s +++ b/libsrc/common/strncat.s @@ -4,69 +4,69 @@ ; char* strncat (char* dest, const char* src, size_t n); ; - .export _strncat - .import popax - .importzp ptr1, ptr2, ptr3, tmp1, tmp2 + .export _strncat + .import popax + .importzp ptr1, ptr2, ptr3, tmp1, tmp2 _strncat: - eor #$FF ; one's complement to count upwards - sta tmp1 - txa - eor #$FF - sta tmp2 - jsr popax ; get src - sta ptr1 - stx ptr1+1 - jsr popax ; get dest - sta ptr2 - stx ptr2+1 - sta ptr3 ; remember for function return - stx ptr3+1 - ldy #0 + eor #$FF ; one's complement to count upwards + sta tmp1 + txa + eor #$FF + sta tmp2 + jsr popax ; get src + sta ptr1 + stx ptr1+1 + jsr popax ; get dest + sta ptr2 + stx ptr2+1 + sta ptr3 ; remember for function return + stx ptr3+1 + ldy #0 ; find end of dest -L1: lda (ptr2),y - beq L2 - iny - bne L1 - inc ptr2+1 - bne L1 +L1: lda (ptr2),y + beq L2 + iny + bne L1 + inc ptr2+1 + bne L1 ; end found, get offset in y into pointer -L2: tya - clc - adc ptr2 - sta ptr2 - bcc L3 - inc ptr2+1 +L2: tya + clc + adc ptr2 + sta ptr2 + bcc L3 + inc ptr2+1 ; copy src. We've put the ones complement of the count into the counter, so ; we'll increment the counter on top of the loop -L3: ldy #0 - ldx tmp1 ; low counter byte +L3: ldy #0 + ldx tmp1 ; low counter byte -L4: inx - bne L5 - inc tmp2 - beq L6 ; jump if done -L5: lda (ptr1),y - sta (ptr2),y - beq L7 - iny - bne L4 - inc ptr1+1 - inc ptr2+1 - bne L4 +L4: inx + bne L5 + inc tmp2 + beq L6 ; jump if done +L5: lda (ptr1),y + sta (ptr2),y + beq L7 + iny + bne L4 + inc ptr1+1 + inc ptr2+1 + bne L4 ; done, set the trailing zero and return pointer to dest -L6: lda #0 - sta (ptr2),y -L7: lda ptr3 - ldx ptr3+1 - rts +L6: lda #0 + sta (ptr2),y +L7: lda ptr3 + ldx ptr3+1 + rts diff --git a/libsrc/common/strncmp.s b/libsrc/common/strncmp.s index 3af44fa69..1035e15b8 100644 --- a/libsrc/common/strncmp.s +++ b/libsrc/common/strncmp.s @@ -4,9 +4,9 @@ ; int strncmp (const char* s1, const char* s2, unsigned n); ; - .export _strncmp - .import popax - .importzp ptr1, ptr2, ptr3 + .export _strncmp + .import popax + .importzp ptr1, ptr2, ptr3 _strncmp: @@ -17,65 +17,65 @@ _strncmp: ; executing a more complex test in each iteration of the loop. We do also ; correct the value by one, so we can do the test on top of the loop. - eor #$FF - sta ptr3 - txa - eor #$FF - sta ptr3+1 + eor #$FF + sta ptr3 + txa + eor #$FF + sta ptr3+1 ; Get the remaining arguments - jsr popax ; get s2 - sta ptr2 - stx ptr2+1 - jsr popax ; get s1 - sta ptr1 - stx ptr1+1 + jsr popax ; get s2 + sta ptr2 + stx ptr2+1 + jsr popax ; get s1 + sta ptr1 + stx ptr1+1 ; Loop setup - ldy #0 + ldy #0 ; Start of compare loop. Check the counter. -Loop: inc ptr3 - beq IncHi ; Increment high byte +Loop: inc ptr3 + beq IncHi ; Increment high byte ; Compare a byte from the strings -Comp: lda (ptr1),y - cmp (ptr2),y - bne NotEqual ; Jump if strings different - tax ; End of strings? - beq Equal1 ; Jump if EOS reached, a/x == 0 +Comp: lda (ptr1),y + cmp (ptr2),y + bne NotEqual ; Jump if strings different + tax ; End of strings? + beq Equal1 ; Jump if EOS reached, a/x == 0 ; Increment the pointers - iny - bne Loop - inc ptr1+1 - inc ptr2+1 - bne Loop ; Branch always + iny + bne Loop + inc ptr1+1 + inc ptr2+1 + bne Loop ; Branch always ; Increment hi byte -IncHi: inc ptr3+1 - bne Comp ; Jump if counter not zero +IncHi: inc ptr3+1 + bne Comp ; Jump if counter not zero ; Exit code if strings are equal. a/x not set -Equal: lda #$00 - tax -Equal1: rts +Equal: lda #$00 + tax +Equal1: rts ; Exit code if strings not equal NotEqual: - bcs L1 - ldx #$FF ; Make result negative - rts + bcs L1 + ldx #$FF ; Make result negative + rts -L1: ldx #$01 ; Make result positive - rts +L1: ldx #$01 ; Make result positive + rts diff --git a/libsrc/common/strncpy.s b/libsrc/common/strncpy.s index 21de3a159..042f9e28b 100644 --- a/libsrc/common/strncpy.s +++ b/libsrc/common/strncpy.s @@ -4,9 +4,9 @@ ; char* __fastcall__ strncpy (char* dest, const char* src, unsigned size); ; - .export _strncpy - .import popax - .importzp ptr1, ptr2, tmp1, tmp2, tmp3 + .export _strncpy + .import popax + .importzp ptr1, ptr2, tmp1, tmp2, tmp3 .proc _strncpy @@ -16,18 +16,18 @@ eor #$FF sta tmp2 ; Store -size - 1 - jsr popax ; get src - sta ptr1 - stx ptr1+1 - jsr popax ; get dest - sta ptr2 - stx ptr2+1 - stx tmp3 ; remember for function return + jsr popax ; get src + sta ptr1 + stx ptr1+1 + jsr popax ; get dest + sta ptr2 + stx ptr2+1 + stx tmp3 ; remember for function return ; Copy src -> dest up to size bytes ldx tmp1 ; Load low byte of ones complement of size - ldy #$00 + ldy #$00 L1: inx bne L2 inc tmp2 diff --git a/libsrc/common/strnicmp.s b/libsrc/common/strnicmp.s index 38bd21c73..b1f973e3a 100644 --- a/libsrc/common/strnicmp.s +++ b/libsrc/common/strnicmp.s @@ -6,9 +6,9 @@ ; int __fastcall__ strncasecmp (const char* s1, const char* s2, size_t count); ; - .export _strnicmp, _strncasecmp - .import popax, __ctype - .importzp ptr1, ptr2, ptr3, tmp1 + .export _strnicmp, _strncasecmp + .import popax, __ctype + .importzp ptr1, ptr2, ptr3, tmp1 .include "ctype.inc" @@ -21,83 +21,83 @@ _strncasecmp: ; executing a more complex test in each iteration of the loop. We do also ; correct the value by one, so we can do the test on top of the loop. - eor #$FF - sta ptr3 - txa - eor #$FF - sta ptr3+1 + eor #$FF + sta ptr3 + txa + eor #$FF + sta ptr3+1 ; Get the remaining arguments - jsr popax ; get s2 - sta ptr2 - stx ptr2+1 - jsr popax ; get s1 - sta ptr1 - stx ptr1+1 + jsr popax ; get s2 + sta ptr2 + stx ptr2+1 + jsr popax ; get s1 + sta ptr1 + stx ptr1+1 ; Loop setup - ldy #0 + ldy #0 ; Start of compare loop. Check the counter. -Loop: inc ptr3 - beq IncHi ; Increment high byte +Loop: inc ptr3 + beq IncHi ; Increment high byte ; Compare a byte from the strings -Comp: lda (ptr2),y - tax - lda __ctype,x ; get character classification - and #CT_LOWER ; lower case char? - beq L1 ; jump if no - txa ; get character back - sec - sbc #<('a'-'A') ; make upper case char - tax ; -L1: stx tmp1 ; remember upper case equivalent +Comp: lda (ptr2),y + tax + lda __ctype,x ; get character classification + and #CT_LOWER ; lower case char? + beq L1 ; jump if no + txa ; get character back + sec + sbc #<('a'-'A') ; make upper case char + tax ; +L1: stx tmp1 ; remember upper case equivalent - lda (ptr1),y ; get character from first string - tax - lda __ctype,x ; get character classification - and #CT_LOWER ; lower case char? - beq L2 ; jump if no - txa ; get character back - sec - sbc #<('a'-'A') ; make upper case char - tax + lda (ptr1),y ; get character from first string + tax + lda __ctype,x ; get character classification + and #CT_LOWER ; lower case char? + beq L2 ; jump if no + txa ; get character back + sec + sbc #<('a'-'A') ; make upper case char + tax -L2: cpx tmp1 ; compare characters - bne NotEqual ; Jump if strings different - txa ; End of strings? - beq Equal1 ; Jump if EOS reached, a/x == 0 +L2: cpx tmp1 ; compare characters + bne NotEqual ; Jump if strings different + txa ; End of strings? + beq Equal1 ; Jump if EOS reached, a/x == 0 ; Increment the pointers - iny - bne Loop - inc ptr1+1 - inc ptr2+1 - bne Loop ; Branch always + iny + bne Loop + inc ptr1+1 + inc ptr2+1 + bne Loop ; Branch always ; Increment hi byte -IncHi: inc ptr3+1 - bne Comp ; Jump if counter not zero +IncHi: inc ptr3+1 + bne Comp ; Jump if counter not zero ; Exit code if strings are equal. a/x not set -Equal: lda #$00 - tax -Equal1: rts +Equal: lda #$00 + tax +Equal1: rts ; Exit code if strings not equal NotEqual: - bcs L3 - ldx #$FF ; Make result negative - rts + bcs L3 + ldx #$FF ; Make result negative + rts -L3: ldx #$01 ; Make result positive - rts +L3: ldx #$01 ; Make result positive + rts diff --git a/libsrc/common/stroserr.s b/libsrc/common/stroserr.s index c410b54d3..25ca30daf 100644 --- a/libsrc/common/stroserr.s +++ b/libsrc/common/stroserr.s @@ -5,8 +5,8 @@ ; /* Map an operating system error number to an error message. */ ; - .export __stroserror - .import __sys_oserrlist + .export __stroserror + .import __sys_oserrlist .importzp ptr1, tmp1 .macpack generic diff --git a/libsrc/common/strpbrk.s b/libsrc/common/strpbrk.s index e34468b53..5d1482913 100644 --- a/libsrc/common/strpbrk.s +++ b/libsrc/common/strpbrk.s @@ -1,59 +1,59 @@ -; +; ; Ullrich von Bassewitz, 11.06.1998 ; ; char* strpbrk (const char* s1, const char* s2); ; - .export _strpbrk - .import popax, return0 - .importzp ptr1, ptr2, tmp1, tmp2, tmp3 + .export _strpbrk + .import popax, return0 + .importzp ptr1, ptr2, tmp1, tmp2, tmp3 _strpbrk: - jsr popax ; get s2 - sta ptr2 - stx ptr2+1 - jsr popax ; get s1 - sta ptr1 - stx ptr1+1 - ldy #$00 + jsr popax ; get s2 + sta ptr2 + stx ptr2+1 + jsr popax ; get s1 + sta ptr1 + stx ptr1+1 + ldy #$00 -L1: lda (ptr1),y ; get next char from s1 - beq L9 ; jump if done - sta tmp2 ; save char - iny - bne L2 - inc ptr1+1 -L2: sty tmp3 ; save index into s1 +L1: lda (ptr1),y ; get next char from s1 + beq L9 ; jump if done + sta tmp2 ; save char + iny + bne L2 + inc ptr1+1 +L2: sty tmp3 ; save index into s1 - ldy #0 ; get index into s2 -L3: lda (ptr2),y ; - beq L4 ; jump if done - cmp tmp2 - beq L6 - iny - bne L3 + ldy #0 ; get index into s2 +L3: lda (ptr2),y ; + beq L4 ; jump if done + cmp tmp2 + beq L6 + iny + bne L3 ; The character was not found in s2. Increment the counter and start over -L4: ldy tmp3 ; reload index - inx - bne L1 - inc tmp1 - bne L1 +L4: ldy tmp3 ; reload index + inx + bne L1 + inc tmp1 + bne L1 ; A character was found. Calculate a pointer to this char in s1 and return it. -L6: ldx ptr1+1 - lda tmp3 ; get y offset - clc - adc ptr1 - bcc L7 - inx -L7: rts +L6: ldx ptr1+1 + lda tmp3 ; get y offset + clc + adc ptr1 + bcc L7 + inx +L7: rts ; None of the characters in s2 was found - return NULL -L9: jmp return0 +L9: jmp return0 diff --git a/libsrc/common/strrchr.s b/libsrc/common/strrchr.s index bf09fbd7b..bd7389e76 100644 --- a/libsrc/common/strrchr.s +++ b/libsrc/common/strrchr.s @@ -4,44 +4,44 @@ ; char* strrchr (const char* s, int c); ; - .export _strrchr - .import popax - .importzp ptr1, ptr2, tmp1 + .export _strrchr + .import popax + .importzp ptr1, ptr2, tmp1 _strrchr: - sta tmp1 ; Save c - jsr popax ; get s - sta ptr1 - stx ptr1+1 - lda #0 ; function result = NULL - sta ptr2 - sta ptr2+1 - tay + sta tmp1 ; Save c + jsr popax ; get s + sta ptr1 + stx ptr1+1 + lda #0 ; function result = NULL + sta ptr2 + sta ptr2+1 + tay -L1: lda (ptr1),y ; get next char - beq L3 ; jump if end of string - cmp tmp1 ; found? - bne L2 ; jump if no +L1: lda (ptr1),y ; get next char + beq L3 ; jump if end of string + cmp tmp1 ; found? + bne L2 ; jump if no ; Remember a pointer to the character - tya - clc - adc ptr1 - sta ptr2 - lda ptr1+1 - adc #$00 - sta ptr2+1 + tya + clc + adc ptr1 + sta ptr2 + lda ptr1+1 + adc #$00 + sta ptr2+1 ; Next char -L2: iny - bne L1 - inc ptr1+1 - bne L1 ; jump always +L2: iny + bne L1 + inc ptr1+1 + bne L1 ; jump always ; Return the pointer to the last occurrence -L3: lda ptr2 - ldx ptr2+1 - rts +L3: lda ptr2 + ldx ptr2+1 + rts diff --git a/libsrc/common/strspn.s b/libsrc/common/strspn.s index 884a3376a..f8b8fff2a 100644 --- a/libsrc/common/strspn.s +++ b/libsrc/common/strspn.s @@ -4,50 +4,50 @@ ; size_t strspn (const char* s1, const char* s2); ; - .export _strspn - .import popax - .importzp ptr1, ptr2, tmp1, tmp2, tmp3 + .export _strspn + .import popax + .importzp ptr1, ptr2, tmp1, tmp2, tmp3 _strspn: - sta ptr2 ; Save s2 - stx ptr2+1 - jsr popax ; get s1 - sta ptr1 - stx ptr1+1 - ldx #0 ; low counter byte - stx tmp1 ; high counter byte - ldy #$00 + sta ptr2 ; Save s2 + stx ptr2+1 + jsr popax ; get s1 + sta ptr1 + stx ptr1+1 + ldx #0 ; low counter byte + stx tmp1 ; high counter byte + ldy #$00 -L1: lda (ptr1),y ; get next char from s1 - beq L6 ; jump if done - sta tmp2 ; save char - iny - bne L2 - inc ptr1+1 -L2: sty tmp3 ; save index into s1 +L1: lda (ptr1),y ; get next char from s1 + beq L6 ; jump if done + sta tmp2 ; save char + iny + bne L2 + inc ptr1+1 +L2: sty tmp3 ; save index into s1 - ldy #0 ; get index into s2 -L3: lda (ptr2),y ; - beq L6 ; jump if done - cmp tmp2 - beq L4 - iny - bne L3 + ldy #0 ; get index into s2 +L3: lda (ptr2),y ; + beq L6 ; jump if done + cmp tmp2 + beq L4 + iny + bne L3 ; The character was found in s2. Increment the counter and start over -L4: ldy tmp3 ; reload index - inx - bne L1 - inc tmp1 - bne L1 +L4: ldy tmp3 ; reload index + inx + bne L1 + inc tmp1 + bne L1 ; The character was not found, or we reached the end of s1. Return count of ; characters -L6: txa ; get low counter byte - ldx tmp1 ; get high counter byte - rts +L6: txa ; get low counter byte + ldx tmp1 ; get high counter byte + rts diff --git a/libsrc/common/strstr.s b/libsrc/common/strstr.s index 62e1944ec..55e2def03 100644 --- a/libsrc/common/strstr.s +++ b/libsrc/common/strstr.s @@ -4,86 +4,86 @@ ; char* strstr (const char* haystack, const char* needle); ; - .export _strstr - .import popax - .importzp ptr1, ptr2, ptr3, ptr4, tmp1 + .export _strstr + .import popax + .importzp ptr1, ptr2, ptr3, ptr4, tmp1 _strstr: - sta ptr2 ; Save needle - stx ptr2+1 - sta ptr4 ; Setup temp copy for later + sta ptr2 ; Save needle + stx ptr2+1 + sta ptr4 ; Setup temp copy for later - jsr popax ; Get haystack - sta ptr1 - stx ptr1+1 ; Save haystack + jsr popax ; Get haystack + sta ptr1 + stx ptr1+1 ; Save haystack ; If needle is empty, return haystack - ldy #$00 - lda (ptr2),y ; Get first byte of needle - beq @Found ; Needle is empty --> we're done + ldy #$00 + lda (ptr2),y ; Get first byte of needle + beq @Found ; Needle is empty --> we're done ; Search for the beginning of the string (this is not an optimal search ; strategy [in fact, it's pretty dumb], but it's simple to implement). - sta tmp1 ; Save start of needle -@L1: lda (ptr1),y ; Get next char from haystack - beq @NotFound ; Jump if end - cmp tmp1 ; Start of needle found? - beq @L2 ; Jump if so - iny ; Next char - bne @L1 - inc ptr1+1 ; Bump high byte - bne @L1 ; Branch always + sta tmp1 ; Save start of needle +@L1: lda (ptr1),y ; Get next char from haystack + beq @NotFound ; Jump if end + cmp tmp1 ; Start of needle found? + beq @L2 ; Jump if so + iny ; Next char + bne @L1 + inc ptr1+1 ; Bump high byte + bne @L1 ; Branch always ; We found the start of needle in haystack -@L2: tya ; Get offset - clc - adc ptr1 - sta ptr1 ; Make ptr1 point to start - bcc @L3 - inc ptr1+1 +@L2: tya ; Get offset + clc + adc ptr1 + sta ptr1 ; Make ptr1 point to start + bcc @L3 + inc ptr1+1 ; ptr1 points to the start of needle now. Setup temporary pointers for the ; search. The low byte of ptr4 is already set. -@L3: sta ptr3 - lda ptr1+1 - sta ptr3+1 - lda ptr2+1 - sta ptr4+1 - ldy #1 ; First char is identical, so start on second +@L3: sta ptr3 + lda ptr1+1 + sta ptr3+1 + lda ptr2+1 + sta ptr4+1 + ldy #1 ; First char is identical, so start on second ; Do the compare -@L4: lda (ptr4),y ; Get char from needle - beq @Found ; Jump if end of needle (-> found) - cmp (ptr3),y ; Compare with haystack - bne @L5 ; Jump if not equal - iny ; Next char - bne @L4 - inc ptr3+1 - inc ptr4+1 ; Bump hi byte of pointers - bne @L4 ; Next char (branch always) +@L4: lda (ptr4),y ; Get char from needle + beq @Found ; Jump if end of needle (-> found) + cmp (ptr3),y ; Compare with haystack + bne @L5 ; Jump if not equal + iny ; Next char + bne @L4 + inc ptr3+1 + inc ptr4+1 ; Bump hi byte of pointers + bne @L4 ; Next char (branch always) ; The strings did not compare equal, search next start of needle -@L5: ldy #1 ; Start after this char - bne @L1 ; Branch always +@L5: ldy #1 ; Start after this char + bne @L1 ; Branch always ; We found the start of needle -@Found: lda ptr1 - ldx ptr1+1 - rts +@Found: lda ptr1 + ldx ptr1+1 + rts ; We reached end of haystack without finding needle @NotFound: - lda #$00 ; return NULL - tax - rts + lda #$00 ; return NULL + tax + rts diff --git a/libsrc/common/strtoimax.s b/libsrc/common/strtoimax.s index 10c0d428c..122547fb3 100644 --- a/libsrc/common/strtoimax.s +++ b/libsrc/common/strtoimax.s @@ -5,5 +5,5 @@ ; .import _strtol - .export _strtoimax = _strtol + .export _strtoimax = _strtol diff --git a/libsrc/common/strtok.c b/libsrc/common/strtok.c index 3e5ff7dd5..30e3e81e4 100644 --- a/libsrc/common/strtok.c +++ b/libsrc/common/strtok.c @@ -11,7 +11,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -22,7 +22,7 @@ static char* Last = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -34,24 +34,24 @@ char* __fastcall__ strtok (register char* s1, const char* s2) /* Use the stored location if called with a NULL pointer */ if (s1 == 0) { - s1 = Last; + s1 = Last; } /* If s1 is empty, there are no more tokens. Return 0 in this case. */ if (*s1 == '\0') { - return 0; + return 0; } /* Search the address of the first element in s1 that equals none * of the characters in s2. */ while ((c = *s1) && strchr (s2, c) != 0) { - ++s1; + ++s1; } if (c == '\0') { - /* No more tokens found */ - Last = s1; - return 0; + /* No more tokens found */ + Last = s1; + return 0; } /* Remember the start of the token */ @@ -59,14 +59,14 @@ char* __fastcall__ strtok (register char* s1, const char* s2) /* Search for the end of the token */ while ((c = *s1) && strchr (s2, c) == 0) { - ++s1; + ++s1; } if (c == '\0') { - /* Last element */ - Last = s1; + /* Last element */ + Last = s1; } else { - *s1 = '\0'; - Last = s1 + 1; + *s1 = '\0'; + Last = s1 + 1; } /* Return the start of the token */ diff --git a/libsrc/common/strtoumax.s b/libsrc/common/strtoumax.s index c59d51c3c..89ea18b6b 100644 --- a/libsrc/common/strtoumax.s +++ b/libsrc/common/strtoumax.s @@ -5,5 +5,5 @@ ; .import _strtoul - .export _strtoumax = _strtoul + .export _strtoumax = _strtoul diff --git a/libsrc/common/strupper.s b/libsrc/common/strupper.s index e33b28675..d7aa2f914 100644 --- a/libsrc/common/strupper.s +++ b/libsrc/common/strupper.s @@ -7,41 +7,41 @@ ; Non-ANSI ; - .export _strupper, _strupr - .import popax - .import __ctype - .importzp ptr1, ptr2 + .export _strupper, _strupr + .import popax + .import __ctype + .importzp ptr1, ptr2 .include "ctype.inc" _strupper: _strupr: - sta ptr1 ; Save s (working copy) - stx ptr1+1 - sta ptr2 - sta ptr2+1 ; save function result - ldy #0 + sta ptr1 ; Save s (working copy) + stx ptr1+1 + sta ptr2 + sta ptr2+1 ; save function result + ldy #0 -loop: lda (ptr1),y ; get character - beq L9 ; jump if done - tax - lda __ctype,x ; get character classification - and #CT_LOWER ; lower case char? - beq L1 ; jump if no - txa ; get character back into accu - clc - adc #<('A'-'a') ; make upper case char - sta (ptr1),y ; store back -L1: iny ; next char - bne loop - inc ptr1+1 ; handle offset overflow - bne loop ; branch always +loop: lda (ptr1),y ; get character + beq L9 ; jump if done + tax + lda __ctype,x ; get character classification + and #CT_LOWER ; lower case char? + beq L1 ; jump if no + txa ; get character back into accu + clc + adc #<('A'-'a') ; make upper case char + sta (ptr1),y ; store back +L1: iny ; next char + bne loop + inc ptr1+1 ; handle offset overflow + bne loop ; branch always ; Done, return the argument string -L9: lda ptr2 - ldx ptr2+1 - rts +L9: lda ptr2 + ldx ptr2+1 + rts diff --git a/libsrc/common/time.s b/libsrc/common/time.s index 00171a82a..2157eb49f 100644 --- a/libsrc/common/time.s +++ b/libsrc/common/time.s @@ -4,7 +4,7 @@ ; time_t __fastcall__ time (time_t* timep); ; - .export _time + .export _time .import __systime .importzp ptr1, sreg, tmp1 diff --git a/libsrc/common/tolower.s b/libsrc/common/tolower.s index f44aa9cad..2c624cb74 100644 --- a/libsrc/common/tolower.s +++ b/libsrc/common/tolower.s @@ -4,18 +4,18 @@ ; int tolower (int c); ; - .export _tolower - .import __ctype + .export _tolower + .import __ctype _tolower: cpx #$00 ; Outside valid range? bne L9 ; If so, return the argument unchanged - tay ; Get C into Y - lda __ctype,y ; Get character classification - lsr a - lsr a ; Get bit 1 (upper case char) into carry - tya ; Get char back into A - bcc L9 ; Jump if no upper case char - sbc #<('A'-'a') ; Make lower case char (carry already set) -L9: rts + tay ; Get C into Y + lda __ctype,y ; Get character classification + lsr a + lsr a ; Get bit 1 (upper case char) into carry + tya ; Get char back into A + bcc L9 ; Jump if no upper case char + sbc #<('A'-'a') ; Make lower case char (carry already set) +L9: rts diff --git a/libsrc/common/toupper.s b/libsrc/common/toupper.s index adc3d4a33..da1ee0427 100644 --- a/libsrc/common/toupper.s +++ b/libsrc/common/toupper.s @@ -4,18 +4,18 @@ ; int toupper (int c); ; - .export _toupper - .import __ctype + .export _toupper + .import __ctype _toupper: cpx #$00 ; Outside valid range? bne L9 ; If so, return the argument unchanged - tay ; Get c into Y - lda __ctype,y ; Get character classification - lsr a ; Get bit 0 (lower char) into carry - tya ; Get C back into A - bcc L9 ; Jump if not lower char - clc - adc #<('A'-'a') ; make upper case char -L9: rts ; CC are set + tay ; Get c into Y + lda __ctype,y ; Get character classification + lsr a ; Get bit 0 (lower char) into carry + tya ; Get C back into A + bcc L9 ; Jump if not lower char + clc + adc #<('A'-'a') ; make upper case char +L9: rts ; CC are set diff --git a/libsrc/common/ungetc.s b/libsrc/common/ungetc.s index 0ad12e3a2..386c450a8 100644 --- a/libsrc/common/ungetc.s +++ b/libsrc/common/ungetc.s @@ -36,10 +36,10 @@ ; Check if the file is open - ldy #_FILE::f_flags - lda (ptr1),y - and #_FOPEN ; Is the file open? - beq error ; Branch if no + ldy #_FILE::f_flags + lda (ptr1),y + and #_FOPEN ; Is the file open? + beq error ; Branch if no ; Set the pushback flag and reset the end-of-file indicator diff --git a/libsrc/common/vfprintf.s b/libsrc/common/vfprintf.s index 881bf9b42..9812f661b 100644 --- a/libsrc/common/vfprintf.s +++ b/libsrc/common/vfprintf.s @@ -5,12 +5,12 @@ ; 2005-02-08, Ullrich von Bassewitz ; 2005-02-11, Greg King - .export _vfprintf - .import push1, pushwysp, incsp6 - .import _fwrite, __printf - .importzp sp, ptr1 + .export _vfprintf + .import push1, pushwysp, incsp6 + .import _fwrite, __printf + .importzp sp, ptr1 - .macpack generic + .macpack generic .data @@ -19,10 +19,10 @@ ; Static data for the _vfprintf routine ; outdesc: ; Static outdesc structure -ccount: .res 2 - .word out ; Output function pointer -ptr: .res 2 ; Points to output file - .res 2 ; (Not used by this function) +ccount: .res 2 + .word out ; Output function pointer +ptr: .res 2 ; Points to output file + .res 2 ; (Not used by this function) .code @@ -57,21 +57,21 @@ out: ldy #5 jsr pushwysp ; Push count lda ptr ldx ptr+1 - jsr _fwrite - sta ptr1 ; Save function result - stx ptr1+1 + jsr _fwrite + sta ptr1 ; Save function result + stx ptr1+1 ; Check the return value. ora ptr1+1 - bne @Ok + bne @Ok ; We had an error. Store -1 into ccount .ifp02 - lda #<-1 + lda #<-1 .else - dec a + dec a .endif sta ccount bne @Done ; Branch always @@ -109,37 +109,37 @@ out: ldy #5 ; } ; _vfprintf: - pha ; Save low byte of ap + pha ; Save low byte of ap ; Setup the outdesc structure - lda #0 - sta ccount - sta ccount+1 ; Clear character-count + lda #0 + sta ccount + sta ccount+1 ; Clear character-count ; Reorder the stack. Replace f on the stack by &d, so the stack frame is ; exactly as _printf expects it. Parameters will get dropped by _printf. - ldy #2 - lda (sp),y ; Low byte of f - sta ptr - lda #outdesc - sta (sp),y + lda (sp),y ; High byte of f + sta ptr+1 + lda #>outdesc + sta (sp),y ; Restore low byte of ap and call _printf pla - jsr __printf + jsr __printf ; Return the number of bytes written - lda ccount - ldx ccount+1 + lda ccount + ldx ccount+1 rts diff --git a/libsrc/common/vfscanf.s b/libsrc/common/vfscanf.s index 44b05ef83..2123085c8 100644 --- a/libsrc/common/vfscanf.s +++ b/libsrc/common/vfscanf.s @@ -5,7 +5,7 @@ ; 2004-12-21, Greg King ; - .export _vfscanf + .export _vfscanf .import _fgetc, _ungetc, _ferror .include "zeropage.inc" @@ -22,8 +22,8 @@ count := ptr3 ; Result of scan .data d: .addr _fgetc ; GET - .addr _ungetc ; UNGET - .addr 0 ; data + .addr _ungetc ; UNGET + .addr 0 ; data ; ---------------------------------------------------------------------------- diff --git a/libsrc/common/vprintf.s b/libsrc/common/vprintf.s index 99e8018f9..0958b1038 100644 --- a/libsrc/common/vprintf.s +++ b/libsrc/common/vprintf.s @@ -4,10 +4,10 @@ ; int __fastcall__ vprintf (const char* format, va_list ap); ; - .export _vprintf + .export _vprintf .import _vfprintf, _stdout - .import decsp2 - .importzp sp + .import decsp2 + .importzp sp .proc _vprintf diff --git a/libsrc/common/vscanf.s b/libsrc/common/vscanf.s index 038b79741..94afe527f 100644 --- a/libsrc/common/vscanf.s +++ b/libsrc/common/vscanf.s @@ -4,7 +4,7 @@ ; Ullrich von Bassewitz, 2004-11-27 ; - .export _vscanf + .export _vscanf .import _vfscanf .import _stdin .import decsp2 diff --git a/libsrc/common/vsnprintf.s b/libsrc/common/vsnprintf.s index 21c358780..db82bdaf3 100644 --- a/libsrc/common/vsnprintf.s +++ b/libsrc/common/vsnprintf.s @@ -4,12 +4,12 @@ ; Ullrich von Bassewitz, 2009-09-26 ; - .export _vsnprintf, vsnprintf - .import ldaxysp, popax, incsp2, incsp6 - .import _memcpy, __printf - .importzp sp, ptr1 + .export _vsnprintf, vsnprintf + .import ldaxysp, popax, incsp2, incsp6 + .import _memcpy, __printf + .importzp sp, ptr1 - .macpack generic + .macpack generic .data @@ -18,10 +18,10 @@ ; Static data for the _vsnprintf routine ; -outdesc: ; Static outdesc structure +outdesc: ; Static outdesc structure ccount: .word 0 ; ccount -func: .word out ; Output function pointer -bufptr: .word 0 ; ptr +func: .word out ; Output function pointer +bufptr: .word 0 ; ptr bufsize:.word 0 ; Buffer size .code @@ -33,7 +33,7 @@ bufsize:.word 0 ; Buffer size ; _vsnprintf: - pha ; Save ap + pha ; Save ap txa pha @@ -41,9 +41,9 @@ _vsnprintf: ; vsprintf with ap on stack vsnprintf: - lda #0 - sta ccount+0 - sta ccount+1 ; Clear ccount + lda #0 + sta ccount+0 + sta ccount+1 ; Clear ccount ; Get the size parameter and replace it by a pointer to outdesc. This is to ; build a stack frame for the call to _printf. @@ -85,10 +85,10 @@ L1: dex ; Restore ap and call _printf - pla + pla tax pla - jsr __printf + jsr __printf ; Terminate the string. The last char is either at bufptr+ccount or ; bufptr+bufsize, whichever is smaller. @@ -116,7 +116,7 @@ L3: adc bufptr+0 lda ccount+0 ldx ccount+1 - jmp incsp2 + jmp incsp2 ; Bail out if size is zero. diff --git a/libsrc/common/vsprintf.s b/libsrc/common/vsprintf.s index f1a2fe5d8..eb47dae18 100644 --- a/libsrc/common/vsprintf.s +++ b/libsrc/common/vsprintf.s @@ -4,9 +4,9 @@ ; Ullrich von Bassewitz, 2009-09-26 ; - .export _vsprintf - .import pushw0sp, staxysp - .import vsnprintf + .export _vsprintf + .import pushw0sp, staxysp + .import vsnprintf ; ---------------------------------------------------------------------------- @@ -17,7 +17,7 @@ _vsprintf: - pha ; Save low byte of ap + pha ; Save low byte of ap txa pha ; Save high byte of op diff --git a/libsrc/common/vsscanf.s b/libsrc/common/vsscanf.s index d6123bef6..a04404a0a 100644 --- a/libsrc/common/vsscanf.s +++ b/libsrc/common/vsscanf.s @@ -6,12 +6,12 @@ ; 2004-12-21, Greg King ; - .export _vsscanf + .export _vsscanf - .import popax, __scanf - .importzp sp, ptr1, ptr2 + .import popax, __scanf + .importzp sp, ptr1, ptr2 - .macpack generic + .macpack generic ; ---------------------------------------------------------------------------- diff --git a/libsrc/common/zerobss.s b/libsrc/common/zerobss.s index 321424efa..de160aeef 100644 --- a/libsrc/common/zerobss.s +++ b/libsrc/common/zerobss.s @@ -4,43 +4,43 @@ ; Zero the bss segment. ; - .export zerobss - .import __BSS_RUN__, __BSS_SIZE__ - .importzp ptr1 + .export zerobss + .import __BSS_RUN__, __BSS_SIZE__ + .importzp ptr1 .segment "INIT" zerobss: - lda #<__BSS_RUN__ - sta ptr1 - lda #>__BSS_RUN__ - sta ptr1+1 - lda #0 - tay + lda #<__BSS_RUN__ + sta ptr1 + lda #>__BSS_RUN__ + sta ptr1+1 + lda #0 + tay ; Clear full pages -L1: ldx #>__BSS_SIZE__ - beq L3 -L2: sta (ptr1),y - iny - bne L2 - inc ptr1+1 - dex - bne L2 +L1: ldx #>__BSS_SIZE__ + beq L3 +L2: sta (ptr1),y + iny + bne L2 + inc ptr1+1 + dex + bne L2 ; Clear remaining page (y is zero on entry) -L3: cpy #<__BSS_SIZE__ - beq L4 - sta (ptr1),y - iny - bne L3 +L3: cpy #<__BSS_SIZE__ + beq L4 + sta (ptr1),y + iny + bne L3 ; Done -L4: rts +L4: rts diff --git a/libsrc/conio/_cursor.s b/libsrc/conio/_cursor.s index 1e56bdb98..eb1bb700e 100644 --- a/libsrc/conio/_cursor.s +++ b/libsrc/conio/_cursor.s @@ -4,10 +4,10 @@ ; Cursor related variables ; - .export cursor + .export cursor .bss -cursor: .res 1 +cursor: .res 1 diff --git a/libsrc/conio/cprintf.s b/libsrc/conio/cprintf.s index d5e569153..01bd0bbc6 100644 --- a/libsrc/conio/cprintf.s +++ b/libsrc/conio/cprintf.s @@ -4,18 +4,18 @@ ; Ullrich von Bassewitz, 1.12.2000 ; - .export _cprintf - .import pushax, addysp, _vcprintf - .importzp sp, ptr1 + .export _cprintf + .import pushax, addysp, _vcprintf + .importzp sp, ptr1 - .macpack generic + .macpack generic ; ---------------------------------------------------------------------------- ; Data .bss -ParamSize: .res 1 ; Number of parameter bytes +ParamSize: .res 1 ; Number of parameter bytes ; ---------------------------------------------------------------------------- ; Code @@ -24,41 +24,41 @@ ParamSize: .res 1 ; Number of parameter bytes _cprintf: - sty ParamSize ; Number of param bytes passed in Y + sty ParamSize ; Number of param bytes passed in Y ; Calculate a pointer that points to Format - dey - dey ; Sub size of Format - tya - add sp - sta ptr1 - ldx sp+1 - bcc @L1 - inx -@L1: stx ptr1+1 + dey + dey ; Sub size of Format + tya + add sp + sta ptr1 + ldx sp+1 + bcc @L1 + inx +@L1: stx ptr1+1 ; Push Format - ldy #1 - lda (ptr1),y - tax - dey - lda (ptr1),y - jsr pushax + ldy #1 + lda (ptr1),y + tax + dey + lda (ptr1),y + jsr pushax ; Load va_list (last and __fastcall__ parameter to vfprintf) - lda ptr1 - ldx ptr1+1 + lda ptr1 + ldx ptr1+1 ; Call vcprintf - jsr _vcprintf + jsr _vcprintf ; Cleanup the stack. We will return what we got from vcprintf - ldy ParamSize - jmp addysp + ldy ParamSize + jmp addysp diff --git a/libsrc/conio/cputhex.s b/libsrc/conio/cputhex.s index 1aaeed6b2..88ef4bebd 100644 --- a/libsrc/conio/cputhex.s +++ b/libsrc/conio/cputhex.s @@ -5,31 +5,31 @@ ; void cputhex16 (unsigned val); ; - .export _cputhex8, _cputhex16 - .import _cputc - .import __hextab + .export _cputhex8, _cputhex16 + .import _cputc + .import __hextab _cputhex16: - pha ; Save low byte - txa ; Get high byte into A - jsr _cputhex8 ; Output high byte - pla ; Restore low byte and run into _cputhex8 + pha ; Save low byte + txa ; Get high byte into A + jsr _cputhex8 ; Output high byte + pla ; Restore low byte and run into _cputhex8 _cputhex8: - pha ; Save the value - lsr a - lsr a - lsr a - lsr a - tay - lda __hextab,y - jsr _cputc - pla - and #$0F - tay - lda __hextab,y - jmp _cputc + pha ; Save the value + lsr a + lsr a + lsr a + lsr a + tay + lda __hextab,y + jsr _cputc + pla + and #$0F + tay + lda __hextab,y + jmp _cputc diff --git a/libsrc/conio/cputs.s b/libsrc/conio/cputs.s index 1d8662607..13cf84789 100644 --- a/libsrc/conio/cputs.s +++ b/libsrc/conio/cputs.s @@ -5,32 +5,32 @@ ; void cputs (char* s); ; - .export _cputsxy, _cputs - .import popa, _gotoxy, _cputc - .importzp ptr1, tmp1 - + .export _cputsxy, _cputs + .import popa, _gotoxy, _cputc + .importzp ptr1, tmp1 + _cputsxy: - sta ptr1 ; Save s for later - stx ptr1+1 - jsr popa ; Get Y - jsr _gotoxy ; Set cursor, pop x - jmp L0 ; Same as cputs... + sta ptr1 ; Save s for later + stx ptr1+1 + jsr popa ; Get Y + jsr _gotoxy ; Set cursor, pop x + jmp L0 ; Same as cputs... -_cputs: sta ptr1 ; Save s - stx ptr1+1 -L0: ldy #0 -L1: lda (ptr1),y - beq L9 ; Jump if done - iny - sty tmp1 ; Save offset - jsr _cputc ; Output char, advance cursor - ldy tmp1 ; Get offset - bne L1 ; Next char - inc ptr1+1 ; Bump high byte - bne L1 +_cputs: sta ptr1 ; Save s + stx ptr1+1 +L0: ldy #0 +L1: lda (ptr1),y + beq L9 ; Jump if done + iny + sty tmp1 ; Save offset + jsr _cputc ; Output char, advance cursor + ldy tmp1 ; Get offset + bne L1 ; Next char + inc ptr1+1 ; Bump high byte + bne L1 ; Done -L9: rts +L9: rts diff --git a/libsrc/conio/cscanf.s b/libsrc/conio/cscanf.s index 6be4dc0dc..7e54a844f 100644 --- a/libsrc/conio/cscanf.s +++ b/libsrc/conio/cscanf.s @@ -5,58 +5,58 @@ ; 2005-01-01, Greg King ; - .export _cscanf + .export _cscanf - .import pushax, addysp, _vcscanf + .import pushax, addysp, _vcscanf - .macpack generic - .include "zeropage.inc" + .macpack generic + .include "zeropage.inc" ; ---------------------------------------------------------------------------- ; Code ; _cscanf: - sty ArgSize ; Number of argument bytes passed in .Y - dey ; subtract size of format pointer + sty ArgSize ; Number of argument bytes passed in .Y + dey ; subtract size of format pointer dey tya ; Now, calculate the va_list pointer -- which points to format. - ldx sp+1 - add sp - bcc @L1 + ldx sp+1 + add sp + bcc @L1 inx -@L1: sta ptr1 - stx ptr1+1 +@L1: sta ptr1 + stx ptr1+1 ; Push a copy of the format pointer onto the stack. - ldy #1 - lda (ptr1),y + ldy #1 + lda (ptr1),y tax dey - lda (ptr1),y - jsr pushax + lda (ptr1),y + jsr pushax ; Load va_list [last and __fastcall__ argument for vcscanf()]. - lda ptr1 - ldx ptr1+1 + lda ptr1 + ldx ptr1+1 ; Call vcscanf(). - jsr _vcscanf + jsr _vcscanf ; Clean up the stack. We will return what we got from vcscanf(). - ldy ArgSize - jmp addysp + ldy ArgSize + jmp addysp ; ---------------------------------------------------------------------------- ; Data ; .bss ArgSize: - .res 1 ; Number of argument bytes + .res 1 ; Number of argument bytes diff --git a/libsrc/conio/cursor.s b/libsrc/conio/cursor.s index c16b28e5e..cb59984f7 100644 --- a/libsrc/conio/cursor.s +++ b/libsrc/conio/cursor.s @@ -4,17 +4,17 @@ ; unsigned char cursor (unsigned char onoff); ; - .export _cursor - .import cursor + .export _cursor + .import cursor -.proc _cursor +.proc _cursor - tay ; onoff into Y - ldx #0 ; High byte of result - lda cursor ; Get old value - sty cursor ; Set new value - rts + tay ; onoff into Y + ldx #0 ; High byte of result + lda cursor ; Get old value + sty cursor ; Set new value + rts .endproc diff --git a/libsrc/conio/scrsize.s b/libsrc/conio/scrsize.s index 291f42d4a..6582568d7 100644 --- a/libsrc/conio/scrsize.s +++ b/libsrc/conio/scrsize.s @@ -4,22 +4,22 @@ ; void screensize (unsigned char* x, unsigned char* y); ; - .export _screensize + .export _screensize - .import popsreg - .import screensize - .importzp ptr1, sreg + .import popsreg + .import screensize + .importzp ptr1, sreg -.proc _screensize +.proc _screensize - sta ptr1 ; Store the y pointer - stx ptr1+1 + sta ptr1 ; Store the y pointer + stx ptr1+1 jsr popsreg ; Get the x pointer into sreg jsr screensize ; Get screensize into X/Y tya ; Get Y size into A .IFP02 - ldy #0 + ldy #0 sta (ptr1),y txa sta (sreg),y @@ -29,7 +29,7 @@ sta (sreg) .ENDIF - rts + rts .endproc diff --git a/libsrc/conio/vcprintf.s b/libsrc/conio/vcprintf.s index f994ad29a..5dbbc051d 100644 --- a/libsrc/conio/vcprintf.s +++ b/libsrc/conio/vcprintf.s @@ -4,12 +4,12 @@ ; Ullrich von Bassewitz, 2.12.2000 ; - .export _vcprintf - .import pushax, popax - .import __printf, _cputc - .importzp sp, ptr1, ptr2, ptr3, tmp1 + .export _vcprintf + .import pushax, popax + .import __printf, _cputc + .importzp sp, ptr1, ptr2, ptr3, tmp1 - .macpack generic + .macpack generic .data @@ -19,11 +19,11 @@ ; Static data for the _vsprintf routine ; -outdesc: ; Static outdesc structure - .word 0 ; ccount - .word out ; Output function pointer - .word 0 ; ptr - .word 0 ; uns +outdesc: ; Static outdesc structure + .word 0 ; ccount + .word out ; Output function pointer + .word 0 ; ptr + .word 0 ; uns .code @@ -36,60 +36,60 @@ outdesc: ; Static outdesc structure ; /* Fast screen output */ ; d->ccount += count; ; while (count) { -; cputc (*buf); -; ++buf; -; --count; +; cputc (*buf); +; ++buf; +; --count; ; } ; } ; ; We're using ptr1 and tmp1, since we know that the cputc routine will not use ; them (they're also used in cputs, so they must be safe). -out: jsr popax ; count - sta ptr2 - eor #$FF - sta outdesc+6 - txa - sta ptr2+1 - eor #$FF - sta outdesc+7 +out: jsr popax ; count + sta ptr2 + eor #$FF + sta outdesc+6 + txa + sta ptr2+1 + eor #$FF + sta outdesc+7 - jsr popax ; buf - sta ptr1 - stx ptr1+1 + jsr popax ; buf + sta ptr1 + stx ptr1+1 - jsr popax ; d - sta ptr3 - stx ptr3+1 + jsr popax ; d + sta ptr3 + stx ptr3+1 ; Sum up the total count of characters - ldy #0 ; ccount in struct outdesc - sty tmp1 ; Initialize tmp1 while we have zero available - lda (ptr3),y - add ptr2 - sta (ptr3),y - iny - lda (ptr3),y - adc ptr2+1 - sta (ptr3),y + ldy #0 ; ccount in struct outdesc + sty tmp1 ; Initialize tmp1 while we have zero available + lda (ptr3),y + add ptr2 + sta (ptr3),y + iny + lda (ptr3),y + adc ptr2+1 + sta (ptr3),y ; Loop outputting characters -@L1: inc outdesc+6 - beq @L4 -@L2: ldy tmp1 - lda (ptr1),y - iny - bne @L3 - inc ptr1+1 -@L3: sty tmp1 - jsr _cputc - jmp @L1 +@L1: inc outdesc+6 + beq @L4 +@L2: ldy tmp1 + lda (ptr1),y + iny + bne @L3 + inc ptr1+1 +@L3: sty tmp1 + jsr _cputc + jmp @L1 -@L4: inc outdesc+7 - bne @L2 - rts +@L4: inc outdesc+7 + bne @L2 + rts ; ---------------------------------------------------------------------------- ; vcprintf - formatted console i/o @@ -113,46 +113,46 @@ out: jsr popax ; count ; gained by using __fastcall__. _vcprintf: - sta ptr1 ; Save ap - stx ptr1+1 + sta ptr1 ; Save ap + stx ptr1+1 ; Setup the outdesc structure - lda #0 - sta outdesc - sta outdesc+1 ; Clear ccount + lda #0 + sta outdesc + sta outdesc+1 ; Clear ccount ; Get the format parameter and push it again - ldy #1 - lda (sp),y - tax - dey - lda (sp),y - jsr pushax + ldy #1 + lda (sp),y + tax + dey + lda (sp),y + jsr pushax ; Replace the passed format parameter on the stack by &d - this creates ; exactly the stack frame _printf expects. Parameters will get dropped ; by _printf. - ldy #2 ; Low byte of d - lda #outdesc - sta (sp),y + ldy #2 ; Low byte of d + lda #outdesc + sta (sp),y ; Restore ap and call _printf - lda ptr1 - ldx ptr1+1 - jsr __printf + lda ptr1 + ldx ptr1+1 + jsr __printf ; Return the number of bytes written. - lda outdesc ; ccount - ldx outdesc+1 - rts + lda outdesc ; ccount + ldx outdesc+1 + rts - + diff --git a/libsrc/conio/vcscanf.s b/libsrc/conio/vcscanf.s index 87c58515b..eb1c5a43a 100644 --- a/libsrc/conio/vcscanf.s +++ b/libsrc/conio/vcscanf.s @@ -4,20 +4,20 @@ ; 2005-01-02, Greg King ; - .export _vcscanf + .export _vcscanf - .import _cgetc, _cputc - .import popax, pushax, swapstk + .import _cgetc, _cputc + .import popax, pushax, swapstk - .include "../common/_scanf.inc" + .include "../common/_scanf.inc" ; static bool pushed; ; static char back; ; .bss -pushed: .res 1 -back: .res 1 +pushed: .res 1 +back: .res 1 .code ; /* Call-back functions: @@ -39,26 +39,26 @@ back: .res 1 ; return (int)C; ; } ; -get: ldx pushed - beq L1 +get: ldx pushed + beq L1 ; Return the old, pushed-back character (instead of getting a new one). ; - dex ; ldx #>0 - stx pushed - lda back + dex ; ldx #>0 + stx pushed + lda back rts ; Directly read the keyboard. ; -L1: jsr _cgetc +L1: jsr _cgetc ; Echo the character to the screen. ; pha - jsr _cputc + jsr _cputc pla - ldx #>0 + ldx #>0 rts @@ -68,10 +68,10 @@ L1: jsr _cgetc ; return back = c; ; } ; -unget: ldx #1 - stx pushed - jsr popax ; get the first argument - sta back +unget: ldx #1 + stx pushed + jsr popax ; get the first argument + sta back rts @@ -96,35 +96,35 @@ unget: ldx #1 ; ; Beware: Because ap is a fastcall parameter, we must not destroy .XA. ; - .proc _vcscanf + .proc _vcscanf ; ---------------------------------------------------------------------------- ; Static, constant scanfdata structure for the _vcscanf routine. ; .rodata -d: .addr get ; SCANFDATA::GET - .addr unget ; SCANFDATA::UNGET -; .addr 0 ; SCANFDATA::DATA (not used) +d: .addr get ; SCANFDATA::GET + .addr unget ; SCANFDATA::UNGET +; .addr 0 ; SCANFDATA::DATA (not used) .code - pha ; Save low byte of ap + pha ; Save low byte of ap txa - pha ; Save high byte of ap - ldx #0 - stx pushed + pha ; Save high byte of ap + ldx #0 + stx pushed ; Put &d on the stack in front of the format pointer. lda #d jsr swapstk ; Swap .XA with top-of-stack - jsr pushax ; Put format pointer back on stack + jsr pushax ; Put format pointer back on stack ; Restore ap, and jump to _scanf which will clean up the stack. pla tax pla - jmp __scanf + jmp __scanf .endproc diff --git a/libsrc/dbg/asmtab.s b/libsrc/dbg/asmtab.s index d09448521..3d27aea1f 100644 --- a/libsrc/dbg/asmtab.s +++ b/libsrc/dbg/asmtab.s @@ -4,10 +4,10 @@ ; Tables needed for the line assembler/disassembler. ; - .export OffsetTab - .export AdrFlagTab - .export SymbolTab1, SymbolTab2 - .export MnemoTab1, MnemoTab2 + .export OffsetTab + .export AdrFlagTab + .export SymbolTab1, SymbolTab2 + .export MnemoTab1, MnemoTab2 ; ------------------------------------------------------------------------- ; Assembler tables @@ -16,45 +16,45 @@ OffsetTab: - .byte $40,$02,$45,$03,$D0,$08,$40,$09 - .byte $30,$22,$45,$33,$D0,$08,$40,$09 - .byte $40,$02,$45,$33,$D0,$08,$40,$09 - .byte $40,$02,$45,$B3,$D0,$08,$40,$09 - .byte $00,$22,$44,$33,$D0,$8C,$44,$00 - .byte $11,$22,$44,$33,$D0,$8C,$44,$9A - .byte $10,$22,$44,$33,$D0,$08,$40,$09 - .byte $10,$22,$44,$33,$D0,$08,$40,$09 - .byte $62,$13,$78,$A9 + .byte $40,$02,$45,$03,$D0,$08,$40,$09 + .byte $30,$22,$45,$33,$D0,$08,$40,$09 + .byte $40,$02,$45,$33,$D0,$08,$40,$09 + .byte $40,$02,$45,$B3,$D0,$08,$40,$09 + .byte $00,$22,$44,$33,$D0,$8C,$44,$00 + .byte $11,$22,$44,$33,$D0,$8C,$44,$9A + .byte $10,$22,$44,$33,$D0,$08,$40,$09 + .byte $10,$22,$44,$33,$D0,$08,$40,$09 + .byte $62,$13,$78,$A9 AdrFlagTab: - .byte $00,$21,$81,$82,$00,$00,$59,$4D - .byte $91,$92,$86,$4A,$85,$9D + .byte $00,$21,$81,$82,$00,$00,$59,$4D + .byte $91,$92,$86,$4A,$85,$9D SymbolTab1: - .byte $2C,$29,$2C,$23,$28,$24 + .byte $2C,$29,$2C,$23,$28,$24 SymbolTab2: - .byte $59,$00,$58,$24,$24,$00 + .byte $59,$00,$58,$24,$24,$00 MnemoTab1: - .byte $1C,$8A,$1C,$23,$5D,$8B,$1B,$A1 - .byte $9D,$8A,$1D,$23,$9D,$8B,$1D,$A1 - .byte $00,$29,$19,$AE,$69,$A8,$19,$23 - .byte $24,$53,$1B,$23,$24,$53,$19,$A1 - .byte $00,$1A,$5B,$5B,$A5,$69,$24,$24 - .byte $AE,$AE,$A8,$AD,$29,$00,$7C,$00 - .byte $15,$9C,$6D,$9C,$A5,$69,$29,$53 - .byte $84,$13,$34,$11,$A5,$69,$23,$A0 + .byte $1C,$8A,$1C,$23,$5D,$8B,$1B,$A1 + .byte $9D,$8A,$1D,$23,$9D,$8B,$1D,$A1 + .byte $00,$29,$19,$AE,$69,$A8,$19,$23 + .byte $24,$53,$1B,$23,$24,$53,$19,$A1 + .byte $00,$1A,$5B,$5B,$A5,$69,$24,$24 + .byte $AE,$AE,$A8,$AD,$29,$00,$7C,$00 + .byte $15,$9C,$6D,$9C,$A5,$69,$29,$53 + .byte $84,$13,$34,$11,$A5,$69,$23,$A0 MnemoTab2: - .byte $D8,$62,$5A,$48,$26,$62,$94,$88 - .byte $54,$44,$C8,$54,$68,$44,$E8,$94 - .byte $00,$B4,$08,$84,$74,$B4,$28,$6E - .byte $74,$F4,$CC,$4A,$72,$F2,$A4,$8A - .byte $00,$AA,$A2,$A2,$74,$74,$74,$72 - .byte $44,$68,$B2,$32,$B2,$00,$22,$00 - .byte $1A,$1A,$26,$26,$72,$72,$88,$C8 - .byte $C4,$CA,$26,$48,$44,$44,$A2,$C8 + .byte $D8,$62,$5A,$48,$26,$62,$94,$88 + .byte $54,$44,$C8,$54,$68,$44,$E8,$94 + .byte $00,$B4,$08,$84,$74,$B4,$28,$6E + .byte $74,$F4,$CC,$4A,$72,$F2,$A4,$8A + .byte $00,$AA,$A2,$A2,$74,$74,$74,$72 + .byte $44,$68,$B2,$32,$B2,$00,$22,$00 + .byte $1A,$1A,$26,$26,$72,$72,$88,$C8 + .byte $C4,$CA,$26,$48,$44,$44,$A2,$C8 diff --git a/libsrc/dbg/dbg.c b/libsrc/dbg/dbg.c index 8090d73dd..32a0cfba0 100644 --- a/libsrc/dbg/dbg.c +++ b/libsrc/dbg/dbg.c @@ -18,7 +18,7 @@ /*****************************************************************************/ -/* Function forwards */ +/* Function forwards */ /*****************************************************************************/ @@ -41,42 +41,42 @@ static char GetKeyUpdate (void); /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Color definitions */ #if defined(__PLUS4__) || defined(__C16__) -# define COLOR_BORDER (BCOLOR_DARKBLUE | CATTR_LUMA6) -# define COLOR_BACKGROUND COLOR_WHITE -# define COLOR_TEXTHIGH COLOR_BLACK -# define COLOR_TEXTLOW COLOR_GRAY1 -# define COLOR_FRAMEHIGH COLOR_BLACK -# define COLOR_FRAMELOW COLOR_GRAY2 +# define COLOR_BORDER (BCOLOR_DARKBLUE | CATTR_LUMA6) +# define COLOR_BACKGROUND COLOR_WHITE +# define COLOR_TEXTHIGH COLOR_BLACK +# define COLOR_TEXTLOW COLOR_GRAY1 +# define COLOR_FRAMEHIGH COLOR_BLACK +# define COLOR_FRAMELOW COLOR_GRAY2 #else # if defined(COLOR_GRAY3) -# define COLOR_BORDER COLOR_BLACK -# define COLOR_BACKGROUND COLOR_BLACK -# define COLOR_TEXTHIGH COLOR_WHITE -# define COLOR_TEXTLOW COLOR_GRAY3 -# define COLOR_FRAMEHIGH COLOR_WHITE -# define COLOR_FRAMELOW COLOR_GRAY3 +# define COLOR_BORDER COLOR_BLACK +# define COLOR_BACKGROUND COLOR_BLACK +# define COLOR_TEXTHIGH COLOR_WHITE +# define COLOR_TEXTLOW COLOR_GRAY3 +# define COLOR_FRAMEHIGH COLOR_WHITE +# define COLOR_FRAMELOW COLOR_GRAY3 # else # if defined(__APPLE2__) || defined(__APPLE2ENH__) -# define COLOR_BORDER COLOR_BLACK +# define COLOR_BORDER COLOR_BLACK # define COLOR_BACKGROUND COLOR_BLACK -# define COLOR_TEXTHIGH COLOR_BLACK -# define COLOR_TEXTLOW COLOR_BLACK -# define COLOR_FRAMEHIGH COLOR_BLACK -# define COLOR_FRAMELOW COLOR_BLACK +# define COLOR_TEXTHIGH COLOR_BLACK +# define COLOR_TEXTLOW COLOR_BLACK +# define COLOR_FRAMEHIGH COLOR_BLACK +# define COLOR_FRAMELOW COLOR_BLACK # else -# define COLOR_BORDER COLOR_BLACK +# define COLOR_BORDER COLOR_BLACK # define COLOR_BACKGROUND COLOR_BLACK -# define COLOR_TEXTHIGH COLOR_WHITE -# define COLOR_TEXTLOW COLOR_WHITE -# define COLOR_FRAMEHIGH COLOR_WHITE -# define COLOR_FRAMELOW COLOR_WHITE +# define COLOR_TEXTHIGH COLOR_WHITE +# define COLOR_TEXTLOW COLOR_WHITE +# define COLOR_FRAMEHIGH COLOR_WHITE +# define COLOR_FRAMELOW COLOR_WHITE # endif # endif #endif @@ -90,17 +90,17 @@ static char GetKeyUpdate (void); /* Screen definitions */ #if defined(__CBM610__) # define BIGSCREEN -# define MAX_X 80 -# define MAX_Y 25 -# define DUMP_BYTES 16 +# define MAX_X 80 +# define MAX_Y 25 +# define DUMP_BYTES 16 #elif defined(__APPLE2__) || defined(__APPLE2ENH__) || defined(__ATARI__) # define MAX_X 40 # define MAX_Y 24 # define DUMP_BYTES 8 #else -# define MAX_X 40 -# define MAX_Y 25 -# define DUMP_BYTES 8 +# define MAX_X 40 +# define MAX_Y 25 +# define DUMP_BYTES 8 #endif /* Replacement key definitions */ @@ -138,27 +138,27 @@ static char GetKeyUpdate (void); #endif /* Defines for opcodes */ -#define OPC_BRK 0x00 -#define OPC_BPL 0x10 -#define OPC_JSR 0x20 -#define OPC_BMI 0x30 -#define OPC_RTI 0x40 -#define OPC_JMP 0x4C -#define OPC_BVC 0x50 -#define OPC_RTS 0x60 -#define OPC_JMPIND 0x6C -#define OPC_BVS 0x70 -#define OPC_BCC 0x90 -#define OPC_BCS 0xB0 -#define OPC_BNE 0xD0 -#define OPC_BEQ 0xF0 +#define OPC_BRK 0x00 +#define OPC_BPL 0x10 +#define OPC_JSR 0x20 +#define OPC_BMI 0x30 +#define OPC_RTI 0x40 +#define OPC_JMP 0x4C +#define OPC_BVC 0x50 +#define OPC_RTS 0x60 +#define OPC_JMPIND 0x6C +#define OPC_BVS 0x70 +#define OPC_BCC 0x90 +#define OPC_BCS 0xB0 +#define OPC_BNE 0xD0 +#define OPC_BEQ 0xF0 /* Register values that are used also in the assembler stuff */ -extern unsigned char DbgSP; /* Stack pointer */ -extern unsigned DbgCS; /* C stack pointer */ -extern unsigned DbgHI; /* High 16 bit of primary reg */ +extern unsigned char DbgSP; /* Stack pointer */ +extern unsigned DbgCS; /* C stack pointer */ +extern unsigned DbgHI; /* High 16 bit of primary reg */ @@ -166,22 +166,22 @@ extern unsigned DbgHI; /* High 16 bit of primary reg */ typedef struct { unsigned char x; unsigned char y; - char* text; + char* text; } TextDesc; /* Window descriptor */ typedef struct { - unsigned char fd_tl; /* Top left char */ - unsigned char fd_tr; /* Top right char */ - unsigned char fd_bl; /* Bottom left char */ - unsigned char fd_br; /* Bottom right char */ - unsigned char fd_x1, fd_y1; /* Upper left corner */ - unsigned char fd_x2, fd_y2; /* Lower right corner */ - unsigned char fd_width, fd_height; /* Redundant but faster */ - unsigned char fd_visible; /* Is the window currently visible? */ - char (*fd_func) (void); /* Handler function */ - unsigned char fd_textcount; /* Number of text lines to print */ - TextDesc* fd_text; /* Static text in the window */ + unsigned char fd_tl; /* Top left char */ + unsigned char fd_tr; /* Top right char */ + unsigned char fd_bl; /* Bottom left char */ + unsigned char fd_br; /* Bottom right char */ + unsigned char fd_x1, fd_y1; /* Upper left corner */ + unsigned char fd_x2, fd_y2; /* Lower right corner */ + unsigned char fd_width, fd_height; /* Redundant but faster */ + unsigned char fd_visible; /* Is the window currently visible? */ + char (*fd_func) (void); /* Handler function */ + unsigned char fd_textcount; /* Number of text lines to print */ + TextDesc* fd_text; /* Static text in the window */ } FrameDesc; @@ -198,24 +198,24 @@ static TextDesc RegText [] = { { 1, 7, "HI" } }; static TextDesc HelpText [] = { - { 1, 0, "F1, ? Help" }, - { 1, 1, "F2, t Toggle breakpoint" }, - { 1, 2, "F3, u Run until subroutine returns" }, - { 1, 3, "F4, h Run to cursor" }, - { 1, 4, "F7, space Step into" }, - { 1, 5, "F8, enter Step over" }, - { 1, 6, "1-5 Select active window" }, - { 1, 7, "+ Page down" }, - { 1, 8, "- Page up" }, - { 1, 9, "Cursor Move up/down" }, + { 1, 0, "F1, ? Help" }, + { 1, 1, "F2, t Toggle breakpoint" }, + { 1, 2, "F3, u Run until subroutine returns" }, + { 1, 3, "F4, h Run to cursor" }, + { 1, 4, "F7, space Step into" }, + { 1, 5, "F8, enter Step over" }, + { 1, 6, "1-5 Select active window" }, + { 1, 7, "+ Page down" }, + { 1, 8, "- Page up" }, + { 1, 9, "Cursor Move up/down" }, { 1, 10, "a/z Move up/down" }, - { 1, 11, "c Continue" }, - { 1, 12, "f Follow instruction" }, - { 1, 13, "o Goto origin" }, - { 1, 14, "p Use as new PC value" }, - { 1, 15, "q Quit" }, - { 1, 16, "r Redraw screen" }, - { 1, 17, "s Skip next instruction" }, + { 1, 11, "c Continue" }, + { 1, 12, "f Follow instruction" }, + { 1, 13, "o Goto origin" }, + { 1, 14, "p Use as new PC value" }, + { 1, 15, "q Quit" }, + { 1, 16, "r Redraw screen" }, + { 1, 17, "s Skip next instruction" }, }; @@ -281,51 +281,51 @@ static FrameDesc* Frames [] = { static int ActiveFrame = -1; /* Window names */ -#define WIN_ASM 0 -#define WIN_REG 1 -#define WIN_STACK 2 -#define WIN_CSTACK 3 -#define WIN_DUMP 4 -#define WIN_HELP 5 +#define WIN_ASM 0 +#define WIN_REG 1 +#define WIN_STACK 2 +#define WIN_CSTACK 3 +#define WIN_DUMP 4 +#define WIN_HELP 5 /* Other window data */ -static unsigned AsmAddr; /* Start address of output */ -static unsigned DumpAddr; /* Start address of output */ -static unsigned CStackAddr; /* Start address of output */ -static unsigned char StackAddr; /* Start address of output */ +static unsigned AsmAddr; /* Start address of output */ +static unsigned DumpAddr; /* Start address of output */ +static unsigned CStackAddr; /* Start address of output */ +static unsigned char StackAddr; /* Start address of output */ /* Prompt line data */ -static char* ActivePrompt = 0; /* Last prompt line displayed */ -static char PromptColor; /* Color behind prompt */ -static char PromptLength; /* Length of current prompt string */ +static char* ActivePrompt = 0; /* Last prompt line displayed */ +static char PromptColor; /* Color behind prompt */ +static char PromptLength; /* Length of current prompt string */ /* Values for the bk_use field of struct BreakPoint */ -#define BRK_EMPTY 0x00 -#define BRK_USER 0x01 -#define BRK_TMP 0x80 +#define BRK_EMPTY 0x00 +#define BRK_USER 0x01 +#define BRK_TMP 0x80 /* Structure describing a breakpoint */ typedef struct { - unsigned bk_addr; /* Address, 0 if unused */ - unsigned char bk_opc; /* Opcode */ - unsigned char bk_use; /* 1 if in use, 0 otherwise */ + unsigned bk_addr; /* Address, 0 if unused */ + unsigned char bk_opc; /* Opcode */ + unsigned char bk_use; /* 1 if in use, 0 otherwise */ } BreakPoint; /* Temporary breakpoints - also accessed from the assembler source */ -#define MAX_USERBREAKS 10 +#define MAX_USERBREAKS 10 unsigned char DbgBreakCount = 0; BreakPoint DbgBreaks [MAX_USERBREAKS+2]; /*****************************************************************************/ -/* Forwards for functions in the assembler source */ +/* Forwards for functions in the assembler source */ /*****************************************************************************/ @@ -341,7 +341,7 @@ BreakPoint* DbgIsBreak (unsigned Addr); /*****************************************************************************/ -/* Frame/window drawing code */ +/* Frame/window drawing code */ /*****************************************************************************/ @@ -357,17 +357,17 @@ static void DrawFrame (register FrameDesc* F, char Active) /* Determine the characters for the corners, set frame color */ if (Active) { - OldColor = textcolor (COLOR_FRAMEHIGH); - tl = CH_ULCORNER; - tr = CH_URCORNER; - bl = CH_LLCORNER; - br = CH_LRCORNER; + OldColor = textcolor (COLOR_FRAMEHIGH); + tl = CH_ULCORNER; + tr = CH_URCORNER; + bl = CH_LLCORNER; + br = CH_LRCORNER; } else { - OldColor = textcolor (COLOR_FRAMELOW); - tl = F->fd_tl; - tr = F->fd_tr; - bl = F->fd_bl; - br = F->fd_br; + OldColor = textcolor (COLOR_FRAMELOW); + tl = F->fd_tl; + tr = F->fd_tr; + bl = F->fd_bl; + br = F->fd_br; } /* Get the coordinates into locals for faster access */ @@ -396,8 +396,8 @@ static void DrawFrame (register FrameDesc* F, char Active) Count = F->fd_textcount; T = F->fd_text; while (Count--) { - cputsxy (x1 + T->x, y1 + T->y, T->text); - ++T; + cputsxy (x1 + T->x, y1 + T->y, T->text); + ++T; } /* Set the old color */ @@ -414,10 +414,10 @@ static void DrawFrames (void) /* Build the frame layout of the screen */ for (I = 0; I < sizeof (Frames) / sizeof (Frames [0]); ++I) { - F = Frames [I]; - if (F->fd_visible) { - DrawFrame (F, 0); - } + F = Frames [I]; + if (F->fd_visible) { + DrawFrame (F, 0); + } } } @@ -431,25 +431,25 @@ static void ActivateFrame (int Num, unsigned char Clear) if (ActiveFrame != Num) { - /* Deactivate the old one */ - if (ActiveFrame >= 0) { - DrawFrame (Frames [ActiveFrame], 0); - } + /* Deactivate the old one */ + if (ActiveFrame >= 0) { + DrawFrame (Frames [ActiveFrame], 0); + } - /* Activate the new one */ - if ((ActiveFrame = Num) >= 0) { - F = Frames [ActiveFrame]; - /* Clear the frame if requested */ - if (Clear) { - for (y = F->fd_y1+1; y < F->fd_y2; ++y) { - cclearxy (F->fd_x1+1, y, F->fd_width); - } - } - DrawFrame (F, 1); - } + /* Activate the new one */ + if ((ActiveFrame = Num) >= 0) { + F = Frames [ActiveFrame]; + /* Clear the frame if requested */ + if (Clear) { + for (y = F->fd_y1+1; y < F->fd_y2; ++y) { + cclearxy (F->fd_x1+1, y, F->fd_width); + } + } + DrawFrame (F, 1); + } - /* Redraw the current prompt line */ - DisplayPrompt (ActivePrompt); + /* Redraw the current prompt line */ + DisplayPrompt (ActivePrompt); } } @@ -457,7 +457,7 @@ static void ActivateFrame (int Num, unsigned char Clear) /*****************************************************************************/ -/* Prompt line */ +/* Prompt line */ /*****************************************************************************/ @@ -472,8 +472,8 @@ static void DisplayPrompt (char* s) /* Clear the old prompt if there is one */ if (ActivePrompt) { - (void) textcolor (PromptColor); - chlinexy ((MAX_X - PromptLength) / 2, MAX_Y-1, PromptLength); + (void) textcolor (PromptColor); + chlinexy ((MAX_X - PromptLength) / 2, MAX_Y-1, PromptLength); } /* Get the new prompt data */ @@ -550,22 +550,22 @@ static char Input (char* Prompt, char* Buf, unsigned char Count) /* Get input and handle it */ i = done = 0; do { - c = cgetc (); - if (isalnum (c) && i < Count) { - Buf [i] = c; - cputcxy (x1 + i, MAX_Y-1, c); - ++i; - } else if (i > 0 && c == CH_DEL) { - --i; - cputcxy (x1 + i, MAX_Y-1, ' '); - gotoxy (x1 + i, MAX_Y-1); - } else if (c == '\n') { - Buf [i] = '\0'; - done = 1; - } else if (IsAbortKey (c)) { - /* Abort */ - done = 2; - } + c = cgetc (); + if (isalnum (c) && i < Count) { + Buf [i] = c; + cputcxy (x1 + i, MAX_Y-1, c); + ++i; + } else if (i > 0 && c == CH_DEL) { + --i; + cputcxy (x1 + i, MAX_Y-1, ' '); + gotoxy (x1 + i, MAX_Y-1); + } else if (c == '\n') { + Buf [i] = '\0'; + done = 1; + } else if (IsAbortKey (c)) { + /* Abort */ + done = 2; + } } while (!done); /* Reset settings, display old prompt line */ @@ -592,25 +592,25 @@ static char InputHex (char* Prompt, unsigned* Val) /* Read input from the user (4 digits max), check input */ if (Input (Prompt, Buf, sizeof (Buf)-1) && isxdigit (Buf [0])) { - /* Check the characters and convert to hex */ - P = Buf; - V = 0; - while ((C = *P) && isxdigit (C)) { - V <<= 4; - if (isdigit (C)) { - C -= '0'; - } else { - C = toupper (C) - ('A' - 10); - } - V += C; - ++P; - } + /* Check the characters and convert to hex */ + P = Buf; + V = 0; + while ((C = *P) && isxdigit (C)) { + V <<= 4; + if (isdigit (C)) { + C -= '0'; + } else { + C = toupper (C) - ('A' - 10); + } + V += C; + ++P; + } - /* Assign the value */ - *Val = V; + /* Assign the value */ + *Val = V; - /* Success */ - return 1; + /* Success */ + return 1; } else { @@ -662,7 +662,7 @@ static void BreakInRomError (void) /*****************************************************************************/ -/* Breakpoint handling */ +/* Breakpoint handling */ /*****************************************************************************/ @@ -683,25 +683,25 @@ static void DbgToggleUserBreak (unsigned Addr) register BreakPoint* B = DbgIsBreak (Addr); if (B) { - /* We have a breakpoint, remove it */ - B->bk_use = BRK_EMPTY; - --DbgBreakCount; + /* We have a breakpoint, remove it */ + B->bk_use = BRK_EMPTY; + --DbgBreakCount; } else { - /* We don't have a breakpoint, set one */ - if (DbgBreakCount >= MAX_USERBREAKS) { - ErrorPrompt ("Too many breakpoints - press a key"); - } else { - /* Test if we can set a breakpoint at that address */ - if (!DbgIsRAM (Addr)) { - BreakInRomError (); - } else { - /* Set the breakpoint */ - B = DbgGetBreakSlot (); - B->bk_addr = Addr; - B->bk_use = BRK_USER; - ++DbgBreakCount; - } - } + /* We don't have a breakpoint, set one */ + if (DbgBreakCount >= MAX_USERBREAKS) { + ErrorPrompt ("Too many breakpoints - press a key"); + } else { + /* Test if we can set a breakpoint at that address */ + if (!DbgIsRAM (Addr)) { + BreakInRomError (); + } else { + /* Set the breakpoint */ + B = DbgGetBreakSlot (); + B->bk_addr = Addr; + B->bk_use = BRK_USER; + ++DbgBreakCount; + } + } } } @@ -714,10 +714,10 @@ static void DbgResetTmpBreaks (void) BreakPoint* B = DbgBreaks; for (i = 0; i < MAX_USERBREAKS; ++i) { - if (B->bk_use == BRK_TMP) { - B->bk_use = BRK_EMPTY; - } - ++B; + if (B->bk_use == BRK_TMP) { + B->bk_use = BRK_EMPTY; + } + ++B; } } @@ -731,12 +731,12 @@ static unsigned char DbgTmpBreaksOk (void) unsigned char i; BreakPoint* B = DbgBreaks; for (i = 0; i < MAX_USERBREAKS; ++i) { - if (B->bk_use == BRK_TMP && !DbgIsRAM (B->bk_addr)) { - BreakInRomError (); - DbgResetTmpBreaks (); - return 0; - } - ++B; + if (B->bk_use == BRK_TMP && !DbgIsRAM (B->bk_addr)) { + BreakInRomError (); + DbgResetTmpBreaks (); + return 0; + } + ++B; } return 1; } @@ -744,7 +744,7 @@ static unsigned char DbgTmpBreaksOk (void) /*****************************************************************************/ -/* Assembler window stuff */ +/* Assembler window stuff */ /*****************************************************************************/ @@ -760,25 +760,25 @@ static unsigned AsmBack (unsigned mem, unsigned char lines) unsigned offs = 6; while (1) { - in = 0; - cur = mem - (lines * 3) - offs; - while (1) { - cur += DbgDisAsmLen (cur); - adr [in] = cur; - in = (in + 1) & 0x1F; - if (cur >= mem) { - if (cur == mem || offs == 12) { - /* Found */ - return adr [(in - lines - 1) & 0x1F]; - } else { - /* The requested address is inside an instruction, go back - * one more byte and try again. - */ - ++offs; - break; - } - } - } + in = 0; + cur = mem - (lines * 3) - offs; + while (1) { + cur += DbgDisAsmLen (cur); + adr [in] = cur; + in = (in + 1) & 0x1F; + if (cur >= mem) { + if (cur == mem || offs == 12) { + /* Found */ + return adr [(in - lines - 1) & 0x1F]; + } else { + /* The requested address is inside an instruction, go back + * one more byte and try again. + */ + ++offs; + break; + } + } + } } } @@ -795,22 +795,22 @@ static unsigned UpdateAsm (void) unsigned m = AsmBack (AsmAddr, 2); for (y = AsmFrame.fd_y1+1; y < AsmFrame.fd_y2; ++y) { - len = DbgDisAsm (m, buf, width); - if (m == brk_pc) { - buf [4] = '-'; - buf [5] = '>'; - } - if (DbgIsBreak (m)) { - buf [5] = '*'; - } - if (m == AsmAddr) { - revers (1); - cputsxy (1, y, buf); - revers (0); - } else { - cputsxy (1, y, buf); - } - m += len; + len = DbgDisAsm (m, buf, width); + if (m == brk_pc) { + buf [4] = '-'; + buf [5] = '>'; + } + if (DbgIsBreak (m)) { + buf [5] = '*'; + } + if (m == AsmAddr) { + revers (1); + cputsxy (1, y, buf); + revers (0); + } else { + cputsxy (1, y, buf); + } + m += len; } return m; } @@ -830,33 +830,33 @@ static void AsmFollow (void) { switch (*(unsigned char*) AsmAddr) { - case OPC_JMP: - case OPC_JSR: - AsmAddr = AsmArg16 (); - break; + case OPC_JMP: + case OPC_JSR: + AsmAddr = AsmArg16 (); + break; case OPC_JMPIND: - AsmAddr = *(unsigned*)AsmArg16 (); - break; + AsmAddr = *(unsigned*)AsmArg16 (); + break; - case OPC_BPL: - case OPC_BMI: - case OPC_BVC: - case OPC_BVS: - case OPC_BCC: - case OPC_BCS: - case OPC_BNE: - case OPC_BEQ: - AsmAddr = AsmAddr + 2 + *(signed char*)(AsmAddr+1); - break; + case OPC_BPL: + case OPC_BMI: + case OPC_BVC: + case OPC_BVS: + case OPC_BCC: + case OPC_BCS: + case OPC_BNE: + case OPC_BEQ: + AsmAddr = AsmAddr + 2 + *(signed char*)(AsmAddr+1); + break; case OPC_RTS: - AsmAddr = (*(unsigned*) (DbgSP + 0x101) + 1); - break; + AsmAddr = (*(unsigned*) (DbgSP + 0x101) + 1); + break; case OPC_RTI: - AsmAddr = *(unsigned*) (DbgSP + 0x102); - break; + AsmAddr = *(unsigned*) (DbgSP + 0x102); + break; } } @@ -888,68 +888,68 @@ static char AsmHandler (void) while (1) { - /* Update the window contents */ - Last = UpdateAsm (); + /* Update the window contents */ + Last = UpdateAsm (); - /* Read and handle input */ - switch (c = GetKeyUpdate ()) { + /* Read and handle input */ + switch (c = GetKeyUpdate ()) { - case '+': - AsmAddr = Last; - break; + case '+': + AsmAddr = Last; + break; - case '-': - AsmAddr = AsmBack (AsmAddr, AsmFrame.fd_height); - break; + case '-': + AsmAddr = AsmBack (AsmAddr, AsmFrame.fd_height); + break; - case 't': + case 't': #ifdef CH_F2 - case CH_F2: + case CH_F2: #endif - DbgToggleUserBreak (AsmAddr); - break; + DbgToggleUserBreak (AsmAddr); + break; - case 'f': - AsmFollow (); - break; + case 'f': + AsmFollow (); + break; - case 'g': - InputGoto (&AsmAddr); - break; + case 'g': + InputGoto (&AsmAddr); + break; - case 'o': - AsmHome (); - break; + case 'o': + AsmHome (); + break; - case 'p': - brk_pc = AsmAddr; - break; + case 'p': + brk_pc = AsmAddr; + break; case 'a': #ifdef CH_CURS_UP - case CH_CURS_UP: + case CH_CURS_UP: #endif - AsmAddr = AsmBack (AsmAddr, 1); - break; + AsmAddr = AsmBack (AsmAddr, 1); + break; case 'z': #ifdef CH_CURS_DOWN - case CH_CURS_DOWN: + case CH_CURS_DOWN: #endif - AsmAddr += DbgDisAsmLen (AsmAddr); - break; + AsmAddr += DbgDisAsmLen (AsmAddr); + break; - default: - return c; + default: + return c; - } + } } } /*****************************************************************************/ -/* Register window stuff */ +/* Register window stuff */ /*****************************************************************************/ @@ -962,14 +962,14 @@ static unsigned UpdateReg (void) unsigned char y = RegFrame.fd_y1; /* Print the register contents */ - gotoxy (x1, ++y); cputhex16 (brk_pc); - gotoxy (x2, ++y); cputhex8 (brk_sr); - gotoxy (x2, ++y); cputhex8 (brk_a); - gotoxy (x2, ++y); cputhex8 (brk_x); - gotoxy (x2, ++y); cputhex8 (brk_y); - gotoxy (x2, ++y); cputhex8 (DbgSP); + gotoxy (x1, ++y); cputhex16 (brk_pc); + gotoxy (x2, ++y); cputhex8 (brk_sr); + gotoxy (x2, ++y); cputhex8 (brk_a); + gotoxy (x2, ++y); cputhex8 (brk_x); + gotoxy (x2, ++y); cputhex8 (brk_y); + gotoxy (x2, ++y); cputhex8 (DbgSP); gotoxy (x1, ++y); cputhex16 (DbgCS); - gotoxy (x1, ++y); cputhex16 (DbgHI); + gotoxy (x1, ++y); cputhex16 (DbgHI); /* Not needed */ return 0; @@ -994,7 +994,7 @@ static char RegHandler (void) /*****************************************************************************/ -/* Stack window stuff */ +/* Stack window stuff */ /*****************************************************************************/ @@ -1008,11 +1008,11 @@ static unsigned UpdateStack (void) unsigned char y; for (y = StackFrame.fd_y2-1; y > StackFrame.fd_y1; --y) { - gotoxy (x1, y); - cputhex8 (mem); - gotoxy (x2, y); - cputhex8 (* (unsigned char*) (mem + 0x100)); - ++mem; + gotoxy (x1, y); + cputhex8 (mem); + gotoxy (x2, y); + cputhex8 (* (unsigned char*) (mem + 0x100)); + ++mem; } return mem; } @@ -1044,49 +1044,49 @@ static char StackHandler (void) while (1) { - /* Read and handle input */ - switch (c = GetKeyUpdate ()) { + /* Read and handle input */ + switch (c = GetKeyUpdate ()) { - case '+': - StackAddr += BytesPerPage; - break; + case '+': + StackAddr += BytesPerPage; + break; - case '-': - StackAddr -= BytesPerPage; - break; + case '-': + StackAddr -= BytesPerPage; + break; - case 'o': - StackHome (); - break; + case 'o': + StackHome (); + break; case 'a': #ifdef CH_CURS_UP: - case CH_CURS_UP: + case CH_CURS_UP: #endif - --StackAddr; - break; + --StackAddr; + break; case 'z': #ifdef CH_CURS_DOWN - case CH_CURS_DOWN: + case CH_CURS_DOWN: #endif - ++StackAddr; - break; + ++StackAddr; + break; - default: - return c; + default: + return c; - } + } - /* Update the window contents */ - UpdateStack (); + /* Update the window contents */ + UpdateStack (); } } /*****************************************************************************/ -/* C Stack window stuff */ +/* C Stack window stuff */ /*****************************************************************************/ @@ -1099,9 +1099,9 @@ static unsigned UpdateCStack (void) unsigned char y; for (y = CStackFrame.fd_y2-1; y > CStackFrame.fd_y1; --y) { - gotoxy (x, y); - cputhex16 (* (unsigned*)mem); - mem += 2; + gotoxy (x, y); + cputhex16 (* (unsigned*)mem); + mem += 2; } cputsxy (CStackFrame.fd_x1+1, CStackFrame.fd_y2-1, "->"); return mem; @@ -1134,49 +1134,49 @@ static char CStackHandler (void) while (1) { - /* Read and handle input */ - switch (c = GetKeyUpdate ()) { + /* Read and handle input */ + switch (c = GetKeyUpdate ()) { - case '+': - CStackAddr += BytesPerPage; - break; + case '+': + CStackAddr += BytesPerPage; + break; - case '-': - CStackAddr -= BytesPerPage; - break; + case '-': + CStackAddr -= BytesPerPage; + break; - case 'o': - CStackHome (); - break; + case 'o': + CStackHome (); + break; case 'a': #ifdef CH_CURS_UP - case CH_CURS_UP: + case CH_CURS_UP: #endif - CStackAddr -= 2; - break; + CStackAddr -= 2; + break; case 'z': #ifdef CH_CURS_DOWN - case CH_CURS_DOWN: + case CH_CURS_DOWN: #endif - CStackAddr += 2; - break; + CStackAddr += 2; + break; - default: - return c; + default: + return c; - } + } - /* Update the window contents */ - UpdateCStack (); + /* Update the window contents */ + UpdateCStack (); } } /*****************************************************************************/ -/* Dump window stuff */ +/* Dump window stuff */ /*****************************************************************************/ @@ -1191,8 +1191,8 @@ static unsigned UpdateDump (void) unsigned char* p = (unsigned char*) mem; for (y = DumpFrame.fd_y1+1; y < DumpFrame.fd_y2; ++y) { - cputsxy (x, y, DbgMemDump (mem, Buf, DUMP_BYTES)); - mem += DUMP_BYTES; + cputsxy (x, y, DbgMemDump (mem, Buf, DUMP_BYTES)); + mem += DUMP_BYTES; } return mem; } @@ -1215,53 +1215,53 @@ static char DumpHandler (void) while (1) { - /* Read and handle input */ - switch (c = GetKeyUpdate ()) { + /* Read and handle input */ + switch (c = GetKeyUpdate ()) { - case '+': - DumpAddr += BytesPerPage; - break; + case '+': + DumpAddr += BytesPerPage; + break; - case '-': - DumpAddr -= BytesPerPage; - break; + case '-': + DumpAddr -= BytesPerPage; + break; - case 'g': - InputGoto (&DumpAddr); - break; + case 'g': + InputGoto (&DumpAddr); + break; - case 'o': - DumpHome (); - break; + case 'o': + DumpHome (); + break; case 'a': #ifdef CH_CURS_UP - case CH_CURS_UP: + case CH_CURS_UP: #endif - DumpAddr -= 8; - break; + DumpAddr -= 8; + break; case 'z': #ifdef CH_CURS_DOWN - case CH_CURS_DOWN: + case CH_CURS_DOWN: #endif - DumpAddr += 8; - break; + DumpAddr += 8; + break; - default: - return c; + default: + return c; - } + } - /* Update the window contents */ - UpdateDump (); + /* Update the window contents */ + UpdateDump (); } } /*****************************************************************************/ -/* Help window stuff */ +/* Help window stuff */ /*****************************************************************************/ @@ -1289,7 +1289,7 @@ static char HelpHandler (void) /*****************************************************************************/ -/* Singlestep */ +/* Singlestep */ /*****************************************************************************/ @@ -1325,49 +1325,49 @@ static void SingleStep (char StepInto) switch (*(unsigned char*) brk_pc) { case OPC_JMP: - /* Set breakpoint at target */ - DbgSetTmpBreak (GetArg16 ()); - return; + /* Set breakpoint at target */ + DbgSetTmpBreak (GetArg16 ()); + return; - case OPC_JMPIND: - /* Indirect jump, ignore CPU error when crossing page */ - DbgSetTmpBreak (*(unsigned*)GetArg16 ()); - return; + case OPC_JMPIND: + /* Indirect jump, ignore CPU error when crossing page */ + DbgSetTmpBreak (*(unsigned*)GetArg16 ()); + return; - case OPC_BPL: - case OPC_BMI: - case OPC_BVC: - case OPC_BVS: - case OPC_BCC: - case OPC_BCS: - case OPC_BNE: - case OPC_BEQ: - /* Be sure not to set the breakpoint twice if this is a jump to - * the following instruction. - */ + case OPC_BPL: + case OPC_BMI: + case OPC_BVC: + case OPC_BVS: + case OPC_BCC: + case OPC_BCS: + case OPC_BNE: + case OPC_BEQ: + /* Be sure not to set the breakpoint twice if this is a jump to + * the following instruction. + */ Offs = ((signed char*)brk_pc)[1]; - if (Offs) { - DbgSetTmpBreak (brk_pc + Offs + 2); - } - break; + if (Offs) { + DbgSetTmpBreak (brk_pc + Offs + 2); + } + break; case OPC_RTS: - /* Set a breakpoint at the return target */ - SetRTSBreak (); - return; + /* Set a breakpoint at the return target */ + SetRTSBreak (); + return; case OPC_RTI: - /* Set a breakpoint at the return target */ - DbgSetTmpBreak (GetStack16 (1)); - return; + /* Set a breakpoint at the return target */ + DbgSetTmpBreak (GetStack16 (1)); + return; case OPC_JSR: - if (StepInto) { - /* Set breakpoint at target */ - DbgSetTmpBreak (GetArg16 ()); - return; - } - break; + if (StepInto) { + /* Set breakpoint at target */ + DbgSetTmpBreak (GetArg16 ()); + return; + } + break; } /* Place a breakpoint behind the instruction */ @@ -1377,7 +1377,7 @@ static void SingleStep (char StepInto) /*****************************************************************************/ -/* High level window handling */ +/* High level window handling */ /*****************************************************************************/ @@ -1431,26 +1431,26 @@ static char GetKeyUpdate (void) /* While there are no keys... */ while (!kbhit ()) { - switch (Win) { + switch (Win) { - case 0: - UpdateAsm (); - break; + case 0: + UpdateAsm (); + break; - case 1: - UpdateStack (); - break; + case 1: + UpdateStack (); + break; - case 2: - UpdateCStack (); - break; + case 2: + UpdateCStack (); + break; - case 3: - UpdateDump (); - break; - } + case 3: + UpdateDump (); + break; + } - Win = (Win + 1) & 0x03; + Win = (Win + 1) & 0x03; } @@ -1461,7 +1461,7 @@ static char GetKeyUpdate (void) /*****************************************************************************/ -/* Externally visible functions */ +/* Externally visible functions */ /*****************************************************************************/ @@ -1475,110 +1475,110 @@ void DbgEntry (void) /* If this is the first call, setup the display */ if (FirstTime) { - FirstTime = 0; + FirstTime = 0; - /* Draw the window, default active frame is ASM frame */ - RedrawStatic (WIN_ASM); - InitAsm (); - InitReg (); - InitStack (); - InitCStack (); - UpdateDump (); + /* Draw the window, default active frame is ASM frame */ + RedrawStatic (WIN_ASM); + InitAsm (); + InitReg (); + InitStack (); + InitCStack (); + UpdateDump (); } /* Only initialize variables here, don't do a display update. The actual * display update will be done while waiting for user input. */ AsmHome (); - UpdateReg (); /* Must update this (static later) */ + UpdateReg (); /* Must update this (static later) */ StackHome (); CStackHome (); /* Wait for user input */ done = 0; while (!done) { - c = Frames [ActiveFrame]->fd_func (); - switch (c) { + c = Frames [ActiveFrame]->fd_func (); + switch (c) { - case '1': - case '2': - case '3': - case '4': - case '5': - ActivateFrame (c - '1', 0); - break; + case '1': + case '2': + case '3': + case '4': + case '5': + ActivateFrame (c - '1', 0); + break; - case '?': + case '?': #ifdef CH_F1 - case CH_F1: + case CH_F1: #endif - HelpHandler (); - break; + HelpHandler (); + break; - case 'u': + case 'u': #ifdef CH_F3 - case CH_F3: + case CH_F3: #endif - /* Go until return */ - SetRTSBreak (); - done = 1; - break; + /* Go until return */ + SetRTSBreak (); + done = 1; + break; - case 'h': + case 'h': #ifdef CH_F4 - case CH_F4: + case CH_F4: #endif - /* Go to cursor, only possible if cursor not at current PC */ - if (AsmAddr != brk_pc) { - DbgSetTmpBreak (AsmAddr); - done = 1; - } - break; + /* Go to cursor, only possible if cursor not at current PC */ + if (AsmAddr != brk_pc) { + DbgSetTmpBreak (AsmAddr); + done = 1; + } + break; - case ' ': + case ' ': #ifdef CH_F7 - case CH_F7: + case CH_F7: #endif - SingleStep (1); - if (DbgTmpBreaksOk ()) { - /* Could set breakpoints */ - done = 1; - } - break; + SingleStep (1); + if (DbgTmpBreaksOk ()) { + /* Could set breakpoints */ + done = 1; + } + break; - case '\n': + case '\n': #ifdef CH_F8 - case CH_F8: + case CH_F8: #endif - SingleStep (0); - if (DbgTmpBreaksOk ()) { - /* Could set breakpoints */ - done = 1; - } - break; + SingleStep (0); + if (DbgTmpBreaksOk ()) { + /* Could set breakpoints */ + done = 1; + } + break; - case 'c': - case 0: - done = 1; - break; + case 'c': + case 0: + done = 1; + break; - case 's': - /* Skip instruction */ - brk_pc += DbgDisAsmLen (brk_pc); - InitAsm (); - break; + case 's': + /* Skip instruction */ + brk_pc += DbgDisAsmLen (brk_pc); + InitAsm (); + break; - case 'r': - /* Redraw screen */ - Redraw (ActiveFrame); - break; + case 'r': + /* Redraw screen */ + Redraw (ActiveFrame); + break; - case 'q': - /* Quit program */ - clrscr (); - exit (1); + case 'q': + /* Quit program */ + clrscr (); + exit (1); - } + } } } diff --git a/libsrc/dbg/dbgdasm.s b/libsrc/dbg/dbgdasm.s index b1e7f152f..9899c0add 100644 --- a/libsrc/dbg/dbgdasm.s +++ b/libsrc/dbg/dbgdasm.s @@ -9,73 +9,73 @@ ; (TEDMon). ; - .import popax - .import __hextab, OffsetTab, AdrFlagTab - .import SymbolTab1, SymbolTab2, MnemoTab1, MnemoTab2 + .import popax + .import __hextab, OffsetTab, AdrFlagTab + .import SymbolTab1, SymbolTab2, MnemoTab1, MnemoTab2 ; ------------------------------------------------------------------------- ; Equates for better readability - .importzp sreg, tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3 + .importzp sreg, tmp1, tmp2, tmp3, tmp4, ptr1, ptr2, ptr3 -BufIndex = tmp1 ; Index into output buffer -OperandLen = tmp2 ; Length of operand -BufLen = tmp3 ; Length of output buffer -AdrFlagBuf = tmp4 ; Flag for addressing mode -YSave = sreg ; Temp storage -XSave = sreg+1 ; Dito -BufPtr = ptr1 ; Pointer to output buffer -MemPtr = ptr2 ; Pointer to memory to disassemble -MnemoBuf = ptr3 ; Buffer for decoding mnemonic +BufIndex = tmp1 ; Index into output buffer +OperandLen = tmp2 ; Length of operand +BufLen = tmp3 ; Length of output buffer +AdrFlagBuf = tmp4 ; Flag for addressing mode +YSave = sreg ; Temp storage +XSave = sreg+1 ; Dito +BufPtr = ptr1 ; Pointer to output buffer +MemPtr = ptr2 ; Pointer to memory to disassemble +MnemoBuf = ptr3 ; Buffer for decoding mnemonic ; ------------------------------------------------------------------------- ; Main entries - .export _DbgDisAsm, _DbgDisAsmLen + .export _DbgDisAsm, _DbgDisAsmLen -.proc _DbgDisAsm - sta BufLen ; Save the buffer length - jsr popax ; Get the buffer pointer - sta BufPtr - stx BufPtr+1 - jsr popax ; Get the address - sta MemPtr - stx MemPtr+1 - lda #0 - sta BufIndex ; Initialize index into buffer - jsr DisAssLine ; Disassemble one line into the buffer +.proc _DbgDisAsm + sta BufLen ; Save the buffer length + jsr popax ; Get the buffer pointer + sta BufPtr + stx BufPtr+1 + jsr popax ; Get the address + sta MemPtr + stx MemPtr+1 + lda #0 + sta BufIndex ; Initialize index into buffer + jsr DisAssLine ; Disassemble one line into the buffer - lda BufLen ; Get requested length - sec - sbc BufIndex - beq L2 - tax ; Count into X - ldy BufIndex - lda #$20 ; Get a space -L1: sta (BufPtr),y - iny - dex - bne L1 -L2: lda #0 ; Add C string terminator - sta (BufPtr),y - beq disassret + lda BufLen ; Get requested length + sec + sbc BufIndex + beq L2 + tax ; Count into X + ldy BufIndex + lda #$20 ; Get a space +L1: sta (BufPtr),y + iny + dex + bne L1 +L2: lda #0 ; Add C string terminator + sta (BufPtr),y + beq disassret .endproc _DbgDisAsmLen: - sta MemPtr ; Save address - stx MemPtr+1 - ldy #$00 - lda (MemPtr),y ; Get the opcode from memory... - jsr AnalyzeOPCode ; ...and analyze it + sta MemPtr ; Save address + stx MemPtr+1 + ldy #$00 + lda (MemPtr),y ; Get the opcode from memory... + jsr AnalyzeOPCode ; ...and analyze it disassret: - ldx OperandLen ; Get length of operand - inx ; Adjust for opcode byte - txa + ldx OperandLen ; Get length of operand + inx ; Adjust for opcode byte + txa ldx #$00 ; Clear high byte rts @@ -84,140 +84,140 @@ disassret: Put3Spaces: - jsr PutSpace + jsr PutSpace Put2Spaces: - jsr PutSpace + jsr PutSpace PutSpace: - lda #$20 + lda #$20 PutChar: - sty YSave ; Save Y - ldy BufIndex ; Get current line pointer - cpy BufLen ; Be sure not to overflow the buffer - bcs PC9 - sta (BufPtr),y ; store character - iny ; bump index - sty BufIndex -PC9: ldy YSave ; get old value - rts + sty YSave ; Save Y + ldy BufIndex ; Get current line pointer + cpy BufLen ; Be sure not to overflow the buffer + bcs PC9 + sta (BufPtr),y ; store character + iny ; bump index + sty BufIndex +PC9: ldy YSave ; get old value + rts ; Print the 16 bit hex value in X/Y PutHex16: - txa - jsr PutHex8 - tya + txa + jsr PutHex8 + tya ; Print 8 bit value in A, save X and Y PutHex8: - stx XSave - sty YSave - ldy BufIndex - pha - lsr a - lsr a - lsr a - lsr a - tax - lda __hextab,x - sta (BufPtr),y - iny - pla - and #$0F - tax - lda __hextab,x - sta (BufPtr),y - iny - sty BufIndex - ldy YSave - ldx XSave - rts + stx XSave + sty YSave + ldy BufIndex + pha + lsr a + lsr a + lsr a + lsr a + tax + lda __hextab,x + sta (BufPtr),y + iny + pla + and #$0F + tax + lda __hextab,x + sta (BufPtr),y + iny + sty BufIndex + ldy YSave + ldx XSave + rts ; ------------------------------------------------------------------------- ; Disassemble one line DisAssLine: - ldy MemPtr - ldx MemPtr+1 - jsr PutHex16 ; Print the address - jsr Put2Spaces ; Add some space - ldy #$00 - lda (MemPtr),y ; Get the opcode from memory... - jsr AnalyzeOPCode ; ...and analyze it - pha ; Save mnemonic - ldx OperandLen ; Number of bytes + ldy MemPtr + ldx MemPtr+1 + jsr PutHex16 ; Print the address + jsr Put2Spaces ; Add some space + ldy #$00 + lda (MemPtr),y ; Get the opcode from memory... + jsr AnalyzeOPCode ; ...and analyze it + pha ; Save mnemonic + ldx OperandLen ; Number of bytes ; Print the bytes that make up the instruction - inx -L2083: dex - bpl L208C ; Print the instruction bytes - jsr Put3Spaces ; If none left, print spaces instead - jmp L2094 -L208C: lda (MemPtr),y ; Get a byte from memory - jsr PutHex8 ; ...and print it - jsr PutSpace ; Add some space + inx +L2083: dex + bpl L208C ; Print the instruction bytes + jsr Put3Spaces ; If none left, print spaces instead + jmp L2094 +L208C: lda (MemPtr),y ; Get a byte from memory + jsr PutHex8 ; ...and print it + jsr PutSpace ; Add some space -L2094: iny ; Next one... - cpy #$03 ; Maximum is three - bcc L2083 ; +L2094: iny ; Next one... + cpy #$03 ; Maximum is three + bcc L2083 ; - jsr Put2Spaces ; Add some space after bytes + jsr Put2Spaces ; Add some space after bytes ; Print the assembler mnemonic - pla ; Get mnemonic code - ldx #$03 - jsr PutMnemo ; Print the mnemonic - ldx #$06 + pla ; Get mnemonic code + ldx #$03 + jsr PutMnemo ; Print the mnemonic + ldx #$06 ; Print the operand -L20A4: cpx #$03 - bne L20BA - ldy OperandLen - beq L20BA +L20A4: cpx #$03 + bne L20BA + ldy OperandLen + beq L20BA -L20AC: lda AdrFlagBuf - cmp #$E8 ; Branch? - lda (MemPtr),y ; Get branch offset - bcs GetBranchAdr ; If branch: Calculate address - jsr PutHex8 ; Otherwise print 8bit value - dey - bne L20AC +L20AC: lda AdrFlagBuf + cmp #$E8 ; Branch? + lda (MemPtr),y ; Get branch offset + bcs GetBranchAdr ; If branch: Calculate address + jsr PutHex8 ; Otherwise print 8bit value + dey + bne L20AC -L20BA: asl AdrFlagBuf - bcc L20CC - lda SymbolTab1-1,x - jsr PutChar - lda SymbolTab2-1,x - beq L20CC - jsr PutChar +L20BA: asl AdrFlagBuf + bcc L20CC + lda SymbolTab1-1,x + jsr PutChar + lda SymbolTab2-1,x + beq L20CC + jsr PutChar -L20CC: dex - bne L20A4 - rts +L20CC: dex + bne L20A4 + rts ; If the instruction is a branch, calculate the absolute address of the ; branch target and print it. GetBranchAdr: - jsr L20DD - clc - adc #$01 - bne L20D9 - inx ; Bump high byte -L20D9: tay - jmp PutHex16 ; Output address + jsr L20DD + clc + adc #$01 + bne L20D9 + inx ; Bump high byte +L20D9: tay + jmp PutHex16 ; Output address -L20DD: ldx MemPtr+1 - tay - bpl L20E3 - dex -L20E3: adc MemPtr - bcc L20E8 - inx ; Bump high byte -L20E8: rts +L20DD: ldx MemPtr+1 + tay + bpl L20E3 + dex +L20E3: adc MemPtr + bcc L20E8 + inx ; Bump high byte +L20E8: rts ; ------------------------------------------------------------------------- ; Subroutine to analyze an opcode byte in A. Will return a byte that @@ -225,72 +225,72 @@ L20E8: rts ; instruction in OperandLen AnalyzeOPCode: - tay - lsr a - bcc L20F8 - lsr a - bcs L2107 - cmp #$22 - beq L2107 - and #$07 - ora #$80 -L20F8: lsr a - tax - lda OffsetTab,x - bcs L2103 - lsr a - lsr a - lsr a - lsr a -L2103: and #$0F - bne L210B -L2107: ldy #$80 - lda #$00 -L210B: tax - lda AdrFlagTab,x - sta AdrFlagBuf - and #$03 - sta OperandLen - tya - and #$8F - tax - tya - ldy #$03 - cpx #$8A - beq L212B + tay + lsr a + bcc L20F8 + lsr a + bcs L2107 + cmp #$22 + beq L2107 + and #$07 + ora #$80 +L20F8: lsr a + tax + lda OffsetTab,x + bcs L2103 + lsr a + lsr a + lsr a + lsr a +L2103: and #$0F + bne L210B +L2107: ldy #$80 + lda #$00 +L210B: tax + lda AdrFlagTab,x + sta AdrFlagBuf + and #$03 + sta OperandLen + tya + and #$8F + tax + tya + ldy #$03 + cpx #$8A + beq L212B -L2120: lsr a - bcc L212B - lsr a -L2124: lsr a - ora #$20 - dey - bne L2124 - iny -L212B: dey - bne L2120 - rts +L2120: lsr a + bcc L212B + lsr a +L2124: lsr a + ora #$20 + dey + bne L2124 + iny +L212B: dey + bne L2120 + rts ; ------------------------------------------------------------------------- ; Print the mnemonic with code in A (that code was returned by ; AnalyzeOpcode). PutMnemo: - tay - lda MnemoTab1,y - sta MnemoBuf - lda MnemoTab2,y - sta MnemoBuf+1 -L213A: lda #$00 - ldy #$05 ; 3*5 bits in two bytes -L213E: asl MnemoBuf+1 - rol MnemoBuf - rol a - dey - bne L213E - adc #$3F - jsr PutChar - dex - bne L213A - jmp PutSpace + tay + lda MnemoTab1,y + sta MnemoBuf + lda MnemoTab2,y + sta MnemoBuf+1 +L213A: lda #$00 + ldy #$05 ; 3*5 bits in two bytes +L213E: asl MnemoBuf+1 + rol MnemoBuf + rol a + dey + bne L213E + adc #$3F + jsr PutChar + dex + bne L213A + jmp PutSpace diff --git a/libsrc/dbg/dbgdump.s b/libsrc/dbg/dbgdump.s index ff8818f96..b2045872f 100644 --- a/libsrc/dbg/dbgdump.s +++ b/libsrc/dbg/dbgdump.s @@ -4,78 +4,78 @@ ; char* DbgMemDump (unsigend Addr, char* Buf, unsigned char Length); ; - .export _DbgMemDump - .import addysp1 - .import __hextab - .importzp sp, tmp2, tmp3, tmp4, ptr3, ptr4 + .export _DbgMemDump + .import addysp1 + .import __hextab + .importzp sp, tmp2, tmp3, tmp4, ptr3, ptr4 _DbgMemDump: - ldy #0 - lda (sp),y ; Get length - sta tmp4 - iny - lda (sp),y ; Get the string buffer - sta ptr3 - iny - lda (sp),y - sta ptr3+1 - iny - lda (sp),y ; Get the address - sta ptr4 - iny - lda (sp),y - sta ptr4+1 - jsr addysp1 ; Drop the parameters + ldy #0 + lda (sp),y ; Get length + sta tmp4 + iny + lda (sp),y ; Get the string buffer + sta ptr3 + iny + lda (sp),y + sta ptr3+1 + iny + lda (sp),y ; Get the address + sta ptr4 + iny + lda (sp),y + sta ptr4+1 + jsr addysp1 ; Drop the parameters - lda #0 - sta tmp2 ; String index - sta tmp3 ; Byte index + lda #0 + sta tmp2 ; String index + sta tmp3 ; Byte index ; Print the address - lda ptr4+1 ; Hi address byte - jsr dump ; Print address - lda ptr4 ; Lo address byte - jsr dump - jsr putspace ; Add a space + lda ptr4+1 ; Hi address byte + jsr dump ; Print address + lda ptr4 ; Lo address byte + jsr dump + jsr putspace ; Add a space -dump1: dec tmp4 ; Bytes left? - bmi dump9 ; Jump if no - jsr putspace ; Add a space - ldy tmp3 - inc tmp3 - lda (ptr4),y - jsr dump - jmp dump1 +dump1: dec tmp4 ; Bytes left? + bmi dump9 ; Jump if no + jsr putspace ; Add a space + ldy tmp3 + inc tmp3 + lda (ptr4),y + jsr dump + jmp dump1 -dump9: lda #0 - ldy tmp2 - sta (ptr3),y ; Add string terminator - lda ptr3 - ldx ptr3+1 ; We assume this is not zero - rts +dump9: lda #0 + ldy tmp2 + sta (ptr3),y ; Add string terminator + lda ptr3 + ldx ptr3+1 ; We assume this is not zero + rts ; Dump one hex byte -dump: pha - lsr a - lsr a - lsr a - lsr a - tax - lda __hextab,x - jsr putc - pla - and #$0F - tax - lda __hextab,x -putc: ldy tmp2 - inc tmp2 - sta (ptr3),y - rts +dump: pha + lsr a + lsr a + lsr a + lsr a + tax + lda __hextab,x + jsr putc + pla + and #$0F + tax + lda __hextab,x +putc: ldy tmp2 + inc tmp2 + sta (ptr3),y + rts putspace: - lda #$20 - bne putc + lda #$20 + bne putc diff --git a/libsrc/dbg/dbgisram.s b/libsrc/dbg/dbgisram.s index f231b3fbb..87cfa0ff4 100644 --- a/libsrc/dbg/dbgisram.s +++ b/libsrc/dbg/dbgisram.s @@ -4,52 +4,52 @@ ; int DbgIsRAM (unsigned Addr); ; - .export _DbgIsRAM - .import popax, return0, return1 - .importzp ptr1 + .export _DbgIsRAM + .import popax, return0, return1 + .importzp ptr1 _DbgIsRAM: - sta ptr1 ; Store the address - stx ptr1+1 + sta ptr1 ; Store the address + stx ptr1+1 - ldy #0 - php ; Save I flag - sei ; Disable interrupts + ldy #0 + php ; Save I flag + sei ; Disable interrupts - lda (ptr1),y ; Get old value - pha ; ...and save it + lda (ptr1),y ; Get old value + pha ; ...and save it - ldx #3 -L1: lda TestVal,x - jsr CheckCell - bne L2 - dex - bpl L1 + ldx #3 +L1: lda TestVal,x + jsr CheckCell + bne L2 + dex + bpl L1 ; This seems to be RAM - pla - sta (ptr1),y ; Restore old value - plp ; Restore old I flag - jmp return1 + pla + sta (ptr1),y ; Restore old value + plp ; Restore old I flag + jmp return1 ; No RAM at this address -L2: pla - sta (ptr1),y ; Restore old value - plp ; Restore old I flag - jmp return0 +L2: pla + sta (ptr1),y ; Restore old value + plp ; Restore old I flag + jmp return0 ; Check one memory cell CheckCell: - sta (ptr1),y - cmp (ptr1),y ; Could we write it? - rts + sta (ptr1),y + cmp (ptr1),y ; Could we write it? + rts .rodata TestVal: - .byte $55, $AA, $33, $CC + .byte $55, $AA, $33, $CC diff --git a/libsrc/dbg/dbgsupp.s b/libsrc/dbg/dbgsupp.s index 0f9a7041c..9f044c728 100644 --- a/libsrc/dbg/dbgsupp.s +++ b/libsrc/dbg/dbgsupp.s @@ -4,11 +4,11 @@ ; Support routines for the debugger ; - .export _DbgInit - .export _DbgSP, _DbgCS, _DbgHI - .import popax, return0, _DbgEntry, _set_brk, _end_brk - .import _DbgBreaks - .import _brk_pc + .export _DbgInit + .export _DbgSP, _DbgCS, _DbgHI + .import popax, return0, _DbgEntry, _set_brk, _end_brk + .import _DbgBreaks + .import _brk_pc .import __ZP_START__ ; Linker generated .include "zeropage.inc" @@ -17,71 +17,71 @@ ; C callable function, will install the debugger _DbgInit: - lda #DbgBreak - jmp _set_brk + lda #DbgBreak + jmp _set_brk ; Entry for the break vector. DbgBreak: - pla - sta retsav - pla - sta retsav+1 + pla + sta retsav + pla + sta retsav+1 - cli - tsx ; Stack pointer - stx _DbgSP + cli + tsx ; Stack pointer + stx _DbgSP - jsr DbgSwapZP ; Swap stuff - lda #DbgStack - sta sp+1 - jsr ResetDbgBreaks ; Reset temporary breakpoints - jsr _DbgEntry ; Call C code - jsr SetDbgBreaks ; Set temporary breakpoints - jsr DbgSwapZP ; Swap stuff back + jsr DbgSwapZP ; Swap stuff + lda #DbgStack + sta sp+1 + jsr ResetDbgBreaks ; Reset temporary breakpoints + jsr _DbgEntry ; Call C code + jsr SetDbgBreaks ; Set temporary breakpoints + jsr DbgSwapZP ; Swap stuff back - lda retsav+1 - pha - lda retsav - pha - rts + lda retsav+1 + pha + lda retsav + pha + rts ; Stack used when in debugger mode .bss - .res 256 + .res 256 DbgStack: ; Swap space for the the C temporaries CTemp: -_DbgCS: .res 2 ; sp -_DbgHI: .res 2 ; sreg - .res (zpsavespace-4) ; Other stuff +_DbgCS: .res 2 ; sp +_DbgHI: .res 2 ; sreg + .res (zpsavespace-4) ; Other stuff -_DbgSP: .res 1 -retsav: .res 2 ; Save buffer for return address +_DbgSP: .res 1 +retsav: .res 2 ; Save buffer for return address .code ; Swap the C temporaries DbgSwapZP: - ldy #zpsavespace-1 -Swap1: ldx CTemp,y - lda <__ZP_START__,y - sta CTemp,y - txa - sta sp,y - dey - bpl Swap1 - rts + ldy #zpsavespace-1 +Swap1: ldx CTemp,y + lda <__ZP_START__,y + sta CTemp,y + txa + sta sp,y + dey + bpl Swap1 + rts ; ---------------------------------------------------------------------------- ; Utility functions @@ -92,114 +92,114 @@ Swap1: ldx CTemp,y ; reset the breakpoints. See declaration of struct breakpoint in the C ; source -MaxBreaks = 48 ; 4*12 +MaxBreaks = 48 ; 4*12 ResetDbgBreaks: - ldy #0 - ldx #0 -L4: lda _DbgBreaks+3,x ; Get bk_use - beq L6 ; Jump if not set - bpl L5 ; Jump if user breakpoint - lda #0 - sta _DbgBreaks+3,x ; Clear if temp breakpoint -L5: lda _DbgBreaks+1,x ; PC hi - sta ptr1+1 - lda _DbgBreaks,x ; PC lo - sta ptr1 - lda _DbgBreaks+2,x ; Old OPC - sta (ptr1),y ; Reset the breakpoint -L6: inx - inx - inx - inx - cpx #MaxBreaks ; Done? - bne L4 - rts + ldy #0 + ldx #0 +L4: lda _DbgBreaks+3,x ; Get bk_use + beq L6 ; Jump if not set + bpl L5 ; Jump if user breakpoint + lda #0 + sta _DbgBreaks+3,x ; Clear if temp breakpoint +L5: lda _DbgBreaks+1,x ; PC hi + sta ptr1+1 + lda _DbgBreaks,x ; PC lo + sta ptr1 + lda _DbgBreaks+2,x ; Old OPC + sta (ptr1),y ; Reset the breakpoint +L6: inx + inx + inx + inx + cpx #MaxBreaks ; Done? + bne L4 + rts SetDbgBreaks: - ldx #0 - ldy #0 -L7: lda _DbgBreaks+3,x ; Get bk_use - beq L8 ; Jump if not set - lda _DbgBreaks+1,x ; PC hi - sta ptr1+1 - lda _DbgBreaks,x ; PC lo - sta ptr1 - lda (ptr1),y ; Get the breakpoint OPC... - sta _DbgBreaks+2,x ; ...and save it - lda #$00 ; Load BRK opcode - sta (ptr1),y -L8: inx - inx - inx - inx - cpx #MaxBreaks ; Done? - bne L7 - rts + ldx #0 + ldy #0 +L7: lda _DbgBreaks+3,x ; Get bk_use + beq L8 ; Jump if not set + lda _DbgBreaks+1,x ; PC hi + sta ptr1+1 + lda _DbgBreaks,x ; PC lo + sta ptr1 + lda (ptr1),y ; Get the breakpoint OPC... + sta _DbgBreaks+2,x ; ...and save it + lda #$00 ; Load BRK opcode + sta (ptr1),y +L8: inx + inx + inx + inx + cpx #MaxBreaks ; Done? + bne L7 + rts ; Get a free breakpoint slot or return 0 - .export _DbgGetBreakSlot + .export _DbgGetBreakSlot _DbgGetBreakSlot: - ldx #0 -L10: lda _DbgBreaks+3,x ; Get bk_use - beq L11 ; Jump if not set - inx - inx - inx - inx - cpx #MaxBreaks ; Done? - bne L10 - jmp return0 ; No free slot + ldx #0 +L10: lda _DbgBreaks+3,x ; Get bk_use + beq L11 ; Jump if not set + inx + inx + inx + inx + cpx #MaxBreaks ; Done? + bne L10 + jmp return0 ; No free slot -L11: stx tmp1 - lda #<_DbgBreaks - ldx #>_DbgBreaks - clc - adc tmp1 - bcc L12 - inx -L12: ldy #1 ; Force != 0 - rts +L11: stx tmp1 + lda #<_DbgBreaks + ldx #>_DbgBreaks + clc + adc tmp1 + bcc L12 + inx +L12: ldy #1 ; Force != 0 + rts ; Check if a given address has a user breakpoint set, if found, return the ; slot, otherwise return 0. - .export _DbgIsBreak + .export _DbgIsBreak _DbgIsBreak: - jsr popax ; Get address - sta ptr1 - stx ptr1+1 - ldx #0 -L20: lda _DbgBreaks+3,x ; Get bk_use - beq L21 ; Jump if not set - bmi L21 ; Jump if temp breakpoint - lda _DbgBreaks,x ; Low byte of address - cmp ptr1 - bne L21 - lda _DbgBreaks+1,x ; High byte of address - cmp ptr1+1 - beq L22 -L21: inx - inx - inx - inx - cpx #MaxBreaks ; Done? - bne L20 - jmp return0 ; Not found + jsr popax ; Get address + sta ptr1 + stx ptr1+1 + ldx #0 +L20: lda _DbgBreaks+3,x ; Get bk_use + beq L21 ; Jump if not set + bmi L21 ; Jump if temp breakpoint + lda _DbgBreaks,x ; Low byte of address + cmp ptr1 + bne L21 + lda _DbgBreaks+1,x ; High byte of address + cmp ptr1+1 + beq L22 +L21: inx + inx + inx + inx + cpx #MaxBreaks ; Done? + bne L20 + jmp return0 ; Not found -L22: stx tmp1 - lda #<_DbgBreaks - ldx #>_DbgBreaks - clc - adc tmp1 - bcc L23 - inx -L23: ldy #1 ; Force != 0 - rts +L22: stx tmp1 + lda #<_DbgBreaks + ldx #>_DbgBreaks + clc + adc tmp1 + bcc L23 + inx +L23: ldy #1 ; Force != 0 + rts diff --git a/libsrc/em/em-kernel.s b/libsrc/em/em-kernel.s index 881c51748..9c1342964 100644 --- a/libsrc/em/em-kernel.s +++ b/libsrc/em/em-kernel.s @@ -16,23 +16,23 @@ .bss -_em_drv: .res 2 ; Pointer to driver +_em_drv: .res 2 ; Pointer to driver ; Jump table for the driver functions. .data emd_vectors: -emd_install: jmp return0 -emd_uninstall: jmp return0 +emd_install: jmp return0 +emd_uninstall: jmp return0 emd_pagecount: jmp return0 emd_map: jmp return0 emd_use: jmp return0 emd_commit: jmp return0 -emd_copyfrom: jmp return0 +emd_copyfrom: jmp return0 emd_copyto: jmp return0 ; Driver header signature .rodata -emd_sig: .byte $65, $6d, $64, EMD_API_VERSION ; "emd", version +emd_sig: .byte $65, $6d, $64, EMD_API_VERSION ; "emd", version ;---------------------------------------------------------------------------- @@ -41,10 +41,10 @@ emd_sig: .byte $65, $6d, $64, EMD_API_VERSION ; "emd", version _em_install: - sta _em_drv - sta ptr1 - stx _em_drv+1 - stx ptr1+1 + sta _em_drv + sta ptr1 + stx _em_drv+1 + stx ptr1+1 ; Check the driver signature diff --git a/libsrc/em/em_commit.s b/libsrc/em/em_commit.s index a7d235c3f..66af02df9 100644 --- a/libsrc/em/em_commit.s +++ b/libsrc/em/em_commit.s @@ -11,4 +11,4 @@ .include "em-kernel.inc" - _em_commit = emd_commit ; Use driver entry + _em_commit = emd_commit ; Use driver entry diff --git a/libsrc/em/em_copyfrom.s b/libsrc/em/em_copyfrom.s index 47bf1e6d2..edcff795b 100644 --- a/libsrc/em/em_copyfrom.s +++ b/libsrc/em/em_copyfrom.s @@ -7,5 +7,5 @@ .include "em-kernel.inc" - _em_copyfrom = emd_copyfrom ; Use driver entry + _em_copyfrom = emd_copyfrom ; Use driver entry diff --git a/libsrc/em/em_copyto.s b/libsrc/em/em_copyto.s index da2664c87..aa89b0e56 100644 --- a/libsrc/em/em_copyto.s +++ b/libsrc/em/em_copyto.s @@ -7,5 +7,5 @@ .include "em-kernel.inc" - _em_copyto = emd_copyto ; Use driver entry + _em_copyto = emd_copyto ; Use driver entry diff --git a/libsrc/em/em_map.s b/libsrc/em/em_map.s index 760103d24..9897243a3 100644 --- a/libsrc/em/em_map.s +++ b/libsrc/em/em_map.s @@ -9,5 +9,5 @@ .include "em-kernel.inc" - _em_map = emd_map ; Use driver entry + _em_map = emd_map ; Use driver entry diff --git a/libsrc/em/em_pagecount.s b/libsrc/em/em_pagecount.s index 298b2a7e0..01b82d5f7 100644 --- a/libsrc/em/em_pagecount.s +++ b/libsrc/em/em_pagecount.s @@ -7,5 +7,5 @@ .include "em-kernel.inc" - _em_pagecount = emd_pagecount ; Use driver entry + _em_pagecount = emd_pagecount ; Use driver entry diff --git a/libsrc/em/em_unload.s b/libsrc/em/em_unload.s index 74ee2f92a..99a17844e 100644 --- a/libsrc/em/em_unload.s +++ b/libsrc/em/em_unload.s @@ -12,11 +12,11 @@ .include "modload.inc" _em_unload: - lda _em_drv - ora _em_drv+1 - beq no_driver ; No driver + lda _em_drv + ora _em_drv+1 + beq no_driver ; No driver - jsr emd_uninstall ; Deinstall the driver + jsr emd_uninstall ; Deinstall the driver lda _em_drv ldx _em_drv+1 @@ -25,6 +25,6 @@ _em_unload: jmp em_clear_ptr ; Clear the driver pointer, return zero no_driver: - tax ; X = 0 - lda #EM_ERR_NO_DRIVER - rts + tax ; X = 0 + lda #EM_ERR_NO_DRIVER + rts diff --git a/libsrc/em/em_use.s b/libsrc/em/em_use.s index 3f07a5147..8e4d57df0 100644 --- a/libsrc/em/em_use.s +++ b/libsrc/em/em_use.s @@ -13,5 +13,5 @@ .include "em-kernel.inc" - _em_use = emd_use ; Use driver entry + _em_use = emd_use ; Use driver entry diff --git a/libsrc/geos-apple/disk/enterturbo.s b/libsrc/geos-apple/disk/enterturbo.s index 1a688ba12..066546c65 100644 --- a/libsrc/geos-apple/disk/enterturbo.s +++ b/libsrc/geos-apple/disk/enterturbo.s @@ -5,7 +5,7 @@ ; void EnterTurbo (void); - .export _EnterTurbo - .import return0 + .export _EnterTurbo + .import return0 -_EnterTurbo = return0 +_EnterTurbo = return0 diff --git a/libsrc/geos-apple/disk/exitturbo.s b/libsrc/geos-apple/disk/exitturbo.s index 678a3d12f..7098a56c4 100644 --- a/libsrc/geos-apple/disk/exitturbo.s +++ b/libsrc/geos-apple/disk/exitturbo.s @@ -5,9 +5,9 @@ ; void ExitTurbo (void); - .export _ExitTurbo - .import return0 + .export _ExitTurbo + .import return0 -_ExitTurbo = return0 - - +_ExitTurbo = return0 + + diff --git a/libsrc/geos-apple/disk/purgeturbo.s b/libsrc/geos-apple/disk/purgeturbo.s index 059526630..631e7f17b 100644 --- a/libsrc/geos-apple/disk/purgeturbo.s +++ b/libsrc/geos-apple/disk/purgeturbo.s @@ -5,7 +5,7 @@ ; void PurgeTurbo (void); - .export _PurgeTurbo - .import return0 + .export _PurgeTurbo + .import return0 -_PurgeTurbo = return0 +_PurgeTurbo = return0 diff --git a/libsrc/geos-apple/diskdrv.inc b/libsrc/geos-apple/diskdrv.inc index 86809c8b9..632717bb2 100644 --- a/libsrc/geos-apple/diskdrv.inc +++ b/libsrc/geos-apple/diskdrv.inc @@ -3,60 +3,60 @@ ;Source: The Hitchhiker's Guide To GEOS ;http://lyonlabs.org/commodore/onrequest/geos-manuals/The_Hitchhikers_Guide_to_GEOS.pdf -GetBlock = $0300 -PutBlock = $0303 -GetFile = $030f -LdFile = $0312 -ReadFile = $0315 -SaveFile = $0318 -WriteFile = $031b -GetVBM = $031e -PutVBM = $0321 -CalcBlksFree = $0324 -FreeBlock = $032a -SetNextFree = $032d -AppendRecord = $0330 -CloseRecordFile = $0333 -DeleteRecord = $0336 -NextRecord = $0336 -InsertRecord = $0339 -OpenRecordFile = $033f -PointRecord = $0342 -PreviousRecord = $0345 -ReadRecord = $0348 -UpdateRecordFile = $034b -WriteRecord = $034e -BlkAlloc = $0351 -NxtBlkAlloc = $0354 -DeleteFile = $0357 -FreeFile = $035a -LdDeskAcc = $035d -RstrAppl = $0360 -FdFTypesInDir = $0363 -FindFTypes = $0366 -FindFile = $0369 -FndFilinDir = $036c -BldGDirEntry = $036f -GetDirHead = $0372 -GetFreeDirBlk = $0375 -PutDirHead = $037b -SetGDirEntry = $037b -DeleteDir = $037e -DownDirectory = $0381 -GetPathname = $0384 -MakeSubDir = $0387 -UpDirectory = $038a -LdApplic = $038d -GetFHdrInfo = $0390 -RenameFile = $0393 -OpenDisk = $0399 -Get1stDirEntry = $039c -GetNxtDirEntry = $039c -GoDirectory = $039f -ReOpenDisk = $03a2 -SortAlpha = $03a5 -SaveFG = $03ab -RecoverFG = $03ae -JsrToAux = $03b4 -UpdateParent = $03b7 -FreeDir = $03ba +GetBlock = $0300 +PutBlock = $0303 +GetFile = $030f +LdFile = $0312 +ReadFile = $0315 +SaveFile = $0318 +WriteFile = $031b +GetVBM = $031e +PutVBM = $0321 +CalcBlksFree = $0324 +FreeBlock = $032a +SetNextFree = $032d +AppendRecord = $0330 +CloseRecordFile = $0333 +DeleteRecord = $0336 +NextRecord = $0336 +InsertRecord = $0339 +OpenRecordFile = $033f +PointRecord = $0342 +PreviousRecord = $0345 +ReadRecord = $0348 +UpdateRecordFile = $034b +WriteRecord = $034e +BlkAlloc = $0351 +NxtBlkAlloc = $0354 +DeleteFile = $0357 +FreeFile = $035a +LdDeskAcc = $035d +RstrAppl = $0360 +FdFTypesInDir = $0363 +FindFTypes = $0366 +FindFile = $0369 +FndFilinDir = $036c +BldGDirEntry = $036f +GetDirHead = $0372 +GetFreeDirBlk = $0375 +PutDirHead = $037b +SetGDirEntry = $037b +DeleteDir = $037e +DownDirectory = $0381 +GetPathname = $0384 +MakeSubDir = $0387 +UpDirectory = $038a +LdApplic = $038d +GetFHdrInfo = $0390 +RenameFile = $0393 +OpenDisk = $0399 +Get1stDirEntry = $039c +GetNxtDirEntry = $039c +GoDirectory = $039f +ReOpenDisk = $03a2 +SortAlpha = $03a5 +SaveFG = $03ab +RecoverFG = $03ae +JsrToAux = $03b4 +UpdateParent = $03b7 +FreeDir = $03ba diff --git a/libsrc/geos-apple/geossym.inc b/libsrc/geos-apple/geossym.inc index 039ea2d25..7ca0a5f53 100644 --- a/libsrc/geos-apple/geossym.inc +++ b/libsrc/geos-apple/geossym.inc @@ -3,180 +3,180 @@ ;Source: The Hitchhiker's Guide To GEOS ;http://lyonlabs.org/commodore/onrequest/geos-manuals/The_Hitchhikers_Guide_to_GEOS.pdf -r0 = $00 -r0L = $00 -r0H = $01 -r1 = $02 -r1L = $02 -r1H = $03 -r2 = $04 -r2L = $04 -r2H = $05 -r3 = $06 -r3L = $06 -r3H = $07 -r4 = $08 -r4L = $08 -r4H = $09 -r5 = $0a -r5L = $0a -r5H = $0b -r6 = $0c -r6L = $0c -r6H = $0d -r7 = $0e -r7L = $0e -r7H = $0f -r8 = $10 -r8L = $10 -r8H = $11 -r9 = $12 -r9L = $12 -r9H = $13 -r10 = $14 -r10L = $14 -r10H = $15 -r11 = $16 -r11L = $16 -r11H = $17 -r12 = $18 -r12L = $18 -r12H = $19 -r13 = $1a -r13L = $1a -r13H = $1b -r14 = $1c -r14L = $1c -r14H = $1d -r15 = $1e -r15L = $1e -r15H = $1f +r0 = $00 +r0L = $00 +r0H = $01 +r1 = $02 +r1L = $02 +r1H = $03 +r2 = $04 +r2L = $04 +r2H = $05 +r3 = $06 +r3L = $06 +r3H = $07 +r4 = $08 +r4L = $08 +r4H = $09 +r5 = $0a +r5L = $0a +r5H = $0b +r6 = $0c +r6L = $0c +r6H = $0d +r7 = $0e +r7L = $0e +r7H = $0f +r8 = $10 +r8L = $10 +r8H = $11 +r9 = $12 +r9L = $12 +r9H = $13 +r10 = $14 +r10L = $14 +r10H = $15 +r11 = $16 +r11L = $16 +r11H = $17 +r12 = $18 +r12L = $18 +r12H = $19 +r13 = $1a +r13L = $1a +r13H = $1b +r14 = $1c +r14L = $1c +r14H = $1d +r15 = $1e +r15L = $1e +r15H = $1f -string = $53 -mouseTop = $57 -mouseBottom = $58 -mouseLeft = $59 -mouseRight = $5b -mouseOn = $5d -curIndexTable = $5e -cardDataPntr = $60 -returnAddress = $64 -shiftBuf = $70 -shiftOutBuf = $78 -appMain = $0200 -intTopVector = $0202 -intBotVector = $0204 -mouseVector = $0206 -keyVector = $0208 -inputVector = $020a -mouseFaultVec = $020c -otherPressVec = $020e -StringFaultVec = $0210 -alarmTmtVector = $0212 -BRKVector = $0214 -RecoverVector = $0216 -baselineOffset = $0218 -curSetWidth = $0219 -curHeight = $021b -currentMode = $021c -dispBufferOn = $021d -windowTop = $021e -leftMargin = $0220 -rightMargin = $0222 -selectionFlash = $0224 -alphaFlag = $0225 -iconSelFlag = $0226 -faultData = $0227 -MenuNumber = $0228 -mouseXOffset = $0229 -mouseYOffset = $022b -curPattern = $022c -stringX = $022e -stringY = $0230 -noEraseSprites = $0240 -mouseXPos = $0241 -mouseYPos = $0243 -keyData = $0245 -inputData = $0247 -random = $024c -saveFontTab = $024e -dblClickCount = $0258 -sysDBData = $0259 -offFlag = $027c -maxMouseSpeed = $027d -minMouseSpeed = $027e -mouseAccel = $027f -firstBoot = $0281 -dataFileName = $02a4 -dataDiskName = $02b4 -MachineType = $02c4 -intSource = $02c6 -reqXpos0 = $0800 -reqXpos1 = $0802 -reqXpos2 = $0804 -reqXpos3 = $0806 -reqXpos4 = $0808 -reqXpos5 = $080a -reqXpos6 = $080c -reqXpos7 = $080e -mobenble = $0818 -mobx2 = $0819 -moby2 = $081a -PrntFileName = $08ac -inputDevName = $08cc -pressFlag = $08fe -curEnable = $0951 -sspr1back = $56d0 -sspr2back = $5820 -sspr3back = $5970 -sspr4back = $5ac0 -sspr5back = $5c10 -sspr6back = $5d60 -sspr7back = $5eb0 -backBufPtr = $9d7c -softOnes = $d000 -softZeros = $d0e0 -curnoby2 = $d952 -curmobx2 = $d953 -curXpos0 = $d954 -curYpos0 = $d964 -backXBufNum = $d98c -backYBufNum = $d994 -sizeFlags = $db1c -doRestFlag = $db1d -bootName = $e003 -version = $e00c -nationality = $e00d -mouseSave = $ee53 -year = $f200 -month = $f201 -day = $f202 -hour = $f203 -minutes = $f204 -seconds = $f205 -dlgBoxRamBuf = $f381 -totNumBlks = $f60b -curDrive = $f60d -numDrives = $f60e -diskOpenFlg = $f617 -curRecord = $f618 -usedRecords = $f619 -fileWritten = $f61a -fileSize = $f61b -dirBlkno = $f620 -dirPtr = $f622 -indexBlkno = $f624 -diskBlkBuf = $f659 -fileHeader = $f859 -dirEntryBuf = $fa59 -curDirHead = $fa80 -DrACurDkNm = $faa7 -DrBCurDkNm = $fab7 -DrCCurDkNm = $fac7 -DrDCurDkNm = $fad7 -devTabHi = $fae7 -devTabLo = $faeb -devUnitTab = $faef -driveType = $faf3 -drSizeLo = $faf7 -drSizeHi = $fafb +string = $53 +mouseTop = $57 +mouseBottom = $58 +mouseLeft = $59 +mouseRight = $5b +mouseOn = $5d +curIndexTable = $5e +cardDataPntr = $60 +returnAddress = $64 +shiftBuf = $70 +shiftOutBuf = $78 +appMain = $0200 +intTopVector = $0202 +intBotVector = $0204 +mouseVector = $0206 +keyVector = $0208 +inputVector = $020a +mouseFaultVec = $020c +otherPressVec = $020e +StringFaultVec = $0210 +alarmTmtVector = $0212 +BRKVector = $0214 +RecoverVector = $0216 +baselineOffset = $0218 +curSetWidth = $0219 +curHeight = $021b +currentMode = $021c +dispBufferOn = $021d +windowTop = $021e +leftMargin = $0220 +rightMargin = $0222 +selectionFlash = $0224 +alphaFlag = $0225 +iconSelFlag = $0226 +faultData = $0227 +MenuNumber = $0228 +mouseXOffset = $0229 +mouseYOffset = $022b +curPattern = $022c +stringX = $022e +stringY = $0230 +noEraseSprites = $0240 +mouseXPos = $0241 +mouseYPos = $0243 +keyData = $0245 +inputData = $0247 +random = $024c +saveFontTab = $024e +dblClickCount = $0258 +sysDBData = $0259 +offFlag = $027c +maxMouseSpeed = $027d +minMouseSpeed = $027e +mouseAccel = $027f +firstBoot = $0281 +dataFileName = $02a4 +dataDiskName = $02b4 +MachineType = $02c4 +intSource = $02c6 +reqXpos0 = $0800 +reqXpos1 = $0802 +reqXpos2 = $0804 +reqXpos3 = $0806 +reqXpos4 = $0808 +reqXpos5 = $080a +reqXpos6 = $080c +reqXpos7 = $080e +mobenble = $0818 +mobx2 = $0819 +moby2 = $081a +PrntFileName = $08ac +inputDevName = $08cc +pressFlag = $08fe +curEnable = $0951 +sspr1back = $56d0 +sspr2back = $5820 +sspr3back = $5970 +sspr4back = $5ac0 +sspr5back = $5c10 +sspr6back = $5d60 +sspr7back = $5eb0 +backBufPtr = $9d7c +softOnes = $d000 +softZeros = $d0e0 +curnoby2 = $d952 +curmobx2 = $d953 +curXpos0 = $d954 +curYpos0 = $d964 +backXBufNum = $d98c +backYBufNum = $d994 +sizeFlags = $db1c +doRestFlag = $db1d +bootName = $e003 +version = $e00c +nationality = $e00d +mouseSave = $ee53 +year = $f200 +month = $f201 +day = $f202 +hour = $f203 +minutes = $f204 +seconds = $f205 +dlgBoxRamBuf = $f381 +totNumBlks = $f60b +curDrive = $f60d +numDrives = $f60e +diskOpenFlg = $f617 +curRecord = $f618 +usedRecords = $f619 +fileWritten = $f61a +fileSize = $f61b +dirBlkno = $f620 +dirPtr = $f622 +indexBlkno = $f624 +diskBlkBuf = $f659 +fileHeader = $f859 +dirEntryBuf = $fa59 +curDirHead = $fa80 +DrACurDkNm = $faa7 +DrBCurDkNm = $fab7 +DrCCurDkNm = $fac7 +DrDCurDkNm = $fad7 +devTabHi = $fae7 +devTabLo = $faeb +devUnitTab = $faef +driveType = $faf3 +drSizeLo = $faf7 +drSizeHi = $fafb diff --git a/libsrc/geos-apple/jumptab.inc b/libsrc/geos-apple/jumptab.inc index f98858e80..2590433ba 100644 --- a/libsrc/geos-apple/jumptab.inc +++ b/libsrc/geos-apple/jumptab.inc @@ -3,163 +3,163 @@ ;Source: The Hitchhiker's Guide To GEOS ;http://lyonlabs.org/commodore/onrequest/geos-manuals/The_Hitchhikers_Guide_to_GEOS.pdf -ReadClock = $0800 -ClockInt = $0803 -SetTimeDate = $0806 -SetAlarm = $0809 -ResetAlarm = $080c -InitForPrint = $6000 -StartPrint = $6003 -StartASCII = $6006 -PrintBuffer = $6009 -PrintASCII = $600c -StopPrint = $600f -GetMode = $6012 -SetMode = $6015 -CancelPrint = $6018 -InitCard = $6700 -OpenCard = $6703 -OutputByte = $6706 -InputByte = $6709 -CloseCard = $670c -InfoCard = $670f -StatusCard = $6712 -ClearCard = $6715 -AuxDMain = $efa0 -AuxDInt = $efa3 -AuxDKeyFilter = $efa6 -AuxDExit = $efa9 -InitMouse = $f000 -SlowMouse = $f003 -UpdateMouse = $f006 -KeyFilter = $f009 -MainLoop = $fe00 -InterruptMain = $fe03 -StartAppl = $fe06 -DoInlineReturn = $fe09 -DoIcons = $fe0c -DoMenu = $fe0f -ReDoMenu = $fe12 -DoPreviousMenu = $fe15 -GotoFirstMenu = $fe18 -RecoverMenu = $fe1b -RecoverAllMenus = $fe1e -DrawPoint = $fe21 -TestPoint = $fe24 -HorizontalLine = $fe27 -VerticalLine = $fe2a -InvertLine = $fe2d -RecoverLine = $fe30 -DrawLine = $fe33 -SetPattern = $fe36 -Rectangle = $fe39 -i_Rectangle = $fe3c -FrameRectangle = $fe3f -i_FrameRectangle = $fe42 -InvertRectangle = $fe45 -RecoverRectangle = $fe48 -i_RecoverRectangle = $fe4b -ImprintRectangle = $fe4e -i_ImprintRectangle = $fe51 -BitmapUp = $fe54 -i_BitmapUp = $fe57 -BitmapClip = $fe5a -BitOtherClip = $fe5d -GraphicsString = $fe60 -i_GraphicsString = $fe63 -GetScanLine = $fe66 -PutString = $fe69 -i_PutString = $fe6c -PutDecimal = $fe6f -GetString = $fe72 -GetNextChar = $fe75 -InitTextPrompt = $fe78 -PromptOn = $fe7b -PromptOff = $fe7e -PutChar = $fe81 -GetRealSize = $fe84 -GetCharWidth = $fe87 -LoadCharSet = $fe8a -UseSystemFont = $fe8d -SmallPutChar = $fe90 -StartMouseMode = $fe93 -MouseOff = $fe96 -MouseUp = $fe99 -IsMseInRegion = $fe9c -ClearMouseMode = $fe9f -DrawSprite = $fea2 -PosSprite = $fea5 -EnablSprite = $fea8 -DisablSprite = $feab -InitProcesses = $feae -RestartProcess = $feb1 -BlockProcess = $feb4 -UnblockProcess = $feb7 -FreezeProcess = $feba -UnfreezeProcess = $febd -Sleep = $fec0 -EnableProcess = $fec3 -DShiftLeft = $fec6 -DShiftRight = $fec9 -BBMult = $fecc -BMult = $fecf -DMult = $fed2 -Ddiv = $fed5 -DSdiv = $fed8 -Dabs = $fedb -Dnegate = $fede -Ddec = $fee1 -GetRandom = $fee4 -CopyString = $fee7 -CopyFString = $feea -CmpString = $feed -CmpFString = $fef0 -Panic = $fef3 -MoveData = $fef6 -i_MoveData = $fef9 -ClearRam = $fefc -FillRam = $feff -i_FillRam = $ff02 -InitRam = $ff05 -CallRoutine = $ff08 -NewBitOtherClip = $ff0e -FirstInit = $ff11 -CRC = $ff14 -DoDlgBox = $ff17 -RstrFrmDialogue = $ff1a -NewBitUp = $ff1d -IrqMiddle = $ff20 -TempHideMouse = $ff29 -SoftSprHandler = $ff2c -SetMsePic = $ff2f -InitSprite = $ff32 -SaveFontData = $ff35 -RestoreFontData = $ff38 -EraseCharacter = $ff3e -ReadByte = $ff41 -GetLdVars = $ff44 -SetLdVars = $ff47 -InitForDialog = $ff4a -WarmStart = $ff4d -RecoverSysRam = $ff53 -GetPtrCurDkNm = $ff56 -EnterDeskTop = $ff59 -CopyScreenBlock = $ff5c -CopyLine = $ff5f -GetScreenLine = $ff62 -PutScreenLine = $ff65 -DivideBySeven = $ff68 -MoveAuxData = $ff6b -GetSpriteData = $ff6e -SwapMainAndAux = $ff71 -ReadBackLine = $ff74 -LoadAuxSet = $ff77 -HideOnlyMouse = $ff7a -GetPattern = $ff7d -SetUserPattern = $ff80 -Bell = $ff86 -ImprintLine = $ff8f -CopyFullScreen = $ff92 -NewBitClip = $ff95 -ReadScanLine = $ff98 -i_NewBitUp = $ff9e +ReadClock = $0800 +ClockInt = $0803 +SetTimeDate = $0806 +SetAlarm = $0809 +ResetAlarm = $080c +InitForPrint = $6000 +StartPrint = $6003 +StartASCII = $6006 +PrintBuffer = $6009 +PrintASCII = $600c +StopPrint = $600f +GetMode = $6012 +SetMode = $6015 +CancelPrint = $6018 +InitCard = $6700 +OpenCard = $6703 +OutputByte = $6706 +InputByte = $6709 +CloseCard = $670c +InfoCard = $670f +StatusCard = $6712 +ClearCard = $6715 +AuxDMain = $efa0 +AuxDInt = $efa3 +AuxDKeyFilter = $efa6 +AuxDExit = $efa9 +InitMouse = $f000 +SlowMouse = $f003 +UpdateMouse = $f006 +KeyFilter = $f009 +MainLoop = $fe00 +InterruptMain = $fe03 +StartAppl = $fe06 +DoInlineReturn = $fe09 +DoIcons = $fe0c +DoMenu = $fe0f +ReDoMenu = $fe12 +DoPreviousMenu = $fe15 +GotoFirstMenu = $fe18 +RecoverMenu = $fe1b +RecoverAllMenus = $fe1e +DrawPoint = $fe21 +TestPoint = $fe24 +HorizontalLine = $fe27 +VerticalLine = $fe2a +InvertLine = $fe2d +RecoverLine = $fe30 +DrawLine = $fe33 +SetPattern = $fe36 +Rectangle = $fe39 +i_Rectangle = $fe3c +FrameRectangle = $fe3f +i_FrameRectangle = $fe42 +InvertRectangle = $fe45 +RecoverRectangle = $fe48 +i_RecoverRectangle = $fe4b +ImprintRectangle = $fe4e +i_ImprintRectangle = $fe51 +BitmapUp = $fe54 +i_BitmapUp = $fe57 +BitmapClip = $fe5a +BitOtherClip = $fe5d +GraphicsString = $fe60 +i_GraphicsString = $fe63 +GetScanLine = $fe66 +PutString = $fe69 +i_PutString = $fe6c +PutDecimal = $fe6f +GetString = $fe72 +GetNextChar = $fe75 +InitTextPrompt = $fe78 +PromptOn = $fe7b +PromptOff = $fe7e +PutChar = $fe81 +GetRealSize = $fe84 +GetCharWidth = $fe87 +LoadCharSet = $fe8a +UseSystemFont = $fe8d +SmallPutChar = $fe90 +StartMouseMode = $fe93 +MouseOff = $fe96 +MouseUp = $fe99 +IsMseInRegion = $fe9c +ClearMouseMode = $fe9f +DrawSprite = $fea2 +PosSprite = $fea5 +EnablSprite = $fea8 +DisablSprite = $feab +InitProcesses = $feae +RestartProcess = $feb1 +BlockProcess = $feb4 +UnblockProcess = $feb7 +FreezeProcess = $feba +UnfreezeProcess = $febd +Sleep = $fec0 +EnableProcess = $fec3 +DShiftLeft = $fec6 +DShiftRight = $fec9 +BBMult = $fecc +BMult = $fecf +DMult = $fed2 +Ddiv = $fed5 +DSdiv = $fed8 +Dabs = $fedb +Dnegate = $fede +Ddec = $fee1 +GetRandom = $fee4 +CopyString = $fee7 +CopyFString = $feea +CmpString = $feed +CmpFString = $fef0 +Panic = $fef3 +MoveData = $fef6 +i_MoveData = $fef9 +ClearRam = $fefc +FillRam = $feff +i_FillRam = $ff02 +InitRam = $ff05 +CallRoutine = $ff08 +NewBitOtherClip = $ff0e +FirstInit = $ff11 +CRC = $ff14 +DoDlgBox = $ff17 +RstrFrmDialogue = $ff1a +NewBitUp = $ff1d +IrqMiddle = $ff20 +TempHideMouse = $ff29 +SoftSprHandler = $ff2c +SetMsePic = $ff2f +InitSprite = $ff32 +SaveFontData = $ff35 +RestoreFontData = $ff38 +EraseCharacter = $ff3e +ReadByte = $ff41 +GetLdVars = $ff44 +SetLdVars = $ff47 +InitForDialog = $ff4a +WarmStart = $ff4d +RecoverSysRam = $ff53 +GetPtrCurDkNm = $ff56 +EnterDeskTop = $ff59 +CopyScreenBlock = $ff5c +CopyLine = $ff5f +GetScreenLine = $ff62 +PutScreenLine = $ff65 +DivideBySeven = $ff68 +MoveAuxData = $ff6b +GetSpriteData = $ff6e +SwapMainAndAux = $ff71 +ReadBackLine = $ff74 +LoadAuxSet = $ff77 +HideOnlyMouse = $ff7a +GetPattern = $ff7d +SetUserPattern = $ff80 +Bell = $ff86 +ImprintLine = $ff8f +CopyFullScreen = $ff92 +NewBitClip = $ff95 +ReadScanLine = $ff98 +i_NewBitUp = $ff9e diff --git a/libsrc/geos-cbm/dio.inc b/libsrc/geos-cbm/dio.inc index 7dfe54f07..2bd96ac5d 100644 --- a/libsrc/geos-cbm/dio.inc +++ b/libsrc/geos-cbm/dio.inc @@ -1,12 +1,12 @@ ; offsets into sectsizetab (DIO functions) -sst_flag = 0 ; length 1 -sst_sectsize = 1 ; 2 -sst_driveno = 3 ; 1 (drive #) -sst_size = 4 ; size of one entry - ; if changed, adapt diopncls.s +sst_flag = 0 ; length 1 +sst_sectsize = 1 ; 2 +sst_driveno = 3 ; 1 (drive #) +sst_size = 4 ; size of one entry + ; if changed, adapt diopncls.s ; offsets into dio_phys_pos -diopp_head = 0 ; head -diopp_track = 1 ; track / cylinder -diopp_sector = 3 ; sector -diopp_size = 5 ; size of structure +diopp_head = 0 ; head +diopp_track = 1 ; track / cylinder +diopp_sector = 3 ; sector +diopp_size = 5 ; size of structure diff --git a/libsrc/geos-cbm/disk/changediskdevice.s b/libsrc/geos-cbm/disk/changediskdevice.s index dd2af0892..c3035deee 100644 --- a/libsrc/geos-cbm/disk/changediskdevice.s +++ b/libsrc/geos-cbm/disk/changediskdevice.s @@ -5,11 +5,11 @@ ; char ChangeDiskDevice (char newDriveNumber); - .export _ChangeDiskDevice - .import setoserror + .export _ChangeDiskDevice + .import setoserror - .include "jumptab.inc" - + .include "jumptab.inc" + _ChangeDiskDevice: - jsr ChangeDiskDevice - jmp setoserror + jsr ChangeDiskDevice + jmp setoserror diff --git a/libsrc/geos-cbm/disk/chkdkgeos.s b/libsrc/geos-cbm/disk/chkdkgeos.s index 2187d5432..c2b4821a4 100644 --- a/libsrc/geos-cbm/disk/chkdkgeos.s +++ b/libsrc/geos-cbm/disk/chkdkgeos.s @@ -5,14 +5,14 @@ ; char ChkDkGEOS (void); - .export _ChkDkGEOS - .import setoserror + .export _ChkDkGEOS + .import setoserror - .include "jumptab.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "geossym.inc" + _ChkDkGEOS: - jsr ChkDkGEOS - jsr setoserror - lda isGEOS - rts + jsr ChkDkGEOS + jsr setoserror + lda isGEOS + rts diff --git a/libsrc/geos-cbm/disk/dio_cts.s b/libsrc/geos-cbm/disk/dio_cts.s index b355c4ffd..8be343641 100644 --- a/libsrc/geos-cbm/disk/dio_cts.s +++ b/libsrc/geos-cbm/disk/dio_cts.s @@ -4,184 +4,184 @@ ; ; ; unsigned char __fastcall__ dio_phys_to_log (dhandle_t handle, -; dio_phys_pos *physpos, /* input */ -; unsigned *sectnum); /* output */ +; dio_phys_pos *physpos, /* input */ +; unsigned *sectnum); /* output */ ; - .export _dio_phys_to_log - .export sectab_1541_l, sectab_1541_h ; for log_to_phys - .import popax,__oserror - .importzp ptr1,ptr2,ptr3,tmp1,tmp2,tmp3,tmp4 + .export _dio_phys_to_log + .export sectab_1541_l, sectab_1541_h ; for log_to_phys + .import popax,__oserror + .importzp ptr1,ptr2,ptr3,tmp1,tmp2,tmp3,tmp4 - .include "dio.inc" - .include "geossym.inc" - .include "const.inc" + .include "dio.inc" + .include "geossym.inc" + .include "const.inc" _dio_phys_to_log: - sta ptr1 - stx ptr1+1 ; pointer to result - - jsr popax - sta ptr2 - stx ptr2+1 ; pointer to input structure - - jsr popax - sta ptr3 - stx ptr3+1 ; pointer to handle - - ldy #sst_flag - lda (ptr3),y - and #128 - beq _inv_hand ; handle not open or invalid - - - ldy #diopp_head - lda (ptr2),y - bne _inv_data ; there is only head 0 - ldy #diopp_track - lda (ptr2),y - beq _inv_data ; there is no track 0 - sta tmp1 - iny - lda (ptr2),y - bne _inv_data ; there are no more than 256 tracks - dec tmp1 ; normalize track to start from 0 - ldy #diopp_sector - lda (ptr2),y - sta tmp2 - iny - lda (ptr2),y - bne _inv_data ; there are no more than 256 sectors + sta ptr1 + stx ptr1+1 ; pointer to result + + jsr popax + sta ptr2 + stx ptr2+1 ; pointer to input structure + + jsr popax + sta ptr3 + stx ptr3+1 ; pointer to handle + + ldy #sst_flag + lda (ptr3),y + and #128 + beq _inv_hand ; handle not open or invalid + + + ldy #diopp_head + lda (ptr2),y + bne _inv_data ; there is only head 0 + ldy #diopp_track + lda (ptr2),y + beq _inv_data ; there is no track 0 + sta tmp1 + iny + lda (ptr2),y + bne _inv_data ; there are no more than 256 tracks + dec tmp1 ; normalize track to start from 0 + ldy #diopp_sector + lda (ptr2),y + sta tmp2 + iny + lda (ptr2),y + bne _inv_data ; there are no more than 256 sectors ; tmp1 (int) holds track+sector, translate it using device info - ldy #sst_driveno - lda (ptr3),y - tay - lda driveType,y - and #%00000011 ; this is for RamDrive compatibility - cmp #DRV_1541 - beq dio_cts1541 - cmp #DRV_1571 - beq dio_cts1571 - cmp #DRV_1581 - beq dio_cts1581 - - lda #DEV_NOT_FOUND ; unknown device - ldx #0 - beq ret + ldy #sst_driveno + lda (ptr3),y + tay + lda driveType,y + and #%00000011 ; this is for RamDrive compatibility + cmp #DRV_1541 + beq dio_cts1541 + cmp #DRV_1571 + beq dio_cts1571 + cmp #DRV_1581 + beq dio_cts1581 + + lda #DEV_NOT_FOUND ; unknown device + ldx #0 + beq ret dio_ctsend: - ldy #1 - lda tmp2 - sta (ptr1),y - dey - lda tmp1 - sta (ptr1),y - - ldx #0 - txa -ret: - sta __oserror - rts ; return success + ldy #1 + lda tmp2 + sta (ptr1),y + dey + lda tmp1 + sta (ptr1),y + + ldx #0 + txa +ret: + sta __oserror + rts ; return success ; errors _inv_data: - lda #INV_TRACK - .byte $2c + lda #INV_TRACK + .byte $2c _inv_hand: - lda #INCOMPATIBLE - ldx #0 - beq ret + lda #INCOMPATIBLE + ldx #0 + beq ret ; device-depended stuff, tmp1=track-1, tmp2=sector dio_cts1541: - ldy tmp1 - cpy #35 - bcs _inv_data - lda sectab_1541_l,y - clc - adc tmp2 - sta tmp1 - lda sectab_1541_h,y - adc #0 - sta tmp2 - jmp dio_ctsend + ldy tmp1 + cpy #35 + bcs _inv_data + lda sectab_1541_l,y + clc + adc tmp2 + sta tmp1 + lda sectab_1541_h,y + adc #0 + sta tmp2 + jmp dio_ctsend dio_cts1571: - lda tmp1 - cmp #70 - bcs _inv_data - cmp #35 ; last track of one side - bcs _sub35 - jmp dio_cts1541 ; track <=35 - same as 1541 + lda tmp1 + cmp #70 + bcs _inv_data + cmp #35 ; last track of one side + bcs _sub35 + jmp dio_cts1541 ; track <=35 - same as 1541 _sub35: - sec - sbc #35 - sta tmp1 - jsr dio_cts1541 ; get offset on second side of disk - lda tmp1 ; add second side base - clc - adc #<683 - sta tmp1 - lda tmp2 - adc #>683 - sta tmp2 - jmp dio_ctsend + sec + sbc #35 + sta tmp1 + jsr dio_cts1541 ; get offset on second side of disk + lda tmp1 ; add second side base + clc + adc #<683 + sta tmp1 + lda tmp2 + adc #>683 + sta tmp2 + jmp dio_ctsend dio_cts1581: ; 1581 has 80 tracks, 40 sectors each secnum=track*40+sector - ldx #0 - stx tmp3 - stx tmp4 - lda tmp1 - beq _nomult - cmp #80 - bcs _inv_data + ldx #0 + stx tmp3 + stx tmp4 + lda tmp1 + beq _nomult + cmp #80 + bcs _inv_data ; mul40 by Christian Groessler - sta tmp4 - asl a - rol tmp3 - asl a - rol tmp3 ; val * 4 - adc tmp4 - bcc L1 - inc tmp3 ; val * 5 -L1: asl a - rol tmp3 ; val * 10 - asl a - rol tmp3 - asl a - rol tmp3 ; val * 40 = AX - ldx tmp3 - sta tmp3 - stx tmp4 + sta tmp4 + asl a + rol tmp3 + asl a + rol tmp3 ; val * 4 + adc tmp4 + bcc L1 + inc tmp3 ; val * 5 +L1: asl a + rol tmp3 ; val * 10 + asl a + rol tmp3 + asl a + rol tmp3 ; val * 40 = AX + ldx tmp3 + sta tmp3 + stx tmp4 _nomult: - lda tmp2 - clc - adc tmp3 - sta tmp1 - lda tmp4 - adc #0 - sta tmp2 - jmp dio_ctsend + lda tmp2 + clc + adc tmp3 + sta tmp1 + lda tmp4 + adc #0 + sta tmp2 + jmp dio_ctsend .rodata sectab_1541_l: - .byte $00, $15, $2a, $3f, $54, $69, $7e, $93 - .byte $a8, $bd, $d2, $e7, $fc, $11, $26, $3b - .byte $50, $65, $78, $8b, $9e, $b1, $c4, $d7 - .byte $ea, $fc, $0e, $20, $32, $44, $56, $67 - .byte $78, $89, $9a, $ab + .byte $00, $15, $2a, $3f, $54, $69, $7e, $93 + .byte $a8, $bd, $d2, $e7, $fc, $11, $26, $3b + .byte $50, $65, $78, $8b, $9e, $b1, $c4, $d7 + .byte $ea, $fc, $0e, $20, $32, $44, $56, $67 + .byte $78, $89, $9a, $ab sectab_1541_h: - .byte $00, $00, $00, $00, $00, $00, $00, $00 - .byte $00, $00, $00, $00, $00, $01, $01, $01 - .byte $01, $01, $01, $01, $01, $01, $01, $01 - .byte $01, $01, $02, $02, $02, $02, $02, $02 - .byte $02, $02, $02, $02 + .byte $00, $00, $00, $00, $00, $00, $00, $00 + .byte $00, $00, $00, $00, $00, $01, $01, $01 + .byte $01, $01, $01, $01, $01, $01, $01, $01 + .byte $01, $01, $02, $02, $02, $02, $02, $02 + .byte $02, $02, $02, $02 diff --git a/libsrc/geos-cbm/disk/dio_openclose.s b/libsrc/geos-cbm/disk/dio_openclose.s index fc0fcecf2..ec5aa8795 100644 --- a/libsrc/geos-cbm/disk/dio_openclose.s +++ b/libsrc/geos-cbm/disk/dio_openclose.s @@ -10,74 +10,74 @@ ; dio_open sets given device as current and initializes disk ; dio_close does nothing special - .export _dio_open, _dio_close - .import __oserror, _OpenDisk - .importzp ptr1, tmp1 + .export _dio_open, _dio_close + .import __oserror, _OpenDisk + .importzp ptr1, tmp1 - .include "dio.inc" + .include "dio.inc" .include "jumptab.inc" .include "geossym.inc" - .include "const.inc" + .include "const.inc" .bss sectsizetab: - .res 4 * sst_size ; this is hardcoded + .res 4 * sst_size ; this is hardcoded .code _dio_open: - pha - tax - lda driveType,x ; check if there's a device - beq _inv_drive - txa - clc - adc #8 ; normalize devnum - sta curDevice - jsr SetDevice - jsr _OpenDisk ; take care for errors there + pha + tax + lda driveType,x ; check if there's a device + beq _inv_drive + txa + clc + adc #8 ; normalize devnum + sta curDevice + jsr SetDevice + jsr _OpenDisk ; take care for errors there - pla - tay ; drive # - asl a ; make index from drive id - asl a - tax - - lda #0 - sta sectsizetab+sst_sectsize,x - lda #128 - sta sectsizetab+sst_flag,x ; set flag that drive is "open" - lda #1 - sta sectsizetab+sst_sectsize+1,x - tya - sta sectsizetab+sst_driveno,x - - stx tmp1 - lda #sectsizetab - adc #0 - tax - lda tmp1 + pla + tay ; drive # + asl a ; make index from drive id + asl a + tax + + lda #0 + sta sectsizetab+sst_sectsize,x + lda #128 + sta sectsizetab+sst_flag,x ; set flag that drive is "open" + lda #1 + sta sectsizetab+sst_sectsize+1,x + tya + sta sectsizetab+sst_driveno,x + + stx tmp1 + lda #sectsizetab + adc #0 + tax + lda tmp1 - rts + rts _inv_drive: - lda #DEV_NOT_FOUND - sta __oserror - lda #0 - tax - rts + lda #DEV_NOT_FOUND + sta __oserror + lda #0 + tax + rts _dio_close: - sta ptr1 - stx ptr1+1 - lda #0 - ldy #sst_flag - sta (ptr1),y - sta __oserror ; success - tax - rts ; return no error + sta ptr1 + stx ptr1+1 + lda #0 + ldy #sst_flag + sta (ptr1),y + sta __oserror ; success + tax + rts ; return no error diff --git a/libsrc/geos-cbm/disk/dio_params.s b/libsrc/geos-cbm/disk/dio_params.s index d663b9591..e9fbc60e0 100644 --- a/libsrc/geos-cbm/disk/dio_params.s +++ b/libsrc/geos-cbm/disk/dio_params.s @@ -5,48 +5,48 @@ ; this function is used by dio_read and dio_write to fix parameters (secnum) ; this function calls SetDevice so that more than one drive can be used at once - .export dio_params,dio_secnum - .import popax,pushax,_dio_log_to_phys - .importzp ptr1 + .export dio_params,dio_secnum + .import popax,pushax,_dio_log_to_phys + .importzp ptr1 - .include "geossym.inc" - .include "jumptab.inc" - .include "dio.inc" + .include "geossym.inc" + .include "jumptab.inc" + .include "dio.inc" .bss dio_secnum: - .res 2 + .res 2 .code dio_params: - sta r4L - stx r4H + sta r4L + stx r4H - jsr popax - sta dio_secnum - stx dio_secnum+1 + jsr popax + sta dio_secnum + stx dio_secnum+1 - jsr popax ; get 3rd parameter - pha ; save it - txa - pha - jsr pushax ; put it back - pla ; restore it - sta ptr1+1 - pla - sta ptr1 - ldy #sst_driveno - lda (ptr1),y - clc - adc #8 - jsr SetDevice ; setup device, load driver + jsr popax ; get 3rd parameter + pha ; save it + txa + pha + jsr pushax ; put it back + pla ; restore it + sta ptr1+1 + pla + sta ptr1 + ldy #sst_driveno + lda (ptr1),y + clc + adc #8 + jsr SetDevice ; setup device, load driver - lda #dio_secnum - jsr pushax + lda #dio_secnum + jsr pushax - lda #r1H - jmp _dio_log_to_phys + lda #r1H + jmp _dio_log_to_phys diff --git a/libsrc/geos-cbm/disk/dio_qcount.s b/libsrc/geos-cbm/disk/dio_qcount.s index 0c9524a9b..5f10ac247 100644 --- a/libsrc/geos-cbm/disk/dio_qcount.s +++ b/libsrc/geos-cbm/disk/dio_qcount.s @@ -4,12 +4,12 @@ ; unsigned __fastcall__ dio_query_sectcount (dhandle_t handle); ; - .export _dio_query_sectcount - .import __oserror + .export _dio_query_sectcount + .import __oserror _dio_query_sectcount: - lda #0 - sta __oserror - lda #<683 - ldx #>683 - rts + lda #0 + sta __oserror + lda #<683 + ldx #>683 + rts diff --git a/libsrc/geos-cbm/disk/dio_qsize.s b/libsrc/geos-cbm/disk/dio_qsize.s index 46a4386ab..bf9178035 100644 --- a/libsrc/geos-cbm/disk/dio_qsize.s +++ b/libsrc/geos-cbm/disk/dio_qsize.s @@ -4,11 +4,11 @@ ; unsigned __fastcall__ dio_query_sectsize (dhandle_t handle); ; - .export _dio_query_sectsize - .import __oserror + .export _dio_query_sectsize + .import __oserror _dio_query_sectsize: - lda #<256 - ldx #>256 - sta __oserror - rts + lda #<256 + ldx #>256 + sta __oserror + rts diff --git a/libsrc/geos-cbm/disk/dio_read.s b/libsrc/geos-cbm/disk/dio_read.s index c1e21ada5..db46c9b69 100644 --- a/libsrc/geos-cbm/disk/dio_read.s +++ b/libsrc/geos-cbm/disk/dio_read.s @@ -7,15 +7,15 @@ ; unsigned char __fastcall__ dio_read (dhandle_t handle, unsigned sect_num, void *buffer); ; - .export _dio_read - .import dio_params, __oserror + .export _dio_read + .import dio_params, __oserror - .include "geossym.inc" - .include "jumptab.inc" + .include "geossym.inc" + .include "jumptab.inc" _dio_read: - jsr dio_params - jsr ReadBlock - stx __oserror - txa - rts + jsr dio_params + jsr ReadBlock + stx __oserror + txa + rts diff --git a/libsrc/geos-cbm/disk/dio_stc.s b/libsrc/geos-cbm/disk/dio_stc.s index 00be2c84e..586e3f3db 100644 --- a/libsrc/geos-cbm/disk/dio_stc.s +++ b/libsrc/geos-cbm/disk/dio_stc.s @@ -3,175 +3,175 @@ ; 2.7.2001 ; ; unsigned char __fastcall__ dio_log_to_phys (dhandle_t handle, -; unsigned *sectnum, /* input */ -; dio_phys_pos *physpos); /* output */ +; unsigned *sectnum, /* input */ +; dio_phys_pos *physpos); /* output */ ; - .export _dio_log_to_phys - .importzp ptr1,ptr2,ptr3,tmp1,tmp2 - .import popax,__oserror - .import sectab_1541_l, sectab_1541_h + .export _dio_log_to_phys + .importzp ptr1,ptr2,ptr3,tmp1,tmp2 + .import popax,__oserror + .import sectab_1541_l, sectab_1541_h - .include "dio.inc" - .include "geossym.inc" - .include "const.inc" + .include "dio.inc" + .include "geossym.inc" + .include "const.inc" _dio_log_to_phys: ; check device type - sta ptr1 - stx ptr1+1 ; pointer to result (struct dio_phys_pos) - - jsr popax - sta ptr2 - stx ptr2+1 ; pointer to input structure (pointer to int) - - jsr popax - sta ptr3 - stx ptr3+1 ; pointer to handle - - ldy #sst_flag - lda (ptr3),y - and #128 - beq _inv_hand ; handle not open or invalid + sta ptr1 + stx ptr1+1 ; pointer to result (struct dio_phys_pos) + + jsr popax + sta ptr2 + stx ptr2+1 ; pointer to input structure (pointer to int) + + jsr popax + sta ptr3 + stx ptr3+1 ; pointer to handle + + ldy #sst_flag + lda (ptr3),y + and #128 + beq _inv_hand ; handle not open or invalid ; fill in all we have - ldy #diopp_head - lda #0 ; head 0 - sta (ptr1),y - ldy #diopp_track+1 - sta (ptr1),y ; track <256 - ldy #diopp_sector+1 - sta (ptr1),y ; sector <256 - - ldy #0 - lda (ptr2),y - sta tmp1 - iny - lda (ptr2),y - sta tmp2 + ldy #diopp_head + lda #0 ; head 0 + sta (ptr1),y + ldy #diopp_track+1 + sta (ptr1),y ; track <256 + ldy #diopp_sector+1 + sta (ptr1),y ; sector <256 + + ldy #0 + lda (ptr2),y + sta tmp1 + iny + lda (ptr2),y + sta tmp2 ; get drive info - ldy #sst_driveno - lda (ptr3),y - tay - lda driveType,y - and #%00000011 ; this is for RamDrive compatibility - cmp #DRV_1541 - beq dio_stc1541 - cmp #DRV_1571 - beq dio_stc1571 - cmp #DRV_1581 - beq dio_stc1581 - - lda #DEV_NOT_FOUND ; unknown device - ldx #0 - beq _ret + ldy #sst_driveno + lda (ptr3),y + tay + lda driveType,y + and #%00000011 ; this is for RamDrive compatibility + cmp #DRV_1541 + beq dio_stc1541 + cmp #DRV_1571 + beq dio_stc1571 + cmp #DRV_1581 + beq dio_stc1581 + + lda #DEV_NOT_FOUND ; unknown device + ldx #0 + beq _ret dio_stcend: - ldy #diopp_track - lda tmp1 - sta (ptr1),y - ldy #diopp_sector - lda tmp2 - sta (ptr1),y - - ldx #0 - txa -_ret: - sta __oserror - rts ; return success + ldy #diopp_track + lda tmp1 + sta (ptr1),y + ldy #diopp_sector + lda tmp2 + sta (ptr1),y + + ldx #0 + txa +_ret: + sta __oserror + rts ; return success ; errors _inv_data: - lda #INV_TRACK - .byte $2c + lda #INV_TRACK + .byte $2c _inv_hand: - lda #INCOMPATIBLE - ldx #0 - beq _ret + lda #INCOMPATIBLE + ldx #0 + beq _ret dio_stc1541: ; if 1541: ; - compare with table to find track ; - subtract and find sector - ldx #0 ; index=(track-1) + ldx #0 ; index=(track-1) _loop41: - lda tmp2 - cmp sectab_1541_h+1,x - bne _nxt - lda tmp1 - cmp sectab_1541_l+1,x - bcc _found -_nxt: inx - cpx #35 - bne _loop41 - beq _inv_data - -_found: - lda tmp1 - sec - sbc sectab_1541_l,x - sta tmp2 + lda tmp2 + cmp sectab_1541_h+1,x + bne _nxt + lda tmp1 + cmp sectab_1541_l+1,x + bcc _found +_nxt: inx + cpx #35 + bne _loop41 + beq _inv_data + +_found: + lda tmp1 + sec + sbc sectab_1541_l,x + sta tmp2 _fndend: - inx - stx tmp1 - jmp dio_stcend + inx + stx tmp1 + jmp dio_stcend dio_stc1571: ; if 1571: ; - check size, if too big - subtract and add 35 to track ; - fall down to 1541 - lda tmp2 - cmp #>683 - bne _cnt71 - lda tmp1 - cmp #<683 - bcc dio_stc1541 - -_cnt71: - lda tmp1 - sec - sbc #<683 - sta tmp1 - lda tmp2 - sbc #>683 - sta tmp2 - jsr dio_stc1541 ; will fall through here - - ldy #diopp_track - lda (ptr1),y - clc - adc #35 - sta (ptr1),y - lda #0 - beq _ret + lda tmp2 + cmp #>683 + bne _cnt71 + lda tmp1 + cmp #<683 + bcc dio_stc1541 + +_cnt71: + lda tmp1 + sec + sbc #<683 + sta tmp1 + lda tmp2 + sbc #>683 + sta tmp2 + jsr dio_stc1541 ; will fall through here + + ldy #diopp_track + lda (ptr1),y + clc + adc #35 + sta (ptr1),y + lda #0 + beq _ret ; if 1581: ; - subtract 40 in loop (at most 80 times) to find track ; - the remainder is sector dio_stc1581: - ldx #0 ; index=(track-1) + ldx #0 ; index=(track-1) _loop81: - lda tmp2 - bne _sub81 - lda tmp1 - cmp #40 - bcc _got81 -_sub81: lda tmp1 - sec - sbc #40 - sta tmp1 - lda tmp2 - sbc #0 - sta tmp2 - inx - cpx #81 - bne _loop81 - beq _inv_data - -_got81: lda tmp1 - sta tmp2 - inx - stx tmp1 - jmp dio_stcend + lda tmp2 + bne _sub81 + lda tmp1 + cmp #40 + bcc _got81 +_sub81: lda tmp1 + sec + sbc #40 + sta tmp1 + lda tmp2 + sbc #0 + sta tmp2 + inx + cpx #81 + bne _loop81 + beq _inv_data + +_got81: lda tmp1 + sta tmp2 + inx + stx tmp1 + jmp dio_stcend diff --git a/libsrc/geos-cbm/disk/dio_write.s b/libsrc/geos-cbm/disk/dio_write.s index 1572b3f3b..14267803a 100644 --- a/libsrc/geos-cbm/disk/dio_write.s +++ b/libsrc/geos-cbm/disk/dio_write.s @@ -7,13 +7,13 @@ ; unsigned char __fastcall__ dio_write (dhandle_t handle, unsigned sect_num, const void *buffer); ; - .export _dio_write - .import dio_params, setoserror + .export _dio_write + .import dio_params, setoserror - .include "geossym.inc" - .include "jumptab.inc" + .include "geossym.inc" + .include "jumptab.inc" _dio_write: - jsr dio_params - jsr WriteBlock - jmp setoserror + jsr dio_params + jsr WriteBlock + jmp setoserror diff --git a/libsrc/geos-cbm/disk/dio_writev.s b/libsrc/geos-cbm/disk/dio_writev.s index cc67e2995..7cb9b029f 100644 --- a/libsrc/geos-cbm/disk/dio_writev.s +++ b/libsrc/geos-cbm/disk/dio_writev.s @@ -7,15 +7,15 @@ ; unsigned char __fastcall__ dio_write_verify (dhandle_t handle, unsigned sect_num, const void *buffer); ; - .export _dio_write_verify - .import dio_params, __oserror + .export _dio_write_verify + .import dio_params, __oserror - .include "geossym.inc" - .include "jumptab.inc" + .include "geossym.inc" + .include "jumptab.inc" _dio_write_verify: - jsr dio_params - jsr VerWriteBlock - stx __oserror - txa - rts + jsr dio_params + jsr VerWriteBlock + stx __oserror + txa + rts diff --git a/libsrc/geos-cbm/disk/enterturbo.s b/libsrc/geos-cbm/disk/enterturbo.s index c1741bb59..777822bae 100644 --- a/libsrc/geos-cbm/disk/enterturbo.s +++ b/libsrc/geos-cbm/disk/enterturbo.s @@ -5,8 +5,8 @@ ; void EnterTurbo (void); - .export _EnterTurbo + .export _EnterTurbo - .include "jumptab.inc" - -_EnterTurbo = EnterTurbo + .include "jumptab.inc" + +_EnterTurbo = EnterTurbo diff --git a/libsrc/geos-cbm/disk/exitturbo.s b/libsrc/geos-cbm/disk/exitturbo.s index fdc771d6e..ab894aeff 100644 --- a/libsrc/geos-cbm/disk/exitturbo.s +++ b/libsrc/geos-cbm/disk/exitturbo.s @@ -5,8 +5,8 @@ ; void ExitTurbo (void); - .export _ExitTurbo + .export _ExitTurbo - .include "jumptab.inc" - -_ExitTurbo = ExitTurbo + .include "jumptab.inc" + +_ExitTurbo = ExitTurbo diff --git a/libsrc/geos-cbm/disk/findbambit.s b/libsrc/geos-cbm/disk/findbambit.s index 8bdedfa2c..3bb566f4d 100644 --- a/libsrc/geos-cbm/disk/findbambit.s +++ b/libsrc/geos-cbm/disk/findbambit.s @@ -6,18 +6,18 @@ ; char FindBAMBit (struct tr_se *TS); ; (might be called inUSE (if (!inUSE(block)))) - .export _FindBAMBit - .import gettrse - .import return0, return1 + .export _FindBAMBit + .import gettrse + .import return0, return1 - .include "jumptab.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "geossym.inc" + _FindBAMBit: - jsr gettrse - sta r6L - stx r6H - jsr FindBAMBit - bne inUse - jmp return0 -inUse: jmp return1 + jsr gettrse + sta r6L + stx r6H + jsr FindBAMBit + bne inUse + jmp return0 +inUse: jmp return1 diff --git a/libsrc/geos-cbm/disk/newdisk.s b/libsrc/geos-cbm/disk/newdisk.s index c32729968..30c7283ae 100644 --- a/libsrc/geos-cbm/disk/newdisk.s +++ b/libsrc/geos-cbm/disk/newdisk.s @@ -5,11 +5,11 @@ ; char NewDisk (void); - .export _NewDisk - .import setoserror + .export _NewDisk + .import setoserror - .include "jumptab.inc" - + .include "jumptab.inc" + _NewDisk: - jsr NewDisk - jmp setoserror + jsr NewDisk + jmp setoserror diff --git a/libsrc/geos-cbm/disk/purgeturbo.s b/libsrc/geos-cbm/disk/purgeturbo.s index 122a5c7cb..f0a293423 100644 --- a/libsrc/geos-cbm/disk/purgeturbo.s +++ b/libsrc/geos-cbm/disk/purgeturbo.s @@ -5,8 +5,8 @@ ; void PurgeTurbo (void); - .export _PurgeTurbo + .export _PurgeTurbo - .include "jumptab.inc" - -_PurgeTurbo = PurgeTurbo + .include "jumptab.inc" + +_PurgeTurbo = PurgeTurbo diff --git a/libsrc/geos-cbm/disk/readblock.s b/libsrc/geos-cbm/disk/readblock.s index ec547415d..977860d91 100644 --- a/libsrc/geos-cbm/disk/readblock.s +++ b/libsrc/geos-cbm/disk/readblock.s @@ -5,19 +5,19 @@ ; char ReadBlock (struct tr_se myTS, char *buffer); - .export _ReadBlock - .import popax, setoserror - .import gettrse + .export _ReadBlock + .import popax, setoserror + .import gettrse - .include "jumptab.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "geossym.inc" + _ReadBlock: - sta r4L - stx r4H - jsr popax - jsr gettrse - sta r1L - stx r1H - jsr ReadBlock - jmp setoserror + sta r4L + stx r4H + jsr popax + jsr gettrse + sta r1L + stx r1H + jsr ReadBlock + jmp setoserror diff --git a/libsrc/geos-cbm/disk/readbuff.s b/libsrc/geos-cbm/disk/readbuff.s index 036d42bcc..149eae1b9 100644 --- a/libsrc/geos-cbm/disk/readbuff.s +++ b/libsrc/geos-cbm/disk/readbuff.s @@ -5,16 +5,16 @@ ; char ReadBuff (struct tr_se); - .export _ReadBuff - .import setoserror - .import gettrse + .export _ReadBuff + .import setoserror + .import gettrse - .include "diskdrv.inc" - .include "geossym.inc" - + .include "diskdrv.inc" + .include "geossym.inc" + _ReadBuff: - jsr gettrse - sta r1L - stx r1H - jsr ReadBuff - jmp setoserror + jsr gettrse + sta r1L + stx r1H + jsr ReadBuff + jmp setoserror diff --git a/libsrc/geos-cbm/disk/setgeosdisk.s b/libsrc/geos-cbm/disk/setgeosdisk.s index eeb27909b..5d40ee442 100644 --- a/libsrc/geos-cbm/disk/setgeosdisk.s +++ b/libsrc/geos-cbm/disk/setgeosdisk.s @@ -5,11 +5,11 @@ ; char SetGEOSDisk (void); - .export _SetGEOSDisk - .import setoserror + .export _SetGEOSDisk + .import setoserror - .include "jumptab.inc" + .include "jumptab.inc" _SetGEOSDisk: - jsr SetGEOSDisk - jmp setoserror + jsr SetGEOSDisk + jmp setoserror diff --git a/libsrc/geos-cbm/disk/verwriteblock.s b/libsrc/geos-cbm/disk/verwriteblock.s index 02aa3fbdd..74243f13f 100644 --- a/libsrc/geos-cbm/disk/verwriteblock.s +++ b/libsrc/geos-cbm/disk/verwriteblock.s @@ -5,19 +5,19 @@ ; char VerWriteBlock (struct tr_se *myTS, char *buffer); - .export _VerWriteBlock - .import popax, setoserror - .import gettrse + .export _VerWriteBlock + .import popax, setoserror + .import gettrse - .include "jumptab.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "geossym.inc" + _VerWriteBlock: - sta r4L - stx r4H - jsr popax - jsr gettrse - sta r1L - stx r1H - jsr VerWriteBlock - jmp setoserror + sta r4L + stx r4H + jsr popax + jsr gettrse + sta r1L + stx r1H + jsr VerWriteBlock + jmp setoserror diff --git a/libsrc/geos-cbm/disk/writeblock.s b/libsrc/geos-cbm/disk/writeblock.s index 927d93e0d..c5a3b3f7a 100644 --- a/libsrc/geos-cbm/disk/writeblock.s +++ b/libsrc/geos-cbm/disk/writeblock.s @@ -5,19 +5,19 @@ ; char WriteBlock (struct tr_se *myTS, char *buffer); - .export _WriteBlock - .import popax, setoserror - .import gettrse + .export _WriteBlock + .import popax, setoserror + .import gettrse - .include "jumptab.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "geossym.inc" + _WriteBlock: - sta r4L - stx r4H - jsr popax - jsr gettrse - sta r1L - stx r1H - jsr WriteBlock - jmp setoserror + sta r4L + stx r4H + jsr popax + jsr gettrse + sta r1L + stx r1H + jsr WriteBlock + jmp setoserror diff --git a/libsrc/geos-cbm/disk/writebuff.s b/libsrc/geos-cbm/disk/writebuff.s index f66ed2e1d..34e7b137b 100644 --- a/libsrc/geos-cbm/disk/writebuff.s +++ b/libsrc/geos-cbm/disk/writebuff.s @@ -5,16 +5,16 @@ ; char WriteBuff (struct tr_se*); - .export _WriteBuff - .import setoserror - .import gettrse + .export _WriteBuff + .import setoserror + .import gettrse - .include "diskdrv.inc" - .include "geossym.inc" - + .include "diskdrv.inc" + .include "geossym.inc" + _WriteBuff: - jsr gettrse - sta r1L - stx r1H - jsr WriteBuff - jmp setoserror + jsr gettrse + sta r1L + stx r1H + jsr WriteBuff + jmp setoserror diff --git a/libsrc/geos-cbm/diskdrv.inc b/libsrc/geos-cbm/diskdrv.inc index f44ce279b..5dc365495 100644 --- a/libsrc/geos-cbm/diskdrv.inc +++ b/libsrc/geos-cbm/diskdrv.inc @@ -4,39 +4,39 @@ ;4-2-99 ;pointers -InitForIO_ = $9000 -DoneWithIO_ = $9002 -ExitTurbo_ = $9004 -PurgeTurbo_ = $9006 -EnterTurbo_ = $9008 -ChangeDiskDevice_ = $900a -NewDisk_ = $900c -ReadBlock_ = $900e -WriteBlock_ = $9010 -VerWriteBlock_ = $9012 -OpenDisk_ = $9014 -GetBlock_ = $9016 -PutBlock_ = $9018 -GetDirHead_ = $901a -PutDirHead_ = $901c -GetFreeDirBlk_ = $901e -CalcBlksFree_ = $9020 -FreeBlock_ = $9022 -SetNextFree_ = $9024 -FindBAMBit_ = $9026 -NxtBlkAlloc_ = $9028 -BlkAlloc_ = $902a -ChkDkGEOS_ = $902c -SetGEOSDisk_ = $902e +InitForIO_ = $9000 +DoneWithIO_ = $9002 +ExitTurbo_ = $9004 +PurgeTurbo_ = $9006 +EnterTurbo_ = $9008 +ChangeDiskDevice_ = $900a +NewDisk_ = $900c +ReadBlock_ = $900e +WriteBlock_ = $9010 +VerWriteBlock_ = $9012 +OpenDisk_ = $9014 +GetBlock_ = $9016 +PutBlock_ = $9018 +GetDirHead_ = $901a +PutDirHead_ = $901c +GetFreeDirBlk_ = $901e +CalcBlksFree_ = $9020 +FreeBlock_ = $9022 +SetNextFree_ = $9024 +FindBAMBit_ = $9026 +NxtBlkAlloc_ = $9028 +BlkAlloc_ = $902a +ChkDkGEOS_ = $902c +SetGEOSDisk_ = $902e ;jump table -Get1stDirEntry = $9030 -GetNxtDirEntry = $9033 -GetBorder = $9036 -AddDirBlock = $9039 -ReadBuff = $903c -WriteBuff = $903f +Get1stDirEntry = $9030 +GetNxtDirEntry = $9033 +GetBorder = $9036 +AddDirBlock = $9039 +ReadBuff = $903c +WriteBuff = $903f ;??? = $9042 ;??? = $9045 -AllocateBlock = $9048 -ReadLink = $904b +AllocateBlock = $9048 +ReadLink = $904b diff --git a/libsrc/geos-cbm/emd/geos-vdc.s b/libsrc/geos-cbm/emd/geos-vdc.s index 81c9d7aaf..7064a78fc 100644 --- a/libsrc/geos-cbm/emd/geos-vdc.s +++ b/libsrc/geos-cbm/emd/geos-vdc.s @@ -5,43 +5,43 @@ ; Maciej 'YTM/Elysium' Witkowiak ; 06,20,25.12.2002 - .include "zeropage.inc" - .include "em-kernel.inc" + .include "zeropage.inc" + .include "em-kernel.inc" .include "em-error.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ ; Header. Includes jump table -.segment "JUMPTABLE" +.segment "JUMPTABLE" ; Driver signature - .byte $65, $6d, $64 ; "emd" - .byte EMD_API_VERSION ; EM API version number + .byte $65, $6d, $64 ; "emd" + .byte EMD_API_VERSION ; EM API version number ; Jump table. - .word INSTALL - .word UNINSTALL - .word PAGECOUNT - .word MAP - .word USE - .word COMMIT - .word COPYFROM - .word COPYTO + .word INSTALL + .word UNINSTALL + .word PAGECOUNT + .word MAP + .word USE + .word COMMIT + .word COPYFROM + .word COPYTO ; ------------------------------------------------------------------------ ; Constants -VDC_ADDR_REG = $D600 ; VDC address -VDC_DATA_REG = $D601 ; VDC data +VDC_ADDR_REG = $D600 ; VDC address +VDC_DATA_REG = $D601 ; VDC data -VDC_DATA_HI = 18 ; used registers -VDC_DATA_LO = 19 -VDC_CSET = 28 -VDC_DATA = 31 +VDC_DATA_HI = 18 ; used registers +VDC_DATA_LO = 19 +VDC_CSET = 28 +VDC_DATA = 31 ; ------------------------------------------------------------------------ ; Data. @@ -49,14 +49,14 @@ VDC_DATA = 31 .data pagecount: - .word 64 ; $0000-$3fff as 16k default + .word 64 ; $0000-$3fff as 16k default curpage: - .word $ffff ; currently mapped-in page (invalid) + .word $ffff ; currently mapped-in page (invalid) .bss window: - .res 256 ; memory window + .res 256 ; memory window .code @@ -68,88 +68,88 @@ window: ; INSTALL: - ; do test for VDC presence here??? + ; do test for VDC presence here??? - php - sei - lda $01 - pha - lda #$35 - sta $01 - - ldx #VDC_CSET ; determine size of RAM... - jsr vdcgetreg - sta tmp1 - ora #%00010000 - jsr vdcputreg ; turn on 64k - - jsr settestadr1 ; save original value of test byte - jsr vdcgetbyte - sta tmp2 - - lda #$55 ; write $55 here - ldy #ptr1 - jsr test64k ; read it here and there - lda #$aa ; write $aa here - ldy #ptr2 - jsr test64k ; read it here and there - - jsr settestadr1 - lda tmp2 - jsr vdcputbyte ; restore original value of test byte - - lda ptr1 ; do bytes match? - cmp ptr1+1 - bne @have64k - lda ptr2 - cmp ptr2+1 - bne @have64k - - ldx #VDC_CSET - lda tmp1 - jsr vdcputreg ; restore 16/64k flag - jmp @endok ; and leave default values for 16k - + php + sei + lda $01 + pha + lda #$35 + sta $01 + + ldx #VDC_CSET ; determine size of RAM... + jsr vdcgetreg + sta tmp1 + ora #%00010000 + jsr vdcputreg ; turn on 64k + + jsr settestadr1 ; save original value of test byte + jsr vdcgetbyte + sta tmp2 + + lda #$55 ; write $55 here + ldy #ptr1 + jsr test64k ; read it here and there + lda #$aa ; write $aa here + ldy #ptr2 + jsr test64k ; read it here and there + + jsr settestadr1 + lda tmp2 + jsr vdcputbyte ; restore original value of test byte + + lda ptr1 ; do bytes match? + cmp ptr1+1 + bne @have64k + lda ptr2 + cmp ptr2+1 + bne @have64k + + ldx #VDC_CSET + lda tmp1 + jsr vdcputreg ; restore 16/64k flag + jmp @endok ; and leave default values for 16k + @have64k: - lda #<256 - ldx #>256 - sta pagecount - stx pagecount+1 -@endok: - pla - sta $01 - plp - lda #EM_ERR_OK - rts - + lda #<256 + ldx #>256 + sta pagecount + stx pagecount+1 +@endok: + pla + sta $01 + plp + lda #EM_ERR_OK + rts + test64k: - sta tmp1 - sty ptr3 - lda #0 - sta ptr3+1 - jsr settestadr1 - lda tmp1 - jsr vdcputbyte ; write $55 - jsr settestadr1 - jsr vdcgetbyte ; read here - pha - jsr settestadr2 - jsr vdcgetbyte ; and there - ldy #1 - sta (ptr3),y - pla - dey - sta (ptr3),y - rts + sta tmp1 + sty ptr3 + lda #0 + sta ptr3+1 + jsr settestadr1 + lda tmp1 + jsr vdcputbyte ; write $55 + jsr settestadr1 + jsr vdcgetbyte ; read here + pha + jsr settestadr2 + jsr vdcgetbyte ; and there + ldy #1 + sta (ptr3),y + pla + dey + sta (ptr3),y + rts settestadr1: - ldy #$02 ; test page 2 (here) - .byte $2c + ldy #$02 ; test page 2 (here) + .byte $2c settestadr2: - ldy #$42 ; or page 64+2 (there) - lda #0 - jmp vdcsetsrcaddr + ldy #$42 ; or page 64+2 (there) + lda #0 + jmp vdcsetsrcaddr ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -157,17 +157,17 @@ settestadr2: ; UNINSTALL: - ;on C128 restore font and clear the screen? - rts + ;on C128 restore font and clear the screen? + rts ; ------------------------------------------------------------------------ ; PAGECOUNT: Return the total number of available pages in a/x. ; PAGECOUNT: - lda pagecount - ldx pagecount+1 - rts + lda pagecount + ldx pagecount+1 + rts ; ------------------------------------------------------------------------ ; MAP: Map the page in a/x into memory and return a pointer to the page in @@ -175,104 +175,104 @@ PAGECOUNT: ; by the driver. ; -MAP: sta curpage - stx curpage+1 - sta ptr1+1 - ldy #0 - sty ptr1 - - lda #window - sta ptr2+1 - - jsr transferin - - lda #window - rts +MAP: sta curpage + stx curpage+1 + sta ptr1+1 + ldy #0 + sty ptr1 + + lda #window + sta ptr2+1 + + jsr transferin + + lda #window + rts ; copy a single page from (ptr1):VDCRAM to (ptr2):RAM transferin: - php - sei - lda $01 - pha - lda #$35 - sta $01 - lda ptr1 - ldy ptr1+1 - jsr vdcsetsrcaddr ; set source address in VDC - ldy #0 - ldx #VDC_DATA - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda VDC_DATA_REG ; get 2 bytes at a time to speed-up - sta (ptr2),y ; (in fact up to 8 bytes could be fetched with special VDC config) - iny - lda VDC_DATA_REG - sta (ptr2),y - iny - bne @L0 - pla - sta $01 - plp - rts + php + sei + lda $01 + pha + lda #$35 + sta $01 + lda ptr1 + ldy ptr1+1 + jsr vdcsetsrcaddr ; set source address in VDC + ldy #0 + ldx #VDC_DATA + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda VDC_DATA_REG ; get 2 bytes at a time to speed-up + sta (ptr2),y ; (in fact up to 8 bytes could be fetched with special VDC config) + iny + lda VDC_DATA_REG + sta (ptr2),y + iny + bne @L0 + pla + sta $01 + plp + rts ; ------------------------------------------------------------------------ ; USE: Tell the driver that the window is now associated with a given page. USE: sta curpage - stx curpage+1 ; Remember the page - lda #window ; Return the window + stx curpage+1 ; Remember the page + lda #window ; Return the window done: rts ; ------------------------------------------------------------------------ ; COMMIT: Commit changes in the memory window to extended storage. COMMIT: - lda curpage ; jump if no page mapped - ldx curpage+1 - bmi done - sta ptr1+1 - ldy #0 - sty ptr1 + lda curpage ; jump if no page mapped + ldx curpage+1 + bmi done + sta ptr1+1 + ldy #0 + sty ptr1 - lda #window - sta ptr2+1 + lda #window + sta ptr2+1 ; fall through to transferout ; copy a single page from (ptr2):RAM to (ptr1):VDCRAM transferout: - php - sei - lda $01 - pha - lda #$35 - sta $01 - lda ptr1 - ldy ptr1+1 - jsr vdcsetsrcaddr ; set source address in VDC - ldy #0 - ldx #VDC_DATA - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda (ptr2),y ; speedup does not work for writing - sta VDC_DATA_REG - iny - bne @L0 - pla - sta $01 - plp - rts + php + sei + lda $01 + pha + lda #$35 + sta $01 + lda ptr1 + ldy ptr1+1 + jsr vdcsetsrcaddr ; set source address in VDC + ldy #0 + ldx #VDC_DATA + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda (ptr2),y ; speedup does not work for writing + sta VDC_DATA_REG + iny + bne @L0 + pla + sta $01 + plp + rts ; ------------------------------------------------------------------------ ; COPYFROM: Copy from extended into linear memory. A pointer to a structure @@ -281,42 +281,42 @@ transferout: ; COPYFROM: - jsr setup - beq @L2 ; Skip if no full pages + jsr setup + beq @L2 ; Skip if no full pages ; Copy full pages @L1: jsr transferin - inc ptr1+1 - inc ptr2+1 - dec tmp1 - bne @L1 + inc ptr1+1 + inc ptr2+1 + dec tmp1 + bne @L1 ; Copy the remainder of the page - + @L2: ldy #EM_COPY::COUNT - lda (ptr3),y ; Get bytes in last page - beq @L4 - sta tmp1 + lda (ptr3),y ; Get bytes in last page + beq @L4 + sta tmp1 ; Transfer the bytes in the last page - php - sei - lda $01 - pha - lda #$35 - sta $01 - ldy #0 -@L3: jsr vdcgetbyte - sta (ptr2),y - iny - dec tmp1 - lda tmp1 - bne @L3 - pla - sta $01 - plp -@L4: rts + php + sei + lda $01 + pha + lda #$35 + sta $01 + ldy #0 +@L3: jsr vdcgetbyte + sta (ptr2),y + iny + dec tmp1 + lda tmp1 + bne @L3 + pla + sta $01 + plp +@L4: rts ; ------------------------------------------------------------------------ ; COPYTO: Copy from linear into extended memory. A pointer to a structure @@ -325,76 +325,76 @@ COPYFROM: ; COPYTO: - jsr setup - beq @L2 ; Skip if no full pages + jsr setup + beq @L2 ; Skip if no full pages ; Copy full pages @L1: jsr transferout - inc ptr1+1 - inc ptr2+1 - dec tmp1 - bne @L1 + inc ptr1+1 + inc ptr2+1 + dec tmp1 + bne @L1 ; Copy the remainder of the page @L2: ldy #EM_COPY::COUNT - lda (ptr3),y ; Get bytes in last page - beq @L4 - sta tmp1 + lda (ptr3),y ; Get bytes in last page + beq @L4 + sta tmp1 ; Transfer the bytes in the last page - php - sei - lda $01 - pha - lda #$35 - sta $01 - ldy #0 -@L3: lda (ptr2),y - jsr vdcputbyte - iny - dec tmp1 - lda tmp1 - bne @L3 - pla - sta $01 - plp -@L4: rts + php + sei + lda $01 + pha + lda #$35 + sta $01 + ldy #0 +@L3: lda (ptr2),y + jsr vdcputbyte + iny + dec tmp1 + lda tmp1 + bne @L3 + pla + sta $01 + plp +@L4: rts ;------------------------------------------------------------------------- ; Helper functions to handle VDC ram ; vdcsetsrcaddr: - ldx #VDC_DATA_LO - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - sta VDC_DATA_REG - dex - tya - stx VDC_ADDR_REG - sta VDC_DATA_REG - rts + ldx #VDC_DATA_LO + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + sta VDC_DATA_REG + dex + tya + stx VDC_ADDR_REG + sta VDC_DATA_REG + rts vdcgetbyte: - ldx #VDC_DATA + ldx #VDC_DATA vdcgetreg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda VDC_DATA_REG + rts vdcputbyte: - ldx #VDC_DATA + ldx #VDC_DATA vdcputreg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - sta VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + sta VDC_DATA_REG + rts ; ------------------------------------------------------------------------ ; Helper function for COPYFROM and COPYTO: Store the pointer to the request @@ -402,24 +402,24 @@ vdcputreg: ; setup: - sta ptr3 - stx ptr3+1 ; Save the passed em_copy pointer + sta ptr3 + stx ptr3+1 ; Save the passed em_copy pointer - ldy #EM_COPY::OFFS - lda (ptr3),y - sta ptr1 - ldy #EM_COPY::PAGE - lda (ptr3),y - sta ptr1+1 ; From + ldy #EM_COPY::OFFS + lda (ptr3),y + sta ptr1 + ldy #EM_COPY::PAGE + lda (ptr3),y + sta ptr1+1 ; From - ldy #EM_COPY::BUF - lda (ptr3),y - sta ptr2 - iny - lda (ptr3),y - sta ptr2+1 ; To + ldy #EM_COPY::BUF + lda (ptr3),y + sta ptr2 + iny + lda (ptr3),y + sta ptr2+1 ; To - ldy #EM_COPY::COUNT+1 - lda (ptr3),y ; Get number of pages - sta tmp1 - rts + ldy #EM_COPY::COUNT+1 + lda (ptr3),y ; Get number of pages + sta tmp1 + rts diff --git a/libsrc/geos-cbm/file/followchain.s b/libsrc/geos-cbm/file/followchain.s index bcdfe635b..df20bcaac 100644 --- a/libsrc/geos-cbm/file/followchain.s +++ b/libsrc/geos-cbm/file/followchain.s @@ -5,19 +5,19 @@ ; char FollowChain (struct tr_se *myTrSe, char *buffer); - .export _FollowChain - .import popax, setoserror - .import gettrse + .export _FollowChain + .import popax, setoserror + .import gettrse - .include "jumptab.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "geossym.inc" + _FollowChain: - sta r3L - stx r3H - jsr popax - jsr gettrse - sta r1L - stx r1H - jsr FollowChain - jmp setoserror + sta r3L + stx r3H + jsr popax + jsr gettrse + sta r1L + stx r1H + jsr FollowChain + jmp setoserror diff --git a/libsrc/geos-cbm/geossym.inc b/libsrc/geos-cbm/geossym.inc index 6cd250d89..03fd451da 100644 --- a/libsrc/geos-cbm/geossym.inc +++ b/libsrc/geos-cbm/geossym.inc @@ -3,312 +3,312 @@ ;reassembled by Maciej 'YTM/Elysium' Witkowiak ;4-2-99 -zpage = $0000 +zpage = $0000 ; -CPU_DDR = $00 -CPU_DATA = $01 +CPU_DDR = $00 +CPU_DATA = $01 ; -r0 = $02 -r0L = $02 -r0H = $03 -r1 = $04 -r1L = $04 -r1H = $05 -r2 = $06 -r2L = $06 -r2H = $07 -r3 = $08 -r3L = $08 -r3H = $09 -r4 = $0a -r4L = $0a -r4H = $0b -r5 = $0c -r5L = $0c -r5H = $0d -r6 = $0e -r6L = $0e -r6H = $0f -r7 = $10 -r7L = $10 -r7H = $11 -r8 = $12 -r8L = $12 -r8H = $13 -r9 = $14 -r9L = $14 -r9H = $15 -r10 = $16 -r10L = $16 -r10H = $17 -r11 = $18 -r11L = $18 -r11H = $19 -r12 = $1a -r12L = $1a -r12H = $1b -r13 = $1c -r13L = $1c -r13H = $1d -r14 = $1e -r14L = $1e -r14H = $1f -r15 = $20 -r15L = $20 -r15H = $21 +r0 = $02 +r0L = $02 +r0H = $03 +r1 = $04 +r1L = $04 +r1H = $05 +r2 = $06 +r2L = $06 +r2H = $07 +r3 = $08 +r3L = $08 +r3H = $09 +r4 = $0a +r4L = $0a +r4H = $0b +r5 = $0c +r5L = $0c +r5H = $0d +r6 = $0e +r6L = $0e +r6H = $0f +r7 = $10 +r7L = $10 +r7H = $11 +r8 = $12 +r8L = $12 +r8H = $13 +r9 = $14 +r9L = $14 +r9H = $15 +r10 = $16 +r10L = $16 +r10H = $17 +r11 = $18 +r11L = $18 +r11H = $19 +r12 = $1a +r12L = $1a +r12H = $1b +r13 = $1c +r13L = $1c +r13H = $1d +r14 = $1e +r14L = $1e +r14H = $1f +r15 = $20 +r15L = $20 +r15H = $21 ; -a0 = $fb -a0L = $fb -a0H = $fc -a1 = $fd -a1L = $fd -a1H = $fe -a2 = $70 -a2L = $70 -a2H = $71 -a3 = $72 -a3L = $72 -a3H = $73 -a4 = $74 -a4L = $74 -a4H = $75 -a5 = $76 -a5L = $76 -a5H = $77 -a6 = $78 -a6L = $78 -a6H = $79 -a7 = $7a -a7L = $7a -a7H = $7b -a8 = $7c -a8L = $7c -a8H = $7d -a9 = $7e -a9L = $7e -a9H = $7f +a0 = $fb +a0L = $fb +a0H = $fc +a1 = $fd +a1L = $fd +a1H = $fe +a2 = $70 +a2L = $70 +a2H = $71 +a3 = $72 +a3L = $72 +a3H = $73 +a4 = $74 +a4L = $74 +a4H = $75 +a5 = $76 +a5L = $76 +a5H = $77 +a6 = $78 +a6L = $78 +a6H = $79 +a7 = $7a +a7L = $7a +a7H = $7b +a8 = $7c +a8L = $7c +a8H = $7d +a9 = $7e +a9L = $7e +a9H = $7f ; -curPattern = $22 -string = $24 -baselineOffset = $26 -curSetWidth = $27 -curHeight = $29 -curIndexTable = $2a -cardDataPntr = $2c -currentMode = $2e -dispBufferOn = $2f -mouseOn = $30 -msePicPtr = $31 -windowTop = $33 -windowBottom = $34 -leftMargin = $35 -rightMargin = $37 -pressFlag = $39 -mouseXPos = $3a -mouseYPos = $3c -returnAddress = $3d -graphMode = $3f -TURBO_DD00 = $8e ; from 1541 turbo -TURBO_DD00_CPY = $8f ; from 1541 turbo -STATUS = $90 -curDevice = $ba +curPattern = $22 +string = $24 +baselineOffset = $26 +curSetWidth = $27 +curHeight = $29 +curIndexTable = $2a +cardDataPntr = $2c +currentMode = $2e +dispBufferOn = $2f +mouseOn = $30 +msePicPtr = $31 +windowTop = $33 +windowBottom = $34 +leftMargin = $35 +rightMargin = $37 +pressFlag = $39 +mouseXPos = $3a +mouseYPos = $3c +returnAddress = $3d +graphMode = $3f +TURBO_DD00 = $8e ; from 1541 turbo +TURBO_DD00_CPY = $8f ; from 1541 turbo +STATUS = $90 +curDevice = $ba ; -irqvec = $0314 -bkvec = $0316 -nmivec = $0318 +irqvec = $0314 +bkvec = $0316 +nmivec = $0318 ; -APP_RAM = $0400 -BACK_SCR_BASE = $6000 -PRINTBASE = $7900 -OS_VARS = $8000 +APP_RAM = $0400 +BACK_SCR_BASE = $6000 +PRINTBASE = $7900 +OS_VARS = $8000 ; -diskBlkBuf = $8000 -fileHeader = $8100 -curDirHead = $8200 -fileTrScTab = $8300 -dirEntryBuf = $8400 -DrACurDkNm = $841e -DrBCurDkNm = $8430 -dataFileName = $8442 -dataDiskName = $8453 -PrntFilename = $8465 -PrntDiskName = $8476 -curDrive = $8489 -diskOpenFlg = $848a -isGEOS = $848b -interleave = $848c -NUMDRV = $848d -driveType = $848e -_driveType = driveType-8 -turboFlags = $8492 -_turboFlags = turboFlags-8 -curRecord = $8496 -usedRecords = $8497 -fileWritten = $8498 -fileSize = $8499 -appMain = $849b -intTopVector = $849d -intBotVector = $849f -mouseVector = $84a1 -keyVector = $84a3 -inputVector = $84a5 -mouseFaultVec = $84a7 -otherPressVec = $84a9 -StringFaultVec = $84ab -alarmTmtVector = $84ad -BRKVector = $84af -RecoverVector = $84b1 -selectionFlash = $84b3 -alphaFlag = $84b4 -iconSelFlg = $84b5 -faultData = $84b6 -menuNumber = $84b7 -mouseTop = $84b8 -mouseBottom = $84b9 -mouseLeft = $84ba -mouseRight = $84bc -stringX = $84be -stringY = $84c0 -mousePicData = $84c1 -maxMouseSpeed = $8501 -minMouseSpeed = $8502 -mouseAccel = $8503 -keyData = $8504 -mouseData = $8505 -inputData = $8506 -mouseSpeed = $8507 -random = $850a -saveFontTab = $850c -dblClickCount = $8515 -year = $8516 -month = $8517 -day = $8518 -hour = $8519 -minutes = $851a -seconds = $851b -alarmSetFlag = $851c -sysDBData = $851d -screencolors = $851e -dlgBoxRamBuf = $851f ; to $8697 +diskBlkBuf = $8000 +fileHeader = $8100 +curDirHead = $8200 +fileTrScTab = $8300 +dirEntryBuf = $8400 +DrACurDkNm = $841e +DrBCurDkNm = $8430 +dataFileName = $8442 +dataDiskName = $8453 +PrntFilename = $8465 +PrntDiskName = $8476 +curDrive = $8489 +diskOpenFlg = $848a +isGEOS = $848b +interleave = $848c +NUMDRV = $848d +driveType = $848e +_driveType = driveType-8 +turboFlags = $8492 +_turboFlags = turboFlags-8 +curRecord = $8496 +usedRecords = $8497 +fileWritten = $8498 +fileSize = $8499 +appMain = $849b +intTopVector = $849d +intBotVector = $849f +mouseVector = $84a1 +keyVector = $84a3 +inputVector = $84a5 +mouseFaultVec = $84a7 +otherPressVec = $84a9 +StringFaultVec = $84ab +alarmTmtVector = $84ad +BRKVector = $84af +RecoverVector = $84b1 +selectionFlash = $84b3 +alphaFlag = $84b4 +iconSelFlg = $84b5 +faultData = $84b6 +menuNumber = $84b7 +mouseTop = $84b8 +mouseBottom = $84b9 +mouseLeft = $84ba +mouseRight = $84bc +stringX = $84be +stringY = $84c0 +mousePicData = $84c1 +maxMouseSpeed = $8501 +minMouseSpeed = $8502 +mouseAccel = $8503 +keyData = $8504 +mouseData = $8505 +inputData = $8506 +mouseSpeed = $8507 +random = $850a +saveFontTab = $850c +dblClickCount = $8515 +year = $8516 +month = $8517 +day = $8518 +hour = $8519 +minutes = $851a +seconds = $851b +alarmSetFlag = $851c +sysDBData = $851d +screencolors = $851e +dlgBoxRamBuf = $851f ; to $8697 ; ;$8698 - $8877 - various system data (keyboard queue, VLIR t&s, DBox, Menu, timers) ; -savedmoby2 = $88bb -scr80polar = $88bc -scr80colors = $88bd -vdcClrMode = $88be -driveData = $88bf -ramExpSize = $88c3 -sysRAMFlg = $88c4 -firstBoot = $88c5 -curType = $88c6 -ramBase = $88c7 -inputDevName = $88cb -memBase = $88cf ;??? -DrCCurDkNm = $88dc -DrDCurDkNm = $88ee -dir2Head = $8900 +savedmoby2 = $88bb +scr80polar = $88bc +scr80colors = $88bd +vdcClrMode = $88be +driveData = $88bf +ramExpSize = $88c3 +sysRAMFlg = $88c4 +firstBoot = $88c5 +curType = $88c6 +ramBase = $88c7 +inputDevName = $88cb +memBase = $88cf ;??? +DrCCurDkNm = $88dc +DrDCurDkNm = $88ee +dir2Head = $8900 ; -SPRITE_PICS = $8a00 -spr0pic = $8a00 -spr1pic = $8a40 -spr2pic = $8a80 -spr3pic = $8ac0 -spr4pic = $8b00 -spr5pic = $8b40 -spr6pic = $8b80 -spr7pic = $8bc0 -COLOR_MATRIX = $8c00 +SPRITE_PICS = $8a00 +spr0pic = $8a00 +spr1pic = $8a40 +spr2pic = $8a80 +spr3pic = $8ac0 +spr4pic = $8b00 +spr5pic = $8b40 +spr6pic = $8b80 +spr7pic = $8bc0 +COLOR_MATRIX = $8c00 ; -obj0Pointer = $8ff8 -obj1Pointer = $8ff9 -obj2Pointer = $8ffa -obj3Pointer = $8ffb -obj4Pointer = $8ffc -obj5Pointer = $8ffd -obj6Pointer = $8ffe -obj7Pointer = $8fff +obj0Pointer = $8ff8 +obj1Pointer = $8ff9 +obj2Pointer = $8ffa +obj3Pointer = $8ffb +obj4Pointer = $8ffc +obj5Pointer = $8ffd +obj6Pointer = $8ffe +obj7Pointer = $8fff ; -DISK_BASE = $9000 -SCREEN_BASE = $a000 -OS_ROM = $c000 -OS_JUMPTAB = $c100 -RAMC_BASE = $de00 -RAMC_WINDOW = $df00 -EXP_BASE = $df00 -MOUSE_BASE_128 = $fd00 -MOUSE_JMP_128 = $fd00 -END_MOUSE_128 = $fe80 -MOUSE_BASE = $fe80 -MOUSE_JMP = $fe80 -config = $ff00 -END_MOUSE = $fffa -NMI_VECTOR = $fffa -RESET_VECTOR = $fffc -IRQ_VECTOR = $fffe +DISK_BASE = $9000 +SCREEN_BASE = $a000 +OS_ROM = $c000 +OS_JUMPTAB = $c100 +RAMC_BASE = $de00 +RAMC_WINDOW = $df00 +EXP_BASE = $df00 +MOUSE_BASE_128 = $fd00 +MOUSE_JMP_128 = $fd00 +END_MOUSE_128 = $fe80 +MOUSE_BASE = $fe80 +MOUSE_JMP = $fe80 +config = $ff00 +END_MOUSE = $fffa +NMI_VECTOR = $fffa +RESET_VECTOR = $fffc +IRQ_VECTOR = $fffe ; -vicbase = $d000 -sidbase = $d400 -mmu = $d500 -VDC = $d600 -ctab = $d800 -cia1base = $dc00 -cia2base = $dd00 +vicbase = $d000 +sidbase = $d400 +mmu = $d500 +VDC = $d600 +ctab = $d800 +cia1base = $dc00 +cia2base = $dd00 ; -mob0xpos = $d000 -mob0ypos = $d001 -mob1xpos = $d002 -mob1ypos = $d003 -mob2xpos = $d004 -mob2ypos = $d005 -mob3xpos = $d006 -mob3ypos = $d007 -mob4xpos = $d008 -mob4ypos = $d009 -mob5xpos = $d00a -mob5ypos = $d00b -mob6xpos = $d00c -mob6ypos = $d00d -mob7xpos = $d00e -mob7ypos = $d00f -msbxpos = $d010 -grcntrl1 = $d011 -rasreg = $d012 -lpxpos = $d013 -lpypos = $d014 -mobenble = $d015 -grcntrl2 = $d016 -grmemptr = $d018 -grirq = $d019 -grirqen = $d01a -moby2 = $d017 -mobprior = $d01b -mobmcm = $d01c -mobx2 = $d01d -mobmobcol = $d01e -mobbakcol = $d01f -extclr = $d020 -bakclr0 = $d021 -bakclr1 = $d022 -bakclr2 = $d023 -bakclr3 = $d024 -mcmclr0 = $d025 -mcmclr1 = $d026 -mob0clr = $d027 -mob1clr = $d028 -mob2clr = $d029 -mob3clr = $d02a -mob4clr = $d02b -mob5clr = $d02c -mob6clr = $d02d -mob7clr = $d02e -keyreg = $d02f -clkreg = $d030 +mob0xpos = $d000 +mob0ypos = $d001 +mob1xpos = $d002 +mob1ypos = $d003 +mob2xpos = $d004 +mob2ypos = $d005 +mob3xpos = $d006 +mob3ypos = $d007 +mob4xpos = $d008 +mob4ypos = $d009 +mob5xpos = $d00a +mob5ypos = $d00b +mob6xpos = $d00c +mob6ypos = $d00d +mob7xpos = $d00e +mob7ypos = $d00f +msbxpos = $d010 +grcntrl1 = $d011 +rasreg = $d012 +lpxpos = $d013 +lpypos = $d014 +mobenble = $d015 +grcntrl2 = $d016 +grmemptr = $d018 +grirq = $d019 +grirqen = $d01a +moby2 = $d017 +mobprior = $d01b +mobmcm = $d01c +mobx2 = $d01d +mobmobcol = $d01e +mobbakcol = $d01f +extclr = $d020 +bakclr0 = $d021 +bakclr1 = $d022 +bakclr2 = $d023 +bakclr3 = $d024 +mcmclr0 = $d025 +mcmclr1 = $d026 +mob0clr = $d027 +mob1clr = $d028 +mob2clr = $d029 +mob3clr = $d02a +mob4clr = $d02b +mob5clr = $d02c +mob6clr = $d02d +mob7clr = $d02e +keyreg = $d02f +clkreg = $d030 ; -vdcreg = $d600 -vdcdata = $d601 +vdcreg = $d600 +vdcdata = $d601 ; diff --git a/libsrc/geos-cbm/geossym2.inc b/libsrc/geos-cbm/geossym2.inc index ced630e34..cdcbc24dc 100644 --- a/libsrc/geos-cbm/geossym2.inc +++ b/libsrc/geos-cbm/geossym2.inc @@ -3,9 +3,9 @@ ;reassembled by Maciej 'YTM/Alliance' Witkowiak ;4-2-99 -bootName = $c006 -version = $c00f -nationality = $c010 -sysFlgCopy = $c012 -c128Flag = $c013 -dateCopy = $c018 \ No newline at end of file +bootName = $c006 +version = $c00f +nationality = $c010 +sysFlgCopy = $c012 +c128Flag = $c013 +dateCopy = $c018 \ No newline at end of file diff --git a/libsrc/geos-cbm/inputdrv.inc b/libsrc/geos-cbm/inputdrv.inc index 4f8b97b65..f40a82721 100644 --- a/libsrc/geos-cbm/inputdrv.inc +++ b/libsrc/geos-cbm/inputdrv.inc @@ -4,13 +4,13 @@ ;4-2-99 ;for C64 -;MOUSE_JMP = $fe80 -SlowMouse = $fe83 -UpdateMouse = $fe86 -SetMouse = $fe89 +;MOUSE_JMP = $fe80 +SlowMouse = $fe83 +UpdateMouse = $fe86 +SetMouse = $fe89 ;for C128 -;MOUSE_JMP_128 = $fd00 -SlowMouse_128 = $fd03 -UpdateMouse_128 = $fd06 -SetMouse_128 = $fd09 +;MOUSE_JMP_128 = $fd00 +SlowMouse_128 = $fd03 +UpdateMouse_128 = $fd06 +SetMouse_128 = $fd09 diff --git a/libsrc/geos-cbm/joy/geos-stdjoy.s b/libsrc/geos-cbm/joy/geos-stdjoy.s index 106209a9e..7cfd0ad08 100644 --- a/libsrc/geos-cbm/joy/geos-stdjoy.s +++ b/libsrc/geos-cbm/joy/geos-stdjoy.s @@ -5,45 +5,45 @@ ; Ullrich von Bassewitz, 2002-12-20 ; - .include "zeropage.inc" - .include "joy-kernel.inc" - .include "joy-error.inc" - .include "geossym.inc" + .include "zeropage.inc" + .include "joy-kernel.inc" + .include "joy-error.inc" + .include "geossym.inc" - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ ; Header. Includes jump table -.segment "JUMPTABLE" - +.segment "JUMPTABLE" + ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) - .byte $01 ; JOY_UP - .byte $02 ; JOY_DOWN - .byte $04 ; JOY_LEFT - .byte $08 ; JOY_RIGHT - .byte $10 ; JOY_FIRE - .byte $00 ; Future expansion - .byte $00 ; Future expansion - .byte $00 ; Future expansion + .byte $01 ; JOY_UP + .byte $02 ; JOY_DOWN + .byte $04 ; JOY_LEFT + .byte $08 ; JOY_RIGHT + .byte $10 ; JOY_FIRE + .byte $00 ; Future expansion + .byte $00 ; Future expansion + .byte $00 ; Future expansion ; Jump table. - .word INSTALL - .word UNINSTALL - .word COUNT - .word READ + .word INSTALL + .word UNINSTALL + .word COUNT + .word READ ; ------------------------------------------------------------------------ ; Constants -JOY_COUNT = 2 ; Number of joysticks we support +JOY_COUNT = 2 ; Number of joysticks we support ; ------------------------------------------------------------------------ ; Data. @@ -58,9 +58,9 @@ JOY_COUNT = 2 ; Number of joysticks we support ; INSTALL: - lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead + lda #JOY_ERR_OK +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -68,54 +68,54 @@ INSTALL: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ ; COUNT: Return the total number of available joysticks in a/x. ; COUNT: - lda #JOY_COUNT - rts + lda #JOY_COUNT + rts ; ------------------------------------------------------------------------ ; READ: Read a particular joystick passed in A. ; READ: - tax - php - sei ; disable IRQ - lda $01 - pha - lda #$35 - sta $01 ; enable I/O + tax + php + sei ; disable IRQ + lda $01 + pha + lda #$35 + sta $01 ; enable I/O - txa ; Joystick number into X - bne joy2 + txa ; Joystick number into X + bne joy2 ; Read joystick 1 joy1: - lda #$7F - sta cia1base - lda cia1base+1 -back: tay - pla - sta $01 - plp - tya - and #$1F - eor #$1F - rts + lda #$7F + sta cia1base + lda cia1base+1 +back: tay + pla + sta $01 + plp + tya + and #$1F + eor #$1F + rts ; Read joystick 2 -joy2: ldx #0 - lda #$E0 - ldy #$FF - sta cia1base+2 - lda cia1base+1 - sty cia1base+2 - jmp back +joy2: ldx #0 + lda #$E0 + ldy #$FF + sta cia1base+2 + lda cia1base+1 + sty cia1base+2 + jmp back diff --git a/libsrc/geos-cbm/jumptab.inc b/libsrc/geos-cbm/jumptab.inc index 9f50decc1..306bffcc4 100644 --- a/libsrc/geos-cbm/jumptab.inc +++ b/libsrc/geos-cbm/jumptab.inc @@ -4,175 +4,175 @@ ;4-2-99 ;jump table -InterruptMain = $c100 -InitProcesses = $c103 -RestartProcess = $c106 -EnableProcess = $c109 -BlockProcess = $c10c -UnblockProcess = $c10f -FreezeProcess = $c112 -UnfreezeProcess = $c115 -HorizontalLine = $c118 -InvertLine = $c11b -RecoverLine = $c11e -VerticalLine = $c121 -Rectangle = $c124 -FrameRectangle = $c127 -InvertRectangle = $c12a -RecoverRectangle = $c12d -DrawLine = $c130 -DrawPoint = $c133 -GraphicsString = $c136 -SetPattern = $c139 -GetScanLine = $c13c -TestPoint = $c13f -BitmapUp = $c142 -PutChar = $c145 -PutString = $c148 -UseSystemFont = $c14b -StartMouseMode = $c14e -DoMenu = $c151 -RecoverMenu = $c154 -RecoverAllMenus = $c157 -DoIcons = $c15a -DShiftLeft = $c15d -BBMult = $c160 -BMult = $c163 -DMult = $c166 -Ddiv = $c169 -DSdiv = $c16c -Dabs = $c16f -Dnegate = $c172 -Ddec = $c175 -ClearRam = $c178 -FillRam = $c17b -MoveData = $c17e -InitRam = $c181 -PutDecimal = $c184 -GetRandom = $c187 -MouseUp = $c18a -MouseOff = $c18d -DoPreviousMenu = $c190 -ReDoMenu = $c193 -GetSerialNumber = $c196 -Sleep = $c199 -ClearMouseMode = $c19c -i_Rectangle = $c19f -i_FrameRectangle = $c1a2 -i_RecoverRectangle = $c1a5 -i_GraphicsString = $c1a8 -i_BitmapUp = $c1ab -i_PutString = $c1ae -GetRealSize = $c1b1 -i_FillRam = $c1b4 -i_MoveData = $c1b7 -GetString = $c1ba -GotoFirstMenu = $c1bd -InitTextPrompt = $c1c0 -MainLoop = $c1c3 -DrawSprite = $c1c6 -GetCharWidth = $c1c9 -LoadCharSet = $c1cc -PosSprite = $c1cf -EnablSprite = $c1d2 -DisablSprite = $c1d5 -CallRoutine = $c1d8 -CalcBlksFree = $c1db -ChkDkGEOS = $c1de -NewDisk = $c1e1 -GetBlock = $c1e4 -PutBlock = $c1e7 -SetGEOSDisk = $c1ea -SaveFile = $c1ed -SetGDirEntry = $c1f0 -BldGDirEntry = $c1f3 -GetFreeDirBlk = $c1f6 -WriteFile = $c1f9 -BlkAlloc = $c1fc -ReadFile = $c1ff -SmallPutChar = $c202 -FollowChain = $c205 -GetFile = $c208 -FindFile = $c20b -CRC = $c20e -LdFile = $c211 -EnterTurbo = $c214 -LdDeskAcc = $c217 -ReadBlock = $c21a -LdApplic = $c21d -WriteBlock = $c220 -VerWriteBlock = $c223 -FreeFile = $c226 -GetFHdrInfo = $c229 -EnterDeskTop = $c22c -StartAppl = $c22f -ExitTurbo = $c232 -PurgeTurbo = $c235 -DeleteFile = $c238 -FindFTypes = $c23b -RstrAppl = $c23e -ToBASIC = $c241 -FastDelFile = $c244 -GetDirHead = $c247 -PutDirHead = $c24a -NxtBlkAlloc = $c24d -ImprintRectangle = $c250 -i_ImprintRectangle = $c253 -DoDlgBox = $c256 -RenameFile = $c259 -InitForIO = $c25c -DoneWithIO = $c25f -DShiftRight = $c262 -CopyString = $c265 -CopyFString = $c268 -CmpString = $c26b -CmpFString = $c26e -FirstInit = $c271 -OpenRecordFile = $c274 -CloseRecordFile = $c277 -NextRecord = $c27a -PreviousRecord = $c27d -PointRecord = $c280 -DeleteRecord = $c283 -InsertRecord = $c286 -AppendRecord = $c289 -ReadRecord = $c28c -WriteRecord = $c28f -SetNextFree = $c292 -UpdateRecordFile = $c295 -GetPtrCurDkNm = $c298 -PromptOn = $c29b -PromptOff = $c29e -OpenDisk = $c2a1 -DoInlineReturn = $c2a4 -GetNextChar = $c2a7 -BitmapClip = $c2aa -FindBAMBit = $c2ad -SetDevice = $c2b0 -IsMseInRegion = $c2b3 -ReadByte = $c2b6 -FreeBlock = $c2b9 -ChangeDiskDevice = $c2bc -RstrFrmDialogue = $c2bf -Panic = $c2c2 -BitOtherClip = $c2c5 -StashRAM = $c2c8 -FetchRAM = $c2cb -SwapRAM = $c2ce -VerifyRAM = $c2d1 -DoRAMOp = $c2d4 +InterruptMain = $c100 +InitProcesses = $c103 +RestartProcess = $c106 +EnableProcess = $c109 +BlockProcess = $c10c +UnblockProcess = $c10f +FreezeProcess = $c112 +UnfreezeProcess = $c115 +HorizontalLine = $c118 +InvertLine = $c11b +RecoverLine = $c11e +VerticalLine = $c121 +Rectangle = $c124 +FrameRectangle = $c127 +InvertRectangle = $c12a +RecoverRectangle = $c12d +DrawLine = $c130 +DrawPoint = $c133 +GraphicsString = $c136 +SetPattern = $c139 +GetScanLine = $c13c +TestPoint = $c13f +BitmapUp = $c142 +PutChar = $c145 +PutString = $c148 +UseSystemFont = $c14b +StartMouseMode = $c14e +DoMenu = $c151 +RecoverMenu = $c154 +RecoverAllMenus = $c157 +DoIcons = $c15a +DShiftLeft = $c15d +BBMult = $c160 +BMult = $c163 +DMult = $c166 +Ddiv = $c169 +DSdiv = $c16c +Dabs = $c16f +Dnegate = $c172 +Ddec = $c175 +ClearRam = $c178 +FillRam = $c17b +MoveData = $c17e +InitRam = $c181 +PutDecimal = $c184 +GetRandom = $c187 +MouseUp = $c18a +MouseOff = $c18d +DoPreviousMenu = $c190 +ReDoMenu = $c193 +GetSerialNumber = $c196 +Sleep = $c199 +ClearMouseMode = $c19c +i_Rectangle = $c19f +i_FrameRectangle = $c1a2 +i_RecoverRectangle = $c1a5 +i_GraphicsString = $c1a8 +i_BitmapUp = $c1ab +i_PutString = $c1ae +GetRealSize = $c1b1 +i_FillRam = $c1b4 +i_MoveData = $c1b7 +GetString = $c1ba +GotoFirstMenu = $c1bd +InitTextPrompt = $c1c0 +MainLoop = $c1c3 +DrawSprite = $c1c6 +GetCharWidth = $c1c9 +LoadCharSet = $c1cc +PosSprite = $c1cf +EnablSprite = $c1d2 +DisablSprite = $c1d5 +CallRoutine = $c1d8 +CalcBlksFree = $c1db +ChkDkGEOS = $c1de +NewDisk = $c1e1 +GetBlock = $c1e4 +PutBlock = $c1e7 +SetGEOSDisk = $c1ea +SaveFile = $c1ed +SetGDirEntry = $c1f0 +BldGDirEntry = $c1f3 +GetFreeDirBlk = $c1f6 +WriteFile = $c1f9 +BlkAlloc = $c1fc +ReadFile = $c1ff +SmallPutChar = $c202 +FollowChain = $c205 +GetFile = $c208 +FindFile = $c20b +CRC = $c20e +LdFile = $c211 +EnterTurbo = $c214 +LdDeskAcc = $c217 +ReadBlock = $c21a +LdApplic = $c21d +WriteBlock = $c220 +VerWriteBlock = $c223 +FreeFile = $c226 +GetFHdrInfo = $c229 +EnterDeskTop = $c22c +StartAppl = $c22f +ExitTurbo = $c232 +PurgeTurbo = $c235 +DeleteFile = $c238 +FindFTypes = $c23b +RstrAppl = $c23e +ToBASIC = $c241 +FastDelFile = $c244 +GetDirHead = $c247 +PutDirHead = $c24a +NxtBlkAlloc = $c24d +ImprintRectangle = $c250 +i_ImprintRectangle = $c253 +DoDlgBox = $c256 +RenameFile = $c259 +InitForIO = $c25c +DoneWithIO = $c25f +DShiftRight = $c262 +CopyString = $c265 +CopyFString = $c268 +CmpString = $c26b +CmpFString = $c26e +FirstInit = $c271 +OpenRecordFile = $c274 +CloseRecordFile = $c277 +NextRecord = $c27a +PreviousRecord = $c27d +PointRecord = $c280 +DeleteRecord = $c283 +InsertRecord = $c286 +AppendRecord = $c289 +ReadRecord = $c28c +WriteRecord = $c28f +SetNextFree = $c292 +UpdateRecordFile = $c295 +GetPtrCurDkNm = $c298 +PromptOn = $c29b +PromptOff = $c29e +OpenDisk = $c2a1 +DoInlineReturn = $c2a4 +GetNextChar = $c2a7 +BitmapClip = $c2aa +FindBAMBit = $c2ad +SetDevice = $c2b0 +IsMseInRegion = $c2b3 +ReadByte = $c2b6 +FreeBlock = $c2b9 +ChangeDiskDevice = $c2bc +RstrFrmDialogue = $c2bf +Panic = $c2c2 +BitOtherClip = $c2c5 +StashRAM = $c2c8 +FetchRAM = $c2cb +SwapRAM = $c2ce +VerifyRAM = $c2d1 +DoRAMOp = $c2d4 ;only in GEOS 128 -TempHideMouse = $c2d7 -SetMousePicture = $c2da -SetNewMode = $c2dd -NormalizeX = $c2e0 -MoveBData = $c2e3 -SwapBData = $c2e6 -VerifyBData = $c2e9 -DoBOp = $c2ec -AccessCache = $c2ef -HideOnlyMouse = $c2f2 -SetColorMode = $c2f5 -ColorCard = $c2f8 -ColorRectangle = $c2fb +TempHideMouse = $c2d7 +SetMousePicture = $c2da +SetNewMode = $c2dd +NormalizeX = $c2e0 +MoveBData = $c2e3 +SwapBData = $c2e6 +VerifyBData = $c2e9 +DoBOp = $c2ec +AccessCache = $c2ef +HideOnlyMouse = $c2f2 +SetColorMode = $c2f5 +ColorCard = $c2f8 +ColorRectangle = $c2fb diff --git a/libsrc/geos-cbm/memory/fetchram.s b/libsrc/geos-cbm/memory/fetchram.s index df481fa73..2a841a01f 100644 --- a/libsrc/geos-cbm/memory/fetchram.s +++ b/libsrc/geos-cbm/memory/fetchram.s @@ -5,12 +5,12 @@ ; void FetchRAM (char REUBank, int length, char *from, char *dest); - .import REURegs - .export _FetchRAM + .import REURegs + .export _FetchRAM - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _FetchRAM: - jsr REURegs - jmp FetchRAM + jsr REURegs + jmp FetchRAM diff --git a/libsrc/geos-cbm/memory/reuregs.s b/libsrc/geos-cbm/memory/reuregs.s index 17f7db0eb..3b904720b 100644 --- a/libsrc/geos-cbm/memory/reuregs.s +++ b/libsrc/geos-cbm/memory/reuregs.s @@ -3,18 +3,18 @@ ; ; 31.12.99 - .import popax, popa - .import DoublePop - .export REURegs + .import popax, popa + .import DoublePop + .export REURegs - .include "geossym.inc" + .include "geossym.inc" REURegs: - jsr DoublePop - jsr popax - sta r2L - stx r2H - jsr popa - sta r3L - rts + jsr DoublePop + jsr popax + sta r2L + stx r2H + jsr popa + sta r3L + rts diff --git a/libsrc/geos-cbm/memory/stashram.s b/libsrc/geos-cbm/memory/stashram.s index cdd08e51f..33a8da90d 100644 --- a/libsrc/geos-cbm/memory/stashram.s +++ b/libsrc/geos-cbm/memory/stashram.s @@ -5,12 +5,12 @@ ; void StashRAM (char REUBank, int length, char *dest, char *from); - .import REURegs - .export _StashRAM + .import REURegs + .export _StashRAM - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _StashRAM: - jsr REURegs - jmp StashRAM + jsr REURegs + jmp StashRAM diff --git a/libsrc/geos-cbm/memory/swapram.s b/libsrc/geos-cbm/memory/swapram.s index 745a3c3f1..6d92a1e79 100644 --- a/libsrc/geos-cbm/memory/swapram.s +++ b/libsrc/geos-cbm/memory/swapram.s @@ -4,14 +4,14 @@ ; 21.12.99 ; void SwapRAM (char REUBank, int length, char *reuaddy, char *cpuaddy); -; note that in all REU procs last two pointers are identified like here +; note that in all REU procs last two pointers are identified like here - .import REURegs - .export _SwapRAM + .import REURegs + .export _SwapRAM - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _SwapRAM: - jsr REURegs - jmp SwapRAM + jsr REURegs + jmp SwapRAM diff --git a/libsrc/geos-cbm/memory/verifyram.s b/libsrc/geos-cbm/memory/verifyram.s index 019ec03d7..1b8211d19 100644 --- a/libsrc/geos-cbm/memory/verifyram.s +++ b/libsrc/geos-cbm/memory/verifyram.s @@ -5,15 +5,15 @@ ; char VerifyRAM (char REUBank, int length, char *reuaddy, char *cpuaddy); - .import REURegs - .export _VerifyRAM + .import REURegs + .export _VerifyRAM - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _VerifyRAM: - jsr REURegs - jsr VerifyRAM - txa - ldx #0 - rts + jsr REURegs + jsr VerifyRAM + txa + ldx #0 + rts diff --git a/libsrc/geos-cbm/printdrv.inc b/libsrc/geos-cbm/printdrv.inc index 55dbc4ebe..1e8937ccf 100644 --- a/libsrc/geos-cbm/printdrv.inc +++ b/libsrc/geos-cbm/printdrv.inc @@ -4,11 +4,11 @@ ;4-2-99 ;jump table -InitForPrint = $7900 -StartPrint = $7903 -PrintBuffer = $7906 -StopPrint = $7909 -GetDimensions = $790c -PrinsASCII = $790f -StartASCII = $7912 -SetNLQ = $7915 +InitForPrint = $7900 +StartPrint = $7903 +PrintBuffer = $7906 +StopPrint = $7909 +GetDimensions = $790c +PrinsASCII = $790f +StartASCII = $7912 +SetNLQ = $7915 diff --git a/libsrc/geos-cbm/system/get_ostype.s b/libsrc/geos-cbm/system/get_ostype.s index bdcdf31e1..492ce132d 100644 --- a/libsrc/geos-cbm/system/get_ostype.s +++ b/libsrc/geos-cbm/system/get_ostype.s @@ -10,83 +10,83 @@ ; unsigned char get_ostype (void); ; unsigned char get_tv (void); - .export _get_ostype - .export _get_tv - .importzp tmp1 + .export _get_ostype + .export _get_tv + .importzp tmp1 - .include "const.inc" - .include "geossym.inc" - .include "geossym2.inc" + .include "const.inc" + .include "geossym.inc" + .include "geossym2.inc" _get_ostype: - ldx #0 - lda version - cmp #$a9 - beq geos11 - and #%11110000 - cmp #$10 - beq geos10 - lda c128Flag ; we're on at least 2.0 - cmp #$18 - beq geos_on_plus4 - ora version - rts + ldx #0 + lda version + cmp #$a9 + beq geos11 + and #%11110000 + cmp #$10 + beq geos10 + lda c128Flag ; we're on at least 2.0 + cmp #$18 + beq geos_on_plus4 + ora version + rts geos10: - lda version - rts + lda version + rts geos11: - lda #$11 - rts + lda #$11 + rts geos_on_plus4: - lda #$04 - rts + lda #$04 + rts _get_tv: - jsr _get_ostype - cmp #$04 - beq plus4_get_tv - bpl only40 ; C64 with 40 columns only - lda graphMode - bpl only40 ; C128 but currently on 40 columns - ldx #1 ; COLUMNS80 - bne tvmode -only40: ldx #0 ; COLUMNS40 -tvmode: ; PAL/NTSC check here, result in A + jsr _get_ostype + cmp #$04 + beq plus4_get_tv + bpl only40 ; C64 with 40 columns only + lda graphMode + bpl only40 ; C128 but currently on 40 columns + ldx #1 ; COLUMNS80 + bne tvmode +only40: ldx #0 ; COLUMNS40 +tvmode: ; PAL/NTSC check here, result in A php - sei ; disable interrupts - lda CPU_DATA ; this is for C64 - pha - lda #IO_IN ; enable access to I/O - sta CPU_DATA - bit rasreg - bpl tvmode ; wait for rasterline 127=256!) + sei ; disable interrupts + lda CPU_DATA ; this is for C64 + pha + lda #IO_IN ; enable access to I/O + sta CPU_DATA + bit rasreg + bpl tvmode ; wait for rasterline 127=256!) modelp: - cmp rasreg ; wait for rasterline = 24 (or 280 on PAL) - bne modelp - lda grcntrl1 ; 24 or 280 ? - bpl ntsc - lda #0 ; PAL - beq modeend + cmp rasreg ; wait for rasterline = 24 (or 280 on PAL) + bne modelp + lda grcntrl1 ; 24 or 280 ? + bpl ntsc + lda #0 ; PAL + beq modeend ntsc: - lda #$80 ; NTSC + lda #$80 ; NTSC modeend: - stx tmp1 - ora tmp1 - sta tmp1 - ldx #0 - pla - sta CPU_DATA ; restore memory config - plp ; restore interrupt state - lda tmp1 - rts + stx tmp1 + ora tmp1 + sta tmp1 + ldx #0 + pla + sta CPU_DATA ; restore memory config + plp ; restore interrupt state + lda tmp1 + rts plus4_get_tv: - ldx #1 ; Assume PAL - bit $FF07 ; Test bit 6 - bvc plus4pal - dex ; NTSC + ldx #1 ; Assume PAL + bit $FF07 ; Test bit 6 + bvc plus4pal + dex ; NTSC plus4pal: - txa - ldx #0 - rts + txa + ldx #0 + rts diff --git a/libsrc/geos-cbm/system/getserialnumber.s b/libsrc/geos-cbm/system/getserialnumber.s index bdb6836c1..ec84ac335 100644 --- a/libsrc/geos-cbm/system/getserialnumber.s +++ b/libsrc/geos-cbm/system/getserialnumber.s @@ -5,13 +5,13 @@ ; int GetSerialNumber (void); - .export _GetSerialNumber + .export _GetSerialNumber - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _GetSerialNumber: - jsr GetSerialNumber - lda r0L - ldx r0H - rts + jsr GetSerialNumber + lda r0L + ldx r0H + rts diff --git a/libsrc/geos-cbm/system/initdoneio.s b/libsrc/geos-cbm/system/initdoneio.s index 6bcfe195b..b5e51524a 100644 --- a/libsrc/geos-cbm/system/initdoneio.s +++ b/libsrc/geos-cbm/system/initdoneio.s @@ -6,10 +6,10 @@ ; void InitForIO (void); ; void DoneWithIO (void); - .export _InitForIO, _DoneWithIO + .export _InitForIO, _DoneWithIO - .include "jumptab.inc" + .include "jumptab.inc" -_InitForIO = InitForIO - -_DoneWithIO = DoneWithIO \ No newline at end of file +_InitForIO = InitForIO + +_DoneWithIO = DoneWithIO \ No newline at end of file diff --git a/libsrc/geos-cbm/system/setdevice.s b/libsrc/geos-cbm/system/setdevice.s index 6d9670422..37a162303 100644 --- a/libsrc/geos-cbm/system/setdevice.s +++ b/libsrc/geos-cbm/system/setdevice.s @@ -5,8 +5,8 @@ ; void SetDevice (char newDeviceNumber); - .export _SetDevice + .export _SetDevice - .include "jumptab.inc" - -_SetDevice = SetDevice + .include "jumptab.inc" + +_SetDevice = SetDevice diff --git a/libsrc/geos-cbm/system/tobasic.s b/libsrc/geos-cbm/system/tobasic.s index b238a47e1..cb47da531 100644 --- a/libsrc/geos-cbm/system/tobasic.s +++ b/libsrc/geos-cbm/system/tobasic.s @@ -5,8 +5,8 @@ ; void ToBASIC (void); - .export _ToBASIC + .export _ToBASIC - .include "jumptab.inc" + .include "jumptab.inc" -_ToBASIC = ToBASIC \ No newline at end of file +_ToBASIC = ToBASIC \ No newline at end of file diff --git a/libsrc/geos-cbm/tgi/geos-tgi.s b/libsrc/geos-cbm/tgi/geos-tgi.s index 6d721328f..dbf9f4fc4 100644 --- a/libsrc/geos-cbm/tgi/geos-tgi.s +++ b/libsrc/geos-cbm/tgi/geos-tgi.s @@ -3,75 +3,75 @@ ; 2010-08-17, Maciej 'YTM/Elysium' Witkowiak ; 2010-08-18, Greg King - .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" - .include "const.inc" - .include "jumptab.inc" - .include "geossym.inc" - .include "geossym2.inc" - - .macpack generic + .include "zeropage.inc" + .include "tgi-kernel.inc" + .include "tgi-error.inc" + .include "const.inc" + .include "jumptab.inc" + .include "geossym.inc" + .include "geossym2.inc" + + .macpack generic ; ------------------------------------------------------------------------ ; Constants -VDC_ADDR_REG := $D600 ; VDC address -VDC_DATA_REG := $D601 ; VDC data +VDC_ADDR_REG := $D600 ; VDC address +VDC_DATA_REG := $D601 ; VDC data -VDC_DSP_HI = 12 ; registers used -VDC_DSP_LO = 13 -VDC_DATA_HI = 18 -VDC_DATA_LO = 19 -VDC_VSCROLL = 24 -VDC_HSCROLL = 25 -VDC_COLORS = 26 -VDC_CSET = 28 -VDC_COUNT = 30 -VDC_DATA = 31 +VDC_DSP_HI = 12 ; registers used +VDC_DSP_LO = 13 +VDC_DATA_HI = 18 +VDC_DATA_LO = 19 +VDC_VSCROLL = 24 +VDC_HSCROLL = 25 +VDC_COLORS = 26 +VDC_CSET = 28 +VDC_COUNT = 30 +VDC_DATA = 31 ; ------------------------------------------------------------------------ ; Header. Includes jump table and constants. -.segment "JUMPTABLE" +.segment "JUMPTABLE" ; First part of the header is a structure that has a magic signature, ; and defines the capabilities of the driver. - .byte $74, $67, $69 ; "tgi" - .byte TGI_API_VERSION ; TGI API version number -xres: .word 320 ; X resolution -yres: .word 200 ; Y resolution - .byte 2 ; Number of drawing colors -pages: .byte 1 ; Number of screens available - .byte 8 ; System font X size - .byte 8 ; System font Y size -aspect: .word $00D4 ; Aspect ratio (based on 4/3 display) - .byte 0 ; TGI driver flags + .byte $74, $67, $69 ; "tgi" + .byte TGI_API_VERSION ; TGI API version number +xres: .word 320 ; X resolution +yres: .word 200 ; Y resolution + .byte 2 ; Number of drawing colors +pages: .byte 1 ; Number of screens available + .byte 8 ; System font X size + .byte 8 ; System font Y size +aspect: .word $00D4 ; Aspect ratio (based on 4/3 display) + .byte 0 ; TGI driver flags ; Next comes the jump table. With the exception of IRQ, all entries must be ; valid, and may point to an RTS for test versions (function not implemented). - .addr INSTALL - .addr UNINSTALL - .addr INIT - .addr DONE - .addr GETERROR - .addr CONTROL - .addr CLEAR - .addr SETVIEWPAGE - .addr SETDRAWPAGE - .addr SETCOLOR - .addr SETPALETTE - .addr GETPALETTE - .addr GETDEFPALETTE - .addr SETPIXEL - .addr GETPIXEL - .addr LINE - .addr BAR - .addr TEXTSTYLE - .addr OUTTEXT - .addr 0 ; IRQ entry is unused + .addr INSTALL + .addr UNINSTALL + .addr INIT + .addr DONE + .addr GETERROR + .addr CONTROL + .addr CLEAR + .addr SETVIEWPAGE + .addr SETDRAWPAGE + .addr SETCOLOR + .addr SETPALETTE + .addr GETPALETTE + .addr GETDEFPALETTE + .addr SETPIXEL + .addr GETPIXEL + .addr LINE + .addr BAR + .addr TEXTSTYLE + .addr OUTTEXT + .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. @@ -79,50 +79,50 @@ aspect: .word $00D4 ; Aspect ratio (based on 4/3 display) ; Variables mapped to the zero-page segment variables. Some of these are ; used for passing parameters to the driver. -X1 = ptr1 -Y1 = ptr2 -X2 = ptr3 -Y2 = ptr4 +X1 = ptr1 +Y1 = ptr2 +X2 = ptr3 +Y2 = ptr4 ; Absolute variables used in the code .bss SCRBASE: - .res 1 ; High byte of screen base (64k VDC only) + .res 1 ; High byte of screen base (64k VDC only) ERROR: - .res 1 ; Error code + .res 1 ; Error code PALETTE: - .res 2 ; The current palette + .res 2 ; The current palette BITMASK: - .res 1 ; $00 = clear, $01 = set pixels + .res 1 ; $00 = clear, $01 = set pixels OLDCOLOR: - .res 1 ; colors before entering gfx mode + .res 1 ; colors before entering gfx mode ; Text output stuff TEXTMAGX: - .res 1 + .res 1 TEXTMAGY: - .res 1 + .res 1 TEXTDIR: - .res 1 + .res 1 ; Constants and tables .rodata DEFPALETTE: - .byte $00, $0f ; White on black + .byte $00, $0f ; White on black PALETTESIZE = * - DEFPALETTE ; color translation table (indexed by VIC color) COLTRANS: - .byte $00, $0f, $08, $06, $0a, $04, $02, $0c - .byte $0d, $0b, $09, $01, $0e, $05, $03, $07 - ; colors BROWN and GRAY3 are wrong + .byte $00, $0f, $08, $06, $0a, $04, $02, $0c + .byte $0d, $0b, $09, $01, $0e, $05, $03, $07 + ; colors BROWN and GRAY3 are wrong .code @@ -135,97 +135,97 @@ COLTRANS: ; INSTALL: - lda version ; if GEOS 1.0... - and #$f0 - cmp #$10 - beq @L40 - lda c128Flag ; at least GEOS 2.0, but we're on C128? - bpl @L40 - lda graphMode ; GEOS 2.0, C128, but is 80 column screen enabled? - bmi @L80 -@L40: rts ; leave default values for 40 column screen + lda version ; if GEOS 1.0... + and #$f0 + cmp #$10 + beq @L40 + lda c128Flag ; at least GEOS 2.0, but we're on C128? + bpl @L40 + lda graphMode ; GEOS 2.0, C128, but is 80 column screen enabled? + bmi @L80 +@L40: rts ; leave default values for 40 column screen - ; check for VDC version and update register $19 value + ; check for VDC version and update register $19 value @L80: - ; double the x resolution and halve the aspect ratio + ; double the x resolution and halve the aspect ratio - asl xres - rol xres+1 + asl xres + rol xres+1 - lsr aspect+1 - ror aspect + lsr aspect+1 + ror aspect - ; update number of available screens + ; update number of available screens - ldx #VDC_CSET ; determine size of RAM... - jsr VDCReadReg - sta tmp1 - ora #%00010000 - jsr VDCWriteReg ; turn on 64k + ldx #VDC_CSET ; determine size of RAM... + jsr VDCReadReg + sta tmp1 + ora #%00010000 + jsr VDCWriteReg ; turn on 64k - jsr settestadr1 ; save original value of test byte - jsr VDCReadByte - sta tmp2 + jsr settestadr1 ; save original value of test byte + jsr VDCReadByte + sta tmp2 - lda #$55 ; write $55 here - ldy #ptr1 - jsr test64k ; read it here and there - lda #$aa ; write $aa here - ldy #ptr2 - jsr test64k ; read it here and there + lda #$55 ; write $55 here + ldy #ptr1 + jsr test64k ; read it here and there + lda #$aa ; write $aa here + ldy #ptr2 + jsr test64k ; read it here and there - jsr settestadr1 - lda tmp2 - jsr VDCWriteByte ; restore original value of test byte + jsr settestadr1 + lda tmp2 + jsr VDCWriteByte ; restore original value of test byte - lda ptr1 ; do bytes match? - cmp ptr1+1 - bne @have64k - lda ptr2 - cmp ptr2+1 - bne @have64k + lda ptr1 ; do bytes match? + cmp ptr1+1 + bne @have64k + lda ptr2 + cmp ptr2+1 + bne @have64k - ldx #VDC_CSET - lda tmp1 - jsr VDCWriteReg ; restore 16/64k flag - jmp @endok ; and leave default values for 16k + ldx #VDC_CSET + lda tmp1 + jsr VDCWriteReg ; restore 16/64k flag + jmp @endok ; and leave default values for 16k @have64k: - lda #4 - sta pages + lda #4 + sta pages @endok: - lda #0 - sta SCRBASE ; draw page 0 as default - rts + lda #0 + sta SCRBASE ; draw page 0 as default + rts test64k: - sta tmp1 - sty ptr3 - lda #0 - sta ptr3+1 - jsr settestadr1 - lda tmp1 - jsr VDCWriteByte ; write $55 - jsr settestadr1 - jsr VDCReadByte ; read here - pha - jsr settestadr2 - jsr VDCReadByte ; and there - ldy #1 - sta (ptr3),y - pla - dey - sta (ptr3),y - rts + sta tmp1 + sty ptr3 + lda #0 + sta ptr3+1 + jsr settestadr1 + lda tmp1 + jsr VDCWriteByte ; write $55 + jsr settestadr1 + jsr VDCReadByte ; read here + pha + jsr settestadr2 + jsr VDCReadByte ; and there + ldy #1 + sta (ptr3),y + pla + dey + sta (ptr3),y + rts settestadr1: - ldy #$02 ; test page 2 (here) - .byte $2c + ldy #$02 ; test page 2 (here) + .byte $2c settestadr2: - ldy #$42 ; or page 64+2 (there) - lda #0 - jmp VDCSetSourceAddr + ldy #$42 ; or page 64+2 (there) + lda #0 + jmp VDCSetSourceAddr ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. May @@ -235,7 +235,7 @@ settestadr2: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ @@ -253,32 +253,32 @@ UNINSTALL: ; INIT: - ldx #$01 - stx BITMASK ; solid black as pattern - lda #1 - jsr SetPattern - lda #ST_WR_FORE ; write only on foreground - sta dispBufferOn + ldx #$01 + stx BITMASK ; solid black as pattern + lda #1 + jsr SetPattern + lda #ST_WR_FORE ; write only on foreground + sta dispBufferOn - lda graphMode - bmi @L80 + lda graphMode + bmi @L80 ; Remember current color value (40 columns) - lda screencolors - sta OLDCOLOR - jmp @L99 + lda screencolors + sta OLDCOLOR + jmp @L99 ; Remember current color value (80 columns) -@L80: lda scr80colors - sta OLDCOLOR -@L99: lda #0 - jsr SETVIEWPAGE ; switch into viewpage 0 +@L80: lda scr80colors + sta OLDCOLOR +@L99: lda #0 + jsr SETVIEWPAGE ; switch into viewpage 0 ; Done, reset the error code - lda #TGI_ERR_OK - sta ERROR - rts + lda #TGI_ERR_OK + sta ERROR + rts ; ------------------------------------------------------------------------ ; DONE: Will be called to switch the graphics device back into text mode. @@ -289,35 +289,35 @@ INIT: ; DONE: - lda #0 - jsr SETVIEWPAGE ; switch into viewpage 0 + lda #0 + jsr SETVIEWPAGE ; switch into viewpage 0 - lda graphMode - bmi @L80 + lda graphMode + bmi @L80 - lda OLDCOLOR - sta screencolors ; restore color for 40 columns - ldx #0 -@L1: sta COLOR_MATRIX,x - sta COLOR_MATRIX+$0100,x - sta COLOR_MATRIX+$0200,x - sta COLOR_MATRIX+1000-256,x - inx - bne @L1 - rts + lda OLDCOLOR + sta screencolors ; restore color for 40 columns + ldx #0 +@L1: sta COLOR_MATRIX,x + sta COLOR_MATRIX+$0100,x + sta COLOR_MATRIX+$0200,x + sta COLOR_MATRIX+1000-256,x + inx + bne @L1 + rts -@L80: lda OLDCOLOR ; restore color for 80 columns - ldx #VDC_COLORS - jmp VDCWriteReg +@L80: lda OLDCOLOR ; restore color for 80 columns + ldx #VDC_COLORS + jmp VDCWriteReg ; ------------------------------------------------------------------------ ; GETERROR: Return the error code in A and clear it. GETERROR: - ldx #TGI_ERR_OK - lda ERROR - stx ERROR - rts + ldx #TGI_ERR_OK + lda ERROR + stx ERROR + rts ; ------------------------------------------------------------------------ ; CONTROL: Platform/driver specific entry point. @@ -326,9 +326,9 @@ GETERROR: ; CONTROL: - lda #TGI_ERR_INV_FUNC - sta ERROR - rts + lda #TGI_ERR_INV_FUNC + sta ERROR + rts ; ------------------------------------------------------------------------ ; CLEAR: Clears the screen. @@ -337,29 +337,29 @@ CONTROL: ; CLEAR: - lda curPattern - pha - lda #0 - jsr SetPattern - ldx #0 - stx r3L - stx r3H - stx r2L - lda #199 - sta r2H - lda graphMode - bpl @L40 - lda #>639 ; 80 columns - ldx #<639 - bne @L99 -@L40: lda #>319 ; 40 columns - ldx #<319 -@L99: sta r4H - stx r4L - jsr Rectangle - pla - sta curPattern - rts + lda curPattern + pha + lda #0 + jsr SetPattern + ldx #0 + stx r3L + stx r3H + stx r2L + lda #199 + sta r2H + lda graphMode + bpl @L40 + lda #>639 ; 80 columns + ldx #<639 + bne @L99 +@L40: lda #>319 ; 40 columns + ldx #<319 +@L99: sta r4H + stx r4L + jsr Rectangle + pla + sta curPattern + rts ; ------------------------------------------------------------------------ ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). @@ -369,15 +369,15 @@ CLEAR: ; SETVIEWPAGE: - ldx graphMode - bmi @L80 - rts -@L80: clc - ror - ror - ror - ldx #VDC_DSP_HI - jmp VDCWriteReg + ldx graphMode + bmi @L80 + rts +@L80: clc + ror + ror + ror + ldx #VDC_DSP_HI + jmp VDCWriteReg ; ------------------------------------------------------------------------ ; SETDRAWPAGE: Set the drawable page. Called with the new page in A (0..n). @@ -387,15 +387,15 @@ SETVIEWPAGE: ; SETDRAWPAGE: - ldx graphMode - bmi @L80 - rts -@L80: clc - ror - ror - ror - sta SCRBASE - rts + ldx graphMode + bmi @L80 + rts +@L80: clc + ror + ror + ror + sta SCRBASE + rts ; ------------------------------------------------------------------------ ; SETCOLOR: Set the drawing color (in A). The new color is already checked @@ -405,11 +405,11 @@ SETDRAWPAGE: ; SETCOLOR: - tax - beq @L1 - lda #1 + tax + beq @L1 + lda #1 @L1: sta BITMASK - jmp SetPattern ; need to have either 0 or 1 + jmp SetPattern ; need to have either 0 or 1 ; ------------------------------------------------------------------------ ; SETPALETTE: Set the palette (not available with all drivers/hardware). @@ -420,46 +420,46 @@ SETCOLOR: ; SETPALETTE: - jsr GETERROR ; clear error (if any) + jsr GETERROR ; clear error (if any) - ldy #PALETTESIZE - 1 -@L1: lda (ptr1),y ; Copy the palette - and #$0F ; Make a valid color - sta PALETTE,y - dey - bpl @L1 + ldy #PALETTESIZE - 1 +@L1: lda (ptr1),y ; Copy the palette + and #$0F ; Make a valid color + sta PALETTE,y + dey + bpl @L1 ; Put colors from palette into screen - lda graphMode - bmi @L80 + lda graphMode + bmi @L80 - lda PALETTE+1 ; foreground - asl a - asl a - asl a - asl a - ora PALETTE ; background - ldx #0 -@L2: sta COLOR_MATRIX,x - sta COLOR_MATRIX+$0100,x - sta COLOR_MATRIX+$0200,x - sta COLOR_MATRIX+1000-256,x - inx - bne @L2 - rts + lda PALETTE+1 ; foreground + asl a + asl a + asl a + asl a + ora PALETTE ; background + ldx #0 +@L2: sta COLOR_MATRIX,x + sta COLOR_MATRIX+$0100,x + sta COLOR_MATRIX+$0200,x + sta COLOR_MATRIX+1000-256,x + inx + bne @L2 + rts -@L80: ldy PALETTE+1 ; Foreground color - lda COLTRANS,y - asl a - asl a - asl a - asl a - ldy PALETTE ; Background color - ora COLTRANS,y +@L80: ldy PALETTE+1 ; Foreground color + lda COLTRANS,y + asl a + asl a + asl a + asl a + ldy PALETTE ; Background color + ora COLTRANS,y - ldx #VDC_COLORS - jmp VDCWriteReg + ldx #VDC_COLORS + jmp VDCWriteReg ; ------------------------------------------------------------------------ ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot @@ -470,9 +470,9 @@ SETPALETTE: ; GETPALETTE: - lda #PALETTE - rts + lda #PALETTE + rts ; ------------------------------------------------------------------------ ; GETDEFPALETTE: Return the default palette for the driver in A/X. All @@ -484,9 +484,9 @@ GETPALETTE: ; GETDEFPALETTE: - lda #DEFPALETTE - rts + lda #DEFPALETTE + rts ; ------------------------------------------------------------------------ ; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing @@ -497,18 +497,18 @@ GETDEFPALETTE: ; SETPIXEL: - lda X1 - ldx X1+1 - ldy Y1 - sta r3L - stx r3H - sty r11L - sec - lda BITMASK ; set or clear C flag - bne @L1 - clc -@L1: lda #0 - jmp DrawPoint + lda X1 + ldx X1+1 + ldy Y1 + sta r3L + stx r3H + sty r11L + sec + lda BITMASK ; set or clear C flag + bne @L1 + clc +@L1: lda #0 + jmp DrawPoint ; ------------------------------------------------------------------------ ; GETPIXEL: Read the color value of a pixel and return it in A/X. The @@ -517,19 +517,19 @@ SETPIXEL: GETPIXEL: - lda X1 - ldx X1+1 - ldy Y1 - sta r3L - stx r3H - sty r11L - jsr TestPoint - ldx #0 - bcc @L1 - inx -@L1: txa - ldx #0 - rts + lda X1 + ldx X1+1 + ldy Y1 + sta r3L + stx r3H + sty r11L + jsr TestPoint + ldx #0 + bcc @L1 + inx +@L1: txa + ldx #0 + rts ; ------------------------------------------------------------------------ ; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and @@ -539,24 +539,24 @@ GETPIXEL: ; LINE: - lda X1 - ldx X1+1 - ldy Y1 - sta r3L - stx r3H - sty r11L - lda X2 - ldx X2+1 - ldy Y2 - sta r4L - stx r4H - sty r11H - sec - lda BITMASK ; set or clear C flag - bne @L1 - clc -@L1: lda #0 - jmp DrawLine + lda X1 + ldx X1+1 + ldy Y1 + sta r3L + stx r3H + sty r11L + lda X2 + ldx X2+1 + ldy Y2 + sta r4L + stx r4H + sty r11H + sec + lda BITMASK ; set or clear C flag + bne @L1 + clc +@L1: lda #0 + jmp DrawLine ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where @@ -575,19 +575,19 @@ LINE: ; BAR: - lda X1 - ldx X1+1 - ldy Y1 - sta r3L - stx r3H - sty r2L - lda X2 - ldx X2+1 - ldy Y2 - sta r4L - stx r4H - sty r2H - jmp Rectangle + lda X1 + ldx X1+1 + ldy Y1 + sta r3L + stx r3H + sty r2L + lda X2 + ldx X2+1 + ldy Y2 + sta r4L + stx r4H + sty r2H + jmp Rectangle ; ------------------------------------------------------------------------ ; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y @@ -597,10 +597,10 @@ BAR: ; TEXTSTYLE: - stx TEXTMAGX - sty TEXTMAGY - sta TEXTDIR - rts + stx TEXTMAGX + sty TEXTMAGY + sta TEXTDIR + rts ; ------------------------------------------------------------------------ @@ -612,69 +612,69 @@ TEXTSTYLE: ; OUTTEXT: - lda TEXTDIR -; cmp #TGI_TEXT_HORIZONTAL ; this is equal 0 - bne @vertical + lda TEXTDIR +; cmp #TGI_TEXT_HORIZONTAL ; this is equal 0 + bne @vertical - lda X1 ; horizontal text output - ldx X1+1 - ldy Y1 - sta r11L - stx r11H - sty r1H - lda ptr3 - ldx ptr3+1 - sta r0L - stx r0H - jmp PutString + lda X1 ; horizontal text output + ldx X1+1 + ldy Y1 + sta r11L + stx r11H + sty r1H + lda ptr3 + ldx ptr3+1 + sta r0L + stx r0H + jmp PutString @vertical: - lda X1 ; vertical text output - ldx X1+1 - ldy Y1 - sta r11L - stx r11H - sty r1H - ldy #0 - lda (ptr3),y - beq @end - jsr PutChar - inc ptr3 - bne @L1 - inc ptr3+1 -@L1: lda Y1 - clc - adc #8 - sta Y1 - bne @vertical -@end: rts + lda X1 ; vertical text output + ldx X1+1 + ldy Y1 + sta r11L + stx r11H + sty r1H + ldy #0 + lda (ptr3),y + beq @end + jsr PutChar + inc ptr3 + bne @L1 + inc ptr3+1 +@L1: lda Y1 + clc + adc #8 + sta Y1 + bne @vertical +@end: rts ;------------- ; VDC helpers VDCSetSourceAddr: - pha - tya - ldx #VDC_DATA_HI - jsr VDCWriteReg - pla - ldx #VDC_DATA_LO - bne VDCWriteReg + pha + tya + ldx #VDC_DATA_HI + jsr VDCWriteReg + pla + ldx #VDC_DATA_LO + bne VDCWriteReg VDCReadByte: - ldx #VDC_DATA + ldx #VDC_DATA VDCReadReg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - lda VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + lda VDC_DATA_REG + rts VDCWriteByte: - ldx #VDC_DATA + ldx #VDC_DATA VDCWriteReg: - stx VDC_ADDR_REG -@L0: bit VDC_ADDR_REG - bpl @L0 - sta VDC_DATA_REG - rts + stx VDC_ADDR_REG +@L0: bit VDC_ADDR_REG + bpl @L0 + sta VDC_DATA_REG + rts diff --git a/libsrc/geos-common/common/_poserror.c b/libsrc/geos-common/common/_poserror.c index 0dc6f99d8..e0a7723a1 100644 --- a/libsrc/geos-common/common/_poserror.c +++ b/libsrc/geos-common/common/_poserror.c @@ -15,8 +15,8 @@ void __fastcall__ _poserror (const char* msg) ExitTurbo(); if (msg && *msg) { - DlgBoxOk(msg, errmsg); + DlgBoxOk(msg, errmsg); } else { - DlgBoxOk("", errmsg); + DlgBoxOk("", errmsg); } } diff --git a/libsrc/geos-common/common/copydata.s b/libsrc/geos-common/common/copydata.s index 95425aae6..ba2cf8043 100644 --- a/libsrc/geos-common/common/copydata.s +++ b/libsrc/geos-common/common/copydata.s @@ -4,25 +4,25 @@ ; Copy the data segment from the LOAD to the RUN location ; - .export copydata - .import __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__ + .export copydata + .import __DATA_LOAD__, __DATA_RUN__, __DATA_SIZE__ - .include "geossym.inc" - .include "jumptab.inc" + .include "geossym.inc" + .include "jumptab.inc" copydata: - lda #<__DATA_SIZE__ ; no need to check if it is == 0 - ldx #>__DATA_SIZE__ - sta r2L - stx r2H + lda #<__DATA_SIZE__ ; no need to check if it is == 0 + ldx #>__DATA_SIZE__ + sta r2L + stx r2H - lda #<__DATA_RUN__ - ldx #>__DATA_RUN__ - sta r1L - stx r1H + lda #<__DATA_RUN__ + ldx #>__DATA_RUN__ + sta r1L + stx r1H - lda #<__DATA_LOAD__ - ldx #>__DATA_LOAD__ - sta r0L - stx r0H - jmp MoveData + lda #<__DATA_LOAD__ + ldx #>__DATA_LOAD__ + sta r0L + stx r0H + jmp MoveData diff --git a/libsrc/geos-common/common/memcpy.s b/libsrc/geos-common/common/memcpy.s index 1afbf456a..7dcd0d62a 100644 --- a/libsrc/geos-common/common/memcpy.s +++ b/libsrc/geos-common/common/memcpy.s @@ -4,7 +4,7 @@ ; Maciej 'YTM/Elysium' Witkowiak, 15.07.2001 ; - .export _memcpy - .import _MoveData + .export _memcpy + .import _MoveData -_memcpy = _MoveData +_memcpy = _MoveData diff --git a/libsrc/geos-common/common/memmove.s b/libsrc/geos-common/common/memmove.s index e5daa93a6..4fceb5a8a 100644 --- a/libsrc/geos-common/common/memmove.s +++ b/libsrc/geos-common/common/memmove.s @@ -4,7 +4,7 @@ ; Maciej 'YTM/Elysium' Witkowiak, 15.07.2001 ; - .export _memmove - .import _MoveData + .export _memmove + .import _MoveData -_memmove = _MoveData +_memmove = _MoveData diff --git a/libsrc/geos-common/common/memset.s b/libsrc/geos-common/common/memset.s index 67c54f8bb..2cb6732d1 100644 --- a/libsrc/geos-common/common/memset.s +++ b/libsrc/geos-common/common/memset.s @@ -6,9 +6,9 @@ ; Maciej 'YTM/Elysium' Witkowiak, 20.08.2003 ; - .export _memset, _bzero, __bzero - .import _ClearRam, _FillRam + .export _memset, _bzero, __bzero + .import _ClearRam, _FillRam -_bzero = _ClearRam -__bzero = _ClearRam -_memset = _FillRam +_bzero = _ClearRam +__bzero = _ClearRam +_memset = _FillRam diff --git a/libsrc/geos-common/common/perror.c b/libsrc/geos-common/common/perror.c index 6b3ed3c64..022968bf2 100644 --- a/libsrc/geos-common/common/perror.c +++ b/libsrc/geos-common/common/perror.c @@ -15,8 +15,8 @@ void __fastcall__ perror(const char* msg) ExitTurbo(); if (msg && *msg) { - DlgBoxOk(msg, errmsg); + DlgBoxOk(msg, errmsg); } else { - DlgBoxOk("", errmsg); + DlgBoxOk("", errmsg); } } diff --git a/libsrc/geos-common/common/sleep.c b/libsrc/geos-common/common/sleep.c index b1b3750c1..94bd9fe79 100644 --- a/libsrc/geos-common/common/sleep.c +++ b/libsrc/geos-common/common/sleep.c @@ -12,9 +12,9 @@ unsigned __fastcall__ sleep (unsigned wait) char typ; if ( (get_tv()) & TV_NTSC ) { - typ = 60; + typ = 60; } else { - typ = 50; + typ = 50; } Sleep(wait*typ); diff --git a/libsrc/geos-common/common/zerobss.s b/libsrc/geos-common/common/zerobss.s index fc19c38c7..48fc5a89a 100644 --- a/libsrc/geos-common/common/zerobss.s +++ b/libsrc/geos-common/common/zerobss.s @@ -5,19 +5,19 @@ ; Zero the bss segment. ; - .export zerobss - .import __BSS_RUN__, __BSS_SIZE__ - - .include "jumptab.inc" - .include "geossym.inc" + .export zerobss + .import __BSS_RUN__, __BSS_SIZE__ + + .include "jumptab.inc" + .include "geossym.inc" zerobss: - lda #<__BSS_SIZE__ - ldx #>__BSS_SIZE__ - sta r0L - stx r0H - lda #<__BSS_RUN__ - ldx #>__BSS_RUN__ - sta r1L - stx r1H - jmp ClearRam + lda #<__BSS_SIZE__ + ldx #>__BSS_SIZE__ + sta r0L + stx r0H + lda #<__BSS_RUN__ + ldx #>__BSS_RUN__ + sta r1L + stx r1H + jmp ClearRam diff --git a/libsrc/geos-common/conio/_scrsize.s b/libsrc/geos-common/conio/_scrsize.s index 31d64e1f4..01aac96a4 100644 --- a/libsrc/geos-common/conio/_scrsize.s +++ b/libsrc/geos-common/conio/_scrsize.s @@ -6,46 +6,46 @@ ; 6.3.2001, 17.4.2003 - .export xsize, ysize - .export screensize - .importzp cursor_r, cursor_c - .import _cursor - .constructor initscrsize - - .include "geossym.inc" + .export xsize, ysize + .export screensize + .importzp cursor_r, cursor_c + .import _cursor + .constructor initscrsize + + .include "geossym.inc" -.segment "INIT" +.segment "INIT" initscrsize: .ifdef __GEOS_CBM__ - lda graphMode - bpl L1 - lda #80 ; 80 columns (more or less) - .byte $2c -L1: lda #40 ; 40 columns (more or less) - sta xsize - lda #25 ; something like that for Y size + lda graphMode + bpl L1 + lda #80 ; 80 columns (more or less) + .byte $2c +L1: lda #40 ; 40 columns (more or less) + sta xsize + lda #25 ; something like that for Y size .else - lda #70 ; 70 columns (more or less) - sta xsize - lda #24 ; something like that for Y size + lda #70 ; 70 columns (more or less) + sta xsize + lda #24 ; something like that for Y size .endif - sta ysize - lda #0 - sta cursor_c - sta cursor_r - jmp _cursor ; home and update cursor + sta ysize + lda #0 + sta cursor_c + sta cursor_r + jmp _cursor ; home and update cursor .code screensize: - ldx xsize - ldy ysize - rts + ldx xsize + ldy ysize + rts .bss xsize: - .res 1 + .res 1 ysize: - .res 1 + .res 1 diff --git a/libsrc/geos-common/conio/cclear.s b/libsrc/geos-common/conio/cclear.s index ac93803d9..9857f70e8 100644 --- a/libsrc/geos-common/conio/cclear.s +++ b/libsrc/geos-common/conio/cclear.s @@ -6,53 +6,53 @@ ; void cclearxy (unsigned char x, unsigned char y, unsigned char length); ; void cclear (unsigned char length); - .export _cclearxy, _cclear - .import popa, _gotoxy, fixcursor - .importzp cursor_x, cursor_y, cursor_c + .export _cclearxy, _cclear + .import popa, _gotoxy, fixcursor + .importzp cursor_x, cursor_y, cursor_c - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _cclearxy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length _cclear: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - tax - lda cursor_x ; left start - sta r3L - lda cursor_x+1 - sta r3L+1 - lda cursor_y ; level - sta r2L - clc - adc #7 - sta r2H - txa ; right end - clc - adc cursor_c - sta cursor_c - sta r4L - ldx #r4 - ldy #3 - jsr DShiftLeft - clc ; one pixel less - lda r4L - sbc #0 - sta r4L - lda r4L+1 - sbc #0 - sta r4L+1 - lda curPattern ; store current pattern - pha - lda #0 ; set pattern to clear - jsr SetPattern - jsr Rectangle - pla - jsr SetPattern ; restore pattern - jsr fixcursor -L9: rts + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + tax + lda cursor_x ; left start + sta r3L + lda cursor_x+1 + sta r3L+1 + lda cursor_y ; level + sta r2L + clc + adc #7 + sta r2H + txa ; right end + clc + adc cursor_c + sta cursor_c + sta r4L + ldx #r4 + ldy #3 + jsr DShiftLeft + clc ; one pixel less + lda r4L + sbc #0 + sta r4L + lda r4L+1 + sbc #0 + sta r4L+1 + lda curPattern ; store current pattern + pha + lda #0 ; set pattern to clear + jsr SetPattern + jsr Rectangle + pla + jsr SetPattern ; restore pattern + jsr fixcursor +L9: rts diff --git a/libsrc/geos-common/conio/cgetc.s b/libsrc/geos-common/conio/cgetc.s index 2c0f19a51..ad6e8ee28 100644 --- a/libsrc/geos-common/conio/cgetc.s +++ b/libsrc/geos-common/conio/cgetc.s @@ -6,34 +6,34 @@ ; unsigned char cgetc (void); - .export _cgetc - .import cursor, _PromptOff - .importzp cursor_x, cursor_y + .export _cgetc + .import cursor, _PromptOff + .importzp cursor_x, cursor_y - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _cgetc: ; show cursor if needed - lda cursor - beq L0 + lda cursor + beq L0 ; prepare cursor - lda #7 - jsr InitTextPrompt - lda cursor_x - ldx cursor_x+1 - sta stringX - stx stringX+1 - lda cursor_y - sta stringY - jsr PromptOn + lda #7 + jsr InitTextPrompt + lda cursor_x + ldx cursor_x+1 + sta stringX + stx stringX+1 + lda cursor_y + sta stringY + jsr PromptOn -L0: jsr GetNextChar - tax - beq L0 - pha - jsr _PromptOff - pla - ldx #0 - rts +L0: jsr GetNextChar + tax + beq L0 + pha + jsr _PromptOff + pla + ldx #0 + rts diff --git a/libsrc/geos-common/conio/chline.s b/libsrc/geos-common/conio/chline.s index c6310a11e..328d01a01 100644 --- a/libsrc/geos-common/conio/chline.s +++ b/libsrc/geos-common/conio/chline.s @@ -6,49 +6,49 @@ ; void chlinexy (unsigned char x, unsigned char y, unsigned char length); ; void chline (unsigned char length); - .export _chlinexy, _chline - .import popa, _gotoxy, fixcursor - .importzp cursor_x, cursor_y, cursor_c + .export _chlinexy, _chline + .import popa, _gotoxy, fixcursor + .importzp cursor_x, cursor_y, cursor_c - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _chlinexy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length _chline: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - tax - lda cursor_x ; left start - sta r3L - lda cursor_x+1 - sta r3L+1 - lda cursor_y ; level - clc - adc #4 ; in the middle of a cell - sta r11L - txa ; right end - clc - adc cursor_c - sta cursor_c - sta r4L - lda #0 - sta r4L+1 - ldx #r4 - ldy #3 - jsr DShiftLeft - clc ; one pixel less - lda r4L - sbc #0 - sta r4L - lda r4L+1 - sbc #0 - sta r4L+1 - lda #%11111111 ; pattern - jsr HorizontalLine - jsr fixcursor -L9: rts + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + tax + lda cursor_x ; left start + sta r3L + lda cursor_x+1 + sta r3L+1 + lda cursor_y ; level + clc + adc #4 ; in the middle of a cell + sta r11L + txa ; right end + clc + adc cursor_c + sta cursor_c + sta r4L + lda #0 + sta r4L+1 + ldx #r4 + ldy #3 + jsr DShiftLeft + clc ; one pixel less + lda r4L + sbc #0 + sta r4L + lda r4L+1 + sbc #0 + sta r4L+1 + lda #%11111111 ; pattern + jsr HorizontalLine + jsr fixcursor +L9: rts diff --git a/libsrc/geos-common/conio/clrscr.s b/libsrc/geos-common/conio/clrscr.s index 72fcb40ff..8df390b5b 100644 --- a/libsrc/geos-common/conio/clrscr.s +++ b/libsrc/geos-common/conio/clrscr.s @@ -5,45 +5,45 @@ ; void clrscr (void); - .export _clrscr - .import fixcursor - .importzp cursor_c, cursor_r + .export _clrscr + .import fixcursor + .importzp cursor_c, cursor_r - .include "jumptab.inc" - .include "geossym.inc" - .include "const.inc" + .include "jumptab.inc" + .include "geossym.inc" + .include "const.inc" _clrscr: - lda curPattern ; save current pattern - pha - lda #0 ; set pattern to clear - jsr SetPattern - ldx #0 - stx r3L - stx r3H - stx r2L - stx cursor_c - stx cursor_r - jsr fixcursor ; home cursor + lda curPattern ; save current pattern + pha + lda #0 ; set pattern to clear + jsr SetPattern + ldx #0 + stx r3L + stx r3H + stx r2L + stx cursor_c + stx cursor_r + jsr fixcursor ; home cursor .ifdef __GEOS_CBM__ - lda #199 - sta r2H - lda graphMode - bpl L40 - lda #>639 ; 80 columns - ldx #<639 - bne L99 -L40: lda #>319 ; 40 columns - ldx #<319 + lda #199 + sta r2H + lda graphMode + bpl L40 + lda #>639 ; 80 columns + ldx #<639 + bne L99 +L40: lda #>319 ; 40 columns + ldx #<319 L99: .else - lda #191 - sta r2H - lda #>559 - ldx #<559 + lda #191 + sta r2H + lda #>559 + ldx #<559 .endif - sta r4H - stx r4L - jsr Rectangle - pla - jmp SetPattern ; restore pattern + sta r4H + stx r4L + jsr Rectangle + pla + jmp SetPattern ; restore pattern diff --git a/libsrc/geos-common/conio/cputc.s b/libsrc/geos-common/conio/cputc.s index dbc4f45c1..55674d583 100644 --- a/libsrc/geos-common/conio/cputc.s +++ b/libsrc/geos-common/conio/cputc.s @@ -22,70 +22,70 @@ ; HOME = KEY_ENTER, KEY_HOME = REV_ON, ; UPLINE = ?, KEY_UPARROW = GOTOY, ... - .export _cputcxy, _cputc - .import _gotoxy, fixcursor - .import popa - .import xsize,ysize - .importzp cursor_x, cursor_y, cursor_c, cursor_r + .export _cputcxy, _cputc + .import _gotoxy, fixcursor + .import popa + .import xsize,ysize + .importzp cursor_x, cursor_y, cursor_c, cursor_r - .include "const.inc" - .include "geossym.inc" - .include "jumptab.inc" + .include "const.inc" + .include "geossym.inc" + .include "jumptab.inc" _cputcxy: - pha ; Save C - jsr popa ; Get Y - jsr _gotoxy ; Set cursor, drop x - pla ; Restore C + pha ; Save C + jsr popa ; Get Y + jsr _gotoxy ; Set cursor, drop x + pla ; Restore C ; Plot a character - also used as internal function _cputc: - tax ; save character + tax ; save character ; some characters 0-31 are not safe for PutChar - cmp #$20 - bcs L1 - cmp #CR - beq do_cr - cmp #LF - beq do_lf - cmp #KEY_DELETE - bne L0 - ldx #BACKSPACE - sec - bcs L2 -L0: rts + cmp #$20 + bcs L1 + cmp #CR + beq do_cr + cmp #LF + beq do_lf + cmp #KEY_DELETE + bne L0 + ldx #BACKSPACE + sec + bcs L2 +L0: rts -L1: clc -L2: php - lda cursor_x - sta r11L - lda cursor_x+1 - sta r11H - lda cursor_y - clc - adc #6 ; 6 pixels down to the baseline - sta r1H - txa - jsr PutChar - plp - bcs fix_cursor +L1: clc +L2: php + lda cursor_x + sta r11L + lda cursor_x+1 + sta r11H + lda cursor_y + clc + adc #6 ; 6 pixels down to the baseline + sta r1H + txa + jsr PutChar + plp + bcs fix_cursor - inc cursor_c - lda cursor_c - cmp xsize ; hit right margin? - bne fix_cursor - lda #0 ; yes - do cr+lf - sta cursor_c -do_lf: inc cursor_r - lda cursor_r - cmp ysize ; hit bottom margin? - bne fix_cursor - dec cursor_r ; yes - stay in the last line + inc cursor_c + lda cursor_c + cmp xsize ; hit right margin? + bne fix_cursor + lda #0 ; yes - do cr+lf + sta cursor_c +do_lf: inc cursor_r + lda cursor_r + cmp ysize ; hit bottom margin? + bne fix_cursor + dec cursor_r ; yes - stay in the last line fix_cursor: - jmp fixcursor + jmp fixcursor -do_cr: lda #0 - sta cursor_c - beq fix_cursor +do_cr: lda #0 + sta cursor_c + beq fix_cursor diff --git a/libsrc/geos-common/conio/cvline.s b/libsrc/geos-common/conio/cvline.s index e60af74a3..ade7f34c9 100644 --- a/libsrc/geos-common/conio/cvline.s +++ b/libsrc/geos-common/conio/cvline.s @@ -6,43 +6,43 @@ ; void cvlinexy (unsigned char x, unsigned char y, unsigned char length); ; void cvline (unsigned char length); - .export _cvlinexy, _cvline - .import popa, _gotoxy, fixcursor - .importzp cursor_x, cursor_y, cursor_r + .export _cvlinexy, _cvline + .import popa, _gotoxy, fixcursor + .importzp cursor_x, cursor_y, cursor_r - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _cvlinexy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length _cvline: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - tax - lda cursor_x ; x position - clc - adc #3 ; in the middle of cell - sta r4L - lda cursor_x+1 - adc #0 - sta r4L+1 - lda cursor_y ; top start - sta r3L - txa ; bottom end - clc - adc cursor_r - sta cursor_r - asl a - asl a - asl a - clc ; one pixel less - sbc #0 - sta r3H - lda #%11111111 ; pattern - jsr VerticalLine - jsr fixcursor -L9: rts + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + tax + lda cursor_x ; x position + clc + adc #3 ; in the middle of cell + sta r4L + lda cursor_x+1 + adc #0 + sta r4L+1 + lda cursor_y ; top start + sta r3L + txa ; bottom end + clc + adc cursor_r + sta cursor_r + asl a + asl a + asl a + clc ; one pixel less + sbc #0 + sta r3H + lda #%11111111 ; pattern + jsr VerticalLine + jsr fixcursor +L9: rts diff --git a/libsrc/geos-common/conio/dummies.s b/libsrc/geos-common/conio/dummies.s index ac494106d..e747c6468 100644 --- a/libsrc/geos-common/conio/dummies.s +++ b/libsrc/geos-common/conio/dummies.s @@ -9,10 +9,10 @@ ; unsigned char __fastcall__ revers (unsigned char onoff); ; - .export _textcolor, _bgcolor, _bordercolor, _revers - .import return0 + .export _textcolor, _bgcolor, _bordercolor, _revers + .import return0 -_textcolor = return0 -_bgcolor = return0 -_bordercolor = return0 -_revers = return0 +_textcolor = return0 +_bgcolor = return0 +_bordercolor = return0 +_revers = return0 diff --git a/libsrc/geos-common/conio/gotoxy.s b/libsrc/geos-common/conio/gotoxy.s index 1464eea27..48b413d5f 100644 --- a/libsrc/geos-common/conio/gotoxy.s +++ b/libsrc/geos-common/conio/gotoxy.s @@ -8,37 +8,37 @@ ; void gotoy (unsigned char y); ; void gotoxy (unsigned char x, unsigned char y); - .export _gotox, _gotoy, _gotoxy, fixcursor - .import popa - .importzp cursor_x, cursor_y, cursor_c, cursor_r + .export _gotox, _gotoy, _gotoxy, fixcursor + .import popa + .importzp cursor_x, cursor_y, cursor_c, cursor_r - .include "jumptab.inc" + .include "jumptab.inc" _gotox: - sta cursor_c - jmp fixcursor + sta cursor_c + jmp fixcursor _gotoy: - sta cursor_r - jmp fixcursor + sta cursor_r + jmp fixcursor _gotoxy: - sta cursor_r - jsr popa - sta cursor_c + sta cursor_r + jsr popa + sta cursor_c ; convert 8x8 x/y coordinates to GEOS hires fixcursor: - lda cursor_c - sta cursor_x - lda #0 - sta cursor_x+1 - ldx #cursor_x - ldy #3 - jsr DShiftLeft - lda cursor_r - asl a - asl a - asl a - sta cursor_y - rts + lda cursor_c + sta cursor_x + lda #0 + sta cursor_x+1 + ldx #cursor_x + ldy #3 + jsr DShiftLeft + lda cursor_r + asl a + asl a + asl a + sta cursor_y + rts diff --git a/libsrc/geos-common/conio/kbhit.s b/libsrc/geos-common/conio/kbhit.s index d5b826ecc..e93d8cc21 100644 --- a/libsrc/geos-common/conio/kbhit.s +++ b/libsrc/geos-common/conio/kbhit.s @@ -5,14 +5,14 @@ ; unsigned char kbhit (void); - .export _kbhit + .export _kbhit - .include "geossym.inc" + .include "geossym.inc" _kbhit: - ldx #0 ; High byte of result - lda pressFlag - rol ; Bit 7 is new key flag - txa ; A = 0 - rol - rts + ldx #0 ; High byte of result + lda pressFlag + rol ; Bit 7 is new key flag + txa ; A = 0 + rol + rts diff --git a/libsrc/geos-common/conio/where.s b/libsrc/geos-common/conio/where.s index 488b72de0..f6a06dd94 100644 --- a/libsrc/geos-common/conio/where.s +++ b/libsrc/geos-common/conio/where.s @@ -8,15 +8,15 @@ ; unsigned char wherex (void); ; unsigned char wherey (void); - .export _wherex, _wherey - .importzp cursor_c, cursor_r + .export _wherex, _wherey + .importzp cursor_c, cursor_r _wherex: - lda cursor_c - ldx #0 - rts + lda cursor_c + ldx #0 + rts _wherey: - lda cursor_r - ldx #0 - rts + lda cursor_r + ldx #0 + rts diff --git a/libsrc/geos-common/const.inc b/libsrc/geos-common/const.inc index a09162b43..c0294e01d 100644 --- a/libsrc/geos-common/const.inc +++ b/libsrc/geos-common/const.inc @@ -3,439 +3,439 @@ ;reassembled by Maciej 'YTM/Elysium' Witkowiak ;4-2-99, 18-3-99 -NULL = 0 -FALSE = NULL -TRUE = $ff +NULL = 0 +FALSE = NULL +TRUE = $ff -MOUSE_SPRNUM = 0 +MOUSE_SPRNUM = 0 -DISK_DRV_LGH = $0d80 +DISK_DRV_LGH = $0d80 ; ;filetypes -; GEOS -NOT_GEOS = 0 -BASIC = 1 -ASSEMBLY = 2 -DATA = 3 -SYSTEM = 4 -DESK_ACC = 5 -APPLICATION = 6 -APPL_DATA = 7 -FONT = 8 -PRINTER = 9 -INPUT_DEVICE = 10 -DISK_DEVICE = 11 -SYSTEM_BOOT = 12 -TEMPORARY = 13 -AUTO_EXEC = 14 -INPUT_128 = 15 -NUMFILETYPES = 16 -; structure -SEQUENTIAL = 0 -VLIR = 1 -; DOS -DEL = 0 -SEQ = 1 -PRG = 2 -USR = 3 -REL = 4 -CBM = 5 +; GEOS +NOT_GEOS = 0 +BASIC = 1 +ASSEMBLY = 2 +DATA = 3 +SYSTEM = 4 +DESK_ACC = 5 +APPLICATION = 6 +APPL_DATA = 7 +FONT = 8 +PRINTER = 9 +INPUT_DEVICE = 10 +DISK_DEVICE = 11 +SYSTEM_BOOT = 12 +TEMPORARY = 13 +AUTO_EXEC = 14 +INPUT_128 = 15 +NUMFILETYPES = 16 +; structure +SEQUENTIAL = 0 +VLIR = 1 +; DOS +DEL = 0 +SEQ = 1 +PRG = 2 +USR = 3 +REL = 4 +CBM = 5 ;drivetypes -DRV_NULL = 0 -DRV_1541 = 1 -DRV_1571 = 2 -DRV_1581 = 3 -DRV_NETWORK = 15 +DRV_NULL = 0 +DRV_1541 = 1 +DRV_1571 = 2 +DRV_1581 = 3 +DRV_NETWORK = 15 ;various disk -REL_FILE_NUM = 9 -CMND_FILE_NUM = 15 -MAX_CMND_STR = 32 -DIR_1581_TRACK = 40 -DIR_ACC_CHAN = 13 -DIR_TRACK = 18 -N_TRACKS = 35 -DK_NM_ID_LEN = 18 -TRACK = 9 -SECTOR = 12 -TOTAL_BLOCKS = 664 +REL_FILE_NUM = 9 +CMND_FILE_NUM = 15 +MAX_CMND_STR = 32 +DIR_1581_TRACK = 40 +DIR_ACC_CHAN = 13 +DIR_TRACK = 18 +N_TRACKS = 35 +DK_NM_ID_LEN = 18 +TRACK = 9 +SECTOR = 12 +TOTAL_BLOCKS = 664 ;colours -BLACK = 0 -WHITE = 1 -RED = 2 -CYAN = 3 -PURPLE = 4 -GREEN = 5 -BLUE = 6 -YELLOW = 7 -ORANGE = 8 -BROWN = 9 -LTRED = 10 -DKGREY = 11 -GREY = 12 -MEDGREY = 12 -LTGREEN = 13 -LTBLUE = 14 -LTGREY = 15 +BLACK = 0 +WHITE = 1 +RED = 2 +CYAN = 3 +PURPLE = 4 +GREEN = 5 +BLUE = 6 +YELLOW = 7 +ORANGE = 8 +BROWN = 9 +LTRED = 10 +DKGREY = 11 +GREY = 12 +MEDGREY = 12 +LTGREEN = 13 +LTBLUE = 14 +LTGREY = 15 ;vic memory banks -GRBANK0 = %11 -GRBANK1 = %10 -GRBANK2 = %01 -GRBANK3 = %00 +GRBANK0 = %11 +GRBANK1 = %10 +GRBANK2 = %01 +GRBANK3 = %00 ;screen -VIC_X_POS_OFF = 24 -VIC_Y_POS_OFF = 50 -SC_BYTE_WIDTH = 40 +VIC_X_POS_OFF = 24 +VIC_Y_POS_OFF = 50 +SC_BYTE_WIDTH = 40 .ifdef __GEOS_CBM__ -SC_PIX_HEIGHT = 200 -SC_PIX_WIDTH = 320 +SC_PIX_HEIGHT = 200 +SC_PIX_WIDTH = 320 .else -SC_PIX_HEIGHT = 192 -SC_PIX_WIDTH = 560 +SC_PIX_HEIGHT = 192 +SC_PIX_WIDTH = 560 .endif -SC_SIZE = 8000 +SC_SIZE = 8000 ;128 screen size constants -SCREENBYTEWIDTH = 80 -SCREENPIXELWIDTH = 640 +SCREENBYTEWIDTH = 80 +SCREENPIXELWIDTH = 640 ;control characters -EOF = 0 -BACKSPACE = 8 -FORWARDSPACE = 9 -TAB = 9 -LF = 10 -HOME = 11 -PAGE_BREAK = 12 -UPLINE = 12 -CR = 13 -ULINEON = 14 -ULINEOFF = 15 -ESC_GRAPHICS = 16 -ESC_RULER = 17 -REV_ON = 18 -REV_OFF = 19 -GOTOX = 20 -GOTOY = 21 -GOTOXY = 22 -NEWCARDSET = 23 -BOLDON = 24 -ITALICON = 25 -OUTLINEON = 26 -PLAINTEXT = 27 +EOF = 0 +BACKSPACE = 8 +FORWARDSPACE = 9 +TAB = 9 +LF = 10 +HOME = 11 +PAGE_BREAK = 12 +UPLINE = 12 +CR = 13 +ULINEON = 14 +ULINEOFF = 15 +ESC_GRAPHICS = 16 +ESC_RULER = 17 +REV_ON = 18 +REV_OFF = 19 +GOTOX = 20 +GOTOY = 21 +GOTOXY = 22 +NEWCARDSET = 23 +BOLDON = 24 +ITALICON = 25 +OUTLINEON = 26 +PLAINTEXT = 27 ;keyboard -KEY_F1 = 1 -KEY_F2 = 2 -KEY_F3 = 3 -KEY_F4 = 4 -KEY_F5 = 5 -KEY_F6 = 6 -KEY_NOSCRL = 7 -KEY_ENTER = 11 -KEY_F7 = 14 -KEY_F8 = 15 -KEY_UP = 16 -KEY_DOWN = 17 -KEY_HOME = 18 -KEY_CLEAR = 19 -KEY_LARROW = 20 -KEY_UPARROR = 21 -KEY_STOP = 22 -KEY_RUN = 23 -KEY_BPS = 24 -KEY_HELP = 25 -KEY_ALT = 26 -KEY_ESC = 27 -KEY_INSERT = 28 -KEY_DELETE = 29 -KEY_RIGHT = 30 -KEY_INVALID = 31 -KEY_LEFT = BACKSPACE +KEY_F1 = 1 +KEY_F2 = 2 +KEY_F3 = 3 +KEY_F4 = 4 +KEY_F5 = 5 +KEY_F6 = 6 +KEY_NOSCRL = 7 +KEY_ENTER = 11 +KEY_F7 = 14 +KEY_F8 = 15 +KEY_UP = 16 +KEY_DOWN = 17 +KEY_HOME = 18 +KEY_CLEAR = 19 +KEY_LARROW = 20 +KEY_UPARROR = 21 +KEY_STOP = 22 +KEY_RUN = 23 +KEY_BPS = 24 +KEY_HELP = 25 +KEY_ALT = 26 +KEY_ESC = 27 +KEY_INSERT = 28 +KEY_DELETE = 29 +KEY_RIGHT = 30 +KEY_INVALID = 31 +KEY_LEFT = BACKSPACE ;DialogBox -; icons -OK = 1 -CANCEL = 2 -YES = 3 -NO = 4 -OPEN = 5 -DISK = 6 -; commands -DBTXTSTR = 11 -DBVARSTR = 12 -DBGETSTRING = 13 -DBSYSOPV = 14 -DBGRPHSTR = 15 -DBGETFILES = 16 -DBOPVEC = 17 -DBUSRICON = 18 -DB_USR_ROUT = 19 -; tabulation in standard window -DBI_X_0 = 1 -DBI_X_1 = 9 -DBI_X_2 = 17 -DBI_Y_0 = 8 -DBI_Y_1 = 40 -DBI_Y_2 = 72 -; standard window -SET_DB_POS = 0 -DEF_DB_POS = $80 -DEF_DB_TOP = 32 -DEF_DB_BOT = 127 -DEF_DB_LEFT = 64 -DEF_DB_RIGHT = 255 -; text tabulation -TXT_LN_1_Y = 16 -TXT_LN_2_Y = 32 -TXT_LN_3_Y = 48 -TXT_LN_4_Y = 64 -TXT_LN_5_Y = 80 -TXT_LN_X = 16 -; ??? -SYSDBI_HEIGHT = 16 -SYSDBI_WIDTH = 6 +; icons +OK = 1 +CANCEL = 2 +YES = 3 +NO = 4 +OPEN = 5 +DISK = 6 +; commands +DBTXTSTR = 11 +DBVARSTR = 12 +DBGETSTRING = 13 +DBSYSOPV = 14 +DBGRPHSTR = 15 +DBGETFILES = 16 +DBOPVEC = 17 +DBUSRICON = 18 +DB_USR_ROUT = 19 +; tabulation in standard window +DBI_X_0 = 1 +DBI_X_1 = 9 +DBI_X_2 = 17 +DBI_Y_0 = 8 +DBI_Y_1 = 40 +DBI_Y_2 = 72 +; standard window +SET_DB_POS = 0 +DEF_DB_POS = $80 +DEF_DB_TOP = 32 +DEF_DB_BOT = 127 +DEF_DB_LEFT = 64 +DEF_DB_RIGHT = 255 +; text tabulation +TXT_LN_1_Y = 16 +TXT_LN_2_Y = 32 +TXT_LN_3_Y = 48 +TXT_LN_4_Y = 64 +TXT_LN_5_Y = 80 +TXT_LN_X = 16 +; ??? +SYSDBI_HEIGHT = 16 +SYSDBI_WIDTH = 6 ;GraphicsString - commands -MOVEPENTO = 1 -LINETO = 2 -RECTANGLETO = 3 -NEWPATTERN = 5 -ESC_PUTSTRING = 6 -FRAME_RECTO = 7 -PEN_X_DELTA = 8 -PEN_Y_DELTA = 9 -PEN_XY_DELTA = 10 +MOVEPENTO = 1 +LINETO = 2 +RECTANGLETO = 3 +NEWPATTERN = 5 +ESC_PUTSTRING = 6 +FRAME_RECTO = 7 +PEN_X_DELTA = 8 +PEN_Y_DELTA = 9 +PEN_XY_DELTA = 10 ;DoMenu - menutypes -MENU_ACTION = $00 -DYN_SUB_MENU = $40 -SUB_MENU = $80 -HORIZONTAL = %00000000 -VERTICAL = %10000000 +MENU_ACTION = $00 +DYN_SUB_MENU = $40 +SUB_MENU = $80 +HORIZONTAL = %00000000 +VERTICAL = %10000000 ;Errors -ANY_FAULT = %11110000 -NO_BLOCKS = 1 -INV_TRACK = 2 -INSUFF_SPACE = 3 -FULL_DIRECTORY = 4 -FILE_NOT_FOUND = 5 -BAD_BAM = 6 -UNOPENED_VLIR = 7 -INV_RECORD = 8 -OUT_OF_RECORDS = 9 -STRUCT_MISMAT = 10 -BFR_OVERFLOW = 11 -CANCEL_ERR = 12 -DEV_NOT_FOUND = 13 -INCOMPATIBLE = 14 -HDR_NOT_THERE = $20 -NO_SYNC = $21 -DBLK_NOT_THERE = $22 -DAT_CHKSUM_ERR = $23 -WR_VER_ERR = $25 -WR_PR_ON = $26 -HDR_CHKSUM_ERR = $27 -DSK_ID_MISMAT = $29 -BYTE_DEC_ERR = $2e -DOS_MISMATCH = $73 +ANY_FAULT = %11110000 +NO_BLOCKS = 1 +INV_TRACK = 2 +INSUFF_SPACE = 3 +FULL_DIRECTORY = 4 +FILE_NOT_FOUND = 5 +BAD_BAM = 6 +UNOPENED_VLIR = 7 +INV_RECORD = 8 +OUT_OF_RECORDS = 9 +STRUCT_MISMAT = 10 +BFR_OVERFLOW = 11 +CANCEL_ERR = 12 +DEV_NOT_FOUND = 13 +INCOMPATIBLE = 14 +HDR_NOT_THERE = $20 +NO_SYNC = $21 +DBLK_NOT_THERE = $22 +DAT_CHKSUM_ERR = $23 +WR_VER_ERR = $25 +WR_PR_ON = $26 +HDR_CHKSUM_ERR = $27 +DSK_ID_MISMAT = $29 +BYTE_DEC_ERR = $2e +DOS_MISMATCH = $73 ;Offsets -; ??? -OFF_INDEX_PTR = 1 -; icons -OFF_NM_ICNS = 0 -OFF_IC_XMOUSE = 1 -OFF_IC_YMOUSE = 3 -OFF_PIC_ICON = 0 -OFF_X_ICON_POS = 2 -OFF_Y_ICON_POS = 3 -OFF_WDTH_ICON = 4 -OFF_HEIGHT_ICON = 5 -OFF_SRV_RT_ICON = 6 -OFF_NX_ICON = 8 -; menu -OFF_MY_TOP = 0 -OFF_MY_BOT = 1 -OFF_MX_LEFT = 2 -OFF_MX_RIGHT = 4 -OFF_NUM_M_ITEMS = 6 -OFF_1ST_M_ITEM = 7 -; dialog box -OFF_DB_FORM = 0 -OFF_DB_TOP = 1 -OFF_DB_BOT = 2 -OFF_DB_LEFT = 3 -OFF_DB_RIGHT = 5 -OFF_DB_1STCMD = 7 -; directory -; disk header -OFF_TO_BAM = 4 -OFF_DISK_NAME = 144 -OFF_GS_DTYPE = 189 -OFF_OP_TR_SC = 171 -OFF_GS_ID = 173 -; dir entry +; ??? +OFF_INDEX_PTR = 1 +; icons +OFF_NM_ICNS = 0 +OFF_IC_XMOUSE = 1 +OFF_IC_YMOUSE = 3 +OFF_PIC_ICON = 0 +OFF_X_ICON_POS = 2 +OFF_Y_ICON_POS = 3 +OFF_WDTH_ICON = 4 +OFF_HEIGHT_ICON = 5 +OFF_SRV_RT_ICON = 6 +OFF_NX_ICON = 8 +; menu +OFF_MY_TOP = 0 +OFF_MY_BOT = 1 +OFF_MX_LEFT = 2 +OFF_MX_RIGHT = 4 +OFF_NUM_M_ITEMS = 6 +OFF_1ST_M_ITEM = 7 +; dialog box +OFF_DB_FORM = 0 +OFF_DB_TOP = 1 +OFF_DB_BOT = 2 +OFF_DB_LEFT = 3 +OFF_DB_RIGHT = 5 +OFF_DB_1STCMD = 7 +; directory +; disk header +OFF_TO_BAM = 4 +OFF_DISK_NAME = 144 +OFF_GS_DTYPE = 189 +OFF_OP_TR_SC = 171 +OFF_GS_ID = 173 +; dir entry .ifdef __GEOS_CBM__ -FRST_FILE_ENTRY = 2 -OFF_CFILE_TYPE = 0 -OFF_DE_TR_SC = 1 -OFF_FNAME = 3 -OFF_GHDR_PTR = 19 -OFF_GSTRUC_TYPE = 21 -OFF_GFILE_TYPE = 22 -OFF_YEAR = 23 -OFF_SIZE = 28 -OFF_NXT_FILE = 32 +FRST_FILE_ENTRY = 2 +OFF_CFILE_TYPE = 0 +OFF_DE_TR_SC = 1 +OFF_FNAME = 3 +OFF_GHDR_PTR = 19 +OFF_GSTRUC_TYPE = 21 +OFF_GFILE_TYPE = 22 +OFF_YEAR = 23 +OFF_SIZE = 28 +OFF_NXT_FILE = 32 .else -FRST_FILE_ENTRY = 43 -OFF_GSTRUC_TYPE = 0 -OFF_FNAME = 1 -OFF_GFILE_TYPE = 16 -OFF_DE_TR_SC = 17 -OFF_SIZE = 21 -OFF_YEAR = 25 -OFF_GHDR_PTR = 31 -OFF_NXT_FILE = 39 +FRST_FILE_ENTRY = 43 +OFF_GSTRUC_TYPE = 0 +OFF_FNAME = 1 +OFF_GFILE_TYPE = 16 +OFF_DE_TR_SC = 17 +OFF_SIZE = 21 +OFF_YEAR = 25 +OFF_GHDR_PTR = 31 +OFF_NXT_FILE = 39 .endif -; file header -O_GHIC_WIDTH = 2 -O_GHIC_HEIGHT = 3 -O_GHIC_PIC = 4 -O_GHCMDR_TYPE = 68 -O_GHGEOS_TYPE = 69 -O_GHSTR_TYPE = 70 -O_GHST_ADDR = 71 -O_GHEND_ADDR = 73 -O_GHST_VEC = 75 -O_GHFNAME = 77 -O_128_FLAGS = 96 -O_GH_AUTHOR = 97 -O_GHP_DISK = 97 -O_GHP_FNAME = 117 -O_GHINFO_TXT = $a0 +; file header +O_GHIC_WIDTH = 2 +O_GHIC_HEIGHT = 3 +O_GHIC_PIC = 4 +O_GHCMDR_TYPE = 68 +O_GHGEOS_TYPE = 69 +O_GHSTR_TYPE = 70 +O_GHST_ADDR = 71 +O_GHEND_ADDR = 73 +O_GHST_VEC = 75 +O_GHFNAME = 77 +O_128_FLAGS = 96 +O_GH_AUTHOR = 97 +O_GHP_DISK = 97 +O_GHP_FNAME = 117 +O_GHINFO_TXT = $a0 ; values for CPU_DATA - C64 memory config -RAM_64K = $30 ;64K RAM -IO_IN = $35 ;60K RAM, 4K I/O space in -KRNL_IO_IN = $36 ;kernal and I/O mapped into memory -KRNL_BAS_IO_IN = $37 ;kernal, I/O and basic mapped into memory +RAM_64K = $30 ;64K RAM +IO_IN = $35 ;60K RAM, 4K I/O space in +KRNL_IO_IN = $36 ;kernal and I/O mapped into memory +KRNL_BAS_IO_IN = $37 ;kernal, I/O and basic mapped into memory ;values for config - C128 mmu -CIOIN = $7E ;60K RAM, 4K I/O space in -CRAM64K = $7F ;64K RAM -CKRNLBASIOIN = $40 ;kernal, I/O and basic ROM's mapped into memory -CKRNLIOIN = $4E ;Kernal ROM and I/O space mapped in +CIOIN = $7E ;60K RAM, 4K I/O space in +CRAM64K = $7F ;64K RAM +CKRNLBASIOIN = $40 ;kernal, I/O and basic ROM's mapped into memory +CKRNLIOIN = $4E ;Kernal ROM and I/O space mapped in ;values of faultData - pointer position vs. mouseTop/Bottom/Left/Right -; bit numbers -OFFTOP_BIT = 7 -OFFBOTTOM_BIT = 6 -OFFLEFT_BIT = 5 -OFFRIGHT_BIT = 4 -OFFMENU_BIT = 3 -; masks -SET_OFFTOP = %10000000 -SET_OFFBOTTOM = %01000000 -SET_OFFLEFT = %00100000 -SET_OFFRIGHT = %00010000 -SET_OFFMENU = %00001000 +; bit numbers +OFFTOP_BIT = 7 +OFFBOTTOM_BIT = 6 +OFFLEFT_BIT = 5 +OFFRIGHT_BIT = 4 +OFFMENU_BIT = 3 +; masks +SET_OFFTOP = %10000000 +SET_OFFBOTTOM = %01000000 +SET_OFFLEFT = %00100000 +SET_OFFRIGHT = %00010000 +SET_OFFMENU = %00001000 ;values of currentMode -; bit numbers -UNDERLINE_BIT = 7 -BOLD_BIT = 6 -REVERSE_BIT = 5 -ITALIC_BIT = 4 -OUTLINE_BIT = 3 -SUPERSCRIPT_BIT = 2 -SUBSCRIPT_BIT = 1 -; masks -SET_UNDERLINE = %10000000 -SET_BOLD = %01000000 -SET_REVERSE = %00100000 -SET_ITALIC = %00010000 -SET_OUTLINE = %00001000 -SET_SUPERSCRIPT = %00000100 -SET_SUBSCRIPT = %00000010 -SET_PLAINTEXT = %00000000 +; bit numbers +UNDERLINE_BIT = 7 +BOLD_BIT = 6 +REVERSE_BIT = 5 +ITALIC_BIT = 4 +OUTLINE_BIT = 3 +SUPERSCRIPT_BIT = 2 +SUBSCRIPT_BIT = 1 +; masks +SET_UNDERLINE = %10000000 +SET_BOLD = %01000000 +SET_REVERSE = %00100000 +SET_ITALIC = %00010000 +SET_OUTLINE = %00001000 +SET_SUPERSCRIPT = %00000100 +SET_SUBSCRIPT = %00000010 +SET_PLAINTEXT = %00000000 ;Process control variable -; bit numbers -RUNABLE_BIT = 7 -BLOCKED_BIT = 6 -FROZEN_BIT = 5 -NOTIMER_BIT = 4 -; masks -SET_RUNABLE = %10000000 -SET_BLOCKED = %01000000 -SET_FROZEN = %00100000 -SET_NOTIMER = %00010000 +; bit numbers +RUNABLE_BIT = 7 +BLOCKED_BIT = 6 +FROZEN_BIT = 5 +NOTIMER_BIT = 4 +; masks +SET_RUNABLE = %10000000 +SET_BLOCKED = %01000000 +SET_FROZEN = %00100000 +SET_NOTIMER = %00010000 ;mouseOn -; bit numbers -MOUSEON_BIT = 7 -MENUON_BIT = 6 -ICONSON_BIT = 5 -; masks -SET_MSE_ON = %10000000 -SET_MENUON = %01000000 -SET_ICONSON = %00100000 +; bit numbers +MOUSEON_BIT = 7 +MENUON_BIT = 6 +ICONSON_BIT = 5 +; masks +SET_MSE_ON = %10000000 +SET_MENUON = %01000000 +SET_ICONSON = %00100000 ;pressFlag -; bit numbers -KEYPRESS_BIT = 7 -INPUT_BIT = 6 -MOUSE_BIT = 5 -; masks -SET_KEYPRESS = %10000000 -SET_INPUTCHG = %01000000 -SET_MOUSE = %00100000 +; bit numbers +KEYPRESS_BIT = 7 +INPUT_BIT = 6 +MOUSE_BIT = 5 +; masks +SET_KEYPRESS = %10000000 +SET_INPUTCHG = %01000000 +SET_MOUSE = %00100000 ;dispBufferOn -ST_WRGS_FORE = $20 -ST_WR_BACK = $40 -ST_WR_FORE = $80 +ST_WRGS_FORE = $20 +ST_WR_BACK = $40 +ST_WR_FORE = $80 ;alarmSetFlag -ALARMMASK = %00000100 +ALARMMASK = %00000100 ;PutDecimal ;leading zeroes -SET_NOSURPRESS = %00000000 -SET_SURPRESS = %01000000 +SET_NOSURPRESS = %00000000 +SET_SURPRESS = %01000000 ;justification -SET_RIGHTJUST = %00000000 -SET_LEFTJUST = %10000000 +SET_RIGHTJUST = %00000000 +SET_LEFTJUST = %10000000 ;icons, menus status flags -ST_FLASH = $80 -ST_INVERT = $40 -ST_LD_AT_ADDR = $01 -ST_LD_DATA = $80 -ST_PR_DATA = $40 -ST_WR_PR = $40 +ST_FLASH = $80 +ST_INVERT = $40 +ST_LD_AT_ADDR = $01 +ST_LD_DATA = $80 +ST_PR_DATA = $40 +ST_WR_PR = $40 ;??? -ADD1_W = $2000 -DOUBLE_B = $80 -DOUBLE_W = $8000 +ADD1_W = $2000 +DOUBLE_B = $80 +DOUBLE_W = $8000 -CLR_SAVE = %01000000 -CONSTRAINED = %01000000 -UN_CONSTRAINED = %00000000 -FG_SAVE = %10000000 +CLR_SAVE = %01000000 +CONSTRAINED = %01000000 +UN_CONSTRAINED = %00000000 +FG_SAVE = %10000000 -FUTURE1 = 7 -FUTURE2 = 8 -FUTURE3 = 9 -FUTURE4 = 10 -USELAST = 127 -SHORTCUT = 128 +FUTURE1 = 7 +FUTURE2 = 8 +FUTURE3 = 9 +FUTURE4 = 10 +USELAST = 127 +SHORTCUT = 128 diff --git a/libsrc/geos-common/disk/blkalloc.s b/libsrc/geos-common/disk/blkalloc.s index 53c99d0ed..6bfcb312c 100644 --- a/libsrc/geos-common/disk/blkalloc.s +++ b/libsrc/geos-common/disk/blkalloc.s @@ -5,18 +5,18 @@ ; char BlkAlloc (struct tr_se output[], int length); - .import popax, setoserror - .export _BlkAlloc + .import popax, setoserror + .export _BlkAlloc - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _BlkAlloc: - sta r2L - stx r2H - jsr popax - sta r4L - stx r4H - jsr BlkAlloc - jmp setoserror + sta r2L + stx r2H + jsr popax + sta r4L + stx r4H + jsr BlkAlloc + jmp setoserror diff --git a/libsrc/geos-common/disk/calcblksfree.s b/libsrc/geos-common/disk/calcblksfree.s index bd60a7d94..520c8ca61 100644 --- a/libsrc/geos-common/disk/calcblksfree.s +++ b/libsrc/geos-common/disk/calcblksfree.s @@ -5,16 +5,16 @@ ; int CalcBlksFree (void); - .import __oserror - .export _CalcBlksFree + .import __oserror + .export _CalcBlksFree - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _CalcBlksFree: - jsr CalcBlksFree - stx __oserror - lda r4L - ldx r4H - rts + jsr CalcBlksFree + stx __oserror + lda r4L + ldx r4H + rts diff --git a/libsrc/geos-common/disk/freeblock.s b/libsrc/geos-common/disk/freeblock.s index fd7017477..cd8b08d2f 100644 --- a/libsrc/geos-common/disk/freeblock.s +++ b/libsrc/geos-common/disk/freeblock.s @@ -5,16 +5,16 @@ ; char FreeBlock (struct tr_se *TS); - .import gettrse, setoserror - .export _FreeBlock + .import gettrse, setoserror + .export _FreeBlock - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _FreeBlock: - jsr gettrse - sta r6L - stx r6H - jsr FreeBlock - jmp setoserror + jsr gettrse + sta r6L + stx r6H + jsr FreeBlock + jmp setoserror diff --git a/libsrc/geos-common/disk/getblock.s b/libsrc/geos-common/disk/getblock.s index 342b2f1b1..cef7ece6f 100644 --- a/libsrc/geos-common/disk/getblock.s +++ b/libsrc/geos-common/disk/getblock.s @@ -5,20 +5,20 @@ ; char GetBlock (struct tr_se *myTS, char *buffer); - .import popax, setoserror - .import gettrse - .export _GetBlock + .import popax, setoserror + .import gettrse + .export _GetBlock - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _GetBlock: - sta r4L - stx r4H - jsr popax - jsr gettrse - sta r1L - stx r1H - jsr GetBlock - jmp setoserror + sta r4L + stx r4H + jsr popax + jsr gettrse + sta r1L + stx r1H + jsr GetBlock + jmp setoserror diff --git a/libsrc/geos-common/disk/getdirhead.s b/libsrc/geos-common/disk/getdirhead.s index 1d014bf44..ccd8b45c4 100644 --- a/libsrc/geos-common/disk/getdirhead.s +++ b/libsrc/geos-common/disk/getdirhead.s @@ -5,12 +5,12 @@ ; char GetDirHead (void); - .import setoserror - .export _GetDirHead + .import setoserror + .export _GetDirHead - .include "jumptab.inc" - .include "diskdrv.inc" + .include "jumptab.inc" + .include "diskdrv.inc" _GetDirHead: - jsr GetDirHead - jmp setoserror + jsr GetDirHead + jmp setoserror diff --git a/libsrc/geos-common/disk/getptrcurdknm.s b/libsrc/geos-common/disk/getptrcurdknm.s index d81490e21..7a99225ef 100644 --- a/libsrc/geos-common/disk/getptrcurdknm.s +++ b/libsrc/geos-common/disk/getptrcurdknm.s @@ -6,33 +6,33 @@ ; void GetPtrCurDkNm (char *curName); ; (fills curName[17] with current disk's name) - .importzp ptr4, ptr3 - .import __oserror - .export _GetPtrCurDkNm + .importzp ptr4, ptr3 + .import __oserror + .export _GetPtrCurDkNm - .include "jumptab.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "geossym.inc" + _GetPtrCurDkNm: - sta ptr3 - stx ptr3+1 - ldx #ptr4 - jsr GetPtrCurDkNm - ldy #0 - txa - bne fin -namelp: lda (ptr4),y + sta ptr3 + stx ptr3+1 + ldx #ptr4 + jsr GetPtrCurDkNm + ldy #0 + txa + bne fin +namelp: lda (ptr4),y .ifdef __GEOS_CBM__ - cmp #$a0 + cmp #$a0 .else - cmp #0 + cmp #0 .endif - beq fin - sta (ptr3),y - iny - cpy #16 - bne namelp -fin: lda #0 - sta (ptr3),y - stx __oserror - rts + beq fin + sta (ptr3),y + iny + cpy #16 + bne namelp +fin: lda #0 + sta (ptr3),y + stx __oserror + rts diff --git a/libsrc/geos-common/disk/gettrse.s b/libsrc/geos-common/disk/gettrse.s index bcae55c9b..8167d6e85 100644 --- a/libsrc/geos-common/disk/gettrse.s +++ b/libsrc/geos-common/disk/gettrse.s @@ -3,15 +3,15 @@ ; ; 29.1.00 - .export gettrse - .importzp ptr4 + .export gettrse + .importzp ptr4 gettrse: - sta ptr4 - stx ptr4+1 - ldy #1 - lda (ptr4),y - tax - dey - lda (ptr4),y - rts + sta ptr4 + stx ptr4+1 + ldy #1 + lda (ptr4),y + tax + dey + lda (ptr4),y + rts diff --git a/libsrc/geos-common/disk/nxtblkalloc.s b/libsrc/geos-common/disk/nxtblkalloc.s index c5dcd0ab2..7427f3de0 100644 --- a/libsrc/geos-common/disk/nxtblkalloc.s +++ b/libsrc/geos-common/disk/nxtblkalloc.s @@ -5,24 +5,24 @@ ; char NxtBlkAlloc (struct tr_se *startTS, struct tr_se output[], int length ); - .import popax, setoserror - .import gettrse - .importzp ptr4 - .export _NxtBlkAlloc + .import popax, setoserror + .import gettrse + .importzp ptr4 + .export _NxtBlkAlloc - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _NxtBlkAlloc: - sta r2L - stx r2H - jsr popax - sta r4L - stx r4H - jsr popax - jsr gettrse - sta r3L - stx r3H - jsr NxtBlkAlloc - jmp setoserror + sta r2L + stx r2H + jsr popax + sta r4L + stx r4H + jsr popax + jsr gettrse + sta r3L + stx r3H + jsr NxtBlkAlloc + jmp setoserror diff --git a/libsrc/geos-common/disk/opendisk.s b/libsrc/geos-common/disk/opendisk.s index e3ecb8d12..66bd24d30 100644 --- a/libsrc/geos-common/disk/opendisk.s +++ b/libsrc/geos-common/disk/opendisk.s @@ -5,12 +5,12 @@ ; char OpenDisk (void); - .import setoserror - .export _OpenDisk + .import setoserror + .export _OpenDisk - .include "jumptab.inc" - .include "diskdrv.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + _OpenDisk: - jsr OpenDisk - jmp setoserror + jsr OpenDisk + jmp setoserror diff --git a/libsrc/geos-common/disk/putblock.s b/libsrc/geos-common/disk/putblock.s index 278fbaaef..df1af9f19 100644 --- a/libsrc/geos-common/disk/putblock.s +++ b/libsrc/geos-common/disk/putblock.s @@ -5,20 +5,20 @@ ; char PutBlock (struct tr_se *myTS, char *buffer); - .import popax, setoserror - .import gettrse - .export _PutBlock + .import popax, setoserror + .import gettrse + .export _PutBlock - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _PutBlock: - sta r4L - stx r4H - jsr popax - jsr gettrse - sta r1L - stx r1H - jsr PutBlock - jmp setoserror + sta r4L + stx r4H + jsr popax + jsr gettrse + sta r1L + stx r1H + jsr PutBlock + jmp setoserror diff --git a/libsrc/geos-common/disk/putdirhead.s b/libsrc/geos-common/disk/putdirhead.s index 039766abc..411b64307 100644 --- a/libsrc/geos-common/disk/putdirhead.s +++ b/libsrc/geos-common/disk/putdirhead.s @@ -5,12 +5,12 @@ ; char PutDirHead (void); - .import setoserror - .export _PutDirHead + .import setoserror + .export _PutDirHead - .include "jumptab.inc" - .include "diskdrv.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + _PutDirHead: - jsr PutDirHead - jmp setoserror + jsr PutDirHead + jmp setoserror diff --git a/libsrc/geos-common/disk/setnextfree.s b/libsrc/geos-common/disk/setnextfree.s index aca3802d8..410532cea 100644 --- a/libsrc/geos-common/disk/setnextfree.s +++ b/libsrc/geos-common/disk/setnextfree.s @@ -5,20 +5,20 @@ ; struct tr_se SetNextFree (struct tr_se *startTS); - .import __oserror - .import gettrse - .export _SetNextFree + .import __oserror + .import gettrse + .export _SetNextFree - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _SetNextFree: - jsr gettrse - sta r3L - stx r3H - jsr SetNextFree - stx __oserror - lda r3L - ldx r3H - rts + jsr gettrse + sta r3L + stx r3H + jsr SetNextFree + stx __oserror + lda r3L + ldx r3H + rts diff --git a/libsrc/geos-common/dlgbox/dbget2lines.s b/libsrc/geos-common/dlgbox/dbget2lines.s index bc0d68fae..dd1ad1f87 100644 --- a/libsrc/geos-common/dlgbox/dbget2lines.s +++ b/libsrc/geos-common/dlgbox/dbget2lines.s @@ -3,32 +3,32 @@ ; ; 25.12.99 - .export DB_get2lines - .importzp ptr3,ptr4 - .import popax + .export DB_get2lines + .importzp ptr3,ptr4 + .import popax DB_get2lines: - sta ptr4 ; fetch line 2 - stx ptr4+1 - jsr popax - sta ptr3 ; fetch line 1 - stx ptr3+1 - ldx #ptr3 - jsr checknull - ldx #ptr4 - jmp checknull + sta ptr4 ; fetch line 2 + stx ptr4+1 + jsr popax + sta ptr3 ; fetch line 1 + stx ptr3+1 + ldx #ptr3 + jsr checknull + ldx #ptr4 + jmp checknull checknull: - lda $0,x - ora $1,x - bne cn_end - lda #nullstring - sta $1,x -cn_end: rts + lda $0,x + ora $1,x + bne cn_end + lda #nullstring + sta $1,x +cn_end: rts .rodata nullstring: - .byte 0 + .byte 0 diff --git a/libsrc/geos-common/dlgbox/dlgboxfileselect.s b/libsrc/geos-common/dlgbox/dlgboxfileselect.s index 284285d03..e97e44594 100644 --- a/libsrc/geos-common/dlgbox/dlgboxfileselect.s +++ b/libsrc/geos-common/dlgbox/dlgboxfileselect.s @@ -5,56 +5,56 @@ ; char DlgBoxFileSelect (char *class, char ftype, char *fname); - .export _DlgBoxFileSelect - .import popa, popax - .import _DoDlgBox + .export _DlgBoxFileSelect + .import popa, popax + .import _DoDlgBox - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - .include "geosmac.inc" - .include "const.inc" + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + .include "geosmac.inc" + .include "const.inc" _DlgBoxFileSelect: - sta tmp_r5 - stx tmp_r5+1 - jsr popa - sta tmp_r7L - jsr popax - sta tmp_r10 - stx tmp_r10+1 + sta tmp_r5 + stx tmp_r5+1 + jsr popa + sta tmp_r7L + jsr popax + sta tmp_r10 + stx tmp_r10+1 DB_FS_reload: - MoveW tmp_r5, r5 - MoveW tmp_r10, r10 - MoveB tmp_r7L, r7L + MoveW tmp_r5, r5 + MoveW tmp_r10, r10 + MoveB tmp_r7L, r7L - lda #paramStrFileSelect - jsr _DoDlgBox - cmp #DISK - bne DB_FS_Fin - jsr OpenDisk - txa - beq DB_FS_reload + lda #paramStrFileSelect + jsr _DoDlgBox + cmp #DISK + bne DB_FS_Fin + jsr OpenDisk + txa + beq DB_FS_reload DB_FS_Fin: - rts + rts .rodata paramStrFileSelect: - .byte DEF_DB_POS | 1 - .byte DBGETFILES, 4, 4 - .byte OPEN, DBI_X_2, DBI_Y_0+16 - .byte DISK, DBI_X_2, DBI_Y_0+32+1 - .byte CANCEL, DBI_X_2, DBI_Y_0+64+3 - .byte NULL + .byte DEF_DB_POS | 1 + .byte DBGETFILES, 4, 4 + .byte OPEN, DBI_X_2, DBI_Y_0+16 + .byte DISK, DBI_X_2, DBI_Y_0+32+1 + .byte CANCEL, DBI_X_2, DBI_Y_0+64+3 + .byte NULL .bss tmp_r5: - .res 2 + .res 2 tmp_r7L: - .res 1 + .res 1 tmp_r10: - .res 2 + .res 2 diff --git a/libsrc/geos-common/dlgbox/dlgboxgetstring.s b/libsrc/geos-common/dlgbox/dlgboxgetstring.s index ec26c8433..5366b41fc 100644 --- a/libsrc/geos-common/dlgbox/dlgboxgetstring.s +++ b/libsrc/geos-common/dlgbox/dlgboxgetstring.s @@ -5,33 +5,33 @@ ; char DlgBoxGetString (char *string, char strlen, char *line1,char *line2); - .export _DlgBoxGetString - .import DB_get2lines, _DoDlgBox - .importzp ptr2, ptr3, ptr4 - .import popa, popax + .export _DlgBoxGetString + .import DB_get2lines, _DoDlgBox + .importzp ptr2, ptr3, ptr4 + .import popa, popax - .include "geossym.inc" - .include "const.inc" + .include "geossym.inc" + .include "const.inc" _DlgBoxGetString: - jsr DB_get2lines - jsr popa - sta DB_strlen - jsr popax - sta ptr2 - stx ptr2+1 - lda #paramStrGetString - jmp _DoDlgBox + jsr DB_get2lines + jsr popa + sta DB_strlen + jsr popax + sta ptr2 + stx ptr2+1 + lda #paramStrGetString + jmp _DoDlgBox .data paramStrGetString: - .byte DEF_DB_POS | 1 - .byte DBVARSTR, TXT_LN_X, TXT_LN_1_Y, ptr3 - .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr4 - .byte DBGETSTRING, TXT_LN_X, TXT_LN_3_Y, ptr2 + .byte DEF_DB_POS | 1 + .byte DBVARSTR, TXT_LN_X, TXT_LN_1_Y, ptr3 + .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr4 + .byte DBGETSTRING, TXT_LN_X, TXT_LN_3_Y, ptr2 DB_strlen: - .byte 17 - .byte CANCEL, DBI_X_2, DBI_Y_2 - .byte NULL + .byte 17 + .byte CANCEL, DBI_X_2, DBI_Y_2 + .byte NULL diff --git a/libsrc/geos-common/dlgbox/dlgboxok.s b/libsrc/geos-common/dlgbox/dlgboxok.s index 9ac094c43..124c32c44 100644 --- a/libsrc/geos-common/dlgbox/dlgboxok.s +++ b/libsrc/geos-common/dlgbox/dlgboxok.s @@ -5,24 +5,24 @@ ; char DlgBoxOk (char *line1,char *line2); - .export _DlgBoxOk - .import DB_get2lines, _DoDlgBox - .importzp ptr3, ptr4 + .export _DlgBoxOk + .import DB_get2lines, _DoDlgBox + .importzp ptr3, ptr4 - .include "geossym.inc" - .include "const.inc" + .include "geossym.inc" + .include "const.inc" _DlgBoxOk: - jsr DB_get2lines - lda #paramStrOk - jmp _DoDlgBox + jsr DB_get2lines + lda #paramStrOk + jmp _DoDlgBox .rodata paramStrOk: - .byte DEF_DB_POS | 1 - .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 - .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 - .byte OK, DBI_X_0, DBI_Y_2 - .byte NULL + .byte DEF_DB_POS | 1 + .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 + .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 + .byte OK, DBI_X_0, DBI_Y_2 + .byte NULL diff --git a/libsrc/geos-common/dlgbox/dlgboxokcancel.s b/libsrc/geos-common/dlgbox/dlgboxokcancel.s index e6267e128..ca03b89ff 100644 --- a/libsrc/geos-common/dlgbox/dlgboxokcancel.s +++ b/libsrc/geos-common/dlgbox/dlgboxokcancel.s @@ -5,25 +5,25 @@ ; char DlgBoxOkCancel (char *line1,char *line2); - .export _DlgBoxOkCancel - .import DB_get2lines, _DoDlgBox - .importzp ptr3, ptr4 + .export _DlgBoxOkCancel + .import DB_get2lines, _DoDlgBox + .importzp ptr3, ptr4 - .include "geossym.inc" - .include "const.inc" + .include "geossym.inc" + .include "const.inc" _DlgBoxOkCancel: - jsr DB_get2lines - lda #paramStrOkCancel - jmp _DoDlgBox + jsr DB_get2lines + lda #paramStrOkCancel + jmp _DoDlgBox .rodata paramStrOkCancel: - .byte DEF_DB_POS | 1 - .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 - .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 - .byte OK, DBI_X_0, DBI_Y_2 - .byte CANCEL, DBI_X_2, DBI_Y_2 - .byte NULL + .byte DEF_DB_POS | 1 + .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 + .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 + .byte OK, DBI_X_0, DBI_Y_2 + .byte CANCEL, DBI_X_2, DBI_Y_2 + .byte NULL diff --git a/libsrc/geos-common/dlgbox/dlgboxyesno.s b/libsrc/geos-common/dlgbox/dlgboxyesno.s index f895bb759..624ee6067 100644 --- a/libsrc/geos-common/dlgbox/dlgboxyesno.s +++ b/libsrc/geos-common/dlgbox/dlgboxyesno.s @@ -5,25 +5,25 @@ ; char DlgBoxYesNo (char *line1,char *line2); - .export _DlgBoxYesNo - .import DB_get2lines, _DoDlgBox - .importzp ptr3, ptr4 + .export _DlgBoxYesNo + .import DB_get2lines, _DoDlgBox + .importzp ptr3, ptr4 - .include "geossym.inc" - .include "const.inc" + .include "geossym.inc" + .include "const.inc" _DlgBoxYesNo: - jsr DB_get2lines - lda #paramStrYesNo - jmp _DoDlgBox + jsr DB_get2lines + lda #paramStrYesNo + jmp _DoDlgBox .rodata paramStrYesNo: - .byte DEF_DB_POS | 1 - .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 - .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 - .byte YES, DBI_X_0, DBI_Y_2 - .byte NO, DBI_X_2, DBI_Y_2 - .byte NULL + .byte DEF_DB_POS | 1 + .byte DBVARSTR, TXT_LN_X, TXT_LN_2_Y, ptr3 + .byte DBVARSTR, TXT_LN_X, TXT_LN_3_Y, ptr4 + .byte YES, DBI_X_0, DBI_Y_2 + .byte NO, DBI_X_2, DBI_Y_2 + .byte NULL diff --git a/libsrc/geos-common/dlgbox/dodlgbox.s b/libsrc/geos-common/dlgbox/dodlgbox.s index 4f5a776b9..ca5922f0b 100644 --- a/libsrc/geos-common/dlgbox/dodlgbox.s +++ b/libsrc/geos-common/dlgbox/dodlgbox.s @@ -5,15 +5,15 @@ ; char DoDlgBox (char *myParamString); - .export _DoDlgBox + .export _DoDlgBox - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _DoDlgBox: - sta r0L - stx r0H - jsr DoDlgBox - ldx #0 - lda r0L - rts + sta r0L + stx r0H + jsr DoDlgBox + ldx #0 + lda r0L + rts diff --git a/libsrc/geos-common/dlgbox/messagebox.c b/libsrc/geos-common/dlgbox/messagebox.c index 4fba1570c..a8774c3c0 100644 --- a/libsrc/geos-common/dlgbox/messagebox.c +++ b/libsrc/geos-common/dlgbox/messagebox.c @@ -12,40 +12,40 @@ void _mbprintout(void); static dlgBoxStr _mbdlg_EMPTY = { - DB_DEFPOS(1), - DB_OPVEC(&RstrFrmDialogue), - DB_USRROUT(&_mbprintout), - DB_END, + DB_DEFPOS(1), + DB_OPVEC(&RstrFrmDialogue), + DB_USRROUT(&_mbprintout), + DB_END, }; static dlgBoxStr _mbdlg_OK = { - DB_DEFPOS(1), - DB_USRROUT(&_mbprintout), - DB_ICON(OK, DBI_X_1, DBI_Y_2), - DB_END, + DB_DEFPOS(1), + DB_USRROUT(&_mbprintout), + DB_ICON(OK, DBI_X_1, DBI_Y_2), + DB_END, }; static dlgBoxStr _mbdlg_OKCANCEL = { - DB_DEFPOS(1), - DB_USRROUT(&_mbprintout), - DB_ICON(OK, DBI_X_0, DBI_Y_2), - DB_ICON(CANCEL, DBI_X_2, DBI_Y_2), - DB_END, + DB_DEFPOS(1), + DB_USRROUT(&_mbprintout), + DB_ICON(OK, DBI_X_0, DBI_Y_2), + DB_ICON(CANCEL, DBI_X_2, DBI_Y_2), + DB_END, }; static dlgBoxStr _mbdlg_YESNO = { - DB_DEFPOS(1), - DB_USRROUT(&_mbprintout), - DB_ICON(YES, DBI_X_0, DBI_Y_2), - DB_ICON(NO, DBI_X_2, DBI_Y_2), - DB_END, + DB_DEFPOS(1), + DB_USRROUT(&_mbprintout), + DB_ICON(YES, DBI_X_0, DBI_Y_2), + DB_ICON(NO, DBI_X_2, DBI_Y_2), + DB_END, }; static dlgBoxStr *_mbboxes[] = { - &_mbdlg_EMPTY, - &_mbdlg_OK, - &_mbdlg_OKCANCEL, - &_mbdlg_YESNO + &_mbdlg_EMPTY, + &_mbdlg_OK, + &_mbdlg_OKCANCEL, + &_mbdlg_YESNO }; static char _mbbuffer[256]; @@ -63,13 +63,13 @@ char MessageBox(char mode, const char *format, ...) /* replace LFs by CRs */ buf = &_mbbuffer[0]; while (*buf) { - if (*buf==LF) *buf=CR; - ++buf; + if (*buf==LF) *buf=CR; + ++buf; } /* validate mode */ if (mode>=MB_LAST) - mode = MB_EMPTY; + mode = MB_EMPTY; return DoDlgBox(_mbboxes[mode]); } diff --git a/libsrc/geos-common/dlgbox/rstrfrmdialogue.s b/libsrc/geos-common/dlgbox/rstrfrmdialogue.s index 84bd1b3ec..efee17465 100644 --- a/libsrc/geos-common/dlgbox/rstrfrmdialogue.s +++ b/libsrc/geos-common/dlgbox/rstrfrmdialogue.s @@ -5,8 +5,8 @@ ; char RstrFrmDialogue (void); - .export _RstrFrmDialogue + .export _RstrFrmDialogue - .include "jumptab.inc" - + .include "jumptab.inc" + _RstrFrmDialogue = RstrFrmDialogue diff --git a/libsrc/geos-common/drivers/fio_module.s b/libsrc/geos-common/drivers/fio_module.s index 4d11511c1..b757e6bd8 100644 --- a/libsrc/geos-common/drivers/fio_module.s +++ b/libsrc/geos-common/drivers/fio_module.s @@ -6,89 +6,89 @@ ; ; only ONE opened file at a time, only O_RDONLY flag -; int open (const char* name, int flags, ...); /* May take a mode argument */ +; int open (const char* name, int flags, ...); /* May take a mode argument */ ; int __fastcall__ close (int fd); ; int __fastcall__ read (int fd, void* buf, unsigned count); -FILEDES = 3 ; first free to use file descriptor +FILEDES = 3 ; first free to use file descriptor .importzp ptr1, ptr2, ptr3, tmp1 .import addysp, popax .import __oserror - .import _FindFile, _ReadByte - .export _open, _close, _read + .import _FindFile, _ReadByte + .export _open, _close, _read - .include "geossym.inc" - .include "const.inc" - .include "errno.inc" - .include "fcntl.inc" + .include "geossym.inc" + .include "const.inc" + .include "errno.inc" + .include "fcntl.inc" _open: - cpy #4 ; correct # of arguments (bytes)? - beq @parmok ; parameter count ok - tya ; parm count < 4 shouldn't be needed to be... - sec ; ...checked (it generates a c compiler warning) - sbc #4 - tay - jsr addysp ; fix stack, throw away unused parameters + cpy #4 ; correct # of arguments (bytes)? + beq @parmok ; parameter count ok + tya ; parm count < 4 shouldn't be needed to be... + sec ; ...checked (it generates a c compiler warning) + sbc #4 + tay + jsr addysp ; fix stack, throw away unused parameters ; Parameters ok. Pop the flags and save them into tmp3 @parmok: - jsr popax ; Get flags - sta tmp1 - jsr popax ; Get name - sta ptr1 - stx ptr1+1 - - lda filedesc ; is there a file already open? - bne @alreadyopen - - lda tmp1 ; check open mode - and #(O_RDWR | O_CREAT) - cmp #O_RDONLY ; only O_RDONLY is valid - bne @badmode - - lda ptr1 - ldx ptr1+1 - jsr _FindFile ; try to find the file - tax - bne @oserror - - lda dirEntryBuf + OFF_DE_TR_SC ; tr&se for ReadByte (r1) - sta f_track - lda dirEntryBuf + OFF_DE_TR_SC + 1 - sta f_sector - lda #diskBlkBuf - sta f_buffer+1 - ldx #0 ; offset for ReadByte (r5) - stx f_offset - stx f_offset+1 - lda #0 ; clear errors - sta __oserror - jsr __seterrno - lda #FILEDES ; return fd - sta filedesc - rts + jsr popax ; Get flags + sta tmp1 + jsr popax ; Get name + sta ptr1 + stx ptr1+1 + + lda filedesc ; is there a file already open? + bne @alreadyopen + + lda tmp1 ; check open mode + and #(O_RDWR | O_CREAT) + cmp #O_RDONLY ; only O_RDONLY is valid + bne @badmode + + lda ptr1 + ldx ptr1+1 + jsr _FindFile ; try to find the file + tax + bne @oserror + + lda dirEntryBuf + OFF_DE_TR_SC ; tr&se for ReadByte (r1) + sta f_track + lda dirEntryBuf + OFF_DE_TR_SC + 1 + sta f_sector + lda #diskBlkBuf + sta f_buffer+1 + ldx #0 ; offset for ReadByte (r5) + stx f_offset + stx f_offset+1 + lda #0 ; clear errors + sta __oserror + jsr __seterrno + lda #FILEDES ; return fd + sta filedesc + rts @badmode: - lda #EINVAL ; invalid parameters - invalid open mode - .byte $2c ; skip + lda #EINVAL ; invalid parameters - invalid open mode + .byte $2c ; skip @alreadyopen: - lda #EMFILE ; too many opened files (there can be only one) - jmp __directerrno ; set errno, clear oserror, return -1 + lda #EMFILE ; too many opened files (there can be only one) + jmp __directerrno ; set errno, clear oserror, return -1 @oserror: - jmp __mappederrno ; set platform error code, return -1 + jmp __mappederrno ; set platform error code, return -1 _close: - lda #0 - sta __oserror - jsr __seterrno ; clear errors - lda #0 ; clear fd - sta filedesc - tax - rts + lda #0 + sta __oserror + jsr __seterrno ; clear errors + lda #0 ; clear fd + sta filedesc + tax + rts _read: ; a/x - number of bytes @@ -96,96 +96,96 @@ _read: ; popax - fd, must be == to the above one ; return -1+__oserror or number of bytes read - eor #$ff - sta ptr1 - txa - eor #$ff - sta ptr1+1 ; -(# of bytes to read)-1 - jsr popax - sta ptr2 - stx ptr2+1 ; buffer ptr - jsr popax - cmp #FILEDES ; lo-byte == FILEDES - bne @filenotopen - txa ; hi-byte == 0 - beq @fileok ; fd must be == FILEDES + eor #$ff + sta ptr1 + txa + eor #$ff + sta ptr1+1 ; -(# of bytes to read)-1 + jsr popax + sta ptr2 + stx ptr2+1 ; buffer ptr + jsr popax + cmp #FILEDES ; lo-byte == FILEDES + bne @filenotopen + txa ; hi-byte == 0 + beq @fileok ; fd must be == FILEDES @filenotopen: - lda #EBADF - jmp __directerrno ; Sets _errno, clears _oserror, returns -1 + lda #EBADF + jmp __directerrno ; Sets _errno, clears _oserror, returns -1 @fileok: - lda #0 - sta ptr3 - sta ptr3+1 ; put 0 into ptr3 (number of bytes read) - sta __oserror ; clear error flags - jsr __seterrno + lda #0 + sta ptr3 + sta ptr3+1 ; put 0 into ptr3 (number of bytes read) + sta __oserror ; clear error flags + jsr __seterrno - lda f_track ; restore stuff for ReadByte - ldx f_sector - sta r1L - stx r1H - lda f_buffer - ldx f_buffer+1 - sta r4L - stx r4H - lda f_offset - ldx f_offset+1 - sta r5L - stx r5H + lda f_track ; restore stuff for ReadByte + ldx f_sector + sta r1L + stx r1H + lda f_buffer + ldx f_buffer+1 + sta r4L + stx r4H + lda f_offset + ldx f_offset+1 + sta r5L + stx r5H - clc - bcc @L3 ; branch always + clc + bcc @L3 ; branch always -@L0: jsr _ReadByte - ldy #0 ; store the byte - sta (ptr2),y - inc ptr2 ; increment target address - bne @L1 - inc ptr2+1 +@L0: jsr _ReadByte + ldy #0 ; store the byte + sta (ptr2),y + inc ptr2 ; increment target address + bne @L1 + inc ptr2+1 -@L1: inc ptr3 ; increment byte count - bne @L2 - inc ptr3+1 +@L1: inc ptr3 ; increment byte count + bne @L2 + inc ptr3+1 -@L2: lda __oserror ; was there error ? - beq @L3 - cmp #BFR_OVERFLOW ; EOF? - beq @done ; yes, we're done - jmp __mappederrno ; no, we're screwed +@L2: lda __oserror ; was there error ? + beq @L3 + cmp #BFR_OVERFLOW ; EOF? + beq @done ; yes, we're done + jmp __mappederrno ; no, we're screwed -@L3: inc ptr1 ; decrement the count - bne @L0 - inc ptr1+1 - bne @L0 +@L3: inc ptr1 ; decrement the count + bne @L0 + inc ptr1+1 + bne @L0 @done: - lda r1L ; preserve data for ReadByte - ldx r1H - sta f_track - stx f_sector - lda r4L - ldx r4H - sta f_buffer - stx f_buffer+1 - lda r5L - ldx r5H - sta f_offset - stx f_offset+1 + lda r1L ; preserve data for ReadByte + ldx r1H + sta f_track + stx f_sector + lda r4L + ldx r4H + sta f_buffer + stx f_buffer+1 + lda r5L + ldx r5H + sta f_offset + stx f_offset+1 - lda ptr3 ; return byte count - ldx ptr3+1 - rts + lda ptr3 ; return byte count + ldx ptr3+1 + rts .bss filedesc: - .res 1 ; file open flag - 0 (no file opened) or 1 + .res 1 ; file open flag - 0 (no file opened) or 1 f_track: - .res 1 ; values preserved for ReadByte + .res 1 ; values preserved for ReadByte f_sector: - .res 1 + .res 1 f_offset: - .res 2 + .res 2 f_buffer: - .res 2 + .res 2 diff --git a/libsrc/geos-common/drivers/geos-stdmou.s b/libsrc/geos-common/drivers/geos-stdmou.s index 6f144d599..7e544ba82 100644 --- a/libsrc/geos-common/drivers/geos-stdmou.s +++ b/libsrc/geos-common/drivers/geos-stdmou.s @@ -5,19 +5,19 @@ ; ; Driver for GEOS standard input device interface ; - - .export _mouse_init, _mouse_done - .export _mouse_hide, _mouse_show - .export _mouse_box - .export _mouse_pos, _mouse_info - .export _mouse_move, _mouse_buttons + + .export _mouse_init, _mouse_done + .export _mouse_hide, _mouse_show + .export _mouse_box + .export _mouse_pos, _mouse_info + .export _mouse_move, _mouse_buttons - .import popsreg, addysp1 - .importzp sp, sreg, ptr1 + .import popsreg, addysp1 + .importzp sp, sreg, ptr1 - .include "const.inc" - .include "jumptab.inc" - .include "geossym.inc" + .include "const.inc" + .include "jumptab.inc" + .include "geossym.inc" ; -------------------------------------------------------------------------- ; @@ -25,57 +25,57 @@ ; _mouse_init: - jsr StartMouseMode - jsr MouseOff + jsr StartMouseMode + jsr MouseOff - lda #0 - sta mouseTop - sta mouseLeft - sta mouseLeft+1 + lda #0 + sta mouseTop + sta mouseLeft + sta mouseLeft+1 .ifdef __GEOS_CBM__ - lda #199 - sta mouseBottom - lda graphMode - bpl _mse_screen320 + lda #199 + sta mouseBottom + lda graphMode + bpl _mse_screen320 - lda #<639 ; 80 columns on C128 - ldx #>639 - bne _mse_storex + lda #<639 ; 80 columns on C128 + ldx #>639 + bne _mse_storex _mse_screen320: - lda #<319 ; 40 columns on C64/C128 - ldx #>319 + lda #<319 ; 40 columns on C64/C128 + ldx #>319 _mse_storex: .else - lda #191 - sta mouseBottom - lda #<559 - ldx #>559 + lda #191 + sta mouseBottom + lda #<559 + ldx #>559 .endif - sta mouseRight - stx mouseRight+1 + sta mouseRight + stx mouseRight+1 _mse_initend: - lda #0 - tax + lda #0 + tax ; -------------------------------------------------------------------------- ; ; void mouse_done (void); ; _mouse_done: - rts + rts ; -------------------------------------------------------------------------- ; ; void mouse_hide (void); ; -_mouse_hide = MouseOff +_mouse_hide = MouseOff ; -------------------------------------------------------------------------- ; ; void mouse_show (void); ; -_mouse_show = MouseUp +_mouse_show = MouseUp ; -------------------------------------------------------------------------- ; @@ -83,29 +83,29 @@ _mouse_show = MouseUp ; _mouse_box: - ldy #0 ; Stack offset + ldy #0 ; Stack offset - sta mouseBottom + sta mouseBottom - lda (sp),y - sta mouseRight - iny - lda (sp),y - sta mouseRight+1 ; maxx + lda (sp),y + sta mouseRight + iny + lda (sp),y + sta mouseRight+1 ; maxx - iny - lda (sp),y - sta mouseTop - iny ; Skip high byte + iny + lda (sp),y + sta mouseTop + iny ; Skip high byte - iny - lda (sp),y - sta mouseLeft - iny - lda (sp),y - sta mouseLeft+1 ; minx + iny + lda (sp),y + sta mouseLeft + iny + lda (sp),y + sta mouseLeft+1 ; minx - jmp addysp1 ; Drop params, return + jmp addysp1 ; Drop params, return ; -------------------------------------------------------------------------- ; @@ -114,28 +114,28 @@ _mouse_box: ; _mouse_pos: - sta ptr1 - stx ptr1+1 ; Remember the argument pointer + sta ptr1 + stx ptr1+1 ; Remember the argument pointer - ldy #0 ; Structure offset + ldy #0 ; Structure offset - php - sei ; Disable interrupts + php + sei ; Disable interrupts - lda mouseXPos ; Transfer the position - sta (ptr1),y - lda mouseXPos+1 - iny - sta (ptr1),y - lda mouseYPos - iny - sta (ptr1),y - lda #$00 - iny - sta (ptr1),y + lda mouseXPos ; Transfer the position + sta (ptr1),y + lda mouseXPos+1 + iny + sta (ptr1),y + lda mouseYPos + iny + sta (ptr1),y + lda #$00 + iny + sta (ptr1),y - plp ; Reenable interrupts - rts ; Done + plp ; Reenable interrupts + rts ; Done ; -------------------------------------------------------------------------- ; @@ -150,15 +150,15 @@ _mouse_info: ; call _mouse_pos to initialize the struct pointer and fill the position ; fields. - jsr _mouse_pos + jsr _mouse_pos ; Fill in the button state - jsr _mouse_buttons ; Will not touch ptr1 - iny - sta (ptr1),y + jsr _mouse_buttons ; Will not touch ptr1 + iny + sta (ptr1),y - rts + rts ; -------------------------------------------------------------------------- ; @@ -166,16 +166,16 @@ _mouse_info: ; _mouse_move: - jsr popsreg ; Get X - php - sei ; Disable interrupts - sta mouseYPos - lda sreg - ldx sreg+1 - sta mouseXPos - stx mouseXPos+1 - plp ; Enable interrupts - rts + jsr popsreg ; Get X + php + sei ; Disable interrupts + sta mouseYPos + lda sreg + ldx sreg+1 + sta mouseXPos + stx mouseXPos+1 + plp ; Enable interrupts + rts ; -------------------------------------------------------------------------- ; @@ -183,8 +183,8 @@ _mouse_move: ; _mouse_buttons: - ldx #0 - lda pressFlag - and #SET_MOUSE - lsr - rts + ldx #0 + lda pressFlag + and #SET_MOUSE + lsr + rts diff --git a/libsrc/geos-common/drivers/mcbdefault.s b/libsrc/geos-common/drivers/mcbdefault.s index 39658ebf6..5b5806685 100644 --- a/libsrc/geos-common/drivers/mcbdefault.s +++ b/libsrc/geos-common/drivers/mcbdefault.s @@ -9,13 +9,13 @@ ; 2004-09-24, Greg King ; -; .constructor init_pointer +; .constructor init_pointer .export _mouse_def_callbacks ; .include "mouse-kernel.inc" -; .include "const.inc" -; .include "geossym.inc" - .include "jumptab.inc" +; .include "const.inc" +; .include "geossym.inc" + .include "jumptab.inc" ; .macpack generic diff --git a/libsrc/geos-common/drivers/mouse_stddrv.s b/libsrc/geos-common/drivers/mouse_stddrv.s index fec7b50e1..349fb9c60 100644 --- a/libsrc/geos-common/drivers/mouse_stddrv.s +++ b/libsrc/geos-common/drivers/mouse_stddrv.s @@ -6,9 +6,9 @@ ; const char mouse_stddrv[]; ; - .export _mouse_stddrv + .export _mouse_stddrv .rodata _mouse_stddrv: - .asciiz "geos-stdmou.mou" + .asciiz "geos-stdmou.mou" diff --git a/libsrc/geos-common/file/appendrecord.s b/libsrc/geos-common/file/appendrecord.s index 4f0ca8dbe..2a7864a13 100644 --- a/libsrc/geos-common/file/appendrecord.s +++ b/libsrc/geos-common/file/appendrecord.s @@ -5,13 +5,13 @@ ; char AppendRecord (void); - .import setoserror - .export _AppendRecord + .import setoserror + .export _AppendRecord - .include "jumptab.inc" - .include "diskdrv.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + _AppendRecord: - jsr AppendRecord - jmp setoserror + jsr AppendRecord + jmp setoserror diff --git a/libsrc/geos-common/file/closerecordfile.s b/libsrc/geos-common/file/closerecordfile.s index 2ca471c8d..ee0778d7b 100644 --- a/libsrc/geos-common/file/closerecordfile.s +++ b/libsrc/geos-common/file/closerecordfile.s @@ -5,12 +5,12 @@ ; char CloseRecordFile (void); - .import setoserror - .export _CloseRecordFile + .import setoserror + .export _CloseRecordFile - .include "jumptab.inc" - .include "diskdrv.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + _CloseRecordFile: - jsr CloseRecordFile - jmp setoserror + jsr CloseRecordFile + jmp setoserror diff --git a/libsrc/geos-common/file/deletefile.s b/libsrc/geos-common/file/deletefile.s index e2b05b9da..730569e55 100644 --- a/libsrc/geos-common/file/deletefile.s +++ b/libsrc/geos-common/file/deletefile.s @@ -5,15 +5,15 @@ ; char DeleteFile (char *myName); - .import setoserror - .export _DeleteFile + .import setoserror + .export _DeleteFile - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _DeleteFile: - sta r0L - stx r0H - jsr DeleteFile - jmp setoserror + sta r0L + stx r0H + jsr DeleteFile + jmp setoserror diff --git a/libsrc/geos-common/file/deleterecord.s b/libsrc/geos-common/file/deleterecord.s index 886f6f3dc..7ffe5d739 100644 --- a/libsrc/geos-common/file/deleterecord.s +++ b/libsrc/geos-common/file/deleterecord.s @@ -5,13 +5,13 @@ ; char DeleteRecord (void); - .import setoserror - .export _DeleteRecord + .import setoserror + .export _DeleteRecord - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _DeleteRecord: - jsr DeleteRecord - jmp setoserror + jsr DeleteRecord + jmp setoserror diff --git a/libsrc/geos-common/file/findfile.s b/libsrc/geos-common/file/findfile.s index a5f77ac35..0f58e99e6 100644 --- a/libsrc/geos-common/file/findfile.s +++ b/libsrc/geos-common/file/findfile.s @@ -5,15 +5,15 @@ ; char FindFile (char *myName); - .import setoserror - .export _FindFile + .import setoserror + .export _FindFile - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _FindFile: - sta r6L - stx r6H - jsr FindFile - jmp setoserror + sta r6L + stx r6H + jsr FindFile + jmp setoserror diff --git a/libsrc/geos-common/file/findftypes.s b/libsrc/geos-common/file/findftypes.s index 2e6020b3a..7b9967a39 100644 --- a/libsrc/geos-common/file/findftypes.s +++ b/libsrc/geos-common/file/findftypes.s @@ -5,33 +5,33 @@ ; char FindFTypes (char *buffer, char fileType, char fileMax, char *Class); - .export _FindFTypes - .import popax, popa, setoserror + .export _FindFTypes + .import popax, popa, setoserror - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" _FindFTypes: - sta r10L - stx r10H - jsr popa - sta r7H - sta tmpFileMax - jsr popa - sta r7L - jsr popax - sta r6L - stx r6H - jsr FindFTypes - jsr setoserror + sta r10L + stx r10H + jsr popa + sta r7H + sta tmpFileMax + jsr popa + sta r7L + jsr popax + sta r6L + stx r6H + jsr FindFTypes + jsr setoserror ; return (fileMax - r7H) - lda tmpFileMax - sec - sbc r7H - rts + lda tmpFileMax + sec + sbc r7H + rts .bss tmpFileMax: - .res 1 + .res 1 diff --git a/libsrc/geos-common/file/freefile.s b/libsrc/geos-common/file/freefile.s index 25d6c9d74..791f3f31c 100644 --- a/libsrc/geos-common/file/freefile.s +++ b/libsrc/geos-common/file/freefile.s @@ -5,15 +5,15 @@ ; char FreeFile (struct trse myTrSe[]); - .import setoserror - .export _FreeFile + .import setoserror + .export _FreeFile - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _FreeFile: - sta r9L - stx r9H - jsr FreeFile - jmp setoserror + sta r9L + stx r9H + jsr FreeFile + jmp setoserror diff --git a/libsrc/geos-common/file/get1stdirentry.s b/libsrc/geos-common/file/get1stdirentry.s index 675779f50..3b99554eb 100644 --- a/libsrc/geos-common/file/get1stdirentry.s +++ b/libsrc/geos-common/file/get1stdirentry.s @@ -5,15 +5,15 @@ ; struct filehandle* Get1stDirEntry (void); - .import __oserror - .export _Get1stDirEntry + .import __oserror + .export _Get1stDirEntry - .include "diskdrv.inc" - .include "geossym.inc" + .include "diskdrv.inc" + .include "geossym.inc" _Get1stDirEntry: - jsr Get1stDirEntry - stx __oserror - lda r5L - ldx r5H - rts + jsr Get1stDirEntry + stx __oserror + lda r5L + ldx r5H + rts diff --git a/libsrc/geos-common/file/getfhdrinfo.s b/libsrc/geos-common/file/getfhdrinfo.s index 6200c8075..a9a843e74 100644 --- a/libsrc/geos-common/file/getfhdrinfo.s +++ b/libsrc/geos-common/file/getfhdrinfo.s @@ -5,15 +5,15 @@ ; char GetFHdrInfo (struct filehandle *myFile); - .import setoserror - .export _GetFHdrInfo + .import setoserror + .export _GetFHdrInfo - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _GetFHdrInfo: - sta r9L - stx r9H - jsr GetFHdrInfo - jmp setoserror + sta r9L + stx r9H + jsr GetFHdrInfo + jmp setoserror diff --git a/libsrc/geos-common/file/getfile.s b/libsrc/geos-common/file/getfile.s index 2496186d7..9c8011542 100644 --- a/libsrc/geos-common/file/getfile.s +++ b/libsrc/geos-common/file/getfile.s @@ -5,28 +5,28 @@ ; char __fastcall__ GetFile(char flag, const char *fname, const char *loadaddr, const char *datadname, char *datafname); - .export _GetFile - .import popa, popax, setoserror + .export _GetFile + .import popa, popax, setoserror - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _GetFile: - sta r3L - stx r3H - jsr popax - sta r2L - stx r2H - jsr popax - sta r7L - stx r7H - jsr popax - sta r6L - stx r6H - jsr popa - sta r0L - lda #0 - sta r10L - jsr GetFile - jmp setoserror + sta r3L + stx r3H + jsr popax + sta r2L + stx r2H + jsr popax + sta r7L + stx r7H + jsr popax + sta r6L + stx r6H + jsr popa + sta r0L + lda #0 + sta r10L + jsr GetFile + jmp setoserror diff --git a/libsrc/geos-common/file/getnxtdirentry.s b/libsrc/geos-common/file/getnxtdirentry.s index a7246cff9..912f48ca4 100644 --- a/libsrc/geos-common/file/getnxtdirentry.s +++ b/libsrc/geos-common/file/getnxtdirentry.s @@ -5,15 +5,15 @@ ; struct filehandle* GetNxtDirEntry (void); - .import __oserror - .export _GetNxtDirEntry + .import __oserror + .export _GetNxtDirEntry - .include "diskdrv.inc" - .include "geossym.inc" + .include "diskdrv.inc" + .include "geossym.inc" _GetNxtDirEntry: - jsr GetNxtDirEntry - stx __oserror - lda r5L - ldx r5H - rts + jsr GetNxtDirEntry + stx __oserror + lda r5L + ldx r5H + rts diff --git a/libsrc/geos-common/file/insertrecord.s b/libsrc/geos-common/file/insertrecord.s index 881537add..5b5a7c71f 100644 --- a/libsrc/geos-common/file/insertrecord.s +++ b/libsrc/geos-common/file/insertrecord.s @@ -5,12 +5,12 @@ ; char InsertRecord (void); - .import setoserror - .export _InsertRecord + .import setoserror + .export _InsertRecord - .include "jumptab.inc" - .include "diskdrv.inc" + .include "jumptab.inc" + .include "diskdrv.inc" _InsertRecord: - jsr InsertRecord - jmp setoserror + jsr InsertRecord + jmp setoserror diff --git a/libsrc/geos-common/file/nextrecord.s b/libsrc/geos-common/file/nextrecord.s index 1c0ec4272..a3f12f9c4 100644 --- a/libsrc/geos-common/file/nextrecord.s +++ b/libsrc/geos-common/file/nextrecord.s @@ -5,12 +5,12 @@ ; char NextRecord (void); - .import setoserror - .export _NextRecord + .import setoserror + .export _NextRecord - .include "jumptab.inc" - .include "diskdrv.inc" + .include "jumptab.inc" + .include "diskdrv.inc" _NextRecord: - jsr NextRecord - jmp setoserror + jsr NextRecord + jmp setoserror diff --git a/libsrc/geos-common/file/openrecordfile.s b/libsrc/geos-common/file/openrecordfile.s index 4052a5a23..cdab3dd6c 100644 --- a/libsrc/geos-common/file/openrecordfile.s +++ b/libsrc/geos-common/file/openrecordfile.s @@ -5,15 +5,15 @@ ; char OpenRecordFile (char *myName); - .import setoserror - .export _OpenRecordFile + .import setoserror + .export _OpenRecordFile - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _OpenRecordFile: - sta r0L - stx r0H - jsr OpenRecordFile - jmp setoserror + sta r0L + stx r0H + jsr OpenRecordFile + jmp setoserror diff --git a/libsrc/geos-common/file/pointrecord.s b/libsrc/geos-common/file/pointrecord.s index b2faf0f0f..82b88c4c6 100644 --- a/libsrc/geos-common/file/pointrecord.s +++ b/libsrc/geos-common/file/pointrecord.s @@ -5,12 +5,12 @@ ; char PointRecord (char recordNum); - .import setoserror - .export _PointRecord + .import setoserror + .export _PointRecord - .include "jumptab.inc" - .include "diskdrv.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + _PointRecord: - jsr PointRecord - jmp setoserror + jsr PointRecord + jmp setoserror diff --git a/libsrc/geos-common/file/previousrecord.s b/libsrc/geos-common/file/previousrecord.s index e0151916f..8fac1a5b1 100644 --- a/libsrc/geos-common/file/previousrecord.s +++ b/libsrc/geos-common/file/previousrecord.s @@ -5,12 +5,12 @@ ; char PreviousRecord (void); - .import setoserror - .export _PreviousRecord + .import setoserror + .export _PreviousRecord - .include "jumptab.inc" - .include "diskdrv.inc" + .include "jumptab.inc" + .include "diskdrv.inc" _PreviousRecord: - jsr PreviousRecord - jmp setoserror + jsr PreviousRecord + jmp setoserror diff --git a/libsrc/geos-common/file/readbyte.s b/libsrc/geos-common/file/readbyte.s index 72345af15..9a24e68df 100644 --- a/libsrc/geos-common/file/readbyte.s +++ b/libsrc/geos-common/file/readbyte.s @@ -5,13 +5,13 @@ ; char ReadByte (void); - .import __oserror - .export _ReadByte + .import __oserror + .export _ReadByte - .include "jumptab.inc" + .include "jumptab.inc" _ReadByte: - jsr ReadByte - stx __oserror - ldx #0 - rts + jsr ReadByte + stx __oserror + ldx #0 + rts diff --git a/libsrc/geos-common/file/readfile.s b/libsrc/geos-common/file/readfile.s index db315498a..3b43cffd4 100644 --- a/libsrc/geos-common/file/readfile.s +++ b/libsrc/geos-common/file/readfile.s @@ -5,23 +5,23 @@ ; char ReadFile (struct tr_se *myTS, char *buffer, int length); - .export _ReadFile - .import popax, setoserror - .import gettrse + .export _ReadFile + .import popax, setoserror + .import gettrse - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _ReadFile: - sta r2L - stx r2H - jsr popax - sta r7L - stx r7H - jsr popax - jsr gettrse - sta r1L - stx r1H - jsr ReadFile - jmp setoserror + sta r2L + stx r2H + jsr popax + sta r7L + stx r7H + jsr popax + jsr gettrse + sta r1L + stx r1H + jsr ReadFile + jmp setoserror diff --git a/libsrc/geos-common/file/readrecord.s b/libsrc/geos-common/file/readrecord.s index 507d0a02c..dd464e0b1 100644 --- a/libsrc/geos-common/file/readrecord.s +++ b/libsrc/geos-common/file/readrecord.s @@ -5,18 +5,18 @@ ; char ReadRecord (char *buffer, int length); - .export _ReadRecord - .import popax, setoserror + .export _ReadRecord + .import popax, setoserror - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _ReadRecord: - sta r2L - stx r2H - jsr popax - sta r7L - stx r7H - jsr ReadRecord - jmp setoserror + sta r2L + stx r2H + jsr popax + sta r7L + stx r7H + jsr ReadRecord + jmp setoserror diff --git a/libsrc/geos-common/file/renamefile.s b/libsrc/geos-common/file/renamefile.s index 2c7da89d7..6689d7938 100644 --- a/libsrc/geos-common/file/renamefile.s +++ b/libsrc/geos-common/file/renamefile.s @@ -5,18 +5,18 @@ ; char RenameFile (char *old, char *new); - .export _RenameFile - .import popax, setoserror + .export _RenameFile + .import popax, setoserror - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" _RenameFile: - sta r0L - stx r0H - jsr popax - sta r6L - stx r6H - jsr RenameFile - jmp setoserror + sta r0L + stx r0H + jsr popax + sta r6L + stx r6H + jsr RenameFile + jmp setoserror diff --git a/libsrc/geos-common/file/savefile.s b/libsrc/geos-common/file/savefile.s index 1b49bcfb8..11a2abfaf 100644 --- a/libsrc/geos-common/file/savefile.s +++ b/libsrc/geos-common/file/savefile.s @@ -5,18 +5,18 @@ ; char SaveFile (char skip, struct fileheader *myHeader); - .import setoserror - .import popa - .export _SaveFile + .import setoserror + .import popa + .export _SaveFile - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" _SaveFile: - sta r9L - stx r9H - jsr popa - sta r10L - jsr SaveFile - jmp setoserror + sta r9L + stx r9H + jsr popa + sta r10L + jsr SaveFile + jmp setoserror diff --git a/libsrc/geos-common/file/sysremove.s b/libsrc/geos-common/file/sysremove.s index 2edf50aec..085380106 100644 --- a/libsrc/geos-common/file/sysremove.s +++ b/libsrc/geos-common/file/sysremove.s @@ -5,16 +5,16 @@ ; unsigned char __fastcall__ _sysremove (const char* name); - .export __sysremove + .export __sysremove - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" __sysremove: - sta r0L - stx r0H - jsr DeleteFile - txa - ldx #0 - rts + sta r0L + stx r0H + jsr DeleteFile + txa + ldx #0 + rts diff --git a/libsrc/geos-common/file/sysrename.s b/libsrc/geos-common/file/sysrename.s index a1060c4d5..45ed49c1c 100644 --- a/libsrc/geos-common/file/sysrename.s +++ b/libsrc/geos-common/file/sysrename.s @@ -5,20 +5,20 @@ ; unsigned char __fastcall__ _sysrename (const char* oldname, const char* newname); - .export __sysrename - .import popax + .export __sysrename + .import popax - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" __sysrename: - sta r0L - stx r0H - jsr popax - sta r6L - stx r6H - jsr RenameFile - txa - ldx #0 - rts + sta r0L + stx r0H + jsr popax + sta r6L + stx r6H + jsr RenameFile + txa + ldx #0 + rts diff --git a/libsrc/geos-common/file/updaterecordfile.s b/libsrc/geos-common/file/updaterecordfile.s index ac0989ac6..896a44ec4 100644 --- a/libsrc/geos-common/file/updaterecordfile.s +++ b/libsrc/geos-common/file/updaterecordfile.s @@ -5,12 +5,12 @@ ; char UpdateRecordFile (void); - .import setoserror - .export _UpdateRecordFile + .import setoserror + .export _UpdateRecordFile - .include "jumptab.inc" - .include "diskdrv.inc" + .include "jumptab.inc" + .include "diskdrv.inc" _UpdateRecordFile: - jsr UpdateRecordFile - jmp setoserror + jsr UpdateRecordFile + jmp setoserror diff --git a/libsrc/geos-common/file/writerecord.s b/libsrc/geos-common/file/writerecord.s index e2449abc4..e0d4c86d4 100644 --- a/libsrc/geos-common/file/writerecord.s +++ b/libsrc/geos-common/file/writerecord.s @@ -5,18 +5,18 @@ ; char WriteRecord (char *buffer, int length); - .export _WriteRecord - .import popax, setoserror + .export _WriteRecord + .import popax, setoserror - .include "jumptab.inc" - .include "diskdrv.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "diskdrv.inc" + .include "geossym.inc" + _WriteRecord: - sta r2L - stx r2H - jsr popax - sta r7L - stx r7H - jsr WriteRecord - jmp setoserror + sta r2L + stx r2H + jsr popax + sta r7L + stx r7H + jsr WriteRecord + jmp setoserror diff --git a/libsrc/geos-common/geosmac.inc b/libsrc/geos-common/geosmac.inc index 00ac67754..5ce20ff7f 100644 --- a/libsrc/geos-common/geosmac.inc +++ b/libsrc/geos-common/geosmac.inc @@ -8,281 +8,281 @@ ;------------------------------------------------------------------------- -.macro LoadB dest, value - lda #value - sta dest +.macro LoadB dest, value + lda #value + sta dest .endmacro ;------------------------------------------------------------------------- -.macro LoadW dest, value - LoadB dest+1, >(value) - LoadB dest+0, <(value) +.macro LoadW dest, value + LoadB dest+1, >(value) + LoadB dest+0, <(value) .endmacro ;------------------------------------------------------------------------- -.macro MoveB source, dest - lda source - sta dest +.macro MoveB source, dest + lda source + sta dest .endmacro ;------------------------------------------------------------------------- -.macro MoveW source, dest - MoveB source+1, dest+1 - MoveB source+0, dest+0 +.macro MoveW source, dest + MoveB source+1, dest+1 + MoveB source+0, dest+0 .endmacro ;------------------------------------------------------------------------- -.macro add source - clc - adc source +.macro add source + clc + adc source .endmacro ;------------------------------------------------------------------------- -.macro AddB source, dest - lda source - add dest - sta dest +.macro AddB source, dest + lda source + add dest + sta dest .endmacro ;------------------------------------------------------------------------- -.macro AddW source, dest - AddB source+0, dest+0 - lda source+1 - adc dest+1 - sta dest+1 +.macro AddW source, dest + AddB source+0, dest+0 + lda source+1 + adc dest+1 + sta dest+1 .endmacro ;------------------------------------------------------------------------- -.macro AddVB value, dest - lda dest - clc - adc #(value) - sta dest - .endmacro +.macro AddVB value, dest + lda dest + clc + adc #(value) + sta dest + .endmacro ;------------------------------------------------------------------------- -.macro AddVW value, dest +.macro AddVW value, dest .local Skip - AddVB <(value), dest+0 - .if (>(value))=0 - bcc Skip - inc dest+1 - .else - lda #>(value) - adc dest+1 - sta dest+1 - .endif + AddVB <(value), dest+0 + .if (>(value))=0 + bcc Skip + inc dest+1 + .else + lda #>(value) + adc dest+1 + sta dest+1 + .endif Skip: .endmacro ;------------------------------------------------------------------------- -.macro ssub source - sec - sbc source +.macro ssub source + sec + sbc source .endmacro ;------------------------------------------------------------------------- -.macro SubB source, dest - lda dest - ssub source - sta dest +.macro SubB source, dest + lda dest + ssub source + sta dest .endmacro ;------------------------------------------------------------------------- -.macro SubW source, dest - SubB source+0, dest+0 - lda dest+1 - sbc source+1 - sta dest+1 +.macro SubW source, dest + SubB source+0, dest+0 + lda dest+1 + sbc source+1 + sta dest+1 .endmacro ;------------------------------------------------------------------------- -.macro SubVW value, dest - sec - lda dest+0 - sbc #<(value) - sta dest+0 - lda dest+1 - sbc #>(value) - sta dest+1 +.macro SubVW value, dest + sec + lda dest+0 + sbc #<(value) + sta dest+0 + lda dest+1 + sbc #>(value) + sta dest+1 .endmacro ;------------------------------------------------------------------------- -.macro CmpB source, dest - lda source - cmp dest +.macro CmpB source, dest + lda source + cmp dest .endmacro ;------------------------------------------------------------------------- -.macro CmpBI source, immed - lda source - cmp #(immed) +.macro CmpBI source, immed + lda source + cmp #(immed) .endmacro ;------------------------------------------------------------------------- -.macro CmpW source, dest -.local Skip - CmpB source+1, dest+1 - bne Skip - CmpB source+0, dest+0 +.macro CmpW source, dest +.local Skip + CmpB source+1, dest+1 + bne Skip + CmpB source+0, dest+0 Skip: .endmacro ;------------------------------------------------------------------------- -.macro CmpWI source, immed +.macro CmpWI source, immed .local Skip - CmpBI source+1, >(immed) - bne Skip - CmpBI source+0, <(immed) + CmpBI source+1, >(immed) + bne Skip + CmpBI source+0, <(immed) Skip: .endmacro ;------------------------------------------------------------------------- -.macro PushB source - lda source - pha +.macro PushB source + lda source + pha .endmacro ;------------------------------------------------------------------------- -.macro PushW source - PushB source+1 - PushB source+0 +.macro PushW source + PushB source+1 + PushB source+0 .endmacro ;------------------------------------------------------------------------- -.macro PopB dest - pla - sta dest +.macro PopB dest + pla + sta dest .endmacro ;------------------------------------------------------------------------- -.macro PopW dest - PopB dest+0 - PopB dest+1 +.macro PopW dest + PopB dest+0 + PopB dest+1 .endmacro ;------------------------------------------------------------------------- -.macro smb bitNumber, dest - pha - lda #(1 << bitNumber) - ora dest - sta dest - pla +.macro smb bitNumber, dest + pha + lda #(1 << bitNumber) + ora dest + sta dest + pla .endmacro ;------------------------------------------------------------------------- -.macro smbf bitNumber, dest - lda #(1 << bitNumber) - ora dest - sta dest +.macro smbf bitNumber, dest + lda #(1 << bitNumber) + ora dest + sta dest .endmacro ;------------------------------------------------------------------------- -.macro rmb bitNumber, dest - pha - lda #(1 << bitNumber) ^ $ff - and dest - sta dest - pla +.macro rmb bitNumber, dest + pha + lda #(1 << bitNumber) ^ $ff + and dest + sta dest + pla .endmacro ;------------------------------------------------------------------------- -.macro rmbf bitNumber, dest - lda #(1 << bitNumber) ^ $ff - and dest - sta dest +.macro rmbf bitNumber, dest + lda #(1 << bitNumber) ^ $ff + and dest + sta dest .endmacro ;------------------------------------------------------------------------- -.macro bbs bitNumber, source, addr +.macro bbs bitNumber, source, addr .local Skip - php - pha - lda source - and #(1 << bitNumber) - beq Skip - pla - plp - bra addr -Skip: pla - plp + php + pha + lda source + and #(1 << bitNumber) + beq Skip + pla + plp + bra addr +Skip: pla + plp .endmacro ;------------------------------------------------------------------------- -.macro bbsf bitNumber, source, addr - .if bitNumber=7 - bit source - bmi addr - .else - .if bitNumber=6 - bit source - bvs addr - .else - lda source - and #(1 << bitNumber) - bne addr - .endif - .endif +.macro bbsf bitNumber, source, addr + .if bitNumber=7 + bit source + bmi addr + .else + .if bitNumber=6 + bit source + bvs addr + .else + lda source + and #(1 << bitNumber) + bne addr + .endif + .endif .endmacro ;------------------------------------------------------------------------- -.macro bbr bitNumber, source, addr +.macro bbr bitNumber, source, addr .local Skip - php - pha - lda source - and #(1 << bitNumber) - bne Skip - pla - plp - bra addr -Skip: pla - plp + php + pha + lda source + and #(1 << bitNumber) + bne Skip + pla + plp + bra addr +Skip: pla + plp .endmacro ;------------------------------------------------------------------------- -.macro bbrf bitNumber, source, addr - .if bitNumber=7 - bit source - bpl addr - .else - .if bitNumber=6 - bit source - bvc addr - .else - lda source - and #(1 << bitNumber) - beq addr - .endif - .endif +.macro bbrf bitNumber, source, addr + .if bitNumber=7 + bit source + bpl addr + .else + .if bitNumber=6 + bit source + bvc addr + .else + lda source + and #(1 << bitNumber) + beq addr + .endif + .endif .endmacro ;------------------------------------------------------------------------- @@ -291,30 +291,30 @@ Skip: pla ;------------------------------------------------------------------------- -.macro addv value - clc - adc #(value) +.macro addv value + clc + adc #(value) .endmacro ;------------------------------------------------------------------------- -.macro subv value - sec - sbc #(value) +.macro subv value + sec + sbc #(value) .endmacro ;------------------------------------------------------------------------- -.macro bnex addr - txa - bne addr +.macro bnex addr + txa + bne addr .endmacro ;------------------------------------------------------------------------- -.macro beqx addr - txa - beq addr +.macro beqx addr + txa + beq addr .endmacro ;------------------------------------------------------------------------- diff --git a/libsrc/geos-common/graph/bitmapclip.s b/libsrc/geos-common/graph/bitmapclip.s index 50e4e03b0..993af095d 100644 --- a/libsrc/geos-common/graph/bitmapclip.s +++ b/libsrc/geos-common/graph/bitmapclip.s @@ -3,22 +3,22 @@ ; ; 21.12.99 -; void BitmapClip (char skipl, char skipr, int skipy, struct iconpic *myGfx); +; void BitmapClip (char skipl, char skipr, int skipy, struct iconpic *myGfx); - .import popa, popax - .import BitmapRegs - .export _BitmapClip + .import popa, popax + .import BitmapRegs + .export _BitmapClip - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _BitmapClip: - jsr BitmapRegs - jsr popax - sta r12L - stx r12H - jsr popa - sta r11H - jsr popa - sta r11L - jmp BitmapClip + jsr BitmapRegs + jsr popax + sta r12L + stx r12H + jsr popa + sta r11H + jsr popa + sta r11L + jmp BitmapClip diff --git a/libsrc/geos-common/graph/bitmapregs.s b/libsrc/geos-common/graph/bitmapregs.s index 9ff45e872..0751c963d 100644 --- a/libsrc/geos-common/graph/bitmapregs.s +++ b/libsrc/geos-common/graph/bitmapregs.s @@ -3,18 +3,18 @@ ; ; 21.12.99 - .importzp ptr4 - .export BitmapRegs + .importzp ptr4 + .export BitmapRegs - .include "geossym.inc" + .include "geossym.inc" -BitmapRegs: ; a/x is a struct iconpic* - sta ptr4 - stx ptr4+1 - ldy #0 -bmpLp: lda (ptr4),y - sta r0L,y - iny - cpy #6 - bne bmpLp - rts +BitmapRegs: ; a/x is a struct iconpic* + sta ptr4 + stx ptr4+1 + ldy #0 +bmpLp: lda (ptr4),y + sta r0L,y + iny + cpy #6 + bne bmpLp + rts diff --git a/libsrc/geos-common/graph/bitmapup.s b/libsrc/geos-common/graph/bitmapup.s index 214bf2357..9b37308f3 100644 --- a/libsrc/geos-common/graph/bitmapup.s +++ b/libsrc/geos-common/graph/bitmapup.s @@ -3,13 +3,13 @@ ; ; 21.12.99 -; void BitmapUp (struct iconpic *myGfx); +; void BitmapUp (struct iconpic *myGfx); - .import BitmapRegs - .export _BitmapUp + .import BitmapRegs + .export _BitmapUp - .include "jumptab.inc" + .include "jumptab.inc" _BitmapUp: - jsr BitmapRegs - jmp BitmapUp + jsr BitmapRegs + jmp BitmapUp diff --git a/libsrc/geos-common/graph/bitotherclip.s b/libsrc/geos-common/graph/bitotherclip.s index 5956ea738..ef849f6d7 100644 --- a/libsrc/geos-common/graph/bitotherclip.s +++ b/libsrc/geos-common/graph/bitotherclip.s @@ -3,34 +3,34 @@ ; ; 21.12.99 -; void BitOtherClip (void *proc1, void* proc2, char skipl, char skipr, int skipy, -; struct iconpic *myGfx); +; void BitOtherClip (void *proc1, void* proc2, char skipl, char skipr, int skipy, +; struct iconpic *myGfx); ; both proc1, proc2 should be: char __fastcall something (void); -; proc1 is called before reading a byte (.A returns next data) -; proc2 is called before reading each byte which is not pattern (code >219) +; proc1 is called before reading a byte (.A returns next data) +; proc2 is called before reading each byte which is not pattern (code >219) - .import popa, popax - .import BitOtherRegs - .export _BitOtherClip + .import popa, popax + .import BitOtherRegs + .export _BitOtherClip - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _BitOtherClip: - jsr BitOtherRegs - jsr popax - sta r12L - stx r12H - jsr popa - sta r11H - jsr popa - sta r11L - jsr popax - sta r14L - stx r14H - jsr popax - sta r13L - stx r13H - jmp BitOtherClip + jsr BitOtherRegs + jsr popax + sta r12L + stx r12H + jsr popa + sta r11H + jsr popa + sta r11L + jsr popax + sta r14L + stx r14H + jsr popax + sta r13L + stx r13H + jmp BitOtherClip diff --git a/libsrc/geos-common/graph/drawline.s b/libsrc/geos-common/graph/drawline.s index 74cb67b74..75952f72a 100644 --- a/libsrc/geos-common/graph/drawline.s +++ b/libsrc/geos-common/graph/drawline.s @@ -5,26 +5,26 @@ ; void DrawLine (char mode, struct window *mywindow); - .import _InitDrawWindow - .import popa - .importzp tmp1 - .export _DrawLine + .import _InitDrawWindow + .import popa + .importzp tmp1 + .export _DrawLine - .include "jumptab.inc" - .include "geossym.inc" - .include "geosmac.inc" + .include "jumptab.inc" + .include "geossym.inc" + .include "geosmac.inc" _DrawLine: - tay - PushW r2 - tya - jsr _InitDrawWindow - MoveW r2, r11 - PopW r2 - jsr popa - sta tmp1 - clc - bit tmp1 - bvc @1 - sec -@1: jmp DrawLine + tay + PushW r2 + tya + jsr _InitDrawWindow + MoveW r2, r11 + PopW r2 + jsr popa + sta tmp1 + clc + bit tmp1 + bvc @1 + sec +@1: jmp DrawLine diff --git a/libsrc/geos-common/graph/drawpoint.s b/libsrc/geos-common/graph/drawpoint.s index 6179d22d8..f7c75a487 100644 --- a/libsrc/geos-common/graph/drawpoint.s +++ b/libsrc/geos-common/graph/drawpoint.s @@ -3,21 +3,21 @@ ; ; 29.10.99, 05.3.2003 -; void DrawPoint (char mode, struct pixel *mypixel); +; void DrawPoint (char mode, struct pixel *mypixel); - .import PointRegs - .import popa - .importzp tmp1 - .export _DrawPoint + .import PointRegs + .import popa + .importzp tmp1 + .export _DrawPoint - .include "jumptab.inc" + .include "jumptab.inc" _DrawPoint: - jsr PointRegs - jsr popa - sta tmp1 - clc - bit tmp1 - bvc @1 - sec -@1: jmp DrawPoint + jsr PointRegs + jsr popa + sta tmp1 + clc + bit tmp1 + bvc @1 + sec +@1: jmp DrawPoint diff --git a/libsrc/geos-common/graph/framerectangle.s b/libsrc/geos-common/graph/framerectangle.s index f0f51d8fd..c5f9de04c 100644 --- a/libsrc/geos-common/graph/framerectangle.s +++ b/libsrc/geos-common/graph/framerectangle.s @@ -5,8 +5,8 @@ ; void FrameRectangle (char pattern); - .export _FrameRectangle + .export _FrameRectangle - .include "jumptab.inc" - -_FrameRectangle = FrameRectangle + .include "jumptab.inc" + +_FrameRectangle = FrameRectangle diff --git a/libsrc/geos-common/graph/getcharwidth.s b/libsrc/geos-common/graph/getcharwidth.s index a98005f9a..9c16ea1ab 100644 --- a/libsrc/geos-common/graph/getcharwidth.s +++ b/libsrc/geos-common/graph/getcharwidth.s @@ -5,11 +5,11 @@ ; char GetCharWidth (char character); - .export _GetCharWidth + .export _GetCharWidth - .include "jumptab.inc" + .include "jumptab.inc" _GetCharWidth: - jsr GetCharWidth - ldx #0 - rts + jsr GetCharWidth + ldx #0 + rts diff --git a/libsrc/geos-common/graph/getintcharint.s b/libsrc/geos-common/graph/getintcharint.s index 5b4088d21..a04fed02b 100644 --- a/libsrc/geos-common/graph/getintcharint.s +++ b/libsrc/geos-common/graph/getintcharint.s @@ -3,18 +3,18 @@ ; ; 11.03.2000 - .import popa, popax - .export getintcharint + .import popa, popax + .export getintcharint - .include "geossym.inc" + .include "geossym.inc" getintcharint: - sta r11L - stx r11H - jsr popa - sta r1H - jsr popax - sta r0L - stx r0H - rts + sta r11L + stx r11H + jsr popa + sta r1H + jsr popax + sta r0L + stx r0H + rts diff --git a/libsrc/geos-common/graph/graphicsstring.s b/libsrc/geos-common/graph/graphicsstring.s index 492b5e35c..86c74f1a6 100644 --- a/libsrc/geos-common/graph/graphicsstring.s +++ b/libsrc/geos-common/graph/graphicsstring.s @@ -5,12 +5,12 @@ ; void GraphicsString (char *myString); - .export _GraphicsString + .export _GraphicsString - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _GraphicsString: - sta r0L - stx r0H - jmp GraphicsString + sta r0L + stx r0H + jmp GraphicsString diff --git a/libsrc/geos-common/graph/hlineregs.s b/libsrc/geos-common/graph/hlineregs.s index 836f85178..bad7e8851 100644 --- a/libsrc/geos-common/graph/hlineregs.s +++ b/libsrc/geos-common/graph/hlineregs.s @@ -4,17 +4,17 @@ ; 29.10.99 - .import popax, popa - .export HLineRegs + .import popax, popa + .export HLineRegs - .include "geossym.inc" + .include "geossym.inc" HLineRegs: - stx r4H - sta r4L - jsr popax - stx r3H - sta r3L - jsr popa - sta r11L - rts + stx r4H + sta r4L + jsr popax + stx r3H + sta r3L + jsr popa + sta r11L + rts diff --git a/libsrc/geos-common/graph/horizontalline.s b/libsrc/geos-common/graph/horizontalline.s index 9b8a1c5d5..95655f55f 100644 --- a/libsrc/geos-common/graph/horizontalline.s +++ b/libsrc/geos-common/graph/horizontalline.s @@ -5,13 +5,13 @@ ; void HorizontalLine (char pattern, char y, int xstart, int xend); - .import popa - .import HLineRegs - .export _HorizontalLine + .import popa + .import HLineRegs + .export _HorizontalLine - .include "jumptab.inc" + .include "jumptab.inc" _HorizontalLine: - jsr HLineRegs - jsr popa - jmp HorizontalLine + jsr HLineRegs + jsr popa + jmp HorizontalLine diff --git a/libsrc/geos-common/graph/imprintrectangle.s b/libsrc/geos-common/graph/imprintrectangle.s index 0ac0c3092..fc327e9d3 100644 --- a/libsrc/geos-common/graph/imprintrectangle.s +++ b/libsrc/geos-common/graph/imprintrectangle.s @@ -4,10 +4,10 @@ ; 21.12.99 ; void ImprintRectangle (void); - - .export _ImprintRectangle + + .export _ImprintRectangle - .include "jumptab.inc" - + .include "jumptab.inc" + _ImprintRectangle = ImprintRectangle diff --git a/libsrc/geos-common/graph/initdrawwindow.s b/libsrc/geos-common/graph/initdrawwindow.s index 31e479065..ec600eaea 100644 --- a/libsrc/geos-common/graph/initdrawwindow.s +++ b/libsrc/geos-common/graph/initdrawwindow.s @@ -6,18 +6,18 @@ ; void InitDrawWindow (struct window *myWindow); - .importzp ptr4 - .export _InitDrawWindow + .importzp ptr4 + .export _InitDrawWindow - .include "geossym.inc" + .include "geossym.inc" -_InitDrawWindow: ; a/x is a struct window* - sta ptr4 - stx ptr4+1 - ldy #0 +_InitDrawWindow: ; a/x is a struct window* + sta ptr4 + stx ptr4+1 + ldy #0 copyWin:lda (ptr4),y - sta r2L,y - iny - cpy #6 - bne copyWin - rts + sta r2L,y + iny + cpy #6 + bne copyWin + rts diff --git a/libsrc/geos-common/graph/invertline.s b/libsrc/geos-common/graph/invertline.s index dcc68d40a..baa4a6e5a 100644 --- a/libsrc/geos-common/graph/invertline.s +++ b/libsrc/geos-common/graph/invertline.s @@ -5,11 +5,11 @@ ; void InvertLine (char y, int xstart, int xend); - .import HLineRegs - .export _InvertLine + .import HLineRegs + .export _InvertLine - .include "jumptab.inc" - + .include "jumptab.inc" + _InvertLine: - jsr HLineRegs - jmp InvertLine + jsr HLineRegs + jmp InvertLine diff --git a/libsrc/geos-common/graph/invertrectangle.s b/libsrc/geos-common/graph/invertrectangle.s index 3e2b1c71a..084187255 100644 --- a/libsrc/geos-common/graph/invertrectangle.s +++ b/libsrc/geos-common/graph/invertrectangle.s @@ -5,9 +5,9 @@ ; void InvertRectangle (void); - .export _InvertRectangle - - .include "jumptab.inc" + .export _InvertRectangle + + .include "jumptab.inc" _InvertRectangle = InvertRectangle diff --git a/libsrc/geos-common/graph/loadcharset.s b/libsrc/geos-common/graph/loadcharset.s index a7e38a666..5ff4d923b 100644 --- a/libsrc/geos-common/graph/loadcharset.s +++ b/libsrc/geos-common/graph/loadcharset.s @@ -5,12 +5,12 @@ ; void LoadCharSet (struct fontdesc *myFont); - .export _LoadCharSet + .export _LoadCharSet - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _LoadCharSet: - sta r0L - stx r0H - jmp LoadCharSet + sta r0L + stx r0H + jmp LoadCharSet diff --git a/libsrc/geos-common/graph/pointregs.s b/libsrc/geos-common/graph/pointregs.s index edff38212..aa6939fbb 100644 --- a/libsrc/geos-common/graph/pointregs.s +++ b/libsrc/geos-common/graph/pointregs.s @@ -3,21 +3,21 @@ ; ; 29.10.99 - .importzp ptr4 - .export PointRegs + .importzp ptr4 + .export PointRegs - .include "geossym.inc" + .include "geossym.inc" -PointRegs: ; a/x is a struct pixel* - sta ptr4 - stx ptr4+1 - ldy #0 - lda (ptr4),y - sta r3L - iny - lda (ptr4),y - sta r3H - iny - lda (ptr4),y - sta r11L - rts +PointRegs: ; a/x is a struct pixel* + sta ptr4 + stx ptr4+1 + ldy #0 + lda (ptr4),y + sta r3L + iny + lda (ptr4),y + sta r3H + iny + lda (ptr4),y + sta r11L + rts diff --git a/libsrc/geos-common/graph/put_char.s b/libsrc/geos-common/graph/put_char.s index bc22a70cb..f34d7a178 100644 --- a/libsrc/geos-common/graph/put_char.s +++ b/libsrc/geos-common/graph/put_char.s @@ -5,16 +5,16 @@ ; void PutChar (char character, char y, int x); - .import popa - .export _PutChar + .import popa + .export _PutChar - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _PutChar: - sta r11L - stx r11H - jsr popa - sta r1H - jsr popa - jmp PutChar + sta r11L + stx r11H + jsr popa + sta r1H + jsr popa + jmp PutChar diff --git a/libsrc/geos-common/graph/putdecimal.s b/libsrc/geos-common/graph/putdecimal.s index f3602c3d4..06221e922 100644 --- a/libsrc/geos-common/graph/putdecimal.s +++ b/libsrc/geos-common/graph/putdecimal.s @@ -5,13 +5,13 @@ ; void PutDecimal (char style, unsigned value, char y, int x); - .import popa, popax - .import getintcharint - .export _PutDecimal + .import popa, popax + .import getintcharint + .export _PutDecimal - .include "jumptab.inc" + .include "jumptab.inc" _PutDecimal: - jsr getintcharint - jsr popa - jmp PutDecimal + jsr getintcharint + jsr popa + jmp PutDecimal diff --git a/libsrc/geos-common/graph/putstring.s b/libsrc/geos-common/graph/putstring.s index 4c333f3ab..ab027f1b4 100644 --- a/libsrc/geos-common/graph/putstring.s +++ b/libsrc/geos-common/graph/putstring.s @@ -3,14 +3,14 @@ ; ; 30.10.99 -; void PutString (char *mytxt, char y, int x); +; void PutString (char *mytxt, char y, int x); - .import popax, popa - .import getintcharint - .export _PutString + .import popax, popa + .import getintcharint + .export _PutString - .include "jumptab.inc" + .include "jumptab.inc" _PutString: - jsr getintcharint - jmp PutString + jsr getintcharint + jmp PutString diff --git a/libsrc/geos-common/graph/recoverline.s b/libsrc/geos-common/graph/recoverline.s index 6d4626cb3..edc366114 100644 --- a/libsrc/geos-common/graph/recoverline.s +++ b/libsrc/geos-common/graph/recoverline.s @@ -5,12 +5,12 @@ ; void RecoverLine (char y, int xstart, int xend); - .import HLineRegs - .export _RecoverLine - - .include "jumptab.inc" + .import HLineRegs + .export _RecoverLine + + .include "jumptab.inc" _RecoverLine: - jsr HLineRegs - jmp RecoverLine + jsr HLineRegs + jmp RecoverLine diff --git a/libsrc/geos-common/graph/recoverrectangle.s b/libsrc/geos-common/graph/recoverrectangle.s index 077b342e0..009ca81eb 100644 --- a/libsrc/geos-common/graph/recoverrectangle.s +++ b/libsrc/geos-common/graph/recoverrectangle.s @@ -4,10 +4,10 @@ ; 29.10.99 ; void RecoverRectangle (void); - - .export _RecoverRectangle + + .export _RecoverRectangle - .include "jumptab.inc" - + .include "jumptab.inc" + _RecoverRectangle = RecoverRectangle diff --git a/libsrc/geos-common/graph/rectangle.s b/libsrc/geos-common/graph/rectangle.s index f0f11e4e3..a9351c47e 100644 --- a/libsrc/geos-common/graph/rectangle.s +++ b/libsrc/geos-common/graph/rectangle.s @@ -5,8 +5,8 @@ ; void Rectangle (void); - .export _Rectangle - - .include "jumptab.inc" + .export _Rectangle + + .include "jumptab.inc" -_Rectangle = Rectangle +_Rectangle = Rectangle diff --git a/libsrc/geos-common/graph/setpattern.s b/libsrc/geos-common/graph/setpattern.s index d81019f32..24ea5e7fa 100644 --- a/libsrc/geos-common/graph/setpattern.s +++ b/libsrc/geos-common/graph/setpattern.s @@ -5,8 +5,8 @@ ; void SetPattern (char pattern); - .export _SetPattern + .export _SetPattern - .include "jumptab.inc" + .include "jumptab.inc" -_SetPattern = SetPattern +_SetPattern = SetPattern diff --git a/libsrc/geos-common/graph/testpoint.s b/libsrc/geos-common/graph/testpoint.s index 6bf28589a..f2dfb7b5d 100644 --- a/libsrc/geos-common/graph/testpoint.s +++ b/libsrc/geos-common/graph/testpoint.s @@ -3,17 +3,17 @@ ; ; 29.10.1999, 2.1.2003 -; char TestPoint (struct pixel *mypixel); +; char TestPoint (struct pixel *mypixel); - .import PointRegs - .import return0, return1 - .export _TestPoint + .import PointRegs + .import return0, return1 + .export _TestPoint - .include "jumptab.inc" - + .include "jumptab.inc" + _TestPoint: - jsr PointRegs - jsr TestPoint - bcc goFalse - jmp return1 + jsr PointRegs + jsr TestPoint + bcc goFalse + jmp return1 goFalse:jmp return0 diff --git a/libsrc/geos-common/graph/usesystemfont.s b/libsrc/geos-common/graph/usesystemfont.s index 3d72e7cf5..83960fd71 100644 --- a/libsrc/geos-common/graph/usesystemfont.s +++ b/libsrc/geos-common/graph/usesystemfont.s @@ -5,8 +5,8 @@ ; void UseSystemFont (void); - .export _UseSystemFont + .export _UseSystemFont - .include "jumptab.inc" + .include "jumptab.inc" -_UseSystemFont = UseSystemFont +_UseSystemFont = UseSystemFont diff --git a/libsrc/geos-common/graph/verticalline.s b/libsrc/geos-common/graph/verticalline.s index 12355aaab..01fb0b725 100644 --- a/libsrc/geos-common/graph/verticalline.s +++ b/libsrc/geos-common/graph/verticalline.s @@ -5,18 +5,18 @@ ; void VerticalLine (char pattern, char ystart, char yend, int x); - .import popa - .export _VerticalLine + .import popa + .export _VerticalLine - .include "jumptab.inc" - .include "geossym.inc" - + .include "jumptab.inc" + .include "geossym.inc" + _VerticalLine: - stx r4H - sta r4L - jsr popa - sta r3H - jsr popa - sta r3L - jsr popa - jmp VerticalLine + stx r4H + sta r4L + jsr popa + sta r3H + jsr popa + sta r3L + jsr popa + jmp VerticalLine diff --git a/libsrc/geos-common/memory/clearram.s b/libsrc/geos-common/memory/clearram.s index 3984f8a67..a656170fa 100644 --- a/libsrc/geos-common/memory/clearram.s +++ b/libsrc/geos-common/memory/clearram.s @@ -5,20 +5,20 @@ ; void * ClearRam (char *dest, int length); - .import DoublePop - .export _ClearRam + .import DoublePop + .export _ClearRam - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _ClearRam: - jsr DoublePop - pha - txa - pha - jsr ClearRam - pla - tax - pla - rts + jsr DoublePop + pha + txa + pha + jsr ClearRam + pla + tax + pla + rts diff --git a/libsrc/geos-common/memory/cmpfstring.s b/libsrc/geos-common/memory/cmpfstring.s index 4b5d42511..112d46a00 100644 --- a/libsrc/geos-common/memory/cmpfstring.s +++ b/libsrc/geos-common/memory/cmpfstring.s @@ -5,17 +5,17 @@ ; char CmpFString (char length, char *dest, char* source); - .import DoubleSPop, SetPtrXY - .import popa, return0, return1 - .export _CmpFString + .import DoubleSPop, SetPtrXY + .import popa, return0, return1 + .export _CmpFString - .include "jumptab.inc" + .include "jumptab.inc" _CmpFString: - jsr DoubleSPop - jsr popa - jsr SetPtrXY - jsr CmpFString - bne L1 - jmp return0 -L1: jmp return1 + jsr DoubleSPop + jsr popa + jsr SetPtrXY + jsr CmpFString + bne L1 + jmp return0 +L1: jmp return1 diff --git a/libsrc/geos-common/memory/cmpstring.s b/libsrc/geos-common/memory/cmpstring.s index fc4ba8c3d..ab5c66baf 100644 --- a/libsrc/geos-common/memory/cmpstring.s +++ b/libsrc/geos-common/memory/cmpstring.s @@ -5,15 +5,15 @@ ; char CmpString (char *dest, char* source); - .import DoubleSPop - .import return0, return1 - .export _CmpString + .import DoubleSPop + .import return0, return1 + .export _CmpString - .include "jumptab.inc" + .include "jumptab.inc" _CmpString: - jsr DoubleSPop - jsr CmpString - bne L1 - jmp return0 -L1: jmp return1 + jsr DoubleSPop + jsr CmpString + bne L1 + jmp return0 +L1: jmp return1 diff --git a/libsrc/geos-common/memory/copyfstring.s b/libsrc/geos-common/memory/copyfstring.s index 6d84e4e82..18182fa78 100644 --- a/libsrc/geos-common/memory/copyfstring.s +++ b/libsrc/geos-common/memory/copyfstring.s @@ -5,14 +5,14 @@ ; void CopyFString (char length, char *dest, char* source); - .import DoubleSPop, SetPtrXY - .import popa - .export _CopyFString + .import DoubleSPop, SetPtrXY + .import popa + .export _CopyFString - .include "jumptab.inc" + .include "jumptab.inc" _CopyFString: - jsr DoubleSPop - jsr popa - jsr SetPtrXY - jmp CopyFString + jsr DoubleSPop + jsr popa + jsr SetPtrXY + jmp CopyFString diff --git a/libsrc/geos-common/memory/copystring.s b/libsrc/geos-common/memory/copystring.s index 3f4941fbb..941f78f85 100644 --- a/libsrc/geos-common/memory/copystring.s +++ b/libsrc/geos-common/memory/copystring.s @@ -5,11 +5,11 @@ ; void CopyString (char *dest, char* source); - .import DoubleSPop - .export _CopyString + .import DoubleSPop + .export _CopyString - .include "jumptab.inc" + .include "jumptab.inc" _CopyString: - jsr DoubleSPop - jmp CopyString + jsr DoubleSPop + jmp CopyString diff --git a/libsrc/geos-common/memory/crc.s b/libsrc/geos-common/memory/crc.s index 69908b3f2..9ec2feb0c 100644 --- a/libsrc/geos-common/memory/crc.s +++ b/libsrc/geos-common/memory/crc.s @@ -5,16 +5,16 @@ ; int CRC (char *memory, int length); - .import DoublePop - .export _CRC + .import DoublePop + .export _CRC - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _CRC: - jsr DoublePop - jsr CRC - lda r2L - ldx r2H - rts - \ No newline at end of file + jsr DoublePop + jsr CRC + lda r2L + ldx r2H + rts + \ No newline at end of file diff --git a/libsrc/geos-common/memory/doublepop.s b/libsrc/geos-common/memory/doublepop.s index f5fdb548c..7e1f2ece9 100644 --- a/libsrc/geos-common/memory/doublepop.s +++ b/libsrc/geos-common/memory/doublepop.s @@ -3,15 +3,15 @@ ; ; 31.12.99 - .import popax - .export DoublePop + .import popax + .export DoublePop - .include "geossym.inc" + .include "geossym.inc" DoublePop: - sta r0L - stx r0H - jsr popax - sta r1L - stx r1H - rts + sta r0L + stx r0H + jsr popax + sta r1L + stx r1H + rts diff --git a/libsrc/geos-common/memory/doublespop.s b/libsrc/geos-common/memory/doublespop.s index e8541207c..f58beabfe 100644 --- a/libsrc/geos-common/memory/doublespop.s +++ b/libsrc/geos-common/memory/doublespop.s @@ -3,25 +3,25 @@ ; ; 22.12.99, 29.07.2000 - .import popax - .importzp ptr3, ptr4 - .export DoubleSPop - .export SetPtrXY + .import popax + .importzp ptr3, ptr4 + .export DoubleSPop + .export SetPtrXY - .include "geossym.inc" + .include "geossym.inc" DoubleSPop: - sta ptr4 - stx ptr4+1 - jsr popax - sta ptr3 - stx ptr3+1 -; rts + sta ptr4 + stx ptr4+1 + jsr popax + sta ptr3 + stx ptr3+1 +; rts ; ; SetPtrXY can be sometimes executed twice, but even this way it is few cycles ; faster... SetPtrXY: - ldx #ptr4 - ldy #ptr3 - rts + ldx #ptr4 + ldy #ptr3 + rts diff --git a/libsrc/geos-common/memory/fillram.s b/libsrc/geos-common/memory/fillram.s index d67b4f242..40d9db73d 100644 --- a/libsrc/geos-common/memory/fillram.s +++ b/libsrc/geos-common/memory/fillram.s @@ -5,25 +5,25 @@ ; void * FillRam (char *dest, char what, int length); - .import popa, popax - .export _FillRam + .import popa, popax + .export _FillRam - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _FillRam: - sta r0L - stx r0H - jsr popa - sta r2L - jsr popax - sta r1L - stx r1H - pha - txa - pha - jsr FillRam - pla - tax - pla - rts + sta r0L + stx r0H + jsr popa + sta r2L + jsr popax + sta r1L + stx r1H + pha + txa + pha + jsr FillRam + pla + tax + pla + rts diff --git a/libsrc/geos-common/memory/initram.s b/libsrc/geos-common/memory/initram.s index 19953694f..4edceddb9 100644 --- a/libsrc/geos-common/memory/initram.s +++ b/libsrc/geos-common/memory/initram.s @@ -5,12 +5,12 @@ ; void InitRam (struct inittab*); - .export _InitRam + .export _InitRam - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _InitRam: - sta r0L - stx r0H - jmp InitRam + sta r0L + stx r0H + jmp InitRam diff --git a/libsrc/geos-common/memory/movedata.s b/libsrc/geos-common/memory/movedata.s index c5134bef3..7c8a530be 100644 --- a/libsrc/geos-common/memory/movedata.s +++ b/libsrc/geos-common/memory/movedata.s @@ -5,22 +5,22 @@ ; void* MoveData (char* dest, char *source, int length); - .import popax - .export _MoveData + .import popax + .export _MoveData - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _MoveData: - sta r2L - stx r2H - jsr popax - sta r0L - stx r0H - jsr popax - sta r1L - stx r1H - jsr MoveData - lda r1L ; return dest ptr to be compatible with memmove and memcpy - ldx r1H - rts + sta r2L + stx r2H + jsr popax + sta r0L + stx r0H + jsr popax + sta r1L + stx r1H + jsr MoveData + lda r1L ; return dest ptr to be compatible with memmove and memcpy + ldx r1H + rts diff --git a/libsrc/geos-common/menuicon/doicons.s b/libsrc/geos-common/menuicon/doicons.s index 6213f9923..5ddf06d01 100644 --- a/libsrc/geos-common/menuicon/doicons.s +++ b/libsrc/geos-common/menuicon/doicons.s @@ -5,12 +5,12 @@ ; void DoIcons (struct icontab *myicons); - .export _DoIcons + .export _DoIcons - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _DoIcons: - sta r0L - stx r0H - jmp DoIcons \ No newline at end of file + sta r0L + stx r0H + jmp DoIcons \ No newline at end of file diff --git a/libsrc/geos-common/menuicon/domenu.s b/libsrc/geos-common/menuicon/domenu.s index fb741de1d..1624a3852 100644 --- a/libsrc/geos-common/menuicon/domenu.s +++ b/libsrc/geos-common/menuicon/domenu.s @@ -5,13 +5,13 @@ ; void DoMenu (struct menu *mymenu); - .export _DoMenu + .export _DoMenu - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _DoMenu: - sta r0L - stx r0H - lda #0 - jmp DoMenu \ No newline at end of file + sta r0L + stx r0H + lda #0 + jmp DoMenu \ No newline at end of file diff --git a/libsrc/geos-common/menuicon/dopreviousmenu.s b/libsrc/geos-common/menuicon/dopreviousmenu.s index 1b27e2622..5ac19b57a 100644 --- a/libsrc/geos-common/menuicon/dopreviousmenu.s +++ b/libsrc/geos-common/menuicon/dopreviousmenu.s @@ -5,8 +5,8 @@ ; void DoPreviousMenu (void); - .export _DoPreviousMenu + .export _DoPreviousMenu - .include "jumptab.inc" + .include "jumptab.inc" -_DoPreviousMenu = DoPreviousMenu \ No newline at end of file +_DoPreviousMenu = DoPreviousMenu \ No newline at end of file diff --git a/libsrc/geos-common/menuicon/gotofirstmenu.s b/libsrc/geos-common/menuicon/gotofirstmenu.s index 110061a4e..b5f2306db 100644 --- a/libsrc/geos-common/menuicon/gotofirstmenu.s +++ b/libsrc/geos-common/menuicon/gotofirstmenu.s @@ -5,8 +5,8 @@ ; void GotoFirstMenu (void); - .export _GotoFirstMenu + .export _GotoFirstMenu - .include "jumptab.inc" + .include "jumptab.inc" -_GotoFirstMenu = GotoFirstMenu \ No newline at end of file +_GotoFirstMenu = GotoFirstMenu \ No newline at end of file diff --git a/libsrc/geos-common/menuicon/recoverallmenus.s b/libsrc/geos-common/menuicon/recoverallmenus.s index 02af28d4c..03a8368bf 100644 --- a/libsrc/geos-common/menuicon/recoverallmenus.s +++ b/libsrc/geos-common/menuicon/recoverallmenus.s @@ -5,8 +5,8 @@ ; void RecoverAllMenus (void); - .export _RecoverAllMenus + .export _RecoverAllMenus - .include "jumptab.inc" + .include "jumptab.inc" _RecoverAllMenus = RecoverAllMenus \ No newline at end of file diff --git a/libsrc/geos-common/menuicon/recovermenu.s b/libsrc/geos-common/menuicon/recovermenu.s index e803eeb7d..638d03d16 100644 --- a/libsrc/geos-common/menuicon/recovermenu.s +++ b/libsrc/geos-common/menuicon/recovermenu.s @@ -5,8 +5,8 @@ ; void RecoverMenu (void); - .export _RecoverMenu + .export _RecoverMenu - .include "jumptab.inc" + .include "jumptab.inc" -_RecoverMenu = RecoverMenu \ No newline at end of file +_RecoverMenu = RecoverMenu \ No newline at end of file diff --git a/libsrc/geos-common/menuicon/redomenu.s b/libsrc/geos-common/menuicon/redomenu.s index 5c76abe05..44d62e807 100644 --- a/libsrc/geos-common/menuicon/redomenu.s +++ b/libsrc/geos-common/menuicon/redomenu.s @@ -5,8 +5,8 @@ ; void ReDoMenu (void); - .export _ReDoMenu + .export _ReDoMenu - .include "jumptab.inc" + .include "jumptab.inc" -_ReDoMenu = ReDoMenu \ No newline at end of file +_ReDoMenu = ReDoMenu \ No newline at end of file diff --git a/libsrc/geos-common/mousesprite/clearmousemode.s b/libsrc/geos-common/mousesprite/clearmousemode.s index a747b1435..01e659567 100644 --- a/libsrc/geos-common/mousesprite/clearmousemode.s +++ b/libsrc/geos-common/mousesprite/clearmousemode.s @@ -5,8 +5,8 @@ ; void ClearMouseMode (void); - .export _ClearMouseMode + .export _ClearMouseMode - .include "jumptab.inc" + .include "jumptab.inc" -_ClearMouseMode = ClearMouseMode \ No newline at end of file +_ClearMouseMode = ClearMouseMode \ No newline at end of file diff --git a/libsrc/geos-common/mousesprite/disablsprite.s b/libsrc/geos-common/mousesprite/disablsprite.s index c9f6d5266..95d298094 100644 --- a/libsrc/geos-common/mousesprite/disablsprite.s +++ b/libsrc/geos-common/mousesprite/disablsprite.s @@ -5,11 +5,11 @@ ; void DisablSprite (char spritenum); - .export _DisablSprite + .export _DisablSprite - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _DisablSprite: - sta r3L - jmp DisablSprite \ No newline at end of file + sta r3L + jmp DisablSprite \ No newline at end of file diff --git a/libsrc/geos-common/mousesprite/drawsprite.s b/libsrc/geos-common/mousesprite/drawsprite.s index 176cd296a..0f4d611c0 100644 --- a/libsrc/geos-common/mousesprite/drawsprite.s +++ b/libsrc/geos-common/mousesprite/drawsprite.s @@ -5,15 +5,15 @@ ; void DrawSprite (char spritenum, char *tab63 ); - .import popa - .export _DrawSprite + .import popa + .export _DrawSprite - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _DrawSprite: - sta r4L - stx r4H - jsr popa - sta r3L - jmp DrawSprite \ No newline at end of file + sta r4L + stx r4H + jsr popa + sta r3L + jmp DrawSprite \ No newline at end of file diff --git a/libsrc/geos-common/mousesprite/enablsprite.s b/libsrc/geos-common/mousesprite/enablsprite.s index 8712724b0..a271d2cdb 100644 --- a/libsrc/geos-common/mousesprite/enablsprite.s +++ b/libsrc/geos-common/mousesprite/enablsprite.s @@ -5,11 +5,11 @@ ; void EnablSprite (char spritenum); - .export _EnablSprite + .export _EnablSprite - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _EnablSprite: - sta r3L - jmp EnablSprite \ No newline at end of file + sta r3L + jmp EnablSprite \ No newline at end of file diff --git a/libsrc/geos-common/mousesprite/getnextchar.s b/libsrc/geos-common/mousesprite/getnextchar.s index ab495cd44..665905908 100644 --- a/libsrc/geos-common/mousesprite/getnextchar.s +++ b/libsrc/geos-common/mousesprite/getnextchar.s @@ -4,14 +4,14 @@ ; 21.12.1999, 2.1.2003 ; char GetNextChar (void); -; note that if it returns 0 (FALSE) then no characters are available +; note that if it returns 0 (FALSE) then no characters are available - .export _GetNextChar + .export _GetNextChar - .include "jumptab.inc" + .include "jumptab.inc" _GetNextChar: - jsr GetNextChar - ldx #0 - tay ; preserve Z flag - rts + jsr GetNextChar + ldx #0 + tay ; preserve Z flag + rts diff --git a/libsrc/geos-common/mousesprite/inittextprompt.s b/libsrc/geos-common/mousesprite/inittextprompt.s index 342ad0ce8..2fc5e58fc 100644 --- a/libsrc/geos-common/mousesprite/inittextprompt.s +++ b/libsrc/geos-common/mousesprite/inittextprompt.s @@ -5,8 +5,8 @@ ; void InitTextPrompt (char height); - .export _InitTextPrompt + .export _InitTextPrompt - .include "jumptab.inc" + .include "jumptab.inc" -_InitTextPrompt = InitTextPrompt \ No newline at end of file +_InitTextPrompt = InitTextPrompt \ No newline at end of file diff --git a/libsrc/geos-common/mousesprite/ismseinregion.s b/libsrc/geos-common/mousesprite/ismseinregion.s index c487e29cd..0617490c5 100644 --- a/libsrc/geos-common/mousesprite/ismseinregion.s +++ b/libsrc/geos-common/mousesprite/ismseinregion.s @@ -5,13 +5,13 @@ ; char IsMseInRegion (struct window *mywindow); - .import _InitDrawWindow - .export _IsMseInRegion - - .include "jumptab.inc" + .import _InitDrawWindow + .export _IsMseInRegion + + .include "jumptab.inc" _IsMseInRegion: - jsr _InitDrawWindow - jsr IsMseInRegion - ldx #0 - rts + jsr _InitDrawWindow + jsr IsMseInRegion + ldx #0 + rts diff --git a/libsrc/geos-common/mousesprite/mouseoff.s b/libsrc/geos-common/mousesprite/mouseoff.s index d60428c34..a918bb612 100644 --- a/libsrc/geos-common/mousesprite/mouseoff.s +++ b/libsrc/geos-common/mousesprite/mouseoff.s @@ -5,8 +5,8 @@ ; void MouseOff (void); - .export _MouseOff + .export _MouseOff - .include "jumptab.inc" + .include "jumptab.inc" -_MouseOff = MouseOff \ No newline at end of file +_MouseOff = MouseOff \ No newline at end of file diff --git a/libsrc/geos-common/mousesprite/mouseup.s b/libsrc/geos-common/mousesprite/mouseup.s index 1b4365271..45b4e83c2 100644 --- a/libsrc/geos-common/mousesprite/mouseup.s +++ b/libsrc/geos-common/mousesprite/mouseup.s @@ -5,8 +5,8 @@ ; void MouseUp (void); - .export _MouseUp + .export _MouseUp - .include "jumptab.inc" + .include "jumptab.inc" -_MouseUp = MouseUp \ No newline at end of file +_MouseUp = MouseUp \ No newline at end of file diff --git a/libsrc/geos-common/mousesprite/possprite.s b/libsrc/geos-common/mousesprite/possprite.s index e8e131f14..24e8bd14c 100644 --- a/libsrc/geos-common/mousesprite/possprite.s +++ b/libsrc/geos-common/mousesprite/possprite.s @@ -5,25 +5,25 @@ ; void PosSprite (char spritenum, struct pixel *position ); - .importzp ptr4 - .import popa - .export _PosSprite + .importzp ptr4 + .import popa + .export _PosSprite - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _PosSprite: - sta ptr4 - stx ptr4+1 - ldy #0 - lda (ptr4),y - sta r4L - iny - lda (ptr4),y - sta r4H - iny - lda (ptr4),y - sta r5L - jsr popa - sta r3L - jmp PosSprite \ No newline at end of file + sta ptr4 + stx ptr4+1 + ldy #0 + lda (ptr4),y + sta r4L + iny + lda (ptr4),y + sta r4H + iny + lda (ptr4),y + sta r5L + jsr popa + sta r3L + jmp PosSprite \ No newline at end of file diff --git a/libsrc/geos-common/mousesprite/promptoff.s b/libsrc/geos-common/mousesprite/promptoff.s index 9b63b6672..8b5734fd8 100644 --- a/libsrc/geos-common/mousesprite/promptoff.s +++ b/libsrc/geos-common/mousesprite/promptoff.s @@ -5,17 +5,17 @@ ; void PromptOff (void); - .export _PromptOff + .export _PromptOff - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _PromptOff: ; from 'The Hitchhiker's Guide To GEOS' - php - sei - jsr PromptOff - lda #0 - sta alphaFlag - plp - rts + php + sei + jsr PromptOff + lda #0 + sta alphaFlag + plp + rts diff --git a/libsrc/geos-common/mousesprite/prompton.s b/libsrc/geos-common/mousesprite/prompton.s index 3390bdf63..82f6e5a1b 100644 --- a/libsrc/geos-common/mousesprite/prompton.s +++ b/libsrc/geos-common/mousesprite/prompton.s @@ -5,20 +5,20 @@ ; void PromptOn (struct pixel *); - .importzp ptr4 - .export _PromptOn + .importzp ptr4 + .export _PromptOn - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _PromptOn: - sta ptr4 - stx ptr4+1 - ldy #0 + sta ptr4 + stx ptr4+1 + ldy #0 promptLp: - lda (ptr4),y - sta stringX,y - iny - cpy #3 - bne promptLp - jmp PromptOn + lda (ptr4),y + sta stringX,y + iny + cpy #3 + bne promptLp + jmp PromptOn diff --git a/libsrc/geos-common/mousesprite/startmousemode.s b/libsrc/geos-common/mousesprite/startmousemode.s index a64e1816e..06a547714 100644 --- a/libsrc/geos-common/mousesprite/startmousemode.s +++ b/libsrc/geos-common/mousesprite/startmousemode.s @@ -5,10 +5,10 @@ ; void StartMouseMode (void); - .export _StartMouseMode + .export _StartMouseMode - .include "jumptab.inc" + .include "jumptab.inc" _StartMouseMode: - clc - jmp StartMouseMode \ No newline at end of file + clc + jmp StartMouseMode \ No newline at end of file diff --git a/libsrc/geos-common/process/processblock.s b/libsrc/geos-common/process/processblock.s index 142cada00..84ead5993 100644 --- a/libsrc/geos-common/process/processblock.s +++ b/libsrc/geos-common/process/processblock.s @@ -3,20 +3,20 @@ ; ; 27.10.99 -; void InitProcesses (char number, struct process* proctab); +; void InitProcesses (char number, struct process* proctab); ; (rest) -; void BlockProcess (char number); -; void UnblockProcess (char number); +; void BlockProcess (char number); +; void UnblockProcess (char number); - .export _BlockProcess - .export _UnblockProcess + .export _BlockProcess + .export _UnblockProcess - .include "jumptab.inc" - + .include "jumptab.inc" + _BlockProcess: - tax - jmp BlockProcess - + tax + jmp BlockProcess + _UnblockProcess: - tax - jmp UnblockProcess + tax + jmp UnblockProcess diff --git a/libsrc/geos-common/process/processfreeze.s b/libsrc/geos-common/process/processfreeze.s index 3fcf896f0..bda914bdc 100644 --- a/libsrc/geos-common/process/processfreeze.s +++ b/libsrc/geos-common/process/processfreeze.s @@ -3,18 +3,18 @@ ; ; 27.10.99 -; void FreezeProcess (char number); -; void UnfreezeProcess (char number); +; void FreezeProcess (char number); +; void UnfreezeProcess (char number); - .export _FreezeProcess - .export _UnfreezeProcess + .export _FreezeProcess + .export _UnfreezeProcess - .include "jumptab.inc" - + .include "jumptab.inc" + _FreezeProcess: - tax - jmp FreezeProcess - + tax + jmp FreezeProcess + _UnfreezeProcess: - tax - jmp UnfreezeProcess + tax + jmp UnfreezeProcess diff --git a/libsrc/geos-common/process/processinitrestartenable.s b/libsrc/geos-common/process/processinitrestartenable.s index 75b804c77..800c2dc5f 100644 --- a/libsrc/geos-common/process/processinitrestartenable.s +++ b/libsrc/geos-common/process/processinitrestartenable.s @@ -3,28 +3,28 @@ ; ; 27.10.99 -; void InitProcesses (char number, struct process* proctab); -; void RestartProcess (char number); -; void EnableProcess (char number); +; void InitProcesses (char number, struct process* proctab); +; void RestartProcess (char number); +; void EnableProcess (char number); - .import popa - .export _InitProcesses - .export _RestartProcess - .export _EnableProcess + .import popa + .export _InitProcesses + .export _RestartProcess + .export _EnableProcess - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _InitProcesses: - sta r0L - stx r0H - jsr popa - jmp InitProcesses - + sta r0L + stx r0H + jsr popa + jmp InitProcesses + _RestartProcess: - tax - jmp RestartProcess - + tax + jmp RestartProcess + _EnableProcess: - tax - jmp EnableProcess + tax + jmp EnableProcess diff --git a/libsrc/geos-common/process/processsleep.s b/libsrc/geos-common/process/processsleep.s index 3abb39cf7..41098f5e1 100644 --- a/libsrc/geos-common/process/processsleep.s +++ b/libsrc/geos-common/process/processsleep.s @@ -5,30 +5,30 @@ ; void Sleep (int jiffies); - .importzp ptr1 - .importzp tmp1 - .export _Sleep + .importzp ptr1 + .importzp tmp1 + .export _Sleep - .include "jumptab.inc" - .include "geossym.inc" + .include "jumptab.inc" + .include "geossym.inc" _SleepExit: - jsr Sleep ; call Sleep - ldx tmp1 - txs ; restore stack pointer - jmp (ptr1) ; when timeouts control will reach here + jsr Sleep ; call Sleep + ldx tmp1 + txs ; restore stack pointer + jmp (ptr1) ; when timeouts control will reach here _Sleep: - sta r0L ; store data - stx r0H - pla - sta ptr1 - pla - sta ptr1+1 ; preserve return address - inc ptr1 - bne @L0 - inc ptr1+1 ; fix return address -@L0: tsx - stx tmp1 ; preserve stack pointer - jsr _SleepExit ; call Sleep - jmp MainLoop ; immediate return here - go to idle loop + sta r0L ; store data + stx r0H + pla + sta ptr1 + pla + sta ptr1+1 ; preserve return address + inc ptr1 + bne @L0 + inc ptr1+1 ; fix return address +@L0: tsx + stx tmp1 ; preserve stack pointer + jsr _SleepExit ; call Sleep + jmp MainLoop ; immediate return here - go to idle loop diff --git a/libsrc/geos-common/runtime/call.s b/libsrc/geos-common/runtime/call.s index 5dd59f782..dadd13e23 100644 --- a/libsrc/geos-common/runtime/call.s +++ b/libsrc/geos-common/runtime/call.s @@ -5,8 +5,8 @@ ; CC65 runtime: call function via pointer in ax ; - .export callax + .export callax .include "jumptab.inc" -callax = CallRoutine +callax = CallRoutine diff --git a/libsrc/geos-common/system/callroutine.s b/libsrc/geos-common/system/callroutine.s index 808699525..54de4cac7 100644 --- a/libsrc/geos-common/system/callroutine.s +++ b/libsrc/geos-common/system/callroutine.s @@ -5,8 +5,8 @@ ; void CallRoutine (myRoutine); - .export _CallRoutine + .export _CallRoutine - .include "jumptab.inc" + .include "jumptab.inc" -_CallRoutine = CallRoutine \ No newline at end of file +_CallRoutine = CallRoutine \ No newline at end of file diff --git a/libsrc/geos-common/system/crt0.s b/libsrc/geos-common/system/crt0.s index aed4b72a5..0e82031af 100644 --- a/libsrc/geos-common/system/crt0.s +++ b/libsrc/geos-common/system/crt0.s @@ -4,23 +4,23 @@ ; Maciej 'YTM/Elysium' Witkowiak ; 26.10.99, 10.3.2000, 15.8.2001, 23.12.2002 - .export _exit - .export __STARTUP__ : absolute = 1 ; Mark as startup - .import __STACKADDR__, __STACKSIZE__ ; Linker generated - .import __BACKBUFSIZE__ ; Linker generated - .import initlib, donelib - .import callmain - .import zerobss - .importzp sp + .export _exit + .export __STARTUP__ : absolute = 1 ; Mark as startup + .import __STACKADDR__, __STACKSIZE__ ; Linker generated + .import __BACKBUFSIZE__ ; Linker generated + .import initlib, donelib + .import callmain + .import zerobss + .importzp sp - .include "jumptab.inc" - .include "geossym.inc" - .include "const.inc" + .include "jumptab.inc" + .include "geossym.inc" + .include "const.inc" ; ------------------------------------------------------------------------ ; Place the startup code in a special segment. -.segment "STARTUP" +.segment "STARTUP" ; GEOS 64/128 initializes the screen before starting an application while ; Apple GEOS does not. In order to provide identical startup conditions @@ -28,40 +28,40 @@ ; the pattern and dispBufferOn even on GEOS 64/128 although we don't use ; them here. - lda #2 ; Checkerboard pattern - jsr SetPattern - lda #<(ST_WR_FORE | .MIN (ST_WR_BACK, __BACKBUFSIZE__)) - sta dispBufferOn + lda #2 ; Checkerboard pattern + jsr SetPattern + lda #<(ST_WR_FORE | .MIN (ST_WR_BACK, __BACKBUFSIZE__)) + sta dispBufferOn .ifdef __GEOS_APPLE__ - jsr i_Rectangle - .byte 0 - .byte SC_PIX_HEIGHT-1 - .word 0 - .word SC_PIX_WIDTH-1 + jsr i_Rectangle + .byte 0 + .byte SC_PIX_HEIGHT-1 + .word 0 + .word SC_PIX_WIDTH-1 .endif ; Clear the BSS data. - jsr zerobss + jsr zerobss ; Setup stack. - lda #<(__STACKADDR__ + __STACKSIZE__) - ldx #>(__STACKADDR__ + __STACKSIZE__) - sta sp - stx sp+1 + lda #<(__STACKADDR__ + __STACKSIZE__) + ldx #>(__STACKADDR__ + __STACKSIZE__) + sta sp + stx sp+1 ; Call module constructors. - jsr initlib + jsr initlib ; Push arguments and call main(). - cli - jsr callmain + cli + jsr callmain ; Call module destructors. -_exit: jsr donelib +_exit: jsr donelib - jmp EnterDeskTop ; Return control to the system + jmp EnterDeskTop ; Return control to the system diff --git a/libsrc/geos-common/system/ctype.s b/libsrc/geos-common/system/ctype.s index 1639e0161..cc0cc98b3 100644 --- a/libsrc/geos-common/system/ctype.s +++ b/libsrc/geos-common/system/ctype.s @@ -5,7 +5,7 @@ ; Character specification table. ; - .include "ctype.inc" + .include "ctype.inc" .rodata @@ -23,259 +23,259 @@ ; * We save some code in the isxxx functions. __ctype: - .byte CT_CTRL ; 0/00 ____NULL___ - .byte CT_CTRL ; 1/01 ____N/A____ - .byte CT_CTRL ; 2/02 ____N/A____ - .byte CT_CTRL ; 3/03 ____N/A____ - .byte CT_CTRL ; 4/04 ____N/A____ - .byte CT_CTRL ; 5/05 ____N/A____ - .byte CT_CTRL ; 6/06 ____N/A____ - .byte CT_CTRL ; 7/07 ____N/A____ - .byte CT_CTRL ; 8/08 __BAKSPACE_ - .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB ; 9/09 __FWDSPACE_ - .byte CT_CTRL | CT_OTHER_WS ; 10/0a _____LF____ - .byte CT_CTRL ; 11/0b ____HOME___ - .byte CT_CTRL ; 12/0c ___UPLINE__ - .byte CT_CTRL | CT_OTHER_WS ; 13/0d _____CR____ - .byte CT_CTRL ; 14/0e __ULINEON__ - .byte CT_CTRL ; 15/0f __ULINEOFF_ - .byte CT_CTRL ; 16/10 _ESC_GRAPH_ - .byte CT_CTRL ; 17/11 ____N/A____ - .byte CT_CTRL ; 18/12 ___REVON___ - .byte CT_CTRL ; 19/13 ___REVOFF__ - .byte CT_CTRL ; 20/14 ___GOTOX___ - .byte CT_CTRL ; 21/15 ___GOTOY___ - .byte CT_CTRL ; 22/16 ___GOTOXY__ - .byte CT_CTRL ; 23/17 _NEWCRDSET_ - .byte CT_CTRL ; 24/18 ___BOLDON__ - .byte CT_CTRL ; 25/19 __ITALICON_ - .byte CT_CTRL ; 26/1a _OUTLINEON_ - .byte CT_CTRL ; 27/1b _PLAINTEXT_ - .byte CT_CTRL ; 28/1c ____N/A____ - .byte CT_CTRL ; 29/1d ____N/A____ - .byte CT_CTRL ; 30/1e ____N/A____ - .byte CT_CTRL ; 31/1f ____N/A____ - .byte CT_SPACE_TAB | CT_SPACE ; 32/20 ___SPACE___ - .byte CT_NONE ; 33/21 _____!_____ - .byte CT_NONE ; 34/22 _____"_____ - .byte CT_NONE ; 35/23 _____#_____ - .byte CT_NONE ; 36/24 _____$_____ - .byte CT_NONE ; 37/25 _____%_____ - .byte CT_NONE ; 38/26 _____&_____ - .byte CT_NONE ; 39/27 _____'_____ - .byte CT_NONE ; 40/28 _____(_____ - .byte CT_NONE ; 41/29 _____)_____ - .byte CT_NONE ; 42/2a _____*_____ - .byte CT_NONE ; 43/2b _____+_____ - .byte CT_NONE ; 44/2c _____,_____ - .byte CT_NONE ; 45/2d _____-_____ - .byte CT_NONE ; 46/2e _____._____ - .byte CT_NONE ; 47/2f _____/_____ - .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ - .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ - .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ - .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ - .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ - .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ - .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ - .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ - .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ - .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ - .byte CT_NONE ; 58/3a _____:_____ - .byte CT_NONE ; 59/3b _____;_____ - .byte CT_NONE ; 60/3c _____<_____ - .byte CT_NONE ; 61/3d _____=_____ - .byte CT_NONE ; 62/3e _____>_____ - .byte CT_NONE ; 63/3f _____?_____ - .byte CT_NONE ; 64/40 _____@_____ - .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____ - .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____ - .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____ - .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____ - .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____ - .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____ - .byte CT_UPPER ; 71/47 _____G_____ - .byte CT_UPPER ; 72/48 _____H_____ - .byte CT_UPPER ; 73/49 _____I_____ - .byte CT_UPPER ; 74/4a _____J_____ - .byte CT_UPPER ; 75/4b _____K_____ - .byte CT_UPPER ; 76/4c _____L_____ - .byte CT_UPPER ; 77/4d _____M_____ - .byte CT_UPPER ; 78/4e _____N_____ - .byte CT_UPPER ; 79/4f _____O_____ - .byte CT_UPPER ; 80/50 _____P_____ - .byte CT_UPPER ; 81/51 _____Q_____ - .byte CT_UPPER ; 82/52 _____R_____ - .byte CT_UPPER ; 83/53 _____S_____ - .byte CT_UPPER ; 84/54 _____T_____ - .byte CT_UPPER ; 85/55 _____U_____ - .byte CT_UPPER ; 86/56 _____V_____ - .byte CT_UPPER ; 87/57 _____W_____ - .byte CT_UPPER ; 88/58 _____X_____ - .byte CT_UPPER ; 89/59 _____Y_____ - .byte CT_UPPER ; 90/5a _____Z_____ - .byte CT_NONE ; 91/5b _____[_____ - .byte CT_NONE ; 92/5c _____\_____ - .byte CT_NONE ; 93/5d _____]_____ - .byte CT_NONE ; 94/5e _____^_____ - .byte CT_NONE ; 95/5f _UNDERLINE_ - .byte CT_NONE ; 96/60 _____`_____ - .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____ - .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____ - .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____ - .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____ - .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____ - .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____ - .byte CT_LOWER ; 103/67 _____g_____ - .byte CT_LOWER ; 104/68 _____h_____ - .byte CT_LOWER ; 105/69 _____i_____ - .byte CT_LOWER ; 106/6a _____j_____ - .byte CT_LOWER ; 107/6b _____k_____ - .byte CT_LOWER ; 108/6c _____l_____ - .byte CT_LOWER ; 109/6d _____m_____ - .byte CT_LOWER ; 110/6e _____n_____ - .byte CT_LOWER ; 111/6f _____o_____ - .byte CT_LOWER ; 112/70 _____p_____ - .byte CT_LOWER ; 113/71 _____q_____ - .byte CT_LOWER ; 114/72 _____r_____ - .byte CT_LOWER ; 115/73 _____s_____ - .byte CT_LOWER ; 116/74 _____t_____ - .byte CT_LOWER ; 117/75 _____u_____ - .byte CT_LOWER ; 118/76 _____v_____ - .byte CT_LOWER ; 119/77 _____w_____ - .byte CT_LOWER ; 120/78 _____x_____ - .byte CT_LOWER ; 121/79 _____y_____ - .byte CT_LOWER ; 122/7a _____z_____ - .byte CT_NONE ; 123/7b _____{_____ - .byte CT_NONE ; 124/7c _____|_____ - .byte CT_NONE ; 125/7d _____}_____ - .byte CT_NONE ; 126/7e _____~_____ - .byte CT_CTRL ; 127/7f __USELAST__ - .byte CT_NONE ; 128/80 __SHORTCUT_ - .byte CT_NONE ; 129/81 ____N/A____ - .byte CT_NONE ; 130/82 ____N/A____ - .byte CT_NONE ; 131/83 ____N/A____ - .byte CT_NONE ; 132/84 ____N/A____ - .byte CT_NONE ; 133/85 ____N/A____ - .byte CT_NONE ; 134/86 ____N/A____ - .byte CT_NONE ; 135/87 ____N/A____ - .byte CT_NONE ; 136/88 ____N/A____ - .byte CT_NONE ; 137/89 ____N/A____ - .byte CT_NONE ; 138/8a ____N/A____ - .byte CT_NONE ; 139/8b ____N/A____ - .byte CT_NONE ; 140/8c ____N/A____ - .byte CT_NONE ; 141/8d ____N/A____ - .byte CT_NONE ; 142/8e ____N/A____ - .byte CT_NONE ; 143/8f ____N/A____ - .byte CT_NONE ; 144/90 ____N/A____ - .byte CT_NONE ; 145/91 ____N/A____ - .byte CT_NONE ; 146/92 ____N/A____ - .byte CT_NONE ; 147/93 ____N/A____ - .byte CT_NONE ; 148/94 ____N/A____ - .byte CT_NONE ; 149/95 ____N/A____ - .byte CT_NONE ; 150/96 ____N/A____ - .byte CT_NONE ; 151/97 ____N/A____ - .byte CT_NONE ; 152/98 ____N/A____ - .byte CT_NONE ; 153/99 ____N/A____ - .byte CT_NONE ; 154/9a ____N/A____ - .byte CT_NONE ; 155/9b ____N/A____ - .byte CT_NONE ; 156/9c ____N/A____ - .byte CT_NONE ; 157/9d ____N/A____ - .byte CT_NONE ; 158/9e ____N/A____ - .byte CT_NONE ; 159/9f ____N/A____ - .byte CT_NONE ; 160/a0 ____N/A____ - .byte CT_NONE ; 161/a1 ____N/A____ - .byte CT_NONE ; 162/a2 ____N/A____ - .byte CT_NONE ; 163/a3 ____N/A____ - .byte CT_NONE ; 164/a4 ____N/A____ - .byte CT_NONE ; 165/a5 ____N/A____ - .byte CT_NONE ; 166/a6 ____N/A____ - .byte CT_NONE ; 167/a7 ____N/A____ - .byte CT_NONE ; 168/a8 ____N/A____ - .byte CT_NONE ; 169/a9 ____N/A____ - .byte CT_NONE ; 170/aa ____N/A____ - .byte CT_NONE ; 171/ab ____N/A____ - .byte CT_NONE ; 172/ac ____N/A____ - .byte CT_NONE ; 173/ad ____N/A____ - .byte CT_NONE ; 174/ae ____N/A____ - .byte CT_NONE ; 175/af ____N/A____ - .byte CT_NONE ; 176/b0 ____N/A____ - .byte CT_NONE ; 177/b1 ____N/A____ - .byte CT_NONE ; 178/b2 ____N/A____ - .byte CT_NONE ; 179/b3 ____N/A____ - .byte CT_NONE ; 180/b4 ____N/A____ - .byte CT_NONE ; 181/b5 ____N/A____ - .byte CT_NONE ; 182/b6 ____N/A____ - .byte CT_NONE ; 183/b7 ____N/A____ - .byte CT_NONE ; 184/b8 ____N/A____ - .byte CT_NONE ; 185/b9 ____N/A____ - .byte CT_NONE ; 186/ba ____N/A____ - .byte CT_NONE ; 187/bb ____N/A____ - .byte CT_NONE ; 188/bc ____N/A____ - .byte CT_NONE ; 189/bd ____N/A____ - .byte CT_NONE ; 190/be ____N/A____ - .byte CT_NONE ; 191/bf ____N/A____ - .byte CT_NONE ; 192/c0 ____N/A____ - .byte CT_NONE ; 193/c1 ____N/A____ - .byte CT_NONE ; 194/c2 ____N/A____ - .byte CT_NONE ; 195/c3 ____N/A____ - .byte CT_NONE ; 196/c4 ____N/A____ - .byte CT_NONE ; 197/c5 ____N/A____ - .byte CT_NONE ; 198/c6 ____N/A____ - .byte CT_NONE ; 199/c7 ____N/A____ - .byte CT_NONE ; 200/c8 ____N/A____ - .byte CT_NONE ; 201/c9 ____N/A____ - .byte CT_NONE ; 202/ca ____N/A____ - .byte CT_NONE ; 203/cb ____N/A____ - .byte CT_NONE ; 204/cc ____N/A____ - .byte CT_NONE ; 205/cd ____N/A____ - .byte CT_NONE ; 206/ce ____N/A____ - .byte CT_NONE ; 207/cf ____N/A____ - .byte CT_NONE ; 208/d0 ____N/A____ - .byte CT_NONE ; 209/d1 ____N/A____ - .byte CT_NONE ; 210/d2 ____N/A____ - .byte CT_NONE ; 211/d3 ____N/A____ - .byte CT_NONE ; 212/d4 ____N/A____ - .byte CT_NONE ; 213/d5 ____N/A____ - .byte CT_NONE ; 214/d6 ____N/A____ - .byte CT_NONE ; 215/d7 ____N/A____ - .byte CT_NONE ; 216/d8 ____N/A____ - .byte CT_NONE ; 217/d9 ____N/A____ - .byte CT_NONE ; 218/da ____N/A____ - .byte CT_NONE ; 219/db ____N/A____ - .byte CT_NONE ; 220/dc ____N/A____ - .byte CT_NONE ; 221/dd ____N/A____ - .byte CT_NONE ; 222/de ____N/A____ - .byte CT_NONE ; 223/df ____N/A____ - .byte CT_NONE ; 224/e0 ____N/A____ - .byte CT_NONE ; 225/e1 ____N/A____ - .byte CT_NONE ; 226/e2 ____N/A____ - .byte CT_NONE ; 227/e3 ____N/A____ - .byte CT_NONE ; 228/e4 ____N/A____ - .byte CT_NONE ; 229/e5 ____N/A____ - .byte CT_NONE ; 230/e6 ____N/A____ - .byte CT_NONE ; 231/e7 ____N/A____ - .byte CT_NONE ; 232/e8 ____N/A____ - .byte CT_NONE ; 233/e9 ____N/A____ - .byte CT_NONE ; 234/ea ____N/A____ - .byte CT_NONE ; 235/eb ____N/A____ - .byte CT_NONE ; 236/ec ____N/A____ - .byte CT_NONE ; 237/ed ____N/A____ - .byte CT_NONE ; 238/ee ____N/A____ - .byte CT_NONE ; 239/ef ____N/A____ - .byte CT_NONE ; 240/f0 ____N/A____ - .byte CT_NONE ; 241/f1 ____N/A____ - .byte CT_NONE ; 242/f2 ____N/A____ - .byte CT_NONE ; 243/f3 ____N/A____ - .byte CT_NONE ; 244/f4 ____N/A____ - .byte CT_NONE ; 245/f5 ____N/A____ - .byte CT_NONE ; 246/f6 ____N/A____ - .byte CT_NONE ; 247/f7 ____N/A____ - .byte CT_NONE ; 248/f8 ____N/A____ - .byte CT_NONE ; 249/f9 ____N/A____ - .byte CT_NONE ; 250/fa ____N/A____ - .byte CT_NONE ; 251/fb ____N/A____ - .byte CT_NONE ; 252/fc ____N/A____ - .byte CT_NONE ; 253/fd ____N/A____ - .byte CT_NONE ; 254/fe ____N/A____ - .byte CT_NONE ; 255/ff ____N/A____ + .byte CT_CTRL ; 0/00 ____NULL___ + .byte CT_CTRL ; 1/01 ____N/A____ + .byte CT_CTRL ; 2/02 ____N/A____ + .byte CT_CTRL ; 3/03 ____N/A____ + .byte CT_CTRL ; 4/04 ____N/A____ + .byte CT_CTRL ; 5/05 ____N/A____ + .byte CT_CTRL ; 6/06 ____N/A____ + .byte CT_CTRL ; 7/07 ____N/A____ + .byte CT_CTRL ; 8/08 __BAKSPACE_ + .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB ; 9/09 __FWDSPACE_ + .byte CT_CTRL | CT_OTHER_WS ; 10/0a _____LF____ + .byte CT_CTRL ; 11/0b ____HOME___ + .byte CT_CTRL ; 12/0c ___UPLINE__ + .byte CT_CTRL | CT_OTHER_WS ; 13/0d _____CR____ + .byte CT_CTRL ; 14/0e __ULINEON__ + .byte CT_CTRL ; 15/0f __ULINEOFF_ + .byte CT_CTRL ; 16/10 _ESC_GRAPH_ + .byte CT_CTRL ; 17/11 ____N/A____ + .byte CT_CTRL ; 18/12 ___REVON___ + .byte CT_CTRL ; 19/13 ___REVOFF__ + .byte CT_CTRL ; 20/14 ___GOTOX___ + .byte CT_CTRL ; 21/15 ___GOTOY___ + .byte CT_CTRL ; 22/16 ___GOTOXY__ + .byte CT_CTRL ; 23/17 _NEWCRDSET_ + .byte CT_CTRL ; 24/18 ___BOLDON__ + .byte CT_CTRL ; 25/19 __ITALICON_ + .byte CT_CTRL ; 26/1a _OUTLINEON_ + .byte CT_CTRL ; 27/1b _PLAINTEXT_ + .byte CT_CTRL ; 28/1c ____N/A____ + .byte CT_CTRL ; 29/1d ____N/A____ + .byte CT_CTRL ; 30/1e ____N/A____ + .byte CT_CTRL ; 31/1f ____N/A____ + .byte CT_SPACE_TAB | CT_SPACE ; 32/20 ___SPACE___ + .byte CT_NONE ; 33/21 _____!_____ + .byte CT_NONE ; 34/22 _____"_____ + .byte CT_NONE ; 35/23 _____#_____ + .byte CT_NONE ; 36/24 _____$_____ + .byte CT_NONE ; 37/25 _____%_____ + .byte CT_NONE ; 38/26 _____&_____ + .byte CT_NONE ; 39/27 _____'_____ + .byte CT_NONE ; 40/28 _____(_____ + .byte CT_NONE ; 41/29 _____)_____ + .byte CT_NONE ; 42/2a _____*_____ + .byte CT_NONE ; 43/2b _____+_____ + .byte CT_NONE ; 44/2c _____,_____ + .byte CT_NONE ; 45/2d _____-_____ + .byte CT_NONE ; 46/2e _____._____ + .byte CT_NONE ; 47/2f _____/_____ + .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ + .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ + .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ + .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ + .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ + .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ + .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ + .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ + .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ + .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ + .byte CT_NONE ; 58/3a _____:_____ + .byte CT_NONE ; 59/3b _____;_____ + .byte CT_NONE ; 60/3c _____<_____ + .byte CT_NONE ; 61/3d _____=_____ + .byte CT_NONE ; 62/3e _____>_____ + .byte CT_NONE ; 63/3f _____?_____ + .byte CT_NONE ; 64/40 _____@_____ + .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____ + .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____ + .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____ + .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____ + .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____ + .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____ + .byte CT_UPPER ; 71/47 _____G_____ + .byte CT_UPPER ; 72/48 _____H_____ + .byte CT_UPPER ; 73/49 _____I_____ + .byte CT_UPPER ; 74/4a _____J_____ + .byte CT_UPPER ; 75/4b _____K_____ + .byte CT_UPPER ; 76/4c _____L_____ + .byte CT_UPPER ; 77/4d _____M_____ + .byte CT_UPPER ; 78/4e _____N_____ + .byte CT_UPPER ; 79/4f _____O_____ + .byte CT_UPPER ; 80/50 _____P_____ + .byte CT_UPPER ; 81/51 _____Q_____ + .byte CT_UPPER ; 82/52 _____R_____ + .byte CT_UPPER ; 83/53 _____S_____ + .byte CT_UPPER ; 84/54 _____T_____ + .byte CT_UPPER ; 85/55 _____U_____ + .byte CT_UPPER ; 86/56 _____V_____ + .byte CT_UPPER ; 87/57 _____W_____ + .byte CT_UPPER ; 88/58 _____X_____ + .byte CT_UPPER ; 89/59 _____Y_____ + .byte CT_UPPER ; 90/5a _____Z_____ + .byte CT_NONE ; 91/5b _____[_____ + .byte CT_NONE ; 92/5c _____\_____ + .byte CT_NONE ; 93/5d _____]_____ + .byte CT_NONE ; 94/5e _____^_____ + .byte CT_NONE ; 95/5f _UNDERLINE_ + .byte CT_NONE ; 96/60 _____`_____ + .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____ + .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____ + .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____ + .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____ + .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____ + .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____ + .byte CT_LOWER ; 103/67 _____g_____ + .byte CT_LOWER ; 104/68 _____h_____ + .byte CT_LOWER ; 105/69 _____i_____ + .byte CT_LOWER ; 106/6a _____j_____ + .byte CT_LOWER ; 107/6b _____k_____ + .byte CT_LOWER ; 108/6c _____l_____ + .byte CT_LOWER ; 109/6d _____m_____ + .byte CT_LOWER ; 110/6e _____n_____ + .byte CT_LOWER ; 111/6f _____o_____ + .byte CT_LOWER ; 112/70 _____p_____ + .byte CT_LOWER ; 113/71 _____q_____ + .byte CT_LOWER ; 114/72 _____r_____ + .byte CT_LOWER ; 115/73 _____s_____ + .byte CT_LOWER ; 116/74 _____t_____ + .byte CT_LOWER ; 117/75 _____u_____ + .byte CT_LOWER ; 118/76 _____v_____ + .byte CT_LOWER ; 119/77 _____w_____ + .byte CT_LOWER ; 120/78 _____x_____ + .byte CT_LOWER ; 121/79 _____y_____ + .byte CT_LOWER ; 122/7a _____z_____ + .byte CT_NONE ; 123/7b _____{_____ + .byte CT_NONE ; 124/7c _____|_____ + .byte CT_NONE ; 125/7d _____}_____ + .byte CT_NONE ; 126/7e _____~_____ + .byte CT_CTRL ; 127/7f __USELAST__ + .byte CT_NONE ; 128/80 __SHORTCUT_ + .byte CT_NONE ; 129/81 ____N/A____ + .byte CT_NONE ; 130/82 ____N/A____ + .byte CT_NONE ; 131/83 ____N/A____ + .byte CT_NONE ; 132/84 ____N/A____ + .byte CT_NONE ; 133/85 ____N/A____ + .byte CT_NONE ; 134/86 ____N/A____ + .byte CT_NONE ; 135/87 ____N/A____ + .byte CT_NONE ; 136/88 ____N/A____ + .byte CT_NONE ; 137/89 ____N/A____ + .byte CT_NONE ; 138/8a ____N/A____ + .byte CT_NONE ; 139/8b ____N/A____ + .byte CT_NONE ; 140/8c ____N/A____ + .byte CT_NONE ; 141/8d ____N/A____ + .byte CT_NONE ; 142/8e ____N/A____ + .byte CT_NONE ; 143/8f ____N/A____ + .byte CT_NONE ; 144/90 ____N/A____ + .byte CT_NONE ; 145/91 ____N/A____ + .byte CT_NONE ; 146/92 ____N/A____ + .byte CT_NONE ; 147/93 ____N/A____ + .byte CT_NONE ; 148/94 ____N/A____ + .byte CT_NONE ; 149/95 ____N/A____ + .byte CT_NONE ; 150/96 ____N/A____ + .byte CT_NONE ; 151/97 ____N/A____ + .byte CT_NONE ; 152/98 ____N/A____ + .byte CT_NONE ; 153/99 ____N/A____ + .byte CT_NONE ; 154/9a ____N/A____ + .byte CT_NONE ; 155/9b ____N/A____ + .byte CT_NONE ; 156/9c ____N/A____ + .byte CT_NONE ; 157/9d ____N/A____ + .byte CT_NONE ; 158/9e ____N/A____ + .byte CT_NONE ; 159/9f ____N/A____ + .byte CT_NONE ; 160/a0 ____N/A____ + .byte CT_NONE ; 161/a1 ____N/A____ + .byte CT_NONE ; 162/a2 ____N/A____ + .byte CT_NONE ; 163/a3 ____N/A____ + .byte CT_NONE ; 164/a4 ____N/A____ + .byte CT_NONE ; 165/a5 ____N/A____ + .byte CT_NONE ; 166/a6 ____N/A____ + .byte CT_NONE ; 167/a7 ____N/A____ + .byte CT_NONE ; 168/a8 ____N/A____ + .byte CT_NONE ; 169/a9 ____N/A____ + .byte CT_NONE ; 170/aa ____N/A____ + .byte CT_NONE ; 171/ab ____N/A____ + .byte CT_NONE ; 172/ac ____N/A____ + .byte CT_NONE ; 173/ad ____N/A____ + .byte CT_NONE ; 174/ae ____N/A____ + .byte CT_NONE ; 175/af ____N/A____ + .byte CT_NONE ; 176/b0 ____N/A____ + .byte CT_NONE ; 177/b1 ____N/A____ + .byte CT_NONE ; 178/b2 ____N/A____ + .byte CT_NONE ; 179/b3 ____N/A____ + .byte CT_NONE ; 180/b4 ____N/A____ + .byte CT_NONE ; 181/b5 ____N/A____ + .byte CT_NONE ; 182/b6 ____N/A____ + .byte CT_NONE ; 183/b7 ____N/A____ + .byte CT_NONE ; 184/b8 ____N/A____ + .byte CT_NONE ; 185/b9 ____N/A____ + .byte CT_NONE ; 186/ba ____N/A____ + .byte CT_NONE ; 187/bb ____N/A____ + .byte CT_NONE ; 188/bc ____N/A____ + .byte CT_NONE ; 189/bd ____N/A____ + .byte CT_NONE ; 190/be ____N/A____ + .byte CT_NONE ; 191/bf ____N/A____ + .byte CT_NONE ; 192/c0 ____N/A____ + .byte CT_NONE ; 193/c1 ____N/A____ + .byte CT_NONE ; 194/c2 ____N/A____ + .byte CT_NONE ; 195/c3 ____N/A____ + .byte CT_NONE ; 196/c4 ____N/A____ + .byte CT_NONE ; 197/c5 ____N/A____ + .byte CT_NONE ; 198/c6 ____N/A____ + .byte CT_NONE ; 199/c7 ____N/A____ + .byte CT_NONE ; 200/c8 ____N/A____ + .byte CT_NONE ; 201/c9 ____N/A____ + .byte CT_NONE ; 202/ca ____N/A____ + .byte CT_NONE ; 203/cb ____N/A____ + .byte CT_NONE ; 204/cc ____N/A____ + .byte CT_NONE ; 205/cd ____N/A____ + .byte CT_NONE ; 206/ce ____N/A____ + .byte CT_NONE ; 207/cf ____N/A____ + .byte CT_NONE ; 208/d0 ____N/A____ + .byte CT_NONE ; 209/d1 ____N/A____ + .byte CT_NONE ; 210/d2 ____N/A____ + .byte CT_NONE ; 211/d3 ____N/A____ + .byte CT_NONE ; 212/d4 ____N/A____ + .byte CT_NONE ; 213/d5 ____N/A____ + .byte CT_NONE ; 214/d6 ____N/A____ + .byte CT_NONE ; 215/d7 ____N/A____ + .byte CT_NONE ; 216/d8 ____N/A____ + .byte CT_NONE ; 217/d9 ____N/A____ + .byte CT_NONE ; 218/da ____N/A____ + .byte CT_NONE ; 219/db ____N/A____ + .byte CT_NONE ; 220/dc ____N/A____ + .byte CT_NONE ; 221/dd ____N/A____ + .byte CT_NONE ; 222/de ____N/A____ + .byte CT_NONE ; 223/df ____N/A____ + .byte CT_NONE ; 224/e0 ____N/A____ + .byte CT_NONE ; 225/e1 ____N/A____ + .byte CT_NONE ; 226/e2 ____N/A____ + .byte CT_NONE ; 227/e3 ____N/A____ + .byte CT_NONE ; 228/e4 ____N/A____ + .byte CT_NONE ; 229/e5 ____N/A____ + .byte CT_NONE ; 230/e6 ____N/A____ + .byte CT_NONE ; 231/e7 ____N/A____ + .byte CT_NONE ; 232/e8 ____N/A____ + .byte CT_NONE ; 233/e9 ____N/A____ + .byte CT_NONE ; 234/ea ____N/A____ + .byte CT_NONE ; 235/eb ____N/A____ + .byte CT_NONE ; 236/ec ____N/A____ + .byte CT_NONE ; 237/ed ____N/A____ + .byte CT_NONE ; 238/ee ____N/A____ + .byte CT_NONE ; 239/ef ____N/A____ + .byte CT_NONE ; 240/f0 ____N/A____ + .byte CT_NONE ; 241/f1 ____N/A____ + .byte CT_NONE ; 242/f2 ____N/A____ + .byte CT_NONE ; 243/f3 ____N/A____ + .byte CT_NONE ; 244/f4 ____N/A____ + .byte CT_NONE ; 245/f5 ____N/A____ + .byte CT_NONE ; 246/f6 ____N/A____ + .byte CT_NONE ; 247/f7 ____N/A____ + .byte CT_NONE ; 248/f8 ____N/A____ + .byte CT_NONE ; 249/f9 ____N/A____ + .byte CT_NONE ; 250/fa ____N/A____ + .byte CT_NONE ; 251/fb ____N/A____ + .byte CT_NONE ; 252/fc ____N/A____ + .byte CT_NONE ; 253/fd ____N/A____ + .byte CT_NONE ; 254/fe ____N/A____ + .byte CT_NONE ; 255/ff ____N/A____ diff --git a/libsrc/geos-common/system/enterdesktop.s b/libsrc/geos-common/system/enterdesktop.s index b13487c42..774de3c14 100644 --- a/libsrc/geos-common/system/enterdesktop.s +++ b/libsrc/geos-common/system/enterdesktop.s @@ -5,10 +5,10 @@ ; void EnterDeskTop (void); - .import _exit - .export _EnterDeskTop + .import _exit + .export _EnterDeskTop _EnterDeskTop: - lda #0 - tax - jmp _exit + lda #0 + tax + jmp _exit diff --git a/libsrc/geos-common/system/extzp.s b/libsrc/geos-common/system/extzp.s index 5ef1c2060..0990a5a87 100644 --- a/libsrc/geos-common/system/extzp.s +++ b/libsrc/geos-common/system/extzp.s @@ -5,17 +5,17 @@ ; zeropage locations for exclusive use by the library ; - .exportzp cursor_x, cursor_y - .exportzp cursor_c, cursor_r + .exportzp cursor_x, cursor_y + .exportzp cursor_c, cursor_r -.segment "EXTZP" : zeropage +.segment "EXTZP" : zeropage cursor_x: - .res 2 ; Cursor column (0-319/639) + .res 2 ; Cursor column (0-319/639) cursor_y: - .res 1 ; Cursor row (0-199) + .res 1 ; Cursor row (0-199) cursor_c: - .res 1 ; Cursor column (0-39/79) + .res 1 ; Cursor column (0-39/79) cursor_r: - .res 1 ; Cursor row (0-24) + .res 1 ; Cursor row (0-24) diff --git a/libsrc/geos-common/system/firstinit.s b/libsrc/geos-common/system/firstinit.s index 8fbb212b7..c0695ee47 100644 --- a/libsrc/geos-common/system/firstinit.s +++ b/libsrc/geos-common/system/firstinit.s @@ -5,8 +5,8 @@ ; void FirstInit (void); - .export _FirstInit + .export _FirstInit - .include "jumptab.inc" + .include "jumptab.inc" -_FirstInit = FirstInit \ No newline at end of file +_FirstInit = FirstInit \ No newline at end of file diff --git a/libsrc/geos-common/system/getrandom.s b/libsrc/geos-common/system/getrandom.s index 2a100a9c2..74c329ee2 100644 --- a/libsrc/geos-common/system/getrandom.s +++ b/libsrc/geos-common/system/getrandom.s @@ -5,11 +5,11 @@ ; char GetRandom (void); - .export _GetRandom + .export _GetRandom - .include "jumptab.inc" + .include "jumptab.inc" _GetRandom: - jsr GetRandom - ldx #0 - rts + jsr GetRandom + ldx #0 + rts diff --git a/libsrc/geos-common/system/joy_stddrv.s b/libsrc/geos-common/system/joy_stddrv.s index ddacdb483..1880ef2de 100644 --- a/libsrc/geos-common/system/joy_stddrv.s +++ b/libsrc/geos-common/system/joy_stddrv.s @@ -6,10 +6,10 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata _joy_stddrv: - .asciiz "geos-stdjoy.joy" + .asciiz "geos-stdjoy.joy" diff --git a/libsrc/geos-common/system/mainargs.s b/libsrc/geos-common/system/mainargs.s index 02c461cb3..db829cc0b 100644 --- a/libsrc/geos-common/system/mainargs.s +++ b/libsrc/geos-common/system/mainargs.s @@ -12,66 +12,66 @@ ; on icon of your application ; - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv - .include "const.inc" - .include "geossym.inc" + .include "const.inc" + .include "geossym.inc" -.segment "INIT" +.segment "INIT" ; Setup arguments for main initmainargs: ; Setup a pointer to our argv vector - lda #argv - sta __argv+1 + lda #argv + sta __argv+1 ; Copy program name - ldy #0 + ldy #0 @fn_loop: - lda dirEntryBuf+OFF_FNAME,y + lda dirEntryBuf+OFF_FNAME,y .ifdef __GEOS_CBM__ - cmp #$a0 + cmp #$a0 .else - cmp #0 + cmp #0 .endif - beq @fn_end - sta argv0,y - iny - cpy #16+1 - bne @fn_loop + beq @fn_end + sta argv0,y + iny + cpy #16+1 + bne @fn_loop @fn_end: - lda #0 - sta argv0,y - sta __argc+1 + lda #0 + sta argv0,y + sta __argc+1 ; Check if there are any more arguments - lda dataFileName - bne @threeargs - ldx #0 ; no dataFileName - NULL the 2nd argument - stx argv+2 - stx argv+3 - inx ; there is only one argument - bne @setargc + lda dataFileName + bne @threeargs + ldx #0 ; no dataFileName - NULL the 2nd argument + stx argv+2 + stx argv+3 + inx ; there is only one argument + bne @setargc @threeargs: - ldx #3 ; there are three arguments + ldx #3 ; there are three arguments @setargc: - stx __argc - rts + stx __argc + rts .data argv: - .word argv0 ; Pointer to program name - .word dataFileName ; dataFileName or NULL if last one - .word dataDiskName ; dataDiskName - .word $0000 ; last one must be NULL + .word argv0 ; Pointer to program name + .word dataFileName ; dataFileName or NULL if last one + .word dataDiskName ; dataDiskName + .word $0000 ; last one must be NULL .bss argv0: - .res 17 ; Program name + .res 17 ; Program name diff --git a/libsrc/geos-common/system/mainloop.s b/libsrc/geos-common/system/mainloop.s index 88d4ac36b..d1f8632ed 100644 --- a/libsrc/geos-common/system/mainloop.s +++ b/libsrc/geos-common/system/mainloop.s @@ -5,8 +5,8 @@ ; void MainLoop (void); - .export _MainLoop + .export _MainLoop - .include "jumptab.inc" + .include "jumptab.inc" -_MainLoop = MainLoop +_MainLoop = MainLoop diff --git a/libsrc/geos-common/system/oserrlist.s b/libsrc/geos-common/system/oserrlist.s index da39203c2..4ec30206e 100644 --- a/libsrc/geos-common/system/oserrlist.s +++ b/libsrc/geos-common/system/oserrlist.s @@ -14,27 +14,27 @@ ; error code could not be found. ; - .export __sys_oserrlist + .export __sys_oserrlist - .include "const.inc" + .include "const.inc" ;---------------------------------------------------------------------------- ; Macros used to generate the list (may get moved to an include file?) ; Regular entry .macro sys_oserr_entry code, msg - .local Start, End + .local Start, End Start: .byte End - Start - .byte code - .asciiz msg + .byte code + .asciiz msg End: .endmacro ; Sentinel entry .macro sys_oserr_sentinel msg - .byte 0 ; Length is always zero - .byte 0 ; Code is unused - .asciiz msg + .byte 0 ; Length is always zero + .byte 0 ; Code is unused + .asciiz msg .endmacro ;---------------------------------------------------------------------------- @@ -43,50 +43,50 @@ End: .rodata __sys_oserrlist: - sys_oserr_entry NO_BLOCKS, "No free blocks" - sys_oserr_entry INV_TRACK, "Illegal track or sector" - sys_oserr_entry INSUFF_SPACE, "Disk full" - sys_oserr_entry FULL_DIRECTORY, "Directory full" - sys_oserr_entry FILE_NOT_FOUND, "File not found" - sys_oserr_entry BAD_BAM, "Inconsistent BAM" - sys_oserr_entry UNOPENED_VLIR, "VLIR file not opened" - sys_oserr_entry INV_RECORD, "Invalid VLIR record" - sys_oserr_entry OUT_OF_RECORDS, "Out of VLIR records" - sys_oserr_entry STRUCT_MISMAT, "Structure mismatch" - sys_oserr_entry BFR_OVERFLOW, "Buffer overflow" - sys_oserr_entry CANCEL_ERR, "Operation cancelled" - sys_oserr_entry DEV_NOT_FOUND, "Device not found" - sys_oserr_entry INCOMPATIBLE, "Incompatible device" - sys_oserr_entry 20, "Read error" - sys_oserr_entry 21, "Read error" - sys_oserr_entry 22, "Read error" - sys_oserr_entry 23, "Read error" - sys_oserr_entry 24, "Read error" - sys_oserr_entry 25, "Write error" - sys_oserr_entry 26, "Write protect on" - sys_oserr_entry 27, "Read error" - sys_oserr_entry 28, "Write error" - sys_oserr_entry 29, "Disk ID mismatch" - sys_oserr_entry 30, "Syntax error" - sys_oserr_entry 31, "Syntax error" - sys_oserr_entry 32, "Syntax error" - sys_oserr_entry 33, "Syntax error (invalid file name)" - sys_oserr_entry 34, "Syntax error (no file given)" - sys_oserr_entry 39, "Syntax error" - sys_oserr_entry 50, "Record not present" - sys_oserr_entry 51, "Overflow in record" - sys_oserr_entry 52, "File too large" - sys_oserr_entry 60, "Write file open" - sys_oserr_entry 61, "File not open" - sys_oserr_entry 62, "File not found" - sys_oserr_entry 63, "File exists" - sys_oserr_entry 64, "File type mismatch" - sys_oserr_entry 65, "No block" - sys_oserr_entry 66, "Illegal track or sector" - sys_oserr_entry 67, "Illegal system track or sector" - sys_oserr_entry 70, "No channel" - sys_oserr_entry 71, "Directory error" - sys_oserr_entry 72, "Disk full" - sys_oserr_entry 73, "DOS version mismatch" - sys_oserr_entry 74, "Drive not ready" - sys_oserr_sentinel "Unknown error" + sys_oserr_entry NO_BLOCKS, "No free blocks" + sys_oserr_entry INV_TRACK, "Illegal track or sector" + sys_oserr_entry INSUFF_SPACE, "Disk full" + sys_oserr_entry FULL_DIRECTORY, "Directory full" + sys_oserr_entry FILE_NOT_FOUND, "File not found" + sys_oserr_entry BAD_BAM, "Inconsistent BAM" + sys_oserr_entry UNOPENED_VLIR, "VLIR file not opened" + sys_oserr_entry INV_RECORD, "Invalid VLIR record" + sys_oserr_entry OUT_OF_RECORDS, "Out of VLIR records" + sys_oserr_entry STRUCT_MISMAT, "Structure mismatch" + sys_oserr_entry BFR_OVERFLOW, "Buffer overflow" + sys_oserr_entry CANCEL_ERR, "Operation cancelled" + sys_oserr_entry DEV_NOT_FOUND, "Device not found" + sys_oserr_entry INCOMPATIBLE, "Incompatible device" + sys_oserr_entry 20, "Read error" + sys_oserr_entry 21, "Read error" + sys_oserr_entry 22, "Read error" + sys_oserr_entry 23, "Read error" + sys_oserr_entry 24, "Read error" + sys_oserr_entry 25, "Write error" + sys_oserr_entry 26, "Write protect on" + sys_oserr_entry 27, "Read error" + sys_oserr_entry 28, "Write error" + sys_oserr_entry 29, "Disk ID mismatch" + sys_oserr_entry 30, "Syntax error" + sys_oserr_entry 31, "Syntax error" + sys_oserr_entry 32, "Syntax error" + sys_oserr_entry 33, "Syntax error (invalid file name)" + sys_oserr_entry 34, "Syntax error (no file given)" + sys_oserr_entry 39, "Syntax error" + sys_oserr_entry 50, "Record not present" + sys_oserr_entry 51, "Overflow in record" + sys_oserr_entry 52, "File too large" + sys_oserr_entry 60, "Write file open" + sys_oserr_entry 61, "File not open" + sys_oserr_entry 62, "File not found" + sys_oserr_entry 63, "File exists" + sys_oserr_entry 64, "File type mismatch" + sys_oserr_entry 65, "No block" + sys_oserr_entry 66, "Illegal track or sector" + sys_oserr_entry 67, "Illegal system track or sector" + sys_oserr_entry 70, "No channel" + sys_oserr_entry 71, "Directory error" + sys_oserr_entry 72, "Disk full" + sys_oserr_entry 73, "DOS version mismatch" + sys_oserr_entry 74, "Drive not ready" + sys_oserr_sentinel "Unknown error" diff --git a/libsrc/geos-common/system/oserror.s b/libsrc/geos-common/system/oserror.s index 2acfe1e9a..f0915fd5b 100644 --- a/libsrc/geos-common/system/oserror.s +++ b/libsrc/geos-common/system/oserror.s @@ -7,79 +7,79 @@ ; /* Map a system specific error into a system independent code */ ; - .export __osmaperrno + .export __osmaperrno - .include "errno.inc" - .include "const.inc" + .include "errno.inc" + .include "const.inc" __osmaperrno: - ldx #ErrTabSize -@L1: cmp ErrTab-2,x ; Search for the error code - beq @L2 ; Jump if found - dex - dex - bne @L1 ; Next entry + ldx #ErrTabSize +@L1: cmp ErrTab-2,x ; Search for the error code + beq @L2 ; Jump if found + dex + dex + bne @L1 ; Next entry ; Code not found, return EINVAL - lda #EINVAL - rts + lda #EINVAL + rts ; Found the code -@L2: lda ErrTab-1,x - ldx #$00 ; High byte always zero - rts +@L2: lda ErrTab-1,x + ldx #$00 ; High byte always zero + rts .rodata ErrTab: - .byte NO_BLOCKS, EINVAL ; ??? - .byte INV_TRACK, EINVAL ; invalid track§or pair - .byte INSUFF_SPACE, ENOSPC ; out of space - .byte FULL_DIRECTORY, ENOSPC ; directory is full - .byte FILE_NOT_FOUND, ENOENT ; file not found - .byte BAD_BAM, EIO ; bam inconsistent - .byte UNOPENED_VLIR, EINVAL ; using VLIR file without opening - .byte INV_RECORD, EINVAL ; using >128 VLIR record number - .byte OUT_OF_RECORDS, ENOSPC ; cannot insert/add record - .byte STRUCT_MISMAT, EINVAL ; ??? - .byte BFR_OVERFLOW, ENOMEM ; file longer than buffer or end of file - .byte CANCEL_ERR, EIO ; ??? - .byte DEV_NOT_FOUND, ENODEV ; device not found - .byte INCOMPATIBLE, EINVAL ; ??? + .byte NO_BLOCKS, EINVAL ; ??? + .byte INV_TRACK, EINVAL ; invalid track§or pair + .byte INSUFF_SPACE, ENOSPC ; out of space + .byte FULL_DIRECTORY, ENOSPC ; directory is full + .byte FILE_NOT_FOUND, ENOENT ; file not found + .byte BAD_BAM, EIO ; bam inconsistent + .byte UNOPENED_VLIR, EINVAL ; using VLIR file without opening + .byte INV_RECORD, EINVAL ; using >128 VLIR record number + .byte OUT_OF_RECORDS, ENOSPC ; cannot insert/add record + .byte STRUCT_MISMAT, EINVAL ; ??? + .byte BFR_OVERFLOW, ENOMEM ; file longer than buffer or end of file + .byte CANCEL_ERR, EIO ; ??? + .byte DEV_NOT_FOUND, ENODEV ; device not found + .byte INCOMPATIBLE, EINVAL ; ??? -; .byte 20, ; Read error -; .byte 21, ; Read error -; .byte 22, ; Read error -; .byte 23, ; Read error -; .byte 24, ; Read error -; .byte 25, ; Write error - .byte 26, EACCES ; Write protect on -; .byte 27, ; Read error -; .byte 28, ; Write error -; .byte 29, ; Disk ID mismatch -; .byte 30, ; Syntax error -; .byte 31, ; Syntax error -; .byte 32, ; Syntax error - .byte 33, EINVAL ; Syntax error (invalid file name) - .byte 34, EINVAL ; Syntax error (no file given) -; .byte 39, ; Syntax error -; .byte 50, ; Record not present -; .byte 51, ; Overflow in record -; .byte 52, ; File too large - .byte 60, EINVAL ; Write file open - .byte 61, EINVAL ; File not open - .byte 62, ENOENT ; File not found - .byte 63, EEXIST ; File exists - .byte 64, EINVAL ; File type mismatch -; .byte 65, ; No block -; .byte 66, ; Illegal track or sector -; .byte 67, ; Illegal system track or sector - .byte 70, EBUSY ; No channel -; .byte 71, ; Directory error -; .byte 72, ; Disk full -; .byte 73, ; DOS version mismatch +; .byte 20, ; Read error +; .byte 21, ; Read error +; .byte 22, ; Read error +; .byte 23, ; Read error +; .byte 24, ; Read error +; .byte 25, ; Write error + .byte 26, EACCES ; Write protect on +; .byte 27, ; Read error +; .byte 28, ; Write error +; .byte 29, ; Disk ID mismatch +; .byte 30, ; Syntax error +; .byte 31, ; Syntax error +; .byte 32, ; Syntax error + .byte 33, EINVAL ; Syntax error (invalid file name) + .byte 34, EINVAL ; Syntax error (no file given) +; .byte 39, ; Syntax error +; .byte 50, ; Record not present +; .byte 51, ; Overflow in record +; .byte 52, ; File too large + .byte 60, EINVAL ; Write file open + .byte 61, EINVAL ; File not open + .byte 62, ENOENT ; File not found + .byte 63, EEXIST ; File exists + .byte 64, EINVAL ; File type mismatch +; .byte 65, ; No block +; .byte 66, ; Illegal track or sector +; .byte 67, ; Illegal system track or sector + .byte 70, EBUSY ; No channel +; .byte 71, ; Directory error +; .byte 72, ; Disk full +; .byte 73, ; DOS version mismatch -ErrTabSize = (* - ErrTab) +ErrTabSize = (* - ErrTab) diff --git a/libsrc/geos-common/system/panic.s b/libsrc/geos-common/system/panic.s index cb6d483c7..9ea916023 100644 --- a/libsrc/geos-common/system/panic.s +++ b/libsrc/geos-common/system/panic.s @@ -5,8 +5,8 @@ ; void Panic (void); - .export _Panic + .export _Panic - .include "jumptab.inc" + .include "jumptab.inc" -_Panic = Panic \ No newline at end of file +_Panic = Panic \ No newline at end of file diff --git a/libsrc/geos-common/system/randomize.s b/libsrc/geos-common/system/randomize.s index e6e4fe51e..67c217d80 100644 --- a/libsrc/geos-common/system/randomize.s +++ b/libsrc/geos-common/system/randomize.s @@ -5,12 +5,12 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand - .include "geossym.inc" + .include "geossym.inc" __randomize: - lda random ; get random value from internal generator - ldx random+1 - jmp _srand ; and use it as seed + lda random ; get random value from internal generator + ldx random+1 + jmp _srand ; and use it as seed diff --git a/libsrc/geos-common/system/setoserror.s b/libsrc/geos-common/system/setoserror.s index 97a8076d7..adc6ad017 100644 --- a/libsrc/geos-common/system/setoserror.s +++ b/libsrc/geos-common/system/setoserror.s @@ -4,12 +4,12 @@ ; 2.1.2003 ; - .export setoserror - .import __oserror + .export setoserror + .import __oserror setoserror: - stx __oserror - txa - ldx #0 ; X is cleared (high byte for promoting char to int) - tay ; Y register is used just to save flags state - rts + stx __oserror + txa + ldx #0 ; X is cleared (high byte for promoting char to int) + tay ; Y register is used just to save flags state + rts diff --git a/libsrc/geos-common/system/systime.c b/libsrc/geos-common/system/systime.c index 29fdf8ff4..75b0fabb7 100644 --- a/libsrc/geos-common/system/systime.c +++ b/libsrc/geos-common/system/systime.c @@ -18,7 +18,7 @@ time_t _systime(void) currentTime.tm_mon = system_date.s_month; currentTime.tm_year = system_date.s_year; if (system_date.s_year < 87) { - currentTime.tm_year+=100; + currentTime.tm_year+=100; } currentTime.tm_isdst = -1; diff --git a/libsrc/geos-common/system/sysuname.s b/libsrc/geos-common/system/sysuname.s index 557ac4396..8eac05941 100644 --- a/libsrc/geos-common/system/sysuname.s +++ b/libsrc/geos-common/system/sysuname.s @@ -4,10 +4,10 @@ ; unsigned char __fastcall__ _sysuname (struct utsname* buf); ; - .import utscopy - .export __sysuname, utsdata + .import utscopy + .export __sysuname, utsdata -__sysuname = utscopy +__sysuname = utscopy ;-------------------------------------------------------------------------- ; Data. We define a fixed utsname struct here and just copy it. @@ -15,24 +15,24 @@ __sysuname = utscopy .rodata utsdata: - ; sysname - .asciiz "cc65" + ; sysname + .asciiz "cc65" - ; nodename - .asciiz "" + ; nodename + .asciiz "" - ; release - .byte ((.VERSION >> 8) & $0F) + '0' - .byte '.' - .byte ((.VERSION >> 4) & $0F) + '0' - .byte $00 + ; release + .byte ((.VERSION >> 8) & $0F) + '0' + .byte '.' + .byte ((.VERSION >> 4) & $0F) + '0' + .byte $00 - ; version - .byte (.VERSION & $0F) + '0' - .byte $00 + ; version + .byte (.VERSION & $0F) + '0' + .byte $00 - ; machine - .asciiz "GEOS" + ; machine + .asciiz "GEOS" diff --git a/libsrc/geos-common/system/tgi_colors.s b/libsrc/geos-common/system/tgi_colors.s index 7432fce49..0d404294c 100644 --- a/libsrc/geos-common/system/tgi_colors.s +++ b/libsrc/geos-common/system/tgi_colors.s @@ -2,7 +2,7 @@ ; Target-specific black & white values, for use by the target-shared TGI kernel ; - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" -tgi_color_black = $00 -tgi_color_white = $01 +tgi_color_black = $00 +tgi_color_white = $01 diff --git a/libsrc/geos-common/system/tgi_stddrv.s b/libsrc/geos-common/system/tgi_stddrv.s index 1d89c5f20..8e1930abe 100644 --- a/libsrc/geos-common/system/tgi_stddrv.s +++ b/libsrc/geos-common/system/tgi_stddrv.s @@ -6,9 +6,9 @@ ; const char tgi_stddrv[]; ; - .export _tgi_stddrv + .export _tgi_stddrv .rodata _tgi_stddrv: - .asciiz "geos-tgi.tgi" + .asciiz "geos-tgi.tgi" diff --git a/libsrc/joystick/joy-kernel.s b/libsrc/joystick/joy-kernel.s index 46bf3fdaf..71f94133a 100644 --- a/libsrc/joystick/joy-kernel.s +++ b/libsrc/joystick/joy-kernel.s @@ -5,7 +5,7 @@ ; .importzp ptr1 - .interruptor joy_irq ; Export as IRQ handler + .interruptor joy_irq ; Export as IRQ handler .include "joy-kernel.inc" .include "joy-error.inc" @@ -16,22 +16,22 @@ .bss -_joy_drv: .res 2 ; Pointer to driver +_joy_drv: .res 2 ; Pointer to driver _joy_masks: .res .sizeof(JOY_HDR::MASKS) ; Jump table for the driver functions. .data joy_vectors: -joy_install: jmp $0000 -joy_uninstall: jmp $0000 +joy_install: jmp $0000 +joy_uninstall: jmp $0000 joy_count: jmp $0000 joy_read: jmp $0000 joy_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes ; Driver header signature .rodata -joy_sig: .byte $6A, $6F, $79, JOY_API_VERSION ; "joy", version +joy_sig: .byte $6A, $6F, $79, JOY_API_VERSION ; "joy", version .code @@ -41,10 +41,10 @@ joy_sig: .byte $6A, $6F, $79, JOY_API_VERSION ; "joy", version _joy_install: - sta _joy_drv - sta ptr1 - stx _joy_drv+1 - stx ptr1+1 + sta _joy_drv + sta ptr1 + stx _joy_drv+1 + stx ptr1+1 ; Check the driver signature @@ -84,8 +84,8 @@ _joy_install: ldy joy_irq+2 ; Check high byte of IRQ vector beq @L3 ; Jump if vector invalid - ldy #$4C ; JMP opcode - sty joy_irq ; Activate IRQ routine + ldy #$4C ; JMP opcode + sty joy_irq ; Activate IRQ routine @L3: rts ; Driver signature invalid @@ -110,8 +110,8 @@ set: sta joy_vectors,x ; */ _joy_uninstall: - lda #$60 ; RTS opcode - sta joy_irq ; Disable IRQ entry point + lda #$60 ; RTS opcode + sta joy_irq ; Disable IRQ entry point jsr joy_uninstall ; Call the driver routine diff --git a/libsrc/joystick/joy_count.s b/libsrc/joystick/joy_count.s index 753368d42..96ef45e78 100644 --- a/libsrc/joystick/joy_count.s +++ b/libsrc/joystick/joy_count.s @@ -7,4 +7,4 @@ .include "joy-kernel.inc" - _joy_count = joy_count ; Use driver entry + _joy_count = joy_count ; Use driver entry diff --git a/libsrc/joystick/joy_read.s b/libsrc/joystick/joy_read.s index c03bf95f6..f76d9dfb7 100644 --- a/libsrc/joystick/joy_read.s +++ b/libsrc/joystick/joy_read.s @@ -7,6 +7,6 @@ .include "joy-kernel.inc" - _joy_read = joy_read ; Use driver entry + _joy_read = joy_read ; Use driver entry diff --git a/libsrc/joystick/joy_unload.s b/libsrc/joystick/joy_unload.s index 9b85abd26..25d54ff02 100644 --- a/libsrc/joystick/joy_unload.s +++ b/libsrc/joystick/joy_unload.s @@ -15,23 +15,23 @@ _joy_unload: - lda _joy_drv + lda _joy_drv pha ; Save pointer to driver - ora _joy_drv+1 - beq no_driver ; No driver - lda _joy_drv+1 - pha + ora _joy_drv+1 + beq no_driver ; No driver + lda _joy_drv+1 + pha - jsr _joy_uninstall ; Uninstall the driver + jsr _joy_uninstall ; Uninstall the driver - pla - tax - pla ; Get pointer to driver + pla + tax + pla ; Get pointer to driver jsr _mod_free ; Free the driver jmp return0 ; Return JOY_ERR_OK no_driver: - tax ; X = 0 + tax ; X = 0 pla ; Remove pushed junk - lda #JOY_ERR_NO_DRIVER - rts + lda #JOY_ERR_NO_DRIVER + rts diff --git a/libsrc/lynx/bllhdr.s b/libsrc/lynx/bllhdr.s index 6cadb5903..60fc87725 100644 --- a/libsrc/lynx/bllhdr.s +++ b/libsrc/lynx/bllhdr.s @@ -3,17 +3,17 @@ ; ; This header is required for BLL builds. ; - .import __BSS_LOAD__ - .import __RAM_START__ - .export __BLLHDR__: absolute = 1 + .import __BSS_LOAD__ + .import __RAM_START__ + .export __BLLHDR__: absolute = 1 ; ------------------------------------------------------------------------ ; BLL header (BLL header) - .segment "BLLHDR" - .word $0880 - .dbyt __RAM_START__ - .dbyt __BSS_LOAD__ - __RAM_START__ + 10 - .byte $42,$53 - .byte $39,$33 + .segment "BLLHDR" + .word $0880 + .dbyt __RAM_START__ + .dbyt __BSS_LOAD__ - __RAM_START__ + 10 + .byte $42,$53 + .byte $39,$33 diff --git a/libsrc/lynx/bootldr.s b/libsrc/lynx/bootldr.s index eba06b873..a62d6155c 100644 --- a/libsrc/lynx/bootldr.s +++ b/libsrc/lynx/bootldr.s @@ -3,177 +3,177 @@ ; ; This bootloader creates a signed binary so that the Lynx will accept it. ; - .include "lynx.inc" - .include "extzp.inc" - .import __BLOCKSIZE__ - .export __BOOTLDR__: absolute = 1 + .include "lynx.inc" + .include "extzp.inc" + .import __BLOCKSIZE__ + .export __BOOTLDR__: absolute = 1 ; ------------------------------------------------------------------------ ; Bootloader - .segment "BOOTLDR" + .segment "BOOTLDR" ;********************************** ; Here is the bootloader in plaintext ; The idea is to make the smalles possible encrypted loader as decryption ; is very slow. The minimum size is 49 bytes plus a zero byte. ;********************************** -; EXE = $fb68 +; EXE = $fb68 ; -; .org $0200 +; .org $0200 ; -; ; 1. force Mikey to be in memory -; stz MAPCTL +; ; 1. force Mikey to be in memory +; stz MAPCTL ; -; ; 3. set ComLynx to open collector -; lda #4 ; a = 00000100 -; sta SERCTL ; set the ComLynx to open collector +; ; 3. set ComLynx to open collector +; lda #4 ; a = 00000100 +; sta SERCTL ; set the ComLynx to open collector ; -; ; 4. make sure the ROM is powered on -; lda #8 ; a = 00001000 -; sta IODAT ; set the ROM power to on +; ; 4. make sure the ROM is powered on +; lda #8 ; a = 00001000 +; sta IODAT ; set the ROM power to on ; -; ; 5. read in secondary exe + 8 bytes from the cart and store it in $f000 -; ldx #0 ; x = 0 -; ldy #$97 ; y = secondary loader size (151 bytes) +; ; 5. read in secondary exe + 8 bytes from the cart and store it in $f000 +; ldx #0 ; x = 0 +; ldy #$97 ; y = secondary loader size (151 bytes) ;rloop1: lda RCART0 ; read a byte from the cart -; sta EXE,X ; EXE[X] = a -; inx ; x++ -; dey ; y-- -; bne rloop1 ; loops until y wraps +; sta EXE,X ; EXE[X] = a +; inx ; x++ +; dey ; y-- +; bne rloop1 ; loops until y wraps ; -; ; 6. jump to secondary loader -; jmp EXE ; run the secondary loader +; ; 6. jump to secondary loader +; jmp EXE ; run the secondary loader ; -; .reloc +; .reloc ;********************************** ; After compilation, encryption and obfuscation it turns into this. ;********************************** - .byte $ff, $81, $ca, $33, $be, $80, $a2, $c4 - .byte $6d, $98, $fe, $8d, $bc, $66, $c0, $7a - .byte $09, $50, $23, $28, $18, $c8, $06, $70 - .byte $58, $4f, $1b, $e1, $c7, $90, $08, $cd - .byte $1a, $6e, $5a, $45, $32, $d7, $6d, $c6 - .byte $8a, $e5, $d8, $5c, $a0, $e8, $4f, $7a - .byte $5f, $73, $8d, $22 + .byte $ff, $81, $ca, $33, $be, $80, $a2, $c4 + .byte $6d, $98, $fe, $8d, $bc, $66, $c0, $7a + .byte $09, $50, $23, $28, $18, $c8, $06, $70 + .byte $58, $4f, $1b, $e1, $c7, $90, $08, $cd + .byte $1a, $6e, $5a, $45, $32, $d7, $6d, $c6 + .byte $8a, $e5, $d8, $5c, $a0, $e8, $4f, $7a + .byte $5f, $73, $8d, $22 ;********************************** ; Now we have the secondary loader ;********************************** - .org $fb68 - ; 1. Read in the 1st File-entry (main exe) in FileEntry - ldx #$00 - ldy #8 -rloop: lda RCART0 ; read a byte from the cart - sta _FileEntry,X ; EXE[X] = a - inx - dey - bne rloop + .org $fb68 + ; 1. Read in the 1st File-entry (main exe) in FileEntry + ldx #$00 + ldy #8 +rloop: lda RCART0 ; read a byte from the cart + sta _FileEntry,X ; EXE[X] = a + inx + dey + bne rloop - ; 2. Set the block hardware to the main exe start - lda _FileStartBlock - sta _FileCurrBlock - jsr seclynxblock + ; 2. Set the block hardware to the main exe start + lda _FileStartBlock + sta _FileCurrBlock + jsr seclynxblock - ; 3. Skip over the block offset - lda _FileBlockOffset+1 - eor #$FF - tay - lda _FileBlockOffset - eor #$FF - tax - jsr seclynxskip0 + ; 3. Skip over the block offset + lda _FileBlockOffset+1 + eor #$FF + tay + lda _FileBlockOffset + eor #$FF + tax + jsr seclynxskip0 - ; 4. Read in the main exe to RAM - lda _FileDestAddr - ldx _FileDestAddr+1 - sta _FileDestPtr - stx _FileDestPtr+1 - lda _FileFileLen+1 - eor #$FF - tay - lda _FileFileLen - eor #$FF - tax - jsr seclynxread0 + ; 4. Read in the main exe to RAM + lda _FileDestAddr + ldx _FileDestAddr+1 + sta _FileDestPtr + stx _FileDestPtr+1 + lda _FileFileLen+1 + eor #$FF + tay + lda _FileFileLen + eor #$FF + tax + jsr seclynxread0 - ; 5. Jump to start of the main exe code - jmp (_FileDestAddr) + ; 5. Jump to start of the main exe code + jmp (_FileDestAddr) ;********************************** ; Skip bytes on bank 0 ; X:Y count (EOR $FFFF) ;********************************** seclynxskip0: - inx - bne @0 - iny - beq exit -@0: jsr secreadbyte0 - bra seclynxskip0 + inx + bne @0 + iny + beq exit +@0: jsr secreadbyte0 + bra seclynxskip0 ;********************************** ; Read bytes from bank 0 ; X:Y count (EOR $ffff) ;********************************** seclynxread0: - inx - bne @1 - iny - beq exit -@1: jsr secreadbyte0 - sta (_FileDestPtr) - inc _FileDestPtr - bne seclynxread0 - inc _FileDestPtr+1 - bra seclynxread0 + inx + bne @1 + iny + beq exit +@1: jsr secreadbyte0 + sta (_FileDestPtr) + inc _FileDestPtr + bne seclynxread0 + inc _FileDestPtr+1 + bra seclynxread0 ;********************************** ; Read one byte from cartridge ;********************************** secreadbyte0: - lda RCART0 - inc _FileBlockByte - bne exit - inc _FileBlockByte+1 - bne exit + lda RCART0 + inc _FileBlockByte + bne exit + inc _FileBlockByte+1 + bne exit ;********************************** ; Select a block ;********************************** seclynxblock: - pha - phx - phy - lda __iodat - and #$fc - tay - ora #2 - tax - lda _FileCurrBlock - inc _FileCurrBlock - sec - bra @2 -@0: bcc @1 - stx IODAT - clc -@1: inx - stx SYSCTL1 - dex -@2: stx SYSCTL1 - rol - sty IODAT - bne @0 - lda __iodat - sta IODAT - stz _FileBlockByte - lda #<($100-(>__BLOCKSIZE__)) - sta _FileBlockByte+1 - ply - plx - pla + pha + phx + phy + lda __iodat + and #$fc + tay + ora #2 + tax + lda _FileCurrBlock + inc _FileCurrBlock + sec + bra @2 +@0: bcc @1 + stx IODAT + clc +@1: inx + stx SYSCTL1 + dex +@2: stx SYSCTL1 + rol + sty IODAT + bne @0 + lda __iodat + sta IODAT + stz _FileBlockByte + lda #<($100-(>__BLOCKSIZE__)) + sta _FileBlockByte+1 + ply + plx + pla -exit: rts +exit: rts - .reloc + .reloc diff --git a/libsrc/lynx/cgetc.s b/libsrc/lynx/cgetc.s index d3d4f8cb4..b61fb44f6 100644 --- a/libsrc/lynx/cgetc.s +++ b/libsrc/lynx/cgetc.s @@ -4,10 +4,10 @@ ; char cgetc (void); ; - .export _cgetc - .import _kbhit - .import KBEDG - .import KBSTL + .export _cgetc + .import _kbhit + .import KBEDG + .import KBSTL ; -------------------------------------------------------------------------- ; The Atari Lynx has a very small keyboard - only 3 keys @@ -20,51 +20,51 @@ ; So the keyboard returns '1', '2', '3', 'P', 'R', 'F' or '?'. _cgetc: - lda KBSTL - ora KBEDG - bne @L1 - jsr _kbhit ; Check for char available - tax ; Test result - bra _cgetc + lda KBSTL + ora KBEDG + bne @L1 + jsr _kbhit ; Check for char available + tax ; Test result + bra _cgetc @L1: - ldx #0 - and #1 - beq @L6 - lda KBEDG ; Pause button is pressed - and #$0c - beq @L3 - ora KBSTL + ldx #0 + and #1 + beq @L6 + lda KBEDG ; Pause button is pressed + and #$0c + beq @L3 + ora KBSTL @L2: - bit #$04 - beq @L4 ; Pause + Opt 1 = Reset - bit #$08 - beq @L5 ; Pause + Opt 2 = Flip - lda #'?' ; All buttons pressed - rts + bit #$04 + beq @L4 ; Pause + Opt 1 = Reset + bit #$08 + beq @L5 ; Pause + Opt 2 = Flip + lda #'?' ; All buttons pressed + rts @L3: - lda KBSTL ; Pause alone was the last placed button - and #$0c - bne @L2 - lda #'P' ; Pause pressed - rts + lda KBSTL ; Pause alone was the last placed button + and #$0c + bne @L2 + lda #'P' ; Pause pressed + rts @L4: - lda #'R' ; Reset pressed - rts + lda #'R' ; Reset pressed + rts @L5: - lda #'F' ; Flip pressed - rts + lda #'F' ; Flip pressed + rts @L6: - lda KBEDG ; No Pause pressed - ora KBSTL - bit #$08 - beq @L8 - bit #$04 - beq @L7 - lda #'3' ; opt 1 + opt 2 pressed - rts + lda KBEDG ; No Pause pressed + ora KBSTL + bit #$08 + beq @L8 + bit #$04 + beq @L7 + lda #'3' ; opt 1 + opt 2 pressed + rts @L7: - lda #'1' ; opt 1 pressed - rts + lda #'1' ; opt 1 pressed + rts @L8: - lda #'2' ; opt 2 pressed - rts + lda #'2' ; opt 2 pressed + rts diff --git a/libsrc/lynx/clock.s b/libsrc/lynx/clock.s index 666409139..881c43554 100644 --- a/libsrc/lynx/clock.s +++ b/libsrc/lynx/clock.s @@ -13,79 +13,79 @@ ; If you change the numbers there, then change them here, too. ; - .export _clock, __clk_tck, clock_count - .interruptor update_clock, 2 ; (low priority) - .constructor init_clock + .export _clock, __clk_tck, clock_count + .interruptor update_clock, 2 ; (low priority) + .constructor init_clock - .import sreg: zp - .include "lynx.inc" + .import sreg: zp + .include "lynx.inc" - .macpack generic + .macpack generic - .proc _clock - php - sei ; Disable interrupts + .proc _clock + php + sei ; Disable interrupts ; Read the clock counter. - lda clock_count - ldx clock_count+1 - ldy clock_count+2 + lda clock_count + ldx clock_count+1 + ldy clock_count+2 - plp ; Re-enable interrupts - sty sreg - stz sreg+1 ; Promote 24 bits up to 32 bits - rts - .endproc + plp ; Re-enable interrupts + sty sreg + stz sreg+1 ; Promote 24 bits up to 32 bits + rts + .endproc ;----------------------------------------------------------------------------- ; Return the number of clock ticks in one second. ; __clk_tck: - ldx #$00 ; >50, >60, >75 - ldy PBKUP - lda #<75 - cpy #$20 + 1 - blt @ok - lda #<60 - cpy #$29 + 1 - blt @ok - lda #<50 -@ok: stz sreg ; return 32 bits - stz sreg+1 - rts + ldx #$00 ; >50, >60, >75 + ldy PBKUP + lda #<75 + cpy #$20 + 1 + blt @ok + lda #<60 + cpy #$29 + 1 + blt @ok + lda #<50 +@ok: stz sreg ; return 32 bits + stz sreg+1 + rts ;----------------------------------------------------------------------------- ; This interrupt handler increments a 24-bit counter at every video ; vertical-blanking time. ; - .segment "LOWCODE" + .segment "LOWCODE" update_clock: - lda INTSET - and #%00000100 - beq @NotVBlank ; Not vertical-blank interrupt + lda INTSET + and #%00000100 + beq @NotVBlank ; Not vertical-blank interrupt - inc clock_count - bne @L1 - inc clock_count+1 - bne @L1 - inc clock_count+2 -@L1: ;clc ; General interrupt was not reset + inc clock_count + bne @L1 + inc clock_count+1 + bne @L1 + inc clock_count+2 +@L1: ;clc ; General interrupt was not reset @NotVBlank: - rts + rts ;----------------------------------------------------------------------------- ; Enable the interrupt that update_clock needs. ; - .segment "INIT" + .segment "INIT" init_clock: - lda #%10000000 - tsb VTIMCTLA - rts + lda #%10000000 + tsb VTIMCTLA + rts ;----------------------------------------------------------------------------- ; - .bss + .bss clock_count: - .res 3 + .res 3 diff --git a/libsrc/lynx/crt0.s b/libsrc/lynx/crt0.s index 804165c0d..116b39f76 100644 --- a/libsrc/lynx/crt0.s +++ b/libsrc/lynx/crt0.s @@ -15,122 +15,122 @@ ; on the front of the fully linked binary (see EXEHDR segment.) ; - .export _exit - .export __STARTUP__ : absolute = 1 ; Mark as startup + .export _exit + .export __STARTUP__ : absolute = 1 ; Mark as startup - .import initlib, donelib - .import zerobss - .import callmain - .import _main - .import __RAM_START__, __RAM_SIZE__, __STACKSIZE__ + .import initlib, donelib + .import zerobss + .import callmain + .import _main + .import __RAM_START__, __RAM_SIZE__, __STACKSIZE__ - .include "zeropage.inc" - .include "extzp.inc" - .include "lynx.inc" + .include "zeropage.inc" + .include "extzp.inc" + .include "lynx.inc" ; ------------------------------------------------------------------------ ; Mikey and Suzy init data, reg offsets and data - .rodata + .rodata -SuzyInitReg: .byte $28,$2a,$04,$06,$92,$83,$90 -SuzyInitData: .byte $7f,$7f,$00,$00,$24,$f3,$01 +SuzyInitReg: .byte $28,$2a,$04,$06,$92,$83,$90 +SuzyInitData: .byte $7f,$7f,$00,$00,$24,$f3,$01 -MikeyInitReg: .byte $00,$01,$08,$09,$20,$28,$30,$38,$44,$50,$8a,$8b,$8c,$92,$93 -MikeyInitData: .byte $9e,$18,$68,$1f,$00,$00,$00,$00,$00,$ff,$1a,$1b,$04,$0d,$29 +MikeyInitReg: .byte $00,$01,$08,$09,$20,$28,$30,$38,$44,$50,$8a,$8b,$8c,$92,$93 +MikeyInitData: .byte $9e,$18,$68,$1f,$00,$00,$00,$00,$00,$ff,$1a,$1b,$04,$0d,$29 ; ------------------------------------------------------------------------ ; Actual code - .segment "STARTUP" + .segment "STARTUP" ; set up system - sei - cld - ldx #$FF - txs + sei + cld + ldx #$FF + txs ; init bank switching - lda #$C - sta MAPCTL ; $FFF9 + lda #$C + sta MAPCTL ; $FFF9 ; disable all timer interrupts - lda #$80 - trb TIM0CTLA - trb TIM1CTLA - trb TIM2CTLA - trb TIM3CTLA - trb TIM5CTLA - trb TIM6CTLA - trb TIM7CTLA + lda #$80 + trb TIM0CTLA + trb TIM1CTLA + trb TIM2CTLA + trb TIM3CTLA + trb TIM5CTLA + trb TIM6CTLA + trb TIM7CTLA ; disable TX/RX IRQ, set to 8E1 - lda #%11101 - sta SERCTL + lda #%11101 + sta SERCTL ; clear all pending interrupts - lda INTSET - sta INTRST + lda INTSET + sta INTRST ; setup the stack - lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - sta sp - lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - sta sp+1 + lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp + lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp+1 ; Init Mickey - ldx #.sizeof(MikeyInitReg)-1 -mloop: ldy MikeyInitReg,x - lda MikeyInitData,x - sta $fd00,y - dex - bpl mloop + ldx #.sizeof(MikeyInitReg)-1 +mloop: ldy MikeyInitReg,x + lda MikeyInitData,x + sta $fd00,y + dex + bpl mloop ; these are RAM-shadows of read only regs - ldx #$1b - stx __iodat - dex ; $1A - stx __iodir - ldx #$d - stx __viddma + ldx #$1b + stx __iodat + dex ; $1A + stx __iodir + ldx #$d + stx __viddma ; Init Suzy - ldx #.sizeof(SuzyInitReg)-1 -sloop: ldy SuzyInitReg,x - lda SuzyInitData,x - sta $fc00,y - dex - bpl sloop + ldx #.sizeof(SuzyInitReg)-1 +sloop: ldy SuzyInitReg,x + lda SuzyInitData,x + sta $fc00,y + dex + bpl sloop - lda #$24 - sta __sprsys - cli + lda #$24 + sta __sprsys + cli ; Clear the BSS data - jsr zerobss + jsr zerobss ; Call module constructors - jsr initlib + jsr initlib ; Push arguments and call main - jsr callmain + jsr callmain ; Call module destructors. This is also the _exit entry. -_exit: jsr donelib ; Run module destructors +_exit: jsr donelib ; Run module destructors ; Endless loop -noret: bra noret +noret: bra noret diff --git a/libsrc/lynx/ctype.s b/libsrc/lynx/ctype.s index 42de7592b..6e0ab1785 100644 --- a/libsrc/lynx/ctype.s +++ b/libsrc/lynx/ctype.s @@ -33,140 +33,140 @@ ; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v') ; 7 - Space or tab character - .export __ctype + .export __ctype __ctype: .repeat 2 ; 2 times for normal and inverted - .byte $10 ; 0/00 ___ctrl_@___ - .byte $10 ; 1/01 ___ctrl_A___ - .byte $10 ; 2/02 ___ctrl_B___ - .byte $10 ; 3/03 ___ctrl_C___ - .byte $10 ; 4/04 ___ctrl_D___ - .byte $10 ; 5/05 ___ctrl_E___ - .byte $10 ; 6/06 ___ctrl_F___ - .byte $10 ; 7/07 ___ctrl_G___ - .byte $10 ; 8/08 ___ctrl_H___ - .byte $D0 ; 9/09 ___ctrl_I___ - .byte $50 ; 10/0a ___ctrl_J___ - .byte $50 ; 11/0b ___ctrl_K___ - .byte $50 ; 12/0c ___ctrl_L___ - .byte $50 ; 13/0d ___ctrl_M___ - .byte $10 ; 14/0e ___ctrl_N___ - .byte $10 ; 15/0f ___ctrl_O___ - .byte $10 ; 16/10 ___ctrl_P___ - .byte $10 ; 17/11 ___ctrl_Q___ - .byte $10 ; 18/12 ___ctrl_R___ - .byte $10 ; 19/13 ___ctrl_S___ - .byte $10 ; 20/14 ___ctrl_T___ - .byte $10 ; 21/15 ___ctrl_U___ - .byte $10 ; 22/16 ___ctrl_V___ - .byte $10 ; 23/17 ___ctrl_W___ - .byte $10 ; 24/18 ___ctrl_X___ - .byte $10 ; 25/19 ___ctrl_Y___ - .byte $10 ; 26/1a ___ctrl_Z___ - .byte $10 ; 27/1b ___ctrl_[___ - .byte $10 ; 28/1c ___ctrl_\___ - .byte $10 ; 29/1d ___ctrl_]___ - .byte $10 ; 30/1e ___ctrl_^___ - .byte $10 ; 31/1f ___ctrl_____ - .byte $A0 ; 32/20 ___SPACE___ - .byte $00 ; 33/21 _____!_____ - .byte $00 ; 34/22 _____"_____ - .byte $00 ; 35/23 _____#_____ - .byte $00 ; 36/24 _____$_____ - .byte $00 ; 37/25 _____%_____ - .byte $00 ; 38/26 _____&_____ - .byte $00 ; 39/27 _____'_____ - .byte $00 ; 40/28 _____(_____ - .byte $00 ; 41/29 _____)_____ - .byte $00 ; 42/2a _____*_____ - .byte $00 ; 43/2b _____+_____ - .byte $00 ; 44/2c _____,_____ - .byte $00 ; 45/2d _____-_____ - .byte $00 ; 46/2e _____._____ - .byte $00 ; 47/2f _____/_____ - .byte $0C ; 48/30 _____0_____ - .byte $0C ; 49/31 _____1_____ - .byte $0C ; 50/32 _____2_____ - .byte $0C ; 51/33 _____3_____ - .byte $0C ; 52/34 _____4_____ - .byte $0C ; 53/35 _____5_____ - .byte $0C ; 54/36 _____6_____ - .byte $0C ; 55/37 _____7_____ - .byte $0C ; 56/38 _____8_____ - .byte $0C ; 57/39 _____9_____ - .byte $00 ; 58/3a _____:_____ - .byte $00 ; 59/3b _____;_____ - .byte $00 ; 60/3c _____<_____ - .byte $00 ; 61/3d _____=_____ - .byte $00 ; 62/3e _____>_____ - .byte $00 ; 63/3f _____?_____ + .byte $10 ; 0/00 ___ctrl_@___ + .byte $10 ; 1/01 ___ctrl_A___ + .byte $10 ; 2/02 ___ctrl_B___ + .byte $10 ; 3/03 ___ctrl_C___ + .byte $10 ; 4/04 ___ctrl_D___ + .byte $10 ; 5/05 ___ctrl_E___ + .byte $10 ; 6/06 ___ctrl_F___ + .byte $10 ; 7/07 ___ctrl_G___ + .byte $10 ; 8/08 ___ctrl_H___ + .byte $D0 ; 9/09 ___ctrl_I___ + .byte $50 ; 10/0a ___ctrl_J___ + .byte $50 ; 11/0b ___ctrl_K___ + .byte $50 ; 12/0c ___ctrl_L___ + .byte $50 ; 13/0d ___ctrl_M___ + .byte $10 ; 14/0e ___ctrl_N___ + .byte $10 ; 15/0f ___ctrl_O___ + .byte $10 ; 16/10 ___ctrl_P___ + .byte $10 ; 17/11 ___ctrl_Q___ + .byte $10 ; 18/12 ___ctrl_R___ + .byte $10 ; 19/13 ___ctrl_S___ + .byte $10 ; 20/14 ___ctrl_T___ + .byte $10 ; 21/15 ___ctrl_U___ + .byte $10 ; 22/16 ___ctrl_V___ + .byte $10 ; 23/17 ___ctrl_W___ + .byte $10 ; 24/18 ___ctrl_X___ + .byte $10 ; 25/19 ___ctrl_Y___ + .byte $10 ; 26/1a ___ctrl_Z___ + .byte $10 ; 27/1b ___ctrl_[___ + .byte $10 ; 28/1c ___ctrl_\___ + .byte $10 ; 29/1d ___ctrl_]___ + .byte $10 ; 30/1e ___ctrl_^___ + .byte $10 ; 31/1f ___ctrl_____ + .byte $A0 ; 32/20 ___SPACE___ + .byte $00 ; 33/21 _____!_____ + .byte $00 ; 34/22 _____"_____ + .byte $00 ; 35/23 _____#_____ + .byte $00 ; 36/24 _____$_____ + .byte $00 ; 37/25 _____%_____ + .byte $00 ; 38/26 _____&_____ + .byte $00 ; 39/27 _____'_____ + .byte $00 ; 40/28 _____(_____ + .byte $00 ; 41/29 _____)_____ + .byte $00 ; 42/2a _____*_____ + .byte $00 ; 43/2b _____+_____ + .byte $00 ; 44/2c _____,_____ + .byte $00 ; 45/2d _____-_____ + .byte $00 ; 46/2e _____._____ + .byte $00 ; 47/2f _____/_____ + .byte $0C ; 48/30 _____0_____ + .byte $0C ; 49/31 _____1_____ + .byte $0C ; 50/32 _____2_____ + .byte $0C ; 51/33 _____3_____ + .byte $0C ; 52/34 _____4_____ + .byte $0C ; 53/35 _____5_____ + .byte $0C ; 54/36 _____6_____ + .byte $0C ; 55/37 _____7_____ + .byte $0C ; 56/38 _____8_____ + .byte $0C ; 57/39 _____9_____ + .byte $00 ; 58/3a _____:_____ + .byte $00 ; 59/3b _____;_____ + .byte $00 ; 60/3c _____<_____ + .byte $00 ; 61/3d _____=_____ + .byte $00 ; 62/3e _____>_____ + .byte $00 ; 63/3f _____?_____ - .byte $00 ; 64/40 _____@_____ - .byte $0A ; 65/41 _____A_____ - .byte $0A ; 66/42 _____B_____ - .byte $0A ; 67/43 _____C_____ - .byte $0A ; 68/44 _____D_____ - .byte $0A ; 69/45 _____E_____ - .byte $0A ; 70/46 _____F_____ - .byte $02 ; 71/47 _____G_____ - .byte $02 ; 72/48 _____H_____ - .byte $02 ; 73/49 _____I_____ - .byte $02 ; 74/4a _____J_____ - .byte $02 ; 75/4b _____K_____ - .byte $02 ; 76/4c _____L_____ - .byte $02 ; 77/4d _____M_____ - .byte $02 ; 78/4e _____N_____ - .byte $02 ; 79/4f _____O_____ - .byte $02 ; 80/50 _____P_____ - .byte $02 ; 81/51 _____Q_____ - .byte $02 ; 82/52 _____R_____ - .byte $02 ; 83/53 _____S_____ - .byte $02 ; 84/54 _____T_____ - .byte $02 ; 85/55 _____U_____ - .byte $02 ; 86/56 _____V_____ - .byte $02 ; 87/57 _____W_____ - .byte $02 ; 88/58 _____X_____ - .byte $02 ; 89/59 _____Y_____ - .byte $02 ; 90/5a _____Z_____ - .byte $00 ; 91/5b _____[_____ - .byte $00 ; 92/5c _____\_____ - .byte $00 ; 93/5d _____]_____ - .byte $00 ; 94/5e _____^_____ - .byte $00 ; 95/5f _UNDERLINE_ - .byte $00 ; 96/60 ___grave___ - .byte $09 ; 97/61 _____a_____ - .byte $09 ; 98/62 _____b_____ - .byte $09 ; 99/63 _____c_____ - .byte $09 ; 100/64 _____d_____ - .byte $09 ; 101/65 _____e_____ - .byte $09 ; 102/66 _____f_____ - .byte $01 ; 103/67 _____g_____ - .byte $01 ; 104/68 _____h_____ - .byte $01 ; 105/69 _____i_____ - .byte $01 ; 106/6a _____j_____ - .byte $01 ; 107/6b _____k_____ - .byte $01 ; 108/6c _____l_____ - .byte $01 ; 109/6d _____m_____ - .byte $01 ; 110/6e _____n_____ - .byte $01 ; 111/6f _____o_____ - .byte $01 ; 112/70 _____p_____ - .byte $01 ; 113/71 _____q_____ - .byte $01 ; 114/72 _____r_____ - .byte $01 ; 115/73 _____s_____ - .byte $01 ; 116/74 _____t_____ - .byte $01 ; 117/75 _____u_____ - .byte $01 ; 118/76 _____v_____ - .byte $01 ; 119/77 _____w_____ - .byte $01 ; 120/78 _____x_____ - .byte $01 ; 121/79 _____y_____ - .byte $01 ; 122/7a _____z_____ - .byte $00 ; 123/7b _____{_____ - .byte $00 ; 124/7c _____|_____ - .byte $00 ; 125/7d _____}_____ - .byte $00 ; 126/7e _____~_____ - .byte $40 ; 127/7f ____DEL____ + .byte $00 ; 64/40 _____@_____ + .byte $0A ; 65/41 _____A_____ + .byte $0A ; 66/42 _____B_____ + .byte $0A ; 67/43 _____C_____ + .byte $0A ; 68/44 _____D_____ + .byte $0A ; 69/45 _____E_____ + .byte $0A ; 70/46 _____F_____ + .byte $02 ; 71/47 _____G_____ + .byte $02 ; 72/48 _____H_____ + .byte $02 ; 73/49 _____I_____ + .byte $02 ; 74/4a _____J_____ + .byte $02 ; 75/4b _____K_____ + .byte $02 ; 76/4c _____L_____ + .byte $02 ; 77/4d _____M_____ + .byte $02 ; 78/4e _____N_____ + .byte $02 ; 79/4f _____O_____ + .byte $02 ; 80/50 _____P_____ + .byte $02 ; 81/51 _____Q_____ + .byte $02 ; 82/52 _____R_____ + .byte $02 ; 83/53 _____S_____ + .byte $02 ; 84/54 _____T_____ + .byte $02 ; 85/55 _____U_____ + .byte $02 ; 86/56 _____V_____ + .byte $02 ; 87/57 _____W_____ + .byte $02 ; 88/58 _____X_____ + .byte $02 ; 89/59 _____Y_____ + .byte $02 ; 90/5a _____Z_____ + .byte $00 ; 91/5b _____[_____ + .byte $00 ; 92/5c _____\_____ + .byte $00 ; 93/5d _____]_____ + .byte $00 ; 94/5e _____^_____ + .byte $00 ; 95/5f _UNDERLINE_ + .byte $00 ; 96/60 ___grave___ + .byte $09 ; 97/61 _____a_____ + .byte $09 ; 98/62 _____b_____ + .byte $09 ; 99/63 _____c_____ + .byte $09 ; 100/64 _____d_____ + .byte $09 ; 101/65 _____e_____ + .byte $09 ; 102/66 _____f_____ + .byte $01 ; 103/67 _____g_____ + .byte $01 ; 104/68 _____h_____ + .byte $01 ; 105/69 _____i_____ + .byte $01 ; 106/6a _____j_____ + .byte $01 ; 107/6b _____k_____ + .byte $01 ; 108/6c _____l_____ + .byte $01 ; 109/6d _____m_____ + .byte $01 ; 110/6e _____n_____ + .byte $01 ; 111/6f _____o_____ + .byte $01 ; 112/70 _____p_____ + .byte $01 ; 113/71 _____q_____ + .byte $01 ; 114/72 _____r_____ + .byte $01 ; 115/73 _____s_____ + .byte $01 ; 116/74 _____t_____ + .byte $01 ; 117/75 _____u_____ + .byte $01 ; 118/76 _____v_____ + .byte $01 ; 119/77 _____w_____ + .byte $01 ; 120/78 _____x_____ + .byte $01 ; 121/79 _____y_____ + .byte $01 ; 122/7a _____z_____ + .byte $00 ; 123/7b _____{_____ + .byte $00 ; 124/7c _____|_____ + .byte $00 ; 125/7d _____}_____ + .byte $00 ; 126/7e _____~_____ + .byte $40 ; 127/7f ____DEL____ .endrepeat diff --git a/libsrc/lynx/defdir.s b/libsrc/lynx/defdir.s index adff6d9d5..5ab61ac14 100644 --- a/libsrc/lynx/defdir.s +++ b/libsrc/lynx/defdir.s @@ -3,18 +3,18 @@ ; ; A default directory with just the main executable. ; - .include "lynx.inc" - .import __STARTOFDIRECTORY__ - .import __RAM_START__ - .import __CODE_SIZE__,__DATA_SIZE__,__RODATA_SIZE__ - .import __STARTUP_SIZE__,__INIT_SIZE__ - .import __BLOCKSIZE__ - .export __DEFDIR__: absolute = 1 + .include "lynx.inc" + .import __STARTOFDIRECTORY__ + .import __RAM_START__ + .import __CODE_SIZE__,__DATA_SIZE__,__RODATA_SIZE__ + .import __STARTUP_SIZE__,__INIT_SIZE__ + .import __BLOCKSIZE__ + .export __DEFDIR__: absolute = 1 ; ------------------------------------------------------------------------ ; Lynx directory - .segment "DIRECTORY" + .segment "DIRECTORY" __DIRECTORY_START__: off0=__STARTOFDIRECTORY__+(__DIRECTORY_END__-__DIRECTORY_START__) diff --git a/libsrc/lynx/eeprom.s b/libsrc/lynx/eeprom.s index 5dc535b4a..978220cfd 100644 --- a/libsrc/lynx/eeprom.s +++ b/libsrc/lynx/eeprom.s @@ -42,10 +42,10 @@ ;**************** - .export _lynx_eeprom_read + .export _lynx_eeprom_read .export _lynx_eeprom_write .export _lynx_eeprom_erase - .import popa + .import popa .importzp ptr1 .include "lynx.inc" diff --git a/libsrc/lynx/eeprom46.s b/libsrc/lynx/eeprom46.s index 961ecf76a..55d9037c0 100644 --- a/libsrc/lynx/eeprom46.s +++ b/libsrc/lynx/eeprom46.s @@ -8,7 +8,7 @@ ; 16.02.96 leaner (thanks to Harry) ; 12.03.96 test for busy after write and erase (well, Harry ;)) ) ; 22.08.97 ported to ra65 for use with cc65 -; 02.12.97 added xref for the new ra65 +; 02.12.97 added xref for the new ra65 ; ; ; (c) 1995..97 Bastian Schick @@ -25,9 +25,9 @@ ; +---| DI |- NC ;(32) AUDIN ----+---| DO |- GND ; ---------- - .export _lynx_eeread_93c46 + .export _lynx_eeread_93c46 .export _lynx_eewrite_93c46 - .import popax + .import popax .importzp ptr1 .include "lynx.inc" @@ -45,160 +45,160 @@ EE_C_EWDS = $00 ; /* Read a 16 bit word from the given address */ ; _lynx_eeread_93c46: - and #$3f - ora #EE_C_READ - jsr EE_Send9Bit - jsr EE_Read16Bit - lda ptr1 - ldx ptr1+1 - rts + and #$3f + ora #EE_C_READ + jsr EE_Send9Bit + jsr EE_Read16Bit + lda ptr1 + ldx ptr1+1 + rts ;*************** ; reads EEPROM-word to ptr1 ; A,Y destroyed EE_Read16Bit: - lda #$a - sta IODIR ; set AUDIN to Input - clc - stz ptr1 - stz ptr1+1 - ldy #15 + lda #$a + sta IODIR ; set AUDIN to Input + clc + stz ptr1 + stz ptr1+1 + ldy #15 EEloop1: ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 - lda IODAT - and #$10 ; mask bit - adc #$f0 ; C=1 if A=$10 - rol ptr1 - rol ptr1+1 ; shifts 0 to Carry - dey - bpl EEloop1 + lda IODAT + and #$10 ; mask bit + adc #$f0 ; C=1 if A=$10 + rol ptr1 + rol ptr1+1 ; shifts 0 to Carry + dey + bpl EEloop1 - ldx #$1a - stx IODIR ; set AUDIN for output + ldx #$1a + stx IODIR ; set AUDIN for output ;EE_SET_CS_LOW - ldx #3 - stx SYSCTL1 - dex - stx SYSCTL1 + ldx #3 + stx SYSCTL1 + dex + stx SYSCTL1 - rts + rts ;*************** ; write word to EEPROM ; void __fastcall__ lynx_eewrite_93c46(unsigned int addr, unsigned int val); _lynx_eewrite_93c46: - sta ptr1 - stx ptr1+1 - lda #EE_C_EWEN - jsr EE_Send9Bit - jsr popax - and #$3f - ora #EE_C_WRITE - jsr EE_Send9Bit - jsr EE_Send16Bit ; Sends ptr1 that contains val + sta ptr1 + stx ptr1+1 + lda #EE_C_EWEN + jsr EE_Send9Bit + jsr popax + and #$3f + ora #EE_C_WRITE + jsr EE_Send9Bit + jsr EE_Send16Bit ; Sends ptr1 that contains val EE_wait: ; EE_SET_CS_HIGH - ldx #63 + ldx #63 EEloop: - stz RCART0 - stz RCART0 - dex - bpl EEloop + stz RCART0 + stz RCART0 + dex + bpl EEloop - lda #$0A - sta IODIR ; AUDIN to input - lda #$10 + lda #$0A + sta IODIR ; AUDIN to input + lda #$10 EE_wait1: - bit IODAT ; 'til ready :D0-read is /D0-written - beq EE_wait1 - lda #$1a ; AUDIN to output - sta IODIR - lda #EE_C_EWDS -; bra EE_Send9Bit ; fall into + bit IODAT ; 'til ready :D0-read is /D0-written + beq EE_wait1 + lda #$1a ; AUDIN to output + sta IODIR + lda #EE_C_EWDS +; bra EE_Send9Bit ; fall into ;*************** ; send A via I2C ; A,Y destroyed ;*************** EE_Send9Bit: ; EE_SET_CS_LOW - ldy #3 - sty SYSCTL1 - dey - sty SYSCTL1 + ldy #3 + sty SYSCTL1 + dey + sty SYSCTL1 ; EE_SET_CS_HIGH - ldy #63 + ldy #63 EEloop2: - stz RCART0 - stz RCART0 - dey - bpl EEloop2 + stz RCART0 + stz RCART0 + dey + bpl EEloop2 - ldy #8 - sec ; start bit - ror A - ror A - ror A - ror A ; bit 8 at pos. 4 + ldy #8 + sec ; start bit + ror A + ror A + ror A + ror A ; bit 8 at pos. 4 EEloop3: - tax - and #$10 - ora #$b - sta IODAT + tax + and #$10 + ora #$b + sta IODAT ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 - txa - rol A - dey - bpl EEloop3 - rts + stz RCART0 + stz RCART0 + txa + rol A + dey + bpl EEloop3 + rts ;*************** ; send ptr1 to EEPROM EE_Send16Bit: - lda ptr1+1 + lda ptr1+1 - ror A - ror ptr1 - ror A - ror ptr1 - ror A - ror ptr1 + ror A + ror ptr1 + ror A + ror ptr1 + ror A + ror ptr1 - ldy #15 + ldy #15 EEloop5: - tax - and #$10 - ora #$b - sta IODAT + tax + and #$10 + ora #$b + sta IODAT ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 - txa - rol ptr1 - rol A - dey - bpl EEloop5 + stz RCART0 + stz RCART0 + txa + rol ptr1 + rol A + dey + bpl EEloop5 ; EE_SET_CS_LOW - ldx #3 - stx SYSCTL1 - dex - stx SYSCTL1 - rts + ldx #3 + stx SYSCTL1 + dex + stx SYSCTL1 + rts diff --git a/libsrc/lynx/eeprom66.s b/libsrc/lynx/eeprom66.s index 0fcf081ed..680db8166 100644 --- a/libsrc/lynx/eeprom66.s +++ b/libsrc/lynx/eeprom66.s @@ -8,7 +8,7 @@ ; 16.02.96 leaner (thanks to Harry) ; 12.03.96 test for busy after write and erase (well, Harry ;)) ) ; 22.08.97 ported to ra65 for use with cc65 -; 02.12.97 added xref for the new ra65 +; 02.12.97 added xref for the new ra65 ; 2010 93c66 support B. Spruck ; 2011 modified to suit cc65 environment Karri Kaksonen ; @@ -27,12 +27,12 @@ ;(32) AUDIN ----+---| DO |- GND ; ---------- - .export _lynx_eeread_93c66 - .export _lynx_eewrite_93c66 - .import popax - .importzp ptr1 + .export _lynx_eeread_93c66 + .export _lynx_eewrite_93c66 + .import popax + .importzp ptr1 - .include "lynx.inc" + .include "lynx.inc" ; ------------------- ; EEPROM command list @@ -48,180 +48,180 @@ EE_C_EWDS2 = $00 ; Only lower byte in A is used for address ; unsigned int __fastcall__ lynx_eeread_93c66(unsigned int addr); _lynx_eeread_93c66: - ldx #EE_C_READ - jsr EE_Send11Bit - jsr EE_Read16Bit - lda ptr1 - ldx ptr1+1 - rts + ldx #EE_C_READ + jsr EE_Send11Bit + jsr EE_Read16Bit + lda ptr1 + ldx ptr1+1 + rts ;*************** ; reads EEPROM-word to ptr1 ; A,Y destroyed EE_Read16Bit: - lda #$a - sta IODIR ; set AUDIN to Input - clc - stz ptr1 - stz ptr1+1 - ldy #15 + lda #$a + sta IODIR ; set AUDIN to Input + clc + stz ptr1 + stz ptr1+1 + ldy #15 EEloop1: ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 - lda IODAT - and #$10 ; mask bit - adc #$f0 ; C=1 if A=$10 - rol ptr1 - rol ptr1+1 ; shifts 0 to Carry - dey - bpl EEloop1 + lda IODAT + and #$10 ; mask bit + adc #$f0 ; C=1 if A=$10 + rol ptr1 + rol ptr1+1 ; shifts 0 to Carry + dey + bpl EEloop1 - ldx #$1a - stx IODIR ; set AUDIN for output + ldx #$1a + stx IODIR ; set AUDIN for output ;EE_SET_CS_LOW - ldx #3 - stx SYSCTL1 - dex - stx SYSCTL1 + ldx #3 + stx SYSCTL1 + dex + stx SYSCTL1 - rts + rts ;*************** ; write word to EEPROM ; void __fastcall__ lynx_eewrite_93c66(unsigned int addr, unsigned int val); _lynx_eewrite_93c66: - sta ptr1 - stx ptr1+1 - ldx #EE_C_EWEN - lda #EE_C_EWEN2 - jsr EE_Send11Bit - jsr popax - ldx #EE_C_WRITE - jsr EE_Send11Bit - jsr EE_Send16Bit ; Sends ptr1 that contains val + sta ptr1 + stx ptr1+1 + ldx #EE_C_EWEN + lda #EE_C_EWEN2 + jsr EE_Send11Bit + jsr popax + ldx #EE_C_WRITE + jsr EE_Send11Bit + jsr EE_Send16Bit ; Sends ptr1 that contains val EE_wait: ; EE_SET_CS_HIGH - ldx #63 + ldx #63 EEloop: - stz RCART0 - stz RCART0 - dex - bpl EEloop + stz RCART0 + stz RCART0 + dex + bpl EEloop - lda #$0A - sta IODIR ; AUDIN to input - lda #$10 + lda #$0A + sta IODIR ; AUDIN to input + lda #$10 EE_wait1: - bit IODAT ; 'til ready :D0-read is /D0-written - beq EE_wait1 - lda #$1a ; AUDIN to output - sta IODIR - ldx #EE_C_EWDS - lda #EE_C_EWDS2 -; bra EE_Send11Bit ; fall into + bit IODAT ; 'til ready :D0-read is /D0-written + beq EE_wait1 + lda #$1a ; AUDIN to output + sta IODIR + ldx #EE_C_EWDS + lda #EE_C_EWDS2 +; bra EE_Send11Bit ; fall into ;*************** ; send A via I2C ; A,Y destroyed EE_Send11Bit: ; EE_SET_CS_LOW - ldy #3 - sty SYSCTL1 - dey - sty SYSCTL1 + ldy #3 + sty SYSCTL1 + dey + sty SYSCTL1 ; EE_SET_CS_HIGH - ldy #63 + ldy #63 EEloop2: - stz RCART0 - stz RCART0 - dey - bpl EEloop2 + stz RCART0 + stz RCART0 + dey + bpl EEloop2 - pha - txa ;; Ok erstmal x abarbeiten und A sichern - ldy #2 ; 3 times + pha + txa ;; Ok erstmal x abarbeiten und A sichern + ldy #2 ; 3 times EEloop3: - tax - and #$10 - ora #$b - sta IODAT + tax + and #$10 + ora #$b + sta IODAT ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 - txa - rol A - dey - bpl EEloop3 + stz RCART0 + stz RCART0 + txa + rol A + dey + bpl EEloop3 - ldy #7 ; 8 times - pla ;; jetzt kommt a an die reihe + ldy #7 ; 8 times + pla ;; jetzt kommt a an die reihe - ror A - ror A - ror A ; bit 7 at pos. 4 + ror A + ror A + ror A ; bit 7 at pos. 4 EEloop4: - tax - and #$10 + tax + and #$10 - ora #$b - sta IODAT + ora #$b + sta IODAT ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 - txa - rol A - dey - bpl EEloop4 - rts + stz RCART0 + stz RCART0 + txa + rol A + dey + bpl EEloop4 + rts ;*************** ; send ptr1 to EEPROM EE_Send16Bit: - lda ptr1+1 + lda ptr1+1 - ror A - ror ptr1 - ror A - ror ptr1 - ror A - ror ptr1 + ror A + ror ptr1 + ror A + ror ptr1 + ror A + ror ptr1 - ldy #15 + ldy #15 EEloop5: - tax - and #$10 - ora #$b - sta IODAT + tax + and #$10 + ora #$b + sta IODAT ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 - txa - rol ptr1 - rol A - dey - bpl EEloop5 + stz RCART0 + stz RCART0 + txa + rol ptr1 + rol A + dey + bpl EEloop5 ; EE_SET_CS_LOW - ldx #3 - stx SYSCTL1 - dex - stx SYSCTL1 - rts + ldx #3 + stx SYSCTL1 + dex + stx SYSCTL1 + rts diff --git a/libsrc/lynx/eeprom86.s b/libsrc/lynx/eeprom86.s index d645fea51..f753b73c3 100644 --- a/libsrc/lynx/eeprom86.s +++ b/libsrc/lynx/eeprom86.s @@ -8,7 +8,7 @@ ; 16.02.96 leaner (thanks to Harry) ; 12.03.96 test for busy after write and erase (well, Harry ;)) ) ; 22.08.97 ported to ra65 for use with cc65 -; 02.12.97 added xref for the new ra65 +; 02.12.97 added xref for the new ra65 ; 2010 93c66 support B. Spruck ; 2010 93c86 support B. Spruck ; 2011 modified to suit cc65 environment Karri Kaksonen @@ -28,12 +28,12 @@ ;(32) AUDIN ----+---| DO |- GND ; ---------- - .export _lynx_eeread_93c86 - .export _lynx_eewrite_93c86 - .import popax - .importzp ptr1 + .export _lynx_eeread_93c86 + .export _lynx_eewrite_93c86 + .import popax + .importzp ptr1 - .include "lynx.inc" + .include "lynx.inc" ; ------------------- ; EEPROM command list @@ -49,188 +49,188 @@ EE_C_EWDS2 = $00 ; Only lower byte in A is used for address ; unsigned int __fastcall__ lynx_eeread_93c86(unsigned int addr); _lynx_eeread_93c86: - pha - txa - ora #EE_C_READ - tax - pla - jsr EE_Send13Bit - jsr EE_Read16Bit - lda ptr1 - ldx ptr1+1 - rts + pha + txa + ora #EE_C_READ + tax + pla + jsr EE_Send13Bit + jsr EE_Read16Bit + lda ptr1 + ldx ptr1+1 + rts ;*************** ; reads EEPROM-word to ptr1 ; A,Y destroyed EE_Read16Bit: - lda #$a - sta IODIR ; set AUDIN to Input - clc - stz ptr1 - stz ptr1+1 - ldy #15 + lda #$a + sta IODIR ; set AUDIN to Input + clc + stz ptr1 + stz ptr1+1 + ldy #15 EEloop1: ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 - lda IODAT - and #$10 ; mask bit - adc #$f0 ; C=1 if A=$10 - rol ptr1 - rol ptr1+1 ; shifts 0 to Carry - dey - bpl EEloop1 + lda IODAT + and #$10 ; mask bit + adc #$f0 ; C=1 if A=$10 + rol ptr1 + rol ptr1+1 ; shifts 0 to Carry + dey + bpl EEloop1 - ldx #$1a - stx IODIR ; set AUDIN for output + ldx #$1a + stx IODIR ; set AUDIN for output ;EE_SET_CS_LOW - ldx #3 - stx SYSCTL1 - dex - stx SYSCTL1 + ldx #3 + stx SYSCTL1 + dex + stx SYSCTL1 - rts + rts ;*************** ; write word to EEPROM ; void __fastcall__ lynx_eewrite_93c86(unsigned int addr, unsigned int val); _lynx_eewrite_93c86: - sta ptr1 - stx ptr1+1 - ldx #EE_C_EWEN - lda #EE_C_EWEN2 - jsr EE_Send13Bit - jsr popax - pha - txa - ora #EE_C_WRITE - tax - pla - jsr EE_Send13Bit - jsr EE_Send16Bit ; Sends ptr1 that contains val + sta ptr1 + stx ptr1+1 + ldx #EE_C_EWEN + lda #EE_C_EWEN2 + jsr EE_Send13Bit + jsr popax + pha + txa + ora #EE_C_WRITE + tax + pla + jsr EE_Send13Bit + jsr EE_Send16Bit ; Sends ptr1 that contains val EE_wait: ; EE_SET_CS_HIGH - ldx #63 + ldx #63 EEloop: - stz RCART0 - stz RCART0 - dex - bpl EEloop + stz RCART0 + stz RCART0 + dex + bpl EEloop - lda #$0A - sta IODIR ; AUDIN to input - lda #$10 + lda #$0A + sta IODIR ; AUDIN to input + lda #$10 EE_wait1: - bit IODAT ; 'til ready :D0-read is /D0-written - beq EE_wait1 - lda #$1a ; AUDIN to output - sta IODIR - ldx #EE_C_EWDS - lda #EE_C_EWDS2 -; bra EE_Send13Bit ; fall into + bit IODAT ; 'til ready :D0-read is /D0-written + beq EE_wait1 + lda #$1a ; AUDIN to output + sta IODIR + ldx #EE_C_EWDS + lda #EE_C_EWDS2 +; bra EE_Send13Bit ; fall into ;*************** ; send A via I2C ; A,Y destroyed EE_Send13Bit: ; EE_SET_CS_LOW - ldy #3 - sty SYSCTL1 - dey - sty SYSCTL1 + ldy #3 + sty SYSCTL1 + dey + sty SYSCTL1 ; EE_SET_CS_HIGH - ldy #63 + ldy #63 EEloop2: - stz RCART0 - stz RCART0 - dey - bpl EEloop2 + stz RCART0 + stz RCART0 + dey + bpl EEloop2 - pha - txa ;; Ok erstmal x abarbeiten und A sichern - ldy #4 ; 5 times + pha + txa ;; Ok erstmal x abarbeiten und A sichern + ldy #4 ; 5 times EEloop3: - tax - and #$10 - ora #$b - sta IODAT + tax + and #$10 + ora #$b + sta IODAT ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 - txa - rol A - dey - bpl EEloop3 + stz RCART0 + stz RCART0 + txa + rol A + dey + bpl EEloop3 - ldy #7 ; 8 times - pla ;; jetzt kommt a an die reihe + ldy #7 ; 8 times + pla ;; jetzt kommt a an die reihe - ror A - ror A - ror A ; bit 7 at pos. 4 + ror A + ror A + ror A ; bit 7 at pos. 4 EEloop4: - tax - and #$10 + tax + and #$10 - ora #$b - sta IODAT + ora #$b + sta IODAT ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 - txa - rol A - dey - bpl EEloop4 - rts + stz RCART0 + stz RCART0 + txa + rol A + dey + bpl EEloop4 + rts ;*************** ; send ptr1 to EEPROM EE_Send16Bit: - lda ptr1+1 + lda ptr1+1 - ror A - ror ptr1 - ror A - ror ptr1 - ror A - ror ptr1 + ror A + ror ptr1 + ror A + ror ptr1 + ror A + ror ptr1 - ldy #15 + ldy #15 EEloop5: - tax - and #$10 - ora #$b - sta IODAT + tax + and #$10 + ora #$b + sta IODAT ; CLK = 1 - stz RCART0 - stz RCART0 + stz RCART0 + stz RCART0 ; CLK = 0 - stz RCART0 - stz RCART0 - txa - rol ptr1 - rol A - dey - bpl EEloop5 + stz RCART0 + stz RCART0 + txa + rol ptr1 + rol A + dey + bpl EEloop5 ; EE_SET_CS_LOW - ldx #3 - stx SYSCTL1 - dex - stx SYSCTL1 - rts + ldx #3 + stx SYSCTL1 + dex + stx SYSCTL1 + rts diff --git a/libsrc/lynx/exec.s b/libsrc/lynx/exec.s index 44550fd7b..c0a630a72 100644 --- a/libsrc/lynx/exec.s +++ b/libsrc/lynx/exec.s @@ -9,26 +9,26 @@ ; ; void lynx_exec(int fileno) ; - .importzp _FileDestAddr - .import pushax,ldax0sp,incsp2 - .import _lynx_load - .export _lynx_exec + .importzp _FileDestAddr + .import pushax,ldax0sp,incsp2 + .import _lynx_load + .export _lynx_exec ; --------------------------------------------------------------- ; void __near__ __fastcall__ lynx_exec (int) ; --------------------------------------------------------------- -.segment "CODE" +.segment "CODE" -.proc _lynx_exec: near +.proc _lynx_exec: near -.segment "CODE" +.segment "CODE" - jsr pushax - jsr ldax0sp - jsr _lynx_load - jsr incsp2 - jmp (_FileDestAddr) + jsr pushax + jsr ldax0sp + jsr _lynx_load + jsr incsp2 + jmp (_FileDestAddr) .endproc diff --git a/libsrc/lynx/exehdr.s b/libsrc/lynx/exehdr.s index c1b06c408..4f077fb82 100644 --- a/libsrc/lynx/exehdr.s +++ b/libsrc/lynx/exehdr.s @@ -3,20 +3,20 @@ ; ; This header contains data for emulators like Handy and Mednafen ; - .import __BLOCKSIZE__ - .export __EXEHDR__: absolute = 1 + .import __BLOCKSIZE__ + .export __EXEHDR__: absolute = 1 ; ------------------------------------------------------------------------ ; EXE header - .segment "EXEHDR" - .byte 'L','Y','N','X' ; magic - .word __BLOCKSIZE__ ; bank 0 page size - .word __BLOCKSIZE__ ; bank 1 page size - .word 1 ; version number - .asciiz "Cart name " ; 32 bytes cart name - .asciiz "Manufacturer " ; 16 bytes manufacturer - .byte 0 ; rotation 1=left - ; rotation 2=right - .byte 0,0,0,0,0 ; spare + .segment "EXEHDR" + .byte 'L','Y','N','X' ; magic + .word __BLOCKSIZE__ ; bank 0 page size + .word __BLOCKSIZE__ ; bank 1 page size + .word 1 ; version number + .asciiz "Cart name " ; 32 bytes cart name + .asciiz "Manufacturer " ; 16 bytes manufacturer + .byte 0 ; rotation 1=left + ; rotation 2=right + .byte 0,0,0,0,0 ; spare diff --git a/libsrc/lynx/extzp.inc b/libsrc/lynx/extzp.inc index 8842acc6b..2b0f68701 100644 --- a/libsrc/lynx/extzp.inc +++ b/libsrc/lynx/extzp.inc @@ -8,23 +8,23 @@ ; - .global __iodat: zp + .global __iodat: zp .global __iodir: zp .global __viddma: zp .global __sprsys: zp - .global _abc_score_ptr0: zp - .global _abc_score_ptr1: zp - .global _abc_score_ptr2: zp - .global _abc_score_ptr3: zp - .global _FileEntry: zp - .global _FileStartBlock: zp - .global _FileBlockOffset: zp - .global _FileExecFlag: zp - .global _FileDestAddr: zp - .global _FileFileLen: zp - .global _FileCurrBlock: zp - .global _FileBlockByte: zp - .global _FileDestPtr: zp + .global _abc_score_ptr0: zp + .global _abc_score_ptr1: zp + .global _abc_score_ptr2: zp + .global _abc_score_ptr3: zp + .global _FileEntry: zp + .global _FileStartBlock: zp + .global _FileBlockOffset: zp + .global _FileExecFlag: zp + .global _FileDestAddr: zp + .global _FileFileLen: zp + .global _FileCurrBlock: zp + .global _FileBlockByte: zp + .global _FileDestPtr: zp diff --git a/libsrc/lynx/extzp.s b/libsrc/lynx/extzp.s index fab93c04f..f22cfaefb 100644 --- a/libsrc/lynx/extzp.s +++ b/libsrc/lynx/extzp.s @@ -25,7 +25,7 @@ _abc_score_ptr3: .res 2 ; ------------------------------------------------------------------------ ; Filesystem variables needed for reading stuff from the Lynx cart -_FileEntry: ; The file directory entry is 8 bytes +_FileEntry: ; The file directory entry is 8 bytes _FileStartBlock: .res 1 _FileBlockOffset: .res 2 _FileExecFlag: .res 1 diff --git a/libsrc/lynx/irq.s b/libsrc/lynx/irq.s index b22b69a77..4a6adfb04 100644 --- a/libsrc/lynx/irq.s +++ b/libsrc/lynx/irq.s @@ -2,45 +2,45 @@ ; IRQ handling (Lynx version) ; - .export initirq, doneirq - .import callirq + .export initirq, doneirq + .import callirq - .include "lynx.inc" + .include "lynx.inc" ; ------------------------------------------------------------------------ -.segment "INIT" +.segment "INIT" initirq: - lda #IRQStub - sei - sta INTVECTL - stx INTVECTH - cli - rts + lda #IRQStub + sei + sta INTVECTL + stx INTVECTH + cli + rts ; ------------------------------------------------------------------------ .code doneirq: - ; as Lynx is a console there is not much point in releasing the IRQ - rts + ; as Lynx is a console there is not much point in releasing the IRQ + rts ; ------------------------------------------------------------------------ -.segment "LOWCODE" +.segment "LOWCODE" IRQStub: - phy - phx - pha - cld - jsr callirq - lda INTSET - sta INTRST - pla - plx - ply - rti + phy + phx + pha + cld + jsr callirq + lda INTSET + sta INTRST + pla + plx + ply + rti diff --git a/libsrc/lynx/joy/lynx-stdjoy.s b/libsrc/lynx/joy/lynx-stdjoy.s index 3ebca7a85..9c5165a77 100644 --- a/libsrc/lynx/joy/lynx-stdjoy.s +++ b/libsrc/lynx/joy/lynx-stdjoy.s @@ -7,9 +7,9 @@ ; Using code from Steve Schmidtke ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" + .include "joy-kernel.inc" .include "joy-error.inc" .include "lynx.inc" @@ -23,7 +23,7 @@ ; Driver signature - .byte $6A, $6F, $79 ; "joy" + .byte $6A, $6F, $79 ; "joy" .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) @@ -68,7 +68,7 @@ JOY_COUNT = 1 ; Number of joysticks we support INSTALL: lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -92,7 +92,7 @@ COUNT: ; READ: Read a particular joystick passed in A. READ: - ldx #$00 ; Clear high byte + ldx #$00 ; Clear high byte lda JOYSTICK ; Read joystick and #$F3 ; Mask relevant keys rts diff --git a/libsrc/lynx/joy_stat_stddrv.s b/libsrc/lynx/joy_stat_stddrv.s index 19bf564ef..4605da3cf 100644 --- a/libsrc/lynx/joy_stat_stddrv.s +++ b/libsrc/lynx/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _lynx_stdjoy_joy + .export _joy_static_stddrv + .import _lynx_stdjoy_joy .rodata diff --git a/libsrc/lynx/joy_stddrv.s b/libsrc/lynx/joy_stddrv.s index eadc44d01..b0d30e8d5 100644 --- a/libsrc/lynx/joy_stddrv.s +++ b/libsrc/lynx/joy_stddrv.s @@ -6,8 +6,8 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "lynx-stdjoy.joy" +_joy_stddrv: .asciiz "lynx-stdjoy.joy" diff --git a/libsrc/lynx/kbhit.s b/libsrc/lynx/kbhit.s index f6a426285..b606fc49a 100644 --- a/libsrc/lynx/kbhit.s +++ b/libsrc/lynx/kbhit.s @@ -4,10 +4,10 @@ ; unsigned char kbhit (void); ; - .export _kbhit - .export KBEDG - .export KBSTL - .import return1 + .export _kbhit + .export KBEDG + .export KBSTL + .import return1 ; -------------------------------------------------------------------------- ; The Atari Lynx has a very small keyboard - only 3 keys @@ -19,38 +19,38 @@ ; and Opt1 + Opt2 pressed '3'. ; So the keyboard returns '1', '2', '3', 'P', 'R', 'F' or '?'. - .data -KBTMP: .byte 0 -KBPRV: .byte 0 -KBEDG: .byte 0 -KBSTL: .byte 0 -KBDEB: .byte 0 -KBNPR: .byte 0 + .data +KBTMP: .byte 0 +KBPRV: .byte 0 +KBEDG: .byte 0 +KBSTL: .byte 0 +KBDEB: .byte 0 +KBNPR: .byte 0 - .code + .code _kbhit: - lda $FCB0 ; Read the Opt buttons - and #$0c - sta KBTMP - lda $FCB1 ; Read Pause - and #1 - ora KBTMP ; 0000210P - tax - and KBPRV - sta KBSTL ; for multibutton - txa - and KBDEB - sta KBEDG ; for just depressed - txa - and KBNPR - sta KBDEB ; for debouncing - txa - eor #$ff - sta KBNPR ; inverted previous ones pressed - stx KBPRV - lda KBEDG - beq @L1 - jmp return1 ; Key hit + lda $FCB0 ; Read the Opt buttons + and #$0c + sta KBTMP + lda $FCB1 ; Read Pause + and #1 + ora KBTMP ; 0000210P + tax + and KBPRV + sta KBSTL ; for multibutton + txa + and KBDEB + sta KBEDG ; for just depressed + txa + and KBNPR + sta KBDEB ; for debouncing + txa + eor #$ff + sta KBNPR ; inverted previous ones pressed + stx KBPRV + lda KBEDG + beq @L1 + jmp return1 ; Key hit @L1: tax ; No new keys hit rts diff --git a/libsrc/lynx/load.s b/libsrc/lynx/load.s index 2e6baa9cb..c638177e2 100644 --- a/libsrc/lynx/load.s +++ b/libsrc/lynx/load.s @@ -7,35 +7,35 @@ ; ; void lynx_load(int fileno) ; - .importzp _FileFileLen - .importzp _FileDestAddr - .import pushax,ldax0sp,pusha0,incsp2 - .import _openn - .import _read - .export _lynx_load + .importzp _FileFileLen + .importzp _FileDestAddr + .import pushax,ldax0sp,pusha0,incsp2 + .import _openn + .import _read + .export _lynx_load ; --------------------------------------------------------------- ; void __near__ __fastcall__ lynx_load (int) ; --------------------------------------------------------------- -.segment "CODE" +.segment "CODE" -.proc _lynx_load: near +.proc _lynx_load: near -.segment "CODE" +.segment "CODE" - jsr pushax - jsr ldax0sp - jsr _openn - lda #$01 - jsr pusha0 - lda _FileDestAddr - ldx _FileDestAddr+1 - jsr pushax - lda _FileFileLen - ldx _FileFileLen+1 - jsr _read - jmp incsp2 + jsr pushax + jsr ldax0sp + jsr _openn + lda #$01 + jsr pusha0 + lda _FileDestAddr + ldx _FileDestAddr+1 + jsr pushax + lda _FileFileLen + ldx _FileFileLen+1 + jsr _read + jmp incsp2 .endproc diff --git a/libsrc/lynx/lseek.s b/libsrc/lynx/lseek.s index 27f7d4af7..4b4f94d7c 100644 --- a/libsrc/lynx/lseek.s +++ b/libsrc/lynx/lseek.s @@ -11,48 +11,48 @@ ; ; off_t __fastcall__ lseek(int fd, off_t offset, int whence); - .importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2 - .macpack longbranch - .export _lseek - .import addysp, stax0sp, tosand0ax, pusheax, asreax2 - .import ldeaxysp, decsp2, pushax, incsp8 - .import tosandeax,decax1,tosdiveax,axlong,ldaxysp - .import lynxskip0, lynxblock,tosasreax - .import __BLOCKSIZE__ - .importzp _FileCurrBlock + .importzp sp, sreg, regsave, regbank, tmp1, ptr1, ptr2 + .macpack longbranch + .export _lseek + .import addysp, stax0sp, tosand0ax, pusheax, asreax2 + .import ldeaxysp, decsp2, pushax, incsp8 + .import tosandeax,decax1,tosdiveax,axlong,ldaxysp + .import lynxskip0, lynxblock,tosasreax + .import __BLOCKSIZE__ + .importzp _FileCurrBlock -.segment "CODE" +.segment "CODE" -.proc _lseek: near +.proc _lseek: near -.segment "CODE" +.segment "CODE" - jsr pushax - ldy #$05 - jsr ldeaxysp - jsr pusheax - ldx #$00 - lda #<(__BLOCKSIZE__/1024 + 9) - jsr tosasreax - sta _FileCurrBlock - jsr lynxblock - ldy #$05 - jsr ldeaxysp - jsr pusheax - lda #<(__BLOCKSIZE__-1) - ldx #>(__BLOCKSIZE__-1) - jsr axlong - jsr tosandeax - eor #$FF - pha - txa - eor #$FF - tay - plx - jsr lynxskip0 - ldy #$05 - jsr ldeaxysp - jmp incsp8 + jsr pushax + ldy #$05 + jsr ldeaxysp + jsr pusheax + ldx #$00 + lda #<(__BLOCKSIZE__/1024 + 9) + jsr tosasreax + sta _FileCurrBlock + jsr lynxblock + ldy #$05 + jsr ldeaxysp + jsr pusheax + lda #<(__BLOCKSIZE__-1) + ldx #>(__BLOCKSIZE__-1) + jsr axlong + jsr tosandeax + eor #$FF + pha + txa + eor #$FF + tay + plx + jsr lynxskip0 + ldy #$05 + jsr ldeaxysp + jmp incsp8 .endproc diff --git a/libsrc/lynx/lynx-cart.s b/libsrc/lynx/lynx-cart.s index 42729a106..86e907348 100644 --- a/libsrc/lynx/lynx-cart.s +++ b/libsrc/lynx/lynx-cart.s @@ -13,86 +13,86 @@ ; with 1024 bytes/block carts that are using CART0 as a read strobe. ; Also the default crt0.s supports this most common Lynx cart format. - .include "lynx.inc" - .include "extzp.inc" - .export lynxskip0, lynxread0 - .export lynxblock - .import __BLOCKSIZE__ + .include "lynx.inc" + .include "extzp.inc" + .export lynxskip0, lynxread0 + .export lynxblock + .import __BLOCKSIZE__ - .code + .code ;********************************** ; Skip bytes on bank 0 ; X:Y count (EOR $FFFF) ;********************************** lynxskip0: - inx - bne @0 - iny - beq exit -@0: jsr readbyte0 - bra lynxskip0 + inx + bne @0 + iny + beq exit +@0: jsr readbyte0 + bra lynxskip0 ;********************************** ; Read bytes from bank 0 ; X:Y count (EOR $ffff) ;********************************** lynxread0: - inx - bne @1 - iny - beq exit -@1: jsr readbyte0 - sta (_FileDestPtr) - inc _FileDestPtr - bne lynxread0 - inc _FileDestPtr+1 - bra lynxread0 + inx + bne @1 + iny + beq exit +@1: jsr readbyte0 + sta (_FileDestPtr) + inc _FileDestPtr + bne lynxread0 + inc _FileDestPtr+1 + bra lynxread0 ;********************************** ; Read one byte from cartridge ;********************************** readbyte0: - lda RCART0 - inc _FileBlockByte - bne exit - inc _FileBlockByte+1 - bne exit + lda RCART0 + inc _FileBlockByte + bne exit + inc _FileBlockByte+1 + bne exit ;********************************** ; Select a block ;********************************** lynxblock: - pha - phx - phy - lda __iodat - and #$fc - tay - ora #2 - tax - lda _FileCurrBlock - inc _FileCurrBlock - sec - bra @2 -@0: bcc @1 - stx IODAT - clc -@1: inx - stx SYSCTL1 - dex -@2: stx SYSCTL1 - rol - sty IODAT - bne @0 - lda __iodat - sta IODAT - stz _FileBlockByte - lda #<($100-(>__BLOCKSIZE__)) - sta _FileBlockByte+1 - ply - plx - pla + pha + phx + phy + lda __iodat + and #$fc + tay + ora #2 + tax + lda _FileCurrBlock + inc _FileCurrBlock + sec + bra @2 +@0: bcc @1 + stx IODAT + clc +@1: inx + stx SYSCTL1 + dex +@2: stx SYSCTL1 + rol + sty IODAT + bne @0 + lda __iodat + sta IODAT + stz _FileBlockByte + lda #<($100-(>__BLOCKSIZE__)) + sta _FileBlockByte+1 + ply + plx + pla -exit: rts +exit: rts diff --git a/libsrc/lynx/lynx-snd.s b/libsrc/lynx/lynx-snd.s index dff5c6a23..9d0b8b7af 100644 --- a/libsrc/lynx/lynx-snd.s +++ b/libsrc/lynx/lynx-snd.s @@ -4,402 +4,402 @@ ; Karri Kaksonen and Bjoern Spruck, 11.12.2012 ; - .include "lynx.inc" - .include "zeropage.inc" + .include "lynx.inc" + .include "zeropage.inc" - .export _lynx_snd_init - .export _lynx_snd_active - .export _lynx_snd_play - .export _lynx_snd_stop - .export _lynx_snd_stop_channel - .export _lynx_snd_pause - .export _lynx_snd_continue - .interruptor lynx_snd_handler - .import popa - .importzp ptr1 + .export _lynx_snd_init + .export _lynx_snd_active + .export _lynx_snd_play + .export _lynx_snd_stop + .export _lynx_snd_stop_channel + .export _lynx_snd_pause + .export _lynx_snd_continue + .interruptor lynx_snd_handler + .import popa + .importzp ptr1 ;---------------------------------------------------------------------------- ; ZP variables that go into APPZP ; - .segment "APPZP" : zeropage + .segment "APPZP" : zeropage -SndSema: .res 1 -SndPtrTmp: .res 2 -SndTmp: .res 2 -SndEnvPtr: .res 2 +SndSema: .res 1 +SndPtrTmp: .res 2 +SndTmp: .res 2 +SndEnvPtr: .res 2 ;---------------------------------------------------------------------------- ; Global variables ; - .bss + .bss -SndRetAFlag2: .res 1 -SndRetAFlag: .res 1 -SndPtrLo: .res 4 -SndPtrHi: .res 4 -SndDelay: .res 4 -SndLoopCnt: .res 4 -SndLoopPtrLo: .res 4 -SndLoopPtrHi: .res 4 -SndVolume: .res 4 -SndMaxVolume: .res 4 -SndNotePlaying: .res 4 -SndRetAddr: .res 8 -SndActive: .res 4 -SndReqStop: .res 4 -SndEnvVol: .res 4 -SndEnvFrq: .res 4 -SndEnvWave: .res 4 -SndChannel: .res 32 -SndEnvVolCnt: .res 4 -SndEnvVolInc: .res 4 -SndEnvVolOff: .res 4 -SndEnvVolLoop: .res 4 -SndEnvVolParts: .res 4 -SndEnvVolParts2: .res 4 -SndEnvFrqCnt: .res 4 -SndEnvFrqInc: .res 4 -SndEnvFrqOff: .res 4 -SndEnvFrqLoop: .res 4 -SndEnvFrqParts: .res 4 -SndEnvFrqParts2: .res 4 -SndEnvWaveCnt: .res 4 -SndEnvWaveOff: .res 4 -SndEnvWaveLoop: .res 4 -SndEnvWaveParts: .res 4 -SndEnvWaveParts2: .res 4 +SndRetAFlag2: .res 1 +SndRetAFlag: .res 1 +SndPtrLo: .res 4 +SndPtrHi: .res 4 +SndDelay: .res 4 +SndLoopCnt: .res 4 +SndLoopPtrLo: .res 4 +SndLoopPtrHi: .res 4 +SndVolume: .res 4 +SndMaxVolume: .res 4 +SndNotePlaying: .res 4 +SndRetAddr: .res 8 +SndActive: .res 4 +SndReqStop: .res 4 +SndEnvVol: .res 4 +SndEnvFrq: .res 4 +SndEnvWave: .res 4 +SndChannel: .res 32 +SndEnvVolCnt: .res 4 +SndEnvVolInc: .res 4 +SndEnvVolOff: .res 4 +SndEnvVolLoop: .res 4 +SndEnvVolParts: .res 4 +SndEnvVolParts2: .res 4 +SndEnvFrqCnt: .res 4 +SndEnvFrqInc: .res 4 +SndEnvFrqOff: .res 4 +SndEnvFrqLoop: .res 4 +SndEnvFrqParts: .res 4 +SndEnvFrqParts2: .res 4 +SndEnvWaveCnt: .res 4 +SndEnvWaveOff: .res 4 +SndEnvWaveLoop: .res 4 +SndEnvWaveParts: .res 4 +SndEnvWaveParts2: .res 4 -MAX_INSTRUMENTS .set 64 -SndEnvVolPtrLo: .res MAX_INSTRUMENTS -SndEnvVolPtrHi: .res MAX_INSTRUMENTS -SndEnvFrqPtrLo: .res MAX_INSTRUMENTS -SndEnvFrqPtrHi: .res MAX_INSTRUMENTS -SndEnvWavePtrLo: .res MAX_INSTRUMENTS -SndEnvWavePtrHi: .res MAX_INSTRUMENTS +MAX_INSTRUMENTS .set 64 +SndEnvVolPtrLo: .res MAX_INSTRUMENTS +SndEnvVolPtrHi: .res MAX_INSTRUMENTS +SndEnvFrqPtrLo: .res MAX_INSTRUMENTS +SndEnvFrqPtrHi: .res MAX_INSTRUMENTS +SndEnvWavePtrLo: .res MAX_INSTRUMENTS +SndEnvWavePtrHi: .res MAX_INSTRUMENTS - .rodata + .rodata -SndOffsets: .byte $00,$08,$10,$18 +SndOffsets: .byte $00,$08,$10,$18 ;---------------------------------------------------------------------------- ; Macros ; -if_count .set 0 -nest_count .set 0 +if_count .set 0 +nest_count .set 0 -.macro _IFNE - if_count .set if_count +1 - nest_count .set nest_count +1 - beq .ident (.sprintf ("else%04d", if_count)) - .ident (.sprintf ("push%04d", nest_count)) .set if_count +.macro _IFNE + if_count .set if_count +1 + nest_count .set nest_count +1 + beq .ident (.sprintf ("else%04d", if_count)) + .ident (.sprintf ("push%04d", nest_count)) .set if_count .endmacro -.macro _IFEQ - if_count .set if_count +1 - nest_count .set nest_count +1 - bne .ident (.sprintf ("else%04d", if_count)) - .ident (.sprintf ("push%04d", nest_count)) .set if_count +.macro _IFEQ + if_count .set if_count +1 + nest_count .set nest_count +1 + bne .ident (.sprintf ("else%04d", if_count)) + .ident (.sprintf ("push%04d", nest_count)) .set if_count .endmacro -.macro _IFMI - if_count .set if_count +1 - nest_count .set nest_count +1 - bpl .ident (.sprintf ("else%04d", if_count)) - .ident (.sprintf ("push%04d", nest_count)) .set if_count +.macro _IFMI + if_count .set if_count +1 + nest_count .set nest_count +1 + bpl .ident (.sprintf ("else%04d", if_count)) + .ident (.sprintf ("push%04d", nest_count)) .set if_count .endmacro -.macro _IFPL - if_count .set if_count +1 - nest_count .set nest_count +1 - bmi .ident (.sprintf ("else%04d", if_count)) - .ident (.sprintf ("push%04d", nest_count)) .set if_count +.macro _IFPL + if_count .set if_count +1 + nest_count .set nest_count +1 + bmi .ident (.sprintf ("else%04d", if_count)) + .ident (.sprintf ("push%04d", nest_count)) .set if_count .endmacro -.macro _IFGE - if_count .set if_count +1 - nest_count .set nest_count +1 - bcc .ident (.sprintf ("else%04d", if_count)) - .ident (.sprintf ("push%04d", nest_count)) .set if_count +.macro _IFGE + if_count .set if_count +1 + nest_count .set nest_count +1 + bcc .ident (.sprintf ("else%04d", if_count)) + .ident (.sprintf ("push%04d", nest_count)) .set if_count .endmacro .macro _IFCS - if_count .set if_count +1 - nest_count .set nest_count +1 - bcc .ident (.sprintf ("else%04d", if_count)) - .ident (.sprintf ("push%04d", nest_count)) .set if_count + if_count .set if_count +1 + nest_count .set nest_count +1 + bcc .ident (.sprintf ("else%04d", if_count)) + .ident (.sprintf ("push%04d", nest_count)) .set if_count .endmacro .macro _IFCC - if_count .set if_count +1 - nest_count .set nest_count +1 - bcs .ident (.sprintf ("else%04d", if_count)) - .ident (.sprintf ("push%04d", nest_count)) .set if_count + if_count .set if_count +1 + nest_count .set nest_count +1 + bcs .ident (.sprintf ("else%04d", if_count)) + .ident (.sprintf ("push%04d", nest_count)) .set if_count .endmacro .macro _ELSE - bra .ident (.sprintf ("endif%04d", .ident (.sprintf ("push%04d", nest_count)))) - .ident (.sprintf ("else%04d", .ident (.sprintf ("push%04d", nest_count)))) := * + bra .ident (.sprintf ("endif%04d", .ident (.sprintf ("push%04d", nest_count)))) + .ident (.sprintf ("else%04d", .ident (.sprintf ("push%04d", nest_count)))) := * .endmacro .macro _ENDIF - .if .not .defined( .ident (.sprintf ("else%04d", .ident (.sprintf ("push%04d", nest_count))))) - .ident (.sprintf ("else%04d", .ident (.sprintf ("push%04d", nest_count)))) := * - .endif - .ident (.sprintf ("endif%04d", .ident (.sprintf ("push%04d", nest_count)))) := * - nest_count .set nest_count -1 + .if .not .defined( .ident (.sprintf ("else%04d", .ident (.sprintf ("push%04d", nest_count))))) + .ident (.sprintf ("else%04d", .ident (.sprintf ("push%04d", nest_count)))) := * + .endif + .ident (.sprintf ("endif%04d", .ident (.sprintf ("push%04d", nest_count)))) := * + nest_count .set nest_count -1 .endmacro - .code + .code ;---------------------------------------------------------------------------- ; void lynx_snd_init() will initialize the sound engine. ; -_31250Hz .set %101 +_31250Hz .set %101 _lynx_snd_init: - php - sei - lda #%10011000|_31250Hz - sta STIMCTLA - lda #129 - sta STIMBKUP ; set up a 240Hz IRQ + php + sei + lda #%10011000|_31250Hz + sta STIMCTLA + lda #129 + sta STIMBKUP ; set up a 240Hz IRQ - stz AUD0VOL - stz AUD1VOL - stz AUD2VOL - stz AUD3VOL + stz AUD0VOL + stz AUD1VOL + stz AUD2VOL + stz AUD3VOL - stz $fd44 ; all channels full volume / no attenuation - lda #$ff - stz MSTEREO + stz $fd44 ; all channels full volume / no attenuation + lda #$ff + stz MSTEREO - lda #0 - sta AUD0CTLA - sta AUD1CTLA - sta AUD2CTLA - sta AUD3CTLA + lda #0 + sta AUD0CTLA + sta AUD1CTLA + sta AUD2CTLA + sta AUD3CTLA - ldx #3 - lda #0 -init0: stz SndActive,x - stz SndReqStop,x - stz SndEnvVol,x - stz SndEnvFrq,x - stz SndEnvWave,x - ldy SndOffsets,x - sta SndChannel+2,y - dex - bpl init0 - stz SndRetAFlag - stz SndRetAFlag2 - stz SndSema - plp - rts + ldx #3 + lda #0 +init0: stz SndActive,x + stz SndReqStop,x + stz SndEnvVol,x + stz SndEnvFrq,x + stz SndEnvWave,x + ldy SndOffsets,x + sta SndChannel+2,y + dex + bpl init0 + stz SndRetAFlag + stz SndRetAFlag2 + stz SndSema + plp + rts ;---------------------------------------------------------------------------- ; lynx_snd_handler is run at every sound interrupt ; lynx_snd_handler: - lda INTSET - and #SND_INTERRUPT - bne @L0 - clc - rts + lda INTSET + and #SND_INTERRUPT + bne @L0 + clc + rts @L0: - lda #$ff - tsb SndSema - bne endirq - phy - ; *NOW* set all values which were "pre-set" in last interrupt - jsr SndSetValues - cli + lda #$ff + tsb SndSema + bne endirq + phy + ; *NOW* set all values which were "pre-set" in last interrupt + jsr SndSetValues + cli - lda SndRetAFlag ; reset the return flag, but save it first - _IFNE - lda #$0F ; MASK - sta SndRetAFlag2 - stz SndRetAFlag - _ENDIF + lda SndRetAFlag ; reset the return flag, but save it first + _IFNE + lda #$0F ; MASK + sta SndRetAFlag2 + stz SndRetAFlag + _ENDIF - ldx #3 -irq0: phx - lda SndActive,x - _IFNE - lda SndEnvVol,x - _IFNE - phx - jsr SndChangeVol - plx - _ENDIF - lda SndEnvFrq,x - _IFNE - phx - jsr SndChangeFrq - plx - _ENDIF - lda SndEnvWave,x - _IFNE - phx - jsr SndChangeWave - plx - _ENDIF - jsr SndGetCmd - _ENDIF - plx - dex - bpl irq0 - sei - ply - stz SndSema + ldx #3 +irq0: phx + lda SndActive,x + _IFNE + lda SndEnvVol,x + _IFNE + phx + jsr SndChangeVol + plx + _ENDIF + lda SndEnvFrq,x + _IFNE + phx + jsr SndChangeFrq + plx + _ENDIF + lda SndEnvWave,x + _IFNE + phx + jsr SndChangeWave + plx + _ENDIF + jsr SndGetCmd + _ENDIF + plx + dex + bpl irq0 + sei + ply + stz SndSema endirq: - clc - rts + clc + rts ;---------------------------------------------------------------------------- ; A process table with addresses to sound functions ; SndCmdsLo: - .byte <((SndLoop)-1) - .byte <((SndDo)-1) - .byte <((SndPause)-1) - .byte <((SndNoteOff)-1) - .byte <((SndSetInstr)-1) - .byte <((SndNewNote2)-1) - .byte <((SndCallPattern)-1) - .byte <((SndRetToSong)-1) - .byte <((SndDefEnvVol)-1) - .byte <((SndSetEnvVol)-1) - .byte <((SndDefEnvFrq)-1) - .byte <((SndSetEnvFrq)-1) - .byte <((SndDefEnvWave)-1) - .byte <((SndSetEnvWave)-1) - .byte <((SndSetStereo)-1) - .byte <((SndSetAttenuationOn)-1) - .byte <((SndSetChnAttenution)-1) - .byte <((SndPlayerFreq)-1) - .byte <((SndReturnAll)-1) + .byte <((SndLoop)-1) + .byte <((SndDo)-1) + .byte <((SndPause)-1) + .byte <((SndNoteOff)-1) + .byte <((SndSetInstr)-1) + .byte <((SndNewNote2)-1) + .byte <((SndCallPattern)-1) + .byte <((SndRetToSong)-1) + .byte <((SndDefEnvVol)-1) + .byte <((SndSetEnvVol)-1) + .byte <((SndDefEnvFrq)-1) + .byte <((SndSetEnvFrq)-1) + .byte <((SndDefEnvWave)-1) + .byte <((SndSetEnvWave)-1) + .byte <((SndSetStereo)-1) + .byte <((SndSetAttenuationOn)-1) + .byte <((SndSetChnAttenution)-1) + .byte <((SndPlayerFreq)-1) + .byte <((SndReturnAll)-1) SndCmdsHi: - .byte >((SndLoop)-1) - .byte >((SndDo)-1) - .byte >((SndPause)-1) - .byte >((SndNoteOff)-1) - .byte >((SndSetInstr)-1) - .byte >((SndNewNote2)-1) - .byte >((SndCallPattern)-1) - .byte >((SndRetToSong)-1) - .byte >((SndDefEnvVol)-1) - .byte >((SndSetEnvVol)-1) - .byte >((SndDefEnvFrq)-1) - .byte >((SndSetEnvFrq)-1) - .byte >((SndDefEnvWave)-1) - .byte >((SndSetEnvWave)-1) - .byte >((SndSetStereo)-1) - .byte >((SndSetAttenuationOn)-1) - .byte >((SndSetChnAttenution)-1) - .byte >((SndPlayerFreq)-1) - .byte >((SndReturnAll)-1) + .byte >((SndLoop)-1) + .byte >((SndDo)-1) + .byte >((SndPause)-1) + .byte >((SndNoteOff)-1) + .byte >((SndSetInstr)-1) + .byte >((SndNewNote2)-1) + .byte >((SndCallPattern)-1) + .byte >((SndRetToSong)-1) + .byte >((SndDefEnvVol)-1) + .byte >((SndSetEnvVol)-1) + .byte >((SndDefEnvFrq)-1) + .byte >((SndSetEnvFrq)-1) + .byte >((SndDefEnvWave)-1) + .byte >((SndSetEnvWave)-1) + .byte >((SndSetStereo)-1) + .byte >((SndSetAttenuationOn)-1) + .byte >((SndSetChnAttenution)-1) + .byte >((SndPlayerFreq)-1) + .byte >((SndReturnAll)-1) ;---------------------------------------------------------------------------- ; Get next sound command from stream ; SndGetCmd: - lda SndReqStop,x - bne SndStop + lda SndReqStop,x + bne SndStop - lda SndRetAFlag2 - and SndMask,x - _IFNE - eor SndRetAFlag2 - sta SndRetAFlag2 - lda SndRetAddr,x - sta SndPtrLo,x - lda SndRetAddr+4,x - sta SndPtrHi,x - ;;; force the direct continue return - _ELSE - dec SndDelay,x - bne cmd991 ;; check special case - _ENDIF + lda SndRetAFlag2 + and SndMask,x + _IFNE + eor SndRetAFlag2 + sta SndRetAFlag2 + lda SndRetAddr,x + sta SndPtrLo,x + lda SndRetAddr+4,x + sta SndPtrHi,x + ;;; force the direct continue return + _ELSE + dec SndDelay,x + bne cmd991 ;; check special case + _ENDIF - lda SndPtrLo,x - sta SndPtrTmp - lda SndPtrHi,x - sta SndPtrTmp+1 -cmd0: lda (SndPtrTmp) - beq SndStop - _IFMI - and #$7f - tay - jsr SndCallCmd - _ELSE - jsr SndNewNote - _ENDIF - clc - tya - and #$7f - adc SndPtrTmp - sta SndPtrLo,x - sta SndPtrTmp - lda #0 - adc SndPtrTmp+1 - sta SndPtrHi,x - sta SndPtrTmp+1 + lda SndPtrLo,x + sta SndPtrTmp + lda SndPtrHi,x + sta SndPtrTmp+1 +cmd0: lda (SndPtrTmp) + beq SndStop + _IFMI + and #$7f + tay + jsr SndCallCmd + _ELSE + jsr SndNewNote + _ENDIF + clc + tya + and #$7f + adc SndPtrTmp + sta SndPtrLo,x + sta SndPtrTmp + lda #0 + adc SndPtrTmp+1 + sta SndPtrHi,x + sta SndPtrTmp+1 - tya - bmi cmd0 + tya + bmi cmd0 cmd991: - ;; now check if delay is only 1 AND next one is return all. - lda #1 - cmp SndDelay,x - bne cmd99 + ;; now check if delay is only 1 AND next one is return all. + lda #1 + cmp SndDelay,x + bne cmd99 - ;; NOW read ahead ONE - lda SndPtrLo,x - sta SndPtrTmp - lda SndPtrHi,x - sta SndPtrTmp+1 + ;; NOW read ahead ONE + lda SndPtrLo,x + sta SndPtrTmp + lda SndPtrHi,x + sta SndPtrTmp+1 - lda (SndPtrTmp) - cmp #$92 ;; Return all - _IFEQ - sta SndRetAFlag ; just set !=0 - _ENDIF -cmd99: rts + lda (SndPtrTmp) + cmp #$92 ;; Return all + _IFEQ + sta SndRetAFlag ; just set !=0 + _ENDIF +cmd99: rts ;---------------------------------------------------------------------------- ; Call function pointed to by y ; SndCallCmd: - lda SndCmdsHi,y - pha - lda SndCmdsLo,y - pha - ldy #1 - rts + lda SndCmdsHi,y + pha + lda SndCmdsLo,y + pha + ldy #1 + rts ;---------------------------------------------------------------------------- ; Stop sound on one channel ; SndStop: - stz SndReqStop,x - stz SndActive,x - ldy SndOffsets,x - lda #0 - sta SndChannel,y - ina ;lda #1 - sta SndChannel+2,y - tay ;ldy #1 - rts + stz SndReqStop,x + stz SndActive,x + ldy SndOffsets,x + lda #0 + sta SndChannel,y + ina ;lda #1 + sta SndChannel+2,y + tay ;ldy #1 + rts ;---------------------------------------------------------------------------- @@ -407,182 +407,182 @@ SndStop: ; SndNewNote: - phx - sta SndNotePlaying,x - pha - ldy #1 - lda (SndPtrTmp),y - sta SndDelay,x - ldy SndOffsets,x - lda SndVolume,x - sta SndChannel,y - plx - lda SndPrescaler,x - sta SndChannel+5,y - lda SndReload,x - sta SndChannel+4,y - lda #$FF ; = -1 - sta SndChannel+2,y - plx - lda SndEnvVol,x - _IFNE - jsr SndSetEnvVol1 - _ENDIF - lda SndEnvFrq,x - _IFNE - jsr SndSetEnvFrq1 - _ENDIF - lda SndEnvWave,x - _IFNE - jsr SndSetEnvWave1 - _ENDIF - lda #$2 - ldy SndDelay,x - _IFNE - ora #$80 - _ENDIF - tay - rts + phx + sta SndNotePlaying,x + pha + ldy #1 + lda (SndPtrTmp),y + sta SndDelay,x + ldy SndOffsets,x + lda SndVolume,x + sta SndChannel,y + plx + lda SndPrescaler,x + sta SndChannel+5,y + lda SndReload,x + sta SndChannel+4,y + lda #$FF ; = -1 + sta SndChannel+2,y + plx + lda SndEnvVol,x + _IFNE + jsr SndSetEnvVol1 + _ENDIF + lda SndEnvFrq,x + _IFNE + jsr SndSetEnvFrq1 + _ENDIF + lda SndEnvWave,x + _IFNE + jsr SndSetEnvWave1 + _ENDIF + lda #$2 + ldy SndDelay,x + _IFNE + ora #$80 + _ENDIF + tay + rts ;---------------------------------------------------------------------------- ; Start a loop with count ; SndLoop: - lda (SndPtrTmp),y - sta SndLoopCnt,x - lda SndPtrTmp - sta SndLoopPtrLo,x - lda SndPtrTmp+1 - sta SndLoopPtrHi,x - ldy #$82 - rts + lda (SndPtrTmp),y + sta SndLoopCnt,x + lda SndPtrTmp + sta SndLoopPtrLo,x + lda SndPtrTmp+1 + sta SndLoopPtrHi,x + ldy #$82 + rts SndDo: - dec SndLoopCnt,x - _IFNE - lda SndLoopPtrLo,x - sta SndPtrTmp - lda SndLoopPtrHi,x - sta SndPtrTmp+1 - ldy #$82 - _ELSE - ldy #$81 - _ENDIF - rts + dec SndLoopCnt,x + _IFNE + lda SndLoopPtrLo,x + sta SndPtrTmp + lda SndLoopPtrHi,x + sta SndPtrTmp+1 + ldy #$82 + _ELSE + ldy #$81 + _ENDIF + rts ;---------------------------------------------------------------------------- ; Sound volume envelope ; SndDefEnvVol: - phx - lda (SndPtrTmp),y ; env # - tax + phx + lda (SndPtrTmp),y ; env # + tax - iny - lda (SndPtrTmp),y - sta SndEnvVolPtrLo,x - iny - lda (SndPtrTmp),y - sta SndEnvVolPtrHi,x ; Ptr to [cnt,inc] + iny + lda (SndPtrTmp),y + sta SndEnvVolPtrLo,x + iny + lda (SndPtrTmp),y + sta SndEnvVolPtrHi,x ; Ptr to [cnt,inc] - ldy #$84 - plx - rts + ldy #$84 + plx + rts SndSetEnvVol: - lda (SndPtrTmp),y ; # env + lda (SndPtrTmp),y ; # env SndSetEnvVol1: - and #$7f - sta SndEnvVol,x ; save - _IFEQ - ldy #$82 - rts - _ENDIF + and #$7f + sta SndEnvVol,x ; save + _IFEQ + ldy #$82 + rts + _ENDIF - tay + tay - lda SndEnvVolPtrLo,y - sta SndEnvPtr - lda SndEnvVolPtrHi,y - sta SndEnvPtr+1 + lda SndEnvVolPtrLo,y + sta SndEnvPtr + lda SndEnvVolPtrHi,y + sta SndEnvPtr+1 - lda (SndEnvPtr) - sta SndTmp - asl - sta SndEnvVolLoop,x ; here is the loop-start + lda (SndEnvPtr) + sta SndTmp + asl + sta SndEnvVolLoop,x ; here is the loop-start - ldy #1 - lda (SndEnvPtr),y - sta SndEnvVolParts,x - sec - sbc SndTmp - sta SndEnvVolParts2,x + ldy #1 + lda (SndEnvPtr),y + sta SndEnvVolParts,x + sec + sbc SndTmp + sta SndEnvVolParts2,x - stz SndEnvVolCnt,x - lda #2 - sta SndEnvVolOff,x + stz SndEnvVolCnt,x + lda #2 + sta SndEnvVolOff,x - ldy #$82 - rts + ldy #$82 + rts ;---------------------------------------------------------------------------- ; Sound frequency envelope ; SndDefEnvFrq: - phx - lda (SndPtrTmp),y ; env # - tax + phx + lda (SndPtrTmp),y ; env # + tax - iny - lda (SndPtrTmp),y - sta SndEnvFrqPtrLo,x - iny - lda (SndPtrTmp),y - sta SndEnvFrqPtrHi,x ; Ptr to [inc,cnt] - plx - ldy #$84 - rts + iny + lda (SndPtrTmp),y + sta SndEnvFrqPtrLo,x + iny + lda (SndPtrTmp),y + sta SndEnvFrqPtrHi,x ; Ptr to [inc,cnt] + plx + ldy #$84 + rts SndSetEnvFrq: - lda (SndPtrTmp),y ; # env + lda (SndPtrTmp),y ; # env SndSetEnvFrq1: - and #$7f - sta SndEnvFrq,x ; save - _IFEQ - ldy #$82 - rts - _ENDIF + and #$7f + sta SndEnvFrq,x ; save + _IFEQ + ldy #$82 + rts + _ENDIF - tay + tay - lda SndEnvFrqPtrLo,y - sta SndEnvPtr - lda SndEnvFrqPtrHi,y - sta SndEnvPtr+1 + lda SndEnvFrqPtrLo,y + sta SndEnvPtr + lda SndEnvFrqPtrHi,y + sta SndEnvPtr+1 - lda (SndEnvPtr) - sta SndTmp - asl - sta SndEnvFrqLoop,x + lda (SndEnvPtr) + sta SndTmp + asl + sta SndEnvFrqLoop,x - ldy #1 - lda (SndEnvPtr),y - sta SndEnvFrqParts,x - sec - sbc SndTmp - sta SndEnvFrqParts2,x + ldy #1 + lda (SndEnvPtr),y + sta SndEnvFrqParts,x + sec + sbc SndTmp + sta SndEnvFrqParts2,x - stz SndEnvFrqCnt,x - lda #2 - sta SndEnvFrqOff,x + stz SndEnvFrqCnt,x + lda #2 + sta SndEnvFrqOff,x - ldy #$82 - rts + ldy #$82 + rts ;---------------------------------------------------------------------------- ; Sound frequency envelope @@ -590,58 +590,58 @@ SndSetEnvFrq1: SndDefEnvWave: - phx - lda (SndPtrTmp),y ; env # - tax + phx + lda (SndPtrTmp),y ; env # + tax - iny - lda (SndPtrTmp),y - sta SndEnvWavePtrLo,x - iny - lda (SndPtrTmp),y - sta SndEnvWavePtrHi,x ; Ptr to [inc,cnt] - plx - ldy #$84 - rts + iny + lda (SndPtrTmp),y + sta SndEnvWavePtrLo,x + iny + lda (SndPtrTmp),y + sta SndEnvWavePtrHi,x ; Ptr to [inc,cnt] + plx + ldy #$84 + rts SndSetEnvWave: - lda (SndPtrTmp),y ; # env + lda (SndPtrTmp),y ; # env SndSetEnvWave1: - and #$7f - sta SndEnvWave,x ; save - _IFEQ - ldy #$82 - rts - _ENDIF + and #$7f + sta SndEnvWave,x ; save + _IFEQ + ldy #$82 + rts + _ENDIF - tay + tay - lda SndEnvWavePtrLo,y - sta SndEnvPtr - lda SndEnvWavePtrHi,y - sta SndEnvPtr+1 + lda SndEnvWavePtrLo,y + sta SndEnvPtr + lda SndEnvWavePtrHi,y + sta SndEnvPtr+1 - lda (SndEnvPtr) - sta SndTmp - asl ; *4 -2 - dea - asl - sta SndEnvWaveLoop,x + lda (SndEnvPtr) + sta SndTmp + asl ; *4 -2 + dea + asl + sta SndEnvWaveLoop,x - ldy #1 - lda (SndEnvPtr),y - sta SndEnvWaveParts,x - sec - sbc SndTmp - sta SndEnvWaveParts2,x + ldy #1 + lda (SndEnvPtr),y + sta SndEnvWaveParts,x + sec + sbc SndTmp + sta SndEnvWaveParts2,x - stz SndEnvWaveCnt,x - lda #2 - sta SndEnvWaveOff,x + stz SndEnvWaveCnt,x + lda #2 + sta SndEnvWaveOff,x - ldy #$82 - rts + ldy #$82 + rts ;---------------------------------------------------------------------------- ; Pause sound @@ -1101,170 +1101,170 @@ set0: ldy SndOffsets,x _IFPL jmp set0 _ENDIF - rts + rts _lynx_snd_play: - sta ptr1 - stx ptr1+1 - jsr popa - tax - lda ptr1 - ldy ptr1+1 - php - pha - lda SndActive,x - _IFNE - dec SndReqStop,x - lda #1 - sta SndDelay,x -start0: lda SndActive,x - bne start0 - _ENDIF - bra start1 + sta ptr1 + stx ptr1+1 + jsr popa + tax + lda ptr1 + ldy ptr1+1 + php + pha + lda SndActive,x + _IFNE + dec SndReqStop,x + lda #1 + sta SndDelay,x +start0: lda SndActive,x + bne start0 + _ENDIF + bra start1 SndStartSoundx: - php - pha + php + pha start1: - sei - pla - sta SndPtrLo,x - tya - sta SndPtrHi,x - lda #1 - sta SndDelay,x - stz SndEnvVol,x - stz SndEnvFrq,x - stz SndEnvWave,x - sta SndActive,x - stz SndReqStop,x - plp - rts + sei + pla + sta SndPtrLo,x + tya + sta SndPtrHi,x + lda #1 + sta SndDelay,x + stz SndEnvVol,x + stz SndEnvFrq,x + stz SndEnvWave,x + sta SndActive,x + stz SndReqStop,x + plp + rts SndStartSound2: - pha - lda SndActive,x ; check default - beq start20 ; inactive => ok - phx - ldx #3 ; search free channel + pha + lda SndActive,x ; check default + beq start20 ; inactive => ok + phx + ldx #3 ; search free channel start21: - lda SndActive,x - beq start22 ; found => - dex - bpl start21 - plx ; not found - dec SndReqStop,x ; stop default-channel - lda #1 - sta SndDelay,x + lda SndActive,x + beq start22 ; found => + dex + bpl start21 + plx ; not found + dec SndReqStop,x ; stop default-channel + lda #1 + sta SndDelay,x start23: - lda SndActive,x - bne start23 - bra start20 + lda SndActive,x + bne start23 + bra start20 start22: - pla ; clear stack + pla ; clear stack start20: - pla - phx - jsr SndStartSoundx ; launch new sound - plx - rts + pla + phx + jsr SndStartSoundx ; launch new sound + plx + rts _lynx_snd_stop: - ldx #3 - lda SndActive,x - _IFNE -stop0: dec SndReqStop,x - lda #1 - sta SndDelay,x -stop1: lda SndActive,x - bne stop1 - _ENDIF - dex - bpl stop0 - rts + ldx #3 + lda SndActive,x + _IFNE +stop0: dec SndReqStop,x + lda #1 + sta SndDelay,x +stop1: lda SndActive,x + bne stop1 + _ENDIF + dex + bpl stop0 + rts _lynx_snd_stop_channel: - tax - lda SndActive,x - _IFNE - dec SndReqStop,x - lda #1 - sta SndDelay,x -stopc1: lda SndActive,x - bne stopc1 - _ENDIF - rts + tax + lda SndActive,x + _IFNE + dec SndReqStop,x + lda #1 + sta SndDelay,x +stopc1: lda SndActive,x + bne stopc1 + _ENDIF + rts _lynx_snd_active: - ldx #3 - lda #0 -act0: ldy SndActive,x - _IFNE - ora SndMask,x - _ENDIF - dex - bpl act0 - rts + ldx #3 + lda #0 +act0: ldy SndActive,x + _IFNE + ora SndMask,x + _ENDIF + dex + bpl act0 + rts _lynx_snd_pause: - php - sei - lda STIMCTLA - sta SndPauseOff1+1 - stz STIMCTLA - lda MSTEREO - sta SndPauseOff2+1 - lda #$ff - sta MSTEREO - lda #$18 - trb AUD0CTLA - trb AUD1CTLA - trb AUD2CTLA - trb AUD3CTLA - plp - rts + php + sei + lda STIMCTLA + sta SndPauseOff1+1 + stz STIMCTLA + lda MSTEREO + sta SndPauseOff2+1 + lda #$ff + sta MSTEREO + lda #$18 + trb AUD0CTLA + trb AUD1CTLA + trb AUD2CTLA + trb AUD3CTLA + plp + rts _lynx_snd_continue: - php - sei + php + sei SndPauseOff1: - lda #0 ; Selbsmodifizierter Code!!! - sta STIMCTLA + lda #0 ; Selbsmodifizierter Code!!! + sta STIMCTLA SndPauseOff2: - lda #0 ; Selbsmodifizierter Code!!! - sta MSTEREO + lda #0 ; Selbsmodifizierter Code!!! + sta MSTEREO - lda #$18 - tsb AUD0CTLA - tsb AUD1CTLA - tsb AUD2CTLA - tsb AUD3CTLA + lda #$18 + tsb AUD0CTLA + tsb AUD1CTLA + tsb AUD2CTLA + tsb AUD3CTLA - plp - rts + plp + rts - .rodata + .rodata SndMask: - .byte 1,2,4,8 + .byte 1,2,4,8 SndPrescaler: - .byte $00,$06,$06,$06,$06,$05,$05,$05,$05,$05,$05,$05,$04,$04,$04,$04 - .byte $04,$04,$04,$04,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$02,$02 - .byte $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$01,$01,$01,$01,$01 - .byte $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 - .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .byte $00,$06,$06,$06,$06,$05,$05,$05,$05,$05,$05,$05,$04,$04,$04,$04 + .byte $04,$04,$04,$04,$03,$03,$03,$03,$03,$03,$03,$03,$03,$03,$02,$02 + .byte $02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$02,$01,$01,$01,$01,$01 + .byte $01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$01,$00,$00 + .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 + .byte $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00 SndReload: - .byte $00,$9A,$96,$8F,$86,$FA,$E5,$D1,$BE,$AC,$9C,$8D,$00,$E8,$D3,$C0 - .byte $AF,$A0,$93,$87,$FA,$E7,$D6,$C6,$B8,$AC,$A1,$96,$8D,$84,$FA,$EB - .byte $DE,$D2,$C7,$BC,$B3,$AA,$A1,$9A,$93,$8C,$86,$00,$F5,$EB,$E1,$D8 - .byte $CF,$C7,$C0,$B9,$B2,$AB,$A5,$A0,$9A,$95,$90,$8B,$87,$82,$FD,$F5 - .byte $EE,$E7,$E0,$D9,$D3,$CD,$C8,$C2,$BD,$B8,$B3,$AE,$AA,$A5,$A1,$9D - .byte $99,$96,$92,$8F,$8B,$88,$85,$82,$7F,$7C,$79,$77,$74,$72,$6F,$6D - .byte $6B,$69,$67,$64,$63,$61,$5F,$5D,$5B,$59,$58,$56,$55,$53,$51,$50 - .byte $4F,$4D,$4C,$4B,$49,$48,$47,$46,$44,$43,$42,$41,$40,$3F,$3E,$3D + .byte $00,$9A,$96,$8F,$86,$FA,$E5,$D1,$BE,$AC,$9C,$8D,$00,$E8,$D3,$C0 + .byte $AF,$A0,$93,$87,$FA,$E7,$D6,$C6,$B8,$AC,$A1,$96,$8D,$84,$FA,$EB + .byte $DE,$D2,$C7,$BC,$B3,$AA,$A1,$9A,$93,$8C,$86,$00,$F5,$EB,$E1,$D8 + .byte $CF,$C7,$C0,$B9,$B2,$AB,$A5,$A0,$9A,$95,$90,$8B,$87,$82,$FD,$F5 + .byte $EE,$E7,$E0,$D9,$D3,$CD,$C8,$C2,$BD,$B8,$B3,$AE,$AA,$A5,$A1,$9D + .byte $99,$96,$92,$8F,$8B,$88,$85,$82,$7F,$7C,$79,$77,$74,$72,$6F,$6D + .byte $6B,$69,$67,$64,$63,$61,$5F,$5D,$5B,$59,$58,$56,$55,$53,$51,$50 + .byte $4F,$4D,$4C,$4B,$49,$48,$47,$46,$44,$43,$42,$41,$40,$3F,$3E,$3D diff --git a/libsrc/lynx/mainargs.s b/libsrc/lynx/mainargs.s index 8b6808051..8ab1b7c68 100644 --- a/libsrc/lynx/mainargs.s +++ b/libsrc/lynx/mainargs.s @@ -5,8 +5,8 @@ ; - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv ;--------------------------------------------------------------------------- diff --git a/libsrc/lynx/open.s b/libsrc/lynx/open.s index 04ef2b68e..c48b8eb95 100644 --- a/libsrc/lynx/open.s +++ b/libsrc/lynx/open.s @@ -15,67 +15,67 @@ ; As helper functions we also provide. ; void openn(int fileno) ; - .importzp sreg, tmp3 - .macpack longbranch - .import _atoi - .import _read - .import _lseek - .import addysp,popax,pushax,decsp6,pusha0,pusheax,ldaxysp - .import aslax3,axlong,tosaddeax,steaxysp,stax0sp,incsp8 - .import ldax0sp - .import lynxskip0, lynxblock - .importzp _FileEntry - .importzp _FileStartBlock - .importzp _FileCurrBlock - .importzp _FileBlockOffset - .import __STARTOFDIRECTORY__ - .export _open - .export _openn + .importzp sreg, tmp3 + .macpack longbranch + .import _atoi + .import _read + .import _lseek + .import addysp,popax,pushax,decsp6,pusha0,pusheax,ldaxysp + .import aslax3,axlong,tosaddeax,steaxysp,stax0sp,incsp8 + .import ldax0sp + .import lynxskip0, lynxblock + .importzp _FileEntry + .importzp _FileStartBlock + .importzp _FileCurrBlock + .importzp _FileBlockOffset + .import __STARTOFDIRECTORY__ + .export _open + .export _openn - .include "errno.inc" - .include "fcntl.inc" + .include "errno.inc" + .include "fcntl.inc" -.segment "DATA" +.segment "DATA" _startofdirectory: - .dword __STARTOFDIRECTORY__ + .dword __STARTOFDIRECTORY__ ; --------------------------------------------------------------- ; int __near__ open (__near__ const unsigned char*, int) ; --------------------------------------------------------------- -.segment "CODE" +.segment "CODE" -.proc _open +.proc _open -.segment "CODE" +.segment "CODE" - dey - dey - dey - dey - beq parmok - jsr addysp + dey + dey + dey + dey + beq parmok + jsr addysp -parmok: jsr popax - sta tmp3 - and #(O_RDWR | O_CREAT) - cmp #O_RDONLY - beq flagsok - cmp #(O_WRONLY | O_CREAT) - beq flagsok - jsr popax - lda #EINVAL - jmp __directerrno +parmok: jsr popax + sta tmp3 + and #(O_RDWR | O_CREAT) + cmp #O_RDONLY + beq flagsok + cmp #(O_WRONLY | O_CREAT) + beq flagsok + jsr popax + lda #EINVAL + jmp __directerrno flagsok: - jsr popax - jsr _atoi - jsr _openn - ldx #$00 - lda #$01 - stx __oserror - rts + jsr popax + jsr _atoi + jsr _openn + ldx #$00 + lda #$01 + stx __oserror + rts .endproc @@ -83,54 +83,54 @@ flagsok: ; void __near__ __fastcall__ openn (int) ; --------------------------------------------------------------- -.segment "CODE" +.segment "CODE" -.proc _openn: near +.proc _openn: near -.segment "CODE" +.segment "CODE" - jsr pushax - jsr decsp6 - lda #$01 - jsr pusha0 - lda _startofdirectory+3 - sta sreg+1 - lda _startofdirectory+2 - sta sreg - ldx _startofdirectory+1 - lda _startofdirectory - jsr pusheax - ldy #$0D - jsr ldaxysp - jsr aslax3 - jsr axlong - jsr tosaddeax - jsr pusheax - ldx #$00 - txa - jsr _lseek - ldy #$02 - jsr steaxysp - lda #$01 - jsr pusha0 - lda #<_FileEntry - ldx #>_FileEntry - jsr pushax - ldx #$00 - lda #$08 - jsr _read - lda _FileStartBlock - sta _FileCurrBlock - jsr lynxblock - lda _FileBlockOffset+1 - eor #$FF - tay - lda _FileBlockOffset - eor #$FF - tax - jsr lynxskip0 - jsr stax0sp - jmp incsp8 + jsr pushax + jsr decsp6 + lda #$01 + jsr pusha0 + lda _startofdirectory+3 + sta sreg+1 + lda _startofdirectory+2 + sta sreg + ldx _startofdirectory+1 + lda _startofdirectory + jsr pusheax + ldy #$0D + jsr ldaxysp + jsr aslax3 + jsr axlong + jsr tosaddeax + jsr pusheax + ldx #$00 + txa + jsr _lseek + ldy #$02 + jsr steaxysp + lda #$01 + jsr pusha0 + lda #<_FileEntry + ldx #>_FileEntry + jsr pushax + ldx #$00 + lda #$08 + jsr _read + lda _FileStartBlock + sta _FileCurrBlock + jsr lynxblock + lda _FileBlockOffset+1 + eor #$FF + tay + lda _FileBlockOffset + eor #$FF + tax + jsr lynxskip0 + jsr stax0sp + jmp incsp8 .endproc diff --git a/libsrc/lynx/oserror.s b/libsrc/lynx/oserror.s index f3643a525..5570a3bb7 100644 --- a/libsrc/lynx/oserror.s +++ b/libsrc/lynx/oserror.s @@ -5,10 +5,10 @@ ; /* Map a system specific error into a system independent code */ ; - .include "errno.inc" + .include "errno.inc" .code __osmaperrno: - rts + rts diff --git a/libsrc/lynx/read.s b/libsrc/lynx/read.s index 43bb27cba..d6341af89 100644 --- a/libsrc/lynx/read.s +++ b/libsrc/lynx/read.s @@ -12,33 +12,33 @@ ; ; int __fastcall__ read(int fd,void *buf,int count) ; - .importzp _FileDestPtr - .import lynxread0 - .import pushax,ldaxysp,ldax0sp,incsp6 - .export _read + .importzp _FileDestPtr + .import lynxread0 + .import pushax,ldaxysp,ldax0sp,incsp6 + .export _read -.segment "CODE" +.segment "CODE" -.proc _read: near +.proc _read: near -.segment "CODE" +.segment "CODE" - jsr pushax - ldy #$03 - jsr ldaxysp - sta _FileDestPtr - stx _FileDestPtr+1 - jsr ldax0sp - pha + jsr pushax + ldy #$03 + jsr ldaxysp + sta _FileDestPtr + stx _FileDestPtr+1 + jsr ldax0sp + pha txa - eor #$FF - tay - pla - eor #$FF - tax - jsr lynxread0 - jsr ldax0sp - jmp incsp6 + eor #$FF + tay + pla + eor #$FF + tax + jsr lynxread0 + jsr ldax0sp + jmp incsp6 .endproc diff --git a/libsrc/lynx/ser/lynx-comlynx.s b/libsrc/lynx/ser/lynx-comlynx.s index d2aae7a0a..7035787c9 100644 --- a/libsrc/lynx/ser/lynx-comlynx.s +++ b/libsrc/lynx/ser/lynx-comlynx.s @@ -4,48 +4,48 @@ ; Karri Kaksonen, 17.09.2009 ; - .include "lynx.inc" - .include "zeropage.inc" - .include "ser-kernel.inc" - .include "ser-error.inc" + .include "lynx.inc" + .include "zeropage.inc" + .include "ser-kernel.inc" + .include "ser-error.inc" ; ------------------------------------------------------------------------ ; Header. Includes jump table - .segment "JUMPTABLE" + .segment "JUMPTABLE" - ; Driver signature - .byte $73, $65, $72 ; "ser" - .byte SER_API_VERSION ; Serial API version number + ; Driver signature + .byte $73, $65, $72 ; "ser" + .byte SER_API_VERSION ; Serial API version number - ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr OPEN - .addr CLOSE - .addr GET - .addr PUT - .addr STATUS - .addr IOCTL - .addr IRQ + ; Jump table. + .addr INSTALL + .addr UNINSTALL + .addr OPEN + .addr CLOSE + .addr GET + .addr PUT + .addr STATUS + .addr IOCTL + .addr IRQ ;---------------------------------------------------------------------------- ; Global variables ; - .bss + .bss -TxBuffer: .res 256 -RxBuffer: .res 256 -RxPtrIn: .res 1 -RxPtrOut: .res 1 -TxPtrIn: .res 1 -TxPtrOut: .res 1 -contrl: .res 1 -SerialStat: .res 1 -TxDone: .res 1 +TxBuffer: .res 256 +RxBuffer: .res 256 +RxPtrIn: .res 1 +RxPtrOut: .res 1 +TxPtrIn: .res 1 +TxPtrOut: .res 1 +contrl: .res 1 +SerialStat: .res 1 +TxDone: .res 1 - .code + .code ;---------------------------------------------------------------------------- ; INSTALL: Is called after the driver is loaded into memory. @@ -53,7 +53,7 @@ TxDone: .res 1 ; Must return an SER_ERR_xx code in a/x. INSTALL: - ; Set up IRQ vector ? + ; Set up IRQ vector ? ;---------------------------------------------------------------------------- ; UNINSTALL: Is called before the driver is removed from memory. @@ -67,11 +67,11 @@ UNINSTALL: ; Must return an SER_ERR_xx code in a/x. CLOSE: - ; Disable interrupts - ; Done, return an error code - lda #SER_ERR_OK - rts + ; Disable interrupts + ; Done, return an error code + lda #SER_ERR_OK + rts ;---------------------------------------------------------------------------- ; OPEN: A pointer to a ser_params structure is passed in ptr1. @@ -95,150 +95,150 @@ CLOSE: ; ; Must return an SER_ERR_xx code in a/x. -OPEN: - stz RxPtrIn - stz RxPtrOut - stz TxPtrIn - stz TxPtrOut +OPEN: + stz RxPtrIn + stz RxPtrOut + stz TxPtrIn + stz TxPtrOut - ; clock = 8 * 15625 - lda #%00011000 - sta TIM4CTLA - ldy #SER_PARAMS::BAUDRATE - lda (ptr1),y + ; clock = 8 * 15625 + lda #%00011000 + sta TIM4CTLA + ldy #SER_PARAMS::BAUDRATE + lda (ptr1),y - ldx #1 - cmp #SER_BAUD_62500 - beq setbaudrate + ldx #1 + cmp #SER_BAUD_62500 + beq setbaudrate - ldx #2 - cmp #SER_BAUD_31250 - beq setbaudrate + ldx #2 + cmp #SER_BAUD_31250 + beq setbaudrate - ldx #12 - cmp #SER_BAUD_9600 - beq setbaudrate + ldx #12 + cmp #SER_BAUD_9600 + beq setbaudrate - ldx #25 - cmp #SER_BAUD_4800 - beq setbaudrate + ldx #25 + cmp #SER_BAUD_4800 + beq setbaudrate - ldx #51 - cmp #SER_BAUD_2400 - beq setbaudrate + ldx #51 + cmp #SER_BAUD_2400 + beq setbaudrate - ldx #103 - cmp #SER_BAUD_1200 - beq setbaudrate + ldx #103 + cmp #SER_BAUD_1200 + beq setbaudrate - ldx #207 - cmp #SER_BAUD_600 - beq setbaudrate + ldx #207 + cmp #SER_BAUD_600 + beq setbaudrate - ; clock = 6 * 15625 - ldx #%00011010 - stx TIM4CTLA + ; clock = 6 * 15625 + ldx #%00011010 + stx TIM4CTLA - ldx #12 - cmp #SER_BAUD_7200 - beq setbaudrate + ldx #12 + cmp #SER_BAUD_7200 + beq setbaudrate - ldx #25 - cmp #SER_BAUD_3600 - beq setbaudrate + ldx #25 + cmp #SER_BAUD_3600 + beq setbaudrate - ldx #207 - stx TIM4BKUP + ldx #207 + stx TIM4BKUP - ; clock = 4 * 15625 - ldx #%00011100 - cmp #SER_BAUD_300 - beq setprescaler + ; clock = 4 * 15625 + ldx #%00011100 + cmp #SER_BAUD_300 + beq setprescaler - ; clock = 6 * 15625 - ldx #%00011110 - cmp #SER_BAUD_150 - beq setprescaler + ; clock = 6 * 15625 + ldx #%00011110 + cmp #SER_BAUD_150 + beq setprescaler - ; clock = 1 * 15625 - ldx #%00011111 - stx TIM4CTLA - cmp #SER_BAUD_75 - beq baudsuccess + ; clock = 1 * 15625 + ldx #%00011111 + stx TIM4CTLA + cmp #SER_BAUD_75 + beq baudsuccess - ldx #141 - cmp #SER_BAUD_110 - beq setbaudrate + ldx #141 + cmp #SER_BAUD_110 + beq setbaudrate - ; clock = 2 * 15625 - ldx #%00011010 - stx TIM4CTLA - ldx #68 - cmp #SER_BAUD_1800 - beq setbaudrate + ; clock = 2 * 15625 + ldx #%00011010 + stx TIM4CTLA + ldx #68 + cmp #SER_BAUD_1800 + beq setbaudrate - ; clock = 6 * 15625 - ldx #%00011110 - stx TIM4CTLA - ldx #231 - cmp #SER_BAUD_134_5 - beq setbaudrate + ; clock = 6 * 15625 + ldx #%00011110 + stx TIM4CTLA + ldx #231 + cmp #SER_BAUD_134_5 + beq setbaudrate - lda #SER_ERR_BAUD_UNAVAIL - rts + lda #SER_ERR_BAUD_UNAVAIL + rts setprescaler: - stx TIM4CTLA - bra baudsuccess + stx TIM4CTLA + bra baudsuccess setbaudrate: - stx TIM4BKUP + stx TIM4BKUP baudsuccess: - ldx #TxOpenColl|ParEven - stx contrl - ldy #SER_PARAMS::DATABITS ; Databits - lda (ptr1),y - cmp #SER_BITS_8 - bne invparameter - ldy #SER_PARAMS::STOPBITS ; Stopbits - lda (ptr1),y - cmp #SER_STOP_1 - bne invparameter - ldy #SER_PARAMS::PARITY ; Parity - lda (ptr1),y - cmp #SER_PAR_NONE - beq invparameter - cmp #SER_PAR_MARK - beq checkhs - cmp #SER_PAR_SPACE - bne @L0 - ldx #TxOpenColl - stx contrl - bra checkhs + ldx #TxOpenColl|ParEven + stx contrl + ldy #SER_PARAMS::DATABITS ; Databits + lda (ptr1),y + cmp #SER_BITS_8 + bne invparameter + ldy #SER_PARAMS::STOPBITS ; Stopbits + lda (ptr1),y + cmp #SER_STOP_1 + bne invparameter + ldy #SER_PARAMS::PARITY ; Parity + lda (ptr1),y + cmp #SER_PAR_NONE + beq invparameter + cmp #SER_PAR_MARK + beq checkhs + cmp #SER_PAR_SPACE + bne @L0 + ldx #TxOpenColl + stx contrl + bra checkhs @L0: - ldx #TxParEnable|TxOpenColl|ParEven - stx contrl - cmp #SER_PAR_EVEN - beq checkhs - ldx #TxParEnable|TxOpenColl - stx contrl + ldx #TxParEnable|TxOpenColl|ParEven + stx contrl + cmp #SER_PAR_EVEN + beq checkhs + ldx #TxParEnable|TxOpenColl + stx contrl checkhs: - ldx contrl - stx SERCTL - ldy #SER_PARAMS::HANDSHAKE ; Handshake - lda (ptr1),y - cmp #SER_HS_NONE - bne invparameter - lda SERDAT - lda contrl - ora #RxIntEnable|ResetErr - sta SERCTL - lda #SER_ERR_OK - rts + ldx contrl + stx SERCTL + ldy #SER_PARAMS::HANDSHAKE ; Handshake + lda (ptr1),y + cmp #SER_HS_NONE + bne invparameter + lda SERDAT + lda contrl + ora #RxIntEnable|ResetErr + sta SERCTL + lda #SER_ERR_OK + rts invparameter: - lda #SER_ERR_INIT_FAILED - rts + lda #SER_ERR_INIT_FAILED + rts ;---------------------------------------------------------------------------- ; GET: Will fetch a character from the receive buffer and store it into the @@ -246,64 +246,64 @@ invparameter: ; returned. GET: - lda RxPtrIn - cmp RxPtrOut - bne GetByte - lda #SER_ERR_NO_DATA - rts + lda RxPtrIn + cmp RxPtrOut + bne GetByte + lda #SER_ERR_NO_DATA + rts GetByte: - ldy RxPtrOut - lda RxBuffer,y - inc RxPtrOut - ldx #$00 - sta (ptr1,x) - txa ; Return code = 0 - rts + ldy RxPtrOut + lda RxBuffer,y + inc RxPtrOut + ldx #$00 + sta (ptr1,x) + txa ; Return code = 0 + rts ;---------------------------------------------------------------------------- ; PUT: Output character in A. ; Must return an SER_ERR_xx code in a/x. PUT: - tax - lda TxPtrIn - ina - cmp TxPtrOut - bne PutByte - lda #SER_ERR_OVERFLOW - rts + tax + lda TxPtrIn + ina + cmp TxPtrOut + bne PutByte + lda #SER_ERR_OVERFLOW + rts PutByte: - ldy TxPtrIn - txa - sta TxBuffer,y - inc TxPtrIn + ldy TxPtrIn + txa + sta TxBuffer,y + inc TxPtrIn - bit TxDone - bmi @L1 + bit TxDone + bmi @L1 php sei - lda contrl - ora #TxIntEnable|ResetErr - sta SERCTL ; Allow TX-IRQ to hang RX-IRQ - sta TxDone + lda contrl + ora #TxIntEnable|ResetErr + sta SERCTL ; Allow TX-IRQ to hang RX-IRQ + sta TxDone plp @L1: - lda #SER_ERR_INV_IOCTL - rts + lda #SER_ERR_INV_IOCTL + rts ;---------------------------------------------------------------------------- ; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All @@ -325,84 +325,84 @@ IOCTL: ; Due to this bug you have to disable the interrupt before clearing it. IRQ: - lda INTSET ; Poll all pending interrupts - and #SERIAL_INTERRUPT - bne @L0 - clc - rts + lda INTSET ; Poll all pending interrupts + and #SERIAL_INTERRUPT + bne @L0 + clc + rts @L0: - bit TxDone - bmi @tx_irq ; Transmit in progress - ldx SERDAT - lda SERCTL - and #RxParityErr|RxOverrun|RxFrameErr|RxBreak - beq @rx_irq - tsb SerialStat ; Save error condition - bit #RxBreak - beq @noBreak - stz TxPtrIn ; Break received - drop buffers - stz TxPtrOut - stz RxPtrIn - stz RxPtrOut + bit TxDone + bmi @tx_irq ; Transmit in progress + ldx SERDAT + lda SERCTL + and #RxParityErr|RxOverrun|RxFrameErr|RxBreak + beq @rx_irq + tsb SerialStat ; Save error condition + bit #RxBreak + beq @noBreak + stz TxPtrIn ; Break received - drop buffers + stz TxPtrOut + stz RxPtrIn + stz RxPtrOut @noBreak: - lda contrl - ora #RxIntEnable|ResetErr - sta SERCTL - lda #$10 - sta INTRST - bra @IRQexit + lda contrl + ora #RxIntEnable|ResetErr + sta SERCTL + lda #$10 + sta INTRST + bra @IRQexit @rx_irq: - lda contrl - ora #RxIntEnable|ResetErr - sta SERCTL + lda contrl + ora #RxIntEnable|ResetErr + sta SERCTL txa - ldx RxPtrIn - sta RxBuffer,x + ldx RxPtrIn + sta RxBuffer,x txa inx @cont0: - cpx RxPtrOut - beq @1 - stx RxPtrIn - lda #SERIAL_INTERRUPT - sta INTRST - bra @IRQexit + cpx RxPtrOut + beq @1 + stx RxPtrIn + lda #SERIAL_INTERRUPT + sta INTRST + bra @IRQexit @1: - sta RxPtrIn - lda #$80 - tsb SerialStat + sta RxPtrIn + lda #$80 + tsb SerialStat @tx_irq: - ldx TxPtrOut ; Has all bytes been sent? - cpx TxPtrIn - beq @allSent + ldx TxPtrOut ; Has all bytes been sent? + cpx TxPtrIn + beq @allSent - lda TxBuffer,x ; Send next byte - sta SERDAT - inc TxPtrOut + lda TxBuffer,x ; Send next byte + sta SERDAT + inc TxPtrOut @exit1: - lda contrl - ora #TxIntEnable|ResetErr - sta SERCTL - lda #SERIAL_INTERRUPT - sta INTRST - bra @IRQexit + lda contrl + ora #TxIntEnable|ResetErr + sta SERCTL + lda #SERIAL_INTERRUPT + sta INTRST + bra @IRQexit @allSent: - lda SERCTL ; All bytes sent - bit #TxEmpty - beq @exit1 - bvs @exit1 - stz TxDone - lda contrl - ora #RxIntEnable|ResetErr - sta SERCTL + lda SERCTL ; All bytes sent + bit #TxEmpty + beq @exit1 + bvs @exit1 + stz TxDone + lda contrl + ora #RxIntEnable|ResetErr + sta SERCTL - lda #SERIAL_INTERRUPT - sta INTRST + lda #SERIAL_INTERRUPT + sta INTRST @IRQexit: - clc + clc rts diff --git a/libsrc/lynx/tgi/lynx-160-102-16.s b/libsrc/lynx/tgi/lynx-160-102-16.s index 0dd3338bf..4542cae1d 100644 --- a/libsrc/lynx/tgi/lynx-160-102-16.s +++ b/libsrc/lynx/tgi/lynx-160-102-16.s @@ -7,13 +7,13 @@ ; This code is written by Karri Kaksonen, 2004 for the cc65 compiler. ; - .include "zeropage.inc" - .include "../extzp.inc" + .include "zeropage.inc" + .include "../extzp.inc" - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" .include "tgi-error.inc" - .include "lynx.inc" + .include "lynx.inc" .macpack generic @@ -33,7 +33,7 @@ .byte 2 ; Number of screens available .byte 8 ; System font X size .byte 8 ; System font Y size - .word $0100 ; Aspect ratio (square pixel LCD) + .word $0100 ; Aspect ratio (square pixel LCD) .byte TGI_BM_FONT_FINESCALE ; TGI driver flags ; Next comes the jump table. Currently all entries must be valid and may point @@ -46,7 +46,7 @@ .addr UNINSTALL .addr INIT .addr DONE - .addr GETERROR + .addr GETERROR .addr CONTROL .addr CLEAR .addr SETVIEWPAGE @@ -75,34 +75,34 @@ Y1 := ptr2 X2 := ptr3 Y2 := ptr4 -STRPTR := ptr3 -FONTOFF := ptr4 -STROFF := tmp3 -STRLEN := tmp4 +STRPTR := ptr3 +FONTOFF := ptr4 +STROFF := tmp3 +STRLEN := tmp4 ; Absolute variables used in the code .bss -ERROR: .res 1 ; Error code +ERROR: .res 1 ; Error code -DRAWINDEX: .res 1 ; Pen to use for drawing -VIEWPAGEL: .res 1 -VIEWPAGEH: .res 1 -DRAWPAGEL: .res 1 -DRAWPAGEH: .res 1 +DRAWINDEX: .res 1 ; Pen to use for drawing +VIEWPAGEL: .res 1 +VIEWPAGEH: .res 1 +DRAWPAGEL: .res 1 +DRAWPAGEH: .res 1 ; Text output stuff TEXTMAGX: .res 1 TEXTMAGY: .res 1 TEXTDIR: .res 1 -BGINDEX: .res 1 ; Pen to use for text background +BGINDEX: .res 1 ; Pen to use for text background ; Double buffer IRQ stuff -DRAWPAGE: .res 1 -SWAPREQUEST: .res 1 +DRAWPAGE: .res 1 +SWAPREQUEST: .res 1 -text_bitmap: .res 8*(1+20+1)+1 +text_bitmap: .res 8*(1+20+1)+1 ; 8 rows with (one offset-byte plus 20 character bytes plus one fill-byte) plus one 0-offset-byte ; Constants and tables @@ -110,37 +110,37 @@ text_bitmap: .res 8*(1+20+1)+1 .rodata DEFPALETTE: .byte >$011 - .byte >$34d - .byte >$9af - .byte >$9b8 - .byte >$777 - .byte >$335 - .byte >$448 - .byte >$75e - .byte >$d5f - .byte >$c53 - .byte >$822 - .byte >$223 - .byte >$484 - .byte >$8e5 - .byte >$cf5 - .byte >$fff - .byte <$011 - .byte <$34d - .byte <$9af - .byte <$9b8 - .byte <$777 - .byte <$335 - .byte <$448 - .byte <$75e - .byte <$d5f - .byte <$c53 - .byte <$822 - .byte <$223 - .byte <$484 - .byte <$8e5 - .byte <$cf5 - .byte <$fff + .byte >$34d + .byte >$9af + .byte >$9b8 + .byte >$777 + .byte >$335 + .byte >$448 + .byte >$75e + .byte >$d5f + .byte >$c53 + .byte >$822 + .byte >$223 + .byte >$484 + .byte >$8e5 + .byte >$cf5 + .byte >$fff + .byte <$011 + .byte <$34d + .byte <$9af + .byte <$9b8 + .byte <$777 + .byte <$335 + .byte <$448 + .byte <$75e + .byte <$d5f + .byte <$c53 + .byte <$822 + .byte <$223 + .byte <$484 + .byte <$8e5 + .byte <$cf5 + .byte <$fff PALETTESIZE = * - DEFPALETTE @@ -155,12 +155,12 @@ PALETTESIZE = * - DEFPALETTE ; INSTALL: - lda #1 - sta TEXTMAGX - sta TEXTMAGY - stz BGINDEX - stz DRAWPAGE - stz SWAPREQUEST + lda #1 + sta TEXTMAGX + sta TEXTMAGY + stz BGINDEX + stz DRAWPAGE + stz SWAPREQUEST rts @@ -191,18 +191,18 @@ UNINSTALL: INIT: ; Enable interrupts for VBL - lda #$80 - tsb VTIMCTLA + lda #$80 + tsb VTIMCTLA ; Set up collision buffer to $A058 - lda #$58 - sta COLLBASL - lda #$A0 - sta COLLBASH + lda #$58 + sta COLLBASL + lda #$A0 + sta COLLBASH ; Put collision index before sprite data - lda #$FF - sta COLLOFFL - lda #$FF - sta COLLOFFH + lda #$FF + sta COLLOFFL + lda #$FF + sta COLLOFFH ; Done, reset the error code lda #TGI_ERR_OK sta ERROR @@ -223,9 +223,9 @@ DONE: ; GETERROR: Return the error code in A and clear it. GETERROR: - ldx #TGI_ERR_OK - lda ERROR - stx ERROR + ldx #TGI_ERR_OK + lda ERROR + stx ERROR rts ; ------------------------------------------------------------------------ @@ -253,126 +253,126 @@ GETERROR: ; Activate or deactivate collision detection by calling tgi_ioctl(5, 0/1). CONTROL: - pha ; Almost all control routines succeed + pha ; Almost all control routines succeed lda #TGI_ERR_OK - sta ERROR - pla + sta ERROR + pla - cmp #5 - bne ControlSwap - lda ptr1 ; Activate/deactivate collision detection - bne @L0 - lda #%00000001 ; tgi_clear does not erase collision buffer - sta cls_sprite - lda #%00100000 - sta cls_sprite+2 - lda __sprsys - ora #$20 - bra @L1 -@L0: lda #%00000000 ; tgi_clear erases collision buffer - sta cls_sprite - sta cls_sprite+2 - lda __sprsys - and #$df -@L1: sta __sprsys - sta SPRSYS - rts + cmp #5 + bne ControlSwap + lda ptr1 ; Activate/deactivate collision detection + bne @L0 + lda #%00000001 ; tgi_clear does not erase collision buffer + sta cls_sprite + lda #%00100000 + sta cls_sprite+2 + lda __sprsys + ora #$20 + bra @L1 +@L0: lda #%00000000 ; tgi_clear erases collision buffer + sta cls_sprite + sta cls_sprite+2 + lda __sprsys + and #$df +@L1: sta __sprsys + sta SPRSYS + rts ControlSwap: - cmp #4 - bne ControlFramerate + cmp #4 + bne ControlFramerate - lda ptr1 ; Swap request - bne @L0 - lda SWAPREQUEST - rts -@L0: sta SWAPREQUEST - rts + lda ptr1 ; Swap request + bne @L0 + lda SWAPREQUEST + rts +@L0: sta SWAPREQUEST + rts ControlFramerate: - cmp #3 - bne ControlTextBG + cmp #3 + bne ControlTextBG - lda ptr1 - cmp #75 ; Set framerate - beq rate75 - cmp #60 - beq rate60 + lda ptr1 + cmp #75 ; Set framerate + beq rate75 + cmp #60 + beq rate60 cmp #50 - beq rate50 + beq rate50 lda #TGI_ERR_INV_ARG - sta ERROR + sta ERROR rts -rate50: lda #$bd ; 50 Hz - ldx #$31 - bra setRate -rate60: lda #$9e ; 60 Hz - ldx #$29 - bra setRate -rate75: lda #$7e ; 75 Hz - ldx #$20 +rate50: lda #$bd ; 50 Hz + ldx #$31 + bra setRate +rate60: lda #$9e ; 60 Hz + ldx #$29 + bra setRate +rate75: lda #$7e ; 75 Hz + ldx #$20 setRate: sta HTIMBKUP - stx PBKUP - rts + stx PBKUP + rts ControlTextBG: - cmp #2 - bne ControlFlipScreen + cmp #2 + bne ControlFlipScreen - lda ptr1 ; Set text background color - sta BGINDEX - rts + lda ptr1 ; Set text background color + sta BGINDEX + rts ControlFlipScreen: - cmp #1 - bne ControlDrawSprite + cmp #1 + bne ControlDrawSprite - lda __sprsys ; Flip screen - eor #8 - sta __sprsys - sta SPRSYS - lda __viddma - eor #2 - sta __viddma - sta DISPCTL - ldy VIEWPAGEL - ldx VIEWPAGEH - and #2 - beq NotFlipped - clc - tya - adc #<8159 - tay - txa - adc #>8159 - tax + lda __sprsys ; Flip screen + eor #8 + sta __sprsys + sta SPRSYS + lda __viddma + eor #2 + sta __viddma + sta DISPCTL + ldy VIEWPAGEL + ldx VIEWPAGEH + and #2 + beq NotFlipped + clc + tya + adc #<8159 + tay + txa + adc #>8159 + tax NotFlipped: - sty DISPADRL - stx DISPADRH + sty DISPADRL + stx DISPADRH rts ControlDrawSprite: - lda ptr1 ; Get the sprite address - ldx ptr1+1 + lda ptr1 ; Get the sprite address + ldx ptr1+1 -draw_sprite: ; Draw it in render buffer - sta SCBNEXTL - stx SCBNEXTH - lda DRAWPAGEL - ldx DRAWPAGEH - sta VIDBASL - stx VIDBASH - lda #1 - sta SPRGO - stz SDONEACK +draw_sprite: ; Draw it in render buffer + sta SCBNEXTL + stx SCBNEXTH + lda DRAWPAGEL + ldx DRAWPAGEH + sta VIDBASL + stx VIDBASH + lda #1 + sta SPRGO + stz SDONEACK @L0: stz CPUSLEEP - lda SPRSYS - lsr - bcs @L0 - stz SDONEACK + lda SPRSYS + lsr + bcs @L0 + stz SDONEACK lda #TGI_ERR_OK - sta ERROR + sta ERROR rts ; ------------------------------------------------------------------------ @@ -386,22 +386,22 @@ pixel_bitmap: .byte 3,%10000100,%00000000, $0 ; A pixel bitmap .data cls_coll: - .byte 0 + .byte 0 cls_sprite: - .byte %00000001 ; A pixel sprite - .byte %00010000 - .byte %00100000 - .addr 0,pixel_bitmap - .word 0 - .word 0 - .word $a000 ; 160 - .word $6600 ; 102 - .byte $00 + .byte %00000001 ; A pixel sprite + .byte %00010000 + .byte %00100000 + .addr 0,pixel_bitmap + .word 0 + .word 0 + .word $a000 ; 160 + .word $6600 ; 102 + .byte $00 .code CLEAR: lda #cls_sprite - bra draw_sprite + ldx #>cls_sprite + bra draw_sprite ; ------------------------------------------------------------------------ ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). @@ -415,31 +415,31 @@ CLEAR: lda #$e018 - bra @L2 + cmp #1 + beq @L1 ; page == maxpages-1 + ldy #<$e018 ; page 0 + ldx #>$e018 + bra @L2 @L1: - ldy #<$c038 ; page 1 - ldx #>$c038 + ldy #<$c038 ; page 1 + ldx #>$c038 @L2: - sty VIEWPAGEL ; Save viewpage for getpixel - stx VIEWPAGEH + sty VIEWPAGEL ; Save viewpage for getpixel + stx VIEWPAGEH - lda __viddma ; Process flipped displays - and #2 - beq @L3 - clc - tya - adc #<8159 - tay - txa - adc #>8159 - tax + lda __viddma ; Process flipped displays + and #2 + beq @L3 + clc + tya + adc #<8159 + tay + txa + adc #>8159 + tax @L3: sty DISPADRL ; $FD94 - stx DISPADRH ; $FD95 + stx DISPADRH ; $FD95 rts ; ------------------------------------------------------------------------ @@ -450,17 +450,17 @@ SETVIEWPAGE: ; SETDRAWPAGE: - cmp #1 - beq @L1 ; page == maxpages-1 - lda #<$e018 ; page 0 - ldx #>$e018 - bra @L2 + cmp #1 + beq @L1 ; page == maxpages-1 + lda #<$e018 ; page 0 + ldx #>$e018 + bra @L2 @L1: lda #<$c038 ; page 1 - ldx #>$c038 + ldx #>$c038 @L2: sta DRAWPAGEL - stx DRAWPAGEH + stx DRAWPAGEH rts ; ------------------------------------------------------------------------ @@ -468,23 +468,23 @@ SETDRAWPAGE: ; IRQ: - lda INTSET ; Poll all pending interrupts - and #VBL_INTERRUPT - beq IRQEND ; Exit if not a VBL interrupt + lda INTSET ; Poll all pending interrupts + and #VBL_INTERRUPT + beq IRQEND ; Exit if not a VBL interrupt - lda SWAPREQUEST - beq @L0 - lda DRAWPAGE - jsr SETVIEWPAGE - lda DRAWPAGE - eor #1 - sta DRAWPAGE - jsr SETDRAWPAGE - stz SWAPREQUEST + lda SWAPREQUEST + beq @L0 + lda DRAWPAGE + jsr SETVIEWPAGE + lda DRAWPAGE + eor #1 + sta DRAWPAGE + jsr SETDRAWPAGE + stz SWAPREQUEST @L0: IRQEND: - clc - rts + clc + rts ; ------------------------------------------------------------------------ ; SETCOLOR: Set the drawing color (in A). The new color is already checked @@ -506,11 +506,11 @@ SETCOLOR: ; SETPALETTE: - ldy #31 + ldy #31 @L1: lda (ptr1),y - sta GCOLMAP,y ; $FDA0 - dey - bpl @L1 + sta GCOLMAP,y ; $FDA0 + dey + bpl @L1 ; Done, reset the error code @@ -527,8 +527,8 @@ SETPALETTE: ; GETPALETTE: - lda #GCOLMAP + lda #GCOLMAP rts ; ------------------------------------------------------------------------ @@ -555,17 +555,17 @@ GETDEFPALETTE: .data pixel_coll: - .byte 0 + .byte 0 pixel_sprite: - .byte %00000001 ; A pixel sprite - .byte %00010000 - .byte %00100000 - .addr 0,pixel_bitmap -pix_x: .word 0 -pix_y: .word 0 - .word $100 - .word $100 -pix_c: .byte $00 + .byte %00000001 ; A pixel sprite + .byte %00010000 + .byte %00100000 + .addr 0,pixel_bitmap +pix_x: .word 0 +pix_y: .word 0 + .word $100 + .word $100 +pix_c: .byte $00 .code SETPIXEL: @@ -573,11 +573,11 @@ SETPIXEL: sta pix_x lda Y1 sta pix_y - lda DRAWINDEX - sta pix_c + lda DRAWINDEX + sta pix_c lda #pixel_sprite - jmp draw_sprite + ldx #>pixel_sprite + jmp draw_sprite ; ------------------------------------------------------------------------ ; GETPIXEL: Read the color value of a pixel and return it in A/X. The @@ -587,42 +587,42 @@ SETPIXEL: GETPIXEL: lda Y1 - sta MATHD ; Hardware multiply - stz MATHC - lda #80 - sta MATHB - stz MATHA - lda X1 - lsr A - php - tay + sta MATHD ; Hardware multiply + stz MATHC + lda #80 + sta MATHB + stz MATHA + lda X1 + lsr A + php + tay - clc - lda VIEWPAGEL - adc MATHH - sta ptr1 - lda VIEWPAGEH - adc MATHG - sta ptr1+1 + clc + lda VIEWPAGEL + adc MATHH + sta ptr1 + lda VIEWPAGEH + adc MATHG + sta ptr1+1 - ldx #0 - lda #15 - sta MAPCTL - lda (ptr1),y - tay - lda #$0c - sta MAPCTL - tya - plp - bcc @L1 - and #$f - rts + ldx #0 + lda #15 + sta MAPCTL + lda (ptr1),y + tay + lda #$0c + sta MAPCTL + tya + plp + bcc @L1 + and #$f + rts @L1: lsr A - lsr A - lsr A - lsr A - rts + lsr A + lsr A + lsr A + rts ; ------------------------------------------------------------------------ ; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and @@ -633,121 +633,121 @@ GETPIXEL: .data line_coll: - .byte 0 + .byte 0 line_sprite: - .byte 0 ; Will be replaced by the code - .byte %00110000 - .byte %00100000 - .word 0,pixel_bitmap + .byte 0 ; Will be replaced by the code + .byte %00110000 + .byte %00100000 + .word 0,pixel_bitmap line_x: - .word 0 + .word 0 line_y: - .word 0 + .word 0 line_sx: - .word $100 + .word $100 line_sy: - .word $100 - .word 0 + .word $100 + .word 0 line_tilt: - .word 0 + .word 0 line_c: - .byte $e + .byte $e .code LINE: - lda DRAWINDEX - sta line_c - stz line_sx - stz line_sy + lda DRAWINDEX + sta line_c + stz line_sx + stz line_sy - sec - lda X2 - sbc X1 - lda X2+1 - sbc X1+1 - bpl @L1 - lda X1 - ldx X2 - sta X2 - stx X1 - lda X1+1 - ldx X2+1 - sta X2+1 - stx X1+1 - lda Y1 - ldx Y2 - sta Y2 - stx Y1 - lda Y1+1 - ldx Y2+1 - sta Y2+1 - stx Y1+1 + sec + lda X2 + sbc X1 + lda X2+1 + sbc X1+1 + bpl @L1 + lda X1 + ldx X2 + sta X2 + stx X1 + lda X1+1 + ldx X2+1 + sta X2+1 + stx X1+1 + lda Y1 + ldx Y2 + sta Y2 + stx Y1 + lda Y1+1 + ldx Y2+1 + sta Y2+1 + stx Y1+1 @L1: - lda #%00000000 ; Not flipped - sta line_sprite + lda #%00000000 ; Not flipped + sta line_sprite - sec - lda Y2 - sbc Y1 - sta Y2 - lda Y2+1 - sbc Y1+1 - sta Y2+1 - bpl @L2 - sec - lda #0 - sbc Y2 - sta Y2 - lda #0 - sbc Y2+1 - sta Y2+1 - lda #%00010000 ; Vertical flip - sta line_sprite + sec + lda Y2 + sbc Y1 + sta Y2 + lda Y2+1 + sbc Y1+1 + sta Y2+1 + bpl @L2 + sec + lda #0 + sbc Y2 + sta Y2 + lda #0 + sbc Y2+1 + sta Y2+1 + lda #%00010000 ; Vertical flip + sta line_sprite @L2: - lda X1 - sta line_x - lda X1+1 - sta line_x+1 - lda Y1 - sta line_y - lda Y1+1 - sta line_y+1 + lda X1 + sta line_x + lda X1+1 + sta line_x+1 + lda Y1 + sta line_y + lda Y1+1 + sta line_y+1 - lda Y2 - ina - sta line_sy+1 - sta MATHP ; hardware divide - stz MATHN + lda Y2 + ina + sta line_sy+1 + sta MATHP ; hardware divide + stz MATHN - stz MATHH - stz MATHG - sec - lda X2 - sbc X1 - ina - sta MATHF - stz MATHE + stz MATHH + stz MATHG + sec + lda X2 + sbc X1 + ina + sta MATHF + stz MATHE @L3: - lda SPRSYS - bmi @L3 ; wait for math done (bit 7 of sprsys) - lda MATHC - sta line_tilt - lda MATHB - sta line_tilt+1 - bne @L4 - lda #1 - sta line_sx+1 - bra @L6 + lda SPRSYS + bmi @L3 ; wait for math done (bit 7 of sprsys) + lda MATHC + sta line_tilt + lda MATHB + sta line_tilt+1 + bne @L4 + lda #1 + sta line_sx+1 + bra @L6 @L4: - bit line_tilt - bpl @L5 - ina + bit line_tilt + bpl @L5 + ina @L5: - sta line_sx+1 + sta line_sx+1 @L6: - lda #line_sprite - jmp draw_sprite + lda #line_sprite + jmp draw_sprite ; ------------------------------------------------------------------------ ; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where @@ -767,38 +767,38 @@ LINE: .data bar_coll: - .byte 0 + .byte 0 bar_sprite: - .byte %00000001 ; A pixel sprite - .byte %00010000 - .byte %00100000 - .addr 0,pixel_bitmap -bar_x: .word 0 -bar_y: .word 0 -bar_sx: .word $0100 -bar_sy: .word $0100 -bar_c: .byte $00 + .byte %00000001 ; A pixel sprite + .byte %00010000 + .byte %00100000 + .addr 0,pixel_bitmap +bar_x: .word 0 +bar_y: .word 0 +bar_sx: .word $0100 +bar_sy: .word $0100 +bar_c: .byte $00 .code BAR: lda X1 sta bar_x lda Y1 sta bar_y - lda X2 - sec - sbc X1 - ina - sta bar_sx+1 - lda Y2 - sec - sbc Y1 - ina - sta bar_sy+1 - lda DRAWINDEX - sta bar_c + lda X2 + sec + sbc X1 + ina + sta bar_sx+1 + lda Y2 + sec + sbc Y1 + ina + sta bar_sy+1 + lda DRAWINDEX + sta bar_c lda #bar_sprite - jmp draw_sprite + ldx #>bar_sprite + jmp draw_sprite ; ------------------------------------------------------------------------ ; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y @@ -822,133 +822,133 @@ TEXTSTYLE: ; OUTTEXT: - lda TEXTMAGX ; Scale sprite - sta text_sx+1 - lda TEXTMAGY - sta text_sy+1 + lda TEXTMAGX ; Scale sprite + sta text_sx+1 + lda TEXTMAGY + sta text_sy+1 - stz text_sprite ; Set normal sprite - lda BGINDEX - bne @L1 - lda #4 - sta text_sprite ; Set opaque sprite + stz text_sprite ; Set normal sprite + lda BGINDEX + bne @L1 + lda #4 + sta text_sprite ; Set opaque sprite @L1: - lda DRAWINDEX ; Set color - asl - asl - asl - asl - ora BGINDEX - sta text_c + lda DRAWINDEX ; Set color + asl + asl + asl + asl + ora BGINDEX + sta text_c - lda X1 ; Set start position - sta text_x - lda X1+1 - sta text_x+1 - lda Y1 - sta text_y - lda Y1+1 - sta text_y+1 + lda X1 ; Set start position + sta text_x + lda X1+1 + sta text_x+1 + lda Y1 + sta text_y + lda Y1+1 + sta text_y+1 - ldy #<-1 ; Calculate string length + ldy #<-1 ; Calculate string length @L2: - iny - lda (STRPTR),y - bne @L2 - cpy #20 - bmi @L3 - ldy #20 -@L3: - sty STRLEN - bne @L4 - rts ; Zero length string -@L4: - iny ; Prepare text_bitmap iny - sty STROFF + lda (STRPTR),y + bne @L2 + cpy #20 + bmi @L3 + ldy #20 +@L3: + sty STRLEN + bne @L4 + rts ; Zero length string +@L4: + iny ; Prepare text_bitmap + iny + sty STROFF - ldy #8-1 ; 8 pixel lines per character - ldx #0 + ldy #8-1 ; 8 pixel lines per character + ldx #0 clc @L5: - lda STROFF - sta text_bitmap,x + lda STROFF + sta text_bitmap,x txa - adc STROFF + adc STROFF tax - lda #$ff - sta text_bitmap-1,x + lda #$ff + sta text_bitmap-1,x dey - bpl @L5 - stz text_bitmap,x + bpl @L5 + stz text_bitmap,x - stz tmp2 + stz tmp2 iny @L6: - lda (STRPTR),y - sty tmp1 + lda (STRPTR),y + sty tmp1 - sec ; (ch-' ') * 8 - sbc #32 - stz FONTOFF - stz FONTOFF+1 + sec ; (ch-' ') * 8 + sbc #32 + stz FONTOFF + stz FONTOFF+1 asl asl - rol FONTOFF+1 + rol FONTOFF+1 asl - rol FONTOFF+1 - clc ; Choose font - adc #font - sta FONTOFF+1 + rol FONTOFF+1 + clc ; Choose font + adc #font + sta FONTOFF+1 ; and now copy the 8 bytes of that char - ldx tmp2 + ldx tmp2 inx - stx tmp2 + stx tmp2 ; draw char from top to bottom, reading char-data from offset 8-1 to offset 0 - ldy #8-1 + ldy #8-1 @L7: - lda (FONTOFF),y ; *chptr - sta text_bitmap,x ;textbuf[y*(1+len+1)+1+x] + lda (FONTOFF),y ; *chptr + sta text_bitmap,x ;textbuf[y*(1+len+1)+1+x] txa - adc STROFF + adc STROFF tax dey - bpl @L7 + bpl @L7 ; goto next char - ldy tmp1 + ldy tmp1 iny - dec STRLEN - bne @L6 + dec STRLEN + bne @L6 - lda #text_sprite - jmp draw_sprite + lda #text_sprite + jmp draw_sprite .data text_coll: - .byte 0 + .byte 0 text_sprite: - .byte $00,$90,$20 - .addr 0, text_bitmap + .byte $00,$90,$20 + .addr 0, text_bitmap text_x: - .word 0 + .word 0 text_y: - .word 0 + .word 0 text_sx: - .word $100 + .word $100 text_sy: - .word $100 + .word $100 text_c: - .byte 0 + .byte 0 .rodata ; The Font @@ -957,104 +957,104 @@ text_c: ; bit value 0 = foreground, bit value 1 = background / transparent font: ; VERSAIL - .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ;32 - .byte $FF, $E7, $FF, $FF, $E7, $E7, $E7, $E7 ;33 - .byte $FF, $FF, $FF, $FF, $FF, $99, $99, $99 ;34 - .byte $FF, $99, $99, $00, $99, $00, $99, $99 ;35 - .byte $FF, $E7, $83, $F9, $C3, $9F, $C1, $E7 ;36 - .byte $FF, $B9, $99, $CF, $E7, $F3, $99, $9D ;37 - .byte $FF, $C0, $99, $98, $C7, $C3, $99, $C3 ;38 - .byte $FF, $FF, $FF, $FF, $FF, $E7, $F3, $F9 ;39 - .byte $FF, $F3, $E7, $CF, $CF, $CF, $E7, $F3 ;40 - .byte $FF, $CF, $E7, $F3, $F3, $F3, $E7, $CF ;41 - .byte $FF, $FF, $99, $C3, $00, $C3, $99, $FF ;42 - .byte $FF, $FF, $E7, $E7, $81, $E7, $E7, $FF ;43 - .byte $CF, $E7, $E7, $FF, $FF, $FF, $FF, $FF ;44 - .byte $FF, $FF, $FF, $FF, $81, $FF, $FF, $FF ;45 - .byte $FF, $E7, $E7, $FF, $FF, $FF, $FF, $FF ;46 - .byte $FF, $9F, $CF, $E7, $F3, $F9, $FC, $FF ;47 - .byte $FF, $C3, $99, $99, $89, $91, $99, $C3 ;48 - .byte $FF, $81, $E7, $E7, $E7, $C7, $E7, $E7 ;49 - .byte $FF, $81, $9F, $CF, $F3, $F9, $99, $C3 ;50 - .byte $FF, $C3, $99, $F9, $E3, $F9, $99, $C3 ;51 - .byte $FF, $F9, $F9, $80, $99, $E1, $F1, $F9 ;52 - .byte $FF, $C3, $99, $F9, $F9, $83, $9F, $81 ;53 - .byte $FF, $C3, $99, $99, $83, $9F, $99, $C3 ;54 - .byte $FF, $E7, $E7, $E7, $E7, $F3, $99, $81 ;55 - .byte $FF, $C3, $99, $99, $C3, $99, $99, $C3 ;56 - .byte $FF, $C3, $99, $F9, $C1, $99, $99, $C3 ;57 - .byte $FF, $FF, $E7, $FF, $FF, $E7, $FF, $FF ;58 - .byte $CF, $E7, $E7, $FF, $FF, $E7, $FF, $FF ;59 - .byte $FF, $F1, $E7, $CF, $9F, $CF, $E7, $F1 ;60 - .byte $FF, $FF, $FF, $81, $FF, $81, $FF, $FF ;61 - .byte $FF, $8F, $E7, $F3, $F9, $F3, $E7, $8F ;62 - .byte $FF, $E7, $FF, $E7, $F3, $F9, $99, $C3 ;63 + .byte $FF, $FF, $FF, $FF, $FF, $FF, $FF, $FF ;32 + .byte $FF, $E7, $FF, $FF, $E7, $E7, $E7, $E7 ;33 + .byte $FF, $FF, $FF, $FF, $FF, $99, $99, $99 ;34 + .byte $FF, $99, $99, $00, $99, $00, $99, $99 ;35 + .byte $FF, $E7, $83, $F9, $C3, $9F, $C1, $E7 ;36 + .byte $FF, $B9, $99, $CF, $E7, $F3, $99, $9D ;37 + .byte $FF, $C0, $99, $98, $C7, $C3, $99, $C3 ;38 + .byte $FF, $FF, $FF, $FF, $FF, $E7, $F3, $F9 ;39 + .byte $FF, $F3, $E7, $CF, $CF, $CF, $E7, $F3 ;40 + .byte $FF, $CF, $E7, $F3, $F3, $F3, $E7, $CF ;41 + .byte $FF, $FF, $99, $C3, $00, $C3, $99, $FF ;42 + .byte $FF, $FF, $E7, $E7, $81, $E7, $E7, $FF ;43 + .byte $CF, $E7, $E7, $FF, $FF, $FF, $FF, $FF ;44 + .byte $FF, $FF, $FF, $FF, $81, $FF, $FF, $FF ;45 + .byte $FF, $E7, $E7, $FF, $FF, $FF, $FF, $FF ;46 + .byte $FF, $9F, $CF, $E7, $F3, $F9, $FC, $FF ;47 + .byte $FF, $C3, $99, $99, $89, $91, $99, $C3 ;48 + .byte $FF, $81, $E7, $E7, $E7, $C7, $E7, $E7 ;49 + .byte $FF, $81, $9F, $CF, $F3, $F9, $99, $C3 ;50 + .byte $FF, $C3, $99, $F9, $E3, $F9, $99, $C3 ;51 + .byte $FF, $F9, $F9, $80, $99, $E1, $F1, $F9 ;52 + .byte $FF, $C3, $99, $F9, $F9, $83, $9F, $81 ;53 + .byte $FF, $C3, $99, $99, $83, $9F, $99, $C3 ;54 + .byte $FF, $E7, $E7, $E7, $E7, $F3, $99, $81 ;55 + .byte $FF, $C3, $99, $99, $C3, $99, $99, $C3 ;56 + .byte $FF, $C3, $99, $F9, $C1, $99, $99, $C3 ;57 + .byte $FF, $FF, $E7, $FF, $FF, $E7, $FF, $FF ;58 + .byte $CF, $E7, $E7, $FF, $FF, $E7, $FF, $FF ;59 + .byte $FF, $F1, $E7, $CF, $9F, $CF, $E7, $F1 ;60 + .byte $FF, $FF, $FF, $81, $FF, $81, $FF, $FF ;61 + .byte $FF, $8F, $E7, $F3, $F9, $F3, $E7, $8F ;62 + .byte $FF, $E7, $FF, $E7, $F3, $F9, $99, $C3 ;63 - .byte $FF, $C3, $9D, $9F, $91, $91, $99, $C3 ;0 - .byte $FF, $99, $99, $99, $81, $99, $C3, $E7 ;1 - .byte $FF, $83, $99, $99, $83, $99, $99, $83 ;2 - .byte $FF, $C3, $99, $9F, $9F, $9F, $99, $C3 ;3 - .byte $FF, $87, $93, $99, $99, $99, $93, $87 ;4 - .byte $FF, $81, $9F, $9F, $87, $9F, $9F, $81 ;5 - .byte $FF, $9F, $9F, $9F, $87, $9F, $9F, $81 ;6 - .byte $FF, $C3, $99, $99, $91, $9F, $99, $C3 ;7 - .byte $FF, $99, $99, $99, $81, $99, $99, $99 ;8 - .byte $FF, $C3, $E7, $E7, $E7, $E7, $E7, $C3 ;9 - .byte $FF, $C7, $93, $F3, $F3, $F3, $F3, $E1 ;10 - .byte $FF, $99, $93, $87, $8F, $87, $93, $99 ;11 - .byte $FF, $81, $9F, $9F, $9F, $9F, $9F, $9F ;12 - .byte $FF, $9C, $9C, $9C, $94, $80, $88, $9C ;13 - .byte $FF, $99, $99, $91, $81, $81, $89, $99 ;14 - .byte $FF, $C3, $99, $99, $99, $99, $99, $C3 ;15 - .byte $FF, $9F, $9F, $9F, $83, $99, $99, $83 ;16 - .byte $FF, $F1, $C3, $99, $99, $99, $99, $C3 ;17 - .byte $FF, $99, $93, $87, $83, $99, $99, $83 ;18 - .byte $FF, $C3, $99, $F9, $C3, $9F, $99, $C3 ;19 - .byte $FF, $E7, $E7, $E7, $E7, $E7, $E7, $81 ;20 - .byte $FF, $C3, $99, $99, $99, $99, $99, $99 ;21 - .byte $FF, $E7, $C3, $99, $99, $99, $99, $99 ;22 - .byte $FF, $9C, $88, $80, $94, $9C, $9C, $9C ;23 - .byte $FF, $99, $99, $C3, $E7, $C3, $99, $99 ;24 - .byte $FF, $E7, $E7, $E7, $C3, $99, $99, $99 ;25 - .byte $FF, $81, $9F, $CF, $E7, $F3, $F9, $81 ;26 - .byte $FF, $C3, $CF, $CF, $CF, $CF, $CF, $C3 ;27 - .byte $FF, $03, $9D, $CF, $83, $CF, $ED, $F3 ;28 - .byte $FF, $C3, $F3, $F3, $F3, $F3, $F3, $C3 ;29 - .byte $E7, $E7, $E7, $E7, $81, $C3, $E7, $FF ;30 - .byte $FF, $EF, $CF, $80, $80, $CF, $EF, $FF ;31 + .byte $FF, $C3, $9D, $9F, $91, $91, $99, $C3 ;0 + .byte $FF, $99, $99, $99, $81, $99, $C3, $E7 ;1 + .byte $FF, $83, $99, $99, $83, $99, $99, $83 ;2 + .byte $FF, $C3, $99, $9F, $9F, $9F, $99, $C3 ;3 + .byte $FF, $87, $93, $99, $99, $99, $93, $87 ;4 + .byte $FF, $81, $9F, $9F, $87, $9F, $9F, $81 ;5 + .byte $FF, $9F, $9F, $9F, $87, $9F, $9F, $81 ;6 + .byte $FF, $C3, $99, $99, $91, $9F, $99, $C3 ;7 + .byte $FF, $99, $99, $99, $81, $99, $99, $99 ;8 + .byte $FF, $C3, $E7, $E7, $E7, $E7, $E7, $C3 ;9 + .byte $FF, $C7, $93, $F3, $F3, $F3, $F3, $E1 ;10 + .byte $FF, $99, $93, $87, $8F, $87, $93, $99 ;11 + .byte $FF, $81, $9F, $9F, $9F, $9F, $9F, $9F ;12 + .byte $FF, $9C, $9C, $9C, $94, $80, $88, $9C ;13 + .byte $FF, $99, $99, $91, $81, $81, $89, $99 ;14 + .byte $FF, $C3, $99, $99, $99, $99, $99, $C3 ;15 + .byte $FF, $9F, $9F, $9F, $83, $99, $99, $83 ;16 + .byte $FF, $F1, $C3, $99, $99, $99, $99, $C3 ;17 + .byte $FF, $99, $93, $87, $83, $99, $99, $83 ;18 + .byte $FF, $C3, $99, $F9, $C3, $9F, $99, $C3 ;19 + .byte $FF, $E7, $E7, $E7, $E7, $E7, $E7, $81 ;20 + .byte $FF, $C3, $99, $99, $99, $99, $99, $99 ;21 + .byte $FF, $E7, $C3, $99, $99, $99, $99, $99 ;22 + .byte $FF, $9C, $88, $80, $94, $9C, $9C, $9C ;23 + .byte $FF, $99, $99, $C3, $E7, $C3, $99, $99 ;24 + .byte $FF, $E7, $E7, $E7, $C3, $99, $99, $99 ;25 + .byte $FF, $81, $9F, $CF, $E7, $F3, $F9, $81 ;26 + .byte $FF, $C3, $CF, $CF, $CF, $CF, $CF, $C3 ;27 + .byte $FF, $03, $9D, $CF, $83, $CF, $ED, $F3 ;28 + .byte $FF, $C3, $F3, $F3, $F3, $F3, $F3, $C3 ;29 + .byte $E7, $E7, $E7, $E7, $81, $C3, $E7, $FF ;30 + .byte $FF, $EF, $CF, $80, $80, $CF, $EF, $FF ;31 ; gemena - .byte $FF, $C3, $9D, $9F, $91, $91, $99, $C3 ;224 - .byte $FF, $C1, $99, $C1, $F9, $C3, $FF, $FF ;225 - .byte $FF, $83, $99, $99, $83, $9F, $9F, $FF ;226 - .byte $FF, $C3, $9F, $9F, $9F, $C3, $FF, $FF ;227 - .byte $FF, $C1, $99, $99, $C1, $F9, $F9, $FF ;228 - .byte $FF, $C3, $9F, $81, $99, $C3, $FF, $FF ;229 - .byte $FF, $E7, $E7, $E7, $C1, $E7, $F1, $FF ;230 - .byte $83, $F9, $C1, $99, $99, $C1, $FF, $FF ;231 - .byte $FF, $99, $99, $99, $83, $9F, $9F, $FF ;232 - .byte $FF, $C3, $E7, $E7, $C7, $FF, $E7, $FF ;233 - .byte $C3, $F9, $F9, $F9, $F9, $FF, $F9, $FF ;234 - .byte $FF, $99, $93, $87, $93, $9F, $9F, $FF ;235 - .byte $FF, $C3, $E7, $E7, $E7, $E7, $C7, $FF ;236 - .byte $FF, $9C, $94, $80, $80, $99, $FF, $FF ;237 - .byte $FF, $99, $99, $99, $99, $83, $FF, $FF ;238 - .byte $FF, $C3, $99, $99, $99, $C3, $FF, $FF ;239 - .byte $9F, $9F, $83, $99, $99, $83, $FF, $FF ;240 - .byte $F9, $F9, $C1, $99, $99, $C1, $FF, $FF ;241 - .byte $FF, $9F, $9F, $9F, $99, $83, $FF, $FF ;242 - .byte $FF, $83, $F9, $C3, $9F, $C1, $FF, $FF ;243 - .byte $FF, $F1, $E7, $E7, $E7, $81, $E7, $FF ;244 - .byte $FF, $C1, $99, $99, $99, $99, $FF, $FF ;245 - .byte $FF, $E7, $C3, $99, $99, $99, $FF, $FF ;246 - .byte $FF, $C9, $C1, $80, $94, $9C, $FF, $FF ;247 - .byte $FF, $99, $C3, $E7, $C3, $99, $FF, $FF ;248 - .byte $87, $F3, $C1, $99, $99, $99, $FF, $FF ;249 - .byte $FF, $81, $CF, $E7, $F3, $81, $FF, $FF ;250 - .byte $FF, $C3, $CF, $CF, $CF, $CF, $CF, $C3 ;251 - .byte $FF, $03, $9D, $CF, $83, $CF, $ED, $F3 ;252 - .byte $FF, $C3, $F3, $F3, $F3, $F3, $F3, $C3 ;253 - .byte $E7, $E7, $E7, $E7, $81, $C3, $E7, $FF ;254 - .byte $FF, $EF, $CF, $80, $80, $CF, $EF, $FF ;255 + .byte $FF, $C3, $9D, $9F, $91, $91, $99, $C3 ;224 + .byte $FF, $C1, $99, $C1, $F9, $C3, $FF, $FF ;225 + .byte $FF, $83, $99, $99, $83, $9F, $9F, $FF ;226 + .byte $FF, $C3, $9F, $9F, $9F, $C3, $FF, $FF ;227 + .byte $FF, $C1, $99, $99, $C1, $F9, $F9, $FF ;228 + .byte $FF, $C3, $9F, $81, $99, $C3, $FF, $FF ;229 + .byte $FF, $E7, $E7, $E7, $C1, $E7, $F1, $FF ;230 + .byte $83, $F9, $C1, $99, $99, $C1, $FF, $FF ;231 + .byte $FF, $99, $99, $99, $83, $9F, $9F, $FF ;232 + .byte $FF, $C3, $E7, $E7, $C7, $FF, $E7, $FF ;233 + .byte $C3, $F9, $F9, $F9, $F9, $FF, $F9, $FF ;234 + .byte $FF, $99, $93, $87, $93, $9F, $9F, $FF ;235 + .byte $FF, $C3, $E7, $E7, $E7, $E7, $C7, $FF ;236 + .byte $FF, $9C, $94, $80, $80, $99, $FF, $FF ;237 + .byte $FF, $99, $99, $99, $99, $83, $FF, $FF ;238 + .byte $FF, $C3, $99, $99, $99, $C3, $FF, $FF ;239 + .byte $9F, $9F, $83, $99, $99, $83, $FF, $FF ;240 + .byte $F9, $F9, $C1, $99, $99, $C1, $FF, $FF ;241 + .byte $FF, $9F, $9F, $9F, $99, $83, $FF, $FF ;242 + .byte $FF, $83, $F9, $C3, $9F, $C1, $FF, $FF ;243 + .byte $FF, $F1, $E7, $E7, $E7, $81, $E7, $FF ;244 + .byte $FF, $C1, $99, $99, $99, $99, $FF, $FF ;245 + .byte $FF, $E7, $C3, $99, $99, $99, $FF, $FF ;246 + .byte $FF, $C9, $C1, $80, $94, $9C, $FF, $FF ;247 + .byte $FF, $99, $C3, $E7, $C3, $99, $FF, $FF ;248 + .byte $87, $F3, $C1, $99, $99, $99, $FF, $FF ;249 + .byte $FF, $81, $CF, $E7, $F3, $81, $FF, $FF ;250 + .byte $FF, $C3, $CF, $CF, $CF, $CF, $CF, $C3 ;251 + .byte $FF, $03, $9D, $CF, $83, $CF, $ED, $F3 ;252 + .byte $FF, $C3, $F3, $F3, $F3, $F3, $F3, $C3 ;253 + .byte $E7, $E7, $E7, $E7, $81, $C3, $E7, $FF ;254 + .byte $FF, $EF, $CF, $80, $80, $CF, $EF, $FF ;255 diff --git a/libsrc/lynx/tgi_colors.s b/libsrc/lynx/tgi_colors.s index 64155f349..c7aefb417 100644 --- a/libsrc/lynx/tgi_colors.s +++ b/libsrc/lynx/tgi_colors.s @@ -2,7 +2,7 @@ ; Target-specific black & white values for use by the target-shared TGI kernel ; - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $0F + .export tgi_color_black:zp = $00 + .export tgi_color_white:zp = $0F diff --git a/libsrc/lynx/tgi_stat_stddrv.s b/libsrc/lynx/tgi_stat_stddrv.s index a40af460e..70ed56e73 100644 --- a/libsrc/lynx/tgi_stat_stddrv.s +++ b/libsrc/lynx/tgi_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void tgi_static_stddrv[]; ; - .export _tgi_static_stddrv - .import _lynx_160_102_16_tgi + .export _tgi_static_stddrv + .import _lynx_160_102_16_tgi .rodata diff --git a/libsrc/lynx/tgi_stddrv.s b/libsrc/lynx/tgi_stddrv.s index a410e033e..07f8f3669 100644 --- a/libsrc/lynx/tgi_stddrv.s +++ b/libsrc/lynx/tgi_stddrv.s @@ -6,8 +6,8 @@ ; const char tgi_stddrv[]; ; - .export _tgi_stddrv + .export _tgi_stddrv .rodata -_tgi_stddrv: .asciiz "lynx-160-102-16.tgi" +_tgi_stddrv: .asciiz "lynx-160-102-16.tgi" diff --git a/libsrc/lynx/toascii.s b/libsrc/lynx/toascii.s index b1437d8a9..2a2088688 100644 --- a/libsrc/lynx/toascii.s +++ b/libsrc/lynx/toascii.s @@ -8,9 +8,9 @@ .proc _toascii ; X must be zero on return - ldx #0 + ldx #0 ; Done! - rts + rts .endproc diff --git a/libsrc/lynx/uploader.s b/libsrc/lynx/uploader.s index da72fd5b9..f16a1721a 100644 --- a/libsrc/lynx/uploader.s +++ b/libsrc/lynx/uploader.s @@ -1,7 +1,7 @@ - .include "lynx.inc" - .include "extzp.inc" - .interruptor _UpLoaderIRQ - .export __UPLOADER__: absolute = 1 + .include "lynx.inc" + .include "extzp.inc" + .interruptor _UpLoaderIRQ + .export __UPLOADER__: absolute = 1 load_len=_FileDestAddr load_ptr=_FileFileLen @@ -10,12 +10,12 @@ load_ptr2=_FileCurrBlock .segment "UPCODE" ComLynxReadAndExec: - ldy #4 + ldy #4 loop0: - jsr read_byte - sta load_len-1,y - dey - bne loop0 ; get destination and length + jsr read_byte + sta load_len-1,y + dey + bne loop0 ; get destination and length tax ; lowbyte of length lda load_ptr @@ -24,20 +24,20 @@ loop0: sta load_ptr2+1 loop1: - inx + inx bne cont1 inc load_len+1 bne cont1 jmp (load_ptr) cont1: - jsr read_byte + jsr read_byte sta (load_ptr2),y sta PALETTE ; feedback ;-) iny - bne loop1 - inc load_ptr2+1 - bra loop1 + bne loop1 + inc load_ptr2+1 + bra loop1 read_byte: bit SERCTL @@ -46,22 +46,22 @@ read_byte: rts _UpLoaderIRQ: - lda INTSET - and #$10 - bne @L0 - clc - rts + lda INTSET + and #$10 + bne @L0 + clc + rts @L0: lda SERDAT ; wait for the start sequence bit flag ; already seen $81 ? bpl again ; >= 0 => no cmp #$50 ; "P" ? bne again ; not correct, so clear flag - sei + sei jmp ComLynxReadAndExec again: - stz flag + stz flag cmp #$81 bne exit sta flag @@ -69,11 +69,11 @@ again: ; last action : clear interrupt ; exit: - clc + clc rts .segment "UPDATA" flag: - .byte 0 + .byte 0 diff --git a/libsrc/mouse/mouse-kernel.s b/libsrc/mouse/mouse-kernel.s index 8844ba506..598b61ea2 100644 --- a/libsrc/mouse/mouse-kernel.s +++ b/libsrc/mouse/mouse-kernel.s @@ -6,7 +6,7 @@ .import return0, popsreg, incsp2 .importzp sreg, ptr1, tmp1, tmp2 - .interruptor mouse_irq ; Export as IRQ handler + .interruptor mouse_irq ; Export as IRQ handler .include "mouse-kernel.inc" @@ -17,7 +17,7 @@ .bss -_mouse_drv: .res 2 ; Pointer to driver +_mouse_drv: .res 2 ; Pointer to driver _mouse_hidden: .res 1 ; Mouse visibility flag @@ -29,13 +29,13 @@ mouse_uninstall:jmp return0 mouse_hide: jmp return0 mouse_show: jmp return0 mouse_setbox: jmp return0 -mouse_getbox: jmp return0 +mouse_getbox: jmp return0 mouse_move: jmp return0 mouse_buttons: jmp return0 mouse_pos: jmp return0 mouse_info: jmp return0 mouse_ioctl: jmp return0 -mouse_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes +mouse_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes mouse_flags: .byte $00 ; Driver header signature @@ -50,10 +50,10 @@ mouse_sig: .byte $6d, $6f, $75, MOUSE_API_VERSION ; "mou", version ; /* Install an already loaded driver. Returns an error code. */ _mouse_install: - sta _mouse_drv - sta ptr1 - stx _mouse_drv+1 - stx ptr1+1 + sta _mouse_drv + sta ptr1 + stx _mouse_drv+1 + stx ptr1+1 ; Check the driver signature @@ -104,7 +104,7 @@ _mouse_install: bit mouse_flags ; Test MOUSE_FLAG_EARLY_IRQ bvc @L3 ; Jump if no interrupts at this time - jsr install_irq ; Activate IRQ routine + jsr install_irq ; Activate IRQ routine ; Call driver install routine and check for errors @@ -119,16 +119,16 @@ _mouse_install: bit mouse_flags ; Test MOUSE_FLAG_LATE_IRQ bpl Exit ; Jump if vector not needed install_irq: - ldy #$4C ; Jump opcode - sty mouse_irq ; Activate IRQ routine + ldy #$4C ; Jump opcode + sty mouse_irq ; Activate IRQ routine Exit: rts ; Uninstall IRQ vector if install routine had errors. A/X may contain the ; error code from mouse_install, so don't use it. uninstall_irq: - ldy #$60 ; RTS opcode - sty mouse_irq ; Disable IRQ entry point + ldy #$60 ; RTS opcode + sty mouse_irq ; Disable IRQ entry point rts ; Driver signature invalid. One word is still on the stack @@ -166,7 +166,7 @@ _mouse_uninstall: bit mouse_flags ; Test MOUSE_FLAG_LATE_IRQ bpl @L1 ; Don't disable interrupts now - jsr uninstall_irq ; Disable driver interrupts + jsr uninstall_irq ; Disable driver interrupts @L1: jsr mouse_uninstall ; Call driver routine ; We don't check the flag a second time here, since disabling IRQs twice, diff --git a/libsrc/mouse/mouse_hide.s b/libsrc/mouse/mouse_hide.s index e50a12a8b..81b3573b7 100644 --- a/libsrc/mouse/mouse_hide.s +++ b/libsrc/mouse/mouse_hide.s @@ -12,10 +12,10 @@ .proc _mouse_hide - lda _mouse_hidden ; Get the flag - bne @L1 ; Jump if already invisible - jsr mouse_hide ; Call the driver -@L1: inc _mouse_hidden ; Set the flag to invisible - rts + lda _mouse_hidden ; Get the flag + bne @L1 ; Jump if already invisible + jsr mouse_hide ; Call the driver +@L1: inc _mouse_hidden ; Set the flag to invisible + rts .endproc diff --git a/libsrc/mouse/mouse_setbox.s b/libsrc/mouse/mouse_setbox.s index 4b00379ff..d211289b5 100644 --- a/libsrc/mouse/mouse_setbox.s +++ b/libsrc/mouse/mouse_setbox.s @@ -7,10 +7,10 @@ ; * NOTE: The function does *not* check if the mouse is currently inside the ; * given margins. The proper way to use this function therefore is: ; * -; * - Hide the mouse -; * - Set the bounding box -; * - Place the mouse at the desired position -; * - Show the mouse again. +; * - Hide the mouse +; * - Set the bounding box +; * - Place the mouse at the desired position +; * - Show the mouse again. ; * ; * NOTE2: When setting the box to something that is larger than the actual ; * screen, the positioning of the mouse cursor can fail. If such margins diff --git a/libsrc/mouse/mouse_show.s b/libsrc/mouse/mouse_show.s index 3941e9dc9..652d154af 100644 --- a/libsrc/mouse/mouse_show.s +++ b/libsrc/mouse/mouse_show.s @@ -9,11 +9,11 @@ .proc _mouse_show - lda _mouse_hidden ; Mouse visible? - beq @L1 ; Jump if yes - dec _mouse_hidden ; Set the flag - bne @L1 ; Jump if still invisible + lda _mouse_hidden ; Mouse visible? + beq @L1 ; Jump if yes + dec _mouse_hidden ; Set the flag + bne @L1 ; Jump if still invisible jmp mouse_show ; Call the driver -@L1: rts +@L1: rts .endproc diff --git a/libsrc/mouse/mouse_unload.s b/libsrc/mouse/mouse_unload.s index 997451283..8c9018484 100644 --- a/libsrc/mouse/mouse_unload.s +++ b/libsrc/mouse/mouse_unload.s @@ -13,23 +13,23 @@ _mouse_unload: - lda _mouse_drv + lda _mouse_drv pha ; Save pointer to driver - ora _mouse_drv+1 - beq no_driver ; No driver - lda _mouse_drv+1 - pha + ora _mouse_drv+1 + beq no_driver ; No driver + lda _mouse_drv+1 + pha - jsr _mouse_uninstall ; Uninstall the driver + jsr _mouse_uninstall ; Uninstall the driver - pla - tax - pla ; Get pointer to driver + pla + tax + pla ; Get pointer to driver jsr _mod_free ; Free the driver jmp return0 ; Return MOUSE_ERR_OK no_driver: - tax ; X = 0 + tax ; X = 0 pla ; Remove pushed junk - lda #(__SRAM_START__ + __SRAM_SIZE__) - sta sp+1 ; Set argument stack ptr + sta sp + lda #>(__SRAM_START__ + __SRAM_SIZE__) + sta sp+1 ; Set argument stack ptr ; Call module constructors - jsr initlib + jsr initlib ; Push arguments and call main() - jsr callmain + jsr callmain ; Call module destructors. This is also the _exit entry. -_exit: jsr donelib ; Run module destructors +_exit: jsr donelib ; Run module destructors ; Reset the NES - jmp start + jmp start ; ------------------------------------------------------------------------ ; System V-Blank Interupt @@ -175,8 +175,8 @@ irq: .word irq1 ; $fff6 ? .word timerirq ; $fff8 ? .word nmi ; $fffa vblank nmi - .word start ; $fffc reset - .word irq ; $fffe irq / brk + .word start ; $fffc reset + .word irq ; $fffe irq / brk ; ------------------------------------------------------------------------ ; character data diff --git a/libsrc/nes/ctype.s b/libsrc/nes/ctype.s index 42de7592b..6e0ab1785 100644 --- a/libsrc/nes/ctype.s +++ b/libsrc/nes/ctype.s @@ -33,140 +33,140 @@ ; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v') ; 7 - Space or tab character - .export __ctype + .export __ctype __ctype: .repeat 2 ; 2 times for normal and inverted - .byte $10 ; 0/00 ___ctrl_@___ - .byte $10 ; 1/01 ___ctrl_A___ - .byte $10 ; 2/02 ___ctrl_B___ - .byte $10 ; 3/03 ___ctrl_C___ - .byte $10 ; 4/04 ___ctrl_D___ - .byte $10 ; 5/05 ___ctrl_E___ - .byte $10 ; 6/06 ___ctrl_F___ - .byte $10 ; 7/07 ___ctrl_G___ - .byte $10 ; 8/08 ___ctrl_H___ - .byte $D0 ; 9/09 ___ctrl_I___ - .byte $50 ; 10/0a ___ctrl_J___ - .byte $50 ; 11/0b ___ctrl_K___ - .byte $50 ; 12/0c ___ctrl_L___ - .byte $50 ; 13/0d ___ctrl_M___ - .byte $10 ; 14/0e ___ctrl_N___ - .byte $10 ; 15/0f ___ctrl_O___ - .byte $10 ; 16/10 ___ctrl_P___ - .byte $10 ; 17/11 ___ctrl_Q___ - .byte $10 ; 18/12 ___ctrl_R___ - .byte $10 ; 19/13 ___ctrl_S___ - .byte $10 ; 20/14 ___ctrl_T___ - .byte $10 ; 21/15 ___ctrl_U___ - .byte $10 ; 22/16 ___ctrl_V___ - .byte $10 ; 23/17 ___ctrl_W___ - .byte $10 ; 24/18 ___ctrl_X___ - .byte $10 ; 25/19 ___ctrl_Y___ - .byte $10 ; 26/1a ___ctrl_Z___ - .byte $10 ; 27/1b ___ctrl_[___ - .byte $10 ; 28/1c ___ctrl_\___ - .byte $10 ; 29/1d ___ctrl_]___ - .byte $10 ; 30/1e ___ctrl_^___ - .byte $10 ; 31/1f ___ctrl_____ - .byte $A0 ; 32/20 ___SPACE___ - .byte $00 ; 33/21 _____!_____ - .byte $00 ; 34/22 _____"_____ - .byte $00 ; 35/23 _____#_____ - .byte $00 ; 36/24 _____$_____ - .byte $00 ; 37/25 _____%_____ - .byte $00 ; 38/26 _____&_____ - .byte $00 ; 39/27 _____'_____ - .byte $00 ; 40/28 _____(_____ - .byte $00 ; 41/29 _____)_____ - .byte $00 ; 42/2a _____*_____ - .byte $00 ; 43/2b _____+_____ - .byte $00 ; 44/2c _____,_____ - .byte $00 ; 45/2d _____-_____ - .byte $00 ; 46/2e _____._____ - .byte $00 ; 47/2f _____/_____ - .byte $0C ; 48/30 _____0_____ - .byte $0C ; 49/31 _____1_____ - .byte $0C ; 50/32 _____2_____ - .byte $0C ; 51/33 _____3_____ - .byte $0C ; 52/34 _____4_____ - .byte $0C ; 53/35 _____5_____ - .byte $0C ; 54/36 _____6_____ - .byte $0C ; 55/37 _____7_____ - .byte $0C ; 56/38 _____8_____ - .byte $0C ; 57/39 _____9_____ - .byte $00 ; 58/3a _____:_____ - .byte $00 ; 59/3b _____;_____ - .byte $00 ; 60/3c _____<_____ - .byte $00 ; 61/3d _____=_____ - .byte $00 ; 62/3e _____>_____ - .byte $00 ; 63/3f _____?_____ + .byte $10 ; 0/00 ___ctrl_@___ + .byte $10 ; 1/01 ___ctrl_A___ + .byte $10 ; 2/02 ___ctrl_B___ + .byte $10 ; 3/03 ___ctrl_C___ + .byte $10 ; 4/04 ___ctrl_D___ + .byte $10 ; 5/05 ___ctrl_E___ + .byte $10 ; 6/06 ___ctrl_F___ + .byte $10 ; 7/07 ___ctrl_G___ + .byte $10 ; 8/08 ___ctrl_H___ + .byte $D0 ; 9/09 ___ctrl_I___ + .byte $50 ; 10/0a ___ctrl_J___ + .byte $50 ; 11/0b ___ctrl_K___ + .byte $50 ; 12/0c ___ctrl_L___ + .byte $50 ; 13/0d ___ctrl_M___ + .byte $10 ; 14/0e ___ctrl_N___ + .byte $10 ; 15/0f ___ctrl_O___ + .byte $10 ; 16/10 ___ctrl_P___ + .byte $10 ; 17/11 ___ctrl_Q___ + .byte $10 ; 18/12 ___ctrl_R___ + .byte $10 ; 19/13 ___ctrl_S___ + .byte $10 ; 20/14 ___ctrl_T___ + .byte $10 ; 21/15 ___ctrl_U___ + .byte $10 ; 22/16 ___ctrl_V___ + .byte $10 ; 23/17 ___ctrl_W___ + .byte $10 ; 24/18 ___ctrl_X___ + .byte $10 ; 25/19 ___ctrl_Y___ + .byte $10 ; 26/1a ___ctrl_Z___ + .byte $10 ; 27/1b ___ctrl_[___ + .byte $10 ; 28/1c ___ctrl_\___ + .byte $10 ; 29/1d ___ctrl_]___ + .byte $10 ; 30/1e ___ctrl_^___ + .byte $10 ; 31/1f ___ctrl_____ + .byte $A0 ; 32/20 ___SPACE___ + .byte $00 ; 33/21 _____!_____ + .byte $00 ; 34/22 _____"_____ + .byte $00 ; 35/23 _____#_____ + .byte $00 ; 36/24 _____$_____ + .byte $00 ; 37/25 _____%_____ + .byte $00 ; 38/26 _____&_____ + .byte $00 ; 39/27 _____'_____ + .byte $00 ; 40/28 _____(_____ + .byte $00 ; 41/29 _____)_____ + .byte $00 ; 42/2a _____*_____ + .byte $00 ; 43/2b _____+_____ + .byte $00 ; 44/2c _____,_____ + .byte $00 ; 45/2d _____-_____ + .byte $00 ; 46/2e _____._____ + .byte $00 ; 47/2f _____/_____ + .byte $0C ; 48/30 _____0_____ + .byte $0C ; 49/31 _____1_____ + .byte $0C ; 50/32 _____2_____ + .byte $0C ; 51/33 _____3_____ + .byte $0C ; 52/34 _____4_____ + .byte $0C ; 53/35 _____5_____ + .byte $0C ; 54/36 _____6_____ + .byte $0C ; 55/37 _____7_____ + .byte $0C ; 56/38 _____8_____ + .byte $0C ; 57/39 _____9_____ + .byte $00 ; 58/3a _____:_____ + .byte $00 ; 59/3b _____;_____ + .byte $00 ; 60/3c _____<_____ + .byte $00 ; 61/3d _____=_____ + .byte $00 ; 62/3e _____>_____ + .byte $00 ; 63/3f _____?_____ - .byte $00 ; 64/40 _____@_____ - .byte $0A ; 65/41 _____A_____ - .byte $0A ; 66/42 _____B_____ - .byte $0A ; 67/43 _____C_____ - .byte $0A ; 68/44 _____D_____ - .byte $0A ; 69/45 _____E_____ - .byte $0A ; 70/46 _____F_____ - .byte $02 ; 71/47 _____G_____ - .byte $02 ; 72/48 _____H_____ - .byte $02 ; 73/49 _____I_____ - .byte $02 ; 74/4a _____J_____ - .byte $02 ; 75/4b _____K_____ - .byte $02 ; 76/4c _____L_____ - .byte $02 ; 77/4d _____M_____ - .byte $02 ; 78/4e _____N_____ - .byte $02 ; 79/4f _____O_____ - .byte $02 ; 80/50 _____P_____ - .byte $02 ; 81/51 _____Q_____ - .byte $02 ; 82/52 _____R_____ - .byte $02 ; 83/53 _____S_____ - .byte $02 ; 84/54 _____T_____ - .byte $02 ; 85/55 _____U_____ - .byte $02 ; 86/56 _____V_____ - .byte $02 ; 87/57 _____W_____ - .byte $02 ; 88/58 _____X_____ - .byte $02 ; 89/59 _____Y_____ - .byte $02 ; 90/5a _____Z_____ - .byte $00 ; 91/5b _____[_____ - .byte $00 ; 92/5c _____\_____ - .byte $00 ; 93/5d _____]_____ - .byte $00 ; 94/5e _____^_____ - .byte $00 ; 95/5f _UNDERLINE_ - .byte $00 ; 96/60 ___grave___ - .byte $09 ; 97/61 _____a_____ - .byte $09 ; 98/62 _____b_____ - .byte $09 ; 99/63 _____c_____ - .byte $09 ; 100/64 _____d_____ - .byte $09 ; 101/65 _____e_____ - .byte $09 ; 102/66 _____f_____ - .byte $01 ; 103/67 _____g_____ - .byte $01 ; 104/68 _____h_____ - .byte $01 ; 105/69 _____i_____ - .byte $01 ; 106/6a _____j_____ - .byte $01 ; 107/6b _____k_____ - .byte $01 ; 108/6c _____l_____ - .byte $01 ; 109/6d _____m_____ - .byte $01 ; 110/6e _____n_____ - .byte $01 ; 111/6f _____o_____ - .byte $01 ; 112/70 _____p_____ - .byte $01 ; 113/71 _____q_____ - .byte $01 ; 114/72 _____r_____ - .byte $01 ; 115/73 _____s_____ - .byte $01 ; 116/74 _____t_____ - .byte $01 ; 117/75 _____u_____ - .byte $01 ; 118/76 _____v_____ - .byte $01 ; 119/77 _____w_____ - .byte $01 ; 120/78 _____x_____ - .byte $01 ; 121/79 _____y_____ - .byte $01 ; 122/7a _____z_____ - .byte $00 ; 123/7b _____{_____ - .byte $00 ; 124/7c _____|_____ - .byte $00 ; 125/7d _____}_____ - .byte $00 ; 126/7e _____~_____ - .byte $40 ; 127/7f ____DEL____ + .byte $00 ; 64/40 _____@_____ + .byte $0A ; 65/41 _____A_____ + .byte $0A ; 66/42 _____B_____ + .byte $0A ; 67/43 _____C_____ + .byte $0A ; 68/44 _____D_____ + .byte $0A ; 69/45 _____E_____ + .byte $0A ; 70/46 _____F_____ + .byte $02 ; 71/47 _____G_____ + .byte $02 ; 72/48 _____H_____ + .byte $02 ; 73/49 _____I_____ + .byte $02 ; 74/4a _____J_____ + .byte $02 ; 75/4b _____K_____ + .byte $02 ; 76/4c _____L_____ + .byte $02 ; 77/4d _____M_____ + .byte $02 ; 78/4e _____N_____ + .byte $02 ; 79/4f _____O_____ + .byte $02 ; 80/50 _____P_____ + .byte $02 ; 81/51 _____Q_____ + .byte $02 ; 82/52 _____R_____ + .byte $02 ; 83/53 _____S_____ + .byte $02 ; 84/54 _____T_____ + .byte $02 ; 85/55 _____U_____ + .byte $02 ; 86/56 _____V_____ + .byte $02 ; 87/57 _____W_____ + .byte $02 ; 88/58 _____X_____ + .byte $02 ; 89/59 _____Y_____ + .byte $02 ; 90/5a _____Z_____ + .byte $00 ; 91/5b _____[_____ + .byte $00 ; 92/5c _____\_____ + .byte $00 ; 93/5d _____]_____ + .byte $00 ; 94/5e _____^_____ + .byte $00 ; 95/5f _UNDERLINE_ + .byte $00 ; 96/60 ___grave___ + .byte $09 ; 97/61 _____a_____ + .byte $09 ; 98/62 _____b_____ + .byte $09 ; 99/63 _____c_____ + .byte $09 ; 100/64 _____d_____ + .byte $09 ; 101/65 _____e_____ + .byte $09 ; 102/66 _____f_____ + .byte $01 ; 103/67 _____g_____ + .byte $01 ; 104/68 _____h_____ + .byte $01 ; 105/69 _____i_____ + .byte $01 ; 106/6a _____j_____ + .byte $01 ; 107/6b _____k_____ + .byte $01 ; 108/6c _____l_____ + .byte $01 ; 109/6d _____m_____ + .byte $01 ; 110/6e _____n_____ + .byte $01 ; 111/6f _____o_____ + .byte $01 ; 112/70 _____p_____ + .byte $01 ; 113/71 _____q_____ + .byte $01 ; 114/72 _____r_____ + .byte $01 ; 115/73 _____s_____ + .byte $01 ; 116/74 _____t_____ + .byte $01 ; 117/75 _____u_____ + .byte $01 ; 118/76 _____v_____ + .byte $01 ; 119/77 _____w_____ + .byte $01 ; 120/78 _____x_____ + .byte $01 ; 121/79 _____y_____ + .byte $01 ; 122/7a _____z_____ + .byte $00 ; 123/7b _____{_____ + .byte $00 ; 124/7c _____|_____ + .byte $00 ; 125/7d _____}_____ + .byte $00 ; 126/7e _____~_____ + .byte $40 ; 127/7f ____DEL____ .endrepeat diff --git a/libsrc/nes/cvline.s b/libsrc/nes/cvline.s index 42de7220e..3ab93f34a 100644 --- a/libsrc/nes/cvline.s +++ b/libsrc/nes/cvline.s @@ -5,28 +5,28 @@ ; void cvline (unsigned char length); ; - .export _cvlinexy, _cvline - .import popa, _gotoxy, putchar, newline - .importzp tmp1 + .export _cvlinexy, _cvline + .import popa, _gotoxy, putchar, newline + .importzp tmp1 .include "nes.inc" _cvlinexy: - pha ; Save the length - jsr popa ; Get y - jsr _gotoxy ; Call this one, will pop params - pla ; Restore the length and run into _cvline + pha ; Save the length + jsr popa ; Get y + jsr _gotoxy ; Call this one, will pop params + pla ; Restore the length and run into _cvline _cvline: - cmp #0 ; Is the length zero? - beq L9 ; Jump if done - sta tmp1 -L1: lda #CH_VLINE ; Vertical bar - jsr putchar ; Write, no cursor advance - jsr newline ; Advance cursor to next line - dec tmp1 - bne L1 -L9: rts + cmp #0 ; Is the length zero? + beq L9 ; Jump if done + sta tmp1 +L1: lda #CH_VLINE ; Vertical bar + jsr putchar ; Write, no cursor advance + jsr newline ; Advance cursor to next line + dec tmp1 + bne L1 +L9: rts diff --git a/libsrc/nes/get_tv.s b/libsrc/nes/get_tv.s index 8d2c313b7..7a52440b3 100644 --- a/libsrc/nes/get_tv.s +++ b/libsrc/nes/get_tv.s @@ -5,33 +5,33 @@ ; /* Return the video mode the machine is using */ ; - .include "nes.inc" - .include "get_tv.inc" - .importzp tmp1, tmp2 + .include "nes.inc" + .include "get_tv.inc" + .importzp tmp1, tmp2 ;-------------------------------------------------------------------------- ; _get_tv -.proc _get_tv +.proc _get_tv - lda #TV::NTSC ; assume NTSC - tax ; clear - sta tmp1 - sta tmp2 - ldy tickcount -wait: cpy tickcount - beq wait - iny ; next tick -loop: cpy tickcount - bne over - inc tmp1 - bne loop - inc tmp2 - bne loop -over: ldy tmp2 - cpy #9 - bcc nopal - lda #TV::PAL ; choose PAL -nopal: rts + lda #TV::NTSC ; assume NTSC + tax ; clear + sta tmp1 + sta tmp2 + ldy tickcount +wait: cpy tickcount + beq wait + iny ; next tick +loop: cpy tickcount + bne over + inc tmp1 + bne loop + inc tmp2 + bne loop +over: ldy tmp2 + cpy #9 + bcc nopal + lda #TV::PAL ; choose PAL +nopal: rts .endproc diff --git a/libsrc/nes/gotox.s b/libsrc/nes/gotox.s index f6750bc98..dab7fc2d7 100644 --- a/libsrc/nes/gotox.s +++ b/libsrc/nes/gotox.s @@ -4,17 +4,17 @@ ; void gotox (unsigned char x); ; - .export _gotox - .import setcursor + .export _gotox + .import setcursor .include "nes.inc" .proc _gotox - sta CURS_X ; Set new position + sta CURS_X ; Set new position tay ldx CURS_Y - jmp setcursor ; Set the cursor to the new position + jmp setcursor ; Set the cursor to the new position .endproc diff --git a/libsrc/nes/gotoxy.s b/libsrc/nes/gotoxy.s index da4ce632b..a670962fc 100644 --- a/libsrc/nes/gotoxy.s +++ b/libsrc/nes/gotoxy.s @@ -4,20 +4,20 @@ ; void gotoxy (unsigned char x, unsigned char y); ; - .export _gotoxy + .export _gotoxy .import setcursor - .import popa + .import popa .include "nes.inc" .proc _gotoxy - sta CURS_Y ; Set Y - jsr popa ; Get X - sta CURS_X ; Set X + sta CURS_Y ; Set Y + jsr popa ; Get X + sta CURS_X ; Set X tay ldx CURS_Y - jmp setcursor ; Set the cursor position + jmp setcursor ; Set the cursor position .endproc diff --git a/libsrc/nes/gotoy.s b/libsrc/nes/gotoy.s index 6f2f6856a..cfd913f2e 100644 --- a/libsrc/nes/gotoy.s +++ b/libsrc/nes/gotoy.s @@ -4,17 +4,17 @@ ; void gotoy (unsigned char y); ; - .export _gotoy - .import setcursor + .export _gotoy + .import setcursor .include "nes.inc" .proc _gotoy - sta CURS_Y ; Set new position + sta CURS_Y ; Set new position tax ldy CURS_X - jmp setcursor ; Set the cursor to the new position + jmp setcursor ; Set the cursor to the new position .endproc diff --git a/libsrc/nes/joy/nes-stdjoy.s b/libsrc/nes/joy/nes-stdjoy.s index d850afde3..76ca96005 100644 --- a/libsrc/nes/joy/nes-stdjoy.s +++ b/libsrc/nes/joy/nes-stdjoy.s @@ -6,11 +6,11 @@ ; Stefan Haubenthal, 2004-10-05 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" - .include "joy-error.inc" - .include "nes.inc" + .include "joy-kernel.inc" + .include "joy-error.inc" + .include "nes.inc" ; ------------------------------------------------------------------------ @@ -20,32 +20,32 @@ ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) - .byte $10 ; JOY_UP - .byte $20 ; JOY_DOWN - .byte $40 ; JOY_LEFT - .byte $80 ; JOY_RIGHT - .byte $01 ; JOY_FIRE (A) - .byte $02 ; JOY_FIRE2 (B) - .byte $04 ; (Select) - .byte $08 ; (Start) + .byte $10 ; JOY_UP + .byte $20 ; JOY_DOWN + .byte $40 ; JOY_LEFT + .byte $80 ; JOY_RIGHT + .byte $01 ; JOY_FIRE (A) + .byte $02 ; JOY_FIRE2 (B) + .byte $04 ; (Select) + .byte $08 ; (Start) ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr COUNT - .addr READJOY - .addr 0 ; IRQ entry unused + .addr INSTALL + .addr UNINSTALL + .addr COUNT + .addr READJOY + .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants -JOY_COUNT = 2 ; Number of joysticks we support +JOY_COUNT = 2 ; Number of joysticks we support .code @@ -58,9 +58,9 @@ JOY_COUNT = 2 ; Number of joysticks we support ; INSTALL: - lda #JOY_ERR_OK - ldx #0 -; rts ; Run into UNINSTALL instead + lda #JOY_ERR_OK + ldx #0 +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -76,8 +76,8 @@ UNINSTALL: ; COUNT: - lda #JOY_COUNT - ldx #0 + lda #JOY_COUNT + ldx #0 rts ; ------------------------------------------------------------------------ @@ -85,23 +85,23 @@ COUNT: ; READJOY: - and #$01 ; Fix joystick number - tay ; Joystick number (0,1) into Y + and #$01 ; Fix joystick number + tay ; Joystick number (0,1) into Y - lda #1 - sta APU_PAD1,y - lda #0 - sta APU_PAD1,y + lda #1 + sta APU_PAD1,y + lda #0 + sta APU_PAD1,y ; Read joystick - ldx #8 -@Loop: lda APU_PAD1,y - ror a - ror tmp1 + ldx #8 +@Loop: lda APU_PAD1,y + ror a + ror tmp1 dex - bne @Loop + bne @Loop - lda tmp1 -; ldx #$00 ; X implicitly fixed + lda tmp1 +; ldx #$00 ; X implicitly fixed rts diff --git a/libsrc/nes/joy_stat_stddrv.s b/libsrc/nes/joy_stat_stddrv.s index 261dad8d1..63b046eb4 100644 --- a/libsrc/nes/joy_stat_stddrv.s +++ b/libsrc/nes/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _nes_stdjoy_joy + .export _joy_static_stddrv + .import _nes_stdjoy_joy .rodata diff --git a/libsrc/nes/joy_stddrv.s b/libsrc/nes/joy_stddrv.s index 4f820aa0a..b99659746 100644 --- a/libsrc/nes/joy_stddrv.s +++ b/libsrc/nes/joy_stddrv.s @@ -6,8 +6,8 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "nes-stdjoy.joy" +_joy_stddrv: .asciiz "nes-stdjoy.joy" diff --git a/libsrc/nes/mainargs.s b/libsrc/nes/mainargs.s index a9233382f..7ed8d46f4 100644 --- a/libsrc/nes/mainargs.s +++ b/libsrc/nes/mainargs.s @@ -5,8 +5,8 @@ ; - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv ;--------------------------------------------------------------------------- diff --git a/libsrc/nes/neschar.inc b/libsrc/nes/neschar.inc index 41d84e327..15401868c 100644 --- a/libsrc/nes/neschar.inc +++ b/libsrc/nes/neschar.inc @@ -1,4608 +1,4608 @@ - .byte %00000000 ; 0000 1-00: - .byte %00000000 ; 0001 1-00: - .byte %00000000 ; 0002 1-00: - .byte %00000000 ; 0003 1-00: - .byte %00000000 ; 0004 1-00: - .byte %00000000 ; 0005 1-00: - .byte %00000000 ; 0006 1-00: - .byte %00000000 ; 0007 1-00: - - .byte %00000000 ; 0008 1-01: - .byte %00000000 ; 0009 1-01: - .byte %00000000 ; 000A 1-01: - .byte %00000000 ; 000B 1-01: - .byte %00000000 ; 000C 1-01: - .byte %00000000 ; 000D 1-01: - .byte %00000000 ; 000E 1-01: - .byte %00000000 ; 000F 1-01: - - .byte %11001100 ; 0010 1-02: ** ** - .byte %11001100 ; 0011 1-02: ** ** - .byte %00110011 ; 0012 1-02: ** ** - .byte %00110011 ; 0013 1-02: ** ** - .byte %11001100 ; 0014 1-02: ** ** - .byte %11001100 ; 0015 1-02: ** ** - .byte %00110011 ; 0016 1-02: ** ** - .byte %00110011 ; 0017 1-02: ** ** - - .byte %11001100 ; 0018 1-03: ** ** - .byte %11001100 ; 0019 1-03: ** ** - .byte %00110011 ; 001A 1-03: ** ** - .byte %00110011 ; 001B 1-03: ** ** - .byte %11001100 ; 001C 1-03: ** ** - .byte %11001100 ; 001D 1-03: ** ** - .byte %00110011 ; 001E 1-03: ** ** - .byte %00110011 ; 001F 1-03: ** ** - - .byte %00000000 ; 0020 1-04: - .byte %00011000 ; 0021 1-04: ** - .byte %00111100 ; 0022 1-04: **** - .byte %01111110 ; 0023 1-04: ****** - .byte %00011000 ; 0024 1-04: ** - .byte %00011000 ; 0025 1-04: ** - .byte %00011000 ; 0026 1-04: ** - .byte %00011000 ; 0027 1-04: ** - - .byte %00000000 ; 0028 1-05: - .byte %00011000 ; 0029 1-05: ** - .byte %00111100 ; 002A 1-05: **** - .byte %01111110 ; 002B 1-05: ****** - .byte %00011000 ; 002C 1-05: ** - .byte %00011000 ; 002D 1-05: ** - .byte %00011000 ; 002E 1-05: ** - .byte %00011000 ; 002F 1-05: ** - - .byte %00000000 ; 0030 1-06: - .byte %00010000 ; 0031 1-06: * - .byte %00110000 ; 0032 1-06: ** - .byte %01111111 ; 0033 1-06: ******* - .byte %01111111 ; 0034 1-06: ******* - .byte %00110000 ; 0035 1-06: ** - .byte %00010000 ; 0036 1-06: * - .byte %00000000 ; 0037 1-06: - - .byte %00000000 ; 0038 1-07: - .byte %00010000 ; 0039 1-07: * - .byte %00110000 ; 003A 1-07: ** - .byte %01111111 ; 003B 1-07: ******* - .byte %01111111 ; 003C 1-07: ******* - .byte %00110000 ; 003D 1-07: ** - .byte %00010000 ; 003E 1-07: * - .byte %00000000 ; 003F 1-07: - - .byte %00001100 ; 0040 1-08: ** - .byte %00010010 ; 0041 1-08: * * - .byte %00110000 ; 0042 1-08: ** - .byte %01111100 ; 0043 1-08: ***** - .byte %00110000 ; 0044 1-08: ** - .byte %01100010 ; 0045 1-08: ** * - .byte %11111100 ; 0046 1-08: ****** - .byte %00000000 ; 0047 1-08: - - .byte %00001100 ; 0048 1-09: ** - .byte %00010010 ; 0049 1-09: * * - .byte %00110000 ; 004A 1-09: ** - .byte %01111100 ; 004B 1-09: ***** - .byte %00110000 ; 004C 1-09: ** - .byte %01100010 ; 004D 1-09: ** * - .byte %11111100 ; 004E 1-09: ****** - .byte %00000000 ; 004F 1-09: - - .byte %00000000 ; 0050 1-0a: - .byte %00000000 ; 0051 1-0a: - .byte %00000011 ; 0052 1-0a: ** - .byte %00111110 ; 0053 1-0a: ***** - .byte %01110110 ; 0054 1-0a: *** ** - .byte %00110110 ; 0055 1-0a: ** ** - .byte %00110110 ; 0056 1-0a: ** ** - .byte %00000000 ; 0057 1-0a: - - .byte %00000000 ; 0058 1-0b: - .byte %00000000 ; 0059 1-0b: - .byte %00000011 ; 005A 1-0b: ** - .byte %00111110 ; 005B 1-0b: ***** - .byte %01110110 ; 005C 1-0b: *** ** - .byte %00110110 ; 005D 1-0b: ** ** - .byte %00110110 ; 005E 1-0b: ** ** - .byte %00000000 ; 005F 1-0b: - - .byte %01111111 ; 0060 1-0c: ******* - .byte %01111111 ; 0061 1-0c: ******* - .byte %00000000 ; 0062 1-0c: - .byte %00000000 ; 0063 1-0c: - .byte %00000000 ; 0064 1-0c: - .byte %00000000 ; 0065 1-0c: - .byte %00000000 ; 0066 1-0c: - .byte %00000000 ; 0067 1-0c: - - .byte %01111111 ; 0068 1-0d: ******* - .byte %01111111 ; 0069 1-0d: ******* - .byte %00000000 ; 006A 1-0d: - .byte %00000000 ; 006B 1-0d: - .byte %00000000 ; 006C 1-0d: - .byte %00000000 ; 006D 1-0d: - .byte %00000000 ; 006E 1-0d: - .byte %00000000 ; 006F 1-0d: - - .byte %11100000 ; 0070 1-0e: *** - .byte %11100000 ; 0071 1-0e: *** - .byte %01100000 ; 0072 1-0e: ** - .byte %01100000 ; 0073 1-0e: ** - .byte %01100000 ; 0074 1-0e: ** - .byte %01100000 ; 0075 1-0e: ** - .byte %01100000 ; 0076 1-0e: ** - .byte %01100000 ; 0077 1-0e: ** - - .byte %11100000 ; 0078 1-0f: *** - .byte %11100000 ; 0079 1-0f: *** - .byte %01100000 ; 007A 1-0f: ** - .byte %01100000 ; 007B 1-0f: ** - .byte %01100000 ; 007C 1-0f: ** - .byte %01100000 ; 007D 1-0f: ** - .byte %01100000 ; 007E 1-0f: ** - .byte %01100000 ; 007F 1-0f: ** - - .byte %00011000 ; 0080 1-10: ** - .byte %00011000 ; 0081 1-10: ** - .byte %00011000 ; 0082 1-10: ** - .byte %11111000 ; 0083 1-10: ***** - .byte %11111000 ; 0084 1-10: ***** - .byte %00000000 ; 0085 1-10: - .byte %00000000 ; 0086 1-10: - .byte %00000000 ; 0087 1-10: - - .byte %00011000 ; 0088 1-11: ** - .byte %00011000 ; 0089 1-11: ** - .byte %00011000 ; 008A 1-11: ** - .byte %11111000 ; 008B 1-11: ***** - .byte %11111000 ; 008C 1-11: ***** - .byte %00000000 ; 008D 1-11: - .byte %00000000 ; 008E 1-11: - .byte %00000000 ; 008F 1-11: - - .byte %11001100 ; 0090 1-12: ** ** - .byte %10011001 ; 0091 1-12: * ** * - .byte %00110011 ; 0092 1-12: ** ** - .byte %01100110 ; 0093 1-12: ** ** - .byte %11001100 ; 0094 1-12: ** ** - .byte %10011001 ; 0095 1-12: * ** * - .byte %00110011 ; 0096 1-12: ** ** - .byte %01100110 ; 0097 1-12: ** ** - - .byte %11001100 ; 0098 1-13: ** ** - .byte %10011001 ; 0099 1-13: * ** * - .byte %00110011 ; 009A 1-13: ** ** - .byte %01100110 ; 009B 1-13: ** ** - .byte %11001100 ; 009C 1-13: ** ** - .byte %10011001 ; 009D 1-13: * ** * - .byte %00110011 ; 009E 1-13: ** ** - .byte %01100110 ; 009F 1-13: ** ** - - .byte %00110011 ; 00A0 1-14: ** ** - .byte %10011001 ; 00A1 1-14: * ** * - .byte %11001100 ; 00A2 1-14: ** ** - .byte %01100110 ; 00A3 1-14: ** ** - .byte %00110011 ; 00A4 1-14: ** ** - .byte %10011001 ; 00A5 1-14: * ** * - .byte %11001100 ; 00A6 1-14: ** ** - .byte %01100110 ; 00A7 1-14: ** ** - - .byte %00110011 ; 00A8 1-15: ** ** - .byte %10011001 ; 00A9 1-15: * ** * - .byte %11001100 ; 00AA 1-15: ** ** - .byte %01100110 ; 00AB 1-15: ** ** - .byte %00110011 ; 00AC 1-15: ** ** - .byte %10011001 ; 00AD 1-15: * ** * - .byte %11001100 ; 00AE 1-15: ** ** - .byte %01100110 ; 00AF 1-15: ** ** - - .byte %00000000 ; 00B0 1-16: - .byte %00000000 ; 00B1 1-16: - .byte %00000000 ; 00B2 1-16: - .byte %11111111 ; 00B3 1-16: ******** - .byte %11111111 ; 00B4 1-16: ******** - .byte %00000000 ; 00B5 1-16: - .byte %00000000 ; 00B6 1-16: - .byte %00000000 ; 00B7 1-16: - - .byte %00000000 ; 00B8 1-17: - .byte %00000000 ; 00B9 1-17: - .byte %00000000 ; 00BA 1-17: - .byte %11111111 ; 00BB 1-17: ******** - .byte %11111111 ; 00BC 1-17: ******** - .byte %00000000 ; 00BD 1-17: - .byte %00000000 ; 00BE 1-17: - .byte %00000000 ; 00BF 1-17: - - .byte %00000011 ; 00C0 1-18: ** - .byte %00000011 ; 00C1 1-18: ** - .byte %00000011 ; 00C2 1-18: ** - .byte %00000011 ; 00C3 1-18: ** - .byte %00000011 ; 00C4 1-18: ** - .byte %00000011 ; 00C5 1-18: ** - .byte %00000011 ; 00C6 1-18: ** - .byte %00000011 ; 00C7 1-18: ** - - .byte %00000011 ; 00C8 1-19: ** - .byte %00000011 ; 00C9 1-19: ** - .byte %00000011 ; 00CA 1-19: ** - .byte %00000011 ; 00CB 1-19: ** - .byte %00000011 ; 00CC 1-19: ** - .byte %00000011 ; 00CD 1-19: ** - .byte %00000011 ; 00CE 1-19: ** - .byte %00000011 ; 00CF 1-19: ** - - .byte %00000000 ; 00D0 1-1a: - .byte %00000000 ; 00D1 1-1a: - .byte %00000000 ; 00D2 1-1a: - .byte %00000000 ; 00D3 1-1a: - .byte %11001100 ; 00D4 1-1a: ** ** - .byte %11001100 ; 00D5 1-1a: ** ** - .byte %00110011 ; 00D6 1-1a: ** ** - .byte %00110011 ; 00D7 1-1a: ** ** - - .byte %00000000 ; 00D8 1-1b: - .byte %00000000 ; 00D9 1-1b: - .byte %00000000 ; 00DA 1-1b: - .byte %00000000 ; 00DB 1-1b: - .byte %11001100 ; 00DC 1-1b: ** ** - .byte %11001100 ; 00DD 1-1b: ** ** - .byte %00110011 ; 00DE 1-1b: ** ** - .byte %00110011 ; 00DF 1-1b: ** ** - - .byte %00011000 ; 00E0 1-1c: ** - .byte %00011000 ; 00E1 1-1c: ** - .byte %00011000 ; 00E2 1-1c: ** - .byte %00011000 ; 00E3 1-1c: ** - .byte %00011000 ; 00E4 1-1c: ** - .byte %00011000 ; 00E5 1-1c: ** - .byte %00011000 ; 00E6 1-1c: ** - .byte %00011000 ; 00E7 1-1c: ** - - .byte %00011000 ; 00E8 1-1d: ** - .byte %00011000 ; 00E9 1-1d: ** - .byte %00011000 ; 00EA 1-1d: ** - .byte %00011000 ; 00EB 1-1d: ** - .byte %00011000 ; 00EC 1-1d: ** - .byte %00011000 ; 00ED 1-1d: ** - .byte %00011000 ; 00EE 1-1d: ** - .byte %00011000 ; 00EF 1-1d: ** - - .byte %00011000 ; 00F0 1-1e: ** - .byte %00011000 ; 00F1 1-1e: ** - .byte %00011000 ; 00F2 1-1e: ** - .byte %00011111 ; 00F3 1-1e: ***** - .byte %00011111 ; 00F4 1-1e: ***** - .byte %00011000 ; 00F5 1-1e: ** - .byte %00011000 ; 00F6 1-1e: ** - .byte %00011000 ; 00F7 1-1e: ** - - .byte %00011000 ; 00F8 1-1f: ** - .byte %00011000 ; 00F9 1-1f: ** - .byte %00011000 ; 00FA 1-1f: ** - .byte %00011111 ; 00FB 1-1f: ***** - .byte %00011111 ; 00FC 1-1f: ***** - .byte %00011000 ; 00FD 1-1f: ** - .byte %00011000 ; 00FE 1-1f: ** - .byte %00011000 ; 00FF 1-1f: ** - - .byte %00011000 ; 0100 1-20: ** - .byte %00011000 ; 0101 1-20: ** - .byte %00011000 ; 0102 1-20: ** - .byte %11111111 ; 0103 1-20: ******** - .byte %11111111 ; 0104 1-20: ******** - .byte %00011000 ; 0105 1-20: ** - .byte %00011000 ; 0106 1-20: ** - .byte %00011000 ; 0107 1-20: ** - - .byte %00011000 ; 0108 1-21: ** - .byte %00011000 ; 0109 1-21: ** - .byte %00011000 ; 010A 1-21: ** - .byte %11111111 ; 010B 1-21: ******** - .byte %11111111 ; 010C 1-21: ******** - .byte %00011000 ; 010D 1-21: ** - .byte %00011000 ; 010E 1-21: ** - .byte %00011000 ; 010F 1-21: ** - - .byte %00011000 ; 0110 1-22: ** - .byte %00011000 ; 0111 1-22: ** - .byte %00011000 ; 0112 1-22: ** - .byte %00011111 ; 0113 1-22: ***** - .byte %00011111 ; 0114 1-22: ***** - .byte %00000000 ; 0115 1-22: - .byte %00000000 ; 0116 1-22: - .byte %00000000 ; 0117 1-22: - - .byte %00011000 ; 0118 1-23: ** - .byte %00011000 ; 0119 1-23: ** - .byte %00011000 ; 011A 1-23: ** - .byte %00011111 ; 011B 1-23: ***** - .byte %00011111 ; 011C 1-23: ***** - .byte %00000000 ; 011D 1-23: - .byte %00000000 ; 011E 1-23: - .byte %00000000 ; 011F 1-23: - - .byte %00000000 ; 0120 1-24: - .byte %00000000 ; 0121 1-24: - .byte %00000000 ; 0122 1-24: - .byte %11111000 ; 0123 1-24: ***** - .byte %11111000 ; 0124 1-24: ***** - .byte %00011000 ; 0125 1-24: ** - .byte %00011000 ; 0126 1-24: ** - .byte %00011000 ; 0127 1-24: ** - - .byte %00000000 ; 0128 1-25: - .byte %00000000 ; 0129 1-25: - .byte %00000000 ; 012A 1-25: - .byte %11111000 ; 012B 1-25: ***** - .byte %11111000 ; 012C 1-25: ***** - .byte %00011000 ; 012D 1-25: ** - .byte %00011000 ; 012E 1-25: ** - .byte %00011000 ; 012F 1-25: ** - - .byte %00000000 ; 0130 1-26: - .byte %00000000 ; 0131 1-26: - .byte %00000000 ; 0132 1-26: - .byte %00000000 ; 0133 1-26: - .byte %00000000 ; 0134 1-26: - .byte %00000000 ; 0135 1-26: - .byte %11111111 ; 0136 1-26: ******** - .byte %11111111 ; 0137 1-26: ******** - - .byte %00000000 ; 0138 1-27: - .byte %00000000 ; 0139 1-27: - .byte %00000000 ; 013A 1-27: - .byte %00000000 ; 013B 1-27: - .byte %00000000 ; 013C 1-27: - .byte %00000000 ; 013D 1-27: - .byte %11111111 ; 013E 1-27: ******** - .byte %11111111 ; 013F 1-27: ******** - - .byte %00000000 ; 0140 1-28: - .byte %00000000 ; 0141 1-28: - .byte %00000000 ; 0142 1-28: - .byte %00011111 ; 0143 1-28: ***** - .byte %00011111 ; 0144 1-28: ***** - .byte %00011000 ; 0145 1-28: ** - .byte %00011000 ; 0146 1-28: ** - .byte %00011000 ; 0147 1-28: ** - - .byte %00000000 ; 0148 1-29: - .byte %00000000 ; 0149 1-29: - .byte %00000000 ; 014A 1-29: - .byte %00011111 ; 014B 1-29: ***** - .byte %00011111 ; 014C 1-29: ***** - .byte %00011000 ; 014D 1-29: ** - .byte %00011000 ; 014E 1-29: ** - .byte %00011000 ; 014F 1-29: ** - - .byte %00011000 ; 0150 1-2a: ** - .byte %00011000 ; 0151 1-2a: ** - .byte %00011000 ; 0152 1-2a: ** - .byte %11111111 ; 0153 1-2a: ******** - .byte %11111111 ; 0154 1-2a: ******** - .byte %00000000 ; 0155 1-2a: - .byte %00000000 ; 0156 1-2a: - .byte %00000000 ; 0157 1-2a: - - .byte %00011000 ; 0158 1-2b: ** - .byte %00011000 ; 0159 1-2b: ** - .byte %00011000 ; 015A 1-2b: ** - .byte %11111111 ; 015B 1-2b: ******** - .byte %11111111 ; 015C 1-2b: ******** - .byte %00000000 ; 015D 1-2b: - .byte %00000000 ; 015E 1-2b: - .byte %00000000 ; 015F 1-2b: - - .byte %00000000 ; 0160 1-2c: - .byte %00000000 ; 0161 1-2c: - .byte %00000000 ; 0162 1-2c: - .byte %11111111 ; 0163 1-2c: ******** - .byte %11111111 ; 0164 1-2c: ******** - .byte %00011000 ; 0165 1-2c: ** - .byte %00011000 ; 0166 1-2c: ** - .byte %00011000 ; 0167 1-2c: ** - - .byte %00000000 ; 0168 1-2d: - .byte %00000000 ; 0169 1-2d: - .byte %00000000 ; 016A 1-2d: - .byte %11111111 ; 016B 1-2d: ******** - .byte %11111111 ; 016C 1-2d: ******** - .byte %00011000 ; 016D 1-2d: ** - .byte %00011000 ; 016E 1-2d: ** - .byte %00011000 ; 016F 1-2d: ** - - .byte %00011000 ; 0170 1-2e: ** - .byte %00011000 ; 0171 1-2e: ** - .byte %00011000 ; 0172 1-2e: ** - .byte %11111000 ; 0173 1-2e: ***** - .byte %11111000 ; 0174 1-2e: ***** - .byte %00011000 ; 0175 1-2e: ** - .byte %00011000 ; 0176 1-2e: ** - .byte %00011000 ; 0177 1-2e: ** - - .byte %00011000 ; 0178 1-2f: ** - .byte %00011000 ; 0179 1-2f: ** - .byte %00011000 ; 017A 1-2f: ** - .byte %11111000 ; 017B 1-2f: ***** - .byte %11111000 ; 017C 1-2f: ***** - .byte %00011000 ; 017D 1-2f: ** - .byte %00011000 ; 017E 1-2f: ** - .byte %00011000 ; 017F 1-2f: ** - - .byte %11110000 ; 0180 1-30: **** - .byte %11110000 ; 0181 1-30: **** - .byte %11110000 ; 0182 1-30: **** - .byte %11110000 ; 0183 1-30: **** - .byte %11110000 ; 0184 1-30: **** - .byte %11110000 ; 0185 1-30: **** - .byte %11110000 ; 0186 1-30: **** - .byte %11110000 ; 0187 1-30: **** - - .byte %11110000 ; 0188 1-31: **** - .byte %11110000 ; 0189 1-31: **** - .byte %11110000 ; 018A 1-31: **** - .byte %11110000 ; 018B 1-31: **** - .byte %11110000 ; 018C 1-31: **** - .byte %11110000 ; 018D 1-31: **** - .byte %11110000 ; 018E 1-31: **** - .byte %11110000 ; 018F 1-31: **** - - .byte %00000000 ; 0190 1-32: - .byte %00000000 ; 0191 1-32: - .byte %00000000 ; 0192 1-32: - .byte %00000000 ; 0193 1-32: - .byte %11111111 ; 0194 1-32: ******** - .byte %11111111 ; 0195 1-32: ******** - .byte %11111111 ; 0196 1-32: ******** - .byte %11111111 ; 0197 1-32: ******** - - .byte %00000000 ; 0198 1-33: - .byte %00000000 ; 0199 1-33: - .byte %00000000 ; 019A 1-33: - .byte %00000000 ; 019B 1-33: - .byte %11111111 ; 019C 1-33: ******** - .byte %11111111 ; 019D 1-33: ******** - .byte %11111111 ; 019E 1-33: ******** - .byte %11111111 ; 019F 1-33: ******** - - .byte %00000000 ; 01A0 1-34: - .byte %00000000 ; 01A1 1-34: - .byte %00000000 ; 01A2 1-34: - .byte %00000000 ; 01A3 1-34: - .byte %11110000 ; 01A4 1-34: **** - .byte %11110000 ; 01A5 1-34: **** - .byte %11110000 ; 01A6 1-34: **** - .byte %11110000 ; 01A7 1-34: **** - - .byte %00000000 ; 01A8 1-35: - .byte %00000000 ; 01A9 1-35: - .byte %00000000 ; 01AA 1-35: - .byte %00000000 ; 01AB 1-35: - .byte %11110000 ; 01AC 1-35: **** - .byte %11110000 ; 01AD 1-35: **** - .byte %11110000 ; 01AE 1-35: **** - .byte %11110000 ; 01AF 1-35: **** - - .byte %11000000 ; 01B0 1-36: ** - .byte %11000000 ; 01B1 1-36: ** - .byte %00110000 ; 01B2 1-36: ** - .byte %00110000 ; 01B3 1-36: ** - .byte %11000000 ; 01B4 1-36: ** - .byte %11000000 ; 01B5 1-36: ** - .byte %00110000 ; 01B6 1-36: ** - .byte %00110000 ; 01B7 1-36: ** - - .byte %11000000 ; 01B8 1-37: ** - .byte %11000000 ; 01B9 1-37: ** - .byte %00110000 ; 01BA 1-37: ** - .byte %00110000 ; 01BB 1-37: ** - .byte %11000000 ; 01BC 1-37: ** - .byte %11000000 ; 01BD 1-37: ** - .byte %00110000 ; 01BE 1-37: ** - .byte %00110000 ; 01BF 1-37: ** - - .byte %00001111 ; 01C0 1-38: **** - .byte %00001111 ; 01C1 1-38: **** - .byte %00001111 ; 01C2 1-38: **** - .byte %00001111 ; 01C3 1-38: **** - .byte %00000000 ; 01C4 1-38: - .byte %00000000 ; 01C5 1-38: - .byte %00000000 ; 01C6 1-38: - .byte %00000000 ; 01C7 1-38: - - .byte %00001111 ; 01C8 1-39: **** - .byte %00001111 ; 01C9 1-39: **** - .byte %00001111 ; 01CA 1-39: **** - .byte %00001111 ; 01CB 1-39: **** - .byte %00000000 ; 01CC 1-39: - .byte %00000000 ; 01CD 1-39: - .byte %00000000 ; 01CE 1-39: - .byte %00000000 ; 01CF 1-39: - - .byte %00000000 ; 01D0 1-3a: - .byte %00000000 ; 01D1 1-3a: - .byte %00000000 ; 01D2 1-3a: - .byte %00000000 ; 01D3 1-3a: - .byte %00001111 ; 01D4 1-3a: **** - .byte %00001111 ; 01D5 1-3a: **** - .byte %00001111 ; 01D6 1-3a: **** - .byte %00001111 ; 01D7 1-3a: **** - - .byte %00000000 ; 01D8 1-3b: - .byte %00000000 ; 01D9 1-3b: - .byte %00000000 ; 01DA 1-3b: - .byte %00000000 ; 01DB 1-3b: - .byte %00001111 ; 01DC 1-3b: **** - .byte %00001111 ; 01DD 1-3b: **** - .byte %00001111 ; 01DE 1-3b: **** - .byte %00001111 ; 01DF 1-3b: **** - - .byte %11110000 ; 01E0 1-3c: **** - .byte %11110000 ; 01E1 1-3c: **** - .byte %11110000 ; 01E2 1-3c: **** - .byte %11110000 ; 01E3 1-3c: **** - .byte %00000000 ; 01E4 1-3c: - .byte %00000000 ; 01E5 1-3c: - .byte %00000000 ; 01E6 1-3c: - .byte %00000000 ; 01E7 1-3c: - - .byte %11110000 ; 01E8 1-3d: **** - .byte %11110000 ; 01E9 1-3d: **** - .byte %11110000 ; 01EA 1-3d: **** - .byte %11110000 ; 01EB 1-3d: **** - .byte %00000000 ; 01EC 1-3d: - .byte %00000000 ; 01ED 1-3d: - .byte %00000000 ; 01EE 1-3d: - .byte %00000000 ; 01EF 1-3d: - - .byte %11110000 ; 01F0 1-3e: **** - .byte %11110000 ; 01F1 1-3e: **** - .byte %11110000 ; 01F2 1-3e: **** - .byte %11110000 ; 01F3 1-3e: **** - .byte %00001111 ; 01F4 1-3e: **** - .byte %00001111 ; 01F5 1-3e: **** - .byte %00001111 ; 01F6 1-3e: **** - .byte %00001111 ; 01F7 1-3e: **** - - .byte %11110000 ; 01F8 1-3f: **** - .byte %11110000 ; 01F9 1-3f: **** - .byte %11110000 ; 01FA 1-3f: **** - .byte %11110000 ; 01FB 1-3f: **** - .byte %00001111 ; 01FC 1-3f: **** - .byte %00001111 ; 01FD 1-3f: **** - .byte %00001111 ; 01FE 1-3f: **** - .byte %00001111 ; 01FF 1-3f: **** - - .byte %00000000 ; 0200 1-40: - .byte %00000000 ; 0201 1-40: - .byte %00000000 ; 0202 1-40: - .byte %00000000 ; 0203 1-40: - .byte %00000000 ; 0204 1-40: - .byte %00000000 ; 0205 1-40: - .byte %00000000 ; 0206 1-40: - .byte %00000000 ; 0207 1-40: - - .byte %00000000 ; 0208 1-41: - .byte %00000000 ; 0209 1-41: - .byte %00000000 ; 020A 1-41: - .byte %00000000 ; 020B 1-41: - .byte %00000000 ; 020C 1-41: - .byte %00000000 ; 020D 1-41: - .byte %00000000 ; 020E 1-41: - .byte %00000000 ; 020F 1-41: - - .byte %00011000 ; 0210 1-42: ** - .byte %00011000 ; 0211 1-42: ** - .byte %00011000 ; 0212 1-42: ** - .byte %00011000 ; 0213 1-42: ** - .byte %00000000 ; 0214 1-42: - .byte %00000000 ; 0215 1-42: - .byte %00011000 ; 0216 1-42: ** - .byte %00000000 ; 0217 1-42: - - .byte %00011000 ; 0218 1-43: ** - .byte %00011000 ; 0219 1-43: ** - .byte %00011000 ; 021A 1-43: ** - .byte %00011000 ; 021B 1-43: ** - .byte %00000000 ; 021C 1-43: - .byte %00000000 ; 021D 1-43: - .byte %00011000 ; 021E 1-43: ** - .byte %00000000 ; 021F 1-43: - - .byte %01100110 ; 0220 1-44: ** ** - .byte %01100110 ; 0221 1-44: ** ** - .byte %01100110 ; 0222 1-44: ** ** - .byte %00000000 ; 0223 1-44: - .byte %00000000 ; 0224 1-44: - .byte %00000000 ; 0225 1-44: - .byte %00000000 ; 0226 1-44: - .byte %00000000 ; 0227 1-44: - - .byte %01100110 ; 0228 1-45: ** ** - .byte %01100110 ; 0229 1-45: ** ** - .byte %01100110 ; 022A 1-45: ** ** - .byte %00000000 ; 022B 1-45: - .byte %00000000 ; 022C 1-45: - .byte %00000000 ; 022D 1-45: - .byte %00000000 ; 022E 1-45: - .byte %00000000 ; 022F 1-45: - - .byte %01100110 ; 0230 1-46: ** ** - .byte %01100110 ; 0231 1-46: ** ** - .byte %11111111 ; 0232 1-46: ******** - .byte %01100110 ; 0233 1-46: ** ** - .byte %11111111 ; 0234 1-46: ******** - .byte %01100110 ; 0235 1-46: ** ** - .byte %01100110 ; 0236 1-46: ** ** - .byte %00000000 ; 0237 1-46: - - .byte %01100110 ; 0238 1-47: ** ** - .byte %01100110 ; 0239 1-47: ** ** - .byte %11111111 ; 023A 1-47: ******** - .byte %01100110 ; 023B 1-47: ** ** - .byte %11111111 ; 023C 1-47: ******** - .byte %01100110 ; 023D 1-47: ** ** - .byte %01100110 ; 023E 1-47: ** ** - .byte %00000000 ; 023F 1-47: - - .byte %00011000 ; 0240 1-48: ** - .byte %00111110 ; 0241 1-48: ***** - .byte %01100000 ; 0242 1-48: ** - .byte %00111100 ; 0243 1-48: **** - .byte %00000110 ; 0244 1-48: ** - .byte %01111100 ; 0245 1-48: ***** - .byte %00011000 ; 0246 1-48: ** - .byte %00000000 ; 0247 1-48: - - .byte %00011000 ; 0248 1-49: ** - .byte %00111110 ; 0249 1-49: ***** - .byte %01100000 ; 024A 1-49: ** - .byte %00111100 ; 024B 1-49: **** - .byte %00000110 ; 024C 1-49: ** - .byte %01111100 ; 024D 1-49: ***** - .byte %00011000 ; 024E 1-49: ** - .byte %00000000 ; 024F 1-49: - - .byte %00000000 ; 0250 1-4a: - .byte %01100110 ; 0251 1-4a: ** ** - .byte %00001100 ; 0252 1-4a: ** - .byte %00011000 ; 0253 1-4a: ** - .byte %00110000 ; 0254 1-4a: ** - .byte %01100110 ; 0255 1-4a: ** ** - .byte %01000110 ; 0256 1-4a: * ** - .byte %00000000 ; 0257 1-4a: - - .byte %00000000 ; 0258 1-4b: - .byte %01100110 ; 0259 1-4b: ** ** - .byte %00001100 ; 025A 1-4b: ** - .byte %00011000 ; 025B 1-4b: ** - .byte %00110000 ; 025C 1-4b: ** - .byte %01100110 ; 025D 1-4b: ** ** - .byte %01000110 ; 025E 1-4b: * ** - .byte %00000000 ; 025F 1-4b: - - .byte %00111100 ; 0260 1-4c: **** - .byte %01100110 ; 0261 1-4c: ** ** - .byte %00111100 ; 0262 1-4c: **** - .byte %00111000 ; 0263 1-4c: *** - .byte %01100111 ; 0264 1-4c: ** *** - .byte %01100110 ; 0265 1-4c: ** ** - .byte %00111111 ; 0266 1-4c: ****** - .byte %00000000 ; 0267 1-4c: - - .byte %00111100 ; 0268 1-4d: **** - .byte %01100110 ; 0269 1-4d: ** ** - .byte %00111100 ; 026A 1-4d: **** - .byte %00111000 ; 026B 1-4d: *** - .byte %01100111 ; 026C 1-4d: ** *** - .byte %01100110 ; 026D 1-4d: ** ** - .byte %00111111 ; 026E 1-4d: ****** - .byte %00000000 ; 026F 1-4d: - - .byte %00000110 ; 0270 1-4e: ** - .byte %00001100 ; 0271 1-4e: ** - .byte %00011000 ; 0272 1-4e: ** - .byte %00000000 ; 0273 1-4e: - .byte %00000000 ; 0274 1-4e: - .byte %00000000 ; 0275 1-4e: - .byte %00000000 ; 0276 1-4e: - .byte %00000000 ; 0277 1-4e: - - .byte %00000110 ; 0278 1-4f: ** - .byte %00001100 ; 0279 1-4f: ** - .byte %00011000 ; 027A 1-4f: ** - .byte %00000000 ; 027B 1-4f: - .byte %00000000 ; 027C 1-4f: - .byte %00000000 ; 027D 1-4f: - .byte %00000000 ; 027E 1-4f: - .byte %00000000 ; 027F 1-4f: - - .byte %00001100 ; 0280 1-50: ** - .byte %00011000 ; 0281 1-50: ** - .byte %00110000 ; 0282 1-50: ** - .byte %00110000 ; 0283 1-50: ** - .byte %00110000 ; 0284 1-50: ** - .byte %00011000 ; 0285 1-50: ** - .byte %00001100 ; 0286 1-50: ** - .byte %00000000 ; 0287 1-50: - - .byte %00001100 ; 0288 1-51: ** - .byte %00011000 ; 0289 1-51: ** - .byte %00110000 ; 028A 1-51: ** - .byte %00110000 ; 028B 1-51: ** - .byte %00110000 ; 028C 1-51: ** - .byte %00011000 ; 028D 1-51: ** - .byte %00001100 ; 028E 1-51: ** - .byte %00000000 ; 028F 1-51: - - .byte %00110000 ; 0290 1-52: ** - .byte %00011000 ; 0291 1-52: ** - .byte %00001100 ; 0292 1-52: ** - .byte %00001100 ; 0293 1-52: ** - .byte %00001100 ; 0294 1-52: ** - .byte %00011000 ; 0295 1-52: ** - .byte %00110000 ; 0296 1-52: ** - .byte %00000000 ; 0297 1-52: - - .byte %00110000 ; 0298 1-53: ** - .byte %00011000 ; 0299 1-53: ** - .byte %00001100 ; 029A 1-53: ** - .byte %00001100 ; 029B 1-53: ** - .byte %00001100 ; 029C 1-53: ** - .byte %00011000 ; 029D 1-53: ** - .byte %00110000 ; 029E 1-53: ** - .byte %00000000 ; 029F 1-53: - - .byte %00000000 ; 02A0 1-54: - .byte %01100110 ; 02A1 1-54: ** ** - .byte %00111100 ; 02A2 1-54: **** - .byte %11111111 ; 02A3 1-54: ******** - .byte %00111100 ; 02A4 1-54: **** - .byte %01100110 ; 02A5 1-54: ** ** - .byte %00000000 ; 02A6 1-54: - .byte %00000000 ; 02A7 1-54: - - .byte %00000000 ; 02A8 1-55: - .byte %01100110 ; 02A9 1-55: ** ** - .byte %00111100 ; 02AA 1-55: **** - .byte %11111111 ; 02AB 1-55: ******** - .byte %00111100 ; 02AC 1-55: **** - .byte %01100110 ; 02AD 1-55: ** ** - .byte %00000000 ; 02AE 1-55: - .byte %00000000 ; 02AF 1-55: - - .byte %00000000 ; 02B0 1-56: - .byte %00011000 ; 02B1 1-56: ** - .byte %00011000 ; 02B2 1-56: ** - .byte %01111110 ; 02B3 1-56: ****** - .byte %00011000 ; 02B4 1-56: ** - .byte %00011000 ; 02B5 1-56: ** - .byte %00000000 ; 02B6 1-56: - .byte %00000000 ; 02B7 1-56: - - .byte %00000000 ; 02B8 1-57: - .byte %00011000 ; 02B9 1-57: ** - .byte %00011000 ; 02BA 1-57: ** - .byte %01111110 ; 02BB 1-57: ****** - .byte %00011000 ; 02BC 1-57: ** - .byte %00011000 ; 02BD 1-57: ** - .byte %00000000 ; 02BE 1-57: - .byte %00000000 ; 02BF 1-57: - - .byte %00000000 ; 02C0 1-58: - .byte %00000000 ; 02C1 1-58: - .byte %00000000 ; 02C2 1-58: - .byte %00000000 ; 02C3 1-58: - .byte %00000000 ; 02C4 1-58: - .byte %00011000 ; 02C5 1-58: ** - .byte %00011000 ; 02C6 1-58: ** - .byte %00110000 ; 02C7 1-58: ** - - .byte %00000000 ; 02C8 1-59: - .byte %00000000 ; 02C9 1-59: - .byte %00000000 ; 02CA 1-59: - .byte %00000000 ; 02CB 1-59: - .byte %00000000 ; 02CC 1-59: - .byte %00011000 ; 02CD 1-59: ** - .byte %00011000 ; 02CE 1-59: ** - .byte %00110000 ; 02CF 1-59: ** - - .byte %00000000 ; 02D0 1-5a: - .byte %00000000 ; 02D1 1-5a: - .byte %00000000 ; 02D2 1-5a: - .byte %01111110 ; 02D3 1-5a: ****** - .byte %00000000 ; 02D4 1-5a: - .byte %00000000 ; 02D5 1-5a: - .byte %00000000 ; 02D6 1-5a: - .byte %00000000 ; 02D7 1-5a: - - .byte %00000000 ; 02D8 1-5b: - .byte %00000000 ; 02D9 1-5b: - .byte %00000000 ; 02DA 1-5b: - .byte %01111110 ; 02DB 1-5b: ****** - .byte %00000000 ; 02DC 1-5b: - .byte %00000000 ; 02DD 1-5b: - .byte %00000000 ; 02DE 1-5b: - .byte %00000000 ; 02DF 1-5b: - - .byte %00000000 ; 02E0 1-5c: - .byte %00000000 ; 02E1 1-5c: - .byte %00000000 ; 02E2 1-5c: - .byte %00000000 ; 02E3 1-5c: - .byte %00000000 ; 02E4 1-5c: - .byte %00011000 ; 02E5 1-5c: ** - .byte %00011000 ; 02E6 1-5c: ** - .byte %00000000 ; 02E7 1-5c: - - .byte %00000000 ; 02E8 1-5d: - .byte %00000000 ; 02E9 1-5d: - .byte %00000000 ; 02EA 1-5d: - .byte %00000000 ; 02EB 1-5d: - .byte %00000000 ; 02EC 1-5d: - .byte %00011000 ; 02ED 1-5d: ** - .byte %00011000 ; 02EE 1-5d: ** - .byte %00000000 ; 02EF 1-5d: - - .byte %00000000 ; 02F0 1-5e: - .byte %00000011 ; 02F1 1-5e: ** - .byte %00000110 ; 02F2 1-5e: ** - .byte %00001100 ; 02F3 1-5e: ** - .byte %00011000 ; 02F4 1-5e: ** - .byte %00110000 ; 02F5 1-5e: ** - .byte %01100000 ; 02F6 1-5e: ** - .byte %00000000 ; 02F7 1-5e: - - .byte %00000000 ; 02F8 1-5f: - .byte %00000011 ; 02F9 1-5f: ** - .byte %00000110 ; 02FA 1-5f: ** - .byte %00001100 ; 02FB 1-5f: ** - .byte %00011000 ; 02FC 1-5f: ** - .byte %00110000 ; 02FD 1-5f: ** - .byte %01100000 ; 02FE 1-5f: ** - .byte %00000000 ; 02FF 1-5f: - - .byte %00111100 ; 0300 1-60: **** - .byte %01100110 ; 0301 1-60: ** ** - .byte %01101110 ; 0302 1-60: ** *** - .byte %01110110 ; 0303 1-60: *** ** - .byte %01100110 ; 0304 1-60: ** ** - .byte %01100110 ; 0305 1-60: ** ** - .byte %00111100 ; 0306 1-60: **** - .byte %00000000 ; 0307 1-60: - - .byte %00111100 ; 0308 1-61: **** - .byte %01100110 ; 0309 1-61: ** ** - .byte %01101110 ; 030A 1-61: ** *** - .byte %01110110 ; 030B 1-61: *** ** - .byte %01100110 ; 030C 1-61: ** ** - .byte %01100110 ; 030D 1-61: ** ** - .byte %00111100 ; 030E 1-61: **** - .byte %00000000 ; 030F 1-61: - - .byte %00011000 ; 0310 1-62: ** - .byte %00011000 ; 0311 1-62: ** - .byte %00111000 ; 0312 1-62: *** - .byte %00011000 ; 0313 1-62: ** - .byte %00011000 ; 0314 1-62: ** - .byte %00011000 ; 0315 1-62: ** - .byte %01111110 ; 0316 1-62: ****** - .byte %00000000 ; 0317 1-62: - - .byte %00011000 ; 0318 1-63: ** - .byte %00011000 ; 0319 1-63: ** - .byte %00111000 ; 031A 1-63: *** - .byte %00011000 ; 031B 1-63: ** - .byte %00011000 ; 031C 1-63: ** - .byte %00011000 ; 031D 1-63: ** - .byte %01111110 ; 031E 1-63: ****** - .byte %00000000 ; 031F 1-63: - - .byte %00111100 ; 0320 1-64: **** - .byte %01100110 ; 0321 1-64: ** ** - .byte %00000110 ; 0322 1-64: ** - .byte %00001100 ; 0323 1-64: ** - .byte %00110000 ; 0324 1-64: ** - .byte %01100000 ; 0325 1-64: ** - .byte %01111110 ; 0326 1-64: ****** - .byte %00000000 ; 0327 1-64: - - .byte %00111100 ; 0328 1-65: **** - .byte %01100110 ; 0329 1-65: ** ** - .byte %00000110 ; 032A 1-65: ** - .byte %00001100 ; 032B 1-65: ** - .byte %00110000 ; 032C 1-65: ** - .byte %01100000 ; 032D 1-65: ** - .byte %01111110 ; 032E 1-65: ****** - .byte %00000000 ; 032F 1-65: - - .byte %00111100 ; 0330 1-66: **** - .byte %01100110 ; 0331 1-66: ** ** - .byte %00000110 ; 0332 1-66: ** - .byte %00011100 ; 0333 1-66: *** - .byte %00000110 ; 0334 1-66: ** - .byte %01100110 ; 0335 1-66: ** ** - .byte %00111100 ; 0336 1-66: **** - .byte %00000000 ; 0337 1-66: - - .byte %00111100 ; 0338 1-67: **** - .byte %01100110 ; 0339 1-67: ** ** - .byte %00000110 ; 033A 1-67: ** - .byte %00011100 ; 033B 1-67: *** - .byte %00000110 ; 033C 1-67: ** - .byte %01100110 ; 033D 1-67: ** ** - .byte %00111100 ; 033E 1-67: **** - .byte %00000000 ; 033F 1-67: - - .byte %00000110 ; 0340 1-68: ** - .byte %00001110 ; 0341 1-68: *** - .byte %00011110 ; 0342 1-68: **** - .byte %01100110 ; 0343 1-68: ** ** - .byte %01111111 ; 0344 1-68: ******* - .byte %00000110 ; 0345 1-68: ** - .byte %00000110 ; 0346 1-68: ** - .byte %00000000 ; 0347 1-68: - - .byte %00000110 ; 0348 1-69: ** - .byte %00001110 ; 0349 1-69: *** - .byte %00011110 ; 034A 1-69: **** - .byte %01100110 ; 034B 1-69: ** ** - .byte %01111111 ; 034C 1-69: ******* - .byte %00000110 ; 034D 1-69: ** - .byte %00000110 ; 034E 1-69: ** - .byte %00000000 ; 034F 1-69: - - .byte %01111110 ; 0350 1-6a: ****** - .byte %01100000 ; 0351 1-6a: ** - .byte %01111100 ; 0352 1-6a: ***** - .byte %00000110 ; 0353 1-6a: ** - .byte %00000110 ; 0354 1-6a: ** - .byte %01100110 ; 0355 1-6a: ** ** - .byte %00111100 ; 0356 1-6a: **** - .byte %00000000 ; 0357 1-6a: - - .byte %01111110 ; 0358 1-6b: ****** - .byte %01100000 ; 0359 1-6b: ** - .byte %01111100 ; 035A 1-6b: ***** - .byte %00000110 ; 035B 1-6b: ** - .byte %00000110 ; 035C 1-6b: ** - .byte %01100110 ; 035D 1-6b: ** ** - .byte %00111100 ; 035E 1-6b: **** - .byte %00000000 ; 035F 1-6b: - - .byte %00111100 ; 0360 1-6c: **** - .byte %01100110 ; 0361 1-6c: ** ** - .byte %01100000 ; 0362 1-6c: ** - .byte %01111100 ; 0363 1-6c: ***** - .byte %01100110 ; 0364 1-6c: ** ** - .byte %01100110 ; 0365 1-6c: ** ** - .byte %00111100 ; 0366 1-6c: **** - .byte %00000000 ; 0367 1-6c: - - .byte %00111100 ; 0368 1-6d: **** - .byte %01100110 ; 0369 1-6d: ** ** - .byte %01100000 ; 036A 1-6d: ** - .byte %01111100 ; 036B 1-6d: ***** - .byte %01100110 ; 036C 1-6d: ** ** - .byte %01100110 ; 036D 1-6d: ** ** - .byte %00111100 ; 036E 1-6d: **** - .byte %00000000 ; 036F 1-6d: - - .byte %01111110 ; 0370 1-6e: ****** - .byte %01100110 ; 0371 1-6e: ** ** - .byte %00001100 ; 0372 1-6e: ** - .byte %00011000 ; 0373 1-6e: ** - .byte %00011000 ; 0374 1-6e: ** - .byte %00011000 ; 0375 1-6e: ** - .byte %00011000 ; 0376 1-6e: ** - .byte %00000000 ; 0377 1-6e: - - .byte %01111110 ; 0378 1-6f: ****** - .byte %01100110 ; 0379 1-6f: ** ** - .byte %00001100 ; 037A 1-6f: ** - .byte %00011000 ; 037B 1-6f: ** - .byte %00011000 ; 037C 1-6f: ** - .byte %00011000 ; 037D 1-6f: ** - .byte %00011000 ; 037E 1-6f: ** - .byte %00000000 ; 037F 1-6f: - - .byte %00111100 ; 0380 1-70: **** - .byte %01100110 ; 0381 1-70: ** ** - .byte %01100110 ; 0382 1-70: ** ** - .byte %00111100 ; 0383 1-70: **** - .byte %01100110 ; 0384 1-70: ** ** - .byte %01100110 ; 0385 1-70: ** ** - .byte %00111100 ; 0386 1-70: **** - .byte %00000000 ; 0387 1-70: - - .byte %00111100 ; 0388 1-71: **** - .byte %01100110 ; 0389 1-71: ** ** - .byte %01100110 ; 038A 1-71: ** ** - .byte %00111100 ; 038B 1-71: **** - .byte %01100110 ; 038C 1-71: ** ** - .byte %01100110 ; 038D 1-71: ** ** - .byte %00111100 ; 038E 1-71: **** - .byte %00000000 ; 038F 1-71: - - .byte %00111100 ; 0390 1-72: **** - .byte %01100110 ; 0391 1-72: ** ** - .byte %01100110 ; 0392 1-72: ** ** - .byte %00111110 ; 0393 1-72: ***** - .byte %00000110 ; 0394 1-72: ** - .byte %01100110 ; 0395 1-72: ** ** - .byte %00111100 ; 0396 1-72: **** - .byte %00000000 ; 0397 1-72: - - .byte %00111100 ; 0398 1-73: **** - .byte %01100110 ; 0399 1-73: ** ** - .byte %01100110 ; 039A 1-73: ** ** - .byte %00111110 ; 039B 1-73: ***** - .byte %00000110 ; 039C 1-73: ** - .byte %01100110 ; 039D 1-73: ** ** - .byte %00111100 ; 039E 1-73: **** - .byte %00000000 ; 039F 1-73: - - .byte %00000000 ; 03A0 1-74: - .byte %00000000 ; 03A1 1-74: - .byte %00011000 ; 03A2 1-74: ** - .byte %00000000 ; 03A3 1-74: - .byte %00000000 ; 03A4 1-74: - .byte %00011000 ; 03A5 1-74: ** - .byte %00000000 ; 03A6 1-74: - .byte %00000000 ; 03A7 1-74: - - .byte %00000000 ; 03A8 1-75: - .byte %00000000 ; 03A9 1-75: - .byte %00011000 ; 03AA 1-75: ** - .byte %00000000 ; 03AB 1-75: - .byte %00000000 ; 03AC 1-75: - .byte %00011000 ; 03AD 1-75: ** - .byte %00000000 ; 03AE 1-75: - .byte %00000000 ; 03AF 1-75: - - .byte %00000000 ; 03B0 1-76: - .byte %00000000 ; 03B1 1-76: - .byte %00011000 ; 03B2 1-76: ** - .byte %00000000 ; 03B3 1-76: - .byte %00000000 ; 03B4 1-76: - .byte %00011000 ; 03B5 1-76: ** - .byte %00011000 ; 03B6 1-76: ** - .byte %00110000 ; 03B7 1-76: ** - - .byte %00000000 ; 03B8 1-77: - .byte %00000000 ; 03B9 1-77: - .byte %00011000 ; 03BA 1-77: ** - .byte %00000000 ; 03BB 1-77: - .byte %00000000 ; 03BC 1-77: - .byte %00011000 ; 03BD 1-77: ** - .byte %00011000 ; 03BE 1-77: ** - .byte %00110000 ; 03BF 1-77: ** - - .byte %00001110 ; 03C0 1-78: *** - .byte %00011000 ; 03C1 1-78: ** - .byte %00110000 ; 03C2 1-78: ** - .byte %01100000 ; 03C3 1-78: ** - .byte %00110000 ; 03C4 1-78: ** - .byte %00011000 ; 03C5 1-78: ** - .byte %00001110 ; 03C6 1-78: *** - .byte %00000000 ; 03C7 1-78: - - .byte %00001110 ; 03C8 1-79: *** - .byte %00011000 ; 03C9 1-79: ** - .byte %00110000 ; 03CA 1-79: ** - .byte %01100000 ; 03CB 1-79: ** - .byte %00110000 ; 03CC 1-79: ** - .byte %00011000 ; 03CD 1-79: ** - .byte %00001110 ; 03CE 1-79: *** - .byte %00000000 ; 03CF 1-79: - - .byte %00000000 ; 03D0 1-7a: - .byte %00000000 ; 03D1 1-7a: - .byte %01111110 ; 03D2 1-7a: ****** - .byte %00000000 ; 03D3 1-7a: - .byte %01111110 ; 03D4 1-7a: ****** - .byte %00000000 ; 03D5 1-7a: - .byte %00000000 ; 03D6 1-7a: - .byte %00000000 ; 03D7 1-7a: - - .byte %00000000 ; 03D8 1-7b: - .byte %00000000 ; 03D9 1-7b: - .byte %01111110 ; 03DA 1-7b: ****** - .byte %00000000 ; 03DB 1-7b: - .byte %01111110 ; 03DC 1-7b: ****** - .byte %00000000 ; 03DD 1-7b: - .byte %00000000 ; 03DE 1-7b: - .byte %00000000 ; 03DF 1-7b: - - .byte %01110000 ; 03E0 1-7c: *** - .byte %00011000 ; 03E1 1-7c: ** - .byte %00001100 ; 03E2 1-7c: ** - .byte %00000110 ; 03E3 1-7c: ** - .byte %00001100 ; 03E4 1-7c: ** - .byte %00011000 ; 03E5 1-7c: ** - .byte %01110000 ; 03E6 1-7c: *** - .byte %00000000 ; 03E7 1-7c: - - .byte %01110000 ; 03E8 1-7d: *** - .byte %00011000 ; 03E9 1-7d: ** - .byte %00001100 ; 03EA 1-7d: ** - .byte %00000110 ; 03EB 1-7d: ** - .byte %00001100 ; 03EC 1-7d: ** - .byte %00011000 ; 03ED 1-7d: ** - .byte %01110000 ; 03EE 1-7d: *** - .byte %00000000 ; 03EF 1-7d: - - .byte %00111100 ; 03F0 1-7e: **** - .byte %01100110 ; 03F1 1-7e: ** ** - .byte %00000110 ; 03F2 1-7e: ** - .byte %00001100 ; 03F3 1-7e: ** - .byte %00011000 ; 03F4 1-7e: ** - .byte %00000000 ; 03F5 1-7e: - .byte %00011000 ; 03F6 1-7e: ** - .byte %00000000 ; 03F7 1-7e: - - .byte %00111100 ; 03F8 1-7f: **** - .byte %01100110 ; 03F9 1-7f: ** ** - .byte %00000110 ; 03FA 1-7f: ** - .byte %00001100 ; 03FB 1-7f: ** - .byte %00011000 ; 03FC 1-7f: ** - .byte %00000000 ; 03FD 1-7f: - .byte %00011000 ; 03FE 1-7f: ** - .byte %00000000 ; 03FF 1-7f: - - .byte %00111100 ; 0400 1-80: **** - .byte %01100110 ; 0401 1-80: ** ** - .byte %01101110 ; 0402 1-80: ** *** - .byte %01101110 ; 0403 1-80: ** *** - .byte %01100000 ; 0404 1-80: ** - .byte %01100010 ; 0405 1-80: ** * - .byte %00111100 ; 0406 1-80: **** - .byte %00000000 ; 0407 1-80: - - .byte %00111100 ; 0408 1-81: **** - .byte %01100110 ; 0409 1-81: ** ** - .byte %01101110 ; 040A 1-81: ** *** - .byte %01101110 ; 040B 1-81: ** *** - .byte %01100000 ; 040C 1-81: ** - .byte %01100010 ; 040D 1-81: ** * - .byte %00111100 ; 040E 1-81: **** - .byte %00000000 ; 040F 1-81: - - .byte %00011000 ; 0410 1-82: ** - .byte %00111100 ; 0411 1-82: **** - .byte %01100110 ; 0412 1-82: ** ** - .byte %01111110 ; 0413 1-82: ****** - .byte %01100110 ; 0414 1-82: ** ** - .byte %01100110 ; 0415 1-82: ** ** - .byte %01100110 ; 0416 1-82: ** ** - .byte %00000000 ; 0417 1-82: - - .byte %00011000 ; 0418 1-83: ** - .byte %00111100 ; 0419 1-83: **** - .byte %01100110 ; 041A 1-83: ** ** - .byte %01111110 ; 041B 1-83: ****** - .byte %01100110 ; 041C 1-83: ** ** - .byte %01100110 ; 041D 1-83: ** ** - .byte %01100110 ; 041E 1-83: ** ** - .byte %00000000 ; 041F 1-83: - - .byte %01111100 ; 0420 1-84: ***** - .byte %01100110 ; 0421 1-84: ** ** - .byte %01100110 ; 0422 1-84: ** ** - .byte %01111100 ; 0423 1-84: ***** - .byte %01100110 ; 0424 1-84: ** ** - .byte %01100110 ; 0425 1-84: ** ** - .byte %01111100 ; 0426 1-84: ***** - .byte %00000000 ; 0427 1-84: - - .byte %01111100 ; 0428 1-85: ***** - .byte %01100110 ; 0429 1-85: ** ** - .byte %01100110 ; 042A 1-85: ** ** - .byte %01111100 ; 042B 1-85: ***** - .byte %01100110 ; 042C 1-85: ** ** - .byte %01100110 ; 042D 1-85: ** ** - .byte %01111100 ; 042E 1-85: ***** - .byte %00000000 ; 042F 1-85: - - .byte %00111100 ; 0430 1-86: **** - .byte %01100110 ; 0431 1-86: ** ** - .byte %01100000 ; 0432 1-86: ** - .byte %01100000 ; 0433 1-86: ** - .byte %01100000 ; 0434 1-86: ** - .byte %01100110 ; 0435 1-86: ** ** - .byte %00111100 ; 0436 1-86: **** - .byte %00000000 ; 0437 1-86: - - .byte %00111100 ; 0438 1-87: **** - .byte %01100110 ; 0439 1-87: ** ** - .byte %01100000 ; 043A 1-87: ** - .byte %01100000 ; 043B 1-87: ** - .byte %01100000 ; 043C 1-87: ** - .byte %01100110 ; 043D 1-87: ** ** - .byte %00111100 ; 043E 1-87: **** - .byte %00000000 ; 043F 1-87: - - .byte %01111000 ; 0440 1-88: **** - .byte %01101100 ; 0441 1-88: ** ** - .byte %01100110 ; 0442 1-88: ** ** - .byte %01100110 ; 0443 1-88: ** ** - .byte %01100110 ; 0444 1-88: ** ** - .byte %01101100 ; 0445 1-88: ** ** - .byte %01111000 ; 0446 1-88: **** - .byte %00000000 ; 0447 1-88: - - .byte %01111000 ; 0448 1-89: **** - .byte %01101100 ; 0449 1-89: ** ** - .byte %01100110 ; 044A 1-89: ** ** - .byte %01100110 ; 044B 1-89: ** ** - .byte %01100110 ; 044C 1-89: ** ** - .byte %01101100 ; 044D 1-89: ** ** - .byte %01111000 ; 044E 1-89: **** - .byte %00000000 ; 044F 1-89: - - .byte %01111110 ; 0450 1-8a: ****** - .byte %01100000 ; 0451 1-8a: ** - .byte %01100000 ; 0452 1-8a: ** - .byte %01111000 ; 0453 1-8a: **** - .byte %01100000 ; 0454 1-8a: ** - .byte %01100000 ; 0455 1-8a: ** - .byte %01111110 ; 0456 1-8a: ****** - .byte %00000000 ; 0457 1-8a: - - .byte %01111110 ; 0458 1-8b: ****** - .byte %01100000 ; 0459 1-8b: ** - .byte %01100000 ; 045A 1-8b: ** - .byte %01111000 ; 045B 1-8b: **** - .byte %01100000 ; 045C 1-8b: ** - .byte %01100000 ; 045D 1-8b: ** - .byte %01111110 ; 045E 1-8b: ****** - .byte %00000000 ; 045F 1-8b: - - .byte %01111110 ; 0460 1-8c: ****** - .byte %01100000 ; 0461 1-8c: ** - .byte %01100000 ; 0462 1-8c: ** - .byte %01111000 ; 0463 1-8c: **** - .byte %01100000 ; 0464 1-8c: ** - .byte %01100000 ; 0465 1-8c: ** - .byte %01100000 ; 0466 1-8c: ** - .byte %00000000 ; 0467 1-8c: - - .byte %01111110 ; 0468 1-8d: ****** - .byte %01100000 ; 0469 1-8d: ** - .byte %01100000 ; 046A 1-8d: ** - .byte %01111000 ; 046B 1-8d: **** - .byte %01100000 ; 046C 1-8d: ** - .byte %01100000 ; 046D 1-8d: ** - .byte %01100000 ; 046E 1-8d: ** - .byte %00000000 ; 046F 1-8d: - - .byte %00111100 ; 0470 1-8e: **** - .byte %01100110 ; 0471 1-8e: ** ** - .byte %01100000 ; 0472 1-8e: ** - .byte %01101110 ; 0473 1-8e: ** *** - .byte %01100110 ; 0474 1-8e: ** ** - .byte %01100110 ; 0475 1-8e: ** ** - .byte %00111100 ; 0476 1-8e: **** - .byte %00000000 ; 0477 1-8e: - - .byte %00111100 ; 0478 1-8f: **** - .byte %01100110 ; 0479 1-8f: ** ** - .byte %01100000 ; 047A 1-8f: ** - .byte %01101110 ; 047B 1-8f: ** *** - .byte %01100110 ; 047C 1-8f: ** ** - .byte %01100110 ; 047D 1-8f: ** ** - .byte %00111100 ; 047E 1-8f: **** - .byte %00000000 ; 047F 1-8f: - - .byte %01100110 ; 0480 1-90: ** ** - .byte %01100110 ; 0481 1-90: ** ** - .byte %01100110 ; 0482 1-90: ** ** - .byte %01111110 ; 0483 1-90: ****** - .byte %01100110 ; 0484 1-90: ** ** - .byte %01100110 ; 0485 1-90: ** ** - .byte %01100110 ; 0486 1-90: ** ** - .byte %00000000 ; 0487 1-90: - - .byte %01100110 ; 0488 1-91: ** ** - .byte %01100110 ; 0489 1-91: ** ** - .byte %01100110 ; 048A 1-91: ** ** - .byte %01111110 ; 048B 1-91: ****** - .byte %01100110 ; 048C 1-91: ** ** - .byte %01100110 ; 048D 1-91: ** ** - .byte %01100110 ; 048E 1-91: ** ** - .byte %00000000 ; 048F 1-91: - - .byte %00111100 ; 0490 1-92: **** - .byte %00011000 ; 0491 1-92: ** - .byte %00011000 ; 0492 1-92: ** - .byte %00011000 ; 0493 1-92: ** - .byte %00011000 ; 0494 1-92: ** - .byte %00011000 ; 0495 1-92: ** - .byte %00111100 ; 0496 1-92: **** - .byte %00000000 ; 0497 1-92: - - .byte %00111100 ; 0498 1-93: **** - .byte %00011000 ; 0499 1-93: ** - .byte %00011000 ; 049A 1-93: ** - .byte %00011000 ; 049B 1-93: ** - .byte %00011000 ; 049C 1-93: ** - .byte %00011000 ; 049D 1-93: ** - .byte %00111100 ; 049E 1-93: **** - .byte %00000000 ; 049F 1-93: - - .byte %00011110 ; 04A0 1-94: **** - .byte %00001100 ; 04A1 1-94: ** - .byte %00001100 ; 04A2 1-94: ** - .byte %00001100 ; 04A3 1-94: ** - .byte %00001100 ; 04A4 1-94: ** - .byte %01101100 ; 04A5 1-94: ** ** - .byte %00111000 ; 04A6 1-94: *** - .byte %00000000 ; 04A7 1-94: - - .byte %00011110 ; 04A8 1-95: **** - .byte %00001100 ; 04A9 1-95: ** - .byte %00001100 ; 04AA 1-95: ** - .byte %00001100 ; 04AB 1-95: ** - .byte %00001100 ; 04AC 1-95: ** - .byte %01101100 ; 04AD 1-95: ** ** - .byte %00111000 ; 04AE 1-95: *** - .byte %00000000 ; 04AF 1-95: - - .byte %01100110 ; 04B0 1-96: ** ** - .byte %01101100 ; 04B1 1-96: ** ** - .byte %01111000 ; 04B2 1-96: **** - .byte %01110000 ; 04B3 1-96: *** - .byte %01111000 ; 04B4 1-96: **** - .byte %01101100 ; 04B5 1-96: ** ** - .byte %01100110 ; 04B6 1-96: ** ** - .byte %00000000 ; 04B7 1-96: - - .byte %01100110 ; 04B8 1-97: ** ** - .byte %01101100 ; 04B9 1-97: ** ** - .byte %01111000 ; 04BA 1-97: **** - .byte %01110000 ; 04BB 1-97: *** - .byte %01111000 ; 04BC 1-97: **** - .byte %01101100 ; 04BD 1-97: ** ** - .byte %01100110 ; 04BE 1-97: ** ** - .byte %00000000 ; 04BF 1-97: - - .byte %01100000 ; 04C0 1-98: ** - .byte %01100000 ; 04C1 1-98: ** - .byte %01100000 ; 04C2 1-98: ** - .byte %01100000 ; 04C3 1-98: ** - .byte %01100000 ; 04C4 1-98: ** - .byte %01100000 ; 04C5 1-98: ** - .byte %01111110 ; 04C6 1-98: ****** - .byte %00000000 ; 04C7 1-98: - - .byte %01100000 ; 04C8 1-99: ** - .byte %01100000 ; 04C9 1-99: ** - .byte %01100000 ; 04CA 1-99: ** - .byte %01100000 ; 04CB 1-99: ** - .byte %01100000 ; 04CC 1-99: ** - .byte %01100000 ; 04CD 1-99: ** - .byte %01111110 ; 04CE 1-99: ****** - .byte %00000000 ; 04CF 1-99: - - .byte %01100011 ; 04D0 1-9a: ** ** - .byte %01110111 ; 04D1 1-9a: *** *** - .byte %01111111 ; 04D2 1-9a: ******* - .byte %01101011 ; 04D3 1-9a: ** * ** - .byte %01100011 ; 04D4 1-9a: ** ** - .byte %01100011 ; 04D5 1-9a: ** ** - .byte %01100011 ; 04D6 1-9a: ** ** - .byte %00000000 ; 04D7 1-9a: - - .byte %01100011 ; 04D8 1-9b: ** ** - .byte %01110111 ; 04D9 1-9b: *** *** - .byte %01111111 ; 04DA 1-9b: ******* - .byte %01101011 ; 04DB 1-9b: ** * ** - .byte %01100011 ; 04DC 1-9b: ** ** - .byte %01100011 ; 04DD 1-9b: ** ** - .byte %01100011 ; 04DE 1-9b: ** ** - .byte %00000000 ; 04DF 1-9b: - - .byte %01100110 ; 04E0 1-9c: ** ** - .byte %01110110 ; 04E1 1-9c: *** ** - .byte %01111110 ; 04E2 1-9c: ****** - .byte %01111110 ; 04E3 1-9c: ****** - .byte %01101110 ; 04E4 1-9c: ** *** - .byte %01100110 ; 04E5 1-9c: ** ** - .byte %01100110 ; 04E6 1-9c: ** ** - .byte %00000000 ; 04E7 1-9c: - - .byte %01100110 ; 04E8 1-9d: ** ** - .byte %01110110 ; 04E9 1-9d: *** ** - .byte %01111110 ; 04EA 1-9d: ****** - .byte %01111110 ; 04EB 1-9d: ****** - .byte %01101110 ; 04EC 1-9d: ** *** - .byte %01100110 ; 04ED 1-9d: ** ** - .byte %01100110 ; 04EE 1-9d: ** ** - .byte %00000000 ; 04EF 1-9d: - - .byte %00111100 ; 04F0 1-9e: **** - .byte %01100110 ; 04F1 1-9e: ** ** - .byte %01100110 ; 04F2 1-9e: ** ** - .byte %01100110 ; 04F3 1-9e: ** ** - .byte %01100110 ; 04F4 1-9e: ** ** - .byte %01100110 ; 04F5 1-9e: ** ** - .byte %00111100 ; 04F6 1-9e: **** - .byte %00000000 ; 04F7 1-9e: - - .byte %00111100 ; 04F8 1-9f: **** - .byte %01100110 ; 04F9 1-9f: ** ** - .byte %01100110 ; 04FA 1-9f: ** ** - .byte %01100110 ; 04FB 1-9f: ** ** - .byte %01100110 ; 04FC 1-9f: ** ** - .byte %01100110 ; 04FD 1-9f: ** ** - .byte %00111100 ; 04FE 1-9f: **** - .byte %00000000 ; 04FF 1-9f: - - .byte %01111100 ; 0500 1-a0: ***** - .byte %01100110 ; 0501 1-a0: ** ** - .byte %01100110 ; 0502 1-a0: ** ** - .byte %01111100 ; 0503 1-a0: ***** - .byte %01100000 ; 0504 1-a0: ** - .byte %01100000 ; 0505 1-a0: ** - .byte %01100000 ; 0506 1-a0: ** - .byte %00000000 ; 0507 1-a0: - - .byte %01111100 ; 0508 1-a1: ***** - .byte %01100110 ; 0509 1-a1: ** ** - .byte %01100110 ; 050A 1-a1: ** ** - .byte %01111100 ; 050B 1-a1: ***** - .byte %01100000 ; 050C 1-a1: ** - .byte %01100000 ; 050D 1-a1: ** - .byte %01100000 ; 050E 1-a1: ** - .byte %00000000 ; 050F 1-a1: - - .byte %00111100 ; 0510 1-a2: **** - .byte %01100110 ; 0511 1-a2: ** ** - .byte %01100110 ; 0512 1-a2: ** ** - .byte %01100110 ; 0513 1-a2: ** ** - .byte %01100110 ; 0514 1-a2: ** ** - .byte %00111100 ; 0515 1-a2: **** - .byte %00001110 ; 0516 1-a2: *** - .byte %00000000 ; 0517 1-a2: - - .byte %00111100 ; 0518 1-a3: **** - .byte %01100110 ; 0519 1-a3: ** ** - .byte %01100110 ; 051A 1-a3: ** ** - .byte %01100110 ; 051B 1-a3: ** ** - .byte %01100110 ; 051C 1-a3: ** ** - .byte %00111100 ; 051D 1-a3: **** - .byte %00001110 ; 051E 1-a3: *** - .byte %00000000 ; 051F 1-a3: - - .byte %01111100 ; 0520 1-a4: ***** - .byte %01100110 ; 0521 1-a4: ** ** - .byte %01100110 ; 0522 1-a4: ** ** - .byte %01111100 ; 0523 1-a4: ***** - .byte %01111000 ; 0524 1-a4: **** - .byte %01101100 ; 0525 1-a4: ** ** - .byte %01100110 ; 0526 1-a4: ** ** - .byte %00000000 ; 0527 1-a4: - - .byte %01111100 ; 0528 1-a5: ***** - .byte %01100110 ; 0529 1-a5: ** ** - .byte %01100110 ; 052A 1-a5: ** ** - .byte %01111100 ; 052B 1-a5: ***** - .byte %01111000 ; 052C 1-a5: **** - .byte %01101100 ; 052D 1-a5: ** ** - .byte %01100110 ; 052E 1-a5: ** ** - .byte %00000000 ; 052F 1-a5: - - .byte %00111100 ; 0530 1-a6: **** - .byte %01100110 ; 0531 1-a6: ** ** - .byte %01100000 ; 0532 1-a6: ** - .byte %00111100 ; 0533 1-a6: **** - .byte %00000110 ; 0534 1-a6: ** - .byte %01100110 ; 0535 1-a6: ** ** - .byte %00111100 ; 0536 1-a6: **** - .byte %00000000 ; 0537 1-a6: - - .byte %00111100 ; 0538 1-a7: **** - .byte %01100110 ; 0539 1-a7: ** ** - .byte %01100000 ; 053A 1-a7: ** - .byte %00111100 ; 053B 1-a7: **** - .byte %00000110 ; 053C 1-a7: ** - .byte %01100110 ; 053D 1-a7: ** ** - .byte %00111100 ; 053E 1-a7: **** - .byte %00000000 ; 053F 1-a7: - - .byte %01111110 ; 0540 1-a8: ****** - .byte %00011000 ; 0541 1-a8: ** - .byte %00011000 ; 0542 1-a8: ** - .byte %00011000 ; 0543 1-a8: ** - .byte %00011000 ; 0544 1-a8: ** - .byte %00011000 ; 0545 1-a8: ** - .byte %00011000 ; 0546 1-a8: ** - .byte %00000000 ; 0547 1-a8: - - .byte %01111110 ; 0548 1-a9: ****** - .byte %00011000 ; 0549 1-a9: ** - .byte %00011000 ; 054A 1-a9: ** - .byte %00011000 ; 054B 1-a9: ** - .byte %00011000 ; 054C 1-a9: ** - .byte %00011000 ; 054D 1-a9: ** - .byte %00011000 ; 054E 1-a9: ** - .byte %00000000 ; 054F 1-a9: - - .byte %01100110 ; 0550 1-aa: ** ** - .byte %01100110 ; 0551 1-aa: ** ** - .byte %01100110 ; 0552 1-aa: ** ** - .byte %01100110 ; 0553 1-aa: ** ** - .byte %01100110 ; 0554 1-aa: ** ** - .byte %01100110 ; 0555 1-aa: ** ** - .byte %00111100 ; 0556 1-aa: **** - .byte %00000000 ; 0557 1-aa: - - .byte %01100110 ; 0558 1-ab: ** ** - .byte %01100110 ; 0559 1-ab: ** ** - .byte %01100110 ; 055A 1-ab: ** ** - .byte %01100110 ; 055B 1-ab: ** ** - .byte %01100110 ; 055C 1-ab: ** ** - .byte %01100110 ; 055D 1-ab: ** ** - .byte %00111100 ; 055E 1-ab: **** - .byte %00000000 ; 055F 1-ab: - - .byte %01100110 ; 0560 1-ac: ** ** - .byte %01100110 ; 0561 1-ac: ** ** - .byte %01100110 ; 0562 1-ac: ** ** - .byte %01100110 ; 0563 1-ac: ** ** - .byte %01100110 ; 0564 1-ac: ** ** - .byte %00111100 ; 0565 1-ac: **** - .byte %00011000 ; 0566 1-ac: ** - .byte %00000000 ; 0567 1-ac: - - .byte %01100110 ; 0568 1-ad: ** ** - .byte %01100110 ; 0569 1-ad: ** ** - .byte %01100110 ; 056A 1-ad: ** ** - .byte %01100110 ; 056B 1-ad: ** ** - .byte %01100110 ; 056C 1-ad: ** ** - .byte %00111100 ; 056D 1-ad: **** - .byte %00011000 ; 056E 1-ad: ** - .byte %00000000 ; 056F 1-ad: - - .byte %01100011 ; 0570 1-ae: ** ** - .byte %01100011 ; 0571 1-ae: ** ** - .byte %01100011 ; 0572 1-ae: ** ** - .byte %01101011 ; 0573 1-ae: ** * ** - .byte %01111111 ; 0574 1-ae: ******* - .byte %01110111 ; 0575 1-ae: *** *** - .byte %01100011 ; 0576 1-ae: ** ** - .byte %00000000 ; 0577 1-ae: - - .byte %01100011 ; 0578 1-af: ** ** - .byte %01100011 ; 0579 1-af: ** ** - .byte %01100011 ; 057A 1-af: ** ** - .byte %01101011 ; 057B 1-af: ** * ** - .byte %01111111 ; 057C 1-af: ******* - .byte %01110111 ; 057D 1-af: *** *** - .byte %01100011 ; 057E 1-af: ** ** - .byte %00000000 ; 057F 1-af: - - .byte %01100110 ; 0580 1-b0: ** ** - .byte %01100110 ; 0581 1-b0: ** ** - .byte %00111100 ; 0582 1-b0: **** - .byte %00011000 ; 0583 1-b0: ** - .byte %00111100 ; 0584 1-b0: **** - .byte %01100110 ; 0585 1-b0: ** ** - .byte %01100110 ; 0586 1-b0: ** ** - .byte %00000000 ; 0587 1-b0: - - .byte %01100110 ; 0588 1-b1: ** ** - .byte %01100110 ; 0589 1-b1: ** ** - .byte %00111100 ; 058A 1-b1: **** - .byte %00011000 ; 058B 1-b1: ** - .byte %00111100 ; 058C 1-b1: **** - .byte %01100110 ; 058D 1-b1: ** ** - .byte %01100110 ; 058E 1-b1: ** ** - .byte %00000000 ; 058F 1-b1: - - .byte %01100110 ; 0590 1-b2: ** ** - .byte %01100110 ; 0591 1-b2: ** ** - .byte %01100110 ; 0592 1-b2: ** ** - .byte %00111100 ; 0593 1-b2: **** - .byte %00011000 ; 0594 1-b2: ** - .byte %00011000 ; 0595 1-b2: ** - .byte %00011000 ; 0596 1-b2: ** - .byte %00000000 ; 0597 1-b2: - - .byte %01100110 ; 0598 1-b3: ** ** - .byte %01100110 ; 0599 1-b3: ** ** - .byte %01100110 ; 059A 1-b3: ** ** - .byte %00111100 ; 059B 1-b3: **** - .byte %00011000 ; 059C 1-b3: ** - .byte %00011000 ; 059D 1-b3: ** - .byte %00011000 ; 059E 1-b3: ** - .byte %00000000 ; 059F 1-b3: - - .byte %01111110 ; 05A0 1-b4: ****** - .byte %00000110 ; 05A1 1-b4: ** - .byte %00001100 ; 05A2 1-b4: ** - .byte %00011000 ; 05A3 1-b4: ** - .byte %00110000 ; 05A4 1-b4: ** - .byte %01100000 ; 05A5 1-b4: ** - .byte %01111110 ; 05A6 1-b4: ****** - .byte %00000000 ; 05A7 1-b4: - - .byte %01111110 ; 05A8 1-b5: ****** - .byte %00000110 ; 05A9 1-b5: ** - .byte %00001100 ; 05AA 1-b5: ** - .byte %00011000 ; 05AB 1-b5: ** - .byte %00110000 ; 05AC 1-b5: ** - .byte %01100000 ; 05AD 1-b5: ** - .byte %01111110 ; 05AE 1-b5: ****** - .byte %00000000 ; 05AF 1-b5: - - .byte %00111100 ; 05B0 1-b6: **** - .byte %00110000 ; 05B1 1-b6: ** - .byte %00110000 ; 05B2 1-b6: ** - .byte %00110000 ; 05B3 1-b6: ** - .byte %00110000 ; 05B4 1-b6: ** - .byte %00110000 ; 05B5 1-b6: ** - .byte %00111100 ; 05B6 1-b6: **** - .byte %00000000 ; 05B7 1-b6: - - .byte %00111100 ; 05B8 1-b7: **** - .byte %00110000 ; 05B9 1-b7: ** - .byte %00110000 ; 05BA 1-b7: ** - .byte %00110000 ; 05BB 1-b7: ** - .byte %00110000 ; 05BC 1-b7: ** - .byte %00110000 ; 05BD 1-b7: ** - .byte %00111100 ; 05BE 1-b7: **** - .byte %00000000 ; 05BF 1-b7: - - .byte %01100000 ; 05C0 1-b8: ** - .byte %00110000 ; 05C1 1-b8: ** - .byte %00011000 ; 05C2 1-b8: ** - .byte %00001100 ; 05C3 1-b8: ** - .byte %00000110 ; 05C4 1-b8: ** - .byte %00000011 ; 05C5 1-b8: ** - .byte %00000000 ; 05C6 1-b8: - .byte %00000000 ; 05C7 1-b8: - - .byte %01100000 ; 05C8 1-b9: ** - .byte %00110000 ; 05C9 1-b9: ** - .byte %00011000 ; 05CA 1-b9: ** - .byte %00001100 ; 05CB 1-b9: ** - .byte %00000110 ; 05CC 1-b9: ** - .byte %00000011 ; 05CD 1-b9: ** - .byte %00000000 ; 05CE 1-b9: - .byte %00000000 ; 05CF 1-b9: - - .byte %00111100 ; 05D0 1-ba: **** - .byte %00001100 ; 05D1 1-ba: ** - .byte %00001100 ; 05D2 1-ba: ** - .byte %00001100 ; 05D3 1-ba: ** - .byte %00001100 ; 05D4 1-ba: ** - .byte %00001100 ; 05D5 1-ba: ** - .byte %00111100 ; 05D6 1-ba: **** - .byte %00000000 ; 05D7 1-ba: - - .byte %00111100 ; 05D8 1-bb: **** - .byte %00001100 ; 05D9 1-bb: ** - .byte %00001100 ; 05DA 1-bb: ** - .byte %00001100 ; 05DB 1-bb: ** - .byte %00001100 ; 05DC 1-bb: ** - .byte %00001100 ; 05DD 1-bb: ** - .byte %00111100 ; 05DE 1-bb: **** - .byte %00000000 ; 05DF 1-bb: - - .byte %00000000 ; 05E0 1-bc: - .byte %00011000 ; 05E1 1-bc: ** - .byte %00111100 ; 05E2 1-bc: **** - .byte %01100110 ; 05E3 1-bc: ** ** - .byte %00000000 ; 05E4 1-bc: - .byte %00000000 ; 05E5 1-bc: - .byte %00000000 ; 05E6 1-bc: - .byte %00000000 ; 05E7 1-bc: - - .byte %00000000 ; 05E8 1-bd: - .byte %00011000 ; 05E9 1-bd: ** - .byte %00111100 ; 05EA 1-bd: **** - .byte %01100110 ; 05EB 1-bd: ** ** - .byte %00000000 ; 05EC 1-bd: - .byte %00000000 ; 05ED 1-bd: - .byte %00000000 ; 05EE 1-bd: - .byte %00000000 ; 05EF 1-bd: - - .byte %00000000 ; 05F0 1-be: - .byte %00000000 ; 05F1 1-be: - .byte %00000000 ; 05F2 1-be: - .byte %00000000 ; 05F3 1-be: - .byte %00000000 ; 05F4 1-be: - .byte %00000000 ; 05F5 1-be: - .byte %01111111 ; 05F6 1-be: ******* - .byte %00000000 ; 05F7 1-be: - - .byte %00000000 ; 05F8 1-bf: - .byte %00000000 ; 05F9 1-bf: - .byte %00000000 ; 05FA 1-bf: - .byte %00000000 ; 05FB 1-bf: - .byte %00000000 ; 05FC 1-bf: - .byte %00000000 ; 05FD 1-bf: - .byte %01111111 ; 05FE 1-bf: ******* - .byte %00000000 ; 05FF 1-bf: - - .byte %00011000 ; 0600 1-c0: ** - .byte %00011000 ; 0601 1-c0: ** - .byte %00011000 ; 0602 1-c0: ** - .byte %00000000 ; 0603 1-c0: - .byte %00000000 ; 0604 1-c0: - .byte %00000000 ; 0605 1-c0: - .byte %00000000 ; 0606 1-c0: - .byte %00000000 ; 0607 1-c0: - - .byte %00011000 ; 0608 1-c1: ** - .byte %00011000 ; 0609 1-c1: ** - .byte %00011000 ; 060A 1-c1: ** - .byte %00000000 ; 060B 1-c1: - .byte %00000000 ; 060C 1-c1: - .byte %00000000 ; 060D 1-c1: - .byte %00000000 ; 060E 1-c1: - .byte %00000000 ; 060F 1-c1: - - .byte %00000000 ; 0610 1-c2: - .byte %00000000 ; 0611 1-c2: - .byte %00111100 ; 0612 1-c2: **** - .byte %00000110 ; 0613 1-c2: ** - .byte %00111110 ; 0614 1-c2: ***** - .byte %01100110 ; 0615 1-c2: ** ** - .byte %00111110 ; 0616 1-c2: ***** - .byte %00000000 ; 0617 1-c2: - - .byte %00000000 ; 0618 1-c3: - .byte %00000000 ; 0619 1-c3: - .byte %00111100 ; 061A 1-c3: **** - .byte %00000110 ; 061B 1-c3: ** - .byte %00111110 ; 061C 1-c3: ***** - .byte %01100110 ; 061D 1-c3: ** ** - .byte %00111110 ; 061E 1-c3: ***** - .byte %00000000 ; 061F 1-c3: - - .byte %00000000 ; 0620 1-c4: - .byte %01100000 ; 0621 1-c4: ** - .byte %01100000 ; 0622 1-c4: ** - .byte %01111100 ; 0623 1-c4: ***** - .byte %01100110 ; 0624 1-c4: ** ** - .byte %01100110 ; 0625 1-c4: ** ** - .byte %01111100 ; 0626 1-c4: ***** - .byte %00000000 ; 0627 1-c4: - - .byte %00000000 ; 0628 1-c5: - .byte %01100000 ; 0629 1-c5: ** - .byte %01100000 ; 062A 1-c5: ** - .byte %01111100 ; 062B 1-c5: ***** - .byte %01100110 ; 062C 1-c5: ** ** - .byte %01100110 ; 062D 1-c5: ** ** - .byte %01111100 ; 062E 1-c5: ***** - .byte %00000000 ; 062F 1-c5: - - .byte %00000000 ; 0630 1-c6: - .byte %00000000 ; 0631 1-c6: - .byte %00111100 ; 0632 1-c6: **** - .byte %01100000 ; 0633 1-c6: ** - .byte %01100000 ; 0634 1-c6: ** - .byte %01100000 ; 0635 1-c6: ** - .byte %00111100 ; 0636 1-c6: **** - .byte %00000000 ; 0637 1-c6: - - .byte %00000000 ; 0638 1-c7: - .byte %00000000 ; 0639 1-c7: - .byte %00111100 ; 063A 1-c7: **** - .byte %01100000 ; 063B 1-c7: ** - .byte %01100000 ; 063C 1-c7: ** - .byte %01100000 ; 063D 1-c7: ** - .byte %00111100 ; 063E 1-c7: **** - .byte %00000000 ; 063F 1-c7: - - .byte %00000000 ; 0640 1-c8: - .byte %00000110 ; 0641 1-c8: ** - .byte %00000110 ; 0642 1-c8: ** - .byte %00111110 ; 0643 1-c8: ***** - .byte %01100110 ; 0644 1-c8: ** ** - .byte %01100110 ; 0645 1-c8: ** ** - .byte %00111110 ; 0646 1-c8: ***** - .byte %00000000 ; 0647 1-c8: - - .byte %00000000 ; 0648 1-c9: - .byte %00000110 ; 0649 1-c9: ** - .byte %00000110 ; 064A 1-c9: ** - .byte %00111110 ; 064B 1-c9: ***** - .byte %01100110 ; 064C 1-c9: ** ** - .byte %01100110 ; 064D 1-c9: ** ** - .byte %00111110 ; 064E 1-c9: ***** - .byte %00000000 ; 064F 1-c9: - - .byte %00000000 ; 0650 1-ca: - .byte %00000000 ; 0651 1-ca: - .byte %00111100 ; 0652 1-ca: **** - .byte %01100110 ; 0653 1-ca: ** ** - .byte %01111110 ; 0654 1-ca: ****** - .byte %01100000 ; 0655 1-ca: ** - .byte %00111100 ; 0656 1-ca: **** - .byte %00000000 ; 0657 1-ca: - - .byte %00000000 ; 0658 1-cb: - .byte %00000000 ; 0659 1-cb: - .byte %00111100 ; 065A 1-cb: **** - .byte %01100110 ; 065B 1-cb: ** ** - .byte %01111110 ; 065C 1-cb: ****** - .byte %01100000 ; 065D 1-cb: ** - .byte %00111100 ; 065E 1-cb: **** - .byte %00000000 ; 065F 1-cb: - - .byte %00000000 ; 0660 1-cc: - .byte %00001110 ; 0661 1-cc: *** - .byte %00011000 ; 0662 1-cc: ** - .byte %00111110 ; 0663 1-cc: ***** - .byte %00011000 ; 0664 1-cc: ** - .byte %00011000 ; 0665 1-cc: ** - .byte %00011000 ; 0666 1-cc: ** - .byte %00000000 ; 0667 1-cc: - - .byte %00000000 ; 0668 1-cd: - .byte %00001110 ; 0669 1-cd: *** - .byte %00011000 ; 066A 1-cd: ** - .byte %00111110 ; 066B 1-cd: ***** - .byte %00011000 ; 066C 1-cd: ** - .byte %00011000 ; 066D 1-cd: ** - .byte %00011000 ; 066E 1-cd: ** - .byte %00000000 ; 066F 1-cd: - - .byte %00000000 ; 0670 1-ce: - .byte %00000000 ; 0671 1-ce: - .byte %00111110 ; 0672 1-ce: ***** - .byte %01100110 ; 0673 1-ce: ** ** - .byte %01100110 ; 0674 1-ce: ** ** - .byte %00111110 ; 0675 1-ce: ***** - .byte %00000110 ; 0676 1-ce: ** - .byte %01111100 ; 0677 1-ce: ***** - - .byte %00000000 ; 0678 1-cf: - .byte %00000000 ; 0679 1-cf: - .byte %00111110 ; 067A 1-cf: ***** - .byte %01100110 ; 067B 1-cf: ** ** - .byte %01100110 ; 067C 1-cf: ** ** - .byte %00111110 ; 067D 1-cf: ***** - .byte %00000110 ; 067E 1-cf: ** - .byte %01111100 ; 067F 1-cf: ***** - - .byte %00000000 ; 0680 1-d0: - .byte %01100000 ; 0681 1-d0: ** - .byte %01100000 ; 0682 1-d0: ** - .byte %01111100 ; 0683 1-d0: ***** - .byte %01100110 ; 0684 1-d0: ** ** - .byte %01100110 ; 0685 1-d0: ** ** - .byte %01100110 ; 0686 1-d0: ** ** - .byte %00000000 ; 0687 1-d0: - - .byte %00000000 ; 0688 1-d1: - .byte %01100000 ; 0689 1-d1: ** - .byte %01100000 ; 068A 1-d1: ** - .byte %01111100 ; 068B 1-d1: ***** - .byte %01100110 ; 068C 1-d1: ** ** - .byte %01100110 ; 068D 1-d1: ** ** - .byte %01100110 ; 068E 1-d1: ** ** - .byte %00000000 ; 068F 1-d1: - - .byte %00000000 ; 0690 1-d2: - .byte %00011000 ; 0691 1-d2: ** - .byte %00000000 ; 0692 1-d2: - .byte %00111000 ; 0693 1-d2: *** - .byte %00011000 ; 0694 1-d2: ** - .byte %00011000 ; 0695 1-d2: ** - .byte %00111100 ; 0696 1-d2: **** - .byte %00000000 ; 0697 1-d2: - - .byte %00000000 ; 0698 1-d3: - .byte %00011000 ; 0699 1-d3: ** - .byte %00000000 ; 069A 1-d3: - .byte %00111000 ; 069B 1-d3: *** - .byte %00011000 ; 069C 1-d3: ** - .byte %00011000 ; 069D 1-d3: ** - .byte %00111100 ; 069E 1-d3: **** - .byte %00000000 ; 069F 1-d3: - - .byte %00000000 ; 06A0 1-d4: - .byte %00000110 ; 06A1 1-d4: ** - .byte %00000000 ; 06A2 1-d4: - .byte %00000110 ; 06A3 1-d4: ** - .byte %00000110 ; 06A4 1-d4: ** - .byte %00000110 ; 06A5 1-d4: ** - .byte %00000110 ; 06A6 1-d4: ** - .byte %00111100 ; 06A7 1-d4: **** - - .byte %00000000 ; 06A8 1-d5: - .byte %00000110 ; 06A9 1-d5: ** - .byte %00000000 ; 06AA 1-d5: - .byte %00000110 ; 06AB 1-d5: ** - .byte %00000110 ; 06AC 1-d5: ** - .byte %00000110 ; 06AD 1-d5: ** - .byte %00000110 ; 06AE 1-d5: ** - .byte %00111100 ; 06AF 1-d5: **** - - .byte %00000000 ; 06B0 1-d6: - .byte %01100000 ; 06B1 1-d6: ** - .byte %01100000 ; 06B2 1-d6: ** - .byte %01101100 ; 06B3 1-d6: ** ** - .byte %01111000 ; 06B4 1-d6: **** - .byte %01101100 ; 06B5 1-d6: ** ** - .byte %01100110 ; 06B6 1-d6: ** ** - .byte %00000000 ; 06B7 1-d6: - - .byte %00000000 ; 06B8 1-d7: - .byte %01100000 ; 06B9 1-d7: ** - .byte %01100000 ; 06BA 1-d7: ** - .byte %01101100 ; 06BB 1-d7: ** ** - .byte %01111000 ; 06BC 1-d7: **** - .byte %01101100 ; 06BD 1-d7: ** ** - .byte %01100110 ; 06BE 1-d7: ** ** - .byte %00000000 ; 06BF 1-d7: - - .byte %00000000 ; 06C0 1-d8: - .byte %00111000 ; 06C1 1-d8: *** - .byte %00011000 ; 06C2 1-d8: ** - .byte %00011000 ; 06C3 1-d8: ** - .byte %00011000 ; 06C4 1-d8: ** - .byte %00011000 ; 06C5 1-d8: ** - .byte %00111100 ; 06C6 1-d8: **** - .byte %00000000 ; 06C7 1-d8: - - .byte %00000000 ; 06C8 1-d9: - .byte %00111000 ; 06C9 1-d9: *** - .byte %00011000 ; 06CA 1-d9: ** - .byte %00011000 ; 06CB 1-d9: ** - .byte %00011000 ; 06CC 1-d9: ** - .byte %00011000 ; 06CD 1-d9: ** - .byte %00111100 ; 06CE 1-d9: **** - .byte %00000000 ; 06CF 1-d9: - - .byte %00000000 ; 06D0 1-da: - .byte %00000000 ; 06D1 1-da: - .byte %01100110 ; 06D2 1-da: ** ** - .byte %01111111 ; 06D3 1-da: ******* - .byte %01111111 ; 06D4 1-da: ******* - .byte %01101011 ; 06D5 1-da: ** * ** - .byte %01100011 ; 06D6 1-da: ** ** - .byte %00000000 ; 06D7 1-da: - - .byte %00000000 ; 06D8 1-db: - .byte %00000000 ; 06D9 1-db: - .byte %01100110 ; 06DA 1-db: ** ** - .byte %01111111 ; 06DB 1-db: ******* - .byte %01111111 ; 06DC 1-db: ******* - .byte %01101011 ; 06DD 1-db: ** * ** - .byte %01100011 ; 06DE 1-db: ** ** - .byte %00000000 ; 06DF 1-db: - - .byte %00000000 ; 06E0 1-dc: - .byte %00000000 ; 06E1 1-dc: - .byte %01111100 ; 06E2 1-dc: ***** - .byte %01100110 ; 06E3 1-dc: ** ** - .byte %01100110 ; 06E4 1-dc: ** ** - .byte %01100110 ; 06E5 1-dc: ** ** - .byte %01100110 ; 06E6 1-dc: ** ** - .byte %00000000 ; 06E7 1-dc: - - .byte %00000000 ; 06E8 1-dd: - .byte %00000000 ; 06E9 1-dd: - .byte %01111100 ; 06EA 1-dd: ***** - .byte %01100110 ; 06EB 1-dd: ** ** - .byte %01100110 ; 06EC 1-dd: ** ** - .byte %01100110 ; 06ED 1-dd: ** ** - .byte %01100110 ; 06EE 1-dd: ** ** - .byte %00000000 ; 06EF 1-dd: - - .byte %00000000 ; 06F0 1-de: - .byte %00000000 ; 06F1 1-de: - .byte %00111100 ; 06F2 1-de: **** - .byte %01100110 ; 06F3 1-de: ** ** - .byte %01100110 ; 06F4 1-de: ** ** - .byte %01100110 ; 06F5 1-de: ** ** - .byte %00111100 ; 06F6 1-de: **** - .byte %00000000 ; 06F7 1-de: - - .byte %00000000 ; 06F8 1-df: - .byte %00000000 ; 06F9 1-df: - .byte %00111100 ; 06FA 1-df: **** - .byte %01100110 ; 06FB 1-df: ** ** - .byte %01100110 ; 06FC 1-df: ** ** - .byte %01100110 ; 06FD 1-df: ** ** - .byte %00111100 ; 06FE 1-df: **** - .byte %00000000 ; 06FF 1-df: - - .byte %00000000 ; 0700 1-e0: - .byte %00000000 ; 0701 1-e0: - .byte %01111100 ; 0702 1-e0: ***** - .byte %01100110 ; 0703 1-e0: ** ** - .byte %01100110 ; 0704 1-e0: ** ** - .byte %01111100 ; 0705 1-e0: ***** - .byte %01100000 ; 0706 1-e0: ** - .byte %01100000 ; 0707 1-e0: ** - - .byte %00000000 ; 0708 1-e1: - .byte %00000000 ; 0709 1-e1: - .byte %01111100 ; 070A 1-e1: ***** - .byte %01100110 ; 070B 1-e1: ** ** - .byte %01100110 ; 070C 1-e1: ** ** - .byte %01111100 ; 070D 1-e1: ***** - .byte %01100000 ; 070E 1-e1: ** - .byte %01100000 ; 070F 1-e1: ** - - .byte %00000000 ; 0710 1-e2: - .byte %00000000 ; 0711 1-e2: - .byte %00111110 ; 0712 1-e2: ***** - .byte %01100110 ; 0713 1-e2: ** ** - .byte %01100110 ; 0714 1-e2: ** ** - .byte %00111110 ; 0715 1-e2: ***** - .byte %00000110 ; 0716 1-e2: ** - .byte %00000110 ; 0717 1-e2: ** - - .byte %00000000 ; 0718 1-e3: - .byte %00000000 ; 0719 1-e3: - .byte %00111110 ; 071A 1-e3: ***** - .byte %01100110 ; 071B 1-e3: ** ** - .byte %01100110 ; 071C 1-e3: ** ** - .byte %00111110 ; 071D 1-e3: ***** - .byte %00000110 ; 071E 1-e3: ** - .byte %00000110 ; 071F 1-e3: ** - - .byte %00000000 ; 0720 1-e4: - .byte %00000000 ; 0721 1-e4: - .byte %01111100 ; 0722 1-e4: ***** - .byte %01100110 ; 0723 1-e4: ** ** - .byte %01100000 ; 0724 1-e4: ** - .byte %01100000 ; 0725 1-e4: ** - .byte %01100000 ; 0726 1-e4: ** - .byte %00000000 ; 0727 1-e4: - - .byte %00000000 ; 0728 1-e5: - .byte %00000000 ; 0729 1-e5: - .byte %01111100 ; 072A 1-e5: ***** - .byte %01100110 ; 072B 1-e5: ** ** - .byte %01100000 ; 072C 1-e5: ** - .byte %01100000 ; 072D 1-e5: ** - .byte %01100000 ; 072E 1-e5: ** - .byte %00000000 ; 072F 1-e5: - - .byte %00000000 ; 0730 1-e6: - .byte %00000000 ; 0731 1-e6: - .byte %00111110 ; 0732 1-e6: ***** - .byte %01100000 ; 0733 1-e6: ** - .byte %00111100 ; 0734 1-e6: **** - .byte %00000110 ; 0735 1-e6: ** - .byte %01111100 ; 0736 1-e6: ***** - .byte %00000000 ; 0737 1-e6: - - .byte %00000000 ; 0738 1-e7: - .byte %00000000 ; 0739 1-e7: - .byte %00111110 ; 073A 1-e7: ***** - .byte %01100000 ; 073B 1-e7: ** - .byte %00111100 ; 073C 1-e7: **** - .byte %00000110 ; 073D 1-e7: ** - .byte %01111100 ; 073E 1-e7: ***** - .byte %00000000 ; 073F 1-e7: - - .byte %00000000 ; 0740 1-e8: - .byte %00011000 ; 0741 1-e8: ** - .byte %01111110 ; 0742 1-e8: ****** - .byte %00011000 ; 0743 1-e8: ** - .byte %00011000 ; 0744 1-e8: ** - .byte %00011000 ; 0745 1-e8: ** - .byte %00001110 ; 0746 1-e8: *** - .byte %00000000 ; 0747 1-e8: - - .byte %00000000 ; 0748 1-e9: - .byte %00011000 ; 0749 1-e9: ** - .byte %01111110 ; 074A 1-e9: ****** - .byte %00011000 ; 074B 1-e9: ** - .byte %00011000 ; 074C 1-e9: ** - .byte %00011000 ; 074D 1-e9: ** - .byte %00001110 ; 074E 1-e9: *** - .byte %00000000 ; 074F 1-e9: - - .byte %00000000 ; 0750 1-ea: - .byte %00000000 ; 0751 1-ea: - .byte %01100110 ; 0752 1-ea: ** ** - .byte %01100110 ; 0753 1-ea: ** ** - .byte %01100110 ; 0754 1-ea: ** ** - .byte %01100110 ; 0755 1-ea: ** ** - .byte %00111110 ; 0756 1-ea: ***** - .byte %00000000 ; 0757 1-ea: - - .byte %00000000 ; 0758 1-eb: - .byte %00000000 ; 0759 1-eb: - .byte %01100110 ; 075A 1-eb: ** ** - .byte %01100110 ; 075B 1-eb: ** ** - .byte %01100110 ; 075C 1-eb: ** ** - .byte %01100110 ; 075D 1-eb: ** ** - .byte %00111110 ; 075E 1-eb: ***** - .byte %00000000 ; 075F 1-eb: - - .byte %00000000 ; 0760 1-ec: - .byte %00000000 ; 0761 1-ec: - .byte %01100110 ; 0762 1-ec: ** ** - .byte %01100110 ; 0763 1-ec: ** ** - .byte %01100110 ; 0764 1-ec: ** ** - .byte %00111100 ; 0765 1-ec: **** - .byte %00011000 ; 0766 1-ec: ** - .byte %00000000 ; 0767 1-ec: - - .byte %00000000 ; 0768 1-ed: - .byte %00000000 ; 0769 1-ed: - .byte %01100110 ; 076A 1-ed: ** ** - .byte %01100110 ; 076B 1-ed: ** ** - .byte %01100110 ; 076C 1-ed: ** ** - .byte %00111100 ; 076D 1-ed: **** - .byte %00011000 ; 076E 1-ed: ** - .byte %00000000 ; 076F 1-ed: - - .byte %00000000 ; 0770 1-ee: - .byte %00000000 ; 0771 1-ee: - .byte %01100011 ; 0772 1-ee: ** ** - .byte %01101011 ; 0773 1-ee: ** * ** - .byte %01111111 ; 0774 1-ee: ******* - .byte %00111110 ; 0775 1-ee: ***** - .byte %00110110 ; 0776 1-ee: ** ** - .byte %00000000 ; 0777 1-ee: - - .byte %00000000 ; 0778 1-ef: - .byte %00000000 ; 0779 1-ef: - .byte %01100011 ; 077A 1-ef: ** ** - .byte %01101011 ; 077B 1-ef: ** * ** - .byte %01111111 ; 077C 1-ef: ******* - .byte %00111110 ; 077D 1-ef: ***** - .byte %00110110 ; 077E 1-ef: ** ** - .byte %00000000 ; 077F 1-ef: - - .byte %00000000 ; 0780 1-f0: - .byte %00000000 ; 0781 1-f0: - .byte %01100110 ; 0782 1-f0: ** ** - .byte %00111100 ; 0783 1-f0: **** - .byte %00011000 ; 0784 1-f0: ** - .byte %00111100 ; 0785 1-f0: **** - .byte %01100110 ; 0786 1-f0: ** ** - .byte %00000000 ; 0787 1-f0: - - .byte %00000000 ; 0788 1-f1: - .byte %00000000 ; 0789 1-f1: - .byte %01100110 ; 078A 1-f1: ** ** - .byte %00111100 ; 078B 1-f1: **** - .byte %00011000 ; 078C 1-f1: ** - .byte %00111100 ; 078D 1-f1: **** - .byte %01100110 ; 078E 1-f1: ** ** - .byte %00000000 ; 078F 1-f1: - - .byte %00000000 ; 0790 1-f2: - .byte %00000000 ; 0791 1-f2: - .byte %01100110 ; 0792 1-f2: ** ** - .byte %01100110 ; 0793 1-f2: ** ** - .byte %01100110 ; 0794 1-f2: ** ** - .byte %00111110 ; 0795 1-f2: ***** - .byte %00001100 ; 0796 1-f2: ** - .byte %01111000 ; 0797 1-f2: **** - - .byte %00000000 ; 0798 1-f3: - .byte %00000000 ; 0799 1-f3: - .byte %01100110 ; 079A 1-f3: ** ** - .byte %01100110 ; 079B 1-f3: ** ** - .byte %01100110 ; 079C 1-f3: ** ** - .byte %00111110 ; 079D 1-f3: ***** - .byte %00001100 ; 079E 1-f3: ** - .byte %01111000 ; 079F 1-f3: **** - - .byte %00000000 ; 07A0 1-f4: - .byte %00000000 ; 07A1 1-f4: - .byte %01111110 ; 07A2 1-f4: ****** - .byte %00001100 ; 07A3 1-f4: ** - .byte %00011000 ; 07A4 1-f4: ** - .byte %00110000 ; 07A5 1-f4: ** - .byte %01111110 ; 07A6 1-f4: ****** - .byte %00000000 ; 07A7 1-f4: - - .byte %00000000 ; 07A8 1-f5: - .byte %00000000 ; 07A9 1-f5: - .byte %01111110 ; 07AA 1-f5: ****** - .byte %00001100 ; 07AB 1-f5: ** - .byte %00011000 ; 07AC 1-f5: ** - .byte %00110000 ; 07AD 1-f5: ** - .byte %01111110 ; 07AE 1-f5: ****** - .byte %00000000 ; 07AF 1-f5: - - .byte %00011100 ; 07B0 1-f6: *** - .byte %00110000 ; 07B1 1-f6: ** - .byte %00011000 ; 07B2 1-f6: ** - .byte %01110000 ; 07B3 1-f6: *** - .byte %00011000 ; 07B4 1-f6: ** - .byte %00110000 ; 07B5 1-f6: ** - .byte %00011100 ; 07B6 1-f6: *** - .byte %00000000 ; 07B7 1-f6: - - .byte %00011100 ; 07B8 1-f7: *** - .byte %00110000 ; 07B9 1-f7: ** - .byte %00011000 ; 07BA 1-f7: ** - .byte %01110000 ; 07BB 1-f7: *** - .byte %00011000 ; 07BC 1-f7: ** - .byte %00110000 ; 07BD 1-f7: ** - .byte %00011100 ; 07BE 1-f7: *** - .byte %00000000 ; 07BF 1-f7: - - .byte %00011000 ; 07C0 1-f8: ** - .byte %00011000 ; 07C1 1-f8: ** - .byte %00011000 ; 07C2 1-f8: ** - .byte %00000000 ; 07C3 1-f8: - .byte %00000000 ; 07C4 1-f8: - .byte %00011000 ; 07C5 1-f8: ** - .byte %00011000 ; 07C6 1-f8: ** - .byte %00011000 ; 07C7 1-f8: ** - - .byte %00011000 ; 07C8 1-f9: ** - .byte %00011000 ; 07C9 1-f9: ** - .byte %00011000 ; 07CA 1-f9: ** - .byte %00000000 ; 07CB 1-f9: - .byte %00000000 ; 07CC 1-f9: - .byte %00011000 ; 07CD 1-f9: ** - .byte %00011000 ; 07CE 1-f9: ** - .byte %00011000 ; 07CF 1-f9: ** - - .byte %00111000 ; 07D0 1-fa: *** - .byte %00001100 ; 07D1 1-fa: ** - .byte %00011000 ; 07D2 1-fa: ** - .byte %00001110 ; 07D3 1-fa: *** - .byte %00011000 ; 07D4 1-fa: ** - .byte %00001100 ; 07D5 1-fa: ** - .byte %00111000 ; 07D6 1-fa: *** - .byte %00000000 ; 07D7 1-fa: - - .byte %00111000 ; 07D8 1-fb: *** - .byte %00001100 ; 07D9 1-fb: ** - .byte %00011000 ; 07DA 1-fb: ** - .byte %00001110 ; 07DB 1-fb: *** - .byte %00011000 ; 07DC 1-fb: ** - .byte %00001100 ; 07DD 1-fb: ** - .byte %00111000 ; 07DE 1-fb: *** - .byte %00000000 ; 07DF 1-fb: - - .byte %00110011 ; 07E0 1-fc: ** ** - .byte %11111111 ; 07E1 1-fc: ******** - .byte %11001100 ; 07E2 1-fc: ** ** - .byte %00000000 ; 07E3 1-fc: - .byte %00000000 ; 07E4 1-fc: - .byte %00000000 ; 07E5 1-fc: - .byte %00000000 ; 07E6 1-fc: - .byte %00000000 ; 07E7 1-fc: - - .byte %00110011 ; 07E8 1-fd: ** ** - .byte %11111111 ; 07E9 1-fd: ******** - .byte %11001100 ; 07EA 1-fd: ** ** - .byte %00000000 ; 07EB 1-fd: - .byte %00000000 ; 07EC 1-fd: - .byte %00000000 ; 07ED 1-fd: - .byte %00000000 ; 07EE 1-fd: - .byte %00000000 ; 07EF 1-fd: - - .byte %00000000 ; 07F0 1-fe: - .byte %00000000 ; 07F1 1-fe: - .byte %00000000 ; 07F2 1-fe: - .byte %00000000 ; 07F3 1-fe: - .byte %00000000 ; 07F4 1-fe: - .byte %00000000 ; 07F5 1-fe: - .byte %00000000 ; 07F6 1-fe: - .byte %00000000 ; 07F7 1-fe: - - .byte %00000000 ; 07F8 1-ff: - .byte %00000000 ; 07F9 1-ff: - .byte %00000000 ; 07FA 1-ff: - .byte %00000000 ; 07FB 1-ff: - .byte %00000000 ; 07FC 1-ff: - .byte %00000000 ; 07FD 1-ff: - .byte %00000000 ; 07FE 1-ff: - .byte %00000000 ; 07FF 1-ff: - - .byte %11111111 ; 0800 2-00: ******** - .byte %11111111 ; 0801 2-00: ******** - .byte %11111111 ; 0802 2-00: ******** - .byte %11111111 ; 0803 2-00: ******** - .byte %11111111 ; 0804 2-00: ******** - .byte %11111111 ; 0805 2-00: ******** - .byte %11111111 ; 0806 2-00: ******** - .byte %11111111 ; 0807 2-00: ******** - - .byte %11111111 ; 0808 2-01: ******** - .byte %11111111 ; 0809 2-01: ******** - .byte %11111111 ; 080A 2-01: ******** - .byte %11111111 ; 080B 2-01: ******** - .byte %11111111 ; 080C 2-01: ******** - .byte %11111111 ; 080D 2-01: ******** - .byte %11111111 ; 080E 2-01: ******** - .byte %11111111 ; 080F 2-01: ******** - - .byte %00110011 ; 0810 2-02: ** ** - .byte %00110011 ; 0811 2-02: ** ** - .byte %11001100 ; 0812 2-02: ** ** - .byte %11001100 ; 0813 2-02: ** ** - .byte %00110011 ; 0814 2-02: ** ** - .byte %00110011 ; 0815 2-02: ** ** - .byte %11001100 ; 0816 2-02: ** ** - .byte %11001100 ; 0817 2-02: ** ** - - .byte %00110011 ; 0818 2-03: ** ** - .byte %00110011 ; 0819 2-03: ** ** - .byte %11001100 ; 081A 2-03: ** ** - .byte %11001100 ; 081B 2-03: ** ** - .byte %00110011 ; 081C 2-03: ** ** - .byte %00110011 ; 081D 2-03: ** ** - .byte %11001100 ; 081E 2-03: ** ** - .byte %11001100 ; 081F 2-03: ** ** - - .byte %11111111 ; 0820 2-04: ******** - .byte %11100111 ; 0821 2-04: *** *** - .byte %11000011 ; 0822 2-04: ** ** - .byte %10000001 ; 0823 2-04: * * - .byte %11100111 ; 0824 2-04: *** *** - .byte %11100111 ; 0825 2-04: *** *** - .byte %11100111 ; 0826 2-04: *** *** - .byte %11100111 ; 0827 2-04: *** *** - - .byte %11111111 ; 0828 2-05: ******** - .byte %11100111 ; 0829 2-05: *** *** - .byte %11000011 ; 082A 2-05: ** ** - .byte %10000001 ; 082B 2-05: * * - .byte %11100111 ; 082C 2-05: *** *** - .byte %11100111 ; 082D 2-05: *** *** - .byte %11100111 ; 082E 2-05: *** *** - .byte %11100111 ; 082F 2-05: *** *** - - .byte %11111111 ; 0830 2-06: ******** - .byte %11101111 ; 0831 2-06: *** **** - .byte %11001111 ; 0832 2-06: ** **** - .byte %10000000 ; 0833 2-06: * - .byte %10000000 ; 0834 2-06: * - .byte %11001111 ; 0835 2-06: ** **** - .byte %11101111 ; 0836 2-06: *** **** - .byte %11111111 ; 0837 2-06: ******** - - .byte %11111111 ; 0838 2-07: ******** - .byte %11101111 ; 0839 2-07: *** **** - .byte %11001111 ; 083A 2-07: ** **** - .byte %10000000 ; 083B 2-07: * - .byte %10000000 ; 083C 2-07: * - .byte %11001111 ; 083D 2-07: ** **** - .byte %11101111 ; 083E 2-07: *** **** - .byte %11111111 ; 083F 2-07: ******** - - .byte %11110011 ; 0840 2-08: **** ** - .byte %11101101 ; 0841 2-08: *** ** * - .byte %11001111 ; 0842 2-08: ** **** - .byte %10000011 ; 0843 2-08: * ** - .byte %11001111 ; 0844 2-08: ** **** - .byte %10011101 ; 0845 2-08: * *** * - .byte %00000011 ; 0846 2-08: ** - .byte %11111111 ; 0847 2-08: ******** - - .byte %11110011 ; 0848 2-09: **** ** - .byte %11101101 ; 0849 2-09: *** ** * - .byte %11001111 ; 084A 2-09: ** **** - .byte %10000011 ; 084B 2-09: * ** - .byte %11001111 ; 084C 2-09: ** **** - .byte %10011101 ; 084D 2-09: * *** * - .byte %00000011 ; 084E 2-09: ** - .byte %11111111 ; 084F 2-09: ******** - - .byte %11111111 ; 0850 2-0a: ******** - .byte %11111111 ; 0851 2-0a: ******** - .byte %11111100 ; 0852 2-0a: ****** - .byte %11000001 ; 0853 2-0a: ** * - .byte %10001001 ; 0854 2-0a: * * * - .byte %11001001 ; 0855 2-0a: ** * * - .byte %11001001 ; 0856 2-0a: ** * * - .byte %11111111 ; 0857 2-0a: ******** - - .byte %11111111 ; 0858 2-0b: ******** - .byte %11111111 ; 0859 2-0b: ******** - .byte %11111100 ; 085A 2-0b: ****** - .byte %11000001 ; 085B 2-0b: ** * - .byte %10001001 ; 085C 2-0b: * * * - .byte %11001001 ; 085D 2-0b: ** * * - .byte %11001001 ; 085E 2-0b: ** * * - .byte %11111111 ; 085F 2-0b: ******** - - .byte %10000000 ; 0860 2-0c: * - .byte %10000000 ; 0861 2-0c: * - .byte %11111111 ; 0862 2-0c: ******** - .byte %11111111 ; 0863 2-0c: ******** - .byte %11111111 ; 0864 2-0c: ******** - .byte %11111111 ; 0865 2-0c: ******** - .byte %11111111 ; 0866 2-0c: ******** - .byte %11111111 ; 0867 2-0c: ******** - - .byte %10000000 ; 0868 2-0d: * - .byte %10000000 ; 0869 2-0d: * - .byte %11111111 ; 086A 2-0d: ******** - .byte %11111111 ; 086B 2-0d: ******** - .byte %11111111 ; 086C 2-0d: ******** - .byte %11111111 ; 086D 2-0d: ******** - .byte %11111111 ; 086E 2-0d: ******** - .byte %11111111 ; 086F 2-0d: ******** - - .byte %00011111 ; 0870 2-0e: ***** - .byte %00011111 ; 0871 2-0e: ***** - .byte %10011111 ; 0872 2-0e: * ***** - .byte %10011111 ; 0873 2-0e: * ***** - .byte %10011111 ; 0874 2-0e: * ***** - .byte %10011111 ; 0875 2-0e: * ***** - .byte %10011111 ; 0876 2-0e: * ***** - .byte %10011111 ; 0877 2-0e: * ***** - - .byte %00011111 ; 0878 2-0f: ***** - .byte %00011111 ; 0879 2-0f: ***** - .byte %10011111 ; 087A 2-0f: * ***** - .byte %10011111 ; 087B 2-0f: * ***** - .byte %10011111 ; 087C 2-0f: * ***** - .byte %10011111 ; 087D 2-0f: * ***** - .byte %10011111 ; 087E 2-0f: * ***** - .byte %10011111 ; 087F 2-0f: * ***** - - .byte %11100111 ; 0880 2-10: *** *** - .byte %11100111 ; 0881 2-10: *** *** - .byte %11100111 ; 0882 2-10: *** *** - .byte %00000111 ; 0883 2-10: *** - .byte %00000111 ; 0884 2-10: *** - .byte %11111111 ; 0885 2-10: ******** - .byte %11111111 ; 0886 2-10: ******** - .byte %11111111 ; 0887 2-10: ******** - - .byte %11100111 ; 0888 2-11: *** *** - .byte %11100111 ; 0889 2-11: *** *** - .byte %11100111 ; 088A 2-11: *** *** - .byte %00000111 ; 088B 2-11: *** - .byte %00000111 ; 088C 2-11: *** - .byte %11111111 ; 088D 2-11: ******** - .byte %11111111 ; 088E 2-11: ******** - .byte %11111111 ; 088F 2-11: ******** - - .byte %00110011 ; 0890 2-12: ** ** - .byte %01100110 ; 0891 2-12: ** ** - .byte %11001100 ; 0892 2-12: ** ** - .byte %10011001 ; 0893 2-12: * ** * - .byte %00110011 ; 0894 2-12: ** ** - .byte %01100110 ; 0895 2-12: ** ** - .byte %11001100 ; 0896 2-12: ** ** - .byte %10011001 ; 0897 2-12: * ** * - - .byte %00110011 ; 0898 2-13: ** ** - .byte %01100110 ; 0899 2-13: ** ** - .byte %11001100 ; 089A 2-13: ** ** - .byte %10011001 ; 089B 2-13: * ** * - .byte %00110011 ; 089C 2-13: ** ** - .byte %01100110 ; 089D 2-13: ** ** - .byte %11001100 ; 089E 2-13: ** ** - .byte %10011001 ; 089F 2-13: * ** * - - .byte %11001100 ; 08A0 2-14: ** ** - .byte %01100110 ; 08A1 2-14: ** ** - .byte %00110011 ; 08A2 2-14: ** ** - .byte %10011001 ; 08A3 2-14: * ** * - .byte %11001100 ; 08A4 2-14: ** ** - .byte %01100110 ; 08A5 2-14: ** ** - .byte %00110011 ; 08A6 2-14: ** ** - .byte %10011001 ; 08A7 2-14: * ** * - - .byte %11001100 ; 08A8 2-15: ** ** - .byte %01100110 ; 08A9 2-15: ** ** - .byte %00110011 ; 08AA 2-15: ** ** - .byte %10011001 ; 08AB 2-15: * ** * - .byte %11001100 ; 08AC 2-15: ** ** - .byte %01100110 ; 08AD 2-15: ** ** - .byte %00110011 ; 08AE 2-15: ** ** - .byte %10011001 ; 08AF 2-15: * ** * - - .byte %11111111 ; 08B0 2-16: ******** - .byte %11111111 ; 08B1 2-16: ******** - .byte %11111111 ; 08B2 2-16: ******** - .byte %00000000 ; 08B3 2-16: - .byte %00000000 ; 08B4 2-16: - .byte %11111111 ; 08B5 2-16: ******** - .byte %11111111 ; 08B6 2-16: ******** - .byte %11111111 ; 08B7 2-16: ******** - - .byte %11111111 ; 08B8 2-17: ******** - .byte %11111111 ; 08B9 2-17: ******** - .byte %11111111 ; 08BA 2-17: ******** - .byte %00000000 ; 08BB 2-17: - .byte %00000000 ; 08BC 2-17: - .byte %11111111 ; 08BD 2-17: ******** - .byte %11111111 ; 08BE 2-17: ******** - .byte %11111111 ; 08BF 2-17: ******** - - .byte %11111100 ; 08C0 2-18: ****** - .byte %11111100 ; 08C1 2-18: ****** - .byte %11111100 ; 08C2 2-18: ****** - .byte %11111100 ; 08C3 2-18: ****** - .byte %11111100 ; 08C4 2-18: ****** - .byte %11111100 ; 08C5 2-18: ****** - .byte %11111100 ; 08C6 2-18: ****** - .byte %11111100 ; 08C7 2-18: ****** - - .byte %11111100 ; 08C8 2-19: ****** - .byte %11111100 ; 08C9 2-19: ****** - .byte %11111100 ; 08CA 2-19: ****** - .byte %11111100 ; 08CB 2-19: ****** - .byte %11111100 ; 08CC 2-19: ****** - .byte %11111100 ; 08CD 2-19: ****** - .byte %11111100 ; 08CE 2-19: ****** - .byte %11111100 ; 08CF 2-19: ****** - - .byte %11111111 ; 08D0 2-1a: ******** - .byte %11111111 ; 08D1 2-1a: ******** - .byte %11111111 ; 08D2 2-1a: ******** - .byte %11111111 ; 08D3 2-1a: ******** - .byte %00110011 ; 08D4 2-1a: ** ** - .byte %00110011 ; 08D5 2-1a: ** ** - .byte %11001100 ; 08D6 2-1a: ** ** - .byte %11001100 ; 08D7 2-1a: ** ** - - .byte %11111111 ; 08D8 2-1b: ******** - .byte %11111111 ; 08D9 2-1b: ******** - .byte %11111111 ; 08DA 2-1b: ******** - .byte %11111111 ; 08DB 2-1b: ******** - .byte %00110011 ; 08DC 2-1b: ** ** - .byte %00110011 ; 08DD 2-1b: ** ** - .byte %11001100 ; 08DE 2-1b: ** ** - .byte %11001100 ; 08DF 2-1b: ** ** - - .byte %11100111 ; 08E0 2-1c: *** *** - .byte %11100111 ; 08E1 2-1c: *** *** - .byte %11100111 ; 08E2 2-1c: *** *** - .byte %11100111 ; 08E3 2-1c: *** *** - .byte %11100111 ; 08E4 2-1c: *** *** - .byte %11100111 ; 08E5 2-1c: *** *** - .byte %11100111 ; 08E6 2-1c: *** *** - .byte %11100111 ; 08E7 2-1c: *** *** - - .byte %11100111 ; 08E8 2-1d: *** *** - .byte %11100111 ; 08E9 2-1d: *** *** - .byte %11100111 ; 08EA 2-1d: *** *** - .byte %11100111 ; 08EB 2-1d: *** *** - .byte %11100111 ; 08EC 2-1d: *** *** - .byte %11100111 ; 08ED 2-1d: *** *** - .byte %11100111 ; 08EE 2-1d: *** *** - .byte %11100111 ; 08EF 2-1d: *** *** - - .byte %11100111 ; 08F0 2-1e: *** *** - .byte %11100111 ; 08F1 2-1e: *** *** - .byte %11100111 ; 08F2 2-1e: *** *** - .byte %11100000 ; 08F3 2-1e: *** - .byte %11100000 ; 08F4 2-1e: *** - .byte %11100111 ; 08F5 2-1e: *** *** - .byte %11100111 ; 08F6 2-1e: *** *** - .byte %11100111 ; 08F7 2-1e: *** *** - - .byte %11100111 ; 08F8 2-1f: *** *** - .byte %11100111 ; 08F9 2-1f: *** *** - .byte %11100111 ; 08FA 2-1f: *** *** - .byte %11100000 ; 08FB 2-1f: *** - .byte %11100000 ; 08FC 2-1f: *** - .byte %11100111 ; 08FD 2-1f: *** *** - .byte %11100111 ; 08FE 2-1f: *** *** - .byte %11100111 ; 08FF 2-1f: *** *** - - .byte %11100111 ; 0900 2-20: *** *** - .byte %11100111 ; 0901 2-20: *** *** - .byte %11100111 ; 0902 2-20: *** *** - .byte %00000000 ; 0903 2-20: - .byte %00000000 ; 0904 2-20: - .byte %11100111 ; 0905 2-20: *** *** - .byte %11100111 ; 0906 2-20: *** *** - .byte %11100111 ; 0907 2-20: *** *** - - .byte %11100111 ; 0908 2-21: *** *** - .byte %11100111 ; 0909 2-21: *** *** - .byte %11100111 ; 090A 2-21: *** *** - .byte %00000000 ; 090B 2-21: - .byte %00000000 ; 090C 2-21: - .byte %11100111 ; 090D 2-21: *** *** - .byte %11100111 ; 090E 2-21: *** *** - .byte %11100111 ; 090F 2-21: *** *** - - .byte %11100111 ; 0910 2-22: *** *** - .byte %11100111 ; 0911 2-22: *** *** - .byte %11100111 ; 0912 2-22: *** *** - .byte %11100000 ; 0913 2-22: *** - .byte %11100000 ; 0914 2-22: *** - .byte %11111111 ; 0915 2-22: ******** - .byte %11111111 ; 0916 2-22: ******** - .byte %11111111 ; 0917 2-22: ******** - - .byte %11100111 ; 0918 2-23: *** *** - .byte %11100111 ; 0919 2-23: *** *** - .byte %11100111 ; 091A 2-23: *** *** - .byte %11100000 ; 091B 2-23: *** - .byte %11100000 ; 091C 2-23: *** - .byte %11111111 ; 091D 2-23: ******** - .byte %11111111 ; 091E 2-23: ******** - .byte %11111111 ; 091F 2-23: ******** - - .byte %11111111 ; 0920 2-24: ******** - .byte %11111111 ; 0921 2-24: ******** - .byte %11111111 ; 0922 2-24: ******** - .byte %00000111 ; 0923 2-24: *** - .byte %00000111 ; 0924 2-24: *** - .byte %11100111 ; 0925 2-24: *** *** - .byte %11100111 ; 0926 2-24: *** *** - .byte %11100111 ; 0927 2-24: *** *** - - .byte %11111111 ; 0928 2-25: ******** - .byte %11111111 ; 0929 2-25: ******** - .byte %11111111 ; 092A 2-25: ******** - .byte %00000111 ; 092B 2-25: *** - .byte %00000111 ; 092C 2-25: *** - .byte %11100111 ; 092D 2-25: *** *** - .byte %11100111 ; 092E 2-25: *** *** - .byte %11100111 ; 092F 2-25: *** *** - - .byte %11111111 ; 0930 2-26: ******** - .byte %11111111 ; 0931 2-26: ******** - .byte %11111111 ; 0932 2-26: ******** - .byte %11111111 ; 0933 2-26: ******** - .byte %11111111 ; 0934 2-26: ******** - .byte %11111111 ; 0935 2-26: ******** - .byte %00000000 ; 0936 2-26: - .byte %00000000 ; 0937 2-26: - - .byte %11111111 ; 0938 2-27: ******** - .byte %11111111 ; 0939 2-27: ******** - .byte %11111111 ; 093A 2-27: ******** - .byte %11111111 ; 093B 2-27: ******** - .byte %11111111 ; 093C 2-27: ******** - .byte %11111111 ; 093D 2-27: ******** - .byte %00000000 ; 093E 2-27: - .byte %00000000 ; 093F 2-27: - - .byte %11111111 ; 0940 2-28: ******** - .byte %11111111 ; 0941 2-28: ******** - .byte %11111111 ; 0942 2-28: ******** - .byte %11100000 ; 0943 2-28: *** - .byte %11100000 ; 0944 2-28: *** - .byte %11100111 ; 0945 2-28: *** *** - .byte %11100111 ; 0946 2-28: *** *** - .byte %11100111 ; 0947 2-28: *** *** - - .byte %11111111 ; 0948 2-29: ******** - .byte %11111111 ; 0949 2-29: ******** - .byte %11111111 ; 094A 2-29: ******** - .byte %11100000 ; 094B 2-29: *** - .byte %11100000 ; 094C 2-29: *** - .byte %11100111 ; 094D 2-29: *** *** - .byte %11100111 ; 094E 2-29: *** *** - .byte %11100111 ; 094F 2-29: *** *** - - .byte %11100111 ; 0950 2-2a: *** *** - .byte %11100111 ; 0951 2-2a: *** *** - .byte %11100111 ; 0952 2-2a: *** *** - .byte %00000000 ; 0953 2-2a: - .byte %00000000 ; 0954 2-2a: - .byte %11111111 ; 0955 2-2a: ******** - .byte %11111111 ; 0956 2-2a: ******** - .byte %11111111 ; 0957 2-2a: ******** - - .byte %11100111 ; 0958 2-2b: *** *** - .byte %11100111 ; 0959 2-2b: *** *** - .byte %11100111 ; 095A 2-2b: *** *** - .byte %00000000 ; 095B 2-2b: - .byte %00000000 ; 095C 2-2b: - .byte %11111111 ; 095D 2-2b: ******** - .byte %11111111 ; 095E 2-2b: ******** - .byte %11111111 ; 095F 2-2b: ******** - - .byte %11111111 ; 0960 2-2c: ******** - .byte %11111111 ; 0961 2-2c: ******** - .byte %11111111 ; 0962 2-2c: ******** - .byte %00000000 ; 0963 2-2c: - .byte %00000000 ; 0964 2-2c: - .byte %11100111 ; 0965 2-2c: *** *** - .byte %11100111 ; 0966 2-2c: *** *** - .byte %11100111 ; 0967 2-2c: *** *** - - .byte %11111111 ; 0968 2-2d: ******** - .byte %11111111 ; 0969 2-2d: ******** - .byte %11111111 ; 096A 2-2d: ******** - .byte %00000000 ; 096B 2-2d: - .byte %00000000 ; 096C 2-2d: - .byte %11100111 ; 096D 2-2d: *** *** - .byte %11100111 ; 096E 2-2d: *** *** - .byte %11100111 ; 096F 2-2d: *** *** - - .byte %11100111 ; 0970 2-2e: *** *** - .byte %11100111 ; 0971 2-2e: *** *** - .byte %11100111 ; 0972 2-2e: *** *** - .byte %00000111 ; 0973 2-2e: *** - .byte %00000111 ; 0974 2-2e: *** - .byte %11100111 ; 0975 2-2e: *** *** - .byte %11100111 ; 0976 2-2e: *** *** - .byte %11100111 ; 0977 2-2e: *** *** - - .byte %11100111 ; 0978 2-2f: *** *** - .byte %11100111 ; 0979 2-2f: *** *** - .byte %11100111 ; 097A 2-2f: *** *** - .byte %00000111 ; 097B 2-2f: *** - .byte %00000111 ; 097C 2-2f: *** - .byte %11100111 ; 097D 2-2f: *** *** - .byte %11100111 ; 097E 2-2f: *** *** - .byte %11100111 ; 097F 2-2f: *** *** - - .byte %00001111 ; 0980 2-30: **** - .byte %00001111 ; 0981 2-30: **** - .byte %00001111 ; 0982 2-30: **** - .byte %00001111 ; 0983 2-30: **** - .byte %00001111 ; 0984 2-30: **** - .byte %00001111 ; 0985 2-30: **** - .byte %00001111 ; 0986 2-30: **** - .byte %00001111 ; 0987 2-30: **** - - .byte %00001111 ; 0988 2-31: **** - .byte %00001111 ; 0989 2-31: **** - .byte %00001111 ; 098A 2-31: **** - .byte %00001111 ; 098B 2-31: **** - .byte %00001111 ; 098C 2-31: **** - .byte %00001111 ; 098D 2-31: **** - .byte %00001111 ; 098E 2-31: **** - .byte %00001111 ; 098F 2-31: **** - - .byte %11111111 ; 0990 2-32: ******** - .byte %11111111 ; 0991 2-32: ******** - .byte %11111111 ; 0992 2-32: ******** - .byte %11111111 ; 0993 2-32: ******** - .byte %00000000 ; 0994 2-32: - .byte %00000000 ; 0995 2-32: - .byte %00000000 ; 0996 2-32: - .byte %00000000 ; 0997 2-32: - - .byte %11111111 ; 0998 2-33: ******** - .byte %11111111 ; 0999 2-33: ******** - .byte %11111111 ; 099A 2-33: ******** - .byte %11111111 ; 099B 2-33: ******** - .byte %00000000 ; 099C 2-33: - .byte %00000000 ; 099D 2-33: - .byte %00000000 ; 099E 2-33: - .byte %00000000 ; 099F 2-33: - - .byte %11111111 ; 09A0 2-34: ******** - .byte %11111111 ; 09A1 2-34: ******** - .byte %11111111 ; 09A2 2-34: ******** - .byte %11111111 ; 09A3 2-34: ******** - .byte %00001111 ; 09A4 2-34: **** - .byte %00001111 ; 09A5 2-34: **** - .byte %00001111 ; 09A6 2-34: **** - .byte %00001111 ; 09A7 2-34: **** - - .byte %11111111 ; 09A8 2-35: ******** - .byte %11111111 ; 09A9 2-35: ******** - .byte %11111111 ; 09AA 2-35: ******** - .byte %11111111 ; 09AB 2-35: ******** - .byte %00001111 ; 09AC 2-35: **** - .byte %00001111 ; 09AD 2-35: **** - .byte %00001111 ; 09AE 2-35: **** - .byte %00001111 ; 09AF 2-35: **** - - .byte %00111111 ; 09B0 2-36: ****** - .byte %00111111 ; 09B1 2-36: ****** - .byte %11001111 ; 09B2 2-36: ** **** - .byte %11001111 ; 09B3 2-36: ** **** - .byte %00111111 ; 09B4 2-36: ****** - .byte %00111111 ; 09B5 2-36: ****** - .byte %11001111 ; 09B6 2-36: ** **** - .byte %11001111 ; 09B7 2-36: ** **** - - .byte %00111111 ; 09B8 2-37: ****** - .byte %00111111 ; 09B9 2-37: ****** - .byte %11001111 ; 09BA 2-37: ** **** - .byte %11001111 ; 09BB 2-37: ** **** - .byte %00111111 ; 09BC 2-37: ****** - .byte %00111111 ; 09BD 2-37: ****** - .byte %11001111 ; 09BE 2-37: ** **** - .byte %11001111 ; 09BF 2-37: ** **** - - .byte %11110000 ; 09C0 2-38: **** - .byte %11110000 ; 09C1 2-38: **** - .byte %11110000 ; 09C2 2-38: **** - .byte %11110000 ; 09C3 2-38: **** - .byte %11111111 ; 09C4 2-38: ******** - .byte %11111111 ; 09C5 2-38: ******** - .byte %11111111 ; 09C6 2-38: ******** - .byte %11111111 ; 09C7 2-38: ******** - - .byte %11110000 ; 09C8 2-39: **** - .byte %11110000 ; 09C9 2-39: **** - .byte %11110000 ; 09CA 2-39: **** - .byte %11110000 ; 09CB 2-39: **** - .byte %11111111 ; 09CC 2-39: ******** - .byte %11111111 ; 09CD 2-39: ******** - .byte %11111111 ; 09CE 2-39: ******** - .byte %11111111 ; 09CF 2-39: ******** - - .byte %11111111 ; 09D0 2-3a: ******** - .byte %11111111 ; 09D1 2-3a: ******** - .byte %11111111 ; 09D2 2-3a: ******** - .byte %11111111 ; 09D3 2-3a: ******** - .byte %11110000 ; 09D4 2-3a: **** - .byte %11110000 ; 09D5 2-3a: **** - .byte %11110000 ; 09D6 2-3a: **** - .byte %11110000 ; 09D7 2-3a: **** - - .byte %11111111 ; 09D8 2-3b: ******** - .byte %11111111 ; 09D9 2-3b: ******** - .byte %11111111 ; 09DA 2-3b: ******** - .byte %11111111 ; 09DB 2-3b: ******** - .byte %11110000 ; 09DC 2-3b: **** - .byte %11110000 ; 09DD 2-3b: **** - .byte %11110000 ; 09DE 2-3b: **** - .byte %11110000 ; 09DF 2-3b: **** - - .byte %00001111 ; 09E0 2-3c: **** - .byte %00001111 ; 09E1 2-3c: **** - .byte %00001111 ; 09E2 2-3c: **** - .byte %00001111 ; 09E3 2-3c: **** - .byte %11111111 ; 09E4 2-3c: ******** - .byte %11111111 ; 09E5 2-3c: ******** - .byte %11111111 ; 09E6 2-3c: ******** - .byte %11111111 ; 09E7 2-3c: ******** - - .byte %00001111 ; 09E8 2-3d: **** - .byte %00001111 ; 09E9 2-3d: **** - .byte %00001111 ; 09EA 2-3d: **** - .byte %00001111 ; 09EB 2-3d: **** - .byte %11111111 ; 09EC 2-3d: ******** - .byte %11111111 ; 09ED 2-3d: ******** - .byte %11111111 ; 09EE 2-3d: ******** - .byte %11111111 ; 09EF 2-3d: ******** - - .byte %00001111 ; 09F0 2-3e: **** - .byte %00001111 ; 09F1 2-3e: **** - .byte %00001111 ; 09F2 2-3e: **** - .byte %00001111 ; 09F3 2-3e: **** - .byte %11110000 ; 09F4 2-3e: **** - .byte %11110000 ; 09F5 2-3e: **** - .byte %11110000 ; 09F6 2-3e: **** - .byte %11110000 ; 09F7 2-3e: **** - - .byte %00001111 ; 09F8 2-3f: **** - .byte %00001111 ; 09F9 2-3f: **** - .byte %00001111 ; 09FA 2-3f: **** - .byte %00001111 ; 09FB 2-3f: **** - .byte %11110000 ; 09FC 2-3f: **** - .byte %11110000 ; 09FD 2-3f: **** - .byte %11110000 ; 09FE 2-3f: **** - .byte %11110000 ; 09FF 2-3f: **** - - .byte %11111111 ; 0A00 2-40: ******** - .byte %11111111 ; 0A01 2-40: ******** - .byte %11111111 ; 0A02 2-40: ******** - .byte %11111111 ; 0A03 2-40: ******** - .byte %11111111 ; 0A04 2-40: ******** - .byte %11111111 ; 0A05 2-40: ******** - .byte %11111111 ; 0A06 2-40: ******** - .byte %11111111 ; 0A07 2-40: ******** - - .byte %11111111 ; 0A08 2-41: ******** - .byte %11111111 ; 0A09 2-41: ******** - .byte %11111111 ; 0A0A 2-41: ******** - .byte %11111111 ; 0A0B 2-41: ******** - .byte %11111111 ; 0A0C 2-41: ******** - .byte %11111111 ; 0A0D 2-41: ******** - .byte %11111111 ; 0A0E 2-41: ******** - .byte %11111111 ; 0A0F 2-41: ******** - - .byte %11100111 ; 0A10 2-42: *** *** - .byte %11100111 ; 0A11 2-42: *** *** - .byte %11100111 ; 0A12 2-42: *** *** - .byte %11100111 ; 0A13 2-42: *** *** - .byte %11111111 ; 0A14 2-42: ******** - .byte %11111111 ; 0A15 2-42: ******** - .byte %11100111 ; 0A16 2-42: *** *** - .byte %11111111 ; 0A17 2-42: ******** - - .byte %11100111 ; 0A18 2-43: *** *** - .byte %11100111 ; 0A19 2-43: *** *** - .byte %11100111 ; 0A1A 2-43: *** *** - .byte %11100111 ; 0A1B 2-43: *** *** - .byte %11111111 ; 0A1C 2-43: ******** - .byte %11111111 ; 0A1D 2-43: ******** - .byte %11100111 ; 0A1E 2-43: *** *** - .byte %11111111 ; 0A1F 2-43: ******** - - .byte %10011001 ; 0A20 2-44: * ** * - .byte %10011001 ; 0A21 2-44: * ** * - .byte %10011001 ; 0A22 2-44: * ** * - .byte %11111111 ; 0A23 2-44: ******** - .byte %11111111 ; 0A24 2-44: ******** - .byte %11111111 ; 0A25 2-44: ******** - .byte %11111111 ; 0A26 2-44: ******** - .byte %11111111 ; 0A27 2-44: ******** - - .byte %10011001 ; 0A28 2-45: * ** * - .byte %10011001 ; 0A29 2-45: * ** * - .byte %10011001 ; 0A2A 2-45: * ** * - .byte %11111111 ; 0A2B 2-45: ******** - .byte %11111111 ; 0A2C 2-45: ******** - .byte %11111111 ; 0A2D 2-45: ******** - .byte %11111111 ; 0A2E 2-45: ******** - .byte %11111111 ; 0A2F 2-45: ******** - - .byte %10011001 ; 0A30 2-46: * ** * - .byte %10011001 ; 0A31 2-46: * ** * - .byte %00000000 ; 0A32 2-46: - .byte %10011001 ; 0A33 2-46: * ** * - .byte %00000000 ; 0A34 2-46: - .byte %10011001 ; 0A35 2-46: * ** * - .byte %10011001 ; 0A36 2-46: * ** * - .byte %11111111 ; 0A37 2-46: ******** - - .byte %10011001 ; 0A38 2-47: * ** * - .byte %10011001 ; 0A39 2-47: * ** * - .byte %00000000 ; 0A3A 2-47: - .byte %10011001 ; 0A3B 2-47: * ** * - .byte %00000000 ; 0A3C 2-47: - .byte %10011001 ; 0A3D 2-47: * ** * - .byte %10011001 ; 0A3E 2-47: * ** * - .byte %11111111 ; 0A3F 2-47: ******** - - .byte %11100111 ; 0A40 2-48: *** *** - .byte %11000001 ; 0A41 2-48: ** * - .byte %10011111 ; 0A42 2-48: * ***** - .byte %11000011 ; 0A43 2-48: ** ** - .byte %11111001 ; 0A44 2-48: ***** * - .byte %10000011 ; 0A45 2-48: * ** - .byte %11100111 ; 0A46 2-48: *** *** - .byte %11111111 ; 0A47 2-48: ******** - - .byte %11100111 ; 0A48 2-49: *** *** - .byte %11000001 ; 0A49 2-49: ** * - .byte %10011111 ; 0A4A 2-49: * ***** - .byte %11000011 ; 0A4B 2-49: ** ** - .byte %11111001 ; 0A4C 2-49: ***** * - .byte %10000011 ; 0A4D 2-49: * ** - .byte %11100111 ; 0A4E 2-49: *** *** - .byte %11111111 ; 0A4F 2-49: ******** - - .byte %11111111 ; 0A50 2-4a: ******** - .byte %10011001 ; 0A51 2-4a: * ** * - .byte %11110011 ; 0A52 2-4a: **** ** - .byte %11100111 ; 0A53 2-4a: *** *** - .byte %11001111 ; 0A54 2-4a: ** **** - .byte %10011001 ; 0A55 2-4a: * ** * - .byte %10111001 ; 0A56 2-4a: * *** * - .byte %11111111 ; 0A57 2-4a: ******** - - .byte %11111111 ; 0A58 2-4b: ******** - .byte %10011001 ; 0A59 2-4b: * ** * - .byte %11110011 ; 0A5A 2-4b: **** ** - .byte %11100111 ; 0A5B 2-4b: *** *** - .byte %11001111 ; 0A5C 2-4b: ** **** - .byte %10011001 ; 0A5D 2-4b: * ** * - .byte %10111001 ; 0A5E 2-4b: * *** * - .byte %11111111 ; 0A5F 2-4b: ******** - - .byte %11000011 ; 0A60 2-4c: ** ** - .byte %10011001 ; 0A61 2-4c: * ** * - .byte %11000011 ; 0A62 2-4c: ** ** - .byte %11000111 ; 0A63 2-4c: ** *** - .byte %10011000 ; 0A64 2-4c: * ** - .byte %10011001 ; 0A65 2-4c: * ** * - .byte %11000000 ; 0A66 2-4c: ** - .byte %11111111 ; 0A67 2-4c: ******** - - .byte %11000011 ; 0A68 2-4d: ** ** - .byte %10011001 ; 0A69 2-4d: * ** * - .byte %11000011 ; 0A6A 2-4d: ** ** - .byte %11000111 ; 0A6B 2-4d: ** *** - .byte %10011000 ; 0A6C 2-4d: * ** - .byte %10011001 ; 0A6D 2-4d: * ** * - .byte %11000000 ; 0A6E 2-4d: ** - .byte %11111111 ; 0A6F 2-4d: ******** - - .byte %11111001 ; 0A70 2-4e: ***** * - .byte %11110011 ; 0A71 2-4e: **** ** - .byte %11100111 ; 0A72 2-4e: *** *** - .byte %11111111 ; 0A73 2-4e: ******** - .byte %11111111 ; 0A74 2-4e: ******** - .byte %11111111 ; 0A75 2-4e: ******** - .byte %11111111 ; 0A76 2-4e: ******** - .byte %11111111 ; 0A77 2-4e: ******** - - .byte %11111001 ; 0A78 2-4f: ***** * - .byte %11110011 ; 0A79 2-4f: **** ** - .byte %11100111 ; 0A7A 2-4f: *** *** - .byte %11111111 ; 0A7B 2-4f: ******** - .byte %11111111 ; 0A7C 2-4f: ******** - .byte %11111111 ; 0A7D 2-4f: ******** - .byte %11111111 ; 0A7E 2-4f: ******** - .byte %11111111 ; 0A7F 2-4f: ******** - - .byte %11110011 ; 0A80 2-50: **** ** - .byte %11100111 ; 0A81 2-50: *** *** - .byte %11001111 ; 0A82 2-50: ** **** - .byte %11001111 ; 0A83 2-50: ** **** - .byte %11001111 ; 0A84 2-50: ** **** - .byte %11100111 ; 0A85 2-50: *** *** - .byte %11110011 ; 0A86 2-50: **** ** - .byte %11111111 ; 0A87 2-50: ******** - - .byte %11110011 ; 0A88 2-51: **** ** - .byte %11100111 ; 0A89 2-51: *** *** - .byte %11001111 ; 0A8A 2-51: ** **** - .byte %11001111 ; 0A8B 2-51: ** **** - .byte %11001111 ; 0A8C 2-51: ** **** - .byte %11100111 ; 0A8D 2-51: *** *** - .byte %11110011 ; 0A8E 2-51: **** ** - .byte %11111111 ; 0A8F 2-51: ******** - - .byte %11001111 ; 0A90 2-52: ** **** - .byte %11100111 ; 0A91 2-52: *** *** - .byte %11110011 ; 0A92 2-52: **** ** - .byte %11110011 ; 0A93 2-52: **** ** - .byte %11110011 ; 0A94 2-52: **** ** - .byte %11100111 ; 0A95 2-52: *** *** - .byte %11001111 ; 0A96 2-52: ** **** - .byte %11111111 ; 0A97 2-52: ******** - - .byte %11001111 ; 0A98 2-53: ** **** - .byte %11100111 ; 0A99 2-53: *** *** - .byte %11110011 ; 0A9A 2-53: **** ** - .byte %11110011 ; 0A9B 2-53: **** ** - .byte %11110011 ; 0A9C 2-53: **** ** - .byte %11100111 ; 0A9D 2-53: *** *** - .byte %11001111 ; 0A9E 2-53: ** **** - .byte %11111111 ; 0A9F 2-53: ******** - - .byte %11111111 ; 0AA0 2-54: ******** - .byte %10011001 ; 0AA1 2-54: * ** * - .byte %11000011 ; 0AA2 2-54: ** ** - .byte %00000000 ; 0AA3 2-54: - .byte %11000011 ; 0AA4 2-54: ** ** - .byte %10011001 ; 0AA5 2-54: * ** * - .byte %11111111 ; 0AA6 2-54: ******** - .byte %11111111 ; 0AA7 2-54: ******** - - .byte %11111111 ; 0AA8 2-55: ******** - .byte %10011001 ; 0AA9 2-55: * ** * - .byte %11000011 ; 0AAA 2-55: ** ** - .byte %00000000 ; 0AAB 2-55: - .byte %11000011 ; 0AAC 2-55: ** ** - .byte %10011001 ; 0AAD 2-55: * ** * - .byte %11111111 ; 0AAE 2-55: ******** - .byte %11111111 ; 0AAF 2-55: ******** - - .byte %11111111 ; 0AB0 2-56: ******** - .byte %11100111 ; 0AB1 2-56: *** *** - .byte %11100111 ; 0AB2 2-56: *** *** - .byte %10000001 ; 0AB3 2-56: * * - .byte %11100111 ; 0AB4 2-56: *** *** - .byte %11100111 ; 0AB5 2-56: *** *** - .byte %11111111 ; 0AB6 2-56: ******** - .byte %11111111 ; 0AB7 2-56: ******** - - .byte %11111111 ; 0AB8 2-57: ******** - .byte %11100111 ; 0AB9 2-57: *** *** - .byte %11100111 ; 0ABA 2-57: *** *** - .byte %10000001 ; 0ABB 2-57: * * - .byte %11100111 ; 0ABC 2-57: *** *** - .byte %11100111 ; 0ABD 2-57: *** *** - .byte %11111111 ; 0ABE 2-57: ******** - .byte %11111111 ; 0ABF 2-57: ******** - - .byte %11111111 ; 0AC0 2-58: ******** - .byte %11111111 ; 0AC1 2-58: ******** - .byte %11111111 ; 0AC2 2-58: ******** - .byte %11111111 ; 0AC3 2-58: ******** - .byte %11111111 ; 0AC4 2-58: ******** - .byte %11100111 ; 0AC5 2-58: *** *** - .byte %11100111 ; 0AC6 2-58: *** *** - .byte %11001111 ; 0AC7 2-58: ** **** - - .byte %11111111 ; 0AC8 2-59: ******** - .byte %11111111 ; 0AC9 2-59: ******** - .byte %11111111 ; 0ACA 2-59: ******** - .byte %11111111 ; 0ACB 2-59: ******** - .byte %11111111 ; 0ACC 2-59: ******** - .byte %11100111 ; 0ACD 2-59: *** *** - .byte %11100111 ; 0ACE 2-59: *** *** - .byte %11001111 ; 0ACF 2-59: ** **** - - .byte %11111111 ; 0AD0 2-5a: ******** - .byte %11111111 ; 0AD1 2-5a: ******** - .byte %11111111 ; 0AD2 2-5a: ******** - .byte %10000001 ; 0AD3 2-5a: * * - .byte %11111111 ; 0AD4 2-5a: ******** - .byte %11111111 ; 0AD5 2-5a: ******** - .byte %11111111 ; 0AD6 2-5a: ******** - .byte %11111111 ; 0AD7 2-5a: ******** - - .byte %11111111 ; 0AD8 2-5b: ******** - .byte %11111111 ; 0AD9 2-5b: ******** - .byte %11111111 ; 0ADA 2-5b: ******** - .byte %10000001 ; 0ADB 2-5b: * * - .byte %11111111 ; 0ADC 2-5b: ******** - .byte %11111111 ; 0ADD 2-5b: ******** - .byte %11111111 ; 0ADE 2-5b: ******** - .byte %11111111 ; 0ADF 2-5b: ******** - - .byte %11111111 ; 0AE0 2-5c: ******** - .byte %11111111 ; 0AE1 2-5c: ******** - .byte %11111111 ; 0AE2 2-5c: ******** - .byte %11111111 ; 0AE3 2-5c: ******** - .byte %11111111 ; 0AE4 2-5c: ******** - .byte %11100111 ; 0AE5 2-5c: *** *** - .byte %11100111 ; 0AE6 2-5c: *** *** - .byte %11111111 ; 0AE7 2-5c: ******** - - .byte %11111111 ; 0AE8 2-5d: ******** - .byte %11111111 ; 0AE9 2-5d: ******** - .byte %11111111 ; 0AEA 2-5d: ******** - .byte %11111111 ; 0AEB 2-5d: ******** - .byte %11111111 ; 0AEC 2-5d: ******** - .byte %11100111 ; 0AED 2-5d: *** *** - .byte %11100111 ; 0AEE 2-5d: *** *** - .byte %11111111 ; 0AEF 2-5d: ******** - - .byte %11111111 ; 0AF0 2-5e: ******** - .byte %11111100 ; 0AF1 2-5e: ****** - .byte %11111001 ; 0AF2 2-5e: ***** * - .byte %11110011 ; 0AF3 2-5e: **** ** - .byte %11100111 ; 0AF4 2-5e: *** *** - .byte %11001111 ; 0AF5 2-5e: ** **** - .byte %10011111 ; 0AF6 2-5e: * ***** - .byte %11111111 ; 0AF7 2-5e: ******** - - .byte %11111111 ; 0AF8 2-5f: ******** - .byte %11111100 ; 0AF9 2-5f: ****** - .byte %11111001 ; 0AFA 2-5f: ***** * - .byte %11110011 ; 0AFB 2-5f: **** ** - .byte %11100111 ; 0AFC 2-5f: *** *** - .byte %11001111 ; 0AFD 2-5f: ** **** - .byte %10011111 ; 0AFE 2-5f: * ***** - .byte %11111111 ; 0AFF 2-5f: ******** - - .byte %11000011 ; 0B00 2-60: ** ** - .byte %10011001 ; 0B01 2-60: * ** * - .byte %10010001 ; 0B02 2-60: * * * - .byte %10001001 ; 0B03 2-60: * * * - .byte %10011001 ; 0B04 2-60: * ** * - .byte %10011001 ; 0B05 2-60: * ** * - .byte %11000011 ; 0B06 2-60: ** ** - .byte %11111111 ; 0B07 2-60: ******** - - .byte %11000011 ; 0B08 2-61: ** ** - .byte %10011001 ; 0B09 2-61: * ** * - .byte %10010001 ; 0B0A 2-61: * * * - .byte %10001001 ; 0B0B 2-61: * * * - .byte %10011001 ; 0B0C 2-61: * ** * - .byte %10011001 ; 0B0D 2-61: * ** * - .byte %11000011 ; 0B0E 2-61: ** ** - .byte %11111111 ; 0B0F 2-61: ******** - - .byte %11100111 ; 0B10 2-62: *** *** - .byte %11100111 ; 0B11 2-62: *** *** - .byte %11000111 ; 0B12 2-62: ** *** - .byte %11100111 ; 0B13 2-62: *** *** - .byte %11100111 ; 0B14 2-62: *** *** - .byte %11100111 ; 0B15 2-62: *** *** - .byte %10000001 ; 0B16 2-62: * * - .byte %11111111 ; 0B17 2-62: ******** - - .byte %11100111 ; 0B18 2-63: *** *** - .byte %11100111 ; 0B19 2-63: *** *** - .byte %11000111 ; 0B1A 2-63: ** *** - .byte %11100111 ; 0B1B 2-63: *** *** - .byte %11100111 ; 0B1C 2-63: *** *** - .byte %11100111 ; 0B1D 2-63: *** *** - .byte %10000001 ; 0B1E 2-63: * * - .byte %11111111 ; 0B1F 2-63: ******** - - .byte %11000011 ; 0B20 2-64: ** ** - .byte %10011001 ; 0B21 2-64: * ** * - .byte %11111001 ; 0B22 2-64: ***** * - .byte %11110011 ; 0B23 2-64: **** ** - .byte %11001111 ; 0B24 2-64: ** **** - .byte %10011111 ; 0B25 2-64: * ***** - .byte %10000001 ; 0B26 2-64: * * - .byte %11111111 ; 0B27 2-64: ******** - - .byte %11000011 ; 0B28 2-65: ** ** - .byte %10011001 ; 0B29 2-65: * ** * - .byte %11111001 ; 0B2A 2-65: ***** * - .byte %11110011 ; 0B2B 2-65: **** ** - .byte %11001111 ; 0B2C 2-65: ** **** - .byte %10011111 ; 0B2D 2-65: * ***** - .byte %10000001 ; 0B2E 2-65: * * - .byte %11111111 ; 0B2F 2-65: ******** - - .byte %11000011 ; 0B30 2-66: ** ** - .byte %10011001 ; 0B31 2-66: * ** * - .byte %11111001 ; 0B32 2-66: ***** * - .byte %11100011 ; 0B33 2-66: *** ** - .byte %11111001 ; 0B34 2-66: ***** * - .byte %10011001 ; 0B35 2-66: * ** * - .byte %11000011 ; 0B36 2-66: ** ** - .byte %11111111 ; 0B37 2-66: ******** - - .byte %11000011 ; 0B38 2-67: ** ** - .byte %10011001 ; 0B39 2-67: * ** * - .byte %11111001 ; 0B3A 2-67: ***** * - .byte %11100011 ; 0B3B 2-67: *** ** - .byte %11111001 ; 0B3C 2-67: ***** * - .byte %10011001 ; 0B3D 2-67: * ** * - .byte %11000011 ; 0B3E 2-67: ** ** - .byte %11111111 ; 0B3F 2-67: ******** - - .byte %11111001 ; 0B40 2-68: ***** * - .byte %11110001 ; 0B41 2-68: **** * - .byte %11100001 ; 0B42 2-68: *** * - .byte %10011001 ; 0B43 2-68: * ** * - .byte %10000000 ; 0B44 2-68: * - .byte %11111001 ; 0B45 2-68: ***** * - .byte %11111001 ; 0B46 2-68: ***** * - .byte %11111111 ; 0B47 2-68: ******** - - .byte %11111001 ; 0B48 2-69: ***** * - .byte %11110001 ; 0B49 2-69: **** * - .byte %11100001 ; 0B4A 2-69: *** * - .byte %10011001 ; 0B4B 2-69: * ** * - .byte %10000000 ; 0B4C 2-69: * - .byte %11111001 ; 0B4D 2-69: ***** * - .byte %11111001 ; 0B4E 2-69: ***** * - .byte %11111111 ; 0B4F 2-69: ******** - - .byte %10000001 ; 0B50 2-6a: * * - .byte %10011111 ; 0B51 2-6a: * ***** - .byte %10000011 ; 0B52 2-6a: * ** - .byte %11111001 ; 0B53 2-6a: ***** * - .byte %11111001 ; 0B54 2-6a: ***** * - .byte %10011001 ; 0B55 2-6a: * ** * - .byte %11000011 ; 0B56 2-6a: ** ** - .byte %11111111 ; 0B57 2-6a: ******** - - .byte %10000001 ; 0B58 2-6b: * * - .byte %10011111 ; 0B59 2-6b: * ***** - .byte %10000011 ; 0B5A 2-6b: * ** - .byte %11111001 ; 0B5B 2-6b: ***** * - .byte %11111001 ; 0B5C 2-6b: ***** * - .byte %10011001 ; 0B5D 2-6b: * ** * - .byte %11000011 ; 0B5E 2-6b: ** ** - .byte %11111111 ; 0B5F 2-6b: ******** - - .byte %11000011 ; 0B60 2-6c: ** ** - .byte %10011001 ; 0B61 2-6c: * ** * - .byte %10011111 ; 0B62 2-6c: * ***** - .byte %10000011 ; 0B63 2-6c: * ** - .byte %10011001 ; 0B64 2-6c: * ** * - .byte %10011001 ; 0B65 2-6c: * ** * - .byte %11000011 ; 0B66 2-6c: ** ** - .byte %11111111 ; 0B67 2-6c: ******** - - .byte %11000011 ; 0B68 2-6d: ** ** - .byte %10011001 ; 0B69 2-6d: * ** * - .byte %10011111 ; 0B6A 2-6d: * ***** - .byte %10000011 ; 0B6B 2-6d: * ** - .byte %10011001 ; 0B6C 2-6d: * ** * - .byte %10011001 ; 0B6D 2-6d: * ** * - .byte %11000011 ; 0B6E 2-6d: ** ** - .byte %11111111 ; 0B6F 2-6d: ******** - - .byte %10000001 ; 0B70 2-6e: * * - .byte %10011001 ; 0B71 2-6e: * ** * - .byte %11110011 ; 0B72 2-6e: **** ** - .byte %11100111 ; 0B73 2-6e: *** *** - .byte %11100111 ; 0B74 2-6e: *** *** - .byte %11100111 ; 0B75 2-6e: *** *** - .byte %11100111 ; 0B76 2-6e: *** *** - .byte %11111111 ; 0B77 2-6e: ******** - - .byte %10000001 ; 0B78 2-6f: * * - .byte %10011001 ; 0B79 2-6f: * ** * - .byte %11110011 ; 0B7A 2-6f: **** ** - .byte %11100111 ; 0B7B 2-6f: *** *** - .byte %11100111 ; 0B7C 2-6f: *** *** - .byte %11100111 ; 0B7D 2-6f: *** *** - .byte %11100111 ; 0B7E 2-6f: *** *** - .byte %11111111 ; 0B7F 2-6f: ******** - - .byte %11000011 ; 0B80 2-70: ** ** - .byte %10011001 ; 0B81 2-70: * ** * - .byte %10011001 ; 0B82 2-70: * ** * - .byte %11000011 ; 0B83 2-70: ** ** - .byte %10011001 ; 0B84 2-70: * ** * - .byte %10011001 ; 0B85 2-70: * ** * - .byte %11000011 ; 0B86 2-70: ** ** - .byte %11111111 ; 0B87 2-70: ******** - - .byte %11000011 ; 0B88 2-71: ** ** - .byte %10011001 ; 0B89 2-71: * ** * - .byte %10011001 ; 0B8A 2-71: * ** * - .byte %11000011 ; 0B8B 2-71: ** ** - .byte %10011001 ; 0B8C 2-71: * ** * - .byte %10011001 ; 0B8D 2-71: * ** * - .byte %11000011 ; 0B8E 2-71: ** ** - .byte %11111111 ; 0B8F 2-71: ******** - - .byte %11000011 ; 0B90 2-72: ** ** - .byte %10011001 ; 0B91 2-72: * ** * - .byte %10011001 ; 0B92 2-72: * ** * - .byte %11000001 ; 0B93 2-72: ** * - .byte %11111001 ; 0B94 2-72: ***** * - .byte %10011001 ; 0B95 2-72: * ** * - .byte %11000011 ; 0B96 2-72: ** ** - .byte %11111111 ; 0B97 2-72: ******** - - .byte %11000011 ; 0B98 2-73: ** ** - .byte %10011001 ; 0B99 2-73: * ** * - .byte %10011001 ; 0B9A 2-73: * ** * - .byte %11000001 ; 0B9B 2-73: ** * - .byte %11111001 ; 0B9C 2-73: ***** * - .byte %10011001 ; 0B9D 2-73: * ** * - .byte %11000011 ; 0B9E 2-73: ** ** - .byte %11111111 ; 0B9F 2-73: ******** - - .byte %11111111 ; 0BA0 2-74: ******** - .byte %11111111 ; 0BA1 2-74: ******** - .byte %11100111 ; 0BA2 2-74: *** *** - .byte %11111111 ; 0BA3 2-74: ******** - .byte %11111111 ; 0BA4 2-74: ******** - .byte %11100111 ; 0BA5 2-74: *** *** - .byte %11111111 ; 0BA6 2-74: ******** - .byte %11111111 ; 0BA7 2-74: ******** - - .byte %11111111 ; 0BA8 2-75: ******** - .byte %11111111 ; 0BA9 2-75: ******** - .byte %11100111 ; 0BAA 2-75: *** *** - .byte %11111111 ; 0BAB 2-75: ******** - .byte %11111111 ; 0BAC 2-75: ******** - .byte %11100111 ; 0BAD 2-75: *** *** - .byte %11111111 ; 0BAE 2-75: ******** - .byte %11111111 ; 0BAF 2-75: ******** - - .byte %11111111 ; 0BB0 2-76: ******** - .byte %11111111 ; 0BB1 2-76: ******** - .byte %11100111 ; 0BB2 2-76: *** *** - .byte %11111111 ; 0BB3 2-76: ******** - .byte %11111111 ; 0BB4 2-76: ******** - .byte %11100111 ; 0BB5 2-76: *** *** - .byte %11100111 ; 0BB6 2-76: *** *** - .byte %11001111 ; 0BB7 2-76: ** **** - - .byte %11111111 ; 0BB8 2-77: ******** - .byte %11111111 ; 0BB9 2-77: ******** - .byte %11100111 ; 0BBA 2-77: *** *** - .byte %11111111 ; 0BBB 2-77: ******** - .byte %11111111 ; 0BBC 2-77: ******** - .byte %11100111 ; 0BBD 2-77: *** *** - .byte %11100111 ; 0BBE 2-77: *** *** - .byte %11001111 ; 0BBF 2-77: ** **** - - .byte %11110001 ; 0BC0 2-78: **** * - .byte %11100111 ; 0BC1 2-78: *** *** - .byte %11001111 ; 0BC2 2-78: ** **** - .byte %10011111 ; 0BC3 2-78: * ***** - .byte %11001111 ; 0BC4 2-78: ** **** - .byte %11100111 ; 0BC5 2-78: *** *** - .byte %11110001 ; 0BC6 2-78: **** * - .byte %11111111 ; 0BC7 2-78: ******** - - .byte %11110001 ; 0BC8 2-79: **** * - .byte %11100111 ; 0BC9 2-79: *** *** - .byte %11001111 ; 0BCA 2-79: ** **** - .byte %10011111 ; 0BCB 2-79: * ***** - .byte %11001111 ; 0BCC 2-79: ** **** - .byte %11100111 ; 0BCD 2-79: *** *** - .byte %11110001 ; 0BCE 2-79: **** * - .byte %11111111 ; 0BCF 2-79: ******** - - .byte %11111111 ; 0BD0 2-7a: ******** - .byte %11111111 ; 0BD1 2-7a: ******** - .byte %10000001 ; 0BD2 2-7a: * * - .byte %11111111 ; 0BD3 2-7a: ******** - .byte %10000001 ; 0BD4 2-7a: * * - .byte %11111111 ; 0BD5 2-7a: ******** - .byte %11111111 ; 0BD6 2-7a: ******** - .byte %11111111 ; 0BD7 2-7a: ******** - - .byte %11111111 ; 0BD8 2-7b: ******** - .byte %11111111 ; 0BD9 2-7b: ******** - .byte %10000001 ; 0BDA 2-7b: * * - .byte %11111111 ; 0BDB 2-7b: ******** - .byte %10000001 ; 0BDC 2-7b: * * - .byte %11111111 ; 0BDD 2-7b: ******** - .byte %11111111 ; 0BDE 2-7b: ******** - .byte %11111111 ; 0BDF 2-7b: ******** - - .byte %10001111 ; 0BE0 2-7c: * **** - .byte %11100111 ; 0BE1 2-7c: *** *** - .byte %11110011 ; 0BE2 2-7c: **** ** - .byte %11111001 ; 0BE3 2-7c: ***** * - .byte %11110011 ; 0BE4 2-7c: **** ** - .byte %11100111 ; 0BE5 2-7c: *** *** - .byte %10001111 ; 0BE6 2-7c: * **** - .byte %11111111 ; 0BE7 2-7c: ******** - - .byte %10001111 ; 0BE8 2-7d: * **** - .byte %11100111 ; 0BE9 2-7d: *** *** - .byte %11110011 ; 0BEA 2-7d: **** ** - .byte %11111001 ; 0BEB 2-7d: ***** * - .byte %11110011 ; 0BEC 2-7d: **** ** - .byte %11100111 ; 0BED 2-7d: *** *** - .byte %10001111 ; 0BEE 2-7d: * **** - .byte %11111111 ; 0BEF 2-7d: ******** - - .byte %11000011 ; 0BF0 2-7e: ** ** - .byte %10011001 ; 0BF1 2-7e: * ** * - .byte %11111001 ; 0BF2 2-7e: ***** * - .byte %11110011 ; 0BF3 2-7e: **** ** - .byte %11100111 ; 0BF4 2-7e: *** *** - .byte %11111111 ; 0BF5 2-7e: ******** - .byte %11100111 ; 0BF6 2-7e: *** *** - .byte %11111111 ; 0BF7 2-7e: ******** - - .byte %11000011 ; 0BF8 2-7f: ** ** - .byte %10011001 ; 0BF9 2-7f: * ** * - .byte %11111001 ; 0BFA 2-7f: ***** * - .byte %11110011 ; 0BFB 2-7f: **** ** - .byte %11100111 ; 0BFC 2-7f: *** *** - .byte %11111111 ; 0BFD 2-7f: ******** - .byte %11100111 ; 0BFE 2-7f: *** *** - .byte %11111111 ; 0BFF 2-7f: ******** - - .byte %11000011 ; 0C00 2-80: ** ** - .byte %10011001 ; 0C01 2-80: * ** * - .byte %10010001 ; 0C02 2-80: * * * - .byte %10010001 ; 0C03 2-80: * * * - .byte %10011111 ; 0C04 2-80: * ***** - .byte %10011101 ; 0C05 2-80: * *** * - .byte %11000011 ; 0C06 2-80: ** ** - .byte %11111111 ; 0C07 2-80: ******** - - .byte %11000011 ; 0C08 2-81: ** ** - .byte %10011001 ; 0C09 2-81: * ** * - .byte %10010001 ; 0C0A 2-81: * * * - .byte %10010001 ; 0C0B 2-81: * * * - .byte %10011111 ; 0C0C 2-81: * ***** - .byte %10011101 ; 0C0D 2-81: * *** * - .byte %11000011 ; 0C0E 2-81: ** ** - .byte %11111111 ; 0C0F 2-81: ******** - - .byte %11100111 ; 0C10 2-82: *** *** - .byte %11000011 ; 0C11 2-82: ** ** - .byte %10011001 ; 0C12 2-82: * ** * - .byte %10000001 ; 0C13 2-82: * * - .byte %10011001 ; 0C14 2-82: * ** * - .byte %10011001 ; 0C15 2-82: * ** * - .byte %10011001 ; 0C16 2-82: * ** * - .byte %11111111 ; 0C17 2-82: ******** - - .byte %11100111 ; 0C18 2-83: *** *** - .byte %11000011 ; 0C19 2-83: ** ** - .byte %10011001 ; 0C1A 2-83: * ** * - .byte %10000001 ; 0C1B 2-83: * * - .byte %10011001 ; 0C1C 2-83: * ** * - .byte %10011001 ; 0C1D 2-83: * ** * - .byte %10011001 ; 0C1E 2-83: * ** * - .byte %11111111 ; 0C1F 2-83: ******** - - .byte %10000011 ; 0C20 2-84: * ** - .byte %10011001 ; 0C21 2-84: * ** * - .byte %10011001 ; 0C22 2-84: * ** * - .byte %10000011 ; 0C23 2-84: * ** - .byte %10011001 ; 0C24 2-84: * ** * - .byte %10011001 ; 0C25 2-84: * ** * - .byte %10000011 ; 0C26 2-84: * ** - .byte %11111111 ; 0C27 2-84: ******** - - .byte %10000011 ; 0C28 2-85: * ** - .byte %10011001 ; 0C29 2-85: * ** * - .byte %10011001 ; 0C2A 2-85: * ** * - .byte %10000011 ; 0C2B 2-85: * ** - .byte %10011001 ; 0C2C 2-85: * ** * - .byte %10011001 ; 0C2D 2-85: * ** * - .byte %10000011 ; 0C2E 2-85: * ** - .byte %11111111 ; 0C2F 2-85: ******** - - .byte %11000011 ; 0C30 2-86: ** ** - .byte %10011001 ; 0C31 2-86: * ** * - .byte %10011111 ; 0C32 2-86: * ***** - .byte %10011111 ; 0C33 2-86: * ***** - .byte %10011111 ; 0C34 2-86: * ***** - .byte %10011001 ; 0C35 2-86: * ** * - .byte %11000011 ; 0C36 2-86: ** ** - .byte %11111111 ; 0C37 2-86: ******** - - .byte %11000011 ; 0C38 2-87: ** ** - .byte %10011001 ; 0C39 2-87: * ** * - .byte %10011111 ; 0C3A 2-87: * ***** - .byte %10011111 ; 0C3B 2-87: * ***** - .byte %10011111 ; 0C3C 2-87: * ***** - .byte %10011001 ; 0C3D 2-87: * ** * - .byte %11000011 ; 0C3E 2-87: ** ** - .byte %11111111 ; 0C3F 2-87: ******** - - .byte %10000111 ; 0C40 2-88: * *** - .byte %10010011 ; 0C41 2-88: * * ** - .byte %10011001 ; 0C42 2-88: * ** * - .byte %10011001 ; 0C43 2-88: * ** * - .byte %10011001 ; 0C44 2-88: * ** * - .byte %10010011 ; 0C45 2-88: * * ** - .byte %10000111 ; 0C46 2-88: * *** - .byte %11111111 ; 0C47 2-88: ******** - - .byte %10000111 ; 0C48 2-89: * *** - .byte %10010011 ; 0C49 2-89: * * ** - .byte %10011001 ; 0C4A 2-89: * ** * - .byte %10011001 ; 0C4B 2-89: * ** * - .byte %10011001 ; 0C4C 2-89: * ** * - .byte %10010011 ; 0C4D 2-89: * * ** - .byte %10000111 ; 0C4E 2-89: * *** - .byte %11111111 ; 0C4F 2-89: ******** - - .byte %10000001 ; 0C50 2-8a: * * - .byte %10011111 ; 0C51 2-8a: * ***** - .byte %10011111 ; 0C52 2-8a: * ***** - .byte %10000111 ; 0C53 2-8a: * *** - .byte %10011111 ; 0C54 2-8a: * ***** - .byte %10011111 ; 0C55 2-8a: * ***** - .byte %10000001 ; 0C56 2-8a: * * - .byte %11111111 ; 0C57 2-8a: ******** - - .byte %10000001 ; 0C58 2-8b: * * - .byte %10011111 ; 0C59 2-8b: * ***** - .byte %10011111 ; 0C5A 2-8b: * ***** - .byte %10000111 ; 0C5B 2-8b: * *** - .byte %10011111 ; 0C5C 2-8b: * ***** - .byte %10011111 ; 0C5D 2-8b: * ***** - .byte %10000001 ; 0C5E 2-8b: * * - .byte %11111111 ; 0C5F 2-8b: ******** - - .byte %10000001 ; 0C60 2-8c: * * - .byte %10011111 ; 0C61 2-8c: * ***** - .byte %10011111 ; 0C62 2-8c: * ***** - .byte %10000111 ; 0C63 2-8c: * *** - .byte %10011111 ; 0C64 2-8c: * ***** - .byte %10011111 ; 0C65 2-8c: * ***** - .byte %10011111 ; 0C66 2-8c: * ***** - .byte %11111111 ; 0C67 2-8c: ******** - - .byte %10000001 ; 0C68 2-8d: * * - .byte %10011111 ; 0C69 2-8d: * ***** - .byte %10011111 ; 0C6A 2-8d: * ***** - .byte %10000111 ; 0C6B 2-8d: * *** - .byte %10011111 ; 0C6C 2-8d: * ***** - .byte %10011111 ; 0C6D 2-8d: * ***** - .byte %10011111 ; 0C6E 2-8d: * ***** - .byte %11111111 ; 0C6F 2-8d: ******** - - .byte %11000011 ; 0C70 2-8e: ** ** - .byte %10011001 ; 0C71 2-8e: * ** * - .byte %10011111 ; 0C72 2-8e: * ***** - .byte %10010001 ; 0C73 2-8e: * * * - .byte %10011001 ; 0C74 2-8e: * ** * - .byte %10011001 ; 0C75 2-8e: * ** * - .byte %11000011 ; 0C76 2-8e: ** ** - .byte %11111111 ; 0C77 2-8e: ******** - - .byte %11000011 ; 0C78 2-8f: ** ** - .byte %10011001 ; 0C79 2-8f: * ** * - .byte %10011111 ; 0C7A 2-8f: * ***** - .byte %10010001 ; 0C7B 2-8f: * * * - .byte %10011001 ; 0C7C 2-8f: * ** * - .byte %10011001 ; 0C7D 2-8f: * ** * - .byte %11000011 ; 0C7E 2-8f: ** ** - .byte %11111111 ; 0C7F 2-8f: ******** - - .byte %10011001 ; 0C80 2-90: * ** * - .byte %10011001 ; 0C81 2-90: * ** * - .byte %10011001 ; 0C82 2-90: * ** * - .byte %10000001 ; 0C83 2-90: * * - .byte %10011001 ; 0C84 2-90: * ** * - .byte %10011001 ; 0C85 2-90: * ** * - .byte %10011001 ; 0C86 2-90: * ** * - .byte %11111111 ; 0C87 2-90: ******** - - .byte %10011001 ; 0C88 2-91: * ** * - .byte %10011001 ; 0C89 2-91: * ** * - .byte %10011001 ; 0C8A 2-91: * ** * - .byte %10000001 ; 0C8B 2-91: * * - .byte %10011001 ; 0C8C 2-91: * ** * - .byte %10011001 ; 0C8D 2-91: * ** * - .byte %10011001 ; 0C8E 2-91: * ** * - .byte %11111111 ; 0C8F 2-91: ******** - - .byte %11000011 ; 0C90 2-92: ** ** - .byte %11100111 ; 0C91 2-92: *** *** - .byte %11100111 ; 0C92 2-92: *** *** - .byte %11100111 ; 0C93 2-92: *** *** - .byte %11100111 ; 0C94 2-92: *** *** - .byte %11100111 ; 0C95 2-92: *** *** - .byte %11000011 ; 0C96 2-92: ** ** - .byte %11111111 ; 0C97 2-92: ******** - - .byte %11000011 ; 0C98 2-93: ** ** - .byte %11100111 ; 0C99 2-93: *** *** - .byte %11100111 ; 0C9A 2-93: *** *** - .byte %11100111 ; 0C9B 2-93: *** *** - .byte %11100111 ; 0C9C 2-93: *** *** - .byte %11100111 ; 0C9D 2-93: *** *** - .byte %11000011 ; 0C9E 2-93: ** ** - .byte %11111111 ; 0C9F 2-93: ******** - - .byte %11100001 ; 0CA0 2-94: *** * - .byte %11110011 ; 0CA1 2-94: **** ** - .byte %11110011 ; 0CA2 2-94: **** ** - .byte %11110011 ; 0CA3 2-94: **** ** - .byte %11110011 ; 0CA4 2-94: **** ** - .byte %10010011 ; 0CA5 2-94: * * ** - .byte %11000111 ; 0CA6 2-94: ** *** - .byte %11111111 ; 0CA7 2-94: ******** - - .byte %11100001 ; 0CA8 2-95: *** * - .byte %11110011 ; 0CA9 2-95: **** ** - .byte %11110011 ; 0CAA 2-95: **** ** - .byte %11110011 ; 0CAB 2-95: **** ** - .byte %11110011 ; 0CAC 2-95: **** ** - .byte %10010011 ; 0CAD 2-95: * * ** - .byte %11000111 ; 0CAE 2-95: ** *** - .byte %11111111 ; 0CAF 2-95: ******** - - .byte %10011001 ; 0CB0 2-96: * ** * - .byte %10010011 ; 0CB1 2-96: * * ** - .byte %10000111 ; 0CB2 2-96: * *** - .byte %10001111 ; 0CB3 2-96: * **** - .byte %10000111 ; 0CB4 2-96: * *** - .byte %10010011 ; 0CB5 2-96: * * ** - .byte %10011001 ; 0CB6 2-96: * ** * - .byte %11111111 ; 0CB7 2-96: ******** - - .byte %10011001 ; 0CB8 2-97: * ** * - .byte %10010011 ; 0CB9 2-97: * * ** - .byte %10000111 ; 0CBA 2-97: * *** - .byte %10001111 ; 0CBB 2-97: * **** - .byte %10000111 ; 0CBC 2-97: * *** - .byte %10010011 ; 0CBD 2-97: * * ** - .byte %10011001 ; 0CBE 2-97: * ** * - .byte %11111111 ; 0CBF 2-97: ******** - - .byte %10011111 ; 0CC0 2-98: * ***** - .byte %10011111 ; 0CC1 2-98: * ***** - .byte %10011111 ; 0CC2 2-98: * ***** - .byte %10011111 ; 0CC3 2-98: * ***** - .byte %10011111 ; 0CC4 2-98: * ***** - .byte %10011111 ; 0CC5 2-98: * ***** - .byte %10000001 ; 0CC6 2-98: * * - .byte %11111111 ; 0CC7 2-98: ******** - - .byte %10011111 ; 0CC8 2-99: * ***** - .byte %10011111 ; 0CC9 2-99: * ***** - .byte %10011111 ; 0CCA 2-99: * ***** - .byte %10011111 ; 0CCB 2-99: * ***** - .byte %10011111 ; 0CCC 2-99: * ***** - .byte %10011111 ; 0CCD 2-99: * ***** - .byte %10000001 ; 0CCE 2-99: * * - .byte %11111111 ; 0CCF 2-99: ******** - - .byte %10011100 ; 0CD0 2-9a: * *** - .byte %10001000 ; 0CD1 2-9a: * * - .byte %10000000 ; 0CD2 2-9a: * - .byte %10010100 ; 0CD3 2-9a: * * * - .byte %10011100 ; 0CD4 2-9a: * *** - .byte %10011100 ; 0CD5 2-9a: * *** - .byte %10011100 ; 0CD6 2-9a: * *** - .byte %11111111 ; 0CD7 2-9a: ******** - - .byte %10011100 ; 0CD8 2-9b: * *** - .byte %10001000 ; 0CD9 2-9b: * * - .byte %10000000 ; 0CDA 2-9b: * - .byte %10010100 ; 0CDB 2-9b: * * * - .byte %10011100 ; 0CDC 2-9b: * *** - .byte %10011100 ; 0CDD 2-9b: * *** - .byte %10011100 ; 0CDE 2-9b: * *** - .byte %11111111 ; 0CDF 2-9b: ******** - - .byte %10011001 ; 0CE0 2-9c: * ** * - .byte %10001001 ; 0CE1 2-9c: * * * - .byte %10000001 ; 0CE2 2-9c: * * - .byte %10000001 ; 0CE3 2-9c: * * - .byte %10010001 ; 0CE4 2-9c: * * * - .byte %10011001 ; 0CE5 2-9c: * ** * - .byte %10011001 ; 0CE6 2-9c: * ** * - .byte %11111111 ; 0CE7 2-9c: ******** - - .byte %10011001 ; 0CE8 2-9d: * ** * - .byte %10001001 ; 0CE9 2-9d: * * * - .byte %10000001 ; 0CEA 2-9d: * * - .byte %10000001 ; 0CEB 2-9d: * * - .byte %10010001 ; 0CEC 2-9d: * * * - .byte %10011001 ; 0CED 2-9d: * ** * - .byte %10011001 ; 0CEE 2-9d: * ** * - .byte %11111111 ; 0CEF 2-9d: ******** - - .byte %11000011 ; 0CF0 2-9e: ** ** - .byte %10011001 ; 0CF1 2-9e: * ** * - .byte %10011001 ; 0CF2 2-9e: * ** * - .byte %10011001 ; 0CF3 2-9e: * ** * - .byte %10011001 ; 0CF4 2-9e: * ** * - .byte %10011001 ; 0CF5 2-9e: * ** * - .byte %11000011 ; 0CF6 2-9e: ** ** - .byte %11111111 ; 0CF7 2-9e: ******** - - .byte %11000011 ; 0CF8 2-9f: ** ** - .byte %10011001 ; 0CF9 2-9f: * ** * - .byte %10011001 ; 0CFA 2-9f: * ** * - .byte %10011001 ; 0CFB 2-9f: * ** * - .byte %10011001 ; 0CFC 2-9f: * ** * - .byte %10011001 ; 0CFD 2-9f: * ** * - .byte %11000011 ; 0CFE 2-9f: ** ** - .byte %11111111 ; 0CFF 2-9f: ******** - - .byte %10000011 ; 0D00 2-a0: * ** - .byte %10011001 ; 0D01 2-a0: * ** * - .byte %10011001 ; 0D02 2-a0: * ** * - .byte %10000011 ; 0D03 2-a0: * ** - .byte %10011111 ; 0D04 2-a0: * ***** - .byte %10011111 ; 0D05 2-a0: * ***** - .byte %10011111 ; 0D06 2-a0: * ***** - .byte %11111111 ; 0D07 2-a0: ******** - - .byte %10000011 ; 0D08 2-a1: * ** - .byte %10011001 ; 0D09 2-a1: * ** * - .byte %10011001 ; 0D0A 2-a1: * ** * - .byte %10000011 ; 0D0B 2-a1: * ** - .byte %10011111 ; 0D0C 2-a1: * ***** - .byte %10011111 ; 0D0D 2-a1: * ***** - .byte %10011111 ; 0D0E 2-a1: * ***** - .byte %11111111 ; 0D0F 2-a1: ******** - - .byte %11000011 ; 0D10 2-a2: ** ** - .byte %10011001 ; 0D11 2-a2: * ** * - .byte %10011001 ; 0D12 2-a2: * ** * - .byte %10011001 ; 0D13 2-a2: * ** * - .byte %10011001 ; 0D14 2-a2: * ** * - .byte %11000011 ; 0D15 2-a2: ** ** - .byte %11110001 ; 0D16 2-a2: **** * - .byte %11111111 ; 0D17 2-a2: ******** - - .byte %11000011 ; 0D18 2-a3: ** ** - .byte %10011001 ; 0D19 2-a3: * ** * - .byte %10011001 ; 0D1A 2-a3: * ** * - .byte %10011001 ; 0D1B 2-a3: * ** * - .byte %10011001 ; 0D1C 2-a3: * ** * - .byte %11000011 ; 0D1D 2-a3: ** ** - .byte %11110001 ; 0D1E 2-a3: **** * - .byte %11111111 ; 0D1F 2-a3: ******** - - .byte %10000011 ; 0D20 2-a4: * ** - .byte %10011001 ; 0D21 2-a4: * ** * - .byte %10011001 ; 0D22 2-a4: * ** * - .byte %10000011 ; 0D23 2-a4: * ** - .byte %10000111 ; 0D24 2-a4: * *** - .byte %10010011 ; 0D25 2-a4: * * ** - .byte %10011001 ; 0D26 2-a4: * ** * - .byte %11111111 ; 0D27 2-a4: ******** - - .byte %10000011 ; 0D28 2-a5: * ** - .byte %10011001 ; 0D29 2-a5: * ** * - .byte %10011001 ; 0D2A 2-a5: * ** * - .byte %10000011 ; 0D2B 2-a5: * ** - .byte %10000111 ; 0D2C 2-a5: * *** - .byte %10010011 ; 0D2D 2-a5: * * ** - .byte %10011001 ; 0D2E 2-a5: * ** * - .byte %11111111 ; 0D2F 2-a5: ******** - - .byte %11000011 ; 0D30 2-a6: ** ** - .byte %10011001 ; 0D31 2-a6: * ** * - .byte %10011111 ; 0D32 2-a6: * ***** - .byte %11000011 ; 0D33 2-a6: ** ** - .byte %11111001 ; 0D34 2-a6: ***** * - .byte %10011001 ; 0D35 2-a6: * ** * - .byte %11000011 ; 0D36 2-a6: ** ** - .byte %11111111 ; 0D37 2-a6: ******** - - .byte %11000011 ; 0D38 2-a7: ** ** - .byte %10011001 ; 0D39 2-a7: * ** * - .byte %10011111 ; 0D3A 2-a7: * ***** - .byte %11000011 ; 0D3B 2-a7: ** ** - .byte %11111001 ; 0D3C 2-a7: ***** * - .byte %10011001 ; 0D3D 2-a7: * ** * - .byte %11000011 ; 0D3E 2-a7: ** ** - .byte %11111111 ; 0D3F 2-a7: ******** - - .byte %10000001 ; 0D40 2-a8: * * - .byte %11100111 ; 0D41 2-a8: *** *** - .byte %11100111 ; 0D42 2-a8: *** *** - .byte %11100111 ; 0D43 2-a8: *** *** - .byte %11100111 ; 0D44 2-a8: *** *** - .byte %11100111 ; 0D45 2-a8: *** *** - .byte %11100111 ; 0D46 2-a8: *** *** - .byte %11111111 ; 0D47 2-a8: ******** - - .byte %10000001 ; 0D48 2-a9: * * - .byte %11100111 ; 0D49 2-a9: *** *** - .byte %11100111 ; 0D4A 2-a9: *** *** - .byte %11100111 ; 0D4B 2-a9: *** *** - .byte %11100111 ; 0D4C 2-a9: *** *** - .byte %11100111 ; 0D4D 2-a9: *** *** - .byte %11100111 ; 0D4E 2-a9: *** *** - .byte %11111111 ; 0D4F 2-a9: ******** - - .byte %10011001 ; 0D50 2-aa: * ** * - .byte %10011001 ; 0D51 2-aa: * ** * - .byte %10011001 ; 0D52 2-aa: * ** * - .byte %10011001 ; 0D53 2-aa: * ** * - .byte %10011001 ; 0D54 2-aa: * ** * - .byte %10011001 ; 0D55 2-aa: * ** * - .byte %11000011 ; 0D56 2-aa: ** ** - .byte %11111111 ; 0D57 2-aa: ******** - - .byte %10011001 ; 0D58 2-ab: * ** * - .byte %10011001 ; 0D59 2-ab: * ** * - .byte %10011001 ; 0D5A 2-ab: * ** * - .byte %10011001 ; 0D5B 2-ab: * ** * - .byte %10011001 ; 0D5C 2-ab: * ** * - .byte %10011001 ; 0D5D 2-ab: * ** * - .byte %11000011 ; 0D5E 2-ab: ** ** - .byte %11111111 ; 0D5F 2-ab: ******** - - .byte %10011001 ; 0D60 2-ac: * ** * - .byte %10011001 ; 0D61 2-ac: * ** * - .byte %10011001 ; 0D62 2-ac: * ** * - .byte %10011001 ; 0D63 2-ac: * ** * - .byte %10011001 ; 0D64 2-ac: * ** * - .byte %11000011 ; 0D65 2-ac: ** ** - .byte %11100111 ; 0D66 2-ac: *** *** - .byte %11111111 ; 0D67 2-ac: ******** - - .byte %10011001 ; 0D68 2-ad: * ** * - .byte %10011001 ; 0D69 2-ad: * ** * - .byte %10011001 ; 0D6A 2-ad: * ** * - .byte %10011001 ; 0D6B 2-ad: * ** * - .byte %10011001 ; 0D6C 2-ad: * ** * - .byte %11000011 ; 0D6D 2-ad: ** ** - .byte %11100111 ; 0D6E 2-ad: *** *** - .byte %11111111 ; 0D6F 2-ad: ******** - - .byte %10011100 ; 0D70 2-ae: * *** - .byte %10011100 ; 0D71 2-ae: * *** - .byte %10011100 ; 0D72 2-ae: * *** - .byte %10010100 ; 0D73 2-ae: * * * - .byte %10000000 ; 0D74 2-ae: * - .byte %10001000 ; 0D75 2-ae: * * - .byte %10011100 ; 0D76 2-ae: * *** - .byte %11111111 ; 0D77 2-ae: ******** - - .byte %10011100 ; 0D78 2-af: * *** - .byte %10011100 ; 0D79 2-af: * *** - .byte %10011100 ; 0D7A 2-af: * *** - .byte %10010100 ; 0D7B 2-af: * * * - .byte %10000000 ; 0D7C 2-af: * - .byte %10001000 ; 0D7D 2-af: * * - .byte %10011100 ; 0D7E 2-af: * *** - .byte %11111111 ; 0D7F 2-af: ******** - - .byte %10011001 ; 0D80 2-b0: * ** * - .byte %10011001 ; 0D81 2-b0: * ** * - .byte %11000011 ; 0D82 2-b0: ** ** - .byte %11100111 ; 0D83 2-b0: *** *** - .byte %11000011 ; 0D84 2-b0: ** ** - .byte %10011001 ; 0D85 2-b0: * ** * - .byte %10011001 ; 0D86 2-b0: * ** * - .byte %11111111 ; 0D87 2-b0: ******** - - .byte %10011001 ; 0D88 2-b1: * ** * - .byte %10011001 ; 0D89 2-b1: * ** * - .byte %11000011 ; 0D8A 2-b1: ** ** - .byte %11100111 ; 0D8B 2-b1: *** *** - .byte %11000011 ; 0D8C 2-b1: ** ** - .byte %10011001 ; 0D8D 2-b1: * ** * - .byte %10011001 ; 0D8E 2-b1: * ** * - .byte %11111111 ; 0D8F 2-b1: ******** - - .byte %10011001 ; 0D90 2-b2: * ** * - .byte %10011001 ; 0D91 2-b2: * ** * - .byte %10011001 ; 0D92 2-b2: * ** * - .byte %11000011 ; 0D93 2-b2: ** ** - .byte %11100111 ; 0D94 2-b2: *** *** - .byte %11100111 ; 0D95 2-b2: *** *** - .byte %11100111 ; 0D96 2-b2: *** *** - .byte %11111111 ; 0D97 2-b2: ******** - - .byte %10011001 ; 0D98 2-b3: * ** * - .byte %10011001 ; 0D99 2-b3: * ** * - .byte %10011001 ; 0D9A 2-b3: * ** * - .byte %11000011 ; 0D9B 2-b3: ** ** - .byte %11100111 ; 0D9C 2-b3: *** *** - .byte %11100111 ; 0D9D 2-b3: *** *** - .byte %11100111 ; 0D9E 2-b3: *** *** - .byte %11111111 ; 0D9F 2-b3: ******** - - .byte %10000001 ; 0DA0 2-b4: * * - .byte %11111001 ; 0DA1 2-b4: ***** * - .byte %11110011 ; 0DA2 2-b4: **** ** - .byte %11100111 ; 0DA3 2-b4: *** *** - .byte %11001111 ; 0DA4 2-b4: ** **** - .byte %10011111 ; 0DA5 2-b4: * ***** - .byte %10000001 ; 0DA6 2-b4: * * - .byte %11111111 ; 0DA7 2-b4: ******** - - .byte %10000001 ; 0DA8 2-b5: * * - .byte %11111001 ; 0DA9 2-b5: ***** * - .byte %11110011 ; 0DAA 2-b5: **** ** - .byte %11100111 ; 0DAB 2-b5: *** *** - .byte %11001111 ; 0DAC 2-b5: ** **** - .byte %10011111 ; 0DAD 2-b5: * ***** - .byte %10000001 ; 0DAE 2-b5: * * - .byte %11111111 ; 0DAF 2-b5: ******** - - .byte %11000011 ; 0DB0 2-b6: ** ** - .byte %11001111 ; 0DB1 2-b6: ** **** - .byte %11001111 ; 0DB2 2-b6: ** **** - .byte %11001111 ; 0DB3 2-b6: ** **** - .byte %11001111 ; 0DB4 2-b6: ** **** - .byte %11001111 ; 0DB5 2-b6: ** **** - .byte %11000011 ; 0DB6 2-b6: ** ** - .byte %11111111 ; 0DB7 2-b6: ******** - - .byte %11000011 ; 0DB8 2-b7: ** ** - .byte %11001111 ; 0DB9 2-b7: ** **** - .byte %11001111 ; 0DBA 2-b7: ** **** - .byte %11001111 ; 0DBB 2-b7: ** **** - .byte %11001111 ; 0DBC 2-b7: ** **** - .byte %11001111 ; 0DBD 2-b7: ** **** - .byte %11000011 ; 0DBE 2-b7: ** ** - .byte %11111111 ; 0DBF 2-b7: ******** - - .byte %10011111 ; 0DC0 2-b8: * ***** - .byte %11001111 ; 0DC1 2-b8: ** **** - .byte %11100111 ; 0DC2 2-b8: *** *** - .byte %11110011 ; 0DC3 2-b8: **** ** - .byte %11111001 ; 0DC4 2-b8: ***** * - .byte %11111100 ; 0DC5 2-b8: ****** - .byte %11111111 ; 0DC6 2-b8: ******** - .byte %11111111 ; 0DC7 2-b8: ******** - - .byte %10011111 ; 0DC8 2-b9: * ***** - .byte %11001111 ; 0DC9 2-b9: ** **** - .byte %11100111 ; 0DCA 2-b9: *** *** - .byte %11110011 ; 0DCB 2-b9: **** ** - .byte %11111001 ; 0DCC 2-b9: ***** * - .byte %11111100 ; 0DCD 2-b9: ****** - .byte %11111111 ; 0DCE 2-b9: ******** - .byte %11111111 ; 0DCF 2-b9: ******** - - .byte %11000011 ; 0DD0 2-ba: ** ** - .byte %11110011 ; 0DD1 2-ba: **** ** - .byte %11110011 ; 0DD2 2-ba: **** ** - .byte %11110011 ; 0DD3 2-ba: **** ** - .byte %11110011 ; 0DD4 2-ba: **** ** - .byte %11110011 ; 0DD5 2-ba: **** ** - .byte %11000011 ; 0DD6 2-ba: ** ** - .byte %11111111 ; 0DD7 2-ba: ******** - - .byte %11000011 ; 0DD8 2-bb: ** ** - .byte %11110011 ; 0DD9 2-bb: **** ** - .byte %11110011 ; 0DDA 2-bb: **** ** - .byte %11110011 ; 0DDB 2-bb: **** ** - .byte %11110011 ; 0DDC 2-bb: **** ** - .byte %11110011 ; 0DDD 2-bb: **** ** - .byte %11000011 ; 0DDE 2-bb: ** ** - .byte %11111111 ; 0DDF 2-bb: ******** - - .byte %11111111 ; 0DE0 2-bc: ******** - .byte %11100111 ; 0DE1 2-bc: *** *** - .byte %11000011 ; 0DE2 2-bc: ** ** - .byte %10011001 ; 0DE3 2-bc: * ** * - .byte %11111111 ; 0DE4 2-bc: ******** - .byte %11111111 ; 0DE5 2-bc: ******** - .byte %11111111 ; 0DE6 2-bc: ******** - .byte %11111111 ; 0DE7 2-bc: ******** - - .byte %11111111 ; 0DE8 2-bd: ******** - .byte %11100111 ; 0DE9 2-bd: *** *** - .byte %11000011 ; 0DEA 2-bd: ** ** - .byte %10011001 ; 0DEB 2-bd: * ** * - .byte %11111111 ; 0DEC 2-bd: ******** - .byte %11111111 ; 0DED 2-bd: ******** - .byte %11111111 ; 0DEE 2-bd: ******** - .byte %11111111 ; 0DEF 2-bd: ******** - - .byte %11111111 ; 0DF0 2-be: ******** - .byte %11111111 ; 0DF1 2-be: ******** - .byte %11111111 ; 0DF2 2-be: ******** - .byte %11111111 ; 0DF3 2-be: ******** - .byte %11111111 ; 0DF4 2-be: ******** - .byte %11111111 ; 0DF5 2-be: ******** - .byte %10000000 ; 0DF6 2-be: * - .byte %11111111 ; 0DF7 2-be: ******** - - .byte %11111111 ; 0DF8 2-bf: ******** - .byte %11111111 ; 0DF9 2-bf: ******** - .byte %11111111 ; 0DFA 2-bf: ******** - .byte %11111111 ; 0DFB 2-bf: ******** - .byte %11111111 ; 0DFC 2-bf: ******** - .byte %11111111 ; 0DFD 2-bf: ******** - .byte %10000000 ; 0DFE 2-bf: * - .byte %11111111 ; 0DFF 2-bf: ******** - - .byte %11100111 ; 0E00 2-c0: *** *** - .byte %11100111 ; 0E01 2-c0: *** *** - .byte %11100111 ; 0E02 2-c0: *** *** - .byte %11111111 ; 0E03 2-c0: ******** - .byte %11111111 ; 0E04 2-c0: ******** - .byte %11111111 ; 0E05 2-c0: ******** - .byte %11111111 ; 0E06 2-c0: ******** - .byte %11111111 ; 0E07 2-c0: ******** - - .byte %11100111 ; 0E08 2-c1: *** *** - .byte %11100111 ; 0E09 2-c1: *** *** - .byte %11100111 ; 0E0A 2-c1: *** *** - .byte %11111111 ; 0E0B 2-c1: ******** - .byte %11111111 ; 0E0C 2-c1: ******** - .byte %11111111 ; 0E0D 2-c1: ******** - .byte %11111111 ; 0E0E 2-c1: ******** - .byte %11111111 ; 0E0F 2-c1: ******** - - .byte %11111111 ; 0E10 2-c2: ******** - .byte %11111111 ; 0E11 2-c2: ******** - .byte %11000011 ; 0E12 2-c2: ** ** - .byte %11111001 ; 0E13 2-c2: ***** * - .byte %11000001 ; 0E14 2-c2: ** * - .byte %10011001 ; 0E15 2-c2: * ** * - .byte %11000001 ; 0E16 2-c2: ** * - .byte %11111111 ; 0E17 2-c2: ******** - - .byte %11111111 ; 0E18 2-c3: ******** - .byte %11111111 ; 0E19 2-c3: ******** - .byte %11000011 ; 0E1A 2-c3: ** ** - .byte %11111001 ; 0E1B 2-c3: ***** * - .byte %11000001 ; 0E1C 2-c3: ** * - .byte %10011001 ; 0E1D 2-c3: * ** * - .byte %11000001 ; 0E1E 2-c3: ** * - .byte %11111111 ; 0E1F 2-c3: ******** - - .byte %11111111 ; 0E20 2-c4: ******** - .byte %10011111 ; 0E21 2-c4: * ***** - .byte %10011111 ; 0E22 2-c4: * ***** - .byte %10000011 ; 0E23 2-c4: * ** - .byte %10011001 ; 0E24 2-c4: * ** * - .byte %10011001 ; 0E25 2-c4: * ** * - .byte %10000011 ; 0E26 2-c4: * ** - .byte %11111111 ; 0E27 2-c4: ******** - - .byte %11111111 ; 0E28 2-c5: ******** - .byte %10011111 ; 0E29 2-c5: * ***** - .byte %10011111 ; 0E2A 2-c5: * ***** - .byte %10000011 ; 0E2B 2-c5: * ** - .byte %10011001 ; 0E2C 2-c5: * ** * - .byte %10011001 ; 0E2D 2-c5: * ** * - .byte %10000011 ; 0E2E 2-c5: * ** - .byte %11111111 ; 0E2F 2-c5: ******** - - .byte %11111111 ; 0E30 2-c6: ******** - .byte %11111111 ; 0E31 2-c6: ******** - .byte %11000011 ; 0E32 2-c6: ** ** - .byte %10011111 ; 0E33 2-c6: * ***** - .byte %10011111 ; 0E34 2-c6: * ***** - .byte %10011111 ; 0E35 2-c6: * ***** - .byte %11000011 ; 0E36 2-c6: ** ** - .byte %11111111 ; 0E37 2-c6: ******** - - .byte %11111111 ; 0E38 2-c7: ******** - .byte %11111111 ; 0E39 2-c7: ******** - .byte %11000011 ; 0E3A 2-c7: ** ** - .byte %10011111 ; 0E3B 2-c7: * ***** - .byte %10011111 ; 0E3C 2-c7: * ***** - .byte %10011111 ; 0E3D 2-c7: * ***** - .byte %11000011 ; 0E3E 2-c7: ** ** - .byte %11111111 ; 0E3F 2-c7: ******** - - .byte %11111111 ; 0E40 2-c8: ******** - .byte %11111001 ; 0E41 2-c8: ***** * - .byte %11111001 ; 0E42 2-c8: ***** * - .byte %11000001 ; 0E43 2-c8: ** * - .byte %10011001 ; 0E44 2-c8: * ** * - .byte %10011001 ; 0E45 2-c8: * ** * - .byte %11000001 ; 0E46 2-c8: ** * - .byte %11111111 ; 0E47 2-c8: ******** - - .byte %11111111 ; 0E48 2-c9: ******** - .byte %11111001 ; 0E49 2-c9: ***** * - .byte %11111001 ; 0E4A 2-c9: ***** * - .byte %11000001 ; 0E4B 2-c9: ** * - .byte %10011001 ; 0E4C 2-c9: * ** * - .byte %10011001 ; 0E4D 2-c9: * ** * - .byte %11000001 ; 0E4E 2-c9: ** * - .byte %11111111 ; 0E4F 2-c9: ******** - - .byte %11111111 ; 0E50 2-ca: ******** - .byte %11111111 ; 0E51 2-ca: ******** - .byte %11000011 ; 0E52 2-ca: ** ** - .byte %10011001 ; 0E53 2-ca: * ** * - .byte %10000001 ; 0E54 2-ca: * * - .byte %10011111 ; 0E55 2-ca: * ***** - .byte %11000011 ; 0E56 2-ca: ** ** - .byte %11111111 ; 0E57 2-ca: ******** - - .byte %11111111 ; 0E58 2-cb: ******** - .byte %11111111 ; 0E59 2-cb: ******** - .byte %11000011 ; 0E5A 2-cb: ** ** - .byte %10011001 ; 0E5B 2-cb: * ** * - .byte %10000001 ; 0E5C 2-cb: * * - .byte %10011111 ; 0E5D 2-cb: * ***** - .byte %11000011 ; 0E5E 2-cb: ** ** - .byte %11111111 ; 0E5F 2-cb: ******** - - .byte %11111111 ; 0E60 2-cc: ******** - .byte %11110001 ; 0E61 2-cc: **** * - .byte %11100111 ; 0E62 2-cc: *** *** - .byte %11000001 ; 0E63 2-cc: ** * - .byte %11100111 ; 0E64 2-cc: *** *** - .byte %11100111 ; 0E65 2-cc: *** *** - .byte %11100111 ; 0E66 2-cc: *** *** - .byte %11111111 ; 0E67 2-cc: ******** - - .byte %11111111 ; 0E68 2-cd: ******** - .byte %11110001 ; 0E69 2-cd: **** * - .byte %11100111 ; 0E6A 2-cd: *** *** - .byte %11000001 ; 0E6B 2-cd: ** * - .byte %11100111 ; 0E6C 2-cd: *** *** - .byte %11100111 ; 0E6D 2-cd: *** *** - .byte %11100111 ; 0E6E 2-cd: *** *** - .byte %11111111 ; 0E6F 2-cd: ******** - - .byte %11111111 ; 0E70 2-ce: ******** - .byte %11111111 ; 0E71 2-ce: ******** - .byte %11000001 ; 0E72 2-ce: ** * - .byte %10011001 ; 0E73 2-ce: * ** * - .byte %10011001 ; 0E74 2-ce: * ** * - .byte %11000001 ; 0E75 2-ce: ** * - .byte %11111001 ; 0E76 2-ce: ***** * - .byte %10000011 ; 0E77 2-ce: * ** - - .byte %11111111 ; 0E78 2-cf: ******** - .byte %11111111 ; 0E79 2-cf: ******** - .byte %11000001 ; 0E7A 2-cf: ** * - .byte %10011001 ; 0E7B 2-cf: * ** * - .byte %10011001 ; 0E7C 2-cf: * ** * - .byte %11000001 ; 0E7D 2-cf: ** * - .byte %11111001 ; 0E7E 2-cf: ***** * - .byte %10000011 ; 0E7F 2-cf: * ** - - .byte %11111111 ; 0E80 2-d0: ******** - .byte %10011111 ; 0E81 2-d0: * ***** - .byte %10011111 ; 0E82 2-d0: * ***** - .byte %10000011 ; 0E83 2-d0: * ** - .byte %10011001 ; 0E84 2-d0: * ** * - .byte %10011001 ; 0E85 2-d0: * ** * - .byte %10011001 ; 0E86 2-d0: * ** * - .byte %11111111 ; 0E87 2-d0: ******** - - .byte %11111111 ; 0E88 2-d1: ******** - .byte %10011111 ; 0E89 2-d1: * ***** - .byte %10011111 ; 0E8A 2-d1: * ***** - .byte %10000011 ; 0E8B 2-d1: * ** - .byte %10011001 ; 0E8C 2-d1: * ** * - .byte %10011001 ; 0E8D 2-d1: * ** * - .byte %10011001 ; 0E8E 2-d1: * ** * - .byte %11111111 ; 0E8F 2-d1: ******** - - .byte %11111111 ; 0E90 2-d2: ******** - .byte %11100111 ; 0E91 2-d2: *** *** - .byte %11111111 ; 0E92 2-d2: ******** - .byte %11000111 ; 0E93 2-d2: ** *** - .byte %11100111 ; 0E94 2-d2: *** *** - .byte %11100111 ; 0E95 2-d2: *** *** - .byte %11000011 ; 0E96 2-d2: ** ** - .byte %11111111 ; 0E97 2-d2: ******** - - .byte %11111111 ; 0E98 2-d3: ******** - .byte %11100111 ; 0E99 2-d3: *** *** - .byte %11111111 ; 0E9A 2-d3: ******** - .byte %11000111 ; 0E9B 2-d3: ** *** - .byte %11100111 ; 0E9C 2-d3: *** *** - .byte %11100111 ; 0E9D 2-d3: *** *** - .byte %11000011 ; 0E9E 2-d3: ** ** - .byte %11111111 ; 0E9F 2-d3: ******** - - .byte %11111111 ; 0EA0 2-d4: ******** - .byte %11111001 ; 0EA1 2-d4: ***** * - .byte %11111111 ; 0EA2 2-d4: ******** - .byte %11111001 ; 0EA3 2-d4: ***** * - .byte %11111001 ; 0EA4 2-d4: ***** * - .byte %11111001 ; 0EA5 2-d4: ***** * - .byte %11111001 ; 0EA6 2-d4: ***** * - .byte %11000011 ; 0EA7 2-d4: ** ** - - .byte %11111111 ; 0EA8 2-d5: ******** - .byte %11111001 ; 0EA9 2-d5: ***** * - .byte %11111111 ; 0EAA 2-d5: ******** - .byte %11111001 ; 0EAB 2-d5: ***** * - .byte %11111001 ; 0EAC 2-d5: ***** * - .byte %11111001 ; 0EAD 2-d5: ***** * - .byte %11111001 ; 0EAE 2-d5: ***** * - .byte %11000011 ; 0EAF 2-d5: ** ** - - .byte %11111111 ; 0EB0 2-d6: ******** - .byte %10011111 ; 0EB1 2-d6: * ***** - .byte %10011111 ; 0EB2 2-d6: * ***** - .byte %10010011 ; 0EB3 2-d6: * * ** - .byte %10000111 ; 0EB4 2-d6: * *** - .byte %10010011 ; 0EB5 2-d6: * * ** - .byte %10011001 ; 0EB6 2-d6: * ** * - .byte %11111111 ; 0EB7 2-d6: ******** - - .byte %11111111 ; 0EB8 2-d7: ******** - .byte %10011111 ; 0EB9 2-d7: * ***** - .byte %10011111 ; 0EBA 2-d7: * ***** - .byte %10010011 ; 0EBB 2-d7: * * ** - .byte %10000111 ; 0EBC 2-d7: * *** - .byte %10010011 ; 0EBD 2-d7: * * ** - .byte %10011001 ; 0EBE 2-d7: * ** * - .byte %11111111 ; 0EBF 2-d7: ******** - - .byte %11111111 ; 0EC0 2-d8: ******** - .byte %11000111 ; 0EC1 2-d8: ** *** - .byte %11100111 ; 0EC2 2-d8: *** *** - .byte %11100111 ; 0EC3 2-d8: *** *** - .byte %11100111 ; 0EC4 2-d8: *** *** - .byte %11100111 ; 0EC5 2-d8: *** *** - .byte %11000011 ; 0EC6 2-d8: ** ** - .byte %11111111 ; 0EC7 2-d8: ******** - - .byte %11111111 ; 0EC8 2-d9: ******** - .byte %11000111 ; 0EC9 2-d9: ** *** - .byte %11100111 ; 0ECA 2-d9: *** *** - .byte %11100111 ; 0ECB 2-d9: *** *** - .byte %11100111 ; 0ECC 2-d9: *** *** - .byte %11100111 ; 0ECD 2-d9: *** *** - .byte %11000011 ; 0ECE 2-d9: ** ** - .byte %11111111 ; 0ECF 2-d9: ******** - - .byte %11111111 ; 0ED0 2-da: ******** - .byte %11111111 ; 0ED1 2-da: ******** - .byte %10011001 ; 0ED2 2-da: * ** * - .byte %10000000 ; 0ED3 2-da: * - .byte %10000000 ; 0ED4 2-da: * - .byte %10010100 ; 0ED5 2-da: * * * - .byte %10011100 ; 0ED6 2-da: * *** - .byte %11111111 ; 0ED7 2-da: ******** - - .byte %11111111 ; 0ED8 2-db: ******** - .byte %11111111 ; 0ED9 2-db: ******** - .byte %10011001 ; 0EDA 2-db: * ** * - .byte %10000000 ; 0EDB 2-db: * - .byte %10000000 ; 0EDC 2-db: * - .byte %10010100 ; 0EDD 2-db: * * * - .byte %10011100 ; 0EDE 2-db: * *** - .byte %11111111 ; 0EDF 2-db: ******** - - .byte %11111111 ; 0EE0 2-dc: ******** - .byte %11111111 ; 0EE1 2-dc: ******** - .byte %10000011 ; 0EE2 2-dc: * ** - .byte %10011001 ; 0EE3 2-dc: * ** * - .byte %10011001 ; 0EE4 2-dc: * ** * - .byte %10011001 ; 0EE5 2-dc: * ** * - .byte %10011001 ; 0EE6 2-dc: * ** * - .byte %11111111 ; 0EE7 2-dc: ******** - - .byte %11111111 ; 0EE8 2-dd: ******** - .byte %11111111 ; 0EE9 2-dd: ******** - .byte %10000011 ; 0EEA 2-dd: * ** - .byte %10011001 ; 0EEB 2-dd: * ** * - .byte %10011001 ; 0EEC 2-dd: * ** * - .byte %10011001 ; 0EED 2-dd: * ** * - .byte %10011001 ; 0EEE 2-dd: * ** * - .byte %11111111 ; 0EEF 2-dd: ******** - - .byte %11111111 ; 0EF0 2-de: ******** - .byte %11111111 ; 0EF1 2-de: ******** - .byte %11000011 ; 0EF2 2-de: ** ** - .byte %10011001 ; 0EF3 2-de: * ** * - .byte %10011001 ; 0EF4 2-de: * ** * - .byte %10011001 ; 0EF5 2-de: * ** * - .byte %11000011 ; 0EF6 2-de: ** ** - .byte %11111111 ; 0EF7 2-de: ******** - - .byte %11111111 ; 0EF8 2-df: ******** - .byte %11111111 ; 0EF9 2-df: ******** - .byte %11000011 ; 0EFA 2-df: ** ** - .byte %10011001 ; 0EFB 2-df: * ** * - .byte %10011001 ; 0EFC 2-df: * ** * - .byte %10011001 ; 0EFD 2-df: * ** * - .byte %11000011 ; 0EFE 2-df: ** ** - .byte %11111111 ; 0EFF 2-df: ******** - - .byte %11111111 ; 0F00 2-e0: ******** - .byte %11111111 ; 0F01 2-e0: ******** - .byte %10000011 ; 0F02 2-e0: * ** - .byte %10011001 ; 0F03 2-e0: * ** * - .byte %10011001 ; 0F04 2-e0: * ** * - .byte %10000011 ; 0F05 2-e0: * ** - .byte %10011111 ; 0F06 2-e0: * ***** - .byte %10011111 ; 0F07 2-e0: * ***** - - .byte %11111111 ; 0F08 2-e1: ******** - .byte %11111111 ; 0F09 2-e1: ******** - .byte %10000011 ; 0F0A 2-e1: * ** - .byte %10011001 ; 0F0B 2-e1: * ** * - .byte %10011001 ; 0F0C 2-e1: * ** * - .byte %10000011 ; 0F0D 2-e1: * ** - .byte %10011111 ; 0F0E 2-e1: * ***** - .byte %10011111 ; 0F0F 2-e1: * ***** - - .byte %11111111 ; 0F10 2-e2: ******** - .byte %11111111 ; 0F11 2-e2: ******** - .byte %11000001 ; 0F12 2-e2: ** * - .byte %10011001 ; 0F13 2-e2: * ** * - .byte %10011001 ; 0F14 2-e2: * ** * - .byte %11000001 ; 0F15 2-e2: ** * - .byte %11111001 ; 0F16 2-e2: ***** * - .byte %11111001 ; 0F17 2-e2: ***** * - - .byte %11111111 ; 0F18 2-e3: ******** - .byte %11111111 ; 0F19 2-e3: ******** - .byte %11000001 ; 0F1A 2-e3: ** * - .byte %10011001 ; 0F1B 2-e3: * ** * - .byte %10011001 ; 0F1C 2-e3: * ** * - .byte %11000001 ; 0F1D 2-e3: ** * - .byte %11111001 ; 0F1E 2-e3: ***** * - .byte %11111001 ; 0F1F 2-e3: ***** * - - .byte %11111111 ; 0F20 2-e4: ******** - .byte %11111111 ; 0F21 2-e4: ******** - .byte %10000011 ; 0F22 2-e4: * ** - .byte %10011001 ; 0F23 2-e4: * ** * - .byte %10011111 ; 0F24 2-e4: * ***** - .byte %10011111 ; 0F25 2-e4: * ***** - .byte %10011111 ; 0F26 2-e4: * ***** - .byte %11111111 ; 0F27 2-e4: ******** - - .byte %11111111 ; 0F28 2-e5: ******** - .byte %11111111 ; 0F29 2-e5: ******** - .byte %10000011 ; 0F2A 2-e5: * ** - .byte %10011001 ; 0F2B 2-e5: * ** * - .byte %10011111 ; 0F2C 2-e5: * ***** - .byte %10011111 ; 0F2D 2-e5: * ***** - .byte %10011111 ; 0F2E 2-e5: * ***** - .byte %11111111 ; 0F2F 2-e5: ******** - - .byte %11111111 ; 0F30 2-e6: ******** - .byte %11111111 ; 0F31 2-e6: ******** - .byte %11000001 ; 0F32 2-e6: ** * - .byte %10011111 ; 0F33 2-e6: * ***** - .byte %11000011 ; 0F34 2-e6: ** ** - .byte %11111001 ; 0F35 2-e6: ***** * - .byte %10000011 ; 0F36 2-e6: * ** - .byte %11111111 ; 0F37 2-e6: ******** - - .byte %11111111 ; 0F38 2-e7: ******** - .byte %11111111 ; 0F39 2-e7: ******** - .byte %11000001 ; 0F3A 2-e7: ** * - .byte %10011111 ; 0F3B 2-e7: * ***** - .byte %11000011 ; 0F3C 2-e7: ** ** - .byte %11111001 ; 0F3D 2-e7: ***** * - .byte %10000011 ; 0F3E 2-e7: * ** - .byte %11111111 ; 0F3F 2-e7: ******** - - .byte %11111111 ; 0F40 2-e8: ******** - .byte %11100111 ; 0F41 2-e8: *** *** - .byte %10000001 ; 0F42 2-e8: * * - .byte %11100111 ; 0F43 2-e8: *** *** - .byte %11100111 ; 0F44 2-e8: *** *** - .byte %11100111 ; 0F45 2-e8: *** *** - .byte %11110001 ; 0F46 2-e8: **** * - .byte %11111111 ; 0F47 2-e8: ******** - - .byte %11111111 ; 0F48 2-e9: ******** - .byte %11100111 ; 0F49 2-e9: *** *** - .byte %10000001 ; 0F4A 2-e9: * * - .byte %11100111 ; 0F4B 2-e9: *** *** - .byte %11100111 ; 0F4C 2-e9: *** *** - .byte %11100111 ; 0F4D 2-e9: *** *** - .byte %11110001 ; 0F4E 2-e9: **** * - .byte %11111111 ; 0F4F 2-e9: ******** - - .byte %11111111 ; 0F50 2-ea: ******** - .byte %11111111 ; 0F51 2-ea: ******** - .byte %10011001 ; 0F52 2-ea: * ** * - .byte %10011001 ; 0F53 2-ea: * ** * - .byte %10011001 ; 0F54 2-ea: * ** * - .byte %10011001 ; 0F55 2-ea: * ** * - .byte %11000001 ; 0F56 2-ea: ** * - .byte %11111111 ; 0F57 2-ea: ******** - - .byte %11111111 ; 0F58 2-eb: ******** - .byte %11111111 ; 0F59 2-eb: ******** - .byte %10011001 ; 0F5A 2-eb: * ** * - .byte %10011001 ; 0F5B 2-eb: * ** * - .byte %10011001 ; 0F5C 2-eb: * ** * - .byte %10011001 ; 0F5D 2-eb: * ** * - .byte %11000001 ; 0F5E 2-eb: ** * - .byte %11111111 ; 0F5F 2-eb: ******** - - .byte %11111111 ; 0F60 2-ec: ******** - .byte %11111111 ; 0F61 2-ec: ******** - .byte %10011001 ; 0F62 2-ec: * ** * - .byte %10011001 ; 0F63 2-ec: * ** * - .byte %10011001 ; 0F64 2-ec: * ** * - .byte %11000011 ; 0F65 2-ec: ** ** - .byte %11100111 ; 0F66 2-ec: *** *** - .byte %11111111 ; 0F67 2-ec: ******** - - .byte %11111111 ; 0F68 2-ed: ******** - .byte %11111111 ; 0F69 2-ed: ******** - .byte %10011001 ; 0F6A 2-ed: * ** * - .byte %10011001 ; 0F6B 2-ed: * ** * - .byte %10011001 ; 0F6C 2-ed: * ** * - .byte %11000011 ; 0F6D 2-ed: ** ** - .byte %11100111 ; 0F6E 2-ed: *** *** - .byte %11111111 ; 0F6F 2-ed: ******** - - .byte %11111111 ; 0F70 2-ee: ******** - .byte %11111111 ; 0F71 2-ee: ******** - .byte %10011100 ; 0F72 2-ee: * *** - .byte %10010100 ; 0F73 2-ee: * * * - .byte %10000000 ; 0F74 2-ee: * - .byte %11000001 ; 0F75 2-ee: ** * - .byte %11001001 ; 0F76 2-ee: ** * * - .byte %11111111 ; 0F77 2-ee: ******** - - .byte %11111111 ; 0F78 2-ef: ******** - .byte %11111111 ; 0F79 2-ef: ******** - .byte %10011100 ; 0F7A 2-ef: * *** - .byte %10010100 ; 0F7B 2-ef: * * * - .byte %10000000 ; 0F7C 2-ef: * - .byte %11000001 ; 0F7D 2-ef: ** * - .byte %11001001 ; 0F7E 2-ef: ** * * - .byte %11111111 ; 0F7F 2-ef: ******** - - .byte %11111111 ; 0F80 2-f0: ******** - .byte %11111111 ; 0F81 2-f0: ******** - .byte %10011001 ; 0F82 2-f0: * ** * - .byte %11000011 ; 0F83 2-f0: ** ** - .byte %11100111 ; 0F84 2-f0: *** *** - .byte %11000011 ; 0F85 2-f0: ** ** - .byte %10011001 ; 0F86 2-f0: * ** * - .byte %11111111 ; 0F87 2-f0: ******** - - .byte %11111111 ; 0F88 2-f1: ******** - .byte %11111111 ; 0F89 2-f1: ******** - .byte %10011001 ; 0F8A 2-f1: * ** * - .byte %11000011 ; 0F8B 2-f1: ** ** - .byte %11100111 ; 0F8C 2-f1: *** *** - .byte %11000011 ; 0F8D 2-f1: ** ** - .byte %10011001 ; 0F8E 2-f1: * ** * - .byte %11111111 ; 0F8F 2-f1: ******** - - .byte %11111111 ; 0F90 2-f2: ******** - .byte %11111111 ; 0F91 2-f2: ******** - .byte %10011001 ; 0F92 2-f2: * ** * - .byte %10011001 ; 0F93 2-f2: * ** * - .byte %10011001 ; 0F94 2-f2: * ** * - .byte %11000001 ; 0F95 2-f2: ** * - .byte %11110011 ; 0F96 2-f2: **** ** - .byte %10000111 ; 0F97 2-f2: * *** - - .byte %11111111 ; 0F98 2-f3: ******** - .byte %11111111 ; 0F99 2-f3: ******** - .byte %10011001 ; 0F9A 2-f3: * ** * - .byte %10011001 ; 0F9B 2-f3: * ** * - .byte %10011001 ; 0F9C 2-f3: * ** * - .byte %11000001 ; 0F9D 2-f3: ** * - .byte %11110011 ; 0F9E 2-f3: **** ** - .byte %10000111 ; 0F9F 2-f3: * *** - - .byte %11111111 ; 0FA0 2-f4: ******** - .byte %11111111 ; 0FA1 2-f4: ******** - .byte %10000001 ; 0FA2 2-f4: * * - .byte %11110011 ; 0FA3 2-f4: **** ** - .byte %11100111 ; 0FA4 2-f4: *** *** - .byte %11001111 ; 0FA5 2-f4: ** **** - .byte %10000001 ; 0FA6 2-f4: * * - .byte %11111111 ; 0FA7 2-f4: ******** - - .byte %11111111 ; 0FA8 2-f5: ******** - .byte %11111111 ; 0FA9 2-f5: ******** - .byte %10000001 ; 0FAA 2-f5: * * - .byte %11110011 ; 0FAB 2-f5: **** ** - .byte %11100111 ; 0FAC 2-f5: *** *** - .byte %11001111 ; 0FAD 2-f5: ** **** - .byte %10000001 ; 0FAE 2-f5: * * - .byte %11111111 ; 0FAF 2-f5: ******** - - .byte %11100011 ; 0FB0 2-f6: *** ** - .byte %11001111 ; 0FB1 2-f6: ** **** - .byte %11100111 ; 0FB2 2-f6: *** *** - .byte %10001111 ; 0FB3 2-f6: * **** - .byte %11100111 ; 0FB4 2-f6: *** *** - .byte %11001111 ; 0FB5 2-f6: ** **** - .byte %11100011 ; 0FB6 2-f6: *** ** - .byte %11111111 ; 0FB7 2-f6: ******** - - .byte %11100011 ; 0FB8 2-f7: *** ** - .byte %11001111 ; 0FB9 2-f7: ** **** - .byte %11100111 ; 0FBA 2-f7: *** *** - .byte %10001111 ; 0FBB 2-f7: * **** - .byte %11100111 ; 0FBC 2-f7: *** *** - .byte %11001111 ; 0FBD 2-f7: ** **** - .byte %11100011 ; 0FBE 2-f7: *** ** - .byte %11111111 ; 0FBF 2-f7: ******** - - .byte %11100111 ; 0FC0 2-f8: *** *** - .byte %11100111 ; 0FC1 2-f8: *** *** - .byte %11100111 ; 0FC2 2-f8: *** *** - .byte %11111111 ; 0FC3 2-f8: ******** - .byte %11111111 ; 0FC4 2-f8: ******** - .byte %11100111 ; 0FC5 2-f8: *** *** - .byte %11100111 ; 0FC6 2-f8: *** *** - .byte %11100111 ; 0FC7 2-f8: *** *** - - .byte %11100111 ; 0FC8 2-f9: *** *** - .byte %11100111 ; 0FC9 2-f9: *** *** - .byte %11100111 ; 0FCA 2-f9: *** *** - .byte %11111111 ; 0FCB 2-f9: ******** - .byte %11111111 ; 0FCC 2-f9: ******** - .byte %11100111 ; 0FCD 2-f9: *** *** - .byte %11100111 ; 0FCE 2-f9: *** *** - .byte %11100111 ; 0FCF 2-f9: *** *** - - .byte %11000111 ; 0FD0 2-fa: ** *** - .byte %11110011 ; 0FD1 2-fa: **** ** - .byte %11100111 ; 0FD2 2-fa: *** *** - .byte %11110001 ; 0FD3 2-fa: **** * - .byte %11100111 ; 0FD4 2-fa: *** *** - .byte %11110011 ; 0FD5 2-fa: **** ** - .byte %11000111 ; 0FD6 2-fa: ** *** - .byte %11111111 ; 0FD7 2-fa: ******** - - .byte %11000111 ; 0FD8 2-fb: ** *** - .byte %11110011 ; 0FD9 2-fb: **** ** - .byte %11100111 ; 0FDA 2-fb: *** *** - .byte %11110001 ; 0FDB 2-fb: **** * - .byte %11100111 ; 0FDC 2-fb: *** *** - .byte %11110011 ; 0FDD 2-fb: **** ** - .byte %11000111 ; 0FDE 2-fb: ** *** - .byte %11111111 ; 0FDF 2-fb: ******** - - .byte %11001100 ; 0FE0 2-fc: ** ** - .byte %00000000 ; 0FE1 2-fc: - .byte %00110011 ; 0FE2 2-fc: ** ** - .byte %11111111 ; 0FE3 2-fc: ******** - .byte %11111111 ; 0FE4 2-fc: ******** - .byte %11111111 ; 0FE5 2-fc: ******** - .byte %11111111 ; 0FE6 2-fc: ******** - .byte %11111111 ; 0FE7 2-fc: ******** - - .byte %11001100 ; 0FE8 2-fd: ** ** - .byte %00000000 ; 0FE9 2-fd: - .byte %00110011 ; 0FEA 2-fd: ** ** - .byte %11111111 ; 0FEB 2-fd: ******** - .byte %11111111 ; 0FEC 2-fd: ******** - .byte %11111111 ; 0FED 2-fd: ******** - .byte %11111111 ; 0FEE 2-fd: ******** - .byte %11111111 ; 0FEF 2-fd: ******** - - .byte %11111111 ; 0FF0 2-fe: ******** - .byte %11111111 ; 0FF1 2-fe: ******** - .byte %11111111 ; 0FF2 2-fe: ******** - .byte %11111111 ; 0FF3 2-fe: ******** - .byte %11111111 ; 0FF4 2-fe: ******** - .byte %11111111 ; 0FF5 2-fe: ******** - .byte %11111111 ; 0FF6 2-fe: ******** - .byte %11111111 ; 0FF7 2-fe: ******** - - .byte %11111111 ; 0FF8 2-ff: ******** - .byte %11111111 ; 0FF9 2-ff: ******** - .byte %11111111 ; 0FFA 2-ff: ******** - .byte %11111111 ; 0FFB 2-ff: ******** - .byte %11111111 ; 0FFC 2-ff: ******** - .byte %11111111 ; 0FFD 2-ff: ******** - .byte %11111111 ; 0FFE 2-ff: ******** - .byte %11111111 ; 0FFF 2-ff: ******** + .byte %00000000 ; 0000 1-00: + .byte %00000000 ; 0001 1-00: + .byte %00000000 ; 0002 1-00: + .byte %00000000 ; 0003 1-00: + .byte %00000000 ; 0004 1-00: + .byte %00000000 ; 0005 1-00: + .byte %00000000 ; 0006 1-00: + .byte %00000000 ; 0007 1-00: + + .byte %00000000 ; 0008 1-01: + .byte %00000000 ; 0009 1-01: + .byte %00000000 ; 000A 1-01: + .byte %00000000 ; 000B 1-01: + .byte %00000000 ; 000C 1-01: + .byte %00000000 ; 000D 1-01: + .byte %00000000 ; 000E 1-01: + .byte %00000000 ; 000F 1-01: + + .byte %11001100 ; 0010 1-02: ** ** + .byte %11001100 ; 0011 1-02: ** ** + .byte %00110011 ; 0012 1-02: ** ** + .byte %00110011 ; 0013 1-02: ** ** + .byte %11001100 ; 0014 1-02: ** ** + .byte %11001100 ; 0015 1-02: ** ** + .byte %00110011 ; 0016 1-02: ** ** + .byte %00110011 ; 0017 1-02: ** ** + + .byte %11001100 ; 0018 1-03: ** ** + .byte %11001100 ; 0019 1-03: ** ** + .byte %00110011 ; 001A 1-03: ** ** + .byte %00110011 ; 001B 1-03: ** ** + .byte %11001100 ; 001C 1-03: ** ** + .byte %11001100 ; 001D 1-03: ** ** + .byte %00110011 ; 001E 1-03: ** ** + .byte %00110011 ; 001F 1-03: ** ** + + .byte %00000000 ; 0020 1-04: + .byte %00011000 ; 0021 1-04: ** + .byte %00111100 ; 0022 1-04: **** + .byte %01111110 ; 0023 1-04: ****** + .byte %00011000 ; 0024 1-04: ** + .byte %00011000 ; 0025 1-04: ** + .byte %00011000 ; 0026 1-04: ** + .byte %00011000 ; 0027 1-04: ** + + .byte %00000000 ; 0028 1-05: + .byte %00011000 ; 0029 1-05: ** + .byte %00111100 ; 002A 1-05: **** + .byte %01111110 ; 002B 1-05: ****** + .byte %00011000 ; 002C 1-05: ** + .byte %00011000 ; 002D 1-05: ** + .byte %00011000 ; 002E 1-05: ** + .byte %00011000 ; 002F 1-05: ** + + .byte %00000000 ; 0030 1-06: + .byte %00010000 ; 0031 1-06: * + .byte %00110000 ; 0032 1-06: ** + .byte %01111111 ; 0033 1-06: ******* + .byte %01111111 ; 0034 1-06: ******* + .byte %00110000 ; 0035 1-06: ** + .byte %00010000 ; 0036 1-06: * + .byte %00000000 ; 0037 1-06: + + .byte %00000000 ; 0038 1-07: + .byte %00010000 ; 0039 1-07: * + .byte %00110000 ; 003A 1-07: ** + .byte %01111111 ; 003B 1-07: ******* + .byte %01111111 ; 003C 1-07: ******* + .byte %00110000 ; 003D 1-07: ** + .byte %00010000 ; 003E 1-07: * + .byte %00000000 ; 003F 1-07: + + .byte %00001100 ; 0040 1-08: ** + .byte %00010010 ; 0041 1-08: * * + .byte %00110000 ; 0042 1-08: ** + .byte %01111100 ; 0043 1-08: ***** + .byte %00110000 ; 0044 1-08: ** + .byte %01100010 ; 0045 1-08: ** * + .byte %11111100 ; 0046 1-08: ****** + .byte %00000000 ; 0047 1-08: + + .byte %00001100 ; 0048 1-09: ** + .byte %00010010 ; 0049 1-09: * * + .byte %00110000 ; 004A 1-09: ** + .byte %01111100 ; 004B 1-09: ***** + .byte %00110000 ; 004C 1-09: ** + .byte %01100010 ; 004D 1-09: ** * + .byte %11111100 ; 004E 1-09: ****** + .byte %00000000 ; 004F 1-09: + + .byte %00000000 ; 0050 1-0a: + .byte %00000000 ; 0051 1-0a: + .byte %00000011 ; 0052 1-0a: ** + .byte %00111110 ; 0053 1-0a: ***** + .byte %01110110 ; 0054 1-0a: *** ** + .byte %00110110 ; 0055 1-0a: ** ** + .byte %00110110 ; 0056 1-0a: ** ** + .byte %00000000 ; 0057 1-0a: + + .byte %00000000 ; 0058 1-0b: + .byte %00000000 ; 0059 1-0b: + .byte %00000011 ; 005A 1-0b: ** + .byte %00111110 ; 005B 1-0b: ***** + .byte %01110110 ; 005C 1-0b: *** ** + .byte %00110110 ; 005D 1-0b: ** ** + .byte %00110110 ; 005E 1-0b: ** ** + .byte %00000000 ; 005F 1-0b: + + .byte %01111111 ; 0060 1-0c: ******* + .byte %01111111 ; 0061 1-0c: ******* + .byte %00000000 ; 0062 1-0c: + .byte %00000000 ; 0063 1-0c: + .byte %00000000 ; 0064 1-0c: + .byte %00000000 ; 0065 1-0c: + .byte %00000000 ; 0066 1-0c: + .byte %00000000 ; 0067 1-0c: + + .byte %01111111 ; 0068 1-0d: ******* + .byte %01111111 ; 0069 1-0d: ******* + .byte %00000000 ; 006A 1-0d: + .byte %00000000 ; 006B 1-0d: + .byte %00000000 ; 006C 1-0d: + .byte %00000000 ; 006D 1-0d: + .byte %00000000 ; 006E 1-0d: + .byte %00000000 ; 006F 1-0d: + + .byte %11100000 ; 0070 1-0e: *** + .byte %11100000 ; 0071 1-0e: *** + .byte %01100000 ; 0072 1-0e: ** + .byte %01100000 ; 0073 1-0e: ** + .byte %01100000 ; 0074 1-0e: ** + .byte %01100000 ; 0075 1-0e: ** + .byte %01100000 ; 0076 1-0e: ** + .byte %01100000 ; 0077 1-0e: ** + + .byte %11100000 ; 0078 1-0f: *** + .byte %11100000 ; 0079 1-0f: *** + .byte %01100000 ; 007A 1-0f: ** + .byte %01100000 ; 007B 1-0f: ** + .byte %01100000 ; 007C 1-0f: ** + .byte %01100000 ; 007D 1-0f: ** + .byte %01100000 ; 007E 1-0f: ** + .byte %01100000 ; 007F 1-0f: ** + + .byte %00011000 ; 0080 1-10: ** + .byte %00011000 ; 0081 1-10: ** + .byte %00011000 ; 0082 1-10: ** + .byte %11111000 ; 0083 1-10: ***** + .byte %11111000 ; 0084 1-10: ***** + .byte %00000000 ; 0085 1-10: + .byte %00000000 ; 0086 1-10: + .byte %00000000 ; 0087 1-10: + + .byte %00011000 ; 0088 1-11: ** + .byte %00011000 ; 0089 1-11: ** + .byte %00011000 ; 008A 1-11: ** + .byte %11111000 ; 008B 1-11: ***** + .byte %11111000 ; 008C 1-11: ***** + .byte %00000000 ; 008D 1-11: + .byte %00000000 ; 008E 1-11: + .byte %00000000 ; 008F 1-11: + + .byte %11001100 ; 0090 1-12: ** ** + .byte %10011001 ; 0091 1-12: * ** * + .byte %00110011 ; 0092 1-12: ** ** + .byte %01100110 ; 0093 1-12: ** ** + .byte %11001100 ; 0094 1-12: ** ** + .byte %10011001 ; 0095 1-12: * ** * + .byte %00110011 ; 0096 1-12: ** ** + .byte %01100110 ; 0097 1-12: ** ** + + .byte %11001100 ; 0098 1-13: ** ** + .byte %10011001 ; 0099 1-13: * ** * + .byte %00110011 ; 009A 1-13: ** ** + .byte %01100110 ; 009B 1-13: ** ** + .byte %11001100 ; 009C 1-13: ** ** + .byte %10011001 ; 009D 1-13: * ** * + .byte %00110011 ; 009E 1-13: ** ** + .byte %01100110 ; 009F 1-13: ** ** + + .byte %00110011 ; 00A0 1-14: ** ** + .byte %10011001 ; 00A1 1-14: * ** * + .byte %11001100 ; 00A2 1-14: ** ** + .byte %01100110 ; 00A3 1-14: ** ** + .byte %00110011 ; 00A4 1-14: ** ** + .byte %10011001 ; 00A5 1-14: * ** * + .byte %11001100 ; 00A6 1-14: ** ** + .byte %01100110 ; 00A7 1-14: ** ** + + .byte %00110011 ; 00A8 1-15: ** ** + .byte %10011001 ; 00A9 1-15: * ** * + .byte %11001100 ; 00AA 1-15: ** ** + .byte %01100110 ; 00AB 1-15: ** ** + .byte %00110011 ; 00AC 1-15: ** ** + .byte %10011001 ; 00AD 1-15: * ** * + .byte %11001100 ; 00AE 1-15: ** ** + .byte %01100110 ; 00AF 1-15: ** ** + + .byte %00000000 ; 00B0 1-16: + .byte %00000000 ; 00B1 1-16: + .byte %00000000 ; 00B2 1-16: + .byte %11111111 ; 00B3 1-16: ******** + .byte %11111111 ; 00B4 1-16: ******** + .byte %00000000 ; 00B5 1-16: + .byte %00000000 ; 00B6 1-16: + .byte %00000000 ; 00B7 1-16: + + .byte %00000000 ; 00B8 1-17: + .byte %00000000 ; 00B9 1-17: + .byte %00000000 ; 00BA 1-17: + .byte %11111111 ; 00BB 1-17: ******** + .byte %11111111 ; 00BC 1-17: ******** + .byte %00000000 ; 00BD 1-17: + .byte %00000000 ; 00BE 1-17: + .byte %00000000 ; 00BF 1-17: + + .byte %00000011 ; 00C0 1-18: ** + .byte %00000011 ; 00C1 1-18: ** + .byte %00000011 ; 00C2 1-18: ** + .byte %00000011 ; 00C3 1-18: ** + .byte %00000011 ; 00C4 1-18: ** + .byte %00000011 ; 00C5 1-18: ** + .byte %00000011 ; 00C6 1-18: ** + .byte %00000011 ; 00C7 1-18: ** + + .byte %00000011 ; 00C8 1-19: ** + .byte %00000011 ; 00C9 1-19: ** + .byte %00000011 ; 00CA 1-19: ** + .byte %00000011 ; 00CB 1-19: ** + .byte %00000011 ; 00CC 1-19: ** + .byte %00000011 ; 00CD 1-19: ** + .byte %00000011 ; 00CE 1-19: ** + .byte %00000011 ; 00CF 1-19: ** + + .byte %00000000 ; 00D0 1-1a: + .byte %00000000 ; 00D1 1-1a: + .byte %00000000 ; 00D2 1-1a: + .byte %00000000 ; 00D3 1-1a: + .byte %11001100 ; 00D4 1-1a: ** ** + .byte %11001100 ; 00D5 1-1a: ** ** + .byte %00110011 ; 00D6 1-1a: ** ** + .byte %00110011 ; 00D7 1-1a: ** ** + + .byte %00000000 ; 00D8 1-1b: + .byte %00000000 ; 00D9 1-1b: + .byte %00000000 ; 00DA 1-1b: + .byte %00000000 ; 00DB 1-1b: + .byte %11001100 ; 00DC 1-1b: ** ** + .byte %11001100 ; 00DD 1-1b: ** ** + .byte %00110011 ; 00DE 1-1b: ** ** + .byte %00110011 ; 00DF 1-1b: ** ** + + .byte %00011000 ; 00E0 1-1c: ** + .byte %00011000 ; 00E1 1-1c: ** + .byte %00011000 ; 00E2 1-1c: ** + .byte %00011000 ; 00E3 1-1c: ** + .byte %00011000 ; 00E4 1-1c: ** + .byte %00011000 ; 00E5 1-1c: ** + .byte %00011000 ; 00E6 1-1c: ** + .byte %00011000 ; 00E7 1-1c: ** + + .byte %00011000 ; 00E8 1-1d: ** + .byte %00011000 ; 00E9 1-1d: ** + .byte %00011000 ; 00EA 1-1d: ** + .byte %00011000 ; 00EB 1-1d: ** + .byte %00011000 ; 00EC 1-1d: ** + .byte %00011000 ; 00ED 1-1d: ** + .byte %00011000 ; 00EE 1-1d: ** + .byte %00011000 ; 00EF 1-1d: ** + + .byte %00011000 ; 00F0 1-1e: ** + .byte %00011000 ; 00F1 1-1e: ** + .byte %00011000 ; 00F2 1-1e: ** + .byte %00011111 ; 00F3 1-1e: ***** + .byte %00011111 ; 00F4 1-1e: ***** + .byte %00011000 ; 00F5 1-1e: ** + .byte %00011000 ; 00F6 1-1e: ** + .byte %00011000 ; 00F7 1-1e: ** + + .byte %00011000 ; 00F8 1-1f: ** + .byte %00011000 ; 00F9 1-1f: ** + .byte %00011000 ; 00FA 1-1f: ** + .byte %00011111 ; 00FB 1-1f: ***** + .byte %00011111 ; 00FC 1-1f: ***** + .byte %00011000 ; 00FD 1-1f: ** + .byte %00011000 ; 00FE 1-1f: ** + .byte %00011000 ; 00FF 1-1f: ** + + .byte %00011000 ; 0100 1-20: ** + .byte %00011000 ; 0101 1-20: ** + .byte %00011000 ; 0102 1-20: ** + .byte %11111111 ; 0103 1-20: ******** + .byte %11111111 ; 0104 1-20: ******** + .byte %00011000 ; 0105 1-20: ** + .byte %00011000 ; 0106 1-20: ** + .byte %00011000 ; 0107 1-20: ** + + .byte %00011000 ; 0108 1-21: ** + .byte %00011000 ; 0109 1-21: ** + .byte %00011000 ; 010A 1-21: ** + .byte %11111111 ; 010B 1-21: ******** + .byte %11111111 ; 010C 1-21: ******** + .byte %00011000 ; 010D 1-21: ** + .byte %00011000 ; 010E 1-21: ** + .byte %00011000 ; 010F 1-21: ** + + .byte %00011000 ; 0110 1-22: ** + .byte %00011000 ; 0111 1-22: ** + .byte %00011000 ; 0112 1-22: ** + .byte %00011111 ; 0113 1-22: ***** + .byte %00011111 ; 0114 1-22: ***** + .byte %00000000 ; 0115 1-22: + .byte %00000000 ; 0116 1-22: + .byte %00000000 ; 0117 1-22: + + .byte %00011000 ; 0118 1-23: ** + .byte %00011000 ; 0119 1-23: ** + .byte %00011000 ; 011A 1-23: ** + .byte %00011111 ; 011B 1-23: ***** + .byte %00011111 ; 011C 1-23: ***** + .byte %00000000 ; 011D 1-23: + .byte %00000000 ; 011E 1-23: + .byte %00000000 ; 011F 1-23: + + .byte %00000000 ; 0120 1-24: + .byte %00000000 ; 0121 1-24: + .byte %00000000 ; 0122 1-24: + .byte %11111000 ; 0123 1-24: ***** + .byte %11111000 ; 0124 1-24: ***** + .byte %00011000 ; 0125 1-24: ** + .byte %00011000 ; 0126 1-24: ** + .byte %00011000 ; 0127 1-24: ** + + .byte %00000000 ; 0128 1-25: + .byte %00000000 ; 0129 1-25: + .byte %00000000 ; 012A 1-25: + .byte %11111000 ; 012B 1-25: ***** + .byte %11111000 ; 012C 1-25: ***** + .byte %00011000 ; 012D 1-25: ** + .byte %00011000 ; 012E 1-25: ** + .byte %00011000 ; 012F 1-25: ** + + .byte %00000000 ; 0130 1-26: + .byte %00000000 ; 0131 1-26: + .byte %00000000 ; 0132 1-26: + .byte %00000000 ; 0133 1-26: + .byte %00000000 ; 0134 1-26: + .byte %00000000 ; 0135 1-26: + .byte %11111111 ; 0136 1-26: ******** + .byte %11111111 ; 0137 1-26: ******** + + .byte %00000000 ; 0138 1-27: + .byte %00000000 ; 0139 1-27: + .byte %00000000 ; 013A 1-27: + .byte %00000000 ; 013B 1-27: + .byte %00000000 ; 013C 1-27: + .byte %00000000 ; 013D 1-27: + .byte %11111111 ; 013E 1-27: ******** + .byte %11111111 ; 013F 1-27: ******** + + .byte %00000000 ; 0140 1-28: + .byte %00000000 ; 0141 1-28: + .byte %00000000 ; 0142 1-28: + .byte %00011111 ; 0143 1-28: ***** + .byte %00011111 ; 0144 1-28: ***** + .byte %00011000 ; 0145 1-28: ** + .byte %00011000 ; 0146 1-28: ** + .byte %00011000 ; 0147 1-28: ** + + .byte %00000000 ; 0148 1-29: + .byte %00000000 ; 0149 1-29: + .byte %00000000 ; 014A 1-29: + .byte %00011111 ; 014B 1-29: ***** + .byte %00011111 ; 014C 1-29: ***** + .byte %00011000 ; 014D 1-29: ** + .byte %00011000 ; 014E 1-29: ** + .byte %00011000 ; 014F 1-29: ** + + .byte %00011000 ; 0150 1-2a: ** + .byte %00011000 ; 0151 1-2a: ** + .byte %00011000 ; 0152 1-2a: ** + .byte %11111111 ; 0153 1-2a: ******** + .byte %11111111 ; 0154 1-2a: ******** + .byte %00000000 ; 0155 1-2a: + .byte %00000000 ; 0156 1-2a: + .byte %00000000 ; 0157 1-2a: + + .byte %00011000 ; 0158 1-2b: ** + .byte %00011000 ; 0159 1-2b: ** + .byte %00011000 ; 015A 1-2b: ** + .byte %11111111 ; 015B 1-2b: ******** + .byte %11111111 ; 015C 1-2b: ******** + .byte %00000000 ; 015D 1-2b: + .byte %00000000 ; 015E 1-2b: + .byte %00000000 ; 015F 1-2b: + + .byte %00000000 ; 0160 1-2c: + .byte %00000000 ; 0161 1-2c: + .byte %00000000 ; 0162 1-2c: + .byte %11111111 ; 0163 1-2c: ******** + .byte %11111111 ; 0164 1-2c: ******** + .byte %00011000 ; 0165 1-2c: ** + .byte %00011000 ; 0166 1-2c: ** + .byte %00011000 ; 0167 1-2c: ** + + .byte %00000000 ; 0168 1-2d: + .byte %00000000 ; 0169 1-2d: + .byte %00000000 ; 016A 1-2d: + .byte %11111111 ; 016B 1-2d: ******** + .byte %11111111 ; 016C 1-2d: ******** + .byte %00011000 ; 016D 1-2d: ** + .byte %00011000 ; 016E 1-2d: ** + .byte %00011000 ; 016F 1-2d: ** + + .byte %00011000 ; 0170 1-2e: ** + .byte %00011000 ; 0171 1-2e: ** + .byte %00011000 ; 0172 1-2e: ** + .byte %11111000 ; 0173 1-2e: ***** + .byte %11111000 ; 0174 1-2e: ***** + .byte %00011000 ; 0175 1-2e: ** + .byte %00011000 ; 0176 1-2e: ** + .byte %00011000 ; 0177 1-2e: ** + + .byte %00011000 ; 0178 1-2f: ** + .byte %00011000 ; 0179 1-2f: ** + .byte %00011000 ; 017A 1-2f: ** + .byte %11111000 ; 017B 1-2f: ***** + .byte %11111000 ; 017C 1-2f: ***** + .byte %00011000 ; 017D 1-2f: ** + .byte %00011000 ; 017E 1-2f: ** + .byte %00011000 ; 017F 1-2f: ** + + .byte %11110000 ; 0180 1-30: **** + .byte %11110000 ; 0181 1-30: **** + .byte %11110000 ; 0182 1-30: **** + .byte %11110000 ; 0183 1-30: **** + .byte %11110000 ; 0184 1-30: **** + .byte %11110000 ; 0185 1-30: **** + .byte %11110000 ; 0186 1-30: **** + .byte %11110000 ; 0187 1-30: **** + + .byte %11110000 ; 0188 1-31: **** + .byte %11110000 ; 0189 1-31: **** + .byte %11110000 ; 018A 1-31: **** + .byte %11110000 ; 018B 1-31: **** + .byte %11110000 ; 018C 1-31: **** + .byte %11110000 ; 018D 1-31: **** + .byte %11110000 ; 018E 1-31: **** + .byte %11110000 ; 018F 1-31: **** + + .byte %00000000 ; 0190 1-32: + .byte %00000000 ; 0191 1-32: + .byte %00000000 ; 0192 1-32: + .byte %00000000 ; 0193 1-32: + .byte %11111111 ; 0194 1-32: ******** + .byte %11111111 ; 0195 1-32: ******** + .byte %11111111 ; 0196 1-32: ******** + .byte %11111111 ; 0197 1-32: ******** + + .byte %00000000 ; 0198 1-33: + .byte %00000000 ; 0199 1-33: + .byte %00000000 ; 019A 1-33: + .byte %00000000 ; 019B 1-33: + .byte %11111111 ; 019C 1-33: ******** + .byte %11111111 ; 019D 1-33: ******** + .byte %11111111 ; 019E 1-33: ******** + .byte %11111111 ; 019F 1-33: ******** + + .byte %00000000 ; 01A0 1-34: + .byte %00000000 ; 01A1 1-34: + .byte %00000000 ; 01A2 1-34: + .byte %00000000 ; 01A3 1-34: + .byte %11110000 ; 01A4 1-34: **** + .byte %11110000 ; 01A5 1-34: **** + .byte %11110000 ; 01A6 1-34: **** + .byte %11110000 ; 01A7 1-34: **** + + .byte %00000000 ; 01A8 1-35: + .byte %00000000 ; 01A9 1-35: + .byte %00000000 ; 01AA 1-35: + .byte %00000000 ; 01AB 1-35: + .byte %11110000 ; 01AC 1-35: **** + .byte %11110000 ; 01AD 1-35: **** + .byte %11110000 ; 01AE 1-35: **** + .byte %11110000 ; 01AF 1-35: **** + + .byte %11000000 ; 01B0 1-36: ** + .byte %11000000 ; 01B1 1-36: ** + .byte %00110000 ; 01B2 1-36: ** + .byte %00110000 ; 01B3 1-36: ** + .byte %11000000 ; 01B4 1-36: ** + .byte %11000000 ; 01B5 1-36: ** + .byte %00110000 ; 01B6 1-36: ** + .byte %00110000 ; 01B7 1-36: ** + + .byte %11000000 ; 01B8 1-37: ** + .byte %11000000 ; 01B9 1-37: ** + .byte %00110000 ; 01BA 1-37: ** + .byte %00110000 ; 01BB 1-37: ** + .byte %11000000 ; 01BC 1-37: ** + .byte %11000000 ; 01BD 1-37: ** + .byte %00110000 ; 01BE 1-37: ** + .byte %00110000 ; 01BF 1-37: ** + + .byte %00001111 ; 01C0 1-38: **** + .byte %00001111 ; 01C1 1-38: **** + .byte %00001111 ; 01C2 1-38: **** + .byte %00001111 ; 01C3 1-38: **** + .byte %00000000 ; 01C4 1-38: + .byte %00000000 ; 01C5 1-38: + .byte %00000000 ; 01C6 1-38: + .byte %00000000 ; 01C7 1-38: + + .byte %00001111 ; 01C8 1-39: **** + .byte %00001111 ; 01C9 1-39: **** + .byte %00001111 ; 01CA 1-39: **** + .byte %00001111 ; 01CB 1-39: **** + .byte %00000000 ; 01CC 1-39: + .byte %00000000 ; 01CD 1-39: + .byte %00000000 ; 01CE 1-39: + .byte %00000000 ; 01CF 1-39: + + .byte %00000000 ; 01D0 1-3a: + .byte %00000000 ; 01D1 1-3a: + .byte %00000000 ; 01D2 1-3a: + .byte %00000000 ; 01D3 1-3a: + .byte %00001111 ; 01D4 1-3a: **** + .byte %00001111 ; 01D5 1-3a: **** + .byte %00001111 ; 01D6 1-3a: **** + .byte %00001111 ; 01D7 1-3a: **** + + .byte %00000000 ; 01D8 1-3b: + .byte %00000000 ; 01D9 1-3b: + .byte %00000000 ; 01DA 1-3b: + .byte %00000000 ; 01DB 1-3b: + .byte %00001111 ; 01DC 1-3b: **** + .byte %00001111 ; 01DD 1-3b: **** + .byte %00001111 ; 01DE 1-3b: **** + .byte %00001111 ; 01DF 1-3b: **** + + .byte %11110000 ; 01E0 1-3c: **** + .byte %11110000 ; 01E1 1-3c: **** + .byte %11110000 ; 01E2 1-3c: **** + .byte %11110000 ; 01E3 1-3c: **** + .byte %00000000 ; 01E4 1-3c: + .byte %00000000 ; 01E5 1-3c: + .byte %00000000 ; 01E6 1-3c: + .byte %00000000 ; 01E7 1-3c: + + .byte %11110000 ; 01E8 1-3d: **** + .byte %11110000 ; 01E9 1-3d: **** + .byte %11110000 ; 01EA 1-3d: **** + .byte %11110000 ; 01EB 1-3d: **** + .byte %00000000 ; 01EC 1-3d: + .byte %00000000 ; 01ED 1-3d: + .byte %00000000 ; 01EE 1-3d: + .byte %00000000 ; 01EF 1-3d: + + .byte %11110000 ; 01F0 1-3e: **** + .byte %11110000 ; 01F1 1-3e: **** + .byte %11110000 ; 01F2 1-3e: **** + .byte %11110000 ; 01F3 1-3e: **** + .byte %00001111 ; 01F4 1-3e: **** + .byte %00001111 ; 01F5 1-3e: **** + .byte %00001111 ; 01F6 1-3e: **** + .byte %00001111 ; 01F7 1-3e: **** + + .byte %11110000 ; 01F8 1-3f: **** + .byte %11110000 ; 01F9 1-3f: **** + .byte %11110000 ; 01FA 1-3f: **** + .byte %11110000 ; 01FB 1-3f: **** + .byte %00001111 ; 01FC 1-3f: **** + .byte %00001111 ; 01FD 1-3f: **** + .byte %00001111 ; 01FE 1-3f: **** + .byte %00001111 ; 01FF 1-3f: **** + + .byte %00000000 ; 0200 1-40: + .byte %00000000 ; 0201 1-40: + .byte %00000000 ; 0202 1-40: + .byte %00000000 ; 0203 1-40: + .byte %00000000 ; 0204 1-40: + .byte %00000000 ; 0205 1-40: + .byte %00000000 ; 0206 1-40: + .byte %00000000 ; 0207 1-40: + + .byte %00000000 ; 0208 1-41: + .byte %00000000 ; 0209 1-41: + .byte %00000000 ; 020A 1-41: + .byte %00000000 ; 020B 1-41: + .byte %00000000 ; 020C 1-41: + .byte %00000000 ; 020D 1-41: + .byte %00000000 ; 020E 1-41: + .byte %00000000 ; 020F 1-41: + + .byte %00011000 ; 0210 1-42: ** + .byte %00011000 ; 0211 1-42: ** + .byte %00011000 ; 0212 1-42: ** + .byte %00011000 ; 0213 1-42: ** + .byte %00000000 ; 0214 1-42: + .byte %00000000 ; 0215 1-42: + .byte %00011000 ; 0216 1-42: ** + .byte %00000000 ; 0217 1-42: + + .byte %00011000 ; 0218 1-43: ** + .byte %00011000 ; 0219 1-43: ** + .byte %00011000 ; 021A 1-43: ** + .byte %00011000 ; 021B 1-43: ** + .byte %00000000 ; 021C 1-43: + .byte %00000000 ; 021D 1-43: + .byte %00011000 ; 021E 1-43: ** + .byte %00000000 ; 021F 1-43: + + .byte %01100110 ; 0220 1-44: ** ** + .byte %01100110 ; 0221 1-44: ** ** + .byte %01100110 ; 0222 1-44: ** ** + .byte %00000000 ; 0223 1-44: + .byte %00000000 ; 0224 1-44: + .byte %00000000 ; 0225 1-44: + .byte %00000000 ; 0226 1-44: + .byte %00000000 ; 0227 1-44: + + .byte %01100110 ; 0228 1-45: ** ** + .byte %01100110 ; 0229 1-45: ** ** + .byte %01100110 ; 022A 1-45: ** ** + .byte %00000000 ; 022B 1-45: + .byte %00000000 ; 022C 1-45: + .byte %00000000 ; 022D 1-45: + .byte %00000000 ; 022E 1-45: + .byte %00000000 ; 022F 1-45: + + .byte %01100110 ; 0230 1-46: ** ** + .byte %01100110 ; 0231 1-46: ** ** + .byte %11111111 ; 0232 1-46: ******** + .byte %01100110 ; 0233 1-46: ** ** + .byte %11111111 ; 0234 1-46: ******** + .byte %01100110 ; 0235 1-46: ** ** + .byte %01100110 ; 0236 1-46: ** ** + .byte %00000000 ; 0237 1-46: + + .byte %01100110 ; 0238 1-47: ** ** + .byte %01100110 ; 0239 1-47: ** ** + .byte %11111111 ; 023A 1-47: ******** + .byte %01100110 ; 023B 1-47: ** ** + .byte %11111111 ; 023C 1-47: ******** + .byte %01100110 ; 023D 1-47: ** ** + .byte %01100110 ; 023E 1-47: ** ** + .byte %00000000 ; 023F 1-47: + + .byte %00011000 ; 0240 1-48: ** + .byte %00111110 ; 0241 1-48: ***** + .byte %01100000 ; 0242 1-48: ** + .byte %00111100 ; 0243 1-48: **** + .byte %00000110 ; 0244 1-48: ** + .byte %01111100 ; 0245 1-48: ***** + .byte %00011000 ; 0246 1-48: ** + .byte %00000000 ; 0247 1-48: + + .byte %00011000 ; 0248 1-49: ** + .byte %00111110 ; 0249 1-49: ***** + .byte %01100000 ; 024A 1-49: ** + .byte %00111100 ; 024B 1-49: **** + .byte %00000110 ; 024C 1-49: ** + .byte %01111100 ; 024D 1-49: ***** + .byte %00011000 ; 024E 1-49: ** + .byte %00000000 ; 024F 1-49: + + .byte %00000000 ; 0250 1-4a: + .byte %01100110 ; 0251 1-4a: ** ** + .byte %00001100 ; 0252 1-4a: ** + .byte %00011000 ; 0253 1-4a: ** + .byte %00110000 ; 0254 1-4a: ** + .byte %01100110 ; 0255 1-4a: ** ** + .byte %01000110 ; 0256 1-4a: * ** + .byte %00000000 ; 0257 1-4a: + + .byte %00000000 ; 0258 1-4b: + .byte %01100110 ; 0259 1-4b: ** ** + .byte %00001100 ; 025A 1-4b: ** + .byte %00011000 ; 025B 1-4b: ** + .byte %00110000 ; 025C 1-4b: ** + .byte %01100110 ; 025D 1-4b: ** ** + .byte %01000110 ; 025E 1-4b: * ** + .byte %00000000 ; 025F 1-4b: + + .byte %00111100 ; 0260 1-4c: **** + .byte %01100110 ; 0261 1-4c: ** ** + .byte %00111100 ; 0262 1-4c: **** + .byte %00111000 ; 0263 1-4c: *** + .byte %01100111 ; 0264 1-4c: ** *** + .byte %01100110 ; 0265 1-4c: ** ** + .byte %00111111 ; 0266 1-4c: ****** + .byte %00000000 ; 0267 1-4c: + + .byte %00111100 ; 0268 1-4d: **** + .byte %01100110 ; 0269 1-4d: ** ** + .byte %00111100 ; 026A 1-4d: **** + .byte %00111000 ; 026B 1-4d: *** + .byte %01100111 ; 026C 1-4d: ** *** + .byte %01100110 ; 026D 1-4d: ** ** + .byte %00111111 ; 026E 1-4d: ****** + .byte %00000000 ; 026F 1-4d: + + .byte %00000110 ; 0270 1-4e: ** + .byte %00001100 ; 0271 1-4e: ** + .byte %00011000 ; 0272 1-4e: ** + .byte %00000000 ; 0273 1-4e: + .byte %00000000 ; 0274 1-4e: + .byte %00000000 ; 0275 1-4e: + .byte %00000000 ; 0276 1-4e: + .byte %00000000 ; 0277 1-4e: + + .byte %00000110 ; 0278 1-4f: ** + .byte %00001100 ; 0279 1-4f: ** + .byte %00011000 ; 027A 1-4f: ** + .byte %00000000 ; 027B 1-4f: + .byte %00000000 ; 027C 1-4f: + .byte %00000000 ; 027D 1-4f: + .byte %00000000 ; 027E 1-4f: + .byte %00000000 ; 027F 1-4f: + + .byte %00001100 ; 0280 1-50: ** + .byte %00011000 ; 0281 1-50: ** + .byte %00110000 ; 0282 1-50: ** + .byte %00110000 ; 0283 1-50: ** + .byte %00110000 ; 0284 1-50: ** + .byte %00011000 ; 0285 1-50: ** + .byte %00001100 ; 0286 1-50: ** + .byte %00000000 ; 0287 1-50: + + .byte %00001100 ; 0288 1-51: ** + .byte %00011000 ; 0289 1-51: ** + .byte %00110000 ; 028A 1-51: ** + .byte %00110000 ; 028B 1-51: ** + .byte %00110000 ; 028C 1-51: ** + .byte %00011000 ; 028D 1-51: ** + .byte %00001100 ; 028E 1-51: ** + .byte %00000000 ; 028F 1-51: + + .byte %00110000 ; 0290 1-52: ** + .byte %00011000 ; 0291 1-52: ** + .byte %00001100 ; 0292 1-52: ** + .byte %00001100 ; 0293 1-52: ** + .byte %00001100 ; 0294 1-52: ** + .byte %00011000 ; 0295 1-52: ** + .byte %00110000 ; 0296 1-52: ** + .byte %00000000 ; 0297 1-52: + + .byte %00110000 ; 0298 1-53: ** + .byte %00011000 ; 0299 1-53: ** + .byte %00001100 ; 029A 1-53: ** + .byte %00001100 ; 029B 1-53: ** + .byte %00001100 ; 029C 1-53: ** + .byte %00011000 ; 029D 1-53: ** + .byte %00110000 ; 029E 1-53: ** + .byte %00000000 ; 029F 1-53: + + .byte %00000000 ; 02A0 1-54: + .byte %01100110 ; 02A1 1-54: ** ** + .byte %00111100 ; 02A2 1-54: **** + .byte %11111111 ; 02A3 1-54: ******** + .byte %00111100 ; 02A4 1-54: **** + .byte %01100110 ; 02A5 1-54: ** ** + .byte %00000000 ; 02A6 1-54: + .byte %00000000 ; 02A7 1-54: + + .byte %00000000 ; 02A8 1-55: + .byte %01100110 ; 02A9 1-55: ** ** + .byte %00111100 ; 02AA 1-55: **** + .byte %11111111 ; 02AB 1-55: ******** + .byte %00111100 ; 02AC 1-55: **** + .byte %01100110 ; 02AD 1-55: ** ** + .byte %00000000 ; 02AE 1-55: + .byte %00000000 ; 02AF 1-55: + + .byte %00000000 ; 02B0 1-56: + .byte %00011000 ; 02B1 1-56: ** + .byte %00011000 ; 02B2 1-56: ** + .byte %01111110 ; 02B3 1-56: ****** + .byte %00011000 ; 02B4 1-56: ** + .byte %00011000 ; 02B5 1-56: ** + .byte %00000000 ; 02B6 1-56: + .byte %00000000 ; 02B7 1-56: + + .byte %00000000 ; 02B8 1-57: + .byte %00011000 ; 02B9 1-57: ** + .byte %00011000 ; 02BA 1-57: ** + .byte %01111110 ; 02BB 1-57: ****** + .byte %00011000 ; 02BC 1-57: ** + .byte %00011000 ; 02BD 1-57: ** + .byte %00000000 ; 02BE 1-57: + .byte %00000000 ; 02BF 1-57: + + .byte %00000000 ; 02C0 1-58: + .byte %00000000 ; 02C1 1-58: + .byte %00000000 ; 02C2 1-58: + .byte %00000000 ; 02C3 1-58: + .byte %00000000 ; 02C4 1-58: + .byte %00011000 ; 02C5 1-58: ** + .byte %00011000 ; 02C6 1-58: ** + .byte %00110000 ; 02C7 1-58: ** + + .byte %00000000 ; 02C8 1-59: + .byte %00000000 ; 02C9 1-59: + .byte %00000000 ; 02CA 1-59: + .byte %00000000 ; 02CB 1-59: + .byte %00000000 ; 02CC 1-59: + .byte %00011000 ; 02CD 1-59: ** + .byte %00011000 ; 02CE 1-59: ** + .byte %00110000 ; 02CF 1-59: ** + + .byte %00000000 ; 02D0 1-5a: + .byte %00000000 ; 02D1 1-5a: + .byte %00000000 ; 02D2 1-5a: + .byte %01111110 ; 02D3 1-5a: ****** + .byte %00000000 ; 02D4 1-5a: + .byte %00000000 ; 02D5 1-5a: + .byte %00000000 ; 02D6 1-5a: + .byte %00000000 ; 02D7 1-5a: + + .byte %00000000 ; 02D8 1-5b: + .byte %00000000 ; 02D9 1-5b: + .byte %00000000 ; 02DA 1-5b: + .byte %01111110 ; 02DB 1-5b: ****** + .byte %00000000 ; 02DC 1-5b: + .byte %00000000 ; 02DD 1-5b: + .byte %00000000 ; 02DE 1-5b: + .byte %00000000 ; 02DF 1-5b: + + .byte %00000000 ; 02E0 1-5c: + .byte %00000000 ; 02E1 1-5c: + .byte %00000000 ; 02E2 1-5c: + .byte %00000000 ; 02E3 1-5c: + .byte %00000000 ; 02E4 1-5c: + .byte %00011000 ; 02E5 1-5c: ** + .byte %00011000 ; 02E6 1-5c: ** + .byte %00000000 ; 02E7 1-5c: + + .byte %00000000 ; 02E8 1-5d: + .byte %00000000 ; 02E9 1-5d: + .byte %00000000 ; 02EA 1-5d: + .byte %00000000 ; 02EB 1-5d: + .byte %00000000 ; 02EC 1-5d: + .byte %00011000 ; 02ED 1-5d: ** + .byte %00011000 ; 02EE 1-5d: ** + .byte %00000000 ; 02EF 1-5d: + + .byte %00000000 ; 02F0 1-5e: + .byte %00000011 ; 02F1 1-5e: ** + .byte %00000110 ; 02F2 1-5e: ** + .byte %00001100 ; 02F3 1-5e: ** + .byte %00011000 ; 02F4 1-5e: ** + .byte %00110000 ; 02F5 1-5e: ** + .byte %01100000 ; 02F6 1-5e: ** + .byte %00000000 ; 02F7 1-5e: + + .byte %00000000 ; 02F8 1-5f: + .byte %00000011 ; 02F9 1-5f: ** + .byte %00000110 ; 02FA 1-5f: ** + .byte %00001100 ; 02FB 1-5f: ** + .byte %00011000 ; 02FC 1-5f: ** + .byte %00110000 ; 02FD 1-5f: ** + .byte %01100000 ; 02FE 1-5f: ** + .byte %00000000 ; 02FF 1-5f: + + .byte %00111100 ; 0300 1-60: **** + .byte %01100110 ; 0301 1-60: ** ** + .byte %01101110 ; 0302 1-60: ** *** + .byte %01110110 ; 0303 1-60: *** ** + .byte %01100110 ; 0304 1-60: ** ** + .byte %01100110 ; 0305 1-60: ** ** + .byte %00111100 ; 0306 1-60: **** + .byte %00000000 ; 0307 1-60: + + .byte %00111100 ; 0308 1-61: **** + .byte %01100110 ; 0309 1-61: ** ** + .byte %01101110 ; 030A 1-61: ** *** + .byte %01110110 ; 030B 1-61: *** ** + .byte %01100110 ; 030C 1-61: ** ** + .byte %01100110 ; 030D 1-61: ** ** + .byte %00111100 ; 030E 1-61: **** + .byte %00000000 ; 030F 1-61: + + .byte %00011000 ; 0310 1-62: ** + .byte %00011000 ; 0311 1-62: ** + .byte %00111000 ; 0312 1-62: *** + .byte %00011000 ; 0313 1-62: ** + .byte %00011000 ; 0314 1-62: ** + .byte %00011000 ; 0315 1-62: ** + .byte %01111110 ; 0316 1-62: ****** + .byte %00000000 ; 0317 1-62: + + .byte %00011000 ; 0318 1-63: ** + .byte %00011000 ; 0319 1-63: ** + .byte %00111000 ; 031A 1-63: *** + .byte %00011000 ; 031B 1-63: ** + .byte %00011000 ; 031C 1-63: ** + .byte %00011000 ; 031D 1-63: ** + .byte %01111110 ; 031E 1-63: ****** + .byte %00000000 ; 031F 1-63: + + .byte %00111100 ; 0320 1-64: **** + .byte %01100110 ; 0321 1-64: ** ** + .byte %00000110 ; 0322 1-64: ** + .byte %00001100 ; 0323 1-64: ** + .byte %00110000 ; 0324 1-64: ** + .byte %01100000 ; 0325 1-64: ** + .byte %01111110 ; 0326 1-64: ****** + .byte %00000000 ; 0327 1-64: + + .byte %00111100 ; 0328 1-65: **** + .byte %01100110 ; 0329 1-65: ** ** + .byte %00000110 ; 032A 1-65: ** + .byte %00001100 ; 032B 1-65: ** + .byte %00110000 ; 032C 1-65: ** + .byte %01100000 ; 032D 1-65: ** + .byte %01111110 ; 032E 1-65: ****** + .byte %00000000 ; 032F 1-65: + + .byte %00111100 ; 0330 1-66: **** + .byte %01100110 ; 0331 1-66: ** ** + .byte %00000110 ; 0332 1-66: ** + .byte %00011100 ; 0333 1-66: *** + .byte %00000110 ; 0334 1-66: ** + .byte %01100110 ; 0335 1-66: ** ** + .byte %00111100 ; 0336 1-66: **** + .byte %00000000 ; 0337 1-66: + + .byte %00111100 ; 0338 1-67: **** + .byte %01100110 ; 0339 1-67: ** ** + .byte %00000110 ; 033A 1-67: ** + .byte %00011100 ; 033B 1-67: *** + .byte %00000110 ; 033C 1-67: ** + .byte %01100110 ; 033D 1-67: ** ** + .byte %00111100 ; 033E 1-67: **** + .byte %00000000 ; 033F 1-67: + + .byte %00000110 ; 0340 1-68: ** + .byte %00001110 ; 0341 1-68: *** + .byte %00011110 ; 0342 1-68: **** + .byte %01100110 ; 0343 1-68: ** ** + .byte %01111111 ; 0344 1-68: ******* + .byte %00000110 ; 0345 1-68: ** + .byte %00000110 ; 0346 1-68: ** + .byte %00000000 ; 0347 1-68: + + .byte %00000110 ; 0348 1-69: ** + .byte %00001110 ; 0349 1-69: *** + .byte %00011110 ; 034A 1-69: **** + .byte %01100110 ; 034B 1-69: ** ** + .byte %01111111 ; 034C 1-69: ******* + .byte %00000110 ; 034D 1-69: ** + .byte %00000110 ; 034E 1-69: ** + .byte %00000000 ; 034F 1-69: + + .byte %01111110 ; 0350 1-6a: ****** + .byte %01100000 ; 0351 1-6a: ** + .byte %01111100 ; 0352 1-6a: ***** + .byte %00000110 ; 0353 1-6a: ** + .byte %00000110 ; 0354 1-6a: ** + .byte %01100110 ; 0355 1-6a: ** ** + .byte %00111100 ; 0356 1-6a: **** + .byte %00000000 ; 0357 1-6a: + + .byte %01111110 ; 0358 1-6b: ****** + .byte %01100000 ; 0359 1-6b: ** + .byte %01111100 ; 035A 1-6b: ***** + .byte %00000110 ; 035B 1-6b: ** + .byte %00000110 ; 035C 1-6b: ** + .byte %01100110 ; 035D 1-6b: ** ** + .byte %00111100 ; 035E 1-6b: **** + .byte %00000000 ; 035F 1-6b: + + .byte %00111100 ; 0360 1-6c: **** + .byte %01100110 ; 0361 1-6c: ** ** + .byte %01100000 ; 0362 1-6c: ** + .byte %01111100 ; 0363 1-6c: ***** + .byte %01100110 ; 0364 1-6c: ** ** + .byte %01100110 ; 0365 1-6c: ** ** + .byte %00111100 ; 0366 1-6c: **** + .byte %00000000 ; 0367 1-6c: + + .byte %00111100 ; 0368 1-6d: **** + .byte %01100110 ; 0369 1-6d: ** ** + .byte %01100000 ; 036A 1-6d: ** + .byte %01111100 ; 036B 1-6d: ***** + .byte %01100110 ; 036C 1-6d: ** ** + .byte %01100110 ; 036D 1-6d: ** ** + .byte %00111100 ; 036E 1-6d: **** + .byte %00000000 ; 036F 1-6d: + + .byte %01111110 ; 0370 1-6e: ****** + .byte %01100110 ; 0371 1-6e: ** ** + .byte %00001100 ; 0372 1-6e: ** + .byte %00011000 ; 0373 1-6e: ** + .byte %00011000 ; 0374 1-6e: ** + .byte %00011000 ; 0375 1-6e: ** + .byte %00011000 ; 0376 1-6e: ** + .byte %00000000 ; 0377 1-6e: + + .byte %01111110 ; 0378 1-6f: ****** + .byte %01100110 ; 0379 1-6f: ** ** + .byte %00001100 ; 037A 1-6f: ** + .byte %00011000 ; 037B 1-6f: ** + .byte %00011000 ; 037C 1-6f: ** + .byte %00011000 ; 037D 1-6f: ** + .byte %00011000 ; 037E 1-6f: ** + .byte %00000000 ; 037F 1-6f: + + .byte %00111100 ; 0380 1-70: **** + .byte %01100110 ; 0381 1-70: ** ** + .byte %01100110 ; 0382 1-70: ** ** + .byte %00111100 ; 0383 1-70: **** + .byte %01100110 ; 0384 1-70: ** ** + .byte %01100110 ; 0385 1-70: ** ** + .byte %00111100 ; 0386 1-70: **** + .byte %00000000 ; 0387 1-70: + + .byte %00111100 ; 0388 1-71: **** + .byte %01100110 ; 0389 1-71: ** ** + .byte %01100110 ; 038A 1-71: ** ** + .byte %00111100 ; 038B 1-71: **** + .byte %01100110 ; 038C 1-71: ** ** + .byte %01100110 ; 038D 1-71: ** ** + .byte %00111100 ; 038E 1-71: **** + .byte %00000000 ; 038F 1-71: + + .byte %00111100 ; 0390 1-72: **** + .byte %01100110 ; 0391 1-72: ** ** + .byte %01100110 ; 0392 1-72: ** ** + .byte %00111110 ; 0393 1-72: ***** + .byte %00000110 ; 0394 1-72: ** + .byte %01100110 ; 0395 1-72: ** ** + .byte %00111100 ; 0396 1-72: **** + .byte %00000000 ; 0397 1-72: + + .byte %00111100 ; 0398 1-73: **** + .byte %01100110 ; 0399 1-73: ** ** + .byte %01100110 ; 039A 1-73: ** ** + .byte %00111110 ; 039B 1-73: ***** + .byte %00000110 ; 039C 1-73: ** + .byte %01100110 ; 039D 1-73: ** ** + .byte %00111100 ; 039E 1-73: **** + .byte %00000000 ; 039F 1-73: + + .byte %00000000 ; 03A0 1-74: + .byte %00000000 ; 03A1 1-74: + .byte %00011000 ; 03A2 1-74: ** + .byte %00000000 ; 03A3 1-74: + .byte %00000000 ; 03A4 1-74: + .byte %00011000 ; 03A5 1-74: ** + .byte %00000000 ; 03A6 1-74: + .byte %00000000 ; 03A7 1-74: + + .byte %00000000 ; 03A8 1-75: + .byte %00000000 ; 03A9 1-75: + .byte %00011000 ; 03AA 1-75: ** + .byte %00000000 ; 03AB 1-75: + .byte %00000000 ; 03AC 1-75: + .byte %00011000 ; 03AD 1-75: ** + .byte %00000000 ; 03AE 1-75: + .byte %00000000 ; 03AF 1-75: + + .byte %00000000 ; 03B0 1-76: + .byte %00000000 ; 03B1 1-76: + .byte %00011000 ; 03B2 1-76: ** + .byte %00000000 ; 03B3 1-76: + .byte %00000000 ; 03B4 1-76: + .byte %00011000 ; 03B5 1-76: ** + .byte %00011000 ; 03B6 1-76: ** + .byte %00110000 ; 03B7 1-76: ** + + .byte %00000000 ; 03B8 1-77: + .byte %00000000 ; 03B9 1-77: + .byte %00011000 ; 03BA 1-77: ** + .byte %00000000 ; 03BB 1-77: + .byte %00000000 ; 03BC 1-77: + .byte %00011000 ; 03BD 1-77: ** + .byte %00011000 ; 03BE 1-77: ** + .byte %00110000 ; 03BF 1-77: ** + + .byte %00001110 ; 03C0 1-78: *** + .byte %00011000 ; 03C1 1-78: ** + .byte %00110000 ; 03C2 1-78: ** + .byte %01100000 ; 03C3 1-78: ** + .byte %00110000 ; 03C4 1-78: ** + .byte %00011000 ; 03C5 1-78: ** + .byte %00001110 ; 03C6 1-78: *** + .byte %00000000 ; 03C7 1-78: + + .byte %00001110 ; 03C8 1-79: *** + .byte %00011000 ; 03C9 1-79: ** + .byte %00110000 ; 03CA 1-79: ** + .byte %01100000 ; 03CB 1-79: ** + .byte %00110000 ; 03CC 1-79: ** + .byte %00011000 ; 03CD 1-79: ** + .byte %00001110 ; 03CE 1-79: *** + .byte %00000000 ; 03CF 1-79: + + .byte %00000000 ; 03D0 1-7a: + .byte %00000000 ; 03D1 1-7a: + .byte %01111110 ; 03D2 1-7a: ****** + .byte %00000000 ; 03D3 1-7a: + .byte %01111110 ; 03D4 1-7a: ****** + .byte %00000000 ; 03D5 1-7a: + .byte %00000000 ; 03D6 1-7a: + .byte %00000000 ; 03D7 1-7a: + + .byte %00000000 ; 03D8 1-7b: + .byte %00000000 ; 03D9 1-7b: + .byte %01111110 ; 03DA 1-7b: ****** + .byte %00000000 ; 03DB 1-7b: + .byte %01111110 ; 03DC 1-7b: ****** + .byte %00000000 ; 03DD 1-7b: + .byte %00000000 ; 03DE 1-7b: + .byte %00000000 ; 03DF 1-7b: + + .byte %01110000 ; 03E0 1-7c: *** + .byte %00011000 ; 03E1 1-7c: ** + .byte %00001100 ; 03E2 1-7c: ** + .byte %00000110 ; 03E3 1-7c: ** + .byte %00001100 ; 03E4 1-7c: ** + .byte %00011000 ; 03E5 1-7c: ** + .byte %01110000 ; 03E6 1-7c: *** + .byte %00000000 ; 03E7 1-7c: + + .byte %01110000 ; 03E8 1-7d: *** + .byte %00011000 ; 03E9 1-7d: ** + .byte %00001100 ; 03EA 1-7d: ** + .byte %00000110 ; 03EB 1-7d: ** + .byte %00001100 ; 03EC 1-7d: ** + .byte %00011000 ; 03ED 1-7d: ** + .byte %01110000 ; 03EE 1-7d: *** + .byte %00000000 ; 03EF 1-7d: + + .byte %00111100 ; 03F0 1-7e: **** + .byte %01100110 ; 03F1 1-7e: ** ** + .byte %00000110 ; 03F2 1-7e: ** + .byte %00001100 ; 03F3 1-7e: ** + .byte %00011000 ; 03F4 1-7e: ** + .byte %00000000 ; 03F5 1-7e: + .byte %00011000 ; 03F6 1-7e: ** + .byte %00000000 ; 03F7 1-7e: + + .byte %00111100 ; 03F8 1-7f: **** + .byte %01100110 ; 03F9 1-7f: ** ** + .byte %00000110 ; 03FA 1-7f: ** + .byte %00001100 ; 03FB 1-7f: ** + .byte %00011000 ; 03FC 1-7f: ** + .byte %00000000 ; 03FD 1-7f: + .byte %00011000 ; 03FE 1-7f: ** + .byte %00000000 ; 03FF 1-7f: + + .byte %00111100 ; 0400 1-80: **** + .byte %01100110 ; 0401 1-80: ** ** + .byte %01101110 ; 0402 1-80: ** *** + .byte %01101110 ; 0403 1-80: ** *** + .byte %01100000 ; 0404 1-80: ** + .byte %01100010 ; 0405 1-80: ** * + .byte %00111100 ; 0406 1-80: **** + .byte %00000000 ; 0407 1-80: + + .byte %00111100 ; 0408 1-81: **** + .byte %01100110 ; 0409 1-81: ** ** + .byte %01101110 ; 040A 1-81: ** *** + .byte %01101110 ; 040B 1-81: ** *** + .byte %01100000 ; 040C 1-81: ** + .byte %01100010 ; 040D 1-81: ** * + .byte %00111100 ; 040E 1-81: **** + .byte %00000000 ; 040F 1-81: + + .byte %00011000 ; 0410 1-82: ** + .byte %00111100 ; 0411 1-82: **** + .byte %01100110 ; 0412 1-82: ** ** + .byte %01111110 ; 0413 1-82: ****** + .byte %01100110 ; 0414 1-82: ** ** + .byte %01100110 ; 0415 1-82: ** ** + .byte %01100110 ; 0416 1-82: ** ** + .byte %00000000 ; 0417 1-82: + + .byte %00011000 ; 0418 1-83: ** + .byte %00111100 ; 0419 1-83: **** + .byte %01100110 ; 041A 1-83: ** ** + .byte %01111110 ; 041B 1-83: ****** + .byte %01100110 ; 041C 1-83: ** ** + .byte %01100110 ; 041D 1-83: ** ** + .byte %01100110 ; 041E 1-83: ** ** + .byte %00000000 ; 041F 1-83: + + .byte %01111100 ; 0420 1-84: ***** + .byte %01100110 ; 0421 1-84: ** ** + .byte %01100110 ; 0422 1-84: ** ** + .byte %01111100 ; 0423 1-84: ***** + .byte %01100110 ; 0424 1-84: ** ** + .byte %01100110 ; 0425 1-84: ** ** + .byte %01111100 ; 0426 1-84: ***** + .byte %00000000 ; 0427 1-84: + + .byte %01111100 ; 0428 1-85: ***** + .byte %01100110 ; 0429 1-85: ** ** + .byte %01100110 ; 042A 1-85: ** ** + .byte %01111100 ; 042B 1-85: ***** + .byte %01100110 ; 042C 1-85: ** ** + .byte %01100110 ; 042D 1-85: ** ** + .byte %01111100 ; 042E 1-85: ***** + .byte %00000000 ; 042F 1-85: + + .byte %00111100 ; 0430 1-86: **** + .byte %01100110 ; 0431 1-86: ** ** + .byte %01100000 ; 0432 1-86: ** + .byte %01100000 ; 0433 1-86: ** + .byte %01100000 ; 0434 1-86: ** + .byte %01100110 ; 0435 1-86: ** ** + .byte %00111100 ; 0436 1-86: **** + .byte %00000000 ; 0437 1-86: + + .byte %00111100 ; 0438 1-87: **** + .byte %01100110 ; 0439 1-87: ** ** + .byte %01100000 ; 043A 1-87: ** + .byte %01100000 ; 043B 1-87: ** + .byte %01100000 ; 043C 1-87: ** + .byte %01100110 ; 043D 1-87: ** ** + .byte %00111100 ; 043E 1-87: **** + .byte %00000000 ; 043F 1-87: + + .byte %01111000 ; 0440 1-88: **** + .byte %01101100 ; 0441 1-88: ** ** + .byte %01100110 ; 0442 1-88: ** ** + .byte %01100110 ; 0443 1-88: ** ** + .byte %01100110 ; 0444 1-88: ** ** + .byte %01101100 ; 0445 1-88: ** ** + .byte %01111000 ; 0446 1-88: **** + .byte %00000000 ; 0447 1-88: + + .byte %01111000 ; 0448 1-89: **** + .byte %01101100 ; 0449 1-89: ** ** + .byte %01100110 ; 044A 1-89: ** ** + .byte %01100110 ; 044B 1-89: ** ** + .byte %01100110 ; 044C 1-89: ** ** + .byte %01101100 ; 044D 1-89: ** ** + .byte %01111000 ; 044E 1-89: **** + .byte %00000000 ; 044F 1-89: + + .byte %01111110 ; 0450 1-8a: ****** + .byte %01100000 ; 0451 1-8a: ** + .byte %01100000 ; 0452 1-8a: ** + .byte %01111000 ; 0453 1-8a: **** + .byte %01100000 ; 0454 1-8a: ** + .byte %01100000 ; 0455 1-8a: ** + .byte %01111110 ; 0456 1-8a: ****** + .byte %00000000 ; 0457 1-8a: + + .byte %01111110 ; 0458 1-8b: ****** + .byte %01100000 ; 0459 1-8b: ** + .byte %01100000 ; 045A 1-8b: ** + .byte %01111000 ; 045B 1-8b: **** + .byte %01100000 ; 045C 1-8b: ** + .byte %01100000 ; 045D 1-8b: ** + .byte %01111110 ; 045E 1-8b: ****** + .byte %00000000 ; 045F 1-8b: + + .byte %01111110 ; 0460 1-8c: ****** + .byte %01100000 ; 0461 1-8c: ** + .byte %01100000 ; 0462 1-8c: ** + .byte %01111000 ; 0463 1-8c: **** + .byte %01100000 ; 0464 1-8c: ** + .byte %01100000 ; 0465 1-8c: ** + .byte %01100000 ; 0466 1-8c: ** + .byte %00000000 ; 0467 1-8c: + + .byte %01111110 ; 0468 1-8d: ****** + .byte %01100000 ; 0469 1-8d: ** + .byte %01100000 ; 046A 1-8d: ** + .byte %01111000 ; 046B 1-8d: **** + .byte %01100000 ; 046C 1-8d: ** + .byte %01100000 ; 046D 1-8d: ** + .byte %01100000 ; 046E 1-8d: ** + .byte %00000000 ; 046F 1-8d: + + .byte %00111100 ; 0470 1-8e: **** + .byte %01100110 ; 0471 1-8e: ** ** + .byte %01100000 ; 0472 1-8e: ** + .byte %01101110 ; 0473 1-8e: ** *** + .byte %01100110 ; 0474 1-8e: ** ** + .byte %01100110 ; 0475 1-8e: ** ** + .byte %00111100 ; 0476 1-8e: **** + .byte %00000000 ; 0477 1-8e: + + .byte %00111100 ; 0478 1-8f: **** + .byte %01100110 ; 0479 1-8f: ** ** + .byte %01100000 ; 047A 1-8f: ** + .byte %01101110 ; 047B 1-8f: ** *** + .byte %01100110 ; 047C 1-8f: ** ** + .byte %01100110 ; 047D 1-8f: ** ** + .byte %00111100 ; 047E 1-8f: **** + .byte %00000000 ; 047F 1-8f: + + .byte %01100110 ; 0480 1-90: ** ** + .byte %01100110 ; 0481 1-90: ** ** + .byte %01100110 ; 0482 1-90: ** ** + .byte %01111110 ; 0483 1-90: ****** + .byte %01100110 ; 0484 1-90: ** ** + .byte %01100110 ; 0485 1-90: ** ** + .byte %01100110 ; 0486 1-90: ** ** + .byte %00000000 ; 0487 1-90: + + .byte %01100110 ; 0488 1-91: ** ** + .byte %01100110 ; 0489 1-91: ** ** + .byte %01100110 ; 048A 1-91: ** ** + .byte %01111110 ; 048B 1-91: ****** + .byte %01100110 ; 048C 1-91: ** ** + .byte %01100110 ; 048D 1-91: ** ** + .byte %01100110 ; 048E 1-91: ** ** + .byte %00000000 ; 048F 1-91: + + .byte %00111100 ; 0490 1-92: **** + .byte %00011000 ; 0491 1-92: ** + .byte %00011000 ; 0492 1-92: ** + .byte %00011000 ; 0493 1-92: ** + .byte %00011000 ; 0494 1-92: ** + .byte %00011000 ; 0495 1-92: ** + .byte %00111100 ; 0496 1-92: **** + .byte %00000000 ; 0497 1-92: + + .byte %00111100 ; 0498 1-93: **** + .byte %00011000 ; 0499 1-93: ** + .byte %00011000 ; 049A 1-93: ** + .byte %00011000 ; 049B 1-93: ** + .byte %00011000 ; 049C 1-93: ** + .byte %00011000 ; 049D 1-93: ** + .byte %00111100 ; 049E 1-93: **** + .byte %00000000 ; 049F 1-93: + + .byte %00011110 ; 04A0 1-94: **** + .byte %00001100 ; 04A1 1-94: ** + .byte %00001100 ; 04A2 1-94: ** + .byte %00001100 ; 04A3 1-94: ** + .byte %00001100 ; 04A4 1-94: ** + .byte %01101100 ; 04A5 1-94: ** ** + .byte %00111000 ; 04A6 1-94: *** + .byte %00000000 ; 04A7 1-94: + + .byte %00011110 ; 04A8 1-95: **** + .byte %00001100 ; 04A9 1-95: ** + .byte %00001100 ; 04AA 1-95: ** + .byte %00001100 ; 04AB 1-95: ** + .byte %00001100 ; 04AC 1-95: ** + .byte %01101100 ; 04AD 1-95: ** ** + .byte %00111000 ; 04AE 1-95: *** + .byte %00000000 ; 04AF 1-95: + + .byte %01100110 ; 04B0 1-96: ** ** + .byte %01101100 ; 04B1 1-96: ** ** + .byte %01111000 ; 04B2 1-96: **** + .byte %01110000 ; 04B3 1-96: *** + .byte %01111000 ; 04B4 1-96: **** + .byte %01101100 ; 04B5 1-96: ** ** + .byte %01100110 ; 04B6 1-96: ** ** + .byte %00000000 ; 04B7 1-96: + + .byte %01100110 ; 04B8 1-97: ** ** + .byte %01101100 ; 04B9 1-97: ** ** + .byte %01111000 ; 04BA 1-97: **** + .byte %01110000 ; 04BB 1-97: *** + .byte %01111000 ; 04BC 1-97: **** + .byte %01101100 ; 04BD 1-97: ** ** + .byte %01100110 ; 04BE 1-97: ** ** + .byte %00000000 ; 04BF 1-97: + + .byte %01100000 ; 04C0 1-98: ** + .byte %01100000 ; 04C1 1-98: ** + .byte %01100000 ; 04C2 1-98: ** + .byte %01100000 ; 04C3 1-98: ** + .byte %01100000 ; 04C4 1-98: ** + .byte %01100000 ; 04C5 1-98: ** + .byte %01111110 ; 04C6 1-98: ****** + .byte %00000000 ; 04C7 1-98: + + .byte %01100000 ; 04C8 1-99: ** + .byte %01100000 ; 04C9 1-99: ** + .byte %01100000 ; 04CA 1-99: ** + .byte %01100000 ; 04CB 1-99: ** + .byte %01100000 ; 04CC 1-99: ** + .byte %01100000 ; 04CD 1-99: ** + .byte %01111110 ; 04CE 1-99: ****** + .byte %00000000 ; 04CF 1-99: + + .byte %01100011 ; 04D0 1-9a: ** ** + .byte %01110111 ; 04D1 1-9a: *** *** + .byte %01111111 ; 04D2 1-9a: ******* + .byte %01101011 ; 04D3 1-9a: ** * ** + .byte %01100011 ; 04D4 1-9a: ** ** + .byte %01100011 ; 04D5 1-9a: ** ** + .byte %01100011 ; 04D6 1-9a: ** ** + .byte %00000000 ; 04D7 1-9a: + + .byte %01100011 ; 04D8 1-9b: ** ** + .byte %01110111 ; 04D9 1-9b: *** *** + .byte %01111111 ; 04DA 1-9b: ******* + .byte %01101011 ; 04DB 1-9b: ** * ** + .byte %01100011 ; 04DC 1-9b: ** ** + .byte %01100011 ; 04DD 1-9b: ** ** + .byte %01100011 ; 04DE 1-9b: ** ** + .byte %00000000 ; 04DF 1-9b: + + .byte %01100110 ; 04E0 1-9c: ** ** + .byte %01110110 ; 04E1 1-9c: *** ** + .byte %01111110 ; 04E2 1-9c: ****** + .byte %01111110 ; 04E3 1-9c: ****** + .byte %01101110 ; 04E4 1-9c: ** *** + .byte %01100110 ; 04E5 1-9c: ** ** + .byte %01100110 ; 04E6 1-9c: ** ** + .byte %00000000 ; 04E7 1-9c: + + .byte %01100110 ; 04E8 1-9d: ** ** + .byte %01110110 ; 04E9 1-9d: *** ** + .byte %01111110 ; 04EA 1-9d: ****** + .byte %01111110 ; 04EB 1-9d: ****** + .byte %01101110 ; 04EC 1-9d: ** *** + .byte %01100110 ; 04ED 1-9d: ** ** + .byte %01100110 ; 04EE 1-9d: ** ** + .byte %00000000 ; 04EF 1-9d: + + .byte %00111100 ; 04F0 1-9e: **** + .byte %01100110 ; 04F1 1-9e: ** ** + .byte %01100110 ; 04F2 1-9e: ** ** + .byte %01100110 ; 04F3 1-9e: ** ** + .byte %01100110 ; 04F4 1-9e: ** ** + .byte %01100110 ; 04F5 1-9e: ** ** + .byte %00111100 ; 04F6 1-9e: **** + .byte %00000000 ; 04F7 1-9e: + + .byte %00111100 ; 04F8 1-9f: **** + .byte %01100110 ; 04F9 1-9f: ** ** + .byte %01100110 ; 04FA 1-9f: ** ** + .byte %01100110 ; 04FB 1-9f: ** ** + .byte %01100110 ; 04FC 1-9f: ** ** + .byte %01100110 ; 04FD 1-9f: ** ** + .byte %00111100 ; 04FE 1-9f: **** + .byte %00000000 ; 04FF 1-9f: + + .byte %01111100 ; 0500 1-a0: ***** + .byte %01100110 ; 0501 1-a0: ** ** + .byte %01100110 ; 0502 1-a0: ** ** + .byte %01111100 ; 0503 1-a0: ***** + .byte %01100000 ; 0504 1-a0: ** + .byte %01100000 ; 0505 1-a0: ** + .byte %01100000 ; 0506 1-a0: ** + .byte %00000000 ; 0507 1-a0: + + .byte %01111100 ; 0508 1-a1: ***** + .byte %01100110 ; 0509 1-a1: ** ** + .byte %01100110 ; 050A 1-a1: ** ** + .byte %01111100 ; 050B 1-a1: ***** + .byte %01100000 ; 050C 1-a1: ** + .byte %01100000 ; 050D 1-a1: ** + .byte %01100000 ; 050E 1-a1: ** + .byte %00000000 ; 050F 1-a1: + + .byte %00111100 ; 0510 1-a2: **** + .byte %01100110 ; 0511 1-a2: ** ** + .byte %01100110 ; 0512 1-a2: ** ** + .byte %01100110 ; 0513 1-a2: ** ** + .byte %01100110 ; 0514 1-a2: ** ** + .byte %00111100 ; 0515 1-a2: **** + .byte %00001110 ; 0516 1-a2: *** + .byte %00000000 ; 0517 1-a2: + + .byte %00111100 ; 0518 1-a3: **** + .byte %01100110 ; 0519 1-a3: ** ** + .byte %01100110 ; 051A 1-a3: ** ** + .byte %01100110 ; 051B 1-a3: ** ** + .byte %01100110 ; 051C 1-a3: ** ** + .byte %00111100 ; 051D 1-a3: **** + .byte %00001110 ; 051E 1-a3: *** + .byte %00000000 ; 051F 1-a3: + + .byte %01111100 ; 0520 1-a4: ***** + .byte %01100110 ; 0521 1-a4: ** ** + .byte %01100110 ; 0522 1-a4: ** ** + .byte %01111100 ; 0523 1-a4: ***** + .byte %01111000 ; 0524 1-a4: **** + .byte %01101100 ; 0525 1-a4: ** ** + .byte %01100110 ; 0526 1-a4: ** ** + .byte %00000000 ; 0527 1-a4: + + .byte %01111100 ; 0528 1-a5: ***** + .byte %01100110 ; 0529 1-a5: ** ** + .byte %01100110 ; 052A 1-a5: ** ** + .byte %01111100 ; 052B 1-a5: ***** + .byte %01111000 ; 052C 1-a5: **** + .byte %01101100 ; 052D 1-a5: ** ** + .byte %01100110 ; 052E 1-a5: ** ** + .byte %00000000 ; 052F 1-a5: + + .byte %00111100 ; 0530 1-a6: **** + .byte %01100110 ; 0531 1-a6: ** ** + .byte %01100000 ; 0532 1-a6: ** + .byte %00111100 ; 0533 1-a6: **** + .byte %00000110 ; 0534 1-a6: ** + .byte %01100110 ; 0535 1-a6: ** ** + .byte %00111100 ; 0536 1-a6: **** + .byte %00000000 ; 0537 1-a6: + + .byte %00111100 ; 0538 1-a7: **** + .byte %01100110 ; 0539 1-a7: ** ** + .byte %01100000 ; 053A 1-a7: ** + .byte %00111100 ; 053B 1-a7: **** + .byte %00000110 ; 053C 1-a7: ** + .byte %01100110 ; 053D 1-a7: ** ** + .byte %00111100 ; 053E 1-a7: **** + .byte %00000000 ; 053F 1-a7: + + .byte %01111110 ; 0540 1-a8: ****** + .byte %00011000 ; 0541 1-a8: ** + .byte %00011000 ; 0542 1-a8: ** + .byte %00011000 ; 0543 1-a8: ** + .byte %00011000 ; 0544 1-a8: ** + .byte %00011000 ; 0545 1-a8: ** + .byte %00011000 ; 0546 1-a8: ** + .byte %00000000 ; 0547 1-a8: + + .byte %01111110 ; 0548 1-a9: ****** + .byte %00011000 ; 0549 1-a9: ** + .byte %00011000 ; 054A 1-a9: ** + .byte %00011000 ; 054B 1-a9: ** + .byte %00011000 ; 054C 1-a9: ** + .byte %00011000 ; 054D 1-a9: ** + .byte %00011000 ; 054E 1-a9: ** + .byte %00000000 ; 054F 1-a9: + + .byte %01100110 ; 0550 1-aa: ** ** + .byte %01100110 ; 0551 1-aa: ** ** + .byte %01100110 ; 0552 1-aa: ** ** + .byte %01100110 ; 0553 1-aa: ** ** + .byte %01100110 ; 0554 1-aa: ** ** + .byte %01100110 ; 0555 1-aa: ** ** + .byte %00111100 ; 0556 1-aa: **** + .byte %00000000 ; 0557 1-aa: + + .byte %01100110 ; 0558 1-ab: ** ** + .byte %01100110 ; 0559 1-ab: ** ** + .byte %01100110 ; 055A 1-ab: ** ** + .byte %01100110 ; 055B 1-ab: ** ** + .byte %01100110 ; 055C 1-ab: ** ** + .byte %01100110 ; 055D 1-ab: ** ** + .byte %00111100 ; 055E 1-ab: **** + .byte %00000000 ; 055F 1-ab: + + .byte %01100110 ; 0560 1-ac: ** ** + .byte %01100110 ; 0561 1-ac: ** ** + .byte %01100110 ; 0562 1-ac: ** ** + .byte %01100110 ; 0563 1-ac: ** ** + .byte %01100110 ; 0564 1-ac: ** ** + .byte %00111100 ; 0565 1-ac: **** + .byte %00011000 ; 0566 1-ac: ** + .byte %00000000 ; 0567 1-ac: + + .byte %01100110 ; 0568 1-ad: ** ** + .byte %01100110 ; 0569 1-ad: ** ** + .byte %01100110 ; 056A 1-ad: ** ** + .byte %01100110 ; 056B 1-ad: ** ** + .byte %01100110 ; 056C 1-ad: ** ** + .byte %00111100 ; 056D 1-ad: **** + .byte %00011000 ; 056E 1-ad: ** + .byte %00000000 ; 056F 1-ad: + + .byte %01100011 ; 0570 1-ae: ** ** + .byte %01100011 ; 0571 1-ae: ** ** + .byte %01100011 ; 0572 1-ae: ** ** + .byte %01101011 ; 0573 1-ae: ** * ** + .byte %01111111 ; 0574 1-ae: ******* + .byte %01110111 ; 0575 1-ae: *** *** + .byte %01100011 ; 0576 1-ae: ** ** + .byte %00000000 ; 0577 1-ae: + + .byte %01100011 ; 0578 1-af: ** ** + .byte %01100011 ; 0579 1-af: ** ** + .byte %01100011 ; 057A 1-af: ** ** + .byte %01101011 ; 057B 1-af: ** * ** + .byte %01111111 ; 057C 1-af: ******* + .byte %01110111 ; 057D 1-af: *** *** + .byte %01100011 ; 057E 1-af: ** ** + .byte %00000000 ; 057F 1-af: + + .byte %01100110 ; 0580 1-b0: ** ** + .byte %01100110 ; 0581 1-b0: ** ** + .byte %00111100 ; 0582 1-b0: **** + .byte %00011000 ; 0583 1-b0: ** + .byte %00111100 ; 0584 1-b0: **** + .byte %01100110 ; 0585 1-b0: ** ** + .byte %01100110 ; 0586 1-b0: ** ** + .byte %00000000 ; 0587 1-b0: + + .byte %01100110 ; 0588 1-b1: ** ** + .byte %01100110 ; 0589 1-b1: ** ** + .byte %00111100 ; 058A 1-b1: **** + .byte %00011000 ; 058B 1-b1: ** + .byte %00111100 ; 058C 1-b1: **** + .byte %01100110 ; 058D 1-b1: ** ** + .byte %01100110 ; 058E 1-b1: ** ** + .byte %00000000 ; 058F 1-b1: + + .byte %01100110 ; 0590 1-b2: ** ** + .byte %01100110 ; 0591 1-b2: ** ** + .byte %01100110 ; 0592 1-b2: ** ** + .byte %00111100 ; 0593 1-b2: **** + .byte %00011000 ; 0594 1-b2: ** + .byte %00011000 ; 0595 1-b2: ** + .byte %00011000 ; 0596 1-b2: ** + .byte %00000000 ; 0597 1-b2: + + .byte %01100110 ; 0598 1-b3: ** ** + .byte %01100110 ; 0599 1-b3: ** ** + .byte %01100110 ; 059A 1-b3: ** ** + .byte %00111100 ; 059B 1-b3: **** + .byte %00011000 ; 059C 1-b3: ** + .byte %00011000 ; 059D 1-b3: ** + .byte %00011000 ; 059E 1-b3: ** + .byte %00000000 ; 059F 1-b3: + + .byte %01111110 ; 05A0 1-b4: ****** + .byte %00000110 ; 05A1 1-b4: ** + .byte %00001100 ; 05A2 1-b4: ** + .byte %00011000 ; 05A3 1-b4: ** + .byte %00110000 ; 05A4 1-b4: ** + .byte %01100000 ; 05A5 1-b4: ** + .byte %01111110 ; 05A6 1-b4: ****** + .byte %00000000 ; 05A7 1-b4: + + .byte %01111110 ; 05A8 1-b5: ****** + .byte %00000110 ; 05A9 1-b5: ** + .byte %00001100 ; 05AA 1-b5: ** + .byte %00011000 ; 05AB 1-b5: ** + .byte %00110000 ; 05AC 1-b5: ** + .byte %01100000 ; 05AD 1-b5: ** + .byte %01111110 ; 05AE 1-b5: ****** + .byte %00000000 ; 05AF 1-b5: + + .byte %00111100 ; 05B0 1-b6: **** + .byte %00110000 ; 05B1 1-b6: ** + .byte %00110000 ; 05B2 1-b6: ** + .byte %00110000 ; 05B3 1-b6: ** + .byte %00110000 ; 05B4 1-b6: ** + .byte %00110000 ; 05B5 1-b6: ** + .byte %00111100 ; 05B6 1-b6: **** + .byte %00000000 ; 05B7 1-b6: + + .byte %00111100 ; 05B8 1-b7: **** + .byte %00110000 ; 05B9 1-b7: ** + .byte %00110000 ; 05BA 1-b7: ** + .byte %00110000 ; 05BB 1-b7: ** + .byte %00110000 ; 05BC 1-b7: ** + .byte %00110000 ; 05BD 1-b7: ** + .byte %00111100 ; 05BE 1-b7: **** + .byte %00000000 ; 05BF 1-b7: + + .byte %01100000 ; 05C0 1-b8: ** + .byte %00110000 ; 05C1 1-b8: ** + .byte %00011000 ; 05C2 1-b8: ** + .byte %00001100 ; 05C3 1-b8: ** + .byte %00000110 ; 05C4 1-b8: ** + .byte %00000011 ; 05C5 1-b8: ** + .byte %00000000 ; 05C6 1-b8: + .byte %00000000 ; 05C7 1-b8: + + .byte %01100000 ; 05C8 1-b9: ** + .byte %00110000 ; 05C9 1-b9: ** + .byte %00011000 ; 05CA 1-b9: ** + .byte %00001100 ; 05CB 1-b9: ** + .byte %00000110 ; 05CC 1-b9: ** + .byte %00000011 ; 05CD 1-b9: ** + .byte %00000000 ; 05CE 1-b9: + .byte %00000000 ; 05CF 1-b9: + + .byte %00111100 ; 05D0 1-ba: **** + .byte %00001100 ; 05D1 1-ba: ** + .byte %00001100 ; 05D2 1-ba: ** + .byte %00001100 ; 05D3 1-ba: ** + .byte %00001100 ; 05D4 1-ba: ** + .byte %00001100 ; 05D5 1-ba: ** + .byte %00111100 ; 05D6 1-ba: **** + .byte %00000000 ; 05D7 1-ba: + + .byte %00111100 ; 05D8 1-bb: **** + .byte %00001100 ; 05D9 1-bb: ** + .byte %00001100 ; 05DA 1-bb: ** + .byte %00001100 ; 05DB 1-bb: ** + .byte %00001100 ; 05DC 1-bb: ** + .byte %00001100 ; 05DD 1-bb: ** + .byte %00111100 ; 05DE 1-bb: **** + .byte %00000000 ; 05DF 1-bb: + + .byte %00000000 ; 05E0 1-bc: + .byte %00011000 ; 05E1 1-bc: ** + .byte %00111100 ; 05E2 1-bc: **** + .byte %01100110 ; 05E3 1-bc: ** ** + .byte %00000000 ; 05E4 1-bc: + .byte %00000000 ; 05E5 1-bc: + .byte %00000000 ; 05E6 1-bc: + .byte %00000000 ; 05E7 1-bc: + + .byte %00000000 ; 05E8 1-bd: + .byte %00011000 ; 05E9 1-bd: ** + .byte %00111100 ; 05EA 1-bd: **** + .byte %01100110 ; 05EB 1-bd: ** ** + .byte %00000000 ; 05EC 1-bd: + .byte %00000000 ; 05ED 1-bd: + .byte %00000000 ; 05EE 1-bd: + .byte %00000000 ; 05EF 1-bd: + + .byte %00000000 ; 05F0 1-be: + .byte %00000000 ; 05F1 1-be: + .byte %00000000 ; 05F2 1-be: + .byte %00000000 ; 05F3 1-be: + .byte %00000000 ; 05F4 1-be: + .byte %00000000 ; 05F5 1-be: + .byte %01111111 ; 05F6 1-be: ******* + .byte %00000000 ; 05F7 1-be: + + .byte %00000000 ; 05F8 1-bf: + .byte %00000000 ; 05F9 1-bf: + .byte %00000000 ; 05FA 1-bf: + .byte %00000000 ; 05FB 1-bf: + .byte %00000000 ; 05FC 1-bf: + .byte %00000000 ; 05FD 1-bf: + .byte %01111111 ; 05FE 1-bf: ******* + .byte %00000000 ; 05FF 1-bf: + + .byte %00011000 ; 0600 1-c0: ** + .byte %00011000 ; 0601 1-c0: ** + .byte %00011000 ; 0602 1-c0: ** + .byte %00000000 ; 0603 1-c0: + .byte %00000000 ; 0604 1-c0: + .byte %00000000 ; 0605 1-c0: + .byte %00000000 ; 0606 1-c0: + .byte %00000000 ; 0607 1-c0: + + .byte %00011000 ; 0608 1-c1: ** + .byte %00011000 ; 0609 1-c1: ** + .byte %00011000 ; 060A 1-c1: ** + .byte %00000000 ; 060B 1-c1: + .byte %00000000 ; 060C 1-c1: + .byte %00000000 ; 060D 1-c1: + .byte %00000000 ; 060E 1-c1: + .byte %00000000 ; 060F 1-c1: + + .byte %00000000 ; 0610 1-c2: + .byte %00000000 ; 0611 1-c2: + .byte %00111100 ; 0612 1-c2: **** + .byte %00000110 ; 0613 1-c2: ** + .byte %00111110 ; 0614 1-c2: ***** + .byte %01100110 ; 0615 1-c2: ** ** + .byte %00111110 ; 0616 1-c2: ***** + .byte %00000000 ; 0617 1-c2: + + .byte %00000000 ; 0618 1-c3: + .byte %00000000 ; 0619 1-c3: + .byte %00111100 ; 061A 1-c3: **** + .byte %00000110 ; 061B 1-c3: ** + .byte %00111110 ; 061C 1-c3: ***** + .byte %01100110 ; 061D 1-c3: ** ** + .byte %00111110 ; 061E 1-c3: ***** + .byte %00000000 ; 061F 1-c3: + + .byte %00000000 ; 0620 1-c4: + .byte %01100000 ; 0621 1-c4: ** + .byte %01100000 ; 0622 1-c4: ** + .byte %01111100 ; 0623 1-c4: ***** + .byte %01100110 ; 0624 1-c4: ** ** + .byte %01100110 ; 0625 1-c4: ** ** + .byte %01111100 ; 0626 1-c4: ***** + .byte %00000000 ; 0627 1-c4: + + .byte %00000000 ; 0628 1-c5: + .byte %01100000 ; 0629 1-c5: ** + .byte %01100000 ; 062A 1-c5: ** + .byte %01111100 ; 062B 1-c5: ***** + .byte %01100110 ; 062C 1-c5: ** ** + .byte %01100110 ; 062D 1-c5: ** ** + .byte %01111100 ; 062E 1-c5: ***** + .byte %00000000 ; 062F 1-c5: + + .byte %00000000 ; 0630 1-c6: + .byte %00000000 ; 0631 1-c6: + .byte %00111100 ; 0632 1-c6: **** + .byte %01100000 ; 0633 1-c6: ** + .byte %01100000 ; 0634 1-c6: ** + .byte %01100000 ; 0635 1-c6: ** + .byte %00111100 ; 0636 1-c6: **** + .byte %00000000 ; 0637 1-c6: + + .byte %00000000 ; 0638 1-c7: + .byte %00000000 ; 0639 1-c7: + .byte %00111100 ; 063A 1-c7: **** + .byte %01100000 ; 063B 1-c7: ** + .byte %01100000 ; 063C 1-c7: ** + .byte %01100000 ; 063D 1-c7: ** + .byte %00111100 ; 063E 1-c7: **** + .byte %00000000 ; 063F 1-c7: + + .byte %00000000 ; 0640 1-c8: + .byte %00000110 ; 0641 1-c8: ** + .byte %00000110 ; 0642 1-c8: ** + .byte %00111110 ; 0643 1-c8: ***** + .byte %01100110 ; 0644 1-c8: ** ** + .byte %01100110 ; 0645 1-c8: ** ** + .byte %00111110 ; 0646 1-c8: ***** + .byte %00000000 ; 0647 1-c8: + + .byte %00000000 ; 0648 1-c9: + .byte %00000110 ; 0649 1-c9: ** + .byte %00000110 ; 064A 1-c9: ** + .byte %00111110 ; 064B 1-c9: ***** + .byte %01100110 ; 064C 1-c9: ** ** + .byte %01100110 ; 064D 1-c9: ** ** + .byte %00111110 ; 064E 1-c9: ***** + .byte %00000000 ; 064F 1-c9: + + .byte %00000000 ; 0650 1-ca: + .byte %00000000 ; 0651 1-ca: + .byte %00111100 ; 0652 1-ca: **** + .byte %01100110 ; 0653 1-ca: ** ** + .byte %01111110 ; 0654 1-ca: ****** + .byte %01100000 ; 0655 1-ca: ** + .byte %00111100 ; 0656 1-ca: **** + .byte %00000000 ; 0657 1-ca: + + .byte %00000000 ; 0658 1-cb: + .byte %00000000 ; 0659 1-cb: + .byte %00111100 ; 065A 1-cb: **** + .byte %01100110 ; 065B 1-cb: ** ** + .byte %01111110 ; 065C 1-cb: ****** + .byte %01100000 ; 065D 1-cb: ** + .byte %00111100 ; 065E 1-cb: **** + .byte %00000000 ; 065F 1-cb: + + .byte %00000000 ; 0660 1-cc: + .byte %00001110 ; 0661 1-cc: *** + .byte %00011000 ; 0662 1-cc: ** + .byte %00111110 ; 0663 1-cc: ***** + .byte %00011000 ; 0664 1-cc: ** + .byte %00011000 ; 0665 1-cc: ** + .byte %00011000 ; 0666 1-cc: ** + .byte %00000000 ; 0667 1-cc: + + .byte %00000000 ; 0668 1-cd: + .byte %00001110 ; 0669 1-cd: *** + .byte %00011000 ; 066A 1-cd: ** + .byte %00111110 ; 066B 1-cd: ***** + .byte %00011000 ; 066C 1-cd: ** + .byte %00011000 ; 066D 1-cd: ** + .byte %00011000 ; 066E 1-cd: ** + .byte %00000000 ; 066F 1-cd: + + .byte %00000000 ; 0670 1-ce: + .byte %00000000 ; 0671 1-ce: + .byte %00111110 ; 0672 1-ce: ***** + .byte %01100110 ; 0673 1-ce: ** ** + .byte %01100110 ; 0674 1-ce: ** ** + .byte %00111110 ; 0675 1-ce: ***** + .byte %00000110 ; 0676 1-ce: ** + .byte %01111100 ; 0677 1-ce: ***** + + .byte %00000000 ; 0678 1-cf: + .byte %00000000 ; 0679 1-cf: + .byte %00111110 ; 067A 1-cf: ***** + .byte %01100110 ; 067B 1-cf: ** ** + .byte %01100110 ; 067C 1-cf: ** ** + .byte %00111110 ; 067D 1-cf: ***** + .byte %00000110 ; 067E 1-cf: ** + .byte %01111100 ; 067F 1-cf: ***** + + .byte %00000000 ; 0680 1-d0: + .byte %01100000 ; 0681 1-d0: ** + .byte %01100000 ; 0682 1-d0: ** + .byte %01111100 ; 0683 1-d0: ***** + .byte %01100110 ; 0684 1-d0: ** ** + .byte %01100110 ; 0685 1-d0: ** ** + .byte %01100110 ; 0686 1-d0: ** ** + .byte %00000000 ; 0687 1-d0: + + .byte %00000000 ; 0688 1-d1: + .byte %01100000 ; 0689 1-d1: ** + .byte %01100000 ; 068A 1-d1: ** + .byte %01111100 ; 068B 1-d1: ***** + .byte %01100110 ; 068C 1-d1: ** ** + .byte %01100110 ; 068D 1-d1: ** ** + .byte %01100110 ; 068E 1-d1: ** ** + .byte %00000000 ; 068F 1-d1: + + .byte %00000000 ; 0690 1-d2: + .byte %00011000 ; 0691 1-d2: ** + .byte %00000000 ; 0692 1-d2: + .byte %00111000 ; 0693 1-d2: *** + .byte %00011000 ; 0694 1-d2: ** + .byte %00011000 ; 0695 1-d2: ** + .byte %00111100 ; 0696 1-d2: **** + .byte %00000000 ; 0697 1-d2: + + .byte %00000000 ; 0698 1-d3: + .byte %00011000 ; 0699 1-d3: ** + .byte %00000000 ; 069A 1-d3: + .byte %00111000 ; 069B 1-d3: *** + .byte %00011000 ; 069C 1-d3: ** + .byte %00011000 ; 069D 1-d3: ** + .byte %00111100 ; 069E 1-d3: **** + .byte %00000000 ; 069F 1-d3: + + .byte %00000000 ; 06A0 1-d4: + .byte %00000110 ; 06A1 1-d4: ** + .byte %00000000 ; 06A2 1-d4: + .byte %00000110 ; 06A3 1-d4: ** + .byte %00000110 ; 06A4 1-d4: ** + .byte %00000110 ; 06A5 1-d4: ** + .byte %00000110 ; 06A6 1-d4: ** + .byte %00111100 ; 06A7 1-d4: **** + + .byte %00000000 ; 06A8 1-d5: + .byte %00000110 ; 06A9 1-d5: ** + .byte %00000000 ; 06AA 1-d5: + .byte %00000110 ; 06AB 1-d5: ** + .byte %00000110 ; 06AC 1-d5: ** + .byte %00000110 ; 06AD 1-d5: ** + .byte %00000110 ; 06AE 1-d5: ** + .byte %00111100 ; 06AF 1-d5: **** + + .byte %00000000 ; 06B0 1-d6: + .byte %01100000 ; 06B1 1-d6: ** + .byte %01100000 ; 06B2 1-d6: ** + .byte %01101100 ; 06B3 1-d6: ** ** + .byte %01111000 ; 06B4 1-d6: **** + .byte %01101100 ; 06B5 1-d6: ** ** + .byte %01100110 ; 06B6 1-d6: ** ** + .byte %00000000 ; 06B7 1-d6: + + .byte %00000000 ; 06B8 1-d7: + .byte %01100000 ; 06B9 1-d7: ** + .byte %01100000 ; 06BA 1-d7: ** + .byte %01101100 ; 06BB 1-d7: ** ** + .byte %01111000 ; 06BC 1-d7: **** + .byte %01101100 ; 06BD 1-d7: ** ** + .byte %01100110 ; 06BE 1-d7: ** ** + .byte %00000000 ; 06BF 1-d7: + + .byte %00000000 ; 06C0 1-d8: + .byte %00111000 ; 06C1 1-d8: *** + .byte %00011000 ; 06C2 1-d8: ** + .byte %00011000 ; 06C3 1-d8: ** + .byte %00011000 ; 06C4 1-d8: ** + .byte %00011000 ; 06C5 1-d8: ** + .byte %00111100 ; 06C6 1-d8: **** + .byte %00000000 ; 06C7 1-d8: + + .byte %00000000 ; 06C8 1-d9: + .byte %00111000 ; 06C9 1-d9: *** + .byte %00011000 ; 06CA 1-d9: ** + .byte %00011000 ; 06CB 1-d9: ** + .byte %00011000 ; 06CC 1-d9: ** + .byte %00011000 ; 06CD 1-d9: ** + .byte %00111100 ; 06CE 1-d9: **** + .byte %00000000 ; 06CF 1-d9: + + .byte %00000000 ; 06D0 1-da: + .byte %00000000 ; 06D1 1-da: + .byte %01100110 ; 06D2 1-da: ** ** + .byte %01111111 ; 06D3 1-da: ******* + .byte %01111111 ; 06D4 1-da: ******* + .byte %01101011 ; 06D5 1-da: ** * ** + .byte %01100011 ; 06D6 1-da: ** ** + .byte %00000000 ; 06D7 1-da: + + .byte %00000000 ; 06D8 1-db: + .byte %00000000 ; 06D9 1-db: + .byte %01100110 ; 06DA 1-db: ** ** + .byte %01111111 ; 06DB 1-db: ******* + .byte %01111111 ; 06DC 1-db: ******* + .byte %01101011 ; 06DD 1-db: ** * ** + .byte %01100011 ; 06DE 1-db: ** ** + .byte %00000000 ; 06DF 1-db: + + .byte %00000000 ; 06E0 1-dc: + .byte %00000000 ; 06E1 1-dc: + .byte %01111100 ; 06E2 1-dc: ***** + .byte %01100110 ; 06E3 1-dc: ** ** + .byte %01100110 ; 06E4 1-dc: ** ** + .byte %01100110 ; 06E5 1-dc: ** ** + .byte %01100110 ; 06E6 1-dc: ** ** + .byte %00000000 ; 06E7 1-dc: + + .byte %00000000 ; 06E8 1-dd: + .byte %00000000 ; 06E9 1-dd: + .byte %01111100 ; 06EA 1-dd: ***** + .byte %01100110 ; 06EB 1-dd: ** ** + .byte %01100110 ; 06EC 1-dd: ** ** + .byte %01100110 ; 06ED 1-dd: ** ** + .byte %01100110 ; 06EE 1-dd: ** ** + .byte %00000000 ; 06EF 1-dd: + + .byte %00000000 ; 06F0 1-de: + .byte %00000000 ; 06F1 1-de: + .byte %00111100 ; 06F2 1-de: **** + .byte %01100110 ; 06F3 1-de: ** ** + .byte %01100110 ; 06F4 1-de: ** ** + .byte %01100110 ; 06F5 1-de: ** ** + .byte %00111100 ; 06F6 1-de: **** + .byte %00000000 ; 06F7 1-de: + + .byte %00000000 ; 06F8 1-df: + .byte %00000000 ; 06F9 1-df: + .byte %00111100 ; 06FA 1-df: **** + .byte %01100110 ; 06FB 1-df: ** ** + .byte %01100110 ; 06FC 1-df: ** ** + .byte %01100110 ; 06FD 1-df: ** ** + .byte %00111100 ; 06FE 1-df: **** + .byte %00000000 ; 06FF 1-df: + + .byte %00000000 ; 0700 1-e0: + .byte %00000000 ; 0701 1-e0: + .byte %01111100 ; 0702 1-e0: ***** + .byte %01100110 ; 0703 1-e0: ** ** + .byte %01100110 ; 0704 1-e0: ** ** + .byte %01111100 ; 0705 1-e0: ***** + .byte %01100000 ; 0706 1-e0: ** + .byte %01100000 ; 0707 1-e0: ** + + .byte %00000000 ; 0708 1-e1: + .byte %00000000 ; 0709 1-e1: + .byte %01111100 ; 070A 1-e1: ***** + .byte %01100110 ; 070B 1-e1: ** ** + .byte %01100110 ; 070C 1-e1: ** ** + .byte %01111100 ; 070D 1-e1: ***** + .byte %01100000 ; 070E 1-e1: ** + .byte %01100000 ; 070F 1-e1: ** + + .byte %00000000 ; 0710 1-e2: + .byte %00000000 ; 0711 1-e2: + .byte %00111110 ; 0712 1-e2: ***** + .byte %01100110 ; 0713 1-e2: ** ** + .byte %01100110 ; 0714 1-e2: ** ** + .byte %00111110 ; 0715 1-e2: ***** + .byte %00000110 ; 0716 1-e2: ** + .byte %00000110 ; 0717 1-e2: ** + + .byte %00000000 ; 0718 1-e3: + .byte %00000000 ; 0719 1-e3: + .byte %00111110 ; 071A 1-e3: ***** + .byte %01100110 ; 071B 1-e3: ** ** + .byte %01100110 ; 071C 1-e3: ** ** + .byte %00111110 ; 071D 1-e3: ***** + .byte %00000110 ; 071E 1-e3: ** + .byte %00000110 ; 071F 1-e3: ** + + .byte %00000000 ; 0720 1-e4: + .byte %00000000 ; 0721 1-e4: + .byte %01111100 ; 0722 1-e4: ***** + .byte %01100110 ; 0723 1-e4: ** ** + .byte %01100000 ; 0724 1-e4: ** + .byte %01100000 ; 0725 1-e4: ** + .byte %01100000 ; 0726 1-e4: ** + .byte %00000000 ; 0727 1-e4: + + .byte %00000000 ; 0728 1-e5: + .byte %00000000 ; 0729 1-e5: + .byte %01111100 ; 072A 1-e5: ***** + .byte %01100110 ; 072B 1-e5: ** ** + .byte %01100000 ; 072C 1-e5: ** + .byte %01100000 ; 072D 1-e5: ** + .byte %01100000 ; 072E 1-e5: ** + .byte %00000000 ; 072F 1-e5: + + .byte %00000000 ; 0730 1-e6: + .byte %00000000 ; 0731 1-e6: + .byte %00111110 ; 0732 1-e6: ***** + .byte %01100000 ; 0733 1-e6: ** + .byte %00111100 ; 0734 1-e6: **** + .byte %00000110 ; 0735 1-e6: ** + .byte %01111100 ; 0736 1-e6: ***** + .byte %00000000 ; 0737 1-e6: + + .byte %00000000 ; 0738 1-e7: + .byte %00000000 ; 0739 1-e7: + .byte %00111110 ; 073A 1-e7: ***** + .byte %01100000 ; 073B 1-e7: ** + .byte %00111100 ; 073C 1-e7: **** + .byte %00000110 ; 073D 1-e7: ** + .byte %01111100 ; 073E 1-e7: ***** + .byte %00000000 ; 073F 1-e7: + + .byte %00000000 ; 0740 1-e8: + .byte %00011000 ; 0741 1-e8: ** + .byte %01111110 ; 0742 1-e8: ****** + .byte %00011000 ; 0743 1-e8: ** + .byte %00011000 ; 0744 1-e8: ** + .byte %00011000 ; 0745 1-e8: ** + .byte %00001110 ; 0746 1-e8: *** + .byte %00000000 ; 0747 1-e8: + + .byte %00000000 ; 0748 1-e9: + .byte %00011000 ; 0749 1-e9: ** + .byte %01111110 ; 074A 1-e9: ****** + .byte %00011000 ; 074B 1-e9: ** + .byte %00011000 ; 074C 1-e9: ** + .byte %00011000 ; 074D 1-e9: ** + .byte %00001110 ; 074E 1-e9: *** + .byte %00000000 ; 074F 1-e9: + + .byte %00000000 ; 0750 1-ea: + .byte %00000000 ; 0751 1-ea: + .byte %01100110 ; 0752 1-ea: ** ** + .byte %01100110 ; 0753 1-ea: ** ** + .byte %01100110 ; 0754 1-ea: ** ** + .byte %01100110 ; 0755 1-ea: ** ** + .byte %00111110 ; 0756 1-ea: ***** + .byte %00000000 ; 0757 1-ea: + + .byte %00000000 ; 0758 1-eb: + .byte %00000000 ; 0759 1-eb: + .byte %01100110 ; 075A 1-eb: ** ** + .byte %01100110 ; 075B 1-eb: ** ** + .byte %01100110 ; 075C 1-eb: ** ** + .byte %01100110 ; 075D 1-eb: ** ** + .byte %00111110 ; 075E 1-eb: ***** + .byte %00000000 ; 075F 1-eb: + + .byte %00000000 ; 0760 1-ec: + .byte %00000000 ; 0761 1-ec: + .byte %01100110 ; 0762 1-ec: ** ** + .byte %01100110 ; 0763 1-ec: ** ** + .byte %01100110 ; 0764 1-ec: ** ** + .byte %00111100 ; 0765 1-ec: **** + .byte %00011000 ; 0766 1-ec: ** + .byte %00000000 ; 0767 1-ec: + + .byte %00000000 ; 0768 1-ed: + .byte %00000000 ; 0769 1-ed: + .byte %01100110 ; 076A 1-ed: ** ** + .byte %01100110 ; 076B 1-ed: ** ** + .byte %01100110 ; 076C 1-ed: ** ** + .byte %00111100 ; 076D 1-ed: **** + .byte %00011000 ; 076E 1-ed: ** + .byte %00000000 ; 076F 1-ed: + + .byte %00000000 ; 0770 1-ee: + .byte %00000000 ; 0771 1-ee: + .byte %01100011 ; 0772 1-ee: ** ** + .byte %01101011 ; 0773 1-ee: ** * ** + .byte %01111111 ; 0774 1-ee: ******* + .byte %00111110 ; 0775 1-ee: ***** + .byte %00110110 ; 0776 1-ee: ** ** + .byte %00000000 ; 0777 1-ee: + + .byte %00000000 ; 0778 1-ef: + .byte %00000000 ; 0779 1-ef: + .byte %01100011 ; 077A 1-ef: ** ** + .byte %01101011 ; 077B 1-ef: ** * ** + .byte %01111111 ; 077C 1-ef: ******* + .byte %00111110 ; 077D 1-ef: ***** + .byte %00110110 ; 077E 1-ef: ** ** + .byte %00000000 ; 077F 1-ef: + + .byte %00000000 ; 0780 1-f0: + .byte %00000000 ; 0781 1-f0: + .byte %01100110 ; 0782 1-f0: ** ** + .byte %00111100 ; 0783 1-f0: **** + .byte %00011000 ; 0784 1-f0: ** + .byte %00111100 ; 0785 1-f0: **** + .byte %01100110 ; 0786 1-f0: ** ** + .byte %00000000 ; 0787 1-f0: + + .byte %00000000 ; 0788 1-f1: + .byte %00000000 ; 0789 1-f1: + .byte %01100110 ; 078A 1-f1: ** ** + .byte %00111100 ; 078B 1-f1: **** + .byte %00011000 ; 078C 1-f1: ** + .byte %00111100 ; 078D 1-f1: **** + .byte %01100110 ; 078E 1-f1: ** ** + .byte %00000000 ; 078F 1-f1: + + .byte %00000000 ; 0790 1-f2: + .byte %00000000 ; 0791 1-f2: + .byte %01100110 ; 0792 1-f2: ** ** + .byte %01100110 ; 0793 1-f2: ** ** + .byte %01100110 ; 0794 1-f2: ** ** + .byte %00111110 ; 0795 1-f2: ***** + .byte %00001100 ; 0796 1-f2: ** + .byte %01111000 ; 0797 1-f2: **** + + .byte %00000000 ; 0798 1-f3: + .byte %00000000 ; 0799 1-f3: + .byte %01100110 ; 079A 1-f3: ** ** + .byte %01100110 ; 079B 1-f3: ** ** + .byte %01100110 ; 079C 1-f3: ** ** + .byte %00111110 ; 079D 1-f3: ***** + .byte %00001100 ; 079E 1-f3: ** + .byte %01111000 ; 079F 1-f3: **** + + .byte %00000000 ; 07A0 1-f4: + .byte %00000000 ; 07A1 1-f4: + .byte %01111110 ; 07A2 1-f4: ****** + .byte %00001100 ; 07A3 1-f4: ** + .byte %00011000 ; 07A4 1-f4: ** + .byte %00110000 ; 07A5 1-f4: ** + .byte %01111110 ; 07A6 1-f4: ****** + .byte %00000000 ; 07A7 1-f4: + + .byte %00000000 ; 07A8 1-f5: + .byte %00000000 ; 07A9 1-f5: + .byte %01111110 ; 07AA 1-f5: ****** + .byte %00001100 ; 07AB 1-f5: ** + .byte %00011000 ; 07AC 1-f5: ** + .byte %00110000 ; 07AD 1-f5: ** + .byte %01111110 ; 07AE 1-f5: ****** + .byte %00000000 ; 07AF 1-f5: + + .byte %00011100 ; 07B0 1-f6: *** + .byte %00110000 ; 07B1 1-f6: ** + .byte %00011000 ; 07B2 1-f6: ** + .byte %01110000 ; 07B3 1-f6: *** + .byte %00011000 ; 07B4 1-f6: ** + .byte %00110000 ; 07B5 1-f6: ** + .byte %00011100 ; 07B6 1-f6: *** + .byte %00000000 ; 07B7 1-f6: + + .byte %00011100 ; 07B8 1-f7: *** + .byte %00110000 ; 07B9 1-f7: ** + .byte %00011000 ; 07BA 1-f7: ** + .byte %01110000 ; 07BB 1-f7: *** + .byte %00011000 ; 07BC 1-f7: ** + .byte %00110000 ; 07BD 1-f7: ** + .byte %00011100 ; 07BE 1-f7: *** + .byte %00000000 ; 07BF 1-f7: + + .byte %00011000 ; 07C0 1-f8: ** + .byte %00011000 ; 07C1 1-f8: ** + .byte %00011000 ; 07C2 1-f8: ** + .byte %00000000 ; 07C3 1-f8: + .byte %00000000 ; 07C4 1-f8: + .byte %00011000 ; 07C5 1-f8: ** + .byte %00011000 ; 07C6 1-f8: ** + .byte %00011000 ; 07C7 1-f8: ** + + .byte %00011000 ; 07C8 1-f9: ** + .byte %00011000 ; 07C9 1-f9: ** + .byte %00011000 ; 07CA 1-f9: ** + .byte %00000000 ; 07CB 1-f9: + .byte %00000000 ; 07CC 1-f9: + .byte %00011000 ; 07CD 1-f9: ** + .byte %00011000 ; 07CE 1-f9: ** + .byte %00011000 ; 07CF 1-f9: ** + + .byte %00111000 ; 07D0 1-fa: *** + .byte %00001100 ; 07D1 1-fa: ** + .byte %00011000 ; 07D2 1-fa: ** + .byte %00001110 ; 07D3 1-fa: *** + .byte %00011000 ; 07D4 1-fa: ** + .byte %00001100 ; 07D5 1-fa: ** + .byte %00111000 ; 07D6 1-fa: *** + .byte %00000000 ; 07D7 1-fa: + + .byte %00111000 ; 07D8 1-fb: *** + .byte %00001100 ; 07D9 1-fb: ** + .byte %00011000 ; 07DA 1-fb: ** + .byte %00001110 ; 07DB 1-fb: *** + .byte %00011000 ; 07DC 1-fb: ** + .byte %00001100 ; 07DD 1-fb: ** + .byte %00111000 ; 07DE 1-fb: *** + .byte %00000000 ; 07DF 1-fb: + + .byte %00110011 ; 07E0 1-fc: ** ** + .byte %11111111 ; 07E1 1-fc: ******** + .byte %11001100 ; 07E2 1-fc: ** ** + .byte %00000000 ; 07E3 1-fc: + .byte %00000000 ; 07E4 1-fc: + .byte %00000000 ; 07E5 1-fc: + .byte %00000000 ; 07E6 1-fc: + .byte %00000000 ; 07E7 1-fc: + + .byte %00110011 ; 07E8 1-fd: ** ** + .byte %11111111 ; 07E9 1-fd: ******** + .byte %11001100 ; 07EA 1-fd: ** ** + .byte %00000000 ; 07EB 1-fd: + .byte %00000000 ; 07EC 1-fd: + .byte %00000000 ; 07ED 1-fd: + .byte %00000000 ; 07EE 1-fd: + .byte %00000000 ; 07EF 1-fd: + + .byte %00000000 ; 07F0 1-fe: + .byte %00000000 ; 07F1 1-fe: + .byte %00000000 ; 07F2 1-fe: + .byte %00000000 ; 07F3 1-fe: + .byte %00000000 ; 07F4 1-fe: + .byte %00000000 ; 07F5 1-fe: + .byte %00000000 ; 07F6 1-fe: + .byte %00000000 ; 07F7 1-fe: + + .byte %00000000 ; 07F8 1-ff: + .byte %00000000 ; 07F9 1-ff: + .byte %00000000 ; 07FA 1-ff: + .byte %00000000 ; 07FB 1-ff: + .byte %00000000 ; 07FC 1-ff: + .byte %00000000 ; 07FD 1-ff: + .byte %00000000 ; 07FE 1-ff: + .byte %00000000 ; 07FF 1-ff: + + .byte %11111111 ; 0800 2-00: ******** + .byte %11111111 ; 0801 2-00: ******** + .byte %11111111 ; 0802 2-00: ******** + .byte %11111111 ; 0803 2-00: ******** + .byte %11111111 ; 0804 2-00: ******** + .byte %11111111 ; 0805 2-00: ******** + .byte %11111111 ; 0806 2-00: ******** + .byte %11111111 ; 0807 2-00: ******** + + .byte %11111111 ; 0808 2-01: ******** + .byte %11111111 ; 0809 2-01: ******** + .byte %11111111 ; 080A 2-01: ******** + .byte %11111111 ; 080B 2-01: ******** + .byte %11111111 ; 080C 2-01: ******** + .byte %11111111 ; 080D 2-01: ******** + .byte %11111111 ; 080E 2-01: ******** + .byte %11111111 ; 080F 2-01: ******** + + .byte %00110011 ; 0810 2-02: ** ** + .byte %00110011 ; 0811 2-02: ** ** + .byte %11001100 ; 0812 2-02: ** ** + .byte %11001100 ; 0813 2-02: ** ** + .byte %00110011 ; 0814 2-02: ** ** + .byte %00110011 ; 0815 2-02: ** ** + .byte %11001100 ; 0816 2-02: ** ** + .byte %11001100 ; 0817 2-02: ** ** + + .byte %00110011 ; 0818 2-03: ** ** + .byte %00110011 ; 0819 2-03: ** ** + .byte %11001100 ; 081A 2-03: ** ** + .byte %11001100 ; 081B 2-03: ** ** + .byte %00110011 ; 081C 2-03: ** ** + .byte %00110011 ; 081D 2-03: ** ** + .byte %11001100 ; 081E 2-03: ** ** + .byte %11001100 ; 081F 2-03: ** ** + + .byte %11111111 ; 0820 2-04: ******** + .byte %11100111 ; 0821 2-04: *** *** + .byte %11000011 ; 0822 2-04: ** ** + .byte %10000001 ; 0823 2-04: * * + .byte %11100111 ; 0824 2-04: *** *** + .byte %11100111 ; 0825 2-04: *** *** + .byte %11100111 ; 0826 2-04: *** *** + .byte %11100111 ; 0827 2-04: *** *** + + .byte %11111111 ; 0828 2-05: ******** + .byte %11100111 ; 0829 2-05: *** *** + .byte %11000011 ; 082A 2-05: ** ** + .byte %10000001 ; 082B 2-05: * * + .byte %11100111 ; 082C 2-05: *** *** + .byte %11100111 ; 082D 2-05: *** *** + .byte %11100111 ; 082E 2-05: *** *** + .byte %11100111 ; 082F 2-05: *** *** + + .byte %11111111 ; 0830 2-06: ******** + .byte %11101111 ; 0831 2-06: *** **** + .byte %11001111 ; 0832 2-06: ** **** + .byte %10000000 ; 0833 2-06: * + .byte %10000000 ; 0834 2-06: * + .byte %11001111 ; 0835 2-06: ** **** + .byte %11101111 ; 0836 2-06: *** **** + .byte %11111111 ; 0837 2-06: ******** + + .byte %11111111 ; 0838 2-07: ******** + .byte %11101111 ; 0839 2-07: *** **** + .byte %11001111 ; 083A 2-07: ** **** + .byte %10000000 ; 083B 2-07: * + .byte %10000000 ; 083C 2-07: * + .byte %11001111 ; 083D 2-07: ** **** + .byte %11101111 ; 083E 2-07: *** **** + .byte %11111111 ; 083F 2-07: ******** + + .byte %11110011 ; 0840 2-08: **** ** + .byte %11101101 ; 0841 2-08: *** ** * + .byte %11001111 ; 0842 2-08: ** **** + .byte %10000011 ; 0843 2-08: * ** + .byte %11001111 ; 0844 2-08: ** **** + .byte %10011101 ; 0845 2-08: * *** * + .byte %00000011 ; 0846 2-08: ** + .byte %11111111 ; 0847 2-08: ******** + + .byte %11110011 ; 0848 2-09: **** ** + .byte %11101101 ; 0849 2-09: *** ** * + .byte %11001111 ; 084A 2-09: ** **** + .byte %10000011 ; 084B 2-09: * ** + .byte %11001111 ; 084C 2-09: ** **** + .byte %10011101 ; 084D 2-09: * *** * + .byte %00000011 ; 084E 2-09: ** + .byte %11111111 ; 084F 2-09: ******** + + .byte %11111111 ; 0850 2-0a: ******** + .byte %11111111 ; 0851 2-0a: ******** + .byte %11111100 ; 0852 2-0a: ****** + .byte %11000001 ; 0853 2-0a: ** * + .byte %10001001 ; 0854 2-0a: * * * + .byte %11001001 ; 0855 2-0a: ** * * + .byte %11001001 ; 0856 2-0a: ** * * + .byte %11111111 ; 0857 2-0a: ******** + + .byte %11111111 ; 0858 2-0b: ******** + .byte %11111111 ; 0859 2-0b: ******** + .byte %11111100 ; 085A 2-0b: ****** + .byte %11000001 ; 085B 2-0b: ** * + .byte %10001001 ; 085C 2-0b: * * * + .byte %11001001 ; 085D 2-0b: ** * * + .byte %11001001 ; 085E 2-0b: ** * * + .byte %11111111 ; 085F 2-0b: ******** + + .byte %10000000 ; 0860 2-0c: * + .byte %10000000 ; 0861 2-0c: * + .byte %11111111 ; 0862 2-0c: ******** + .byte %11111111 ; 0863 2-0c: ******** + .byte %11111111 ; 0864 2-0c: ******** + .byte %11111111 ; 0865 2-0c: ******** + .byte %11111111 ; 0866 2-0c: ******** + .byte %11111111 ; 0867 2-0c: ******** + + .byte %10000000 ; 0868 2-0d: * + .byte %10000000 ; 0869 2-0d: * + .byte %11111111 ; 086A 2-0d: ******** + .byte %11111111 ; 086B 2-0d: ******** + .byte %11111111 ; 086C 2-0d: ******** + .byte %11111111 ; 086D 2-0d: ******** + .byte %11111111 ; 086E 2-0d: ******** + .byte %11111111 ; 086F 2-0d: ******** + + .byte %00011111 ; 0870 2-0e: ***** + .byte %00011111 ; 0871 2-0e: ***** + .byte %10011111 ; 0872 2-0e: * ***** + .byte %10011111 ; 0873 2-0e: * ***** + .byte %10011111 ; 0874 2-0e: * ***** + .byte %10011111 ; 0875 2-0e: * ***** + .byte %10011111 ; 0876 2-0e: * ***** + .byte %10011111 ; 0877 2-0e: * ***** + + .byte %00011111 ; 0878 2-0f: ***** + .byte %00011111 ; 0879 2-0f: ***** + .byte %10011111 ; 087A 2-0f: * ***** + .byte %10011111 ; 087B 2-0f: * ***** + .byte %10011111 ; 087C 2-0f: * ***** + .byte %10011111 ; 087D 2-0f: * ***** + .byte %10011111 ; 087E 2-0f: * ***** + .byte %10011111 ; 087F 2-0f: * ***** + + .byte %11100111 ; 0880 2-10: *** *** + .byte %11100111 ; 0881 2-10: *** *** + .byte %11100111 ; 0882 2-10: *** *** + .byte %00000111 ; 0883 2-10: *** + .byte %00000111 ; 0884 2-10: *** + .byte %11111111 ; 0885 2-10: ******** + .byte %11111111 ; 0886 2-10: ******** + .byte %11111111 ; 0887 2-10: ******** + + .byte %11100111 ; 0888 2-11: *** *** + .byte %11100111 ; 0889 2-11: *** *** + .byte %11100111 ; 088A 2-11: *** *** + .byte %00000111 ; 088B 2-11: *** + .byte %00000111 ; 088C 2-11: *** + .byte %11111111 ; 088D 2-11: ******** + .byte %11111111 ; 088E 2-11: ******** + .byte %11111111 ; 088F 2-11: ******** + + .byte %00110011 ; 0890 2-12: ** ** + .byte %01100110 ; 0891 2-12: ** ** + .byte %11001100 ; 0892 2-12: ** ** + .byte %10011001 ; 0893 2-12: * ** * + .byte %00110011 ; 0894 2-12: ** ** + .byte %01100110 ; 0895 2-12: ** ** + .byte %11001100 ; 0896 2-12: ** ** + .byte %10011001 ; 0897 2-12: * ** * + + .byte %00110011 ; 0898 2-13: ** ** + .byte %01100110 ; 0899 2-13: ** ** + .byte %11001100 ; 089A 2-13: ** ** + .byte %10011001 ; 089B 2-13: * ** * + .byte %00110011 ; 089C 2-13: ** ** + .byte %01100110 ; 089D 2-13: ** ** + .byte %11001100 ; 089E 2-13: ** ** + .byte %10011001 ; 089F 2-13: * ** * + + .byte %11001100 ; 08A0 2-14: ** ** + .byte %01100110 ; 08A1 2-14: ** ** + .byte %00110011 ; 08A2 2-14: ** ** + .byte %10011001 ; 08A3 2-14: * ** * + .byte %11001100 ; 08A4 2-14: ** ** + .byte %01100110 ; 08A5 2-14: ** ** + .byte %00110011 ; 08A6 2-14: ** ** + .byte %10011001 ; 08A7 2-14: * ** * + + .byte %11001100 ; 08A8 2-15: ** ** + .byte %01100110 ; 08A9 2-15: ** ** + .byte %00110011 ; 08AA 2-15: ** ** + .byte %10011001 ; 08AB 2-15: * ** * + .byte %11001100 ; 08AC 2-15: ** ** + .byte %01100110 ; 08AD 2-15: ** ** + .byte %00110011 ; 08AE 2-15: ** ** + .byte %10011001 ; 08AF 2-15: * ** * + + .byte %11111111 ; 08B0 2-16: ******** + .byte %11111111 ; 08B1 2-16: ******** + .byte %11111111 ; 08B2 2-16: ******** + .byte %00000000 ; 08B3 2-16: + .byte %00000000 ; 08B4 2-16: + .byte %11111111 ; 08B5 2-16: ******** + .byte %11111111 ; 08B6 2-16: ******** + .byte %11111111 ; 08B7 2-16: ******** + + .byte %11111111 ; 08B8 2-17: ******** + .byte %11111111 ; 08B9 2-17: ******** + .byte %11111111 ; 08BA 2-17: ******** + .byte %00000000 ; 08BB 2-17: + .byte %00000000 ; 08BC 2-17: + .byte %11111111 ; 08BD 2-17: ******** + .byte %11111111 ; 08BE 2-17: ******** + .byte %11111111 ; 08BF 2-17: ******** + + .byte %11111100 ; 08C0 2-18: ****** + .byte %11111100 ; 08C1 2-18: ****** + .byte %11111100 ; 08C2 2-18: ****** + .byte %11111100 ; 08C3 2-18: ****** + .byte %11111100 ; 08C4 2-18: ****** + .byte %11111100 ; 08C5 2-18: ****** + .byte %11111100 ; 08C6 2-18: ****** + .byte %11111100 ; 08C7 2-18: ****** + + .byte %11111100 ; 08C8 2-19: ****** + .byte %11111100 ; 08C9 2-19: ****** + .byte %11111100 ; 08CA 2-19: ****** + .byte %11111100 ; 08CB 2-19: ****** + .byte %11111100 ; 08CC 2-19: ****** + .byte %11111100 ; 08CD 2-19: ****** + .byte %11111100 ; 08CE 2-19: ****** + .byte %11111100 ; 08CF 2-19: ****** + + .byte %11111111 ; 08D0 2-1a: ******** + .byte %11111111 ; 08D1 2-1a: ******** + .byte %11111111 ; 08D2 2-1a: ******** + .byte %11111111 ; 08D3 2-1a: ******** + .byte %00110011 ; 08D4 2-1a: ** ** + .byte %00110011 ; 08D5 2-1a: ** ** + .byte %11001100 ; 08D6 2-1a: ** ** + .byte %11001100 ; 08D7 2-1a: ** ** + + .byte %11111111 ; 08D8 2-1b: ******** + .byte %11111111 ; 08D9 2-1b: ******** + .byte %11111111 ; 08DA 2-1b: ******** + .byte %11111111 ; 08DB 2-1b: ******** + .byte %00110011 ; 08DC 2-1b: ** ** + .byte %00110011 ; 08DD 2-1b: ** ** + .byte %11001100 ; 08DE 2-1b: ** ** + .byte %11001100 ; 08DF 2-1b: ** ** + + .byte %11100111 ; 08E0 2-1c: *** *** + .byte %11100111 ; 08E1 2-1c: *** *** + .byte %11100111 ; 08E2 2-1c: *** *** + .byte %11100111 ; 08E3 2-1c: *** *** + .byte %11100111 ; 08E4 2-1c: *** *** + .byte %11100111 ; 08E5 2-1c: *** *** + .byte %11100111 ; 08E6 2-1c: *** *** + .byte %11100111 ; 08E7 2-1c: *** *** + + .byte %11100111 ; 08E8 2-1d: *** *** + .byte %11100111 ; 08E9 2-1d: *** *** + .byte %11100111 ; 08EA 2-1d: *** *** + .byte %11100111 ; 08EB 2-1d: *** *** + .byte %11100111 ; 08EC 2-1d: *** *** + .byte %11100111 ; 08ED 2-1d: *** *** + .byte %11100111 ; 08EE 2-1d: *** *** + .byte %11100111 ; 08EF 2-1d: *** *** + + .byte %11100111 ; 08F0 2-1e: *** *** + .byte %11100111 ; 08F1 2-1e: *** *** + .byte %11100111 ; 08F2 2-1e: *** *** + .byte %11100000 ; 08F3 2-1e: *** + .byte %11100000 ; 08F4 2-1e: *** + .byte %11100111 ; 08F5 2-1e: *** *** + .byte %11100111 ; 08F6 2-1e: *** *** + .byte %11100111 ; 08F7 2-1e: *** *** + + .byte %11100111 ; 08F8 2-1f: *** *** + .byte %11100111 ; 08F9 2-1f: *** *** + .byte %11100111 ; 08FA 2-1f: *** *** + .byte %11100000 ; 08FB 2-1f: *** + .byte %11100000 ; 08FC 2-1f: *** + .byte %11100111 ; 08FD 2-1f: *** *** + .byte %11100111 ; 08FE 2-1f: *** *** + .byte %11100111 ; 08FF 2-1f: *** *** + + .byte %11100111 ; 0900 2-20: *** *** + .byte %11100111 ; 0901 2-20: *** *** + .byte %11100111 ; 0902 2-20: *** *** + .byte %00000000 ; 0903 2-20: + .byte %00000000 ; 0904 2-20: + .byte %11100111 ; 0905 2-20: *** *** + .byte %11100111 ; 0906 2-20: *** *** + .byte %11100111 ; 0907 2-20: *** *** + + .byte %11100111 ; 0908 2-21: *** *** + .byte %11100111 ; 0909 2-21: *** *** + .byte %11100111 ; 090A 2-21: *** *** + .byte %00000000 ; 090B 2-21: + .byte %00000000 ; 090C 2-21: + .byte %11100111 ; 090D 2-21: *** *** + .byte %11100111 ; 090E 2-21: *** *** + .byte %11100111 ; 090F 2-21: *** *** + + .byte %11100111 ; 0910 2-22: *** *** + .byte %11100111 ; 0911 2-22: *** *** + .byte %11100111 ; 0912 2-22: *** *** + .byte %11100000 ; 0913 2-22: *** + .byte %11100000 ; 0914 2-22: *** + .byte %11111111 ; 0915 2-22: ******** + .byte %11111111 ; 0916 2-22: ******** + .byte %11111111 ; 0917 2-22: ******** + + .byte %11100111 ; 0918 2-23: *** *** + .byte %11100111 ; 0919 2-23: *** *** + .byte %11100111 ; 091A 2-23: *** *** + .byte %11100000 ; 091B 2-23: *** + .byte %11100000 ; 091C 2-23: *** + .byte %11111111 ; 091D 2-23: ******** + .byte %11111111 ; 091E 2-23: ******** + .byte %11111111 ; 091F 2-23: ******** + + .byte %11111111 ; 0920 2-24: ******** + .byte %11111111 ; 0921 2-24: ******** + .byte %11111111 ; 0922 2-24: ******** + .byte %00000111 ; 0923 2-24: *** + .byte %00000111 ; 0924 2-24: *** + .byte %11100111 ; 0925 2-24: *** *** + .byte %11100111 ; 0926 2-24: *** *** + .byte %11100111 ; 0927 2-24: *** *** + + .byte %11111111 ; 0928 2-25: ******** + .byte %11111111 ; 0929 2-25: ******** + .byte %11111111 ; 092A 2-25: ******** + .byte %00000111 ; 092B 2-25: *** + .byte %00000111 ; 092C 2-25: *** + .byte %11100111 ; 092D 2-25: *** *** + .byte %11100111 ; 092E 2-25: *** *** + .byte %11100111 ; 092F 2-25: *** *** + + .byte %11111111 ; 0930 2-26: ******** + .byte %11111111 ; 0931 2-26: ******** + .byte %11111111 ; 0932 2-26: ******** + .byte %11111111 ; 0933 2-26: ******** + .byte %11111111 ; 0934 2-26: ******** + .byte %11111111 ; 0935 2-26: ******** + .byte %00000000 ; 0936 2-26: + .byte %00000000 ; 0937 2-26: + + .byte %11111111 ; 0938 2-27: ******** + .byte %11111111 ; 0939 2-27: ******** + .byte %11111111 ; 093A 2-27: ******** + .byte %11111111 ; 093B 2-27: ******** + .byte %11111111 ; 093C 2-27: ******** + .byte %11111111 ; 093D 2-27: ******** + .byte %00000000 ; 093E 2-27: + .byte %00000000 ; 093F 2-27: + + .byte %11111111 ; 0940 2-28: ******** + .byte %11111111 ; 0941 2-28: ******** + .byte %11111111 ; 0942 2-28: ******** + .byte %11100000 ; 0943 2-28: *** + .byte %11100000 ; 0944 2-28: *** + .byte %11100111 ; 0945 2-28: *** *** + .byte %11100111 ; 0946 2-28: *** *** + .byte %11100111 ; 0947 2-28: *** *** + + .byte %11111111 ; 0948 2-29: ******** + .byte %11111111 ; 0949 2-29: ******** + .byte %11111111 ; 094A 2-29: ******** + .byte %11100000 ; 094B 2-29: *** + .byte %11100000 ; 094C 2-29: *** + .byte %11100111 ; 094D 2-29: *** *** + .byte %11100111 ; 094E 2-29: *** *** + .byte %11100111 ; 094F 2-29: *** *** + + .byte %11100111 ; 0950 2-2a: *** *** + .byte %11100111 ; 0951 2-2a: *** *** + .byte %11100111 ; 0952 2-2a: *** *** + .byte %00000000 ; 0953 2-2a: + .byte %00000000 ; 0954 2-2a: + .byte %11111111 ; 0955 2-2a: ******** + .byte %11111111 ; 0956 2-2a: ******** + .byte %11111111 ; 0957 2-2a: ******** + + .byte %11100111 ; 0958 2-2b: *** *** + .byte %11100111 ; 0959 2-2b: *** *** + .byte %11100111 ; 095A 2-2b: *** *** + .byte %00000000 ; 095B 2-2b: + .byte %00000000 ; 095C 2-2b: + .byte %11111111 ; 095D 2-2b: ******** + .byte %11111111 ; 095E 2-2b: ******** + .byte %11111111 ; 095F 2-2b: ******** + + .byte %11111111 ; 0960 2-2c: ******** + .byte %11111111 ; 0961 2-2c: ******** + .byte %11111111 ; 0962 2-2c: ******** + .byte %00000000 ; 0963 2-2c: + .byte %00000000 ; 0964 2-2c: + .byte %11100111 ; 0965 2-2c: *** *** + .byte %11100111 ; 0966 2-2c: *** *** + .byte %11100111 ; 0967 2-2c: *** *** + + .byte %11111111 ; 0968 2-2d: ******** + .byte %11111111 ; 0969 2-2d: ******** + .byte %11111111 ; 096A 2-2d: ******** + .byte %00000000 ; 096B 2-2d: + .byte %00000000 ; 096C 2-2d: + .byte %11100111 ; 096D 2-2d: *** *** + .byte %11100111 ; 096E 2-2d: *** *** + .byte %11100111 ; 096F 2-2d: *** *** + + .byte %11100111 ; 0970 2-2e: *** *** + .byte %11100111 ; 0971 2-2e: *** *** + .byte %11100111 ; 0972 2-2e: *** *** + .byte %00000111 ; 0973 2-2e: *** + .byte %00000111 ; 0974 2-2e: *** + .byte %11100111 ; 0975 2-2e: *** *** + .byte %11100111 ; 0976 2-2e: *** *** + .byte %11100111 ; 0977 2-2e: *** *** + + .byte %11100111 ; 0978 2-2f: *** *** + .byte %11100111 ; 0979 2-2f: *** *** + .byte %11100111 ; 097A 2-2f: *** *** + .byte %00000111 ; 097B 2-2f: *** + .byte %00000111 ; 097C 2-2f: *** + .byte %11100111 ; 097D 2-2f: *** *** + .byte %11100111 ; 097E 2-2f: *** *** + .byte %11100111 ; 097F 2-2f: *** *** + + .byte %00001111 ; 0980 2-30: **** + .byte %00001111 ; 0981 2-30: **** + .byte %00001111 ; 0982 2-30: **** + .byte %00001111 ; 0983 2-30: **** + .byte %00001111 ; 0984 2-30: **** + .byte %00001111 ; 0985 2-30: **** + .byte %00001111 ; 0986 2-30: **** + .byte %00001111 ; 0987 2-30: **** + + .byte %00001111 ; 0988 2-31: **** + .byte %00001111 ; 0989 2-31: **** + .byte %00001111 ; 098A 2-31: **** + .byte %00001111 ; 098B 2-31: **** + .byte %00001111 ; 098C 2-31: **** + .byte %00001111 ; 098D 2-31: **** + .byte %00001111 ; 098E 2-31: **** + .byte %00001111 ; 098F 2-31: **** + + .byte %11111111 ; 0990 2-32: ******** + .byte %11111111 ; 0991 2-32: ******** + .byte %11111111 ; 0992 2-32: ******** + .byte %11111111 ; 0993 2-32: ******** + .byte %00000000 ; 0994 2-32: + .byte %00000000 ; 0995 2-32: + .byte %00000000 ; 0996 2-32: + .byte %00000000 ; 0997 2-32: + + .byte %11111111 ; 0998 2-33: ******** + .byte %11111111 ; 0999 2-33: ******** + .byte %11111111 ; 099A 2-33: ******** + .byte %11111111 ; 099B 2-33: ******** + .byte %00000000 ; 099C 2-33: + .byte %00000000 ; 099D 2-33: + .byte %00000000 ; 099E 2-33: + .byte %00000000 ; 099F 2-33: + + .byte %11111111 ; 09A0 2-34: ******** + .byte %11111111 ; 09A1 2-34: ******** + .byte %11111111 ; 09A2 2-34: ******** + .byte %11111111 ; 09A3 2-34: ******** + .byte %00001111 ; 09A4 2-34: **** + .byte %00001111 ; 09A5 2-34: **** + .byte %00001111 ; 09A6 2-34: **** + .byte %00001111 ; 09A7 2-34: **** + + .byte %11111111 ; 09A8 2-35: ******** + .byte %11111111 ; 09A9 2-35: ******** + .byte %11111111 ; 09AA 2-35: ******** + .byte %11111111 ; 09AB 2-35: ******** + .byte %00001111 ; 09AC 2-35: **** + .byte %00001111 ; 09AD 2-35: **** + .byte %00001111 ; 09AE 2-35: **** + .byte %00001111 ; 09AF 2-35: **** + + .byte %00111111 ; 09B0 2-36: ****** + .byte %00111111 ; 09B1 2-36: ****** + .byte %11001111 ; 09B2 2-36: ** **** + .byte %11001111 ; 09B3 2-36: ** **** + .byte %00111111 ; 09B4 2-36: ****** + .byte %00111111 ; 09B5 2-36: ****** + .byte %11001111 ; 09B6 2-36: ** **** + .byte %11001111 ; 09B7 2-36: ** **** + + .byte %00111111 ; 09B8 2-37: ****** + .byte %00111111 ; 09B9 2-37: ****** + .byte %11001111 ; 09BA 2-37: ** **** + .byte %11001111 ; 09BB 2-37: ** **** + .byte %00111111 ; 09BC 2-37: ****** + .byte %00111111 ; 09BD 2-37: ****** + .byte %11001111 ; 09BE 2-37: ** **** + .byte %11001111 ; 09BF 2-37: ** **** + + .byte %11110000 ; 09C0 2-38: **** + .byte %11110000 ; 09C1 2-38: **** + .byte %11110000 ; 09C2 2-38: **** + .byte %11110000 ; 09C3 2-38: **** + .byte %11111111 ; 09C4 2-38: ******** + .byte %11111111 ; 09C5 2-38: ******** + .byte %11111111 ; 09C6 2-38: ******** + .byte %11111111 ; 09C7 2-38: ******** + + .byte %11110000 ; 09C8 2-39: **** + .byte %11110000 ; 09C9 2-39: **** + .byte %11110000 ; 09CA 2-39: **** + .byte %11110000 ; 09CB 2-39: **** + .byte %11111111 ; 09CC 2-39: ******** + .byte %11111111 ; 09CD 2-39: ******** + .byte %11111111 ; 09CE 2-39: ******** + .byte %11111111 ; 09CF 2-39: ******** + + .byte %11111111 ; 09D0 2-3a: ******** + .byte %11111111 ; 09D1 2-3a: ******** + .byte %11111111 ; 09D2 2-3a: ******** + .byte %11111111 ; 09D3 2-3a: ******** + .byte %11110000 ; 09D4 2-3a: **** + .byte %11110000 ; 09D5 2-3a: **** + .byte %11110000 ; 09D6 2-3a: **** + .byte %11110000 ; 09D7 2-3a: **** + + .byte %11111111 ; 09D8 2-3b: ******** + .byte %11111111 ; 09D9 2-3b: ******** + .byte %11111111 ; 09DA 2-3b: ******** + .byte %11111111 ; 09DB 2-3b: ******** + .byte %11110000 ; 09DC 2-3b: **** + .byte %11110000 ; 09DD 2-3b: **** + .byte %11110000 ; 09DE 2-3b: **** + .byte %11110000 ; 09DF 2-3b: **** + + .byte %00001111 ; 09E0 2-3c: **** + .byte %00001111 ; 09E1 2-3c: **** + .byte %00001111 ; 09E2 2-3c: **** + .byte %00001111 ; 09E3 2-3c: **** + .byte %11111111 ; 09E4 2-3c: ******** + .byte %11111111 ; 09E5 2-3c: ******** + .byte %11111111 ; 09E6 2-3c: ******** + .byte %11111111 ; 09E7 2-3c: ******** + + .byte %00001111 ; 09E8 2-3d: **** + .byte %00001111 ; 09E9 2-3d: **** + .byte %00001111 ; 09EA 2-3d: **** + .byte %00001111 ; 09EB 2-3d: **** + .byte %11111111 ; 09EC 2-3d: ******** + .byte %11111111 ; 09ED 2-3d: ******** + .byte %11111111 ; 09EE 2-3d: ******** + .byte %11111111 ; 09EF 2-3d: ******** + + .byte %00001111 ; 09F0 2-3e: **** + .byte %00001111 ; 09F1 2-3e: **** + .byte %00001111 ; 09F2 2-3e: **** + .byte %00001111 ; 09F3 2-3e: **** + .byte %11110000 ; 09F4 2-3e: **** + .byte %11110000 ; 09F5 2-3e: **** + .byte %11110000 ; 09F6 2-3e: **** + .byte %11110000 ; 09F7 2-3e: **** + + .byte %00001111 ; 09F8 2-3f: **** + .byte %00001111 ; 09F9 2-3f: **** + .byte %00001111 ; 09FA 2-3f: **** + .byte %00001111 ; 09FB 2-3f: **** + .byte %11110000 ; 09FC 2-3f: **** + .byte %11110000 ; 09FD 2-3f: **** + .byte %11110000 ; 09FE 2-3f: **** + .byte %11110000 ; 09FF 2-3f: **** + + .byte %11111111 ; 0A00 2-40: ******** + .byte %11111111 ; 0A01 2-40: ******** + .byte %11111111 ; 0A02 2-40: ******** + .byte %11111111 ; 0A03 2-40: ******** + .byte %11111111 ; 0A04 2-40: ******** + .byte %11111111 ; 0A05 2-40: ******** + .byte %11111111 ; 0A06 2-40: ******** + .byte %11111111 ; 0A07 2-40: ******** + + .byte %11111111 ; 0A08 2-41: ******** + .byte %11111111 ; 0A09 2-41: ******** + .byte %11111111 ; 0A0A 2-41: ******** + .byte %11111111 ; 0A0B 2-41: ******** + .byte %11111111 ; 0A0C 2-41: ******** + .byte %11111111 ; 0A0D 2-41: ******** + .byte %11111111 ; 0A0E 2-41: ******** + .byte %11111111 ; 0A0F 2-41: ******** + + .byte %11100111 ; 0A10 2-42: *** *** + .byte %11100111 ; 0A11 2-42: *** *** + .byte %11100111 ; 0A12 2-42: *** *** + .byte %11100111 ; 0A13 2-42: *** *** + .byte %11111111 ; 0A14 2-42: ******** + .byte %11111111 ; 0A15 2-42: ******** + .byte %11100111 ; 0A16 2-42: *** *** + .byte %11111111 ; 0A17 2-42: ******** + + .byte %11100111 ; 0A18 2-43: *** *** + .byte %11100111 ; 0A19 2-43: *** *** + .byte %11100111 ; 0A1A 2-43: *** *** + .byte %11100111 ; 0A1B 2-43: *** *** + .byte %11111111 ; 0A1C 2-43: ******** + .byte %11111111 ; 0A1D 2-43: ******** + .byte %11100111 ; 0A1E 2-43: *** *** + .byte %11111111 ; 0A1F 2-43: ******** + + .byte %10011001 ; 0A20 2-44: * ** * + .byte %10011001 ; 0A21 2-44: * ** * + .byte %10011001 ; 0A22 2-44: * ** * + .byte %11111111 ; 0A23 2-44: ******** + .byte %11111111 ; 0A24 2-44: ******** + .byte %11111111 ; 0A25 2-44: ******** + .byte %11111111 ; 0A26 2-44: ******** + .byte %11111111 ; 0A27 2-44: ******** + + .byte %10011001 ; 0A28 2-45: * ** * + .byte %10011001 ; 0A29 2-45: * ** * + .byte %10011001 ; 0A2A 2-45: * ** * + .byte %11111111 ; 0A2B 2-45: ******** + .byte %11111111 ; 0A2C 2-45: ******** + .byte %11111111 ; 0A2D 2-45: ******** + .byte %11111111 ; 0A2E 2-45: ******** + .byte %11111111 ; 0A2F 2-45: ******** + + .byte %10011001 ; 0A30 2-46: * ** * + .byte %10011001 ; 0A31 2-46: * ** * + .byte %00000000 ; 0A32 2-46: + .byte %10011001 ; 0A33 2-46: * ** * + .byte %00000000 ; 0A34 2-46: + .byte %10011001 ; 0A35 2-46: * ** * + .byte %10011001 ; 0A36 2-46: * ** * + .byte %11111111 ; 0A37 2-46: ******** + + .byte %10011001 ; 0A38 2-47: * ** * + .byte %10011001 ; 0A39 2-47: * ** * + .byte %00000000 ; 0A3A 2-47: + .byte %10011001 ; 0A3B 2-47: * ** * + .byte %00000000 ; 0A3C 2-47: + .byte %10011001 ; 0A3D 2-47: * ** * + .byte %10011001 ; 0A3E 2-47: * ** * + .byte %11111111 ; 0A3F 2-47: ******** + + .byte %11100111 ; 0A40 2-48: *** *** + .byte %11000001 ; 0A41 2-48: ** * + .byte %10011111 ; 0A42 2-48: * ***** + .byte %11000011 ; 0A43 2-48: ** ** + .byte %11111001 ; 0A44 2-48: ***** * + .byte %10000011 ; 0A45 2-48: * ** + .byte %11100111 ; 0A46 2-48: *** *** + .byte %11111111 ; 0A47 2-48: ******** + + .byte %11100111 ; 0A48 2-49: *** *** + .byte %11000001 ; 0A49 2-49: ** * + .byte %10011111 ; 0A4A 2-49: * ***** + .byte %11000011 ; 0A4B 2-49: ** ** + .byte %11111001 ; 0A4C 2-49: ***** * + .byte %10000011 ; 0A4D 2-49: * ** + .byte %11100111 ; 0A4E 2-49: *** *** + .byte %11111111 ; 0A4F 2-49: ******** + + .byte %11111111 ; 0A50 2-4a: ******** + .byte %10011001 ; 0A51 2-4a: * ** * + .byte %11110011 ; 0A52 2-4a: **** ** + .byte %11100111 ; 0A53 2-4a: *** *** + .byte %11001111 ; 0A54 2-4a: ** **** + .byte %10011001 ; 0A55 2-4a: * ** * + .byte %10111001 ; 0A56 2-4a: * *** * + .byte %11111111 ; 0A57 2-4a: ******** + + .byte %11111111 ; 0A58 2-4b: ******** + .byte %10011001 ; 0A59 2-4b: * ** * + .byte %11110011 ; 0A5A 2-4b: **** ** + .byte %11100111 ; 0A5B 2-4b: *** *** + .byte %11001111 ; 0A5C 2-4b: ** **** + .byte %10011001 ; 0A5D 2-4b: * ** * + .byte %10111001 ; 0A5E 2-4b: * *** * + .byte %11111111 ; 0A5F 2-4b: ******** + + .byte %11000011 ; 0A60 2-4c: ** ** + .byte %10011001 ; 0A61 2-4c: * ** * + .byte %11000011 ; 0A62 2-4c: ** ** + .byte %11000111 ; 0A63 2-4c: ** *** + .byte %10011000 ; 0A64 2-4c: * ** + .byte %10011001 ; 0A65 2-4c: * ** * + .byte %11000000 ; 0A66 2-4c: ** + .byte %11111111 ; 0A67 2-4c: ******** + + .byte %11000011 ; 0A68 2-4d: ** ** + .byte %10011001 ; 0A69 2-4d: * ** * + .byte %11000011 ; 0A6A 2-4d: ** ** + .byte %11000111 ; 0A6B 2-4d: ** *** + .byte %10011000 ; 0A6C 2-4d: * ** + .byte %10011001 ; 0A6D 2-4d: * ** * + .byte %11000000 ; 0A6E 2-4d: ** + .byte %11111111 ; 0A6F 2-4d: ******** + + .byte %11111001 ; 0A70 2-4e: ***** * + .byte %11110011 ; 0A71 2-4e: **** ** + .byte %11100111 ; 0A72 2-4e: *** *** + .byte %11111111 ; 0A73 2-4e: ******** + .byte %11111111 ; 0A74 2-4e: ******** + .byte %11111111 ; 0A75 2-4e: ******** + .byte %11111111 ; 0A76 2-4e: ******** + .byte %11111111 ; 0A77 2-4e: ******** + + .byte %11111001 ; 0A78 2-4f: ***** * + .byte %11110011 ; 0A79 2-4f: **** ** + .byte %11100111 ; 0A7A 2-4f: *** *** + .byte %11111111 ; 0A7B 2-4f: ******** + .byte %11111111 ; 0A7C 2-4f: ******** + .byte %11111111 ; 0A7D 2-4f: ******** + .byte %11111111 ; 0A7E 2-4f: ******** + .byte %11111111 ; 0A7F 2-4f: ******** + + .byte %11110011 ; 0A80 2-50: **** ** + .byte %11100111 ; 0A81 2-50: *** *** + .byte %11001111 ; 0A82 2-50: ** **** + .byte %11001111 ; 0A83 2-50: ** **** + .byte %11001111 ; 0A84 2-50: ** **** + .byte %11100111 ; 0A85 2-50: *** *** + .byte %11110011 ; 0A86 2-50: **** ** + .byte %11111111 ; 0A87 2-50: ******** + + .byte %11110011 ; 0A88 2-51: **** ** + .byte %11100111 ; 0A89 2-51: *** *** + .byte %11001111 ; 0A8A 2-51: ** **** + .byte %11001111 ; 0A8B 2-51: ** **** + .byte %11001111 ; 0A8C 2-51: ** **** + .byte %11100111 ; 0A8D 2-51: *** *** + .byte %11110011 ; 0A8E 2-51: **** ** + .byte %11111111 ; 0A8F 2-51: ******** + + .byte %11001111 ; 0A90 2-52: ** **** + .byte %11100111 ; 0A91 2-52: *** *** + .byte %11110011 ; 0A92 2-52: **** ** + .byte %11110011 ; 0A93 2-52: **** ** + .byte %11110011 ; 0A94 2-52: **** ** + .byte %11100111 ; 0A95 2-52: *** *** + .byte %11001111 ; 0A96 2-52: ** **** + .byte %11111111 ; 0A97 2-52: ******** + + .byte %11001111 ; 0A98 2-53: ** **** + .byte %11100111 ; 0A99 2-53: *** *** + .byte %11110011 ; 0A9A 2-53: **** ** + .byte %11110011 ; 0A9B 2-53: **** ** + .byte %11110011 ; 0A9C 2-53: **** ** + .byte %11100111 ; 0A9D 2-53: *** *** + .byte %11001111 ; 0A9E 2-53: ** **** + .byte %11111111 ; 0A9F 2-53: ******** + + .byte %11111111 ; 0AA0 2-54: ******** + .byte %10011001 ; 0AA1 2-54: * ** * + .byte %11000011 ; 0AA2 2-54: ** ** + .byte %00000000 ; 0AA3 2-54: + .byte %11000011 ; 0AA4 2-54: ** ** + .byte %10011001 ; 0AA5 2-54: * ** * + .byte %11111111 ; 0AA6 2-54: ******** + .byte %11111111 ; 0AA7 2-54: ******** + + .byte %11111111 ; 0AA8 2-55: ******** + .byte %10011001 ; 0AA9 2-55: * ** * + .byte %11000011 ; 0AAA 2-55: ** ** + .byte %00000000 ; 0AAB 2-55: + .byte %11000011 ; 0AAC 2-55: ** ** + .byte %10011001 ; 0AAD 2-55: * ** * + .byte %11111111 ; 0AAE 2-55: ******** + .byte %11111111 ; 0AAF 2-55: ******** + + .byte %11111111 ; 0AB0 2-56: ******** + .byte %11100111 ; 0AB1 2-56: *** *** + .byte %11100111 ; 0AB2 2-56: *** *** + .byte %10000001 ; 0AB3 2-56: * * + .byte %11100111 ; 0AB4 2-56: *** *** + .byte %11100111 ; 0AB5 2-56: *** *** + .byte %11111111 ; 0AB6 2-56: ******** + .byte %11111111 ; 0AB7 2-56: ******** + + .byte %11111111 ; 0AB8 2-57: ******** + .byte %11100111 ; 0AB9 2-57: *** *** + .byte %11100111 ; 0ABA 2-57: *** *** + .byte %10000001 ; 0ABB 2-57: * * + .byte %11100111 ; 0ABC 2-57: *** *** + .byte %11100111 ; 0ABD 2-57: *** *** + .byte %11111111 ; 0ABE 2-57: ******** + .byte %11111111 ; 0ABF 2-57: ******** + + .byte %11111111 ; 0AC0 2-58: ******** + .byte %11111111 ; 0AC1 2-58: ******** + .byte %11111111 ; 0AC2 2-58: ******** + .byte %11111111 ; 0AC3 2-58: ******** + .byte %11111111 ; 0AC4 2-58: ******** + .byte %11100111 ; 0AC5 2-58: *** *** + .byte %11100111 ; 0AC6 2-58: *** *** + .byte %11001111 ; 0AC7 2-58: ** **** + + .byte %11111111 ; 0AC8 2-59: ******** + .byte %11111111 ; 0AC9 2-59: ******** + .byte %11111111 ; 0ACA 2-59: ******** + .byte %11111111 ; 0ACB 2-59: ******** + .byte %11111111 ; 0ACC 2-59: ******** + .byte %11100111 ; 0ACD 2-59: *** *** + .byte %11100111 ; 0ACE 2-59: *** *** + .byte %11001111 ; 0ACF 2-59: ** **** + + .byte %11111111 ; 0AD0 2-5a: ******** + .byte %11111111 ; 0AD1 2-5a: ******** + .byte %11111111 ; 0AD2 2-5a: ******** + .byte %10000001 ; 0AD3 2-5a: * * + .byte %11111111 ; 0AD4 2-5a: ******** + .byte %11111111 ; 0AD5 2-5a: ******** + .byte %11111111 ; 0AD6 2-5a: ******** + .byte %11111111 ; 0AD7 2-5a: ******** + + .byte %11111111 ; 0AD8 2-5b: ******** + .byte %11111111 ; 0AD9 2-5b: ******** + .byte %11111111 ; 0ADA 2-5b: ******** + .byte %10000001 ; 0ADB 2-5b: * * + .byte %11111111 ; 0ADC 2-5b: ******** + .byte %11111111 ; 0ADD 2-5b: ******** + .byte %11111111 ; 0ADE 2-5b: ******** + .byte %11111111 ; 0ADF 2-5b: ******** + + .byte %11111111 ; 0AE0 2-5c: ******** + .byte %11111111 ; 0AE1 2-5c: ******** + .byte %11111111 ; 0AE2 2-5c: ******** + .byte %11111111 ; 0AE3 2-5c: ******** + .byte %11111111 ; 0AE4 2-5c: ******** + .byte %11100111 ; 0AE5 2-5c: *** *** + .byte %11100111 ; 0AE6 2-5c: *** *** + .byte %11111111 ; 0AE7 2-5c: ******** + + .byte %11111111 ; 0AE8 2-5d: ******** + .byte %11111111 ; 0AE9 2-5d: ******** + .byte %11111111 ; 0AEA 2-5d: ******** + .byte %11111111 ; 0AEB 2-5d: ******** + .byte %11111111 ; 0AEC 2-5d: ******** + .byte %11100111 ; 0AED 2-5d: *** *** + .byte %11100111 ; 0AEE 2-5d: *** *** + .byte %11111111 ; 0AEF 2-5d: ******** + + .byte %11111111 ; 0AF0 2-5e: ******** + .byte %11111100 ; 0AF1 2-5e: ****** + .byte %11111001 ; 0AF2 2-5e: ***** * + .byte %11110011 ; 0AF3 2-5e: **** ** + .byte %11100111 ; 0AF4 2-5e: *** *** + .byte %11001111 ; 0AF5 2-5e: ** **** + .byte %10011111 ; 0AF6 2-5e: * ***** + .byte %11111111 ; 0AF7 2-5e: ******** + + .byte %11111111 ; 0AF8 2-5f: ******** + .byte %11111100 ; 0AF9 2-5f: ****** + .byte %11111001 ; 0AFA 2-5f: ***** * + .byte %11110011 ; 0AFB 2-5f: **** ** + .byte %11100111 ; 0AFC 2-5f: *** *** + .byte %11001111 ; 0AFD 2-5f: ** **** + .byte %10011111 ; 0AFE 2-5f: * ***** + .byte %11111111 ; 0AFF 2-5f: ******** + + .byte %11000011 ; 0B00 2-60: ** ** + .byte %10011001 ; 0B01 2-60: * ** * + .byte %10010001 ; 0B02 2-60: * * * + .byte %10001001 ; 0B03 2-60: * * * + .byte %10011001 ; 0B04 2-60: * ** * + .byte %10011001 ; 0B05 2-60: * ** * + .byte %11000011 ; 0B06 2-60: ** ** + .byte %11111111 ; 0B07 2-60: ******** + + .byte %11000011 ; 0B08 2-61: ** ** + .byte %10011001 ; 0B09 2-61: * ** * + .byte %10010001 ; 0B0A 2-61: * * * + .byte %10001001 ; 0B0B 2-61: * * * + .byte %10011001 ; 0B0C 2-61: * ** * + .byte %10011001 ; 0B0D 2-61: * ** * + .byte %11000011 ; 0B0E 2-61: ** ** + .byte %11111111 ; 0B0F 2-61: ******** + + .byte %11100111 ; 0B10 2-62: *** *** + .byte %11100111 ; 0B11 2-62: *** *** + .byte %11000111 ; 0B12 2-62: ** *** + .byte %11100111 ; 0B13 2-62: *** *** + .byte %11100111 ; 0B14 2-62: *** *** + .byte %11100111 ; 0B15 2-62: *** *** + .byte %10000001 ; 0B16 2-62: * * + .byte %11111111 ; 0B17 2-62: ******** + + .byte %11100111 ; 0B18 2-63: *** *** + .byte %11100111 ; 0B19 2-63: *** *** + .byte %11000111 ; 0B1A 2-63: ** *** + .byte %11100111 ; 0B1B 2-63: *** *** + .byte %11100111 ; 0B1C 2-63: *** *** + .byte %11100111 ; 0B1D 2-63: *** *** + .byte %10000001 ; 0B1E 2-63: * * + .byte %11111111 ; 0B1F 2-63: ******** + + .byte %11000011 ; 0B20 2-64: ** ** + .byte %10011001 ; 0B21 2-64: * ** * + .byte %11111001 ; 0B22 2-64: ***** * + .byte %11110011 ; 0B23 2-64: **** ** + .byte %11001111 ; 0B24 2-64: ** **** + .byte %10011111 ; 0B25 2-64: * ***** + .byte %10000001 ; 0B26 2-64: * * + .byte %11111111 ; 0B27 2-64: ******** + + .byte %11000011 ; 0B28 2-65: ** ** + .byte %10011001 ; 0B29 2-65: * ** * + .byte %11111001 ; 0B2A 2-65: ***** * + .byte %11110011 ; 0B2B 2-65: **** ** + .byte %11001111 ; 0B2C 2-65: ** **** + .byte %10011111 ; 0B2D 2-65: * ***** + .byte %10000001 ; 0B2E 2-65: * * + .byte %11111111 ; 0B2F 2-65: ******** + + .byte %11000011 ; 0B30 2-66: ** ** + .byte %10011001 ; 0B31 2-66: * ** * + .byte %11111001 ; 0B32 2-66: ***** * + .byte %11100011 ; 0B33 2-66: *** ** + .byte %11111001 ; 0B34 2-66: ***** * + .byte %10011001 ; 0B35 2-66: * ** * + .byte %11000011 ; 0B36 2-66: ** ** + .byte %11111111 ; 0B37 2-66: ******** + + .byte %11000011 ; 0B38 2-67: ** ** + .byte %10011001 ; 0B39 2-67: * ** * + .byte %11111001 ; 0B3A 2-67: ***** * + .byte %11100011 ; 0B3B 2-67: *** ** + .byte %11111001 ; 0B3C 2-67: ***** * + .byte %10011001 ; 0B3D 2-67: * ** * + .byte %11000011 ; 0B3E 2-67: ** ** + .byte %11111111 ; 0B3F 2-67: ******** + + .byte %11111001 ; 0B40 2-68: ***** * + .byte %11110001 ; 0B41 2-68: **** * + .byte %11100001 ; 0B42 2-68: *** * + .byte %10011001 ; 0B43 2-68: * ** * + .byte %10000000 ; 0B44 2-68: * + .byte %11111001 ; 0B45 2-68: ***** * + .byte %11111001 ; 0B46 2-68: ***** * + .byte %11111111 ; 0B47 2-68: ******** + + .byte %11111001 ; 0B48 2-69: ***** * + .byte %11110001 ; 0B49 2-69: **** * + .byte %11100001 ; 0B4A 2-69: *** * + .byte %10011001 ; 0B4B 2-69: * ** * + .byte %10000000 ; 0B4C 2-69: * + .byte %11111001 ; 0B4D 2-69: ***** * + .byte %11111001 ; 0B4E 2-69: ***** * + .byte %11111111 ; 0B4F 2-69: ******** + + .byte %10000001 ; 0B50 2-6a: * * + .byte %10011111 ; 0B51 2-6a: * ***** + .byte %10000011 ; 0B52 2-6a: * ** + .byte %11111001 ; 0B53 2-6a: ***** * + .byte %11111001 ; 0B54 2-6a: ***** * + .byte %10011001 ; 0B55 2-6a: * ** * + .byte %11000011 ; 0B56 2-6a: ** ** + .byte %11111111 ; 0B57 2-6a: ******** + + .byte %10000001 ; 0B58 2-6b: * * + .byte %10011111 ; 0B59 2-6b: * ***** + .byte %10000011 ; 0B5A 2-6b: * ** + .byte %11111001 ; 0B5B 2-6b: ***** * + .byte %11111001 ; 0B5C 2-6b: ***** * + .byte %10011001 ; 0B5D 2-6b: * ** * + .byte %11000011 ; 0B5E 2-6b: ** ** + .byte %11111111 ; 0B5F 2-6b: ******** + + .byte %11000011 ; 0B60 2-6c: ** ** + .byte %10011001 ; 0B61 2-6c: * ** * + .byte %10011111 ; 0B62 2-6c: * ***** + .byte %10000011 ; 0B63 2-6c: * ** + .byte %10011001 ; 0B64 2-6c: * ** * + .byte %10011001 ; 0B65 2-6c: * ** * + .byte %11000011 ; 0B66 2-6c: ** ** + .byte %11111111 ; 0B67 2-6c: ******** + + .byte %11000011 ; 0B68 2-6d: ** ** + .byte %10011001 ; 0B69 2-6d: * ** * + .byte %10011111 ; 0B6A 2-6d: * ***** + .byte %10000011 ; 0B6B 2-6d: * ** + .byte %10011001 ; 0B6C 2-6d: * ** * + .byte %10011001 ; 0B6D 2-6d: * ** * + .byte %11000011 ; 0B6E 2-6d: ** ** + .byte %11111111 ; 0B6F 2-6d: ******** + + .byte %10000001 ; 0B70 2-6e: * * + .byte %10011001 ; 0B71 2-6e: * ** * + .byte %11110011 ; 0B72 2-6e: **** ** + .byte %11100111 ; 0B73 2-6e: *** *** + .byte %11100111 ; 0B74 2-6e: *** *** + .byte %11100111 ; 0B75 2-6e: *** *** + .byte %11100111 ; 0B76 2-6e: *** *** + .byte %11111111 ; 0B77 2-6e: ******** + + .byte %10000001 ; 0B78 2-6f: * * + .byte %10011001 ; 0B79 2-6f: * ** * + .byte %11110011 ; 0B7A 2-6f: **** ** + .byte %11100111 ; 0B7B 2-6f: *** *** + .byte %11100111 ; 0B7C 2-6f: *** *** + .byte %11100111 ; 0B7D 2-6f: *** *** + .byte %11100111 ; 0B7E 2-6f: *** *** + .byte %11111111 ; 0B7F 2-6f: ******** + + .byte %11000011 ; 0B80 2-70: ** ** + .byte %10011001 ; 0B81 2-70: * ** * + .byte %10011001 ; 0B82 2-70: * ** * + .byte %11000011 ; 0B83 2-70: ** ** + .byte %10011001 ; 0B84 2-70: * ** * + .byte %10011001 ; 0B85 2-70: * ** * + .byte %11000011 ; 0B86 2-70: ** ** + .byte %11111111 ; 0B87 2-70: ******** + + .byte %11000011 ; 0B88 2-71: ** ** + .byte %10011001 ; 0B89 2-71: * ** * + .byte %10011001 ; 0B8A 2-71: * ** * + .byte %11000011 ; 0B8B 2-71: ** ** + .byte %10011001 ; 0B8C 2-71: * ** * + .byte %10011001 ; 0B8D 2-71: * ** * + .byte %11000011 ; 0B8E 2-71: ** ** + .byte %11111111 ; 0B8F 2-71: ******** + + .byte %11000011 ; 0B90 2-72: ** ** + .byte %10011001 ; 0B91 2-72: * ** * + .byte %10011001 ; 0B92 2-72: * ** * + .byte %11000001 ; 0B93 2-72: ** * + .byte %11111001 ; 0B94 2-72: ***** * + .byte %10011001 ; 0B95 2-72: * ** * + .byte %11000011 ; 0B96 2-72: ** ** + .byte %11111111 ; 0B97 2-72: ******** + + .byte %11000011 ; 0B98 2-73: ** ** + .byte %10011001 ; 0B99 2-73: * ** * + .byte %10011001 ; 0B9A 2-73: * ** * + .byte %11000001 ; 0B9B 2-73: ** * + .byte %11111001 ; 0B9C 2-73: ***** * + .byte %10011001 ; 0B9D 2-73: * ** * + .byte %11000011 ; 0B9E 2-73: ** ** + .byte %11111111 ; 0B9F 2-73: ******** + + .byte %11111111 ; 0BA0 2-74: ******** + .byte %11111111 ; 0BA1 2-74: ******** + .byte %11100111 ; 0BA2 2-74: *** *** + .byte %11111111 ; 0BA3 2-74: ******** + .byte %11111111 ; 0BA4 2-74: ******** + .byte %11100111 ; 0BA5 2-74: *** *** + .byte %11111111 ; 0BA6 2-74: ******** + .byte %11111111 ; 0BA7 2-74: ******** + + .byte %11111111 ; 0BA8 2-75: ******** + .byte %11111111 ; 0BA9 2-75: ******** + .byte %11100111 ; 0BAA 2-75: *** *** + .byte %11111111 ; 0BAB 2-75: ******** + .byte %11111111 ; 0BAC 2-75: ******** + .byte %11100111 ; 0BAD 2-75: *** *** + .byte %11111111 ; 0BAE 2-75: ******** + .byte %11111111 ; 0BAF 2-75: ******** + + .byte %11111111 ; 0BB0 2-76: ******** + .byte %11111111 ; 0BB1 2-76: ******** + .byte %11100111 ; 0BB2 2-76: *** *** + .byte %11111111 ; 0BB3 2-76: ******** + .byte %11111111 ; 0BB4 2-76: ******** + .byte %11100111 ; 0BB5 2-76: *** *** + .byte %11100111 ; 0BB6 2-76: *** *** + .byte %11001111 ; 0BB7 2-76: ** **** + + .byte %11111111 ; 0BB8 2-77: ******** + .byte %11111111 ; 0BB9 2-77: ******** + .byte %11100111 ; 0BBA 2-77: *** *** + .byte %11111111 ; 0BBB 2-77: ******** + .byte %11111111 ; 0BBC 2-77: ******** + .byte %11100111 ; 0BBD 2-77: *** *** + .byte %11100111 ; 0BBE 2-77: *** *** + .byte %11001111 ; 0BBF 2-77: ** **** + + .byte %11110001 ; 0BC0 2-78: **** * + .byte %11100111 ; 0BC1 2-78: *** *** + .byte %11001111 ; 0BC2 2-78: ** **** + .byte %10011111 ; 0BC3 2-78: * ***** + .byte %11001111 ; 0BC4 2-78: ** **** + .byte %11100111 ; 0BC5 2-78: *** *** + .byte %11110001 ; 0BC6 2-78: **** * + .byte %11111111 ; 0BC7 2-78: ******** + + .byte %11110001 ; 0BC8 2-79: **** * + .byte %11100111 ; 0BC9 2-79: *** *** + .byte %11001111 ; 0BCA 2-79: ** **** + .byte %10011111 ; 0BCB 2-79: * ***** + .byte %11001111 ; 0BCC 2-79: ** **** + .byte %11100111 ; 0BCD 2-79: *** *** + .byte %11110001 ; 0BCE 2-79: **** * + .byte %11111111 ; 0BCF 2-79: ******** + + .byte %11111111 ; 0BD0 2-7a: ******** + .byte %11111111 ; 0BD1 2-7a: ******** + .byte %10000001 ; 0BD2 2-7a: * * + .byte %11111111 ; 0BD3 2-7a: ******** + .byte %10000001 ; 0BD4 2-7a: * * + .byte %11111111 ; 0BD5 2-7a: ******** + .byte %11111111 ; 0BD6 2-7a: ******** + .byte %11111111 ; 0BD7 2-7a: ******** + + .byte %11111111 ; 0BD8 2-7b: ******** + .byte %11111111 ; 0BD9 2-7b: ******** + .byte %10000001 ; 0BDA 2-7b: * * + .byte %11111111 ; 0BDB 2-7b: ******** + .byte %10000001 ; 0BDC 2-7b: * * + .byte %11111111 ; 0BDD 2-7b: ******** + .byte %11111111 ; 0BDE 2-7b: ******** + .byte %11111111 ; 0BDF 2-7b: ******** + + .byte %10001111 ; 0BE0 2-7c: * **** + .byte %11100111 ; 0BE1 2-7c: *** *** + .byte %11110011 ; 0BE2 2-7c: **** ** + .byte %11111001 ; 0BE3 2-7c: ***** * + .byte %11110011 ; 0BE4 2-7c: **** ** + .byte %11100111 ; 0BE5 2-7c: *** *** + .byte %10001111 ; 0BE6 2-7c: * **** + .byte %11111111 ; 0BE7 2-7c: ******** + + .byte %10001111 ; 0BE8 2-7d: * **** + .byte %11100111 ; 0BE9 2-7d: *** *** + .byte %11110011 ; 0BEA 2-7d: **** ** + .byte %11111001 ; 0BEB 2-7d: ***** * + .byte %11110011 ; 0BEC 2-7d: **** ** + .byte %11100111 ; 0BED 2-7d: *** *** + .byte %10001111 ; 0BEE 2-7d: * **** + .byte %11111111 ; 0BEF 2-7d: ******** + + .byte %11000011 ; 0BF0 2-7e: ** ** + .byte %10011001 ; 0BF1 2-7e: * ** * + .byte %11111001 ; 0BF2 2-7e: ***** * + .byte %11110011 ; 0BF3 2-7e: **** ** + .byte %11100111 ; 0BF4 2-7e: *** *** + .byte %11111111 ; 0BF5 2-7e: ******** + .byte %11100111 ; 0BF6 2-7e: *** *** + .byte %11111111 ; 0BF7 2-7e: ******** + + .byte %11000011 ; 0BF8 2-7f: ** ** + .byte %10011001 ; 0BF9 2-7f: * ** * + .byte %11111001 ; 0BFA 2-7f: ***** * + .byte %11110011 ; 0BFB 2-7f: **** ** + .byte %11100111 ; 0BFC 2-7f: *** *** + .byte %11111111 ; 0BFD 2-7f: ******** + .byte %11100111 ; 0BFE 2-7f: *** *** + .byte %11111111 ; 0BFF 2-7f: ******** + + .byte %11000011 ; 0C00 2-80: ** ** + .byte %10011001 ; 0C01 2-80: * ** * + .byte %10010001 ; 0C02 2-80: * * * + .byte %10010001 ; 0C03 2-80: * * * + .byte %10011111 ; 0C04 2-80: * ***** + .byte %10011101 ; 0C05 2-80: * *** * + .byte %11000011 ; 0C06 2-80: ** ** + .byte %11111111 ; 0C07 2-80: ******** + + .byte %11000011 ; 0C08 2-81: ** ** + .byte %10011001 ; 0C09 2-81: * ** * + .byte %10010001 ; 0C0A 2-81: * * * + .byte %10010001 ; 0C0B 2-81: * * * + .byte %10011111 ; 0C0C 2-81: * ***** + .byte %10011101 ; 0C0D 2-81: * *** * + .byte %11000011 ; 0C0E 2-81: ** ** + .byte %11111111 ; 0C0F 2-81: ******** + + .byte %11100111 ; 0C10 2-82: *** *** + .byte %11000011 ; 0C11 2-82: ** ** + .byte %10011001 ; 0C12 2-82: * ** * + .byte %10000001 ; 0C13 2-82: * * + .byte %10011001 ; 0C14 2-82: * ** * + .byte %10011001 ; 0C15 2-82: * ** * + .byte %10011001 ; 0C16 2-82: * ** * + .byte %11111111 ; 0C17 2-82: ******** + + .byte %11100111 ; 0C18 2-83: *** *** + .byte %11000011 ; 0C19 2-83: ** ** + .byte %10011001 ; 0C1A 2-83: * ** * + .byte %10000001 ; 0C1B 2-83: * * + .byte %10011001 ; 0C1C 2-83: * ** * + .byte %10011001 ; 0C1D 2-83: * ** * + .byte %10011001 ; 0C1E 2-83: * ** * + .byte %11111111 ; 0C1F 2-83: ******** + + .byte %10000011 ; 0C20 2-84: * ** + .byte %10011001 ; 0C21 2-84: * ** * + .byte %10011001 ; 0C22 2-84: * ** * + .byte %10000011 ; 0C23 2-84: * ** + .byte %10011001 ; 0C24 2-84: * ** * + .byte %10011001 ; 0C25 2-84: * ** * + .byte %10000011 ; 0C26 2-84: * ** + .byte %11111111 ; 0C27 2-84: ******** + + .byte %10000011 ; 0C28 2-85: * ** + .byte %10011001 ; 0C29 2-85: * ** * + .byte %10011001 ; 0C2A 2-85: * ** * + .byte %10000011 ; 0C2B 2-85: * ** + .byte %10011001 ; 0C2C 2-85: * ** * + .byte %10011001 ; 0C2D 2-85: * ** * + .byte %10000011 ; 0C2E 2-85: * ** + .byte %11111111 ; 0C2F 2-85: ******** + + .byte %11000011 ; 0C30 2-86: ** ** + .byte %10011001 ; 0C31 2-86: * ** * + .byte %10011111 ; 0C32 2-86: * ***** + .byte %10011111 ; 0C33 2-86: * ***** + .byte %10011111 ; 0C34 2-86: * ***** + .byte %10011001 ; 0C35 2-86: * ** * + .byte %11000011 ; 0C36 2-86: ** ** + .byte %11111111 ; 0C37 2-86: ******** + + .byte %11000011 ; 0C38 2-87: ** ** + .byte %10011001 ; 0C39 2-87: * ** * + .byte %10011111 ; 0C3A 2-87: * ***** + .byte %10011111 ; 0C3B 2-87: * ***** + .byte %10011111 ; 0C3C 2-87: * ***** + .byte %10011001 ; 0C3D 2-87: * ** * + .byte %11000011 ; 0C3E 2-87: ** ** + .byte %11111111 ; 0C3F 2-87: ******** + + .byte %10000111 ; 0C40 2-88: * *** + .byte %10010011 ; 0C41 2-88: * * ** + .byte %10011001 ; 0C42 2-88: * ** * + .byte %10011001 ; 0C43 2-88: * ** * + .byte %10011001 ; 0C44 2-88: * ** * + .byte %10010011 ; 0C45 2-88: * * ** + .byte %10000111 ; 0C46 2-88: * *** + .byte %11111111 ; 0C47 2-88: ******** + + .byte %10000111 ; 0C48 2-89: * *** + .byte %10010011 ; 0C49 2-89: * * ** + .byte %10011001 ; 0C4A 2-89: * ** * + .byte %10011001 ; 0C4B 2-89: * ** * + .byte %10011001 ; 0C4C 2-89: * ** * + .byte %10010011 ; 0C4D 2-89: * * ** + .byte %10000111 ; 0C4E 2-89: * *** + .byte %11111111 ; 0C4F 2-89: ******** + + .byte %10000001 ; 0C50 2-8a: * * + .byte %10011111 ; 0C51 2-8a: * ***** + .byte %10011111 ; 0C52 2-8a: * ***** + .byte %10000111 ; 0C53 2-8a: * *** + .byte %10011111 ; 0C54 2-8a: * ***** + .byte %10011111 ; 0C55 2-8a: * ***** + .byte %10000001 ; 0C56 2-8a: * * + .byte %11111111 ; 0C57 2-8a: ******** + + .byte %10000001 ; 0C58 2-8b: * * + .byte %10011111 ; 0C59 2-8b: * ***** + .byte %10011111 ; 0C5A 2-8b: * ***** + .byte %10000111 ; 0C5B 2-8b: * *** + .byte %10011111 ; 0C5C 2-8b: * ***** + .byte %10011111 ; 0C5D 2-8b: * ***** + .byte %10000001 ; 0C5E 2-8b: * * + .byte %11111111 ; 0C5F 2-8b: ******** + + .byte %10000001 ; 0C60 2-8c: * * + .byte %10011111 ; 0C61 2-8c: * ***** + .byte %10011111 ; 0C62 2-8c: * ***** + .byte %10000111 ; 0C63 2-8c: * *** + .byte %10011111 ; 0C64 2-8c: * ***** + .byte %10011111 ; 0C65 2-8c: * ***** + .byte %10011111 ; 0C66 2-8c: * ***** + .byte %11111111 ; 0C67 2-8c: ******** + + .byte %10000001 ; 0C68 2-8d: * * + .byte %10011111 ; 0C69 2-8d: * ***** + .byte %10011111 ; 0C6A 2-8d: * ***** + .byte %10000111 ; 0C6B 2-8d: * *** + .byte %10011111 ; 0C6C 2-8d: * ***** + .byte %10011111 ; 0C6D 2-8d: * ***** + .byte %10011111 ; 0C6E 2-8d: * ***** + .byte %11111111 ; 0C6F 2-8d: ******** + + .byte %11000011 ; 0C70 2-8e: ** ** + .byte %10011001 ; 0C71 2-8e: * ** * + .byte %10011111 ; 0C72 2-8e: * ***** + .byte %10010001 ; 0C73 2-8e: * * * + .byte %10011001 ; 0C74 2-8e: * ** * + .byte %10011001 ; 0C75 2-8e: * ** * + .byte %11000011 ; 0C76 2-8e: ** ** + .byte %11111111 ; 0C77 2-8e: ******** + + .byte %11000011 ; 0C78 2-8f: ** ** + .byte %10011001 ; 0C79 2-8f: * ** * + .byte %10011111 ; 0C7A 2-8f: * ***** + .byte %10010001 ; 0C7B 2-8f: * * * + .byte %10011001 ; 0C7C 2-8f: * ** * + .byte %10011001 ; 0C7D 2-8f: * ** * + .byte %11000011 ; 0C7E 2-8f: ** ** + .byte %11111111 ; 0C7F 2-8f: ******** + + .byte %10011001 ; 0C80 2-90: * ** * + .byte %10011001 ; 0C81 2-90: * ** * + .byte %10011001 ; 0C82 2-90: * ** * + .byte %10000001 ; 0C83 2-90: * * + .byte %10011001 ; 0C84 2-90: * ** * + .byte %10011001 ; 0C85 2-90: * ** * + .byte %10011001 ; 0C86 2-90: * ** * + .byte %11111111 ; 0C87 2-90: ******** + + .byte %10011001 ; 0C88 2-91: * ** * + .byte %10011001 ; 0C89 2-91: * ** * + .byte %10011001 ; 0C8A 2-91: * ** * + .byte %10000001 ; 0C8B 2-91: * * + .byte %10011001 ; 0C8C 2-91: * ** * + .byte %10011001 ; 0C8D 2-91: * ** * + .byte %10011001 ; 0C8E 2-91: * ** * + .byte %11111111 ; 0C8F 2-91: ******** + + .byte %11000011 ; 0C90 2-92: ** ** + .byte %11100111 ; 0C91 2-92: *** *** + .byte %11100111 ; 0C92 2-92: *** *** + .byte %11100111 ; 0C93 2-92: *** *** + .byte %11100111 ; 0C94 2-92: *** *** + .byte %11100111 ; 0C95 2-92: *** *** + .byte %11000011 ; 0C96 2-92: ** ** + .byte %11111111 ; 0C97 2-92: ******** + + .byte %11000011 ; 0C98 2-93: ** ** + .byte %11100111 ; 0C99 2-93: *** *** + .byte %11100111 ; 0C9A 2-93: *** *** + .byte %11100111 ; 0C9B 2-93: *** *** + .byte %11100111 ; 0C9C 2-93: *** *** + .byte %11100111 ; 0C9D 2-93: *** *** + .byte %11000011 ; 0C9E 2-93: ** ** + .byte %11111111 ; 0C9F 2-93: ******** + + .byte %11100001 ; 0CA0 2-94: *** * + .byte %11110011 ; 0CA1 2-94: **** ** + .byte %11110011 ; 0CA2 2-94: **** ** + .byte %11110011 ; 0CA3 2-94: **** ** + .byte %11110011 ; 0CA4 2-94: **** ** + .byte %10010011 ; 0CA5 2-94: * * ** + .byte %11000111 ; 0CA6 2-94: ** *** + .byte %11111111 ; 0CA7 2-94: ******** + + .byte %11100001 ; 0CA8 2-95: *** * + .byte %11110011 ; 0CA9 2-95: **** ** + .byte %11110011 ; 0CAA 2-95: **** ** + .byte %11110011 ; 0CAB 2-95: **** ** + .byte %11110011 ; 0CAC 2-95: **** ** + .byte %10010011 ; 0CAD 2-95: * * ** + .byte %11000111 ; 0CAE 2-95: ** *** + .byte %11111111 ; 0CAF 2-95: ******** + + .byte %10011001 ; 0CB0 2-96: * ** * + .byte %10010011 ; 0CB1 2-96: * * ** + .byte %10000111 ; 0CB2 2-96: * *** + .byte %10001111 ; 0CB3 2-96: * **** + .byte %10000111 ; 0CB4 2-96: * *** + .byte %10010011 ; 0CB5 2-96: * * ** + .byte %10011001 ; 0CB6 2-96: * ** * + .byte %11111111 ; 0CB7 2-96: ******** + + .byte %10011001 ; 0CB8 2-97: * ** * + .byte %10010011 ; 0CB9 2-97: * * ** + .byte %10000111 ; 0CBA 2-97: * *** + .byte %10001111 ; 0CBB 2-97: * **** + .byte %10000111 ; 0CBC 2-97: * *** + .byte %10010011 ; 0CBD 2-97: * * ** + .byte %10011001 ; 0CBE 2-97: * ** * + .byte %11111111 ; 0CBF 2-97: ******** + + .byte %10011111 ; 0CC0 2-98: * ***** + .byte %10011111 ; 0CC1 2-98: * ***** + .byte %10011111 ; 0CC2 2-98: * ***** + .byte %10011111 ; 0CC3 2-98: * ***** + .byte %10011111 ; 0CC4 2-98: * ***** + .byte %10011111 ; 0CC5 2-98: * ***** + .byte %10000001 ; 0CC6 2-98: * * + .byte %11111111 ; 0CC7 2-98: ******** + + .byte %10011111 ; 0CC8 2-99: * ***** + .byte %10011111 ; 0CC9 2-99: * ***** + .byte %10011111 ; 0CCA 2-99: * ***** + .byte %10011111 ; 0CCB 2-99: * ***** + .byte %10011111 ; 0CCC 2-99: * ***** + .byte %10011111 ; 0CCD 2-99: * ***** + .byte %10000001 ; 0CCE 2-99: * * + .byte %11111111 ; 0CCF 2-99: ******** + + .byte %10011100 ; 0CD0 2-9a: * *** + .byte %10001000 ; 0CD1 2-9a: * * + .byte %10000000 ; 0CD2 2-9a: * + .byte %10010100 ; 0CD3 2-9a: * * * + .byte %10011100 ; 0CD4 2-9a: * *** + .byte %10011100 ; 0CD5 2-9a: * *** + .byte %10011100 ; 0CD6 2-9a: * *** + .byte %11111111 ; 0CD7 2-9a: ******** + + .byte %10011100 ; 0CD8 2-9b: * *** + .byte %10001000 ; 0CD9 2-9b: * * + .byte %10000000 ; 0CDA 2-9b: * + .byte %10010100 ; 0CDB 2-9b: * * * + .byte %10011100 ; 0CDC 2-9b: * *** + .byte %10011100 ; 0CDD 2-9b: * *** + .byte %10011100 ; 0CDE 2-9b: * *** + .byte %11111111 ; 0CDF 2-9b: ******** + + .byte %10011001 ; 0CE0 2-9c: * ** * + .byte %10001001 ; 0CE1 2-9c: * * * + .byte %10000001 ; 0CE2 2-9c: * * + .byte %10000001 ; 0CE3 2-9c: * * + .byte %10010001 ; 0CE4 2-9c: * * * + .byte %10011001 ; 0CE5 2-9c: * ** * + .byte %10011001 ; 0CE6 2-9c: * ** * + .byte %11111111 ; 0CE7 2-9c: ******** + + .byte %10011001 ; 0CE8 2-9d: * ** * + .byte %10001001 ; 0CE9 2-9d: * * * + .byte %10000001 ; 0CEA 2-9d: * * + .byte %10000001 ; 0CEB 2-9d: * * + .byte %10010001 ; 0CEC 2-9d: * * * + .byte %10011001 ; 0CED 2-9d: * ** * + .byte %10011001 ; 0CEE 2-9d: * ** * + .byte %11111111 ; 0CEF 2-9d: ******** + + .byte %11000011 ; 0CF0 2-9e: ** ** + .byte %10011001 ; 0CF1 2-9e: * ** * + .byte %10011001 ; 0CF2 2-9e: * ** * + .byte %10011001 ; 0CF3 2-9e: * ** * + .byte %10011001 ; 0CF4 2-9e: * ** * + .byte %10011001 ; 0CF5 2-9e: * ** * + .byte %11000011 ; 0CF6 2-9e: ** ** + .byte %11111111 ; 0CF7 2-9e: ******** + + .byte %11000011 ; 0CF8 2-9f: ** ** + .byte %10011001 ; 0CF9 2-9f: * ** * + .byte %10011001 ; 0CFA 2-9f: * ** * + .byte %10011001 ; 0CFB 2-9f: * ** * + .byte %10011001 ; 0CFC 2-9f: * ** * + .byte %10011001 ; 0CFD 2-9f: * ** * + .byte %11000011 ; 0CFE 2-9f: ** ** + .byte %11111111 ; 0CFF 2-9f: ******** + + .byte %10000011 ; 0D00 2-a0: * ** + .byte %10011001 ; 0D01 2-a0: * ** * + .byte %10011001 ; 0D02 2-a0: * ** * + .byte %10000011 ; 0D03 2-a0: * ** + .byte %10011111 ; 0D04 2-a0: * ***** + .byte %10011111 ; 0D05 2-a0: * ***** + .byte %10011111 ; 0D06 2-a0: * ***** + .byte %11111111 ; 0D07 2-a0: ******** + + .byte %10000011 ; 0D08 2-a1: * ** + .byte %10011001 ; 0D09 2-a1: * ** * + .byte %10011001 ; 0D0A 2-a1: * ** * + .byte %10000011 ; 0D0B 2-a1: * ** + .byte %10011111 ; 0D0C 2-a1: * ***** + .byte %10011111 ; 0D0D 2-a1: * ***** + .byte %10011111 ; 0D0E 2-a1: * ***** + .byte %11111111 ; 0D0F 2-a1: ******** + + .byte %11000011 ; 0D10 2-a2: ** ** + .byte %10011001 ; 0D11 2-a2: * ** * + .byte %10011001 ; 0D12 2-a2: * ** * + .byte %10011001 ; 0D13 2-a2: * ** * + .byte %10011001 ; 0D14 2-a2: * ** * + .byte %11000011 ; 0D15 2-a2: ** ** + .byte %11110001 ; 0D16 2-a2: **** * + .byte %11111111 ; 0D17 2-a2: ******** + + .byte %11000011 ; 0D18 2-a3: ** ** + .byte %10011001 ; 0D19 2-a3: * ** * + .byte %10011001 ; 0D1A 2-a3: * ** * + .byte %10011001 ; 0D1B 2-a3: * ** * + .byte %10011001 ; 0D1C 2-a3: * ** * + .byte %11000011 ; 0D1D 2-a3: ** ** + .byte %11110001 ; 0D1E 2-a3: **** * + .byte %11111111 ; 0D1F 2-a3: ******** + + .byte %10000011 ; 0D20 2-a4: * ** + .byte %10011001 ; 0D21 2-a4: * ** * + .byte %10011001 ; 0D22 2-a4: * ** * + .byte %10000011 ; 0D23 2-a4: * ** + .byte %10000111 ; 0D24 2-a4: * *** + .byte %10010011 ; 0D25 2-a4: * * ** + .byte %10011001 ; 0D26 2-a4: * ** * + .byte %11111111 ; 0D27 2-a4: ******** + + .byte %10000011 ; 0D28 2-a5: * ** + .byte %10011001 ; 0D29 2-a5: * ** * + .byte %10011001 ; 0D2A 2-a5: * ** * + .byte %10000011 ; 0D2B 2-a5: * ** + .byte %10000111 ; 0D2C 2-a5: * *** + .byte %10010011 ; 0D2D 2-a5: * * ** + .byte %10011001 ; 0D2E 2-a5: * ** * + .byte %11111111 ; 0D2F 2-a5: ******** + + .byte %11000011 ; 0D30 2-a6: ** ** + .byte %10011001 ; 0D31 2-a6: * ** * + .byte %10011111 ; 0D32 2-a6: * ***** + .byte %11000011 ; 0D33 2-a6: ** ** + .byte %11111001 ; 0D34 2-a6: ***** * + .byte %10011001 ; 0D35 2-a6: * ** * + .byte %11000011 ; 0D36 2-a6: ** ** + .byte %11111111 ; 0D37 2-a6: ******** + + .byte %11000011 ; 0D38 2-a7: ** ** + .byte %10011001 ; 0D39 2-a7: * ** * + .byte %10011111 ; 0D3A 2-a7: * ***** + .byte %11000011 ; 0D3B 2-a7: ** ** + .byte %11111001 ; 0D3C 2-a7: ***** * + .byte %10011001 ; 0D3D 2-a7: * ** * + .byte %11000011 ; 0D3E 2-a7: ** ** + .byte %11111111 ; 0D3F 2-a7: ******** + + .byte %10000001 ; 0D40 2-a8: * * + .byte %11100111 ; 0D41 2-a8: *** *** + .byte %11100111 ; 0D42 2-a8: *** *** + .byte %11100111 ; 0D43 2-a8: *** *** + .byte %11100111 ; 0D44 2-a8: *** *** + .byte %11100111 ; 0D45 2-a8: *** *** + .byte %11100111 ; 0D46 2-a8: *** *** + .byte %11111111 ; 0D47 2-a8: ******** + + .byte %10000001 ; 0D48 2-a9: * * + .byte %11100111 ; 0D49 2-a9: *** *** + .byte %11100111 ; 0D4A 2-a9: *** *** + .byte %11100111 ; 0D4B 2-a9: *** *** + .byte %11100111 ; 0D4C 2-a9: *** *** + .byte %11100111 ; 0D4D 2-a9: *** *** + .byte %11100111 ; 0D4E 2-a9: *** *** + .byte %11111111 ; 0D4F 2-a9: ******** + + .byte %10011001 ; 0D50 2-aa: * ** * + .byte %10011001 ; 0D51 2-aa: * ** * + .byte %10011001 ; 0D52 2-aa: * ** * + .byte %10011001 ; 0D53 2-aa: * ** * + .byte %10011001 ; 0D54 2-aa: * ** * + .byte %10011001 ; 0D55 2-aa: * ** * + .byte %11000011 ; 0D56 2-aa: ** ** + .byte %11111111 ; 0D57 2-aa: ******** + + .byte %10011001 ; 0D58 2-ab: * ** * + .byte %10011001 ; 0D59 2-ab: * ** * + .byte %10011001 ; 0D5A 2-ab: * ** * + .byte %10011001 ; 0D5B 2-ab: * ** * + .byte %10011001 ; 0D5C 2-ab: * ** * + .byte %10011001 ; 0D5D 2-ab: * ** * + .byte %11000011 ; 0D5E 2-ab: ** ** + .byte %11111111 ; 0D5F 2-ab: ******** + + .byte %10011001 ; 0D60 2-ac: * ** * + .byte %10011001 ; 0D61 2-ac: * ** * + .byte %10011001 ; 0D62 2-ac: * ** * + .byte %10011001 ; 0D63 2-ac: * ** * + .byte %10011001 ; 0D64 2-ac: * ** * + .byte %11000011 ; 0D65 2-ac: ** ** + .byte %11100111 ; 0D66 2-ac: *** *** + .byte %11111111 ; 0D67 2-ac: ******** + + .byte %10011001 ; 0D68 2-ad: * ** * + .byte %10011001 ; 0D69 2-ad: * ** * + .byte %10011001 ; 0D6A 2-ad: * ** * + .byte %10011001 ; 0D6B 2-ad: * ** * + .byte %10011001 ; 0D6C 2-ad: * ** * + .byte %11000011 ; 0D6D 2-ad: ** ** + .byte %11100111 ; 0D6E 2-ad: *** *** + .byte %11111111 ; 0D6F 2-ad: ******** + + .byte %10011100 ; 0D70 2-ae: * *** + .byte %10011100 ; 0D71 2-ae: * *** + .byte %10011100 ; 0D72 2-ae: * *** + .byte %10010100 ; 0D73 2-ae: * * * + .byte %10000000 ; 0D74 2-ae: * + .byte %10001000 ; 0D75 2-ae: * * + .byte %10011100 ; 0D76 2-ae: * *** + .byte %11111111 ; 0D77 2-ae: ******** + + .byte %10011100 ; 0D78 2-af: * *** + .byte %10011100 ; 0D79 2-af: * *** + .byte %10011100 ; 0D7A 2-af: * *** + .byte %10010100 ; 0D7B 2-af: * * * + .byte %10000000 ; 0D7C 2-af: * + .byte %10001000 ; 0D7D 2-af: * * + .byte %10011100 ; 0D7E 2-af: * *** + .byte %11111111 ; 0D7F 2-af: ******** + + .byte %10011001 ; 0D80 2-b0: * ** * + .byte %10011001 ; 0D81 2-b0: * ** * + .byte %11000011 ; 0D82 2-b0: ** ** + .byte %11100111 ; 0D83 2-b0: *** *** + .byte %11000011 ; 0D84 2-b0: ** ** + .byte %10011001 ; 0D85 2-b0: * ** * + .byte %10011001 ; 0D86 2-b0: * ** * + .byte %11111111 ; 0D87 2-b0: ******** + + .byte %10011001 ; 0D88 2-b1: * ** * + .byte %10011001 ; 0D89 2-b1: * ** * + .byte %11000011 ; 0D8A 2-b1: ** ** + .byte %11100111 ; 0D8B 2-b1: *** *** + .byte %11000011 ; 0D8C 2-b1: ** ** + .byte %10011001 ; 0D8D 2-b1: * ** * + .byte %10011001 ; 0D8E 2-b1: * ** * + .byte %11111111 ; 0D8F 2-b1: ******** + + .byte %10011001 ; 0D90 2-b2: * ** * + .byte %10011001 ; 0D91 2-b2: * ** * + .byte %10011001 ; 0D92 2-b2: * ** * + .byte %11000011 ; 0D93 2-b2: ** ** + .byte %11100111 ; 0D94 2-b2: *** *** + .byte %11100111 ; 0D95 2-b2: *** *** + .byte %11100111 ; 0D96 2-b2: *** *** + .byte %11111111 ; 0D97 2-b2: ******** + + .byte %10011001 ; 0D98 2-b3: * ** * + .byte %10011001 ; 0D99 2-b3: * ** * + .byte %10011001 ; 0D9A 2-b3: * ** * + .byte %11000011 ; 0D9B 2-b3: ** ** + .byte %11100111 ; 0D9C 2-b3: *** *** + .byte %11100111 ; 0D9D 2-b3: *** *** + .byte %11100111 ; 0D9E 2-b3: *** *** + .byte %11111111 ; 0D9F 2-b3: ******** + + .byte %10000001 ; 0DA0 2-b4: * * + .byte %11111001 ; 0DA1 2-b4: ***** * + .byte %11110011 ; 0DA2 2-b4: **** ** + .byte %11100111 ; 0DA3 2-b4: *** *** + .byte %11001111 ; 0DA4 2-b4: ** **** + .byte %10011111 ; 0DA5 2-b4: * ***** + .byte %10000001 ; 0DA6 2-b4: * * + .byte %11111111 ; 0DA7 2-b4: ******** + + .byte %10000001 ; 0DA8 2-b5: * * + .byte %11111001 ; 0DA9 2-b5: ***** * + .byte %11110011 ; 0DAA 2-b5: **** ** + .byte %11100111 ; 0DAB 2-b5: *** *** + .byte %11001111 ; 0DAC 2-b5: ** **** + .byte %10011111 ; 0DAD 2-b5: * ***** + .byte %10000001 ; 0DAE 2-b5: * * + .byte %11111111 ; 0DAF 2-b5: ******** + + .byte %11000011 ; 0DB0 2-b6: ** ** + .byte %11001111 ; 0DB1 2-b6: ** **** + .byte %11001111 ; 0DB2 2-b6: ** **** + .byte %11001111 ; 0DB3 2-b6: ** **** + .byte %11001111 ; 0DB4 2-b6: ** **** + .byte %11001111 ; 0DB5 2-b6: ** **** + .byte %11000011 ; 0DB6 2-b6: ** ** + .byte %11111111 ; 0DB7 2-b6: ******** + + .byte %11000011 ; 0DB8 2-b7: ** ** + .byte %11001111 ; 0DB9 2-b7: ** **** + .byte %11001111 ; 0DBA 2-b7: ** **** + .byte %11001111 ; 0DBB 2-b7: ** **** + .byte %11001111 ; 0DBC 2-b7: ** **** + .byte %11001111 ; 0DBD 2-b7: ** **** + .byte %11000011 ; 0DBE 2-b7: ** ** + .byte %11111111 ; 0DBF 2-b7: ******** + + .byte %10011111 ; 0DC0 2-b8: * ***** + .byte %11001111 ; 0DC1 2-b8: ** **** + .byte %11100111 ; 0DC2 2-b8: *** *** + .byte %11110011 ; 0DC3 2-b8: **** ** + .byte %11111001 ; 0DC4 2-b8: ***** * + .byte %11111100 ; 0DC5 2-b8: ****** + .byte %11111111 ; 0DC6 2-b8: ******** + .byte %11111111 ; 0DC7 2-b8: ******** + + .byte %10011111 ; 0DC8 2-b9: * ***** + .byte %11001111 ; 0DC9 2-b9: ** **** + .byte %11100111 ; 0DCA 2-b9: *** *** + .byte %11110011 ; 0DCB 2-b9: **** ** + .byte %11111001 ; 0DCC 2-b9: ***** * + .byte %11111100 ; 0DCD 2-b9: ****** + .byte %11111111 ; 0DCE 2-b9: ******** + .byte %11111111 ; 0DCF 2-b9: ******** + + .byte %11000011 ; 0DD0 2-ba: ** ** + .byte %11110011 ; 0DD1 2-ba: **** ** + .byte %11110011 ; 0DD2 2-ba: **** ** + .byte %11110011 ; 0DD3 2-ba: **** ** + .byte %11110011 ; 0DD4 2-ba: **** ** + .byte %11110011 ; 0DD5 2-ba: **** ** + .byte %11000011 ; 0DD6 2-ba: ** ** + .byte %11111111 ; 0DD7 2-ba: ******** + + .byte %11000011 ; 0DD8 2-bb: ** ** + .byte %11110011 ; 0DD9 2-bb: **** ** + .byte %11110011 ; 0DDA 2-bb: **** ** + .byte %11110011 ; 0DDB 2-bb: **** ** + .byte %11110011 ; 0DDC 2-bb: **** ** + .byte %11110011 ; 0DDD 2-bb: **** ** + .byte %11000011 ; 0DDE 2-bb: ** ** + .byte %11111111 ; 0DDF 2-bb: ******** + + .byte %11111111 ; 0DE0 2-bc: ******** + .byte %11100111 ; 0DE1 2-bc: *** *** + .byte %11000011 ; 0DE2 2-bc: ** ** + .byte %10011001 ; 0DE3 2-bc: * ** * + .byte %11111111 ; 0DE4 2-bc: ******** + .byte %11111111 ; 0DE5 2-bc: ******** + .byte %11111111 ; 0DE6 2-bc: ******** + .byte %11111111 ; 0DE7 2-bc: ******** + + .byte %11111111 ; 0DE8 2-bd: ******** + .byte %11100111 ; 0DE9 2-bd: *** *** + .byte %11000011 ; 0DEA 2-bd: ** ** + .byte %10011001 ; 0DEB 2-bd: * ** * + .byte %11111111 ; 0DEC 2-bd: ******** + .byte %11111111 ; 0DED 2-bd: ******** + .byte %11111111 ; 0DEE 2-bd: ******** + .byte %11111111 ; 0DEF 2-bd: ******** + + .byte %11111111 ; 0DF0 2-be: ******** + .byte %11111111 ; 0DF1 2-be: ******** + .byte %11111111 ; 0DF2 2-be: ******** + .byte %11111111 ; 0DF3 2-be: ******** + .byte %11111111 ; 0DF4 2-be: ******** + .byte %11111111 ; 0DF5 2-be: ******** + .byte %10000000 ; 0DF6 2-be: * + .byte %11111111 ; 0DF7 2-be: ******** + + .byte %11111111 ; 0DF8 2-bf: ******** + .byte %11111111 ; 0DF9 2-bf: ******** + .byte %11111111 ; 0DFA 2-bf: ******** + .byte %11111111 ; 0DFB 2-bf: ******** + .byte %11111111 ; 0DFC 2-bf: ******** + .byte %11111111 ; 0DFD 2-bf: ******** + .byte %10000000 ; 0DFE 2-bf: * + .byte %11111111 ; 0DFF 2-bf: ******** + + .byte %11100111 ; 0E00 2-c0: *** *** + .byte %11100111 ; 0E01 2-c0: *** *** + .byte %11100111 ; 0E02 2-c0: *** *** + .byte %11111111 ; 0E03 2-c0: ******** + .byte %11111111 ; 0E04 2-c0: ******** + .byte %11111111 ; 0E05 2-c0: ******** + .byte %11111111 ; 0E06 2-c0: ******** + .byte %11111111 ; 0E07 2-c0: ******** + + .byte %11100111 ; 0E08 2-c1: *** *** + .byte %11100111 ; 0E09 2-c1: *** *** + .byte %11100111 ; 0E0A 2-c1: *** *** + .byte %11111111 ; 0E0B 2-c1: ******** + .byte %11111111 ; 0E0C 2-c1: ******** + .byte %11111111 ; 0E0D 2-c1: ******** + .byte %11111111 ; 0E0E 2-c1: ******** + .byte %11111111 ; 0E0F 2-c1: ******** + + .byte %11111111 ; 0E10 2-c2: ******** + .byte %11111111 ; 0E11 2-c2: ******** + .byte %11000011 ; 0E12 2-c2: ** ** + .byte %11111001 ; 0E13 2-c2: ***** * + .byte %11000001 ; 0E14 2-c2: ** * + .byte %10011001 ; 0E15 2-c2: * ** * + .byte %11000001 ; 0E16 2-c2: ** * + .byte %11111111 ; 0E17 2-c2: ******** + + .byte %11111111 ; 0E18 2-c3: ******** + .byte %11111111 ; 0E19 2-c3: ******** + .byte %11000011 ; 0E1A 2-c3: ** ** + .byte %11111001 ; 0E1B 2-c3: ***** * + .byte %11000001 ; 0E1C 2-c3: ** * + .byte %10011001 ; 0E1D 2-c3: * ** * + .byte %11000001 ; 0E1E 2-c3: ** * + .byte %11111111 ; 0E1F 2-c3: ******** + + .byte %11111111 ; 0E20 2-c4: ******** + .byte %10011111 ; 0E21 2-c4: * ***** + .byte %10011111 ; 0E22 2-c4: * ***** + .byte %10000011 ; 0E23 2-c4: * ** + .byte %10011001 ; 0E24 2-c4: * ** * + .byte %10011001 ; 0E25 2-c4: * ** * + .byte %10000011 ; 0E26 2-c4: * ** + .byte %11111111 ; 0E27 2-c4: ******** + + .byte %11111111 ; 0E28 2-c5: ******** + .byte %10011111 ; 0E29 2-c5: * ***** + .byte %10011111 ; 0E2A 2-c5: * ***** + .byte %10000011 ; 0E2B 2-c5: * ** + .byte %10011001 ; 0E2C 2-c5: * ** * + .byte %10011001 ; 0E2D 2-c5: * ** * + .byte %10000011 ; 0E2E 2-c5: * ** + .byte %11111111 ; 0E2F 2-c5: ******** + + .byte %11111111 ; 0E30 2-c6: ******** + .byte %11111111 ; 0E31 2-c6: ******** + .byte %11000011 ; 0E32 2-c6: ** ** + .byte %10011111 ; 0E33 2-c6: * ***** + .byte %10011111 ; 0E34 2-c6: * ***** + .byte %10011111 ; 0E35 2-c6: * ***** + .byte %11000011 ; 0E36 2-c6: ** ** + .byte %11111111 ; 0E37 2-c6: ******** + + .byte %11111111 ; 0E38 2-c7: ******** + .byte %11111111 ; 0E39 2-c7: ******** + .byte %11000011 ; 0E3A 2-c7: ** ** + .byte %10011111 ; 0E3B 2-c7: * ***** + .byte %10011111 ; 0E3C 2-c7: * ***** + .byte %10011111 ; 0E3D 2-c7: * ***** + .byte %11000011 ; 0E3E 2-c7: ** ** + .byte %11111111 ; 0E3F 2-c7: ******** + + .byte %11111111 ; 0E40 2-c8: ******** + .byte %11111001 ; 0E41 2-c8: ***** * + .byte %11111001 ; 0E42 2-c8: ***** * + .byte %11000001 ; 0E43 2-c8: ** * + .byte %10011001 ; 0E44 2-c8: * ** * + .byte %10011001 ; 0E45 2-c8: * ** * + .byte %11000001 ; 0E46 2-c8: ** * + .byte %11111111 ; 0E47 2-c8: ******** + + .byte %11111111 ; 0E48 2-c9: ******** + .byte %11111001 ; 0E49 2-c9: ***** * + .byte %11111001 ; 0E4A 2-c9: ***** * + .byte %11000001 ; 0E4B 2-c9: ** * + .byte %10011001 ; 0E4C 2-c9: * ** * + .byte %10011001 ; 0E4D 2-c9: * ** * + .byte %11000001 ; 0E4E 2-c9: ** * + .byte %11111111 ; 0E4F 2-c9: ******** + + .byte %11111111 ; 0E50 2-ca: ******** + .byte %11111111 ; 0E51 2-ca: ******** + .byte %11000011 ; 0E52 2-ca: ** ** + .byte %10011001 ; 0E53 2-ca: * ** * + .byte %10000001 ; 0E54 2-ca: * * + .byte %10011111 ; 0E55 2-ca: * ***** + .byte %11000011 ; 0E56 2-ca: ** ** + .byte %11111111 ; 0E57 2-ca: ******** + + .byte %11111111 ; 0E58 2-cb: ******** + .byte %11111111 ; 0E59 2-cb: ******** + .byte %11000011 ; 0E5A 2-cb: ** ** + .byte %10011001 ; 0E5B 2-cb: * ** * + .byte %10000001 ; 0E5C 2-cb: * * + .byte %10011111 ; 0E5D 2-cb: * ***** + .byte %11000011 ; 0E5E 2-cb: ** ** + .byte %11111111 ; 0E5F 2-cb: ******** + + .byte %11111111 ; 0E60 2-cc: ******** + .byte %11110001 ; 0E61 2-cc: **** * + .byte %11100111 ; 0E62 2-cc: *** *** + .byte %11000001 ; 0E63 2-cc: ** * + .byte %11100111 ; 0E64 2-cc: *** *** + .byte %11100111 ; 0E65 2-cc: *** *** + .byte %11100111 ; 0E66 2-cc: *** *** + .byte %11111111 ; 0E67 2-cc: ******** + + .byte %11111111 ; 0E68 2-cd: ******** + .byte %11110001 ; 0E69 2-cd: **** * + .byte %11100111 ; 0E6A 2-cd: *** *** + .byte %11000001 ; 0E6B 2-cd: ** * + .byte %11100111 ; 0E6C 2-cd: *** *** + .byte %11100111 ; 0E6D 2-cd: *** *** + .byte %11100111 ; 0E6E 2-cd: *** *** + .byte %11111111 ; 0E6F 2-cd: ******** + + .byte %11111111 ; 0E70 2-ce: ******** + .byte %11111111 ; 0E71 2-ce: ******** + .byte %11000001 ; 0E72 2-ce: ** * + .byte %10011001 ; 0E73 2-ce: * ** * + .byte %10011001 ; 0E74 2-ce: * ** * + .byte %11000001 ; 0E75 2-ce: ** * + .byte %11111001 ; 0E76 2-ce: ***** * + .byte %10000011 ; 0E77 2-ce: * ** + + .byte %11111111 ; 0E78 2-cf: ******** + .byte %11111111 ; 0E79 2-cf: ******** + .byte %11000001 ; 0E7A 2-cf: ** * + .byte %10011001 ; 0E7B 2-cf: * ** * + .byte %10011001 ; 0E7C 2-cf: * ** * + .byte %11000001 ; 0E7D 2-cf: ** * + .byte %11111001 ; 0E7E 2-cf: ***** * + .byte %10000011 ; 0E7F 2-cf: * ** + + .byte %11111111 ; 0E80 2-d0: ******** + .byte %10011111 ; 0E81 2-d0: * ***** + .byte %10011111 ; 0E82 2-d0: * ***** + .byte %10000011 ; 0E83 2-d0: * ** + .byte %10011001 ; 0E84 2-d0: * ** * + .byte %10011001 ; 0E85 2-d0: * ** * + .byte %10011001 ; 0E86 2-d0: * ** * + .byte %11111111 ; 0E87 2-d0: ******** + + .byte %11111111 ; 0E88 2-d1: ******** + .byte %10011111 ; 0E89 2-d1: * ***** + .byte %10011111 ; 0E8A 2-d1: * ***** + .byte %10000011 ; 0E8B 2-d1: * ** + .byte %10011001 ; 0E8C 2-d1: * ** * + .byte %10011001 ; 0E8D 2-d1: * ** * + .byte %10011001 ; 0E8E 2-d1: * ** * + .byte %11111111 ; 0E8F 2-d1: ******** + + .byte %11111111 ; 0E90 2-d2: ******** + .byte %11100111 ; 0E91 2-d2: *** *** + .byte %11111111 ; 0E92 2-d2: ******** + .byte %11000111 ; 0E93 2-d2: ** *** + .byte %11100111 ; 0E94 2-d2: *** *** + .byte %11100111 ; 0E95 2-d2: *** *** + .byte %11000011 ; 0E96 2-d2: ** ** + .byte %11111111 ; 0E97 2-d2: ******** + + .byte %11111111 ; 0E98 2-d3: ******** + .byte %11100111 ; 0E99 2-d3: *** *** + .byte %11111111 ; 0E9A 2-d3: ******** + .byte %11000111 ; 0E9B 2-d3: ** *** + .byte %11100111 ; 0E9C 2-d3: *** *** + .byte %11100111 ; 0E9D 2-d3: *** *** + .byte %11000011 ; 0E9E 2-d3: ** ** + .byte %11111111 ; 0E9F 2-d3: ******** + + .byte %11111111 ; 0EA0 2-d4: ******** + .byte %11111001 ; 0EA1 2-d4: ***** * + .byte %11111111 ; 0EA2 2-d4: ******** + .byte %11111001 ; 0EA3 2-d4: ***** * + .byte %11111001 ; 0EA4 2-d4: ***** * + .byte %11111001 ; 0EA5 2-d4: ***** * + .byte %11111001 ; 0EA6 2-d4: ***** * + .byte %11000011 ; 0EA7 2-d4: ** ** + + .byte %11111111 ; 0EA8 2-d5: ******** + .byte %11111001 ; 0EA9 2-d5: ***** * + .byte %11111111 ; 0EAA 2-d5: ******** + .byte %11111001 ; 0EAB 2-d5: ***** * + .byte %11111001 ; 0EAC 2-d5: ***** * + .byte %11111001 ; 0EAD 2-d5: ***** * + .byte %11111001 ; 0EAE 2-d5: ***** * + .byte %11000011 ; 0EAF 2-d5: ** ** + + .byte %11111111 ; 0EB0 2-d6: ******** + .byte %10011111 ; 0EB1 2-d6: * ***** + .byte %10011111 ; 0EB2 2-d6: * ***** + .byte %10010011 ; 0EB3 2-d6: * * ** + .byte %10000111 ; 0EB4 2-d6: * *** + .byte %10010011 ; 0EB5 2-d6: * * ** + .byte %10011001 ; 0EB6 2-d6: * ** * + .byte %11111111 ; 0EB7 2-d6: ******** + + .byte %11111111 ; 0EB8 2-d7: ******** + .byte %10011111 ; 0EB9 2-d7: * ***** + .byte %10011111 ; 0EBA 2-d7: * ***** + .byte %10010011 ; 0EBB 2-d7: * * ** + .byte %10000111 ; 0EBC 2-d7: * *** + .byte %10010011 ; 0EBD 2-d7: * * ** + .byte %10011001 ; 0EBE 2-d7: * ** * + .byte %11111111 ; 0EBF 2-d7: ******** + + .byte %11111111 ; 0EC0 2-d8: ******** + .byte %11000111 ; 0EC1 2-d8: ** *** + .byte %11100111 ; 0EC2 2-d8: *** *** + .byte %11100111 ; 0EC3 2-d8: *** *** + .byte %11100111 ; 0EC4 2-d8: *** *** + .byte %11100111 ; 0EC5 2-d8: *** *** + .byte %11000011 ; 0EC6 2-d8: ** ** + .byte %11111111 ; 0EC7 2-d8: ******** + + .byte %11111111 ; 0EC8 2-d9: ******** + .byte %11000111 ; 0EC9 2-d9: ** *** + .byte %11100111 ; 0ECA 2-d9: *** *** + .byte %11100111 ; 0ECB 2-d9: *** *** + .byte %11100111 ; 0ECC 2-d9: *** *** + .byte %11100111 ; 0ECD 2-d9: *** *** + .byte %11000011 ; 0ECE 2-d9: ** ** + .byte %11111111 ; 0ECF 2-d9: ******** + + .byte %11111111 ; 0ED0 2-da: ******** + .byte %11111111 ; 0ED1 2-da: ******** + .byte %10011001 ; 0ED2 2-da: * ** * + .byte %10000000 ; 0ED3 2-da: * + .byte %10000000 ; 0ED4 2-da: * + .byte %10010100 ; 0ED5 2-da: * * * + .byte %10011100 ; 0ED6 2-da: * *** + .byte %11111111 ; 0ED7 2-da: ******** + + .byte %11111111 ; 0ED8 2-db: ******** + .byte %11111111 ; 0ED9 2-db: ******** + .byte %10011001 ; 0EDA 2-db: * ** * + .byte %10000000 ; 0EDB 2-db: * + .byte %10000000 ; 0EDC 2-db: * + .byte %10010100 ; 0EDD 2-db: * * * + .byte %10011100 ; 0EDE 2-db: * *** + .byte %11111111 ; 0EDF 2-db: ******** + + .byte %11111111 ; 0EE0 2-dc: ******** + .byte %11111111 ; 0EE1 2-dc: ******** + .byte %10000011 ; 0EE2 2-dc: * ** + .byte %10011001 ; 0EE3 2-dc: * ** * + .byte %10011001 ; 0EE4 2-dc: * ** * + .byte %10011001 ; 0EE5 2-dc: * ** * + .byte %10011001 ; 0EE6 2-dc: * ** * + .byte %11111111 ; 0EE7 2-dc: ******** + + .byte %11111111 ; 0EE8 2-dd: ******** + .byte %11111111 ; 0EE9 2-dd: ******** + .byte %10000011 ; 0EEA 2-dd: * ** + .byte %10011001 ; 0EEB 2-dd: * ** * + .byte %10011001 ; 0EEC 2-dd: * ** * + .byte %10011001 ; 0EED 2-dd: * ** * + .byte %10011001 ; 0EEE 2-dd: * ** * + .byte %11111111 ; 0EEF 2-dd: ******** + + .byte %11111111 ; 0EF0 2-de: ******** + .byte %11111111 ; 0EF1 2-de: ******** + .byte %11000011 ; 0EF2 2-de: ** ** + .byte %10011001 ; 0EF3 2-de: * ** * + .byte %10011001 ; 0EF4 2-de: * ** * + .byte %10011001 ; 0EF5 2-de: * ** * + .byte %11000011 ; 0EF6 2-de: ** ** + .byte %11111111 ; 0EF7 2-de: ******** + + .byte %11111111 ; 0EF8 2-df: ******** + .byte %11111111 ; 0EF9 2-df: ******** + .byte %11000011 ; 0EFA 2-df: ** ** + .byte %10011001 ; 0EFB 2-df: * ** * + .byte %10011001 ; 0EFC 2-df: * ** * + .byte %10011001 ; 0EFD 2-df: * ** * + .byte %11000011 ; 0EFE 2-df: ** ** + .byte %11111111 ; 0EFF 2-df: ******** + + .byte %11111111 ; 0F00 2-e0: ******** + .byte %11111111 ; 0F01 2-e0: ******** + .byte %10000011 ; 0F02 2-e0: * ** + .byte %10011001 ; 0F03 2-e0: * ** * + .byte %10011001 ; 0F04 2-e0: * ** * + .byte %10000011 ; 0F05 2-e0: * ** + .byte %10011111 ; 0F06 2-e0: * ***** + .byte %10011111 ; 0F07 2-e0: * ***** + + .byte %11111111 ; 0F08 2-e1: ******** + .byte %11111111 ; 0F09 2-e1: ******** + .byte %10000011 ; 0F0A 2-e1: * ** + .byte %10011001 ; 0F0B 2-e1: * ** * + .byte %10011001 ; 0F0C 2-e1: * ** * + .byte %10000011 ; 0F0D 2-e1: * ** + .byte %10011111 ; 0F0E 2-e1: * ***** + .byte %10011111 ; 0F0F 2-e1: * ***** + + .byte %11111111 ; 0F10 2-e2: ******** + .byte %11111111 ; 0F11 2-e2: ******** + .byte %11000001 ; 0F12 2-e2: ** * + .byte %10011001 ; 0F13 2-e2: * ** * + .byte %10011001 ; 0F14 2-e2: * ** * + .byte %11000001 ; 0F15 2-e2: ** * + .byte %11111001 ; 0F16 2-e2: ***** * + .byte %11111001 ; 0F17 2-e2: ***** * + + .byte %11111111 ; 0F18 2-e3: ******** + .byte %11111111 ; 0F19 2-e3: ******** + .byte %11000001 ; 0F1A 2-e3: ** * + .byte %10011001 ; 0F1B 2-e3: * ** * + .byte %10011001 ; 0F1C 2-e3: * ** * + .byte %11000001 ; 0F1D 2-e3: ** * + .byte %11111001 ; 0F1E 2-e3: ***** * + .byte %11111001 ; 0F1F 2-e3: ***** * + + .byte %11111111 ; 0F20 2-e4: ******** + .byte %11111111 ; 0F21 2-e4: ******** + .byte %10000011 ; 0F22 2-e4: * ** + .byte %10011001 ; 0F23 2-e4: * ** * + .byte %10011111 ; 0F24 2-e4: * ***** + .byte %10011111 ; 0F25 2-e4: * ***** + .byte %10011111 ; 0F26 2-e4: * ***** + .byte %11111111 ; 0F27 2-e4: ******** + + .byte %11111111 ; 0F28 2-e5: ******** + .byte %11111111 ; 0F29 2-e5: ******** + .byte %10000011 ; 0F2A 2-e5: * ** + .byte %10011001 ; 0F2B 2-e5: * ** * + .byte %10011111 ; 0F2C 2-e5: * ***** + .byte %10011111 ; 0F2D 2-e5: * ***** + .byte %10011111 ; 0F2E 2-e5: * ***** + .byte %11111111 ; 0F2F 2-e5: ******** + + .byte %11111111 ; 0F30 2-e6: ******** + .byte %11111111 ; 0F31 2-e6: ******** + .byte %11000001 ; 0F32 2-e6: ** * + .byte %10011111 ; 0F33 2-e6: * ***** + .byte %11000011 ; 0F34 2-e6: ** ** + .byte %11111001 ; 0F35 2-e6: ***** * + .byte %10000011 ; 0F36 2-e6: * ** + .byte %11111111 ; 0F37 2-e6: ******** + + .byte %11111111 ; 0F38 2-e7: ******** + .byte %11111111 ; 0F39 2-e7: ******** + .byte %11000001 ; 0F3A 2-e7: ** * + .byte %10011111 ; 0F3B 2-e7: * ***** + .byte %11000011 ; 0F3C 2-e7: ** ** + .byte %11111001 ; 0F3D 2-e7: ***** * + .byte %10000011 ; 0F3E 2-e7: * ** + .byte %11111111 ; 0F3F 2-e7: ******** + + .byte %11111111 ; 0F40 2-e8: ******** + .byte %11100111 ; 0F41 2-e8: *** *** + .byte %10000001 ; 0F42 2-e8: * * + .byte %11100111 ; 0F43 2-e8: *** *** + .byte %11100111 ; 0F44 2-e8: *** *** + .byte %11100111 ; 0F45 2-e8: *** *** + .byte %11110001 ; 0F46 2-e8: **** * + .byte %11111111 ; 0F47 2-e8: ******** + + .byte %11111111 ; 0F48 2-e9: ******** + .byte %11100111 ; 0F49 2-e9: *** *** + .byte %10000001 ; 0F4A 2-e9: * * + .byte %11100111 ; 0F4B 2-e9: *** *** + .byte %11100111 ; 0F4C 2-e9: *** *** + .byte %11100111 ; 0F4D 2-e9: *** *** + .byte %11110001 ; 0F4E 2-e9: **** * + .byte %11111111 ; 0F4F 2-e9: ******** + + .byte %11111111 ; 0F50 2-ea: ******** + .byte %11111111 ; 0F51 2-ea: ******** + .byte %10011001 ; 0F52 2-ea: * ** * + .byte %10011001 ; 0F53 2-ea: * ** * + .byte %10011001 ; 0F54 2-ea: * ** * + .byte %10011001 ; 0F55 2-ea: * ** * + .byte %11000001 ; 0F56 2-ea: ** * + .byte %11111111 ; 0F57 2-ea: ******** + + .byte %11111111 ; 0F58 2-eb: ******** + .byte %11111111 ; 0F59 2-eb: ******** + .byte %10011001 ; 0F5A 2-eb: * ** * + .byte %10011001 ; 0F5B 2-eb: * ** * + .byte %10011001 ; 0F5C 2-eb: * ** * + .byte %10011001 ; 0F5D 2-eb: * ** * + .byte %11000001 ; 0F5E 2-eb: ** * + .byte %11111111 ; 0F5F 2-eb: ******** + + .byte %11111111 ; 0F60 2-ec: ******** + .byte %11111111 ; 0F61 2-ec: ******** + .byte %10011001 ; 0F62 2-ec: * ** * + .byte %10011001 ; 0F63 2-ec: * ** * + .byte %10011001 ; 0F64 2-ec: * ** * + .byte %11000011 ; 0F65 2-ec: ** ** + .byte %11100111 ; 0F66 2-ec: *** *** + .byte %11111111 ; 0F67 2-ec: ******** + + .byte %11111111 ; 0F68 2-ed: ******** + .byte %11111111 ; 0F69 2-ed: ******** + .byte %10011001 ; 0F6A 2-ed: * ** * + .byte %10011001 ; 0F6B 2-ed: * ** * + .byte %10011001 ; 0F6C 2-ed: * ** * + .byte %11000011 ; 0F6D 2-ed: ** ** + .byte %11100111 ; 0F6E 2-ed: *** *** + .byte %11111111 ; 0F6F 2-ed: ******** + + .byte %11111111 ; 0F70 2-ee: ******** + .byte %11111111 ; 0F71 2-ee: ******** + .byte %10011100 ; 0F72 2-ee: * *** + .byte %10010100 ; 0F73 2-ee: * * * + .byte %10000000 ; 0F74 2-ee: * + .byte %11000001 ; 0F75 2-ee: ** * + .byte %11001001 ; 0F76 2-ee: ** * * + .byte %11111111 ; 0F77 2-ee: ******** + + .byte %11111111 ; 0F78 2-ef: ******** + .byte %11111111 ; 0F79 2-ef: ******** + .byte %10011100 ; 0F7A 2-ef: * *** + .byte %10010100 ; 0F7B 2-ef: * * * + .byte %10000000 ; 0F7C 2-ef: * + .byte %11000001 ; 0F7D 2-ef: ** * + .byte %11001001 ; 0F7E 2-ef: ** * * + .byte %11111111 ; 0F7F 2-ef: ******** + + .byte %11111111 ; 0F80 2-f0: ******** + .byte %11111111 ; 0F81 2-f0: ******** + .byte %10011001 ; 0F82 2-f0: * ** * + .byte %11000011 ; 0F83 2-f0: ** ** + .byte %11100111 ; 0F84 2-f0: *** *** + .byte %11000011 ; 0F85 2-f0: ** ** + .byte %10011001 ; 0F86 2-f0: * ** * + .byte %11111111 ; 0F87 2-f0: ******** + + .byte %11111111 ; 0F88 2-f1: ******** + .byte %11111111 ; 0F89 2-f1: ******** + .byte %10011001 ; 0F8A 2-f1: * ** * + .byte %11000011 ; 0F8B 2-f1: ** ** + .byte %11100111 ; 0F8C 2-f1: *** *** + .byte %11000011 ; 0F8D 2-f1: ** ** + .byte %10011001 ; 0F8E 2-f1: * ** * + .byte %11111111 ; 0F8F 2-f1: ******** + + .byte %11111111 ; 0F90 2-f2: ******** + .byte %11111111 ; 0F91 2-f2: ******** + .byte %10011001 ; 0F92 2-f2: * ** * + .byte %10011001 ; 0F93 2-f2: * ** * + .byte %10011001 ; 0F94 2-f2: * ** * + .byte %11000001 ; 0F95 2-f2: ** * + .byte %11110011 ; 0F96 2-f2: **** ** + .byte %10000111 ; 0F97 2-f2: * *** + + .byte %11111111 ; 0F98 2-f3: ******** + .byte %11111111 ; 0F99 2-f3: ******** + .byte %10011001 ; 0F9A 2-f3: * ** * + .byte %10011001 ; 0F9B 2-f3: * ** * + .byte %10011001 ; 0F9C 2-f3: * ** * + .byte %11000001 ; 0F9D 2-f3: ** * + .byte %11110011 ; 0F9E 2-f3: **** ** + .byte %10000111 ; 0F9F 2-f3: * *** + + .byte %11111111 ; 0FA0 2-f4: ******** + .byte %11111111 ; 0FA1 2-f4: ******** + .byte %10000001 ; 0FA2 2-f4: * * + .byte %11110011 ; 0FA3 2-f4: **** ** + .byte %11100111 ; 0FA4 2-f4: *** *** + .byte %11001111 ; 0FA5 2-f4: ** **** + .byte %10000001 ; 0FA6 2-f4: * * + .byte %11111111 ; 0FA7 2-f4: ******** + + .byte %11111111 ; 0FA8 2-f5: ******** + .byte %11111111 ; 0FA9 2-f5: ******** + .byte %10000001 ; 0FAA 2-f5: * * + .byte %11110011 ; 0FAB 2-f5: **** ** + .byte %11100111 ; 0FAC 2-f5: *** *** + .byte %11001111 ; 0FAD 2-f5: ** **** + .byte %10000001 ; 0FAE 2-f5: * * + .byte %11111111 ; 0FAF 2-f5: ******** + + .byte %11100011 ; 0FB0 2-f6: *** ** + .byte %11001111 ; 0FB1 2-f6: ** **** + .byte %11100111 ; 0FB2 2-f6: *** *** + .byte %10001111 ; 0FB3 2-f6: * **** + .byte %11100111 ; 0FB4 2-f6: *** *** + .byte %11001111 ; 0FB5 2-f6: ** **** + .byte %11100011 ; 0FB6 2-f6: *** ** + .byte %11111111 ; 0FB7 2-f6: ******** + + .byte %11100011 ; 0FB8 2-f7: *** ** + .byte %11001111 ; 0FB9 2-f7: ** **** + .byte %11100111 ; 0FBA 2-f7: *** *** + .byte %10001111 ; 0FBB 2-f7: * **** + .byte %11100111 ; 0FBC 2-f7: *** *** + .byte %11001111 ; 0FBD 2-f7: ** **** + .byte %11100011 ; 0FBE 2-f7: *** ** + .byte %11111111 ; 0FBF 2-f7: ******** + + .byte %11100111 ; 0FC0 2-f8: *** *** + .byte %11100111 ; 0FC1 2-f8: *** *** + .byte %11100111 ; 0FC2 2-f8: *** *** + .byte %11111111 ; 0FC3 2-f8: ******** + .byte %11111111 ; 0FC4 2-f8: ******** + .byte %11100111 ; 0FC5 2-f8: *** *** + .byte %11100111 ; 0FC6 2-f8: *** *** + .byte %11100111 ; 0FC7 2-f8: *** *** + + .byte %11100111 ; 0FC8 2-f9: *** *** + .byte %11100111 ; 0FC9 2-f9: *** *** + .byte %11100111 ; 0FCA 2-f9: *** *** + .byte %11111111 ; 0FCB 2-f9: ******** + .byte %11111111 ; 0FCC 2-f9: ******** + .byte %11100111 ; 0FCD 2-f9: *** *** + .byte %11100111 ; 0FCE 2-f9: *** *** + .byte %11100111 ; 0FCF 2-f9: *** *** + + .byte %11000111 ; 0FD0 2-fa: ** *** + .byte %11110011 ; 0FD1 2-fa: **** ** + .byte %11100111 ; 0FD2 2-fa: *** *** + .byte %11110001 ; 0FD3 2-fa: **** * + .byte %11100111 ; 0FD4 2-fa: *** *** + .byte %11110011 ; 0FD5 2-fa: **** ** + .byte %11000111 ; 0FD6 2-fa: ** *** + .byte %11111111 ; 0FD7 2-fa: ******** + + .byte %11000111 ; 0FD8 2-fb: ** *** + .byte %11110011 ; 0FD9 2-fb: **** ** + .byte %11100111 ; 0FDA 2-fb: *** *** + .byte %11110001 ; 0FDB 2-fb: **** * + .byte %11100111 ; 0FDC 2-fb: *** *** + .byte %11110011 ; 0FDD 2-fb: **** ** + .byte %11000111 ; 0FDE 2-fb: ** *** + .byte %11111111 ; 0FDF 2-fb: ******** + + .byte %11001100 ; 0FE0 2-fc: ** ** + .byte %00000000 ; 0FE1 2-fc: + .byte %00110011 ; 0FE2 2-fc: ** ** + .byte %11111111 ; 0FE3 2-fc: ******** + .byte %11111111 ; 0FE4 2-fc: ******** + .byte %11111111 ; 0FE5 2-fc: ******** + .byte %11111111 ; 0FE6 2-fc: ******** + .byte %11111111 ; 0FE7 2-fc: ******** + + .byte %11001100 ; 0FE8 2-fd: ** ** + .byte %00000000 ; 0FE9 2-fd: + .byte %00110011 ; 0FEA 2-fd: ** ** + .byte %11111111 ; 0FEB 2-fd: ******** + .byte %11111111 ; 0FEC 2-fd: ******** + .byte %11111111 ; 0FED 2-fd: ******** + .byte %11111111 ; 0FEE 2-fd: ******** + .byte %11111111 ; 0FEF 2-fd: ******** + + .byte %11111111 ; 0FF0 2-fe: ******** + .byte %11111111 ; 0FF1 2-fe: ******** + .byte %11111111 ; 0FF2 2-fe: ******** + .byte %11111111 ; 0FF3 2-fe: ******** + .byte %11111111 ; 0FF4 2-fe: ******** + .byte %11111111 ; 0FF5 2-fe: ******** + .byte %11111111 ; 0FF6 2-fe: ******** + .byte %11111111 ; 0FF7 2-fe: ******** + + .byte %11111111 ; 0FF8 2-ff: ******** + .byte %11111111 ; 0FF9 2-ff: ******** + .byte %11111111 ; 0FFA 2-ff: ******** + .byte %11111111 ; 0FFB 2-ff: ******** + .byte %11111111 ; 0FFC 2-ff: ******** + .byte %11111111 ; 0FFD 2-ff: ******** + .byte %11111111 ; 0FFE 2-ff: ******** + .byte %11111111 ; 0FFF 2-ff: ******** diff --git a/libsrc/nes/ppu.s b/libsrc/nes/ppu.s index 344a1071a..06dc10a65 100644 --- a/libsrc/nes/ppu.s +++ b/libsrc/nes/ppu.s @@ -3,130 +3,130 @@ ; Cleanup by Ullrich von Bassewitz ; - .export ppuinit - .export paletteinit, paldata + .export ppuinit + .export paletteinit, paldata - .include "nes.inc" + .include "nes.inc" ;+---------+----------------------------------------------------------+ -;| $2000 | PPU Control Register #1 (W) | -;| | | -;| | D7: Execute NMI on VBlank | -;| | 0 = Disabled | -;| | 1 = Enabled | -;| | D6: PPU Master/Slave Selection --+ | -;| | 0 = Master +-- UNUSED | -;| | 1 = Slave --+ | -;| | D5: Sprite Size | -;| | 0 = 8x8 | -;| | 1 = 8x16 | -;| | D4: Background Pattern Table Address | -;| | 0 = $0000 (VRAM) | -;| | 1 = $1000 (VRAM) | -;| | D3: Sprite Pattern Table Address | -;| | 0 = $0000 (VRAM) | -;| | 1 = $1000 (VRAM) | -;| | D2: PPU Address Increment | -;| | 0 = Increment by 1 | -;| | 1 = Increment by 32 | -;| | D1-D0: Name Table Address | -;| | 00 = $2000 (VRAM) | -;| | 01 = $2400 (VRAM) | -;| | 10 = $2800 (VRAM) | -;| | 11 = $2C00 (VRAM) | +;| $2000 | PPU Control Register #1 (W) | +;| | | +;| | D7: Execute NMI on VBlank | +;| | 0 = Disabled | +;| | 1 = Enabled | +;| | D6: PPU Master/Slave Selection --+ | +;| | 0 = Master +-- UNUSED | +;| | 1 = Slave --+ | +;| | D5: Sprite Size | +;| | 0 = 8x8 | +;| | 1 = 8x16 | +;| | D4: Background Pattern Table Address | +;| | 0 = $0000 (VRAM) | +;| | 1 = $1000 (VRAM) | +;| | D3: Sprite Pattern Table Address | +;| | 0 = $0000 (VRAM) | +;| | 1 = $1000 (VRAM) | +;| | D2: PPU Address Increment | +;| | 0 = Increment by 1 | +;| | 1 = Increment by 32 | +;| | D1-D0: Name Table Address | +;| | 00 = $2000 (VRAM) | +;| | 01 = $2400 (VRAM) | +;| | 10 = $2800 (VRAM) | +;| | 11 = $2C00 (VRAM) | ;+---------+----------------------------------------------------------+ ;+---------+----------------------------------------------------------+ -;| $2001 | PPU Control Register #2 (W) | -;| | | -;| | D7-D5: Full Background Colour (when D0 == 1) | -;| | 000 = None +------------+ | -;| | 001 = Green | NOTE: Do not use more | -;| | 010 = Blue | than one type | -;| | 100 = Red +------------+ | -;| | D7-D5: Colour Intensity (when D0 == 0) | -;| | 000 = None +--+ | -;| | 001 = Intensify green | NOTE: Do not use more | -;| | 010 = Intensify blue | than one type | -;| | 100 = Intensify red +--+ | -;| | D4: Sprite Visibility | -;| | 0 = Sprites not displayed | -;| | 1 = Sprites visible | -;| | D3: Background Visibility | -;| | 0 = Background not displayed | -;| | 1 = Background visible | -;| | D2: Sprite Clipping | -;| | 0 = Sprites invisible in left 8-pixel column | -;| | 1 = No clipping | -;| | D1: Background Clipping | -;| | 0 = BG invisible in left 8-pixel column | -;| | 1 = No clipping | -;| | D0: Display Type | -;| | 0 = Colour display | -;| | 1 = Monochrome display | +;| $2001 | PPU Control Register #2 (W) | +;| | | +;| | D7-D5: Full Background Colour (when D0 == 1) | +;| | 000 = None +------------+ | +;| | 001 = Green | NOTE: Do not use more | +;| | 010 = Blue | than one type | +;| | 100 = Red +------------+ | +;| | D7-D5: Colour Intensity (when D0 == 0) | +;| | 000 = None +--+ | +;| | 001 = Intensify green | NOTE: Do not use more | +;| | 010 = Intensify blue | than one type | +;| | 100 = Intensify red +--+ | +;| | D4: Sprite Visibility | +;| | 0 = Sprites not displayed | +;| | 1 = Sprites visible | +;| | D3: Background Visibility | +;| | 0 = Background not displayed | +;| | 1 = Background visible | +;| | D2: Sprite Clipping | +;| | 0 = Sprites invisible in left 8-pixel column | +;| | 1 = No clipping | +;| | D1: Background Clipping | +;| | 0 = BG invisible in left 8-pixel column | +;| | 1 = No clipping | +;| | D0: Display Type | +;| | 0 = Colour display | +;| | 1 = Monochrome display | ;+---------+----------------------------------------------------------+ ;----------------------------------------------------------------------------- -.proc ppuinit +.proc ppuinit - lda #%10101000 - sta PPU_CTRL1 + lda #%10101000 + sta PPU_CTRL1 - lda #%00011110 - sta PPU_CTRL2 + lda #%00011110 + sta PPU_CTRL2 ; Wait for vblank -@wait: lda PPU_STATUS - bpl @wait +@wait: lda PPU_STATUS + bpl @wait ; reset scrolling - lda #0 - sta PPU_VRAM_ADDR1 - sta PPU_VRAM_ADDR1 + lda #0 + sta PPU_VRAM_ADDR1 + sta PPU_VRAM_ADDR1 ; Make all sprites invisible - lda #$00 - ldy #$f0 - sta PPU_SPR_ADDR - ldx #$40 -@loop: sty PPU_SPR_IO - sta PPU_SPR_IO - sta PPU_SPR_IO - sty PPU_SPR_IO - dex - bne @loop + lda #$00 + ldy #$f0 + sta PPU_SPR_ADDR + ldx #$40 +@loop: sty PPU_SPR_IO + sta PPU_SPR_IO + sta PPU_SPR_IO + sty PPU_SPR_IO + dex + bne @loop - rts + rts .endproc ;----------------------------------------------------------------------------- -.proc paletteinit +.proc paletteinit ; Wait for v-blank -@wait: lda PPU_STATUS - bpl @wait +@wait: lda PPU_STATUS + bpl @wait - lda #$3F - sta PPU_VRAM_ADDR2 - lda #$00 - sta PPU_VRAM_ADDR2 + lda #$3F + sta PPU_VRAM_ADDR2 + lda #$00 + sta PPU_VRAM_ADDR2 - ldx #0 -@loop: lda paldata,x - sta PPU_VRAM_IO - inx - cpx #(16*2) - bne @loop + ldx #0 +@loop: lda paldata,x + sta PPU_VRAM_IO + inx + cpx #(16*2) + bne @loop - rts - + rts + .endproc ;----------------------------------------------------------------------------- @@ -134,24 +134,24 @@ .rodata paldata: - .repeat 2 - .byte $0f ; 0 black - .byte $14 ; 4 violett - .byte $3b ; 3 cyan - .byte $3d ; 1 white + .repeat 2 + .byte $0f ; 0 black + .byte $14 ; 4 violett + .byte $3b ; 3 cyan + .byte $3d ; 1 white - .byte $38 ; 7 yellow - .byte $2d ; b dark grey - .byte $22 ; e light blue - .byte $04 ; 2 red + .byte $38 ; 7 yellow + .byte $2d ; b dark grey + .byte $22 ; e light blue + .byte $04 ; 2 red - .byte $18 ; 8 orange - .byte $08 ; 9 brown - .byte $35 ; a light red - .byte $01 ; 6 blue + .byte $18 ; 8 orange + .byte $08 ; 9 brown + .byte $35 ; a light red + .byte $01 ; 6 blue - .byte $10 ; c middle grey - .byte $2b ; d light green - .byte $3d ; f light gray - .byte $1a ; 5 green - .endrepeat + .byte $10 ; c middle grey + .byte $2b ; d light green + .byte $3d ; f light gray + .byte $1a ; 5 green + .endrepeat diff --git a/libsrc/nes/ppubuf.s b/libsrc/nes/ppubuf.s index 68f194e78..3708b93c1 100644 --- a/libsrc/nes/ppubuf.s +++ b/libsrc/nes/ppubuf.s @@ -20,8 +20,8 @@ @wait: lda ringcount - bne @wait - rts + bne @wait + rts .endproc @@ -34,8 +34,8 @@ lda #$ff ; (($0100/3)*1) @wait: cmp ringcount - beq @wait - rts + beq @wait + rts .endproc diff --git a/libsrc/nes/randomize.s b/libsrc/nes/randomize.s index 8336b17c6..8df4fb88a 100644 --- a/libsrc/nes/randomize.s +++ b/libsrc/nes/randomize.s @@ -5,10 +5,10 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand - .include "nes.inc" + .include "nes.inc" __randomize: ldx tickcount ; Use tick clock diff --git a/libsrc/nes/revers.s b/libsrc/nes/revers.s index 32144c9e2..3f74db087 100644 --- a/libsrc/nes/revers.s +++ b/libsrc/nes/revers.s @@ -4,24 +4,24 @@ ; unsigned char revers (unsigned char onoff); ; - .export _revers + .export _revers .include "nes.inc" .proc _revers - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value - ldy #$00 ; Assume old value is zero -L1: lda RVS ; Load old value - stx RVS ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value + ldy #$00 ; Assume old value is zero +L1: lda RVS ; Load old value + stx RVS ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts .endproc diff --git a/libsrc/nes/setcursor.s b/libsrc/nes/setcursor.s index a3cca1030..c73a3441c 100644 --- a/libsrc/nes/setcursor.s +++ b/libsrc/nes/setcursor.s @@ -4,22 +4,22 @@ ; ; Set the cursor position - .export setcursor + .export setcursor - .include "nes.inc" + .include "nes.inc" ;----------------------------------------------------------------------------- .proc setcursor - tya - clc - adc addrlo,x - sta SCREEN_PTR + tya + clc + adc addrlo,x + sta SCREEN_PTR - lda addrhi,x - adc #0 - sta SCREEN_PTR+1 + lda addrhi,x + adc #0 + sta SCREEN_PTR+1 rts .endproc @@ -28,10 +28,10 @@ ; Tables with screen addresses addrlo: .repeat screenrows,line - .byte <($2000+((1*32))+(line*charsperline)) - .endrepeat + .byte <($2000+((1*32))+(line*charsperline)) + .endrepeat addrhi: .repeat screenrows,line - .byte >($2000+((1*32))+(line*charsperline)) - .endrepeat + .byte >($2000+((1*32))+(line*charsperline)) + .endrepeat diff --git a/libsrc/nes/tgi/nes-64-56-2.s b/libsrc/nes/tgi/nes-64-56-2.s index f41e63d88..cce83e231 100644 --- a/libsrc/nes/tgi/nes-64-56-2.s +++ b/libsrc/nes/tgi/nes-64-56-2.s @@ -5,59 +5,59 @@ ; Based on Maciej Witkowiak's line routine. ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "tgi-kernel.inc" - .include "tgi-error.inc" - .include "nes.inc" - .include "get_tv.inc" - .import _clrscr, setcursor, putchar - .import paldata + .include "tgi-kernel.inc" + .include "tgi-error.inc" + .include "nes.inc" + .include "get_tv.inc" + .import _clrscr, setcursor, putchar + .import paldata - .macpack generic + .macpack generic ; ------------------------------------------------------------------------ ; Header. Includes jump table and constants. -.segment "JUMPTABLE" +.segment "JUMPTABLE" ; First part of the header is a structure that has a magic and defines the ; capabilities of the driver - .byte $74, $67, $69 ; "tgi" - .byte TGI_API_VERSION ; TGI API version number -xres: .word charsperline*2 ; Max X resolution -yres: .word 56 ; Max Y resolution - .byte 2 ; Number of drawing colors - .byte 1 ; Number of screens available - .byte 2 ; System font X size - .byte 2 ; System font Y size - .word $100 ; Aspect ratio - .byte 0 ; TGI driver flags + .byte $74, $67, $69 ; "tgi" + .byte TGI_API_VERSION ; TGI API version number +xres: .word charsperline*2 ; Max X resolution +yres: .word 56 ; Max Y resolution + .byte 2 ; Number of drawing colors + .byte 1 ; Number of screens available + .byte 2 ; System font X size + .byte 2 ; System font Y size + .word $100 ; Aspect ratio + .byte 0 ; TGI driver flags ; Next comes the jump table. Currently all entries must be valid and may point ; to an RTS for test versions (function not implemented). - .addr INSTALL - .addr UNINSTALL - .addr INIT - .addr DONE - .addr GETERROR - .addr CONTROL - .addr CLEAR - .addr SETVIEWPAGE - .addr SETDRAWPAGE - .addr SETCOLOR - .addr SETPALETTE - .addr GETPALETTE - .addr GETDEFPALETTE - .addr SETPIXEL - .addr GETPIXEL - .addr LINE - .addr BAR - .addr TEXTSTYLE - .addr OUTTEXT - .addr 0 ; IRQ entry is unused + .addr INSTALL + .addr UNINSTALL + .addr INIT + .addr DONE + .addr GETERROR + .addr CONTROL + .addr CLEAR + .addr SETVIEWPAGE + .addr SETDRAWPAGE + .addr SETCOLOR + .addr SETPALETTE + .addr GETPALETTE + .addr GETDEFPALETTE + .addr SETPIXEL + .addr GETPIXEL + .addr LINE + .addr BAR + .addr TEXTSTYLE + .addr OUTTEXT + .addr 0 ; IRQ entry is unused ; ------------------------------------------------------------------------ ; Data. @@ -65,57 +65,57 @@ yres: .word 56 ; Max Y resolution ; Variables mapped to the zero page segment variables. Some of these are ; used for passing parameters to the driver. -X1 = ptr1 -Y1 = ptr2 -X2 = ptr3 -Y2 = ptr4 -RADIUS = tmp1 +X1 = ptr1 +Y1 = ptr2 +X2 = ptr3 +Y2 = ptr4 +RADIUS = tmp1 -ADDR = tmp1 -TEMP = tmp3 -TEMP2 = tmp4 -TEMP3 = sreg -TEMP4 = sreg+1 +ADDR = tmp1 +TEMP = tmp3 +TEMP2 = tmp4 +TEMP3 = sreg +TEMP4 = sreg+1 ; Line routine stuff (must be on zpage) -PB = ptr3 ; (2) LINE -UB = ptr4 ; (2) LINE -ERR = regsave ; (2) LINE -NX = regsave+2 ; (2) LINE +PB = ptr3 ; (2) LINE +UB = ptr4 ; (2) LINE +ERR = regsave ; (2) LINE +NX = regsave+2 ; (2) LINE ; Absolute variables used in the code .bss -MEM: .res charsperline*2*56/4 +MEM: .res charsperline*2*56/4 MEMEND: -ERROR: .res 1 ; Error code -COLOR: .res 1 ; Current color -PALETTE: .res 2 ; The current palette +ERROR: .res 1 ; Error code +COLOR: .res 1 ; Current color +PALETTE: .res 2 ; The current palette ; Line routine stuff OGora: -COUNT: .res 2 +COUNT: .res 2 OUkos: -NY: .res 2 +NY: .res 2 Y3: -DX: .res 1 -DY: .res 1 -AY: .res 1 +DX: .res 1 +DY: .res 1 +AY: .res 1 ; Constants and tables .rodata -DEFPALETTE: .byte $0, $1 -OFFSET: .byte 8, 4, 2, 1 -; 00 00 00 00 01 01 01 01 -; 00 01 10 11 00 01 10 11 -CODE: .byte 32, 29, 26, 25, 28, 24+128, 31+128, 30+128 -; 10 10 10 10 11 11 11 11 -; 00 01 10 11 00 01 10 11 - .byte 30, 31, 24, 28+128, 25+128, 26+128, 29+128, 32+128 +DEFPALETTE: .byte $0, $1 +OFFSET: .byte 8, 4, 2, 1 +; 00 00 00 00 01 01 01 01 +; 00 01 10 11 00 01 10 11 +CODE: .byte 32, 29, 26, 25, 28, 24+128, 31+128, 30+128 +; 10 10 10 10 11 11 11 11 +; 00 01 10 11 00 01 10 11 + .byte 30, 31, 24, 28+128, 25+128, 26+128, 29+128, 32+128 .code @@ -128,13 +128,13 @@ CODE: .byte 32, 29, 26, 25, 28, 24+128, 31+128, 30+128 ; INSTALL: - jsr _get_tv - cmp #TV::NTSC - beq ntsc + jsr _get_tv + cmp #TV::NTSC + beq ntsc ; TODO ROM! - inc yres - inc yres -ntsc:; rts + inc yres + inc yres +ntsc:; rts ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. May @@ -144,7 +144,7 @@ ntsc:; rts ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ ; INIT: Changes an already installed device from text mode to graphics @@ -164,9 +164,9 @@ INIT: ; Done, reset the error code - lda #TGI_ERR_OK - sta ERROR -; rts + lda #TGI_ERR_OK + sta ERROR +; rts ; ------------------------------------------------------------------------ ; DONE: Will be called to switch the graphics device back into text mode. @@ -177,16 +177,16 @@ INIT: ; DONE: - rts + rts ; ------------------------------------------------------------------------ ; GETERROR: Return the error code in A and clear it. GETERROR: - lda ERROR - ldx #TGI_ERR_OK - stx ERROR - rts + lda ERROR + ldx #TGI_ERR_OK + stx ERROR + rts ; ------------------------------------------------------------------------ ; CONTROL: Platform/driver specific entry point. @@ -195,9 +195,9 @@ GETERROR: ; CONTROL: - lda #TGI_ERR_INV_FUNC - sta ERROR - rts + lda #TGI_ERR_INV_FUNC + sta ERROR + rts ; ------------------------------------------------------------------------ ; CLEAR: Clears the screen. @@ -206,20 +206,20 @@ CONTROL: ; CLEAR: - ldx #MEM - stx TEMP+1 - lda #0 - tay -@L1: sta (TEMP),y - iny - bne @L1 - inc TEMP+1 - inx - cpx #>MEMEND - bne @L1 - jmp _clrscr + ldx #MEM + stx TEMP+1 + lda #0 + tay +@L1: sta (TEMP),y + iny + bne @L1 + inc TEMP+1 + inx + cpx #>MEMEND + bne @L1 + jmp _clrscr ; ------------------------------------------------------------------------ ; SETCOLOR: Set the drawing color (in A). The new color is already checked @@ -229,8 +229,8 @@ CLEAR: ; SETCOLOR: - sta COLOR -; rts + sta COLOR +; rts ; ------------------------------------------------------------------------ ; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n). @@ -249,7 +249,7 @@ SETVIEWPAGE: ; SETDRAWPAGE: - rts + rts ; ------------------------------------------------------------------------ ; SETPALETTE: Set the palette (not available with all drivers/hardware). @@ -261,31 +261,31 @@ SETDRAWPAGE: SETPALETTE: ; Wait for v-blank -@wait: lda PPU_STATUS - bpl @wait +@wait: lda PPU_STATUS + bpl @wait - lda #$3F - sta PPU_VRAM_ADDR2 - lda #$00 - sta PPU_VRAM_ADDR2 + lda #$3F + sta PPU_VRAM_ADDR2 + lda #$00 + sta PPU_VRAM_ADDR2 - ldy #0 - lda (ptr1),y - sta PALETTE - tax - lda paldata,x -; sta PPU_VRAM_IO + ldy #0 + lda (ptr1),y + sta PALETTE + tax + lda paldata,x +; sta PPU_VRAM_IO - iny - lda (ptr1),y - sta PALETTE+1 - tax - lda paldata,x - sta PPU_VRAM_IO + iny + lda (ptr1),y + sta PALETTE+1 + tax + lda paldata,x + sta PPU_VRAM_IO - lda #TGI_ERR_OK - sta ERROR - rts + lda #TGI_ERR_OK + sta ERROR + rts ; ------------------------------------------------------------------------ ; GETPALETTE: Return the current palette in A/X. Even drivers that cannot @@ -296,9 +296,9 @@ SETPALETTE: ; GETPALETTE: - lda #PALETTE - rts + lda #PALETTE + rts ; ------------------------------------------------------------------------ ; GETDEFPALETTE: Return the default palette for the driver in A/X. All @@ -310,9 +310,9 @@ GETPALETTE: ; GETDEFPALETTE: - lda #DEFPALETTE - rts + lda #DEFPALETTE + rts ; ------------------------------------------------------------------------ ; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing @@ -323,41 +323,41 @@ GETDEFPALETTE: ; SETPIXEL: - ldx Y1 ; y+2= 0) && (X1 < XRES) -; (X2 >= 0) && (X2 < XRES) -; (Y1 >= 0) && (Y1 < YRES) -; (Y2 >= 0) && (Y2 < YRES) +; X1 <= X2 +; Y1 <= Y2 +; (X1 >= 0) && (X1 < XRES) +; (X2 >= 0) && (X2 < XRES) +; (Y1 >= 0) && (Y1 < YRES) +; (Y2 >= 0) && (Y2 < YRES) ; ; Must set an error code: NO ; BAR: - inc Y2 -@L1: lda X1 - pha -@L2: jsr SETPIXEL - inc X1 - lda X2 - cmp X1 - bne @L2 - pla - sta X1 - inc Y1 - lda Y2 - cmp Y1 - bne @L1 - rts + inc Y2 +@L1: lda X1 + pha +@L2: jsr SETPIXEL + inc X1 + lda X2 + cmp X1 + bne @L2 + pla + sta X1 + inc Y1 + lda Y2 + cmp Y1 + bne @L1 + rts ; ------------------------------------------------------------------------ ; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y @@ -416,7 +416,7 @@ BAR: ; TEXTSTYLE: - rts + rts ; ------------------------------------------------------------------------ ; OUTTEXT: Output text at X/Y = ptr1/ptr2 using the current color and the @@ -427,68 +427,68 @@ TEXTSTYLE: ; OUTTEXT: - lda ptr1 - lsr - tay - lda ptr2 - lsr - tax - clc - jsr setcursor - ldy #0 -@L1: lda (ptr3),y - jsr putchar - iny - cmp #$0 - bne @L1 - rts + lda ptr1 + lsr + tay + lda ptr2 + lsr + tax + clc + jsr setcursor + ldy #0 +@L1: lda (ptr3),y + jsr putchar + iny + cmp #$0 + bne @L1 + rts ; ------------------------------------------------------------------------ ; Calculate all variables to plot the pixel at X1/Y1. If the point is out ; of range, a carry is returned and INRANGE is set to a value !0 zero. If ; the coordinates are valid, INRANGE is zero and the carry clear. -CALC: lda xres - sta TEMP - lda #0 - sta TEMP+1 - ldy Y1 -@L1: lda TEMP - add xres - lsr - sta TEMP - lda TEMP+1 - adc #0 - lsr - sta TEMP+1 - dey - bne @L1 - lda TEMP - add X1 - lsr - sta TEMP - lda TEMP+1 - adc #0 - lsr - sta TEMP+1 - lda TEMP - add #MEM - sta TEMP+1 +CALC: lda xres + sta TEMP + lda #0 + sta TEMP+1 + ldy Y1 +@L1: lda TEMP + add xres + lsr + sta TEMP + lda TEMP+1 + adc #0 + lsr + sta TEMP+1 + dey + bne @L1 + lda TEMP + add X1 + lsr + sta TEMP + lda TEMP+1 + adc #0 + lsr + sta TEMP+1 + lda TEMP + add #MEM + sta TEMP+1 - lda X1 - and #%00000001 - sta TEMP3 - lda Y1 - asl - and #%00000010 - ora TEMP3 - tax - lda OFFSET,x - rts + lda X1 + and #%00000001 + sta TEMP3 + lda Y1 + asl + and #%00000010 + ora TEMP3 + tax + lda OFFSET,x + rts ; ------------------------------------------------------------------------ -.include "../../tgi/tgidrv_line.inc" +.include "../../tgi/tgidrv_line.inc" diff --git a/libsrc/nes/tgi_colors.s b/libsrc/nes/tgi_colors.s index 4dab483e2..6ef3729b4 100644 --- a/libsrc/nes/tgi_colors.s +++ b/libsrc/nes/tgi_colors.s @@ -2,7 +2,7 @@ ; Target-specific black & white values for use by the target-shared TGI kernel ; - .include "tgi-kernel.inc" + .include "tgi-kernel.inc" - .export tgi_color_black:zp = $00 - .export tgi_color_white:zp = $01 + .export tgi_color_black:zp = $00 + .export tgi_color_white:zp = $01 diff --git a/libsrc/nes/tgi_stat_stddrv.s b/libsrc/nes/tgi_stat_stddrv.s index 797d24494..9b08bc460 100644 --- a/libsrc/nes/tgi_stat_stddrv.s +++ b/libsrc/nes/tgi_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void tgi_static_stddrv[]; ; - .export _tgi_static_stddrv - .import _nes_64_56_2_tgi + .export _tgi_static_stddrv + .import _nes_64_56_2_tgi .rodata diff --git a/libsrc/nes/tgi_stddrv.s b/libsrc/nes/tgi_stddrv.s index 25f00f803..b0239e276 100644 --- a/libsrc/nes/tgi_stddrv.s +++ b/libsrc/nes/tgi_stddrv.s @@ -6,8 +6,8 @@ ; const char tgi_stddrv[]; ; - .export _tgi_stddrv + .export _tgi_stddrv .rodata -_tgi_stddrv: .asciiz "nes-64-56-2.tgi" +_tgi_stddrv: .asciiz "nes-64-56-2.tgi" diff --git a/libsrc/nes/waitvblank.s b/libsrc/nes/waitvblank.s index 373a84629..408646904 100644 --- a/libsrc/nes/waitvblank.s +++ b/libsrc/nes/waitvblank.s @@ -5,9 +5,9 @@ ; void waitvblank(void); ; - .export _waitvblank + .export _waitvblank - .include "nes.inc" + .include "nes.inc" .proc _waitvblank diff --git a/libsrc/nes/wherex.s b/libsrc/nes/wherex.s index 347d1fdbe..2082c73f6 100644 --- a/libsrc/nes/wherex.s +++ b/libsrc/nes/wherex.s @@ -4,7 +4,7 @@ ; unsigned char wherex (void); ; - .export _wherex + .export _wherex .include "nes.inc" @@ -12,7 +12,7 @@ lda CURS_X ldx #$00 - rts + rts .endproc diff --git a/libsrc/nes/wherey.s b/libsrc/nes/wherey.s index af6ead4b6..46813b923 100644 --- a/libsrc/nes/wherey.s +++ b/libsrc/nes/wherey.s @@ -4,7 +4,7 @@ ; unsigned char wherey (void); ; - .export _wherey + .export _wherey .include "nes.inc" @@ -12,7 +12,7 @@ lda CURS_Y ldx #$00 - rts + rts .endproc diff --git a/libsrc/pet/_scrsize.s b/libsrc/pet/_scrsize.s index ef8b4c56b..b2ba92b98 100644 --- a/libsrc/pet/_scrsize.s +++ b/libsrc/pet/_scrsize.s @@ -4,16 +4,16 @@ ; Screen size variables ; - .export screensize + .export screensize - .include "pet.inc" + .include "pet.inc" .proc screensize - ldx SCR_LINELEN - inx ; Variable is one less - ldy #25 - rts + ldx SCR_LINELEN + inx ; Variable is one less + ldy #25 + rts .endproc diff --git a/libsrc/pet/break.s b/libsrc/pet/break.s index 7d31c679d..49585ffef 100644 --- a/libsrc/pet/break.s +++ b/libsrc/pet/break.s @@ -5,65 +5,65 @@ ; void reset_brk (void); ; - .export _set_brk, _reset_brk - .destructor _reset_brk - .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc + .export _set_brk, _reset_brk + .destructor _reset_brk + .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc - .include "pet.inc" + .include "pet.inc" .bss -_brk_a: .res 1 -_brk_x: .res 1 -_brk_y: .res 1 -_brk_sr: .res 1 -_brk_pc: .res 2 +_brk_a: .res 1 +_brk_x: .res 1 +_brk_y: .res 1 +_brk_sr: .res 1 +_brk_pc: .res 2 -oldvec: .res 2 ; Old vector +oldvec: .res 2 ; Old vector .data -uservec: jmp $FFFF ; Patched at runtime +uservec: jmp $FFFF ; Patched at runtime .code ; Set the break vector -.proc _set_brk +.proc _set_brk - sta uservec+1 - stx uservec+2 ; Set the user vector + sta uservec+1 + stx uservec+2 ; Set the user vector - lda oldvec - ora oldvec+1 ; Did we save the vector already? - bne L1 ; Jump if we installed the handler already + lda oldvec + ora oldvec+1 ; Did we save the vector already? + bne L1 ; Jump if we installed the handler already - lda BRKVec - sta oldvec - lda BRKVec+1 - sta oldvec+1 ; Save the old vector + lda BRKVec + sta oldvec + lda BRKVec+1 + sta oldvec+1 ; Save the old vector -L1: lda #brk_handler - sta BRKVec - stx BRKVec+1 - rts +L1: lda #brk_handler + sta BRKVec + stx BRKVec+1 + rts .endproc ; Reset the break vector -.proc _reset_brk +.proc _reset_brk - lda oldvec - ldx oldvec+1 - beq @L9 ; Jump if vector not installed - sta BRKVec - stx BRKVec+1 - lda #$00 - sta oldvec ; Clear the old vector - stx oldvec+1 -@L9: rts + lda oldvec + ldx oldvec+1 + beq @L9 ; Jump if vector not installed + sta BRKVec + stx BRKVec+1 + lda #$00 + sta oldvec ; Clear the old vector + stx oldvec+1 +@L9: rts .endproc @@ -71,37 +71,37 @@ L1: lda #IRQStub - jmp setvec + lda IRQVec + ldx IRQVec+1 + sta IRQInd+1 + stx IRQInd+2 + lda #IRQStub + jmp setvec ; ------------------------------------------------------------------------ .code doneirq: - lda IRQInd+1 - ldx IRQInd+2 -setvec: sei - sta IRQVec - stx IRQVec+1 - cli - rts + lda IRQInd+1 + ldx IRQInd+2 +setvec: sei + sta IRQVec + stx IRQVec+1 + cli + rts ; ------------------------------------------------------------------------ -.segment "LOWCODE" +.segment "LOWCODE" IRQStub: - cld ; Just to be sure - jsr callirq ; Call the functions - jmp IRQInd ; Jump to the saved IRQ vector + cld ; Just to be sure + jsr callirq ; Call the functions + jmp IRQInd ; Jump to the saved IRQ vector ; ------------------------------------------------------------------------ .data -IRQInd: jmp $0000 +IRQInd: jmp $0000 diff --git a/libsrc/pet/joy/pet-ptvjoy.s b/libsrc/pet/joy/pet-ptvjoy.s index 85d2097ce..997352f06 100644 --- a/libsrc/pet/joy/pet-ptvjoy.s +++ b/libsrc/pet/joy/pet-ptvjoy.s @@ -6,47 +6,47 @@ ; obviously based on Ullrichs driver :) ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" - .include "joy-error.inc" -; .include "pet.inc" -VIA_PRA := $E841 ; Port register A -VIA_DDRA := $E843 ; Data direction register A + .include "joy-kernel.inc" + .include "joy-error.inc" +; .include "pet.inc" +VIA_PRA := $E841 ; Port register A +VIA_DDRA := $E843 ; Data direction register A ; ------------------------------------------------------------------------ ; Header. Includes jump table - .segment "JUMPTABLE" + .segment "JUMPTABLE" ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) - .byte $01 ; JOY_UP - .byte $02 ; JOY_DOWN - .byte $04 ; JOY_LEFT - .byte $08 ; JOY_RIGHT - .byte $10 ; JOY_FIRE - .byte $00 ; JOY_FIRE2 unavailable - .byte $00 ; Future expansion - .byte $00 ; Future expansion + .byte $01 ; JOY_UP + .byte $02 ; JOY_DOWN + .byte $04 ; JOY_LEFT + .byte $08 ; JOY_RIGHT + .byte $10 ; JOY_FIRE + .byte $00 ; JOY_FIRE2 unavailable + .byte $00 ; Future expansion + .byte $00 ; Future expansion ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr COUNT - .addr READ - .addr 0 ; IRQ entry unused + .addr INSTALL + .addr UNINSTALL + .addr COUNT + .addr READ + .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants -JOY_COUNT = 2 ; Number of joysticks we support +JOY_COUNT = 2 ; Number of joysticks we support .code @@ -59,9 +59,9 @@ JOY_COUNT = 2 ; Number of joysticks we support ; INSTALL: - lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead + lda #JOY_ERR_OK +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -69,7 +69,7 @@ INSTALL: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ @@ -77,44 +77,44 @@ UNINSTALL: ; COUNT: - lda #JOY_COUNT - rts + lda #JOY_COUNT + rts ; ------------------------------------------------------------------------ ; READ: Read a particular joystick passed in A. ; -READ: lda #%10000000 ; via port A Data-Direction - sta VIA_DDRA ; bit 7: out bit 6-0: in +READ: lda #%10000000 ; via port A Data-Direction + sta VIA_DDRA ; bit 7: out bit 6-0: in - tax ; Joystick number into X - bne joy2 + tax ; Joystick number into X + bne joy2 ; Read joystick 1 -joy1: lda #$80 ; via port A read/write - sta VIA_PRA ; (output one at PA7) +joy1: lda #$80 ; via port A read/write + sta VIA_PRA ; (output one at PA7) - lda VIA_PRA ; via port A read/write - and #$1f ; get bit 4-0 (PA4-PA0) - eor #$1f - rts + lda VIA_PRA ; via port A read/write + and #$1f ; get bit 4-0 (PA4-PA0) + eor #$1f + rts ; Read joystick 2 -joy2: lda #$00 ; via port A read/write - sta VIA_PRA ; (output zero at PA7) +joy2: lda #$00 ; via port A read/write + sta VIA_PRA ; (output zero at PA7) - lda VIA_PRA ; via port A read/write - and #$0f ; get bit 3-0 (PA3-PA0) - sta tmp1 ; joy 4 directions + lda VIA_PRA ; via port A read/write + and #$0f ; get bit 3-0 (PA3-PA0) + sta tmp1 ; joy 4 directions - lda VIA_PRA ; via port A read/write - and #%00100000 ; get bit 5 (PA5) - lsr - ora tmp1 - eor #$1f + lda VIA_PRA ; via port A read/write + and #%00100000 ; get bit 5 (PA5) + lsr + ora tmp1 + eor #$1f - ldx #0 - rts + ldx #0 + rts diff --git a/libsrc/pet/joy/pet-stdjoy.s b/libsrc/pet/joy/pet-stdjoy.s index d14f3e408..155dbbdf7 100644 --- a/libsrc/pet/joy/pet-stdjoy.s +++ b/libsrc/pet/joy/pet-stdjoy.s @@ -4,46 +4,46 @@ ; Marco van den Heuvel, 2010-01-23 ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" - .include "joy-error.inc" - .include "pet.inc" + .include "joy-kernel.inc" + .include "joy-error.inc" + .include "pet.inc" ; ------------------------------------------------------------------------ ; Header. Includes jump table - .segment "JUMPTABLE" + .segment "JUMPTABLE" ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) - .byte $01 ; JOY_UP - .byte $02 ; JOY_DOWN - .byte $04 ; JOY_LEFT - .byte $08 ; JOY_RIGHT - .byte $10 ; JOY_FIRE - .byte $00 ; JOY_FIRE2 unavailable - .byte $00 ; Future expansion - .byte $00 ; Future expansion + .byte $01 ; JOY_UP + .byte $02 ; JOY_DOWN + .byte $04 ; JOY_LEFT + .byte $08 ; JOY_RIGHT + .byte $10 ; JOY_FIRE + .byte $00 ; JOY_FIRE2 unavailable + .byte $00 ; Future expansion + .byte $00 ; Future expansion ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr COUNT - .addr READ - .addr 0 ; IRQ entry unused + .addr INSTALL + .addr UNINSTALL + .addr COUNT + .addr READ + .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants -JOY_COUNT = 2 ; Number of joysticks we support +JOY_COUNT = 2 ; Number of joysticks we support .code @@ -56,9 +56,9 @@ JOY_COUNT = 2 ; Number of joysticks we support ; INSTALL: - lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead + lda #JOY_ERR_OK +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -66,7 +66,7 @@ INSTALL: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ @@ -74,52 +74,52 @@ UNINSTALL: ; COUNT: - lda #JOY_COUNT - rts + lda #JOY_COUNT + rts ; ------------------------------------------------------------------------ ; READ: Read a particular joystick passed in A. ; READ: - tax ; Joystick number into X - bne joy2 + tax ; Joystick number into X + bne joy2 ; Read joystick 1 joy1: - lda #0 - sta VIA_DDRA - lda VIA_PRA - and #$0f - cmp #$0c - bne @notc1 - lda #$0f - bne @end1 + lda #0 + sta VIA_DDRA + lda VIA_PRA + and #$0f + cmp #$0c + bne @notc1 + lda #$0f + bne @end1 @notc1: - ora #$10 + ora #$10 @end1: - eor #$1f - rts + eor #$1f + rts ; Read joystick 2 joy2: - lda #0 - sta VIA_DDRA - lda VIA_PRA - lsr - lsr - lsr - lsr - cmp #$0c - bne @notc2 - lda #$0f - bne @end2 + lda #0 + sta VIA_DDRA + lda VIA_PRA + lsr + lsr + lsr + lsr + cmp #$0c + bne @notc2 + lda #$0f + bne @end2 @notc2: - ora #$10 + ora #$10 @end2: - eor #$1f - ldx #0 - rts + eor #$1f + ldx #0 + rts diff --git a/libsrc/pet/joy_stat_stddrv.s b/libsrc/pet/joy_stat_stddrv.s index fb79aa421..840c66ff3 100644 --- a/libsrc/pet/joy_stat_stddrv.s +++ b/libsrc/pet/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _pet_stdjoy_joy + .export _joy_static_stddrv + .import _pet_stdjoy_joy .rodata diff --git a/libsrc/pet/joy_stddrv.s b/libsrc/pet/joy_stddrv.s index 617d374cf..21fa53902 100644 --- a/libsrc/pet/joy_stddrv.s +++ b/libsrc/pet/joy_stddrv.s @@ -6,9 +6,9 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "pet-stdjoy.joy" +_joy_stddrv: .asciiz "pet-stdjoy.joy" diff --git a/libsrc/pet/kbhit.s b/libsrc/pet/kbhit.s index a09c28321..2a011c69d 100644 --- a/libsrc/pet/kbhit.s +++ b/libsrc/pet/kbhit.s @@ -4,15 +4,15 @@ ; unsigned char kbhit (void); ; - .export _kbhit + .export _kbhit - .include "pet.inc" + .include "pet.inc" .proc _kbhit ldx #0 ; High byte of return is always zero - lda KEY_COUNT ; Get number of characters + lda KEY_COUNT ; Get number of characters beq L9 lda #1 L9: rts diff --git a/libsrc/pet/kernal.s b/libsrc/pet/kernal.s index 714f7ab08..1a9dd6f67 100644 --- a/libsrc/pet/kernal.s +++ b/libsrc/pet/kernal.s @@ -19,10 +19,10 @@ ;----------------------------------------------------------------------------- ; Functions that are available in the kernal jump table -CLRCH = $FFCC -BASIN = $FFCF -STOP = $FFE1 -GETIN = $FFE4 -CLALL = $FFE7 -UDTIM = $FFEA +CLRCH = $FFCC +BASIN = $FFCF +STOP = $FFE1 +GETIN = $FFE4 +CLALL = $FFE7 +UDTIM = $FFEA diff --git a/libsrc/pet/mainargs.s b/libsrc/pet/mainargs.s index a5892a49c..9a63f50c2 100644 --- a/libsrc/pet/mainargs.s +++ b/libsrc/pet/mainargs.s @@ -5,14 +5,14 @@ ; Setup arguments for main ; - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv - .include "pet.inc" + .include "pet.inc" -MAXARGS = 10 ; Maximum number of arguments allowed -REM = $8f ; BASIC token-code -NAME_LEN = 16 ; maximum length of command-name +MAXARGS = 10 ; Maximum number of arguments allowed +REM = $8f ; BASIC token-code +NAME_LEN = 16 ; maximum length of command-name BASIC_BUF= $200 @@ -20,106 +20,106 @@ BASIC_BUF= $200 ; Get possible command-line arguments. Goes into the special INIT segment, ; which may be reused after the startup code is run -.segment "INIT" +.segment "INIT" -.proc initmainargs +.proc initmainargs ; Assume that the program was loaded, a moment ago, by the traditional LOAD ; statement. Save the "most-recent filename" as argument #0. ; Because the buffer, that we're copying into, was zeroed out, ; we don't need to add a NUL character. ; - ldy FNLEN - cpy #NAME_LEN + 1 - bcc L1 - ldy #NAME_LEN - 1 ; limit the length -L0: lda (FNADR),y - sta name,y -L1: dey - bpl L0 - inc __argc ; argc always is equal to, at least, 1 + ldy FNLEN + cpy #NAME_LEN + 1 + bcc L1 + ldy #NAME_LEN - 1 ; limit the length +L0: lda (FNADR),y + sta name,y +L1: dey + bpl L0 + inc __argc ; argc always is equal to, at least, 1 ; Find the "rem" token. ; - ldx #0 -L2: lda BASIC_BUF,x - beq done ; no "rem," no args. - inx - cmp #REM - bne L2 - ldy #1 * 2 + ldx #0 +L2: lda BASIC_BUF,x + beq done ; no "rem," no args. + inx + cmp #REM + bne L2 + ldy #1 * 2 ; Find the next argument -next: lda BASIC_BUF,x - beq done ; End of line reached - inx - cmp #' ' ; Skip leading spaces - beq next ; +next: lda BASIC_BUF,x + beq done ; End of line reached + inx + cmp #' ' ; Skip leading spaces + beq next ; ; Found start of next argument. We've incremented the pointer in X already, so ; it points to the second character of the argument. This is useful since we ; will check now for a quoted argument, in which case we will have to skip this ; first character. -found: cmp #'"' ; Is the argument quoted? - beq setterm ; Jump if so - dex ; Reset pointer to first argument character - lda #' ' ; A space ends the argument -setterm:sta term ; Set end of argument marker +found: cmp #'"' ; Is the argument quoted? + beq setterm ; Jump if so + dex ; Reset pointer to first argument character + lda #' ' ; A space ends the argument +setterm:sta term ; Set end of argument marker ; Now store a pointer to the argument into the next slot. Since the BASIC ; input buffer is located at the start of a RAM page, no calculations are ; necessary. - txa ; Get low byte - sta argv,y ; argv[y]= &arg - iny - lda #>BASIC_BUF - sta argv,y - iny - inc __argc ; Found another arg + txa ; Get low byte + sta argv,y ; argv[y]= &arg + iny + lda #>BASIC_BUF + sta argv,y + iny + inc __argc ; Found another arg ; Search for the end of the argument -argloop:lda BASIC_BUF,x - beq done - inx - cmp term - bne argloop +argloop:lda BASIC_BUF,x + beq done + inx + cmp term + bne argloop ; We've found the end of the argument. X points one character behind it, and ; A contains the terminating character. To make the argument a valid C string, ; replace the terminating character by a zero. - lda #0 - sta BASIC_BUF-1,x + lda #0 + sta BASIC_BUF-1,x ; Check if the maximum number of command line arguments is reached. If not, ; parse the next one. - lda __argc ; Get low byte of argument count - cmp #MAXARGS ; Maximum number of arguments reached? - bcc next ; Parse next one if not + lda __argc ; Get low byte of argument count + cmp #MAXARGS ; Maximum number of arguments reached? + bcc next ; Parse next one if not ; (The last vector in argv[] already is NULL.) -done: lda #argv - sta __argv - stx __argv + 1 - rts +done: lda #argv + sta __argv + stx __argv + 1 + rts .endproc ; These arrays are zeroed before initmainargs is called. -; char name[16+1]; +; char name[16+1]; ; char* argv[MAXARGS+1]={name}; ; .bss -term: .res 1 -name: .res NAME_LEN + 1 +term: .res 1 +name: .res NAME_LEN + 1 .data -argv: .addr name - .res MAXARGS * 2 +argv: .addr name + .res MAXARGS * 2 diff --git a/libsrc/pet/randomize.s b/libsrc/pet/randomize.s index bf6527036..fc5f621af 100644 --- a/libsrc/pet/randomize.s +++ b/libsrc/pet/randomize.s @@ -5,10 +5,10 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand - .include "pet.inc" + .include "pet.inc" __randomize: ldx TIME diff --git a/libsrc/pet/revers.s b/libsrc/pet/revers.s index bbcf8e132..49982d261 100644 --- a/libsrc/pet/revers.s +++ b/libsrc/pet/revers.s @@ -4,24 +4,24 @@ ; unsigned char revers (unsigned char onoff); ; - .export _revers + .export _revers .include "pet.inc" .proc _revers - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value - ldy #$00 ; Assume old value is zero -L1: lda RVS ; Load old value - stx RVS ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value + ldy #$00 ; Assume old value is zero +L1: lda RVS ; Load old value + stx RVS ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts .endproc diff --git a/libsrc/pet/status.s b/libsrc/pet/status.s index bb72817ce..2e2e858a0 100644 --- a/libsrc/pet/status.s +++ b/libsrc/pet/status.s @@ -2,4 +2,4 @@ ; Oliver Schmidt, 2012-09-30 ; - .exportzp ST := $96 ; IEC status byte + .exportzp ST := $96 ; IEC status byte diff --git a/libsrc/plus4/_scrsize.s b/libsrc/plus4/_scrsize.s index 19f92d7e5..4d3bae05d 100644 --- a/libsrc/plus4/_scrsize.s +++ b/libsrc/plus4/_scrsize.s @@ -4,7 +4,7 @@ ; Screen size variables ; - .export screensize + .export screensize ; We will return the values directly instead of banking in the ROM and calling ; SCREEN which is a lot more overhead in code size and CPU cycles. diff --git a/libsrc/plus4/break.s b/libsrc/plus4/break.s index 37ead40bb..248a558c7 100644 --- a/libsrc/plus4/break.s +++ b/libsrc/plus4/break.s @@ -5,46 +5,46 @@ ; void reset_brk (void); ; - .export _set_brk, _reset_brk - .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc + .export _set_brk, _reset_brk + .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc .import brk_jmp - .include "plus4.inc" + .include "plus4.inc" .bss -_brk_a: .res 1 -_brk_x: .res 1 -_brk_y: .res 1 -_brk_sr: .res 1 -_brk_pc: .res 2 +_brk_a: .res 1 +_brk_x: .res 1 +_brk_y: .res 1 +_brk_sr: .res 1 +_brk_pc: .res 2 -oldvec: .res 2 ; Old vector +oldvec: .res 2 ; Old vector .data -uservec: jmp $FFFF ; Patched at runtime +uservec: jmp $FFFF ; Patched at runtime .code ; Set the break vector -.proc _set_brk +.proc _set_brk - sta uservec+1 - stx uservec+2 ; Set the user vector + sta uservec+1 + stx uservec+2 ; Set the user vector - lda #brk_handler - sta brk_jmp+2 - rts + lda #brk_handler + sta brk_jmp+2 + rts .endproc ; Reset the break vector -.proc _reset_brk +.proc _reset_brk lda #$00 sta brk_jmp+1 @@ -57,37 +57,37 @@ uservec: jmp $FFFF ; Patched at runtime ; Break handler, called if a break occurs. -.proc brk_handler +.proc brk_handler - pla - sta _brk_y - pla - sta _brk_x - pla - sta _brk_a - pla - and #$EF ; Clear break bit - sta _brk_sr - pla ; PC low - sec - sbc #2 ; Point to start of brk - sta _brk_pc - pla ; PC high - sbc #0 - sta _brk_pc+1 + pla + sta _brk_y + pla + sta _brk_x + pla + sta _brk_a + pla + and #$EF ; Clear break bit + sta _brk_sr + pla ; PC low + sec + sbc #2 ; Point to start of brk + sta _brk_pc + pla ; PC high + sbc #0 + sta _brk_pc+1 - jsr uservec ; Call the user's routine + jsr uservec ; Call the user's routine - lda _brk_pc+1 - pha - lda _brk_pc - pha - lda _brk_sr - pha - ldx _brk_x - ldy _brk_y - lda _brk_a - rti ; Jump back... + lda _brk_pc+1 + pha + lda _brk_pc + pha + lda _brk_sr + pha + ldx _brk_x + ldy _brk_y + lda _brk_a + rti ; Jump back... .endproc diff --git a/libsrc/plus4/cgetc.s b/libsrc/plus4/cgetc.s index 0a4403127..7ff568101 100644 --- a/libsrc/plus4/cgetc.s +++ b/libsrc/plus4/cgetc.s @@ -4,87 +4,87 @@ ; char cgetc (void); ; - .export _cgetc - .import cursor + .export _cgetc + .import cursor - .include "plus4.inc" + .include "plus4.inc" ; -------------------------------------------------------------------------- .segment "LOWCODE" ; Accesses the ROM - must go into low mem -_cgetc: lda KEY_COUNT ; Get number of characters - ora FKEY_COUNT ; Or with number of function key chars - bne L2 ; Jump if there are already chars waiting +_cgetc: lda KEY_COUNT ; Get number of characters + ora FKEY_COUNT ; Or with number of function key chars + bne L2 ; Jump if there are already chars waiting ; Switch on the cursor if needed - ldy CURS_X - lda (CRAM_PTR),y ; Get current char - pha ; And save it - lda CHARCOLOR - sta (CRAM_PTR),y + ldy CURS_X + lda (CRAM_PTR),y ; Get current char + pha ; And save it + lda CHARCOLOR + sta (CRAM_PTR),y - lda cursor - beq L1 ; Jump if no cursor - tya - clc - adc SCREEN_PTR - sta TED_CURSLO - lda SCREEN_PTR+1 - adc #$00 - sbc #$0B ; + carry = $C00 (screen address) - sta TED_CURSHI + lda cursor + beq L1 ; Jump if no cursor + tya + clc + adc SCREEN_PTR + sta TED_CURSLO + lda SCREEN_PTR+1 + adc #$00 + sbc #$0B ; + carry = $C00 (screen address) + sta TED_CURSHI -L1: lda KEY_COUNT - ora FKEY_COUNT - beq L1 - pla - sta (CRAM_PTR),y - lda #$ff - sta TED_CURSLO ; Cursor off - sta TED_CURSHI +L1: lda KEY_COUNT + ora FKEY_COUNT + beq L1 + pla + sta (CRAM_PTR),y + lda #$ff + sta TED_CURSLO ; Cursor off + sta TED_CURSHI -L2: sta ENABLE_ROM ; Bank in the ROM - jsr KBDREAD ; Read char and return in A (ROM routine) +L2: sta ENABLE_ROM ; Bank in the ROM + jsr KBDREAD ; Read char and return in A (ROM routine) sta ENABLE_RAM ; Reenable the RAM - ldx #0 - rts + ldx #0 + rts ; -------------------------------------------------------------------------- ; Make the function keys return function key codes instead of the current ; strings so the program will see and may handle them. ; Undo this change when the program ends - .constructor initkbd - .destructor donekbd + .constructor initkbd + .destructor donekbd .segment "INIT" ; Special init code segment may get overwritten -.proc initkbd +.proc initkbd - ldy #15 -@L1: lda fnkeys,y - sta FKEY_SPACE,y - dey - bpl @L1 - rts + ldy #15 +@L1: lda fnkeys,y + sta FKEY_SPACE,y + dey + bpl @L1 + rts .endproc .segment "LOWCODE" ; Accesses the ROM - must go into low mem -.proc donekbd +.proc donekbd - ldx #$39 ; Copy the original function keys + ldx #$39 ; Copy the original function keys sta ENABLE_ROM ; Bank in the ROM -@L1: lda FKEY_ORIG,x - sta FKEY_SPACE,x - dex - bpl @L1 +@L1: lda FKEY_ORIG,x + sta FKEY_SPACE,x + dex + bpl @L1 sta ENABLE_RAM ; Bank out the ROM - rts + rts .endproc @@ -92,6 +92,6 @@ L2: sta ENABLE_ROM ; Bank in the ROM ; Function key table, readonly .rodata -fnkeys: .byte $01, $01, $01, $01, $01, $01, $01, $01 - .byte 133, 137, 134, 138, 135, 139, 136, 140 +fnkeys: .byte $01, $01, $01, $01, $01, $01, $01, $01 + .byte 133, 137, 134, 138, 135, 139, 136, 140 diff --git a/libsrc/plus4/clrscr.s b/libsrc/plus4/clrscr.s index 6641c336b..720a5e6e4 100644 --- a/libsrc/plus4/clrscr.s +++ b/libsrc/plus4/clrscr.s @@ -4,9 +4,9 @@ ; void clrscr (void); ; - .export _clrscr + .export _clrscr - .include "plus4.inc" + .include "plus4.inc" .segment "LOWCODE" ; Must go into low memory diff --git a/libsrc/plus4/color.s b/libsrc/plus4/color.s index 9d7107de8..2f3046e8f 100644 --- a/libsrc/plus4/color.s +++ b/libsrc/plus4/color.s @@ -6,28 +6,28 @@ ; unsigned char __fastcall__ bordercolor (unsigned char color); ; - .export _textcolor, _bgcolor, _bordercolor + .export _textcolor, _bgcolor, _bordercolor - .include "plus4.inc" + .include "plus4.inc" _textcolor: - ldx CHARCOLOR ; get old value - sta CHARCOLOR ; set new value - txa - rts + ldx CHARCOLOR ; get old value + sta CHARCOLOR ; set new value + txa + rts _bgcolor: - ldx TED_BGCOLOR ; get old value - sta TED_BGCOLOR ; set new value - txa - rts + ldx TED_BGCOLOR ; get old value + sta TED_BGCOLOR ; set new value + txa + rts _bordercolor: - ldx TED_BORDERCOLOR ; get old value - sta TED_BORDERCOLOR ; set new value - txa - rts + ldx TED_BORDERCOLOR ; get old value + sta TED_BORDERCOLOR ; set new value + txa + rts diff --git a/libsrc/plus4/conio.s b/libsrc/plus4/conio.s index 23c794856..feca30c68 100644 --- a/libsrc/plus4/conio.s +++ b/libsrc/plus4/conio.s @@ -4,7 +4,7 @@ ; Low level stuff for screen output/console input ; - .exportzp CURS_X, CURS_Y + .exportzp CURS_X, CURS_Y - .include "plus4.inc" + .include "plus4.inc" diff --git a/libsrc/plus4/cputc.s b/libsrc/plus4/cputc.s index 5788c1cb0..a83a9c60b 100644 --- a/libsrc/plus4/cputc.s +++ b/libsrc/plus4/cputc.s @@ -5,45 +5,45 @@ ; void cputc (char c); ; - .export _cputcxy, _cputc, cputdirect, putchar - .export newline, plot - .import popa, _gotoxy + .export _cputcxy, _cputc, cputdirect, putchar + .export newline, plot + .import popa, _gotoxy .import PLOT - .include "plus4.inc" + .include "plus4.inc" _cputcxy: - pha ; Save C - jsr popa ; Get Y - jsr _gotoxy ; Set cursor, drop x - pla ; Restore C + pha ; Save C + jsr popa ; Get Y + jsr _gotoxy ; Set cursor, drop x + pla ; Restore C ; Plot a character - also used as internal function -_cputc: cmp #$0A ; CR? - bne L1 - lda #0 - sta CURS_X - beq plot ; Recalculate pointers +_cputc: cmp #$0A ; CR? + bne L1 + lda #0 + sta CURS_X + beq plot ; Recalculate pointers -L1: cmp #$0D ; LF? - beq newline ; Recalculate pointers +L1: cmp #$0D ; LF? + beq newline ; Recalculate pointers ; Printable char of some sort - cmp #' ' - bcc cputdirect ; Other control char - tay - bmi L10 - cmp #$60 - bcc L2 - and #$DF - bne cputdirect ; Branch always -L2: and #$3F + cmp #' ' + bcc cputdirect ; Other control char + tay + bmi L10 + cmp #$60 + bcc L2 + and #$DF + bne cputdirect ; Branch always +L2: and #$3F cputdirect: - jsr putchar ; Write the character to the screen + jsr putchar ; Write the character to the screen ; Advance cursor position @@ -57,39 +57,39 @@ L3: sty CURS_X rts newline: - clc - lda #XSIZE - adc SCREEN_PTR - sta SCREEN_PTR - bcc L4 - inc SCREEN_PTR+1 - clc -L4: lda #XSIZE - adc CRAM_PTR - sta CRAM_PTR - bcc L5 - inc CRAM_PTR+1 -L5: inc CURS_Y - rts + clc + lda #XSIZE + adc SCREEN_PTR + sta SCREEN_PTR + bcc L4 + inc SCREEN_PTR+1 + clc +L4: lda #XSIZE + adc CRAM_PTR + sta CRAM_PTR + bcc L5 + inc CRAM_PTR+1 +L5: inc CURS_Y + rts ; Handle character if high bit set -L10: and #$7F - cmp #$7E ; PI? - bne L11 - lda #$5E ; Load screen code for PI - bne cputdirect -L11: ora #$40 - bne cputdirect +L10: and #$7F + cmp #$7E ; PI? + bne L11 + lda #$5E ; Load screen code for PI + bne cputdirect +L11: ora #$40 + bne cputdirect ; Set cursor position, calculate RAM pointers -plot: ldy CURS_X - ldx CURS_Y - clc - jmp PLOT ; Set the new cursor +plot: ldy CURS_X + ldx CURS_Y + clc + jmp PLOT ; Set the new cursor @@ -97,9 +97,9 @@ plot: ldy CURS_X ; position in Y putchar: - ora RVS ; Set revers bit - ldy CURS_X - sta (SCREEN_PTR),y ; Set char - lda CHARCOLOR - sta (CRAM_PTR),y ; Set color - rts + ora RVS ; Set revers bit + ldy CURS_X + sta (SCREEN_PTR),y ; Set char + lda CHARCOLOR + sta (CRAM_PTR),y ; Set color + rts diff --git a/libsrc/plus4/crt0.s b/libsrc/plus4/crt0.s index 73460d82b..92faadf52 100644 --- a/libsrc/plus4/crt0.s +++ b/libsrc/plus4/crt0.s @@ -2,30 +2,30 @@ ; Startup code for cc65 (Plus/4 version) ; - .export _exit + .export _exit .export brk_jmp .export __STARTUP__ : absolute = 1 ; Mark as startup - .import callirq_y, initlib, donelib - .import callmain, zerobss - .import __INTERRUPTOR_COUNT__ - .import __RAM_START__, __RAM_SIZE__ ; Linker generated - .import __STACKSIZE__ ; Linker generated - .importzp ST + .import callirq_y, initlib, donelib + .import callmain, zerobss + .import __INTERRUPTOR_COUNT__ + .import __RAM_START__, __RAM_SIZE__ ; Linker generated + .import __STACKSIZE__ ; Linker generated + .importzp ST .include "zeropage.inc" - .include "plus4.inc" + .include "plus4.inc" ; ------------------------------------------------------------------------ ; Constants -IRQInd = $500 ; JMP $0000 - used as indirect IRQ vector +IRQInd = $500 ; JMP $0000 - used as indirect IRQ vector ; ------------------------------------------------------------------------ ; Startup code -.segment "STARTUP" +.segment "STARTUP" Start: @@ -33,24 +33,24 @@ Start: sei ; No interrupts since we're banking out the ROM sta ENABLE_RAM - ldx #zpspace-1 -L1: lda sp,x - sta zpsave,x - dex - bpl L1 + ldx #zpspace-1 +L1: lda sp,x + sta zpsave,x + dex + bpl L1 sta ENABLE_ROM cli ; Switch to second charset - lda #14 - jsr $FFD2 ; BSOUT + lda #14 + jsr $FFD2 ; BSOUT ; Save system stuff and setup the stack. The stack starts at the top of the ; usable RAM. - tsx - stx spsave ; save system stk ptr + tsx + stx spsave ; save system stk ptr lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) sta sp @@ -69,7 +69,7 @@ L1: lda sp,x ; Clear the BSS data - jsr zerobss + jsr zerobss ; Initialize irqcount, which means that from now own custom linked in IRQ ; handlers (via condes) will be called. @@ -79,44 +79,44 @@ L1: lda sp,x ; Call module constructors - jsr initlib + jsr initlib ; Push arguments and call main() - jsr callmain + jsr callmain ; Back from main (this is also the _exit entry). Run module destructors. -_exit: pha ; Save the return code - jsr donelib ; Run module destructors +_exit: pha ; Save the return code + jsr donelib ; Run module destructors ; Disable chained IRQ handlers - lda #0 + lda #0 sta irqcount ; Disable custom IRQ handlers ; Copy back the zero page stuff - ldx #zpspace-1 -L2: lda zpsave,x - sta sp,x - dex - bpl L2 + ldx #zpspace-1 +L2: lda zpsave,x + sta sp,x + dex + bpl L2 ; Place the program return code into ST - pla - sta ST + pla + sta ST ; Restore the stack pointer - ldx spsave - txs + ldx spsave + txs ; Enable the ROM and return to BASIC sta ENABLE_ROM - rts + rts ; ------------------------------------------------------------------------ ; IRQ handler. The handler in the ROM enables the kernal and jumps to @@ -128,12 +128,12 @@ L2: lda zpsave,x .segment "LOWCODE" -IRQ: cld ; Just to be sure - pha +IRQ: cld ; Just to be sure + pha txa pha - tya - pha + tya + pha tsx ; Get the stack pointer lda $0104,x ; Get the saved status register and #$10 ; Test for BRK bit @@ -144,8 +144,8 @@ IRQ: cld ; Just to be sure ; condes function is not reentrant. The irqcount flag will be set/reset from ; the main code, to avoid races. - ldy irqcount - beq @L1 + ldy irqcount + beq @L1 jsr callirq_y ; Call the IRQ functions ; Since the ROM handler will end with an RTI, we have to fake an IRQ return @@ -156,17 +156,17 @@ IRQ: cld ; Just to be sure pha lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -89,16 +89,16 @@ COUNT: ; READ: Read a particular joystick passed in A. ; -READ: ldy #$FA ; Load index for joystick #1 - tax ; Test joystick number - beq @L1 - ldy #$FB ; Load index for joystick #2 +READ: ldy #$FA ; Load index for joystick #1 + tax ; Test joystick number + beq @L1 + ldy #$FB ; Load index for joystick #2 @L1: sei - sty TED_KBD - lda TED_KBD - cli - ldx #$00 ; Clear high byte - and #$1F - eor #$1F - rts + sty TED_KBD + lda TED_KBD + cli + ldx #$00 ; Clear high byte + and #$1F + eor #$1F + rts diff --git a/libsrc/plus4/joy_stat_stddrv.s b/libsrc/plus4/joy_stat_stddrv.s index d31f32354..9401d415b 100644 --- a/libsrc/plus4/joy_stat_stddrv.s +++ b/libsrc/plus4/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _plus4_stdjoy_joy + .export _joy_static_stddrv + .import _plus4_stdjoy_joy .rodata diff --git a/libsrc/plus4/joy_stddrv.s b/libsrc/plus4/joy_stddrv.s index 354ebf702..b80a3d87e 100644 --- a/libsrc/plus4/joy_stddrv.s +++ b/libsrc/plus4/joy_stddrv.s @@ -6,9 +6,9 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "plus4-stdjoy.joy" +_joy_stddrv: .asciiz "plus4-stdjoy.joy" diff --git a/libsrc/plus4/kbhit.s b/libsrc/plus4/kbhit.s index 87e379955..9484d2b4a 100644 --- a/libsrc/plus4/kbhit.s +++ b/libsrc/plus4/kbhit.s @@ -4,16 +4,16 @@ ; unsigned char kbhit (void); ; - .export _kbhit + .export _kbhit - .include "plus4.inc" + .include "plus4.inc" .proc _kbhit ldx #0 ; High byte of return is always zero - lda KEY_COUNT ; Get number of characters - ora FKEY_COUNT ; Or with number of chars from function keys + lda KEY_COUNT ; Get number of characters + ora FKEY_COUNT ; Or with number of chars from function keys beq L9 lda #1 L9: rts diff --git a/libsrc/plus4/kclose.s b/libsrc/plus4/kclose.s index eb15bbf95..8f8d07f7a 100644 --- a/libsrc/plus4/kclose.s +++ b/libsrc/plus4/kclose.s @@ -12,7 +12,7 @@ .proc CLOSE sta ENABLE_ROM ; Enable the ROM - clc ; Force C64 compatible behaviour + clc ; Force C64 compatible behaviour jsr $FFC3 ; Call the ROM routine sta ENABLE_RAM ; Switch back to RAM rts ; Return to caller diff --git a/libsrc/plus4/ksetnam.s b/libsrc/plus4/ksetnam.s index 90a08c25b..43fbb0f54 100644 --- a/libsrc/plus4/ksetnam.s +++ b/libsrc/plus4/ksetnam.s @@ -17,7 +17,7 @@ ; Store the length of the name into the zero page - sta FNAM_LEN + sta FNAM_LEN ; Check if we have to copy the name to low memory diff --git a/libsrc/plus4/mainargs.s b/libsrc/plus4/mainargs.s index 7365b1478..7df8402fe 100644 --- a/libsrc/plus4/mainargs.s +++ b/libsrc/plus4/mainargs.s @@ -22,16 +22,16 @@ ; - The "file-name" might be a path-name; don't copy the directory-components. ; - Add a control-character quoting mechanism. - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv - .include "plus4.inc" + .include "plus4.inc" -MAXARGS = 10 ; Maximum number of arguments allowed -REM = $8f ; BASIC token-code -NAME_LEN = 16 ; maximum length of command-name +MAXARGS = 10 ; Maximum number of arguments allowed +REM = $8f ; BASIC token-code +NAME_LEN = 16 ; maximum length of command-name ; Get possible command-line arguments. Goes into the special INIT segment, ; which may be reused after the startup code is run @@ -45,25 +45,25 @@ initmainargs: ; Because the buffer, that we're copying into, was zeroed out, ; we don't need to add a NUL character. ; - ldy FNAM_LEN - cpy #NAME_LEN + 1 - bcc L1 - ldy #NAME_LEN - 1 ; limit the length -L0: lda (FNAM),y - sta name,y -L1: dey - bpl L0 - inc __argc ; argc always is equal to, at least, 1 + ldy FNAM_LEN + cpy #NAME_LEN + 1 + bcc L1 + ldy #NAME_LEN - 1 ; limit the length +L0: lda (FNAM),y + sta name,y +L1: dey + bpl L0 + inc __argc ; argc always is equal to, at least, 1 ; Find the "rem" token. ; - ldx #0 -L2: lda BASIC_BUF,x - beq done ; no "rem," no args. - inx - cmp #REM - bne L2 - ldy #1 * 2 + ldx #0 +L2: lda BASIC_BUF,x + beq done ; no "rem," no args. + inx + cmp #REM + bne L2 + ldy #1 * 2 ; Find the next argument @@ -89,11 +89,11 @@ setterm:sta term ; Set end of argument marker ; necessary. txa ; Get low byte - sta argv,y ; argv[y]= &arg - iny - lda #>BASIC_BUF - sta argv,y - iny + sta argv,y ; argv[y]= &arg + iny + lda #>BASIC_BUF + sta argv,y + iny inc __argc ; Found another arg ; Search for the end of the argument @@ -120,22 +120,22 @@ argloop:lda BASIC_BUF,x ; (The last vector in argv[] already is NULL.) -done: lda #argv - sta __argv - stx __argv + 1 - rts +done: lda #argv + sta __argv + stx __argv + 1 + rts ; -------------------------------------------------------------------------- ; These arrays are zeroed before initmainargs is called. -; char name[16+1]; +; char name[16+1]; ; char* argv[MAXARGS+1]={name}; ; .bss -term: .res 1 -name: .res NAME_LEN + 1 +term: .res 1 +name: .res NAME_LEN + 1 .data argv: .addr name - .res MAXARGS * 2 + .res MAXARGS * 2 diff --git a/libsrc/plus4/randomize.s b/libsrc/plus4/randomize.s index ff7c05ce9..6c7b86353 100644 --- a/libsrc/plus4/randomize.s +++ b/libsrc/plus4/randomize.s @@ -5,10 +5,10 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand - .include "plus4.inc" + .include "plus4.inc" __randomize: ldx TED_VLINELO ; Use TED rasterline as high byte diff --git a/libsrc/plus4/revers.s b/libsrc/plus4/revers.s index c48ff9862..f1c0b4d64 100644 --- a/libsrc/plus4/revers.s +++ b/libsrc/plus4/revers.s @@ -4,24 +4,24 @@ ; unsigned char revers (unsigned char onoff); ; - .export _revers + .export _revers .include "plus4.inc" .proc _revers - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value - ldy #$00 ; Assume old value is zero -L1: lda RVS ; Load old value - stx RVS ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value + ldy #$00 ; Assume old value is zero +L1: lda RVS ; Load old value + stx RVS ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts .endproc diff --git a/libsrc/plus4/ser/plus4-stdser.s b/libsrc/plus4/ser/plus4-stdser.s index 30569a31f..ed33aa8c7 100644 --- a/libsrc/plus4/ser/plus4-stdser.s +++ b/libsrc/plus4/ser/plus4-stdser.s @@ -24,7 +24,7 @@ .include "zeropage.inc" .include "ser-kernel.inc" .include "ser-error.inc" - .include "plus4.inc" + .include "plus4.inc" ; ------------------------------------------------------------------------ @@ -47,12 +47,12 @@ .word PUT .word STATUS .word IOCTL - .word IRQ + .word IRQ ;---------------------------------------------------------------------------- ; I/O definitions -ACIA = $DE00 +ACIA = $DE00 ACIA_DATA = ACIA+0 ; Data register ACIA_STATUS = ACIA+1 ; Status register ACIA_CMD = ACIA+2 ; Command register @@ -64,19 +64,19 @@ ACIA_CTRL = ACIA+3 ; Control register ; .bss -RecvHead: .res 1 ; Head of receive buffer -RecvTail: .res 1 ; Tail of receive buffer -RecvFreeCnt: .res 1 ; Number of bytes in receive buffer -SendHead: .res 1 ; Head of send buffer -SendTail: .res 1 ; Tail of send buffer -SendFreeCnt: .res 1 ; Number of bytes in send buffer +RecvHead: .res 1 ; Head of receive buffer +RecvTail: .res 1 ; Tail of receive buffer +RecvFreeCnt: .res 1 ; Number of bytes in receive buffer +SendHead: .res 1 ; Head of send buffer +SendTail: .res 1 ; Tail of send buffer +SendFreeCnt: .res 1 ; Number of bytes in send buffer -Stopped: .res 1 ; Flow-stopped flag -RtsOff: .res 1 ; +Stopped: .res 1 ; Flow-stopped flag +RtsOff: .res 1 ; ; Send and receive buffers: 256 bytes each -RecvBuf: .res 256 -SendBuf: .res 256 +RecvBuf: .res 256 +SendBuf: .res 256 .rodata @@ -146,14 +146,14 @@ CLOSE: ; Deactivate DTR and disable 6551 interrupts - lda #%00001010 - sta ACIA_CMD + lda #%00001010 + sta ACIA_CMD ; Done, return an error code lda #SER_ERR_INIT_FAILED - rts + lda #SER_ERR_INIT_FAILED + rts ; Baud rate not available @@ -243,43 +243,43 @@ InvBaud: ; return. ; -GET: ldx SendFreeCnt ; Send data if necessary - inx ; X == $FF? - beq @L1 - lda #$00 - jsr TryToSend +GET: ldx SendFreeCnt ; Send data if necessary + inx ; X == $FF? + beq @L1 + lda #$00 + jsr TryToSend ; Check for buffer empty -@L1: lda RecvFreeCnt ; (25) - cmp #$ff - bne @L2 - lda #SER_ERR_NO_DATA - rts +@L1: lda RecvFreeCnt ; (25) + cmp #$ff + bne @L2 + lda #SER_ERR_NO_DATA + rts ; Check for flow stopped & enough free: release flow control -@L2: ldx Stopped ; (34) - beq @L3 - cmp #63 - bcc @L3 - lda #$00 - sta Stopped - lda RtsOff - ora #%00001000 - sta ACIA_CMD +@L2: ldx Stopped ; (34) + beq @L3 + cmp #63 + bcc @L3 + lda #$00 + sta Stopped + lda RtsOff + ora #%00001000 + sta ACIA_CMD ; Get byte from buffer -@L3: ldx RecvHead ; (41) - lda RecvBuf,x - inc RecvHead - inc RecvFreeCnt - ldx #$00 ; (59) - sta (ptr1,x) - txa ; Return code = 0 - rts +@L3: ldx RecvHead ; (41) + lda RecvBuf,x + inc RecvHead + inc RecvFreeCnt + ldx #$00 ; (59) + sta (ptr1,x) + txa ; Return code = 0 + rts ;---------------------------------------------------------------------------- ; PUT: Output character in A. @@ -290,40 +290,40 @@ PUT: ; Try to send - ldx SendFreeCnt - inx ; X = $ff? - beq @L2 - pha - lda #$00 - jsr TryToSend - pla + ldx SendFreeCnt + inx ; X = $ff? + beq @L2 + pha + lda #$00 + jsr TryToSend + pla ; Put byte into send buffer & send -@L2: ldx SendFreeCnt - bne @L3 - lda #SER_ERR_INV_IOCTL - rts ; Run into IRQ instead + rts ; Run into IRQ instead ;---------------------------------------------------------------------------- ; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All @@ -343,25 +343,25 @@ IOCTL: lda #__CONSTRUCTOR_TABLE__ + ldy #<(__CONSTRUCTOR_COUNT__*2) + beq exit + lda #<__CONSTRUCTOR_TABLE__ + ldx #>__CONSTRUCTOR_TABLE__ jmp condes exit: rts @@ -42,13 +42,13 @@ exit: rts .code -.proc donelib +.proc donelib - ldy #<(__DESTRUCTOR_COUNT__*2) - beq exit - lda #<__DESTRUCTOR_TABLE__ - ldx #>__DESTRUCTOR_TABLE__ - jmp condes + ldy #<(__DESTRUCTOR_COUNT__*2) + beq exit + lda #<__DESTRUCTOR_TABLE__ + ldx #>__DESTRUCTOR_TABLE__ + jmp condes exit: rts .endproc @@ -61,22 +61,22 @@ exit: rts .data -.proc condes +.proc condes - sta fetch1+1 - stx fetch1+2 - sta fetch2+1 - stx fetch2+2 + sta fetch1+1 + stx fetch1+2 + sta fetch2+1 + stx fetch2+2 loop: dey fetch1: lda $FFFF,y ; Patched at runtime sta jmpvec+2 - dey + dey fetch2: lda $FFFF,y ; Patched at runtime sta jmpvec+1 - sty index+1 -jmpvec: jsr $FFFF ; Patched at runtime -index: ldy #$FF ; Patched at runtime - bne loop + sty index+1 +jmpvec: jsr $FFFF ; Patched at runtime +index: ldy #$FF ; Patched at runtime + bne loop rts .endproc diff --git a/libsrc/runtime/decax1.s b/libsrc/runtime/decax1.s index 7c6891a96..ebde0b052 100644 --- a/libsrc/runtime/decax1.s +++ b/libsrc/runtime/decax1.s @@ -4,15 +4,15 @@ ; CC65 runtime: Decrement ax by 1 ; - .export decax1 + .export decax1 - .macpack generic + .macpack generic -.proc decax1 +.proc decax1 - sub #1 - bcs @L9 - dex -@L9: rts + sub #1 + bcs @L9 + dex +@L9: rts .endproc diff --git a/libsrc/runtime/decax2.s b/libsrc/runtime/decax2.s index f117063b6..7ef01ae55 100644 --- a/libsrc/runtime/decax2.s +++ b/libsrc/runtime/decax2.s @@ -4,15 +4,15 @@ ; CC65 runtime: Decrement ax by 2 ; - .export decax2 + .export decax2 - .macpack generic + .macpack generic -.proc decax2 +.proc decax2 - sub #2 - bcs @L9 - dex -@L9: rts + sub #2 + bcs @L9 + dex +@L9: rts .endproc diff --git a/libsrc/runtime/decax3.s b/libsrc/runtime/decax3.s index 3a86d3f2b..9529fd905 100644 --- a/libsrc/runtime/decax3.s +++ b/libsrc/runtime/decax3.s @@ -4,15 +4,15 @@ ; CC65 runtime: Decrement ax by 3 ; - .export decax3 + .export decax3 - .macpack generic + .macpack generic -.proc decax3 +.proc decax3 - sub #3 - bcs @L9 - dex -@L9: rts + sub #3 + bcs @L9 + dex +@L9: rts .endproc diff --git a/libsrc/runtime/decax4.s b/libsrc/runtime/decax4.s index 57e5c7c36..be5f9aa49 100644 --- a/libsrc/runtime/decax4.s +++ b/libsrc/runtime/decax4.s @@ -4,15 +4,15 @@ ; CC65 runtime: Decrement ax by 4 ; - .export decax4 + .export decax4 - .macpack generic + .macpack generic -.proc decax4 +.proc decax4 - sub #4 - bcs @L9 - dex -@L9: rts + sub #4 + bcs @L9 + dex +@L9: rts .endproc diff --git a/libsrc/runtime/decax5.s b/libsrc/runtime/decax5.s index 5b44bbb73..1f7f9cd33 100644 --- a/libsrc/runtime/decax5.s +++ b/libsrc/runtime/decax5.s @@ -4,15 +4,15 @@ ; CC65 runtime: Decrement ax by 5 ; - .export decax5 + .export decax5 - .macpack generic + .macpack generic -.proc decax5 +.proc decax5 - sub #5 - bcs @L9 - dex -@L9: rts + sub #5 + bcs @L9 + dex +@L9: rts .endproc diff --git a/libsrc/runtime/decax6.s b/libsrc/runtime/decax6.s index 0ca4de649..8d40fb084 100644 --- a/libsrc/runtime/decax6.s +++ b/libsrc/runtime/decax6.s @@ -4,15 +4,15 @@ ; CC65 runtime: Decrement ax by 6 ; - .export decax6 + .export decax6 - .macpack generic + .macpack generic -.proc decax6 +.proc decax6 - sub #6 - bcs @L9 - dex -@L9: rts + sub #6 + bcs @L9 + dex +@L9: rts .endproc diff --git a/libsrc/runtime/decax7.s b/libsrc/runtime/decax7.s index 17636b574..7d06ce41b 100644 --- a/libsrc/runtime/decax7.s +++ b/libsrc/runtime/decax7.s @@ -4,15 +4,15 @@ ; CC65 runtime: Decrement ax by 7 ; - .export decax7 + .export decax7 - .macpack generic + .macpack generic -.proc decax7 +.proc decax7 - sub #7 - bcs @L9 - dex -@L9: rts + sub #7 + bcs @L9 + dex +@L9: rts .endproc diff --git a/libsrc/runtime/decax8.s b/libsrc/runtime/decax8.s index abeb632d6..6bab61ea3 100644 --- a/libsrc/runtime/decax8.s +++ b/libsrc/runtime/decax8.s @@ -4,15 +4,15 @@ ; CC65 runtime: Decrement ax by 8 ; - .export decax8 + .export decax8 - .macpack generic + .macpack generic -.proc decax8 +.proc decax8 - sub #8 - bcs @L9 - dex -@L9: rts + sub #8 + bcs @L9 + dex +@L9: rts .endproc diff --git a/libsrc/runtime/decaxy.s b/libsrc/runtime/decaxy.s index ec2b9c784..d01d881d0 100644 --- a/libsrc/runtime/decaxy.s +++ b/libsrc/runtime/decaxy.s @@ -4,18 +4,18 @@ ; CC65 runtime: Decrement ax by value in Y ; - .export decaxy - .importzp tmp1 + .export decaxy + .importzp tmp1 - .macpack generic + .macpack generic -.proc decaxy +.proc decaxy - sty tmp1 - sub tmp1 - bcs @L9 - dex -@L9: rts + sty tmp1 + sub tmp1 + bcs @L9 + dex +@L9: rts .endproc diff --git a/libsrc/runtime/decsp1.s b/libsrc/runtime/decsp1.s index ab31a49b0..5aa7fa204 100644 --- a/libsrc/runtime/decsp1.s +++ b/libsrc/runtime/decsp1.s @@ -4,20 +4,20 @@ ; CC65 runtime: Decrement the stackpointer by 1 ; - .export decsp1 - .importzp sp + .export decsp1 + .importzp sp -.proc decsp1 +.proc decsp1 - ldy sp - bne @L1 - dec sp+1 -@L1: dec sp - rts + ldy sp + bne @L1 + dec sp+1 +@L1: dec sp + rts .endproc - + diff --git a/libsrc/runtime/decsp2.s b/libsrc/runtime/decsp2.s index c92da4d31..a3793e778 100644 --- a/libsrc/runtime/decsp2.s +++ b/libsrc/runtime/decsp2.s @@ -4,20 +4,20 @@ ; CC65 runtime: Decrement the stackpointer by 2 ; - .export decsp2 - .importzp sp + .export decsp2 + .importzp sp -.proc decsp2 +.proc decsp2 - lda sp - sec - sbc #2 - sta sp - bcc @L1 - rts + lda sp + sec + sbc #2 + sta sp + bcc @L1 + rts -@L1: dec sp+1 - rts +@L1: dec sp+1 + rts .endproc diff --git a/libsrc/runtime/decsp3.s b/libsrc/runtime/decsp3.s index 9401c3dc5..a3ad7777e 100644 --- a/libsrc/runtime/decsp3.s +++ b/libsrc/runtime/decsp3.s @@ -4,20 +4,20 @@ ; CC65 runtime: Decrement the stackpointer by 3 ; - .export decsp3 - .importzp sp + .export decsp3 + .importzp sp -.proc decsp3 +.proc decsp3 - lda sp - sec - sbc #3 - sta sp - bcc @L1 - rts + lda sp + sec + sbc #3 + sta sp + bcc @L1 + rts -@L1: dec sp+1 - rts +@L1: dec sp+1 + rts .endproc diff --git a/libsrc/runtime/decsp4.s b/libsrc/runtime/decsp4.s index 851339072..5c7e94943 100644 --- a/libsrc/runtime/decsp4.s +++ b/libsrc/runtime/decsp4.s @@ -4,20 +4,20 @@ ; CC65 runtime: Decrement the stackpointer by 4 ; - .export decsp4 - .importzp sp + .export decsp4 + .importzp sp -.proc decsp4 +.proc decsp4 - lda sp - sec - sbc #4 - sta sp - bcc @L1 - rts + lda sp + sec + sbc #4 + sta sp + bcc @L1 + rts -@L1: dec sp+1 - rts +@L1: dec sp+1 + rts .endproc diff --git a/libsrc/runtime/decsp5.s b/libsrc/runtime/decsp5.s index 0519bf480..7ff4605cf 100644 --- a/libsrc/runtime/decsp5.s +++ b/libsrc/runtime/decsp5.s @@ -4,20 +4,20 @@ ; CC65 runtime: Decrement the stackpointer by 5 ; - .export decsp5 - .importzp sp + .export decsp5 + .importzp sp -.proc decsp5 +.proc decsp5 - lda sp - sec - sbc #5 - sta sp - bcc @L1 - rts + lda sp + sec + sbc #5 + sta sp + bcc @L1 + rts -@L1: dec sp+1 - rts +@L1: dec sp+1 + rts .endproc diff --git a/libsrc/runtime/decsp6.s b/libsrc/runtime/decsp6.s index 31d6ec9dc..6e55e664d 100644 --- a/libsrc/runtime/decsp6.s +++ b/libsrc/runtime/decsp6.s @@ -4,20 +4,20 @@ ; CC65 runtime: Decrement the stackpointer by 6 ; - .export decsp6 - .importzp sp + .export decsp6 + .importzp sp -.proc decsp6 +.proc decsp6 - lda sp - sec - sbc #6 - sta sp - bcc @L1 - rts + lda sp + sec + sbc #6 + sta sp + bcc @L1 + rts -@L1: dec sp+1 - rts +@L1: dec sp+1 + rts .endproc diff --git a/libsrc/runtime/decsp7.s b/libsrc/runtime/decsp7.s index 249b00baa..ee82232f6 100644 --- a/libsrc/runtime/decsp7.s +++ b/libsrc/runtime/decsp7.s @@ -4,20 +4,20 @@ ; CC65 runtime: Decrement the stackpointer by 7 ; - .export decsp7 - .importzp sp + .export decsp7 + .importzp sp -.proc decsp7 +.proc decsp7 - lda sp - sec - sbc #7 - sta sp - bcc @L1 - rts + lda sp + sec + sbc #7 + sta sp + bcc @L1 + rts -@L1: dec sp+1 - rts +@L1: dec sp+1 + rts .endproc diff --git a/libsrc/runtime/decsp8.s b/libsrc/runtime/decsp8.s index 0c0c8fee9..47d44593e 100644 --- a/libsrc/runtime/decsp8.s +++ b/libsrc/runtime/decsp8.s @@ -4,20 +4,20 @@ ; CC65 runtime: Decrement the stackpointer by 8 ; - .export decsp8 - .importzp sp + .export decsp8 + .importzp sp -.proc decsp8 +.proc decsp8 - lda sp - sec - sbc #8 - sta sp - bcc @L1 - rts + lda sp + sec + sbc #8 + sta sp + bcc @L1 + rts -@L1: dec sp+1 - rts +@L1: dec sp+1 + rts .endproc diff --git a/libsrc/runtime/div.s b/libsrc/runtime/div.s index e419dedff..cdd340272 100644 --- a/libsrc/runtime/div.s +++ b/libsrc/runtime/div.s @@ -7,15 +7,15 @@ ; When negating values, we will ignore the possibility here, that one of the ; values if $8000, in which case the negate will fail. - .export tosdiva0, tosdivax - .import popsargs, udiv16, negax - .importzp sreg, tmp1, tmp2 + .export tosdiva0, tosdivax + .import popsargs, udiv16, negax + .importzp sreg, tmp1, tmp2 tosdiva0: - ldx #0 + ldx #0 tosdivax: - jsr popsargs ; Get arguments from stack, adjust sign - jsr udiv16 ; Do the division + jsr popsargs ; Get arguments from stack, adjust sign + jsr udiv16 ; Do the division ldx sreg+1 ; Load high byte of result ; Adjust the sign of the result. tmp1 contains the high byte of the left diff --git a/libsrc/runtime/enter.s b/libsrc/runtime/enter.s index a246d5e93..c51b4f7bb 100644 --- a/libsrc/runtime/enter.s +++ b/libsrc/runtime/enter.s @@ -4,15 +4,15 @@ ; CC65 runtime: function prologue ; - .export enter - .importzp sp + .export enter + .importzp sp -enter: tya ; get arg size - ldy sp - bne L1 - dec sp+1 -L1: dec sp - ldy #0 - sta (sp),y ; Store the arg count - rts +enter: tya ; get arg size + ldy sp + bne L1 + dec sp+1 +L1: dec sp + ldy #0 + sta (sp),y ; Store the arg count + rts diff --git a/libsrc/runtime/eq.s b/libsrc/runtime/eq.s index 28e52055e..c2a537a35 100644 --- a/libsrc/runtime/eq.s +++ b/libsrc/runtime/eq.s @@ -4,14 +4,14 @@ ; CC65 runtime: Compare == for ints ; - .export toseq00, toseqa0, toseqax - .import tosicmp, booleq - .importzp sp, tmp1 + .export toseq00, toseqa0, toseqax + .import tosicmp, booleq + .importzp sp, tmp1 toseq00: - lda #$00 + lda #$00 toseqa0: - ldx #$00 + ldx #$00 toseqax: - jsr tosicmp ; Set flags - jmp booleq ; Convert to boolean + jsr tosicmp ; Set flags + jmp booleq ; Convert to boolean diff --git a/libsrc/runtime/ge.s b/libsrc/runtime/ge.s index 17d4bb98b..5cfb829c1 100644 --- a/libsrc/runtime/ge.s +++ b/libsrc/runtime/ge.s @@ -4,14 +4,14 @@ ; CC65 runtime: Compare >= for signed ints ; - .export tosge00, tosgea0, tosgeax - .import tosicmp, boolge + .export tosge00, tosgea0, tosgeax + .import tosicmp, boolge tosge00: - lda #$00 + lda #$00 tosgea0: - ldx #$00 + ldx #$00 tosgeax: - jsr tosicmp ; Set flags - jmp boolge ; Convert to boolean + jsr tosicmp ; Set flags + jmp boolge ; Convert to boolean diff --git a/libsrc/runtime/gt.s b/libsrc/runtime/gt.s index b6ba7b61c..3c6976da5 100644 --- a/libsrc/runtime/gt.s +++ b/libsrc/runtime/gt.s @@ -4,15 +4,15 @@ ; CC65 runtime: Compare > for signed ints ; - .export tosgt00, tosgta0, tosgtax - .import tosicmp, boolgt + .export tosgt00, tosgta0, tosgtax + .import tosicmp, boolgt tosgt00: - lda #$00 + lda #$00 tosgta0: - ldx #$00 + ldx #$00 tosgtax: - jsr tosicmp ; Set the flags - jmp boolgt ; Convert to boolean + jsr tosicmp ; Set the flags + jmp boolgt ; Convert to boolean diff --git a/libsrc/runtime/icmp.s b/libsrc/runtime/icmp.s index 70bcb76bd..05c73bd01 100644 --- a/libsrc/runtime/icmp.s +++ b/libsrc/runtime/icmp.s @@ -5,43 +5,43 @@ ; Integer compare function - used by the compare operators ; - .export tosicmp, tosicmp0 - .importzp sp, sreg + .export tosicmp, tosicmp0 + .importzp sp, sreg tosicmp0: ldx #$00 tosicmp: - sta sreg - stx sreg+1 ; Save ax + sta sreg + stx sreg+1 ; Save ax - ldy #$00 - lda (sp),y ; Get low byte - tax - inc sp ; 5 - bne @L1 ; 3 - inc sp+1 ; (5) + ldy #$00 + lda (sp),y ; Get low byte + tax + inc sp ; 5 + bne @L1 ; 3 + inc sp+1 ; (5) @L1: - lda (sp),y ; Get high byte - inc sp ; 5 - bne @L2 ; 3 - inc sp+1 ; (5) + lda (sp),y ; Get high byte + inc sp ; 5 + bne @L2 ; 3 + inc sp+1 ; (5) ; Do the compare. -@L2: sec - sbc sreg+1 ; Compare high byte - bne @L4 - cpx sreg ; Compare low byte - beq @L3 - adc #$FF ; If the C flag is set then clear the N flag - ora #$01 ; else set the N flag -@L3: rts +@L2: sec + sbc sreg+1 ; Compare high byte + bne @L4 + cpx sreg ; Compare low byte + beq @L3 + adc #$FF ; If the C flag is set then clear the N flag + ora #$01 ; else set the N flag +@L3: rts -@L4: bvc @L3 - eor #$FF ; Fix the N flag if overflow - ora #$01 ; Clear the Z flag - rts +@L4: bvc @L3 + eor #$FF ; Fix the N flag if overflow + ora #$01 ; Clear the Z flag + rts diff --git a/libsrc/runtime/idiv32by16r16.s b/libsrc/runtime/idiv32by16r16.s index a69c2a7a7..12e7feb51 100644 --- a/libsrc/runtime/idiv32by16r16.s +++ b/libsrc/runtime/idiv32by16r16.s @@ -5,7 +5,7 @@ ; .export idiv32by16r16 - .import negax, udiv32by16r16m + .import negax, udiv32by16r16m .include "zeropage.inc" diff --git a/libsrc/runtime/incax1.s b/libsrc/runtime/incax1.s index 2d57b3981..19c1d0c60 100644 --- a/libsrc/runtime/incax1.s +++ b/libsrc/runtime/incax1.s @@ -4,21 +4,21 @@ ; CC65 runtime: Increment ax by 1 ; - .export incax1 + .export incax1 - .macpack generic + .macpack generic .macpack cpu -.proc incax1 +.proc incax1 .if (.cpu .bitand ::CPU_ISET_65SC02) - ina ; 65C02 version - bne @L9 + ina ; 65C02 version + bne @L9 .else - add #1 - bcc @L9 + add #1 + bcc @L9 .endif - inx -@L9: rts + inx +@L9: rts .endproc diff --git a/libsrc/runtime/incax2.s b/libsrc/runtime/incax2.s index 9525171cc..55c4571e4 100644 --- a/libsrc/runtime/incax2.s +++ b/libsrc/runtime/incax2.s @@ -4,15 +4,15 @@ ; CC65 runtime: Increment ax by 2 ; - .export incax2 + .export incax2 - .macpack generic + .macpack generic -.proc incax2 +.proc incax2 - add #2 - bcc @L9 - inx -@L9: rts + add #2 + bcc @L9 + inx +@L9: rts .endproc diff --git a/libsrc/runtime/incax3.s b/libsrc/runtime/incax3.s index e06b9132b..031c41ddf 100644 --- a/libsrc/runtime/incax3.s +++ b/libsrc/runtime/incax3.s @@ -4,13 +4,13 @@ ; CC65 runtime: Increment ax by 3 ; - .export incax3 - .import incaxy + .export incax3 + .import incaxy -.proc incax3 +.proc incax3 - ldy #3 - jmp incaxy + ldy #3 + jmp incaxy .endproc diff --git a/libsrc/runtime/incax5.s b/libsrc/runtime/incax5.s index ae9e063cf..2e16a1c9f 100644 --- a/libsrc/runtime/incax5.s +++ b/libsrc/runtime/incax5.s @@ -4,13 +4,13 @@ ; CC65 runtime: Increment ax by 5 ; - .export incax5 - .import incaxy + .export incax5 + .import incaxy -.proc incax5 +.proc incax5 - ldy #5 - jmp incaxy + ldy #5 + jmp incaxy .endproc diff --git a/libsrc/runtime/incax6.s b/libsrc/runtime/incax6.s index 5f80d36f8..355245450 100644 --- a/libsrc/runtime/incax6.s +++ b/libsrc/runtime/incax6.s @@ -4,13 +4,13 @@ ; CC65 runtime: Increment ax by 6 ; - .export incax6 - .import incaxy + .export incax6 + .import incaxy -.proc incax6 +.proc incax6 - ldy #6 - jmp incaxy + ldy #6 + jmp incaxy .endproc diff --git a/libsrc/runtime/incax7.s b/libsrc/runtime/incax7.s index ed883c3ae..e8d27ae50 100644 --- a/libsrc/runtime/incax7.s +++ b/libsrc/runtime/incax7.s @@ -4,13 +4,13 @@ ; CC65 runtime: Increment ax by 7 ; - .export incax7 - .import incaxy + .export incax7 + .import incaxy -.proc incax7 +.proc incax7 - ldy #7 - jmp incaxy + ldy #7 + jmp incaxy .endproc diff --git a/libsrc/runtime/incax8.s b/libsrc/runtime/incax8.s index ae1e52660..12b9dfd09 100644 --- a/libsrc/runtime/incax8.s +++ b/libsrc/runtime/incax8.s @@ -4,13 +4,13 @@ ; CC65 runtime: Increment ax by 8 ; - .export incax8 - .import incaxy + .export incax8 + .import incaxy -.proc incax8 +.proc incax8 - ldy #8 - jmp incaxy + ldy #8 + jmp incaxy .endproc diff --git a/libsrc/runtime/incaxy.s b/libsrc/runtime/incaxy.s index feed9564c..0ee7d879f 100644 --- a/libsrc/runtime/incaxy.s +++ b/libsrc/runtime/incaxy.s @@ -4,14 +4,14 @@ ; CC65 runtime: Increment ax by valie in y ; - .export incaxy, incax4 - .importzp tmp1 - .macpack generic + .export incaxy, incax4 + .importzp tmp1 + .macpack generic -incax4: ldy #4 -incaxy: sty tmp1 - add tmp1 - bcc @L9 - inx -@L9: rts +incax4: ldy #4 +incaxy: sty tmp1 + add tmp1 + bcc @L9 + inx +@L9: rts diff --git a/libsrc/runtime/incsp1.s b/libsrc/runtime/incsp1.s index a85092d23..43c92dc82 100644 --- a/libsrc/runtime/incsp1.s +++ b/libsrc/runtime/incsp1.s @@ -4,19 +4,19 @@ ; CC65 runtime: Increment the stackpointer by 1 ; - .export incsp1 - .importzp sp + .export incsp1 + .importzp sp -.proc incsp1 +.proc incsp1 - inc sp - bne @L1 - inc sp+1 -@L1: rts + inc sp + bne @L1 + inc sp+1 +@L1: rts .endproc - + diff --git a/libsrc/runtime/incsp2.s b/libsrc/runtime/incsp2.s index 639f8a44f..067154b86 100644 --- a/libsrc/runtime/incsp2.s +++ b/libsrc/runtime/incsp2.s @@ -2,32 +2,32 @@ ; Ullrich von Bassewitz, 25.10.2000 ; ; CC65 runtime: Increment the stackpointer by 2. For performance reasons, -; this modules does also contain the popax function. +; this modules does also contain the popax function. - .export popax, incsp2 - .importzp sp + .export popax, incsp2 + .importzp sp .macpack cpu ; Pop a/x from stack. This function will run directly into incsp2 -.proc popax +.proc popax - ldy #1 - lda (sp),y ; get hi byte - tax ; into x + ldy #1 + lda (sp),y ; get hi byte + tax ; into x .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (sp) ; get lo byte + lda (sp) ; get lo byte .else - dey - lda (sp),y ; get lo byte + dey + lda (sp),y ; get lo byte .endif .endproc -.proc incsp2 +.proc incsp2 inc sp ; 5 beq @L1 ; 2 diff --git a/libsrc/runtime/incsp3.s b/libsrc/runtime/incsp3.s index 90dca0b96..29067a55e 100644 --- a/libsrc/runtime/incsp3.s +++ b/libsrc/runtime/incsp3.s @@ -4,17 +4,17 @@ ; CC65 runtime: Increment the stackpointer by 3 ; - .export incsp3 - .import addysp + .export incsp3 + .import addysp -.proc incsp3 +.proc incsp3 - ldy #3 - jmp addysp + ldy #3 + jmp addysp .endproc - + diff --git a/libsrc/runtime/incsp4.s b/libsrc/runtime/incsp4.s index 125c533e7..51e9229bb 100644 --- a/libsrc/runtime/incsp4.s +++ b/libsrc/runtime/incsp4.s @@ -4,17 +4,17 @@ ; CC65 runtime: Increment the stackpointer by 4 ; - .export incsp4 - .import addysp + .export incsp4 + .import addysp -.proc incsp4 +.proc incsp4 - ldy #4 - jmp addysp + ldy #4 + jmp addysp .endproc - + diff --git a/libsrc/runtime/incsp5.s b/libsrc/runtime/incsp5.s index df239cf21..164c62524 100644 --- a/libsrc/runtime/incsp5.s +++ b/libsrc/runtime/incsp5.s @@ -4,17 +4,17 @@ ; CC65 runtime: Increment the stackpointer by 5 ; - .export incsp5 - .import addysp + .export incsp5 + .import addysp -.proc incsp5 +.proc incsp5 - ldy #5 - jmp addysp + ldy #5 + jmp addysp .endproc - + diff --git a/libsrc/runtime/incsp6.s b/libsrc/runtime/incsp6.s index a7ab932dd..1a393840e 100644 --- a/libsrc/runtime/incsp6.s +++ b/libsrc/runtime/incsp6.s @@ -4,17 +4,17 @@ ; CC65 runtime: Increment the stackpointer by 6 ; - .export incsp6 - .import addysp + .export incsp6 + .import addysp -.proc incsp6 +.proc incsp6 - ldy #6 - jmp addysp + ldy #6 + jmp addysp .endproc - + diff --git a/libsrc/runtime/incsp7.s b/libsrc/runtime/incsp7.s index 417700fe9..8a5838137 100644 --- a/libsrc/runtime/incsp7.s +++ b/libsrc/runtime/incsp7.s @@ -4,17 +4,17 @@ ; CC65 runtime: Increment the stackpointer by 7 ; - .export incsp7 - .import addysp + .export incsp7 + .import addysp -.proc incsp7 +.proc incsp7 - ldy #7 - jmp addysp + ldy #7 + jmp addysp .endproc - + diff --git a/libsrc/runtime/incsp8.s b/libsrc/runtime/incsp8.s index 3ec15202e..a77dc3d7f 100644 --- a/libsrc/runtime/incsp8.s +++ b/libsrc/runtime/incsp8.s @@ -4,13 +4,13 @@ ; CC65 runtime: Increment the stackpointer by 8 ; - .export incsp8 - .import addysp + .export incsp8 + .import addysp -.proc incsp8 +.proc incsp8 - ldy #8 - jmp addysp + ldy #8 + jmp addysp .endproc diff --git a/libsrc/runtime/jmpvec.s b/libsrc/runtime/jmpvec.s index 6ae8715ca..ed77a0789 100644 --- a/libsrc/runtime/jmpvec.s +++ b/libsrc/runtime/jmpvec.s @@ -5,10 +5,10 @@ ; may be patched at runtime. ; - .export jmpvec + .export jmpvec .data -jmpvec: jmp $FFFF +jmpvec: jmp $FFFF diff --git a/libsrc/runtime/ladd.s b/libsrc/runtime/ladd.s index 4e864c797..23b3436c0 100644 --- a/libsrc/runtime/ladd.s +++ b/libsrc/runtime/ladd.s @@ -4,9 +4,9 @@ ; CC65 runtime: long add ; - .export tosadd0ax, tosaddeax - .import addysp1 - .importzp sp, sreg, tmp1 + .export tosadd0ax, tosaddeax + .import addysp1 + .importzp sp, sreg, tmp1 .macpack cpu @@ -18,27 +18,27 @@ tosadd0ax: sty sreg+1 tosaddeax: - clc + clc .if (.cpu .bitand CPU_ISET_65SC02) - adc (sp) ; 65SC02 version - saves 2 cycles - ldy #1 + adc (sp) ; 65SC02 version - saves 2 cycles + ldy #1 .else - ldy #0 - adc (sp),y ; lo byte - iny + ldy #0 + adc (sp),y ; lo byte + iny .endif - sta tmp1 ; use as temp storage - txa - adc (sp),y ; byte 1 - tax - iny - lda sreg - adc (sp),y ; byte 2 - sta sreg - iny - lda sreg+1 - adc (sp),y ; byte 3 - sta sreg+1 - lda tmp1 ; load byte 0 - jmp addysp1 ; drop TOS + sta tmp1 ; use as temp storage + txa + adc (sp),y ; byte 1 + tax + iny + lda sreg + adc (sp),y ; byte 2 + sta sreg + iny + lda sreg+1 + adc (sp),y ; byte 3 + sta sreg+1 + lda tmp1 ; load byte 0 + jmp addysp1 ; drop TOS diff --git a/libsrc/runtime/laddeq.s b/libsrc/runtime/laddeq.s index 6478017f3..2632ec909 100644 --- a/libsrc/runtime/laddeq.s +++ b/libsrc/runtime/laddeq.s @@ -7,47 +7,47 @@ ; in ptr1, the high byte is in Y, and the increment is in eax. ; - .export laddeq1, laddeqa, laddeq - .importzp sreg, ptr1, tmp1 + .export laddeq1, laddeqa, laddeq + .importzp sreg, ptr1, tmp1 laddeq1: - lda #$01 + lda #$01 laddeqa: - ldx #$00 - stx sreg - stx sreg+1 + ldx #$00 + stx sreg + stx sreg+1 -laddeq: sty ptr1+1 ; Store high byte of address - ldy #$00 ; Address low byte - clc +laddeq: sty ptr1+1 ; Store high byte of address + ldy #$00 ; Address low byte + clc - adc (ptr1),y - sta (ptr1),y - pha ; Save byte 0 of result for later + adc (ptr1),y + sta (ptr1),y + pha ; Save byte 0 of result for later - iny ; Address byte 1 - txa - adc (ptr1),y ; Load byte 1 - sta (ptr1),y - tax + iny ; Address byte 1 + txa + adc (ptr1),y ; Load byte 1 + sta (ptr1),y + tax - iny ; Address byte 2 - lda sreg - adc (ptr1),y - sta (ptr1),y - sta sreg + iny ; Address byte 2 + lda sreg + adc (ptr1),y + sta (ptr1),y + sta sreg - iny ; Address byte 3 - lda sreg+1 - adc (ptr1),y - sta (ptr1),y - sta sreg+1 + iny ; Address byte 3 + lda sreg+1 + adc (ptr1),y + sta (ptr1),y + sta sreg+1 - pla ; Retrieve byte 0 of result + pla ; Retrieve byte 0 of result - rts ; Done + rts ; Done diff --git a/libsrc/runtime/laddeqsp.s b/libsrc/runtime/laddeqsp.s index e5a1f04a9..46c3c1f29 100644 --- a/libsrc/runtime/laddeqsp.s +++ b/libsrc/runtime/laddeqsp.s @@ -4,31 +4,31 @@ ; CC65 runtime: += operator for longs on the stack ; - .export laddeq0sp, laddeqysp - .importzp sp, sreg + .export laddeq0sp, laddeqysp + .importzp sp, sreg laddeq0sp: - ldy #0 + ldy #0 laddeqysp: - clc - adc (sp),y - sta (sp),y - pha - iny - txa - adc (sp),y - sta (sp),y - tax - iny - lda sreg - adc (sp),y - sta (sp),y - sta sreg - iny - lda sreg+1 - adc (sp),y - sta (sp),y - sta sreg+1 - pla - rts + clc + adc (sp),y + sta (sp),y + pha + iny + txa + adc (sp),y + sta (sp),y + tax + iny + lda sreg + adc (sp),y + sta (sp),y + sta sreg + iny + lda sreg+1 + adc (sp),y + sta (sp),y + sta sreg+1 + pla + rts diff --git a/libsrc/runtime/land.s b/libsrc/runtime/land.s index 1e66039e2..506c071a4 100644 --- a/libsrc/runtime/land.s +++ b/libsrc/runtime/land.s @@ -4,9 +4,9 @@ ; CC65 runtime: and on longs ; - .export tosand0ax, tosandeax - .import addysp1 - .importzp sp, sreg, tmp1 + .export tosand0ax, tosandeax + .import addysp1 + .importzp sp, sreg, tmp1 tosand0ax: @@ -15,22 +15,22 @@ tosand0ax: sty sreg+1 tosandeax: - ldy #0 - and (sp),y ; byte 0 - sta tmp1 - iny - txa - and (sp),y ; byte 1 - tax - iny - lda sreg - and (sp),y ; byte 2 - sta sreg - iny - lda sreg+1 - and (sp),y ; byte 3 - sta sreg+1 + ldy #0 + and (sp),y ; byte 0 + sta tmp1 + iny + txa + and (sp),y ; byte 1 + tax + iny + lda sreg + and (sp),y ; byte 2 + sta sreg + iny + lda sreg+1 + and (sp),y ; byte 3 + sta sreg+1 - lda tmp1 - jmp addysp1 + lda tmp1 + jmp addysp1 diff --git a/libsrc/runtime/lasr.s b/libsrc/runtime/lasr.s index c96f1e1f5..cce9a711f 100644 --- a/libsrc/runtime/lasr.s +++ b/libsrc/runtime/lasr.s @@ -11,9 +11,9 @@ ; - .export tosasreax - .import popeax - .importzp sreg, tmp1 + .export tosasreax + .import popeax + .importzp sreg, tmp1 tosasreax: @@ -35,7 +35,7 @@ L2: cpx #$80 ; Copy bit 31 into the carry ror tmp1 ror a dey - bne L2 + bne L2 ; Shift done diff --git a/libsrc/runtime/lbneg.s b/libsrc/runtime/lbneg.s index ca737e426..0b06d1f15 100644 --- a/libsrc/runtime/lbneg.s +++ b/libsrc/runtime/lbneg.s @@ -4,19 +4,19 @@ ; CC65 runtime: boolean negation for longs ; - .export bnegeax - .importzp sreg, tmp1 + .export bnegeax + .importzp sreg, tmp1 bnegeax: - stx tmp1 - ldx #0 ; High byte of result - ora tmp1 - ora sreg - ora sreg+1 - bne @L0 - lda #1 - rts + stx tmp1 + ldx #0 ; High byte of result + ora tmp1 + ora sreg + ora sreg+1 + bne @L0 + lda #1 + rts -@L0: txa ; X is zero - rts +@L0: txa ; X is zero + rts diff --git a/libsrc/runtime/lcmp.s b/libsrc/runtime/lcmp.s index 4e50aa538..d0ba4d81f 100644 --- a/libsrc/runtime/lcmp.s +++ b/libsrc/runtime/lcmp.s @@ -5,52 +5,52 @@ ; Long int compare function - used by the compare operators ; - .export toslcmp - .import incsp4 - .importzp sp, sreg, ptr1 + .export toslcmp + .import incsp4 + .importzp sp, sreg, ptr1 toslcmp: - sta ptr1 - stx ptr1+1 ; EAX now in sreg:ptr1 + sta ptr1 + stx ptr1+1 ; EAX now in sreg:ptr1 - ldy #$03 - lda (sp),y - sec - sbc sreg+1 - bne L4 + ldy #$03 + lda (sp),y + sec + sbc sreg+1 + bne L4 - dey - lda (sp),y - cmp sreg - bne L1 + dey + lda (sp),y + cmp sreg + bne L1 - dey - lda (sp),y - cmp ptr1+1 - bne L1 + dey + lda (sp),y + cmp ptr1+1 + bne L1 - dey - lda (sp),y - cmp ptr1 + dey + lda (sp),y + cmp ptr1 -L1: php ; Save flags - jsr incsp4 ; Drop TOS - plp ; Restore the flags - beq L2 - bcs L3 - lda #$FF ; Set the N flag -L2: rts +L1: php ; Save flags + jsr incsp4 ; Drop TOS + plp ; Restore the flags + beq L2 + bcs L3 + lda #$FF ; Set the N flag +L2: rts -L3: lda #$01 ; Clear the N flag - rts +L3: lda #$01 ; Clear the N flag + rts -L4: bvc L5 - eor #$FF ; Fix the N flag if overflow - ora #$01 ; Clear the Z flag -L5: php ; Save flags - jsr incsp4 ; Drop TOS - plp ; Restore flags - rts +L4: bvc L5 + eor #$FF ; Fix the N flag if overflow + ora #$01 ; Clear the Z flag +L5: php ; Save flags + jsr incsp4 ; Drop TOS + plp ; Restore flags + rts diff --git a/libsrc/runtime/lcompl.s b/libsrc/runtime/lcompl.s index fff31d9af..f856aeaa9 100644 --- a/libsrc/runtime/lcompl.s +++ b/libsrc/runtime/lcompl.s @@ -4,23 +4,23 @@ ; CC65 runtime: long complement ; - .export compleax - .importzp sreg + .export compleax + .importzp sreg ; eax = ~eax compleax: - eor #$FF - pha - txa - eor #$FF - tax - lda sreg - eor #$FF - sta sreg - lda sreg+1 - eor #$FF - sta sreg+1 - pla - rts + eor #$FF + pha + txa + eor #$FF + tax + lda sreg + eor #$FF + sta sreg + lda sreg+1 + eor #$FF + sta sreg+1 + pla + rts diff --git a/libsrc/runtime/ldai.s b/libsrc/runtime/ldai.s index ec3a99610..6d90f0b2c 100644 --- a/libsrc/runtime/ldai.s +++ b/libsrc/runtime/ldai.s @@ -4,16 +4,16 @@ ; CC65 runtime: Load a indirect from address in ax ; - .export ldaidx - .importzp ptr1 + .export ldaidx + .importzp ptr1 -.proc ldaidx - sta ptr1 - stx ptr1+1 - ldx #$00 - lda (ptr1),y - bpl @L1 - dex -@L1: rts +.proc ldaidx + sta ptr1 + stx ptr1+1 + ldx #$00 + lda (ptr1),y + bpl @L1 + dex +@L1: rts .endproc diff --git a/libsrc/runtime/ldau0sp.s b/libsrc/runtime/ldau0sp.s index 0be99d320..a986d52da 100644 --- a/libsrc/runtime/ldau0sp.s +++ b/libsrc/runtime/ldau0sp.s @@ -4,24 +4,24 @@ ; CC65 runtime: Load an unsigned char indirect from pointer somewhere in stack ; - .export ldau00sp, ldau0ysp - .importzp sp, ptr1 + .export ldau00sp, ldau0ysp + .importzp sp, ptr1 .macpack cpu ldau00sp: - ldy #1 + ldy #1 ldau0ysp: - lda (sp),y - sta ptr1+1 - dey - lda (sp),y - sta ptr1 - ldx #0 + lda (sp),y + sta ptr1+1 + dey + lda (sp),y + sta ptr1 + ldx #0 .if (.cpu .bitand CPU_ISET_65SC02) - lda (ptr1) ; Save one cycle for the C02 + lda (ptr1) ; Save one cycle for the C02 .else - lda (ptr1,x) + lda (ptr1,x) .endif - rts + rts diff --git a/libsrc/runtime/ldaui.s b/libsrc/runtime/ldaui.s index b84783df3..aa3a41c17 100644 --- a/libsrc/runtime/ldaui.s +++ b/libsrc/runtime/ldaui.s @@ -4,13 +4,13 @@ ; CC65 runtime: Load a unsigned indirect from address in ax ; - .export ldauidx - .importzp ptr1 + .export ldauidx + .importzp ptr1 -.proc ldauidx - sta ptr1 - stx ptr1+1 - ldx #0 - lda (ptr1),y - rts +.proc ldauidx + sta ptr1 + stx ptr1+1 + ldx #0 + lda (ptr1),y + rts .endproc diff --git a/libsrc/runtime/ldauisp.s b/libsrc/runtime/ldauisp.s index 7e153291c..1afcf2487 100644 --- a/libsrc/runtime/ldauisp.s +++ b/libsrc/runtime/ldauisp.s @@ -4,21 +4,21 @@ ; CC65 runtime: Load an unsigned char indirect from pointer somewhere in stack ; - .export ldaui0sp, ldauiysp - .importzp sp, ptr1 + .export ldaui0sp, ldauiysp + .importzp sp, ptr1 ldaui0sp: - ldy #1 + ldy #1 ldauiysp: - lda (sp),y - sta ptr1+1 - dey - lda (sp),y - sta ptr1 - txa - tay - ldx #0 - lda (ptr1),y - rts + lda (sp),y + sta ptr1+1 + dey + lda (sp),y + sta ptr1 + txa + tay + ldx #0 + lda (ptr1),y + rts - + diff --git a/libsrc/runtime/ldaxi.s b/libsrc/runtime/ldaxi.s index a03c610e4..f2ac653d5 100644 --- a/libsrc/runtime/ldaxi.s +++ b/libsrc/runtime/ldaxi.s @@ -4,16 +4,16 @@ ; CC65 runtime: Load ax indirect from address in ax ; - .export ldaxi, ldaxidx - .importzp ptr1 + .export ldaxi, ldaxidx + .importzp ptr1 -ldaxi: ldy #1 +ldaxi: ldy #1 ldaxidx: - sta ptr1 - stx ptr1+1 - lda (ptr1),y - tax - dey - lda (ptr1),y - rts + sta ptr1 + stx ptr1+1 + lda (ptr1),y + tax + dey + lda (ptr1),y + rts diff --git a/libsrc/runtime/ldaxsp.s b/libsrc/runtime/ldaxsp.s index 0f1a2c8d3..aa94b43cd 100644 --- a/libsrc/runtime/ldaxsp.s +++ b/libsrc/runtime/ldaxsp.s @@ -4,17 +4,17 @@ ; CC65 runtime: Load ax from offset in stack ; - .export ldax0sp, ldaxysp - .importzp sp + .export ldax0sp, ldaxysp + .importzp sp ; Beware: The optimizer knows about the value in Y after return! ldax0sp: - ldy #1 + ldy #1 ldaxysp: - lda (sp),y ; get high byte - tax ; and save it - dey ; point to lo byte - lda (sp),y ; load low byte - rts + lda (sp),y ; get high byte + tax ; and save it + dey ; point to lo byte + lda (sp),y ; load low byte + rts diff --git a/libsrc/runtime/ldeaxi.s b/libsrc/runtime/ldeaxi.s index a1f9e64f9..26b208f84 100644 --- a/libsrc/runtime/ldeaxi.s +++ b/libsrc/runtime/ldeaxi.s @@ -4,22 +4,22 @@ ; CC65 runtime: Load eax indirect from address in ax ; - .export ldeaxidx, ldeaxi - .importzp sreg, ptr1 + .export ldeaxidx, ldeaxi + .importzp sreg, ptr1 -ldeaxi: ldy #3 +ldeaxi: ldy #3 ldeaxidx: - sta ptr1 - stx ptr1+1 - lda (ptr1),y - dey - sta sreg+1 - lda (ptr1),y - dey - sta sreg - lda (ptr1),y - dey - tax - lda (ptr1),y - rts + sta ptr1 + stx ptr1+1 + lda (ptr1),y + dey + sta sreg+1 + lda (ptr1),y + dey + sta sreg + lda (ptr1),y + dey + tax + lda (ptr1),y + rts diff --git a/libsrc/runtime/ldeaxysp.s b/libsrc/runtime/ldeaxysp.s index cf15f3fc4..1d65e9c38 100644 --- a/libsrc/runtime/ldeaxysp.s +++ b/libsrc/runtime/ldeaxysp.s @@ -4,25 +4,25 @@ ; CC65 runtime: Load a long from somewhere in the stack ; ; Beware: The optimizer knows about the register contents after calling -; this function! +; this function! ; - .export ldeax0sp, ldeaxysp - .importzp sreg, sp + .export ldeax0sp, ldeaxysp + .importzp sreg, sp ldeax0sp: - ldy #3 + ldy #3 ldeaxysp: - lda (sp),y - sta sreg+1 - dey - lda (sp),y - sta sreg - dey - lda (sp),y - tax - dey - lda (sp),y - rts + lda (sp),y + sta sreg+1 + dey + lda (sp),y + sta sreg + dey + lda (sp),y + tax + dey + lda (sp),y + rts diff --git a/libsrc/runtime/ldec.s b/libsrc/runtime/ldec.s index a87323e61..53b60095d 100644 --- a/libsrc/runtime/ldec.s +++ b/libsrc/runtime/ldec.s @@ -4,23 +4,23 @@ ; CC65 runtime: Decrement eax by value in Y ; - .export deceaxy - .importzp sreg, tmp1 + .export deceaxy + .importzp sreg, tmp1 deceaxy: - sty tmp1 - sec - sbc tmp1 - sta tmp1 - txa - sbc #0 - tax - lda sreg - sbc #0 - sta sreg - lda sreg+1 - sbc #0 - sta sreg+1 - lda tmp1 - rts + sty tmp1 + sec + sbc tmp1 + sta tmp1 + txa + sbc #0 + tax + lda sreg + sbc #0 + sta sreg + lda sreg+1 + sbc #0 + sta sreg+1 + lda tmp1 + rts diff --git a/libsrc/runtime/ldiv.s b/libsrc/runtime/ldiv.s index 3d8dda0d5..b9ed89716 100644 --- a/libsrc/runtime/ldiv.s +++ b/libsrc/runtime/ldiv.s @@ -7,9 +7,9 @@ ; When negating values, we will ignore the possibility here, that one of the ; values if $80000000, in which case the negate will fail. - .export tosdiv0ax, tosdiveax - .import poplsargs, udiv32, negeax - .importzp sreg, ptr1, tmp1, tmp2 + .export tosdiv0ax, tosdiveax + .import poplsargs, udiv32, negeax + .importzp sreg, ptr1, tmp1, tmp2 tosdiv0ax: ldy #$00 @@ -17,8 +17,8 @@ tosdiv0ax: sty sreg+1 tosdiveax: - jsr poplsargs ; Get arguments from stack, adjust sign - jsr udiv32 ; Do the division, result is in (ptr1:sreg) + jsr poplsargs ; Get arguments from stack, adjust sign + jsr udiv32 ; Do the division, result is in (ptr1:sreg) ldx ptr1+1 ; Load byte 1 of result ; Adjust the sign of the result @@ -29,8 +29,8 @@ tosdiveax: ; Result is negative - lda ptr1 ; Load byte 0 - jmp negeax ; Negate value + lda ptr1 ; Load byte 0 + jmp negeax ; Negate value ; Result is positive diff --git a/libsrc/runtime/le.s b/libsrc/runtime/le.s index a615b3f0a..1a875ecc1 100644 --- a/libsrc/runtime/le.s +++ b/libsrc/runtime/le.s @@ -4,14 +4,14 @@ ; CC65 runtime: Compare <= for signed ints ; - .export tosle00, toslea0, tosleax - .import tosicmp, boolle + .export tosle00, toslea0, tosleax + .import tosicmp, boolle tosle00: - lda #$00 + lda #$00 toslea0: - ldx #$00 + ldx #$00 tosleax: - jsr tosicmp ; Set flags - jmp boolle ; Convert to boolean + jsr tosicmp ; Set flags + jmp boolle ; Convert to boolean diff --git a/libsrc/runtime/leaaxsp.s b/libsrc/runtime/leaaxsp.s index 2a92cf00d..0741170ca 100644 --- a/libsrc/runtime/leaaxsp.s +++ b/libsrc/runtime/leaaxsp.s @@ -4,8 +4,8 @@ ; CC65 runtime: Load effective address with offset in A/X relative to SP ; - .export leaaxsp, leaa0sp - .importzp sp + .export leaaxsp, leaa0sp + .importzp sp leaa0sp: ldx #$00 diff --git a/libsrc/runtime/leave.s b/libsrc/runtime/leave.s index 4846b9efd..8f4e055f5 100644 --- a/libsrc/runtime/leave.s +++ b/libsrc/runtime/leave.s @@ -8,30 +8,30 @@ ; flavours that provide default values for the return val, or drop a local ; stack frame with size in y. - .export leave00, leave0, leavey00, leavey0, leavey - .export leave - .import addysp - .importzp sp + .export leave00, leave0, leavey00, leavey0, leavey + .export leave + .import addysp + .importzp sp leave00: - lda #0 -leave0: ldx #0 - beq leave + lda #0 +leave0: ldx #0 + beq leave leavey00: - lda #0 ; "return 0" + lda #0 ; "return 0" leavey0: - ldx #0 ; return < 256 + ldx #0 ; return < 256 leavey: - jsr addysp ; drop stack frame -leave: pha ; save A a sec - ldy #0 - lda (sp),y ; that's the pushed arg size - sec ; Count the byte, the count's stored in - adc sp - sta sp - bcc L1 - inc sp+1 -L1: pla ; Get return value back - rts + jsr addysp ; drop stack frame +leave: pha ; save A a sec + ldy #0 + lda (sp),y ; that's the pushed arg size + sec ; Count the byte, the count's stored in + adc sp + sta sp + bcc L1 + inc sp+1 +L1: pla ; Get return value back + rts diff --git a/libsrc/runtime/leq.s b/libsrc/runtime/leq.s index 6349caffc..44316aa08 100644 --- a/libsrc/runtime/leq.s +++ b/libsrc/runtime/leq.s @@ -4,12 +4,12 @@ ; CC65 runtime: long equal ; - .export toseqeax - .import toslcmp, booleq + .export toseqeax + .import toslcmp, booleq -toseqeax: - jsr toslcmp ; Set flags - jmp booleq ; Convert to boolean +toseqeax: + jsr toslcmp ; Set flags + jmp booleq ; Convert to boolean diff --git a/libsrc/runtime/lge.s b/libsrc/runtime/lge.s index 1e4df329c..768175cff 100644 --- a/libsrc/runtime/lge.s +++ b/libsrc/runtime/lge.s @@ -4,10 +4,10 @@ ; CC65 runtime: Compare >= for long ints ; - .export tosgeeax - .import toslcmp, boolge + .export tosgeeax + .import toslcmp, boolge tosgeeax: - jsr toslcmp ; Set the flags - jmp boolge ; Convert to boolean + jsr toslcmp ; Set the flags + jmp boolge ; Convert to boolean diff --git a/libsrc/runtime/lgt.s b/libsrc/runtime/lgt.s index aa7157000..a7ff05568 100644 --- a/libsrc/runtime/lgt.s +++ b/libsrc/runtime/lgt.s @@ -4,11 +4,11 @@ ; CC65 runtime: Compare > for long ints ; - .export tosgteax - .import toslcmp, boolgt + .export tosgteax + .import toslcmp, boolgt tosgteax: - jsr toslcmp ; Set the flags - jmp boolgt ; Convert to boolean + jsr toslcmp ; Set the flags + jmp boolgt ; Convert to boolean diff --git a/libsrc/runtime/linc.s b/libsrc/runtime/linc.s index aff3758ee..1a0de38ad 100644 --- a/libsrc/runtime/linc.s +++ b/libsrc/runtime/linc.s @@ -4,21 +4,21 @@ ; CC65 runtime: Increment eax by value in Y ; - .export inceaxy - .importzp ptr4, sreg + .export inceaxy + .importzp ptr4, sreg -.proc inceaxy +.proc inceaxy - sty ptr4 - clc - adc ptr4 - bcc @L9 - inx - bne @L9 - inc sreg - bne @L9 - inc sreg+1 -@L9: rts + sty ptr4 + clc + adc ptr4 + bcc @L9 + inx + bne @L9 + inc sreg + bne @L9 + inc sreg+1 +@L9: rts .endproc diff --git a/libsrc/runtime/lle.s b/libsrc/runtime/lle.s index 6f11e0339..6a73e2103 100644 --- a/libsrc/runtime/lle.s +++ b/libsrc/runtime/lle.s @@ -4,10 +4,10 @@ ; CC65 runtime: Compare <= for long ints ; - .export tosleeax - .import toslcmp, boolle + .export tosleeax + .import toslcmp, boolle tosleeax: - jsr toslcmp ; Set the flags - jmp boolle ; Convert to boolean + jsr toslcmp ; Set the flags + jmp boolle ; Convert to boolean diff --git a/libsrc/runtime/llt.s b/libsrc/runtime/llt.s index 5d5290d34..242664d08 100644 --- a/libsrc/runtime/llt.s +++ b/libsrc/runtime/llt.s @@ -4,9 +4,9 @@ ; CC65 runtime: Compare < for long ints ; - .export toslteax - .import toslcmp, boollt + .export toslteax + .import toslcmp, boollt toslteax: - jsr toslcmp ; Set the flags - jmp boollt ; Convert to boolean + jsr toslcmp ; Set the flags + jmp boollt ; Convert to boolean diff --git a/libsrc/runtime/lmod.s b/libsrc/runtime/lmod.s index 89826ba84..74deb23f0 100644 --- a/libsrc/runtime/lmod.s +++ b/libsrc/runtime/lmod.s @@ -7,9 +7,9 @@ ; When negating values, we will ignore the possibility here, that one of the ; values if $8000, in which case the negate will fail. - .export tosmod0ax, tosmodeax - .import poplsargs, udiv32, negeax - .importzp sreg, ptr1, ptr2, tmp1, tmp3, tmp4 + .export tosmod0ax, tosmodeax + .import poplsargs, udiv32, negeax + .importzp sreg, ptr1, ptr2, tmp1, tmp3, tmp4 tosmod0ax: ldy #$00 @@ -17,17 +17,17 @@ tosmod0ax: sty sreg+1 tosmodeax: - jsr poplsargs ; Get arguments from stack, adjust sign - jsr udiv32 ; Do the division, remainder is in (ptr2:tmp3:tmp4) + jsr poplsargs ; Get arguments from stack, adjust sign + jsr udiv32 ; Do the division, remainder is in (ptr2:tmp3:tmp4) ; Load the result lda ptr2 - ldx ptr2+1 - ldy tmp3 - sty sreg - ldy tmp4 - sty sreg+1 + ldx ptr2+1 + ldy tmp3 + sty sreg + ldy tmp4 + sty sreg+1 ; Check the sign of the result. It is the sign of the left operand. diff --git a/libsrc/runtime/lmul.s b/libsrc/runtime/lmul.s index 44a46b5aa..7ad2b2aa4 100644 --- a/libsrc/runtime/lmul.s +++ b/libsrc/runtime/lmul.s @@ -4,9 +4,9 @@ ; CC65 runtime: multiplication for long (unsigned) ints ; - .export tosumul0ax, tosumuleax, tosmul0ax, tosmuleax - .import addysp1 - .importzp sp, sreg, tmp1, tmp2, tmp3, tmp4, ptr1, ptr3, ptr4 + .export tosumul0ax, tosumuleax, tosmul0ax, tosmuleax + .import addysp1 + .importzp sp, sreg, tmp1, tmp2, tmp3, tmp4, ptr1, ptr3, ptr4 tosmul0ax: tosumul0ax: @@ -16,54 +16,54 @@ tosumul0ax: tosmuleax: tosumuleax: -mul32: sta ptr1 - stx ptr1+1 ; op2 now in ptr1/sreg - ldy #0 - lda (sp),y - sta ptr3 - iny - lda (sp),y - sta ptr3+1 - iny - lda (sp),y - sta ptr4 - iny - lda (sp),y - sta ptr4+1 ; op1 in pre3/ptr4 - jsr addysp1 ; Drop TOS +mul32: sta ptr1 + stx ptr1+1 ; op2 now in ptr1/sreg + ldy #0 + lda (sp),y + sta ptr3 + iny + lda (sp),y + sta ptr3+1 + iny + lda (sp),y + sta ptr4 + iny + lda (sp),y + sta ptr4+1 ; op1 in pre3/ptr4 + jsr addysp1 ; Drop TOS ; Do (ptr1:sreg)*(ptr3:ptr4) --> EAX. - lda #0 - sta tmp4 - sta tmp3 - sta tmp2 - ldy #32 -L0: lsr tmp4 - ror tmp3 - ror tmp2 - ror a - ror sreg+1 - ror sreg - ror ptr1+1 - ror ptr1 - bcc L1 - clc - adc ptr3 - pha - lda ptr3+1 - adc tmp2 - sta tmp2 - lda ptr4 - adc tmp3 - sta tmp3 - lda ptr4+1 - adc tmp4 - sta tmp4 - pla -L1: dey - bpl L0 - lda ptr1 ; Load the low result word - ldx ptr1+1 - rts + lda #0 + sta tmp4 + sta tmp3 + sta tmp2 + ldy #32 +L0: lsr tmp4 + ror tmp3 + ror tmp2 + ror a + ror sreg+1 + ror sreg + ror ptr1+1 + ror ptr1 + bcc L1 + clc + adc ptr3 + pha + lda ptr3+1 + adc tmp2 + sta tmp2 + lda ptr4 + adc tmp3 + sta tmp3 + lda ptr4+1 + adc tmp4 + sta tmp4 + pla +L1: dey + bpl L0 + lda ptr1 ; Load the low result word + ldx ptr1+1 + rts diff --git a/libsrc/runtime/lne.s b/libsrc/runtime/lne.s index e0f048579..58ae99acc 100644 --- a/libsrc/runtime/lne.s +++ b/libsrc/runtime/lne.s @@ -4,11 +4,11 @@ ; CC65 runtime: long not equal ; - .export tosneeax - .import toslcmp, boolne + .export tosneeax + .import toslcmp, boolne tosneeax: - jsr toslcmp ; Set flags - jmp boolne ; Convert to boolean + jsr toslcmp ; Set flags + jmp boolne ; Convert to boolean diff --git a/libsrc/runtime/lneg.s b/libsrc/runtime/lneg.s index 12b744b48..a5c11c6af 100644 --- a/libsrc/runtime/lneg.s +++ b/libsrc/runtime/lneg.s @@ -7,25 +7,25 @@ ; ; eax = -eax ; - .export negeax - .importzp sreg + .export negeax + .importzp sreg -negeax: clc - eor #$FF - adc #1 - pha - txa - eor #$FF - adc #0 - tax - lda sreg - eor #$FF - adc #0 - sta sreg - lda sreg+1 - eor #$FF - adc #0 - sta sreg+1 - pla - rts +negeax: clc + eor #$FF + adc #1 + pha + txa + eor #$FF + adc #0 + tax + lda sreg + eor #$FF + adc #0 + sta sreg + lda sreg+1 + eor #$FF + adc #0 + sta sreg+1 + pla + rts diff --git a/libsrc/runtime/lor.s b/libsrc/runtime/lor.s index 841154b1d..a74b33059 100644 --- a/libsrc/runtime/lor.s +++ b/libsrc/runtime/lor.s @@ -4,9 +4,9 @@ ; CC65 runtime: or on longs ; - .export tosor0ax, tosoreax - .import addysp1 - .importzp sp, sreg, tmp1 + .export tosor0ax, tosoreax + .import addysp1 + .importzp sp, sreg, tmp1 tosor0ax: @@ -15,22 +15,22 @@ tosor0ax: sty sreg+1 tosoreax: - ldy #0 - ora (sp),y ; byte 0 - sta tmp1 - iny - txa - ora (sp),y ; byte 1 - tax - iny - lda sreg - ora (sp),y ; byte 2 - sta sreg - iny - lda sreg+1 - ora (sp),y ; byte 3 - sta sreg+1 + ldy #0 + ora (sp),y ; byte 0 + sta tmp1 + iny + txa + ora (sp),y ; byte 1 + tax + iny + lda sreg + ora (sp),y ; byte 2 + sta sreg + iny + lda sreg+1 + ora (sp),y ; byte 3 + sta sreg+1 - lda tmp1 - jmp addysp1 + lda tmp1 + jmp addysp1 diff --git a/libsrc/runtime/lpop.s b/libsrc/runtime/lpop.s index ff0d59b9b..7d281db52 100644 --- a/libsrc/runtime/lpop.s +++ b/libsrc/runtime/lpop.s @@ -4,22 +4,22 @@ ; CC65 runtime: long pop ; - .export popeax - .import incsp4 - .importzp sp, sreg + .export popeax + .import incsp4 + .importzp sp, sreg -popeax: ldy #3 - lda (sp),y - sta sreg+1 - dey - lda (sp),y - sta sreg - dey - lda (sp),y - tax - dey - lda (sp),y - jmp incsp4 +popeax: ldy #3 + lda (sp),y + sta sreg+1 + dey + lda (sp),y + sta sreg + dey + lda (sp),y + tax + dey + lda (sp),y + jmp incsp4 diff --git a/libsrc/runtime/lpush.s b/libsrc/runtime/lpush.s index 0d75085fc..074b4320a 100644 --- a/libsrc/runtime/lpush.s +++ b/libsrc/runtime/lpush.s @@ -7,31 +7,31 @@ ; ; push eax on stack ; - .export pushl0, push0ax, pusheax - .import decsp4 - .importzp sp, sreg + .export pushl0, push0ax, pusheax + .import decsp4 + .importzp sp, sreg pushl0: lda #0 tax push0ax: - ldy #0 - sty sreg - sty sreg+1 + ldy #0 + sty sreg + sty sreg+1 pusheax: - pha ; decsp will destroy A (but not X) - jsr decsp4 - ldy #3 - lda sreg+1 - sta (sp),y - dey - lda sreg - sta (sp),y - dey - txa - sta (sp),y - dey - pla - sta (sp),y - rts + pha ; decsp will destroy A (but not X) + jsr decsp4 + ldy #3 + lda sreg+1 + sta (sp),y + dey + lda sreg + sta (sp),y + dey + txa + sta (sp),y + dey + pla + sta (sp),y + rts diff --git a/libsrc/runtime/lrsub.s b/libsrc/runtime/lrsub.s index 7dfe43ac5..fd519ca4f 100644 --- a/libsrc/runtime/lrsub.s +++ b/libsrc/runtime/lrsub.s @@ -7,9 +7,9 @@ ; ; EAX = EAX - TOS ; - .export tosrsub0ax, tosrsubeax - .import addysp1 - .importzp sp, sreg, tmp1 + .export tosrsub0ax, tosrsubeax + .import addysp1 + .importzp sp, sreg, tmp1 tosrsub0ax: ldy #$00 @@ -17,22 +17,22 @@ tosrsub0ax: sty sreg+1 tosrsubeax: - ldy #0 - sec - sbc (sp),y ; byte 0 - sta tmp1 ; use as temp storage - txa - iny - sbc (sp),y ; byte 1 - tax - iny - lda sreg - sbc (sp),y ; byte 2 - sta sreg - iny - lda sreg+1 - sbc (sp),y ; byte 3 - sta sreg+1 - lda tmp1 - jmp addysp1 ; drop TOS + ldy #0 + sec + sbc (sp),y ; byte 0 + sta tmp1 ; use as temp storage + txa + iny + sbc (sp),y ; byte 1 + tax + iny + lda sreg + sbc (sp),y ; byte 2 + sta sreg + iny + lda sreg+1 + sbc (sp),y ; byte 3 + sta sreg+1 + lda tmp1 + jmp addysp1 ; drop TOS diff --git a/libsrc/runtime/lsave.s b/libsrc/runtime/lsave.s index e9ccfc32f..fa21e463e 100644 --- a/libsrc/runtime/lsave.s +++ b/libsrc/runtime/lsave.s @@ -4,25 +4,25 @@ ; CC65 runtime: save ax into temp storage/restore ax from temp storage ; - .export saveeax, resteax - .importzp sreg, regsave + .export saveeax, resteax + .importzp sreg, regsave saveeax: - sta regsave - stx regsave+1 - lda sreg - sta regsave+2 - lda sreg+1 - sta regsave+3 - lda regsave - rts + sta regsave + stx regsave+1 + lda sreg + sta regsave+2 + lda sreg+1 + sta regsave+3 + lda regsave + rts resteax: - lda regsave+3 - sta sreg+1 - lda regsave+2 - sta sreg - ldx regsave+1 - lda regsave - rts + lda regsave+3 + sta sreg+1 + lda regsave+2 + sta sreg + ldx regsave+1 + lda regsave + rts diff --git a/libsrc/runtime/lshelp.s b/libsrc/runtime/lshelp.s index a17f12fd1..8a2fca139 100644 --- a/libsrc/runtime/lshelp.s +++ b/libsrc/runtime/lshelp.s @@ -7,59 +7,59 @@ ; When negating values, we will ignore the possibility here, that one of the ; values if $80000000, in which case the negate will fail. - .export poplsargs - .import getlop - .importzp sreg, tmp1, tmp2, ptr1, ptr3, ptr4 + .export poplsargs + .import getlop + .importzp sreg, tmp1, tmp2, ptr1, ptr3, ptr4 poplsargs: - jsr getlop ; Get the operands + jsr getlop ; Get the operands ; Remember the signs of the operands (that is, the high bytes) in tmp1 and ; tmp2. Make both operands positive. - lda sreg+1 ; Is the left operand negative? + lda sreg+1 ; Is the left operand negative? sta tmp1 ; Remember the sign for later - bpl L1 ; Jump if not + bpl L1 ; Jump if not - clc ; Make it positive - lda ptr1 - eor #$FF - adc #$01 - sta ptr1 - lda ptr1+1 - eor #$FF - adc #$00 - sta ptr1+1 - lda sreg - eor #$FF - adc #$00 - sta sreg - lda sreg+1 - eor #$FF - adc #$00 - sta sreg+1 + clc ; Make it positive + lda ptr1 + eor #$FF + adc #$01 + sta ptr1 + lda ptr1+1 + eor #$FF + adc #$00 + sta ptr1+1 + lda sreg + eor #$FF + adc #$00 + sta sreg + lda sreg+1 + eor #$FF + adc #$00 + sta sreg+1 -L1: lda ptr4+1 ; Is the right operand nagative? +L1: lda ptr4+1 ; Is the right operand nagative? sta tmp2 ; Remember the sign for later - bpl L2 ; Jump if not + bpl L2 ; Jump if not - clc ; Make it positive - lda ptr3 - eor #$FF - adc #$01 - sta ptr3 - lda ptr3+1 - eor #$FF - adc #$00 - sta ptr3+1 - lda ptr4 - eor #$FF - adc #$00 - sta ptr4 - lda ptr4+1 - eor #$FF - adc #$00 - sta ptr4+1 + clc ; Make it positive + lda ptr3 + eor #$FF + adc #$01 + sta ptr3 + lda ptr3+1 + eor #$FF + adc #$00 + sta ptr3+1 + lda ptr4 + eor #$FF + adc #$00 + sta ptr4 + lda ptr4+1 + eor #$FF + adc #$00 + sta ptr4+1 -L2: rts +L2: rts diff --git a/libsrc/runtime/lshl.s b/libsrc/runtime/lshl.s index 3c4e7080b..78c065eb2 100644 --- a/libsrc/runtime/lshl.s +++ b/libsrc/runtime/lshl.s @@ -11,9 +11,9 @@ ; - .export tosasleax, tosshleax - .import popeax - .importzp sreg, tmp1 + .export tosasleax, tosshleax + .import popeax + .importzp sreg, tmp1 tosshleax: @@ -29,12 +29,12 @@ tosasleax: ; Do the actual shift. Faster solutions are possible but need a lot more code. -L2: asl a - rol tmp1 - rol sreg - rol sreg+1 +L2: asl a + rol tmp1 + rol sreg + rol sreg+1 dey - bne L2 + bne L2 ; Shift done diff --git a/libsrc/runtime/lshr.s b/libsrc/runtime/lshr.s index 9c2a6e3a8..09d585abd 100644 --- a/libsrc/runtime/lshr.s +++ b/libsrc/runtime/lshr.s @@ -11,9 +11,9 @@ ; - .export tosshreax - .import popeax - .importzp sreg, tmp1 + .export tosshreax + .import popeax + .importzp sreg, tmp1 tosshreax: @@ -29,11 +29,11 @@ tosshreax: ; Do the actual shift. Faster solutions are possible but need a lot more code. L2: lsr sreg+1 - ror sreg - ror tmp1 + ror sreg + ror tmp1 ror a dey - bne L2 + bne L2 ; Shift done diff --git a/libsrc/runtime/lsub.s b/libsrc/runtime/lsub.s index 30ae49da1..926d52e51 100644 --- a/libsrc/runtime/lsub.s +++ b/libsrc/runtime/lsub.s @@ -7,9 +7,9 @@ ; ; EAX = TOS - EAX ; - .export tossub0ax, tossubeax - .import addysp1 - .importzp sp, sreg + .export tossub0ax, tossubeax + .import addysp1 + .importzp sp, sreg .macpack cpu @@ -19,29 +19,29 @@ tossub0ax: sty sreg+1 tossubeax: - sec - eor #$FF + sec + eor #$FF .if (.cpu .bitand CPU_ISET_65SC02) - adc (sp) ; 65SC02 version - saves 2 cycles - ldy #1 + adc (sp) ; 65SC02 version - saves 2 cycles + ldy #1 .else - ldy #0 - adc (sp),y ; lo byte - iny + ldy #0 + adc (sp),y ; lo byte + iny .endif - pha ; Save low byte - txa - eor #$FF - adc (sp),y ; byte 1 - tax - iny - lda (sp),y - sbc sreg ; byte 2 - sta sreg - iny - lda (sp),y - sbc sreg+1 ; byte 3 - sta sreg+1 - pla ; Restore byte 0 - jmp addysp1 ; Drop TOS + pha ; Save low byte + txa + eor #$FF + adc (sp),y ; byte 1 + tax + iny + lda (sp),y + sbc sreg ; byte 2 + sta sreg + iny + lda (sp),y + sbc sreg+1 ; byte 3 + sta sreg+1 + pla ; Restore byte 0 + jmp addysp1 ; Drop TOS diff --git a/libsrc/runtime/lsubeq.s b/libsrc/runtime/lsubeq.s index acc6a2861..9f5853d29 100644 --- a/libsrc/runtime/lsubeq.s +++ b/libsrc/runtime/lsubeq.s @@ -1,4 +1,4 @@ -; +; ; Ullrich von Bassewitz, 07.04.2000 ; ; CC65 runtime: -= operator @@ -7,49 +7,49 @@ ; in ptr1, the high byte is in Y, and the decrement is in eax. ; - .export lsubeq1, lsubeqa, lsubeq - .importzp sreg, ptr1 + .export lsubeq1, lsubeqa, lsubeq + .importzp sreg, ptr1 lsubeq1: - lda #$01 + lda #$01 lsubeqa: - ldx #$00 - stx sreg - stx sreg+1 + ldx #$00 + stx sreg + stx sreg+1 -lsubeq: sty ptr1+1 ; Store high byte of address - ldy #$00 ; Address low byte - sec +lsubeq: sty ptr1+1 ; Store high byte of address + ldy #$00 ; Address low byte + sec - eor #$FF - adc (ptr1),y ; Subtract byte 0 - sta (ptr1),y - pha ; Save byte 0 of result for later + eor #$FF + adc (ptr1),y ; Subtract byte 0 + sta (ptr1),y + pha ; Save byte 0 of result for later - iny ; Address byte 1 - txa - eor #$FF - adc (ptr1),y ; Subtract byte 1 - sta (ptr1),y - tax + iny ; Address byte 1 + txa + eor #$FF + adc (ptr1),y ; Subtract byte 1 + sta (ptr1),y + tax - iny ; Address byte 2 - lda (ptr1),y - sbc sreg - sta (ptr1),y - sta sreg + iny ; Address byte 2 + lda (ptr1),y + sbc sreg + sta (ptr1),y + sta sreg - iny ; Address byte 3 - lda (ptr1),y - sbc sreg+1 - sta (ptr1),y - sta sreg+1 + iny ; Address byte 3 + lda (ptr1),y + sbc sreg+1 + sta (ptr1),y + sta sreg+1 - pla ; Retrieve byte 0 of result + pla ; Retrieve byte 0 of result - rts ; Done + rts ; Done diff --git a/libsrc/runtime/lsubeqsp.s b/libsrc/runtime/lsubeqsp.s index c679c8806..f32930c69 100644 --- a/libsrc/runtime/lsubeqsp.s +++ b/libsrc/runtime/lsubeqsp.s @@ -4,33 +4,33 @@ ; CC65 runtime: -= operator for longs on the stack ; - .export lsubeq0sp, lsubeqysp - .importzp sp, sreg + .export lsubeq0sp, lsubeqysp + .importzp sp, sreg lsubeq0sp: - ldy #0 + ldy #0 lsubeqysp: - sec - eor #$FF - adc (sp),y - sta (sp),y - pha ; Save low byte - iny - txa - eor #$FF - adc (sp),y - sta (sp),y - tax - iny - lda (sp),y - sbc sreg - sta (sp),y - sta sreg - iny - lda (sp),y - sbc sreg+1 - sta (sp),y - sta sreg+1 - pla - rts + sec + eor #$FF + adc (sp),y + sta (sp),y + pha ; Save low byte + iny + txa + eor #$FF + adc (sp),y + sta (sp),y + tax + iny + lda (sp),y + sbc sreg + sta (sp),y + sta sreg + iny + lda (sp),y + sbc sreg+1 + sta (sp),y + sta sreg+1 + pla + rts diff --git a/libsrc/runtime/lt.s b/libsrc/runtime/lt.s index 1b681f588..f42a0e7fa 100644 --- a/libsrc/runtime/lt.s +++ b/libsrc/runtime/lt.s @@ -4,14 +4,14 @@ ; CC65 runtime: Compare < for signed ints ; - .export toslt00, toslta0, tosltax - .import tosicmp, boollt + .export toslt00, toslta0, tosltax + .import tosicmp, boollt toslt00: - lda #$00 + lda #$00 toslta0: - ldx #$00 + ldx #$00 tosltax: - jsr tosicmp ; Set flags - jmp boollt ; Convert to boolean + jsr tosicmp ; Set flags + jmp boollt ; Convert to boolean diff --git a/libsrc/runtime/ltest.s b/libsrc/runtime/ltest.s index 2c6630042..6027b8dd4 100644 --- a/libsrc/runtime/ltest.s +++ b/libsrc/runtime/ltest.s @@ -4,19 +4,19 @@ ; CC65 runtime: test long in eax ; - .export utsteax, tsteax - .importzp sreg, tmp1 + .export utsteax, tsteax + .importzp sreg, tmp1 tsteax: utsteax: - tay ; Save value - stx tmp1 - ora tmp1 - ora sreg - ora sreg+1 - beq L9 - tya - ldy #1 ; Force NE -L9: rts + tay ; Save value + stx tmp1 + ora tmp1 + ora sreg + ora sreg+1 + beq L9 + tya + ldy #1 ; Force NE +L9: rts diff --git a/libsrc/runtime/ludiv.s b/libsrc/runtime/ludiv.s index aa40a9620..149c98a78 100644 --- a/libsrc/runtime/ludiv.s +++ b/libsrc/runtime/ludiv.s @@ -4,9 +4,9 @@ ; CC65 runtime: division for long unsigned ints ; - .export tosudiv0ax, tosudiveax, getlop, udiv32 - .import addysp1 - .importzp sp, sreg, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4 + .export tosudiv0ax, tosudiveax, getlop, udiv32 + .import addysp1 + .importzp sp, sreg, tmp3, tmp4, ptr1, ptr2, ptr3, ptr4 tosudiv0ax: ldy #$00 @@ -14,85 +14,85 @@ tosudiv0ax: sty sreg+1 tosudiveax: - jsr getlop ; Get the paramameters - jsr udiv32 ; Do the division - lda ptr1 ; Result is in ptr1:sreg - ldx ptr1+1 - rts + jsr getlop ; Get the paramameters + jsr udiv32 ; Do the division + lda ptr1 ; Result is in ptr1:sreg + ldx ptr1+1 + rts ; Pop the parameters for the long division and put it into the relevant ; memory cells. Called from the signed divisions also. -getlop: sta ptr3 ; Put right operand in place - stx ptr3+1 - lda sreg - sta ptr4 - lda sreg+1 - sta ptr4+1 +getlop: sta ptr3 ; Put right operand in place + stx ptr3+1 + lda sreg + sta ptr4 + lda sreg+1 + sta ptr4+1 - ldy #0 ; Put left operand in place - lda (sp),y - sta ptr1 - iny - lda (sp),y - sta ptr1+1 - iny - lda (sp),y - sta sreg - iny - lda (sp),y - sta sreg+1 - jmp addysp1 ; Drop parameters + ldy #0 ; Put left operand in place + lda (sp),y + sta ptr1 + iny + lda (sp),y + sta ptr1+1 + iny + lda (sp),y + sta sreg + iny + lda (sp),y + sta sreg+1 + jmp addysp1 ; Drop parameters ; Do (ptr1:sreg) / (ptr3:ptr4) --> (ptr1:sreg), remainder in (ptr2:tmp3:tmp4) ; This is also the entry point for the signed division -udiv32: lda #0 - sta ptr2+1 - sta tmp3 - sta tmp4 -; sta ptr1+1 - ldy #32 -L0: asl ptr1 - rol ptr1+1 - rol sreg - rol sreg+1 - rol a - rol ptr2+1 - rol tmp3 - rol tmp4 +udiv32: lda #0 + sta ptr2+1 + sta tmp3 + sta tmp4 +; sta ptr1+1 + ldy #32 +L0: asl ptr1 + rol ptr1+1 + rol sreg + rol sreg+1 + rol a + rol ptr2+1 + rol tmp3 + rol tmp4 ; Do a subtraction. we do not have enough space to store the intermediate ; result, so we may have to do the subtraction twice. - pha - cmp ptr3 - lda ptr2+1 - sbc ptr3+1 - lda tmp3 - sbc ptr4 - lda tmp4 - sbc ptr4+1 - bcc L1 + pha + cmp ptr3 + lda ptr2+1 + sbc ptr3+1 + lda tmp3 + sbc ptr4 + lda tmp4 + sbc ptr4+1 + bcc L1 ; Overflow, do the subtraction again, this time store the result - sta tmp4 ; We have the high byte already - pla - sbc ptr3 ; byte 0 - pha - lda ptr2+1 - sbc ptr3+1 - sta ptr2+1 ; byte 1 - lda tmp3 - sbc ptr4 - sta tmp3 ; byte 2 - inc ptr1 ; Set result bit + sta tmp4 ; We have the high byte already + pla + sbc ptr3 ; byte 0 + pha + lda ptr2+1 + sbc ptr3+1 + sta ptr2+1 ; byte 1 + lda tmp3 + sbc ptr4 + sta tmp3 ; byte 2 + inc ptr1 ; Set result bit -L1: pla - dey - bne L0 - sta ptr2 - rts +L1: pla + dey + bne L0 + sta ptr2 + rts diff --git a/libsrc/runtime/luge.s b/libsrc/runtime/luge.s index 541ff4852..38e06f0c6 100644 --- a/libsrc/runtime/luge.s +++ b/libsrc/runtime/luge.s @@ -4,10 +4,10 @@ ; CC65 runtime: Compare >= for long unsigneds ; - .export tosugeeax - .import toslcmp, booluge + .export tosugeeax + .import toslcmp, booluge tosugeeax: - jsr toslcmp ; Set the flags - jmp booluge ; Convert to boolean + jsr toslcmp ; Set the flags + jmp booluge ; Convert to boolean diff --git a/libsrc/runtime/lugt.s b/libsrc/runtime/lugt.s index 19cbcc0fa..19254e94c 100644 --- a/libsrc/runtime/lugt.s +++ b/libsrc/runtime/lugt.s @@ -4,11 +4,11 @@ ; CC65 runtime: Compare > for long unsigneds ; - .export tosugteax - .import toslcmp, boolugt + .export tosugteax + .import toslcmp, boolugt tosugteax: - jsr toslcmp ; Set the flags - jmp boolugt ; Convert to boolean + jsr toslcmp ; Set the flags + jmp boolugt ; Convert to boolean diff --git a/libsrc/runtime/lule.s b/libsrc/runtime/lule.s index d898979d5..5a802c9e1 100644 --- a/libsrc/runtime/lule.s +++ b/libsrc/runtime/lule.s @@ -4,10 +4,10 @@ ; CC65 runtime: Compare <= for long unsigneds ; - .export tosuleeax - .import toslcmp, boolule + .export tosuleeax + .import toslcmp, boolule tosuleeax: - jsr toslcmp ; Set the flags - jmp boolule ; Convert to boolean + jsr toslcmp ; Set the flags + jmp boolule ; Convert to boolean diff --git a/libsrc/runtime/lult.s b/libsrc/runtime/lult.s index f13735eb1..905ff1d46 100644 --- a/libsrc/runtime/lult.s +++ b/libsrc/runtime/lult.s @@ -4,9 +4,9 @@ ; CC65 runtime: Compare < for long unsigneds ; - .export tosulteax - .import toslcmp, boolult + .export tosulteax + .import toslcmp, boolult tosulteax: - jsr toslcmp ; Set the flags - jmp boolult ; Convert to boolean + jsr toslcmp ; Set the flags + jmp boolult ; Convert to boolean diff --git a/libsrc/runtime/lumod.s b/libsrc/runtime/lumod.s index 3128bc078..e290e1167 100644 --- a/libsrc/runtime/lumod.s +++ b/libsrc/runtime/lumod.s @@ -4,9 +4,9 @@ ; CC65 runtime: modulo operation for long unsigned ints ; - .export tosumod0ax, tosumodeax - .import getlop, udiv32 - .importzp sreg, tmp3, tmp4, ptr2 + .export tosumod0ax, tosumodeax + .import getlop, udiv32 + .importzp sreg, tmp3, tmp4, ptr2 tosumod0ax: ldy #$00 @@ -14,13 +14,13 @@ tosumod0ax: sty sreg+1 tosumodeax: - jsr getlop ; Get the paramameters - jsr udiv32 ; Do the division - lda tmp3 ; Remainder is in ptr2:tmp3:tmp4 - sta sreg - lda tmp4 - sta sreg+1 - lda ptr2 - ldx ptr2+1 - rts + jsr getlop ; Get the paramameters + jsr udiv32 ; Do the division + lda tmp3 ; Remainder is in ptr2:tmp3:tmp4 + sta sreg + lda tmp4 + sta sreg+1 + lda ptr2 + ldx ptr2+1 + rts diff --git a/libsrc/runtime/lxor.s b/libsrc/runtime/lxor.s index 46086fbc4..ce21ef35b 100644 --- a/libsrc/runtime/lxor.s +++ b/libsrc/runtime/lxor.s @@ -4,9 +4,9 @@ ; CC65 runtime: xor on longs ; - .export tosxor0ax, tosxoreax - .import addysp1 - .importzp sp, sreg, tmp1 + .export tosxor0ax, tosxoreax + .import addysp1 + .importzp sp, sreg, tmp1 tosxor0ax: ldy #$00 @@ -14,24 +14,24 @@ tosxor0ax: sty sreg+1 tosxoreax: - ldy #0 - eor (sp),y ; byte 0 - sta tmp1 - iny - txa - eor (sp),y ; byte 1 - tax - iny - lda sreg - eor (sp),y ; byte 2 - sta sreg - iny - lda sreg+1 - eor (sp),y ; byte 3 - sta sreg+1 + ldy #0 + eor (sp),y ; byte 0 + sta tmp1 + iny + txa + eor (sp),y ; byte 1 + tax + iny + lda sreg + eor (sp),y ; byte 2 + sta sreg + iny + lda sreg+1 + eor (sp),y ; byte 3 + sta sreg+1 - lda tmp1 - jmp addysp1 + lda tmp1 + jmp addysp1 diff --git a/libsrc/runtime/makebool.s b/libsrc/runtime/makebool.s index 3429ff0bc..a15b24b93 100644 --- a/libsrc/runtime/makebool.s +++ b/libsrc/runtime/makebool.s @@ -4,57 +4,57 @@ ; CC65 runtime: Make boolean according to flags ; - .export boolne, booleq, boollt, boolle, boolgt, boolge - .export boolult, boolule, boolugt, booluge + .export boolne, booleq, boollt, boolle, boolgt, boolge + .export boolult, boolule, boolugt, booluge -boolne: bne ret1 - ldx #$00 - txa - rts +boolne: bne ret1 + ldx #$00 + txa + rts -booleq: beq ret1 - ldx #$00 - txa - rts +booleq: beq ret1 + ldx #$00 + txa + rts -boolle: beq ret1 -boollt: bmi ret1 - ldx #$00 - txa - rts +boolle: beq ret1 +boollt: bmi ret1 + ldx #$00 + txa + rts -boolgt: beq L0 -boolge: bpl ret1 -L0: ldx #$00 - txa - rts +boolgt: beq L0 +boolge: bpl ret1 +L0: ldx #$00 + txa + rts boolule: - beq ret1 + beq ret1 boolult: - bcc ret1 - ldx #$00 - txa - rts + bcc ret1 + ldx #$00 + txa + rts boolugt: - beq L1 + beq L1 booluge: - bcs ret1 -L1: ldx #$00 - txa - rts + bcs ret1 +L1: ldx #$00 + txa + rts -ret1: ldx #$00 - lda #$01 - rts +ret1: ldx #$00 + lda #$01 + rts diff --git a/libsrc/runtime/mod.s b/libsrc/runtime/mod.s index c5565a852..c4331ed85 100644 --- a/libsrc/runtime/mod.s +++ b/libsrc/runtime/mod.s @@ -7,17 +7,17 @@ ; When negating values, we will ignore the possibility here, that one of the ; values if $8000, in which case the negate will fail. - .export tosmoda0, tosmodax - .import popsargs, udiv16, negax - .importzp ptr1, tmp1 + .export tosmoda0, tosmodax + .import popsargs, udiv16, negax + .importzp ptr1, tmp1 tosmoda0: - ldx #0 + ldx #0 tosmodax: - jsr popsargs ; Get arguments from stack, adjust sign - jsr udiv16 ; Do the division + jsr popsargs ; Get arguments from stack, adjust sign + jsr udiv16 ; Do the division lda ptr1 ; Load low byte of result - ldx ptr1+1 ; Load high byte of result + ldx ptr1+1 ; Load high byte of result ; Adjust the sign of the result. tmp1 contains the high byte of the left ; operand, tmp2 contains the high byte of the right operand. The sign of diff --git a/libsrc/runtime/mul.s b/libsrc/runtime/mul.s index eaf1fb97b..6344e3a32 100644 --- a/libsrc/runtime/mul.s +++ b/libsrc/runtime/mul.s @@ -4,10 +4,10 @@ ; CC65 runtime: multiplication for ints ; - .export tosumulax, tosmulax + .export tosumulax, tosmulax .import mul8x16, mul8x16a ; in mul8.s - .import popsreg - .importzp sreg, tmp1, ptr4 + .import popsreg + .importzp sreg, tmp1, ptr4 ;--------------------------------------------------------------------------- @@ -15,42 +15,42 @@ tosmulax: tosumulax: - sta ptr4 + sta ptr4 txa ; High byte zero beq @L3 ; Do 8x16 multiplication if high byte zero - stx ptr4+1 ; Save right operand - jsr popsreg ; Get left operand + stx ptr4+1 ; Save right operand + jsr popsreg ; Get left operand ; Do ptr4:ptr4+1 * sreg:sreg+1 --> AX - lda #0 - ldx sreg+1 ; Get high byte into register for speed + lda #0 + ldx sreg+1 ; Get high byte into register for speed beq @L4 ; -> we can do 8x16 after swap - sta tmp1 - ldy #16 ; Number of bits + sta tmp1 + ldy #16 ; Number of bits lsr ptr4+1 ror ptr4 ; Get first bit into carry @L0: bcc @L1 - clc - adc sreg - pha - txa ; hi byte of left op - adc tmp1 - sta tmp1 - pla + clc + adc sreg + pha + txa ; hi byte of left op + adc tmp1 + sta tmp1 + pla @L1: ror tmp1 - ror a - ror ptr4+1 - ror ptr4 + ror a + ror ptr4+1 + ror ptr4 dey bne @L0 - lda ptr4 ; Load the result - ldx ptr4+1 - rts ; Done + lda ptr4 ; Load the result + ldx ptr4+1 + rts ; Done ; High byte of rhs is zero, jump to the 8x16 routine instead diff --git a/libsrc/runtime/mul8.s b/libsrc/runtime/mul8.s index 3287e2155..9d4dfcbf4 100644 --- a/libsrc/runtime/mul8.s +++ b/libsrc/runtime/mul8.s @@ -4,10 +4,10 @@ ; CC65 runtime: multiplication for ints. Short versions. ; - .export tosumula0, tosmula0 + .export tosumula0, tosmula0 .export mul8x16, mul8x16a - .import popsreg - .importzp sreg, ptr4 + .import popsreg + .importzp sreg, ptr4 ;--------------------------------------------------------------------------- @@ -15,30 +15,30 @@ tosmula0: tosumula0: - sta ptr4 -mul8x16:jsr popsreg ; Get left operand + sta ptr4 +mul8x16:jsr popsreg ; Get left operand - lda #0 ; Clear byte 1 - ldy #8 ; Number of bits - ldx sreg+1 ; Get into register for speed + lda #0 ; Clear byte 1 + ldy #8 ; Number of bits + ldx sreg+1 ; Get into register for speed beq mul8x8 ; Do 8x8 multiplication if high byte zero mul8x16a: - sta ptr4+1 ; Clear byte 2 + sta ptr4+1 ; Clear byte 2 lsr ptr4 ; Get first bit into carry @L0: bcc @L1 - clc - adc sreg - pha - txa ; hi byte of left op - adc ptr4+1 - sta ptr4+1 - pla + clc + adc sreg + pha + txa ; hi byte of left op + adc ptr4+1 + sta ptr4+1 + pla -@L1: ror ptr4+1 - ror a - ror ptr4 +@L1: ror ptr4+1 + ror a + ror ptr4 dey bne @L0 tax @@ -58,6 +58,6 @@ mul8x8: dey bne @L0 tax - lda ptr4 ; Load the result - rts ; Done + lda ptr4 ; Load the result + rts ; Done diff --git a/libsrc/runtime/mulax10.s b/libsrc/runtime/mulax10.s index 3fe250c4a..d3e006d2b 100644 --- a/libsrc/runtime/mulax10.s +++ b/libsrc/runtime/mulax10.s @@ -5,27 +5,27 @@ ; CC65 runtime: Multiply the primary register by 10 ; - .export mulax10 - .importzp ptr1 + .export mulax10 + .importzp ptr1 -.proc mulax10 +.proc mulax10 - sta ptr1 - stx ptr1+1 - asl a - rol ptr1+1 - asl a - rol ptr1+1 - clc - adc ptr1 - sta ptr1 - txa - adc ptr1+1 - asl ptr1 - rol a - tax - lda ptr1 - rts + sta ptr1 + stx ptr1+1 + asl a + rol ptr1+1 + asl a + rol ptr1+1 + clc + adc ptr1 + sta ptr1 + txa + adc ptr1+1 + asl ptr1 + rol a + tax + lda ptr1 + rts .endproc diff --git a/libsrc/runtime/mulax3.s b/libsrc/runtime/mulax3.s index 07625f8cf..c35b05dcc 100644 --- a/libsrc/runtime/mulax3.s +++ b/libsrc/runtime/mulax3.s @@ -4,23 +4,23 @@ ; CC65 runtime: Multiply the primary register ; - .export mulax3 - .importzp ptr1 - -.proc mulax3 + .export mulax3 + .importzp ptr1 + +.proc mulax3 - sta ptr1 - stx ptr1+1 - asl a - rol ptr1+1 - clc - adc ptr1 - pha - txa - adc ptr1+1 - tax - pla - rts + sta ptr1 + stx ptr1+1 + asl a + rol ptr1+1 + clc + adc ptr1 + pha + txa + adc ptr1+1 + tax + pla + rts .endproc diff --git a/libsrc/runtime/mulax5.s b/libsrc/runtime/mulax5.s index dbfa9fc95..9af599806 100644 --- a/libsrc/runtime/mulax5.s +++ b/libsrc/runtime/mulax5.s @@ -4,25 +4,25 @@ ; CC65 runtime: Multiply the primary register ; - .export mulax5 - .importzp ptr1 + .export mulax5 + .importzp ptr1 -.proc mulax5 +.proc mulax5 - sta ptr1 - stx ptr1+1 - asl a - rol ptr1+1 - asl a - rol ptr1+1 - clc - adc ptr1 - pha - txa - adc ptr1+1 - tax - pla - rts + sta ptr1 + stx ptr1+1 + asl a + rol ptr1+1 + asl a + rol ptr1+1 + clc + adc ptr1 + pha + txa + adc ptr1+1 + tax + pla + rts .endproc diff --git a/libsrc/runtime/mulax6.s b/libsrc/runtime/mulax6.s index 78aa85bda..6967602fc 100644 --- a/libsrc/runtime/mulax6.s +++ b/libsrc/runtime/mulax6.s @@ -5,25 +5,25 @@ ; CC65 runtime: Multiply the primary register by 6 ; - .export mulax6 - .importzp ptr1 + .export mulax6 + .importzp ptr1 -.proc mulax6 +.proc mulax6 - sta ptr1 - stx ptr1+1 - asl a - rol ptr1+1 - clc - adc ptr1 - sta ptr1 - txa - adc ptr1+1 - asl ptr1 - rol a - tax - lda ptr1 - rts + sta ptr1 + stx ptr1+1 + asl a + rol ptr1+1 + clc + adc ptr1 + sta ptr1 + txa + adc ptr1+1 + asl ptr1 + rol a + tax + lda ptr1 + rts .endproc diff --git a/libsrc/runtime/mulax7.s b/libsrc/runtime/mulax7.s index c9f7e4715..90313180c 100644 --- a/libsrc/runtime/mulax7.s +++ b/libsrc/runtime/mulax7.s @@ -5,28 +5,28 @@ ; CC65 runtime: Multiply the primary register by 7 ; - .export mulax7 - .importzp ptr1 + .export mulax7 + .importzp ptr1 -.proc mulax7 +.proc mulax7 - sta ptr1 - stx ptr1+1 - asl a - rol ptr1+1 ; * 2 - asl a - rol ptr1+1 ; * 4 - asl a - rol ptr1+1 ; * 8 - sec - sbc ptr1 - pha - txa - eor #$ff - adc ptr1+1 ; * (8 - 1) - tax - pla - rts + sta ptr1 + stx ptr1+1 + asl a + rol ptr1+1 ; * 2 + asl a + rol ptr1+1 ; * 4 + asl a + rol ptr1+1 ; * 8 + sec + sbc ptr1 + pha + txa + eor #$ff + adc ptr1+1 ; * (8 - 1) + tax + pla + rts .endproc diff --git a/libsrc/runtime/mulax9.s b/libsrc/runtime/mulax9.s index 67a07b4d6..d2dd89529 100644 --- a/libsrc/runtime/mulax9.s +++ b/libsrc/runtime/mulax9.s @@ -5,27 +5,27 @@ ; CC65 runtime: Multiply the primary register by 9 ; - .export mulax9 - .importzp ptr1 + .export mulax9 + .importzp ptr1 -.proc mulax9 +.proc mulax9 - sta ptr1 - stx ptr1+1 - asl a - rol ptr1+1 ; * 2 - asl a - rol ptr1+1 ; * 4 - asl a - rol ptr1+1 ; * 8 - clc - adc ptr1 ; * (8+1) - pha - txa - adc ptr1+1 - tax - pla - rts + sta ptr1 + stx ptr1+1 + asl a + rol ptr1+1 ; * 2 + asl a + rol ptr1+1 ; * 4 + asl a + rol ptr1+1 ; * 8 + clc + adc ptr1 ; * (8+1) + pha + txa + adc ptr1+1 + tax + pla + rts .endproc diff --git a/libsrc/runtime/ne.s b/libsrc/runtime/ne.s index ce9b8171d..f20953489 100644 --- a/libsrc/runtime/ne.s +++ b/libsrc/runtime/ne.s @@ -4,15 +4,15 @@ ; CC65 runtime: Compare != for ints ; - .export tosne00, tosnea0, tosneax - .import tosicmp, boolne + .export tosne00, tosnea0, tosneax + .import tosicmp, boolne tosne00: - lda #$00 + lda #$00 tosnea0: - ldx #$00 + ldx #$00 tosneax: - jsr tosicmp ; Set flags - jmp boolne ; Convert to boolean + jsr tosicmp ; Set flags + jmp boolne ; Convert to boolean diff --git a/libsrc/runtime/neg.s b/libsrc/runtime/neg.s index 62807c7e9..a428fd1e4 100644 --- a/libsrc/runtime/neg.s +++ b/libsrc/runtime/neg.s @@ -4,18 +4,18 @@ ; CC65 runtime: negation on ints ; - .export negax + .export negax -negax: clc - eor #$FF - adc #1 - pha - txa - eor #$FF - adc #0 - tax - pla - rts +negax: clc + eor #$FF + adc #1 + pha + txa + eor #$FF + adc #0 + tax + pla + rts diff --git a/libsrc/runtime/or.s b/libsrc/runtime/or.s index f95354921..8570c0cd7 100644 --- a/libsrc/runtime/or.s +++ b/libsrc/runtime/or.s @@ -4,20 +4,20 @@ ; CC65 runtime: or on ints ; - .export tosora0, tosorax - .import addysp1 - .importzp sp, tmp1 + .export tosora0, tosorax + .import addysp1 + .importzp sp, tmp1 tosora0: - ldx #$00 + ldx #$00 tosorax: - ldy #0 - ora (sp),y - sta tmp1 - iny - txa - ora (sp),y - tax - lda tmp1 - jmp addysp1 ; drop TOS, set condition codes + ldy #0 + ora (sp),y + sta tmp1 + iny + txa + ora (sp),y + tax + lda tmp1 + jmp addysp1 ; drop TOS, set condition codes diff --git a/libsrc/runtime/popa.s b/libsrc/runtime/popa.s index 0534b24e5..bb74df0ca 100644 --- a/libsrc/runtime/popa.s +++ b/libsrc/runtime/popa.s @@ -4,25 +4,25 @@ ; CC65 runtime: Pop a from stack ; - .export popa - .importzp sp + .export popa + .importzp sp .macpack cpu -.proc popa +.proc popa .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (sp) + lda (sp) .else - ldy #0 ; (2) - lda (sp),y ; (7) Read byte + ldy #0 ; (2) + lda (sp),y ; (7) Read byte .endif - inc sp ; (12) - beq @L1 ; (14) - rts ; (20) + inc sp ; (12) + beq @L1 ; (14) + rts ; (20) -@L1: inc sp+1 - rts +@L1: inc sp+1 + rts .endproc diff --git a/libsrc/runtime/popsreg.s b/libsrc/runtime/popsreg.s index 80e484339..47d67503a 100644 --- a/libsrc/runtime/popsreg.s +++ b/libsrc/runtime/popsreg.s @@ -4,24 +4,24 @@ ; CC65 runtime: Pop TOS into sreg ; - .export popsreg - .import incsp2 - .importzp sp, sreg + .export popsreg + .import incsp2 + .importzp sp, sreg .macpack cpu popsreg: - pha ; save A - ldy #1 - lda (sp),y ; get hi byte - sta sreg+1 ; store it + pha ; save A + ldy #1 + lda (sp),y ; get hi byte + sta sreg+1 ; store it .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (sp) ; get lo byte + lda (sp) ; get lo byte .else - dey - lda (sp),y ; get lo byte + dey + lda (sp),y ; get lo byte .endif - sta sreg ; store it - pla ; get A back - jmp incsp2 ; bump stack and return + sta sreg ; store it + pla ; get A back + jmp incsp2 ; bump stack and return diff --git a/libsrc/runtime/push1.s b/libsrc/runtime/push1.s index d58509a73..0451ecf89 100644 --- a/libsrc/runtime/push1.s +++ b/libsrc/runtime/push1.s @@ -4,15 +4,15 @@ ; CC65 runtime: Push (int)1 onto the stack ; - .export push1 - .import pusha0 + .export push1 + .import pusha0 ; Beware: The optimizer knows about this function! -.proc push1 +.proc push1 - lda #1 - jmp pusha0 + lda #1 + jmp pusha0 .endproc diff --git a/libsrc/runtime/push2.s b/libsrc/runtime/push2.s index 2bbf81548..95ce7271f 100644 --- a/libsrc/runtime/push2.s +++ b/libsrc/runtime/push2.s @@ -4,15 +4,15 @@ ; CC65 runtime: Push (int)2 onto the stack ; - .export push2 - .import pusha0 + .export push2 + .import pusha0 ; Beware: The optimizer knows about this function! -.proc push2 +.proc push2 - lda #2 - jmp pusha0 + lda #2 + jmp pusha0 .endproc diff --git a/libsrc/runtime/push3.s b/libsrc/runtime/push3.s index d55d1e4dc..a7c933fbd 100644 --- a/libsrc/runtime/push3.s +++ b/libsrc/runtime/push3.s @@ -4,15 +4,15 @@ ; CC65 runtime: Push (int)3 onto the stack ; - .export push3 - .import pusha0 + .export push3 + .import pusha0 ; Beware: The optimizer knows about this function! -.proc push3 +.proc push3 - lda #3 - jmp pusha0 + lda #3 + jmp pusha0 .endproc diff --git a/libsrc/runtime/push4.s b/libsrc/runtime/push4.s index 0ceeeda2e..06da2fccc 100644 --- a/libsrc/runtime/push4.s +++ b/libsrc/runtime/push4.s @@ -4,15 +4,15 @@ ; CC65 runtime: Push (int)4 onto the stack ; - .export push4 - .import pusha0 + .export push4 + .import pusha0 ; Beware: The optimizer knows about this function! -.proc push4 +.proc push4 - lda #4 - jmp pusha0 + lda #4 + jmp pusha0 .endproc diff --git a/libsrc/runtime/push5.s b/libsrc/runtime/push5.s index 583486439..94b9d9242 100644 --- a/libsrc/runtime/push5.s +++ b/libsrc/runtime/push5.s @@ -4,15 +4,15 @@ ; CC65 runtime: Push (int)5 onto the stack ; - .export push5 - .import pusha0 + .export push5 + .import pusha0 ; Beware: The optimizer knows about this function! -.proc push5 +.proc push5 - lda #5 - jmp pusha0 + lda #5 + jmp pusha0 .endproc diff --git a/libsrc/runtime/push6.s b/libsrc/runtime/push6.s index 7355aeada..0e4e9d340 100644 --- a/libsrc/runtime/push6.s +++ b/libsrc/runtime/push6.s @@ -4,15 +4,15 @@ ; CC65 runtime: Push (int)6 onto the stack ; - .export push6 - .import pusha0 + .export push6 + .import pusha0 ; Beware: The optimizer knows about this function! -.proc push6 +.proc push6 - lda #6 - jmp pusha0 + lda #6 + jmp pusha0 .endproc diff --git a/libsrc/runtime/push7.s b/libsrc/runtime/push7.s index 2dfc994ff..afae8ad39 100644 --- a/libsrc/runtime/push7.s +++ b/libsrc/runtime/push7.s @@ -4,15 +4,15 @@ ; CC65 runtime: Push (int)7 onto the stack ; - .export push7 - .import pusha0 + .export push7 + .import pusha0 ; Beware: The optimizer knows about this function! -.proc push7 +.proc push7 - lda #7 - jmp pusha0 + lda #7 + jmp pusha0 .endproc diff --git a/libsrc/runtime/pusha.s b/libsrc/runtime/pusha.s index f4e9639dd..04233282e 100644 --- a/libsrc/runtime/pusha.s +++ b/libsrc/runtime/pusha.s @@ -4,26 +4,26 @@ ; CC65 runtime: Push value in a onto the stack ; - .export pusha0sp, pushaysp, pusha - .importzp sp + .export pusha0sp, pushaysp, pusha + .importzp sp .macpack cpu ; Beware: The optimizer knows about this function! pusha0sp: - ldy #$00 + ldy #$00 pushaysp: - lda (sp),y -pusha: ldy sp ; (3) - beq @L1 ; (6) - dec sp ; (11) - ldy #0 ; (13) - sta (sp),y ; (19) - rts ; (25) + lda (sp),y +pusha: ldy sp ; (3) + beq @L1 ; (6) + dec sp ; (11) + ldy #0 ; (13) + sta (sp),y ; (19) + rts ; (25) -@L1: dec sp+1 ; (11) - dec sp ; (16) - sta (sp),y ; (22) - rts ; (28) +@L1: dec sp+1 ; (11) + dec sp ; (16) + sta (sp),y ; (22) + rts ; (28) diff --git a/libsrc/runtime/pushaff.s b/libsrc/runtime/pushaff.s index dd8dc8768..08d988bb2 100644 --- a/libsrc/runtime/pushaff.s +++ b/libsrc/runtime/pushaff.s @@ -4,17 +4,17 @@ ; CC65 runtime: Push a extended with FF onto the stack ; - .export pushaFF - .import pushax + .export pushaFF + .import pushax ; Beware: The optimizer knows about this function! -.proc pushaFF +.proc pushaFF - ldx #$FF - jmp pushax + ldx #$FF + jmp pushax .endproc - + diff --git a/libsrc/runtime/pushax.s b/libsrc/runtime/pushax.s index d9efe7c0e..cba313c2f 100644 --- a/libsrc/runtime/pushax.s +++ b/libsrc/runtime/pushax.s @@ -4,32 +4,32 @@ ; CC65 runtime: Push value in a/x onto the stack ; - .export push0, pusha0, pushax - .importzp sp + .export push0, pusha0, pushax + .importzp sp -push0: lda #0 -pusha0: ldx #0 +push0: lda #0 +pusha0: ldx #0 ; This function is used *a lot*, so don't call any subroutines here. ; Beware: The value in ax must not be changed by this function! ; Beware^2: The optimizer knows about the value of Y after the function ; returns! -.proc pushax +.proc pushax - pha ; (3) - lda sp ; (6) - sec ; (8) - sbc #2 ; (10) - sta sp ; (13) - bcs @L1 ; (17) - dec sp+1 ; (+5) -@L1: ldy #1 ; (19) - txa ; (21) - sta (sp),y ; (27) - pla ; (31) - dey ; (33) - sta (sp),y ; (38) - rts ; (44) + pha ; (3) + lda sp ; (6) + sec ; (8) + sbc #2 ; (10) + sta sp ; (13) + bcs @L1 ; (17) + dec sp+1 ; (+5) +@L1: ldy #1 ; (19) + txa ; (21) + sta (sp),y ; (27) + pla ; (31) + dey ; (33) + sta (sp),y ; (38) + rts ; (44) .endproc diff --git a/libsrc/runtime/pushb.s b/libsrc/runtime/pushb.s index d32c1c930..7507ff21a 100644 --- a/libsrc/runtime/pushb.s +++ b/libsrc/runtime/pushb.s @@ -4,27 +4,27 @@ ; CC65 runtime: Push word from stack ; - .export pushb, pushbidx - .import pushax - .importzp ptr1 + .export pushb, pushbidx + .import pushax + .importzp ptr1 .macpack cpu pushbidx: - sty ptr1 - clc - adc ptr1 - bcc pushb - inx -pushb: sta ptr1 - stx ptr1+1 - ldx #0 ; Load index/high byte + sty ptr1 + clc + adc ptr1 + bcc pushb + inx +pushb: sta ptr1 + stx ptr1+1 + ldx #0 ; Load index/high byte .if (.cpu .bitand CPU_ISET_65SC02) - lda (ptr1) ; Save one cycle for the C02 + lda (ptr1) ; Save one cycle for the C02 .else - lda (ptr1,x) + lda (ptr1,x) .endif - bpl L1 - dex ; Make high byte FF -L1: jmp pushax + bpl L1 + dex ; Make high byte FF +L1: jmp pushax diff --git a/libsrc/runtime/pushbsp.s b/libsrc/runtime/pushbsp.s index 2ae062506..0b5cbe854 100644 --- a/libsrc/runtime/pushbsp.s +++ b/libsrc/runtime/pushbsp.s @@ -4,14 +4,14 @@ ; CC65 runtime: Load a from stack slot and push as word ; - .export pushbsp, pushbysp - .import pusha0 - .importzp sp + .export pushbsp, pushbysp + .import pusha0 + .importzp sp pushbsp: - ldy #0 + ldy #0 pushbysp: - lda (sp),y ; get lo byte - jmp pusha0 ; promote to unsigned and push + lda (sp),y ; get lo byte + jmp pusha0 ; promote to unsigned and push diff --git a/libsrc/runtime/pushc0.s b/libsrc/runtime/pushc0.s index fd7206400..5100cd6f7 100644 --- a/libsrc/runtime/pushc0.s +++ b/libsrc/runtime/pushc0.s @@ -4,15 +4,15 @@ ; CC65 runtime: Push (char)0 onto the stack ; - .export pushc0 - .import pusha + .export pushc0 + .import pusha ; Beware: The optimizer knows about this function! -.proc pushc0 +.proc pushc0 - lda #0 - jmp pusha + lda #0 + jmp pusha .endproc diff --git a/libsrc/runtime/pushc1.s b/libsrc/runtime/pushc1.s index 9997b566b..84365b564 100644 --- a/libsrc/runtime/pushc1.s +++ b/libsrc/runtime/pushc1.s @@ -4,15 +4,15 @@ ; CC65 runtime: Push (char)1 onto the stack ; - .export pushc1 - .import pusha + .export pushc1 + .import pusha ; Beware: The optimizer knows about this function! -.proc pushc1 +.proc pushc1 - lda #1 - jmp pusha + lda #1 + jmp pusha .endproc diff --git a/libsrc/runtime/pushc2.s b/libsrc/runtime/pushc2.s index 4539f30b4..87a59e3cc 100644 --- a/libsrc/runtime/pushc2.s +++ b/libsrc/runtime/pushc2.s @@ -4,15 +4,15 @@ ; CC65 runtime: Push (char)2 onto the stack ; - .export pushc2 - .import pusha + .export pushc2 + .import pusha ; Beware: The optimizer knows about this function! -.proc pushc2 +.proc pushc2 - lda #2 - jmp pusha + lda #2 + jmp pusha .endproc diff --git a/libsrc/runtime/pushlysp.s b/libsrc/runtime/pushlysp.s index a91b9f77e..ca1834265 100644 --- a/libsrc/runtime/pushlysp.s +++ b/libsrc/runtime/pushlysp.s @@ -5,26 +5,26 @@ ; - .export pushlysp - .import pusheax - .importzp sreg, sp + .export pushlysp + .import pusheax + .importzp sreg, sp -.proc pushlysp +.proc pushlysp - iny - iny - lda (sp),y - iny - sta sreg - lda (sp),y - sta sreg+1 - dey - dey - lda (sp),y - dey - tax - lda (sp),y - jmp pusheax + iny + iny + lda (sp),y + iny + sta sreg + lda (sp),y + sta sreg+1 + dey + dey + lda (sp),y + dey + tax + lda (sp),y + jmp pusheax .endproc diff --git a/libsrc/runtime/pushw.s b/libsrc/runtime/pushw.s index d78323c74..4b1920cdd 100644 --- a/libsrc/runtime/pushw.s +++ b/libsrc/runtime/pushw.s @@ -4,19 +4,19 @@ ; CC65 runtime: Fetch word indirect and push ; - .export pushw, pushwidx, pushptr1idx - .import pushax - .importzp ptr1 + .export pushw, pushwidx, pushptr1idx + .import pushax + .importzp ptr1 pushw: ldy #1 pushwidx: - sta ptr1 - stx ptr1+1 + sta ptr1 + stx ptr1+1 pushptr1idx: - lda (ptr1),y - tax - dey - lda (ptr1),y - jmp pushax + lda (ptr1),y + tax + dey + lda (ptr1),y + jmp pushax diff --git a/libsrc/runtime/pushwsp.s b/libsrc/runtime/pushwsp.s index 6e9735485..f5ebe0d7e 100644 --- a/libsrc/runtime/pushwsp.s +++ b/libsrc/runtime/pushwsp.s @@ -4,28 +4,28 @@ ; CC65 runtime: Load word from stack slot and push ; - .export pushwysp, pushw0sp - .importzp sp + .export pushwysp, pushw0sp + .importzp sp - .macpack generic + .macpack generic pushw0sp: - ldy #3 + ldy #3 pushwysp: - lda sp ; 3 - sub #2 ; 4 - sta sp ; 3 - bcs @L1 ; 3(+1) - dec sp+1 ; (5) -@L1: lda (sp),y ; 5 =16 - tax ; 2 - dey ; 2 - lda (sp),y ; 5 - ldy #$00 ; 2 - sta (sp),y ; 5 - iny ; 2 - txa ; 2 - sta (sp),y ; 5 - rts + lda sp ; 3 + sub #2 ; 4 + sta sp ; 3 + bcs @L1 ; 3(+1) + dec sp+1 ; (5) +@L1: lda (sp),y ; 5 =16 + tax ; 2 + dey ; 2 + lda (sp),y ; 5 + ldy #$00 ; 2 + sta (sp),y ; 5 + iny ; 2 + txa ; 2 + sta (sp),y ; 5 + rts diff --git a/libsrc/runtime/regswap.s b/libsrc/runtime/regswap.s index 28e0441af..689d8d12a 100644 --- a/libsrc/runtime/regswap.s +++ b/libsrc/runtime/regswap.s @@ -4,10 +4,10 @@ ; CC65 runtime: Swap x bytes of register variable space ; - .export regswap - .importzp sp, regbank, tmp1 + .export regswap + .importzp sp, regbank, tmp1 -.proc regswap +.proc regswap sta tmp1 ; Store count @L1: lda regbank,x ; Get old value @@ -21,7 +21,7 @@ dec tmp1 bne @L1 - rts + rts .endproc diff --git a/libsrc/runtime/regswap1.s b/libsrc/runtime/regswap1.s index e2410f96d..753020acb 100644 --- a/libsrc/runtime/regswap1.s +++ b/libsrc/runtime/regswap1.s @@ -4,10 +4,10 @@ ; CC65 runtime: Swap 1 byte of register variable space ; - .export regswap1 - .importzp sp, regbank + .export regswap1 + .importzp sp, regbank -.proc regswap1 +.proc regswap1 lda regbank,x ; Get old value pha ; Save it @@ -15,7 +15,7 @@ sta regbank,x ; Store new value pla sta (sp),y ; Store old value - rts + rts .endproc diff --git a/libsrc/runtime/regswap2.s b/libsrc/runtime/regswap2.s index 50eb6c2a4..df5109dc6 100644 --- a/libsrc/runtime/regswap2.s +++ b/libsrc/runtime/regswap2.s @@ -4,10 +4,10 @@ ; CC65 runtime: Swap 2 bytes of register variable space ; - .export regswap2 - .importzp sp, regbank + .export regswap2 + .importzp sp, regbank -.proc regswap2 +.proc regswap2 ; First byte @@ -28,7 +28,7 @@ pla sta (sp),y ; Store old value - rts + rts .endproc diff --git a/libsrc/runtime/return0.s b/libsrc/runtime/return0.s index 37c260804..c061e013c 100644 --- a/libsrc/runtime/return0.s +++ b/libsrc/runtime/return0.s @@ -4,17 +4,17 @@ ; CC65 runtime: Return 0 in a/x ; - .export return0 + .export return0 -.proc return0 +.proc return0 - lda #0 - tax - rts + lda #0 + tax + rts .endproc - + diff --git a/libsrc/runtime/return1.s b/libsrc/runtime/return1.s index 2987de30c..76153f3e1 100644 --- a/libsrc/runtime/return1.s +++ b/libsrc/runtime/return1.s @@ -4,17 +4,17 @@ ; CC65 runtime: Return 1 in a/x ; - .export return1 + .export return1 -.proc return1 +.proc return1 - ldx #0 - lda #1 - rts + ldx #0 + lda #1 + rts .endproc - + diff --git a/libsrc/runtime/rsub.s b/libsrc/runtime/rsub.s index 2b722e013..475a69e76 100644 --- a/libsrc/runtime/rsub.s +++ b/libsrc/runtime/rsub.s @@ -4,26 +4,26 @@ ; CC65 runtime: sub ints reversed ; - .export tosrsuba0, tosrsubax - .import addysp1 - .importzp sp, tmp1 + .export tosrsuba0, tosrsubax + .import addysp1 + .importzp sp, tmp1 ; ; AX = AX - TOS ; tosrsuba0: - ldx #0 + ldx #0 tosrsubax: - ldy #0 - sec - sbc (sp),y ; lo byte - sta tmp1 ; save lo byte - txa - iny - sbc (sp),y ; hi byte - tax - lda tmp1 - jmp addysp1 ; drop TOS, set condition codes + ldy #0 + sec + sbc (sp),y ; lo byte + sta tmp1 ; save lo byte + txa + iny + sbc (sp),y ; hi byte + tax + lda tmp1 + jmp addysp1 ; drop TOS, set condition codes diff --git a/libsrc/runtime/shelp.s b/libsrc/runtime/shelp.s index d4f55b1e2..b1ebeb798 100644 --- a/libsrc/runtime/shelp.s +++ b/libsrc/runtime/shelp.s @@ -7,24 +7,24 @@ ; When negating values, we will ignore the possibility here, that one of the ; values if $8000, in which case the negate will fail. - .export popsargs - .import negax, popax - .importzp sreg, tmp1, tmp2, ptr4 + .export popsargs + .import negax, popax + .importzp sreg, tmp1, tmp2, ptr4 popsargs: - stx tmp2 ; Remember sign - cpx #0 - bpl L1 - jsr negax ; Negate accumulator -L1: sta ptr4 - stx ptr4+1 ; Save right operand + stx tmp2 ; Remember sign + cpx #0 + bpl L1 + jsr negax ; Negate accumulator +L1: sta ptr4 + stx ptr4+1 ; Save right operand - jsr popax - stx tmp1 ; Remember sign - cpx #0 - bpl L2 - jsr negax -L2: sta sreg - stx sreg+1 + jsr popax + stx tmp1 ; Remember sign + cpx #0 + bpl L2 + jsr negax +L2: sta sreg + stx sreg+1 rts diff --git a/libsrc/runtime/shr.s b/libsrc/runtime/shr.s index edc5f871c..55b15bd29 100644 --- a/libsrc/runtime/shr.s +++ b/libsrc/runtime/shr.s @@ -11,9 +11,9 @@ ; - .export tosshrax, shraxy - .import popax - .importzp tmp1 + .export tosshrax, shraxy + .import popax + .importzp tmp1 tosshrax: sta tmp1 ; Save shift count @@ -65,11 +65,11 @@ L4: adc #8 ; Correct counter L5: lsr tmp1 ror a dey - bne L5 + bne L5 ; Done with shift - ldx tmp1 + ldx tmp1 rts diff --git a/libsrc/runtime/shrax1.s b/libsrc/runtime/shrax1.s index f7b6b7256..4f4fac0fd 100644 --- a/libsrc/runtime/shrax1.s +++ b/libsrc/runtime/shrax1.s @@ -4,12 +4,12 @@ ; CC65 runtime: Scale the primary register ; - .export shrax1 - .importzp tmp1 + .export shrax1 + .importzp tmp1 -shrax1: stx tmp1 - lsr tmp1 - ror a - ldx tmp1 - rts +shrax1: stx tmp1 + lsr tmp1 + ror a + ldx tmp1 + rts diff --git a/libsrc/runtime/shrax2.s b/libsrc/runtime/shrax2.s index 074ab8e3e..a96d5641b 100644 --- a/libsrc/runtime/shrax2.s +++ b/libsrc/runtime/shrax2.s @@ -4,15 +4,15 @@ ; CC65 runtime: Scale the primary register by 4 ; - .export shrax2 - .importzp tmp1 + .export shrax2 + .importzp tmp1 -shrax2: stx tmp1 - lsr tmp1 - ror a - lsr tmp1 - ror a - ldx tmp1 - rts +shrax2: stx tmp1 + lsr tmp1 + ror a + lsr tmp1 + ror a + ldx tmp1 + rts diff --git a/libsrc/runtime/shrax3.s b/libsrc/runtime/shrax3.s index 07e1e1f07..d84236f1e 100644 --- a/libsrc/runtime/shrax3.s +++ b/libsrc/runtime/shrax3.s @@ -4,17 +4,17 @@ ; CC65 runtime: Scale the primary register by 8 ; - .export shrax3 - .importzp tmp1 + .export shrax3 + .importzp tmp1 -shrax3: stx tmp1 - lsr tmp1 - ror a - lsr tmp1 - ror a - lsr tmp1 - ror a - ldx tmp1 - rts +shrax3: stx tmp1 + lsr tmp1 + ror a + lsr tmp1 + ror a + lsr tmp1 + ror a + ldx tmp1 + rts diff --git a/libsrc/runtime/shrax4.s b/libsrc/runtime/shrax4.s index 46589e2b1..730e33729 100644 --- a/libsrc/runtime/shrax4.s +++ b/libsrc/runtime/shrax4.s @@ -4,19 +4,19 @@ ; CC65 runtime: Scale the primary register by 16 ; - .export shrax4 - .importzp tmp1 + .export shrax4 + .importzp tmp1 -shrax4: stx tmp1 - lsr tmp1 - ror a - lsr tmp1 - ror a - lsr tmp1 - ror a - lsr tmp1 - ror a - ldx tmp1 - rts +shrax4: stx tmp1 + lsr tmp1 + ror a + lsr tmp1 + ror a + lsr tmp1 + ror a + lsr tmp1 + ror a + ldx tmp1 + rts diff --git a/libsrc/runtime/shreax1.s b/libsrc/runtime/shreax1.s index f4d808f55..93ee7d8c3 100644 --- a/libsrc/runtime/shreax1.s +++ b/libsrc/runtime/shreax1.s @@ -4,15 +4,15 @@ ; CC65 runtime: Scale the 32 bit primary register by 2 ; - .export shreax1 - .importzp sreg, tmp1 + .export shreax1 + .importzp sreg, tmp1 shreax1: - stx tmp1 - lsr sreg+1 - ror sreg - ror tmp1 - ror a - ldx tmp1 - rts + stx tmp1 + lsr sreg+1 + ror sreg + ror tmp1 + ror a + ldx tmp1 + rts diff --git a/libsrc/runtime/shreax2.s b/libsrc/runtime/shreax2.s index 1f2a23da8..29ba23cf8 100644 --- a/libsrc/runtime/shreax2.s +++ b/libsrc/runtime/shreax2.s @@ -4,19 +4,19 @@ ; CC65 runtime: Scale the 32 bit primary register by 4 ; - .export shreax2 - .importzp sreg, tmp1 + .export shreax2 + .importzp sreg, tmp1 shreax2: - stx tmp1 - lsr sreg+1 - ror sreg - ror tmp1 - ror a - lsr sreg+1 - ror sreg - ror tmp1 - ror a - ldx tmp1 - rts + stx tmp1 + lsr sreg+1 + ror sreg + ror tmp1 + ror a + lsr sreg+1 + ror sreg + ror tmp1 + ror a + ldx tmp1 + rts diff --git a/libsrc/runtime/shreax3.s b/libsrc/runtime/shreax3.s index 8111253a0..e67cfe2e4 100644 --- a/libsrc/runtime/shreax3.s +++ b/libsrc/runtime/shreax3.s @@ -4,23 +4,23 @@ ; CC65 runtime: Scale the 32 bit primary register by 8 ; - .export shreax3 - .importzp sreg, tmp1 + .export shreax3 + .importzp sreg, tmp1 shreax3: - stx tmp1 - lsr sreg+1 - ror sreg - ror tmp1 - ror a - lsr sreg+1 - ror sreg - ror tmp1 - ror a - lsr sreg+1 - ror sreg - ror tmp1 - ror a - ldx tmp1 - rts + stx tmp1 + lsr sreg+1 + ror sreg + ror tmp1 + ror a + lsr sreg+1 + ror sreg + ror tmp1 + ror a + lsr sreg+1 + ror sreg + ror tmp1 + ror a + ldx tmp1 + rts diff --git a/libsrc/runtime/shreax4.s b/libsrc/runtime/shreax4.s index 802059261..a44e7b8a7 100644 --- a/libsrc/runtime/shreax4.s +++ b/libsrc/runtime/shreax4.s @@ -4,18 +4,18 @@ ; CC65 runtime: Scale the 32 bit primary register by 16 ; - .export shreax4 - .importzp sreg, tmp1 + .export shreax4 + .importzp sreg, tmp1 shreax4: - stx tmp1 - ldx #4 -@L1: lsr sreg+1 - ror sreg - ror tmp1 - ror a - dex - bne @L1 - ldx tmp1 - rts + stx tmp1 + ldx #4 +@L1: lsr sreg+1 + ror sreg + ror tmp1 + ror a + dex + bne @L1 + ldx tmp1 + rts diff --git a/libsrc/runtime/staspidx.s b/libsrc/runtime/staspidx.s index c5e1440b8..c8d42f34c 100644 --- a/libsrc/runtime/staspidx.s +++ b/libsrc/runtime/staspidx.s @@ -4,24 +4,24 @@ ; CC65 runtime: Store a indirect into address at top of stack with index ; - .export staspidx - .import incsp2 - .importzp sp, tmp1, ptr1 + .export staspidx + .import incsp2 + .importzp sp, tmp1, ptr1 -.proc staspidx +.proc staspidx - pha - sty tmp1 ; Save Index - ldy #1 - lda (sp),y - sta ptr1+1 - dey - lda (sp),y - sta ptr1 ; Pointer now in ptr1 - ldy tmp1 ; Restore offset - pla ; Restore value - sta (ptr1),y ; Store - jmp incsp2 ; Drop address + pha + sty tmp1 ; Save Index + ldy #1 + lda (sp),y + sta ptr1+1 + dey + lda (sp),y + sta ptr1 ; Pointer now in ptr1 + ldy tmp1 ; Restore offset + pla ; Restore value + sta (ptr1),y ; Store + jmp incsp2 ; Drop address .endproc diff --git a/libsrc/runtime/staxsp.s b/libsrc/runtime/staxsp.s index 07828e36f..599e92a32 100644 --- a/libsrc/runtime/staxsp.s +++ b/libsrc/runtime/staxsp.s @@ -4,17 +4,17 @@ ; CC65 runtime: Store ax at (sp),y ; - .export staxysp, stax0sp - .importzp sp + .export staxysp, stax0sp + .importzp sp stax0sp: - ldy #0 + ldy #0 staxysp: - sta (sp),y - iny - pha - txa - sta (sp),y - pla - rts + sta (sp),y + iny + pha + txa + sta (sp),y + pla + rts diff --git a/libsrc/runtime/staxspi.s b/libsrc/runtime/staxspi.s index 1c4c011b4..90738e0d2 100644 --- a/libsrc/runtime/staxspi.s +++ b/libsrc/runtime/staxspi.s @@ -4,28 +4,28 @@ ; CC65 runtime: Store a/x indirect into address at top of stack with index ; - .export staxspidx - .import incsp2 - .importzp sp, tmp1, ptr1 + .export staxspidx + .import incsp2 + .importzp sp, tmp1, ptr1 -.proc staxspidx +.proc staxspidx - sty tmp1 ; Save Y - pha ; Save A - ldy #1 - lda (sp),y - sta ptr1+1 - dey - lda (sp),y - sta ptr1 ; Address now in ptr1 - ldy tmp1 ; Restore Y - iny ; Address high byte - txa ; Get high byte - sta (ptr1),y ; Store high byte - dey ; Address low byte - pla ; Restore low byte into A - sta (ptr1),y ; Store low byte - jmp incsp2 ; Drop address + sty tmp1 ; Save Y + pha ; Save A + ldy #1 + lda (sp),y + sta ptr1+1 + dey + lda (sp),y + sta ptr1 ; Address now in ptr1 + ldy tmp1 ; Restore Y + iny ; Address high byte + txa ; Get high byte + sta (ptr1),y ; Store high byte + dey ; Address low byte + pla ; Restore low byte into A + sta (ptr1),y ; Store low byte + jmp incsp2 ; Drop address .endproc diff --git a/libsrc/runtime/steaxsp.s b/libsrc/runtime/steaxsp.s index de134e2d3..6ac3891c9 100644 --- a/libsrc/runtime/steaxsp.s +++ b/libsrc/runtime/steaxsp.s @@ -4,24 +4,24 @@ ; CC65 runtime: Store eax at (sp),y ; - .export steaxysp, steax0sp - .importzp sp, sreg + .export steaxysp, steax0sp + .importzp sp, sreg steax0sp: - ldy #0 + ldy #0 steaxysp: - sta (sp),y - iny - pha - txa - sta (sp),y - iny - lda sreg - sta (sp),y - iny - lda sreg+1 - sta (sp),y - pla - rts + sta (sp),y + iny + pha + txa + sta (sp),y + iny + lda sreg + sta (sp),y + iny + lda sreg+1 + sta (sp),y + pla + rts diff --git a/libsrc/runtime/steaxspi.s b/libsrc/runtime/steaxspi.s index ec1777e87..b85725050 100644 --- a/libsrc/runtime/steaxspi.s +++ b/libsrc/runtime/steaxspi.s @@ -5,34 +5,34 @@ ; - .export steaxspidx - .import popax - .importzp sreg, ptr1, tmp1, tmp2, tmp3 + .export steaxspidx + .import popax + .importzp sreg, ptr1, tmp1, tmp2, tmp3 -.proc steaxspidx +.proc steaxspidx - sta tmp1 - stx tmp2 - sty tmp3 - jsr popax ; get the pointer - sta ptr1 - stx ptr1+1 - ldy tmp3 - lda tmp1 - sta (ptr1),y - iny - lda tmp2 - sta (ptr1),y - iny - tax - lda sreg - sta (ptr1),y - iny - lda sreg+1 - sta (ptr1),y - lda tmp1 - rts + sta tmp1 + stx tmp2 + sty tmp3 + jsr popax ; get the pointer + sta ptr1 + stx ptr1+1 + ldy tmp3 + lda tmp1 + sta (ptr1),y + iny + lda tmp2 + sta (ptr1),y + iny + tax + lda sreg + sta (ptr1),y + iny + lda sreg+1 + sta (ptr1),y + lda tmp1 + rts .endproc diff --git a/libsrc/runtime/stkchk.s b/libsrc/runtime/stkchk.s index ee0b7144c..73df09917 100644 --- a/libsrc/runtime/stkchk.s +++ b/libsrc/runtime/stkchk.s @@ -13,14 +13,14 @@ ; its' bounds. ; - .export stkchk, cstkchk - .constructor initstkchk, 25 - .import __STACKSIZE__ ; Linker defined - .import pusha0, _exit - .importzp sp + .export stkchk, cstkchk + .constructor initstkchk, 25 + .import __STACKSIZE__ ; Linker defined + .import pusha0, _exit + .importzp sp - ; Use macros for better readability - .macpack generic + ; Use macros for better readability + .macpack generic .macpack cpu @@ -30,22 +30,22 @@ .segment "INIT" -.proc initstkchk +.proc initstkchk - lda sp - sta initialsp - sub #<__STACKSIZE__ - sta lowwater - lda sp+1 - sta initialsp+1 - sbc #>__STACKSIZE__ + lda sp + sta initialsp + sub #<__STACKSIZE__ + sta lowwater + lda sp+1 + sta initialsp+1 + sbc #>__STACKSIZE__ .if (.cpu .bitand ::CPU_ISET_65SC02) - ina ; Add 256 bytes safety area + ina ; Add 256 bytes safety area .else - add #1 ; Add 256 bytes safety area + add #1 ; Add 256 bytes safety area .endif - sta lowwater+1 - rts + sta lowwater+1 + rts .endproc @@ -55,10 +55,10 @@ .code -stkchk: tsx - cpx #12 - bcc Fail ; Jump on stack overflow - rts ; Return if ok +stkchk: tsx + cpx #12 + bcc Fail ; Jump on stack overflow + rts ; Return if ok ; ---------------------------------------------------------------------------- ; C stack checking routine. Does not need to save any registers. @@ -69,34 +69,34 @@ cstkchk: ; Check the high byte of the software stack -@L0: lda lowwater+1 - cmp sp+1 - bcs @L1 - rts +@L0: lda lowwater+1 + cmp sp+1 + bcs @L1 + rts ; Check low byte -@L1: bne CStackOverflow - lda lowwater - cmp sp - bcs CStackOverflow -Done: rts +@L1: bne CStackOverflow + lda lowwater + cmp sp + bcs CStackOverflow +Done: rts ; We have a C stack overflow. Set the stack pointer to the initial value, so ; we can continue without worrying about stack issues. CStackOverflow: - lda initialsp - sta sp - lda initialsp+1 - sta sp+1 + lda initialsp + sta sp + lda initialsp+1 + sta sp+1 ; Generic abort entry. We should output a diagnostic here, but this is ; difficult, since we're operating at a lower level here. -Fail: lda #4 +Fail: lda #4 ldx #0 - jmp _exit + jmp _exit ; ---------------------------------------------------------------------------- ; Data @@ -105,10 +105,10 @@ Fail: lda #4 ; Initial stack pointer value. Stack is reset to this in case of overflows to ; allow program exit processing. -initialsp: .word 0 +initialsp: .word 0 ; Stack low water mark. -lowwater: .word 0 +lowwater: .word 0 diff --git a/libsrc/runtime/sub.s b/libsrc/runtime/sub.s index c9d427efd..b41df3d91 100644 --- a/libsrc/runtime/sub.s +++ b/libsrc/runtime/sub.s @@ -4,32 +4,32 @@ ; CC65 runtime: sub ints ; - .export tossuba0, tossubax - .import addysp1 - .importzp sp + .export tossuba0, tossubax + .import addysp1 + .importzp sp .macpack cpu ; AX = TOS - AX tossuba0: - ldx #0 + ldx #0 tossubax: - sec - eor #$FF + sec + eor #$FF .if (.cpu .bitand CPU_ISET_65SC02) - adc (sp) - ldy #1 + adc (sp) + ldy #1 .else - ldy #0 - adc (sp),y ; Subtract low byte - iny + ldy #0 + adc (sp),y ; Subtract low byte + iny .endif - pha ; Save high byte + pha ; Save high byte txa - eor #$FF - adc (sp),y ; Subtract high byte - tax ; High byte into X - pla ; Restore low byte - jmp addysp1 ; drop TOS + eor #$FF + adc (sp),y ; Subtract high byte + tax ; High byte into X + pla ; Restore low byte + jmp addysp1 ; drop TOS diff --git a/libsrc/runtime/subeqsp.s b/libsrc/runtime/subeqsp.s index 8a2e3e3ee..24080d97d 100644 --- a/libsrc/runtime/subeqsp.s +++ b/libsrc/runtime/subeqsp.s @@ -4,23 +4,23 @@ ; CC65 runtime: -= operator for ints on the stack ; - .export subeq0sp, subeqysp - .importzp sp + .export subeq0sp, subeqysp + .importzp sp subeq0sp: - ldy #0 + ldy #0 subeqysp: - sec - eor #$FF - adc (sp),y - sta (sp),y - pha ; Save low byte - iny - txa - eor #$FF - adc (sp),y - sta (sp),y - tax - pla ; Restore low byte - rts + sec + eor #$FF + adc (sp),y + sta (sp),y + pha ; Save low byte + iny + txa + eor #$FF + adc (sp),y + sta (sp),y + tax + pla ; Restore low byte + rts diff --git a/libsrc/runtime/subysp.s b/libsrc/runtime/subysp.s index 9d1a2c691..9fae44222 100644 --- a/libsrc/runtime/subysp.s +++ b/libsrc/runtime/subysp.s @@ -5,19 +5,19 @@ ; CC65 runtime: Decrement the stackpointer by value in y ; - .export subysp - .importzp sp + .export subysp + .importzp sp -.proc subysp +.proc subysp - tya - eor #$ff - sec - adc sp - sta sp - bcs @L1 - dec sp+1 -@L1: rts + tya + eor #$ff + sec + adc sp + sta sp + bcs @L1 + dec sp+1 +@L1: rts .endproc diff --git a/libsrc/runtime/swap.s b/libsrc/runtime/swap.s index e2f882f7e..e91eeca31 100644 --- a/libsrc/runtime/swap.s +++ b/libsrc/runtime/swap.s @@ -4,22 +4,22 @@ ; CC65 runtime: swap ax with TOS ; - .export swapstk - .importzp sp, ptr4 + .export swapstk + .importzp sp, ptr4 swapstk: - sta ptr4 - stx ptr4+1 - ldy #1 ; index - lda (sp),y - tax - lda ptr4+1 - sta (sp),y - dey - lda (sp),y - pha - lda ptr4 - sta (sp),y - pla - rts ; whew! + sta ptr4 + stx ptr4+1 + ldy #1 ; index + lda (sp),y + tax + lda ptr4+1 + sta (sp),y + dey + lda (sp),y + pha + lda ptr4 + sta (sp),y + pla + rts ; whew! diff --git a/libsrc/runtime/tosint.s b/libsrc/runtime/tosint.s index d29fa2e8b..ed32298bd 100644 --- a/libsrc/runtime/tosint.s +++ b/libsrc/runtime/tosint.s @@ -4,30 +4,30 @@ ; CC65 runtime: Convert tos from long to int ; - .export tosint - .import incsp2 - .importzp sp + .export tosint + .import incsp2 + .importzp sp .macpack cpu ; Convert TOS from long to int by cutting of the high 16bit -.proc tosint +.proc tosint - pha + pha .if (.cpu .bitand ::CPU_ISET_65SC02) - lda (sp) + lda (sp) .else - ldy #0 - lda (sp),y ; sp+1 + ldy #0 + lda (sp),y ; sp+1 .endif - ldy #2 - sta (sp),y - dey - lda (sp),y - ldy #3 - sta (sp),y - pla - jmp incsp2 ; Drop 16 bit + ldy #2 + sta (sp),y + dey + lda (sp),y + ldy #3 + sta (sp),y + pla + jmp incsp2 ; Drop 16 bit .endproc diff --git a/libsrc/runtime/toslong.s b/libsrc/runtime/toslong.s index 9bf66a321..9065d3e6c 100644 --- a/libsrc/runtime/toslong.s +++ b/libsrc/runtime/toslong.s @@ -4,57 +4,57 @@ ; CC65 runtime: Convert tos from int to long ; - .export tosulong, toslong - .import decsp2 - .importzp sp + .export tosulong, toslong + .import decsp2 + .importzp sp .macpack cpu ; Convert TOS from int to long tosulong: - pha - jsr decsp2 ; Make room - ldy #2 - lda (sp),y + pha + jsr decsp2 ; Make room + ldy #2 + lda (sp),y .if (.cpu .bitand CPU_ISET_65SC02) - sta (sp) ; 65C02 version - iny ; Y = 3 + sta (sp) ; 65C02 version + iny ; Y = 3 .else - ldy #0 - sta (sp),y - ldy #3 + ldy #0 + sta (sp),y + ldy #3 .endif - lda (sp),y + lda (sp),y toslong1: - ldy #1 - sta (sp),y - lda #0 ; Zero extend + ldy #1 + sta (sp),y + lda #0 ; Zero extend toslong2: - iny - sta (sp),y - iny - sta (sp),y - pla - rts + iny + sta (sp),y + iny + sta (sp),y + pla + rts toslong: - pha - jsr decsp2 ; Make room - ldy #2 - lda (sp),y + pha + jsr decsp2 ; Make room + ldy #2 + lda (sp),y .if (.cpu .bitand CPU_ISET_65SC02) - sta (sp) ; 65C02 version - iny ; Y = 3 + sta (sp) ; 65C02 version + iny ; Y = 3 .else - ldy #0 - sta (sp),y - ldy #3 + ldy #0 + sta (sp),y + ldy #3 .endif - lda (sp),y - bpl toslong1 ; Jump if positive, high word is zero - ldy #1 - sta (sp),y - lda #$FF - bne toslong2 ; Branch always + lda (sp),y + bpl toslong1 ; Jump if positive, high word is zero + ldy #1 + sta (sp),y + lda #$FF + bne toslong2 ; Branch always diff --git a/libsrc/runtime/udiv.s b/libsrc/runtime/udiv.s index e667af0e2..93548d049 100644 --- a/libsrc/runtime/udiv.s +++ b/libsrc/runtime/udiv.s @@ -4,79 +4,79 @@ ; CC65 runtime: division for unsigned ints ; - .export tosudiva0, tosudivax, udiv16 - .import popsreg - .importzp sreg, ptr1, ptr4 + .export tosudiva0, tosudivax, udiv16 + .import popsreg + .importzp sreg, ptr1, ptr4 tosudiva0: ldx #$00 ; Clear high byte tosudivax: - sta ptr4 - stx ptr4+1 ; Save right operand - jsr popsreg ; Get left operand + sta ptr4 + stx ptr4+1 ; Save right operand + jsr popsreg ; Get left operand ; Do the division - jsr udiv16 + jsr udiv16 ; Result is in sreg, remainder in ptr1 - lda sreg - ldx sreg+1 - rts + lda sreg + ldx sreg+1 + rts ;--------------------------------------------------------------------------- ; 16by16 division. Divide sreg by ptr4. Result is in sreg, remainder in ptr1 ; (see mult-div.s from "The Fridge"). ; This is also the entry point for the signed division -udiv16: lda #0 - sta ptr1+1 - ldy #16 +udiv16: lda #0 + sta ptr1+1 + ldy #16 ldx ptr4+1 beq udiv16by8a -L0: asl sreg - rol sreg+1 - rol a - rol ptr1+1 +L0: asl sreg + rol sreg+1 + rol a + rol ptr1+1 - pha - cmp ptr4 - lda ptr1+1 - sbc ptr4+1 - bcc L1 + pha + cmp ptr4 + lda ptr1+1 + sbc ptr4+1 + bcc L1 - sta ptr1+1 - pla - sbc ptr4 - pha - inc sreg + sta ptr1+1 + pla + sbc ptr4 + pha + inc sreg -L1: pla - dey - bne L0 - sta ptr1 - rts +L1: pla + dey + bne L0 + sta ptr1 + rts ;--------------------------------------------------------------------------- ; 16by8 division udiv16by8a: -@L0: asl sreg - rol sreg+1 - rol a +@L0: asl sreg + rol sreg+1 + rol a bcs @L1 - cmp ptr4 - bcc @L2 -@L1: sbc ptr4 - inc sreg + cmp ptr4 + bcc @L2 +@L1: sbc ptr4 + inc sreg -@L2: dey - bne @L0 - sta ptr1 - rts +@L2: dey + bne @L0 + sta ptr1 + rts diff --git a/libsrc/runtime/udiv32by16r16.s b/libsrc/runtime/udiv32by16r16.s index 3925ffe81..9897f9908 100644 --- a/libsrc/runtime/udiv32by16r16.s +++ b/libsrc/runtime/udiv32by16r16.s @@ -4,7 +4,7 @@ ; CC65 runtime: 32by16 => 16 unsigned division ; - .export udiv32by16r16, udiv32by16r16m + .export udiv32by16r16, udiv32by16r16m .include "zeropage.inc" @@ -23,34 +23,34 @@ udiv32by16r16: sta ptr3 stx ptr3+1 udiv32by16r16m: - lda #0 - sta sreg+1 - ldy #32 + lda #0 + sta sreg+1 + ldy #32 -L0: asl ptr1 +L0: asl ptr1 rol ptr1+1 rol ptr2 rol ptr2+1 rol a rol sreg+1 - pha - cmp ptr3 - lda sreg+1 - sbc ptr3+1 - bcc L1 + pha + cmp ptr3 + lda sreg+1 + sbc ptr3+1 + bcc L1 - sta sreg+1 - pla - sbc ptr3 - pha - inc ptr1 + sta sreg+1 + pla + sbc ptr3 + pha + inc ptr1 -L1: pla - dey - bne L0 - sta sreg +L1: pla + dey + bne L0 + sta sreg lda ptr1 ldx ptr1+1 - rts + rts diff --git a/libsrc/runtime/uge.s b/libsrc/runtime/uge.s index 96e949717..ecbe74efd 100644 --- a/libsrc/runtime/uge.s +++ b/libsrc/runtime/uge.s @@ -4,17 +4,17 @@ ; CC65 runtime: Compare >= for unsigned ints ; - .export tosuge00, tosugea0, tosugeax - .import tosicmp, booluge + .export tosuge00, tosugea0, tosugeax + .import tosicmp, booluge tosuge00: - lda #$00 + lda #$00 tosugea0: - ldx #$00 + ldx #$00 tosugeax: - jsr tosicmp ; Set flags - jmp booluge ; Convert to boolean + jsr tosicmp ; Set flags + jmp booluge ; Convert to boolean diff --git a/libsrc/runtime/ugt.s b/libsrc/runtime/ugt.s index a8befbfca..3b05f435f 100644 --- a/libsrc/runtime/ugt.s +++ b/libsrc/runtime/ugt.s @@ -4,15 +4,15 @@ ; CC65 runtime: Compare > for unsigned ints ; - .export tosugt00, tosugta0, tosugtax - .import tosicmp, boolugt + .export tosugt00, tosugta0, tosugtax + .import tosicmp, boolugt tosugt00: - lda #$00 + lda #$00 tosugta0: - ldx #$00 + ldx #$00 tosugtax: - jsr tosicmp ; Set flags - jmp boolugt ; Convert to boolean + jsr tosicmp ; Set flags + jmp boolugt ; Convert to boolean diff --git a/libsrc/runtime/ule.s b/libsrc/runtime/ule.s index 5e0817d49..7a78ff490 100644 --- a/libsrc/runtime/ule.s +++ b/libsrc/runtime/ule.s @@ -4,15 +4,15 @@ ; CC65 runtime: Compare <= for unsigned ints ; - .export tosule00, tosulea0, tosuleax - .import tosicmp, boolule + .export tosule00, tosulea0, tosuleax + .import tosicmp, boolule tosule00: - lda #$00 + lda #$00 tosulea0: - ldx #$00 + ldx #$00 tosuleax: - jsr tosicmp ; Set flags - jmp boolule ; Convert to boolean + jsr tosicmp ; Set flags + jmp boolule ; Convert to boolean diff --git a/libsrc/runtime/ult.s b/libsrc/runtime/ult.s index d2895d08d..34df73262 100644 --- a/libsrc/runtime/ult.s +++ b/libsrc/runtime/ult.s @@ -4,15 +4,15 @@ ; CC65 runtime: Compare < for unsigned ints ; - .export tosult00, tosulta0, tosultax - .import tosicmp, boolult, return0 + .export tosult00, tosulta0, tosultax + .import tosicmp, boolult, return0 -tosult00 = return0 ; This is always false +tosult00 = return0 ; This is always false tosulta0: - ldx #$00 + ldx #$00 tosultax: - jsr tosicmp ; Set flags - jmp boolult ; Convert to boolean + jsr tosicmp ; Set flags + jmp boolult ; Convert to boolean diff --git a/libsrc/runtime/umod.s b/libsrc/runtime/umod.s index b465d90f0..92ebb5f91 100644 --- a/libsrc/runtime/umod.s +++ b/libsrc/runtime/umod.s @@ -4,25 +4,25 @@ ; CC65 runtime: modulo operation for unsigned ints ; - .export tosumoda0, tosumodax - .import popsreg, udiv16 - .importzp ptr1, ptr4 + .export tosumoda0, tosumodax + .import popsreg, udiv16 + .importzp ptr1, ptr4 tosumoda0: - ldx #0 + ldx #0 tosumodax: - sta ptr4 - stx ptr4+1 ; Save right operand - jsr popsreg ; Get right operand + sta ptr4 + stx ptr4+1 ; Save right operand + jsr popsreg ; Get right operand ; Do the division - jsr udiv16 + jsr udiv16 ; Result is in sreg, remainder in ptr1 - lda ptr1 - ldx ptr1+1 - rts + lda ptr1 + ldx ptr1+1 + rts - + diff --git a/libsrc/runtime/umul16x16r32.s b/libsrc/runtime/umul16x16r32.s index d481fd166..c02cf8bb2 100644 --- a/libsrc/runtime/umul16x16r32.s +++ b/libsrc/runtime/umul16x16r32.s @@ -32,32 +32,32 @@ umul16x16r16: umul16x16r32m: umul16x16r16m: - lda #0 - sta sreg+1 - ldy #16 ; Number of bits + lda #0 + sta sreg+1 + ldy #16 ; Number of bits lsr ptr1+1 ror ptr1 ; Get first bit into carry @L0: bcc @L1 - clc - adc ptr3 - pha - lda ptr3+1 - adc sreg+1 - sta sreg+1 - pla + clc + adc ptr3 + pha + lda ptr3+1 + adc sreg+1 + sta sreg+1 + pla @L1: ror sreg+1 - ror a - ror ptr1+1 - ror ptr1 + ror a + ror ptr1+1 + ror ptr1 dey bne @L0 sta sreg ; Save byte 3 - lda ptr1 ; Load the result - ldx ptr1+1 - rts ; Done + lda ptr1 ; Load the result + ldx ptr1+1 + rts ; Done diff --git a/libsrc/runtime/umul8x16r24.s b/libsrc/runtime/umul8x16r24.s index 9a982d58a..64653f5f4 100644 --- a/libsrc/runtime/umul8x16r24.s +++ b/libsrc/runtime/umul8x16r24.s @@ -30,11 +30,11 @@ umul8x16r16: umul8x16r24m: umul8x16r16m: - ldx #0 + ldx #0 stx ptr1+1 - stx sreg + stx sreg - ldy #8 ; Number of bits + ldy #8 ; Number of bits ldx ptr3 ; Get into register for speed lda ptr1 ror a ; Get next bit into carry @@ -51,13 +51,13 @@ umul8x16r16m: pla @L1: ror sreg - ror ptr1+1 - ror a + ror ptr1+1 + ror a dey bne @L0 sta ptr1 ; Save low byte of result ldx ptr1+1 ; Load high byte of result - rts ; Done + rts ; Done diff --git a/libsrc/runtime/umul8x8r16.s b/libsrc/runtime/umul8x8r16.s index 543110f1b..34ff82872 100644 --- a/libsrc/runtime/umul8x8r16.s +++ b/libsrc/runtime/umul8x8r16.s @@ -4,8 +4,8 @@ ; CC65 runtime: 8x8 => 16 multiplication ; - .export umul8x8r16, umul8x8r16m - .importzp ptr1, ptr3 + .export umul8x8r16, umul8x8r16m + .importzp ptr1, ptr3 ;--------------------------------------------------------------------------- @@ -19,8 +19,8 @@ umul8x8r16: sta ptr3 umul8x8r16m: - lda #0 ; Clear byte 1 - ldy #8 ; Number of bits + lda #0 ; Clear byte 1 + ldy #8 ; Number of bits lsr ptr1 ; Get first bit of lhs into carry @L0: bcc @L1 clc @@ -31,7 +31,7 @@ umul8x8r16m: bne @L0 tax stx ptr1+1 ; Result in a/x and ptr1 - lda ptr1 ; Load the result - rts ; Done + lda ptr1 ; Load the result + rts ; Done diff --git a/libsrc/runtime/xor.s b/libsrc/runtime/xor.s index 9027cb1d6..825c576d1 100644 --- a/libsrc/runtime/xor.s +++ b/libsrc/runtime/xor.s @@ -4,20 +4,20 @@ ; CC65 runtime: xor on ints ; - .export tosxora0, tosxorax - .import addysp1 - .importzp sp, tmp1 + .export tosxora0, tosxorax + .import addysp1 + .importzp sp, tmp1 tosxora0: - ldx #$00 + ldx #$00 tosxorax: - ldy #0 - eor (sp),y - sta tmp1 - iny - txa - eor (sp),y - tax - lda tmp1 - jmp addysp1 ; drop TOS, set condition codes + ldy #0 + eor (sp),y + sta tmp1 + iny + txa + eor (sp),y + tax + lda tmp1 + jmp addysp1 ; drop TOS, set condition codes diff --git a/libsrc/runtime/zeropage.s b/libsrc/runtime/zeropage.s index 8d5818344..b4af44e33 100644 --- a/libsrc/runtime/zeropage.s +++ b/libsrc/runtime/zeropage.s @@ -10,18 +10,18 @@ .zeropage -sp: .res 2 ; Stack pointer -sreg: .res 2 ; Secondary register/high 16 bit for longs -regsave: .res 4 ; Slot to save/restore (E)AX into -ptr1: .res 2 -ptr2: .res 2 -ptr3: .res 2 -ptr4: .res 2 -tmp1: .res 1 -tmp2: .res 1 -tmp3: .res 1 -tmp4: .res 1 -regbank: .res regbanksize ; Register bank +sp: .res 2 ; Stack pointer +sreg: .res 2 ; Secondary register/high 16 bit for longs +regsave: .res 4 ; Slot to save/restore (E)AX into +ptr1: .res 2 +ptr2: .res 2 +ptr3: .res 2 +ptr4: .res 2 +tmp1: .res 1 +tmp2: .res 1 +tmp3: .res 1 +tmp4: .res 1 +regbank: .res regbanksize ; Register bank ; Add an empty EXTZP zeropage segment to avoid linker warnings that this ; segment does not exist (it does not exist in most builtin linker configs diff --git a/libsrc/serial/ser-kernel.s b/libsrc/serial/ser-kernel.s index d96f8306a..7a91e5e4b 100644 --- a/libsrc/serial/ser-kernel.s +++ b/libsrc/serial/ser-kernel.s @@ -6,7 +6,7 @@ .import return0 .importzp ptr1 - .interruptor ser_irq, 29 ; Export as high priority IRQ handler + .interruptor ser_irq, 29 ; Export as high priority IRQ handler .include "ser-kernel.inc" .include "ser-error.inc" @@ -17,20 +17,20 @@ .bss -_ser_drv: .res 2 ; Pointer to driver +_ser_drv: .res 2 ; Pointer to driver ; Jump table for the driver functions. .data ser_vectors: -ser_install: jmp return0 -ser_uninstall: jmp return0 +ser_install: jmp return0 +ser_uninstall: jmp return0 ser_open: jmp return0 ser_close: jmp return0 ser_get: jmp return0 ser_put: jmp return0 ser_status: jmp return0 ser_ioctl: jmp return0 -ser_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes +ser_irq: .byte $60, $00, $00 ; RTS plus two dummy bytes ; Driver header signature .rodata @@ -44,10 +44,10 @@ ser_sig: .byte $73, $65, $72, SER_API_VERSION ; "ser", version _ser_install: - sta _ser_drv - sta ptr1 - stx _ser_drv+1 - stx ptr1+1 + sta _ser_drv + sta ptr1 + stx _ser_drv+1 + stx ptr1+1 ; Check the driver signature @@ -72,8 +72,8 @@ _ser_install: ldy ser_irq+2 ; Check high byte of IRQ vector beq @L2 ; Jump if vector invalid - ldy #$4C ; Jump opcode - sty ser_irq ; Activate IRQ routine + ldy #$4C ; Jump opcode + sty ser_irq ; Activate IRQ routine @L2: rts ; Driver signature invalid @@ -100,8 +100,8 @@ copy: lda (ptr1),y _ser_uninstall: jsr ser_uninstall ; Call driver routine - lda #$60 ; RTS opcode - sta ser_irq ; Disable IRQ entry point + lda #$60 ; RTS opcode + sta ser_irq ; Disable IRQ entry point _ser_clear_ptr: ; External entry point lda #0 diff --git a/libsrc/serial/ser_unload.s b/libsrc/serial/ser_unload.s index c97a4b3d3..bf7201255 100644 --- a/libsrc/serial/ser_unload.s +++ b/libsrc/serial/ser_unload.s @@ -15,23 +15,23 @@ _ser_unload: - lda _ser_drv + lda _ser_drv pha ; Save pointer to driver - ora _ser_drv+1 - beq no_driver ; No driver - lda _ser_drv+1 - pha + ora _ser_drv+1 + beq no_driver ; No driver + lda _ser_drv+1 + pha - jsr _ser_uninstall ; Uninstall the driver + jsr _ser_uninstall ; Uninstall the driver - pla - tax - pla ; Get pointer to driver + pla + tax + pla ; Get pointer to driver jsr _mod_free ; Free the driver jmp return0 ; Return SER_ERR_OK no_driver: - tax ; X = 0 + tax ; X = 0 pla ; Remove pushed junk - lda #(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - sta sp+1 ; Set argument stack ptr - stz sp ; #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - jsr initlib - jsr _main -_exit: jsr donelib -exit: jmp exit + lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp+1 ; Set argument stack ptr + stz sp ; #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + jsr initlib + jsr _main +_exit: jsr donelib +exit: jmp exit .proc irq - pha - lda sv_irq_source - and #SV_IRQ_REQUEST_TIMER - beq not_timer - lda sv_timer_quit - inc _sv_irq_timer_counter + pha + lda sv_irq_source + and #SV_IRQ_REQUEST_TIMER + beq not_timer + lda sv_timer_quit + inc _sv_irq_timer_counter not_timer: - lda sv_irq_source - and #SV_IRQ_REQUEST_DMA - beq not_dma - lda sv_dma_quit - inc _sv_irq_dma_counter + lda sv_irq_source + and #SV_IRQ_REQUEST_DMA + beq not_dma + lda sv_dma_quit + inc _sv_irq_dma_counter not_dma: - pla - rti + pla + rti .endproc .proc nmi - inc _sv_nmi_counter - rti + inc _sv_nmi_counter + rti .endproc ; removing this segment gives only a warning diff --git a/libsrc/supervision/ctype.s b/libsrc/supervision/ctype.s index f8b04a1a6..1892554fd 100644 --- a/libsrc/supervision/ctype.s +++ b/libsrc/supervision/ctype.s @@ -4,7 +4,7 @@ ; Character specification table. ; - .include "ctype.inc" + .include "ctype.inc" ; The tables are readonly, put them into the rodata segment @@ -25,136 +25,136 @@ __ctype: - .byte CT_CTRL ; 0/00 ___ctrl_@___ - .byte CT_CTRL ; 1/01 ___ctrl_A___ - .byte CT_CTRL ; 2/02 ___ctrl_B___ - .byte CT_CTRL ; 3/03 ___ctrl_C___ - .byte CT_CTRL ; 4/04 ___ctrl_D___ - .byte CT_CTRL ; 5/05 ___ctrl_E___ - .byte CT_CTRL ; 6/06 ___ctrl_F___ - .byte CT_CTRL ; 7/07 ___ctrl_G___ - .byte CT_CTRL ; 8/08 ___ctrl_H___ - .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB - ; 9/09 ___ctrl_I___ - .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___ - .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___ - .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___ - .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___ - .byte CT_CTRL ; 14/0e ___ctrl_N___ - .byte CT_CTRL ; 15/0f ___ctrl_O___ - .byte CT_CTRL ; 16/10 ___ctrl_P___ - .byte CT_CTRL ; 17/11 ___ctrl_Q___ - .byte CT_CTRL ; 18/12 ___ctrl_R___ - .byte CT_CTRL ; 19/13 ___ctrl_S___ - .byte CT_CTRL ; 20/14 ___ctrl_T___ - .byte CT_CTRL ; 21/15 ___ctrl_U___ - .byte CT_CTRL ; 22/16 ___ctrl_V___ - .byte CT_CTRL ; 23/17 ___ctrl_W___ - .byte CT_CTRL ; 24/18 ___ctrl_X___ - .byte CT_CTRL ; 25/19 ___ctrl_Y___ - .byte CT_CTRL ; 26/1a ___ctrl_Z___ - .byte CT_CTRL ; 27/1b ___ctrl_[___ - .byte CT_CTRL ; 28/1c ___ctrl_\___ - .byte CT_CTRL ; 29/1d ___ctrl_]___ - .byte CT_CTRL ; 30/1e ___ctrl_^___ - .byte CT_CTRL ; 31/1f ___ctrl_____ - .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___ - .byte CT_NONE ; 33/21 _____!_____ - .byte CT_NONE ; 34/22 _____"_____ - .byte CT_NONE ; 35/23 _____#_____ - .byte CT_NONE ; 36/24 _____$_____ - .byte CT_NONE ; 37/25 _____%_____ - .byte CT_NONE ; 38/26 _____&_____ - .byte CT_NONE ; 39/27 _____'_____ - .byte CT_NONE ; 40/28 _____(_____ - .byte CT_NONE ; 41/29 _____)_____ - .byte CT_NONE ; 42/2a _____*_____ - .byte CT_NONE ; 43/2b _____+_____ - .byte CT_NONE ; 44/2c _____,_____ - .byte CT_NONE ; 45/2d _____-_____ - .byte CT_NONE ; 46/2e _____._____ - .byte CT_NONE ; 47/2f _____/_____ - .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ - .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ - .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ - .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ - .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ - .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ - .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ - .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ - .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ - .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ - .byte CT_NONE ; 58/3a _____:_____ - .byte CT_NONE ; 59/3b _____;_____ - .byte CT_NONE ; 60/3c _____<_____ - .byte CT_NONE ; 61/3d _____=_____ - .byte CT_NONE ; 62/3e _____>_____ - .byte CT_NONE ; 63/3f _____?_____ + .byte CT_CTRL ; 0/00 ___ctrl_@___ + .byte CT_CTRL ; 1/01 ___ctrl_A___ + .byte CT_CTRL ; 2/02 ___ctrl_B___ + .byte CT_CTRL ; 3/03 ___ctrl_C___ + .byte CT_CTRL ; 4/04 ___ctrl_D___ + .byte CT_CTRL ; 5/05 ___ctrl_E___ + .byte CT_CTRL ; 6/06 ___ctrl_F___ + .byte CT_CTRL ; 7/07 ___ctrl_G___ + .byte CT_CTRL ; 8/08 ___ctrl_H___ + .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB + ; 9/09 ___ctrl_I___ + .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___ + .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___ + .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___ + .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___ + .byte CT_CTRL ; 14/0e ___ctrl_N___ + .byte CT_CTRL ; 15/0f ___ctrl_O___ + .byte CT_CTRL ; 16/10 ___ctrl_P___ + .byte CT_CTRL ; 17/11 ___ctrl_Q___ + .byte CT_CTRL ; 18/12 ___ctrl_R___ + .byte CT_CTRL ; 19/13 ___ctrl_S___ + .byte CT_CTRL ; 20/14 ___ctrl_T___ + .byte CT_CTRL ; 21/15 ___ctrl_U___ + .byte CT_CTRL ; 22/16 ___ctrl_V___ + .byte CT_CTRL ; 23/17 ___ctrl_W___ + .byte CT_CTRL ; 24/18 ___ctrl_X___ + .byte CT_CTRL ; 25/19 ___ctrl_Y___ + .byte CT_CTRL ; 26/1a ___ctrl_Z___ + .byte CT_CTRL ; 27/1b ___ctrl_[___ + .byte CT_CTRL ; 28/1c ___ctrl_\___ + .byte CT_CTRL ; 29/1d ___ctrl_]___ + .byte CT_CTRL ; 30/1e ___ctrl_^___ + .byte CT_CTRL ; 31/1f ___ctrl_____ + .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___ + .byte CT_NONE ; 33/21 _____!_____ + .byte CT_NONE ; 34/22 _____"_____ + .byte CT_NONE ; 35/23 _____#_____ + .byte CT_NONE ; 36/24 _____$_____ + .byte CT_NONE ; 37/25 _____%_____ + .byte CT_NONE ; 38/26 _____&_____ + .byte CT_NONE ; 39/27 _____'_____ + .byte CT_NONE ; 40/28 _____(_____ + .byte CT_NONE ; 41/29 _____)_____ + .byte CT_NONE ; 42/2a _____*_____ + .byte CT_NONE ; 43/2b _____+_____ + .byte CT_NONE ; 44/2c _____,_____ + .byte CT_NONE ; 45/2d _____-_____ + .byte CT_NONE ; 46/2e _____._____ + .byte CT_NONE ; 47/2f _____/_____ + .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____ + .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____ + .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____ + .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____ + .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____ + .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____ + .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____ + .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____ + .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____ + .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____ + .byte CT_NONE ; 58/3a _____:_____ + .byte CT_NONE ; 59/3b _____;_____ + .byte CT_NONE ; 60/3c _____<_____ + .byte CT_NONE ; 61/3d _____=_____ + .byte CT_NONE ; 62/3e _____>_____ + .byte CT_NONE ; 63/3f _____?_____ - .byte CT_NONE ; 64/40 _____@_____ - .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____ - .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____ - .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____ - .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____ - .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____ - .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____ - .byte CT_UPPER ; 71/47 _____G_____ - .byte CT_UPPER ; 72/48 _____H_____ - .byte CT_UPPER ; 73/49 _____I_____ - .byte CT_UPPER ; 74/4a _____J_____ - .byte CT_UPPER ; 75/4b _____K_____ - .byte CT_UPPER ; 76/4c _____L_____ - .byte CT_UPPER ; 77/4d _____M_____ - .byte CT_UPPER ; 78/4e _____N_____ - .byte CT_UPPER ; 79/4f _____O_____ - .byte CT_UPPER ; 80/50 _____P_____ - .byte CT_UPPER ; 81/51 _____Q_____ - .byte CT_UPPER ; 82/52 _____R_____ - .byte CT_UPPER ; 83/53 _____S_____ - .byte CT_UPPER ; 84/54 _____T_____ - .byte CT_UPPER ; 85/55 _____U_____ - .byte CT_UPPER ; 86/56 _____V_____ - .byte CT_UPPER ; 87/57 _____W_____ - .byte CT_UPPER ; 88/58 _____X_____ - .byte CT_UPPER ; 89/59 _____Y_____ - .byte CT_UPPER ; 90/5a _____Z_____ - .byte CT_NONE ; 91/5b _____[_____ - .byte CT_NONE ; 92/5c _____\_____ - .byte CT_NONE ; 93/5d _____]_____ - .byte CT_NONE ; 94/5e _____^_____ - .byte CT_NONE ; 95/5f _UNDERLINE_ - .byte CT_NONE ; 96/60 ___grave___ - .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____ - .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____ - .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____ - .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____ - .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____ - .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____ - .byte CT_LOWER ; 103/67 _____g_____ - .byte CT_LOWER ; 104/68 _____h_____ - .byte CT_LOWER ; 105/69 _____i_____ - .byte CT_LOWER ; 106/6a _____j_____ - .byte CT_LOWER ; 107/6b _____k_____ - .byte CT_LOWER ; 108/6c _____l_____ - .byte CT_LOWER ; 109/6d _____m_____ - .byte CT_LOWER ; 110/6e _____n_____ - .byte CT_LOWER ; 111/6f _____o_____ - .byte CT_LOWER ; 112/70 _____p_____ - .byte CT_LOWER ; 113/71 _____q_____ - .byte CT_LOWER ; 114/72 _____r_____ - .byte CT_LOWER ; 115/73 _____s_____ - .byte CT_LOWER ; 116/74 _____t_____ - .byte CT_LOWER ; 117/75 _____u_____ - .byte CT_LOWER ; 118/76 _____v_____ - .byte CT_LOWER ; 119/77 _____w_____ - .byte CT_LOWER ; 120/78 _____x_____ - .byte CT_LOWER ; 121/79 _____y_____ - .byte CT_LOWER ; 122/7a _____z_____ - .byte CT_NONE ; 123/7b _____{_____ - .byte CT_NONE ; 124/7c _____|_____ - .byte CT_NONE ; 125/7d _____}_____ - .byte CT_NONE ; 126/7e _____~_____ - .byte CT_OTHER_WS ; 127/7f ____DEL____ + .byte CT_NONE ; 64/40 _____@_____ + .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____ + .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____ + .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____ + .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____ + .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____ + .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____ + .byte CT_UPPER ; 71/47 _____G_____ + .byte CT_UPPER ; 72/48 _____H_____ + .byte CT_UPPER ; 73/49 _____I_____ + .byte CT_UPPER ; 74/4a _____J_____ + .byte CT_UPPER ; 75/4b _____K_____ + .byte CT_UPPER ; 76/4c _____L_____ + .byte CT_UPPER ; 77/4d _____M_____ + .byte CT_UPPER ; 78/4e _____N_____ + .byte CT_UPPER ; 79/4f _____O_____ + .byte CT_UPPER ; 80/50 _____P_____ + .byte CT_UPPER ; 81/51 _____Q_____ + .byte CT_UPPER ; 82/52 _____R_____ + .byte CT_UPPER ; 83/53 _____S_____ + .byte CT_UPPER ; 84/54 _____T_____ + .byte CT_UPPER ; 85/55 _____U_____ + .byte CT_UPPER ; 86/56 _____V_____ + .byte CT_UPPER ; 87/57 _____W_____ + .byte CT_UPPER ; 88/58 _____X_____ + .byte CT_UPPER ; 89/59 _____Y_____ + .byte CT_UPPER ; 90/5a _____Z_____ + .byte CT_NONE ; 91/5b _____[_____ + .byte CT_NONE ; 92/5c _____\_____ + .byte CT_NONE ; 93/5d _____]_____ + .byte CT_NONE ; 94/5e _____^_____ + .byte CT_NONE ; 95/5f _UNDERLINE_ + .byte CT_NONE ; 96/60 ___grave___ + .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____ + .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____ + .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____ + .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____ + .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____ + .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____ + .byte CT_LOWER ; 103/67 _____g_____ + .byte CT_LOWER ; 104/68 _____h_____ + .byte CT_LOWER ; 105/69 _____i_____ + .byte CT_LOWER ; 106/6a _____j_____ + .byte CT_LOWER ; 107/6b _____k_____ + .byte CT_LOWER ; 108/6c _____l_____ + .byte CT_LOWER ; 109/6d _____m_____ + .byte CT_LOWER ; 110/6e _____n_____ + .byte CT_LOWER ; 111/6f _____o_____ + .byte CT_LOWER ; 112/70 _____p_____ + .byte CT_LOWER ; 113/71 _____q_____ + .byte CT_LOWER ; 114/72 _____r_____ + .byte CT_LOWER ; 115/73 _____s_____ + .byte CT_LOWER ; 116/74 _____t_____ + .byte CT_LOWER ; 117/75 _____u_____ + .byte CT_LOWER ; 118/76 _____v_____ + .byte CT_LOWER ; 119/77 _____w_____ + .byte CT_LOWER ; 120/78 _____x_____ + .byte CT_LOWER ; 121/79 _____y_____ + .byte CT_LOWER ; 122/7a _____z_____ + .byte CT_NONE ; 123/7b _____{_____ + .byte CT_NONE ; 124/7c _____|_____ + .byte CT_NONE ; 125/7d _____}_____ + .byte CT_NONE ; 126/7e _____~_____ + .byte CT_OTHER_WS ; 127/7f ____DEL____ .res 128, CT_NONE ; 128-255 diff --git a/libsrc/tgi/tgi-kernel.s b/libsrc/tgi/tgi-kernel.s index cfdd375b2..d5b025506 100644 --- a/libsrc/tgi/tgi-kernel.s +++ b/libsrc/tgi/tgi-kernel.s @@ -16,10 +16,10 @@ .bss -_tgi_drv: .res 2 ; Pointer to driver +_tgi_drv: .res 2 ; Pointer to driver ; From here on, variables get cleared when a new driver is loaded cstart: -_tgi_error: .res 1 ; Last error code +_tgi_error: .res 1 ; Last error code _tgi_gmode: .res 1 ; Flag: Graphics mode active _tgi_curx: .res 2 ; Current drawing cursor X _tgi_cury: .res 2 ; Current drawing cursor Y @@ -61,11 +61,11 @@ _tgi_flags: .res 1 ; TGI driver flags ; Jump table for the driver functions. jumpvectors: -tgi_install: jmp $0000 -tgi_uninstall: jmp $0000 +tgi_install: jmp $0000 +tgi_uninstall: jmp $0000 tgi_init: jmp $0000 tgi_done: jmp $0000 -tgi_geterror: jmp $0000 +tgi_geterror: jmp $0000 tgi_control: jmp $0000 tgi_clear: jmp $0000 tgi_setviewpage: jmp $0000 @@ -94,10 +94,10 @@ tgi_sig: .byte $74, $67, $69, TGI_API_VERSION ; "tgi", version _tgi_install: - sta _tgi_drv - sta ptr1 - stx _tgi_drv+1 - stx ptr1+1 + sta _tgi_drv + sta ptr1 + stx _tgi_drv+1 + stx ptr1+1 ; Check the driver signature @@ -138,8 +138,8 @@ _tgi_install: lda tgi_irq+2 ; Check high byte of IRQ vector beq @L4 ; Jump if vector invalid - lda #$4C ; Jump opcode - sta tgi_irq ; Activate IRQ routine + lda #$4C ; Jump opcode + sta tgi_irq ; Activate IRQ routine ; Initialize some other variables @@ -149,7 +149,7 @@ _tgi_install: dex bpl @L5 - rts + rts ; Copy one byte to the jump vectors @@ -179,10 +179,10 @@ tgi_inv_drv: ; Load the pointer to the tgi driver into ptr1. tgi_set_ptr: - lda _tgi_drv - sta ptr1 - lda _tgi_drv+1 - sta ptr1+1 + lda _tgi_drv + sta ptr1 + lda _tgi_drv+1 + sta ptr1+1 rts ;---------------------------------------------------------------------------- @@ -196,8 +196,8 @@ _tgi_uninstall: jsr tgi_uninstall ; Allow the driver to clean up - lda #$60 ; RTS opcode - sta tgi_irq ; Disable IRQ entry point + lda #$60 ; RTS opcode + sta tgi_irq ; Disable IRQ entry point ; Clear driver pointer and error code diff --git a/libsrc/tgi/tgi_init.s b/libsrc/tgi/tgi_init.s index 44ab3d521..c8fd355d5 100644 --- a/libsrc/tgi/tgi_init.s +++ b/libsrc/tgi/tgi_init.s @@ -40,10 +40,10 @@ ; Do driver initialization. Set draw and view pages. - lda #0 - jsr tgi_setviewpage - lda #0 - jsr tgi_setdrawpage + lda #0 + jsr tgi_setviewpage + lda #0 + jsr tgi_setdrawpage ; Set the default palette. diff --git a/libsrc/tgi/tgidrv_line.inc b/libsrc/tgi/tgidrv_line.inc index bbcb7c911..e904b5117 100644 --- a/libsrc/tgi/tgidrv_line.inc +++ b/libsrc/tgi/tgidrv_line.inc @@ -11,300 +11,300 @@ ; X2/Y2 = ptr3/ptr4 using the current drawing color. ; Must set an error code: NO - .proc LINE + .proc LINE ; Used for passing parameters to the driver. -X1 := ptr1 -Y1 := ptr2 -X2 := ptr3 -Y2 := ptr4 +X1 := ptr1 +Y1 := ptr2 +X2 := ptr3 +Y2 := ptr4 ; These ones must be on zpage. -TEMP1 := tmp3 -TEMP2 := tmp4 -TEMP3 := sreg -TEMP4 := sreg+1 -PB := ptr3 -UB := ptr4 -ERR := regsave -NX := regsave+2 +TEMP1 := tmp3 +TEMP2 := tmp4 +TEMP3 := sreg +TEMP4 := sreg+1 +PB := ptr3 +UB := ptr4 +ERR := regsave +NX := regsave+2 ; ------------------------------------------------------------------------ - .bss + .bss -COUNT: .res 2 -NY: .res 2 -DX: .res 1 -DY: .res 1 -AX: .res 1 -AY: .res 1 +COUNT: .res 2 +NY: .res 2 +DX: .res 1 +DY: .res 1 +AX: .res 1 +AY: .res 1 ; ------------------------------------------------------------------------ - .code + .code - ; nx = abs (x2 - x1) - sec - lda X2 - sbc X1 - sta NX - lda X2+1 - sbc X1+1 - tay - lda NX - jsr abs - sta NX - sty NX+1 + ; nx = abs (x2 - x1) + sec + lda X2 + sbc X1 + sta NX + lda X2+1 + sbc X1+1 + tay + lda NX + jsr abs + sta NX + sty NX+1 - ; ny = abs (y2 - y1) - sec - lda Y2 - sbc Y1 - sta NY - lda Y2+1 - sbc Y1+1 - tay - lda NY - jsr abs - sta NY - sty NY+1 + ; ny = abs (y2 - y1) + sec + lda Y2 + sbc Y1 + sta NY + lda Y2+1 + sbc Y1+1 + tay + lda NY + jsr abs + sta NY + sty NY+1 - ; if (x2 >= x1) - ldx #X2 - lda X1 - ldy X1+1 - jsr icmp - bcc :+ + ; if (x2 >= x1) + ldx #X2 + lda X1 + ldy X1+1 + jsr icmp + bcc :+ - ; dx = 1 - lda #$01 - bne :++ + ; dx = 1 + lda #$01 + bne :++ - ; else - ; dx = -1 -: lda #$FF -: sta DX + ; else + ; dx = -1 +: lda #$FF +: sta DX - ; if (y2 >= y1) - ldx #Y2 - lda Y1 - ldy Y1+1 - jsr icmp - bcc :+ + ; if (y2 >= y1) + ldx #Y2 + lda Y1 + ldy Y1+1 + jsr icmp + bcc :+ - ; dy = 1 - lda #$01 - bne :++ + ; dy = 1 + lda #$01 + bne :++ - ; else - ; dy = -1 -: lda #$FF -: sta DY + ; else + ; dy = -1 +: lda #$FF +: sta DY - ; err = ax = ay = 0 - lda #$00 - sta ERR - sta ERR+1 - sta AX - sta AY + ; err = ax = ay = 0 + lda #$00 + sta ERR + sta ERR+1 + sta AX + sta AY - ; if (nx < ny) { - ldx #NX - lda NY - ldy NY+1 - jsr icmp - bcs :+ + ; if (nx < ny) { + ldx #NX + lda NY + ldy NY+1 + jsr icmp + bcs :+ - ; nx <-> ny - lda NX - ldx NY - sta NY - stx NX - lda NX+1 - ldx NY+1 - sta NY+1 - stx NX+1 + ; nx <-> ny + lda NX + ldx NY + sta NY + stx NX + lda NX+1 + ldx NY+1 + sta NY+1 + stx NX+1 - ; ax = dx - lda DX - sta AX + ; ax = dx + lda DX + sta AX - ; ay = dy - lda DY - sta AY + ; ay = dy + lda DY + sta AY - ; dx = dy = 0 } - lda #$00 - sta DX - sta DY + ; dx = dy = 0 } + lda #$00 + sta DX + sta DY - ; ny = - ny -: lda NY - ldy NY+1 - jsr neg - sta NY - sty NY+1 + ; ny = - ny +: lda NY + ldy NY+1 + jsr neg + sta NY + sty NY+1 - ; for (count = nx; count > 0; --count) { - lda NX - ldx NX+1 - sta COUNT - stx COUNT+1 -for: lda COUNT ; count > 0 - ora COUNT+1 - bne :+ - rts + ; for (count = nx; count > 0; --count) { + lda NX + ldx NX+1 + sta COUNT + stx COUNT+1 +for: lda COUNT ; count > 0 + ora COUNT+1 + bne :+ + rts - ; setpixel (X1, Y1) -: jsr SETPIXEL + ; setpixel (X1, Y1) +: jsr SETPIXEL - ; pb = err + ny - clc - lda ERR - adc NY - sta PB - lda ERR+1 - adc NY+1 - sta PB+1 - tax + ; pb = err + ny + clc + lda ERR + adc NY + sta PB + lda ERR+1 + adc NY+1 + sta PB+1 + tax - ; ub = pb + nx - clc - lda PB - adc NX - sta UB - txa - adc NX+1 - sta UB+1 + ; ub = pb + nx + clc + lda PB + adc NX + sta UB + txa + adc NX+1 + sta UB+1 - ; x1 = x1 + dx - ldx #$00 - lda DX - bpl :+ - dex -: clc - adc X1 - sta X1 - txa - adc X1+1 - sta X1+1 + ; x1 = x1 + dx + ldx #$00 + lda DX + bpl :+ + dex +: clc + adc X1 + sta X1 + txa + adc X1+1 + sta X1+1 - ; y1 = y1 + ay - ldx #$00 - lda AY - bpl :+ - dex -: clc - adc Y1 - sta Y1 - txa - adc Y1+1 - sta Y1+1 + ; y1 = y1 + ay + ldx #$00 + lda AY + bpl :+ + dex +: clc + adc Y1 + sta Y1 + txa + adc Y1+1 + sta Y1+1 - ; if (abs (pb) < abs (ub)) { - lda PB - ldy PB+1 - jsr abs - sta TEMP3 - sty TEMP4 - lda UB - ldy UB+1 - jsr abs - ldx #TEMP3 - jsr icmp - bpl :+ + ; if (abs (pb) < abs (ub)) { + lda PB + ldy PB+1 + jsr abs + sta TEMP3 + sty TEMP4 + lda UB + ldy UB+1 + jsr abs + ldx #TEMP3 + jsr icmp + bpl :+ - ; err = pb } - lda PB - ldx PB+1 - jmp next + ; err = pb } + lda PB + ldx PB+1 + jmp next - ; else { x1 = x1 + ax -: ldx #$00 - lda AX - bpl :+ - dex -: clc - adc X1 - sta X1 - txa - adc X1+1 - sta X1+1 + ; else { x1 = x1 + ax +: ldx #$00 + lda AX + bpl :+ + dex +: clc + adc X1 + sta X1 + txa + adc X1+1 + sta X1+1 - ; y1 = y1 + dy - ldx #$00 - lda DY - bpl :+ - dex -: clc - adc Y1 - sta Y1 - txa - adc Y1+1 - sta Y1+1 + ; y1 = y1 + dy + ldx #$00 + lda DY + bpl :+ + dex +: clc + adc Y1 + sta Y1 + txa + adc Y1+1 + sta Y1+1 - ; err = ub } - lda UB - ldx UB+1 -next: sta ERR - stx ERR+1 + ; err = ub } + lda UB + ldx UB+1 +next: sta ERR + stx ERR+1 - ; } (--count) - lda COUNT - sec - sbc #$01 - sta COUNT - bcc :+ - jmp for -: dec COUNT+1 - jmp for + ; } (--count) + lda COUNT + sec + sbc #$01 + sta COUNT + bcc :+ + jmp for +: dec COUNT+1 + jmp for ; Copies of some runtime routines abs: - ; A/Y := abs (A/Y) - cpy #$00 - bpl :+ - - ; A/Y := neg (A/Y) -neg: clc - eor #$FF - adc #$01 - pha - tya - eor #$FF - adc #$00 - tay - pla -: rts + ; A/Y := abs (A/Y) + cpy #$00 + bpl :+ + + ; A/Y := neg (A/Y) +neg: clc + eor #$FF + adc #$01 + pha + tya + eor #$FF + adc #$00 + tay + pla +: rts icmp: - ; Compare A/Y to zp,X - sta TEMP1 ; TEMP1/TEMP2 - arg2 - sty TEMP2 - lda $00,x - pha - lda $01,x - tay - pla - tax - tya ; X/A - arg1 (a = high) + ; Compare A/Y to zp,X + sta TEMP1 ; TEMP1/TEMP2 - arg2 + sty TEMP2 + lda $00,x + pha + lda $01,x + tay + pla + tax + tya ; X/A - arg1 (a = high) - sec - sbc TEMP2 - bne :++ - cpx TEMP1 - beq :+ - adc #$FF - ora #$01 -: rts -: bvc :+ - eor #$FF - ora #$01 -: rts + sec + sbc TEMP2 + bne :++ + cpx TEMP1 + beq :+ + adc #$FF + ora #$01 +: rts +: bvc :+ + eor #$FF + ora #$01 +: rts - .endproc + .endproc diff --git a/libsrc/vic20/_scrsize.s b/libsrc/vic20/_scrsize.s index c0a746198..57ad4f30f 100644 --- a/libsrc/vic20/_scrsize.s +++ b/libsrc/vic20/_scrsize.s @@ -4,7 +4,7 @@ ; Screen size variables ; - .export screensize + .export screensize .import SCREEN screensize = SCREEN diff --git a/libsrc/vic20/break.s b/libsrc/vic20/break.s index 4277336c7..9a5ef02e7 100644 --- a/libsrc/vic20/break.s +++ b/libsrc/vic20/break.s @@ -5,65 +5,65 @@ ; void reset_brk (void); ; - .export _set_brk, _reset_brk - .destructor _reset_brk - .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc + .export _set_brk, _reset_brk + .destructor _reset_brk + .export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc - .include "vic20.inc" + .include "vic20.inc" .bss -_brk_a: .res 1 -_brk_x: .res 1 -_brk_y: .res 1 -_brk_sr: .res 1 -_brk_pc: .res 2 +_brk_a: .res 1 +_brk_x: .res 1 +_brk_y: .res 1 +_brk_sr: .res 1 +_brk_pc: .res 2 -oldvec: .res 2 ; Old vector +oldvec: .res 2 ; Old vector .data -uservec: jmp $FFFF ; Patched at runtime +uservec: jmp $FFFF ; Patched at runtime .code ; Set the break vector -.proc _set_brk +.proc _set_brk - sta uservec+1 - stx uservec+2 ; Set the user vector + sta uservec+1 + stx uservec+2 ; Set the user vector - lda oldvec - ora oldvec+1 ; Did we save the vector already? - bne L1 ; Jump if we installed the handler already + lda oldvec + ora oldvec+1 ; Did we save the vector already? + bne L1 ; Jump if we installed the handler already - lda BRKVec - sta oldvec - lda BRKVec+1 - sta oldvec+1 ; Save the old vector + lda BRKVec + sta oldvec + lda BRKVec+1 + sta oldvec+1 ; Save the old vector -L1: lda #brk_handler - sta BRKVec - stx BRKVec+1 - rts +L1: lda #brk_handler + sta BRKVec + stx BRKVec+1 + rts .endproc ; Reset the break vector -.proc _reset_brk +.proc _reset_brk - lda oldvec - ldx oldvec+1 - beq @L9 ; Jump if vector not installed - sta BRKVec - stx BRKVec+1 - lda #$00 - sta oldvec ; Clear the old vector - stx oldvec+1 -@L9: rts + lda oldvec + ldx oldvec+1 + beq @L9 ; Jump if vector not installed + sta BRKVec + stx BRKVec+1 + lda #$00 + sta oldvec ; Clear the old vector + stx oldvec+1 +@L9: rts .endproc @@ -71,37 +71,37 @@ L1: lda #(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) - sta sp+1 ; Set argument stack ptr + lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp + lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__) + sta sp+1 ; Set argument stack ptr ; Call module constructors - jsr initlib + jsr initlib ; Push arguments and call main() - jsr callmain + jsr callmain ; Back from main (This is also the _exit entry). Run module destructors -_exit: pha ; Save the return code on stack - jsr donelib +_exit: pha ; Save the return code on stack + jsr donelib ; Copy back the zero page stuff - ldx #zpspace-1 -L2: lda zpsave,x - sta sp,x - dex - bpl L2 + ldx #zpspace-1 +L2: lda zpsave,x + sta sp,x + dex + bpl L2 ; Place the program return code into ST - pla - sta ST + pla + sta ST ; Restore the stack pointer - ldx spsave - txs + ldx spsave + txs ; Back to basic - rts + rts ; ------------------------------------------------------------------------ -.segment "ZPSAVE" +.segment "ZPSAVE" -zpsave: .res zpspace +zpsave: .res zpspace ; ------------------------------------------------------------------------ .bss -spsave: .res 1 +spsave: .res 1 diff --git a/libsrc/vic20/devnum.s b/libsrc/vic20/devnum.s index 23a9c3808..663db5aa4 100644 --- a/libsrc/vic20/devnum.s +++ b/libsrc/vic20/devnum.s @@ -2,6 +2,6 @@ ; Oliver Schmidt, 2010-02-14 ; - .include "vic20.inc" + .include "vic20.inc" - .exportzp devnum := DEVNUM + .exportzp devnum := DEVNUM diff --git a/libsrc/vic20/get_tv.s b/libsrc/vic20/get_tv.s index df75814d9..7182c0df7 100644 --- a/libsrc/vic20/get_tv.s +++ b/libsrc/vic20/get_tv.s @@ -6,26 +6,26 @@ ; /* Return the video mode the machine is using */ ; - .include "vic20.inc" - .include "get_tv.inc" + .include "vic20.inc" + .include "get_tv.inc" ;-------------------------------------------------------------------------- ; _get_tv -.proc _get_tv +.proc _get_tv NTSC_LINES = 261 - ; detect the system - lda #TV::NTSC - tax -@L0: ldy VIC_HLINE - cpy #1 - bne @L0 ; wait for line 1 -@L1: ldy VIC_HLINE - beq @L2 ; line 0 reached -> NTSC - cpy #NTSC_LINES/2+2 - bne @L1 - lda #TV::PAL -@L2: rts ; system detected: 0 for NTSC, 1 for PAL + ; detect the system + lda #TV::NTSC + tax +@L0: ldy VIC_HLINE + cpy #1 + bne @L0 ; wait for line 1 +@L1: ldy VIC_HLINE + beq @L2 ; line 0 reached -> NTSC + cpy #NTSC_LINES/2+2 + bne @L1 + lda #TV::PAL +@L2: rts ; system detected: 0 for NTSC, 1 for PAL .endproc diff --git a/libsrc/vic20/irq.s b/libsrc/vic20/irq.s index 6e5099e4a..ca47347f8 100644 --- a/libsrc/vic20/irq.s +++ b/libsrc/vic20/irq.s @@ -2,48 +2,48 @@ ; IRQ handling (Vic20 version) ; - .export initirq, doneirq - .import callirq + .export initirq, doneirq + .import callirq - .include "vic20.inc" + .include "vic20.inc" ; ------------------------------------------------------------------------ -.segment "INIT" +.segment "INIT" initirq: - lda IRQVec - ldx IRQVec+1 - sta IRQInd+1 - stx IRQInd+2 - lda #IRQStub - jmp setvec + lda IRQVec + ldx IRQVec+1 + sta IRQInd+1 + stx IRQInd+2 + lda #IRQStub + jmp setvec ; ------------------------------------------------------------------------ .code doneirq: - lda IRQInd+1 - ldx IRQInd+2 -setvec: sei - sta IRQVec - stx IRQVec+1 - cli - rts + lda IRQInd+1 + ldx IRQInd+2 +setvec: sei + sta IRQVec + stx IRQVec+1 + cli + rts ; ------------------------------------------------------------------------ -.segment "LOWCODE" +.segment "LOWCODE" IRQStub: - cld ; Just to be sure - jsr callirq ; Call the functions - jmp IRQInd ; Jump to the saved IRQ vector + cld ; Just to be sure + jsr callirq ; Call the functions + jmp IRQInd ; Jump to the saved IRQ vector ; ------------------------------------------------------------------------ .data -IRQInd: jmp $0000 +IRQInd: jmp $0000 diff --git a/libsrc/vic20/joy/vic20-ptvjoy.s b/libsrc/vic20/joy/vic20-ptvjoy.s index b8c08c67d..fabb802f6 100644 --- a/libsrc/vic20/joy/vic20-ptvjoy.s +++ b/libsrc/vic20/joy/vic20-ptvjoy.s @@ -7,46 +7,46 @@ ; Using code from Steve Schmidtke ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" - .include "joy-error.inc" - .include "vic20.inc" + .include "joy-kernel.inc" + .include "joy-error.inc" + .include "vic20.inc" ; ------------------------------------------------------------------------ ; Header. Includes jump table - .segment "JUMPTABLE" + .segment "JUMPTABLE" ; Driver signature - .byte $6A, $6F, $79 ; "joy" - .byte JOY_API_VERSION ; Driver API version number + .byte $6A, $6F, $79 ; "joy" + .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) - .byte $01 ; JOY_UP - .byte $02 ; JOY_DOWN - .byte $04 ; JOY_LEFT - .byte $08 ; JOY_RIGHT - .byte $10 ; JOY_FIRE - .byte $00 ; JOY_FIRE2 unavailable - .byte $00 ; Future expansion - .byte $00 ; Future expansion + .byte $01 ; JOY_UP + .byte $02 ; JOY_DOWN + .byte $04 ; JOY_LEFT + .byte $08 ; JOY_RIGHT + .byte $10 ; JOY_FIRE + .byte $00 ; JOY_FIRE2 unavailable + .byte $00 ; Future expansion + .byte $00 ; Future expansion ; Jump table. - .addr INSTALL - .addr UNINSTALL - .addr COUNT - .addr READ - .addr 0 ; IRQ entry unused + .addr INSTALL + .addr UNINSTALL + .addr COUNT + .addr READ + .addr 0 ; IRQ entry unused ; ------------------------------------------------------------------------ ; Constants -VIA1_PRB := VIA1 ; User port register -JOY_COUNT = 3 ; Number of joysticks we support +VIA1_PRB := VIA1 ; User port register +JOY_COUNT = 3 ; Number of joysticks we support .code @@ -59,9 +59,9 @@ JOY_COUNT = 3 ; Number of joysticks we support ; INSTALL: - lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead + lda #JOY_ERR_OK +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -69,7 +69,7 @@ INSTALL: ; UNINSTALL: - rts + rts ; ------------------------------------------------------------------------ @@ -77,72 +77,72 @@ UNINSTALL: ; COUNT: - lda #JOY_COUNT - rts + lda #JOY_COUNT + rts ; ------------------------------------------------------------------------ ; READ: Read a particular joystick passed in A. ; -READ: tax ; Joystick number into X - bne joy2 +READ: tax ; Joystick number into X + bne joy2 ; Read joystick 1 -joy1: lda #$7F ; mask for VIA2 JOYBIT: sw3 - ldx #$C3 ; mask for VIA1 JOYBITS: sw0,sw1,sw2,sw4 - sei ; necessary? +joy1: lda #$7F ; mask for VIA2 JOYBIT: sw3 + ldx #$C3 ; mask for VIA1 JOYBITS: sw0,sw1,sw2,sw4 + sei ; necessary? - ldy VIA2_DDRB ; remember the date of DDRB - sta VIA2_DDRB ; set JOYBITS on this VIA for input - lda VIA2_JOY ; read JOYBIT: sw3 - sty VIA2_DDRB ; restore the state of DDRB - asl ; Shift sw3 into carry + ldy VIA2_DDRB ; remember the date of DDRB + sta VIA2_DDRB ; set JOYBITS on this VIA for input + lda VIA2_JOY ; read JOYBIT: sw3 + sty VIA2_DDRB ; restore the state of DDRB + asl ; Shift sw3 into carry - ldy VIA1_DDRA ; remember the state of DDRA - stx VIA1_DDRA ; set JOYBITS on this VIA for input - lda VIA1_JOY ; read JOYBITS: sw0,sw1,sw2,sw4 - sty VIA1_DDRA ; restore the state of DDRA + ldy VIA1_DDRA ; remember the state of DDRA + stx VIA1_DDRA ; set JOYBITS on this VIA for input + lda VIA1_JOY ; read JOYBITS: sw0,sw1,sw2,sw4 + sty VIA1_DDRA ; restore the state of DDRA - cli ; necessary? - ror ; Shift sw3 into bit 7 - and #$9E ; Mask relevant bits - eor #$9E ; Active states are inverted + cli ; necessary? + ror ; Shift sw3 into bit 7 + and #$9E ; Mask relevant bits + eor #$9E ; Active states are inverted - rts + rts ; Read joystick 2 -joy2: lda #%10000000 ; via port B Data-Direction - sta VIA1_DDRB ; bit 7: out bit 6-0: in +joy2: lda #%10000000 ; via port B Data-Direction + sta VIA1_DDRB ; bit 7: out bit 6-0: in - dex - bne joy3 + dex + bne joy3 - lda #$80 ; via port B read/write - sta VIA1_PRB ; (output one at PB7) + lda #$80 ; via port B read/write + sta VIA1_PRB ; (output one at PB7) - lda VIA1_PRB ; via port B read/write - and #$1f ; get bit 4-0 (PB4-PB0) - eor #$1f - rts + lda VIA1_PRB ; via port B read/write + and #$1f ; get bit 4-0 (PB4-PB0) + eor #$1f + rts ; Read joystick 3 -joy3: lda #$00 ; via port B read/write - sta VIA1_PRB ; (output zero at PB7) +joy3: lda #$00 ; via port B read/write + sta VIA1_PRB ; (output zero at PB7) - lda VIA1_PRB ; via port B read/write - and #$0f ; get bit 3-0 (PB3-PB0) - sta tmp1 ; joy 4 directions + lda VIA1_PRB ; via port B read/write + and #$0f ; get bit 3-0 (PB3-PB0) + sta tmp1 ; joy 4 directions - lda VIA1_PRB ; via port B read/write - and #%00100000 ; get bit 5 (PB5) - lsr - ora tmp1 - eor #$1f + lda VIA1_PRB ; via port B read/write + and #%00100000 ; get bit 5 (PB5) + lsr + ora tmp1 + eor #$1f - ldx #0 - rts + ldx #0 + rts diff --git a/libsrc/vic20/joy/vic20-stdjoy.s b/libsrc/vic20/joy/vic20-stdjoy.s index e352950cf..e49cd38f4 100644 --- a/libsrc/vic20/joy/vic20-stdjoy.s +++ b/libsrc/vic20/joy/vic20-stdjoy.s @@ -6,9 +6,9 @@ ; Using code from Steve Schmidtke ; - .include "zeropage.inc" + .include "zeropage.inc" - .include "joy-kernel.inc" + .include "joy-kernel.inc" .include "joy-error.inc" .include "vic20.inc" @@ -22,7 +22,7 @@ ; Driver signature - .byte $6A, $6F, $79 ; "joy" + .byte $6A, $6F, $79 ; "joy" .byte JOY_API_VERSION ; Driver API version number ; Button state masks (8 values) @@ -66,7 +66,7 @@ JOY_COUNT = 1 ; Number of joysticks we support INSTALL: lda #JOY_ERR_OK -; rts ; Run into UNINSTALL instead +; rts ; Run into UNINSTALL instead ; ------------------------------------------------------------------------ ; UNINSTALL routine. Is called before the driver is removed from memory. @@ -91,7 +91,7 @@ COUNT: ; The current implemenation will ignore the joystick number because we do only ; have one joystick -READ: lda #$7F ; mask for VIA2 JOYBIT: sw3 +READ: lda #$7F ; mask for VIA2 JOYBIT: sw3 ldx #$C3 ; mask for VIA1 JOYBITS: sw0,sw1,sw2,sw4 sei ; necessary? diff --git a/libsrc/vic20/joy_stat_stddrv.s b/libsrc/vic20/joy_stat_stddrv.s index 12c2f6234..04f790947 100644 --- a/libsrc/vic20/joy_stat_stddrv.s +++ b/libsrc/vic20/joy_stat_stddrv.s @@ -6,8 +6,8 @@ ; const void joy_static_stddrv[]; ; - .export _joy_static_stddrv - .import _vic20_stdjoy_joy + .export _joy_static_stddrv + .import _vic20_stdjoy_joy .rodata diff --git a/libsrc/vic20/joy_stddrv.s b/libsrc/vic20/joy_stddrv.s index 07241ae52..cd3536084 100644 --- a/libsrc/vic20/joy_stddrv.s +++ b/libsrc/vic20/joy_stddrv.s @@ -6,9 +6,9 @@ ; const char joy_stddrv[]; ; - .export _joy_stddrv + .export _joy_stddrv .rodata -_joy_stddrv: .asciiz "vic20-stdjoy.joy" +_joy_stddrv: .asciiz "vic20-stdjoy.joy" diff --git a/libsrc/vic20/kbhit.s b/libsrc/vic20/kbhit.s index 713646776..d2e7e81a0 100644 --- a/libsrc/vic20/kbhit.s +++ b/libsrc/vic20/kbhit.s @@ -4,15 +4,15 @@ ; unsigned char kbhit (void); ; - .export _kbhit + .export _kbhit - .include "vic20.inc" + .include "vic20.inc" .proc _kbhit ldx #0 ; High byte of return is always zero - lda KEY_COUNT ; Get number of characters + lda KEY_COUNT ; Get number of characters beq L9 lda #1 L9: rts diff --git a/libsrc/vic20/kernal.s b/libsrc/vic20/kernal.s index ca1bac5bc..35bedb466 100644 --- a/libsrc/vic20/kernal.s +++ b/libsrc/vic20/kernal.s @@ -47,42 +47,42 @@ ;----------------------------------------------------------------------------- ; All functions are available in the kernal jump table -CINT = $FF81 -IOINIT = $FF84 -RAMTAS = $FF87 -RESTOR = $FF8A -VECTOR = $FF8D -SETMSG = $FF90 -SECOND = $FF93 -TKSA = $FF96 -MEMTOP = $FF99 -MEMBOT = $FF9C -SCNKEY = $FF9F -SETTMO = $FFA2 -ACPTR = $FFA5 -CIOUT = $FFA8 -UNTLK = $FFAB -UNLSN = $FFAE -LISTEN = $FFB1 -TALK = $FFB4 -READST = $FFB7 -SETLFS = $FFBA -SETNAM = $FFBD -OPEN = $FFC0 -CLOSE = $FFC3 -CHKIN = $FFC6 -CKOUT = $FFC9 -CLRCH = $FFCC -BASIN = $FFCF -BSOUT = $FFD2 -LOAD = $FFD5 -SAVE = $FFD8 -SETTIM = $FFDB -RDTIM = $FFDE -STOP = $FFE1 -GETIN = $FFE4 -CLALL = $FFE7 -UDTIM = $FFEA -SCREEN = $FFED -IOBASE = $FFF3 +CINT = $FF81 +IOINIT = $FF84 +RAMTAS = $FF87 +RESTOR = $FF8A +VECTOR = $FF8D +SETMSG = $FF90 +SECOND = $FF93 +TKSA = $FF96 +MEMTOP = $FF99 +MEMBOT = $FF9C +SCNKEY = $FF9F +SETTMO = $FFA2 +ACPTR = $FFA5 +CIOUT = $FFA8 +UNTLK = $FFAB +UNLSN = $FFAE +LISTEN = $FFB1 +TALK = $FFB4 +READST = $FFB7 +SETLFS = $FFBA +SETNAM = $FFBD +OPEN = $FFC0 +CLOSE = $FFC3 +CHKIN = $FFC6 +CKOUT = $FFC9 +CLRCH = $FFCC +BASIN = $FFCF +BSOUT = $FFD2 +LOAD = $FFD5 +SAVE = $FFD8 +SETTIM = $FFDB +RDTIM = $FFDE +STOP = $FFE1 +GETIN = $FFE4 +CLALL = $FFE7 +UDTIM = $FFEA +SCREEN = $FFED +IOBASE = $FFF3 diff --git a/libsrc/vic20/mainargs.s b/libsrc/vic20/mainargs.s index 3cc1dc286..eda8f4f85 100644 --- a/libsrc/vic20/mainargs.s +++ b/libsrc/vic20/mainargs.s @@ -22,16 +22,16 @@ ; - The "file-name" might be a path-name; don't copy the directory-components. ; - Add a control-character quoting mechanism. - .constructor initmainargs, 24 - .import __argc, __argv + .constructor initmainargs, 24 + .import __argc, __argv - .include "vic20.inc" + .include "vic20.inc" -MAXARGS = 10 ; Maximum number of arguments allowed -REM = $8f ; BASIC token-code -NAME_LEN = 16 ; maximum length of command-name +MAXARGS = 10 ; Maximum number of arguments allowed +REM = $8f ; BASIC token-code +NAME_LEN = 16 ; maximum length of command-name ; Get possible command-line arguments. Goes into the special INIT segment, ; which may be reused after the startup code is run @@ -45,25 +45,25 @@ initmainargs: ; Because the buffer, that we're copying into, was zeroed out, ; we don't need to add a NUL character. ; - ldy FNAM_LEN - cpy #NAME_LEN + 1 - bcc L1 - ldy #NAME_LEN - 1 ; limit the length -L0: lda (FNAM),y - sta name,y -L1: dey - bpl L0 - inc __argc ; argc always is equal to, at least, 1 + ldy FNAM_LEN + cpy #NAME_LEN + 1 + bcc L1 + ldy #NAME_LEN - 1 ; limit the length +L0: lda (FNAM),y + sta name,y +L1: dey + bpl L0 + inc __argc ; argc always is equal to, at least, 1 ; Find the "rem" token. ; - ldx #0 -L2: lda BASIC_BUF,x - beq done ; no "rem," no args. - inx - cmp #REM - bne L2 - ldy #1 * 2 + ldx #0 +L2: lda BASIC_BUF,x + beq done ; no "rem," no args. + inx + cmp #REM + bne L2 + ldy #1 * 2 ; Find the next argument @@ -89,11 +89,11 @@ setterm:sta term ; Set end of argument marker ; necessary. txa ; Get low byte - sta argv,y ; argv[y]= &arg - iny - lda #>BASIC_BUF - sta argv,y - iny + sta argv,y ; argv[y]= &arg + iny + lda #>BASIC_BUF + sta argv,y + iny inc __argc ; Found another arg ; Search for the end of the argument @@ -120,21 +120,21 @@ argloop:lda BASIC_BUF,x ; (The last vector in argv[] already is NULL.) -done: lda #argv - sta __argv - stx __argv + 1 - rts +done: lda #argv + sta __argv + stx __argv + 1 + rts ; These arrays are zeroed before initmainargs is called. -; char name[16+1]; +; char name[16+1]; ; char* argv[MAXARGS+1]={name}; ; .bss -term: .res 1 -name: .res NAME_LEN + 1 +term: .res 1 +name: .res NAME_LEN + 1 .data argv: .addr name - .res MAXARGS * 2 + .res MAXARGS * 2 diff --git a/libsrc/vic20/randomize.s b/libsrc/vic20/randomize.s index e87d4d398..8a1c4eee7 100644 --- a/libsrc/vic20/randomize.s +++ b/libsrc/vic20/randomize.s @@ -5,10 +5,10 @@ ; /* Initialize the random number generator */ ; - .export __randomize - .import _srand + .export __randomize + .import _srand - .include "vic20.inc" + .include "vic20.inc" __randomize: lda VIC_LINES ; Get overflow bit diff --git a/libsrc/vic20/revers.s b/libsrc/vic20/revers.s index da4d2ca11..b2912b8a5 100644 --- a/libsrc/vic20/revers.s +++ b/libsrc/vic20/revers.s @@ -4,24 +4,24 @@ ; unsigned char revers (unsigned char onoff); ; - .export _revers + .export _revers .include "vic20.inc" .proc _revers - ldx #$00 ; Assume revers off - tay ; Test onoff - beq L1 ; Jump if off - ldx #$80 ; Load on value - ldy #$00 ; Assume old value is zero -L1: lda RVS ; Load old value - stx RVS ; Set new value - beq L2 ; Jump if old value zero - iny ; Make old value = 1 -L2: ldx #$00 ; Load high byte of result - tya ; Load low byte, set CC - rts + ldx #$00 ; Assume revers off + tay ; Test onoff + beq L1 ; Jump if off + ldx #$80 ; Load on value + ldy #$00 ; Assume old value is zero +L1: lda RVS ; Load old value + stx RVS ; Set new value + beq L2 ; Jump if old value zero + iny ; Make old value = 1 +L2: ldx #$00 ; Load high byte of result + tya ; Load low byte, set CC + rts .endproc diff --git a/libsrc/vic20/status.s b/libsrc/vic20/status.s index 3620c9107..c6f279230 100644 --- a/libsrc/vic20/status.s +++ b/libsrc/vic20/status.s @@ -2,4 +2,4 @@ ; Oliver Schmidt, 2012-09-30 ; - .exportzp ST := $90 ; IEC status byte + .exportzp ST := $90 ; IEC status byte diff --git a/libsrc/zlib/adler32.s b/libsrc/zlib/adler32.s index bebe34dcf..e54e25e77 100644 --- a/libsrc/zlib/adler32.s +++ b/libsrc/zlib/adler32.s @@ -5,81 +5,81 @@ ; unsigned len); ; - .export _adler32 + .export _adler32 - .import incsp2, incsp4, popax, popeax - .importzp sreg, ptr1, ptr2, tmp1 + .import incsp2, incsp4, popax, popeax + .importzp sreg, ptr1, ptr2, tmp1 -BASE = 65521 ; largest prime smaller than 65536 +BASE = 65521 ; largest prime smaller than 65536 _adler32: ; ptr2 = (len & 0xff) == 0 ? len : len + 0x100; - tay - beq @L1 - inx -@L1: sta ptr2 - stx ptr2+1 + tay + beq @L1 + inx +@L1: sta ptr2 + stx ptr2+1 ; ptr1 = buf - jsr popax - sta ptr1 - stx ptr1+1 + jsr popax + sta ptr1 + stx ptr1+1 ; if (buf == NULL) return 1L; - ora ptr1+1 - beq @L0 + ora ptr1+1 + beq @L0 ; s1 = adler & 0xFFFF; s2 = adler >> 16; - jsr popeax + jsr popeax ; if (len == 0) return adler; - ldy ptr2 - bne @L2 - ldy ptr2+1 - beq @RET -@L2: ldy #0 + ldy ptr2 + bne @L2 + ldy ptr2+1 + beq @RET +@L2: ldy #0 ; s1 += *ptr++; if (s1 >= BASE) s1 -= BASE; -@L3: clc - adc (ptr1),y - bcc @L4 - inx - beq @L5 ; C flag is set -@L4: cpx #>BASE - bcc @L6 - cmp #BASE + bcc @L6 + cmp #= BASE) s2 -= BASE; - adc sreg ; C flag is clear - sta sreg - txa - adc sreg+1 - sta sreg+1 - bcs @L7 - cmp #>BASE - bcc @L8 - lda sreg - cmp #BASE - sta sreg+1 -@L8: lda tmp1 - iny - bne @L9 - inc ptr1+1 -@L9: dec ptr2 - bne @L3 - dec ptr2+1 - bne @L3 + adc sreg ; C flag is clear + sta sreg + txa + adc sreg+1 + sta sreg+1 + bcs @L7 + cmp #>BASE + bcc @L8 + lda sreg + cmp #BASE + sta sreg+1 +@L8: lda tmp1 + iny + bne @L9 + inc ptr1+1 +@L9: dec ptr2 + bne @L3 + dec ptr2+1 + bne @L3 ; return (s2 << 16) | s1; -@RET: rts +@RET: rts ; return 1L -@L0: sta sreg - sta sreg+1 - lda #1 +@L0: sta sreg + sta sreg+1 + lda #1 ; ignore adler - jmp incsp4 + jmp incsp4 diff --git a/libsrc/zlib/crc32.s b/libsrc/zlib/crc32.s index 61f64c3cf..26955dbed 100644 --- a/libsrc/zlib/crc32.s +++ b/libsrc/zlib/crc32.s @@ -5,130 +5,130 @@ ; unsigned len); ; - .export _crc32 + .export _crc32 - .import compleax, incsp2, incsp4, popax, popeax - .importzp sreg, ptr1, ptr2, tmp1, tmp2 + .import compleax, incsp2, incsp4, popax, popeax + .importzp sreg, ptr1, ptr2, tmp1, tmp2 -POLYNOMIAL = $EDB88320 +POLYNOMIAL = $EDB88320 make_table: - ldx #0 -@L1: lda #0 - sta tmp2 - sta sreg - sta sreg+1 - ldy #8 - txa -@L2: sta tmp1 - lsr a - bcc @L3 - lda sreg+1 - lsr a - eor #(POLYNOMIAL>>24)&$FF - sta sreg+1 - lda sreg - ror a - eor #(POLYNOMIAL>>16)&$FF - sta sreg - lda tmp2 - ror a - eor #(POLYNOMIAL>>8)&$FF - sta tmp2 - lda tmp1 - ror a - eor #POLYNOMIAL&$FF - bcs @L4 ; branch always -@L3: rol a - lsr sreg+1 - ror sreg - ror tmp2 - ror a -@L4: dey - bne @L2 - sta table_0,x - lda tmp2 - sta table_1,x - lda sreg - sta table_2,x - lda sreg+1 - sta table_3,x - inx - bne @L1 - inc table_initialised + ldx #0 +@L1: lda #0 + sta tmp2 + sta sreg + sta sreg+1 + ldy #8 + txa +@L2: sta tmp1 + lsr a + bcc @L3 + lda sreg+1 + lsr a + eor #(POLYNOMIAL>>24)&$FF + sta sreg+1 + lda sreg + ror a + eor #(POLYNOMIAL>>16)&$FF + sta sreg + lda tmp2 + ror a + eor #(POLYNOMIAL>>8)&$FF + sta tmp2 + lda tmp1 + ror a + eor #POLYNOMIAL&$FF + bcs @L4 ; branch always +@L3: rol a + lsr sreg+1 + ror sreg + ror tmp2 + ror a +@L4: dey + bne @L2 + sta table_0,x + lda tmp2 + sta table_1,x + lda sreg + sta table_2,x + lda sreg+1 + sta table_3,x + inx + bne @L1 + inc table_initialised RET: - rts + rts _crc32: ; ptr2 = (len & 0xff) == 0 ? len : len + 0x100; - tay - beq @L1 - inx -@L1: sta ptr2 - stx ptr2+1 + tay + beq @L1 + inx +@L1: sta ptr2 + stx ptr2+1 ; ptr1 = buf - jsr popax - sta ptr1 - stx ptr1+1 + jsr popax + sta ptr1 + stx ptr1+1 ; if (buf == NULL) return 0; - ora ptr1+1 - beq @L0 + ora ptr1+1 + beq @L0 ; if (!tables_initialised) make_tables(); - lda table_initialised - bne @dont_make - jsr make_table + lda table_initialised + bne @dont_make + jsr make_table @dont_make: ; eax = crc - jsr popeax + jsr popeax ; if (len == 0) return crc; - ldy ptr2 - bne @L2 - ldy ptr2+1 - beq RET + ldy ptr2 + bne @L2 + ldy ptr2+1 + beq RET @L2: ; eax = ~crc - jsr compleax - stx tmp2 - ldy #0 + jsr compleax + stx tmp2 + ldy #0 ; crc = (crc >> 8) ^ table[(crc & 0xff) ^ *p++]; -@L3: eor (ptr1),y - tax - lda table_0,x - eor tmp2 - sta tmp1 - lda table_1,x - eor sreg - sta tmp2 - lda table_2,x - eor sreg+1 - sta sreg - lda table_3,x - sta sreg+1 - lda tmp1 - iny - bne @L4 - inc ptr1+1 -@L4: dec ptr2 - bne @L3 - dec ptr2+1 - bne @L3 - ldx tmp2 - jmp compleax +@L3: eor (ptr1),y + tax + lda table_0,x + eor tmp2 + sta tmp1 + lda table_1,x + eor sreg + sta tmp2 + lda table_2,x + eor sreg+1 + sta sreg + lda table_3,x + sta sreg+1 + lda tmp1 + iny + bne @L4 + inc ptr1+1 +@L4: dec ptr2 + bne @L3 + dec ptr2+1 + bne @L3 + ldx tmp2 + jmp compleax ; return 0L -@L0: sta sreg - sta sreg+1 +@L0: sta sreg + sta sreg+1 ; ignore crc - jmp incsp4 + jmp incsp4 - .data + .data table_initialised: - .byte 0 + .byte 0 - .bss -table_0: .res 256 -table_1: .res 256 -table_2: .res 256 -table_3: .res 256 + .bss +table_0: .res 256 +table_1: .res 256 +table_2: .res 256 +table_3: .res 256 diff --git a/libsrc/zlib/inflatemem.s b/libsrc/zlib/inflatemem.s index 18bf80cd1..bcf473bdd 100644 --- a/libsrc/zlib/inflatemem.s +++ b/libsrc/zlib/inflatemem.s @@ -4,10 +4,10 @@ ; unsigned __fastcall__ inflatemem (char* dest, const char* source); ; - .export _inflatemem + .export _inflatemem - .import incsp2 - .importzp sp, sreg, ptr1, ptr2, ptr3, ptr4, tmp1 + .import incsp2 + .importzp sp, sreg, ptr1, ptr2, ptr3, ptr4, tmp1 ; -------------------------------------------------------------------------- ; @@ -15,7 +15,7 @@ ; ; Maximum length of a Huffman code. -MAX_BITS = 15 +MAX_BITS = 15 ; All Huffman trees are stored in the bitsCount, bitsPointer_l ; and bitsPointer_h arrays. There may be two trees: the literal/length tree @@ -23,13 +23,13 @@ MAX_BITS = 15 ; Index in the mentioned arrays for the beginning of the literal/length tree ; or the temporary tree. -PRIMARY_TREE = 0 +PRIMARY_TREE = 0 ; Index in the mentioned arrays for the beginning of the distance tree. -DISTANCE_TREE = MAX_BITS +DISTANCE_TREE = MAX_BITS ; Size of each array. -TREES_SIZE = 2*MAX_BITS +TREES_SIZE = 2*MAX_BITS ; -------------------------------------------------------------------------- @@ -38,30 +38,30 @@ TREES_SIZE = 2*MAX_BITS ; ; Pointer to the compressed data. -inputPointer = ptr1 ; 2 bytes +inputPointer = ptr1 ; 2 bytes ; Pointer to the uncompressed data. -outputPointer = ptr2 ; 2 bytes +outputPointer = ptr2 ; 2 bytes ; Local variables. ; As far as there is no conflict, same memory locations are used ; for different variables. -inflateDynamicBlock_cnt = ptr3 ; 1 byte -inflateCodes_src = ptr3 ; 2 bytes -buildHuffmanTree_src = ptr3 ; 2 bytes -getNextLength_last = ptr3 ; 1 byte -getNextLength_index = ptr3+1 ; 1 byte +inflateDynamicBlock_cnt = ptr3 ; 1 byte +inflateCodes_src = ptr3 ; 2 bytes +buildHuffmanTree_src = ptr3 ; 2 bytes +getNextLength_last = ptr3 ; 1 byte +getNextLength_index = ptr3+1 ; 1 byte -buildHuffmanTree_ptr = ptr4 ; 2 bytes -fetchCode_ptr = ptr4 ; 2 bytes -getBits_tmp = ptr4 ; 1 byte +buildHuffmanTree_ptr = ptr4 ; 2 bytes +fetchCode_ptr = ptr4 ; 2 bytes +getBits_tmp = ptr4 ; 1 byte -moveBlock_len = sreg ; 2 bytes -inflateDynamicBlock_np = sreg ; 1 byte -inflateDynamicBlock_nd = sreg+1 ; 1 byte +moveBlock_len = sreg ; 2 bytes +inflateDynamicBlock_np = sreg ; 1 byte +inflateDynamicBlock_nd = sreg+1 ; 1 byte -getBit_hold = tmp1 ; 1 byte +getBit_hold = tmp1 ; 1 byte ; -------------------------------------------------------------------------- @@ -72,127 +72,127 @@ getBit_hold = tmp1 ; 1 byte _inflatemem: ; inputPointer = source - sta inputPointer - stx inputPointer+1 + sta inputPointer + stx inputPointer+1 ; outputPointer = dest .ifpc02 - lda (sp) - ldy #1 + lda (sp) + ldy #1 .else - ldy #0 - lda (sp),y - iny + ldy #0 + lda (sp),y + iny .endif - sta outputPointer - lda (sp),y - sta outputPointer+1 + sta outputPointer + lda (sp),y + sta outputPointer+1 -; ldy #1 - sty getBit_hold +; ldy #1 + sty getBit_hold inflatemem_1: ; Get a bit of EOF and two bits of block type - ldx #3 - lda #0 - jsr getBits - lsr a + ldx #3 + lda #0 + jsr getBits + lsr a ; A and Z contain block type, C contains EOF flag ; Save EOF flag - php + php ; Go to the routine decompressing this block - jsr callExtr - plp - bcc inflatemem_1 + jsr callExtr + plp + bcc inflatemem_1 ; C flag is set! ; return outputPointer - dest; - lda outputPointer + lda outputPointer .ifpc02 - sbc (sp) ; C flag is set - ldy #1 + sbc (sp) ; C flag is set + ldy #1 .else - ldy #0 - sbc (sp),y ; C flag is set - iny + ldy #0 + sbc (sp),y ; C flag is set + iny .endif - pha - lda outputPointer+1 - sbc (sp),y - tax - pla + pha + lda outputPointer+1 + sbc (sp),y + tax + pla ; pop dest - jmp incsp2 + jmp incsp2 ; -------------------------------------------------------------------------- ; Go to proper block decoding routine. callExtr: - bne inflateCompressedBlock + bne inflateCompressedBlock ; -------------------------------------------------------------------------- ; Decompress a 'stored' data block. inflateCopyBlock: ; Ignore bits until byte boundary - ldy #1 - sty getBit_hold + ldy #1 + sty getBit_hold ; Get 16-bit length - ldx #inputPointer - lda (0,x) - sta moveBlock_len - lda (inputPointer),y - sta moveBlock_len+1 + ldx #inputPointer + lda (0,x) + sta moveBlock_len + lda (inputPointer),y + sta moveBlock_len+1 ; Skip the length and one's complement of it - lda #4 - clc - adc inputPointer - sta inputPointer - bcc moveBlock - inc inputPointer+1 -; jmp moveBlock + lda #4 + clc + adc inputPointer + sta inputPointer + bcc moveBlock + inc inputPointer+1 +; jmp moveBlock ; -------------------------------------------------------------------------- ; Copy block of length moveBlock_len from (0,x) to the output. moveBlock: - ldy moveBlock_len - beq moveBlock_1 + ldy moveBlock_len + beq moveBlock_1 .ifpc02 .else - ldy #0 + ldy #0 .endif - inc moveBlock_len+1 + inc moveBlock_len+1 moveBlock_1: - lda (0,x) + lda (0,x) .ifpc02 - sta (outputPointer) + sta (outputPointer) .else - sta (outputPointer),y + sta (outputPointer),y .endif - inc 0,x - bne moveBlock_2 - inc 1,x + inc 0,x + bne moveBlock_2 + inc 1,x moveBlock_2: - inc outputPointer - bne moveBlock_3 - inc outputPointer+1 + inc outputPointer + bne moveBlock_3 + inc outputPointer+1 moveBlock_3: .ifpc02 - dey + dey .else - dec moveBlock_len + dec moveBlock_len .endif - bne moveBlock_1 - dec moveBlock_len+1 - bne moveBlock_1 - rts + bne moveBlock_1 + dec moveBlock_len+1 + bne moveBlock_1 + rts ; -------------------------------------------------------------------------- ; Decompress a Huffman-coded data block ; (A = 1: fixed, A = 2: dynamic). inflateCompressedBlock: - lsr a - bne inflateDynamicBlock + lsr a + bne inflateDynamicBlock ; Note: inflateDynamicBlock may assume that A = 1 ; -------------------------------------------------------------------------- @@ -205,151 +205,151 @@ inflateCompressedBlock: ; (two 8-bit codes from the primary tree are not used). inflateFixedBlock: - ldx #159 - stx distanceCodeLength+32 - lda #8 + ldx #159 + stx distanceCodeLength+32 + lda #8 inflateFixedBlock_1: - sta literalCodeLength-1,x - sta literalCodeLength+159-1,x - dex - bne inflateFixedBlock_1 - ldx #112 -; lda #9 + sta literalCodeLength-1,x + sta literalCodeLength+159-1,x + dex + bne inflateFixedBlock_1 + ldx #112 +; lda #9 inflateFixedBlock_2: - inc literalCodeLength+144-1,x ; sta - dex - bne inflateFixedBlock_2 - ldx #24 -; lda #7 + inc literalCodeLength+144-1,x ; sta + dex + bne inflateFixedBlock_2 + ldx #24 +; lda #7 inflateFixedBlock_3: - dec endCodeLength-1,x ; sta - dex - bne inflateFixedBlock_3 - ldx #30 - lda #5+DISTANCE_TREE + dec endCodeLength-1,x ; sta + dex + bne inflateFixedBlock_3 + ldx #30 + lda #5+DISTANCE_TREE inflateFixedBlock_4: - sta distanceCodeLength-1,x - dex - bne inflateFixedBlock_4 - beq inflateCodes ; branch always + sta distanceCodeLength-1,x + dex + bne inflateFixedBlock_4 + beq inflateCodes ; branch always ; -------------------------------------------------------------------------- ; Decompress a Huffman-coded data block, reading Huffman trees first. inflateDynamicBlock: ; numberOfPrimaryCodes = 257 + getBits(5) - ldx #5 -; lda #1 - jsr getBits - sta inflateDynamicBlock_np + ldx #5 +; lda #1 + jsr getBits + sta inflateDynamicBlock_np ; numberOfDistanceCodes = 1 + getBits(5) - ldx #5 - lda #1+29+1 - jsr getBits - sta inflateDynamicBlock_nd + ldx #5 + lda #1+29+1 + jsr getBits + sta inflateDynamicBlock_nd ; numberOfTemporaryCodes = 4 + getBits(4) - lda #4 - tax - jsr getBits - sta inflateDynamicBlock_cnt + lda #4 + tax + jsr getBits + sta inflateDynamicBlock_cnt ; Get lengths of temporary codes in the order stored in tempCodeLengthOrder - txa ; lda #0 - tay + txa ; lda #0 + tay inflateDynamicBlock_1: - ldx #3 ; A = 0 - jsr getBits ; does not change Y + ldx #3 ; A = 0 + jsr getBits ; does not change Y inflateDynamicBlock_2: - ldx tempCodeLengthOrder,y - sta literalCodeLength,x - lda #0 - iny - cpy inflateDynamicBlock_cnt - bcc inflateDynamicBlock_1 - cpy #19 - bcc inflateDynamicBlock_2 - ror literalCodeLength+19 ; C flag is set, so this will set b7 + ldx tempCodeLengthOrder,y + sta literalCodeLength,x + lda #0 + iny + cpy inflateDynamicBlock_cnt + bcc inflateDynamicBlock_1 + cpy #19 + bcc inflateDynamicBlock_2 + ror literalCodeLength+19 ; C flag is set, so this will set b7 ; Build the tree for temporary codes - jsr buildHuffmanTree + jsr buildHuffmanTree ; Use temporary codes to get lengths of literal/length and distance codes - ldx #0 - ldy #1 - stx getNextLength_last + ldx #0 + ldy #1 + stx getNextLength_last inflateDynamicBlock_3: - jsr getNextLength - sta literalCodeLength,x - inx - bne inflateDynamicBlock_3 + jsr getNextLength + sta literalCodeLength,x + inx + bne inflateDynamicBlock_3 inflateDynamicBlock_4: - jsr getNextLength + jsr getNextLength inflateDynamicBlock_5: - sta endCodeLength,x - inx - cpx inflateDynamicBlock_np - bcc inflateDynamicBlock_4 - lda #0 - cpx #1+29 - bcc inflateDynamicBlock_5 + sta endCodeLength,x + inx + cpx inflateDynamicBlock_np + bcc inflateDynamicBlock_4 + lda #0 + cpx #1+29 + bcc inflateDynamicBlock_5 inflateDynamicBlock_6: - jsr getNextLength - cmp #0 - beq inflateDynamicBlock_7 - adc #DISTANCE_TREE-1 ; C flag is set + jsr getNextLength + cmp #0 + beq inflateDynamicBlock_7 + adc #DISTANCE_TREE-1 ; C flag is set inflateDynamicBlock_7: - sta endCodeLength,x - inx - cpx inflateDynamicBlock_nd - bcc inflateDynamicBlock_6 - ror endCodeLength,x ; C flag is set, so this will set b7 -; jmp inflateCodes + sta endCodeLength,x + inx + cpx inflateDynamicBlock_nd + bcc inflateDynamicBlock_6 + ror endCodeLength,x ; C flag is set, so this will set b7 +; jmp inflateCodes ; -------------------------------------------------------------------------- ; Decompress a data block basing on given Huffman trees. inflateCodes: - jsr buildHuffmanTree + jsr buildHuffmanTree inflateCodes_1: - jsr fetchPrimaryCode - bcs inflateCodes_2 + jsr fetchPrimaryCode + bcs inflateCodes_2 ; Literal code .ifpc02 - sta (outputPointer) + sta (outputPointer) .else - ldy #0 - sta (outputPointer),y + ldy #0 + sta (outputPointer),y .endif - inc outputPointer - bne inflateCodes_1 - inc outputPointer+1 - bcc inflateCodes_1 ; branch always + inc outputPointer + bne inflateCodes_1 + inc outputPointer+1 + bcc inflateCodes_1 ; branch always ; End of block inflateCodes_ret: - rts + rts inflateCodes_2: - beq inflateCodes_ret + beq inflateCodes_ret ; Restore a block from the look-behind buffer - jsr getValue - sta moveBlock_len - tya - jsr getBits - sta moveBlock_len+1 - ldx #DISTANCE_TREE - jsr fetchCode - jsr getValue - sec - eor #$ff - adc outputPointer - sta inflateCodes_src - php - tya - jsr getBits - plp - eor #$ff - adc outputPointer+1 - sta inflateCodes_src+1 - ldx #inflateCodes_src - jsr moveBlock - beq inflateCodes_1 ; branch always + jsr getValue + sta moveBlock_len + tya + jsr getBits + sta moveBlock_len+1 + ldx #DISTANCE_TREE + jsr fetchCode + jsr getValue + sec + eor #$ff + adc outputPointer + sta inflateCodes_src + php + tya + jsr getBits + plp + eor #$ff + adc outputPointer+1 + sta inflateCodes_src+1 + ldx #inflateCodes_src + jsr moveBlock + beq inflateCodes_1 ; branch always ; -------------------------------------------------------------------------- ; Build Huffman trees basing on code lengths (in bits). @@ -357,114 +357,114 @@ inflateCodes_2: ; A byte with its highest bit set marks the end. buildHuffmanTree: - lda #literalCodeLength - sta buildHuffmanTree_src+1 + lda #literalCodeLength + sta buildHuffmanTree_src+1 ; Clear bitsCount and bitsPointer_l - ldy #2*TREES_SIZE+1 - lda #0 + ldy #2*TREES_SIZE+1 + lda #0 buildHuffmanTree_1: - sta bitsCount-1,y - dey - bne buildHuffmanTree_1 - beq buildHuffmanTree_3 ; branch always + sta bitsCount-1,y + dey + bne buildHuffmanTree_1 + beq buildHuffmanTree_3 ; branch always ; Count number of codes of each length buildHuffmanTree_2: - tax - inc bitsPointer_l,x - iny - bne buildHuffmanTree_3 - inc buildHuffmanTree_src+1 + tax + inc bitsPointer_l,x + iny + bne buildHuffmanTree_3 + inc buildHuffmanTree_src+1 buildHuffmanTree_3: - lda (buildHuffmanTree_src),y - bpl buildHuffmanTree_2 + lda (buildHuffmanTree_src),y + bpl buildHuffmanTree_2 ; Calculate a pointer for each length - ldx #0 - lda #sortedCodes - clc + ldx #0 + lda #sortedCodes + clc buildHuffmanTree_4: - sta bitsPointer_l,x - tya - sta bitsPointer_h,x - lda bitsPointer_l+1,x - adc bitsPointer_l,x ; C flag is zero - bcc buildHuffmanTree_5 - iny + sta bitsPointer_l,x + tya + sta bitsPointer_h,x + lda bitsPointer_l+1,x + adc bitsPointer_l,x ; C flag is zero + bcc buildHuffmanTree_5 + iny buildHuffmanTree_5: - inx - cpx #TREES_SIZE - bcc buildHuffmanTree_4 - lda #>literalCodeLength - sta buildHuffmanTree_src+1 - ldy #0 - bcs buildHuffmanTree_9 ; branch always + inx + cpx #TREES_SIZE + bcc buildHuffmanTree_4 + lda #>literalCodeLength + sta buildHuffmanTree_src+1 + ldy #0 + bcs buildHuffmanTree_9 ; branch always ; Put codes into their place in sorted table buildHuffmanTree_6: - beq buildHuffmanTree_7 - tax - lda bitsPointer_l-1,x - sta buildHuffmanTree_ptr - lda bitsPointer_h-1,x - sta buildHuffmanTree_ptr+1 - tya - ldy bitsCount-1,x - inc bitsCount-1,x - sta (buildHuffmanTree_ptr),y - tay + beq buildHuffmanTree_7 + tax + lda bitsPointer_l-1,x + sta buildHuffmanTree_ptr + lda bitsPointer_h-1,x + sta buildHuffmanTree_ptr+1 + tya + ldy bitsCount-1,x + inc bitsCount-1,x + sta (buildHuffmanTree_ptr),y + tay buildHuffmanTree_7: - iny - bne buildHuffmanTree_9 - inc buildHuffmanTree_src+1 - ldx #MAX_BITS-1 + iny + bne buildHuffmanTree_9 + inc buildHuffmanTree_src+1 + ldx #MAX_BITS-1 buildHuffmanTree_8: - lda bitsCount,x - sta literalCount,x - dex - bpl buildHuffmanTree_8 + lda bitsCount,x + sta literalCount,x + dex + bpl buildHuffmanTree_8 buildHuffmanTree_9: - lda (buildHuffmanTree_src),y - bpl buildHuffmanTree_6 - rts + lda (buildHuffmanTree_src),y + bpl buildHuffmanTree_6 + rts ; -------------------------------------------------------------------------- ; Decode next code length using temporary codes. getNextLength: - stx getNextLength_index - dey - bne getNextLength_1 + stx getNextLength_index + dey + bne getNextLength_1 ; Fetch a temporary code - jsr fetchPrimaryCode + jsr fetchPrimaryCode ; Temporary code 0..15: put this length - ldy #1 - cmp #16 - bcc getNextLength_2 + ldy #1 + cmp #16 + bcc getNextLength_2 ; Temporary code 16: repeat last length 3 + getBits(2) times ; Temporary code 17: put zero length 3 + getBits(3) times ; Temporary code 18: put zero length 11 + getBits(7) times - tay - ldx tempExtraBits-16,y - lda tempBaseValue-16,y - jsr getBits - cpy #17 - tay - txa ; lda #0 - bcs getNextLength_2 + tay + ldx tempExtraBits-16,y + lda tempBaseValue-16,y + jsr getBits + cpy #17 + tay + txa ; lda #0 + bcs getNextLength_2 getNextLength_1: - lda getNextLength_last + lda getNextLength_last getNextLength_2: - sta getNextLength_last - ldx getNextLength_index - rts + sta getNextLength_last + ldx getNextLength_index + rts ; -------------------------------------------------------------------------- ; Read a code basing on the primary tree. fetchPrimaryCode: - ldx #PRIMARY_TREE -; jmp fetchCode + ldx #PRIMARY_TREE +; jmp fetchCode ; -------------------------------------------------------------------------- ; Read a code from input basing on the tree specified in X. @@ -472,36 +472,36 @@ fetchPrimaryCode: ; For the literal/length tree, the C flag is set if the code is non-literal. fetchCode: - lda #0 + lda #0 fetchCode_1: - jsr getBit - rol a - inx - sec - sbc bitsCount-1,x - bcs fetchCode_1 - adc bitsCount-1,x ; C flag is zero - cmp literalCount-1,x - sta fetchCode_ptr - ldy bitsPointer_l-1,x - lda bitsPointer_h-1,x - sta fetchCode_ptr+1 - lda (fetchCode_ptr),y - rts + jsr getBit + rol a + inx + sec + sbc bitsCount-1,x + bcs fetchCode_1 + adc bitsCount-1,x ; C flag is zero + cmp literalCount-1,x + sta fetchCode_ptr + ldy bitsPointer_l-1,x + lda bitsPointer_h-1,x + sta fetchCode_ptr+1 + lda (fetchCode_ptr),y + rts ; -------------------------------------------------------------------------- ; Decode low byte of a value (length or distance), basing on the code in A. ; The result is the base value for this code plus some bits read from input. getValue: - tay - ldx lengthExtraBits-1,y - lda lengthBaseValue_l-1,y - pha - lda lengthBaseValue_h-1,y - tay - pla -; jmp getBits + tay + ldx lengthExtraBits-1,y + lda lengthBaseValue_l-1,y + pha + lda lengthBaseValue_h-1,y + tay + pla +; jmp getBits ; -------------------------------------------------------------------------- ; Read X-bit number from the input and add it to A. @@ -510,55 +510,55 @@ getValue: ; On return X holds number of unread bits: X = (X > 8 ? X - 8 : 0); getBits: - cpx #0 - beq getBits_ret + cpx #0 + beq getBits_ret .ifpc02 - stz getBits_tmp - dec getBits_tmp + stz getBits_tmp + dec getBits_tmp .else - pha - lda #$ff - sta getBits_tmp - pla + pha + lda #$ff + sta getBits_tmp + pla .endif getBits_1: - jsr getBit - bcc getBits_2 - sbc getBits_tmp ; C flag is set - bcc getBits_2 - iny + jsr getBit + bcc getBits_2 + sbc getBits_tmp ; C flag is set + bcc getBits_2 + iny getBits_2: - dex - beq getBits_ret - asl getBits_tmp - bmi getBits_1 + dex + beq getBits_ret + asl getBits_tmp + bmi getBits_1 getBits_ret: - rts + rts ; -------------------------------------------------------------------------- ; Read a single bit from input, return it in the C flag. getBit: - lsr getBit_hold - bne getBit_ret - pha + lsr getBit_hold + bne getBit_ret + pha .ifpc02 - lda (inputPointer) + lda (inputPointer) .else - sty getBit_hold - ldy #0 - lda (inputPointer),y - ldy getBit_hold + sty getBit_hold + ldy #0 + lda (inputPointer),y + ldy getBit_hold .endif - inc inputPointer - bne getBit_1 - inc inputPointer+1 + inc inputPointer + bne getBit_1 + inc inputPointer+1 getBit_1: - ror a ; C flag is set - sta getBit_hold - pla + ror a ; C flag is set + sta getBit_hold + pla getBit_ret: - rts + rts ; -------------------------------------------------------------------------- @@ -566,58 +566,58 @@ getBit_ret: ; Constant data ; - .rodata + .rodata ; -------------------------------------------------------------------------- ; Arrays for the temporary codes. ; Order, in which lengths of the temporary codes are stored. tempCodeLengthOrder: - .byte 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 + .byte 16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15 ; Base values. tempBaseValue: - .byte 3,3,11 + .byte 3,3,11 ; Number of extra bits to read. tempExtraBits: - .byte 2,3,7 + .byte 2,3,7 ; -------------------------------------------------------------------------- ; Arrays for the length and distance codes. ; Base values. lengthBaseValue_l: - .byte <3,<4,<5,<6,<7,<8,<9,<10 - .byte <11,<13,<15,<17,<19,<23,<27,<31 - .byte <35,<43,<51,<59,<67,<83,<99,<115 - .byte <131,<163,<195,<227,<258 + .byte <3,<4,<5,<6,<7,<8,<9,<10 + .byte <11,<13,<15,<17,<19,<23,<27,<31 + .byte <35,<43,<51,<59,<67,<83,<99,<115 + .byte <131,<163,<195,<227,<258 distanceBaseValue_l: - .byte <1,<2,<3,<4,<5,<7,<9,<13 - .byte <17,<25,<33,<49,<65,<97,<129,<193 - .byte <257,<385,<513,<769,<1025,<1537,<2049,<3073 - .byte <4097,<6145,<8193,<12289,<16385,<24577 + .byte <1,<2,<3,<4,<5,<7,<9,<13 + .byte <17,<25,<33,<49,<65,<97,<129,<193 + .byte <257,<385,<513,<769,<1025,<1537,<2049,<3073 + .byte <4097,<6145,<8193,<12289,<16385,<24577 lengthBaseValue_h: - .byte >3,>4,>5,>6,>7,>8,>9,>10 - .byte >11,>13,>15,>17,>19,>23,>27,>31 - .byte >35,>43,>51,>59,>67,>83,>99,>115 - .byte >131,>163,>195,>227,>258 + .byte >3,>4,>5,>6,>7,>8,>9,>10 + .byte >11,>13,>15,>17,>19,>23,>27,>31 + .byte >35,>43,>51,>59,>67,>83,>99,>115 + .byte >131,>163,>195,>227,>258 distanceBaseValue_h: - .byte >1,>2,>3,>4,>5,>7,>9,>13 - .byte >17,>25,>33,>49,>65,>97,>129,>193 - .byte >257,>385,>513,>769,>1025,>1537,>2049,>3073 - .byte >4097,>6145,>8193,>12289,>16385,>24577 + .byte >1,>2,>3,>4,>5,>7,>9,>13 + .byte >17,>25,>33,>49,>65,>97,>129,>193 + .byte >257,>385,>513,>769,>1025,>1537,>2049,>3073 + .byte >4097,>6145,>8193,>12289,>16385,>24577 ; Number of extra bits to read. lengthExtraBits: - .byte 0,0,0,0,0,0,0,0 - .byte 1,1,1,1,2,2,2,2 - .byte 3,3,3,3,4,4,4,4 - .byte 5,5,5,5,0 + .byte 0,0,0,0,0,0,0,0 + .byte 1,1,1,1,2,2,2,2 + .byte 3,3,3,3,4,4,4,4 + .byte 5,5,5,5,0 distanceExtraBits: - .byte 0,0,0,0,1,1,2,2 - .byte 3,3,4,4,5,5,6,6 - .byte 7,7,8,8,9,9,10,10 - .byte 11,11,12,12,13,13 + .byte 0,0,0,0,1,1,2,2 + .byte 3,3,4,4,5,5,6,6 + .byte 7,7,8,8,9,9,10,10 + .byte 11,11,12,12,13,13 ; -------------------------------------------------------------------------- @@ -625,7 +625,7 @@ distanceExtraBits: ; Uninitialised data ; - .bss + .bss ; Number of literal codes of each length in the primary tree ; (MAX_BITS bytes, overlap with literalCodeLength). @@ -636,38 +636,38 @@ literalCount: ; Lengths of literal codes. literalCodeLength: - .res 256 + .res 256 ; Length of the end code. endCodeLength: - .res 1 + .res 1 ; Lengths of length codes. lengthCodeLength: - .res 29 + .res 29 ; -------------------------------------------------------------------------- ; Data for building the distance tree. ; Lengths of distance codes. distanceCodeLength: - .res 30 + .res 30 ; For two unused codes in the fixed trees and an 'end' mark. - .res 3 + .res 3 ; -------------------------------------------------------------------------- ; The Huffman trees. ; Number of codes of each length. bitsCount: - .res TREES_SIZE + .res TREES_SIZE ; Pointers to sorted codes of each length. bitsPointer_l: - .res TREES_SIZE+1 + .res TREES_SIZE+1 bitsPointer_h: - .res TREES_SIZE + .res TREES_SIZE ; Sorted codes. sortedCodes: - .res 256+1+29+30+2 + .res 256+1+29+30+2 diff --git a/libsrc/zlib/uncompress.c b/libsrc/zlib/uncompress.c index 162158657..3cff19ad3 100644 --- a/libsrc/zlib/uncompress.c +++ b/libsrc/zlib/uncompress.c @@ -9,28 +9,28 @@ int uncompress (char* dest, unsigned* destLen, const char* source, unsigned sourceLen) { - unsigned len; - unsigned char* ptr; - unsigned long csum; - /* source[0]: Compression method and flags - bits 0 to 3: Compression method (must be Z_DEFLATED) - bits 4 to 7: Compression info (must be <= 7) - source[1]: Flags - bits 0 to 4: Check bits - bit 5: Preset dictionary (not supported, sorry) - bits 6 to 7: Compression level - */ - if ((source[0] & 0x8f) != Z_DEFLATED || source[1] & 0x20) - return Z_DATA_ERROR; - if ((((unsigned) source[0] << 8) | (unsigned char) source[1]) % 31) - return Z_DATA_ERROR; - *destLen = len = inflatemem(dest, source + 2); - ptr = (unsigned char*) source + sourceLen - 4; - csum = adler32(adler32(0L, Z_NULL, 0), dest, len); - if ((unsigned char) csum != ptr[3] - || (unsigned char) (csum >> 8) != ptr[2] - || (unsigned char) (csum >> 16) != ptr[1] - || (unsigned char) (csum >> 24) != ptr[0]) - return Z_DATA_ERROR; - return Z_OK; + unsigned len; + unsigned char* ptr; + unsigned long csum; + /* source[0]: Compression method and flags + bits 0 to 3: Compression method (must be Z_DEFLATED) + bits 4 to 7: Compression info (must be <= 7) + source[1]: Flags + bits 0 to 4: Check bits + bit 5: Preset dictionary (not supported, sorry) + bits 6 to 7: Compression level + */ + if ((source[0] & 0x8f) != Z_DEFLATED || source[1] & 0x20) + return Z_DATA_ERROR; + if ((((unsigned) source[0] << 8) | (unsigned char) source[1]) % 31) + return Z_DATA_ERROR; + *destLen = len = inflatemem(dest, source + 2); + ptr = (unsigned char*) source + sourceLen - 4; + csum = adler32(adler32(0L, Z_NULL, 0), dest, len); + if ((unsigned char) csum != ptr[3] + || (unsigned char) (csum >> 8) != ptr[2] + || (unsigned char) (csum >> 16) != ptr[1] + || (unsigned char) (csum >> 24) != ptr[0]) + return Z_DATA_ERROR; + return Z_OK; } diff --git a/samples/README b/samples/README index 4d677fa1a..25ee43118 100644 --- a/samples/README +++ b/samples/README @@ -19,103 +19,103 @@ Please note: List of supplied sample programs: ----------------------------------------------------------------------------- -Name: ascii -Description: Shows the ASCII (or ATASCII, PETSCII) codes of typed - characters. Written and contributed by Greg King - . -Platforms: All platforms with conio or stdio (compile time configurable). +Name: ascii +Description: Shows the ASCII (or ATASCII, PETSCII) codes of typed + characters. Written and contributed by Greg King + . +Platforms: All platforms with conio or stdio (compile time configurable). ----------------------------------------------------------------------------- -Name: diodemo -Description: A disc copy program written and contributed by Oliver - Schmidt, . Supports single or dual disc copy. -Platforms: The program does depend on conio and dio (direct disk i/o), - so it does currently compile for the Atari and Apple ][ - machines. +Name: diodemo +Description: A disc copy program written and contributed by Oliver + Schmidt, . Supports single or dual disc copy. +Platforms: The program does depend on conio and dio (direct disk i/o), + so it does currently compile for the Atari and Apple ][ + machines. ----------------------------------------------------------------------------- -Name: enumdevdir -Description: Enumerates all devices, directories and files. Written and - contributed by Oliver Schmidt, . -Platforms: All systems with device enumeration and directory access - (currently the C64, the C128 and the Apple ][). +Name: enumdevdir +Description: Enumerates all devices, directories and files. Written and + contributed by Oliver Schmidt, . +Platforms: All systems with device enumeration and directory access + (currently the C64, the C128 and the Apple ][). ----------------------------------------------------------------------------- -Name: fire -Description: Another graphics demo written by groepaz/hitmen. -Platforms: The program is currently only running on the C64, but should - be portable to the C128 and CBM510 (and maybe more machines). +Name: fire +Description: Another graphics demo written by groepaz/hitmen. +Platforms: The program is currently only running on the C64, but should + be portable to the C128 and CBM510 (and maybe more machines). ----------------------------------------------------------------------------- -Name: gunzip65 -Description: A gunzip utility for 6502 based machines written by Piotr - Fusik . -Platforms: Runs on all platforms with file I/O (currently the Atari, the - Apple ][ and most Commodore machines). +Name: gunzip65 +Description: A gunzip utility for 6502 based machines written by Piotr + Fusik . +Platforms: Runs on all platforms with file I/O (currently the Atari, the + Apple ][ and most Commodore machines). ----------------------------------------------------------------------------- -Name: hello -Description: A nice "Hello world" type program that uses the conio - console I/O library for output. -Platforms: Runs on all platforms that support conio, which means: - Apple ][, Atari, C16, C64, C128, CBM510, CBM610, PET, Plus/4 +Name: hello +Description: A nice "Hello world" type program that uses the conio + console I/O library for output. +Platforms: Runs on all platforms that support conio, which means: + Apple ][, Atari, C16, C64, C128, CBM510, CBM610, PET, Plus/4 ----------------------------------------------------------------------------- -Name: mandelbrot -Description: A mandelbrot demo using integer arithmetic. The demo was - written by groepaz/hitmen and converted to cc65 using TGI - graphics by Stephan Haubenthal. -Platforms: Runs on all platforms that have TGI support: - Apple ][, C64, C128, Oric Atmos, Geos and Lynx. +Name: mandelbrot +Description: A mandelbrot demo using integer arithmetic. The demo was + written by groepaz/hitmen and converted to cc65 using TGI + graphics by Stephan Haubenthal. +Platforms: Runs on all platforms that have TGI support: + Apple ][, C64, C128, Oric Atmos, Geos and Lynx. ----------------------------------------------------------------------------- -Name: mousedemo -Description: Shows how to use the mouse. -Platforms: All systems with mouse and conio support: - C64, C128, CBM510, Atari, Apple ][ +Name: mousedemo +Description: Shows how to use the mouse. +Platforms: All systems with mouse and conio support: + C64, C128, CBM510, Atari, Apple ][ ----------------------------------------------------------------------------- -Name: multidemo -Description: Shows how to combine multiple cc65 features incl. overlays - and extended memory drivers. Written and contributed by - Oliver Schmidt, . -Platforms: All systems with an overlay linker config, disk directory - access and EMD support (currently the C64, the C128, - the Atari and the Apple ][). +Name: multidemo +Description: Shows how to combine multiple cc65 features incl. overlays + and extended memory drivers. Written and contributed by + Oliver Schmidt, . +Platforms: All systems with an overlay linker config, disk directory + access and EMD support (currently the C64, the C128, + the Atari and the Apple ][). ----------------------------------------------------------------------------- -Name: nachtm -Description: Plays "Eine kleine Nachtmusik" by Wolfgang Amadeus Mozart -Platforms: All systems that have the Commodore SID (Sound Interface - Device): - C64, C128, CBM510, CBM610 +Name: nachtm +Description: Plays "Eine kleine Nachtmusik" by Wolfgang Amadeus Mozart +Platforms: All systems that have the Commodore SID (Sound Interface + Device): + C64, C128, CBM510, CBM610 ----------------------------------------------------------------------------- -Name: overlaydemo -Description: Shows how to load overlay files from disk. Written and - contributed by Oliver Schmidt, . -Platforms: All systems with an overlay linker config (currently the C64, - the C128, the Atari and the Apple ][). +Name: overlaydemo +Description: Shows how to load overlay files from disk. Written and + contributed by Oliver Schmidt, . +Platforms: All systems with an overlay linker config (currently the C64, + the C128, the Atari and the Apple ][). ----------------------------------------------------------------------------- -Name: plasma -Description: A fancy graphics demo written by groepaz/hitmen. -Platforms: The program needs a VIC, or a TED, so it runs on the following - systems: - C64, C128, CBM510, Plus/4 +Name: plasma +Description: A fancy graphics demo written by groepaz/hitmen. +Platforms: The program needs a VIC, or a TED, so it runs on the following + systems: + C64, C128, CBM510, Plus/4 ----------------------------------------------------------------------------- -Name: sieve -Description: Implements the "Sieve of Eratosthenes" as a way to find all - prime numbers in a specific number interval. Often used as - a benchmark program. -Platforms: All systems with conio and clock support: - Atari, C16, C64, C128, CBM510, CBM610, PET, Plus/4, - Apple ][ (without timing due to missing clock support) +Name: sieve +Description: Implements the "Sieve of Eratosthenes" as a way to find all + prime numbers in a specific number interval. Often used as + a benchmark program. +Platforms: All systems with conio and clock support: + Atari, C16, C64, C128, CBM510, CBM610, PET, Plus/4, + Apple ][ (without timing due to missing clock support) ----------------------------------------------------------------------------- -Name: tgidemo -Description: Shows some of the graphics capabilities of the "tiny graphics - interface". -Platforms: Runs on all platforms that have TGI support: - Apple ][, C64, C128, Oric Atmos, Geos and Lynx. +Name: tgidemo +Description: Shows some of the graphics capabilities of the "tiny graphics + interface". +Platforms: Runs on all platforms that have TGI support: + Apple ][, C64, C128, Oric Atmos, Geos and Lynx. diff --git a/samples/ascii.c b/samples/ascii.c index 190025e9d..fd293e213 100644 --- a/samples/ascii.c +++ b/samples/ascii.c @@ -19,7 +19,7 @@ #include #include -#define QUIT 'Q' +#define QUIT 'Q' /* r -- row. t -- table-column. */ @@ -28,63 +28,63 @@ static int c; #ifndef USE_STDIO -# define PRINT cprintf -# define PUT(c) cputc((char)(c)) +# define PRINT cprintf +# define PUT(c) cputc((char)(c)) /* conio doesn't echo typed characters. ** So, this function does it. */ static int GET(void) { - PUT(c = (int)cgetc()); - return c; - } + PUT(c = (int)cgetc()); + return c; + } #else -# define PRINT printf -# define GET getchar +# define PRINT printf +# define GET getchar #endif int main(void) { -# ifndef USE_STDIO - /* conio doesn't scroll! Avoid trouble by starting at the top - ** of the screen, and never going "below" the bottom of the screen. - */ - clrscr(); - r = 7; /* allow for prompt */ -# endif +# ifndef USE_STDIO + /* conio doesn't scroll! Avoid trouble by starting at the top + ** of the screen, and never going "below" the bottom of the screen. + */ + clrscr(); + r = 7; /* allow for prompt */ +# endif - /* This prompt fits on the VIC-20's narrow screen. - */ - PRINT("Type characters to see\r\ntheir hexadecimal code\r\nnumbers:\r\n\n"); - screensize(&width, &height); /* get the screen's dimensions */ - width /= 6; /* get number of codes on a line */ - cursor(true); - t = 0; - while ((c = GET()) != EOF) { + /* This prompt fits on the VIC-20's narrow screen. + */ + PRINT("Type characters to see\r\ntheir hexadecimal code\r\nnumbers:\r\n\n"); + screensize(&width, &height); /* get the screen's dimensions */ + width /= 6; /* get number of codes on a line */ + cursor(true); + t = 0; + while ((c = GET()) != EOF) { -# ifndef USE_STDIO - if (r == height) { - clrscr(); - t = 0; - PUT(c); /* echo char. again because screen was erased */ - r = 1; - } - if (c == '\n') - ++r; -# endif +# ifndef USE_STDIO + if (r == height) { + clrscr(); + t = 0; + PUT(c); /* echo char. again because screen was erased */ + r = 1; + } + if (c == '\n') + ++r; +# endif - PRINT("=$%02x ", c); - if (c == QUIT) - break; - if (++t == width) { - PRINT("\r\n"); - ++r; - t = 0; - } - } - PRINT("\r\n"); - return EXIT_SUCCESS; - } + PRINT("=$%02x ", c); + if (c == QUIT) + break; + if (++t == width) { + PRINT("\r\n"); + ++r; + t = 0; + } + } + PRINT("\r\n"); + return EXIT_SUCCESS; + } diff --git a/samples/fire.c b/samples/fire.c index bbea872cf..cae922509 100644 --- a/samples/fire.c +++ b/samples/fire.c @@ -3,7 +3,7 @@ * * * (w)2002 by groepaz/hitmen * * * - * Cleanup and porting by Ullrich von Bassewitz. * + * Cleanup and porting by Ullrich von Bassewitz. * * 2004-06-08, Greg King * * * *****************************************************************************/ @@ -26,7 +26,7 @@ # define SCREEN2 0xE400 # define CHARSET 0xE800 # define COLORRAM 0xD800 -# define outb(addr,val) (*(addr) = (val)) +# define outb(addr,val) (*(addr) = (val)) # define inb(addr) (*(addr)) #elif defined(__C128__) # define BUFFER 0x0400 @@ -34,7 +34,7 @@ # define SCREEN2 0xE400 # define CHARSET 0xE800 # define COLORRAM 0xD800 -# define outb(addr,val) (*(addr) = (val)) +# define outb(addr,val) (*(addr) = (val)) # define inb(addr) (*(addr)) #elif defined(__CBM510__) # define BUFFER 0xF800 @@ -201,7 +201,7 @@ int main (void) /* Run the demo until a key was hit */ t = clock (); while (!kbhit()) { - /* Build page 1, then make it visible */ + /* Build page 1, then make it visible */ fire (SCREEN1); waitvsync (); outb (&VIC.addr, PAGE1); diff --git a/samples/geos/hello1.c b/samples/geos/hello1.c index b4ad10605..fd46d157d 100644 --- a/samples/geos/hello1.c +++ b/samples/geos/hello1.c @@ -17,8 +17,8 @@ void main (void) // Let's show what we've got... DlgBoxOk(CBOLDON "Hello, world" CPLAINTEXT, - "This is written in C!"); - + "This is written in C!"); + // Normal apps exit from main into system's mainloop, and app finish // when user selects it from icons or menu, but here we want to exit // immediately. diff --git a/samples/geos/hello2.c b/samples/geos/hello2.c index f4f57a6cb..d41bdb3c9 100644 --- a/samples/geos/hello2.c +++ b/samples/geos/hello2.c @@ -36,7 +36,7 @@ void main (void) // Note that this is multitasking sleep, and if there are any icons/menus onscreen, // they would be usable, in this case you have only pointer usable Sleep(5*50); - + // Normal apps exit from main into system's mainloop, and app finish // when user selects it from icons or menu, but here we want to exit // immediately. diff --git a/samples/gunzip65.c b/samples/gunzip65.c index 3b84982b7..bc515f0ee 100644 --- a/samples/gunzip65.c +++ b/samples/gunzip65.c @@ -21,22 +21,22 @@ */ unsigned inflatemem(char* dest, const char* source) { - z_stream stream; + z_stream stream; - stream.next_in = (Bytef*) source; - stream.avail_in = 65535; + stream.next_in = (Bytef*) source; + stream.avail_in = 65535; - stream.next_out = dest; - stream.avail_out = 65535; + stream.next_out = dest; + stream.avail_out = 65535; - stream.zalloc = (alloc_func) 0; - stream.zfree = (free_func) 0; + stream.zalloc = (alloc_func) 0; + stream.zfree = (free_func) 0; - inflateInit2(&stream, -MAX_WBITS); - inflate(&stream, Z_FINISH); - inflateEnd(&stream); + inflateInit2(&stream, -MAX_WBITS); + inflate(&stream, Z_FINISH); + inflateEnd(&stream); - return stream.total_out; + return stream.total_out; } #endif /* __CC65__ */ @@ -63,11 +63,11 @@ unsigned inflatemem(char* dest, const char* source) */ /* Flags in the GZIP header. */ -#define FTEXT 1 /* Extra text */ -#define FHCRC 2 /* Header CRC */ -#define FEXTRA 4 /* Extra field */ -#define FNAME 8 /* File name */ -#define FCOMMENT 16 /* File comment */ +#define FTEXT 1 /* Extra text */ +#define FHCRC 2 /* Header CRC */ +#define FEXTRA 4 /* Extra field */ +#define FNAME 8 /* File name */ +#define FCOMMENT 16 /* File comment */ /* * We read whole GZIP file into this buffer. @@ -94,82 +94,82 @@ static unsigned char buffer[26000]; */ unsigned uncompress_buffer(unsigned complen) { - unsigned char* ptr; - unsigned long crc; - unsigned long unclen; - void* ptr2; - unsigned unclen2; + unsigned char* ptr; + unsigned long crc; + unsigned long unclen; + void* ptr2; + unsigned unclen2; - /* check GZIP signature */ - if (buffer[0] != 0x1f || buffer[1] != 0x8b) { - puts("Not GZIP format"); - return 0; - } + /* check GZIP signature */ + if (buffer[0] != 0x1f || buffer[1] != 0x8b) { + puts("Not GZIP format"); + return 0; + } - /* check compression method (it is always (?) "deflate") */ - if (buffer[2] != 8) { - puts("Unsupported compression method"); - return 0; - } + /* check compression method (it is always (?) "deflate") */ + if (buffer[2] != 8) { + puts("Unsupported compression method"); + return 0; + } - /* get CRC from GZIP trailer */ - crc = GET_LONG(buffer + complen - 8); + /* get CRC from GZIP trailer */ + crc = GET_LONG(buffer + complen - 8); - /* get uncompressed length from GZIP trailer */ - unclen = GET_LONG(buffer + complen - 4); - if (unclen > sizeof(buffer)) { - puts("Uncompressed size too big"); - return 0; - } + /* get uncompressed length from GZIP trailer */ + unclen = GET_LONG(buffer + complen - 4); + if (unclen > sizeof(buffer)) { + puts("Uncompressed size too big"); + return 0; + } - /* skip extra field, file name, comment and crc */ - ptr = buffer + 10; - if (buffer[3] & FEXTRA) - ptr = buffer + 12 + GET_WORD(buffer + 10); - if (buffer[3] & FNAME) - while (*ptr++ != 0); - if (buffer[3] & FCOMMENT) - while (*ptr++ != 0); - if (buffer[3] & FHCRC) - ptr += 2; + /* skip extra field, file name, comment and crc */ + ptr = buffer + 10; + if (buffer[3] & FEXTRA) + ptr = buffer + 12 + GET_WORD(buffer + 10); + if (buffer[3] & FNAME) + while (*ptr++ != 0); + if (buffer[3] & FCOMMENT) + while (*ptr++ != 0); + if (buffer[3] & FHCRC) + ptr += 2; - /* - * calculate length of raw "deflate" data - * (without the GZIP header and 8-byte trailer) - */ - complen -= (ptr - buffer) + 8; + /* + * calculate length of raw "deflate" data + * (without the GZIP header and 8-byte trailer) + */ + complen -= (ptr - buffer) + 8; - /* - * We will move the compressed data to the end of buffer[]. - * Thus the compressed data and the decompressed data (written from - * the beginning of buffer[]) may overlap, as long as the decompressed - * data doesn't go further than unread compressed data. - * ptr2 points to the beginning of compressed data at the end - * of buffer[]. - */ - ptr2 = buffer + sizeof(buffer) - complen; - /* move the compressed data to end of buffer[] */ - memmove(ptr2, ptr, complen); + /* + * We will move the compressed data to the end of buffer[]. + * Thus the compressed data and the decompressed data (written from + * the beginning of buffer[]) may overlap, as long as the decompressed + * data doesn't go further than unread compressed data. + * ptr2 points to the beginning of compressed data at the end + * of buffer[]. + */ + ptr2 = buffer + sizeof(buffer) - complen; + /* move the compressed data to end of buffer[] */ + memmove(ptr2, ptr, complen); - /* uncompress */ - puts("Inflating..."); - unclen2 = inflatemem(buffer, ptr2); + /* uncompress */ + puts("Inflating..."); + unclen2 = inflatemem(buffer, ptr2); - /* verify uncompressed length */ - if (unclen2 != (unsigned) unclen) { - puts("Uncompressed size does not match"); - return 0; - } + /* verify uncompressed length */ + if (unclen2 != (unsigned) unclen) { + puts("Uncompressed size does not match"); + return 0; + } - /* verify CRC */ - puts("Calculating CRC..."); - if (crc32(crc32(0L, Z_NULL, 0), buffer, unclen2) != crc) { - puts("CRC mismatch"); - return 0; - } + /* verify CRC */ + puts("Calculating CRC..."); + if (crc32(crc32(0L, Z_NULL, 0), buffer, unclen2) != crc) { + puts("CRC mismatch"); + return 0; + } - /* return number of uncompressed bytes */ - return unclen2; + /* return number of uncompressed bytes */ + return unclen2; } /* @@ -177,52 +177,52 @@ unsigned uncompress_buffer(unsigned complen) */ char* get_fname(void) { - static char filename[100]; - unsigned len; - fgets(filename, sizeof(filename), stdin); - len = strlen(filename); - if (len >= 1 && filename[len - 1] == '\n') - filename[len - 1] = '\0'; - return filename; + static char filename[100]; + unsigned len; + fgets(filename, sizeof(filename), stdin); + len = strlen(filename); + if (len >= 1 && filename[len - 1] == '\n') + filename[len - 1] = '\0'; + return filename; } int main(void) { - FILE* fp; - unsigned length; + FILE* fp; + unsigned length; - /* read GZIP file */ - puts("GZIP file name:"); - fp = fopen(get_fname(), "rb"); - if (!fp) { - puts("Can't open GZIP file"); - return 1; - } - length = fread(buffer, 1, sizeof(buffer), fp); - fclose(fp); - if (length == sizeof(buffer)) { - puts("File is too long"); - return 1; - } + /* read GZIP file */ + puts("GZIP file name:"); + fp = fopen(get_fname(), "rb"); + if (!fp) { + puts("Can't open GZIP file"); + return 1; + } + length = fread(buffer, 1, sizeof(buffer), fp); + fclose(fp); + if (length == sizeof(buffer)) { + puts("File is too long"); + return 1; + } - /* decompress */ - length = uncompress_buffer(length); - if (length == 0) - return 1; + /* decompress */ + length = uncompress_buffer(length); + if (length == 0) + return 1; - /* write uncompressed file */ - puts("Uncompressed file name:"); - fp = fopen(get_fname(), "wb"); - if (!fp) { - puts("Can't create output file"); - return 1; - } - if (fwrite(buffer, 1, length, fp) != length) { - puts("Error while writing output file"); - return 1; - } - fclose(fp); + /* write uncompressed file */ + puts("Uncompressed file name:"); + fp = fopen(get_fname(), "wb"); + if (!fp) { + puts("Can't create output file"); + return 1; + } + if (fwrite(buffer, 1, length, fp) != length) { + puts("Error while writing output file"); + return 1; + } + fclose(fp); - puts("Ok."); - return 0; + puts("Ok."); + return 0; } diff --git a/samples/hello.c b/samples/hello.c index cdbfab73a..dcd6d6884 100644 --- a/samples/hello.c +++ b/samples/hello.c @@ -15,7 +15,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -25,7 +25,7 @@ static const char Text [] = "Hello world!"; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/samples/mandelbrot.c b/samples/mandelbrot.c index 69035f4ed..6c58cea97 100644 --- a/samples/mandelbrot.c +++ b/samples/mandelbrot.c @@ -14,28 +14,28 @@ /* Graphics definitions */ -#define SCREEN_X (tgi_getxres()) -#define SCREEN_Y (tgi_getyres()) -#define MAXCOL (tgi_getcolorcount()) +#define SCREEN_X (tgi_getxres()) +#define SCREEN_Y (tgi_getyres()) +#define MAXCOL (tgi_getcolorcount()) -#define maxiterations 32 -#define fpshift (10) -#define tofp(_x) ((_x)<>fpshift) -#define fpabs(_x) (abs(_x)) +#define maxiterations 32 +#define fpshift (10) +#define tofp(_x) ((_x)<>fpshift) +#define fpabs(_x) (abs(_x)) -#define mulfp(_a,_b) ((((signed long)_a)*(_b))>>fpshift) -#define divfp(_a,_b) ((((signed long)_a)<>fpshift) +#define divfp(_a,_b) ((((signed long)_a)<Msg)) / 2; - cputsxy (X, T->Y, T->Msg); - ++T; + cputsxy (X, T->Y, T->Msg); + ++T; } } @@ -1017,7 +1017,7 @@ static void TimeSync (void) static unsigned char Clock; do { - Clock = clock (); + Clock = clock (); } while (Clock != NextClock); NextClock = Clock + TICKS_PER_TONE; } @@ -1041,11 +1041,11 @@ static void DisplayTime (void) * just write to the memory space. */ #if defined(__CBM510__) || defined(__CBM610__) -# define outb(addr,val) pokebsys ((unsigned)(addr), val) -# define outw(addr,val) pokewsys ((unsigned)(addr), val) +# define outb(addr,val) pokebsys ((unsigned)(addr), val) +# define outw(addr,val) pokewsys ((unsigned)(addr), val) #else -# define outb(addr,val) (*(addr)) = (val) -# define outw(addr,val) (*(addr)) = (val) +# define outb(addr,val) (*(addr)) = (val) +# define outw(addr,val) (*(addr)) = (val) #endif @@ -1055,9 +1055,9 @@ int main (void) unsigned char I; unsigned char Tone; unsigned char Octave; - unsigned Val; - struct __sid_voice* Voice; - register VoiceCtrl* VC; + unsigned Val; + struct __sid_voice* Voice; + register VoiceCtrl* VC; /* Initialize the debugger */ DbgInit (0); @@ -1089,74 +1089,74 @@ int main (void) /* Play each voice until all three are done */ while (Done != 0x07) { - /* Display the time in the lower left corner */ - DisplayTime (); + /* Display the time in the lower left corner */ + DisplayTime (); - /* Wait for the next run */ - TimeSync (); + /* Wait for the next run */ + TimeSync (); - /* Check for a key */ - if (kbhit ()) { - if (cgetc () == 'd') { - /* Start the debugger */ - BREAK (); - } else { - /* Stop playing music */ - break; - } - } + /* Check for a key */ + if (kbhit ()) { + if (cgetc () == 'd') { + /* Start the debugger */ + BREAK (); + } else { + /* Stop playing music */ + break; + } + } - /* Play all three voices */ - for (I = 0; I < 3; ++I) { + /* Play all three voices */ + for (I = 0; I < 3; ++I) { - /* Get a pointer to this voice */ - VC = V [I]; - Voice = VC->Voice; + /* Get a pointer to this voice */ + VC = V [I]; + Voice = VC->Voice; - /* Is this voice done? */ - if (Done & VC->DoneMask) { - /* Voice already done */ - continue; - } + /* Is this voice done? */ + if (Done & VC->DoneMask) { + /* Voice already done */ + continue; + } - /* Do we have any more ticks to play? */ - if (VC->Ticks == 0) { - /* We need new data */ - if ((Val = *VC->Data) == 0) { - /* End of data. Mark the voice as done */ - Done |= VC->DoneMask; - continue; - } - ++VC->Data; + /* Do we have any more ticks to play? */ + if (VC->Ticks == 0) { + /* We need new data */ + if ((Val = *VC->Data) == 0) { + /* End of data. Mark the voice as done */ + Done |= VC->DoneMask; + continue; + } + ++VC->Data; - /* Get the ticks from the data */ - VC->Ticks = (Val & 0x7F) - 1; + /* Get the ticks from the data */ + VC->Ticks = (Val & 0x7F) - 1; - /* Check if this is a tone or a pause */ - if (Val & 0x8000) { - /* This is a pause. Remember it and shut off the SID */ - outb (&Voice->ctrl, VC->Trigger & 0xFE); - } else { - /* This is a tone. Extract the attributes. */ - Tone = (Val >> 8) & 0x0F; - Octave = ((Val >> 12) & 0x07) ^ 0x07; - /* Calculate the frequency */ - VC->Freq = FreqTab [Tone] >> Octave; - /* Set the frequency */ - outw (&Voice->freq, VC->Freq); - /* Start the tone */ - outb (&Voice->ctrl, VC->Trigger); - } - } else { - /* Decrement the ticks. If this is the last tick of a tone, - * reset bit 0 of the trigger value and write it back to the - * SID to start the release phase. - */ - if (--(VC->Ticks) == 0) { - outb (&Voice->ctrl, VC->Trigger & 0xFE); - } - } - } + /* Check if this is a tone or a pause */ + if (Val & 0x8000) { + /* This is a pause. Remember it and shut off the SID */ + outb (&Voice->ctrl, VC->Trigger & 0xFE); + } else { + /* This is a tone. Extract the attributes. */ + Tone = (Val >> 8) & 0x0F; + Octave = ((Val >> 12) & 0x07) ^ 0x07; + /* Calculate the frequency */ + VC->Freq = FreqTab [Tone] >> Octave; + /* Set the frequency */ + outw (&Voice->freq, VC->Freq); + /* Start the tone */ + outb (&Voice->ctrl, VC->Trigger); + } + } else { + /* Decrement the ticks. If this is the last tick of a tone, + * reset bit 0 of the trigger value and write it back to the + * SID to start the release phase. + */ + if (--(VC->Ticks) == 0) { + outb (&Voice->ctrl, VC->Trigger & 0xFE); + } + } + } } /* Reset the SID */ @@ -1169,7 +1169,7 @@ int main (void) /* If we have a character, remove it from the buffer */ if (kbhit ()) { - cgetc (); + cgetc (); } /* Done */ diff --git a/samples/plasma.c b/samples/plasma.c index cf0d911f5..ef21ef60e 100644 --- a/samples/plasma.c +++ b/samples/plasma.c @@ -3,7 +3,7 @@ * * * (w)2001 by groepaz/hitmen * * * - * Cleanup and porting by Ullrich von Bassewitz. * + * Cleanup and porting by Ullrich von Bassewitz. * * * *****************************************************************************/ @@ -19,19 +19,19 @@ # define SCREEN1 0xE000 # define SCREEN2 0xE400 # define CHARSET 0xE800 -# define outb(addr,val) (*(addr)) = (val) +# define outb(addr,val) (*(addr)) = (val) # define inb(addr) (*(addr)) #elif defined(__CBM510__) # define SCREEN1 0xF000 # define SCREEN2 0xF400 # define CHARSET 0xE000 -# define outb(addr,val) pokebsys ((unsigned)(addr), val) +# define outb(addr,val) pokebsys ((unsigned)(addr), val) # define inb(addr) peekbsys ((unsigned)(addr)) #elif defined(__PLUS4__) # define SCREEN1 0x6400 # define SCREEN2 0x6C00 # define CHARSET 0x7000 -# define outb(addr,val) (*(addr)) = (val) +# define outb(addr,val) (*(addr)) = (val) # define inb(addr) (*(addr)) #endif @@ -41,7 +41,7 @@ #if defined(__PLUS4__) #define PAGE1 ((SCREEN1 >> 8) & 0xF8) #define PAGE2 ((SCREEN2 >> 8) & 0xF8) -#define CHARADR ((CHARSET >> 8) & 0xFC) +#define CHARADR ((CHARSET >> 8) & 0xFC) #else #define PAGE1 ((SCREEN1 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E) #define PAGE2 ((SCREEN2 >> 6) & 0xF0) | ((CHARSET >> 10) & 0x0E) @@ -106,7 +106,7 @@ static void doplasma (register unsigned char* scrn) for (ii = 0; ii < 25; ++ii) { ybuf[ii] = (sinustable[c1a] + sinustable[c1b]); c1a += 4; - c1b += 9; + c1b += 9; } c1A += 3; c1B -= 5; @@ -115,15 +115,15 @@ static void doplasma (register unsigned char* scrn) for (i = 0; i < 40; ++i) { xbuf[i] = (sinustable[c2a] + sinustable[c2b]); c2a += 3; - c2b += 7; + c2b += 7; } c2A += 2; c2B -= 3; for (ii = 0; ii < 25; ++ii) { - /* Unrolling the following loop will give a speed increase of - * nearly 100% (~24fps), but it will also increase the code - * size a lot. - */ + /* Unrolling the following loop will give a speed increase of + * nearly 100% (~24fps), but it will also increase the code + * size a lot. + */ for (i = 0; i < 40; ++i, ++scrn) { *scrn = (xbuf[i] + ybuf[ii]); } @@ -135,26 +135,26 @@ static void doplasma (register unsigned char* scrn) static void makechar (void) { static const unsigned char bittab[8] = { - 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 + 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }; unsigned char i, ii, b, s; unsigned c; gotoxy (0, 1); for (c = 0; c < 0x100; ++c) { - s = sinustable[c]; + s = sinustable[c]; for (i = 0; i < 8; ++i){ b = 0; for (ii = 0; ii < 8; ++ii) { if ((rand() & 0xFF) > s) { - b |= bittab[ii]; - } + b |= bittab[ii]; + } } ((unsigned char*)CHARSET) [(c*8) + i] = b; } - if ((c & 0x07) == 0) { - cputc ('.'); - } + if ((c & 0x07) == 0) { + cputc ('.'); + } } } @@ -222,8 +222,8 @@ int main (void) #if defined(__PLUS4__) for (i=0;i<1000;i++) { - ((unsigned char *) (SCREEN1-0x0400))[i] = 0; - ((unsigned char *) (SCREEN2-0x0400))[i] = 0; + ((unsigned char *) (SCREEN1-0x0400))[i] = 0; + ((unsigned char *) (SCREEN2-0x0400))[i] = 0; } outb (&TED.char_addr, CHARADR); #endif @@ -231,23 +231,23 @@ int main (void) /* Run the demo until a key was hit */ t = clock (); while (!kbhit()) { - /* Build page 1, then make it visible */ + /* Build page 1, then make it visible */ doplasma ((unsigned char*)SCREEN1); #if defined(__PLUS4__) - outb (&TED.video_addr, PAGE1); + outb (&TED.video_addr, PAGE1); #else - outb (&VIC.addr, PAGE1); + outb (&VIC.addr, PAGE1); #endif - /* Build page 2, then make it visible */ + /* Build page 2, then make it visible */ doplasma ((unsigned char*)SCREEN2); #if defined(__PLUS4__) - outb (&TED.video_addr, PAGE2); + outb (&TED.video_addr, PAGE2); #else - outb (&VIC.addr, PAGE2); + outb (&VIC.addr, PAGE2); #endif - /* Count frames */ + /* Count frames */ f += 2; } t = clock() - t; diff --git a/samples/sieve.c b/samples/sieve.c index a82e972c9..9ecbab020 100644 --- a/samples/sieve.c +++ b/samples/sieve.c @@ -13,27 +13,27 @@ /* Workaround missing clock stuff */ #if defined(__APPLE2__) || defined(__APPLE2ENH__) -# define clock() 0 -# define CLOCKS_PER_SEC 1 +# define clock() 0 +# define CLOCKS_PER_SEC 1 #endif /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -#define COUNT 16384 /* Up to what number? */ -#define SQRT_COUNT 128 /* Sqrt of COUNT */ +#define COUNT 16384 /* Up to what number? */ +#define SQRT_COUNT 128 /* Sqrt of COUNT */ static unsigned char Sieve[COUNT]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -59,8 +59,8 @@ int main (void) /* This is an example where register variables make sense */ register unsigned char* S; - register unsigned I; - register unsigned J; + register unsigned I; + register unsigned J; /* Output a header */ printf ("Sieve benchmark - calculating primes\n"); @@ -73,17 +73,17 @@ int main (void) /* Execute the sieve */ I = 2; while (I < SQRT_COUNT) { - if (Sieve[I] == 0) { - /* Prime number - mark multiples */ + if (Sieve[I] == 0) { + /* Prime number - mark multiples */ J = I*2; - S = &Sieve[J]; - while (J < COUNT) { - *S = 1; - S += I; - J += I; - } - } - ++I; + S = &Sieve[J]; + while (J < COUNT) { + *S = 1; + S += I; + J += I; + } + } + ++I; } /* Calculate the time used */ @@ -97,11 +97,11 @@ int main (void) /* Wait for a key and print the list if not 'Q' */ if (ReadUpperKey () != 'Q') { - /* Print the result */ + /* Print the result */ J = 0; - for (I = 2; I < COUNT; ++I) { - if (Sieve[I] == 0) { - printf ("%4d\n", I); + for (I = 2; I < COUNT; ++I) { + if (Sieve[I] == 0) { + printf ("%4d\n", I); if (++J == 23) { printf ("Q to quit, any other key continues\n"); if (ReadUpperKey () == 'Q') { @@ -109,11 +109,11 @@ int main (void) } J = 0; } - } - if (kbhit() && ReadUpperKey == 'Q') { - break; - } - } + } + if (kbhit() && ReadUpperKey == 'Q') { + break; + } + } } return EXIT_SUCCESS; diff --git a/samples/tgidemo.c b/samples/tgidemo.c index 3329dd3ca..a7e3b10f6 100644 --- a/samples/tgidemo.c +++ b/samples/tgidemo.c @@ -10,15 +10,15 @@ #ifndef DYN_DRV -# define DYN_DRV 1 +# define DYN_DRV 1 #endif -#define COLOR_BACK TGI_COLOR_BLACK -#define COLOR_FORE TGI_COLOR_WHITE +#define COLOR_BACK TGI_COLOR_BLACK +#define COLOR_FORE TGI_COLOR_WHITE /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -31,7 +31,7 @@ static unsigned AspectRatio; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/samples/tutorial/hello.c b/samples/tutorial/hello.c index 82695c18f..41be9d65e 100644 --- a/samples/tutorial/hello.c +++ b/samples/tutorial/hello.c @@ -1,7 +1,7 @@ #include #include -extern const char text[]; /* In text.s */ +extern const char text[]; /* In text.s */ int main (void) { diff --git a/samples/tutorial/text.s b/samples/tutorial/text.s index 173a4da0d..a72be18b1 100644 --- a/samples/tutorial/text.s +++ b/samples/tutorial/text.s @@ -1,4 +1,4 @@ - .export _text - _text: .asciiz "Hello world!" + .export _text + _text: .asciiz "Hello world!" diff --git a/src/ar65/add.c b/src/ar65/add.c index 1ca0ff14f..cecb89292 100644 --- a/src/ar65/add.c +++ b/src/ar65/add.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* add.c */ +/* add.c */ /* */ -/* Object file adding for the ar65 archiver */ +/* Object file adding for the ar65 archiver */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -55,10 +55,10 @@ void AddObjFiles (int argc, char* argv []) /* Check the argument count */ if (argc <= 0) { - Error ("No library name given"); + Error ("No library name given"); } if (argc <= 1) { - Error ("No object files to add"); + Error ("No object files to add"); } /* Open the library, read the index */ @@ -67,8 +67,8 @@ void AddObjFiles (int argc, char* argv []) /* Add the object files */ I = 1; while (I < argc) { - ObjAdd (argv [I]); - ++I; + ObjAdd (argv [I]); + ++I; } /* Create a new library file and close the old one */ diff --git a/src/ar65/add.h b/src/ar65/add.h index 38bf8682a..abaf017b6 100644 --- a/src/ar65/add.h +++ b/src/ar65/add.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* add.h */ +/* add.h */ /* */ -/* Object file adding for the ar65 archiver */ +/* Object file adding for the ar65 archiver */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ar65/del.c b/src/ar65/del.c index a94be258f..d95c012f9 100644 --- a/src/ar65/del.c +++ b/src/ar65/del.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* del.h */ +/* del.h */ /* */ -/* Object file deleting for the ar65 archiver */ +/* Object file deleting for the ar65 archiver */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -55,10 +55,10 @@ void DelObjFiles (int argc, char* argv []) /* Check the argument count */ if (argc <= 0) { - Error ("No library name given"); + Error ("No library name given"); } if (argc <= 1) { - Error ("No modules to delete"); + Error ("No modules to delete"); } /* Open the library, read the index */ @@ -67,9 +67,9 @@ void DelObjFiles (int argc, char* argv []) /* Delete the modules */ I = 1; while (I < argc) { - /* Delete the module from the list */ - DelObjData (argv [I]); - ++I; + /* Delete the module from the list */ + DelObjData (argv [I]); + ++I; } /* Create a new library file and close the old one */ diff --git a/src/ar65/del.h b/src/ar65/del.h index 18f6c3cc0..f25672609 100644 --- a/src/ar65/del.h +++ b/src/ar65/del.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* del.h */ +/* del.h */ /* */ -/* Object file deleting for the ar65 archiver */ +/* Object file deleting for the ar65 archiver */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -49,7 +49,7 @@ void DelObjFiles (int argc, char* argv []); -/* End of del.h */ +/* End of del.h */ #endif diff --git a/src/ar65/error.c b/src/ar65/error.c index 26e5619ee..d21c9e9b7 100644 --- a/src/ar65/error.c +++ b/src/ar65/error.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ -/* Error handling for the ar65 archiver */ +/* Error handling for the ar65 archiver */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ar65/error.h b/src/ar65/error.h index f7a5122e6..abff5bd2a 100644 --- a/src/ar65/error.h +++ b/src/ar65/error.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ -/* Error handling for the ar65 archiver */ +/* Error handling for the ar65 archiver */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ar65/exports.c b/src/ar65/exports.c index 8f74c670f..75a1986e8 100644 --- a/src/ar65/exports.c +++ b/src/ar65/exports.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* exports.c */ +/* exports.c */ /* */ -/* Duplicate export checking for the ar65 archiver */ +/* Duplicate export checking for the ar65 archiver */ /* */ /* */ /* */ @@ -48,7 +48,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -56,19 +56,19 @@ /* A hash table entry */ typedef struct HashEntry HashEntry; struct HashEntry { - HashEntry* Next; /* Next in list */ - const ObjData* Module; /* Pointer to object module */ - char Name [1]; /* Name of identifier */ + HashEntry* Next; /* Next in list */ + const ObjData* Module; /* Pointer to object module */ + char Name [1]; /* Name of identifier */ }; /* Hash table */ -#define HASHTAB_SIZE 4783 -static HashEntry* HashTab [HASHTAB_SIZE]; +#define HASHTAB_SIZE 4783 +static HashEntry* HashTab [HASHTAB_SIZE]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -83,8 +83,8 @@ static HashEntry* NewHashEntry (const char* Name, const ObjData* Module) HashEntry* H = xmalloc (sizeof (HashEntry) + Len); /* Initialize the fields and return it */ - H->Next = 0; - H->Module = Module; + H->Next = 0; + H->Module = Module; memcpy (H->Name, Name, Len); H->Name [Len] = '\0'; return H; @@ -105,23 +105,23 @@ void ExpInsert (const char* Name, const ObjData* Module) /* Search through the list in that slot and print matching duplicates */ if (HashTab [HashVal] == 0) { - /* The slot is empty */ - HashTab [HashVal] = H; - return; + /* The slot is empty */ + HashTab [HashVal] = H; + return; } L = HashTab [HashVal]; while (1) { - if (strcmp (L->Name, Name) == 0) { - /* Duplicate entry */ - Warning ("External symbol `%s' in module `%s', library `%s' " + if (strcmp (L->Name, Name) == 0) { + /* Duplicate entry */ + Warning ("External symbol `%s' in module `%s', library `%s' " "is duplicated in module `%s'", - Name, L->Name, LibName, Module->Name); - } - if (L->Next == 0) { - break; - } else { - L = L->Next; - } + Name, L->Name, LibName, Module->Name); + } + if (L->Next == 0) { + break; + } else { + L = L->Next; + } } L->Next = H; } @@ -137,11 +137,11 @@ const ObjData* ExpFind (const char* Name) HashEntry* L = HashTab [HashStr (Name) % HASHTAB_SIZE]; while (L) { /* Search through the list in that slot */ - if (strcmp (L->Name, Name) == 0) { - /* Entry found */ - return L->Module; - } - L = L->Next; + if (strcmp (L->Name, Name) == 0) { + /* Entry found */ + return L->Module; + } + L = L->Next; } /* Not found */ diff --git a/src/ar65/exports.h b/src/ar65/exports.h index 1ac30edf3..272b19d63 100644 --- a/src/ar65/exports.h +++ b/src/ar65/exports.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* exports.h */ +/* exports.h */ /* */ -/* Duplicate export checking for the ar65 archiver */ +/* Duplicate export checking for the ar65 archiver */ /* */ /* */ /* */ @@ -49,7 +49,7 @@ struct ObjData; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ar65/extract.c b/src/ar65/extract.c index e6769f76f..43d7c5b3b 100644 --- a/src/ar65/extract.c +++ b/src/ar65/extract.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* extract.c */ +/* extract.c */ /* */ -/* Object file extraction for the ar65 archiver */ +/* Object file extraction for the ar65 archiver */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -55,10 +55,10 @@ void ExtractObjFiles (int argc, char* argv []) /* Check the argument count */ if (argc <= 0) { - Error ("No library name given"); + Error ("No library name given"); } if (argc <= 1) { - Error ("No object files to extract"); + Error ("No object files to extract"); } /* Open the library, read the index */ @@ -67,8 +67,8 @@ void ExtractObjFiles (int argc, char* argv []) /* Extract the object files */ I = 1; while (I < argc) { - ObjExtract (argv [I]); - ++I; + ObjExtract (argv [I]); + ++I; } /* Create a new library file and close the old one */ diff --git a/src/ar65/extract.h b/src/ar65/extract.h index c413fd8bc..705d2c8e1 100644 --- a/src/ar65/extract.h +++ b/src/ar65/extract.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* extract.h */ +/* extract.h */ /* */ -/* Object file extraction for the ar65 archiver */ +/* Object file extraction for the ar65 archiver */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ar65/fileio.c b/src/ar65/fileio.c index b4c6b4aec..0bd925f15 100644 --- a/src/ar65/fileio.c +++ b/src/ar65/fileio.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fileio.c */ +/* fileio.c */ /* */ -/* File I/O for the ar65 archiver */ +/* File I/O for the ar65 archiver */ /* */ /* */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -54,7 +54,7 @@ void Write8 (FILE* F, unsigned char Val) /* Write an 8 bit value to the file */ { if (putc (Val, F) == EOF) { - Error ("Write error (disk full?)"); + Error ("Write error (disk full?)"); } } @@ -89,12 +89,12 @@ void WriteVar (FILE* F, unsigned long V) * needing 5 bytes if a 32 bit value is written to file. */ do { - unsigned char C = (V & 0x7F); - V >>= 7; - if (V) { - C |= 0x80; - } - Write8 (F, C); + unsigned char C = (V & 0x7F); + V >>= 7; + if (V) { + C |= 0x80; + } + Write8 (F, C); } while (V != 0); } @@ -114,7 +114,7 @@ void WriteData (FILE* F, const void* Data, unsigned Size) /* Write data to the file */ { if (fwrite (Data, 1, Size, F) != Size) { - Error ("Write error (disk full?)"); + Error ("Write error (disk full?)"); } } @@ -125,7 +125,7 @@ unsigned Read8 (FILE* F) { int C = getc (F); if (C == EOF) { - Error ("Read error (file corrupt?)"); + Error ("Read error (file corrupt?)"); } return C; } @@ -162,12 +162,12 @@ unsigned long ReadVar (FILE* F) unsigned long V = 0; unsigned Shift = 0; do { - /* Read one byte */ - C = Read8 (F); - /* Encode it into the target value */ - V |= ((unsigned long)(C & 0x7F)) << Shift; - /* Next value */ - Shift += 7; + /* Read one byte */ + C = Read8 (F); + /* Encode it into the target value */ + V |= ((unsigned long)(C & 0x7F)) << Shift; + /* Next value */ + Shift += 7; } while (C & 0x80); /* Return the value read */ @@ -197,7 +197,7 @@ void* ReadData (FILE* F, void* Data, unsigned Size) /* Read data from the file */ { if (fread (Data, 1, Size, F) != Size) { - Error ("Read error (file corrupt?)"); + Error ("Read error (file corrupt?)"); } return Data; } diff --git a/src/ar65/fileio.h b/src/ar65/fileio.h index 3a636e987..0c69f7c13 100644 --- a/src/ar65/fileio.h +++ b/src/ar65/fileio.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fileio.h */ +/* fileio.h */ /* */ -/* File I/O for the ar65 archiver */ +/* File I/O for the ar65 archiver */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ar65/global.c b/src/ar65/global.c index 459dc83e7..02157f08b 100644 --- a/src/ar65/global.c +++ b/src/ar65/global.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ -/* Global variables for the ar65 archiver */ +/* Global variables for the ar65 archiver */ /* */ /* */ /* */ @@ -38,7 +38,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/ar65/global.h b/src/ar65/global.h index c8021be86..f35452d5c 100644 --- a/src/ar65/global.h +++ b/src/ar65/global.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ -/* Global variables for the ar65 archiver */ +/* Global variables for the ar65 archiver */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/ar65/library.c b/src/ar65/library.c index c7c9e02c2..9fdbf9e91 100644 --- a/src/ar65/library.c +++ b/src/ar65/library.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* library.c */ +/* library.c */ /* */ -/* Library data structures and helpers for the ar65 archiver */ +/* Library data structures and helpers for the ar65 archiver */ /* */ /* */ /* */ @@ -56,20 +56,20 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Name of the library file */ -const char* LibName = 0; +const char* LibName = 0; /* File descriptor for the library file */ -FILE* NewLib = 0; -static FILE* Lib = 0; +FILE* NewLib = 0; +static FILE* Lib = 0; /* The library header */ -static LibHeader Header = { +static LibHeader Header = { LIB_MAGIC, LIB_VERSION, 0, @@ -79,7 +79,7 @@ static LibHeader Header = { /*****************************************************************************/ -/* Writing file data structures */ +/* Writing file data structures */ /*****************************************************************************/ @@ -93,11 +93,11 @@ static void ReadHeader (void) /* Read the header fields, checking magic and version */ Header.Magic = Read32 (Lib); if (Header.Magic != LIB_MAGIC) { - Error ("`%s' is not a valid library file", LibName); + Error ("`%s' is not a valid library file", LibName); } Header.Version = Read16 (Lib); if (Header.Version != LIB_VERSION) { - Error ("Wrong data version in `%s'", LibName); + Error ("Wrong data version in `%s'", LibName); } Header.Flags = Read16 (Lib); Header.IndexOffs = Read32 (Lib); @@ -109,7 +109,7 @@ static void ReadIndexEntry (void) /* Read one entry in the index */ { /* Create a new entry and insert it into the list */ - ObjData* O = NewObjData (); + ObjData* O = NewObjData (); /* Module name/flags/MTime/Start/Size */ O->Name = ReadStr (Lib); @@ -134,7 +134,7 @@ static void ReadIndex (void) /* Read all entries in the index */ while (Count--) { - ReadIndexEntry (); + ReadIndexEntry (); } /* Read basic object file data from the actual entries */ @@ -151,7 +151,7 @@ static void ReadIndex (void) /*****************************************************************************/ -/* Writing file data structures */ +/* Writing file data structures */ /*****************************************************************************/ @@ -200,14 +200,14 @@ static void WriteIndex (void) /* Write the object files */ for (I = 0; I < CollCount (&ObjPool); ++I) { - WriteIndexEntry (CollConstAt (&ObjPool, I)); + WriteIndexEntry (CollConstAt (&ObjPool, I)); } } /*****************************************************************************/ -/* High level stuff */ +/* High level stuff */ /*****************************************************************************/ @@ -225,32 +225,32 @@ void LibOpen (const char* Name, int MustExist, int NeedTemp) Lib = fopen (Name, "rb"); if (Lib == 0) { - /* File does not exist */ - if (MustExist) { - Error ("Library `%s' does not exist", Name); - } else { - Warning ("Library `%s' not found - will be created", Name); - } + /* File does not exist */ + if (MustExist) { + Error ("Library `%s' does not exist", Name); + } else { + Warning ("Library `%s' not found - will be created", Name); + } } else { /* We have an existing file: Read the header */ - ReadHeader (); + ReadHeader (); - /* Now read the existing index */ - ReadIndex (); + /* Now read the existing index */ + ReadIndex (); } if (NeedTemp) { - /* Create the temporary library */ - NewLib = tmpfile (); - if (NewLib == 0) { - Error ("Cannot create temporary file: %s", strerror (errno)); - } + /* Create the temporary library */ + NewLib = tmpfile (); + if (NewLib == 0) { + Error ("Cannot create temporary file: %s", strerror (errno)); + } - /* Write a dummy header to the temp file */ - WriteHeader (); + /* Write a dummy header to the temp file */ + WriteHeader (); } } @@ -268,10 +268,10 @@ unsigned long LibCopyTo (FILE* F, unsigned long Bytes) /* Copy loop */ while (Bytes) { - unsigned Count = (Bytes > sizeof (Buf))? sizeof (Buf) : Bytes; - ReadData (F, Buf, Count); - WriteData (NewLib, Buf, Count); - Bytes -= Count; + unsigned Count = (Bytes > sizeof (Buf))? sizeof (Buf) : Bytes; + ReadData (F, Buf, Count); + WriteData (NewLib, Buf, Count); + Bytes -= Count; } /* Return the start position */ @@ -290,10 +290,10 @@ void LibCopyFrom (unsigned long Pos, unsigned long Bytes, FILE* F) /* Copy loop */ while (Bytes) { - unsigned Count = (Bytes > sizeof (Buf))? sizeof (Buf) : Bytes; - ReadData (Lib, Buf, Count); - WriteData (F, Buf, Count); - Bytes -= Count; + unsigned Count = (Bytes > sizeof (Buf))? sizeof (Buf) : Bytes; + ReadData (Lib, Buf, Count); + WriteData (F, Buf, Count); + Bytes -= Count; } } @@ -313,11 +313,11 @@ static void LibCheckExports (ObjData* O) for (I = 0; I < CollCount (&O->Exports); ++I) { /* Get the name of the export */ - const char* Name = CollConstAt (&O->Exports, I); + const char* Name = CollConstAt (&O->Exports, I); - /* Insert the name into the hash table */ - Print (stdout, 1, " %s\n", Name); - ExpInsert (Name, O); + /* Insert the name into the hash table */ + Print (stdout, 1, " %s\n", Name); + ExpInsert (Name, O); } } @@ -331,65 +331,65 @@ void LibClose (void) /* Do we have a temporary library? */ if (NewLib) { - unsigned I; - unsigned char Buf [4096]; - size_t Count; + unsigned I; + unsigned char Buf [4096]; + size_t Count; /* Walk through the object file list, inserting exports into the - * export list checking for duplicates. Copy any data that is still - * in the old library into the new one. - */ - for (I = 0; I < CollCount (&ObjPool); ++I) { + * export list checking for duplicates. Copy any data that is still + * in the old library into the new one. + */ + for (I = 0; I < CollCount (&ObjPool); ++I) { - /* Get a pointer to the object */ - ObjData* O = CollAtUnchecked (&ObjPool, I); + /* Get a pointer to the object */ + ObjData* O = CollAtUnchecked (&ObjPool, I); - /* Check exports, make global export table */ - LibCheckExports (O); + /* Check exports, make global export table */ + LibCheckExports (O); - /* Copy data if needed */ - if ((O->Flags & OBJ_HAVEDATA) == 0) { - /* Data is still in the old library */ - fseek (Lib, O->Start, SEEK_SET); - O->Start = ftell (NewLib); - LibCopyTo (Lib, O->Size); - O->Flags |= OBJ_HAVEDATA; - } - } + /* Copy data if needed */ + if ((O->Flags & OBJ_HAVEDATA) == 0) { + /* Data is still in the old library */ + fseek (Lib, O->Start, SEEK_SET); + O->Start = ftell (NewLib); + LibCopyTo (Lib, O->Size); + O->Flags |= OBJ_HAVEDATA; + } + } - /* Write the index */ - WriteIndex (); + /* Write the index */ + WriteIndex (); - /* Write the updated header */ - WriteHeader (); + /* Write the updated header */ + WriteHeader (); - /* Close the file */ - if (Lib && fclose (Lib) != 0) { - Error ("Error closing library: %s", strerror (errno)); - } + /* Close the file */ + if (Lib && fclose (Lib) != 0) { + Error ("Error closing library: %s", strerror (errno)); + } - /* Reopen the library and truncate it */ - Lib = fopen (LibName, "wb"); - if (Lib == 0) { - Error ("Cannot open library `%s' for writing: %s", - LibName, strerror (errno)); - } + /* Reopen the library and truncate it */ + Lib = fopen (LibName, "wb"); + if (Lib == 0) { + Error ("Cannot open library `%s' for writing: %s", + LibName, strerror (errno)); + } - /* Copy the new library to the new one */ - fseek (NewLib, 0, SEEK_SET); - while ((Count = fread (Buf, 1, sizeof (Buf), NewLib)) != 0) { - if (fwrite (Buf, 1, Count, Lib) != Count) { - Error ("Cannot write to `%s': %s", LibName, strerror (errno)); - } - } + /* Copy the new library to the new one */ + fseek (NewLib, 0, SEEK_SET); + while ((Count = fread (Buf, 1, sizeof (Buf), NewLib)) != 0) { + if (fwrite (Buf, 1, Count, Lib) != Count) { + Error ("Cannot write to `%s': %s", LibName, strerror (errno)); + } + } } /* Close both files */ if (Lib && fclose (Lib) != 0) { - Error ("Problem closing `%s': %s", LibName, strerror (errno)); + Error ("Problem closing `%s': %s", LibName, strerror (errno)); } if (NewLib && fclose (NewLib) != 0) { - Error ("Problem closing temporary library file: %s", strerror (errno)); + Error ("Problem closing temporary library file: %s", strerror (errno)); } } diff --git a/src/ar65/library.h b/src/ar65/library.h index 09a489478..abb8c475f 100644 --- a/src/ar65/library.h +++ b/src/ar65/library.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* library.h */ +/* library.h */ /* */ -/* Library data structures and helpers for the ar65 archiver */ +/* Library data structures and helpers for the ar65 archiver */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -52,12 +52,12 @@ extern const char* LibName; /* File descriptor for the new library file */ -extern FILE* NewLib; +extern FILE* NewLib; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ar65/list.c b/src/ar65/list.c index a1132517f..a3536c7d2 100644 --- a/src/ar65/list.c +++ b/src/ar65/list.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* list.c */ +/* list.c */ /* */ -/* Module listing for the ar65 archiver */ +/* Module listing for the ar65 archiver */ /* */ /* */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -58,10 +58,10 @@ void ListObjFiles (int argc, char* argv []) /* Check the argument count */ if (argc <= 0) { - Error ("No library name given"); + Error ("No library name given"); } if (argc > 2) { - Error ("Too many arguments"); + Error ("Too many arguments"); } /* Open the library, read the index */ @@ -74,7 +74,7 @@ void ListObjFiles (int argc, char* argv []) O = CollConstAt (&ObjPool, I); /* Print the name */ - printf ("%s\n", O->Name); + printf ("%s\n", O->Name); } diff --git a/src/ar65/list.h b/src/ar65/list.h index 09ac5080e..ea6a62512 100644 --- a/src/ar65/list.h +++ b/src/ar65/list.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* list.h */ +/* list.h */ /* */ -/* Module listing for the ar65 archiver */ +/* Module listing for the ar65 archiver */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ar65/main.c b/src/ar65/main.c index 5af84ad0e..cf3c428f5 100644 --- a/src/ar65/main.c +++ b/src/ar65/main.c @@ -1,34 +1,34 @@ /*****************************************************************************/ -/* */ -/* main.c */ -/* */ -/* Main program for the ar65 archiver */ -/* */ -/* */ -/* */ +/* */ +/* main.c */ +/* */ +/* Main program for the ar65 archiver */ +/* */ +/* */ +/* */ /* (C) 1998-2012, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -52,7 +52,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -83,54 +83,54 @@ int main (int argc, char* argv []) /* We must have a file name */ if (ArgCount < 2) { - Usage (); + Usage (); } /* Check the parameters */ I = 1; while (I < ArgCount) { - /* Get the argument */ - const char* Arg = ArgVec [I]; + /* Get the argument */ + const char* Arg = ArgVec [I]; - /* Check for an option */ - if (strlen (Arg) != 1) { - Usage (); - } - switch (Arg [0]) { + /* Check for an option */ + if (strlen (Arg) != 1) { + Usage (); + } + switch (Arg [0]) { - case 'a': - AddObjFiles (ArgCount - I - 1, &ArgVec[I+1]); - break; + case 'a': + AddObjFiles (ArgCount - I - 1, &ArgVec[I+1]); + break; - case 'd': - DelObjFiles (ArgCount - I - 1, &ArgVec [I+1]); - break; + case 'd': + DelObjFiles (ArgCount - I - 1, &ArgVec [I+1]); + break; - case 'l': - ListObjFiles (ArgCount - I - 1, &ArgVec [I+1]); - break; + case 'l': + ListObjFiles (ArgCount - I - 1, &ArgVec [I+1]); + break; - case 'v': - ++Verbosity; - break; + case 'v': + ++Verbosity; + break; - case 'x': - ExtractObjFiles (ArgCount - I - 1, &ArgVec [I+1]); - break; + case 'x': + ExtractObjFiles (ArgCount - I - 1, &ArgVec [I+1]); + break; - case 'V': - fprintf (stderr, "ar65 V%s\n", GetVersionAsString ()); - break; + case 'V': + fprintf (stderr, "ar65 V%s\n", GetVersionAsString ()); + break; - default: - fprintf (stderr, "Unknown option: %s\n", Arg); - Usage (); + default: + fprintf (stderr, "Unknown option: %s\n", Arg); + Usage (); - } + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Return an apropriate exit code */ diff --git a/src/ar65/objdata.c b/src/ar65/objdata.c index b22ad023a..b419fac4d 100644 --- a/src/ar65/objdata.c +++ b/src/ar65/objdata.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objdata.c */ +/* objdata.c */ /* */ -/* Handling object file data for the ar65 archiver */ +/* Handling object file data for the ar65 archiver */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,7 +58,7 @@ Collection ObjPool = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -70,12 +70,12 @@ ObjData* NewObjData (void) ObjData* O = xmalloc (sizeof (ObjData)); /* Initialize the data */ - O->Name = 0; + O->Name = 0; - O->Flags = 0; - O->MTime = 0; - O->Start = 0; - O->Size = 0; + O->Flags = 0; + O->MTime = 0; + O->Start = 0; + O->Size = 0; O->Strings = EmptyCollection; O->Exports = EmptyCollection; @@ -134,9 +134,9 @@ ObjData* FindObjData (const char* Module) ObjData* O = CollAtUnchecked (&ObjPool, I); /* Did we find it? */ - if (strcmp (O->Name, Module) == 0) { - return O; - } + if (strcmp (O->Name, Module) == 0) { + return O; + } } return 0; } @@ -153,15 +153,15 @@ void DelObjData (const char* Module) ObjData* O = CollAtUnchecked (&ObjPool, I); /* Did we find it? */ - if (strcmp (O->Name, Module) == 0) { + if (strcmp (O->Name, Module) == 0) { - /* Free the entry */ + /* Free the entry */ CollDelete (&ObjPool, I); - FreeObjData (O); + FreeObjData (O); - /* Done */ - return; - } + /* Done */ + return; + } } /* Not found! */ diff --git a/src/ar65/objdata.h b/src/ar65/objdata.h index 5d191339b..52e175e84 100644 --- a/src/ar65/objdata.h +++ b/src/ar65/objdata.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objdata.h */ +/* objdata.h */ /* */ -/* Handling object file data for the ar65 archiver */ +/* Handling object file data for the ar65 archiver */ /* */ /* */ /* */ @@ -45,32 +45,32 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Values for the Flags field */ -#define OBJ_HAVEDATA 0x0001 /* The object data is in the tmp file */ +#define OBJ_HAVEDATA 0x0001 /* The object data is in the tmp file */ /* Internal structure holding object file data */ typedef struct ObjData ObjData; struct ObjData { - char* Name; /* Module name */ + char* Name; /* Module name */ /* Index entry */ - unsigned Flags; - unsigned long MTime; /* Modifiation time of object file */ - unsigned long Start; /* Start offset of data in library */ - unsigned long Size; /* Size of data in library */ + unsigned Flags; + unsigned long MTime; /* Modifiation time of object file */ + unsigned long Start; /* Start offset of data in library */ + unsigned long Size; /* Size of data in library */ /* Object file header */ ObjHeader Header; /* Basic data needed for simple checks */ Collection Strings; /* Strings from the object file */ - Collection Exports; /* Exports list from object file */ + Collection Exports; /* Exports list from object file */ }; @@ -81,7 +81,7 @@ extern Collection ObjPool; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ar65/objfile.c b/src/ar65/objfile.c index b4560bee8..4f937a5de 100644 --- a/src/ar65/objfile.c +++ b/src/ar65/objfile.c @@ -1,34 +1,34 @@ /*****************************************************************************/ -/* */ -/* objfile.c */ -/* */ -/* Object file handling for the ar65 archiver */ -/* */ -/* */ -/* */ +/* */ +/* objfile.c */ +/* */ +/* Object file handling for the ar65 archiver */ +/* */ +/* */ +/* */ /* (C) 1998-2012, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -55,7 +55,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -68,7 +68,7 @@ static const char* GetModule (const char* Name) /* Must not end with a path separator */ if (*Module == 0) { - Error ("Cannot make module name from `%s'", Name); + Error ("Cannot make module name from `%s'", Name); } /* Done */ @@ -80,21 +80,21 @@ static const char* GetModule (const char* Name) static void ObjReadHeader (FILE* Obj, ObjHeader* H, const char* Name) /* Read the header of the object file checking the signature */ { - H->Magic = Read32 (Obj); + H->Magic = Read32 (Obj); if (H->Magic != OBJ_MAGIC) { - Error ("`%s' is not an object file", Name); + Error ("`%s' is not an object file", Name); } - H->Version = Read16 (Obj); + H->Version = Read16 (Obj); if (H->Version != OBJ_VERSION) { - Error ("Object file `%s' has wrong version", Name); + Error ("Object file `%s' has wrong version", Name); } - H->Flags = Read16 (Obj); + H->Flags = Read16 (Obj); H->OptionOffs = Read32 (Obj); H->OptionSize = Read32 (Obj); H->FileOffs = Read32 (Obj); H->FileSize = Read32 (Obj); - H->SegOffs = Read32 (Obj); - H->SegSize = Read32 (Obj); + H->SegOffs = Read32 (Obj); + H->SegSize = Read32 (Obj); H->ImportOffs = Read32 (Obj); H->ImportSize = Read32 (Obj); H->ExportOffs = Read32 (Obj); @@ -124,23 +124,23 @@ static void SkipExpr (FILE* F) /* Handle then different expression nodes */ switch (Op) { - case EXPR_NULL: - break; + case EXPR_NULL: + break; case EXPR_LITERAL: - /* 32 bit literal value */ - (void) Read32 (F); - break; + /* 32 bit literal value */ + (void) Read32 (F); + break; case EXPR_SYMBOL: - /* Variable seized symbol index */ - (void) ReadVar (F); - break; + /* Variable seized symbol index */ + (void) ReadVar (F); + break; case EXPR_SECTION: - /* 8 bit segment number */ - (void) Read8 (F); - break; + /* 8 bit segment number */ + (void) Read8 (F); + break; default: /* What's left are unary and binary nodes */ @@ -236,7 +236,7 @@ void ObjAdd (const char* Name) /* Open the object file */ FILE* Obj = fopen (Name, "rb"); if (Obj == 0) { - Error ("Could not open `%s': %s", Name, strerror (errno)); + Error ("Could not open `%s': %s", Name, strerror (errno)); } /* Get the modification time of the object file. There a race condition @@ -248,7 +248,7 @@ void ObjAdd (const char* Name) * here. */ if (FileStat (Name, &StatBuf) != 0) { - Error ("Cannot stat object file `%s': %s", Name, strerror (errno)); + Error ("Cannot stat object file `%s': %s", Name, strerror (errno)); } /* Read and check the header */ @@ -260,16 +260,16 @@ void ObjAdd (const char* Name) /* Check if we already have a module with this name */ O = FindObjData (Module); if (O == 0) { - /* Not found, create a new entry */ - O = NewObjData (); + /* Not found, create a new entry */ + O = NewObjData (); } else { - /* Found - check the file modification times of the internal copy - * and the external one. - */ - if (difftime ((time_t)O->MTime, StatBuf.st_mtime) > 0.0) { - Warning ("Replacing module `%s' by older version in library `%s'", + /* Found - check the file modification times of the internal copy + * and the external one. + */ + if (difftime ((time_t)O->MTime, StatBuf.st_mtime) > 0.0) { + Warning ("Replacing module `%s' by older version in library `%s'", O->Name, LibName); - } + } /* Free data */ ClearObjData (O); @@ -277,8 +277,8 @@ void ObjAdd (const char* Name) /* Initialize the object module data structure */ O->Name = xstrdup (Module); - O->Flags = OBJ_HAVEDATA; - O->MTime = (unsigned long) StatBuf.st_mtime; + O->Flags = OBJ_HAVEDATA; + O->MTime = (unsigned long) StatBuf.st_mtime; O->Start = 0; /* Determine the file size. Note: Race condition here */ @@ -313,13 +313,13 @@ void ObjExtract (const char* Name) /* Bail out if the module does not exist */ if (O == 0) { - Error ("Module `%s' not found in library `%s'", Module, LibName); + Error ("Module `%s' not found in library `%s'", Module, LibName); } /* Open the output file */ Obj = fopen (Name, "w+b"); if (Obj == 0) { - Error ("Cannot open target file `%s': %s", Name, strerror (errno)); + Error ("Cannot open target file `%s': %s", Name, strerror (errno)); } /* Copy the complete object file data from the library to the new object @@ -329,12 +329,12 @@ void ObjExtract (const char* Name) /* Close the file */ if (fclose (Obj) != 0) { - Error ("Problem closing object file `%s': %s", Name, strerror (errno)); + Error ("Problem closing object file `%s': %s", Name, strerror (errno)); } /* Set access and modification time */ if (SetFileTimes (Name, O->MTime) != 0) { - Error ("Cannot set mod time on `%s': %s", Name, strerror (errno)); + Error ("Cannot set mod time on `%s': %s", Name, strerror (errno)); } } diff --git a/src/ar65/objfile.h b/src/ar65/objfile.h index a1db14e82..3f24c7c50 100644 --- a/src/ar65/objfile.h +++ b/src/ar65/objfile.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objfile.h */ +/* objfile.h */ /* */ -/* Object file handling for the ar65 archiver */ +/* Object file handling for the ar65 archiver */ /* */ /* */ /* */ @@ -53,7 +53,7 @@ struct ObjData; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/anonname.c b/src/ca65/anonname.c index 3a24381f0..d01ae2aa1 100644 --- a/src/ca65/anonname.c +++ b/src/ca65/anonname.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* anonname.c */ +/* anonname.c */ /* */ /* Create names for anonymous scopes/variables/types */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -52,7 +52,7 @@ static const char AnonTag[] = "$anon"; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/anonname.h b/src/ca65/anonname.h index bce9126a3..bfefc05b5 100644 --- a/src/ca65/anonname.h +++ b/src/ca65/anonname.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* anonname.h */ +/* anonname.h */ /* */ /* Create names for anonymous scopes/variables/types */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/asserts.c b/src/ca65/asserts.c index 84b2621c7..a1a61a117 100644 --- a/src/ca65/asserts.c +++ b/src/ca65/asserts.c @@ -48,7 +48,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -68,7 +68,7 @@ static Collection Assertions = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/asserts.h b/src/ca65/asserts.h index fe1925e3c..f860a1af3 100644 --- a/src/ca65/asserts.h +++ b/src/ca65/asserts.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -55,7 +55,7 @@ struct ExprNode; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/condasm.c b/src/ca65/condasm.c index a14bbc2f6..8be5cb687 100644 --- a/src/ca65/condasm.c +++ b/src/ca65/condasm.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* condasm.c */ +/* condasm.c */ /* */ -/* Conditional assembly support for ca65 */ +/* Conditional assembly support for ca65 */ /* */ /* */ /* */ @@ -46,21 +46,21 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Maximum count of nested .ifs */ -#define MAX_IFS 256 +#define MAX_IFS 256 /* Set of bitmapped flags for the if descriptor */ enum { - ifNone = 0x0000, /* No flag */ - ifCond = 0x0001, /* IF condition was true */ + ifNone = 0x0000, /* No flag */ + ifCond = 0x0001, /* IF condition was true */ ifParentCond= 0x0002, /* IF condition of parent */ - ifElse = 0x0004, /* We had a .ELSE branch */ - ifNeedTerm = 0x0008, /* Need .ENDIF termination */ + ifElse = 0x0004, /* We had a .ELSE branch */ + ifNeedTerm = 0x0008, /* Need .ENDIF termination */ }; /* The overall .IF condition */ @@ -69,7 +69,7 @@ int IfCond = 1; /*****************************************************************************/ -/* struct IfDesc */ +/* struct IfDesc */ /*****************************************************************************/ @@ -77,9 +77,9 @@ int IfCond = 1; /* One .IF descriptor */ typedef struct IfDesc IfDesc; struct IfDesc { - unsigned Flags; /* Bitmapped flags, see above */ + unsigned Flags; /* Bitmapped flags, see above */ Collection LineInfos; /* File position of the .IF */ - const char* Name; /* Name of the directive */ + const char* Name; /* Name of the directive */ }; /* The .IF stack */ @@ -92,7 +92,7 @@ static IfDesc* GetCurrentIf (void) /* Return the current .IF descriptor */ { if (IfCount == 0) { - return 0; + return 0; } else { return &IfStack[IfCount-1]; } @@ -125,9 +125,9 @@ static void SetIfCond (IfDesc* ID, int C) /* Set the .IF condition */ { if (C) { - ID->Flags |= ifCond; + ID->Flags |= ifCond; } else { - ID->Flags &= ~ifCond; + ID->Flags &= ~ifCond; } } @@ -162,7 +162,7 @@ static IfDesc* AllocIf (const char* Directive, int NeedTerm) /* Check for stack overflow */ if (IfCount >= MAX_IFS) { - Fatal ("Too many nested .IFs"); + Fatal ("Too many nested .IFs"); } /* Get the next element */ @@ -192,23 +192,23 @@ static void FreeIf (void) { int Done; do { - IfDesc* ID = GetCurrentIf(); - if (ID == 0) { - Error (" Unexpected .ENDIF"); - Done = 1; - } else { - Done = (ID->Flags & ifNeedTerm) != 0; + IfDesc* ID = GetCurrentIf(); + if (ID == 0) { + Error (" Unexpected .ENDIF"); + Done = 1; + } else { + Done = (ID->Flags & ifNeedTerm) != 0; ReleaseFullLineInfo (&ID->LineInfos); DoneCollection (&ID->LineInfos); --IfCount; - } + } } while (!Done); } /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -220,10 +220,10 @@ void DoConditionals (void) do { - switch (CurTok.Tok) { + switch (CurTok.Tok) { - case TOK_ELSE: - D = GetCurrentIf (); + case TOK_ELSE: + D = GetCurrentIf (); /* Allow an .ELSE */ ElseClause (D, ".ELSE"); @@ -239,12 +239,12 @@ void DoConditionals (void) CalcOverallIfCond (); /* Skip .ELSE */ - NextTok (); - ExpectSep (); - break; + NextTok (); + ExpectSep (); + break; - case TOK_ELSEIF: - D = GetCurrentIf (); + case TOK_ELSEIF: + D = GetCurrentIf (); /* Handle as if there was an .ELSE first */ ElseClause (D, ".ELSEIF"); @@ -266,172 +266,172 @@ void DoConditionals (void) /* Get the new overall condition */ CalcOverallIfCond (); - break; + break; - case TOK_ENDIF: - /* We're done with this .IF.. - remove the descriptor(s) */ - FreeIf (); + case TOK_ENDIF: + /* We're done with this .IF.. - remove the descriptor(s) */ + FreeIf (); - /* Be sure not to read the next token until the .IF stack - * has been cleanup up, since we may be at end of file. - */ - NextTok (); - ExpectSep (); + /* Be sure not to read the next token until the .IF stack + * has been cleanup up, since we may be at end of file. + */ + NextTok (); + ExpectSep (); - /* Get the new overall condition */ + /* Get the new overall condition */ CalcOverallIfCond (); - break; + break; - case TOK_IF: - D = AllocIf (".IF", 1); - NextTok (); - if (IfCond) { + case TOK_IF: + D = AllocIf (".IF", 1); + NextTok (); + if (IfCond) { SetIfCond (D, ConstExpression ()); ExpectSep (); - } + } CalcOverallIfCond (); - break; + break; - case TOK_IFBLANK: - D = AllocIf (".IFBLANK", 1); - NextTok (); - if (IfCond) { + case TOK_IFBLANK: + D = AllocIf (".IFBLANK", 1); + NextTok (); + if (IfCond) { if (TokIsSep (CurTok.Tok)) { SetIfCond (D, 1); } else { - SetIfCond (D, 0); + SetIfCond (D, 0); SkipUntilSep (); } - } + } CalcOverallIfCond (); - break; + break; - case TOK_IFCONST: - D = AllocIf (".IFCONST", 1); - NextTok (); - if (IfCond) { - ExprNode* Expr = Expression(); - SetIfCond (D, IsConstExpr (Expr, 0)); - FreeExpr (Expr); - ExpectSep (); - } + case TOK_IFCONST: + D = AllocIf (".IFCONST", 1); + NextTok (); + if (IfCond) { + ExprNode* Expr = Expression(); + SetIfCond (D, IsConstExpr (Expr, 0)); + FreeExpr (Expr); + ExpectSep (); + } CalcOverallIfCond (); - break; + break; - case TOK_IFDEF: - D = AllocIf (".IFDEF", 1); - NextTok (); - if (IfCond) { - SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING); - SetIfCond (D, Sym != 0 && SymIsDef (Sym)); - } + case TOK_IFDEF: + D = AllocIf (".IFDEF", 1); + NextTok (); + if (IfCond) { + SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING); + SetIfCond (D, Sym != 0 && SymIsDef (Sym)); + } CalcOverallIfCond (); - break; + break; - case TOK_IFNBLANK: - D = AllocIf (".IFNBLANK", 1); - NextTok (); - if (IfCond) { + case TOK_IFNBLANK: + D = AllocIf (".IFNBLANK", 1); + NextTok (); + if (IfCond) { if (TokIsSep (CurTok.Tok)) { SetIfCond (D, 0); } else { - SetIfCond (D, 1); + SetIfCond (D, 1); SkipUntilSep (); } - } + } CalcOverallIfCond (); - break; + break; - case TOK_IFNCONST: - D = AllocIf (".IFNCONST", 1); - NextTok (); - if (IfCond) { - ExprNode* Expr = Expression(); - SetIfCond (D, !IsConstExpr (Expr, 0)); - FreeExpr (Expr); - ExpectSep (); - } + case TOK_IFNCONST: + D = AllocIf (".IFNCONST", 1); + NextTok (); + if (IfCond) { + ExprNode* Expr = Expression(); + SetIfCond (D, !IsConstExpr (Expr, 0)); + FreeExpr (Expr); + ExpectSep (); + } CalcOverallIfCond (); - break; + break; - case TOK_IFNDEF: - D = AllocIf (".IFNDEF", 1); - NextTok (); - if (IfCond) { - SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING); - SetIfCond (D, Sym == 0 || !SymIsDef (Sym)); - ExpectSep (); - } + case TOK_IFNDEF: + D = AllocIf (".IFNDEF", 1); + NextTok (); + if (IfCond) { + SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING); + SetIfCond (D, Sym == 0 || !SymIsDef (Sym)); + ExpectSep (); + } CalcOverallIfCond (); - break; + break; - case TOK_IFNREF: - D = AllocIf (".IFNREF", 1); - NextTok (); - if (IfCond) { - SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING); - SetIfCond (D, Sym == 0 || !SymIsRef (Sym)); - ExpectSep (); - } + case TOK_IFNREF: + D = AllocIf (".IFNREF", 1); + NextTok (); + if (IfCond) { + SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING); + SetIfCond (D, Sym == 0 || !SymIsRef (Sym)); + ExpectSep (); + } CalcOverallIfCond (); - break; + break; - case TOK_IFP02: - D = AllocIf (".IFP02", 1); - NextTok (); - if (IfCond) { - SetIfCond (D, GetCPU() == CPU_6502); - } - ExpectSep (); + case TOK_IFP02: + D = AllocIf (".IFP02", 1); + NextTok (); + if (IfCond) { + SetIfCond (D, GetCPU() == CPU_6502); + } + ExpectSep (); CalcOverallIfCond (); - break; + break; - case TOK_IFP816: - D = AllocIf (".IFP816", 1); - NextTok (); - if (IfCond) { - SetIfCond (D, GetCPU() == CPU_65816); - } - ExpectSep (); + case TOK_IFP816: + D = AllocIf (".IFP816", 1); + NextTok (); + if (IfCond) { + SetIfCond (D, GetCPU() == CPU_65816); + } + ExpectSep (); CalcOverallIfCond (); - break; + break; - case TOK_IFPC02: - D = AllocIf (".IFPC02", 1); - NextTok (); - if (IfCond) { - SetIfCond (D, GetCPU() == CPU_65C02); - } - ExpectSep (); + case TOK_IFPC02: + D = AllocIf (".IFPC02", 1); + NextTok (); + if (IfCond) { + SetIfCond (D, GetCPU() == CPU_65C02); + } + ExpectSep (); CalcOverallIfCond (); - break; + break; - case TOK_IFPSC02: - D = AllocIf (".IFPSC02", 1); - NextTok (); - if (IfCond) { - SetIfCond (D, GetCPU() == CPU_65SC02); - } - ExpectSep (); + case TOK_IFPSC02: + D = AllocIf (".IFPSC02", 1); + NextTok (); + if (IfCond) { + SetIfCond (D, GetCPU() == CPU_65SC02); + } + ExpectSep (); CalcOverallIfCond (); - break; + break; - case TOK_IFREF: - D = AllocIf (".IFREF", 1); - NextTok (); - if (IfCond) { - SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING); - SetIfCond (D, Sym != 0 && SymIsRef (Sym)); - ExpectSep (); - } + case TOK_IFREF: + D = AllocIf (".IFREF", 1); + NextTok (); + if (IfCond) { + SymEntry* Sym = ParseAnySymName (SYM_FIND_EXISTING); + SetIfCond (D, Sym != 0 && SymIsRef (Sym)); + ExpectSep (); + } CalcOverallIfCond (); - break; + break; - default: - /* Skip tokens */ - NextTok (); + default: + /* Skip tokens */ + NextTok (); - } + } } while (IfCond == 0 && CurTok.Tok != TOK_EOF); } @@ -479,24 +479,24 @@ void CheckOpenIfs (void) const LineInfo* LI; while (1) { - /* Get the current file number and check if the topmost entry on the - * .IF stack was inserted with this file number - */ - IfDesc* D = GetCurrentIf (); - if (D == 0) { - /* There are no open .IFs */ - break; - } + /* Get the current file number and check if the topmost entry on the + * .IF stack was inserted with this file number + */ + IfDesc* D = GetCurrentIf (); + if (D == 0) { + /* There are no open .IFs */ + break; + } LI = CollConstAt (&D->LineInfos, 0); - if (GetSourcePos (LI)->Name != CurTok.Pos.Name) { - /* The .if is from another file, bail out */ - break; - } + if (GetSourcePos (LI)->Name != CurTok.Pos.Name) { + /* The .if is from another file, bail out */ + break; + } - /* Start of .if is in the file we're about to leave */ - LIError (&D->LineInfos, "Conditional assembly branch was never closed"); - FreeIf (); + /* Start of .if is in the file we're about to leave */ + LIError (&D->LineInfos, "Conditional assembly branch was never closed"); + FreeIf (); } /* Calculate the new overall .IF condition */ @@ -517,7 +517,7 @@ void CleanupIfStack (unsigned SP) /* Cleanup the .IF stack, remove anything above the given stack pointer */ { while (IfCount > SP) { - FreeIf (); + FreeIf (); } /* Calculate the new overall .IF condition */ diff --git a/src/ca65/condasm.h b/src/ca65/condasm.h index 4973a622c..3489310d5 100644 --- a/src/ca65/condasm.h +++ b/src/ca65/condasm.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* condasm.h */ +/* condasm.h */ /* */ -/* Conditional assembly support for ca65 */ +/* Conditional assembly support for ca65 */ /* */ /* */ /* */ @@ -50,7 +50,7 @@ extern int IfCond; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/dbginfo.c b/src/ca65/dbginfo.c index aa24b3309..b1b845fc9 100644 --- a/src/ca65/dbginfo.c +++ b/src/ca65/dbginfo.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* dbginfo.c */ +/* dbginfo.c */ /* */ -/* Handle the .dbg commands */ +/* Handle the .dbg commands */ /* */ /* */ /* */ @@ -58,7 +58,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -181,8 +181,8 @@ void DbgInfoFile (void) /* Name */ if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - return; + ErrorSkip ("String constant expected"); + return; } SB_Copy (&Name, &CurTok.SVal); NextTok (); @@ -212,8 +212,8 @@ void DbgInfoFunc (void) /* Parse and handle func subcommand of the .dbg pseudo instruction */ { static const char* StorageKeys[] = { - "EXTERN", - "STATIC", + "EXTERN", + "STATIC", }; unsigned Name; @@ -228,8 +228,8 @@ void DbgInfoFunc (void) /* Name */ if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - return; + ErrorSkip ("String constant expected"); + return; } Name = GetStrBufId (&CurTok.SVal); NextTok (); @@ -239,8 +239,8 @@ void DbgInfoFunc (void) /* Type */ if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - return; + ErrorSkip ("String constant expected"); + return; } Type = ValidateType (&CurTok.SVal); if (Type < 0) { @@ -253,8 +253,8 @@ void DbgInfoFunc (void) /* The storage class follows */ if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Storage class specifier expected"); - return; + ErrorSkip ("Storage class specifier expected"); + return; } switch (GetSubKey (StorageKeys, sizeof (StorageKeys)/sizeof (StorageKeys[0]))) { case 0: Flags = HLL_TYPE_FUNC | HLL_SC_EXTERN; break; @@ -314,7 +314,7 @@ void DbgInfoLine (void) * follow, the last line info is terminated. */ if (CurTok.Tok == TOK_SEP) { - return; + return; } /* Parameters are separated by a comma */ @@ -322,8 +322,8 @@ void DbgInfoLine (void) /* The name of the file follows */ if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - return; + ErrorSkip ("String constant expected"); + return; } /* Get the index in the file table for the name */ @@ -338,8 +338,8 @@ void DbgInfoLine (void) /* Line number */ Line = ConstExpression (); if (Line < 0) { - ErrorSkip ("Line number is out of valid range"); - return; + ErrorSkip ("Line number is out of valid range"); + return; } Pos.Line = Line; @@ -354,9 +354,9 @@ void DbgInfoSym (void) { static const char* StorageKeys[] = { "AUTO", - "EXTERN", + "EXTERN", "REGISTER", - "STATIC", + "STATIC", }; unsigned Name; @@ -372,8 +372,8 @@ void DbgInfoSym (void) /* Name */ if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - return; + ErrorSkip ("String constant expected"); + return; } Name = GetStrBufId (&CurTok.SVal); NextTok (); @@ -383,8 +383,8 @@ void DbgInfoSym (void) /* Type */ if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - return; + ErrorSkip ("String constant expected"); + return; } Type = ValidateType (&CurTok.SVal); if (Type < 0) { @@ -397,8 +397,8 @@ void DbgInfoSym (void) /* The storage class follows */ if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Storage class specifier expected"); - return; + ErrorSkip ("Storage class specifier expected"); + return; } switch (GetSubKey (StorageKeys, sizeof (StorageKeys)/sizeof (StorageKeys[0]))) { case 0: Flags = HLL_SC_AUTO; break; diff --git a/src/ca65/dbginfo.h b/src/ca65/dbginfo.h index 781e0d0bb..32cb3ca51 100644 --- a/src/ca65/dbginfo.h +++ b/src/ca65/dbginfo.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* dbginfo.h */ +/* dbginfo.h */ /* */ -/* Handle the .dbg commands */ +/* Handle the .dbg commands */ /* */ /* */ /* */ @@ -34,12 +34,12 @@ #ifndef DBGINFO_H -#define DBGINFO_H +#define DBGINFO_H /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/ea.h b/src/ca65/ea.h index dbedcd760..5a65638a0 100644 --- a/src/ca65/ea.h +++ b/src/ca65/ea.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* ea65.h */ +/* ea65.h */ /* */ /* Effective address structure definition */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/ca65/ea65.c b/src/ca65/ea65.c index d030f47b4..48c4a2c07 100644 --- a/src/ca65/ea65.c +++ b/src/ca65/ea65.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* ea65.c */ +/* ea65.c */ /* */ /* 65XX effective address parsing for the ca65 macroassembler */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -83,87 +83,87 @@ void GetEA (EffAddr* A) /* Parse the effective address */ if (TokIsSep (CurTok.Tok)) { - A->AddrModeSet = AM65_IMPLICIT; + A->AddrModeSet = AM65_IMPLICIT; } else if (CurTok.Tok == TOK_HASH) { - /* #val */ - NextTok (); - A->Expr = Expression (); - A->AddrModeSet = AM65_ALL_IMM; + /* #val */ + NextTok (); + A->Expr = Expression (); + A->AddrModeSet = AM65_ALL_IMM; } else if (CurTok.Tok == TOK_A) { - NextTok (); - A->AddrModeSet = AM65_ACCU; + NextTok (); + A->AddrModeSet = AM65_ACCU; } else if (CurTok.Tok == TOK_LBRACK) { - /* [dir] or [dir],y */ - NextTok (); - A->Expr = Expression (); - Consume (TOK_RBRACK, "']' expected"); - if (CurTok.Tok == TOK_COMMA) { - /* [dir],y */ - NextTok (); - Consume (TOK_Y, "`Y' expected"); - A->AddrModeSet = AM65_DIR_IND_LONG_Y; - } else { - /* [dir] */ - A->AddrModeSet = AM65_DIR_IND_LONG; - } + /* [dir] or [dir],y */ + NextTok (); + A->Expr = Expression (); + Consume (TOK_RBRACK, "']' expected"); + if (CurTok.Tok == TOK_COMMA) { + /* [dir],y */ + NextTok (); + Consume (TOK_Y, "`Y' expected"); + A->AddrModeSet = AM65_DIR_IND_LONG_Y; + } else { + /* [dir] */ + A->AddrModeSet = AM65_DIR_IND_LONG; + } } else if (CurTok.Tok == TOK_LPAREN) { - /* One of the indirect modes */ - NextTok (); - A->Expr = Expression (); + /* One of the indirect modes */ + NextTok (); + A->Expr = Expression (); - if (CurTok.Tok == TOK_COMMA) { + if (CurTok.Tok == TOK_COMMA) { - /* (expr,X) or (rel,S),y */ - NextTok (); - if (CurTok.Tok == TOK_X) { - /* (adr,x) */ - NextTok (); - A->AddrModeSet = AM65_ABS_X_IND | AM65_DIR_X_IND; - ConsumeRParen (); - } else if (CurTok.Tok == TOK_S) { - /* (rel,s),y */ - NextTok (); - A->AddrModeSet = AM65_STACK_REL_IND_Y; - ConsumeRParen (); - ConsumeComma (); - Consume (TOK_Y, "`Y' expected"); - } else { - Error ("Syntax error"); - } + /* (expr,X) or (rel,S),y */ + NextTok (); + if (CurTok.Tok == TOK_X) { + /* (adr,x) */ + NextTok (); + A->AddrModeSet = AM65_ABS_X_IND | AM65_DIR_X_IND; + ConsumeRParen (); + } else if (CurTok.Tok == TOK_S) { + /* (rel,s),y */ + NextTok (); + A->AddrModeSet = AM65_STACK_REL_IND_Y; + ConsumeRParen (); + ConsumeComma (); + Consume (TOK_Y, "`Y' expected"); + } else { + Error ("Syntax error"); + } - } else { + } else { - /* (adr) or (adr),y */ - ConsumeRParen (); - if (CurTok.Tok == TOK_COMMA) { - /* (adr),y */ - NextTok (); - Consume (TOK_Y, "`Y' expected"); - A->AddrModeSet = AM65_DIR_IND_Y; - } else { - /* (adr) */ - A->AddrModeSet = AM65_ABS_IND | AM65_DIR_IND; - } - } + /* (adr) or (adr),y */ + ConsumeRParen (); + if (CurTok.Tok == TOK_COMMA) { + /* (adr),y */ + NextTok (); + Consume (TOK_Y, "`Y' expected"); + A->AddrModeSet = AM65_DIR_IND_Y; + } else { + /* (adr) */ + A->AddrModeSet = AM65_ABS_IND | AM65_DIR_IND; + } + } } else { - /* Remaining stuff: - * - * adr - * adr,x - * adr,y - * adr,s - */ - A->Expr = Expression (); + /* Remaining stuff: + * + * adr + * adr,x + * adr,y + * adr,s + */ + A->Expr = Expression (); if (CurTok.Tok == TOK_COMMA) { diff --git a/src/ca65/ea65.h b/src/ca65/ea65.h index f5b6c32cd..f7f8c2018 100644 --- a/src/ca65/ea65.h +++ b/src/ca65/ea65.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* ea65.h */ +/* ea65.h */ /* */ /* 65XX effective address parsing for the ca65 macroassembler */ /* */ @@ -49,7 +49,7 @@ struct EffAddr; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/easw16.c b/src/ca65/easw16.c index 15773a7ae..6b3fe4f4c 100644 --- a/src/ca65/easw16.c +++ b/src/ca65/easw16.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* easw16.c */ +/* easw16.c */ /* */ /* SWEET16 effective address parsing for the ca65 macroassembler */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -82,13 +82,13 @@ void GetSweet16EA (EffAddr* A) /* Parse the effective address */ if (TokIsSep (CurTok.Tok)) { - A->AddrModeSet = AMSW16_IMP; + A->AddrModeSet = AMSW16_IMP; } else if (CurTok.Tok == TOK_AT) { - /* @reg or @regnumber */ - A->AddrModeSet = AMSW16_IND; - NextTok (); + /* @reg or @regnumber */ + A->AddrModeSet = AMSW16_IND; + NextTok (); if (CurTok.Tok == TOK_REG) { A->Reg = (unsigned) CurTok.IVal; NextTok (); diff --git a/src/ca65/easw16.h b/src/ca65/easw16.h index 3c8af690a..81dfd0fa2 100644 --- a/src/ca65/easw16.h +++ b/src/ca65/easw16.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* easw16.h */ +/* easw16.h */ /* */ /* SWEET16 effective address parsing for the ca65 macroassembler */ /* */ @@ -49,7 +49,7 @@ struct EffAddr; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/enum.c b/src/ca65/enum.c index d44dbfd19..08ef52fa6 100644 --- a/src/ca65/enum.c +++ b/src/ca65/enum.c @@ -51,7 +51,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/enum.h b/src/ca65/enum.h index eecadf0cd..5e85255f0 100644 --- a/src/ca65/enum.h +++ b/src/ca65/enum.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/error.c b/src/ca65/error.c index 4edb1e8a3..ffda60ecd 100644 --- a/src/ca65/error.c +++ b/src/ca65/error.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* error.c */ +/* error.c */ /* */ -/* Error handling for the ca65 macroassembler */ +/* Error handling for the ca65 macroassembler */ /* */ /* */ /* */ @@ -49,17 +49,17 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Warning level */ -unsigned WarnLevel = 1; +unsigned WarnLevel = 1; /* Statistics */ -unsigned ErrorCount = 0; -unsigned WarningCount = 0; +unsigned ErrorCount = 0; +unsigned WarningCount = 0; /* Maximum number of additional notifications */ #define MAX_NOTES 8 @@ -184,7 +184,7 @@ static void AddNotifications (const Collection* LineInfos) /*****************************************************************************/ -/* Warnings */ +/* Warnings */ /*****************************************************************************/ @@ -262,7 +262,7 @@ void LIWarning (const Collection* LineInfos, unsigned Level, const char* Format, /*****************************************************************************/ -/* Errors */ +/* Errors */ /*****************************************************************************/ @@ -357,7 +357,7 @@ void ErrorSkip (const char* Format, ...) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/error.h b/src/ca65/error.h index de0e53ac5..d86e68c42 100644 --- a/src/ca65/error.h +++ b/src/ca65/error.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* error.h */ +/* error.h */ /* */ -/* Error handling for the ca65 macroassembler */ +/* Error handling for the ca65 macroassembler */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -61,7 +61,7 @@ extern unsigned WarningCount; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/expr.c b/src/ca65/expr.c index c642bc61d..ecbd22a27 100644 --- a/src/ca65/expr.c +++ b/src/ca65/expr.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* expr.c */ +/* expr.c */ /* */ -/* Expression evaluation for the ca65 macroassembler */ +/* Expression evaluation for the ca65 macroassembler */ /* */ /* */ /* */ @@ -66,7 +66,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -77,14 +77,14 @@ * number of freed nodes for later and remember them in a single linked list * using the Left link. */ -#define MAX_FREE_NODES 64 -static ExprNode* FreeExprNodes = 0; -static unsigned FreeNodeCount = 0; +#define MAX_FREE_NODES 64 +static ExprNode* FreeExprNodes = 0; +static unsigned FreeNodeCount = 0; /*****************************************************************************/ -/* Helpers */ +/* Helpers */ /*****************************************************************************/ @@ -96,12 +96,12 @@ static ExprNode* NewExprNode (unsigned Op) /* Do we have some nodes in the list already? */ if (FreeNodeCount) { - /* Use first node from list */ - N = FreeExprNodes; - FreeExprNodes = N->Left; + /* Use first node from list */ + N = FreeExprNodes; + FreeExprNodes = N->Left; --FreeNodeCount; } else { - /* Allocate fresh memory */ + /* Allocate fresh memory */ N = xmalloc (sizeof (ExprNode)); } N->Op = Op; @@ -122,22 +122,22 @@ static void FreeExprNode (ExprNode* E) SymDelExprRef (E->V.Sym, E); } /* Place the symbol into the free nodes list if possible */ - if (FreeNodeCount < MAX_FREE_NODES) { - /* Remember this node for later */ - E->Left = FreeExprNodes; - FreeExprNodes = E; + if (FreeNodeCount < MAX_FREE_NODES) { + /* Remember this node for later */ + E->Left = FreeExprNodes; + FreeExprNodes = E; ++FreeNodeCount; - } else { - /* Free the memory */ - xfree (E); - } + } else { + /* Free the memory */ + xfree (E); + } } } /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -361,19 +361,19 @@ static ExprNode* FuncBlank (void) unsigned Count = 0; while (CurTok.Tok != Term) { - /* Check for end of line or end of input. Since the calling function - * will check for the closing paren, we don't need to print an error - * here, just bail out. - */ - if (TokIsSep (CurTok.Tok)) { - break; - } + /* Check for end of line or end of input. Since the calling function + * will check for the closing paren, we don't need to print an error + * here, just bail out. + */ + if (TokIsSep (CurTok.Tok)) { + break; + } - /* One more token */ - ++Count; + /* One more token */ + ++Count; - /* Skip the token */ - NextTok (); + /* Skip the token */ + NextTok (); } /* If the list was enclosed in curly braces, skip the closing brace */ @@ -464,25 +464,25 @@ static ExprNode* DoMatch (enum TC EqualityLevel) token_t Term = GetTokListTerm (TOK_COMMA); while (CurTok.Tok != Term) { - /* We may not end-of-line of end-of-file here */ - if (TokIsSep (CurTok.Tok)) { - Error ("Unexpected end of line"); - return GenLiteral0 (); - } + /* We may not end-of-line of end-of-file here */ + if (TokIsSep (CurTok.Tok)) { + Error ("Unexpected end of line"); + return GenLiteral0 (); + } - /* Get a node with this token */ - Node = NewTokNode (); + /* Get a node with this token */ + Node = NewTokNode (); - /* Insert the node into the list */ - if (Last == 0) { - Root = Node; - } else { - Last->Next = Node; - } - Last = Node; + /* Insert the node into the list */ + if (Last == 0) { + Root = Node; + } else { + Last->Next = Node; + } + Last = Node; - /* Skip the token */ - NextTok (); + /* Skip the token */ + NextTok (); } /* Skip the terminator token*/ @@ -502,30 +502,30 @@ static ExprNode* DoMatch (enum TC EqualityLevel) Node = Root; while (CurTok.Tok != Term) { - /* We may not end-of-line of end-of-file here */ - if (TokIsSep (CurTok.Tok)) { - Error ("Unexpected end of line"); - return GenLiteral0 (); - } + /* We may not end-of-line of end-of-file here */ + if (TokIsSep (CurTok.Tok)) { + Error ("Unexpected end of line"); + return GenLiteral0 (); + } - /* Compare the tokens if the result is not already known */ - if (Result != 0) { - if (Node == 0) { - /* The second list is larger than the first one */ - Result = 0; - } else if (TokCmp (Node) < EqualityLevel) { - /* Tokens do not match */ - Result = 0; - } - } + /* Compare the tokens if the result is not already known */ + if (Result != 0) { + if (Node == 0) { + /* The second list is larger than the first one */ + Result = 0; + } else if (TokCmp (Node) < EqualityLevel) { + /* Tokens do not match */ + Result = 0; + } + } - /* Next token in first list */ - if (Node) { - Node = Node->Next; - } + /* Next token in first list */ + if (Node) { + Node = Node->Next; + } - /* Next token in current list */ - NextTok (); + /* Next token in current list */ + NextTok (); } /* If the token list was enclosed in curly braces, eat the closing brace */ @@ -535,14 +535,14 @@ static ExprNode* DoMatch (enum TC EqualityLevel) /* Check if there are remaining tokens in the first list */ if (Node != 0) { - Result = 0; + Result = 0; } /* Free the token list */ while (Root) { - Node = Root; - Root = Root->Next; - FreeTokNode (Node); + Node = Root; + Root = Root->Next; + FreeTokNode (Node); } /* Done, return the result */ @@ -733,9 +733,9 @@ static ExprNode* FuncStrAt (void) /* String constant expected */ if (CurTok.Tok != TOK_STRCON) { - Error ("String constant expected"); - NextTok (); - goto ExitPoint; + Error ("String constant expected"); + NextTok (); + goto ExitPoint; } /* Remember the string and skip it */ @@ -750,7 +750,7 @@ static ExprNode* FuncStrAt (void) /* Must be a valid index */ if (Index >= (long) SB_GetLen (&Str)) { - Error ("Range error"); + Error ("Range error"); goto ExitPoint; } @@ -777,20 +777,20 @@ static ExprNode* FuncStrLen (void) /* String constant expected */ if (CurTok.Tok != TOK_STRCON) { - Error ("String constant expected"); - /* Smart error recovery */ - if (CurTok.Tok != TOK_RPAREN) { - NextTok (); - } - Len = 0; + Error ("String constant expected"); + /* Smart error recovery */ + if (CurTok.Tok != TOK_RPAREN) { + NextTok (); + } + Len = 0; } else { /* Get the length of the string */ - Len = SB_GetLen (&CurTok.SVal); + Len = SB_GetLen (&CurTok.SVal); - /* Skip the string */ - NextTok (); + /* Skip the string */ + NextTok (); } /* Return the length */ @@ -809,19 +809,19 @@ static ExprNode* FuncTCount (void) int Count = 0; while (CurTok.Tok != Term) { - /* Check for end of line or end of input. Since the calling function - * will check for the closing paren, we don't need to print an error - * here, just bail out. - */ - if (TokIsSep (CurTok.Tok)) { - break; - } + /* Check for end of line or end of input. Since the calling function + * will check for the closing paren, we don't need to print an error + * here, just bail out. + */ + if (TokIsSep (CurTok.Tok)) { + break; + } - /* One more token */ - ++Count; + /* One more token */ + ++Count; - /* Skip the token */ - NextTok (); + /* Skip the token */ + NextTok (); } /* If the list was enclosed in curly braces, skip the closing brace */ @@ -853,9 +853,9 @@ static ExprNode* Function (ExprNode* (*F) (void)) /* Expression must be enclosed in braces */ if (CurTok.Tok != TOK_LPAREN) { - Error ("'(' expected"); - SkipUntilSep (); - return GenLiteral0 (); + Error ("'(' expected"); + SkipUntilSep (); + return GenLiteral0 (); } NextTok (); @@ -879,46 +879,46 @@ static ExprNode* Factor (void) switch (CurTok.Tok) { - case TOK_INTCON: - N = GenLiteralExpr (CurTok.IVal); - NextTok (); - break; + case TOK_INTCON: + N = GenLiteralExpr (CurTok.IVal); + NextTok (); + break; - case TOK_CHARCON: - N = GenLiteralExpr (TgtTranslateChar (CurTok.IVal)); - NextTok (); - break; + case TOK_CHARCON: + N = GenLiteralExpr (TgtTranslateChar (CurTok.IVal)); + NextTok (); + break; - case TOK_NAMESPACE: - case TOK_IDENT: + case TOK_NAMESPACE: + case TOK_IDENT: case TOK_LOCAL_IDENT: N = Symbol (ParseAnySymName (SYM_ALLOC_NEW)); - break; + break; - case TOK_ULABEL: - N = ULabRef (CurTok.IVal); - NextTok (); - break; + case TOK_ULABEL: + N = ULabRef (CurTok.IVal); + NextTok (); + break; case TOK_PLUS: NextTok (); N = Factor (); break; - case TOK_MINUS: - NextTok (); + case TOK_MINUS: + NextTok (); L = Factor (); if (IsEasyConst (L, &Val)) { FreeExpr (L); N = GenLiteralExpr (-Val); } else { N = NewExprNode (EXPR_UNARY_MINUS); - N->Left = L; + N->Left = L; } - break; + break; - case TOK_NOT: - NextTok (); + case TOK_NOT: + NextTok (); L = Factor (); if (IsEasyConst (L, &Val)) { FreeExpr (L); @@ -927,23 +927,23 @@ static ExprNode* Factor (void) N = NewExprNode (EXPR_NOT); N->Left = L; } - break; + break; - case TOK_STAR: - case TOK_PC: - NextTok (); - N = GenCurrentPC (); - break; + case TOK_STAR: + case TOK_PC: + NextTok (); + N = GenCurrentPC (); + break; - case TOK_LT: - NextTok (); + case TOK_LT: + NextTok (); N = LoByte (Factor ()); - break; + break; - case TOK_GT: - NextTok (); + case TOK_GT: + NextTok (); N = HiByte (Factor ()); - break; + break; case TOK_XOR: /* ^ means the bank byte of an expression */ @@ -951,11 +951,11 @@ static ExprNode* Factor (void) N = BankByte (Factor ()); break; - case TOK_LPAREN: - NextTok (); - N = Expr0 (); - ConsumeRParen (); - break; + case TOK_LPAREN: + NextTok (); + N = Expr0 (); + ConsumeRParen (); + break; case TOK_BANK: N = Function (FuncBank); @@ -966,21 +966,21 @@ static ExprNode* Factor (void) break; case TOK_BLANK: - N = Function (FuncBlank); - break; + N = Function (FuncBlank); + break; - case TOK_CONST: - N = Function (FuncConst); - break; + case TOK_CONST: + N = Function (FuncConst); + break; - case TOK_CPU: - N = GenLiteralExpr (CPUIsets[CPU]); - NextTok (); - break; + case TOK_CPU: + N = GenLiteralExpr (CPUIsets[CPU]); + NextTok (); + break; case TOK_DEFINED: - N = Function (FuncDefined); - break; + N = Function (FuncDefined); + break; case TOK_HIBYTE: N = Function (FuncHiByte); @@ -998,9 +998,9 @@ static ExprNode* Factor (void) N = Function (FuncLoWord); break; - case TOK_MATCH: - N = Function (FuncMatch); - break; + case TOK_MATCH: + N = Function (FuncMatch); + break; case TOK_MAX: N = Function (FuncMax); @@ -1011,50 +1011,50 @@ static ExprNode* Factor (void) break; case TOK_REFERENCED: - N = Function (FuncReferenced); - break; + N = Function (FuncReferenced); + break; case TOK_SIZEOF: N = Function (FuncSizeOf); break; - case TOK_STRAT: - N = Function (FuncStrAt); - break; + case TOK_STRAT: + N = Function (FuncStrAt); + break; - case TOK_STRLEN: - N = Function (FuncStrLen); - break; + case TOK_STRLEN: + N = Function (FuncStrLen); + break; - case TOK_TCOUNT: - N = Function (FuncTCount); - break; + case TOK_TCOUNT: + N = Function (FuncTCount); + break; - case TOK_TIME: - N = GenLiteralExpr ((long) time (0)); - NextTok (); - break; + case TOK_TIME: + N = GenLiteralExpr ((long) time (0)); + NextTok (); + break; case TOK_VERSION: N = GenLiteralExpr (GetVersionAsNumber ()); NextTok (); break; - case TOK_XMATCH: - N = Function (FuncXMatch); - break; + case TOK_XMATCH: + N = Function (FuncXMatch); + break; - default: - if (LooseCharTerm && CurTok.Tok == TOK_STRCON && + default: + if (LooseCharTerm && CurTok.Tok == TOK_STRCON && SB_GetLen (&CurTok.SVal) == 1) { - /* A character constant */ - N = GenLiteralExpr (TgtTranslateChar (SB_At (&CurTok.SVal, 0))); - } else { - N = GenLiteral0 (); /* Dummy */ - Error ("Syntax error"); - } - NextTok (); - break; + /* A character constant */ + N = GenLiteralExpr (TgtTranslateChar (SB_At (&CurTok.SVal, 0))); + } else { + N = GenLiteral0 (); /* Dummy */ + Error ("Syntax error"); + } + NextTok (); + break; } return N; } @@ -1070,7 +1070,7 @@ static ExprNode* Term (void) while (CurTok.Tok == TOK_MUL || CurTok.Tok == TOK_DIV || CurTok.Tok == TOK_MOD || CurTok.Tok == TOK_AND || CurTok.Tok == TOK_XOR || CurTok.Tok == TOK_SHL || - CurTok.Tok == TOK_SHR) { + CurTok.Tok == TOK_SHR) { long LVal, RVal, Val; ExprNode* Left; @@ -1142,14 +1142,14 @@ static ExprNode* Term (void) /* Generate an expression tree */ unsigned char Op; switch (T) { - case TOK_MUL: Op = EXPR_MUL; break; + case TOK_MUL: Op = EXPR_MUL; break; case TOK_DIV: Op = EXPR_DIV; break; case TOK_MOD: Op = EXPR_MOD; break; case TOK_AND: Op = EXPR_AND; break; case TOK_XOR: Op = EXPR_XOR; break; case TOK_SHL: Op = EXPR_SHL; break; case TOK_SHR: Op = EXPR_SHR; break; - default: Internal ("Invalid token"); + default: Internal ("Invalid token"); } Root = NewExprNode (Op); Root->Left = Left; @@ -1212,7 +1212,7 @@ static ExprNode* SimpleExpr (void) case TOK_PLUS: Op = EXPR_PLUS; break; case TOK_MINUS: Op = EXPR_MINUS; break; case TOK_OR: Op = EXPR_OR; break; - default: Internal ("Invalid token"); + default: Internal ("Invalid token"); } Root = NewExprNode (Op); Root->Left = Left; @@ -1281,7 +1281,7 @@ static ExprNode* BoolExpr (void) case TOK_GT: Op = EXPR_GT; break; case TOK_LE: Op = EXPR_LE; break; case TOK_GE: Op = EXPR_GE; break; - default: Internal ("Invalid token"); + default: Internal ("Invalid token"); } Root = NewExprNode (Op); Root->Left = Left; @@ -1340,7 +1340,7 @@ static ExprNode* Expr2 (void) switch (T) { case TOK_BOOLAND: Op = EXPR_BOOLAND; break; case TOK_BOOLXOR: Op = EXPR_BOOLXOR; break; - default: Internal ("Invalid token"); + default: Internal ("Invalid token"); } Root = NewExprNode (Op); Root->Left = Left; @@ -1397,7 +1397,7 @@ static ExprNode* Expr1 (void) unsigned char Op; switch (T) { case TOK_BOOLOR: Op = EXPR_BOOLOR; break; - default: Internal ("Invalid token"); + default: Internal ("Invalid token"); } Root = NewExprNode (Op); Root->Left = Left; @@ -1424,7 +1424,7 @@ static ExprNode* Expr0 (void) ExprNode* Left; /* Skip the operator token */ - NextTok (); + NextTok (); /* Read the argument */ Left = Expr0 (); @@ -1440,8 +1440,8 @@ static ExprNode* Expr0 (void) } else { - /* Read left hand side */ - Root = Expr1 (); + /* Read left hand side */ + Root = Expr1 (); } @@ -1481,8 +1481,8 @@ long ConstExpression (void) if (ED_IsConst (&D)) { Val = D.Val; } else { - Error ("Constant expression expected"); - Val = 0; + Error ("Constant expression expected"); + Val = 0; } /* Free the expression tree and allocated memory for D */ @@ -1499,9 +1499,9 @@ void FreeExpr (ExprNode* Root) /* Free the expression, Root is pointing to. */ { if (Root) { - FreeExpr (Root->Left); - FreeExpr (Root->Right); - FreeExprNode (Root); + FreeExpr (Root->Left); + FreeExpr (Root->Right); + FreeExprNode (Root); } } @@ -1595,12 +1595,12 @@ ExprNode* GenCurrentPC (void) ExprNode* Root; if (GetRelocMode ()) { - /* Create SegmentBase + Offset */ - Root = GenAddExpr (GenSectionExpr (GetCurrentSegNum ()), + /* Create SegmentBase + Offset */ + Root = GenAddExpr (GenSectionExpr (GetCurrentSegNum ()), GenLiteralExpr (GetPC ())); } else { - /* Absolute mode, just return PC value */ - Root = GenLiteralExpr (GetPC ()); + /* Absolute mode, just return PC value */ + Root = GenLiteralExpr (GetPC ()); } return Root; @@ -1679,7 +1679,7 @@ ExprNode* GenULabelExpr (unsigned Num) /* Return an expression for an unnamed label with the given index */ { ExprNode* Node = NewExprNode (EXPR_ULABEL); - Node->V.IVal = Num; + Node->V.IVal = Num; /* Return the new node */ return Node; @@ -1749,7 +1749,7 @@ ExprNode* GenNE (ExprNode* Expr, long Val) /* Generate a compare node */ ExprNode* Root = NewExprNode (EXPR_NE); Root->Left = Expr; - Root->Right = GenLiteralExpr (Val); + Root->Right = GenLiteralExpr (Val); /* Return the result */ return Root; @@ -1798,21 +1798,21 @@ ExprNode* CloneExpr (ExprNode* Expr) /* Clone the node */ switch (Expr->Op) { - case EXPR_LITERAL: + case EXPR_LITERAL: Clone = GenLiteralExpr (Expr->V.IVal); break; - case EXPR_ULABEL: - Clone = GenULabelExpr (Expr->V.IVal); - break; + case EXPR_ULABEL: + Clone = GenULabelExpr (Expr->V.IVal); + break; - case EXPR_SYMBOL: - Clone = GenSymExpr (Expr->V.Sym); - break; + case EXPR_SYMBOL: + Clone = GenSymExpr (Expr->V.Sym); + break; - case EXPR_SECTION: - Clone = GenSectionExpr (Expr->V.SecNum); - break; + case EXPR_SECTION: + Clone = GenSectionExpr (Expr->V.SecNum); + break; case EXPR_BANK: Clone = GenBankExpr (Expr->V.SecNum); @@ -1838,8 +1838,8 @@ void WriteExpr (ExprNode* Expr) { /* Null expressions are encoded by a type byte of zero */ if (Expr == 0) { - ObjWrite8 (EXPR_NULL); - return; + ObjWrite8 (EXPR_NULL); + return; } /* If the is a leafnode, write the expression attribute, otherwise @@ -1849,33 +1849,33 @@ void WriteExpr (ExprNode* Expr) case EXPR_LITERAL: ObjWrite8 (EXPR_LITERAL); - ObjWrite32 (Expr->V.IVal); - break; + ObjWrite32 (Expr->V.IVal); + break; case EXPR_SYMBOL: - if (SymIsImport (Expr->V.Sym)) { + if (SymIsImport (Expr->V.Sym)) { ObjWrite8 (EXPR_SYMBOL); ObjWriteVar (GetSymImportId (Expr->V.Sym)); } else { WriteExpr (GetSymExpr (Expr->V.Sym)); } - break; + break; case EXPR_SECTION: ObjWrite8 (EXPR_SECTION); - ObjWriteVar (Expr->V.SecNum); - break; + ObjWriteVar (Expr->V.SecNum); + break; - case EXPR_ULABEL: + case EXPR_ULABEL: WriteExpr (ULabResolve (Expr->V.IVal)); - break; + break; default: - /* Not a leaf node */ + /* Not a leaf node */ ObjWrite8 (Expr->Op); - WriteExpr (Expr->Left); - WriteExpr (Expr->Right); - break; + WriteExpr (Expr->Left); + WriteExpr (Expr->Right); + break; } } diff --git a/src/ca65/expr.h b/src/ca65/expr.h index 1011b825d..17f547beb 100644 --- a/src/ca65/expr.h +++ b/src/ca65/expr.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* expr.h */ +/* expr.h */ /* */ -/* Expression evaluation for the ca65 macroassembler */ +/* Expression evaluation for the ca65 macroassembler */ /* */ /* */ /* */ @@ -55,7 +55,7 @@ struct ExprDesc; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/feature.c b/src/ca65/feature.c index 0a45ded86..c2532c595 100644 --- a/src/ca65/feature.c +++ b/src/ca65/feature.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* feature.c */ +/* feature.c */ /* */ -/* Subroutines for the emulation features */ +/* Subroutines for the emulation features */ /* */ /* */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -68,7 +68,7 @@ static const char* FeatureKeys[FEAT_COUNT] = { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -82,10 +82,10 @@ feature_t FindFeature (const StrBuf* Key) /* This is not time critical, so do a linear search */ for (F = (feature_t) 0; F < FEAT_COUNT; ++F) { - if (SB_CompareStr (Key, FeatureKeys[F]) == 0) { - /* Found, index is enum value */ - return F; - } + if (SB_CompareStr (Key, FeatureKeys[F]) == 0) { + /* Found, index is enum value */ + return F; + } } /* Not found */ @@ -105,21 +105,21 @@ feature_t SetFeature (const StrBuf* Key) /* Set the flags */ switch (Feature) { - case FEAT_DOLLAR_IS_PC: DollarIsPC = 1; break; - case FEAT_LABELS_WITHOUT_COLONS: NoColonLabels = 1; break; - case FEAT_LOOSE_STRING_TERM: LooseStringTerm = 1; break; - case FEAT_LOOSE_CHAR_TERM: LooseCharTerm = 1; break; - case FEAT_AT_IN_IDENTIFIERS: AtInIdents = 1; break; - case FEAT_DOLLAR_IN_IDENTIFIERS: DollarInIdents = 1; break; - case FEAT_LEADING_DOT_IN_IDENTIFIERS: LeadingDotInIdents= 1; break; + case FEAT_DOLLAR_IS_PC: DollarIsPC = 1; break; + case FEAT_LABELS_WITHOUT_COLONS: NoColonLabels = 1; break; + case FEAT_LOOSE_STRING_TERM: LooseStringTerm = 1; break; + case FEAT_LOOSE_CHAR_TERM: LooseCharTerm = 1; break; + case FEAT_AT_IN_IDENTIFIERS: AtInIdents = 1; break; + case FEAT_DOLLAR_IN_IDENTIFIERS: DollarInIdents = 1; break; + case FEAT_LEADING_DOT_IN_IDENTIFIERS: LeadingDotInIdents= 1; break; case FEAT_ORG_PER_SEG: OrgPerSeg = 1; break; - case FEAT_PC_ASSIGNMENT: PCAssignment = 1; break; + case FEAT_PC_ASSIGNMENT: PCAssignment = 1; break; case FEAT_MISSING_CHAR_TERM: MissingCharTerm = 1; break; case FEAT_UBIQUITOUS_IDENTS: UbiquitousIdents = 1; break; case FEAT_C_COMMENTS: CComments = 1; break; case FEAT_FORCE_RANGE: ForceRange = 1; break; case FEAT_UNDERLINE_IN_NUMBERS: UnderlineInNumbers= 1; break; - default: /* Keep gcc silent */ break; + default: /* Keep gcc silent */ break; } /* Return the value found */ diff --git a/src/ca65/feature.h b/src/ca65/feature.h index a56fc57f0..53016b21c 100644 --- a/src/ca65/feature.h +++ b/src/ca65/feature.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* feature.h */ +/* feature.h */ /* */ -/* Subroutines for the emulation features */ +/* Subroutines for the emulation features */ /* */ /* */ /* */ @@ -34,7 +34,7 @@ #ifndef FEATURE_H -#define FEATURE_H +#define FEATURE_H @@ -44,13 +44,13 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ typedef enum { - FEAT_UNKNOWN = -1, + FEAT_UNKNOWN = -1, FEAT_DOLLAR_IS_PC, FEAT_LABELS_WITHOUT_COLONS, FEAT_LOOSE_STRING_TERM, @@ -73,7 +73,7 @@ typedef enum { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/filetab.c b/src/ca65/filetab.c index 82e20ee70..bf5b32503 100644 --- a/src/ca65/filetab.c +++ b/src/ca65/filetab.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* filetab.h */ +/* filetab.h */ /* */ -/* Input file table for ca65 */ +/* Input file table for ca65 */ /* */ /* */ /* */ @@ -73,7 +73,7 @@ static int HT_Compare (const void* Key1, const void* Key2); /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -87,10 +87,10 @@ typedef struct FileEntry FileEntry; struct FileEntry { HashNode Node; unsigned Name; /* File name */ - unsigned Index; /* Index of entry */ + unsigned Index; /* Index of entry */ FileType Type; /* Type of file */ - unsigned long Size; /* Size of file */ - unsigned long MTime; /* Time of last modification */ + unsigned long Size; /* Size of file */ + unsigned long MTime; /* Time of last modification */ }; /* Array of all entries, listed by index */ @@ -142,7 +142,7 @@ static int HT_Compare (const void* Key1, const void* Key2) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -157,10 +157,10 @@ static FileEntry* NewFileEntry (unsigned Name, FileType Type, /* Initialize the fields */ InitHashNode (&F->Node); F->Name = Name; - F->Index = CollCount (&FileTab) + 1; /* First file has index #1 */ + F->Index = CollCount (&FileTab) + 1; /* First file has index #1 */ F->Type = Type; - F->Size = Size; - F->MTime = MTime; + F->Size = Size; + F->MTime = MTime; /* Insert the file into the file table */ CollAppend (&FileTab, F); @@ -182,16 +182,16 @@ const StrBuf* GetFileName (unsigned Name) const FileEntry* F; if (Name == 0) { - /* Name was defined outside any file scope, use the name of the first - * file instead. Errors are then reported with a file position of - * line zero in the first file. - */ - if (CollCount (&FileTab) == 0) { - /* No files defined until now */ + /* Name was defined outside any file scope, use the name of the first + * file instead. Errors are then reported with a file position of + * line zero in the first file. + */ + if (CollCount (&FileTab) == 0) { + /* No files defined until now */ return &ErrorMsg; - } else { + } else { F = CollConstAt (&FileTab, 0); - } + } } else { F = CollConstAt (&FileTab, Name-1); } @@ -248,12 +248,12 @@ void WriteFiles (void) /* Write the file data */ for (I = 0; I < CollCount (&FileTab); ++I) { - /* Get a pointer to the entry */ - const FileEntry* F = CollConstAt (&FileTab, I); - /* Write the fields */ - ObjWriteVar (F->Name); - ObjWrite32 (F->MTime); - ObjWriteVar (F->Size); + /* Get a pointer to the entry */ + const FileEntry* F = CollConstAt (&FileTab, I); + /* Write the fields */ + ObjWriteVar (F->Name); + ObjWrite32 (F->MTime); + ObjWriteVar (F->Size); } /* Done writing files */ @@ -272,20 +272,20 @@ static void WriteDep (FILE* F, FileType Types) const StrBuf* Filename; - /* Get the next input file */ - const FileEntry* E = (const FileEntry*) CollAt (&FileTab, I); + /* Get the next input file */ + const FileEntry* E = (const FileEntry*) CollAt (&FileTab, I); /* Ignore it if it is not of the correct type */ if ((E->Type & Types) == 0) { continue; } - /* If this is not the first file, add a space */ - if (I > 0) { + /* If this is not the first file, add a space */ + if (I > 0) { fputc (' ', F); } - /* Print the dependency */ + /* Print the dependency */ Filename = GetStrBuf (E->Name); fprintf (F, "%*s", SB_GetLen (Filename), SB_GetConstBuf (Filename)); } @@ -301,7 +301,7 @@ static void CreateDepFile (const char* Name, FileType Types) /* Open the file */ FILE* F = fopen (Name, "w"); if (F == 0) { - Fatal ("Cannot open dependency file `%s': %s", Name, strerror (errno)); + Fatal ("Cannot open dependency file `%s': %s", Name, strerror (errno)); } /* Print the output file followed by a tab char */ @@ -317,8 +317,8 @@ static void CreateDepFile (const char* Name, FileType Types) /* Close the file, check for errors */ if (fclose (F) != 0) { - remove (Name); - Fatal ("Cannot write to dependeny file (disk full?)"); + remove (Name); + Fatal ("Cannot write to dependeny file (disk full?)"); } } diff --git a/src/ca65/filetab.h b/src/ca65/filetab.h index 99ef4ba20..af5909c4c 100644 --- a/src/ca65/filetab.h +++ b/src/ca65/filetab.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* filetab.h */ +/* filetab.h */ /* */ -/* Input file table for ca65 */ +/* Input file table for ca65 */ /* */ /* */ /* */ @@ -34,7 +34,7 @@ #ifndef FILETAB_H -#define FILETAB_H +#define FILETAB_H @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -62,7 +62,7 @@ typedef enum { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/fragment.c b/src/ca65/fragment.c index 059371e77..e1a55edb3 100644 --- a/src/ca65/fragment.c +++ b/src/ca65/fragment.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fragment.c */ +/* fragment.c */ /* */ -/* Data fragments for the ca65 crossassembler */ +/* Data fragments for the ca65 crossassembler */ /* */ /* */ /* */ @@ -56,12 +56,12 @@ Fragment* NewFragment (unsigned char Type, unsigned short Len) Fragment* F = xmalloc (sizeof (*F)); /* Initialize it */ - F->Next = 0; + F->Next = 0; F->LineList = 0; F->LI = EmptyCollection; GetFullLineInfo (&F->LI); - F->Len = Len; - F->Type = Type; + F->Len = Len; + F->Type = Type; /* And return it */ return F; diff --git a/src/ca65/fragment.h b/src/ca65/fragment.h index 6cd9a8fbb..99852202a 100644 --- a/src/ca65/fragment.h +++ b/src/ca65/fragment.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fragment.h */ +/* fragment.h */ /* */ -/* Data fragments for the ca65 crossassembler */ +/* Data fragments for the ca65 crossassembler */ /* */ /* */ /* */ @@ -48,21 +48,21 @@ /*****************************************************************************/ -/* struct Fragment */ +/* struct Fragment */ /*****************************************************************************/ typedef struct Fragment Fragment; struct Fragment { - Fragment* Next; /* Pointer to next fragment in segment */ - Fragment* LineList; /* List of fragments for one src line */ + Fragment* Next; /* Pointer to next fragment in segment */ + Fragment* LineList; /* List of fragments for one src line */ Collection LI; /* Line info for this fragment */ - unsigned short Len; /* Length for this fragment */ - unsigned char Type; /* Fragment type */ + unsigned short Len; /* Length for this fragment */ + unsigned char Type; /* Fragment type */ union { - unsigned char Data[sizeof (ExprNode*)]; /* Literal values */ - ExprNode* Expr; /* Expression */ + unsigned char Data[sizeof (ExprNode*)]; /* Literal values */ + ExprNode* Expr; /* Expression */ } V; }; diff --git a/src/ca65/global.c b/src/ca65/global.c index b76337250..b3d6d6c6e 100644 --- a/src/ca65/global.c +++ b/src/ca65/global.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ -/* Global variables for the ca65 macroassembler */ +/* Global variables for the ca65 macroassembler */ /* */ /* */ /* */ @@ -42,40 +42,40 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* File names */ -const char* InFile = 0; /* Name of input file */ -const char* OutFile = 0; /* Name of output file */ +const char* InFile = 0; /* Name of input file */ +const char* OutFile = 0; /* Name of output file */ StrBuf ListingName = STATIC_STRBUF_INITIALIZER; /* Name of listing file */ StrBuf DepName = STATIC_STRBUF_INITIALIZER; /* Dependency file */ StrBuf FullDepName = STATIC_STRBUF_INITIALIZER; /* Full dependency file */ /* Default extensions */ -const char ObjExt[] = ".o";/* Default object extension */ +const char ObjExt[] = ".o";/* Default object extension */ -char LocalStart = '@'; /* This char starts local symbols */ +char LocalStart = '@'; /* This char starts local symbols */ unsigned char IgnoreCase = 0; /* Ignore case on identifiers? */ unsigned char AutoImport = 0; /* Mark unresolveds as import */ -unsigned char SmartMode = 0; /* Smart mode */ -unsigned char DbgSyms = 0; /* Add debug symbols */ -unsigned char LineCont = 0; /* Allow line continuation */ +unsigned char SmartMode = 0; /* Smart mode */ +unsigned char DbgSyms = 0; /* Add debug symbols */ +unsigned char LineCont = 0; /* Allow line continuation */ unsigned char LargeAlignment = 0; /* Don't warn about large alignments */ unsigned char RelaxChecks = 0; /* Relax a few assembler checks */ /* Emulation features */ unsigned char DollarIsPC = 0; /* Allow the $ symbol as current PC */ unsigned char NoColonLabels = 0; /* Allow labels without a colon */ -unsigned char LooseStringTerm = 0; /* Allow ' as string terminator */ -unsigned char LooseCharTerm = 0; /* Allow " for char constants */ -unsigned char AtInIdents = 0; /* Allow '@' in identifiers */ +unsigned char LooseStringTerm = 0; /* Allow ' as string terminator */ +unsigned char LooseCharTerm = 0; /* Allow " for char constants */ +unsigned char AtInIdents = 0; /* Allow '@' in identifiers */ unsigned char DollarInIdents = 0; /* Allow '$' in identifiers */ unsigned char LeadingDotInIdents = 0; /* Allow '.' to start an identifier */ -unsigned char PCAssignment = 0; /* Allow "* = $XXX" or "$ = $XXX" */ +unsigned char PCAssignment = 0; /* Allow "* = $XXX" or "$ = $XXX" */ unsigned char MissingCharTerm = 0; /* Allow lda #'a (no closing term) */ unsigned char UbiquitousIdents = 0; /* Allow ubiquitous identifiers */ unsigned char OrgPerSeg = 0; /* Make .org local to current seg */ diff --git a/src/ca65/global.h b/src/ca65/global.h index cc1a646f9..23bbe4884 100644 --- a/src/ca65/global.h +++ b/src/ca65/global.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ -/* Global variables for the ca65 macroassembler */ +/* Global variables for the ca65 macroassembler */ /* */ /* */ /* */ @@ -44,40 +44,40 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* File names */ -extern const char* InFile; /* Name of input file */ -extern const char* OutFile; /* Name of output file */ +extern const char* InFile; /* Name of input file */ +extern const char* OutFile; /* Name of output file */ extern StrBuf ListingName; /* Name of listing file */ extern StrBuf DepName; /* Name of dependencies file */ extern StrBuf FullDepName; /* Name of full dependencies file */ /* Default extensions */ -extern const char ObjExt[]; /* Default object extension */ +extern const char ObjExt[]; /* Default object extension */ -extern char LocalStart; /* This char starts local symbols */ +extern char LocalStart; /* This char starts local symbols */ -extern unsigned char IgnoreCase; /* Ignore case on identifiers? */ -extern unsigned char AutoImport; /* Mark unresolveds as import */ -extern unsigned char SmartMode; /* Smart mode */ -extern unsigned char DbgSyms; /* Add debug symbols */ -extern unsigned char LineCont; /* Allow line continuation */ +extern unsigned char IgnoreCase; /* Ignore case on identifiers? */ +extern unsigned char AutoImport; /* Mark unresolveds as import */ +extern unsigned char SmartMode; /* Smart mode */ +extern unsigned char DbgSyms; /* Add debug symbols */ +extern unsigned char LineCont; /* Allow line continuation */ extern unsigned char LargeAlignment; /* Don't warn about large alignments */ extern unsigned char RelaxChecks; /* Relax a few assembler checks */ /* Emulation features */ -extern unsigned char DollarIsPC; /* Allow the $ symbol as current PC */ -extern unsigned char NoColonLabels; /* Allow labels without a colon */ -extern unsigned char LooseStringTerm; /* Allow ' as string terminator */ -extern unsigned char LooseCharTerm; /* Allow " for char constants */ -extern unsigned char AtInIdents; /* Allow '@' in identifiers */ -extern unsigned char DollarInIdents; /* Allow '$' in identifiers */ +extern unsigned char DollarIsPC; /* Allow the $ symbol as current PC */ +extern unsigned char NoColonLabels; /* Allow labels without a colon */ +extern unsigned char LooseStringTerm; /* Allow ' as string terminator */ +extern unsigned char LooseCharTerm; /* Allow " for char constants */ +extern unsigned char AtInIdents; /* Allow '@' in identifiers */ +extern unsigned char DollarInIdents; /* Allow '$' in identifiers */ extern unsigned char LeadingDotInIdents; /* Allow '.' to start an identifier */ -extern unsigned char PCAssignment; /* Allow "* = $XXX" or "$ = $XXX" */ +extern unsigned char PCAssignment; /* Allow "* = $XXX" or "$ = $XXX" */ extern unsigned char MissingCharTerm; /* Allow lda #'a (no closing term) */ extern unsigned char UbiquitousIdents; /* Allow ubiquitous identifiers */ extern unsigned char OrgPerSeg; /* Make .org local to current seg */ diff --git a/src/ca65/incpath.c b/src/ca65/incpath.c index 2a8bb9c73..76ad3111a 100644 --- a/src/ca65/incpath.c +++ b/src/ca65/incpath.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* incpath.c */ +/* incpath.c */ /* */ -/* Include path handling for the ca65 macro assembler */ +/* Include path handling for the ca65 macro assembler */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -50,7 +50,7 @@ SearchPath* BinSearchPath; /* Binary include path */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/incpath.h b/src/ca65/incpath.h index 5ad6369cb..841767e4b 100644 --- a/src/ca65/incpath.h +++ b/src/ca65/incpath.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* incpath.h */ +/* incpath.h */ /* */ -/* Include path handling for the ca65 macro assembler */ +/* Include path handling for the ca65 macro assembler */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -55,7 +55,7 @@ extern SearchPath* BinSearchPath; /* Binary include path */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/instr.c b/src/ca65/instr.c index c4d756a5d..277676614 100644 --- a/src/ca65/instr.c +++ b/src/ca65/instr.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* instr.c */ +/* instr.c */ /* */ -/* Instruction encoding for the ca65 macroassembler */ +/* Instruction encoding for the ca65 macroassembler */ /* */ /* */ /* */ @@ -134,7 +134,7 @@ static void PutSweet16Branch (const InsDesc* Ins); /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -153,62 +153,62 @@ static const struct { } InsTab6502 = { sizeof (InsTab6502.Ins) / sizeof (InsTab6502.Ins[0]), { - { "ADC", 0x080A26C, 0x60, 0, PutAll }, - { "AND", 0x080A26C, 0x20, 0, PutAll }, - { "ASL", 0x000006e, 0x02, 1, PutAll }, - { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, - { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, - { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, - { "BIT", 0x000000C, 0x00, 2, PutAll }, - { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, - { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, - { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, - { "BRK", 0x0000001, 0x00, 0, PutAll }, - { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, - { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, - { "CLC", 0x0000001, 0x18, 0, PutAll }, - { "CLD", 0x0000001, 0xd8, 0, PutAll }, - { "CLI", 0x0000001, 0x58, 0, PutAll }, - { "CLV", 0x0000001, 0xb8, 0, PutAll }, - { "CMP", 0x080A26C, 0xc0, 0, PutAll }, - { "CPX", 0x080000C, 0xe0, 1, PutAll }, - { "CPY", 0x080000C, 0xc0, 1, PutAll }, - { "DEC", 0x000006C, 0x00, 3, PutAll }, - { "DEX", 0x0000001, 0xca, 0, PutAll }, - { "DEY", 0x0000001, 0x88, 0, PutAll }, - { "EOR", 0x080A26C, 0x40, 0, PutAll }, - { "INC", 0x000006c, 0x00, 4, PutAll }, - { "INX", 0x0000001, 0xe8, 0, PutAll }, - { "INY", 0x0000001, 0xc8, 0, PutAll }, - { "JMP", 0x0000808, 0x4c, 6, PutJMP }, - { "JSR", 0x0000008, 0x20, 7, PutAll }, - { "LDA", 0x080A26C, 0xa0, 0, PutAll }, - { "LDX", 0x080030C, 0xa2, 1, PutAll }, - { "LDY", 0x080006C, 0xa0, 1, PutAll }, - { "LSR", 0x000006F, 0x42, 1, PutAll }, - { "NOP", 0x0000001, 0xea, 0, PutAll }, - { "ORA", 0x080A26C, 0x00, 0, PutAll }, - { "PHA", 0x0000001, 0x48, 0, PutAll }, - { "PHP", 0x0000001, 0x08, 0, PutAll }, - { "PLA", 0x0000001, 0x68, 0, PutAll }, - { "PLP", 0x0000001, 0x28, 0, PutAll }, - { "ROL", 0x000006F, 0x22, 1, PutAll }, - { "ROR", 0x000006F, 0x62, 1, PutAll }, - { "RTI", 0x0000001, 0x40, 0, PutAll }, - { "RTS", 0x0000001, 0x60, 0, PutAll }, - { "SBC", 0x080A26C, 0xe0, 0, PutAll }, - { "SEC", 0x0000001, 0x38, 0, PutAll }, - { "SED", 0x0000001, 0xf8, 0, PutAll }, - { "SEI", 0x0000001, 0x78, 0, PutAll }, - { "STA", 0x000A26C, 0x80, 0, PutAll }, - { "STX", 0x000010c, 0x82, 1, PutAll }, - { "STY", 0x000002c, 0x80, 1, PutAll }, - { "TAX", 0x0000001, 0xaa, 0, PutAll }, - { "TAY", 0x0000001, 0xa8, 0, PutAll }, - { "TSX", 0x0000001, 0xba, 0, PutAll }, - { "TXA", 0x0000001, 0x8a, 0, PutAll }, - { "TXS", 0x0000001, 0x9a, 0, PutAll }, - { "TYA", 0x0000001, 0x98, 0, PutAll } + { "ADC", 0x080A26C, 0x60, 0, PutAll }, + { "AND", 0x080A26C, 0x20, 0, PutAll }, + { "ASL", 0x000006e, 0x02, 1, PutAll }, + { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, + { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, + { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, + { "BIT", 0x000000C, 0x00, 2, PutAll }, + { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, + { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, + { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, + { "BRK", 0x0000001, 0x00, 0, PutAll }, + { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, + { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, + { "CLC", 0x0000001, 0x18, 0, PutAll }, + { "CLD", 0x0000001, 0xd8, 0, PutAll }, + { "CLI", 0x0000001, 0x58, 0, PutAll }, + { "CLV", 0x0000001, 0xb8, 0, PutAll }, + { "CMP", 0x080A26C, 0xc0, 0, PutAll }, + { "CPX", 0x080000C, 0xe0, 1, PutAll }, + { "CPY", 0x080000C, 0xc0, 1, PutAll }, + { "DEC", 0x000006C, 0x00, 3, PutAll }, + { "DEX", 0x0000001, 0xca, 0, PutAll }, + { "DEY", 0x0000001, 0x88, 0, PutAll }, + { "EOR", 0x080A26C, 0x40, 0, PutAll }, + { "INC", 0x000006c, 0x00, 4, PutAll }, + { "INX", 0x0000001, 0xe8, 0, PutAll }, + { "INY", 0x0000001, 0xc8, 0, PutAll }, + { "JMP", 0x0000808, 0x4c, 6, PutJMP }, + { "JSR", 0x0000008, 0x20, 7, PutAll }, + { "LDA", 0x080A26C, 0xa0, 0, PutAll }, + { "LDX", 0x080030C, 0xa2, 1, PutAll }, + { "LDY", 0x080006C, 0xa0, 1, PutAll }, + { "LSR", 0x000006F, 0x42, 1, PutAll }, + { "NOP", 0x0000001, 0xea, 0, PutAll }, + { "ORA", 0x080A26C, 0x00, 0, PutAll }, + { "PHA", 0x0000001, 0x48, 0, PutAll }, + { "PHP", 0x0000001, 0x08, 0, PutAll }, + { "PLA", 0x0000001, 0x68, 0, PutAll }, + { "PLP", 0x0000001, 0x28, 0, PutAll }, + { "ROL", 0x000006F, 0x22, 1, PutAll }, + { "ROR", 0x000006F, 0x62, 1, PutAll }, + { "RTI", 0x0000001, 0x40, 0, PutAll }, + { "RTS", 0x0000001, 0x60, 0, PutAll }, + { "SBC", 0x080A26C, 0xe0, 0, PutAll }, + { "SEC", 0x0000001, 0x38, 0, PutAll }, + { "SED", 0x0000001, 0xf8, 0, PutAll }, + { "SEI", 0x0000001, 0x78, 0, PutAll }, + { "STA", 0x000A26C, 0x80, 0, PutAll }, + { "STX", 0x000010c, 0x82, 1, PutAll }, + { "STY", 0x000002c, 0x80, 1, PutAll }, + { "TAX", 0x0000001, 0xaa, 0, PutAll }, + { "TAY", 0x0000001, 0xa8, 0, PutAll }, + { "TSX", 0x0000001, 0xba, 0, PutAll }, + { "TXA", 0x0000001, 0x8a, 0, PutAll }, + { "TXS", 0x0000001, 0x9a, 0, PutAll }, + { "TYA", 0x0000001, 0x98, 0, PutAll } } }; @@ -219,76 +219,76 @@ static const struct { } InsTab6502X = { sizeof (InsTab6502X.Ins) / sizeof (InsTab6502X.Ins[0]), { - { "ADC", 0x080A26C, 0x60, 0, PutAll }, + { "ADC", 0x080A26C, 0x60, 0, PutAll }, { "ALR", 0x0800000, 0x4B, 0, PutAll }, /* X */ { "ANC", 0x0800000, 0x0B, 0, PutAll }, /* X */ - { "AND", 0x080A26C, 0x20, 0, PutAll }, + { "AND", 0x080A26C, 0x20, 0, PutAll }, { "ARR", 0x0800000, 0x6B, 0, PutAll }, /* X */ - { "ASL", 0x000006e, 0x02, 1, PutAll }, + { "ASL", 0x000006e, 0x02, 1, PutAll }, { "AXS", 0x0800000, 0xCB, 0, PutAll }, /* X */ - { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, - { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, - { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, - { "BIT", 0x000000C, 0x00, 2, PutAll }, - { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, - { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, - { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, - { "BRK", 0x0000001, 0x00, 0, PutAll }, - { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, - { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, - { "CLC", 0x0000001, 0x18, 0, PutAll }, - { "CLD", 0x0000001, 0xd8, 0, PutAll }, - { "CLI", 0x0000001, 0x58, 0, PutAll }, - { "CLV", 0x0000001, 0xb8, 0, PutAll }, - { "CMP", 0x080A26C, 0xc0, 0, PutAll }, - { "CPX", 0x080000C, 0xe0, 1, PutAll }, - { "CPY", 0x080000C, 0xc0, 1, PutAll }, + { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, + { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, + { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, + { "BIT", 0x000000C, 0x00, 2, PutAll }, + { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, + { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, + { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, + { "BRK", 0x0000001, 0x00, 0, PutAll }, + { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, + { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, + { "CLC", 0x0000001, 0x18, 0, PutAll }, + { "CLD", 0x0000001, 0xd8, 0, PutAll }, + { "CLI", 0x0000001, 0x58, 0, PutAll }, + { "CLV", 0x0000001, 0xb8, 0, PutAll }, + { "CMP", 0x080A26C, 0xc0, 0, PutAll }, + { "CPX", 0x080000C, 0xe0, 1, PutAll }, + { "CPY", 0x080000C, 0xc0, 1, PutAll }, { "DCP", 0x000A26C, 0xC3, 0, PutAll }, /* X */ - { "DEC", 0x000006C, 0x00, 3, PutAll }, - { "DEX", 0x0000001, 0xca, 0, PutAll }, - { "DEY", 0x0000001, 0x88, 0, PutAll }, - { "EOR", 0x080A26C, 0x40, 0, PutAll }, - { "INC", 0x000006c, 0x00, 4, PutAll }, - { "INX", 0x0000001, 0xe8, 0, PutAll }, - { "INY", 0x0000001, 0xc8, 0, PutAll }, + { "DEC", 0x000006C, 0x00, 3, PutAll }, + { "DEX", 0x0000001, 0xca, 0, PutAll }, + { "DEY", 0x0000001, 0x88, 0, PutAll }, + { "EOR", 0x080A26C, 0x40, 0, PutAll }, + { "INC", 0x000006c, 0x00, 4, PutAll }, + { "INX", 0x0000001, 0xe8, 0, PutAll }, + { "INY", 0x0000001, 0xc8, 0, PutAll }, { "ISC", 0x000A26C, 0xE3, 0, PutAll }, /* X */ { "JAM", 0x0000001, 0x02, 0, PutAll }, /* X */ - { "JMP", 0x0000808, 0x4c, 6, PutJMP }, - { "JSR", 0x0000008, 0x20, 7, PutAll }, + { "JMP", 0x0000808, 0x4c, 6, PutJMP }, + { "JSR", 0x0000008, 0x20, 7, PutAll }, { "LAS", 0x0000200, 0xBB, 0, PutAll }, /* X */ { "LAX", 0x000A30C, 0xA3, 1, PutAll }, /* X */ - { "LDA", 0x080A26C, 0xa0, 0, PutAll }, - { "LDX", 0x080030C, 0xa2, 1, PutAll }, - { "LDY", 0x080006C, 0xa0, 1, PutAll }, - { "LSR", 0x000006F, 0x42, 1, PutAll }, - { "NOP", 0x0000001, 0xea, 0, PutAll }, - { "ORA", 0x080A26C, 0x00, 0, PutAll }, - { "PHA", 0x0000001, 0x48, 0, PutAll }, - { "PHP", 0x0000001, 0x08, 0, PutAll }, - { "PLA", 0x0000001, 0x68, 0, PutAll }, - { "PLP", 0x0000001, 0x28, 0, PutAll }, + { "LDA", 0x080A26C, 0xa0, 0, PutAll }, + { "LDX", 0x080030C, 0xa2, 1, PutAll }, + { "LDY", 0x080006C, 0xa0, 1, PutAll }, + { "LSR", 0x000006F, 0x42, 1, PutAll }, + { "NOP", 0x0000001, 0xea, 0, PutAll }, + { "ORA", 0x080A26C, 0x00, 0, PutAll }, + { "PHA", 0x0000001, 0x48, 0, PutAll }, + { "PHP", 0x0000001, 0x08, 0, PutAll }, + { "PLA", 0x0000001, 0x68, 0, PutAll }, + { "PLP", 0x0000001, 0x28, 0, PutAll }, { "RLA", 0x000A26C, 0x23, 0, PutAll }, /* X */ - { "ROL", 0x000006F, 0x22, 1, PutAll }, - { "ROR", 0x000006F, 0x62, 1, PutAll }, + { "ROL", 0x000006F, 0x22, 1, PutAll }, + { "ROR", 0x000006F, 0x62, 1, PutAll }, { "RRA", 0x000A26C, 0x63, 0, PutAll }, /* X */ - { "RTI", 0x0000001, 0x40, 0, PutAll }, - { "RTS", 0x0000001, 0x60, 0, PutAll }, + { "RTI", 0x0000001, 0x40, 0, PutAll }, + { "RTS", 0x0000001, 0x60, 0, PutAll }, { "SAX", 0x000810C, 0x83, 1, PutAll }, /* X */ - { "SBC", 0x080A26C, 0xe0, 0, PutAll }, - { "SEC", 0x0000001, 0x38, 0, PutAll }, - { "SED", 0x0000001, 0xf8, 0, PutAll }, - { "SEI", 0x0000001, 0x78, 0, PutAll }, + { "SBC", 0x080A26C, 0xe0, 0, PutAll }, + { "SEC", 0x0000001, 0x38, 0, PutAll }, + { "SED", 0x0000001, 0xf8, 0, PutAll }, + { "SEI", 0x0000001, 0x78, 0, PutAll }, { "SLO", 0x000A26C, 0x03, 0, PutAll }, /* X */ { "SRE", 0x000A26C, 0x43, 0, PutAll }, /* X */ - { "STA", 0x000A26C, 0x80, 0, PutAll }, - { "STX", 0x000010c, 0x82, 1, PutAll }, - { "STY", 0x000002c, 0x80, 1, PutAll }, - { "TAX", 0x0000001, 0xaa, 0, PutAll }, - { "TAY", 0x0000001, 0xa8, 0, PutAll }, - { "TSX", 0x0000001, 0xba, 0, PutAll }, - { "TXA", 0x0000001, 0x8a, 0, PutAll }, - { "TXS", 0x0000001, 0x9a, 0, PutAll }, - { "TYA", 0x0000001, 0x98, 0, PutAll } + { "STA", 0x000A26C, 0x80, 0, PutAll }, + { "STX", 0x000010c, 0x82, 1, PutAll }, + { "STY", 0x000002c, 0x80, 1, PutAll }, + { "TAX", 0x0000001, 0xaa, 0, PutAll }, + { "TAY", 0x0000001, 0xa8, 0, PutAll }, + { "TSX", 0x0000001, 0xba, 0, PutAll }, + { "TXA", 0x0000001, 0x8a, 0, PutAll }, + { "TXS", 0x0000001, 0x9a, 0, PutAll }, + { "TYA", 0x0000001, 0x98, 0, PutAll } } }; @@ -299,72 +299,72 @@ static const struct { } InsTab65SC02 = { sizeof (InsTab65SC02.Ins) / sizeof (InsTab65SC02.Ins[0]), { - { "ADC", 0x080A66C, 0x60, 0, PutAll }, - { "AND", 0x080A66C, 0x20, 0, PutAll }, - { "ASL", 0x000006e, 0x02, 1, PutAll }, - { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, - { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, - { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, - { "BIT", 0x0A0006C, 0x00, 2, PutAll }, - { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, - { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, - { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, - { "BRA", 0x0020000, 0x80, 0, PutPCRel8 }, - { "BRK", 0x0000001, 0x00, 0, PutAll }, - { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, - { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, - { "CLC", 0x0000001, 0x18, 0, PutAll }, - { "CLD", 0x0000001, 0xd8, 0, PutAll }, - { "CLI", 0x0000001, 0x58, 0, PutAll }, - { "CLV", 0x0000001, 0xb8, 0, PutAll }, - { "CMP", 0x080A66C, 0xc0, 0, PutAll }, - { "CPX", 0x080000C, 0xe0, 1, PutAll }, - { "CPY", 0x080000C, 0xc0, 1, PutAll }, - { "DEA", 0x0000001, 0x00, 3, PutAll }, /* == DEC */ - { "DEC", 0x000006F, 0x00, 3, PutAll }, - { "DEX", 0x0000001, 0xca, 0, PutAll }, - { "DEY", 0x0000001, 0x88, 0, PutAll }, - { "EOR", 0x080A66C, 0x40, 0, PutAll }, - { "INA", 0x0000001, 0x00, 4, PutAll }, /* == INC */ - { "INC", 0x000006f, 0x00, 4, PutAll }, - { "INX", 0x0000001, 0xe8, 0, PutAll }, - { "INY", 0x0000001, 0xc8, 0, PutAll }, - { "JMP", 0x0010808, 0x4c, 6, PutAll }, - { "JSR", 0x0000008, 0x20, 7, PutAll }, - { "LDA", 0x080A66C, 0xa0, 0, PutAll }, - { "LDX", 0x080030C, 0xa2, 1, PutAll }, - { "LDY", 0x080006C, 0xa0, 1, PutAll }, - { "LSR", 0x000006F, 0x42, 1, PutAll }, - { "NOP", 0x0000001, 0xea, 0, PutAll }, - { "ORA", 0x080A66C, 0x00, 0, PutAll }, - { "PHA", 0x0000001, 0x48, 0, PutAll }, - { "PHP", 0x0000001, 0x08, 0, PutAll }, - { "PHX", 0x0000001, 0xda, 0, PutAll }, - { "PHY", 0x0000001, 0x5a, 0, PutAll }, - { "PLA", 0x0000001, 0x68, 0, PutAll }, - { "PLP", 0x0000001, 0x28, 0, PutAll }, - { "PLX", 0x0000001, 0xfa, 0, PutAll }, - { "PLY", 0x0000001, 0x7a, 0, PutAll }, - { "ROL", 0x000006F, 0x22, 1, PutAll }, - { "ROR", 0x000006F, 0x62, 1, PutAll }, - { "RTI", 0x0000001, 0x40, 0, PutAll }, - { "RTS", 0x0000001, 0x60, 0, PutAll }, - { "SBC", 0x080A66C, 0xe0, 0, PutAll }, - { "SEC", 0x0000001, 0x38, 0, PutAll }, - { "SED", 0x0000001, 0xf8, 0, PutAll }, - { "SEI", 0x0000001, 0x78, 0, PutAll }, - { "STA", 0x000A66C, 0x80, 0, PutAll }, - { "STX", 0x000010c, 0x82, 1, PutAll }, - { "STY", 0x000002c, 0x80, 1, PutAll }, - { "STZ", 0x000006c, 0x04, 5, PutAll }, - { "TAX", 0x0000001, 0xaa, 0, PutAll }, - { "TAY", 0x0000001, 0xa8, 0, PutAll }, - { "TRB", 0x000000c, 0x10, 1, PutAll }, - { "TSB", 0x000000c, 0x00, 1, PutAll }, - { "TSX", 0x0000001, 0xba, 0, PutAll }, - { "TXA", 0x0000001, 0x8a, 0, PutAll }, - { "TXS", 0x0000001, 0x9a, 0, PutAll }, - { "TYA", 0x0000001, 0x98, 0, PutAll } + { "ADC", 0x080A66C, 0x60, 0, PutAll }, + { "AND", 0x080A66C, 0x20, 0, PutAll }, + { "ASL", 0x000006e, 0x02, 1, PutAll }, + { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, + { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, + { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, + { "BIT", 0x0A0006C, 0x00, 2, PutAll }, + { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, + { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, + { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, + { "BRA", 0x0020000, 0x80, 0, PutPCRel8 }, + { "BRK", 0x0000001, 0x00, 0, PutAll }, + { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, + { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, + { "CLC", 0x0000001, 0x18, 0, PutAll }, + { "CLD", 0x0000001, 0xd8, 0, PutAll }, + { "CLI", 0x0000001, 0x58, 0, PutAll }, + { "CLV", 0x0000001, 0xb8, 0, PutAll }, + { "CMP", 0x080A66C, 0xc0, 0, PutAll }, + { "CPX", 0x080000C, 0xe0, 1, PutAll }, + { "CPY", 0x080000C, 0xc0, 1, PutAll }, + { "DEA", 0x0000001, 0x00, 3, PutAll }, /* == DEC */ + { "DEC", 0x000006F, 0x00, 3, PutAll }, + { "DEX", 0x0000001, 0xca, 0, PutAll }, + { "DEY", 0x0000001, 0x88, 0, PutAll }, + { "EOR", 0x080A66C, 0x40, 0, PutAll }, + { "INA", 0x0000001, 0x00, 4, PutAll }, /* == INC */ + { "INC", 0x000006f, 0x00, 4, PutAll }, + { "INX", 0x0000001, 0xe8, 0, PutAll }, + { "INY", 0x0000001, 0xc8, 0, PutAll }, + { "JMP", 0x0010808, 0x4c, 6, PutAll }, + { "JSR", 0x0000008, 0x20, 7, PutAll }, + { "LDA", 0x080A66C, 0xa0, 0, PutAll }, + { "LDX", 0x080030C, 0xa2, 1, PutAll }, + { "LDY", 0x080006C, 0xa0, 1, PutAll }, + { "LSR", 0x000006F, 0x42, 1, PutAll }, + { "NOP", 0x0000001, 0xea, 0, PutAll }, + { "ORA", 0x080A66C, 0x00, 0, PutAll }, + { "PHA", 0x0000001, 0x48, 0, PutAll }, + { "PHP", 0x0000001, 0x08, 0, PutAll }, + { "PHX", 0x0000001, 0xda, 0, PutAll }, + { "PHY", 0x0000001, 0x5a, 0, PutAll }, + { "PLA", 0x0000001, 0x68, 0, PutAll }, + { "PLP", 0x0000001, 0x28, 0, PutAll }, + { "PLX", 0x0000001, 0xfa, 0, PutAll }, + { "PLY", 0x0000001, 0x7a, 0, PutAll }, + { "ROL", 0x000006F, 0x22, 1, PutAll }, + { "ROR", 0x000006F, 0x62, 1, PutAll }, + { "RTI", 0x0000001, 0x40, 0, PutAll }, + { "RTS", 0x0000001, 0x60, 0, PutAll }, + { "SBC", 0x080A66C, 0xe0, 0, PutAll }, + { "SEC", 0x0000001, 0x38, 0, PutAll }, + { "SED", 0x0000001, 0xf8, 0, PutAll }, + { "SEI", 0x0000001, 0x78, 0, PutAll }, + { "STA", 0x000A66C, 0x80, 0, PutAll }, + { "STX", 0x000010c, 0x82, 1, PutAll }, + { "STY", 0x000002c, 0x80, 1, PutAll }, + { "STZ", 0x000006c, 0x04, 5, PutAll }, + { "TAX", 0x0000001, 0xaa, 0, PutAll }, + { "TAY", 0x0000001, 0xa8, 0, PutAll }, + { "TRB", 0x000000c, 0x10, 1, PutAll }, + { "TSB", 0x000000c, 0x00, 1, PutAll }, + { "TSX", 0x0000001, 0xba, 0, PutAll }, + { "TXA", 0x0000001, 0x8a, 0, PutAll }, + { "TXS", 0x0000001, 0x9a, 0, PutAll }, + { "TYA", 0x0000001, 0x98, 0, PutAll } } }; @@ -375,9 +375,9 @@ static const struct { } InsTab65C02 = { sizeof (InsTab65C02.Ins) / sizeof (InsTab65C02.Ins[0]), { - { "ADC", 0x080A66C, 0x60, 0, PutAll }, - { "AND", 0x080A66C, 0x20, 0, PutAll }, - { "ASL", 0x000006e, 0x02, 1, PutAll }, + { "ADC", 0x080A66C, 0x60, 0, PutAll }, + { "AND", 0x080A66C, 0x20, 0, PutAll }, + { "ASL", 0x000006e, 0x02, 1, PutAll }, { "BBR0", 0x0000000, 0x0F, 0, PutBitBranch }, { "BBR1", 0x0000000, 0x1F, 0, PutBitBranch }, { "BBR2", 0x0000000, 0x2F, 0, PutBitBranch }, @@ -394,85 +394,85 @@ static const struct { { "BBS5", 0x0000000, 0xDF, 0, PutBitBranch }, { "BBS6", 0x0000000, 0xEF, 0, PutBitBranch }, { "BBS7", 0x0000000, 0xFF, 0, PutBitBranch }, - { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, - { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, - { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, - { "BIT", 0x0A0006C, 0x00, 2, PutAll }, - { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, - { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, - { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, - { "BRA", 0x0020000, 0x80, 0, PutPCRel8 }, - { "BRK", 0x0000001, 0x00, 0, PutAll }, - { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, - { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, - { "CLC", 0x0000001, 0x18, 0, PutAll }, - { "CLD", 0x0000001, 0xd8, 0, PutAll }, - { "CLI", 0x0000001, 0x58, 0, PutAll }, - { "CLV", 0x0000001, 0xb8, 0, PutAll }, - { "CMP", 0x080A66C, 0xc0, 0, PutAll }, - { "CPX", 0x080000C, 0xe0, 1, PutAll }, - { "CPY", 0x080000C, 0xc0, 1, PutAll }, - { "DEA", 0x0000001, 0x00, 3, PutAll }, /* == DEC */ - { "DEC", 0x000006F, 0x00, 3, PutAll }, - { "DEX", 0x0000001, 0xca, 0, PutAll }, - { "DEY", 0x0000001, 0x88, 0, PutAll }, - { "EOR", 0x080A66C, 0x40, 0, PutAll }, - { "INA", 0x0000001, 0x00, 4, PutAll }, /* == INC */ - { "INC", 0x000006f, 0x00, 4, PutAll }, - { "INX", 0x0000001, 0xe8, 0, PutAll }, - { "INY", 0x0000001, 0xc8, 0, PutAll }, - { "JMP", 0x0010808, 0x4c, 6, PutAll }, - { "JSR", 0x0000008, 0x20, 7, PutAll }, - { "LDA", 0x080A66C, 0xa0, 0, PutAll }, - { "LDX", 0x080030C, 0xa2, 1, PutAll }, - { "LDY", 0x080006C, 0xa0, 1, PutAll }, - { "LSR", 0x000006F, 0x42, 1, PutAll }, - { "NOP", 0x0000001, 0xea, 0, PutAll }, - { "ORA", 0x080A66C, 0x00, 0, PutAll }, - { "PHA", 0x0000001, 0x48, 0, PutAll }, - { "PHP", 0x0000001, 0x08, 0, PutAll }, - { "PHX", 0x0000001, 0xda, 0, PutAll }, - { "PHY", 0x0000001, 0x5a, 0, PutAll }, - { "PLA", 0x0000001, 0x68, 0, PutAll }, - { "PLP", 0x0000001, 0x28, 0, PutAll }, - { "PLX", 0x0000001, 0xfa, 0, PutAll }, - { "PLY", 0x0000001, 0x7a, 0, PutAll }, - { "RMB0", 0x0000004, 0x07, 1, PutAll }, - { "RMB1", 0x0000004, 0x17, 1, PutAll }, - { "RMB2", 0x0000004, 0x27, 1, PutAll }, - { "RMB3", 0x0000004, 0x37, 1, PutAll }, - { "RMB4", 0x0000004, 0x47, 1, PutAll }, - { "RMB5", 0x0000004, 0x57, 1, PutAll }, - { "RMB6", 0x0000004, 0x67, 1, PutAll }, - { "RMB7", 0x0000004, 0x77, 1, PutAll }, - { "ROL", 0x000006F, 0x22, 1, PutAll }, - { "ROR", 0x000006F, 0x62, 1, PutAll }, - { "RTI", 0x0000001, 0x40, 0, PutAll }, - { "RTS", 0x0000001, 0x60, 0, PutAll }, - { "SBC", 0x080A66C, 0xe0, 0, PutAll }, - { "SEC", 0x0000001, 0x38, 0, PutAll }, - { "SED", 0x0000001, 0xf8, 0, PutAll }, - { "SEI", 0x0000001, 0x78, 0, PutAll }, - { "SMB0", 0x0000004, 0x87, 1, PutAll }, - { "SMB1", 0x0000004, 0x97, 1, PutAll }, - { "SMB2", 0x0000004, 0xA7, 1, PutAll }, - { "SMB3", 0x0000004, 0xB7, 1, PutAll }, - { "SMB4", 0x0000004, 0xC7, 1, PutAll }, - { "SMB5", 0x0000004, 0xD7, 1, PutAll }, - { "SMB6", 0x0000004, 0xE7, 1, PutAll }, - { "SMB7", 0x0000004, 0xF7, 1, PutAll }, - { "STA", 0x000A66C, 0x80, 0, PutAll }, - { "STX", 0x000010c, 0x82, 1, PutAll }, - { "STY", 0x000002c, 0x80, 1, PutAll }, - { "STZ", 0x000006c, 0x04, 5, PutAll }, - { "TAX", 0x0000001, 0xaa, 0, PutAll }, - { "TAY", 0x0000001, 0xa8, 0, PutAll }, - { "TRB", 0x000000c, 0x10, 1, PutAll }, - { "TSB", 0x000000c, 0x00, 1, PutAll }, - { "TSX", 0x0000001, 0xba, 0, PutAll }, - { "TXA", 0x0000001, 0x8a, 0, PutAll }, - { "TXS", 0x0000001, 0x9a, 0, PutAll }, - { "TYA", 0x0000001, 0x98, 0, PutAll } + { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, + { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, + { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, + { "BIT", 0x0A0006C, 0x00, 2, PutAll }, + { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, + { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, + { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, + { "BRA", 0x0020000, 0x80, 0, PutPCRel8 }, + { "BRK", 0x0000001, 0x00, 0, PutAll }, + { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, + { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, + { "CLC", 0x0000001, 0x18, 0, PutAll }, + { "CLD", 0x0000001, 0xd8, 0, PutAll }, + { "CLI", 0x0000001, 0x58, 0, PutAll }, + { "CLV", 0x0000001, 0xb8, 0, PutAll }, + { "CMP", 0x080A66C, 0xc0, 0, PutAll }, + { "CPX", 0x080000C, 0xe0, 1, PutAll }, + { "CPY", 0x080000C, 0xc0, 1, PutAll }, + { "DEA", 0x0000001, 0x00, 3, PutAll }, /* == DEC */ + { "DEC", 0x000006F, 0x00, 3, PutAll }, + { "DEX", 0x0000001, 0xca, 0, PutAll }, + { "DEY", 0x0000001, 0x88, 0, PutAll }, + { "EOR", 0x080A66C, 0x40, 0, PutAll }, + { "INA", 0x0000001, 0x00, 4, PutAll }, /* == INC */ + { "INC", 0x000006f, 0x00, 4, PutAll }, + { "INX", 0x0000001, 0xe8, 0, PutAll }, + { "INY", 0x0000001, 0xc8, 0, PutAll }, + { "JMP", 0x0010808, 0x4c, 6, PutAll }, + { "JSR", 0x0000008, 0x20, 7, PutAll }, + { "LDA", 0x080A66C, 0xa0, 0, PutAll }, + { "LDX", 0x080030C, 0xa2, 1, PutAll }, + { "LDY", 0x080006C, 0xa0, 1, PutAll }, + { "LSR", 0x000006F, 0x42, 1, PutAll }, + { "NOP", 0x0000001, 0xea, 0, PutAll }, + { "ORA", 0x080A66C, 0x00, 0, PutAll }, + { "PHA", 0x0000001, 0x48, 0, PutAll }, + { "PHP", 0x0000001, 0x08, 0, PutAll }, + { "PHX", 0x0000001, 0xda, 0, PutAll }, + { "PHY", 0x0000001, 0x5a, 0, PutAll }, + { "PLA", 0x0000001, 0x68, 0, PutAll }, + { "PLP", 0x0000001, 0x28, 0, PutAll }, + { "PLX", 0x0000001, 0xfa, 0, PutAll }, + { "PLY", 0x0000001, 0x7a, 0, PutAll }, + { "RMB0", 0x0000004, 0x07, 1, PutAll }, + { "RMB1", 0x0000004, 0x17, 1, PutAll }, + { "RMB2", 0x0000004, 0x27, 1, PutAll }, + { "RMB3", 0x0000004, 0x37, 1, PutAll }, + { "RMB4", 0x0000004, 0x47, 1, PutAll }, + { "RMB5", 0x0000004, 0x57, 1, PutAll }, + { "RMB6", 0x0000004, 0x67, 1, PutAll }, + { "RMB7", 0x0000004, 0x77, 1, PutAll }, + { "ROL", 0x000006F, 0x22, 1, PutAll }, + { "ROR", 0x000006F, 0x62, 1, PutAll }, + { "RTI", 0x0000001, 0x40, 0, PutAll }, + { "RTS", 0x0000001, 0x60, 0, PutAll }, + { "SBC", 0x080A66C, 0xe0, 0, PutAll }, + { "SEC", 0x0000001, 0x38, 0, PutAll }, + { "SED", 0x0000001, 0xf8, 0, PutAll }, + { "SEI", 0x0000001, 0x78, 0, PutAll }, + { "SMB0", 0x0000004, 0x87, 1, PutAll }, + { "SMB1", 0x0000004, 0x97, 1, PutAll }, + { "SMB2", 0x0000004, 0xA7, 1, PutAll }, + { "SMB3", 0x0000004, 0xB7, 1, PutAll }, + { "SMB4", 0x0000004, 0xC7, 1, PutAll }, + { "SMB5", 0x0000004, 0xD7, 1, PutAll }, + { "SMB6", 0x0000004, 0xE7, 1, PutAll }, + { "SMB7", 0x0000004, 0xF7, 1, PutAll }, + { "STA", 0x000A66C, 0x80, 0, PutAll }, + { "STX", 0x000010c, 0x82, 1, PutAll }, + { "STY", 0x000002c, 0x80, 1, PutAll }, + { "STZ", 0x000006c, 0x04, 5, PutAll }, + { "TAX", 0x0000001, 0xaa, 0, PutAll }, + { "TAY", 0x0000001, 0xa8, 0, PutAll }, + { "TRB", 0x000000c, 0x10, 1, PutAll }, + { "TSB", 0x000000c, 0x00, 1, PutAll }, + { "TSX", 0x0000001, 0xba, 0, PutAll }, + { "TXA", 0x0000001, 0x8a, 0, PutAll }, + { "TXS", 0x0000001, 0x9a, 0, PutAll }, + { "TYA", 0x0000001, 0x98, 0, PutAll } } }; @@ -483,105 +483,105 @@ static const struct { } InsTab65816 = { sizeof (InsTab65816.Ins) / sizeof (InsTab65816.Ins[0]), { - { "ADC", 0x0b8f6fc, 0x60, 0, PutAll }, - { "AND", 0x0b8f6fc, 0x20, 0, PutAll }, - { "ASL", 0x000006e, 0x02, 1, PutAll }, - { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, - { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, - { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, - { "BIT", 0x0a0006c, 0x00, 2, PutAll }, - { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, - { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, - { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, - { "BRA", 0x0020000, 0x80, 0, PutPCRel8 }, - { "BRK", 0x0000001, 0x00, 0, PutAll }, - { "BRL", 0x0040000, 0x82, 0, PutPCRel16 }, - { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, - { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, - { "CLC", 0x0000001, 0x18, 0, PutAll }, - { "CLD", 0x0000001, 0xd8, 0, PutAll }, - { "CLI", 0x0000001, 0x58, 0, PutAll }, - { "CLV", 0x0000001, 0xb8, 0, PutAll }, - { "CMP", 0x0b8f6fc, 0xc0, 0, PutAll }, - { "COP", 0x0000004, 0x02, 6, PutAll }, - { "CPA", 0x0b8f6fc, 0xc0, 0, PutAll }, /* == CMP */ - { "CPX", 0x0c0000c, 0xe0, 1, PutAll }, - { "CPY", 0x0c0000c, 0xc0, 1, PutAll }, - { "DEA", 0x0000001, 0x00, 3, PutAll }, /* == DEC */ - { "DEC", 0x000006F, 0x00, 3, PutAll }, - { "DEX", 0x0000001, 0xca, 0, PutAll }, - { "DEY", 0x0000001, 0x88, 0, PutAll }, - { "EOR", 0x0b8f6fc, 0x40, 0, PutAll }, - { "INA", 0x0000001, 0x00, 4, PutAll }, /* == INC */ - { "INC", 0x000006F, 0x00, 4, PutAll }, - { "INX", 0x0000001, 0xe8, 0, PutAll }, - { "INY", 0x0000001, 0xc8, 0, PutAll }, - { "JML", 0x0000810, 0x5c, 1, PutAll }, - { "JMP", 0x0010818, 0x4c, 6, PutAll }, - { "JSL", 0x0000010, 0x20, 7, PutAll }, - { "JSR", 0x0010018, 0x20, 7, PutAll }, - { "LDA", 0x0b8f6fc, 0xa0, 0, PutAll }, - { "LDX", 0x0c0030c, 0xa2, 1, PutAll }, - { "LDY", 0x0c0006c, 0xa0, 1, PutAll }, - { "LSR", 0x000006F, 0x42, 1, PutAll }, - { "MVN", 0x1000000, 0x54, 0, PutBlockMove }, - { "MVP", 0x1000000, 0x44, 0, PutBlockMove }, - { "NOP", 0x0000001, 0xea, 0, PutAll }, - { "ORA", 0x0b8f6fc, 0x00, 0, PutAll }, - { "PEA", 0x0000008, 0xf4, 6, PutAll }, - { "PEI", 0x0000400, 0xd4, 1, PutAll }, - { "PER", 0x0040000, 0x62, 0, PutPCRel16 }, - { "PHA", 0x0000001, 0x48, 0, PutAll }, - { "PHB", 0x0000001, 0x8b, 0, PutAll }, - { "PHD", 0x0000001, 0x0b, 0, PutAll }, - { "PHK", 0x0000001, 0x4b, 0, PutAll }, - { "PHP", 0x0000001, 0x08, 0, PutAll }, - { "PHX", 0x0000001, 0xda, 0, PutAll }, - { "PHY", 0x0000001, 0x5a, 0, PutAll }, - { "PLA", 0x0000001, 0x68, 0, PutAll }, - { "PLB", 0x0000001, 0xab, 0, PutAll }, - { "PLD", 0x0000001, 0x2b, 0, PutAll }, - { "PLP", 0x0000001, 0x28, 0, PutAll }, - { "PLX", 0x0000001, 0xfa, 0, PutAll }, - { "PLY", 0x0000001, 0x7a, 0, PutAll }, - { "REP", 0x0800000, 0xc2, 1, PutREP }, - { "ROL", 0x000006F, 0x22, 1, PutAll }, - { "ROR", 0x000006F, 0x62, 1, PutAll }, - { "RTI", 0x0000001, 0x40, 0, PutAll }, - { "RTL", 0x0000001, 0x6b, 0, PutAll }, - { "RTS", 0x0000001, 0x60, 0, PutRTS }, - { "SBC", 0x0b8f6fc, 0xe0, 0, PutAll }, - { "SEC", 0x0000001, 0x38, 0, PutAll }, - { "SED", 0x0000001, 0xf8, 0, PutAll }, - { "SEI", 0x0000001, 0x78, 0, PutAll }, - { "SEP", 0x0800000, 0xe2, 1, PutSEP }, - { "STA", 0x018f6fc, 0x80, 0, PutAll }, - { "STP", 0x0000001, 0xdb, 0, PutAll }, - { "STX", 0x000010c, 0x82, 1, PutAll }, - { "STY", 0x000002c, 0x80, 1, PutAll }, - { "STZ", 0x000006c, 0x04, 5, PutAll }, - { "SWA", 0x0000001, 0xeb, 0, PutAll }, /* == XBA */ - { "TAD", 0x0000001, 0x5b, 0, PutAll }, /* == TCD */ - { "TAS", 0x0000001, 0x1b, 0, PutAll }, /* == TCS */ - { "TAX", 0x0000001, 0xaa, 0, PutAll }, - { "TAY", 0x0000001, 0xa8, 0, PutAll }, - { "TCD", 0x0000001, 0x5b, 0, PutAll }, - { "TCS", 0x0000001, 0x1b, 0, PutAll }, - { "TDA", 0x0000001, 0x7b, 0, PutAll }, /* == TDC */ - { "TDC", 0x0000001, 0x7b, 0, PutAll }, - { "TRB", 0x000000c, 0x10, 1, PutAll }, - { "TSA", 0x0000001, 0x3b, 0, PutAll }, /* == TSC */ - { "TSB", 0x000000c, 0x00, 1, PutAll }, - { "TSC", 0x0000001, 0x3b, 0, PutAll }, - { "TSX", 0x0000001, 0xba, 0, PutAll }, - { "TXA", 0x0000001, 0x8a, 0, PutAll }, - { "TXS", 0x0000001, 0x9a, 0, PutAll }, - { "TXY", 0x0000001, 0x9b, 0, PutAll }, - { "TYA", 0x0000001, 0x98, 0, PutAll }, - { "TYX", 0x0000001, 0xbb, 0, PutAll }, - { "WAI", 0x0000001, 0xcb, 0, PutAll }, - { "XBA", 0x0000001, 0xeb, 0, PutAll }, - { "XCE", 0x0000001, 0xfb, 0, PutAll } + { "ADC", 0x0b8f6fc, 0x60, 0, PutAll }, + { "AND", 0x0b8f6fc, 0x20, 0, PutAll }, + { "ASL", 0x000006e, 0x02, 1, PutAll }, + { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, + { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, + { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, + { "BIT", 0x0a0006c, 0x00, 2, PutAll }, + { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, + { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, + { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, + { "BRA", 0x0020000, 0x80, 0, PutPCRel8 }, + { "BRK", 0x0000001, 0x00, 0, PutAll }, + { "BRL", 0x0040000, 0x82, 0, PutPCRel16 }, + { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, + { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, + { "CLC", 0x0000001, 0x18, 0, PutAll }, + { "CLD", 0x0000001, 0xd8, 0, PutAll }, + { "CLI", 0x0000001, 0x58, 0, PutAll }, + { "CLV", 0x0000001, 0xb8, 0, PutAll }, + { "CMP", 0x0b8f6fc, 0xc0, 0, PutAll }, + { "COP", 0x0000004, 0x02, 6, PutAll }, + { "CPA", 0x0b8f6fc, 0xc0, 0, PutAll }, /* == CMP */ + { "CPX", 0x0c0000c, 0xe0, 1, PutAll }, + { "CPY", 0x0c0000c, 0xc0, 1, PutAll }, + { "DEA", 0x0000001, 0x00, 3, PutAll }, /* == DEC */ + { "DEC", 0x000006F, 0x00, 3, PutAll }, + { "DEX", 0x0000001, 0xca, 0, PutAll }, + { "DEY", 0x0000001, 0x88, 0, PutAll }, + { "EOR", 0x0b8f6fc, 0x40, 0, PutAll }, + { "INA", 0x0000001, 0x00, 4, PutAll }, /* == INC */ + { "INC", 0x000006F, 0x00, 4, PutAll }, + { "INX", 0x0000001, 0xe8, 0, PutAll }, + { "INY", 0x0000001, 0xc8, 0, PutAll }, + { "JML", 0x0000810, 0x5c, 1, PutAll }, + { "JMP", 0x0010818, 0x4c, 6, PutAll }, + { "JSL", 0x0000010, 0x20, 7, PutAll }, + { "JSR", 0x0010018, 0x20, 7, PutAll }, + { "LDA", 0x0b8f6fc, 0xa0, 0, PutAll }, + { "LDX", 0x0c0030c, 0xa2, 1, PutAll }, + { "LDY", 0x0c0006c, 0xa0, 1, PutAll }, + { "LSR", 0x000006F, 0x42, 1, PutAll }, + { "MVN", 0x1000000, 0x54, 0, PutBlockMove }, + { "MVP", 0x1000000, 0x44, 0, PutBlockMove }, + { "NOP", 0x0000001, 0xea, 0, PutAll }, + { "ORA", 0x0b8f6fc, 0x00, 0, PutAll }, + { "PEA", 0x0000008, 0xf4, 6, PutAll }, + { "PEI", 0x0000400, 0xd4, 1, PutAll }, + { "PER", 0x0040000, 0x62, 0, PutPCRel16 }, + { "PHA", 0x0000001, 0x48, 0, PutAll }, + { "PHB", 0x0000001, 0x8b, 0, PutAll }, + { "PHD", 0x0000001, 0x0b, 0, PutAll }, + { "PHK", 0x0000001, 0x4b, 0, PutAll }, + { "PHP", 0x0000001, 0x08, 0, PutAll }, + { "PHX", 0x0000001, 0xda, 0, PutAll }, + { "PHY", 0x0000001, 0x5a, 0, PutAll }, + { "PLA", 0x0000001, 0x68, 0, PutAll }, + { "PLB", 0x0000001, 0xab, 0, PutAll }, + { "PLD", 0x0000001, 0x2b, 0, PutAll }, + { "PLP", 0x0000001, 0x28, 0, PutAll }, + { "PLX", 0x0000001, 0xfa, 0, PutAll }, + { "PLY", 0x0000001, 0x7a, 0, PutAll }, + { "REP", 0x0800000, 0xc2, 1, PutREP }, + { "ROL", 0x000006F, 0x22, 1, PutAll }, + { "ROR", 0x000006F, 0x62, 1, PutAll }, + { "RTI", 0x0000001, 0x40, 0, PutAll }, + { "RTL", 0x0000001, 0x6b, 0, PutAll }, + { "RTS", 0x0000001, 0x60, 0, PutRTS }, + { "SBC", 0x0b8f6fc, 0xe0, 0, PutAll }, + { "SEC", 0x0000001, 0x38, 0, PutAll }, + { "SED", 0x0000001, 0xf8, 0, PutAll }, + { "SEI", 0x0000001, 0x78, 0, PutAll }, + { "SEP", 0x0800000, 0xe2, 1, PutSEP }, + { "STA", 0x018f6fc, 0x80, 0, PutAll }, + { "STP", 0x0000001, 0xdb, 0, PutAll }, + { "STX", 0x000010c, 0x82, 1, PutAll }, + { "STY", 0x000002c, 0x80, 1, PutAll }, + { "STZ", 0x000006c, 0x04, 5, PutAll }, + { "SWA", 0x0000001, 0xeb, 0, PutAll }, /* == XBA */ + { "TAD", 0x0000001, 0x5b, 0, PutAll }, /* == TCD */ + { "TAS", 0x0000001, 0x1b, 0, PutAll }, /* == TCS */ + { "TAX", 0x0000001, 0xaa, 0, PutAll }, + { "TAY", 0x0000001, 0xa8, 0, PutAll }, + { "TCD", 0x0000001, 0x5b, 0, PutAll }, + { "TCS", 0x0000001, 0x1b, 0, PutAll }, + { "TDA", 0x0000001, 0x7b, 0, PutAll }, /* == TDC */ + { "TDC", 0x0000001, 0x7b, 0, PutAll }, + { "TRB", 0x000000c, 0x10, 1, PutAll }, + { "TSA", 0x0000001, 0x3b, 0, PutAll }, /* == TSC */ + { "TSB", 0x000000c, 0x00, 1, PutAll }, + { "TSC", 0x0000001, 0x3b, 0, PutAll }, + { "TSX", 0x0000001, 0xba, 0, PutAll }, + { "TXA", 0x0000001, 0x8a, 0, PutAll }, + { "TXS", 0x0000001, 0x9a, 0, PutAll }, + { "TXY", 0x0000001, 0x9b, 0, PutAll }, + { "TYA", 0x0000001, 0x98, 0, PutAll }, + { "TYX", 0x0000001, 0xbb, 0, PutAll }, + { "WAI", 0x0000001, 0xcb, 0, PutAll }, + { "XBA", 0x0000001, 0xeb, 0, PutAll }, + { "XCE", 0x0000001, 0xfb, 0, PutAll } } }; @@ -633,9 +633,9 @@ static const struct { } InsTabHuC6280 = { sizeof (InsTabHuC6280.Ins) / sizeof (InsTabHuC6280.Ins[0]), { - { "ADC", 0x080A66C, 0x60, 0, PutAll }, - { "AND", 0x080A66C, 0x20, 0, PutAll }, - { "ASL", 0x000006e, 0x02, 1, PutAll }, + { "ADC", 0x080A66C, 0x60, 0, PutAll }, + { "AND", 0x080A66C, 0x20, 0, PutAll }, + { "ASL", 0x000006e, 0x02, 1, PutAll }, { "BBR0", 0x0000000, 0x0F, 0, PutBitBranch }, { "BBR1", 0x0000000, 0x1F, 0, PutBitBranch }, { "BBR2", 0x0000000, 0x2F, 0, PutBitBranch }, @@ -652,122 +652,122 @@ static const struct { { "BBS5", 0x0000000, 0xDF, 0, PutBitBranch }, { "BBS6", 0x0000000, 0xEF, 0, PutBitBranch }, { "BBS7", 0x0000000, 0xFF, 0, PutBitBranch }, - { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, - { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, - { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, - { "BIT", 0x0A0006C, 0x00, 2, PutAll }, - { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, - { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, - { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, - { "BRA", 0x0020000, 0x80, 0, PutPCRel8 }, - { "BRK", 0x0000001, 0x00, 0, PutAll }, - { "BSR", 0x0020000, 0x44, 0, PutPCRel8 }, - { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, - { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, - { "CLA", 0x0000001, 0x62, 0, PutAll }, - { "CLC", 0x0000001, 0x18, 0, PutAll }, - { "CLD", 0x0000001, 0xd8, 0, PutAll }, - { "CLI", 0x0000001, 0x58, 0, PutAll }, - { "CLV", 0x0000001, 0xb8, 0, PutAll }, - { "CLX", 0x0000001, 0x82, 0, PutAll }, - { "CLY", 0x0000001, 0xc2, 0, PutAll }, - { "CMP", 0x080A66C, 0xc0, 0, PutAll }, - { "CPX", 0x080000C, 0xe0, 1, PutAll }, - { "CPY", 0x080000C, 0xc0, 1, PutAll }, - { "CSH", 0x0000001, 0xd4, 0, PutAll }, - { "CSL", 0x0000001, 0x54, 0, PutAll }, - { "DEA", 0x0000001, 0x00, 3, PutAll }, /* == DEC */ - { "DEC", 0x000006F, 0x00, 3, PutAll }, - { "DEX", 0x0000001, 0xca, 0, PutAll }, - { "DEY", 0x0000001, 0x88, 0, PutAll }, - { "EOR", 0x080A66C, 0x40, 0, PutAll }, - { "INA", 0x0000001, 0x00, 4, PutAll }, /* == INC */ - { "INC", 0x000006f, 0x00, 4, PutAll }, - { "INX", 0x0000001, 0xe8, 0, PutAll }, - { "INY", 0x0000001, 0xc8, 0, PutAll }, - { "JMP", 0x0010808, 0x4c, 6, PutAll }, - { "JSR", 0x0000008, 0x20, 7, PutAll }, - { "LDA", 0x080A66C, 0xa0, 0, PutAll }, - { "LDX", 0x080030C, 0xa2, 1, PutAll }, - { "LDY", 0x080006C, 0xa0, 1, PutAll }, - { "LSR", 0x000006F, 0x42, 1, PutAll }, - { "NOP", 0x0000001, 0xea, 0, PutAll }, - { "ORA", 0x080A66C, 0x00, 0, PutAll }, - { "PHA", 0x0000001, 0x48, 0, PutAll }, - { "PHP", 0x0000001, 0x08, 0, PutAll }, - { "PHX", 0x0000001, 0xda, 0, PutAll }, - { "PHY", 0x0000001, 0x5a, 0, PutAll }, - { "PLA", 0x0000001, 0x68, 0, PutAll }, - { "PLP", 0x0000001, 0x28, 0, PutAll }, - { "PLX", 0x0000001, 0xfa, 0, PutAll }, - { "PLY", 0x0000001, 0x7a, 0, PutAll }, - { "RMB0", 0x0000004, 0x07, 1, PutAll }, - { "RMB1", 0x0000004, 0x17, 1, PutAll }, - { "RMB2", 0x0000004, 0x27, 1, PutAll }, - { "RMB3", 0x0000004, 0x37, 1, PutAll }, - { "RMB4", 0x0000004, 0x47, 1, PutAll }, - { "RMB5", 0x0000004, 0x57, 1, PutAll }, - { "RMB6", 0x0000004, 0x67, 1, PutAll }, - { "RMB7", 0x0000004, 0x77, 1, PutAll }, - { "ROL", 0x000006F, 0x22, 1, PutAll }, - { "ROR", 0x000006F, 0x62, 1, PutAll }, - { "RTI", 0x0000001, 0x40, 0, PutAll }, - { "RTS", 0x0000001, 0x60, 0, PutAll }, - { "SBC", 0x080A66C, 0xe0, 0, PutAll }, - { "SAX", 0x0000001, 0x22, 0, PutAll }, - { "SAY", 0x0000001, 0x42, 0, PutAll }, - { "SEC", 0x0000001, 0x38, 0, PutAll }, - { "SED", 0x0000001, 0xf8, 0, PutAll }, - { "SEI", 0x0000001, 0x78, 0, PutAll }, - { "SET", 0x0000001, 0xf4, 0, PutAll }, - { "SMB0", 0x0000004, 0x87, 1, PutAll }, - { "SMB1", 0x0000004, 0x97, 1, PutAll }, - { "SMB2", 0x0000004, 0xA7, 1, PutAll }, - { "SMB3", 0x0000004, 0xB7, 1, PutAll }, - { "SMB4", 0x0000004, 0xC7, 1, PutAll }, - { "SMB5", 0x0000004, 0xD7, 1, PutAll }, - { "SMB6", 0x0000004, 0xE7, 1, PutAll }, - { "SMB7", 0x0000004, 0xF7, 1, PutAll }, - { "ST0", 0x0800000, 0x03, 1, PutAll }, - { "ST1", 0x0800000, 0x13, 1, PutAll }, - { "ST2", 0x0800000, 0x23, 1, PutAll }, - { "STA", 0x000A66C, 0x80, 0, PutAll }, - { "STX", 0x000010c, 0x82, 1, PutAll }, - { "STY", 0x000002c, 0x80, 1, PutAll }, - { "STZ", 0x000006c, 0x04, 5, PutAll }, - { "SXY", 0x0000001, 0x02, 0, PutAll }, - { "TAI", 0x2000000, 0xf3, 0, PutBlockTransfer }, - { "TAM", 0x0800000, 0x53, 1, PutAll }, - { "TAM0", 0x0000001, 0x01, 0, PutTAMn}, - { "TAM1", 0x0000001, 0x02, 0, PutTAMn}, - { "TAM2", 0x0000001, 0x04, 0, PutTAMn}, - { "TAM3", 0x0000001, 0x08, 0, PutTAMn}, - { "TAM4", 0x0000001, 0x10, 0, PutTAMn}, - { "TAM5", 0x0000001, 0x20, 0, PutTAMn}, - { "TAM6", 0x0000001, 0x40, 0, PutTAMn}, - { "TAM7", 0x0000001, 0x80, 0, PutTAMn}, - { "TAX", 0x0000001, 0xaa, 0, PutAll }, - { "TAY", 0x0000001, 0xa8, 0, PutAll }, - { "TDD", 0x2000000, 0xc3, 0, PutBlockTransfer }, - { "TIA", 0x2000000, 0xe3, 0, PutBlockTransfer }, - { "TII", 0x2000000, 0x73, 0, PutBlockTransfer }, - { "TIN", 0x2000000, 0xD3, 0, PutBlockTransfer }, - { "TMA", 0x0800000, 0x43, 1, PutTMA }, - { "TMA0", 0x0000001, 0x01, 0, PutTMAn}, - { "TMA1", 0x0000001, 0x02, 0, PutTMAn}, - { "TMA2", 0x0000001, 0x04, 0, PutTMAn}, - { "TMA3", 0x0000001, 0x08, 0, PutTMAn}, - { "TMA4", 0x0000001, 0x10, 0, PutTMAn}, - { "TMA5", 0x0000001, 0x20, 0, PutTMAn}, - { "TMA6", 0x0000001, 0x40, 0, PutTMAn}, - { "TMA7", 0x0000001, 0x80, 0, PutTMAn}, - { "TRB", 0x000000c, 0x10, 1, PutAll }, - { "TSB", 0x000000c, 0x00, 1, PutAll }, + { "BCC", 0x0020000, 0x90, 0, PutPCRel8 }, + { "BCS", 0x0020000, 0xb0, 0, PutPCRel8 }, + { "BEQ", 0x0020000, 0xf0, 0, PutPCRel8 }, + { "BIT", 0x0A0006C, 0x00, 2, PutAll }, + { "BMI", 0x0020000, 0x30, 0, PutPCRel8 }, + { "BNE", 0x0020000, 0xd0, 0, PutPCRel8 }, + { "BPL", 0x0020000, 0x10, 0, PutPCRel8 }, + { "BRA", 0x0020000, 0x80, 0, PutPCRel8 }, + { "BRK", 0x0000001, 0x00, 0, PutAll }, + { "BSR", 0x0020000, 0x44, 0, PutPCRel8 }, + { "BVC", 0x0020000, 0x50, 0, PutPCRel8 }, + { "BVS", 0x0020000, 0x70, 0, PutPCRel8 }, + { "CLA", 0x0000001, 0x62, 0, PutAll }, + { "CLC", 0x0000001, 0x18, 0, PutAll }, + { "CLD", 0x0000001, 0xd8, 0, PutAll }, + { "CLI", 0x0000001, 0x58, 0, PutAll }, + { "CLV", 0x0000001, 0xb8, 0, PutAll }, + { "CLX", 0x0000001, 0x82, 0, PutAll }, + { "CLY", 0x0000001, 0xc2, 0, PutAll }, + { "CMP", 0x080A66C, 0xc0, 0, PutAll }, + { "CPX", 0x080000C, 0xe0, 1, PutAll }, + { "CPY", 0x080000C, 0xc0, 1, PutAll }, + { "CSH", 0x0000001, 0xd4, 0, PutAll }, + { "CSL", 0x0000001, 0x54, 0, PutAll }, + { "DEA", 0x0000001, 0x00, 3, PutAll }, /* == DEC */ + { "DEC", 0x000006F, 0x00, 3, PutAll }, + { "DEX", 0x0000001, 0xca, 0, PutAll }, + { "DEY", 0x0000001, 0x88, 0, PutAll }, + { "EOR", 0x080A66C, 0x40, 0, PutAll }, + { "INA", 0x0000001, 0x00, 4, PutAll }, /* == INC */ + { "INC", 0x000006f, 0x00, 4, PutAll }, + { "INX", 0x0000001, 0xe8, 0, PutAll }, + { "INY", 0x0000001, 0xc8, 0, PutAll }, + { "JMP", 0x0010808, 0x4c, 6, PutAll }, + { "JSR", 0x0000008, 0x20, 7, PutAll }, + { "LDA", 0x080A66C, 0xa0, 0, PutAll }, + { "LDX", 0x080030C, 0xa2, 1, PutAll }, + { "LDY", 0x080006C, 0xa0, 1, PutAll }, + { "LSR", 0x000006F, 0x42, 1, PutAll }, + { "NOP", 0x0000001, 0xea, 0, PutAll }, + { "ORA", 0x080A66C, 0x00, 0, PutAll }, + { "PHA", 0x0000001, 0x48, 0, PutAll }, + { "PHP", 0x0000001, 0x08, 0, PutAll }, + { "PHX", 0x0000001, 0xda, 0, PutAll }, + { "PHY", 0x0000001, 0x5a, 0, PutAll }, + { "PLA", 0x0000001, 0x68, 0, PutAll }, + { "PLP", 0x0000001, 0x28, 0, PutAll }, + { "PLX", 0x0000001, 0xfa, 0, PutAll }, + { "PLY", 0x0000001, 0x7a, 0, PutAll }, + { "RMB0", 0x0000004, 0x07, 1, PutAll }, + { "RMB1", 0x0000004, 0x17, 1, PutAll }, + { "RMB2", 0x0000004, 0x27, 1, PutAll }, + { "RMB3", 0x0000004, 0x37, 1, PutAll }, + { "RMB4", 0x0000004, 0x47, 1, PutAll }, + { "RMB5", 0x0000004, 0x57, 1, PutAll }, + { "RMB6", 0x0000004, 0x67, 1, PutAll }, + { "RMB7", 0x0000004, 0x77, 1, PutAll }, + { "ROL", 0x000006F, 0x22, 1, PutAll }, + { "ROR", 0x000006F, 0x62, 1, PutAll }, + { "RTI", 0x0000001, 0x40, 0, PutAll }, + { "RTS", 0x0000001, 0x60, 0, PutAll }, + { "SBC", 0x080A66C, 0xe0, 0, PutAll }, + { "SAX", 0x0000001, 0x22, 0, PutAll }, + { "SAY", 0x0000001, 0x42, 0, PutAll }, + { "SEC", 0x0000001, 0x38, 0, PutAll }, + { "SED", 0x0000001, 0xf8, 0, PutAll }, + { "SEI", 0x0000001, 0x78, 0, PutAll }, + { "SET", 0x0000001, 0xf4, 0, PutAll }, + { "SMB0", 0x0000004, 0x87, 1, PutAll }, + { "SMB1", 0x0000004, 0x97, 1, PutAll }, + { "SMB2", 0x0000004, 0xA7, 1, PutAll }, + { "SMB3", 0x0000004, 0xB7, 1, PutAll }, + { "SMB4", 0x0000004, 0xC7, 1, PutAll }, + { "SMB5", 0x0000004, 0xD7, 1, PutAll }, + { "SMB6", 0x0000004, 0xE7, 1, PutAll }, + { "SMB7", 0x0000004, 0xF7, 1, PutAll }, + { "ST0", 0x0800000, 0x03, 1, PutAll }, + { "ST1", 0x0800000, 0x13, 1, PutAll }, + { "ST2", 0x0800000, 0x23, 1, PutAll }, + { "STA", 0x000A66C, 0x80, 0, PutAll }, + { "STX", 0x000010c, 0x82, 1, PutAll }, + { "STY", 0x000002c, 0x80, 1, PutAll }, + { "STZ", 0x000006c, 0x04, 5, PutAll }, + { "SXY", 0x0000001, 0x02, 0, PutAll }, + { "TAI", 0x2000000, 0xf3, 0, PutBlockTransfer }, + { "TAM", 0x0800000, 0x53, 1, PutAll }, + { "TAM0", 0x0000001, 0x01, 0, PutTAMn}, + { "TAM1", 0x0000001, 0x02, 0, PutTAMn}, + { "TAM2", 0x0000001, 0x04, 0, PutTAMn}, + { "TAM3", 0x0000001, 0x08, 0, PutTAMn}, + { "TAM4", 0x0000001, 0x10, 0, PutTAMn}, + { "TAM5", 0x0000001, 0x20, 0, PutTAMn}, + { "TAM6", 0x0000001, 0x40, 0, PutTAMn}, + { "TAM7", 0x0000001, 0x80, 0, PutTAMn}, + { "TAX", 0x0000001, 0xaa, 0, PutAll }, + { "TAY", 0x0000001, 0xa8, 0, PutAll }, + { "TDD", 0x2000000, 0xc3, 0, PutBlockTransfer }, + { "TIA", 0x2000000, 0xe3, 0, PutBlockTransfer }, + { "TII", 0x2000000, 0x73, 0, PutBlockTransfer }, + { "TIN", 0x2000000, 0xD3, 0, PutBlockTransfer }, + { "TMA", 0x0800000, 0x43, 1, PutTMA }, + { "TMA0", 0x0000001, 0x01, 0, PutTMAn}, + { "TMA1", 0x0000001, 0x02, 0, PutTMAn}, + { "TMA2", 0x0000001, 0x04, 0, PutTMAn}, + { "TMA3", 0x0000001, 0x08, 0, PutTMAn}, + { "TMA4", 0x0000001, 0x10, 0, PutTMAn}, + { "TMA5", 0x0000001, 0x20, 0, PutTMAn}, + { "TMA6", 0x0000001, 0x40, 0, PutTMAn}, + { "TMA7", 0x0000001, 0x80, 0, PutTMAn}, + { "TRB", 0x000000c, 0x10, 1, PutAll }, + { "TSB", 0x000000c, 0x00, 1, PutAll }, { "TST", 0x000006c, 0x83, 9, PutTST }, - { "TSX", 0x0000001, 0xba, 0, PutAll }, - { "TXA", 0x0000001, 0x8a, 0, PutAll }, - { "TXS", 0x0000001, 0x9a, 0, PutAll }, - { "TYA", 0x0000001, 0x98, 0, PutAll } + { "TSX", 0x0000001, 0xba, 0, PutAll }, + { "TXA", 0x0000001, 0x8a, 0, PutAll }, + { "TXS", 0x0000001, 0x9a, 0, PutAll }, + { "TYA", 0x0000001, 0x98, 0, PutAll } } }; @@ -797,64 +797,64 @@ const InsTable* InsTab = (const InsTable*) &InsTab6502; */ static unsigned char EATab[10][AM65I_COUNT] = { { /* Table 0 */ - 0x00, 0x00, 0x05, 0x0D, 0x0F, 0x15, 0x1D, 0x1F, - 0x00, 0x19, 0x12, 0x00, 0x07, 0x11, 0x17, 0x01, - 0x00, 0x00, 0x00, 0x03, 0x13, 0x09, 0x00, 0x09, - 0x00, 0x00 + 0x00, 0x00, 0x05, 0x0D, 0x0F, 0x15, 0x1D, 0x1F, + 0x00, 0x19, 0x12, 0x00, 0x07, 0x11, 0x17, 0x01, + 0x00, 0x00, 0x00, 0x03, 0x13, 0x09, 0x00, 0x09, + 0x00, 0x00 }, { /* Table 1 */ - 0x08, 0x08, 0x04, 0x0C, 0x00, 0x14, 0x1C, 0x00, - 0x14, 0x1C, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 + 0x08, 0x08, 0x04, 0x0C, 0x00, 0x14, 0x1C, 0x00, + 0x14, 0x1C, 0x00, 0x80, 0x00, 0x10, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 }, { /* Table 2 */ - 0x00, 0x00, 0x24, 0x2C, 0x0F, 0x34, 0x3C, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, - 0x00, 0x00 + 0x00, 0x00, 0x24, 0x2C, 0x0F, 0x34, 0x3C, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, + 0x00, 0x00 }, { /* Table 3 */ - 0x3A, 0x3A, 0xC6, 0xCE, 0x00, 0xD6, 0xDE, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 + 0x3A, 0x3A, 0xC6, 0xCE, 0x00, 0xD6, 0xDE, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 }, { /* Table 4 */ - 0x1A, 0x1A, 0xE6, 0xEE, 0x00, 0xF6, 0xFE, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 + 0x1A, 0x1A, 0xE6, 0xEE, 0x00, 0xF6, 0xFE, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 }, { /* Table 5 */ - 0x00, 0x00, 0x60, 0x98, 0x00, 0x70, 0x9E, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 + 0x00, 0x00, 0x60, 0x98, 0x00, 0x70, 0x9E, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 }, { /* Table 6 */ - 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, - 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 }, { /* Table 7 */ - 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 + 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 }, { /* Table 8 */ - 0x00, 0x40, 0x01, 0x41, 0x00, 0x09, 0x49, 0x00, - 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, - 0x00, 0x00 + 0x00, 0x40, 0x01, 0x41, 0x00, 0x09, 0x49, 0x00, + 0x00, 0x00, 0x00, 0x51, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, + 0x00, 0x00 }, { /* Table 9 */ - 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x30, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00 + 0x00, 0x00, 0x00, 0x10, 0x00, 0x20, 0x30, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00 }, }; @@ -863,41 +863,41 @@ static unsigned char EATab[10][AM65I_COUNT] = { */ static unsigned char Sweet16EATab[2][AMSW16I_COUNT] = { { /* Table 0 */ - 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, }, { /* Table 1 */ - 0x00, 0x00, 0x00, 0x40, 0x20, + 0x00, 0x00, 0x00, 0x40, 0x20, }, }; /* Table that encodes the additional bytes for each 65xx instruction */ unsigned char ExtBytes[AM65I_COUNT] = { - 0, /* Implicit */ - 0, /* Accu */ - 1, /* Direct */ - 2, /* Absolute */ - 3, /* Absolute long */ - 1, /* Direct,X */ - 2, /* Absolute,X */ - 3, /* Absolute long,X */ - 1, /* Direct,Y */ - 2, /* Absolute,Y */ - 1, /* (Direct) */ - 2, /* (Absolute) */ - 1, /* [Direct] */ - 1, /* (Direct),Y */ - 1, /* [Direct],Y */ - 1, /* (Direct,X) */ - 2, /* (Absolute,X) */ - 1, /* Relative short */ - 2, /* Relative long */ - 1, /* r,s */ - 1, /* (r,s),y */ - 1, /* Immidiate accu */ - 1, /* Immidiate index */ - 1, /* Immidiate byte */ - 2, /* Blockmove (65816) */ - 7, /* Block transfer (HuC6280) */ + 0, /* Implicit */ + 0, /* Accu */ + 1, /* Direct */ + 2, /* Absolute */ + 3, /* Absolute long */ + 1, /* Direct,X */ + 2, /* Absolute,X */ + 3, /* Absolute long,X */ + 1, /* Direct,Y */ + 2, /* Absolute,Y */ + 1, /* (Direct) */ + 2, /* (Absolute) */ + 1, /* [Direct] */ + 1, /* (Direct),Y */ + 1, /* [Direct],Y */ + 1, /* (Direct,X) */ + 2, /* (Absolute,X) */ + 1, /* Relative short */ + 2, /* Relative long */ + 1, /* r,s */ + 1, /* (r,s),y */ + 1, /* Immidiate accu */ + 1, /* Immidiate index */ + 1, /* Immidiate byte */ + 2, /* Blockmove (65816) */ + 7, /* Block transfer (HuC6280) */ }; /* Table that encodes the additional bytes for each SWEET16 instruction */ @@ -989,8 +989,8 @@ static int EvalEA (const InsDesc* Ins, EffAddr* A) /* Check if we have any adressing modes left */ if (A->AddrModeSet == 0) { - Error ("Illegal addressing mode"); - return 0; + Error ("Illegal addressing mode"); + return 0; } A->AddrMode = BitFind (A->AddrModeSet); A->AddrModeBit = (0x01UL << A->AddrMode); @@ -1042,32 +1042,32 @@ static void EmitCode (EffAddr* A) switch (ExtBytes[A->AddrMode]) { case 0: - Emit0 (A->Opcode); - break; + Emit0 (A->Opcode); + break; - case 1: - Emit1 (A->Opcode, A->Expr); - break; + case 1: + Emit1 (A->Opcode, A->Expr); + break; - case 2: - if (CPU == CPU_65816 && (A->AddrModeBit & (AM65_ABS | AM65_ABS_X | AM65_ABS_Y))) { - /* This is a 16 bit mode that uses an address. If in 65816, - * mode, force this address into 16 bit range to allow - * addressing inside a 64K segment. - */ - Emit2 (A->Opcode, GenWordExpr (A->Expr)); - } else { - Emit2 (A->Opcode, A->Expr); - } - break; + case 2: + if (CPU == CPU_65816 && (A->AddrModeBit & (AM65_ABS | AM65_ABS_X | AM65_ABS_Y))) { + /* This is a 16 bit mode that uses an address. If in 65816, + * mode, force this address into 16 bit range to allow + * addressing inside a 64K segment. + */ + Emit2 (A->Opcode, GenWordExpr (A->Expr)); + } else { + Emit2 (A->Opcode, A->Expr); + } + break; - case 3: + case 3: /* Far argument */ - Emit3 (A->Opcode, A->Expr); - break; + Emit3 (A->Opcode, A->Expr); + break; - default: - Internal ("Invalid operand byte count: %u", ExtBytes[A->AddrMode]); + default: + Internal ("Invalid operand byte count: %u", ExtBytes[A->AddrMode]); } } @@ -1096,12 +1096,12 @@ static long PutImmed8 (const InsDesc* Ins) /* Check how many extension bytes are needed and output the instruction */ switch (ExtBytes[A.AddrMode]) { - case 1: - Emit1 (A.Opcode, A.Expr); - break; + case 1: + Emit1 (A.Opcode, A.Expr); + break; - default: - Internal ("Invalid operand byte count: %u", ExtBytes[A.AddrMode]); + default: + Internal ("Invalid operand byte count: %u", ExtBytes[A.AddrMode]); } /* Return the expression value */ @@ -1170,20 +1170,20 @@ static void PutREP (const InsDesc* Ins) /* We track the status only for the 816 CPU and in smart mode */ if (CPU == CPU_65816 && SmartMode) { - /* Check the range for Val. */ - if (Val < 0) { - /* We had an error */ - Warning (1, "Cannot track processor status byte"); - } else { - if (Val & 0x10) { - /* Index registers to 16 bit */ - ExtBytes[AM65I_IMM_INDEX] = 2; - } - if (Val & 0x20) { - /* Accu to 16 bit */ - ExtBytes[AM65I_IMM_ACCU] = 2; - } - } + /* Check the range for Val. */ + if (Val < 0) { + /* We had an error */ + Warning (1, "Cannot track processor status byte"); + } else { + if (Val & 0x10) { + /* Index registers to 16 bit */ + ExtBytes[AM65I_IMM_INDEX] = 2; + } + if (Val & 0x20) { + /* Accu to 16 bit */ + ExtBytes[AM65I_IMM_ACCU] = 2; + } + } } } @@ -1198,20 +1198,20 @@ static void PutSEP (const InsDesc* Ins) /* We track the status only for the 816 CPU and in smart mode */ if (CPU == CPU_65816 && SmartMode) { - /* Check the range for Val. */ - if (Val < 0) { - /* We had an error */ - Warning (1, "Cannot track processor status byte"); - } else { - if (Val & 0x10) { - /* Index registers to 8 bit */ - ExtBytes[AM65I_IMM_INDEX] = 1; - } - if (Val & 0x20) { - /* Accu to 8 bit */ - ExtBytes[AM65I_IMM_ACCU] = 1; - } - } + /* Check the range for Val. */ + if (Val < 0) { + /* We had an error */ + Warning (1, "Cannot track processor status byte"); + } else { + if (Val & 0x10) { + /* Index registers to 8 bit */ + ExtBytes[AM65I_IMM_INDEX] = 1; + } + if (Val & 0x20) { + /* Accu to 8 bit */ + ExtBytes[AM65I_IMM_ACCU] = 1; + } + } } } @@ -1394,8 +1394,8 @@ static void PutSweet16 (const InsDesc* Ins) /* Check if we have any adressing modes left */ if (A.AddrModeSet == 0) { - Error ("Illegal addressing mode"); - return; + Error ("Illegal addressing mode"); + return; } A.AddrMode = BitFind (A.AddrModeSet); A.AddrModeBit = (0x01UL << A.AddrMode); @@ -1407,19 +1407,19 @@ static void PutSweet16 (const InsDesc* Ins) switch (Sweet16ExtBytes[A.AddrMode]) { case 0: - Emit0 (A.Opcode); - break; + Emit0 (A.Opcode); + break; - case 1: - Emit1 (A.Opcode, A.Expr); - break; + case 1: + Emit1 (A.Opcode, A.Expr); + break; - case 2: + case 2: Emit2 (A.Opcode, A.Expr); - break; + break; - default: - Internal ("Invalid operand byte count: %u", Sweet16ExtBytes[A.AddrMode]); + default: + Internal ("Invalid operand byte count: %u", Sweet16ExtBytes[A.AddrMode]); } } @@ -1435,7 +1435,7 @@ static void PutSweet16Branch (const InsDesc* Ins) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -1456,10 +1456,10 @@ void SetCPU (cpu_t NewCPU) /* Check if we have support for the new CPU, if so, use it */ if (NewCPU != CPU_UNKNOWN && InsTabs[NewCPU]) { - CPU = NewCPU; - InsTab = InsTabs[CPU]; + CPU = NewCPU; + InsTab = InsTabs[CPU]; } else { - Error ("CPU not supported"); + Error ("CPU not supported"); } } @@ -1508,11 +1508,11 @@ int FindInstruction (const StrBuf* Ident) /* Search for the key */ ID = bsearch (Key, InsTab->Ins, InsTab->Count, sizeof (InsDesc), CmpName); if (ID == 0) { - /* Not found */ - return -1; + /* Not found */ + return -1; } else { - /* Found, return the entry */ - return ID - InsTab->Ins; + /* Found, return the entry */ + return ID - InsTab->Ins; } } diff --git a/src/ca65/instr.h b/src/ca65/instr.h index 7d39dbeaf..9a219b424 100644 --- a/src/ca65/instr.h +++ b/src/ca65/instr.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* instr.h */ +/* instr.h */ /* */ -/* Instruction encoding for the ca65 macroassembler */ +/* Instruction encoding for the ca65 macroassembler */ /* */ /* */ /* */ @@ -58,18 +58,18 @@ * When assembling for the 6502 or 65C02, all addressing modes that are not * available on these CPUs are removed before doing any checks. */ -#define AM65_IMPLICIT 0x00000003UL -#define AM65_ACCU 0x00000002UL -#define AM65_DIR 0x00000004UL -#define AM65_ABS 0x00000008UL -#define AM65_ABS_LONG 0x00000010UL -#define AM65_DIR_X 0x00000020UL -#define AM65_ABS_X 0x00000040UL -#define AM65_ABS_LONG_X 0x00000080UL +#define AM65_IMPLICIT 0x00000003UL +#define AM65_ACCU 0x00000002UL +#define AM65_DIR 0x00000004UL +#define AM65_ABS 0x00000008UL +#define AM65_ABS_LONG 0x00000010UL +#define AM65_DIR_X 0x00000020UL +#define AM65_ABS_X 0x00000040UL +#define AM65_ABS_LONG_X 0x00000080UL #define AM65_DIR_Y 0x00000100UL #define AM65_ABS_Y 0x00000200UL #define AM65_DIR_IND 0x00000400UL -#define AM65_ABS_IND 0x00000800UL +#define AM65_ABS_IND 0x00000800UL #define AM65_DIR_IND_LONG 0x00001000UL #define AM65_DIR_IND_Y 0x00002000UL #define AM65_DIR_IND_LONG_Y 0x00004000UL @@ -79,14 +79,14 @@ #define AM65_REL_LONG 0x00040000UL #define AM65_STACK_REL 0x00080000UL #define AM65_STACK_REL_IND_Y 0x00100000UL -#define AM65_IMM_ACCU 0x00200000UL -#define AM65_IMM_INDEX 0x00400000UL -#define AM65_IMM_IMPLICIT 0x00800000UL +#define AM65_IMM_ACCU 0x00200000UL +#define AM65_IMM_INDEX 0x00400000UL +#define AM65_IMM_IMPLICIT 0x00800000UL #define AM65_BLOCKMOVE 0x01000000UL #define AM65_BLOCKXFER 0x02000000UL /* Bitmask for all ZP operations that have correspondent ABS ops */ -#define AM65_SET_ZP (AM65_DIR | AM65_DIR_X | AM65_DIR_Y | AM65_DIR_IND | AM65_DIR_X_IND) +#define AM65_SET_ZP (AM65_DIR | AM65_DIR_X | AM65_DIR_Y | AM65_DIR_IND | AM65_DIR_X_IND) /* Bitmask for all ABS operations that have correspondent FAR ops */ #define AM65_SET_ABS (AM65_ABS | AM65_ABS_X) @@ -104,28 +104,28 @@ #define AM65_ALL_IMM (AM65_IMM_ACCU | AM65_IMM_INDEX | AM65_IMM_IMPLICIT) /* Bit numbers and count */ -#define AM65I_IMM_ACCU 21 -#define AM65I_IMM_INDEX 22 +#define AM65I_IMM_ACCU 21 +#define AM65I_IMM_INDEX 22 #define AM65I_IMM_IMPLICIT 23 -#define AM65I_COUNT 26 +#define AM65I_COUNT 26 /* Description for one instruction */ typedef struct InsDesc InsDesc; struct InsDesc { - char Mnemonic[5]; - unsigned long AddrMode; /* Valid adressing modes */ - unsigned char BaseCode; /* Base opcode */ - unsigned char ExtCode; /* Number of ext code table */ - void (*Emit) (const InsDesc*);/* Handler function */ + char Mnemonic[5]; + unsigned long AddrMode; /* Valid adressing modes */ + unsigned char BaseCode; /* Base opcode */ + unsigned char ExtCode; /* Number of ext code table */ + void (*Emit) (const InsDesc*);/* Handler function */ }; /* An instruction table */ typedef struct InsTable InsTable; struct InsTable { - unsigned Count; /* Number of intstructions */ - InsDesc Ins[1]; /* Varying length */ + unsigned Count; /* Number of intstructions */ + InsDesc Ins[1]; /* Varying length */ }; /* The instruction table for the currently active CPU */ @@ -154,7 +154,7 @@ extern unsigned char ExtBytes[AM65I_COUNT]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/istack.c b/src/ca65/istack.c index e9af45f2b..507d56ba5 100644 --- a/src/ca65/istack.c +++ b/src/ca65/istack.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* istack.c */ +/* istack.c */ /* */ -/* Input stack for the scanner */ +/* Input stack for the scanner */ /* */ /* */ /* */ @@ -44,31 +44,31 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Size of the stack (== maximum nested macro or repeat count) */ -#define ISTACK_MAX 256 +#define ISTACK_MAX 256 /* Structure holding a stack element */ typedef struct IElement IElement; struct IElement { - IElement* Next; /* Next stack element */ - int (*Func)(void*); /* Function called for input */ - void* Data; /* User data given as argument */ - const char* Desc; /* Description */ + IElement* Next; /* Next stack element */ + int (*Func)(void*); /* Function called for input */ + void* Data; /* User data given as argument */ + const char* Desc; /* Description */ }; /* The stack */ -static IElement* IStack = 0; /* Input stack pointer */ -static unsigned ICount = 0; /* Number of items on the stack */ +static IElement* IStack = 0; /* Input stack pointer */ +static unsigned ICount = 0; /* Number of items on the stack */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -80,7 +80,7 @@ void PushInput (int (*Func) (void*), void* Data, const char* Desc) /* Check for a stack overflow */ if (ICount > ISTACK_MAX) { - Fatal ("Maximum input stack nesting exceeded"); + Fatal ("Maximum input stack nesting exceeded"); } /* Create a new stack element */ @@ -127,10 +127,10 @@ int InputFromStack (void) * routines. */ while (IStack) { - if (IStack->Func (IStack->Data) != 0) { - /* We have a token */ - return 1; - } + if (IStack->Func (IStack->Data) != 0) { + /* We have a token */ + return 1; + } } /* Nothing is on the stack */ @@ -153,7 +153,7 @@ void CheckInputStack (void) */ { if (IStack) { - Error ("Open %s", IStack->Desc); + Error ("Open %s", IStack->Desc); } } diff --git a/src/ca65/istack.h b/src/ca65/istack.h index 5529c7911..06ff066e4 100644 --- a/src/ca65/istack.h +++ b/src/ca65/istack.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* istack.h */ +/* istack.h */ /* */ -/* Input stack for the scanner */ +/* Input stack for the scanner */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/lineinfo.c b/src/ca65/lineinfo.c index 25ef376a9..dbc5b4d41 100644 --- a/src/ca65/lineinfo.c +++ b/src/ca65/lineinfo.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* lineinfo.c */ +/* lineinfo.c */ /* */ -/* Source file line info structure */ +/* Source file line info structure */ /* */ /* */ /* */ @@ -72,7 +72,7 @@ static int HT_Compare (const void* Key1, const void* Key2); /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -231,7 +231,7 @@ static int CheckLineInfo (void* Entry, void* Data attribute ((unused))) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/lineinfo.h b/src/ca65/lineinfo.h index 94b51ae4f..41b44c0bc 100644 --- a/src/ca65/lineinfo.h +++ b/src/ca65/lineinfo.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* lineinfo.h */ +/* lineinfo.h */ /* */ /* Source file line info management */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,7 +58,7 @@ typedef struct LineInfo LineInfo; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/listing.c b/src/ca65/listing.c index d1682ee15..8bd8833dd 100644 --- a/src/ca65/listing.c +++ b/src/ca65/listing.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* listing.c */ +/* listing.c */ /* */ -/* Listing support for the ca65 crossassembler */ +/* Listing support for the ca65 crossassembler */ /* */ /* */ /* */ @@ -55,29 +55,29 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Single linked list of lines */ -ListLine* LineList = 0; /* List of listing lines */ -ListLine* LineCur = 0; /* Current listing line */ -ListLine* LineLast = 0; /* Last (current) listing line */ +ListLine* LineList = 0; /* List of listing lines */ +ListLine* LineCur = 0; /* Current listing line */ +ListLine* LineLast = 0; /* Last (current) listing line */ /* Page and other formatting */ -int PageLength = -1; /* Length of a listing page */ -static unsigned PageNumber = 1; /* Current listing page number */ -static int PageLines = 0; /* Current line on page */ -static unsigned ListBytes = 12; /* Number of bytes to list for one line */ +int PageLength = -1; /* Length of a listing page */ +static unsigned PageNumber = 1; /* Current listing page number */ +static int PageLines = 0; /* Current line on page */ +static unsigned ListBytes = 12; /* Number of bytes to list for one line */ /* Switch the listing on/off */ -static int ListingEnabled = 1; /* Enabled if > 0 */ +static int ListingEnabled = 1; /* Enabled if > 0 */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -88,39 +88,39 @@ void NewListingLine (const StrBuf* Line, unsigned char File, unsigned char Depth /* Store only if listing is enabled */ if (SB_GetLen (&ListingName) > 0) { - ListLine* L; + ListLine* L; - /* Get the length of the line */ - unsigned Len = SB_GetLen (Line); + /* Get the length of the line */ + unsigned Len = SB_GetLen (Line); - /* Ignore trailing newlines */ - while (Len > 0 && SB_AtUnchecked (Line, Len-1) == '\n') { - --Len; - } + /* Ignore trailing newlines */ + while (Len > 0 && SB_AtUnchecked (Line, Len-1) == '\n') { + --Len; + } - /* Allocate memory */ - L = xmalloc (sizeof (ListLine) + Len); + /* Allocate memory */ + L = xmalloc (sizeof (ListLine) + Len); - /* Initialize the fields. */ - L->Next = 0; - L->FragList = 0; - L->FragLast = 0; - L->PC = GetPC (); - L->Reloc = GetRelocMode (); - L->File = File; - L->Depth = Depth; - L->Output = (ListingEnabled > 0); - L->ListBytes = (unsigned char) ListBytes; - memcpy (L->Line, SB_GetConstBuf (Line), Len); - L->Line[Len] = '\0'; + /* Initialize the fields. */ + L->Next = 0; + L->FragList = 0; + L->FragLast = 0; + L->PC = GetPC (); + L->Reloc = GetRelocMode (); + L->File = File; + L->Depth = Depth; + L->Output = (ListingEnabled > 0); + L->ListBytes = (unsigned char) ListBytes; + memcpy (L->Line, SB_GetConstBuf (Line), Len); + L->Line[Len] = '\0'; - /* Insert the line into the list of lines */ - if (LineList == 0) { - LineList = L; - } else { - LineLast->Next = L; - } - LineLast = L; + /* Insert the line into the list of lines */ + if (LineList == 0) { + LineList = L; + } else { + LineLast->Next = L; + } + LineLast = L; } } @@ -130,12 +130,12 @@ void EnableListing (void) /* Enable output of lines to the listing */ { if (SB_GetLen (&ListingName) > 0) { - /* If we're about to enable the listing, do this for the current line - * also, so we will see the source line that did this. - */ - if (ListingEnabled++ == 0) { - LineCur->Output = 1; - } + /* If we're about to enable the listing, do this for the current line + * also, so we will see the source line that did this. + */ + if (ListingEnabled++ == 0) { + LineCur->Output = 1; + } } } @@ -145,12 +145,12 @@ void DisableListing (void) /* Disable output of lines to the listing */ { if (SB_GetLen (&ListingName) > 0) { - if (ListingEnabled == 0) { - /* Cannot switch the listing off once more */ - Error ("Counter underflow"); - } else { - --ListingEnabled; - } + if (ListingEnabled == 0) { + /* Cannot switch the listing off once more */ + Error ("Counter underflow"); + } else { + --ListingEnabled; + } } } @@ -160,7 +160,7 @@ void SetListBytes (int Bytes) /* Set the maximum number of bytes listed for one line */ { if (Bytes < 0) { - Bytes = 0; /* Encode "unlimited" as zero */ + Bytes = 0; /* Encode "unlimited" as zero */ } ListBytes = Bytes; } @@ -171,30 +171,30 @@ void InitListingLine (void) /* Initialize the current listing line */ { if (SB_GetLen (&ListingName) > 0) { - /* Make the last loaded line the current line */ - /* ###### This code is a hack! We really need to do it right - * as soon as we know, how:-( - */ - if (LineCur && LineCur->Next && LineCur->Next != LineLast) { - ListLine* L = LineCur; - do { - L = L->Next; - /* Set the values for this line */ - CHECK (L != 0); - L->PC = GetPC (); - L->Reloc = GetRelocMode (); - L->Output = (ListingEnabled > 0); - L->ListBytes = (unsigned char) ListBytes; - } while (L->Next != LineLast); - } - LineCur = LineLast; + /* Make the last loaded line the current line */ + /* ###### This code is a hack! We really need to do it right + * as soon as we know, how:-( + */ + if (LineCur && LineCur->Next && LineCur->Next != LineLast) { + ListLine* L = LineCur; + do { + L = L->Next; + /* Set the values for this line */ + CHECK (L != 0); + L->PC = GetPC (); + L->Reloc = GetRelocMode (); + L->Output = (ListingEnabled > 0); + L->ListBytes = (unsigned char) ListBytes; + } while (L->Next != LineLast); + } + LineCur = LineLast; - /* Set the values for this line */ - CHECK (LineCur != 0); - LineCur->PC = GetPC (); - LineCur->Reloc = GetRelocMode (); - LineCur->Output = (ListingEnabled > 0); - LineCur->ListBytes = (unsigned char) ListBytes; + /* Set the values for this line */ + CHECK (LineCur != 0); + LineCur->PC = GetPC (); + LineCur->Reloc = GetRelocMode (); + LineCur->Output = (ListingEnabled > 0); + LineCur->ListBytes = (unsigned char) ListBytes; } } @@ -204,7 +204,7 @@ static char* AddHex (char* S, unsigned Val) /* Add a hex byte in ASCII to the given string and return the new pointer */ { static const char HexTab [16] = { - '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' + '0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F' }; *S++ = HexTab [(Val >> 4) & 0x0F]; @@ -225,13 +225,13 @@ static void PrintPageHeader (FILE* F, const ListLine* L) /* Print the header on the new page */ fprintf (F, - "ca65 V%s\n" - "Main file : %s\n" - "Current file: %.*s\n" - "\n", - GetVersionAsString (), - InFile, - (int) SB_GetLen (CurFile), SB_GetConstBuf (CurFile)); + "ca65 V%s\n" + "Main file : %s\n" + "Current file: %.*s\n" + "\n", + GetVersionAsString (), + InFile, + (int) SB_GetLen (CurFile), SB_GetConstBuf (CurFile)); /* Count pages, reset lines */ ++PageNumber; @@ -253,10 +253,10 @@ static void PrintLine (FILE* F, const char* Header, const char* Line, const List * the last one, to avoid pages that consist of just the header. */ if (PageLength > 0 && PageLines >= PageLength && L->Next != 0) { - /* Do a formfeed */ - putc ('\f', F); - /* Print the header on the new page */ - PrintPageHeader (F, L); + /* Do a formfeed */ + putc ('\f', F); + /* Print the header on the new page */ + PrintPageHeader (F, L); } } @@ -304,7 +304,7 @@ void CreateListing (void) /* Open the real listing file */ F = fopen (SB_GetConstBuf (&ListingName), "w"); if (F == 0) { - Fatal ("Cannot open listing file `%s': %s", + Fatal ("Cannot open listing file `%s': %s", SB_GetConstBuf (&ListingName), strerror (errno)); } @@ -320,132 +320,132 @@ void CreateListing (void) L = LineList; while (L) { - char* Buf; - char* B; - unsigned Count; - unsigned I; - char* Line; + char* Buf; + char* B; + unsigned Count; + unsigned I; + char* Line; - /* If we should not output this line, go to the next */ - if (L->Output == 0) { - L = L->Next; - continue; - } + /* If we should not output this line, go to the next */ + if (L->Output == 0) { + L = L->Next; + continue; + } - /* If we don't have a fragment list for this line, things are easy */ - if (L->FragList == 0) { - PrintLine (F, MakeLineHeader (HeaderBuf, L), L->Line, L); - L = L->Next; - continue; - } + /* If we don't have a fragment list for this line, things are easy */ + if (L->FragList == 0) { + PrintLine (F, MakeLineHeader (HeaderBuf, L), L->Line, L); + L = L->Next; + continue; + } - /* Count the number of bytes in the complete fragment list */ - Count = 0; - Frag = L->FragList; - while (Frag) { - Count += Frag->Len; - Frag = Frag->LineList; - } + /* Count the number of bytes in the complete fragment list */ + Count = 0; + Frag = L->FragList; + while (Frag) { + Count += Frag->Len; + Frag = Frag->LineList; + } - /* Allocate memory for the given number of bytes */ - Buf = xmalloc (Count*2+1); + /* Allocate memory for the given number of bytes */ + Buf = xmalloc (Count*2+1); - /* Copy an ASCII representation of the bytes into the buffer */ - B = Buf; - Frag = L->FragList; - while (Frag) { + /* Copy an ASCII representation of the bytes into the buffer */ + B = Buf; + Frag = L->FragList; + while (Frag) { - /* Write data depending on the type */ - switch (Frag->Type) { + /* Write data depending on the type */ + switch (Frag->Type) { - case FRAG_LITERAL: - for (I = 0; I < Frag->Len; ++I) { - B = AddHex (B, Frag->V.Data[I]); - } - break; + case FRAG_LITERAL: + for (I = 0; I < Frag->Len; ++I) { + B = AddHex (B, Frag->V.Data[I]); + } + break; - case FRAG_EXPR: - case FRAG_SEXPR: - B = AddMult (B, 'r', Frag->Len*2); - break; + case FRAG_EXPR: + case FRAG_SEXPR: + B = AddMult (B, 'r', Frag->Len*2); + break; - case FRAG_FILL: - B = AddMult (B, 'x', Frag->Len*2); - break; + case FRAG_FILL: + B = AddMult (B, 'x', Frag->Len*2); + break; - default: - Internal ("Invalid fragment type: %u", Frag->Type); + default: + Internal ("Invalid fragment type: %u", Frag->Type); - } + } - /* Next fragment */ - Frag = Frag->LineList; + /* Next fragment */ + Frag = Frag->LineList; - } + } - /* Limit the number of bytes actually printed */ - if (L->ListBytes != 0) { - /* Not unlimited */ - if (Count > L->ListBytes) { - Count = L->ListBytes; - } - } + /* Limit the number of bytes actually printed */ + if (L->ListBytes != 0) { + /* Not unlimited */ + if (Count > L->ListBytes) { + Count = L->ListBytes; + } + } - /* Output the data. The format of a listing line is: - * - * PPPPPPm I 11 22 33 44 - * - * where - * - * PPPPPP is the PC - * m is the mode ('r' or empty) - * I is the include level - * 11 .. are code or data bytes - */ - Line = L->Line; - B = Buf; - while (Count) { + /* Output the data. The format of a listing line is: + * + * PPPPPPm I 11 22 33 44 + * + * where + * + * PPPPPP is the PC + * m is the mode ('r' or empty) + * I is the include level + * 11 .. are code or data bytes + */ + Line = L->Line; + B = Buf; + while (Count) { - unsigned Chunk; - char* P; + unsigned Chunk; + char* P; - /* Prepare the line header */ - MakeLineHeader (HeaderBuf, L); + /* Prepare the line header */ + MakeLineHeader (HeaderBuf, L); - /* Get the number of bytes for the next line */ - Chunk = Count; - if (Chunk > 4) { - Chunk = 4; - } - Count -= Chunk; + /* Get the number of bytes for the next line */ + Chunk = Count; + if (Chunk > 4) { + Chunk = 4; + } + Count -= Chunk; - /* Increment the program counter. Since we don't need the PC stored - * in the LineList object for anything else, just increment this - * variable. - */ - L->PC += Chunk; + /* Increment the program counter. Since we don't need the PC stored + * in the LineList object for anything else, just increment this + * variable. + */ + L->PC += Chunk; - /* Copy the bytes into the line */ - P = HeaderBuf + 11; - for (I = 0; I < Chunk; ++I) { - *P++ = *B++; - *P++ = *B++; - *P++ = ' '; - } + /* Copy the bytes into the line */ + P = HeaderBuf + 11; + for (I = 0; I < Chunk; ++I) { + *P++ = *B++; + *P++ = *B++; + *P++ = ' '; + } - /* Output this line */ - PrintLine (F, HeaderBuf, Line, L); + /* Output this line */ + PrintLine (F, HeaderBuf, Line, L); - /* Don't output a line twice */ - Line = ""; + /* Don't output a line twice */ + Line = ""; - } + } - /* Delete the temporary buffer */ - xfree (Buf); + /* Delete the temporary buffer */ + xfree (Buf); - /* Next line */ - L = L->Next; + /* Next line */ + L = L->Next; } diff --git a/src/ca65/listing.h b/src/ca65/listing.h index 33debd524..bea716bf1 100644 --- a/src/ca65/listing.h +++ b/src/ca65/listing.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* listing.h */ +/* listing.h */ /* */ -/* Listing support for the ca65 crossassembler */ +/* Listing support for the ca65 crossassembler */ /* */ /* */ /* */ @@ -54,47 +54,47 @@ struct StrBuf; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Length of the header of a listing line */ -#define LINE_HEADER_LEN 24 +#define LINE_HEADER_LEN 24 /* One listing line as it is stored in memory */ typedef struct ListLine ListLine; struct ListLine { - ListLine* Next; /* Pointer to next line */ - Fragment* FragList; /* List of fragments for this line */ - Fragment* FragLast; /* Last entry in fragment list */ - unsigned long PC; /* Program counter for this line */ - unsigned char Reloc; /* Relocatable mode? */ - unsigned char File; /* From which file is the line? */ - unsigned char Depth; /* Include depth */ - unsigned char Output; /* Should we output this line? */ - unsigned char ListBytes; /* How many bytes at max? */ - char Line[1]; /* Line with dynamic length */ + ListLine* Next; /* Pointer to next line */ + Fragment* FragList; /* List of fragments for this line */ + Fragment* FragLast; /* Last entry in fragment list */ + unsigned long PC; /* Program counter for this line */ + unsigned char Reloc; /* Relocatable mode? */ + unsigned char File; /* From which file is the line? */ + unsigned char Depth; /* Include depth */ + unsigned char Output; /* Should we output this line? */ + unsigned char ListBytes; /* How many bytes at max? */ + char Line[1]; /* Line with dynamic length */ }; /* Single linked list of lines */ -extern ListLine* LineList; /* List of listing lines */ -extern ListLine* LineCur; /* Current listing line */ -extern ListLine* LineLast; /* Last listing line */ +extern ListLine* LineList; /* List of listing lines */ +extern ListLine* LineCur; /* Current listing line */ +extern ListLine* LineLast; /* Last listing line */ /* Page formatting */ -#define MIN_PAGE_LEN 32 -#define MAX_PAGE_LEN 127 -extern int PageLength; /* Length of a listing page */ +#define MIN_PAGE_LEN 32 +#define MAX_PAGE_LEN 127 +extern int PageLength; /* Length of a listing page */ /* Byte for one listing line */ -#define MIN_LIST_BYTES 4 -#define MAX_LIST_BYTES 255 +#define MIN_LIST_BYTES 4 +#define MAX_LIST_BYTES 255 /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/macro.c b/src/ca65/macro.c index 719e76f0a..75741c479 100644 --- a/src/ca65/macro.c +++ b/src/ca65/macro.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* macro.c */ +/* macro.c */ /* */ -/* Macros for the ca65 macroassembler */ +/* Macros for the ca65 macroassembler */ /* */ /* */ /* */ @@ -77,7 +77,7 @@ static int HT_Compare (const void* Key1, const void* Key2); /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -85,7 +85,7 @@ static int HT_Compare (const void* Key1, const void* Key2); /* Struct that describes an identifer (macro param, local list) */ typedef struct IdDesc IdDesc; struct IdDesc { - IdDesc* Next; /* Linked list */ + IdDesc* Next; /* Linked list */ StrBuf Id; /* Identifier, dynamically allocated */ }; @@ -94,17 +94,17 @@ struct IdDesc { /* Struct that describes a macro definition */ struct Macro { HashNode Node; /* Hash list node */ - Macro* List; /* List of all macros */ - unsigned LocalCount; /* Count of local symbols */ - IdDesc* Locals; /* List of local symbols */ - unsigned ParamCount; /* Parameter count of macro */ - IdDesc* Params; /* Identifiers of macro parameters */ - unsigned TokCount; /* Number of tokens for this macro */ - TokNode* TokRoot; /* Root of token list */ - TokNode* TokLast; /* Pointer to last token in list */ - StrBuf Name; /* Macro name, dynamically allocated */ + Macro* List; /* List of all macros */ + unsigned LocalCount; /* Count of local symbols */ + IdDesc* Locals; /* List of local symbols */ + unsigned ParamCount; /* Parameter count of macro */ + IdDesc* Params; /* Identifiers of macro parameters */ + unsigned TokCount; /* Number of tokens for this macro */ + TokNode* TokRoot; /* Root of token list */ + TokNode* TokLast; /* Pointer to last token in list */ + StrBuf Name; /* Macro name, dynamically allocated */ unsigned Expansions; /* Number of active macro expansions */ - unsigned char Style; /* Macro style */ + unsigned char Style; /* Macro style */ unsigned char Incomplete; /* Macro is currently built */ }; @@ -121,16 +121,16 @@ static HashTable MacroTab = STATIC_HASHTABLE_INITIALIZER (117, &HashFunc); /* Structs that holds data for a macro expansion */ typedef struct MacExp MacExp; struct MacExp { - MacExp* Next; /* Pointer to next expansion */ - Macro* M; /* Which macro do we expand? */ - unsigned IfSP; /* .IF stack pointer at start of expansion */ - TokNode* Exp; /* Pointer to current token */ - TokNode* Final; /* Pointer to final token */ + MacExp* Next; /* Pointer to next expansion */ + Macro* M; /* Which macro do we expand? */ + unsigned IfSP; /* .IF stack pointer at start of expansion */ + TokNode* Exp; /* Pointer to current token */ + TokNode* Final; /* Pointer to final token */ unsigned MacExpansions; /* Number of active macro expansions */ - unsigned LocalStart; /* Start of counter for local symbol names */ - unsigned ParamCount; /* Number of actual parameters */ - TokNode** Params; /* List of actual parameters */ - TokNode* ParamExp; /* Node for expanding parameters */ + unsigned LocalStart; /* Start of counter for local symbol names */ + unsigned ParamCount; /* Number of actual parameters */ + TokNode** Params; /* List of actual parameters */ + TokNode* ParamExp; /* Node for expanding parameters */ LineInfo* LI; /* Line info for the expansion */ LineInfo* ParamLI; /* Line info for parameter expansion */ }; @@ -186,7 +186,7 @@ static int HT_Compare (const void* Key1, const void* Key2) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -244,13 +244,13 @@ static Macro* NewMacro (const StrBuf* Name, unsigned char Style) M->Locals = 0; M->ParamCount = 0; M->Params = 0; - M->TokCount = 0; + M->TokCount = 0; M->TokRoot = 0; M->TokLast = 0; SB_Init (&M->Name); SB_Copy (&M->Name, Name); M->Expansions = 0; - M->Style = Style; + M->Style = Style; M->Incomplete = 1; /* Insert the macro into the hash table */ @@ -297,19 +297,19 @@ static MacExp* NewMacExp (Macro* M) MacExp* E = xmalloc (sizeof (MacExp)); /* Initialize the data */ - E->M = M; - E->IfSP = GetIfStack (); - E->Exp = M->TokRoot; - E->Final = 0; + E->M = M; + E->IfSP = GetIfStack (); + E->Exp = M->TokRoot; + E->Final = 0; E->MacExpansions = ++MacExpansions; /* One macro expansion more */ E->LocalStart = LocalName; LocalName += M->LocalCount; E->ParamCount = 0; E->Params = xmalloc (M->ParamCount * sizeof (TokNode*)); for (I = 0; I < M->ParamCount; ++I) { - E->Params[I] = 0; + E->Params[I] = 0; } - E->ParamExp = 0; + E->ParamExp = 0; E->LI = 0; E->ParamLI = 0; @@ -355,7 +355,7 @@ static void FreeMacExp (MacExp* E) /* Free the final token if we have one */ if (E->Final) { - FreeTokNode (E->Final); + FreeTokNode (E->Final); } /* Free the structure itself */ @@ -368,18 +368,18 @@ static void MacSkipDef (unsigned Style) /* Skip a macro definition */ { if (Style == MAC_STYLE_CLASSIC) { - /* Skip tokens until we reach the final .endmacro */ - while (CurTok.Tok != TOK_ENDMACRO && CurTok.Tok != TOK_EOF) { - NextTok (); - } - if (CurTok.Tok != TOK_EOF) { - SkipUntilSep (); - } else { - Error ("`.ENDMACRO' expected"); - } + /* Skip tokens until we reach the final .endmacro */ + while (CurTok.Tok != TOK_ENDMACRO && CurTok.Tok != TOK_EOF) { + NextTok (); + } + if (CurTok.Tok != TOK_EOF) { + SkipUntilSep (); + } else { + Error ("`.ENDMACRO' expected"); + } } else { - /* Skip until end of line */ - SkipUntilSep (); + /* Skip until end of line */ + SkipUntilSep (); } } @@ -394,9 +394,9 @@ void MacDef (unsigned Style) /* We expect a macro name here */ if (CurTok.Tok != TOK_IDENT) { - Error ("Identifier expected"); - MacSkipDef (Style); - return; + Error ("Identifier expected"); + MacSkipDef (Style); + return; } else if (!UbiquitousIdents && FindInstruction (&CurTok.SVal) >= 0) { /* The identifier is a name of a 6502 instruction, which is not * allowed if not explicitly enabled. @@ -408,11 +408,11 @@ void MacDef (unsigned Style) /* Did we already define that macro? */ if (HT_Find (&MacroTab, &CurTok.SVal) != 0) { - /* Macro is already defined */ - Error ("A macro named `%m%p' is already defined", &CurTok.SVal); - /* Skip tokens until we reach the final .endmacro */ - MacSkipDef (Style); - return; + /* Macro is already defined */ + Error ("A macro named `%m%p' is already defined", &CurTok.SVal); + /* Skip tokens until we reach the final .endmacro */ + MacSkipDef (Style); + return; } /* Define the macro */ @@ -426,62 +426,62 @@ void MacDef (unsigned Style) * otherwise we may have parameters without braces. */ if (Style == MAC_STYLE_CLASSIC) { - HaveParams = 1; + HaveParams = 1; } else { - if (CurTok.Tok == TOK_LPAREN) { - HaveParams = 1; - NextTok (); - } else { - HaveParams = 0; - } + if (CurTok.Tok == TOK_LPAREN) { + HaveParams = 1; + NextTok (); + } else { + HaveParams = 0; + } } /* Parse the parameter list */ if (HaveParams) { - while (CurTok.Tok == TOK_IDENT) { + while (CurTok.Tok == TOK_IDENT) { - /* Create a struct holding the identifier */ - IdDesc* I = NewIdDesc (&CurTok.SVal); + /* Create a struct holding the identifier */ + IdDesc* I = NewIdDesc (&CurTok.SVal); - /* Insert the struct into the list, checking for duplicate idents */ - if (M->ParamCount == 0) { - M->Params = I; - } else { - IdDesc* List = M->Params; - while (1) { - if (SB_Compare (&List->Id, &CurTok.SVal) == 0) { - Error ("Duplicate symbol `%m%p'", &CurTok.SVal); - } - if (List->Next == 0) { - break; - } else { - List = List->Next; - } - } - List->Next = I; - } - ++M->ParamCount; + /* Insert the struct into the list, checking for duplicate idents */ + if (M->ParamCount == 0) { + M->Params = I; + } else { + IdDesc* List = M->Params; + while (1) { + if (SB_Compare (&List->Id, &CurTok.SVal) == 0) { + Error ("Duplicate symbol `%m%p'", &CurTok.SVal); + } + if (List->Next == 0) { + break; + } else { + List = List->Next; + } + } + List->Next = I; + } + ++M->ParamCount; - /* Skip the name */ - NextTok (); + /* Skip the name */ + NextTok (); - /* Maybe there are more params... */ - if (CurTok.Tok == TOK_COMMA) { - NextTok (); - } else { - break; - } - } + /* Maybe there are more params... */ + if (CurTok.Tok == TOK_COMMA) { + NextTok (); + } else { + break; + } + } } /* For class macros, we expect a separator token, for define style macros, * we expect the closing paren. */ if (Style == MAC_STYLE_CLASSIC) { - ConsumeSep (); + ConsumeSep (); } else if (HaveParams) { - ConsumeRParen (); + ConsumeRParen (); } /* Preparse the macro body. We will read the tokens until we reach end of @@ -491,98 +491,98 @@ void MacDef (unsigned Style) */ while (1) { - /* Check for end of macro */ - if (Style == MAC_STYLE_CLASSIC) { - /* In classic macros, only .endmacro is allowed */ - if (CurTok.Tok == TOK_ENDMACRO) { - /* Done */ - break; - } - /* May not have end of file in a macro definition */ - if (CurTok.Tok == TOK_EOF) { - Error ("`.ENDMACRO' expected"); - goto Done; - } - } else { - /* Accept a newline or end of file for new style macros */ - if (TokIsSep (CurTok.Tok)) { - break; - } - } + /* Check for end of macro */ + if (Style == MAC_STYLE_CLASSIC) { + /* In classic macros, only .endmacro is allowed */ + if (CurTok.Tok == TOK_ENDMACRO) { + /* Done */ + break; + } + /* May not have end of file in a macro definition */ + if (CurTok.Tok == TOK_EOF) { + Error ("`.ENDMACRO' expected"); + goto Done; + } + } else { + /* Accept a newline or end of file for new style macros */ + if (TokIsSep (CurTok.Tok)) { + break; + } + } - /* Check for a .LOCAL declaration */ - if (CurTok.Tok == TOK_LOCAL && Style == MAC_STYLE_CLASSIC) { + /* Check for a .LOCAL declaration */ + if (CurTok.Tok == TOK_LOCAL && Style == MAC_STYLE_CLASSIC) { - while (1) { + while (1) { - IdDesc* I; + IdDesc* I; - /* Skip .local or comma */ - NextTok (); + /* Skip .local or comma */ + NextTok (); - /* Need an identifer */ - if (CurTok.Tok != TOK_IDENT && CurTok.Tok != TOK_LOCAL_IDENT) { - Error ("Identifier expected"); - SkipUntilSep (); - break; - } + /* Need an identifer */ + if (CurTok.Tok != TOK_IDENT && CurTok.Tok != TOK_LOCAL_IDENT) { + Error ("Identifier expected"); + SkipUntilSep (); + break; + } - /* Put the identifier into the locals list and skip it */ - I = NewIdDesc (&CurTok.SVal); - I->Next = M->Locals; - M->Locals = I; - ++M->LocalCount; - NextTok (); + /* Put the identifier into the locals list and skip it */ + I = NewIdDesc (&CurTok.SVal); + I->Next = M->Locals; + M->Locals = I; + ++M->LocalCount; + NextTok (); - /* Check for end of list */ - if (CurTok.Tok != TOK_COMMA) { - break; - } + /* Check for end of list */ + if (CurTok.Tok != TOK_COMMA) { + break; + } - } + } - /* We need end of line after the locals */ - ConsumeSep (); - continue; - } + /* We need end of line after the locals */ + ConsumeSep (); + continue; + } - /* Create a token node for the current token */ - N = NewTokNode (); + /* Create a token node for the current token */ + N = NewTokNode (); /* If the token is an identifier, check if it is a local parameter */ - if (CurTok.Tok == TOK_IDENT) { - unsigned Count = 0; - IdDesc* I = M->Params; - while (I) { - if (SB_Compare (&I->Id, &CurTok.SVal) == 0) { - /* Local param name, replace it */ - N->T.Tok = TOK_MACPARAM; - N->T.IVal = Count; - break; - } - ++Count; - I = I->Next; - } - } + if (CurTok.Tok == TOK_IDENT) { + unsigned Count = 0; + IdDesc* I = M->Params; + while (I) { + if (SB_Compare (&I->Id, &CurTok.SVal) == 0) { + /* Local param name, replace it */ + N->T.Tok = TOK_MACPARAM; + N->T.IVal = Count; + break; + } + ++Count; + I = I->Next; + } + } - /* Insert the new token in the list */ - if (M->TokCount == 0) { - /* First token */ - M->TokRoot = M->TokLast = N; - } else { - /* We have already tokens */ - M->TokLast->Next = N; - M->TokLast = N; - } - ++M->TokCount; + /* Insert the new token in the list */ + if (M->TokCount == 0) { + /* First token */ + M->TokRoot = M->TokLast = N; + } else { + /* We have already tokens */ + M->TokLast->Next = N; + M->TokLast = N; + } + ++M->TokCount; - /* Read the next token */ - NextTok (); + /* Read the next token */ + NextTok (); } /* Skip the .endmacro for a classic macro */ if (Style == MAC_STYLE_CLASSIC) { - NextTok (); + NextTok (); } /* Reset the Incomplete flag now that parsing is done */ @@ -634,14 +634,14 @@ static int MacExpand (void* Data) /* Check if we should abort this macro */ if (DoMacAbort) { - /* Reset the flag */ - DoMacAbort = 0; + /* Reset the flag */ + DoMacAbort = 0; - /* Abort any open .IF statements in this macro expansion */ - CleanupIfStack (Mac->IfSP); + /* Abort any open .IF statements in this macro expansion */ + CleanupIfStack (Mac->IfSP); - /* Terminate macro expansion */ - goto MacEnd; + /* Terminate macro expansion */ + goto MacEnd; } /* We're expanding a macro. Check if we are expanding one of the @@ -650,8 +650,8 @@ static int MacExpand (void* Data) ExpandParam: if (Mac->ParamExp) { - /* Ok, use token from parameter list */ - TokSet (Mac->ParamExp); + /* Ok, use token from parameter list */ + TokSet (Mac->ParamExp); /* Create new line info for this parameter token */ if (Mac->ParamLI) { @@ -659,11 +659,11 @@ ExpandParam: } Mac->ParamLI = StartLine (&CurTok.Pos, LI_TYPE_MACPARAM, Mac->MacExpansions); - /* Set pointer to next token */ - Mac->ParamExp = Mac->ParamExp->Next; + /* Set pointer to next token */ + Mac->ParamExp = Mac->ParamExp->Next; - /* Done */ - return 1; + /* Done */ + return 1; } else if (Mac->ParamLI) { @@ -678,8 +678,8 @@ ExpandParam: */ if (Mac->Exp) { - /* Use next macro token */ - TokSet (Mac->Exp); + /* Use next macro token */ + TokSet (Mac->Exp); /* Create new line info for this token */ if (Mac->LI) { @@ -687,35 +687,35 @@ ExpandParam: } Mac->LI = StartLine (&CurTok.Pos, LI_TYPE_MACRO, Mac->MacExpansions); - /* Set pointer to next token */ - Mac->Exp = Mac->Exp->Next; + /* Set pointer to next token */ + Mac->Exp = Mac->Exp->Next; - /* Is it a request for actual parameter count? */ - if (CurTok.Tok == TOK_PARAMCOUNT) { - CurTok.Tok = TOK_INTCON; - CurTok.IVal = Mac->ParamCount; - return 1; - } + /* Is it a request for actual parameter count? */ + if (CurTok.Tok == TOK_PARAMCOUNT) { + CurTok.Tok = TOK_INTCON; + CurTok.IVal = Mac->ParamCount; + return 1; + } - /* Is it the name of a macro parameter? */ - if (CurTok.Tok == TOK_MACPARAM) { + /* Is it the name of a macro parameter? */ + if (CurTok.Tok == TOK_MACPARAM) { - /* Start to expand the parameter token list */ - Mac->ParamExp = Mac->Params[CurTok.IVal]; + /* Start to expand the parameter token list */ + Mac->ParamExp = Mac->Params[CurTok.IVal]; - /* Go back and expand the parameter */ - goto ExpandParam; - } + /* Go back and expand the parameter */ + goto ExpandParam; + } - /* If it's an identifier, it may in fact be a local symbol */ - if ((CurTok.Tok == TOK_IDENT || CurTok.Tok == TOK_LOCAL_IDENT) && + /* If it's an identifier, it may in fact be a local symbol */ + if ((CurTok.Tok == TOK_IDENT || CurTok.Tok == TOK_LOCAL_IDENT) && Mac->M->LocalCount) { - /* Search for the local symbol in the list */ - unsigned Index = 0; - IdDesc* I = Mac->M->Locals; - while (I) { - if (SB_Compare (&CurTok.SVal, &I->Id) == 0) { - /* This is in fact a local symbol, change the name. Be sure + /* Search for the local symbol in the list */ + unsigned Index = 0; + IdDesc* I = Mac->M->Locals; + while (I) { + if (SB_Compare (&CurTok.SVal, &I->Id) == 0) { + /* This is in fact a local symbol, change the name. Be sure * to generate a local label name if the original name was * a local label, and also generate a name that cannot be * generated by a user. @@ -729,28 +729,28 @@ ExpandParam: SB_Printf (&CurTok.SVal, "LOCAL-MACRO_SYMBOL-%04X", Mac->LocalStart + Index); } - break; - } - /* Next symbol */ - ++Index; - I = I->Next; - } + break; + } + /* Next symbol */ + ++Index; + I = I->Next; + } - /* Done */ - return 1; - } + /* Done */ + return 1; + } - /* The token was successfully set */ - return 1; + /* The token was successfully set */ + return 1; } /* No more macro tokens. Do we have a final token? */ if (Mac->Final) { - /* Set the final token and remove it */ - TokSet (Mac->Final); - FreeTokNode (Mac->Final); - Mac->Final = 0; + /* Set the final token and remove it */ + TokSet (Mac->Final); + FreeTokNode (Mac->Final); + Mac->Final = 0; /* Problem: When a .define style macro is expanded within the call * of a classic one, the latter may be terminated and removed while @@ -765,8 +765,8 @@ ExpandParam: FreeMacExp (Mac); PopInput (); - /* The token was successfully set */ - return 1; + /* The token was successfully set */ + return 1; } MacEnd: @@ -793,47 +793,47 @@ static void StartExpClassic (MacExp* E) /* Read the actual parameters */ while (!TokIsSep (CurTok.Tok)) { - TokNode* Last; + TokNode* Last; - /* Check for maximum parameter count */ - if (E->ParamCount >= E->M->ParamCount) { - ErrorSkip ("Too many macro parameters"); - break; - } + /* Check for maximum parameter count */ + if (E->ParamCount >= E->M->ParamCount) { + ErrorSkip ("Too many macro parameters"); + break; + } /* The macro may optionally be enclosed in curly braces */ Term = GetTokListTerm (TOK_COMMA); - /* Read tokens for one parameter, accept empty params */ - Last = 0; - while (CurTok.Tok != Term && CurTok.Tok != TOK_SEP) { + /* Read tokens for one parameter, accept empty params */ + Last = 0; + while (CurTok.Tok != Term && CurTok.Tok != TOK_SEP) { - TokNode* T; + TokNode* T; - /* Check for end of file */ - if (CurTok.Tok == TOK_EOF) { - Error ("Unexpected end of file"); + /* Check for end of file */ + if (CurTok.Tok == TOK_EOF) { + Error ("Unexpected end of file"); FreeMacExp (E); - return; - } + return; + } - /* Get the next token in a node */ - T = NewTokNode (); + /* Get the next token in a node */ + T = NewTokNode (); - /* Insert it into the list */ - if (Last == 0) { - E->Params [E->ParamCount] = T; - } else { - Last->Next = T; - } - Last = T; + /* Insert it into the list */ + if (Last == 0) { + E->Params [E->ParamCount] = T; + } else { + Last->Next = T; + } + Last = T; - /* And skip it... */ - NextTok (); - } + /* And skip it... */ + NextTok (); + } - /* One parameter more */ - ++E->ParamCount; + /* One parameter more */ + ++E->ParamCount; /* If the macro argument was enclosed in curly braces, end-of-line * is an error. Skip the closing curly brace. @@ -846,12 +846,12 @@ static void StartExpClassic (MacExp* E) NextTok (); } - /* Check for a comma */ - if (CurTok.Tok == TOK_COMMA) { - NextTok (); - } else { - break; - } + /* Check for a comma */ + if (CurTok.Tok == TOK_COMMA) { + NextTok (); + } else { + break; + } } /* We must be at end of line now, otherwise something is wrong */ @@ -877,42 +877,42 @@ static void StartExpDefine (MacExp* E) /* Read the actual parameters */ while (Count--) { - TokNode* Last; + TokNode* Last; /* The macro may optionally be enclosed in curly braces */ token_t Term = GetTokListTerm (TOK_COMMA); - /* Check if there is really a parameter */ - if (TokIsSep (CurTok.Tok) || CurTok.Tok == Term) { + /* Check if there is really a parameter */ + if (TokIsSep (CurTok.Tok) || CurTok.Tok == Term) { ErrorSkip ("Macro parameter #%u is empty", E->ParamCount+1); FreeMacExp (E); return; } - /* Read tokens for one parameter */ - Last = 0; - do { + /* Read tokens for one parameter */ + Last = 0; + do { - TokNode* T; + TokNode* T; - /* Get the next token in a node */ - T = NewTokNode (); + /* Get the next token in a node */ + T = NewTokNode (); - /* Insert it into the list */ - if (Last == 0) { - E->Params [E->ParamCount] = T; - } else { - Last->Next = T; - } - Last = T; + /* Insert it into the list */ + if (Last == 0) { + E->Params [E->ParamCount] = T; + } else { + Last->Next = T; + } + Last = T; - /* And skip it... */ - NextTok (); + /* And skip it... */ + NextTok (); - } while (CurTok.Tok != Term && !TokIsSep (CurTok.Tok)); + } while (CurTok.Tok != Term && !TokIsSep (CurTok.Tok)); - /* One parameter more */ - ++E->ParamCount; + /* One parameter more */ + ++E->ParamCount; /* If the macro argument was enclosed in curly braces, end-of-line * is an error. Skip the closing curly brace. @@ -925,14 +925,14 @@ static void StartExpDefine (MacExp* E) NextTok (); } - /* Check for a comma */ - if (Count > 0) { - if (CurTok.Tok == TOK_COMMA) { - NextTok (); - } else { - Error ("`,' expected"); - } - } + /* Check for a comma */ + if (Count > 0) { + if (CurTok.Tok == TOK_COMMA) { + NextTok (); + } else { + Error ("`,' expected"); + } + } } /* Macro expansion will overwrite the current token. This is a problem @@ -975,9 +975,9 @@ void MacExpandStart (Macro* M) /* Call the apropriate subroutine */ switch (M->Style) { - case MAC_STYLE_CLASSIC: StartExpClassic (E); break; - case MAC_STYLE_DEFINE: StartExpDefine (E); break; - default: Internal ("Invalid macro style: %d", M->Style); + case MAC_STYLE_CLASSIC: StartExpClassic (E); break; + case MAC_STYLE_DEFINE: StartExpDefine (E); break; + default: Internal ("Invalid macro style: %d", M->Style); } } diff --git a/src/ca65/macro.h b/src/ca65/macro.h index 490747810..582b13524 100644 --- a/src/ca65/macro.h +++ b/src/ca65/macro.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* macro.h */ +/* macro.h */ /* */ -/* Macros for the ca65 macroassembler */ +/* Macros for the ca65 macroassembler */ /* */ /* */ /* */ @@ -49,14 +49,14 @@ struct StrBuf; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Macro styles */ -#define MAC_STYLE_CLASSIC 0 -#define MAC_STYLE_DEFINE 1 +#define MAC_STYLE_CLASSIC 0 +#define MAC_STYLE_DEFINE 1 /* Macro as an opaque data type */ struct Macro; @@ -65,7 +65,7 @@ typedef struct Macro Macro; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/main.c b/src/ca65/main.c index 50844be69..9bf08f347 100644 --- a/src/ca65/main.c +++ b/src/ca65/main.c @@ -1,7 +1,7 @@ /* */ -/* main.c */ +/* main.c */ /* */ -/* Main program for the ca65 macroassembler */ +/* Main program for the ca65 macroassembler */ /* */ /* */ /* */ @@ -81,7 +81,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -168,7 +168,7 @@ static void NewSymbol (const char* SymName, long Val) /* Check if have already a symbol with this name */ if (SymIsDef (Sym)) { - AbEnd ("`%s' is already defined", SymName); + AbEnd ("`%s' is already defined", SymName); } /* Generate an expression for the symbol */ @@ -197,75 +197,75 @@ static void SetSys (const char* Sys) { switch (Target = FindTarget (Sys)) { - case TGT_NONE: - break; + case TGT_NONE: + break; case TGT_MODULE: AbEnd ("Cannot use `module' as a target for the assembler"); break; - case TGT_ATARI: - NewSymbol ("__ATARI__", 1); - break; + case TGT_ATARI: + NewSymbol ("__ATARI__", 1); + break; - case TGT_C16: - CBMSystem ("__C16__"); - break; + case TGT_C16: + CBMSystem ("__C16__"); + break; - case TGT_C64: - CBMSystem ("__C64__"); - break; + case TGT_C64: + CBMSystem ("__C64__"); + break; - case TGT_VIC20: - CBMSystem ("__VIC20__"); - break; + case TGT_VIC20: + CBMSystem ("__VIC20__"); + break; - case TGT_C128: - CBMSystem ("__C128__"); - break; + case TGT_C128: + CBMSystem ("__C128__"); + break; - case TGT_PLUS4: - CBMSystem ("__PLUS4__"); - break; + case TGT_PLUS4: + CBMSystem ("__PLUS4__"); + break; - case TGT_CBM510: - CBMSystem ("__CBM510__"); - break; + case TGT_CBM510: + CBMSystem ("__CBM510__"); + break; - case TGT_CBM610: - CBMSystem ("__CBM610__"); - break; + case TGT_CBM610: + CBMSystem ("__CBM610__"); + break; - case TGT_PET: - CBMSystem ("__PET__"); - break; + case TGT_PET: + CBMSystem ("__PET__"); + break; - case TGT_BBC: - NewSymbol ("__BBC__", 1); - break; + case TGT_BBC: + NewSymbol ("__BBC__", 1); + break; - case TGT_APPLE2: - NewSymbol ("__APPLE2__", 1); - break; + case TGT_APPLE2: + NewSymbol ("__APPLE2__", 1); + break; - case TGT_APPLE2ENH: + case TGT_APPLE2ENH: NewSymbol ("__APPLE2ENH__", 1); - break; + break; - case TGT_GEOS_CBM: - /* Do not handle as a CBM system */ - NewSymbol ("__GEOS__", 1); - NewSymbol ("__GEOS_CBM__", 1); - break; + case TGT_GEOS_CBM: + /* Do not handle as a CBM system */ + NewSymbol ("__GEOS__", 1); + NewSymbol ("__GEOS_CBM__", 1); + break; - case TGT_GEOS_APPLE: - NewSymbol ("__GEOS__", 1); - NewSymbol ("__GEOS_APPLE__", 1); - break; + case TGT_GEOS_APPLE: + NewSymbol ("__GEOS__", 1); + NewSymbol ("__GEOS_APPLE__", 1); + break; - case TGT_LUNIX: - NewSymbol ("__LUNIX__", 1); - break; + case TGT_LUNIX: + NewSymbol ("__LUNIX__", 1); + break; case TGT_ATMOS: NewSymbol ("__ATMOS__", 1); @@ -283,7 +283,7 @@ static void SetSys (const char* Sys) NewSymbol ("__LYNX__", 1); break; - default: + default: AbEnd ("Invalid target name: `%s'", Sys); } @@ -318,7 +318,7 @@ static void DefineSymbol (const char* Def) /* The symbol must start with a character or underline */ if (!IsIdStart (Def [0])) { - InvDef (Def); + InvDef (Def); } P = Def; @@ -330,23 +330,23 @@ static void DefineSymbol (const char* Def) /* Do we have a value given? */ if (*P != '=') { - if (*P != '\0') { - InvDef (Def); - } - Val = 0; + if (*P != '\0') { + InvDef (Def); + } + Val = 0; } else { - /* We have a value */ - ++P; - if (*P == '$') { - ++P; - if (sscanf (P, "%lx", &Val) != 1) { - InvDef (Def); - } - } else { - if (sscanf (P, "%li", &Val) != 1) { - InvDef (Def); - } - } + /* We have a value */ + ++P; + if (*P == '$') { + ++P; + if (sscanf (P, "%lx", &Val) != 1) { + InvDef (Def); + } + } else { + if (sscanf (P, "%li", &Val) != 1) { + InvDef (Def); + } + } } /* Define the new symbol */ @@ -359,7 +359,7 @@ static void DefineSymbol (const char* Def) static void OptAutoImport (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Mark unresolved symbols as imported */ { AutoImport = 1; @@ -380,9 +380,9 @@ static void OptCPU (const char* Opt attribute ((unused)), const char* Arg) { cpu_t CPU = FindCPU (Arg); if (CPU == CPU_UNKNOWN) { - AbEnd ("Invalid CPU: `%s'", Arg); + AbEnd ("Invalid CPU: `%s'", Arg); } else { - SetCPU (CPU); + SetCPU (CPU); } } @@ -397,7 +397,7 @@ static void OptCreateDep (const char* Opt, const char* Arg) static void OptCreateFullDep (const char* Opt attribute ((unused)), - const char* Arg) + const char* Arg) /* Handle the --create-full-dep option */ { FileNameOption (Opt, Arg, &FullDepName); @@ -406,7 +406,7 @@ static void OptCreateFullDep (const char* Opt attribute ((unused)), static void OptDebug (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Compiler debug mode */ { ++Debug; @@ -415,7 +415,7 @@ static void OptDebug (const char* Opt attribute ((unused)), static void OptDebugInfo (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Add debug info to the object file */ { DbgSyms = 1; @@ -431,14 +431,14 @@ static void OptFeature (const char* Opt attribute ((unused)), const char* Arg) /* Set the feature, check for errors */ if (SetFeature (SB_InitFromString (&Feature, Arg)) == FEAT_UNKNOWN) { - AbEnd ("Illegal emulation feature: `%s'", Arg); + AbEnd ("Illegal emulation feature: `%s'", Arg); } } static void OptHelp (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print usage information and exit */ { Usage (); @@ -448,7 +448,7 @@ static void OptHelp (const char* Opt attribute ((unused)), static void OptIgnoreCase (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Ignore case on symbols */ { IgnoreCase = 1; @@ -465,7 +465,7 @@ static void OptIncludeDir (const char* Opt attribute ((unused)), const char* Arg static void OptLargeAlignment (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Don't warn about large alignments */ { LargeAlignment = 1; @@ -541,7 +541,7 @@ static void OptPageLength (const char* Opt attribute ((unused)), const char* Arg { int Len = atoi (Arg); if (Len != -1 && (Len < MIN_PAGE_LEN || Len > MAX_PAGE_LEN)) { - AbEnd ("Invalid page length: %d", Len); + AbEnd ("Invalid page length: %d", Len); } PageLength = Len; } @@ -549,7 +549,7 @@ static void OptPageLength (const char* Opt attribute ((unused)), const char* Arg static void OptRelaxChecks (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Handle the --relax-checks options */ { RelaxChecks = 1; @@ -558,7 +558,7 @@ static void OptRelaxChecks (const char* Opt attribute ((unused)), static void OptSmart (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Handle the -s/--smart options */ { SmartMode = 1; @@ -575,7 +575,7 @@ static void OptTarget (const char* Opt attribute ((unused)), const char* Arg) static void OptVerbose (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Increase verbosity */ { ++Verbosity; @@ -584,7 +584,7 @@ static void OptVerbose (const char* Opt attribute ((unused)), static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print the assembler version */ { fprintf (stderr, "ca65 V%s\n", GetVersionAsString ()); @@ -597,9 +597,9 @@ static void DoPCAssign (void) { long PC = ConstExpression (); if (PC < 0 || PC > 0xFFFFFF) { - Error ("Range error"); + Error ("Range error"); } else { - EnterAbsoluteMode (PC); + EnterAbsoluteMode (PC); } } @@ -618,13 +618,13 @@ static void OneLine (void) * and not from internally pushed input. */ if (!HavePushedInput ()) { - InitListingLine (); + InitListingLine (); } /* Single colon means unnamed label */ if (CurTok.Tok == TOK_COLON) { - ULabDef (); - NextTok (); + ULabDef (); + NextTok (); } /* If the first token on the line is an identifier, check for a macro or @@ -794,7 +794,7 @@ static void Assemble (void) /* Assemble lines until end of file */ while (CurTok.Tok != TOK_EOF) { - OneLine (); + OneLine (); } } @@ -850,27 +850,27 @@ int main (int argc, char* argv []) { /* Program long options */ static const LongOpt OptTab[] = { - { "--auto-import", 0, OptAutoImport }, + { "--auto-import", 0, OptAutoImport }, { "--bin-include-dir", 1, OptBinIncludeDir }, - { "--cpu", 1, OptCPU }, + { "--cpu", 1, OptCPU }, { "--create-dep", 1, OptCreateDep }, { "--create-full-dep", 1, OptCreateFullDep }, - { "--debug", 0, OptDebug }, - { "--debug-info", 0, OptDebugInfo }, - { "--feature", 1, OptFeature }, - { "--help", 0, OptHelp }, - { "--ignore-case", 0, OptIgnoreCase }, - { "--include-dir", 1, OptIncludeDir }, + { "--debug", 0, OptDebug }, + { "--debug-info", 0, OptDebugInfo }, + { "--feature", 1, OptFeature }, + { "--help", 0, OptHelp }, + { "--ignore-case", 0, OptIgnoreCase }, + { "--include-dir", 1, OptIncludeDir }, { "--large-alignment", 0, OptLargeAlignment }, { "--list-bytes", 1, OptListBytes }, - { "--listing", 1, OptListing }, + { "--listing", 1, OptListing }, { "--memory-model", 1, OptMemoryModel }, - { "--pagelength", 1, OptPageLength }, + { "--pagelength", 1, OptPageLength }, { "--relax-checks", 0, OptRelaxChecks }, - { "--smart", 0, OptSmart }, - { "--target", 1, OptTarget }, - { "--verbose", 0, OptVerbose }, - { "--version", 0, OptVersion }, + { "--smart", 0, OptSmart }, + { "--target", 1, OptTarget }, + { "--verbose", 0, OptVerbose }, + { "--version", 0, OptVersion }, }; /* Name of the global name space */ @@ -904,36 +904,36 @@ int main (int argc, char* argv []) I = 1; while (I < ArgCount) { - /* Get the argument */ - const char* Arg = ArgVec [I]; + /* Get the argument */ + const char* Arg = ArgVec [I]; - /* Check for an option */ - if (Arg[0] == '-') { - switch (Arg[1]) { + /* Check for an option */ + if (Arg[0] == '-') { + switch (Arg[1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; - case 'd': - OptDebug (Arg, 0); - break; + case 'd': + OptDebug (Arg, 0); + break; - case 'g': - OptDebugInfo (Arg, 0); - break; + case 'g': + OptDebugInfo (Arg, 0); + break; - case 'h': - OptHelp (Arg, 0); - break; + case 'h': + OptHelp (Arg, 0); + break; - case 'i': - OptIgnoreCase (Arg, 0); - break; + case 'i': + OptIgnoreCase (Arg, 0); + break; - case 'l': - OptListing (Arg, GetArg (&I, 2)); - break; + case 'l': + OptListing (Arg, GetArg (&I, 2)); + break; case 'm': if (Arg[2] == 'm') { @@ -943,66 +943,66 @@ int main (int argc, char* argv []) } break; - case 'o': - OutFile = GetArg (&I, 2); - break; + case 'o': + OutFile = GetArg (&I, 2); + break; - case 's': - OptSmart (Arg, 0); - break; + case 's': + OptSmart (Arg, 0); + break; - case 't': - OptTarget (Arg, GetArg (&I, 2)); - break; + case 't': + OptTarget (Arg, GetArg (&I, 2)); + break; - case 'v': - OptVerbose (Arg, 0); - break; + case 'v': + OptVerbose (Arg, 0); + break; - case 'D': - DefineSymbol (GetArg (&I, 2)); - break; + case 'D': + DefineSymbol (GetArg (&I, 2)); + break; - case 'I': - OptIncludeDir (Arg, GetArg (&I, 2)); - break; + case 'I': + OptIncludeDir (Arg, GetArg (&I, 2)); + break; - case 'U': - OptAutoImport (Arg, 0); - break; + case 'U': + OptAutoImport (Arg, 0); + break; - case 'V': - OptVersion (Arg, 0); - break; + case 'V': + OptVersion (Arg, 0); + break; - case 'W': - WarnLevel = atoi (GetArg (&I, 2)); - break; + case 'W': + WarnLevel = atoi (GetArg (&I, 2)); + break; - default: - UnknownOption (Arg); - break; + default: + UnknownOption (Arg); + break; - } - } else { - /* Filename. Check if we already had one */ - if (InFile) { - fprintf (stderr, "%s: Don't know what to do with `%s'\n", - ProgName, Arg); - exit (EXIT_FAILURE); - } else { - InFile = Arg; - } - } + } + } else { + /* Filename. Check if we already had one */ + if (InFile) { + fprintf (stderr, "%s: Don't know what to do with `%s'\n", + ProgName, Arg); + exit (EXIT_FAILURE); + } else { + InFile = Arg; + } + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Do we have an input file? */ if (InFile == 0) { - fprintf (stderr, "%s: No input files\n", ProgName); - exit (EXIT_FAILURE); + fprintf (stderr, "%s: No input files\n", ProgName); + exit (EXIT_FAILURE); } /* Add the default include search paths. */ @@ -1082,10 +1082,10 @@ int main (int argc, char* argv []) * dependency files */ if (ErrorCount == 0) { - CreateObjFile (); - if (SB_GetLen (&ListingName) > 0) { - CreateListing (); - } + CreateObjFile (); + if (SB_GetLen (&ListingName) > 0) { + CreateListing (); + } CreateDependencies (); } diff --git a/src/ca65/nexttok.c b/src/ca65/nexttok.c index 3761ebb67..d52a8babd 100644 --- a/src/ca65/nexttok.c +++ b/src/ca65/nexttok.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* nexttok.c */ +/* nexttok.c */ /* */ -/* Get next token and handle token level functions */ +/* Get next token and handle token level functions */ /* */ /* */ /* */ @@ -53,12 +53,12 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -static unsigned RawMode = 0; /* Raw token mode flag/counter */ +static unsigned RawMode = 0; /* Raw token mode flag/counter */ @@ -86,7 +86,7 @@ static int LookAtStrCon (void) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -109,21 +109,21 @@ static TokList* CollectTokens (unsigned Start, unsigned Count) unsigned Current = 0; while (CurTok.Tok != Term) { - /* Check for end of line or end of input */ - if (TokIsSep (CurTok.Tok)) { - Error ("Unexpected end of line"); - return List; - } + /* Check for end of line or end of input */ + if (TokIsSep (CurTok.Tok)) { + Error ("Unexpected end of line"); + return List; + } - /* Collect tokens in the given range */ - if (Current >= Start && Current < Start+Count) { - /* Add the current token to the list */ - AddCurTok (List); - } + /* Collect tokens in the given range */ + if (Current >= Start && Current < Start+Count) { + /* Add the current token to the list */ + AddCurTok (List); + } - /* Get the next token */ - ++Current; - NextTok (); + /* Get the next token */ + ++Current; + NextTok (); } /* Eat the terminator token */ @@ -154,35 +154,35 @@ static void FuncConcat (void) /* Concatenate any number of strings */ while (1) { - /* Next token must be a string */ + /* Next token must be a string */ if (!LookAtStrCon ()) { SB_Done (&Buf); - return; - } + return; + } /* Append the string */ SB_Append (&Buf, &CurTok.SVal); - /* Skip the string token */ - NextTok (); + /* Skip the string token */ + NextTok (); - /* Comma means another argument */ - if (CurTok.Tok == TOK_COMMA) { - NextTok (); - } else { - /* Done */ - break; - } + /* Comma means another argument */ + if (CurTok.Tok == TOK_COMMA) { + NextTok (); + } else { + /* Done */ + break; + } } /* We expect a closing parenthesis, but will not skip it but replace it * by the string token just created. */ if (CurTok.Tok != TOK_RPAREN) { - Error ("`)' expected"); + Error ("`)' expected"); } else { - CurTok.Tok = TOK_STRCON; - SB_Copy (&CurTok.SVal, &Buf); + CurTok.Tok = TOK_STRCON; + SB_Copy (&CurTok.SVal, &Buf); SB_Terminate (&CurTok.SVal); } @@ -253,7 +253,7 @@ static void FuncIdent (void) SB_Copy (&Buf, &CurTok.SVal); NextTok (); if (CurTok.Tok != TOK_RPAREN) { - Error ("`)' expected"); + Error ("`)' expected"); } else { CurTok.Tok = Id; SB_Copy (&CurTok.SVal, &Buf); @@ -269,8 +269,8 @@ static void FuncIdent (void) static void FuncLeft (void) /* Handle the .LEFT function */ { - long Count; - TokList* List; + long Count; + TokList* List; /* Skip it */ NextTok (); @@ -281,7 +281,7 @@ static void FuncLeft (void) /* Count argument. Correct negative counts to zero. */ Count = ConstExpression (); if (Count < 0) { - Count = 0; + Count = 0; } ConsumeComma (); @@ -309,9 +309,9 @@ static void FuncLeft (void) static void FuncMid (void) /* Handle the .MID function */ { - long Start; - long Count; - TokList* List; + long Start; + long Count; + TokList* List; /* Skip it */ NextTok (); @@ -324,7 +324,7 @@ static void FuncMid (void) */ Start = ConstExpression (); if (Start < 0 || Start > 100) { - Start = 0; + Start = 0; } ConsumeComma (); @@ -333,7 +333,7 @@ static void FuncMid (void) */ Count = ConstExpression (); if (Count < 0) { - Count = 0; + Count = 0; } ConsumeComma (); @@ -361,8 +361,8 @@ static void FuncMid (void) static void FuncRight (void) /* Handle the .RIGHT function */ { - long Count; - TokList* List; + long Count; + TokList* List; /* Skip it */ NextTok (); @@ -373,7 +373,7 @@ static void FuncRight (void) /* Count argument. Correct negative counts to zero. */ Count = ConstExpression (); if (Count < 0) { - Count = 0; + Count = 0; } ConsumeComma (); @@ -382,17 +382,17 @@ static void FuncRight (void) /* Delete tokens from the list until Count tokens are remaining */ while (List->Count > (unsigned) Count) { - /* Get the first node */ - TokNode* T = List->Root; + /* Get the first node */ + TokNode* T = List->Root; - /* Remove it from the list */ - List->Root = List->Root->Next; + /* Remove it from the list */ + List->Root = List->Root->Next; - /* Free the node */ - FreeTokNode (T); + /* Free the node */ + FreeTokNode (T); - /* Corrent the token counter */ - List->Count--; + /* Corrent the token counter */ + List->Count--; } /* Since we want to insert the list before the now current token, we have @@ -600,9 +600,9 @@ static void FuncSPrintF (void) * by the string token just created. */ if (CurTok.Tok != TOK_RPAREN) { - Error ("`)' expected"); + Error ("`)' expected"); } else { - CurTok.Tok = TOK_STRCON; + CurTok.Tok = TOK_STRCON; SB_Copy (&CurTok.SVal, &R); SB_Terminate (&CurTok.SVal); } @@ -630,9 +630,9 @@ static void FuncString (void) /* Accept identifiers or numeric expressions */ if (CurTok.Tok == TOK_LOCAL_IDENT) { - /* Save the identifier, then skip it */ - SB_Copy (&Buf, &CurTok.SVal); - NextTok (); + /* Save the identifier, then skip it */ + SB_Copy (&Buf, &CurTok.SVal); + NextTok (); } else if (CurTok.Tok == TOK_NAMESPACE || CurTok.Tok == TOK_IDENT) { /* Parse a fully qualified symbol name. We cannot use @@ -651,19 +651,19 @@ static void FuncString (void) (NameSpace == 0 && CurTok.Tok == TOK_NAMESPACE)); } else { - /* Numeric expression */ - long Val = ConstExpression (); - SB_Printf (&Buf, "%ld", Val); + /* Numeric expression */ + long Val = ConstExpression (); + SB_Printf (&Buf, "%ld", Val); } /* We expect a closing parenthesis, but will not skip it but replace it * by the string token just created. */ if (CurTok.Tok != TOK_RPAREN) { - Error ("`)' expected"); + Error ("`)' expected"); } else { - CurTok.Tok = TOK_STRCON; - SB_Copy (&CurTok.SVal, &Buf); + CurTok.Tok = TOK_STRCON; + SB_Copy (&CurTok.SVal, &Buf); SB_Terminate (&CurTok.SVal); } @@ -684,42 +684,42 @@ void NextTok (void) */ if (RawMode == 0 && IfCond) { - /* Execute token handling functions */ - switch (CurTok.Tok) { + /* Execute token handling functions */ + switch (CurTok.Tok) { - case TOK_CONCAT: - FuncConcat (); - break; + case TOK_CONCAT: + FuncConcat (); + break; - case TOK_LEFT: - FuncLeft (); - break; + case TOK_LEFT: + FuncLeft (); + break; case TOK_MAKEIDENT: FuncIdent (); break; - case TOK_MID: - FuncMid (); - break; + case TOK_MID: + FuncMid (); + break; - case TOK_RIGHT: - FuncRight (); - break; + case TOK_RIGHT: + FuncRight (); + break; case TOK_SPRINTF: FuncSPrintF (); break; - case TOK_STRING: - FuncString (); - break; + case TOK_STRING: + FuncString (); + break; - default: - /* Quiet down gcc */ - break; + default: + /* Quiet down gcc */ + break; - } + } } } @@ -729,9 +729,9 @@ void Consume (token_t Expected, const char* ErrMsg) /* Consume Expected, print an error if we don't find it */ { if (CurTok.Tok == Expected) { - NextTok (); + NextTok (); } else { - Error ("%s", ErrMsg); + Error ("%s", ErrMsg); } } @@ -745,7 +745,7 @@ void ConsumeSep (void) /* If we are at end of line, skip it */ if (CurTok.Tok == TOK_SEP) { - NextTok (); + NextTok (); } } @@ -779,7 +779,7 @@ void SkipUntilSep (void) /* Skip tokens until we reach a line separator or end of file */ { while (!TokIsSep (CurTok.Tok)) { - NextTok (); + NextTok (); } } @@ -791,7 +791,7 @@ void ExpectSep (void) */ { if (!TokIsSep (CurTok.Tok)) { - ErrorSkip ("Unexpected trailing garbage characters"); + ErrorSkip ("Unexpected trailing garbage characters"); } } diff --git a/src/ca65/nexttok.h b/src/ca65/nexttok.h index 28806f94e..d8d7c0101 100644 --- a/src/ca65/nexttok.h +++ b/src/ca65/nexttok.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* nexttok.h */ +/* nexttok.h */ /* */ -/* Get next token and handle token level functions */ +/* Get next token and handle token level functions */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/objcode.c b/src/ca65/objcode.c index f80eec203..3ab9b2ebe 100644 --- a/src/ca65/objcode.c +++ b/src/ca65/objcode.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objcode.c */ +/* objcode.c */ /* */ -/* Objectcode management for the ca65 macroassembler */ +/* Objectcode management for the ca65 macroassembler */ /* */ /* */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -159,23 +159,23 @@ void EmitData (const void* D, unsigned Size) /* Create lots of fragments for the data */ while (Size) { - Fragment* F; + Fragment* F; - /* Determine the length of the next fragment */ - unsigned Len = Size; - if (Len > sizeof (F->V.Data)) { - Len = sizeof (F->V.Data); - } + /* Determine the length of the next fragment */ + unsigned Len = Size; + if (Len > sizeof (F->V.Data)) { + Len = sizeof (F->V.Data); + } - /* Create a new fragment */ - F = GenFragment (FRAG_LITERAL, Len); + /* Create a new fragment */ + F = GenFragment (FRAG_LITERAL, Len); - /* Copy the data */ - memcpy (F->V.Data, Data, Len); + /* Copy the data */ + memcpy (F->V.Data, Data, Len); - /* Next chunk */ - Data += Len; - Size -= Len; + /* Next chunk */ + Data += Len; + Size -= Len; } } @@ -270,12 +270,12 @@ void EmitFill (unsigned long Count) /* Emit Count fill bytes */ { while (Count) { - /* Calculate the size of the next chunk */ - unsigned Chunk = (Count > 0xFFFF)? 0xFFFF : (unsigned) Count; - Count -= Chunk; + /* Calculate the size of the next chunk */ + unsigned Chunk = (Count > 0xFFFF)? 0xFFFF : (unsigned) Count; + Count -= Chunk; - /* Emit one chunk */ - GenFragment (FRAG_FILL, Chunk); + /* Emit one chunk */ + GenFragment (FRAG_FILL, Chunk); } } diff --git a/src/ca65/objcode.h b/src/ca65/objcode.h index 317fe295b..68b967e3f 100644 --- a/src/ca65/objcode.h +++ b/src/ca65/objcode.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objcode.h */ +/* objcode.h */ /* */ -/* Objectcode management for the ca65 macroassembler */ +/* Objectcode management for the ca65 macroassembler */ /* */ /* */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/objfile.c b/src/ca65/objfile.c index 199bc13c5..818e5625b 100644 --- a/src/ca65/objfile.c +++ b/src/ca65/objfile.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objfile.c */ +/* objfile.c */ /* */ -/* Object file writing routines for the ca65 macroassembler */ +/* Object file writing routines for the ca65 macroassembler */ /* */ /* */ /* */ @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -59,7 +59,7 @@ static FILE* F = 0; /* Default extension */ -#define OBJ_EXT ".o" +#define OBJ_EXT ".o" /* Header structure */ static ObjHeader Header = { @@ -93,7 +93,7 @@ static ObjHeader Header = { /*****************************************************************************/ -/* Internally used functions */ +/* Internally used functions */ /*****************************************************************************/ @@ -151,7 +151,7 @@ static void ObjWriteHeader (void) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -161,16 +161,16 @@ void ObjOpen (void) { /* Do we have a name for the output file? */ if (OutFile == 0) { - /* We don't have an output name explicitly given, construct one from - * the name of the input file. - */ - OutFile = MakeFilename (InFile, OBJ_EXT); + /* We don't have an output name explicitly given, construct one from + * the name of the input file. + */ + OutFile = MakeFilename (InFile, OBJ_EXT); } /* Create the output file */ F = fopen (OutFile, "w+b"); if (F == 0) { - Fatal ("Cannot open output file `%s': %s", OutFile, strerror (errno)); + Fatal ("Cannot open output file `%s': %s", OutFile, strerror (errno)); } /* Write a dummy header */ @@ -184,7 +184,7 @@ void ObjClose (void) { /* Go back to the beginning */ if (fseek (F, 0, SEEK_SET) != 0) { - ObjWriteError (); + ObjWriteError (); } /* If we have debug infos, set the flag in the header */ @@ -197,7 +197,7 @@ void ObjClose (void) /* Close the file */ if (fclose (F) != 0) { - ObjWriteError (); + ObjWriteError (); } } @@ -229,7 +229,7 @@ void ObjWrite8 (unsigned V) /* Write an 8 bit value to the file */ { if (putc (V, F) == EOF) { - ObjWriteError (); + ObjWriteError (); } } @@ -274,12 +274,12 @@ void ObjWriteVar (unsigned long V) * needing 5 bytes if a 32 bit value is written to file. */ do { - unsigned char C = (V & 0x7F); - V >>= 7; - if (V) { - C |= 0x80; - } - ObjWrite8 (C); + unsigned char C = (V & 0x7F); + V >>= 7; + if (V) { + C |= 0x80; + } + ObjWrite8 (C); } while (V != 0); } @@ -317,7 +317,7 @@ void ObjWriteData (const void* Data, unsigned Size) /* Write literal data to the file */ { if (fwrite (Data, 1, Size, F) != Size) { - ObjWriteError (); + ObjWriteError (); } } @@ -330,8 +330,8 @@ void ObjWritePos (const FilePos* Pos) ObjWriteVar (Pos->Line); ObjWriteVar (Pos->Col); if (Pos->Name == 0) { - /* Position is outside file scope, use the main file instead */ - ObjWriteVar (0); + /* Position is outside file scope, use the main file instead */ + ObjWriteVar (0); } else { ObjWriteVar (Pos->Name - 1); } diff --git a/src/ca65/objfile.h b/src/ca65/objfile.h index 91987b3d9..ab775ca24 100644 --- a/src/ca65/objfile.h +++ b/src/ca65/objfile.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objfile.h */ +/* objfile.h */ /* */ -/* Object file writing routines for the ca65 macroassembler */ +/* Object file writing routines for the ca65 macroassembler */ /* */ /* */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/options.c b/src/ca65/options.c index 02e68f696..c71296a57 100644 --- a/src/ca65/options.c +++ b/src/ca65/options.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* options.c */ +/* options.c */ /* */ -/* Object file options for the ca65 macroassembler */ +/* Object file options for the ca65 macroassembler */ /* */ /* */ /* */ @@ -48,20 +48,20 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Option list */ -static Option* OptRoot = 0; -static Option* OptLast = 0; -static unsigned OptCount = 0; +static Option* OptRoot = 0; +static Option* OptLast = 0; +static unsigned OptCount = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -81,9 +81,9 @@ static Option* NewOption (unsigned char Type, unsigned long Val) /* Insert it into the list */ if (OptRoot == 0) { - OptRoot = Opt; + OptRoot = Opt; } else { - OptLast->Next = Opt; + OptLast->Next = Opt; } OptLast = Opt; @@ -167,12 +167,12 @@ void WriteOptions (void) O = OptRoot; while (O) { - /* Write the type of the option, then the value */ - ObjWrite8 (O->Type); + /* Write the type of the option, then the value */ + ObjWrite8 (O->Type); ObjWriteVar (O->Val); - /* Next option */ - O = O->Next; + /* Next option */ + O = O->Next; } diff --git a/src/ca65/options.h b/src/ca65/options.h index bbb429951..6b4184824 100644 --- a/src/ca65/options.h +++ b/src/ca65/options.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* options.h */ +/* options.h */ /* */ -/* Object file options for the ca65 macroassembler */ +/* Object file options for the ca65 macroassembler */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/pseudo.c b/src/ca65/pseudo.c index 74dd4b260..5c534b29c 100644 --- a/src/ca65/pseudo.c +++ b/src/ca65/pseudo.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* pseudo.c */ +/* pseudo.c */ /* */ -/* Pseudo instructions for the ca65 macroassembler */ +/* Pseudo instructions for the ca65 macroassembler */ /* */ /* */ /* */ @@ -84,7 +84,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -102,7 +102,7 @@ static Collection SegStack = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -122,7 +122,7 @@ static void DoInvalid (void); /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -152,28 +152,28 @@ static void SetBoolOption (unsigned char* Flag) /* Read a on/off/+/- option and set flag accordingly */ { static const char* Keys[] = { - "OFF", - "ON", + "OFF", + "ON", }; if (CurTok.Tok == TOK_PLUS) { - *Flag = 1; - NextTok (); + *Flag = 1; + NextTok (); } else if (CurTok.Tok == TOK_MINUS) { - *Flag = 0; - NextTok (); + *Flag = 0; + NextTok (); } else if (CurTok.Tok == TOK_IDENT) { - /* Map the keyword to a number */ - switch (GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0]))) { - case 0: *Flag = 0; NextTok (); break; - case 1: *Flag = 1; NextTok (); break; - default: ErrorSkip ("`on' or `off' expected"); break; - } + /* Map the keyword to a number */ + switch (GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0]))) { + case 0: *Flag = 0; NextTok (); break; + case 1: *Flag = 1; NextTok (); break; + default: ErrorSkip ("`on' or `off' expected"); break; + } } else if (TokIsSep (CurTok.Tok)) { - /* Without anything assume switch on */ - *Flag = 1; + /* Without anything assume switch on */ + *Flag = 1; } else { - ErrorSkip ("`on' or `off' expected"); + ErrorSkip ("`on' or `off' expected"); } } @@ -216,10 +216,10 @@ static void ExportImport (void (*Func) (SymEntry*, unsigned char, unsigned), while (1) { /* We need an identifier here */ - if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); - return; - } + if (CurTok.Tok != TOK_IDENT) { + ErrorSkip ("Identifier expected"); + return; + } /* Find the symbol table entry, allocate a new one if necessary */ Sym = SymFind (CurrentScope, &CurTok.SVal, SYM_ALLOC_NEW); @@ -237,11 +237,11 @@ static void ExportImport (void (*Func) (SymEntry*, unsigned char, unsigned), Func (Sym, AddrSize, Flags); /* More symbols? */ - if (CurTok.Tok == TOK_COMMA) { - NextTok (); - } else { - break; - } + if (CurTok.Tok == TOK_COMMA) { + NextTok (); + } else { + break; + } } } @@ -253,15 +253,15 @@ static long IntArg (long Min, long Max) */ { if (CurTok.Tok == TOK_IDENT && SB_CompareStr (&CurTok.SVal, "unlimited") == 0) { - NextTok (); - return -1; + NextTok (); + return -1; } else { - long Val = ConstExpression (); - if (Val < Min || Val > Max) { - Error ("Range error"); - Val = Min; - } - return Val; + long Val = ConstExpression (); + if (Val < Min || Val > Max) { + Error ("Range error"); + Val = Min; + } + return Val; } } @@ -278,17 +278,17 @@ static void ConDes (const StrBuf* Name, unsigned Type) /* Optional constructor priority */ if (CurTok.Tok == TOK_COMMA) { - /* Priority value follows */ - NextTok (); - Prio = ConstExpression (); - if (Prio < CD_PRIO_MIN || Prio > CD_PRIO_MAX) { - /* Value out of range */ - Error ("Range error"); - return; - } + /* Priority value follows */ + NextTok (); + Prio = ConstExpression (); + if (Prio < CD_PRIO_MIN || Prio > CD_PRIO_MAX) { + /* Value out of range */ + Error ("Range error"); + return; + } } else { - /* Use the default priority value */ - Prio = CD_PRIO_DEF; + /* Use the default priority value */ + Prio = CD_PRIO_DEF; } /* Define the symbol */ @@ -325,7 +325,7 @@ static StrBuf* GenArrayType (StrBuf* Type, unsigned SpanSize, /*****************************************************************************/ -/* Handler functions */ +/* Handler functions */ /*****************************************************************************/ @@ -334,10 +334,10 @@ static void DoA16 (void) /* Switch the accu to 16 bit mode (assembler only) */ { if (GetCPU() != CPU_65816) { - Error ("Command is only valid in 65816 mode"); + Error ("Command is only valid in 65816 mode"); } else { - /* Immidiate mode has two extension bytes */ - ExtBytes [AM65I_IMM_ACCU] = 2; + /* Immidiate mode has two extension bytes */ + ExtBytes [AM65I_IMM_ACCU] = 2; } } @@ -347,10 +347,10 @@ static void DoA8 (void) /* Switch the accu to 8 bit mode (assembler only) */ { if (GetCPU() != CPU_65816) { - Error ("Command is only valid in 65816 mode"); + Error ("Command is only valid in 65816 mode"); } else { - /* Immidiate mode has one extension byte */ - ExtBytes [AM65I_IMM_ACCU] = 1; + /* Immidiate mode has one extension byte */ + ExtBytes [AM65I_IMM_ACCU] = 1; } } @@ -369,16 +369,16 @@ static void DoAddr (void) /* Parse arguments */ while (1) { ExprNode* Expr = Expression (); - if (GetCPU () == CPU_65816 || ForceRange) { - /* Do a range check */ + if (GetCPU () == CPU_65816 || ForceRange) { + /* Do a range check */ Expr = GenWordExpr (Expr); - } + } EmitWord (Expr); - if (CurTok.Tok != TOK_COMMA) { - break; - } else { - NextTok (); - } + if (CurTok.Tok != TOK_COMMA) { + break; + } else { + NextTok (); + } } /* Close the span, then add type information to it */ @@ -427,21 +427,21 @@ static void DoASCIIZ (void) /* Define text with a zero terminator */ { while (1) { - /* Must have a string constant */ - if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - return; - } + /* Must have a string constant */ + if (CurTok.Tok != TOK_STRCON) { + ErrorSkip ("String constant expected"); + return; + } - /* Translate into target charset and emit */ - TgtTranslateStrBuf (&CurTok.SVal); - EmitStrBuf (&CurTok.SVal); - NextTok (); - if (CurTok.Tok == TOK_COMMA) { - NextTok (); - } else { - break; - } + /* Translate into target charset and emit */ + TgtTranslateStrBuf (&CurTok.SVal); + EmitStrBuf (&CurTok.SVal); + NextTok (); + if (CurTok.Tok == TOK_COMMA) { + NextTok (); + } else { + break; + } } Emit0 (0); } @@ -452,7 +452,7 @@ static void DoAssert (void) /* Add an assertion */ { static const char* ActionTab [] = { - "WARN", "WARNING", + "WARN", "WARNING", "ERROR", "LDWARN", "LDWARNING", "LDERROR", @@ -578,24 +578,24 @@ static void DoByte (void) /* Parse arguments */ while (1) { - if (CurTok.Tok == TOK_STRCON) { - /* A string, translate into target charset and emit */ - TgtTranslateStrBuf (&CurTok.SVal); - EmitStrBuf (&CurTok.SVal); - NextTok (); - } else { + if (CurTok.Tok == TOK_STRCON) { + /* A string, translate into target charset and emit */ + TgtTranslateStrBuf (&CurTok.SVal); + EmitStrBuf (&CurTok.SVal); + NextTok (); + } else { EmitByte (BoundedExpr (Expression, 1)); - } - if (CurTok.Tok != TOK_COMMA) { - break; - } else { - NextTok (); - /* Do smart handling of dangling comma */ - if (CurTok.Tok == TOK_SEP) { - Error ("Unexpected end of line"); - break; - } - } + } + if (CurTok.Tok != TOK_COMMA) { + break; + } else { + NextTok (); + /* Do smart handling of dangling comma */ + if (CurTok.Tok == TOK_SEP) { + Error ("Unexpected end of line"); + break; + } + } } /* Close the span, then add type information to it */ @@ -626,9 +626,9 @@ static void DoCharMap (void) /* Read the index as numerical value */ Index = ConstExpression (); if (Index <= 0 || Index > 255) { - /* Value out of range */ - ErrorSkip ("Range error"); - return; + /* Value out of range */ + ErrorSkip ("Range error"); + return; } /* Comma follows */ @@ -637,9 +637,9 @@ static void DoCharMap (void) /* Read the character code */ Code = ConstExpression (); if (Code < 0 || Code > 255) { - /* Value out of range */ - ErrorSkip ("Range error"); - return; + /* Value out of range */ + ErrorSkip ("Range error"); + return; } /* Set the character translation */ @@ -660,8 +660,8 @@ static void DoConDes (void) /* Export a symbol as constructor/destructor */ { static const char* Keys[] = { - "CONSTRUCTOR", - "DESTRUCTOR", + "CONSTRUCTOR", + "DESTRUCTOR", "INTERRUPTOR", }; StrBuf Name = STATIC_STRBUF_INITIALIZER; @@ -669,8 +669,8 @@ static void DoConDes (void) /* Symbol name follows */ if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); - return; + ErrorSkip ("Identifier expected"); + return; } SB_Copy (&Name, &CurTok.SVal); NextTok (); @@ -679,25 +679,25 @@ static void DoConDes (void) ConsumeComma (); if (CurTok.Tok == TOK_IDENT) { - /* Map the following keyword to a number, then skip it */ - Type = GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0])); - NextTok (); + /* Map the following keyword to a number, then skip it */ + Type = GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0])); + NextTok (); - /* Check if we got a valid keyword */ - if (Type < 0) { - ErrorSkip ("Syntax error"); - goto ExitPoint; - } + /* Check if we got a valid keyword */ + if (Type < 0) { + ErrorSkip ("Syntax error"); + goto ExitPoint; + } } else { - /* Read the type as numerical value */ - Type = ConstExpression (); - if (Type < CD_TYPE_MIN || Type > CD_TYPE_MAX) { - /* Value out of range */ - ErrorSkip ("Range error"); - goto ExitPoint; - } + /* Read the type as numerical value */ + Type = ConstExpression (); + if (Type < CD_TYPE_MIN || Type > CD_TYPE_MAX) { + /* Value out of range */ + ErrorSkip ("Range error"); + goto ExitPoint; + } } @@ -718,8 +718,8 @@ static void DoConstructor (void) /* Symbol name follows */ if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); - return; + ErrorSkip ("Identifier expected"); + return; } SB_Copy (&Name, &CurTok.SVal); NextTok (); @@ -745,18 +745,18 @@ static void DoDbg (void) /* Add debug information from high level code */ { static const char* Keys[] = { - "FILE", + "FILE", "FUNC", - "LINE", - "SYM", + "LINE", + "SYM", }; int Key; /* We expect a subkey */ if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); - return; + ErrorSkip ("Identifier expected"); + return; } /* Map the following keyword to a number */ @@ -767,11 +767,11 @@ static void DoDbg (void) /* Check the key and dispatch to a handler */ switch (Key) { - case 0: DbgInfoFile (); break; + case 0: DbgInfoFile (); break; case 1: DbgInfoFunc (); break; - case 2: DbgInfoLine (); break; - case 3: DbgInfoSym (); break; - default: ErrorSkip ("Syntax error"); break; + case 2: DbgInfoLine (); break; + case 3: DbgInfoSym (); break; + default: ErrorSkip ("Syntax error"); break; } } @@ -789,12 +789,12 @@ static void DoDByt (void) /* Parse arguments */ while (1) { - EmitWord (GenSwapExpr (BoundedExpr (Expression, 2))); - if (CurTok.Tok != TOK_COMMA) { - break; - } else { - NextTok (); - } + EmitWord (GenSwapExpr (BoundedExpr (Expression, 2))); + if (CurTok.Tok != TOK_COMMA) { + break; + } else { + NextTok (); + } } /* Close the span, then add type information to it */ @@ -828,7 +828,7 @@ static void DoDelMac (void) { /* We expect an identifier */ if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); + ErrorSkip ("Identifier expected"); } else { MacUndef (&CurTok.SVal, MAC_STYLE_CLASSIC); NextTok (); @@ -844,8 +844,8 @@ static void DoDestructor (void) /* Symbol name follows */ if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); - return; + ErrorSkip ("Identifier expected"); + return; } SB_Copy (&Name, &CurTok.SVal); NextTok (); @@ -863,12 +863,12 @@ static void DoDWord (void) /* Define dwords */ { while (1) { - EmitDWord (BoundedExpr (Expression, 4)); - if (CurTok.Tok != TOK_COMMA) { - break; - } else { - NextTok (); - } + EmitDWord (BoundedExpr (Expression, 4)); + if (CurTok.Tok != TOK_COMMA) { + break; + } else { + NextTok (); + } } } @@ -913,10 +913,10 @@ static void DoError (void) /* User error */ { if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); + ErrorSkip ("String constant expected"); } else { - Error ("User error: %m%p", &CurTok.SVal); - SkipUntilSep (); + Error ("User error: %m%p", &CurTok.SVal); + SkipUntilSep (); } } @@ -926,10 +926,10 @@ static void DoExitMacro (void) /* Exit a macro expansion */ { if (!InMacExpansion ()) { - /* We aren't expanding a macro currently */ - DoUnexpected (); + /* We aren't expanding a macro currently */ + DoUnexpected (); } else { - MacAbort (); + MacAbort (); } } @@ -963,12 +963,12 @@ static void DoFarAddr (void) /* Parse arguments */ while (1) { - EmitFarAddr (BoundedExpr (Expression, 3)); - if (CurTok.Tok != TOK_COMMA) { - break; - } else { - NextTok (); - } + EmitFarAddr (BoundedExpr (Expression, 3)); + if (CurTok.Tok != TOK_COMMA) { + break; + } else { + NextTok (); + } } /* Close the span, then add type information to it */ @@ -985,10 +985,10 @@ static void DoFatal (void) /* Fatal user error */ { if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); + ErrorSkip ("String constant expected"); } else { - Fatal ("User error: %m%p", &CurTok.SVal); - SkipUntilSep (); + Fatal ("User error: %m%p", &CurTok.SVal); + SkipUntilSep (); } } @@ -1000,31 +1000,31 @@ static void DoFeature (void) /* Allow a list of comma separated keywords */ while (1) { - /* We expect an identifier */ - if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); - return; - } + /* We expect an identifier */ + if (CurTok.Tok != TOK_IDENT) { + ErrorSkip ("Identifier expected"); + return; + } - /* Make the string attribute lower case */ - LocaseSVal (); + /* Make the string attribute lower case */ + LocaseSVal (); - /* Set the feature and check for errors */ - if (SetFeature (&CurTok.SVal) == FEAT_UNKNOWN) { - /* Not found */ - ErrorSkip ("Invalid feature: `%m%p'", &CurTok.SVal); - return; - } else { - /* Skip the keyword */ - NextTok (); - } + /* Set the feature and check for errors */ + if (SetFeature (&CurTok.SVal) == FEAT_UNKNOWN) { + /* Not found */ + ErrorSkip ("Invalid feature: `%m%p'", &CurTok.SVal); + return; + } else { + /* Skip the keyword */ + NextTok (); + } - /* Allow more than one keyword */ - if (CurTok.Tok == TOK_COMMA) { - NextTok (); - } else { - break; - } + /* Allow more than one keyword */ + if (CurTok.Tok == TOK_COMMA) { + NextTok (); + } else { + break; + } } } @@ -1038,80 +1038,80 @@ static void DoFileOpt (void) /* The option type may be given as a keyword or as a number. */ if (CurTok.Tok == TOK_IDENT) { - /* Option given as keyword */ - static const char* Keys [] = { - "AUTHOR", "COMMENT", "COMPILER" - }; + /* Option given as keyword */ + static const char* Keys [] = { + "AUTHOR", "COMMENT", "COMPILER" + }; - /* Map the option to a number */ - OptNum = GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0])); - if (OptNum < 0) { - /* Not found */ - ErrorSkip ("File option keyword expected"); - return; - } + /* Map the option to a number */ + OptNum = GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0])); + if (OptNum < 0) { + /* Not found */ + ErrorSkip ("File option keyword expected"); + return; + } - /* Skip the keyword */ - NextTok (); + /* Skip the keyword */ + NextTok (); - /* Must be followed by a comma */ - ConsumeComma (); + /* Must be followed by a comma */ + ConsumeComma (); - /* We accept only string options for now */ - if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - return; - } + /* We accept only string options for now */ + if (CurTok.Tok != TOK_STRCON) { + ErrorSkip ("String constant expected"); + return; + } - /* Insert the option */ - switch (OptNum) { + /* Insert the option */ + switch (OptNum) { - case 0: - /* Author */ - OptAuthor (&CurTok.SVal); - break; + case 0: + /* Author */ + OptAuthor (&CurTok.SVal); + break; - case 1: - /* Comment */ - OptComment (&CurTok.SVal); - break; + case 1: + /* Comment */ + OptComment (&CurTok.SVal); + break; - case 2: - /* Compiler */ - OptCompiler (&CurTok.SVal); - break; + case 2: + /* Compiler */ + OptCompiler (&CurTok.SVal); + break; - default: - Internal ("Invalid OptNum: %ld", OptNum); + default: + Internal ("Invalid OptNum: %ld", OptNum); - } + } - /* Done */ - NextTok (); + /* Done */ + NextTok (); } else { - /* Option given as number */ - OptNum = ConstExpression (); - if (!IsByteRange (OptNum)) { - ErrorSkip ("Range error"); - return; - } + /* Option given as number */ + OptNum = ConstExpression (); + if (!IsByteRange (OptNum)) { + ErrorSkip ("Range error"); + return; + } - /* Must be followed by a comma */ - ConsumeComma (); + /* Must be followed by a comma */ + ConsumeComma (); - /* We accept only string options for now */ - if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - return; - } + /* We accept only string options for now */ + if (CurTok.Tok != TOK_STRCON) { + ErrorSkip ("String constant expected"); + return; + } - /* Insert the option */ - OptStr ((unsigned char) OptNum, &CurTok.SVal); + /* Insert the option */ + OptStr ((unsigned char) OptNum, &CurTok.SVal); - /* Done */ - NextTok (); + /* Done */ + NextTok (); } } @@ -1159,10 +1159,10 @@ static void DoI16 (void) /* Switch the index registers to 16 bit mode (assembler only) */ { if (GetCPU() != CPU_65816) { - Error ("Command is only valid in 65816 mode"); + Error ("Command is only valid in 65816 mode"); } else { - /* Immidiate mode has two extension bytes */ - ExtBytes [AM65I_IMM_INDEX] = 2; + /* Immidiate mode has two extension bytes */ + ExtBytes [AM65I_IMM_INDEX] = 2; } } @@ -1172,10 +1172,10 @@ static void DoI8 (void) /* Switch the index registers to 16 bit mode (assembler only) */ { if (GetCPU() != CPU_65816) { - Error ("Command is only valid in 65816 mode"); + Error ("Command is only valid in 65816 mode"); } else { - /* Immidiate mode has one extension byte */ - ExtBytes [AM65I_IMM_INDEX] = 1; + /* Immidiate mode has one extension byte */ + ExtBytes [AM65I_IMM_INDEX] = 1; } } @@ -1209,8 +1209,8 @@ static void DoIncBin (void) /* Name must follow */ if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); - return; + ErrorSkip ("String constant expected"); + return; } SB_Copy (&Name, &CurTok.SVal); SB_Terminate (&Name); @@ -1218,14 +1218,14 @@ static void DoIncBin (void) /* A starting offset may follow */ if (CurTok.Tok == TOK_COMMA) { - NextTok (); - Start = ConstExpression (); + NextTok (); + Start = ConstExpression (); - /* And a length may follow */ - if (CurTok.Tok == TOK_COMMA) { - NextTok (); - Count = ConstExpression (); - } + /* And a length may follow */ + if (CurTok.Tok == TOK_COMMA) { + NextTok (); + Count = ConstExpression (); + } } @@ -1233,20 +1233,20 @@ static void DoIncBin (void) F = fopen (SB_GetConstBuf (&Name), "rb"); if (F == 0) { - /* Search for the file in the binary include directory */ - char* PathName = SearchFile (BinSearchPath, SB_GetConstBuf (&Name)); - if (PathName == 0 || (F = fopen (PathName, "rb")) == 0) { - /* Not found or cannot open, print an error and bail out */ - ErrorSkip ("Cannot open include file `%m%p': %s", &Name, strerror (errno)); + /* Search for the file in the binary include directory */ + char* PathName = SearchFile (BinSearchPath, SB_GetConstBuf (&Name)); + if (PathName == 0 || (F = fopen (PathName, "rb")) == 0) { + /* Not found or cannot open, print an error and bail out */ + ErrorSkip ("Cannot open include file `%m%p': %s", &Name, strerror (errno)); xfree (PathName); goto ExitPoint; - } + } /* Remember the new file name */ SB_CopyStr (&Name, PathName); - /* Free the allocated memory */ - xfree (PathName); + /* Free the allocated memory */ + xfree (PathName); } /* Get the size of the file */ @@ -1271,18 +1271,18 @@ static void DoIncBin (void) /* If a count was not given, calculate it now */ if (Count < 0) { - Count = Size - Start; - if (Count < 0) { - /* Nothing to read - flag this as a range error */ - ErrorSkip ("Range error"); - goto Done; - } + Count = Size - Start; + if (Count < 0) { + /* Nothing to read - flag this as a range error */ + ErrorSkip ("Range error"); + goto Done; + } } else { - /* Count was given, check if it is valid */ - if (Start + Count > Size) { - ErrorSkip ("Range error"); - goto Done; - } + /* Count was given, check if it is valid */ + if (Start + Count > Size) { + ErrorSkip ("Range error"); + goto Done; + } } /* Seek to the start position */ @@ -1291,25 +1291,25 @@ static void DoIncBin (void) /* Read chunks and insert them into the output */ while (Count > 0) { - unsigned char Buf [1024]; + unsigned char Buf [1024]; - /* Calculate the number of bytes to read */ - size_t BytesToRead = (Count > (long)sizeof(Buf))? sizeof(Buf) : (size_t) Count; + /* Calculate the number of bytes to read */ + size_t BytesToRead = (Count > (long)sizeof(Buf))? sizeof(Buf) : (size_t) Count; - /* Read chunk */ - size_t BytesRead = fread (Buf, 1, BytesToRead, F); - if (BytesToRead != BytesRead) { - /* Some sort of error */ - ErrorSkip ("Cannot read from include file `%m%p': %s", + /* Read chunk */ + size_t BytesRead = fread (Buf, 1, BytesToRead, F); + if (BytesToRead != BytesRead) { + /* Some sort of error */ + ErrorSkip ("Cannot read from include file `%m%p': %s", &Name, strerror (errno)); - break; - } + break; + } - /* Insert it into the output */ - EmitData (Buf, BytesRead); + /* Insert it into the output */ + EmitData (Buf, BytesRead); - /* Keep the counters current */ - Count -= BytesRead; + /* Keep the counters current */ + Count -= BytesRead; } Done: @@ -1328,10 +1328,10 @@ static void DoInclude (void) { /* Name must follow */ if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); + ErrorSkip ("String constant expected"); } else { SB_Terminate (&CurTok.SVal); - if (NewInputFile (SB_GetConstBuf (&CurTok.SVal)) == 0) { + if (NewInputFile (SB_GetConstBuf (&CurTok.SVal)) == 0) { /* Error opening the file, skip remainder of line */ SkipUntilSep (); } @@ -1347,8 +1347,8 @@ static void DoInterruptor (void) /* Symbol name follows */ if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); - return; + ErrorSkip ("Identifier expected"); + return; } SB_Copy (&Name, &CurTok.SVal); NextTok (); @@ -1393,9 +1393,9 @@ static void DoList (void) /* Manage the counter */ if (List) { - EnableListing (); + EnableListing (); } else { - DisableListing (); + DisableListing (); } } @@ -1427,14 +1427,14 @@ static void DoLocalChar (void) /* Define the character that starts local labels */ { if (CurTok.Tok != TOK_CHARCON) { - ErrorSkip ("Character constant expected"); + ErrorSkip ("Character constant expected"); } else { - if (CurTok.IVal != '@' && CurTok.IVal != '?') { - Error ("Invalid start character for locals"); - } else { - LocalStart = (char) CurTok.IVal; - } - NextTok (); + if (CurTok.IVal != '@' && CurTok.IVal != '?') { + Error ("Invalid start character for locals"); + } else { + LocalStart = (char) CurTok.IVal; + } + NextTok (); } } @@ -1445,11 +1445,11 @@ static void DoMacPack (void) { /* We expect an identifier */ if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); + ErrorSkip ("Identifier expected"); } else { SB_AppendStr (&CurTok.SVal, ".mac"); SB_Terminate (&CurTok.SVal); - if (NewInputFile (SB_GetConstBuf (&CurTok.SVal)) == 0) { + if (NewInputFile (SB_GetConstBuf (&CurTok.SVal)) == 0) { /* Error opening the file, skip remainder of line */ SkipUntilSep (); } @@ -1479,8 +1479,8 @@ static void DoOrg (void) { long PC = ConstExpression (); if (PC < 0 || PC > 0xFFFFFF) { - Error ("Range error"); - return; + Error ("Range error"); + return; } EnterAbsoluteMode (PC); } @@ -1491,16 +1491,16 @@ static void DoOut (void) /* Output a string */ { if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); + ErrorSkip ("String constant expected"); } else { - /* Output the string and be sure to flush the output to keep it in - * sync with any error messages if the output is redirected to a file. - */ - printf ("%.*s\n", + /* Output the string and be sure to flush the output to keep it in + * sync with any error messages if the output is redirected to a file. + */ + printf ("%.*s\n", (int) SB_GetLen (&CurTok.SVal), SB_GetConstBuf (&CurTok.SVal)); - fflush (stdout); - NextTok (); + fflush (stdout); + NextTok (); } } @@ -1586,11 +1586,11 @@ static void DoProc (void) if (CurTok.Tok == TOK_IDENT) { - /* The new scope has a name. Remember it. */ + /* The new scope has a name. Remember it. */ SB_Copy (&Name, &CurTok.SVal); /* Search for the symbol, generate a new one if needed */ - Sym = SymFind (CurrentScope, &Name, SYM_ALLOC_NEW); + Sym = SymFind (CurrentScope, &Name, SYM_ALLOC_NEW); /* Skip the scope name */ NextTok (); @@ -1599,7 +1599,7 @@ static void DoProc (void) AddrSize = OptionalAddrSize (); /* Mark the symbol as defined */ - SymDef (Sym, GenCurrentPC (), AddrSize, SF_LABEL); + SymDef (Sym, GenCurrentPC (), AddrSize, SF_LABEL); } else { @@ -1681,26 +1681,26 @@ static void DoRes (void) Count = ConstExpression (); if (Count > 0xFFFF || Count < 0) { - ErrorSkip ("Range error"); - return; + ErrorSkip ("Range error"); + return; } if (CurTok.Tok == TOK_COMMA) { - NextTok (); - Val = ConstExpression (); - /* We need a byte value here */ - if (!IsByteRange (Val)) { - ErrorSkip ("Range error"); - return; - } + NextTok (); + Val = ConstExpression (); + /* We need a byte value here */ + if (!IsByteRange (Val)) { + ErrorSkip ("Range error"); + return; + } - /* Emit constant values */ - while (Count--) { - Emit0 ((unsigned char) Val); - } + /* Emit constant values */ + while (Count--) { + Emit0 ((unsigned char) Val); + } } else { - /* Emit fill fragments */ - EmitFill (Count); + /* Emit fill fragments */ + EmitFill (Count); } } @@ -1723,7 +1723,7 @@ static void DoScope (void) if (CurTok.Tok == TOK_IDENT) { - /* The new scope has a name. Remember and skip it. */ + /* The new scope has a name. Remember and skip it. */ SB_Copy (&Name, &CurTok.SVal); NextTok (); @@ -1753,22 +1753,22 @@ static void DoSegment (void) SegDef Def; if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); + ErrorSkip ("String constant expected"); } else { - /* Save the name of the segment and skip it */ - SB_Copy (&Name, &CurTok.SVal); - NextTok (); + /* Save the name of the segment and skip it */ + SB_Copy (&Name, &CurTok.SVal); + NextTok (); /* Use the name for the segment definition */ SB_Terminate (&Name); Def.Name = SB_GetBuf (&Name); - /* Check for an optional address size modifier */ + /* Check for an optional address size modifier */ Def.AddrSize = OptionalAddrSize (); - /* Set the segment */ - UseSeg (&Def); + /* Set the segment */ + UseSeg (&Def); } /* Free memory for Name */ @@ -1782,7 +1782,7 @@ static void DoSetCPU (void) { /* We expect an identifier */ if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); + ErrorSkip ("String constant expected"); } else { cpu_t CPU; @@ -1879,7 +1879,7 @@ static void DoUnDef (void) /* We expect an identifier */ if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); + ErrorSkip ("Identifier expected"); } else { MacUndef (&CurTok.SVal, MAC_STYLE_DEFINE); NextTok (); @@ -1901,10 +1901,10 @@ static void DoWarning (void) /* User warning */ { if (CurTok.Tok != TOK_STRCON) { - ErrorSkip ("String constant expected"); + ErrorSkip ("String constant expected"); } else { - Warning (0, "User warning: %m%p", &CurTok.SVal); - SkipUntilSep (); + Warning (0, "User warning: %m%p", &CurTok.SVal); + SkipUntilSep (); } } @@ -1922,12 +1922,12 @@ static void DoWord (void) /* Parse arguments */ while (1) { - EmitWord (BoundedExpr (Expression, 2)); - if (CurTok.Tok != TOK_COMMA) { - break; - } else { - NextTok (); - } + EmitWord (BoundedExpr (Expression, 2)); + if (CurTok.Tok != TOK_COMMA) { + break; + } else { + NextTok (); + } } /* Close the span, then add type information to it */ @@ -1949,167 +1949,167 @@ static void DoZeropage (void) /*****************************************************************************/ -/* Table data */ +/* Table data */ /*****************************************************************************/ /* Control commands flags */ enum { - ccNone = 0x0000, /* No special flags */ - ccKeepToken = 0x0001 /* Do not skip the current token */ + ccNone = 0x0000, /* No special flags */ + ccKeepToken = 0x0001 /* Do not skip the current token */ }; /* Control command table */ typedef struct CtrlDesc CtrlDesc; struct CtrlDesc { - unsigned Flags; /* Flags for this directive */ - void (*Handler) (void); /* Command handler */ + unsigned Flags; /* Flags for this directive */ + void (*Handler) (void); /* Command handler */ }; -#define PSEUDO_COUNT (sizeof (CtrlCmdTab) / sizeof (CtrlCmdTab [0])) +#define PSEUDO_COUNT (sizeof (CtrlCmdTab) / sizeof (CtrlCmdTab [0])) static CtrlDesc CtrlCmdTab [] = { - { ccNone, DoA16 }, - { ccNone, DoA8 }, - { ccNone, DoAddr }, /* .ADDR */ - { ccNone, DoAlign }, - { ccNone, DoASCIIZ }, + { ccNone, DoA16 }, + { ccNone, DoA8 }, + { ccNone, DoAddr }, /* .ADDR */ + { ccNone, DoAlign }, + { ccNone, DoASCIIZ }, { ccNone, DoAssert }, - { ccNone, DoAutoImport }, + { ccNone, DoAutoImport }, { ccNone, DoUnexpected }, /* .BANK */ - { ccNone, DoUnexpected }, /* .BANKBYTE */ + { ccNone, DoUnexpected }, /* .BANKBYTE */ { ccNone, DoBankBytes }, - { ccNone, DoUnexpected }, /* .BLANK */ - { ccNone, DoBss }, - { ccNone, DoByte }, - { ccNone, DoCase }, - { ccNone, DoCharMap }, - { ccNone, DoCode }, - { ccNone, DoUnexpected, }, /* .CONCAT */ - { ccNone, DoConDes }, - { ccNone, DoUnexpected }, /* .CONST */ - { ccNone, DoConstructor }, - { ccNone, DoUnexpected }, /* .CPU */ - { ccNone, DoData }, - { ccNone, DoDbg, }, - { ccNone, DoDByt }, - { ccNone, DoDebugInfo }, - { ccNone, DoDefine }, - { ccNone, DoUnexpected }, /* .DEFINED */ + { ccNone, DoUnexpected }, /* .BLANK */ + { ccNone, DoBss }, + { ccNone, DoByte }, + { ccNone, DoCase }, + { ccNone, DoCharMap }, + { ccNone, DoCode }, + { ccNone, DoUnexpected, }, /* .CONCAT */ + { ccNone, DoConDes }, + { ccNone, DoUnexpected }, /* .CONST */ + { ccNone, DoConstructor }, + { ccNone, DoUnexpected }, /* .CPU */ + { ccNone, DoData }, + { ccNone, DoDbg, }, + { ccNone, DoDByt }, + { ccNone, DoDebugInfo }, + { ccNone, DoDefine }, + { ccNone, DoUnexpected }, /* .DEFINED */ { ccNone, DoDelMac }, - { ccNone, DoDestructor }, - { ccNone, DoDWord }, - { ccKeepToken, DoConditionals }, /* .ELSE */ - { ccKeepToken, DoConditionals }, /* .ELSEIF */ - { ccKeepToken, DoEnd }, + { ccNone, DoDestructor }, + { ccNone, DoDWord }, + { ccKeepToken, DoConditionals }, /* .ELSE */ + { ccKeepToken, DoConditionals }, /* .ELSEIF */ + { ccKeepToken, DoEnd }, { ccNone, DoUnexpected }, /* .ENDENUM */ - { ccKeepToken, DoConditionals }, /* .ENDIF */ - { ccNone, DoUnexpected }, /* .ENDMACRO */ - { ccNone, DoEndProc }, - { ccNone, DoUnexpected }, /* .ENDREPEAT */ + { ccKeepToken, DoConditionals }, /* .ENDIF */ + { ccNone, DoUnexpected }, /* .ENDMACRO */ + { ccNone, DoEndProc }, + { ccNone, DoUnexpected }, /* .ENDREPEAT */ { ccNone, DoEndScope }, { ccNone, DoUnexpected }, /* .ENDSTRUCT */ { ccNone, DoUnexpected }, /* .ENDUNION */ { ccNone, DoEnum }, - { ccNone, DoError }, - { ccNone, DoExitMacro }, - { ccNone, DoExport }, - { ccNone, DoExportZP }, - { ccNone, DoFarAddr }, - { ccNone, DoFatal }, - { ccNone, DoFeature }, - { ccNone, DoFileOpt }, + { ccNone, DoError }, + { ccNone, DoExitMacro }, + { ccNone, DoExport }, + { ccNone, DoExportZP }, + { ccNone, DoFarAddr }, + { ccNone, DoFatal }, + { ccNone, DoFeature }, + { ccNone, DoFileOpt }, { ccNone, DoForceImport }, - { ccNone, DoUnexpected }, /* .FORCEWORD */ - { ccNone, DoGlobal }, - { ccNone, DoGlobalZP }, - { ccNone, DoUnexpected }, /* .HIBYTE */ + { ccNone, DoUnexpected }, /* .FORCEWORD */ + { ccNone, DoGlobal }, + { ccNone, DoGlobalZP }, + { ccNone, DoUnexpected }, /* .HIBYTE */ { ccNone, DoHiBytes }, - { ccNone, DoUnexpected }, /* .HIWORD */ - { ccNone, DoI16 }, - { ccNone, DoI8 }, + { ccNone, DoUnexpected }, /* .HIWORD */ + { ccNone, DoI16 }, + { ccNone, DoI8 }, { ccNone, DoUnexpected }, /* .IDENT */ - { ccKeepToken, DoConditionals }, /* .IF */ - { ccKeepToken, DoConditionals }, /* .IFBLANK */ - { ccKeepToken, DoConditionals }, /* .IFCONST */ - { ccKeepToken, DoConditionals }, /* .IFDEF */ - { ccKeepToken, DoConditionals }, /* .IFNBLANK */ - { ccKeepToken, DoConditionals }, /* .IFNCONST */ - { ccKeepToken, DoConditionals }, /* .IFNDEF */ - { ccKeepToken, DoConditionals }, /* .IFNREF */ - { ccKeepToken, DoConditionals }, /* .IFP02 */ - { ccKeepToken, DoConditionals }, /* .IFP816 */ - { ccKeepToken, DoConditionals }, /* .IFPC02 */ - { ccKeepToken, DoConditionals }, /* .IFPSC02 */ - { ccKeepToken, DoConditionals }, /* .IFREF */ - { ccNone, DoImport }, - { ccNone, DoImportZP }, - { ccNone, DoIncBin }, - { ccNone, DoInclude }, + { ccKeepToken, DoConditionals }, /* .IF */ + { ccKeepToken, DoConditionals }, /* .IFBLANK */ + { ccKeepToken, DoConditionals }, /* .IFCONST */ + { ccKeepToken, DoConditionals }, /* .IFDEF */ + { ccKeepToken, DoConditionals }, /* .IFNBLANK */ + { ccKeepToken, DoConditionals }, /* .IFNCONST */ + { ccKeepToken, DoConditionals }, /* .IFNDEF */ + { ccKeepToken, DoConditionals }, /* .IFNREF */ + { ccKeepToken, DoConditionals }, /* .IFP02 */ + { ccKeepToken, DoConditionals }, /* .IFP816 */ + { ccKeepToken, DoConditionals }, /* .IFPC02 */ + { ccKeepToken, DoConditionals }, /* .IFPSC02 */ + { ccKeepToken, DoConditionals }, /* .IFREF */ + { ccNone, DoImport }, + { ccNone, DoImportZP }, + { ccNone, DoIncBin }, + { ccNone, DoInclude }, { ccNone, DoInterruptor }, - { ccNone, DoInvalid }, /* .LEFT */ - { ccNone, DoLineCont }, - { ccNone, DoList }, - { ccNone, DoListBytes }, - { ccNone, DoUnexpected }, /* .LOBYTE */ + { ccNone, DoInvalid }, /* .LEFT */ + { ccNone, DoLineCont }, + { ccNone, DoList }, + { ccNone, DoListBytes }, + { ccNone, DoUnexpected }, /* .LOBYTE */ { ccNone, DoLoBytes }, - { ccNone, DoUnexpected }, /* .LOCAL */ - { ccNone, DoLocalChar }, - { ccNone, DoUnexpected }, /* .LOWORD */ - { ccNone, DoMacPack }, - { ccNone, DoMacro }, - { ccNone, DoUnexpected }, /* .MATCH */ - { ccNone, DoUnexpected }, /* .MAX */ - { ccNone, DoInvalid }, /* .MID */ - { ccNone, DoUnexpected }, /* .MIN */ - { ccNone, DoNull }, - { ccNone, DoOrg }, - { ccNone, DoOut }, - { ccNone, DoP02 }, - { ccNone, DoP816 }, - { ccNone, DoPageLength }, - { ccNone, DoUnexpected }, /* .PARAMCOUNT */ - { ccNone, DoPC02 }, + { ccNone, DoUnexpected }, /* .LOCAL */ + { ccNone, DoLocalChar }, + { ccNone, DoUnexpected }, /* .LOWORD */ + { ccNone, DoMacPack }, + { ccNone, DoMacro }, + { ccNone, DoUnexpected }, /* .MATCH */ + { ccNone, DoUnexpected }, /* .MAX */ + { ccNone, DoInvalid }, /* .MID */ + { ccNone, DoUnexpected }, /* .MIN */ + { ccNone, DoNull }, + { ccNone, DoOrg }, + { ccNone, DoOut }, + { ccNone, DoP02 }, + { ccNone, DoP816 }, + { ccNone, DoPageLength }, + { ccNone, DoUnexpected }, /* .PARAMCOUNT */ + { ccNone, DoPC02 }, { ccNone, DoPopCPU }, { ccNone, DoPopSeg }, - { ccNone, DoProc }, - { ccNone, DoPSC02 }, + { ccNone, DoProc }, + { ccNone, DoPSC02 }, { ccNone, DoPushCPU }, { ccNone, DoPushSeg }, - { ccNone, DoUnexpected }, /* .REFERENCED */ - { ccNone, DoReloc }, - { ccNone, DoRepeat }, - { ccNone, DoRes }, - { ccNone, DoInvalid }, /* .RIGHT */ - { ccNone, DoROData }, + { ccNone, DoUnexpected }, /* .REFERENCED */ + { ccNone, DoReloc }, + { ccNone, DoRepeat }, + { ccNone, DoRes }, + { ccNone, DoInvalid }, /* .RIGHT */ + { ccNone, DoROData }, { ccNone, DoScope }, - { ccNone, DoSegment }, + { ccNone, DoSegment }, { ccNone, DoUnexpected }, /* .SET */ - { ccNone, DoSetCPU }, + { ccNone, DoSetCPU }, { ccNone, DoUnexpected }, /* .SIZEOF */ - { ccNone, DoSmart }, + { ccNone, DoSmart }, { ccNone, DoUnexpected }, /* .SPRINTF */ - { ccNone, DoUnexpected }, /* .STRAT */ - { ccNone, DoUnexpected }, /* .STRING */ - { ccNone, DoUnexpected }, /* .STRLEN */ + { ccNone, DoUnexpected }, /* .STRAT */ + { ccNone, DoUnexpected }, /* .STRING */ + { ccNone, DoUnexpected }, /* .STRLEN */ { ccNone, DoStruct }, - { ccNone, DoSunPlus }, + { ccNone, DoSunPlus }, { ccNone, DoTag }, - { ccNone, DoUnexpected }, /* .TCOUNT */ - { ccNone, DoUnexpected }, /* .TIME */ + { ccNone, DoUnexpected }, /* .TCOUNT */ + { ccNone, DoUnexpected }, /* .TIME */ { ccKeepToken, DoUnDef }, { ccNone, DoUnion }, { ccNone, DoUnexpected }, /* .VERSION */ - { ccNone, DoWarning }, - { ccNone, DoWord }, - { ccNone, DoUnexpected }, /* .XMATCH */ - { ccNone, DoZeropage }, + { ccNone, DoWarning }, + { ccNone, DoWord }, + { ccNone, DoUnexpected }, /* .XMATCH */ + { ccNone, DoZeropage }, }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -2124,8 +2124,8 @@ void HandlePseudo (void) /* Safety check */ if (PSEUDO_COUNT != (TOK_LASTPSEUDO - TOK_FIRSTPSEUDO + 1)) { - Internal ("Pseudo mismatch: PSEUDO_COUNT = %u, actual count = %u\n", - (unsigned) PSEUDO_COUNT, TOK_LASTPSEUDO - TOK_FIRSTPSEUDO + 1); + Internal ("Pseudo mismatch: PSEUDO_COUNT = %u, actual count = %u\n", + (unsigned) PSEUDO_COUNT, TOK_LASTPSEUDO - TOK_FIRSTPSEUDO + 1); } CHECK (Index < PSEUDO_COUNT); @@ -2134,8 +2134,8 @@ void HandlePseudo (void) /* Remember the instruction, then skip it if needed */ if ((D->Flags & ccKeepToken) == 0) { - SB_Copy (&Keyword, &CurTok.SVal); - NextTok (); + SB_Copy (&Keyword, &CurTok.SVal); + NextTok (); } /* Call the handler */ diff --git a/src/ca65/pseudo.h b/src/ca65/pseudo.h index ba2636825..006b27909 100644 --- a/src/ca65/pseudo.h +++ b/src/ca65/pseudo.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* pseudo.h */ +/* pseudo.h */ /* */ -/* Pseudo instructions for the ca65 macroassembler */ +/* Pseudo instructions for the ca65 macroassembler */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/repeat.c b/src/ca65/repeat.c index d433d3136..915c8a78f 100644 --- a/src/ca65/repeat.c +++ b/src/ca65/repeat.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* repeat.c */ +/* repeat.c */ /* */ -/* Handle the .REPEAT pseudo instruction */ +/* Handle the .REPEAT pseudo instruction */ /* */ /* */ /* */ @@ -48,7 +48,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -65,25 +65,25 @@ static TokList* CollectRepeatTokens (void) unsigned Repeats = 0; while (Repeats != 0 || CurTok.Tok != TOK_ENDREP) { - /* Check for end of input */ - if (CurTok.Tok == TOK_EOF) { - Error ("Unexpected end of file"); - FreeTokList (List); - return 0; - } + /* Check for end of input */ + if (CurTok.Tok == TOK_EOF) { + Error ("Unexpected end of file"); + FreeTokList (List); + return 0; + } - /* Collect all tokens in the list */ - AddCurTok (List); + /* Collect all tokens in the list */ + AddCurTok (List); - /* Check for and count nested .REPEATs */ - if (CurTok.Tok == TOK_REPEAT) { - ++Repeats; - } else if (CurTok.Tok == TOK_ENDREP) { - --Repeats; - } + /* Check for and count nested .REPEATs */ + if (CurTok.Tok == TOK_REPEAT) { + ++Repeats; + } else if (CurTok.Tok == TOK_ENDREP) { + --Repeats; + } - /* Get the next token */ - NextTok (); + /* Get the next token */ + NextTok (); } /* Eat the closing .ENDREP */ @@ -103,9 +103,9 @@ static void RepeatTokenCheck (TokList* L) if (CurTok.Tok == TOK_IDENT && L->Data != 0 && SB_CompareStr (&CurTok.SVal, L->Data) == 0) { - /* Must replace by the repeat counter */ - CurTok.Tok = TOK_INTCON; - CurTok.IVal = L->RepCount; + /* Must replace by the repeat counter */ + CurTok.Tok = TOK_INTCON; + CurTok.IVal = L->RepCount; } } @@ -120,26 +120,26 @@ void ParseRepeat (void) /* Repeat count follows */ long RepCount = ConstExpression (); if (RepCount < 0) { - Error ("Range error"); - RepCount = 0; + Error ("Range error"); + RepCount = 0; } /* Optional there is a comma and a counter variable */ Name = 0; if (CurTok.Tok == TOK_COMMA) { - /* Skip the comma */ - NextTok (); + /* Skip the comma */ + NextTok (); - /* Check for an identifier */ - if (CurTok.Tok != TOK_IDENT) { - ErrorSkip ("Identifier expected"); - } else { - /* Remember the name and skip it */ + /* Check for an identifier */ + if (CurTok.Tok != TOK_IDENT) { + ErrorSkip ("Identifier expected"); + } else { + /* Remember the name and skip it */ SB_Terminate (&CurTok.SVal); - Name = xstrdup (SB_GetConstBuf (&CurTok.SVal)); - NextTok (); - } + Name = xstrdup (SB_GetConstBuf (&CurTok.SVal)); + NextTok (); + } } /* Switch to raw token mode, then skip the separator */ @@ -151,8 +151,8 @@ void ParseRepeat (void) /* If we had an error, bail out */ if (List == 0) { - xfree (Name); - goto Done; + xfree (Name); + goto Done; } /* Update the token list for replay */ @@ -164,8 +164,8 @@ void ParseRepeat (void) * to repeat. */ if (List->Count == 0 || RepCount == 0) { - FreeTokList (List); - goto Done; + FreeTokList (List); + goto Done; } /* Read input from the repeat descriptor */ diff --git a/src/ca65/repeat.h b/src/ca65/repeat.h index 8bb5d3ec8..1cdccc0e3 100644 --- a/src/ca65/repeat.h +++ b/src/ca65/repeat.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* repeat.h */ +/* repeat.h */ /* */ -/* Handle the .REPEAT pseudo instruction */ +/* Handle the .REPEAT pseudo instruction */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/scanner.c b/src/ca65/scanner.c index f99876c33..aadb91d54 100644 --- a/src/ca65/scanner.c +++ b/src/ca65/scanner.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* scanner.c */ +/* scanner.c */ /* */ -/* The scanner for the ca65 macroassembler */ +/* The scanner for the ca65 macroassembler */ /* */ /* */ /* */ @@ -64,7 +64,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -75,25 +75,25 @@ Token CurTok = STATIC_TOKEN_INITIALIZER; /* Struct to handle include files. */ typedef struct InputFile InputFile; struct InputFile { - FILE* F; /* Input file descriptor */ - FilePos Pos; /* Position in file */ - token_t Tok; /* Last token */ - int C; /* Last character */ + FILE* F; /* Input file descriptor */ + FilePos Pos; /* Position in file */ + token_t Tok; /* Last token */ + int C; /* Last character */ StrBuf Line; /* The current input line */ int IncSearchPath; /* True if we've added a search path */ int BinSearchPath; /* True if we've added a search path */ - InputFile* Next; /* Linked list of input files */ + InputFile* Next; /* Linked list of input files */ }; /* Struct to handle textual input data */ typedef struct InputData InputData; struct InputData { - char* Text; /* Pointer to the text data */ - const char* Pos; /* Pointer to current position */ - int Malloced; /* Memory was malloced */ - token_t Tok; /* Last token */ - int C; /* Last character */ - InputData* Next; /* Linked list of input data */ + char* Text; /* Pointer to the text data */ + const char* Pos; /* Pointer to current position */ + int Malloced; /* Memory was malloced */ + token_t Tok; /* Last token */ + int C; /* Last character */ + InputData* Next; /* Linked list of input data */ }; /* Input source: Either file or data */ @@ -110,8 +110,8 @@ struct CharSourceFunctions { /* Input source: Either file or data */ struct CharSource { CharSource* Next; /* Linked list of char sources */ - token_t Tok; /* Last token */ - int C; /* Last character */ + token_t Tok; /* Last token */ + int C; /* Last character */ const CharSourceFunctions* Func; /* Pointer to function table */ union { InputFile File; /* File data */ @@ -121,174 +121,174 @@ struct CharSource { /* Current input variables */ static CharSource* Source = 0; /* Current char source */ -static unsigned FCount = 0; /* Count of input files */ -static int C = 0; /* Current input character */ +static unsigned FCount = 0; /* Count of input files */ +static int C = 0; /* Current input character */ /* Force end of assembly */ -int ForcedEnd = 0; +int ForcedEnd = 0; /* List of dot keywords with the corresponding tokens */ struct DotKeyword { - const char* Key; /* MUST be first field */ + const char* Key; /* MUST be first field */ token_t Tok; } DotKeywords [] = { - { ".A16", TOK_A16 }, - { ".A8", TOK_A8 }, - { ".ADDR", TOK_ADDR }, - { ".ALIGN", TOK_ALIGN }, - { ".AND", TOK_BOOLAND }, - { ".ASCIIZ", TOK_ASCIIZ }, + { ".A16", TOK_A16 }, + { ".A8", TOK_A8 }, + { ".ADDR", TOK_ADDR }, + { ".ALIGN", TOK_ALIGN }, + { ".AND", TOK_BOOLAND }, + { ".ASCIIZ", TOK_ASCIIZ }, { ".ASSERT", TOK_ASSERT }, - { ".AUTOIMPORT", TOK_AUTOIMPORT }, + { ".AUTOIMPORT", TOK_AUTOIMPORT }, { ".BANK", TOK_BANK }, { ".BANKBYTE", TOK_BANKBYTE }, { ".BANKBYTES", TOK_BANKBYTES }, - { ".BITAND", TOK_AND }, - { ".BITNOT", TOK_NOT }, - { ".BITOR", TOK_OR }, - { ".BITXOR", TOK_XOR }, - { ".BLANK", TOK_BLANK }, - { ".BSS", TOK_BSS }, - { ".BYT", TOK_BYTE }, - { ".BYTE", TOK_BYTE }, - { ".CASE", TOK_CASE }, - { ".CHARMAP", TOK_CHARMAP }, - { ".CODE", TOK_CODE }, - { ".CONCAT", TOK_CONCAT }, - { ".CONDES", TOK_CONDES }, - { ".CONST", TOK_CONST }, - { ".CONSTRUCTOR", TOK_CONSTRUCTOR }, - { ".CPU", TOK_CPU }, - { ".DATA", TOK_DATA }, - { ".DBG", TOK_DBG }, - { ".DBYT", TOK_DBYT }, - { ".DEBUGINFO", TOK_DEBUGINFO }, - { ".DEF", TOK_DEFINED }, - { ".DEFINE", TOK_DEFINE }, - { ".DEFINED", TOK_DEFINED }, + { ".BITAND", TOK_AND }, + { ".BITNOT", TOK_NOT }, + { ".BITOR", TOK_OR }, + { ".BITXOR", TOK_XOR }, + { ".BLANK", TOK_BLANK }, + { ".BSS", TOK_BSS }, + { ".BYT", TOK_BYTE }, + { ".BYTE", TOK_BYTE }, + { ".CASE", TOK_CASE }, + { ".CHARMAP", TOK_CHARMAP }, + { ".CODE", TOK_CODE }, + { ".CONCAT", TOK_CONCAT }, + { ".CONDES", TOK_CONDES }, + { ".CONST", TOK_CONST }, + { ".CONSTRUCTOR", TOK_CONSTRUCTOR }, + { ".CPU", TOK_CPU }, + { ".DATA", TOK_DATA }, + { ".DBG", TOK_DBG }, + { ".DBYT", TOK_DBYT }, + { ".DEBUGINFO", TOK_DEBUGINFO }, + { ".DEF", TOK_DEFINED }, + { ".DEFINE", TOK_DEFINE }, + { ".DEFINED", TOK_DEFINED }, { ".DELMAC", TOK_DELMAC }, { ".DELMACRO", TOK_DELMAC }, - { ".DESTRUCTOR", TOK_DESTRUCTOR }, - { ".DWORD", TOK_DWORD }, - { ".ELSE", TOK_ELSE }, - { ".ELSEIF", TOK_ELSEIF }, - { ".END", TOK_END }, + { ".DESTRUCTOR", TOK_DESTRUCTOR }, + { ".DWORD", TOK_DWORD }, + { ".ELSE", TOK_ELSE }, + { ".ELSEIF", TOK_ELSEIF }, + { ".END", TOK_END }, { ".ENDENUM", TOK_ENDENUM }, - { ".ENDIF", TOK_ENDIF }, - { ".ENDMAC", TOK_ENDMACRO }, - { ".ENDMACRO", TOK_ENDMACRO }, - { ".ENDPROC", TOK_ENDPROC }, - { ".ENDREP", TOK_ENDREP }, - { ".ENDREPEAT", TOK_ENDREP }, + { ".ENDIF", TOK_ENDIF }, + { ".ENDMAC", TOK_ENDMACRO }, + { ".ENDMACRO", TOK_ENDMACRO }, + { ".ENDPROC", TOK_ENDPROC }, + { ".ENDREP", TOK_ENDREP }, + { ".ENDREPEAT", TOK_ENDREP }, { ".ENDSCOPE", TOK_ENDSCOPE }, - { ".ENDSTRUCT", TOK_ENDSTRUCT }, - { ".ENDUNION", TOK_ENDUNION }, + { ".ENDSTRUCT", TOK_ENDSTRUCT }, + { ".ENDUNION", TOK_ENDUNION }, { ".ENUM", TOK_ENUM }, - { ".ERROR", TOK_ERROR }, - { ".EXITMAC", TOK_EXITMACRO }, - { ".EXITMACRO", TOK_EXITMACRO }, - { ".EXPORT", TOK_EXPORT }, - { ".EXPORTZP", TOK_EXPORTZP }, - { ".FARADDR", TOK_FARADDR }, + { ".ERROR", TOK_ERROR }, + { ".EXITMAC", TOK_EXITMACRO }, + { ".EXITMACRO", TOK_EXITMACRO }, + { ".EXPORT", TOK_EXPORT }, + { ".EXPORTZP", TOK_EXPORTZP }, + { ".FARADDR", TOK_FARADDR }, { ".FATAL", TOK_FATAL }, - { ".FEATURE", TOK_FEATURE }, - { ".FILEOPT", TOK_FILEOPT }, - { ".FOPT", TOK_FILEOPT }, + { ".FEATURE", TOK_FEATURE }, + { ".FILEOPT", TOK_FILEOPT }, + { ".FOPT", TOK_FILEOPT }, { ".FORCEIMPORT", TOK_FORCEIMPORT }, - { ".FORCEWORD", TOK_FORCEWORD }, - { ".GLOBAL", TOK_GLOBAL }, - { ".GLOBALZP", TOK_GLOBALZP }, + { ".FORCEWORD", TOK_FORCEWORD }, + { ".GLOBAL", TOK_GLOBAL }, + { ".GLOBALZP", TOK_GLOBALZP }, { ".HIBYTE", TOK_HIBYTE }, { ".HIBYTES", TOK_HIBYTES }, { ".HIWORD", TOK_HIWORD }, - { ".I16", TOK_I16 }, - { ".I8", TOK_I8 }, + { ".I16", TOK_I16 }, + { ".I8", TOK_I8 }, { ".IDENT", TOK_MAKEIDENT }, - { ".IF", TOK_IF }, - { ".IFBLANK", TOK_IFBLANK }, - { ".IFCONST", TOK_IFCONST }, - { ".IFDEF", TOK_IFDEF }, - { ".IFNBLANK", TOK_IFNBLANK }, - { ".IFNCONST", TOK_IFNCONST }, - { ".IFNDEF", TOK_IFNDEF }, - { ".IFNREF", TOK_IFNREF }, - { ".IFP02", TOK_IFP02 }, - { ".IFP816", TOK_IFP816 }, - { ".IFPC02", TOK_IFPC02 }, - { ".IFPSC02", TOK_IFPSC02 }, - { ".IFREF", TOK_IFREF }, - { ".IMPORT", TOK_IMPORT }, - { ".IMPORTZP", TOK_IMPORTZP }, - { ".INCBIN", TOK_INCBIN }, - { ".INCLUDE", TOK_INCLUDE }, + { ".IF", TOK_IF }, + { ".IFBLANK", TOK_IFBLANK }, + { ".IFCONST", TOK_IFCONST }, + { ".IFDEF", TOK_IFDEF }, + { ".IFNBLANK", TOK_IFNBLANK }, + { ".IFNCONST", TOK_IFNCONST }, + { ".IFNDEF", TOK_IFNDEF }, + { ".IFNREF", TOK_IFNREF }, + { ".IFP02", TOK_IFP02 }, + { ".IFP816", TOK_IFP816 }, + { ".IFPC02", TOK_IFPC02 }, + { ".IFPSC02", TOK_IFPSC02 }, + { ".IFREF", TOK_IFREF }, + { ".IMPORT", TOK_IMPORT }, + { ".IMPORTZP", TOK_IMPORTZP }, + { ".INCBIN", TOK_INCBIN }, + { ".INCLUDE", TOK_INCLUDE }, { ".INTERRUPTOR", TOK_INTERRUPTOR }, - { ".LEFT", TOK_LEFT }, - { ".LINECONT", TOK_LINECONT }, - { ".LIST", TOK_LIST }, - { ".LISTBYTES", TOK_LISTBYTES }, + { ".LEFT", TOK_LEFT }, + { ".LINECONT", TOK_LINECONT }, + { ".LIST", TOK_LIST }, + { ".LISTBYTES", TOK_LISTBYTES }, { ".LOBYTE", TOK_LOBYTE }, { ".LOBYTES", TOK_LOBYTES }, - { ".LOCAL", TOK_LOCAL }, - { ".LOCALCHAR", TOK_LOCALCHAR }, + { ".LOCAL", TOK_LOCAL }, + { ".LOCALCHAR", TOK_LOCALCHAR }, { ".LOWORD", TOK_LOWORD }, - { ".MAC", TOK_MACRO }, - { ".MACPACK", TOK_MACPACK }, - { ".MACRO", TOK_MACRO }, - { ".MATCH", TOK_MATCH }, + { ".MAC", TOK_MACRO }, + { ".MACPACK", TOK_MACPACK }, + { ".MACRO", TOK_MACRO }, + { ".MATCH", TOK_MATCH }, { ".MAX", TOK_MAX }, - { ".MID", TOK_MID }, + { ".MID", TOK_MID }, { ".MIN", TOK_MIN }, - { ".MOD", TOK_MOD }, - { ".NOT", TOK_BOOLNOT }, - { ".NULL", TOK_NULL }, - { ".OR", TOK_BOOLOR }, - { ".ORG", TOK_ORG }, - { ".OUT", TOK_OUT }, - { ".P02", TOK_P02 }, - { ".P816", TOK_P816 }, - { ".PAGELEN", TOK_PAGELENGTH }, - { ".PAGELENGTH", TOK_PAGELENGTH }, - { ".PARAMCOUNT", TOK_PARAMCOUNT }, - { ".PC02", TOK_PC02 }, + { ".MOD", TOK_MOD }, + { ".NOT", TOK_BOOLNOT }, + { ".NULL", TOK_NULL }, + { ".OR", TOK_BOOLOR }, + { ".ORG", TOK_ORG }, + { ".OUT", TOK_OUT }, + { ".P02", TOK_P02 }, + { ".P816", TOK_P816 }, + { ".PAGELEN", TOK_PAGELENGTH }, + { ".PAGELENGTH", TOK_PAGELENGTH }, + { ".PARAMCOUNT", TOK_PARAMCOUNT }, + { ".PC02", TOK_PC02 }, { ".POPCPU", TOK_POPCPU }, - { ".POPSEG", TOK_POPSEG }, - { ".PROC", TOK_PROC }, - { ".PSC02", TOK_PSC02 }, + { ".POPSEG", TOK_POPSEG }, + { ".PROC", TOK_PROC }, + { ".PSC02", TOK_PSC02 }, { ".PUSHCPU", TOK_PUSHCPU }, - { ".PUSHSEG", TOK_PUSHSEG }, - { ".REF", TOK_REFERENCED }, - { ".REFERENCED", TOK_REFERENCED }, - { ".RELOC", TOK_RELOC }, - { ".REPEAT", TOK_REPEAT }, - { ".RES", TOK_RES }, - { ".RIGHT", TOK_RIGHT }, - { ".RODATA", TOK_RODATA }, + { ".PUSHSEG", TOK_PUSHSEG }, + { ".REF", TOK_REFERENCED }, + { ".REFERENCED", TOK_REFERENCED }, + { ".RELOC", TOK_RELOC }, + { ".REPEAT", TOK_REPEAT }, + { ".RES", TOK_RES }, + { ".RIGHT", TOK_RIGHT }, + { ".RODATA", TOK_RODATA }, { ".SCOPE", TOK_SCOPE }, - { ".SEGMENT", TOK_SEGMENT }, + { ".SEGMENT", TOK_SEGMENT }, { ".SET", TOK_SET }, - { ".SETCPU", TOK_SETCPU }, - { ".SHL", TOK_SHL }, - { ".SHR", TOK_SHR }, + { ".SETCPU", TOK_SETCPU }, + { ".SHL", TOK_SHL }, + { ".SHR", TOK_SHR }, { ".SIZEOF", TOK_SIZEOF }, - { ".SMART", TOK_SMART }, + { ".SMART", TOK_SMART }, { ".SPRINTF", TOK_SPRINTF }, - { ".STRAT", TOK_STRAT }, - { ".STRING", TOK_STRING }, - { ".STRLEN", TOK_STRLEN }, + { ".STRAT", TOK_STRAT }, + { ".STRING", TOK_STRING }, + { ".STRLEN", TOK_STRLEN }, { ".STRUCT", TOK_STRUCT }, - { ".SUNPLUS", TOK_SUNPLUS }, + { ".SUNPLUS", TOK_SUNPLUS }, { ".TAG", TOK_TAG }, - { ".TCOUNT", TOK_TCOUNT }, - { ".TIME", TOK_TIME }, + { ".TCOUNT", TOK_TCOUNT }, + { ".TIME", TOK_TIME }, { ".UNDEF", TOK_UNDEF }, { ".UNDEFINE", TOK_UNDEF }, { ".UNION", TOK_UNION }, { ".VERSION", TOK_VERSION }, - { ".WARNING", TOK_WARNING }, - { ".WORD", TOK_WORD }, - { ".XMATCH", TOK_XMATCH }, - { ".XOR", TOK_BOOLXOR }, - { ".ZEROPAGE", TOK_ZEROPAGE }, + { ".WARNING", TOK_WARNING }, + { ".WORD", TOK_WORD }, + { ".XMATCH", TOK_XMATCH }, + { ".XOR", TOK_BOOLXOR }, + { ".ZEROPAGE", TOK_ZEROPAGE }, }; @@ -307,7 +307,7 @@ static void UseCharSource (CharSource* S) S->C = C; /* Use the new input source */ - S->Next = Source; + S->Next = Source; Source = S; /* Read the first character from the new file */ @@ -494,20 +494,20 @@ int NewInputFile (const char* Name) /* Main file */ F = fopen (Name, "r"); if (F == 0) { - Fatal ("Cannot open input file `%s': %s", Name, strerror (errno)); + Fatal ("Cannot open input file `%s': %s", Name, strerror (errno)); } } else { - /* We are on include level. Search for the file in the include - * directories. - */ - PathName = SearchFile (IncSearchPath, Name); - if (PathName == 0 || (F = fopen (PathName, "r")) == 0) { - /* Not found or cannot open, print an error and bail out */ - Error ("Cannot open include file `%s': %s", Name, strerror (errno)); + /* We are on include level. Search for the file in the include + * directories. + */ + PathName = SearchFile (IncSearchPath, Name); + if (PathName == 0 || (F = fopen (PathName, "r")) == 0) { + /* Not found or cannot open, print an error and bail out */ + Error ("Cannot open include file `%s': %s", Name, strerror (errno)); goto ExitPoint; - } + } - /* Use the path name from now on */ + /* Use the path name from now on */ Name = PathName; } @@ -595,7 +595,7 @@ void IDDone (CharSource* S) { /* Cleanup the current stuff */ if (S->V.Data.Malloced) { - xfree (S->V.Data.Text); + xfree (S->V.Data.Text); } } @@ -629,7 +629,7 @@ void NewInputData (char* Text, int Malloced) /*****************************************************************************/ -/* Character classification functions */ +/* Character classification functions */ /*****************************************************************************/ @@ -637,10 +637,10 @@ void NewInputData (char* Text, int Malloced) int IsIdChar (int C) /* Return true if the character is a valid character for an identifier */ { - return IsAlNum (C) || - (C == '_') || - (C == '@' && AtInIdents) || - (C == '$' && DollarInIdents); + return IsAlNum (C) || + (C == '_') || + (C == '@' && AtInIdents) || + (C == '$' && DollarInIdents); } @@ -654,7 +654,7 @@ int IsIdStart (int C) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -663,9 +663,9 @@ static unsigned DigitVal (unsigned char C) /* Convert a digit into it's numerical representation */ { if (IsDigit (C)) { - return C - '0'; + return C - '0'; } else { - return toupper (C) - 'A' + 10; + return toupper (C) - 'A' + 10; } } @@ -717,16 +717,16 @@ static token_t FindDotKeyword (void) /* If we aren't in ignore case mode, we have to uppercase the keyword */ if (!IgnoreCase) { - UpcaseSVal (); + UpcaseSVal (); } /* Search for the keyword */ R = bsearch (&K, DotKeywords, sizeof (DotKeywords) / sizeof (DotKeywords [0]), - sizeof (DotKeywords [0]), CmpDotKeyword); + sizeof (DotKeywords [0]), CmpDotKeyword); if (R != 0) { - return R->Tok; + return R->Tok; } else { - return TOK_NONE; + return TOK_NONE; } } @@ -742,13 +742,13 @@ static void ReadIdent (void) /* Read the identifier */ do { SB_AppendChar (&CurTok.SVal, C); - NextChar (); + NextChar (); } while (IsIdChar (C)); SB_Terminate (&CurTok.SVal); /* If we should ignore case, convert the identifier to upper case */ if (IgnoreCase) { - UpcaseSVal (); + UpcaseSVal (); } } @@ -762,19 +762,19 @@ static void ReadStringConst (int StringTerm) /* Read the string */ while (1) { - if (C == StringTerm) { - break; - } - if (C == '\n' || C == EOF) { - Error ("Newline in string constant"); - break; - } + if (C == StringTerm) { + break; + } + if (C == '\n' || C == EOF) { + Error ("Newline in string constant"); + break; + } - /* Append the char to the string */ + /* Append the char to the string */ SB_AppendChar (&CurTok.SVal, C); - /* Skip the character */ - NextChar (); + /* Skip the character */ + NextChar (); } /* Skip the trailing terminator */ @@ -822,8 +822,8 @@ void NextRawTok (void) /* If we've a forced end of assembly, don't read further */ if (ForcedEnd) { - CurTok.Tok = TOK_EOF; - return; + CurTok.Tok = TOK_EOF; + return; } Restart: @@ -840,8 +840,8 @@ Restart: Again: /* Skip whitespace, remember if we had some */ if ((CurTok.WS = IsBlank (C)) != 0) { - do { - NextChar (); + do { + NextChar (); } while (IsBlank (C)); } @@ -856,20 +856,20 @@ Again: /* Hex number or PC symbol? */ if (C == '$') { - NextChar (); + NextChar (); - /* Hex digit must follow or DollarIsPC must be enabled */ - if (!IsXDigit (C)) { - if (DollarIsPC) { - CurTok.Tok = TOK_PC; - return; - } else { - Error ("Hexadecimal digit expected"); - } - } + /* Hex digit must follow or DollarIsPC must be enabled */ + if (!IsXDigit (C)) { + if (DollarIsPC) { + CurTok.Tok = TOK_PC; + return; + } else { + Error ("Hexadecimal digit expected"); + } + } - /* Read the number */ - CurTok.IVal = 0; + /* Read the number */ + CurTok.IVal = 0; while (1) { if (UnderlineInNumbers && C == '_') { while (C == '_') { @@ -891,21 +891,21 @@ Again: } } - /* This is an integer constant */ - CurTok.Tok = TOK_INTCON; - return; + /* This is an integer constant */ + CurTok.Tok = TOK_INTCON; + return; } /* Binary number? */ if (C == '%') { - NextChar (); + NextChar (); - /* 0 or 1 must follow */ - if (!IsBDigit (C)) { - Error ("Binary digit expected"); - } + /* 0 or 1 must follow */ + if (!IsBDigit (C)) { + Error ("Binary digit expected"); + } - /* Read the number */ + /* Read the number */ CurTok.IVal = 0; while (1) { if (UnderlineInNumbers && C == '_') { @@ -928,9 +928,9 @@ Again: } } - /* This is an integer constant */ + /* This is an integer constant */ CurTok.Tok = TOK_INTCON; - return; + return; } /* Number? */ @@ -986,69 +986,69 @@ Again: /* Convert the number using the given base */ CurTok.IVal = 0; for (I = 0; I < Digits; ++I) { - if (CurTok.IVal > Max) { - Error ("Number out of range"); + if (CurTok.IVal > Max) { + Error ("Number out of range"); CurTok.IVal = 0; break; - } + } DVal = DigitVal (Buf[I]); if (DVal > Base) { Error ("Invalid digits in number"); CurTok.IVal = 0; break; } - CurTok.IVal = (CurTok.IVal * Base) + DVal; + CurTok.IVal = (CurTok.IVal * Base) + DVal; } - /* This is an integer constant */ - CurTok.Tok = TOK_INTCON; - return; + /* This is an integer constant */ + CurTok.Tok = TOK_INTCON; + return; } /* Control command? */ if (C == '.') { - /* Remember and skip the dot */ - NextChar (); + /* Remember and skip the dot */ + NextChar (); - /* Check if it's just a dot */ - if (!IsIdStart (C)) { + /* Check if it's just a dot */ + if (!IsIdStart (C)) { - /* Just a dot */ - CurTok.Tok = TOK_DOT; + /* Just a dot */ + CurTok.Tok = TOK_DOT; - } else { + } else { - /* Read the remainder of the identifier */ + /* Read the remainder of the identifier */ SB_AppendChar (&CurTok.SVal, '.'); - ReadIdent (); + ReadIdent (); - /* Dot keyword, search for it */ - CurTok.Tok = FindDotKeyword (); - if (CurTok.Tok == TOK_NONE) { + /* Dot keyword, search for it */ + CurTok.Tok = FindDotKeyword (); + if (CurTok.Tok == TOK_NONE) { - /* Not found */ - if (!LeadingDotInIdents) { - /* Invalid pseudo instruction */ - Error ("`%m%p' is not a recognized control command", &CurTok.SVal); - goto Again; - } + /* Not found */ + if (!LeadingDotInIdents) { + /* Invalid pseudo instruction */ + Error ("`%m%p' is not a recognized control command", &CurTok.SVal); + goto Again; + } - /* An identifier with a dot. Check if it's a define style - * macro. - */ - if ((M = FindDefine (&CurTok.SVal)) != 0) { - /* This is a define style macro - expand it */ - MacExpandStart (M); - goto Restart; - } + /* An identifier with a dot. Check if it's a define style + * macro. + */ + if ((M = FindDefine (&CurTok.SVal)) != 0) { + /* This is a define style macro - expand it */ + MacExpandStart (M); + goto Restart; + } - /* Just an identifier with a dot */ - CurTok.Tok = TOK_IDENT; - } + /* Just an identifier with a dot */ + CurTok.Tok = TOK_IDENT; + } - } - return; + } + return; } /* Indirect op for sweet16 cpu. Must check this before checking for local @@ -1063,78 +1063,78 @@ Again: /* Local symbol? */ if (C == LocalStart) { - /* Read the identifier. */ - ReadIdent (); + /* Read the identifier. */ + ReadIdent (); - /* Start character alone is not enough */ + /* Start character alone is not enough */ if (SB_GetLen (&CurTok.SVal) == 1) { - Error ("Invalid cheap local symbol"); - goto Again; - } + Error ("Invalid cheap local symbol"); + goto Again; + } - /* A local identifier */ + /* A local identifier */ CurTok.Tok = TOK_LOCAL_IDENT; - return; + return; } /* Identifier or keyword? */ if (IsIdStart (C)) { - /* Read the identifier */ - ReadIdent (); + /* Read the identifier */ + ReadIdent (); - /* Check for special names. Bail out if we have identified the type of - * the token. Go on if the token is an identifier. - */ + /* Check for special names. Bail out if we have identified the type of + * the token. Go on if the token is an identifier. + */ if (SB_GetLen (&CurTok.SVal) == 1) { - switch (toupper (SB_AtUnchecked (&CurTok.SVal, 0))) { + switch (toupper (SB_AtUnchecked (&CurTok.SVal, 0))) { - case 'A': + case 'A': if (C == ':') { NextChar (); CurTok.Tok = TOK_OVERRIDE_ABS; } else { - CurTok.Tok = TOK_A; + CurTok.Tok = TOK_A; } - return; + return; case 'F': if (C == ':') { NextChar (); CurTok.Tok = TOK_OVERRIDE_FAR; - return; + return; } - break; + break; - case 'S': + case 'S': if (CPU == CPU_65816) { CurTok.Tok = TOK_S; return; } break; - case 'X': - CurTok.Tok = TOK_X; - return; + case 'X': + CurTok.Tok = TOK_X; + return; - case 'Y': - CurTok.Tok = TOK_Y; - return; + case 'Y': + CurTok.Tok = TOK_Y; + return; case 'Z': if (C == ':') { NextChar (); CurTok.Tok = TOK_OVERRIDE_ZP; - return; + return; } break; - default: - break; - } + default: + break; + } - } else if (CPU == CPU_SWEET16 && + } else if (CPU == CPU_SWEET16 && (CurTok.IVal = Sweet16Reg (&CurTok.SVal)) >= 0) { /* A sweet16 register number in sweet16 mode */ @@ -1143,34 +1143,34 @@ Again: } - /* Check for define style macro */ - if ((M = FindDefine (&CurTok.SVal)) != 0) { - /* Macro - expand it */ - MacExpandStart (M); - goto Restart; - } else { - /* An identifier */ - CurTok.Tok = TOK_IDENT; - } - return; + /* Check for define style macro */ + if ((M = FindDefine (&CurTok.SVal)) != 0) { + /* Macro - expand it */ + MacExpandStart (M); + goto Restart; + } else { + /* An identifier */ + CurTok.Tok = TOK_IDENT; + } + return; } /* Ok, let's do the switch */ CharAgain: switch (C) { - case '+': - NextChar (); - CurTok.Tok = TOK_PLUS; - return; + case '+': + NextChar (); + CurTok.Tok = TOK_PLUS; + return; - case '-': - NextChar (); - CurTok.Tok = TOK_MINUS; - return; + case '-': + NextChar (); + CurTok.Tok = TOK_MINUS; + return; - case '/': - NextChar (); + case '/': + NextChar (); if (C != '*') { CurTok.Tok = TOK_DIV; } else if (CComments) { @@ -1195,222 +1195,222 @@ CharAgain: DoneCollection (&LineInfos); goto Again; } - return; + return; - case '*': - NextChar (); - CurTok.Tok = TOK_MUL; - return; + case '*': + NextChar (); + CurTok.Tok = TOK_MUL; + return; - case '^': - NextChar (); - CurTok.Tok = TOK_XOR; - return; + case '^': + NextChar (); + CurTok.Tok = TOK_XOR; + return; - case '&': - NextChar (); - if (C == '&') { - NextChar (); - CurTok.Tok = TOK_BOOLAND; - } else { - CurTok.Tok = TOK_AND; - } - return; + case '&': + NextChar (); + if (C == '&') { + NextChar (); + CurTok.Tok = TOK_BOOLAND; + } else { + CurTok.Tok = TOK_AND; + } + return; - case '|': - NextChar (); - if (C == '|') { - NextChar (); - CurTok.Tok = TOK_BOOLOR; - } else { - CurTok.Tok = TOK_OR; - } - return; + case '|': + NextChar (); + if (C == '|') { + NextChar (); + CurTok.Tok = TOK_BOOLOR; + } else { + CurTok.Tok = TOK_OR; + } + return; - case ':': - NextChar (); - switch (C) { + case ':': + NextChar (); + switch (C) { - case ':': - NextChar (); - CurTok.Tok = TOK_NAMESPACE; - break; + case ':': + NextChar (); + CurTok.Tok = TOK_NAMESPACE; + break; - case '-': - CurTok.IVal = 0; - do { - --CurTok.IVal; - NextChar (); - } while (C == '-'); - CurTok.Tok = TOK_ULABEL; - break; + case '-': + CurTok.IVal = 0; + do { + --CurTok.IVal; + NextChar (); + } while (C == '-'); + CurTok.Tok = TOK_ULABEL; + break; - case '+': - CurTok.IVal = 0; - do { - ++CurTok.IVal; - NextChar (); - } while (C == '+'); - CurTok.Tok = TOK_ULABEL; - break; + case '+': + CurTok.IVal = 0; + do { + ++CurTok.IVal; + NextChar (); + } while (C == '+'); + CurTok.Tok = TOK_ULABEL; + break; case '=': NextChar (); CurTok.Tok = TOK_ASSIGN; break; - default: - CurTok.Tok = TOK_COLON; - break; - } - return; + default: + CurTok.Tok = TOK_COLON; + break; + } + return; - case ',': - NextChar (); - CurTok.Tok = TOK_COMMA; - return; + case ',': + NextChar (); + CurTok.Tok = TOK_COMMA; + return; - case ';': - NextChar (); - while (C != '\n' && C != EOF) { - NextChar (); - } - goto CharAgain; + case ';': + NextChar (); + while (C != '\n' && C != EOF) { + NextChar (); + } + goto CharAgain; - case '#': - NextChar (); - CurTok.Tok = TOK_HASH; - return; + case '#': + NextChar (); + CurTok.Tok = TOK_HASH; + return; - case '(': - NextChar (); - CurTok.Tok = TOK_LPAREN; - return; + case '(': + NextChar (); + CurTok.Tok = TOK_LPAREN; + return; - case ')': - NextChar (); + case ')': + NextChar (); CurTok.Tok = TOK_RPAREN; - return; + return; - case '[': - NextChar (); - CurTok.Tok = TOK_LBRACK; - return; + case '[': + NextChar (); + CurTok.Tok = TOK_LBRACK; + return; - case ']': - NextChar (); - CurTok.Tok = TOK_RBRACK; - return; + case ']': + NextChar (); + CurTok.Tok = TOK_RBRACK; + return; - case '{': - NextChar (); - CurTok.Tok = TOK_LCURLY; - return; + case '{': + NextChar (); + CurTok.Tok = TOK_LCURLY; + return; - case '}': - NextChar (); - CurTok.Tok = TOK_RCURLY; - return; + case '}': + NextChar (); + CurTok.Tok = TOK_RCURLY; + return; - case '<': - NextChar (); - if (C == '=') { - NextChar (); - CurTok.Tok = TOK_LE; - } else if (C == '<') { - NextChar (); - CurTok.Tok = TOK_SHL; - } else if (C == '>') { - NextChar (); - CurTok.Tok = TOK_NE; - } else { - CurTok.Tok = TOK_LT; - } - return; + case '<': + NextChar (); + if (C == '=') { + NextChar (); + CurTok.Tok = TOK_LE; + } else if (C == '<') { + NextChar (); + CurTok.Tok = TOK_SHL; + } else if (C == '>') { + NextChar (); + CurTok.Tok = TOK_NE; + } else { + CurTok.Tok = TOK_LT; + } + return; - case '=': - NextChar (); - CurTok.Tok = TOK_EQ; - return; + case '=': + NextChar (); + CurTok.Tok = TOK_EQ; + return; - case '!': - NextChar (); - CurTok.Tok = TOK_BOOLNOT; - return; + case '!': + NextChar (); + CurTok.Tok = TOK_BOOLNOT; + return; - case '>': - NextChar (); - if (C == '=') { - NextChar (); - CurTok.Tok = TOK_GE; - } else if (C == '>') { - NextChar (); - CurTok.Tok = TOK_SHR; - } else { - CurTok.Tok = TOK_GT; - } - return; + case '>': + NextChar (); + if (C == '=') { + NextChar (); + CurTok.Tok = TOK_GE; + } else if (C == '>') { + NextChar (); + CurTok.Tok = TOK_SHR; + } else { + CurTok.Tok = TOK_GT; + } + return; case '~': - NextChar (); - CurTok.Tok = TOK_NOT; - return; + NextChar (); + CurTok.Tok = TOK_NOT; + return; - case '\'': - /* Hack: If we allow ' as terminating character for strings, read - * the following stuff as a string, and check for a one character - * string later. - */ - if (LooseStringTerm) { - ReadStringConst ('\''); + case '\'': + /* Hack: If we allow ' as terminating character for strings, read + * the following stuff as a string, and check for a one character + * string later. + */ + if (LooseStringTerm) { + ReadStringConst ('\''); if (SB_GetLen (&CurTok.SVal) == 1) { - CurTok.IVal = SB_AtUnchecked (&CurTok.SVal, 0); - CurTok.Tok = TOK_CHARCON; - } else { - CurTok.Tok = TOK_STRCON; - } - } else { - /* Always a character constant */ - NextChar (); - if (C == EOF || IsControl (C)) { - Error ("Illegal character constant"); - goto CharAgain; - } - CurTok.IVal = C; - CurTok.Tok = TOK_CHARCON; - NextChar (); - if (C != '\'') { + CurTok.IVal = SB_AtUnchecked (&CurTok.SVal, 0); + CurTok.Tok = TOK_CHARCON; + } else { + CurTok.Tok = TOK_STRCON; + } + } else { + /* Always a character constant */ + NextChar (); + if (C == EOF || IsControl (C)) { + Error ("Illegal character constant"); + goto CharAgain; + } + CurTok.IVal = C; + CurTok.Tok = TOK_CHARCON; + NextChar (); + if (C != '\'') { if (!MissingCharTerm) { Error ("Illegal character constant"); } - } else { - NextChar (); - } - } - return; + } else { + NextChar (); + } + } + return; - case '\"': - ReadStringConst ('\"'); - CurTok.Tok = TOK_STRCON; - return; + case '\"': + ReadStringConst ('\"'); + CurTok.Tok = TOK_STRCON; + return; - case '\\': - /* Line continuation? */ - if (LineCont) { - NextChar (); - if (C == '\n') { - /* Handle as white space */ - NextChar (); - C = ' '; - goto Again; - } - } - break; + case '\\': + /* Line continuation? */ + if (LineCont) { + NextChar (); + if (C == '\n') { + /* Handle as white space */ + NextChar (); + C = ' '; + goto Again; + } + } + break; case '\n': - NextChar (); - CurTok.Tok = TOK_SEP; - return; + NextChar (); + CurTok.Tok = TOK_SEP; + return; case EOF: CheckInputStack (); @@ -1419,7 +1419,7 @@ CharAgain: DoneCharSource (); goto Again; } else { - CurTok.Tok = TOK_EOF; + CurTok.Tok = TOK_EOF; } return; } @@ -1448,15 +1448,15 @@ int GetSubKey (const char** Keys, unsigned Count) /* If we aren't in ignore case mode, we have to uppercase the identifier */ if (!IgnoreCase) { - UpcaseSVal (); + UpcaseSVal (); } /* Do a linear search (a binary search is not worth the effort) */ for (I = 0; I < Count; ++I) { - if (SB_CompareStr (&CurTok.SVal, Keys [I]) == 0) { - /* Found it */ - return I; - } + if (SB_CompareStr (&CurTok.SVal, Keys [I]) == 0) { + /* Found it */ + return I; + } } /* Not found */ diff --git a/src/ca65/scanner.h b/src/ca65/scanner.h index 0fad248d1..b0fc3411f 100644 --- a/src/ca65/scanner.h +++ b/src/ca65/scanner.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* scanner.h */ +/* scanner.h */ /* */ -/* The scanner for the ca65 macroassembler */ +/* The scanner for the ca65 macroassembler */ /* */ /* */ /* */ @@ -44,19 +44,19 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Scanner variables */ extern Token CurTok; /* Current input token incl. attributes */ -extern int ForcedEnd; /* Force end of assembly */ +extern int ForcedEnd; /* Force end of assembly */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/segdef.c b/src/ca65/segdef.c index a08a18dc1..3c1a59992 100644 --- a/src/ca65/segdef.c +++ b/src/ca65/segdef.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* segdef.c */ +/* segdef.c */ /* */ -/* Segment definitions for the ca65 assembler */ +/* Segment definitions for the ca65 assembler */ /* */ /* */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/segdef.h b/src/ca65/segdef.h index 9fdbe1698..c7431b9a2 100644 --- a/src/ca65/segdef.h +++ b/src/ca65/segdef.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* segdef.h */ +/* segdef.h */ /* */ -/* Segment definitions for the ca65 assembler */ +/* Segment definitions for the ca65 assembler */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -62,7 +62,7 @@ struct SegDef { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/segment.c b/src/ca65/segment.c index 5482681c6..60a897324 100644 --- a/src/ca65/segment.c +++ b/src/ca65/segment.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* segment.c */ +/* segment.c */ /* */ /* Segments for the ca65 macroassembler */ /* */ @@ -62,7 +62,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -71,7 +71,7 @@ * used when in absolute mode. OrgPerSeg may be set by .feature org_per_seg */ static int RelocMode = 1; -static unsigned long AbsPC = 0; /* PC if in absolute mode */ +static unsigned long AbsPC = 0; /* PC if in absolute mode */ /* Definitions for predefined segments */ SegDef NullSegDef = STATIC_SEGDEF_INITIALIZER (SEGNAME_NULL, ADDR_SIZE_ABS); @@ -90,7 +90,7 @@ Segment* ActiveSeg; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -129,12 +129,12 @@ static Segment* NewSegment (const char* Name, unsigned char AddrSize) { /* Check for too many segments */ if (CollCount (&SegmentList) >= 256) { - Fatal ("Too many segments"); + Fatal ("Too many segments"); } /* Check the segment name for invalid names */ if (!ValidSegName (Name)) { - Error ("Illegal segment name: `%s'", Name); + Error ("Illegal segment name: `%s'", Name); } /* Create a new segment and return it */ @@ -151,21 +151,21 @@ Fragment* GenFragment (unsigned char Type, unsigned short Len) /* Insert the fragment into the current segment */ if (ActiveSeg->Root) { - ActiveSeg->Last->Next = F; - ActiveSeg->Last = F; + ActiveSeg->Last->Next = F; + ActiveSeg->Last = F; } else { - ActiveSeg->Root = ActiveSeg->Last = F; + ActiveSeg->Root = ActiveSeg->Last = F; } ++ActiveSeg->FragCount; /* Add this fragment to the current listing line */ if (LineCur) { - if (LineCur->FragList == 0) { - LineCur->FragList = F; - } else { - LineCur->FragLast->LineList = F; - } - LineCur->FragLast = F; + if (LineCur->FragList == 0) { + LineCur->FragList = F; + } else { + LineCur->FragLast->LineList = F; + } + LineCur->FragLast = F; } /* Increment the program counter */ @@ -194,17 +194,17 @@ void UseSeg (const SegDef* D) unsigned I; for (I = 0; I < CollCount (&SegmentList); ++I) { Segment* Seg = CollAtUnchecked (&SegmentList, I); - if (strcmp (Seg->Def->Name, D->Name) == 0) { - /* We found this segment. Check if the type is identical */ - if (D->AddrSize != ADDR_SIZE_DEFAULT && + if (strcmp (Seg->Def->Name, D->Name) == 0) { + /* We found this segment. Check if the type is identical */ + if (D->AddrSize != ADDR_SIZE_DEFAULT && Seg->Def->AddrSize != D->AddrSize) { - Error ("Segment attribute mismatch"); - /* Use the new attribute to avoid errors */ - Seg->Def->AddrSize = D->AddrSize; - } - ActiveSeg = Seg; - return; - } + Error ("Segment attribute mismatch"); + /* Use the new attribute to avoid errors */ + Seg->Def->AddrSize = D->AddrSize; + } + ActiveSeg = Seg; + return; + } } /* Segment is not in list, create a new one */ @@ -319,20 +319,20 @@ void SegAlign (unsigned long Alignment, int FillVal) /* Emit the data or a fill fragment */ if (FillVal != -1) { - /* User defined fill value */ - memset (Data, FillVal, sizeof (Data)); - while (Count) { - if (Count > sizeof (Data)) { - EmitData (Data, sizeof (Data)); - Count -= sizeof (Data); - } else { - EmitData (Data, Count); - Count = 0; - } - } + /* User defined fill value */ + memset (Data, FillVal, sizeof (Data)); + while (Count) { + if (Count > sizeof (Data)) { + EmitData (Data, sizeof (Data)); + Count -= sizeof (Data); + } else { + EmitData (Data, Count); + Count = 0; + } + } } else { - /* Linker defined fill value */ - EmitFill (Count); + /* Linker defined fill value */ + EmitFill (Count); } } @@ -343,7 +343,7 @@ unsigned char GetSegAddrSize (unsigned SegNum) { /* Is there such a segment? */ if (SegNum >= CollCount (&SegmentList)) { - FAIL ("Invalid segment number"); + FAIL ("Invalid segment number"); } /* Return the address size */ @@ -356,18 +356,18 @@ void SegDone (void) /* Check the segments for range and other errors. Do cleanup. */ { static const unsigned long U_Hi[4] = { - 0x000000FFUL, 0x0000FFFFUL, 0x00FFFFFFUL, 0xFFFFFFFFUL + 0x000000FFUL, 0x0000FFFFUL, 0x00FFFFFFUL, 0xFFFFFFFFUL }; static const long S_Hi[4] = { - 0x0000007FL, 0x00007FFFL, 0x007FFFFFL, 0x7FFFFFFFL + 0x0000007FL, 0x00007FFFL, 0x007FFFFFL, 0x7FFFFFFFL }; unsigned I; for (I = 0; I < CollCount (&SegmentList); ++I) { Segment* S = CollAtUnchecked (&SegmentList, I); - Fragment* F = S->Root; - while (F) { - if (F->Type == FRAG_EXPR || F->Type == FRAG_SEXPR) { + Fragment* F = S->Root; + while (F) { + if (F->Type == FRAG_EXPR || F->Type == FRAG_SEXPR) { /* We have an expression, study it */ ExprDesc ED; @@ -377,9 +377,9 @@ void SegDone (void) /* Check if the expression is constant */ if (ED_IsConst (&ED)) { - unsigned J; + unsigned J; - /* The expression is constant. Check for range errors. */ + /* The expression is constant. Check for range errors. */ CHECK (F->Len <= 4); if (F->Type == FRAG_SEXPR) { long Hi = S_Hi[F->Len-1]; @@ -400,32 +400,32 @@ void SegDone (void) /* We don't need the expression tree any longer */ FreeExpr (F->V.Expr); - /* Convert the fragment into a literal fragment */ - for (J = 0; J < F->Len; ++J) { - F->V.Data[J] = ED.Val & 0xFF; - ED.Val >>= 8; - } - F->Type = FRAG_LITERAL; + /* Convert the fragment into a literal fragment */ + for (J = 0; J < F->Len; ++J) { + F->V.Data[J] = ED.Val & 0xFF; + ED.Val >>= 8; + } + F->Type = FRAG_LITERAL; - } else if (RelaxChecks == 0) { + } else if (RelaxChecks == 0) { - /* We cannot evaluate the expression now, leave the job for - * the linker. However, we can check if the address size + /* We cannot evaluate the expression now, leave the job for + * the linker. However, we can check if the address size * matches the fragment size. Mismatches are errors in * most situations. - */ + */ if ((F->Len == 1 && ED.AddrSize > ADDR_SIZE_ZP) || (F->Len == 2 && ED.AddrSize > ADDR_SIZE_ABS) || (F->Len == 3 && ED.AddrSize > ADDR_SIZE_FAR)) { - LIError (&F->LI, "Range error"); - } - } + LIError (&F->LI, "Range error"); + } + } /* Release memory allocated for the expression decriptor */ ED_Done (&ED); - } - F = F->Next; - } + } + F = F->Next; + } } } @@ -440,38 +440,38 @@ void SegDump (void) printf ("\n"); for (I = 0; I < CollCount (&SegmentList); ++I) { Segment* S = CollAtUnchecked (&SegmentList, I); - unsigned I; - Fragment* F; - int State = -1; - printf ("New segment: %s", S->Def->Name); - F = S->Root; - while (F) { - if (F->Type == FRAG_LITERAL) { - if (State != 0) { - printf ("\n Literal:"); - X = 15; - State = 0; - } - for (I = 0; I < F->Len; ++I) { - printf (" %02X", F->V.Data [I]); - X += 3; - } - } else if (F->Type == FRAG_EXPR || F->Type == FRAG_SEXPR) { - State = 1; - printf ("\n Expression (%u): ", F->Len); - DumpExpr (F->V.Expr, SymResolve); - } else if (F->Type == FRAG_FILL) { - State = 1; - printf ("\n Fill bytes (%u)", F->Len); - } else { - Internal ("Unknown fragment type: %u", F->Type); - } - if (X > 65) { - State = -1; - } - F = F->Next; - } - printf ("\n End PC = $%04X\n", (unsigned)(S->PC & 0xFFFF)); + unsigned I; + Fragment* F; + int State = -1; + printf ("New segment: %s", S->Def->Name); + F = S->Root; + while (F) { + if (F->Type == FRAG_LITERAL) { + if (State != 0) { + printf ("\n Literal:"); + X = 15; + State = 0; + } + for (I = 0; I < F->Len; ++I) { + printf (" %02X", F->V.Data [I]); + X += 3; + } + } else if (F->Type == FRAG_EXPR || F->Type == FRAG_SEXPR) { + State = 1; + printf ("\n Expression (%u): ", F->Len); + DumpExpr (F->V.Expr, SymResolve); + } else if (F->Type == FRAG_FILL) { + State = 1; + printf ("\n Fill bytes (%u)", F->Len); + } else { + Internal ("Unknown fragment type: %u", F->Type); + } + if (X > 65) { + State = -1; + } + F = F->Next; + } + printf ("\n End PC = $%04X\n", (unsigned)(S->PC & 0xFFFF)); } printf ("\n"); } @@ -549,52 +549,52 @@ static void WriteOneSeg (Segment* Seg) Frag = Seg->Root; while (Frag) { - /* Write data depending on the type */ - switch (Frag->Type) { + /* Write data depending on the type */ + switch (Frag->Type) { - case FRAG_LITERAL: - ObjWrite8 (FRAG_LITERAL); - ObjWriteVar (Frag->Len); - ObjWriteData (Frag->V.Data, Frag->Len); - break; + case FRAG_LITERAL: + ObjWrite8 (FRAG_LITERAL); + ObjWriteVar (Frag->Len); + ObjWriteData (Frag->V.Data, Frag->Len); + break; - case FRAG_EXPR: - switch (Frag->Len) { - case 1: ObjWrite8 (FRAG_EXPR8); break; - case 2: ObjWrite8 (FRAG_EXPR16); break; - case 3: ObjWrite8 (FRAG_EXPR24); break; - case 4: ObjWrite8 (FRAG_EXPR32); break; - default: Internal ("Invalid fragment size: %u", Frag->Len); - } - WriteExpr (Frag->V.Expr); - break; + case FRAG_EXPR: + switch (Frag->Len) { + case 1: ObjWrite8 (FRAG_EXPR8); break; + case 2: ObjWrite8 (FRAG_EXPR16); break; + case 3: ObjWrite8 (FRAG_EXPR24); break; + case 4: ObjWrite8 (FRAG_EXPR32); break; + default: Internal ("Invalid fragment size: %u", Frag->Len); + } + WriteExpr (Frag->V.Expr); + break; - case FRAG_SEXPR: - switch (Frag->Len) { - case 1: ObjWrite8 (FRAG_SEXPR8); break; - case 2: ObjWrite8 (FRAG_SEXPR16); break; - case 3: ObjWrite8 (FRAG_SEXPR24); break; - case 4: ObjWrite8 (FRAG_SEXPR32); break; - default: Internal ("Invalid fragment size: %u", Frag->Len); - } - WriteExpr (Frag->V.Expr); - break; + case FRAG_SEXPR: + switch (Frag->Len) { + case 1: ObjWrite8 (FRAG_SEXPR8); break; + case 2: ObjWrite8 (FRAG_SEXPR16); break; + case 3: ObjWrite8 (FRAG_SEXPR24); break; + case 4: ObjWrite8 (FRAG_SEXPR32); break; + default: Internal ("Invalid fragment size: %u", Frag->Len); + } + WriteExpr (Frag->V.Expr); + break; - case FRAG_FILL: - ObjWrite8 (FRAG_FILL); - ObjWriteVar (Frag->Len); - break; + case FRAG_FILL: + ObjWrite8 (FRAG_FILL); + ObjWriteVar (Frag->Len); + break; - default: - Internal ("Invalid fragment type: %u", Frag->Type); + default: + Internal ("Invalid fragment type: %u", Frag->Type); - } + } - /* Write the line infos for this fragment */ - WriteLineInfo (&Frag->LI); + /* Write the line infos for this fragment */ + WriteLineInfo (&Frag->LI); - /* Next fragment */ - Frag = Frag->Next; + /* Next fragment */ + Frag = Frag->Next; } /* Calculate the size of the data, seek back and write it */ @@ -620,8 +620,8 @@ void WriteSegments (void) /* Now walk through all segments and write them to the object file */ for (I = 0; I < CollCount (&SegmentList); ++I) { - /* Write one segment */ - WriteOneSeg (CollAtUnchecked (&SegmentList, I)); + /* Write one segment */ + WriteOneSeg (CollAtUnchecked (&SegmentList, I)); } /* Done writing segments */ diff --git a/src/ca65/segment.h b/src/ca65/segment.h index 77b269d62..69a3eb833 100644 --- a/src/ca65/segment.h +++ b/src/ca65/segment.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* segment.h */ +/* segment.h */ /* */ /* Segments for the ca65 macroassembler */ /* */ @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,12 +58,12 @@ /* Segment definition */ typedef struct Segment Segment; struct Segment { - Fragment* Root; /* Root of fragment list */ - Fragment* Last; /* Pointer to last fragment */ + Fragment* Root; /* Root of fragment list */ + Fragment* Last; /* Pointer to last fragment */ unsigned long FragCount; /* Number of fragments */ - unsigned Num; /* Segment number */ + unsigned Num; /* Segment number */ unsigned Flags; /* Segment flags */ - unsigned long Align; /* Segment alignment */ + unsigned long Align; /* Segment alignment */ int RelocMode; /* Relocatable mode if OrgPerSeg */ unsigned long PC; /* PC if in relocatable mode */ unsigned long AbsPC; /* PC if in local absolute mode */ @@ -88,7 +88,7 @@ extern Segment* ActiveSeg; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/sizeof.c b/src/ca65/sizeof.c index 8d16b72bf..a29c83e9d 100644 --- a/src/ca65/sizeof.c +++ b/src/ca65/sizeof.c @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -57,7 +57,7 @@ static const StrBuf SizeEntryName = LIT_STRBUF_INITIALIZER (".size"); /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/sizeof.h b/src/ca65/sizeof.h index 7dcca1421..2bb400d83 100644 --- a/src/ca65/sizeof.h +++ b/src/ca65/sizeof.h @@ -55,7 +55,7 @@ struct SymTable; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/span.h b/src/ca65/span.h index 621267ad3..3ca99ee8f 100644 --- a/src/ca65/span.h +++ b/src/ca65/span.h @@ -48,7 +48,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -61,7 +61,7 @@ typedef struct Span Span; struct Span{ HashNode Node; /* Node for hash table */ unsigned Id; /* Id of span */ - struct Segment* Seg; /* Pointer to segment */ + struct Segment* Seg; /* Pointer to segment */ unsigned Start; /* Start of range */ unsigned End; /* End of range */ unsigned Type; /* Type of data in span */ @@ -70,7 +70,7 @@ struct Span{ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/spool.c b/src/ca65/spool.c index 0cf829c06..d30045195 100644 --- a/src/ca65/spool.c +++ b/src/ca65/spool.c @@ -40,7 +40,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -50,7 +50,7 @@ StringPool* StrPool = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/spool.h b/src/ca65/spool.h index d20b3014b..744e8e5bb 100644 --- a/src/ca65/spool.h +++ b/src/ca65/spool.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,7 +58,7 @@ extern StringPool* StrPool; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/struct.c b/src/ca65/struct.c index 07068ef94..1ad5832c0 100644 --- a/src/ca65/struct.c +++ b/src/ca65/struct.c @@ -52,7 +52,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -65,7 +65,7 @@ enum { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -182,7 +182,7 @@ static long DoStructInternal (long Offs, unsigned Type) break; case TOK_RES: - NextTok (); + NextTok (); if (CurTok.Tok == TOK_SEP) { ErrorSkip ("Size is missing"); } else { diff --git a/src/ca65/struct.h b/src/ca65/struct.h index 871fa6a42..9175a498c 100644 --- a/src/ca65/struct.h +++ b/src/ca65/struct.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -49,7 +49,7 @@ struct SymTable; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/studyexpr.c b/src/ca65/studyexpr.c index cef121223..5ff1cc369 100644 --- a/src/ca65/studyexpr.c +++ b/src/ca65/studyexpr.c @@ -61,7 +61,7 @@ ExprDesc* ED_Init (ExprDesc* ED) { ED->Flags = ED_OK; ED->AddrSize = ADDR_SIZE_DEFAULT; - ED->Val = 0; + ED->Val = 0; ED->SymCount = 0; ED->SymLimit = 0; ED->SymRef = 0; @@ -432,7 +432,7 @@ static void ED_Move (ExprDesc* From, ExprDesc* To) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -1283,29 +1283,29 @@ static void StudyExprInternal (ExprNode* Expr, ExprDesc* D) /* Study this expression node */ switch (Expr->Op) { - case EXPR_LITERAL: + case EXPR_LITERAL: StudyLiteral (Expr, D); - break; + break; - case EXPR_SYMBOL: + case EXPR_SYMBOL: StudySymbol (Expr, D); break; - case EXPR_SECTION: + case EXPR_SECTION: StudySection (Expr, D); - break; + break; - case EXPR_ULABEL: + case EXPR_ULABEL: StudyULabel (Expr, D); break; - case EXPR_PLUS: + case EXPR_PLUS: StudyPlus (Expr, D); - break; + break; - case EXPR_MINUS: - StudyMinus (Expr, D); - break; + case EXPR_MINUS: + StudyMinus (Expr, D); + break; case EXPR_MUL: StudyMul (Expr, D); @@ -1436,8 +1436,8 @@ static void StudyExprInternal (ExprNode* Expr, ExprDesc* D) break; default: - Internal ("Unknown Op type: %u", Expr->Op); - break; + Internal ("Unknown Op type: %u", Expr->Op); + break; } } diff --git a/src/ca65/studyexpr.h b/src/ca65/studyexpr.h index 56e1a8f61..504323e13 100644 --- a/src/ca65/studyexpr.h +++ b/src/ca65/studyexpr.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -73,7 +73,7 @@ typedef struct ExprDesc ExprDesc; struct ExprDesc { unsigned short Flags; /* See ED_xxx */ unsigned char AddrSize; /* Address size of the expression */ - long Val; /* The offset value */ + long Val; /* The offset value */ long Right; /* Right value for StudyBinaryExpr */ /* Symbol reference management */ @@ -107,7 +107,7 @@ int ED_IsConst (const ExprDesc* ED); /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/symbol.c b/src/ca65/symbol.c index 581e8e54b..b9e2a6c16 100644 --- a/src/ca65/symbol.c +++ b/src/ca65/symbol.c @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/symbol.h b/src/ca65/symbol.h index fc1a84aa4..30964f0c0 100644 --- a/src/ca65/symbol.h +++ b/src/ca65/symbol.h @@ -54,7 +54,7 @@ struct StrBuf; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/symentry.c b/src/ca65/symentry.c index 576a24b03..612bc09f2 100644 --- a/src/ca65/symentry.c +++ b/src/ca65/symentry.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* symentry.c */ +/* symentry.c */ /* */ /* Symbol table entry for the ca65 macroassembler */ /* */ @@ -54,7 +54,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -68,7 +68,7 @@ SymEntry* SymLast = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -82,9 +82,9 @@ SymEntry* NewSymEntry (const StrBuf* Name, unsigned Flags) SymEntry* S = xmalloc (sizeof (SymEntry)); /* Initialize the entry */ - S->Left = 0; - S->Right = 0; - S->Locals = 0; + S->Left = 0; + S->Right = 0; + S->Locals = 0; S->Sym.Tab = 0; S->DefLines = EmptyCollection; S->RefLines = EmptyCollection; @@ -92,7 +92,7 @@ SymEntry* NewSymEntry (const StrBuf* Name, unsigned Flags) S->GuessedUse[I] = 0; } S->HLLSym = 0; - S->Flags = Flags; + S->Flags = Flags; S->DebugSymId = ~0U; S->ImportId = ~0U; S->ExportId = ~0U; @@ -124,8 +124,8 @@ int SymSearchTree (SymEntry* T, const StrBuf* Name, SymEntry** E) { /* Is there a tree? */ if (T == 0) { - *E = 0; - return 1; + *E = 0; + return 1; } /* We have a table, search it */ @@ -134,17 +134,17 @@ int SymSearchTree (SymEntry* T, const StrBuf* Name, SymEntry** E) /* Get the symbol name */ const StrBuf* SymName = GetStrBuf (T->Name); - /* Choose next entry */ + /* Choose next entry */ int Cmp = SB_Compare (Name, SymName); - if (Cmp < 0 && T->Left) { - T = T->Left; - } else if (Cmp > 0 && T->Right) { - T = T->Right; - } else { - /* Found or end of search, return the result */ + if (Cmp < 0 && T->Left) { + T = T->Left; + } else if (Cmp > 0 && T->Right) { + T = T->Right; + } else { + /* Found or end of search, return the result */ *E = T; return Cmp; - } + } } } @@ -212,9 +212,9 @@ void SymDef (SymEntry* S, ExprNode* Expr, unsigned char AddrSize, unsigned Flags /* Define a new symbol */ { if (S->Flags & SF_IMPORT) { - /* Defined symbol is marked as imported external symbol */ - Error ("Symbol `%m%p' is already an import", GetSymName (S)); - return; + /* Defined symbol is marked as imported external symbol */ + Error ("Symbol `%m%p' is already an import", GetSymName (S)); + return; } if ((Flags & SF_VAR) != 0 && (S->Flags & (SF_EXPORT | SF_GLOBAL))) { /* Variable symbols cannot be exports or globals */ @@ -222,7 +222,7 @@ void SymDef (SymEntry* S, ExprNode* Expr, unsigned char AddrSize, unsigned Flags return; } if (S->Flags & SF_DEFINED) { - /* Multiple definition. In case of a variable, this is legal. */ + /* Multiple definition. In case of a variable, this is legal. */ if ((S->Flags & SF_VAR) == 0) { Error ("Symbol `%m%p' is already defined", GetSymName (S)); S->Flags |= SF_MULTDEF; @@ -293,7 +293,7 @@ void SymDef (SymEntry* S, ExprNode* Expr, unsigned char AddrSize, unsigned Flags /* If this is not a local symbol, remember it as the last global one */ if ((S->Flags & SF_LOCAL) == 0) { - SymLast = S; + SymLast = S; } } @@ -315,14 +315,14 @@ void SymImport (SymEntry* S, unsigned char AddrSize, unsigned Flags) /* Mark the given symbol as an imported symbol */ { if (S->Flags & SF_DEFINED) { - Error ("Symbol `%m%p' is already defined", GetSymName (S)); - S->Flags |= SF_MULTDEF; - return; + Error ("Symbol `%m%p' is already defined", GetSymName (S)); + S->Flags |= SF_MULTDEF; + return; } if (S->Flags & SF_EXPORT) { - /* The symbol is already marked as exported symbol */ - Error ("Cannot import exported symbol `%m%p'", GetSymName (S)); - return; + /* The symbol is already marked as exported symbol */ + Error ("Cannot import exported symbol `%m%p'", GetSymName (S)); + return; } /* If no address size is given, use the address size of the enclosing @@ -336,9 +336,9 @@ void SymImport (SymEntry* S, unsigned char AddrSize, unsigned Flags) * then do silently remove the global flag. */ if (S->Flags & SF_IMPORT) { - if ((Flags & SF_FORCED) != (S->Flags & SF_FORCED)) { - Error ("Redeclaration mismatch for symbol `%m%p'", GetSymName (S)); - } + if ((Flags & SF_FORCED) != (S->Flags & SF_FORCED)) { + Error ("Redeclaration mismatch for symbol `%m%p'", GetSymName (S)); + } if (AddrSize != S->AddrSize) { Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); } @@ -347,7 +347,7 @@ void SymImport (SymEntry* S, unsigned char AddrSize, unsigned Flags) S->Flags &= ~SF_GLOBAL; if (AddrSize != S->AddrSize) { Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); - } + } } /* Set the symbol data */ @@ -368,9 +368,9 @@ void SymExport (SymEntry* S, unsigned char AddrSize, unsigned Flags) { /* Check if it's ok to export the symbol */ if (S->Flags & SF_IMPORT) { - /* The symbol is already marked as imported external symbol */ - Error ("Symbol `%m%p' is already an import", GetSymName (S)); - return; + /* The symbol is already marked as imported external symbol */ + Error ("Symbol `%m%p' is already an import", GetSymName (S)); + return; } if (S->Flags & SF_VAR) { /* Variable symbols cannot be exported */ @@ -536,9 +536,9 @@ void SymConDes (SymEntry* S, unsigned char AddrSize, unsigned Type, unsigned Pri /* Check for errors */ if (S->Flags & SF_IMPORT) { - /* The symbol is already marked as imported external symbol */ - Error ("Symbol `%m%p' is already an import", GetSymName (S)); - return; + /* The symbol is already marked as imported external symbol */ + Error ("Symbol `%m%p' is already an import", GetSymName (S)); + return; } if (S->Flags & SF_VAR) { /* Variable symbols cannot be exported or imported */ @@ -574,9 +574,9 @@ void SymConDes (SymEntry* S, unsigned char AddrSize, unsigned Type, unsigned Pri * priority value is the same as the old one. */ if (S->ConDesPrio[Type] != CD_PRIO_NONE) { - if (S->ConDesPrio[Type] != Prio) { - Error ("Redeclaration mismatch for symbol `%m%p'", GetSymName (S)); - } + if (S->ConDesPrio[Type] != Prio) { + Error ("Redeclaration mismatch for symbol `%m%p'", GetSymName (S)); + } } S->ConDesPrio[Type] = Prio; diff --git a/src/ca65/symentry.h b/src/ca65/symentry.h index b55a20fca..a9b1386e3 100644 --- a/src/ca65/symentry.h +++ b/src/ca65/symentry.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* symentry.h */ +/* symentry.h */ /* */ -/* Symbol table entry forward for the ca65 macroassembler */ +/* Symbol table entry forward for the ca65 macroassembler */ /* */ /* */ /* */ @@ -51,7 +51,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -61,19 +61,19 @@ struct HLLDbgSym; /* Bits for the Flags value in SymEntry */ #define SF_NONE 0x0000 /* Empty flag set */ -#define SF_USER 0x0001 /* User bit */ -#define SF_UNUSED 0x0002 /* Unused entry */ -#define SF_EXPORT 0x0004 /* Export this symbol */ -#define SF_IMPORT 0x0008 /* Import this symbol */ -#define SF_GLOBAL 0x0010 /* Global symbol */ +#define SF_USER 0x0001 /* User bit */ +#define SF_UNUSED 0x0002 /* Unused entry */ +#define SF_EXPORT 0x0004 /* Export this symbol */ +#define SF_IMPORT 0x0008 /* Import this symbol */ +#define SF_GLOBAL 0x0010 /* Global symbol */ #define SF_LOCAL 0x0020 /* Cheap local symbol */ #define SF_LABEL 0x0040 /* Used as a label */ #define SF_VAR 0x0080 /* Variable symbol */ #define SF_FORCED 0x0100 /* Forced import, SF_IMPORT also set */ #define SF_FIXED 0x0200 /* May not be trampoline */ -#define SF_MULTDEF 0x1000 /* Multiply defined symbol */ -#define SF_DEFINED 0x2000 /* Defined */ -#define SF_REFERENCED 0x4000 /* Referenced */ +#define SF_MULTDEF 0x1000 /* Multiply defined symbol */ +#define SF_DEFINED 0x2000 /* Defined */ +#define SF_REFERENCED 0x4000 /* Referenced */ /* Combined values */ #define SF_REFIMP (SF_REFERENCED|SF_IMPORT) /* A ref'd import */ @@ -81,12 +81,12 @@ struct HLLDbgSym; /* Structure of a symbol table entry */ typedef struct SymEntry SymEntry; struct SymEntry { - SymEntry* Left; /* Lexically smaller entry */ - SymEntry* Right; /* Lexically larger entry */ - SymEntry* List; /* List of all entries */ - SymEntry* Locals; /* Root of subtree for local symbols */ + SymEntry* Left; /* Lexically smaller entry */ + SymEntry* Right; /* Lexically larger entry */ + SymEntry* List; /* List of all entries */ + SymEntry* Locals; /* Root of subtree for local symbols */ union { - struct SymTable* Tab; /* Table this symbol is in */ + struct SymTable* Tab; /* Table this symbol is in */ struct SymEntry* Entry; /* Parent for cheap locals */ } Sym; Collection DefLines; /* Line infos for definition */ @@ -98,17 +98,17 @@ struct SymEntry { * addressing */ struct HLLDbgSym* HLLSym; /* Symbol from high level language */ - unsigned Flags; /* Symbol flags */ + unsigned Flags; /* Symbol flags */ unsigned DebugSymId; /* Debug symbol id */ unsigned ImportId; /* Id of import if this is one */ unsigned ExportId; /* Id of export if this is one */ - struct ExprNode* Expr; /* Symbol expression */ + struct ExprNode* Expr; /* Symbol expression */ Collection ExprRefs; /* Expressions using this symbol */ unsigned char ExportSize; /* Export address size */ unsigned char AddrSize; /* Address size of label */ - unsigned char ConDesPrio[CD_TYPE_COUNT]; /* ConDes priorities... */ - /* ...actually value+1 (used as flag) */ - unsigned Name; /* Name index in global string pool */ + unsigned char ConDesPrio[CD_TYPE_COUNT]; /* ConDes priorities... */ + /* ...actually value+1 (used as flag) */ + unsigned Name; /* Name index in global string pool */ }; /* List of all symbol table entries */ @@ -120,7 +120,7 @@ extern SymEntry* SymLast; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/symtab.c b/src/ca65/symtab.c index 02bc2af49..2681605fa 100644 --- a/src/ca65/symtab.c +++ b/src/ca65/symtab.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* symtab.c */ +/* symtab.c */ /* */ -/* Symbol table for the ca65 macroassembler */ +/* Symbol table for the ca65 macroassembler */ /* */ /* */ /* */ @@ -61,18 +61,18 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Combined symbol entry flags used within this module */ -#define SF_UNDEFMASK (SF_REFERENCED | SF_DEFINED | SF_IMPORT) -#define SF_UNDEFVAL (SF_REFERENCED) +#define SF_UNDEFMASK (SF_REFERENCED | SF_DEFINED | SF_IMPORT) +#define SF_UNDEFVAL (SF_REFERENCED) /* Symbol tables */ -SymTable* CurrentScope = 0; /* Pointer to current symbol table */ -SymTable* RootScope = 0; /* Root symbol table */ +SymTable* CurrentScope = 0; /* Pointer to current symbol table */ +SymTable* RootScope = 0; /* Root symbol table */ static SymTable* LastScope = 0; /* Pointer to last scope in list */ static unsigned ScopeCount = 0; /* Number of scopes */ @@ -83,7 +83,7 @@ static unsigned ExportCount = 0; /* Counter for export symbols */ /*****************************************************************************/ -/* Internally used functions */ +/* Internally used functions */ /*****************************************************************************/ @@ -141,7 +141,7 @@ static SymTable* NewSymTable (SymTable* Parent, const StrBuf* Name) S->Parent = Parent; S->Name = GetStrBufId (Name); while (Slots--) { - S->Table[Slots] = 0; + S->Table[Slots] = 0; } /* Insert the symbol table into the list of all symbol tables */ @@ -191,7 +191,7 @@ static SymTable* NewSymTable (SymTable* Parent, const StrBuf* Name) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -310,12 +310,12 @@ SymTable* SymFindAnyScope (SymTable* Parent, const StrBuf* Name) { SymTable* Scope; do { - /* Search in the current table */ - Scope = SymFindScope (Parent, Name, SYM_FIND_EXISTING); - if (Scope == 0) { - /* Not found, search in the parent scope, if we have one */ - Parent = Parent->Parent; - } + /* Search in the current table */ + Scope = SymFindScope (Parent, Name, SYM_FIND_EXISTING); + if (Scope == 0) { + /* Not found, search in the parent scope, if we have one */ + Parent = Parent->Parent; + } } while (Scope == 0 && Parent != 0); return Scope; @@ -470,7 +470,7 @@ static void SymCheckUndefined (SymEntry* S) * * - An undefined symbol in a nested lexical level. If the symbol is not * fixed to this level, search for the symbol in the higher levels and - * make the entry a trampoline entry if we find one. + * make the entry a trampoline entry if we find one. * * - If the symbol is not found, it is a real undefined symbol. If the * AutoImport flag is set, make it an import. If the AutoImport flag is @@ -499,12 +499,12 @@ static void SymCheckUndefined (SymEntry* S) * and check for problems. */ if (S->Flags & SF_EXPORT) { - if (Sym->Flags & SF_IMPORT) { - /* The symbol is already marked as import */ - LIError (&S->RefLines, + if (Sym->Flags & SF_IMPORT) { + /* The symbol is already marked as import */ + LIError (&S->RefLines, "Symbol `%s' is already an import", GetString (Sym->Name)); - } + } if (Sym->Flags & SF_EXPORT) { /* The symbol is already marked as an export. */ if (Sym->AddrSize > S->ExportSize) { @@ -547,27 +547,27 @@ static void SymCheckUndefined (SymEntry* S) S->Flags = SF_UNUSED; } else { - /* The symbol is definitely undefined */ - if (S->Flags & SF_EXPORT) { - /* We will not auto-import an export */ - LIError (&S->RefLines, + /* The symbol is definitely undefined */ + if (S->Flags & SF_EXPORT) { + /* We will not auto-import an export */ + LIError (&S->RefLines, "Exported symbol `%m%p' was never defined", GetSymName (S)); - } else { - if (AutoImport) { - /* Mark as import, will be indexed later */ - S->Flags |= SF_IMPORT; + } else { + if (AutoImport) { + /* Mark as import, will be indexed later */ + S->Flags |= SF_IMPORT; /* Use the address size for code */ S->AddrSize = CodeAddrSize; /* Mark point of import */ GetFullLineInfo (&S->DefLines); - } else { - /* Error */ - LIError (&S->RefLines, + } else { + /* Error */ + LIError (&S->RefLines, "Symbol `%m%p' is undefined", GetSymName (S)); - } - } + } + } } } @@ -580,7 +580,7 @@ void SymCheck (void) /* Check for open scopes */ if (CurrentScope->Parent != 0) { - Error ("Local scope was not closed"); + Error ("Local scope was not closed"); } /* First pass: Walk through all symbols, checking for undefined's and @@ -588,25 +588,25 @@ void SymCheck (void) */ S = SymList; while (S) { - /* If the symbol is marked as global, mark it as export, if it is - * already defined, otherwise mark it as import. - */ - if (S->Flags & SF_GLOBAL) { - if (S->Flags & SF_DEFINED) { - SymExportFromGlobal (S); - } else { - SymImportFromGlobal (S); - } - } + /* If the symbol is marked as global, mark it as export, if it is + * already defined, otherwise mark it as import. + */ + if (S->Flags & SF_GLOBAL) { + if (S->Flags & SF_DEFINED) { + SymExportFromGlobal (S); + } else { + SymImportFromGlobal (S); + } + } - /* Handle undefined symbols */ - if ((S->Flags & SF_UNDEFMASK) == SF_UNDEFVAL) { - /* This is an undefined symbol. Handle it. */ - SymCheckUndefined (S); - } + /* Handle undefined symbols */ + if ((S->Flags & SF_UNDEFMASK) == SF_UNDEFVAL) { + /* This is an undefined symbol. Handle it. */ + SymCheckUndefined (S); + } - /* Next symbol */ - S = S->List; + /* Next symbol */ + S = S->List; } /* Second pass: Walk again through the symbols. Count exports and imports @@ -616,8 +616,8 @@ void SymCheck (void) */ S = SymList; while (S) { - if ((S->Flags & SF_UNUSED) == 0 && - (S->Flags & SF_UNDEFMASK) != SF_UNDEFVAL) { + if ((S->Flags & SF_UNUSED) == 0 && + (S->Flags & SF_UNDEFMASK) != SF_UNDEFVAL) { /* Check for defined symbols that were never referenced */ if (IsSizeOfSymbol (S)) { @@ -631,22 +631,22 @@ void SymCheck (void) } /* Assign an index to all imports */ - if (S->Flags & SF_IMPORT) { - if ((S->Flags & (SF_REFERENCED | SF_FORCED)) == SF_NONE) { - /* Imported symbol is not referenced */ - LIWarning (&S->DefLines, 2, + if (S->Flags & SF_IMPORT) { + if ((S->Flags & (SF_REFERENCED | SF_FORCED)) == SF_NONE) { + /* Imported symbol is not referenced */ + LIWarning (&S->DefLines, 2, "Symbol `%m%p' is imported but never used", GetSymName (S)); - } else { - /* Give the import an id, count imports */ - S->ImportId = ImportCount++; - } - } + } else { + /* Give the import an id, count imports */ + S->ImportId = ImportCount++; + } + } /* Count exports, assign the export ID */ - if (S->Flags & SF_EXPORT) { + if (S->Flags & SF_EXPORT) { S->ExportId = ExportCount++; - } + } /* If the symbol is defined but has an unknown address size, * recalculate it. @@ -690,10 +690,10 @@ void SymCheck (void) } } - } + } - /* Next symbol */ - S = S->List; + /* Next symbol */ + S = S->List; } } @@ -705,19 +705,19 @@ void SymDump (FILE* F) SymEntry* S = SymList; while (S) { - /* Ignore unused symbols */ - if ((S->Flags & SF_UNUSED) != 0) { - fprintf (F, - "%m%-24p %s %s %s %s %s\n", - GetSymName (S), - (S->Flags & SF_DEFINED)? "DEF" : "---", - (S->Flags & SF_REFERENCED)? "REF" : "---", - (S->Flags & SF_IMPORT)? "IMP" : "---", - (S->Flags & SF_EXPORT)? "EXP" : "---", + /* Ignore unused symbols */ + if ((S->Flags & SF_UNUSED) != 0) { + fprintf (F, + "%m%-24p %s %s %s %s %s\n", + GetSymName (S), + (S->Flags & SF_DEFINED)? "DEF" : "---", + (S->Flags & SF_REFERENCED)? "REF" : "---", + (S->Flags & SF_IMPORT)? "IMP" : "---", + (S->Flags & SF_EXPORT)? "EXP" : "---", AddrSizeToStr (S->AddrSize)); - } - /* Next symbol */ - S = S->List; + } + /* Next symbol */ + S = S->List; } } @@ -745,11 +745,11 @@ void WriteImports (void) (S->Flags & (SF_REFERENCED | SF_FORCED)) != 0) { ObjWrite8 (S->AddrSize); - ObjWriteVar (S->Name); - WriteLineInfo (&S->DefLines); + ObjWriteVar (S->Name); + WriteLineInfo (&S->DefLines); WriteLineInfo (&S->RefLines); - } - S = S->List; + } + S = S->List; } /* Done writing imports */ @@ -773,9 +773,9 @@ void WriteExports (void) /* Walk throught list and write all exports to the file */ S = SymList; while (S) { - if ((S->Flags & (SF_UNUSED | SF_EXPORT)) == SF_EXPORT) { + if ((S->Flags & (SF_UNUSED | SF_EXPORT)) == SF_EXPORT) { - /* Get the expression bits and the value */ + /* Get the expression bits and the value */ long ConstVal; unsigned SymFlags = GetSymInfoFlags (S, &ConstVal); @@ -788,37 +788,37 @@ void WriteExports (void) SymFlags |= SYM_SIZE; } - /* Count the number of ConDes types */ - for (Type = 0; Type < CD_TYPE_COUNT; ++Type) { - if (S->ConDesPrio[Type] != CD_PRIO_NONE) { - SYM_INC_CONDES_COUNT (SymFlags); - } - } + /* Count the number of ConDes types */ + for (Type = 0; Type < CD_TYPE_COUNT; ++Type) { + if (S->ConDesPrio[Type] != CD_PRIO_NONE) { + SYM_INC_CONDES_COUNT (SymFlags); + } + } - /* Write the type and the export size */ - ObjWriteVar (SymFlags); + /* Write the type and the export size */ + ObjWriteVar (SymFlags); ObjWrite8 (S->ExportSize); - /* Write any ConDes declarations */ - if (SYM_GET_CONDES_COUNT (SymFlags) > 0) { - for (Type = 0; Type < CD_TYPE_COUNT; ++Type) { - unsigned char Prio = S->ConDesPrio[Type]; - if (Prio != CD_PRIO_NONE) { - ObjWrite8 (CD_BUILD (Type, Prio)); - } - } - } + /* Write any ConDes declarations */ + if (SYM_GET_CONDES_COUNT (SymFlags) > 0) { + for (Type = 0; Type < CD_TYPE_COUNT; ++Type) { + unsigned char Prio = S->ConDesPrio[Type]; + if (Prio != CD_PRIO_NONE) { + ObjWrite8 (CD_BUILD (Type, Prio)); + } + } + } - /* Write the name */ - ObjWriteVar (S->Name); + /* Write the name */ + ObjWriteVar (S->Name); - /* Write the value */ - if (SYM_IS_CONST (SymFlags)) { - /* Constant value */ - ObjWrite32 (ConstVal); - } else { - /* Expression involved */ - WriteExpr (S->Expr); + /* Write the value */ + if (SYM_IS_CONST (SymFlags)) { + /* Constant value */ + ObjWrite32 (ConstVal); + } else { + /* Expression involved */ + WriteExpr (S->Expr); } /* If the symbol has a size, write it to the file */ @@ -826,11 +826,11 @@ void WriteExports (void) ObjWriteVar (Size); } - /* Write the line infos */ + /* Write the line infos */ WriteLineInfo (&S->DefLines); - WriteLineInfo (&S->RefLines); - } - S = S->List; + WriteLineInfo (&S->RefLines); + } + S = S->List; } /* Done writing exports */ @@ -851,25 +851,25 @@ void WriteDbgSyms (void) /* Check if debug info is requested */ if (DbgSyms) { - /* Walk through the list, give each symbol an id and count them */ - Count = 0; - S = SymList; - while (S) { - if (IsDbgSym (S)) { + /* Walk through the list, give each symbol an id and count them */ + Count = 0; + S = SymList; + while (S) { + if (IsDbgSym (S)) { S->DebugSymId = Count++; - } - S = S->List; - } + } + S = S->List; + } - /* Write the symbol count to the list */ - ObjWriteVar (Count); + /* Write the symbol count to the list */ + ObjWriteVar (Count); - /* Walk through list and write all symbols to the file. Ignore size + /* Walk through list and write all symbols to the file. Ignore size * symbols. */ - S = SymList; - while (S) { - if (IsDbgSym (S)) { + S = SymList; + while (S) { + if (IsDbgSym (S)) { /* Get the expression bits and the value */ long ConstVal; @@ -884,8 +884,8 @@ void WriteDbgSyms (void) SymFlags |= SYM_SIZE; } - /* Write the type */ - ObjWriteVar (SymFlags); + /* Write the type */ + ObjWriteVar (SymFlags); /* Write the address size */ ObjWrite8 (S->AddrSize); @@ -899,17 +899,17 @@ void WriteDbgSyms (void) ObjWriteVar (S->Sym.Entry->DebugSymId); } - /* Write the name */ - ObjWriteVar (S->Name); + /* Write the name */ + ObjWriteVar (S->Name); - /* Write the value */ - if (SYM_IS_CONST (SymFlags)) { - /* Constant value */ - ObjWrite32 (ConstVal); - } else { - /* Expression involved */ - WriteExpr (S->Expr); - } + /* Write the value */ + if (SYM_IS_CONST (SymFlags)) { + /* Constant value */ + ObjWrite32 (ConstVal); + } else { + /* Expression involved */ + WriteExpr (S->Expr); + } /* If the symbol has a size, write it to the file */ if (SYM_HAS_SIZE (SymFlags)) { @@ -924,17 +924,17 @@ void WriteDbgSyms (void) ObjWriteVar (GetSymExportId (S)); } - /* Write the line infos */ + /* Write the line infos */ WriteLineInfo (&S->DefLines); - WriteLineInfo (&S->RefLines); - } - S = S->List; - } + WriteLineInfo (&S->RefLines); + } + S = S->List; + } } else { - /* No debug symbols */ - ObjWriteVar (0); + /* No debug symbols */ + ObjWriteVar (0); } diff --git a/src/ca65/symtab.h b/src/ca65/symtab.h index 0a0b2caa9..e7f7384d0 100644 --- a/src/ca65/symtab.h +++ b/src/ca65/symtab.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* symtab.h */ +/* symtab.h */ /* */ -/* Symbol table for the ca65 macroassembler */ +/* Symbol table for the ca65 macroassembler */ /* */ /* */ /* */ @@ -50,15 +50,15 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Arguments for SymFind... */ typedef enum { - SYM_FIND_EXISTING = 0x00, - SYM_ALLOC_NEW = 0x01, + SYM_FIND_EXISTING = 0x00, + SYM_ALLOC_NEW = 0x01, SYM_CHECK_ONLY = 0x02, } SymFindAction; @@ -73,29 +73,29 @@ struct SymTable { SymTable* Next; /* Pointer to next table in list */ SymTable* Left; /* Pointer to smaller entry */ SymTable* Right; /* Pointer to greater entry */ - SymTable* Parent; /* Link to enclosing scope if any */ + SymTable* Parent; /* Link to enclosing scope if any */ SymTable* Childs; /* Pointer to child scopes */ SymEntry* Label; /* Scope label */ Collection Spans; /* Spans for this scope */ unsigned Id; /* Scope id */ unsigned short Flags; /* Symbol table flags */ - unsigned char AddrSize; /* Address size */ + unsigned char AddrSize; /* Address size */ unsigned char Type; /* Type of the scope */ unsigned Level; /* Lexical level */ - unsigned TableSlots; /* Number of hash table slots */ - unsigned TableEntries; /* Number of entries in the table */ + unsigned TableSlots; /* Number of hash table slots */ + unsigned TableEntries; /* Number of entries in the table */ unsigned Name; /* Name of the scope */ - SymEntry* Table[1]; /* Dynamic allocation */ + SymEntry* Table[1]; /* Dynamic allocation */ }; /* Symbol tables */ extern SymTable* CurrentScope; /* Pointer to current symbol table */ -extern SymTable* RootScope; /* Root symbol table */ +extern SymTable* RootScope; /* Root symbol table */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/token.c b/src/ca65/token.c index 5fb3d2fc8..b2d103dde 100644 --- a/src/ca65/token.c +++ b/src/ca65/token.c @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/token.h b/src/ca65/token.h index eba24cdfa..5214771fd 100644 --- a/src/ca65/token.h +++ b/src/ca65/token.h @@ -46,67 +46,67 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Tokens */ typedef enum token_t { - TOK_NONE, /* Start value, invalid */ - TOK_EOF, /* End of input file */ - TOK_SEP, /* Separator (usually newline) */ - TOK_IDENT, /* An identifier */ + TOK_NONE, /* Start value, invalid */ + TOK_EOF, /* End of input file */ + TOK_SEP, /* Separator (usually newline) */ + TOK_IDENT, /* An identifier */ TOK_LOCAL_IDENT, /* A cheap local identifier */ - TOK_INTCON, /* Integer constant */ - TOK_CHARCON, /* Character constant */ - TOK_STRCON, /* String constant */ + TOK_INTCON, /* Integer constant */ + TOK_CHARCON, /* Character constant */ + TOK_STRCON, /* String constant */ - TOK_A, /* A)ccumulator */ - TOK_X, /* X register */ - TOK_Y, /* Y register */ - TOK_S, /* S register */ + TOK_A, /* A)ccumulator */ + TOK_X, /* X register */ + TOK_Y, /* Y register */ + TOK_S, /* S register */ TOK_REG, /* Sweet16 R.. register (in sweet16 mode) */ TOK_ASSIGN, /* := */ - TOK_ULABEL, /* :++ or :-- */ + TOK_ULABEL, /* :++ or :-- */ - TOK_EQ, /* = */ - TOK_NE, /* <> */ - TOK_LT, /* < */ - TOK_GT, /* > */ - TOK_LE, /* <= */ - TOK_GE, /* >= */ + TOK_EQ, /* = */ + TOK_NE, /* <> */ + TOK_LT, /* < */ + TOK_GT, /* > */ + TOK_LE, /* <= */ + TOK_GE, /* >= */ - TOK_BOOLAND, /* .and */ - TOK_BOOLOR, /* .or */ - TOK_BOOLXOR, /* .xor */ - TOK_BOOLNOT, /* .not */ + TOK_BOOLAND, /* .and */ + TOK_BOOLOR, /* .or */ + TOK_BOOLXOR, /* .xor */ + TOK_BOOLNOT, /* .not */ - TOK_PLUS, /* + */ - TOK_MINUS, /* - */ - TOK_MUL, /* * */ - TOK_STAR = TOK_MUL, /* Alias */ - TOK_DIV, /* / */ - TOK_MOD, /* ! */ - TOK_OR, /* | */ - TOK_XOR, /* ^ */ - TOK_AND, /* & */ - TOK_SHL, /* << */ - TOK_SHR, /* >> */ - TOK_NOT, /* ~ */ + TOK_PLUS, /* + */ + TOK_MINUS, /* - */ + TOK_MUL, /* * */ + TOK_STAR = TOK_MUL, /* Alias */ + TOK_DIV, /* / */ + TOK_MOD, /* ! */ + TOK_OR, /* | */ + TOK_XOR, /* ^ */ + TOK_AND, /* & */ + TOK_SHL, /* << */ + TOK_SHR, /* >> */ + TOK_NOT, /* ~ */ - TOK_PC, /* $ if enabled */ - TOK_NAMESPACE, /* :: */ - TOK_DOT, /* . */ - TOK_COMMA, /* , */ - TOK_HASH, /* # */ - TOK_COLON, /* : */ - TOK_LPAREN, /* ( */ - TOK_RPAREN, /* ) */ - TOK_LBRACK, /* [ */ - TOK_RBRACK, /* ] */ + TOK_PC, /* $ if enabled */ + TOK_NAMESPACE, /* :: */ + TOK_DOT, /* . */ + TOK_COMMA, /* , */ + TOK_HASH, /* # */ + TOK_COLON, /* : */ + TOK_LPAREN, /* ( */ + TOK_RPAREN, /* ) */ + TOK_LBRACK, /* [ */ + TOK_RBRACK, /* ] */ TOK_LCURLY, /* { */ TOK_RCURLY, /* } */ TOK_AT, /* @ - in Sweet16 mode */ @@ -115,12 +115,12 @@ typedef enum token_t { TOK_OVERRIDE_ABS, /* a: */ TOK_OVERRIDE_FAR, /* f: */ - TOK_MACPARAM, /* Macro parameter, not generated by scanner */ - TOK_REPCOUNTER, /* Repeat counter, not generated by scanner */ + TOK_MACPARAM, /* Macro parameter, not generated by scanner */ + TOK_REPCOUNTER, /* Repeat counter, not generated by scanner */ /* The next ones are tokens for the pseudo instructions. Keep together! */ TOK_FIRSTPSEUDO, - TOK_A16 = TOK_FIRSTPSEUDO, + TOK_A16 = TOK_FIRSTPSEUDO, TOK_A8, TOK_ADDR, TOK_ALIGN, @@ -255,9 +255,9 @@ typedef enum token_t { TOK_WORD, TOK_XMATCH, TOK_ZEROPAGE, - TOK_LASTPSEUDO = TOK_ZEROPAGE, + TOK_LASTPSEUDO = TOK_ZEROPAGE, - TOK_COUNT /* Count of tokens */ + TOK_COUNT /* Count of tokens */ } token_t; @@ -284,7 +284,7 @@ struct Token { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/toklist.c b/src/ca65/toklist.c index 9c12422ec..e6adf3d96 100644 --- a/src/ca65/toklist.c +++ b/src/ca65/toklist.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* toklist.c */ +/* toklist.c */ /* */ -/* Token list for the ca65 macroassembler */ +/* Token list for the ca65 macroassembler */ /* */ /* */ /* */ @@ -61,7 +61,7 @@ static unsigned PushCounter = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -107,19 +107,19 @@ enum TC TokCmp (const TokNode* N) /* Compare the token given as parameter against the current token */ { if (N->T.Tok != CurTok.Tok) { - /* Different token */ - return tcDifferent; + /* Different token */ + return tcDifferent; } /* If the token has string attribute, check it */ if (TokHasSVal (N->T.Tok)) { - if (SB_Compare (&CurTok.SVal, &N->T.SVal) != 0) { - return tcSameToken; - } + if (SB_Compare (&CurTok.SVal, &N->T.SVal) != 0) { + return tcSameToken; + } } else if (TokHasIVal (N->T.Tok)) { - if (N->T.IVal != CurTok.IVal) { - return tcSameToken; - } + if (N->T.IVal != CurTok.IVal) { + return tcSameToken; + } } /* Tokens are identical */ @@ -135,14 +135,14 @@ TokList* NewTokList (void) TokList* T = xmalloc (sizeof (TokList)); /* Initialize the fields */ - T->Next = 0; - T->Root = 0; - T->Last = 0; - T->RepCount = 0; - T->RepMax = 1; - T->Count = 0; - T->Check = 0; - T->Data = 0; + T->Next = 0; + T->Root = 0; + T->Last = 0; + T->RepCount = 0; + T->RepMax = 1; + T->Count = 0; + T->Check = 0; + T->Data = 0; T->LI = 0; /* Return the new list */ @@ -157,9 +157,9 @@ void FreeTokList (TokList* List) /* Free the token list */ TokNode* T = List->Root; while (T) { - TokNode* Tmp = T; - T = T->Next; - FreeTokNode (Tmp); + TokNode* Tmp = T; + T = T->Next; + FreeTokNode (Tmp); } /* Free associated line info */ @@ -169,7 +169,7 @@ void FreeTokList (TokList* List) /* If we have associated data, free it */ if (List->Data) { - xfree (List->Data); + xfree (List->Data); } /* Free the list structure itself */ @@ -202,9 +202,9 @@ void AddCurTok (TokList* List) /* Insert the node into the list */ if (List->Root == 0) { - List->Root = T; + List->Root = T; } else { - List->Last->Next = T; + List->Last->Next = T; } List->Last = T; @@ -227,16 +227,16 @@ static int ReplayTokList (void* List) * zero, delete the list and remove the function from the stack. */ if (L->Last == 0) { - if (++L->RepCount >= L->RepMax) { - /* Done with this list */ - FreeTokList (L); + if (++L->RepCount >= L->RepMax) { + /* Done with this list */ + FreeTokList (L); --PushCounter; - PopInput (); + PopInput (); return 0; - } else { - /* Replay one more time */ - L->Last = L->Root; - } + } else { + /* Replay one more time */ + L->Last = L->Root; + } } /* Set the next token from the list */ @@ -252,7 +252,7 @@ static int ReplayTokList (void* List) * just set and changed it as apropriate. */ if (L->Check) { - L->Check (L); + L->Check (L); } /* Set the pointer to the next token */ @@ -272,8 +272,8 @@ void PushTokList (TokList* List, const char* Desc) { /* If the list is empty, just delete it and bail out */ if (List->Count == 0) { - FreeTokList (List); - return; + FreeTokList (List); + return; } /* Reset the last pointer to the first element */ diff --git a/src/ca65/toklist.h b/src/ca65/toklist.h index 8b4f6449b..6e7a414cc 100644 --- a/src/ca65/toklist.h +++ b/src/ca65/toklist.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* toklist.h */ +/* toklist.h */ /* */ -/* Token list for the ca65 macroassembler */ +/* Token list for the ca65 macroassembler */ /* */ /* */ /* */ @@ -48,7 +48,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -56,21 +56,21 @@ /* Struct holding a token */ typedef struct TokNode TokNode; struct TokNode { - TokNode* Next; /* For single linked list */ + TokNode* Next; /* For single linked list */ Token T; /* Token value */ }; /* Struct holding a token list */ typedef struct TokList TokList; struct TokList { - TokList* Next; /* Single linked list (for replay) */ - TokNode* Root; /* First node in list */ - TokNode* Last; /* Last node in list or replay */ - unsigned RepCount; /* Repeat counter (used for replay) */ - unsigned RepMax; /* Maximum repeat count for replay */ - unsigned Count; /* Token count */ - void (*Check)(TokList*); /* Token check function */ - void* Data; /* Additional data for check */ + TokList* Next; /* Single linked list (for replay) */ + TokNode* Root; /* First node in list */ + TokNode* Last; /* Last node in list or replay */ + unsigned RepCount; /* Repeat counter (used for replay) */ + unsigned RepMax; /* Maximum repeat count for replay */ + unsigned Count; /* Token count */ + void (*Check)(TokList*); /* Token check function */ + void* Data; /* Additional data for check */ LineInfo* LI; /* Line info for replay */ }; @@ -78,15 +78,15 @@ struct TokList { /* Return codes for TokCmp - higher numeric code means better match */ enum TC { - tcDifferent, /* Different tokents */ - tcSameToken, /* Same token, different attribute */ - tcIdentical /* Identical (token + attribute) */ + tcDifferent, /* Different tokents */ + tcSameToken, /* Same token, different attribute */ + tcIdentical /* Identical (token + attribute) */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65/ulabel.c b/src/ca65/ulabel.c index 768312c19..140dad3d9 100644 --- a/src/ca65/ulabel.c +++ b/src/ca65/ulabel.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* ulabel.c */ +/* ulabel.c */ /* */ -/* Unnamed labels for the ca65 macroassembler */ +/* Unnamed labels for the ca65 macroassembler */ /* */ /* */ /* */ @@ -48,7 +48,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -57,18 +57,18 @@ typedef struct ULabel ULabel; struct ULabel { Collection LineInfos; /* Position of the label in the source */ - ExprNode* Val; /* The label value - may be NULL */ + ExprNode* Val; /* The label value - may be NULL */ unsigned Ref; /* Number of references */ }; /* List management */ -static Collection ULabList = STATIC_COLLECTION_INITIALIZER; -static unsigned ULabDefCount = 0; /* Number of defined labels */ +static Collection ULabList = STATIC_COLLECTION_INITIALIZER; +static unsigned ULabDefCount = 0; /* Number of defined labels */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -104,7 +104,7 @@ ExprNode* ULabRef (int Which) * must be resolved later. */ { - int Index; + int Index; ULabel* L; /* Which can never be 0 */ @@ -112,27 +112,27 @@ ExprNode* ULabRef (int Which) /* Get the index of the referenced label */ if (Which > 0) { - --Which; + --Which; } Index = (int) ULabDefCount + Which; /* We cannot have negative label indices */ if (Index < 0) { - /* Label does not exist */ - Error ("Undefined label"); - /* We must return something valid */ - return GenCurrentPC(); + /* Label does not exist */ + Error ("Undefined label"); + /* We must return something valid */ + return GenCurrentPC(); } /* Check if the label exists. If not, generate enough forward labels. */ if (Index < (int) CollCount (&ULabList)) { /* The label exists, get it. */ - L = CollAtUnchecked (&ULabList, Index); + L = CollAtUnchecked (&ULabList, Index); } else { /* Generate new, undefined labels */ - while (Index >= (int) CollCount (&ULabList)) { + while (Index >= (int) CollCount (&ULabList)) { L = NewULabel (0); - } + } } /* Mark the label as referenced */ @@ -154,18 +154,18 @@ void ULabDef (void) /* Define an unnamed label at the current PC */ { if (ULabDefCount < CollCount (&ULabList)) { - /* We did already have a forward reference to this label, so has - * already been generated, but doesn't have a value. Use the current - * PC for the label value. - */ - ULabel* L = CollAtUnchecked (&ULabList, ULabDefCount); - CHECK (L->Val == 0); - L->Val = GenCurrentPC (); + /* We did already have a forward reference to this label, so has + * already been generated, but doesn't have a value. Use the current + * PC for the label value. + */ + ULabel* L = CollAtUnchecked (&ULabList, ULabDefCount); + CHECK (L->Val == 0); + L->Val = GenCurrentPC (); ReleaseFullLineInfo (&L->LineInfos); GetFullLineInfo (&L->LineInfos); } else { - /* There is no such label, create it */ - NewULabel (GenCurrentPC ()); + /* There is no such label, create it */ + NewULabel (GenCurrentPC ()); } /* We have one more defined label */ @@ -207,9 +207,9 @@ void ULabDone (void) /* Check if there are undefined labels */ unsigned I = ULabDefCount; while (I < CollCount (&ULabList)) { - ULabel* L = CollAtUnchecked (&ULabList, I); - LIError (&L->LineInfos, "Undefined label"); - ++I; + ULabel* L = CollAtUnchecked (&ULabList, I); + LIError (&L->LineInfos, "Undefined label"); + ++I; } /* Walk over all labels and emit a warning if any unreferenced ones diff --git a/src/ca65/ulabel.h b/src/ca65/ulabel.h index 9e8d1b37f..c7c172918 100644 --- a/src/ca65/ulabel.h +++ b/src/ca65/ulabel.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* ulabel.h */ +/* ulabel.h */ /* */ -/* Unnamed labels for the ca65 macroassembler */ +/* Unnamed labels for the ca65 macroassembler */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ca65html/ca65html b/src/ca65html/ca65html index 3d82abaeb..bdb4a9d46 100755 --- a/src/ca65html/ca65html +++ b/src/ca65html/ca65html @@ -3,7 +3,7 @@ # # # ca65html # # # -# Convert a ca65 source into HTML # +# Convert a ca65 source into HTML # # # # # # # @@ -55,42 +55,42 @@ use Getopt::Long; #-----------------------------------------------------------------------------# -# Variables # +# Variables # # ----------------------------------------------------------------------------# # Global variables -my %Files = (); # List of all files. -my $FileCount = 0; # Number of input files -my %Exports = (); # List of exported symbols. -my %Imports = (); # List of imported symbols. -my %Labels = (); # List of all labels -my $LabelNum = 0; # Counter to generate unique labels +my %Files = (); # List of all files. +my $FileCount = 0; # Number of input files +my %Exports = (); # List of exported symbols. +my %Imports = (); # List of imported symbols. +my %Labels = (); # List of all labels +my $LabelNum = 0; # Counter to generate unique labels # Command line options -my $BGColor = "#FFFFFF"; # Background color +my $BGColor = "#FFFFFF"; # Background color my $Colorize = 0; # Colorize the output my $CommentColor = "#B22222"; # Color for comments my $CRefs = 0; # Add references to the C file my $CtrlColor = "#228B22"; # Color for control directives -my $CvtTabs = 0; # Convert tabs to spaces +my $CvtTabs = 0; # Convert tabs to spaces my $TabSize = 8; # This is how god created them -my $Debug = 0; # No debugging -my $Help = 0; # Help flag -my $HTMLDir = ""; # Directory in which to create the files -my $IndexCols = 6; # Columns in the file listing -my $IndexTitle = "Index"; # Title of index page -my $IndexName = "index.html"; # Name of index page -my $IndexPage = 0; # Create an index page +my $Debug = 0; # No debugging +my $Help = 0; # Help flag +my $HTMLDir = ""; # Directory in which to create the files +my $IndexCols = 6; # Columns in the file listing +my $IndexTitle = "Index"; # Title of index page +my $IndexName = "index.html"; # Name of index page +my $IndexPage = 0; # Create an index page my $KeywordColor = "#A020F0"; # Color for keywords my $LineLabels = 0; # Add a HTML label to each line my $LineNumbers = 0; # Add line numbers to the output -my $LinkStyle = 0; # Default link style -my $ReplaceExt = 0; # Replace extension instead of appending +my $LinkStyle = 0; # Default link style +my $ReplaceExt = 0; # Replace extension instead of appending my $StringColor = "#6169C1"; # Color for strings -my $TextColor = "#000000"; # Text color -my $Verbose = 0; # Be quiet +my $TextColor = "#000000"; # Text color +my $Verbose = 0; # Be quiet # Table used to convert the label number into names my @NameTab = ('A' .. 'Z', '0' .. '9'); @@ -98,7 +98,7 @@ my @NameTab = ('A' .. 'Z', '0' .. '9'); #-----------------------------------------------------------------------------# -# Helper functions # +# Helper functions # # ----------------------------------------------------------------------------# @@ -112,7 +112,7 @@ sub Abort { # Print a message if verbose is true sub Gabble { if ($Verbose) { - print "ca65html: @_\n"; + print "ca65html: @_\n"; } } @@ -125,8 +125,8 @@ sub GenLabel { # Generate the label for ($I = 0; $I < 4; $I++) { - $L = $NameTab[$Num % 36] . $L; - $Num /= 36; + $L = $NameTab[$Num % 36] . $L; + $Num /= 36; } return $L; } @@ -139,9 +139,9 @@ sub GetOutName { # Create the output file name from the input file name if ($ReplaceExt && $InName =~ /^(.+)\.([^\.\/]*)$/) { - return "$1.html"; + return "$1.html"; } else { - return "$InName.html"; + return "$InName.html"; } } @@ -169,7 +169,7 @@ sub StripPath { #-----------------------------------------------------------------------------# -# Document header and footer # +# Document header and footer # # ----------------------------------------------------------------------------# @@ -302,7 +302,7 @@ sub ColorizeString { #-----------------------------------------------------------------------------# -# File list management # +# File list management # #-----------------------------------------------------------------------------# @@ -317,27 +317,27 @@ sub AddFile { # Check if we have the file already if (exists ($Files{$Name})) { - Gabble ("File \"$FileName\" already known"); - return; + Gabble ("File \"$FileName\" already known"); + return; } # Check with the full pathname. If we don't find it, search in the current # directory if (-f $FileName && -r _) { - $Files{$Name} = $FileName; - $FileCount++; + $Files{$Name} = $FileName; + $FileCount++; } elsif (-f $Name && -r _) { - $Files{$Name} = $Name; - $FileCount++; + $Files{$Name} = $Name; + $FileCount++; } else { - Abort ("$FileName not found or not readable"); + Abort ("$FileName not found or not readable"); } } #-----------------------------------------------------------------------------# -# Referencing and defining labels # +# Referencing and defining labels # #-----------------------------------------------------------------------------# @@ -348,44 +348,44 @@ sub RefLabel { # Arguments are: Filename, identifier, item that should be tagged my $FileName = $_[0]; my $Id = $_[1]; - my $Item = $_[2]; + my $Item = $_[2]; # Search for the identifier in the list of labels if (exists ($Labels{$FileName}{$Id})) { - # It is a label (in this file) - return sprintf ("%s", $Labels{$FileName}{$Id}, $Item); + # It is a label (in this file) + return sprintf ("%s", $Labels{$FileName}{$Id}, $Item); } elsif (exists ($Imports{$FileName}{$Id})) { - # It is an import. If LinkStyle is 1, or if the file exporting the - # identifier is not visible, we link to the .import statement in the - # current file. Otherwise we link directly to the referenced symbol - # in the file that exports it. - if ($LinkStyle == 1 or not exists ($Exports{$Id})) { - return sprintf ("%s", $Imports{$FileName}{$Id}, $Item); - } else { - # Get the filename from the export - my $Label; - ($FileName, $Label) = split (/#/, $Exports{$Id}); - if (not defined ($Labels{$FileName}{$Id})) { - # This may currently happen because we don't see .include - # statements, so we may have an export but no definition. - # Link to the .export statement instead - $Label = $Exports{$Id}; - } else { - # Link to the definition in the file - $Label = sprintf ("%s#%s", $FileName, $Labels{$FileName}{$Id}); - } - return sprintf ("%s", $Label, $Item); - } + # It is an import. If LinkStyle is 1, or if the file exporting the + # identifier is not visible, we link to the .import statement in the + # current file. Otherwise we link directly to the referenced symbol + # in the file that exports it. + if ($LinkStyle == 1 or not exists ($Exports{$Id})) { + return sprintf ("%s", $Imports{$FileName}{$Id}, $Item); + } else { + # Get the filename from the export + my $Label; + ($FileName, $Label) = split (/#/, $Exports{$Id}); + if (not defined ($Labels{$FileName}{$Id})) { + # This may currently happen because we don't see .include + # statements, so we may have an export but no definition. + # Link to the .export statement instead + $Label = $Exports{$Id}; + } else { + # Link to the definition in the file + $Label = sprintf ("%s#%s", $FileName, $Labels{$FileName}{$Id}); + } + return sprintf ("%s", $Label, $Item); + } } else { - # The symbol is unknown, return as is - return $Item; + # The symbol is unknown, return as is + return $Item; } } #-----------------------------------------------------------------------------# -# Pass 1 # +# Pass 1 # # ----------------------------------------------------------------------------# @@ -407,7 +407,7 @@ sub Process1 { my $CheapPrefix = ""; # Open a the input file - my $FileName = $Files{$InName}; # Includes path if needed + my $FileName = $Files{$InName}; # Includes path if needed open (INPUT, "<$FileName") or Abort ("Cannot open $FileName: $!"); # Keep the user happy @@ -416,65 +416,65 @@ sub Process1 { # Read and process all lines from the file while ($Line = ) { - # Remove the newline - chomp ($Line); + # Remove the newline + chomp ($Line); - # Check for a label + # Check for a label if ($Line =~ /^\s*(([\@?]?)[_a-zA-Z]\w*)\s*(?::=?|=)/) { - # Is this a local label? - if ($2 ne "") { - # Use the prefix - $Id = "$CheapPrefix$1"; - } else { - # Use as is - $Id = $1; - # Remember the id as new cheap local prefix - $CheapPrefix = $Id; - } + # Is this a local label? + if ($2 ne "") { + # Use the prefix + $Id = "$CheapPrefix$1"; + } else { + # Use as is + $Id = $1; + # Remember the id as new cheap local prefix + $CheapPrefix = $Id; + } - # Remember the label - $Labels{$OutName}{$Id} = GenLabel(); + # Remember the label + $Labels{$OutName}{$Id} = GenLabel(); - # Check for an import statement - } elsif ($Line =~ /^\s*\.(?:(?:force)?import|importzp)\s+(.*?)\s*(?:;.*)?$/i) { + # Check for an import statement + } elsif ($Line =~ /^\s*\.(?:(?:force)?import|importzp)\s+(.*?)\s*(?:;.*)?$/i) { - # Split into a list of identifiers - my @Ids = split (/\s*(?::\s*[A-Za-z]+\s*)?,\s*/, $1); + # Split into a list of identifiers + my @Ids = split (/\s*(?::\s*[A-Za-z]+\s*)?,\s*/, $1); - # Remove an address-size specifier, from the last identifier, - # if there is one. - $Ids[$#Ids] =~ s/\s*:\s*[A-Za-z]+//; + # Remove an address-size specifier, from the last identifier, + # if there is one. + $Ids[$#Ids] =~ s/\s*:\s*[A-Za-z]+//; - for $Id (@Ids) { - $Imports{$OutName}{$Id} = GenLabel(); - } + for $Id (@Ids) { + $Imports{$OutName}{$Id} = GenLabel(); + } - # Check for an export statement - } elsif ($Line =~ /^\s*\.export(?:zp)?\s+(.*?)\s*(?:;.*)?$/i) { + # Check for an export statement + } elsif ($Line =~ /^\s*\.export(?:zp)?\s+(.*?)\s*(?:;.*)?$/i) { - # Split into a list of identifiers - my @Ids = split (/\s*(?::\s*[A-Za-z]+\s*)?,\s*/, $1); + # Split into a list of identifiers + my @Ids = split (/\s*(?::\s*[A-Za-z]+\s*)?,\s*/, $1); - # Remove an address-size specifier, from the last identifier, - # if there is one. - $Ids[$#Ids] =~ s/\s*:\s*[A-Za-z]+//; + # Remove an address-size specifier, from the last identifier, + # if there is one. + $Ids[$#Ids] =~ s/\s*:\s*[A-Za-z]+//; - for $Id (@Ids) { - $Exports{$Id} = sprintf ("%s#%s", $OutName, GenLabel()); - } + for $Id (@Ids) { + $Exports{$Id} = sprintf ("%s#%s", $OutName, GenLabel()); + } - # Check for an actor statement. - } elsif ($Line =~ /^\s*\.(?:(?:(?:con|de)struc|interrup)tor|condes)\s+([_a-z]\w*)/i) { - $Exports{$1} = sprintf ("%s#%s", $OutName, GenLabel()); + # Check for an actor statement. + } elsif ($Line =~ /^\s*\.(?:(?:(?:con|de)struc|interrup)tor|condes)\s+([_a-z]\w*)/i) { + $Exports{$1} = sprintf ("%s#%s", $OutName, GenLabel()); - # Check for a .proc statement - } elsif ($Line =~ /^\s*\.proc\s+([_a-z]\w*)/i) { + # Check for a .proc statement + } elsif ($Line =~ /^\s*\.proc\s+([_a-z]\w*)/i) { - # Remember the ID as the new cheap-local prefix. - $CheapPrefix = $1; - $Labels{$OutName}{$1} = GenLabel(); - } + # Remember the ID as the new cheap-local prefix. + $CheapPrefix = $1; + $Labels{$OutName}{$1} = GenLabel(); + } } # Close the input file @@ -491,15 +491,15 @@ sub Pass1 () { # Walk over the files for my $InName (keys (%Files)) { - # Process one file - Process1 ($InName); + # Process one file + Process1 ($InName); } } #-----------------------------------------------------------------------------# -# Pass 2 # +# Pass 2 # # ----------------------------------------------------------------------------# @@ -527,7 +527,7 @@ sub Process2 { my $CheapPrefix = ""; # Open a the input file - my $FileName = $Files{$InName}; # Includes path if needed + my $FileName = $Files{$InName}; # Includes path if needed open (INPUT, "<$FileName") or Abort ("Cannot open $FileName: $!"); # Open the output file and print the HTML header @@ -541,17 +541,17 @@ sub Process2 { # The instructions that will have hyperlinks if a label is used. # And, they will be highlighted when color is used. my $LabelIns = "adc|add|and|asl|bb[rs][0-7]|b[cv][cs]|beq|bge|bit|blt|". - "bmi|bne|bpl|br[akl]|bsr|cmp|cop|cp[axy]|dec|eor|inc|jml|". - "jmp|jsl|jsr|ld[axy]|lsr|mvn|mvp|ora|pe[air]|rep|". - "[rs]mb[0-7]|rol|ror|sbc|sep|st[012axyz]|sub|tai|tam|tdd|". - "ti[ain]|tma|trb|tsb|tst"; + "bmi|bne|bpl|br[akl]|bsr|cmp|cop|cp[axy]|dec|eor|inc|jml|". + "jmp|jsl|jsr|ld[axy]|lsr|mvn|mvp|ora|pe[air]|rep|". + "[rs]mb[0-7]|rol|ror|sbc|sep|st[012axyz]|sub|tai|tam|tdd|". + "ti[ain]|tma|trb|tsb|tst"; # Instructions that have only the implied-addressing mode -- therefore, # no hyperlinking. They will be highlighted only, when color is used. my $OtherIns = "cl[acdivxy]|csh|csl|de[axy]|in[axy]|nop|ph[abdkpxy]|". - "pl[abdpxy]|rt[ils]|sax|say|se[cdit]|stp|swa|sxy|ta[dsxy]|". - "tam[0-7]|tcd|tcs|tda|tdc|tma[0-7]|ts[acx]|tx[asy]|tya|tyx|". - "wai|xba|xce"; + "pl[abdpxy]|rt[ils]|sax|say|se[cdit]|stp|swa|sxy|ta[dsxy]|". + "tam[0-7]|tcd|tcs|tda|tdc|tma[0-7]|ts[acx]|tx[asy]|tya|tyx|". + "wai|xba|xce"; # Read the input file, replacing references with hyperlinks; and, mark # labels as link targets. @@ -561,18 +561,18 @@ sub Process2 { # Count input lines $LineNo++; - # Remove the newline at the end of line. Don't use chomp to be able to + # Remove the newline at the end of line. Don't use chomp to be able to # read dos/windows sources on unices. $Line =~ s/[\r\n]*$//; # If requested, convert tabs to spaces - if ($CvtTabs) { - # Don't ask me - this is from the perl manual page - 1 while ($Line =~ s/\t+/' ' x (length($&) * $TabSize - length($`) % $TabSize)/e) ; - } + if ($CvtTabs) { + # Don't ask me - this is from the perl manual page + 1 while ($Line =~ s/\t+/' ' x (length($&) * $TabSize - length($`) % $TabSize)/e) ; + } - # Clear the output line - $OutLine = ""; + # Clear the output line + $OutLine = ""; # If requested, add a html label to each line with a name "linexxx", # so it can be referenced from the outside (this is the same convention @@ -597,245 +597,245 @@ sub Process2 { # Remove trailing whitespace and move it together with the comment # into the $Trailer variable. - $Line =~ s/\s*$//; - $Trailer = $& . ColorizeComment (Cleanup ($Comment)); + $Line =~ s/\s*$//; + $Trailer = $& . ColorizeComment (Cleanup ($Comment)); - # Check for a label at the start of the line. If we have one, process + # Check for a label at the start of the line. If we have one, process # it, and remove it from the line. if ($Line =~ s/^\s*?(([\@?]?)[_a-zA-Z]\w*)(\s*(?::=?|=))//) { - # Is this a local label? - if ($2 ne "") { - # Use the prefix - $Id = "$CheapPrefix$1"; - } else { - # Use as is - $Id = $1; - # Remember the id as new cheap local prefix - $CheapPrefix = $Id; - } + # Is this a local label? + if ($2 ne "") { + # Use the prefix + $Id = "$CheapPrefix$1"; + } else { + # Use as is + $Id = $1; + # Remember the id as new cheap local prefix + $CheapPrefix = $Id; + } - # Get the label for the id - $Label = $Labels{$OutName}{$Id}; + # Get the label for the id + $Label = $Labels{$OutName}{$Id}; - # Print the label with a tag - $OutLine .= "$1$3"; + # Print the label with a tag + $OutLine .= "$1$3"; - # Is the name explicitly assigned a value? - if ($3 =~ /=$/) { - # Print all identifiers if there are any. - while ($Line =~ s/^([^_a-zA-Z]*?)(([\@?]?)[_a-zA-Z]\w*)//) { - # Add the non-label stuff. - $OutLine .= Cleanup ($1); + # Is the name explicitly assigned a value? + if ($3 =~ /=$/) { + # Print all identifiers if there are any. + while ($Line =~ s/^([^_a-zA-Z]*?)(([\@?]?)[_a-zA-Z]\w*)//) { + # Add the non-label stuff. + $OutLine .= Cleanup ($1); - # Use the prefix if the label is local. - # Get the reference to that label if we find it. - $OutLine .= RefLabel ($OutName, ($3 ne "") ? "$CheapPrefix$2" : $2, $2); - } + # Use the prefix if the label is local. + # Get the reference to that label if we find it. + $OutLine .= RefLabel ($OutName, ($3 ne "") ? "$CheapPrefix$2" : $2, $2); + } - # Add a remainder if there is one. - $OutLine .= Cleanup ($Line); + # Add a remainder if there is one. + $OutLine .= Cleanup ($Line); - # The line is complete; print it. - next LINE; - } - } + # The line is complete; print it. + next LINE; + } + } - # Print any leading whitespace and remove it, so we don't have to - # care about whitespace below. - if ($Line =~ s/^\s+//) { - $OutLine .= $&; - } + # Print any leading whitespace and remove it, so we don't have to + # care about whitespace below. + if ($Line =~ s/^\s+//) { + $OutLine .= $&; + } - # Handle the import statements - if ($Line =~ s/^\.(?:(?:force)?import|importzp)\s+//i) { + # Handle the import statements + if ($Line =~ s/^\.(?:(?:force)?import|importzp)\s+//i) { - # Print any fixed stuff from the line and remove it - $OutLine .= $&; + # Print any fixed stuff from the line and remove it + $OutLine .= $&; - # Print all identifiers if there are any - while ($Line =~ s/^[_a-zA-Z]\w*//) { + # Print all identifiers if there are any + while ($Line =~ s/^[_a-zA-Z]\w*//) { # Remember the identifier - my $Id = $&; + my $Id = $&; - # Variable to assemble HTML representation - my $Contents = ""; + # Variable to assemble HTML representation + my $Contents = ""; - # Make this import a link target - if (exists ($Imports{$OutName}{$Id})) { - $Label = $Imports{$OutName}{$Id}; - $Contents .= sprintf (" name=\"%s\"", $Label); - } + # Make this import a link target + if (exists ($Imports{$OutName}{$Id})) { + $Label = $Imports{$OutName}{$Id}; + $Contents .= sprintf (" name=\"%s\"", $Label); + } - # If we have an export for this import, add a link to this - # export definition - if (exists ($Exports{$Id})) { - $Label = $Exports{$Id}; - $Contents .= sprintf (" href=\"%s\"", $Label); - } + # If we have an export for this import, add a link to this + # export definition + if (exists ($Exports{$Id})) { + $Label = $Exports{$Id}; + $Contents .= sprintf (" href=\"%s\"", $Label); + } - # Add the HTML stuff to the output line - if ($Contents ne "") { - $OutLine .= sprintf ("%s", $Contents, $Id); - } else { - $OutLine .= $Id; - } + # Add the HTML stuff to the output line + if ($Contents ne "") { + $OutLine .= sprintf ("%s", $Contents, $Id); + } else { + $OutLine .= $Id; + } - # Check if another identifier follows - if ($Line =~ s/^\s*(?::\s*[A-Za-z]+\s*)?,\s*//) { - $OutLine .= $&; - } else { - last; - } - } + # Check if another identifier follows + if ($Line =~ s/^\s*(?::\s*[A-Za-z]+\s*)?,\s*//) { + $OutLine .= $&; + } else { + last; + } + } - # Add an remainder if there is one - $OutLine .= Cleanup ($Line); + # Add an remainder if there is one + $OutLine .= Cleanup ($Line); - # Handle export statements - } elsif ($Line =~ s/^\.export(?:zp)?\s+//i) { + # Handle export statements + } elsif ($Line =~ s/^\.export(?:zp)?\s+//i) { - # Print the command and the whitespace. - $OutLine .= $&; + # Print the command and the whitespace. + $OutLine .= $&; - # Print all identifiers if there are any - while ($Line =~ s/^[_a-zA-Z]\w*//) { + # Print all identifiers if there are any + while ($Line =~ s/^[_a-zA-Z]\w*//) { # Remember the identifier - my $Id = $&; + my $Id = $&; - # Variable to assemble HTML representation - my $Contents = ""; + # Variable to assemble HTML representation + my $Contents = ""; - # If we have a definition for this export in this file, add - # a link to the definition. - if (exists ($Labels{$OutName}{$Id})) { - $Label = $Labels{$OutName}{$Id}; - $Contents = sprintf (" href=\"#%s\"", $Label); - } + # If we have a definition for this export in this file, add + # a link to the definition. + if (exists ($Labels{$OutName}{$Id})) { + $Label = $Labels{$OutName}{$Id}; + $Contents = sprintf (" href=\"#%s\"", $Label); + } - # If we have this identifier in the list of exports, add a - # jump target for the export. - if (exists ($Exports{$Id})) { - $Label = $Exports{$Id}; - # Be sure to use only the label part - $Label =~ s/^.*#//; - $Contents .= sprintf (" name=\"%s\"", $Label); - } + # If we have this identifier in the list of exports, add a + # jump target for the export. + if (exists ($Exports{$Id})) { + $Label = $Exports{$Id}; + # Be sure to use only the label part + $Label =~ s/^.*#//; + $Contents .= sprintf (" name=\"%s\"", $Label); + } - # Add the HTML stuff to the output line - if ($Contents ne "") { - $OutLine .= sprintf ("%s", $Contents, $Id); - } else { - $OutLine .= $Id; - } + # Add the HTML stuff to the output line + if ($Contents ne "") { + $OutLine .= sprintf ("%s", $Contents, $Id); + } else { + $OutLine .= $Id; + } - # Check if another identifier follows - if ($Line =~ s/^\s*(?::\s*[A-Za-z]+\s*)?,\s*//) { - $OutLine .= $&; - } else { - last; - } - } + # Check if another identifier follows + if ($Line =~ s/^\s*(?::\s*[A-Za-z]+\s*)?,\s*//) { + $OutLine .= $&; + } else { + last; + } + } - # Add an remainder if there is one - $OutLine .= Cleanup ($Line); + # Add an remainder if there is one + $OutLine .= Cleanup ($Line); - # Handle actor statements. - } elsif ($Line =~ s/^(\.(?:(?:(?:con|de)struc|interrup)tor|condes)\s+)([_a-z]\w*)//i) { + # Handle actor statements. + } elsif ($Line =~ s/^(\.(?:(?:(?:con|de)struc|interrup)tor|condes)\s+)([_a-z]\w*)//i) { - # Print the command and the whitespace. - $OutLine .= $1; + # Print the command and the whitespace. + $OutLine .= $1; - # Remember the identifier. - $Id = $2; + # Remember the identifier. + $Id = $2; - # Variable to assemble HTML representation - my $Contents = ""; + # Variable to assemble HTML representation + my $Contents = ""; - # If we have a definition for this actor, in this file, - # then add a link to that definition. - if (exists ($Labels{$OutName}{$Id})) { - $Contents = sprintf (" href=\"#%s\"", $Labels{$OutName}{$Id}); - } + # If we have a definition for this actor, in this file, + # then add a link to that definition. + if (exists ($Labels{$OutName}{$Id})) { + $Contents = sprintf (" href=\"#%s\"", $Labels{$OutName}{$Id}); + } - # Get the target, for linking from imports in other files. - $Label = $Exports{$Id}; - # Be sure to use only the label part. - $Label =~ s/^.*#//; + # Get the target, for linking from imports in other files. + $Label = $Exports{$Id}; + # Be sure to use only the label part. + $Label =~ s/^.*#//; - # Add the HTML stuff and the remainder of the actor - # to the output line. - $OutLine .= sprintf ("%s%s", $Label, - $Contents, $Id, Cleanup ($Line)); + # Add the HTML stuff and the remainder of the actor + # to the output line. + $OutLine .= sprintf ("%s%s", $Label, + $Contents, $Id, Cleanup ($Line)); - # Check for .faraddr, .addr, .dword, .word, .dbyt, .byt, .byte, .res, - # .elseif, .if, .align, and .org. - } elsif ($Line =~ s/^\.(?:(?:far)?addr|d?word|d?byte?|res|(?:else)?if|align|org)\s+//i) { + # Check for .faraddr, .addr, .dword, .word, .dbyt, .byt, .byte, .res, + # .elseif, .if, .align, and .org. + } elsif ($Line =~ s/^\.(?:(?:far)?addr|d?word|d?byte?|res|(?:else)?if|align|org)\s+//i) { - # Print the command and the white space - $OutLine .= $&; + # Print the command and the white space + $OutLine .= $&; - # Print all identifiers if there are any - while ($Line =~ s/^([^_a-zA-Z]*?)(([\@?]?)[_a-zA-Z]\w*)//) { + # Print all identifiers if there are any + while ($Line =~ s/^([^_a-zA-Z]*?)(([\@?]?)[_a-zA-Z]\w*)//) { # Add the non label stuff $OutLine .= Cleanup ($1); - # Use the prefix if the label is local. - # Get the reference to that label if we find it. - $OutLine .= RefLabel ($OutName, ($3 ne "") ? "$CheapPrefix$2" : $2, $2); - } + # Use the prefix if the label is local. + # Get the reference to that label if we find it. + $OutLine .= RefLabel ($OutName, ($3 ne "") ? "$CheapPrefix$2" : $2, $2); + } - # Add an remainder if there is one - $OutLine .= Cleanup ($Line); + # Add an remainder if there is one + $OutLine .= Cleanup ($Line); - # Handle .proc - } elsif ($Line =~ /^(\.proc)(\s+)([_a-z]\w*)?(.*)$/i) { + # Handle .proc + } elsif ($Line =~ /^(\.proc)(\s+)([_a-z]\w*)?(.*)$/i) { - # Do we have an identifier? - if ($3 ne "") { - # Remember the ID as the new cheap-local prefix. - $CheapPrefix = $3; + # Do we have an identifier? + if ($3 ne "") { + # Remember the ID as the new cheap-local prefix. + $CheapPrefix = $3; - # Get the label for the id - $Label = $Labels{$OutName}{$3}; + # Get the label for the id + $Label = $Labels{$OutName}{$3}; - # Print the label with a tag - $OutLine .= "$1$2$3"; + # Print the label with a tag + $OutLine .= "$1$2$3"; - } else { + } else { - # Print a line that has invalid syntax (its operand isn't - # a correctly formed name). - $OutLine .= "$1$2"; + # Print a line that has invalid syntax (its operand isn't + # a correctly formed name). + $OutLine .= "$1$2"; } # Add the remainder $OutLine .= Cleanup ($4); - # Handle .include - } elsif ($Line =~ /^(\.include)(\s*)\"((?:[^\"]+?|\\\")+)(\".*)$/i) { + # Handle .include + } elsif ($Line =~ /^(\.include)(\s*)\"((?:[^\"]+?|\\\")+)(\".*)$/i) { - # Add the fixed stuff to the output line - $OutLine .= "$1$2""; + # Add the fixed stuff to the output line + $OutLine .= "$1$2""; - # Get the filename into a named variable - my $FileName = Cleanup ($3); + # Get the filename into a named variable + my $FileName = Cleanup ($3); - # Get the name without a path - my $Name = StripPath ($3); + # Get the name without a path + my $Name = StripPath ($3); - # If the include file is among the list of our files, add a link, - # otherwise just add the name as is. - if (exists ($Files{$Name})) { - $OutLine .= sprintf ("%s", GetOutName ($Name), $FileName); - } else { - $OutLine .= $FileName; - } + # If the include file is among the list of our files, add a link, + # otherwise just add the name as is. + if (exists ($Files{$Name})) { + $OutLine .= sprintf ("%s", GetOutName ($Name), $FileName); + } else { + $OutLine .= $FileName; + } - # Add the remainder - $OutLine .= Cleanup ($4); + # Add the remainder + $OutLine .= Cleanup ($4); # Handle .dbg line } elsif ($CRefs && $Line =~ s/^\.dbg\s+//) { @@ -892,108 +892,108 @@ sub Process2 { # Add the fixed stuff to the output line $OutLine .= "$1$2""; - # Get the filename and line number into named variables - my $FileName = $3; + # Get the filename and line number into named variables + my $FileName = $3; my $LineNo = $5; - # Remember the remainder - $Line = "\"$4$5$6"; + # Remember the remainder + $Line = "\"$4$5$6"; - # Get the name without a path - my $Name = StripPath ($FileName); + # Get the name without a path + my $Name = StripPath ($FileName); - # We don't need FileName any longer as is, so clean it up - $FileName = Cleanup ($FileName); + # We don't need FileName any longer as is, so clean it up + $FileName = Cleanup ($FileName); - # Add a link to the source file - $OutLine .= sprintf ("%s", $Name, $LineNo, $FileName); + # Add a link to the source file + $OutLine .= sprintf ("%s", $Name, $LineNo, $FileName); - # Add the remainder - $OutLine .= Cleanup ($Line); + # Add the remainder + $OutLine .= Cleanup ($Line); - # Check for .ifdef, .ifndef, .ifref, and .ifnref. - } elsif ($Line =~ s/^(\.ifn?[dr]ef\s+)(([\@?]?)[_a-z]\w*)?//i) { + # Check for .ifdef, .ifndef, .ifref, and .ifnref. + } elsif ($Line =~ s/^(\.ifn?[dr]ef\s+)(([\@?]?)[_a-z]\w*)?//i) { - # Print the command and the whitespace. - $OutLine .= $1; + # Print the command and the whitespace. + $OutLine .= $1; - if ($2 ne "") { - # Use the prefix if the label is local. - # Get the reference to that label if we find it. - $OutLine .= RefLabel ($OutName, ($3 ne "") ? "$CheapPrefix$2" : $2, $2); - } + if ($2 ne "") { + # Use the prefix if the label is local. + # Get the reference to that label if we find it. + $OutLine .= RefLabel ($OutName, ($3 ne "") ? "$CheapPrefix$2" : $2, $2); + } - # Add a remainder if there is one. - $OutLine .= Cleanup ($Line); + # Add a remainder if there is one. + $OutLine .= Cleanup ($Line); - # Check for assertions. - } elsif ($Line =~ s/^(\.assert\s+)(.+?)(,\s*(?:error|warning)\s*(?:,.*)?)$/$2/i) { + # Check for assertions. + } elsif ($Line =~ s/^(\.assert\s+)(.+?)(,\s*(?:error|warning)\s*(?:,.*)?)$/$2/i) { - # Print the command and the whitespace. - $OutLine .= $1; + # Print the command and the whitespace. + $OutLine .= $1; - $Comment = $3; + $Comment = $3; - # Print all identifiers if there are any. - while ($Line =~ s/^([^_a-zA-Z]*?)(([\@?]?)[_a-zA-Z]\w*)//) { - # Add the non-label stuff. - $OutLine .= Cleanup ($1); + # Print all identifiers if there are any. + while ($Line =~ s/^([^_a-zA-Z]*?)(([\@?]?)[_a-zA-Z]\w*)//) { + # Add the non-label stuff. + $OutLine .= Cleanup ($1); - # Use the prefix if the label is local. - # Get the reference to that label if we find it. - $OutLine .= RefLabel ($OutName, ($3 ne "") ? "$CheapPrefix$2" : $2, $2); - } + # Use the prefix if the label is local. + # Get the reference to that label if we find it. + $OutLine .= RefLabel ($OutName, ($3 ne "") ? "$CheapPrefix$2" : $2, $2); + } - # Add a remainder if there is one. - $OutLine .= Cleanup ($Line . $Comment); + # Add a remainder if there is one. + $OutLine .= Cleanup ($Line . $Comment); - # Check for instructions with labels + # Check for instructions with labels } elsif ($Line =~ s/^($LabelIns)\b(\s*)//io) { - # Print the instruction and white space + # Print the instruction and white space $OutLine .= ColorizeKeyword ($1) . $2; - # Print all identifiers if there are any. - while ($Line =~ s/^([^_a-zA-Z]*?)(([\@?]?)[_a-zA-Z]\w*)//) { + # Print all identifiers if there are any. + while ($Line =~ s/^([^_a-zA-Z]*?)(([\@?]?)[_a-zA-Z]\w*)//) { - # Add the non-label stuff. - $OutLine .= Cleanup ($1); + # Add the non-label stuff. + $OutLine .= Cleanup ($1); - # Is this a local label? - if ($3 ne "") { - # Use the prefix - $Id = "$CheapPrefix$2"; - } else { - # Use as is - $Id = $2; - } + # Is this a local label? + if ($3 ne "") { + # Use the prefix + $Id = "$CheapPrefix$2"; + } else { + # Use as is + $Id = $2; + } - # Get the reference to this label if we find it - $OutLine .= RefLabel ($OutName, $Id, $2); - } + # Get the reference to this label if we find it + $OutLine .= RefLabel ($OutName, $Id, $2); + } - # Reassemble and print the line - $OutLine .= Cleanup ($Line); + # Reassemble and print the line + $OutLine .= Cleanup ($Line); - # Check for all other instructions + # Check for all other instructions } elsif ($Line =~ /^($OtherIns)\b(.*)$/io) { - # Colorize and print + # Colorize and print $OutLine .= ColorizeKeyword ($1) . Cleanup ($2); - } else { + } else { - # Nothing known - print the line - $OutLine .= Cleanup ($Line); + # Nothing known - print the line + $OutLine .= Cleanup ($Line); - } + } } continue { # Colorize all keywords - $OutLine =~ s/(?\n"; - } - printf $INDEX "%s\n", GetOutName ($File), $File; - if (($Count % $IndexCols) == $IndexCols-1) { - print $INDEX "\n"; - } - $Count++; + # + if (($Count % $IndexCols) == 0) { + print $INDEX "\n"; + } + printf $INDEX "%s\n", GetOutName ($File), $File; + if (($Count % $IndexCols) == $IndexCols-1) { + print $INDEX "\n"; + } + $Count++; } if (($Count % $IndexCols) != 0) { - print $INDEX "\n"; + print $INDEX "\n"; } print $INDEX "


\n"; } @@ -1070,29 +1070,29 @@ sub ExportIndex { my $Count = 0; for my $Export (sort (keys (%Exports))) { - # Get the export - my $File; - my $Label; - ($File, $Label) = split (/#/, $Exports{$Export}); + # Get the export + my $File; + my $Label; + ($File, $Label) = split (/#/, $Exports{$Export}); - # The label is the label of the export statement. If we can find the - # actual label, use this instead. - if (exists ($Labels{$File}{$Export})) { - $Label = $Labels{$File}{$Export}; - } + # The label is the label of the export statement. If we can find the + # actual label, use this instead. + if (exists ($Labels{$File}{$Export})) { + $Label = $Labels{$File}{$Export}; + } - # - if (($Count % $IndexCols) == 0) { - print $INDEX "\n"; - } - printf $INDEX "%s\n", $File, $Label, $Export; - if (($Count % $IndexCols) == $IndexCols-1) { - print $INDEX "\n"; - } - $Count++; + # + if (($Count % $IndexCols) == 0) { + print $INDEX "\n"; + } + printf $INDEX "%s\n", $File, $Label, $Export; + if (($Count % $IndexCols) == $IndexCols-1) { + print $INDEX "\n"; + } + $Count++; } if (($Count % $IndexCols) != 0) { - print $INDEX "\n"; + print $INDEX "\n"; } print $INDEX "


\n"; } @@ -1121,7 +1121,7 @@ sub CreateIndex { #-----------------------------------------------------------------------------# -# Print usage information # +# Print usage information # # ----------------------------------------------------------------------------# @@ -1154,34 +1154,34 @@ sub Usage { #-----------------------------------------------------------------------------# -# Main # +# Main # # ----------------------------------------------------------------------------# # Get program options -GetOptions ("bgcolor=s" => \$BGColor, +GetOptions ("bgcolor=s" => \$BGColor, "colorize" => \$Colorize, "commentcolor=s" => \$CommentColor, "crefs" => \$CRefs, "ctrlcolor=s" => \$CtrlColor, - "cvttabs" => \$CvtTabs, - "debug!" => \$Debug, - "help" => \$Help, - "htmldir=s" => \$HTMLDir, - "indexcols=i" => \$IndexCols, - "indexname=s" => \$IndexName, - "indexpage" => \$IndexPage, - "indextitle=s" => \$IndexTitle, + "cvttabs" => \$CvtTabs, + "debug!" => \$Debug, + "help" => \$Help, + "htmldir=s" => \$HTMLDir, + "indexcols=i" => \$IndexCols, + "indexname=s" => \$IndexName, + "indexpage" => \$IndexPage, + "indextitle=s" => \$IndexTitle, "keywordcolor=s" => \$KeywordColor, "linelabels" => \$LineLabels, "linenumbers" => \$LineNumbers, - "linkstyle=i" => \$LinkStyle, - "replaceext" => \$ReplaceExt, + "linkstyle=i" => \$LinkStyle, + "replaceext" => \$ReplaceExt, "tabsize=i" => \$TabSize, - "textcolor=s" => \$TextColor, - "verbose!" => \$Verbose, - "<>" => \&AddFile); + "textcolor=s" => \$TextColor, + "verbose!" => \$Verbose, + "<>" => \&AddFile); # Check some arguments if ($IndexCols <= 0 || $IndexCols >= 20) { diff --git a/src/cc65/anonname.c b/src/cc65/anonname.c index 27b498d2a..2c33b3f17 100644 --- a/src/cc65/anonname.c +++ b/src/cc65/anonname.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* anonname.c */ +/* anonname.c */ /* */ -/* Create names for anonymous variables/types */ +/* Create names for anonymous variables/types */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -56,7 +56,7 @@ static const char AnonTag[] = "$anon"; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/anonname.h b/src/cc65/anonname.h index 90c9e0af8..43292505e 100644 --- a/src/cc65/anonname.h +++ b/src/cc65/anonname.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* anonname.h */ +/* anonname.h */ /* */ -/* Create names for anonymous variables/types */ +/* Create names for anonymous variables/types */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/asmcode.c b/src/cc65/asmcode.c index c70675c01..ec0a8791e 100644 --- a/src/cc65/asmcode.c +++ b/src/cc65/asmcode.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* asmcode.c */ +/* asmcode.c */ /* */ -/* Assembler output code handling for the cc65 C compiler */ +/* Assembler output code handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -123,11 +123,11 @@ void WriteAsmOutput (void) SymTab = GetGlobalSymTab (); Entry = SymTab->SymHead; while (Entry) { - if (SymIsOutputFunc (Entry)) { + if (SymIsOutputFunc (Entry)) { /* Function which is defined and referenced or extern */ - OutputSegments (Entry->V.F.Seg); - } - Entry = Entry->NextSym; + OutputSegments (Entry->V.F.Seg); + } + Entry = Entry->NextSym; } } diff --git a/src/cc65/asmcode.h b/src/cc65/asmcode.h index b91b892d0..5d70ae381 100644 --- a/src/cc65/asmcode.h +++ b/src/cc65/asmcode.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* asmcode.h */ +/* asmcode.h */ /* */ -/* Assembler output code handling for the cc65 C compiler */ +/* Assembler output code handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -60,7 +60,7 @@ typedef struct { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/asmlabel.c b/src/cc65/asmlabel.c index fe76f2b85..46330c303 100644 --- a/src/cc65/asmlabel.c +++ b/src/cc65/asmlabel.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* asmlabel.c */ +/* asmlabel.c */ /* */ -/* Generate assembler code labels */ +/* Generate assembler code labels */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/asmlabel.h b/src/cc65/asmlabel.h index 316eb51af..44235c9d9 100644 --- a/src/cc65/asmlabel.h +++ b/src/cc65/asmlabel.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* asmlabel.h */ +/* asmlabel.h */ /* */ -/* Generate assembler code labels */ +/* Generate assembler code labels */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/asmstmt.c b/src/cc65/asmstmt.c index 3f858c679..ce2660e54 100644 --- a/src/cc65/asmstmt.c +++ b/src/cc65/asmstmt.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* asmstmt.c */ +/* asmstmt.c */ /* */ -/* Inline assembler statements for the cc65 C compiler */ +/* Inline assembler statements for the cc65 C compiler */ /* */ /* */ /* */ @@ -54,7 +54,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -90,9 +90,9 @@ static SymEntry* AsmGetSym (unsigned Arg, unsigned Type) /* Argument must be an identifier */ if (CurTok.Tok != TOK_IDENT) { - Error ("Identifier expected for argument %u", Arg); - AsmErrorSkip (); - return 0; + Error ("Identifier expected for argument %u", Arg); + AsmErrorSkip (); + return 0; } /* Get a pointer to the symbol table entry */ @@ -100,9 +100,9 @@ static SymEntry* AsmGetSym (unsigned Arg, unsigned Type) /* Did we find a symbol with this name? */ if (Sym == 0) { - Error ("Undefined symbol `%s' for argument %u", CurTok.Ident, Arg); - AsmErrorSkip (); - return 0; + Error ("Undefined symbol `%s' for argument %u", CurTok.Ident, Arg); + AsmErrorSkip (); + return 0; } /* We found the symbol - skip the name token */ @@ -110,9 +110,9 @@ static SymEntry* AsmGetSym (unsigned Arg, unsigned Type) /* Check if we have a global symbol */ if ((Sym->Flags & Type) != Type) { - Error ("Type of argument %u differs from format specifier", Arg); - AsmErrorSkip (); - return 0; + Error ("Type of argument %u differs from format specifier", Arg); + AsmErrorSkip (); + return 0; } /* Mark the symbol as referenced */ @@ -138,15 +138,15 @@ static void ParseByteArg (StrBuf* T, unsigned Arg) /* Check the range but allow negative values if the type is signed */ if (IsSignUnsigned (Expr.Type)) { - if (Expr.IVal < 0 || Expr.IVal > 0xFF) { - AsmRangeError (Arg); - Expr.IVal = 0; - } + if (Expr.IVal < 0 || Expr.IVal > 0xFF) { + AsmRangeError (Arg); + Expr.IVal = 0; + } } else { - if (Expr.IVal < -128 || Expr.IVal > 127) { - AsmRangeError (Arg); - Expr.IVal = 0; - } + if (Expr.IVal < -128 || Expr.IVal > 127) { + AsmRangeError (Arg); + Expr.IVal = 0; + } } /* Convert into a hex number */ @@ -172,15 +172,15 @@ static void ParseWordArg (StrBuf* T, unsigned Arg) /* Check the range but allow negative values if the type is signed */ if (IsSignUnsigned (Expr.Type)) { - if (Expr.IVal < 0 || Expr.IVal > 0xFFFF) { - AsmRangeError (Arg); - Expr.IVal = 0; - } + if (Expr.IVal < 0 || Expr.IVal > 0xFFFF) { + AsmRangeError (Arg); + Expr.IVal = 0; + } } else { - if (Expr.IVal < -32768 || Expr.IVal > 32767) { - AsmRangeError (Arg); - Expr.IVal = 0; - } + if (Expr.IVal < -32768 || Expr.IVal > 32767) { + AsmRangeError (Arg); + Expr.IVal = 0; + } } /* Convert into a hex number */ @@ -219,25 +219,25 @@ static void ParseGVarArg (StrBuf* T, unsigned Arg) /* Parse the symbol name parameter and check the type */ SymEntry* Sym = AsmGetSym (Arg, SC_STATIC); if (Sym == 0) { - /* Some sort of error */ - return; + /* Some sort of error */ + return; } /* Check for external linkage */ if (Sym->Flags & (SC_EXTERN | SC_STORAGE | SC_FUNC)) { - /* External linkage or a function */ - /* ### FIXME: Asm name should be generated by codegen */ - SB_AppendChar (T, '_'); - SB_AppendStr (T, Sym->Name); + /* External linkage or a function */ + /* ### FIXME: Asm name should be generated by codegen */ + SB_AppendChar (T, '_'); + SB_AppendStr (T, Sym->Name); } else if (Sym->Flags & SC_REGISTER) { char Buf[32]; xsprintf (Buf, sizeof (Buf), "regbank+%d", Sym->V.R.RegOffs); SB_AppendStr (T, Buf); } else { - /* Static variable */ - char Buf [16]; - xsprintf (Buf, sizeof (Buf), "L%04X", Sym->V.Label); - SB_AppendStr (T, Buf); + /* Static variable */ + char Buf [16]; + xsprintf (Buf, sizeof (Buf), "L%04X", Sym->V.Label); + SB_AppendStr (T, Buf); } } @@ -252,8 +252,8 @@ static void ParseLVarArg (StrBuf* T, unsigned Arg) /* Parse the symbol name parameter and check the type */ SymEntry* Sym = AsmGetSym (Arg, SC_AUTO); if (Sym == 0) { - /* Some sort of error */ - return; + /* Some sort of error */ + return; } /* The symbol may be a parameter to a variadic function. In this case, we @@ -261,9 +261,9 @@ static void ParseLVarArg (StrBuf* T, unsigned Arg) * if this is the case. */ if ((Sym->Flags & SC_PARAM) == SC_PARAM && F_IsVariadic (CurrentFunc)) { - Error ("Argument %u has no fixed stack offset", Arg); - AsmErrorSkip (); - return; + Error ("Argument %u has no fixed stack offset", Arg); + AsmErrorSkip (); + return; } /* Calculate the current offset from SP */ @@ -287,11 +287,11 @@ static void ParseLabelArg (StrBuf* T, unsigned Arg attribute ((unused))) } else { - /* Add a new label symbol if we don't have one until now */ - SymEntry* Entry = AddLabelSym (CurTok.Ident, SC_REF); + /* Add a new label symbol if we don't have one until now */ + SymEntry* Entry = AddLabelSym (CurTok.Ident, SC_REF); - /* Append the label name to the buffer */ - SB_AppendStr (T, LocalLabelName (Entry->V.Label)); + /* Append the label name to the buffer */ + SB_AppendStr (T, LocalLabelName (Entry->V.Label)); /* Eat the label name */ NextToken (); @@ -353,34 +353,34 @@ static void ParseAsm (void) /* Parse the statement. It may contain several lines and one or more * of the following place holders: - * %b - Numerical 8 bit value - * %w - Numerical 16 bit value - * %l - Numerical 32 bit value - * %v - Assembler name of a (global) variable - * %o - Stack offset of a (local) variable - * %g - Assembler name of a C label + * %b - Numerical 8 bit value + * %w - Numerical 16 bit value + * %l - Numerical 32 bit value + * %v - Assembler name of a (global) variable + * %o - Stack offset of a (local) variable + * %g - Assembler name of a C label * %s - Any argument converted to a string (almost) - * %% - The % sign + * %% - The % sign */ Arg = 0; while ((C = SB_Get (&S)) != '\0') { - /* If it is a newline, the current line is ready to go */ - if (C == '\n') { + /* If it is a newline, the current line is ready to go */ + if (C == '\n') { - /* Pass it to the backend and start over */ - g_asmcode (&T); - SB_Clear (&T); + /* Pass it to the backend and start over */ + g_asmcode (&T); + SB_Clear (&T); - } else if (C == '%') { + } else if (C == '%') { - /* Format specifier */ - ++Arg; + /* Format specifier */ + ++Arg; C = SB_Get (&S); switch (C) { case '%': SB_AppendChar (&T, '%'); break; case 'b': ParseByteArg (&T, Arg); break; - case 'g': ParseLabelArg (&T, Arg); break; + case 'g': ParseLabelArg (&T, Arg); break; case 'l': ParseLongArg (&T, Arg); break; case 'o': ParseLVarArg (&T, Arg); break; case 's': ParseStrArg (&T, Arg); break; @@ -392,17 +392,17 @@ static void ParseAsm (void) goto Done; } - } else { + } else { - /* A normal character, just copy it */ - SB_AppendChar (&T, C); + /* A normal character, just copy it */ + SB_AppendChar (&T, C); - } + } } /* If the target buffer is not empty, we have a last line in there */ if (!SB_IsEmpty (&T)) { - g_asmcode (&T); + g_asmcode (&T); } Done: @@ -430,18 +430,18 @@ void AsmStatement (void) /* String literal */ if (CurTok.Tok != TOK_SCONST) { - /* Print a diagnostic */ - Error ("String literal expected"); + /* Print a diagnostic */ + Error ("String literal expected"); - /* Try some smart error recovery: Skip tokens until we reach the - * enclosing paren, or a semicolon. - */ - AsmErrorSkip (); + /* Try some smart error recovery: Skip tokens until we reach the + * enclosing paren, or a semicolon. + */ + AsmErrorSkip (); } else { - /* Parse the ASM statement */ - ParseAsm (); + /* Parse the ASM statement */ + ParseAsm (); } /* Closing paren needed */ diff --git a/src/cc65/asmstmt.h b/src/cc65/asmstmt.h index 9de91f492..e3a6a0433 100644 --- a/src/cc65/asmstmt.h +++ b/src/cc65/asmstmt.h @@ -1,12 +1,12 @@ /*****************************************************************************/ /* */ -/* asmstmt.h */ +/* asmstmt.h */ /* */ -/* Inline assembler statements for the cc65 C compiler */ +/* Inline assembler statements for the cc65 C compiler */ /* */ /* */ /* */ -/* (C) 2001 Ullrich von Bassewitz */ +/* (C) 2001 Ullrich von Bassewitz */ /* Wacholderweg 14 */ /* D-70597 Stuttgart */ /* EMail: uz@musoftware.de */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/assignment.c b/src/cc65/assignment.c index 662128c84..81a189f36 100644 --- a/src/cc65/assignment.c +++ b/src/cc65/assignment.c @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -68,7 +68,7 @@ void Assignment (ExprDesc* Expr) /* Check for assignment to const */ if (IsQualConst (ltype)) { - Error ("Assignment to const"); + Error ("Assignment to const"); } /* Skip the '=' token */ @@ -99,12 +99,12 @@ void Assignment (ExprDesc* Expr) PushAddr (Expr); } else { ED_MakeRVal (Expr); - LoadExpr (CF_NONE, Expr); + LoadExpr (CF_NONE, Expr); g_push (CF_PTR | CF_UNSIGNED, 0); } - /* Get the expression on the right of the '=' into the primary */ - hie1 (&Expr2); + /* Get the expression on the right of the '=' into the primary */ + hie1 (&Expr2); /* Check for equality of the structs */ if (TypeCmp (ltype, Expr2.Type) < TC_STRICT_COMPATIBLE) { @@ -112,8 +112,8 @@ void Assignment (ExprDesc* Expr) } /* Check if the right hand side is an lvalue */ - if (ED_IsLVal (&Expr2)) { - /* We have an lvalue. Do we copy using the primary? */ + if (ED_IsLVal (&Expr2)) { + /* We have an lvalue. Do we copy using the primary? */ if (UseReg) { /* Just use the replacement type */ Expr2.Type = stype; @@ -193,13 +193,13 @@ void Assignment (ExprDesc* Expr) GetCodePos (&PushPos); g_push (Flags, 0); - /* Read the expression on the right side of the '=' */ - MarkedExprWithCheck (hie1, &Expr2); + /* Read the expression on the right side of the '=' */ + MarkedExprWithCheck (hie1, &Expr2); - /* Do type conversion if necessary. Beware: Do not use char type + /* Do type conversion if necessary. Beware: Do not use char type * here! */ - TypeConversion (&Expr2, ltype); + TypeConversion (&Expr2, ltype); /* Special treatment if the value is constant. */ /* Beware: Expr2 may contain side effects, so there must not be @@ -238,28 +238,28 @@ void Assignment (ExprDesc* Expr) g_or (Flags, 0); } - /* Generate a store instruction */ - Store (Expr, 0); + /* Generate a store instruction */ + Store (Expr, 0); /* Restore the expression type */ Expr->Type = ltype; } else { - /* Get the address on stack if needed */ - PushAddr (Expr); + /* Get the address on stack if needed */ + PushAddr (Expr); - /* Read the expression on the right side of the '=' */ - hie1 (&Expr2); + /* Read the expression on the right side of the '=' */ + hie1 (&Expr2); - /* Do type conversion if necessary */ - TypeConversion (&Expr2, ltype); + /* Do type conversion if necessary */ + TypeConversion (&Expr2, ltype); - /* If necessary, load the value into the primary register */ - LoadExpr (CF_NONE, &Expr2); + /* If necessary, load the value into the primary register */ + LoadExpr (CF_NONE, &Expr2); - /* Generate a store instruction */ - Store (Expr, 0); + /* Generate a store instruction */ + Store (Expr, 0); } diff --git a/src/cc65/assignment.h b/src/cc65/assignment.h index aab7c5562..6273724ca 100644 --- a/src/cc65/assignment.h +++ b/src/cc65/assignment.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/casenode.c b/src/cc65/casenode.c index 25121f5e8..0e1b37305 100644 --- a/src/cc65/casenode.c +++ b/src/cc65/casenode.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* casenode.c */ +/* casenode.c */ /* */ -/* Node for the tree that is generated for a switch statement */ +/* Node for the tree that is generated for a switch statement */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -73,7 +73,7 @@ void FreeCaseNode (CaseNode* N) /* Delete a case node plus all sub nodes */ { if (N->Nodes) { - FreeCaseNodeColl (N->Nodes); + FreeCaseNodeColl (N->Nodes); } xfree (N); } @@ -85,7 +85,7 @@ void FreeCaseNodeColl (Collection* Nodes) { unsigned I; for (I = 0; I < CollCount (Nodes); ++I) { - FreeCaseNode (CollAtUnchecked (Nodes, I)); + FreeCaseNode (CollAtUnchecked (Nodes, I)); } FreeCollection (Nodes); } @@ -106,23 +106,23 @@ int SearchCaseNode (const Collection* Nodes, unsigned char Key, int* Index) while (First <= Last) { - /* Set current to mid of range */ - int Current = (Last + First) / 2; + /* Set current to mid of range */ + int Current = (Last + First) / 2; - /* Get the entry from this position */ - const CaseNode* N = CollConstAt (Nodes, Current); + /* Get the entry from this position */ + const CaseNode* N = CollConstAt (Nodes, Current); - /* Compare the values */ - if (N->Value < Key) { - First = Current + 1; - } else { - Last = Current - 1; - if (N->Value == Key) { - /* Found. We cannot have duplicates, so end the search here. */ - S = 1; - First = Current; - } - } + /* Compare the values */ + if (N->Value < Key) { + First = Current + 1; + } else { + Last = Current - 1; + if (N->Value == Key) { + /* Found. We cannot have duplicates, so end the search here. */ + S = 1; + First = Current; + } + } } @@ -142,41 +142,41 @@ unsigned InsertCaseValue (Collection* Nodes, unsigned long Val, unsigned Depth) while (Depth--) { - int Index; + int Index; - /* Get the key */ - unsigned char Key = (Val >> (Depth * CHAR_BIT)) & 0xFF; + /* Get the key */ + unsigned char Key = (Val >> (Depth * CHAR_BIT)) & 0xFF; - /* Search for the node in the collection */ - if (SearchCaseNode (Nodes, Key, &Index) == 0) { + /* Search for the node in the collection */ + if (SearchCaseNode (Nodes, Key, &Index) == 0) { - /* Node not found - insert one */ - N = NewCaseNode (Key); - CollInsert (Nodes, N, Index); + /* Node not found - insert one */ + N = NewCaseNode (Key); + CollInsert (Nodes, N, Index); - /* If this is not the last round, create the collection for - * the subnodes, otherwise get a label for the code. - */ - if (Depth > 0) { - N->Nodes = NewCollection (); - } else { - N->Label = CaseLabel; - } + /* If this is not the last round, create the collection for + * the subnodes, otherwise get a label for the code. + */ + if (Depth > 0) { + N->Nodes = NewCollection (); + } else { + N->Label = CaseLabel; + } - } else { - /* Node found, get it */ - N = CollAt (Nodes, Index); + } else { + /* Node found, get it */ + N = CollAt (Nodes, Index); - /* If this is the last round and we found a node, we have a - * duplicate case label in a switch. - */ - if (Depth == 0) { - Error ("Duplicate case label"); - } - } + /* If this is the last round and we found a node, we have a + * duplicate case label in a switch. + */ + if (Depth == 0) { + Error ("Duplicate case label"); + } + } - /* Get the collection from the node for the next round. */ - Nodes = N->Nodes; + /* Get the collection from the node for the next round. */ + Nodes = N->Nodes; } /* Return the label of the node we found/created */ diff --git a/src/cc65/casenode.h b/src/cc65/casenode.h index 785c00552..aa1de2efa 100644 --- a/src/cc65/casenode.h +++ b/src/cc65/casenode.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* casenode.h */ +/* casenode.h */ /* */ -/* Node for the tree that is generated for a switch statement */ +/* Node for the tree that is generated for a switch statement */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -59,7 +59,7 @@ struct CaseNode { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/codeent.c b/src/cc65/codeent.c index 49a837ed9..7372af338 100644 --- a/src/cc65/codeent.c +++ b/src/cc65/codeent.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codeent.c */ +/* codeent.c */ /* */ -/* Code segment entry */ +/* Code segment entry */ /* */ /* */ /* */ @@ -54,7 +54,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -65,7 +65,7 @@ static char EmptyArg[] = ""; /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -74,7 +74,7 @@ static void FreeArg (char* Arg) /* Free a code entry argument */ { if (Arg != EmptyArg) { - xfree (Arg); + xfree (Arg); } } @@ -84,11 +84,11 @@ static char* GetArgCopy (const char* Arg) /* Create an argument copy for assignment */ { if (Arg && Arg[0] != '\0') { - /* Create a copy */ - return xstrdup (Arg); + /* Create a copy */ + return xstrdup (Arg); } else { - /* Use the empty argument string */ - return EmptyArg; + /* Use the empty argument string */ + return EmptyArg; } } @@ -105,11 +105,11 @@ static int NumArg (const char* Arg, unsigned long* Num) /* Determine the base */ int Base = 10; if (*Arg == '$') { - ++Arg; - Base = 16; + ++Arg; + Base = 16; } else if (*Arg == '%') { - ++Arg; - Base = 2; + ++Arg; + Base = 2; } /* Convert the value. strtol is not exactly what we want here, but it's @@ -120,15 +120,15 @@ static int NumArg (const char* Arg, unsigned long* Num) /* Check if the conversion was successful */ if (*End != '\0') { - /* Could not convert */ - *Num = 0; - return 0; + /* Could not convert */ + *Num = 0; + return 0; } else { - /* Conversion ok */ - *Num = Val; - return 1; + /* Conversion ok */ + *Num = Val; + return 1; } } @@ -145,73 +145,73 @@ static void SetUseChgInfo (CodeEntry* E, const OPCDesc* D) * does not change any registers, so we don't need to use the data from D. */ if ((E->Info & (OF_UBRA | OF_CALL)) != 0 && E->JumpTo == 0) { - /* A subroutine call or jump to external symbol (function exit) */ - GetFuncInfo (E->Arg, &E->Use, &E->Chg); + /* A subroutine call or jump to external symbol (function exit) */ + GetFuncInfo (E->Arg, &E->Use, &E->Chg); } else { - /* Some other instruction. Use the values from the opcode description - * plus addressing mode info. - */ - E->Use = D->Use | GetAMUseInfo (E->AM); - E->Chg = D->Chg; + /* Some other instruction. Use the values from the opcode description + * plus addressing mode info. + */ + E->Use = D->Use | GetAMUseInfo (E->AM); + E->Chg = D->Chg; - /* Check for special zero page registers used */ - switch (E->AM) { + /* Check for special zero page registers used */ + switch (E->AM) { - case AM65_ACC: - if (E->OPC == OP65_ASL || E->OPC == OP65_DEC || - E->OPC == OP65_INC || E->OPC == OP65_LSR || - E->OPC == OP65_ROL || E->OPC == OP65_ROR) { - /* A is changed by these insns */ - E->Chg |= REG_A; - } + case AM65_ACC: + if (E->OPC == OP65_ASL || E->OPC == OP65_DEC || + E->OPC == OP65_INC || E->OPC == OP65_LSR || + E->OPC == OP65_ROL || E->OPC == OP65_ROR) { + /* A is changed by these insns */ + E->Chg |= REG_A; + } break; - case AM65_ZP: - case AM65_ABS: - /* Be conservative: */ - case AM65_ZPX: - case AM65_ABSX: - case AM65_ABSY: - Info = GetZPInfo (E->Arg); - if (Info && Info->ByteUse != REG_NONE) { - if (E->OPC == OP65_ASL || E->OPC == OP65_DEC || - E->OPC == OP65_INC || E->OPC == OP65_LSR || - E->OPC == OP65_ROL || E->OPC == OP65_ROR || - E->OPC == OP65_TRB || E->OPC == OP65_TSB) { - /* The zp loc is both, input and output */ - E->Chg |= Info->ByteUse; - E->Use |= Info->ByteUse; - } else if ((E->Info & OF_STORE) != 0) { - /* Just output */ - E->Chg |= Info->ByteUse; - } else { - /* Input only */ - E->Use |= Info->ByteUse; - } - } - break; + case AM65_ZP: + case AM65_ABS: + /* Be conservative: */ + case AM65_ZPX: + case AM65_ABSX: + case AM65_ABSY: + Info = GetZPInfo (E->Arg); + if (Info && Info->ByteUse != REG_NONE) { + if (E->OPC == OP65_ASL || E->OPC == OP65_DEC || + E->OPC == OP65_INC || E->OPC == OP65_LSR || + E->OPC == OP65_ROL || E->OPC == OP65_ROR || + E->OPC == OP65_TRB || E->OPC == OP65_TSB) { + /* The zp loc is both, input and output */ + E->Chg |= Info->ByteUse; + E->Use |= Info->ByteUse; + } else if ((E->Info & OF_STORE) != 0) { + /* Just output */ + E->Chg |= Info->ByteUse; + } else { + /* Input only */ + E->Use |= Info->ByteUse; + } + } + break; - case AM65_ZPX_IND: - case AM65_ZP_INDY: - case AM65_ZP_IND: - Info = GetZPInfo (E->Arg); - if (Info && Info->ByteUse != REG_NONE) { - /* These addressing modes will never change the zp loc */ - E->Use |= Info->WordUse; - } - break; + case AM65_ZPX_IND: + case AM65_ZP_INDY: + case AM65_ZP_IND: + Info = GetZPInfo (E->Arg); + if (Info && Info->ByteUse != REG_NONE) { + /* These addressing modes will never change the zp loc */ + E->Use |= Info->WordUse; + } + break; - default: - /* Keep gcc silent */ - break; - } + default: + /* Keep gcc silent */ + break; + } } } /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -232,7 +232,7 @@ const char* MakeHexArg (unsigned Num) CodeEntry* NewCodeEntry (opc_t OPC, am_t AM, const char* Arg, - CodeLabel* JumpTo, LineInfo* LI) + CodeLabel* JumpTo, LineInfo* LI) /* Create a new code entry, initialize and return it */ { /* Get the opcode description */ @@ -256,7 +256,7 @@ CodeEntry* NewCodeEntry (opc_t OPC, am_t AM, const char* Arg, /* If we have a label given, add this entry to the label */ if (JumpTo) { - CollAppend (&JumpTo->JumpFrom, E); + CollAppend (&JumpTo->JumpFrom, E); } /* Return the initialized struct */ @@ -376,13 +376,13 @@ void CE_SetNumArg (CodeEntry* E, long Num) /* Make the new argument string */ if (E->Size == 2) { - Num &= 0xFF; - xsprintf (Buf, sizeof (Buf), "$%02X", (unsigned) Num); + Num &= 0xFF; + xsprintf (Buf, sizeof (Buf), "$%02X", (unsigned) Num); } else if (E->Size == 3) { - Num &= 0xFFFF; - xsprintf (Buf, sizeof (Buf), "$%04X", (unsigned) Num); + Num &= 0xFFFF; + xsprintf (Buf, sizeof (Buf), "$%04X", (unsigned) Num); } else { - Internal ("Invalid instruction size in CE_SetNumArg"); + Internal ("Invalid instruction size in CE_SetNumArg"); } /* Replace the argument by the new one */ @@ -482,8 +482,8 @@ void CE_FreeRegInfo (CodeEntry* E) /* Free an existing register info struct */ { if (E->RI) { - FreeRegInfo (E->RI); - E->RI = 0; + FreeRegInfo (E->RI); + E->RI = 0; } } @@ -503,339 +503,339 @@ void CE_GenRegInfo (CodeEntry* E, RegContents* InputRegs) /* If we don't have a register info struct, allocate one. */ if (E->RI == 0) { - E->RI = NewRegInfo (InputRegs); + E->RI = NewRegInfo (InputRegs); } else { - if (InputRegs) { - E->RI->In = *InputRegs; - } else { - RC_Invalidate (&E->RI->In); - } - E->RI->Out2 = E->RI->Out = E->RI->In; + if (InputRegs) { + E->RI->In = *InputRegs; + } else { + RC_Invalidate (&E->RI->In); + } + E->RI->Out2 = E->RI->Out = E->RI->In; } /* Get pointers to the register contents */ In = &E->RI->In; - Out = &E->RI->Out; + Out = &E->RI->Out; /* Handle the different instructions */ switch (E->OPC) { - case OP65_ADC: - /* We don't know the value of the carry, so the result is - * always unknown. - */ - Out->RegA = UNKNOWN_REGVAL; - break; + case OP65_ADC: + /* We don't know the value of the carry, so the result is + * always unknown. + */ + Out->RegA = UNKNOWN_REGVAL; + break; - case OP65_AND: - if (RegValIsKnown (In->RegA)) { - if (CE_IsConstImm (E)) { - Out->RegA = In->RegA & (short) E->Num; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Use & REG_ZP, In)) { - case REG_TMP1: - Out->RegA = In->RegA & In->Tmp1; - break; - case REG_PTR1_LO: - Out->RegA = In->RegA & In->Ptr1Lo; - break; - case REG_PTR1_HI: - Out->RegA = In->RegA & In->Ptr1Hi; - break; - case REG_SREG_LO: - Out->RegA = In->RegA & In->SRegLo; - break; - case REG_SREG_HI: - Out->RegA = In->RegA & In->SRegHi; - break; - default: - Out->RegA = UNKNOWN_REGVAL; - break; - } + case OP65_AND: + if (RegValIsKnown (In->RegA)) { + if (CE_IsConstImm (E)) { + Out->RegA = In->RegA & (short) E->Num; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Use & REG_ZP, In)) { + case REG_TMP1: + Out->RegA = In->RegA & In->Tmp1; + break; + case REG_PTR1_LO: + Out->RegA = In->RegA & In->Ptr1Lo; + break; + case REG_PTR1_HI: + Out->RegA = In->RegA & In->Ptr1Hi; + break; + case REG_SREG_LO: + Out->RegA = In->RegA & In->SRegLo; + break; + case REG_SREG_HI: + Out->RegA = In->RegA & In->SRegHi; + break; + default: + Out->RegA = UNKNOWN_REGVAL; + break; + } } else { - Out->RegA = UNKNOWN_REGVAL; - } - } else if (CE_IsKnownImm (E, 0)) { + Out->RegA = UNKNOWN_REGVAL; + } + } else if (CE_IsKnownImm (E, 0)) { /* A and $00 does always give zero */ Out->RegA = 0; } - break; + break; - case OP65_ASL: - if (E->AM == AM65_ACC && RegValIsKnown (In->RegA)) { - Out->RegA = (In->RegA << 1) & 0xFF; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Chg & REG_ZP, In)) { - case REG_TMP1: - Out->Tmp1 = (In->Tmp1 << 1) & 0xFF; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = (In->Ptr1Lo << 1) & 0xFF; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = (In->Ptr1Hi << 1) & 0xFF; - break; - case REG_SREG_LO: - Out->SRegLo = (In->SRegLo << 1) & 0xFF; - break; - case REG_SREG_HI: - Out->SRegHi = (In->SRegHi << 1) & 0xFF; - break; - } - } else if (E->AM == AM65_ZPX) { + case OP65_ASL: + if (E->AM == AM65_ACC && RegValIsKnown (In->RegA)) { + Out->RegA = (In->RegA << 1) & 0xFF; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Chg & REG_ZP, In)) { + case REG_TMP1: + Out->Tmp1 = (In->Tmp1 << 1) & 0xFF; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = (In->Ptr1Lo << 1) & 0xFF; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = (In->Ptr1Hi << 1) & 0xFF; + break; + case REG_SREG_LO: + Out->SRegLo = (In->SRegLo << 1) & 0xFF; + break; + case REG_SREG_HI: + Out->SRegHi = (In->SRegHi << 1) & 0xFF; + break; + } + } else if (E->AM == AM65_ZPX) { /* Invalidates all ZP registers */ RC_InvalidateZP (Out); - } - break; + } + break; - case OP65_BCC: - break; + case OP65_BCC: + break; - case OP65_BCS: - break; + case OP65_BCS: + break; - case OP65_BEQ: - break; + case OP65_BEQ: + break; - case OP65_BIT: - break; + case OP65_BIT: + break; - case OP65_BMI: - break; + case OP65_BMI: + break; - case OP65_BNE: - break; + case OP65_BNE: + break; - case OP65_BPL: - break; + case OP65_BPL: + break; - case OP65_BRA: - break; + case OP65_BRA: + break; - case OP65_BRK: - break; + case OP65_BRK: + break; - case OP65_BVC: - break; + case OP65_BVC: + break; - case OP65_BVS: - break; + case OP65_BVS: + break; - case OP65_CLC: - break; + case OP65_CLC: + break; - case OP65_CLD: - break; + case OP65_CLD: + break; - case OP65_CLI: - break; + case OP65_CLI: + break; - case OP65_CLV: - break; + case OP65_CLV: + break; - case OP65_CMP: - break; + case OP65_CMP: + break; - case OP65_CPX: - break; + case OP65_CPX: + break; - case OP65_CPY: - break; + case OP65_CPY: + break; - case OP65_DEA: - if (RegValIsKnown (In->RegA)) { - Out->RegA = (In->RegA - 1) & 0xFF; - } - break; + case OP65_DEA: + if (RegValIsKnown (In->RegA)) { + Out->RegA = (In->RegA - 1) & 0xFF; + } + break; - case OP65_DEC: - if (E->AM == AM65_ACC && RegValIsKnown (In->RegA)) { - Out->RegA = (In->RegA - 1) & 0xFF; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Chg & REG_ZP, In)) { - case REG_TMP1: - Out->Tmp1 = (In->Tmp1 - 1) & 0xFF; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = (In->Ptr1Lo - 1) & 0xFF; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = (In->Ptr1Hi - 1) & 0xFF; - break; - case REG_SREG_LO: - Out->SRegLo = (In->SRegLo - 1) & 0xFF; - break; - case REG_SREG_HI: - Out->SRegHi = (In->SRegHi - 1) & 0xFF; - break; - } - } else if (E->AM == AM65_ZPX) { + case OP65_DEC: + if (E->AM == AM65_ACC && RegValIsKnown (In->RegA)) { + Out->RegA = (In->RegA - 1) & 0xFF; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Chg & REG_ZP, In)) { + case REG_TMP1: + Out->Tmp1 = (In->Tmp1 - 1) & 0xFF; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = (In->Ptr1Lo - 1) & 0xFF; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = (In->Ptr1Hi - 1) & 0xFF; + break; + case REG_SREG_LO: + Out->SRegLo = (In->SRegLo - 1) & 0xFF; + break; + case REG_SREG_HI: + Out->SRegHi = (In->SRegHi - 1) & 0xFF; + break; + } + } else if (E->AM == AM65_ZPX) { /* Invalidates all ZP registers */ RC_InvalidateZP (Out); - } - break; + } + break; - case OP65_DEX: - if (RegValIsKnown (In->RegX)) { - Out->RegX = (In->RegX - 1) & 0xFF; - } - break; + case OP65_DEX: + if (RegValIsKnown (In->RegX)) { + Out->RegX = (In->RegX - 1) & 0xFF; + } + break; - case OP65_DEY: - if (RegValIsKnown (In->RegY)) { - Out->RegY = (In->RegY - 1) & 0xFF; - } - break; + case OP65_DEY: + if (RegValIsKnown (In->RegY)) { + Out->RegY = (In->RegY - 1) & 0xFF; + } + break; - case OP65_EOR: - if (RegValIsKnown (In->RegA)) { - if (CE_IsConstImm (E)) { - Out->RegA = In->RegA ^ (short) E->Num; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Use & REG_ZP, In)) { - case REG_TMP1: - Out->RegA = In->RegA ^ In->Tmp1; - break; - case REG_PTR1_LO: - Out->RegA = In->RegA ^ In->Ptr1Lo; - break; - case REG_PTR1_HI: - Out->RegA = In->RegA ^ In->Ptr1Hi; - break; - case REG_SREG_LO: - Out->RegA = In->RegA ^ In->SRegLo; - break; - case REG_SREG_HI: - Out->RegA = In->RegA ^ In->SRegHi; - break; - default: - Out->RegA = UNKNOWN_REGVAL; - break; - } - } else { - Out->RegA = UNKNOWN_REGVAL; - } - } - break; + case OP65_EOR: + if (RegValIsKnown (In->RegA)) { + if (CE_IsConstImm (E)) { + Out->RegA = In->RegA ^ (short) E->Num; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Use & REG_ZP, In)) { + case REG_TMP1: + Out->RegA = In->RegA ^ In->Tmp1; + break; + case REG_PTR1_LO: + Out->RegA = In->RegA ^ In->Ptr1Lo; + break; + case REG_PTR1_HI: + Out->RegA = In->RegA ^ In->Ptr1Hi; + break; + case REG_SREG_LO: + Out->RegA = In->RegA ^ In->SRegLo; + break; + case REG_SREG_HI: + Out->RegA = In->RegA ^ In->SRegHi; + break; + default: + Out->RegA = UNKNOWN_REGVAL; + break; + } + } else { + Out->RegA = UNKNOWN_REGVAL; + } + } + break; - case OP65_INA: - if (RegValIsKnown (In->RegA)) { - Out->RegA = (In->RegA + 1) & 0xFF; - } - break; + case OP65_INA: + if (RegValIsKnown (In->RegA)) { + Out->RegA = (In->RegA + 1) & 0xFF; + } + break; - case OP65_INC: - if (E->AM == AM65_ACC && RegValIsKnown (In->RegA)) { - Out->RegA = (In->RegA + 1) & 0xFF; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Chg & REG_ZP, In)) { - case REG_TMP1: - Out->Tmp1 = (In->Tmp1 + 1) & 0xFF; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = (In->Ptr1Lo + 1) & 0xFF; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = (In->Ptr1Hi + 1) & 0xFF; - break; - case REG_SREG_LO: - Out->SRegLo = (In->SRegLo + 1) & 0xFF; - break; - case REG_SREG_HI: - Out->SRegHi = (In->SRegHi + 1) & 0xFF; - break; - } - } else if (E->AM == AM65_ZPX) { + case OP65_INC: + if (E->AM == AM65_ACC && RegValIsKnown (In->RegA)) { + Out->RegA = (In->RegA + 1) & 0xFF; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Chg & REG_ZP, In)) { + case REG_TMP1: + Out->Tmp1 = (In->Tmp1 + 1) & 0xFF; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = (In->Ptr1Lo + 1) & 0xFF; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = (In->Ptr1Hi + 1) & 0xFF; + break; + case REG_SREG_LO: + Out->SRegLo = (In->SRegLo + 1) & 0xFF; + break; + case REG_SREG_HI: + Out->SRegHi = (In->SRegHi + 1) & 0xFF; + break; + } + } else if (E->AM == AM65_ZPX) { /* Invalidates all ZP registers */ RC_InvalidateZP (Out); - } - break; + } + break; - case OP65_INX: - if (RegValIsKnown (In->RegX)) { - Out->RegX = (In->RegX + 1) & 0xFF; - } - break; + case OP65_INX: + if (RegValIsKnown (In->RegX)) { + Out->RegX = (In->RegX + 1) & 0xFF; + } + break; - case OP65_INY: - if (RegValIsKnown (In->RegY)) { - Out->RegY = (In->RegY + 1) & 0xFF; - } - break; + case OP65_INY: + if (RegValIsKnown (In->RegY)) { + Out->RegY = (In->RegY + 1) & 0xFF; + } + break; - case OP65_JCC: - break; + case OP65_JCC: + break; - case OP65_JCS: - break; + case OP65_JCS: + break; - case OP65_JEQ: - break; + case OP65_JEQ: + break; - case OP65_JMI: - break; + case OP65_JMI: + break; - case OP65_JMP: - break; + case OP65_JMP: + break; - case OP65_JNE: - break; + case OP65_JNE: + break; - case OP65_JPL: - break; + case OP65_JPL: + break; - case OP65_JSR: - /* Get the code info for the function */ - GetFuncInfo (E->Arg, &Use, &Chg); - if (Chg & REG_A) { - Out->RegA = UNKNOWN_REGVAL; - } - if (Chg & REG_X) { - Out->RegX = UNKNOWN_REGVAL; - } - if (Chg & REG_Y) { - Out->RegY = UNKNOWN_REGVAL; - } - if (Chg & REG_TMP1) { - Out->Tmp1 = UNKNOWN_REGVAL; - } + case OP65_JSR: + /* Get the code info for the function */ + GetFuncInfo (E->Arg, &Use, &Chg); + if (Chg & REG_A) { + Out->RegA = UNKNOWN_REGVAL; + } + if (Chg & REG_X) { + Out->RegX = UNKNOWN_REGVAL; + } + if (Chg & REG_Y) { + Out->RegY = UNKNOWN_REGVAL; + } + if (Chg & REG_TMP1) { + Out->Tmp1 = UNKNOWN_REGVAL; + } if (Chg & REG_PTR1_LO) { - Out->Ptr1Lo = UNKNOWN_REGVAL; - } - if (Chg & REG_PTR1_HI) { - Out->Ptr1Hi = UNKNOWN_REGVAL; - } + Out->Ptr1Lo = UNKNOWN_REGVAL; + } + if (Chg & REG_PTR1_HI) { + Out->Ptr1Hi = UNKNOWN_REGVAL; + } if (Chg & REG_SREG_LO) { - Out->SRegLo = UNKNOWN_REGVAL; - } - if (Chg & REG_SREG_HI) { - Out->SRegHi = UNKNOWN_REGVAL; - } - /* ## FIXME: Quick hack for some known functions: */ - if (strcmp (E->Arg, "complax") == 0) { - if (RegValIsKnown (In->RegA)) { - Out->RegA = (In->RegA ^ 0xFF); - } - if (RegValIsKnown (In->RegX)) { - Out->RegX = (In->RegX ^ 0xFF); - } - } else if (strcmp (E->Arg, "tosandax") == 0) { - if (In->RegA == 0) { - Out->RegA = 0; - } - if (In->RegX == 0) { - Out->RegX = 0; - } + Out->SRegLo = UNKNOWN_REGVAL; + } + if (Chg & REG_SREG_HI) { + Out->SRegHi = UNKNOWN_REGVAL; + } + /* ## FIXME: Quick hack for some known functions: */ + if (strcmp (E->Arg, "complax") == 0) { + if (RegValIsKnown (In->RegA)) { + Out->RegA = (In->RegA ^ 0xFF); + } + if (RegValIsKnown (In->RegX)) { + Out->RegX = (In->RegX ^ 0xFF); + } + } else if (strcmp (E->Arg, "tosandax") == 0) { + if (In->RegA == 0) { + Out->RegA = 0; + } + if (In->RegX == 0) { + Out->RegX = 0; + } } else if (strcmp (E->Arg, "tosaslax") == 0) { if (RegValIsKnown (In->RegA) && (In->RegA & 0x0F) >= 8) { printf ("Hey!\n"); Out->RegA = 0; } - } else if (strcmp (E->Arg, "tosorax") == 0) { - if (In->RegA == 0xFF) { - Out->RegA = 0xFF; - } - if (In->RegX == 0xFF) { + } else if (strcmp (E->Arg, "tosorax") == 0) { + if (In->RegA == 0xFF) { + Out->RegA = 0xFF; + } + if (In->RegX == 0xFF) { Out->RegX = 0xFF; } } else if (strcmp (E->Arg, "tosshlax") == 0) { @@ -847,487 +847,487 @@ void CE_GenRegInfo (CodeEntry* E, RegContents* InputRegs) /* Result is boolean value, so X is zero on output */ Out->RegX = 0; } - break; + break; - case OP65_JVC: - break; + case OP65_JVC: + break; - case OP65_JVS: - break; + case OP65_JVS: + break; - case OP65_LDA: - if (CE_IsConstImm (E)) { - Out->RegA = (unsigned char) E->Num; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Use & REG_ZP, In)) { - case REG_TMP1: - Out->RegA = In->Tmp1; - break; - case REG_PTR1_LO: - Out->RegA = In->Ptr1Lo; - break; - case REG_PTR1_HI: - Out->RegA = In->Ptr1Hi; - break; - case REG_SREG_LO: - Out->RegA = In->SRegLo; - break; - case REG_SREG_HI: - Out->RegA = In->SRegHi; - break; - default: - Out->RegA = UNKNOWN_REGVAL; - break; - } - } else { - /* A is now unknown */ - Out->RegA = UNKNOWN_REGVAL; - } - break; + case OP65_LDA: + if (CE_IsConstImm (E)) { + Out->RegA = (unsigned char) E->Num; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Use & REG_ZP, In)) { + case REG_TMP1: + Out->RegA = In->Tmp1; + break; + case REG_PTR1_LO: + Out->RegA = In->Ptr1Lo; + break; + case REG_PTR1_HI: + Out->RegA = In->Ptr1Hi; + break; + case REG_SREG_LO: + Out->RegA = In->SRegLo; + break; + case REG_SREG_HI: + Out->RegA = In->SRegHi; + break; + default: + Out->RegA = UNKNOWN_REGVAL; + break; + } + } else { + /* A is now unknown */ + Out->RegA = UNKNOWN_REGVAL; + } + break; - case OP65_LDX: - if (CE_IsConstImm (E)) { - Out->RegX = (unsigned char) E->Num; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Use & REG_ZP, In)) { - case REG_TMP1: - Out->RegX = In->Tmp1; - break; - case REG_PTR1_LO: - Out->RegX = In->Ptr1Lo; - break; - case REG_PTR1_HI: - Out->RegX = In->Ptr1Hi; - break; - case REG_SREG_LO: - Out->RegX = In->SRegLo; - break; - case REG_SREG_HI: - Out->RegX = In->SRegHi; - break; - default: - Out->RegX = UNKNOWN_REGVAL; - break; - } - } else { - /* X is now unknown */ - Out->RegX = UNKNOWN_REGVAL; - } - break; + case OP65_LDX: + if (CE_IsConstImm (E)) { + Out->RegX = (unsigned char) E->Num; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Use & REG_ZP, In)) { + case REG_TMP1: + Out->RegX = In->Tmp1; + break; + case REG_PTR1_LO: + Out->RegX = In->Ptr1Lo; + break; + case REG_PTR1_HI: + Out->RegX = In->Ptr1Hi; + break; + case REG_SREG_LO: + Out->RegX = In->SRegLo; + break; + case REG_SREG_HI: + Out->RegX = In->SRegHi; + break; + default: + Out->RegX = UNKNOWN_REGVAL; + break; + } + } else { + /* X is now unknown */ + Out->RegX = UNKNOWN_REGVAL; + } + break; - case OP65_LDY: - if (CE_IsConstImm (E)) { - Out->RegY = (unsigned char) E->Num; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Use & REG_ZP, In)) { - case REG_TMP1: - Out->RegY = In->Tmp1; - break; - case REG_PTR1_LO: - Out->RegY = In->Ptr1Lo; - break; - case REG_PTR1_HI: - Out->RegY = In->Ptr1Hi; - break; - case REG_SREG_LO: - Out->RegY = In->SRegLo; - break; - case REG_SREG_HI: - Out->RegY = In->SRegHi; - break; - default: - Out->RegY = UNKNOWN_REGVAL; - break; - } - } else { - /* Y is now unknown */ - Out->RegY = UNKNOWN_REGVAL; - } - break; + case OP65_LDY: + if (CE_IsConstImm (E)) { + Out->RegY = (unsigned char) E->Num; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Use & REG_ZP, In)) { + case REG_TMP1: + Out->RegY = In->Tmp1; + break; + case REG_PTR1_LO: + Out->RegY = In->Ptr1Lo; + break; + case REG_PTR1_HI: + Out->RegY = In->Ptr1Hi; + break; + case REG_SREG_LO: + Out->RegY = In->SRegLo; + break; + case REG_SREG_HI: + Out->RegY = In->SRegHi; + break; + default: + Out->RegY = UNKNOWN_REGVAL; + break; + } + } else { + /* Y is now unknown */ + Out->RegY = UNKNOWN_REGVAL; + } + break; - case OP65_LSR: - if (E->AM == AM65_ACC && RegValIsKnown (In->RegA)) { - Out->RegA = (In->RegA >> 1) & 0xFF; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Chg & REG_ZP, In)) { - case REG_TMP1: - Out->Tmp1 = (In->Tmp1 >> 1) & 0xFF; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = (In->Ptr1Lo >> 1) & 0xFF; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = (In->Ptr1Hi >> 1) & 0xFF; - break; - case REG_SREG_LO: - Out->SRegLo = (In->SRegLo >> 1) & 0xFF; - break; - case REG_SREG_HI: - Out->SRegHi = (In->SRegHi >> 1) & 0xFF; - break; - } - } else if (E->AM == AM65_ZPX) { + case OP65_LSR: + if (E->AM == AM65_ACC && RegValIsKnown (In->RegA)) { + Out->RegA = (In->RegA >> 1) & 0xFF; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Chg & REG_ZP, In)) { + case REG_TMP1: + Out->Tmp1 = (In->Tmp1 >> 1) & 0xFF; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = (In->Ptr1Lo >> 1) & 0xFF; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = (In->Ptr1Hi >> 1) & 0xFF; + break; + case REG_SREG_LO: + Out->SRegLo = (In->SRegLo >> 1) & 0xFF; + break; + case REG_SREG_HI: + Out->SRegHi = (In->SRegHi >> 1) & 0xFF; + break; + } + } else if (E->AM == AM65_ZPX) { /* Invalidates all ZP registers */ RC_InvalidateZP (Out); - } - break; + } + break; - case OP65_NOP: - break; + case OP65_NOP: + break; - case OP65_ORA: - if (RegValIsKnown (In->RegA)) { - if (CE_IsConstImm (E)) { - Out->RegA = In->RegA | (short) E->Num; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Use & REG_ZP, In)) { - case REG_TMP1: - Out->RegA = In->RegA | In->Tmp1; - break; - case REG_PTR1_LO: - Out->RegA = In->RegA | In->Ptr1Lo; - break; - case REG_PTR1_HI: - Out->RegA = In->RegA | In->Ptr1Hi; - break; - case REG_SREG_LO: - Out->RegA = In->RegA | In->SRegLo; - break; - case REG_SREG_HI: - Out->RegA = In->RegA | In->SRegHi; - break; - default: - Out->RegA = UNKNOWN_REGVAL; - break; - } - } else { - /* A is now unknown */ - Out->RegA = UNKNOWN_REGVAL; - } - } else if (CE_IsKnownImm (E, 0xFF)) { + case OP65_ORA: + if (RegValIsKnown (In->RegA)) { + if (CE_IsConstImm (E)) { + Out->RegA = In->RegA | (short) E->Num; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Use & REG_ZP, In)) { + case REG_TMP1: + Out->RegA = In->RegA | In->Tmp1; + break; + case REG_PTR1_LO: + Out->RegA = In->RegA | In->Ptr1Lo; + break; + case REG_PTR1_HI: + Out->RegA = In->RegA | In->Ptr1Hi; + break; + case REG_SREG_LO: + Out->RegA = In->RegA | In->SRegLo; + break; + case REG_SREG_HI: + Out->RegA = In->RegA | In->SRegHi; + break; + default: + Out->RegA = UNKNOWN_REGVAL; + break; + } + } else { + /* A is now unknown */ + Out->RegA = UNKNOWN_REGVAL; + } + } else if (CE_IsKnownImm (E, 0xFF)) { /* ORA with 0xFF does always give 0xFF */ Out->RegA = 0xFF; } - break; + break; - case OP65_PHA: - break; + case OP65_PHA: + break; - case OP65_PHP: - break; + case OP65_PHP: + break; - case OP65_PHX: - break; + case OP65_PHX: + break; - case OP65_PHY: - break; + case OP65_PHY: + break; - case OP65_PLA: - Out->RegA = UNKNOWN_REGVAL; - break; + case OP65_PLA: + Out->RegA = UNKNOWN_REGVAL; + break; - case OP65_PLP: - break; + case OP65_PLP: + break; - case OP65_PLX: - Out->RegX = UNKNOWN_REGVAL; - break; + case OP65_PLX: + Out->RegX = UNKNOWN_REGVAL; + break; - case OP65_PLY: - Out->RegY = UNKNOWN_REGVAL; - break; + case OP65_PLY: + Out->RegY = UNKNOWN_REGVAL; + break; - case OP65_ROL: - /* We don't know the value of the carry bit */ - if (E->AM == AM65_ACC) { - Out->RegA = UNKNOWN_REGVAL; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Chg & REG_ZP, In)) { - case REG_TMP1: - Out->Tmp1 = UNKNOWN_REGVAL; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = UNKNOWN_REGVAL; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = UNKNOWN_REGVAL; - break; - case REG_SREG_LO: - Out->SRegLo = UNKNOWN_REGVAL; - break; - case REG_SREG_HI: - Out->SRegHi = UNKNOWN_REGVAL; - break; - } - } else if (E->AM == AM65_ZPX) { - /* Invalidates all ZP registers */ - RC_InvalidateZP (Out); - } - break; - - case OP65_ROR: - /* We don't know the value of the carry bit */ - if (E->AM == AM65_ACC) { - Out->RegA = UNKNOWN_REGVAL; - } else if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Chg & REG_ZP, In)) { - case REG_TMP1: - Out->Tmp1 = UNKNOWN_REGVAL; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = UNKNOWN_REGVAL; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = UNKNOWN_REGVAL; - break; - case REG_SREG_LO: - Out->SRegLo = UNKNOWN_REGVAL; - break; - case REG_SREG_HI: - Out->SRegHi = UNKNOWN_REGVAL; - break; - } - } else if (E->AM == AM65_ZPX) { - /* Invalidates all ZP registers */ - RC_InvalidateZP (Out); - } - break; - - case OP65_RTI: - break; - - case OP65_RTS: - break; - - case OP65_SBC: - /* We don't know the value of the carry bit */ - Out->RegA = UNKNOWN_REGVAL; - break; - - case OP65_SEC: - break; - - case OP65_SED: - break; - - case OP65_SEI: - break; - - case OP65_STA: - if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Chg & REG_ZP, 0)) { - case REG_TMP1: - Out->Tmp1 = In->RegA; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = In->RegA; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = In->RegA; - break; - case REG_SREG_LO: - Out->SRegLo = In->RegA; - break; - case REG_SREG_HI: - Out->SRegHi = In->RegA; - break; - } - } else if (E->AM == AM65_ZPX) { - /* Invalidates all ZP registers */ - RC_InvalidateZP (Out); - } - break; - - case OP65_STX: - if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Chg & REG_ZP, 0)) { - case REG_TMP1: - Out->Tmp1 = In->RegX; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = In->RegX; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = In->RegX; - break; - case REG_SREG_LO: - Out->SRegLo = In->RegX; - break; - case REG_SREG_HI: - Out->SRegHi = In->RegX; - break; - } - } else if (E->AM == AM65_ZPX) { - /* Invalidates all ZP registers */ - RC_InvalidateZP (Out); - } - break; - - case OP65_STY: - if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Chg & REG_ZP, 0)) { - case REG_TMP1: - Out->Tmp1 = In->RegY; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = In->RegY; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = In->RegY; - break; - case REG_SREG_LO: - Out->SRegLo = In->RegY; - break; - case REG_SREG_HI: - Out->SRegHi = In->RegY; - break; - } - } else if (E->AM == AM65_ZPX) { + case OP65_ROL: + /* We don't know the value of the carry bit */ + if (E->AM == AM65_ACC) { + Out->RegA = UNKNOWN_REGVAL; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Chg & REG_ZP, In)) { + case REG_TMP1: + Out->Tmp1 = UNKNOWN_REGVAL; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = UNKNOWN_REGVAL; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = UNKNOWN_REGVAL; + break; + case REG_SREG_LO: + Out->SRegLo = UNKNOWN_REGVAL; + break; + case REG_SREG_HI: + Out->SRegHi = UNKNOWN_REGVAL; + break; + } + } else if (E->AM == AM65_ZPX) { /* Invalidates all ZP registers */ RC_InvalidateZP (Out); } - break; + break; - case OP65_STZ: - if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Chg & REG_ZP, 0)) { - case REG_TMP1: - Out->Tmp1 = 0; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = 0; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = 0; - break; - case REG_SREG_LO: - Out->SRegLo = 0; - break; - case REG_SREG_HI: - Out->SRegHi = 0; - break; - } - } else if (E->AM == AM65_ZPX) { + case OP65_ROR: + /* We don't know the value of the carry bit */ + if (E->AM == AM65_ACC) { + Out->RegA = UNKNOWN_REGVAL; + } else if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Chg & REG_ZP, In)) { + case REG_TMP1: + Out->Tmp1 = UNKNOWN_REGVAL; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = UNKNOWN_REGVAL; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = UNKNOWN_REGVAL; + break; + case REG_SREG_LO: + Out->SRegLo = UNKNOWN_REGVAL; + break; + case REG_SREG_HI: + Out->SRegHi = UNKNOWN_REGVAL; + break; + } + } else if (E->AM == AM65_ZPX) { /* Invalidates all ZP registers */ RC_InvalidateZP (Out); } - break; + break; - case OP65_TAX: - Out->RegX = In->RegA; - break; + case OP65_RTI: + break; - case OP65_TAY: - Out->RegY = In->RegA; - break; + case OP65_RTS: + break; - case OP65_TRB: - if (E->AM == AM65_ZPX) { - /* Invalidates all ZP registers */ - RC_InvalidateZP (Out); - } else if (E->AM == AM65_ZP) { - if (RegValIsKnown (In->RegA)) { - switch (GetKnownReg (E->Chg & REG_ZP, In)) { - case REG_TMP1: - Out->Tmp1 &= ~In->RegA; - break; - case REG_PTR1_LO: - Out->Ptr1Lo &= ~In->RegA; - break; - case REG_PTR1_HI: - Out->Ptr1Hi &= ~In->RegA; - break; - case REG_SREG_LO: - Out->SRegLo &= ~In->RegA; - break; - case REG_SREG_HI: - Out->SRegHi &= ~In->RegA; - break; - } - } else { - switch (GetKnownReg (E->Chg & REG_ZP, In)) { - case REG_TMP1: - Out->Tmp1 = UNKNOWN_REGVAL; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = UNKNOWN_REGVAL; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = UNKNOWN_REGVAL; - break; - case REG_SREG_LO: - Out->SRegLo = UNKNOWN_REGVAL; - break; - case REG_SREG_HI: - Out->SRegHi = UNKNOWN_REGVAL; - break; - } - } - } - break; + case OP65_SBC: + /* We don't know the value of the carry bit */ + Out->RegA = UNKNOWN_REGVAL; + break; - case OP65_TSB: - if (E->AM == AM65_ZPX) { - /* Invalidates all ZP registers */ - RC_InvalidateZP (Out); - } else if (E->AM == AM65_ZP) { - if (RegValIsKnown (In->RegA)) { - switch (GetKnownReg (E->Chg & REG_ZP, In)) { - case REG_TMP1: - Out->Tmp1 |= In->RegA; - break; - case REG_PTR1_LO: - Out->Ptr1Lo |= In->RegA; - break; - case REG_PTR1_HI: - Out->Ptr1Hi |= In->RegA; - break; - case REG_SREG_LO: - Out->SRegLo |= In->RegA; - break; - case REG_SREG_HI: - Out->SRegHi |= In->RegA; - break; - } - } else { - switch (GetKnownReg (E->Chg & REG_ZP, In)) { - case REG_TMP1: - Out->Tmp1 = UNKNOWN_REGVAL; - break; - case REG_PTR1_LO: - Out->Ptr1Lo = UNKNOWN_REGVAL; - break; - case REG_PTR1_HI: - Out->Ptr1Hi = UNKNOWN_REGVAL; - break; - case REG_SREG_LO: - Out->SRegLo = UNKNOWN_REGVAL; - break; - case REG_SREG_HI: - Out->SRegHi = UNKNOWN_REGVAL; - break; - } - } - } - break; + case OP65_SEC: + break; - case OP65_TSX: - Out->RegX = UNKNOWN_REGVAL; - break; + case OP65_SED: + break; - case OP65_TXA: - Out->RegA = In->RegX; - break; + case OP65_SEI: + break; - case OP65_TXS: - break; + case OP65_STA: + if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Chg & REG_ZP, 0)) { + case REG_TMP1: + Out->Tmp1 = In->RegA; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = In->RegA; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = In->RegA; + break; + case REG_SREG_LO: + Out->SRegLo = In->RegA; + break; + case REG_SREG_HI: + Out->SRegHi = In->RegA; + break; + } + } else if (E->AM == AM65_ZPX) { + /* Invalidates all ZP registers */ + RC_InvalidateZP (Out); + } + break; - case OP65_TYA: - Out->RegA = In->RegY; - break; + case OP65_STX: + if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Chg & REG_ZP, 0)) { + case REG_TMP1: + Out->Tmp1 = In->RegX; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = In->RegX; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = In->RegX; + break; + case REG_SREG_LO: + Out->SRegLo = In->RegX; + break; + case REG_SREG_HI: + Out->SRegHi = In->RegX; + break; + } + } else if (E->AM == AM65_ZPX) { + /* Invalidates all ZP registers */ + RC_InvalidateZP (Out); + } + break; - default: - break; + case OP65_STY: + if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Chg & REG_ZP, 0)) { + case REG_TMP1: + Out->Tmp1 = In->RegY; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = In->RegY; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = In->RegY; + break; + case REG_SREG_LO: + Out->SRegLo = In->RegY; + break; + case REG_SREG_HI: + Out->SRegHi = In->RegY; + break; + } + } else if (E->AM == AM65_ZPX) { + /* Invalidates all ZP registers */ + RC_InvalidateZP (Out); + } + break; + + case OP65_STZ: + if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Chg & REG_ZP, 0)) { + case REG_TMP1: + Out->Tmp1 = 0; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = 0; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = 0; + break; + case REG_SREG_LO: + Out->SRegLo = 0; + break; + case REG_SREG_HI: + Out->SRegHi = 0; + break; + } + } else if (E->AM == AM65_ZPX) { + /* Invalidates all ZP registers */ + RC_InvalidateZP (Out); + } + break; + + case OP65_TAX: + Out->RegX = In->RegA; + break; + + case OP65_TAY: + Out->RegY = In->RegA; + break; + + case OP65_TRB: + if (E->AM == AM65_ZPX) { + /* Invalidates all ZP registers */ + RC_InvalidateZP (Out); + } else if (E->AM == AM65_ZP) { + if (RegValIsKnown (In->RegA)) { + switch (GetKnownReg (E->Chg & REG_ZP, In)) { + case REG_TMP1: + Out->Tmp1 &= ~In->RegA; + break; + case REG_PTR1_LO: + Out->Ptr1Lo &= ~In->RegA; + break; + case REG_PTR1_HI: + Out->Ptr1Hi &= ~In->RegA; + break; + case REG_SREG_LO: + Out->SRegLo &= ~In->RegA; + break; + case REG_SREG_HI: + Out->SRegHi &= ~In->RegA; + break; + } + } else { + switch (GetKnownReg (E->Chg & REG_ZP, In)) { + case REG_TMP1: + Out->Tmp1 = UNKNOWN_REGVAL; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = UNKNOWN_REGVAL; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = UNKNOWN_REGVAL; + break; + case REG_SREG_LO: + Out->SRegLo = UNKNOWN_REGVAL; + break; + case REG_SREG_HI: + Out->SRegHi = UNKNOWN_REGVAL; + break; + } + } + } + break; + + case OP65_TSB: + if (E->AM == AM65_ZPX) { + /* Invalidates all ZP registers */ + RC_InvalidateZP (Out); + } else if (E->AM == AM65_ZP) { + if (RegValIsKnown (In->RegA)) { + switch (GetKnownReg (E->Chg & REG_ZP, In)) { + case REG_TMP1: + Out->Tmp1 |= In->RegA; + break; + case REG_PTR1_LO: + Out->Ptr1Lo |= In->RegA; + break; + case REG_PTR1_HI: + Out->Ptr1Hi |= In->RegA; + break; + case REG_SREG_LO: + Out->SRegLo |= In->RegA; + break; + case REG_SREG_HI: + Out->SRegHi |= In->RegA; + break; + } + } else { + switch (GetKnownReg (E->Chg & REG_ZP, In)) { + case REG_TMP1: + Out->Tmp1 = UNKNOWN_REGVAL; + break; + case REG_PTR1_LO: + Out->Ptr1Lo = UNKNOWN_REGVAL; + break; + case REG_PTR1_HI: + Out->Ptr1Hi = UNKNOWN_REGVAL; + break; + case REG_SREG_LO: + Out->SRegLo = UNKNOWN_REGVAL; + break; + case REG_SREG_HI: + Out->SRegHi = UNKNOWN_REGVAL; + break; + } + } + } + break; + + case OP65_TSX: + Out->RegX = UNKNOWN_REGVAL; + break; + + case OP65_TXA: + Out->RegA = In->RegX; + break; + + case OP65_TXS: + break; + + case OP65_TYA: + Out->RegA = In->RegY; + break; + + default: + break; } } @@ -1396,7 +1396,7 @@ void CE_Output (const CodeEntry* E) unsigned LabelCount = CollCount (&E->Labels); unsigned I; for (I = 0; I < LabelCount; ++I) { - CL_Output (CollConstAt (&E->Labels, I)); + CL_Output (CollConstAt (&E->Labels, I)); } /* Get the opcode description */ @@ -1411,72 +1411,72 @@ void CE_Output (const CodeEntry* E) /* Print the operand */ switch (E->AM) { - case AM65_IMP: - /* implicit */ - break; + case AM65_IMP: + /* implicit */ + break; - case AM65_ACC: - /* accumulator */ - Chars += WriteOutput ("%*sa", Space, ""); - break; + case AM65_ACC: + /* accumulator */ + Chars += WriteOutput ("%*sa", Space, ""); + break; - case AM65_IMM: - /* immidiate */ - Chars += WriteOutput ("%*s#%s", Space, "", E->Arg); - break; + case AM65_IMM: + /* immidiate */ + Chars += WriteOutput ("%*s#%s", Space, "", E->Arg); + break; - case AM65_ZP: - case AM65_ABS: - /* zeropage and absolute */ - Chars += WriteOutput ("%*s%s", Space, "", E->Arg); - break; + case AM65_ZP: + case AM65_ABS: + /* zeropage and absolute */ + Chars += WriteOutput ("%*s%s", Space, "", E->Arg); + break; - case AM65_ZPX: - case AM65_ABSX: - /* zeropage,X and absolute,X */ - Chars += WriteOutput ("%*s%s,x", Space, "", E->Arg); - break; + case AM65_ZPX: + case AM65_ABSX: + /* zeropage,X and absolute,X */ + Chars += WriteOutput ("%*s%s,x", Space, "", E->Arg); + break; - case AM65_ABSY: - /* absolute,Y */ - Chars += WriteOutput ("%*s%s,y", Space, "", E->Arg); - break; + case AM65_ABSY: + /* absolute,Y */ + Chars += WriteOutput ("%*s%s,y", Space, "", E->Arg); + break; - case AM65_ZPX_IND: - /* (zeropage,x) */ - Chars += WriteOutput ("%*s(%s,x)", Space, "", E->Arg); - break; + case AM65_ZPX_IND: + /* (zeropage,x) */ + Chars += WriteOutput ("%*s(%s,x)", Space, "", E->Arg); + break; - case AM65_ZP_INDY: - /* (zeropage),y */ - Chars += WriteOutput ("%*s(%s),y", Space, "", E->Arg); - break; + case AM65_ZP_INDY: + /* (zeropage),y */ + Chars += WriteOutput ("%*s(%s),y", Space, "", E->Arg); + break; - case AM65_ZP_IND: - /* (zeropage) */ - Chars += WriteOutput ("%*s(%s)", Space, "", E->Arg); - break; + case AM65_ZP_IND: + /* (zeropage) */ + Chars += WriteOutput ("%*s(%s)", Space, "", E->Arg); + break; - case AM65_BRA: - /* branch */ - Target = E->JumpTo? E->JumpTo->Name : E->Arg; - Chars += WriteOutput ("%*s%s", Space, "", Target); - break; + case AM65_BRA: + /* branch */ + Target = E->JumpTo? E->JumpTo->Name : E->Arg; + Chars += WriteOutput ("%*s%s", Space, "", Target); + break; - default: - Internal ("Invalid addressing mode"); + default: + Internal ("Invalid addressing mode"); } /* Print usage info if requested by the debugging flag */ if (Debug) { - char Use [128]; - char Chg [128]; - WriteOutput ("%*s; USE: %-12s CHG: %-12s SIZE: %u", - (int)(30-Chars), "", - RegInfoDesc (E->Use, Use), - RegInfoDesc (E->Chg, Chg), - E->Size); + char Use [128]; + char Chg [128]; + WriteOutput ("%*s; USE: %-12s CHG: %-12s SIZE: %u", + (int)(30-Chars), "", + RegInfoDesc (E->Use, Use), + RegInfoDesc (E->Chg, Chg), + E->Size); if (E->RI) { char RegIn[32]; diff --git a/src/cc65/codeent.h b/src/cc65/codeent.h index 303adc7fc..634034c6b 100644 --- a/src/cc65/codeent.h +++ b/src/cc65/codeent.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codeent.h */ +/* codeent.h */ /* */ -/* Code segment entry */ +/* Code segment entry */ /* */ /* */ /* */ @@ -53,29 +53,29 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Flags used */ -#define CEF_USERMARK 0x0001U /* Generic mark by user functions */ -#define CEF_NUMARG 0x0002U /* Insn has numerical argument */ +#define CEF_USERMARK 0x0001U /* Generic mark by user functions */ +#define CEF_NUMARG 0x0002U /* Insn has numerical argument */ /* Code entry structure */ typedef struct CodeEntry CodeEntry; struct CodeEntry { - unsigned char OPC; /* Opcode */ - unsigned char AM; /* Adressing mode */ - unsigned char Size; /* Estimated size */ - unsigned char Flags; /* Flags */ - char* Arg; /* Argument as string */ - unsigned long Num; /* Numeric argument */ - unsigned short Info; /* Additional code info */ - unsigned short Use; /* Registers used */ - unsigned short Chg; /* Registers changed/destroyed */ - CodeLabel* JumpTo; /* Jump label */ - Collection Labels; /* Labels for this instruction */ + unsigned char OPC; /* Opcode */ + unsigned char AM; /* Adressing mode */ + unsigned char Size; /* Estimated size */ + unsigned char Flags; /* Flags */ + char* Arg; /* Argument as string */ + unsigned long Num; /* Numeric argument */ + unsigned short Info; /* Additional code info */ + unsigned short Use; /* Registers used */ + unsigned short Chg; /* Registers changed/destroyed */ + CodeLabel* JumpTo; /* Jump label */ + Collection Labels; /* Labels for this instruction */ LineInfo* LI; /* Source line info for this insn */ RegInfo* RI; /* Register info for this insn */ }; @@ -83,7 +83,7 @@ struct CodeEntry { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -97,7 +97,7 @@ const char* MakeHexArg (unsigned Num); */ CodeEntry* NewCodeEntry (opc_t OPC, am_t AM, const char* Arg, - CodeLabel* JumpTo, LineInfo* LI); + CodeLabel* JumpTo, LineInfo* LI); /* Create a new code entry, initialize and return it */ void FreeCodeEntry (CodeEntry* E); @@ -127,7 +127,7 @@ INLINE int CE_HasLabel (const CodeEntry* E) return (CollCount (&E->Labels) > 0); } #else -# define CE_HasLabel(E) (CollCount (&(E)->Labels) > 0) +# define CE_HasLabel(E) (CollCount (&(E)->Labels) > 0) #endif #if defined(HAVE_INLINE) @@ -137,7 +137,7 @@ INLINE unsigned CE_GetLabelCount (const CodeEntry* E) return CollCount (&E->Labels); } #else -# define CE_GetLabelCount(E) CollCount (&(E)->Labels) +# define CE_GetLabelCount(E) CollCount (&(E)->Labels) #endif #if defined(HAVE_INLINE) @@ -147,7 +147,7 @@ INLINE CodeLabel* CE_GetLabel (CodeEntry* E, unsigned Index) return CollAt (&E->Labels, Index); } #else -# define CE_GetLabel(E, Index) CollAt (&(E)->Labels, (Index)) +# define CE_GetLabel(E, Index) CollAt (&(E)->Labels, (Index)) #endif void CE_MoveLabel (CodeLabel* L, CodeEntry* E); @@ -160,7 +160,7 @@ INLINE int CE_HasMark (const CodeEntry* E) return (E->Flags & CEF_USERMARK) != 0; } #else -# define CE_HasMark(E) (((E)->Flags & CEF_USERMARK) != 0) +# define CE_HasMark(E) (((E)->Flags & CEF_USERMARK) != 0) #endif #if defined(HAVE_INLINE) @@ -170,7 +170,7 @@ INLINE void CE_SetMark (CodeEntry* E) E->Flags |= CEF_USERMARK; } #else -# define CE_SetMark(E) ((E)->Flags |= CEF_USERMARK) +# define CE_SetMark(E) ((E)->Flags |= CEF_USERMARK) #endif #if defined(HAVE_INLINE) @@ -180,7 +180,7 @@ INLINE void CE_ResetMark (CodeEntry* E) E->Flags &= ~CEF_USERMARK; } #else -# define CE_ResetMark(E) ((E)->Flags &= ~CEF_USERMARK) +# define CE_ResetMark(E) ((E)->Flags &= ~CEF_USERMARK) #endif #if defined(HAVE_INLINE) diff --git a/src/cc65/codegen.c b/src/cc65/codegen.c index 4a3eb17c3..2d41c4a95 100644 --- a/src/cc65/codegen.c +++ b/src/cc65/codegen.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codegen.c */ +/* codegen.c */ /* */ -/* 6502 code generator */ +/* 6502 code generator */ /* */ /* */ /* */ @@ -62,7 +62,7 @@ /*****************************************************************************/ -/* Helpers */ +/* Helpers */ /*****************************************************************************/ @@ -103,16 +103,16 @@ static const char* GetLabelName (unsigned Flags, unsigned long Label, long Offs) if (Offs) { xsprintf (Buf, sizeof (Buf), "%s%+ld", LocalLabelName (Label), Offs); } else { - xsprintf (Buf, sizeof (Buf), "%s", LocalLabelName (Label)); + xsprintf (Buf, sizeof (Buf), "%s", LocalLabelName (Label)); } break; case CF_EXTERNAL: /* External label */ if (Offs) { - xsprintf (Buf, sizeof (Buf), "_%s%+ld", (char*) Label, Offs); + xsprintf (Buf, sizeof (Buf), "_%s%+ld", (char*) Label, Offs); } else { - xsprintf (Buf, sizeof (Buf), "_%s", (char*) Label); + xsprintf (Buf, sizeof (Buf), "_%s", (char*) Label); } break; @@ -137,7 +137,7 @@ static const char* GetLabelName (unsigned Flags, unsigned long Label, long Offs) /*****************************************************************************/ -/* Pre- and postamble */ +/* Pre- and postamble */ /*****************************************************************************/ @@ -152,7 +152,7 @@ void g_preamble (void) /* Insert some object file options */ AddTextLine ("\t.fopt\t\tcompiler,\"cc65 v %s\"", - GetVersionAsString ()); + GetVersionAsString ()); /* If we're producing code for some other CPU, switch the command set */ switch (CPU) { @@ -201,7 +201,7 @@ void g_fileinfo (const char* Name, unsigned long Size, unsigned long MTime) /*****************************************************************************/ -/* Segment support */ +/* Segment support */ /*****************************************************************************/ @@ -249,7 +249,7 @@ void g_segname (segment_t Seg) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -326,7 +326,7 @@ static unsigned MakeByteOffs (unsigned Flags, unsigned Offs) /*****************************************************************************/ -/* Functions handling local labels */ +/* Functions handling local labels */ /*****************************************************************************/ @@ -366,7 +366,7 @@ void g_aliasdatalabel (unsigned label, unsigned baselabel, long offs) /*****************************************************************************/ -/* Functions handling global labels */ +/* Functions handling global labels */ /*****************************************************************************/ @@ -421,7 +421,7 @@ void g_importmainargs (void) /*****************************************************************************/ -/* Function entry and exit */ +/* Function entry and exit */ /*****************************************************************************/ @@ -485,7 +485,7 @@ void g_leave (void) /*****************************************************************************/ -/* Register variables */ +/* Register variables */ /*****************************************************************************/ @@ -637,7 +637,7 @@ void g_restore_regvars (int StackOffs, int RegOffs, unsigned Bytes) /*****************************************************************************/ -/* Fetching memory cells */ +/* Fetching memory cells */ /*****************************************************************************/ @@ -686,7 +686,7 @@ void g_getimmed (unsigned Flags, unsigned long Val, long Offs) AddCodeLine ("stx sreg+1"); Done |= 0x08; } - if ((Done & 0x04) == 0 && B1 != B3) { + if ((Done & 0x04) == 0 && B1 != B3) { AddCodeLine ("lda #$%02X", B3); AddCodeLine ("sta sreg"); Done |= 0x04; @@ -739,17 +739,17 @@ void g_getstatic (unsigned flags, unsigned long label, long offs) case CF_CHAR: if ((flags & CF_FORCECHAR) || (flags & CF_TEST)) { - AddCodeLine ("lda %s", lbuf); /* load A from the label */ + AddCodeLine ("lda %s", lbuf); /* load A from the label */ } else { AddCodeLine ("ldx #$00"); - AddCodeLine ("lda %s", lbuf); /* load A from the label */ - if (!(flags & CF_UNSIGNED)) { - /* Must sign extend */ + AddCodeLine ("lda %s", lbuf); /* load A from the label */ + if (!(flags & CF_UNSIGNED)) { + /* Must sign extend */ unsigned L = GetLocalLabel (); - AddCodeLine ("bpl %s", LocalLabelName (L)); - AddCodeLine ("dex"); + AddCodeLine ("bpl %s", LocalLabelName (L)); + AddCodeLine ("dex"); g_defcodelabel (L); - } + } } break; @@ -764,13 +764,13 @@ void g_getstatic (unsigned flags, unsigned long label, long offs) case CF_LONG: if (flags & CF_TEST) { - AddCodeLine ("lda %s+3", lbuf); + AddCodeLine ("lda %s+3", lbuf); AddCodeLine ("ora %s+2", lbuf); AddCodeLine ("ora %s+1", lbuf); AddCodeLine ("ora %s+0", lbuf); } else { - AddCodeLine ("lda %s+3", lbuf); - AddCodeLine ("sta sreg+1"); + AddCodeLine ("lda %s+3", lbuf); + AddCodeLine ("sta sreg+1"); AddCodeLine ("lda %s+2", lbuf); AddCodeLine ("sta sreg"); AddCodeLine ("ldx %s+1", lbuf); @@ -801,12 +801,12 @@ void g_getlocal (unsigned Flags, int Offs) AddCodeLine ("ldy #$%02X", Offs); AddCodeLine ("ldx #$00"); AddCodeLine ("lda (sp),y"); - if ((Flags & CF_UNSIGNED) == 0) { + if ((Flags & CF_UNSIGNED) == 0) { unsigned L = GetLocalLabel(); - AddCodeLine ("bpl %s", LocalLabelName (L)); - AddCodeLine ("dex"); + AddCodeLine ("bpl %s", LocalLabelName (L)); + AddCodeLine ("dex"); g_defcodelabel (L); - } + } } break; @@ -814,7 +814,7 @@ void g_getlocal (unsigned Flags, int Offs) CheckLocalOffs (Offs + 1); AddCodeLine ("ldy #$%02X", (unsigned char) (Offs+1)); if (Flags & CF_TEST) { - AddCodeLine ("lda (sp),y"); + AddCodeLine ("lda (sp),y"); AddCodeLine ("dey"); AddCodeLine ("ora (sp),y"); } else { @@ -827,7 +827,7 @@ void g_getlocal (unsigned Flags, int Offs) AddCodeLine ("ldy #$%02X", (unsigned char) (Offs+3)); AddCodeLine ("jsr ldeaxysp"); if (Flags & CF_TEST) { - g_test (Flags); + g_test (Flags); } break; @@ -1002,7 +1002,7 @@ void g_leavariadic (int Offs) /*****************************************************************************/ -/* Store into memory */ +/* Store into memory */ /*****************************************************************************/ @@ -1051,7 +1051,7 @@ void g_putlocal (unsigned Flags, int Offs, long Val) case CF_CHAR: if (Flags & CF_CONST) { - AddCodeLine ("lda #$%02X", (unsigned char) Val); + AddCodeLine ("lda #$%02X", (unsigned char) Val); } AddCodeLine ("ldy #$%02X", Offs); AddCodeLine ("sta (sp),y"); @@ -1090,7 +1090,7 @@ void g_putlocal (unsigned Flags, int Offs, long Val) case CF_LONG: if (Flags & CF_CONST) { - g_getimmed (Flags, Val, 0); + g_getimmed (Flags, Val, 0); } AddCodeLine ("ldy #$%02X", Offs); AddCodeLine ("jsr steaxysp"); @@ -1175,7 +1175,7 @@ void g_putind (unsigned Flags, unsigned Offs) /*****************************************************************************/ -/* type conversion and similiar stuff */ +/* type conversion and similiar stuff */ /*****************************************************************************/ @@ -1297,15 +1297,15 @@ void g_reglong (unsigned Flags) case CF_INT: if (Flags & CF_UNSIGNED) { - if (IS_Get (&CodeSizeFactor) >= 200) { + if (IS_Get (&CodeSizeFactor) >= 200) { AddCodeLine ("ldy #$00"); - AddCodeLine ("sty sreg"); - AddCodeLine ("sty sreg+1"); - } else { - AddCodeLine ("jsr axulong"); - } + AddCodeLine ("sty sreg"); + AddCodeLine ("sty sreg+1"); + } else { + AddCodeLine ("jsr axulong"); + } } else { - AddCodeLine ("jsr axlong"); + AddCodeLine ("jsr axlong"); } break; @@ -1430,28 +1430,28 @@ void g_scale (unsigned flags, long val) case CF_CHAR: if (flags & CF_FORCECHAR) { - while (p2--) { - AddCodeLine ("asl a"); - } - break; - } - /* FALLTHROUGH */ + while (p2--) { + AddCodeLine ("asl a"); + } + break; + } + /* FALLTHROUGH */ - case CF_INT: + case CF_INT: if (flags & CF_UNSIGNED) { AddCodeLine ("jsr shlax%d", p2); } else { AddCodeLine ("jsr aslax%d", p2); } - break; + break; - case CF_LONG: - if (flags & CF_UNSIGNED) { - AddCodeLine ("jsr shleax%d", p2); - } else { - AddCodeLine ("jsr asleax%d", p2); - } - break; + case CF_LONG: + if (flags & CF_UNSIGNED) { + AddCodeLine ("jsr shleax%d", p2); + } else { + AddCodeLine ("jsr asleax%d", p2); + } + break; default: typeerror (flags); @@ -1478,11 +1478,11 @@ void g_scale (unsigned flags, long val) if (flags & CF_FORCECHAR) { if (flags & CF_UNSIGNED) { while (p2--) { - AddCodeLine ("lsr a"); + AddCodeLine ("lsr a"); } break; } else if (p2 <= 2) { - AddCodeLine ("cmp #$80"); + AddCodeLine ("cmp #$80"); AddCodeLine ("ror a"); break; } @@ -1499,9 +1499,9 @@ void g_scale (unsigned flags, long val) case CF_LONG: if (flags & CF_UNSIGNED) { - AddCodeLine ("jsr lsreax%d", p2); + AddCodeLine ("jsr lsreax%d", p2); } else { - AddCodeLine ("jsr asreax%d", p2); + AddCodeLine ("jsr asreax%d", p2); } break; @@ -1522,7 +1522,7 @@ void g_scale (unsigned flags, long val) /*****************************************************************************/ -/* Adds and subs of variables fix a fixed address */ +/* Adds and subs of variables fix a fixed address */ /*****************************************************************************/ @@ -1620,13 +1620,13 @@ void g_addstatic (unsigned flags, unsigned long label, long offs) /*****************************************************************************/ -/* Special op= functions */ +/* Special op= functions */ /*****************************************************************************/ void g_addeqstatic (unsigned flags, unsigned long label, long offs, - unsigned long val) + unsigned long val) /* Emit += for a static variable */ { /* Create the correct label name */ @@ -1637,25 +1637,25 @@ void g_addeqstatic (unsigned flags, unsigned long label, long offs, case CF_CHAR: if (flags & CF_FORCECHAR) { - AddCodeLine ("ldx #$00"); - if (flags & CF_CONST) { - if (val == 1) { - AddCodeLine ("inc %s", lbuf); - AddCodeLine ("lda %s", lbuf); - } else { - AddCodeLine ("lda #$%02X", (int)(val & 0xFF)); - AddCodeLine ("clc"); - AddCodeLine ("adc %s", lbuf); - AddCodeLine ("sta %s", lbuf); - } - } else { - AddCodeLine ("clc"); - AddCodeLine ("adc %s", lbuf); - AddCodeLine ("sta %s", lbuf); - } - if ((flags & CF_UNSIGNED) == 0) { + AddCodeLine ("ldx #$00"); + if (flags & CF_CONST) { + if (val == 1) { + AddCodeLine ("inc %s", lbuf); + AddCodeLine ("lda %s", lbuf); + } else { + AddCodeLine ("lda #$%02X", (int)(val & 0xFF)); + AddCodeLine ("clc"); + AddCodeLine ("adc %s", lbuf); + AddCodeLine ("sta %s", lbuf); + } + } else { + AddCodeLine ("clc"); + AddCodeLine ("adc %s", lbuf); + AddCodeLine ("sta %s", lbuf); + } + if ((flags & CF_UNSIGNED) == 0) { unsigned L = GetLocalLabel(); - AddCodeLine ("bpl %s", LocalLabelName (L)); + AddCodeLine ("bpl %s", LocalLabelName (L)); AddCodeLine ("dex"); g_defcodelabel (L); } @@ -1671,25 +1671,25 @@ void g_addeqstatic (unsigned flags, unsigned long label, long offs, AddCodeLine ("bne %s", LocalLabelName (L)); AddCodeLine ("inc %s+1", lbuf); g_defcodelabel (L); - AddCodeLine ("lda %s", lbuf); /* Hmmm... */ + AddCodeLine ("lda %s", lbuf); /* Hmmm... */ AddCodeLine ("ldx %s+1", lbuf); } else { - AddCodeLine ("lda #$%02X", (int)(val & 0xFF)); + AddCodeLine ("lda #$%02X", (int)(val & 0xFF)); AddCodeLine ("clc"); AddCodeLine ("adc %s", lbuf); AddCodeLine ("sta %s", lbuf); if (val < 0x100) { - unsigned L = GetLocalLabel (); - AddCodeLine ("bcc %s", LocalLabelName (L)); - AddCodeLine ("inc %s+1", lbuf); - g_defcodelabel (L); - AddCodeLine ("ldx %s+1", lbuf); + unsigned L = GetLocalLabel (); + AddCodeLine ("bcc %s", LocalLabelName (L)); + AddCodeLine ("inc %s+1", lbuf); + g_defcodelabel (L); + AddCodeLine ("ldx %s+1", lbuf); } else { - AddCodeLine ("lda #$%02X", (unsigned char)(val >> 8)); - AddCodeLine ("adc %s+1", lbuf); - AddCodeLine ("sta %s+1", lbuf); - AddCodeLine ("tax"); - AddCodeLine ("lda %s", lbuf); + AddCodeLine ("lda #$%02X", (unsigned char)(val >> 8)); + AddCodeLine ("adc %s+1", lbuf); + AddCodeLine ("sta %s+1", lbuf); + AddCodeLine ("tax"); + AddCodeLine ("lda %s", lbuf); } } } else { @@ -1698,9 +1698,9 @@ void g_addeqstatic (unsigned flags, unsigned long label, long offs, AddCodeLine ("sta %s", lbuf); AddCodeLine ("txa"); AddCodeLine ("adc %s+1", lbuf); - AddCodeLine ("sta %s+1", lbuf); - AddCodeLine ("tax"); - AddCodeLine ("lda %s", lbuf); + AddCodeLine ("sta %s+1", lbuf); + AddCodeLine ("tax"); + AddCodeLine ("lda %s", lbuf); } break; @@ -1714,7 +1714,7 @@ void g_addeqstatic (unsigned flags, unsigned long label, long offs, AddCodeLine ("jsr laddeq1"); } else { AddCodeLine ("lda #$%02X", (int)(val & 0xFF)); - AddCodeLine ("jsr laddeqa"); + AddCodeLine ("jsr laddeqa"); } } else { g_getstatic (flags, label, offs); @@ -1760,13 +1760,13 @@ void g_addeqlocal (unsigned flags, int Offs, unsigned long val) AddCodeLine ("adc (sp),y"); AddCodeLine ("sta (sp),y"); } - if ((flags & CF_UNSIGNED) == 0) { + if ((flags & CF_UNSIGNED) == 0) { unsigned L = GetLocalLabel(); - AddCodeLine ("bpl %s", LocalLabelName (L)); - AddCodeLine ("dex"); + AddCodeLine ("bpl %s", LocalLabelName (L)); + AddCodeLine ("dex"); g_defcodelabel (L); - } - break; + } + break; } /* FALLTHROUGH */ @@ -1790,13 +1790,13 @@ void g_addeqlocal (unsigned flags, int Offs, unsigned long val) AddCodeLine ("jsr addeqysp"); } } else { - AddCodeLine ("jsr addeqysp"); + AddCodeLine ("jsr addeqysp"); } break; case CF_LONG: if (flags & CF_CONST) { - g_getimmed (flags, val, 0); + g_getimmed (flags, val, 0); } AddCodeLine ("ldy #$%02X", Offs); AddCodeLine ("jsr laddeqysp"); @@ -1834,11 +1834,11 @@ void g_addeqind (unsigned flags, unsigned offs, unsigned long val) case CF_INT: case CF_LONG: - AddCodeLine ("jsr pushax"); /* Push the address */ - push (CF_PTR); /* Correct the internal sp */ - g_getind (flags, offs); /* Fetch the value */ - g_inc (flags, val); /* Increment value in primary */ - g_putind (flags, offs); /* Store the value back */ + AddCodeLine ("jsr pushax"); /* Push the address */ + push (CF_PTR); /* Correct the internal sp */ + g_getind (flags, offs); /* Fetch the value */ + g_inc (flags, val); /* Increment value in primary */ + g_putind (flags, offs); /* Store the value back */ break; default: @@ -1861,41 +1861,41 @@ void g_subeqstatic (unsigned flags, unsigned long label, long offs, case CF_CHAR: if (flags & CF_FORCECHAR) { AddCodeLine ("ldx #$00"); - if (flags & CF_CONST) { + if (flags & CF_CONST) { if (val == 1) { AddCodeLine ("dec %s", lbuf); AddCodeLine ("lda %s", lbuf); } else { - AddCodeLine ("lda %s", lbuf); - AddCodeLine ("sec"); - AddCodeLine ("sbc #$%02X", (int)(val & 0xFF)); - AddCodeLine ("sta %s", lbuf); + AddCodeLine ("lda %s", lbuf); + AddCodeLine ("sec"); + AddCodeLine ("sbc #$%02X", (int)(val & 0xFF)); + AddCodeLine ("sta %s", lbuf); } - } else { + } else { AddCodeLine ("eor #$FF"); AddCodeLine ("sec"); - AddCodeLine ("adc %s", lbuf); + AddCodeLine ("adc %s", lbuf); AddCodeLine ("sta %s", lbuf); - } + } if ((flags & CF_UNSIGNED) == 0) { unsigned L = GetLocalLabel(); AddCodeLine ("bpl %s", LocalLabelName (L)); AddCodeLine ("dex"); g_defcodelabel (L); - } - break; + } + break; } /* FALLTHROUGH */ case CF_INT: if (flags & CF_CONST) { - AddCodeLine ("lda %s", lbuf); + AddCodeLine ("lda %s", lbuf); AddCodeLine ("sec"); - AddCodeLine ("sbc #$%02X", (unsigned char)val); - AddCodeLine ("sta %s", lbuf); - if (val < 0x100) { - unsigned L = GetLocalLabel (); - AddCodeLine ("bcs %s", LocalLabelName (L)); + AddCodeLine ("sbc #$%02X", (unsigned char)val); + AddCodeLine ("sta %s", lbuf); + if (val < 0x100) { + unsigned L = GetLocalLabel (); + AddCodeLine ("bcs %s", LocalLabelName (L)); AddCodeLine ("dec %s+1", lbuf); g_defcodelabel (L); AddCodeLine ("ldx %s+1", lbuf); @@ -1909,11 +1909,11 @@ void g_subeqstatic (unsigned flags, unsigned long label, long offs, } else { AddCodeLine ("eor #$FF"); AddCodeLine ("sec"); - AddCodeLine ("adc %s", lbuf); + AddCodeLine ("adc %s", lbuf); AddCodeLine ("sta %s", lbuf); AddCodeLine ("txa"); AddCodeLine ("eor #$FF"); - AddCodeLine ("adc %s+1", lbuf); + AddCodeLine ("adc %s+1", lbuf); AddCodeLine ("sta %s+1", lbuf); AddCodeLine ("tax"); AddCodeLine ("lda %s", lbuf); @@ -1969,22 +1969,22 @@ void g_subeqlocal (unsigned flags, int Offs, unsigned long val) } else { AddCodeLine ("eor #$FF"); AddCodeLine ("sec"); - AddCodeLine ("adc (sp),y"); + AddCodeLine ("adc (sp),y"); } - AddCodeLine ("sta (sp),y"); + AddCodeLine ("sta (sp),y"); if ((flags & CF_UNSIGNED) == 0) { - unsigned L = GetLocalLabel(); - AddCodeLine ("bpl %s", LocalLabelName (L)); - AddCodeLine ("dex"); - g_defcodelabel (L); - } - break; + unsigned L = GetLocalLabel(); + AddCodeLine ("bpl %s", LocalLabelName (L)); + AddCodeLine ("dex"); + g_defcodelabel (L); + } + break; } /* FALLTHROUGH */ case CF_INT: if (flags & CF_CONST) { - g_getimmed (flags, val, 0); + g_getimmed (flags, val, 0); } AddCodeLine ("ldy #$%02X", Offs); AddCodeLine ("jsr subeqysp"); @@ -1992,7 +1992,7 @@ void g_subeqlocal (unsigned flags, int Offs, unsigned long val) case CF_LONG: if (flags & CF_CONST) { - g_getimmed (flags, val, 0); + g_getimmed (flags, val, 0); } AddCodeLine ("ldy #$%02X", Offs); AddCodeLine ("jsr lsubeqysp"); @@ -2030,11 +2030,11 @@ void g_subeqind (unsigned flags, unsigned offs, unsigned long val) case CF_INT: case CF_LONG: - AddCodeLine ("jsr pushax"); /* Push the address */ - push (CF_PTR); /* Correct the internal sp */ - g_getind (flags, offs); /* Fetch the value */ - g_dec (flags, val); /* Increment value in primary */ - g_putind (flags, offs); /* Store the value back */ + AddCodeLine ("jsr pushax"); /* Push the address */ + push (CF_PTR); /* Correct the internal sp */ + g_getind (flags, offs); /* Fetch the value */ + g_dec (flags, val); /* Increment value in primary */ + g_putind (flags, offs); /* Store the value back */ break; default: @@ -2045,7 +2045,7 @@ void g_subeqind (unsigned flags, unsigned offs, unsigned long val) /*****************************************************************************/ -/* Add a variable address to the value in ax */ +/* Add a variable address to the value in ax */ /*****************************************************************************/ @@ -2103,7 +2103,7 @@ void g_addaddr_static (unsigned flags, unsigned long label, long offs) /*****************************************************************************/ -/* */ +/* */ /*****************************************************************************/ @@ -2116,7 +2116,7 @@ void g_save (unsigned flags) case CF_CHAR: if (flags & CF_FORCECHAR) { - AddCodeLine ("pha"); + AddCodeLine ("pha"); break; } /* FALLTHROUGH */ @@ -2145,8 +2145,8 @@ void g_restore (unsigned flags) case CF_CHAR: if (flags & CF_FORCECHAR) { - AddCodeLine ("pla"); - break; + AddCodeLine ("pla"); + break; } /* FALLTHROUGH */ @@ -2178,8 +2178,8 @@ void g_cmp (unsigned flags, unsigned long val) case CF_CHAR: if (flags & CF_FORCECHAR) { - AddCodeLine ("cmp #$%02X", (unsigned char)val); - break; + AddCodeLine ("cmp #$%02X", (unsigned char)val); + break; } /* FALLTHROUGH */ @@ -2204,10 +2204,10 @@ void g_cmp (unsigned flags, unsigned long val) static void oper (unsigned Flags, unsigned long Val, const char** Subs) /* Encode a binary operation. subs is a pointer to four strings: - * 0 --> Operate on ints - * 1 --> Operate on unsigneds - * 2 --> Operate on longs - * 3 --> Operate on unsigned longs + * 0 --> Operate on ints + * 1 --> Operate on unsigneds + * 2 --> Operate on longs + * 3 --> Operate on unsigned longs */ { /* Determine the offset into the array */ @@ -2252,9 +2252,9 @@ void g_test (unsigned flags) case CF_LONG: if (flags & CF_UNSIGNED) { - AddCodeLine ("jsr utsteax"); + AddCodeLine ("jsr utsteax"); } else { - AddCodeLine ("jsr tsteax"); + AddCodeLine ("jsr tsteax"); } break; @@ -2308,7 +2308,7 @@ void g_push (unsigned flags, unsigned long val) break; case CF_LONG: - AddCodeLine ("jsr pusheax"); + AddCodeLine ("jsr pusheax"); break; default: @@ -2495,7 +2495,7 @@ void g_add (unsigned flags, unsigned long val) }; if (flags & CF_CONST) { - flags &= ~CF_FORCECHAR; /* Handle chars as ints */ + flags &= ~CF_FORCECHAR; /* Handle chars as ints */ g_push (flags & ~CF_CONST, 0); } oper (flags, val, ops); @@ -2511,7 +2511,7 @@ void g_sub (unsigned flags, unsigned long val) }; if (flags & CF_CONST) { - flags &= ~CF_FORCECHAR; /* Handle chars as ints */ + flags &= ~CF_FORCECHAR; /* Handle chars as ints */ g_push (flags & ~CF_CONST, 0); } oper (flags, val, ops); @@ -2558,37 +2558,37 @@ void g_mul (unsigned flags, unsigned long val) /* Handle some special cases */ switch (val) { - case 3: - AddCodeLine ("sta tmp1"); - AddCodeLine ("asl a"); - AddCodeLine ("clc"); - AddCodeLine ("adc tmp1"); - return; - - case 5: - AddCodeLine ("sta tmp1"); - AddCodeLine ("asl a"); - AddCodeLine ("asl a"); - AddCodeLine ("clc"); - AddCodeLine ("adc tmp1"); - return; - - case 6: - AddCodeLine ("sta tmp1"); - AddCodeLine ("asl a"); - AddCodeLine ("clc"); - AddCodeLine ("adc tmp1"); + case 3: + AddCodeLine ("sta tmp1"); AddCodeLine ("asl a"); - return; + AddCodeLine ("clc"); + AddCodeLine ("adc tmp1"); + return; - case 10: - AddCodeLine ("sta tmp1"); - AddCodeLine ("asl a"); - AddCodeLine ("asl a"); - AddCodeLine ("clc"); - AddCodeLine ("adc tmp1"); - AddCodeLine ("asl a"); - return; + case 5: + AddCodeLine ("sta tmp1"); + AddCodeLine ("asl a"); + AddCodeLine ("asl a"); + AddCodeLine ("clc"); + AddCodeLine ("adc tmp1"); + return; + + case 6: + AddCodeLine ("sta tmp1"); + AddCodeLine ("asl a"); + AddCodeLine ("clc"); + AddCodeLine ("adc tmp1"); + AddCodeLine ("asl a"); + return; + + case 10: + AddCodeLine ("sta tmp1"); + AddCodeLine ("asl a"); + AddCodeLine ("asl a"); + AddCodeLine ("clc"); + AddCodeLine ("adc tmp1"); + AddCodeLine ("asl a"); + return; } } /* FALLTHROUGH */ @@ -2626,7 +2626,7 @@ void g_mul (unsigned flags, unsigned long val) /* If we go here, we didn't emit code. Push the lhs on stack and fall * into the normal, non-optimized stuff. */ - flags &= ~CF_FORCECHAR; /* Handle chars as ints */ + flags &= ~CF_FORCECHAR; /* Handle chars as ints */ g_push (flags & ~CF_CONST, 0); } @@ -2653,7 +2653,7 @@ void g_div (unsigned flags, unsigned long val) /* Generate a division */ if (flags & CF_CONST) { /* lhs is not on stack */ - flags &= ~CF_FORCECHAR; /* Handle chars as ints */ + flags &= ~CF_FORCECHAR; /* Handle chars as ints */ g_push (flags & ~CF_CONST, 0); } oper (flags, val, ops); @@ -2678,7 +2678,7 @@ void g_mod (unsigned flags, unsigned long val) /* Do it the hard way... */ if (flags & CF_CONST) { /* lhs is not on stack */ - flags &= ~CF_FORCECHAR; /* Handle chars as ints */ + flags &= ~CF_FORCECHAR; /* Handle chars as ints */ g_push (flags & ~CF_CONST, 0); } oper (flags, val, ops); @@ -2704,7 +2704,7 @@ void g_or (unsigned flags, unsigned long val) case CF_CHAR: if (flags & CF_FORCECHAR) { if ((val & 0xFF) != 0) { - AddCodeLine ("ora #$%02X", (unsigned char)val); + AddCodeLine ("ora #$%02X", (unsigned char)val); } return; } @@ -2775,7 +2775,7 @@ void g_xor (unsigned flags, unsigned long val) case CF_CHAR: if (flags & CF_FORCECHAR) { if ((val & 0xFF) != 0) { - AddCodeLine ("eor #$%02X", (unsigned char)val); + AddCodeLine ("eor #$%02X", (unsigned char)val); } return; } @@ -2784,14 +2784,14 @@ void g_xor (unsigned flags, unsigned long val) case CF_INT: if (val <= 0xFF) { if (val != 0) { - AddCodeLine ("eor #$%02X", (unsigned char)val); + AddCodeLine ("eor #$%02X", (unsigned char)val); } - } else if (val != 0) { + } else if (val != 0) { if ((val & 0xFF) != 0) { AddCodeLine ("eor #$%02X", (unsigned char)val); } AddCodeLine ("pha"); - AddCodeLine ("txa"); + AddCodeLine ("txa"); AddCodeLine ("eor #$%02X", (unsigned char)(val >> 8)); AddCodeLine ("tax"); AddCodeLine ("pla"); @@ -2801,7 +2801,7 @@ void g_xor (unsigned flags, unsigned long val) case CF_LONG: if (val <= 0xFF) { if (val != 0) { - AddCodeLine ("eor #$%02X", (unsigned char)val); + AddCodeLine ("eor #$%02X", (unsigned char)val); } return; } @@ -2846,37 +2846,37 @@ void g_and (unsigned Flags, unsigned long Val) } else if ((Val & 0xFF) != 0xFF) { AddCodeLine ("and #$%02X", (unsigned char)Val); } - return; - } - /* FALLTHROUGH */ + return; + } + /* FALLTHROUGH */ case CF_INT: - if ((Val & 0xFFFF) != 0xFFFF) { - if (Val <= 0xFF) { + if ((Val & 0xFFFF) != 0xFFFF) { + if (Val <= 0xFF) { AddCodeLine ("ldx #$00"); - if (Val == 0) { + if (Val == 0) { AddCodeLine ("lda #$00"); - } else if (Val != 0xFF) { - AddCodeLine ("and #$%02X", (unsigned char)Val); - } - } else if ((Val & 0xFFFF) == 0xFF00) { + } else if (Val != 0xFF) { + AddCodeLine ("and #$%02X", (unsigned char)Val); + } + } else if ((Val & 0xFFFF) == 0xFF00) { AddCodeLine ("lda #$00"); } else if ((Val & 0xFF00) == 0xFF00) { - AddCodeLine ("and #$%02X", (unsigned char)Val); - } else if ((Val & 0x00FF) == 0x0000) { - AddCodeLine ("txa"); - AddCodeLine ("and #$%02X", (unsigned char)(Val >> 8)); - AddCodeLine ("tax"); - AddCodeLine ("lda #$00"); + AddCodeLine ("and #$%02X", (unsigned char)Val); + } else if ((Val & 0x00FF) == 0x0000) { + AddCodeLine ("txa"); + AddCodeLine ("and #$%02X", (unsigned char)(Val >> 8)); + AddCodeLine ("tax"); + AddCodeLine ("lda #$00"); } else { - AddCodeLine ("tay"); - AddCodeLine ("txa"); - AddCodeLine ("and #$%02X", (unsigned char)(Val >> 8)); - AddCodeLine ("tax"); - AddCodeLine ("tya"); - if ((Val & 0x00FF) == 0x0000) { + AddCodeLine ("tay"); + AddCodeLine ("txa"); + AddCodeLine ("and #$%02X", (unsigned char)(Val >> 8)); + AddCodeLine ("tax"); + AddCodeLine ("tya"); + if ((Val & 0x00FF) == 0x0000) { AddCodeLine ("lda #$00"); - } else if ((Val & 0x00FF) != 0x00FF) { - AddCodeLine ("and #$%02X", (unsigned char)Val); + } else if ((Val & 0x00FF) != 0x00FF) { + AddCodeLine ("and #$%02X", (unsigned char)Val); } } } @@ -2886,9 +2886,9 @@ void g_and (unsigned Flags, unsigned long Val) if (Val <= 0xFF) { AddCodeLine ("ldx #$00"); AddCodeLine ("stx sreg+1"); - AddCodeLine ("stx sreg"); + AddCodeLine ("stx sreg"); if ((Val & 0xFF) != 0xFF) { - AddCodeLine ("and #$%02X", (unsigned char)Val); + AddCodeLine ("and #$%02X", (unsigned char)Val); } return; } else if (Val == 0xFF00) { @@ -2934,36 +2934,36 @@ void g_asr (unsigned flags, unsigned long val) case CF_CHAR: case CF_INT: val &= 0x0F; - if (val >= 8) { + if (val >= 8) { if (flags & CF_UNSIGNED) { AddCodeLine ("txa"); AddCodeLine ("ldx #$00"); } else { - unsigned L = GetLocalLabel(); + unsigned L = GetLocalLabel(); AddCodeLine ("cpx #$80"); /* Sign bit into carry */ AddCodeLine ("txa"); AddCodeLine ("ldx #$00"); AddCodeLine ("bcc %s", LocalLabelName (L)); AddCodeLine ("dex"); /* Make $FF */ - g_defcodelabel (L); + g_defcodelabel (L); } val -= 8; } if (val >= 4) { if (flags & CF_UNSIGNED) { - AddCodeLine ("jsr shrax4"); + AddCodeLine ("jsr shrax4"); } else { - AddCodeLine ("jsr asrax4"); + AddCodeLine ("jsr asrax4"); } val -= 4; } if (val > 0) { if (flags & CF_UNSIGNED) { - AddCodeLine ("jsr shrax%ld", val); + AddCodeLine ("jsr shrax%ld", val); } else { - AddCodeLine ("jsr asrax%ld", val); + AddCodeLine ("jsr asrax%ld", val); } - } + } return; case CF_LONG: @@ -2985,10 +2985,10 @@ void g_asr (unsigned flags, unsigned long val) AddCodeLine ("ldy #$00"); AddCodeLine ("ldx sreg+1"); if ((flags & CF_UNSIGNED) == 0) { - unsigned L = GetLocalLabel(); + unsigned L = GetLocalLabel(); AddCodeLine ("bpl %s", LocalLabelName (L)); AddCodeLine ("dey"); - g_defcodelabel (L); + g_defcodelabel (L); } AddCodeLine ("lda sreg"); AddCodeLine ("sty sreg+1"); @@ -3001,12 +3001,12 @@ void g_asr (unsigned flags, unsigned long val) AddCodeLine ("ldy sreg+1"); AddCodeLine ("sty sreg"); if ((flags & CF_UNSIGNED) == 0) { - unsigned L = GetLocalLabel(); + unsigned L = GetLocalLabel(); AddCodeLine ("cpy #$80"); AddCodeLine ("ldy #$00"); AddCodeLine ("bcc %s", LocalLabelName (L)); AddCodeLine ("dey"); - g_defcodelabel (L); + g_defcodelabel (L); } else { AddCodeLine ("ldy #$00"); } @@ -3015,17 +3015,17 @@ void g_asr (unsigned flags, unsigned long val) } if (val >= 4) { if (flags & CF_UNSIGNED) { - AddCodeLine ("jsr shreax4"); + AddCodeLine ("jsr shreax4"); } else { - AddCodeLine ("jsr asreax4"); + AddCodeLine ("jsr asreax4"); } val -= 4; } if (val > 0) { if (flags & CF_UNSIGNED) { - AddCodeLine ("jsr shreax%ld", val); + AddCodeLine ("jsr shreax%ld", val); } else { - AddCodeLine ("jsr asreax%ld", val); + AddCodeLine ("jsr asreax%ld", val); } } return; @@ -3114,17 +3114,17 @@ void g_asl (unsigned flags, unsigned long val) } if (val > 4) { if (flags & CF_UNSIGNED) { - AddCodeLine ("jsr shleax4"); + AddCodeLine ("jsr shleax4"); } else { - AddCodeLine ("jsr asleax4"); + AddCodeLine ("jsr asleax4"); } val -= 4; } if (val > 0) { if (flags & CF_UNSIGNED) { - AddCodeLine ("jsr shleax%ld", val); + AddCodeLine ("jsr shleax%ld", val); } else { - AddCodeLine ("jsr asleax%ld", val); + AddCodeLine ("jsr asleax%ld", val); } } return; @@ -3243,9 +3243,9 @@ void g_inc (unsigned flags, unsigned long val) if (flags & CF_FORCECHAR) { if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0 && val <= 2) { while (val--) { - AddCodeLine ("ina"); + AddCodeLine ("ina"); } - } else { + } else { AddCodeLine ("clc"); AddCodeLine ("adc #$%02X", (unsigned char)val); } @@ -3274,21 +3274,21 @@ void g_inc (unsigned flags, unsigned long val) /* Inline the code */ if (val <= 0x300) { if ((val & 0xFF) != 0) { - unsigned L = GetLocalLabel(); - AddCodeLine ("clc"); - AddCodeLine ("adc #$%02X", (unsigned char) val); - AddCodeLine ("bcc %s", LocalLabelName (L)); - AddCodeLine ("inx"); - g_defcodelabel (L); + unsigned L = GetLocalLabel(); + AddCodeLine ("clc"); + AddCodeLine ("adc #$%02X", (unsigned char) val); + AddCodeLine ("bcc %s", LocalLabelName (L)); + AddCodeLine ("inx"); + g_defcodelabel (L); } if (val >= 0x100) { - AddCodeLine ("inx"); + AddCodeLine ("inx"); } if (val >= 0x200) { - AddCodeLine ("inx"); + AddCodeLine ("inx"); } if (val >= 0x300) { - AddCodeLine ("inx"); + AddCodeLine ("inx"); } } else if ((val & 0xFF) != 0) { AddCodeLine ("clc"); @@ -3342,11 +3342,11 @@ void g_dec (unsigned flags, unsigned long val) if (flags & CF_FORCECHAR) { if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0 && val <= 2) { while (val--) { - AddCodeLine ("dea"); + AddCodeLine ("dea"); } } else { AddCodeLine ("sec"); - AddCodeLine ("sbc #$%02X", (unsigned char)val); + AddCodeLine ("sbc #$%02X", (unsigned char)val); } break; } @@ -3368,22 +3368,22 @@ void g_dec (unsigned flags, unsigned long val) if (val < 0x300) { if ((val & 0xFF) != 0) { unsigned L = GetLocalLabel(); - AddCodeLine ("sec"); - AddCodeLine ("sbc #$%02X", (unsigned char) val); - AddCodeLine ("bcs %s", LocalLabelName (L)); - AddCodeLine ("dex"); + AddCodeLine ("sec"); + AddCodeLine ("sbc #$%02X", (unsigned char) val); + AddCodeLine ("bcs %s", LocalLabelName (L)); + AddCodeLine ("dex"); g_defcodelabel (L); } if (val >= 0x100) { - AddCodeLine ("dex"); + AddCodeLine ("dex"); } if (val >= 0x200) { - AddCodeLine ("dex"); + AddCodeLine ("dex"); } } else { if ((val & 0xFF) != 0) { AddCodeLine ("sec"); - AddCodeLine ("sbc #$%02X", (unsigned char) val); + AddCodeLine ("sbc #$%02X", (unsigned char) val); AddCodeLine ("pha"); AddCodeLine ("txa"); AddCodeLine ("sbc #$%02X", (unsigned char) (val >> 8)); @@ -3453,7 +3453,7 @@ void g_eq (unsigned flags, unsigned long val) case CF_INT: L = GetLocalLabel(); AddCodeLine ("cpx #$%02X", (unsigned char)(val >> 8)); - AddCodeLine ("bne %s", LocalLabelName (L)); + AddCodeLine ("bne %s", LocalLabelName (L)); AddCodeLine ("cmp #$%02X", (unsigned char)val); g_defcodelabel (L); AddCodeLine ("jsr booleq"); @@ -3716,28 +3716,28 @@ void g_le (unsigned flags, unsigned long val) if (flags & CF_FORCECHAR) { if (flags & CF_UNSIGNED) { /* Unsigned compare */ - if (val < 0xFF) { - /* Use < instead of <= because the former gives - * better code on the 6502 than the latter. - */ + if (val < 0xFF) { + /* Use < instead of <= because the former gives + * better code on the 6502 than the latter. + */ g_lt (flags, val+1); - } else { + } else { /* Always true */ Warning ("Condition is always true"); AddCodeLine ("jsr return1"); - } + } } else { /* Signed compare */ - if ((long) val < 0x7F) { - /* Use < instead of <= because the former gives - * better code on the 6502 than the latter. - */ + if ((long) val < 0x7F) { + /* Use < instead of <= because the former gives + * better code on the 6502 than the latter. + */ g_lt (flags, val+1); - } else { + } else { /* Always true */ Warning ("Condition is always true"); AddCodeLine ("jsr return1"); - } + } } return; } @@ -3747,10 +3747,10 @@ void g_le (unsigned flags, unsigned long val) if (flags & CF_UNSIGNED) { /* Unsigned compare */ if (val < 0xFFFF) { - /* Use < instead of <= because the former gives - * better code on the 6502 than the latter. - */ - g_lt (flags, val+1); + /* Use < instead of <= because the former gives + * better code on the 6502 than the latter. + */ + g_lt (flags, val+1); } else { /* Always true */ Warning ("Condition is always true"); @@ -3759,7 +3759,7 @@ void g_le (unsigned flags, unsigned long val) } else { /* Signed compare */ if ((long) val < 0x7FFF) { - g_lt (flags, val+1); + g_lt (flags, val+1); } else { /* Always true */ Warning ("Condition is always true"); @@ -3772,10 +3772,10 @@ void g_le (unsigned flags, unsigned long val) if (flags & CF_UNSIGNED) { /* Unsigned compare */ if (val < 0xFFFFFFFF) { - /* Use < instead of <= because the former gives - * better code on the 6502 than the latter. - */ - g_lt (flags, val+1); + /* Use < instead of <= because the former gives + * better code on the 6502 than the latter. + */ + g_lt (flags, val+1); } else { /* Always true */ Warning ("Condition is always true"); @@ -3784,7 +3784,7 @@ void g_le (unsigned flags, unsigned long val) } else { /* Signed compare */ if ((long) val < 0x7FFFFFFF) { - g_lt (flags, val+1); + g_lt (flags, val+1); } else { /* Always true */ Warning ("Condition is always true"); @@ -3830,27 +3830,27 @@ void g_gt (unsigned flags, unsigned long val) case CF_CHAR: if (flags & CF_FORCECHAR) { if (flags & CF_UNSIGNED) { - if (val == 0) { - /* If we have a compare > 0, we will replace it by - * != 0 here, since both are identical but the + if (val == 0) { + /* If we have a compare > 0, we will replace it by + * != 0 here, since both are identical but the * latter is easier to optimize. - */ + */ g_ne (flags, val); - } else if (val < 0xFF) { - /* Use >= instead of > because the former gives - * better code on the 6502 than the latter. - */ + } else if (val < 0xFF) { + /* Use >= instead of > because the former gives + * better code on the 6502 than the latter. + */ g_ge (flags, val+1); - } else { + } else { /* Never true */ Warning ("Condition is never true"); AddCodeLine ("jsr return0"); } } else { - if ((long) val < 0x7F) { - /* Use >= instead of > because the former gives - * better code on the 6502 than the latter. - */ + if ((long) val < 0x7F) { + /* Use >= instead of > because the former gives + * better code on the 6502 than the latter. + */ g_ge (flags, val+1); } else { /* Never true */ @@ -3865,23 +3865,23 @@ void g_gt (unsigned flags, unsigned long val) case CF_INT: if (flags & CF_UNSIGNED) { /* Unsigned compare */ - if (val == 0) { - /* If we have a compare > 0, we will replace it by - * != 0 here, since both are identical but the latter - * is easier to optimize. - */ + if (val == 0) { + /* If we have a compare > 0, we will replace it by + * != 0 here, since both are identical but the latter + * is easier to optimize. + */ g_ne (flags, val); - } else if (val < 0xFFFF) { - /* Use >= instead of > because the former gives better - * code on the 6502 than the latter. - */ - g_ge (flags, val+1); + } else if (val < 0xFFFF) { + /* Use >= instead of > because the former gives better + * code on the 6502 than the latter. + */ + g_ge (flags, val+1); } else { /* Never true */ Warning ("Condition is never true"); AddCodeLine ("jsr return0"); - } - } else { + } + } else { /* Signed compare */ if ((long) val < 0x7FFF) { g_ge (flags, val+1); @@ -3889,30 +3889,30 @@ void g_gt (unsigned flags, unsigned long val) /* Never true */ Warning ("Condition is never true"); AddCodeLine ("jsr return0"); - } + } } return; case CF_LONG: if (flags & CF_UNSIGNED) { /* Unsigned compare */ - if (val == 0) { - /* If we have a compare > 0, we will replace it by - * != 0 here, since both are identical but the latter - * is easier to optimize. - */ + if (val == 0) { + /* If we have a compare > 0, we will replace it by + * != 0 here, since both are identical but the latter + * is easier to optimize. + */ g_ne (flags, val); - } else if (val < 0xFFFFFFFF) { - /* Use >= instead of > because the former gives better - * code on the 6502 than the latter. - */ - g_ge (flags, val+1); + } else if (val < 0xFFFFFFFF) { + /* Use >= instead of > because the former gives better + * code on the 6502 than the latter. + */ + g_ge (flags, val+1); } else { /* Never true */ Warning ("Condition is never true"); AddCodeLine ("jsr return0"); - } - } else { + } + } else { /* Signed compare */ if ((long) val < 0x7FFFFFFF) { g_ge (flags, val+1); @@ -3920,12 +3920,12 @@ void g_gt (unsigned flags, unsigned long val) /* Never true */ Warning ("Condition is never true"); AddCodeLine ("jsr return0"); - } + } } return; default: - typeerror (flags); + typeerror (flags); } /* If we go here, we didn't emit code. Push the lhs on stack and fall @@ -4101,7 +4101,7 @@ void g_ge (unsigned flags, unsigned long val) /*****************************************************************************/ -/* Allocating static storage */ +/* Allocating static storage */ /*****************************************************************************/ @@ -4123,7 +4123,7 @@ void g_defdata (unsigned flags, unsigned long val, long offs) switch (flags & CF_TYPEMASK) { case CF_CHAR: - AddDataLine ("\t.byte\t$%02lX", val & 0xFF); + AddDataLine ("\t.byte\t$%02lX", val & 0xFF); break; case CF_INT: @@ -4331,11 +4331,11 @@ void g_switch (Collection* Nodes, unsigned DefaultLabel, unsigned Depth) /* Determine the next label */ if (I == CollCount (Nodes) - 1) { - /* Last node means not found */ + /* Last node means not found */ g_truejump (0, DefaultLabel); } else { - /* Jump to the next check */ - NextLabel = GetLocalLabel (); + /* Jump to the next check */ + NextLabel = GetLocalLabel (); g_truejump (0, NextLabel); } @@ -4352,7 +4352,7 @@ void g_switch (Collection* Nodes, unsigned DefaultLabel, unsigned Depth) /*****************************************************************************/ -/* User supplied assembler code */ +/* User supplied assembler code */ /*****************************************************************************/ diff --git a/src/cc65/codegen.h b/src/cc65/codegen.h index ecfb43d42..a2f91518d 100644 --- a/src/cc65/codegen.h +++ b/src/cc65/codegen.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codegen.h */ +/* codegen.h */ /* */ -/* 6502 code generator */ +/* 6502 code generator */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,37 +58,37 @@ * Note^2: The actual type including the sign flag is in the lower bits, so * we can mask the information and use them as a table index. */ -#define CF_NONE 0x0000 /* No special flags */ +#define CF_NONE 0x0000 /* No special flags */ /* Values for the actual type */ -#define CF_CHAR 0x0003 /* Operation on characters */ -#define CF_INT 0x0001 /* Operation on ints */ -#define CF_PTR CF_INT /* Alias for readability */ -#define CF_LONG 0x0000 /* Operation on longs */ +#define CF_CHAR 0x0003 /* Operation on characters */ +#define CF_INT 0x0001 /* Operation on ints */ +#define CF_PTR CF_INT /* Alias for readability */ +#define CF_LONG 0x0000 /* Operation on longs */ #define CF_FLOAT 0x0004 /* Operation on a float */ /* Signedness */ -#define CF_UNSIGNED 0x0008 /* Value is unsigned */ +#define CF_UNSIGNED 0x0008 /* Value is unsigned */ /* Masks for retrieving type information */ #define CF_TYPEMASK 0x0007 /* Type information */ #define CF_STYPEMASK 0x000F /* Includes signedness */ -#define CF_NOKEEP 0x0010 /* Value may get destroyed when storing */ -#define CF_CONST 0x0020 /* Constant value available */ -#define CF_CONSTADDR 0x0040 /* Constant address value available */ -#define CF_TEST 0x0080 /* Test value */ -#define CF_FIXARGC 0x0100 /* Function has fixed arg count */ -#define CF_FORCECHAR 0x0200 /* Handle chars as chars, not ints */ -#define CF_REG 0x0800 /* Value is in primary register */ +#define CF_NOKEEP 0x0010 /* Value may get destroyed when storing */ +#define CF_CONST 0x0020 /* Constant value available */ +#define CF_CONSTADDR 0x0040 /* Constant address value available */ +#define CF_TEST 0x0080 /* Test value */ +#define CF_FIXARGC 0x0100 /* Function has fixed arg count */ +#define CF_FORCECHAR 0x0200 /* Handle chars as chars, not ints */ +#define CF_REG 0x0800 /* Value is in primary register */ /* Type of static address */ -#define CF_ADDRMASK 0xF000 /* Type of address */ -#define CF_STATIC 0x0000 /* Static local */ -#define CF_EXTERNAL 0x1000 /* Static external */ -#define CF_ABSOLUTE 0x2000 /* Numeric absolute address */ -#define CF_LOCAL 0x4000 /* Auto variable */ -#define CF_REGVAR 0x8000 /* Register variable */ +#define CF_ADDRMASK 0xF000 /* Type of address */ +#define CF_STATIC 0x0000 /* Static local */ +#define CF_EXTERNAL 0x1000 /* Static external */ +#define CF_ABSOLUTE 0x2000 /* Numeric absolute address */ +#define CF_LOCAL 0x4000 /* Auto variable */ +#define CF_REGVAR 0x8000 /* Register variable */ @@ -98,7 +98,7 @@ struct StrBuf; /*****************************************************************************/ -/* Files, pre- and postamble */ +/* Files, pre- and postamble */ /*****************************************************************************/ @@ -112,7 +112,7 @@ void g_fileinfo (const char* Name, unsigned long Size, unsigned long MTime); /*****************************************************************************/ -/* Segment support */ +/* Segment support */ /*****************************************************************************/ @@ -132,7 +132,7 @@ void g_segname (segment_t Seg); /*****************************************************************************/ -/* Functions handling local labels */ +/* Functions handling local labels */ /*****************************************************************************/ @@ -149,7 +149,7 @@ void g_aliasdatalabel (unsigned label, unsigned baselabel, long offs); /*****************************************************************************/ -/* Functions handling global labels */ +/* Functions handling global labels */ /*****************************************************************************/ @@ -172,7 +172,7 @@ void g_importmainargs (void); /*****************************************************************************/ -/* stack */ +/* stack */ /*****************************************************************************/ @@ -189,7 +189,7 @@ unsigned sizeofarg (unsigned flags); /*****************************************************************************/ -/* type conversion and similiar stuff */ +/* type conversion and similiar stuff */ /*****************************************************************************/ @@ -227,7 +227,7 @@ void g_scale (unsigned flags, long val); /*****************************************************************************/ -/* Function entry and exit */ +/* Function entry and exit */ /*****************************************************************************/ @@ -241,7 +241,7 @@ void g_leave (void); /*****************************************************************************/ -/* Register variables */ +/* Register variables */ /*****************************************************************************/ @@ -258,7 +258,7 @@ void g_restore_regvars (int StackOffs, int RegOffs, unsigned Bytes); /*****************************************************************************/ -/* Fetching memory cells */ +/* Fetching memory cells */ /*****************************************************************************/ @@ -288,7 +288,7 @@ void g_leavariadic (int Offs); /*****************************************************************************/ -/* Store into memory */ +/* Store into memory */ /*****************************************************************************/ @@ -307,7 +307,7 @@ void g_putind (unsigned flags, unsigned offs); /*****************************************************************************/ -/* Adds and subs of variables fix a fixed address */ +/* Adds and subs of variables fix a fixed address */ /*****************************************************************************/ @@ -321,13 +321,13 @@ void g_addstatic (unsigned flags, unsigned long label, long offs); /*****************************************************************************/ -/* Special op= functions */ +/* Special op= functions */ /*****************************************************************************/ void g_addeqstatic (unsigned flags, unsigned long label, long offs, - unsigned long val); + unsigned long val); /* Emit += for a static variable */ void g_addeqlocal (unsigned flags, int offs, unsigned long val); @@ -337,7 +337,7 @@ void g_addeqind (unsigned flags, unsigned offs, unsigned long val); /* Emit += for the location with address in ax */ void g_subeqstatic (unsigned flags, unsigned long label, long offs, - unsigned long val); + unsigned long val); /* Emit -= for a static variable */ void g_subeqlocal (unsigned flags, int offs, unsigned long val); @@ -349,7 +349,7 @@ void g_subeqind (unsigned flags, unsigned offs, unsigned long val); /*****************************************************************************/ -/* Add a variable address to the value in ax */ +/* Add a variable address to the value in ax */ /*****************************************************************************/ @@ -363,7 +363,7 @@ void g_addaddr_static (unsigned flags, unsigned long label, long offs); /*****************************************************************************/ -/* */ +/* */ /*****************************************************************************/ @@ -464,7 +464,7 @@ void g_initstatic (unsigned InitLabel, unsigned VarLabel, unsigned Size); /*****************************************************************************/ -/* Switch statement */ +/* Switch statement */ /*****************************************************************************/ @@ -475,7 +475,7 @@ void g_switch (Collection* Nodes, unsigned DefaultLabel, unsigned Depth); /*****************************************************************************/ -/* User supplied assembler code */ +/* User supplied assembler code */ /*****************************************************************************/ diff --git a/src/cc65/codeinfo.c b/src/cc65/codeinfo.c index 7c7bbba68..5f549c4a6 100644 --- a/src/cc65/codeinfo.c +++ b/src/cc65/codeinfo.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codeinfo.c */ +/* codeinfo.c */ /* */ -/* Additional information about 6502 code */ +/* Additional information about 6502 code */ /* */ /* */ /* */ @@ -53,7 +53,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -68,9 +68,9 @@ static const char CmpSuffixTab [][4] = { */ typedef struct FuncInfo FuncInfo; struct FuncInfo { - const char* Name; /* Function name */ - unsigned short Use; /* Register usage */ - unsigned short Chg; /* Changed/destroyed registers */ + const char* Name; /* Function name */ + unsigned short Use; /* Register usage */ + unsigned short Chg; /* Changed/destroyed registers */ }; /* Note for the shift functions: Shifts are done modulo 32, so all shift @@ -80,92 +80,92 @@ struct FuncInfo { static const FuncInfo FuncInfoTable[] = { { "addeq0sp", REG_AX, REG_AXY }, { "addeqysp", REG_AXY, REG_AXY }, - { "addysp", REG_Y, REG_NONE }, - { "aslax1", REG_AX, REG_AX | REG_TMP1 }, - { "aslax2", REG_AX, REG_AX | REG_TMP1 }, - { "aslax3", REG_AX, REG_AX | REG_TMP1 }, - { "aslax4", REG_AX, REG_AX | REG_TMP1 }, + { "addysp", REG_Y, REG_NONE }, + { "aslax1", REG_AX, REG_AX | REG_TMP1 }, + { "aslax2", REG_AX, REG_AX | REG_TMP1 }, + { "aslax3", REG_AX, REG_AX | REG_TMP1 }, + { "aslax4", REG_AX, REG_AX | REG_TMP1 }, { "aslaxy", REG_AXY, REG_AXY | REG_TMP1 }, - { "asleax1", REG_EAX, REG_EAX | REG_TMP1 }, - { "asleax2", REG_EAX, REG_EAX | REG_TMP1 }, - { "asleax3", REG_EAX, REG_EAX | REG_TMP1 }, - { "asleax4", REG_EAX, REG_EAXY | REG_TMP1 }, - { "asrax1", REG_AX, REG_AX | REG_TMP1 }, - { "asrax2", REG_AX, REG_AX | REG_TMP1 }, - { "asrax3", REG_AX, REG_AX | REG_TMP1 }, - { "asrax4", REG_AX, REG_AX | REG_TMP1 }, + { "asleax1", REG_EAX, REG_EAX | REG_TMP1 }, + { "asleax2", REG_EAX, REG_EAX | REG_TMP1 }, + { "asleax3", REG_EAX, REG_EAX | REG_TMP1 }, + { "asleax4", REG_EAX, REG_EAXY | REG_TMP1 }, + { "asrax1", REG_AX, REG_AX | REG_TMP1 }, + { "asrax2", REG_AX, REG_AX | REG_TMP1 }, + { "asrax3", REG_AX, REG_AX | REG_TMP1 }, + { "asrax4", REG_AX, REG_AX | REG_TMP1 }, { "asraxy", REG_AXY, REG_AXY | REG_TMP1 }, - { "asreax1", REG_EAX, REG_EAX | REG_TMP1 }, - { "asreax2", REG_EAX, REG_EAX | REG_TMP1 }, - { "asreax3", REG_EAX, REG_EAX | REG_TMP1 }, - { "asreax4", REG_EAX, REG_EAXY | REG_TMP1 }, - { "bnega", REG_A, REG_AX }, - { "bnegax", REG_AX, REG_AX }, - { "bnegeax", REG_EAX, REG_EAX }, - { "booleq", REG_NONE, REG_AX }, - { "boolge", REG_NONE, REG_AX }, - { "boolgt", REG_NONE, REG_AX }, - { "boolle", REG_NONE, REG_AX }, - { "boollt", REG_NONE, REG_AX }, - { "boolne", REG_NONE, REG_AX }, - { "booluge", REG_NONE, REG_AX }, - { "boolugt", REG_NONE, REG_AX }, - { "boolule", REG_NONE, REG_AX }, - { "boolult", REG_NONE, REG_AX }, + { "asreax1", REG_EAX, REG_EAX | REG_TMP1 }, + { "asreax2", REG_EAX, REG_EAX | REG_TMP1 }, + { "asreax3", REG_EAX, REG_EAX | REG_TMP1 }, + { "asreax4", REG_EAX, REG_EAXY | REG_TMP1 }, + { "bnega", REG_A, REG_AX }, + { "bnegax", REG_AX, REG_AX }, + { "bnegeax", REG_EAX, REG_EAX }, + { "booleq", REG_NONE, REG_AX }, + { "boolge", REG_NONE, REG_AX }, + { "boolgt", REG_NONE, REG_AX }, + { "boolle", REG_NONE, REG_AX }, + { "boollt", REG_NONE, REG_AX }, + { "boolne", REG_NONE, REG_AX }, + { "booluge", REG_NONE, REG_AX }, + { "boolugt", REG_NONE, REG_AX }, + { "boolule", REG_NONE, REG_AX }, + { "boolult", REG_NONE, REG_AX }, { "callax", REG_AX, REG_ALL }, - { "complax", REG_AX, REG_AX }, - { "decax1", REG_AX, REG_AX }, - { "decax2", REG_AX, REG_AX }, - { "decax3", REG_AX, REG_AX }, - { "decax4", REG_AX, REG_AX }, - { "decax5", REG_AX, REG_AX }, - { "decax6", REG_AX, REG_AX }, - { "decax7", REG_AX, REG_AX }, - { "decax8", REG_AX, REG_AX }, - { "decaxy", REG_AXY, REG_AX | REG_TMP1 }, + { "complax", REG_AX, REG_AX }, + { "decax1", REG_AX, REG_AX }, + { "decax2", REG_AX, REG_AX }, + { "decax3", REG_AX, REG_AX }, + { "decax4", REG_AX, REG_AX }, + { "decax5", REG_AX, REG_AX }, + { "decax6", REG_AX, REG_AX }, + { "decax7", REG_AX, REG_AX }, + { "decax8", REG_AX, REG_AX }, + { "decaxy", REG_AXY, REG_AX | REG_TMP1 }, { "deceaxy", REG_EAXY, REG_EAX }, - { "decsp1", REG_NONE, REG_Y }, - { "decsp2", REG_NONE, REG_A }, - { "decsp3", REG_NONE, REG_A }, - { "decsp4", REG_NONE, REG_A }, - { "decsp5", REG_NONE, REG_A }, - { "decsp6", REG_NONE, REG_A }, - { "decsp7", REG_NONE, REG_A }, - { "decsp8", REG_NONE, REG_A }, - { "incax1", REG_AX, REG_AX }, - { "incax2", REG_AX, REG_AX }, + { "decsp1", REG_NONE, REG_Y }, + { "decsp2", REG_NONE, REG_A }, + { "decsp3", REG_NONE, REG_A }, + { "decsp4", REG_NONE, REG_A }, + { "decsp5", REG_NONE, REG_A }, + { "decsp6", REG_NONE, REG_A }, + { "decsp7", REG_NONE, REG_A }, + { "decsp8", REG_NONE, REG_A }, + { "incax1", REG_AX, REG_AX }, + { "incax2", REG_AX, REG_AX }, { "incax3", REG_AX, REG_AXY | REG_TMP1 }, - { "incax4", REG_AX, REG_AXY | REG_TMP1 }, - { "incax5", REG_AX, REG_AXY | REG_TMP1 }, - { "incax6", REG_AX, REG_AXY | REG_TMP1 }, - { "incax7", REG_AX, REG_AXY | REG_TMP1 }, - { "incax8", REG_AX, REG_AXY | REG_TMP1 }, - { "incaxy", REG_AXY, REG_AXY | REG_TMP1 }, - { "incsp1", REG_NONE, REG_NONE }, - { "incsp2", REG_NONE, REG_Y }, - { "incsp3", REG_NONE, REG_Y }, - { "incsp4", REG_NONE, REG_Y }, - { "incsp5", REG_NONE, REG_Y }, - { "incsp6", REG_NONE, REG_Y }, - { "incsp7", REG_NONE, REG_Y }, - { "incsp8", REG_NONE, REG_Y }, - { "laddeq", REG_EAXY|REG_PTR1_LO, REG_EAXY | REG_PTR1_HI }, + { "incax4", REG_AX, REG_AXY | REG_TMP1 }, + { "incax5", REG_AX, REG_AXY | REG_TMP1 }, + { "incax6", REG_AX, REG_AXY | REG_TMP1 }, + { "incax7", REG_AX, REG_AXY | REG_TMP1 }, + { "incax8", REG_AX, REG_AXY | REG_TMP1 }, + { "incaxy", REG_AXY, REG_AXY | REG_TMP1 }, + { "incsp1", REG_NONE, REG_NONE }, + { "incsp2", REG_NONE, REG_Y }, + { "incsp3", REG_NONE, REG_Y }, + { "incsp4", REG_NONE, REG_Y }, + { "incsp5", REG_NONE, REG_Y }, + { "incsp6", REG_NONE, REG_Y }, + { "incsp7", REG_NONE, REG_Y }, + { "incsp8", REG_NONE, REG_Y }, + { "laddeq", REG_EAXY|REG_PTR1_LO, REG_EAXY | REG_PTR1_HI }, { "laddeq0sp", REG_EAX, REG_EAXY }, - { "laddeq1", REG_Y | REG_PTR1_LO, REG_EAXY | REG_PTR1_HI }, + { "laddeq1", REG_Y | REG_PTR1_LO, REG_EAXY | REG_PTR1_HI }, { "laddeqa", REG_AY | REG_PTR1_LO, REG_EAXY | REG_PTR1_HI }, { "laddeqysp", REG_EAXY, REG_EAXY }, - { "ldaidx", REG_AXY, REG_AX | REG_PTR1 }, - { "ldauidx", REG_AXY, REG_AX | REG_PTR1 }, - { "ldax0sp", REG_NONE, REG_AXY }, - { "ldaxi", REG_AX, REG_AXY | REG_PTR1 }, - { "ldaxidx", REG_AXY, REG_AXY | REG_PTR1 }, - { "ldaxysp", REG_Y, REG_AXY }, + { "ldaidx", REG_AXY, REG_AX | REG_PTR1 }, + { "ldauidx", REG_AXY, REG_AX | REG_PTR1 }, + { "ldax0sp", REG_NONE, REG_AXY }, + { "ldaxi", REG_AX, REG_AXY | REG_PTR1 }, + { "ldaxidx", REG_AXY, REG_AXY | REG_PTR1 }, + { "ldaxysp", REG_Y, REG_AXY }, { "ldeax0sp", REG_NONE, REG_EAXY }, { "ldeaxi", REG_AX, REG_EAXY | REG_PTR1 }, { "ldeaxidx", REG_AXY, REG_EAXY | REG_PTR1 }, { "ldeaxysp", REG_Y, REG_EAXY }, - { "leaa0sp", REG_A, REG_AX }, - { "leaaxsp", REG_AX, REG_AX }, + { "leaa0sp", REG_A, REG_AX }, + { "leaaxsp", REG_AX, REG_AX }, { "lsubeq", REG_EAXY|REG_PTR1_LO, REG_EAXY | REG_PTR1_HI }, { "lsubeq0sp", REG_EAX, REG_EAXY }, { "lsubeq1", REG_Y | REG_PTR1_LO, REG_EAXY | REG_PTR1_HI }, @@ -177,63 +177,63 @@ static const FuncInfo FuncInfoTable[] = { { "mulax6", REG_AX, REG_AX | REG_PTR1 }, { "mulax7", REG_AX, REG_AX | REG_PTR1 }, { "mulax9", REG_AX, REG_AX | REG_PTR1 }, - { "negax", REG_AX, REG_AX }, - { "push0", REG_NONE, REG_AXY }, + { "negax", REG_AX, REG_AX }, + { "push0", REG_NONE, REG_AXY }, { "push0ax", REG_AX, REG_Y | REG_SREG }, - { "push1", REG_NONE, REG_AXY }, - { "push2", REG_NONE, REG_AXY }, - { "push3", REG_NONE, REG_AXY }, - { "push4", REG_NONE, REG_AXY }, - { "push5", REG_NONE, REG_AXY }, - { "push6", REG_NONE, REG_AXY }, - { "push7", REG_NONE, REG_AXY }, - { "pusha", REG_A, REG_Y }, - { "pusha0", REG_A, REG_XY }, + { "push1", REG_NONE, REG_AXY }, + { "push2", REG_NONE, REG_AXY }, + { "push3", REG_NONE, REG_AXY }, + { "push4", REG_NONE, REG_AXY }, + { "push5", REG_NONE, REG_AXY }, + { "push6", REG_NONE, REG_AXY }, + { "push7", REG_NONE, REG_AXY }, + { "pusha", REG_A, REG_Y }, + { "pusha0", REG_A, REG_XY }, { "pusha0sp", REG_NONE, REG_AY }, - { "pushaFF", REG_A, REG_Y }, - { "pushax", REG_AX, REG_Y }, + { "pushaFF", REG_A, REG_Y }, + { "pushax", REG_AX, REG_Y }, { "pushaysp", REG_Y, REG_AY }, - { "pushc0", REG_NONE, REG_A | REG_Y }, - { "pushc1", REG_NONE, REG_A | REG_Y }, - { "pushc2", REG_NONE, REG_A | REG_Y }, - { "pusheax", REG_EAX, REG_Y }, - { "pushl0", REG_NONE, REG_AXY }, - { "pushw", REG_AX, REG_AXY | REG_PTR1 }, - { "pushw0sp", REG_NONE, REG_AXY }, - { "pushwidx", REG_AXY, REG_AXY | REG_PTR1 }, - { "pushwysp", REG_Y, REG_AXY }, + { "pushc0", REG_NONE, REG_A | REG_Y }, + { "pushc1", REG_NONE, REG_A | REG_Y }, + { "pushc2", REG_NONE, REG_A | REG_Y }, + { "pusheax", REG_EAX, REG_Y }, + { "pushl0", REG_NONE, REG_AXY }, + { "pushw", REG_AX, REG_AXY | REG_PTR1 }, + { "pushw0sp", REG_NONE, REG_AXY }, + { "pushwidx", REG_AXY, REG_AXY | REG_PTR1 }, + { "pushwysp", REG_Y, REG_AXY }, { "regswap", REG_AXY, REG_AXY | REG_TMP1 }, { "regswap1", REG_XY, REG_A }, { "regswap2", REG_XY, REG_A | REG_Y }, { "return0", REG_NONE, REG_AX }, { "return1", REG_NONE, REG_AX }, - { "shlax1", REG_AX, REG_AX | REG_TMP1 }, - { "shlax2", REG_AX, REG_AX | REG_TMP1 }, - { "shlax3", REG_AX, REG_AX | REG_TMP1 }, - { "shlax4", REG_AX, REG_AX | REG_TMP1 }, + { "shlax1", REG_AX, REG_AX | REG_TMP1 }, + { "shlax2", REG_AX, REG_AX | REG_TMP1 }, + { "shlax3", REG_AX, REG_AX | REG_TMP1 }, + { "shlax4", REG_AX, REG_AX | REG_TMP1 }, { "shlaxy", REG_AXY, REG_AXY | REG_TMP1 }, - { "shleax1", REG_EAX, REG_EAX | REG_TMP1 }, - { "shleax2", REG_EAX, REG_EAX | REG_TMP1 }, - { "shleax3", REG_EAX, REG_EAX | REG_TMP1 }, - { "shleax4", REG_EAX, REG_EAXY | REG_TMP1 }, - { "shrax1", REG_AX, REG_AX | REG_TMP1 }, - { "shrax2", REG_AX, REG_AX | REG_TMP1 }, - { "shrax3", REG_AX, REG_AX | REG_TMP1 }, - { "shrax4", REG_AX, REG_AX | REG_TMP1 }, + { "shleax1", REG_EAX, REG_EAX | REG_TMP1 }, + { "shleax2", REG_EAX, REG_EAX | REG_TMP1 }, + { "shleax3", REG_EAX, REG_EAX | REG_TMP1 }, + { "shleax4", REG_EAX, REG_EAXY | REG_TMP1 }, + { "shrax1", REG_AX, REG_AX | REG_TMP1 }, + { "shrax2", REG_AX, REG_AX | REG_TMP1 }, + { "shrax3", REG_AX, REG_AX | REG_TMP1 }, + { "shrax4", REG_AX, REG_AX | REG_TMP1 }, { "shraxy", REG_AXY, REG_AXY | REG_TMP1 }, - { "shreax1", REG_EAX, REG_EAX | REG_TMP1 }, - { "shreax2", REG_EAX, REG_EAX | REG_TMP1 }, - { "shreax3", REG_EAX, REG_EAX | REG_TMP1 }, - { "shreax4", REG_EAX, REG_EAXY | REG_TMP1 }, + { "shreax1", REG_EAX, REG_EAX | REG_TMP1 }, + { "shreax2", REG_EAX, REG_EAX | REG_TMP1 }, + { "shreax3", REG_EAX, REG_EAX | REG_TMP1 }, + { "shreax4", REG_EAX, REG_EAXY | REG_TMP1 }, { "staspidx", REG_A | REG_Y, REG_Y | REG_TMP1 | REG_PTR1 }, - { "stax0sp", REG_AX, REG_Y }, + { "stax0sp", REG_AX, REG_Y }, { "staxspidx", REG_AXY, REG_TMP1 | REG_PTR1 }, - { "staxysp", REG_AXY, REG_Y }, + { "staxysp", REG_AXY, REG_Y }, { "steax0sp", REG_EAX, REG_Y }, { "steaxysp", REG_EAXY, REG_Y }, { "subeq0sp", REG_AX, REG_AXY }, { "subeqysp", REG_AXY, REG_AXY }, - { "subysp", REG_Y, REG_AY }, + { "subysp", REG_Y, REG_AY }, { "tosadd0ax", REG_AX, REG_EAXY | REG_TMP1 }, { "tosadda0", REG_A, REG_AXY }, { "tosaddax", REG_AX, REG_AXY }, @@ -246,55 +246,55 @@ static const FuncInfo FuncInfoTable[] = { { "tosasleax", REG_A, REG_EAXY | REG_TMP1 }, { "tosasrax", REG_A, REG_AXY | REG_TMP1 }, { "tosasreax", REG_A, REG_EAXY | REG_TMP1 }, - { "tosdiv0ax", REG_AX, REG_ALL }, - { "tosdiva0", REG_A, REG_ALL }, - { "tosdivax", REG_AX, REG_ALL }, - { "tosdiveax", REG_EAX, REG_ALL }, - { "toseq00", REG_NONE, REG_AXY | REG_SREG }, - { "toseqa0", REG_A, REG_AXY | REG_SREG }, - { "toseqax", REG_AX, REG_AXY | REG_SREG }, - { "toseqeax", REG_EAX, REG_AXY | REG_PTR1 }, - { "tosge00", REG_NONE, REG_AXY | REG_SREG }, - { "tosgea0", REG_A, REG_AXY | REG_SREG }, - { "tosgeax", REG_AX, REG_AXY | REG_SREG }, - { "tosgeeax", REG_EAX, REG_AXY | REG_PTR1 }, - { "tosgt00", REG_NONE, REG_AXY | REG_SREG }, - { "tosgta0", REG_A, REG_AXY | REG_SREG }, - { "tosgtax", REG_AX, REG_AXY | REG_SREG }, - { "tosgteax", REG_EAX, REG_AXY | REG_PTR1 }, - { "tosicmp", REG_AX, REG_AXY | REG_SREG }, + { "tosdiv0ax", REG_AX, REG_ALL }, + { "tosdiva0", REG_A, REG_ALL }, + { "tosdivax", REG_AX, REG_ALL }, + { "tosdiveax", REG_EAX, REG_ALL }, + { "toseq00", REG_NONE, REG_AXY | REG_SREG }, + { "toseqa0", REG_A, REG_AXY | REG_SREG }, + { "toseqax", REG_AX, REG_AXY | REG_SREG }, + { "toseqeax", REG_EAX, REG_AXY | REG_PTR1 }, + { "tosge00", REG_NONE, REG_AXY | REG_SREG }, + { "tosgea0", REG_A, REG_AXY | REG_SREG }, + { "tosgeax", REG_AX, REG_AXY | REG_SREG }, + { "tosgeeax", REG_EAX, REG_AXY | REG_PTR1 }, + { "tosgt00", REG_NONE, REG_AXY | REG_SREG }, + { "tosgta0", REG_A, REG_AXY | REG_SREG }, + { "tosgtax", REG_AX, REG_AXY | REG_SREG }, + { "tosgteax", REG_EAX, REG_AXY | REG_PTR1 }, + { "tosicmp", REG_AX, REG_AXY | REG_SREG }, { "tosicmp0", REG_A, REG_AXY | REG_SREG }, - { "toslcmp", REG_EAX, REG_A | REG_Y | REG_PTR1 }, - { "tosle00", REG_NONE, REG_AXY | REG_SREG }, - { "toslea0", REG_A, REG_AXY | REG_SREG }, - { "tosleax", REG_AX, REG_AXY | REG_SREG }, - { "tosleeax", REG_EAX, REG_AXY | REG_PTR1 }, - { "toslt00", REG_NONE, REG_AXY | REG_SREG }, - { "toslta0", REG_A, REG_AXY | REG_SREG }, - { "tosltax", REG_AX, REG_AXY | REG_SREG }, - { "toslteax", REG_EAX, REG_AXY | REG_PTR1 }, - { "tosmod0ax", REG_AX, REG_ALL }, - { "tosmodeax", REG_EAX, REG_ALL }, - { "tosmul0ax", REG_AX, REG_ALL }, - { "tosmula0", REG_A, REG_ALL }, - { "tosmulax", REG_AX, REG_ALL }, - { "tosmuleax", REG_EAX, REG_ALL }, - { "tosne00", REG_NONE, REG_AXY | REG_SREG }, - { "tosnea0", REG_A, REG_AXY | REG_SREG }, - { "tosneax", REG_AX, REG_AXY | REG_SREG }, - { "tosneeax", REG_EAX, REG_AXY | REG_PTR1 }, + { "toslcmp", REG_EAX, REG_A | REG_Y | REG_PTR1 }, + { "tosle00", REG_NONE, REG_AXY | REG_SREG }, + { "toslea0", REG_A, REG_AXY | REG_SREG }, + { "tosleax", REG_AX, REG_AXY | REG_SREG }, + { "tosleeax", REG_EAX, REG_AXY | REG_PTR1 }, + { "toslt00", REG_NONE, REG_AXY | REG_SREG }, + { "toslta0", REG_A, REG_AXY | REG_SREG }, + { "tosltax", REG_AX, REG_AXY | REG_SREG }, + { "toslteax", REG_EAX, REG_AXY | REG_PTR1 }, + { "tosmod0ax", REG_AX, REG_ALL }, + { "tosmodeax", REG_EAX, REG_ALL }, + { "tosmul0ax", REG_AX, REG_ALL }, + { "tosmula0", REG_A, REG_ALL }, + { "tosmulax", REG_AX, REG_ALL }, + { "tosmuleax", REG_EAX, REG_ALL }, + { "tosne00", REG_NONE, REG_AXY | REG_SREG }, + { "tosnea0", REG_A, REG_AXY | REG_SREG }, + { "tosneax", REG_AX, REG_AXY | REG_SREG }, + { "tosneeax", REG_EAX, REG_AXY | REG_PTR1 }, { "tosor0ax", REG_AX, REG_EAXY | REG_TMP1 }, - { "tosora0", REG_A, REG_AXY | REG_TMP1 }, - { "tosorax", REG_AX, REG_AXY | REG_TMP1 }, + { "tosora0", REG_A, REG_AXY | REG_TMP1 }, + { "tosorax", REG_AX, REG_AXY | REG_TMP1 }, { "tosoreax", REG_EAX, REG_EAXY | REG_TMP1 }, { "tosrsub0ax", REG_AX, REG_EAXY | REG_TMP1 }, { "tosrsuba0", REG_A, REG_AXY | REG_TMP1 }, { "tosrsubax", REG_AX, REG_AXY | REG_TMP1 }, { "tosrsubeax", REG_EAX, REG_EAXY | REG_TMP1 }, { "tosshlax", REG_A, REG_AXY | REG_TMP1 }, - { "tosshleax", REG_A, REG_EAXY | REG_TMP1 }, + { "tosshleax", REG_A, REG_EAXY | REG_TMP1 }, { "tosshrax", REG_A, REG_AXY | REG_TMP1 }, - { "tosshreax", REG_A, REG_EAXY | REG_TMP1 }, + { "tosshreax", REG_A, REG_EAXY | REG_TMP1 }, { "tossub0ax", REG_AX, REG_EAXY }, { "tossuba0", REG_A, REG_AXY }, { "tossubax", REG_AX, REG_AXY }, @@ -303,30 +303,30 @@ static const FuncInfo FuncInfoTable[] = { { "tosudiva0", REG_A, REG_EAXY | REG_PTR1 }, /* also ptr4 */ { "tosudivax", REG_AX, REG_EAXY | REG_PTR1 }, /* also ptr4 */ { "tosudiveax", REG_EAX, REG_ALL & ~REG_SAVE }, - { "tosuge00", REG_NONE, REG_AXY | REG_SREG }, - { "tosugea0", REG_A, REG_AXY | REG_SREG }, - { "tosugeax", REG_AX, REG_AXY | REG_SREG }, - { "tosugeeax", REG_EAX, REG_AXY | REG_PTR1 }, - { "tosugt00", REG_NONE, REG_AXY | REG_SREG }, - { "tosugta0", REG_A, REG_AXY | REG_SREG }, - { "tosugtax", REG_AX, REG_AXY | REG_SREG }, - { "tosugteax", REG_EAX, REG_AXY | REG_PTR1 }, - { "tosule00", REG_NONE, REG_AXY | REG_SREG }, - { "tosulea0", REG_A, REG_AXY | REG_SREG }, - { "tosuleax", REG_AX, REG_AXY | REG_SREG }, - { "tosuleeax", REG_EAX, REG_AXY | REG_PTR1 }, - { "tosult00", REG_NONE, REG_AXY | REG_SREG }, - { "tosulta0", REG_A, REG_AXY | REG_SREG }, - { "tosultax", REG_AX, REG_AXY | REG_SREG }, - { "tosulteax", REG_EAX, REG_AXY | REG_PTR1 }, + { "tosuge00", REG_NONE, REG_AXY | REG_SREG }, + { "tosugea0", REG_A, REG_AXY | REG_SREG }, + { "tosugeax", REG_AX, REG_AXY | REG_SREG }, + { "tosugeeax", REG_EAX, REG_AXY | REG_PTR1 }, + { "tosugt00", REG_NONE, REG_AXY | REG_SREG }, + { "tosugta0", REG_A, REG_AXY | REG_SREG }, + { "tosugtax", REG_AX, REG_AXY | REG_SREG }, + { "tosugteax", REG_EAX, REG_AXY | REG_PTR1 }, + { "tosule00", REG_NONE, REG_AXY | REG_SREG }, + { "tosulea0", REG_A, REG_AXY | REG_SREG }, + { "tosuleax", REG_AX, REG_AXY | REG_SREG }, + { "tosuleeax", REG_EAX, REG_AXY | REG_PTR1 }, + { "tosult00", REG_NONE, REG_AXY | REG_SREG }, + { "tosulta0", REG_A, REG_AXY | REG_SREG }, + { "tosultax", REG_AX, REG_AXY | REG_SREG }, + { "tosulteax", REG_EAX, REG_AXY | REG_PTR1 }, { "tosumod0ax", REG_AX, REG_ALL & ~REG_SAVE }, { "tosumoda0", REG_A, REG_EAXY | REG_PTR1 }, /* also ptr4 */ { "tosumodax", REG_AX, REG_EAXY | REG_PTR1 }, /* also ptr4 */ { "tosumodeax", REG_EAX, REG_ALL & ~REG_SAVE }, - { "tosumul0ax", REG_AX, REG_ALL }, - { "tosumula0", REG_A, REG_ALL }, - { "tosumulax", REG_AX, REG_ALL }, - { "tosumuleax", REG_EAX, REG_ALL }, + { "tosumul0ax", REG_AX, REG_ALL }, + { "tosumula0", REG_A, REG_ALL }, + { "tosumulax", REG_AX, REG_ALL }, + { "tosumuleax", REG_EAX, REG_ALL }, { "tosxor0ax", REG_AX, REG_EAXY | REG_TMP1 }, { "tosxora0", REG_A, REG_AXY | REG_TMP1 }, { "tosxorax", REG_AX, REG_AXY | REG_TMP1 }, @@ -334,34 +334,34 @@ static const FuncInfo FuncInfoTable[] = { { "tsteax", REG_EAX, REG_Y }, { "utsteax", REG_EAX, REG_Y }, }; -#define FuncInfoCount (sizeof(FuncInfoTable) / sizeof(FuncInfoTable[0])) +#define FuncInfoCount (sizeof(FuncInfoTable) / sizeof(FuncInfoTable[0])) /* Table with names of zero page locations used by the compiler */ static const ZPInfo ZPInfoTable[] = { - { 0, "ptr1", REG_PTR1_LO, REG_PTR1 }, - { 0, "ptr1+1", REG_PTR1_HI, REG_PTR1 }, - { 0, "ptr2", REG_PTR2_LO, REG_PTR2 }, - { 0, "ptr2+1", REG_PTR2_HI, REG_PTR2 }, - { 4, "ptr3", REG_NONE, REG_NONE }, - { 4, "ptr4", REG_NONE, REG_NONE }, - { 7, "regbank", REG_NONE, REG_NONE }, - { 0, "regsave", REG_SAVE_LO, REG_SAVE }, - { 0, "regsave+1", REG_SAVE_HI, REG_SAVE }, - { 0, "sp", REG_SP_LO, REG_SP }, + { 0, "ptr1", REG_PTR1_LO, REG_PTR1 }, + { 0, "ptr1+1", REG_PTR1_HI, REG_PTR1 }, + { 0, "ptr2", REG_PTR2_LO, REG_PTR2 }, + { 0, "ptr2+1", REG_PTR2_HI, REG_PTR2 }, + { 4, "ptr3", REG_NONE, REG_NONE }, + { 4, "ptr4", REG_NONE, REG_NONE }, + { 7, "regbank", REG_NONE, REG_NONE }, + { 0, "regsave", REG_SAVE_LO, REG_SAVE }, + { 0, "regsave+1", REG_SAVE_HI, REG_SAVE }, + { 0, "sp", REG_SP_LO, REG_SP }, { 0, "sp+1", REG_SP_HI, REG_SP }, - { 0, "sreg", REG_SREG_LO, REG_SREG }, - { 0, "sreg+1", REG_SREG_HI, REG_SREG }, - { 0, "tmp1", REG_TMP1, REG_TMP1 }, - { 0, "tmp2", REG_NONE, REG_NONE }, - { 0, "tmp3", REG_NONE, REG_NONE }, - { 0, "tmp4", REG_NONE, REG_NONE }, + { 0, "sreg", REG_SREG_LO, REG_SREG }, + { 0, "sreg+1", REG_SREG_HI, REG_SREG }, + { 0, "tmp1", REG_TMP1, REG_TMP1 }, + { 0, "tmp2", REG_NONE, REG_NONE }, + { 0, "tmp3", REG_NONE, REG_NONE }, + { 0, "tmp4", REG_NONE, REG_NONE }, }; -#define ZPInfoCount (sizeof(ZPInfoTable) / sizeof(ZPInfoTable[0])) +#define ZPInfoCount (sizeof(ZPInfoTable) / sizeof(ZPInfoTable[0])) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -369,7 +369,7 @@ static const ZPInfo ZPInfoTable[] = { static int CompareFuncInfo (const void* Key, const void* Info) /* Compare function for bsearch */ { - return strcmp (Key, ((const FuncInfo*) Info)->Name); + return strcmp (Key, ((const FuncInfo*) Info)->Name); } @@ -387,43 +387,43 @@ void GetFuncInfo (const char* Name, unsigned short* Use, unsigned short* Chg) */ if (Name[0] == '_') { - /* Search in the symbol table, skip the leading underscore */ - SymEntry* E = FindGlobalSym (Name+1); + /* Search in the symbol table, skip the leading underscore */ + SymEntry* E = FindGlobalSym (Name+1); - /* Did we find it in the top level table? */ - if (E && IsTypeFunc (E->Type)) { + /* Did we find it in the top level table? */ + if (E && IsTypeFunc (E->Type)) { FuncDesc* D = E->V.F.Func; - /* A function may use the A or A/X registers if it is a fastcall - * function. If it is not a fastcall function but a variadic one, - * it will use the Y register (the parameter size is passed here). - * In all other cases, no registers are used. However, we assume - * that any function will destroy all registers. - */ - if (IsQualFastcall (E->Type) && D->ParamCount > 0) { - /* Will use registers depending on the last param */ + /* A function may use the A or A/X registers if it is a fastcall + * function. If it is not a fastcall function but a variadic one, + * it will use the Y register (the parameter size is passed here). + * In all other cases, no registers are used. However, we assume + * that any function will destroy all registers. + */ + if (IsQualFastcall (E->Type) && D->ParamCount > 0) { + /* Will use registers depending on the last param */ unsigned LastParamSize = CheckedSizeOf (D->LastParam->Type); - if (LastParamSize == 1) { - *Use = REG_A; - } else if (LastParamSize == 2) { - *Use = REG_AX; - } else { + if (LastParamSize == 1) { + *Use = REG_A; + } else if (LastParamSize == 2) { + *Use = REG_AX; + } else { *Use = REG_EAX; } - } else if ((D->Flags & FD_VARIADIC) != 0) { - *Use = REG_Y; - } else { - /* Will not use any registers */ - *Use = REG_NONE; - } + } else if ((D->Flags & FD_VARIADIC) != 0) { + *Use = REG_Y; + } else { + /* Will not use any registers */ + *Use = REG_NONE; + } - /* Will destroy all registers */ - *Chg = REG_ALL; + /* Will destroy all registers */ + *Chg = REG_ALL; - /* Done */ - return; - } + /* Done */ + return; + } } else if (IsDigit (Name[0]) || Name[0] == '$') { @@ -437,16 +437,16 @@ void GetFuncInfo (const char* Name, unsigned short* Use, unsigned short* Chg) } else { - /* Search for the function in the list of builtin functions */ - const FuncInfo* Info = bsearch (Name, FuncInfoTable, FuncInfoCount, - sizeof(FuncInfo), CompareFuncInfo); + /* Search for the function in the list of builtin functions */ + const FuncInfo* Info = bsearch (Name, FuncInfoTable, FuncInfoCount, + sizeof(FuncInfo), CompareFuncInfo); - /* Do we know the function? */ - if (Info) { - /* Use the information we have */ - *Use = Info->Use; - *Chg = Info->Chg; - } else { + /* Do we know the function? */ + if (Info) { + /* Use the information we have */ + *Use = Info->Use; + *Chg = Info->Chg; + } else { /* It's an internal function we have no information for. If in * debug mode, output an additional warning, so we have a chance * to fix it. Otherwise assume that the internal function will @@ -481,16 +481,16 @@ static int CompareZPInfo (const void* Name, const void* Info) * more than just the zeropage name). */ if (E->Len == 0) { - /* Do a full compare */ - return strcmp (N, E->Name); + /* Do a full compare */ + return strcmp (N, E->Name); } else { - /* Only compare the first part */ - int Res = strncmp (N, E->Name, E->Len); - if (Res == 0 && (N[E->Len] != '\0' && N[E->Len] != '+')) { - /* Name is actually longer than Info->Name */ - Res = -1; - } - return Res; + /* Only compare the first part */ + int Res = strncmp (N, E->Name, E->Len); + if (Res == 0 && (N[E->Len] != '\0' && N[E->Len] != '+')) { + /* Name is actually longer than Info->Name */ + Res = -1; + } + return Res; } } @@ -503,103 +503,103 @@ const ZPInfo* GetZPInfo (const char* Name) { /* Search for the zp location in the list */ return bsearch (Name, ZPInfoTable, ZPInfoCount, - sizeof(ZPInfo), CompareZPInfo); + sizeof(ZPInfo), CompareZPInfo); } static unsigned GetRegInfo2 (CodeSeg* S, - CodeEntry* E, - int Index, - Collection* Visited, - unsigned Used, - unsigned Unused, - unsigned Wanted) + CodeEntry* E, + int Index, + Collection* Visited, + unsigned Used, + unsigned Unused, + unsigned Wanted) /* Recursively called subfunction for GetRegInfo. */ { /* Follow the instruction flow recording register usage. */ while (1) { - unsigned R; + unsigned R; - /* Check if we have already visited the current code entry. If so, - * bail out. - */ - if (CE_HasMark (E)) { - break; - } + /* Check if we have already visited the current code entry. If so, + * bail out. + */ + if (CE_HasMark (E)) { + break; + } - /* Mark this entry as already visited */ - CE_SetMark (E); - CollAppend (Visited, E); + /* Mark this entry as already visited */ + CE_SetMark (E); + CollAppend (Visited, E); - /* Evaluate the used registers */ - R = E->Use; - if (E->OPC == OP65_RTS || - ((E->Info & OF_UBRA) != 0 && E->JumpTo == 0)) { - /* This instruction will leave the function */ - R |= S->ExitRegs; - } - if (R != REG_NONE) { - /* We are not interested in the use of any register that has been - * used before. - */ - R &= ~Unused; - /* Remember the remaining registers */ - Used |= R; - } + /* Evaluate the used registers */ + R = E->Use; + if (E->OPC == OP65_RTS || + ((E->Info & OF_UBRA) != 0 && E->JumpTo == 0)) { + /* This instruction will leave the function */ + R |= S->ExitRegs; + } + if (R != REG_NONE) { + /* We are not interested in the use of any register that has been + * used before. + */ + R &= ~Unused; + /* Remember the remaining registers */ + Used |= R; + } - /* Evaluate the changed registers */ - if ((R = E->Chg) != REG_NONE) { - /* We are not interested in the use of any register that has been - * used before. - */ - R &= ~Used; - /* Remember the remaining registers */ - Unused |= R; - } + /* Evaluate the changed registers */ + if ((R = E->Chg) != REG_NONE) { + /* We are not interested in the use of any register that has been + * used before. + */ + R &= ~Used; + /* Remember the remaining registers */ + Unused |= R; + } - /* If we know about all registers now, bail out */ - if (((Used | Unused) & Wanted) == Wanted) { - break; - } + /* If we know about all registers now, bail out */ + if (((Used | Unused) & Wanted) == Wanted) { + break; + } - /* If the instruction is an RTS or RTI, we're done */ - if ((E->Info & OF_RET) != 0) { - break; - } + /* If the instruction is an RTS or RTI, we're done */ + if ((E->Info & OF_RET) != 0) { + break; + } - /* If we have an unconditional branch, follow this branch if possible, - * otherwise we're done. - */ - if ((E->Info & OF_UBRA) != 0) { + /* If we have an unconditional branch, follow this branch if possible, + * otherwise we're done. + */ + if ((E->Info & OF_UBRA) != 0) { - /* Does this jump have a valid target? */ - if (E->JumpTo) { + /* Does this jump have a valid target? */ + if (E->JumpTo) { - /* Unconditional jump */ - E = E->JumpTo->Owner; - Index = -1; /* Invalidate */ + /* Unconditional jump */ + E = E->JumpTo->Owner; + Index = -1; /* Invalidate */ - } else { - /* Jump outside means we're done */ - break; - } + } else { + /* Jump outside means we're done */ + break; + } - /* In case of conditional branches, follow the branch if possible and - * follow the normal flow (branch not taken) afterwards. If we cannot - * follow the branch, we're done. - */ - } else if ((E->Info & OF_CBRA) != 0) { + /* In case of conditional branches, follow the branch if possible and + * follow the normal flow (branch not taken) afterwards. If we cannot + * follow the branch, we're done. + */ + } else if ((E->Info & OF_CBRA) != 0) { /* Recursively determine register usage at the branch target */ - unsigned U1; - unsigned U2; + unsigned U1; + unsigned U2; - if (E->JumpTo) { + if (E->JumpTo) { /* Jump to internal label */ - U1 = GetRegInfo2 (S, E->JumpTo->Owner, -1, Visited, Used, Unused, Wanted); + U1 = GetRegInfo2 (S, E->JumpTo->Owner, -1, Visited, Used, Unused, Wanted); } else { @@ -624,19 +624,19 @@ static unsigned GetRegInfo2 (CodeSeg* S, /* Registers are used if they're use in any of the branches */ return U1 | U2; - } else { + } else { - /* Just go to the next instruction */ - if (Index < 0) { - Index = CS_GetEntryIndex (S, E); - } - E = CS_GetEntry (S, ++Index); - if (E == 0) { - /* No next entry */ - Internal ("GetRegInfo2: No next entry!"); - } + /* Just go to the next instruction */ + if (Index < 0) { + Index = CS_GetEntryIndex (S, E); + } + E = CS_GetEntry (S, ++Index); + if (E == 0) { + /* No next entry */ + Internal ("GetRegInfo2: No next entry!"); + } - } + } } @@ -647,12 +647,12 @@ static unsigned GetRegInfo2 (CodeSeg* S, static unsigned GetRegInfo1 (CodeSeg* S, - CodeEntry* E, - int Index, - Collection* Visited, - unsigned Used, - unsigned Unused, - unsigned Wanted) + CodeEntry* E, + int Index, + Collection* Visited, + unsigned Used, + unsigned Unused, + unsigned Wanted) /* Recursively called subfunction for GetRegInfo. */ { /* Remember the current count of the line collection */ @@ -664,9 +664,9 @@ static unsigned GetRegInfo1 (CodeSeg* S, /* Restore the old count, unmarking all new entries */ unsigned NewCount = CollCount (Visited); while (NewCount-- > Count) { - CodeEntry* E = CollAt (Visited, NewCount); - CE_ResetMark (E); - CollDelete (Visited, NewCount); + CodeEntry* E = CollAt (Visited, NewCount); + CE_ResetMark (E); + CollDelete (Visited, NewCount); } /* Return the registers used */ @@ -680,14 +680,14 @@ unsigned GetRegInfo (struct CodeSeg* S, unsigned Index, unsigned Wanted) * given index. */ { - CodeEntry* E; - Collection Visited; /* Visited entries */ + CodeEntry* E; + Collection Visited; /* Visited entries */ unsigned R; /* Get the code entry for the given index */ if (Index >= CS_GetEntryCount (S)) { - /* There is no such code entry */ - return REG_NONE; + /* There is no such code entry */ + return REG_NONE; } E = CS_GetEntry (S, Index); @@ -753,23 +753,23 @@ unsigned GetKnownReg (unsigned Use, const RegContents* RC) */ { if ((Use & REG_A) != 0) { - return (RC == 0 || RC->RegA >= 0)? REG_A : REG_NONE; + return (RC == 0 || RC->RegA >= 0)? REG_A : REG_NONE; } else if ((Use & REG_X) != 0) { - return (RC == 0 || RC->RegX >= 0)? REG_X : REG_NONE; + return (RC == 0 || RC->RegX >= 0)? REG_X : REG_NONE; } else if ((Use & REG_Y) != 0) { - return (RC == 0 || RC->RegY >= 0)? REG_Y : REG_NONE; + return (RC == 0 || RC->RegY >= 0)? REG_Y : REG_NONE; } else if ((Use & REG_TMP1) != 0) { - return (RC == 0 || RC->Tmp1 >= 0)? REG_TMP1 : REG_NONE; + return (RC == 0 || RC->Tmp1 >= 0)? REG_TMP1 : REG_NONE; } else if ((Use & REG_PTR1_LO) != 0) { - return (RC == 0 || RC->Ptr1Lo >= 0)? REG_PTR1_LO : REG_NONE; + return (RC == 0 || RC->Ptr1Lo >= 0)? REG_PTR1_LO : REG_NONE; } else if ((Use & REG_PTR1_HI) != 0) { - return (RC == 0 || RC->Ptr1Hi >= 0)? REG_PTR1_HI : REG_NONE; + return (RC == 0 || RC->Ptr1Hi >= 0)? REG_PTR1_HI : REG_NONE; } else if ((Use & REG_SREG_LO) != 0) { - return (RC == 0 || RC->SRegLo >= 0)? REG_SREG_LO : REG_NONE; + return (RC == 0 || RC->SRegLo >= 0)? REG_SREG_LO : REG_NONE; } else if ((Use & REG_SREG_HI) != 0) { - return (RC == 0 || RC->SRegHi >= 0)? REG_SREG_HI : REG_NONE; + return (RC == 0 || RC->SRegHi >= 0)? REG_SREG_HI : REG_NONE; } else { - return REG_NONE; + return REG_NONE; } } @@ -782,10 +782,10 @@ static cmp_t FindCmpCond (const char* Code, unsigned CodeLen) /* Linear search */ for (I = 0; I < sizeof (CmpSuffixTab) / sizeof (CmpSuffixTab [0]); ++I) { - if (strncmp (Code, CmpSuffixTab [I], CodeLen) == 0) { - /* Found */ - return I; - } + if (strncmp (Code, CmpSuffixTab [I], CodeLen) == 0) { + /* Found */ + return I; + } } /* Not found */ @@ -802,11 +802,11 @@ cmp_t FindBoolCmpCond (const char* Name) { /* Check for the correct subroutine name */ if (strncmp (Name, "bool", 4) == 0) { - /* Name is ok, search for the code in the table */ - return FindCmpCond (Name+4, strlen(Name)-4); + /* Name is ok, search for the code in the table */ + return FindCmpCond (Name+4, strlen(Name)-4); } else { - /* Not found */ - return CMP_INV; + /* Not found */ + return CMP_INV; } } @@ -821,11 +821,11 @@ cmp_t FindTosCmpCond (const char* Name) /* Check for the correct subroutine name */ if (strncmp (Name, "tos", 3) == 0 && strcmp (Name+Len-2, "ax") == 0) { - /* Name is ok, search for the code in the table */ - return FindCmpCond (Name+3, Len-3-2); + /* Name is ok, search for the code in the table */ + return FindCmpCond (Name+3, Len-3-2); } else { - /* Not found */ - return CMP_INV; + /* Not found */ + return CMP_INV; } } diff --git a/src/cc65/codeinfo.h b/src/cc65/codeinfo.h index 4e0b16887..68a08b5c8 100644 --- a/src/cc65/codeinfo.h +++ b/src/cc65/codeinfo.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codeinfo.h */ +/* codeinfo.h */ /* */ -/* Additional information about 6502 code */ +/* Additional information about 6502 code */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -49,7 +49,7 @@ struct CodeSeg; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,16 +58,16 @@ struct CodeSeg; struct RegContents; /* Defines for registers. */ -#define REG_NONE 0x0000U -#define REG_A 0x0001U -#define REG_X 0x0002U -#define REG_Y 0x0004U -#define REG_TMP1 0x0008U -#define REG_PTR1_LO 0x0010U -#define REG_PTR1_HI 0x0020U +#define REG_NONE 0x0000U +#define REG_A 0x0001U +#define REG_X 0x0002U +#define REG_Y 0x0004U +#define REG_TMP1 0x0008U +#define REG_PTR1_LO 0x0010U +#define REG_PTR1_HI 0x0020U #define REG_PTR2_LO 0x0040U #define REG_PTR2_HI 0x0080U -#define REG_SREG_LO 0x0100U +#define REG_SREG_LO 0x0100U #define REG_SREG_HI 0x0200U #define REG_SAVE_LO 0x0400U #define REG_SAVE_HI 0x0800U @@ -81,10 +81,10 @@ struct RegContents; #define REG_SREG (REG_SREG_LO | REG_SREG_HI) #define REG_SAVE (REG_SAVE_LO | REG_SAVE_HI) #define REG_SP (REG_SP_LO | REG_SP_HI) -#define REG_AX (REG_A | REG_X) +#define REG_AX (REG_A | REG_X) #define REG_AY (REG_A | REG_Y) -#define REG_XY (REG_X | REG_Y) -#define REG_AXY (REG_AX | REG_Y) +#define REG_XY (REG_X | REG_Y) +#define REG_AXY (REG_AX | REG_Y) #define REG_EAX (REG_AX | REG_SREG) #define REG_EAXY (REG_EAX | REG_Y) #define REG_ZP 0xFFF8U @@ -95,7 +95,7 @@ struct RegContents; /* Zero page register info */ typedef struct ZPInfo ZPInfo; struct ZPInfo { - unsigned char Len; /* Length of the following string */ + unsigned char Len; /* Length of the following string */ char Name[11]; /* Name of zero page symbol */ unsigned short ByteUse; /* Register info for this symbol */ unsigned short WordUse; /* Register info for 16 bit access */ @@ -121,7 +121,7 @@ typedef enum { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/codelab.c b/src/cc65/codelab.c index 9e3b93765..88de84dc1 100644 --- a/src/cc65/codelab.c +++ b/src/cc65/codelab.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codelab.c */ +/* codelab.c */ /* */ -/* Code label structure */ +/* Code label structure */ /* */ /* */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -108,12 +108,12 @@ void CL_MoveRefs (CodeLabel* OldLabel, CodeLabel* NewLabel) unsigned Count = CL_GetRefCount (OldLabel); while (Count--) { - /* Get the instruction that references the old label */ - CodeEntry* E = CL_GetRef (OldLabel, Count); + /* Get the instruction that references the old label */ + CodeEntry* E = CL_GetRef (OldLabel, Count); - /* Change the reference to the new label */ - CHECK (E->JumpTo == OldLabel); - CL_AddRef (NewLabel, E); + /* Change the reference to the new label */ + CHECK (E->JumpTo == OldLabel); + CL_AddRef (NewLabel, E); } @@ -128,8 +128,8 @@ void CL_Output (const CodeLabel* L) { WriteOutput ("%s:", L->Name); if (strlen (L->Name) > 6) { - /* Label is too long, add a linefeed */ - WriteOutput ("\n"); + /* Label is too long, add a linefeed */ + WriteOutput ("\n"); } } diff --git a/src/cc65/codelab.h b/src/cc65/codelab.h index 649c0a2b7..d38a30e82 100644 --- a/src/cc65/codelab.h +++ b/src/cc65/codelab.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codelab.h */ +/* codelab.h */ /* */ -/* Code label structure */ +/* Code label structure */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -54,7 +54,7 @@ struct CodeEntry; /*****************************************************************************/ -/* struct CodeLabel */ +/* struct CodeLabel */ /*****************************************************************************/ @@ -62,17 +62,17 @@ struct CodeEntry; /* Label structure */ typedef struct CodeLabel CodeLabel; struct CodeLabel { - CodeLabel* Next; /* Next in hash list */ - char* Name; /* Label name */ - unsigned Hash; /* Hash over the name */ - struct CodeEntry* Owner; /* Owner entry */ - Collection JumpFrom; /* Entries that jump here */ + CodeLabel* Next; /* Next in hash list */ + char* Name; /* Label name */ + unsigned Hash; /* Hash over the name */ + struct CodeEntry* Owner; /* Owner entry */ + Collection JumpFrom; /* Entries that jump here */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -90,7 +90,7 @@ INLINE unsigned CL_GetRefCount (const CodeLabel* L) return CollCount (&L->JumpFrom); } #else -# define CL_GetRefCount(L) CollCount (&(L)->JumpFrom) +# define CL_GetRefCount(L) CollCount (&(L)->JumpFrom) #endif #if defined(HAVE_INLINE) @@ -100,7 +100,7 @@ INLINE struct CodeEntry* CL_GetRef (CodeLabel* L, unsigned Index) return CollAt (&L->JumpFrom, Index); } #else -# define CL_GetRef(L, Index) CollAt (&(L)->JumpFrom, (Index)) +# define CL_GetRef(L, Index) CollAt (&(L)->JumpFrom, (Index)) #endif void CL_AddRef (CodeLabel* L, struct CodeEntry* E); diff --git a/src/cc65/codeopt.c b/src/cc65/codeopt.c index 9006ea8ff..a16364be4 100644 --- a/src/cc65/codeopt.c +++ b/src/cc65/codeopt.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codeopt.c */ +/* codeopt.c */ /* */ -/* Optimizer subroutines */ +/* Optimizer subroutines */ /* */ /* */ /* */ @@ -90,13 +90,13 @@ static unsigned OptLoad1 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* E; + CodeEntry* E; - /* Get next entry */ - E = CS_GetEntry (S, I); + /* Get next entry */ + E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (CE_IsCallTo (E, "ldaxysp") && + /* Check for the sequence */ + if (CE_IsCallTo (E, "ldaxysp") && RegValIsKnown (E->RI->In.RegY) && !RegXUsed (S, I+1)) { @@ -112,15 +112,15 @@ static unsigned OptLoad1 (CodeSeg* S) CS_InsertEntry (S, X, I+2); /* Now remove the call to the subroutine */ - CS_DelEntry (S, I); + CS_DelEntry (S, I); - /* Remember, we had changes */ + /* Remember, we had changes */ ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -140,13 +140,13 @@ static unsigned OptLoad2 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[3]; + CodeEntry* L[3]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (CE_IsCallTo (L[0], "ldaxysp")) { + /* Check for the sequence */ + if (CE_IsCallTo (L[0], "ldaxysp")) { CodeEntry* X; @@ -212,13 +212,13 @@ static unsigned OptLoad2 (CodeSeg* S) } - /* Remember, we had changes */ + /* Remember, we had changes */ ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } /* Return the number of changes made */ @@ -237,8 +237,8 @@ static unsigned OptLoad3 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); /* Forget a preceeding load if we have a label */ if (Load && CE_HasLabel (E)) { @@ -281,8 +281,8 @@ static unsigned OptLoad3 (CodeSeg* S) Load = 0; } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } /* Return the number of changes made */ @@ -292,7 +292,7 @@ static unsigned OptLoad3 (CodeSeg* S) /*****************************************************************************/ -/* Decouple operations */ +/* Decouple operations */ /*****************************************************************************/ @@ -310,7 +310,7 @@ static unsigned OptDecouple (CodeSeg* S) * tya -> lda #imm * lda zp -> lda #imm * ldx zp -> ldx #imm - * ldy zp -> ldy #imm + * ldy zp -> ldy #imm * * Provided that the register values are known of course. */ @@ -322,196 +322,196 @@ static unsigned OptDecouple (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - const char* Arg; + const char* Arg; - /* Get next entry and it's input register values */ - CodeEntry* E = CS_GetEntry (S, I); - const RegContents* In = &E->RI->In; + /* Get next entry and it's input register values */ + CodeEntry* E = CS_GetEntry (S, I); + const RegContents* In = &E->RI->In; - /* Assume we have no replacement */ - CodeEntry* X = 0; + /* Assume we have no replacement */ + CodeEntry* X = 0; - /* Check the instruction */ - switch (E->OPC) { + /* Check the instruction */ + switch (E->OPC) { - case OP65_DEA: - if (RegValIsKnown (In->RegA)) { - Arg = MakeHexArg ((In->RegA - 1) & 0xFF); - X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); - } - break; + case OP65_DEA: + if (RegValIsKnown (In->RegA)) { + Arg = MakeHexArg ((In->RegA - 1) & 0xFF); + X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); + } + break; - case OP65_DEX: - if (RegValIsKnown (In->RegX)) { - Arg = MakeHexArg ((In->RegX - 1) & 0xFF); - X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); - } - break; + case OP65_DEX: + if (RegValIsKnown (In->RegX)) { + Arg = MakeHexArg ((In->RegX - 1) & 0xFF); + X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); + } + break; - case OP65_DEY: - if (RegValIsKnown (In->RegY)) { - Arg = MakeHexArg ((In->RegY - 1) & 0xFF); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); - } - break; + case OP65_DEY: + if (RegValIsKnown (In->RegY)) { + Arg = MakeHexArg ((In->RegY - 1) & 0xFF); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); + } + break; - case OP65_INA: - if (RegValIsKnown (In->RegA)) { - Arg = MakeHexArg ((In->RegA + 1) & 0xFF); - X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); - } - break; + case OP65_INA: + if (RegValIsKnown (In->RegA)) { + Arg = MakeHexArg ((In->RegA + 1) & 0xFF); + X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); + } + break; - case OP65_INX: - if (RegValIsKnown (In->RegX)) { - Arg = MakeHexArg ((In->RegX + 1) & 0xFF); - X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); - } - break; + case OP65_INX: + if (RegValIsKnown (In->RegX)) { + Arg = MakeHexArg ((In->RegX + 1) & 0xFF); + X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); + } + break; - case OP65_INY: - if (RegValIsKnown (In->RegY)) { - Arg = MakeHexArg ((In->RegY + 1) & 0xFF); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); - } - break; + case OP65_INY: + if (RegValIsKnown (In->RegY)) { + Arg = MakeHexArg ((In->RegY + 1) & 0xFF); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); + } + break; - case OP65_LDA: - if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Use & REG_ZP, In)) { - case REG_TMP1: - Arg = MakeHexArg (In->Tmp1); - X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); - break; + case OP65_LDA: + if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Use & REG_ZP, In)) { + case REG_TMP1: + Arg = MakeHexArg (In->Tmp1); + X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); + break; - case REG_PTR1_LO: - Arg = MakeHexArg (In->Ptr1Lo); - X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); - break; + case REG_PTR1_LO: + Arg = MakeHexArg (In->Ptr1Lo); + X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); + break; - case REG_PTR1_HI: - Arg = MakeHexArg (In->Ptr1Hi); - X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); - break; + case REG_PTR1_HI: + Arg = MakeHexArg (In->Ptr1Hi); + X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); + break; - case REG_SREG_LO: - Arg = MakeHexArg (In->SRegLo); - X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); - break; + case REG_SREG_LO: + Arg = MakeHexArg (In->SRegLo); + X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); + break; - case REG_SREG_HI: - Arg = MakeHexArg (In->SRegHi); - X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); - break; - } - } - break; + case REG_SREG_HI: + Arg = MakeHexArg (In->SRegHi); + X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); + break; + } + } + break; - case OP65_LDX: - if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Use & REG_ZP, In)) { - case REG_TMP1: - Arg = MakeHexArg (In->Tmp1); - X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); - break; + case OP65_LDX: + if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Use & REG_ZP, In)) { + case REG_TMP1: + Arg = MakeHexArg (In->Tmp1); + X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); + break; - case REG_PTR1_LO: - Arg = MakeHexArg (In->Ptr1Lo); - X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); - break; + case REG_PTR1_LO: + Arg = MakeHexArg (In->Ptr1Lo); + X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); + break; - case REG_PTR1_HI: - Arg = MakeHexArg (In->Ptr1Hi); - X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); - break; + case REG_PTR1_HI: + Arg = MakeHexArg (In->Ptr1Hi); + X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); + break; - case REG_SREG_LO: - Arg = MakeHexArg (In->SRegLo); - X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); - break; + case REG_SREG_LO: + Arg = MakeHexArg (In->SRegLo); + X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); + break; - case REG_SREG_HI: - Arg = MakeHexArg (In->SRegHi); - X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); - break; - } - } - break; + case REG_SREG_HI: + Arg = MakeHexArg (In->SRegHi); + X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); + break; + } + } + break; - case OP65_LDY: - if (E->AM == AM65_ZP) { - switch (GetKnownReg (E->Use, In)) { - case REG_TMP1: - Arg = MakeHexArg (In->Tmp1); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); - break; + case OP65_LDY: + if (E->AM == AM65_ZP) { + switch (GetKnownReg (E->Use, In)) { + case REG_TMP1: + Arg = MakeHexArg (In->Tmp1); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); + break; - case REG_PTR1_LO: - Arg = MakeHexArg (In->Ptr1Lo); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); - break; + case REG_PTR1_LO: + Arg = MakeHexArg (In->Ptr1Lo); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); + break; - case REG_PTR1_HI: - Arg = MakeHexArg (In->Ptr1Hi); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); - break; + case REG_PTR1_HI: + Arg = MakeHexArg (In->Ptr1Hi); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); + break; - case REG_SREG_LO: - Arg = MakeHexArg (In->SRegLo); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); - break; + case REG_SREG_LO: + Arg = MakeHexArg (In->SRegLo); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); + break; - case REG_SREG_HI: - Arg = MakeHexArg (In->SRegHi); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); - break; - } - } - break; + case REG_SREG_HI: + Arg = MakeHexArg (In->SRegHi); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); + break; + } + } + break; - case OP65_TAX: - if (E->RI->In.RegA >= 0) { - Arg = MakeHexArg (In->RegA); - X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); - } - break; + case OP65_TAX: + if (E->RI->In.RegA >= 0) { + Arg = MakeHexArg (In->RegA); + X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, E->LI); + } + break; - case OP65_TAY: - if (E->RI->In.RegA >= 0) { - Arg = MakeHexArg (In->RegA); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); - } - break; + case OP65_TAY: + if (E->RI->In.RegA >= 0) { + Arg = MakeHexArg (In->RegA); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); + } + break; - case OP65_TXA: - if (E->RI->In.RegX >= 0) { - Arg = MakeHexArg (In->RegX); - X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); - } - break; + case OP65_TXA: + if (E->RI->In.RegX >= 0) { + Arg = MakeHexArg (In->RegX); + X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); + } + break; - case OP65_TYA: - if (E->RI->In.RegY >= 0) { - Arg = MakeHexArg (In->RegY); - X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); - } - break; + case OP65_TYA: + if (E->RI->In.RegY >= 0) { + Arg = MakeHexArg (In->RegY); + X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, E->LI); + } + break; - default: - /* Avoid gcc warnings */ - break; + default: + /* Avoid gcc warnings */ + break; - } + } - /* Insert the replacement if we have one */ - if (X) { - CS_InsertEntry (S, X, I+1); - CS_DelEntry (S, I); - ++Changes; - } + /* Insert the replacement if we have one */ + if (X) { + CS_InsertEntry (S, X, I+1); + CS_DelEntry (S, I); + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -599,12 +599,12 @@ static unsigned OptStackPtrOps (CodeSeg* S) CS_GenRegInfo (S); /* Remember we had changes */ - ++Changes; + ++Changes; - } else { + } else { /* Next entry */ - ++I; + ++I; } } @@ -616,7 +616,7 @@ static unsigned OptStackPtrOps (CodeSeg* S) /*****************************************************************************/ -/* struct OptFunc */ +/* struct OptFunc */ /*****************************************************************************/ @@ -626,7 +626,7 @@ struct OptFunc { unsigned (*Func) (CodeSeg*); /* Optimizer function */ const char* Name; /* Name of the function/group */ unsigned CodeSizeFactor; /* Code size factor for this opt func */ - unsigned long TotalRuns; /* Total number of runs */ + unsigned long TotalRuns; /* Total number of runs */ unsigned long LastRuns; /* Last number of runs */ unsigned long TotalChanges; /* Total number of changes */ unsigned long LastChanges; /* Last number of changes */ @@ -636,21 +636,21 @@ struct OptFunc { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ /* A list of all the function descriptions */ static OptFunc DOpt65C02BitOps = { Opt65C02BitOps, "Opt65C02BitOps", 66, 0, 0, 0, 0, 0 }; -static OptFunc DOpt65C02Ind = { Opt65C02Ind, "Opt65C02Ind", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOpt65C02Ind = { Opt65C02Ind, "Opt65C02Ind", 100, 0, 0, 0, 0, 0 }; static OptFunc DOpt65C02Stores = { Opt65C02Stores, "Opt65C02Stores", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptAdd1 = { OptAdd1, "OptAdd1", 125, 0, 0, 0, 0, 0 }; -static OptFunc DOptAdd2 = { OptAdd2, "OptAdd2", 200, 0, 0, 0, 0, 0 }; -static OptFunc DOptAdd3 = { OptAdd3, "OptAdd3", 65, 0, 0, 0, 0, 0 }; -static OptFunc DOptAdd4 = { OptAdd4, "OptAdd4", 90, 0, 0, 0, 0, 0 }; -static OptFunc DOptAdd5 = { OptAdd5, "OptAdd5", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptAdd6 = { OptAdd6, "OptAdd6", 40, 0, 0, 0, 0, 0 }; +static OptFunc DOptAdd1 = { OptAdd1, "OptAdd1", 125, 0, 0, 0, 0, 0 }; +static OptFunc DOptAdd2 = { OptAdd2, "OptAdd2", 200, 0, 0, 0, 0, 0 }; +static OptFunc DOptAdd3 = { OptAdd3, "OptAdd3", 65, 0, 0, 0, 0, 0 }; +static OptFunc DOptAdd4 = { OptAdd4, "OptAdd4", 90, 0, 0, 0, 0, 0 }; +static OptFunc DOptAdd5 = { OptAdd5, "OptAdd5", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptAdd6 = { OptAdd6, "OptAdd6", 40, 0, 0, 0, 0, 0 }; static OptFunc DOptBNegA1 = { OptBNegA1, "OptBNegA1", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptBNegA2 = { OptBNegA2, "OptBNegA2", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptBNegAX1 = { OptBNegAX1, "OptBNegAX1", 100, 0, 0, 0, 0, 0 }; @@ -658,26 +658,26 @@ static OptFunc DOptBNegAX2 = { OptBNegAX2, "OptBNegAX2", 100, 0, static OptFunc DOptBNegAX3 = { OptBNegAX3, "OptBNegAX3", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptBNegAX4 = { OptBNegAX4, "OptBNegAX4", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptBoolTrans = { OptBoolTrans, "OptBoolTrans", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptBranchDist = { OptBranchDist, "OptBranchDist", 0, 0, 0, 0, 0, 0 }; -static OptFunc DOptCmp1 = { OptCmp1, "OptCmp1", 42, 0, 0, 0, 0, 0 }; -static OptFunc DOptCmp2 = { OptCmp2, "OptCmp2", 85, 0, 0, 0, 0, 0 }; -static OptFunc DOptCmp3 = { OptCmp3, "OptCmp3", 75, 0, 0, 0, 0, 0 }; -static OptFunc DOptCmp4 = { OptCmp4, "OptCmp4", 75, 0, 0, 0, 0, 0 }; -static OptFunc DOptCmp5 = { OptCmp5, "OptCmp5", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptCmp6 = { OptCmp6, "OptCmp6", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptCmp7 = { OptCmp7, "OptCmp7", 85, 0, 0, 0, 0, 0 }; -static OptFunc DOptCmp8 = { OptCmp8, "OptCmp8", 50, 0, 0, 0, 0, 0 }; -static OptFunc DOptCmp9 = { OptCmp9, "OptCmp9", 85, 0, 0, 0, 0, 0 }; +static OptFunc DOptBranchDist = { OptBranchDist, "OptBranchDist", 0, 0, 0, 0, 0, 0 }; +static OptFunc DOptCmp1 = { OptCmp1, "OptCmp1", 42, 0, 0, 0, 0, 0 }; +static OptFunc DOptCmp2 = { OptCmp2, "OptCmp2", 85, 0, 0, 0, 0, 0 }; +static OptFunc DOptCmp3 = { OptCmp3, "OptCmp3", 75, 0, 0, 0, 0, 0 }; +static OptFunc DOptCmp4 = { OptCmp4, "OptCmp4", 75, 0, 0, 0, 0, 0 }; +static OptFunc DOptCmp5 = { OptCmp5, "OptCmp5", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptCmp6 = { OptCmp6, "OptCmp6", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptCmp7 = { OptCmp7, "OptCmp7", 85, 0, 0, 0, 0, 0 }; +static OptFunc DOptCmp8 = { OptCmp8, "OptCmp8", 50, 0, 0, 0, 0, 0 }; +static OptFunc DOptCmp9 = { OptCmp9, "OptCmp9", 85, 0, 0, 0, 0, 0 }; static OptFunc DOptComplAX1 = { OptComplAX1, "OptComplAX1", 65, 0, 0, 0, 0, 0 }; static OptFunc DOptCondBranches1= { OptCondBranches1,"OptCondBranches1", 80, 0, 0, 0, 0, 0 }; static OptFunc DOptCondBranches2= { OptCondBranches2,"OptCondBranches2", 0, 0, 0, 0, 0, 0 }; -static OptFunc DOptDeadCode = { OptDeadCode, "OptDeadCode", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptDeadJumps = { OptDeadJumps, "OptDeadJumps", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptDeadCode = { OptDeadCode, "OptDeadCode", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptDeadJumps = { OptDeadJumps, "OptDeadJumps", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptDecouple = { OptDecouple, "OptDecouple", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptDupLoads = { OptDupLoads, "OptDupLoads", 0, 0, 0, 0, 0, 0 }; static OptFunc DOptIndLoads1 = { OptIndLoads1, "OptIndLoads1", 0, 0, 0, 0, 0, 0 }; static OptFunc DOptIndLoads2 = { OptIndLoads2, "OptIndLoads2", 0, 0, 0, 0, 0, 0 }; -static OptFunc DOptJumpCascades = { OptJumpCascades, "OptJumpCascades", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptJumpCascades = { OptJumpCascades, "OptJumpCascades", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptJumpTarget1 = { OptJumpTarget1, "OptJumpTarget1", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptJumpTarget2 = { OptJumpTarget2, "OptJumpTarget2", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptJumpTarget3 = { OptJumpTarget3, "OptJumpTarget3", 100, 0, 0, 0, 0, 0 }; @@ -686,57 +686,57 @@ static OptFunc DOptLoad2 = { OptLoad2, "OptLoad2", 200, 0, static OptFunc DOptLoad3 = { OptLoad3, "OptLoad3", 0, 0, 0, 0, 0, 0 }; static OptFunc DOptNegAX1 = { OptNegAX1, "OptNegAX1", 165, 0, 0, 0, 0, 0 }; static OptFunc DOptNegAX2 = { OptNegAX2, "OptNegAX2", 200, 0, 0, 0, 0, 0 }; -static OptFunc DOptRTS = { OptRTS, "OptRTS", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptRTSJumps1 = { OptRTSJumps1, "OptRTSJumps1", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptRTSJumps2 = { OptRTSJumps2, "OptRTSJumps2", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptPrecalc = { OptPrecalc, "OptPrecalc", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad1 = { OptPtrLoad1, "OptPtrLoad1", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad2 = { OptPtrLoad2, "OptPtrLoad2", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad3 = { OptPtrLoad3, "OptPtrLoad3", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad4 = { OptPtrLoad4, "OptPtrLoad4", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad5 = { OptPtrLoad5, "OptPtrLoad5", 50, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad6 = { OptPtrLoad6, "OptPtrLoad6", 60, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad7 = { OptPtrLoad7, "OptPtrLoad7", 140, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad11 = { OptPtrLoad11, "OptPtrLoad11", 92, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad12 = { OptPtrLoad12, "OptPtrLoad12", 50, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad13 = { OptPtrLoad13, "OptPtrLoad13", 65, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad14 = { OptPtrLoad14, "OptPtrLoad14", 108, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad15 = { OptPtrLoad15, "OptPtrLoad15", 86, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad16 = { OptPtrLoad16, "OptPtrLoad16", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrLoad17 = { OptPtrLoad17, "OptPtrLoad17", 190, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrStore1 = { OptPtrStore1, "OptPtrStore1", 65, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrStore2 = { OptPtrStore2, "OptPtrStore2", 65, 0, 0, 0, 0, 0 }; -static OptFunc DOptPtrStore3 = { OptPtrStore3, "OptPtrStore3", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptPush1 = { OptPush1, "OptPush1", 65, 0, 0, 0, 0, 0 }; -static OptFunc DOptPush2 = { OptPush2, "OptPush2", 50, 0, 0, 0, 0, 0 }; +static OptFunc DOptRTS = { OptRTS, "OptRTS", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptRTSJumps1 = { OptRTSJumps1, "OptRTSJumps1", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptRTSJumps2 = { OptRTSJumps2, "OptRTSJumps2", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptPrecalc = { OptPrecalc, "OptPrecalc", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad1 = { OptPtrLoad1, "OptPtrLoad1", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad2 = { OptPtrLoad2, "OptPtrLoad2", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad3 = { OptPtrLoad3, "OptPtrLoad3", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad4 = { OptPtrLoad4, "OptPtrLoad4", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad5 = { OptPtrLoad5, "OptPtrLoad5", 50, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad6 = { OptPtrLoad6, "OptPtrLoad6", 60, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad7 = { OptPtrLoad7, "OptPtrLoad7", 140, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad11 = { OptPtrLoad11, "OptPtrLoad11", 92, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad12 = { OptPtrLoad12, "OptPtrLoad12", 50, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad13 = { OptPtrLoad13, "OptPtrLoad13", 65, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad14 = { OptPtrLoad14, "OptPtrLoad14", 108, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad15 = { OptPtrLoad15, "OptPtrLoad15", 86, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad16 = { OptPtrLoad16, "OptPtrLoad16", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrLoad17 = { OptPtrLoad17, "OptPtrLoad17", 190, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrStore1 = { OptPtrStore1, "OptPtrStore1", 65, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrStore2 = { OptPtrStore2, "OptPtrStore2", 65, 0, 0, 0, 0, 0 }; +static OptFunc DOptPtrStore3 = { OptPtrStore3, "OptPtrStore3", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptPush1 = { OptPush1, "OptPush1", 65, 0, 0, 0, 0, 0 }; +static OptFunc DOptPush2 = { OptPush2, "OptPush2", 50, 0, 0, 0, 0, 0 }; static OptFunc DOptPushPop = { OptPushPop, "OptPushPop", 0, 0, 0, 0, 0, 0 }; -static OptFunc DOptShift1 = { OptShift1, "OptShift1", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptShift2 = { OptShift2, "OptShift2", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptShift3 = { OptShift3, "OptShift3", 17, 0, 0, 0, 0, 0 }; -static OptFunc DOptShift4 = { OptShift4, "OptShift4", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptShift5 = { OptShift5, "OptShift5", 110, 0, 0, 0, 0, 0 }; -static OptFunc DOptShift6 = { OptShift6, "OptShift6", 200, 0, 0, 0, 0, 0 }; +static OptFunc DOptShift1 = { OptShift1, "OptShift1", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptShift2 = { OptShift2, "OptShift2", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptShift3 = { OptShift3, "OptShift3", 17, 0, 0, 0, 0, 0 }; +static OptFunc DOptShift4 = { OptShift4, "OptShift4", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptShift5 = { OptShift5, "OptShift5", 110, 0, 0, 0, 0, 0 }; +static OptFunc DOptShift6 = { OptShift6, "OptShift6", 200, 0, 0, 0, 0, 0 }; static OptFunc DOptSize1 = { OptSize1, "OptSize1", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptSize2 = { OptSize2, "OptSize2", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptStackOps = { OptStackOps, "OptStackOps", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptStackOps = { OptStackOps, "OptStackOps", 100, 0, 0, 0, 0, 0 }; static OptFunc DOptStackPtrOps = { OptStackPtrOps, "OptStackPtrOps", 50, 0, 0, 0, 0, 0 }; static OptFunc DOptStore1 = { OptStore1, "OptStore1", 70, 0, 0, 0, 0, 0 }; static OptFunc DOptStore2 = { OptStore2, "OptStore2", 115, 0, 0, 0, 0, 0 }; static OptFunc DOptStore3 = { OptStore3, "OptStore3", 120, 0, 0, 0, 0, 0 }; static OptFunc DOptStore4 = { OptStore4, "OptStore4", 50, 0, 0, 0, 0, 0 }; static OptFunc DOptStore5 = { OptStore5, "OptStore5", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptStoreLoad = { OptStoreLoad, "OptStoreLoad", 0, 0, 0, 0, 0, 0 }; -static OptFunc DOptSub1 = { OptSub1, "OptSub1", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptSub2 = { OptSub2, "OptSub2", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptSub3 = { OptSub3, "OptSub3", 100, 0, 0, 0, 0, 0 }; -static OptFunc DOptTest1 = { OptTest1, "OptTest1", 65, 0, 0, 0, 0, 0 }; -static OptFunc DOptTest2 = { OptTest2, "OptTest2", 50, 0, 0, 0, 0, 0 }; -static OptFunc DOptTransfers1 = { OptTransfers1, "OptTransfers1", 0, 0, 0, 0, 0, 0 }; -static OptFunc DOptTransfers2 = { OptTransfers2, "OptTransfers2", 60, 0, 0, 0, 0, 0 }; -static OptFunc DOptTransfers3 = { OptTransfers3, "OptTransfers3", 65, 0, 0, 0, 0, 0 }; -static OptFunc DOptTransfers4 = { OptTransfers4, "OptTransfers4", 65, 0, 0, 0, 0, 0 }; -static OptFunc DOptUnusedLoads = { OptUnusedLoads, "OptUnusedLoads", 0, 0, 0, 0, 0, 0 }; -static OptFunc DOptUnusedStores = { OptUnusedStores, "OptUnusedStores", 0, 0, 0, 0, 0, 0 }; +static OptFunc DOptStoreLoad = { OptStoreLoad, "OptStoreLoad", 0, 0, 0, 0, 0, 0 }; +static OptFunc DOptSub1 = { OptSub1, "OptSub1", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptSub2 = { OptSub2, "OptSub2", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptSub3 = { OptSub3, "OptSub3", 100, 0, 0, 0, 0, 0 }; +static OptFunc DOptTest1 = { OptTest1, "OptTest1", 65, 0, 0, 0, 0, 0 }; +static OptFunc DOptTest2 = { OptTest2, "OptTest2", 50, 0, 0, 0, 0, 0 }; +static OptFunc DOptTransfers1 = { OptTransfers1, "OptTransfers1", 0, 0, 0, 0, 0, 0 }; +static OptFunc DOptTransfers2 = { OptTransfers2, "OptTransfers2", 60, 0, 0, 0, 0, 0 }; +static OptFunc DOptTransfers3 = { OptTransfers3, "OptTransfers3", 65, 0, 0, 0, 0, 0 }; +static OptFunc DOptTransfers4 = { OptTransfers4, "OptTransfers4", 65, 0, 0, 0, 0, 0 }; +static OptFunc DOptUnusedLoads = { OptUnusedLoads, "OptUnusedLoads", 0, 0, 0, 0, 0, 0 }; +static OptFunc DOptUnusedStores = { OptUnusedStores, "OptUnusedStores", 0, 0, 0, 0, 0, 0 }; /* Table containing all the steps in alphabetical order */ @@ -869,8 +869,8 @@ static OptFunc* GetOptFunc (const char* Name) /* Search for the function in the list */ OptFunc* F = FindOptFunc (Name); if (F == 0) { - /* Not found */ - AbEnd ("Optimization step `%s' not found", Name); + /* Not found */ + AbEnd ("Optimization step `%s' not found", Name); } return F; } @@ -881,12 +881,12 @@ void DisableOpt (const char* Name) /* Disable the optimization with the given name */ { if (strcmp (Name, "any") == 0) { - unsigned I; - for (I = 0; I < OPTFUNC_COUNT; ++I) { - OptFuncs[I]->Disabled = 1; - } + unsigned I; + for (I = 0; I < OPTFUNC_COUNT; ++I) { + OptFuncs[I]->Disabled = 1; + } } else { - GetOptFunc(Name)->Disabled = 1; + GetOptFunc(Name)->Disabled = 1; } } @@ -896,12 +896,12 @@ void EnableOpt (const char* Name) /* Enable the optimization with the given name */ { if (strcmp (Name, "any") == 0) { - unsigned I; - for (I = 0; I < OPTFUNC_COUNT; ++I) { - OptFuncs[I]->Disabled = 0; - } + unsigned I; + for (I = 0; I < OPTFUNC_COUNT; ++I) { + OptFuncs[I]->Disabled = 0; + } } else { - GetOptFunc(Name)->Disabled = 0; + GetOptFunc(Name)->Disabled = 0; } } @@ -912,7 +912,7 @@ void ListOptSteps (FILE* F) { unsigned I; for (I = 0; I < OPTFUNC_COUNT; ++I) { - fprintf (F, "%s\n", OptFuncs[I]->Name); + fprintf (F, "%s\n", OptFuncs[I]->Name); } } @@ -927,60 +927,60 @@ static void ReadOptStats (const char* Name) /* Try to open the file */ FILE* F = fopen (Name, "r"); if (F == 0) { - /* Ignore the error */ - return; + /* Ignore the error */ + return; } /* Read and parse the lines */ Lines = 0; while (fgets (Buf, sizeof (Buf), F) != 0) { - char* B; - unsigned Len; - OptFunc* Func; + char* B; + unsigned Len; + OptFunc* Func; - /* Fields */ - char Name[32]; - unsigned long TotalRuns; - unsigned long TotalChanges; + /* Fields */ + char Name[32]; + unsigned long TotalRuns; + unsigned long TotalChanges; - /* Count lines */ - ++Lines; + /* Count lines */ + ++Lines; - /* Remove trailing white space including the line terminator */ - B = Buf; - Len = strlen (B); - while (Len > 0 && IsSpace (B[Len-1])) { - --Len; - } - B[Len] = '\0'; + /* Remove trailing white space including the line terminator */ + B = Buf; + Len = strlen (B); + while (Len > 0 && IsSpace (B[Len-1])) { + --Len; + } + B[Len] = '\0'; - /* Remove leading whitespace */ - while (IsSpace (*B)) { - ++B; - } + /* Remove leading whitespace */ + while (IsSpace (*B)) { + ++B; + } - /* Check for empty and comment lines */ - if (*B == '\0' || *B == ';' || *B == '#') { - continue; - } + /* Check for empty and comment lines */ + if (*B == '\0' || *B == ';' || *B == '#') { + continue; + } - /* Parse the line */ - if (sscanf (B, "%31s %lu %*u %lu %*u", Name, &TotalRuns, &TotalChanges) != 3) { - /* Syntax error */ - continue; - } + /* Parse the line */ + if (sscanf (B, "%31s %lu %*u %lu %*u", Name, &TotalRuns, &TotalChanges) != 3) { + /* Syntax error */ + continue; + } - /* Search for the optimizer step. */ - Func = FindOptFunc (Name); - if (Func == 0) { - /* Not found */ - continue; - } + /* Search for the optimizer step. */ + Func = FindOptFunc (Name); + if (Func == 0) { + /* Not found */ + continue; + } - /* Found the step, set the fields */ - Func->TotalRuns = TotalRuns; - Func->TotalChanges = TotalChanges; + /* Found the step, set the fields */ + Func->TotalRuns = TotalRuns; + Func->TotalChanges = TotalChanges; } @@ -998,26 +998,26 @@ static void WriteOptStats (const char* Name) /* Try to open the file */ FILE* F = fopen (Name, "w"); if (F == 0) { - /* Ignore the error */ - return; + /* Ignore the error */ + return; } /* Write a header */ fprintf (F, - "; Optimizer Total Last Total Last\n" - "; Step Runs Runs Chg Chg\n"); + "; Optimizer Total Last Total Last\n" + "; Step Runs Runs Chg Chg\n"); /* Write the data */ for (I = 0; I < OPTFUNC_COUNT; ++I) { - const OptFunc* O = OptFuncs[I]; - fprintf (F, - "%-20s %10lu %10lu %10lu %10lu\n", - O->Name, - O->TotalRuns, - O->LastRuns, - O->TotalChanges, - O->LastChanges); + const OptFunc* O = OptFuncs[I]; + fprintf (F, + "%-20s %10lu %10lu %10lu %10lu\n", + O->Name, + O->TotalRuns, + O->LastRuns, + O->TotalChanges, + O->LastChanges); } /* Close the file, ignore errors here. */ @@ -1077,22 +1077,22 @@ static unsigned RunOptFunc (CodeSeg* S, OptFunc* F, unsigned Max) * code size factor */ if (F->Disabled || F->CodeSizeFactor > S->CodeSizeFactor) { - return 0; + return 0; } /* Run this until there are no more changes */ Changes = 0; do { - /* Run the function */ - C = F->Func (S); - Changes += C; + /* Run the function */ + C = F->Func (S); + Changes += C; - /* Do statistics */ - ++F->TotalRuns; - ++F->LastRuns; - F->TotalChanges += C; - F->LastChanges += C; + /* Do statistics */ + ++F->TotalRuns; + ++F->LastRuns; + F->TotalChanges += C; + F->LastChanges += C; /* If we had changes, output stuff and regenerate register info */ if (C) { @@ -1193,56 +1193,56 @@ static unsigned RunOptGroup3 (CodeSeg* S) Changes = 0; do { - C = 0; + C = 0; - C += RunOptFunc (S, &DOptBNegA1, 1); - C += RunOptFunc (S, &DOptBNegA2, 1); + C += RunOptFunc (S, &DOptBNegA1, 1); + C += RunOptFunc (S, &DOptBNegA2, 1); C += RunOptFunc (S, &DOptNegAX1, 1); C += RunOptFunc (S, &DOptNegAX2, 1); - C += RunOptFunc (S, &DOptStackOps, 3); + C += RunOptFunc (S, &DOptStackOps, 3); C += RunOptFunc (S, &DOptShift1, 1); C += RunOptFunc (S, &DOptShift4, 1); C += RunOptFunc (S, &DOptComplAX1, 1); - C += RunOptFunc (S, &DOptSub1, 1); - C += RunOptFunc (S, &DOptSub2, 1); - C += RunOptFunc (S, &DOptSub3, 1); - C += RunOptFunc (S, &DOptAdd5, 1); - C += RunOptFunc (S, &DOptAdd6, 1); - C += RunOptFunc (S, &DOptJumpCascades, 1); - C += RunOptFunc (S, &DOptDeadJumps, 1); - C += RunOptFunc (S, &DOptRTS, 1); - C += RunOptFunc (S, &DOptDeadCode, 1); - C += RunOptFunc (S, &DOptBoolTrans, 1); - C += RunOptFunc (S, &DOptJumpTarget1, 1); - C += RunOptFunc (S, &DOptJumpTarget2, 1); - C += RunOptFunc (S, &DOptCondBranches1, 1); - C += RunOptFunc (S, &DOptCondBranches2, 1); - C += RunOptFunc (S, &DOptRTSJumps1, 1); - C += RunOptFunc (S, &DOptCmp1, 1); - C += RunOptFunc (S, &DOptCmp2, 1); - C += RunOptFunc (S, &DOptCmp8, 1); /* Must run before OptCmp3 */ - C += RunOptFunc (S, &DOptCmp3, 1); - C += RunOptFunc (S, &DOptCmp4, 1); - C += RunOptFunc (S, &DOptCmp5, 1); - C += RunOptFunc (S, &DOptCmp6, 1); - C += RunOptFunc (S, &DOptCmp7, 1); - C += RunOptFunc (S, &DOptCmp9, 1); - C += RunOptFunc (S, &DOptTest1, 1); + C += RunOptFunc (S, &DOptSub1, 1); + C += RunOptFunc (S, &DOptSub2, 1); + C += RunOptFunc (S, &DOptSub3, 1); + C += RunOptFunc (S, &DOptAdd5, 1); + C += RunOptFunc (S, &DOptAdd6, 1); + C += RunOptFunc (S, &DOptJumpCascades, 1); + C += RunOptFunc (S, &DOptDeadJumps, 1); + C += RunOptFunc (S, &DOptRTS, 1); + C += RunOptFunc (S, &DOptDeadCode, 1); + C += RunOptFunc (S, &DOptBoolTrans, 1); + C += RunOptFunc (S, &DOptJumpTarget1, 1); + C += RunOptFunc (S, &DOptJumpTarget2, 1); + C += RunOptFunc (S, &DOptCondBranches1, 1); + C += RunOptFunc (S, &DOptCondBranches2, 1); + C += RunOptFunc (S, &DOptRTSJumps1, 1); + C += RunOptFunc (S, &DOptCmp1, 1); + C += RunOptFunc (S, &DOptCmp2, 1); + C += RunOptFunc (S, &DOptCmp8, 1); /* Must run before OptCmp3 */ + C += RunOptFunc (S, &DOptCmp3, 1); + C += RunOptFunc (S, &DOptCmp4, 1); + C += RunOptFunc (S, &DOptCmp5, 1); + C += RunOptFunc (S, &DOptCmp6, 1); + C += RunOptFunc (S, &DOptCmp7, 1); + C += RunOptFunc (S, &DOptCmp9, 1); + C += RunOptFunc (S, &DOptTest1, 1); C += RunOptFunc (S, &DOptLoad1, 1); - C += RunOptFunc (S, &DOptJumpTarget3, 1); /* After OptCondBranches2 */ - C += RunOptFunc (S, &DOptUnusedLoads, 1); - C += RunOptFunc (S, &DOptUnusedStores, 1); - C += RunOptFunc (S, &DOptDupLoads, 1); - C += RunOptFunc (S, &DOptStoreLoad, 1); - C += RunOptFunc (S, &DOptTransfers1, 1); - C += RunOptFunc (S, &DOptTransfers3, 1); - C += RunOptFunc (S, &DOptTransfers4, 1); - C += RunOptFunc (S, &DOptStore1, 1); - C += RunOptFunc (S, &DOptStore5, 1); + C += RunOptFunc (S, &DOptJumpTarget3, 1); /* After OptCondBranches2 */ + C += RunOptFunc (S, &DOptUnusedLoads, 1); + C += RunOptFunc (S, &DOptUnusedStores, 1); + C += RunOptFunc (S, &DOptDupLoads, 1); + C += RunOptFunc (S, &DOptStoreLoad, 1); + C += RunOptFunc (S, &DOptTransfers1, 1); + C += RunOptFunc (S, &DOptTransfers3, 1); + C += RunOptFunc (S, &DOptTransfers4, 1); + C += RunOptFunc (S, &DOptStore1, 1); + C += RunOptFunc (S, &DOptStore5, 1); C += RunOptFunc (S, &DOptPushPop, 1); C += RunOptFunc (S, &DOptPrecalc, 1); - Changes += C; + Changes += C; } while (C); @@ -1283,15 +1283,15 @@ static unsigned RunOptGroup5 (CodeSeg* S) if (CPUIsets[CPU] & CPU_ISET_65SC02) { Changes += RunOptFunc (S, &DOpt65C02BitOps, 1); - Changes += RunOptFunc (S, &DOpt65C02Ind, 1); + Changes += RunOptFunc (S, &DOpt65C02Ind, 1); Changes += RunOptFunc (S, &DOpt65C02Stores, 1); - if (Changes) { + if (Changes) { /* The 65C02 replacement codes do often make the use of a register * value unnecessary, so if we have changes, run another load * removal pass. */ - Changes += RunOptFunc (S, &DOptUnusedLoads, 1); - } + Changes += RunOptFunc (S, &DOptUnusedLoads, 1); + } } /* Return the number of changes */ @@ -1371,7 +1371,7 @@ static unsigned RunOptGroup7 (CodeSeg* S) C = RunOptFunc (S, &DOptRTSJumps2, 1); Changes += C; if (C) { - Changes += RunOptFunc (S, &DOptDeadCode, 1); + Changes += RunOptFunc (S, &DOptDeadCode, 1); } /* Return the number of changes */ @@ -1387,20 +1387,20 @@ void RunOpt (CodeSeg* S) /* If we shouldn't run the optimizer, bail out */ if (!S->Optimize) { - return; + return; } /* Check if we are requested to write optimizer statistics */ StatFileName = getenv ("CC65_OPTSTATS"); if (StatFileName) { - ReadOptStats (StatFileName); + ReadOptStats (StatFileName); } /* Print the name of the function we are working on */ if (S->Func) { - Print (stdout, 1, "Running optimizer for function `%s'\n", S->Func->Name); + Print (stdout, 1, "Running optimizer for function `%s'\n", S->Func->Name); } else { - Print (stdout, 1, "Running optimizer for global code segment\n"); + Print (stdout, 1, "Running optimizer for global code segment\n"); } /* If requested, open an output file */ @@ -1429,7 +1429,7 @@ void RunOpt (CodeSeg* S) /* Write statistics */ if (StatFileName) { - WriteOptStats (StatFileName); + WriteOptStats (StatFileName); } } diff --git a/src/cc65/codeopt.h b/src/cc65/codeopt.h index 4ee2626aa..7ce2fa844 100644 --- a/src/cc65/codeopt.h +++ b/src/cc65/codeopt.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codeopt.h */ +/* codeopt.h */ /* */ -/* Optimizer subroutines */ +/* Optimizer subroutines */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/codeseg.c b/src/cc65/codeseg.c index fff502d3e..c28f32651 100644 --- a/src/cc65/codeseg.c +++ b/src/cc65/codeseg.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codeseg.c */ +/* codeseg.c */ /* */ -/* Code segment structure */ +/* Code segment structure */ /* */ /* */ /* */ @@ -61,7 +61,7 @@ /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -95,11 +95,11 @@ static void CS_MoveLabelsToEntry (CodeSeg* S, CodeEntry* E) unsigned LabelCount = CollCount (&S->Labels); for (I = 0; I < LabelCount; ++I) { - /* Get the label */ - CodeLabel* L = CollAt (&S->Labels, I); + /* Get the label */ + CodeLabel* L = CollAt (&S->Labels, I); - /* Attach it to the entry */ - CE_AttachLabel (E, L); + /* Attach it to the entry */ + CE_AttachLabel (E, L); } /* Delete the transfered labels */ @@ -113,9 +113,9 @@ static void CS_MoveLabelsToPool (CodeSeg* S, CodeEntry* E) { unsigned LabelCount = CE_GetLabelCount (E); while (LabelCount--) { - CodeLabel* L = CE_GetLabel (E, LabelCount); - L->Owner = 0; - CollAppend (&S->Labels, L); + CodeLabel* L = CE_GetLabel (E, LabelCount); + L->Owner = 0; + CollAppend (&S->Labels, L); } CollDeleteAll (&E->Labels); } @@ -130,11 +130,11 @@ static CodeLabel* CS_FindLabel (CodeSeg* S, const char* Name, unsigned Hash) /* Search the list */ while (L) { - if (strcmp (Name, L->Name) == 0) { - /* Found */ - break; - } - L = L->Next; + if (strcmp (Name, L->Name) == 0) { + /* Found */ + break; + } + L = L->Next; } return L; } @@ -166,25 +166,25 @@ static void CS_RemoveLabelFromHash (CodeSeg* S, CodeLabel* L) /* First, remove the label from the hash chain */ if (List == L) { - /* First entry in hash chain */ - S->LabelHash[L->Hash] = L->Next; + /* First entry in hash chain */ + S->LabelHash[L->Hash] = L->Next; } else { - /* Must search through the chain */ - while (List->Next != L) { - /* If we've reached the end of the chain, something is *really* wrong */ - CHECK (List->Next != 0); - /* Next entry */ - List = List->Next; - } - /* The next entry is the one, we have been searching for */ - List->Next = L->Next; + /* Must search through the chain */ + while (List->Next != L) { + /* If we've reached the end of the chain, something is *really* wrong */ + CHECK (List->Next != 0); + /* Next entry */ + List = List->Next; + } + /* The next entry is the one, we have been searching for */ + List->Next = L->Next; } } /*****************************************************************************/ -/* Functions for parsing instructions */ +/* Functions for parsing instructions */ /*****************************************************************************/ @@ -193,7 +193,7 @@ static const char* SkipSpace (const char* S) /* Skip white space and return an updated pointer */ { while (IsSpace (*S)) { - ++S; + ++S; } return S; } @@ -201,7 +201,7 @@ static const char* SkipSpace (const char* S) static const char* ReadToken (const char* L, const char* Term, - char* Buf, unsigned BufSize) + char* Buf, unsigned BufSize) /* Read the next token into Buf, return the updated line pointer. The * token is terminated by one of the characters given in term. */ @@ -210,21 +210,21 @@ static const char* ReadToken (const char* L, const char* Term, unsigned I = 0; unsigned ParenCount = 0; while (*L && (ParenCount > 0 || strchr (Term, *L) == 0)) { - if (I < BufSize-1) { - Buf[I] = *L; - } else if (I == BufSize-1) { - /* Cannot store this character, this is an input error (maybe - * identifier too long or similar). - */ - Error ("ASM code error: syntax error"); - } - ++I; - if (*L == ')') { - --ParenCount; - } else if (*L == '(') { - ++ParenCount; - } - ++L; + if (I < BufSize-1) { + Buf[I] = *L; + } else if (I == BufSize-1) { + /* Cannot store this character, this is an input error (maybe + * identifier too long or similar). + */ + Error ("ASM code error: syntax error"); + } + ++I; + if (*L == ')') { + --ParenCount; + } else if (*L == '(') { + ++ParenCount; + } + ++L; } /* Terminate the buffer contents */ @@ -245,12 +245,12 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L) */ { char Mnemo[IDENTSIZE+10]; - const OPCDesc* OPC; - am_t AM = 0; /* Initialize to keep gcc silent */ + const OPCDesc* OPC; + am_t AM = 0; /* Initialize to keep gcc silent */ char Arg[IDENTSIZE+10]; - char Reg; - CodeEntry* E; - CodeLabel* Label; + char Reg; + CodeEntry* E; + CodeLabel* Label; /* Read the first token and skip white space after it */ L = SkipSpace (ReadToken (L, " \t:", Mnemo, sizeof (Mnemo))); @@ -258,20 +258,20 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L) /* Check if we have a label */ if (*L == ':') { - /* Skip the colon and following white space */ - L = SkipSpace (L+1); + /* Skip the colon and following white space */ + L = SkipSpace (L+1); - /* Add the label */ - CS_AddLabel (S, Mnemo); + /* Add the label */ + CS_AddLabel (S, Mnemo); - /* If we have reached end of line, bail out, otherwise a mnemonic - * may follow. - */ - if (*L == '\0') { - return 0; - } + /* If we have reached end of line, bail out, otherwise a mnemonic + * may follow. + */ + if (*L == '\0') { + return 0; + } - L = SkipSpace (ReadToken (L, " \t", Mnemo, sizeof (Mnemo))); + L = SkipSpace (ReadToken (L, " \t", Mnemo, sizeof (Mnemo))); } /* Try to find the opcode description for the mnemonic */ @@ -279,138 +279,138 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L) /* If we didn't find the opcode, print an error and bail out */ if (OPC == 0) { - Error ("ASM code error: %s is not a valid mnemonic", Mnemo); - return 0; + Error ("ASM code error: %s is not a valid mnemonic", Mnemo); + return 0; } /* Get the addressing mode */ Arg[0] = '\0'; switch (*L) { - case '\0': - /* Implicit or accu */ + case '\0': + /* Implicit or accu */ if (OPC->Info & OF_NOIMP) { AM = AM65_ACC; } else { AM = AM65_IMP; } - break; + break; - case '#': - /* Immidiate */ - StrCopy (Arg, sizeof (Arg), L+1); - AM = AM65_IMM; - break; + case '#': + /* Immidiate */ + StrCopy (Arg, sizeof (Arg), L+1); + AM = AM65_IMM; + break; - case '(': - /* Indirect */ - L = ReadToken (L+1, ",)", Arg, sizeof (Arg)); + case '(': + /* Indirect */ + L = ReadToken (L+1, ",)", Arg, sizeof (Arg)); - /* Check for errors */ - if (*L == '\0') { - Error ("ASM code error: syntax error"); - return 0; - } + /* Check for errors */ + if (*L == '\0') { + Error ("ASM code error: syntax error"); + return 0; + } - /* Check the different indirect modes */ - if (*L == ',') { - /* Expect zp x indirect */ - L = SkipSpace (L+1); - if (toupper (*L) != 'X') { - Error ("ASM code error: `X' expected"); - return 0; - } - L = SkipSpace (L+1); - if (*L != ')') { - Error ("ASM code error: `)' expected"); - return 0; - } - L = SkipSpace (L+1); - if (*L != '\0') { - Error ("ASM code error: syntax error"); - return 0; - } - AM = AM65_ZPX_IND; - } else if (*L == ')') { - /* zp indirect or zp indirect, y */ - L = SkipSpace (L+1); - if (*L == ',') { - L = SkipSpace (L+1); - if (toupper (*L) != 'Y') { - Error ("ASM code error: `Y' expected"); - return 0; - } - L = SkipSpace (L+1); - if (*L != '\0') { - Error ("ASM code error: syntax error"); - return 0; - } - AM = AM65_ZP_INDY; - } else if (*L == '\0') { - AM = AM65_ZP_IND; - } else { - Error ("ASM code error: syntax error"); - return 0; - } - } - break; + /* Check the different indirect modes */ + if (*L == ',') { + /* Expect zp x indirect */ + L = SkipSpace (L+1); + if (toupper (*L) != 'X') { + Error ("ASM code error: `X' expected"); + return 0; + } + L = SkipSpace (L+1); + if (*L != ')') { + Error ("ASM code error: `)' expected"); + return 0; + } + L = SkipSpace (L+1); + if (*L != '\0') { + Error ("ASM code error: syntax error"); + return 0; + } + AM = AM65_ZPX_IND; + } else if (*L == ')') { + /* zp indirect or zp indirect, y */ + L = SkipSpace (L+1); + if (*L == ',') { + L = SkipSpace (L+1); + if (toupper (*L) != 'Y') { + Error ("ASM code error: `Y' expected"); + return 0; + } + L = SkipSpace (L+1); + if (*L != '\0') { + Error ("ASM code error: syntax error"); + return 0; + } + AM = AM65_ZP_INDY; + } else if (*L == '\0') { + AM = AM65_ZP_IND; + } else { + Error ("ASM code error: syntax error"); + return 0; + } + } + break; - case 'a': - case 'A': - /* Accumulator? */ - if (L[1] == '\0') { - AM = AM65_ACC; - break; - } - /* FALLTHROUGH */ + case 'a': + case 'A': + /* Accumulator? */ + if (L[1] == '\0') { + AM = AM65_ACC; + break; + } + /* FALLTHROUGH */ - default: - /* Absolute, maybe indexed */ - L = ReadToken (L, ",", Arg, sizeof (Arg)); - if (*L == '\0') { - /* Absolute, zeropage or branch */ - if ((OPC->Info & OF_BRA) != 0) { - /* Branch */ - AM = AM65_BRA; - } else if (GetZPInfo(Arg) != 0) { - AM = AM65_ZP; - } else { + default: + /* Absolute, maybe indexed */ + L = ReadToken (L, ",", Arg, sizeof (Arg)); + if (*L == '\0') { + /* Absolute, zeropage or branch */ + if ((OPC->Info & OF_BRA) != 0) { + /* Branch */ + AM = AM65_BRA; + } else if (GetZPInfo(Arg) != 0) { + AM = AM65_ZP; + } else { /* Check for subroutine call to local label */ if ((OPC->Info & OF_CALL) && IsLocalLabelName (Arg)) { Error ("ASM code error: " "Cannot use local label `%s' in subroutine call", Arg); } - AM = AM65_ABS; - } - } else if (*L == ',') { - /* Indexed */ - L = SkipSpace (L+1); - if (*L == '\0') { - Error ("ASM code error: syntax error"); - return 0; - } else { - Reg = toupper (*L); - L = SkipSpace (L+1); - if (Reg == 'X') { - if (GetZPInfo(Arg) != 0) { - AM = AM65_ZPX; - } else { - AM = AM65_ABSX; - } - } else if (Reg == 'Y') { - AM = AM65_ABSY; - } else { - Error ("ASM code error: syntax error"); - return 0; - } - if (*L != '\0') { - Error ("ASM code error: syntax error"); - return 0; - } - } - } - break; + AM = AM65_ABS; + } + } else if (*L == ',') { + /* Indexed */ + L = SkipSpace (L+1); + if (*L == '\0') { + Error ("ASM code error: syntax error"); + return 0; + } else { + Reg = toupper (*L); + L = SkipSpace (L+1); + if (Reg == 'X') { + if (GetZPInfo(Arg) != 0) { + AM = AM65_ZPX; + } else { + AM = AM65_ABSX; + } + } else if (Reg == 'Y') { + AM = AM65_ABSY; + } else { + Error ("ASM code error: syntax error"); + return 0; + } + if (*L != '\0') { + Error ("ASM code error: syntax error"); + return 0; + } + } + } + break; } @@ -422,15 +422,15 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L) Label = 0; if (AM == AM65_BRA) { - /* Generate the hash over the label, then search for the label */ - unsigned Hash = HashStr (Arg) % CS_LABEL_HASH_SIZE; - Label = CS_FindLabel (S, Arg, Hash); + /* Generate the hash over the label, then search for the label */ + unsigned Hash = HashStr (Arg) % CS_LABEL_HASH_SIZE; + Label = CS_FindLabel (S, Arg, Hash); - /* If we don't have the label, it's a forward ref - create it */ - if (Label == 0) { - /* Generate a new label */ - Label = CS_NewCodeLabel (S, Arg, Hash); - } + /* If we don't have the label, it's a forward ref - create it */ + if (Label == 0) { + /* Generate a new label */ + Label = CS_NewCodeLabel (S, Arg, Hash); + } } /* We do now have the addressing mode in AM. Allocate a new CodeEntry @@ -445,7 +445,7 @@ static CodeEntry* ParseInsn (CodeSeg* S, LineInfo* LI, const char* L) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -461,24 +461,24 @@ CodeSeg* NewCodeSeg (const char* SegName, SymEntry* Func) /* Initialize the fields */ S->SegName = xstrdup (SegName); - S->Func = Func; + S->Func = Func; InitCollection (&S->Entries); InitCollection (&S->Labels); for (I = 0; I < sizeof(S->LabelHash) / sizeof(S->LabelHash[0]); ++I) { - S->LabelHash[I] = 0; + S->LabelHash[I] = 0; } /* If we have a function given, get the return type of the function. * Assume ANY return type besides void will use the A and X registers. */ if (S->Func && !IsTypeVoid ((RetType = GetFuncReturn (Func->Type)))) { - if (SizeOf (RetType) == SizeOf (type_long)) { - S->ExitRegs = REG_EAX; - } else { - S->ExitRegs = REG_AX; - } + if (SizeOf (RetType) == SizeOf (type_long)) { + S->ExitRegs = REG_EAX; + } else { + S->ExitRegs = REG_AX; + } } else { - S->ExitRegs = REG_NONE; + S->ExitRegs = REG_NONE; } /* Copy the global optimization settings */ @@ -518,31 +518,31 @@ void CS_AddVLine (CodeSeg* S, LineInfo* LI, const char* Format, va_list ap) L = SkipSpace (SB_GetConstBuf (&Buf)); /* Check which type of instruction we have */ - E = 0; /* Assume no insn created */ + E = 0; /* Assume no insn created */ switch (*L) { - case '\0': - /* Empty line, just ignore it */ - break; + case '\0': + /* Empty line, just ignore it */ + break; - case ';': - /* Comment or hint, ignore it for now */ - break; + case ';': + /* Comment or hint, ignore it for now */ + break; - case '.': - /* Control instruction */ - ReadToken (L, " \t", Token, sizeof (Token)); - Error ("ASM code error: Pseudo instruction `%s' not supported", Token); - break; + case '.': + /* Control instruction */ + ReadToken (L, " \t", Token, sizeof (Token)); + Error ("ASM code error: Pseudo instruction `%s' not supported", Token); + break; - default: - E = ParseInsn (S, LI, L); - break; + default: + E = ParseInsn (S, LI, L); + break; } /* If we have a code entry, transfer the labels and insert it */ if (E) { - CS_AddEntry (S, E); + CS_AddEntry (S, E); } /* Cleanup the string buffer */ @@ -593,31 +593,31 @@ void CS_DelEntry (CodeSeg* S, unsigned Index) unsigned Count = CE_GetLabelCount (E); if (Count > 0) { - /* The instruction has labels attached. Check if there is a next - * instruction. - */ - if (Index == CS_GetEntryCount (S)-1) { + /* The instruction has labels attached. Check if there is a next + * instruction. + */ + if (Index == CS_GetEntryCount (S)-1) { - /* No next instruction, move to the codeseg label pool */ - CS_MoveLabelsToPool (S, E); + /* No next instruction, move to the codeseg label pool */ + CS_MoveLabelsToPool (S, E); - } else { + } else { - /* There is a next insn, get it */ - CodeEntry* N = CS_GetEntry (S, Index+1); + /* There is a next insn, get it */ + CodeEntry* N = CS_GetEntry (S, Index+1); - /* Move labels to the next entry */ - CS_MoveLabels (S, E, N); + /* Move labels to the next entry */ + CS_MoveLabels (S, E, N); - } + } } /* If this insn references a label, remove the reference. And, if the * the reference count for this label drops to zero, remove this label. */ if (E->JumpTo) { - /* Remove the reference */ - CS_RemoveLabelRef (S, E); + /* Remove the reference */ + CS_RemoveLabelRef (S, E); } /* Delete the pointer to the insn */ @@ -638,7 +638,7 @@ void CS_DelEntries (CodeSeg* S, unsigned Start, unsigned Count) * memory moving. */ while (Count--) { - CS_DelEntry (S, Start + Count); + CS_DelEntry (S, Start + Count); } } @@ -664,7 +664,7 @@ void CS_MoveEntries (CodeSeg* S, unsigned Start, unsigned Count, unsigned NewPos * label pool to the first instruction of the moved range. */ if (NewPos == CS_GetEntryCount (S)) { - CS_MoveLabelsToEntry (S, CS_GetEntry (S, Start)); + CS_MoveLabelsToEntry (S, CS_GetEntry (S, Start)); } /* Move the code block to the destination */ @@ -679,11 +679,11 @@ struct CodeEntry* CS_GetPrevEntry (CodeSeg* S, unsigned Index) */ { if (Index == 0) { - /* This is the first entry */ - return 0; + /* This is the first entry */ + return 0; } else { - /* Previous entry available */ - return CollAtUnchecked (&S->Entries, Index-1); + /* Previous entry available */ + return CollAtUnchecked (&S->Entries, Index-1); } } @@ -695,30 +695,30 @@ struct CodeEntry* CS_GetNextEntry (CodeSeg* S, unsigned Index) */ { if (Index >= CollCount (&S->Entries)-1) { - /* This is the last entry */ - return 0; + /* This is the last entry */ + return 0; } else { - /* Code entries left */ - return CollAtUnchecked (&S->Entries, Index+1); + /* Code entries left */ + return CollAtUnchecked (&S->Entries, Index+1); } } int CS_GetEntries (CodeSeg* S, struct CodeEntry** List, - unsigned Start, unsigned Count) + unsigned Start, unsigned Count) /* Get Count code entries into List starting at index start. Return true if * we got the lines, return false if not enough lines were available. */ { /* Check if enough entries are available */ if (Start + Count > CollCount (&S->Entries)) { - return 0; + return 0; } /* Copy the entries */ while (Count--) { - *List++ = CollAtUnchecked (&S->Entries, Start++); + *List++ = CollAtUnchecked (&S->Entries, Start++); } /* We have the entries */ @@ -748,17 +748,17 @@ int CS_RangeHasLabel (CodeSeg* S, unsigned Start, unsigned Count) /* Adjust count. We expect at least Start to be valid. */ CHECK (Start < EntryCount); if (Start + Count > EntryCount) { - Count = EntryCount - Start; + Count = EntryCount - Start; } /* Check each entry. Since we have validated the index above, we may * use the unchecked access function in the loop which is faster. */ while (Count--) { - const CodeEntry* E = CollAtUnchecked (&S->Entries, Start++); - if (CE_HasLabel (E)) { - return 1; - } + const CodeEntry* E = CollAtUnchecked (&S->Entries, Start++); + if (CE_HasLabel (E)) { + return 1; + } } /* No label in the complete range */ @@ -778,19 +778,19 @@ CodeLabel* CS_AddLabel (CodeSeg* S, const char* Name) /* Did we find it? */ if (L) { - /* We found it - be sure it does not already have an owner */ - if (L->Owner) { - Error ("ASM label `%s' is already defined", Name); + /* We found it - be sure it does not already have an owner */ + if (L->Owner) { + Error ("ASM label `%s' is already defined", Name); return L; - } + } } else { - /* Not found - create a new one */ - L = CS_NewCodeLabel (S, Name, Hash); + /* Not found - create a new one */ + L = CS_NewCodeLabel (S, Name, Hash); } /* Safety. This call is quite costly, but safety is better */ if (CollIndex (&S->Labels, L) >= 0) { - Error ("ASM label `%s' is already defined", Name); + Error ("ASM label `%s' is already defined", Name); return L; } @@ -812,22 +812,22 @@ CodeLabel* CS_GenLabel (CodeSeg* S, struct CodeEntry* E) if (CE_HasLabel (E)) { - /* Get the label from this entry */ - L = CE_GetLabel (E, 0); + /* Get the label from this entry */ + L = CE_GetLabel (E, 0); } else { - /* Get a new name */ - const char* Name = LocalLabelName (GetLocalLabel ()); + /* Get a new name */ + const char* Name = LocalLabelName (GetLocalLabel ()); - /* Generate the hash over the name */ - unsigned Hash = HashStr (Name) % CS_LABEL_HASH_SIZE; + /* Generate the hash over the name */ + unsigned Hash = HashStr (Name) % CS_LABEL_HASH_SIZE; - /* Create a new label */ - L = CS_NewCodeLabel (S, Name, Hash); + /* Create a new label */ + L = CS_NewCodeLabel (S, Name, Hash); - /* Attach this label to the code entry */ - CE_AttachLabel (E, L); + /* Attach this label to the code entry */ + CE_AttachLabel (E, L); } @@ -848,10 +848,10 @@ void CS_DelLabel (CodeSeg* S, CodeLabel* L) /* Remove references from insns jumping to this label */ Count = CollCount (&L->JumpFrom); for (I = 0; I < Count; ++I) { - /* Get the insn referencing this label */ - CodeEntry* E = CollAt (&L->JumpFrom, I); - /* Remove the reference */ - CE_ClearJumpTo (E); + /* Get the insn referencing this label */ + CodeEntry* E = CollAt (&L->JumpFrom, I); + /* Remove the reference */ + CE_ClearJumpTo (E); } CollDeleteAll (&L->JumpFrom); @@ -861,7 +861,7 @@ void CS_DelLabel (CodeSeg* S, CodeLabel* L) * errors to slip through. */ if (L->Owner) { - CollDeleteItem (&L->Owner->Labels, L); + CollDeleteItem (&L->Owner->Labels, L); } /* All references removed, delete the label itself */ @@ -884,83 +884,83 @@ void CS_MergeLabels (CodeSeg* S) */ for (I = 0; I < CS_LABEL_HASH_SIZE; ++I) { - /* Get the first label in this hash chain */ - CodeLabel** L = &S->LabelHash[I]; - while (*L) { - if ((*L)->Owner == 0) { + /* Get the first label in this hash chain */ + CodeLabel** L = &S->LabelHash[I]; + while (*L) { + if ((*L)->Owner == 0) { - /* The label does not have an owner, remove it from the chain */ - CodeLabel* X = *L; - *L = X->Next; + /* The label does not have an owner, remove it from the chain */ + CodeLabel* X = *L; + *L = X->Next; - /* Cleanup any entries jumping to this label */ - for (J = 0; J < CL_GetRefCount (X); ++J) { - /* Get the entry referencing this label */ - CodeEntry* E = CL_GetRef (X, J); - /* And remove the reference. Do NOT call CE_ClearJumpTo + /* Cleanup any entries jumping to this label */ + for (J = 0; J < CL_GetRefCount (X); ++J) { + /* Get the entry referencing this label */ + CodeEntry* E = CL_GetRef (X, J); + /* And remove the reference. Do NOT call CE_ClearJumpTo * here, because this will also clear the label name, * which is not what we want. */ - E->JumpTo = 0; - } + E->JumpTo = 0; + } - /* Print some debugging output */ - if (Debug) { - printf ("Removing unused global label `%s'", X->Name); - } + /* Print some debugging output */ + if (Debug) { + printf ("Removing unused global label `%s'", X->Name); + } - /* And free the label */ - FreeCodeLabel (X); - } else { - /* Label is owned, point to next code label pointer */ - L = &((*L)->Next); - } - } + /* And free the label */ + FreeCodeLabel (X); + } else { + /* Label is owned, point to next code label pointer */ + L = &((*L)->Next); + } + } } /* Walk over all code entries */ for (I = 0; I < CS_GetEntryCount (S); ++I) { - CodeLabel* RefLab; - unsigned J; + CodeLabel* RefLab; + unsigned J; - /* Get a pointer to the next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get a pointer to the next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* If this entry has zero labels, continue with the next one */ - unsigned LabelCount = CE_GetLabelCount (E); - if (LabelCount == 0) { - continue; - } + /* If this entry has zero labels, continue with the next one */ + unsigned LabelCount = CE_GetLabelCount (E); + if (LabelCount == 0) { + continue; + } - /* We have at least one label. Use the first one as reference label. */ - RefLab = CE_GetLabel (E, 0); + /* We have at least one label. Use the first one as reference label. */ + RefLab = CE_GetLabel (E, 0); - /* Walk through the remaining labels and change references to these - * labels to a reference to the one and only label. Delete the labels - * that are no longer used. To increase performance, walk backwards - * through the list. - */ - for (J = LabelCount-1; J >= 1; --J) { + /* Walk through the remaining labels and change references to these + * labels to a reference to the one and only label. Delete the labels + * that are no longer used. To increase performance, walk backwards + * through the list. + */ + for (J = LabelCount-1; J >= 1; --J) { - /* Get the next label */ - CodeLabel* L = CE_GetLabel (E, J); + /* Get the next label */ + CodeLabel* L = CE_GetLabel (E, J); - /* Move all references from this label to the reference label */ - CL_MoveRefs (L, RefLab); + /* Move all references from this label to the reference label */ + CL_MoveRefs (L, RefLab); - /* Remove the label completely. */ - CS_DelLabel (S, L); - } + /* Remove the label completely. */ + CS_DelLabel (S, L); + } - /* The reference label is the only remaining label. Check if there - * are any references to this label, and delete it if this is not - * the case. - */ - if (CollCount (&RefLab->JumpFrom) == 0) { - /* Delete the label */ - CS_DelLabel (S, RefLab); - } + /* The reference label is the only remaining label. Check if there + * are any references to this label, and delete it if this is not + * the case. + */ + if (CollCount (&RefLab->JumpFrom) == 0) { + /* Delete the label */ + CS_DelLabel (S, RefLab); + } } } @@ -979,30 +979,30 @@ void CS_MoveLabels (CodeSeg* S, struct CodeEntry* Old, struct CodeEntry* New) /* Does the new entry have itself a label? */ if (CE_HasLabel (New)) { - /* The new entry does already have a label - move references */ - CodeLabel* NewLabel = CE_GetLabel (New, 0); - while (OldLabelCount--) { + /* The new entry does already have a label - move references */ + CodeLabel* NewLabel = CE_GetLabel (New, 0); + while (OldLabelCount--) { - /* Get the next label */ - CodeLabel* OldLabel = CE_GetLabel (Old, OldLabelCount); + /* Get the next label */ + CodeLabel* OldLabel = CE_GetLabel (Old, OldLabelCount); - /* Move references */ - CL_MoveRefs (OldLabel, NewLabel); + /* Move references */ + CL_MoveRefs (OldLabel, NewLabel); - /* Delete the label */ - CS_DelLabel (S, OldLabel); + /* Delete the label */ + CS_DelLabel (S, OldLabel); - } + } } else { - /* The new entry does not have a label, just move them */ - while (OldLabelCount--) { + /* The new entry does not have a label, just move them */ + while (OldLabelCount--) { - /* Move the label to the new entry */ - CE_MoveLabel (CE_GetLabel (Old, OldLabelCount), New); + /* Move the label to the new entry */ + CE_MoveLabel (CE_GetLabel (Old, OldLabelCount), New); - } + } } } @@ -1028,7 +1028,7 @@ void CS_RemoveLabelRef (CodeSeg* S, struct CodeEntry* E) /* If there are no more references, delete the label */ if (CollCount (&L->JumpFrom) == 0) { - CS_DelLabel (S, L); + CS_DelLabel (S, L); } } @@ -1088,8 +1088,8 @@ void CS_DelCodeRange (CodeSeg* S, unsigned First, unsigned Last) /* There is an entry after Last - move the labels */ CS_MoveLabels (S, FirstEntry, FollowingEntry); } else { - /* Move the labels to the pool and clear the owner pointer */ - CS_MoveLabelsToPool (S, FirstEntry); + /* Move the labels to the pool and clear the owner pointer */ + CS_MoveLabelsToPool (S, FirstEntry); } } @@ -1098,19 +1098,19 @@ void CS_DelCodeRange (CodeSeg* S, unsigned First, unsigned Last) */ for (I = Last; I >= First; --I) { - /* Get the next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get the next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if this entry has a label reference */ - if (E->JumpTo) { + /* Check if this entry has a label reference */ + if (E->JumpTo) { - /* If the label is a label in the label pool, this is an error */ - CodeLabel* L = E->JumpTo; - CHECK (CollIndex (&S->Labels, L) < 0); + /* If the label is a label in the label pool, this is an error */ + CodeLabel* L = E->JumpTo; + CHECK (CollIndex (&S->Labels, L) < 0); - /* Remove the reference to the label */ - CS_RemoveLabelRef (S, E); - } + /* Remove the reference to the label */ + CS_RemoveLabelRef (S, E); + } } /* Second pass: Delete the instructions. If a label attached to an @@ -1119,17 +1119,17 @@ void CS_DelCodeRange (CodeSeg* S, unsigned First, unsigned Last) */ for (I = Last; I >= First; --I) { - /* Get the next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get the next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if this entry has a label attached */ - CHECK (!CE_HasLabel (E)); + /* Check if this entry has a label attached */ + CHECK (!CE_HasLabel (E)); - /* Delete the pointer to the entry */ - CollDelete (&S->Entries, I); + /* Delete the pointer to the entry */ + CollDelete (&S->Entries, I); - /* Delete the entry itself */ - FreeCodeEntry (E); + /* Delete the entry itself */ + FreeCodeEntry (E); } } @@ -1147,24 +1147,24 @@ void CS_DelCodeAfter (CodeSeg* S, unsigned Last) unsigned C = Count; while (Last < C--) { - /* Get the next entry */ - CodeEntry* E = CS_GetEntry (S, C); + /* Get the next entry */ + CodeEntry* E = CS_GetEntry (S, C); - /* Check if this entry has a label reference */ - if (E->JumpTo) { - /* If the label is a label in the label pool and this is the last - * reference to the label, remove the label from the pool. - */ - CodeLabel* L = E->JumpTo; - int Index = CollIndex (&S->Labels, L); - if (Index >= 0 && CollCount (&L->JumpFrom) == 1) { - /* Delete it from the pool */ - CollDelete (&S->Labels, Index); - } + /* Check if this entry has a label reference */ + if (E->JumpTo) { + /* If the label is a label in the label pool and this is the last + * reference to the label, remove the label from the pool. + */ + CodeLabel* L = E->JumpTo; + int Index = CollIndex (&S->Labels, L); + if (Index >= 0 && CollCount (&L->JumpFrom) == 1) { + /* Delete it from the pool */ + CollDelete (&S->Labels, Index); + } - /* Remove the reference to the label */ - CS_RemoveLabelRef (S, E); - } + /* Remove the reference to the label */ + CS_RemoveLabelRef (S, E); + } } @@ -1176,20 +1176,20 @@ void CS_DelCodeAfter (CodeSeg* S, unsigned Last) C = Count; while (Last < C--) { - /* Get the next entry */ - CodeEntry* E = CS_GetEntry (S, C); + /* Get the next entry */ + CodeEntry* E = CS_GetEntry (S, C); - /* Check if this entry has a label attached */ - if (CE_HasLabel (E)) { - /* Move the labels to the pool and clear the owner pointer */ - CS_MoveLabelsToPool (S, E); - } + /* Check if this entry has a label attached */ + if (CE_HasLabel (E)) { + /* Move the labels to the pool and clear the owner pointer */ + CS_MoveLabelsToPool (S, E); + } - /* Delete the pointer to the entry */ - CollDelete (&S->Entries, C); + /* Delete the pointer to the entry */ + CollDelete (&S->Entries, C); - /* Delete the entry itself */ - FreeCodeEntry (E); + /* Delete the entry itself */ + FreeCodeEntry (E); } } @@ -1331,7 +1331,7 @@ void CS_OutputPrologue (const CodeSeg* S) */ if (Func) { /* Get the function descriptor */ - CS_PrintFunctionHeader (S); + CS_PrintFunctionHeader (S); WriteOutput (".segment\t\"%s\"\n\n.proc\t_%s", S->SegName, Func->Name); if (IsQualNear (Func->Type)) { WriteOutput (": near"); @@ -1351,7 +1351,7 @@ void CS_OutputEpilogue (const CodeSeg* S) */ { if (S->Func) { - WriteOutput ("\n.endproc\n\n"); + WriteOutput ("\n.endproc\n\n"); } } @@ -1368,7 +1368,7 @@ void CS_Output (CodeSeg* S) /* If the code segment is empty, bail out here */ if (Count == 0) { - return; + return; } /* Generate register info */ @@ -1380,20 +1380,20 @@ void CS_Output (CodeSeg* S) /* Output all entries, prepended by the line information if it has changed */ LI = 0; for (I = 0; I < Count; ++I) { - /* Get the next entry */ - const CodeEntry* E = CollConstAt (&S->Entries, I); - /* Check if the line info has changed. If so, output the source line - * if the option is enabled and output debug line info if the debug - * option is enabled. - */ - if (E->LI != LI) { - /* Line info has changed, remember the new line info */ - LI = E->LI; + /* Get the next entry */ + const CodeEntry* E = CollConstAt (&S->Entries, I); + /* Check if the line info has changed. If so, output the source line + * if the option is enabled and output debug line info if the debug + * option is enabled. + */ + if (E->LI != LI) { + /* Line info has changed, remember the new line info */ + LI = E->LI; - /* Add the source line as a comment. Beware: When line continuation + /* Add the source line as a comment. Beware: When line continuation * was used, the line may contain newlines. */ - if (AddSource) { + if (AddSource) { const char* L = LI->Line; WriteOutput (";\n; "); while (*L) { @@ -1409,21 +1409,21 @@ void CS_Output (CodeSeg* S) } } WriteOutput (";\n"); - } + } - /* Add line debug info */ - if (DebugInfo) { - WriteOutput ("\t.dbg\tline, \"%s\", %u\n", - GetInputName (LI), GetInputLine (LI)); - } - } - /* Output the code */ - CE_Output (E); + /* Add line debug info */ + if (DebugInfo) { + WriteOutput ("\t.dbg\tline, \"%s\", %u\n", + GetInputName (LI), GetInputLine (LI)); + } + } + /* Output the code */ + CE_Output (E); } /* If debug info is enabled, terminate the last line number information */ if (DebugInfo) { - WriteOutput ("\t.dbg\tline\n"); + WriteOutput ("\t.dbg\tline\n"); } /* Free register info */ @@ -1447,7 +1447,7 @@ void CS_GenRegInfo (CodeSeg* S) /* Generate register infos for all instructions */ { unsigned I; - RegContents Regs; /* Initial register contents */ + RegContents Regs; /* Initial register contents */ RegContents* CurrentRegs; /* Current register contents */ int WasJump; /* True if last insn was a jump */ int Done; /* All runs done flag */ @@ -1458,225 +1458,225 @@ void CS_GenRegInfo (CodeSeg* S) /* We may need two runs to get back references right */ do { - /* Assume we're done after this run */ - Done = 1; + /* Assume we're done after this run */ + Done = 1; - /* On entry, the register contents are unknown */ - RC_Invalidate (&Regs); - CurrentRegs = &Regs; + /* On entry, the register contents are unknown */ + RC_Invalidate (&Regs); + CurrentRegs = &Regs; - /* Walk over all insns and note just the changes from one insn to the - * next one. - */ - WasJump = 0; - for (I = 0; I < CS_GetEntryCount (S); ++I) { + /* Walk over all insns and note just the changes from one insn to the + * next one. + */ + WasJump = 0; + for (I = 0; I < CS_GetEntryCount (S); ++I) { - CodeEntry* P; + CodeEntry* P; - /* Get the next instruction */ - CodeEntry* E = CollAtUnchecked (&S->Entries, I); + /* Get the next instruction */ + CodeEntry* E = CollAtUnchecked (&S->Entries, I); - /* If the instruction has a label, we need some special handling */ - unsigned LabelCount = CE_GetLabelCount (E); - if (LabelCount > 0) { + /* If the instruction has a label, we need some special handling */ + unsigned LabelCount = CE_GetLabelCount (E); + if (LabelCount > 0) { - /* Loop over all entry points that jump here. If these entry - * points already have register info, check if all values are - * known and identical. If all values are identical, and the - * preceeding instruction was not an unconditional branch, check - * if the register value on exit of the preceeding instruction - * is also identical. If all these values are identical, the - * value of a register is known, otherwise it is unknown. - */ - CodeLabel* Label = CE_GetLabel (E, 0); - unsigned Entry; - if (WasJump) { - /* Preceeding insn was an unconditional branch */ - CodeEntry* J = CL_GetRef(Label, 0); - if (J->RI) { - Regs = J->RI->Out2; - } else { - RC_Invalidate (&Regs); - } - Entry = 1; - } else { - Regs = *CurrentRegs; - Entry = 0; - } + /* Loop over all entry points that jump here. If these entry + * points already have register info, check if all values are + * known and identical. If all values are identical, and the + * preceeding instruction was not an unconditional branch, check + * if the register value on exit of the preceeding instruction + * is also identical. If all these values are identical, the + * value of a register is known, otherwise it is unknown. + */ + CodeLabel* Label = CE_GetLabel (E, 0); + unsigned Entry; + if (WasJump) { + /* Preceeding insn was an unconditional branch */ + CodeEntry* J = CL_GetRef(Label, 0); + if (J->RI) { + Regs = J->RI->Out2; + } else { + RC_Invalidate (&Regs); + } + Entry = 1; + } else { + Regs = *CurrentRegs; + Entry = 0; + } - while (Entry < CL_GetRefCount (Label)) { - /* Get this entry */ - CodeEntry* J = CL_GetRef (Label, Entry); - if (J->RI == 0) { - /* No register info for this entry. This means that the - * instruction that jumps here is at higher addresses and - * the jump is a backward jump. We need a second run to - * get the register info right in this case. Until then, - * assume unknown register contents. - */ - Done = 0; - RC_Invalidate (&Regs); - break; - } - if (J->RI->Out2.RegA != Regs.RegA) { - Regs.RegA = UNKNOWN_REGVAL; - } - if (J->RI->Out2.RegX != Regs.RegX) { - Regs.RegX = UNKNOWN_REGVAL; - } - if (J->RI->Out2.RegY != Regs.RegY) { - Regs.RegY = UNKNOWN_REGVAL; - } - if (J->RI->Out2.SRegLo != Regs.SRegLo) { - Regs.SRegLo = UNKNOWN_REGVAL; - } - if (J->RI->Out2.SRegHi != Regs.SRegHi) { - Regs.SRegHi = UNKNOWN_REGVAL; - } - if (J->RI->Out2.Tmp1 != Regs.Tmp1) { - Regs.Tmp1 = UNKNOWN_REGVAL; - } - ++Entry; - } + while (Entry < CL_GetRefCount (Label)) { + /* Get this entry */ + CodeEntry* J = CL_GetRef (Label, Entry); + if (J->RI == 0) { + /* No register info for this entry. This means that the + * instruction that jumps here is at higher addresses and + * the jump is a backward jump. We need a second run to + * get the register info right in this case. Until then, + * assume unknown register contents. + */ + Done = 0; + RC_Invalidate (&Regs); + break; + } + if (J->RI->Out2.RegA != Regs.RegA) { + Regs.RegA = UNKNOWN_REGVAL; + } + if (J->RI->Out2.RegX != Regs.RegX) { + Regs.RegX = UNKNOWN_REGVAL; + } + if (J->RI->Out2.RegY != Regs.RegY) { + Regs.RegY = UNKNOWN_REGVAL; + } + if (J->RI->Out2.SRegLo != Regs.SRegLo) { + Regs.SRegLo = UNKNOWN_REGVAL; + } + if (J->RI->Out2.SRegHi != Regs.SRegHi) { + Regs.SRegHi = UNKNOWN_REGVAL; + } + if (J->RI->Out2.Tmp1 != Regs.Tmp1) { + Regs.Tmp1 = UNKNOWN_REGVAL; + } + ++Entry; + } - /* Use this register info */ - CurrentRegs = &Regs; + /* Use this register info */ + CurrentRegs = &Regs; - } + } - /* Generate register info for this instruction */ - CE_GenRegInfo (E, CurrentRegs); + /* Generate register info for this instruction */ + CE_GenRegInfo (E, CurrentRegs); - /* Remember for the next insn if this insn was an uncondition branch */ - WasJump = (E->Info & OF_UBRA) != 0; + /* Remember for the next insn if this insn was an uncondition branch */ + WasJump = (E->Info & OF_UBRA) != 0; - /* Output registers for this insn are input for the next */ - CurrentRegs = &E->RI->Out; + /* Output registers for this insn are input for the next */ + CurrentRegs = &E->RI->Out; - /* If this insn is a branch on zero flag, we may have more info on - * register contents for one of both flow directions, but only if - * there is a previous instruction. - */ - if ((E->Info & OF_ZBRA) != 0 && (P = CS_GetPrevEntry (S, I)) != 0) { + /* If this insn is a branch on zero flag, we may have more info on + * register contents for one of both flow directions, but only if + * there is a previous instruction. + */ + if ((E->Info & OF_ZBRA) != 0 && (P = CS_GetPrevEntry (S, I)) != 0) { - /* Get the branch condition */ - bc_t BC = GetBranchCond (E->OPC); + /* Get the branch condition */ + bc_t BC = GetBranchCond (E->OPC); - /* Check the previous instruction */ - switch (P->OPC) { + /* Check the previous instruction */ + switch (P->OPC) { - case OP65_ADC: - case OP65_AND: - case OP65_DEA: - case OP65_EOR: - case OP65_INA: - case OP65_LDA: - case OP65_ORA: - case OP65_PLA: - case OP65_SBC: - /* A is zero in one execution flow direction */ - if (BC == BC_EQ) { - E->RI->Out2.RegA = 0; - } else { - E->RI->Out.RegA = 0; - } - break; + case OP65_ADC: + case OP65_AND: + case OP65_DEA: + case OP65_EOR: + case OP65_INA: + case OP65_LDA: + case OP65_ORA: + case OP65_PLA: + case OP65_SBC: + /* A is zero in one execution flow direction */ + if (BC == BC_EQ) { + E->RI->Out2.RegA = 0; + } else { + E->RI->Out.RegA = 0; + } + break; - case OP65_CMP: - /* If this is an immidiate compare, the A register has - * the value of the compare later. - */ - if (CE_IsConstImm (P)) { - if (BC == BC_EQ) { - E->RI->Out2.RegA = (unsigned char)P->Num; - } else { - E->RI->Out.RegA = (unsigned char)P->Num; - } - } - break; + case OP65_CMP: + /* If this is an immidiate compare, the A register has + * the value of the compare later. + */ + if (CE_IsConstImm (P)) { + if (BC == BC_EQ) { + E->RI->Out2.RegA = (unsigned char)P->Num; + } else { + E->RI->Out.RegA = (unsigned char)P->Num; + } + } + break; - case OP65_CPX: - /* If this is an immidiate compare, the X register has - * the value of the compare later. - */ - if (CE_IsConstImm (P)) { - if (BC == BC_EQ) { - E->RI->Out2.RegX = (unsigned char)P->Num; - } else { - E->RI->Out.RegX = (unsigned char)P->Num; - } - } - break; + case OP65_CPX: + /* If this is an immidiate compare, the X register has + * the value of the compare later. + */ + if (CE_IsConstImm (P)) { + if (BC == BC_EQ) { + E->RI->Out2.RegX = (unsigned char)P->Num; + } else { + E->RI->Out.RegX = (unsigned char)P->Num; + } + } + break; - case OP65_CPY: - /* If this is an immidiate compare, the Y register has - * the value of the compare later. - */ - if (CE_IsConstImm (P)) { - if (BC == BC_EQ) { - E->RI->Out2.RegY = (unsigned char)P->Num; - } else { - E->RI->Out.RegY = (unsigned char)P->Num; - } - } - break; + case OP65_CPY: + /* If this is an immidiate compare, the Y register has + * the value of the compare later. + */ + if (CE_IsConstImm (P)) { + if (BC == BC_EQ) { + E->RI->Out2.RegY = (unsigned char)P->Num; + } else { + E->RI->Out.RegY = (unsigned char)P->Num; + } + } + break; - case OP65_DEX: - case OP65_INX: - case OP65_LDX: - case OP65_PLX: - /* X is zero in one execution flow direction */ - if (BC == BC_EQ) { - E->RI->Out2.RegX = 0; - } else { - E->RI->Out.RegX = 0; - } - break; + case OP65_DEX: + case OP65_INX: + case OP65_LDX: + case OP65_PLX: + /* X is zero in one execution flow direction */ + if (BC == BC_EQ) { + E->RI->Out2.RegX = 0; + } else { + E->RI->Out.RegX = 0; + } + break; - case OP65_DEY: - case OP65_INY: - case OP65_LDY: - case OP65_PLY: - /* X is zero in one execution flow direction */ - if (BC == BC_EQ) { - E->RI->Out2.RegY = 0; - } else { - E->RI->Out.RegY = 0; - } - break; + case OP65_DEY: + case OP65_INY: + case OP65_LDY: + case OP65_PLY: + /* X is zero in one execution flow direction */ + if (BC == BC_EQ) { + E->RI->Out2.RegY = 0; + } else { + E->RI->Out.RegY = 0; + } + break; - case OP65_TAX: - case OP65_TXA: - /* If the branch is a beq, both A and X are zero at the - * branch target, otherwise they are zero at the next - * insn. - */ - if (BC == BC_EQ) { - E->RI->Out2.RegA = E->RI->Out2.RegX = 0; - } else { - E->RI->Out.RegA = E->RI->Out.RegX = 0; - } - break; + case OP65_TAX: + case OP65_TXA: + /* If the branch is a beq, both A and X are zero at the + * branch target, otherwise they are zero at the next + * insn. + */ + if (BC == BC_EQ) { + E->RI->Out2.RegA = E->RI->Out2.RegX = 0; + } else { + E->RI->Out.RegA = E->RI->Out.RegX = 0; + } + break; - case OP65_TAY: - case OP65_TYA: - /* If the branch is a beq, both A and Y are zero at the - * branch target, otherwise they are zero at the next - * insn. - */ - if (BC == BC_EQ) { - E->RI->Out2.RegA = E->RI->Out2.RegY = 0; - } else { - E->RI->Out.RegA = E->RI->Out.RegY = 0; - } - break; + case OP65_TAY: + case OP65_TYA: + /* If the branch is a beq, both A and Y are zero at the + * branch target, otherwise they are zero at the next + * insn. + */ + if (BC == BC_EQ) { + E->RI->Out2.RegA = E->RI->Out2.RegY = 0; + } else { + E->RI->Out.RegA = E->RI->Out.RegY = 0; + } + break; - default: - break; + default: + break; - } - } - } + } + } + } } while (!Done); } diff --git a/src/cc65/codeseg.h b/src/cc65/codeseg.h index e7f0ebc9f..125ad31c0 100644 --- a/src/cc65/codeseg.h +++ b/src/cc65/codeseg.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* codeseg.h */ +/* codeseg.h */ /* */ -/* Code segment structure */ +/* Code segment structure */ /* */ /* */ /* */ @@ -53,7 +53,7 @@ /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -63,23 +63,23 @@ struct CodeEntry; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Size of the label hash table */ -#define CS_LABEL_HASH_SIZE 29 +#define CS_LABEL_HASH_SIZE 29 /* Code segment structure */ typedef struct CodeSeg CodeSeg; struct CodeSeg { - char* SegName; /* Segment name */ - SymEntry* Func; /* Owner function */ - Collection Entries; /* List of code entries */ - Collection Labels; /* Labels for next insn */ - CodeLabel* LabelHash[CS_LABEL_HASH_SIZE]; /* Label hash table */ - unsigned short ExitRegs; /* Register use on exit */ + char* SegName; /* Segment name */ + SymEntry* Func; /* Owner function */ + Collection Entries; /* List of code entries */ + Collection Labels; /* Labels for next insn */ + CodeLabel* LabelHash[CS_LABEL_HASH_SIZE]; /* Label hash table */ + unsigned short ExitRegs; /* Register use on exit */ /* Optimization settings for this segment */ unsigned char Optimize; /* On/off switch */ @@ -89,7 +89,7 @@ struct CodeSeg { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -113,7 +113,7 @@ INLINE unsigned CS_GetEntryCount (const CodeSeg* S) return CollCount (&S->Entries); } #else -# define CS_GetEntryCount(S) CollCount (&(S)->Entries) +# define CS_GetEntryCount(S) CollCount (&(S)->Entries) #endif void CS_InsertEntry (CodeSeg* S, struct CodeEntry* E, unsigned Index); @@ -164,7 +164,7 @@ INLINE struct CodeEntry* CS_GetEntry (CodeSeg* S, unsigned Index) return CollAt (&S->Entries, Index); } #else -# define CS_GetEntry(S, Index) ((struct CodeEntry*) CollAt(&(S)->Entries, (Index))) +# define CS_GetEntry(S, Index) ((struct CodeEntry*) CollAt(&(S)->Entries, (Index))) #endif struct CodeEntry* CS_GetPrevEntry (CodeSeg* S, unsigned Index); @@ -178,7 +178,7 @@ struct CodeEntry* CS_GetNextEntry (CodeSeg* S, unsigned Index); */ int CS_GetEntries (CodeSeg* S, struct CodeEntry** List, - unsigned Start, unsigned Count); + unsigned Start, unsigned Count); /* Get Count code entries into List starting at index start. Return true if * we got the lines, return false if not enough lines were available. */ diff --git a/src/cc65/compile.c b/src/cc65/compile.c index c87d32729..17e9471b8 100644 --- a/src/cc65/compile.c +++ b/src/cc65/compile.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* compile.c */ +/* compile.c */ /* */ -/* Top level compiler subroutine */ +/* Top level compiler subroutine */ /* */ /* */ /* */ @@ -65,7 +65,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -83,34 +83,34 @@ static void Parse (void) /* Parse until end of input */ while (CurTok.Tok != TOK_CEOF) { - DeclSpec Spec; + DeclSpec Spec; - /* Check for empty statements */ - if (CurTok.Tok == TOK_SEMI) { - NextToken (); - continue; - } + /* Check for empty statements */ + if (CurTok.Tok == TOK_SEMI) { + NextToken (); + continue; + } - /* Disallow ASM statements on global level */ - if (CurTok.Tok == TOK_ASM) { + /* Disallow ASM statements on global level */ + if (CurTok.Tok == TOK_ASM) { Error ("__asm__ is not allowed here"); /* Parse and remove the statement for error recovery */ - AsmStatement (); - ConsumeSemi (); + AsmStatement (); + ConsumeSemi (); RemoveGlobalCode (); - continue; - } + continue; + } - /* Check for a #pragma */ - if (CurTok.Tok == TOK_PRAGMA) { - DoPragma (); - continue; - } + /* Check for a #pragma */ + if (CurTok.Tok == TOK_PRAGMA) { + DoPragma (); + continue; + } - /* Read variable defs and functions */ - ParseDeclSpec (&Spec, SC_EXTERN | SC_STATIC, T_INT); + /* Read variable defs and functions */ + ParseDeclSpec (&Spec, SC_EXTERN | SC_STATIC, T_INT); - /* Don't accept illegal storage classes */ + /* Don't accept illegal storage classes */ if ((Spec.StorageClass & SC_TYPE) == 0) { if ((Spec.StorageClass & SC_AUTO) != 0 || (Spec.StorageClass & SC_REGISTER) != 0) { @@ -119,26 +119,26 @@ static void Parse (void) } } - /* Check if this is only a type declaration */ - if (CurTok.Tok == TOK_SEMI) { - CheckEmptyDecl (&Spec); - NextToken (); - continue; - } + /* Check if this is only a type declaration */ + if (CurTok.Tok == TOK_SEMI) { + CheckEmptyDecl (&Spec); + NextToken (); + continue; + } - /* Read declarations for this type */ - Entry = 0; - comma = 0; - while (1) { + /* Read declarations for this type */ + Entry = 0; + comma = 0; + while (1) { Declaration Decl; - /* Read the next declaration */ - ParseDecl (&Spec, &Decl, DM_NEED_IDENT); - if (Decl.Ident[0] == '\0') { - NextToken (); - break; - } + /* Read the next declaration */ + ParseDecl (&Spec, &Decl, DM_NEED_IDENT); + if (Decl.Ident[0] == '\0') { + NextToken (); + break; + } /* Check if we must reserve storage for the variable. We do this, * @@ -149,7 +149,7 @@ static void Parse (void) * * This means that "extern int i;" will not get storage allocated. */ - if ((Decl.StorageClass & SC_FUNC) != SC_FUNC && + if ((Decl.StorageClass & SC_FUNC) != SC_FUNC && (Decl.StorageClass & SC_TYPEMASK) != SC_TYPEDEF && ((Spec.Flags & DS_DEF_STORAGE) != 0 || (Decl.StorageClass & (SC_EXTERN|SC_STATIC)) == SC_STATIC || @@ -157,8 +157,8 @@ static void Parse (void) CurTok.Tok == TOK_ASSIGN))) { /* We will allocate storage */ - Decl.StorageClass |= SC_STORAGE | SC_DEF; - } + Decl.StorageClass |= SC_STORAGE | SC_DEF; + } /* If this is a function declarator that is not followed by a comma * or semicolon, it must be followed by a function body. If this is @@ -175,67 +175,67 @@ static void Parse (void) } } - /* Add an entry to the symbol table */ - Entry = AddGlobalSym (Decl.Ident, Decl.Type, Decl.StorageClass); + /* Add an entry to the symbol table */ + Entry = AddGlobalSym (Decl.Ident, Decl.Type, Decl.StorageClass); /* Add declaration attributes */ SymUseAttr (Entry, &Decl); - /* Reserve storage for the variable if we need to */ - if (Decl.StorageClass & SC_STORAGE) { + /* Reserve storage for the variable if we need to */ + if (Decl.StorageClass & SC_STORAGE) { - /* Get the size of the variable */ - unsigned Size = SizeOf (Decl.Type); + /* Get the size of the variable */ + unsigned Size = SizeOf (Decl.Type); - /* Allow initialization */ - if (CurTok.Tok == TOK_ASSIGN) { + /* Allow initialization */ + if (CurTok.Tok == TOK_ASSIGN) { - /* We cannot initialize types of unknown size, or - * void types in non ANSI mode. - */ - if (Size == 0) { - if (!IsTypeVoid (Decl.Type)) { - if (!IsTypeArray (Decl.Type)) { - /* Size is unknown and not an array */ - Error ("Variable `%s' has unknown size", Decl.Ident); - } - } else if (IS_Get (&Standard) != STD_CC65) { - /* We cannot declare variables of type void */ - Error ("Illegal type for variable `%s'", Decl.Ident); - } - } + /* We cannot initialize types of unknown size, or + * void types in non ANSI mode. + */ + if (Size == 0) { + if (!IsTypeVoid (Decl.Type)) { + if (!IsTypeArray (Decl.Type)) { + /* Size is unknown and not an array */ + Error ("Variable `%s' has unknown size", Decl.Ident); + } + } else if (IS_Get (&Standard) != STD_CC65) { + /* We cannot declare variables of type void */ + Error ("Illegal type for variable `%s'", Decl.Ident); + } + } - /* Switch to the data or rodata segment. For arrays, check + /* Switch to the data or rodata segment. For arrays, check * the element qualifiers, since not the array but its * elements are const. */ - if (IsQualConst (GetBaseElementType (Decl.Type))) { - g_userodata (); - } else { - g_usedata (); - } + if (IsQualConst (GetBaseElementType (Decl.Type))) { + g_userodata (); + } else { + g_usedata (); + } - /* Define a label */ - g_defgloblabel (Entry->Name); + /* Define a label */ + g_defgloblabel (Entry->Name); - /* Skip the '=' */ - NextToken (); + /* Skip the '=' */ + NextToken (); - /* Parse the initialization */ - ParseInit (Entry->Type); - } else { + /* Parse the initialization */ + ParseInit (Entry->Type); + } else { - if (IsTypeVoid (Decl.Type)) { - /* We cannot declare variables of type void */ - Error ("Illegal type for variable `%s'", Decl.Ident); + if (IsTypeVoid (Decl.Type)) { + /* We cannot declare variables of type void */ + Error ("Illegal type for variable `%s'", Decl.Ident); Entry->Flags &= ~(SC_STORAGE | SC_DEF); } else if (Size == 0) { - /* Size is unknown. Is it an array? */ + /* Size is unknown. Is it an array? */ if (!IsTypeArray (Decl.Type)) { Error ("Variable `%s' has unknown size", Decl.Ident); } Entry->Flags &= ~(SC_STORAGE | SC_DEF); - } + } /* Allocate storage if it is still needed */ if (Entry->Flags & SC_STORAGE) { @@ -249,28 +249,28 @@ static void Parse (void) /* Allocate space for uninitialized variable */ g_res (Size); } - } + } - } + } - /* Check for end of declaration list */ - if (CurTok.Tok == TOK_COMMA) { - NextToken (); - comma = 1; - } else { - break; - } - } + /* Check for end of declaration list */ + if (CurTok.Tok == TOK_COMMA) { + NextToken (); + comma = 1; + } else { + break; + } + } - /* Function declaration? */ - if (Entry && IsTypeFunc (Entry->Type)) { + /* Function declaration? */ + if (Entry && IsTypeFunc (Entry->Type)) { - /* Function */ - if (!comma) { - if (CurTok.Tok == TOK_SEMI) { - /* Prototype only */ - NextToken (); - } else { + /* Function */ + if (!comma) { + if (CurTok.Tok == TOK_SEMI) { + /* Prototype only */ + NextToken (); + } else { /* Function body. Check for duplicate function definitions */ if (SymIsDef (Entry)) { @@ -280,15 +280,15 @@ static void Parse (void) /* Parse the function body */ NewFunc (Entry); - } - } + } + } - } else { + } else { - /* Must be followed by a semicolon */ - ConsumeSemi (); + /* Must be followed by a semicolon */ + ConsumeSemi (); - } + } } } @@ -325,16 +325,16 @@ void Compile (const char* FileName) */ if (IS_Get (&Optimize)) { long CodeSize = IS_Get (&CodeSizeFactor); - DefineNumericMacro ("__OPT__", 1); - if (CodeSize > 100) { - DefineNumericMacro ("__OPT_i__", CodeSize); - } - if (IS_Get (&EnableRegVars)) { - DefineNumericMacro ("__OPT_r__", 1); - } - if (IS_Get (&InlineStdFuncs)) { - DefineNumericMacro ("__OPT_s__", 1); - } + DefineNumericMacro ("__OPT__", 1); + if (CodeSize > 100) { + DefineNumericMacro ("__OPT_i__", CodeSize); + } + if (IS_Get (&EnableRegVars)) { + DefineNumericMacro ("__OPT_r__", 1); + } + if (IS_Get (&InlineStdFuncs)) { + DefineNumericMacro ("__OPT_s__", 1); + } } /* __TIME__ and __DATE__ macros */ @@ -368,7 +368,7 @@ void Compile (const char* FileName) /* Are we supposed to compile or just preprocess the input? */ if (PreprocessOnly) { - /* Open the file */ + /* Open the file */ OpenOutputFile (); /* Preprocess each line and write it to the output file */ diff --git a/src/cc65/compile.h b/src/cc65/compile.h index 27dae0778..74e294efe 100644 --- a/src/cc65/compile.h +++ b/src/cc65/compile.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* compile.h */ +/* compile.h */ /* */ -/* Top level compiler subroutine */ +/* Top level compiler subroutine */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/coptadd.c b/src/cc65/coptadd.c index 6a4002823..fe050cef6 100644 --- a/src/cc65/coptadd.c +++ b/src/cc65/coptadd.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptadd.c */ +/* coptadd.c */ /* */ -/* Optimize addition sequences */ +/* Optimize addition sequences */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Optimize additions */ +/* Optimize additions */ /*****************************************************************************/ @@ -81,67 +81,67 @@ unsigned OptAdd1 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[6]; + CodeEntry* L[6]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDY && - CE_IsConstImm (L[0]) && - !CS_RangeHasLabel (S, I+1, 5) && - CS_GetEntries (S, L+1, I+1, 5) && - CE_IsCallTo (L[1], "ldaxysp") && - CE_IsCallTo (L[2], "pushax") && - L[3]->OPC == OP65_LDY && - CE_IsConstImm (L[3]) && - CE_IsCallTo (L[4], "ldaxysp") && - CE_IsCallTo (L[5], "tosaddax")) { + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDY && + CE_IsConstImm (L[0]) && + !CS_RangeHasLabel (S, I+1, 5) && + CS_GetEntries (S, L+1, I+1, 5) && + CE_IsCallTo (L[1], "ldaxysp") && + CE_IsCallTo (L[2], "pushax") && + L[3]->OPC == OP65_LDY && + CE_IsConstImm (L[3]) && + CE_IsCallTo (L[4], "ldaxysp") && + CE_IsCallTo (L[5], "tosaddax")) { - CodeEntry* X; + CodeEntry* X; const char* Arg; - /* Correct the stack of the first Y register load */ - CE_SetNumArg (L[0], L[0]->Num - 1); + /* Correct the stack of the first Y register load */ + CE_SetNumArg (L[0], L[0]->Num - 1); /* lda (sp),y */ X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+1); /* ldy #yy-3 */ - Arg = MakeHexArg (L[3]->Num - 3); + Arg = MakeHexArg (L[3]->Num - 3); X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[4]->LI); - CS_InsertEntry (S, X, I+2); + CS_InsertEntry (S, X, I+2); - /* clc */ - X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[5]->LI); - CS_InsertEntry (S, X, I+3); + /* clc */ + X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[5]->LI); + CS_InsertEntry (S, X, I+3); - /* adc (sp),y */ - X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "sp", 0, L[5]->LI); - CS_InsertEntry (S, X, I+4); + /* adc (sp),y */ + X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "sp", 0, L[5]->LI); + CS_InsertEntry (S, X, I+4); /* pha */ X = NewCodeEntry (OP65_PHA, AM65_IMP, 0, 0, L[5]->LI); CS_InsertEntry (S, X, I+5); /* ldy #xx (beware: L[0] has changed) */ - Arg = MakeHexArg (L[0]->Num + 1); + Arg = MakeHexArg (L[0]->Num + 1); X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[1]->LI); - CS_InsertEntry (S, X, I+6); + CS_InsertEntry (S, X, I+6); /* lda (sp),y */ X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); CS_InsertEntry (S, X, I+7); /* ldy #yy-2 */ - Arg = MakeHexArg (L[3]->Num - 2); + Arg = MakeHexArg (L[3]->Num - 2); X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[4]->LI); - CS_InsertEntry (S, X, I+8); + CS_InsertEntry (S, X, I+8); - /* adc (sp),y */ - X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "sp", 0, L[5]->LI); - CS_InsertEntry (S, X, I+9); + /* adc (sp),y */ + X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "sp", 0, L[5]->LI); + CS_InsertEntry (S, X, I+9); /* tax */ X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, L[5]->LI); @@ -151,16 +151,16 @@ unsigned OptAdd1 (CodeSeg* S) X = NewCodeEntry (OP65_PLA, AM65_IMP, 0, 0, L[5]->LI); CS_InsertEntry (S, X, I+11); - /* Delete the old code */ - CS_DelEntries (S, I+12, 5); + /* Delete the old code */ + CS_DelEntries (S, I+12, 5); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -173,7 +173,7 @@ unsigned OptAdd1 (CodeSeg* S) unsigned OptAdd2 (CodeSeg* S) /* Search for the sequence * - * ldy #xx + * ldy #xx * jsr ldaxysp * ldy #yy * jsr addeqysp @@ -201,82 +201,82 @@ unsigned OptAdd2 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[4]; + CodeEntry* L[4]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDY && - CE_IsConstImm (L[0]) && - !CS_RangeHasLabel (S, I+1, 3) && - CS_GetEntries (S, L+1, I+1, 3) && - CE_IsCallTo (L[1], "ldaxysp") && - L[2]->OPC == OP65_LDY && - CE_IsConstImm (L[2]) && - CE_IsCallTo (L[3], "addeqysp") && - (GetRegInfo (S, I+4, REG_AX) & REG_AX) == 0) { + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDY && + CE_IsConstImm (L[0]) && + !CS_RangeHasLabel (S, I+1, 3) && + CS_GetEntries (S, L+1, I+1, 3) && + CE_IsCallTo (L[1], "ldaxysp") && + L[2]->OPC == OP65_LDY && + CE_IsConstImm (L[2]) && + CE_IsCallTo (L[3], "addeqysp") && + (GetRegInfo (S, I+4, REG_AX) & REG_AX) == 0) { - /* Insert new code behind the addeqysp */ - const char* Arg; - CodeEntry* X; + /* Insert new code behind the addeqysp */ + const char* Arg; + CodeEntry* X; - /* ldy #xx-1 */ - Arg = MakeHexArg (L[0]->Num-1); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[0]->LI); - CS_InsertEntry (S, X, I+4); + /* ldy #xx-1 */ + Arg = MakeHexArg (L[0]->Num-1); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[0]->LI); + CS_InsertEntry (S, X, I+4); - /* lda (sp),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); - CS_InsertEntry (S, X, I+5); + /* lda (sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); + CS_InsertEntry (S, X, I+5); - /* ldy #yy */ - X = NewCodeEntry (OP65_LDY, AM65_IMM, L[2]->Arg, 0, L[2]->LI); - CS_InsertEntry (S, X, I+6); + /* ldy #yy */ + X = NewCodeEntry (OP65_LDY, AM65_IMM, L[2]->Arg, 0, L[2]->LI); + CS_InsertEntry (S, X, I+6); - /* clc */ - X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[3]->LI); - CS_InsertEntry (S, X, I+7); + /* clc */ + X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[3]->LI); + CS_InsertEntry (S, X, I+7); - /* adc (sp),y */ - X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "sp", 0, L[3]->LI); - CS_InsertEntry (S, X, I+8); + /* adc (sp),y */ + X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "sp", 0, L[3]->LI); + CS_InsertEntry (S, X, I+8); - /* sta (sp),y */ - X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, "sp", 0, L[3]->LI); - CS_InsertEntry (S, X, I+9); + /* sta (sp),y */ + X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, "sp", 0, L[3]->LI); + CS_InsertEntry (S, X, I+9); - /* ldy #xx */ - X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); - CS_InsertEntry (S, X, I+10); + /* ldy #xx */ + X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); + CS_InsertEntry (S, X, I+10); - /* lda (sp),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); - CS_InsertEntry (S, X, I+11); + /* lda (sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); + CS_InsertEntry (S, X, I+11); - /* ldy #yy+1 */ - Arg = MakeHexArg (L[2]->Num+1); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[2]->LI); - CS_InsertEntry (S, X, I+12); + /* ldy #yy+1 */ + Arg = MakeHexArg (L[2]->Num+1); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[2]->LI); + CS_InsertEntry (S, X, I+12); - /* adc (sp),y */ - X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "sp", 0, L[3]->LI); - CS_InsertEntry (S, X, I+13); + /* adc (sp),y */ + X = NewCodeEntry (OP65_ADC, AM65_ZP_INDY, "sp", 0, L[3]->LI); + CS_InsertEntry (S, X, I+13); - /* sta (sp),y */ - X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, "sp", 0, L[3]->LI); - CS_InsertEntry (S, X, I+14); + /* sta (sp),y */ + X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, "sp", 0, L[3]->LI); + CS_InsertEntry (S, X, I+14); - /* Delete the old code */ - CS_DelEntries (S, I, 4); + /* Delete the old code */ + CS_DelEntries (S, I, 4); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -289,8 +289,8 @@ unsigned OptAdd2 (CodeSeg* S) unsigned OptAdd3 (CodeSeg* S) /* Search for the sequence * - * jsr pushax - * ldx #$00 + * jsr pushax + * ldx #$00 * lda xxx * jsr tosaddax * @@ -309,14 +309,14 @@ unsigned OptAdd3 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[5]; + CodeEntry* L[5]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ + /* Check for the sequence */ if (CE_IsCallTo (L[0], "pushax") && - CS_GetEntries (S, L+1, I+1, 4) && + CS_GetEntries (S, L+1, I+1, 4) && !CS_RangeHasLabel (S, I+1, 3) && L[1]->OPC == OP65_LDX && CE_IsKnownImm (L[1], 0) && @@ -327,32 +327,32 @@ unsigned OptAdd3 (CodeSeg* S) CodeLabel* Label; /* Insert new code behind the sequence */ - X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[3]->LI); - CS_InsertEntry (S, X, I+4); + X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[3]->LI); + CS_InsertEntry (S, X, I+4); /* adc xxx */ - X = NewCodeEntry (OP65_ADC, L[2]->AM, L[2]->Arg, 0, L[3]->LI); - CS_InsertEntry (S, X, I+5); + X = NewCodeEntry (OP65_ADC, L[2]->AM, L[2]->Arg, 0, L[3]->LI); + CS_InsertEntry (S, X, I+5); /* bcc L1 */ Label = CS_GenLabel (S, L[4]); X = NewCodeEntry (OP65_BCC, AM65_BRA, Label->Name, Label, L[3]->LI); - CS_InsertEntry (S, X, I+6); + CS_InsertEntry (S, X, I+6); /* inx */ X = NewCodeEntry (OP65_INX, AM65_IMP, 0, 0, L[3]->LI); - CS_InsertEntry (S, X, I+7); + CS_InsertEntry (S, X, I+7); - /* Delete the old code */ - CS_DelEntries (S, I, 4); + /* Delete the old code */ + CS_DelEntries (S, I, 4); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -365,9 +365,9 @@ unsigned OptAdd3 (CodeSeg* S) unsigned OptAdd4 (CodeSeg* S) /* Search for the sequence * - * jsr pushax + * jsr pushax * lda xxx - * ldx yyy + * ldx yyy * jsr tosaddax * * and replace it by @@ -387,14 +387,14 @@ unsigned OptAdd4 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[4]; + CodeEntry* L[4]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ + /* Check for the sequence */ if (CE_IsCallTo (L[0], "pushax") && - CS_GetEntries (S, L+1, I+1, 3) && + CS_GetEntries (S, L+1, I+1, 3) && !CS_RangeHasLabel (S, I+1, 3) && L[1]->OPC == OP65_LDA && (L[1]->AM == AM65_ABS || L[1]->AM == AM65_ZP) && @@ -405,43 +405,43 @@ unsigned OptAdd4 (CodeSeg* S) CodeEntry* X; /* Insert new code behind the sequence */ - X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[3]->LI); - CS_InsertEntry (S, X, I+4); + X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, L[3]->LI); + CS_InsertEntry (S, X, I+4); /* adc xxx */ - X = NewCodeEntry (OP65_ADC, L[1]->AM, L[1]->Arg, 0, L[3]->LI); - CS_InsertEntry (S, X, I+5); + X = NewCodeEntry (OP65_ADC, L[1]->AM, L[1]->Arg, 0, L[3]->LI); + CS_InsertEntry (S, X, I+5); /* pha */ - X = NewCodeEntry (OP65_PHA, AM65_IMP, 0, 0, L[3]->LI); - CS_InsertEntry (S, X, I+6); + X = NewCodeEntry (OP65_PHA, AM65_IMP, 0, 0, L[3]->LI); + CS_InsertEntry (S, X, I+6); /* txa */ - X = NewCodeEntry (OP65_TXA, AM65_IMP, 0, 0, L[3]->LI); - CS_InsertEntry (S, X, I+7); + X = NewCodeEntry (OP65_TXA, AM65_IMP, 0, 0, L[3]->LI); + CS_InsertEntry (S, X, I+7); /* adc yyy */ - X = NewCodeEntry (OP65_ADC, L[2]->AM, L[2]->Arg, 0, L[3]->LI); - CS_InsertEntry (S, X, I+8); + X = NewCodeEntry (OP65_ADC, L[2]->AM, L[2]->Arg, 0, L[3]->LI); + CS_InsertEntry (S, X, I+8); /* tax */ - X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, L[3]->LI); - CS_InsertEntry (S, X, I+9); + X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, L[3]->LI); + CS_InsertEntry (S, X, I+9); /* pla */ - X = NewCodeEntry (OP65_PLA, AM65_IMP, 0, 0, L[3]->LI); - CS_InsertEntry (S, X, I+10); + X = NewCodeEntry (OP65_PLA, AM65_IMP, 0, 0, L[3]->LI); + CS_InsertEntry (S, X, I+10); - /* Delete the old code */ - CS_DelEntries (S, I, 4); + /* Delete the old code */ + CS_DelEntries (S, I, 4); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -462,12 +462,12 @@ unsigned OptAdd5 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* E; + CodeEntry* E; - /* Get next entry */ - E = CS_GetEntry (S, I); + /* Get next entry */ + E = CS_GetEntry (S, I); - /* Check for the sequence */ + /* Check for the sequence */ if (E->OPC == OP65_JSR && strncmp (E->Arg, "incax", 5) == 0 && IsDigit (E->Arg[5]) && @@ -478,23 +478,23 @@ unsigned OptAdd5 (CodeSeg* S) const char* Arg; /* Insert new code behind the sequence */ - X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, E->LI); - CS_InsertEntry (S, X, I+1); + X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, E->LI); + CS_InsertEntry (S, X, I+1); - Arg = MakeHexArg (E->Arg[5] - '0'); - X = NewCodeEntry (OP65_ADC, AM65_IMM, Arg, 0, E->LI); - CS_InsertEntry (S, X, I+2); + Arg = MakeHexArg (E->Arg[5] - '0'); + X = NewCodeEntry (OP65_ADC, AM65_IMM, Arg, 0, E->LI); + CS_InsertEntry (S, X, I+2); - /* Delete the old code */ - CS_DelEntry (S, I); + /* Delete the old code */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -507,9 +507,9 @@ unsigned OptAdd5 (CodeSeg* S) unsigned OptAdd6 (CodeSeg* S) /* Search for the sequence * - * adc ... + * adc ... * bcc L - * inx + * inx * L: * * and remove the handling of the high byte if X is not used later. @@ -521,32 +521,32 @@ unsigned OptAdd6 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[3]; + CodeEntry* L[3]; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_ADC && - CS_GetEntries (S, L, I+1, 3) && - (L[0]->OPC == OP65_BCC || L[0]->OPC == OP65_JCC) && - L[0]->JumpTo != 0 && - !CE_HasLabel (L[0]) && - L[1]->OPC == OP65_INX && - !CE_HasLabel (L[1]) && - L[0]->JumpTo->Owner == L[2] && - !RegXUsed (S, I+3)) { + /* Check for the sequence */ + if (E->OPC == OP65_ADC && + CS_GetEntries (S, L, I+1, 3) && + (L[0]->OPC == OP65_BCC || L[0]->OPC == OP65_JCC) && + L[0]->JumpTo != 0 && + !CE_HasLabel (L[0]) && + L[1]->OPC == OP65_INX && + !CE_HasLabel (L[1]) && + L[0]->JumpTo->Owner == L[2] && + !RegXUsed (S, I+3)) { - /* Remove the bcs/dex */ - CS_DelEntries (S, I+1, 2); + /* Remove the bcs/dex */ + CS_DelEntries (S, I+1, 2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptadd.h b/src/cc65/coptadd.h index cc2afe48b..f89ad016e 100644 --- a/src/cc65/coptadd.h +++ b/src/cc65/coptadd.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptadd.h */ +/* coptadd.h */ /* */ -/* Optimize addition sequences */ +/* Optimize addition sequences */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Optimize additions */ +/* Optimize additions */ /*****************************************************************************/ @@ -52,9 +52,9 @@ unsigned OptAdd1 (CodeSeg* S); /* Search for the sequence * - * jsr pushax + * jsr pushax * ldy xxx - * ldx #$00 + * ldx #$00 * lda (sp),y * jsr tosaddax * @@ -71,9 +71,9 @@ unsigned OptAdd1 (CodeSeg* S); unsigned OptAdd2 (CodeSeg* S); /* Search for the sequence * - * ldy #xx + * ldy #xx * lda (sp),y - * tax + * tax * dey * lda (sp),y * ldy #$yy @@ -99,8 +99,8 @@ unsigned OptAdd2 (CodeSeg* S); unsigned OptAdd3 (CodeSeg* S); /* Search for the sequence * - * jsr pushax - * ldx #$00 + * jsr pushax + * ldx #$00 * lda xxx * jsr tosaddax * @@ -116,9 +116,9 @@ unsigned OptAdd3 (CodeSeg* S); unsigned OptAdd4 (CodeSeg* S); /* Search for the sequence * - * jsr pushax + * jsr pushax * lda xxx - * ldx yyy + * ldx yyy * jsr tosaddax * * and replace it by @@ -140,9 +140,9 @@ unsigned OptAdd5 (CodeSeg* S); unsigned OptAdd6 (CodeSeg* S); /* Search for the sequence * - * adc ... + * adc ... * bcc L - * inx + * inx * L: * * and remove the handling of the high byte if X is not used later. diff --git a/src/cc65/coptc02.c b/src/cc65/coptc02.c index a45025ee5..969f9fd6e 100644 --- a/src/cc65/coptc02.c +++ b/src/cc65/coptc02.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptc02.h */ +/* coptc02.h */ /* */ -/* 65C02 specific optimizations */ +/* 65C02 specific optimizations */ /* */ /* */ /* */ @@ -44,19 +44,19 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -71,27 +71,27 @@ unsigned Opt65C02Ind (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for addressing mode indirect indexed Y where Y is zero. - * Note: All opcodes that are available as (zp),y are also available - * as (zp), so we can ignore the actual opcode here. - */ - if (E->AM == AM65_ZP_INDY && E->RI->In.RegY == 0) { + /* Check for addressing mode indirect indexed Y where Y is zero. + * Note: All opcodes that are available as (zp),y are also available + * as (zp), so we can ignore the actual opcode here. + */ + if (E->AM == AM65_ZP_INDY && E->RI->In.RegY == 0) { - /* Replace it by indirect addressing mode */ - CodeEntry* X = NewCodeEntry (E->OPC, AM65_ZP_IND, E->Arg, 0, E->LI); - CS_InsertEntry (S, X, I+1); - CS_DelEntry (S, I); + /* Replace it by indirect addressing mode */ + CodeEntry* X = NewCodeEntry (E->OPC, AM65_ZP_IND, E->Arg, 0, E->LI); + CS_InsertEntry (S, X, I+1); + CS_DelEntry (S, I); - /* We had changes */ - ++Changes; + /* We had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -111,13 +111,13 @@ unsigned Opt65C02BitOps (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[3]; + CodeEntry* L[3]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDA && + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDA && (L[0]->AM == AM65_ZP || L[0]->AM == AM65_ABS) && !CS_RangeHasLabel (S, I+1, 2) && CS_GetEntries (S, L+1, I+1, 2) && @@ -158,12 +158,12 @@ unsigned Opt65C02BitOps (CodeSeg* S) /* Delete the old stuff */ CS_DelEntries (S, I, 3); - /* We had changes */ - ++Changes; - } + /* We had changes */ + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -183,15 +183,15 @@ unsigned Opt65C02Stores (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for a store with a register value of zero and an addressing - * mode available with STZ. - */ - if (((E->OPC == OP65_STA && E->RI->In.RegA == 0) || - (E->OPC == OP65_STX && E->RI->In.RegX == 0) || - (E->OPC == OP65_STY && E->RI->In.RegY == 0)) && + /* Check for a store with a register value of zero and an addressing + * mode available with STZ. + */ + if (((E->OPC == OP65_STA && E->RI->In.RegA == 0) || + (E->OPC == OP65_STX && E->RI->In.RegX == 0) || + (E->OPC == OP65_STY && E->RI->In.RegY == 0)) && (E->AM == AM65_ZP || E->AM == AM65_ABS || E->AM == AM65_ZPX || E->AM == AM65_ABSX)) { @@ -202,12 +202,12 @@ unsigned Opt65C02Stores (CodeSeg* S) /* Delete the old stuff */ CS_DelEntry (S, I); - /* We had changes */ - ++Changes; - } + /* We had changes */ + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptc02.h b/src/cc65/coptc02.h index 309e4578a..7d010568b 100644 --- a/src/cc65/coptc02.h +++ b/src/cc65/coptc02.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptc02.h */ +/* coptc02.h */ /* */ -/* 65C02 specific optimizations */ +/* 65C02 specific optimizations */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/coptcmp.c b/src/cc65/coptcmp.c index 25e1a8982..e1b80a71c 100644 --- a/src/cc65/coptcmp.c +++ b/src/cc65/coptcmp.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptcmp.c */ +/* coptcmp.c */ /* */ -/* Optimize compares */ +/* Optimize compares */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -59,7 +59,7 @@ static const unsigned char CmpInvertTab [] = { /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -81,86 +81,86 @@ static void ReplaceCmp (CodeSeg* S, unsigned I, cmp_t Cond) /* Replace the conditional branch */ switch (Cond) { - case CMP_EQ: - CE_ReplaceOPC (E, OP65_JEQ); - break; + case CMP_EQ: + CE_ReplaceOPC (E, OP65_JEQ); + break; - case CMP_NE: - CE_ReplaceOPC (E, OP65_JNE); - break; + case CMP_NE: + CE_ReplaceOPC (E, OP65_JNE); + break; - case CMP_GT: - /* Replace by - * beq @L - * jpl Target - * @L: ... - */ - if ((N = CS_GetNextEntry (S, I)) == 0) { - /* No such entry */ - Internal ("Invalid program flow"); - } - L = CS_GenLabel (S, N); - N = NewCodeEntry (OP65_BEQ, AM65_BRA, L->Name, L, E->LI); - CS_InsertEntry (S, N, I); - CE_ReplaceOPC (E, OP65_JPL); - break; + case CMP_GT: + /* Replace by + * beq @L + * jpl Target + * @L: ... + */ + if ((N = CS_GetNextEntry (S, I)) == 0) { + /* No such entry */ + Internal ("Invalid program flow"); + } + L = CS_GenLabel (S, N); + N = NewCodeEntry (OP65_BEQ, AM65_BRA, L->Name, L, E->LI); + CS_InsertEntry (S, N, I); + CE_ReplaceOPC (E, OP65_JPL); + break; - case CMP_GE: - CE_ReplaceOPC (E, OP65_JPL); - break; + case CMP_GE: + CE_ReplaceOPC (E, OP65_JPL); + break; - case CMP_LT: - CE_ReplaceOPC (E, OP65_JMI); - break; + case CMP_LT: + CE_ReplaceOPC (E, OP65_JMI); + break; - case CMP_LE: - /* Replace by - * jmi Target - * jeq Target - */ - CE_ReplaceOPC (E, OP65_JMI); - L = E->JumpTo; - N = NewCodeEntry (OP65_JEQ, AM65_BRA, L->Name, L, E->LI); - CS_InsertEntry (S, N, I+1); - break; + case CMP_LE: + /* Replace by + * jmi Target + * jeq Target + */ + CE_ReplaceOPC (E, OP65_JMI); + L = E->JumpTo; + N = NewCodeEntry (OP65_JEQ, AM65_BRA, L->Name, L, E->LI); + CS_InsertEntry (S, N, I+1); + break; - case CMP_UGT: - /* Replace by - * beq @L - * jcs Target - * @L: ... - */ - if ((N = CS_GetNextEntry (S, I)) == 0) { - /* No such entry */ - Internal ("Invalid program flow"); - } - L = CS_GenLabel (S, N); - N = NewCodeEntry (OP65_BEQ, AM65_BRA, L->Name, L, E->LI); - CS_InsertEntry (S, N, I); - CE_ReplaceOPC (E, OP65_JCS); - break; + case CMP_UGT: + /* Replace by + * beq @L + * jcs Target + * @L: ... + */ + if ((N = CS_GetNextEntry (S, I)) == 0) { + /* No such entry */ + Internal ("Invalid program flow"); + } + L = CS_GenLabel (S, N); + N = NewCodeEntry (OP65_BEQ, AM65_BRA, L->Name, L, E->LI); + CS_InsertEntry (S, N, I); + CE_ReplaceOPC (E, OP65_JCS); + break; - case CMP_UGE: - CE_ReplaceOPC (E, OP65_JCS); - break; + case CMP_UGE: + CE_ReplaceOPC (E, OP65_JCS); + break; - case CMP_ULT: - CE_ReplaceOPC (E, OP65_JCC); - break; + case CMP_ULT: + CE_ReplaceOPC (E, OP65_JCC); + break; - case CMP_ULE: - /* Replace by - * jcc Target - * jeq Target - */ - CE_ReplaceOPC (E, OP65_JCC); - L = E->JumpTo; - N = NewCodeEntry (OP65_JEQ, AM65_BRA, L->Name, L, E->LI); - CS_InsertEntry (S, N, I+1); - break; + case CMP_ULE: + /* Replace by + * jcc Target + * jeq Target + */ + CE_ReplaceOPC (E, OP65_JCC); + L = E->JumpTo; + N = NewCodeEntry (OP65_JEQ, AM65_BRA, L->Name, L, E->LI); + CS_InsertEntry (S, N, I+1); + break; - default: - Internal ("Unknown jump condition: %d", Cond); + default: + Internal ("Unknown jump condition: %d", Cond); } @@ -175,18 +175,18 @@ static int IsImmCmp16 (CodeEntry** L) */ { return (L[0]->OPC == OP65_CPX && - L[0]->AM == AM65_IMM && - (L[0]->Flags & CEF_NUMARG) != 0 && - !CE_HasLabel (L[0]) && - (L[1]->OPC == OP65_JNE || L[1]->OPC == OP65_BNE) && - L[1]->JumpTo != 0 && - !CE_HasLabel (L[1]) && - L[2]->OPC == OP65_CMP && - L[2]->AM == AM65_IMM && - (L[2]->Flags & CEF_NUMARG) != 0 && - (L[3]->Info & OF_CBRA) != 0 && - L[3]->JumpTo != 0 && - (L[1]->JumpTo->Owner == L[3] || L[1]->JumpTo == L[3]->JumpTo)); + L[0]->AM == AM65_IMM && + (L[0]->Flags & CEF_NUMARG) != 0 && + !CE_HasLabel (L[0]) && + (L[1]->OPC == OP65_JNE || L[1]->OPC == OP65_BNE) && + L[1]->JumpTo != 0 && + !CE_HasLabel (L[1]) && + L[2]->OPC == OP65_CMP && + L[2]->AM == AM65_IMM && + (L[2]->Flags & CEF_NUMARG) != 0 && + (L[3]->Info & OF_CBRA) != 0 && + L[3]->JumpTo != 0 && + (L[1]->JumpTo->Owner == L[3] || L[1]->JumpTo == L[3]->JumpTo)); } @@ -195,18 +195,18 @@ static int GetCmpRegVal (const CodeEntry* E) /* Return the register value for an immediate compare */ { switch (E->OPC) { - case OP65_CMP: return E->RI->In.RegA; - case OP65_CPX: return E->RI->In.RegX; - case OP65_CPY: return E->RI->In.RegY; - default: Internal ("Invalid opcode in GetCmpRegVal"); - return 0; /* Not reached */ + case OP65_CMP: return E->RI->In.RegA; + case OP65_CPX: return E->RI->In.RegX; + case OP65_CPY: return E->RI->In.RegY; + default: Internal ("Invalid opcode in GetCmpRegVal"); + return 0; /* Not reached */ } } /*****************************************************************************/ -/* Remove calls to the bool transformer subroutines */ +/* Remove calls to the bool transformer subroutines */ /*****************************************************************************/ @@ -222,42 +222,42 @@ unsigned OptBoolTrans (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; - cmp_t Cond; + CodeEntry* N; + cmp_t Cond; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for a boolean transformer */ - if (E->OPC == OP65_JSR && - (Cond = FindBoolCmpCond (E->Arg)) != CMP_INV && - (N = CS_GetNextEntry (S, I)) != 0 && - (N->Info & OF_ZBRA) != 0) { + /* Check for a boolean transformer */ + if (E->OPC == OP65_JSR && + (Cond = FindBoolCmpCond (E->Arg)) != CMP_INV && + (N = CS_GetNextEntry (S, I)) != 0 && + (N->Info & OF_ZBRA) != 0) { - /* Make the boolean transformer unnecessary by changing the - * the conditional jump to evaluate the condition flags that - * are set after the compare directly. Note: jeq jumps if - * the condition is not met, jne jumps if the condition is met. - * Invert the code if we jump on condition not met. - */ - if (GetBranchCond (N->OPC) == BC_EQ) { - /* Jumps if condition false, invert condition */ - Cond = CmpInvertTab [Cond]; - } + /* Make the boolean transformer unnecessary by changing the + * the conditional jump to evaluate the condition flags that + * are set after the compare directly. Note: jeq jumps if + * the condition is not met, jne jumps if the condition is met. + * Invert the code if we jump on condition not met. + */ + if (GetBranchCond (N->OPC) == BC_EQ) { + /* Jumps if condition false, invert condition */ + Cond = CmpInvertTab [Cond]; + } - /* Check if we can replace the code by something better */ - ReplaceCmp (S, I+1, Cond); + /* Check if we can replace the code by something better */ + ReplaceCmp (S, I+1, Cond); - /* Remove the call to the bool transformer */ - CS_DelEntry (S, I); + /* Remove the call to the bool transformer */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -268,7 +268,7 @@ unsigned OptBoolTrans (CodeSeg* S) /*****************************************************************************/ -/* Optimizations for compares */ +/* Optimizations for compares */ /*****************************************************************************/ @@ -276,13 +276,13 @@ unsigned OptBoolTrans (CodeSeg* S) unsigned OptCmp1 (CodeSeg* S) /* Search for the sequence * - * ldx xx - * stx tmp1 - * ora tmp1 + * ldx xx + * stx tmp1 + * ora tmp1 * * and replace it by * - * ora xx + * ora xx */ { unsigned Changes = 0; @@ -291,36 +291,36 @@ unsigned OptCmp1 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[3]; + CodeEntry* L[3]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDX && - !CS_RangeHasLabel (S, I+1, 2) && - CS_GetEntries (S, L+1, I+1, 2) && - L[1]->OPC == OP65_STX && - strcmp (L[1]->Arg, "tmp1") == 0 && - L[2]->OPC == OP65_ORA && - strcmp (L[2]->Arg, "tmp1") == 0) { + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDX && + !CS_RangeHasLabel (S, I+1, 2) && + CS_GetEntries (S, L+1, I+1, 2) && + L[1]->OPC == OP65_STX && + strcmp (L[1]->Arg, "tmp1") == 0 && + L[2]->OPC == OP65_ORA && + strcmp (L[2]->Arg, "tmp1") == 0) { CodeEntry* X; - /* Insert the ora instead */ + /* Insert the ora instead */ X = NewCodeEntry (OP65_ORA, L[0]->AM, L[0]->Arg, 0, L[0]->LI); - CS_InsertEntry (S, X, I); + CS_InsertEntry (S, X, I); - /* Remove all other instructions */ - CS_DelEntries (S, I+1, 3); + /* Remove all other instructions */ + CS_DelEntries (S, I+1, 3); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -333,14 +333,14 @@ unsigned OptCmp1 (CodeSeg* S) unsigned OptCmp2 (CodeSeg* S) /* Search for the sequence * - * stx xx - * stx tmp1 - * ora tmp1 + * stx xx + * stx tmp1 + * ora tmp1 * * and replace it by * - * stx xx - * ora xx + * stx xx + * ora xx */ { unsigned Changes = 0; @@ -349,33 +349,33 @@ unsigned OptCmp2 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[2]; + CodeEntry* L[2]; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_STX && - !CS_RangeHasLabel (S, I+1, 2) && - CS_GetEntries (S, L, I+1, 2) && - L[0]->OPC == OP65_STX && - strcmp (L[0]->Arg, "tmp1") == 0 && - L[1]->OPC == OP65_ORA && - strcmp (L[1]->Arg, "tmp1") == 0) { + /* Check for the sequence */ + if (E->OPC == OP65_STX && + !CS_RangeHasLabel (S, I+1, 2) && + CS_GetEntries (S, L, I+1, 2) && + L[0]->OPC == OP65_STX && + strcmp (L[0]->Arg, "tmp1") == 0 && + L[1]->OPC == OP65_ORA && + strcmp (L[1]->Arg, "tmp1") == 0) { - /* Remove the remaining instructions */ - CS_DelEntries (S, I+1, 2); + /* Remove the remaining instructions */ + CS_DelEntries (S, I+1, 2); - /* Insert the ora instead */ - CS_InsertEntry (S, NewCodeEntry (OP65_ORA, E->AM, E->Arg, 0, E->LI), I+1); + /* Insert the ora instead */ + CS_InsertEntry (S, NewCodeEntry (OP65_ORA, E->AM, E->Arg, 0, E->LI), I+1); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -388,13 +388,13 @@ unsigned OptCmp2 (CodeSeg* S) unsigned OptCmp3 (CodeSeg* S) /* Search for * - * lda/and/ora/eor ... - * cmp #$00 - * jeq/jne + * lda/and/ora/eor ... + * cmp #$00 + * jeq/jne * or - * lda/and/ora/eor ... - * cmp #$00 - * jsr boolxx + * lda/and/ora/eor ... + * cmp #$00 + * jsr boolxx * * and remove the cmp. */ @@ -405,59 +405,59 @@ unsigned OptCmp3 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[3]; + CodeEntry* L[3]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if ((L[0]->OPC == OP65_ADC || - L[0]->OPC == OP65_AND || + /* Check for the sequence */ + if ((L[0]->OPC == OP65_ADC || + L[0]->OPC == OP65_AND || L[0]->OPC == OP65_ASL || - L[0]->OPC == OP65_DEA || - L[0]->OPC == OP65_EOR || - L[0]->OPC == OP65_INA || - L[0]->OPC == OP65_LDA || + L[0]->OPC == OP65_DEA || + L[0]->OPC == OP65_EOR || + L[0]->OPC == OP65_INA || + L[0]->OPC == OP65_LDA || L[0]->OPC == OP65_LSR || - L[0]->OPC == OP65_ORA || - L[0]->OPC == OP65_PLA || - L[0]->OPC == OP65_SBC || - L[0]->OPC == OP65_TXA || - L[0]->OPC == OP65_TYA) && - !CS_RangeHasLabel (S, I+1, 2) && - CS_GetEntries (S, L+1, I+1, 2) && - L[1]->OPC == OP65_CMP && - CE_IsKnownImm (L[1], 0)) { + L[0]->OPC == OP65_ORA || + L[0]->OPC == OP65_PLA || + L[0]->OPC == OP65_SBC || + L[0]->OPC == OP65_TXA || + L[0]->OPC == OP65_TYA) && + !CS_RangeHasLabel (S, I+1, 2) && + CS_GetEntries (S, L+1, I+1, 2) && + L[1]->OPC == OP65_CMP && + CE_IsKnownImm (L[1], 0)) { int Delete = 0; - /* Check for the call to boolxx. We only remove the compare if - * the carry flag is not evaluated later, because the load will + /* Check for the call to boolxx. We only remove the compare if + * the carry flag is not evaluated later, because the load will * not set the carry flag. - */ - if (L[2]->OPC == OP65_JSR) { - switch (FindBoolCmpCond (L[2]->Arg)) { + */ + if (L[2]->OPC == OP65_JSR) { + switch (FindBoolCmpCond (L[2]->Arg)) { - case CMP_EQ: - case CMP_NE: - case CMP_GT: - case CMP_GE: - case CMP_LT: - case CMP_LE: - /* Remove the compare */ + case CMP_EQ: + case CMP_NE: + case CMP_GT: + case CMP_GE: + case CMP_LT: + case CMP_LE: + /* Remove the compare */ Delete = 1; - break; + break; - case CMP_UGT: - case CMP_UGE: - case CMP_ULT: - case CMP_ULE: - case CMP_INV: - /* Leave it alone */ - break; - } + case CMP_UGT: + case CMP_UGE: + case CMP_ULT: + case CMP_ULE: + case CMP_INV: + /* Leave it alone */ + break; + } - } else if ((L[2]->Info & OF_FBRA) != 0) { + } else if ((L[2]->Info & OF_FBRA) != 0) { /* The following insn branches on the condition of the load, * so the compare instruction might be removed. For safety, * do some more checks if the carry isn't used later, since @@ -488,10 +488,10 @@ unsigned OptCmp3 (CodeSeg* S) CS_DelEntry (S, I+1); ++Changes; } - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -504,19 +504,19 @@ unsigned OptCmp3 (CodeSeg* S) unsigned OptCmp4 (CodeSeg* S) /* Search for * - * lda x - * ldx y - * cpx #a - * bne L1 - * cmp #b - * L1: jne/jeq L2 + * lda x + * ldx y + * cpx #a + * bne L1 + * cmp #b + * L1: jne/jeq L2 * * If a is zero, we may remove the compare. If a and b are both zero, we may * replace it by the sequence * - * lda x - * ora x+1 - * jne/jeq ... + * lda x + * ora x+1 + * jne/jeq ... * * L1 may be either the label at the branch instruction, or the target label * of this instruction. @@ -528,48 +528,48 @@ unsigned OptCmp4 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[5]; + CodeEntry* L[5]; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_LDA && - CS_GetEntries (S, L, I+1, 5) && - L[0]->OPC == OP65_LDX && - !CE_HasLabel (L[0]) && - IsImmCmp16 (L+1) && - !RegAXUsed (S, I+6)) { + /* Check for the sequence */ + if (E->OPC == OP65_LDA && + CS_GetEntries (S, L, I+1, 5) && + L[0]->OPC == OP65_LDX && + !CE_HasLabel (L[0]) && + IsImmCmp16 (L+1) && + !RegAXUsed (S, I+6)) { - if ((L[4]->Info & OF_FBRA) != 0 && L[1]->Num == 0 && L[3]->Num == 0) { - /* The value is zero, we may use the simple code version. */ - CE_ReplaceOPC (L[0], OP65_ORA); - CS_DelEntries (S, I+2, 3); - } else { - /* Move the lda instruction after the first branch. This will - * improve speed, since the load is delayed after the first - * test. - */ - CS_MoveEntry (S, I, I+4); + if ((L[4]->Info & OF_FBRA) != 0 && L[1]->Num == 0 && L[3]->Num == 0) { + /* The value is zero, we may use the simple code version. */ + CE_ReplaceOPC (L[0], OP65_ORA); + CS_DelEntries (S, I+2, 3); + } else { + /* Move the lda instruction after the first branch. This will + * improve speed, since the load is delayed after the first + * test. + */ + CS_MoveEntry (S, I, I+4); - /* We will replace the ldx/cpx by lda/cmp */ - CE_ReplaceOPC (L[0], OP65_LDA); - CE_ReplaceOPC (L[1], OP65_CMP); + /* We will replace the ldx/cpx by lda/cmp */ + CE_ReplaceOPC (L[0], OP65_LDA); + CE_ReplaceOPC (L[1], OP65_CMP); - /* Beware: If the first LDA instruction had a label, we have - * to move this label to the top of the sequence again. - */ - if (CE_HasLabel (E)) { - CS_MoveLabels (S, E, L[0]); - } + /* Beware: If the first LDA instruction had a label, we have + * to move this label to the top of the sequence again. + */ + if (CE_HasLabel (E)) { + CS_MoveLabels (S, E, L[0]); + } - } + } - ++Changes; - } + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -586,7 +586,7 @@ unsigned OptCmp5 (CodeSeg* S) * jsr ldaxysp * cpx #a * bne L1 - * cmp #b + * cmp #b * jne/jeq L2 */ { @@ -596,89 +596,89 @@ unsigned OptCmp5 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[6]; + CodeEntry* L[6]; - /* Get the next entry */ - L[0] = CS_GetEntry (S, I); + /* Get the next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDY && - CE_IsConstImm (L[0]) && - CS_GetEntries (S, L+1, I+1, 5) && - !CE_HasLabel (L[1]) && - CE_IsCallTo (L[1], "ldaxysp") && - IsImmCmp16 (L+2)) { + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDY && + CE_IsConstImm (L[0]) && + CS_GetEntries (S, L+1, I+1, 5) && + !CE_HasLabel (L[1]) && + CE_IsCallTo (L[1], "ldaxysp") && + IsImmCmp16 (L+2)) { - if ((L[5]->Info & OF_FBRA) != 0 && L[2]->Num == 0 && L[4]->Num == 0) { + if ((L[5]->Info & OF_FBRA) != 0 && L[2]->Num == 0 && L[4]->Num == 0) { - CodeEntry* X; - char Buf[20]; + CodeEntry* X; + char Buf[20]; - /* The value is zero, we may use the simple code version: - * ldy #o-1 - * lda (sp),y - * ldy #o - * ora (sp),y - * jne/jeq ... - */ - sprintf (Buf, "$%02X", (int)(L[0]->Num-1)); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Buf, 0, L[0]->LI); - CS_InsertEntry (S, X, I+1); + /* The value is zero, we may use the simple code version: + * ldy #o-1 + * lda (sp),y + * ldy #o + * ora (sp),y + * jne/jeq ... + */ + sprintf (Buf, "$%02X", (int)(L[0]->Num-1)); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Buf, 0, L[0]->LI); + CS_InsertEntry (S, X, I+1); - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); - CS_InsertEntry (S, X, I+2); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); + CS_InsertEntry (S, X, I+2); - X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); - CS_InsertEntry (S, X, I+3); + X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); + CS_InsertEntry (S, X, I+3); - X = NewCodeEntry (OP65_ORA, AM65_ZP_INDY, "sp", 0, L[1]->LI); - CS_InsertEntry (S, X, I+4); + X = NewCodeEntry (OP65_ORA, AM65_ZP_INDY, "sp", 0, L[1]->LI); + CS_InsertEntry (S, X, I+4); - CS_DelEntries (S, I+5, 3); /* cpx/bne/cmp */ - CS_DelEntry (S, I); /* ldy */ + CS_DelEntries (S, I+5, 3); /* cpx/bne/cmp */ + CS_DelEntry (S, I); /* ldy */ - } else { + } else { - CodeEntry* X; - char Buf[20]; + CodeEntry* X; + char Buf[20]; - /* Change the code to just use the A register. Move the load - * of the low byte after the first branch if possible: - * - * ldy #o - * lda (sp),y - * cmp #a - * bne L1 - * ldy #o-1 - * lda (sp),y - * cmp #b - * jne/jeq ... - */ - X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); - CS_InsertEntry (S, X, I+3); + /* Change the code to just use the A register. Move the load + * of the low byte after the first branch if possible: + * + * ldy #o + * lda (sp),y + * cmp #a + * bne L1 + * ldy #o-1 + * lda (sp),y + * cmp #b + * jne/jeq ... + */ + X = NewCodeEntry (OP65_LDY, AM65_IMM, L[0]->Arg, 0, L[0]->LI); + CS_InsertEntry (S, X, I+3); - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); - CS_InsertEntry (S, X, I+4); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); + CS_InsertEntry (S, X, I+4); - X = NewCodeEntry (OP65_CMP, L[2]->AM, L[2]->Arg, 0, L[2]->LI); - CS_InsertEntry (S, X, I+5); + X = NewCodeEntry (OP65_CMP, L[2]->AM, L[2]->Arg, 0, L[2]->LI); + CS_InsertEntry (S, X, I+5); - sprintf (Buf, "$%02X", (int)(L[0]->Num-1)); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Buf, 0, L[0]->LI); - CS_InsertEntry (S, X, I+7); + sprintf (Buf, "$%02X", (int)(L[0]->Num-1)); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Buf, 0, L[0]->LI); + CS_InsertEntry (S, X, I+7); - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); - CS_InsertEntry (S, X, I+8); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); + CS_InsertEntry (S, X, I+8); - CS_DelEntries (S, I, 3); /* ldy/jsr/cpx */ + CS_DelEntries (S, I, 3); /* ldy/jsr/cpx */ - } + } - ++Changes; - } + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -701,46 +701,46 @@ unsigned OptCmp6 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; - cmp_t Cond; + CodeEntry* N; + cmp_t Cond; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_JSR && - (Cond = FindTosCmpCond (E->Arg)) != CMP_INV && - (N = CS_GetNextEntry (S, I)) != 0 && - (N->Info & OF_ZBRA) != 0 && - !CE_HasLabel (N)) { + /* Check for the sequence */ + if (E->OPC == OP65_JSR && + (Cond = FindTosCmpCond (E->Arg)) != CMP_INV && + (N = CS_GetNextEntry (S, I)) != 0 && + (N->Info & OF_ZBRA) != 0 && + !CE_HasLabel (N)) { - /* The tos... functions will return a boolean value in a/x and - * the Z flag says if this value is zero or not. We will call - * a cheaper subroutine instead, one that does not return a - * boolean value but only valid flags. Note: jeq jumps if - * the condition is not met, jne jumps if the condition is met. - * Invert the code if we jump on condition not met. - */ - if (GetBranchCond (N->OPC) == BC_EQ) { - /* Jumps if condition false, invert condition */ - Cond = CmpInvertTab [Cond]; - } + /* The tos... functions will return a boolean value in a/x and + * the Z flag says if this value is zero or not. We will call + * a cheaper subroutine instead, one that does not return a + * boolean value but only valid flags. Note: jeq jumps if + * the condition is not met, jne jumps if the condition is met. + * Invert the code if we jump on condition not met. + */ + if (GetBranchCond (N->OPC) == BC_EQ) { + /* Jumps if condition false, invert condition */ + Cond = CmpInvertTab [Cond]; + } - /* Replace the subroutine call. */ - E = NewCodeEntry (OP65_JSR, AM65_ABS, "tosicmp", 0, E->LI); - CS_InsertEntry (S, E, I+1); - CS_DelEntry (S, I); + /* Replace the subroutine call. */ + E = NewCodeEntry (OP65_JSR, AM65_ABS, "tosicmp", 0, E->LI); + CS_InsertEntry (S, E, I+1); + CS_DelEntry (S, I); - /* Replace the conditional branch */ - ReplaceCmp (S, I+1, Cond); + /* Replace the conditional branch */ + ReplaceCmp (S, I+1, Cond); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -761,30 +761,30 @@ unsigned OptCmp7 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[2]; + CodeEntry* L[2]; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if ((E->OPC == OP65_LDX) && - CS_GetEntries (S, L, I+1, 2) && - L[0]->OPC == OP65_TXA && - !CE_HasLabel (L[0]) && - (L[1]->Info & OF_FBRA) != 0 && - !CE_HasLabel (L[1]) && - !RegAUsed (S, I+3)) { + /* Check for the sequence */ + if ((E->OPC == OP65_LDX) && + CS_GetEntries (S, L, I+1, 2) && + L[0]->OPC == OP65_TXA && + !CE_HasLabel (L[0]) && + (L[1]->Info & OF_FBRA) != 0 && + !CE_HasLabel (L[1]) && + !RegAUsed (S, I+3)) { - /* Remove the txa */ - CS_DelEntry (S, I+1); + /* Remove the txa */ + CS_DelEntry (S, I+1); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -806,95 +806,95 @@ unsigned OptCmp8 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - int RegVal; + int RegVal; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for a compare against an immediate value */ - if ((E->Info & OF_CMP) != 0 && - (RegVal = GetCmpRegVal (E)) >= 0 && - CE_IsConstImm (E)) { + /* Check for a compare against an immediate value */ + if ((E->Info & OF_CMP) != 0 && + (RegVal = GetCmpRegVal (E)) >= 0 && + CE_IsConstImm (E)) { - /* We are able to evaluate the compare at compile time. Check if - * one or more branches are ahead. - */ - unsigned JumpsChanged = 0; - CodeEntry* N; - while ((N = CS_GetNextEntry (S, I)) != 0 && /* Followed by something.. */ - (N->Info & OF_CBRA) != 0 && /* ..that is a cond branch.. */ - !CE_HasLabel (N)) { /* ..and has no label */ + /* We are able to evaluate the compare at compile time. Check if + * one or more branches are ahead. + */ + unsigned JumpsChanged = 0; + CodeEntry* N; + while ((N = CS_GetNextEntry (S, I)) != 0 && /* Followed by something.. */ + (N->Info & OF_CBRA) != 0 && /* ..that is a cond branch.. */ + !CE_HasLabel (N)) { /* ..and has no label */ - /* Evaluate the branch condition */ - int Cond; - switch (GetBranchCond (N->OPC)) { - case BC_CC: - Cond = ((unsigned char)RegVal) < ((unsigned char)E->Num); - break; + /* Evaluate the branch condition */ + int Cond; + switch (GetBranchCond (N->OPC)) { + case BC_CC: + Cond = ((unsigned char)RegVal) < ((unsigned char)E->Num); + break; - case BC_CS: - Cond = ((unsigned char)RegVal) >= ((unsigned char)E->Num); - break; + case BC_CS: + Cond = ((unsigned char)RegVal) >= ((unsigned char)E->Num); + break; - case BC_EQ: - Cond = ((unsigned char)RegVal) == ((unsigned char)E->Num); - break; + case BC_EQ: + Cond = ((unsigned char)RegVal) == ((unsigned char)E->Num); + break; - case BC_MI: - Cond = ((signed char)RegVal) < ((signed char)E->Num); - break; + case BC_MI: + Cond = ((signed char)RegVal) < ((signed char)E->Num); + break; - case BC_NE: - Cond = ((unsigned char)RegVal) != ((unsigned char)E->Num); - break; + case BC_NE: + Cond = ((unsigned char)RegVal) != ((unsigned char)E->Num); + break; - case BC_PL: - Cond = ((signed char)RegVal) >= ((signed char)E->Num); - break; + case BC_PL: + Cond = ((signed char)RegVal) >= ((signed char)E->Num); + break; - case BC_VC: - case BC_VS: - /* Not set by the compare operation, bail out (Note: - * Just skipping anything here is rather stupid, but - * the sequence is never generated by the compiler, - * so it's quite safe to skip). - */ - goto NextEntry; + case BC_VC: + case BC_VS: + /* Not set by the compare operation, bail out (Note: + * Just skipping anything here is rather stupid, but + * the sequence is never generated by the compiler, + * so it's quite safe to skip). + */ + goto NextEntry; - default: - Internal ("Unknown branch condition"); + default: + Internal ("Unknown branch condition"); - } + } - /* If the condition is false, we may remove the jump. Otherwise - * the branch will always be taken, so we may replace it by a - * jump (and bail out). - */ - if (!Cond) { - CS_DelEntry (S, I+1); - } else { - CodeLabel* L = N->JumpTo; - const char* LabelName = L? L->Name : N->Arg; - CodeEntry* X = NewCodeEntry (OP65_JMP, AM65_BRA, LabelName, L, N->LI); - CS_InsertEntry (S, X, I+2); - CS_DelEntry (S, I+1); - } + /* If the condition is false, we may remove the jump. Otherwise + * the branch will always be taken, so we may replace it by a + * jump (and bail out). + */ + if (!Cond) { + CS_DelEntry (S, I+1); + } else { + CodeLabel* L = N->JumpTo; + const char* LabelName = L? L->Name : N->Arg; + CodeEntry* X = NewCodeEntry (OP65_JMP, AM65_BRA, LabelName, L, N->LI); + CS_InsertEntry (S, X, I+2); + CS_DelEntry (S, I+1); + } - /* Remember, we had changes */ - ++JumpsChanged; - ++Changes; - } + /* Remember, we had changes */ + ++JumpsChanged; + ++Changes; + } - /* If we have made changes above, we may also remove the compare */ - if (JumpsChanged) { - CS_DelEntry (S, I); - } + /* If we have made changes above, we may also remove the compare */ + if (JumpsChanged) { + CS_DelEntry (S, I); + } - } + } NextEntry: - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -924,14 +924,14 @@ unsigned OptCmp9 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[5]; + CodeEntry* L[5]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_SBC && - CS_GetEntries (S, L+1, I+1, 4) && + /* Check for the sequence */ + if (L[0]->OPC == OP65_SBC && + CS_GetEntries (S, L+1, I+1, 4) && (L[1]->OPC == OP65_BVC || L[1]->OPC == OP65_BVS) && L[1]->JumpTo != 0 && @@ -947,8 +947,8 @@ unsigned OptCmp9 (CodeSeg* S) !CE_HasLabel (L[4]) && !RegAUsed (S, I+4)) { - /* Replace the branch condition */ - switch (GetBranchCond (L[4]->OPC)) { + /* Replace the branch condition */ + switch (GetBranchCond (L[4]->OPC)) { case BC_CC: CE_ReplaceOPC (L[4], OP65_JPL); break; case BC_CS: CE_ReplaceOPC (L[4], OP65_JMI); break; default: Internal ("Unknown branch condition in OptCmp9"); @@ -962,10 +962,10 @@ unsigned OptCmp9 (CodeSeg* S) /* Remember, we had changes */ ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } /* Return the number of changes made */ diff --git a/src/cc65/coptcmp.h b/src/cc65/coptcmp.h index 7efbeada8..d54b8f5c6 100644 --- a/src/cc65/coptcmp.h +++ b/src/cc65/coptcmp.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptcmp.h */ +/* coptcmp.h */ /* */ -/* Optimize compares */ +/* Optimize compares */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Remove calls to the bool transformer subroutines */ +/* Remove calls to the bool transformer subroutines */ /*****************************************************************************/ @@ -57,7 +57,7 @@ unsigned OptBoolTrans (CodeSeg* S); /*****************************************************************************/ -/* Optimizations for compares */ +/* Optimizations for compares */ /*****************************************************************************/ @@ -65,38 +65,38 @@ unsigned OptBoolTrans (CodeSeg* S); unsigned OptCmp1 (CodeSeg* S); /* Search for the sequence * - * ldx xx - * stx tmp1 - * ora tmp1 + * ldx xx + * stx tmp1 + * ora tmp1 * * and replace it by * - * ora xx + * ora xx */ unsigned OptCmp2 (CodeSeg* S); /* Search for the sequence * - * stx xx - * stx tmp1 - * ora tmp1 + * stx xx + * stx tmp1 + * ora tmp1 * * and replace it by * - * stx xx - * ora xx + * stx xx + * ora xx */ unsigned OptCmp3 (CodeSeg* S); /* Search for * - * lda/and/ora/eor ... - * cmp #$00 - * jeq/jne + * lda/and/ora/eor ... + * cmp #$00 + * jeq/jne * or - * lda/and/ora/eor ... - * cmp #$00 - * jsr boolxx + * lda/and/ora/eor ... + * cmp #$00 + * jsr boolxx * * and remove the cmp. */ @@ -104,19 +104,19 @@ unsigned OptCmp3 (CodeSeg* S); unsigned OptCmp4 (CodeSeg* S); /* Search for * - * lda x - * ldx y - * cpx #a - * bne L1 - * cmp #b - * jne/jeq L2 + * lda x + * ldx y + * cpx #a + * bne L1 + * cmp #b + * jne/jeq L2 * * If a is zero, we may remove the compare. If a and b are both zero, we may * replace it by the sequence * - * lda x - * ora x+1 - * jne/jeq ... + * lda x + * ora x+1 + * jne/jeq ... * * L1 may be either the label at the branch instruction, or the target label * of this instruction. @@ -132,7 +132,7 @@ unsigned OptCmp5 (CodeSeg* S); * lda (sp),y * cpx #a * bne L1 - * cmp #b + * cmp #b * jne/jeq L2 */ diff --git a/src/cc65/coptind.c b/src/cc65/coptind.c index 34cdea8d5..14f64590e 100644 --- a/src/cc65/coptind.c +++ b/src/cc65/coptind.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptind.c */ +/* coptind.c */ /* */ -/* Environment independent low level optimizations */ +/* Environment independent low level optimizations */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -82,8 +82,8 @@ static int MemAccess (CodeSeg* S, unsigned From, unsigned To, const CodeEntry* N /* Walk over all code entries */ while (From <= To) { - /* Get the next entry */ - CodeEntry* E = CS_GetEntry (S, From); + /* Get the next entry */ + CodeEntry* E = CS_GetEntry (S, From); /* Check if there is an argument and if this argument equals Arg in * some variants. @@ -135,19 +135,19 @@ static int GetBranchDist (CodeSeg* S, unsigned From, CodeEntry* To) /* Determine the branch distance */ int Distance = 0; if (TI >= From) { - /* Forward branch, do not count the current insn */ - unsigned J = From+1; - while (J < TI) { - CodeEntry* N = CS_GetEntry (S, J++); - Distance += N->Size; - } + /* Forward branch, do not count the current insn */ + unsigned J = From+1; + while (J < TI) { + CodeEntry* N = CS_GetEntry (S, J++); + Distance += N->Size; + } } else { - /* Backward branch */ - unsigned J = TI; - while (J < From) { - CodeEntry* N = CS_GetEntry (S, J++); - Distance -= N->Size; - } + /* Backward branch */ + unsigned J = TI; + while (J < From) { + CodeEntry* N = CS_GetEntry (S, J++); + Distance -= N->Size; + } } /* Return the calculated distance */ @@ -168,17 +168,17 @@ static short ZPRegVal (unsigned short Use, const RegContents* RC) /* Return the contents of the given zeropage register */ { if ((Use & REG_TMP1) != 0) { - return RC->Tmp1; + return RC->Tmp1; } else if ((Use & REG_PTR1_LO) != 0) { - return RC->Ptr1Lo; + return RC->Ptr1Lo; } else if ((Use & REG_PTR1_HI) != 0) { - return RC->Ptr1Hi; + return RC->Ptr1Hi; } else if ((Use & REG_SREG_LO) != 0) { - return RC->SRegLo; + return RC->SRegLo; } else if ((Use & REG_SREG_HI) != 0) { - return RC->SRegHi; + return RC->SRegHi; } else { - return UNKNOWN_REGVAL; + return UNKNOWN_REGVAL; } } @@ -188,11 +188,11 @@ static short RegVal (unsigned short Use, const RegContents* RC) /* Return the contents of the given register */ { if ((Use & REG_A) != 0) { - return RC->RegA; + return RC->RegA; } else if ((Use & REG_X) != 0) { - return RC->RegX; + return RC->RegX; } else if ((Use & REG_Y) != 0) { - return RC->RegY; + return RC->RegY; } else { return ZPRegVal (Use, RC); } @@ -201,7 +201,7 @@ static short RegVal (unsigned short Use, const RegContents* RC) /*****************************************************************************/ -/* Replace jumps to RTS by RTS */ +/* Replace jumps to RTS by RTS */ /*****************************************************************************/ @@ -215,28 +215,28 @@ unsigned OptRTSJumps1 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - /* Get the next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get the next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's an unconditional branch to a local target */ - if ((E->Info & OF_UBRA) != 0 && - E->JumpTo != 0 && - E->JumpTo->Owner->OPC == OP65_RTS) { + /* Check if it's an unconditional branch to a local target */ + if ((E->Info & OF_UBRA) != 0 && + E->JumpTo != 0 && + E->JumpTo->Owner->OPC == OP65_RTS) { - /* Insert an RTS instruction */ - CodeEntry* X = NewCodeEntry (OP65_RTS, AM65_IMP, 0, 0, E->LI); - CS_InsertEntry (S, X, I+1); + /* Insert an RTS instruction */ + CodeEntry* X = NewCodeEntry (OP65_RTS, AM65_IMP, 0, 0, E->LI); + CS_InsertEntry (S, X, I+1); - /* Delete the jump */ - CS_DelEntry (S, I); + /* Delete the jump */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -255,13 +255,13 @@ unsigned OptRTSJumps2 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S) - 1) { - /* Get the next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get the next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's an conditional branch to a local target */ - if ((E->Info & OF_CBRA) != 0 && /* Conditional branch */ - (E->Info & OF_LBRA) != 0 && /* Long branch */ - E->JumpTo != 0) { /* Local label */ + /* Check if it's an conditional branch to a local target */ + if ((E->Info & OF_CBRA) != 0 && /* Conditional branch */ + (E->Info & OF_LBRA) != 0 && /* Long branch */ + E->JumpTo != 0) { /* Local label */ /* Get the jump target and the next entry. There's always a next @@ -318,10 +318,10 @@ unsigned OptRTSJumps2 (CodeSeg* S) ++Changes; } - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -332,7 +332,7 @@ unsigned OptRTSJumps2 (CodeSeg* S) /*****************************************************************************/ -/* Remove dead jumps */ +/* Remove dead jumps */ /*****************************************************************************/ @@ -346,28 +346,28 @@ unsigned OptDeadJumps (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - /* Get the next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get the next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's a branch, if it has a local target, and if the target - * is the next instruction. - */ - if (E->AM == AM65_BRA && - E->JumpTo && - E->JumpTo->Owner == CS_GetNextEntry (S, I)) { + /* Check if it's a branch, if it has a local target, and if the target + * is the next instruction. + */ + if (E->AM == AM65_BRA && + E->JumpTo && + E->JumpTo->Owner == CS_GetNextEntry (S, I)) { - /* Delete the dead jump */ - CS_DelEntry (S, I); + /* Delete the dead jump */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } else { + } else { - /* Next entry */ - ++I; + /* Next entry */ + ++I; - } + } } /* Return the number of changes made */ @@ -377,7 +377,7 @@ unsigned OptDeadJumps (CodeSeg* S) /*****************************************************************************/ -/* Remove dead code */ +/* Remove dead code */ /*****************************************************************************/ @@ -393,36 +393,36 @@ unsigned OptDeadCode (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; + CodeEntry* N; CodeLabel* LN; - /* Get this entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get this entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's an unconditional branch, and if the next entry has - * no labels attached, or if the label is just used so that the insn + /* Check if it's an unconditional branch, and if the next entry has + * no labels attached, or if the label is just used so that the insn * can jump to itself. - */ - if ((E->Info & OF_DEAD) != 0 && /* Dead code follows */ - (N = CS_GetNextEntry (S, I)) != 0 && /* Has next entry */ - (!CE_HasLabel (N) || /* Don't has a label */ + */ + if ((E->Info & OF_DEAD) != 0 && /* Dead code follows */ + (N = CS_GetNextEntry (S, I)) != 0 && /* Has next entry */ + (!CE_HasLabel (N) || /* Don't has a label */ ((N->Info & OF_UBRA) != 0 && /* Uncond branch */ (LN = N->JumpTo) != 0 && /* Jumps to known label */ LN->Owner == N && /* Attached to insn */ CL_GetRefCount (LN) == 1))) { /* Only reference */ - /* Delete the next entry */ - CS_DelEntry (S, I+1); + /* Delete the next entry */ + CS_DelEntry (S, I+1); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } else { + } else { - /* Next entry */ - ++I; + /* Next entry */ + ++I; - } + } } /* Return the number of changes made */ @@ -432,7 +432,7 @@ unsigned OptDeadCode (CodeSeg* S) /*****************************************************************************/ -/* Optimize jump cascades */ +/* Optimize jump cascades */ /*****************************************************************************/ @@ -451,13 +451,13 @@ unsigned OptJumpCascades (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; - CodeLabel* OldLabel; + CodeEntry* N; + CodeLabel* OldLabel; - /* Get this entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get this entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check: + /* Check: * - if it's a branch, * - if it has a jump label, * - if this jump label is not attached to the instruction itself, @@ -468,28 +468,28 @@ unsigned OptJumpCascades (CodeSeg* S) * outside of the function (usually incspx), which won't simplify the * code, since conditional far branches are emulated by a short branch * around a jump. - */ - if ((E->Info & OF_BRA) != 0 && - (OldLabel = E->JumpTo) != 0 && - (N = OldLabel->Owner) != E && - (N->Info & OF_BRA) != 0 && + */ + if ((E->Info & OF_BRA) != 0 && + (OldLabel = E->JumpTo) != 0 && + (N = OldLabel->Owner) != E && + (N->Info & OF_BRA) != 0 && ((E->Info & OF_CBRA) == 0 || N->JumpTo != 0)) { - /* Check if we can use the final target label. This is the case, - * if the target branch is an absolut branch, or if it is a - * conditional branch checking the same condition as the first one. - */ - if ((N->Info & OF_UBRA) != 0 || - ((E->Info & OF_CBRA) != 0 && - GetBranchCond (E->OPC) == GetBranchCond (N->OPC))) { + /* Check if we can use the final target label. This is the case, + * if the target branch is an absolut branch, or if it is a + * conditional branch checking the same condition as the first one. + */ + if ((N->Info & OF_UBRA) != 0 || + ((E->Info & OF_CBRA) != 0 && + GetBranchCond (E->OPC) == GetBranchCond (N->OPC))) { - /* This is a jump cascade and we may jump to the final target, + /* This is a jump cascade and we may jump to the final target, * provided that the other insn does not jump to itself. If * this is the case, we can also jump to ourselves, otherwise * insert a jump to the new instruction and remove the old one. - */ - CodeEntry* X; + */ + CodeEntry* X; CodeLabel* LN = N->JumpTo; if (LN != 0 && LN->Owner == N) { @@ -507,57 +507,57 @@ unsigned OptJumpCascades (CodeSeg* S) } - /* Insert it behind E */ - CS_InsertEntry (S, X, I+1); + /* Insert it behind E */ + CS_InsertEntry (S, X, I+1); - /* Remove E */ - CS_DelEntry (S, I); + /* Remove E */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - /* Check if both are conditional branches, and the condition of - * the second is the inverse of that of the first. In this case, - * the second branch will never be taken, and we may jump directly - * to the instruction behind this one. - */ - } else if ((E->Info & OF_CBRA) != 0 && (N->Info & OF_CBRA) != 0) { + /* Check if both are conditional branches, and the condition of + * the second is the inverse of that of the first. In this case, + * the second branch will never be taken, and we may jump directly + * to the instruction behind this one. + */ + } else if ((E->Info & OF_CBRA) != 0 && (N->Info & OF_CBRA) != 0) { - CodeEntry* X; /* Instruction behind N */ - CodeLabel* LX; /* Label attached to X */ + CodeEntry* X; /* Instruction behind N */ + CodeLabel* LX; /* Label attached to X */ - /* Get the branch conditions of both branches */ - bc_t BC1 = GetBranchCond (E->OPC); - bc_t BC2 = GetBranchCond (N->OPC); + /* Get the branch conditions of both branches */ + bc_t BC1 = GetBranchCond (E->OPC); + bc_t BC2 = GetBranchCond (N->OPC); - /* Check the branch conditions */ - if (BC1 != GetInverseCond (BC2)) { - /* Condition not met */ - goto NextEntry; - } + /* Check the branch conditions */ + if (BC1 != GetInverseCond (BC2)) { + /* Condition not met */ + goto NextEntry; + } - /* We may jump behind this conditional branch. Get the - * pointer to the next instruction - */ - if ((X = CS_GetNextEntry (S, CS_GetEntryIndex (S, N))) == 0) { - /* N is the last entry, bail out */ - goto NextEntry; - } + /* We may jump behind this conditional branch. Get the + * pointer to the next instruction + */ + if ((X = CS_GetNextEntry (S, CS_GetEntryIndex (S, N))) == 0) { + /* N is the last entry, bail out */ + goto NextEntry; + } - /* Get the label attached to X, create a new one if needed */ - LX = CS_GenLabel (S, X); + /* Get the label attached to X, create a new one if needed */ + LX = CS_GenLabel (S, X); - /* Move the reference from E to the new label */ - CS_MoveLabelRef (S, E, LX); + /* Move the reference from E to the new label */ + CS_MoveLabelRef (S, E, LX); - /* Remember, we had changes */ - ++Changes; - } - } + /* Remember, we had changes */ + ++Changes; + } + } NextEntry: - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -568,7 +568,7 @@ NextEntry: /*****************************************************************************/ -/* Optimize jsr/rts */ +/* Optimize jsr/rts */ /*****************************************************************************/ @@ -585,27 +585,27 @@ unsigned OptRTS (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; + CodeEntry* N; - /* Get this entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get this entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's a subroutine call and if the following insn is RTS */ - if (E->OPC == OP65_JSR && - (N = CS_GetNextEntry (S, I)) != 0 && - N->OPC == OP65_RTS) { + /* Check if it's a subroutine call and if the following insn is RTS */ + if (E->OPC == OP65_JSR && + (N = CS_GetNextEntry (S, I)) != 0 && + N->OPC == OP65_RTS) { - /* Change the jsr to a jmp and use the additional info for a jump */ - E->AM = AM65_BRA; - CE_ReplaceOPC (E, OP65_JMP); + /* Change the jsr to a jmp and use the additional info for a jump */ + E->AM = AM65_BRA; + CE_ReplaceOPC (E, OP65_JMP); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -616,7 +616,7 @@ unsigned OptRTS (CodeSeg* S) /*****************************************************************************/ -/* Optimize jump targets */ +/* Optimize jump targets */ /*****************************************************************************/ @@ -629,33 +629,33 @@ unsigned OptJumpTarget1 (CodeSeg* S) */ { unsigned Changes = 0; - CodeEntry* E1; /* Entry 1 */ - CodeEntry* E2; /* Entry 2 */ - CodeEntry* T1; /* Jump target entry 1 */ - CodeLabel* TL1; /* Target label 1 */ + CodeEntry* E1; /* Entry 1 */ + CodeEntry* E2; /* Entry 2 */ + CodeEntry* T1; /* Jump target entry 1 */ + CodeLabel* TL1; /* Target label 1 */ /* Walk over the entries */ unsigned I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - E2 = CS_GetNextEntry (S, I); + /* Get next entry */ + E2 = CS_GetNextEntry (S, I); - /* Check if we have a jump or branch without a label attached, and + /* Check if we have a jump or branch without a label attached, and * a jump target, which is not attached to the jump itself - */ - if (E2 != 0 && - (E2->Info & OF_UBRA) != 0 && + */ + if (E2 != 0 && + (E2->Info & OF_UBRA) != 0 && !CE_HasLabel (E2) && - E2->JumpTo && - E2->JumpTo->Owner != E2) { + E2->JumpTo && + E2->JumpTo->Owner != E2) { - /* Get the entry preceeding the branch target */ - T1 = CS_GetPrevEntry (S, CS_GetEntryIndex (S, E2->JumpTo->Owner)); - if (T1 == 0) { - /* There is no such entry */ - goto NextEntry; - } + /* Get the entry preceeding the branch target */ + T1 = CS_GetPrevEntry (S, CS_GetEntryIndex (S, E2->JumpTo->Owner)); + if (T1 == 0) { + /* There is no such entry */ + goto NextEntry; + } /* The entry preceeding the branch target may not be the branch * insn. @@ -664,38 +664,38 @@ unsigned OptJumpTarget1 (CodeSeg* S) goto NextEntry; } - /* Get the entry preceeding the jump */ - E1 = CS_GetEntry (S, I); + /* Get the entry preceeding the jump */ + E1 = CS_GetEntry (S, I); - /* Check if both preceeding instructions are identical */ - if (!CodeEntriesAreEqual (E1, T1)) { - /* Not equal, try next */ + /* Check if both preceeding instructions are identical */ + if (!CodeEntriesAreEqual (E1, T1)) { + /* Not equal, try next */ goto NextEntry; - } + } - /* Get the label for the instruction preceeding the jump target. - * This routine will create a new label if the instruction does - * not already have one. - */ - TL1 = CS_GenLabel (S, T1); + /* Get the label for the instruction preceeding the jump target. + * This routine will create a new label if the instruction does + * not already have one. + */ + TL1 = CS_GenLabel (S, T1); - /* Change the jump target to point to this new label */ - CS_MoveLabelRef (S, E2, TL1); + /* Change the jump target to point to this new label */ + CS_MoveLabelRef (S, E2, TL1); - /* If the instruction preceeding the jump has labels attached, - * move references to this label to the new label. - */ - if (CE_HasLabel (E1)) { - CS_MoveLabels (S, E1, T1); - } + /* If the instruction preceeding the jump has labels attached, + * move references to this label to the new label. + */ + if (CE_HasLabel (E1)) { + CS_MoveLabels (S, E1, T1); + } - /* Remove the entry preceeding the jump */ - CS_DelEntry (S, I); + /* Remove the entry preceeding the jump */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } else { + } else { NextEntry: /* Next entry */ ++I; @@ -729,8 +729,8 @@ unsigned OptJumpTarget2 (CodeSeg* S) /* New jump label */ CodeLabel* L; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); /* Check if this is a bcc insn */ if (E->OPC == OP65_BCC || E->OPC == OP65_JCC) { @@ -800,8 +800,8 @@ unsigned OptJumpTarget3 (CodeSeg* S) CodeEntry* N; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); /* Check if this is a load insn with a label and the next insn is not * a conditional branch that needs the flags from the load. @@ -868,7 +868,7 @@ unsigned OptJumpTarget3 (CodeSeg* S) /*****************************************************************************/ -/* Optimize conditional branches */ +/* Optimize conditional branches */ /*****************************************************************************/ @@ -892,71 +892,71 @@ unsigned OptCondBranches1 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; - CodeLabel* L; + CodeEntry* N; + CodeLabel* L; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's a register load */ - if ((E->Info & OF_LOAD) != 0 && /* It's a load instruction */ - E->AM == AM65_IMM && /* ..with immidiate addressing */ - (E->Flags & CEF_NUMARG) != 0 && /* ..and a numeric argument. */ - (N = CS_GetNextEntry (S, I)) != 0 && /* There is a following entry */ - (N->Info & OF_CBRA) != 0 && /* ..which is a conditional branch */ - !CE_HasLabel (N)) { /* ..and does not have a label */ + /* Check if it's a register load */ + if ((E->Info & OF_LOAD) != 0 && /* It's a load instruction */ + E->AM == AM65_IMM && /* ..with immidiate addressing */ + (E->Flags & CEF_NUMARG) != 0 && /* ..and a numeric argument. */ + (N = CS_GetNextEntry (S, I)) != 0 && /* There is a following entry */ + (N->Info & OF_CBRA) != 0 && /* ..which is a conditional branch */ + !CE_HasLabel (N)) { /* ..and does not have a label */ - /* Get the branch condition */ - bc_t BC = GetBranchCond (N->OPC); + /* Get the branch condition */ + bc_t BC = GetBranchCond (N->OPC); - /* Check the argument against the branch condition */ - if ((BC == BC_EQ && E->Num != 0) || - (BC == BC_NE && E->Num == 0) || - (BC == BC_PL && (E->Num & 0x80) != 0) || - (BC == BC_MI && (E->Num & 0x80) == 0)) { + /* Check the argument against the branch condition */ + if ((BC == BC_EQ && E->Num != 0) || + (BC == BC_NE && E->Num == 0) || + (BC == BC_PL && (E->Num & 0x80) != 0) || + (BC == BC_MI && (E->Num & 0x80) == 0)) { - /* Remove the conditional branch */ - CS_DelEntry (S, I+1); + /* Remove the conditional branch */ + CS_DelEntry (S, I+1); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } else if ((BC == BC_EQ && E->Num == 0) || - (BC == BC_NE && E->Num != 0) || - (BC == BC_PL && (E->Num & 0x80) == 0) || - (BC == BC_MI && (E->Num & 0x80) != 0)) { + } else if ((BC == BC_EQ && E->Num == 0) || + (BC == BC_NE && E->Num != 0) || + (BC == BC_PL && (E->Num & 0x80) == 0) || + (BC == BC_MI && (E->Num & 0x80) != 0)) { - /* The branch is always taken, replace it by a jump */ - CE_ReplaceOPC (N, OP65_JMP); + /* The branch is always taken, replace it by a jump */ + CE_ReplaceOPC (N, OP65_JMP); - /* Remember, we had changes */ - ++Changes; - } + /* Remember, we had changes */ + ++Changes; + } - } + } - if ((E->Info & OF_CBRA) != 0 && /* It's a conditional branch */ - (L = E->JumpTo) != 0 && /* ..referencing a local label */ - (N = CS_GetNextEntry (S, I)) != 0 && /* There is a following entry */ - (N->Info & OF_UBRA) != 0 && /* ..which is an uncond branch, */ - !CE_HasLabel (N) && /* ..has no label attached */ - L->Owner == CS_GetNextEntry (S, I+1)) {/* ..and jump target follows */ + if ((E->Info & OF_CBRA) != 0 && /* It's a conditional branch */ + (L = E->JumpTo) != 0 && /* ..referencing a local label */ + (N = CS_GetNextEntry (S, I)) != 0 && /* There is a following entry */ + (N->Info & OF_UBRA) != 0 && /* ..which is an uncond branch, */ + !CE_HasLabel (N) && /* ..has no label attached */ + L->Owner == CS_GetNextEntry (S, I+1)) {/* ..and jump target follows */ - /* Replace the jump by a conditional branch with the inverse branch - * condition than the branch around it. - */ - CE_ReplaceOPC (N, GetInverseBranch (E->OPC)); + /* Replace the jump by a conditional branch with the inverse branch + * condition than the branch around it. + */ + CE_ReplaceOPC (N, GetInverseBranch (E->OPC)); - /* Remove the conditional branch */ - CS_DelEntry (S, I); + /* Remove the conditional branch */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -978,13 +978,13 @@ unsigned OptCondBranches2 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; + CodeEntry* N; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's a rol insn with A in accu and a branch follows */ - if (E->OPC == OP65_ROL && + /* Check if it's a rol insn with A in accu and a branch follows */ + if (E->OPC == OP65_ROL && E->AM == AM65_ACC && E->RI->In.RegA == 0 && !CE_HasLabel (E) && @@ -992,8 +992,8 @@ unsigned OptCondBranches2 (CodeSeg* S) (N->Info & OF_ZBRA) != 0 && !RegAUsed (S, I+1)) { - /* Replace the branch condition */ - switch (GetBranchCond (N->OPC)) { + /* Replace the branch condition */ + switch (GetBranchCond (N->OPC)) { case BC_EQ: CE_ReplaceOPC (N, OP65_JCC); break; case BC_NE: CE_ReplaceOPC (N, OP65_JCS); break; default: Internal ("Unknown branch condition in OptCondBranches2"); @@ -1004,10 +1004,10 @@ unsigned OptCondBranches2 (CodeSeg* S) /* Remember, we had changes */ ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } /* Return the number of changes made */ @@ -1017,7 +1017,7 @@ unsigned OptCondBranches2 (CodeSeg* S) /*****************************************************************************/ -/* Remove unused loads and stores */ +/* Remove unused loads and stores */ /*****************************************************************************/ @@ -1031,51 +1031,51 @@ unsigned OptUnusedLoads (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; + CodeEntry* N; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's a register load or transfer insn */ - if ((E->Info & (OF_LOAD | OF_XFR | OF_REG_INCDEC)) != 0 && - (N = CS_GetNextEntry (S, I)) != 0 && - !CE_UseLoadFlags (N)) { + /* Check if it's a register load or transfer insn */ + if ((E->Info & (OF_LOAD | OF_XFR | OF_REG_INCDEC)) != 0 && + (N = CS_GetNextEntry (S, I)) != 0 && + !CE_UseLoadFlags (N)) { - /* Check which sort of load or transfer it is */ - unsigned R; - switch (E->OPC) { - case OP65_DEA: - case OP65_INA: - case OP65_LDA: - case OP65_TXA: - case OP65_TYA: R = REG_A; break; - case OP65_DEX: - case OP65_INX: - case OP65_LDX: - case OP65_TAX: R = REG_X; break; - case OP65_DEY: - case OP65_INY: - case OP65_LDY: - case OP65_TAY: R = REG_Y; break; - default: goto NextEntry; /* OOPS */ - } + /* Check which sort of load or transfer it is */ + unsigned R; + switch (E->OPC) { + case OP65_DEA: + case OP65_INA: + case OP65_LDA: + case OP65_TXA: + case OP65_TYA: R = REG_A; break; + case OP65_DEX: + case OP65_INX: + case OP65_LDX: + case OP65_TAX: R = REG_X; break; + case OP65_DEY: + case OP65_INY: + case OP65_LDY: + case OP65_TAY: R = REG_Y; break; + default: goto NextEntry; /* OOPS */ + } - /* Get register usage and check if the register value is used later */ - if ((GetRegInfo (S, I+1, R) & R) == 0) { + /* Get register usage and check if the register value is used later */ + if ((GetRegInfo (S, I+1, R) & R) == 0) { - /* Register value is not used, remove the load */ - CS_DelEntry (S, I); + /* Register value is not used, remove the load */ + CS_DelEntry (S, I); - /* Remember, we had changes. Account the deleted entry in I. */ - ++Changes; - --I; + /* Remember, we had changes. Account the deleted entry in I. */ + ++Changes; + --I; - } - } + } + } NextEntry: - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -1094,35 +1094,35 @@ unsigned OptUnusedStores (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's a register load or transfer insn */ - if ((E->Info & OF_STORE) != 0 && - E->AM == AM65_ZP && - (E->Chg & REG_ZP) != 0) { + /* Check if it's a register load or transfer insn */ + if ((E->Info & OF_STORE) != 0 && + E->AM == AM65_ZP && + (E->Chg & REG_ZP) != 0) { - /* Check for the zero page location. We know that there cannot be - * more than one zero page location involved in the store. - */ - unsigned R = E->Chg & REG_ZP; + /* Check for the zero page location. We know that there cannot be + * more than one zero page location involved in the store. + */ + unsigned R = E->Chg & REG_ZP; - /* Get register usage and check if the register value is used later */ - if ((GetRegInfo (S, I+1, R) & R) == 0) { + /* Get register usage and check if the register value is used later */ + if ((GetRegInfo (S, I+1, R) & R) == 0) { - /* Register value is not used, remove the load */ - CS_DelEntry (S, I); + /* Register value is not used, remove the load */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; /* Continue with next insn */ continue; - } - } + } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -1142,187 +1142,187 @@ unsigned OptDupLoads (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; + CodeEntry* N; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Assume we won't delete the entry */ - int Delete = 0; + /* Assume we won't delete the entry */ + int Delete = 0; - /* Get a pointer to the input registers of the insn */ - const RegContents* In = &E->RI->In; + /* Get a pointer to the input registers of the insn */ + const RegContents* In = &E->RI->In; - /* Handle the different instructions */ - switch (E->OPC) { + /* Handle the different instructions */ + switch (E->OPC) { - case OP65_LDA: - if (RegValIsKnown (In->RegA) && /* Value of A is known */ - CE_IsKnownImm (E, In->RegA) && /* Value to be loaded is known */ - (N = CS_GetNextEntry (S, I)) != 0 && /* There is a next entry */ - !CE_UseLoadFlags (N)) { /* Which does not use the flags */ - Delete = 1; - } - break; + case OP65_LDA: + if (RegValIsKnown (In->RegA) && /* Value of A is known */ + CE_IsKnownImm (E, In->RegA) && /* Value to be loaded is known */ + (N = CS_GetNextEntry (S, I)) != 0 && /* There is a next entry */ + !CE_UseLoadFlags (N)) { /* Which does not use the flags */ + Delete = 1; + } + break; - case OP65_LDX: - if (RegValIsKnown (In->RegX) && /* Value of X is known */ - CE_IsKnownImm (E, In->RegX) && /* Value to be loaded is known */ - (N = CS_GetNextEntry (S, I)) != 0 && /* There is a next entry */ - !CE_UseLoadFlags (N)) { /* Which does not use the flags */ - Delete = 1; - } - break; + case OP65_LDX: + if (RegValIsKnown (In->RegX) && /* Value of X is known */ + CE_IsKnownImm (E, In->RegX) && /* Value to be loaded is known */ + (N = CS_GetNextEntry (S, I)) != 0 && /* There is a next entry */ + !CE_UseLoadFlags (N)) { /* Which does not use the flags */ + Delete = 1; + } + break; - case OP65_LDY: - if (RegValIsKnown (In->RegY) && /* Value of Y is known */ - CE_IsKnownImm (E, In->RegY) && /* Value to be loaded is known */ - (N = CS_GetNextEntry (S, I)) != 0 && /* There is a next entry */ - !CE_UseLoadFlags (N)) { /* Which does not use the flags */ - Delete = 1; - } - break; + case OP65_LDY: + if (RegValIsKnown (In->RegY) && /* Value of Y is known */ + CE_IsKnownImm (E, In->RegY) && /* Value to be loaded is known */ + (N = CS_GetNextEntry (S, I)) != 0 && /* There is a next entry */ + !CE_UseLoadFlags (N)) { /* Which does not use the flags */ + Delete = 1; + } + break; - case OP65_STA: - /* If we store into a known zero page location, and this - * location does already contain the value to be stored, - * remove the store. - */ - if (RegValIsKnown (In->RegA) && /* Value of A is known */ - E->AM == AM65_ZP && /* Store into zp */ - In->RegA == ZPRegVal (E->Chg, In)) { /* Value identical */ + case OP65_STA: + /* If we store into a known zero page location, and this + * location does already contain the value to be stored, + * remove the store. + */ + if (RegValIsKnown (In->RegA) && /* Value of A is known */ + E->AM == AM65_ZP && /* Store into zp */ + In->RegA == ZPRegVal (E->Chg, In)) { /* Value identical */ - Delete = 1; - } - break; + Delete = 1; + } + break; - case OP65_STX: - /* If we store into a known zero page location, and this - * location does already contain the value to be stored, - * remove the store. - */ - if (RegValIsKnown (In->RegX) && /* Value of A is known */ - E->AM == AM65_ZP && /* Store into zp */ - In->RegX == ZPRegVal (E->Chg, In)) { /* Value identical */ + case OP65_STX: + /* If we store into a known zero page location, and this + * location does already contain the value to be stored, + * remove the store. + */ + if (RegValIsKnown (In->RegX) && /* Value of A is known */ + E->AM == AM65_ZP && /* Store into zp */ + In->RegX == ZPRegVal (E->Chg, In)) { /* Value identical */ - Delete = 1; + Delete = 1; - /* If the value in the X register is known and the same as - * that in the A register, replace the store by a STA. The - * optimizer will then remove the load instruction for X - * later. STX does support the zeropage,y addressing mode, - * so be sure to check for that. - */ - } else if (RegValIsKnown (In->RegX) && - In->RegX == In->RegA && - E->AM != AM65_ABSY && - E->AM != AM65_ZPY) { - /* Use the A register instead */ - CE_ReplaceOPC (E, OP65_STA); - } - break; + /* If the value in the X register is known and the same as + * that in the A register, replace the store by a STA. The + * optimizer will then remove the load instruction for X + * later. STX does support the zeropage,y addressing mode, + * so be sure to check for that. + */ + } else if (RegValIsKnown (In->RegX) && + In->RegX == In->RegA && + E->AM != AM65_ABSY && + E->AM != AM65_ZPY) { + /* Use the A register instead */ + CE_ReplaceOPC (E, OP65_STA); + } + break; - case OP65_STY: - /* If we store into a known zero page location, and this - * location does already contain the value to be stored, - * remove the store. - */ - if (RegValIsKnown (In->RegY) && /* Value of Y is known */ - E->AM == AM65_ZP && /* Store into zp */ - In->RegY == ZPRegVal (E->Chg, In)) { /* Value identical */ + case OP65_STY: + /* If we store into a known zero page location, and this + * location does already contain the value to be stored, + * remove the store. + */ + if (RegValIsKnown (In->RegY) && /* Value of Y is known */ + E->AM == AM65_ZP && /* Store into zp */ + In->RegY == ZPRegVal (E->Chg, In)) { /* Value identical */ - Delete = 1; + Delete = 1; - /* If the value in the Y register is known and the same as - * that in the A register, replace the store by a STA. The - * optimizer will then remove the load instruction for Y - * later. If replacement by A is not possible try a - * replacement by X, but check for invalid addressing modes - * in this case. - */ - } else if (RegValIsKnown (In->RegY)) { - if (In->RegY == In->RegA) { - CE_ReplaceOPC (E, OP65_STA); - } else if (In->RegY == In->RegX && - E->AM != AM65_ABSX && - E->AM != AM65_ZPX) { - CE_ReplaceOPC (E, OP65_STX); - } - } - break; + /* If the value in the Y register is known and the same as + * that in the A register, replace the store by a STA. The + * optimizer will then remove the load instruction for Y + * later. If replacement by A is not possible try a + * replacement by X, but check for invalid addressing modes + * in this case. + */ + } else if (RegValIsKnown (In->RegY)) { + if (In->RegY == In->RegA) { + CE_ReplaceOPC (E, OP65_STA); + } else if (In->RegY == In->RegX && + E->AM != AM65_ABSX && + E->AM != AM65_ZPX) { + CE_ReplaceOPC (E, OP65_STX); + } + } + break; - case OP65_STZ: - /* If we store into a known zero page location, and this - * location does already contain the value to be stored, - * remove the store. - */ - if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0 && E->AM == AM65_ZP) { - if (ZPRegVal (E->Chg, In) == 0) { + case OP65_STZ: + /* If we store into a known zero page location, and this + * location does already contain the value to be stored, + * remove the store. + */ + if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0 && E->AM == AM65_ZP) { + if (ZPRegVal (E->Chg, In) == 0) { Delete = 1; } - } - break; + } + break; - case OP65_TAX: + case OP65_TAX: if (RegValIsKnown (In->RegA) && - In->RegA == In->RegX && - (N = CS_GetNextEntry (S, I)) != 0 && - !CE_UseLoadFlags (N)) { - /* Value is identical and not followed by a branch */ - Delete = 1; - } - break; + In->RegA == In->RegX && + (N = CS_GetNextEntry (S, I)) != 0 && + !CE_UseLoadFlags (N)) { + /* Value is identical and not followed by a branch */ + Delete = 1; + } + break; - case OP65_TAY: + case OP65_TAY: if (RegValIsKnown (In->RegA) && - In->RegA == In->RegY && - (N = CS_GetNextEntry (S, I)) != 0 && - !CE_UseLoadFlags (N)) { - /* Value is identical and not followed by a branch */ - Delete = 1; - } - break; + In->RegA == In->RegY && + (N = CS_GetNextEntry (S, I)) != 0 && + !CE_UseLoadFlags (N)) { + /* Value is identical and not followed by a branch */ + Delete = 1; + } + break; - case OP65_TXA: + case OP65_TXA: if (RegValIsKnown (In->RegX) && - In->RegX == In->RegA && - (N = CS_GetNextEntry (S, I)) != 0 && - !CE_UseLoadFlags (N)) { - /* Value is identical and not followed by a branch */ - Delete = 1; - } - break; + In->RegX == In->RegA && + (N = CS_GetNextEntry (S, I)) != 0 && + !CE_UseLoadFlags (N)) { + /* Value is identical and not followed by a branch */ + Delete = 1; + } + break; - case OP65_TYA: + case OP65_TYA: if (RegValIsKnown (In->RegY) && - In->RegY == In->RegA && - (N = CS_GetNextEntry (S, I)) != 0 && - !CE_UseLoadFlags (N)) { - /* Value is identical and not followed by a branch */ - Delete = 1; - } - break; + In->RegY == In->RegA && + (N = CS_GetNextEntry (S, I)) != 0 && + !CE_UseLoadFlags (N)) { + /* Value is identical and not followed by a branch */ + Delete = 1; + } + break; - default: - break; + default: + break; - } + } - /* Delete the entry if requested */ - if (Delete) { + /* Delete the entry if requested */ + if (Delete) { - /* Register value is not used, remove the load */ - CS_DelEntry (S, I); + /* Register value is not used, remove the load */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } else { + } else { - /* Next entry */ - ++I; + /* Next entry */ + ++I; - } + } } @@ -1341,36 +1341,36 @@ unsigned OptStoreLoad (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; - CodeEntry* X; + CodeEntry* N; + CodeEntry* X; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it is a store instruction followed by a load from the - * same address which is itself not followed by a conditional branch. - */ - if ((E->Info & OF_STORE) != 0 && - (N = CS_GetNextEntry (S, I)) != 0 && - !CE_HasLabel (N) && - E->AM == N->AM && - ((E->OPC == OP65_STA && N->OPC == OP65_LDA) || - (E->OPC == OP65_STX && N->OPC == OP65_LDX) || - (E->OPC == OP65_STY && N->OPC == OP65_LDY)) && - strcmp (E->Arg, N->Arg) == 0 && - (X = CS_GetNextEntry (S, I+1)) != 0 && + /* Check if it is a store instruction followed by a load from the + * same address which is itself not followed by a conditional branch. + */ + if ((E->Info & OF_STORE) != 0 && + (N = CS_GetNextEntry (S, I)) != 0 && + !CE_HasLabel (N) && + E->AM == N->AM && + ((E->OPC == OP65_STA && N->OPC == OP65_LDA) || + (E->OPC == OP65_STX && N->OPC == OP65_LDX) || + (E->OPC == OP65_STY && N->OPC == OP65_LDY)) && + strcmp (E->Arg, N->Arg) == 0 && + (X = CS_GetNextEntry (S, I+1)) != 0 && !CE_UseLoadFlags (X)) { - /* Register has already the correct value, remove the load */ - CS_DelEntry (S, I+1); + /* Register has already the correct value, remove the load */ + CS_DelEntry (S, I+1); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -1389,56 +1389,56 @@ unsigned OptTransfers1 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; - CodeEntry* X; - CodeEntry* P; + CodeEntry* N; + CodeEntry* X; + CodeEntry* P; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if we have two transfer instructions */ - if ((E->Info & OF_XFR) != 0 && - (N = CS_GetNextEntry (S, I)) != 0 && - !CE_HasLabel (N) && - (N->Info & OF_XFR) != 0) { + /* Check if we have two transfer instructions */ + if ((E->Info & OF_XFR) != 0 && + (N = CS_GetNextEntry (S, I)) != 0 && + !CE_HasLabel (N) && + (N->Info & OF_XFR) != 0) { - /* Check if it's a transfer and back */ - if ((E->OPC == OP65_TAX && N->OPC == OP65_TXA && !RegXUsed (S, I+2)) || - (E->OPC == OP65_TAY && N->OPC == OP65_TYA && !RegYUsed (S, I+2)) || - (E->OPC == OP65_TXA && N->OPC == OP65_TAX && !RegAUsed (S, I+2)) || - (E->OPC == OP65_TYA && N->OPC == OP65_TAY && !RegAUsed (S, I+2))) { + /* Check if it's a transfer and back */ + if ((E->OPC == OP65_TAX && N->OPC == OP65_TXA && !RegXUsed (S, I+2)) || + (E->OPC == OP65_TAY && N->OPC == OP65_TYA && !RegYUsed (S, I+2)) || + (E->OPC == OP65_TXA && N->OPC == OP65_TAX && !RegAUsed (S, I+2)) || + (E->OPC == OP65_TYA && N->OPC == OP65_TAY && !RegAUsed (S, I+2))) { - /* If the next insn is a conditional branch, check if the insn - * preceeding the first xfr will set the flags right, otherwise we - * may not remove the sequence. - */ - if ((X = CS_GetNextEntry (S, I+1)) == 0) { - goto NextEntry; - } + /* If the next insn is a conditional branch, check if the insn + * preceeding the first xfr will set the flags right, otherwise we + * may not remove the sequence. + */ + if ((X = CS_GetNextEntry (S, I+1)) == 0) { + goto NextEntry; + } if (CE_UseLoadFlags (X)) { - if (I == 0) { - /* No preceeding entry */ - goto NextEntry; - } - P = CS_GetEntry (S, I-1); - if ((P->Info & OF_SETF) == 0) { - /* Does not set the flags */ - goto NextEntry; - } - } + if (I == 0) { + /* No preceeding entry */ + goto NextEntry; + } + P = CS_GetEntry (S, I-1); + if ((P->Info & OF_SETF) == 0) { + /* Does not set the flags */ + goto NextEntry; + } + } - /* Remove both transfers */ - CS_DelEntry (S, I+1); - CS_DelEntry (S, I); + /* Remove both transfers */ + CS_DelEntry (S, I+1); + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; - } - } + /* Remember, we had changes */ + ++Changes; + } + } NextEntry: - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -1459,18 +1459,18 @@ unsigned OptTransfers2 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* N; + CodeEntry* N; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if we have a load followed by a transfer where the loaded + /* Check if we have a load followed by a transfer where the loaded * register is not used later. */ - if ((E->Info & OF_LOAD) != 0 && - (N = CS_GetNextEntry (S, I)) != 0 && - !CE_HasLabel (N) && - (N->Info & OF_XFR) != 0 && + if ((E->Info & OF_LOAD) != 0 && + (N = CS_GetNextEntry (S, I)) != 0 && + !CE_HasLabel (N) && + (N->Info & OF_XFR) != 0 && GetRegInfo (S, I+2, E->Chg) != E->Chg) { CodeEntry* X = 0; @@ -1512,10 +1512,10 @@ unsigned OptTransfers2 (CodeSeg* S) ++Changes; --I; /* Correct for one entry less */ } - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } /* Return the number of changes made */ @@ -1549,8 +1549,8 @@ unsigned OptTransfers3 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); switch (State) { @@ -1698,8 +1698,8 @@ unsigned OptTransfers3 (CodeSeg* S) } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } /* Return the number of changes made */ @@ -1731,8 +1731,8 @@ unsigned OptTransfers4 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); switch (State) { @@ -1856,8 +1856,8 @@ unsigned OptTransfers4 (CodeSeg* S) } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } /* Return the number of changes made */ @@ -1893,8 +1893,8 @@ unsigned OptPushPop (CodeSeg* S) CodeEntry* X; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); switch (State) { @@ -1983,8 +1983,8 @@ unsigned OptPushPop (CodeSeg* S) } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } /* Return the number of changes made */ @@ -2005,11 +2005,11 @@ unsigned OptPrecalc (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Get pointers to the input and output registers of the insn */ - const RegContents* Out = &E->RI->Out; + /* Get pointers to the input and output registers of the insn */ + const RegContents* Out = &E->RI->Out; const RegContents* In = &E->RI->In; /* Argument for LDn and flag */ @@ -2113,8 +2113,8 @@ unsigned OptPrecalc (CodeSeg* S) ++Changes; } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } /* Return the number of changes made */ @@ -2124,7 +2124,7 @@ unsigned OptPrecalc (CodeSeg* S) /*****************************************************************************/ -/* Optimize branch types */ +/* Optimize branch types */ /*****************************************************************************/ @@ -2138,49 +2138,49 @@ unsigned OptBranchDist (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's a conditional branch to a local label. */ - if (E->Info & OF_CBRA) { + /* Check if it's a conditional branch to a local label. */ + if (E->Info & OF_CBRA) { - /* Is this a branch to a local symbol? */ - if (E->JumpTo != 0) { + /* Is this a branch to a local symbol? */ + if (E->JumpTo != 0) { - /* Check if the branch distance is short */ - int IsShort = IsShortDist (GetBranchDist (S, I, E->JumpTo->Owner)); + /* Check if the branch distance is short */ + int IsShort = IsShortDist (GetBranchDist (S, I, E->JumpTo->Owner)); - /* Make the branch short/long according to distance */ - if ((E->Info & OF_LBRA) == 0 && !IsShort) { - /* Short branch but long distance */ - CE_ReplaceOPC (E, MakeLongBranch (E->OPC)); - ++Changes; - } else if ((E->Info & OF_LBRA) != 0 && IsShort) { - /* Long branch but short distance */ - CE_ReplaceOPC (E, MakeShortBranch (E->OPC)); - ++Changes; - } + /* Make the branch short/long according to distance */ + if ((E->Info & OF_LBRA) == 0 && !IsShort) { + /* Short branch but long distance */ + CE_ReplaceOPC (E, MakeLongBranch (E->OPC)); + ++Changes; + } else if ((E->Info & OF_LBRA) != 0 && IsShort) { + /* Long branch but short distance */ + CE_ReplaceOPC (E, MakeShortBranch (E->OPC)); + ++Changes; + } - } else if ((E->Info & OF_LBRA) == 0) { + } else if ((E->Info & OF_LBRA) == 0) { - /* Short branch to external symbol - make it long */ - CE_ReplaceOPC (E, MakeLongBranch (E->OPC)); - ++Changes; + /* Short branch to external symbol - make it long */ + CE_ReplaceOPC (E, MakeLongBranch (E->OPC)); + ++Changes; - } + } - } else if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0 && - (E->Info & OF_UBRA) != 0 && - E->JumpTo != 0 && - IsShortDist (GetBranchDist (S, I, E->JumpTo->Owner))) { + } else if ((CPUIsets[CPU] & CPU_ISET_65SC02) != 0 && + (E->Info & OF_UBRA) != 0 && + E->JumpTo != 0 && + IsShortDist (GetBranchDist (S, I, E->JumpTo->Owner))) { - /* The jump is short and may be replaced by a BRA on the 65C02 CPU */ - CE_ReplaceOPC (E, OP65_BRA); - ++Changes; - } + /* The jump is short and may be replaced by a BRA on the 65C02 CPU */ + CE_ReplaceOPC (E, OP65_BRA); + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -2215,26 +2215,26 @@ unsigned OptIndLoads1 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's what we're looking for */ - if (E->OPC == OP65_LDA && + /* Check if it's what we're looking for */ + if (E->OPC == OP65_LDA && E->AM == AM65_ZP_INDY && E->RI->In.RegY == 0 && E->RI->In.RegX == 0) { - /* Replace by the same insn with other addressing mode */ + /* Replace by the same insn with other addressing mode */ CodeEntry* X = NewCodeEntry (E->OPC, AM65_ZPX_IND, E->Arg, 0, E->LI); CS_InsertEntry (S, X, I+1); /* Remove the old insn */ CS_DelEntry (S, I); ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -2263,26 +2263,26 @@ unsigned OptIndLoads2 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if it's what we're looking for */ - if (E->OPC == OP65_LDA && + /* Check if it's what we're looking for */ + if (E->OPC == OP65_LDA && E->AM == AM65_ZPX_IND && E->RI->In.RegY == 0 && E->RI->In.RegX == 0) { - /* Replace by the same insn with other addressing mode */ + /* Replace by the same insn with other addressing mode */ CodeEntry* X = NewCodeEntry (E->OPC, AM65_ZP_INDY, E->Arg, 0, E->LI); CS_InsertEntry (S, X, I+1); /* Remove the old insn */ CS_DelEntry (S, I); ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptind.h b/src/cc65/coptind.h index 0ea7cd1b9..83a3f964c 100644 --- a/src/cc65/coptind.h +++ b/src/cc65/coptind.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptind.h */ +/* coptind.h */ /* */ -/* Environment independent low level optimizations */ +/* Environment independent low level optimizations */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/coptneg.c b/src/cc65/coptneg.c index 083815e9a..2bc0e6b2f 100644 --- a/src/cc65/coptneg.c +++ b/src/cc65/coptneg.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptneg.c */ +/* coptneg.c */ /* */ -/* Optimize negation sequences */ +/* Optimize negation sequences */ /* */ /* */ /* */ @@ -41,7 +41,7 @@ /*****************************************************************************/ -/* bnega optimizations */ +/* bnega optimizations */ /*****************************************************************************/ @@ -49,9 +49,9 @@ unsigned OptBNegA1 (CodeSeg* S) /* Check for * - * ldx #$00 - * lda .. - * jsr bnega + * ldx #$00 + * lda .. + * jsr bnega * * Remove the ldx if the lda does not use it. */ @@ -62,33 +62,33 @@ unsigned OptBNegA1 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[2]; + CodeEntry* L[2]; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for a ldx */ - if (E->OPC == OP65_LDX && - E->AM == AM65_IMM && - (E->Flags & CEF_NUMARG) != 0 && - E->Num == 0 && - CS_GetEntries (S, L, I+1, 2) && - L[0]->OPC == OP65_LDA && - (L[0]->Use & REG_X) == 0 && - !CE_HasLabel (L[0]) && - CE_IsCallTo (L[1], "bnega") && - !CE_HasLabel (L[1])) { + /* Check for a ldx */ + if (E->OPC == OP65_LDX && + E->AM == AM65_IMM && + (E->Flags & CEF_NUMARG) != 0 && + E->Num == 0 && + CS_GetEntries (S, L, I+1, 2) && + L[0]->OPC == OP65_LDA && + (L[0]->Use & REG_X) == 0 && + !CE_HasLabel (L[0]) && + CE_IsCallTo (L[1], "bnega") && + !CE_HasLabel (L[1])) { - /* Remove the ldx instruction */ - CS_DelEntry (S, I); + /* Remove the ldx instruction */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -101,9 +101,9 @@ unsigned OptBNegA1 (CodeSeg* S) unsigned OptBNegA2 (CodeSeg* S) /* Check for * - * lda .. - * jsr bnega - * jeq/jne .. + * lda .. + * jsr bnega + * jeq/jne .. * * Adjust the conditional branch and remove the call to the subroutine. */ @@ -114,42 +114,42 @@ unsigned OptBNegA2 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[2]; + CodeEntry* L[2]; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if ((E->OPC == OP65_ADC || - E->OPC == OP65_AND || - E->OPC == OP65_DEA || - E->OPC == OP65_EOR || - E->OPC == OP65_INA || - E->OPC == OP65_LDA || - E->OPC == OP65_ORA || - E->OPC == OP65_PLA || - E->OPC == OP65_SBC || - E->OPC == OP65_TXA || - E->OPC == OP65_TYA) && - CS_GetEntries (S, L, I+1, 2) && - CE_IsCallTo (L[0], "bnega") && - !CE_HasLabel (L[0]) && - (L[1]->Info & OF_ZBRA) != 0 && - !CE_HasLabel (L[1])) { + /* Check for the sequence */ + if ((E->OPC == OP65_ADC || + E->OPC == OP65_AND || + E->OPC == OP65_DEA || + E->OPC == OP65_EOR || + E->OPC == OP65_INA || + E->OPC == OP65_LDA || + E->OPC == OP65_ORA || + E->OPC == OP65_PLA || + E->OPC == OP65_SBC || + E->OPC == OP65_TXA || + E->OPC == OP65_TYA) && + CS_GetEntries (S, L, I+1, 2) && + CE_IsCallTo (L[0], "bnega") && + !CE_HasLabel (L[0]) && + (L[1]->Info & OF_ZBRA) != 0 && + !CE_HasLabel (L[1])) { - /* Invert the branch */ - CE_ReplaceOPC (L[1], GetInverseBranch (L[1]->OPC)); + /* Invert the branch */ + CE_ReplaceOPC (L[1], GetInverseBranch (L[1]->OPC)); - /* Delete the subroutine call */ - CS_DelEntry (S, I+1); + /* Delete the subroutine call */ + CS_DelEntry (S, I+1); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -160,7 +160,7 @@ unsigned OptBNegA2 (CodeSeg* S) /*****************************************************************************/ -/* bnegax optimizations */ +/* bnegax optimizations */ /*****************************************************************************/ @@ -178,22 +178,22 @@ unsigned OptBNegAX1 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if this is a call to bnegax, and if X is known and zero */ - if (E->RI->In.RegX == 0 && CE_IsCallTo (E, "bnegax")) { + /* Check if this is a call to bnegax, and if X is known and zero */ + if (E->RI->In.RegX == 0 && CE_IsCallTo (E, "bnegax")) { - CodeEntry* X = NewCodeEntry (OP65_JSR, AM65_ABS, "bnega", 0, E->LI); - CS_InsertEntry (S, X, I+1); - CS_DelEntry (S, I); + CodeEntry* X = NewCodeEntry (OP65_JSR, AM65_ABS, "bnega", 0, E->LI); + CS_InsertEntry (S, X, I+1); + CS_DelEntry (S, I); - /* We had changes */ - ++Changes; - } + /* We had changes */ + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -208,16 +208,16 @@ unsigned OptBNegAX2 (CodeSeg* S) * * ldy #xx * jsr ldaxysp - * jsr bnegax - * jne/jeq ... + * jsr bnegax + * jne/jeq ... * * and replace it by * * ldy #xx - * lda (sp),y - * dey - * ora (sp),y - * jeq/jne ... + * lda (sp),y + * dey + * ora (sp),y + * jeq/jne ... */ { unsigned Changes = 0; @@ -226,47 +226,47 @@ unsigned OptBNegAX2 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[4]; + CodeEntry* L[4]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDY && - CE_IsConstImm (L[0]) && - !CS_RangeHasLabel (S, I+1, 3) && - CS_GetEntries (S, L+1, I+1, 3) && - CE_IsCallTo (L[1], "ldaxysp") && - CE_IsCallTo (L[2], "bnegax") && - (L[3]->Info & OF_ZBRA) != 0) { + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDY && + CE_IsConstImm (L[0]) && + !CS_RangeHasLabel (S, I+1, 3) && + CS_GetEntries (S, L+1, I+1, 3) && + CE_IsCallTo (L[1], "ldaxysp") && + CE_IsCallTo (L[2], "bnegax") && + (L[3]->Info & OF_ZBRA) != 0) { - CodeEntry* X; + CodeEntry* X; - /* lda (sp),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); - CS_InsertEntry (S, X, I+1); + /* lda (sp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "sp", 0, L[1]->LI); + CS_InsertEntry (S, X, I+1); - /* dey */ - X = NewCodeEntry (OP65_DEY, AM65_IMP, 0, 0, L[1]->LI); - CS_InsertEntry (S, X, I+2); + /* dey */ + X = NewCodeEntry (OP65_DEY, AM65_IMP, 0, 0, L[1]->LI); + CS_InsertEntry (S, X, I+2); - /* ora (sp),y */ - X = NewCodeEntry (OP65_ORA, AM65_ZP_INDY, "sp", 0, L[1]->LI); - CS_InsertEntry (S, X, I+3); + /* ora (sp),y */ + X = NewCodeEntry (OP65_ORA, AM65_ZP_INDY, "sp", 0, L[1]->LI); + CS_InsertEntry (S, X, I+3); - /* Invert the branch */ - CE_ReplaceOPC (L[3], GetInverseBranch (L[3]->OPC)); + /* Invert the branch */ + CE_ReplaceOPC (L[3], GetInverseBranch (L[3]->OPC)); - /* Delete the entries no longer needed. */ - CS_DelEntries (S, I+4, 2); + /* Delete the entries no longer needed. */ + CS_DelEntries (S, I+4, 2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -279,16 +279,16 @@ unsigned OptBNegAX2 (CodeSeg* S) unsigned OptBNegAX3 (CodeSeg* S) /* Search for the sequence: * - * lda xx - * ldx yy - * jsr bnegax - * jne/jeq ... + * lda xx + * ldx yy + * jsr bnegax + * jne/jeq ... * * and replace it by * - * lda xx - * ora xx+1 - * jeq/jne ... + * lda xx + * ora xx+1 + * jeq/jne ... */ { unsigned Changes = 0; @@ -297,37 +297,37 @@ unsigned OptBNegAX3 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[3]; + CodeEntry* L[3]; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_LDA && - CS_GetEntries (S, L, I+1, 3) && - L[0]->OPC == OP65_LDX && - !CE_HasLabel (L[0]) && - CE_IsCallTo (L[1], "bnegax") && - !CE_HasLabel (L[1]) && - (L[2]->Info & OF_ZBRA) != 0 && - !CE_HasLabel (L[2])) { + /* Check for the sequence */ + if (E->OPC == OP65_LDA && + CS_GetEntries (S, L, I+1, 3) && + L[0]->OPC == OP65_LDX && + !CE_HasLabel (L[0]) && + CE_IsCallTo (L[1], "bnegax") && + !CE_HasLabel (L[1]) && + (L[2]->Info & OF_ZBRA) != 0 && + !CE_HasLabel (L[2])) { - /* ldx --> ora */ - CE_ReplaceOPC (L[0], OP65_ORA); + /* ldx --> ora */ + CE_ReplaceOPC (L[0], OP65_ORA); - /* Invert the branch */ - CE_ReplaceOPC (L[2], GetInverseBranch (L[2]->OPC)); + /* Invert the branch */ + CE_ReplaceOPC (L[2], GetInverseBranch (L[2]->OPC)); - /* Delete the subroutine call */ - CS_DelEntry (S, I+2); + /* Delete the subroutine call */ + CS_DelEntry (S, I+2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -340,15 +340,15 @@ unsigned OptBNegAX3 (CodeSeg* S) unsigned OptBNegAX4 (CodeSeg* S) /* Search for the sequence: * - * jsr xxx - * jsr bnega(x) - * jeq/jne ... + * jsr xxx + * jsr bnega(x) + * jeq/jne ... * * and replace it by: * - * jsr xxx - * - * jne/jeq ... + * jsr xxx + * + * jne/jeq ... */ { unsigned Changes = 0; @@ -357,51 +357,51 @@ unsigned OptBNegAX4 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[2]; + CodeEntry* L[2]; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_JSR && - CS_GetEntries (S, L, I+1, 2) && - L[0]->OPC == OP65_JSR && - strncmp (L[0]->Arg,"bnega",5) == 0 && - !CE_HasLabel (L[0]) && - (L[1]->Info & OF_ZBRA) != 0 && - !CE_HasLabel (L[1])) { + /* Check for the sequence */ + if (E->OPC == OP65_JSR && + CS_GetEntries (S, L, I+1, 2) && + L[0]->OPC == OP65_JSR && + strncmp (L[0]->Arg,"bnega",5) == 0 && + !CE_HasLabel (L[0]) && + (L[1]->Info & OF_ZBRA) != 0 && + !CE_HasLabel (L[1])) { - CodeEntry* X; + CodeEntry* X; - /* Check if we're calling bnega or bnegax */ - int ByteSized = (strcmp (L[0]->Arg, "bnega") == 0); + /* Check if we're calling bnega or bnegax */ + int ByteSized = (strcmp (L[0]->Arg, "bnega") == 0); - /* Insert apropriate test code */ - if (ByteSized) { - /* Test bytes */ - X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, L[0]->LI); - CS_InsertEntry (S, X, I+2); - } else { - /* Test words */ - X = NewCodeEntry (OP65_STX, AM65_ZP, "tmp1", 0, L[0]->LI); - CS_InsertEntry (S, X, I+2); - X = NewCodeEntry (OP65_ORA, AM65_ZP, "tmp1", 0, L[0]->LI); - CS_InsertEntry (S, X, I+3); - } + /* Insert apropriate test code */ + if (ByteSized) { + /* Test bytes */ + X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, L[0]->LI); + CS_InsertEntry (S, X, I+2); + } else { + /* Test words */ + X = NewCodeEntry (OP65_STX, AM65_ZP, "tmp1", 0, L[0]->LI); + CS_InsertEntry (S, X, I+2); + X = NewCodeEntry (OP65_ORA, AM65_ZP, "tmp1", 0, L[0]->LI); + CS_InsertEntry (S, X, I+3); + } - /* Delete the subroutine call */ - CS_DelEntry (S, I+1); + /* Delete the subroutine call */ + CS_DelEntry (S, I+1); - /* Invert the branch */ - CE_ReplaceOPC (L[1], GetInverseBranch (L[1]->OPC)); + /* Invert the branch */ + CE_ReplaceOPC (L[1], GetInverseBranch (L[1]->OPC)); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -434,17 +434,17 @@ unsigned OptNegAX1 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if this is a call to negax, and if X isn't used later */ - if (CE_IsCallTo (E, "negax") && !RegXUsed (S, I+1)) { + /* Check if this is a call to negax, and if X isn't used later */ + if (CE_IsCallTo (E, "negax") && !RegXUsed (S, I+1)) { CodeEntry* X; /* Add replacement code behind */ - X = NewCodeEntry (OP65_EOR, AM65_IMM, "$FF", 0, E->LI); - CS_InsertEntry (S, X, I+1); + X = NewCodeEntry (OP65_EOR, AM65_IMM, "$FF", 0, E->LI); + CS_InsertEntry (S, X, I+1); X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, E->LI); CS_InsertEntry (S, X, I+2); @@ -453,17 +453,17 @@ unsigned OptNegAX1 (CodeSeg* S) CS_InsertEntry (S, X, I+3); /* Delete the call to negax */ - CS_DelEntry (S, I); + CS_DelEntry (S, I); /* Skip the generated code */ I += 2; - /* We had changes */ - ++Changes; - } + /* We had changes */ + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -496,11 +496,11 @@ unsigned OptNegAX2 (CodeSeg* S) CodeEntry* P; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if this is a call to negax, and if X is known and zero */ - if (E->RI->In.RegX == 0 && + /* Check if this is a call to negax, and if X is known and zero */ + if (E->RI->In.RegX == 0 && CE_IsCallTo (E, "negax") && (P = CS_GetNextEntry (S, I)) != 0) { @@ -510,12 +510,12 @@ unsigned OptNegAX2 (CodeSeg* S) /* Add replacement code behind */ /* ldx #$FF */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$FF", 0, E->LI); - CS_InsertEntry (S, X, I+1); + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$FF", 0, E->LI); + CS_InsertEntry (S, X, I+1); /* eor #$FF */ - X = NewCodeEntry (OP65_EOR, AM65_IMM, "$FF", 0, E->LI); - CS_InsertEntry (S, X, I+2); + X = NewCodeEntry (OP65_EOR, AM65_IMM, "$FF", 0, E->LI); + CS_InsertEntry (S, X, I+2); /* clc */ X = NewCodeEntry (OP65_CLC, AM65_IMP, 0, 0, E->LI); @@ -537,17 +537,17 @@ unsigned OptNegAX2 (CodeSeg* S) CS_InsertEntry (S, X, I+6); /* Delete the call to negax */ - CS_DelEntry (S, I); + CS_DelEntry (S, I); /* Skip the generated code */ I += 5; - /* We had changes */ - ++Changes; - } + /* We had changes */ + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -578,27 +578,27 @@ unsigned OptComplAX1 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check if this is a call to negax, and if X isn't used later */ - if (CE_IsCallTo (E, "complax") && !RegXUsed (S, I+1)) { + /* Check if this is a call to negax, and if X isn't used later */ + if (CE_IsCallTo (E, "complax") && !RegXUsed (S, I+1)) { CodeEntry* X; /* Add replacement code behind */ - X = NewCodeEntry (OP65_EOR, AM65_IMM, "$FF", 0, E->LI); - CS_InsertEntry (S, X, I+1); + X = NewCodeEntry (OP65_EOR, AM65_IMM, "$FF", 0, E->LI); + CS_InsertEntry (S, X, I+1); /* Delete the call to negax */ - CS_DelEntry (S, I); + CS_DelEntry (S, I); - /* We had changes */ - ++Changes; - } + /* We had changes */ + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptneg.h b/src/cc65/coptneg.h index f5c36f79f..580faaa67 100644 --- a/src/cc65/coptneg.h +++ b/src/cc65/coptneg.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptneg.h */ +/* coptneg.h */ /* */ -/* Optimize negation sequences */ +/* Optimize negation sequences */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* bnega optimizations */ +/* bnega optimizations */ /*****************************************************************************/ @@ -52,9 +52,9 @@ unsigned OptBNegA1 (CodeSeg* S); /* Check for * - * ldx #$00 - * lda .. - * jsr bnega + * ldx #$00 + * lda .. + * jsr bnega * * Remove the ldx if the lda does not use it. */ @@ -62,9 +62,9 @@ unsigned OptBNegA1 (CodeSeg* S); unsigned OptBNegA2 (CodeSeg* S); /* Check for * - * lda .. - * jsr bnega - * jeq/jne .. + * lda .. + * jsr bnega + * jeq/jne .. * * Adjust the conditional branch and remove the call to the subroutine. */ @@ -72,7 +72,7 @@ unsigned OptBNegA2 (CodeSeg* S); /*****************************************************************************/ -/* bnegax optimizations */ +/* bnegax optimizations */ /*****************************************************************************/ @@ -86,48 +86,48 @@ unsigned OptBNegAX1 (CodeSeg* S); unsigned OptBNegAX2 (CodeSeg* S); /* Search for the sequence: * - * lda (xx),y - * tax - * dey - * lda (xx),y - * jsr bnegax - * jne/jeq ... + * lda (xx),y + * tax + * dey + * lda (xx),y + * jsr bnegax + * jne/jeq ... * * and replace it by * - * lda (xx),y - * dey - * ora (xx),y - * jeq/jne ... + * lda (xx),y + * dey + * ora (xx),y + * jeq/jne ... */ unsigned OptBNegAX3 (CodeSeg* S); /* Search for the sequence: * - * lda xx - * ldx yy - * jsr bnegax - * jne/jeq ... + * lda xx + * ldx yy + * jsr bnegax + * jne/jeq ... * * and replace it by * - * lda xx - * ora xx+1 - * jeq/jne ... + * lda xx + * ora xx+1 + * jeq/jne ... */ unsigned OptBNegAX4 (CodeSeg* S); /* Search for the sequence: * - * jsr xxx - * jsr bnega(x) - * jeq/jne ... + * jsr xxx + * jsr bnega(x) + * jeq/jne ... * * and replace it by: * - * jsr xxx - * - * jne/jeq ... + * jsr xxx + * + * jne/jeq ... */ diff --git a/src/cc65/coptptrload.c b/src/cc65/coptptrload.c index 479010b88..43f3cc49c 100644 --- a/src/cc65/coptptrload.c +++ b/src/cc65/coptptrload.c @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -55,14 +55,14 @@ unsigned OptPtrLoad1 (CodeSeg* S) /* Search for the sequence: * * clc - * adc xxx + * adc xxx * tay * txa * adc yyy * tax * tya * ldy #$00 - * jsr ldauidx + * jsr ldauidx * * and replace it by: * @@ -82,30 +82,30 @@ unsigned OptPtrLoad1 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[9]; + CodeEntry* L[9]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_CLC && - CS_GetEntries (S, L+1, I+1, 8) && - L[1]->OPC == OP65_ADC && + /* Check for the sequence */ + if (L[0]->OPC == OP65_CLC && + CS_GetEntries (S, L+1, I+1, 8) && + L[1]->OPC == OP65_ADC && (L[1]->AM == AM65_ABS || L[1]->AM == AM65_ZP || L[1]->AM == AM65_IMM) && - L[2]->OPC == OP65_TAY && - L[3]->OPC == OP65_TXA && - L[4]->OPC == OP65_ADC && - L[5]->OPC == OP65_TAX && - L[6]->OPC == OP65_TYA && - L[7]->OPC == OP65_LDY && + L[2]->OPC == OP65_TAY && + L[3]->OPC == OP65_TXA && + L[4]->OPC == OP65_ADC && + L[5]->OPC == OP65_TAX && + L[6]->OPC == OP65_TYA && + L[7]->OPC == OP65_LDY && CE_IsKnownImm (L[7], 0) && - CE_IsCallTo (L[8], "ldauidx") && + CE_IsCallTo (L[8], "ldauidx") && !CS_RangeHasLabel (S, I+1, 8)) { - CodeEntry* X; - CodeEntry* P; + CodeEntry* X; + CodeEntry* P; /* Track the insertion point */ unsigned IP = I+9; @@ -114,15 +114,15 @@ unsigned OptPtrLoad1 (CodeSeg* S) X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[2]->LI); CS_InsertEntry (S, X, IP++); - /* If the instruction before the clc is a ldx, replace the - * txa by an lda with the same location of the ldx. Otherwise + /* If the instruction before the clc is a ldx, replace the + * txa by an lda with the same location of the ldx. Otherwise * transfer the value in X to A. - */ - if ((P = CS_GetPrevEntry (S, I)) != 0 && - P->OPC == OP65_LDX && - !CE_HasLabel (P)) { - X = NewCodeEntry (OP65_LDA, P->AM, P->Arg, 0, P->LI); - } else { + */ + if ((P = CS_GetPrevEntry (S, I)) != 0 && + P->OPC == OP65_LDX && + !CE_HasLabel (P)) { + X = NewCodeEntry (OP65_LDA, P->AM, P->Arg, 0, P->LI); + } else { X = NewCodeEntry (OP65_TXA, AM65_IMP, 0, 0, L[3]->LI); } CS_InsertEntry (S, X, IP++); @@ -148,19 +148,19 @@ unsigned OptPtrLoad1 (CodeSeg* S) CS_InsertEntry (S, X, IP++); /* lda (ptr1),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[8]->LI); - CS_InsertEntry (S, X, IP++); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[8]->LI); + CS_InsertEntry (S, X, IP++); /* Remove the old instructions */ CS_DelEntries (S, I, 9); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -173,7 +173,7 @@ unsigned OptPtrLoad1 (CodeSeg* S) unsigned OptPtrLoad2 (CodeSeg* S) /* Search for the sequence: * - * adc xxx + * adc xxx * pha * txa * iny @@ -181,18 +181,18 @@ unsigned OptPtrLoad2 (CodeSeg* S) * tax * pla * ldy - * jsr ldauidx + * jsr ldauidx * * and replace it by: * - * adc xxx + * adc xxx * sta ptr1 * txa * iny * adc yyy * sta ptr1+1 * ldy - * ldx #$00 + * ldx #$00 * lda (ptr1),y */ { @@ -202,53 +202,53 @@ unsigned OptPtrLoad2 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[9]; + CodeEntry* L[9]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_ADC && - CS_GetEntries (S, L+1, I+1, 8) && - L[1]->OPC == OP65_PHA && - L[2]->OPC == OP65_TXA && - L[3]->OPC == OP65_INY && - L[4]->OPC == OP65_ADC && - L[5]->OPC == OP65_TAX && - L[6]->OPC == OP65_PLA && - L[7]->OPC == OP65_LDY && - CE_IsCallTo (L[8], "ldauidx") && - !CS_RangeHasLabel (S, I+1, 8)) { + /* Check for the sequence */ + if (L[0]->OPC == OP65_ADC && + CS_GetEntries (S, L+1, I+1, 8) && + L[1]->OPC == OP65_PHA && + L[2]->OPC == OP65_TXA && + L[3]->OPC == OP65_INY && + L[4]->OPC == OP65_ADC && + L[5]->OPC == OP65_TAX && + L[6]->OPC == OP65_PLA && + L[7]->OPC == OP65_LDY && + CE_IsCallTo (L[8], "ldauidx") && + !CS_RangeHasLabel (S, I+1, 8)) { - CodeEntry* X; + CodeEntry* X; - /* Store the low byte and remove the PHA instead */ - X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[0]->LI); - CS_InsertEntry (S, X, I+1); + /* Store the low byte and remove the PHA instead */ + X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[0]->LI); + CS_InsertEntry (S, X, I+1); - /* Store the high byte */ - X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1+1", 0, L[4]->LI); - CS_InsertEntry (S, X, I+6); + /* Store the high byte */ + X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1+1", 0, L[4]->LI); + CS_InsertEntry (S, X, I+6); - /* Load high and low byte */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[6]->LI); - CS_InsertEntry (S, X, I+10); - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[6]->LI); - CS_InsertEntry (S, X, I+11); + /* Load high and low byte */ + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[6]->LI); + CS_InsertEntry (S, X, I+10); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[6]->LI); + CS_InsertEntry (S, X, I+11); - /* Delete the old code */ - CS_DelEntry (S, I+12); /* jsr ldauidx */ - CS_DelEntry (S, I+8); /* pla */ - CS_DelEntry (S, I+7); /* tax */ - CS_DelEntry (S, I+2); /* pha */ + /* Delete the old code */ + CS_DelEntry (S, I+12); /* jsr ldauidx */ + CS_DelEntry (S, I+8); /* pla */ + CS_DelEntry (S, I+7); /* tax */ + CS_DelEntry (S, I+2); /* pha */ - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -283,66 +283,66 @@ unsigned OptPtrLoad3 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[8]; - unsigned Len; + CodeEntry* L[8]; + unsigned Len; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDA && - L[0]->AM == AM65_IMM && - CS_GetEntries (S, L+1, I+1, 7) && - L[1]->OPC == OP65_LDX && - L[1]->AM == AM65_IMM && - L[2]->OPC == OP65_CLC && - L[3]->OPC == OP65_ADC && - (L[3]->AM == AM65_ABS || L[3]->AM == AM65_ZP) && - (L[4]->OPC == OP65_BCC || L[4]->OPC == OP65_JCC) && - L[4]->JumpTo != 0 && - L[4]->JumpTo->Owner == L[6] && - L[5]->OPC == OP65_INX && - L[6]->OPC == OP65_LDY && - CE_IsKnownImm (L[6], 0) && - CE_IsCallTo (L[7], "ldauidx") && - !CS_RangeHasLabel (S, I+1, 5) && + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDA && + L[0]->AM == AM65_IMM && + CS_GetEntries (S, L+1, I+1, 7) && + L[1]->OPC == OP65_LDX && + L[1]->AM == AM65_IMM && + L[2]->OPC == OP65_CLC && + L[3]->OPC == OP65_ADC && + (L[3]->AM == AM65_ABS || L[3]->AM == AM65_ZP) && + (L[4]->OPC == OP65_BCC || L[4]->OPC == OP65_JCC) && + L[4]->JumpTo != 0 && + L[4]->JumpTo->Owner == L[6] && + L[5]->OPC == OP65_INX && + L[6]->OPC == OP65_LDY && + CE_IsKnownImm (L[6], 0) && + CE_IsCallTo (L[7], "ldauidx") && + !CS_RangeHasLabel (S, I+1, 5) && !CE_HasLabel (L[7]) && - /* Check the label last because this is quite costly */ - (Len = strlen (L[0]->Arg)) > 3 && - L[0]->Arg[0] == '<' && - L[0]->Arg[1] == '(' && - strlen (L[1]->Arg) == Len && - L[1]->Arg[0] == '>' && - memcmp (L[0]->Arg+1, L[1]->Arg+1, Len-1) == 0) { + /* Check the label last because this is quite costly */ + (Len = strlen (L[0]->Arg)) > 3 && + L[0]->Arg[0] == '<' && + L[0]->Arg[1] == '(' && + strlen (L[1]->Arg) == Len && + L[1]->Arg[0] == '>' && + memcmp (L[0]->Arg+1, L[1]->Arg+1, Len-1) == 0) { - CodeEntry* X; - char* Label; + CodeEntry* X; + char* Label; - /* We will create all the new stuff behind the current one so - * we keep the line references. - */ - X = NewCodeEntry (OP65_LDY, L[3]->AM, L[3]->Arg, 0, L[0]->LI); - CS_InsertEntry (S, X, I+8); + /* We will create all the new stuff behind the current one so + * we keep the line references. + */ + X = NewCodeEntry (OP65_LDY, L[3]->AM, L[3]->Arg, 0, L[0]->LI); + CS_InsertEntry (S, X, I+8); - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[0]->LI); - CS_InsertEntry (S, X, I+9); + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[0]->LI); + CS_InsertEntry (S, X, I+9); - Label = memcpy (xmalloc (Len-2), L[0]->Arg+2, Len-3); - Label[Len-3] = '\0'; - X = NewCodeEntry (OP65_LDA, AM65_ABSY, Label, 0, L[0]->LI); - CS_InsertEntry (S, X, I+10); - xfree (Label); + Label = memcpy (xmalloc (Len-2), L[0]->Arg+2, Len-3); + Label[Len-3] = '\0'; + X = NewCodeEntry (OP65_LDA, AM65_ABSY, Label, 0, L[0]->LI); + CS_InsertEntry (S, X, I+10); + xfree (Label); - /* Remove the old code */ - CS_DelEntries (S, I, 8); + /* Remove the old code */ + CS_DelEntries (S, I, 8); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -380,78 +380,78 @@ unsigned OptPtrLoad4 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[9]; - unsigned Len; + CodeEntry* L[9]; + unsigned Len; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDA && - L[0]->AM == AM65_IMM && - CS_GetEntries (S, L+1, I+1, 8) && - L[1]->OPC == OP65_LDX && - L[1]->AM == AM65_IMM && - !CE_HasLabel (L[1]) && - L[2]->OPC == OP65_LDY && - CE_IsConstImm (L[2]) && - !CE_HasLabel (L[2]) && - L[3]->OPC == OP65_CLC && - !CE_HasLabel (L[3]) && - L[4]->OPC == OP65_ADC && - L[4]->AM == AM65_ZP_INDY && - !CE_HasLabel (L[4]) && - (L[5]->OPC == OP65_BCC || L[5]->OPC == OP65_JCC) && - L[5]->JumpTo != 0 && - L[5]->JumpTo->Owner == L[7] && - !CE_HasLabel (L[5]) && - L[6]->OPC == OP65_INX && - !CE_HasLabel (L[6]) && - L[7]->OPC == OP65_LDY && - CE_IsKnownImm (L[7], 0) && - CE_IsCallTo (L[8], "ldauidx") && - !CE_HasLabel (L[8]) && - /* Check the label last because this is quite costly */ - (Len = strlen (L[0]->Arg)) > 3 && - L[0]->Arg[0] == '<' && - L[0]->Arg[1] == '(' && - strlen (L[1]->Arg) == Len && - L[1]->Arg[0] == '>' && - memcmp (L[0]->Arg+1, L[1]->Arg+1, Len-1) == 0) { + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDA && + L[0]->AM == AM65_IMM && + CS_GetEntries (S, L+1, I+1, 8) && + L[1]->OPC == OP65_LDX && + L[1]->AM == AM65_IMM && + !CE_HasLabel (L[1]) && + L[2]->OPC == OP65_LDY && + CE_IsConstImm (L[2]) && + !CE_HasLabel (L[2]) && + L[3]->OPC == OP65_CLC && + !CE_HasLabel (L[3]) && + L[4]->OPC == OP65_ADC && + L[4]->AM == AM65_ZP_INDY && + !CE_HasLabel (L[4]) && + (L[5]->OPC == OP65_BCC || L[5]->OPC == OP65_JCC) && + L[5]->JumpTo != 0 && + L[5]->JumpTo->Owner == L[7] && + !CE_HasLabel (L[5]) && + L[6]->OPC == OP65_INX && + !CE_HasLabel (L[6]) && + L[7]->OPC == OP65_LDY && + CE_IsKnownImm (L[7], 0) && + CE_IsCallTo (L[8], "ldauidx") && + !CE_HasLabel (L[8]) && + /* Check the label last because this is quite costly */ + (Len = strlen (L[0]->Arg)) > 3 && + L[0]->Arg[0] == '<' && + L[0]->Arg[1] == '(' && + strlen (L[1]->Arg) == Len && + L[1]->Arg[0] == '>' && + memcmp (L[0]->Arg+1, L[1]->Arg+1, Len-1) == 0) { - CodeEntry* X; - char* Label; + CodeEntry* X; + char* Label; - /* Add the lda */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, L[4]->Arg, 0, L[0]->LI); - CS_InsertEntry (S, X, I+3); + /* Add the lda */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, L[4]->Arg, 0, L[0]->LI); + CS_InsertEntry (S, X, I+3); - /* Add the tay */ - X = NewCodeEntry (OP65_TAY, AM65_IMP, 0, 0, L[0]->LI); - CS_InsertEntry (S, X, I+4); + /* Add the tay */ + X = NewCodeEntry (OP65_TAY, AM65_IMP, 0, 0, L[0]->LI); + CS_InsertEntry (S, X, I+4); - /* Add the ldx */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[0]->LI); - CS_InsertEntry (S, X, I+5); + /* Add the ldx */ + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[0]->LI); + CS_InsertEntry (S, X, I+5); - /* Add the lda */ - Label = memcpy (xmalloc (Len-2), L[0]->Arg+2, Len-3); - Label[Len-3] = '\0'; - X = NewCodeEntry (OP65_LDA, AM65_ABSY, Label, 0, L[0]->LI); - CS_InsertEntry (S, X, I+6); - xfree (Label); + /* Add the lda */ + Label = memcpy (xmalloc (Len-2), L[0]->Arg+2, Len-3); + Label[Len-3] = '\0'; + X = NewCodeEntry (OP65_LDA, AM65_ABSY, Label, 0, L[0]->LI); + CS_InsertEntry (S, X, I+6); + xfree (Label); - /* Remove the old code */ - CS_DelEntries (S, I, 2); - CS_DelEntries (S, I+5, 6); + /* Remove the old code */ + CS_DelEntries (S, I, 2); + CS_DelEntries (S, I+5, 6); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -486,27 +486,27 @@ unsigned OptPtrLoad5 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[6]; + CodeEntry* L[6]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (CE_IsCallTo (L[0], "pushax") && - CS_GetEntries (S, L+1, I+1, 5) && - L[1]->OPC == OP65_LDX && + /* Check for the sequence */ + if (CE_IsCallTo (L[0], "pushax") && + CS_GetEntries (S, L+1, I+1, 5) && + L[1]->OPC == OP65_LDX && CE_IsKnownImm (L[1], 0) && L[2]->OPC == OP65_LDA && - (L[2]->AM == AM65_ABS || + (L[2]->AM == AM65_ABS || L[2]->AM == AM65_ZP || L[2]->AM == AM65_IMM) && CE_IsCallTo (L[3], "tosaddax") && L[4]->OPC == OP65_LDY && CE_IsKnownImm (L[4], 0) && CE_IsCallTo (L[5], "ldauidx") && - !CS_RangeHasLabel (S, I+1, 5)) { + !CS_RangeHasLabel (S, I+1, 5)) { - CodeEntry* X; + CodeEntry* X; /* sta ptr1 */ X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[0]->LI); @@ -521,23 +521,23 @@ unsigned OptPtrLoad5 (CodeSeg* S) CS_InsertEntry (S, X, I+8); /* ldx #$00 */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[5]->LI); - CS_InsertEntry (S, X, I+9); + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[5]->LI); + CS_InsertEntry (S, X, I+9); /* lda (ptr1),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[5]->LI); - CS_InsertEntry (S, X, I+10); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[5]->LI); + CS_InsertEntry (S, X, I+10); - /* Remove the old code */ - CS_DelEntries (S, I, 6); + /* Remove the old code */ + CS_DelEntries (S, I, 6); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -575,29 +575,29 @@ unsigned OptPtrLoad6 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[7]; + CodeEntry* L[7]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (CE_IsCallTo (L[0], "pushax") && - CS_GetEntries (S, L+1, I+1, 6) && + /* Check for the sequence */ + if (CE_IsCallTo (L[0], "pushax") && + CS_GetEntries (S, L+1, I+1, 6) && L[1]->OPC == OP65_LDY && CE_IsConstImm (L[1]) && L[1]->Num >= 2 && - L[2]->OPC == OP65_LDX && + L[2]->OPC == OP65_LDX && CE_IsKnownImm (L[2], 0) && L[3]->OPC == OP65_LDA && - L[3]->AM == AM65_ZP_INDY && + L[3]->AM == AM65_ZP_INDY && CE_IsCallTo (L[4], "tosaddax") && L[5]->OPC == OP65_LDY && CE_IsKnownImm (L[5], 0) && CE_IsCallTo (L[6], "ldauidx") && - !CS_RangeHasLabel (S, I+1, 6) && + !CS_RangeHasLabel (S, I+1, 6) && !RegYUsed (S, I+7)) { - CodeEntry* X; + CodeEntry* X; const char* Arg; /* sta ptr1 */ @@ -622,23 +622,23 @@ unsigned OptPtrLoad6 (CodeSeg* S) CS_InsertEntry (S, X, I+11); /* ldx #$00 */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[5]->LI); - CS_InsertEntry (S, X, I+12); + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[5]->LI); + CS_InsertEntry (S, X, I+12); /* lda (ptr1),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[6]->LI); - CS_InsertEntry (S, X, I+13); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[6]->LI); + CS_InsertEntry (S, X, I+13); - /* Remove the old code */ - CS_DelEntries (S, I, 7); + /* Remove the old code */ + CS_DelEntries (S, I, 7); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -687,18 +687,18 @@ unsigned OptPtrLoad7 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[10]; + CodeEntry* L[10]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ + /* Check for the sequence */ if (L[0]->OPC == OP65_JSR && (strcmp (L[0]->Arg, "aslax1") == 0 || strcmp (L[0]->Arg, "shlax1") == 0) && - CS_GetEntries (S, L+1, I+1, 9) && + CS_GetEntries (S, L+1, I+1, 9) && L[1]->OPC == OP65_CLC && - L[2]->OPC == OP65_ADC && + L[2]->OPC == OP65_ADC && L[3]->OPC == OP65_TAY && L[4]->OPC == OP65_TXA && L[5]->OPC == OP65_ADC && @@ -706,9 +706,9 @@ unsigned OptPtrLoad7 (CodeSeg* S) L[7]->OPC == OP65_TYA && L[8]->OPC == OP65_LDY && CE_IsCallTo (L[9], "ldaxidx") && - !CS_RangeHasLabel (S, I+1, 9)) { + !CS_RangeHasLabel (S, I+1, 9)) { - CodeEntry* X; + CodeEntry* X; /* Track the insertion point */ unsigned IP = I + 10; @@ -817,16 +817,16 @@ unsigned OptPtrLoad7 (CodeSeg* S) X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[9]->LI); CS_InsertEntry (S, X, IP++); - /* Remove the old code */ - CS_DelEntries (S, I, 10); + /* Remove the old code */ + CS_DelEntries (S, I, 10); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -861,59 +861,59 @@ unsigned OptPtrLoad11 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[6]; + CodeEntry* L[6]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_CLC && - CS_GetEntries (S, L+1, I+1, 5) && - L[1]->OPC == OP65_ADC && - (L[1]->AM == AM65_ABS || L[1]->AM == AM65_ZP || L[1]->AM == AM65_IMM) && - (L[2]->OPC == OP65_BCC || L[2]->OPC == OP65_JCC) && - L[2]->JumpTo != 0 && - L[2]->JumpTo->Owner == L[4] && - L[3]->OPC == OP65_INX && - L[4]->OPC == OP65_LDY && - CE_IsKnownImm (L[4], 0) && - CE_IsCallTo (L[5], "ldauidx") && - !CS_RangeHasLabel (S, I+1, 3) && + /* Check for the sequence */ + if (L[0]->OPC == OP65_CLC && + CS_GetEntries (S, L+1, I+1, 5) && + L[1]->OPC == OP65_ADC && + (L[1]->AM == AM65_ABS || L[1]->AM == AM65_ZP || L[1]->AM == AM65_IMM) && + (L[2]->OPC == OP65_BCC || L[2]->OPC == OP65_JCC) && + L[2]->JumpTo != 0 && + L[2]->JumpTo->Owner == L[4] && + L[3]->OPC == OP65_INX && + L[4]->OPC == OP65_LDY && + CE_IsKnownImm (L[4], 0) && + CE_IsCallTo (L[5], "ldauidx") && + !CS_RangeHasLabel (S, I+1, 3) && !CE_HasLabel (L[5])) { - CodeEntry* X; + CodeEntry* X; - /* We will create all the new stuff behind the current one so - * we keep the line references. - */ - X = NewCodeEntry (OP65_LDY, L[1]->AM, L[1]->Arg, 0, L[0]->LI); - CS_InsertEntry (S, X, I+6); + /* We will create all the new stuff behind the current one so + * we keep the line references. + */ + X = NewCodeEntry (OP65_LDY, L[1]->AM, L[1]->Arg, 0, L[0]->LI); + CS_InsertEntry (S, X, I+6); /* sta ptr1 */ - X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[0]->LI); - CS_InsertEntry (S, X, I+7); + X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[0]->LI); + CS_InsertEntry (S, X, I+7); /* stx ptr1+1 */ - X = NewCodeEntry (OP65_STX, AM65_ZP, "ptr1+1", 0, L[0]->LI); - CS_InsertEntry (S, X, I+8); + X = NewCodeEntry (OP65_STX, AM65_ZP, "ptr1+1", 0, L[0]->LI); + CS_InsertEntry (S, X, I+8); /* ldx #$00 */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[0]->LI); - CS_InsertEntry (S, X, I+9); + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[0]->LI); + CS_InsertEntry (S, X, I+9); - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[0]->LI); - CS_InsertEntry (S, X, I+10); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[0]->LI); + CS_InsertEntry (S, X, I+10); - /* Remove the old code */ - CS_DelEntries (S, I, 6); + /* Remove the old code */ + CS_DelEntries (S, I, 6); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -961,18 +961,18 @@ unsigned OptPtrLoad12 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[15]; - unsigned Len; + CodeEntry* L[15]; + unsigned Len; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDA && + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDA && L[0]->AM == AM65_ZP && strncmp (L[0]->Arg, "regbank+", 8) == 0 && (Len = strlen (L[0]->Arg)) > 0 && - CS_GetEntries (S, L+1, I+1, 14) && + CS_GetEntries (S, L+1, I+1, 14) && !CS_RangeHasLabel (S, I+1, 7) && !CS_RangeHasLabel (S, I+9, 5) && L[1]->OPC == OP65_LDX && @@ -1008,7 +1008,7 @@ unsigned OptPtrLoad12 (CodeSeg* S) CE_IsConstImm (L[12]) && CE_IsCallTo (L[13], "ldauidx")) { - CodeEntry* X; + CodeEntry* X; CodeLabel* Label; /* Check if the instruction following the sequence uses the flags @@ -1025,13 +1025,13 @@ unsigned OptPtrLoad12 (CodeSeg* S) */ Label = CS_GenLabel (S, L[14]); - /* ldy #$xx */ - X = NewCodeEntry (OP65_LDY, AM65_IMM, L[12]->Arg, 0, L[12]->LI); - CS_InsertEntry (S, X, I+14); + /* ldy #$xx */ + X = NewCodeEntry (OP65_LDY, AM65_IMM, L[12]->Arg, 0, L[12]->LI); + CS_InsertEntry (S, X, I+14); - /* ldx #$xx */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[13]->LI); - CS_InsertEntry (S, X, I+15); + /* ldx #$xx */ + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[13]->LI); + CS_InsertEntry (S, X, I+15); /* lda (regbank+n),y */ X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, L[0]->Arg, 0, L[13]->LI); @@ -1050,15 +1050,15 @@ unsigned OptPtrLoad12 (CodeSeg* S) CS_InsertEntry (S, X, I+19); /* Delete the old code */ - CS_DelEntries (S, I, 14); + CS_DelEntries (S, I, 14); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -1089,44 +1089,44 @@ unsigned OptPtrLoad13 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[4]; - unsigned Len; + CodeEntry* L[4]; + unsigned Len; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDA && L[0]->AM == AM65_ZP && - CS_GetEntries (S, L+1, I+1, 3) && + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDA && L[0]->AM == AM65_ZP && + CS_GetEntries (S, L+1, I+1, 3) && !CS_RangeHasLabel (S, I+1, 3) && - L[1]->OPC == OP65_LDX && L[1]->AM == AM65_ZP && + L[1]->OPC == OP65_LDX && L[1]->AM == AM65_ZP && (Len = strlen (L[0]->Arg)) > 0 && strncmp (L[0]->Arg, L[1]->Arg, Len) == 0 && strcmp (L[1]->Arg + Len, "+1") == 0 && - L[2]->OPC == OP65_LDY && - CE_IsCallTo (L[3], "ldauidx")) { + L[2]->OPC == OP65_LDY && + CE_IsCallTo (L[3], "ldauidx")) { - CodeEntry* X; + CodeEntry* X; - /* ldx #$00 */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[3]->LI); - CS_InsertEntry (S, X, I+3); + /* ldx #$00 */ + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[3]->LI); + CS_InsertEntry (S, X, I+3); - /* lda (zp),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, L[0]->Arg, 0, L[3]->LI); - CS_InsertEntry (S, X, I+4); + /* lda (zp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, L[0]->Arg, 0, L[3]->LI); + CS_InsertEntry (S, X, I+4); - /* Remove the old code */ - CS_DelEntry (S, I+5); - CS_DelEntries (S, I, 2); + /* Remove the old code */ + CS_DelEntry (S, I+5); + CS_DelEntries (S, I, 2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -1163,44 +1163,44 @@ unsigned OptPtrLoad14 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[5]; - unsigned Len; + CodeEntry* L[5]; + unsigned Len; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDA && L[0]->AM == AM65_ZP && - CS_GetEntries (S, L+1, I+1, 4) && + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDA && L[0]->AM == AM65_ZP && + CS_GetEntries (S, L+1, I+1, 4) && !CS_RangeHasLabel (S, I+1, 4) && - L[1]->OPC == OP65_LDX && L[1]->AM == AM65_ZP && + L[1]->OPC == OP65_LDX && L[1]->AM == AM65_ZP && (Len = strlen (L[0]->Arg)) > 0 && strncmp (L[0]->Arg, L[1]->Arg, Len) == 0 && strcmp (L[1]->Arg + Len, "+1") == 0 && (L[2]->Chg & REG_AX) == 0 && - L[3]->OPC == OP65_LDY && - CE_IsCallTo (L[4], "ldauidx")) { + L[3]->OPC == OP65_LDY && + CE_IsCallTo (L[4], "ldauidx")) { - CodeEntry* X; + CodeEntry* X; - /* ldx #$00 */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[3]->LI); - CS_InsertEntry (S, X, I+5); + /* ldx #$00 */ + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[3]->LI); + CS_InsertEntry (S, X, I+5); - /* lda (zp),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, L[0]->Arg, 0, L[3]->LI); - CS_InsertEntry (S, X, I+6); + /* lda (zp),y */ + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, L[0]->Arg, 0, L[3]->LI); + CS_InsertEntry (S, X, I+6); - /* Remove the old code */ - CS_DelEntry (S, I+4); + /* Remove the old code */ + CS_DelEntry (S, I+4); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -1237,13 +1237,13 @@ unsigned OptPtrLoad15 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[5]; - unsigned Len; + CodeEntry* L[5]; + unsigned Len; - /* Check for the start of the sequence */ - if (CS_GetEntries (S, L, I, 3) && + /* Check for the start of the sequence */ + if (CS_GetEntries (S, L, I, 3) && L[0]->OPC == OP65_LDA && L[0]->AM == AM65_ZP && - L[1]->OPC == OP65_LDX && L[1]->AM == AM65_ZP && + L[1]->OPC == OP65_LDX && L[1]->AM == AM65_ZP && !CS_RangeHasLabel (S, I+1, 2) && (Len = strlen (L[0]->Arg)) > 0 && strncmp (L[0]->Arg, L[1]->Arg, Len) == 0 && @@ -1285,10 +1285,10 @@ unsigned OptPtrLoad15 (CodeSeg* S) ++Changes; } - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -1321,49 +1321,49 @@ unsigned OptPtrLoad16 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[2]; + CodeEntry* L[2]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDY && - CS_GetEntries (S, L+1, I+1, 1) && - CE_IsCallTo (L[1], "ldauidx") && - !CE_HasLabel (L[1])) { + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDY && + CS_GetEntries (S, L+1, I+1, 1) && + CE_IsCallTo (L[1], "ldauidx") && + !CE_HasLabel (L[1])) { - CodeEntry* X; + CodeEntry* X; - /* stx ptr1+1 */ - X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[1]->LI); - CS_InsertEntry (S, X, I+2); + /* stx ptr1+1 */ + X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[1]->LI); + CS_InsertEntry (S, X, I+2); - /* sta ptr1 */ - X = NewCodeEntry (OP65_STX, AM65_ZP, "ptr1+1", 0, L[1]->LI); - CS_InsertEntry (S, X, I+3); + /* sta ptr1 */ + X = NewCodeEntry (OP65_STX, AM65_ZP, "ptr1+1", 0, L[1]->LI); + CS_InsertEntry (S, X, I+3); /* ldy ... */ - X = NewCodeEntry (L[0]->OPC, L[0]->AM, L[0]->Arg, 0, L[0]->LI); - CS_InsertEntry (S, X, I+4); + X = NewCodeEntry (L[0]->OPC, L[0]->AM, L[0]->Arg, 0, L[0]->LI); + CS_InsertEntry (S, X, I+4); - /* ldx #$00 */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[1]->LI); - CS_InsertEntry (S, X, I+5); + /* ldx #$00 */ + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[1]->LI); + CS_InsertEntry (S, X, I+5); /* lda (ptr1),y */ - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[1]->LI); - CS_InsertEntry (S, X, I+6); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[1]->LI); + CS_InsertEntry (S, X, I+6); - /* Delete the old code */ - CS_DelEntries (S, I, 2); + /* Delete the old code */ + CS_DelEntries (S, I, 2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -1401,26 +1401,26 @@ unsigned OptPtrLoad17 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[2]; + CodeEntry* L[2]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDY && - CS_GetEntries (S, L+1, I+1, 1) && - CE_IsCallTo (L[1], "ldaxidx") && - !CE_HasLabel (L[1])) { + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDY && + CS_GetEntries (S, L+1, I+1, 1) && + CE_IsCallTo (L[1], "ldaxidx") && + !CE_HasLabel (L[1])) { - CodeEntry* X; + CodeEntry* X; - /* Store the high byte */ - X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[0]->LI); - CS_InsertEntry (S, X, I+2); + /* Store the high byte */ + X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[0]->LI); + CS_InsertEntry (S, X, I+2); - /* Store the low byte */ - X = NewCodeEntry (OP65_STX, AM65_ZP, "ptr1+1", 0, L[0]->LI); - CS_InsertEntry (S, X, I+3); + /* Store the low byte */ + X = NewCodeEntry (OP65_STX, AM65_ZP, "ptr1+1", 0, L[0]->LI); + CS_InsertEntry (S, X, I+3); /* ldy ... */ X = NewCodeEntry (L[0]->OPC, L[0]->AM, L[0]->Arg, 0, L[0]->LI); @@ -1442,16 +1442,16 @@ unsigned OptPtrLoad17 (CodeSeg* S) X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, "ptr1", 0, L[1]->LI); CS_InsertEntry (S, X, I+8); - /* Delete original sequence */ - CS_DelEntries (S, I, 2); + /* Delete original sequence */ + CS_DelEntries (S, I, 2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptptrload.h b/src/cc65/coptptrload.h index 06790aee5..3b8a83c7b 100644 --- a/src/cc65/coptptrload.h +++ b/src/cc65/coptptrload.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -53,32 +53,32 @@ unsigned OptPtrLoad1 (CodeSeg* S); /* Search for the sequence: * * clc - * adc xxx + * adc xxx * tay * txa * adc yyy * tax * tya * ldy - * jsr ldauidx + * jsr ldauidx * * and replace it by: * * clc - * adc xxx + * adc xxx * sta ptr1 * txa * adc yyy * sta ptr1+1 * ldy - * ldx #$00 + * ldx #$00 * lda (ptr1),y */ unsigned OptPtrLoad2 (CodeSeg* S); /* Search for the sequence: * - * adc xxx + * adc xxx * pha * txa * iny @@ -86,18 +86,18 @@ unsigned OptPtrLoad2 (CodeSeg* S); * tax * pla * ldy - * jsr ldauidx + * jsr ldauidx * * and replace it by: * - * adc xxx + * adc xxx * sta ptr1 * txa * iny * adc yyy * sta ptr1+1 * ldy - * ldx #$00 + * ldx #$00 * lda (ptr1),y */ diff --git a/src/cc65/coptptrstore.c b/src/cc65/coptptrstore.c index 754388de8..646cec07f 100644 --- a/src/cc65/coptptrstore.c +++ b/src/cc65/coptptrstore.c @@ -59,32 +59,32 @@ static unsigned OptPtrStore1Sub (CodeSeg* S, unsigned I, CodeEntry** const L) { /* Check for a label attached to the entry */ if (CE_HasLabel (L[0])) { - return 0; + return 0; } /* Check for single insn sub ops */ if (L[0]->OPC == OP65_AND || - L[0]->OPC == OP65_EOR || - L[0]->OPC == OP65_ORA || - (L[0]->OPC == OP65_JSR && + L[0]->OPC == OP65_EOR || + L[0]->OPC == OP65_ORA || + (L[0]->OPC == OP65_JSR && (strncmp (L[0]->Arg, "shlax", 5) == 0 || strncmp (L[0]->Arg, "shrax", 5) == 0) && strlen (L[0]->Arg) == 6 && IsDigit (L[0]->Arg[5]))) { - /* One insn */ - return 1; + /* One insn */ + return 1; } else if (L[0]->OPC == OP65_CLC && - (L[1] = CS_GetNextEntry (S, I)) != 0 && - L[1]->OPC == OP65_ADC && - !CE_HasLabel (L[1])) { - return 2; + (L[1] = CS_GetNextEntry (S, I)) != 0 && + L[1]->OPC == OP65_ADC && + !CE_HasLabel (L[1])) { + return 2; } else if (L[0]->OPC == OP65_SEC && - (L[1] = CS_GetNextEntry (S, I)) != 0 && - L[1]->OPC == OP65_SBC && - !CE_HasLabel (L[1])) { - return 2; + (L[1] = CS_GetNextEntry (S, I)) != 0 && + L[1]->OPC == OP65_SBC && + !CE_HasLabel (L[1])) { + return 2; } @@ -216,7 +216,7 @@ static const char* LoadAXImm (CodeSeg* S, unsigned I) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -228,10 +228,10 @@ unsigned OptPtrStore1 (CodeSeg* S) * adc xxx * bcc L * inx - * L: jsr pushax - * ldx #$00 - * lda yyy - * ldy #$00 + * L: jsr pushax + * ldx #$00 + * lda yyy + * ldy #$00 * jsr staspidx * * and replace it by: @@ -274,34 +274,34 @@ unsigned OptPtrStore1 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[9]; + CodeEntry* L[9]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_CLC && - CS_GetEntries (S, L+1, I+1, 8) && - L[1]->OPC == OP65_ADC && - (L[1]->AM == AM65_ABS || + /* Check for the sequence */ + if (L[0]->OPC == OP65_CLC && + CS_GetEntries (S, L+1, I+1, 8) && + L[1]->OPC == OP65_ADC && + (L[1]->AM == AM65_ABS || L[1]->AM == AM65_ZP || L[1]->AM == AM65_IMM || (L[1]->AM == AM65_ZP_INDY && RegValIsKnown (L[1]->RI->In.RegY))) && - (L[2]->OPC == OP65_BCC || L[2]->OPC == OP65_JCC) && - L[2]->JumpTo != 0 && - L[2]->JumpTo->Owner == L[4] && - L[3]->OPC == OP65_INX && + (L[2]->OPC == OP65_BCC || L[2]->OPC == OP65_JCC) && + L[2]->JumpTo != 0 && + L[2]->JumpTo->Owner == L[4] && + L[3]->OPC == OP65_INX && CE_IsCallTo (L[4], "pushax") && L[5]->OPC == OP65_LDX && L[6]->OPC == OP65_LDA && - L[7]->OPC == OP65_LDY && - CE_IsKnownImm (L[7], 0) && - CE_IsCallTo (L[8], "staspidx") && - !CS_RangeHasLabel (S, I+1, 3) && + L[7]->OPC == OP65_LDY && + CE_IsKnownImm (L[7], 0) && + CE_IsCallTo (L[8], "staspidx") && + !CS_RangeHasLabel (S, I+1, 3) && !CS_RangeHasLabel (S, I+5, 4)) { - CodeEntry* X; + CodeEntry* X; const char* Loc; am_t AM; @@ -364,19 +364,19 @@ unsigned OptPtrStore1 (CodeSeg* S) X = NewCodeEntry (OP65_STA, AM, Loc, 0, L[8]->LI); CS_InsertEntry (S, X, IP++); - /* Remove the old code */ - CS_DelEntries (S, I, 9); + /* Remove the old code */ + CS_DelEntries (S, I, 9); /* Skip most of the generated replacement code */ I += 3; - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -393,11 +393,11 @@ unsigned OptPtrStore2 (CodeSeg* S) * adc xxx * bcc L * inx - * L: jsr pushax + * L: jsr pushax * ldy yyy - * ldx #$00 - * lda (sp),y - * ldy #$00 + * ldx #$00 + * lda (sp),y + * ldy #$00 * jsr staspidx * * and replace it by: @@ -444,24 +444,24 @@ unsigned OptPtrStore2 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[10]; + CodeEntry* L[10]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_CLC && - CS_GetEntries (S, L+1, I+1, 9) && - L[1]->OPC == OP65_ADC && - (L[1]->AM == AM65_ABS || + /* Check for the sequence */ + if (L[0]->OPC == OP65_CLC && + CS_GetEntries (S, L+1, I+1, 9) && + L[1]->OPC == OP65_ADC && + (L[1]->AM == AM65_ABS || L[1]->AM == AM65_ZP || L[1]->AM == AM65_IMM || (L[1]->AM == AM65_ZP_INDY && RegValIsKnown (L[1]->RI->In.RegY))) && - (L[2]->OPC == OP65_BCC || L[2]->OPC == OP65_JCC) && - L[2]->JumpTo != 0 && - L[2]->JumpTo->Owner == L[4] && - L[3]->OPC == OP65_INX && + (L[2]->OPC == OP65_BCC || L[2]->OPC == OP65_JCC) && + L[2]->JumpTo != 0 && + L[2]->JumpTo->Owner == L[4] && + L[3]->OPC == OP65_INX && CE_IsCallTo (L[4], "pushax") && L[5]->OPC == OP65_LDY && CE_IsConstImm (L[5]) && @@ -469,15 +469,15 @@ unsigned OptPtrStore2 (CodeSeg* S) L[7]->OPC == OP65_LDA && L[7]->AM == AM65_ZP_INDY && strcmp (L[7]->Arg, "sp") == 0 && - L[8]->OPC == OP65_LDY && + L[8]->OPC == OP65_LDY && (L[8]->AM == AM65_ABS || L[8]->AM == AM65_ZP || L[8]->AM == AM65_IMM) && - CE_IsCallTo (L[9], "staspidx") && - !CS_RangeHasLabel (S, I+1, 3) && + CE_IsCallTo (L[9], "staspidx") && + !CS_RangeHasLabel (S, I+1, 3) && !CS_RangeHasLabel (S, I+5, 5)) { - CodeEntry* X; + CodeEntry* X; const char* Arg; const char* Loc; am_t AM; @@ -606,19 +606,19 @@ unsigned OptPtrStore2 (CodeSeg* S) } - /* Remove the old code */ - CS_DelEntries (S, I, 10); + /* Remove the old code */ + CS_DelEntries (S, I, 10); /* Skip most of the generated replacement code */ I += 4; - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -631,12 +631,12 @@ unsigned OptPtrStore2 (CodeSeg* S) unsigned OptPtrStore3 (CodeSeg* S) /* Search for the sequence: * - * jsr pushax + * jsr pushax * ldy xxx * jsr ldauidx * subop * ldy yyy - * jsr staspidx + * jsr staspidx * * and replace it by: * @@ -645,7 +645,7 @@ unsigned OptPtrStore3 (CodeSeg* S) * ldy xxx * ldx #$00 * lda (ptr1),y - * subop + * subop * ldy yyy * sta (ptr1),y * @@ -660,32 +660,32 @@ unsigned OptPtrStore3 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - unsigned K; - CodeEntry* L[10]; + unsigned K; + CodeEntry* L[10]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (CE_IsCallTo (L[0], "pushax") && - CS_GetEntries (S, L+1, I+1, 3) && - L[1]->OPC == OP65_LDY && - CE_IsConstImm (L[1]) && - !CE_HasLabel (L[1]) && - CE_IsCallTo (L[2], "ldauidx") && - !CE_HasLabel (L[2]) && - (K = OptPtrStore1Sub (S, I+3, L+3)) > 0 && - CS_GetEntries (S, L+3+K, I+3+K, 2) && - L[3+K]->OPC == OP65_LDY && - CE_IsConstImm (L[3+K]) && - !CE_HasLabel (L[3+K]) && - CE_IsCallTo (L[4+K], "staspidx") && - !CE_HasLabel (L[4+K])) { + /* Check for the sequence */ + if (CE_IsCallTo (L[0], "pushax") && + CS_GetEntries (S, L+1, I+1, 3) && + L[1]->OPC == OP65_LDY && + CE_IsConstImm (L[1]) && + !CE_HasLabel (L[1]) && + CE_IsCallTo (L[2], "ldauidx") && + !CE_HasLabel (L[2]) && + (K = OptPtrStore1Sub (S, I+3, L+3)) > 0 && + CS_GetEntries (S, L+3+K, I+3+K, 2) && + L[3+K]->OPC == OP65_LDY && + CE_IsConstImm (L[3+K]) && + !CE_HasLabel (L[3+K]) && + CE_IsCallTo (L[4+K], "staspidx") && + !CE_HasLabel (L[4+K])) { const char* RegBank = 0; const char* ZPLoc = "ptr1"; - CodeEntry* X; + CodeEntry* X; /* Get the preceeding two instructions and check them. We check @@ -717,21 +717,21 @@ unsigned OptPtrStore3 (CodeSeg* S) } } - /* Insert the load via the zp pointer */ - X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[3]->LI); - CS_InsertEntry (S, X, I+3); - X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, ZPLoc, 0, L[2]->LI); - CS_InsertEntry (S, X, I+4); + /* Insert the load via the zp pointer */ + X = NewCodeEntry (OP65_LDX, AM65_IMM, "$00", 0, L[3]->LI); + CS_InsertEntry (S, X, I+3); + X = NewCodeEntry (OP65_LDA, AM65_ZP_INDY, ZPLoc, 0, L[2]->LI); + CS_InsertEntry (S, X, I+4); - /* Insert the store through the zp pointer */ - X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, ZPLoc, 0, L[3]->LI); - CS_InsertEntry (S, X, I+6+K); + /* Insert the store through the zp pointer */ + X = NewCodeEntry (OP65_STA, AM65_ZP_INDY, ZPLoc, 0, L[3]->LI); + CS_InsertEntry (S, X, I+6+K); - /* Delete the old code */ - CS_DelEntry (S, I+7+K); /* jsr spaspidx */ + /* Delete the old code */ + CS_DelEntry (S, I+7+K); /* jsr spaspidx */ CS_DelEntry (S, I+2); /* jsr ldauidx */ - /* Create and insert the stores into the zp pointer if needed */ + /* Create and insert the stores into the zp pointer if needed */ if (RegBank == 0) { X = NewCodeEntry (OP65_STA, AM65_ZP, "ptr1", 0, L[0]->LI); CS_InsertEntry (S, X, I+1); @@ -744,13 +744,13 @@ unsigned OptPtrStore3 (CodeSeg* S) */ CS_DelEntry (S, I); /* jsr pushax */ - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptptrstore.h b/src/cc65/coptptrstore.h index 136ea8230..c6798ea30 100644 --- a/src/cc65/coptptrstore.h +++ b/src/cc65/coptptrstore.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -56,10 +56,10 @@ unsigned OptPtrStore1 (CodeSeg* S); * adc xxx * bcc L * inx - * L: jsr pushax - * ldx #$00 - * lda yyy - * ldy #$00 + * L: jsr pushax + * ldx #$00 + * lda yyy + * ldy #$00 * jsr staspidx * * and replace it by: @@ -102,11 +102,11 @@ unsigned OptPtrStore2 (CodeSeg* S); * adc xxx * bcc L * inx - * L: jsr pushax + * L: jsr pushax * ldy yyy - * ldx #$00 - * lda (sp),y - * ldy #$00 + * ldx #$00 + * lda (sp),y + * ldy #$00 * jsr staspidx * * and replace it by: @@ -149,12 +149,12 @@ unsigned OptPtrStore2 (CodeSeg* S); unsigned OptPtrStore3 (CodeSeg* S); /* Search for the sequence: * - * jsr pushax + * jsr pushax * ldy xxx * jsr ldauidx * subop * ldy yyy - * jsr staspidx + * jsr staspidx * * and replace it by: * @@ -163,7 +163,7 @@ unsigned OptPtrStore3 (CodeSeg* S); * ldy xxx * ldx #$00 * lda (ptr1),y - * subop + * subop * ldy yyy * sta (ptr1),y * diff --git a/src/cc65/coptpush.c b/src/cc65/coptpush.c index 54b54fc03..a1ed700f6 100644 --- a/src/cc65/coptpush.c +++ b/src/cc65/coptpush.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptpush.c */ +/* coptpush.c */ /* */ -/* Optimize push sequences */ +/* Optimize push sequences */ /* */ /* */ /* */ @@ -41,7 +41,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -67,43 +67,43 @@ unsigned OptPush1 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[2]; + CodeEntry* L[2]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (CE_IsCallTo (L[0], "ldaxysp") && + /* Check for the sequence */ + if (CE_IsCallTo (L[0], "ldaxysp") && RegValIsKnown (L[0]->RI->In.RegY) && L[0]->RI->In.RegY < 0xFE && (L[1] = CS_GetNextEntry (S, I)) != 0 && !CE_HasLabel (L[1]) && - CE_IsCallTo (L[1], "pushax") && - !RegAXUsed (S, I+2)) { + CE_IsCallTo (L[1], "pushax") && + !RegAXUsed (S, I+2)) { - /* Insert new code behind the pushax */ - const char* Arg; - CodeEntry* X; + /* Insert new code behind the pushax */ + const char* Arg; + CodeEntry* X; - /* ldy #xx+1 */ - Arg = MakeHexArg (L[0]->RI->In.RegY+2); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[0]->LI); - CS_InsertEntry (S, X, I+2); + /* ldy #xx+1 */ + Arg = MakeHexArg (L[0]->RI->In.RegY+2); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, L[0]->LI); + CS_InsertEntry (S, X, I+2); - /* jsr pushwysp */ - X = NewCodeEntry (OP65_JSR, AM65_ABS, "pushwysp", 0, L[1]->LI); - CS_InsertEntry (S, X, I+3); + /* jsr pushwysp */ + X = NewCodeEntry (OP65_JSR, AM65_ABS, "pushwysp", 0, L[1]->LI); + CS_InsertEntry (S, X, I+3); - /* Delete the old code */ - CS_DelEntries (S, I, 2); + /* Delete the old code */ + CS_DelEntries (S, I, 2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -132,34 +132,34 @@ unsigned OptPush2 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[2]; + CodeEntry* L[2]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (CE_IsCallTo (L[0], "ldaxidx") && + /* Check for the sequence */ + if (CE_IsCallTo (L[0], "ldaxidx") && (L[1] = CS_GetNextEntry (S, I)) != 0 && !CE_HasLabel (L[1]) && - CE_IsCallTo (L[1], "pushax")) { + CE_IsCallTo (L[1], "pushax")) { - /* Insert new code behind the pushax */ - CodeEntry* X; + /* Insert new code behind the pushax */ + CodeEntry* X; - /* jsr pushwidx */ - X = NewCodeEntry (OP65_JSR, AM65_ABS, "pushwidx", 0, L[1]->LI); - CS_InsertEntry (S, X, I+2); + /* jsr pushwidx */ + X = NewCodeEntry (OP65_JSR, AM65_ABS, "pushwidx", 0, L[1]->LI); + CS_InsertEntry (S, X, I+2); - /* Delete the old code */ - CS_DelEntries (S, I, 2); + /* Delete the old code */ + CS_DelEntries (S, I, 2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptpush.h b/src/cc65/coptpush.h index 02b15d7ee..0cd01dde8 100644 --- a/src/cc65/coptpush.h +++ b/src/cc65/coptpush.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptpush.h */ +/* coptpush.h */ /* */ -/* Optimize push sequences */ +/* Optimize push sequences */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/coptshift.c b/src/cc65/coptshift.c index 7ec8155ea..933c3dfa3 100644 --- a/src/cc65/coptshift.c +++ b/src/cc65/coptshift.c @@ -183,7 +183,7 @@ static unsigned GetShift (const char* Name) /*****************************************************************************/ -/* Optimize shifts */ +/* Optimize shifts */ /*****************************************************************************/ @@ -212,11 +212,11 @@ unsigned OptShift1 (CodeSeg* S) CodeEntry* X; CodeLabel* L; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_JSR && + /* Check for the sequence */ + if (E->OPC == OP65_JSR && (Shift = GetShift (E->Arg)) != SHIFT_NONE && SHIFT_DIR (Shift) == SHIFT_DIR_LEFT) { @@ -294,11 +294,11 @@ unsigned OptShift1 (CodeSeg* S) /* Remember, we had changes */ ++Changes; - } + } NextEntry: - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -327,11 +327,11 @@ unsigned OptShift2(CodeSeg* S) unsigned Shift; unsigned Count; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_JSR && + /* Check for the sequence */ + if (E->OPC == OP65_JSR && (Shift = GetShift (E->Arg)) != SHIFT_NONE && SHIFT_TYPE (Shift) == SHIFT_TYPE_ASR && (Count = SHIFT_COUNT (Shift)) > 0 && @@ -357,10 +357,10 @@ unsigned OptShift2(CodeSeg* S) /* Remember, we had changes */ ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -374,7 +374,7 @@ unsigned OptShift3 (CodeSeg* S) /* The sequence * * bcc L - * inx + * inx * L: jsr shrax1 * * may get replaced by @@ -397,19 +397,19 @@ unsigned OptShift3 (CodeSeg* S) unsigned Shift; unsigned Count; - CodeEntry* L[3]; + CodeEntry* L[3]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if ((L[0]->OPC == OP65_BCC || L[0]->OPC == OP65_JCC) && - L[0]->JumpTo != 0 && + /* Check for the sequence */ + if ((L[0]->OPC == OP65_BCC || L[0]->OPC == OP65_JCC) && + L[0]->JumpTo != 0 && L[0]->RI->In.RegX == 0 && - CS_GetEntries (S, L+1, I+1, 2) && - L[1]->OPC == OP65_INX && - L[0]->JumpTo->Owner == L[2] && - !CS_RangeHasLabel (S, I, 2) && + CS_GetEntries (S, L+1, I+1, 2) && + L[1]->OPC == OP65_INX && + L[0]->JumpTo->Owner == L[2] && + !CS_RangeHasLabel (S, I, 2) && L[2]->OPC == OP65_JSR && (Shift = GetShift (L[2]->Arg)) != SHIFT_NONE && SHIFT_DIR (Shift) == SHIFT_DIR_RIGHT && @@ -423,16 +423,16 @@ unsigned OptShift3 (CodeSeg* S) CS_InsertEntry (S, X, I+4); } - /* Remove the bcs/dex/jsr */ - CS_DelEntries (S, I, 3); + /* Remove the bcs/dex/jsr */ + CS_DelEntries (S, I, 3); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -457,14 +457,14 @@ unsigned OptShift4 (CodeSeg* S) unsigned Shift; unsigned Count; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_JSR && + /* Check for the sequence */ + if (E->OPC == OP65_JSR && (Shift = GetShift (E->Arg)) != SHIFT_NONE && SHIFT_DIR (Shift) == SHIFT_DIR_RIGHT && - E->RI->In.RegX == 0) { + E->RI->In.RegX == 0) { CodeEntry* X; @@ -518,17 +518,17 @@ unsigned OptShift4 (CodeSeg* S) } - /* Delete the call to shrax */ - CS_DelEntry (S, I); + /* Delete the call to shrax */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } NextEntry: - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -566,22 +566,22 @@ unsigned OptShift5 (CodeSeg* S) while (I < CS_GetEntryCount (S)) { unsigned ShiftType; - CodeEntry* L[5]; + CodeEntry* L[5]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check for the sequence */ - if (L[0]->OPC == OP65_LDA && + /* Check for the sequence */ + if (L[0]->OPC == OP65_LDA && (L[0]->AM == AM65_ABS || L[0]->AM == AM65_ZP) && - CS_GetEntries (S, L+1, I+1, 4) && + CS_GetEntries (S, L+1, I+1, 4) && !CS_RangeHasLabel (S, I+1, 4) && L[1]->OPC == OP65_LDX && (L[1]->AM == AM65_ABS || L[1]->AM == AM65_ZP) && L[2]->OPC == OP65_JSR && (ShiftType = GetShift (L[2]->Arg)) != SHIFT_NONE && SHIFT_COUNT(ShiftType) == 1 && - L[3]->OPC == OP65_STA && + L[3]->OPC == OP65_STA && (L[3]->AM == AM65_ABS || L[3]->AM == AM65_ZP) && L[4]->OPC == OP65_STX && (L[4]->AM == AM65_ABS || L[4]->AM == AM65_ZP) && @@ -644,13 +644,13 @@ unsigned OptShift5 (CodeSeg* S) } - /* Remember, we had changes */ + /* Remember, we had changes */ ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -674,11 +674,11 @@ unsigned OptShift6 (CodeSeg* S) CodeEntry* X; unsigned IP; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for a call to one of the shift routine */ - if (E->OPC == OP65_JSR && + /* Check for a call to one of the shift routine */ + if (E->OPC == OP65_JSR && (Shift = GetShift (E->Arg)) != SHIFT_NONE && SHIFT_DIR (Shift) == SHIFT_DIR_LEFT && (Count = SHIFT_COUNT (Shift)) > 0) { @@ -729,13 +729,13 @@ unsigned OptShift6 (CodeSeg* S) /* Remove the subroutine call */ CS_DelEntry (S, I); - /* Remember, we had changes */ + /* Remember, we had changes */ ++Changes; - } + } NextEntry: - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptshift.h b/src/cc65/coptshift.h index 9bde729b0..ce63e0e1b 100644 --- a/src/cc65/coptshift.h +++ b/src/cc65/coptshift.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Optimize shifts */ +/* Optimize shifts */ /*****************************************************************************/ @@ -74,7 +74,7 @@ unsigned OptShift3 (CodeSeg* S); /* The sequence * * bcc L - * inx + * inx * L: jsr shrax1 * * may get replaced by diff --git a/src/cc65/coptsize.c b/src/cc65/coptsize.c index fcb15854e..0848bab0e 100644 --- a/src/cc65/coptsize.c +++ b/src/cc65/coptsize.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* coptsize.c */ +/* coptsize.c */ /* */ /* Size optimizations */ /* */ @@ -811,7 +811,7 @@ static const CallDesc CallTable [] = { /*****************************************************************************/ -/* Helpers */ +/* Helpers */ /*****************************************************************************/ @@ -828,22 +828,22 @@ static const CallDesc* FindCall (const char* Name) while (First <= Last) { - /* Set current to mid of range */ - int Current = (Last + First) / 2; + /* Set current to mid of range */ + int Current = (Last + First) / 2; - /* Do a compare */ - int Result = strcmp (CallTable[Current].LongFunc, Name); - if (Result < 0) { - First = Current + 1; - } else { - Last = Current - 1; - if (Result == 0) { - /* Found. Repeat the procedure until the first of all entries + /* Do a compare */ + int Result = strcmp (CallTable[Current].LongFunc, Name); + if (Result < 0) { + First = Current + 1; + } else { + Last = Current - 1; + if (Result == 0) { + /* Found. Repeat the procedure until the first of all entries * with the same name is found. */ - Found = 1; - } - } + Found = 1; + } + } } /* Return the first entry if found, or NULL otherwise */ @@ -863,7 +863,7 @@ static int RegMatch (short Expected, short Actual) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -887,11 +887,11 @@ unsigned OptSize1 (CodeSeg* S) const CallDesc* D; - /* Get next entry */ - E = CS_GetEntry (S, I); + /* Get next entry */ + E = CS_GetEntry (S, I); - /* Check if it's a subroutine call */ - if (E->OPC == OP65_JSR && (D = FindCall (E->Arg)) != 0) { + /* Check if it's a subroutine call */ + if (E->OPC == OP65_JSR && (D = FindCall (E->Arg)) != 0) { /* Get input register info for this insn */ const RegContents* In = &E->RI->In; @@ -934,8 +934,8 @@ unsigned OptSize1 (CodeSeg* S) } } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -958,76 +958,76 @@ unsigned OptSize2 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); /* Get the input registers */ const RegContents* In = &E->RI->In; - /* Assume we have no replacement */ - CodeEntry* X = 0; + /* Assume we have no replacement */ + CodeEntry* X = 0; - /* Check the instruction */ - switch (E->OPC) { + /* Check the instruction */ + switch (E->OPC) { - case OP65_LDA: - if (CE_IsConstImm (E)) { - short Val = (short) E->Num; - if (Val == In->RegX) { - X = NewCodeEntry (OP65_TXA, AM65_IMP, 0, 0, E->LI); - } else if (Val == In->RegY) { - X = NewCodeEntry (OP65_TYA, AM65_IMP, 0, 0, E->LI); - } else if (RegValIsKnown (In->RegA) && (CPUIsets[CPU] & CPU_ISET_65SC02) != 0) { - if (Val == ((In->RegA - 1) & 0xFF)) { - X = NewCodeEntry (OP65_DEA, AM65_IMP, 0, 0, E->LI); - } else if (Val == ((In->RegA + 1) & 0xFF)) { - X = NewCodeEntry (OP65_INA, AM65_IMP, 0, 0, E->LI); - } - } - } - break; - - case OP65_LDX: - if (CE_IsConstImm (E)) { - short Val = (short) E->Num; - if (RegValIsKnown (In->RegX) && Val == ((In->RegX - 1) & 0xFF)) { - X = NewCodeEntry (OP65_DEX, AM65_IMP, 0, 0, E->LI); - } else if (RegValIsKnown (In->RegX) && Val == ((In->RegX + 1) & 0xFF)) { - X = NewCodeEntry (OP65_INX, AM65_IMP, 0, 0, E->LI); - } else if (Val == In->RegA) { - X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, E->LI); + case OP65_LDA: + if (CE_IsConstImm (E)) { + short Val = (short) E->Num; + if (Val == In->RegX) { + X = NewCodeEntry (OP65_TXA, AM65_IMP, 0, 0, E->LI); + } else if (Val == In->RegY) { + X = NewCodeEntry (OP65_TYA, AM65_IMP, 0, 0, E->LI); + } else if (RegValIsKnown (In->RegA) && (CPUIsets[CPU] & CPU_ISET_65SC02) != 0) { + if (Val == ((In->RegA - 1) & 0xFF)) { + X = NewCodeEntry (OP65_DEA, AM65_IMP, 0, 0, E->LI); + } else if (Val == ((In->RegA + 1) & 0xFF)) { + X = NewCodeEntry (OP65_INA, AM65_IMP, 0, 0, E->LI); + } } - } - break; + } + break; - case OP65_LDY: - if (CE_IsConstImm (E)) { - short Val = (short) E->Num; - if (RegValIsKnown (In->RegY) && Val == ((In->RegY - 1) & 0xFF)) { - X = NewCodeEntry (OP65_DEY, AM65_IMP, 0, 0, E->LI); - } else if (RegValIsKnown (In->RegY) && Val == ((In->RegY + 1) & 0xFF)) { - X = NewCodeEntry (OP65_INY, AM65_IMP, 0, 0, E->LI); - } else if (Val == In->RegA) { - X = NewCodeEntry (OP65_TAY, AM65_IMP, 0, 0, E->LI); - } - } - break; + case OP65_LDX: + if (CE_IsConstImm (E)) { + short Val = (short) E->Num; + if (RegValIsKnown (In->RegX) && Val == ((In->RegX - 1) & 0xFF)) { + X = NewCodeEntry (OP65_DEX, AM65_IMP, 0, 0, E->LI); + } else if (RegValIsKnown (In->RegX) && Val == ((In->RegX + 1) & 0xFF)) { + X = NewCodeEntry (OP65_INX, AM65_IMP, 0, 0, E->LI); + } else if (Val == In->RegA) { + X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, E->LI); + } + } + break; - default: - /* Avoid gcc warnings */ - break; + case OP65_LDY: + if (CE_IsConstImm (E)) { + short Val = (short) E->Num; + if (RegValIsKnown (In->RegY) && Val == ((In->RegY - 1) & 0xFF)) { + X = NewCodeEntry (OP65_DEY, AM65_IMP, 0, 0, E->LI); + } else if (RegValIsKnown (In->RegY) && Val == ((In->RegY + 1) & 0xFF)) { + X = NewCodeEntry (OP65_INY, AM65_IMP, 0, 0, E->LI); + } else if (Val == In->RegA) { + X = NewCodeEntry (OP65_TAY, AM65_IMP, 0, 0, E->LI); + } + } + break; - } + default: + /* Avoid gcc warnings */ + break; - /* Insert the replacement if we have one */ - if (X) { - CS_InsertEntry (S, X, I+1); - CS_DelEntry (S, I); - ++Changes; - } + } - /* Next entry */ - ++I; + /* Insert the replacement if we have one */ + if (X) { + CS_InsertEntry (S, X, I+1); + CS_DelEntry (S, I); + ++Changes; + } + + /* Next entry */ + ++I; } diff --git a/src/cc65/coptsize.h b/src/cc65/coptsize.h index 13eeae038..f1dc07e46 100644 --- a/src/cc65/coptsize.h +++ b/src/cc65/coptsize.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* coptsize.c */ +/* coptsize.c */ /* */ /* Size optimizations */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/coptstop.c b/src/cc65/coptstop.c index 0919002cf..4d3fe76e6 100644 --- a/src/cc65/coptstop.c +++ b/src/cc65/coptstop.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptstop.c */ +/* coptstop.c */ /* */ -/* Optimize operations that take operands via the stack */ +/* Optimize operations that take operands via the stack */ /* */ /* */ /* */ @@ -364,7 +364,7 @@ static void TrackLoads (LoadInfo* LI, CodeEntry* E, int I) /*****************************************************************************/ -/* Helpers */ +/* Helpers */ /*****************************************************************************/ @@ -428,14 +428,14 @@ static void AdjustStackOffset (StackOpData* D, unsigned Offs) int I = D->PushIndex + 1; while (I < D->OpIndex) { - CodeEntry* E = CS_GetEntry (D->Code, I); + CodeEntry* E = CS_GetEntry (D->Code, I); int NeedCorrection = 0; - if ((E->Use & REG_SP) != 0) { + if ((E->Use & REG_SP) != 0) { - /* Check for some things that should not happen */ - CHECK (E->AM == AM65_ZP_INDY || E->RI->In.RegY >= (short) Offs); - CHECK (strcmp (E->Arg, "sp") == 0); + /* Check for some things that should not happen */ + CHECK (E->AM == AM65_ZP_INDY || E->RI->In.RegY >= (short) Offs); + CHECK (strcmp (E->Arg, "sp") == 0); /* We need to correct this one */ NeedCorrection = 1; @@ -449,37 +449,37 @@ static void AdjustStackOffset (StackOpData* D, unsigned Offs) if (NeedCorrection) { - /* Get the code entry before this one. If it's a LDY, adjust the - * value. - */ - CodeEntry* P = CS_GetPrevEntry (D->Code, I); - if (P && P->OPC == OP65_LDY && CE_IsConstImm (P)) { + /* Get the code entry before this one. If it's a LDY, adjust the + * value. + */ + CodeEntry* P = CS_GetPrevEntry (D->Code, I); + if (P && P->OPC == OP65_LDY && CE_IsConstImm (P)) { - /* The Y load is just before the stack access, adjust it */ - CE_SetNumArg (P, P->Num - Offs); + /* The Y load is just before the stack access, adjust it */ + CE_SetNumArg (P, P->Num - Offs); - } else { + } else { - /* Insert a new load instruction before the stack access */ - const char* Arg = MakeHexArg (E->RI->In.RegY - Offs); - CodeEntry* X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); - InsertEntry (D, X, I++); + /* Insert a new load instruction before the stack access */ + const char* Arg = MakeHexArg (E->RI->In.RegY - Offs); + CodeEntry* X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); + InsertEntry (D, X, I++); - } + } /* If we need the value of Y later, be sure to reload it */ if (RegYUsed (D->Code, I+1)) { - const char* Arg = MakeHexArg (E->RI->In.RegY); - CodeEntry* X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); - InsertEntry (D, X, I+1); + const char* Arg = MakeHexArg (E->RI->In.RegY); + CodeEntry* X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, E->LI); + InsertEntry (D, X, I+1); - /* Skip this instruction in the next round */ - ++I; + /* Skip this instruction in the next round */ + ++I; } - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } /* If we have rhs load insns that load from stack, we'll have to adjust @@ -542,7 +542,7 @@ static void AddOpLow (StackOpData* D, opc_t OPC, LoadInfo* LI) CodeEntry* X; if ((LI->A.Flags & LI_DIRECT) != 0) { - /* Op with a variable location. If the location is on the stack, we + /* Op with a variable location. If the location is on the stack, we * need to reload the Y register. */ if ((LI->A.Flags & LI_RELOAD_Y) == 0) { @@ -570,8 +570,8 @@ static void AddOpLow (StackOpData* D, opc_t OPC, LoadInfo* LI) } else { - /* Op with temp storage */ - X = NewCodeEntry (OPC, AM65_ZP, D->ZPLo, 0, D->OpEntry->LI); + /* Op with temp storage */ + X = NewCodeEntry (OPC, AM65_ZP, D->ZPLo, 0, D->OpEntry->LI); InsertEntry (D, X, D->IP++); } @@ -588,9 +588,9 @@ static void AddOpHigh (StackOpData* D, opc_t OPC, LoadInfo* LI, int KeepResult) CodeEntry* X; if (KeepResult) { - /* pha */ - X = NewCodeEntry (OP65_PHA, AM65_IMP, 0, 0, D->OpEntry->LI); - InsertEntry (D, X, D->IP++); + /* pha */ + X = NewCodeEntry (OP65_PHA, AM65_IMP, 0, 0, D->OpEntry->LI); + InsertEntry (D, X, D->IP++); } /* txa */ @@ -603,7 +603,7 @@ static void AddOpHigh (StackOpData* D, opc_t OPC, LoadInfo* LI, int KeepResult) /* opc xxx */ CodeEntry* LoadX = LI->X.LoadEntry; - X = NewCodeEntry (OPC, LoadX->AM, LoadX->Arg, 0, D->OpEntry->LI); + X = NewCodeEntry (OPC, LoadX->AM, LoadX->Arg, 0, D->OpEntry->LI); InsertEntry (D, X, D->IP++); } else { @@ -628,13 +628,13 @@ static void AddOpHigh (StackOpData* D, opc_t OPC, LoadInfo* LI, int KeepResult) } if (KeepResult) { - /* tax */ - X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, D->OpEntry->LI); - InsertEntry (D, X, D->IP++); + /* tax */ + X = NewCodeEntry (OP65_TAX, AM65_IMP, 0, 0, D->OpEntry->LI); + InsertEntry (D, X, D->IP++); - /* pla */ - X = NewCodeEntry (OP65_PLA, AM65_IMP, 0, 0, D->OpEntry->LI); - InsertEntry (D, X, D->IP++); + /* pla */ + X = NewCodeEntry (OP65_PLA, AM65_IMP, 0, 0, D->OpEntry->LI); + InsertEntry (D, X, D->IP++); } } @@ -716,7 +716,7 @@ static int IsRegVar (StackOpData* D) /*****************************************************************************/ -/* Actual optimization functions */ +/* Actual optimization functions */ /*****************************************************************************/ @@ -791,15 +791,15 @@ static unsigned Opt_toseqax_tosneax (StackOpData* D, const char* BoolTransformer D->IP = D->OpIndex+1; - /* Add operand for low byte */ - AddOpLow (D, OP65_CMP, &D->Rhs); + /* Add operand for low byte */ + AddOpLow (D, OP65_CMP, &D->Rhs); /* bne L */ X = NewCodeEntry (OP65_BNE, AM65_BRA, L->Name, L, D->OpEntry->LI); InsertEntry (D, X, D->IP++); - /* Add operand for high byte */ - AddOpHigh (D, OP65_CMP, &D->Rhs, 0); + /* Add operand for high byte */ + AddOpHigh (D, OP65_CMP, &D->Rhs, 0); } else { @@ -945,7 +945,7 @@ static unsigned Opt___bzero (StackOpData* D) /* Loop using the sign bit */ /* ldy #count-1 */ - Arg = MakeHexArg (D->OpEntry->RI->In.RegA - 1); + Arg = MakeHexArg (D->OpEntry->RI->In.RegA - 1); X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, D->OpEntry->LI); InsertEntry (D, X, D->OpIndex+2); @@ -980,7 +980,7 @@ static unsigned Opt___bzero (StackOpData* D) InsertEntry (D, X, D->OpIndex+4); /* cpy #count */ - Arg = MakeHexArg (D->OpEntry->RI->In.RegA); + Arg = MakeHexArg (D->OpEntry->RI->In.RegA); X = NewCodeEntry (OP65_CPY, AM65_IMM, Arg, 0, D->OpEntry->LI); InsertEntry (D, X, D->OpIndex+5); @@ -1045,20 +1045,20 @@ static unsigned Opt_staxspidx (StackOpData* D) if (RegValIsKnown (D->OpEntry->RI->In.RegY)) { /* Value of Y is known */ - const char* Arg = MakeHexArg (D->OpEntry->RI->In.RegY + 1); - X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, D->OpEntry->LI); + const char* Arg = MakeHexArg (D->OpEntry->RI->In.RegY + 1); + X = NewCodeEntry (OP65_LDY, AM65_IMM, Arg, 0, D->OpEntry->LI); } else { X = NewCodeEntry (OP65_INY, AM65_IMP, 0, 0, D->OpEntry->LI); } InsertEntry (D, X, D->OpIndex+2); if (RegValIsKnown (D->OpEntry->RI->In.RegX)) { - /* Value of X is known */ - const char* Arg = MakeHexArg (D->OpEntry->RI->In.RegX); - X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, D->OpEntry->LI); + /* Value of X is known */ + const char* Arg = MakeHexArg (D->OpEntry->RI->In.RegX); + X = NewCodeEntry (OP65_LDA, AM65_IMM, Arg, 0, D->OpEntry->LI); } else { - /* Value unknown */ - X = NewCodeEntry (OP65_TXA, AM65_IMP, 0, 0, D->OpEntry->LI); + /* Value unknown */ + X = NewCodeEntry (OP65_TXA, AM65_IMP, 0, 0, D->OpEntry->LI); } InsertEntry (D, X, D->OpIndex+3); @@ -1175,9 +1175,9 @@ static unsigned Opt_tosaddax (StackOpData* D) X = NewCodeEntry (OP65_INX, AM65_IMP, 0, 0, D->OpEntry->LI); InsertEntry (D, X, D->IP++); - } else if (D->OpEntry->RI->In.RegX == 0 && - (RegValIsKnown (D->PushEntry->RI->In.RegX) || - (D->Lhs.X.Flags & LI_RELOAD_Y) == 0)) { + } else if (D->OpEntry->RI->In.RegX == 0 && + (RegValIsKnown (D->PushEntry->RI->In.RegX) || + (D->Lhs.X.Flags & LI_RELOAD_Y) == 0)) { /* The high byte is that of the first operand plus carry */ CodeLabel* L; @@ -1187,14 +1187,14 @@ static unsigned Opt_tosaddax (StackOpData* D) X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, D->OpEntry->LI); } else { /* Value of first op high byte is unknown. Load from ZP or - * original storage. - */ - if (D->Lhs.X.Flags & LI_DIRECT) { - CodeEntry* LoadX = D->Lhs.X.LoadEntry; - X = NewCodeEntry (OP65_LDX, LoadX->AM, LoadX->Arg, 0, D->OpEntry->LI); - } else { + * original storage. + */ + if (D->Lhs.X.Flags & LI_DIRECT) { + CodeEntry* LoadX = D->Lhs.X.LoadEntry; + X = NewCodeEntry (OP65_LDX, LoadX->AM, LoadX->Arg, 0, D->OpEntry->LI); + } else { X = NewCodeEntry (OP65_LDX, AM65_ZP, D->ZPHi, 0, D->OpEntry->LI); - } + } } InsertEntry (D, X, D->IP++); @@ -1623,12 +1623,12 @@ static unsigned Opt_tosxorax (StackOpData* D) /* High byte */ if (RegValIsKnown (D->PushEntry->RI->In.RegX) && RegValIsKnown (D->OpEntry->RI->In.RegX)) { - /* Both values known, precalculate the result */ - const char* Arg = MakeHexArg (D->PushEntry->RI->In.RegX ^ D->OpEntry->RI->In.RegX); - X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, D->OpEntry->LI); - InsertEntry (D, X, D->IP++); + /* Both values known, precalculate the result */ + const char* Arg = MakeHexArg (D->PushEntry->RI->In.RegX ^ D->OpEntry->RI->In.RegX); + X = NewCodeEntry (OP65_LDX, AM65_IMM, Arg, 0, D->OpEntry->LI); + InsertEntry (D, X, D->IP++); } else if (D->PushEntry->RI->In.RegX != 0) { - /* High byte is unknown */ + /* High byte is unknown */ AddOpHigh (D, OP65_EOR, &D->Lhs, 1); } @@ -1642,7 +1642,7 @@ static unsigned Opt_tosxorax (StackOpData* D) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -1676,7 +1676,7 @@ static const OptFuncDesc FuncTable[] = { static int CmpFunc (const void* Key, const void* Func) /* Compare function for bsearch */ { - return strcmp (Key, ((const OptFuncDesc*) Func)->Name); + return strcmp (Key, ((const OptFuncDesc*) Func)->Name); } @@ -1847,7 +1847,7 @@ static int PreCondOk (StackOpData* D) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -1892,8 +1892,8 @@ unsigned OptStackOps (CodeSeg* S) I = 0; while (I < (int)CS_GetEntryCount (S)) { - /* Get the next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get the next entry */ + CodeEntry* E = CS_GetEntry (S, I); /* Actions depend on state */ switch (State) { @@ -2062,10 +2062,10 @@ unsigned OptStackOps (CodeSeg* S) State = Initialize; continue; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptstop.h b/src/cc65/coptstop.h index 786158e32..8abc25ece 100644 --- a/src/cc65/coptstop.h +++ b/src/cc65/coptstop.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptstop.h */ +/* coptstop.h */ /* */ -/* Optimize operations that take operands via the stack */ +/* Optimize operations that take operands via the stack */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/coptstore.c b/src/cc65/coptstore.c index 03d8ab32f..ea304e15d 100644 --- a/src/cc65/coptstore.c +++ b/src/cc65/coptstore.c @@ -41,7 +41,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -71,32 +71,32 @@ unsigned OptStore1 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[4]; + CodeEntry* L[4]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); /* Check for the sequence */ if (L[0]->OPC == OP65_LDY && - CE_IsConstImm (L[0]) && + CE_IsConstImm (L[0]) && L[0]->Num < 0xFF && - !CS_RangeHasLabel (S, I+1, 3) && - CS_GetEntries (S, L+1, I+1, 3) && + !CS_RangeHasLabel (S, I+1, 3) && + CS_GetEntries (S, L+1, I+1, 3) && CE_IsCallTo (L[1], "staxysp") && L[2]->OPC == OP65_LDY && CE_IsKnownImm (L[2], L[0]->Num + 1) && CE_IsCallTo (L[3], "ldaxysp")) { - /* Register has already the correct value, remove the loads */ - CS_DelEntries (S, I+2, 2); + /* Register has already the correct value, remove the loads */ + CS_DelEntries (S, I+2, 2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -119,14 +119,14 @@ unsigned OptStore2 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); /* Get the input registers */ const RegInfo* RI = E->RI; - /* Check for the call */ - if (CE_IsCallTo (E, "staxysp") && + /* Check for the call */ + if (CE_IsCallTo (E, "staxysp") && RegValIsKnown (RI->In.RegA) && RegValIsKnown (RI->In.RegX) && RegValIsKnown (RI->In.RegY) && @@ -160,13 +160,13 @@ unsigned OptStore2 (CodeSeg* S) /* Remove the call */ CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -189,14 +189,14 @@ unsigned OptStore3 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); /* Get the input registers */ const RegInfo* RI = E->RI; - /* Check for the call */ - if (CE_IsCallTo (E, "steaxysp") && + /* Check for the call */ + if (CE_IsCallTo (E, "steaxysp") && RegValIsKnown (RI->In.RegA) && RegValIsKnown (RI->In.RegX) && RegValIsKnown (RI->In.RegY) && @@ -299,13 +299,13 @@ unsigned OptStore3 (CodeSeg* S) /* Remove the call */ CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -333,16 +333,16 @@ unsigned OptStore4 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[5]; + CodeEntry* L[5]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); /* Check for the sequence */ if (L[0]->OPC == OP65_STA && (L[0]->AM == AM65_ABS || L[0]->AM == AM65_ZP) && - !CS_RangeHasLabel (S, I+1, 3) && - CS_GetEntries (S, L+1, I+1, 4) && + !CS_RangeHasLabel (S, I+1, 3) && + CS_GetEntries (S, L+1, I+1, 4) && L[1]->OPC == OP65_STX && L[1]->AM == L[0]->AM && L[2]->OPC == OP65_LDA && @@ -353,16 +353,16 @@ unsigned OptStore4 (CodeSeg* S) strcmp (L[1]->Arg, L[3]->Arg) == 0 && !CE_UseLoadFlags (L[4])) { - /* Register has already the correct value, remove the loads */ - CS_DelEntries (S, I+2, 2); + /* Register has already the correct value, remove the loads */ + CS_DelEntries (S, I+2, 2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -397,15 +397,15 @@ unsigned OptStore5 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[4]; + CodeEntry* L[4]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); /* Check for the sequence */ if (L[0]->OPC == OP65_LDA && - !CS_RangeHasLabel (S, I+1, 3) && - CS_GetEntries (S, L+1, I+1, 3) && + !CS_RangeHasLabel (S, I+1, 3) && + CS_GetEntries (S, L+1, I+1, 3) && L[1]->OPC == OP65_LDX && L[2]->OPC == OP65_STA && L[3]->OPC == OP65_STX && @@ -414,21 +414,21 @@ unsigned OptStore5 (CodeSeg* S) CodeEntry* X; /* Insert the code after the sequence */ - X = NewCodeEntry (OP65_LDA, L[1]->AM, L[1]->Arg, 0, L[1]->LI); - CS_InsertEntry (S, X, I+4); - X = NewCodeEntry (OP65_STA, L[3]->AM, L[3]->Arg, 0, L[3]->LI); - CS_InsertEntry (S, X, I+5); + X = NewCodeEntry (OP65_LDA, L[1]->AM, L[1]->Arg, 0, L[1]->LI); + CS_InsertEntry (S, X, I+4); + X = NewCodeEntry (OP65_STA, L[3]->AM, L[3]->Arg, 0, L[3]->LI); + CS_InsertEntry (S, X, I+5); - /* Delete the old code */ + /* Delete the old code */ CS_DelEntry (S, I+3); - CS_DelEntry (S, I+1); + CS_DelEntry (S, I+1); - /* Remember, we had changes */ - ++Changes; - } + /* Remember, we had changes */ + ++Changes; + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptstore.h b/src/cc65/coptstore.h index b6ac18353..0785566e0 100644 --- a/src/cc65/coptstore.h +++ b/src/cc65/coptstore.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/coptsub.c b/src/cc65/coptsub.c index 5449889f6..fdb167684 100644 --- a/src/cc65/coptsub.c +++ b/src/cc65/coptsub.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptsub.c */ +/* coptsub.c */ /* */ -/* Optimize subtraction sequences */ +/* Optimize subtraction sequences */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Optimize subtractions */ +/* Optimize subtractions */ /*****************************************************************************/ @@ -52,9 +52,9 @@ unsigned OptSub1 (CodeSeg* S) /* Search for the sequence * - * sbc ... + * sbc ... * bcs L - * dex + * dex * L: * * and remove the handling of the high byte if X is not used later. @@ -66,32 +66,32 @@ unsigned OptSub1 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[3]; + CodeEntry* L[3]; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_SBC && - CS_GetEntries (S, L, I+1, 3) && - (L[0]->OPC == OP65_BCS || L[0]->OPC == OP65_JCS) && - L[0]->JumpTo != 0 && - !CE_HasLabel (L[0]) && - L[1]->OPC == OP65_DEX && - !CE_HasLabel (L[1]) && - L[0]->JumpTo->Owner == L[2] && - !RegXUsed (S, I+3)) { + /* Check for the sequence */ + if (E->OPC == OP65_SBC && + CS_GetEntries (S, L, I+1, 3) && + (L[0]->OPC == OP65_BCS || L[0]->OPC == OP65_JCS) && + L[0]->JumpTo != 0 && + !CE_HasLabel (L[0]) && + L[1]->OPC == OP65_DEX && + !CE_HasLabel (L[1]) && + L[0]->JumpTo->Owner == L[2] && + !RegXUsed (S, I+3)) { - /* Remove the bcs/dex */ - CS_DelEntries (S, I+1, 2); + /* Remove the bcs/dex */ + CS_DelEntries (S, I+1, 2); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -104,9 +104,9 @@ unsigned OptSub1 (CodeSeg* S) unsigned OptSub2 (CodeSeg* S) /* Search for the sequence * - * lda xx + * lda xx * sec - * sta tmp1 + * sta tmp1 * lda yy * sbc tmp1 * sta yy @@ -115,7 +115,7 @@ unsigned OptSub2 (CodeSeg* S) * * sec * lda yy - * sbc xx + * sbc xx * sta yy */ { @@ -125,50 +125,50 @@ unsigned OptSub2 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[5]; + CodeEntry* L[5]; - /* Get next entry */ - CodeEntry* E = CS_GetEntry (S, I); + /* Get next entry */ + CodeEntry* E = CS_GetEntry (S, I); - /* Check for the sequence */ - if (E->OPC == OP65_LDA && - !CS_RangeHasLabel (S, I+1, 5) && - CS_GetEntries (S, L, I+1, 5) && - L[0]->OPC == OP65_SEC && - L[1]->OPC == OP65_STA && - strcmp (L[1]->Arg, "tmp1") == 0 && - L[2]->OPC == OP65_LDA && - L[3]->OPC == OP65_SBC && - strcmp (L[3]->Arg, "tmp1") == 0 && - L[4]->OPC == OP65_STA && - strcmp (L[4]->Arg, L[2]->Arg) == 0) { + /* Check for the sequence */ + if (E->OPC == OP65_LDA && + !CS_RangeHasLabel (S, I+1, 5) && + CS_GetEntries (S, L, I+1, 5) && + L[0]->OPC == OP65_SEC && + L[1]->OPC == OP65_STA && + strcmp (L[1]->Arg, "tmp1") == 0 && + L[2]->OPC == OP65_LDA && + L[3]->OPC == OP65_SBC && + strcmp (L[3]->Arg, "tmp1") == 0 && + L[4]->OPC == OP65_STA && + strcmp (L[4]->Arg, L[2]->Arg) == 0) { - /* Remove the store to tmp1 */ - CS_DelEntry (S, I+2); + /* Remove the store to tmp1 */ + CS_DelEntry (S, I+2); - /* Remove the subtraction */ - CS_DelEntry (S, I+3); + /* Remove the subtraction */ + CS_DelEntry (S, I+3); - /* Move the lda to the position of the subtraction and change the - * op to SBC. - */ - CS_MoveEntry (S, I, I+3); - CE_ReplaceOPC (E, OP65_SBC); + /* Move the lda to the position of the subtraction and change the + * op to SBC. + */ + CS_MoveEntry (S, I, I+3); + CE_ReplaceOPC (E, OP65_SBC); - /* If the sequence head had a label, move this label back to the - * head. - */ - if (CE_HasLabel (E)) { - CS_MoveLabels (S, E, L[0]); - } + /* If the sequence head had a label, move this label back to the + * head. + */ + if (CE_HasLabel (E)) { + CS_MoveLabels (S, E, L[0]); + } - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -189,12 +189,12 @@ unsigned OptSub3 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* E; + CodeEntry* E; - /* Get next entry */ - E = CS_GetEntry (S, I); + /* Get next entry */ + E = CS_GetEntry (S, I); - /* Check for the sequence */ + /* Check for the sequence */ if (E->OPC == OP65_JSR && strncmp (E->Arg, "decax", 5) == 0 && IsDigit (E->Arg[5]) && @@ -205,23 +205,23 @@ unsigned OptSub3 (CodeSeg* S) const char* Arg; /* Insert new code behind the sequence */ - X = NewCodeEntry (OP65_SEC, AM65_IMP, 0, 0, E->LI); - CS_InsertEntry (S, X, I+1); + X = NewCodeEntry (OP65_SEC, AM65_IMP, 0, 0, E->LI); + CS_InsertEntry (S, X, I+1); - Arg = MakeHexArg (E->Arg[5] - '0'); - X = NewCodeEntry (OP65_SBC, AM65_IMM, Arg, 0, E->LI); - CS_InsertEntry (S, X, I+2); + Arg = MakeHexArg (E->Arg[5] - '0'); + X = NewCodeEntry (OP65_SBC, AM65_IMM, Arg, 0, E->LI); + CS_InsertEntry (S, X, I+2); - /* Delete the old code */ - CS_DelEntry (S, I); + /* Delete the old code */ + CS_DelEntry (S, I); - /* Remember, we had changes */ - ++Changes; + /* Remember, we had changes */ + ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/coptsub.h b/src/cc65/coptsub.h index 828a1d417..c8249bdb2 100644 --- a/src/cc65/coptsub.h +++ b/src/cc65/coptsub.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coptsub.h */ +/* coptsub.h */ /* */ -/* Optimize subtraction sequences */ +/* Optimize subtraction sequences */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Optimize subtractions */ +/* Optimize subtractions */ /*****************************************************************************/ @@ -52,9 +52,9 @@ unsigned OptSub1 (CodeSeg* S); /* Search for the sequence * - * sbc ... + * sbc ... * bcs L - * dex + * dex * L: * * and remove the handling of the high byte if X is not used later. @@ -63,9 +63,9 @@ unsigned OptSub1 (CodeSeg* S); unsigned OptSub2 (CodeSeg* S); /* Search for the sequence * - * lda xx + * lda xx * sec - * sta tmp1 + * sta tmp1 * lda yy * sbc tmp1 * sta yy @@ -74,7 +74,7 @@ unsigned OptSub2 (CodeSeg* S); * * sec * lda yy - * sbc xx + * sbc xx * sta yy */ diff --git a/src/cc65/copttest.c b/src/cc65/copttest.c index 89ca80760..91ebdc7ad 100644 --- a/src/cc65/copttest.c +++ b/src/cc65/copttest.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* copttest.c */ +/* copttest.c */ /* */ -/* Optimize test sequences */ +/* Optimize test sequences */ /* */ /* */ /* */ @@ -41,7 +41,7 @@ /*****************************************************************************/ -/* Optimize tests */ +/* Optimize tests */ /*****************************************************************************/ @@ -74,52 +74,52 @@ unsigned OptTest1 (CodeSeg* S) I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[3]; + CodeEntry* L[3]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check if it's the sequence we're searching for */ - if (L[0]->OPC == OP65_STX && - CS_GetEntries (S, L+1, I+1, 2) && - !CE_HasLabel (L[1]) && - L[1]->OPC == OP65_ORA && - strcmp (L[0]->Arg, L[1]->Arg) == 0 && - !CE_HasLabel (L[2]) && - (L[2]->Info & OF_ZBRA) != 0) { + /* Check if it's the sequence we're searching for */ + if (L[0]->OPC == OP65_STX && + CS_GetEntries (S, L+1, I+1, 2) && + !CE_HasLabel (L[1]) && + L[1]->OPC == OP65_ORA && + strcmp (L[0]->Arg, L[1]->Arg) == 0 && + !CE_HasLabel (L[2]) && + (L[2]->Info & OF_ZBRA) != 0) { - /* Check if X is zero */ - if (L[0]->RI->In.RegX == 0) { + /* Check if X is zero */ + if (L[0]->RI->In.RegX == 0) { - /* Insert the compare */ - CodeEntry* N = NewCodeEntry (OP65_CMP, AM65_IMM, "$00", 0, L[0]->LI); - CS_InsertEntry (S, N, I+2); + /* Insert the compare */ + CodeEntry* N = NewCodeEntry (OP65_CMP, AM65_IMM, "$00", 0, L[0]->LI); + CS_InsertEntry (S, N, I+2); - /* Remove the two other insns */ - CS_DelEntry (S, I+1); - CS_DelEntry (S, I); + /* Remove the two other insns */ + CS_DelEntry (S, I+1); + CS_DelEntry (S, I); - /* We had changes */ - ++Changes; + /* We had changes */ + ++Changes; - /* Check if A is zero */ - } else if (L[1]->RI->In.RegA == 0) { + /* Check if A is zero */ + } else if (L[1]->RI->In.RegA == 0) { - /* Insert the txa */ - CodeEntry* N = NewCodeEntry (OP65_TXA, AM65_IMP, 0, 0, L[1]->LI); - CS_InsertEntry (S, N, I+2); + /* Insert the txa */ + CodeEntry* N = NewCodeEntry (OP65_TXA, AM65_IMP, 0, 0, L[1]->LI); + CS_InsertEntry (S, N, I+2); - /* Remove the two other insns */ - CS_DelEntry (S, I+1); - CS_DelEntry (S, I); + /* Remove the two other insns */ + CS_DelEntry (S, I+1); + CS_DelEntry (S, I); - /* We had changes */ - ++Changes; - } - } + /* We had changes */ + ++Changes; + } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } @@ -141,28 +141,28 @@ unsigned OptTest2 (CodeSeg* S) unsigned I = 0; while (I < CS_GetEntryCount (S)) { - CodeEntry* L[3]; + CodeEntry* L[3]; - /* Get next entry */ - L[0] = CS_GetEntry (S, I); + /* Get next entry */ + L[0] = CS_GetEntry (S, I); - /* Check if it's the sequence we're searching for */ - if ((L[0]->OPC == OP65_INC || L[0]->OPC == OP65_DEC) && - CS_GetEntries (S, L+1, I+1, 2) && - !CE_HasLabel (L[1]) && - (L[1]->Info & OF_LOAD) != 0 && + /* Check if it's the sequence we're searching for */ + if ((L[0]->OPC == OP65_INC || L[0]->OPC == OP65_DEC) && + CS_GetEntries (S, L+1, I+1, 2) && + !CE_HasLabel (L[1]) && + (L[1]->Info & OF_LOAD) != 0 && (L[2]->Info & OF_FBRA) != 0 && L[1]->AM == L[0]->AM && - strcmp (L[0]->Arg, L[1]->Arg) == 0 && + strcmp (L[0]->Arg, L[1]->Arg) == 0 && (GetRegInfo (S, I+2, L[1]->Chg) & L[1]->Chg) == 0) { /* Remove the load */ CS_DelEntry (S, I+1); ++Changes; - } + } - /* Next entry */ - ++I; + /* Next entry */ + ++I; } diff --git a/src/cc65/copttest.h b/src/cc65/copttest.h index e6e409e89..f6af1da32 100644 --- a/src/cc65/copttest.h +++ b/src/cc65/copttest.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* copttest.h */ +/* copttest.h */ /* */ -/* Optimize test sequences */ +/* Optimize test sequences */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Optimize tests */ +/* Optimize tests */ /*****************************************************************************/ diff --git a/src/cc65/dataseg.c b/src/cc65/dataseg.c index ebb033cbc..c19791e9e 100644 --- a/src/cc65/dataseg.c +++ b/src/cc65/dataseg.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* dataseg.c */ +/* dataseg.c */ /* */ -/* Data segment structure */ +/* Data segment structure */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -55,11 +55,11 @@ DataSeg* NewDataSeg (const char* Name, SymEntry* Func) /* Create a new data segment, initialize and return it */ { /* Allocate memory */ - DataSeg* S = xmalloc (sizeof (DataSeg)); + DataSeg* S = xmalloc (sizeof (DataSeg)); /* Initialize the fields */ - S->SegName = xstrdup (Name); - S->Func = Func; + S->SegName = xstrdup (Name); + S->Func = Func; InitCollection (&S->Lines); /* Return the new struct */ @@ -76,7 +76,7 @@ void DS_Append (DataSeg* Target, const DataSeg* Source) /* Append all lines from Source to Target */ unsigned Count = CollCount (&Source->Lines); for (I = 0; I < Count; ++I) { - CollAppend (&Target->Lines, xstrdup (CollConstAt (&Source->Lines, I))); + CollAppend (&Target->Lines, xstrdup (CollConstAt (&Source->Lines, I))); } } @@ -116,7 +116,7 @@ void DS_Output (const DataSeg* S) /* If the segment is actually empty, bail out */ if (Count == 0) { - return; + return; } /* Output the segment directive */ @@ -124,7 +124,7 @@ void DS_Output (const DataSeg* S) /* Output all entries */ for (I = 0; I < Count; ++I) { - WriteOutput ("%s\n", (const char*) CollConstAt (&S->Lines, I)); + WriteOutput ("%s\n", (const char*) CollConstAt (&S->Lines, I)); } /* Add an additional newline after the segment output */ diff --git a/src/cc65/dataseg.h b/src/cc65/dataseg.h index dab06e893..c822120a8 100644 --- a/src/cc65/dataseg.h +++ b/src/cc65/dataseg.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* dataseg.h */ +/* dataseg.h */ /* */ -/* Data segment structure */ +/* Data segment structure */ /* */ /* */ /* */ @@ -50,22 +50,22 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ typedef struct DataSeg DataSeg; struct DataSeg { - char* SegName; /* Segment name */ - SymEntry* Func; /* Owner function */ - Collection Lines; /* List of code lines */ + char* SegName; /* Segment name */ + SymEntry* Func; /* Owner function */ + Collection Lines; /* List of code lines */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/datatype.c b/src/cc65/datatype.c index c1f86062f..88ec9ead6 100644 --- a/src/cc65/datatype.c +++ b/src/cc65/datatype.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* datatype.c */ +/* datatype.c */ /* */ -/* Type string handling for the cc65 C compiler */ +/* Type string handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -53,7 +53,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -73,7 +73,7 @@ Type type_double[] = { TYPE(T_DOUBLE), TYPE(T_END) }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -83,7 +83,7 @@ unsigned TypeLen (const Type* T) { const Type* Start = T; while (T->C != T_END) { - ++T; + ++T; } return T - Start; } @@ -95,11 +95,11 @@ Type* TypeCopy (Type* Dest, const Type* Src) { Type* Orig = Dest; while (1) { - *Dest = *Src; + *Dest = *Src; if (Src->C == T_END) { break; } - Src++; + Src++; Dest++; } return Orig; @@ -138,9 +138,9 @@ int SignExtendChar (int C) /* Do correct sign extension of a character */ { if (IS_Get (&SignedChars) && (C & 0x80) != 0) { - return C | ~0xFF; + return C | ~0xFF; } else { - return C & 0xFF; + return C & 0xFF; } } @@ -207,7 +207,7 @@ Type* PointerTo (const Type* T) unsigned Size = TypeLen (T) + 1; /* Allocate the new type string */ - Type* P = TypeAlloc (Size + 1); + Type* P = TypeAlloc (Size + 1); /* Create the return type... */ P[0].C = T_PTR | (T[0].C & T_QUAL_ADDRSIZE); @@ -225,8 +225,8 @@ static TypeCode PrintTypeComp (FILE* F, TypeCode C, TypeCode Mask, const char* N */ { if ((C & Mask) == Mask) { - fprintf (F, "%s ", Name); - C &= ~Mask; + fprintf (F, "%s ", Name); + C &= ~Mask; } return C; } @@ -242,73 +242,73 @@ void PrintType (FILE* F, const Type* T) /* Get the type code */ TypeCode C = T->C; - /* Print any qualifiers */ - C = PrintTypeComp (F, C, T_QUAL_CONST, "const"); - C = PrintTypeComp (F, C, T_QUAL_VOLATILE, "volatile"); + /* Print any qualifiers */ + C = PrintTypeComp (F, C, T_QUAL_CONST, "const"); + C = PrintTypeComp (F, C, T_QUAL_VOLATILE, "volatile"); C = PrintTypeComp (F, C, T_QUAL_RESTRICT, "restrict"); C = PrintTypeComp (F, C, T_QUAL_NEAR, "__near__"); C = PrintTypeComp (F, C, T_QUAL_FAR, "__far__"); C = PrintTypeComp (F, C, T_QUAL_FASTCALL, "__fastcall__"); C = PrintTypeComp (F, C, T_QUAL_CDECL, "__cdecl__"); - /* Signedness. Omit the signedness specifier for long and int */ - if ((C & T_MASK_TYPE) != T_TYPE_INT && (C & T_MASK_TYPE) != T_TYPE_LONG) { - C = PrintTypeComp (F, C, T_SIGN_SIGNED, "signed"); - } - C = PrintTypeComp (F, C, T_SIGN_UNSIGNED, "unsigned"); + /* Signedness. Omit the signedness specifier for long and int */ + if ((C & T_MASK_TYPE) != T_TYPE_INT && (C & T_MASK_TYPE) != T_TYPE_LONG) { + C = PrintTypeComp (F, C, T_SIGN_SIGNED, "signed"); + } + C = PrintTypeComp (F, C, T_SIGN_UNSIGNED, "unsigned"); - /* Now check the real type */ - switch (C & T_MASK_TYPE) { - case T_TYPE_CHAR: - fprintf (F, "char"); - break; - case T_TYPE_SHORT: - fprintf (F, "short"); - break; - case T_TYPE_INT: - fprintf (F, "int"); - break; - case T_TYPE_LONG: - fprintf (F, "long"); - break; - case T_TYPE_LONGLONG: - fprintf (F, "long long"); - break; - case T_TYPE_FLOAT: - fprintf (F, "float"); - break; - case T_TYPE_DOUBLE: - fprintf (F, "double"); - break; - case T_TYPE_VOID: - fprintf (F, "void"); - break; - case T_TYPE_STRUCT: - fprintf (F, "struct %s", ((SymEntry*) T->A.P)->Name); - break; - case T_TYPE_UNION: - fprintf (F, "union %s", ((SymEntry*) T->A.P)->Name); - break; - case T_TYPE_ARRAY: - /* Recursive call */ - PrintType (F, T + 1); - if (T->A.L == UNSPECIFIED) { - fprintf (F, "[]"); - } else { - fprintf (F, "[%ld]", T->A.L); - } - return; - case T_TYPE_PTR: - /* Recursive call */ - PrintType (F, T + 1); - fprintf (F, "*"); - return; - case T_TYPE_FUNC: - fprintf (F, "function returning "); - break; - default: - fprintf (F, "unknown type: %04lX", T->C); - } + /* Now check the real type */ + switch (C & T_MASK_TYPE) { + case T_TYPE_CHAR: + fprintf (F, "char"); + break; + case T_TYPE_SHORT: + fprintf (F, "short"); + break; + case T_TYPE_INT: + fprintf (F, "int"); + break; + case T_TYPE_LONG: + fprintf (F, "long"); + break; + case T_TYPE_LONGLONG: + fprintf (F, "long long"); + break; + case T_TYPE_FLOAT: + fprintf (F, "float"); + break; + case T_TYPE_DOUBLE: + fprintf (F, "double"); + break; + case T_TYPE_VOID: + fprintf (F, "void"); + break; + case T_TYPE_STRUCT: + fprintf (F, "struct %s", ((SymEntry*) T->A.P)->Name); + break; + case T_TYPE_UNION: + fprintf (F, "union %s", ((SymEntry*) T->A.P)->Name); + break; + case T_TYPE_ARRAY: + /* Recursive call */ + PrintType (F, T + 1); + if (T->A.L == UNSPECIFIED) { + fprintf (F, "[]"); + } else { + fprintf (F, "[%ld]", T->A.L); + } + return; + case T_TYPE_PTR: + /* Recursive call */ + PrintType (F, T + 1); + fprintf (F, "*"); + return; + case T_TYPE_FUNC: + fprintf (F, "function returning "); + break; + default: + fprintf (F, "unknown type: %04lX", T->C); + } /* Next element */ ++T; @@ -332,29 +332,29 @@ void PrintFuncSig (FILE* F, const char* Name, Type* T) fprintf (F, " __far__"); } if (IsQualFastcall (T)) { - fprintf (F, " __fastcall__"); + fprintf (F, " __fastcall__"); } if (IsQualCDecl (T)) { - fprintf (F, " __cdecl__"); + fprintf (F, " __cdecl__"); } fprintf (F, " %s (", Name); /* Parameters */ if (D->Flags & FD_VOID_PARAM) { - fprintf (F, "void"); + fprintf (F, "void"); } else { - unsigned I; - SymEntry* E = D->SymTab->SymHead; - for (I = 0; I < D->ParamCount; ++I) { - if (I > 0) { - fprintf (F, ", "); - } + unsigned I; + SymEntry* E = D->SymTab->SymHead; + for (I = 0; I < D->ParamCount; ++I) { + if (I > 0) { + fprintf (F, ", "); + } if (SymIsRegVar (E)) { fprintf (F, "register "); } - PrintType (F, E->Type); - E = E->NextSym; - } + PrintType (F, E->Type); + E = E->NextSym; + } } /* End of parameter list */ @@ -367,7 +367,7 @@ void PrintRawType (FILE* F, const Type* T) /* Print a type string in raw format (for debugging) */ { while (T->C != T_END) { - fprintf (F, "%04lX ", T->C); + fprintf (F, "%04lX ", T->C); ++T; } fprintf (F, "\n"); @@ -388,57 +388,57 @@ unsigned SizeOf (const Type* T) { switch (UnqualifiedType (T->C)) { - case T_VOID: - return 0; /* Assume voids have size zero */ + case T_VOID: + return 0; /* Assume voids have size zero */ - case T_SCHAR: - case T_UCHAR: - return SIZEOF_CHAR; + case T_SCHAR: + case T_UCHAR: + return SIZEOF_CHAR; - case T_SHORT: - case T_USHORT: + case T_SHORT: + case T_USHORT: return SIZEOF_SHORT; - case T_INT: - case T_UINT: + case T_INT: + case T_UINT: return SIZEOF_INT; - case T_PTR: - case T_FUNC: /* Maybe pointer to function */ - return SIZEOF_PTR; + case T_PTR: + case T_FUNC: /* Maybe pointer to function */ + return SIZEOF_PTR; case T_LONG: - case T_ULONG: - return SIZEOF_LONG; + case T_ULONG: + return SIZEOF_LONG; - case T_LONGLONG: - case T_ULONGLONG: - return SIZEOF_LONGLONG; + case T_LONGLONG: + case T_ULONGLONG: + return SIZEOF_LONGLONG; case T_ENUM: - return SIZEOF_INT; + return SIZEOF_INT; - case T_FLOAT: + case T_FLOAT: return SIZEOF_FLOAT; - case T_DOUBLE: - return SIZEOF_DOUBLE; + case T_DOUBLE: + return SIZEOF_DOUBLE; - case T_STRUCT: - case T_UNION: + case T_STRUCT: + case T_UNION: return ((SymEntry*) T->A.P)->V.S.Size; - case T_ARRAY: + case T_ARRAY: if (T->A.L == UNSPECIFIED) { /* Array with unspecified size */ return 0; } else { - return T->A.L * SizeOf (T + 1); + return T->A.L * SizeOf (T + 1); } - default: - Internal ("Unknown type in SizeOf: %04lX", T->C); - return 0; + default: + Internal ("Unknown type in SizeOf: %04lX", T->C); + return 0; } } @@ -494,28 +494,28 @@ unsigned TypeOf (const Type* T) { switch (UnqualifiedType (T->C)) { - case T_SCHAR: - return CF_CHAR; + case T_SCHAR: + return CF_CHAR; - case T_UCHAR: - return CF_CHAR | CF_UNSIGNED; + case T_UCHAR: + return CF_CHAR | CF_UNSIGNED; - case T_SHORT: - case T_INT: + case T_SHORT: + case T_INT: case T_ENUM: - return CF_INT; + return CF_INT; - case T_USHORT: - case T_UINT: - case T_PTR: - case T_ARRAY: - return CF_INT | CF_UNSIGNED; + case T_USHORT: + case T_UINT: + case T_PTR: + case T_ARRAY: + return CF_INT | CF_UNSIGNED; case T_LONG: - return CF_LONG; + return CF_LONG; - case T_ULONG: - return CF_LONG | CF_UNSIGNED; + case T_ULONG: + return CF_LONG | CF_UNSIGNED; case T_FLOAT: case T_DOUBLE: @@ -523,16 +523,16 @@ unsigned TypeOf (const Type* T) return CF_FLOAT; case T_FUNC: - return (((FuncDesc*) T->A.P)->Flags & FD_VARIADIC)? 0 : CF_FIXARGC; + return (((FuncDesc*) T->A.P)->Flags & FD_VARIADIC)? 0 : CF_FIXARGC; case T_STRUCT: case T_UNION: - /* Address of ... */ - return CF_INT | CF_UNSIGNED; + /* Address of ... */ + return CF_INT | CF_UNSIGNED; - default: - Error ("Illegal type %04lX", T->C); - return CF_INT; + default: + Error ("Illegal type %04lX", T->C); + return CF_INT; } } @@ -576,8 +576,8 @@ FuncDesc* GetFuncDesc (const Type* T) /* Get the FuncDesc pointer from a function or pointer-to-function type */ { if (UnqualifiedType (T->C) == T_PTR) { - /* Pointer to function */ - ++T; + /* Pointer to function */ + ++T; } /* Be sure it's a function type */ @@ -593,8 +593,8 @@ void SetFuncDesc (Type* T, FuncDesc* F) /* Set the FuncDesc pointer in a function or pointer-to-function type */ { if (UnqualifiedType (T->C) == T_PTR) { - /* Pointer to function */ - ++T; + /* Pointer to function */ + ++T; } /* Be sure it's a function type */ @@ -610,8 +610,8 @@ Type* GetFuncReturn (Type* T) /* Return a pointer to the return type of a function or pointer-to-function type */ { if (UnqualifiedType (T->C) == T_PTR) { - /* Pointer to function */ - ++T; + /* Pointer to function */ + ++T; } /* Be sure it's a function type */ @@ -719,7 +719,7 @@ Type* PtrConversion (Type* T) */ { if (IsTypeFunc (T)) { - return PointerTo (T); + return PointerTo (T); } else if (IsTypeArray (T)) { return ArrayToPtr (T); } else { diff --git a/src/cc65/datatype.h b/src/cc65/datatype.h index 3cc6ec5b5..b49694da3 100644 --- a/src/cc65/datatype.h +++ b/src/cc65/datatype.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* datatype.h */ +/* datatype.h */ /* */ -/* Type string handling for the cc65 C compiler */ +/* Type string handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -51,7 +51,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -59,16 +59,16 @@ /* Basic data types */ enum { - T_END = 0x000000, + T_END = 0x000000, /* Basic types */ - T_TYPE_NONE = 0x000000, - T_TYPE_CHAR = 0x000001, + T_TYPE_NONE = 0x000000, + T_TYPE_CHAR = 0x000001, T_TYPE_SHORT = 0x000002, - T_TYPE_INT = 0x000003, - T_TYPE_LONG = 0x000004, + T_TYPE_INT = 0x000003, + T_TYPE_LONG = 0x000004, T_TYPE_LONGLONG = 0x000005, - T_TYPE_ENUM = 0x000006, + T_TYPE_ENUM = 0x000006, T_TYPE_FLOAT = 0x000007, T_TYPE_DOUBLE = 0x000008, T_TYPE_VOID = 0x000009, @@ -77,29 +77,29 @@ enum { T_TYPE_ARRAY = 0x00000C, T_TYPE_PTR = 0x00000D, T_TYPE_FUNC = 0x00000E, - T_MASK_TYPE = 0x00000F, + T_MASK_TYPE = 0x00000F, /* Type classes */ T_CLASS_NONE = 0x000000, - T_CLASS_INT = 0x000010, + T_CLASS_INT = 0x000010, T_CLASS_FLOAT = 0x000020, - T_CLASS_PTR = 0x000030, + T_CLASS_PTR = 0x000030, T_CLASS_STRUCT = 0x000040, T_CLASS_FUNC = 0x000050, T_MASK_CLASS = 0x000070, /* Type signedness */ - T_SIGN_NONE = 0x000000, + T_SIGN_NONE = 0x000000, T_SIGN_UNSIGNED = 0x000080, T_SIGN_SIGNED = 0x000100, T_MASK_SIGN = 0x000180, /* Type size modifiers */ - T_SIZE_NONE = 0x000000, + T_SIZE_NONE = 0x000000, T_SIZE_SHORT = 0x000200, T_SIZE_LONG = 0x000400, T_SIZE_LONGLONG = 0x000600, - T_MASK_SIZE = 0x000600, + T_MASK_SIZE = 0x000600, /* Type qualifiers */ T_QUAL_NONE = 0x000000, @@ -112,29 +112,29 @@ enum { T_QUAL_FASTCALL = 0x010000, T_QUAL_CDECL = 0x020000, T_QUAL_CCONV = T_QUAL_FASTCALL | T_QUAL_CDECL, - T_MASK_QUAL = 0x03F800, + T_MASK_QUAL = 0x03F800, /* Types */ - T_CHAR = T_TYPE_CHAR | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_NONE, - T_SCHAR = T_TYPE_CHAR | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_NONE, - T_UCHAR = T_TYPE_CHAR | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_NONE, - T_SHORT = T_TYPE_SHORT | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_SHORT, + T_CHAR = T_TYPE_CHAR | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_NONE, + T_SCHAR = T_TYPE_CHAR | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_NONE, + T_UCHAR = T_TYPE_CHAR | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_NONE, + T_SHORT = T_TYPE_SHORT | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_SHORT, T_USHORT = T_TYPE_SHORT | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_SHORT, - T_INT = T_TYPE_INT | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_NONE, - T_UINT = T_TYPE_INT | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_NONE, - T_LONG = T_TYPE_LONG | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_LONG, - T_ULONG = T_TYPE_LONG | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_LONG, - T_LONGLONG = T_TYPE_LONGLONG | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_LONGLONG, - T_ULONGLONG = T_TYPE_LONGLONG | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_LONGLONG, - T_ENUM = T_TYPE_ENUM | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_NONE, - T_FLOAT = T_TYPE_FLOAT | T_CLASS_FLOAT | T_SIGN_NONE | T_SIZE_NONE, - T_DOUBLE = T_TYPE_DOUBLE | T_CLASS_FLOAT | T_SIGN_NONE | T_SIZE_NONE, - T_VOID = T_TYPE_VOID | T_CLASS_NONE | T_SIGN_NONE | T_SIZE_NONE, + T_INT = T_TYPE_INT | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_NONE, + T_UINT = T_TYPE_INT | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_NONE, + T_LONG = T_TYPE_LONG | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_LONG, + T_ULONG = T_TYPE_LONG | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_LONG, + T_LONGLONG = T_TYPE_LONGLONG | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_LONGLONG, + T_ULONGLONG = T_TYPE_LONGLONG | T_CLASS_INT | T_SIGN_UNSIGNED | T_SIZE_LONGLONG, + T_ENUM = T_TYPE_ENUM | T_CLASS_INT | T_SIGN_SIGNED | T_SIZE_NONE, + T_FLOAT = T_TYPE_FLOAT | T_CLASS_FLOAT | T_SIGN_NONE | T_SIZE_NONE, + T_DOUBLE = T_TYPE_DOUBLE | T_CLASS_FLOAT | T_SIGN_NONE | T_SIZE_NONE, + T_VOID = T_TYPE_VOID | T_CLASS_NONE | T_SIGN_NONE | T_SIZE_NONE, T_STRUCT = T_TYPE_STRUCT | T_CLASS_STRUCT | T_SIGN_NONE | T_SIZE_NONE, T_UNION = T_TYPE_UNION | T_CLASS_STRUCT | T_SIGN_NONE | T_SIZE_NONE, - T_ARRAY = T_TYPE_ARRAY | T_CLASS_PTR | T_SIGN_NONE | T_SIZE_NONE, - T_PTR = T_TYPE_PTR | T_CLASS_PTR | T_SIGN_NONE | T_SIZE_NONE, - T_FUNC = T_TYPE_FUNC | T_CLASS_FUNC | T_SIGN_NONE | T_SIZE_NONE, + T_ARRAY = T_TYPE_ARRAY | T_CLASS_PTR | T_SIGN_NONE | T_SIZE_NONE, + T_PTR = T_TYPE_PTR | T_CLASS_PTR | T_SIGN_NONE | T_SIZE_NONE, + T_FUNC = T_TYPE_FUNC | T_CLASS_FUNC | T_SIGN_NONE | T_SIZE_NONE, /* Aliases */ T_SIZE_T = T_UINT, @@ -160,7 +160,7 @@ struct Type { #define TYPE(T) { (T), { 0 } } /* Maximum length of a type string */ -#define MAXTYPELEN 30 +#define MAXTYPELEN 30 /* Special encodings for element counts of an array */ #define UNSPECIFIED -1L /* Element count was not specified */ @@ -204,7 +204,7 @@ struct SymEntry; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/declare.c b/src/cc65/declare.c index 5694b76b8..c4debd8aa 100644 --- a/src/cc65/declare.c +++ b/src/cc65/declare.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* declare.c */ +/* declare.c */ /* */ -/* Parse variable and function declarations */ +/* Parse variable and function declarations */ /* */ /* */ /* */ @@ -79,7 +79,7 @@ struct StructInitData { /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -93,7 +93,7 @@ static unsigned ParseInitInternal (Type* T, int AllowFlexibleMembers); /*****************************************************************************/ -/* Internal functions */ +/* Internal functions */ /*****************************************************************************/ @@ -117,9 +117,9 @@ static TypeCode OptionalQualifiers (TypeCode Allowed) /* Check for more qualifiers */ while (1) { - switch (CurTok.Tok) { + switch (CurTok.Tok) { - case TOK_CONST: + case TOK_CONST: if (Allowed & T_QUAL_CONST) { if (Q & T_QUAL_CONST) { DuplicateQualifier ("const"); @@ -130,7 +130,7 @@ static TypeCode OptionalQualifiers (TypeCode Allowed) } break; - case TOK_VOLATILE: + case TOK_VOLATILE: if (Allowed & T_QUAL_VOLATILE) { if (Q & T_QUAL_VOLATILE) { DuplicateQualifier ("volatile"); @@ -139,7 +139,7 @@ static TypeCode OptionalQualifiers (TypeCode Allowed) } else { goto Done; } - break; + break; case TOK_RESTRICT: if (Allowed & T_QUAL_RESTRICT) { @@ -196,13 +196,13 @@ static TypeCode OptionalQualifiers (TypeCode Allowed) } break; - default: - goto Done; + default: + goto Done; - } + } - /* Skip the token */ - NextToken (); + /* Skip the token */ + NextToken (); } Done: @@ -242,8 +242,8 @@ static void OptionalInt (void) /* Eat an optional "int" token */ { if (CurTok.Tok == TOK_INT) { - /* Skip it */ - NextToken (); + /* Skip it */ + NextToken (); } } @@ -253,8 +253,8 @@ static void OptionalSigned (void) /* Eat an optional "signed" token */ { if (CurTok.Tok == TOK_SIGNED) { - /* Skip it */ - NextToken (); + /* Skip it */ + NextToken (); } } @@ -285,11 +285,11 @@ static void NeedTypeSpace (Declaration* D, unsigned Count) /* Check if there is enough space for Count type specifiers within D */ { if (D->Index + Count >= MAXTYPELEN) { - /* We must call Fatal() here, since calling Error() will try to - * continue, and the declaration type is not correctly terminated - * in case we come here. - */ - Fatal ("Too many type specifiers"); + /* We must call Fatal() here, since calling Error() will try to + * continue, and the declaration type is not correctly terminated + * in case we come here. + */ + Fatal ("Too many type specifiers"); } } @@ -404,36 +404,36 @@ static void ParseStorageClass (DeclSpec* D, unsigned DefStorage) /* Check the storage class given */ switch (CurTok.Tok) { - case TOK_EXTERN: - D->StorageClass = SC_EXTERN | SC_STATIC; - NextToken (); - break; + case TOK_EXTERN: + D->StorageClass = SC_EXTERN | SC_STATIC; + NextToken (); + break; - case TOK_STATIC: - D->StorageClass = SC_STATIC; - NextToken (); - break; + case TOK_STATIC: + D->StorageClass = SC_STATIC; + NextToken (); + break; - case TOK_REGISTER: - D->StorageClass = SC_REGISTER | SC_STATIC; - NextToken (); - break; + case TOK_REGISTER: + D->StorageClass = SC_REGISTER | SC_STATIC; + NextToken (); + break; - case TOK_AUTO: - D->StorageClass = SC_AUTO; - NextToken (); - break; + case TOK_AUTO: + D->StorageClass = SC_AUTO; + NextToken (); + break; - case TOK_TYPEDEF: - D->StorageClass = SC_TYPEDEF; - NextToken (); - break; + case TOK_TYPEDEF: + D->StorageClass = SC_TYPEDEF; + NextToken (); + break; - default: - /* No storage class given, use default */ - D->Flags |= DS_DEF_STORAGE; - D->StorageClass = DefStorage; - break; + default: + /* No storage class given, use default */ + D->Flags |= DS_DEF_STORAGE; + D->StorageClass = DefStorage; + break; } } @@ -447,7 +447,7 @@ static void ParseEnumDecl (void) /* Accept forward definitions */ if (CurTok.Tok != TOK_LCURLY) { - return; + return; } /* Skip the opening curly brace */ @@ -457,31 +457,31 @@ static void ParseEnumDecl (void) EnumVal = 0; while (CurTok.Tok != TOK_RCURLY) { - /* We expect an identifier */ - if (CurTok.Tok != TOK_IDENT) { - Error ("Identifier expected"); - continue; - } + /* We expect an identifier */ + if (CurTok.Tok != TOK_IDENT) { + Error ("Identifier expected"); + continue; + } - /* Remember the identifier and skip it */ - strcpy (Ident, CurTok.Ident); - NextToken (); + /* Remember the identifier and skip it */ + strcpy (Ident, CurTok.Ident); + NextToken (); - /* Check for an assigned value */ - if (CurTok.Tok == TOK_ASSIGN) { - ExprDesc Expr; - NextToken (); - ConstAbsIntExpr (hie1, &Expr); - EnumVal = Expr.IVal; - } + /* Check for an assigned value */ + if (CurTok.Tok == TOK_ASSIGN) { + ExprDesc Expr; + NextToken (); + ConstAbsIntExpr (hie1, &Expr); + EnumVal = Expr.IVal; + } - /* Add an entry to the symbol table */ - AddConstSym (Ident, type_int, SC_ENUM, EnumVal++); + /* Add an entry to the symbol table */ + AddConstSym (Ident, type_int, SC_ENUM, EnumVal++); - /* Check for end of definition */ - if (CurTok.Tok != TOK_COMMA) - break; - NextToken (); + /* Check for end of definition */ + if (CurTok.Tok != TOK_COMMA) + break; + NextToken (); } ConsumeRCurly (); } @@ -602,8 +602,8 @@ static SymEntry* ParseUnionDecl (const char* Name) if (CurTok.Tok != TOK_LCURLY) { - /* Just a forward declaration. */ - return StructOrUnionForwardDecl (Name, SC_UNION); + /* Just a forward declaration. */ + return StructOrUnionForwardDecl (Name, SC_UNION); } /* Add a forward declaration for the struct in the current lexical level */ @@ -619,18 +619,18 @@ static SymEntry* ParseUnionDecl (const char* Name) UnionSize = 0; while (CurTok.Tok != TOK_RCURLY) { - /* Get the type of the entry */ - DeclSpec Spec; - InitDeclSpec (&Spec); - ParseTypeSpec (&Spec, -1, T_QUAL_NONE); + /* Get the type of the entry */ + DeclSpec Spec; + InitDeclSpec (&Spec); + ParseTypeSpec (&Spec, -1, T_QUAL_NONE); - /* Read fields with this type */ - while (1) { + /* Read fields with this type */ + while (1) { - Declaration Decl; + Declaration Decl; - /* Get type and name of the struct field */ - ParseDecl (&Spec, &Decl, DM_ACCEPT_IDENT); + /* Get type and name of the struct field */ + ParseDecl (&Spec, &Decl, DM_ACCEPT_IDENT); /* Check for a bit-field declaration */ FieldWidth = ParseFieldWidth (&Decl); @@ -672,11 +672,11 @@ static SymEntry* ParseUnionDecl (const char* Name) } NextMember: if (CurTok.Tok != TOK_COMMA) { - break; + break; } - NextToken (); - } - ConsumeSemi (); + NextToken (); + } + ConsumeSemi (); } /* Skip the closing brace */ @@ -704,8 +704,8 @@ static SymEntry* ParseStructDecl (const char* Name) if (CurTok.Tok != TOK_LCURLY) { - /* Just a forward declaration. */ - return StructOrUnionForwardDecl (Name, SC_STRUCT); + /* Just a forward declaration. */ + return StructOrUnionForwardDecl (Name, SC_STRUCT); } /* Add a forward declaration for the struct in the current lexical level */ @@ -723,15 +723,15 @@ static SymEntry* ParseStructDecl (const char* Name) BitOffs = 0; while (CurTok.Tok != TOK_RCURLY) { - /* Get the type of the entry */ - DeclSpec Spec; - InitDeclSpec (&Spec); - ParseTypeSpec (&Spec, -1, T_QUAL_NONE); + /* Get the type of the entry */ + DeclSpec Spec; + InitDeclSpec (&Spec); + ParseTypeSpec (&Spec, -1, T_QUAL_NONE); - /* Read fields with this type */ - while (1) { + /* Read fields with this type */ + while (1) { - Declaration Decl; + Declaration Decl; ident Ident; /* If we had a flexible array member before, no other fields can @@ -742,8 +742,8 @@ static SymEntry* ParseStructDecl (const char* Name) FlexibleMember = 0; /* Avoid further errors */ } - /* Get type and name of the struct field */ - ParseDecl (&Spec, &Decl, DM_ACCEPT_IDENT); + /* Get type and name of the struct field */ + ParseDecl (&Spec, &Decl, DM_ACCEPT_IDENT); /* Check for a bit-field declaration */ FieldWidth = ParseFieldWidth (&Decl); @@ -836,11 +836,11 @@ static SymEntry* ParseStructDecl (const char* Name) } NextMember: if (CurTok.Tok != TOK_COMMA) { - break; + break; } - NextToken (); - } - ConsumeSemi (); + NextToken (); + } + ConsumeSemi (); } /* If we have bits from bit-fields left, add them to the size. */ @@ -864,8 +864,8 @@ NextMember: if (CurTok.Tok != TOK_COMMA) { static void ParseTypeSpec (DeclSpec* D, long Default, TypeCode Qualifiers) /* Parse a type specificier */ { - ident Ident; - SymEntry* Entry; + ident Ident; + SymEntry* Entry; /* Assume we have an explicit type */ D->Flags &= ~DS_DEF_TYPE; @@ -876,223 +876,223 @@ static void ParseTypeSpec (DeclSpec* D, long Default, TypeCode Qualifiers) /* Look at the data type */ switch (CurTok.Tok) { - case TOK_VOID: - NextToken (); - D->Type[0].C = T_VOID; - D->Type[1].C = T_END; - break; + case TOK_VOID: + NextToken (); + D->Type[0].C = T_VOID; + D->Type[1].C = T_END; + break; - case TOK_CHAR: - NextToken (); - D->Type[0].C = GetDefaultChar(); - D->Type[1].C = T_END; - break; + case TOK_CHAR: + NextToken (); + D->Type[0].C = GetDefaultChar(); + D->Type[1].C = T_END; + break; - case TOK_LONG: - NextToken (); - if (CurTok.Tok == TOK_UNSIGNED) { - NextToken (); - OptionalInt (); - D->Type[0].C = T_ULONG; - D->Type[1].C = T_END; - } else { - OptionalSigned (); - OptionalInt (); - D->Type[0].C = T_LONG; - D->Type[1].C = T_END; - } - break; + case TOK_LONG: + NextToken (); + if (CurTok.Tok == TOK_UNSIGNED) { + NextToken (); + OptionalInt (); + D->Type[0].C = T_ULONG; + D->Type[1].C = T_END; + } else { + OptionalSigned (); + OptionalInt (); + D->Type[0].C = T_LONG; + D->Type[1].C = T_END; + } + break; - case TOK_SHORT: - NextToken (); - if (CurTok.Tok == TOK_UNSIGNED) { - NextToken (); - OptionalInt (); - D->Type[0].C = T_USHORT; - D->Type[1].C = T_END; - } else { - OptionalSigned (); - OptionalInt (); - D->Type[0].C = T_SHORT; - D->Type[1].C = T_END; - } - break; + case TOK_SHORT: + NextToken (); + if (CurTok.Tok == TOK_UNSIGNED) { + NextToken (); + OptionalInt (); + D->Type[0].C = T_USHORT; + D->Type[1].C = T_END; + } else { + OptionalSigned (); + OptionalInt (); + D->Type[0].C = T_SHORT; + D->Type[1].C = T_END; + } + break; - case TOK_INT: - NextToken (); - D->Type[0].C = T_INT; - D->Type[1].C = T_END; - break; + case TOK_INT: + NextToken (); + D->Type[0].C = T_INT; + D->Type[1].C = T_END; + break; case TOK_SIGNED: - NextToken (); - switch (CurTok.Tok) { + NextToken (); + switch (CurTok.Tok) { - case TOK_CHAR: - NextToken (); - D->Type[0].C = T_SCHAR; - D->Type[1].C = T_END; - break; + case TOK_CHAR: + NextToken (); + D->Type[0].C = T_SCHAR; + D->Type[1].C = T_END; + break; - case TOK_SHORT: - NextToken (); - OptionalInt (); - D->Type[0].C = T_SHORT; - D->Type[1].C = T_END; - break; + case TOK_SHORT: + NextToken (); + OptionalInt (); + D->Type[0].C = T_SHORT; + D->Type[1].C = T_END; + break; - case TOK_LONG: - NextToken (); - OptionalInt (); - D->Type[0].C = T_LONG; - D->Type[1].C = T_END; - break; + case TOK_LONG: + NextToken (); + OptionalInt (); + D->Type[0].C = T_LONG; + D->Type[1].C = T_END; + break; - case TOK_INT: - NextToken (); - /* FALL THROUGH */ + case TOK_INT: + NextToken (); + /* FALL THROUGH */ - default: - D->Type[0].C = T_INT; - D->Type[1].C = T_END; - break; - } - break; + default: + D->Type[0].C = T_INT; + D->Type[1].C = T_END; + break; + } + break; - case TOK_UNSIGNED: - NextToken (); - switch (CurTok.Tok) { + case TOK_UNSIGNED: + NextToken (); + switch (CurTok.Tok) { - case TOK_CHAR: - NextToken (); - D->Type[0].C = T_UCHAR; - D->Type[1].C = T_END; - break; + case TOK_CHAR: + NextToken (); + D->Type[0].C = T_UCHAR; + D->Type[1].C = T_END; + break; - case TOK_SHORT: - NextToken (); - OptionalInt (); - D->Type[0].C = T_USHORT; - D->Type[1].C = T_END; - break; + case TOK_SHORT: + NextToken (); + OptionalInt (); + D->Type[0].C = T_USHORT; + D->Type[1].C = T_END; + break; - case TOK_LONG: - NextToken (); - OptionalInt (); - D->Type[0].C = T_ULONG; - D->Type[1].C = T_END; - break; + case TOK_LONG: + NextToken (); + OptionalInt (); + D->Type[0].C = T_ULONG; + D->Type[1].C = T_END; + break; - case TOK_INT: - NextToken (); - /* FALL THROUGH */ + case TOK_INT: + NextToken (); + /* FALL THROUGH */ - default: - D->Type[0].C = T_UINT; - D->Type[1].C = T_END; - break; - } - break; + default: + D->Type[0].C = T_UINT; + D->Type[1].C = T_END; + break; + } + break; case TOK_FLOAT: - NextToken (); - D->Type[0].C = T_FLOAT; - D->Type[1].C = T_END; - break; + NextToken (); + D->Type[0].C = T_FLOAT; + D->Type[1].C = T_END; + break; case TOK_DOUBLE: - NextToken (); - D->Type[0].C = T_DOUBLE; - D->Type[1].C = T_END; - break; + NextToken (); + D->Type[0].C = T_DOUBLE; + D->Type[1].C = T_END; + break; - case TOK_UNION: - NextToken (); - /* */ - if (CurTok.Tok == TOK_IDENT) { - strcpy (Ident, CurTok.Ident); - NextToken (); - } else { - AnonName (Ident, "union"); - } - /* Remember we have an extra type decl */ - D->Flags |= DS_EXTRA_TYPE; - /* Declare the union in the current scope */ - Entry = ParseUnionDecl (Ident); - /* Encode the union entry into the type */ - D->Type[0].C = T_UNION; - SetSymEntry (D->Type, Entry); - D->Type[1].C = T_END; - break; + case TOK_UNION: + NextToken (); + /* */ + if (CurTok.Tok == TOK_IDENT) { + strcpy (Ident, CurTok.Ident); + NextToken (); + } else { + AnonName (Ident, "union"); + } + /* Remember we have an extra type decl */ + D->Flags |= DS_EXTRA_TYPE; + /* Declare the union in the current scope */ + Entry = ParseUnionDecl (Ident); + /* Encode the union entry into the type */ + D->Type[0].C = T_UNION; + SetSymEntry (D->Type, Entry); + D->Type[1].C = T_END; + break; - case TOK_STRUCT: - NextToken (); - /* */ - if (CurTok.Tok == TOK_IDENT) { - strcpy (Ident, CurTok.Ident); - NextToken (); - } else { - AnonName (Ident, "struct"); - } - /* Remember we have an extra type decl */ - D->Flags |= DS_EXTRA_TYPE; - /* Declare the struct in the current scope */ - Entry = ParseStructDecl (Ident); - /* Encode the struct entry into the type */ - D->Type[0].C = T_STRUCT; - SetSymEntry (D->Type, Entry); - D->Type[1].C = T_END; - break; + case TOK_STRUCT: + NextToken (); + /* */ + if (CurTok.Tok == TOK_IDENT) { + strcpy (Ident, CurTok.Ident); + NextToken (); + } else { + AnonName (Ident, "struct"); + } + /* Remember we have an extra type decl */ + D->Flags |= DS_EXTRA_TYPE; + /* Declare the struct in the current scope */ + Entry = ParseStructDecl (Ident); + /* Encode the struct entry into the type */ + D->Type[0].C = T_STRUCT; + SetSymEntry (D->Type, Entry); + D->Type[1].C = T_END; + break; - case TOK_ENUM: - NextToken (); - if (CurTok.Tok != TOK_LCURLY) { - /* Named enum */ - if (CurTok.Tok == TOK_IDENT) { - /* Find an entry with this name */ - Entry = FindTagSym (CurTok.Ident); - if (Entry) { - if (SymIsLocal (Entry) && (Entry->Flags & SC_ENUM) == 0) { - Error ("Symbol `%s' is already different kind", Entry->Name); - } - } else { - /* Insert entry into table ### */ - } - /* Skip the identifier */ - NextToken (); - } else { - Error ("Identifier expected"); - } - } - /* Remember we have an extra type decl */ - D->Flags |= DS_EXTRA_TYPE; - /* Parse the enum decl */ - ParseEnumDecl (); - D->Type[0].C = T_INT; - D->Type[1].C = T_END; - break; + case TOK_ENUM: + NextToken (); + if (CurTok.Tok != TOK_LCURLY) { + /* Named enum */ + if (CurTok.Tok == TOK_IDENT) { + /* Find an entry with this name */ + Entry = FindTagSym (CurTok.Ident); + if (Entry) { + if (SymIsLocal (Entry) && (Entry->Flags & SC_ENUM) == 0) { + Error ("Symbol `%s' is already different kind", Entry->Name); + } + } else { + /* Insert entry into table ### */ + } + /* Skip the identifier */ + NextToken (); + } else { + Error ("Identifier expected"); + } + } + /* Remember we have an extra type decl */ + D->Flags |= DS_EXTRA_TYPE; + /* Parse the enum decl */ + ParseEnumDecl (); + D->Type[0].C = T_INT; + D->Type[1].C = T_END; + break; case TOK_IDENT: - Entry = FindSym (CurTok.Ident); - if (Entry && SymIsTypeDef (Entry)) { - /* It's a typedef */ - NextToken (); - TypeCopy (D->Type, Entry->Type); - break; - } - /* FALL THROUGH */ + Entry = FindSym (CurTok.Ident); + if (Entry && SymIsTypeDef (Entry)) { + /* It's a typedef */ + NextToken (); + TypeCopy (D->Type, Entry->Type); + break; + } + /* FALL THROUGH */ - default: - if (Default < 0) { - Error ("Type expected"); - D->Type[0].C = T_INT; - D->Type[1].C = T_END; - } else { - D->Flags |= DS_DEF_TYPE; - D->Type[0].C = (TypeCode) Default; - D->Type[1].C = T_END; - } - break; + default: + if (Default < 0) { + Error ("Type expected"); + D->Type[0].C = T_INT; + D->Type[1].C = T_END; + } else { + D->Flags |= DS_DEF_TYPE; + D->Type[0].C = (TypeCode) Default; + D->Type[1].C = T_END; + } + break; } /* There may also be qualifiers *after* the initial type */ @@ -1107,7 +1107,7 @@ static Type* ParamTypeCvt (Type* T) */ { if (IsTypeArray (T)) { - T->C = T_PTR; + T->C = T_PTR; } return T; } @@ -1123,8 +1123,8 @@ static void ParseOldStyleParamList (FuncDesc* F) /* Parse params */ while (CurTok.Tok != TOK_RPAREN) { - /* List of identifiers expected */ - if (CurTok.Tok == TOK_IDENT) { + /* List of identifiers expected */ + if (CurTok.Tok == TOK_IDENT) { /* Create a symbol table entry with type int */ AddLocalSym (CurTok.Ident, type_int, SC_AUTO | SC_PARAM | SC_DEF | SC_DEFTYPE, 0); @@ -1135,20 +1135,20 @@ static void ParseOldStyleParamList (FuncDesc* F) /* Skip the identifier */ NextToken (); - } else { + } else { /* Not a parameter name */ - Error ("Identifier expected"); + Error ("Identifier expected"); /* Try some smart error recovery */ SkipTokens (TokenList, sizeof(TokenList) / sizeof(TokenList[0])); } - /* Check for more parameters */ - if (CurTok.Tok == TOK_COMMA) { - NextToken (); - } else { - break; - } + /* Check for more parameters */ + if (CurTok.Tok == TOK_COMMA) { + NextToken (); + } else { + break; + } } /* Skip right paren. We must explicitly check for one here, since some of @@ -1159,31 +1159,31 @@ static void ParseOldStyleParamList (FuncDesc* F) /* An optional list of type specifications follows */ while (CurTok.Tok != TOK_LCURLY) { - DeclSpec Spec; + DeclSpec Spec; - /* Read the declaration specifier */ - ParseDeclSpec (&Spec, SC_AUTO, T_INT); + /* Read the declaration specifier */ + ParseDeclSpec (&Spec, SC_AUTO, T_INT); - /* We accept only auto and register as storage class specifiers, but - * we ignore all this, since we use auto anyway. - */ - if ((Spec.StorageClass & SC_AUTO) == 0 && - (Spec.StorageClass & SC_REGISTER) == 0) { - Error ("Illegal storage class"); - } + /* We accept only auto and register as storage class specifiers, but + * we ignore all this, since we use auto anyway. + */ + if ((Spec.StorageClass & SC_AUTO) == 0 && + (Spec.StorageClass & SC_REGISTER) == 0) { + Error ("Illegal storage class"); + } - /* Parse a comma separated variable list */ - while (1) { + /* Parse a comma separated variable list */ + while (1) { - Declaration Decl; + Declaration Decl; - /* Read the parameter */ - ParseDecl (&Spec, &Decl, DM_NEED_IDENT); - if (Decl.Ident[0] != '\0') { + /* Read the parameter */ + ParseDecl (&Spec, &Decl, DM_NEED_IDENT); + if (Decl.Ident[0] != '\0') { - /* We have a name given. Search for the symbol */ - SymEntry* Sym = FindLocalSym (Decl.Ident); - if (Sym) { + /* We have a name given. Search for the symbol */ + SymEntry* Sym = FindLocalSym (Decl.Ident); + if (Sym) { /* Check if we already changed the type for this * parameter */ @@ -1196,21 +1196,21 @@ static void ParseOldStyleParamList (FuncDesc* F) /* Type has already been changed */ Error ("Redefinition for parameter `%s'", Sym->Name); } - } else { - Error ("Unknown identifier: `%s'", Decl.Ident); - } - } + } else { + Error ("Unknown identifier: `%s'", Decl.Ident); + } + } - if (CurTok.Tok == TOK_COMMA) { - NextToken (); - } else { - break; - } + if (CurTok.Tok == TOK_COMMA) { + NextToken (); + } else { + break; + } - } + } - /* Variable list must be semicolon terminated */ - ConsumeSemi (); + /* Variable list must be semicolon terminated */ + ConsumeSemi (); } } @@ -1222,50 +1222,50 @@ static void ParseAnsiParamList (FuncDesc* F) /* Parse params */ while (CurTok.Tok != TOK_RPAREN) { - DeclSpec Spec; - Declaration Decl; + DeclSpec Spec; + Declaration Decl; SymEntry* Sym; - /* Allow an ellipsis as last parameter */ - if (CurTok.Tok == TOK_ELLIPSIS) { - NextToken (); - F->Flags |= FD_VARIADIC; - break; - } + /* Allow an ellipsis as last parameter */ + if (CurTok.Tok == TOK_ELLIPSIS) { + NextToken (); + F->Flags |= FD_VARIADIC; + break; + } - /* Read the declaration specifier */ - ParseDeclSpec (&Spec, SC_AUTO, T_INT); + /* Read the declaration specifier */ + ParseDeclSpec (&Spec, SC_AUTO, T_INT); - /* We accept only auto and register as storage class specifiers */ + /* We accept only auto and register as storage class specifiers */ if ((Spec.StorageClass & SC_AUTO) == SC_AUTO) { Spec.StorageClass = SC_AUTO | SC_PARAM | SC_DEF; } else if ((Spec.StorageClass & SC_REGISTER) == SC_REGISTER) { Spec.StorageClass = SC_REGISTER | SC_STATIC | SC_PARAM | SC_DEF; } else { - Error ("Illegal storage class"); + Error ("Illegal storage class"); Spec.StorageClass = SC_AUTO | SC_PARAM | SC_DEF; - } + } - /* Allow parameters without a name, but remember if we had some to - * eventually print an error message later. - */ - ParseDecl (&Spec, &Decl, DM_ACCEPT_IDENT); - if (Decl.Ident[0] == '\0') { + /* Allow parameters without a name, but remember if we had some to + * eventually print an error message later. + */ + ParseDecl (&Spec, &Decl, DM_ACCEPT_IDENT); + if (Decl.Ident[0] == '\0') { - /* Unnamed symbol. Generate a name that is not user accessible, - * then handle the symbol normal. - */ - AnonName (Decl.Ident, "param"); - F->Flags |= FD_UNNAMED_PARAMS; + /* Unnamed symbol. Generate a name that is not user accessible, + * then handle the symbol normal. + */ + AnonName (Decl.Ident, "param"); + F->Flags |= FD_UNNAMED_PARAMS; - /* Clear defined bit on nonames */ - Decl.StorageClass &= ~SC_DEF; - } + /* Clear defined bit on nonames */ + Decl.StorageClass &= ~SC_DEF; + } - /* Parse attributes for this parameter */ - ParseAttribute (&Decl); + /* Parse attributes for this parameter */ + ParseAttribute (&Decl); - /* Create a symbol table entry */ + /* Create a symbol table entry */ Sym = AddLocalSym (Decl.Ident, ParamTypeCvt (Decl.Type), Decl.StorageClass, 0); /* Add attributes if we have any */ @@ -1278,15 +1278,15 @@ static void ParseAnsiParamList (FuncDesc* F) } } - /* Count arguments */ - ++F->ParamCount; + /* Count arguments */ + ++F->ParamCount; - /* Check for more parameters */ - if (CurTok.Tok == TOK_COMMA) { - NextToken (); - } else { - break; - } + /* Check for more parameters */ + if (CurTok.Tok == TOK_COMMA) { + NextToken (); + } else { + break; + } } /* Skip right paren. We must explicitly check for one here, since some of @@ -1311,33 +1311,33 @@ static FuncDesc* ParseFuncDecl (void) /* Check for several special parameter lists */ if (CurTok.Tok == TOK_RPAREN) { - /* Parameter list is empty */ - F->Flags |= (FD_EMPTY | FD_VARIADIC); + /* Parameter list is empty */ + F->Flags |= (FD_EMPTY | FD_VARIADIC); } else if (CurTok.Tok == TOK_VOID && NextTok.Tok == TOK_RPAREN) { - /* Parameter list declared as void */ - NextToken (); - F->Flags |= FD_VOID_PARAM; + /* Parameter list declared as void */ + NextToken (); + F->Flags |= FD_VOID_PARAM; } else if (CurTok.Tok == TOK_IDENT && - (NextTok.Tok == TOK_COMMA || NextTok.Tok == TOK_RPAREN)) { - /* If the identifier is a typedef, we have a new style parameter list, - * if it's some other identifier, it's an old style parameter list. - */ - Sym = FindSym (CurTok.Ident); - if (Sym == 0 || !SymIsTypeDef (Sym)) { - /* Old style (K&R) function. */ - F->Flags |= FD_OLDSTYLE; - } + (NextTok.Tok == TOK_COMMA || NextTok.Tok == TOK_RPAREN)) { + /* If the identifier is a typedef, we have a new style parameter list, + * if it's some other identifier, it's an old style parameter list. + */ + Sym = FindSym (CurTok.Ident); + if (Sym == 0 || !SymIsTypeDef (Sym)) { + /* Old style (K&R) function. */ + F->Flags |= FD_OLDSTYLE; + } } /* Parse params */ if ((F->Flags & FD_OLDSTYLE) == 0) { - /* New style function */ - ParseAnsiParamList (F); + /* New style function */ + ParseAnsiParamList (F); } else { - /* Old style function */ - ParseOldStyleParamList (F); + /* Old style function */ + ParseOldStyleParamList (F); } /* Remember the last function parameter. We need it later for several @@ -1353,15 +1353,15 @@ static FuncDesc* ParseFuncDecl (void) Offs = (F->Flags & FD_VARIADIC)? 1 : 0; Sym = F->LastParam; while (Sym) { - unsigned Size = CheckedSizeOf (Sym->Type); + unsigned Size = CheckedSizeOf (Sym->Type); if (SymIsRegVar (Sym)) { Sym->V.R.SaveOffs = Offs; } else { - Sym->V.Offs = Offs; + Sym->V.Offs = Offs; } - Offs += Size; - F->ParamSize += Size; - Sym = Sym->PrevSym; + Offs += Size; + F->ParamSize += Size; + Sym = Sym->PrevSym; } /* Leave the lexical level remembering the symbol tables */ @@ -1388,58 +1388,58 @@ static void Declarator (const DeclSpec* Spec, Declaration* D, declmode_t Mode) if (CurTok.Tok == TOK_STAR) { /* Skip the star */ - NextToken (); + NextToken (); - /* Allow const, restrict and volatile qualifiers */ + /* Allow const, restrict and volatile qualifiers */ Qualifiers |= OptionalQualifiers (T_QUAL_CONST | T_QUAL_VOLATILE | T_QUAL_RESTRICT); /* Parse the type, the pointer points to */ - Declarator (Spec, D, Mode); + Declarator (Spec, D, Mode); - /* Add the type */ - AddTypeToDeclaration (D, T_PTR | Qualifiers); - return; + /* Add the type */ + AddTypeToDeclaration (D, T_PTR | Qualifiers); + return; } if (CurTok.Tok == TOK_LPAREN) { - NextToken (); - Declarator (Spec, D, Mode); - ConsumeRParen (); + NextToken (); + Declarator (Spec, D, Mode); + ConsumeRParen (); } else { - /* Things depend on Mode now: - * - Mode == DM_NEED_IDENT means: - * we *must* have a type and a variable identifer. - * - Mode == DM_NO_IDENT means: - * we must have a type but no variable identifer - * (if there is one, it's not read). - * - Mode == DM_ACCEPT_IDENT means: - * we *may* have an identifier. If there is an identifier, - * it is read, but it is no error, if there is none. - */ - if (Mode == DM_NO_IDENT) { - D->Ident[0] = '\0'; - } else if (CurTok.Tok == TOK_IDENT) { - strcpy (D->Ident, CurTok.Ident); - NextToken (); - } else { - if (Mode == DM_NEED_IDENT) { - Error ("Identifier expected"); - } - D->Ident[0] = '\0'; - } + /* Things depend on Mode now: + * - Mode == DM_NEED_IDENT means: + * we *must* have a type and a variable identifer. + * - Mode == DM_NO_IDENT means: + * we must have a type but no variable identifer + * (if there is one, it's not read). + * - Mode == DM_ACCEPT_IDENT means: + * we *may* have an identifier. If there is an identifier, + * it is read, but it is no error, if there is none. + */ + if (Mode == DM_NO_IDENT) { + D->Ident[0] = '\0'; + } else if (CurTok.Tok == TOK_IDENT) { + strcpy (D->Ident, CurTok.Ident); + NextToken (); + } else { + if (Mode == DM_NEED_IDENT) { + Error ("Identifier expected"); + } + D->Ident[0] = '\0'; + } } while (CurTok.Tok == TOK_LBRACK || CurTok.Tok == TOK_LPAREN) { - if (CurTok.Tok == TOK_LPAREN) { + if (CurTok.Tok == TOK_LPAREN) { - /* Function declaration */ - FuncDesc* F; + /* Function declaration */ + FuncDesc* F; /* Skip the opening paren */ - NextToken (); + NextToken (); - /* Parse the function declaration */ - F = ParseFuncDecl (); + /* Parse the function declaration */ + F = ParseFuncDecl (); /* We cannot specify fastcall for variadic functions */ if ((F->Flags & FD_VARIADIC) && (Qualifiers & T_QUAL_FASTCALL)) { @@ -1447,7 +1447,7 @@ static void Declarator (const DeclSpec* Spec, Declaration* D, declmode_t Mode) Qualifiers &= ~T_QUAL_FASTCALL; } - /* Add the function type. Be sure to bounds check the type buffer */ + /* Add the function type. Be sure to bounds check the type buffer */ NeedTypeSpace (D, 1); D->Type[D->Index].C = T_FUNC | Qualifiers; D->Type[D->Index].A.P = F; @@ -1456,9 +1456,9 @@ static void Declarator (const DeclSpec* Spec, Declaration* D, declmode_t Mode) /* Qualifiers now used */ Qualifiers = T_QUAL_NONE; - } else { - /* Array declaration. */ - long Size = UNSPECIFIED; + } else { + /* Array declaration. */ + long Size = UNSPECIFIED; /* We cannot have any qualifiers for an array */ if (Qualifiers != T_QUAL_NONE) { @@ -1467,12 +1467,12 @@ static void Declarator (const DeclSpec* Spec, Declaration* D, declmode_t Mode) } /* Skip the left bracket */ - NextToken (); + NextToken (); - /* Read the size if it is given */ - if (CurTok.Tok != TOK_RBRACK) { - ExprDesc Expr; - ConstAbsIntExpr (hie1, &Expr); + /* Read the size if it is given */ + if (CurTok.Tok != TOK_RBRACK) { + ExprDesc Expr; + ConstAbsIntExpr (hie1, &Expr); if (Expr.IVal <= 0) { if (D->Ident[0] != '\0') { Error ("Size of array `%s' is invalid", D->Ident); @@ -1481,18 +1481,18 @@ static void Declarator (const DeclSpec* Spec, Declaration* D, declmode_t Mode) } Expr.IVal = 1; } - Size = Expr.IVal; - } + Size = Expr.IVal; + } /* Skip the right bracket */ - ConsumeRBrack (); + ConsumeRBrack (); - /* Add the array type with the size to the type */ + /* Add the array type with the size to the type */ NeedTypeSpace (D, 1); D->Type[D->Index].C = T_ARRAY; D->Type[D->Index].A.L = Size; ++D->Index; - } + } } /* If we have remaining qualifiers, flag them as invalid */ @@ -1513,7 +1513,7 @@ static void Declarator (const DeclSpec* Spec, Declaration* D, declmode_t Mode) /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ @@ -1550,7 +1550,7 @@ void ParseDecl (const DeclSpec* Spec, Declaration* D, declmode_t Mode) Declarator (Spec, D, Mode); /* Add the base type. */ - NeedTypeSpace (D, TypeLen (Spec->Type) + 1); /* Bounds check */ + NeedTypeSpace (D, TypeLen (Spec->Type) + 1); /* Bounds check */ TypeCopy (D->Type + D->Index, Spec->Type); /* Use the storage class from the declspec */ @@ -1663,7 +1663,7 @@ void CheckEmptyDecl (const DeclSpec* D) */ { if ((D->Flags & DS_EXTRA_TYPE) == 0) { - Warning ("Useless declaration"); + Warning ("Useless declaration"); } } @@ -1734,7 +1734,7 @@ static void DefineData (ExprDesc* Expr) case E_LOC_ABS: /* Absolute: numeric address or const */ - g_defdata (TypeOf (Expr->Type) | CF_CONST, Expr->IVal, 0); + g_defdata (TypeOf (Expr->Type) | CF_CONST, Expr->IVal, 0); break; case E_LOC_GLOBAL: @@ -1749,12 +1749,12 @@ static void DefineData (ExprDesc* Expr) break; case E_LOC_REGISTER: - /* Register variable. Taking the address is usually not - * allowed. - */ - if (IS_Get (&AllowRegVarAddr) == 0) { - Error ("Cannot take the address of a register variable"); - } + /* Register variable. Taking the address is usually not + * allowed. + */ + if (IS_Get (&AllowRegVarAddr) == 0) { + Error ("Cannot take the address of a register variable"); + } g_defdata (CF_REGVAR, Expr->Name, Expr->IVal); break; @@ -1764,8 +1764,8 @@ static void DefineData (ExprDesc* Expr) Error ("Non constant initializer"); break; - default: - Internal ("Unknown constant type: 0x%04X", ED_GetLoc (Expr)); + default: + Internal ("Unknown constant type: 0x%04X", ED_GetLoc (Expr)); } } @@ -1972,11 +1972,11 @@ static unsigned ParseStructInit (Type* T, int AllowFlexibleMembers) */ Tab = Entry->V.S.SymTab; if (Tab == 0) { - Error ("Cannot initialize variables with incomplete type"); + Error ("Cannot initialize variables with incomplete type"); /* Try error recovery */ SkipInitializer (1); - /* Nothing initialized */ - return 0; + /* Nothing initialized */ + return 0; } /* Get a pointer to the list of symbols */ @@ -1989,11 +1989,11 @@ static unsigned ParseStructInit (Type* T, int AllowFlexibleMembers) while (CurTok.Tok != TOK_RCURLY) { /* */ - if (Entry == 0) { - Error ("Too many initializers"); + if (Entry == 0) { + Error ("Too many initializers"); SkipInitializer (1); - return SI.Offs; - } + return SI.Offs; + } /* Parse initialization of one field. Bit-fields need a special * handling. @@ -2063,8 +2063,8 @@ static unsigned ParseStructInit (Type* T, int AllowFlexibleMembers) } /* More initializers? */ - if (CurTok.Tok != TOK_COMMA) { - break; + if (CurTok.Tok != TOK_COMMA) { + break; } /* Skip the comma */ @@ -2089,7 +2089,7 @@ NextMember: /* If there are struct fields left, reserve additional storage */ if (SI.Offs < SI.Size) { - g_zerobytes (SI.Size - SI.Offs); + g_zerobytes (SI.Size - SI.Offs); SI.Offs = SI.Size; } @@ -2116,53 +2116,53 @@ static unsigned ParseVoidInit (void) /* Allow an arbitrary list of values */ Size = 0; do { - ConstExpr (hie1, &Expr); - switch (UnqualifiedType (Expr.Type[0].C)) { + ConstExpr (hie1, &Expr); + switch (UnqualifiedType (Expr.Type[0].C)) { - case T_SCHAR: - case T_UCHAR: - if (ED_IsConstAbsInt (&Expr)) { - /* Make it byte sized */ - Expr.IVal &= 0xFF; - } - DefineData (&Expr); + case T_SCHAR: + case T_UCHAR: + if (ED_IsConstAbsInt (&Expr)) { + /* Make it byte sized */ + Expr.IVal &= 0xFF; + } + DefineData (&Expr); Size += SIZEOF_CHAR; break; - case T_SHORT: - case T_USHORT: - case T_INT: - case T_UINT: - case T_PTR: - case T_ARRAY: - if (ED_IsConstAbsInt (&Expr)) { - /* Make it word sized */ - Expr.IVal &= 0xFFFF; - } - DefineData (&Expr); - Size += SIZEOF_INT; + case T_SHORT: + case T_USHORT: + case T_INT: + case T_UINT: + case T_PTR: + case T_ARRAY: + if (ED_IsConstAbsInt (&Expr)) { + /* Make it word sized */ + Expr.IVal &= 0xFFFF; + } + DefineData (&Expr); + Size += SIZEOF_INT; break; - case T_LONG: - case T_ULONG: - if (ED_IsConstAbsInt (&Expr)) { - /* Make it dword sized */ - Expr.IVal &= 0xFFFFFFFF; - } - DefineData (&Expr); - Size += SIZEOF_LONG; + case T_LONG: + case T_ULONG: + if (ED_IsConstAbsInt (&Expr)) { + /* Make it dword sized */ + Expr.IVal &= 0xFFFFFFFF; + } + DefineData (&Expr); + Size += SIZEOF_LONG; break; - default: - Error ("Illegal type in initialization"); - break; + default: + Error ("Illegal type in initialization"); + break; - } + } - if (CurTok.Tok != TOK_COMMA) { - break; - } - NextToken (); + if (CurTok.Tok != TOK_COMMA) { + break; + } + NextToken (); } while (CurTok.Tok != TOK_RCURLY); @@ -2180,38 +2180,38 @@ static unsigned ParseInitInternal (Type* T, int AllowFlexibleMembers) { switch (UnqualifiedType (T->C)) { - case T_SCHAR: - case T_UCHAR: - case T_SHORT: - case T_USHORT: - case T_INT: - case T_UINT: - case T_LONG: - case T_ULONG: + case T_SCHAR: + case T_UCHAR: + case T_SHORT: + case T_USHORT: + case T_INT: + case T_UINT: + case T_LONG: + case T_ULONG: case T_FLOAT: case T_DOUBLE: return ParseScalarInit (T); - case T_PTR: + case T_PTR: return ParsePointerInit (T); - case T_ARRAY: + case T_ARRAY: return ParseArrayInit (T, AllowFlexibleMembers); case T_STRUCT: case T_UNION: - return ParseStructInit (T, AllowFlexibleMembers); + return ParseStructInit (T, AllowFlexibleMembers); - case T_VOID: - if (IS_Get (&Standard) == STD_CC65) { - /* Special cc65 extension in non ANSI mode */ - return ParseVoidInit (); - } - /* FALLTHROUGH */ + case T_VOID: + if (IS_Get (&Standard) == STD_CC65) { + /* Special cc65 extension in non ANSI mode */ + return ParseVoidInit (); + } + /* FALLTHROUGH */ - default: - Error ("Illegal type"); - return SIZEOF_CHAR; + default: + Error ("Illegal type"); + return SIZEOF_CHAR; } } diff --git a/src/cc65/declare.h b/src/cc65/declare.h index 96cdc40d9..3a21a59d9 100644 --- a/src/cc65/declare.h +++ b/src/cc65/declare.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* declare.h */ +/* declare.h */ /* */ -/* Parse variable and function declarations */ +/* Parse variable and function declarations */ /* */ /* */ /* */ @@ -48,34 +48,34 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Masks for the Flags field in DeclSpec */ -#define DS_DEF_STORAGE 0x0001U /* Default storage class used */ -#define DS_DEF_TYPE 0x0002U /* Default type used */ -#define DS_EXTRA_TYPE 0x0004U /* Extra type declared */ +#define DS_DEF_STORAGE 0x0001U /* Default storage class used */ +#define DS_DEF_TYPE 0x0002U /* Default type used */ +#define DS_EXTRA_TYPE 0x0004U /* Extra type declared */ /* Result of ParseDeclSpec */ typedef struct DeclSpec DeclSpec; struct DeclSpec { - unsigned StorageClass; /* One of the SC_xxx flags */ - Type Type[MAXTYPELEN]; /* Type of the declaration spec */ - unsigned Flags; /* Bitmapped flags */ + unsigned StorageClass; /* One of the SC_xxx flags */ + Type Type[MAXTYPELEN]; /* Type of the declaration spec */ + unsigned Flags; /* Bitmapped flags */ }; /* Result of ParseDecl */ typedef struct Declaration Declaration; struct Declaration { unsigned StorageClass; /* A set of SC_xxx flags */ - Type Type[MAXTYPELEN]; /* The type */ - ident Ident; /* The identifier, if any*/ + Type Type[MAXTYPELEN]; /* The type */ + ident Ident; /* The identifier, if any*/ Collection* Attributes; /* Attributes if any */ /* Working variables */ - unsigned Index; /* Used to build Type */ + unsigned Index; /* Used to build Type */ }; /* Modes for ParseDecl */ @@ -88,7 +88,7 @@ typedef enum { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/declattr.c b/src/cc65/declattr.c index 5110361b7..ac45db221 100644 --- a/src/cc65/declattr.c +++ b/src/cc65/declattr.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* declattr.c */ +/* declattr.c */ /* */ -/* Declaration attributes */ +/* Declaration attributes */ /* */ /* */ /* */ @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -63,8 +63,8 @@ static void UnusedAttr (Declaration* D); /* Attribute table */ typedef struct AttrDesc AttrDesc; struct AttrDesc { - const char Name[15]; - void (*Handler) (Declaration*); + const char Name[15]; + void (*Handler) (Declaration*); }; static const AttrDesc AttrTable [] = { { "__noreturn__", NoReturnAttr }, @@ -111,10 +111,10 @@ static const AttrDesc* FindAttribute (const char* Attr) /* For now do a linear search */ for (A = 0; A < sizeof (AttrTable) / sizeof (AttrTable[0]); ++A) { - if (strcmp (Attr, AttrTable[A].Name) == 0) { - /* Found */ - return AttrTable + A; - } + if (strcmp (Attr, AttrTable[A].Name) == 0) { + /* Found */ + return AttrTable + A; + } } /* Not found */ @@ -182,8 +182,8 @@ void ParseAttribute (Declaration* D) { /* Do we have an attribute? */ if (CurTok.Tok != TOK_ATTRIBUTE) { - /* No attribute, bail out */ - return; + /* No attribute, bail out */ + return; } /* Skip the attribute token */ diff --git a/src/cc65/declattr.h b/src/cc65/declattr.h index d6c8a168b..e3826c77f 100644 --- a/src/cc65/declattr.h +++ b/src/cc65/declattr.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* declattr.h */ +/* declattr.h */ /* */ -/* Declaration attributes */ +/* Declaration attributes */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -49,7 +49,7 @@ struct Declaration; /* Supported attribute types */ typedef enum { - atNoReturn, /* Function does not return */ + atNoReturn, /* Function does not return */ atUnused, /* Symbol is unused - don't warn */ } DeclAttrType; @@ -62,7 +62,7 @@ struct DeclAttr { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/error.c b/src/cc65/error.c index 2fe399702..e15cd22ba 100644 --- a/src/cc65/error.c +++ b/src/cc65/error.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* error.c */ +/* error.c */ /* */ -/* Error handling for the cc65 C compiler */ +/* Error handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -51,14 +51,14 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Count of errors/warnings */ -unsigned ErrorCount = 0; -unsigned WarningCount = 0; +unsigned ErrorCount = 0; +unsigned WarningCount = 0; /* Warning and error options */ IntStack WarnEnable = INTSTACK(1); /* Enable warnings */ @@ -106,11 +106,11 @@ void Fatal (const char* Format, ...) const char* FileName; unsigned LineNum; if (CurTok.LI) { - FileName = GetInputName (CurTok.LI); - LineNum = GetInputLine (CurTok.LI); + FileName = GetInputName (CurTok.LI); + LineNum = GetInputLine (CurTok.LI); } else { - FileName = GetCurrentFile (); - LineNum = GetCurrentLine (); + FileName = GetCurrentFile (); + LineNum = GetCurrentLine (); } fprintf (stderr, "%s(%u): Fatal: ", FileName, LineNum); @@ -136,15 +136,15 @@ void Internal (const char* Format, ...) const char* FileName; unsigned LineNum; if (CurTok.LI) { - FileName = GetInputName (CurTok.LI); - LineNum = GetInputLine (CurTok.LI); + FileName = GetInputName (CurTok.LI); + LineNum = GetInputLine (CurTok.LI); } else { - FileName = GetCurrentFile (); - LineNum = GetCurrentLine (); + FileName = GetCurrentFile (); + LineNum = GetCurrentLine (); } fprintf (stderr, "%s(%u): Internal compiler error:\n", - FileName, LineNum); + FileName, LineNum); va_start (ap, Format); vfprintf (stderr, Format, ap); @@ -179,7 +179,7 @@ static void IntError (const char* Filename, unsigned LineNo, const char* Msg, va } ++ErrorCount; if (ErrorCount > 10) { - Fatal ("Too many errors"); + Fatal ("Too many errors"); } } @@ -234,14 +234,14 @@ static void IntWarning (const char* Filename, unsigned LineNo, const char* Msg, } else if (IS_Get (&WarnEnable)) { - fprintf (stderr, "%s(%u): Warning: ", Filename, LineNo); - vfprintf (stderr, Msg, ap); - fprintf (stderr, "\n"); + fprintf (stderr, "%s(%u): Warning: ", Filename, LineNo); + vfprintf (stderr, Msg, ap); + fprintf (stderr, "\n"); if (Line) { - Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line)); + Print (stderr, 1, "Input: %.*s\n", (int) SB_GetLen (Line), SB_GetConstBuf (Line)); } - ++WarningCount; + ++WarningCount; } } diff --git a/src/cc65/error.h b/src/cc65/error.h index 5830367e1..5811e1b45 100644 --- a/src/cc65/error.h +++ b/src/cc65/error.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* error.h */ +/* error.h */ /* */ -/* Error handling for the cc65 C compiler */ +/* Error handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -74,7 +74,7 @@ extern IntStack WarnUnknownPragma; /* - unknown #pragmas */ /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ diff --git a/src/cc65/expr.c b/src/cc65/expr.c index 9708ebe2c..558967aa2 100644 --- a/src/cc65/expr.c +++ b/src/cc65/expr.c @@ -41,38 +41,38 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Generator attributes */ -#define GEN_NOPUSH 0x01 /* Don't push lhs */ +#define GEN_NOPUSH 0x01 /* Don't push lhs */ #define GEN_COMM 0x02 /* Operator is commutative */ /* Map a generator function and its attributes to a token */ typedef struct { - token_t Tok; /* Token to map to */ - unsigned Flags; /* Flags for generator function */ - void (*Func) (unsigned, unsigned long); /* Generator func */ + token_t Tok; /* Token to map to */ + unsigned Flags; /* Flags for generator function */ + void (*Func) (unsigned, unsigned long); /* Generator func */ } GenDesc; /* Descriptors for the operations */ -static GenDesc GenPASGN = { TOK_PLUS_ASSIGN, GEN_NOPUSH, g_add }; +static GenDesc GenPASGN = { TOK_PLUS_ASSIGN, GEN_NOPUSH, g_add }; static GenDesc GenSASGN = { TOK_MINUS_ASSIGN, GEN_NOPUSH, g_sub }; -static GenDesc GenMASGN = { TOK_MUL_ASSIGN, GEN_NOPUSH, g_mul }; -static GenDesc GenDASGN = { TOK_DIV_ASSIGN, GEN_NOPUSH, g_div }; -static GenDesc GenMOASGN = { TOK_MOD_ASSIGN, GEN_NOPUSH, g_mod }; -static GenDesc GenSLASGN = { TOK_SHL_ASSIGN, GEN_NOPUSH, g_asl }; -static GenDesc GenSRASGN = { TOK_SHR_ASSIGN, GEN_NOPUSH, g_asr }; -static GenDesc GenAASGN = { TOK_AND_ASSIGN, GEN_NOPUSH, g_and }; -static GenDesc GenXOASGN = { TOK_XOR_ASSIGN, GEN_NOPUSH, g_xor }; -static GenDesc GenOASGN = { TOK_OR_ASSIGN, GEN_NOPUSH, g_or }; +static GenDesc GenMASGN = { TOK_MUL_ASSIGN, GEN_NOPUSH, g_mul }; +static GenDesc GenDASGN = { TOK_DIV_ASSIGN, GEN_NOPUSH, g_div }; +static GenDesc GenMOASGN = { TOK_MOD_ASSIGN, GEN_NOPUSH, g_mod }; +static GenDesc GenSLASGN = { TOK_SHL_ASSIGN, GEN_NOPUSH, g_asl }; +static GenDesc GenSRASGN = { TOK_SHR_ASSIGN, GEN_NOPUSH, g_asr }; +static GenDesc GenAASGN = { TOK_AND_ASSIGN, GEN_NOPUSH, g_and }; +static GenDesc GenXOASGN = { TOK_XOR_ASSIGN, GEN_NOPUSH, g_xor }; +static GenDesc GenOASGN = { TOK_OR_ASSIGN, GEN_NOPUSH, g_or }; /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -109,15 +109,15 @@ void ExprWithCheck (void (*Func) (ExprDesc*), ExprDesc* Expr) /* Do some checks if code generation is still constistent */ if (StackPtr != OldSP) { - if (Debug) { - Error ("Code generation messed up: " + if (Debug) { + Error ("Code generation messed up: " "StackPtr is %d, should be %d", StackPtr, OldSP); - } else { - Internal ("Code generation messed up: " + } else { + Internal ("Code generation messed up: " "StackPtr is %d, should be %d", StackPtr, OldSP); - } + } } } @@ -142,21 +142,21 @@ static Type* promoteint (Type* lhst, Type* rhst) { /* Rules for integer types: * - If one of the values is a long, the result is long. - * - If one of the values is unsigned, the result is also unsigned. + * - If one of the values is unsigned, the result is also unsigned. * - Otherwise the result is an int. */ if (IsTypeLong (lhst) || IsTypeLong (rhst)) { - if (IsSignUnsigned (lhst) || IsSignUnsigned (rhst)) { - return type_ulong; - } else { - return type_long; - } + if (IsSignUnsigned (lhst) || IsSignUnsigned (rhst)) { + return type_ulong; + } else { + return type_long; + } } else { - if (IsSignUnsigned (lhst) || IsSignUnsigned (rhst)) { - return type_uint; - } else { - return type_int; - } + if (IsSignUnsigned (lhst) || IsSignUnsigned (rhst)) { + return type_uint; + } else { + return type_int; + } } } @@ -182,15 +182,15 @@ static unsigned typeadjust (ExprDesc* lhs, ExprDesc* rhs, int NoPush) /* Generate type adjustment code if needed */ ltype = TypeOf (lhst); if (ED_IsLocAbs (lhs)) { - ltype |= CF_CONST; + ltype |= CF_CONST; } if (NoPush) { - /* Value is in primary register*/ - ltype |= CF_REG; + /* Value is in primary register*/ + ltype |= CF_REG; } rtype = TypeOf (rhst); if (ED_IsLocAbs (rhs)) { - rtype |= CF_CONST; + rtype |= CF_CONST; } flags = g_typeadjust (ltype, rtype); @@ -207,10 +207,10 @@ static const GenDesc* FindGen (token_t Tok, const GenDesc* Table) /* Find a token in a generator table */ { while (Table->Tok != TOK_INVALID) { - if (Table->Tok == Tok) { - return Table; - } - ++Table; + if (Table->Tok == Tok) { + return Table; + } + ++Table; } return 0; } @@ -232,11 +232,11 @@ static int TypeSpecAhead (void) * c. the next token is a typedef'd type */ return CurTok.Tok == TOK_LPAREN && ( - TokIsType (&NextTok) || + TokIsType (&NextTok) || TokIsTypeQual (&NextTok) || - (NextTok.Tok == TOK_IDENT && - (Entry = FindSym (NextTok.Ident)) != 0 && - SymIsTypeDef (Entry))); + (NextTok.Tok == TOK_IDENT && + (Entry = FindSym (NextTok.Ident)) != 0 && + SymIsTypeDef (Entry))); } @@ -250,8 +250,8 @@ void PushAddr (const ExprDesc* Expr) { /* Get the address on stack if needed */ if (ED_IsLocExpr (Expr)) { - /* Push the address (always a pointer) */ - g_push (CF_PTR, 0); + /* Push the address (always a pointer) */ + g_push (CF_PTR, 0); } } @@ -270,7 +270,7 @@ static void WarnConstCompareResult (void) /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ @@ -286,13 +286,13 @@ static unsigned FunctionParamList (FuncDesc* Func, int IsFastcall) ExprDesc Expr; /* Initialize variables */ - SymEntry* Param = 0; /* Keep gcc silent */ - unsigned ParamSize = 0; /* Size of parameters pushed */ - unsigned ParamCount = 0; /* Number of parameters pushed */ - unsigned FrameSize = 0; /* Size of parameter frame */ - unsigned FrameParams = 0; /* Number of params in frame */ - int FrameOffs = 0; /* Offset into parameter frame */ - int Ellipsis = 0; /* Function is variadic */ + SymEntry* Param = 0; /* Keep gcc silent */ + unsigned ParamSize = 0; /* Size of parameters pushed */ + unsigned ParamCount = 0; /* Number of parameters pushed */ + unsigned FrameSize = 0; /* Size of parameter frame */ + unsigned FrameParams = 0; /* Number of params in frame */ + int FrameOffs = 0; /* Offset into parameter frame */ + int Ellipsis = 0; /* Function is variadic */ /* As an optimization, we may allocate the complete parameter frame at * once instead of pushing each parameter as it comes. We may do that, @@ -309,81 +309,81 @@ static unsigned FunctionParamList (FuncDesc* Func, int IsFastcall) */ if (IS_Get (&CodeSizeFactor) >= 200) { - /* Calculate the number and size of the parameters */ - FrameParams = Func->ParamCount; - FrameSize = Func->ParamSize; - if (FrameParams > 0 && IsFastcall) { - /* Last parameter is not pushed */ - FrameSize -= CheckedSizeOf (Func->LastParam->Type); - --FrameParams; - } + /* Calculate the number and size of the parameters */ + FrameParams = Func->ParamCount; + FrameSize = Func->ParamSize; + if (FrameParams > 0 && IsFastcall) { + /* Last parameter is not pushed */ + FrameSize -= CheckedSizeOf (Func->LastParam->Type); + --FrameParams; + } - /* Do we have more than one parameter in the frame? */ - if (FrameParams > 1) { - /* Okeydokey, setup the frame */ - FrameOffs = StackPtr; - g_space (FrameSize); - StackPtr -= FrameSize; - } else { - /* Don't use a preallocated frame */ - FrameSize = 0; - } + /* Do we have more than one parameter in the frame? */ + if (FrameParams > 1) { + /* Okeydokey, setup the frame */ + FrameOffs = StackPtr; + g_space (FrameSize); + StackPtr -= FrameSize; + } else { + /* Don't use a preallocated frame */ + FrameSize = 0; + } } /* Parse the actual parameter list */ while (CurTok.Tok != TOK_RPAREN) { - unsigned Flags; + unsigned Flags; - /* Count arguments */ - ++ParamCount; + /* Count arguments */ + ++ParamCount; - /* Fetch the pointer to the next argument, check for too many args */ - if (ParamCount <= Func->ParamCount) { - /* Beware: If there are parameters with identical names, they - * cannot go into the same symbol table, which means that in this - * case of errorneous input, the number of nodes in the symbol - * table and ParamCount are NOT equal. We have to handle this case - * below to avoid segmentation violations. Since we know that this - * problem can only occur if there is more than one parameter, - * we will just use the last one. - */ - if (ParamCount == 1) { - /* First argument */ - Param = Func->SymTab->SymHead; - } else if (Param->NextSym != 0) { - /* Next argument */ - Param = Param->NextSym; - CHECK ((Param->Flags & SC_PARAM) != 0); - } - } else if (!Ellipsis) { - /* Too many arguments. Do we have an open param list? */ - if ((Func->Flags & FD_VARIADIC) == 0) { - /* End of param list reached, no ellipsis */ - Error ("Too many arguments in function call"); - } - /* Assume an ellipsis even in case of errors to avoid an error - * message for each other argument. - */ - Ellipsis = 1; - } + /* Fetch the pointer to the next argument, check for too many args */ + if (ParamCount <= Func->ParamCount) { + /* Beware: If there are parameters with identical names, they + * cannot go into the same symbol table, which means that in this + * case of errorneous input, the number of nodes in the symbol + * table and ParamCount are NOT equal. We have to handle this case + * below to avoid segmentation violations. Since we know that this + * problem can only occur if there is more than one parameter, + * we will just use the last one. + */ + if (ParamCount == 1) { + /* First argument */ + Param = Func->SymTab->SymHead; + } else if (Param->NextSym != 0) { + /* Next argument */ + Param = Param->NextSym; + CHECK ((Param->Flags & SC_PARAM) != 0); + } + } else if (!Ellipsis) { + /* Too many arguments. Do we have an open param list? */ + if ((Func->Flags & FD_VARIADIC) == 0) { + /* End of param list reached, no ellipsis */ + Error ("Too many arguments in function call"); + } + /* Assume an ellipsis even in case of errors to avoid an error + * message for each other argument. + */ + Ellipsis = 1; + } /* Evaluate the parameter expression */ hie1 (&Expr); - /* If we don't have an argument spec, accept anything, otherwise - * convert the actual argument to the type needed. - */ + /* If we don't have an argument spec, accept anything, otherwise + * convert the actual argument to the type needed. + */ Flags = CF_NONE; - if (!Ellipsis) { + if (!Ellipsis) { - /* Convert the argument to the parameter type if needed */ + /* Convert the argument to the parameter type if needed */ TypeConversion (&Expr, Param->Type); - /* If we have a prototype, chars may be pushed as chars */ - Flags |= CF_FORCECHAR; + /* If we have a prototype, chars may be pushed as chars */ + Flags |= CF_FORCECHAR; - } else { + } else { /* No prototype available. Convert array to "pointer to first * element", and function to "pointer to function". @@ -395,14 +395,14 @@ static unsigned FunctionParamList (FuncDesc* Func, int IsFastcall) /* Load the value into the primary if it is not already there */ LoadExpr (Flags, &Expr); - /* Use the type of the argument for the push */ - Flags |= TypeOf (Expr.Type); + /* Use the type of the argument for the push */ + Flags |= TypeOf (Expr.Type); - /* If this is a fastcall function, don't push the last argument */ - if (ParamCount != Func->ParamCount || !IsFastcall) { - unsigned ArgSize = sizeofarg (Flags); - if (FrameSize > 0) { - /* We have the space already allocated, store in the frame. + /* If this is a fastcall function, don't push the last argument */ + if (ParamCount != Func->ParamCount || !IsFastcall) { + unsigned ArgSize = sizeofarg (Flags); + if (FrameSize > 0) { + /* We have the space already allocated, store in the frame. * Because of invalid type conversions (that have produced an * error before), we can end up here with a non aligned stack * frame. Since no output will be generated anyway, handle @@ -413,28 +413,28 @@ static unsigned FunctionParamList (FuncDesc* Func, int IsFastcall) } else { FrameSize = 0; } - FrameOffs -= ArgSize; - /* Store */ - g_putlocal (Flags | CF_NOKEEP, FrameOffs, Expr.IVal); - } else { - /* Push the argument */ - g_push (Flags, Expr.IVal); - } + FrameOffs -= ArgSize; + /* Store */ + g_putlocal (Flags | CF_NOKEEP, FrameOffs, Expr.IVal); + } else { + /* Push the argument */ + g_push (Flags, Expr.IVal); + } - /* Calculate total parameter size */ - ParamSize += ArgSize; - } + /* Calculate total parameter size */ + ParamSize += ArgSize; + } - /* Check for end of argument list */ - if (CurTok.Tok != TOK_COMMA) { - break; - } - NextToken (); + /* Check for end of argument list */ + if (CurTok.Tok != TOK_COMMA) { + break; + } + NextToken (); } /* Check if we had enough parameters */ if (ParamCount < Func->ParamCount) { - Error ("Too few arguments in function call"); + Error ("Too few arguments in function call"); } /* The function returns the size of all parameters pushed onto the stack. @@ -453,10 +453,10 @@ static unsigned FunctionParamList (FuncDesc* Func, int IsFastcall) static void FunctionCall (ExprDesc* Expr) /* Perform a function call. */ { - FuncDesc* Func; /* Function descriptor */ + FuncDesc* Func; /* Function descriptor */ int IsFuncPtr; /* Flag */ - unsigned ParamSize; /* Number of parameter bytes */ - CodeMark Mark; + unsigned ParamSize; /* Number of parameter bytes */ + CodeMark Mark; int PtrOffs = 0; /* Offset of function pointer on stack */ int IsFastcall = 0; /* True if it's a fast call function */ int PtrOnStack = 0; /* True if a pointer copy is on stack */ @@ -471,33 +471,33 @@ static void FunctionCall (ExprDesc* Expr) IsFuncPtr = IsTypeFuncPtr (Expr->Type); if (IsFuncPtr) { - /* Check wether it's a fastcall function that has parameters */ - IsFastcall = IsQualFastcall (Expr->Type + 1) && (Func->ParamCount > 0); + /* Check wether it's a fastcall function that has parameters */ + IsFastcall = IsQualFastcall (Expr->Type + 1) && (Func->ParamCount > 0); - /* Things may be difficult, depending on where the function pointer - * resides. If the function pointer is an expression of some sort - * (not a local or global variable), we have to evaluate this - * expression now and save the result for later. Since calls to - * function pointers may be nested, we must save it onto the stack. - * For fastcall functions we do also need to place a copy of the - * pointer on stack, since we cannot use a/x. - */ - PtrOnStack = IsFastcall || !ED_IsConst (Expr); - if (PtrOnStack) { + /* Things may be difficult, depending on where the function pointer + * resides. If the function pointer is an expression of some sort + * (not a local or global variable), we have to evaluate this + * expression now and save the result for later. Since calls to + * function pointers may be nested, we must save it onto the stack. + * For fastcall functions we do also need to place a copy of the + * pointer on stack, since we cannot use a/x. + */ + PtrOnStack = IsFastcall || !ED_IsConst (Expr); + if (PtrOnStack) { - /* Not a global or local variable, or a fastcall function. Load - * the pointer into the primary and mark it as an expression. - */ - LoadExpr (CF_NONE, Expr); - ED_MakeRValExpr (Expr); + /* Not a global or local variable, or a fastcall function. Load + * the pointer into the primary and mark it as an expression. + */ + LoadExpr (CF_NONE, Expr); + ED_MakeRValExpr (Expr); - /* Remember the code position */ - GetCodePos (&Mark); + /* Remember the code position */ + GetCodePos (&Mark); - /* Push the pointer onto the stack and remember the offset */ - g_push (CF_PTR, 0); - PtrOffs = StackPtr; - } + /* Push the pointer onto the stack and remember the offset */ + g_push (CF_PTR, 0); + PtrOffs = StackPtr; + } } else { /* Check function attributes */ @@ -529,55 +529,55 @@ static void FunctionCall (ExprDesc* Expr) /* Special handling for function pointers */ if (IsFuncPtr) { - /* If the function is not a fastcall function, load the pointer to - * the function into the primary. - */ - if (!IsFastcall) { + /* If the function is not a fastcall function, load the pointer to + * the function into the primary. + */ + if (!IsFastcall) { - /* Not a fastcall function - we may use the primary */ - if (PtrOnStack) { - /* If we have no parameters, the pointer is still in the - * primary. Remove the code to push it and correct the - * stack pointer. - */ - if (ParamSize == 0) { - RemoveCode (&Mark); - PtrOnStack = 0; - } else { - /* Load from the saved copy */ - g_getlocal (CF_PTR, PtrOffs); - } - } else { - /* Load from original location */ - LoadExpr (CF_NONE, Expr); - } + /* Not a fastcall function - we may use the primary */ + if (PtrOnStack) { + /* If we have no parameters, the pointer is still in the + * primary. Remove the code to push it and correct the + * stack pointer. + */ + if (ParamSize == 0) { + RemoveCode (&Mark); + PtrOnStack = 0; + } else { + /* Load from the saved copy */ + g_getlocal (CF_PTR, PtrOffs); + } + } else { + /* Load from original location */ + LoadExpr (CF_NONE, Expr); + } - /* Call the function */ - g_callind (TypeOf (Expr->Type+1), ParamSize, PtrOffs); + /* Call the function */ + g_callind (TypeOf (Expr->Type+1), ParamSize, PtrOffs); - } else { + } else { - /* Fastcall function. We cannot use the primary for the function - * pointer and must therefore use an offset to the stack location. - * Since fastcall functions may never be variadic, we can use the - * index register for this purpose. - */ - g_callind (CF_LOCAL, ParamSize, PtrOffs); - } + /* Fastcall function. We cannot use the primary for the function + * pointer and must therefore use an offset to the stack location. + * Since fastcall functions may never be variadic, we can use the + * index register for this purpose. + */ + g_callind (CF_LOCAL, ParamSize, PtrOffs); + } - /* If we have a pointer on stack, remove it */ - if (PtrOnStack) { - g_drop (SIZEOF_PTR); - pop (CF_PTR); - } + /* If we have a pointer on stack, remove it */ + if (PtrOnStack) { + g_drop (SIZEOF_PTR); + pop (CF_PTR); + } - /* Skip T_PTR */ - ++Expr->Type; + /* Skip T_PTR */ + ++Expr->Type; } else { - /* Normal function */ - g_call (TypeOf (Expr->Type), (const char*) Expr->Name, ParamSize); + /* Normal function */ + g_call (TypeOf (Expr->Type), (const char*) Expr->Name, ParamSize); } @@ -598,11 +598,11 @@ static void Primary (ExprDesc* E) /* Character and integer constants. */ if (CurTok.Tok == TOK_ICONST || CurTok.Tok == TOK_CCONST) { - E->IVal = CurTok.IVal; - E->Flags = E_LOC_ABS | E_RTYPE_RVAL; - E->Type = CurTok.Type; - NextToken (); - return; + E->IVal = CurTok.IVal; + E->Flags = E_LOC_ABS | E_RTYPE_RVAL; + E->Type = CurTok.Type; + NextToken (); + return; } /* Floating point constant */ @@ -618,17 +618,17 @@ static void Primary (ExprDesc* E) * recursively. */ if (CurTok.Tok == TOK_LPAREN) { - NextToken (); + NextToken (); hie0 (E); - ConsumeRParen (); - return; + ConsumeRParen (); + return; } /* If we run into an identifier in preprocessing mode, we assume that this * is an undefined macro and replace it by a constant value of zero. */ if (Preprocessing && CurTok.Tok == TOK_IDENT) { - NextToken (); + NextToken (); ED_MakeConstAbsInt (E, 0); return; } @@ -637,10 +637,10 @@ static void Primary (ExprDesc* E) * recursively by the preprocessor. */ if (Preprocessing) { - /* Illegal expression in PP mode */ - Error ("Preprocessor expression expected"); - ED_MakeConstAbsInt (E, 1); - return; + /* Illegal expression in PP mode */ + Error ("Preprocessor expression expected"); + ED_MakeConstAbsInt (E, 1); + return; } switch (CurTok.Tok) { @@ -839,15 +839,15 @@ static void ArrayRef (ExprDesc* Expr) /* If we have a constant base, we delay the address fetch */ GetCodePos (&Mark1); if (!ConstBaseAddr) { - /* Get a pointer to the array into the primary */ - LoadExpr (CF_NONE, Expr); + /* Get a pointer to the array into the primary */ + LoadExpr (CF_NONE, Expr); - /* Get the array pointer on stack. Do not push more than 16 - * bit, even if this value is greater, since we cannot handle - * other than 16bit stuff when doing indexing. - */ - GetCodePos (&Mark2); - g_push (CF_PTR, 0); + /* Get the array pointer on stack. Do not push more than 16 + * bit, even if this value is greater, since we cannot handle + * other than 16bit stuff when doing indexing. + */ + GetCodePos (&Mark2); + g_push (CF_PTR, 0); } /* TOS now contains ptr to array elements. Get the subscript. */ @@ -909,23 +909,23 @@ static void ArrayRef (ExprDesc* Expr) /* Check if the subscript is constant absolute value */ if (ED_IsConstAbs (&Subscript) && ED_CodeRangeIsEmpty (&Subscript)) { - /* The array subscript is a numeric constant. If we had pushed the + /* The array subscript is a numeric constant. If we had pushed the * array base address onto the stack before, we can remove this value, * since we can generate expression+offset. */ - if (!ConstBaseAddr) { - RemoveCode (&Mark2); - } else { - /* Get an array pointer into the primary */ - LoadExpr (CF_NONE, Expr); - } + if (!ConstBaseAddr) { + RemoveCode (&Mark2); + } else { + /* Get an array pointer into the primary */ + LoadExpr (CF_NONE, Expr); + } - if (IsClassPtr (Expr->Type)) { + if (IsClassPtr (Expr->Type)) { - /* Lhs is pointer/array. Scale the subscript value according to + /* Lhs is pointer/array. Scale the subscript value according to * the element size. */ - Subscript.IVal *= CheckedSizeOf (ElementType); + Subscript.IVal *= CheckedSizeOf (ElementType); /* Remove the address load code */ RemoveCode (&Mark1); @@ -953,10 +953,10 @@ static void ArrayRef (ExprDesc* Expr) Expr->IVal = Subscript.IVal; } - } else { + } else { - /* Scale the rhs value according to the element type */ - g_scale (TypeOf (tptr1), CheckedSizeOf (ElementType)); + /* Scale the rhs value according to the element type */ + g_scale (TypeOf (tptr1), CheckedSizeOf (ElementType)); /* Add the subscript. Since arrays are indexed by integers, * we will ignore the true type of the subscript here and @@ -964,117 +964,117 @@ static void ArrayRef (ExprDesc* Expr) */ g_inc (CF_INT | CF_CONST, Subscript.IVal); - } + } } else { - /* Array subscript is not constant. Load it into the primary */ - GetCodePos (&Mark2); + /* Array subscript is not constant. Load it into the primary */ + GetCodePos (&Mark2); LoadExpr (CF_NONE, &Subscript); /* Do scaling */ - if (IsClassPtr (Expr->Type)) { + if (IsClassPtr (Expr->Type)) { - /* Indexing is based on unsigneds, so we will just use the integer - * portion of the index (which is in (e)ax, so there's no further - * action required). - */ - g_scale (CF_INT, CheckedSizeOf (ElementType)); + /* Indexing is based on unsigneds, so we will just use the integer + * portion of the index (which is in (e)ax, so there's no further + * action required). + */ + g_scale (CF_INT, CheckedSizeOf (ElementType)); - } else { + } else { - /* Get the int value on top. If we come here, we're sure, both + /* Get the int value on top. If we come here, we're sure, both * values are 16 bit (the first one was truncated if necessary * and the second one is a pointer). Note: If ConstBaseAddr is * true, we don't have a value on stack, so to "swap" both, just * push the subscript. - */ - if (ConstBaseAddr) { - g_push (CF_INT, 0); - LoadExpr (CF_NONE, Expr); - ConstBaseAddr = 0; - } else { - g_swap (CF_INT); - } + */ + if (ConstBaseAddr) { + g_push (CF_INT, 0); + LoadExpr (CF_NONE, Expr); + ConstBaseAddr = 0; + } else { + g_swap (CF_INT); + } - /* Scale it */ - g_scale (TypeOf (tptr1), CheckedSizeOf (ElementType)); + /* Scale it */ + g_scale (TypeOf (tptr1), CheckedSizeOf (ElementType)); - } + } - /* The offset is now in the primary register. It we didn't have a - * constant base address for the lhs, the lhs address is already - * on stack, and we must add the offset. If the base address was - * constant, we call special functions to add the address to the - * offset value. - */ - if (!ConstBaseAddr) { + /* The offset is now in the primary register. It we didn't have a + * constant base address for the lhs, the lhs address is already + * on stack, and we must add the offset. If the base address was + * constant, we call special functions to add the address to the + * offset value. + */ + if (!ConstBaseAddr) { - /* The array base address is on stack and the subscript is in the + /* The array base address is on stack and the subscript is in the * primary. Add both. */ - g_add (CF_INT, 0); + g_add (CF_INT, 0); - } else { + } else { /* The subscript is in the primary, and the array base address is * in Expr. If the subscript has itself a constant address, it is * often a better idea to reverse again the order of the * evaluation. This will generate better code if the subscript is * a byte sized variable. But beware: This is only possible if the - * subscript was not scaled, that is, if this was a byte array - * or pointer. - */ + * subscript was not scaled, that is, if this was a byte array + * or pointer. + */ if ((ED_IsLocConst (&Subscript) || ED_IsLocStack (&Subscript)) && CheckedSizeOf (ElementType) == SIZEOF_CHAR) { unsigned Flags; - /* Reverse the order of evaluation */ + /* Reverse the order of evaluation */ if (CheckedSizeOf (Subscript.Type) == SIZEOF_CHAR) { Flags = CF_CHAR; } else { Flags = CF_INT; } - RemoveCode (&Mark2); + RemoveCode (&Mark2); - /* Get a pointer to the array into the primary. */ - LoadExpr (CF_NONE, Expr); + /* Get a pointer to the array into the primary. */ + LoadExpr (CF_NONE, Expr); - /* Add the variable */ - if (ED_IsLocStack (&Subscript)) { - g_addlocal (Flags, Subscript.IVal); - } else { - Flags |= GlobalModeFlags (&Subscript); - g_addstatic (Flags, Subscript.Name, Subscript.IVal); - } - } else { + /* Add the variable */ + if (ED_IsLocStack (&Subscript)) { + g_addlocal (Flags, Subscript.IVal); + } else { + Flags |= GlobalModeFlags (&Subscript); + g_addstatic (Flags, Subscript.Name, Subscript.IVal); + } + } else { - if (ED_IsLocAbs (Expr)) { - /* Constant numeric address. Just add it */ - g_inc (CF_INT, Expr->IVal); - } else if (ED_IsLocStack (Expr)) { - /* Base address is a local variable address */ - if (IsTypeArray (Expr->Type)) { - g_addaddr_local (CF_INT, Expr->IVal); - } else { - g_addlocal (CF_PTR, Expr->IVal); - } - } else { - /* Base address is a static variable address */ - unsigned Flags = CF_INT | GlobalModeFlags (Expr); + if (ED_IsLocAbs (Expr)) { + /* Constant numeric address. Just add it */ + g_inc (CF_INT, Expr->IVal); + } else if (ED_IsLocStack (Expr)) { + /* Base address is a local variable address */ + if (IsTypeArray (Expr->Type)) { + g_addaddr_local (CF_INT, Expr->IVal); + } else { + g_addlocal (CF_PTR, Expr->IVal); + } + } else { + /* Base address is a static variable address */ + unsigned Flags = CF_INT | GlobalModeFlags (Expr); if (ED_IsRVal (Expr)) { /* Add the address of the location */ - g_addaddr_static (Flags, Expr->Name, Expr->IVal); - } else { + g_addaddr_static (Flags, Expr->Name, Expr->IVal); + } else { /* Add the contents of the location */ - g_addstatic (Flags, Expr->Name, Expr->IVal); - } - } - } + g_addstatic (Flags, Expr->Name, Expr->IVal); + } + } + } - } + } /* The result is an expression in the primary */ ED_MakeRValExpr (Expr); @@ -1112,7 +1112,7 @@ static void StructRef (ExprDesc* Expr) /* Skip the token and check for an identifier */ NextToken (); if (CurTok.Tok != TOK_IDENT) { - Error ("Identifier expected"); + Error ("Identifier expected"); /* Make the expression an integer at address zero */ ED_MakeConstAbs (Expr, 0, type_int); return; @@ -1123,10 +1123,10 @@ static void StructRef (ExprDesc* Expr) NextToken (); Field = FindStructField (Expr->Type, Ident); if (Field == 0) { - Error ("Struct/union has no field named `%s'", Ident); + Error ("Struct/union has no field named `%s'", Ident); /* Make the expression an integer at address zero */ ED_MakeConstAbs (Expr, 0, type_int); - return; + return; } /* If we have a struct pointer that is an lvalue and not already in the @@ -1366,8 +1366,8 @@ static void PreInc (ExprDesc* Expr) /* Evaluate the expression and check that it is an lvalue */ hie10 (Expr); if (!ED_IsLVal (Expr)) { - Error ("Invalid lvalue"); - return; + Error ("Invalid lvalue"); + return; } /* We cannot modify const values */ @@ -1442,8 +1442,8 @@ static void PreDec (ExprDesc* Expr) /* Evaluate the expression and check that it is an lvalue */ hie10 (Expr); if (!ED_IsLVal (Expr)) { - Error ("Invalid lvalue"); - return; + Error ("Invalid lvalue"); + return; } /* We cannot modify const values */ @@ -1515,8 +1515,8 @@ static void PostInc (ExprDesc* Expr) /* The expression to increment must be an lvalue */ if (!ED_IsLVal (Expr)) { - Error ("Invalid lvalue"); - return; + Error ("Invalid lvalue"); + return; } /* We cannot modify const values */ @@ -1536,9 +1536,9 @@ static void PostInc (ExprDesc* Expr) /* If we have a pointer expression, increment by the size of the type */ if (IsTypePtr (Expr->Type)) { - g_inc (Flags | CF_CONST | CF_FORCECHAR, CheckedSizeOf (Expr->Type + 1)); + g_inc (Flags | CF_CONST | CF_FORCECHAR, CheckedSizeOf (Expr->Type + 1)); } else { - g_inc (Flags | CF_CONST | CF_FORCECHAR, 1); + g_inc (Flags | CF_CONST | CF_FORCECHAR, 1); } /* Store the result back */ @@ -1562,8 +1562,8 @@ static void PostDec (ExprDesc* Expr) /* The expression to increment must be an lvalue */ if (!ED_IsLVal (Expr)) { - Error ("Invalid lvalue"); - return; + Error ("Invalid lvalue"); + return; } /* We cannot modify const values */ @@ -1583,9 +1583,9 @@ static void PostDec (ExprDesc* Expr) /* If we have a pointer expression, increment by the size of the type */ if (IsTypePtr (Expr->Type)) { - g_dec (Flags | CF_CONST | CF_FORCECHAR, CheckedSizeOf (Expr->Type + 1)); + g_dec (Flags | CF_CONST | CF_FORCECHAR, CheckedSizeOf (Expr->Type + 1)); } else { - g_dec (Flags | CF_CONST | CF_FORCECHAR, 1); + g_dec (Flags | CF_CONST | CF_FORCECHAR, 1); } /* Store the result back */ @@ -1620,27 +1620,27 @@ static void UnaryOp (ExprDesc* Expr) /* Check for a constant expression */ if (ED_IsConstAbs (Expr)) { - /* Value is constant */ - switch (Tok) { - case TOK_MINUS: Expr->IVal = -Expr->IVal; break; - case TOK_PLUS: break; - case TOK_COMP: Expr->IVal = ~Expr->IVal; break; - default: Internal ("Unexpected token: %d", Tok); - } + /* Value is constant */ + switch (Tok) { + case TOK_MINUS: Expr->IVal = -Expr->IVal; break; + case TOK_PLUS: break; + case TOK_COMP: Expr->IVal = ~Expr->IVal; break; + default: Internal ("Unexpected token: %d", Tok); + } } else { - /* Value is not constant */ - LoadExpr (CF_NONE, Expr); + /* Value is not constant */ + LoadExpr (CF_NONE, Expr); - /* Get the type of the expression */ - Flags = TypeOf (Expr->Type); + /* Get the type of the expression */ + Flags = TypeOf (Expr->Type); - /* Handle the operation */ - switch (Tok) { - case TOK_MINUS: g_neg (Flags); break; - case TOK_PLUS: break; - case TOK_COMP: g_com (Flags); break; - default: Internal ("Unexpected token: %d", Tok); - } + /* Handle the operation */ + switch (Tok) { + case TOK_MINUS: g_neg (Flags); break; + case TOK_PLUS: break; + case TOK_COMP: g_com (Flags); break; + default: Internal ("Unexpected token: %d", Tok); + } /* The result is a rvalue in the primary */ ED_MakeRValExpr (Expr); @@ -1656,34 +1656,34 @@ void hie10 (ExprDesc* Expr) switch (CurTok.Tok) { - case TOK_INC: - PreInc (Expr); - break; + case TOK_INC: + PreInc (Expr); + break; - case TOK_DEC: - PreDec (Expr); - break; + case TOK_DEC: + PreDec (Expr); + break; - case TOK_PLUS: - case TOK_MINUS: - case TOK_COMP: - UnaryOp (Expr); - break; + case TOK_PLUS: + case TOK_MINUS: + case TOK_COMP: + UnaryOp (Expr); + break; - case TOK_BOOL_NOT: - NextToken (); - if (evalexpr (CF_NONE, hie10, Expr) == 0) { - /* Constant expression */ - Expr->IVal = !Expr->IVal; - } else { - g_bneg (TypeOf (Expr->Type)); + case TOK_BOOL_NOT: + NextToken (); + if (evalexpr (CF_NONE, hie10, Expr) == 0) { + /* Constant expression */ + Expr->IVal = !Expr->IVal; + } else { + g_bneg (TypeOf (Expr->Type)); ED_MakeRValExpr (Expr); - ED_TestDone (Expr); /* bneg will set cc */ - } - break; + ED_TestDone (Expr); /* bneg will set cc */ + } + break; - case TOK_STAR: - NextToken (); + case TOK_STAR: + NextToken (); ExprWithCheck (hie10, Expr); if (ED_IsLVal (Expr) || !(ED_IsLocConst (Expr) || ED_IsLocStack (Expr))) { /* Not a const, load it into the primary and make it a @@ -1712,13 +1712,13 @@ void hie10 (ExprDesc* Expr) } break; - case TOK_AND: - NextToken (); - ExprWithCheck (hie10, Expr); - /* The & operator may be applied to any lvalue, and it may be - * applied to functions, even if they're no lvalues. - */ - if (ED_IsRVal (Expr) && !IsTypeFunc (Expr->Type) && !IsTypeArray (Expr->Type)) { + case TOK_AND: + NextToken (); + ExprWithCheck (hie10, Expr); + /* The & operator may be applied to any lvalue, and it may be + * applied to functions, even if they're no lvalues. + */ + if (ED_IsRVal (Expr) && !IsTypeFunc (Expr->Type) && !IsTypeArray (Expr->Type)) { Error ("Illegal address"); } else { if (ED_IsBitField (Expr)) { @@ -1729,21 +1729,21 @@ void hie10 (ExprDesc* Expr) Expr->Type = PointerTo (Expr->Type); /* The & operator yields an rvalue */ ED_MakeRVal (Expr); - } - break; + } + break; - case TOK_SIZEOF: - NextToken (); - if (TypeSpecAhead ()) { - Type T[MAXTYPELEN]; - NextToken (); - Size = CheckedSizeOf (ParseType (T)); - ConsumeRParen (); - } else { - /* Remember the output queue pointer */ - CodeMark Mark; + case TOK_SIZEOF: + NextToken (); + if (TypeSpecAhead ()) { + Type T[MAXTYPELEN]; + NextToken (); + Size = CheckedSizeOf (ParseType (T)); + ConsumeRParen (); + } else { + /* Remember the output queue pointer */ + CodeMark Mark; GetCodePos (&Mark); - hie10 (Expr); + hie10 (Expr); /* If the expression is a literal string, release it, so it * won't be output as data if not used elsewhere. */ @@ -1751,21 +1751,21 @@ void hie10 (ExprDesc* Expr) ReleaseLiteral (Expr->LVal); } /* Calculate the size */ - Size = CheckedSizeOf (Expr->Type); - /* Remove any generated code */ - RemoveCode (&Mark); - } + Size = CheckedSizeOf (Expr->Type); + /* Remove any generated code */ + RemoveCode (&Mark); + } ED_MakeConstAbs (Expr, Size, type_size_t); - ED_MarkAsUntested (Expr); - break; + ED_MarkAsUntested (Expr); + break; - default: - if (TypeSpecAhead ()) { + default: + if (TypeSpecAhead ()) { - /* A typecast */ - TypeCast (Expr); + /* A typecast */ + TypeCast (Expr); - } else { + } else { /* An expression */ hie11 (Expr); @@ -1785,19 +1785,19 @@ void hie10 (ExprDesc* Expr) static void hie_internal (const GenDesc* Ops, /* List of generators */ - ExprDesc* Expr, - void (*hienext) (ExprDesc*), - int* UsedGen) + ExprDesc* Expr, + void (*hienext) (ExprDesc*), + int* UsedGen) /* Helper function */ { ExprDesc Expr2; CodeMark Mark1; CodeMark Mark2; const GenDesc* Gen; - token_t Tok; /* The operator token */ + token_t Tok; /* The operator token */ unsigned ltype, type; int lconst; /* Left operand is a constant */ - int rconst; /* Right operand is a constant */ + int rconst; /* Right operand is a constant */ ExprWithCheck (hienext, Expr); @@ -1805,41 +1805,41 @@ static void hie_internal (const GenDesc* Ops, /* List of generators */ *UsedGen = 0; while ((Gen = FindGen (CurTok.Tok, Ops)) != 0) { - /* Tell the caller that we handled it's ops */ - *UsedGen = 1; + /* Tell the caller that we handled it's ops */ + *UsedGen = 1; - /* All operators that call this function expect an int on the lhs */ - if (!IsClassInt (Expr->Type)) { - Error ("Integer expression expected"); + /* All operators that call this function expect an int on the lhs */ + if (!IsClassInt (Expr->Type)) { + Error ("Integer expression expected"); /* To avoid further errors, make Expr a valid int expression */ ED_MakeConstAbsInt (Expr, 1); - } + } - /* Remember the operator token, then skip it */ - Tok = CurTok.Tok; - NextToken (); + /* Remember the operator token, then skip it */ + Tok = CurTok.Tok; + NextToken (); - /* Get the lhs on stack */ - GetCodePos (&Mark1); - ltype = TypeOf (Expr->Type); - lconst = ED_IsConstAbs (Expr); + /* Get the lhs on stack */ + GetCodePos (&Mark1); + ltype = TypeOf (Expr->Type); + lconst = ED_IsConstAbs (Expr); if (lconst) { - /* Constant value */ - GetCodePos (&Mark2); + /* Constant value */ + GetCodePos (&Mark2); /* If the operator is commutative, don't push the left side, if * it's a constant, since we will exchange both operands. */ if ((Gen->Flags & GEN_COMM) == 0) { g_push (ltype | CF_CONST, Expr->IVal); } - } else { - /* Value not constant */ - LoadExpr (CF_NONE, Expr); - GetCodePos (&Mark2); - g_push (ltype, 0); - } + } else { + /* Value not constant */ + LoadExpr (CF_NONE, Expr); + GetCodePos (&Mark2); + g_push (ltype, 0); + } - /* Get the right hand side */ + /* Get the right hand side */ MarkedExprWithCheck (hienext, &Expr2); /* Check for a constant expression */ @@ -1849,19 +1849,19 @@ static void hie_internal (const GenDesc* Ops, /* List of generators */ LoadExpr (CF_NONE, &Expr2); } - /* Check the type of the rhs */ - if (!IsClassInt (Expr2.Type)) { - Error ("Integer expression expected"); - } + /* Check the type of the rhs */ + if (!IsClassInt (Expr2.Type)) { + Error ("Integer expression expected"); + } - /* Check for const operands */ + /* Check for const operands */ if (lconst && rconst) { - /* Both operands are constant, remove the generated code */ - RemoveCode (&Mark1); + /* Both operands are constant, remove the generated code */ + RemoveCode (&Mark1); - /* Get the type of the result */ - Expr->Type = promoteint (Expr->Type, Expr2.Type); + /* Get the type of the result */ + Expr->Type = promoteint (Expr->Type, Expr2.Type); /* Handle the op differently for signed and unsigned types */ if (IsSignSigned (Expr->Type)) { @@ -1948,64 +1948,64 @@ static void hie_internal (const GenDesc* Ops, /* List of generators */ * operation because this allows for better code. */ unsigned rtype = ltype | CF_CONST; - ltype = TypeOf (Expr2.Type); /* Expr2 is now left */ - type = CF_CONST; + ltype = TypeOf (Expr2.Type); /* Expr2 is now left */ + type = CF_CONST; if ((Gen->Flags & GEN_NOPUSH) == 0) { g_push (ltype, 0); - ltype |= CF_REG; /* Value is in register */ + ltype |= CF_REG; /* Value is in register */ } - /* Determine the type of the operation result. */ - type |= g_typeadjust (ltype, rtype); - Expr->Type = promoteint (Expr->Type, Expr2.Type); + /* Determine the type of the operation result. */ + type |= g_typeadjust (ltype, rtype); + Expr->Type = promoteint (Expr->Type, Expr2.Type); - /* Generate code */ - Gen->Func (type, Expr->IVal); + /* Generate code */ + Gen->Func (type, Expr->IVal); /* We have a rvalue in the primary now */ - ED_MakeRValExpr (Expr); + ED_MakeRValExpr (Expr); - } else { + } else { - /* If the right hand side is constant, and the generator function - * expects the lhs in the primary, remove the push of the primary - * now. - */ - unsigned rtype = TypeOf (Expr2.Type); - type = 0; - if (rconst) { - /* Second value is constant - check for div */ - type |= CF_CONST; - rtype |= CF_CONST; - if (Tok == TOK_DIV && Expr2.IVal == 0) { - Error ("Division by zero"); - } else if (Tok == TOK_MOD && Expr2.IVal == 0) { - Error ("Modulo operation with zero"); - } - if ((Gen->Flags & GEN_NOPUSH) != 0) { - RemoveCode (&Mark2); - ltype |= CF_REG; /* Value is in register */ - } - } + /* If the right hand side is constant, and the generator function + * expects the lhs in the primary, remove the push of the primary + * now. + */ + unsigned rtype = TypeOf (Expr2.Type); + type = 0; + if (rconst) { + /* Second value is constant - check for div */ + type |= CF_CONST; + rtype |= CF_CONST; + if (Tok == TOK_DIV && Expr2.IVal == 0) { + Error ("Division by zero"); + } else if (Tok == TOK_MOD && Expr2.IVal == 0) { + Error ("Modulo operation with zero"); + } + if ((Gen->Flags & GEN_NOPUSH) != 0) { + RemoveCode (&Mark2); + ltype |= CF_REG; /* Value is in register */ + } + } - /* Determine the type of the operation result. */ - type |= g_typeadjust (ltype, rtype); - Expr->Type = promoteint (Expr->Type, Expr2.Type); + /* Determine the type of the operation result. */ + type |= g_typeadjust (ltype, rtype); + Expr->Type = promoteint (Expr->Type, Expr2.Type); - /* Generate code */ - Gen->Func (type, Expr2.IVal); + /* Generate code */ + Gen->Func (type, Expr2.IVal); /* We have a rvalue in the primary now */ - ED_MakeRValExpr (Expr); - } + ED_MakeRValExpr (Expr); + } } } static void hie_compare (const GenDesc* Ops, /* List of generators */ - ExprDesc* Expr, - void (*hienext) (ExprDesc*)) + ExprDesc* Expr, + void (*hienext) (ExprDesc*)) /* Helper function for the compare operators */ { ExprDesc Expr2; @@ -2013,9 +2013,9 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */ CodeMark Mark1; CodeMark Mark2; const GenDesc* Gen; - token_t Tok; /* The operator token */ + token_t Tok; /* The operator token */ unsigned ltype; - int rconst; /* Operand is a constant */ + int rconst; /* Operand is a constant */ GetCodePos (&Mark0); @@ -2026,25 +2026,25 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */ /* Remember the generator function */ void (*GenFunc) (unsigned, unsigned long) = Gen->Func; - /* Remember the operator token, then skip it */ - Tok = CurTok.Tok; - NextToken (); + /* Remember the operator token, then skip it */ + Tok = CurTok.Tok; + NextToken (); - /* Get the lhs on stack */ - GetCodePos (&Mark1); - ltype = TypeOf (Expr->Type); - if (ED_IsConstAbs (Expr)) { - /* Constant value */ - GetCodePos (&Mark2); - g_push (ltype | CF_CONST, Expr->IVal); - } else { - /* Value not constant */ - LoadExpr (CF_NONE, Expr); - GetCodePos (&Mark2); - g_push (ltype, 0); - } + /* Get the lhs on stack */ + GetCodePos (&Mark1); + ltype = TypeOf (Expr->Type); + if (ED_IsConstAbs (Expr)) { + /* Constant value */ + GetCodePos (&Mark2); + g_push (ltype | CF_CONST, Expr->IVal); + } else { + /* Value not constant */ + LoadExpr (CF_NONE, Expr); + GetCodePos (&Mark2); + g_push (ltype, 0); + } - /* Get the right hand side */ + /* Get the right hand side */ MarkedExprWithCheck (hienext, &Expr2); /* Check for a constant expression */ @@ -2054,37 +2054,37 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */ LoadExpr (CF_NONE, &Expr2); } - /* Make sure, the types are compatible */ - if (IsClassInt (Expr->Type)) { - if (!IsClassInt (Expr2.Type) && !(IsClassPtr(Expr2.Type) && ED_IsNullPtr(Expr))) { - Error ("Incompatible types"); - } - } else if (IsClassPtr (Expr->Type)) { - if (IsClassPtr (Expr2.Type)) { - /* Both pointers are allowed in comparison if they point to - * the same type, or if one of them is a void pointer. - */ - Type* left = Indirect (Expr->Type); - Type* right = Indirect (Expr2.Type); - if (TypeCmp (left, right) < TC_EQUAL && left->C != T_VOID && right->C != T_VOID) { - /* Incomatible pointers */ - Error ("Incompatible types"); - } - } else if (!ED_IsNullPtr (&Expr2)) { - Error ("Incompatible types"); - } - } + /* Make sure, the types are compatible */ + if (IsClassInt (Expr->Type)) { + if (!IsClassInt (Expr2.Type) && !(IsClassPtr(Expr2.Type) && ED_IsNullPtr(Expr))) { + Error ("Incompatible types"); + } + } else if (IsClassPtr (Expr->Type)) { + if (IsClassPtr (Expr2.Type)) { + /* Both pointers are allowed in comparison if they point to + * the same type, or if one of them is a void pointer. + */ + Type* left = Indirect (Expr->Type); + Type* right = Indirect (Expr2.Type); + if (TypeCmp (left, right) < TC_EQUAL && left->C != T_VOID && right->C != T_VOID) { + /* Incomatible pointers */ + Error ("Incompatible types"); + } + } else if (!ED_IsNullPtr (&Expr2)) { + Error ("Incompatible types"); + } + } - /* Check for const operands */ - if (ED_IsConstAbs (Expr) && rconst) { + /* Check for const operands */ + if (ED_IsConstAbs (Expr) && rconst) { /* If the result is constant, this is suspicious when not in * preprocessor mode. */ WarnConstCompareResult (); - /* Both operands are constant, remove the generated code */ - RemoveCode (&Mark1); + /* Both operands are constant, remove the generated code */ + RemoveCode (&Mark1); /* Determine if this is a signed or unsigned compare */ if (IsClassInt (Expr->Type) && IsSignSigned (Expr->Type) && @@ -2119,26 +2119,26 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */ } } - } else { + } else { /* Determine the signedness of the operands */ int LeftSigned = IsSignSigned (Expr->Type); int RightSigned = IsSignSigned (Expr2.Type); - /* If the right hand side is constant, and the generator function - * expects the lhs in the primary, remove the push of the primary - * now. - */ - unsigned flags = 0; - if (rconst) { - flags |= CF_CONST; - if ((Gen->Flags & GEN_NOPUSH) != 0) { - RemoveCode (&Mark2); - ltype |= CF_REG; /* Value is in register */ - } - } + /* If the right hand side is constant, and the generator function + * expects the lhs in the primary, remove the push of the primary + * now. + */ + unsigned flags = 0; + if (rconst) { + flags |= CF_CONST; + if ((Gen->Flags & GEN_NOPUSH) != 0) { + RemoveCode (&Mark2); + ltype |= CF_REG; /* Value is in register */ + } + } - /* Determine the type of the operation. */ + /* Determine the type of the operation. */ if (IsTypeChar (Expr->Type) && rconst) { /* Left side is unsigned char, right side is constant. @@ -2169,8 +2169,8 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */ /* Comparing a char against a constant may have a constant * result. Please note: It is not possible to remove the code - * for the compare alltogether, because it may have side - * effects. + * for the compare alltogether, because it may have side + * effects. */ switch (Tok) { @@ -2248,10 +2248,10 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */ if (!LeftSigned) { flags |= CF_UNSIGNED; } - } else { - unsigned rtype = TypeOf (Expr2.Type) | (flags & CF_CONST); - flags |= g_typeadjust (ltype, rtype); - } + } else { + unsigned rtype = TypeOf (Expr2.Type) | (flags & CF_CONST); + flags |= g_typeadjust (ltype, rtype); + } /* If the left side is an unsigned and the right is a constant, * we may be able to change the compares to something more @@ -2306,18 +2306,18 @@ static void hie_compare (const GenDesc* Ops, /* List of generators */ } - /* Generate code */ - GenFunc (flags, Expr2.IVal); + /* Generate code */ + GenFunc (flags, Expr2.IVal); /* The result is an rvalue in the primary */ - ED_MakeRValExpr (Expr); - } + ED_MakeRValExpr (Expr); + } - /* Result type is always int */ - Expr->Type = type_int; + /* Result type is always int */ + Expr->Type = type_int; Done: /* Condition codes are set */ - ED_TestDone (Expr); + ED_TestDone (Expr); } } @@ -2346,10 +2346,10 @@ static void parseadd (ExprDesc* Expr) */ { ExprDesc Expr2; - unsigned flags; /* Operation flags */ - CodeMark Mark; /* Remember code position */ - Type* lhst; /* Type of left hand side */ - Type* rhst; /* Type of right hand side */ + unsigned flags; /* Operation flags */ + CodeMark Mark; /* Remember code position */ + Type* lhst; /* Type of left hand side */ + Type* rhst; /* Type of right hand side */ /* Skip the PLUS token */ @@ -2362,186 +2362,186 @@ static void parseadd (ExprDesc* Expr) /* Check for constness on both sides */ if (ED_IsConst (Expr)) { - /* The left hand side is a constant of some sort. Good. Get rhs */ - ExprWithCheck (hie9, &Expr2); - if (ED_IsConstAbs (&Expr2)) { + /* The left hand side is a constant of some sort. Good. Get rhs */ + ExprWithCheck (hie9, &Expr2); + if (ED_IsConstAbs (&Expr2)) { - /* Right hand side is a constant numeric value. Get the rhs type */ - rhst = Expr2.Type; + /* Right hand side is a constant numeric value. Get the rhs type */ + rhst = Expr2.Type; - /* Both expressions are constants. Check for pointer arithmetic */ - if (IsClassPtr (lhst) && IsClassInt (rhst)) { - /* Left is pointer, right is int, must scale rhs */ - Expr->IVal += Expr2.IVal * CheckedPSizeOf (lhst); - /* Result type is a pointer */ - } else if (IsClassInt (lhst) && IsClassPtr (rhst)) { - /* Left is int, right is pointer, must scale lhs */ - Expr->IVal = Expr->IVal * CheckedPSizeOf (rhst) + Expr2.IVal; - /* Result type is a pointer */ - Expr->Type = Expr2.Type; - } else if (IsClassInt (lhst) && IsClassInt (rhst)) { - /* Integer addition */ - Expr->IVal += Expr2.IVal; - typeadjust (Expr, &Expr2, 1); - } else { - /* OOPS */ - Error ("Invalid operands for binary operator `+'"); - } + /* Both expressions are constants. Check for pointer arithmetic */ + if (IsClassPtr (lhst) && IsClassInt (rhst)) { + /* Left is pointer, right is int, must scale rhs */ + Expr->IVal += Expr2.IVal * CheckedPSizeOf (lhst); + /* Result type is a pointer */ + } else if (IsClassInt (lhst) && IsClassPtr (rhst)) { + /* Left is int, right is pointer, must scale lhs */ + Expr->IVal = Expr->IVal * CheckedPSizeOf (rhst) + Expr2.IVal; + /* Result type is a pointer */ + Expr->Type = Expr2.Type; + } else if (IsClassInt (lhst) && IsClassInt (rhst)) { + /* Integer addition */ + Expr->IVal += Expr2.IVal; + typeadjust (Expr, &Expr2, 1); + } else { + /* OOPS */ + Error ("Invalid operands for binary operator `+'"); + } - } else { + } else { - /* lhs is a constant and rhs is not constant. Load rhs into - * the primary. - */ - LoadExpr (CF_NONE, &Expr2); + /* lhs is a constant and rhs is not constant. Load rhs into + * the primary. + */ + LoadExpr (CF_NONE, &Expr2); - /* Beware: The check above (for lhs) lets not only pass numeric - * constants, but also constant addresses (labels), maybe even - * with an offset. We have to check for that here. - */ + /* Beware: The check above (for lhs) lets not only pass numeric + * constants, but also constant addresses (labels), maybe even + * with an offset. We have to check for that here. + */ - /* First, get the rhs type. */ - rhst = Expr2.Type; + /* First, get the rhs type. */ + rhst = Expr2.Type; - /* Setup flags */ - if (ED_IsLocAbs (Expr)) { - /* A numerical constant */ - flags |= CF_CONST; - } else { - /* Constant address label */ - flags |= GlobalModeFlags (Expr) | CF_CONSTADDR; - } + /* Setup flags */ + if (ED_IsLocAbs (Expr)) { + /* A numerical constant */ + flags |= CF_CONST; + } else { + /* Constant address label */ + flags |= GlobalModeFlags (Expr) | CF_CONSTADDR; + } - /* Check for pointer arithmetic */ - if (IsClassPtr (lhst) && IsClassInt (rhst)) { - /* Left is pointer, right is int, must scale rhs */ - g_scale (CF_INT, CheckedPSizeOf (lhst)); - /* Operate on pointers, result type is a pointer */ - flags |= CF_PTR; - /* Generate the code for the add */ - if (ED_GetLoc (Expr) == E_LOC_ABS) { - /* Numeric constant */ - g_inc (flags, Expr->IVal); - } else { - /* Constant address */ - g_addaddr_static (flags, Expr->Name, Expr->IVal); - } - } else if (IsClassInt (lhst) && IsClassPtr (rhst)) { + /* Check for pointer arithmetic */ + if (IsClassPtr (lhst) && IsClassInt (rhst)) { + /* Left is pointer, right is int, must scale rhs */ + g_scale (CF_INT, CheckedPSizeOf (lhst)); + /* Operate on pointers, result type is a pointer */ + flags |= CF_PTR; + /* Generate the code for the add */ + if (ED_GetLoc (Expr) == E_LOC_ABS) { + /* Numeric constant */ + g_inc (flags, Expr->IVal); + } else { + /* Constant address */ + g_addaddr_static (flags, Expr->Name, Expr->IVal); + } + } else if (IsClassInt (lhst) && IsClassPtr (rhst)) { - /* Left is int, right is pointer, must scale lhs. */ - unsigned ScaleFactor = CheckedPSizeOf (rhst); + /* Left is int, right is pointer, must scale lhs. */ + unsigned ScaleFactor = CheckedPSizeOf (rhst); - /* Operate on pointers, result type is a pointer */ - flags |= CF_PTR; - Expr->Type = Expr2.Type; + /* Operate on pointers, result type is a pointer */ + flags |= CF_PTR; + Expr->Type = Expr2.Type; - /* Since we do already have rhs in the primary, if lhs is - * not a numeric constant, and the scale factor is not one - * (no scaling), we must take the long way over the stack. - */ - if (ED_IsLocAbs (Expr)) { - /* Numeric constant, scale lhs */ - Expr->IVal *= ScaleFactor; - /* Generate the code for the add */ - g_inc (flags, Expr->IVal); - } else if (ScaleFactor == 1) { - /* Constant address but no need to scale */ - g_addaddr_static (flags, Expr->Name, Expr->IVal); - } else { - /* Constant address that must be scaled */ - g_push (TypeOf (Expr2.Type), 0); /* rhs --> stack */ - g_getimmed (flags, Expr->Name, Expr->IVal); - g_scale (CF_PTR, ScaleFactor); - g_add (CF_PTR, 0); - } - } else if (IsClassInt (lhst) && IsClassInt (rhst)) { - /* Integer addition */ - flags |= typeadjust (Expr, &Expr2, 1); - /* Generate the code for the add */ - if (ED_IsLocAbs (Expr)) { - /* Numeric constant */ - g_inc (flags, Expr->IVal); - } else { - /* Constant address */ - g_addaddr_static (flags, Expr->Name, Expr->IVal); - } - } else { - /* OOPS */ - Error ("Invalid operands for binary operator `+'"); + /* Since we do already have rhs in the primary, if lhs is + * not a numeric constant, and the scale factor is not one + * (no scaling), we must take the long way over the stack. + */ + if (ED_IsLocAbs (Expr)) { + /* Numeric constant, scale lhs */ + Expr->IVal *= ScaleFactor; + /* Generate the code for the add */ + g_inc (flags, Expr->IVal); + } else if (ScaleFactor == 1) { + /* Constant address but no need to scale */ + g_addaddr_static (flags, Expr->Name, Expr->IVal); + } else { + /* Constant address that must be scaled */ + g_push (TypeOf (Expr2.Type), 0); /* rhs --> stack */ + g_getimmed (flags, Expr->Name, Expr->IVal); + g_scale (CF_PTR, ScaleFactor); + g_add (CF_PTR, 0); + } + } else if (IsClassInt (lhst) && IsClassInt (rhst)) { + /* Integer addition */ + flags |= typeadjust (Expr, &Expr2, 1); + /* Generate the code for the add */ + if (ED_IsLocAbs (Expr)) { + /* Numeric constant */ + g_inc (flags, Expr->IVal); + } else { + /* Constant address */ + g_addaddr_static (flags, Expr->Name, Expr->IVal); + } + } else { + /* OOPS */ + Error ("Invalid operands for binary operator `+'"); flags = CF_INT; - } + } - /* Result is a rvalue in primary register */ - ED_MakeRValExpr (Expr); - } + /* Result is a rvalue in primary register */ + ED_MakeRValExpr (Expr); + } } else { - /* Left hand side is not constant. Get the value onto the stack. */ - LoadExpr (CF_NONE, Expr); /* --> primary register */ - GetCodePos (&Mark); - g_push (TypeOf (Expr->Type), 0); /* --> stack */ + /* Left hand side is not constant. Get the value onto the stack. */ + LoadExpr (CF_NONE, Expr); /* --> primary register */ + GetCodePos (&Mark); + g_push (TypeOf (Expr->Type), 0); /* --> stack */ - /* Evaluate the rhs */ + /* Evaluate the rhs */ MarkedExprWithCheck (hie9, &Expr2); /* Check for a constant rhs expression */ if (ED_IsConstAbs (&Expr2) && ED_CodeRangeIsEmpty (&Expr2)) { - /* Right hand side is a constant. Get the rhs type */ - rhst = Expr2.Type; + /* Right hand side is a constant. Get the rhs type */ + rhst = Expr2.Type; - /* Remove pushed value from stack */ - RemoveCode (&Mark); + /* Remove pushed value from stack */ + RemoveCode (&Mark); - /* Check for pointer arithmetic */ - if (IsClassPtr (lhst) && IsClassInt (rhst)) { - /* Left is pointer, right is int, must scale rhs */ - Expr2.IVal *= CheckedPSizeOf (lhst); - /* Operate on pointers, result type is a pointer */ - flags = CF_PTR; - } else if (IsClassInt (lhst) && IsClassPtr (rhst)) { - /* Left is int, right is pointer, must scale lhs (ptr only) */ - g_scale (CF_INT | CF_CONST, CheckedPSizeOf (rhst)); - /* Operate on pointers, result type is a pointer */ - flags = CF_PTR; - Expr->Type = Expr2.Type; - } else if (IsClassInt (lhst) && IsClassInt (rhst)) { - /* Integer addition */ - flags = typeadjust (Expr, &Expr2, 1); - } else { - /* OOPS */ - Error ("Invalid operands for binary operator `+'"); + /* Check for pointer arithmetic */ + if (IsClassPtr (lhst) && IsClassInt (rhst)) { + /* Left is pointer, right is int, must scale rhs */ + Expr2.IVal *= CheckedPSizeOf (lhst); + /* Operate on pointers, result type is a pointer */ + flags = CF_PTR; + } else if (IsClassInt (lhst) && IsClassPtr (rhst)) { + /* Left is int, right is pointer, must scale lhs (ptr only) */ + g_scale (CF_INT | CF_CONST, CheckedPSizeOf (rhst)); + /* Operate on pointers, result type is a pointer */ + flags = CF_PTR; + Expr->Type = Expr2.Type; + } else if (IsClassInt (lhst) && IsClassInt (rhst)) { + /* Integer addition */ + flags = typeadjust (Expr, &Expr2, 1); + } else { + /* OOPS */ + Error ("Invalid operands for binary operator `+'"); flags = CF_INT; - } + } - /* Generate code for the add */ - g_inc (flags | CF_CONST, Expr2.IVal); + /* Generate code for the add */ + g_inc (flags | CF_CONST, Expr2.IVal); - } else { + } else { /* Not constant, load into the primary */ LoadExpr (CF_NONE, &Expr2); - /* lhs and rhs are not constant. Get the rhs type. */ - rhst = Expr2.Type; + /* lhs and rhs are not constant. Get the rhs type. */ + rhst = Expr2.Type; - /* Check for pointer arithmetic */ - if (IsClassPtr (lhst) && IsClassInt (rhst)) { - /* Left is pointer, right is int, must scale rhs */ - g_scale (CF_INT, CheckedPSizeOf (lhst)); - /* Operate on pointers, result type is a pointer */ - flags = CF_PTR; - } else if (IsClassInt (lhst) && IsClassPtr (rhst)) { - /* Left is int, right is pointer, must scale lhs */ - g_tosint (TypeOf (rhst)); /* Make sure, TOS is int */ - g_swap (CF_INT); /* Swap TOS and primary */ - g_scale (CF_INT, CheckedPSizeOf (rhst)); - /* Operate on pointers, result type is a pointer */ - flags = CF_PTR; - Expr->Type = Expr2.Type; - } else if (IsClassInt (lhst) && IsClassInt (rhst)) { - /* Integer addition. Note: Result is never constant. + /* Check for pointer arithmetic */ + if (IsClassPtr (lhst) && IsClassInt (rhst)) { + /* Left is pointer, right is int, must scale rhs */ + g_scale (CF_INT, CheckedPSizeOf (lhst)); + /* Operate on pointers, result type is a pointer */ + flags = CF_PTR; + } else if (IsClassInt (lhst) && IsClassPtr (rhst)) { + /* Left is int, right is pointer, must scale lhs */ + g_tosint (TypeOf (rhst)); /* Make sure, TOS is int */ + g_swap (CF_INT); /* Swap TOS and primary */ + g_scale (CF_INT, CheckedPSizeOf (rhst)); + /* Operate on pointers, result type is a pointer */ + flags = CF_PTR; + Expr->Type = Expr2.Type; + } else if (IsClassInt (lhst) && IsClassInt (rhst)) { + /* Integer addition. Note: Result is never constant. * Problem here is that typeadjust does not know if the * variable is an rvalue or lvalue, so if both operands * are dereferenced constant numeric addresses, typeadjust @@ -2550,17 +2550,17 @@ static void parseadd (ExprDesc* Expr) * whole parser is such a mess that I fear to break anything * when trying to apply another solution. */ - flags = typeadjust (Expr, &Expr2, 0) & ~CF_CONST; - } else { - /* OOPS */ - Error ("Invalid operands for binary operator `+'"); + flags = typeadjust (Expr, &Expr2, 0) & ~CF_CONST; + } else { + /* OOPS */ + Error ("Invalid operands for binary operator `+'"); flags = CF_INT; - } + } - /* Generate code for the add */ - g_add (flags, 0); + /* Generate code for the add */ + g_add (flags, 0); - } + } /* Result is a rvalue in primary register */ ED_MakeRValExpr (Expr); @@ -2580,12 +2580,12 @@ static void parsesub (ExprDesc* Expr) */ { ExprDesc Expr2; - unsigned flags; /* Operation flags */ - Type* lhst; /* Type of left hand side */ - Type* rhst; /* Type of right hand side */ - CodeMark Mark1; /* Save position of output queue */ - CodeMark Mark2; /* Another position in the queue */ - int rscale; /* Scale factor for the result */ + unsigned flags; /* Operation flags */ + Type* lhst; /* Type of left hand side */ + Type* rhst; /* Type of right hand side */ + CodeMark Mark1; /* Save position of output queue */ + CodeMark Mark2; /* Another position in the queue */ + int rscale; /* Scale factor for the result */ /* Skip the MINUS token */ @@ -2593,13 +2593,13 @@ static void parsesub (ExprDesc* Expr) /* Get the left hand side type, initialize operation flags */ lhst = Expr->Type; - rscale = 1; /* Scale by 1, that is, don't scale */ + rscale = 1; /* Scale by 1, that is, don't scale */ /* Remember the output queue position, then bring the value onto the stack */ GetCodePos (&Mark1); LoadExpr (CF_NONE, Expr); /* --> primary register */ GetCodePos (&Mark2); - g_push (TypeOf (lhst), 0); /* --> stack */ + g_push (TypeOf (lhst), 0); /* --> stack */ /* Parse the right hand side */ MarkedExprWithCheck (hie9, &Expr2); @@ -2607,138 +2607,138 @@ static void parsesub (ExprDesc* Expr) /* Check for a constant rhs expression */ if (ED_IsConstAbs (&Expr2) && ED_CodeRangeIsEmpty (&Expr2)) { - /* The right hand side is constant. Get the rhs type. */ - rhst = Expr2.Type; + /* The right hand side is constant. Get the rhs type. */ + rhst = Expr2.Type; - /* Check left hand side */ - if (ED_IsConstAbs (Expr)) { + /* Check left hand side */ + if (ED_IsConstAbs (Expr)) { - /* Both sides are constant, remove generated code */ - RemoveCode (&Mark1); + /* Both sides are constant, remove generated code */ + RemoveCode (&Mark1); - /* Check for pointer arithmetic */ - if (IsClassPtr (lhst) && IsClassInt (rhst)) { - /* Left is pointer, right is int, must scale rhs */ - Expr->IVal -= Expr2.IVal * CheckedPSizeOf (lhst); - /* Operate on pointers, result type is a pointer */ - } else if (IsClassPtr (lhst) && IsClassPtr (rhst)) { - /* Left is pointer, right is pointer, must scale result */ - if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) { - Error ("Incompatible pointer types"); - } else { - Expr->IVal = (Expr->IVal - Expr2.IVal) / + /* Check for pointer arithmetic */ + if (IsClassPtr (lhst) && IsClassInt (rhst)) { + /* Left is pointer, right is int, must scale rhs */ + Expr->IVal -= Expr2.IVal * CheckedPSizeOf (lhst); + /* Operate on pointers, result type is a pointer */ + } else if (IsClassPtr (lhst) && IsClassPtr (rhst)) { + /* Left is pointer, right is pointer, must scale result */ + if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) { + Error ("Incompatible pointer types"); + } else { + Expr->IVal = (Expr->IVal - Expr2.IVal) / CheckedPSizeOf (lhst); - } - /* Operate on pointers, result type is an integer */ - Expr->Type = type_int; - } else if (IsClassInt (lhst) && IsClassInt (rhst)) { - /* Integer subtraction */ - typeadjust (Expr, &Expr2, 1); - Expr->IVal -= Expr2.IVal; - } else { - /* OOPS */ - Error ("Invalid operands for binary operator `-'"); - } + } + /* Operate on pointers, result type is an integer */ + Expr->Type = type_int; + } else if (IsClassInt (lhst) && IsClassInt (rhst)) { + /* Integer subtraction */ + typeadjust (Expr, &Expr2, 1); + Expr->IVal -= Expr2.IVal; + } else { + /* OOPS */ + Error ("Invalid operands for binary operator `-'"); + } - /* Result is constant, condition codes not set */ - ED_MarkAsUntested (Expr); + /* Result is constant, condition codes not set */ + ED_MarkAsUntested (Expr); - } else { + } else { - /* Left hand side is not constant, right hand side is. - * Remove pushed value from stack. - */ - RemoveCode (&Mark2); + /* Left hand side is not constant, right hand side is. + * Remove pushed value from stack. + */ + RemoveCode (&Mark2); - if (IsClassPtr (lhst) && IsClassInt (rhst)) { - /* Left is pointer, right is int, must scale rhs */ - Expr2.IVal *= CheckedPSizeOf (lhst); - /* Operate on pointers, result type is a pointer */ - flags = CF_PTR; - } else if (IsClassPtr (lhst) && IsClassPtr (rhst)) { - /* Left is pointer, right is pointer, must scale result */ - if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) { - Error ("Incompatible pointer types"); - } else { - rscale = CheckedPSizeOf (lhst); - } - /* Operate on pointers, result type is an integer */ - flags = CF_PTR; - Expr->Type = type_int; - } else if (IsClassInt (lhst) && IsClassInt (rhst)) { - /* Integer subtraction */ - flags = typeadjust (Expr, &Expr2, 1); - } else { - /* OOPS */ - Error ("Invalid operands for binary operator `-'"); + if (IsClassPtr (lhst) && IsClassInt (rhst)) { + /* Left is pointer, right is int, must scale rhs */ + Expr2.IVal *= CheckedPSizeOf (lhst); + /* Operate on pointers, result type is a pointer */ + flags = CF_PTR; + } else if (IsClassPtr (lhst) && IsClassPtr (rhst)) { + /* Left is pointer, right is pointer, must scale result */ + if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) { + Error ("Incompatible pointer types"); + } else { + rscale = CheckedPSizeOf (lhst); + } + /* Operate on pointers, result type is an integer */ + flags = CF_PTR; + Expr->Type = type_int; + } else if (IsClassInt (lhst) && IsClassInt (rhst)) { + /* Integer subtraction */ + flags = typeadjust (Expr, &Expr2, 1); + } else { + /* OOPS */ + Error ("Invalid operands for binary operator `-'"); flags = CF_INT; - } + } - /* Do the subtraction */ - g_dec (flags | CF_CONST, Expr2.IVal); + /* Do the subtraction */ + g_dec (flags | CF_CONST, Expr2.IVal); - /* If this was a pointer subtraction, we must scale the result */ - if (rscale != 1) { - g_scale (flags, -rscale); - } + /* If this was a pointer subtraction, we must scale the result */ + if (rscale != 1) { + g_scale (flags, -rscale); + } - /* Result is a rvalue in the primary register */ - ED_MakeRValExpr (Expr); - ED_MarkAsUntested (Expr); + /* Result is a rvalue in the primary register */ + ED_MakeRValExpr (Expr); + ED_MarkAsUntested (Expr); - } + } } else { /* Not constant, load into the primary */ LoadExpr (CF_NONE, &Expr2); - /* Right hand side is not constant. Get the rhs type. */ - rhst = Expr2.Type; + /* Right hand side is not constant. Get the rhs type. */ + rhst = Expr2.Type; - /* Check for pointer arithmetic */ - if (IsClassPtr (lhst) && IsClassInt (rhst)) { - /* Left is pointer, right is int, must scale rhs */ - g_scale (CF_INT, CheckedPSizeOf (lhst)); - /* Operate on pointers, result type is a pointer */ - flags = CF_PTR; - } else if (IsClassPtr (lhst) && IsClassPtr (rhst)) { - /* Left is pointer, right is pointer, must scale result */ - if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) { - Error ("Incompatible pointer types"); - } else { - rscale = CheckedPSizeOf (lhst); - } - /* Operate on pointers, result type is an integer */ - flags = CF_PTR; - Expr->Type = type_int; - } else if (IsClassInt (lhst) && IsClassInt (rhst)) { - /* Integer subtraction. If the left hand side descriptor says that - * the lhs is const, we have to remove this mark, since this is no - * longer true, lhs is on stack instead. - */ - if (ED_IsLocAbs (Expr)) { - ED_MakeRValExpr (Expr); - } - /* Adjust operand types */ - flags = typeadjust (Expr, &Expr2, 0); - } else { - /* OOPS */ - Error ("Invalid operands for binary operator `-'"); + /* Check for pointer arithmetic */ + if (IsClassPtr (lhst) && IsClassInt (rhst)) { + /* Left is pointer, right is int, must scale rhs */ + g_scale (CF_INT, CheckedPSizeOf (lhst)); + /* Operate on pointers, result type is a pointer */ + flags = CF_PTR; + } else if (IsClassPtr (lhst) && IsClassPtr (rhst)) { + /* Left is pointer, right is pointer, must scale result */ + if (TypeCmp (Indirect (lhst), Indirect (rhst)) < TC_QUAL_DIFF) { + Error ("Incompatible pointer types"); + } else { + rscale = CheckedPSizeOf (lhst); + } + /* Operate on pointers, result type is an integer */ + flags = CF_PTR; + Expr->Type = type_int; + } else if (IsClassInt (lhst) && IsClassInt (rhst)) { + /* Integer subtraction. If the left hand side descriptor says that + * the lhs is const, we have to remove this mark, since this is no + * longer true, lhs is on stack instead. + */ + if (ED_IsLocAbs (Expr)) { + ED_MakeRValExpr (Expr); + } + /* Adjust operand types */ + flags = typeadjust (Expr, &Expr2, 0); + } else { + /* OOPS */ + Error ("Invalid operands for binary operator `-'"); flags = CF_INT; - } + } - /* Generate code for the sub (the & is a hack here) */ - g_sub (flags & ~CF_CONST, 0); + /* Generate code for the sub (the & is a hack here) */ + g_sub (flags & ~CF_CONST, 0); - /* If this was a pointer subtraction, we must scale the result */ - if (rscale != 1) { - g_scale (flags, -rscale); - } + /* If this was a pointer subtraction, we must scale the result */ + if (rscale != 1) { + g_scale (flags, -rscale); + } - /* Result is a rvalue in the primary register */ - ED_MakeRValExpr (Expr); - ED_MarkAsUntested (Expr); + /* Result is a rvalue in the primary register */ + ED_MakeRValExpr (Expr); + ED_MarkAsUntested (Expr); } } @@ -2749,11 +2749,11 @@ void hie8 (ExprDesc* Expr) { ExprWithCheck (hie9, Expr); while (CurTok.Tok == TOK_PLUS || CurTok.Tok == TOK_MINUS) { - if (CurTok.Tok == TOK_PLUS) { - parseadd (Expr); - } else { - parsesub (Expr); - } + if (CurTok.Tok == TOK_PLUS) { + parseadd (Expr); + } else { + parsesub (Expr); + } } } @@ -2763,10 +2763,10 @@ static void hie6 (ExprDesc* Expr) /* Handle greater-than type comparators */ { static const GenDesc hie6_ops [] = { - { TOK_LT, GEN_NOPUSH, g_lt }, - { TOK_LE, GEN_NOPUSH, g_le }, - { TOK_GE, GEN_NOPUSH, g_ge }, - { TOK_GT, GEN_NOPUSH, g_gt }, + { TOK_LT, GEN_NOPUSH, g_lt }, + { TOK_LE, GEN_NOPUSH, g_le }, + { TOK_GE, GEN_NOPUSH, g_ge }, + { TOK_GT, GEN_NOPUSH, g_gt }, { TOK_INVALID, 0, 0 } }; hie_compare (hie6_ops, Expr, ShiftExpr); @@ -2778,8 +2778,8 @@ static void hie5 (ExprDesc* Expr) /* Handle == and != */ { static const GenDesc hie5_ops[] = { - { TOK_EQ, GEN_NOPUSH, g_eq }, - { TOK_NE, GEN_NOPUSH, g_ne }, + { TOK_EQ, GEN_NOPUSH, g_eq }, + { TOK_NE, GEN_NOPUSH, g_ne }, { TOK_INVALID, 0, 0 } }; hie_compare (hie5_ops, Expr, hie6); @@ -2805,7 +2805,7 @@ static void hie3 (ExprDesc* Expr) /* Handle ^ (bitwise exclusive or) */ { static const GenDesc hie3_ops[] = { - { TOK_XOR, GEN_NOPUSH | GEN_COMM, g_xor }, + { TOK_XOR, GEN_NOPUSH | GEN_COMM, g_xor }, { TOK_INVALID, 0, 0 } }; int UsedGen; @@ -2819,7 +2819,7 @@ static void hie2 (ExprDesc* Expr) /* Handle | (bitwise or) */ { static const GenDesc hie2_ops[] = { - { TOK_OR, GEN_NOPUSH | GEN_COMM, g_or }, + { TOK_OR, GEN_NOPUSH | GEN_COMM, g_or }, { TOK_INVALID, 0, 0 } }; int UsedGen; @@ -2839,14 +2839,14 @@ static void hieAndPP (ExprDesc* Expr) ConstAbsIntExpr (hie2, Expr); while (CurTok.Tok == TOK_BOOL_AND) { - /* Skip the && */ - NextToken (); + /* Skip the && */ + NextToken (); - /* Get rhs */ - ConstAbsIntExpr (hie2, &Expr2); + /* Get rhs */ + ConstAbsIntExpr (hie2, &Expr2); - /* Combine the two */ - Expr->IVal = (Expr->IVal && Expr2.IVal); + /* Combine the two */ + Expr->IVal = (Expr->IVal && Expr2.IVal); } } @@ -2862,14 +2862,14 @@ static void hieOrPP (ExprDesc *Expr) ConstAbsIntExpr (hieAndPP, Expr); while (CurTok.Tok == TOK_BOOL_OR) { - /* Skip the && */ - NextToken (); + /* Skip the && */ + NextToken (); - /* Get rhs */ - ConstAbsIntExpr (hieAndPP, &Expr2); + /* Get rhs */ + ConstAbsIntExpr (hieAndPP, &Expr2); - /* Combine the two */ - Expr->IVal = (Expr->IVal || Expr2.IVal); + /* Combine the two */ + Expr->IVal = (Expr->IVal || Expr2.IVal); } } @@ -2884,51 +2884,51 @@ static void hieAnd (ExprDesc* Expr, unsigned TrueLab, int* BoolOp) ExprWithCheck (hie2, Expr); if (CurTok.Tok == TOK_BOOL_AND) { - /* Tell our caller that we're evaluating a boolean */ - *BoolOp = 1; + /* Tell our caller that we're evaluating a boolean */ + *BoolOp = 1; - /* Get a label that we will use for false expressions */ - FalseLab = GetLocalLabel (); + /* Get a label that we will use for false expressions */ + FalseLab = GetLocalLabel (); - /* If the expr hasn't set condition codes, set the force-test flag */ - if (!ED_IsTested (Expr)) { - ED_MarkForTest (Expr); - } + /* If the expr hasn't set condition codes, set the force-test flag */ + if (!ED_IsTested (Expr)) { + ED_MarkForTest (Expr); + } - /* Load the value */ - LoadExpr (CF_FORCECHAR, Expr); + /* Load the value */ + LoadExpr (CF_FORCECHAR, Expr); - /* Generate the jump */ - g_falsejump (CF_NONE, FalseLab); + /* Generate the jump */ + g_falsejump (CF_NONE, FalseLab); - /* Parse more boolean and's */ - while (CurTok.Tok == TOK_BOOL_AND) { + /* Parse more boolean and's */ + while (CurTok.Tok == TOK_BOOL_AND) { - /* Skip the && */ - NextToken (); + /* Skip the && */ + NextToken (); - /* Get rhs */ - hie2 (&Expr2); - if (!ED_IsTested (&Expr2)) { - ED_MarkForTest (&Expr2); - } - LoadExpr (CF_FORCECHAR, &Expr2); + /* Get rhs */ + hie2 (&Expr2); + if (!ED_IsTested (&Expr2)) { + ED_MarkForTest (&Expr2); + } + LoadExpr (CF_FORCECHAR, &Expr2); - /* Do short circuit evaluation */ - if (CurTok.Tok == TOK_BOOL_AND) { - g_falsejump (CF_NONE, FalseLab); - } else { - /* Last expression - will evaluate to true */ - g_truejump (CF_NONE, TrueLab); - } - } + /* Do short circuit evaluation */ + if (CurTok.Tok == TOK_BOOL_AND) { + g_falsejump (CF_NONE, FalseLab); + } else { + /* Last expression - will evaluate to true */ + g_truejump (CF_NONE, TrueLab); + } + } - /* Define the false jump label here */ - g_defcodelabel (FalseLab); + /* Define the false jump label here */ + g_defcodelabel (FalseLab); - /* The result is an rvalue in primary */ - ED_MakeRValExpr (Expr); - ED_TestDone (Expr); /* Condition codes are set */ + /* The result is an rvalue in primary */ + ED_MakeRValExpr (Expr); + ED_TestDone (Expr); /* Condition codes are set */ } } @@ -2938,9 +2938,9 @@ static void hieOr (ExprDesc *Expr) /* Process "exp || exp". */ { ExprDesc Expr2; - int BoolOp = 0; /* Did we have a boolean op? */ - int AndOp; /* Did we have a && operation? */ - unsigned TrueLab; /* Jump to this label if true */ + int BoolOp = 0; /* Did we have a boolean op? */ + int AndOp; /* Did we have a && operation? */ + unsigned TrueLab; /* Jump to this label if true */ unsigned DoneLab; /* Get a label */ @@ -2952,56 +2952,56 @@ static void hieOr (ExprDesc *Expr) /* Any boolean or's? */ if (CurTok.Tok == TOK_BOOL_OR) { - /* If the expr hasn't set condition codes, set the force-test flag */ - if (!ED_IsTested (Expr)) { - ED_MarkForTest (Expr); - } + /* If the expr hasn't set condition codes, set the force-test flag */ + if (!ED_IsTested (Expr)) { + ED_MarkForTest (Expr); + } - /* Get first expr */ - LoadExpr (CF_FORCECHAR, Expr); + /* Get first expr */ + LoadExpr (CF_FORCECHAR, Expr); - /* For each expression jump to TrueLab if true. Beware: If we - * had && operators, the jump is already in place! - */ - if (!BoolOp) { - g_truejump (CF_NONE, TrueLab); - } + /* For each expression jump to TrueLab if true. Beware: If we + * had && operators, the jump is already in place! + */ + if (!BoolOp) { + g_truejump (CF_NONE, TrueLab); + } - /* Remember that we had a boolean op */ - BoolOp = 1; + /* Remember that we had a boolean op */ + BoolOp = 1; - /* while there's more expr */ - while (CurTok.Tok == TOK_BOOL_OR) { + /* while there's more expr */ + while (CurTok.Tok == TOK_BOOL_OR) { - /* skip the || */ - NextToken (); + /* skip the || */ + NextToken (); - /* Get a subexpr */ - AndOp = 0; - hieAnd (&Expr2, TrueLab, &AndOp); - if (!ED_IsTested (&Expr2)) { - ED_MarkForTest (&Expr2); - } - LoadExpr (CF_FORCECHAR, &Expr2); + /* Get a subexpr */ + AndOp = 0; + hieAnd (&Expr2, TrueLab, &AndOp); + if (!ED_IsTested (&Expr2)) { + ED_MarkForTest (&Expr2); + } + LoadExpr (CF_FORCECHAR, &Expr2); - /* If there is more to come, add shortcut boolean eval. */ - g_truejump (CF_NONE, TrueLab); + /* If there is more to come, add shortcut boolean eval. */ + g_truejump (CF_NONE, TrueLab); - } + } - /* The result is an rvalue in primary */ - ED_MakeRValExpr (Expr); - ED_TestDone (Expr); /* Condition codes are set */ + /* The result is an rvalue in primary */ + ED_MakeRValExpr (Expr); + ED_TestDone (Expr); /* Condition codes are set */ } /* If we really had boolean ops, generate the end sequence */ if (BoolOp) { - DoneLab = GetLocalLabel (); - g_getimmed (CF_INT | CF_CONST, 0, 0); /* Load FALSE */ - g_falsejump (CF_NONE, DoneLab); - g_defcodelabel (TrueLab); - g_getimmed (CF_INT | CF_CONST, 1, 0); /* Load TRUE */ - g_defcodelabel (DoneLab); + DoneLab = GetLocalLabel (); + g_getimmed (CF_INT | CF_CONST, 0, 0); /* Load FALSE */ + g_falsejump (CF_NONE, DoneLab); + g_defcodelabel (TrueLab); + g_getimmed (CF_INT | CF_CONST, 1, 0); /* Load TRUE */ + g_defcodelabel (DoneLab); } } @@ -3013,11 +3013,11 @@ static void hieQuest (ExprDesc* Expr) int FalseLab; int TrueLab; CodeMark TrueCodeEnd; - ExprDesc Expr2; /* Expression 2 */ - ExprDesc Expr3; /* Expression 3 */ + ExprDesc Expr2; /* Expression 2 */ + ExprDesc Expr3; /* Expression 3 */ int Expr2IsNULL; /* Expression 2 is a NULL pointer */ int Expr3IsNULL; /* Expression 3 is a NULL pointer */ - Type* ResultType; /* Type of result */ + Type* ResultType; /* Type of result */ /* Call the lower level eval routine */ @@ -3029,16 +3029,16 @@ static void hieQuest (ExprDesc* Expr) /* Check if it's a ternary expression */ if (CurTok.Tok == TOK_QUEST) { - NextToken (); - if (!ED_IsTested (Expr)) { - /* Condition codes not set, request a test */ - ED_MarkForTest (Expr); - } - LoadExpr (CF_NONE, Expr); - FalseLab = GetLocalLabel (); - g_falsejump (CF_NONE, FalseLab); + NextToken (); + if (!ED_IsTested (Expr)) { + /* Condition codes not set, request a test */ + ED_MarkForTest (Expr); + } + LoadExpr (CF_NONE, Expr); + FalseLab = GetLocalLabel (); + g_falsejump (CF_NONE, FalseLab); - /* Parse second expression. Remember for later if it is a NULL pointer + /* Parse second expression. Remember for later if it is a NULL pointer * expression, then load it into the primary. */ ExprWithCheck (hie1, &Expr2); @@ -3054,14 +3054,14 @@ static void hieQuest (ExprDesc* Expr) GetCodePos (&TrueCodeEnd); /* Jump around the evaluation of the third expression */ - TrueLab = GetLocalLabel (); - ConsumeColon (); - g_jump (TrueLab); + TrueLab = GetLocalLabel (); + ConsumeColon (); + g_jump (TrueLab); /* Jump here if the first expression was false */ - g_defcodelabel (FalseLab); + g_defcodelabel (FalseLab); - /* Parse third expression. Remember for later if it is a NULL pointer + /* Parse third expression. Remember for later if it is a NULL pointer * expression, then load it into the primary. */ ExprWithCheck (hie1, &Expr3); @@ -3073,36 +3073,36 @@ static void hieQuest (ExprDesc* Expr) Expr3.Type = PtrConversion (Expr3.Type); } - /* Check if any conversions are needed, if so, do them. - * Conversion rules for ?: expression are: - * - if both expressions are int expressions, default promotion - * rules for ints apply. - * - if both expressions are pointers of the same type, the - * result of the expression is of this type. - * - if one of the expressions is a pointer and the other is - * a zero constant, the resulting type is that of the pointer - * type. + /* Check if any conversions are needed, if so, do them. + * Conversion rules for ?: expression are: + * - if both expressions are int expressions, default promotion + * rules for ints apply. + * - if both expressions are pointers of the same type, the + * result of the expression is of this type. + * - if one of the expressions is a pointer and the other is + * a zero constant, the resulting type is that of the pointer + * type. * - if both expressions are void expressions, the result is of * type void. - * - all other cases are flagged by an error. - */ - if (IsClassInt (Expr2.Type) && IsClassInt (Expr3.Type)) { + * - all other cases are flagged by an error. + */ + if (IsClassInt (Expr2.Type) && IsClassInt (Expr3.Type)) { CodeMark CvtCodeStart; CodeMark CvtCodeEnd; - /* Get common type */ - ResultType = promoteint (Expr2.Type, Expr3.Type); + /* Get common type */ + ResultType = promoteint (Expr2.Type, Expr3.Type); - /* Convert the third expression to this type if needed */ - TypeConversion (&Expr3, ResultType); + /* Convert the third expression to this type if needed */ + TypeConversion (&Expr3, ResultType); /* Emit conversion code for the second expression, but remember * where it starts end ends. */ GetCodePos (&CvtCodeStart); - TypeConversion (&Expr2, ResultType); + TypeConversion (&Expr2, ResultType); GetCodePos (&CvtCodeEnd); /* If we had conversion code, move it to the right place */ @@ -3110,33 +3110,33 @@ static void hieQuest (ExprDesc* Expr) MoveCode (&CvtCodeStart, &CvtCodeEnd, &TrueCodeEnd); } - } else if (IsClassPtr (Expr2.Type) && IsClassPtr (Expr3.Type)) { - /* Must point to same type */ - if (TypeCmp (Indirect (Expr2.Type), Indirect (Expr3.Type)) < TC_EQUAL) { - Error ("Incompatible pointer types"); - } - /* Result has the common type */ - ResultType = Expr2.Type; - } else if (IsClassPtr (Expr2.Type) && Expr3IsNULL) { - /* Result type is pointer, no cast needed */ - ResultType = Expr2.Type; - } else if (Expr2IsNULL && IsClassPtr (Expr3.Type)) { - /* Result type is pointer, no cast needed */ - ResultType = Expr3.Type; + } else if (IsClassPtr (Expr2.Type) && IsClassPtr (Expr3.Type)) { + /* Must point to same type */ + if (TypeCmp (Indirect (Expr2.Type), Indirect (Expr3.Type)) < TC_EQUAL) { + Error ("Incompatible pointer types"); + } + /* Result has the common type */ + ResultType = Expr2.Type; + } else if (IsClassPtr (Expr2.Type) && Expr3IsNULL) { + /* Result type is pointer, no cast needed */ + ResultType = Expr2.Type; + } else if (Expr2IsNULL && IsClassPtr (Expr3.Type)) { + /* Result type is pointer, no cast needed */ + ResultType = Expr3.Type; } else if (IsTypeVoid (Expr2.Type) && IsTypeVoid (Expr3.Type)) { /* Result type is void */ ResultType = Expr3.Type; - } else { - Error ("Incompatible types"); - ResultType = Expr2.Type; /* Doesn't matter here */ - } + } else { + Error ("Incompatible types"); + ResultType = Expr2.Type; /* Doesn't matter here */ + } - /* Define the final label */ + /* Define the final label */ g_defcodelabel (TrueLab); - /* Setup the target expression */ - ED_MakeRValExpr (Expr); - Expr->Type = ResultType; + /* Setup the target expression */ + ED_MakeRValExpr (Expr); + Expr->Type = ResultType; } } @@ -3152,13 +3152,13 @@ static void opeq (const GenDesc* Gen, ExprDesc* Expr, const char* Op) /* op= can only be used with lvalues */ if (!ED_IsLVal (Expr)) { - Error ("Invalid lvalue in assignment"); - return; + Error ("Invalid lvalue in assignment"); + return; } /* The left side must not be const qualified */ if (IsQualConst (Expr->Type)) { - Error ("Assignment to const"); + Error ("Assignment to const"); } /* There must be an integer or pointer on the left side */ @@ -3199,30 +3199,30 @@ static void opeq (const GenDesc* Gen, ExprDesc* Expr, const char* Op) /* Check for a constant expression */ if (ED_IsConstAbs (&Expr2) && ED_CodeRangeIsEmpty (&Expr2)) { - /* The resulting value is a constant. If the generator has the NOPUSH - * flag set, don't push the lhs. - */ - if (Gen->Flags & GEN_NOPUSH) { - RemoveCode (&Mark); - } - if (MustScale) { - /* lhs is a pointer, scale rhs */ - Expr2.IVal *= CheckedSizeOf (Expr->Type+1); - } + /* The resulting value is a constant. If the generator has the NOPUSH + * flag set, don't push the lhs. + */ + if (Gen->Flags & GEN_NOPUSH) { + RemoveCode (&Mark); + } + if (MustScale) { + /* lhs is a pointer, scale rhs */ + Expr2.IVal *= CheckedSizeOf (Expr->Type+1); + } - /* If the lhs is character sized, the operation may be later done - * with characters. - */ - if (CheckedSizeOf (Expr->Type) == SIZEOF_CHAR) { - flags |= CF_FORCECHAR; - } + /* If the lhs is character sized, the operation may be later done + * with characters. + */ + if (CheckedSizeOf (Expr->Type) == SIZEOF_CHAR) { + flags |= CF_FORCECHAR; + } - /* Special handling for add and sub - some sort of a hack, but short code */ - if (Gen->Func == g_add) { - g_inc (flags | CF_CONST, Expr2.IVal); - } else if (Gen->Func == g_sub) { - g_dec (flags | CF_CONST, Expr2.IVal); - } else { + /* Special handling for add and sub - some sort of a hack, but short code */ + if (Gen->Func == g_add) { + g_inc (flags | CF_CONST, Expr2.IVal); + } else if (Gen->Func == g_sub) { + g_dec (flags | CF_CONST, Expr2.IVal); + } else { if (Expr2.IVal == 0) { /* Check for div by zero/mod by zero */ if (Gen->Func == g_div) { @@ -3231,26 +3231,26 @@ static void opeq (const GenDesc* Gen, ExprDesc* Expr, const char* Op) Error ("Modulo operation with zero"); } } - Gen->Func (flags | CF_CONST, Expr2.IVal); - } + Gen->Func (flags | CF_CONST, Expr2.IVal); + } } else { - /* rhs is not constant. Load into the primary */ + /* rhs is not constant. Load into the primary */ LoadExpr (CF_NONE, &Expr2); - if (MustScale) { - /* lhs is a pointer, scale rhs */ - g_scale (TypeOf (Expr2.Type), CheckedSizeOf (Expr->Type+1)); - } + if (MustScale) { + /* lhs is a pointer, scale rhs */ + g_scale (TypeOf (Expr2.Type), CheckedSizeOf (Expr->Type+1)); + } - /* If the lhs is character sized, the operation may be later done - * with characters. - */ - if (CheckedSizeOf (Expr->Type) == SIZEOF_CHAR) { - flags |= CF_FORCECHAR; - } + /* If the lhs is character sized, the operation may be later done + * with characters. + */ + if (CheckedSizeOf (Expr->Type) == SIZEOF_CHAR) { + flags |= CF_FORCECHAR; + } - /* Adjust the types of the operands if needed */ - Gen->Func (g_typeadjust (flags, TypeOf (Expr2.Type)), 0); + /* Adjust the types of the operands if needed */ + Gen->Func (g_typeadjust (flags, TypeOf (Expr2.Type)), 0); } Store (Expr, 0); ED_MakeRValExpr (Expr); @@ -3269,20 +3269,20 @@ static void addsubeq (const GenDesc* Gen, ExprDesc *Expr, const char* Op) /* We're currently only able to handle some adressing modes */ if (ED_GetLoc (Expr) == E_LOC_EXPR || ED_GetLoc (Expr) == E_LOC_PRIMARY) { - /* Use generic routine */ - opeq (Gen, Expr, Op); - return; + /* Use generic routine */ + opeq (Gen, Expr, Op); + return; } /* We must have an lvalue */ if (ED_IsRVal (Expr)) { - Error ("Invalid lvalue in assignment"); - return; + Error ("Invalid lvalue in assignment"); + return; } /* The left side must not be const qualified */ if (IsQualConst (Expr->Type)) { - Error ("Assignment to const"); + Error ("Assignment to const"); } /* There must be an integer or pointer on the left side */ @@ -3314,19 +3314,19 @@ static void addsubeq (const GenDesc* Gen, ExprDesc *Expr, const char* Op) */ } if (ED_IsConstAbs (&Expr2)) { - /* The resulting value is a constant. Scale it. */ + /* The resulting value is a constant. Scale it. */ if (MustScale) { Expr2.IVal *= CheckedSizeOf (Indirect (Expr->Type)); } - rflags |= CF_CONST; - lflags |= CF_CONST; + rflags |= CF_CONST; + lflags |= CF_CONST; } else { - /* Not constant, load into the primary */ + /* Not constant, load into the primary */ LoadExpr (CF_NONE, &Expr2); - if (MustScale) { - /* lhs is a pointer, scale rhs */ - g_scale (TypeOf (Expr2.Type), CheckedSizeOf (Indirect (Expr->Type))); - } + if (MustScale) { + /* lhs is a pointer, scale rhs */ + g_scale (TypeOf (Expr2.Type), CheckedSizeOf (Indirect (Expr->Type))); + } } /* Setup the code generator flags */ @@ -3401,52 +3401,52 @@ void hie1 (ExprDesc* Expr) hieQuest (Expr); switch (CurTok.Tok) { - case TOK_ASSIGN: + case TOK_ASSIGN: Assignment (Expr); - break; + break; - case TOK_PLUS_ASSIGN: - addsubeq (&GenPASGN, Expr, "+="); - break; + case TOK_PLUS_ASSIGN: + addsubeq (&GenPASGN, Expr, "+="); + break; - case TOK_MINUS_ASSIGN: - addsubeq (&GenSASGN, Expr, "-="); - break; + case TOK_MINUS_ASSIGN: + addsubeq (&GenSASGN, Expr, "-="); + break; - case TOK_MUL_ASSIGN: - opeq (&GenMASGN, Expr, "*="); - break; + case TOK_MUL_ASSIGN: + opeq (&GenMASGN, Expr, "*="); + break; - case TOK_DIV_ASSIGN: - opeq (&GenDASGN, Expr, "/="); - break; + case TOK_DIV_ASSIGN: + opeq (&GenDASGN, Expr, "/="); + break; - case TOK_MOD_ASSIGN: - opeq (&GenMOASGN, Expr, "%="); - break; + case TOK_MOD_ASSIGN: + opeq (&GenMOASGN, Expr, "%="); + break; - case TOK_SHL_ASSIGN: - opeq (&GenSLASGN, Expr, "<<="); - break; + case TOK_SHL_ASSIGN: + opeq (&GenSLASGN, Expr, "<<="); + break; - case TOK_SHR_ASSIGN: - opeq (&GenSRASGN, Expr, ">>="); - break; + case TOK_SHR_ASSIGN: + opeq (&GenSRASGN, Expr, ">>="); + break; - case TOK_AND_ASSIGN: - opeq (&GenAASGN, Expr, "&="); - break; + case TOK_AND_ASSIGN: + opeq (&GenAASGN, Expr, "&="); + break; - case TOK_XOR_ASSIGN: - opeq (&GenXOASGN, Expr, "^="); - break; + case TOK_XOR_ASSIGN: + opeq (&GenXOASGN, Expr, "^="); + break; - case TOK_OR_ASSIGN: - opeq (&GenOASGN, Expr, "|="); - break; + case TOK_OR_ASSIGN: + opeq (&GenOASGN, Expr, "|="); + break; - default: - break; + default: + break; } } @@ -3457,8 +3457,8 @@ void hie0 (ExprDesc *Expr) { hie1 (Expr); while (CurTok.Tok == TOK_COMMA) { - NextToken (); - hie1 (Expr); + NextToken (); + hie1 (Expr); } } @@ -3476,12 +3476,12 @@ int evalexpr (unsigned Flags, void (*Func) (ExprDesc*), ExprDesc* Expr) /* Check for a constant expression */ if (ED_IsConstAbs (Expr)) { - /* Constant expression */ - return 0; + /* Constant expression */ + return 0; } else { - /* Not constant, load into the primary */ + /* Not constant, load into the primary */ LoadExpr (Flags, Expr); - return 1; + return 1; } } @@ -3505,9 +3505,9 @@ void ConstExpr (void (*Func) (ExprDesc*), ExprDesc* Expr) { ExprWithCheck (Func, Expr); if (!ED_IsConst (Expr)) { - Error ("Constant expression expected"); - /* To avoid any compiler errors, make the expression a valid const */ - ED_MakeConstAbsInt (Expr, 1); + Error ("Constant expression expected"); + /* To avoid any compiler errors, make the expression a valid const */ + ED_MakeConstAbsInt (Expr, 1); } } @@ -3522,9 +3522,9 @@ void BoolExpr (void (*Func) (ExprDesc*), ExprDesc* Expr) { ExprWithCheck (Func, Expr); if (!ED_IsBool (Expr)) { - Error ("Boolean expression expected"); - /* To avoid any compiler errors, make the expression a valid int */ - ED_MakeConstAbsInt (Expr, 1); + Error ("Boolean expression expected"); + /* To avoid any compiler errors, make the expression a valid int */ + ED_MakeConstAbsInt (Expr, 1); } } @@ -3539,9 +3539,9 @@ void ConstAbsIntExpr (void (*Func) (ExprDesc*), ExprDesc* Expr) { ExprWithCheck (Func, Expr); if (!ED_IsConstAbsInt (Expr)) { - Error ("Constant integer expression expected"); - /* To avoid any compiler errors, make the expression a valid const */ - ED_MakeConstAbsInt (Expr, 1); + Error ("Constant integer expression expected"); + /* To avoid any compiler errors, make the expression a valid const */ + ED_MakeConstAbsInt (Expr, 1); } } diff --git a/src/cc65/expr.h b/src/cc65/expr.h index c98074356..c5d193e6b 100644 --- a/src/cc65/expr.h +++ b/src/cc65/expr.h @@ -18,7 +18,7 @@ /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ diff --git a/src/cc65/exprdesc.c b/src/cc65/exprdesc.c index 2615e9dbd..978aedfc6 100644 --- a/src/cc65/exprdesc.c +++ b/src/cc65/exprdesc.c @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -118,31 +118,31 @@ const char* ED_GetLabelName (const ExprDesc* Expr, long Offs) case E_LOC_ABS: /* Absolute: numeric address or const */ - SB_Printf (&Buf, "$%04X", (int)(Offs & 0xFFFF)); + SB_Printf (&Buf, "$%04X", (int)(Offs & 0xFFFF)); break; case E_LOC_GLOBAL: case E_LOC_STATIC: /* Global or static variable */ - if (Offs) { - SB_Printf (&Buf, "%s%+ld", SymGetAsmName (Expr->Sym), Offs); - } else { - SB_Printf (&Buf, "%s", SymGetAsmName (Expr->Sym)); - } + if (Offs) { + SB_Printf (&Buf, "%s%+ld", SymGetAsmName (Expr->Sym), Offs); + } else { + SB_Printf (&Buf, "%s", SymGetAsmName (Expr->Sym)); + } break; case E_LOC_REGISTER: /* Register variable */ - SB_Printf (&Buf, "regbank+%u", (unsigned)((Offs + Expr->Name) & 0xFFFFU)); + SB_Printf (&Buf, "regbank+%u", (unsigned)((Offs + Expr->Name) & 0xFFFFU)); break; case E_LOC_LITERAL: /* Literal in the literal pool */ - if (Offs) { - SB_Printf (&Buf, "%s%+ld", LocalLabelName (Expr->Name), Offs); - } else { - SB_Printf (&Buf, "%s", LocalLabelName (Expr->Name)); - } + if (Offs) { + SB_Printf (&Buf, "%s%+ld", LocalLabelName (Expr->Name), Offs); + } else { + SB_Printf (&Buf, "%s", LocalLabelName (Expr->Name)); + } break; default: diff --git a/src/cc65/exprdesc.h b/src/cc65/exprdesc.h index 16322fb09..f2d5ce322 100644 --- a/src/cc65/exprdesc.h +++ b/src/cc65/exprdesc.h @@ -51,7 +51,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -95,11 +95,11 @@ struct Literal; /* Describe the result of an expression */ typedef struct ExprDesc ExprDesc; struct ExprDesc { - struct SymEntry* Sym; /* Symbol table entry if known */ - Type* Type; /* Type array of expression */ + struct SymEntry* Sym; /* Symbol table entry if known */ + Type* Type; /* Type array of expression */ unsigned Flags; - unsigned long Name; /* Name or label number */ - long IVal; /* Integer value if expression constant */ + unsigned long Name; /* Name or label number */ + long IVal; /* Integer value if expression constant */ Double FVal; /* Floating point value */ struct Literal* LVal; /* Literal value */ @@ -115,7 +115,7 @@ struct ExprDesc { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/funcdesc.c b/src/cc65/funcdesc.c index cfba7fec8..874dfb101 100644 --- a/src/cc65/funcdesc.c +++ b/src/cc65/funcdesc.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* funcdesc.c */ +/* funcdesc.c */ /* */ -/* Function descriptor structure for the cc65 C compiler */ +/* Function descriptor structure for the cc65 C compiler */ /* */ /* */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -54,9 +54,9 @@ FuncDesc* NewFuncDesc (void) FuncDesc* F = (FuncDesc*) xmalloc (sizeof (FuncDesc)); /* Nullify the fields */ - F->Flags = 0; - F->SymTab = 0; - F->TagTab = 0; + F->Flags = 0; + F->SymTab = 0; + F->TagTab = 0; F->ParamCount = 0; F->ParamSize = 0; F->LastParam = 0; diff --git a/src/cc65/funcdesc.h b/src/cc65/funcdesc.h index 7186c3ee8..7232bca1d 100644 --- a/src/cc65/funcdesc.h +++ b/src/cc65/funcdesc.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* funcdesc.h */ +/* funcdesc.h */ /* */ -/* Function descriptor structure for the cc65 C compiler */ +/* Function descriptor structure for the cc65 C compiler */ /* */ /* */ /* */ @@ -39,19 +39,19 @@ /*****************************************************************************/ -/* struct FuncDesc */ +/* struct FuncDesc */ /*****************************************************************************/ /* Masks for the Flags field in FuncDesc */ -#define FD_NONE 0x0000U /* No flags */ -#define FD_EMPTY 0x0001U /* Function with empty param list */ -#define FD_VOID_PARAM 0x0002U /* Function with a void param list */ -#define FD_VARIADIC 0x0004U /* Function with variable param list */ -#define FD_OLDSTYLE 0x0010U /* Old style (K&R) function */ -#define FD_OLDSTYLE_INTRET 0x0020U /* K&R func has implicit int return */ -#define FD_UNNAMED_PARAMS 0x0040U /* Function has unnamed params */ +#define FD_NONE 0x0000U /* No flags */ +#define FD_EMPTY 0x0001U /* Function with empty param list */ +#define FD_VOID_PARAM 0x0002U /* Function with a void param list */ +#define FD_VARIADIC 0x0004U /* Function with variable param list */ +#define FD_OLDSTYLE 0x0010U /* Old style (K&R) function */ +#define FD_OLDSTYLE_INTRET 0x0020U /* K&R func has implicit int return */ +#define FD_UNNAMED_PARAMS 0x0040U /* Function has unnamed params */ /* Bits that must be ignored when comparing funcs */ #define FD_IGNORE (FD_OLDSTYLE | FD_OLDSTYLE_INTRET | FD_UNNAMED_PARAMS) @@ -61,18 +61,18 @@ /* Function descriptor */ typedef struct FuncDesc FuncDesc; struct FuncDesc { - unsigned Flags; /* Bitmapped flags FD_... */ - struct SymTable* SymTab; /* Symbol table */ - struct SymTable* TagTab; /* Symbol table for structs/enums */ - unsigned ParamCount; /* Number of parameters */ - unsigned ParamSize; /* Size of the parameters */ - struct SymEntry* LastParam; /* Pointer to last parameter */ + unsigned Flags; /* Bitmapped flags FD_... */ + struct SymTable* SymTab; /* Symbol table */ + struct SymTable* TagTab; /* Symbol table for structs/enums */ + unsigned ParamCount; /* Number of parameters */ + unsigned ParamSize; /* Size of the parameters */ + struct SymEntry* LastParam; /* Pointer to last parameter */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/function.c b/src/cc65/function.c index 2956fed1d..ccf2adf49 100644 --- a/src/cc65/function.c +++ b/src/cc65/function.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* function.c */ +/* function.c */ /* */ -/* Parse function entry/body/exit */ +/* Parse function entry/body/exit */ /* */ /* */ /* */ @@ -56,7 +56,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -71,14 +71,14 @@ typedef enum { /* Structure that holds all data needed for function activation */ struct Function { - struct SymEntry* FuncEntry; /* Symbol table entry */ - Type* ReturnType; /* Function return type */ - FuncDesc* Desc; /* Function descriptor */ - int Reserved; /* Reserved local space */ - unsigned RetLab; /* Return code label */ - int TopLevelSP; /* SP at function top level */ + struct SymEntry* FuncEntry; /* Symbol table entry */ + Type* ReturnType; /* Function return type */ + FuncDesc* Desc; /* Function descriptor */ + int Reserved; /* Reserved local space */ + unsigned RetLab; /* Return code label */ + int TopLevelSP; /* SP at function top level */ unsigned RegOffs; /* Register variable space offset */ - funcflags_t Flags; /* Function flags */ + funcflags_t Flags; /* Function flags */ }; /* Pointer to current function */ @@ -87,7 +87,7 @@ Function* CurrentFunc = 0; /*****************************************************************************/ -/* Subroutines working with struct Function */ +/* Subroutines working with struct Function */ /*****************************************************************************/ @@ -101,12 +101,12 @@ static Function* NewFunction (struct SymEntry* Sym) /* Initialize the fields */ F->FuncEntry = Sym; F->ReturnType = GetFuncReturn (Sym->Type); - F->Desc = GetFuncDesc (Sym->Type); - F->Reserved = 0; - F->RetLab = GetLocalLabel (); + F->Desc = GetFuncDesc (Sym->Type); + F->Reserved = 0; + F->RetLab = GetLocalLabel (); F->TopLevelSP = 0; F->RegOffs = RegisterSpace; - F->Flags = IsTypeVoid (F->ReturnType) ? FF_VOID_RETURN : FF_NONE; + F->Flags = IsTypeVoid (F->ReturnType) ? FF_VOID_RETURN : FF_NONE; /* Return the new structure */ return F; @@ -254,14 +254,14 @@ void F_AllocLocalSpace (Function* F) { if (F->Reserved > 0) { - /* Create space on the stack */ - g_space (F->Reserved); + /* Create space on the stack */ + g_space (F->Reserved); - /* Correct the stack pointer */ - StackPtr -= F->Reserved; + /* Correct the stack pointer */ + StackPtr -= F->Reserved; - /* Nothing more reserved */ - F->Reserved = 0; + /* Nothing more reserved */ + F->Reserved = 0; } } @@ -276,18 +276,18 @@ int F_AllocRegVar (Function* F, const Type* Type) /* Allow register variables only on top level and if enabled */ if (IS_Get (&EnableRegVars) && GetLexicalLevel () == LEX_LEVEL_FUNCTION) { - /* Get the size of the variable */ - unsigned Size = CheckedSizeOf (Type); + /* Get the size of the variable */ + unsigned Size = CheckedSizeOf (Type); - /* Do we have space left? */ - if (F->RegOffs >= Size) { - /* Space left. We allocate the variables from high to low addresses, - * so the adressing is compatible with the saved values on stack. - * This allows shorter code when saving/restoring the variables. - */ - F->RegOffs -= Size; - return F->RegOffs; - } + /* Do we have space left? */ + if (F->RegOffs >= Size) { + /* Space left. We allocate the variables from high to low addresses, + * so the adressing is compatible with the saved values on stack. + * This allows shorter code when saving/restoring the variables. + */ + F->RegOffs -= Size; + return F->RegOffs; + } } /* No space left or no allocation */ @@ -303,12 +303,12 @@ static void F_RestoreRegVars (Function* F) /* If we don't have register variables in this function, bail out early */ if (F->RegOffs == RegisterSpace) { - return; + return; } /* Save the accumulator if needed */ if (!F_HasVoidReturn (F)) { - g_save (CF_CHAR | CF_FORCECHAR); + g_save (CF_CHAR | CF_FORCECHAR); } /* Get the first symbol from the function symbol table */ @@ -363,7 +363,7 @@ static void F_RestoreRegVars (Function* F) /* Restore the accumulator if needed */ if (!F_HasVoidReturn (F)) { - g_restore (CF_CHAR | CF_FORCECHAR); + g_restore (CF_CHAR | CF_FORCECHAR); } } @@ -387,7 +387,7 @@ static void F_EmitDebugInfo (void) /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ @@ -420,12 +420,12 @@ void NewFunc (SymEntry* Func) */ AddConstSym ("__fixargs__", type_uint, SC_DEF | SC_CONST, D->ParamSize); if (D->Flags & FD_VARIADIC) { - /* Variadic function. The variable must be const. */ - static const Type T[] = { TYPE(T_UCHAR | T_QUAL_CONST), TYPE(T_END) }; - AddLocalSym ("__argsize__", T, SC_DEF | SC_REF | SC_AUTO, 0); + /* Variadic function. The variable must be const. */ + static const Type T[] = { TYPE(T_UCHAR | T_QUAL_CONST), TYPE(T_END) }; + AddLocalSym ("__argsize__", T, SC_DEF | SC_REF | SC_AUTO, 0); } else { - /* Non variadic */ - AddConstSym ("__argsize__", type_uchar, SC_DEF | SC_CONST, D->ParamSize); + /* Non variadic */ + AddConstSym ("__argsize__", type_uchar, SC_DEF | SC_CONST, D->ParamSize); } /* Function body now defined */ @@ -480,19 +480,19 @@ void NewFunc (SymEntry* Func) /* If this is a fastcall function, push the last parameter onto the stack */ if (IsQualFastcall (Func->Type) && D->ParamCount > 0) { - unsigned Flags; + unsigned Flags; - /* Fastcall functions may never have an ellipsis or the compiler is buggy */ - CHECK ((D->Flags & FD_VARIADIC) == 0); + /* Fastcall functions may never have an ellipsis or the compiler is buggy */ + CHECK ((D->Flags & FD_VARIADIC) == 0); - /* Generate the push */ - if (IsTypeFunc (D->LastParam->Type)) { - /* Pointer to function */ - Flags = CF_PTR; - } else { - Flags = TypeOf (D->LastParam->Type) | CF_FORCECHAR; - } - g_push (Flags, 0); + /* Generate the push */ + if (IsTypeFunc (D->LastParam->Type)) { + /* Pointer to function */ + Flags = CF_PTR; + } else { + Flags = TypeOf (D->LastParam->Type) | CF_FORCECHAR; + } + g_push (Flags, 0); } /* Generate function entry code if needed */ @@ -500,7 +500,7 @@ void NewFunc (SymEntry* Func) /* If stack checking code is requested, emit a call to the helper routine */ if (IS_Get (&CheckStack)) { - g_stackcheck (); + g_stackcheck (); } /* Setup the stack */ diff --git a/src/cc65/function.h b/src/cc65/function.h index 87f61268d..b70389372 100644 --- a/src/cc65/function.h +++ b/src/cc65/function.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* function.h */ +/* function.h */ /* */ -/* Function management */ +/* Function management */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* data */ +/* data */ /*****************************************************************************/ @@ -53,7 +53,7 @@ extern Function* CurrentFunc; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/global.c b/src/cc65/global.c index 4884283f3..a6d752b27 100644 --- a/src/cc65/global.c +++ b/src/cc65/global.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ -/* Global variables for the cc65 C compiler */ +/* Global variables for the cc65 C compiler */ /* */ /* */ /* */ @@ -38,13 +38,13 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -unsigned char AddSource = 0; /* Add source lines as comments */ -unsigned char DebugInfo = 0; /* Add debug info to the obj */ +unsigned char AddSource = 0; /* Add source lines as comments */ +unsigned char DebugInfo = 0; /* Add debug info to the obj */ unsigned char PreprocessOnly = 0; /* Just preprocess the input */ unsigned char DebugOptOutput = 0; /* Output debug stuff */ unsigned RegisterSpace = 6; /* Space available for register vars */ @@ -59,8 +59,8 @@ IntStack RegVarsToCallStack = INTSTACK(0); /* Save reg variables on call stack IntStack StaticLocals = INTSTACK(0); /* Make local variables static */ IntStack SignedChars = INTSTACK(0); /* Make characters signed by default */ IntStack CheckStack = INTSTACK(0); /* Generate stack overflow checks */ -IntStack Optimize = INTSTACK(0); /* Optimize flag */ -IntStack CodeSizeFactor = INTSTACK(100);/* Size factor for generated code */ +IntStack Optimize = INTSTACK(0); /* Optimize flag */ +IntStack CodeSizeFactor = INTSTACK(100);/* Size factor for generated code */ IntStack DataAlignment = INTSTACK(1); /* Alignment for data */ /* File names */ diff --git a/src/cc65/global.h b/src/cc65/global.h index dc624b0da..b9c15a26e 100644 --- a/src/cc65/global.h +++ b/src/cc65/global.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ -/* Global variables for the cc65 C compiler */ +/* Global variables for the cc65 C compiler */ /* */ /* */ /* */ @@ -45,30 +45,30 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Options */ -extern unsigned char AddSource; /* Add source lines as comments */ -extern unsigned char DebugInfo; /* Add debug info to the obj */ +extern unsigned char AddSource; /* Add source lines as comments */ +extern unsigned char DebugInfo; /* Add debug info to the obj */ extern unsigned char PreprocessOnly; /* Just preprocess the input */ extern unsigned char DebugOptOutput; /* Output debug stuff */ extern unsigned RegisterSpace; /* Space available for register vars */ /* Stackable options */ -extern IntStack WritableStrings; /* Literal strings are r/w */ +extern IntStack WritableStrings; /* Literal strings are r/w */ extern IntStack LocalStrings; /* Emit string literals immediately */ -extern IntStack InlineStdFuncs; /* Inline some known functions */ -extern IntStack EnableRegVars; /* Enable register variables */ -extern IntStack AllowRegVarAddr; /* Allow taking addresses of register vars */ -extern IntStack RegVarsToCallStack; /* Save reg variables on call stack */ -extern IntStack StaticLocals; /* Make local variables static */ -extern IntStack SignedChars; /* Make characters signed by default */ -extern IntStack CheckStack; /* Generate stack overflow checks */ -extern IntStack Optimize; /* Optimize flag */ -extern IntStack CodeSizeFactor; /* Size factor for generated code */ +extern IntStack InlineStdFuncs; /* Inline some known functions */ +extern IntStack EnableRegVars; /* Enable register variables */ +extern IntStack AllowRegVarAddr; /* Allow taking addresses of register vars */ +extern IntStack RegVarsToCallStack; /* Save reg variables on call stack */ +extern IntStack StaticLocals; /* Make local variables static */ +extern IntStack SignedChars; /* Make characters signed by default */ +extern IntStack CheckStack; /* Generate stack overflow checks */ +extern IntStack Optimize; /* Optimize flag */ +extern IntStack CodeSizeFactor; /* Size factor for generated code */ extern IntStack DataAlignment; /* Alignment for data */ /* File names */ diff --git a/src/cc65/goto.c b/src/cc65/goto.c index 33d056f9a..6f12c145b 100644 --- a/src/cc65/goto.c +++ b/src/cc65/goto.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* goto.c */ +/* goto.c */ /* */ -/* Goto and label handling for the cc65 C compiler */ +/* Goto and label handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -56,15 +56,15 @@ void GotoStatement (void) /* Label name must follow */ if (CurTok.Tok != TOK_IDENT) { - Error ("Label name expected"); + Error ("Label name expected"); } else { - /* Add a new label symbol if we don't have one until now */ - SymEntry* Entry = AddLabelSym (CurTok.Ident, SC_REF); + /* Add a new label symbol if we don't have one until now */ + SymEntry* Entry = AddLabelSym (CurTok.Ident, SC_REF); - /* Jump to the label */ - g_jump (Entry->V.Label); + /* Jump to the label */ + g_jump (Entry->V.Label); } /* Eat the label name */ diff --git a/src/cc65/goto.h b/src/cc65/goto.h index 3ec95e542..a887b0eaa 100644 --- a/src/cc65/goto.h +++ b/src/cc65/goto.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* goto.h */ +/* goto.h */ /* */ -/* Goto and label handling for the cc65 C compiler */ +/* Goto and label handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/hexval.c b/src/cc65/hexval.c index 21c8ef8b8..aaedf68ce 100644 --- a/src/cc65/hexval.c +++ b/src/cc65/hexval.c @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -54,12 +54,12 @@ unsigned HexVal (int C) */ { if (!IsXDigit (C)) { - Error ("Invalid hexadecimal digit: `%c'", C); + Error ("Invalid hexadecimal digit: `%c'", C); } if (IsDigit (C)) { - return C - '0'; + return C - '0'; } else { - return toupper (C) - 'A' + 10; + return toupper (C) - 'A' + 10; } } diff --git a/src/cc65/hexval.h b/src/cc65/hexval.h index edba95bf4..770ed5ce5 100644 --- a/src/cc65/hexval.h +++ b/src/cc65/hexval.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/ident.c b/src/cc65/ident.c index f29f06a74..fac69bd0a 100644 --- a/src/cc65/ident.c +++ b/src/cc65/ident.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* ident.c */ +/* ident.c */ /* */ -/* Identifier handling for the cc65 compiler */ +/* Identifier handling for the cc65 compiler */ /* */ /* */ /* */ @@ -35,14 +35,14 @@ /* common */ #include "chartype.h" - + /* cc65 */ #include "ident.h" /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/ident.h b/src/cc65/ident.h index f4db625d7..d470e198b 100644 --- a/src/cc65/ident.h +++ b/src/cc65/ident.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* ident.h */ +/* ident.h */ /* */ -/* Identifier handling for the cc65 compiler */ +/* Identifier handling for the cc65 compiler */ /* */ /* */ /* */ @@ -39,14 +39,14 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Maximum length of an identifier and the corresponding char array */ -#define MAX_IDENTLEN 64 -#define IDENTSIZE (MAX_IDENTLEN+1) +#define MAX_IDENTLEN 64 +#define IDENTSIZE (MAX_IDENTLEN+1) /* Variable that holds an identifer */ typedef char ident [IDENTSIZE]; @@ -54,7 +54,7 @@ typedef char ident [IDENTSIZE]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/incpath.c b/src/cc65/incpath.c index 2a9058ad0..7a4b31e94 100644 --- a/src/cc65/incpath.c +++ b/src/cc65/incpath.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* incpath.c */ +/* incpath.c */ /* */ -/* Include path handling for cc65 */ +/* Include path handling for cc65 */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -50,7 +50,7 @@ SearchPath* UsrIncSearchPath; /* User include path */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/incpath.h b/src/cc65/incpath.h index dc109674d..ed8ba50cc 100644 --- a/src/cc65/incpath.h +++ b/src/cc65/incpath.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* incpath.h */ +/* incpath.h */ /* */ -/* Include path handling for cc65 */ +/* Include path handling for cc65 */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -55,7 +55,7 @@ extern SearchPath* UsrIncSearchPath; /* User include path */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/input.c b/src/cc65/input.c index a1ef9ec98..a98c72e4f 100644 --- a/src/cc65/input.c +++ b/src/cc65/input.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* input.c */ +/* input.c */ /* */ -/* Input file handling */ +/* Input file handling */ /* */ /* */ /* */ @@ -58,7 +58,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -71,24 +71,24 @@ char CurC = '\0'; char NextC = '\0'; /* Maximum count of nested includes */ -#define MAX_INC_NESTING 16 +#define MAX_INC_NESTING 16 /* Struct that describes an input file */ typedef struct IFile IFile; struct IFile { - unsigned Index; /* File index */ - unsigned Usage; /* Usage counter */ + unsigned Index; /* File index */ + unsigned Usage; /* Usage counter */ unsigned long Size; /* File size */ unsigned long MTime; /* Time of last modification */ InputType Type; /* Type of input file */ - char Name[1]; /* Name of file (dynamically allocated) */ + char Name[1]; /* Name of file (dynamically allocated) */ }; /* Struct that describes an active input file */ typedef struct AFile AFile; struct AFile { - unsigned Line; /* Line number for this file */ - FILE* F; /* Input file stream */ + unsigned Line; /* Line number for this file */ + FILE* F; /* Input file stream */ IFile* Input; /* Points to corresponding IFile */ int SearchPath; /* True if we've added a path for this file */ }; @@ -105,7 +105,7 @@ static Collection InputStack = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* struct IFile */ +/* struct IFile */ /*****************************************************************************/ @@ -137,7 +137,7 @@ static IFile* NewIFile (const char* Name, InputType Type) /*****************************************************************************/ -/* struct AFile */ +/* struct AFile */ /*****************************************************************************/ @@ -163,7 +163,7 @@ static AFile* NewAFile (IFile* IF, FILE* F) */ if (IF->Usage++ == 0) { - /* Get file size and modification time. There a race condition here, + /* Get file size and modification time. There a race condition here, * since we cannot use fileno() (non standard identifier in standard * header file), and therefore not fstat. When using stat with the * file name, there's a risk that the file was deleted and recreated @@ -171,16 +171,16 @@ static AFile* NewAFile (IFile* IF, FILE* F) * if a file has changed in the debugger, we will ignore this problem * here. */ - struct stat Buf; - if (FileStat (IF->Name, &Buf) != 0) { - /* Error */ - Fatal ("Cannot stat `%s': %s", IF->Name, strerror (errno)); - } - IF->Size = (unsigned long) Buf.st_size; - IF->MTime = (unsigned long) Buf.st_mtime; + struct stat Buf; + if (FileStat (IF->Name, &Buf) != 0) { + /* Error */ + Fatal ("Cannot stat `%s': %s", IF->Name, strerror (errno)); + } + IF->Size = (unsigned long) Buf.st_size; + IF->MTime = (unsigned long) Buf.st_mtime; - /* Set the debug data */ - g_fileinfo (IF->Name, IF->Size, IF->MTime); + /* Set the debug data */ + g_fileinfo (IF->Name, IF->Size, IF->MTime); } /* Insert the new structure into the AFile collection */ @@ -210,7 +210,7 @@ static void FreeAFile (AFile* AF) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -223,13 +223,13 @@ static IFile* FindFile (const char* Name) { unsigned I; for (I = 0; I < CollCount (&IFiles); ++I) { - /* Get the file struct */ - IFile* IF = (IFile*) CollAt (&IFiles, I); - /* Check the name */ - if (strcmp (Name, IF->Name) == 0) { - /* Found, return the struct */ - return IF; - } + /* Get the file struct */ + IFile* IF = (IFile*) CollAt (&IFiles, I); + /* Check the name */ + if (strcmp (Name, IF->Name) == 0) { + /* Found, return the struct */ + return IF; + } } /* Not found */ @@ -250,8 +250,8 @@ void OpenMainFile (const char* Name) /* Open the file for reading */ FILE* F = fopen (Name, "r"); if (F == 0) { - /* Cannot open */ - Fatal ("Cannot open input file `%s': %s", Name, strerror (errno)); + /* Cannot open */ + Fatal ("Cannot open input file `%s': %s", Name, strerror (errno)); } /* Allocate a new AFile structure for the file */ @@ -277,15 +277,15 @@ void OpenIncludeFile (const char* Name, InputType IT) /* Check for the maximum include nesting */ if (CollCount (&AFiles) > MAX_INC_NESTING) { - PPError ("Include nesting too deep"); - return; + PPError ("Include nesting too deep"); + return; } /* Search for the file */ N = SearchFile ((IT == IT_SYSINC)? SysIncSearchPath : UsrIncSearchPath, Name); if (N == 0) { - PPError ("Include file `%s' not found", Name); - return; + PPError ("Include file `%s' not found", Name); + return; } /* Search the list of all input files for this file. If we don't find @@ -293,7 +293,7 @@ void OpenIncludeFile (const char* Name, InputType IT) */ IF = FindFile (N); if (IF == 0) { - IF = NewIFile (N, IT); + IF = NewIFile (N, IT); } /* We don't need N any longer, since we may now use IF->Name */ @@ -302,9 +302,9 @@ void OpenIncludeFile (const char* Name, InputType IT) /* Open the file */ F = fopen (IF->Name, "r"); if (F == 0) { - /* Error opening the file */ - PPError ("Cannot open include file `%s': %s", IF->Name, strerror (errno)); - return; + /* Error opening the file */ + PPError ("Cannot open include file `%s': %s", IF->Name, strerror (errno)); + return; } /* Debugging output */ @@ -438,14 +438,14 @@ StrBuf* InitLine (StrBuf* Buf) int NextLine (void) /* Get a line from the current input. Returns 0 on end of file. */ { - AFile* Input; + AFile* Input; /* Clear the current line */ ClearLine (); /* If there is no file open, bail out, otherwise get the current input file */ if (CollCount (&AFiles) == 0) { - return 0; + return 0; } Input = CollLast (&AFiles); @@ -464,8 +464,8 @@ int NextLine (void) break; } - /* Leave the current file */ - CloseIncludeFile (); + /* Leave the current file */ + CloseIncludeFile (); /* If there is no file open, bail out, otherwise get the * previous input file and start over. @@ -536,17 +536,17 @@ const char* GetCurrentFile (void) { unsigned AFileCount = CollCount (&AFiles); if (AFileCount > 0) { - const AFile* AF = (const AFile*) CollAt (&AFiles, AFileCount-1); - return AF->Input->Name; + const AFile* AF = (const AFile*) CollAt (&AFiles, AFileCount-1); + return AF->Input->Name; } else { - /* No open file. Use the main file if we have one. */ - unsigned IFileCount = CollCount (&IFiles); - if (IFileCount > 0) { - const IFile* IF = (const IFile*) CollAt (&IFiles, 0); - return IF->Name; - } else { - return "(outside file scope)"; - } + /* No open file. Use the main file if we have one. */ + unsigned IFileCount = CollCount (&IFiles); + if (IFileCount > 0) { + const IFile* IF = (const IFile*) CollAt (&IFiles, 0); + return IF->Name; + } else { + return "(outside file scope)"; + } } } @@ -557,11 +557,11 @@ unsigned GetCurrentLine (void) { unsigned AFileCount = CollCount (&AFiles); if (AFileCount > 0) { - const AFile* AF = (const AFile*) CollAt (&AFiles, AFileCount-1); - return AF->Line; + const AFile* AF = (const AFile*) CollAt (&AFiles, AFileCount-1); + return AF->Line; } else { - /* No open file */ - return 0; + /* No open file */ + return 0; } } @@ -591,20 +591,20 @@ static void WriteDep (FILE* F, InputType Types) unsigned FileCount = CollCount (&IFiles); for (I = 0; I < FileCount; ++I) { - /* Get the next input file */ - const IFile* IF = (const IFile*) CollAt (&IFiles, I); + /* Get the next input file */ + const IFile* IF = (const IFile*) CollAt (&IFiles, I); /* Ignore it if it is not of the correct type */ if ((IF->Type & Types) == 0) { continue; } - /* If this is not the first file, add a space */ - if (I > 0) { + /* If this is not the first file, add a space */ + if (I > 0) { fputc (' ', F); } - /* Print the dependency escaping spaces */ + /* Print the dependency escaping spaces */ WriteEscaped (F, IF->Name); } } @@ -619,7 +619,7 @@ static void CreateDepFile (const char* Name, InputType Types) /* Open the file */ FILE* F = fopen (Name, "w"); if (F == 0) { - Fatal ("Cannot open dependency file `%s': %s", Name, strerror (errno)); + Fatal ("Cannot open dependency file `%s': %s", Name, strerror (errno)); } /* If a dependency target was given, use it, otherwise use the output @@ -642,8 +642,8 @@ static void CreateDepFile (const char* Name, InputType Types) /* Close the file, check for errors */ if (fclose (F) != 0) { - remove (Name); - Fatal ("Cannot write to dependeny file (disk full?)"); + remove (Name); + Fatal ("Cannot write to dependeny file (disk full?)"); } } diff --git a/src/cc65/input.h b/src/cc65/input.h index dfa0ad03b..4d2fd7fb1 100644 --- a/src/cc65/input.h +++ b/src/cc65/input.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* input.h */ +/* input.h */ /* */ -/* Input file handling */ +/* Input file handling */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* data */ +/* data */ /*****************************************************************************/ @@ -73,7 +73,7 @@ extern char NextC; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/lineinfo.c b/src/cc65/lineinfo.c index e99d5201f..342fce969 100644 --- a/src/cc65/lineinfo.c +++ b/src/cc65/lineinfo.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* lineinfo.c */ +/* lineinfo.c */ /* */ -/* Source file line info structure */ +/* Source file line info structure */ /* */ /* */ /* */ @@ -48,7 +48,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -59,7 +59,7 @@ static LineInfo* CurLineInfo = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -78,7 +78,7 @@ static LineInfo* NewLineInfo (struct IFile* F, unsigned LineNum, const StrBuf* L /* Skip leading spaces in Line */ while (Len > 0 && IsBlank (*S)) { - ++S; + ++S; --Len; } @@ -96,13 +96,13 @@ static LineInfo* NewLineInfo (struct IFile* F, unsigned LineNum, const StrBuf* L */ T = LI->Line; while (Len--) { - if (*S == '\t') { - *T = ' '; - } else { - *T = *S; - } - ++S; - ++T; + if (*S == '\t') { + *T = ' '; + } else { + *T = *S; + } + ++S; + ++T; } /* Add the terminator */ @@ -139,8 +139,8 @@ void ReleaseLineInfo (LineInfo* LI) { CHECK (LI && LI->RefCount > 0); if (--LI->RefCount == 0) { - /* No more references, free it */ - FreeLineInfo (LI); + /* No more references, free it */ + FreeLineInfo (LI); } } @@ -161,14 +161,14 @@ void UpdateLineInfo (struct IFile* F, unsigned LineNum, const StrBuf* Line) { /* If a current line info exists, release it */ if (CurLineInfo) { - ReleaseLineInfo (CurLineInfo); + ReleaseLineInfo (CurLineInfo); } /* If we have intermixed assembly switched off, use an empty line instead * of the supplied one to save some memory. */ if (!AddSource) { - Line = &EmptyStrBuf; + Line = &EmptyStrBuf; } /* Create a new line info */ diff --git a/src/cc65/lineinfo.h b/src/cc65/lineinfo.h index 6d0f2d05c..3ecd0ce84 100644 --- a/src/cc65/lineinfo.h +++ b/src/cc65/lineinfo.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* lineinfo.h */ +/* lineinfo.h */ /* */ -/* Source file line info structure */ +/* Source file line info structure */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -55,7 +55,7 @@ struct IFile; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -65,7 +65,7 @@ struct IFile; */ typedef struct LineInfo LineInfo; struct LineInfo { - unsigned RefCount; /* Reference counter */ + unsigned RefCount; /* Reference counter */ struct IFile* InputFile; /* Input file for this line */ unsigned LineNum; /* Line number */ char Line[1]; /* Source code line */ @@ -74,7 +74,7 @@ struct LineInfo { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/litpool.c b/src/cc65/litpool.c index cf8261320..013c6ad4a 100644 --- a/src/cc65/litpool.c +++ b/src/cc65/litpool.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* litpool.c */ +/* litpool.c */ /* */ -/* Literal string handling for the cc65 C compiler */ +/* Literal string handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -53,7 +53,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -215,7 +215,7 @@ unsigned GetLiteralSize (const Literal* L) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -347,7 +347,7 @@ static void OutputWritableLiterals (Collection* Literals) /* If nothing there, exit... */ if (CollCount (Literals) == 0) { - return; + return; } /* Switch to the correct segment */ @@ -376,7 +376,7 @@ static void OutputReadOnlyLiterals (Collection* Literals) /* If nothing there, exit... */ if (CollCount (Literals) == 0) { - return; + return; } /* Switch to the correct segment */ diff --git a/src/cc65/litpool.h b/src/cc65/litpool.h index a71c58414..7a771d5eb 100644 --- a/src/cc65/litpool.h +++ b/src/cc65/litpool.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* litpool.h */ +/* litpool.h */ /* */ -/* Literal string handling for the cc65 C compiler */ +/* Literal string handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -92,7 +92,7 @@ unsigned GetLiteralSize (const Literal* L); /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/loadexpr.c b/src/cc65/loadexpr.c index 99c5684d1..d3c190b13 100644 --- a/src/cc65/loadexpr.c +++ b/src/cc65/loadexpr.c @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -53,38 +53,38 @@ static void LoadConstant (unsigned Flags, ExprDesc* Expr) { switch (ED_GetLoc (Expr)) { - case E_LOC_ABS: - /* Number constant */ - g_getimmed (Flags | TypeOf (Expr->Type) | CF_CONST, Expr->IVal, 0); - break; + case E_LOC_ABS: + /* Number constant */ + g_getimmed (Flags | TypeOf (Expr->Type) | CF_CONST, Expr->IVal, 0); + break; case E_LOC_GLOBAL: - /* Global symbol, load address */ - g_getimmed ((Flags | CF_EXTERNAL) & ~CF_CONST, Expr->Name, Expr->IVal); - break; + /* Global symbol, load address */ + g_getimmed ((Flags | CF_EXTERNAL) & ~CF_CONST, Expr->Name, Expr->IVal); + break; - case E_LOC_STATIC: - case E_LOC_LITERAL: - /* Static symbol or literal, load address */ - g_getimmed ((Flags | CF_STATIC) & ~CF_CONST, Expr->Name, Expr->IVal); - break; + case E_LOC_STATIC: + case E_LOC_LITERAL: + /* Static symbol or literal, load address */ + g_getimmed ((Flags | CF_STATIC) & ~CF_CONST, Expr->Name, Expr->IVal); + break; - case E_LOC_REGISTER: - /* Register variable. Taking the address is usually not - * allowed. - */ - if (IS_Get (&AllowRegVarAddr) == 0) { - Error ("Cannot take the address of a register variable"); - } - g_getimmed ((Flags | CF_REGVAR) & ~CF_CONST, Expr->Name, Expr->IVal); - break; + case E_LOC_REGISTER: + /* Register variable. Taking the address is usually not + * allowed. + */ + if (IS_Get (&AllowRegVarAddr) == 0) { + Error ("Cannot take the address of a register variable"); + } + g_getimmed ((Flags | CF_REGVAR) & ~CF_CONST, Expr->Name, Expr->IVal); + break; - case E_LOC_STACK: - g_leasp (Expr->IVal); - break; + case E_LOC_STACK: + g_leasp (Expr->IVal); + break; - default: - Internal ("Unknown constant type: %04X", Expr->Flags); + default: + Internal ("Unknown constant type: %04X", Expr->Flags); } } @@ -95,7 +95,7 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr) { if (ED_IsLVal (Expr)) { - /* Dereferenced lvalue. If this is a bit field its type is unsigned. + /* Dereferenced lvalue. If this is a bit field its type is unsigned. * But if the field is completely contained in the lower byte, we will * throw away the high byte anyway and may therefore load just the * low byte. @@ -106,9 +106,9 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr) } else { Flags |= TypeOf (Expr->Type); } - if (ED_NeedsTest (Expr)) { - Flags |= CF_TEST; - } + if (ED_NeedsTest (Expr)) { + Flags |= CF_TEST; + } switch (ED_GetLoc (Expr)) { @@ -173,8 +173,8 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr) ED_TestDone (Expr); } else { - /* An rvalue */ - if (ED_IsLocExpr (Expr)) { + /* An rvalue */ + if (ED_IsLocExpr (Expr)) { if (Expr->IVal != 0) { /* We have an expression in the primary plus a constant * offset. Adjust the value in the primary accordingly. @@ -182,10 +182,10 @@ void LoadExpr (unsigned Flags, struct ExprDesc* Expr) Flags |= TypeOf (Expr->Type); g_inc (Flags | CF_CONST, Expr->IVal); } - } else { - /* Constant of some sort, load it into the primary */ - LoadConstant (Flags, Expr); - } + } else { + /* Constant of some sort, load it into the primary */ + LoadConstant (Flags, Expr); + } /* Are we testing this value? */ if (ED_NeedsTest (Expr)) { diff --git a/src/cc65/loadexpr.h b/src/cc65/loadexpr.h index 96485a2c7..acd570f1f 100644 --- a/src/cc65/loadexpr.h +++ b/src/cc65/loadexpr.h @@ -49,7 +49,7 @@ struct ExprDesc; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/locals.c b/src/cc65/locals.c index 20b6b511e..bdc0df906 100644 --- a/src/cc65/locals.c +++ b/src/cc65/locals.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* locals.c */ +/* locals.c */ /* */ -/* Local variable handling for the cc65 C compiler */ +/* Local variable handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -56,7 +56,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -411,7 +411,7 @@ static void ParseStaticDecl (Declaration* Decl) static void ParseOneDecl (const DeclSpec* Spec) /* Parse one variable declaration */ { - Declaration Decl; /* Declaration data structure */ + Declaration Decl; /* Declaration data structure */ /* Read the declaration */ @@ -419,23 +419,23 @@ static void ParseOneDecl (const DeclSpec* Spec) /* Set the correct storage class for functions */ if ((Decl.StorageClass & SC_FUNC) == SC_FUNC) { - /* Function prototypes are always external */ - if ((Decl.StorageClass & SC_EXTERN) == 0) { - Warning ("Function must be extern"); - } - Decl.StorageClass |= SC_EXTERN; + /* Function prototypes are always external */ + if ((Decl.StorageClass & SC_EXTERN) == 0) { + Warning ("Function must be extern"); + } + Decl.StorageClass |= SC_EXTERN; } /* If we don't have a name, this was flagged as an error earlier. * To avoid problems later, use an anonymous name here. */ if (Decl.Ident[0] == '\0') { - AnonName (Decl.Ident, "param"); + AnonName (Decl.Ident, "param"); } /* If the symbol is not marked as external, it will be defined now */ if ((Decl.StorageClass & SC_EXTERN) == 0) { - Decl.StorageClass |= SC_DEF; + Decl.StorageClass |= SC_DEF; } /* Handle anything that needs storage (no functions, no typdefs) */ @@ -456,7 +456,7 @@ static void ParseOneDecl (const DeclSpec* Spec) if ((Decl.StorageClass & SC_REGISTER) == SC_REGISTER) { /* Register variable */ ParseRegisterDecl (&Decl, Reg); - } else if ((Decl.StorageClass & SC_AUTO) == SC_AUTO) { + } else if ((Decl.StorageClass & SC_AUTO) == SC_AUTO) { /* Auto variable */ ParseAutoDecl (&Decl); } else if ((Decl.StorageClass & SC_EXTERN) == SC_EXTERN) { @@ -466,10 +466,10 @@ static void ParseOneDecl (const DeclSpec* Spec) } /* Add the external symbol to the symbol table */ AddLocalSym (Decl.Ident, Decl.Type, Decl.StorageClass, 0); - } else if ((Decl.StorageClass & SC_STATIC) == SC_STATIC) { + } else if ((Decl.StorageClass & SC_STATIC) == SC_STATIC) { /* Static variable */ ParseStaticDecl (&Decl); - } else { + } else { Internal ("Invalid storage class in ParseOneDecl: %04X", Decl.StorageClass); } @@ -492,47 +492,47 @@ void DeclareLocals (void) /* Loop until we don't find any more variables */ while (1) { - /* Check variable declarations. We need to distinguish between a - * default int type and the end of variable declarations. So we - * will do the following: If there is no explicit storage class - * specifier *and* no explicit type given, *and* no type qualifiers + /* Check variable declarations. We need to distinguish between a + * default int type and the end of variable declarations. So we + * will do the following: If there is no explicit storage class + * specifier *and* no explicit type given, *and* no type qualifiers * have been read, it is assumed that we have reached the end of * declarations. - */ - DeclSpec Spec; - ParseDeclSpec (&Spec, SC_AUTO, T_INT); - if ((Spec.Flags & DS_DEF_STORAGE) != 0 && /* No storage spec */ + */ + DeclSpec Spec; + ParseDeclSpec (&Spec, SC_AUTO, T_INT); + if ((Spec.Flags & DS_DEF_STORAGE) != 0 && /* No storage spec */ (Spec.Flags & DS_DEF_TYPE) != 0 && /* No type given */ GetQualifier (Spec.Type) == T_QUAL_NONE) { /* No type qualifier */ - break; - } + break; + } - /* Accept type only declarations */ - if (CurTok.Tok == TOK_SEMI) { - /* Type declaration only */ - CheckEmptyDecl (&Spec); - NextToken (); - continue; - } + /* Accept type only declarations */ + if (CurTok.Tok == TOK_SEMI) { + /* Type declaration only */ + CheckEmptyDecl (&Spec); + NextToken (); + continue; + } - /* Parse a comma separated variable list */ - while (1) { + /* Parse a comma separated variable list */ + while (1) { - /* Parse one declaration */ - ParseOneDecl (&Spec); + /* Parse one declaration */ + ParseOneDecl (&Spec); - /* Check if there is more */ - if (CurTok.Tok == TOK_COMMA) { - /* More to come */ - NextToken (); - } else { - /* Done */ - break; - } - } + /* Check if there is more */ + if (CurTok.Tok == TOK_COMMA) { + /* More to come */ + NextToken (); + } else { + /* Done */ + break; + } + } - /* A semicolon must follow */ - ConsumeSemi (); + /* A semicolon must follow */ + ConsumeSemi (); } /* Be sure to allocate any reserved space for locals */ @@ -542,7 +542,7 @@ void DeclareLocals (void) * the stack checking routine if stack checks are enabled. */ if (IS_Get (&CheckStack) && InitialStack != StackPtr) { - g_cstackcheck (); + g_cstackcheck (); } } diff --git a/src/cc65/locals.h b/src/cc65/locals.h index d077e7b26..d47cb6725 100644 --- a/src/cc65/locals.h +++ b/src/cc65/locals.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* locals.h */ +/* locals.h */ /* */ -/* Local variable handling for the cc65 C compiler */ +/* Local variable handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/loop.c b/src/cc65/loop.c index f2925e0cb..4a3cdd882 100644 --- a/src/cc65/loop.c +++ b/src/cc65/loop.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* loop.c */ +/* loop.c */ /* */ -/* Loop management */ +/* Loop management */ /* */ /* */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -56,7 +56,7 @@ static LoopDesc* LoopStack = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -68,9 +68,9 @@ LoopDesc* AddLoop (unsigned BreakLabel, unsigned ContinueLabel) LoopDesc* L = xmalloc (sizeof (LoopDesc)); /* Fill in the data */ - L->StackPtr = StackPtr; + L->StackPtr = StackPtr; L->BreakLabel = BreakLabel; - L->ContinueLabel = ContinueLabel; + L->ContinueLabel = ContinueLabel; /* Insert it into the list */ L->Next = LoopStack; diff --git a/src/cc65/loop.h b/src/cc65/loop.h index c8660fb69..f24a3ef9f 100644 --- a/src/cc65/loop.h +++ b/src/cc65/loop.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* loop.h */ +/* loop.h */ /* */ -/* Loop management */ +/* Loop management */ /* */ /* */ /* */ @@ -39,23 +39,23 @@ /*****************************************************************************/ -/* data */ +/* data */ /*****************************************************************************/ typedef struct LoopDesc LoopDesc; struct LoopDesc { - LoopDesc* Next; - unsigned StackPtr; - unsigned BreakLabel; - unsigned ContinueLabel; + LoopDesc* Next; + unsigned StackPtr; + unsigned BreakLabel; + unsigned ContinueLabel; }; /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ diff --git a/src/cc65/macrotab.c b/src/cc65/macrotab.c index d0b18bdf1..acb532ac4 100644 --- a/src/cc65/macrotab.c +++ b/src/cc65/macrotab.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* macrotab.h */ +/* macrotab.h */ /* */ -/* Preprocessor macro table for the cc65 C compiler */ +/* Preprocessor macro table for the cc65 C compiler */ /* */ /* */ /* */ @@ -47,19 +47,19 @@ /*****************************************************************************/ -/* data */ +/* data */ /*****************************************************************************/ /* The macro hash table */ -#define MACRO_TAB_SIZE 211 +#define MACRO_TAB_SIZE 211 static Macro* MacroTab[MACRO_TAB_SIZE]; /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ @@ -76,10 +76,10 @@ Macro* NewMacro (const char* Name) Macro* M = (Macro*) xmalloc (sizeof(Macro) + Len); /* Initialize the data */ - M->Next = 0; + M->Next = 0; M->Expanding = 0; - M->ArgCount = -1; /* Flag: Not a function like macro */ - M->MaxArgs = 0; + M->ArgCount = -1; /* Flag: Not a function like macro */ + M->MaxArgs = 0; InitCollection (&M->FormalArgs); SB_Init (&M->Replacement); M->Variadic = 0; @@ -99,7 +99,7 @@ void FreeMacro (Macro* M) unsigned I; for (I = 0; I < CollCount (&M->FormalArgs); ++I) { - xfree (CollAtUnchecked (&M->FormalArgs, I)); + xfree (CollAtUnchecked (&M->FormalArgs, I)); } DoneCollection (&M->FormalArgs); SB_Done (&M->Replacement); @@ -163,26 +163,26 @@ int UndefineMacro (const char* Name) Macro* L = 0; Macro* M = MacroTab[Hash]; while (M) { - if (strcmp (M->Name, Name) == 0) { + if (strcmp (M->Name, Name) == 0) { - /* Found it */ - if (L == 0) { - /* First in chain */ - MacroTab[Hash] = M->Next; - } else { - L->Next = M->Next; - } + /* Found it */ + if (L == 0) { + /* First in chain */ + MacroTab[Hash] = M->Next; + } else { + L->Next = M->Next; + } - /* Delete the macro */ - FreeMacro (M); + /* Delete the macro */ + FreeMacro (M); - /* Done */ - return 1; - } + /* Done */ + return 1; + } - /* Next macro */ - L = M; - M = M->Next; + /* Next macro */ + L = M; + M = M->Next; } /* Not found */ @@ -200,13 +200,13 @@ Macro* FindMacro (const char* Name) /* Search the hash chain */ Macro* M = MacroTab[Hash]; while (M) { - if (strcmp (M->Name, Name) == 0) { - /* Found it */ - return M; - } + if (strcmp (M->Name, Name) == 0) { + /* Found it */ + return M; + } - /* Next macro */ - M = M->Next; + /* Next macro */ + M = M->Next; } /* Not found */ @@ -222,10 +222,10 @@ int FindMacroArg (Macro* M, const char* Arg) { unsigned I; for (I = 0; I < CollCount (&M->FormalArgs); ++I) { - if (strcmp (CollAtUnchecked (&M->FormalArgs, I), Arg) == 0) { - /* Found */ - return I; - } + if (strcmp (CollAtUnchecked (&M->FormalArgs, I), Arg) == 0) { + /* Found */ + return I; + } } /* Not found */ @@ -243,11 +243,11 @@ void AddMacroArg (Macro* M, const char* Arg) */ unsigned I; for (I = 0; I < CollCount (&M->FormalArgs); ++I) { - if (strcmp (CollAtUnchecked (&M->FormalArgs, I), Arg) == 0) { - /* Found */ - Error ("Duplicate macro parameter: `%s'", Arg); - break; - } + if (strcmp (CollAtUnchecked (&M->FormalArgs, I), Arg) == 0) { + /* Found */ + Error ("Duplicate macro parameter: `%s'", Arg); + break; + } } /* Add the new argument */ @@ -264,15 +264,15 @@ int MacroCmp (const Macro* M1, const Macro* M2) /* Argument count must be identical */ if (M1->ArgCount != M2->ArgCount) { - return 1; + return 1; } /* Compare the arguments */ for (I = 0; I < M1->ArgCount; ++I) { - if (strcmp (CollConstAt (&M1->FormalArgs, I), + if (strcmp (CollConstAt (&M1->FormalArgs, I), CollConstAt (&M2->FormalArgs, I)) != 0) { - return 1; - } + return 1; + } } /* Compare the replacement */ @@ -289,17 +289,17 @@ void PrintMacroStats (FILE* F) fprintf (F, "\n\nMacro Hash Table Summary\n"); for (I = 0; I < MACRO_TAB_SIZE; ++I) { - fprintf (F, "%3u : ", I); - M = MacroTab [I]; - if (M) { - while (M) { - fprintf (F, "%s ", M->Name); - M = M->Next; - } - fprintf (F, "\n"); - } else { - fprintf (F, "empty\n"); - } + fprintf (F, "%3u : ", I); + M = MacroTab [I]; + if (M) { + while (M) { + fprintf (F, "%s ", M->Name); + M = M->Next; + } + fprintf (F, "\n"); + } else { + fprintf (F, "empty\n"); + } } } diff --git a/src/cc65/macrotab.h b/src/cc65/macrotab.h index 91142e872..c20ab81c4 100644 --- a/src/cc65/macrotab.h +++ b/src/cc65/macrotab.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* macrotab.h */ +/* macrotab.h */ /* */ -/* Preprocessor macro table for the cc65 C compiler */ +/* Preprocessor macro table for the cc65 C compiler */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* data */ +/* data */ /*****************************************************************************/ @@ -54,20 +54,20 @@ /* Structure describing a macro */ typedef struct Macro Macro; struct Macro { - Macro* Next; /* Next macro with same hash value */ + Macro* Next; /* Next macro with same hash value */ int Expanding; /* Are we currently expanding this macro? */ - int ArgCount; /* Number of parameters, -1 = no parens */ - unsigned MaxArgs; /* Size of formal argument list */ - Collection FormalArgs; /* Formal argument list (char*) */ + int ArgCount; /* Number of parameters, -1 = no parens */ + unsigned MaxArgs; /* Size of formal argument list */ + Collection FormalArgs; /* Formal argument list (char*) */ StrBuf Replacement; /* Replacement text */ unsigned char Variadic; /* C99 variadic macro */ - char Name[1]; /* Name, dynamically allocated */ + char Name[1]; /* Name, dynamically allocated */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/main.c b/src/cc65/main.c index 02f378766..71fbb022f 100644 --- a/src/cc65/main.c +++ b/src/cc65/main.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* main.c */ +/* main.c */ /* */ -/* cc65 main program */ +/* cc65 main program */ /* */ /* */ /* */ @@ -71,7 +71,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -153,75 +153,75 @@ static void SetSys (const char* Sys) { switch (Target = FindTarget (Sys)) { - case TGT_NONE: - break; + case TGT_NONE: + break; case TGT_MODULE: AbEnd ("Cannot use `module' as a target for the compiler"); break; - case TGT_ATARI: - DefineNumericMacro ("__ATARI__", 1); - break; + case TGT_ATARI: + DefineNumericMacro ("__ATARI__", 1); + break; - case TGT_C16: - cbmsys ("__C16__"); - break; + case TGT_C16: + cbmsys ("__C16__"); + break; - case TGT_C64: - cbmsys ("__C64__"); - break; + case TGT_C64: + cbmsys ("__C64__"); + break; - case TGT_VIC20: - cbmsys ("__VIC20__"); - break; + case TGT_VIC20: + cbmsys ("__VIC20__"); + break; - case TGT_C128: - cbmsys ("__C128__"); - break; + case TGT_C128: + cbmsys ("__C128__"); + break; - case TGT_PLUS4: - cbmsys ("__PLUS4__"); - break; + case TGT_PLUS4: + cbmsys ("__PLUS4__"); + break; - case TGT_CBM510: - cbmsys ("__CBM510__"); - break; + case TGT_CBM510: + cbmsys ("__CBM510__"); + break; - case TGT_CBM610: - cbmsys ("__CBM610__"); - break; + case TGT_CBM610: + cbmsys ("__CBM610__"); + break; - case TGT_PET: - cbmsys ("__PET__"); - break; + case TGT_PET: + cbmsys ("__PET__"); + break; - case TGT_BBC: - DefineNumericMacro ("__BBC__", 1); - break; + case TGT_BBC: + DefineNumericMacro ("__BBC__", 1); + break; - case TGT_APPLE2: - DefineNumericMacro ("__APPLE2__", 1); - break; + case TGT_APPLE2: + DefineNumericMacro ("__APPLE2__", 1); + break; - case TGT_APPLE2ENH: + case TGT_APPLE2ENH: DefineNumericMacro ("__APPLE2ENH__", 1); - break; + break; - case TGT_GEOS_CBM: - /* Do not handle as a CBM system */ - DefineNumericMacro ("__GEOS__", 1); - DefineNumericMacro ("__GEOS_CBM__", 1); - break; + case TGT_GEOS_CBM: + /* Do not handle as a CBM system */ + DefineNumericMacro ("__GEOS__", 1); + DefineNumericMacro ("__GEOS_CBM__", 1); + break; - case TGT_GEOS_APPLE: - DefineNumericMacro ("__GEOS__", 1); - DefineNumericMacro ("__GEOS_APPLE__", 1); - break; + case TGT_GEOS_APPLE: + DefineNumericMacro ("__GEOS__", 1); + DefineNumericMacro ("__GEOS_APPLE__", 1); + break; - case TGT_LUNIX: - DefineNumericMacro ("__LUNIX__", 1); - break; + case TGT_LUNIX: + DefineNumericMacro ("__LUNIX__", 1); + break; case TGT_ATMOS: DefineNumericMacro ("__ATMOS__", 1); @@ -239,8 +239,8 @@ static void SetSys (const char* Sys) DefineNumericMacro ("__LYNX__", 1); break; - default: - AbEnd ("Unknown target system type %d", Target); + default: + AbEnd ("Unknown target system type %d", Target); } /* Initialize the translation tables for the target system */ @@ -270,38 +270,38 @@ static void DefineSym (const char* Def) /* The symbol must start with a character or underline */ if (Def [0] != '_' && !IsAlpha (Def [0])) { - InvDef (Def); + InvDef (Def); } /* Check the symbol name */ while (IsAlNum (*P) || *P == '_') { - ++P; + ++P; } /* Do we have a value given? */ if (*P != '=') { - if (*P != '\0') { - InvDef (Def); - } - /* No value given. Define the macro with the value 1 */ - DefineNumericMacro (Def, 1); + if (*P != '\0') { + InvDef (Def); + } + /* No value given. Define the macro with the value 1 */ + DefineNumericMacro (Def, 1); } else { - /* We have a value, P points to the '=' character. Since the argument - * is const, create a copy and replace the '=' in the copy by a zero - * terminator. - */ - char* Q; - unsigned Len = strlen (Def)+1; - char* S = (char*) xmalloc (Len); - memcpy (S, Def, Len); - Q = S + (P - Def); - *Q++ = '\0'; + /* We have a value, P points to the '=' character. Since the argument + * is const, create a copy and replace the '=' in the copy by a zero + * terminator. + */ + char* Q; + unsigned Len = strlen (Def)+1; + char* S = (char*) xmalloc (Len); + memcpy (S, Def, Len); + Q = S + (P - Def); + *Q++ = '\0'; - /* Define this as a macro */ - DefineTextMacro (S, Q); + /* Define this as a macro */ + DefineTextMacro (S, Q); - /* Release the allocated memory */ - xfree (S); + /* Release the allocated memory */ + xfree (S); } } @@ -312,14 +312,14 @@ static void CheckSegName (const char* Seg) { /* Print an error and abort if the name is not ok */ if (!ValidSegName (Seg)) { - AbEnd ("Segment name `%s' is invalid", Seg); + AbEnd ("Segment name `%s' is invalid", Seg); } } static void OptAddSource (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Add source lines as comments in generated assembler file */ { AddSource = 1; @@ -340,7 +340,7 @@ static void OptBssName (const char* Opt attribute ((unused)), const char* Arg) static void OptCheckStack (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Handle the --check-stack option */ { IS_Set (&CheckStack, 1); @@ -369,7 +369,7 @@ static void OptCodeSize (const char* Opt, const char* Arg) /* Numeric argument expected */ if (sscanf (Arg, "%u%c", &Factor, &BoundsCheck) != 1 || Factor < 10 || Factor > 1000) { - AbEnd ("Argument for %s is invalid", Opt); + AbEnd ("Argument for %s is invalid", Opt); } IS_Set (&CodeSizeFactor, Factor); } @@ -385,7 +385,7 @@ static void OptCreateDep (const char* Opt, const char* Arg) static void OptCreateFullDep (const char* Opt attribute ((unused)), - const char* Arg) + const char* Arg) /* Handle the --create-full-dep option */ { FileNameOption (Opt, Arg, &FullDepName); @@ -400,7 +400,7 @@ static void OptCPU (const char* Opt, const char* Arg) CPU = FindCPU (Arg); if (CPU != CPU_6502 && CPU != CPU_6502X && CPU != CPU_65SC02 && CPU != CPU_65C02 && CPU != CPU_65816 && CPU != CPU_HUC6280) { - AbEnd ("Invalid argument for %s: `%s'", Opt, Arg); + AbEnd ("Invalid argument for %s: `%s'", Opt, Arg); } } @@ -419,7 +419,7 @@ static void OptDataName (const char* Opt attribute ((unused)), const char* Arg) static void OptDebug (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Compiler debug mode */ { ++Debug; @@ -428,7 +428,7 @@ static void OptDebug (const char* Opt attribute ((unused)), static void OptDebugInfo (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Add debug info to the object file */ { DebugInfo = 1; @@ -445,7 +445,7 @@ static void OptDebugOpt (const char* Opt attribute ((unused)), const char* Arg) /* Open the file */ FILE* F = fopen (Arg, "r"); if (F == 0) { - AbEnd ("Cannot open `%s': %s", Arg, strerror (errno)); + AbEnd ("Cannot open `%s': %s", Arg, strerror (errno)); } /* Read line by line, ignore empty lines and switch optimization @@ -453,45 +453,45 @@ static void OptDebugOpt (const char* Opt attribute ((unused)), const char* Arg) */ while (fgets (Buf, sizeof (Buf), F) != 0) { - /* Remove trailing control chars. This will also remove the - * trailing newline. - */ - unsigned Len = strlen (Buf); - while (Len > 0 && IsControl (Buf[Len-1])) { - --Len; - } - Buf[Len] = '\0'; + /* Remove trailing control chars. This will also remove the + * trailing newline. + */ + unsigned Len = strlen (Buf); + while (Len > 0 && IsControl (Buf[Len-1])) { + --Len; + } + Buf[Len] = '\0'; - /* Get a pointer to the buffer and remove leading white space */ - Line = Buf; - while (IsBlank (*Line)) { - ++Line; - } + /* Get a pointer to the buffer and remove leading white space */ + Line = Buf; + while (IsBlank (*Line)) { + ++Line; + } - /* Check the first character and enable/disable the step or - * ignore the line - */ - switch (*Line) { + /* Check the first character and enable/disable the step or + * ignore the line + */ + switch (*Line) { - case '\0': - case '#': - case ';': - /* Empty or comment line */ - continue; + case '\0': + case '#': + case ';': + /* Empty or comment line */ + continue; - case '-': - DisableOpt (Line+1); - break; + case '-': + DisableOpt (Line+1); + break; - case '+': - ++Line; - /* FALLTHROUGH */ + case '+': + ++Line; + /* FALLTHROUGH */ - default: - EnableOpt (Line); - break; + default: + EnableOpt (Line); + break; - } + } } @@ -537,7 +537,7 @@ static void OptEnableOpt (const char* Opt attribute ((unused)), const char* Arg) static void OptHelp (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print usage information and exit */ { Usage (); @@ -556,7 +556,7 @@ static void OptIncludeDir (const char* Opt attribute ((unused)), const char* Arg static void OptListOptSteps (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* List all optimizer steps */ { /* List the optimizer steps */ @@ -569,7 +569,7 @@ static void OptListOptSteps (const char* Opt attribute ((unused)), static void OptListWarnings (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* List all warning types */ { /* List the warnings */ @@ -582,7 +582,7 @@ static void OptListWarnings (const char* Opt attribute ((unused)), static void OptLocalStrings (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Emit string literals immediately */ { IS_Set (&LocalStrings, 1); @@ -619,7 +619,7 @@ static void OptRegisterSpace (const char* Opt, const char* Arg) { /* Numeric argument expected */ if (sscanf (Arg, "%u", &RegisterSpace) != 1 || RegisterSpace > 256) { - AbEnd ("Argument for option %s is invalid", Opt); + AbEnd ("Argument for option %s is invalid", Opt); } } @@ -647,7 +647,7 @@ static void OptRodataName (const char* Opt attribute ((unused)), const char* Arg static void OptSignedChars (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Make default characters signed */ { IS_Set (&SignedChars, 1); @@ -661,7 +661,7 @@ static void OptStandard (const char* Opt, const char* Arg) /* Find the standard from the given name */ standard_t Std = FindStandard (Arg); if (Std == STD_UNKNOWN) { - AbEnd ("Invalid argument for %s: `%s'", Opt, Arg); + AbEnd ("Invalid argument for %s: `%s'", Opt, Arg); } else if (IS_Get (&Standard) != STD_UNKNOWN) { AbEnd ("Option %s given more than once", Opt); } else { @@ -672,7 +672,7 @@ static void OptStandard (const char* Opt, const char* Arg) static void OptStaticLocals (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Place local variables in static storage */ { IS_Set (&StaticLocals, 1); @@ -689,7 +689,7 @@ static void OptTarget (const char* Opt attribute ((unused)), const char* Arg) static void OptVerbose (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Increase verbosity */ { ++Verbosity; @@ -698,7 +698,7 @@ static void OptVerbose (const char* Opt attribute ((unused)), static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print the compiler version */ { fprintf (stderr, "cc65 V%s\n", GetVersionAsString ()); @@ -754,7 +754,7 @@ static void OptWarning (const char* Opt attribute ((unused)), const char* Arg) static void OptWritableStrings (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Make string literals writable */ { IS_Set (&WritableStrings, 1); @@ -766,38 +766,38 @@ int main (int argc, char* argv[]) { /* Program long options */ static const LongOpt OptTab[] = { - { "--add-source", 0, OptAddSource }, - { "--bss-name", 1, OptBssName }, - { "--check-stack", 0, OptCheckStack }, - { "--code-name", 1, OptCodeName }, - { "--codesize", 1, OptCodeSize }, - { "--cpu", 1, OptCPU }, - { "--create-dep", 1, OptCreateDep }, + { "--add-source", 0, OptAddSource }, + { "--bss-name", 1, OptBssName }, + { "--check-stack", 0, OptCheckStack }, + { "--code-name", 1, OptCodeName }, + { "--codesize", 1, OptCodeSize }, + { "--cpu", 1, OptCPU }, + { "--create-dep", 1, OptCreateDep }, { "--create-full-dep", 1, OptCreateFullDep }, - { "--data-name", 1, OptDataName }, - { "--debug", 0, OptDebug }, - { "--debug-info", 0, OptDebugInfo }, + { "--data-name", 1, OptDataName }, + { "--debug", 0, OptDebug }, + { "--debug-info", 0, OptDebugInfo }, { "--debug-opt", 1, OptDebugOpt }, { "--debug-opt-output", 0, OptDebugOptOutput }, { "--dep-target", 1, OptDepTarget }, - { "--disable-opt", 1, OptDisableOpt }, - { "--enable-opt", 1, OptEnableOpt }, - { "--help", 0, OptHelp }, - { "--include-dir", 1, OptIncludeDir }, - { "--list-opt-steps", 0, OptListOptSteps }, - { "--list-warnings", 0, OptListWarnings }, + { "--disable-opt", 1, OptDisableOpt }, + { "--enable-opt", 1, OptEnableOpt }, + { "--help", 0, OptHelp }, + { "--include-dir", 1, OptIncludeDir }, + { "--list-opt-steps", 0, OptListOptSteps }, + { "--list-warnings", 0, OptListWarnings }, { "--local-strings", 0, OptLocalStrings }, { "--memory-model", 1, OptMemoryModel }, { "--register-space", 1, OptRegisterSpace }, { "--register-vars", 0, OptRegisterVars }, - { "--rodata-name", 1, OptRodataName }, - { "--signed-chars", 0, OptSignedChars }, + { "--rodata-name", 1, OptRodataName }, + { "--signed-chars", 0, OptSignedChars }, { "--standard", 1, OptStandard }, - { "--static-locals", 0, OptStaticLocals }, - { "--target", 1, OptTarget }, - { "--verbose", 0, OptVerbose }, - { "--version", 0, OptVersion }, - { "--writable-strings", 0, OptWritableStrings }, + { "--static-locals", 0, OptStaticLocals }, + { "--target", 1, OptTarget }, + { "--verbose", 0, OptVerbose }, + { "--version", 0, OptVersion }, + { "--writable-strings", 0, OptWritableStrings }, }; unsigned I; @@ -818,132 +818,132 @@ int main (int argc, char* argv[]) I = 1; while (I < ArgCount) { - const char* P; + const char* P; - /* Get the argument */ - const char* Arg = ArgVec[I]; + /* Get the argument */ + const char* Arg = ArgVec[I]; - /* Check for an option */ - if (Arg[0] == '-') { + /* Check for an option */ + if (Arg[0] == '-') { - switch (Arg[1]) { + switch (Arg[1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; - case 'd': - OptDebug (Arg, 0); - break; + case 'd': + OptDebug (Arg, 0); + break; - case 'h': - case '?': - OptHelp (Arg, 0); - break; + case 'h': + case '?': + OptHelp (Arg, 0); + break; - case 'g': - OptDebugInfo (Arg, 0); - break; + case 'g': + OptDebugInfo (Arg, 0); + break; - case 'j': - OptSignedChars (Arg, 0); - break; + case 'j': + OptSignedChars (Arg, 0); + break; - case 'o': - SetOutputName (GetArg (&I, 2)); - break; + case 'o': + SetOutputName (GetArg (&I, 2)); + break; case 'r': OptRegisterVars (Arg, 0); break; - case 't': - OptTarget (Arg, GetArg (&I, 2)); - break; + case 't': + OptTarget (Arg, GetArg (&I, 2)); + break; - case 'u': - OptCreateDep (Arg, 0); - break; + case 'u': + OptCreateDep (Arg, 0); + break; - case 'v': - OptVerbose (Arg, 0); - break; + case 'v': + OptVerbose (Arg, 0); + break; - case 'C': - P = Arg + 2; - while (*P) { - switch (*P++) { - case 'l': - OptStaticLocals (Arg, 0); - break; - default: - UnknownOption (Arg); - break; - } - } - break; + case 'C': + P = Arg + 2; + while (*P) { + switch (*P++) { + case 'l': + OptStaticLocals (Arg, 0); + break; + default: + UnknownOption (Arg); + break; + } + } + break; - case 'D': - DefineSym (GetArg (&I, 2)); - break; + case 'D': + DefineSym (GetArg (&I, 2)); + break; case 'E': PreprocessOnly = 1; break; - case 'I': - OptIncludeDir (Arg, GetArg (&I, 2)); - break; + case 'I': + OptIncludeDir (Arg, GetArg (&I, 2)); + break; - case 'O': - IS_Set (&Optimize, 1); - P = Arg + 2; - while (*P) { - switch (*P++) { - case 'i': - IS_Set (&CodeSizeFactor, 200); - break; - case 'r': - IS_Set (&EnableRegVars, 1); - break; - case 's': - IS_Set (&InlineStdFuncs, 1); - break; - } - } - break; + case 'O': + IS_Set (&Optimize, 1); + P = Arg + 2; + while (*P) { + switch (*P++) { + case 'i': + IS_Set (&CodeSizeFactor, 200); + break; + case 'r': + IS_Set (&EnableRegVars, 1); + break; + case 's': + IS_Set (&InlineStdFuncs, 1); + break; + } + } + break; - case 'T': - OptAddSource (Arg, 0); - break; + case 'T': + OptAddSource (Arg, 0); + break; - case 'V': - OptVersion (Arg, 0); - break; + case 'V': + OptVersion (Arg, 0); + break; - case 'W': + case 'W': OptWarning (Arg, GetArg (&I, 2)); - break; + break; - default: - UnknownOption (Arg); - break; - } - } else { - if (InputFile) { - fprintf (stderr, "additional file specs ignored\n"); - } else { - InputFile = Arg; - } - } + default: + UnknownOption (Arg); + break; + } + } else { + if (InputFile) { + fprintf (stderr, "additional file specs ignored\n"); + } else { + InputFile = Arg; + } + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Did we have a file spec on the command line? */ if (InputFile == 0) { - AbEnd ("No input files"); + AbEnd ("No input files"); } /* Add the default include search paths. */ @@ -980,17 +980,17 @@ int main (int argc, char* argv[]) /* Emit literals, externals, do cleanup and optimizations */ FinishCompile (); - /* Open the file */ + /* Open the file */ OpenOutputFile (); - /* Write the output to the file */ - WriteAsmOutput (); - Print (stdout, 1, "Wrote output to `%s'\n", OutputFilename); + /* Write the output to the file */ + WriteAsmOutput (); + Print (stdout, 1, "Wrote output to `%s'\n", OutputFilename); - /* Close the file, check for errors */ + /* Close the file, check for errors */ CloseOutputFile (); - /* Create dependencies if requested */ + /* Create dependencies if requested */ CreateDependencies (); } diff --git a/src/cc65/opcodes.c b/src/cc65/opcodes.c index 2c838a695..d8a7fcb1f 100644 --- a/src/cc65/opcodes.c +++ b/src/cc65/opcodes.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* opcodes.c */ +/* opcodes.c */ /* */ -/* Opcode and addressing mode definitions */ +/* Opcode and addressing mode definitions */ /* */ /* */ /* */ @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,533 +58,533 @@ const OPCDesc OPCTable[OP65_COUNT] = { /* 65XX opcodes */ - { OP65_ADC, /* opcode */ - "adc", /* mnemonic */ - 0, /* size */ - REG_A, /* use */ - REG_A, /* chg */ - OF_SETF /* flags */ + { OP65_ADC, /* opcode */ + "adc", /* mnemonic */ + 0, /* size */ + REG_A, /* use */ + REG_A, /* chg */ + OF_SETF /* flags */ }, - { OP65_AND, /* opcode */ - "and", /* mnemonic */ - 0, /* size */ - REG_A, /* use */ - REG_A, /* chg */ - OF_SETF /* flags */ + { OP65_AND, /* opcode */ + "and", /* mnemonic */ + 0, /* size */ + REG_A, /* use */ + REG_A, /* chg */ + OF_SETF /* flags */ }, - { OP65_ASL, /* opcode */ - "asl", /* mnemonic */ - 0, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_SETF | OF_NOIMP /* flags */ + { OP65_ASL, /* opcode */ + "asl", /* mnemonic */ + 0, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_SETF | OF_NOIMP /* flags */ }, - { OP65_BCC, /* opcode */ - "bcc", /* mnemonic */ - 2, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA /* flags */ + { OP65_BCC, /* opcode */ + "bcc", /* mnemonic */ + 2, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA /* flags */ }, - { OP65_BCS, /* opcode */ - "bcs", /* mnemonic */ - 2, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA /* flags */ + { OP65_BCS, /* opcode */ + "bcs", /* mnemonic */ + 2, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA /* flags */ }, - { OP65_BEQ, /* opcode */ - "beq", /* mnemonic */ - 2, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_ZBRA | OF_FBRA /* flags */ + { OP65_BEQ, /* opcode */ + "beq", /* mnemonic */ + 2, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_ZBRA | OF_FBRA /* flags */ }, - { OP65_BIT, /* opcode */ - "bit", /* mnemonic */ - 0, /* size */ - REG_A, /* use */ - REG_NONE, /* chg */ - OF_SETF /* flags */ + { OP65_BIT, /* opcode */ + "bit", /* mnemonic */ + 0, /* size */ + REG_A, /* use */ + REG_NONE, /* chg */ + OF_SETF /* flags */ }, - { OP65_BMI, /* opcode */ - "bmi", /* mnemonic */ - 2, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_FBRA /* flags */ + { OP65_BMI, /* opcode */ + "bmi", /* mnemonic */ + 2, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_FBRA /* flags */ }, - { OP65_BNE, /* opcode */ - "bne", /* mnemonic */ - 2, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_ZBRA | OF_FBRA /* flags */ + { OP65_BNE, /* opcode */ + "bne", /* mnemonic */ + 2, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_ZBRA | OF_FBRA /* flags */ }, - { OP65_BPL, /* opcode */ - "bpl", /* mnemonic */ - 2, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_FBRA /* flags */ + { OP65_BPL, /* opcode */ + "bpl", /* mnemonic */ + 2, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_FBRA /* flags */ }, - { OP65_BRA, /* opcode */ - "bra", /* mnemonic */ - 2, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_UBRA /* flags */ + { OP65_BRA, /* opcode */ + "bra", /* mnemonic */ + 2, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_UBRA /* flags */ }, - { OP65_BRK, /* opcode */ - "brk", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_BRK, /* opcode */ + "brk", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_BVC, /* opcode */ - "bvc", /* mnemonic */ - 2, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA /* flags */ + { OP65_BVC, /* opcode */ + "bvc", /* mnemonic */ + 2, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA /* flags */ }, - { OP65_BVS, /* opcode */ - "bvs", /* mnemonic */ - 2, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA /* flags */ + { OP65_BVS, /* opcode */ + "bvs", /* mnemonic */ + 2, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA /* flags */ }, - { OP65_CLC, /* opcode */ - "clc", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_CLC, /* opcode */ + "clc", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_CLD, /* opcode */ - "cld", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_CLD, /* opcode */ + "cld", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_CLI, /* opcode */ - "cli", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_CLI, /* opcode */ + "cli", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_CLV, /* opcode */ - "clv", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_CLV, /* opcode */ + "clv", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_CMP, /* opcode */ - "cmp", /* mnemonic */ - 0, /* size */ - REG_A, /* use */ - REG_NONE, /* chg */ - OF_SETF | OF_CMP /* flags */ + { OP65_CMP, /* opcode */ + "cmp", /* mnemonic */ + 0, /* size */ + REG_A, /* use */ + REG_NONE, /* chg */ + OF_SETF | OF_CMP /* flags */ }, - { OP65_CPX, /* opcode */ - "cpx", /* mnemonic */ - 0, /* size */ - REG_X, /* use */ - REG_NONE, /* chg */ - OF_SETF | OF_CMP /* flags */ + { OP65_CPX, /* opcode */ + "cpx", /* mnemonic */ + 0, /* size */ + REG_X, /* use */ + REG_NONE, /* chg */ + OF_SETF | OF_CMP /* flags */ }, - { OP65_CPY, /* opcode */ - "cpy", /* mnemonic */ - 0, /* size */ - REG_Y, /* use */ - REG_NONE, /* chg */ - OF_SETF | OF_CMP /* flags */ + { OP65_CPY, /* opcode */ + "cpy", /* mnemonic */ + 0, /* size */ + REG_Y, /* use */ + REG_NONE, /* chg */ + OF_SETF | OF_CMP /* flags */ }, - { OP65_DEA, /* opcode */ - "dea", /* mnemonic */ - 1, /* size */ - REG_A, /* use */ - REG_A, /* chg */ - OF_REG_INCDEC | OF_SETF /* flags */ + { OP65_DEA, /* opcode */ + "dea", /* mnemonic */ + 1, /* size */ + REG_A, /* use */ + REG_A, /* chg */ + OF_REG_INCDEC | OF_SETF /* flags */ }, - { OP65_DEC, /* opcode */ - "dec", /* mnemonic */ - 0, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_SETF | OF_NOIMP /* flags */ + { OP65_DEC, /* opcode */ + "dec", /* mnemonic */ + 0, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_SETF | OF_NOIMP /* flags */ }, - { OP65_DEX, /* opcode */ - "dex", /* mnemonic */ - 1, /* size */ - REG_X, /* use */ - REG_X, /* chg */ - OF_REG_INCDEC | OF_SETF /* flags */ + { OP65_DEX, /* opcode */ + "dex", /* mnemonic */ + 1, /* size */ + REG_X, /* use */ + REG_X, /* chg */ + OF_REG_INCDEC | OF_SETF /* flags */ }, - { OP65_DEY, /* opcode */ - "dey", /* mnemonic */ - 1, /* size */ - REG_Y, /* use */ - REG_Y, /* chg */ - OF_REG_INCDEC | OF_SETF /* flags */ + { OP65_DEY, /* opcode */ + "dey", /* mnemonic */ + 1, /* size */ + REG_Y, /* use */ + REG_Y, /* chg */ + OF_REG_INCDEC | OF_SETF /* flags */ }, - { OP65_EOR, /* opcode */ - "eor", /* mnemonic */ - 0, /* size */ - REG_A, /* use */ - REG_A, /* chg */ - OF_SETF /* flags */ + { OP65_EOR, /* opcode */ + "eor", /* mnemonic */ + 0, /* size */ + REG_A, /* use */ + REG_A, /* chg */ + OF_SETF /* flags */ }, - { OP65_INA, /* opcode */ - "ina", /* mnemonic */ - 1, /* size */ - REG_A, /* use */ - REG_A, /* chg */ - OF_REG_INCDEC | OF_SETF /* flags */ + { OP65_INA, /* opcode */ + "ina", /* mnemonic */ + 1, /* size */ + REG_A, /* use */ + REG_A, /* chg */ + OF_REG_INCDEC | OF_SETF /* flags */ }, - { OP65_INC, /* opcode */ - "inc", /* mnemonic */ - 0, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_SETF | OF_NOIMP /* flags */ + { OP65_INC, /* opcode */ + "inc", /* mnemonic */ + 0, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_SETF | OF_NOIMP /* flags */ }, - { OP65_INX, /* opcode */ - "inx", /* mnemonic */ - 1, /* size */ - REG_X, /* use */ - REG_X, /* chg */ - OF_REG_INCDEC | OF_SETF /* flags */ + { OP65_INX, /* opcode */ + "inx", /* mnemonic */ + 1, /* size */ + REG_X, /* use */ + REG_X, /* chg */ + OF_REG_INCDEC | OF_SETF /* flags */ }, - { OP65_INY, /* opcode */ - "iny", /* mnemonic */ - 1, /* size */ - REG_Y, /* use */ - REG_Y, /* chg */ - OF_REG_INCDEC | OF_SETF /* flags */ + { OP65_INY, /* opcode */ + "iny", /* mnemonic */ + 1, /* size */ + REG_Y, /* use */ + REG_Y, /* chg */ + OF_REG_INCDEC | OF_SETF /* flags */ }, - { OP65_JCC, /* opcode */ - "jcc", /* mnemonic */ - 5, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_LBRA /* flags */ + { OP65_JCC, /* opcode */ + "jcc", /* mnemonic */ + 5, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_LBRA /* flags */ }, - { OP65_JCS, /* opcode */ - "jcs", /* mnemonic */ - 5, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_LBRA /* flags */ + { OP65_JCS, /* opcode */ + "jcs", /* mnemonic */ + 5, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_LBRA /* flags */ }, - { OP65_JEQ, /* opcode */ - "jeq", /* mnemonic */ - 5, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_LBRA | OF_ZBRA | OF_FBRA /* flags */ + { OP65_JEQ, /* opcode */ + "jeq", /* mnemonic */ + 5, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_LBRA | OF_ZBRA | OF_FBRA /* flags */ }, - { OP65_JMI, /* opcode */ - "jmi", /* mnemonic */ - 5, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_LBRA | OF_FBRA /* flags */ + { OP65_JMI, /* opcode */ + "jmi", /* mnemonic */ + 5, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_LBRA | OF_FBRA /* flags */ }, - { OP65_JMP, /* opcode */ - "jmp", /* mnemonic */ - 3, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_UBRA | OF_LBRA /* flags */ + { OP65_JMP, /* opcode */ + "jmp", /* mnemonic */ + 3, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_UBRA | OF_LBRA /* flags */ }, - { OP65_JNE, /* opcode */ - "jne", /* mnemonic */ - 5, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_LBRA | OF_ZBRA | OF_FBRA /* flags */ + { OP65_JNE, /* opcode */ + "jne", /* mnemonic */ + 5, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_LBRA | OF_ZBRA | OF_FBRA /* flags */ }, - { OP65_JPL, /* opcode */ - "jpl", /* mnemonic */ - 5, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_LBRA | OF_FBRA /* flags */ + { OP65_JPL, /* opcode */ + "jpl", /* mnemonic */ + 5, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_LBRA | OF_FBRA /* flags */ }, - { OP65_JSR, /* opcode */ - "jsr", /* mnemonic */ - 3, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CALL /* flags */ + { OP65_JSR, /* opcode */ + "jsr", /* mnemonic */ + 3, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CALL /* flags */ }, - { OP65_JVC, /* opcode */ - "jvc", /* mnemonic */ - 5, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_LBRA /* flags */ + { OP65_JVC, /* opcode */ + "jvc", /* mnemonic */ + 5, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_LBRA /* flags */ }, - { OP65_JVS, /* opcode */ - "jvs", /* mnemonic */ - 5, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_CBRA | OF_LBRA /* flags */ + { OP65_JVS, /* opcode */ + "jvs", /* mnemonic */ + 5, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_CBRA | OF_LBRA /* flags */ }, - { OP65_LDA, /* opcode */ - "lda", /* mnemonic */ - 0, /* size */ - REG_NONE, /* use */ - REG_A, /* chg */ - OF_LOAD | OF_SETF /* flags */ + { OP65_LDA, /* opcode */ + "lda", /* mnemonic */ + 0, /* size */ + REG_NONE, /* use */ + REG_A, /* chg */ + OF_LOAD | OF_SETF /* flags */ }, - { OP65_LDX, /* opcode */ - "ldx", /* mnemonic */ - 0, /* size */ - REG_NONE, /* use */ - REG_X, /* chg */ - OF_LOAD | OF_SETF /* flags */ + { OP65_LDX, /* opcode */ + "ldx", /* mnemonic */ + 0, /* size */ + REG_NONE, /* use */ + REG_X, /* chg */ + OF_LOAD | OF_SETF /* flags */ }, - { OP65_LDY, /* opcode */ - "ldy", /* mnemonic */ - 0, /* size */ - REG_NONE, /* use */ - REG_Y, /* chg */ - OF_LOAD | OF_SETF /* flags */ + { OP65_LDY, /* opcode */ + "ldy", /* mnemonic */ + 0, /* size */ + REG_NONE, /* use */ + REG_Y, /* chg */ + OF_LOAD | OF_SETF /* flags */ }, - { OP65_LSR, /* opcode */ - "lsr", /* mnemonic */ - 0, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_SETF | OF_NOIMP /* flags */ + { OP65_LSR, /* opcode */ + "lsr", /* mnemonic */ + 0, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_SETF | OF_NOIMP /* flags */ }, - { OP65_NOP, /* opcode */ - "nop", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_NOP, /* opcode */ + "nop", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_ORA, /* opcode */ - "ora", /* mnemonic */ - 0, /* size */ - REG_A, /* use */ - REG_A, /* chg */ - OF_SETF /* flags */ + { OP65_ORA, /* opcode */ + "ora", /* mnemonic */ + 0, /* size */ + REG_A, /* use */ + REG_A, /* chg */ + OF_SETF /* flags */ }, - { OP65_PHA, /* opcode */ - "pha", /* mnemonic */ - 1, /* size */ - REG_A, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_PHA, /* opcode */ + "pha", /* mnemonic */ + 1, /* size */ + REG_A, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_PHP, /* opcode */ - "php", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_PHP, /* opcode */ + "php", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_PHX, /* opcode */ - "phx", /* mnemonic */ - 1, /* size */ - REG_X, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_PHX, /* opcode */ + "phx", /* mnemonic */ + 1, /* size */ + REG_X, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_PHY, /* opcode */ - "phy", /* mnemonic */ - 1, /* size */ - REG_Y, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_PHY, /* opcode */ + "phy", /* mnemonic */ + 1, /* size */ + REG_Y, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_PLA, /* opcode */ - "pla", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_A, /* chg */ - OF_SETF /* flags */ + { OP65_PLA, /* opcode */ + "pla", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_A, /* chg */ + OF_SETF /* flags */ }, - { OP65_PLP, /* opcode */ - "plp", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_PLP, /* opcode */ + "plp", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_PLX, /* opcode */ - "plx", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_X, /* chg */ - OF_SETF /* flags */ + { OP65_PLX, /* opcode */ + "plx", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_X, /* chg */ + OF_SETF /* flags */ }, - { OP65_PLY, /* opcode */ - "ply", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_Y, /* chg */ - OF_SETF /* flags */ + { OP65_PLY, /* opcode */ + "ply", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_Y, /* chg */ + OF_SETF /* flags */ }, - { OP65_ROL, /* opcode */ - "rol", /* mnemonic */ - 0, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_SETF | OF_NOIMP /* flags */ + { OP65_ROL, /* opcode */ + "rol", /* mnemonic */ + 0, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_SETF | OF_NOIMP /* flags */ }, - { OP65_ROR, /* opcode */ - "ror", /* mnemonic */ - 0, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_SETF | OF_NOIMP /* flags */ + { OP65_ROR, /* opcode */ + "ror", /* mnemonic */ + 0, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_SETF | OF_NOIMP /* flags */ }, /* Mark RTI as "uses all registers but doesn't change them", so the * optimizer won't remove preceeding loads. */ - { OP65_RTI, /* opcode */ - "rti", /* mnemonic */ - 1, /* size */ - REG_AXY, /* use */ - REG_NONE, /* chg */ - OF_RET /* flags */ + { OP65_RTI, /* opcode */ + "rti", /* mnemonic */ + 1, /* size */ + REG_AXY, /* use */ + REG_NONE, /* chg */ + OF_RET /* flags */ }, - { OP65_RTS, /* opcode */ - "rts", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_RET /* flags */ + { OP65_RTS, /* opcode */ + "rts", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_RET /* flags */ }, - { OP65_SBC, /* opcode */ - "sbc", /* mnemonic */ - 0, /* size */ - REG_A, /* use */ - REG_A, /* chg */ - OF_SETF /* flags */ + { OP65_SBC, /* opcode */ + "sbc", /* mnemonic */ + 0, /* size */ + REG_A, /* use */ + REG_A, /* chg */ + OF_SETF /* flags */ }, - { OP65_SEC, /* opcode */ - "sec", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_SEC, /* opcode */ + "sec", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_SED, /* opcode */ - "sed", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_SED, /* opcode */ + "sed", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_SEI, /* opcode */ - "sei", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_NONE /* flags */ + { OP65_SEI, /* opcode */ + "sei", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_NONE /* flags */ }, - { OP65_STA, /* opcode */ - "sta", /* mnemonic */ - 0, /* size */ - REG_A, /* use */ - REG_NONE, /* chg */ - OF_STORE /* flags */ + { OP65_STA, /* opcode */ + "sta", /* mnemonic */ + 0, /* size */ + REG_A, /* use */ + REG_NONE, /* chg */ + OF_STORE /* flags */ }, - { OP65_STX, /* opcode */ - "stx", /* mnemonic */ - 0, /* size */ - REG_X, /* use */ - REG_NONE, /* chg */ - OF_STORE /* flags */ + { OP65_STX, /* opcode */ + "stx", /* mnemonic */ + 0, /* size */ + REG_X, /* use */ + REG_NONE, /* chg */ + OF_STORE /* flags */ }, - { OP65_STY, /* opcode */ - "sty", /* mnemonic */ - 0, /* size */ - REG_Y, /* use */ - REG_NONE, /* chg */ - OF_STORE /* flags */ + { OP65_STY, /* opcode */ + "sty", /* mnemonic */ + 0, /* size */ + REG_Y, /* use */ + REG_NONE, /* chg */ + OF_STORE /* flags */ }, - { OP65_STZ, /* opcode */ - "stz", /* mnemonic */ - 0, /* size */ - REG_NONE, /* use */ - REG_NONE, /* chg */ - OF_STORE /* flags */ + { OP65_STZ, /* opcode */ + "stz", /* mnemonic */ + 0, /* size */ + REG_NONE, /* use */ + REG_NONE, /* chg */ + OF_STORE /* flags */ }, - { OP65_TAX, /* opcode */ - "tax", /* mnemonic */ - 1, /* size */ - REG_A, /* use */ - REG_X, /* chg */ - OF_XFR | OF_SETF /* flags */ + { OP65_TAX, /* opcode */ + "tax", /* mnemonic */ + 1, /* size */ + REG_A, /* use */ + REG_X, /* chg */ + OF_XFR | OF_SETF /* flags */ }, - { OP65_TAY, /* opcode */ - "tay", /* mnemonic */ - 1, /* size */ - REG_A, /* use */ - REG_Y, /* chg */ - OF_XFR | OF_SETF /* flags */ + { OP65_TAY, /* opcode */ + "tay", /* mnemonic */ + 1, /* size */ + REG_A, /* use */ + REG_Y, /* chg */ + OF_XFR | OF_SETF /* flags */ }, - { OP65_TRB, /* opcode */ - "trb", /* mnemonic */ - 0, /* size */ - REG_A, /* use */ - REG_NONE, /* chg */ - OF_SETF /* flags */ + { OP65_TRB, /* opcode */ + "trb", /* mnemonic */ + 0, /* size */ + REG_A, /* use */ + REG_NONE, /* chg */ + OF_SETF /* flags */ }, - { OP65_TSB, /* opcode */ - "tsb", /* mnemonic */ - 0, /* size */ - REG_A, /* use */ - REG_NONE, /* chg */ - OF_SETF /* flags */ + { OP65_TSB, /* opcode */ + "tsb", /* mnemonic */ + 0, /* size */ + REG_A, /* use */ + REG_NONE, /* chg */ + OF_SETF /* flags */ }, - { OP65_TSX, /* opcode */ - "tsx", /* mnemonic */ - 1, /* size */ - REG_NONE, /* use */ - REG_X, /* chg */ - OF_XFR | OF_SETF /* flags */ + { OP65_TSX, /* opcode */ + "tsx", /* mnemonic */ + 1, /* size */ + REG_NONE, /* use */ + REG_X, /* chg */ + OF_XFR | OF_SETF /* flags */ }, - { OP65_TXA, /* opcode */ - "txa", /* mnemonic */ - 1, /* size */ - REG_X, /* use */ - REG_A, /* chg */ - OF_XFR | OF_SETF /* flags */ + { OP65_TXA, /* opcode */ + "txa", /* mnemonic */ + 1, /* size */ + REG_X, /* use */ + REG_A, /* chg */ + OF_XFR | OF_SETF /* flags */ }, - { OP65_TXS, /* opcode */ - "txs", /* mnemonic */ - 1, /* size */ - REG_X, /* use */ - REG_NONE, /* chg */ - OF_XFR /* flags */ + { OP65_TXS, /* opcode */ + "txs", /* mnemonic */ + 1, /* size */ + REG_X, /* use */ + REG_NONE, /* chg */ + OF_XFR /* flags */ }, - { OP65_TYA, /* opcode */ - "tya", /* mnemonic */ - 1, /* size */ - REG_Y, /* use */ - REG_A, /* chg */ - OF_XFR | OF_SETF /* flags */ + { OP65_TYA, /* opcode */ + "tya", /* mnemonic */ + 1, /* size */ + REG_Y, /* use */ + REG_A, /* chg */ + OF_XFR | OF_SETF /* flags */ }, }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -611,17 +611,17 @@ const OPCDesc* FindOP65 (const char* M) char Mnemo[sizeof (OPCTable[0].Mnemo)]; Len = strlen (M); if (Len >= sizeof (OPCTable[0].Mnemo)) { - /* Invalid length means invalid opcode */ - return 0; + /* Invalid length means invalid opcode */ + return 0; } for (I = 0; I < Len; ++I) { - Mnemo[I] = tolower (M[I]); + Mnemo[I] = tolower (M[I]); } Mnemo[I] = '\0'; /* Search for the mnemonic in the table and return the result */ return bsearch (Mnemo, OPCTable, OP65_COUNT, - sizeof (OPCTable[0]), FindCmp ); + sizeof (OPCTable[0]), FindCmp ); } @@ -632,25 +632,25 @@ unsigned GetInsnSize (opc_t OPC, am_t AM) /* Get the opcode desc and check the size given there */ const OPCDesc* D = &OPCTable[OPC]; if (D->Size != 0) { - return D->Size; + return D->Size; } /* Check the addressing mode. */ switch (AM) { - case AM65_IMP: return 1; - case AM65_ACC: return 1; - case AM65_IMM: return 2; - case AM65_ZP: return 2; - case AM65_ZPX: return 2; - case AM65_ABS: return 3; - case AM65_ABSX: return 3; - case AM65_ABSY: return 3; - case AM65_ZPX_IND: return 2; - case AM65_ZP_INDY: return 2; - case AM65_ZP_IND: return 2; - default: - Internal ("Invalid addressing mode"); - return 0; + case AM65_IMP: return 1; + case AM65_ACC: return 1; + case AM65_IMM: return 2; + case AM65_ZP: return 2; + case AM65_ZPX: return 2; + case AM65_ABS: return 3; + case AM65_ABSX: return 3; + case AM65_ABSY: return 3; + case AM65_ZPX_IND: return 2; + case AM65_ZP_INDY: return 2; + case AM65_ZP_IND: return 2; + default: + Internal ("Invalid addressing mode"); + return 0; } } @@ -663,13 +663,13 @@ unsigned char GetAMUseInfo (am_t AM) { /* Check the addressing mode. */ switch (AM) { - case AM65_ACC: return REG_A; - case AM65_ZPX: return REG_X; - case AM65_ABSX: return REG_X; - case AM65_ABSY: return REG_Y; - case AM65_ZPX_IND: return REG_X; - case AM65_ZP_INDY: return REG_Y; - default: return REG_NONE; + case AM65_ACC: return REG_A; + case AM65_ZPX: return REG_X; + case AM65_ABSX: return REG_X; + case AM65_ABSY: return REG_Y; + case AM65_ZPX_IND: return REG_X; + case AM65_ZP_INDY: return REG_Y; + default: return REG_NONE; } } @@ -679,25 +679,25 @@ opc_t GetInverseBranch (opc_t OPC) /* Return a branch that reverse the condition of the branch given in OPC */ { switch (OPC) { - case OP65_BCC: return OP65_BCS; - case OP65_BCS: return OP65_BCC; - case OP65_BEQ: return OP65_BNE; - case OP65_BMI: return OP65_BPL; - case OP65_BNE: return OP65_BEQ; - case OP65_BPL: return OP65_BMI; - case OP65_BVC: return OP65_BVS; - case OP65_BVS: return OP65_BVC; - case OP65_JCC: return OP65_JCS; - case OP65_JCS: return OP65_JCC; - case OP65_JEQ: return OP65_JNE; - case OP65_JMI: return OP65_JPL; - case OP65_JNE: return OP65_JEQ; - case OP65_JPL: return OP65_JMI; - case OP65_JVC: return OP65_JVS; - case OP65_JVS: return OP65_JVC; - default: - Internal ("GetInverseBranch: Invalid opcode: %d", OPC); - return 0; + case OP65_BCC: return OP65_BCS; + case OP65_BCS: return OP65_BCC; + case OP65_BEQ: return OP65_BNE; + case OP65_BMI: return OP65_BPL; + case OP65_BNE: return OP65_BEQ; + case OP65_BPL: return OP65_BMI; + case OP65_BVC: return OP65_BVS; + case OP65_BVS: return OP65_BVC; + case OP65_JCC: return OP65_JCS; + case OP65_JCS: return OP65_JCC; + case OP65_JEQ: return OP65_JNE; + case OP65_JMI: return OP65_JPL; + case OP65_JNE: return OP65_JEQ; + case OP65_JPL: return OP65_JMI; + case OP65_JVC: return OP65_JVS; + case OP65_JVS: return OP65_JVC; + default: + Internal ("GetInverseBranch: Invalid opcode: %d", OPC); + return 0; } } @@ -709,27 +709,27 @@ opc_t MakeShortBranch (opc_t OPC) */ { switch (OPC) { - case OP65_BCC: - case OP65_JCC: return OP65_BCC; - case OP65_BCS: - case OP65_JCS: return OP65_BCS; - case OP65_BEQ: - case OP65_JEQ: return OP65_BEQ; - case OP65_BMI: - case OP65_JMI: return OP65_BMI; - case OP65_BNE: - case OP65_JNE: return OP65_BNE; - case OP65_BPL: - case OP65_JPL: return OP65_BPL; - case OP65_BVC: - case OP65_JVC: return OP65_BVC; - case OP65_BVS: - case OP65_JVS: return OP65_BVS; - case OP65_BRA: - case OP65_JMP: return (CPUIsets[CPU] & CPU_ISET_65SC02)? OP65_BRA : OP65_JMP; - default: - Internal ("MakeShortBranch: Invalid opcode: %d", OPC); - return 0; + case OP65_BCC: + case OP65_JCC: return OP65_BCC; + case OP65_BCS: + case OP65_JCS: return OP65_BCS; + case OP65_BEQ: + case OP65_JEQ: return OP65_BEQ; + case OP65_BMI: + case OP65_JMI: return OP65_BMI; + case OP65_BNE: + case OP65_JNE: return OP65_BNE; + case OP65_BPL: + case OP65_JPL: return OP65_BPL; + case OP65_BVC: + case OP65_JVC: return OP65_BVC; + case OP65_BVS: + case OP65_JVS: return OP65_BVS; + case OP65_BRA: + case OP65_JMP: return (CPUIsets[CPU] & CPU_ISET_65SC02)? OP65_BRA : OP65_JMP; + default: + Internal ("MakeShortBranch: Invalid opcode: %d", OPC); + return 0; } } @@ -741,27 +741,27 @@ opc_t MakeLongBranch (opc_t OPC) */ { switch (OPC) { - case OP65_BCC: - case OP65_JCC: return OP65_JCC; - case OP65_BCS: - case OP65_JCS: return OP65_JCS; - case OP65_BEQ: - case OP65_JEQ: return OP65_JEQ; - case OP65_BMI: - case OP65_JMI: return OP65_JMI; - case OP65_BNE: - case OP65_JNE: return OP65_JNE; - case OP65_BPL: - case OP65_JPL: return OP65_JPL; - case OP65_BVC: - case OP65_JVC: return OP65_JVC; - case OP65_BVS: - case OP65_JVS: return OP65_JVS; - case OP65_BRA: - case OP65_JMP: return OP65_JMP; - default: - Internal ("MakeLongBranch: Invalid opcode: %d", OPC); - return 0; + case OP65_BCC: + case OP65_JCC: return OP65_JCC; + case OP65_BCS: + case OP65_JCS: return OP65_JCS; + case OP65_BEQ: + case OP65_JEQ: return OP65_JEQ; + case OP65_BMI: + case OP65_JMI: return OP65_JMI; + case OP65_BNE: + case OP65_JNE: return OP65_JNE; + case OP65_BPL: + case OP65_JPL: return OP65_JPL; + case OP65_BVC: + case OP65_JVC: return OP65_JVC; + case OP65_BVS: + case OP65_JVS: return OP65_JVS; + case OP65_BRA: + case OP65_JMP: return OP65_JMP; + default: + Internal ("MakeLongBranch: Invalid opcode: %d", OPC); + return 0; } } @@ -771,25 +771,25 @@ bc_t GetBranchCond (opc_t OPC) /* Get the condition for the conditional branch in OPC */ { switch (OPC) { - case OP65_BCC: return BC_CC; - case OP65_BCS: return BC_CS; - case OP65_BEQ: return BC_EQ; - case OP65_BMI: return BC_MI; - case OP65_BNE: return BC_NE; - case OP65_BPL: return BC_PL; - case OP65_BVC: return BC_VC; - case OP65_BVS: return BC_VS; - case OP65_JCC: return BC_CC; - case OP65_JCS: return BC_CS; - case OP65_JEQ: return BC_EQ; - case OP65_JMI: return BC_MI; - case OP65_JNE: return BC_NE; - case OP65_JPL: return BC_PL; - case OP65_JVC: return BC_VC; - case OP65_JVS: return BC_VS; - default: - Internal ("GetBranchCond: Invalid opcode: %d", OPC); - return 0; + case OP65_BCC: return BC_CC; + case OP65_BCS: return BC_CS; + case OP65_BEQ: return BC_EQ; + case OP65_BMI: return BC_MI; + case OP65_BNE: return BC_NE; + case OP65_BPL: return BC_PL; + case OP65_BVC: return BC_VC; + case OP65_BVS: return BC_VS; + case OP65_JCC: return BC_CC; + case OP65_JCS: return BC_CS; + case OP65_JEQ: return BC_EQ; + case OP65_JMI: return BC_MI; + case OP65_JNE: return BC_NE; + case OP65_JPL: return BC_PL; + case OP65_JVC: return BC_VC; + case OP65_JVS: return BC_VS; + default: + Internal ("GetBranchCond: Invalid opcode: %d", OPC); + return 0; } } @@ -799,17 +799,17 @@ bc_t GetInverseCond (bc_t BC) /* Return the inverse condition of the given one */ { switch (BC) { - case BC_CC: return BC_CS; - case BC_CS: return BC_CC; - case BC_EQ: return BC_NE; - case BC_MI: return BC_PL; - case BC_NE: return BC_EQ; - case BC_PL: return BC_MI; - case BC_VC: return BC_VS; - case BC_VS: return BC_VC; - default: - Internal ("GetInverseCond: Invalid condition: %d", BC); - return 0; + case BC_CC: return BC_CS; + case BC_CS: return BC_CC; + case BC_EQ: return BC_NE; + case BC_MI: return BC_PL; + case BC_NE: return BC_EQ; + case BC_PL: return BC_MI; + case BC_VC: return BC_VS; + case BC_VS: return BC_VC; + default: + Internal ("GetInverseCond: Invalid condition: %d", BC); + return 0; } } diff --git a/src/cc65/opcodes.h b/src/cc65/opcodes.h index fb9e3e53e..7dc5262c8 100644 --- a/src/cc65/opcodes.h +++ b/src/cc65/opcodes.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* opcodes.h */ +/* opcodes.h */ /* */ -/* Opcode and addressing mode definitions */ +/* Opcode and addressing mode definitions */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -132,18 +132,18 @@ typedef enum { /* 65XX addressing modes */ typedef enum { - AM65_IMP, /* implicit */ - AM65_ACC, /* accumulator */ - AM65_IMM, /* immidiate */ - AM65_ZP, /* zeropage */ - AM65_ZPX, /* zeropage,X */ + AM65_IMP, /* implicit */ + AM65_ACC, /* accumulator */ + AM65_IMM, /* immidiate */ + AM65_ZP, /* zeropage */ + AM65_ZPX, /* zeropage,X */ AM65_ZPY, /* zeropage,Y */ - AM65_ABS, /* absolute */ - AM65_ABSX, /* absolute,X */ - AM65_ABSY, /* absolute,Y */ - AM65_ZPX_IND, /* (zeropage,x) */ - AM65_ZP_INDY, /* (zeropage),y */ - AM65_ZP_IND, /* (zeropage) */ + AM65_ABS, /* absolute */ + AM65_ABSX, /* absolute,X */ + AM65_ABSY, /* absolute,Y */ + AM65_ZPX_IND, /* (zeropage,x) */ + AM65_ZP_INDY, /* (zeropage),y */ + AM65_ZP_IND, /* (zeropage) */ AM65_BRA /* branch */ } am_t; @@ -160,14 +160,14 @@ typedef enum { } bc_t; /* Opcode info */ -#define OF_NONE 0x0000U /* No additional information */ -#define OF_UBRA 0x0001U /* Unconditional branch */ -#define OF_CBRA 0x0002U /* Conditional branch */ -#define OF_ZBRA 0x0004U /* Branch on zero flag condition */ +#define OF_NONE 0x0000U /* No additional information */ +#define OF_UBRA 0x0001U /* Unconditional branch */ +#define OF_CBRA 0x0002U /* Conditional branch */ +#define OF_ZBRA 0x0004U /* Branch on zero flag condition */ #define OF_FBRA 0x0008U /* Branch on cond set by a load */ -#define OF_LBRA 0x0010U /* Jump/branch is long */ -#define OF_RET 0x0020U /* Return from function */ -#define OF_LOAD 0x0040U /* Register load */ +#define OF_LBRA 0x0010U /* Jump/branch is long */ +#define OF_RET 0x0020U /* Return from function */ +#define OF_LOAD 0x0040U /* Register load */ #define OF_STORE 0x0080U /* Register store */ #define OF_XFR 0x0100U /* Transfer instruction */ #define OF_CALL 0x0200U /* A subroutine call */ @@ -177,17 +177,17 @@ typedef enum { #define OF_NOIMP 0x2000U /* Implicit addressing mode is actually A */ /* Combined infos */ -#define OF_BRA (OF_UBRA | OF_CBRA) /* Operation is a jump/branch */ -#define OF_DEAD (OF_UBRA | OF_RET) /* Dead end - no exec behind this point */ +#define OF_BRA (OF_UBRA | OF_CBRA) /* Operation is a jump/branch */ +#define OF_DEAD (OF_UBRA | OF_RET) /* Dead end - no exec behind this point */ /* Opcode description */ typedef struct { - opc_t OPC; /* Opcode */ - char Mnemo[9]; /* Mnemonic */ - unsigned char Size; /* Size, 0 = check addressing mode */ - unsigned short Use; /* Registers used by this insn */ - unsigned short Chg; /* Registers changed by this insn */ - unsigned short Info; /* Additional information */ + opc_t OPC; /* Opcode */ + char Mnemo[9]; /* Mnemonic */ + unsigned char Size; /* Size, 0 = check addressing mode */ + unsigned short Use; /* Registers used by this insn */ + unsigned short Chg; /* Registers changed by this insn */ + unsigned short Info; /* Additional information */ } OPCDesc; /* Opcode description table */ @@ -196,7 +196,7 @@ extern const OPCDesc OPCTable[OP65_COUNT]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -217,7 +217,7 @@ INLINE const OPCDesc* GetOPCDesc (opc_t OPC) return &OPCTable [OPC]; } #else -# define GetOPCDesc(OPC) (&OPCTable [(OPC)]) +# define GetOPCDesc(OPC) (&OPCTable [(OPC)]) #endif #if defined(HAVE_INLINE) @@ -228,7 +228,7 @@ INLINE unsigned GetOPCInfo (opc_t OPC) return OPCTable[OPC].Info; } #else -# define GetOPCInfo(OPC) (OPCTable[(OPC)].Info) +# define GetOPCInfo(OPC) (OPCTable[(OPC)].Info) #endif unsigned char GetAMUseInfo (am_t AM); diff --git a/src/cc65/output.c b/src/cc65/output.c index 5db77d0c4..92a66108e 100644 --- a/src/cc65/output.c +++ b/src/cc65/output.c @@ -52,7 +52,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -66,7 +66,7 @@ FILE* OutputFile = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/output.h b/src/cc65/output.h index 485e20a46..bcabba7a9 100644 --- a/src/cc65/output.h +++ b/src/cc65/output.h @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -60,7 +60,7 @@ extern FILE* OutputFile; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/pragma.c b/src/cc65/pragma.c index 08d62ae20..980d46a20 100644 --- a/src/cc65/pragma.c +++ b/src/cc65/pragma.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* pragma.c */ +/* pragma.c */ /* */ -/* Pragma handling for the cc65 C compiler */ +/* Pragma handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -55,7 +55,7 @@ /*****************************************************************************/ -/* data */ +/* data */ /*****************************************************************************/ @@ -93,34 +93,34 @@ typedef enum { /* Pragma table */ static const struct Pragma { - const char* Key; /* Keyword */ - pragma_t Tok; /* Token */ + const char* Key; /* Keyword */ + pragma_t Tok; /* Token */ } Pragmas[PRAGMA_COUNT] = { { "align", PRAGMA_ALIGN }, { "bss-name", PRAGMA_BSS_NAME }, { "bssseg", PRAGMA_BSSSEG }, /* obsolete */ { "charmap", PRAGMA_CHARMAP }, { "check-stack", PRAGMA_CHECK_STACK }, - { "checkstack", PRAGMA_CHECKSTACK }, /* obsolete */ + { "checkstack", PRAGMA_CHECKSTACK }, /* obsolete */ { "code-name", PRAGMA_CODE_NAME }, - { "codeseg", PRAGMA_CODESEG }, /* obsolete */ + { "codeseg", PRAGMA_CODESEG }, /* obsolete */ { "codesize", PRAGMA_CODESIZE }, { "data-name", PRAGMA_DATA_NAME }, - { "dataseg", PRAGMA_DATASEG }, /* obsolete */ + { "dataseg", PRAGMA_DATASEG }, /* obsolete */ { "local-strings", PRAGMA_LOCAL_STRINGS }, { "optimize", PRAGMA_OPTIMIZE }, { "register-vars", PRAGMA_REGISTER_VARS }, - { "regvaraddr", PRAGMA_REGVARADDR }, + { "regvaraddr", PRAGMA_REGVARADDR }, { "regvars", PRAGMA_REGVARS }, /* obsolete */ { "rodata-name", PRAGMA_RODATA_NAME }, - { "rodataseg", PRAGMA_RODATASEG }, /* obsolete */ + { "rodataseg", PRAGMA_RODATASEG }, /* obsolete */ { "signed-chars", PRAGMA_SIGNED_CHARS }, - { "signedchars", PRAGMA_SIGNEDCHARS }, /* obsolete */ + { "signedchars", PRAGMA_SIGNEDCHARS }, /* obsolete */ { "static-locals", PRAGMA_STATIC_LOCALS }, - { "staticlocals", PRAGMA_STATICLOCALS }, /* obsolete */ + { "staticlocals", PRAGMA_STATICLOCALS }, /* obsolete */ { "warn", PRAGMA_WARN }, { "writable-strings", PRAGMA_WRITABLE_STRINGS }, - { "zpsym", PRAGMA_ZPSYM }, + { "zpsym", PRAGMA_ZPSYM }, }; /* Result of ParsePushPop */ @@ -192,7 +192,7 @@ static int GetString (StrBuf* B, StrBuf* S) */ { if (!SB_GetString (B, S)) { - Error ("String literal expected"); + Error ("String literal expected"); return 0; } return 1; @@ -206,7 +206,7 @@ static int GetNumber (StrBuf* B, long* Val) */ { if (!SB_GetNumber (B, Val)) { - Error ("Constant integer expected"); + Error ("Constant integer expected"); return 0; } return 1; @@ -366,8 +366,8 @@ static void StringPragma (StrBuf* B, void (*Func) (const char*)) /* We expect a string here */ if (GetString (B, &S)) { - /* Call the given function with the string argument */ - Func (SB_GetConstBuf (&S)); + /* Call the given function with the string argument */ + Func (SB_GetConstBuf (&S)); } /* Call the string buf destructor */ @@ -459,7 +459,7 @@ static void CharMapPragma (StrBuf* B) } else { Error ("Character index out of range"); } - return; + return; } /* Comma follows */ @@ -478,7 +478,7 @@ static void CharMapPragma (StrBuf* B) } else { Error ("Character code out of range"); } - return; + return; } /* Remap the character */ @@ -675,13 +675,13 @@ static void ParsePragma (void) /* Do we know this pragma? */ if (Pragma == PRAGMA_ILLEGAL) { - /* According to the ANSI standard, we're not allowed to generate errors - * for unknown pragmas, but warn about them if enabled (the default). - */ + /* According to the ANSI standard, we're not allowed to generate errors + * for unknown pragmas, but warn about them if enabled (the default). + */ if (IS_Get (&WarnUnknownPragma)) { - Warning ("Unknown pragma `%s'", SB_GetConstBuf (&Ident)); + Warning ("Unknown pragma `%s'", SB_GetConstBuf (&Ident)); } - goto ExitPoint; + goto ExitPoint; } /* Check for an open paren */ @@ -701,41 +701,41 @@ static void ParsePragma (void) IntPragma (&B, &DataAlignment, 1, 4096); break; - case PRAGMA_BSSSEG: + case PRAGMA_BSSSEG: Warning ("#pragma bssseg is obsolete, please use #pragma bss-name instead"); /* FALLTHROUGH */ case PRAGMA_BSS_NAME: - SegNamePragma (&B, SEG_BSS); - break; + SegNamePragma (&B, SEG_BSS); + break; - case PRAGMA_CHARMAP: - CharMapPragma (&B); - break; + case PRAGMA_CHARMAP: + CharMapPragma (&B); + break; - case PRAGMA_CHECKSTACK: + case PRAGMA_CHECKSTACK: Warning ("#pragma checkstack is obsolete, please use #pragma check-stack instead"); /* FALLTHROUGH */ case PRAGMA_CHECK_STACK: - FlagPragma (&B, &CheckStack); - break; + FlagPragma (&B, &CheckStack); + break; - case PRAGMA_CODESEG: + case PRAGMA_CODESEG: Warning ("#pragma codeseg is obsolete, please use #pragma code-name instead"); /* FALLTHROUGH */ case PRAGMA_CODE_NAME: - SegNamePragma (&B, SEG_CODE); - break; + SegNamePragma (&B, SEG_CODE); + break; - case PRAGMA_CODESIZE: - IntPragma (&B, &CodeSizeFactor, 10, 1000); - break; + case PRAGMA_CODESIZE: + IntPragma (&B, &CodeSizeFactor, 10, 1000); + break; - case PRAGMA_DATASEG: + case PRAGMA_DATASEG: Warning ("#pragma dataseg is obsolete, please use #pragma data-name instead"); /* FALLTHROUGH */ case PRAGMA_DATA_NAME: - SegNamePragma (&B, SEG_DATA); - break; + SegNamePragma (&B, SEG_DATA); + break; case PRAGMA_LOCAL_STRINGS: FlagPragma (&B, &LocalStrings); @@ -745,37 +745,37 @@ static void ParsePragma (void) FlagPragma (&B, &Optimize); break; - case PRAGMA_REGVARADDR: - FlagPragma (&B, &AllowRegVarAddr); - break; + case PRAGMA_REGVARADDR: + FlagPragma (&B, &AllowRegVarAddr); + break; - case PRAGMA_REGVARS: + case PRAGMA_REGVARS: Warning ("#pragma regvars is obsolete, please use #pragma register-vars instead"); /* FALLTHROUGH */ case PRAGMA_REGISTER_VARS: - FlagPragma (&B, &EnableRegVars); - break; + FlagPragma (&B, &EnableRegVars); + break; - case PRAGMA_RODATASEG: + case PRAGMA_RODATASEG: Warning ("#pragma rodataseg is obsolete, please use #pragma rodata-name instead"); /* FALLTHROUGH */ case PRAGMA_RODATA_NAME: - SegNamePragma (&B, SEG_RODATA); - break; + SegNamePragma (&B, SEG_RODATA); + break; - case PRAGMA_SIGNEDCHARS: + case PRAGMA_SIGNEDCHARS: Warning ("#pragma signedchars is obsolete, please use #pragma signed-chars instead"); /* FALLTHROUGH */ case PRAGMA_SIGNED_CHARS: - FlagPragma (&B, &SignedChars); - break; + FlagPragma (&B, &SignedChars); + break; - case PRAGMA_STATICLOCALS: + case PRAGMA_STATICLOCALS: Warning ("#pragma staticlocals is obsolete, please use #pragma static-locals instead"); /* FALLTHROUGH */ case PRAGMA_STATIC_LOCALS: - FlagPragma (&B, &StaticLocals); - break; + FlagPragma (&B, &StaticLocals); + break; case PRAGMA_WARN: WarnPragma (&B); @@ -785,12 +785,12 @@ static void ParsePragma (void) FlagPragma (&B, &WritableStrings); break; - case PRAGMA_ZPSYM: - StringPragma (&B, MakeZPSym); - break; + case PRAGMA_ZPSYM: + StringPragma (&B, MakeZPSym); + break; - default: - Internal ("Invalid pragma"); + default: + Internal ("Invalid pragma"); } /* Closing paren expected */ @@ -828,24 +828,24 @@ void DoPragma (void) /* We expect an opening paren */ if (!ConsumeLParen ()) { - return; + return; } /* String literal */ if (CurTok.Tok != TOK_SCONST) { - /* Print a diagnostic */ - Error ("String literal expected"); + /* Print a diagnostic */ + Error ("String literal expected"); - /* Try some smart error recovery: Skip tokens until we reach the - * enclosing paren, or a semicolon. - */ - PragmaErrorSkip (); + /* Try some smart error recovery: Skip tokens until we reach the + * enclosing paren, or a semicolon. + */ + PragmaErrorSkip (); } else { - /* Parse the _Pragma statement */ - ParsePragma (); + /* Parse the _Pragma statement */ + ParsePragma (); } /* Closing paren needed */ diff --git a/src/cc65/pragma.h b/src/cc65/pragma.h index 86ef28697..d75273fa6 100644 --- a/src/cc65/pragma.h +++ b/src/cc65/pragma.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* pragma.h */ +/* pragma.h */ /* */ -/* Pragma handling for the cc65 C compiler */ +/* Pragma handling for the cc65 C compiler */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/preproc.c b/src/cc65/preproc.c index 8edeacdd7..199388deb 100644 --- a/src/cc65/preproc.c +++ b/src/cc65/preproc.c @@ -62,7 +62,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -93,7 +93,7 @@ struct MacroExp { /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -109,7 +109,7 @@ static void MacroReplacement (StrBuf* Source, StrBuf* Target); /*****************************************************************************/ -/* Low level preprocessor token handling */ +/* Low level preprocessor token handling */ /*****************************************************************************/ @@ -136,26 +136,26 @@ typedef enum { /* Preprocessor keyword to token mapping table */ static const struct PPToken { - const char* Key; /* Keyword */ - pptoken_t Tok; /* Token */ + const char* Key; /* Keyword */ + pptoken_t Tok; /* Token */ } PPTokens[] = { - { "define", PP_DEFINE }, + { "define", PP_DEFINE }, { "elif", PP_ELIF }, - { "else", PP_ELSE }, - { "endif", PP_ENDIF }, - { "error", PP_ERROR }, - { "if", PP_IF }, - { "ifdef", PP_IFDEF }, - { "ifndef", PP_IFNDEF }, - { "include", PP_INCLUDE }, - { "line", PP_LINE }, - { "pragma", PP_PRAGMA }, - { "undef", PP_UNDEF }, - { "warning", PP_WARNING }, + { "else", PP_ELSE }, + { "endif", PP_ENDIF }, + { "error", PP_ERROR }, + { "if", PP_IF }, + { "ifdef", PP_IFDEF }, + { "ifndef", PP_IFNDEF }, + { "include", PP_INCLUDE }, + { "line", PP_LINE }, + { "pragma", PP_PRAGMA }, + { "undef", PP_UNDEF }, + { "warning", PP_WARNING }, }; /* Number of preprocessor tokens */ -#define PPTOKEN_COUNT (sizeof(PPTokens) / sizeof(PPTokens[0])) +#define PPTOKEN_COUNT (sizeof(PPTokens) / sizeof(PPTokens[0])) @@ -246,7 +246,7 @@ static int ME_ArgIsVariadic (const MacroExp* E) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -296,18 +296,18 @@ static void OldStyleComment (void) /* Skip the comment */ while (CurC != '*' || NextC != '/') { - if (CurC == '\0') { - if (NextLine () == 0) { - PPError ("End-of-file reached in comment starting at line %u", - StartingLine); - return; - } - } else { - if (CurC == '/' && NextC == '*') { - PPWarning ("`/*' found inside a comment"); - } - NextChar (); - } + if (CurC == '\0') { + if (NextLine () == 0) { + PPError ("End-of-file reached in comment starting at line %u", + StartingLine); + return; + } + } else { + if (CurC == '/' && NextC == '*') { + PPWarning ("`/*' found inside a comment"); + } + NextChar (); + } } /* Skip the end of comment chars */ @@ -326,10 +326,10 @@ static void NewStyleComment (void) * source line is denoted by a lf (\n) character. */ do { - NextChar (); + NextChar (); } while (CurC != '\n' && CurC != '\0'); if (CurC == '\n') { - NextChar (); + NextChar (); } } @@ -374,27 +374,27 @@ static void CopyQuotedString (StrBuf* Target) /* Copy the characters inside the string */ while (CurC != '\0' && CurC != Quote) { - /* Keep an escaped char */ - if (CurC == '\\') { - SB_AppendChar (Target, CurC); - NextChar (); - } - /* Copy the character */ - SB_AppendChar (Target, CurC); - NextChar (); + /* Keep an escaped char */ + if (CurC == '\\') { + SB_AppendChar (Target, CurC); + NextChar (); + } + /* Copy the character */ + SB_AppendChar (Target, CurC); + NextChar (); } /* If we had a terminating quote, copy it */ if (CurC != '\0') { - SB_AppendChar (Target, CurC); - NextChar (); + SB_AppendChar (Target, CurC); + NextChar (); } } /*****************************************************************************/ -/* Macro stuff */ +/* Macro stuff */ /*****************************************************************************/ @@ -405,11 +405,11 @@ static int MacName (char* Ident) */ { if (IsSym (Ident) == 0) { - PPError ("Identifier expected"); - ClearLine (); - return 0; + PPError ("Identifier expected"); + ClearLine (); + return 0; } else { - return 1; + return 1; } } @@ -418,41 +418,41 @@ static int MacName (char* Ident) static void ReadMacroArgs (MacroExp* E) /* Identify the arguments to a macro call */ { - unsigned Parens; /* Number of open parenthesis */ + unsigned Parens; /* Number of open parenthesis */ StrBuf Arg = STATIC_STRBUF_INITIALIZER; /* Read the actual macro arguments */ Parens = 0; while (1) { - if (CurC == '(') { + if (CurC == '(') { - /* Nested parenthesis */ - SB_AppendChar (&Arg, CurC); - NextChar (); - ++Parens; + /* Nested parenthesis */ + SB_AppendChar (&Arg, CurC); + NextChar (); + ++Parens; - } else if (IsQuote (CurC)) { + } else if (IsQuote (CurC)) { /* Quoted string - just copy */ - CopyQuotedString (&Arg); + CopyQuotedString (&Arg); - } else if (CurC == ',' || CurC == ')') { + } else if (CurC == ',' || CurC == ')') { - if (Parens) { - /* Comma or right paren inside nested parenthesis */ - if (CurC == ')') { - --Parens; - } - SB_AppendChar (&Arg, CurC); - NextChar (); + if (Parens) { + /* Comma or right paren inside nested parenthesis */ + if (CurC == ')') { + --Parens; + } + SB_AppendChar (&Arg, CurC); + NextChar (); } else if (CurC == ',' && ME_ArgIsVariadic (E)) { /* It's a comma, but we're inside a variadic macro argument, so * just copy it and proceed. */ SB_AppendChar (&Arg, CurC); NextChar (); - } else { - /* End of actual argument. Remove whitespace from the end. */ + } else { + /* End of actual argument. Remove whitespace from the end. */ while (IsSpace (SB_LookAtLast (&Arg))) { SB_Drop (&Arg, 1); } @@ -462,44 +462,44 @@ static void ReadMacroArgs (MacroExp* E) */ if (CurC != ')' || SB_NotEmpty (&Arg) || E->M->ArgCount > 0) { ME_AppendActual (E, &Arg); - } + } - /* Check for end of macro param list */ - if (CurC == ')') { - NextChar (); - break; - } + /* Check for end of macro param list */ + if (CurC == ')') { + NextChar (); + break; + } - /* Start the next param */ - NextChar (); + /* Start the next param */ + NextChar (); SB_Clear (&Arg); - } - } else if (SkipWhitespace (1)) { - /* Squeeze runs of blanks within an arg */ + } + } else if (SkipWhitespace (1)) { + /* Squeeze runs of blanks within an arg */ if (SB_NotEmpty (&Arg)) { SB_AppendChar (&Arg, ' '); } - } else if (CurC == '/' && NextC == '*') { + } else if (CurC == '/' && NextC == '*') { if (SB_NotEmpty (&Arg)) { SB_AppendChar (&Arg, ' '); } - OldStyleComment (); - } else if (IS_Get (&Standard) >= STD_C99 && CurC == '/' && NextC == '/') { + OldStyleComment (); + } else if (IS_Get (&Standard) >= STD_C99 && CurC == '/' && NextC == '/') { if (SB_NotEmpty (&Arg)) { SB_AppendChar (&Arg, ' '); } - NewStyleComment (); - } else if (CurC == '\0') { - /* End of input inside macro argument list */ + NewStyleComment (); + } else if (CurC == '\0') { + /* End of input inside macro argument list */ PPError ("Unterminated argument list invoking macro `%s'", E->M->Name); ClearLine (); break; - } else { - /* Just copy the character */ - SB_AppendChar (&Arg, CurC); - NextChar (); - } + } else { + /* Just copy the character */ + SB_AppendChar (&Arg, CurC); + NextChar (); + } } /* Deallocate string buf resources */ @@ -511,7 +511,7 @@ static void ReadMacroArgs (MacroExp* E) static void MacroArgSubst (MacroExp* E) /* Argument substitution according to ISO/IEC 9899:1999 (E), 6.10.3.1ff */ { - ident Ident; + ident Ident; int ArgIdx; StrBuf* OldSource; StrBuf* Arg; @@ -526,8 +526,8 @@ static void MacroArgSubst (MacroExp* E) /* Argument handling loop */ while (CurC != '\0') { - /* If we have an identifier, check if it's a macro */ - if (IsSym (Ident)) { + /* If we have an identifier, check if it's a macro */ + if (IsSym (Ident)) { /* Check if it's a macro argument */ if ((ArgIdx = FindMacroArg (E->M, Ident)) >= 0) { @@ -564,9 +564,9 @@ static void MacroArgSubst (MacroExp* E) } else { /* An identifier, keep it */ - SB_AppendStr (&E->Replacement, Ident); + SB_AppendStr (&E->Replacement, Ident); - } + } } else if (CurC == '#' && NextC == '#') { @@ -619,12 +619,12 @@ static void MacroArgSubst (MacroExp* E) Stringize (Arg, &E->Replacement); } - } else if (IsQuote (CurC)) { - CopyQuotedString (&E->Replacement); - } else { - SB_AppendChar (&E->Replacement, CurC); - NextChar (); - } + } else if (IsQuote (CurC)) { + CopyQuotedString (&E->Replacement); + } else { + SB_AppendChar (&E->Replacement, CurC); + NextChar (); + } } #if 0 @@ -661,12 +661,12 @@ static void MacroCall (StrBuf* Target, Macro* M) StrBuf Arg = STATIC_STRBUF_INITIALIZER; /* Argument count mismatch */ - PPError ("Macro argument count mismatch"); + PPError ("Macro argument count mismatch"); - /* Be sure to make enough empty arguments available */ - while (CollCount (&E.ActualArgs) < (unsigned) M->ArgCount) { + /* Be sure to make enough empty arguments available */ + while (CollCount (&E.ActualArgs) < (unsigned) M->ArgCount) { ME_AppendActual (&E, &Arg); - } + } } /* Replace macro arguments handling the # and ## operators */ @@ -737,15 +737,15 @@ static void ExpandMacro (StrBuf* Target, Macro* M) static void DefineMacro (void) /* Handle a macro definition. */ { - ident Ident; - Macro* M; - Macro* Existing; + ident Ident; + Macro* M; + Macro* Existing; int C89; /* Read the macro name */ SkipWhitespace (0); if (!MacName (Ident)) { - return; + return; } /* Remember if we're in C89 mode */ @@ -760,19 +760,19 @@ static void DefineMacro (void) /* Check if this is a function like macro */ if (CurC == '(') { - /* Skip the left paren */ - NextChar (); + /* Skip the left paren */ + NextChar (); - /* Set the marker that this is a function like macro */ - M->ArgCount = 0; + /* Set the marker that this is a function like macro */ + M->ArgCount = 0; - /* Read the formal parameter list */ - while (1) { + /* Read the formal parameter list */ + while (1) { /* Skip white space and check for end of parameter list */ - SkipWhitespace (0); - if (CurC == ')') { - break; + SkipWhitespace (0); + if (CurC == ')') { + break; } /* The next token must be either an identifier, or - if not in @@ -808,26 +808,26 @@ static void DefineMacro (void) } /* Add the macro argument */ - AddMacroArg (M, Ident); + AddMacroArg (M, Ident); } /* If we had an ellipsis, or the next char is not a comma, we've * reached the end of the macro argument list. */ - SkipWhitespace (0); - if (M->Variadic || CurC != ',') { - break; + SkipWhitespace (0); + if (M->Variadic || CurC != ',') { + break; } - NextChar (); - } + NextChar (); + } - /* Check for a right paren and eat it if we find one */ - if (CurC != ')') { - PPError ("`)' expected"); - ClearLine (); - return; - } - NextChar (); + /* Check for a right paren and eat it if we find one */ + if (CurC != ')') { + PPError ("`)' expected"); + ClearLine (); + return; + } + NextChar (); } /* Skip whitespace before the macro replacement */ @@ -860,7 +860,7 @@ static void DefineMacro (void) /*****************************************************************************/ -/* Preprocessing */ +/* Preprocessing */ /*****************************************************************************/ @@ -871,8 +871,8 @@ static unsigned Pass1 (StrBuf* Source, StrBuf* Target) */ { unsigned IdentCount; - ident Ident; - int HaveParen; + ident Ident; + int HaveParen; /* Switch to the new input source */ StrBuf* OldSource = InitLine (Source); @@ -880,55 +880,55 @@ static unsigned Pass1 (StrBuf* Source, StrBuf* Target) /* Loop removing ws and comments */ IdentCount = 0; while (CurC != '\0') { - if (SkipWhitespace (0)) { + if (SkipWhitespace (0)) { /* Squeeze runs of blanks */ if (!IsSpace (SB_LookAtLast (Target))) { SB_AppendChar (Target, ' '); } - } else if (IsSym (Ident)) { - if (Preprocessing && strcmp (Ident, "defined") == 0) { - /* Handle the "defined" operator */ - SkipWhitespace (0); - HaveParen = 0; - if (CurC == '(') { - HaveParen = 1; - NextChar (); - SkipWhitespace (0); - } - if (IsSym (Ident)) { - SB_AppendChar (Target, IsMacro (Ident)? '1' : '0'); - if (HaveParen) { - SkipWhitespace (0); - if (CurC != ')') { - PPError ("`)' expected"); - } else { - NextChar (); - } - } - } else { - PPError ("Identifier expected"); - SB_AppendChar (Target, '0'); - } - } else { - ++IdentCount; - SB_AppendStr (Target, Ident); - } - } else if (IsQuote (CurC)) { - CopyQuotedString (Target); - } else if (CurC == '/' && NextC == '*') { + } else if (IsSym (Ident)) { + if (Preprocessing && strcmp (Ident, "defined") == 0) { + /* Handle the "defined" operator */ + SkipWhitespace (0); + HaveParen = 0; + if (CurC == '(') { + HaveParen = 1; + NextChar (); + SkipWhitespace (0); + } + if (IsSym (Ident)) { + SB_AppendChar (Target, IsMacro (Ident)? '1' : '0'); + if (HaveParen) { + SkipWhitespace (0); + if (CurC != ')') { + PPError ("`)' expected"); + } else { + NextChar (); + } + } + } else { + PPError ("Identifier expected"); + SB_AppendChar (Target, '0'); + } + } else { + ++IdentCount; + SB_AppendStr (Target, Ident); + } + } else if (IsQuote (CurC)) { + CopyQuotedString (Target); + } else if (CurC == '/' && NextC == '*') { if (!IsSpace (SB_LookAtLast (Target))) { SB_AppendChar (Target, ' '); } - OldStyleComment (); - } else if (IS_Get (&Standard) >= STD_C99 && CurC == '/' && NextC == '/') { + OldStyleComment (); + } else if (IS_Get (&Standard) >= STD_C99 && CurC == '/' && NextC == '/') { if (!IsSpace (SB_LookAtLast (Target))) { SB_AppendChar (Target, ' '); } - NewStyleComment (); - } else { - SB_AppendChar (Target, CurC); - NextChar (); - } + NewStyleComment (); + } else { + SB_AppendChar (Target, CurC); + NextChar (); + } } /* Switch back to the old source */ @@ -943,35 +943,35 @@ static unsigned Pass1 (StrBuf* Source, StrBuf* Target) static void MacroReplacement (StrBuf* Source, StrBuf* Target) /* Perform macro replacement. */ { - ident Ident; - Macro* M; + ident Ident; + Macro* M; /* Remember the current input and switch to Source */ StrBuf* OldSource = InitLine (Source); /* Loop substituting macros */ while (CurC != '\0') { - /* If we have an identifier, check if it's a macro */ - if (IsSym (Ident)) { + /* If we have an identifier, check if it's a macro */ + if (IsSym (Ident)) { /* Check if it's a macro */ if ((M = FindMacro (Ident)) != 0 && !M->Expanding) { /* It's a macro, expand it */ ExpandMacro (Target, M); } else { /* An identifier, keep it */ - SB_AppendStr (Target, Ident); - } - } else if (IsQuote (CurC)) { - CopyQuotedString (Target); - } else if (IsSpace (CurC)) { + SB_AppendStr (Target, Ident); + } + } else if (IsQuote (CurC)) { + CopyQuotedString (Target); + } else if (IsSpace (CurC)) { if (!IsSpace (SB_LookAtLast (Target))) { SB_AppendChar (Target, CurC); } NextChar (); } else { - SB_AppendChar (Target, CurC); - NextChar (); - } + SB_AppendChar (Target, CurC); + NextChar (); + } } /* Switch back the input */ @@ -1006,18 +1006,18 @@ static int PushIf (int Skip, int Invert, int Cond) { /* Check for an overflow of the if stack */ if (IfIndex >= MAX_IFS-1) { - PPError ("Too many nested #if clauses"); - return 1; + PPError ("Too many nested #if clauses"); + return 1; } /* Push the #if condition */ ++IfIndex; if (Skip) { - IfStack[IfIndex] = IFCOND_SKIP | IFCOND_NEEDTERM; - return 1; + IfStack[IfIndex] = IFCOND_SKIP | IFCOND_NEEDTERM; + return 1; } else { - IfStack[IfIndex] = IFCOND_NONE | IFCOND_NEEDTERM; - return (Invert ^ Cond); + IfStack[IfIndex] = IFCOND_NONE | IFCOND_NEEDTERM; + return (Invert ^ Cond); } } @@ -1028,7 +1028,7 @@ static void DoError (void) { SkipWhitespace (0); if (CurC == '\0') { - PPError ("Invalid #error directive"); + PPError ("Invalid #error directive"); } else { PPError ("#error: %s", SB_GetConstBuf (Line) + SB_GetIndex (Line)); } @@ -1054,10 +1054,10 @@ static int DoIf (int Skip) /* Make sure the line infos for the tokens won't get removed */ if (SavedCurTok.LI) { - UseLineInfo (SavedCurTok.LI); + UseLineInfo (SavedCurTok.LI); } if (SavedNextTok.LI) { - UseLineInfo (SavedNextTok.LI); + UseLineInfo (SavedNextTok.LI); } /* Switch into special preprocessing mode */ @@ -1100,9 +1100,9 @@ static int DoIfDef (int skip, int flag) SkipWhitespace (0); if (MacName (Ident) == 0) { - return 0; + return 0; } else { - return PushIf (skip, flag, IsMacro(Ident)); + return PushIf (skip, flag, IsMacro(Ident)); } } @@ -1111,7 +1111,7 @@ static int DoIfDef (int skip, int flag) static void DoInclude (void) /* Open an include file. */ { - char RTerm; + char RTerm; InputType IT; StrBuf Filename = STATIC_STRBUF_INITIALIZER; @@ -1127,26 +1127,26 @@ static void DoInclude (void) */ switch (CurC) { - case '\"': - RTerm = '\"'; - IT = IT_USRINC; - break; + case '\"': + RTerm = '\"'; + IT = IT_USRINC; + break; - case '<': - RTerm = '>'; - IT = IT_SYSINC; - break; + case '<': + RTerm = '>'; + IT = IT_SYSINC; + break; - default: - PPError ("`\"' or `<' expected"); - goto Done; + default: + PPError ("`\"' or `<' expected"); + goto Done; } NextChar (); /* Get a copy of the filename */ while (CurC != '\0' && CurC != RTerm) { - SB_AppendChar (&Filename, CurC); - NextChar (); + SB_AppendChar (&Filename, CurC); + NextChar (); } SB_Terminate (&Filename); @@ -1155,8 +1155,8 @@ static void DoInclude (void) /* Open the include file */ OpenIncludeFile (SB_GetConstBuf (&Filename), IT); } else if (CurC == '\0') { - /* No terminator found */ - PPError ("#include expects \"FILENAME\" or "); + /* No terminator found */ + PPError ("#include expects \"FILENAME\" or "); } Done: @@ -1203,7 +1203,7 @@ static void DoUndef (void) SkipWhitespace (0); if (MacName (Ident)) { - UndefineMacro (Ident); + UndefineMacro (Ident); } } @@ -1214,7 +1214,7 @@ static void DoWarning (void) { SkipWhitespace (0); if (CurC == '\0') { - PPError ("Invalid #warning directive"); + PPError ("Invalid #warning directive"); } else { PPWarning ("#warning: %s", SB_GetConstBuf (Line) + SB_GetIndex (Line)); } @@ -1228,8 +1228,8 @@ static void DoWarning (void) void Preprocess (void) /* Preprocess a line */ { - int Skip; - ident Directive; + int Skip; + ident Directive; /* Create the output buffer if we don't already have one */ if (MLine == 0) { @@ -1243,124 +1243,124 @@ void Preprocess (void) Skip = 0; while (CurC == '\0' || CurC == '#' || Skip) { - /* Check for preprocessor lines lines */ - if (CurC == '#') { - NextChar (); - SkipWhitespace (0); - if (CurC == '\0') { - /* Ignore the empty preprocessor directive */ - continue; - } - if (!IsSym (Directive)) { - PPError ("Preprocessor directive expected"); - ClearLine (); - } else { - switch (FindPPToken (Directive)) { + /* Check for preprocessor lines lines */ + if (CurC == '#') { + NextChar (); + SkipWhitespace (0); + if (CurC == '\0') { + /* Ignore the empty preprocessor directive */ + continue; + } + if (!IsSym (Directive)) { + PPError ("Preprocessor directive expected"); + ClearLine (); + } else { + switch (FindPPToken (Directive)) { - case PP_DEFINE: - if (!Skip) { - DefineMacro (); - } - break; + case PP_DEFINE: + if (!Skip) { + DefineMacro (); + } + break; - case PP_ELIF: - if (IfIndex >= 0) { - if ((IfStack[IfIndex] & IFCOND_ELSE) == 0) { + case PP_ELIF: + if (IfIndex >= 0) { + if ((IfStack[IfIndex] & IFCOND_ELSE) == 0) { - /* Handle as #else/#if combination */ - if ((IfStack[IfIndex] & IFCOND_SKIP) == 0) { - Skip = !Skip; - } - IfStack[IfIndex] |= IFCOND_ELSE; - Skip = DoIf (Skip); + /* Handle as #else/#if combination */ + if ((IfStack[IfIndex] & IFCOND_SKIP) == 0) { + Skip = !Skip; + } + IfStack[IfIndex] |= IFCOND_ELSE; + Skip = DoIf (Skip); - /* #elif doesn't need a terminator */ - IfStack[IfIndex] &= ~IFCOND_NEEDTERM; - } else { - PPError ("Duplicate #else/#elif"); - } - } else { - PPError ("Unexpected #elif"); - } - break; + /* #elif doesn't need a terminator */ + IfStack[IfIndex] &= ~IFCOND_NEEDTERM; + } else { + PPError ("Duplicate #else/#elif"); + } + } else { + PPError ("Unexpected #elif"); + } + break; - case PP_ELSE: - if (IfIndex >= 0) { - if ((IfStack[IfIndex] & IFCOND_ELSE) == 0) { - if ((IfStack[IfIndex] & IFCOND_SKIP) == 0) { - Skip = !Skip; - } - IfStack[IfIndex] |= IFCOND_ELSE; - } else { - PPError ("Duplicate #else"); - } - } else { - PPError ("Unexpected `#else'"); - } - break; + case PP_ELSE: + if (IfIndex >= 0) { + if ((IfStack[IfIndex] & IFCOND_ELSE) == 0) { + if ((IfStack[IfIndex] & IFCOND_SKIP) == 0) { + Skip = !Skip; + } + IfStack[IfIndex] |= IFCOND_ELSE; + } else { + PPError ("Duplicate #else"); + } + } else { + PPError ("Unexpected `#else'"); + } + break; - case PP_ENDIF: - if (IfIndex >= 0) { - /* Remove any clauses on top of stack that do not - * need a terminating #endif. - */ - while (IfIndex >= 0 && (IfStack[IfIndex] & IFCOND_NEEDTERM) == 0) { - --IfIndex; - } + case PP_ENDIF: + if (IfIndex >= 0) { + /* Remove any clauses on top of stack that do not + * need a terminating #endif. + */ + while (IfIndex >= 0 && (IfStack[IfIndex] & IFCOND_NEEDTERM) == 0) { + --IfIndex; + } - /* Stack may not be empty here or something is wrong */ - CHECK (IfIndex >= 0); + /* Stack may not be empty here or something is wrong */ + CHECK (IfIndex >= 0); - /* Remove the clause that needs a terminator */ - Skip = (IfStack[IfIndex--] & IFCOND_SKIP) != 0; - } else { - PPError ("Unexpected `#endif'"); - } - break; + /* Remove the clause that needs a terminator */ + Skip = (IfStack[IfIndex--] & IFCOND_SKIP) != 0; + } else { + PPError ("Unexpected `#endif'"); + } + break; - case PP_ERROR: - if (!Skip) { - DoError (); - } - break; + case PP_ERROR: + if (!Skip) { + DoError (); + } + break; - case PP_IF: - Skip = DoIf (Skip); - break; + case PP_IF: + Skip = DoIf (Skip); + break; - case PP_IFDEF: - Skip = DoIfDef (Skip, 1); - break; + case PP_IFDEF: + Skip = DoIfDef (Skip, 1); + break; - case PP_IFNDEF: - Skip = DoIfDef (Skip, 0); - break; + case PP_IFNDEF: + Skip = DoIfDef (Skip, 0); + break; - case PP_INCLUDE: - if (!Skip) { - DoInclude (); - } - break; + case PP_INCLUDE: + if (!Skip) { + DoInclude (); + } + break; - case PP_LINE: - /* Should do something in C99 at least, but we ignore it */ - if (!Skip) { - ClearLine (); - } - break; + case PP_LINE: + /* Should do something in C99 at least, but we ignore it */ + if (!Skip) { + ClearLine (); + } + break; - case PP_PRAGMA: - if (!Skip) { + case PP_PRAGMA: + if (!Skip) { DoPragma (); goto Done; - } - break; + } + break; - case PP_UNDEF: - if (!Skip) { - DoUndef (); - } - break; + case PP_UNDEF: + if (!Skip) { + DoUndef (); + } + break; case PP_WARNING: /* #warning is a non standard extension */ @@ -1376,22 +1376,22 @@ void Preprocess (void) } break; - default: + default: if (!Skip) { - PPError ("Preprocessor directive expected"); + PPError ("Preprocessor directive expected"); } - ClearLine (); - } - } + ClearLine (); + } + } - } - if (NextLine () == 0) { - if (IfIndex >= 0) { - PPError ("`#endif' expected"); - } - return; - } - SkipWhitespace (0); + } + if (NextLine () == 0) { + if (IfIndex >= 0) { + PPError ("`#endif' expected"); + } + return; + } + SkipWhitespace (0); } PreprocessLine (); diff --git a/src/cc65/preproc.h b/src/cc65/preproc.h index 286d309d1..3b2722567 100644 --- a/src/cc65/preproc.h +++ b/src/cc65/preproc.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* data */ +/* data */ /*****************************************************************************/ @@ -50,7 +50,7 @@ extern unsigned char Preprocessing; /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ diff --git a/src/cc65/reginfo.c b/src/cc65/reginfo.c index 00590e6f8..65c073420 100644 --- a/src/cc65/reginfo.c +++ b/src/cc65/reginfo.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* reginfo.c */ +/* reginfo.c */ /* */ -/* 6502 register tracking info */ +/* 6502 register tracking info */ /* */ /* */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -113,13 +113,13 @@ RegInfo* NewRegInfo (const RegContents* RC) /* Initialize the registers */ if (RC) { - RI->In = *RC; - RI->Out = *RC; - RI->Out2 = *RC; + RI->In = *RC; + RI->Out = *RC; + RI->Out2 = *RC; } else { - RC_Invalidate (&RI->In); - RC_Invalidate (&RI->Out); - RC_Invalidate (&RI->Out2); + RC_Invalidate (&RI->In); + RC_Invalidate (&RI->Out); + RC_Invalidate (&RI->Out2); } /* Return the new struct */ diff --git a/src/cc65/reginfo.h b/src/cc65/reginfo.h index 52cb40d71..31281675c 100644 --- a/src/cc65/reginfo.h +++ b/src/cc65/reginfo.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* reginfo.h */ +/* reginfo.h */ /* */ -/* 6502 register tracking info */ +/* 6502 register tracking info */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -57,28 +57,28 @@ /* Register contents */ typedef struct RegContents RegContents; struct RegContents { - short RegA; + short RegA; short RegX; short RegY; short SRegLo; short SRegHi; short Ptr1Lo; short Ptr1Hi; - short Tmp1; + short Tmp1; }; /* Register change info */ typedef struct RegInfo RegInfo; struct RegInfo { - RegContents In; /* Incoming register values */ + RegContents In; /* Incoming register values */ RegContents Out; /* Outgoing register values */ - RegContents Out2; /* Alternative outgoing reg values for branches */ + RegContents Out2; /* Alternative outgoing reg values for branches */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/scanner.c b/src/cc65/scanner.c index 3a1a40b84..9d6553ae0 100644 --- a/src/cc65/scanner.c +++ b/src/cc65/scanner.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* scanner.c */ +/* scanner.c */ /* */ -/* Source file line info structure */ +/* Source file line info structure */ /* */ /* */ /* */ @@ -62,13 +62,13 @@ /*****************************************************************************/ -/* data */ +/* data */ /*****************************************************************************/ -Token CurTok; /* The current token */ -Token NextTok; /* The next token */ +Token CurTok; /* The current token */ +Token NextTok; /* The next token */ @@ -81,77 +81,77 @@ enum { /* Token table */ static const struct Keyword { - char* Key; /* Keyword name */ - unsigned char Tok; /* The token */ + char* Key; /* Keyword name */ + unsigned char Tok; /* The token */ unsigned char Std; /* Token supported in which standards? */ } Keywords [] = { { "_Pragma", TOK_PRAGMA, TT_C89 | TT_C99 | TT_CC65 }, /* !! */ - { "__AX__", TOK_AX, TT_C89 | TT_C99 | TT_CC65 }, - { "__A__", TOK_A, TT_C89 | TT_C99 | TT_CC65 }, - { "__EAX__", TOK_EAX, TT_C89 | TT_C99 | TT_CC65 }, - { "__X__", TOK_X, TT_C89 | TT_C99 | TT_CC65 }, - { "__Y__", TOK_Y, TT_C89 | TT_C99 | TT_CC65 }, - { "__asm__", TOK_ASM, TT_C89 | TT_C99 | TT_CC65 }, - { "__attribute__", TOK_ATTRIBUTE, TT_C89 | TT_C99 | TT_CC65 }, - { "__cdecl__", TOK_CDECL, TT_C89 | TT_C99 | TT_CC65 }, - { "__far__", TOK_FAR, TT_C89 | TT_C99 | TT_CC65 }, - { "__fastcall__", TOK_FASTCALL, TT_C89 | TT_C99 | TT_CC65 }, - { "__inline__", TOK_INLINE, TT_C89 | TT_C99 | TT_CC65 }, - { "__near__", TOK_NEAR, TT_C89 | TT_C99 | TT_CC65 }, - { "asm", TOK_ASM, TT_CC65 }, - { "auto", TOK_AUTO, TT_C89 | TT_C99 | TT_CC65 }, - { "break", TOK_BREAK, TT_C89 | TT_C99 | TT_CC65 }, - { "case", TOK_CASE, TT_C89 | TT_C99 | TT_CC65 }, - { "cdecl", TOK_CDECL, TT_CC65 }, - { "char", TOK_CHAR, TT_C89 | TT_C99 | TT_CC65 }, - { "const", TOK_CONST, TT_C89 | TT_C99 | TT_CC65 }, - { "continue", TOK_CONTINUE, TT_C89 | TT_C99 | TT_CC65 }, - { "default", TOK_DEFAULT, TT_C89 | TT_C99 | TT_CC65 }, - { "do", TOK_DO, TT_C89 | TT_C99 | TT_CC65 }, - { "double", TOK_DOUBLE, TT_C89 | TT_C99 | TT_CC65 }, - { "else", TOK_ELSE, TT_C89 | TT_C99 | TT_CC65 }, - { "enum", TOK_ENUM, TT_C89 | TT_C99 | TT_CC65 }, - { "extern", TOK_EXTERN, TT_C89 | TT_C99 | TT_CC65 }, - { "far", TOK_FAR, TT_CC65 }, - { "fastcall", TOK_FASTCALL, TT_CC65 }, - { "float", TOK_FLOAT, TT_C89 | TT_C99 | TT_CC65 }, - { "for", TOK_FOR, TT_C89 | TT_C99 | TT_CC65 }, - { "goto", TOK_GOTO, TT_C89 | TT_C99 | TT_CC65 }, - { "if", TOK_IF, TT_C89 | TT_C99 | TT_CC65 }, + { "__AX__", TOK_AX, TT_C89 | TT_C99 | TT_CC65 }, + { "__A__", TOK_A, TT_C89 | TT_C99 | TT_CC65 }, + { "__EAX__", TOK_EAX, TT_C89 | TT_C99 | TT_CC65 }, + { "__X__", TOK_X, TT_C89 | TT_C99 | TT_CC65 }, + { "__Y__", TOK_Y, TT_C89 | TT_C99 | TT_CC65 }, + { "__asm__", TOK_ASM, TT_C89 | TT_C99 | TT_CC65 }, + { "__attribute__", TOK_ATTRIBUTE, TT_C89 | TT_C99 | TT_CC65 }, + { "__cdecl__", TOK_CDECL, TT_C89 | TT_C99 | TT_CC65 }, + { "__far__", TOK_FAR, TT_C89 | TT_C99 | TT_CC65 }, + { "__fastcall__", TOK_FASTCALL, TT_C89 | TT_C99 | TT_CC65 }, + { "__inline__", TOK_INLINE, TT_C89 | TT_C99 | TT_CC65 }, + { "__near__", TOK_NEAR, TT_C89 | TT_C99 | TT_CC65 }, + { "asm", TOK_ASM, TT_CC65 }, + { "auto", TOK_AUTO, TT_C89 | TT_C99 | TT_CC65 }, + { "break", TOK_BREAK, TT_C89 | TT_C99 | TT_CC65 }, + { "case", TOK_CASE, TT_C89 | TT_C99 | TT_CC65 }, + { "cdecl", TOK_CDECL, TT_CC65 }, + { "char", TOK_CHAR, TT_C89 | TT_C99 | TT_CC65 }, + { "const", TOK_CONST, TT_C89 | TT_C99 | TT_CC65 }, + { "continue", TOK_CONTINUE, TT_C89 | TT_C99 | TT_CC65 }, + { "default", TOK_DEFAULT, TT_C89 | TT_C99 | TT_CC65 }, + { "do", TOK_DO, TT_C89 | TT_C99 | TT_CC65 }, + { "double", TOK_DOUBLE, TT_C89 | TT_C99 | TT_CC65 }, + { "else", TOK_ELSE, TT_C89 | TT_C99 | TT_CC65 }, + { "enum", TOK_ENUM, TT_C89 | TT_C99 | TT_CC65 }, + { "extern", TOK_EXTERN, TT_C89 | TT_C99 | TT_CC65 }, + { "far", TOK_FAR, TT_CC65 }, + { "fastcall", TOK_FASTCALL, TT_CC65 }, + { "float", TOK_FLOAT, TT_C89 | TT_C99 | TT_CC65 }, + { "for", TOK_FOR, TT_C89 | TT_C99 | TT_CC65 }, + { "goto", TOK_GOTO, TT_C89 | TT_C99 | TT_CC65 }, + { "if", TOK_IF, TT_C89 | TT_C99 | TT_CC65 }, { "inline", TOK_INLINE, TT_C99 | TT_CC65 }, - { "int", TOK_INT, TT_C89 | TT_C99 | TT_CC65 }, - { "long", TOK_LONG, TT_C89 | TT_C99 | TT_CC65 }, - { "near", TOK_NEAR, TT_CC65 }, - { "register", TOK_REGISTER, TT_C89 | TT_C99 | TT_CC65 }, - { "restrict", TOK_RESTRICT, TT_C99 | TT_CC65 }, - { "return", TOK_RETURN, TT_C89 | TT_C99 | TT_CC65 }, - { "short", TOK_SHORT, TT_C89 | TT_C99 | TT_CC65 }, - { "signed", TOK_SIGNED, TT_C89 | TT_C99 | TT_CC65 }, - { "sizeof", TOK_SIZEOF, TT_C89 | TT_C99 | TT_CC65 }, - { "static", TOK_STATIC, TT_C89 | TT_C99 | TT_CC65 }, - { "struct", TOK_STRUCT, TT_C89 | TT_C99 | TT_CC65 }, - { "switch", TOK_SWITCH, TT_C89 | TT_C99 | TT_CC65 }, - { "typedef", TOK_TYPEDEF, TT_C89 | TT_C99 | TT_CC65 }, - { "union", TOK_UNION, TT_C89 | TT_C99 | TT_CC65 }, - { "unsigned", TOK_UNSIGNED, TT_C89 | TT_C99 | TT_CC65 }, - { "void", TOK_VOID, TT_C89 | TT_C99 | TT_CC65 }, - { "volatile", TOK_VOLATILE, TT_C89 | TT_C99 | TT_CC65 }, - { "while", TOK_WHILE, TT_C89 | TT_C99 | TT_CC65 }, + { "int", TOK_INT, TT_C89 | TT_C99 | TT_CC65 }, + { "long", TOK_LONG, TT_C89 | TT_C99 | TT_CC65 }, + { "near", TOK_NEAR, TT_CC65 }, + { "register", TOK_REGISTER, TT_C89 | TT_C99 | TT_CC65 }, + { "restrict", TOK_RESTRICT, TT_C99 | TT_CC65 }, + { "return", TOK_RETURN, TT_C89 | TT_C99 | TT_CC65 }, + { "short", TOK_SHORT, TT_C89 | TT_C99 | TT_CC65 }, + { "signed", TOK_SIGNED, TT_C89 | TT_C99 | TT_CC65 }, + { "sizeof", TOK_SIZEOF, TT_C89 | TT_C99 | TT_CC65 }, + { "static", TOK_STATIC, TT_C89 | TT_C99 | TT_CC65 }, + { "struct", TOK_STRUCT, TT_C89 | TT_C99 | TT_CC65 }, + { "switch", TOK_SWITCH, TT_C89 | TT_C99 | TT_CC65 }, + { "typedef", TOK_TYPEDEF, TT_C89 | TT_C99 | TT_CC65 }, + { "union", TOK_UNION, TT_C89 | TT_C99 | TT_CC65 }, + { "unsigned", TOK_UNSIGNED, TT_C89 | TT_C99 | TT_CC65 }, + { "void", TOK_VOID, TT_C89 | TT_C99 | TT_CC65 }, + { "volatile", TOK_VOLATILE, TT_C89 | TT_C99 | TT_CC65 }, + { "while", TOK_WHILE, TT_C89 | TT_C99 | TT_CC65 }, }; -#define KEY_COUNT (sizeof (Keywords) / sizeof (Keywords [0])) +#define KEY_COUNT (sizeof (Keywords) / sizeof (Keywords [0])) /* Stuff for determining the type of an integer constant */ -#define IT_INT 0x01 -#define IT_UINT 0x02 -#define IT_LONG 0x04 -#define IT_ULONG 0x08 +#define IT_INT 0x01 +#define IT_UINT 0x02 +#define IT_LONG 0x04 +#define IT_ULONG 0x08 /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ @@ -172,9 +172,9 @@ static token_t FindKey (const char* Key) struct Keyword* K; K = bsearch (Key, Keywords, KEY_COUNT, sizeof (Keywords [0]), CmpKey); if (K && (K->Std & (0x01 << IS_Get (&Standard))) != 0) { - return K->Tok; + return K->Tok; } else { - return TOK_IDENT; + return TOK_IDENT; } } @@ -186,17 +186,17 @@ static int SkipWhite (void) */ { while (1) { - while (CurC == '\0') { - if (NextLine () == 0) { - return 0; - } - Preprocess (); - } - if (IsSpace (CurC)) { - NextChar (); - } else { - return 1; - } + while (CurC == '\0') { + if (NextLine () == 0) { + return 0; + } + Preprocess (); + } + if (IsSpace (CurC)) { + NextChar (); + } else { + return 1; + } } } @@ -220,11 +220,11 @@ void SymName (char* S) { unsigned Len = 0; do { - if (Len < MAX_IDENTLEN) { - ++Len; - *S++ = CurC; - } - NextChar (); + if (Len < MAX_IDENTLEN) { + ++Len; + *S++ = CurC; + } + NextChar (); } while (IsIdent (CurC) || IsDigit (CurC)); *S = '\0'; } @@ -235,10 +235,10 @@ int IsSym (char* S) /* If a symbol follows, read it and return 1, otherwise return 0 */ { if (IsIdent (CurC)) { - SymName (S); - return 1; + SymName (S); + return 1; } else { - return 0; + return 0; } } @@ -248,7 +248,7 @@ static void UnknownChar (char C) /* Error message for unknown character */ { Error ("Invalid input character with code %02X", C & 0xFF); - NextChar (); /* Skip */ + NextChar (); /* Skip */ } @@ -270,44 +270,44 @@ static int ParseChar (void) /* Check for escape chars */ if (CurC == '\\') { - NextChar (); - switch (CurC) { - case '?': - C = '\?'; - break; - case 'a': - C = '\a'; - break; - case 'b': - C = '\b'; - break; - case 'f': - C = '\f'; - break; - case 'r': - C = '\r'; - break; - case 'n': - C = '\n'; - break; - case 't': - C = '\t'; - break; + NextChar (); + switch (CurC) { + case '?': + C = '\?'; + break; + case 'a': + C = '\a'; + break; + case 'b': + C = '\b'; + break; + case 'f': + C = '\f'; + break; + case 'r': + C = '\r'; + break; + case 'n': + C = '\n'; + break; + case 't': + C = '\t'; + break; case 'v': C = '\v'; break; - case '\"': - C = '\"'; - break; - case '\'': - C = '\''; - break; - case '\\': - C = '\\'; - break; - case 'x': - case 'X': - /* Hex character constant */ + case '\"': + C = '\"'; + break; + case '\'': + C = '\''; + break; + case '\\': + C = '\\'; + break; + case 'x': + case 'X': + /* Hex character constant */ if (!IsXDigit (NextC)) { Error ("\\x used with no following hex digits"); C = ' '; @@ -326,19 +326,19 @@ static int ParseChar (void) NextChar (); } } - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - /* Octal constant */ + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + /* Octal constant */ HadError = 0; - C = HexVal (CurC); - while (IsODigit (NextC)) { + C = HexVal (CurC); + while (IsODigit (NextC)) { if ((C << 3) >= 256) { if (!HadError) { Error ("Octal character constant out of range"); @@ -347,12 +347,12 @@ static int ParseChar (void) } else { C = (C << 3) | HexVal (NextC); } - NextChar (); - } - break; - default: - Error ("Illegal character constant"); - C = ' '; + NextChar (); + } + break; + default: + Error ("Illegal character constant"); + C = ' '; /* Try to do error recovery, otherwise the compiler will spit * out thousands of errors in this place and abort. */ @@ -361,10 +361,10 @@ static int ParseChar (void) NextChar (); } } - break; - } + break; + } } else { - C = CurC; + C = CurC; } /* Skip the character read */ @@ -389,10 +389,10 @@ static void CharConst (void) /* Check for closing quote */ if (CurC != '\'') { - Error ("`\'' expected"); + Error ("`\'' expected"); } else { - /* Skip the quote */ - NextChar (); + /* Skip the quote */ + NextChar (); } /* Setup values and attributes */ @@ -430,26 +430,26 @@ static void StringConst (void) NextChar (); } else if (CurC == '\"') { /* Skip the quote char */ - NextChar (); + NextChar (); } else { /* No string */ break; } /* Read until end of string */ - while (CurC != '\"') { - if (CurC == '\0') { - Error ("Unexpected newline"); - break; - } - SB_AppendChar (&S, ParseChar ()); - } + while (CurC != '\"') { + if (CurC == '\0') { + Error ("Unexpected newline"); + break; + } + SB_AppendChar (&S, ParseChar ()); + } - /* Skip closing quote char if there was one */ - NextChar (); + /* Skip closing quote char if there was one */ + NextChar (); - /* Skip white space, read new input */ - SkipWhite (); + /* Skip white space, read new input */ + SkipWhite (); } @@ -484,7 +484,7 @@ static void NumericConst (void) NextChar (); if (toupper (CurC) == 'X') { Base = Prefix = 16; - NextChar (); /* gobble "x" */ + NextChar (); /* gobble "x" */ } else { Base = 10; /* Assume 10 for now - see below */ Prefix = 8; /* Actual prefix says octal */ @@ -713,7 +713,7 @@ void NextToken (void) /* Current token is the lookahead token */ if (CurTok.LI) { - ReleaseLineInfo (CurTok.LI); + ReleaseLineInfo (CurTok.LI); } CurTok = NextTok; @@ -722,7 +722,7 @@ void NextToken (void) * the token is used for error messages, we must make it valid. */ if (CurTok.LI == 0) { - CurTok.LI = UseLineInfo (GetCurLineInfo ()); + CurTok.LI = UseLineInfo (GetCurLineInfo ()); } /* Remember the starting position of the next token */ @@ -730,16 +730,16 @@ void NextToken (void) /* Now handle end of input. */ if (GotEOF) { - /* End of file reached */ - NextTok.Tok = TOK_CEOF; - return; + /* End of file reached */ + NextTok.Tok = TOK_CEOF; + return; } /* Determine the next token from the lookahead */ if (IsDigit (CurC) || (CurC == '.' && IsDigit (NextC))) { - /* A number */ + /* A number */ NumericConst (); - return; + return; } /* Check for wide character literals */ @@ -751,135 +751,135 @@ void NextToken (void) /* Check for keywords and identifiers */ if (IsSym (token)) { - /* Check for a keyword */ - if ((NextTok.Tok = FindKey (token)) != TOK_IDENT) { - /* Reserved word found */ - return; - } - /* No reserved word, check for special symbols */ - if (token[0] == '_' && token[1] == '_') { - /* Special symbols */ + /* Check for a keyword */ + if ((NextTok.Tok = FindKey (token)) != TOK_IDENT) { + /* Reserved word found */ + return; + } + /* No reserved word, check for special symbols */ + if (token[0] == '_' && token[1] == '_') { + /* Special symbols */ if (strcmp (token+2, "FILE__") == 0) { - NextTok.SVal = AddLiteral (GetCurrentFile()); - NextTok.Tok = TOK_SCONST; - return; - } else if (strcmp (token+2, "LINE__") == 0) { - NextTok.Tok = TOK_ICONST; - NextTok.IVal = GetCurrentLine(); - NextTok.Type = type_int; - return; - } else if (strcmp (token+2, "func__") == 0) { - /* __func__ is only defined in functions */ - if (CurrentFunc) { - NextTok.SVal = AddLiteral (F_GetFuncName (CurrentFunc)); - NextTok.Tok = TOK_SCONST; - return; - } - } - } + NextTok.SVal = AddLiteral (GetCurrentFile()); + NextTok.Tok = TOK_SCONST; + return; + } else if (strcmp (token+2, "LINE__") == 0) { + NextTok.Tok = TOK_ICONST; + NextTok.IVal = GetCurrentLine(); + NextTok.Type = type_int; + return; + } else if (strcmp (token+2, "func__") == 0) { + /* __func__ is only defined in functions */ + if (CurrentFunc) { + NextTok.SVal = AddLiteral (F_GetFuncName (CurrentFunc)); + NextTok.Tok = TOK_SCONST; + return; + } + } + } - /* No reserved word but identifier */ - strcpy (NextTok.Ident, token); - NextTok.Tok = TOK_IDENT; - return; + /* No reserved word but identifier */ + strcpy (NextTok.Ident, token); + NextTok.Tok = TOK_IDENT; + return; } /* Monstrous switch statement ahead... */ switch (CurC) { - case '!': - NextChar (); - if (CurC == '=') { - SetTok (TOK_NE); - } else { - NextTok.Tok = TOK_BOOL_NOT; - } - break; + case '!': + NextChar (); + if (CurC == '=') { + SetTok (TOK_NE); + } else { + NextTok.Tok = TOK_BOOL_NOT; + } + break; - case '\"': - StringConst (); - break; + case '\"': + StringConst (); + break; - case '%': - NextChar (); - if (CurC == '=') { - SetTok (TOK_MOD_ASSIGN); - } else { - NextTok.Tok = TOK_MOD; - } - break; + case '%': + NextChar (); + if (CurC == '=') { + SetTok (TOK_MOD_ASSIGN); + } else { + NextTok.Tok = TOK_MOD; + } + break; - case '&': - NextChar (); - switch (CurC) { - case '&': - SetTok (TOK_BOOL_AND); - break; - case '=': - SetTok (TOK_AND_ASSIGN); - break; - default: - NextTok.Tok = TOK_AND; - } - break; + case '&': + NextChar (); + switch (CurC) { + case '&': + SetTok (TOK_BOOL_AND); + break; + case '=': + SetTok (TOK_AND_ASSIGN); + break; + default: + NextTok.Tok = TOK_AND; + } + break; - case '\'': - CharConst (); - break; + case '\'': + CharConst (); + break; - case '(': - SetTok (TOK_LPAREN); - break; + case '(': + SetTok (TOK_LPAREN); + break; - case ')': - SetTok (TOK_RPAREN); - break; + case ')': + SetTok (TOK_RPAREN); + break; - case '*': - NextChar (); - if (CurC == '=') { - SetTok (TOK_MUL_ASSIGN); - } else { - NextTok.Tok = TOK_STAR; - } - break; + case '*': + NextChar (); + if (CurC == '=') { + SetTok (TOK_MUL_ASSIGN); + } else { + NextTok.Tok = TOK_STAR; + } + break; - case '+': - NextChar (); - switch (CurC) { - case '+': - SetTok (TOK_INC); - break; - case '=': - SetTok (TOK_PLUS_ASSIGN); - break; - default: - NextTok.Tok = TOK_PLUS; - } - break; + case '+': + NextChar (); + switch (CurC) { + case '+': + SetTok (TOK_INC); + break; + case '=': + SetTok (TOK_PLUS_ASSIGN); + break; + default: + NextTok.Tok = TOK_PLUS; + } + break; - case ',': - SetTok (TOK_COMMA); - break; + case ',': + SetTok (TOK_COMMA); + break; - case '-': - NextChar (); - switch (CurC) { - case '-': - SetTok (TOK_DEC); - break; - case '=': - SetTok (TOK_MINUS_ASSIGN); - break; - case '>': - SetTok (TOK_PTR_REF); - break; - default: - NextTok.Tok = TOK_MINUS; - } - break; + case '-': + NextChar (); + switch (CurC) { + case '-': + SetTok (TOK_DEC); + break; + case '=': + SetTok (TOK_MINUS_ASSIGN); + break; + case '>': + SetTok (TOK_PTR_REF); + break; + default: + NextTok.Tok = TOK_MINUS; + } + break; - case '.': + case '.': NextChar (); if (CurC == '.') { NextChar (); @@ -891,121 +891,121 @@ void NextToken (void) } else { NextTok.Tok = TOK_DOT; } - break; + break; - case '/': - NextChar (); - if (CurC == '=') { - SetTok (TOK_DIV_ASSIGN); - } else { - NextTok.Tok = TOK_DIV; - } - break; + case '/': + NextChar (); + if (CurC == '=') { + SetTok (TOK_DIV_ASSIGN); + } else { + NextTok.Tok = TOK_DIV; + } + break; - case ':': - SetTok (TOK_COLON); - break; + case ':': + SetTok (TOK_COLON); + break; - case ';': - SetTok (TOK_SEMI); - break; + case ';': + SetTok (TOK_SEMI); + break; - case '<': - NextChar (); - switch (CurC) { - case '=': - SetTok (TOK_LE); - break; - case '<': - NextChar (); - if (CurC == '=') { - SetTok (TOK_SHL_ASSIGN); - } else { - NextTok.Tok = TOK_SHL; - } - break; - default: - NextTok.Tok = TOK_LT; - } - break; + case '<': + NextChar (); + switch (CurC) { + case '=': + SetTok (TOK_LE); + break; + case '<': + NextChar (); + if (CurC == '=') { + SetTok (TOK_SHL_ASSIGN); + } else { + NextTok.Tok = TOK_SHL; + } + break; + default: + NextTok.Tok = TOK_LT; + } + break; - case '=': - NextChar (); - if (CurC == '=') { - SetTok (TOK_EQ); - } else { - NextTok.Tok = TOK_ASSIGN; - } - break; + case '=': + NextChar (); + if (CurC == '=') { + SetTok (TOK_EQ); + } else { + NextTok.Tok = TOK_ASSIGN; + } + break; - case '>': - NextChar (); - switch (CurC) { - case '=': - SetTok (TOK_GE); - break; - case '>': - NextChar (); - if (CurC == '=') { - SetTok (TOK_SHR_ASSIGN); - } else { - NextTok.Tok = TOK_SHR; - } - break; - default: - NextTok.Tok = TOK_GT; - } - break; + case '>': + NextChar (); + switch (CurC) { + case '=': + SetTok (TOK_GE); + break; + case '>': + NextChar (); + if (CurC == '=') { + SetTok (TOK_SHR_ASSIGN); + } else { + NextTok.Tok = TOK_SHR; + } + break; + default: + NextTok.Tok = TOK_GT; + } + break; - case '?': - SetTok (TOK_QUEST); - break; + case '?': + SetTok (TOK_QUEST); + break; - case '[': - SetTok (TOK_LBRACK); - break; + case '[': + SetTok (TOK_LBRACK); + break; - case ']': - SetTok (TOK_RBRACK); - break; + case ']': + SetTok (TOK_RBRACK); + break; - case '^': - NextChar (); - if (CurC == '=') { - SetTok (TOK_XOR_ASSIGN); - } else { - NextTok.Tok = TOK_XOR; - } - break; + case '^': + NextChar (); + if (CurC == '=') { + SetTok (TOK_XOR_ASSIGN); + } else { + NextTok.Tok = TOK_XOR; + } + break; - case '{': - SetTok (TOK_LCURLY); - break; + case '{': + SetTok (TOK_LCURLY); + break; case '|': - NextChar (); - switch (CurC) { - case '|': - SetTok (TOK_BOOL_OR); - break; - case '=': - SetTok (TOK_OR_ASSIGN); - break; - default: - NextTok.Tok = TOK_OR; - } - break; + NextChar (); + switch (CurC) { + case '|': + SetTok (TOK_BOOL_OR); + break; + case '=': + SetTok (TOK_OR_ASSIGN); + break; + default: + NextTok.Tok = TOK_OR; + } + break; - case '}': - SetTok (TOK_RCURLY); - break; + case '}': + SetTok (TOK_RCURLY); + break; - case '~': - SetTok (TOK_COMP); - break; + case '~': + SetTok (TOK_COMP); + break; - default: - UnknownChar (CurC); + default: + UnknownChar (CurC); } @@ -1020,17 +1020,17 @@ void SkipTokens (const token_t* TokenList, unsigned TokenCount) { while (CurTok.Tok != TOK_CEOF) { - /* Check if the current token is in the token list */ - unsigned I; - for (I = 0; I < TokenCount; ++I) { - if (CurTok.Tok == TokenList[I]) { - /* Found a token in the list */ - return; - } - } + /* Check if the current token is in the token list */ + unsigned I; + for (I = 0; I < TokenCount; ++I) { + if (CurTok.Tok == TokenList[I]) { + /* Found a token in the list */ + return; + } + } - /* Not in the list: Skip it */ - NextToken (); + /* Not in the list: Skip it */ + NextToken (); } } @@ -1043,10 +1043,10 @@ int Consume (token_t Token, const char* ErrorMsg) */ { if (CurTok.Tok == Token) { - NextToken (); + NextToken (); return 1; } else { - Error ("%s", ErrorMsg); + Error ("%s", ErrorMsg); return 0; } } @@ -1066,13 +1066,13 @@ int ConsumeSemi (void) { /* Try do be smart about typos... */ if (CurTok.Tok == TOK_SEMI) { - NextToken (); + NextToken (); return 1; } else { - Error ("`;' expected"); - if (CurTok.Tok == TOK_COLON || CurTok.Tok == TOK_COMMA) { - NextToken (); - } + Error ("`;' expected"); + if (CurTok.Tok == TOK_COLON || CurTok.Tok == TOK_COMMA) { + NextToken (); + } return 0; } } @@ -1084,13 +1084,13 @@ int ConsumeComma (void) { /* Try do be smart about typos... */ if (CurTok.Tok == TOK_COMMA) { - NextToken (); + NextToken (); return 1; } else { - Error ("`,' expected"); - if (CurTok.Tok == TOK_SEMI) { - NextToken (); - } + Error ("`,' expected"); + if (CurTok.Tok == TOK_SEMI) { + NextToken (); + } return 0; } } diff --git a/src/cc65/scanner.h b/src/cc65/scanner.h index 1a97692a6..77f2028b9 100644 --- a/src/cc65/scanner.h +++ b/src/cc65/scanner.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* scanner.h */ +/* scanner.h */ /* */ -/* Source file line info structure */ +/* Source file line info structure */ /* */ /* */ /* */ @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Token definitions */ +/* Token definitions */ /*****************************************************************************/ @@ -81,7 +81,7 @@ typedef enum token_t { /* Tokens denoting types */ TOK_FIRST_TYPE, - TOK_ENUM = TOK_FIRST_TYPE, + TOK_ENUM = TOK_FIRST_TYPE, TOK_CHAR, TOK_INT, TOK_DOUBLE, @@ -135,7 +135,7 @@ typedef enum token_t { TOK_MINUS, TOK_MUL_ASSIGN, TOK_STAR, - TOK_MUL = TOK_STAR, /* Alias */ + TOK_MUL = TOK_STAR, /* Alias */ TOK_DIV_ASSIGN, TOK_DIV, TOK_BOOL_AND, @@ -187,7 +187,7 @@ typedef enum token_t { /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -198,22 +198,22 @@ struct Literal; /* Token stuff */ typedef struct Token Token; struct Token { - token_t Tok; /* The token itself */ - long IVal; /* The integer attribute */ - Double FVal; /* The float attribute */ + token_t Tok; /* The token itself */ + long IVal; /* The integer attribute */ + Double FVal; /* The float attribute */ struct Literal* SVal; /* String literal is any */ - ident Ident; /* Identifier if IDENT */ - LineInfo* LI; /* Source line where the token comes from */ - Type* Type; /* Type if integer or float constant */ + ident Ident; /* Identifier if IDENT */ + LineInfo* LI; /* Source line where the token comes from */ + Type* Type; /* Type if integer or float constant */ }; -extern Token CurTok; /* The current token */ -extern Token NextTok; /* The next token */ +extern Token CurTok; /* The current token */ +extern Token NextTok; /* The next token */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/scanstrbuf.c b/src/cc65/scanstrbuf.c index f55f52a64..abddf06db 100644 --- a/src/cc65/scanstrbuf.c +++ b/src/cc65/scanstrbuf.c @@ -61,60 +61,60 @@ static int ParseChar (StrBuf* B) /* Check for escape chars */ if ((C = SB_Get (B)) == '\\') { - switch (SB_Peek (B)) { - case '?': - C = '?'; + switch (SB_Peek (B)) { + case '?': + C = '?'; SB_Skip (B); - break; - case 'a': - C = '\a'; + break; + case 'a': + C = '\a'; SB_Skip (B); - break; - case 'b': - C = '\b'; + break; + case 'b': + C = '\b'; SB_Skip (B); - break; - case 'f': - C = '\f'; + break; + case 'f': + C = '\f'; SB_Skip (B); - break; - case 'r': - C = '\r'; + break; + case 'r': + C = '\r'; SB_Skip (B); - break; - case 'n': - C = '\n'; + break; + case 'n': + C = '\n'; SB_Skip (B); - break; - case 't': - C = '\t'; + break; + case 't': + C = '\t'; SB_Skip (B); - break; - case 'v': - C = '\v'; + break; + case 'v': + C = '\v'; SB_Skip (B); - break; - case '\"': - C = '\"'; + break; + case '\"': + C = '\"'; SB_Skip (B); - break; - case '\'': - C = '\''; + break; + case '\'': + C = '\''; SB_Skip (B); - break; - case '\\': - C = '\\'; + break; + case '\\': + C = '\\'; SB_Skip (B); - break; - case 'x': - case 'X': - /* Hex character constant */ + break; + case 'x': + case 'X': + /* Hex character constant */ SB_Skip (B); - C = HexVal (SB_Get (B)) << 4; - C |= HexVal (SB_Get (B)); - break; - case '0': - case '1': + C = HexVal (SB_Get (B)) << 4; + C |= HexVal (SB_Get (B)); + break; + case '0': + case '1': case '2': case '3': case '4': @@ -124,20 +124,20 @@ static int ParseChar (StrBuf* B) /* Octal constant */ I = 0; Val = SB_Get (B) - '0'; - while (SB_Peek (B) >= '0' && SB_Peek (B) <= '7' && ++I <= 3) { + while (SB_Peek (B) >= '0' && SB_Peek (B) <= '7' && ++I <= 3) { Val = (Val << 3) | (SB_Get (B) - '0'); - } + } C = (int) Val; if (Val > 256) { Error ("Character constant out of range"); C = ' '; } - break; - default: - Error ("Illegal character constant 0x%02X", SB_Get (B)); - C = ' '; - break; - } + break; + default: + Error ("Illegal character constant 0x%02X", SB_Get (B)); + C = ' '; + break; + } } /* Return the character */ @@ -147,7 +147,7 @@ static int ParseChar (StrBuf* B) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -188,9 +188,9 @@ int SB_GetSym (StrBuf* B, StrBuf* Ident, const char* SpecialChars) } while (IsIdent (C) || IsDigit (C) || (C != '\0' && strchr (SpecialChars, C) != 0)); SB_Terminate (Ident); - return 1; + return 1; } else { - return 0; + return 0; } } diff --git a/src/cc65/scanstrbuf.h b/src/cc65/scanstrbuf.h index a49a5f035..a84bbd276 100644 --- a/src/cc65/scanstrbuf.h +++ b/src/cc65/scanstrbuf.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/segments.c b/src/cc65/segments.c index 7fbaa34a6..cdbd05e39 100644 --- a/src/cc65/segments.c +++ b/src/cc65/segments.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* segments.c */ +/* segments.c */ /* */ -/* Lightweight segment management stuff */ +/* Lightweight segment management stuff */ /* */ /* */ /* */ @@ -56,7 +56,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -80,7 +80,7 @@ static Collection SegmentStack = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -143,12 +143,12 @@ static Segments* NewSegments (SymEntry* Func) Segments* S = xmalloc (sizeof (Segments)); /* Initialize the fields */ - S->Text = NewTextSeg (Func); - S->Code = NewCodeSeg (GetSegName (SEG_CODE), Func); - S->Data = NewDataSeg (GetSegName (SEG_DATA), Func); - S->ROData = NewDataSeg (GetSegName (SEG_RODATA), Func); - S->BSS = NewDataSeg (GetSegName (SEG_BSS), Func); - S->CurDSeg = SEG_DATA; + S->Text = NewTextSeg (Func); + S->Code = NewCodeSeg (GetSegName (SEG_CODE), Func); + S->Data = NewDataSeg (GetSegName (SEG_DATA), Func); + S->ROData = NewDataSeg (GetSegName (SEG_RODATA), Func); + S->BSS = NewDataSeg (GetSegName (SEG_BSS), Func); + S->CurDSeg = SEG_DATA; /* Return the new struct */ return S; @@ -208,12 +208,12 @@ struct DataSeg* GetDataSeg (void) { PRECONDITION (CS != 0); switch (CS->CurDSeg) { - case SEG_BSS: return CS->BSS; - case SEG_DATA: return CS->Data; - case SEG_RODATA: return CS->ROData; - default: - FAIL ("Invalid data segment"); - return 0; + case SEG_BSS: return CS->BSS; + case SEG_DATA: return CS->Data; + case SEG_RODATA: return CS->ROData; + default: + FAIL ("Invalid data segment"); + return 0; } } diff --git a/src/cc65/segments.h b/src/cc65/segments.h index 11c8fb2bc..cf6c72fba 100644 --- a/src/cc65/segments.h +++ b/src/cc65/segments.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* segments.h */ +/* segments.h */ /* */ -/* Segment management */ +/* Segment management */ /* */ /* */ /* */ @@ -48,7 +48,7 @@ /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -63,7 +63,7 @@ struct SymEntry; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -80,12 +80,12 @@ typedef enum segment_t { /* A list of all segments used when generating code */ typedef struct Segments Segments; struct Segments { - struct TextSeg* Text; /* Text segment */ - struct CodeSeg* Code; /* Code segment */ - struct DataSeg* Data; /* Data segment */ - struct DataSeg* ROData; /* Readonly data segment */ - struct DataSeg* BSS; /* Segment for uninitialized data */ - segment_t CurDSeg; /* Current data segment */ + struct TextSeg* Text; /* Text segment */ + struct CodeSeg* Code; /* Code segment */ + struct DataSeg* Data; /* Data segment */ + struct DataSeg* ROData; /* Readonly data segment */ + struct DataSeg* BSS; /* Segment for uninitialized data */ + segment_t CurDSeg; /* Current data segment */ }; /* Pointer to the current segment list. Output goes here. */ @@ -97,7 +97,7 @@ extern Segments* GS; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/shiftexpr.c b/src/cc65/shiftexpr.c index 6920590e8..44a42f304 100644 --- a/src/cc65/shiftexpr.c +++ b/src/cc65/shiftexpr.c @@ -47,13 +47,13 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -64,13 +64,13 @@ void ShiftExpr (struct ExprDesc* Expr) ExprDesc Expr2; CodeMark Mark1; CodeMark Mark2; - token_t Tok; /* The operator token */ + token_t Tok; /* The operator token */ Type* EffType; /* Effective lhs type */ Type* ResultType; /* Type of the result */ unsigned ExprBits; /* Bits of the lhs operand */ unsigned GenFlags; /* Generator flags */ unsigned ltype; - int rconst; /* Operand is a constant */ + int rconst; /* Operand is a constant */ /* Evaluate the lhs */ @@ -78,15 +78,15 @@ void ShiftExpr (struct ExprDesc* Expr) while (CurTok.Tok == TOK_SHL || CurTok.Tok == TOK_SHR) { - /* All operators that call this function expect an int on the lhs */ - if (!IsClassInt (Expr->Type)) { - Error ("Integer expression expected"); + /* All operators that call this function expect an int on the lhs */ + if (!IsClassInt (Expr->Type)) { + Error ("Integer expression expected"); ED_MakeConstAbsInt (Expr, 1); - } + } - /* Remember the operator token, then skip it */ - Tok = CurTok.Tok; - NextToken (); + /* Remember the operator token, then skip it */ + Tok = CurTok.Tok; + NextToken (); /* Get the type of the result */ ResultType = EffType = IntPromotion (Expr->Type); @@ -97,28 +97,28 @@ void ShiftExpr (struct ExprDesc* Expr) /* Calculate the number of bits the lhs operand has */ ExprBits = SizeOf (ResultType) * 8; - /* Get the lhs on stack */ - GetCodePos (&Mark1); - ltype = TypeOf (Expr->Type); - if (ED_IsConstAbs (Expr)) { - /* Constant value */ - GetCodePos (&Mark2); - g_push (ltype | CF_CONST, Expr->IVal); - } else { - /* Value not constant */ - LoadExpr (CF_NONE, Expr); - GetCodePos (&Mark2); - g_push (ltype, 0); - } + /* Get the lhs on stack */ + GetCodePos (&Mark1); + ltype = TypeOf (Expr->Type); + if (ED_IsConstAbs (Expr)) { + /* Constant value */ + GetCodePos (&Mark2); + g_push (ltype | CF_CONST, Expr->IVal); + } else { + /* Value not constant */ + LoadExpr (CF_NONE, Expr); + GetCodePos (&Mark2); + g_push (ltype, 0); + } - /* Get the right hand side */ + /* Get the right hand side */ ExprWithCheck (hie8, &Expr2); - /* Check the type of the rhs */ - if (!IsClassInt (Expr2.Type)) { - Error ("Integer expression expected"); + /* Check the type of the rhs */ + if (!IsClassInt (Expr2.Type)) { + Error ("Integer expression expected"); ED_MakeConstAbsInt (&Expr2, 1); - } + } /* Check for a constant right side expression */ rconst = ED_IsConstAbs (&Expr2); @@ -232,7 +232,7 @@ MakeRVal: Next: /* Set the type of the result */ - Expr->Type = ResultType; + Expr->Type = ResultType; } } diff --git a/src/cc65/shiftexpr.h b/src/cc65/shiftexpr.h index d5f670699..b4c50d44b 100644 --- a/src/cc65/shiftexpr.h +++ b/src/cc65/shiftexpr.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -55,7 +55,7 @@ struct ExprDesc; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/stackptr.c b/src/cc65/stackptr.c index 9313db366..26669fa57 100644 --- a/src/cc65/stackptr.c +++ b/src/cc65/stackptr.c @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -50,7 +50,7 @@ int StackPtr = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/stackptr.h b/src/cc65/stackptr.h index 51d6e878a..4232c0a46 100644 --- a/src/cc65/stackptr.h +++ b/src/cc65/stackptr.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -55,7 +55,7 @@ extern int StackPtr; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/standard.c b/src/cc65/standard.c index a7073f8ce..e6a842d2c 100644 --- a/src/cc65/standard.c +++ b/src/cc65/standard.c @@ -41,7 +41,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -57,7 +57,7 @@ static const char* StdNames[STD_COUNT] = { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -71,9 +71,9 @@ standard_t FindStandard (const char* Name) /* Check for a standard string */ for (I = 0; I < STD_COUNT; ++I) { - if (strcmp (StdNames [I], Name) == 0) { - return (standard_t)I; - } + if (strcmp (StdNames [I], Name) == 0) { + return (standard_t)I; + } } /* Not found */ diff --git a/src/cc65/standard.h b/src/cc65/standard.h index 6cfd23e59..bebc154ee 100644 --- a/src/cc65/standard.h +++ b/src/cc65/standard.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -67,7 +67,7 @@ extern IntStack Standard; /* Language standard */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/stdfunc.c b/src/cc65/stdfunc.c index d1db93b15..1c3c89483 100644 --- a/src/cc65/stdfunc.c +++ b/src/cc65/stdfunc.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* stdfunc.c */ +/* stdfunc.c */ /* */ -/* Handle inlining of known functions for the cc65 compiler */ +/* Handle inlining of known functions for the cc65 compiler */ /* */ /* */ /* */ @@ -58,7 +58,7 @@ /*****************************************************************************/ -/* Function forwards */ +/* Function forwards */ /*****************************************************************************/ @@ -72,7 +72,7 @@ static void StdFunc_strlen (FuncDesc*, ExprDesc*); /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -81,17 +81,17 @@ static void StdFunc_strlen (FuncDesc*, ExprDesc*); * alphabetically! */ static struct StdFuncDesc { - const char* Name; - void (*Handler) (FuncDesc*, ExprDesc*); + const char* Name; + void (*Handler) (FuncDesc*, ExprDesc*); } StdFuncs[] = { - { "memcpy", StdFunc_memcpy }, - { "memset", StdFunc_memset }, - { "strcmp", StdFunc_strcmp }, - { "strcpy", StdFunc_strcpy }, - { "strlen", StdFunc_strlen }, + { "memcpy", StdFunc_memcpy }, + { "memset", StdFunc_memset }, + { "strcmp", StdFunc_strcmp }, + { "strcpy", StdFunc_strcpy }, + { "strlen", StdFunc_strlen }, }; -#define FUNC_COUNT (sizeof (StdFuncs) / sizeof (StdFuncs[0])) +#define FUNC_COUNT (sizeof (StdFuncs) / sizeof (StdFuncs[0])) typedef struct ArgDesc ArgDesc; struct ArgDesc { @@ -107,7 +107,7 @@ struct ArgDesc { /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -1290,7 +1290,7 @@ static void StdFunc_strlen (FuncDesc* F attribute ((unused)), ExprDesc* Expr) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/stdfunc.h b/src/cc65/stdfunc.h index 33094ecee..9716d2b3e 100644 --- a/src/cc65/stdfunc.h +++ b/src/cc65/stdfunc.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* stdfunc.h */ +/* stdfunc.h */ /* */ -/* Handle inlining of known functions for the cc65 compiler */ +/* Handle inlining of known functions for the cc65 compiler */ /* */ /* */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/stdnames.c b/src/cc65/stdnames.c index b56678b9f..aa58e3be4 100644 --- a/src/cc65/stdnames.c +++ b/src/cc65/stdnames.c @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/cc65/stdnames.h b/src/cc65/stdnames.h index 1df8337a7..d60de04a2 100644 --- a/src/cc65/stdnames.h +++ b/src/cc65/stdnames.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/cc65/stmt.c b/src/cc65/stmt.c index 74fbf6ea9..34a314863 100644 --- a/src/cc65/stmt.c +++ b/src/cc65/stmt.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* stmt.c */ +/* stmt.c */ /* */ -/* Parse a statement */ +/* Parse a statement */ /* */ /* */ /* */ @@ -66,7 +66,7 @@ /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -94,11 +94,11 @@ static void CheckTok (token_t Tok, const char* Msg, int* PendingToken) */ { if (CurTok.Tok != Tok) { - Error ("%s", Msg); + Error ("%s", Msg); } else if (PendingToken) { - *PendingToken = 1; + *PendingToken = 1; } else { - NextToken (); + NextToken (); } } @@ -115,7 +115,7 @@ static void CheckSemi (int* PendingToken) { int HaveToken = (CurTok.Tok == TOK_SEMI); if (!HaveToken) { - Error ("`;' expected"); + Error ("`;' expected"); /* Try to be smart about errors */ if (CurTok.Tok == TOK_COLON || CurTok.Tok == TOK_COMMA) { HaveToken = 1; @@ -136,14 +136,14 @@ static void SkipPending (int PendingToken) /* Skip the pending token if we have one */ { if (PendingToken) { - NextToken (); + NextToken (); } } /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -168,21 +168,21 @@ static int IfStatement (void) /* Else clause present? */ if (CurTok.Tok != TOK_ELSE) { - g_defcodelabel (Label1); + g_defcodelabel (Label1); - /* Since there's no else clause, we're not sure, if the a break - * statement is really executed. - */ - return 0; + /* Since there's no else clause, we're not sure, if the a break + * statement is really executed. + */ + return 0; } else { - /* Generate a jump around the else branch */ - unsigned Label2 = GetLocalLabel (); - g_jump (Label2); + /* Generate a jump around the else branch */ + unsigned Label2 = GetLocalLabel (); + g_jump (Label2); - /* Skip the else */ - NextToken (); + /* Skip the else */ + NextToken (); /* If the if expression was always true, the code in the else branch * is never executed. Output a warning if this is the case. @@ -191,17 +191,17 @@ static int IfStatement (void) Warning ("Unreachable code"); } - /* Define the target for the first test */ - g_defcodelabel (Label1); + /* Define the target for the first test */ + g_defcodelabel (Label1); - /* Total break only if both branches had a break. */ - GotBreak &= Statement (0); + /* Total break only if both branches had a break. */ + GotBreak &= Statement (0); - /* Generate the label for the else clause */ - g_defcodelabel (Label2); + /* Generate the label for the else clause */ + g_defcodelabel (Label2); - /* Done */ - return GotBreak; + /* Done */ + return GotBreak; } } @@ -314,25 +314,25 @@ static void ReturnStatement (void) NextToken (); if (CurTok.Tok != TOK_SEMI) { - /* Evaluate the return expression */ - hie0 (&Expr); + /* Evaluate the return expression */ + hie0 (&Expr); /* If we return something in a void function, print an error and * ignore the value. Otherwise convert the value to the type of the * return. */ - if (F_HasVoidReturn (CurrentFunc)) { - Error ("Returning a value in function with return type void"); - } else { - /* Convert the return value to the type of the function result */ - TypeConversion (&Expr, F_GetReturnType (CurrentFunc)); + if (F_HasVoidReturn (CurrentFunc)) { + Error ("Returning a value in function with return type void"); + } else { + /* Convert the return value to the type of the function result */ + TypeConversion (&Expr, F_GetReturnType (CurrentFunc)); - /* Load the value into the primary */ - LoadExpr (CF_NONE, &Expr); - } + /* Load the value into the primary */ + LoadExpr (CF_NONE, &Expr); + } } else if (!F_HasVoidReturn (CurrentFunc) && !F_HasOldStyleIntRet (CurrentFunc)) { - Error ("Function `%s' must return a value", F_GetFuncName (CurrentFunc)); + Error ("Function `%s' must return a value", F_GetFuncName (CurrentFunc)); } /* Mark the function as having a return statement */ @@ -360,9 +360,9 @@ static void BreakStatement (void) /* Check if we are inside a loop */ if (L == 0) { - /* Error: No current loop */ - Error ("`break' statement not within loop or switch"); - return; + /* Error: No current loop */ + Error ("`break' statement not within loop or switch"); + return; } /* Correct the stack pointer if needed */ @@ -385,19 +385,19 @@ static void ContinueStatement (void) /* Get the current loop descriptor */ L = CurrentLoop (); if (L) { - /* Search for a loop that has a continue label. */ - do { - if (L->ContinueLabel) { - break; - } - L = L->Next; - } while (L); + /* Search for a loop that has a continue label. */ + do { + if (L->ContinueLabel) { + break; + } + L = L->Next; + } while (L); } /* Did we find it? */ if (L == 0) { - Error ("`continue' statement not within a loop"); - return; + Error ("`continue' statement not within a loop"); + return; } /* Correct the stackpointer if needed */ @@ -438,7 +438,7 @@ static void ForStatement (void) /* Parse the initializer expression */ if (CurTok.Tok != TOK_SEMI) { - Expression0 (&lval1); + Expression0 (&lval1); } ConsumeSemi (); @@ -448,9 +448,9 @@ static void ForStatement (void) /* Parse the test expression */ if (CurTok.Tok != TOK_SEMI) { Test (BodyLabel, 1); - g_jump (BreakLabel); + g_jump (BreakLabel); } else { - g_jump (BodyLabel); + g_jump (BodyLabel); } ConsumeSemi (); @@ -463,7 +463,7 @@ static void ForStatement (void) /* Parse the increment expression */ HaveIncExpr = (CurTok.Tok != TOK_RPAREN); if (HaveIncExpr) { - Expression0 (&lval3); + Expression0 (&lval3); } /* Jump to the test */ @@ -486,10 +486,10 @@ static void ForStatement (void) if (HaveIncExpr) { CodeMark Here; GetCodePos (&Here); - MoveCode (&IncExprStart, &IncExprEnd, &Here); + MoveCode (&IncExprStart, &IncExprEnd, &Here); } else { - /* Jump back to the increment expression */ - g_jump (IncLabel); + /* Jump back to the increment expression */ + g_jump (IncLabel); } /* Skip a pending token if we have one */ @@ -523,16 +523,16 @@ static int CompoundStatement (void) /* Now process statements in this block */ GotBreak = 0; while (CurTok.Tok != TOK_RCURLY) { - if (CurTok.Tok != TOK_CEOF) { - GotBreak = Statement (0); - } else { - break; - } + if (CurTok.Tok != TOK_CEOF) { + GotBreak = Statement (0); + } else { + break; + } } /* Clean up the stack. */ if (!GotBreak) { - g_space (StackPtr - OldStack); + g_space (StackPtr - OldStack); } StackPtr = OldStack; @@ -563,15 +563,15 @@ int Statement (int* PendingToken) /* Assume no pending token */ if (PendingToken) { - *PendingToken = 0; + *PendingToken = 0; } /* Check for a label. A label is always part of a statement, it does not * replace one. */ while (CurTok.Tok == TOK_IDENT && NextTok.Tok == TOK_COLON) { - /* Handle the label */ - DoLabel (); + /* Handle the label */ + DoLabel (); if (CheckLabelWithoutStatement ()) { return 0; } diff --git a/src/cc65/stmt.h b/src/cc65/stmt.h index 8a1d2a941..4a9a72e42 100644 --- a/src/cc65/stmt.h +++ b/src/cc65/stmt.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* stmt.h */ +/* stmt.h */ /* */ -/* Parse a statement */ +/* Parse a statement */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/swstmt.c b/src/cc65/swstmt.c index 2823ae118..7e48b58d2 100644 --- a/src/cc65/swstmt.c +++ b/src/cc65/swstmt.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* swstmt.c */ +/* swstmt.c */ /* */ -/* Parse the switch statement */ +/* Parse the switch statement */ /* */ /* */ /* */ @@ -56,7 +56,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -78,7 +78,7 @@ static SwitchCtrl* Switch = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -90,7 +90,7 @@ void SwitchStatement (void) CodeMark CaseCodeStart; /* Start of code marker */ CodeMark SwitchCodeStart;/* Start of switch code */ CodeMark SwitchCodeEnd; /* End of switch code */ - unsigned ExitLabel; /* Exit label */ + unsigned ExitLabel; /* Exit label */ unsigned SwitchCodeLabel;/* Label for the switch code */ int HaveBreak = 0; /* True if the last statement had a break */ int RCurlyBrace; /* True if last token is right curly brace */ @@ -108,8 +108,8 @@ void SwitchStatement (void) Expression0 (&SwitchExpr); if (!IsClassInt (SwitchExpr.Type)) { Error ("Switch quantity is not an integer"); - /* To avoid any compiler errors, make the expression a valid int */ - ED_MakeConstAbsInt (&SwitchExpr, 1); + /* To avoid any compiler errors, make the expression a valid int */ + ED_MakeConstAbsInt (&SwitchExpr, 1); } ConsumeRParen (); @@ -156,7 +156,7 @@ void SwitchStatement (void) /* Check if we had any labels */ if (CollCount (SwitchData.Nodes) == 0 && SwitchData.DefaultLabel == 0) { - Warning ("No case labels"); + Warning ("No case labels"); } /* If the last statement did not have a break, we may have an open diff --git a/src/cc65/swstmt.h b/src/cc65/swstmt.h index 7af232f85..1523217f1 100644 --- a/src/cc65/swstmt.h +++ b/src/cc65/swstmt.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* swstmt.h */ +/* swstmt.h */ /* */ -/* Parse the switch statement */ +/* Parse the switch statement */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/symentry.c b/src/cc65/symentry.c index 67654a9f0..41e14e673 100644 --- a/src/cc65/symentry.c +++ b/src/cc65/symentry.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* symentry.c */ +/* symentry.c */ /* */ -/* Symbol table entries for the cc65 C compiler */ +/* Symbol table entries for the cc65 C compiler */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -62,13 +62,13 @@ SymEntry* NewSymEntry (const char* Name, unsigned Flags) SymEntry* E = xmalloc (sizeof (SymEntry) + Len); /* Initialize the entry */ - E->NextHash = 0; - E->PrevSym = 0; - E->NextSym = 0; - E->Link = 0; - E->Owner = 0; - E->Flags = Flags; - E->Type = 0; + E->NextHash = 0; + E->PrevSym = 0; + E->NextSym = 0; + E->Link = 0; + E->Owner = 0; + E->Flags = Flags; + E->Type = 0; E->Attr = 0; E->AsmName = 0; memcpy (E->Name, Name, Len+1); @@ -93,28 +93,28 @@ void DumpSymEntry (FILE* F, const SymEntry* E) /* Dump the given symbol table entry to the file in readable form */ { static const struct { - const char* Name; - unsigned Val; + const char* Name; + unsigned Val; } Flags [] = { - /* Beware: Order is important! */ - { "SC_TYPEDEF", SC_TYPEDEF }, + /* Beware: Order is important! */ + { "SC_TYPEDEF", SC_TYPEDEF }, { "SC_BITFIELD", SC_BITFIELD }, - { "SC_STRUCTFIELD", SC_STRUCTFIELD }, + { "SC_STRUCTFIELD", SC_STRUCTFIELD }, { "SC_UNION", SC_UNION }, - { "SC_STRUCT", SC_STRUCT }, - { "SC_AUTO", SC_AUTO }, - { "SC_REGISTER", SC_REGISTER }, - { "SC_STATIC", SC_STATIC }, - { "SC_EXTERN", SC_EXTERN }, - { "SC_ENUM", SC_ENUM }, - { "SC_CONST", SC_CONST }, - { "SC_LABEL", SC_LABEL }, - { "SC_PARAM", SC_PARAM }, - { "SC_FUNC", SC_FUNC }, - { "SC_STORAGE", SC_STORAGE }, - { "SC_DEF", SC_DEF }, - { "SC_REF", SC_REF }, - { "SC_ZEROPAGE", SC_ZEROPAGE }, + { "SC_STRUCT", SC_STRUCT }, + { "SC_AUTO", SC_AUTO }, + { "SC_REGISTER", SC_REGISTER }, + { "SC_STATIC", SC_STATIC }, + { "SC_EXTERN", SC_EXTERN }, + { "SC_ENUM", SC_ENUM }, + { "SC_CONST", SC_CONST }, + { "SC_LABEL", SC_LABEL }, + { "SC_PARAM", SC_PARAM }, + { "SC_FUNC", SC_FUNC }, + { "SC_STORAGE", SC_STORAGE }, + { "SC_DEF", SC_DEF }, + { "SC_REF", SC_REF }, + { "SC_ZEROPAGE", SC_ZEROPAGE }, }; unsigned I; @@ -132,22 +132,22 @@ void DumpSymEntry (FILE* F, const SymEntry* E) SymFlags = E->Flags; fprintf (F, " Flags: "); for (I = 0; I < sizeof (Flags) / sizeof (Flags[0]) && SymFlags != 0; ++I) { - if ((SymFlags & Flags[I].Val) == Flags[I].Val) { - SymFlags &= ~Flags[I].Val; - fprintf (F, "%s ", Flags[I].Name); - } + if ((SymFlags & Flags[I].Val) == Flags[I].Val) { + SymFlags &= ~Flags[I].Val; + fprintf (F, "%s ", Flags[I].Name); + } } if (SymFlags != 0) { - fprintf (F, "%04X", SymFlags); + fprintf (F, "%04X", SymFlags); } fprintf (F, "\n"); /* Print the type */ fprintf (F, " Type: "); if (E->Type) { - PrintType (F, E->Type); + PrintType (F, E->Type); } else { - fprintf (F, "(none)"); + fprintf (F, "(none)"); } fprintf (F, "\n"); } diff --git a/src/cc65/symentry.h b/src/cc65/symentry.h index 54a7d32ad..14d786995 100644 --- a/src/cc65/symentry.h +++ b/src/cc65/symentry.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* symentry.h */ +/* symentry.h */ /* */ -/* Symbol table entries for the cc65 C compiler */ +/* Symbol table entries for the cc65 C compiler */ /* */ /* */ /* */ @@ -51,7 +51,7 @@ /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -62,39 +62,39 @@ struct LiteralPool; /*****************************************************************************/ -/* struct SymEntry */ +/* struct SymEntry */ /*****************************************************************************/ /* Storage classes and flags */ -#define SC_AUTO 0x0001U /* Auto variable */ -#define SC_REGISTER 0x0002U /* Register variable */ -#define SC_STATIC 0x0004U /* Static */ -#define SC_EXTERN 0x0008U /* Extern linkage */ +#define SC_AUTO 0x0001U /* Auto variable */ +#define SC_REGISTER 0x0002U /* Register variable */ +#define SC_STATIC 0x0004U /* Static */ +#define SC_EXTERN 0x0008U /* Extern linkage */ -#define SC_ENUM 0x0030U /* An enum */ -#define SC_CONST 0x0020U /* A numeric constant with a type */ -#define SC_LABEL 0x0040U /* A goto label */ -#define SC_PARAM 0x0080U /* A function parameter */ -#define SC_FUNC 0x0100U /* A function */ +#define SC_ENUM 0x0030U /* An enum */ +#define SC_CONST 0x0020U /* A numeric constant with a type */ +#define SC_LABEL 0x0040U /* A goto label */ +#define SC_PARAM 0x0080U /* A function parameter */ +#define SC_FUNC 0x0100U /* A function */ #define SC_DEFTYPE 0x0200U /* Parameter has default type (=int, old style) */ -#define SC_STORAGE 0x0400U /* Symbol with associated storage */ -#define SC_DEFAULT 0x0800U /* Flag: default storage class was used */ +#define SC_STORAGE 0x0400U /* Symbol with associated storage */ +#define SC_DEFAULT 0x0800U /* Flag: default storage class was used */ -#define SC_DEF 0x1000U /* Symbol is defined */ -#define SC_REF 0x2000U /* Symbol is referenced */ +#define SC_DEF 0x1000U /* Symbol is defined */ +#define SC_REF 0x2000U /* Symbol is referenced */ -#define SC_TYPE 0x4000U /* This is a type, struct, typedef, etc. */ -#define SC_STRUCT 0x4001U /* Struct */ +#define SC_TYPE 0x4000U /* This is a type, struct, typedef, etc. */ +#define SC_STRUCT 0x4001U /* Struct */ #define SC_UNION 0x4002U /* Union */ -#define SC_STRUCTFIELD 0x4003U /* Struct or union field */ +#define SC_STRUCTFIELD 0x4003U /* Struct or union field */ #define SC_BITFIELD 0x4004U /* A bit-field inside a struct or union */ -#define SC_TYPEDEF 0x4005U /* A typedef */ +#define SC_TYPEDEF 0x4005U /* A typedef */ #define SC_TYPEMASK 0x400FU /* Mask for above types */ -#define SC_ZEROPAGE 0x8000U /* Symbol marked as zeropage */ +#define SC_ZEROPAGE 0x8000U /* Symbol marked as zeropage */ #define SC_HAVEATTR 0x10000U /* Symbol has attributes */ @@ -103,24 +103,24 @@ struct LiteralPool; /* Symbol table entry */ typedef struct SymEntry SymEntry; struct SymEntry { - SymEntry* NextHash; /* Next entry in hash list */ - SymEntry* PrevSym; /* Previous symbol in dl list */ - SymEntry* NextSym; /* Next symbol double linked list */ - SymEntry* Link; /* General purpose single linked list */ - struct SymTable* Owner; /* Symbol table the symbol is in */ - unsigned Flags; /* Symbol flags */ - Type* Type; /* Symbol type */ + SymEntry* NextHash; /* Next entry in hash list */ + SymEntry* PrevSym; /* Previous symbol in dl list */ + SymEntry* NextSym; /* Next symbol double linked list */ + SymEntry* Link; /* General purpose single linked list */ + struct SymTable* Owner; /* Symbol table the symbol is in */ + unsigned Flags; /* Symbol flags */ + Type* Type; /* Symbol type */ Collection* Attr; /* Attribute list if any */ char* AsmName; /* Assembler name if any */ /* Data that differs for the different symbol types */ union { - /* Offset for locals or struct members */ - int Offs; + /* Offset for locals or struct members */ + int Offs; - /* Label name for static symbols */ - unsigned Label; + /* Label name for static symbols */ + unsigned Label; /* Register bank offset and offset of the saved copy on stack for * register variables. @@ -130,14 +130,14 @@ struct SymEntry { int SaveOffs; } R; - /* Value for constants (including enums) */ - long ConstVal; + /* Value for constants (including enums) */ + long ConstVal; - /* Data for structs/unions */ - struct { - struct SymTable* SymTab; /* Member symbol table */ - unsigned Size; /* Size of the union/struct */ - } S; + /* Data for structs/unions */ + struct { + struct SymTable* SymTab; /* Member symbol table */ + unsigned Size; /* Size of the union/struct */ + } S; /* Data for bit fields */ struct { @@ -146,21 +146,21 @@ struct SymEntry { unsigned BitWidth; /* Width in bits */ } B; - /* Data for functions */ - struct { - struct FuncDesc* Func; /* Function descriptor */ - struct Segments* Seg; /* Segments for this function */ + /* Data for functions */ + struct { + struct FuncDesc* Func; /* Function descriptor */ + struct Segments* Seg; /* Segments for this function */ struct LiteralPool* LitPool; /* Literal pool for this function */ - } F; + } F; } V; - char Name[1]; /* Name, dynamically allocated */ + char Name[1]; /* Name, dynamically allocated */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/symtab.c b/src/cc65/symtab.c index d7a4b92dc..4a44c770d 100644 --- a/src/cc65/symtab.c +++ b/src/cc65/symtab.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* symtab.c */ +/* symtab.c */ /* */ -/* Symbol table management for the cc65 C compiler */ +/* Symbol table management for the cc65 C compiler */ /* */ /* */ /* */ @@ -61,40 +61,40 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* An empty symbol table */ -SymTable EmptySymTab = { - 0, /* PrevTab */ - 0, /* SymHead */ - 0, /* SymTail */ - 0, /* SymCount */ - 1, /* Size */ - { 0 } /* Tab[1] */ +SymTable EmptySymTab = { + 0, /* PrevTab */ + 0, /* SymHead */ + 0, /* SymTail */ + 0, /* SymCount */ + 1, /* Size */ + { 0 } /* Tab[1] */ }; /* Symbol table sizes */ -#define SYMTAB_SIZE_GLOBAL 211U -#define SYMTAB_SIZE_FUNCTION 29U -#define SYMTAB_SIZE_BLOCK 13U -#define SYMTAB_SIZE_STRUCT 19U -#define SYMTAB_SIZE_LABEL 7U +#define SYMTAB_SIZE_GLOBAL 211U +#define SYMTAB_SIZE_FUNCTION 29U +#define SYMTAB_SIZE_BLOCK 13U +#define SYMTAB_SIZE_STRUCT 19U +#define SYMTAB_SIZE_LABEL 7U /* The current and root symbol tables */ -static unsigned LexicalLevel = 0; /* For safety checks */ -static SymTable* SymTab0 = 0; -static SymTable* SymTab = 0; -static SymTable* TagTab0 = 0; -static SymTable* TagTab = 0; -static SymTable* LabelTab = 0; +static unsigned LexicalLevel = 0; /* For safety checks */ +static SymTable* SymTab0 = 0; +static SymTable* SymTab = 0; +static SymTable* TagTab0 = 0; +static SymTable* TagTab = 0; +static SymTable* LabelTab = 0; /*****************************************************************************/ -/* struct SymTable */ +/* struct SymTable */ /*****************************************************************************/ @@ -108,13 +108,13 @@ static SymTable* NewSymTable (unsigned Size) SymTable* S = xmalloc (sizeof (SymTable) + (Size-1) * sizeof (SymEntry*)); /* Initialize the symbol table structure */ - S->PrevTab = 0; - S->SymHead = 0; - S->SymTail = 0; - S->SymCount = 0; - S->Size = Size; + S->PrevTab = 0; + S->SymHead = 0; + S->SymTail = 0; + S->SymCount = 0; + S->Size = Size; for (I = 0; I < Size; ++I) { - S->Tab[I] = 0; + S->Tab[I] = 0; } /* Return the symbol table */ @@ -129,9 +129,9 @@ static void FreeSymTable (SymTable* S) /* Free all symbols */ SymEntry* Sym = S->SymHead; while (Sym) { - SymEntry* NextSym = Sym->NextSym; - FreeSymEntry (Sym); - Sym = NextSym; + SymEntry* NextSym = Sym->NextSym; + FreeSymEntry (Sym); + Sym = NextSym; } /* Free the table itself */ @@ -141,7 +141,7 @@ static void FreeSymTable (SymTable* S) /*****************************************************************************/ -/* Check symbols in a table */ +/* Check symbols in a table */ /*****************************************************************************/ @@ -152,54 +152,54 @@ static void CheckSymTable (SymTable* Tab) SymEntry* Entry = Tab->SymHead; while (Entry) { - /* Get the storage flags for tne entry */ - unsigned Flags = Entry->Flags; + /* Get the storage flags for tne entry */ + unsigned Flags = Entry->Flags; - /* Ignore typedef entries */ - if (!SymIsTypeDef (Entry)) { + /* Ignore typedef entries */ + if (!SymIsTypeDef (Entry)) { - /* Check if the symbol is one with storage, and it if it was - * defined but not used. - */ - if (((Flags & SC_AUTO) || (Flags & SC_STATIC)) && (Flags & SC_EXTERN) == 0) { - if (SymIsDef (Entry) && !SymIsRef (Entry) && + /* Check if the symbol is one with storage, and it if it was + * defined but not used. + */ + if (((Flags & SC_AUTO) || (Flags & SC_STATIC)) && (Flags & SC_EXTERN) == 0) { + if (SymIsDef (Entry) && !SymIsRef (Entry) && !SymHasAttr (Entry, atUnused)) { - if (Flags & SC_PARAM) { + if (Flags & SC_PARAM) { if (IS_Get (&WarnUnusedParam)) { - Warning ("Parameter `%s' is never used", Entry->Name); + Warning ("Parameter `%s' is never used", Entry->Name); } - } else { + } else { if (IS_Get (&WarnUnusedVar)) { Warning ("`%s' is defined but never used", Entry->Name); } - } - } - } - - /* If the entry is a label, check if it was defined in the function */ - if (Flags & SC_LABEL) { - if (!SymIsDef (Entry)) { - /* Undefined label */ - Error ("Undefined label: `%s'", Entry->Name); - } else if (!SymIsRef (Entry)) { - /* Defined but not used */ - if (IS_Get (&WarnUnusedLabel)) { - Warning ("`%s' is defined but never used", Entry->Name); } - } - } + } + } - } + /* If the entry is a label, check if it was defined in the function */ + if (Flags & SC_LABEL) { + if (!SymIsDef (Entry)) { + /* Undefined label */ + Error ("Undefined label: `%s'", Entry->Name); + } else if (!SymIsRef (Entry)) { + /* Defined but not used */ + if (IS_Get (&WarnUnusedLabel)) { + Warning ("`%s' is defined but never used", Entry->Name); + } + } + } - /* Next entry */ - Entry = Entry->NextSym; + } + + /* Next entry */ + Entry = Entry->NextSym; } } /*****************************************************************************/ -/* Handling of lexical levels */ +/* Handling of lexical levels */ /*****************************************************************************/ @@ -238,8 +238,8 @@ void LeaveGlobalLevel (void) /* Dump the tables if requested */ if (Debug) { - PrintSymTable (SymTab0, stdout, "Global symbol table"); - PrintSymTable (TagTab0, stdout, "Global tag table"); + PrintSymTable (SymTab0, stdout, "Global symbol table"); + PrintSymTable (TagTab0, stdout, "Global tag table"); } /* Don't delete the symbol and struct tables! */ @@ -321,7 +321,7 @@ void LeaveFunctionLevel (void) /* Drop the label table if it is empty */ if (LabelTab->SymCount == 0) { - FreeSymTable (LabelTab); + FreeSymTable (LabelTab); } /* Don't delete the tables */ @@ -342,8 +342,8 @@ void EnterBlockLevel (void) /* Get a new symbol table and make it current */ S = NewSymTable (SYMTAB_SIZE_BLOCK); - S->PrevTab = SymTab; - SymTab = S; + S->PrevTab = SymTab; + SymTab = S; /* Get a new tag table and make it current */ S = NewSymTable (SYMTAB_SIZE_BLOCK); @@ -379,8 +379,8 @@ void EnterStructLevel (void) * outside scope. So we will NOT create a new struct or enum table. */ S = NewSymTable (SYMTAB_SIZE_BLOCK); - S->PrevTab = SymTab; - SymTab = S; + S->PrevTab = SymTab; + SymTab = S; } @@ -395,7 +395,7 @@ void LeaveStructLevel (void) /*****************************************************************************/ -/* Find functions */ +/* Find functions */ /*****************************************************************************/ @@ -406,13 +406,13 @@ static SymEntry* FindSymInTable (const SymTable* T, const char* Name, unsigned H /* Get the start of the hash chain */ SymEntry* E = T->Tab [Hash % T->Size]; while (E) { - /* Compare the name */ - if (strcmp (E->Name, Name) == 0) { - /* Found */ - return E; - } - /* Not found, next entry in hash chain */ - E = E->NextHash; + /* Compare the name */ + if (strcmp (E->Name, Name) == 0) { + /* Found */ + return E; + } + /* Not found, next entry in hash chain */ + E = E->NextHash; } /* Not found */ @@ -429,16 +429,16 @@ static SymEntry* FindSymInTree (const SymTable* Tab, const char* Name) /* Check all symbol tables for the symbol */ while (Tab) { - /* Try to find the symbol in this table */ - SymEntry* E = FindSymInTable (Tab, Name, Hash); + /* Try to find the symbol in this table */ + SymEntry* E = FindSymInTable (Tab, Name, Hash); - /* Bail out if we found it */ - if (E != 0) { - return E; - } + /* Bail out if we found it */ + if (E != 0) { + return E; + } - /* Repeat the search in the next higher lexical level */ - Tab = Tab->PrevTab; + /* Repeat the search in the next higher lexical level */ + Tab = Tab->PrevTab; } /* Not found */ @@ -486,22 +486,22 @@ SymEntry* FindStructField (const Type* T, const char* Name) /* The given type may actually be a pointer to struct */ if (IsTypePtr (T)) { - ++T; + ++T; } /* Non-structs do not have any struct fields... */ if (IsClassStruct (T)) { - /* Get a pointer to the struct/union type */ - const SymEntry* Struct = GetSymEntry (T); - CHECK (Struct != 0); + /* Get a pointer to the struct/union type */ + const SymEntry* Struct = GetSymEntry (T); + CHECK (Struct != 0); - /* Now search in the struct symbol table. Beware: The table may not + /* Now search in the struct symbol table. Beware: The table may not * exist. - */ - if (Struct->V.S.SymTab) { - Field = FindSymInTable (Struct->V.S.SymTab, Name, HashStr (Name)); - } + */ + if (Struct->V.S.SymTab) { + Field = FindSymInTable (Struct->V.S.SymTab, Name, HashStr (Name)); + } } return Field; @@ -510,7 +510,7 @@ SymEntry* FindStructField (const Type* T, const char* Name) /*****************************************************************************/ -/* Add stuff to the symbol table */ +/* Add stuff to the symbol table */ /*****************************************************************************/ @@ -523,13 +523,13 @@ static void AddSymEntry (SymTable* T, SymEntry* S) /* Insert the symbol into the list of all symbols in this level */ if (T->SymTail) { - T->SymTail->NextSym = S; + T->SymTail->NextSym = S; } S->PrevSym = T->SymTail; T->SymTail = S; if (T->SymHead == 0) { - /* First symbol */ - T->SymHead = S; + /* First symbol */ + T->SymHead = S; } ++T->SymCount; @@ -555,32 +555,32 @@ SymEntry* AddStructSym (const char* Name, unsigned Type, unsigned Size, SymTable Entry = FindSymInTable (TagTab, Name, HashStr (Name)); if (Entry) { - /* We do have an entry. This may be a forward, so check it. */ - if ((Entry->Flags & SC_TYPEMASK) != Type) { - /* Existing symbol is not a struct */ - Error ("Symbol `%s' is already different kind", Name); - } else if (Size > 0 && Entry->V.S.Size > 0) { - /* Both structs are definitions. */ - Error ("Multiple definition for `%s'", Name); - } else { - /* Define the struct size if it is given */ - if (Size > 0) { - Entry->V.S.SymTab = Tab; - Entry->V.S.Size = Size; - } - } + /* We do have an entry. This may be a forward, so check it. */ + if ((Entry->Flags & SC_TYPEMASK) != Type) { + /* Existing symbol is not a struct */ + Error ("Symbol `%s' is already different kind", Name); + } else if (Size > 0 && Entry->V.S.Size > 0) { + /* Both structs are definitions. */ + Error ("Multiple definition for `%s'", Name); + } else { + /* Define the struct size if it is given */ + if (Size > 0) { + Entry->V.S.SymTab = Tab; + Entry->V.S.Size = Size; + } + } } else { - /* Create a new entry */ - Entry = NewSymEntry (Name, Type); + /* Create a new entry */ + Entry = NewSymEntry (Name, Type); - /* Set the struct data */ - Entry->V.S.SymTab = Tab; - Entry->V.S.Size = Size; + /* Set the struct data */ + Entry->V.S.SymTab = Tab; + Entry->V.S.Size = Size; - /* Add it to the current table */ - AddSymEntry (TagTab, Entry); + /* Add it to the current table */ + AddSymEntry (TagTab, Entry); } /* Return the entry */ @@ -596,22 +596,22 @@ SymEntry* AddBitField (const char* Name, unsigned Offs, unsigned BitOffs, unsign SymEntry* Entry = FindSymInTable (SymTab, Name, HashStr (Name)); if (Entry) { - /* We have a symbol with this name already */ - Error ("Multiple definition for `%s'", Name); + /* We have a symbol with this name already */ + Error ("Multiple definition for `%s'", Name); } else { - /* Create a new entry */ - Entry = NewSymEntry (Name, SC_BITFIELD); + /* Create a new entry */ + Entry = NewSymEntry (Name, SC_BITFIELD); - /* Set the symbol attributes. Bit-fields are always of type unsigned */ - Entry->Type = type_uint; + /* Set the symbol attributes. Bit-fields are always of type unsigned */ + Entry->Type = type_uint; Entry->V.B.Offs = Offs; Entry->V.B.BitOffs = BitOffs; Entry->V.B.BitWidth = Width; - /* Add the entry to the symbol table */ - AddSymEntry (SymTab, Entry); + /* Add the entry to the symbol table */ + AddSymEntry (SymTab, Entry); } @@ -630,19 +630,19 @@ SymEntry* AddConstSym (const char* Name, const Type* T, unsigned Flags, long Val /* Do we have an entry with this name already? */ SymEntry* Entry = FindSymInTable (Tab, Name, HashStr (Name)); if (Entry) { - if ((Entry->Flags & SC_CONST) != SC_CONST) { - Error ("Symbol `%s' is already different kind", Name); - } else { - Error ("Multiple definition for `%s'", Name); - } - return Entry; + if ((Entry->Flags & SC_CONST) != SC_CONST) { + Error ("Symbol `%s' is already different kind", Name); + } else { + Error ("Multiple definition for `%s'", Name); + } + return Entry; } /* Create a new entry */ Entry = NewSymEntry (Name, Flags); /* Enum values are ints */ - Entry->Type = TypeDup (T); + Entry->Type = TypeDup (T); /* Set the enum data */ Entry->V.ConstVal = Val; @@ -663,25 +663,25 @@ SymEntry* AddLabelSym (const char* Name, unsigned Flags) SymEntry* Entry = FindSymInTable (LabelTab, Name, HashStr (Name)); if (Entry) { - if (SymIsDef (Entry) && (Flags & SC_DEF) != 0) { - /* Trying to define the label more than once */ - Error ("Label `%s' is defined more than once", Name); - } - Entry->Flags |= Flags; + if (SymIsDef (Entry) && (Flags & SC_DEF) != 0) { + /* Trying to define the label more than once */ + Error ("Label `%s' is defined more than once", Name); + } + Entry->Flags |= Flags; } else { - /* Create a new entry */ - Entry = NewSymEntry (Name, SC_LABEL | Flags); + /* Create a new entry */ + Entry = NewSymEntry (Name, SC_LABEL | Flags); - /* Set a new label number */ - Entry->V.Label = GetLocalLabel (); + /* Set a new label number */ + Entry->V.Label = GetLocalLabel (); /* Generate the assembler name of the label */ Entry->AsmName = xstrdup (LocalLabelName (Entry->V.Label)); - /* Add the entry to the label table */ - AddSymEntry (LabelTab, Entry); + /* Add the entry to the label table */ + AddSymEntry (LabelTab, Entry); } @@ -698,16 +698,16 @@ SymEntry* AddLocalSym (const char* Name, const Type* T, unsigned Flags, int Offs SymEntry* Entry = FindSymInTable (SymTab, Name, HashStr (Name)); if (Entry) { - /* We have a symbol with this name already */ - Error ("Multiple definition for `%s'", Name); + /* We have a symbol with this name already */ + Error ("Multiple definition for `%s'", Name); } else { - /* Create a new entry */ - Entry = NewSymEntry (Name, Flags); + /* Create a new entry */ + Entry = NewSymEntry (Name, Flags); - /* Set the symbol attributes */ - Entry->Type = TypeDup (T); + /* Set the symbol attributes */ + Entry->Type = TypeDup (T); if ((Flags & SC_AUTO) == SC_AUTO) { Entry->V.Offs = Offs; } else if ((Flags & SC_REGISTER) == SC_REGISTER) { @@ -726,8 +726,8 @@ SymEntry* AddLocalSym (const char* Name, const Type* T, unsigned Flags, int Offs Internal ("Invalid flags in AddLocalSym: %04X", Flags); } - /* Add the entry to the symbol table */ - AddSymEntry (SymTab, Entry); + /* Add the entry to the symbol table */ + AddSymEntry (SymTab, Entry); } @@ -750,90 +750,90 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned Flags) SymEntry* Entry = FindSymInTable (Tab, Name, HashStr (Name)); if (Entry) { - Type* EType; + Type* EType; - /* We have a symbol with this name already */ - if (Entry->Flags & SC_TYPE) { - Error ("Multiple definition for `%s'", Name); - return Entry; - } + /* We have a symbol with this name already */ + if (Entry->Flags & SC_TYPE) { + Error ("Multiple definition for `%s'", Name); + return Entry; + } - /* Get the type string of the existing symbol */ - EType = Entry->Type; + /* Get the type string of the existing symbol */ + EType = Entry->Type; - /* If we are handling arrays, the old entry or the new entry may be an - * incomplete declaration. Accept this, and if the exsting entry is - * incomplete, complete it. - */ - if (IsTypeArray (T) && IsTypeArray (EType)) { + /* If we are handling arrays, the old entry or the new entry may be an + * incomplete declaration. Accept this, and if the exsting entry is + * incomplete, complete it. + */ + if (IsTypeArray (T) && IsTypeArray (EType)) { - /* Get the array sizes */ - long Size = GetElementCount (T); - long ESize = GetElementCount (EType); + /* Get the array sizes */ + long Size = GetElementCount (T); + long ESize = GetElementCount (EType); - if ((Size != UNSPECIFIED && ESize != UNSPECIFIED && Size != ESize) || - TypeCmp (T + 1, EType + 1) < TC_EQUAL) { - /* Types not identical: Conflicting types */ - Error ("Conflicting types for `%s'", Name); - return Entry; - } else { - /* Check if we have a size in the existing definition */ - if (ESize == UNSPECIFIED) { - /* Existing, size not given, use size from new def */ - SetElementCount (EType, Size); - } - } + if ((Size != UNSPECIFIED && ESize != UNSPECIFIED && Size != ESize) || + TypeCmp (T + 1, EType + 1) < TC_EQUAL) { + /* Types not identical: Conflicting types */ + Error ("Conflicting types for `%s'", Name); + return Entry; + } else { + /* Check if we have a size in the existing definition */ + if (ESize == UNSPECIFIED) { + /* Existing, size not given, use size from new def */ + SetElementCount (EType, Size); + } + } - } else { - /* New type must be identical */ - if (TypeCmp (EType, T) < TC_EQUAL) { - Error ("Conflicting types for `%s'", Name); - return Entry; - } + } else { + /* New type must be identical */ + if (TypeCmp (EType, T) < TC_EQUAL) { + Error ("Conflicting types for `%s'", Name); + return Entry; + } - /* In case of a function, use the new type descriptor, since it - * contains pointers to the new symbol tables that are needed if - * an actual function definition follows. Be sure not to use the + /* In case of a function, use the new type descriptor, since it + * contains pointers to the new symbol tables that are needed if + * an actual function definition follows. Be sure not to use the * new descriptor if it contains a function declaration with an * empty parameter list. - */ - if (IsFunc) { - /* Get the function descriptor from the new type */ - FuncDesc* F = GetFuncDesc (T); - /* Use this new function descriptor if it doesn't contain + */ + if (IsFunc) { + /* Get the function descriptor from the new type */ + FuncDesc* F = GetFuncDesc (T); + /* Use this new function descriptor if it doesn't contain * an empty parameter list. */ if ((F->Flags & FD_EMPTY) == 0) { Entry->V.F.Func = F; SetFuncDesc (EType, F); } - } - } + } + } - /* Add the new flags */ - Entry->Flags |= Flags; + /* Add the new flags */ + Entry->Flags |= Flags; } else { - /* Create a new entry */ - Entry = NewSymEntry (Name, Flags); + /* Create a new entry */ + Entry = NewSymEntry (Name, Flags); - /* Set the symbol attributes */ - Entry->Type = TypeDup (T); + /* Set the symbol attributes */ + Entry->Type = TypeDup (T); - /* If this is a function, set the function descriptor and clear - * additional fields. - */ - if (IsFunc) { - Entry->V.F.Func = GetFuncDesc (Entry->Type); - Entry->V.F.Seg = 0; - } + /* If this is a function, set the function descriptor and clear + * additional fields. + */ + if (IsFunc) { + Entry->V.F.Func = GetFuncDesc (Entry->Type); + Entry->V.F.Seg = 0; + } /* Add the assembler name of the symbol */ SymSetAsmName (Entry); - /* Add the entry to the symbol table */ - AddSymEntry (Tab, Entry); + /* Add the entry to the symbol table */ + AddSymEntry (Tab, Entry); } /* Return the entry */ @@ -843,7 +843,7 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned Flags) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -880,9 +880,9 @@ void MakeZPSym (const char* Name) /* Mark the symbol as zeropage */ if (Entry) { - Entry->Flags |= SC_ZEROPAGE; + Entry->Flags |= SC_ZEROPAGE; } else { - Error ("Undefined symbol: `%s'", Name); + Error ("Undefined symbol: `%s'", Name); } } @@ -904,19 +904,19 @@ void PrintSymTable (const SymTable* Tab, FILE* F, const char* Header, ...) /* Underline the header */ while (Len--) { - fputc ('=', F); + fputc ('=', F); } fputc ('\n', F); /* Dump the table */ Entry = Tab->SymHead; if (Entry == 0) { - fprintf (F, "(empty)\n"); + fprintf (F, "(empty)\n"); } else { - while (Entry) { - DumpSymEntry (F, Entry); - Entry = Entry->NextSym; - } + while (Entry) { + DumpSymEntry (F, Entry); + Entry = Entry->NextSym; + } } fprintf (F, "\n\n\n"); } @@ -930,18 +930,18 @@ void EmitExternals (void) Entry = SymTab->SymHead; while (Entry) { - unsigned Flags = Entry->Flags; - if (Flags & SC_EXTERN) { - /* Only defined or referenced externs */ - if (SymIsRef (Entry) && !SymIsDef (Entry)) { - /* An import */ - g_defimport (Entry->Name, Flags & SC_ZEROPAGE); - } else if (SymIsDef (Entry)) { - /* An export */ - g_defexport (Entry->Name, Flags & SC_ZEROPAGE); - } - } - Entry = Entry->NextSym; + unsigned Flags = Entry->Flags; + if (Flags & SC_EXTERN) { + /* Only defined or referenced externs */ + if (SymIsRef (Entry) && !SymIsDef (Entry)) { + /* An import */ + g_defimport (Entry->Name, Flags & SC_ZEROPAGE); + } else if (SymIsDef (Entry)) { + /* An export */ + g_defexport (Entry->Name, Flags & SC_ZEROPAGE); + } + } + Entry = Entry->NextSym; } } diff --git a/src/cc65/symtab.h b/src/cc65/symtab.h index 66216313c..154dce55a 100644 --- a/src/cc65/symtab.h +++ b/src/cc65/symtab.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* symtab.h */ +/* symtab.h */ /* */ -/* Symbol table management for the cc65 C compiler */ +/* Symbol table management for the cc65 C compiler */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -54,28 +54,28 @@ /* Symbol table */ typedef struct SymTable SymTable; struct SymTable { - SymTable* PrevTab; /* Pointer to higher level symbol table */ - SymEntry* SymHead; /* Double linked list of symbols */ - SymEntry* SymTail; /* Double linked list of symbols */ - unsigned SymCount; /* Count of symbols in this table */ - unsigned Size; /* Size of table */ - SymEntry* Tab[1]; /* Actual table, dynamically allocated */ + SymTable* PrevTab; /* Pointer to higher level symbol table */ + SymEntry* SymHead; /* Double linked list of symbols */ + SymEntry* SymTail; /* Double linked list of symbols */ + unsigned SymCount; /* Count of symbols in this table */ + unsigned Size; /* Size of table */ + SymEntry* Tab[1]; /* Actual table, dynamically allocated */ }; /* An empty symbol table */ -extern SymTable EmptySymTab; +extern SymTable EmptySymTab; /* Forwards */ struct FuncDesc; /* Predefined lexical levels */ -#define LEX_LEVEL_GLOBAL 1U +#define LEX_LEVEL_GLOBAL 1U #define LEX_LEVEL_FUNCTION 2U /*****************************************************************************/ -/* Handling of lexical levels */ +/* Handling of lexical levels */ /*****************************************************************************/ @@ -116,7 +116,7 @@ void LeaveStructLevel (void); /*****************************************************************************/ -/* Find functions */ +/* Find functions */ /*****************************************************************************/ @@ -139,7 +139,7 @@ SymEntry* FindStructField (const Type* TypeArray, const char* Name); /*****************************************************************************/ -/* Add stuff to the symbol table */ +/* Add stuff to the symbol table */ /*****************************************************************************/ @@ -165,7 +165,7 @@ SymEntry* AddGlobalSym (const char* Name, const Type* T, unsigned Flags); /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/testexpr.c b/src/cc65/testexpr.c index 5b2ae3d02..f95c94dd8 100644 --- a/src/cc65/testexpr.c +++ b/src/cc65/testexpr.c @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -67,13 +67,13 @@ unsigned Test (unsigned Label, int Invert) /* Result is constant, so we know the outcome */ Result = (Expr.IVal != 0); - /* Constant rvalue */ - if (!Invert && Expr.IVal == 0) { - g_jump (Label); - Warning ("Unreachable code"); - } else if (Invert && Expr.IVal != 0) { - g_jump (Label); - } + /* Constant rvalue */ + if (!Invert && Expr.IVal == 0) { + g_jump (Label); + Warning ("Unreachable code"); + } else if (Invert && Expr.IVal != 0) { + g_jump (Label); + } } else { diff --git a/src/cc65/testexpr.h b/src/cc65/testexpr.h index 20585417a..bfc033185 100644 --- a/src/cc65/testexpr.h +++ b/src/cc65/testexpr.h @@ -51,7 +51,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/textseg.c b/src/cc65/textseg.c index 172a1c450..2275261e0 100644 --- a/src/cc65/textseg.c +++ b/src/cc65/textseg.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* textseg.c */ +/* textseg.c */ /* */ -/* Text segment structure */ +/* Text segment structure */ /* */ /* */ /* */ @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -59,10 +59,10 @@ TextSeg* NewTextSeg (SymEntry* Func) /* Create a new text segment, initialize and return it */ { /* Allocate memory for the structure */ - TextSeg* S = xmalloc (sizeof (TextSeg)); + TextSeg* S = xmalloc (sizeof (TextSeg)); /* Initialize the fields */ - S->Func = Func; + S->Func = Func; InitCollection (&S->Lines); /* Return the new struct */ @@ -105,7 +105,7 @@ void TS_Output (const TextSeg* S) /* If the segment is actually empty, bail out */ if (Count == 0) { - return; + return; } /* Output all entries */ diff --git a/src/cc65/textseg.h b/src/cc65/textseg.h index 7aa53a3e0..1c3aba53b 100644 --- a/src/cc65/textseg.h +++ b/src/cc65/textseg.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* textseg.h */ +/* textseg.h */ /* */ -/* Text segment structure */ +/* Text segment structure */ /* */ /* */ /* */ @@ -56,21 +56,21 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ typedef struct TextSeg TextSeg; struct TextSeg { - SymEntry* Func; /* Owner function */ - Collection Lines; /* List of text lines */ + SymEntry* Func; /* Owner function */ + Collection Lines; /* List of text lines */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/typecmp.c b/src/cc65/typecmp.c index 6afc6698f..139b3b3ff 100644 --- a/src/cc65/typecmp.c +++ b/src/cc65/typecmp.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* typecmp.c */ +/* typecmp.c */ /* */ -/* Type compare function for the cc65 C compiler */ +/* Type compare function for the cc65 C compiler */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -53,7 +53,7 @@ static void SetResult (typecmp_t* Result, typecmp_t Val) { if (Val < *Result) { /* printf ("SetResult = %d\n", Val); */ - *Result = Val; + *Result = Val; } } @@ -83,8 +83,8 @@ static int ParamsHaveDefaultPromotions (const FuncDesc* F) } } - /* Get the pointer to the next param */ - Sym = Sym->NextSym; + /* Get the pointer to the next param */ + Sym = Sym->NextSym; } /* No default promotions in the parameter list */ @@ -127,22 +127,22 @@ static int EqualFuncParams (const FuncDesc* F1, const FuncDesc* F2) } } - /* Compare this field */ - if (TypeCmp (Type1, Type2) < TC_EQUAL) { - /* Field types not equal */ - return 0; - } + /* Compare this field */ + if (TypeCmp (Type1, Type2) < TC_EQUAL) { + /* Field types not equal */ + return 0; + } - /* Get the pointers to the next fields */ - Sym1 = Sym1->NextSym; - Sym2 = Sym2->NextSym; + /* Get the pointers to the next fields */ + Sym1 = Sym1->NextSym; + Sym2 = Sym2->NextSym; } /* Check both pointers against NULL or a non parameter to compare the * field count */ return (Sym1 == 0 || (Sym1->Flags & SC_PARAM) == 0) && - (Sym2 == 0 || (Sym2->Flags & SC_PARAM) == 0); + (Sym2 == 0 || (Sym2->Flags & SC_PARAM) == 0); } @@ -157,7 +157,7 @@ static int EqualSymTables (SymTable* Tab1, SymTable* Tab2) /* Compare the fields */ while (Sym1 && Sym2) { - /* Compare the names of this field */ + /* Compare the names of this field */ if (!HasAnonName (Sym1) || !HasAnonName (Sym2)) { if (strcmp (Sym1->Name, Sym2->Name) != 0) { /* Names are not identical */ @@ -166,14 +166,14 @@ static int EqualSymTables (SymTable* Tab1, SymTable* Tab2) } /* Compare the types of this field */ - if (TypeCmp (Sym1->Type, Sym2->Type) < TC_EQUAL) { - /* Field types not equal */ - return 0; - } + if (TypeCmp (Sym1->Type, Sym2->Type) < TC_EQUAL) { + /* Field types not equal */ + return 0; + } - /* Get the pointers to the next fields */ - Sym1 = Sym1->NextSym; - Sym2 = Sym2->NextSym; + /* Get the pointers to the next fields */ + Sym1 = Sym1->NextSym; + Sym2 = Sym2->NextSym; } /* Check both pointers against NULL to compare the field count */ @@ -185,14 +185,14 @@ static int EqualSymTables (SymTable* Tab1, SymTable* Tab2) static void DoCompare (const Type* lhs, const Type* rhs, typecmp_t* Result) /* Recursively compare two types. */ { - unsigned Indirections; - unsigned ElementCount; - SymEntry* Sym1; - SymEntry* Sym2; - SymTable* Tab1; - SymTable* Tab2; - FuncDesc* F1; - FuncDesc* F2; + unsigned Indirections; + unsigned ElementCount; + SymEntry* Sym1; + SymEntry* Sym2; + SymTable* Tab1; + SymTable* Tab2; + FuncDesc* F1; + FuncDesc* F2; /* Initialize stuff */ @@ -202,93 +202,93 @@ static void DoCompare (const Type* lhs, const Type* rhs, typecmp_t* Result) /* Compare two types. Determine, where they differ */ while (lhs->C != T_END) { - TypeCode LeftType, RightType; - TypeCode LeftSign, RightSign; - TypeCode LeftQual, RightQual; - long LeftCount, RightCount; + TypeCode LeftType, RightType; + TypeCode LeftSign, RightSign; + TypeCode LeftQual, RightQual; + long LeftCount, RightCount; - /* Check if the end of the type string is reached */ - if (rhs->C == T_END) { - /* End of comparison reached */ - return; - } + /* Check if the end of the type string is reached */ + if (rhs->C == T_END) { + /* End of comparison reached */ + return; + } - /* Get the raw left and right types, signs and qualifiers */ - LeftType = GetType (lhs); - RightType = GetType (rhs); - LeftSign = GetSignedness (lhs); - RightSign = GetSignedness (rhs); - LeftQual = GetQualifier (lhs); - RightQual = GetQualifier (rhs); + /* Get the raw left and right types, signs and qualifiers */ + LeftType = GetType (lhs); + RightType = GetType (rhs); + LeftSign = GetSignedness (lhs); + RightSign = GetSignedness (rhs); + LeftQual = GetQualifier (lhs); + RightQual = GetQualifier (rhs); - /* If the left type is a pointer and the right is an array, both - * are compatible. - */ - if (LeftType == T_TYPE_PTR && RightType == T_TYPE_ARRAY) { - RightType = T_TYPE_PTR; - } + /* If the left type is a pointer and the right is an array, both + * are compatible. + */ + if (LeftType == T_TYPE_PTR && RightType == T_TYPE_ARRAY) { + RightType = T_TYPE_PTR; + } - /* If the raw types are not identical, the types are incompatible */ - if (LeftType != RightType) { - SetResult (Result, TC_INCOMPATIBLE); - return; - } + /* If the raw types are not identical, the types are incompatible */ + if (LeftType != RightType) { + SetResult (Result, TC_INCOMPATIBLE); + return; + } - /* On indirection level zero, a qualifier or sign difference is - * accepted. The types are no longer equal, but compatible. - */ - if (LeftSign != RightSign) { - if (ElementCount == 0) { - SetResult (Result, TC_SIGN_DIFF); - } else { - SetResult (Result, TC_INCOMPATIBLE); - return; - } - } - if (LeftQual != RightQual) { - /* On the first indirection level, different qualifiers mean - * that the types are still compatible. On the second level, - * this is a (maybe minor) error, so we create a special - * return code, since a qualifier is dropped from a pointer. - * Starting from the next level, the types are incompatible - * if the qualifiers differ. - */ + /* On indirection level zero, a qualifier or sign difference is + * accepted. The types are no longer equal, but compatible. + */ + if (LeftSign != RightSign) { + if (ElementCount == 0) { + SetResult (Result, TC_SIGN_DIFF); + } else { + SetResult (Result, TC_INCOMPATIBLE); + return; + } + } + if (LeftQual != RightQual) { + /* On the first indirection level, different qualifiers mean + * that the types are still compatible. On the second level, + * this is a (maybe minor) error, so we create a special + * return code, since a qualifier is dropped from a pointer. + * Starting from the next level, the types are incompatible + * if the qualifiers differ. + */ /* printf ("Ind = %d %06X != %06X\n", Indirections, LeftQual, RightQual); */ - switch (Indirections) { + switch (Indirections) { - case 0: - SetResult (Result, TC_STRICT_COMPATIBLE); - break; + case 0: + SetResult (Result, TC_STRICT_COMPATIBLE); + break; - case 1: - /* A non const value on the right is compatible to a - * const one to the left, same for volatile. - */ - if ((LeftQual & T_QUAL_CONST) < (RightQual & T_QUAL_CONST) || - (LeftQual & T_QUAL_VOLATILE) < (RightQual & T_QUAL_VOLATILE)) { - SetResult (Result, TC_QUAL_DIFF); - } else { - SetResult (Result, TC_STRICT_COMPATIBLE); - } - break; + case 1: + /* A non const value on the right is compatible to a + * const one to the left, same for volatile. + */ + if ((LeftQual & T_QUAL_CONST) < (RightQual & T_QUAL_CONST) || + (LeftQual & T_QUAL_VOLATILE) < (RightQual & T_QUAL_VOLATILE)) { + SetResult (Result, TC_QUAL_DIFF); + } else { + SetResult (Result, TC_STRICT_COMPATIBLE); + } + break; - default: - SetResult (Result, TC_INCOMPATIBLE); - return; - } - } + default: + SetResult (Result, TC_INCOMPATIBLE); + return; + } + } - /* Check for special type elements */ - switch (LeftType) { + /* Check for special type elements */ + switch (LeftType) { - case T_TYPE_PTR: - ++Indirections; - break; + case T_TYPE_PTR: + ++Indirections; + break; - case T_TYPE_FUNC: - /* Compare the function descriptors */ - F1 = GetFuncDesc (lhs); - F2 = GetFuncDesc (rhs); + case T_TYPE_FUNC: + /* Compare the function descriptors */ + F1 = GetFuncDesc (lhs); + F2 = GetFuncDesc (rhs); /* If one of both functions has an empty parameter list (which * does also mean, it is not a function definition, because the @@ -314,44 +314,44 @@ static void DoCompare (const Type* lhs, const Type* rhs, typecmp_t* Result) } } else { - /* Check the remaining flags */ - if ((F1->Flags & ~FD_IGNORE) != (F2->Flags & ~FD_IGNORE)) { - /* Flags differ */ - SetResult (Result, TC_INCOMPATIBLE); - return; - } + /* Check the remaining flags */ + if ((F1->Flags & ~FD_IGNORE) != (F2->Flags & ~FD_IGNORE)) { + /* Flags differ */ + SetResult (Result, TC_INCOMPATIBLE); + return; + } - /* Compare the parameter lists */ - if (EqualFuncParams (F1, F2) == 0) { - /* Parameter list is not identical */ - SetResult (Result, TC_INCOMPATIBLE); - return; - } - } + /* Compare the parameter lists */ + if (EqualFuncParams (F1, F2) == 0) { + /* Parameter list is not identical */ + SetResult (Result, TC_INCOMPATIBLE); + return; + } + } - /* Keep on and compare the return type */ - break; + /* Keep on and compare the return type */ + break; - case T_TYPE_ARRAY: - /* Check member count */ - LeftCount = GetElementCount (lhs); - RightCount = GetElementCount (rhs); - if (LeftCount != UNSPECIFIED && + case T_TYPE_ARRAY: + /* Check member count */ + LeftCount = GetElementCount (lhs); + RightCount = GetElementCount (rhs); + if (LeftCount != UNSPECIFIED && RightCount != UNSPECIFIED && LeftCount != RightCount) { - /* Member count given but different */ - SetResult (Result, TC_INCOMPATIBLE); - return; - } - break; + /* Member count given but different */ + SetResult (Result, TC_INCOMPATIBLE); + return; + } + break; - case T_TYPE_STRUCT: - case T_TYPE_UNION: - /* Compare the fields recursively. To do that, we fetch the - * pointer to the struct definition from the type, and compare - * the fields. - */ - Sym1 = GetSymEntry (lhs); + case T_TYPE_STRUCT: + case T_TYPE_UNION: + /* Compare the fields recursively. To do that, we fetch the + * pointer to the struct definition from the type, and compare + * the fields. + */ + Sym1 = GetSymEntry (lhs); Sym2 = GetSymEntry (rhs); /* If one symbol has a name, the names must be identical */ @@ -363,39 +363,39 @@ static void DoCompare (const Type* lhs, const Type* rhs, typecmp_t* Result) } } - /* Get the field tables from the struct entry */ - Tab1 = Sym1->V.S.SymTab; - Tab2 = Sym2->V.S.SymTab; + /* Get the field tables from the struct entry */ + Tab1 = Sym1->V.S.SymTab; + Tab2 = Sym2->V.S.SymTab; - /* One or both structs may be forward definitions. In this case, - * the symbol tables are both non existant. Assume that the - * structs are equal in this case. - */ - if (Tab1 != 0 && Tab2 != 0) { + /* One or both structs may be forward definitions. In this case, + * the symbol tables are both non existant. Assume that the + * structs are equal in this case. + */ + if (Tab1 != 0 && Tab2 != 0) { - if (EqualSymTables (Tab1, Tab2) == 0) { - /* Field lists are not equal */ - SetResult (Result, TC_INCOMPATIBLE); - return; - } + if (EqualSymTables (Tab1, Tab2) == 0) { + /* Field lists are not equal */ + SetResult (Result, TC_INCOMPATIBLE); + return; + } - } + } - /* Structs are equal */ - break; - } + /* Structs are equal */ + break; + } - /* Next type string element */ - ++lhs; - ++rhs; - ++ElementCount; + /* Next type string element */ + ++lhs; + ++rhs; + ++ElementCount; } /* Check if end of rhs reached */ if (rhs->C == T_END) { - SetResult (Result, TC_EQUAL); + SetResult (Result, TC_EQUAL); } else { - SetResult (Result, TC_INCOMPATIBLE); + SetResult (Result, TC_INCOMPATIBLE); } } @@ -405,7 +405,7 @@ typecmp_t TypeCmp (const Type* lhs, const Type* rhs) /* Compare two types and return the result */ { /* Assume the types are identical */ - typecmp_t Result = TC_IDENTICAL; + typecmp_t Result = TC_IDENTICAL; #if 0 printf ("Left : "); PrintRawType (stdout, lhs); @@ -414,7 +414,7 @@ typecmp_t TypeCmp (const Type* lhs, const Type* rhs) /* Recursively compare the types if they aren't identical */ if (rhs != lhs) { - DoCompare (lhs, rhs, &Result); + DoCompare (lhs, rhs, &Result); } /* Return the result */ diff --git a/src/cc65/typecmp.h b/src/cc65/typecmp.h index 6ccaa3371..652585738 100644 --- a/src/cc65/typecmp.h +++ b/src/cc65/typecmp.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* typecmp.h */ +/* typecmp.h */ /* */ -/* Type compare function for the cc65 C compiler */ +/* Type compare function for the cc65 C compiler */ /* */ /* */ /* */ @@ -43,26 +43,26 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Degree of type compatibility. Must be in ascending order */ typedef enum { - TC_INCOMPATIBLE, /* Distinct types */ - TC_SIGN_DIFF, /* Signedness differs */ + TC_INCOMPATIBLE, /* Distinct types */ + TC_SIGN_DIFF, /* Signedness differs */ TC_COMPATIBLE = TC_SIGN_DIFF, /* Compatible types */ - TC_QUAL_DIFF, /* Types differ in qualifier of pointer */ - TC_STRICT_COMPATIBLE, /* Strict compatibility */ - TC_EQUAL, /* Types are equal */ - TC_IDENTICAL /* Types are identical */ + TC_QUAL_DIFF, /* Types differ in qualifier of pointer */ + TC_STRICT_COMPATIBLE, /* Strict compatibility */ + TC_EQUAL, /* Types are equal */ + TC_IDENTICAL /* Types are identical */ } typecmp_t; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/typeconv.c b/src/cc65/typeconv.c index ecde7349f..6d50aa5c6 100644 --- a/src/cc65/typeconv.c +++ b/src/cc65/typeconv.c @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -180,10 +180,10 @@ void TypeConversion (ExprDesc* Expr, Type* NewType) /* First, do some type checking */ if (IsTypeVoid (NewType) || IsTypeVoid (Expr->Type)) { - /* If one of the sides are of type void, output a more apropriate - * error message. - */ - Error ("Illegal type"); + /* If one of the sides are of type void, output a more apropriate + * error message. + */ + Error ("Illegal type"); } /* If Expr is a function, convert it to pointer to function */ @@ -201,15 +201,15 @@ void TypeConversion (ExprDesc* Expr, Type* NewType) if (IsClassInt (NewType)) { /* Handle conversions to int type */ - if (IsClassPtr (Expr->Type)) { - /* Pointer -> int conversion. Convert array to pointer */ + if (IsClassPtr (Expr->Type)) { + /* Pointer -> int conversion. Convert array to pointer */ if (IsTypeArray (Expr->Type)) { Expr->Type = ArrayToPtr (Expr->Type); } - Warning ("Converting pointer to integer without a cast"); - } else if (!IsClassInt (Expr->Type) && !IsClassFloat (Expr->Type)) { - Error ("Incompatible types"); - } + Warning ("Converting pointer to integer without a cast"); + } else if (!IsClassInt (Expr->Type) && !IsClassFloat (Expr->Type)) { + Error ("Incompatible types"); + } } else if (IsClassFloat (NewType)) { @@ -220,44 +220,44 @@ void TypeConversion (ExprDesc* Expr, Type* NewType) } else if (IsClassPtr (NewType)) { /* Handle conversions to pointer type */ - if (IsClassPtr (Expr->Type)) { + if (IsClassPtr (Expr->Type)) { /* Convert array to pointer */ if (IsTypeArray (Expr->Type)) { Expr->Type = ArrayToPtr (Expr->Type); } - /* Pointer to pointer assignment is valid, if: - * - both point to the same types, or - * - the rhs pointer is a void pointer, or - * - the lhs pointer is a void pointer. - */ - if (!IsTypeVoid (Indirect (NewType)) && !IsTypeVoid (Indirect (Expr->Type))) { - /* Compare the types */ + /* Pointer to pointer assignment is valid, if: + * - both point to the same types, or + * - the rhs pointer is a void pointer, or + * - the lhs pointer is a void pointer. + */ + if (!IsTypeVoid (Indirect (NewType)) && !IsTypeVoid (Indirect (Expr->Type))) { + /* Compare the types */ switch (TypeCmp (NewType, Expr->Type)) { - case TC_INCOMPATIBLE: - Error ("Incompatible pointer types"); - break; + case TC_INCOMPATIBLE: + Error ("Incompatible pointer types"); + break; - case TC_QUAL_DIFF: - Error ("Pointer types differ in type qualifiers"); - break; + case TC_QUAL_DIFF: + Error ("Pointer types differ in type qualifiers"); + break; - default: - /* Ok */ - break; - } - } + default: + /* Ok */ + break; + } + } - } else if (IsClassInt (Expr->Type)) { - /* Int to pointer assignment is valid only for constant zero */ - if (!ED_IsConstAbsInt (Expr) || Expr->IVal != 0) { - Warning ("Converting integer to pointer without a cast"); - } - } else { - Error ("Incompatible types"); - } + } else if (IsClassInt (Expr->Type)) { + /* Int to pointer assignment is valid only for constant zero */ + if (!ED_IsConstAbsInt (Expr) || Expr->IVal != 0) { + Warning ("Converting integer to pointer without a cast"); + } + } else { + Error ("Incompatible types"); + } } else { diff --git a/src/cc65/typeconv.h b/src/cc65/typeconv.h index cab6fc0ec..2407862e1 100644 --- a/src/cc65/typeconv.h +++ b/src/cc65/typeconv.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cc65/util.c b/src/cc65/util.c index 07586ccf1..db26dd7d2 100644 --- a/src/cc65/util.c +++ b/src/cc65/util.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* util.c */ +/* util.c */ /* */ -/* Utility functions for the cc65 C compiler */ +/* Utility functions for the cc65 C compiler */ /* */ /* */ /* */ @@ -38,7 +38,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -52,10 +52,10 @@ int PowerOf2 (unsigned long Val) unsigned long Mask = 0x0001; for (I = 0; I < 32; ++I) { - if (Val == Mask) { - return I; - } - Mask <<= 1; + if (Val == Mask) { + return I; + } + Mask <<= 1; } return -1; } diff --git a/src/cc65/util.h b/src/cc65/util.h index 8cb516a8f..9fc717339 100644 --- a/src/cc65/util.h +++ b/src/cc65/util.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* util.h */ +/* util.h */ /* */ -/* Utility functions for the cc65 C compiler */ +/* Utility functions for the cc65 C compiler */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/chrcvt/error.c b/src/chrcvt/error.c index 310688f07..424080d83 100644 --- a/src/chrcvt/error.c +++ b/src/chrcvt/error.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* error.c */ +/* error.c */ /* */ /* Error handling for the chrcvt vector font converter */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/chrcvt/error.h b/src/chrcvt/error.h index de1390bfc..93f59ccfd 100644 --- a/src/chrcvt/error.h +++ b/src/chrcvt/error.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* error.h */ +/* error.h */ /* */ /* Error handling for the chrcvt vector font converter */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/chrcvt/main.c b/src/chrcvt/main.c index 8cc32cc88..bec905142 100644 --- a/src/chrcvt/main.c +++ b/src/chrcvt/main.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* main.c */ +/* main.c */ /* */ /* Main program of the chrcvt vector font converter */ /* */ @@ -161,7 +161,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -171,7 +171,7 @@ static unsigned FilesProcessed = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -180,23 +180,23 @@ static void Usage (void) /* Print usage information and exit */ { fprintf (stderr, - "Usage: %s [options] file [options] [file]\n" - "Short options:\n" - " -h\t\t\tHelp (this text)\n" + "Usage: %s [options] file [options] [file]\n" + "Short options:\n" + " -h\t\t\tHelp (this text)\n" " -v\t\t\tBe more verbose\n" - " -V\t\t\tPrint the version number and exit\n" - "\n" - "Long options:\n" - " --help\t\tHelp (this text)\n" + " -V\t\t\tPrint the version number and exit\n" + "\n" + "Long options:\n" + " --help\t\tHelp (this text)\n" " --verbose\t\tBe more verbose\n" - " --version\t\tPrint the version number and exit\n", - ProgName); + " --version\t\tPrint the version number and exit\n", + ProgName); } static void OptHelp (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print usage information and exit */ { Usage (); @@ -206,7 +206,7 @@ static void OptHelp (const char* Opt attribute ((unused)), static void OptVerbose (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Increase verbosity */ { ++Verbosity; @@ -215,12 +215,12 @@ static void OptVerbose (const char* Opt attribute ((unused)), static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print the assembler version */ { fprintf (stderr, - "%s V%s - (C) Copyright 2009, Ullrich von Bassewitz\n", - ProgName, GetVersionAsString ()); + "%s V%s - (C) Copyright 2009, Ullrich von Bassewitz\n", + ProgName, GetVersionAsString ()); } @@ -324,7 +324,7 @@ static void ConvertFile (const char* Input, const char* Output) /* Try to open the file for reading */ FILE* F = fopen (Input, "rb"); if (F == 0) { - Error ("Cannot open input file `%s': %s", Input, strerror (errno)); + Error ("Cannot open input file `%s': %s", Input, strerror (errno)); } /* Seek to the end and determine the size */ @@ -434,7 +434,7 @@ static void ConvertFile (const char* Input, const char* Output) /* Open the output file */ F = fopen (Output, "wb"); if (F == 0) { - Error ("Cannot open output file `%s': %s", Output, strerror (errno)); + Error ("Cannot open output file `%s': %s", Output, strerror (errno)); } /* Write the header to the output file */ @@ -473,9 +473,9 @@ int main (int argc, char* argv []) { /* Program long options */ static const LongOpt OptTab[] = { - { "--help", 0, OptHelp }, - { "--verbose", 0, OptVerbose }, - { "--version", 0, OptVersion }, + { "--help", 0, OptHelp }, + { "--verbose", 0, OptVerbose }, + { "--version", 0, OptVersion }, }; unsigned I; @@ -487,47 +487,47 @@ int main (int argc, char* argv []) I = 1; while (I < ArgCount) { - /* Get the argument */ - const char* Arg = ArgVec[I]; + /* Get the argument */ + const char* Arg = ArgVec[I]; - /* Check for an option */ - if (Arg [0] == '-') { - switch (Arg [1]) { + /* Check for an option */ + if (Arg [0] == '-') { + switch (Arg [1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; - case 'h': - OptHelp (Arg, 0); - break; + case 'h': + OptHelp (Arg, 0); + break; - case 'v': - OptVerbose (Arg, 0); - break; + case 'v': + OptVerbose (Arg, 0); + break; - case 'V': - OptVersion (Arg, 0); - break; + case 'V': + OptVersion (Arg, 0); + break; - default: - UnknownOption (Arg); - break; + default: + UnknownOption (Arg); + break; - } - } else { - /* Filename. Dump it. */ - ConvertFile (Arg, 0); - ++FilesProcessed; - } + } + } else { + /* Filename. Dump it. */ + ConvertFile (Arg, 0); + ++FilesProcessed; + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Print a message if we did not process any files */ if (FilesProcessed == 0) { - fprintf (stderr, "%s: No input files\n", ProgName); + fprintf (stderr, "%s: No input files\n", ProgName); } /* Success */ diff --git a/src/cl65/error.c b/src/cl65/error.c index 0372d50a0..c68b7fe64 100644 --- a/src/cl65/error.c +++ b/src/cl65/error.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ -/* Error handling for the cl65 compile and link utility */ +/* Error handling for the cl65 compile and link utility */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /* common */ #include "cmdline.h" - + /* cl65 */ #include "global.h" #include "error.h" @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cl65/error.h b/src/cl65/error.h index 5517d91f2..38999faec 100644 --- a/src/cl65/error.h +++ b/src/cl65/error.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ -/* Error handling for the cl65 compile and link utility */ +/* Error handling for the cl65 compile and link utility */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cl65/global.c b/src/cl65/global.c index 9962c9c7e..318020415 100644 --- a/src/cl65/global.c +++ b/src/cl65/global.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ -/* Global variables for the cl65 compile and link utility */ +/* Global variables for the cl65 compile and link utility */ /* */ /* */ /* */ @@ -38,12 +38,12 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -unsigned char Debug = 0; /* Debug mode enabled? */ +unsigned char Debug = 0; /* Debug mode enabled? */ diff --git a/src/cl65/global.h b/src/cl65/global.h index 011c8d0b1..fd85dc2d5 100644 --- a/src/cl65/global.h +++ b/src/cl65/global.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ -/* Global variables for the cl65 compile and link utility */ +/* Global variables for the cl65 compile and link utility */ /* */ /* */ /* */ @@ -39,12 +39,12 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -extern unsigned char Debug; /* Debug mode enabled? */ +extern unsigned char Debug; /* Debug mode enabled? */ diff --git a/src/cl65/main.c b/src/cl65/main.c index 4c3c40b1f..e704d985c 100644 --- a/src/cl65/main.c +++ b/src/cl65/main.c @@ -1,34 +1,34 @@ /*****************************************************************************/ -/* */ -/* main.c */ -/* */ -/* Main module for the cl65 compile-and-link utility */ -/* */ -/* */ -/* */ +/* */ +/* main.c */ +/* */ +/* Main module for the cl65 compile-and-link utility */ +/* */ +/* */ +/* */ /* (C) 1999-2013, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -73,7 +73,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -81,15 +81,15 @@ /* Struct that describes a command */ typedef struct CmdDesc CmdDesc; struct CmdDesc { - char* Name; /* The command name */ + char* Name; /* The command name */ - unsigned ArgCount; /* Count of arguments */ - unsigned ArgMax; /* Maximum count of arguments */ - char** Args; /* The arguments */ + unsigned ArgCount; /* Count of arguments */ + unsigned ArgMax; /* Maximum count of arguments */ + char** Args; /* The arguments */ - unsigned FileCount; /* Count of files to translate */ - unsigned FileMax; /* Maximum count of files */ - char** Files; /* The files */ + unsigned FileCount; /* Count of files to translate */ + unsigned FileMax; /* Maximum count of files */ + char** Files; /* The files */ }; /* Command descriptors for the different programs */ @@ -125,7 +125,7 @@ static int Module = 0; #define MODULE_EXT ".o65" /* Name of the target specific runtime library */ -static char* TargetLib = 0; +static char* TargetLib = 0; @@ -146,7 +146,7 @@ static char* TargetLib = 0; /*****************************************************************************/ -/* Command structure handling */ +/* Command structure handling */ /*****************************************************************************/ @@ -155,7 +155,7 @@ static void CmdExpand (CmdDesc* Cmd) /* Expand the argument vector */ { unsigned NewMax = Cmd->ArgMax + 10; - char** NewArgs = xmalloc (NewMax * sizeof (char*)); + char** NewArgs = xmalloc (NewMax * sizeof (char*)); memcpy (NewArgs, Cmd->Args, Cmd->ArgMax * sizeof (char*)); xfree (Cmd->Args); Cmd->Args = NewArgs; @@ -174,9 +174,9 @@ static void CmdAddArg (CmdDesc* Cmd, const char* Arg) /* Add a copy of the new argument, allow a NULL pointer */ if (Arg) { - Cmd->Args[Cmd->ArgCount++] = xstrdup (Arg); + Cmd->Args[Cmd->ArgCount++] = xstrdup (Arg); } else { - Cmd->Args[Cmd->ArgCount++] = 0; + Cmd->Args[Cmd->ArgCount++] = 0; } } @@ -236,9 +236,9 @@ static void CmdDelArgs (CmdDesc* Cmd, unsigned LastValid) /* Remove all arguments with an index greater than LastValid */ { while (Cmd->ArgCount > LastValid) { - Cmd->ArgCount--; - xfree (Cmd->Args [Cmd->ArgCount]); - Cmd->Args [Cmd->ArgCount] = 0; + Cmd->ArgCount--; + xfree (Cmd->Args [Cmd->ArgCount]); + Cmd->Args [Cmd->ArgCount] = 0; } } @@ -249,12 +249,12 @@ static void CmdAddFile (CmdDesc* Cmd, const char* File) { /* Expand the file vector if needed */ if (Cmd->FileCount == Cmd->FileMax) { - unsigned NewMax = Cmd->FileMax + 10; - char** NewFiles = xmalloc (NewMax * sizeof (char*)); - memcpy (NewFiles, Cmd->Files, Cmd->FileMax * sizeof (char*)); - xfree (Cmd->Files); - Cmd->Files = NewFiles; - Cmd->FileMax = NewMax; + unsigned NewMax = Cmd->FileMax + 10; + char** NewFiles = xmalloc (NewMax * sizeof (char*)); + memcpy (NewFiles, Cmd->Files, Cmd->FileMax * sizeof (char*)); + xfree (Cmd->Files); + Cmd->Files = NewFiles; + Cmd->FileMax = NewMax; } /* If the file name is not NULL (which is legal and is used to terminate @@ -263,21 +263,21 @@ static void CmdAddFile (CmdDesc* Cmd, const char* File) * the file. */ if (File) { - unsigned I; - for (I = 0; I < Cmd->FileCount; ++I) { - if (strcmp (Cmd->Files[I], File) == 0) { - /* Duplicate file */ - Warning ("Duplicate file in argument list: `%s'", File); - /* No need to search further */ - break; - } - } + unsigned I; + for (I = 0; I < Cmd->FileCount; ++I) { + if (strcmp (Cmd->Files[I], File) == 0) { + /* Duplicate file */ + Warning ("Duplicate file in argument list: `%s'", File); + /* No need to search further */ + break; + } + } - /* Add the file */ - Cmd->Files [Cmd->FileCount++] = xstrdup (File); + /* Add the file */ + Cmd->Files [Cmd->FileCount++] = xstrdup (File); } else { - /* Add a NULL pointer */ - Cmd->Files [Cmd->FileCount++] = 0; + /* Add a NULL pointer */ + Cmd->Files [Cmd->FileCount++] = 0; } } @@ -324,14 +324,14 @@ static void CmdPrint (CmdDesc* Cmd, FILE* F) { unsigned I; for (I = 0; I < Cmd->ArgCount && Cmd->Args[I] != 0; ++I) { - fprintf (F, "%s ", Cmd->Args[I]); + fprintf (F, "%s ", Cmd->Args[I]); } } /*****************************************************************************/ -/* Target handling */ +/* Target handling */ /*****************************************************************************/ @@ -342,14 +342,14 @@ static void SetTargetFiles (void) /* Determine the names of the target specific library file */ if (Target != TGT_NONE) { - /* Get a pointer to the system name and its length */ - const char* TargetName = GetTargetName (Target); - unsigned TargetNameLen = strlen (TargetName); + /* Get a pointer to the system name and its length */ + const char* TargetName = GetTargetName (Target); + unsigned TargetNameLen = strlen (TargetName); - /* Set the library file */ - TargetLib = xmalloc (TargetNameLen + 4 + 1); - memcpy (TargetLib, TargetName, TargetNameLen); - strcpy (TargetLib + TargetNameLen, ".lib"); + /* Set the library file */ + TargetLib = xmalloc (TargetNameLen + 4 + 1); + memcpy (TargetLib, TargetName, TargetNameLen); + strcpy (TargetLib + TargetNameLen, ".lib"); } } @@ -357,7 +357,7 @@ static void SetTargetFiles (void) /*****************************************************************************/ -/* Subprocesses */ +/* Subprocesses */ /*****************************************************************************/ @@ -369,9 +369,9 @@ static void ExecProgram (CmdDesc* Cmd) /* If in debug mode, output the command line we will execute */ if (Debug) { - printf ("Executing: "); - CmdPrint (Cmd, stdout); - printf ("\n"); + printf ("Executing: "); + CmdPrint (Cmd, stdout); + printf ("\n"); } /* Call the program */ @@ -379,11 +379,11 @@ static void ExecProgram (CmdDesc* Cmd) /* Check the result code */ if (Status < 0) { - /* Error executing the program */ - Error ("Cannot execute `%s': %s", Cmd->Name, strerror (errno)); + /* Error executing the program */ + Error ("Cannot execute `%s': %s", Cmd->Name, strerror (errno)); } else if (Status != 0) { - /* Called program had an error */ - exit (Status); + /* Called program had an error */ + exit (Status); } } @@ -400,14 +400,14 @@ static void Link (void) */ if (OutputName) { - CmdSetOutput (&LD65, OutputName); + CmdSetOutput (&LD65, OutputName); } else if (FirstInput && FindExt (FirstInput)) { /* Only if ext present! */ const char* Extension = Module? MODULE_EXT : ""; - char* Output = MakeFilename (FirstInput, Extension); - CmdSetOutput (&LD65, Output); - xfree (Output); + char* Output = MakeFilename (FirstInput, Extension); + CmdSetOutput (&LD65, Output); + xfree (Output); } @@ -418,11 +418,11 @@ static void Link (void) if (Module) { Error ("Cannot use -C and --module together"); } - CmdAddArg2 (&LD65, "-C", LinkerConfig); + CmdAddArg2 (&LD65, "-C", LinkerConfig); } else if (Module) { CmdSetTarget (&LD65, TGT_MODULE); } else { - CmdSetTarget (&LD65, Target); + CmdSetTarget (&LD65, Target); } /* Determine which target libraries are needed */ @@ -430,12 +430,12 @@ static void Link (void) /* Add all object files as parameters */ for (I = 0; I < LD65.FileCount; ++I) { - CmdAddArg (&LD65, LD65.Files [I]); + CmdAddArg (&LD65, LD65.Files [I]); } /* Add the system runtime library */ if (TargetLib) { - CmdAddArg (&LD65, TargetLib); + CmdAddArg (&LD65, TargetLib); } /* Terminate the argument list with a NULL pointer */ @@ -462,9 +462,9 @@ static void AssembleFile (const char* File, unsigned ArgCount) * the the file list of the linker. The name of the output * file is that of the input file with ".s" replaced by ".o". */ - char* ObjName = MakeFilename (File, ".o"); - CmdAddFile (&LD65, ObjName); - xfree (ObjName); + char* ObjName = MakeFilename (File, ".o"); + CmdAddFile (&LD65, ObjName); + xfree (ObjName); } else { /* This is the final step. If an output name is given, set it */ if (OutputName) { @@ -590,7 +590,7 @@ static void Compile (const char* File) */ if (DoAssemble) { /* Assemble the intermediate file and remove it */ - AssembleIntermediate (File); + AssembleIntermediate (File); } } @@ -624,7 +624,7 @@ static void CompileRes (const char* File) */ if (DoAssemble) { /* Assemble the intermediate file and remove it */ - AssembleIntermediate (File); + AssembleIntermediate (File); } } @@ -640,7 +640,7 @@ static void ConvertO65 (const char* File) * output name. */ if (!DoAssemble && OutputName) { - CmdSetOutput (&CO65, OutputName); + CmdSetOutput (&CO65, OutputName); } /* Add the file as argument for the object file converter */ @@ -660,14 +660,14 @@ static void ConvertO65 (const char* File) */ if (DoAssemble) { /* Assemble the intermediate file and remove it */ - AssembleIntermediate (File); + AssembleIntermediate (File); } } /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -765,7 +765,7 @@ static void Usage (void) static void OptAddSource (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Strict source code as comments to the generated asm code */ { CmdAddArg (&CC65, "-T"); @@ -839,7 +839,7 @@ static void OptCfgPath (const char* Opt attribute ((unused)), const char* Arg) static void OptCheckStack (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Handle the --check-stack option */ { CmdAddArg (&CC65, "--check-stack"); @@ -935,7 +935,7 @@ static void OptDataName (const char* Opt attribute ((unused)), const char* Arg) static void OptDebug (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Debug mode (compiler and cl65 utility) */ { CmdAddArg (&CC65, "-d"); @@ -946,7 +946,7 @@ static void OptDebug (const char* Opt attribute ((unused)), static void OptDebugInfo (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Debug Info - add to compiler and assembler */ { CmdAddArg (&CC65, "-g"); @@ -973,7 +973,7 @@ static void OptForceImport (const char* Opt attribute ((unused)), const char* Ar static void OptHelp (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print help - cl65 */ { Usage (); @@ -1031,14 +1031,14 @@ static void OptListing (const char* Opt attribute ((unused)), const char* Arg) static void OptListTargets (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* List all targets */ { target_t T; /* List the targets */ for (T = TGT_NONE; T < TGT_COUNT; ++T) { - printf ("%s\n", GetTargetName (T)); + printf ("%s\n", GetTargetName (T)); } /* Terminate */ @@ -1140,7 +1140,7 @@ static void OptRodataName (const char* Opt attribute ((unused)), const char* Arg static void OptSignedChars (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Make default characters signed */ { CmdAddArg (&CC65, "-j"); @@ -1165,7 +1165,7 @@ static void OptStartAddr (const char* Opt attribute ((unused)), const char* Arg) static void OptStaticLocals (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Place local variables in static storage */ { CmdAddArg (&CC65, "-Cl"); @@ -1187,7 +1187,7 @@ static void OptTarget (const char* Opt attribute ((unused)), const char* Arg) static void OptVerbose (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Verbose mode (compiler, assembler, linker) */ { CmdAddArg (&CC65, "-v"); @@ -1199,7 +1199,7 @@ static void OptVerbose (const char* Opt attribute ((unused)), static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print version number */ { fprintf (stderr, "cl65 V%s\n", GetVersionAsString ()); @@ -1228,56 +1228,56 @@ int main (int argc, char* argv []) { /* Program long options */ static const LongOpt OptTab[] = { - { "--add-source", 0, OptAddSource }, + { "--add-source", 0, OptAddSource }, { "--asm-args", 1, OptAsmArgs }, - { "--asm-define", 1, OptAsmDefine }, - { "--asm-include-dir", 1, OptAsmIncludeDir }, + { "--asm-define", 1, OptAsmDefine }, + { "--asm-include-dir", 1, OptAsmIncludeDir }, { "--bin-include-dir", 1, OptBinIncludeDir }, - { "--bss-label", 1, OptBssLabel }, - { "--bss-name", 1, OptBssName }, + { "--bss-label", 1, OptBssLabel }, + { "--bss-name", 1, OptBssName }, { "--cc-args", 1, OptCCArgs }, - { "--cfg-path", 1, OptCfgPath }, - { "--check-stack", 0, OptCheckStack }, - { "--code-label", 1, OptCodeLabel }, - { "--code-name", 1, OptCodeName }, - { "--codesize", 1, OptCodeSize }, + { "--cfg-path", 1, OptCfgPath }, + { "--check-stack", 0, OptCheckStack }, + { "--code-label", 1, OptCodeLabel }, + { "--code-name", 1, OptCodeName }, + { "--codesize", 1, OptCodeSize }, { "--config", 1, OptConfig }, - { "--cpu", 1, OptCPU }, - { "--create-dep", 1, OptCreateDep }, - { "--create-full-dep", 1, OptCreateFullDep }, - { "--data-label", 1, OptDataLabel }, - { "--data-name", 1, OptDataName }, - { "--debug", 0, OptDebug }, - { "--debug-info", 0, OptDebugInfo }, - { "--feature", 1, OptFeature }, + { "--cpu", 1, OptCPU }, + { "--create-dep", 1, OptCreateDep }, + { "--create-full-dep", 1, OptCreateFullDep }, + { "--data-label", 1, OptDataLabel }, + { "--data-name", 1, OptDataName }, + { "--debug", 0, OptDebug }, + { "--debug-info", 0, OptDebugInfo }, + { "--feature", 1, OptFeature }, { "--force-import", 1, OptForceImport }, - { "--help", 0, OptHelp }, - { "--include-dir", 1, OptIncludeDir }, + { "--help", 0, OptHelp }, + { "--include-dir", 1, OptIncludeDir }, { "--ld-args", 1, OptLdArgs }, - { "--lib", 1, OptLib }, - { "--lib-path", 1, OptLibPath }, - { "--list-targets", 0, OptListTargets }, - { "--listing", 1, OptListing }, + { "--lib", 1, OptLib }, + { "--lib-path", 1, OptLibPath }, + { "--list-targets", 0, OptListTargets }, + { "--listing", 1, OptListing }, { "--list-bytes", 1, OptListBytes }, - { "--mapfile", 1, OptMapFile }, + { "--mapfile", 1, OptMapFile }, { "--memory-model", 1, OptMemoryModel }, { "--module", 0, OptModule }, { "--module-id", 1, OptModuleId }, { "--o65-model", 1, OptO65Model }, - { "--obj", 1, OptObj }, - { "--obj-path", 1, OptObjPath }, + { "--obj", 1, OptObj }, + { "--obj-path", 1, OptObjPath }, { "--register-space", 1, OptRegisterSpace }, { "--register-vars", 0, OptRegisterVars }, - { "--rodata-name", 1, OptRodataName }, - { "--signed-chars", 0, OptSignedChars }, + { "--rodata-name", 1, OptRodataName }, + { "--signed-chars", 0, OptSignedChars }, { "--standard", 1, OptStandard }, - { "--start-addr", 1, OptStartAddr }, - { "--static-locals", 0, OptStaticLocals }, - { "--target", 1, OptTarget }, - { "--verbose", 0, OptVerbose }, - { "--version", 0, OptVersion }, - { "--zeropage-label", 1, OptZeropageLabel }, - { "--zeropage-name", 1, OptZeropageName }, + { "--start-addr", 1, OptStartAddr }, + { "--static-locals", 0, OptStaticLocals }, + { "--target", 1, OptTarget }, + { "--verbose", 0, OptVerbose }, + { "--version", 0, OptVersion }, + { "--zeropage-label", 1, OptZeropageLabel }, + { "--zeropage-name", 1, OptZeropageName }, }; char* CmdPath; @@ -1316,211 +1316,211 @@ int main (int argc, char* argv []) I = 1; while (I < ArgCount) { - /* Get the argument */ - const char* Arg = ArgVec[I]; + /* Get the argument */ + const char* Arg = ArgVec[I]; - /* Check for an option */ - if (Arg [0] == '-') { + /* Check for an option */ + if (Arg [0] == '-') { - switch (Arg [1]) { + switch (Arg [1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; - case 'C': - if (Arg[2] == 'l' && Arg[3] == '\0') { - /* Make local variables static */ - OptStaticLocals (Arg, 0); - } else { - /* Specify linker config file */ - OptConfig (Arg, GetArg (&I, 2)); - } - break; + case 'C': + if (Arg[2] == 'l' && Arg[3] == '\0') { + /* Make local variables static */ + OptStaticLocals (Arg, 0); + } else { + /* Specify linker config file */ + OptConfig (Arg, GetArg (&I, 2)); + } + break; - case 'D': - /* Define a preprocessor symbol (compiler) */ - CmdAddArg2 (&CC65, "-D", GetArg (&I, 2)); - break; + case 'D': + /* Define a preprocessor symbol (compiler) */ + CmdAddArg2 (&CC65, "-D", GetArg (&I, 2)); + break; - case 'I': - /* Include directory (compiler) */ - OptIncludeDir (Arg, GetArg (&I, 2)); - break; + case 'I': + /* Include directory (compiler) */ + OptIncludeDir (Arg, GetArg (&I, 2)); + break; - case 'L': - if (Arg[2] == 'n' && Arg[3] == '\0') { - /* VICE label file (linker) */ - CmdAddArg2 (&LD65, "-Ln", GetArg (&I, 3)); - } else { + case 'L': + if (Arg[2] == 'n' && Arg[3] == '\0') { + /* VICE label file (linker) */ + CmdAddArg2 (&LD65, "-Ln", GetArg (&I, 3)); + } else { /* Library search path (linker) */ OptLibPath (Arg, GetArg (&I, 2)); - } - break; + } + break; - case 'O': - /* Optimize code (compiler, also covers -Oi and others) */ - CmdAddArg (&CC65, Arg); - break; + case 'O': + /* Optimize code (compiler, also covers -Oi and others) */ + CmdAddArg (&CC65, Arg); + break; - case 'S': - /* Dont assemble and link the created files */ + case 'S': + /* Dont assemble and link the created files */ DoAssemble = 0; - DoLink = 0; - break; + DoLink = 0; + break; - case 'T': - /* Include source as comment (compiler) */ - OptAddSource (Arg, 0); - break; + case 'T': + /* Include source as comment (compiler) */ + OptAddSource (Arg, 0); + break; - case 'V': - /* Print version number */ - OptVersion (Arg, 0); - break; + case 'V': + /* Print version number */ + OptVersion (Arg, 0); + break; - case 'W': - if (Arg[2] == 'a' && Arg[3] == '\0') { - /* -Wa: Pass options to assembler */ - OptAsmArgs (Arg, GetArg (&I, 3)); - } else if (Arg[2] == 'c' && Arg[3] == '\0') { - /* -Wc: Pass options to compiler */ - OptCCArgs (Arg, GetArg (&I, 3)); - } else if (Arg[2] == 'l' && Arg[3] == '\0') { - /* -Wl: Pass options to linker */ - OptLdArgs (Arg, GetArg (&I, 3)); - } else { - /* Anything else: Suppress warnings (compiler) */ - CmdAddArg2 (&CC65, "-W", GetArg (&I, 2)); - } - break; + case 'W': + if (Arg[2] == 'a' && Arg[3] == '\0') { + /* -Wa: Pass options to assembler */ + OptAsmArgs (Arg, GetArg (&I, 3)); + } else if (Arg[2] == 'c' && Arg[3] == '\0') { + /* -Wc: Pass options to compiler */ + OptCCArgs (Arg, GetArg (&I, 3)); + } else if (Arg[2] == 'l' && Arg[3] == '\0') { + /* -Wl: Pass options to linker */ + OptLdArgs (Arg, GetArg (&I, 3)); + } else { + /* Anything else: Suppress warnings (compiler) */ + CmdAddArg2 (&CC65, "-W", GetArg (&I, 2)); + } + break; - case 'c': - /* Don't link the resulting files */ - DoLink = 0; - break; + case 'c': + /* Don't link the resulting files */ + DoLink = 0; + break; - case 'd': - /* Debug mode (compiler) */ - OptDebug (Arg, 0); - break; + case 'd': + /* Debug mode (compiler) */ + OptDebug (Arg, 0); + break; - case 'g': - /* Debugging - add to compiler and assembler */ - OptDebugInfo (Arg, 0); - break; + case 'g': + /* Debugging - add to compiler and assembler */ + OptDebugInfo (Arg, 0); + break; - case 'h': - case '?': - /* Print help - cl65 */ - OptHelp (Arg, 0); - break; + case 'h': + case '?': + /* Print help - cl65 */ + OptHelp (Arg, 0); + break; - case 'j': - /* Default characters are signed */ - OptSignedChars (Arg, 0); - break; + case 'j': + /* Default characters are signed */ + OptSignedChars (Arg, 0); + break; - case 'l': - /* Create an assembler listing */ - OptListing (Arg, GetArg (&I, 2)); - break; + case 'l': + /* Create an assembler listing */ + OptListing (Arg, GetArg (&I, 2)); + break; - case 'm': - /* Create a map file (linker) */ - OptMapFile (Arg, GetArg (&I, 2)); - break; + case 'm': + /* Create a map file (linker) */ + OptMapFile (Arg, GetArg (&I, 2)); + break; - case 'o': - /* Name the output file */ - OutputName = GetArg (&I, 2); - break; + case 'o': + /* Name the output file */ + OutputName = GetArg (&I, 2); + break; - case 'r': - /* Enable register variables */ - OptRegisterVars (Arg, 0); - break; + case 'r': + /* Enable register variables */ + OptRegisterVars (Arg, 0); + break; - case 't': - /* Set target system - compiler, assembler and linker */ - OptTarget (Arg, GetArg (&I, 2)); - break; + case 't': + /* Set target system - compiler, assembler and linker */ + OptTarget (Arg, GetArg (&I, 2)); + break; - case 'u': - /* Force an import (linker) */ - OptForceImport (Arg, GetArg (&I, 2)); - break; + case 'u': + /* Force an import (linker) */ + OptForceImport (Arg, GetArg (&I, 2)); + break; - case 'v': - if (Arg [2] == 'm') { - /* Verbose map file (linker) */ - CmdAddArg (&LD65, "-vm"); - } else { - /* Verbose mode (compiler, assembler, linker) */ - OptVerbose (Arg, 0); - } - break; + case 'v': + if (Arg [2] == 'm') { + /* Verbose map file (linker) */ + CmdAddArg (&LD65, "-vm"); + } else { + /* Verbose mode (compiler, assembler, linker) */ + OptVerbose (Arg, 0); + } + break; - default: - UnknownOption (Arg); - } - } else { + default: + UnknownOption (Arg); + } + } else { - /* Remember the first file name */ - if (FirstInput == 0) { - FirstInput = Arg; - } + /* Remember the first file name */ + if (FirstInput == 0) { + FirstInput = Arg; + } - /* Determine the file type by the extension */ - switch (GetFileType (Arg)) { + /* Determine the file type by the extension */ + switch (GetFileType (Arg)) { - case FILETYPE_C: - /* Compile the file */ - Compile (Arg); - break; + case FILETYPE_C: + /* Compile the file */ + Compile (Arg); + break; - case FILETYPE_ASM: - /* Assemble the file */ - if (DoAssemble) { - Assemble (Arg); - } - break; + case FILETYPE_ASM: + /* Assemble the file */ + if (DoAssemble) { + Assemble (Arg); + } + break; - case FILETYPE_OBJ: - case FILETYPE_LIB: - /* Add to the linker files */ - CmdAddFile (&LD65, Arg); - break; + case FILETYPE_OBJ: + case FILETYPE_LIB: + /* Add to the linker files */ + CmdAddFile (&LD65, Arg); + break; - case FILETYPE_GR: - /* Add to the resource compiler files */ - CompileRes (Arg); - break; + case FILETYPE_GR: + /* Add to the resource compiler files */ + CompileRes (Arg); + break; case FILETYPE_O65: /* Add the the object file converter files */ ConvertO65 (Arg); break; - default: - Error ("Don't know what to do with `%s'", Arg); + default: + Error ("Don't know what to do with `%s'", Arg); - } + } - } + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Check if we had any input files */ if (FirstInput == 0) { - Warning ("No input files"); + Warning ("No input files"); } /* Link the given files if requested and if we have any */ if (DoLink && LD65.FileCount > 0) { - Link (); + Link (); } /* Return an apropriate exit code */ diff --git a/src/cl65/spawn-amiga.inc b/src/cl65/spawn-amiga.inc index 41fa3895e..4a0278cfa 100644 --- a/src/cl65/spawn-amiga.inc +++ b/src/cl65/spawn-amiga.inc @@ -32,7 +32,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -41,13 +41,13 @@ * provided for DOS/Windows compatibility. */ #ifndef P_WAIT -#define P_WAIT 0 +#define P_WAIT 0 #endif /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/cl65/spawn-unix.inc b/src/cl65/spawn-unix.inc index d64d85d5b..a0334b8db 100644 --- a/src/cl65/spawn-unix.inc +++ b/src/cl65/spawn-unix.inc @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -51,13 +51,13 @@ * provided for DOS/Windows compatibility. */ #ifndef P_WAIT -#define P_WAIT 0 +#define P_WAIT 0 #endif /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -75,27 +75,27 @@ int spawnvp (int Mode attribute ((unused)), const char* File, char* const argv [ int pid = fork (); if (pid < 0) { - /* Error forking */ - Error ("Cannot fork: %s", strerror (errno)); + /* Error forking */ + Error ("Cannot fork: %s", strerror (errno)); } else if (pid == 0) { - /* The son - exec the program */ - if (execvp (File, argv) < 0) { - Error ("Cannot exec `%s': %s", File, strerror (errno)); - } + /* The son - exec the program */ + if (execvp (File, argv) < 0) { + Error ("Cannot exec `%s': %s", File, strerror (errno)); + } } else { - /* The father: Wait for the subprocess to terminate */ - if (waitpid (pid, &Status, 0) < 0) { - Error ("Failure waiting for subprocess: %s", strerror (errno)); - } + /* The father: Wait for the subprocess to terminate */ + if (waitpid (pid, &Status, 0) < 0) { + Error ("Failure waiting for subprocess: %s", strerror (errno)); + } - /* Examine the child status */ - if (!WIFEXITED (Status)) { - Error ("Subprocess `%s' aborted by signal %d", File, WTERMSIG (Status)); - } + /* Examine the child status */ + if (!WIFEXITED (Status)) { + Error ("Subprocess `%s' aborted by signal %d", File, WTERMSIG (Status)); + } } /* Only the father goes here, we place a return here regardless of that diff --git a/src/cl65/spawn.h b/src/cl65/spawn.h index 86f50654a..6e75f555d 100644 --- a/src/cl65/spawn.h +++ b/src/cl65/spawn.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* spawn.h */ +/* spawn.h */ /* */ -/* Execute other external programs */ +/* Execute other external programs */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -48,13 +48,13 @@ * provided for DOS/Windows compatibility. */ #ifndef P_WAIT -#define P_WAIT 0 +#define P_WAIT 0 #endif /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/co65/convert.c b/src/co65/convert.c index 42b2df1b4..6ae051091 100644 --- a/src/co65/convert.c +++ b/src/co65/convert.c @@ -54,7 +54,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -459,7 +459,7 @@ void Convert (const O65Data* D) /* Select the CPU */ if ((D->Header.mode & O65_CPU_MASK) == O65_CPU_65816) { - fprintf (F, ".p816\n"); + fprintf (F, ".p816\n"); } /* Object file options */ diff --git a/src/co65/convert.h b/src/co65/convert.h index b7512d3b0..f000f55c4 100644 --- a/src/co65/convert.h +++ b/src/co65/convert.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -50,7 +50,7 @@ struct O65Data; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/co65/error.c b/src/co65/error.c index da0f8adad..5ee75661b 100644 --- a/src/co65/error.c +++ b/src/co65/error.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* error.c */ +/* error.c */ /* */ /* Error handling for the co65 object file converter */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/co65/error.h b/src/co65/error.h index 48ba30caf..1b3060a84 100644 --- a/src/co65/error.h +++ b/src/co65/error.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* error.h */ +/* error.h */ /* */ /* Error handling for the co65 object file converter */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/co65/fileio.c b/src/co65/fileio.c index 1b0d58c46..4846add3f 100644 --- a/src/co65/fileio.c +++ b/src/co65/fileio.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* fileio.c */ +/* fileio.c */ /* */ /* Binary file I/O for the co65 object file converter */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -55,7 +55,7 @@ unsigned Read8 (FILE* F) { int C = getc (F); if (C == EOF) { - Error ("Read error (file corrupt?)"); + Error ("Read error (file corrupt?)"); } return C; } @@ -97,9 +97,9 @@ void* ReadData (FILE* F, void* Data, unsigned Size) { /* Explicitly allow reading zero bytes */ if (Size > 0) { - if (fread (Data, 1, Size, F) != Size) { - Error ("Read error (file corrupt?)"); - } + if (fread (Data, 1, Size, F) != Size) { + Error ("Read error (file corrupt?)"); + } } return Data; } diff --git a/src/co65/fileio.h b/src/co65/fileio.h index aedfddbc7..ccae88020 100644 --- a/src/co65/fileio.h +++ b/src/co65/fileio.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* fileio.h */ +/* fileio.h */ /* */ /* Binary file I/O for the co65 object file converter */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/co65/global.c b/src/co65/global.c index 8bce9aec3..38748cc0e 100644 --- a/src/co65/global.c +++ b/src/co65/global.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ /* Global variables for the co65 object file converter */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/co65/global.h b/src/co65/global.h index 8825b1072..247b9de45 100644 --- a/src/co65/global.h +++ b/src/co65/global.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ /* Global variables for the co65 object file converter */ /* */ @@ -39,17 +39,17 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* File names */ -extern const char* InputName; /* Name of input file */ -extern const char* OutputName; /* Name of output file */ +extern const char* InputName; /* Name of input file */ +extern const char* OutputName; /* Name of output file */ /* Default extensions */ -extern const char AsmExt[]; /* Default assembler extension */ +extern const char AsmExt[]; /* Default assembler extension */ /* Segment names */ extern const char* CodeSeg; /* Name of the code segment */ diff --git a/src/co65/main.c b/src/co65/main.c index 1d9773143..79aca87fa 100644 --- a/src/co65/main.c +++ b/src/co65/main.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* main.c */ +/* main.c */ /* */ /* Main program for the co65 object file converter */ /* */ @@ -60,7 +60,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -123,7 +123,7 @@ static void CheckSegName (const char* Seg) { /* Print an error and abort if the name is not ok */ if (!ValidSegName (Seg)) { - Error ("Segment name `%s' is invalid", Seg); + Error ("Segment name `%s' is invalid", Seg); } } @@ -202,7 +202,7 @@ static void OptDataName (const char* Opt attribute ((unused)), const char* Arg) static void OptDebug (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Enable debugging code */ { ++Debug; @@ -211,7 +211,7 @@ static void OptDebug (const char* Opt attribute ((unused)), static void OptDebugInfo (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Add debug info to the object file */ { DebugInfo = 1; @@ -220,7 +220,7 @@ static void OptDebugInfo (const char* Opt attribute ((unused)), static void OptHelp (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print usage information and exit */ { Usage (); @@ -230,7 +230,7 @@ static void OptHelp (const char* Opt attribute ((unused)), static void OptNoOutput (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Handle the --no-output option */ { NoOutput = 1; @@ -251,7 +251,7 @@ static void OptO65Model (const char* Opt attribute ((unused)), const char* Arg) static void OptVerbose (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Increase verbosity */ { ++Verbosity; @@ -260,7 +260,7 @@ static void OptVerbose (const char* Opt attribute ((unused)), static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print the assembler version */ { fprintf (stderr, "co65 V%s\n", GetVersionAsString ()); @@ -313,21 +313,21 @@ int main (int argc, char* argv []) { /* Program long options */ static const LongOpt OptTab[] = { - { "--bss-label", 1, OptBssLabel }, - { "--bss-name", 1, OptBssName }, - { "--code-label", 1, OptCodeLabel }, - { "--code-name", 1, OptCodeName }, - { "--data-label", 1, OptDataLabel }, - { "--data-name", 1, OptDataName }, - { "--debug", 0, OptDebug }, - { "--debug-info", 0, OptDebugInfo }, - { "--help", 0, OptHelp }, - { "--no-output", 0, OptNoOutput }, + { "--bss-label", 1, OptBssLabel }, + { "--bss-name", 1, OptBssName }, + { "--code-label", 1, OptCodeLabel }, + { "--code-name", 1, OptCodeName }, + { "--data-label", 1, OptDataLabel }, + { "--data-name", 1, OptDataName }, + { "--debug", 0, OptDebug }, + { "--debug-info", 0, OptDebugInfo }, + { "--help", 0, OptHelp }, + { "--no-output", 0, OptNoOutput }, { "--o65-model", 1, OptO65Model }, - { "--verbose", 0, OptVerbose }, - { "--version", 0, OptVersion }, - { "--zeropage-label", 1, OptZeropageLabel }, - { "--zeropage-name", 1, OptZeropageName }, + { "--verbose", 0, OptVerbose }, + { "--version", 0, OptVersion }, + { "--zeropage-label", 1, OptZeropageLabel }, + { "--zeropage-name", 1, OptZeropageName }, }; unsigned I; @@ -339,24 +339,24 @@ int main (int argc, char* argv []) I = 1; while (I < ArgCount) { - /* Get the argument */ - const char* Arg = ArgVec [I]; + /* Get the argument */ + const char* Arg = ArgVec [I]; - /* Check for an option */ - if (Arg [0] == '-') { - switch (Arg [1]) { + /* Check for an option */ + if (Arg [0] == '-') { + switch (Arg [1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; - case 'g': - OptDebugInfo (Arg, 0); - break; + case 'g': + OptDebugInfo (Arg, 0); + break; - case 'h': - OptHelp (Arg, 0); - break; + case 'h': + OptHelp (Arg, 0); + break; case 'm': OptO65Model (Arg, GetArg (&I, 2)); @@ -366,39 +366,39 @@ int main (int argc, char* argv []) OptNoOutput (Arg, 0); break; - case 'o': - OutputName = GetArg (&I, 2); - break; + case 'o': + OutputName = GetArg (&I, 2); + break; - case 'v': - OptVerbose (Arg, 0); - break; + case 'v': + OptVerbose (Arg, 0); + break; - case 'V': - OptVersion (Arg, 0); - break; + case 'V': + OptVersion (Arg, 0); + break; - default: - UnknownOption (Arg); - break; + default: + UnknownOption (Arg); + break; - } - } else { - /* Filename. Check if we already had one */ - if (InputName) { - Error ("Don't know what to do with `%s'", Arg); - } else { - InputName = Arg; - } - } + } + } else { + /* Filename. Check if we already had one */ + if (InputName) { + Error ("Don't know what to do with `%s'", Arg); + } else { + InputName = Arg; + } + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Do we have an input file? */ if (InputName == 0) { - Error ("No input file"); + Error ("No input file"); } /* Generate the name of the output file if none was specified */ diff --git a/src/co65/model.c b/src/co65/model.c index f708876d5..365eed49d 100644 --- a/src/co65/model.c +++ b/src/co65/model.c @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -62,7 +62,7 @@ static const char* NameTable[O65_MODEL_COUNT] = { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/co65/model.h b/src/co65/model.h index e9c3fc572..1f44b89b4 100644 --- a/src/co65/model.h +++ b/src/co65/model.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -63,7 +63,7 @@ extern O65Model Model; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/co65/o65.c b/src/co65/o65.c index a30b18d00..187e4fc38 100644 --- a/src/co65/o65.c +++ b/src/co65/o65.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* o65.h */ +/* o65.h */ /* */ /* Definitions and code for the o65 file format */ /* */ @@ -76,7 +76,7 @@ static O65Data* NewO65Data (void) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/co65/o65.h b/src/co65/o65.h index 9c88c2ffc..6fb8433c5 100644 --- a/src/co65/o65.h +++ b/src/co65/o65.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* o65.h */ +/* o65.h */ /* */ /* Definitions and code for the o65 file format */ /* */ @@ -64,7 +64,7 @@ typedef struct O65Header O65Header; struct O65Header { char marker[2]; /* Non-C64 marker */ char magic[3]; /* o65 magic */ - char version; /* Version number */ + char version; /* Version number */ unsigned mode; /* Mode word */ unsigned long tbase; /* Original text (code) segment address */ unsigned long tlen; /* Size of text (code) segment */ @@ -133,7 +133,7 @@ struct O65Data { #define O65_VERSION 0x00 /* Defines for the mode word */ -#define O65_CPU_65816 0x8000 /* Executable is for 65816 */ +#define O65_CPU_65816 0x8000 /* Executable is for 65816 */ #define O65_CPU_6502 0x0000 /* Executable is for the 6502 */ #define O65_CPU_MASK 0x8000 /* Mask to extract CPU type */ @@ -141,7 +141,7 @@ struct O65Data { #define O65_RELOC_BYTE 0x0000 /* Byte wise relocation */ #define O65_RELOC_MASK 0x4000 /* Mask to extract relocation type */ -#define O65_SIZE_32BIT 0x2000 /* All size words are 32bit */ +#define O65_SIZE_32BIT 0x2000 /* All size words are 32bit */ #define O65_SIZE_16BIT 0x0000 /* All size words are 16bit */ #define O65_SIZE_MASK 0x2000 /* Mask to extract size */ @@ -168,9 +168,9 @@ struct O65Data { O65_ALIGN_1) /* The four o65 segment types. */ -#define O65_SEGID_UNDEF 0x00 +#define O65_SEGID_UNDEF 0x00 #define O65_SEGID_ABS 0x01 -#define O65_SEGID_TEXT 0x02 +#define O65_SEGID_TEXT 0x02 #define O65_SEGID_DATA 0x03 #define O65_SEGID_BSS 0x04 #define O65_SEGID_ZP 0x05 @@ -195,20 +195,20 @@ struct O65Data { /* Option tags */ #define O65_OPT_FILENAME 0 -#define O65_OPT_OS 1 -#define O65_OPT_ASM 2 -#define O65_OPT_AUTHOR 3 -#define O65_OPT_TIMESTAMP 4 +#define O65_OPT_OS 1 +#define O65_OPT_ASM 2 +#define O65_OPT_AUTHOR 3 +#define O65_OPT_TIMESTAMP 4 /* Operating system codes for O65_OPT_OS */ -#define O65_OS_OSA65 1 -#define O65_OS_LUNIX 2 +#define O65_OS_OSA65 1 +#define O65_OS_LUNIX 2 #define O65_OS_CC65_MODULE 3 /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/abend.c b/src/common/abend.c index 741badd9a..0213bdde7 100644 --- a/src/common/abend.c +++ b/src/common/abend.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* abend.c */ +/* abend.c */ /* */ -/* Abnormal program end */ +/* Abnormal program end */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/abend.h b/src/common/abend.h index 7b5fefaf0..f32a3381d 100644 --- a/src/common/abend.h +++ b/src/common/abend.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* abend.h */ +/* abend.h */ /* */ -/* Abnormal program end */ +/* Abnormal program end */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/addrsize.c b/src/common/addrsize.c index 82dc14d00..ad54618e6 100644 --- a/src/common/addrsize.c +++ b/src/common/addrsize.c @@ -40,7 +40,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/addrsize.h b/src/common/addrsize.h index 9d11ce44c..d2c871e3f 100644 --- a/src/common/addrsize.h +++ b/src/common/addrsize.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -54,7 +54,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/attrib.h b/src/common/attrib.h index b2f2aa72b..ff963f9c5 100644 --- a/src/common/attrib.h +++ b/src/common/attrib.h @@ -2,7 +2,7 @@ /* */ /* attrib.h */ /* */ -/* Handle gcc attributes */ +/* Handle gcc attributes */ /* */ /* */ /* */ @@ -39,13 +39,13 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ #if defined(__GNUC__) -# define attribute(a) __attribute__(a) +# define attribute(a) __attribute__(a) #else # define attribute(a) #endif diff --git a/src/common/bitops.c b/src/common/bitops.c index 071b7102c..86633604b 100644 --- a/src/common/bitops.c +++ b/src/common/bitops.c @@ -1,34 +1,34 @@ /*****************************************************************************/ -/* */ -/* bitops.c */ -/* */ -/* Single bit operations */ -/* */ -/* */ -/* */ -/* (C) 1998 Ullrich von Bassewitz */ -/* Wacholderweg 14 */ -/* D-70597 Stuttgart */ -/* EMail: uz@musoftware.de */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* bitops.c */ +/* */ +/* Single bit operations */ +/* */ +/* */ +/* */ +/* (C) 1998 Ullrich von Bassewitz */ +/* Wacholderweg 14 */ +/* D-70597 Stuttgart */ +/* EMail: uz@musoftware.de */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -38,7 +38,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -53,11 +53,11 @@ unsigned BitFind (unsigned long Val) Mask = 1; Bit = 0; while (1) { - if (Val & Mask) { - return Bit; - } - Mask <<= 1; - ++Bit; + if (Val & Mask) { + return Bit; + } + Mask <<= 1; + ++Bit; } } @@ -115,12 +115,12 @@ void BitMerge (void* Target, const void* Source, unsigned Size) /* Merge the bits of two char arrays (that is, do an or for the full array) */ { /* Make char arrays */ - unsigned char* T = Target; + unsigned char* T = Target; const unsigned char* S = Source; /* Merge the arrays */ while (Size--) { - *T++ |= *S++; + *T++ |= *S++; } } diff --git a/src/common/bitops.h b/src/common/bitops.h index af39a2e0f..ade1d1e4e 100644 --- a/src/common/bitops.h +++ b/src/common/bitops.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* bitops.h */ +/* bitops.h */ /* */ -/* Single bit operations */ +/* Single bit operations */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/cddefs.h b/src/common/cddefs.h index 4b2c97be7..7b3dc5b99 100644 --- a/src/common/cddefs.h +++ b/src/common/cddefs.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* cddefs.h */ +/* cddefs.h */ /* */ -/* Definitions for module constructor/destructors */ +/* Definitions for module constructor/destructors */ /* */ /* */ /* */ @@ -39,37 +39,37 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* ConDes types. Count is only 7 because we want to encode 0..count in 3 bits */ -#define CD_TYPE_COUNT 7 /* Number of table types */ -#define CD_TYPE_MIN 0 /* Minimum numeric type value */ -#define CD_TYPE_MAX 6 /* Maximum numeric type value */ +#define CD_TYPE_COUNT 7 /* Number of table types */ +#define CD_TYPE_MIN 0 /* Minimum numeric type value */ +#define CD_TYPE_MAX 6 /* Maximum numeric type value */ /* ConDes priorities, zero is no valid priority and used to mark an empty * (missing) decl for this type throughout the code. */ -#define CD_PRIO_NONE 0 /* No priority (no decl) */ -#define CD_PRIO_MIN 1 /* Lowest priority */ -#define CD_PRIO_DEF 7 /* Default priority */ -#define CD_PRIO_MAX 32 /* Highest priority */ +#define CD_PRIO_NONE 0 /* No priority (no decl) */ +#define CD_PRIO_MIN 1 /* Lowest priority */ +#define CD_PRIO_DEF 7 /* Default priority */ +#define CD_PRIO_MAX 32 /* Highest priority */ /* Predefined types */ -#define CD_TYPE_CON 0 /* Constructor */ -#define CD_TYPE_DES 1 /* Destructor */ +#define CD_TYPE_CON 0 /* Constructor */ +#define CD_TYPE_DES 1 /* Destructor */ #define CD_TYPE_INT 2 /* Interruptor */ /* When part of an export in an object file, type and priority are encoded in * one byte. In this case, the following macros access the fields: */ -#define CD_GET_TYPE(v) (((v) >> 5) & 0x07) -#define CD_GET_PRIO(v) (((v) & 0x1F) + 1) +#define CD_GET_TYPE(v) (((v) >> 5) & 0x07) +#define CD_GET_PRIO(v) (((v) & 0x1F) + 1) /* Macro to build the byte value: */ -#define CD_BUILD(type,prio) ((((type) & 0x07) << 5) | (((prio) - 1) & 0x1F)) +#define CD_BUILD(type,prio) ((((type) & 0x07) << 5) | (((prio) - 1) & 0x1F)) diff --git a/src/common/chartype.c b/src/common/chartype.c index a48688e77..4b8fa9e3d 100644 --- a/src/common/chartype.c +++ b/src/common/chartype.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* chartype.c */ +/* chartype.c */ /* */ -/* Character classification functions */ +/* Character classification functions */ /* */ /* */ /* */ @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/chartype.h b/src/common/chartype.h index 4c0c9ffd4..6c38d98c8 100644 --- a/src/common/chartype.h +++ b/src/common/chartype.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* chartype.h */ +/* chartype.h */ /* */ -/* Character classification functions */ +/* Character classification functions */ /* */ /* */ /* */ @@ -56,7 +56,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -80,7 +80,7 @@ INLINE int IsControl (char C) return iscntrl ((unsigned char) C); } #else -# define IsControl(C) iscntrl (C) +# define IsControl(C) iscntrl (C) #endif int IsSpace (char C); diff --git a/src/common/check.c b/src/common/check.c index d96d94a35..cb4589bf9 100644 --- a/src/common/check.c +++ b/src/common/check.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* check.c */ +/* check.c */ /* */ -/* Assert like macros */ +/* Assert like macros */ /* */ /* */ /* */ @@ -41,38 +41,38 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Predefined messages */ -const char* MsgInternalError = "Internal error: "; -const char* MsgPrecondition = "Precondition violated: "; -const char* MsgCheckFailed = "Check failed: "; -const char* MsgProgramAborted = "Program aborted: "; +const char* MsgInternalError = "Internal error: "; +const char* MsgPrecondition = "Precondition violated: "; +const char* MsgCheckFailed = "Check failed: "; +const char* MsgProgramAborted = "Program aborted: "; static void DefaultCheckFailed (const char* msg, const char* cond, - const char* file, unsigned line) - attribute ((noreturn)); + const char* file, unsigned line) + attribute ((noreturn)); void (*CheckFailed) (const char* Msg, const char* Cond, - const char* File, unsigned Line) attribute ((noreturn)) - = DefaultCheckFailed; + const char* File, unsigned Line) attribute ((noreturn)) + = DefaultCheckFailed; /* Function pointer that is called from check if the condition code is true. */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ static void DefaultCheckFailed (const char* Msg, const char* Cond, - const char* File, unsigned Line) + const char* File, unsigned Line) { /* Output a diagnostic and abort */ AbEnd ("%s%s, file `%s', line %u", Msg, Cond, File, Line); diff --git a/src/common/check.h b/src/common/check.h index 5f8b31784..3f26be79c 100644 --- a/src/common/check.h +++ b/src/common/check.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* check.h */ +/* check.h */ /* */ -/* Assert like macros */ +/* Assert like macros */ /* */ /* */ /* */ @@ -48,16 +48,16 @@ -extern const char* MsgInternalError; /* "Internal error: " */ -extern const char* MsgPrecondition; /* "Precondition violated: " */ -extern const char* MsgCheckFailed; /* "Check failed: " */ -extern const char* MsgProgramAborted; /* "Program aborted: " */ +extern const char* MsgInternalError; /* "Internal error: " */ +extern const char* MsgPrecondition; /* "Precondition violated: " */ +extern const char* MsgCheckFailed; /* "Check failed: " */ +extern const char* MsgProgramAborted; /* "Program aborted: " */ extern void (*CheckFailed) (const char* Msg, const char* Cond, - const char* File, unsigned Line) - attribute ((noreturn)); + const char* File, unsigned Line) + attribute ((noreturn)); /* Function pointer that is called from check if the condition code is true. */ @@ -80,7 +80,7 @@ extern void (*CheckFailed) (const char* Msg, const char* Cond, #define PRECONDITION(c) \ ((void) ((c)? 0 : (CheckFailed (MsgPrecondition, #c, __FILE__, __LINE__), 0))) -#define CHECK(c) \ +#define CHECK(c) \ ((void) ((c)? 0 : (CheckFailed (MsgCheckFailed, #c, __FILE__, __LINE__), 0))) diff --git a/src/common/cmdline.c b/src/common/cmdline.c index 8ed149247..13a9da061 100644 --- a/src/common/cmdline.c +++ b/src/common/cmdline.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* cmdline.c */ +/* cmdline.c */ /* */ -/* Helper functions for command line parsing */ +/* Helper functions for command line parsing */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -62,14 +62,14 @@ unsigned ArgCount = 0; /* Struct to pass the command line */ typedef struct { char** Vec; /* The argument vector */ - unsigned Count; /* Actual number of arguments */ - unsigned Size; /* Number of argument allocated */ + unsigned Count; /* Actual number of arguments */ + unsigned Size; /* Number of argument allocated */ } CmdLine; /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -89,13 +89,13 @@ static void AddArg (CmdLine* L, char* Arg) /* Add one argument to the list */ { if (L->Size <= L->Count) { - /* No space left, reallocate */ - unsigned NewSize = L->Size * 2; - char** NewVec = xmalloc (NewSize * sizeof (L->Vec[0])); - memcpy (NewVec, L->Vec, L->Count * sizeof (L->Vec[0])); - xfree (L->Vec); - L->Vec = NewVec; - L->Size = NewSize; + /* No space left, reallocate */ + unsigned NewSize = L->Size * 2; + char** NewVec = xmalloc (NewSize * sizeof (L->Vec[0])); + memcpy (NewVec, L->Vec, L->Count * sizeof (L->Vec[0])); + xfree (L->Vec); + L->Vec = NewVec; + L->Size = NewSize; } /* We have space left, add a copy of the argument */ @@ -114,36 +114,36 @@ static void ExpandFile (CmdLine* L, const char* Name) /* Try to open the file for reading */ FILE* F = fopen (Name, "r"); if (F == 0) { - AbEnd ("Cannot open \"%s\": %s", Name, strerror (errno)); + AbEnd ("Cannot open \"%s\": %s", Name, strerror (errno)); } /* File is open, read all lines */ while (fgets (Buf, sizeof (Buf), F) != 0) { - /* Get a pointer to the buffer */ - const char* B = Buf; + /* Get a pointer to the buffer */ + const char* B = Buf; - /* Skip trailing whitespace (this will also kill the newline that is - * appended by fgets(). - */ - unsigned Len = strlen (Buf); - while (Len > 0 && IsSpace (Buf [Len-1])) { - --Len; - } - Buf [Len] = '\0'; + /* Skip trailing whitespace (this will also kill the newline that is + * appended by fgets(). + */ + unsigned Len = strlen (Buf); + while (Len > 0 && IsSpace (Buf [Len-1])) { + --Len; + } + Buf [Len] = '\0'; - /* Skip leading spaces */ - while (IsSpace (*B)) { - ++B; - } + /* Skip leading spaces */ + while (IsSpace (*B)) { + ++B; + } - /* Skip empty lines to work around problems with some editors */ - if (*B == '\0') { - continue; - } + /* Skip empty lines to work around problems with some editors */ + if (*B == '\0') { + continue; + } - /* Add anything not empty to the command line */ - AddArg (L, xstrdup (B)); + /* Add anything not empty to the command line */ + AddArg (L, xstrdup (B)); } @@ -156,7 +156,7 @@ static void ExpandFile (CmdLine* L, const char* Name) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -167,20 +167,20 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName) * array. Both arguments are remembered in static storage. */ { - CmdLine L; + CmdLine L; int I; /* Get the program name from argv[0] but strip a path */ if (*(aArgVec)[0] == 0) { - /* Use the default name given */ - ProgName = aProgName; + /* Use the default name given */ + ProgName = aProgName; } else { - /* Strip a path */ - ProgName = FindName ((*aArgVec)[0]); - if (ProgName[0] == '\0') { - /* Use the default */ - ProgName = aProgName; - } + /* Strip a path */ + ProgName = FindName ((*aArgVec)[0]); + if (ProgName[0] == '\0') { + /* Use the default */ + ProgName = aProgName; + } } /* Make a CmdLine struct */ @@ -192,21 +192,21 @@ void InitCmdLine (int* aArgCount, char** aArgVec[], const char* aProgName) */ for (I = 0; I < *aArgCount; ++I) { - /* Get the next argument */ - char* Arg = (*aArgVec)[I]; + /* Get the next argument */ + char* Arg = (*aArgVec)[I]; - /* Is this a file argument? */ - if (Arg && Arg[0] == '@') { + /* Is this a file argument? */ + if (Arg && Arg[0] == '@') { - /* Expand the file */ - ExpandFile (&L, Arg+1); + /* Expand the file */ + ExpandFile (&L, Arg+1); - } else { + } else { - /* No file, just add a copy */ - AddArg (&L, Arg); + /* No file, just add a copy */ + AddArg (&L, Arg); - } + } } /* Store the new argument list in a safe place... */ @@ -259,17 +259,17 @@ const char* GetArg (unsigned* ArgNum, unsigned Len) { const char* Arg = ArgVec[*ArgNum]; if (Arg[Len] != '\0') { - /* Argument appended */ - return Arg + Len; + /* Argument appended */ + return Arg + Len; } else { - /* Separate argument */ - Arg = ArgVec[*ArgNum + 1]; - if (Arg == 0) { - /* End of arguments */ - NeedArg (ArgVec[*ArgNum]); - } - ++(*ArgNum); - return Arg; + /* Separate argument */ + Arg = ArgVec[*ArgNum + 1]; + if (Arg == 0) { + /* End of arguments */ + NeedArg (ArgVec[*ArgNum]); + } + ++(*ArgNum); + return Arg; } } @@ -283,25 +283,25 @@ void LongOption (unsigned* ArgNum, const LongOpt* OptTab, unsigned OptCount) /* Search the table for a match */ while (OptCount) { - if (strcmp (Opt, OptTab->Option) == 0) { - /* Found, call the function */ - if (OptTab->ArgCount > 0) { - /* We need an argument, check if we have one */ - const char* Arg = ArgVec[++(*ArgNum)]; - if (Arg == 0) { - NeedArg (Opt); - } - OptTab->Func (Opt, Arg); - } else { - OptTab->Func (Opt, 0); - } - /* Done */ - return; - } + if (strcmp (Opt, OptTab->Option) == 0) { + /* Found, call the function */ + if (OptTab->ArgCount > 0) { + /* We need an argument, check if we have one */ + const char* Arg = ArgVec[++(*ArgNum)]; + if (Arg == 0) { + NeedArg (Opt); + } + OptTab->Func (Opt, Arg); + } else { + OptTab->Func (Opt, 0); + } + /* Done */ + return; + } - /* Next table entry */ - --OptCount; - ++OptTab; + /* Next table entry */ + --OptCount; + ++OptTab; } /* Invalid option */ diff --git a/src/common/cmdline.h b/src/common/cmdline.h index f2af3ef18..b3a483b6b 100644 --- a/src/common/cmdline.h +++ b/src/common/cmdline.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* cmdline.h */ +/* cmdline.h */ /* */ -/* Helper functions for command line parsing */ +/* Helper functions for command line parsing */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -56,17 +56,17 @@ extern char** ArgVec; extern unsigned ArgCount; /* Structure defining a long option */ -typedef struct LongOpt LongOpt; +typedef struct LongOpt LongOpt; struct LongOpt { - const char* Option; - unsigned ArgCount; - void (*Func) (const char* Opt, const char* Arg); + const char* Option; + unsigned ArgCount; + void (*Func) (const char* Opt, const char* Arg); }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/coll.c b/src/common/coll.c index 0fa0d152e..5112157aa 100644 --- a/src/common/coll.c +++ b/src/common/coll.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coll.c */ +/* coll.c */ /* */ -/* Collection (dynamic array) */ +/* Collection (dynamic array) */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -57,7 +57,7 @@ const Collection EmptyCollection = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -139,13 +139,13 @@ void CollInsert (Collection* C, void* Item, unsigned Index) /* Grow the array if necessary */ if (C->Count >= C->Size) { - /* Must grow */ + /* Must grow */ CollGrow (C, (C->Size == 0)? 4 : C->Size * 2); } /* Move the existing elements if needed */ if (C->Count != Index) { - memmove (C->Items+Index+1, C->Items+Index, (C->Count-Index) * sizeof (void*)); + memmove (C->Items+Index+1, C->Items+Index, (C->Count-Index) * sizeof (void*)); } ++C->Count; @@ -246,10 +246,10 @@ int CollIndex (Collection* C, const void* Item) /* Linear search */ unsigned I; for (I = 0; I < C->Count; ++I) { - if (Item == C->Items[I]) { - /* Found */ - return (int)I; - } + if (Item == C->Items[I]) { + /* Found */ + return (int)I; + } } /* Not found */ @@ -352,8 +352,8 @@ void CollMove (Collection* C, unsigned OldIndex, unsigned NewIndex) /* Correct NewIndex if needed */ if (NewIndex >= OldIndex) { - /* Position has changed with removal */ - --NewIndex; + /* Position has changed with removal */ + --NewIndex; } /* Now insert it at the new position */ @@ -378,7 +378,7 @@ void CollMoveMultiple (Collection* C, unsigned Start, unsigned Count, unsigned T /* Check for trivial parameters */ if (Count == 0 || Start == Target) { - return; + return; } /* Calculate the raw memory space used by the items to move */ @@ -396,24 +396,24 @@ void CollMoveMultiple (Collection* C, unsigned Start, unsigned Count, unsigned T */ if (Target < Start) { - /* Move downwards */ - unsigned BytesToMove = (Start - Target) * sizeof (void*); - memmove (C->Items+Target+Count, C->Items+Target, BytesToMove); + /* Move downwards */ + unsigned BytesToMove = (Start - Target) * sizeof (void*); + memmove (C->Items+Target+Count, C->Items+Target, BytesToMove); } else if (Target < Start + Count) { - /* Target is inside range */ - FAIL ("Not supported"); + /* Target is inside range */ + FAIL ("Not supported"); } else { - /* Move upwards */ - unsigned ItemsToMove = (Target - Start - Count); - unsigned BytesToMove = ItemsToMove * sizeof (void*); - memmove (C->Items+Start, C->Items+Target-ItemsToMove, BytesToMove); + /* Move upwards */ + unsigned ItemsToMove = (Target - Start - Count); + unsigned BytesToMove = ItemsToMove * sizeof (void*); + memmove (C->Items+Start, C->Items+Target-ItemsToMove, BytesToMove); - /* Adjust the target index */ - Target -= Count; + /* Adjust the target index */ + Target -= Count; } /* Move the old items to their final location */ @@ -426,8 +426,8 @@ void CollMoveMultiple (Collection* C, unsigned Start, unsigned Count, unsigned T static void QuickSort (Collection* C, int Lo, int Hi, - int (*Compare) (void*, const void*, const void*), - void* Data) + int (*Compare) (void*, const void*, const void*), + void* Data) /* Internal recursive sort function. */ { /* Get a pointer to the items */ @@ -435,37 +435,37 @@ static void QuickSort (Collection* C, int Lo, int Hi, /* Quicksort */ while (Hi > Lo) { - int I = Lo + 1; - int J = Hi; - while (I <= J) { - while (I <= J && Compare (Data, Items[Lo], Items[I]) >= 0) { - ++I; - } - while (I <= J && Compare (Data, Items[Lo], Items[J]) < 0) { - --J; - } - if (I <= J) { - /* Swap I and J */ - void* Tmp = Items[I]; - Items[I] = Items[J]; - Items[J] = Tmp; - ++I; - --J; - } - } - if (J != Lo) { - /* Swap J and Lo */ - void* Tmp = Items[J]; - Items[J] = Items[Lo]; - Items[Lo] = Tmp; - } - if (J > (Hi + Lo) / 2) { - QuickSort (C, J + 1, Hi, Compare, Data); - Hi = J - 1; - } else { - QuickSort (C, Lo, J - 1, Compare, Data); - Lo = J + 1; - } + int I = Lo + 1; + int J = Hi; + while (I <= J) { + while (I <= J && Compare (Data, Items[Lo], Items[I]) >= 0) { + ++I; + } + while (I <= J && Compare (Data, Items[Lo], Items[J]) < 0) { + --J; + } + if (I <= J) { + /* Swap I and J */ + void* Tmp = Items[I]; + Items[I] = Items[J]; + Items[J] = Tmp; + ++I; + --J; + } + } + if (J != Lo) { + /* Swap J and Lo */ + void* Tmp = Items[J]; + Items[J] = Items[Lo]; + Items[Lo] = Tmp; + } + if (J > (Hi + Lo) / 2) { + QuickSort (C, J + 1, Hi, Compare, Data); + Hi = J - 1; + } else { + QuickSort (C, Lo, J - 1, Compare, Data); + Lo = J + 1; + } } } @@ -492,8 +492,8 @@ void CollTransfer (Collection* Dest, const Collection* Source) void CollSort (Collection* C, - int (*Compare) (void*, const void*, const void*), - void* Data) + int (*Compare) (void*, const void*, const void*), + void* Data) /* Sort the collection using the given compare function. The data pointer is * passed as *first* element to the compare function, it's not used by the * sort function itself. The other two pointer passed to the Compare function @@ -501,7 +501,7 @@ void CollSort (Collection* C, */ { if (C->Count > 1) { - QuickSort (C, 0, C->Count-1, Compare, Data); + QuickSort (C, 0, C->Count-1, Compare, Data); } } diff --git a/src/common/coll.h b/src/common/coll.h index db2b5e8f0..eacfac248 100644 --- a/src/common/coll.h +++ b/src/common/coll.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* coll.h */ +/* coll.h */ /* */ -/* Collection (dynamic array) */ +/* Collection (dynamic array) */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -54,16 +54,16 @@ /* An array of pointers that grows if needed */ typedef struct Collection Collection; struct Collection { - unsigned Count; /* Number of items in the list */ - unsigned Size; /* Size of allocated array */ - void** Items; /* Array with dynamic size */ + unsigned Count; /* Number of items in the list */ + unsigned Size; /* Size of allocated array */ + void** Items; /* Array with dynamic size */ }; /* An empty collection */ extern const Collection EmptyCollection; /* Initializer for static collections */ -#define STATIC_COLLECTION_INITIALIZER { 0, 0, 0 } +#define STATIC_COLLECTION_INITIALIZER { 0, 0, 0 } /* Initializer for auto collections */ #define AUTO_COLLECTION_INITIALIZER EmptyCollection @@ -71,7 +71,7 @@ extern const Collection EmptyCollection; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -103,7 +103,7 @@ INLINE unsigned CollCount (const Collection* C) return C->Count; } #else -# define CollCount(C) (C)->Count +# define CollCount(C) (C)->Count #endif void CollInsert (Collection* C, void* Item, unsigned Index); @@ -144,7 +144,7 @@ INLINE void* CollAtUnchecked (const Collection* C, unsigned Index) return C->Items[Index]; } #else -# define CollAtUnchecked(C, Index) ((C)->Items[(Index)]) +# define CollAtUnchecked(C, Index) ((C)->Items[(Index)]) #endif #if defined(HAVE_INLINE) @@ -237,7 +237,7 @@ INLINE void CollDeleteAll (Collection* C) C->Count = 0; } #else -# define CollDeleteAll(C) ((C)->Count = 0) +# define CollDeleteAll(C) ((C)->Count = 0) #endif #if defined(HAVE_INLINE) @@ -288,8 +288,8 @@ void CollTransfer (Collection* Dest, const Collection* Source); */ void CollSort (Collection* C, - int (*Compare) (void*, const void*, const void*), - void* Data); + int (*Compare) (void*, const void*, const void*), + void* Data); /* Sort the collection using the given compare function. The data pointer is * passed as *first* element to the compare function, it's not used by the * sort function itself. The other two pointer passed to the Compare function diff --git a/src/common/cpu.c b/src/common/cpu.c index 3ac1108a5..59353a6a1 100644 --- a/src/common/cpu.c +++ b/src/common/cpu.c @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -81,7 +81,7 @@ const unsigned CPUIsets[CPU_COUNT] = { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -128,9 +128,9 @@ cpu_t FindCPU (const char* Name) /* Check all CPU names */ for (I = 0; I < CPU_COUNT; ++I) { - if (StrCaseCmp (CPUNames [I], Name) == 0) { - return (cpu_t)I; - } + if (StrCaseCmp (CPUNames [I], Name) == 0) { + return (cpu_t)I; + } } /* Not found */ diff --git a/src/common/cpu.h b/src/common/cpu.h index 64f2974b6..424053cf9 100644 --- a/src/common/cpu.h +++ b/src/common/cpu.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -53,11 +53,11 @@ typedef enum { CPU_65SC02, CPU_65C02, CPU_65816, - CPU_SUNPLUS, /* Not in the freeware version - sorry */ + CPU_SUNPLUS, /* Not in the freeware version - sorry */ CPU_SWEET16, CPU_HUC6280, /* Used in PC engine */ CPU_M740, /* Mitsubishi 740 series MCUs */ - CPU_COUNT /* Number of different CPUs */ + CPU_COUNT /* Number of different CPUs */ } cpu_t; /* CPU instruction sets */ @@ -86,7 +86,7 @@ extern const unsigned CPUIsets[CPU_COUNT]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/debugflag.c b/src/common/debugflag.c index 991f42b3a..d660018b5 100644 --- a/src/common/debugflag.c +++ b/src/common/debugflag.c @@ -44,7 +44,7 @@ -unsigned char Debug = 0; /* Debug mode */ +unsigned char Debug = 0; /* Debug mode */ diff --git a/src/common/debugflag.h b/src/common/debugflag.h index e443b6029..f62e60e82 100644 --- a/src/common/debugflag.h +++ b/src/common/debugflag.h @@ -44,7 +44,7 @@ -extern unsigned char Debug; /* Debug mode */ +extern unsigned char Debug; /* Debug mode */ diff --git a/src/common/exprdefs.c b/src/common/exprdefs.c index 4fd117dc9..69eda4c4d 100644 --- a/src/common/exprdefs.c +++ b/src/common/exprdefs.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* exprdefs.c */ +/* exprdefs.c */ /* */ -/* Expression tree definitions */ +/* Expression tree definitions */ /* */ /* */ /* */ @@ -41,7 +41,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -50,113 +50,113 @@ static void InternalDumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym /* Dump an expression in RPN to stdout */ { if (Expr == 0) { - return; + return; } InternalDumpExpr (Expr->Left, ResolveSym); InternalDumpExpr (Expr->Right, ResolveSym); switch (Expr->Op) { - case EXPR_LITERAL: - case EXPR_ULABEL: - printf (" $%04lX", Expr->V.IVal); - break; + case EXPR_LITERAL: + case EXPR_ULABEL: + printf (" $%04lX", Expr->V.IVal); + break; - case EXPR_SYMBOL: + case EXPR_SYMBOL: printf (" SYM("); if (ResolveSym && (Expr = ResolveSym (Expr->V.Sym)) != 0) { InternalDumpExpr (Expr, ResolveSym); } printf (") "); - break; + break; - case EXPR_SECTION: - printf (" SEC"); - break; + case EXPR_SECTION: + printf (" SEC"); + break; - case EXPR_SEGMENT: - printf (" SEG"); - break; + case EXPR_SEGMENT: + printf (" SEG"); + break; case EXPR_MEMAREA: printf (" MEM"); break; - case EXPR_PLUS: - printf (" +"); - break; + case EXPR_PLUS: + printf (" +"); + break; - case EXPR_MINUS: - printf (" -"); - break; + case EXPR_MINUS: + printf (" -"); + break; - case EXPR_MUL: - printf (" *"); - break; + case EXPR_MUL: + printf (" *"); + break; - case EXPR_DIV: - printf (" /"); - break; + case EXPR_DIV: + printf (" /"); + break; - case EXPR_MOD: - printf (" MOD"); - break; + case EXPR_MOD: + printf (" MOD"); + break; - case EXPR_OR: - printf (" OR"); - break; + case EXPR_OR: + printf (" OR"); + break; - case EXPR_XOR: - printf (" XOR"); - break; + case EXPR_XOR: + printf (" XOR"); + break; - case EXPR_AND: - printf (" AND"); - break; + case EXPR_AND: + printf (" AND"); + break; - case EXPR_SHL: - printf (" SHL"); - break; + case EXPR_SHL: + printf (" SHL"); + break; - case EXPR_SHR: - printf (" SHR"); - break; + case EXPR_SHR: + printf (" SHR"); + break; - case EXPR_EQ: - printf (" ="); - break; + case EXPR_EQ: + printf (" ="); + break; - case EXPR_NE: - printf ("<>"); - break; + case EXPR_NE: + printf ("<>"); + break; - case EXPR_LT: - printf (" <"); - break; + case EXPR_LT: + printf (" <"); + break; - case EXPR_GT: - printf (" >"); - break; + case EXPR_GT: + printf (" >"); + break; - case EXPR_LE: - printf (" <="); - break; + case EXPR_LE: + printf (" <="); + break; - case EXPR_GE: - printf (" >="); - break; + case EXPR_GE: + printf (" >="); + break; - case EXPR_BOOLAND: - printf (" BOOL_AND"); - break; + case EXPR_BOOLAND: + printf (" BOOL_AND"); + break; - case EXPR_BOOLOR: - printf (" BOOL_OR"); - break; + case EXPR_BOOLOR: + printf (" BOOL_OR"); + break; - case EXPR_BOOLXOR: - printf (" BOOL_XOR"); - break; + case EXPR_BOOLXOR: + printf (" BOOL_XOR"); + break; case EXPR_MAX: printf (" MAX"); @@ -166,60 +166,60 @@ static void InternalDumpExpr (const ExprNode* Expr, const ExprNode* (*ResolveSym printf (" MIN"); break; - case EXPR_UNARY_MINUS: - printf (" NEG"); - break; + case EXPR_UNARY_MINUS: + printf (" NEG"); + break; - case EXPR_NOT: - printf (" ~"); - break; + case EXPR_NOT: + printf (" ~"); + break; - case EXPR_SWAP: - printf (" SWAP"); - break; + case EXPR_SWAP: + printf (" SWAP"); + break; - case EXPR_BOOLNOT: - printf (" BOOL_NOT"); - break; + case EXPR_BOOLNOT: + printf (" BOOL_NOT"); + break; case EXPR_BANK: printf (" BANK"); break; - case EXPR_BYTE0: - printf (" BYTE0"); - break; + case EXPR_BYTE0: + printf (" BYTE0"); + break; - case EXPR_BYTE1: - printf (" BYTE1"); - break; + case EXPR_BYTE1: + printf (" BYTE1"); + break; - case EXPR_BYTE2: - printf (" BYTE2"); - break; + case EXPR_BYTE2: + printf (" BYTE2"); + break; - case EXPR_BYTE3: - printf (" BYTE3"); - break; + case EXPR_BYTE3: + printf (" BYTE3"); + break; - case EXPR_WORD0: - printf (" WORD0"); - break; + case EXPR_WORD0: + printf (" WORD0"); + break; - case EXPR_WORD1: - printf (" WORD1"); - break; + case EXPR_WORD1: + printf (" WORD1"); + break; - case EXPR_FARADDR: - printf (" FARADDR"); - break; + case EXPR_FARADDR: + printf (" FARADDR"); + break; - case EXPR_DWORD: - printf (" DWORD"); - break; + case EXPR_DWORD: + printf (" DWORD"); + break; default: - AbEnd ("Unknown Op type: %u", Expr->Op); + AbEnd ("Unknown Op type: %u", Expr->Op); } } diff --git a/src/common/exprdefs.h b/src/common/exprdefs.h index fd899d900..933677fa3 100644 --- a/src/common/exprdefs.h +++ b/src/common/exprdefs.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* exprdefs.h */ +/* exprdefs.h */ /* */ -/* Expression tree definitions */ +/* Expression tree definitions */ /* */ /* */ /* */ @@ -39,64 +39,64 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Expression type masks */ -#define EXPR_TYPEMASK 0xC0 -#define EXPR_BINARYNODE 0x00 -#define EXPR_UNARYNODE 0x40 -#define EXPR_LEAFNODE 0x80 +#define EXPR_TYPEMASK 0xC0 +#define EXPR_BINARYNODE 0x00 +#define EXPR_UNARYNODE 0x40 +#define EXPR_LEAFNODE 0x80 /* Type of expression nodes */ -#define EXPR_NULL 0x00 /* Internal error or NULL node */ +#define EXPR_NULL 0x00 /* Internal error or NULL node */ /* Leaf node codes */ -#define EXPR_LITERAL (EXPR_LEAFNODE | 0x01) -#define EXPR_SYMBOL (EXPR_LEAFNODE | 0x02) +#define EXPR_LITERAL (EXPR_LEAFNODE | 0x01) +#define EXPR_SYMBOL (EXPR_LEAFNODE | 0x02) #define EXPR_SECTION (EXPR_LEAFNODE | 0x03) -#define EXPR_SEGMENT (EXPR_LEAFNODE | 0x04) /* Linker only */ -#define EXPR_MEMAREA (EXPR_LEAFNODE | 0x05) /* Linker only */ -#define EXPR_ULABEL (EXPR_LEAFNODE | 0x06) /* Assembler only */ +#define EXPR_SEGMENT (EXPR_LEAFNODE | 0x04) /* Linker only */ +#define EXPR_MEMAREA (EXPR_LEAFNODE | 0x05) /* Linker only */ +#define EXPR_ULABEL (EXPR_LEAFNODE | 0x06) /* Assembler only */ /* Binary operations, left and right hand sides are valid */ -#define EXPR_PLUS (EXPR_BINARYNODE | 0x01) -#define EXPR_MINUS (EXPR_BINARYNODE | 0x02) -#define EXPR_MUL (EXPR_BINARYNODE | 0x03) -#define EXPR_DIV (EXPR_BINARYNODE | 0x04) -#define EXPR_MOD (EXPR_BINARYNODE | 0x05) -#define EXPR_OR (EXPR_BINARYNODE | 0x06) -#define EXPR_XOR (EXPR_BINARYNODE | 0x07) -#define EXPR_AND (EXPR_BINARYNODE | 0x08) -#define EXPR_SHL (EXPR_BINARYNODE | 0x09) -#define EXPR_SHR (EXPR_BINARYNODE | 0x0A) -#define EXPR_EQ (EXPR_BINARYNODE | 0x0B) -#define EXPR_NE (EXPR_BINARYNODE | 0x0C) -#define EXPR_LT (EXPR_BINARYNODE | 0x0D) -#define EXPR_GT (EXPR_BINARYNODE | 0x0E) -#define EXPR_LE (EXPR_BINARYNODE | 0x0F) -#define EXPR_GE (EXPR_BINARYNODE | 0x10) -#define EXPR_BOOLAND (EXPR_BINARYNODE | 0x11) -#define EXPR_BOOLOR (EXPR_BINARYNODE | 0x12) -#define EXPR_BOOLXOR (EXPR_BINARYNODE | 0x13) +#define EXPR_PLUS (EXPR_BINARYNODE | 0x01) +#define EXPR_MINUS (EXPR_BINARYNODE | 0x02) +#define EXPR_MUL (EXPR_BINARYNODE | 0x03) +#define EXPR_DIV (EXPR_BINARYNODE | 0x04) +#define EXPR_MOD (EXPR_BINARYNODE | 0x05) +#define EXPR_OR (EXPR_BINARYNODE | 0x06) +#define EXPR_XOR (EXPR_BINARYNODE | 0x07) +#define EXPR_AND (EXPR_BINARYNODE | 0x08) +#define EXPR_SHL (EXPR_BINARYNODE | 0x09) +#define EXPR_SHR (EXPR_BINARYNODE | 0x0A) +#define EXPR_EQ (EXPR_BINARYNODE | 0x0B) +#define EXPR_NE (EXPR_BINARYNODE | 0x0C) +#define EXPR_LT (EXPR_BINARYNODE | 0x0D) +#define EXPR_GT (EXPR_BINARYNODE | 0x0E) +#define EXPR_LE (EXPR_BINARYNODE | 0x0F) +#define EXPR_GE (EXPR_BINARYNODE | 0x10) +#define EXPR_BOOLAND (EXPR_BINARYNODE | 0x11) +#define EXPR_BOOLOR (EXPR_BINARYNODE | 0x12) +#define EXPR_BOOLXOR (EXPR_BINARYNODE | 0x13) #define EXPR_MAX (EXPR_BINARYNODE | 0x14) #define EXPR_MIN (EXPR_BINARYNODE | 0x15) /* Unary operations, right hand side is empty */ -#define EXPR_UNARY_MINUS (EXPR_UNARYNODE | 0x01) -#define EXPR_NOT (EXPR_UNARYNODE | 0x02) -#define EXPR_SWAP (EXPR_UNARYNODE | 0x03) -#define EXPR_BOOLNOT (EXPR_UNARYNODE | 0x04) +#define EXPR_UNARY_MINUS (EXPR_UNARYNODE | 0x01) +#define EXPR_NOT (EXPR_UNARYNODE | 0x02) +#define EXPR_SWAP (EXPR_UNARYNODE | 0x03) +#define EXPR_BOOLNOT (EXPR_UNARYNODE | 0x04) #define EXPR_BANK (EXPR_UNARYNODE | 0x05) -#define EXPR_BYTE0 (EXPR_UNARYNODE | 0x08) -#define EXPR_BYTE1 (EXPR_UNARYNODE | 0x09) -#define EXPR_BYTE2 (EXPR_UNARYNODE | 0x0A) -#define EXPR_BYTE3 (EXPR_UNARYNODE | 0x0B) -#define EXPR_WORD0 (EXPR_UNARYNODE | 0x0C) -#define EXPR_WORD1 (EXPR_UNARYNODE | 0x0D) +#define EXPR_BYTE0 (EXPR_UNARYNODE | 0x08) +#define EXPR_BYTE1 (EXPR_UNARYNODE | 0x09) +#define EXPR_BYTE2 (EXPR_UNARYNODE | 0x0A) +#define EXPR_BYTE3 (EXPR_UNARYNODE | 0x0B) +#define EXPR_WORD0 (EXPR_UNARYNODE | 0x0C) +#define EXPR_WORD1 (EXPR_UNARYNODE | 0x0D) #define EXPR_FARADDR (EXPR_UNARYNODE | 0x0E) #define EXPR_DWORD (EXPR_UNARYNODE | 0x0F) @@ -105,19 +105,19 @@ /* The expression node itself */ typedef struct ExprNode ExprNode; struct ExprNode { - unsigned char Op; /* Operand/Type */ - ExprNode* Left; /* Left leaf */ - ExprNode* Right; /* Right leaf */ - struct ObjData* Obj; /* Object file reference (linker) */ + unsigned char Op; /* Operand/Type */ + ExprNode* Left; /* Left leaf */ + ExprNode* Right; /* Right leaf */ + struct ObjData* Obj; /* Object file reference (linker) */ union { - long IVal; /* If this is a int value */ - struct SymEntry* Sym; /* If this is a symbol */ - unsigned SecNum; /* If this is a section and Obj != 0 */ + long IVal; /* If this is a int value */ + struct SymEntry* Sym; /* If this is a symbol */ + unsigned SecNum; /* If this is a section and Obj != 0 */ unsigned ImpNum; /* If this is an import and Obj != 0 */ - struct Import* Imp; /* If this is an import and Obj == 0 */ + struct Import* Imp; /* If this is an import and Obj == 0 */ struct MemoryArea* Mem; /* If this is a memory area */ - struct Segment* Seg; /* If this is a segment */ - struct Section* Sec; /* If this is a section and Obj == 0 */ + struct Segment* Seg; /* If this is a segment */ + struct Section* Sec; /* If this is a section and Obj == 0 */ } V; }; @@ -125,14 +125,14 @@ struct ExprNode { /* Macros to determine the expression type */ #define EXPR_NODETYPE(Op) ((Op) & EXPR_TYPEMASK) -#define EXPR_IS_LEAF(Op) (EXPR_NODETYPE (Op) == EXPR_LEAFNODE) -#define EXPR_IS_UNARY(Op) (EXPR_NODETYPE (Op) == EXPR_UNARYNODE) -#define EXPR_IS_BINARY(OP) (EXPR_NODETYPE (Op) == EXPR_BINARYNODE) +#define EXPR_IS_LEAF(Op) (EXPR_NODETYPE (Op) == EXPR_LEAFNODE) +#define EXPR_IS_UNARY(Op) (EXPR_NODETYPE (Op) == EXPR_UNARYNODE) +#define EXPR_IS_BINARY(OP) (EXPR_NODETYPE (Op) == EXPR_BINARYNODE) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/fileid.c b/src/common/fileid.c index d7a1fcdc8..fe26aff79 100644 --- a/src/common/fileid.c +++ b/src/common/fileid.c @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -68,7 +68,7 @@ const FileId* GetFileId (const char* Name, const FileId* Table, unsigned Count) /* Do we have an extension? */ if (Ext == 0) { - return 0; + return 0; } /* Search for a table entry and return it */ diff --git a/src/common/fileid.h b/src/common/fileid.h index 649c84844..751c4ca17 100644 --- a/src/common/fileid.h +++ b/src/common/fileid.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -49,14 +49,14 @@ */ typedef struct FileId FileId; struct FileId { - const char Ext[4]; + const char Ext[4]; int Id; }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/filepos.c b/src/common/filepos.c index 6613f8b3d..bf6888495 100644 --- a/src/common/filepos.c +++ b/src/common/filepos.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* filepos.c */ +/* filepos.c */ /* */ -/* File position data structure */ +/* File position data structure */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/filepos.h b/src/common/filepos.h index 73179ccd5..21ef2e7b0 100644 --- a/src/common/filepos.h +++ b/src/common/filepos.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* filepos.h */ +/* filepos.h */ /* */ -/* File position data structure */ +/* File position data structure */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,7 +58,7 @@ struct FilePos { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/filestat.c b/src/common/filestat.c index 27a966fa1..0f5f5cd11 100644 --- a/src/common/filestat.c +++ b/src/common/filestat.c @@ -58,7 +58,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/filestat.h b/src/common/filestat.h index 9f19188f2..50b7685ef 100644 --- a/src/common/filestat.h +++ b/src/common/filestat.h @@ -55,7 +55,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/filetime.c b/src/common/filetime.c index b621b9e57..025380759 100644 --- a/src/common/filetime.c +++ b/src/common/filetime.c @@ -51,7 +51,7 @@ /* The Windows compilers have the file in the wrong directory */ # include #else -# include /* FreeBSD needs this */ +# include /* FreeBSD needs this */ # include #endif #endif @@ -63,7 +63,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/filetime.h b/src/common/filetime.h index 3b525b734..8a27712d9 100644 --- a/src/common/filetime.h +++ b/src/common/filetime.h @@ -52,7 +52,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/filetype.c b/src/common/filetype.c index abd66911f..3e5779eb8 100644 --- a/src/common/filetype.c +++ b/src/common/filetype.c @@ -43,42 +43,42 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ static const FileId TypeTable[] = { /* Upper case stuff for obsolete operating systems */ - { "A", FILETYPE_LIB }, - { "A65", FILETYPE_ASM }, - { "ASM", FILETYPE_ASM }, - { "C", FILETYPE_C }, + { "A", FILETYPE_LIB }, + { "A65", FILETYPE_ASM }, + { "ASM", FILETYPE_ASM }, + { "C", FILETYPE_C }, { "EMD", FILETYPE_O65 }, - { "GRC", FILETYPE_GR }, + { "GRC", FILETYPE_GR }, { "JOY", FILETYPE_O65 }, - { "LIB", FILETYPE_LIB }, + { "LIB", FILETYPE_LIB }, { "MOU", FILETYPE_O65 }, - { "O", FILETYPE_OBJ }, + { "O", FILETYPE_OBJ }, { "O65", FILETYPE_O65 }, - { "OBJ", FILETYPE_OBJ }, - { "S", FILETYPE_ASM }, + { "OBJ", FILETYPE_OBJ }, + { "S", FILETYPE_ASM }, { "SER", FILETYPE_O65 }, { "TGI", FILETYPE_O65 }, - { "a", FILETYPE_LIB }, - { "a65", FILETYPE_ASM }, - { "asm", FILETYPE_ASM }, - { "c", FILETYPE_C }, + { "a", FILETYPE_LIB }, + { "a65", FILETYPE_ASM }, + { "asm", FILETYPE_ASM }, + { "c", FILETYPE_C }, { "emd", FILETYPE_O65 }, - { "grc", FILETYPE_GR }, + { "grc", FILETYPE_GR }, { "joy", FILETYPE_O65 }, - { "lib", FILETYPE_LIB }, + { "lib", FILETYPE_LIB }, { "mou", FILETYPE_O65 }, - { "o", FILETYPE_OBJ }, + { "o", FILETYPE_OBJ }, { "o65", FILETYPE_O65 }, - { "obj", FILETYPE_OBJ }, - { "s", FILETYPE_ASM }, + { "obj", FILETYPE_OBJ }, + { "s", FILETYPE_ASM }, { "ser", FILETYPE_O65 }, { "tgi", FILETYPE_O65 }, }; @@ -88,7 +88,7 @@ static const FileId TypeTable[] = { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/filetype.h b/src/common/filetype.h index 9923742cf..c1294d5f4 100644 --- a/src/common/filetype.h +++ b/src/common/filetype.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -51,14 +51,14 @@ typedef enum { FILETYPE_ASM, /* Assembler file */ FILETYPE_OBJ, /* Object file */ FILETYPE_LIB, /* Library file */ - FILETYPE_GR, /* GEOS resource file */ + FILETYPE_GR, /* GEOS resource file */ FILETYPE_O65 /* O65 object file */ } FILETYPE; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/fname.c b/src/common/fname.c index 444d4c7b1..5fd56338d 100644 --- a/src/common/fname.c +++ b/src/common/fname.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fname.c */ +/* fname.c */ /* */ -/* File name handling utilities */ +/* File name handling utilities */ /* */ /* */ /* */ @@ -41,7 +41,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -54,7 +54,7 @@ const char* FindExt (const char* Name) /* Get the length of the name */ unsigned Len = strlen (Name); if (Len < 2) { - return 0; + return 0; } /* Get a pointer to the last character */ @@ -62,14 +62,14 @@ const char* FindExt (const char* Name) /* Search for the dot, beware of subdirectories */ while (S >= Name && *S != '.' && *S != '\\' && *S != '/') { - --S; + --S; } /* Did we find an extension? */ if (*S == '.') { - return S; + return S; } else { - return 0; + return 0; } } @@ -85,7 +85,7 @@ const char* FindName (const char* Path) /* Search for the path separator */ while (Len > 0 && Path[Len-1] != '\\' && Path[Len-1] != '/') { - --Len; + --Len; } /* Return the name or path */ @@ -104,14 +104,14 @@ char* MakeFilename (const char* Origin, const char* Ext) char* Out; const char* P = FindExt (Origin); if (P == 0) { - /* No dot, add the extension */ - Out = xmalloc (strlen (Origin) + strlen (Ext) + 1); - strcpy (Out, Origin); - strcat (Out, Ext); + /* No dot, add the extension */ + Out = xmalloc (strlen (Origin) + strlen (Ext) + 1); + strcpy (Out, Origin); + strcat (Out, Ext); } else { - Out = xmalloc (P - Origin + strlen (Ext) + 1); - memcpy (Out, Origin, P - Origin); - strcpy (Out + (P - Origin), Ext); + Out = xmalloc (P - Origin + strlen (Ext) + 1); + memcpy (Out, Origin, P - Origin); + strcpy (Out + (P - Origin), Ext); } return Out; } diff --git a/src/common/fname.h b/src/common/fname.h index 4d493d78a..c9c3848f7 100644 --- a/src/common/fname.h +++ b/src/common/fname.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fname.h */ +/* fname.h */ /* */ -/* File name handling utilities */ +/* File name handling utilities */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/fp.c b/src/common/fp.c index d2c5f5218..cfec86e42 100644 --- a/src/common/fp.c +++ b/src/common/fp.c @@ -64,7 +64,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/fp.h b/src/common/fp.h index 6886d51ac..8544c453f 100644 --- a/src/common/fp.h +++ b/src/common/fp.h @@ -57,7 +57,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -76,7 +76,7 @@ union Double { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/fragdefs.h b/src/common/fragdefs.h index 2de81967a..c0a37ffcd 100644 --- a/src/common/fragdefs.h +++ b/src/common/fragdefs.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* fragdefs.h */ +/* fragdefs.h */ /* */ /* Fragment definitions for the bin65 binary utils */ /* */ @@ -39,31 +39,31 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Masks for the fragment type byte */ -#define FRAG_TYPEMASK 0x38 /* Mask the type of the fragment */ -#define FRAG_BYTEMASK 0x07 /* Mask for byte count */ +#define FRAG_TYPEMASK 0x38 /* Mask the type of the fragment */ +#define FRAG_BYTEMASK 0x07 /* Mask for byte count */ /* Fragment types */ -#define FRAG_LITERAL 0x00 /* Literal data */ +#define FRAG_LITERAL 0x00 /* Literal data */ -#define FRAG_EXPR 0x08 /* Expression */ -#define FRAG_EXPR8 (FRAG_EXPR | 1) /* 8 bit expression */ -#define FRAG_EXPR16 (FRAG_EXPR | 2) /* 16 bit expression */ -#define FRAG_EXPR24 (FRAG_EXPR | 3) /* 24 bit expression */ -#define FRAG_EXPR32 (FRAG_EXPR | 4) /* 32 bit expression */ +#define FRAG_EXPR 0x08 /* Expression */ +#define FRAG_EXPR8 (FRAG_EXPR | 1) /* 8 bit expression */ +#define FRAG_EXPR16 (FRAG_EXPR | 2) /* 16 bit expression */ +#define FRAG_EXPR24 (FRAG_EXPR | 3) /* 24 bit expression */ +#define FRAG_EXPR32 (FRAG_EXPR | 4) /* 32 bit expression */ -#define FRAG_SEXPR 0x10 /* Signed expression */ -#define FRAG_SEXPR8 (FRAG_SEXPR | 1)/* 8 bit signed expression */ -#define FRAG_SEXPR16 (FRAG_SEXPR | 2)/* 16 bit signed expression */ -#define FRAG_SEXPR24 (FRAG_SEXPR | 3)/* 24 bit signed expression */ -#define FRAG_SEXPR32 (FRAG_SEXPR | 4)/* 32 bit signed expression */ +#define FRAG_SEXPR 0x10 /* Signed expression */ +#define FRAG_SEXPR8 (FRAG_SEXPR | 1)/* 8 bit signed expression */ +#define FRAG_SEXPR16 (FRAG_SEXPR | 2)/* 16 bit signed expression */ +#define FRAG_SEXPR24 (FRAG_SEXPR | 3)/* 24 bit signed expression */ +#define FRAG_SEXPR32 (FRAG_SEXPR | 4)/* 32 bit signed expression */ -#define FRAG_FILL 0x20 /* Fill bytes */ +#define FRAG_FILL 0x20 /* Fill bytes */ diff --git a/src/common/gentype.h b/src/common/gentype.h index 5a32c2268..1a2440f46 100644 --- a/src/common/gentype.h +++ b/src/common/gentype.h @@ -63,7 +63,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/common/hashfunc.c b/src/common/hashfunc.c index a26d1635b..6774c88fc 100644 --- a/src/common/hashfunc.c +++ b/src/common/hashfunc.c @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -70,7 +70,7 @@ unsigned HashStr (const char* S) /* Do the hash */ H = L = 0; while (*S) { - H = ((H << 3) ^ ((unsigned char) *S++)) + L++; + H = ((H << 3) ^ ((unsigned char) *S++)) + L++; } return H; } @@ -85,7 +85,7 @@ unsigned HashBuf (const StrBuf* S) /* Do the hash */ H = L = 0; for (I = 0; I < SB_GetLen (S); ++I) { - H = ((H << 3) ^ ((unsigned char) SB_AtUnchecked (S, I))) + L++; + H = ((H << 3) ^ ((unsigned char) SB_AtUnchecked (S, I))) + L++; } return H; } diff --git a/src/common/hashfunc.h b/src/common/hashfunc.h index 22bd599fe..4d8b5ac7b 100644 --- a/src/common/hashfunc.h +++ b/src/common/hashfunc.h @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/hashtab.h b/src/common/hashtab.h index 0543ac087..a8397db40 100644 --- a/src/common/hashtab.h +++ b/src/common/hashtab.h @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/common/hlldbgsym.h b/src/common/hlldbgsym.h index b24c0e94a..c1e6487ce 100644 --- a/src/common/hlldbgsym.h +++ b/src/common/hlldbgsym.h @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/common/inline.h b/src/common/inline.h index 5c6dedb43..3857511a1 100644 --- a/src/common/inline.h +++ b/src/common/inline.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* inline.h */ +/* inline.h */ /* */ -/* Definitions to use the inline compiler feature */ +/* Definitions to use the inline compiler feature */ /* */ /* */ /* */ @@ -39,14 +39,14 @@ /*****************************************************************************/ -/* Defines */ +/* Defines */ /*****************************************************************************/ #if defined(__GNUC__) && !defined(DISABLE_INLINE) -# define HAVE_INLINE 1 -# define INLINE static __inline__ +# define HAVE_INLINE 1 +# define INLINE static __inline__ #endif diff --git a/src/common/libdefs.h b/src/common/libdefs.h index 6324ff4fd..19b3a8290 100644 --- a/src/common/libdefs.h +++ b/src/common/libdefs.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* libdefs.h */ +/* libdefs.h */ /* */ -/* Library file definitions */ +/* Library file definitions */ /* */ /* */ /* */ @@ -39,27 +39,27 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Defines for magic and version */ -#define LIB_MAGIC 0x7A55616E -#define LIB_VERSION 0x000D +#define LIB_MAGIC 0x7A55616E +#define LIB_VERSION 0x000D /* Size of an library file header */ -#define LIB_HDR_SIZE 12 +#define LIB_HDR_SIZE 12 /* Header structure for the library */ typedef struct LibHeader LibHeader; struct LibHeader { - unsigned long Magic; /* 32: Magic number */ - unsigned Version; /* 16: Version number */ - unsigned Flags; /* 16: flags */ - unsigned long IndexOffs; /* 32: Offset to directory */ + unsigned long Magic; /* 32: Magic number */ + unsigned Version; /* 16: Version number */ + unsigned Flags; /* 16: flags */ + unsigned long IndexOffs; /* 32: Offset to directory */ }; diff --git a/src/common/lidefs.h b/src/common/lidefs.h index 1a85dba5d..3c996f710 100644 --- a/src/common/lidefs.h +++ b/src/common/lidefs.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* lidefs.h */ +/* lidefs.h */ /* */ /* Definitions for line information */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/common/matchpat.c b/src/common/matchpat.c index c14b95da4..9ea17cdb4 100644 --- a/src/common/matchpat.c +++ b/src/common/matchpat.c @@ -76,7 +76,7 @@ typedef unsigned char CharSet[32]; /* 256 bits */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -85,10 +85,10 @@ typedef unsigned char CharSet[32]; /* 256 bits */ #define ESCAPE_CHAR '\\' /* Utility macro used in RecursiveMatch */ -#define IncPattern() Pattern++; \ - if (*Pattern == '\0') { \ - return 0; \ - } +#define IncPattern() Pattern++; \ + if (*Pattern == '\0') { \ + return 0; \ + } @@ -98,10 +98,10 @@ static int RealChar (const unsigned char* Pattern) */ { if (*Pattern == ESCAPE_CHAR) { - Pattern++; - return (*Pattern == '\0') ? -1 : *Pattern; + Pattern++; + return (*Pattern == '\0') ? -1 : *Pattern; } else { - return *Pattern; + return *Pattern; } } @@ -115,107 +115,107 @@ static int RecursiveMatch (const unsigned char* Source, const unsigned char* Pat while (1) { - if (*Pattern == '\0') { + if (*Pattern == '\0') { - /* Reached the end of Pattern, what about Source? */ - return (*Source == '\0') ? 1 : 0; + /* Reached the end of Pattern, what about Source? */ + return (*Source == '\0') ? 1 : 0; - } else if (*Pattern == '*') { + } else if (*Pattern == '*') { - if (*++Pattern == '\0') { - /* A trailing '*' is always a match */ - return 1; - } + if (*++Pattern == '\0') { + /* A trailing '*' is always a match */ + return 1; + } - /* Check the rest of the string */ - while (*Source) { - if (RecursiveMatch (Source++, Pattern)) { - /* Match! */ - return 1; - } - } + /* Check the rest of the string */ + while (*Source) { + if (RecursiveMatch (Source++, Pattern)) { + /* Match! */ + return 1; + } + } - /* No match... */ - return 0; + /* No match... */ + return 0; - } else if (*Source == '\0') { + } else if (*Source == '\0') { - /* End of Source reached, no match */ - return 0; + /* End of Source reached, no match */ + return 0; - } else { + } else { - /* Check a single char. Build a set of all possible characters in - * CS, then check if the current char of Source is contained in - * there. + /* Check a single char. Build a set of all possible characters in + * CS, then check if the current char of Source is contained in + * there. */ - CS_CLEAR (CS); /* Clear the character set */ + CS_CLEAR (CS); /* Clear the character set */ - if (*Pattern == '?') { + if (*Pattern == '?') { - /* All chars are allowed */ - CS_SETALL (CS); - ++Pattern; /* Skip '?' */ + /* All chars are allowed */ + CS_SETALL (CS); + ++Pattern; /* Skip '?' */ - } else if (*Pattern == ESCAPE_CHAR) { + } else if (*Pattern == ESCAPE_CHAR) { - /* Use the next char as is */ - IncPattern (); - CS_ADD (CS, *Pattern); - ++Pattern; /* Skip the character */ + /* Use the next char as is */ + IncPattern (); + CS_ADD (CS, *Pattern); + ++Pattern; /* Skip the character */ - } else if (*Pattern == '[') { + } else if (*Pattern == '[') { - /* A set follows */ - int Invert = 0; - IncPattern (); - if (*Pattern == '!') { - IncPattern (); - Invert = 1; - } - while (*Pattern != ']') { + /* A set follows */ + int Invert = 0; + IncPattern (); + if (*Pattern == '!') { + IncPattern (); + Invert = 1; + } + while (*Pattern != ']') { - int C1; - if ((C1 = RealChar (Pattern)) == -1) { - return 0; - } - IncPattern (); - if (*Pattern != '-') { - CS_ADD (CS, C1); - } else { - int C2; + int C1; + if ((C1 = RealChar (Pattern)) == -1) { + return 0; + } + IncPattern (); + if (*Pattern != '-') { + CS_ADD (CS, C1); + } else { + int C2; unsigned char C; - IncPattern (); - if ((C2 = RealChar (Pattern)) == -1) { - return 0; - } - IncPattern (); - for (C = C1; C <= C2; C++) { - CS_ADD (CS, C); - } - } - } + IncPattern (); + if ((C2 = RealChar (Pattern)) == -1) { + return 0; + } + IncPattern (); + for (C = C1; C <= C2; C++) { + CS_ADD (CS, C); + } + } + } /* Skip ']' */ - ++Pattern; - if (Invert) { + ++Pattern; + if (Invert) { /* Reverse all bits in the set */ - CS_INVERT (CS); - } + CS_INVERT (CS); + } - } else { + } else { - /* Include the char in the charset, then skip it */ - CS_ADD (CS, *Pattern); - ++Pattern; + /* Include the char in the charset, then skip it */ + CS_ADD (CS, *Pattern); + ++Pattern; - } + } - if (!CS_CONTAINS (CS, *Source)) { - /* No match */ - return 0; - } - ++Source; - } + if (!CS_CONTAINS (CS, *Source)) { + /* No match */ + return 0; + } + ++Source; + } } } @@ -232,7 +232,7 @@ int MatchPattern (const char* Source, const char* Pattern) { /* Handle the trivial cases */ if (Pattern == 0 || *Pattern == '\0') { - return (Source == 0 || *Source == '\0'); + return (Source == 0 || *Source == '\0'); } /* Do the real thing */ diff --git a/src/common/matchpat.h b/src/common/matchpat.h index b71205599..ddf431ff9 100644 --- a/src/common/matchpat.h +++ b/src/common/matchpat.h @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/mmodel.c b/src/common/mmodel.c index 66a93ada9..7ed0f9b3f 100644 --- a/src/common/mmodel.c +++ b/src/common/mmodel.c @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -65,7 +65,7 @@ unsigned char ZpAddrSize = ADDR_SIZE_ZP; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -77,9 +77,9 @@ mmodel_t FindMemoryModel (const char* Name) /* Check all CPU names */ for (I = 0; I < MMODEL_COUNT; ++I) { - if (strcmp (MemoryModelNames[I], Name) == 0) { - return (mmodel_t)I; - } + if (strcmp (MemoryModelNames[I], Name) == 0) { + return (mmodel_t)I; + } } /* Not found */ diff --git a/src/common/mmodel.h b/src/common/mmodel.h index 098d03412..043e93037 100644 --- a/src/common/mmodel.h +++ b/src/common/mmodel.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -64,7 +64,7 @@ extern unsigned char ZpAddrSize; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/objdefs.h b/src/common/objdefs.h index aa3c4a198..608a4dc62 100644 --- a/src/common/objdefs.h +++ b/src/common/objdefs.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objdefs.h */ +/* objdefs.h */ /* */ -/* Object file definitions */ +/* Object file definitions */ /* */ /* */ /* */ @@ -39,20 +39,20 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Defines for magic and version */ -#define OBJ_MAGIC 0x616E7A55 -#define OBJ_VERSION 0x0011 +#define OBJ_MAGIC 0x616E7A55 +#define OBJ_VERSION 0x0011 /* Size of an object file header */ -#define OBJ_HDR_SIZE (24*4) +#define OBJ_HDR_SIZE (24*4) /* Flag bits */ -#define OBJ_FLAGS_DBGINFO 0x0001 /* File has debug info */ +#define OBJ_FLAGS_DBGINFO 0x0001 /* File has debug info */ #define OBJ_HAS_DBGINFO(x) (((x) & OBJ_FLAGS_DBGINFO) != 0) @@ -60,21 +60,21 @@ /* Header structure */ typedef struct ObjHeader ObjHeader; struct ObjHeader { - unsigned long Magic; /* 32: Magic number */ - unsigned Version; /* 16: Version number */ - unsigned Flags; /* 16: flags */ - unsigned long OptionOffs; /* 32: Offset to option table */ - unsigned long OptionSize; /* 32: Size of options */ - unsigned long FileOffs; /* 32: Offset to file table */ - unsigned long FileSize; /* 32: Size of files */ - unsigned long SegOffs; /* 32: Offset to segment table */ - unsigned long SegSize; /* 32: Size of segment table */ - unsigned long ImportOffs; /* 32: Offset to import list */ - unsigned long ImportSize; /* 32: Size of import list */ - unsigned long ExportOffs; /* 32: Offset to export list */ - unsigned long ExportSize; /* 32: Size of export list */ - unsigned long DbgSymOffs; /* 32: Offset to list of debug symbols */ - unsigned long DbgSymSize; /* 32: Size of debug symbols */ + unsigned long Magic; /* 32: Magic number */ + unsigned Version; /* 16: Version number */ + unsigned Flags; /* 16: flags */ + unsigned long OptionOffs; /* 32: Offset to option table */ + unsigned long OptionSize; /* 32: Size of options */ + unsigned long FileOffs; /* 32: Offset to file table */ + unsigned long FileSize; /* 32: Size of files */ + unsigned long SegOffs; /* 32: Offset to segment table */ + unsigned long SegSize; /* 32: Size of segment table */ + unsigned long ImportOffs; /* 32: Offset to import list */ + unsigned long ImportSize; /* 32: Size of import list */ + unsigned long ExportOffs; /* 32: Offset to export list */ + unsigned long ExportSize; /* 32: Size of export list */ + unsigned long DbgSymOffs; /* 32: Offset to list of debug symbols */ + unsigned long DbgSymSize; /* 32: Size of debug symbols */ unsigned long LineInfoOffs; /* 32: Offset to list of line infos */ unsigned long LineInfoSize; /* 32: Size of line infos */ unsigned long StrPoolOffs; /* 32: Offset to string pool */ diff --git a/src/common/optdefs.h b/src/common/optdefs.h index 3fc525cc2..55264ca88 100644 --- a/src/common/optdefs.h +++ b/src/common/optdefs.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* optdefs.h */ +/* optdefs.h */ /* */ -/* Definitions for object file options */ +/* Definitions for object file options */ /* */ /* */ /* */ @@ -39,32 +39,32 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Type of options */ -#define OPT_ARGMASK 0xC0 /* Mask for argument */ -#define OPT_ARGSTR 0x00 /* String argument */ -#define OPT_ARGNUM 0x40 /* Numerical argument */ +#define OPT_ARGMASK 0xC0 /* Mask for argument */ +#define OPT_ARGSTR 0x00 /* String argument */ +#define OPT_ARGNUM 0x40 /* Numerical argument */ -#define OPT_COMMENT (OPT_ARGSTR+0) /* Generic comment */ -#define OPT_AUTHOR (OPT_ARGSTR+1) /* Author specification */ -#define OPT_TRANSLATOR (OPT_ARGSTR+2) /* Translator specification */ -#define OPT_COMPILER (OPT_ARGSTR+3) /* Compiler specification */ -#define OPT_OS (OPT_ARGSTR+4) /* Operating system specification */ +#define OPT_COMMENT (OPT_ARGSTR+0) /* Generic comment */ +#define OPT_AUTHOR (OPT_ARGSTR+1) /* Author specification */ +#define OPT_TRANSLATOR (OPT_ARGSTR+2) /* Translator specification */ +#define OPT_COMPILER (OPT_ARGSTR+3) /* Compiler specification */ +#define OPT_OS (OPT_ARGSTR+4) /* Operating system specification */ -#define OPT_DATETIME (OPT_ARGNUM+0) /* Date/time of translation */ +#define OPT_DATETIME (OPT_ARGNUM+0) /* Date/time of translation */ /* Structure to encode options */ typedef struct Option Option; struct Option { - Option* Next; /* For list of options */ - unsigned char Type; /* Type of option */ - unsigned long Val; /* Value attribute or string index */ + Option* Next; /* For list of options */ + unsigned char Type; /* Type of option */ + unsigned long Val; /* Value attribute or string index */ }; diff --git a/src/common/print.c b/src/common/print.c index 48004d226..53b2aa210 100644 --- a/src/common/print.c +++ b/src/common/print.c @@ -1,12 +1,12 @@ /*****************************************************************************/ /* */ -/* print.c */ +/* print.c */ /* */ -/* Program output */ +/* Program output */ /* */ /* */ /* */ -/* (C) 2001 Ullrich von Bassewitz */ +/* (C) 2001 Ullrich von Bassewitz */ /* Wacholderweg 14 */ /* D-70597 Stuttgart */ /* EMail: uz@musoftware.de */ @@ -41,17 +41,17 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -unsigned char Verbosity = 0; /* Verbose operation flag */ +unsigned char Verbosity = 0; /* Verbose operation flag */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -63,8 +63,8 @@ void Print (FILE* F, unsigned V, const char* Format, ...) /* Check the verbosity */ if (V > Verbosity) { - /* Don't output this message */ - return; + /* Don't output this message */ + return; } /* Output */ diff --git a/src/common/print.h b/src/common/print.h index cd5a1d20d..92b654910 100644 --- a/src/common/print.h +++ b/src/common/print.h @@ -1,12 +1,12 @@ /*****************************************************************************/ /* */ -/* print.h */ +/* print.h */ /* */ -/* Program output */ +/* Program output */ /* */ /* */ /* */ -/* (C) 2001 Ullrich von Bassewitz */ +/* (C) 2001 Ullrich von Bassewitz */ /* Wacholderweg 14 */ /* D-70597 Stuttgart */ /* EMail: uz@musoftware.de */ @@ -46,23 +46,23 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -extern unsigned char Verbosity; /* Verbose operation flag */ +extern unsigned char Verbosity; /* Verbose operation flag */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ void Print (FILE* F, unsigned V, const char* Format, ...) - attribute ((format (printf, 3, 4))); + attribute ((format (printf, 3, 4))); /* Output according to Verbosity */ diff --git a/src/common/scopedefs.h b/src/common/scopedefs.h index d1a0cec46..08a7f5ec8 100644 --- a/src/common/scopedefs.h +++ b/src/common/scopedefs.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* symdefs.h */ +/* symdefs.h */ /* */ /* Scope definitions for the bin65 binary utils */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/common/searchpath.c b/src/common/searchpath.c index bd3a1f603..16945f36d 100644 --- a/src/common/searchpath.c +++ b/src/common/searchpath.c @@ -53,7 +53,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -69,7 +69,7 @@ static char* CleanupPath (const char* Path) /* Check for a trailing path separator and remove it */ if (Len > 0 && (Path[Len-1] == '\\' || Path[Len-1] == '/')) { - --Len; + --Len; } /* Allocate memory for the new string */ @@ -130,8 +130,8 @@ void AddSubSearchPathFromEnv (SearchPath* P, const char* EnvVar, const char* Sub const char* EnvVal = getenv (EnvVar); if (EnvVal == 0) { - /* Not found */ - return; + /* Not found */ + return; } /* Copy the environment variable to the buffer */ @@ -139,9 +139,9 @@ void AddSubSearchPathFromEnv (SearchPath* P, const char* EnvVar, const char* Sub /* Add a path separator if necessary */ if (SB_NotEmpty (&Dir)) { - if (SB_LookAtLast (&Dir) != '\\' && SB_LookAtLast (&Dir) != '/') { - SB_AppendChar (&Dir, '/'); - } + if (SB_LookAtLast (&Dir) != '\\' && SB_LookAtLast (&Dir) != '/') { + SB_AppendChar (&Dir, '/'); + } } /* Add the subdirectory and terminate the string */ @@ -252,19 +252,19 @@ char* SearchFile (const SearchPath* P, const char* File) /* Copy the next path element into the buffer */ SB_CopyStr (&PathName, CollConstAt (P, I)); - /* Add a path separator and the filename */ - if (SB_NotEmpty (&PathName)) { - SB_AppendChar (&PathName, '/'); - } - SB_AppendStr (&PathName, File); - SB_Terminate (&PathName); + /* Add a path separator and the filename */ + if (SB_NotEmpty (&PathName)) { + SB_AppendChar (&PathName, '/'); + } + SB_AppendStr (&PathName, File); + SB_Terminate (&PathName); - /* Check if this file exists */ - if (access (SB_GetBuf (&PathName), 0) == 0) { - /* The file exists, we're done */ - Name = xstrdup (SB_GetBuf (&PathName)); + /* Check if this file exists */ + if (access (SB_GetBuf (&PathName), 0) == 0) { + /* The file exists, we're done */ + Name = xstrdup (SB_GetBuf (&PathName)); break; - } + } } /* Cleanup and return the result of the search */ diff --git a/src/common/searchpath.h b/src/common/searchpath.h index fb5aa092f..555a0e18e 100644 --- a/src/common/searchpath.h +++ b/src/common/searchpath.h @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,7 +58,7 @@ typedef struct Collection SearchPath; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/segdefs.h b/src/common/segdefs.h index 62fb7d557..e8f6883f6 100644 --- a/src/common/segdefs.h +++ b/src/common/segdefs.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* segdefs.h */ +/* segdefs.h */ /* */ /* Constants and flags for segments */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/common/segnames.c b/src/common/segnames.c index 78993589c..2bed984ed 100644 --- a/src/common/segnames.c +++ b/src/common/segnames.c @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -52,14 +52,14 @@ int ValidSegName (const char* Name) { /* Must start with '_' or a letter */ if ((*Name != '_' && !IsAlpha(*Name)) || strlen(Name) > 80) { - return 0; + return 0; } /* Can have letters, digits or the underline */ while (*++Name) { - if (*Name != '_' && !IsAlNum(*Name)) { - return 0; - } + if (*Name != '_' && !IsAlNum(*Name)) { + return 0; + } } /* Name is ok */ diff --git a/src/common/segnames.h b/src/common/segnames.h index 3b0e20a57..071cb387b 100644 --- a/src/common/segnames.h +++ b/src/common/segnames.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -55,7 +55,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/shift.c b/src/common/shift.c index 176a68c30..156dbd22c 100644 --- a/src/common/shift.c +++ b/src/common/shift.c @@ -55,7 +55,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/shift.h b/src/common/shift.h index c3f36930d..4bf96e335 100644 --- a/src/common/shift.h +++ b/src/common/shift.h @@ -57,7 +57,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/strbuf.c b/src/common/strbuf.c index 741fc4887..029fe5ad4 100644 --- a/src/common/strbuf.c +++ b/src/common/strbuf.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* strbuf.c */ +/* strbuf.c */ /* */ -/* Variable sized string buffers */ +/* Variable sized string buffers */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -57,7 +57,7 @@ const StrBuf EmptyStrBuf = STATIC_STRBUF_INITIALIZER; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -132,12 +132,12 @@ void SB_Realloc (StrBuf* B, unsigned NewSize) /* Get the current size, use a minimum of 8 bytes */ unsigned NewAllocated = B->Allocated; if (NewAllocated == 0) { - NewAllocated = 8; + NewAllocated = 8; } /* Round up to the next power of two */ while (NewAllocated < NewSize) { - NewAllocated *= 2; + NewAllocated *= 2; } /* Reallocate the buffer. Beware: The allocated size may be zero while the @@ -167,12 +167,12 @@ static void SB_CheapRealloc (StrBuf* B, unsigned NewSize) /* Get the current size, use a minimum of 8 bytes */ unsigned NewAllocated = B->Allocated; if (NewAllocated == 0) { - NewAllocated = 8; + NewAllocated = 8; } /* Round up to the next power of two */ while (NewAllocated < NewSize) { - NewAllocated *= 2; + NewAllocated *= 2; } /* Free the old buffer if there is one */ @@ -219,7 +219,7 @@ void SB_Terminate (StrBuf* B) { unsigned NewLen = B->Len + 1; if (NewLen > B->Allocated) { - SB_Realloc (B, NewLen); + SB_Realloc (B, NewLen); } B->Buf[B->Len] = '\0'; } @@ -266,7 +266,7 @@ void SB_AppendChar (StrBuf* B, int C) { unsigned NewLen = B->Len + 1; if (NewLen > B->Allocated) { - SB_Realloc (B, NewLen); + SB_Realloc (B, NewLen); } B->Buf[B->Len] = (char) C; B->Len = NewLen; @@ -279,7 +279,7 @@ void SB_AppendBuf (StrBuf* B, const char* S, unsigned Size) { unsigned NewLen = B->Len + Size; if (NewLen > B->Allocated) { - SB_Realloc (B, NewLen); + SB_Realloc (B, NewLen); } memcpy (B->Buf + B->Len, S, Size); B->Len = NewLen; @@ -314,7 +314,7 @@ void SB_Cut (StrBuf* B, unsigned Len) */ { if (Len < B->Len) { - B->Len = Len; + B->Len = Len; } } #endif @@ -330,17 +330,17 @@ void SB_Slice (StrBuf* Target, const StrBuf* Source, unsigned Start, unsigned Le { /* Calculate the length of the resulting buffer */ if (Start >= Source->Len) { - /* Target will be empty */ - SB_Clear (Target); - return; + /* Target will be empty */ + SB_Clear (Target); + return; } if (Start + Len > Source->Len) { - Len = Source->Len - Start; + Len = Source->Len - Start; } /* Make sure we have enough room in the target string buffer */ if (Len > Target->Allocated) { - SB_Realloc (Target, Len); + SB_Realloc (Target, Len); } /* Copy the slice */ diff --git a/src/common/strbuf.h b/src/common/strbuf.h index 0bd0a7f7e..4d90637d5 100644 --- a/src/common/strbuf.h +++ b/src/common/strbuf.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* strbuf.h */ +/* strbuf.h */ /* */ -/* Variable sized string buffers */ +/* Variable sized string buffers */ /* */ /* */ /* */ @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -66,7 +66,7 @@ struct StrBuf { extern const StrBuf EmptyStrBuf; /* Initializer for static string bufs */ -#define STATIC_STRBUF_INITIALIZER { 0, 0, 0, 0 } +#define STATIC_STRBUF_INITIALIZER { 0, 0, 0, 0 } /* Initializer for auto string bufs */ #define AUTO_STRBUF_INITIALIZER { 0, 0, 0, 0 } @@ -77,7 +77,7 @@ extern const StrBuf EmptyStrBuf; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -368,7 +368,7 @@ INLINE void SB_Cut (StrBuf* B, unsigned Len) */ { if (Len < B->Len) { - B->Len = Len; + B->Len = Len; } } #else diff --git a/src/common/strutil.c b/src/common/strutil.c index b98e911e3..1cab51869 100644 --- a/src/common/strutil.c +++ b/src/common/strutil.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* strutil.h */ +/* strutil.h */ /* */ -/* String utility functions */ +/* String utility functions */ /* */ /* */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -56,9 +56,9 @@ char* StrCopy (char* Dest, size_t DestSize, const char* Source) size_t Len = strlen (Source); if (Len >= DestSize) { memcpy (Dest, Source, DestSize-1); - Dest[DestSize-1] = '\0'; + Dest[DestSize-1] = '\0'; } else { - memcpy (Dest, Source, Len+1); + memcpy (Dest, Source, Len+1); } return Dest; } diff --git a/src/common/strutil.h b/src/common/strutil.h index f32a2bfa4..24daa222a 100644 --- a/src/common/strutil.h +++ b/src/common/strutil.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* strutil.h */ +/* strutil.h */ /* */ -/* String utility functions */ +/* String utility functions */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/symdefs.h b/src/common/symdefs.h index 7520af218..fbe0bc168 100644 --- a/src/common/symdefs.h +++ b/src/common/symdefs.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* symdefs.h */ +/* symdefs.h */ /* */ -/* Symbol definitions for the bin65 binary utils */ +/* Symbol definitions for the bin65 binary utils */ /* */ /* */ /* */ @@ -43,15 +43,15 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Number of module constructor/destructor declarations for an export */ -#define SYM_CONDES_MASK 0x0007U +#define SYM_CONDES_MASK 0x0007U -#define SYM_IS_CONDES(x) (((x) & SYM_CONDES_MASK) != 0) +#define SYM_IS_CONDES(x) (((x) & SYM_CONDES_MASK) != 0) #define SYM_GET_CONDES_COUNT(x) ((x) & SYM_CONDES_MASK) #define SYM_INC_CONDES_COUNT(x) ((x)++) @@ -63,12 +63,12 @@ #define SYM_HAS_SIZE(x) (((x) & SYM_MASK_SIZE) == SYM_SIZE) /* Symbol value type */ -#define SYM_CONST 0x0000U /* Mask bit for const values */ -#define SYM_EXPR 0x0010U /* Mask bit for expr values */ -#define SYM_MASK_VAL 0x0010U /* Value mask */ +#define SYM_CONST 0x0000U /* Mask bit for const values */ +#define SYM_EXPR 0x0010U /* Mask bit for expr values */ +#define SYM_MASK_VAL 0x0010U /* Value mask */ -#define SYM_IS_CONST(x) (((x) & SYM_MASK_VAL) == SYM_CONST) -#define SYM_IS_EXPR(x) (((x) & SYM_MASK_VAL) == SYM_EXPR) +#define SYM_IS_CONST(x) (((x) & SYM_MASK_VAL) == SYM_CONST) +#define SYM_IS_EXPR(x) (((x) & SYM_MASK_VAL) == SYM_EXPR) /* Symbol usage */ #define SYM_EQUATE 0x0000U /* Mask bit for an equate */ diff --git a/src/common/target.c b/src/common/target.c index 79c9f8555..d42d82429 100644 --- a/src/common/target.c +++ b/src/common/target.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* target.c */ +/* target.c */ /* */ -/* Target specification */ +/* Target specification */ /* */ /* */ /* */ @@ -175,12 +175,12 @@ static const TargetProperties PropertyTable[TGT_COUNT] = { }; /* Target system */ -target_t Target = TGT_NONE; +target_t Target = TGT_NONE; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/target.h b/src/common/target.h index 0ac5564e5..07bc55d49 100644 --- a/src/common/target.h +++ b/src/common/target.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* target.h */ +/* target.h */ /* */ -/* Target specification */ +/* Target specification */ /* */ /* */ /* */ @@ -44,14 +44,14 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Supported target systems */ typedef enum { - TGT_UNKNOWN = -1, /* Not specified or invalid target */ + TGT_UNKNOWN = -1, /* Not specified or invalid target */ TGT_NONE, TGT_MODULE, TGT_ATARI, @@ -73,7 +73,7 @@ typedef enum { TGT_NES, TGT_SUPERVISION, TGT_LYNX, - TGT_COUNT /* Number of target systems */ + TGT_COUNT /* Number of target systems */ } target_t; /* Collection of target properties */ @@ -86,17 +86,17 @@ struct TargetProperties { }; /* Target system */ -extern target_t Target; +extern target_t Target; /* Types of available output formats */ -#define BINFMT_DEFAULT 0 /* Default (binary) */ -#define BINFMT_BINARY 1 /* Straight binary format */ -#define BINFMT_O65 2 /* Andre Fachats o65 format */ +#define BINFMT_DEFAULT 0 /* Default (binary) */ +#define BINFMT_BINARY 1 /* Straight binary format */ +#define BINFMT_O65 2 /* Andre Fachats o65 format */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/tgttrans.c b/src/common/tgttrans.c index dff5238e1..a1b61cbd3 100644 --- a/src/common/tgttrans.c +++ b/src/common/tgttrans.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* tgttrans.c */ +/* tgttrans.c */ /* */ -/* Character set translation */ +/* Character set translation */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -71,7 +71,7 @@ static unsigned char Tab[256] = { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -104,8 +104,8 @@ void TgtTranslateBuf (void* Buf, unsigned Len) /* Translate */ unsigned char* B = (unsigned char*)Buf; while (Len--) { - *B = Tab[*B]; - ++B; + *B = Tab[*B]; + ++B; } } diff --git a/src/common/tgttrans.h b/src/common/tgttrans.h index 6a54cfc4a..e4f08f71a 100644 --- a/src/common/tgttrans.h +++ b/src/common/tgttrans.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* tgttrans.h */ +/* tgttrans.h */ /* */ -/* Character set translation */ +/* Character set translation */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/version.c b/src/common/version.c index 3b0cb9b02..7264e79ef 100644 --- a/src/common/version.c +++ b/src/common/version.c @@ -1,34 +1,34 @@ /*****************************************************************************/ -/* */ -/* version.c */ -/* */ -/* Version information for the cc65 compiler package */ -/* */ -/* */ -/* */ +/* */ +/* version.c */ +/* */ +/* Version information for the cc65 compiler package */ +/* */ +/* */ +/* */ /* (C) 1998-2009, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -39,13 +39,13 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -#define VER_MAJOR 2U -#define VER_MINOR 13U +#define VER_MAJOR 2U +#define VER_MINOR 13U #define VER_PATCH 9U #define VER_RC 0U diff --git a/src/common/version.h b/src/common/version.h index 0039b2a60..edf5d2c56 100644 --- a/src/common/version.h +++ b/src/common/version.h @@ -1,34 +1,34 @@ /*****************************************************************************/ -/* */ -/* version.h */ -/* */ -/* Version information for the cc65 compiler package */ -/* */ -/* */ -/* */ +/* */ +/* version.h */ +/* */ +/* Version information for the cc65 compiler package */ +/* */ +/* */ +/* */ /* (C) 1998-2009, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ diff --git a/src/common/xmalloc.c b/src/common/xmalloc.c index a50ad1653..1a7b915ab 100644 --- a/src/common/xmalloc.c +++ b/src/common/xmalloc.c @@ -1,34 +1,34 @@ /*****************************************************************************/ -/* */ -/* xmalloc.c */ /* */ -/* Memory allocation subroutines */ -/* */ -/* */ -/* */ +/* xmalloc.c */ +/* */ +/* Memory allocation subroutines */ +/* */ +/* */ +/* */ /* (C) 2000-2006 Ullrich von Bassewitz */ /* Römerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* code */ +/* code */ /*****************************************************************************/ @@ -81,7 +81,7 @@ void* xrealloc (void* P, size_t Size) /* Check for errors */ if (N == 0 && Size != 0) { - AbEnd ("Out of memory in realloc - requested block size = %lu", (unsigned long) Size); + AbEnd ("Out of memory in realloc - requested block size = %lu", (unsigned long) Size); } /* Return the pointer to the new block */ @@ -104,16 +104,16 @@ char* xstrdup (const char* S) /* Allow dup'ing of NULL strings */ if (S) { - /* Get the length of the string */ - unsigned Len = strlen (S) + 1; + /* Get the length of the string */ + unsigned Len = strlen (S) + 1; - /* Allocate memory and return a copy */ - return memcpy (xmalloc (Len), S, Len); + /* Allocate memory and return a copy */ + return memcpy (xmalloc (Len), S, Len); } else { - /* Return a NULL pointer */ - return 0; + /* Return a NULL pointer */ + return 0; } } diff --git a/src/common/xmalloc.h b/src/common/xmalloc.h index 5482302ed..3979a9617 100644 --- a/src/common/xmalloc.h +++ b/src/common/xmalloc.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* xmalloc.h */ +/* xmalloc.h */ /* */ -/* Memory allocation subroutines */ +/* Memory allocation subroutines */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/xsprintf.c b/src/common/xsprintf.c index 0a0727e09..c33f32b24 100644 --- a/src/common/xsprintf.c +++ b/src/common/xsprintf.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* xsprintf.c */ +/* xsprintf.c */ /* */ -/* Replacement sprintf function */ +/* Replacement sprintf function */ /* */ /* */ /* */ @@ -649,7 +649,7 @@ int xsnprintf (char* Buf, size_t Size, const char* Format, ...) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/common/xsprintf.h b/src/common/xsprintf.h index cc32d4620..07672c5c4 100644 --- a/src/common/xsprintf.h +++ b/src/common/xsprintf.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* xsprintf.h */ +/* xsprintf.h */ /* */ -/* Replacement sprintf function */ +/* Replacement sprintf function */ /* */ /* */ /* */ @@ -58,29 +58,29 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ int xvsnprintf (char* Buf, size_t Size, const char* Format, va_list ap) - attribute ((format (printf, 3, 0))); + attribute ((format (printf, 3, 0))); /* A basic vsnprintf implementation. Does currently only support integer * formats. */ int xsnprintf (char* Buf, size_t Size, const char* Format, ...) - attribute ((format (printf, 3, 4))); + attribute ((format (printf, 3, 4))); /* A basic snprintf implementation. Does currently only support integer * formats. */ int xsprintf (char* Buf, size_t BufSize, const char* Format, ...) - attribute ((format (printf, 3, 4))); + attribute ((format (printf, 3, 4))); /* Replacement function for sprintf. Will FAIL on errors. */ int xvsprintf (char* Buf, size_t BufSize, const char* Format, va_list ap) - attribute ((format (printf, 3, 0))); + attribute ((format (printf, 3, 0))); /* Replacement function for sprintf. Will FAIL on errors. */ diff --git a/src/da65/asminc.c b/src/da65/asminc.c index 22e1ff387..079b751ba 100644 --- a/src/da65/asminc.c +++ b/src/da65/asminc.c @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -84,7 +84,7 @@ void AsmInc (const char* Filename, char CommentStart, int IgnoreUnknown) char* L; const char* Comment; unsigned Line; - unsigned Len; + unsigned Len; long Val; unsigned DVal; int Sign; @@ -111,12 +111,12 @@ void AsmInc (const char* Filename, char CommentStart, int IgnoreUnknown) ++L; } - /* Remove trailing whitespace */ - Len = strlen (L); - while (Len > 0 && IsSpace (L[Len-1])) { - --Len; - } - L[Len] = '\0'; + /* Remove trailing whitespace */ + Len = strlen (L); + while (Len > 0 && IsSpace (L[Len-1])) { + --Len; + } + L[Len] = '\0'; /* If the line is empty or starts with a comment char, ignore it */ if (*L == '\0' || *L == CommentStart) { @@ -147,11 +147,11 @@ void AsmInc (const char* Filename, char CommentStart, int IgnoreUnknown) } else if (*L == ':' && *++L == '=') { ++L; } else { - if (!IgnoreUnknown) { - Error ("%s(%u): Missing `='", Filename, Line); - } - continue; - } + if (!IgnoreUnknown) { + Error ("%s(%u): Missing `='", Filename, Line); + } + continue; + } /* Allow white space once again */ L = SkipWhitespace (L); diff --git a/src/da65/asminc.h b/src/da65/asminc.h index 7b5c553e8..8c375b67e 100644 --- a/src/da65/asminc.h +++ b/src/da65/asminc.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/attrtab.c b/src/da65/attrtab.c index 61ed6b440..07a47b72e 100644 --- a/src/da65/attrtab.c +++ b/src/da65/attrtab.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* attrtab.c */ +/* attrtab.c */ /* */ -/* Disassembler attribute table */ +/* Disassembler attribute table */ /* */ /* */ /* */ @@ -40,7 +40,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -51,7 +51,7 @@ static unsigned short AttrTab[0x10000]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -60,7 +60,7 @@ void AddrCheck (unsigned Addr) /* Check if the given address has a valid range */ { if (Addr >= 0x10000) { - Error ("Address out of range: %08X", Addr); + Error ("Address out of range: %08X", Addr); } } @@ -95,21 +95,21 @@ unsigned GetGranularity (attr_t Style) /* Get the granularity for the given style */ { switch (Style) { - case atDefault: return 1; - case atCode: return 1; - case atIllegal: return 1; - case atByteTab: return 1; - case atDByteTab: return 2; - case atWordTab: return 2; - case atDWordTab: return 4; - case atAddrTab: return 2; - case atRtsTab: return 2; - case atTextTab: return 1; + case atDefault: return 1; + case atCode: return 1; + case atIllegal: return 1; + case atByteTab: return 1; + case atDByteTab: return 2; + case atWordTab: return 2; + case atDWordTab: return 4; + case atAddrTab: return 2; + case atRtsTab: return 2; + case atTextTab: return 1; - case atSkip: - default: - Internal ("GetGraularity called for style = %d", Style); - return 0; + case atSkip: + default: + Internal ("GetGraularity called for style = %d", Style); + return 0; } } @@ -120,7 +120,7 @@ void MarkRange (unsigned Start, unsigned End, attr_t Attr) { /* Do it easy here... */ while (Start <= End) { - MarkAddr (Start++, Attr); + MarkAddr (Start++, Attr); } } @@ -134,9 +134,9 @@ void MarkAddr (unsigned Addr, attr_t Attr) /* We must not have more than one style bit */ if (Attr & atStyleMask) { - if (AttrTab[Addr] & atStyleMask) { - Error ("Duplicate style for address %04X", Addr); - } + if (AttrTab[Addr] & atStyleMask) { + Error ("Duplicate style for address %04X", Addr); + } } /* Set the style */ diff --git a/src/da65/attrtab.h b/src/da65/attrtab.h index 40a414c2e..b1caf083d 100644 --- a/src/da65/attrtab.h +++ b/src/da65/attrtab.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* attrtab.h */ +/* attrtab.h */ /* */ -/* Disassembler attribute table */ +/* Disassembler attribute table */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -47,28 +47,28 @@ typedef enum attr_t { /* Styles */ - atDefault = 0x0000, /* Default style */ - atCode = 0x0001, - atIllegal = 0x0002, - atByteTab = 0x0003, /* Same as illegal */ + atDefault = 0x0000, /* Default style */ + atCode = 0x0001, + atIllegal = 0x0002, + atByteTab = 0x0003, /* Same as illegal */ atDByteTab = 0x0004, - atWordTab = 0x0005, - atDWordTab = 0x0006, - atAddrTab = 0x0007, - atRtsTab = 0x0008, + atWordTab = 0x0005, + atDWordTab = 0x0006, + atAddrTab = 0x0007, + atRtsTab = 0x0008, atTextTab = 0x0009, atSkip = 0x000A, /* Skip code completely */ /* Label flags */ - atNoLabel = 0x0000, /* No label for this address */ - atExtLabel = 0x0010, /* External label */ - atIntLabel = 0x0020, /* Internally generated label */ - atDepLabel = 0x0040, /* Dependent label */ + atNoLabel = 0x0000, /* No label for this address */ + atExtLabel = 0x0010, /* External label */ + atIntLabel = 0x0020, /* Internally generated label */ + atDepLabel = 0x0040, /* Dependent label */ atUnnamedLabel = 0x0080, /* Unnamed label */ atLabelDefined = 0x0100, /* True if we defined the label */ - atStyleMask = 0x000F, /* Output style */ + atStyleMask = 0x000F, /* Output style */ atLabelMask = 0x00F0, /* Label information */ /* Segment */ @@ -79,7 +79,7 @@ typedef enum attr_t { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/code.c b/src/da65/code.c index ceb303fd5..c94fa24cd 100644 --- a/src/da65/code.c +++ b/src/da65/code.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* code.c */ +/* code.c */ /* */ -/* Binary code management */ +/* Binary code management */ /* */ /* */ /* */ @@ -48,20 +48,20 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -unsigned char CodeBuf [0x10000]; /* Code buffer */ -unsigned long CodeStart; /* Start address */ -unsigned long CodeEnd; /* End address */ -unsigned long PC; /* Current PC */ +unsigned char CodeBuf [0x10000]; /* Code buffer */ +unsigned long CodeStart; /* Start address */ +unsigned long CodeEnd; /* End address */ +unsigned long PC; /* Current PC */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -78,12 +78,12 @@ void LoadCode (void) /* Open the file */ F = fopen (InFile, "rb"); if (F == 0) { - Error ("Cannot open `%s': %s", InFile, strerror (errno)); + Error ("Cannot open `%s': %s", InFile, strerror (errno)); } /* Seek to the end to get the size of the file */ if (fseek (F, 0, SEEK_END) != 0) { - Error ("Cannot seek on file `%s': %s", InFile, strerror (errno)); + Error ("Cannot seek on file `%s': %s", InFile, strerror (errno)); } Size = ftell (F); @@ -101,7 +101,7 @@ void LoadCode (void) * the file. */ if (fseek (F, InputOffs, SEEK_SET) != 0) { - Error ("Cannot seek on file `%s': %s", InFile, strerror (errno)); + Error ("Cannot seek on file `%s': %s", InFile, strerror (errno)); } Size -= InputOffs; @@ -118,11 +118,11 @@ void LoadCode (void) * is a ROM that contains the hardware vectors at $FFFA. */ if (StartAddr < 0) { - if (Size > 0x10000) { - StartAddr = 0; - } else { - StartAddr = 0x10000 - Size; - } + if (Size > 0x10000) { + StartAddr = 0; + } else { + StartAddr = 0x10000 - Size; + } } /* Calculate the maximum code size */ @@ -130,19 +130,19 @@ void LoadCode (void) /* Check if the size is larger than what we can read */ if (Size == 0) { - Error ("Nothing to read from input file `%s'", InFile); + Error ("Nothing to read from input file `%s'", InFile); } if (Size > MaxCount) { - Warning ("File `%s' is too large, ignoring %ld bytes", - InFile, Size - MaxCount); + Warning ("File `%s' is too large, ignoring %ld bytes", + InFile, Size - MaxCount); } else if (MaxCount > Size) { - MaxCount = (unsigned) Size; + MaxCount = (unsigned) Size; } /* Read from the file and remember the number of bytes read */ Count = fread (CodeBuf + StartAddr, 1, MaxCount, F); if (ferror (F) || Count != MaxCount) { - Error ("Error reading from `%s': %s", InFile, strerror (errno)); + Error ("Error reading from `%s': %s", InFile, strerror (errno)); } /* Close the file */ @@ -150,7 +150,7 @@ void LoadCode (void) /* Set the buffer variables */ CodeStart = PC = StartAddr; - CodeEnd = CodeStart + Count - 1; /* CodeEnd is inclusive */ + CodeEnd = CodeStart + Count - 1; /* CodeEnd is inclusive */ } @@ -198,9 +198,9 @@ unsigned GetRemainingBytes (void) /* Return the number of remaining code bytes */ { if (CodeEnd >= PC) { - return (CodeEnd - PC + 1); + return (CodeEnd - PC + 1); } else { - return 0; + return 0; } } diff --git a/src/da65/code.h b/src/da65/code.h index 59e77db9b..e4d95a03b 100644 --- a/src/da65/code.h +++ b/src/da65/code.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* code.h */ +/* code.h */ /* */ -/* Binary code management */ +/* Binary code management */ /* */ /* */ /* */ @@ -39,20 +39,20 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -extern unsigned char CodeBuf [0x10000]; /* Code buffer */ -extern unsigned long CodeStart; /* Start address */ -extern unsigned long CodeEnd; /* End address */ -extern unsigned long PC; /* Current PC */ +extern unsigned char CodeBuf [0x10000]; /* Code buffer */ +extern unsigned long CodeStart; /* Start address */ +extern unsigned long CodeEnd; /* End address */ +extern unsigned long PC; /* Current PC */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/comments.c b/src/da65/comments.c index 3cad907e1..4702cf9d7 100644 --- a/src/da65/comments.c +++ b/src/da65/comments.c @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -55,7 +55,7 @@ static const char* CommentTab[0x10000]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/comments.h b/src/da65/comments.h index 7bc2c1c4c..0e235d31d 100644 --- a/src/da65/comments.h +++ b/src/da65/comments.h @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/data.c b/src/da65/data.c index bafd14e23..0e2f7f275 100644 --- a/src/da65/data.c +++ b/src/da65/data.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* data.c */ +/* data.c */ /* */ -/* Data output routines */ +/* Data output routines */ /* */ /* */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -63,9 +63,9 @@ static unsigned GetSpan (attr_t Style) unsigned Count = 1; while (Count < RemainingBytes) { attr_t Attr; - if (MustDefLabel(PC+Count)) { - break; - } + if (MustDefLabel(PC+Count)) { + break; + } Attr = GetAttr (PC+Count); if ((Attr & atStyleMask) != Style) { break; @@ -73,7 +73,7 @@ static unsigned GetSpan (attr_t Style) if ((Attr & atSegmentChange)) { break; } - ++Count; + ++Count; } /* Return the number of bytes */ @@ -95,9 +95,9 @@ static unsigned DoTable (attr_t Style, unsigned MemberSize, void (*TableFunc) (u * than BytesPerLine. */ if (Count < MemberSize) { - DataByteLine (Count); + DataByteLine (Count); PC += Count; - return Count; + return Count; } /* Make Count an even number of multiples of MemberSize */ @@ -107,20 +107,20 @@ static unsigned DoTable (attr_t Style, unsigned MemberSize, void (*TableFunc) (u BytesLeft = Count; while (BytesLeft > 0) { - /* Calculate the number of bytes for the next line */ - unsigned Chunk = (BytesLeft > BytesPerLine)? BytesPerLine : BytesLeft; + /* Calculate the number of bytes for the next line */ + unsigned Chunk = (BytesLeft > BytesPerLine)? BytesPerLine : BytesLeft; - /* Output a line with these bytes */ - TableFunc (Chunk); + /* Output a line with these bytes */ + TableFunc (Chunk); - /* Next line */ - BytesLeft -= Chunk; - PC += Chunk; + /* Next line */ + BytesLeft -= Chunk; + PC += Chunk; } /* If the next line is not the same style, add a separator */ if (CodeLeft() && GetStyleAttr (PC) != Style) { - SeparatorLine (); + SeparatorLine (); } /* Return the number of bytes output */ @@ -191,28 +191,28 @@ unsigned AddrTable (void) /* Now get the address from the PC */ Addr = GetCodeWord (PC); - /* In pass 1, define a label, in pass 2 output the line */ - if (Pass == 1) { - if (!HaveLabel (Addr)) { - AddIntLabel (Addr); - } - } else { - const char* Label = GetLabel (Addr, PC); - if (Label == 0) { - /* OOPS! Should not happen */ - Internal ("OOPS - Label for address 0x%06X disappeard!", Addr); - } - Indent (MCol); - Output (".addr"); - Indent (ACol); - Output ("%s", Label); - LineComment (PC, 2); - LineFeed (); - } + /* In pass 1, define a label, in pass 2 output the line */ + if (Pass == 1) { + if (!HaveLabel (Addr)) { + AddIntLabel (Addr); + } + } else { + const char* Label = GetLabel (Addr, PC); + if (Label == 0) { + /* OOPS! Should not happen */ + Internal ("OOPS - Label for address 0x%06X disappeard!", Addr); + } + Indent (MCol); + Output (".addr"); + Indent (ACol); + Output ("%s", Label); + LineComment (PC, 2); + LineFeed (); + } - /* Next table entry */ - PC += 2; - BytesLeft -= 2; + /* Next table entry */ + PC += 2; + BytesLeft -= 2; /* If we must define a label here, bail out */ if (BytesLeft && MustDefLabel (PC)) { @@ -222,7 +222,7 @@ unsigned AddrTable (void) /* If the next line is not an address table line, add a separator */ if (CodeLeft() && GetStyleAttr (PC) != atAddrTab) { - SeparatorLine (); + SeparatorLine (); } /* Return the number of bytes output */ @@ -255,30 +255,30 @@ unsigned RtsTable (void) ForwardLabel (1); /* Now get the address from the PC */ - Addr = (GetCodeWord (PC) + 1) & 0xFFFF; + Addr = (GetCodeWord (PC) + 1) & 0xFFFF; - /* In pass 1, define a label, in pass 2 output the line */ - if (Pass == 1) { - if (!HaveLabel (Addr)) { - AddIntLabel (Addr); - } - } else { - const char* Label = GetLabel (Addr, PC); - if (Label == 0) { - /* OOPS! Should not happen */ - Internal ("OOPS - Label for address 0x%06X disappeard!", Addr); - } - Indent (MCol); - Output (".word"); - Indent (ACol); - Output ("%s-1", Label); - LineComment (PC, 2); - LineFeed (); - } + /* In pass 1, define a label, in pass 2 output the line */ + if (Pass == 1) { + if (!HaveLabel (Addr)) { + AddIntLabel (Addr); + } + } else { + const char* Label = GetLabel (Addr, PC); + if (Label == 0) { + /* OOPS! Should not happen */ + Internal ("OOPS - Label for address 0x%06X disappeard!", Addr); + } + Indent (MCol); + Output (".word"); + Indent (ACol); + Output ("%s-1", Label); + LineComment (PC, 2); + LineFeed (); + } - /* Next table entry */ - PC += 2; - BytesLeft -= 2; + /* Next table entry */ + PC += 2; + BytesLeft -= 2; /* If we must define a label here, bail out */ if (BytesLeft && MustDefLabel (PC)) { @@ -288,7 +288,7 @@ unsigned RtsTable (void) /* If the next line is not a return address table line, add a separator */ if (CodeLeft() && GetStyleAttr (PC) != atRtsTab) { - SeparatorLine (); + SeparatorLine (); } /* Return the number of bytes output */ @@ -307,67 +307,67 @@ unsigned TextTable (void) unsigned BytesLeft = ByteCount; while (BytesLeft > 0) { - unsigned I; + unsigned I; - /* Count the number of characters that can be output as such */ - unsigned Count = 0; - while (Count < BytesLeft && Count < BytesPerLine*4-1) { - unsigned char C = GetCodeByte (PC + Count); - if (C >= 0x20 && C <= 0x7E && C != '\"') { - ++Count; - } else { - break; - } - } + /* Count the number of characters that can be output as such */ + unsigned Count = 0; + while (Count < BytesLeft && Count < BytesPerLine*4-1) { + unsigned char C = GetCodeByte (PC + Count); + if (C >= 0x20 && C <= 0x7E && C != '\"') { + ++Count; + } else { + break; + } + } - /* If we have text, output it */ - if (Count > 0) { - unsigned CBytes; - Indent (MCol); - Output (".byte"); - Indent (ACol); - Output ("\""); - for (I = 0; I < Count; ++I) { - Output ("%c", GetCodeByte (PC+I)); - } - Output ("\""); - CBytes = Count; - while (CBytes > 0) { - unsigned Chunk = CBytes; - if (Chunk > BytesPerLine) { - Chunk = BytesPerLine; - } - LineComment (PC, Chunk); - LineFeed (); - CBytes -= Chunk; - PC += Chunk; - } - BytesLeft -= Count; - } + /* If we have text, output it */ + if (Count > 0) { + unsigned CBytes; + Indent (MCol); + Output (".byte"); + Indent (ACol); + Output ("\""); + for (I = 0; I < Count; ++I) { + Output ("%c", GetCodeByte (PC+I)); + } + Output ("\""); + CBytes = Count; + while (CBytes > 0) { + unsigned Chunk = CBytes; + if (Chunk > BytesPerLine) { + Chunk = BytesPerLine; + } + LineComment (PC, Chunk); + LineFeed (); + CBytes -= Chunk; + PC += Chunk; + } + BytesLeft -= Count; + } - /* Count the number of bytes that must be output as bytes */ - Count = 0; - while (Count < BytesLeft && Count < BytesPerLine) { - unsigned char C = GetCodeByte (PC + Count); - if (C < 0x20 || C > 0x7E || C == '\"') { - ++Count; - } else { - break; - } - } + /* Count the number of bytes that must be output as bytes */ + Count = 0; + while (Count < BytesLeft && Count < BytesPerLine) { + unsigned char C = GetCodeByte (PC + Count); + if (C < 0x20 || C > 0x7E || C == '\"') { + ++Count; + } else { + break; + } + } - /* If we have raw output bytes, print them */ - if (Count > 0) { - DataByteLine (Count); - PC += Count; - BytesLeft -= Count; - } + /* If we have raw output bytes, print them */ + if (Count > 0) { + DataByteLine (Count); + PC += Count; + BytesLeft -= Count; + } } /* If the next line is not a byte table line, add a separator */ if (CodeLeft() && GetStyleAttr (PC) != atTextTab) { - SeparatorLine (); + SeparatorLine (); } /* Return the number of bytes output */ diff --git a/src/da65/data.h b/src/da65/data.h index a6603fa03..37c0df04a 100644 --- a/src/da65/data.h +++ b/src/da65/data.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* data.h */ +/* data.h */ /* */ -/* Data output routines */ +/* Data output routines */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/error.c b/src/da65/error.c index 0b52dee45..e0d96c9fb 100644 --- a/src/da65/error.c +++ b/src/da65/error.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* error.c */ +/* error.c */ /* */ -/* Error handling */ +/* Error handling */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/error.h b/src/da65/error.h index 17fb87d46..b8de97286 100644 --- a/src/da65/error.h +++ b/src/da65/error.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* error.h */ +/* error.h */ /* */ -/* Error handling */ +/* Error handling */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/global.c b/src/da65/global.c index f3243f0d8..14f9982d0 100644 --- a/src/da65/global.c +++ b/src/da65/global.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ -/* Global variables for the da65 disassembler */ +/* Global variables for the da65 disassembler */ /* */ /* */ /* */ @@ -38,45 +38,45 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* File names */ -const char* InFile = 0; /* Name of input file */ -const char* OutFile = 0; /* Name of output file */ +const char* InFile = 0; /* Name of input file */ +const char* OutFile = 0; /* Name of output file */ /* Default extensions */ -const char OutExt[] = ".dis"; /* Output file extension */ -const char CfgExt[] = ".cfg"; /* Config file extension */ +const char OutExt[] = ".dis"; /* Output file extension */ +const char CfgExt[] = ".cfg"; /* Config file extension */ /* Flags and other command line stuff */ unsigned char DebugInfo = 0; /* Add debug info to the object file */ -unsigned char FormFeeds = 0; /* Add form feeds to the output? */ +unsigned char FormFeeds = 0; /* Add form feeds to the output? */ unsigned char UseHexOffs = 0; /* Use hexadecimal label offsets */ -unsigned char PassCount = 2; /* How many passed do we do? */ +unsigned char PassCount = 2; /* How many passed do we do? */ signed char NewlineAfterJMP = -1; /* Add a newline after a JMP insn? */ signed char NewlineAfterRTS = -1; /* Add a newline after a RTS insn? */ -long StartAddr = -1L; /* Start/load address of the program */ +long StartAddr = -1L; /* Start/load address of the program */ long InputOffs = -1L; /* Offset into input file */ long InputSize = -1L; /* Number of bytes to read from input */ /* Stuff needed by many routines */ -unsigned Pass = 0; /* Disassembler pass */ +unsigned Pass = 0; /* Disassembler pass */ char Now[128]; /* Current time as string */ /* Comments */ unsigned Comments = 0; /* Add which comments to the output? */ /* Page formatting */ -unsigned PageLength = 0; /* Length of a listing page */ +unsigned PageLength = 0; /* Length of a listing page */ unsigned LBreak = 7; /* Linefeed if labels exceed this limit */ -unsigned MCol = 9; /* Mnemonic column */ -unsigned ACol = 17; /* Argument column */ -unsigned CCol = 49; /* Comment column */ -unsigned TCol = 81; /* Text bytes column */ -unsigned BytesPerLine = 8; /* Max. number of data bytes per line */ +unsigned MCol = 9; /* Mnemonic column */ +unsigned ACol = 17; /* Argument column */ +unsigned CCol = 49; /* Comment column */ +unsigned TCol = 81; /* Text bytes column */ +unsigned BytesPerLine = 8; /* Max. number of data bytes per line */ diff --git a/src/da65/global.h b/src/da65/global.h index 78680c93f..b48805157 100644 --- a/src/da65/global.h +++ b/src/da65/global.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ -/* Global variables for the da65 disassembler */ +/* Global variables for the da65 disassembler */ /* */ /* */ /* */ @@ -39,32 +39,32 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* File stuff */ -extern const char* InFile; /* Name of input file */ -extern const char* OutFile; /* Name of output file */ +extern const char* InFile; /* Name of input file */ +extern const char* OutFile; /* Name of output file */ /* Default extensions */ -extern const char OutExt[]; /* Output file extension */ -extern const char CfgExt[]; /* Config file extension */ +extern const char OutExt[]; /* Output file extension */ +extern const char CfgExt[]; /* Config file extension */ /* Flags and other command line stuff */ extern unsigned char DebugInfo; /* Add debug info to the object file */ -extern unsigned char FormFeeds; /* Add form feeds to the output? */ +extern unsigned char FormFeeds; /* Add form feeds to the output? */ extern unsigned char UseHexOffs; /* Use hexadecimal label offsets */ -extern unsigned char PassCount; /* How many passed do we do? */ +extern unsigned char PassCount; /* How many passed do we do? */ extern signed char NewlineAfterJMP;/* Add a newline after a JMP insn? */ extern signed char NewlineAfterRTS;/* Add a newline after a RTS insn? */ -extern long StartAddr; /* Start/load address of the program */ +extern long StartAddr; /* Start/load address of the program */ extern long InputOffs; /* Offset into input file */ extern long InputSize; /* Number of bytes to read from input */ /* Stuff needed by many routines */ -extern unsigned Pass; /* Disassembler pass */ +extern unsigned Pass; /* Disassembler pass */ extern char Now[128]; /* Current time as string */ /* Comments */ @@ -73,9 +73,9 @@ extern char Now[128]; /* Current time as string */ extern unsigned Comments; /* Add which comments to the output? */ /* Page formatting */ -#define MIN_PAGE_LEN 32 -#define MAX_PAGE_LEN 127 -extern unsigned PageLength; /* Length of a listing page */ +#define MIN_PAGE_LEN 32 +#define MAX_PAGE_LEN 127 +extern unsigned PageLength; /* Length of a listing page */ /* Linefeed if labels exceed this limit */ #define MIN_LABELBREAK 1 @@ -85,27 +85,27 @@ extern unsigned LBreak; /* Mnemonic column */ #define MIN_MCOL 1 #define MAX_MCOL 127 -extern unsigned MCol; +extern unsigned MCol; /* Argument column */ #define MIN_ACOL 1 #define MAX_ACOL 127 -extern unsigned ACol; +extern unsigned ACol; /* Comment column */ #define MIN_CCOL 1 #define MAX_CCOL 127 -extern unsigned CCol; +extern unsigned CCol; /* Text bytes column */ #define MIN_TCOL 1 #define MAX_TCOL 127 -extern unsigned TCol; +extern unsigned TCol; /* Max. number of data bytes per line */ #define MIN_BYTESPERLINE 1 #define MAX_BYTESPERLINE 127 -extern unsigned BytesPerLine; +extern unsigned BytesPerLine; diff --git a/src/da65/handler.c b/src/da65/handler.c index ee27ae857..1b26fca7e 100644 --- a/src/da65/handler.c +++ b/src/da65/handler.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* handler.c */ +/* handler.c */ /* */ -/* Opcode handler functions for the disassembler */ +/* Opcode handler functions for the disassembler */ /* */ /* */ /* */ @@ -51,7 +51,7 @@ /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -110,18 +110,18 @@ static const char* GetAddrArg (unsigned Flags, unsigned Addr) { const char* Label = 0; if (Flags & flUseLabel) { - Label = GetLabel (Addr, PC); + Label = GetLabel (Addr, PC); } if (Label) { - return Label; + return Label; } else { - static char Buf [32]; - if (Addr < 0x100) { - xsprintf (Buf, sizeof (Buf), "$%02X", Addr); - } else { - xsprintf (Buf, sizeof (Buf), "$%04X", Addr); - } - return Buf; + static char Buf [32]; + if (Addr < 0x100) { + xsprintf (Buf, sizeof (Buf), "$%02X", Addr); + } else { + xsprintf (Buf, sizeof (Buf), "$%04X", Addr); + } + return Buf; } } @@ -132,66 +132,66 @@ static void GenerateLabel (unsigned Flags, unsigned Addr) { /* Generate labels in pass #1, and only if we don't have a label already */ if (Pass == 1 && !HaveLabel (Addr) && - /* Check if we must create a label */ - ((Flags & flGenLabel) != 0 || - ((Flags & flUseLabel) != 0 && Addr >= CodeStart && Addr <= CodeEnd))) { + /* Check if we must create a label */ + ((Flags & flGenLabel) != 0 || + ((Flags & flUseLabel) != 0 && Addr >= CodeStart && Addr <= CodeEnd))) { - /* As a special case, handle ranges with tables or similar. Within - * such a range with a granularity > 1, do only generate dependent - * labels for all addresses but the first one. Be sure to generate - * a label for the start of the range, however. - */ - attr_t Style = GetStyleAttr (Addr); - unsigned Granularity = GetGranularity (Style); + /* As a special case, handle ranges with tables or similar. Within + * such a range with a granularity > 1, do only generate dependent + * labels for all addresses but the first one. Be sure to generate + * a label for the start of the range, however. + */ + attr_t Style = GetStyleAttr (Addr); + unsigned Granularity = GetGranularity (Style); - if (Granularity == 1) { - /* Just add the label */ - AddIntLabel (Addr); - } else { + if (Granularity == 1) { + /* Just add the label */ + AddIntLabel (Addr); + } else { /* THIS CODE IS A MESS AND WILL FAIL ON SEVERAL CONDITIONS! ### */ - /* Search for the start of the range or the last non dependent - * label in the range. - */ - unsigned Offs; - attr_t LabelAttr; - unsigned LabelAddr = Addr; - while (LabelAddr > CodeStart) { + /* Search for the start of the range or the last non dependent + * label in the range. + */ + unsigned Offs; + attr_t LabelAttr; + unsigned LabelAddr = Addr; + while (LabelAddr > CodeStart) { - if (Style != GetStyleAttr (LabelAddr-1)) { - /* End of range reached */ - break; - } - --LabelAddr; - LabelAttr = GetLabelAttr (LabelAddr); - if ((LabelAttr & (atIntLabel|atExtLabel)) != 0) { - /* The address has an internal or external label */ - break; - } - } + if (Style != GetStyleAttr (LabelAddr-1)) { + /* End of range reached */ + break; + } + --LabelAddr; + LabelAttr = GetLabelAttr (LabelAddr); + if ((LabelAttr & (atIntLabel|atExtLabel)) != 0) { + /* The address has an internal or external label */ + break; + } + } - /* If the proposed label address doesn't have a label, define one */ - if ((GetLabelAttr (LabelAddr) & (atIntLabel|atExtLabel)) == 0) { - AddIntLabel (LabelAddr); - } + /* If the proposed label address doesn't have a label, define one */ + if ((GetLabelAttr (LabelAddr) & (atIntLabel|atExtLabel)) == 0) { + AddIntLabel (LabelAddr); + } - /* Create the label */ - Offs = Addr - LabelAddr; - if (Offs == 0) { - AddIntLabel (Addr); - } else { - AddDepLabel (Addr, atIntLabel, GetLabelName (LabelAddr), Offs); - } - } + /* Create the label */ + Offs = Addr - LabelAddr; + if (Offs == 0) { + AddIntLabel (Addr); + } else { + AddDepLabel (Addr, atIntLabel, GetLabelName (LabelAddr), Offs); + } + } } } /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/handler.h b/src/da65/handler.h index affc4cf38..fddcfba25 100644 --- a/src/da65/handler.h +++ b/src/da65/handler.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* handler.h */ +/* handler.h */ /* */ -/* Opcode handler functions for the disassembler */ +/* Opcode handler functions for the disassembler */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/infofile.c b/src/da65/infofile.c index dba7a64de..4b1857dc5 100644 --- a/src/da65/infofile.c +++ b/src/da65/infofile.c @@ -63,7 +63,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -85,7 +85,7 @@ static void AsmIncSection (void) { static const IdentTok LabelDefs[] = { { "COMMENTSTART", INFOTOK_COMMENTSTART }, - { "FILE", INFOTOK_FILE }, + { "FILE", INFOTOK_FILE }, { "IGNOREUNKNOWN", INFOTOK_IGNOREUNKNOWN }, }; @@ -103,11 +103,11 @@ static void AsmIncSection (void) /* Look for section tokens */ while (InfoTok != INFOTOK_RCURLY) { - /* Convert to special token */ - InfoSpecialToken (LabelDefs, ENTRY_COUNT (LabelDefs), "Asminc directive"); + /* Convert to special token */ + InfoSpecialToken (LabelDefs, ENTRY_COUNT (LabelDefs), "Asminc directive"); - /* Look at the token */ - switch (InfoTok) { + /* Look at the token */ + switch (InfoTok) { case INFOTOK_COMMENTSTART: InfoNextTok (); @@ -119,18 +119,18 @@ static void AsmIncSection (void) InfoNextTok (); break; - case INFOTOK_FILE: - InfoNextTok (); - if (Name) { - InfoError ("File name already given"); - } - InfoAssureStr (); - if (InfoSVal[0] == '\0') { - InfoError ("File name may not be empty"); - } - Name = xstrdup (InfoSVal); - InfoNextTok (); - break; + case INFOTOK_FILE: + InfoNextTok (); + if (Name) { + InfoError ("File name already given"); + } + InfoAssureStr (); + if (InfoSVal[0] == '\0') { + InfoError ("File name may not be empty"); + } + Name = xstrdup (InfoSVal); + InfoNextTok (); + break; case INFOTOK_IGNOREUNKNOWN: InfoNextTok (); @@ -144,18 +144,18 @@ static void AsmIncSection (void) default: Internal ("Unexpected token: %u", InfoTok); - } + } - /* Directive is followed by a semicolon */ - InfoConsumeSemi (); + /* Directive is followed by a semicolon */ + InfoConsumeSemi (); } /* Check for the necessary data and assume defaults */ if (Name == 0) { - InfoError ("File name is missing"); + InfoError ("File name is missing"); } if (CommentStart == EOF) { - CommentStart = ';'; + CommentStart = ';'; } if (IgnoreUnknown == -1) { IgnoreUnknown = 0; @@ -182,9 +182,9 @@ static void GlobalSection (void) { "COMMENTCOL", INFOTOK_COMMENT_COLUMN }, { "COMMENTCOLUMN", INFOTOK_COMMENT_COLUMN }, { "COMMENTS", INFOTOK_COMMENTS }, - { "CPU", INFOTOK_CPU }, + { "CPU", INFOTOK_CPU }, { "HEXOFFS", INFOTOK_HEXOFFS }, - { "INPUTNAME", INFOTOK_INPUTNAME }, + { "INPUTNAME", INFOTOK_INPUTNAME }, { "INPUTOFFS", INFOTOK_INPUTOFFS }, { "INPUTSIZE", INFOTOK_INPUTSIZE }, { "LABELBREAK", INFOTOK_LABELBREAK }, @@ -192,9 +192,9 @@ static void GlobalSection (void) { "MNEMONICCOLUMN", INFOTOK_MNEMONIC_COLUMN }, { "NEWLINEAFTERJMP", INFOTOK_NL_AFTER_JMP }, { "NEWLINEAFTERRTS", INFOTOK_NL_AFTER_RTS }, - { "OUTPUTNAME", INFOTOK_OUTPUTNAME }, - { "PAGELENGTH", INFOTOK_PAGELENGTH }, - { "STARTADDR", INFOTOK_STARTADDR }, + { "OUTPUTNAME", INFOTOK_OUTPUTNAME }, + { "PAGELENGTH", INFOTOK_PAGELENGTH }, + { "STARTADDR", INFOTOK_STARTADDR }, { "TEXTCOL", INFOTOK_TEXT_COLUMN }, { "TEXTCOLUMN", INFOTOK_TEXT_COLUMN }, }; @@ -208,35 +208,35 @@ static void GlobalSection (void) /* Look for section tokens */ while (InfoTok != INFOTOK_RCURLY) { - /* Convert to special token */ - InfoSpecialToken (GlobalDefs, ENTRY_COUNT (GlobalDefs), "Global directive"); + /* Convert to special token */ + InfoSpecialToken (GlobalDefs, ENTRY_COUNT (GlobalDefs), "Global directive"); - /* Look at the token */ - switch (InfoTok) { + /* Look at the token */ + switch (InfoTok) { case INFOTOK_ARGUMENT_COLUMN: - InfoNextTok (); - InfoAssureInt (); + InfoNextTok (); + InfoAssureInt (); InfoRangeCheck (MIN_ACOL, MAX_ACOL); - ACol = InfoIVal; - InfoNextTok (); - break; + ACol = InfoIVal; + InfoNextTok (); + break; case INFOTOK_COMMENT_COLUMN: - InfoNextTok (); - InfoAssureInt (); + InfoNextTok (); + InfoAssureInt (); InfoRangeCheck (MIN_CCOL, MAX_CCOL); - CCol = InfoIVal; - InfoNextTok (); - break; + CCol = InfoIVal; + InfoNextTok (); + break; case INFOTOK_COMMENTS: - InfoNextTok (); - InfoAssureInt (); + InfoNextTok (); + InfoAssureInt (); InfoRangeCheck (MIN_COMMENTS, MAX_COMMENTS); - Comments = InfoIVal; - InfoNextTok (); - break; + Comments = InfoIVal; + InfoNextTok (); + break; case INFOTOK_CPU: InfoNextTok (); @@ -259,46 +259,46 @@ static void GlobalSection (void) InfoNextTok (); break; - case INFOTOK_INPUTNAME: - InfoNextTok (); - InfoAssureStr (); - if (InFile) { - InfoError ("Input file name already given"); - } - InFile = xstrdup (InfoSVal); - InfoNextTok (); - break; + case INFOTOK_INPUTNAME: + InfoNextTok (); + InfoAssureStr (); + if (InFile) { + InfoError ("Input file name already given"); + } + InFile = xstrdup (InfoSVal); + InfoNextTok (); + break; case INFOTOK_INPUTOFFS: - InfoNextTok (); - InfoAssureInt (); - InputOffs = InfoIVal; - InfoNextTok (); - break; + InfoNextTok (); + InfoAssureInt (); + InputOffs = InfoIVal; + InfoNextTok (); + break; case INFOTOK_INPUTSIZE: - InfoNextTok (); - InfoAssureInt (); + InfoNextTok (); + InfoAssureInt (); InfoRangeCheck (1, 0x10000); - InputSize = InfoIVal; - InfoNextTok (); - break; + InputSize = InfoIVal; + InfoNextTok (); + break; case INFOTOK_LABELBREAK: - InfoNextTok (); - InfoAssureInt (); + InfoNextTok (); + InfoAssureInt (); InfoRangeCheck (0, UCHAR_MAX); - LBreak = (unsigned char) InfoIVal; - InfoNextTok (); - break; + LBreak = (unsigned char) InfoIVal; + InfoNextTok (); + break; case INFOTOK_MNEMONIC_COLUMN: - InfoNextTok (); - InfoAssureInt (); + InfoNextTok (); + InfoAssureInt (); InfoRangeCheck (MIN_MCOL, MAX_MCOL); - MCol = InfoIVal; - InfoNextTok (); - break; + MCol = InfoIVal; + InfoNextTok (); + break; case INFOTOK_NL_AFTER_JMP: InfoNextTok (); @@ -320,49 +320,49 @@ static void GlobalSection (void) InfoNextTok (); break; - case INFOTOK_OUTPUTNAME: - InfoNextTok (); - InfoAssureStr (); - if (OutFile) { - InfoError ("Output file name already given"); - } - OutFile = xstrdup (InfoSVal); - InfoNextTok (); - break; + case INFOTOK_OUTPUTNAME: + InfoNextTok (); + InfoAssureStr (); + if (OutFile) { + InfoError ("Output file name already given"); + } + OutFile = xstrdup (InfoSVal); + InfoNextTok (); + break; - case INFOTOK_PAGELENGTH: - InfoNextTok (); - InfoAssureInt (); - if (InfoIVal != 0) { - InfoRangeCheck (MIN_PAGE_LEN, MAX_PAGE_LEN); - } - PageLength = InfoIVal; - InfoNextTok (); - break; + case INFOTOK_PAGELENGTH: + InfoNextTok (); + InfoAssureInt (); + if (InfoIVal != 0) { + InfoRangeCheck (MIN_PAGE_LEN, MAX_PAGE_LEN); + } + PageLength = InfoIVal; + InfoNextTok (); + break; - case INFOTOK_STARTADDR: - InfoNextTok (); - InfoAssureInt (); - InfoRangeCheck (0x0000, 0xFFFF); - StartAddr = InfoIVal; - InfoNextTok (); - break; + case INFOTOK_STARTADDR: + InfoNextTok (); + InfoAssureInt (); + InfoRangeCheck (0x0000, 0xFFFF); + StartAddr = InfoIVal; + InfoNextTok (); + break; case INFOTOK_TEXT_COLUMN: - InfoNextTok (); - InfoAssureInt (); + InfoNextTok (); + InfoAssureInt (); InfoRangeCheck (MIN_TCOL, MAX_TCOL); - TCol = InfoIVal; - InfoNextTok (); - break; + TCol = InfoIVal; + InfoNextTok (); + break; default: Internal ("Unexpected token: %u", InfoTok); - } + } - /* Directive is followed by a semicolon */ - InfoConsumeSemi (); + /* Directive is followed by a semicolon */ + InfoConsumeSemi (); } @@ -376,10 +376,10 @@ static void LabelSection (void) /* Parse a label section */ { static const IdentTok LabelDefs[] = { - { "COMMENT", INFOTOK_COMMENT }, - { "ADDR", INFOTOK_ADDR }, - { "NAME", INFOTOK_NAME }, - { "SIZE", INFOTOK_SIZE }, + { "COMMENT", INFOTOK_COMMENT }, + { "ADDR", INFOTOK_ADDR }, + { "NAME", INFOTOK_NAME }, + { "SIZE", INFOTOK_SIZE }, }; /* Locals - initialize to avoid gcc warnings */ @@ -397,84 +397,84 @@ static void LabelSection (void) /* Look for section tokens */ while (InfoTok != INFOTOK_RCURLY) { - /* Convert to special token */ - InfoSpecialToken (LabelDefs, ENTRY_COUNT (LabelDefs), "Label attribute"); + /* Convert to special token */ + InfoSpecialToken (LabelDefs, ENTRY_COUNT (LabelDefs), "Label attribute"); - /* Look at the token */ - switch (InfoTok) { + /* Look at the token */ + switch (InfoTok) { - case INFOTOK_ADDR: - InfoNextTok (); - if (Value >= 0) { - InfoError ("Value already given"); - } - InfoAssureInt (); - InfoRangeCheck (0, 0xFFFF); - Value = InfoIVal; - InfoNextTok (); - break; + case INFOTOK_ADDR: + InfoNextTok (); + if (Value >= 0) { + InfoError ("Value already given"); + } + InfoAssureInt (); + InfoRangeCheck (0, 0xFFFF); + Value = InfoIVal; + InfoNextTok (); + break; - case INFOTOK_COMMENT: - InfoNextTok (); - if (Comment) { - InfoError ("Comment already given"); - } - InfoAssureStr (); - if (InfoSVal[0] == '\0') { - InfoError ("Comment may not be empty"); - } - Comment = xstrdup (InfoSVal); - InfoNextTok (); - break; + case INFOTOK_COMMENT: + InfoNextTok (); + if (Comment) { + InfoError ("Comment already given"); + } + InfoAssureStr (); + if (InfoSVal[0] == '\0') { + InfoError ("Comment may not be empty"); + } + Comment = xstrdup (InfoSVal); + InfoNextTok (); + break; - case INFOTOK_NAME: - InfoNextTok (); - if (Name) { - InfoError ("Name already given"); - } - InfoAssureStr (); - Name = xstrdup (InfoSVal); - InfoNextTok (); - break; + case INFOTOK_NAME: + InfoNextTok (); + if (Name) { + InfoError ("Name already given"); + } + InfoAssureStr (); + Name = xstrdup (InfoSVal); + InfoNextTok (); + break; - case INFOTOK_SIZE: - InfoNextTok (); - if (Size >= 0) { - InfoError ("Size already given"); - } - InfoAssureInt (); - InfoRangeCheck (1, 0x10000); - Size = InfoIVal; - InfoNextTok (); - break; + case INFOTOK_SIZE: + InfoNextTok (); + if (Size >= 0) { + InfoError ("Size already given"); + } + InfoAssureInt (); + InfoRangeCheck (1, 0x10000); + Size = InfoIVal; + InfoNextTok (); + break; default: Internal ("Unexpected token: %u", InfoTok); - } + } - /* Directive is followed by a semicolon */ - InfoConsumeSemi (); + /* Directive is followed by a semicolon */ + InfoConsumeSemi (); } /* Did we get the necessary data */ if (Name == 0) { - InfoError ("Label name is missing"); + InfoError ("Label name is missing"); } if (Name[0] == '\0' && Size > 1) { InfoError ("Unnamed labels must not have a size > 1"); } if (Value < 0) { - InfoError ("Label value is missing"); + InfoError ("Label value is missing"); } if (Size < 0) { - /* Use default */ - Size = 1; + /* Use default */ + Size = 1; } if (Value + Size > 0x10000) { - InfoError ("Invalid size (address out of range)"); + InfoError ("Invalid size (address out of range)"); } if (HaveLabel ((unsigned) Value)) { - InfoError ("Label for address $%04lX already defined", Value); + InfoError ("Label for address $%04lX already defined", Value); } /* Define the label(s) */ @@ -505,41 +505,41 @@ static void RangeSection (void) { static const IdentTok RangeDefs[] = { { "COMMENT", INFOTOK_COMMENT }, - { "END", INFOTOK_END }, + { "END", INFOTOK_END }, { "NAME", INFOTOK_NAME }, - { "START", INFOTOK_START }, - { "TYPE", INFOTOK_TYPE }, + { "START", INFOTOK_START }, + { "TYPE", INFOTOK_TYPE }, }; static const IdentTok TypeDefs[] = { - { "ADDRTABLE", INFOTOK_ADDRTAB }, - { "BYTETABLE", INFOTOK_BYTETAB }, - { "CODE", INFOTOK_CODE }, + { "ADDRTABLE", INFOTOK_ADDRTAB }, + { "BYTETABLE", INFOTOK_BYTETAB }, + { "CODE", INFOTOK_CODE }, { "DBYTETABLE", INFOTOK_DBYTETAB }, - { "DWORDTABLE", INFOTOK_DWORDTAB }, - { "RTSTABLE", INFOTOK_RTSTAB }, + { "DWORDTABLE", INFOTOK_DWORDTAB }, + { "RTSTABLE", INFOTOK_RTSTAB }, { "SKIP", INFOTOK_SKIP }, - { "TEXTTABLE", INFOTOK_TEXTTAB }, - { "WORDTABLE", INFOTOK_WORDTAB }, + { "TEXTTABLE", INFOTOK_TEXTTAB }, + { "WORDTABLE", INFOTOK_WORDTAB }, }; /* Which values did we get? */ enum { - tNone = 0x00, - tStart = 0x01, - tEnd = 0x02, - tType = 0x04, + tNone = 0x00, + tStart = 0x01, + tEnd = 0x02, + tType = 0x04, tName = 0x08, tComment= 0x10, - tNeeded = (tStart | tEnd | tType) + tNeeded = (tStart | tEnd | tType) }; unsigned Attributes = tNone; /* Locals - initialize to avoid gcc warnings */ - unsigned Start = 0; - unsigned End = 0; - unsigned char Type = 0; + unsigned Start = 0; + unsigned End = 0; + unsigned char Type = 0; char* Name = 0; char* Comment = 0; unsigned MemberSize = 0; @@ -554,94 +554,94 @@ static void RangeSection (void) /* Look for section tokens */ while (InfoTok != INFOTOK_RCURLY) { - /* Convert to special token */ - InfoSpecialToken (RangeDefs, ENTRY_COUNT (RangeDefs), "Range attribute"); + /* Convert to special token */ + InfoSpecialToken (RangeDefs, ENTRY_COUNT (RangeDefs), "Range attribute"); - /* Look at the token */ - switch (InfoTok) { + /* Look at the token */ + switch (InfoTok) { - case INFOTOK_COMMENT: + case INFOTOK_COMMENT: AddAttr ("COMMENT", &Attributes, tComment); - InfoNextTok (); - InfoAssureStr (); - if (InfoSVal[0] == '\0') { - InfoError ("Comment may not be empty"); - } - Comment = xstrdup (InfoSVal); + InfoNextTok (); + InfoAssureStr (); + if (InfoSVal[0] == '\0') { + InfoError ("Comment may not be empty"); + } + Comment = xstrdup (InfoSVal); Attributes |= tComment; - InfoNextTok (); - break; + InfoNextTok (); + break; - case INFOTOK_END: + case INFOTOK_END: AddAttr ("END", &Attributes, tEnd); - InfoNextTok (); - InfoAssureInt (); - InfoRangeCheck (0x0000, 0xFFFF); - End = InfoIVal; - InfoNextTok (); - break; + InfoNextTok (); + InfoAssureInt (); + InfoRangeCheck (0x0000, 0xFFFF); + End = InfoIVal; + InfoNextTok (); + break; - case INFOTOK_NAME: + case INFOTOK_NAME: AddAttr ("NAME", &Attributes, tName); - InfoNextTok (); - InfoAssureStr (); - if (InfoSVal[0] == '\0') { - InfoError ("Name may not be empty"); - } - Name = xstrdup (InfoSVal); + InfoNextTok (); + InfoAssureStr (); + if (InfoSVal[0] == '\0') { + InfoError ("Name may not be empty"); + } + Name = xstrdup (InfoSVal); Attributes |= tName; - InfoNextTok (); - break; + InfoNextTok (); + break; - case INFOTOK_START: + case INFOTOK_START: AddAttr ("START", &Attributes, tStart); - InfoNextTok (); - InfoAssureInt (); - InfoRangeCheck (0x0000, 0xFFFF); - Start = InfoIVal; - InfoNextTok (); - break; + InfoNextTok (); + InfoAssureInt (); + InfoRangeCheck (0x0000, 0xFFFF); + Start = InfoIVal; + InfoNextTok (); + break; - case INFOTOK_TYPE: + case INFOTOK_TYPE: AddAttr ("TYPE", &Attributes, tType); - InfoNextTok (); - InfoSpecialToken (TypeDefs, ENTRY_COUNT (TypeDefs), "TYPE"); - switch (InfoTok) { - case INFOTOK_ADDRTAB: Type = atAddrTab; MemberSize = 2; break; - case INFOTOK_BYTETAB: Type = atByteTab; MemberSize = 1; break; - case INFOTOK_CODE: Type = atCode; MemberSize = 1; break; + InfoNextTok (); + InfoSpecialToken (TypeDefs, ENTRY_COUNT (TypeDefs), "TYPE"); + switch (InfoTok) { + case INFOTOK_ADDRTAB: Type = atAddrTab; MemberSize = 2; break; + case INFOTOK_BYTETAB: Type = atByteTab; MemberSize = 1; break; + case INFOTOK_CODE: Type = atCode; MemberSize = 1; break; case INFOTOK_DBYTETAB: Type = atDByteTab; MemberSize = 2; break; - case INFOTOK_DWORDTAB: Type = atDWordTab; MemberSize = 4; break; - case INFOTOK_RTSTAB: Type = atRtsTab; MemberSize = 2; break; + case INFOTOK_DWORDTAB: Type = atDWordTab; MemberSize = 4; break; + case INFOTOK_RTSTAB: Type = atRtsTab; MemberSize = 2; break; case INFOTOK_SKIP: Type = atSkip; MemberSize = 1; break; - case INFOTOK_TEXTTAB: Type = atTextTab; MemberSize = 1; break; - case INFOTOK_WORDTAB: Type = atWordTab; MemberSize = 2; break; - } - InfoNextTok (); - break; + case INFOTOK_TEXTTAB: Type = atTextTab; MemberSize = 1; break; + case INFOTOK_WORDTAB: Type = atWordTab; MemberSize = 2; break; + } + InfoNextTok (); + break; default: Internal ("Unexpected token: %u", InfoTok); - } + } - /* Directive is followed by a semicolon */ - InfoConsumeSemi (); + /* Directive is followed by a semicolon */ + InfoConsumeSemi (); } /* Did we get all required values? */ if ((Attributes & tNeeded) != tNeeded) { - InfoError ("Required values missing from this section"); + InfoError ("Required values missing from this section"); } /* Start must be less than end */ if (Start > End) { - InfoError ("Start value must not be greater than end value"); + InfoError ("Start value must not be greater than end value"); } /* Check the granularity */ if (((End - Start + 1) % MemberSize) != 0) { - InfoError ("Type of range needs a granularity of %u", MemberSize); + InfoError ("Type of range needs a granularity of %u", MemberSize); } /* Set the range */ @@ -673,9 +673,9 @@ static void SegmentSection (void) /* Parse a segment section */ { static const IdentTok LabelDefs[] = { - { "END", INFOTOK_END }, - { "NAME", INFOTOK_NAME }, - { "START", INFOTOK_START }, + { "END", INFOTOK_END }, + { "NAME", INFOTOK_NAME }, + { "START", INFOTOK_START }, }; /* Locals - initialize to avoid gcc warnings */ @@ -692,61 +692,61 @@ static void SegmentSection (void) /* Look for section tokens */ while (InfoTok != INFOTOK_RCURLY) { - /* Convert to special token */ - InfoSpecialToken (LabelDefs, ENTRY_COUNT (LabelDefs), "Segment attribute"); + /* Convert to special token */ + InfoSpecialToken (LabelDefs, ENTRY_COUNT (LabelDefs), "Segment attribute"); - /* Look at the token */ - switch (InfoTok) { + /* Look at the token */ + switch (InfoTok) { - case INFOTOK_END: - InfoNextTok (); - if (End >= 0) { - InfoError ("Value already given"); - } - InfoAssureInt (); - InfoRangeCheck (0, 0xFFFF); - End = InfoIVal; - InfoNextTok (); - break; + case INFOTOK_END: + InfoNextTok (); + if (End >= 0) { + InfoError ("Value already given"); + } + InfoAssureInt (); + InfoRangeCheck (0, 0xFFFF); + End = InfoIVal; + InfoNextTok (); + break; - case INFOTOK_NAME: - InfoNextTok (); - if (Name) { - InfoError ("Name already given"); - } - InfoAssureStr (); - Name = xstrdup (InfoSVal); - InfoNextTok (); - break; + case INFOTOK_NAME: + InfoNextTok (); + if (Name) { + InfoError ("Name already given"); + } + InfoAssureStr (); + Name = xstrdup (InfoSVal); + InfoNextTok (); + break; - case INFOTOK_START: - InfoNextTok (); - if (Start >= 0) { - InfoError ("Value already given"); - } - InfoAssureInt (); - InfoRangeCheck (0, 0xFFFF); - Start = InfoIVal; - InfoNextTok (); - break; + case INFOTOK_START: + InfoNextTok (); + if (Start >= 0) { + InfoError ("Value already given"); + } + InfoAssureInt (); + InfoRangeCheck (0, 0xFFFF); + Start = InfoIVal; + InfoNextTok (); + break; default: Internal ("Unexpected token: %u", InfoTok); - } + } - /* Directive is followed by a semicolon */ - InfoConsumeSemi (); + /* Directive is followed by a semicolon */ + InfoConsumeSemi (); } /* Did we get the necessary data, and is it correct? */ if (Name == 0 || Name[0] == '\0') { - InfoError ("Segment name is missing"); + InfoError ("Segment name is missing"); } if (End < 0) { InfoError ("End address is missing"); } if (Start < 0) { - InfoError ("Start address is missing"); + InfoError ("Start address is missing"); } if (Start == End) { InfoError ("Segment is empty"); @@ -777,35 +777,35 @@ static void InfoParse (void) { static const IdentTok Globals[] = { { "ASMINC", INFOTOK_ASMINC }, - { "GLOBAL", INFOTOK_GLOBAL }, - { "LABEL", INFOTOK_LABEL }, - { "RANGE", INFOTOK_RANGE }, + { "GLOBAL", INFOTOK_GLOBAL }, + { "LABEL", INFOTOK_LABEL }, + { "RANGE", INFOTOK_RANGE }, { "SEGMENT", INFOTOK_SEGMENT }, }; while (InfoTok != INFOTOK_EOF) { - /* Convert an identifier into a token */ - InfoSpecialToken (Globals, ENTRY_COUNT (Globals), "Config directive"); + /* Convert an identifier into a token */ + InfoSpecialToken (Globals, ENTRY_COUNT (Globals), "Config directive"); - /* Check the token */ - switch (InfoTok) { + /* Check the token */ + switch (InfoTok) { case INFOTOK_ASMINC: AsmIncSection (); break; - case INFOTOK_GLOBAL: - GlobalSection (); - break; + case INFOTOK_GLOBAL: + GlobalSection (); + break; - case INFOTOK_LABEL: - LabelSection (); - break; + case INFOTOK_LABEL: + LabelSection (); + break; - case INFOTOK_RANGE: - RangeSection (); - break; + case INFOTOK_RANGE: + RangeSection (); + break; case INFOTOK_SEGMENT: SegmentSection (); @@ -813,10 +813,10 @@ static void InfoParse (void) default: Internal ("Unexpected token: %u", InfoTok); - } + } - /* Semicolon expected */ - InfoConsumeSemi (); + /* Semicolon expected */ + InfoConsumeSemi (); } } diff --git a/src/da65/infofile.h b/src/da65/infofile.h index a39a02d43..0bfeb79b8 100644 --- a/src/da65/infofile.h +++ b/src/da65/infofile.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/labels.c b/src/da65/labels.c index b9b217a24..c837b17a6 100644 --- a/src/da65/labels.c +++ b/src/da65/labels.c @@ -52,7 +52,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -63,7 +63,7 @@ static const char* SymTab[0x10000]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -88,14 +88,14 @@ static void AddLabel (unsigned Addr, attr_t Attr, const char* Name) /* Must not have two symbols for one address */ if (ExistingAttr != atNoLabel) { - /* Allow redefinition if identical. Beware: Unnamed labels don't + /* Allow redefinition if identical. Beware: Unnamed labels don't * have a name (you guessed that, didn't you?). */ - if (ExistingAttr == Attr && + if (ExistingAttr == Attr && ((Name == 0 && SymTab[Addr] == 0) || strcmp (SymTab[Addr], Name) == 0)) { - return; - } - Error ("Duplicate label for address $%04X: %s/%s", Addr, SymTab[Addr], Name); + return; + } + Error ("Duplicate label for address $%04X: %s/%s", Addr, SymTab[Addr], Name); } /* Create a new label (xstrdup will return NULL if input NULL) */ @@ -138,13 +138,13 @@ void AddDepLabel (unsigned Addr, attr_t Attr, const char* BaseName, unsigned Off { /* Allocate memory for the dependent label name */ unsigned NameLen = strlen (BaseName); - char* DepName = xmalloc (NameLen + 7); /* "+$ABCD\0" */ + char* DepName = xmalloc (NameLen + 7); /* "+$ABCD\0" */ /* Create the new name in the buffer */ if (UseHexOffs) { - sprintf (DepName, "%s+$%02X", BaseName, Offs); + sprintf (DepName, "%s+$%02X", BaseName, Offs); } else { - sprintf (DepName, "%s+%u", BaseName, Offs); + sprintf (DepName, "%s+%u", BaseName, Offs); } /* Define the labels */ @@ -167,28 +167,28 @@ static void AddLabelRange (unsigned Addr, attr_t Attr, /* Define dependent labels if necessary */ if (Count > 1) { - unsigned Offs; + unsigned Offs; /* Setup the format string */ const char* Format = UseHexOffs? "$%02X" : "%u"; - /* Allocate memory for the dependent label names */ - unsigned NameLen = strlen (Name); - char* DepName = xmalloc (NameLen + 7); /* "+$ABCD" */ - char* DepOffs = DepName + NameLen + 1; + /* Allocate memory for the dependent label names */ + unsigned NameLen = strlen (Name); + char* DepName = xmalloc (NameLen + 7); /* "+$ABCD" */ + char* DepOffs = DepName + NameLen + 1; - /* Copy the original name into the buffer */ - memcpy (DepName, Name, NameLen); - DepName[NameLen] = '+'; + /* Copy the original name into the buffer */ + memcpy (DepName, Name, NameLen); + DepName[NameLen] = '+'; - /* Define the labels */ - for (Offs = 1; Offs < Count; ++Offs) { - sprintf (DepOffs, Format, Offs); - AddLabel (Addr + Offs, Attr | atDepLabel, DepName); - } + /* Define the labels */ + for (Offs = 1; Offs < Count; ++Offs) { + sprintf (DepOffs, Format, Offs); + AddLabel (Addr + Offs, Attr | atDepLabel, DepName); + } - /* Free the name buffer */ - xfree (DepName); + /* Free the name buffer */ + xfree (DepName); } } diff --git a/src/da65/labels.h b/src/da65/labels.h index 53d46c6c8..34735a54c 100644 --- a/src/da65/labels.h +++ b/src/da65/labels.h @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/main.c b/src/da65/main.c index cbc6bb19e..a0af30539 100644 --- a/src/da65/main.c +++ b/src/da65/main.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* main.c */ +/* main.c */ /* */ -/* Main program for the da65 disassembler */ +/* Main program for the da65 disassembler */ /* */ /* */ /* */ @@ -64,7 +64,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -124,20 +124,20 @@ static unsigned long CvtNumber (const char* Arg, const char* Number) */ { unsigned long Val; - int Converted; + int Converted; char BoundsCheck; /* Convert */ if (*Number == '$') { - ++Number; - Converted = sscanf (Number, "%lx%c", &Val, &BoundsCheck); + ++Number; + Converted = sscanf (Number, "%lx%c", &Val, &BoundsCheck); } else { - Converted = sscanf (Number, "%li%c", (long*)&Val, &BoundsCheck); + Converted = sscanf (Number, "%li%c", (long*)&Val, &BoundsCheck); } /* Check if we do really have a number */ if (Converted != 1) { - Error ("Invalid number given in argument: %s\n", Arg); + Error ("Invalid number given in argument: %s\n", Arg); } /* Return the result */ @@ -217,7 +217,7 @@ static void OptCPU (const char* Opt attribute ((unused)), const char* Arg) static void OptDebugInfo (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Add debug info to the object file */ { DebugInfo = 1; @@ -226,7 +226,7 @@ static void OptDebugInfo (const char* Opt attribute ((unused)), static void OptFormFeeds (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Add form feeds to the output */ { FormFeeds = 1; @@ -235,7 +235,7 @@ static void OptFormFeeds (const char* Opt attribute ((unused)), static void OptHelp (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print usage information and exit */ { Usage (); @@ -245,7 +245,7 @@ static void OptHelp (const char* Opt attribute ((unused)), static void OptHexOffs (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Handle the --hexoffs option */ { UseHexOffs = 1; @@ -327,7 +327,7 @@ static void OptTextColumn (const char* Opt, const char* Arg) static void OptVerbose (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Increase verbosity */ { ++Verbosity; @@ -336,7 +336,7 @@ static void OptVerbose (const char* Opt attribute ((unused)), static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print the disassembler version */ { fprintf (stderr, "da65 V%s\n", GetVersionAsString ()); @@ -364,7 +364,7 @@ static void OneOpcode (unsigned RemainingBytes) if (Comment) { UserComment (Comment); } - DefLabel (GetLabelName (PC)); + DefLabel (GetLabelName (PC)); } /* Check... @@ -374,33 +374,33 @@ static void OneOpcode (unsigned RemainingBytes) * If any of these conditions is false, switch to data mode. */ if (Style == atDefault) { - if (D->Size > RemainingBytes) { - Style = atIllegal; - MarkAddr (PC, Style); - } else if (D->Flags & flIllegal) { - Style = atIllegal; - MarkAddr (PC, Style); - } else { - unsigned I; - for (I = 1; I < D->Size; ++I) { - if (HaveLabel (PC+I) || HaveSegmentChange (PC+I)) { - Style = atIllegal; - MarkAddr (PC, Style); - break; - } - } - } + if (D->Size > RemainingBytes) { + Style = atIllegal; + MarkAddr (PC, Style); + } else if (D->Flags & flIllegal) { + Style = atIllegal; + MarkAddr (PC, Style); + } else { + unsigned I; + for (I = 1; I < D->Size; ++I) { + if (HaveLabel (PC+I) || HaveSegmentChange (PC+I)) { + Style = atIllegal; + MarkAddr (PC, Style); + break; + } + } + } } /* Disassemble the line */ switch (Style) { - case atDefault: - D->Handler (D); - PC += D->Size; - break; + case atDefault: + D->Handler (D); + PC += D->Size; + break; - case atCode: + case atCode: /* Beware: If we don't have enough bytes left to disassemble the * following insn, fall through to byte mode. */ @@ -417,42 +417,42 @@ static void OneOpcode (unsigned RemainingBytes) } /* FALLTHROUGH */ - case atByteTab: - ByteTable (); - break; + case atByteTab: + ByteTable (); + break; case atDByteTab: DByteTable (); break; - case atWordTab: - WordTable (); - break; + case atWordTab: + WordTable (); + break; - case atDWordTab: - DWordTable (); - break; + case atDWordTab: + DWordTable (); + break; - case atAddrTab: - AddrTable (); - break; + case atAddrTab: + AddrTable (); + break; - case atRtsTab: - RtsTable (); - break; + case atRtsTab: + RtsTable (); + break; - case atTextTab: - TextTable (); - break; + case atTextTab: + TextTable (); + break; case atSkip: ++PC; break; - default: - DataByteLine (1); - ++PC; - break; + default: + DataByteLine (1); + ++PC; + break; } } @@ -466,7 +466,7 @@ static void OnePass (void) /* Disassemble until nothing left */ while ((Count = GetRemainingBytes()) > 0) { - OneOpcode (Count); + OneOpcode (Count); } } @@ -501,19 +501,19 @@ int main (int argc, char* argv []) { "--bytes-per-line", 1, OptBytesPerLine }, { "--comment-column", 1, OptCommentColumn }, { "--comments", 1, OptComments }, - { "--cpu", 1, OptCPU }, - { "--debug-info", 0, OptDebugInfo }, - { "--formfeeds", 0, OptFormFeeds }, - { "--help", 0, OptHelp }, - { "--hexoffs", 0, OptHexOffs }, - { "--info", 1, OptInfo }, + { "--cpu", 1, OptCPU }, + { "--debug-info", 0, OptDebugInfo }, + { "--formfeeds", 0, OptFormFeeds }, + { "--help", 0, OptHelp }, + { "--hexoffs", 0, OptHexOffs }, + { "--info", 1, OptInfo }, { "--label-break", 1, OptLabelBreak }, { "--mnemonic-column", 1, OptMnemonicColumn }, - { "--pagelength", 1, OptPageLength }, - { "--start-addr", 1, OptStartAddr }, + { "--pagelength", 1, OptPageLength }, + { "--start-addr", 1, OptStartAddr }, { "--text-column", 1, OptTextColumn }, - { "--verbose", 0, OptVerbose }, - { "--version", 0, OptVersion }, + { "--verbose", 0, OptVerbose }, + { "--version", 0, OptVersion }, }; unsigned I; @@ -526,63 +526,63 @@ int main (int argc, char* argv []) I = 1; while (I < ArgCount) { - /* Get the argument */ - const char* Arg = ArgVec[I]; + /* Get the argument */ + const char* Arg = ArgVec[I]; - /* Check for an option */ - if (Arg [0] == '-') { - switch (Arg [1]) { + /* Check for an option */ + if (Arg [0] == '-') { + switch (Arg [1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; - case 'g': - OptDebugInfo (Arg, 0); - break; + case 'g': + OptDebugInfo (Arg, 0); + break; - case 'h': - OptHelp (Arg, 0); - break; + case 'h': + OptHelp (Arg, 0); + break; - case 'i': - OptInfo (Arg, GetArg (&I, 2)); - break; + case 'i': + OptInfo (Arg, GetArg (&I, 2)); + break; - case 'o': - OutFile = GetArg (&I, 2); - break; + case 'o': + OutFile = GetArg (&I, 2); + break; - case 'v': - OptVerbose (Arg, 0); - break; + case 'v': + OptVerbose (Arg, 0); + break; - case 'S': - OptStartAddr (Arg, GetArg (&I, 2)); - break; + case 'S': + OptStartAddr (Arg, GetArg (&I, 2)); + break; - case 'V': - OptVersion (Arg, 0); - break; + case 'V': + OptVersion (Arg, 0); + break; - default: - UnknownOption (Arg); - break; + default: + UnknownOption (Arg); + break; - } - } else { - /* Filename. Check if we already had one */ - if (InFile) { - fprintf (stderr, "%s: Don't know what to do with `%s'\n", - ProgName, Arg); - exit (EXIT_FAILURE); - } else { - InFile = Arg; - } - } + } + } else { + /* Filename. Check if we already had one */ + if (InFile) { + fprintf (stderr, "%s: Don't know what to do with `%s'\n", + ProgName, Arg); + exit (EXIT_FAILURE); + } else { + InFile = Arg; + } + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Try to read the info file */ @@ -590,7 +590,7 @@ int main (int argc, char* argv []) /* Must have an input file */ if (InFile == 0) { - AbEnd ("No input file"); + AbEnd ("No input file"); } /* Check the formatting options for reasonable values. Note: We will not diff --git a/src/da65/opc6502.c b/src/da65/opc6502.c index 754d8f14e..b59db8d57 100644 --- a/src/da65/opc6502.c +++ b/src/da65/opc6502.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opc6502.c */ +/* opc6502.c */ /* */ /* 6502 opcode description table */ /* */ @@ -40,7 +40,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opc6502.h b/src/da65/opc6502.h index c74273bf6..26171cf61 100644 --- a/src/da65/opc6502.h +++ b/src/da65/opc6502.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opc6502.h */ +/* opc6502.h */ /* */ /* 6502 opcode description table */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opc6502x.c b/src/da65/opc6502x.c index 7b5080194..ee2c4e0ec 100644 --- a/src/da65/opc6502x.c +++ b/src/da65/opc6502x.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opc6502.c */ +/* opc6502.c */ /* */ /* 6502 opcode description table with NMOS illegals */ /* */ @@ -40,7 +40,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opc6502x.h b/src/da65/opc6502x.h index 85a420fd0..e086f87ae 100644 --- a/src/da65/opc6502x.h +++ b/src/da65/opc6502x.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opc6502.h */ +/* opc6502.h */ /* */ /* 6502 opcode description table with NMOS illegals */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opc65816.c b/src/da65/opc65816.c index b5afbcacf..520aafefb 100644 --- a/src/da65/opc65816.c +++ b/src/da65/opc65816.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opc65816.c */ +/* opc65816.c */ /* */ /* 65816 opcode description table */ /* */ @@ -40,7 +40,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opc65816.h b/src/da65/opc65816.h index 4bf5a9c22..4b0ac21f4 100644 --- a/src/da65/opc65816.h +++ b/src/da65/opc65816.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opc65816.h */ +/* opc65816.h */ /* */ /* 65816 opcode description table */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opc65c02.c b/src/da65/opc65c02.c index a451e5272..5d29a36de 100644 --- a/src/da65/opc65c02.c +++ b/src/da65/opc65c02.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opc65c02.c */ +/* opc65c02.c */ /* */ /* 65C02 opcode description table */ /* */ @@ -40,7 +40,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opc65c02.h b/src/da65/opc65c02.h index e60148e08..2addf5861 100644 --- a/src/da65/opc65c02.h +++ b/src/da65/opc65c02.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opc65c02.h */ +/* opc65c02.h */ /* */ /* 65C02 opcode description table */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opc65sc02.c b/src/da65/opc65sc02.c index 5f447dd3e..236a9ee34 100644 --- a/src/da65/opc65sc02.c +++ b/src/da65/opc65sc02.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opc65sc02.c */ +/* opc65sc02.c */ /* */ /* 65SC02 opcode description table */ /* */ @@ -40,7 +40,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opc65sc02.h b/src/da65/opc65sc02.h index cd08760ee..e9cd30a21 100644 --- a/src/da65/opc65sc02.h +++ b/src/da65/opc65sc02.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opc65sc02.h */ +/* opc65sc02.h */ /* */ /* 65SC02 opcode description table */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opcdesc.h b/src/da65/opcdesc.h index 9ff339fa5..093e71c9d 100644 --- a/src/da65/opcdesc.h +++ b/src/da65/opcdesc.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opcdesc.h */ +/* opcdesc.h */ /* */ /* Disassembler description for one opcode */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -47,10 +47,10 @@ /* Constants for Flags */ enum { flNone = 0x00, /* No flags given */ - flNoLabel = 0x00, /* Don't use a label */ - flGenLabel = 0x01, /* Generate a label */ - flUseLabel = 0x02, /* Use a label if there is one */ - flLabel = flUseLabel|flGenLabel, /* Generate and use a label */ + flNoLabel = 0x00, /* Don't use a label */ + flGenLabel = 0x01, /* Generate a label */ + flUseLabel = 0x02, /* Use a label if there is one */ + flLabel = flUseLabel|flGenLabel, /* Generate and use a label */ flIllegal = 0x10, /* Illegal instruction */ flAbsOverride = 0x20, /* Need a: override */ flFarOverride = 0x40 /* Need f: override */ @@ -64,10 +64,10 @@ typedef void (*OpcHandler) (const OpcDesc*); /* Description for one opcode */ struct OpcDesc { - char Mnemo [6]; /* Mnemonic */ - unsigned char Size; /* Size of this command */ - unsigned char Flags; /* Flags */ - OpcHandler Handler; /* Handler routine */ + char Mnemo [6]; /* Mnemonic */ + unsigned char Size; /* Size of this command */ + unsigned char Flags; /* Flags */ + OpcHandler Handler; /* Handler routine */ }; diff --git a/src/da65/opchuc6280.c b/src/da65/opchuc6280.c index de37c41d2..df6ba587b 100644 --- a/src/da65/opchuc6280.c +++ b/src/da65/opchuc6280.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opchuc6280.c */ +/* opchuc6280.c */ /* */ /* HuC6280 opcode description table */ /* */ @@ -40,7 +40,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opchuc6280.h b/src/da65/opchuc6280.h index 7bc72156c..26f5390a8 100644 --- a/src/da65/opchuc6280.h +++ b/src/da65/opchuc6280.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* opchuc6280.h */ +/* opchuc6280.h */ /* */ /* HuC6280 opcode description table */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opcm740.c b/src/da65/opcm740.c index 35940f7b9..2a2040515 100644 --- a/src/da65/opcm740.c +++ b/src/da65/opcm740.c @@ -41,7 +41,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opcm740.h b/src/da65/opcm740.h index 20d9ee69a..edfa20c8d 100644 --- a/src/da65/opcm740.h +++ b/src/da65/opcm740.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/da65/opctable.c b/src/da65/opctable.c index e29b66e7e..e44294b1e 100644 --- a/src/da65/opctable.c +++ b/src/da65/opctable.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* opctable.c */ +/* opctable.c */ /* */ -/* Disassembler opcode description table */ +/* Disassembler opcode description table */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,7 +58,7 @@ const OpcDesc* OpcTable = OpcTable_6502; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/opctable.h b/src/da65/opctable.h index a576865be..2835fba01 100644 --- a/src/da65/opctable.h +++ b/src/da65/opctable.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* opctable.h */ +/* opctable.h */ /* */ -/* Disassembler opcode description table */ +/* Disassembler opcode description table */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,7 +58,7 @@ extern const OpcDesc* OpcTable; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/output.c b/src/da65/output.c index 48db5ee20..3bfebc428 100644 --- a/src/da65/output.c +++ b/src/da65/output.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* output.c */ +/* output.c */ /* */ -/* Disassembler output routines */ +/* Disassembler output routines */ /* */ /* */ /* */ @@ -53,20 +53,20 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -static FILE* F = 0; /* Output stream */ -static unsigned Col = 1; /* Current column */ -static unsigned Line = 0; /* Current line on page */ -static unsigned Page = 1; /* Current output page */ +static FILE* F = 0; /* Output stream */ +static unsigned Col = 1; /* Current column */ +static unsigned Line = 0; /* Current line on page */ +static unsigned Page = 1; /* Current output page */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -75,14 +75,14 @@ static void PageHeader (void) /* Print a page header */ { fprintf (F, - "; da65 V%s\n" + "; da65 V%s\n" "; Created: %s\n" - "; Input file: %s\n" - "; Page: %u\n\n", - GetVersionAsString (), + "; Input file: %s\n" + "; Page: %u\n\n", + GetVersionAsString (), Now, - InFile, - Page); + InFile, + Page); } @@ -112,7 +112,7 @@ void CloseOutput (void) /* Close the output file */ { if (F != stdout && fclose (F) != 0) { - Error ("Error closing output file: %s", strerror (errno)); + Error ("Error closing output file: %s", strerror (errno)); } } @@ -122,10 +122,10 @@ void Output (const char* Format, ...) /* Write to the output file */ { if (Pass == PassCount) { - va_list ap; - va_start (ap, Format); - Col += vfprintf (F, Format, ap); - va_end (ap); + va_list ap; + va_start (ap, Format); + Col += vfprintf (F, Format, ap); + va_end (ap); } } @@ -135,10 +135,10 @@ void Indent (unsigned N) /* Make sure the current line column is at position N (zero based) */ { if (Pass == PassCount) { - while (Col < N) { - fputc (' ', F); - ++Col; - } + while (Col < N) { + fputc (' ', F); + ++Col; + } } } @@ -148,16 +148,16 @@ void LineFeed (void) /* Add a linefeed to the output file */ { if (Pass == PassCount) { - fputc ('\n', F); - if (PageLength > 0 && ++Line >= PageLength) { - if (FormFeeds) { - fputc ('\f', F); - } - ++Page; - PageHeader (); - Line = 5; - } - Col = 1; + fputc ('\n', F); + if (PageLength > 0 && ++Line >= PageLength) { + if (FormFeeds) { + fputc ('\f', F); + } + ++Page; + PageHeader (); + Line = 5; + } + Col = 1; } } @@ -171,7 +171,7 @@ void DefLabel (const char* Name) * the opcode column, start a new line. */ if (Col > LBreak+2 || Col > MCol) { - LineFeed (); + LineFeed (); } } @@ -249,11 +249,11 @@ void DataByteLine (unsigned ByteCount) Output (".byte"); Indent (ACol); for (I = 0; I < ByteCount; ++I) { - if (I > 0) { - Output (",$%02X", CodeBuf[PC+I]); - } else { - Output ("$%02X", CodeBuf[PC+I]); - } + if (I > 0) { + Output (",$%02X", CodeBuf[PC+I]); + } else { + Output ("$%02X", CodeBuf[PC+I]); + } } LineComment (PC, ByteCount); LineFeed (); @@ -270,11 +270,11 @@ void DataDByteLine (unsigned ByteCount) Output (".dbyt"); Indent (ACol); for (I = 0; I < ByteCount; I += 2) { - if (I > 0) { - Output (",$%04X", GetCodeDByte (PC+I)); - } else { - Output ("$%04X", GetCodeDByte (PC+I)); - } + if (I > 0) { + Output (",$%04X", GetCodeDByte (PC+I)); + } else { + Output ("$%04X", GetCodeDByte (PC+I)); + } } LineComment (PC, ByteCount); LineFeed (); @@ -291,11 +291,11 @@ void DataWordLine (unsigned ByteCount) Output (".word"); Indent (ACol); for (I = 0; I < ByteCount; I += 2) { - if (I > 0) { - Output (",$%04X", GetCodeWord (PC+I)); - } else { - Output ("$%04X", GetCodeWord (PC+I)); - } + if (I > 0) { + Output (",$%04X", GetCodeWord (PC+I)); + } else { + Output ("$%04X", GetCodeWord (PC+I)); + } } LineComment (PC, ByteCount); LineFeed (); @@ -312,11 +312,11 @@ void DataDWordLine (unsigned ByteCount) Output (".dword"); Indent (ACol); for (I = 0; I < ByteCount; I += 4) { - if (I > 0) { - Output (",$%08lX", GetCodeDWord (PC+I)); - } else { - Output ("$%08lX", GetCodeDWord (PC+I)); - } + if (I > 0) { + Output (",$%08lX", GetCodeDWord (PC+I)); + } else { + Output ("$%08lX", GetCodeDWord (PC+I)); + } } LineComment (PC, ByteCount); LineFeed (); @@ -328,8 +328,8 @@ void SeparatorLine (void) /* Print a separator line */ { if (Pass == PassCount && Comments >= 1) { - Output ("; ----------------------------------------------------------------------------"); - LineFeed (); + Output ("; ----------------------------------------------------------------------------"); + LineFeed (); } } @@ -350,23 +350,23 @@ void LineComment (unsigned PC, unsigned Count) unsigned I; if (Pass == PassCount && Comments >= 2) { - Indent (CCol); - Output ("; %04X", PC); - if (Comments >= 3) { - for (I = 0; I < Count; ++I) { - Output (" %02X", CodeBuf [PC+I]); - } - if (Comments >= 4) { - Indent (TCol); - for (I = 0; I < Count; ++I) { - unsigned char C = CodeBuf [PC+I]; - if (!isprint (C)) { - C = '.'; - } - Output ("%c", C); - } - } - } + Indent (CCol); + Output ("; %04X", PC); + if (Comments >= 3) { + for (I = 0; I < Count; ++I) { + Output (" %02X", CodeBuf [PC+I]); + } + if (Comments >= 4) { + Indent (TCol); + for (I = 0; I < Count; ++I) { + unsigned char C = CodeBuf [PC+I]; + if (!isprint (C)) { + C = '.'; + } + Output ("%c", C); + } + } + } } } diff --git a/src/da65/output.h b/src/da65/output.h index 37c0915c8..16e2ee3be 100644 --- a/src/da65/output.h +++ b/src/da65/output.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* output.h */ +/* output.h */ /* */ -/* Disassembler output routines */ +/* Disassembler output routines */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/scanner.c b/src/da65/scanner.c index 176a6869e..dab5ffe98 100644 --- a/src/da65/scanner.c +++ b/src/da65/scanner.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* scanner.c */ +/* scanner.c */ /* */ -/* Configuration file scanner for the da65 disassembler */ +/* Configuration file scanner for the da65 disassembler */ /* */ /* */ /* */ @@ -50,33 +50,33 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Current token and attributes */ unsigned InfoTok; -char InfoSVal [CFG_MAX_IDENT_LEN+1]; +char InfoSVal [CFG_MAX_IDENT_LEN+1]; long InfoIVal; /* Error location */ -unsigned InfoErrorLine; -unsigned InfoErrorCol; +unsigned InfoErrorLine; +unsigned InfoErrorCol; /* Input sources for the configuration */ -static const char* InfoFile = 0; +static const char* InfoFile = 0; /* Other input stuff */ -static int C = ' '; -static unsigned InputLine = 1; -static unsigned InputCol = 0; -static FILE* InputFile = 0; +static int C = ' '; +static unsigned InputLine = 1; +static unsigned InputCol = 0; +static FILE* InputFile = 0; /*****************************************************************************/ -/* Error handling */ +/* Error handling */ /*****************************************************************************/ @@ -112,7 +112,7 @@ void InfoError (const char* Format, ...) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -125,13 +125,13 @@ static void NextChar (void) /* Count columns */ if (C != EOF) { - ++InputCol; + ++InputCol; } /* Count lines */ if (C == '\n') { - ++InputLine; - InputCol = 0; + ++InputLine; + InputCol = 0; } } @@ -141,9 +141,9 @@ static unsigned DigitVal (int C) /* Return the value for a numeric digit */ { if (IsDigit (C)) { - return C - '0'; + return C - '0'; } else { - return toupper (C) - 'A' + 10; + return toupper (C) - 'A' + 10; } } @@ -153,12 +153,12 @@ void InfoNextTok (void) /* Read the next token from the input stream */ { unsigned I; - int Esc; + int Esc; Again: /* Skip whitespace */ while (IsSpace (C)) { - NextChar (); + NextChar (); } /* Remember the current position */ @@ -168,110 +168,110 @@ Again: /* Identifier? */ if (C == '_' || IsAlpha (C)) { - /* Read the identifier */ - I = 0; - while (C == '_' || IsAlNum (C)) { - if (I < CFG_MAX_IDENT_LEN) { - InfoSVal [I++] = C; - } - NextChar (); - } - InfoSVal [I] = '\0'; - InfoTok = INFOTOK_IDENT; - return; + /* Read the identifier */ + I = 0; + while (C == '_' || IsAlNum (C)) { + if (I < CFG_MAX_IDENT_LEN) { + InfoSVal [I++] = C; + } + NextChar (); + } + InfoSVal [I] = '\0'; + InfoTok = INFOTOK_IDENT; + return; } /* Hex number? */ if (C == '$') { - NextChar (); - if (!IsXDigit (C)) { - InfoError ("Hex digit expected"); - } - InfoIVal = 0; - while (IsXDigit (C)) { - InfoIVal = InfoIVal * 16 + DigitVal (C); - NextChar (); - } - InfoTok = INFOTOK_INTCON; - return; + NextChar (); + if (!IsXDigit (C)) { + InfoError ("Hex digit expected"); + } + InfoIVal = 0; + while (IsXDigit (C)) { + InfoIVal = InfoIVal * 16 + DigitVal (C); + NextChar (); + } + InfoTok = INFOTOK_INTCON; + return; } /* Decimal number? */ if (IsDigit (C)) { - InfoIVal = 0; - while (IsDigit (C)) { - InfoIVal = InfoIVal * 10 + DigitVal (C); - NextChar (); - } - InfoTok = INFOTOK_INTCON; - return; + InfoIVal = 0; + while (IsDigit (C)) { + InfoIVal = InfoIVal * 10 + DigitVal (C); + NextChar (); + } + InfoTok = INFOTOK_INTCON; + return; } /* Other characters */ switch (C) { - case '{': - NextChar (); - InfoTok = INFOTOK_LCURLY; - break; + case '{': + NextChar (); + InfoTok = INFOTOK_LCURLY; + break; - case '}': - NextChar (); - InfoTok = INFOTOK_RCURLY; - break; + case '}': + NextChar (); + InfoTok = INFOTOK_RCURLY; + break; - case ';': - NextChar (); - InfoTok = INFOTOK_SEMI; - break; + case ';': + NextChar (); + InfoTok = INFOTOK_SEMI; + break; - case '.': - NextChar (); - InfoTok = INFOTOK_DOT; - break; + case '.': + NextChar (); + InfoTok = INFOTOK_DOT; + break; - case ',': - NextChar (); - InfoTok = INFOTOK_COMMA; - break; + case ',': + NextChar (); + InfoTok = INFOTOK_COMMA; + break; - case '=': - NextChar (); - InfoTok = INFOTOK_EQ; - break; + case '=': + NextChar (); + InfoTok = INFOTOK_EQ; + break; case ':': - NextChar (); - InfoTok = INFOTOK_COLON; - break; + NextChar (); + InfoTok = INFOTOK_COLON; + break; case '\"': - NextChar (); - I = 0; - while (C != '\"') { - Esc = (C == '\\'); - if (Esc) { - NextChar (); - } - if (C == EOF || C == '\n') { - InfoError ("Unterminated string"); - } - if (Esc) { - switch (C) { - case '\"': C = '\"'; break; - case '\'': C = '\''; break; - default: InfoError ("Invalid escape char: %c", C); - } - } - if (I < CFG_MAX_IDENT_LEN) { - InfoSVal [I++] = C; - } - NextChar (); - } - NextChar (); - InfoSVal [I] = '\0'; - InfoTok = INFOTOK_STRCON; - break; + NextChar (); + I = 0; + while (C != '\"') { + Esc = (C == '\\'); + if (Esc) { + NextChar (); + } + if (C == EOF || C == '\n') { + InfoError ("Unterminated string"); + } + if (Esc) { + switch (C) { + case '\"': C = '\"'; break; + case '\'': C = '\''; break; + default: InfoError ("Invalid escape char: %c", C); + } + } + if (I < CFG_MAX_IDENT_LEN) { + InfoSVal [I++] = C; + } + NextChar (); + } + NextChar (); + InfoSVal [I] = '\0'; + InfoTok = INFOTOK_STRCON; + break; case '\'': NextChar (); @@ -288,22 +288,22 @@ Again: break; case '#': - /* Comment */ - while (C != '\n' && C != EOF) { - NextChar (); - } - if (C != EOF) { - goto Again; - } - InfoTok = INFOTOK_EOF; - break; + /* Comment */ + while (C != '\n' && C != EOF) { + NextChar (); + } + if (C != EOF) { + goto Again; + } + InfoTok = INFOTOK_EOF; + break; case EOF: - InfoTok = INFOTOK_EOF; - break; + InfoTok = INFOTOK_EOF; + break; - default: - InfoError ("Invalid character `%c'", C); + default: + InfoError ("Invalid character `%c'", C); } } @@ -314,7 +314,7 @@ void InfoConsume (unsigned T, const char* Msg) /* Skip a token, print an error message if not found */ { if (InfoTok != T) { - InfoError (Msg); + InfoError (Msg); } InfoNextTok (); } @@ -357,7 +357,7 @@ void InfoOptionalComma (void) /* Consume a comma if there is one */ { if (InfoTok == INFOTOK_COMMA) { - InfoNextTok (); + InfoNextTok (); } } @@ -367,7 +367,7 @@ void InfoOptionalAssign (void) /* Consume an equal sign if there is one */ { if (InfoTok == INFOTOK_EQ) { - InfoNextTok (); + InfoNextTok (); } } @@ -377,7 +377,7 @@ void InfoAssureInt (void) /* Make sure the next token is an integer */ { if (InfoTok != INFOTOK_INTCON) { - InfoError ("Integer constant expected"); + InfoError ("Integer constant expected"); } } @@ -387,7 +387,7 @@ void InfoAssureStr (void) /* Make sure the next token is a string constant */ { if (InfoTok != INFOTOK_STRCON) { - InfoError ("String constant expected"); + InfoError ("String constant expected"); } } @@ -397,7 +397,7 @@ void InfoAssureChar (void) /* Make sure the next token is a char constant */ { if (InfoTok != INFOTOK_STRCON) { - InfoError ("Character constant expected"); + InfoError ("Character constant expected"); } } @@ -407,7 +407,7 @@ void InfoAssureIdent (void) /* Make sure the next token is an identifier */ { if (InfoTok != INFOTOK_IDENT) { - InfoError ("Identifier expected"); + InfoError ("Identifier expected"); } } @@ -417,7 +417,7 @@ void InfoRangeCheck (long Lo, long Hi) /* Check the range of InfoIVal */ { if (InfoIVal < Lo || InfoIVal > Hi) { - InfoError ("Range error"); + InfoError ("Range error"); } } @@ -431,20 +431,20 @@ void InfoSpecialToken (const IdentTok* Table, unsigned Size, const char* Name) /* We need an identifier */ if (InfoTok == INFOTOK_IDENT) { - /* Make it upper case */ - I = 0; - while (InfoSVal [I]) { - InfoSVal [I] = toupper (InfoSVal [I]); - ++I; - } + /* Make it upper case */ + I = 0; + while (InfoSVal [I]) { + InfoSVal [I] = toupper (InfoSVal [I]); + ++I; + } - /* Linear search */ - for (I = 0; I < Size; ++I) { - if (strcmp (InfoSVal, Table [I].Ident) == 0) { - InfoTok = Table [I].Tok; - return; - } - } + /* Linear search */ + for (I = 0; I < Size; ++I) { + if (strcmp (InfoSVal, Table [I].Ident) == 0) { + InfoTok = Table [I].Tok; + return; + } + } } @@ -458,23 +458,23 @@ void InfoBoolToken (void) /* Map an identifier or integer to a boolean token */ { static const IdentTok Booleans [] = { - { "YES", INFOTOK_TRUE }, - { "NO", INFOTOK_FALSE }, + { "YES", INFOTOK_TRUE }, + { "NO", INFOTOK_FALSE }, { "TRUE", INFOTOK_TRUE }, { "FALSE", INFOTOK_FALSE }, - { "ON", INFOTOK_TRUE }, - { "OFF", INFOTOK_FALSE }, + { "ON", INFOTOK_TRUE }, + { "OFF", INFOTOK_FALSE }, }; /* If we have an identifier, map it to a boolean token */ if (InfoTok == INFOTOK_IDENT) { - InfoSpecialToken (Booleans, ENTRY_COUNT (Booleans), "Boolean"); + InfoSpecialToken (Booleans, ENTRY_COUNT (Booleans), "Boolean"); } else { - /* We expected an integer here */ - if (InfoTok != INFOTOK_INTCON) { - InfoError ("Boolean value expected"); - } - InfoTok = (InfoIVal == 0)? INFOTOK_FALSE : INFOTOK_TRUE; + /* We expected an integer here */ + if (InfoTok != INFOTOK_INTCON) { + InfoError ("Boolean value expected"); + } + InfoTok = (InfoIVal == 0)? INFOTOK_FALSE : INFOTOK_TRUE; } } @@ -530,7 +530,7 @@ void InfoCloseInput (void) /* Close the input file if we had one */ if (InputFile) { (void) fclose (InputFile); - InputFile = 0; + InputFile = 0; } } diff --git a/src/da65/scanner.h b/src/da65/scanner.h index d1eeec024..46b9d29fc 100644 --- a/src/da65/scanner.h +++ b/src/da65/scanner.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* scanner.h */ +/* scanner.h */ /* */ -/* Configuration file scanner for the da65 disassembler */ +/* Configuration file scanner for the da65 disassembler */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -120,27 +120,27 @@ typedef enum token_t { /* Mapping table entry, special identifier --> token */ typedef struct IdentTok IdentTok; struct IdentTok { - const char* Ident; /* Identifier */ - token_t Tok; /* Token for identifier */ + const char* Ident; /* Identifier */ + token_t Tok; /* Token for identifier */ }; -#define ENTRY_COUNT(s) (sizeof (s) / sizeof (s [0])) +#define ENTRY_COUNT(s) (sizeof (s) / sizeof (s [0])) /* Current token and attributes */ #define CFG_MAX_IDENT_LEN 255 -extern unsigned InfoTok; -extern char InfoSVal[CFG_MAX_IDENT_LEN+1]; -extern long InfoIVal; +extern unsigned InfoTok; +extern char InfoSVal[CFG_MAX_IDENT_LEN+1]; +extern long InfoIVal; /* Error location */ -extern unsigned InfoErrorLine; -extern unsigned InfoErrorCol; +extern unsigned InfoErrorLine; +extern unsigned InfoErrorCol; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/segment.c b/src/da65/segment.c index 1098efdc4..479f8f973 100644 --- a/src/da65/segment.c +++ b/src/da65/segment.c @@ -74,7 +74,7 @@ static Segment* EndTab[HASH_SIZE]; /* Table containing segment ends */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/da65/segment.h b/src/da65/segment.h index a27720bee..b2dc26488 100644 --- a/src/da65/segment.h +++ b/src/da65/segment.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/dbginfo/dbginfo.c b/src/dbginfo/dbginfo.c index f7d517c36..16bc9d9de 100644 --- a/src/dbginfo/dbginfo.c +++ b/src/dbginfo/dbginfo.c @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -84,8 +84,8 @@ union CollEntry { typedef struct Collection Collection; struct Collection { - unsigned Count; /* Number of items in the list */ - unsigned Size; /* Size of allocated array */ + unsigned Count; /* Number of items in the list */ + unsigned Size; /* Size of allocated array */ CollEntry* Items; /* Array with dynamic size */ }; @@ -161,7 +161,7 @@ typedef enum { TOK_SCOPE, /* SCOPE keyword */ TOK_SEGMENT, /* SEGMENT keyword */ TOK_SIZE, /* SIZE keyword */ - TOK_SPAN, /* SPAN keyword */ + TOK_SPAN, /* SPAN keyword */ TOK_START, /* START keyword */ TOK_STATIC, /* STATIC keyword */ TOK_STRUCT, /* STRUCT keyword */ @@ -194,14 +194,14 @@ struct DbgInfo { Collection ModInfoById; /* Module infos sorted by id */ Collection ScopeInfoById; /* Scope infos sorted by id */ Collection SegInfoById; /* Segment infos sorted by id */ - Collection SpanInfoById; /* Span infos sorted by id */ + Collection SpanInfoById; /* Span infos sorted by id */ Collection SymInfoById; /* Symbol infos sorted by id */ Collection TypeInfoById; /* Type infos sorted by id */ /* Collections with other sort criteria */ Collection CSymFuncByName; /* C functions sorted by name */ Collection FileInfoByName; /* File infos sorted by name */ - Collection ModInfoByName; /* Module info sorted by name */ + Collection ModInfoByName; /* Module info sorted by name */ Collection ScopeInfoByName;/* Scope infos sorted by name */ Collection SegInfoByName; /* Segment infos sorted by name */ Collection SymInfoByName; /* Symbol infos sorted by name */ @@ -333,7 +333,7 @@ struct ScopeInfo { SymInfo* Info; /* Pointer to label symbol */ } Label; CSymInfo* CSymFunc; /* C function for this scope */ - Collection SpanInfoList; /* List of spans for this scope */ + Collection SpanInfoList; /* List of spans for this scope */ Collection SymInfoByName; /* Symbols in this scope */ Collection* CSymInfoByName; /* C symbols for this scope */ Collection* ChildScopeList; /* Child scopes of this scope */ @@ -356,14 +356,14 @@ struct SpanInfo { cc65_addr Start; /* Start of span */ cc65_addr End; /* End of span */ union { - unsigned Id; /* Id of segment */ - SegInfo* Info; /* Pointer to segment */ + unsigned Id; /* Id of segment */ + SegInfo* Info; /* Pointer to segment */ } Seg; union { unsigned Id; /* Id of type */ TypeInfo* Info; /* Pointer to type */ } Type; - Collection* ScopeInfoList; /* Scopes for this span */ + Collection* ScopeInfoList; /* Scopes for this span */ Collection* LineInfoList; /* Lines for this span */ }; @@ -504,12 +504,12 @@ static void SB_Realloc (StrBuf* B, unsigned NewSize) /* Get the current size, use a minimum of 8 bytes */ unsigned NewAllocated = B->Allocated; if (NewAllocated == 0) { - NewAllocated = 8; + NewAllocated = 8; } /* Round up to the next power of two */ while (NewAllocated < NewSize) { - NewAllocated *= 2; + NewAllocated *= 2; } /* Reallocate the buffer. Beware: The allocated size may be zero while the @@ -539,12 +539,12 @@ static void SB_CheapRealloc (StrBuf* B, unsigned NewSize) /* Get the current size, use a minimum of 8 bytes */ unsigned NewAllocated = B->Allocated; if (NewAllocated == 0) { - NewAllocated = 8; + NewAllocated = 8; } /* Round up to the next power of two */ while (NewAllocated < NewSize) { - NewAllocated *= 2; + NewAllocated *= 2; } /* Free the old buffer if there is one */ @@ -601,7 +601,7 @@ static void SB_Terminate (StrBuf* B) { unsigned NewLen = B->Len + 1; if (NewLen > B->Allocated) { - SB_Realloc (B, NewLen); + SB_Realloc (B, NewLen); } B->Buf[B->Len] = '\0'; } @@ -643,7 +643,7 @@ static void SB_AppendChar (StrBuf* B, int C) { unsigned NewLen = B->Len + 1; if (NewLen > B->Allocated) { - SB_Realloc (B, NewLen); + SB_Realloc (B, NewLen); } B->Buf[B->Len] = (char) C; B->Len = NewLen; @@ -722,8 +722,8 @@ static void CollFree (Collection* C) { /* Accept NULL pointers */ if (C) { - xfree (C->Items); - xfree (C); + xfree (C->Items); + xfree (C); } } @@ -788,13 +788,13 @@ static void CollPrepareInsert (Collection* C, unsigned Index) /* Grow the array if necessary */ if (C->Count >= C->Size) { - /* Must grow */ + /* Must grow */ CollGrow (C, (C->Size == 0)? 1 : C->Size * 2); } /* Move the existing elements if needed */ if (C->Count != Index) { - memmove (C->Items+Index+1, C->Items+Index, (C->Count-Index) * sizeof (void*)); + memmove (C->Items+Index+1, C->Items+Index, (C->Count-Index) * sizeof (void*)); } ++C->Count; } @@ -913,7 +913,7 @@ static unsigned CollIdAt (const Collection* C, unsigned Index) static void CollQuickSort (Collection* C, int Lo, int Hi, - int (*Compare) (const void*, const void*)) + int (*Compare) (const void*, const void*)) /* Internal recursive sort function. */ { /* Get a pointer to the items */ @@ -921,37 +921,37 @@ static void CollQuickSort (Collection* C, int Lo, int Hi, /* Quicksort */ while (Hi > Lo) { - int I = Lo + 1; - int J = Hi; - while (I <= J) { - while (I <= J && Compare (Items[Lo].Ptr, Items[I].Ptr) >= 0) { - ++I; - } - while (I <= J && Compare (Items[Lo].Ptr, Items[J].Ptr) < 0) { - --J; - } - if (I <= J) { - /* Swap I and J */ - CollEntry Tmp = Items[I]; - Items[I] = Items[J]; - Items[J] = Tmp; - ++I; - --J; - } - } - if (J != Lo) { - /* Swap J and Lo */ - CollEntry Tmp = Items[J]; - Items[J] = Items[Lo]; - Items[Lo] = Tmp; - } - if (J > (Hi + Lo) / 2) { - CollQuickSort (C, J + 1, Hi, Compare); - Hi = J - 1; - } else { - CollQuickSort (C, Lo, J - 1, Compare); - Lo = J + 1; - } + int I = Lo + 1; + int J = Hi; + while (I <= J) { + while (I <= J && Compare (Items[Lo].Ptr, Items[I].Ptr) >= 0) { + ++I; + } + while (I <= J && Compare (Items[Lo].Ptr, Items[J].Ptr) < 0) { + --J; + } + if (I <= J) { + /* Swap I and J */ + CollEntry Tmp = Items[I]; + Items[I] = Items[J]; + Items[J] = Tmp; + ++I; + --J; + } + } + if (J != Lo) { + /* Swap J and Lo */ + CollEntry Tmp = Items[J]; + Items[J] = Items[Lo]; + Items[Lo] = Tmp; + } + if (J > (Hi + Lo) / 2) { + CollQuickSort (C, J + 1, Hi, Compare); + Hi = J - 1; + } else { + CollQuickSort (C, Lo, J - 1, Compare); + Lo = J + 1; + } } } @@ -2492,9 +2492,9 @@ static int DigitVal (int C) /* Return the value for a numeric digit. Return -1 if C is invalid */ { if (isdigit (C)) { - return C - '0'; + return C - '0'; } else if (isxdigit (C)) { - return toupper (C) - 'A' + 10; + return toupper (C) - 'A' + 10; } else { return -1; } @@ -2562,7 +2562,7 @@ static void NextToken (InputData* D) { "scope", TOK_SCOPE }, { "seg", TOK_SEGMENT }, { "size", TOK_SIZE }, - { "span", TOK_SPAN }, + { "span", TOK_SPAN }, { "start", TOK_START }, { "static", TOK_STATIC }, { "struct", TOK_STRUCT }, @@ -2577,7 +2577,7 @@ static void NextToken (InputData* D) /* Skip whitespace */ while (D->C == ' ' || D->C == '\t' || D->C == '\r') { - NextChar (D); + NextChar (D); } /* Remember the current position as start of the next token */ @@ -2589,13 +2589,13 @@ static void NextToken (InputData* D) const struct KeywordEntry* Entry; - /* Read the identifier */ + /* Read the identifier */ SB_Clear (&D->SVal); - while (D->C == '_' || isalnum (D->C)) { + while (D->C == '_' || isalnum (D->C)) { SB_AppendChar (&D->SVal, D->C); - NextChar (D); - } - SB_Terminate (&D->SVal); + NextChar (D); + } + SB_Terminate (&D->SVal); /* Search the identifier in the keyword table */ Entry = bsearch (SB_GetConstBuf (&D->SVal), @@ -2608,7 +2608,7 @@ static void NextToken (InputData* D) } else { D->Tok = Entry->Tok; } - return; + return; } /* Number? */ @@ -2626,13 +2626,13 @@ static void NextToken (InputData* D) } else { Base = 10; } - D->IVal = 0; + D->IVal = 0; while ((Val = DigitVal (D->C)) >= 0 && Val < Base) { - D->IVal = D->IVal * Base + Val; - NextChar (D); - } - D->Tok = TOK_INTCON; - return; + D->IVal = D->IVal * Base + Val; + NextChar (D); + } + D->Tok = TOK_INTCON; + return; } /* Other characters */ @@ -2648,15 +2648,15 @@ static void NextToken (InputData* D) D->Tok = TOK_PLUS; break; - case ',': - NextChar (D); - D->Tok = TOK_COMMA; - break; + case ',': + NextChar (D); + D->Tok = TOK_COMMA; + break; - case '=': - NextChar (D); - D->Tok = TOK_EQUAL; - break; + case '=': + NextChar (D); + D->Tok = TOK_EQUAL; + break; case '\"': SB_Clear (&D->SVal); @@ -2675,7 +2675,7 @@ static void NextToken (InputData* D) } SB_Terminate (&D->SVal); D->Tok = TOK_STRCON; - break; + break; case '\n': NextChar (D); @@ -2683,11 +2683,11 @@ static void NextToken (InputData* D) break; case EOF: - D->Tok = TOK_EOF; - break; + D->Tok = TOK_EOF; + break; - default: - ParseError (D, CC65_ERROR, "Invalid input character `%c'", D->C); + default: + ParseError (D, CC65_ERROR, "Invalid input character `%c'", D->C); } } @@ -3157,7 +3157,7 @@ static void ParseInfo (InputData* D) case TOK_FILE: CollGrow (&D->Info->FileInfoById, D->IVal); - CollGrow (&D->Info->FileInfoByName, D->IVal); + CollGrow (&D->Info->FileInfoByName, D->IVal); break; case TOK_LIBRARY: @@ -3170,7 +3170,7 @@ static void ParseInfo (InputData* D) case TOK_MODULE: CollGrow (&D->Info->ModInfoById, D->IVal); - CollGrow (&D->Info->ModInfoByName, D->IVal); + CollGrow (&D->Info->ModInfoByName, D->IVal); break; case TOK_SCOPE: @@ -3180,7 +3180,7 @@ static void ParseInfo (InputData* D) case TOK_SEGMENT: CollGrow (&D->Info->SegInfoById, D->IVal); - CollGrow (&D->Info->SegInfoByName, D->IVal); + CollGrow (&D->Info->SegInfoByName, D->IVal); break; case TOK_SPAN: @@ -3190,7 +3190,7 @@ static void ParseInfo (InputData* D) case TOK_SYM: CollGrow (&D->Info->SymInfoById, D->IVal); CollGrow (&D->Info->SymInfoByName, D->IVal); - CollGrow (&D->Info->SymInfoByVal, D->IVal); + CollGrow (&D->Info->SymInfoByVal, D->IVal); break; case TOK_TYPE: @@ -3414,7 +3414,7 @@ static void ParseLine (InputData* D) InfoBits |= ibLine; break; - case TOK_SPAN: + case TOK_SPAN: while (1) { if (!IntConstFollows (D)) { goto ErrorExit; @@ -3640,7 +3640,7 @@ static void ParseScope (InputData* D) StrBuf Name = STRBUF_INITIALIZER; unsigned ModId = CC65_INV_ID; unsigned ParentId = CC65_INV_ID; - Collection SpanIds = COLLECTION_INITIALIZER; + Collection SpanIds = COLLECTION_INITIALIZER; unsigned SymId = CC65_INV_ID; ScopeInfo* S; enum { @@ -3651,7 +3651,7 @@ static void ParseScope (InputData* D) ibName = 0x004, ibParentId = 0x008, ibSize = 0x010, - ibSpanId = 0x020, + ibSpanId = 0x020, ibSymId = 0x040, ibType = 0x080, @@ -3669,8 +3669,8 @@ static void ParseScope (InputData* D) /* Something we know? */ if (D->Tok != TOK_ID && D->Tok != TOK_MODULE && D->Tok != TOK_NAME && D->Tok != TOK_PARENT && - D->Tok != TOK_SIZE && D->Tok != TOK_SPAN && - D->Tok != TOK_SYM && D->Tok != TOK_TYPE) { + D->Tok != TOK_SIZE && D->Tok != TOK_SPAN && + D->Tok != TOK_SYM && D->Tok != TOK_TYPE) { /* Try smart error recovery */ if (D->Tok == TOK_IDENT || TokenIsKeyword (D->Tok)) { @@ -3738,7 +3738,7 @@ static void ParseScope (InputData* D) NextToken (D); break; - case TOK_SPAN: + case TOK_SPAN: while (1) { if (!IntConstFollows (D)) { goto ErrorExit; @@ -4011,14 +4011,14 @@ static void ParseSpan (InputData* D) unsigned Id = 0; cc65_addr Start = 0; cc65_addr Size = 0; - unsigned SegId = CC65_INV_ID; + unsigned SegId = CC65_INV_ID; unsigned TypeId = CC65_INV_ID; SpanInfo* S; enum { ibNone = 0x000, ibId = 0x01, - ibSegId = 0x02, + ibSegId = 0x02, ibSize = 0x04, ibStart = 0x08, ibType = 0x10, @@ -4035,8 +4035,8 @@ static void ParseSpan (InputData* D) Token Tok; /* Something we know? */ - if (D->Tok != TOK_ID && D->Tok != TOK_SEGMENT && - D->Tok != TOK_SIZE && D->Tok != TOK_START && + if (D->Tok != TOK_ID && D->Tok != TOK_SEGMENT && + D->Tok != TOK_SIZE && D->Tok != TOK_START && D->Tok != TOK_TYPE) { /* Try smart error recovery */ @@ -5128,7 +5128,7 @@ static void ProcessLineInfo (InputData* D) CollAppend (&L->File.Info->LineInfoByLine, L); } - /* Resolve the spans ids */ + /* Resolve the spans ids */ for (J = 0; J < CollCount (&L->SpanInfoList); ++J) { /* Get the id of this span */ @@ -5148,9 +5148,9 @@ static void ProcessLineInfo (InputData* D) CollReplace (&L->SpanInfoList, SP, J); /* Insert a backpointer into the span */ - if (SP->LineInfoList == 0) { - SP->LineInfoList = CollNew (); - } + if (SP->LineInfoList == 0) { + SP->LineInfoList = CollNew (); + } CollAppend (SP->LineInfoList, L); } } @@ -5194,7 +5194,7 @@ static void ProcessModInfo (InputData* D) } /* Resolve the library */ - if (M->Lib.Id == CC65_INV_ID) { + if (M->Lib.Id == CC65_INV_ID) { M->Lib.Info = 0; } else if (M->Lib.Id >= CollCount (&D->Info->LibInfoById)) { ParseError (D, @@ -5287,7 +5287,7 @@ static void ProcessScopeInfo (InputData* D) S->Label.Info = CollAt (&D->Info->SymInfoById, S->Label.Id); } - /* Resolve the spans ids */ + /* Resolve the spans ids */ for (J = 0; J < CollCount (&S->SpanInfoList); ++J) { /* Get the id of this span */ @@ -5307,9 +5307,9 @@ static void ProcessScopeInfo (InputData* D) CollReplace (&S->SpanInfoList, SP, J); /* Insert a backpointer into the span */ - if (SP->ScopeInfoList == 0) { - SP->ScopeInfoList = CollNew (); - } + if (SP->ScopeInfoList == 0) { + SP->ScopeInfoList = CollNew (); + } CollAppend (SP->ScopeInfoList, S); } } @@ -5713,9 +5713,9 @@ cc65_dbginfo cc65_read_dbginfo (const char* FileName, cc65_errorfunc ErrFunc) ParseSegment (&D); break; - case TOK_SPAN: - ParseSpan (&D); - break; + case TOK_SPAN: + ParseSpan (&D); + break; case TOK_SYM: ParseSym (&D); diff --git a/src/dbginfo/dbginfo.h b/src/dbginfo/dbginfo.h index c444a5168..7cb7271b2 100644 --- a/src/dbginfo/dbginfo.h +++ b/src/dbginfo/dbginfo.h @@ -46,7 +46,7 @@ extern "C" { /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ diff --git a/src/ld65/asserts.c b/src/ld65/asserts.c index 650fd0745..f84bdf3f4 100644 --- a/src/ld65/asserts.c +++ b/src/ld65/asserts.c @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -70,7 +70,7 @@ static Collection Assertions = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/asserts.h b/src/ld65/asserts.h index cc4b7cde4..94125294d 100644 --- a/src/ld65/asserts.h +++ b/src/ld65/asserts.h @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -60,7 +60,7 @@ struct ObjData; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/bin.c b/src/ld65/bin.c index 1a2ef4e82..e86411241 100644 --- a/src/ld65/bin.c +++ b/src/ld65/bin.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* bin.c */ +/* bin.c */ /* */ -/* Module to handle the raw binary format */ +/* Module to handle the raw binary format */ /* */ /* */ /* */ @@ -58,21 +58,21 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ struct BinDesc { - unsigned Undef; /* Count of undefined externals */ - FILE* F; /* Output file */ + unsigned Undef; /* Count of undefined externals */ + FILE* F; /* Output file */ const char* Filename; /* Name of output file */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -84,8 +84,8 @@ BinDesc* NewBinDesc (void) BinDesc* D = xmalloc (sizeof (BinDesc)); /* Initialize the fields */ - D->Undef = 0; - D->F = 0; + D->Undef = 0; + D->F = 0; D->Filename = 0; /* Return the created struct */ @@ -103,8 +103,8 @@ void FreeBinDesc (BinDesc* D) static unsigned BinWriteExpr (ExprNode* E, int Signed, unsigned Size, - unsigned long Offs attribute ((unused)), - void* Data) + unsigned long Offs attribute ((unused)), + void* Data) /* Called from SegWrite for an expression. Evaluate the expression, check the * range and write the expression value to the file. */ @@ -148,20 +148,20 @@ static void BinWriteMem (BinDesc* D, MemoryArea* M) /* Walk over all segments in this memory area */ for (I = 0; I < CollCount (&M->SegList); ++I) { - int DoWrite; + int DoWrite; - /* Get the segment */ - SegDesc* S = CollAtUnchecked (&M->SegList, I); + /* Get the segment */ + SegDesc* S = CollAtUnchecked (&M->SegList, I); - /* Keep the user happy */ - Print (stdout, 1, " Writing `%s'\n", GetString (S->Name)); + /* Keep the user happy */ + Print (stdout, 1, " Writing `%s'\n", GetString (S->Name)); - /* Writes do only occur in the load area and not for BSS segments */ - DoWrite = (S->Flags & SF_BSS) == 0 && /* No BSS segment */ - S->Load == M && /* LOAD segment */ - S->Seg->Dumped == 0; /* Not already written */ + /* Writes do only occur in the load area and not for BSS segments */ + DoWrite = (S->Flags & SF_BSS) == 0 && /* No BSS segment */ + S->Load == M && /* LOAD segment */ + S->Seg->Dumped == 0; /* Not already written */ - /* Output debugging stuff */ + /* Output debugging stuff */ PrintBoolVal ("bss", S->Flags & SF_BSS); PrintBoolVal ("LoadArea", S->Load == M); PrintBoolVal ("Dumped", S->Seg->Dumped); @@ -169,17 +169,17 @@ static void BinWriteMem (BinDesc* D, MemoryArea* M) PrintNumVal ("Address", Addr); PrintNumVal ("FileOffs", (unsigned long) ftell (D->F)); - /* Check if the alignment for the segment from the linker config is + /* Check if the alignment for the segment from the linker config is * a multiple for that of the segment. */ if ((S->RunAlignment % S->Seg->Alignment) != 0) { - /* Segment requires another alignment than configured - * in the linker. - */ - Warning ("Segment `%s' is not aligned properly. Resulting " + /* Segment requires another alignment than configured + * in the linker. + */ + Warning ("Segment `%s' is not aligned properly. Resulting " "executable may not be functional.", - GetString (S->Name)); - } + GetString (S->Name)); + } /* If this is the run memory area, we must apply run alignment. If * this is not the run memory area but the load memory area (which @@ -226,31 +226,31 @@ static void BinWriteMem (BinDesc* D, MemoryArea* M) } - /* Now write the segment to disk if it is not a BSS type segment and - * if the memory area is the load area. - */ - if (DoWrite) { + /* Now write the segment to disk if it is not a BSS type segment and + * if the memory area is the load area. + */ + if (DoWrite) { unsigned long P = ftell (D->F); - SegWrite (D->Filename, D->F, S->Seg, BinWriteExpr, D); + SegWrite (D->Filename, D->F, S->Seg, BinWriteExpr, D); PrintNumVal ("Wrote", (unsigned long) (ftell (D->F) - P)); - } else if (M->Flags & MF_FILL) { - WriteMult (D->F, S->Seg->FillVal, S->Seg->Size); + } else if (M->Flags & MF_FILL) { + WriteMult (D->F, S->Seg->FillVal, S->Seg->Size); PrintNumVal ("Filled", (unsigned long) S->Seg->Size); - } + } - /* If this was the load memory area, mark the segment as dumped */ - if (S->Load == M) { - S->Seg->Dumped = 1; - } + /* If this was the load memory area, mark the segment as dumped */ + if (S->Load == M) { + S->Seg->Dumped = 1; + } - /* Calculate the new address */ - Addr += S->Seg->Size; + /* Calculate the new address */ + Addr += S->Seg->Size; } /* If a fill was requested, fill the remaining space */ if ((M->Flags & MF_FILL) != 0 && M->FillLevel < M->Size) { unsigned long ToFill = M->Size - M->FillLevel; - Print (stdout, 2, " Filling 0x%lx bytes with 0x%02x\n", + Print (stdout, 2, " Filling 0x%lx bytes with 0x%02x\n", ToFill, M->FillVal); WriteMult (D->F, M->FillVal, ToFill); M->FillLevel = M->Size; @@ -283,17 +283,17 @@ void BinWriteTarget (BinDesc* D, struct File* F) /* Check for unresolved symbols. The function BinUnresolved is called * if we get an unresolved symbol. */ - D->Undef = 0; /* Reset the counter */ + D->Undef = 0; /* Reset the counter */ CheckUnresolvedImports (BinUnresolved, D); if (D->Undef > 0) { - /* We had unresolved symbols, cannot create output file */ - Error ("%u unresolved external(s) found - cannot create output file", D->Undef); + /* We had unresolved symbols, cannot create output file */ + Error ("%u unresolved external(s) found - cannot create output file", D->Undef); } /* Open the file */ D->F = fopen (D->Filename, "wb"); if (D->F == 0) { - Error ("Cannot open `%s': %s", D->Filename, strerror (errno)); + Error ("Cannot open `%s': %s", D->Filename, strerror (errno)); } /* Keep the user happy */ @@ -303,13 +303,13 @@ void BinWriteTarget (BinDesc* D, struct File* F) for (I = 0; I < CollCount (&F->MemoryAreas); ++I) { /* Get this entry */ MemoryArea* M = CollAtUnchecked (&F->MemoryAreas, I); - Print (stdout, 1, " Dumping `%s'\n", GetString (M->Name)); - BinWriteMem (D, M); + Print (stdout, 1, " Dumping `%s'\n", GetString (M->Name)); + BinWriteMem (D, M); } /* Close the file */ if (fclose (D->F) != 0) { - Error ("Cannot write to `%s': %s", D->Filename, strerror (errno)); + Error ("Cannot write to `%s': %s", D->Filename, strerror (errno)); } /* Reset the file and filename */ diff --git a/src/ld65/bin.h b/src/ld65/bin.h index 753f16dd4..9cb5e7dd9 100644 --- a/src/ld65/bin.h +++ b/src/ld65/bin.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* bin.h */ +/* bin.h */ /* */ -/* Module to handle the raw binary format */ +/* Module to handle the raw binary format */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -54,7 +54,7 @@ typedef struct BinDesc BinDesc; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/binfmt.c b/src/ld65/binfmt.c index 3419cd063..39a7ae3e2 100644 --- a/src/ld65/binfmt.c +++ b/src/ld65/binfmt.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* binfmt.c */ +/* binfmt.c */ /* */ -/* Binary format definitions for the ld65 linker */ +/* Binary format definitions for the ld65 linker */ /* */ /* */ /* */ @@ -43,18 +43,18 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Default format (depends on target system) */ -unsigned char DefaultBinFmt = BINFMT_BINARY; +unsigned char DefaultBinFmt = BINFMT_BINARY; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -66,22 +66,22 @@ int RelocatableBinFmt (unsigned Format) /* Resolve the default format */ if (Format == BINFMT_DEFAULT) { - Format = DefaultBinFmt; + Format = DefaultBinFmt; } /* Check the type */ switch (Format) { - case BINFMT_BINARY: - Reloc = 0; - break; + case BINFMT_BINARY: + Reloc = 0; + break; - case BINFMT_O65: - Reloc = 1; - break; + case BINFMT_O65: + Reloc = 1; + break; - default: - Internal ("Invalid format specifier: %u", Format); + default: + Internal ("Invalid format specifier: %u", Format); } diff --git a/src/ld65/binfmt.h b/src/ld65/binfmt.h index 493bd7fea..5c4bf5778 100644 --- a/src/ld65/binfmt.h +++ b/src/ld65/binfmt.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* binfmt.h */ +/* binfmt.h */ /* */ -/* Binary format definitions for the ld65 linker */ +/* Binary format definitions for the ld65 linker */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -50,7 +50,7 @@ extern unsigned char DefaultBinFmt; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/cfgexpr.c b/src/ld65/cfgexpr.c index 17f9cb57d..65ff3dd67 100644 --- a/src/ld65/cfgexpr.c +++ b/src/ld65/cfgexpr.c @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -64,7 +64,7 @@ static ExprNode* Factor (void) switch (CfgTok) { - case CFGTOK_IDENT: + case CFGTOK_IDENT: /* Get the name as an id */ Name = GetStrBufId (&CfgSVal); @@ -82,11 +82,11 @@ static ExprNode* Factor (void) CfgNextTok (); break; - case CFGTOK_INTCON: + case CFGTOK_INTCON: /* An integer constant */ N = LiteralExpr (CfgIVal, 0); - CfgNextTok (); - break; + CfgNextTok (); + break; case CFGTOK_PLUS: /* Unary plus */ @@ -101,16 +101,16 @@ static ExprNode* Factor (void) N->Left = Factor (); break; - case CFGTOK_LPAR: + case CFGTOK_LPAR: /* Left parenthesis */ - CfgNextTok (); - N = CfgExpr (); - CfgConsume (CFGTOK_RPAR, "')' expected"); - break; + CfgNextTok (); + N = CfgExpr (); + CfgConsume (CFGTOK_RPAR, "')' expected"); + break; - default: - CfgError (&CfgErrorPos, "Invalid expression: %d", CfgTok); - break; + default: + CfgError (&CfgErrorPos, "Invalid expression: %d", CfgTok); + break; } /* Return the new expression node */ @@ -238,7 +238,7 @@ long CfgCheckedConstExpr (long Min, long Max) /* Check the range */ if (Val < Min || Val > Max) { - CfgError (&CfgErrorPos, "Range error"); + CfgError (&CfgErrorPos, "Range error"); } /* Return the value */ diff --git a/src/ld65/cfgexpr.h b/src/ld65/cfgexpr.h index 68247ca08..8a6e18c67 100644 --- a/src/ld65/cfgexpr.h +++ b/src/ld65/cfgexpr.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/condes.c b/src/ld65/condes.c index ebf1bdecb..dc8383767 100644 --- a/src/ld65/condes.c +++ b/src/ld65/condes.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* condes.c */ +/* condes.c */ /* */ -/* Module constructor/destructor support */ +/* Module constructor/destructor support */ /* */ /* */ /* */ @@ -53,7 +53,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -61,11 +61,11 @@ /* Struct describing one condes type */ typedef struct ConDesDesc ConDesDesc; struct ConDesDesc { - Collection ExpList; /* List of exported symbols */ - unsigned SegName; /* Name of segment the table is in */ - unsigned Label; /* Name of table label */ - unsigned CountSym; /* Name of symbol for entry count */ - unsigned char Order; /* Table order (increasing/decreasing) */ + Collection ExpList; /* List of exported symbols */ + unsigned SegName; /* Name of segment the table is in */ + unsigned Label; /* Name of table label */ + unsigned CountSym; /* Name of symbol for entry count */ + unsigned char Order; /* Table order (increasing/decreasing) */ ConDesImport Import; /* Forced import if any */ }; @@ -126,7 +126,7 @@ static ConDesDesc ConDes[CD_TYPE_COUNT] = { /*****************************************************************************/ -/* Internally used function to create the condes tables */ +/* Internally used function to create the condes tables */ /*****************************************************************************/ @@ -151,19 +151,19 @@ static int ConDesCompare (void* Data, const void* E1, const void* E2) /* Compare the priorities for this condes type */ if (Prio1 < Prio2) { - Cmp = -1; + Cmp = -1; } else if (Prio1 > Prio2) { - Cmp = 1; + Cmp = 1; } else { - /* Use the name in this case */ - Cmp = SB_Compare (GetStrBuf (Exp1->Name), GetStrBuf (Exp2->Name)); + /* Use the name in this case */ + Cmp = SB_Compare (GetStrBuf (Exp1->Name), GetStrBuf (Exp2->Name)); } /* Reverse the result for decreasing order */ if (CD->Order == cdIncreasing) { - return Cmp; + return Cmp; } else { - return -Cmp; + return -Cmp; } } @@ -172,16 +172,16 @@ static int ConDesCompare (void* Data, const void* E1, const void* E2) static void ConDesCreateOne (ConDesDesc* CD) /* Create one table if requested */ { - Segment* Seg; /* Segment for table */ - Section* Sec; /* Section for table */ - unsigned Count; /* Number of exports */ - unsigned I; + Segment* Seg; /* Segment for table */ + Section* Sec; /* Section for table */ + unsigned Count; /* Number of exports */ + unsigned I; /* Check if this table has a segment and table label defined. If not, * creation was not requested in the config file - ignore it. */ if (CD->SegName == INVALID_STRING_ID || CD->Label == INVALID_STRING_ID) { - return; + return; } /* Check if there is an import for the table label. If not, there is no @@ -189,7 +189,7 @@ static void ConDesCreateOne (ConDesDesc* CD) * table. */ if (!IsUnresolved (CD->Label)) { - return; + return; } /* Sort the collection of exports according to priority */ @@ -209,14 +209,14 @@ static void ConDesCreateOne (ConDesDesc* CD) Count = CollCount (&CD->ExpList); for (I = 0; I < Count; ++I) { - /* Get the export */ - Export* E = CollAt (&CD->ExpList, I); + /* Get the export */ + Export* E = CollAt (&CD->ExpList, I); - /* Create the fragment */ - Fragment* F = NewFragment (FRAG_EXPR, 2, Sec); + /* Create the fragment */ + Fragment* F = NewFragment (FRAG_EXPR, 2, Sec); - /* Set the expression pointer */ - F->Expr = E->Expr; + /* Set the expression pointer */ + F->Expr = E->Expr; } /* Define the table start as an export, offset into section is zero @@ -228,14 +228,14 @@ static void ConDesCreateOne (ConDesDesc* CD) * with the number of elements in the table. */ if (CD->CountSym) { - CreateConstExport (CD->CountSym, Count); + CreateConstExport (CD->CountSym, Count); } } /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -247,10 +247,10 @@ void ConDesAddExport (struct Export* E) /* Insert the export into all tables for which declarations exist */ for (Type = 0; Type < CD_TYPE_COUNT; ++Type) { - unsigned Prio = E->ConDes[Type]; - if (Prio != CD_PRIO_NONE) { - CollAppend (&ConDes[Type].ExpList, E); - } + unsigned Prio = E->ConDes[Type]; + if (Prio != CD_PRIO_NONE) { + CollAppend (&ConDes[Type].ExpList, E); + } } } @@ -374,7 +374,7 @@ void ConDesCreate (void) /* Walk over the descriptor array and create a table for each entry */ for (Type = 0; Type < CD_TYPE_COUNT; ++Type) { - ConDesCreateOne (ConDes + Type); + ConDesCreateOne (ConDes + Type); } } @@ -385,8 +385,8 @@ void ConDesDump (void) { unsigned Type; for (Type = 0; Type < CD_TYPE_COUNT; ++Type) { - Collection* ExpList = &ConDes[Type].ExpList; - printf ("CONDES(%u): %u symbols\n", Type, CollCount (ExpList)); + Collection* ExpList = &ConDes[Type].ExpList; + printf ("CONDES(%u): %u symbols\n", Type, CollCount (ExpList)); } } diff --git a/src/ld65/condes.h b/src/ld65/condes.h index 8ff2687f3..3cec6bda9 100644 --- a/src/ld65/condes.h +++ b/src/ld65/condes.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* condes.h */ +/* condes.h */ /* */ -/* Module constructor/destructor support */ +/* Module constructor/destructor support */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -54,15 +54,15 @@ struct Export; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Order of the tables */ typedef enum { - cdIncreasing, /* Increasing priority - default */ - cdDecreasing /* Decreasing priority */ + cdIncreasing, /* Increasing priority - default */ + cdDecreasing /* Decreasing priority */ } ConDesOrder; /* Data for a forced condes import */ @@ -76,7 +76,7 @@ struct ConDesImport { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/config.c b/src/ld65/config.c index 70fa63b54..76518cafd 100644 --- a/src/ld65/config.c +++ b/src/ld65/config.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* config.c */ +/* config.c */ /* */ -/* Target configuration file for the ld65 linker */ +/* Target configuration file for the ld65 linker */ /* */ /* */ /* */ @@ -72,7 +72,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -97,27 +97,27 @@ static Collection FileList = STATIC_COLLECTION_INITIALIZER; static Collection MemoryAreas = STATIC_COLLECTION_INITIALIZER; /* Memory attributes */ -#define MA_START 0x0001 -#define MA_SIZE 0x0002 -#define MA_TYPE 0x0004 -#define MA_FILE 0x0008 -#define MA_DEFINE 0x0010 -#define MA_FILL 0x0020 -#define MA_FILLVAL 0x0040 +#define MA_START 0x0001 +#define MA_SIZE 0x0002 +#define MA_TYPE 0x0004 +#define MA_FILE 0x0008 +#define MA_DEFINE 0x0010 +#define MA_FILL 0x0020 +#define MA_FILLVAL 0x0040 #define MA_BANK 0x0080 /* Segment list */ static Collection SegDescList = STATIC_COLLECTION_INITIALIZER; /* Segment attributes */ -#define SA_TYPE 0x0001 -#define SA_LOAD 0x0002 -#define SA_RUN 0x0004 -#define SA_ALIGN 0x0008 +#define SA_TYPE 0x0001 +#define SA_LOAD 0x0002 +#define SA_RUN 0x0004 +#define SA_ALIGN 0x0008 #define SA_ALIGN_LOAD 0x0010 -#define SA_DEFINE 0x0020 -#define SA_OFFSET 0x0040 -#define SA_START 0x0080 +#define SA_DEFINE 0x0020 +#define SA_OFFSET 0x0040 +#define SA_START 0x0080 #define SA_OPTIONAL 0x0100 #define SA_FILLVAL 0x0200 @@ -147,13 +147,13 @@ struct CfgSymbol { static Collection CfgSymbols = STATIC_COLLECTION_INITIALIZER; /* Descriptor holding information about the binary formats */ -static BinDesc* BinFmtDesc = 0; -static O65Desc* O65FmtDesc = 0; +static BinDesc* BinFmtDesc = 0; +static O65Desc* O65FmtDesc = 0; /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -164,7 +164,7 @@ static File* NewFile (unsigned Name); /*****************************************************************************/ -/* List management */ +/* List management */ /*****************************************************************************/ @@ -175,9 +175,9 @@ static File* FindFile (unsigned Name) unsigned I; for (I = 0; I < CollCount (&FileList); ++I) { File* F = CollAtUnchecked (&FileList, I); - if (F->Name == Name) { - return F; - } + if (F->Name == Name) { + return F; + } } return 0; } @@ -189,8 +189,8 @@ static File* GetFile (unsigned Name) { File* F = FindFile (Name); if (F == 0) { - /* Create a new one */ - F = NewFile (Name); + /* Create a new one */ + F = NewFile (Name); } return F; } @@ -212,9 +212,9 @@ static MemoryArea* CfgFindMemory (unsigned Name) unsigned I; for (I = 0; I < CollCount (&MemoryAreas); ++I) { MemoryArea* M = CollAtUnchecked (&MemoryAreas, I); - if (M->Name == Name) { - return M; - } + if (M->Name == Name) { + return M; + } } return 0; } @@ -226,7 +226,7 @@ static MemoryArea* CfgGetMemory (unsigned Name) { MemoryArea* M = CfgFindMemory (Name); if (M == 0) { - CfgError (&CfgErrorPos, "Invalid memory area `%s'", GetString (Name)); + CfgError (&CfgErrorPos, "Invalid memory area `%s'", GetString (Name)); } return M; } @@ -239,10 +239,10 @@ static SegDesc* CfgFindSegDesc (unsigned Name) unsigned I; for (I = 0; I < CollCount (&SegDescList); ++I) { SegDesc* S = CollAtUnchecked (&SegDescList, I); - if (S->Name == Name) { - /* Found */ - return S; - } + if (S->Name == Name) { + /* Found */ + return S; + } } /* Not found */ @@ -261,7 +261,7 @@ static void MemoryInsert (MemoryArea* M, SegDesc* S) /*****************************************************************************/ -/* Constructors/Destructors */ +/* Constructors/Destructors */ /*****************************************************************************/ @@ -319,7 +319,7 @@ static MemoryArea* CreateMemoryArea (const FilePos* Pos, unsigned Name) /* Check for duplicate names */ MemoryArea* M = CfgFindMemory (Name); if (M) { - CfgError (&CfgErrorPos, + CfgError (&CfgErrorPos, "Memory area `%s' defined twice", GetString (Name)); } @@ -343,7 +343,7 @@ static SegDesc* NewSegDesc (unsigned Name) /* Check for duplicate names */ SegDesc* S = CfgFindSegDesc (Name); if (S) { - CfgError (&CfgErrorPos, "Segment `%s' defined twice", GetString (Name)); + CfgError (&CfgErrorPos, "Segment `%s' defined twice", GetString (Name)); } /* Allocate memory */ @@ -389,7 +389,7 @@ static void FlagAttr (unsigned* Flags, unsigned Mask, const char* Name) */ { if (*Flags & Mask) { - CfgError (&CfgErrorPos, "%s is already defined", Name); + CfgError (&CfgErrorPos, "%s is already defined", Name); } *Flags |= Mask; } @@ -400,7 +400,7 @@ static void AttrCheck (unsigned Attr, unsigned Mask, const char* Name) /* Check that a mandatory attribute was given */ { if ((Attr & Mask) == 0) { - CfgError (&CfgErrorPos, "%s attribute is missing", Name); + CfgError (&CfgErrorPos, "%s attribute is missing", Name); } } @@ -413,121 +413,121 @@ static void ParseMemory (void) { "BANK", CFGTOK_BANK }, { "DEFINE", CFGTOK_DEFINE }, { "FILE", CFGTOK_FILE }, - { "FILL", CFGTOK_FILL }, - { "FILLVAL", CFGTOK_FILLVAL }, - { "SIZE", CFGTOK_SIZE }, - { "START", CFGTOK_START }, + { "FILL", CFGTOK_FILL }, + { "FILLVAL", CFGTOK_FILLVAL }, + { "SIZE", CFGTOK_SIZE }, + { "START", CFGTOK_START }, { "TYPE", CFGTOK_TYPE }, }; static const IdentTok Types [] = { - { "RO", CFGTOK_RO }, - { "RW", CFGTOK_RW }, + { "RO", CFGTOK_RO }, + { "RW", CFGTOK_RW }, }; while (CfgTok == CFGTOK_IDENT) { - /* Create a new entry on the heap */ - MemoryArea* M = CreateMemoryArea (&CfgErrorPos, GetStrBufId (&CfgSVal)); + /* Create a new entry on the heap */ + MemoryArea* M = CreateMemoryArea (&CfgErrorPos, GetStrBufId (&CfgSVal)); - /* Skip the name and the following colon */ - CfgNextTok (); - CfgConsumeColon (); + /* Skip the name and the following colon */ + CfgNextTok (); + CfgConsumeColon (); - /* Read the attributes */ - while (CfgTok == CFGTOK_IDENT) { + /* Read the attributes */ + while (CfgTok == CFGTOK_IDENT) { - /* Map the identifier to a token */ - cfgtok_t AttrTok; - CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); - AttrTok = CfgTok; + /* Map the identifier to a token */ + cfgtok_t AttrTok; + CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); + AttrTok = CfgTok; - /* An optional assignment follows */ - CfgNextTok (); - CfgOptionalAssign (); + /* An optional assignment follows */ + CfgNextTok (); + CfgOptionalAssign (); - /* Check which attribute was given */ - switch (AttrTok) { + /* Check which attribute was given */ + switch (AttrTok) { - case CFGTOK_BANK: - FlagAttr (&M->Attr, MA_BANK, "BANK"); - M->BankExpr = CfgExpr (); - break; + case CFGTOK_BANK: + FlagAttr (&M->Attr, MA_BANK, "BANK"); + M->BankExpr = CfgExpr (); + break; - case CFGTOK_DEFINE: - FlagAttr (&M->Attr, MA_DEFINE, "DEFINE"); - /* Map the token to a boolean */ - CfgBoolToken (); - if (CfgTok == CFGTOK_TRUE) { - M->Flags |= MF_DEFINE; - } + case CFGTOK_DEFINE: + FlagAttr (&M->Attr, MA_DEFINE, "DEFINE"); + /* Map the token to a boolean */ + CfgBoolToken (); + if (CfgTok == CFGTOK_TRUE) { + M->Flags |= MF_DEFINE; + } CfgNextTok (); - break; + break; - case CFGTOK_FILE: - FlagAttr (&M->Attr, MA_FILE, "FILE"); - CfgAssureStr (); - /* Get the file entry and insert the memory area */ - FileInsert (GetFile (GetStrBufId (&CfgSVal)), M); + case CFGTOK_FILE: + FlagAttr (&M->Attr, MA_FILE, "FILE"); + CfgAssureStr (); + /* Get the file entry and insert the memory area */ + FileInsert (GetFile (GetStrBufId (&CfgSVal)), M); CfgNextTok (); - break; + break; - case CFGTOK_FILL: - FlagAttr (&M->Attr, MA_FILL, "FILL"); - /* Map the token to a boolean */ - CfgBoolToken (); - if (CfgTok == CFGTOK_TRUE) { - M->Flags |= MF_FILL; - } + case CFGTOK_FILL: + FlagAttr (&M->Attr, MA_FILL, "FILL"); + /* Map the token to a boolean */ + CfgBoolToken (); + if (CfgTok == CFGTOK_TRUE) { + M->Flags |= MF_FILL; + } CfgNextTok (); - break; + break; - case CFGTOK_FILLVAL: - FlagAttr (&M->Attr, MA_FILLVAL, "FILLVAL"); - M->FillVal = (unsigned char) CfgCheckedConstExpr (0, 0xFF); - break; + case CFGTOK_FILLVAL: + FlagAttr (&M->Attr, MA_FILLVAL, "FILLVAL"); + M->FillVal = (unsigned char) CfgCheckedConstExpr (0, 0xFF); + break; - case CFGTOK_SIZE: - FlagAttr (&M->Attr, MA_SIZE, "SIZE"); - M->SizeExpr = CfgExpr (); - break; + case CFGTOK_SIZE: + FlagAttr (&M->Attr, MA_SIZE, "SIZE"); + M->SizeExpr = CfgExpr (); + break; - case CFGTOK_START: - FlagAttr (&M->Attr, MA_START, "START"); + case CFGTOK_START: + FlagAttr (&M->Attr, MA_START, "START"); M->StartExpr = CfgExpr (); - break; + break; - case CFGTOK_TYPE: - FlagAttr (&M->Attr, MA_TYPE, "TYPE"); - CfgSpecialToken (Types, ENTRY_COUNT (Types), "TYPE"); - if (CfgTok == CFGTOK_RO) { - M->Flags |= MF_RO; - } + case CFGTOK_TYPE: + FlagAttr (&M->Attr, MA_TYPE, "TYPE"); + CfgSpecialToken (Types, ENTRY_COUNT (Types), "TYPE"); + if (CfgTok == CFGTOK_RO) { + M->Flags |= MF_RO; + } CfgNextTok (); - break; + break; - default: - FAIL ("Unexpected attribute token"); + default: + FAIL ("Unexpected attribute token"); - } + } - /* Skip an optional comma */ - CfgOptionalComma (); - } + /* Skip an optional comma */ + CfgOptionalComma (); + } - /* Skip the semicolon */ - CfgConsumeSemi (); + /* Skip the semicolon */ + CfgConsumeSemi (); - /* Check for mandatory parameters */ - AttrCheck (M->Attr, MA_START, "START"); - AttrCheck (M->Attr, MA_SIZE, "SIZE"); + /* Check for mandatory parameters */ + AttrCheck (M->Attr, MA_START, "START"); + AttrCheck (M->Attr, MA_SIZE, "SIZE"); - /* If we don't have a file name for output given, use the default - * file name. - */ - if ((M->Attr & MA_FILE) == 0) { - FileInsert (GetFile (GetStringId (OutputName)), M); - OutputNameUsed = 1; - } + /* If we don't have a file name for output given, use the default + * file name. + */ + if ((M->Attr & MA_FILE) == 0) { + FileInsert (GetFile (GetStringId (OutputName)), M); + OutputNameUsed = 1; + } } /* Remember we had this section */ @@ -540,12 +540,12 @@ static void ParseFiles (void) /* Parse a FILES section */ { static const IdentTok Attributes [] = { - { "FORMAT", CFGTOK_FORMAT }, + { "FORMAT", CFGTOK_FORMAT }, }; static const IdentTok Formats [] = { - { "O65", CFGTOK_O65 }, - { "BIN", CFGTOK_BIN }, - { "BINARY", CFGTOK_BIN }, + { "O65", CFGTOK_O65 }, + { "BIN", CFGTOK_BIN }, + { "BINARY", CFGTOK_BIN }, }; @@ -557,73 +557,73 @@ static void ParseFiles (void) /* Parse all files */ while (CfgTok != CFGTOK_RCURLY) { - File* F; + File* F; - /* We expect a string value here */ - CfgAssureStr (); + /* We expect a string value here */ + CfgAssureStr (); - /* Search for the file, it must exist */ - F = FindFile (GetStrBufId (&CfgSVal)); - if (F == 0) { - CfgError (&CfgErrorPos, + /* Search for the file, it must exist */ + F = FindFile (GetStrBufId (&CfgSVal)); + if (F == 0) { + CfgError (&CfgErrorPos, "File `%s' not found in MEMORY section", SB_GetConstBuf (&CfgSVal)); - } + } - /* Skip the token and the following colon */ - CfgNextTok (); - CfgConsumeColon (); + /* Skip the token and the following colon */ + CfgNextTok (); + CfgConsumeColon (); - /* Read the attributes */ - while (CfgTok == CFGTOK_IDENT) { + /* Read the attributes */ + while (CfgTok == CFGTOK_IDENT) { - /* Map the identifier to a token */ - cfgtok_t AttrTok; - CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); - AttrTok = CfgTok; + /* Map the identifier to a token */ + cfgtok_t AttrTok; + CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); + AttrTok = CfgTok; - /* An optional assignment follows */ - CfgNextTok (); - CfgOptionalAssign (); + /* An optional assignment follows */ + CfgNextTok (); + CfgOptionalAssign (); - /* Check which attribute was given */ - switch (AttrTok) { + /* Check which attribute was given */ + switch (AttrTok) { - case CFGTOK_FORMAT: - if (F->Format != BINFMT_DEFAULT) { - /* We've set the format already! */ - CfgError (&CfgErrorPos, + case CFGTOK_FORMAT: + if (F->Format != BINFMT_DEFAULT) { + /* We've set the format already! */ + CfgError (&CfgErrorPos, "Cannot set a file format twice"); - } - /* Read the format token */ - CfgSpecialToken (Formats, ENTRY_COUNT (Formats), "Format"); - switch (CfgTok) { + } + /* Read the format token */ + CfgSpecialToken (Formats, ENTRY_COUNT (Formats), "Format"); + switch (CfgTok) { - case CFGTOK_BIN: - F->Format = BINFMT_BINARY; - break; + case CFGTOK_BIN: + F->Format = BINFMT_BINARY; + break; - case CFGTOK_O65: - F->Format = BINFMT_O65; - break; + case CFGTOK_O65: + F->Format = BINFMT_O65; + break; - default: - Error ("Unexpected format token"); - } - break; + default: + Error ("Unexpected format token"); + } + break; - default: - FAIL ("Unexpected attribute token"); + default: + FAIL ("Unexpected attribute token"); - } + } - /* Skip the attribute value and an optional comma */ - CfgNextTok (); - CfgOptionalComma (); - } + /* Skip the attribute value and an optional comma */ + CfgNextTok (); + CfgOptionalComma (); + } - /* Skip the semicolon */ - CfgConsumeSemi (); + /* Skip the semicolon */ + CfgConsumeSemi (); } @@ -641,18 +641,18 @@ static void ParseSegments (void) { "ALIGN_LOAD", CFGTOK_ALIGN_LOAD }, { "DEFINE", CFGTOK_DEFINE }, { "FILLVAL", CFGTOK_FILLVAL }, - { "LOAD", CFGTOK_LOAD }, - { "OFFSET", CFGTOK_OFFSET }, + { "LOAD", CFGTOK_LOAD }, + { "OFFSET", CFGTOK_OFFSET }, { "OPTIONAL", CFGTOK_OPTIONAL }, - { "RUN", CFGTOK_RUN }, - { "START", CFGTOK_START }, + { "RUN", CFGTOK_RUN }, + { "START", CFGTOK_START }, { "TYPE", CFGTOK_TYPE }, }; static const IdentTok Types [] = { - { "RO", CFGTOK_RO }, - { "RW", CFGTOK_RW }, - { "BSS", CFGTOK_BSS }, - { "ZP", CFGTOK_ZP }, + { "RO", CFGTOK_RO }, + { "RW", CFGTOK_RW }, + { "BSS", CFGTOK_BSS }, + { "ZP", CFGTOK_ZP }, }; unsigned Count; @@ -664,127 +664,127 @@ static void ParseSegments (void) while (CfgTok == CFGTOK_IDENT) { - SegDesc* S; + SegDesc* S; - /* Create a new entry on the heap */ - S = NewSegDesc (GetStrBufId (&CfgSVal)); + /* Create a new entry on the heap */ + S = NewSegDesc (GetStrBufId (&CfgSVal)); - /* Skip the name and the following colon */ - CfgNextTok (); - CfgConsumeColon (); + /* Skip the name and the following colon */ + CfgNextTok (); + CfgConsumeColon (); - /* Read the attributes */ - while (CfgTok == CFGTOK_IDENT) { + /* Read the attributes */ + while (CfgTok == CFGTOK_IDENT) { - /* Map the identifier to a token */ - cfgtok_t AttrTok; - CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); - AttrTok = CfgTok; + /* Map the identifier to a token */ + cfgtok_t AttrTok; + CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); + AttrTok = CfgTok; - /* An optional assignment follows */ - CfgNextTok (); - CfgOptionalAssign (); + /* An optional assignment follows */ + CfgNextTok (); + CfgOptionalAssign (); - /* Check which attribute was given */ - switch (AttrTok) { + /* Check which attribute was given */ + switch (AttrTok) { - case CFGTOK_ALIGN: - FlagAttr (&S->Attr, SA_ALIGN, "ALIGN"); - S->RunAlignment = (unsigned) CfgCheckedConstExpr (1, MAX_ALIGNMENT); - S->Flags |= SF_ALIGN; - break; + case CFGTOK_ALIGN: + FlagAttr (&S->Attr, SA_ALIGN, "ALIGN"); + S->RunAlignment = (unsigned) CfgCheckedConstExpr (1, MAX_ALIGNMENT); + S->Flags |= SF_ALIGN; + break; case CFGTOK_ALIGN_LOAD: - FlagAttr (&S->Attr, SA_ALIGN_LOAD, "ALIGN_LOAD"); - S->LoadAlignment = (unsigned) CfgCheckedConstExpr (1, MAX_ALIGNMENT); - S->Flags |= SF_ALIGN_LOAD; - break; + FlagAttr (&S->Attr, SA_ALIGN_LOAD, "ALIGN_LOAD"); + S->LoadAlignment = (unsigned) CfgCheckedConstExpr (1, MAX_ALIGNMENT); + S->Flags |= SF_ALIGN_LOAD; + break; - case CFGTOK_DEFINE: - FlagAttr (&S->Attr, SA_DEFINE, "DEFINE"); - /* Map the token to a boolean */ - CfgBoolToken (); - if (CfgTok == CFGTOK_TRUE) { - S->Flags |= SF_DEFINE; - } + case CFGTOK_DEFINE: + FlagAttr (&S->Attr, SA_DEFINE, "DEFINE"); + /* Map the token to a boolean */ + CfgBoolToken (); + if (CfgTok == CFGTOK_TRUE) { + S->Flags |= SF_DEFINE; + } CfgNextTok (); - break; + break; case CFGTOK_FILLVAL: - FlagAttr (&S->Attr, SA_FILLVAL, "FILLVAL"); - S->FillVal = (unsigned char) CfgCheckedConstExpr (0, 0xFF); + FlagAttr (&S->Attr, SA_FILLVAL, "FILLVAL"); + S->FillVal = (unsigned char) CfgCheckedConstExpr (0, 0xFF); S->Flags |= SF_FILLVAL; - break; + break; - case CFGTOK_LOAD: - FlagAttr (&S->Attr, SA_LOAD, "LOAD"); - S->Load = CfgGetMemory (GetStrBufId (&CfgSVal)); + case CFGTOK_LOAD: + FlagAttr (&S->Attr, SA_LOAD, "LOAD"); + S->Load = CfgGetMemory (GetStrBufId (&CfgSVal)); CfgNextTok (); - break; + break; - case CFGTOK_OFFSET: - FlagAttr (&S->Attr, SA_OFFSET, "OFFSET"); - S->Addr = CfgCheckedConstExpr (1, 0x1000000); - S->Flags |= SF_OFFSET; - break; + case CFGTOK_OFFSET: + FlagAttr (&S->Attr, SA_OFFSET, "OFFSET"); + S->Addr = CfgCheckedConstExpr (1, 0x1000000); + S->Flags |= SF_OFFSET; + break; - case CFGTOK_OPTIONAL: - FlagAttr (&S->Attr, SA_OPTIONAL, "OPTIONAL"); - CfgBoolToken (); - if (CfgTok == CFGTOK_TRUE) { - S->Flags |= SF_OPTIONAL; - } + case CFGTOK_OPTIONAL: + FlagAttr (&S->Attr, SA_OPTIONAL, "OPTIONAL"); + CfgBoolToken (); + if (CfgTok == CFGTOK_TRUE) { + S->Flags |= SF_OPTIONAL; + } CfgNextTok (); - break; + break; - case CFGTOK_RUN: - FlagAttr (&S->Attr, SA_RUN, "RUN"); - S->Run = CfgGetMemory (GetStrBufId (&CfgSVal)); + case CFGTOK_RUN: + FlagAttr (&S->Attr, SA_RUN, "RUN"); + S->Run = CfgGetMemory (GetStrBufId (&CfgSVal)); CfgNextTok (); - break; + break; - case CFGTOK_START: - FlagAttr (&S->Attr, SA_START, "START"); - S->Addr = CfgCheckedConstExpr (1, 0x1000000); - S->Flags |= SF_START; - break; + case CFGTOK_START: + FlagAttr (&S->Attr, SA_START, "START"); + S->Addr = CfgCheckedConstExpr (1, 0x1000000); + S->Flags |= SF_START; + break; - case CFGTOK_TYPE: - FlagAttr (&S->Attr, SA_TYPE, "TYPE"); - CfgSpecialToken (Types, ENTRY_COUNT (Types), "Type"); - switch (CfgTok) { - case CFGTOK_RO: S->Flags |= SF_RO; break; - case CFGTOK_RW: /* Default */ break; - case CFGTOK_BSS: S->Flags |= SF_BSS; break; - case CFGTOK_ZP: S->Flags |= (SF_BSS | SF_ZP); break; - default: Internal ("Unexpected token: %d", CfgTok); - } + case CFGTOK_TYPE: + FlagAttr (&S->Attr, SA_TYPE, "TYPE"); + CfgSpecialToken (Types, ENTRY_COUNT (Types), "Type"); + switch (CfgTok) { + case CFGTOK_RO: S->Flags |= SF_RO; break; + case CFGTOK_RW: /* Default */ break; + case CFGTOK_BSS: S->Flags |= SF_BSS; break; + case CFGTOK_ZP: S->Flags |= (SF_BSS | SF_ZP); break; + default: Internal ("Unexpected token: %d", CfgTok); + } CfgNextTok (); - break; + break; - default: - FAIL ("Unexpected attribute token"); + default: + FAIL ("Unexpected attribute token"); - } + } - /* Skip an optional comma */ - CfgOptionalComma (); - } + /* Skip an optional comma */ + CfgOptionalComma (); + } - /* Check for mandatory parameters */ - AttrCheck (S->Attr, SA_LOAD, "LOAD"); + /* Check for mandatory parameters */ + AttrCheck (S->Attr, SA_LOAD, "LOAD"); - /* Set defaults for stuff not given */ - if ((S->Attr & SA_RUN) == 0) { - S->Attr |= SA_RUN; - S->Run = S->Load; - } + /* Set defaults for stuff not given */ + if ((S->Attr & SA_RUN) == 0) { + S->Attr |= SA_RUN; + S->Run = S->Load; + } /* An attribute of ALIGN_LOAD doesn't make sense if there are no * separate run and load memory areas. */ if ((S->Flags & SF_ALIGN_LOAD) != 0 && (S->Load == S->Run)) { - CfgWarning (&CfgErrorPos, + CfgWarning (&CfgErrorPos, "ALIGN_LOAD attribute specified, but no separate " "LOAD and RUN memory areas assigned"); /* Remove the flag */ @@ -795,31 +795,31 @@ static void ParseSegments (void) * load and run memory areas, because it's is never written to disk. */ if ((S->Flags & SF_BSS) != 0 && (S->Load != S->Run)) { - CfgWarning (&CfgErrorPos, + CfgWarning (&CfgErrorPos, "Segment with type `bss' has both LOAD and RUN " "memory areas assigned"); } - /* Don't allow read/write data to be put into a readonly area */ - if ((S->Flags & SF_RO) == 0) { - if (S->Run->Flags & MF_RO) { - CfgError (&CfgErrorPos, + /* Don't allow read/write data to be put into a readonly area */ + if ((S->Flags & SF_RO) == 0) { + if (S->Run->Flags & MF_RO) { + CfgError (&CfgErrorPos, "Cannot put r/w segment `%s' in r/o memory area `%s'", - GetString (S->Name), GetString (S->Run->Name)); - } - } + GetString (S->Name), GetString (S->Run->Name)); + } + } - /* Only one of ALIGN, START and OFFSET may be used */ - Count = ((S->Flags & SF_ALIGN) != 0) + - ((S->Flags & SF_OFFSET) != 0) + - ((S->Flags & SF_START) != 0); - if (Count > 1) { - CfgError (&CfgErrorPos, + /* Only one of ALIGN, START and OFFSET may be used */ + Count = ((S->Flags & SF_ALIGN) != 0) + + ((S->Flags & SF_OFFSET) != 0) + + ((S->Flags & SF_START) != 0); + if (Count > 1) { + CfgError (&CfgErrorPos, "Only one of ALIGN, START, OFFSET may be used"); - } + } - /* Skip the semicolon */ - CfgConsumeSemi (); + /* Skip the semicolon */ + CfgConsumeSemi (); } /* Remember we had this section */ @@ -832,32 +832,32 @@ static void ParseO65 (void) /* Parse the o65 format section */ { static const IdentTok Attributes [] = { - { "EXPORT", CFGTOK_EXPORT }, - { "IMPORT", CFGTOK_IMPORT }, - { "TYPE", CFGTOK_TYPE }, - { "OS", CFGTOK_OS }, - { "ID", CFGTOK_ID }, - { "VERSION", CFGTOK_VERSION }, + { "EXPORT", CFGTOK_EXPORT }, + { "IMPORT", CFGTOK_IMPORT }, + { "TYPE", CFGTOK_TYPE }, + { "OS", CFGTOK_OS }, + { "ID", CFGTOK_ID }, + { "VERSION", CFGTOK_VERSION }, }; static const IdentTok Types [] = { - { "SMALL", CFGTOK_SMALL }, - { "LARGE", CFGTOK_LARGE }, + { "SMALL", CFGTOK_SMALL }, + { "LARGE", CFGTOK_LARGE }, }; static const IdentTok OperatingSystems [] = { - { "LUNIX", CFGTOK_LUNIX }, - { "OSA65", CFGTOK_OSA65 }, + { "LUNIX", CFGTOK_LUNIX }, + { "OSA65", CFGTOK_OSA65 }, { "CC65", CFGTOK_CC65 }, { "OPENCBM", CFGTOK_OPENCBM }, }; /* Bitmask to remember the attributes we got already */ enum { - atNone = 0x0000, - atOS = 0x0001, + atNone = 0x0000, + atOS = 0x0001, atOSVersion = 0x0002, - atType = 0x0004, - atImport = 0x0008, - atExport = 0x0010, + atType = 0x0004, + atImport = 0x0008, + atExport = 0x0010, atID = 0x0020, atVersion = 0x0040 }; @@ -870,72 +870,72 @@ static void ParseO65 (void) /* Read the attributes */ while (CfgTok == CFGTOK_IDENT) { - /* Map the identifier to a token */ - cfgtok_t AttrTok; - CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); - AttrTok = CfgTok; + /* Map the identifier to a token */ + cfgtok_t AttrTok; + CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); + AttrTok = CfgTok; - /* An optional assignment follows */ - CfgNextTok (); - CfgOptionalAssign (); + /* An optional assignment follows */ + CfgNextTok (); + CfgOptionalAssign (); - /* Check which attribute was given */ - switch (AttrTok) { + /* Check which attribute was given */ + switch (AttrTok) { - case CFGTOK_EXPORT: + case CFGTOK_EXPORT: /* Remember we had this token (maybe more than once) */ AttrFlags |= atExport; - /* We expect an identifier */ - CfgAssureIdent (); + /* We expect an identifier */ + CfgAssureIdent (); /* Remember it as an export for later */ NewCfgSymbol (CfgSymO65Export, GetStrBufId (&CfgSVal)); /* Eat the identifier token */ CfgNextTok (); - break; + break; - case CFGTOK_IMPORT: + case CFGTOK_IMPORT: /* Remember we had this token (maybe more than once) */ AttrFlags |= atImport; - /* We expect an identifier */ - CfgAssureIdent (); + /* We expect an identifier */ + CfgAssureIdent (); /* Remember it as an import for later */ NewCfgSymbol (CfgSymO65Import, GetStrBufId (&CfgSVal)); /* Eat the identifier token */ CfgNextTok (); - break; + break; - case CFGTOK_TYPE: - /* Cannot have this attribute twice */ - FlagAttr (&AttrFlags, atType, "TYPE"); - /* Get the type of the executable */ - CfgSpecialToken (Types, ENTRY_COUNT (Types), "Type"); - switch (CfgTok) { + case CFGTOK_TYPE: + /* Cannot have this attribute twice */ + FlagAttr (&AttrFlags, atType, "TYPE"); + /* Get the type of the executable */ + CfgSpecialToken (Types, ENTRY_COUNT (Types), "Type"); + switch (CfgTok) { - case CFGTOK_SMALL: - O65SetSmallModel (O65FmtDesc); - break; + case CFGTOK_SMALL: + O65SetSmallModel (O65FmtDesc); + break; - case CFGTOK_LARGE: - O65SetLargeModel (O65FmtDesc); - break; + case CFGTOK_LARGE: + O65SetLargeModel (O65FmtDesc); + break; - default: - CfgError (&CfgErrorPos, "Unexpected type token"); - } + default: + CfgError (&CfgErrorPos, "Unexpected type token"); + } /* Eat the attribute token */ CfgNextTok (); - break; + break; - case CFGTOK_OS: - /* Cannot use this attribute twice */ - FlagAttr (&AttrFlags, atOS, "OS"); - /* Get the operating system. It may be specified as name or + case CFGTOK_OS: + /* Cannot use this attribute twice */ + FlagAttr (&AttrFlags, atOS, "OS"); + /* Get the operating system. It may be specified as name or * as a number in the range 1..255. */ - if (CfgTok == CFGTOK_INTCON) { - CfgRangeCheck (O65OS_MIN, O65OS_MAX); - OS = (unsigned) CfgIVal; - } else { + if (CfgTok == CFGTOK_INTCON) { + CfgRangeCheck (O65OS_MIN, O65OS_MAX); + OS = (unsigned) CfgIVal; + } else { CfgSpecialToken (OperatingSystems, ENTRY_COUNT (OperatingSystems), "OS type"); switch (CfgTok) { case CFGTOK_LUNIX: OS = O65OS_LUNIX; break; @@ -946,7 +946,7 @@ static void ParseO65 (void) } } CfgNextTok (); - break; + break; case CFGTOK_ID: /* Cannot have this attribute twice */ @@ -962,13 +962,13 @@ static void ParseO65 (void) Version = (unsigned) CfgCheckedConstExpr (0, 0xFF); break; - default: - FAIL ("Unexpected attribute token"); + default: + FAIL ("Unexpected attribute token"); - } + } - /* Skip an optional comma */ - CfgOptionalComma (); + /* Skip an optional comma */ + CfgOptionalComma (); } /* Check if we have all mandatory attributes */ @@ -997,39 +997,39 @@ static void ParseFormats (void) /* Parse a target format section */ { static const IdentTok Formats [] = { - { "O65", CFGTOK_O65 }, - { "BIN", CFGTOK_BIN }, - { "BINARY", CFGTOK_BIN }, + { "O65", CFGTOK_O65 }, + { "BIN", CFGTOK_BIN }, + { "BINARY", CFGTOK_BIN }, }; while (CfgTok == CFGTOK_IDENT) { - /* Map the identifier to a token */ - cfgtok_t FormatTok; - CfgSpecialToken (Formats, ENTRY_COUNT (Formats), "Format"); - FormatTok = CfgTok; + /* Map the identifier to a token */ + cfgtok_t FormatTok; + CfgSpecialToken (Formats, ENTRY_COUNT (Formats), "Format"); + FormatTok = CfgTok; - /* Skip the name and the following colon */ - CfgNextTok (); - CfgConsumeColon (); + /* Skip the name and the following colon */ + CfgNextTok (); + CfgConsumeColon (); - /* Parse the format options */ - switch (FormatTok) { + /* Parse the format options */ + switch (FormatTok) { - case CFGTOK_O65: - ParseO65 (); - break; + case CFGTOK_O65: + ParseO65 (); + break; - case CFGTOK_BIN: - /* No attribibutes available */ - break; + case CFGTOK_BIN: + /* No attribibutes available */ + break; - default: - Error ("Unexpected format token"); - } + default: + Error ("Unexpected format token"); + } - /* Skip the semicolon */ - CfgConsumeSemi (); + /* Skip the semicolon */ + CfgConsumeSemi (); } @@ -1043,23 +1043,23 @@ static void ParseConDes (void) /* Parse the CONDES feature */ { static const IdentTok Attributes [] = { - { "COUNT", CFGTOK_COUNT }, + { "COUNT", CFGTOK_COUNT }, { "IMPORT", CFGTOK_IMPORT }, - { "LABEL", CFGTOK_LABEL }, - { "ORDER", CFGTOK_ORDER }, - { "SEGMENT", CFGTOK_SEGMENT }, - { "TYPE", CFGTOK_TYPE }, + { "LABEL", CFGTOK_LABEL }, + { "ORDER", CFGTOK_ORDER }, + { "SEGMENT", CFGTOK_SEGMENT }, + { "TYPE", CFGTOK_TYPE }, }; static const IdentTok Types [] = { - { "CONSTRUCTOR", CFGTOK_CONSTRUCTOR }, - { "DESTRUCTOR", CFGTOK_DESTRUCTOR }, + { "CONSTRUCTOR", CFGTOK_CONSTRUCTOR }, + { "DESTRUCTOR", CFGTOK_DESTRUCTOR }, { "INTERRUPTOR", CFGTOK_INTERRUPTOR }, }; static const IdentTok Orders [] = { - { "DECREASING", CFGTOK_DECREASING }, - { "INCREASING", CFGTOK_INCREASING }, + { "DECREASING", CFGTOK_DECREASING }, + { "INCREASING", CFGTOK_INCREASING }, }; /* Attribute values. */ @@ -1073,112 +1073,112 @@ static void ParseConDes (void) /* Bitmask to remember the attributes we got already */ enum { - atNone = 0x0000, - atCount = 0x0001, + atNone = 0x0000, + atCount = 0x0001, atImport = 0x0002, - atLabel = 0x0004, - atOrder = 0x0008, - atSegName = 0x0010, - atType = 0x0020, + atLabel = 0x0004, + atOrder = 0x0008, + atSegName = 0x0010, + atType = 0x0020, }; unsigned AttrFlags = atNone; /* Parse the attributes */ while (1) { - /* Map the identifier to a token */ - cfgtok_t AttrTok; - CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); - AttrTok = CfgTok; + /* Map the identifier to a token */ + cfgtok_t AttrTok; + CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); + AttrTok = CfgTok; - /* An optional assignment follows */ - CfgNextTok (); - CfgOptionalAssign (); + /* An optional assignment follows */ + CfgNextTok (); + CfgOptionalAssign (); - /* Check which attribute was given */ - switch (AttrTok) { + /* Check which attribute was given */ + switch (AttrTok) { - case CFGTOK_COUNT: - /* Don't allow this twice */ - FlagAttr (&AttrFlags, atCount, "COUNT"); - /* We expect an identifier */ - CfgAssureIdent (); - /* Remember the value for later */ - Count = GetStrBufId (&CfgSVal); - break; + case CFGTOK_COUNT: + /* Don't allow this twice */ + FlagAttr (&AttrFlags, atCount, "COUNT"); + /* We expect an identifier */ + CfgAssureIdent (); + /* Remember the value for later */ + Count = GetStrBufId (&CfgSVal); + break; - case CFGTOK_IMPORT: - /* Don't allow this twice */ - FlagAttr (&AttrFlags, atImport, "IMPORT"); - /* We expect an identifier */ - CfgAssureIdent (); - /* Remember value and position for later */ - Import.Name = GetStrBufId (&CfgSVal); + case CFGTOK_IMPORT: + /* Don't allow this twice */ + FlagAttr (&AttrFlags, atImport, "IMPORT"); + /* We expect an identifier */ + CfgAssureIdent (); + /* Remember value and position for later */ + Import.Name = GetStrBufId (&CfgSVal); Import.Pos = CfgErrorPos; Import.AddrSize = ADDR_SIZE_ABS; - break; + break; - case CFGTOK_LABEL: - /* Don't allow this twice */ - FlagAttr (&AttrFlags, atLabel, "LABEL"); - /* We expect an identifier */ - CfgAssureIdent (); - /* Remember the value for later */ - Label = GetStrBufId (&CfgSVal); - break; + case CFGTOK_LABEL: + /* Don't allow this twice */ + FlagAttr (&AttrFlags, atLabel, "LABEL"); + /* We expect an identifier */ + CfgAssureIdent (); + /* Remember the value for later */ + Label = GetStrBufId (&CfgSVal); + break; - case CFGTOK_ORDER: - /* Don't allow this twice */ - FlagAttr (&AttrFlags, atOrder, "ORDER"); - CfgSpecialToken (Orders, ENTRY_COUNT (Orders), "Order"); - switch (CfgTok) { - case CFGTOK_DECREASING: Order = cdDecreasing; break; - case CFGTOK_INCREASING: Order = cdIncreasing; break; - default: FAIL ("Unexpected order token"); - } - break; + case CFGTOK_ORDER: + /* Don't allow this twice */ + FlagAttr (&AttrFlags, atOrder, "ORDER"); + CfgSpecialToken (Orders, ENTRY_COUNT (Orders), "Order"); + switch (CfgTok) { + case CFGTOK_DECREASING: Order = cdDecreasing; break; + case CFGTOK_INCREASING: Order = cdIncreasing; break; + default: FAIL ("Unexpected order token"); + } + break; - case CFGTOK_SEGMENT: - /* Don't allow this twice */ - FlagAttr (&AttrFlags, atSegName, "SEGMENT"); - /* We expect an identifier */ - CfgAssureIdent (); - /* Remember the value for later */ - SegName = GetStrBufId (&CfgSVal); - break; + case CFGTOK_SEGMENT: + /* Don't allow this twice */ + FlagAttr (&AttrFlags, atSegName, "SEGMENT"); + /* We expect an identifier */ + CfgAssureIdent (); + /* Remember the value for later */ + SegName = GetStrBufId (&CfgSVal); + break; - case CFGTOK_TYPE: - /* Don't allow this twice */ - FlagAttr (&AttrFlags, atType, "TYPE"); - /* The type may be given as id or numerical */ - if (CfgTok == CFGTOK_INTCON) { - CfgRangeCheck (CD_TYPE_MIN, CD_TYPE_MAX); - Type = (int) CfgIVal; - } else { - CfgSpecialToken (Types, ENTRY_COUNT (Types), "Type"); - switch (CfgTok) { - case CFGTOK_CONSTRUCTOR: Type = CD_TYPE_CON; break; - case CFGTOK_DESTRUCTOR: Type = CD_TYPE_DES; break; + case CFGTOK_TYPE: + /* Don't allow this twice */ + FlagAttr (&AttrFlags, atType, "TYPE"); + /* The type may be given as id or numerical */ + if (CfgTok == CFGTOK_INTCON) { + CfgRangeCheck (CD_TYPE_MIN, CD_TYPE_MAX); + Type = (int) CfgIVal; + } else { + CfgSpecialToken (Types, ENTRY_COUNT (Types), "Type"); + switch (CfgTok) { + case CFGTOK_CONSTRUCTOR: Type = CD_TYPE_CON; break; + case CFGTOK_DESTRUCTOR: Type = CD_TYPE_DES; break; case CFGTOK_INTERRUPTOR: Type = CD_TYPE_INT; break; - default: FAIL ("Unexpected type token"); - } - } - break; + default: FAIL ("Unexpected type token"); + } + } + break; - default: - FAIL ("Unexpected attribute token"); + default: + FAIL ("Unexpected attribute token"); - } + } - /* Skip the attribute value */ - CfgNextTok (); + /* Skip the attribute value */ + CfgNextTok (); - /* Semicolon ends the ConDes decl, otherwise accept an optional comma */ - if (CfgTok == CFGTOK_SEMI) { - break; - } else if (CfgTok == CFGTOK_COMMA) { - CfgNextTok (); - } + /* Semicolon ends the ConDes decl, otherwise accept an optional comma */ + if (CfgTok == CFGTOK_SEMI) { + break; + } else if (CfgTok == CFGTOK_COMMA) { + CfgNextTok (); + } } /* Check if we have all mandatory attributes */ @@ -1188,7 +1188,7 @@ static void ParseConDes (void) /* Check if the condes has already attributes defined */ if (ConDesHasSegName(Type) || ConDesHasLabel(Type)) { - CfgError (&CfgErrorPos, + CfgError (&CfgErrorPos, "CONDES attributes for type %d are already defined", Type); } @@ -1197,13 +1197,13 @@ static void ParseConDes (void) ConDesSetSegName (Type, SegName); ConDesSetLabel (Type, Label); if (AttrFlags & atCount) { - ConDesSetCountSym (Type, Count); + ConDesSetCountSym (Type, Count); } if (AttrFlags & atImport) { - ConDesSetImport (Type, &Import); + ConDesSetImport (Type, &Import); } if (AttrFlags & atOrder) { - ConDesSetOrder (Type, Order); + ConDesSetOrder (Type, Order); } } @@ -1213,7 +1213,7 @@ static void ParseStartAddress (void) /* Parse the STARTADDRESS feature */ { static const IdentTok Attributes [] = { - { "DEFAULT", CFGTOK_DEFAULT }, + { "DEFAULT", CFGTOK_DEFAULT }, }; @@ -1222,44 +1222,44 @@ static void ParseStartAddress (void) /* Bitmask to remember the attributes we got already */ enum { - atNone = 0x0000, - atDefault = 0x0001 + atNone = 0x0000, + atDefault = 0x0001 }; unsigned AttrFlags = atNone; /* Parse the attributes */ while (1) { - /* Map the identifier to a token */ - cfgtok_t AttrTok; - CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); - AttrTok = CfgTok; + /* Map the identifier to a token */ + cfgtok_t AttrTok; + CfgSpecialToken (Attributes, ENTRY_COUNT (Attributes), "Attribute"); + AttrTok = CfgTok; - /* An optional assignment follows */ - CfgNextTok (); - CfgOptionalAssign (); + /* An optional assignment follows */ + CfgNextTok (); + CfgOptionalAssign (); - /* Check which attribute was given */ - switch (AttrTok) { + /* Check which attribute was given */ + switch (AttrTok) { - case CFGTOK_DEFAULT: - /* Don't allow this twice */ - FlagAttr (&AttrFlags, atDefault, "DEFAULT"); - /* We expect a numeric expression */ + case CFGTOK_DEFAULT: + /* Don't allow this twice */ + FlagAttr (&AttrFlags, atDefault, "DEFAULT"); + /* We expect a numeric expression */ DefStartAddr = CfgCheckedConstExpr (0, 0xFFFFFF); - break; + break; - default: - FAIL ("Unexpected attribute token"); + default: + FAIL ("Unexpected attribute token"); - } + } - /* Semicolon ends the ConDes decl, otherwise accept an optional comma */ - if (CfgTok == CFGTOK_SEMI) { - break; - } else if (CfgTok == CFGTOK_COMMA) { - CfgNextTok (); - } + /* Semicolon ends the ConDes decl, otherwise accept an optional comma */ + if (CfgTok == CFGTOK_SEMI) { + break; + } else if (CfgTok == CFGTOK_COMMA) { + CfgNextTok (); + } } /* Check if we have all mandatory attributes */ @@ -1279,39 +1279,39 @@ static void ParseFeatures (void) /* Parse a features section */ { static const IdentTok Features [] = { - { "CONDES", CFGTOK_CONDES }, + { "CONDES", CFGTOK_CONDES }, { "STARTADDRESS", CFGTOK_STARTADDRESS }, }; while (CfgTok == CFGTOK_IDENT) { - /* Map the identifier to a token */ - cfgtok_t FeatureTok; - CfgSpecialToken (Features, ENTRY_COUNT (Features), "Feature"); - FeatureTok = CfgTok; + /* Map the identifier to a token */ + cfgtok_t FeatureTok; + CfgSpecialToken (Features, ENTRY_COUNT (Features), "Feature"); + FeatureTok = CfgTok; - /* Skip the name and the following colon */ - CfgNextTok (); - CfgConsumeColon (); + /* Skip the name and the following colon */ + CfgNextTok (); + CfgConsumeColon (); - /* Parse the format options */ - switch (FeatureTok) { + /* Parse the format options */ + switch (FeatureTok) { - case CFGTOK_CONDES: - ParseConDes (); - break; + case CFGTOK_CONDES: + ParseConDes (); + break; case CFGTOK_STARTADDRESS: ParseStartAddress (); break; - default: - FAIL ("Unexpected feature token"); - } + default: + FAIL ("Unexpected feature token"); + } - /* Skip the semicolon */ - CfgConsumeSemi (); + /* Skip the semicolon */ + CfgConsumeSemi (); } /* Remember we had this section */ @@ -1326,48 +1326,48 @@ static void ParseSymbols (void) static const IdentTok Attributes[] = { { "ADDRSIZE", CFGTOK_ADDRSIZE }, { "TYPE", CFGTOK_TYPE }, - { "VALUE", CFGTOK_VALUE }, + { "VALUE", CFGTOK_VALUE }, }; static const IdentTok AddrSizes [] = { - { "ABS", CFGTOK_ABS }, - { "ABSOLUTE", CFGTOK_ABS }, - { "DIRECT", CFGTOK_ZP }, - { "DWORD", CFGTOK_LONG }, - { "FAR", CFGTOK_FAR }, - { "LONG", CFGTOK_LONG }, - { "NEAR", CFGTOK_ABS }, - { "ZEROPAGE", CFGTOK_ZP }, - { "ZP", CFGTOK_ZP }, + { "ABS", CFGTOK_ABS }, + { "ABSOLUTE", CFGTOK_ABS }, + { "DIRECT", CFGTOK_ZP }, + { "DWORD", CFGTOK_LONG }, + { "FAR", CFGTOK_FAR }, + { "LONG", CFGTOK_LONG }, + { "NEAR", CFGTOK_ABS }, + { "ZEROPAGE", CFGTOK_ZP }, + { "ZP", CFGTOK_ZP }, }; static const IdentTok Types [] = { - { "EXPORT", CFGTOK_EXPORT }, - { "IMPORT", CFGTOK_IMPORT }, - { "WEAK", CFGTOK_WEAK }, + { "EXPORT", CFGTOK_EXPORT }, + { "IMPORT", CFGTOK_IMPORT }, + { "WEAK", CFGTOK_WEAK }, }; while (CfgTok == CFGTOK_IDENT) { /* Bitmask to remember the attributes we got already */ enum { - atNone = 0x0000, + atNone = 0x0000, atAddrSize = 0x0001, atType = 0x0002, atValue = 0x0004, }; unsigned AttrFlags = atNone; - ExprNode* Value = 0; + ExprNode* Value = 0; CfgSymType Type = CfgSymExport; unsigned char AddrSize = ADDR_SIZE_ABS; Import* Imp; Export* Exp; CfgSymbol* Sym; - /* Remember the name */ - unsigned Name = GetStrBufId (&CfgSVal); - CfgNextTok (); + /* Remember the name */ + unsigned Name = GetStrBufId (&CfgSVal); + CfgNextTok (); /* New syntax - skip the colon */ CfgNextTok (); @@ -1389,36 +1389,36 @@ static void ParseSymbols (void) /* Check which attribute was given */ switch (AttrTok) { - case CFGTOK_ADDRSIZE: + case CFGTOK_ADDRSIZE: /* Don't allow this twice */ FlagAttr (&AttrFlags, atAddrSize, "ADDRSIZE"); /* Map the type to a token */ - CfgSpecialToken (AddrSizes, ENTRY_COUNT (AddrSizes), "AddrSize"); + CfgSpecialToken (AddrSizes, ENTRY_COUNT (AddrSizes), "AddrSize"); switch (CfgTok) { case CFGTOK_ABS: AddrSize = ADDR_SIZE_ABS; break; case CFGTOK_FAR: AddrSize = ADDR_SIZE_FAR; break; case CFGTOK_LONG: AddrSize = ADDR_SIZE_LONG; break; case CFGTOK_ZP: AddrSize = ADDR_SIZE_ZP; break; - default: + default: Internal ("Unexpected token: %d", CfgTok); } CfgNextTok (); - break; + break; - case CFGTOK_TYPE: + case CFGTOK_TYPE: /* Don't allow this twice */ FlagAttr (&AttrFlags, atType, "TYPE"); /* Map the type to a token */ - CfgSpecialToken (Types, ENTRY_COUNT (Types), "Type"); + CfgSpecialToken (Types, ENTRY_COUNT (Types), "Type"); switch (CfgTok) { case CFGTOK_EXPORT: Type = CfgSymExport; break; case CFGTOK_IMPORT: Type = CfgSymImport; break; case CFGTOK_WEAK: Type = CfgSymWeak; break; - default: + default: Internal ("Unexpected token: %d", CfgTok); } CfgNextTok (); - break; + break; case CFGTOK_VALUE: /* Don't allow this twice */ @@ -1478,8 +1478,8 @@ static void ParseSymbols (void) Internal ("Unexpected symbol type %d", Type); } - /* Skip the semicolon */ - CfgConsumeSemi (); + /* Skip the semicolon */ + CfgConsumeSemi (); } /* Remember we had this section */ @@ -1492,59 +1492,59 @@ static void ParseConfig (void) /* Parse the config file */ { static const IdentTok BlockNames [] = { - { "MEMORY", CFGTOK_MEMORY }, - { "FILES", CFGTOK_FILES }, + { "MEMORY", CFGTOK_MEMORY }, + { "FILES", CFGTOK_FILES }, { "SEGMENTS", CFGTOK_SEGMENTS }, - { "FORMATS", CFGTOK_FORMATS }, - { "FEATURES", CFGTOK_FEATURES }, - { "SYMBOLS", CFGTOK_SYMBOLS }, + { "FORMATS", CFGTOK_FORMATS }, + { "FEATURES", CFGTOK_FEATURES }, + { "SYMBOLS", CFGTOK_SYMBOLS }, }; cfgtok_t BlockTok; do { - /* Read the block ident */ - CfgSpecialToken (BlockNames, ENTRY_COUNT (BlockNames), "Block identifier"); - BlockTok = CfgTok; - CfgNextTok (); + /* Read the block ident */ + CfgSpecialToken (BlockNames, ENTRY_COUNT (BlockNames), "Block identifier"); + BlockTok = CfgTok; + CfgNextTok (); - /* Expected a curly brace */ - CfgConsume (CFGTOK_LCURLY, "`{' expected"); + /* Expected a curly brace */ + CfgConsume (CFGTOK_LCURLY, "`{' expected"); - /* Read the block */ - switch (BlockTok) { + /* Read the block */ + switch (BlockTok) { - case CFGTOK_MEMORY: - ParseMemory (); - break; + case CFGTOK_MEMORY: + ParseMemory (); + break; - case CFGTOK_FILES: - ParseFiles (); - break; + case CFGTOK_FILES: + ParseFiles (); + break; - case CFGTOK_SEGMENTS: - ParseSegments (); - break; + case CFGTOK_SEGMENTS: + ParseSegments (); + break; - case CFGTOK_FORMATS: - ParseFormats (); - break; + case CFGTOK_FORMATS: + ParseFormats (); + break; - case CFGTOK_FEATURES: - ParseFeatures (); - break; + case CFGTOK_FEATURES: + ParseFeatures (); + break; - case CFGTOK_SYMBOLS: - ParseSymbols (); - break; + case CFGTOK_SYMBOLS: + ParseSymbols (); + break; - default: - FAIL ("Unexpected block token"); + default: + FAIL ("Unexpected block token"); - } + } - /* Skip closing brace */ - CfgConsume (CFGTOK_RCURLY, "`}' expected"); + /* Skip closing brace */ + CfgConsume (CFGTOK_RCURLY, "`}' expected"); } while (CfgTok != CFGTOK_EOF); } @@ -1588,36 +1588,36 @@ static void ProcessSegments (void) while (I < CollCount (&SegDescList)) { /* Get the next segment descriptor */ - SegDesc* S = CollAtUnchecked (&SegDescList, I); + SegDesc* S = CollAtUnchecked (&SegDescList, I); /* Search for the actual segment in the input files. The function may * return NULL (no such segment), this is checked later. */ S->Seg = SegFind (S->Name); - /* If the segment is marked as BSS style, and if the segment exists + /* If the segment is marked as BSS style, and if the segment exists * in any of the object file, check that there's no initialized data * in the segment. - */ - if ((S->Flags & SF_BSS) != 0 && S->Seg != 0 && !IsBSSType (S->Seg)) { - CfgWarning (GetSourcePos (S->LI), + */ + if ((S->Flags & SF_BSS) != 0 && S->Seg != 0 && !IsBSSType (S->Seg)) { + CfgWarning (GetSourcePos (S->LI), "Segment `%s' with type `bss' contains initialized data", - GetString (S->Name)); - } + GetString (S->Name)); + } - /* If this segment does exist in any of the object files, insert the - * segment into the load/run memory areas. Otherwise print a warning + /* If this segment does exist in any of the object files, insert the + * segment into the load/run memory areas. Otherwise print a warning * and discard it, because the segment pointer in the descriptor is * invalid. - */ - if (S->Seg != 0) { + */ + if (S->Seg != 0) { - /* Insert the segment into the memory area list */ - MemoryInsert (S->Run, S); - if (S->Load != S->Run) { - /* We have separate RUN and LOAD areas */ - MemoryInsert (S->Load, S); - } + /* Insert the segment into the memory area list */ + MemoryInsert (S->Run, S); + if (S->Load != S->Run) { + /* We have separate RUN and LOAD areas */ + MemoryInsert (S->Load, S); + } /* Use the fill value from the config */ S->Seg->FillVal = S->FillVal; @@ -1625,7 +1625,7 @@ static void ProcessSegments (void) /* Process the next segment descriptor in the next run */ ++I; - } else { + } else { /* Print a warning if the segment is not optional */ if ((S->Flags & SF_OPTIONAL) == 0) { @@ -1634,10 +1634,10 @@ static void ProcessSegments (void) GetString (S->Name)); } - /* Discard the descriptor and remove it from the collection */ - FreeSegDesc (S); + /* Discard the descriptor and remove it from the collection */ + FreeSegDesc (S); CollDelete (&SegDescList, I); - } + } } } @@ -1821,13 +1821,13 @@ unsigned CfgProcess (void) * Doing it here means that the expression for the size of the area * may reference this symbol. */ - if (M->Flags & MF_DEFINE) { + if (M->Flags & MF_DEFINE) { Export* E; - StrBuf Buf = STATIC_STRBUF_INITIALIZER; + StrBuf Buf = STATIC_STRBUF_INITIALIZER; /* Define the start of the memory area */ - SB_Printf (&Buf, "__%s_START__", GetString (M->Name)); - E = CreateMemoryExport (GetStrBufId (&Buf), M, 0); + SB_Printf (&Buf, "__%s_START__", GetString (M->Name)); + E = CreateMemoryExport (GetStrBufId (&Buf), M, 0); CollAppend (&E->DefLines, M->LI); SB_Done (&Buf); @@ -1841,11 +1841,11 @@ unsigned CfgProcess (void) } M->Size = GetExprVal (M->SizeExpr); - /* Walk through the segments in this memory area */ + /* Walk through the segments in this memory area */ for (J = 0; J < CollCount (&M->SegList); ++J) { - /* Get the segment */ - SegDesc* S = CollAtUnchecked (&M->SegList, J); + /* Get the segment */ + SegDesc* S = CollAtUnchecked (&M->SegList, J); /* Remember the start address before handling this segment */ unsigned long StartAddr = Addr; @@ -1931,56 +1931,56 @@ unsigned CfgProcess (void) S->Seg->FillVal = M->FillVal; } - /* Increment the fill level of the memory area and check for an - * overflow. - */ - M->FillLevel = Addr + S->Seg->Size - M->Start; - if (M->FillLevel > M->Size && (M->Flags & MF_OVERFLOW) == 0) { + /* Increment the fill level of the memory area and check for an + * overflow. + */ + M->FillLevel = Addr + S->Seg->Size - M->Start; + if (M->FillLevel > M->Size && (M->Flags & MF_OVERFLOW) == 0) { ++Overflows; M->Flags |= MF_OVERFLOW; CfgWarning (GetSourcePos (M->LI), "Memory area overflow in `%s', segment `%s' (%lu bytes)", GetString (M->Name), GetString (S->Name), M->FillLevel - M->Size); - } + } - /* If requested, define symbols for the start and size of the - * segment. - */ - if (S->Flags & SF_DEFINE) { + /* If requested, define symbols for the start and size of the + * segment. + */ + if (S->Flags & SF_DEFINE) { if (S->Run == M && (S->Flags & SF_RUN_DEF) == 0) { CreateRunDefines (S, Addr); } if (S->Load == M && (S->Flags & SF_LOAD_DEF) == 0) { CreateLoadDefines (S, Addr); } - } + } - /* Calculate the new address */ - Addr += S->Seg->Size; + /* Calculate the new address */ + Addr += S->Seg->Size; /* If this segment goes out to the file, increase the file size */ if ((S->Flags & SF_BSS) == 0 && S->Load == M) { M->F->Size += Addr - StartAddr; } - } + } - /* If requested, define symbols for start, size and offset of the + /* If requested, define symbols for start, size and offset of the * memory area */ - if (M->Flags & MF_DEFINE) { + if (M->Flags & MF_DEFINE) { Export* E; - StrBuf Buf = STATIC_STRBUF_INITIALIZER; + StrBuf Buf = STATIC_STRBUF_INITIALIZER; /* Define the size of the memory area */ - SB_Printf (&Buf, "__%s_SIZE__", GetString (M->Name)); - E = CreateConstExport (GetStrBufId (&Buf), M->Size); + SB_Printf (&Buf, "__%s_SIZE__", GetString (M->Name)); + E = CreateConstExport (GetStrBufId (&Buf), M->Size); CollAppend (&E->DefLines, M->LI); /* Define the fill level of the memory area */ - SB_Printf (&Buf, "__%s_LAST__", GetString (M->Name)); - E = CreateMemoryExport (GetStrBufId (&Buf), M, M->FillLevel); + SB_Printf (&Buf, "__%s_LAST__", GetString (M->Name)); + E = CreateMemoryExport (GetStrBufId (&Buf), M, M->FillLevel); CollAppend (&E->DefLines, M->LI); /* Define the file offset of the memory area. This isn't of much @@ -1994,7 +1994,7 @@ unsigned CfgProcess (void) /* Throw away the string buffer */ SB_Done (&Buf); - } + } /* If we didn't have an overflow and are requested to fill the memory * area, acount for that in the file size. @@ -2021,60 +2021,60 @@ void CfgWriteTarget (void) /* Get this entry */ File* F = CollAtUnchecked (&FileList, I); - /* We don't need to look at files with no memory areas */ - if (CollCount (&F->MemoryAreas) > 0) { + /* We don't need to look at files with no memory areas */ + if (CollCount (&F->MemoryAreas) > 0) { - /* Is there an output file? */ - if (SB_GetLen (GetStrBuf (F->Name)) > 0) { + /* Is there an output file? */ + if (SB_GetLen (GetStrBuf (F->Name)) > 0) { - /* Assign a proper binary format */ - if (F->Format == BINFMT_DEFAULT) { - F->Format = DefaultBinFmt; - } + /* Assign a proper binary format */ + if (F->Format == BINFMT_DEFAULT) { + F->Format = DefaultBinFmt; + } - /* Call the apropriate routine for the binary format */ - switch (F->Format) { + /* Call the apropriate routine for the binary format */ + switch (F->Format) { - case BINFMT_BINARY: - BinWriteTarget (BinFmtDesc, F); - break; + case BINFMT_BINARY: + BinWriteTarget (BinFmtDesc, F); + break; - case BINFMT_O65: - O65WriteTarget (O65FmtDesc, F); - break; + case BINFMT_O65: + O65WriteTarget (O65FmtDesc, F); + break; - default: - Internal ("Invalid binary format: %u", F->Format); + default: + Internal ("Invalid binary format: %u", F->Format); - } + } - } else { + } else { - /* No output file. Walk through the list and mark all segments - * loading into these memory areas in this file as dumped. - */ + /* No output file. Walk through the list and mark all segments + * loading into these memory areas in this file as dumped. + */ unsigned J; for (J = 0; J < CollCount (&F->MemoryAreas); ++J) { unsigned K; /* Get this entry */ - MemoryArea* M = CollAtUnchecked (&F->MemoryAreas, J); + MemoryArea* M = CollAtUnchecked (&F->MemoryAreas, J); - /* Debugging */ - Print (stdout, 2, "Skipping `%s'...\n", GetString (M->Name)); + /* Debugging */ + Print (stdout, 2, "Skipping `%s'...\n", GetString (M->Name)); - /* Walk throught the segments */ + /* Walk throught the segments */ for (K = 0; K < CollCount (&M->SegList); ++K) { SegDesc* S = CollAtUnchecked (&M->SegList, K); - if (S->Load == M) { - /* Load area - mark the segment as dumped */ - S->Seg->Dumped = 1; - } - } - } - } - } + if (S->Load == M) { + /* Load area - mark the segment as dumped */ + S->Seg->Dumped = 1; + } + } + } + } + } } } diff --git a/src/ld65/config.h b/src/ld65/config.h index da3a6478d..76104d2d8 100644 --- a/src/ld65/config.h +++ b/src/ld65/config.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* config.h */ +/* config.h */ /* */ -/* Target configuration file for the ld65 linker */ +/* Target configuration file for the ld65 linker */ /* */ /* */ /* */ @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -61,8 +61,8 @@ struct MemoryArea; typedef struct File File; struct File { unsigned Name; /* Name index of the file */ - unsigned Flags; - unsigned Format; /* Output format */ + unsigned Flags; + unsigned Format; /* Output format */ unsigned long Size; /* Size of the generated file */ Collection MemoryAreas; /* List of memory areas in this file */ }; @@ -72,35 +72,35 @@ typedef struct SegDesc SegDesc; struct SegDesc { unsigned Name; /* Index of the name */ LineInfo* LI; /* Position of definition */ - Segment* Seg; /* Pointer to segment structure */ - unsigned Attr; /* Attributes for segment */ - unsigned Flags; /* Set of bitmapped flags */ + Segment* Seg; /* Pointer to segment structure */ + unsigned Attr; /* Attributes for segment */ + unsigned Flags; /* Set of bitmapped flags */ unsigned char FillVal; /* Fill value for this segment */ struct MemoryArea* Load; /* Load memory section */ struct MemoryArea* Run; /* Run memory section */ - unsigned long Addr; /* Start address or offset into segment */ + unsigned long Addr; /* Start address or offset into segment */ unsigned long RunAlignment; /* Run area alignment if given */ unsigned long LoadAlignment; /* Load area alignment if given */ }; /* Segment flags */ -#define SF_RO 0x0001 /* Read only segment */ -#define SF_BSS 0x0002 /* Segment is BSS style segment */ -#define SF_ZP 0x0004 /* Zeropage segment (o65 only) */ -#define SF_DEFINE 0x0008 /* Define start and size */ -#define SF_ALIGN 0x0010 /* Align segment in run area */ +#define SF_RO 0x0001 /* Read only segment */ +#define SF_BSS 0x0002 /* Segment is BSS style segment */ +#define SF_ZP 0x0004 /* Zeropage segment (o65 only) */ +#define SF_DEFINE 0x0008 /* Define start and size */ +#define SF_ALIGN 0x0010 /* Align segment in run area */ #define SF_ALIGN_LOAD 0x0020 /* Align segment in load area */ -#define SF_OFFSET 0x0040 /* Segment has offset in memory */ -#define SF_START 0x0080 /* Segment has fixed start address */ +#define SF_OFFSET 0x0040 /* Segment has offset in memory */ +#define SF_START 0x0080 /* Segment has fixed start address */ #define SF_OPTIONAL 0x0100 /* Segment is optional (must not exist) */ -#define SF_RUN_DEF 0x0200 /* RUN symbols already defined */ -#define SF_LOAD_DEF 0x0400 /* LOAD symbols already defined */ +#define SF_RUN_DEF 0x0200 /* RUN symbols already defined */ +#define SF_LOAD_DEF 0x0400 /* LOAD symbols already defined */ #define SF_FILLVAL 0x0800 /* Segment has separate fill value */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/dbgfile.c b/src/ld65/dbgfile.c index f2d40a7f7..aec560212 100644 --- a/src/ld65/dbgfile.c +++ b/src/ld65/dbgfile.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* dbgfile.c */ +/* dbgfile.c */ /* */ /* Debug file creation for the ld65 linker */ /* */ @@ -53,7 +53,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -107,7 +107,7 @@ void CreateDbgFile (void) /* Open the debug info file */ FILE* F = fopen (DbgFileName, "w"); if (F == 0) { - Error ("Cannot create debug file `%s': %s", DbgFileName, strerror (errno)); + Error ("Cannot create debug file `%s': %s", DbgFileName, strerror (errno)); } /* Output version information */ @@ -166,7 +166,7 @@ void CreateDbgFile (void) /* Close the file */ if (fclose (F) != 0) { - Error ("Error closing debug file `%s': %s", DbgFileName, strerror (errno)); + Error ("Error closing debug file `%s': %s", DbgFileName, strerror (errno)); } } diff --git a/src/ld65/dbgfile.h b/src/ld65/dbgfile.h index ad660daaa..a5020101e 100644 --- a/src/ld65/dbgfile.h +++ b/src/ld65/dbgfile.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* dbgfile.h */ +/* dbgfile.h */ /* */ /* Debug file creation for the ld65 linker */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/dbgsyms.c b/src/ld65/dbgsyms.c index 090e0cdf8..808f04c44 100644 --- a/src/ld65/dbgsyms.c +++ b/src/ld65/dbgsyms.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* dbgsyms.c */ +/* dbgsyms.c */ /* */ -/* Debug symbol handling for the ld65 linker */ +/* Debug symbol handling for the ld65 linker */ /* */ /* */ /* */ @@ -58,7 +58,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -66,16 +66,16 @@ /* Definition of the debug symbol structure */ struct DbgSym { unsigned Id; /* Id of debug symbol */ - DbgSym* Next; /* Pool linear list link */ - ObjData* Obj; /* Object file that exports the name */ + DbgSym* Next; /* Pool linear list link */ + ObjData* Obj; /* Object file that exports the name */ Collection DefLines; /* Line infos for definition */ Collection RefLines; /* Line infos for references */ - ExprNode* Expr; /* Expression (0 if not def'd) */ + ExprNode* Expr; /* Expression (0 if not def'd) */ unsigned Size; /* Symbol size if any */ unsigned OwnerId; /* Id of parent/owner */ unsigned ImportId; /* Id of import if this is one */ - unsigned Name; /* Name */ - unsigned short Type; /* Type of symbol */ + unsigned Name; /* Name */ + unsigned short Type; /* Type of symbol */ unsigned short AddrSize; /* Address size of symbol */ }; @@ -93,12 +93,12 @@ struct HLLDbgSym { /* We will collect all debug symbols in the following array and remove * duplicates before outputing them into a label file. */ -static DbgSym* DbgSymPool[256]; +static DbgSym* DbgSymPool[256]; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -116,12 +116,12 @@ static DbgSym* NewDbgSym (unsigned Id, unsigned Type, unsigned char AddrSize, D->Obj = O; D->DefLines = EmptyCollection; D->RefLines = EmptyCollection; - D->Expr = 0; + D->Expr = 0; D->Size = 0; D->OwnerId = ~0U; D->ImportId = ~0U; - D->Name = 0; - D->Type = Type; + D->Name = 0; + D->Type = Type; D->AddrSize = AddrSize; /* Return the new entry */ @@ -146,21 +146,21 @@ static DbgSym* GetDbgSym (DbgSym* D, long Val) { /* Create the hash. We hash over the symbol value */ unsigned Hash = ((Val >> 24) & 0xFF) ^ - ((Val >> 16) & 0xFF) ^ - ((Val >> 8) & 0xFF) ^ - ((Val >> 0) & 0xFF); + ((Val >> 16) & 0xFF) ^ + ((Val >> 8) & 0xFF) ^ + ((Val >> 0) & 0xFF); /* Check for this symbol */ DbgSym* Sym = DbgSymPool[Hash]; while (Sym) { - /* Is this symbol identical? */ - if (Sym->Name == D->Name && EqualExpr (Sym->Expr, D->Expr)) { - /* Found */ - return Sym; - } + /* Is this symbol identical? */ + if (Sym->Name == D->Name && EqualExpr (Sym->Expr, D->Expr)) { + /* Found */ + return Sym; + } - /* Next symbol */ - Sym = Sym->Next; + /* Next symbol */ + Sym = Sym->Next; } /* This is the first symbol of it's kind */ @@ -174,9 +174,9 @@ static void InsertDbgSym (DbgSym* D, long Val) { /* Create the hash. We hash over the symbol value */ unsigned Hash = ((Val >> 24) & 0xFF) ^ - ((Val >> 16) & 0xFF) ^ - ((Val >> 8) & 0xFF) ^ - ((Val >> 0) & 0xFF); + ((Val >> 16) & 0xFF) ^ + ((Val >> 8) & 0xFF) ^ + ((Val >> 0) & 0xFF); /* Insert the symbol */ D->Next = DbgSymPool [Hash]; @@ -203,9 +203,9 @@ DbgSym* ReadDbgSym (FILE* F, ObjData* O, unsigned Id) /* Read the value */ if (SYM_IS_EXPR (D->Type)) { - D->Expr = ReadExpr (F, O); + D->Expr = ReadExpr (F, O); } else { - D->Expr = LiteralExpr (Read32 (F), O); + D->Expr = LiteralExpr (Read32 (F), O); } /* Read the size */ diff --git a/src/ld65/dbgsyms.h b/src/ld65/dbgsyms.h index 53031a82c..3d58579f6 100644 --- a/src/ld65/dbgsyms.h +++ b/src/ld65/dbgsyms.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* dbgsyms.h */ +/* dbgsyms.h */ /* */ -/* Debug symbol handling for the ld65 linker */ +/* Debug symbol handling for the ld65 linker */ /* */ /* */ /* */ @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -65,7 +65,7 @@ typedef struct DbgSym DbgSym; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/error.c b/src/ld65/error.c index 3fea97fdc..bfd7e0671 100644 --- a/src/ld65/error.c +++ b/src/ld65/error.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* error.c */ +/* error.c */ /* */ -/* Error handling for the ld65 linker */ +/* Error handling for the ld65 linker */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/error.h b/src/ld65/error.h index b3d8ecfbc..e144bb4fd 100644 --- a/src/ld65/error.h +++ b/src/ld65/error.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* error.h */ +/* error.h */ /* */ -/* Error handling for the ld65 linker */ +/* Error handling for the ld65 linker */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/exports.c b/src/ld65/exports.c index 8009056e6..c5533d318 100644 --- a/src/ld65/exports.c +++ b/src/ld65/exports.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* exports.c */ +/* exports.c */ /* */ -/* Exports handling for the ld65 linker */ +/* Exports handling for the ld65 linker */ /* */ /* */ /* */ @@ -60,35 +60,35 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Hash table */ #define HASHTAB_MASK 0x0FFFU -#define HASHTAB_SIZE (HASHTAB_MASK + 1) -static Export* HashTab[HASHTAB_SIZE]; +#define HASHTAB_SIZE (HASHTAB_MASK + 1) +static Export* HashTab[HASHTAB_SIZE]; /* Import management variables */ -static unsigned ImpCount = 0; /* Import count */ -static unsigned ImpOpen = 0; /* Count of open imports */ +static unsigned ImpCount = 0; /* Import count */ +static unsigned ImpOpen = 0; /* Count of open imports */ /* Export management variables */ -static unsigned ExpCount = 0; /* Export count */ -static Export** ExpPool = 0; /* Exports array */ +static unsigned ExpCount = 0; /* Export count */ +static Export** ExpPool = 0; /* Exports array */ /* Defines for the flags in Import */ #define IMP_INLIST 0x0001U /* Import is in exports list */ /* Defines for the flags in Export */ #define EXP_INLIST 0x0001U /* Export is in exports list */ -#define EXP_USERMARK 0x0002U /* User setable flag */ +#define EXP_USERMARK 0x0002U /* User setable flag */ /*****************************************************************************/ -/* Import handling */ +/* Import handling */ /*****************************************************************************/ @@ -106,8 +106,8 @@ static Import* NewImport (unsigned char AddrSize, ObjData* Obj) Import* I = xmalloc (sizeof (Import)); /* Initialize the fields */ - I->Next = 0; - I->Obj = Obj; + I->Next = 0; + I->Obj = Obj; I->DefLines = EmptyCollection; I->RefLines = EmptyCollection; I->Exp = 0; @@ -223,26 +223,26 @@ Import* InsertImport (Import* I) /* Search through the list in that slot for a symbol with that name */ if (HashTab[Hash] == 0) { - /* The slot is empty, we need to insert a dummy export */ - E = HashTab[Hash] = NewExport (0, ADDR_SIZE_DEFAULT, Name, 0); - ++ExpCount; + /* The slot is empty, we need to insert a dummy export */ + E = HashTab[Hash] = NewExport (0, ADDR_SIZE_DEFAULT, Name, 0); + ++ExpCount; } else { - E = HashTab [Hash]; - while (1) { - if (E->Name == Name) { - /* We have an entry, L points to it */ - break; - } - if (E->Next == 0) { - /* End of list an entry not found, insert a dummy */ - E->Next = NewExport (0, ADDR_SIZE_DEFAULT, Name, 0); - E = E->Next; /* Point to dummy */ - ++ExpCount; /* One export more */ - break; - } else { - E = E->Next; - } - } + E = HashTab [Hash]; + while (1) { + if (E->Name == Name) { + /* We have an entry, L points to it */ + break; + } + if (E->Next == 0) { + /* End of list an entry not found, insert a dummy */ + E->Next = NewExport (0, ADDR_SIZE_DEFAULT, Name, 0); + E = E->Next; /* Point to dummy */ + ++ExpCount; /* One export more */ + break; + } else { + E = E->Next; + } + } } /* Ok, E now points to a valid exports entry for the given import. Insert @@ -252,10 +252,10 @@ Import* InsertImport (Import* I) I->Next = E->ImpList; E->ImpList = I; E->ImpCount++; - ++ImpCount; /* Total import count */ + ++ImpCount; /* Total import count */ if (E->Expr == 0) { - /* This is a dummy export */ - ++ImpOpen; + /* This is a dummy export */ + ++ImpOpen; } /* Mark the import so we know it's in the list */ @@ -281,7 +281,7 @@ const LineInfo* GetImportPos (const Import* Imp) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -298,16 +298,16 @@ static Export* NewExport (unsigned Type, unsigned char AddrSize, /* Initialize the fields */ E->Name = Name; E->Next = 0; - E->Flags = 0; + E->Flags = 0; E->Obj = Obj; E->ImpCount = 0; E->ImpList = 0; - E->Expr = 0; + E->Expr = 0; E->Size = 0; E->DefLines = EmptyCollection; E->RefLines = EmptyCollection; E->DbgSymId = ~0U; - E->Type = Type | SYM_EXPORT; + E->Type = Type | SYM_EXPORT; E->AddrSize = AddrSize; for (I = 0; I < sizeof (E->ConDes) / sizeof (E->ConDes[0]); ++I) { E->ConDes[I] = CD_PRIO_NONE; @@ -361,18 +361,18 @@ Export* ReadExport (FILE* F, ObjData* O) ConDesCount = SYM_GET_CONDES_COUNT (Type); if (ConDesCount > 0) { - unsigned char ConDes[CD_TYPE_COUNT]; + unsigned char ConDes[CD_TYPE_COUNT]; - /* Read the data into temp storage */ - ReadData (F, ConDes, ConDesCount); + /* Read the data into temp storage */ + ReadData (F, ConDes, ConDesCount); - /* Re-order the data. In the file, each decl is encoded into a byte - * which contains the type and the priority. In memory, we will use - * an array of types which contain the priority. - */ - for (I = 0; I < ConDesCount; ++I) { - E->ConDes[CD_GET_TYPE (ConDes[I])] = CD_GET_PRIO (ConDes[I]); - } + /* Re-order the data. In the file, each decl is encoded into a byte + * which contains the type and the priority. In memory, we will use + * an array of types which contain the priority. + */ + for (I = 0; I < ConDesCount; ++I) { + E->ConDes[CD_GET_TYPE (ConDes[I])] = CD_GET_PRIO (ConDes[I]); + } } /* Read the name */ @@ -380,9 +380,9 @@ Export* ReadExport (FILE* F, ObjData* O) /* Read the value */ if (SYM_IS_EXPR (Type)) { - E->Expr = ReadExpr (F, O); + E->Expr = ReadExpr (F, O); } else { - E->Expr = LiteralExpr (Read32 (F), O); + E->Expr = LiteralExpr (Read32 (F), O); } /* Read the size */ @@ -440,7 +440,7 @@ void InsertExport (Export* E) /* Insert the export into any condes tables if needed */ if (SYM_IS_CONDES (E->Type)) { - ConDesAddExport (E); + ConDesAddExport (E); } /* Create a hash value for the given name */ @@ -448,54 +448,54 @@ void InsertExport (Export* E) /* Search through the list in that slot */ if (HashTab[Hash] == 0) { - /* The slot is empty */ - HashTab[Hash] = E; - ++ExpCount; + /* The slot is empty */ + HashTab[Hash] = E; + ++ExpCount; } else { - Last = 0; - L = HashTab[Hash]; - do { - if (L->Name == E->Name) { - /* This may be an unresolved external */ - if (L->Expr == 0) { + Last = 0; + L = HashTab[Hash]; + do { + if (L->Name == E->Name) { + /* This may be an unresolved external */ + if (L->Expr == 0) { - /* This *is* an unresolved external. Use the actual export + /* This *is* an unresolved external. Use the actual export * in E instead of the dummy one in L. */ - E->Next = L->Next; - E->ImpCount = L->ImpCount; - E->ImpList = L->ImpList; - if (Last) { - Last->Next = E; - } else { - HashTab[Hash] = E; - } - ImpOpen -= E->ImpCount; /* Decrease open imports now */ - xfree (L); - /* We must run through the import list and change the - * export pointer now. - */ - Imp = E->ImpList; - while (Imp) { - Imp->Exp = E; - Imp = Imp->Next; - } - } else { - /* Duplicate entry, ignore it */ - Warning ("Duplicate external identifier: `%s'", + E->Next = L->Next; + E->ImpCount = L->ImpCount; + E->ImpList = L->ImpList; + if (Last) { + Last->Next = E; + } else { + HashTab[Hash] = E; + } + ImpOpen -= E->ImpCount; /* Decrease open imports now */ + xfree (L); + /* We must run through the import list and change the + * export pointer now. + */ + Imp = E->ImpList; + while (Imp) { + Imp->Exp = E; + Imp = Imp->Next; + } + } else { + /* Duplicate entry, ignore it */ + Warning ("Duplicate external identifier: `%s'", GetString (L->Name)); - } - return; - } - Last = L; - L = L->Next; + } + return; + } + Last = L; + L = L->Next; - } while (L); + } while (L); - /* Insert export at end of queue */ - Last->Next = E; - ++ExpCount; + /* Insert export at end of queue */ + Last->Next = E; + ++ExpCount; } } @@ -613,11 +613,11 @@ Export* FindExport (unsigned Name) Export* L = HashTab[Name & HASHTAB_MASK]; while (L) { /* Search through the list in that slot */ - if (L->Name == Name) { - /* Entry found */ - return L; - } - L = L->Next; + if (L->Name == Name) { + /* Entry found */ + return L; + } + L = L->Next; } /* Not found */ @@ -648,8 +648,8 @@ int IsConstExport (const Export* E) /* Return true if the expression associated with this export is const */ { if (E->Expr == 0) { - /* External symbols cannot be const */ - return 0; + /* External symbols cannot be const */ + return 0; } else { return IsConstExpr (E->Expr); } @@ -661,8 +661,8 @@ long GetExportVal (const Export* E) /* Get the value of this export */ { if (E->Expr == 0) { - /* OOPS */ - Internal ("`%s' is an undefined external", GetString (E->Name)); + /* OOPS */ + Internal ("`%s' is an undefined external", GetString (E->Name)); } return GetExprVal (E->Expr); } @@ -675,8 +675,8 @@ static void CheckSymType (const Export* E) /* External with matching imports */ Import* I = E->ImpList; while (I) { - if (E->AddrSize != I->AddrSize) { - /* Export and import address sizes do not match */ + if (E->AddrSize != I->AddrSize) { + /* Export and import address sizes do not match */ StrBuf ExportLoc = STATIC_STRBUF_INITIALIZER; StrBuf ImportLoc = STATIC_STRBUF_INITIALIZER; const char* ExpAddrSize = AddrSizeToStr ((unsigned char) E->AddrSize); @@ -732,8 +732,8 @@ static void CheckSymType (const Export* E) /* Free the temporary strings */ SB_Done (&ExportLoc); SB_Done (&ImportLoc); - } - I = I->Next; + } + I = I->Next; } } @@ -746,11 +746,11 @@ static void CheckSymTypes (void) /* Print all open imports */ for (I = 0; I < ExpCount; ++I) { - const Export* E = ExpPool [I]; - if (E->Expr != 0 && E->ImpCount > 0) { - /* External with matching imports */ - CheckSymType (E); - } + const Export* E = ExpPool [I]; + if (E->Expr != 0 && E->ImpCount > 0) { + /* External with matching imports */ + CheckSymType (E); + } } } @@ -765,14 +765,14 @@ static void PrintUnresolved (ExpCheckFunc F, void* Data) /* Print all open imports */ for (I = 0; I < ExpCount; ++I) { - Export* E = ExpPool [I]; - if (E->Expr == 0 && E->ImpCount > 0 && F (E->Name, Data) == 0) { - /* Unresolved external */ - Import* Imp = E->ImpList; - fprintf (stderr, - "Unresolved external `%s' referenced in:\n", - GetString (E->Name)); - while (Imp) { + Export* E = ExpPool [I]; + if (E->Expr == 0 && E->ImpCount > 0 && F (E->Name, Data) == 0) { + /* Unresolved external */ + Import* Imp = E->ImpList; + fprintf (stderr, + "Unresolved external `%s' referenced in:\n", + GetString (E->Name)); + while (Imp) { unsigned J; for (J = 0; J < CollCount (&Imp->RefLines); ++J) { const LineInfo* LI = CollConstAt (&Imp->RefLines, J); @@ -781,9 +781,9 @@ static void PrintUnresolved (ExpCheckFunc F, void* Data) GetSourceName (LI), GetSourceLine (LI)); } - Imp = Imp->Next; - } - } + Imp = Imp->Next; + } + } } } @@ -805,18 +805,18 @@ static void CreateExportPool (void) /* Allocate memory */ if (ExpPool) { - xfree (ExpPool); + xfree (ExpPool); } ExpPool = xmalloc (ExpCount * sizeof (Export*)); /* Walk through the list and insert the exports */ for (I = 0, J = 0; I < sizeof (HashTab) / sizeof (HashTab [0]); ++I) { - Export* E = HashTab[I]; - while (E) { - CHECK (J < ExpCount); - ExpPool[J++] = E; - E = E->Next; - } + Export* E = HashTab[I]; + while (E) { + CHECK (J < ExpCount); + ExpPool[J++] = E; + E = E->Next; + } } /* Sort them by name */ @@ -846,8 +846,8 @@ void CheckUnresolvedImports (ExpCheckFunc F, void* Data) { /* Check for unresolved externals */ if (ImpOpen != 0) { - /* Print all open imports */ - PrintUnresolved (F, Data); + /* Print all open imports */ + PrintUnresolved (F, Data); } } @@ -863,8 +863,8 @@ static char GetAddrSizeCode (unsigned char AddrSize) case ADDR_SIZE_LONG: return 'L'; default: Internal ("Invalid address size: %u", AddrSize); - /* NOTREACHED */ - return '-'; + /* NOTREACHED */ + return '-'; } } @@ -879,23 +879,23 @@ void PrintExportMap (FILE* F) /* Print all exports */ Count = 0; for (I = 0; I < ExpCount; ++I) { - const Export* E = ExpPool [I]; + const Export* E = ExpPool [I]; - /* Print unreferenced symbols only if explictly requested */ - if (VerboseMap || E->ImpCount > 0 || SYM_IS_CONDES (E->Type)) { - fprintf (F, - "%-25s %06lX %c%c%c%c ", - GetString (E->Name), - GetExportVal (E), - E->ImpCount? 'R' : ' ', - SYM_IS_LABEL (E->Type)? 'L' : 'E', - GetAddrSizeCode ((unsigned char) E->AddrSize), - SYM_IS_CONDES (E->Type)? 'I' : ' '); - if (++Count == 2) { - Count = 0; - fprintf (F, "\n"); - } - } + /* Print unreferenced symbols only if explictly requested */ + if (VerboseMap || E->ImpCount > 0 || SYM_IS_CONDES (E->Type)) { + fprintf (F, + "%-25s %06lX %c%c%c%c ", + GetString (E->Name), + GetExportVal (E), + E->ImpCount? 'R' : ' ', + SYM_IS_LABEL (E->Type)? 'L' : 'E', + GetAddrSizeCode ((unsigned char) E->AddrSize), + SYM_IS_CONDES (E->Type)? 'I' : ' '); + if (++Count == 2) { + Count = 0; + fprintf (F, "\n"); + } + } } fprintf (F, "\n"); } @@ -911,25 +911,25 @@ void PrintImportMap (FILE* F) /* Loop over all exports */ for (I = 0; I < ExpCount; ++I) { - /* Get the export */ - const Export* Exp = ExpPool [I]; + /* Get the export */ + const Export* Exp = ExpPool [I]; - /* Print the symbol only if there are imports, or if a verbose map - * file is requested. - */ - if (VerboseMap || Exp->ImpCount > 0) { + /* Print the symbol only if there are imports, or if a verbose map + * file is requested. + */ + if (VerboseMap || Exp->ImpCount > 0) { - /* Print the export */ - fprintf (F, - "%s (%s):\n", - GetString (Exp->Name), - GetObjFileName (Exp->Obj)); + /* Print the export */ + fprintf (F, + "%s (%s):\n", + GetString (Exp->Name), + GetObjFileName (Exp->Obj)); - /* Print all imports for this symbol */ - Imp = Exp->ImpList; - while (Imp) { + /* Print all imports for this symbol */ + Imp = Exp->ImpList; + while (Imp) { - /* Print the import. Beware: The import might be linker + /* Print the import. Beware: The import might be linker * generated, in which case there is no object file and * sometimes no line information. */ @@ -946,10 +946,10 @@ void PrintImportMap (FILE* F) GetObjFileName (Imp->Obj)); } - /* Next import */ - Imp = Imp->Next; - } - } + /* Next import */ + Imp = Imp->Next; + } + } } fprintf (F, "\n"); } @@ -963,8 +963,8 @@ void PrintExportLabels (FILE* F) /* Print all exports */ for (I = 0; I < ExpCount; ++I) { - const Export* E = ExpPool [I]; - fprintf (F, "al %06lX .%s\n", GetExportVal (E), GetString (E->Name)); + const Export* E = ExpPool [I]; + fprintf (F, "al %06lX .%s\n", GetExportVal (E), GetString (E->Name)); } } @@ -999,7 +999,7 @@ void CircularRefError (const Export* E) { const LineInfo* LI = GetExportPos (E); Error ("Circular reference for symbol `%s', %s(%u)", - GetString (E->Name), + GetString (E->Name), GetSourceName (LI), GetSourceLine (LI)); } diff --git a/src/ld65/exports.h b/src/ld65/exports.h index 973156865..0d5337785 100644 --- a/src/ld65/exports.h +++ b/src/ld65/exports.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* exports.h */ +/* exports.h */ /* */ -/* Exports handing for the ld65 linker */ +/* Exports handing for the ld65 linker */ /* */ /* */ /* */ @@ -54,7 +54,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -62,12 +62,12 @@ /* Import symbol structure */ typedef struct Import Import; struct Import { - Import* Next; /* Single linked list */ - ObjData* Obj; /* Object file that imports the name */ + Import* Next; /* Single linked list */ + ObjData* Obj; /* Object file that imports the name */ Collection DefLines; /* Line infos of definition */ Collection RefLines; /* Line infos of reference */ - struct Export* Exp; /* Matching export for this import */ - unsigned Name; /* Name if not in table */ + struct Export* Exp; /* Matching export for this import */ + unsigned Name; /* Name if not in table */ unsigned short Flags; /* Generic flags */ unsigned short AddrSize; /* Address size of import */ }; @@ -77,20 +77,20 @@ struct Import { /* Export symbol structure */ typedef struct Export Export; struct Export { - unsigned Name; /* Name */ - Export* Next; /* Hash table link */ - unsigned Flags; /* Generic flags */ - ObjData* Obj; /* Object file that exports the name */ - unsigned ImpCount; /* How many imports for this symbol? */ - Import* ImpList; /* List of imports for this symbol */ - ExprNode* Expr; /* Expression (0 if not def'd) */ + unsigned Name; /* Name */ + Export* Next; /* Hash table link */ + unsigned Flags; /* Generic flags */ + ObjData* Obj; /* Object file that exports the name */ + unsigned ImpCount; /* How many imports for this symbol? */ + Import* ImpList; /* List of imports for this symbol */ + ExprNode* Expr; /* Expression (0 if not def'd) */ unsigned Size; /* Size of the symbol if any */ Collection DefLines; /* Line infos of definition */ Collection RefLines; /* Line infos of reference */ unsigned DbgSymId; /* Id of debug symbol for this export */ - unsigned short Type; /* Type of export */ + unsigned short Type; /* Type of export */ unsigned short AddrSize; /* Address size of export */ - unsigned char ConDes[CD_TYPE_COUNT]; /* Constructor/destructor decls */ + unsigned char ConDes[CD_TYPE_COUNT]; /* Constructor/destructor decls */ }; @@ -106,7 +106,7 @@ typedef int (*ExpCheckFunc) (unsigned Name, void* Data); /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/expr.c b/src/ld65/expr.c index bfcb852ea..c5cfe9abd 100644 --- a/src/ld65/expr.c +++ b/src/ld65/expr.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* expr.c */ +/* expr.c */ /* */ -/* Expression evaluation for the ld65 linker */ +/* Expression evaluation for the ld65 linker */ /* */ /* */ /* */ @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -59,11 +59,11 @@ ExprNode* NewExprNode (ObjData* O, unsigned char Op) { /* Allocate fresh memory */ ExprNode* N = xmalloc (sizeof (ExprNode)); - N->Op = Op; - N->Left = 0; - N->Right = 0; - N->Obj = O; - N->V.IVal = 0; + N->Op = Op; + N->Left = 0; + N->Right = 0; + N->Obj = O; + N->V.IVal = 0; return N; } @@ -83,9 +83,9 @@ void FreeExpr (ExprNode* Root) /* Free the expression, Root is pointing to. */ { if (Root) { - FreeExpr (Root->Left); - FreeExpr (Root->Right); - FreeExprNode (Root); + FreeExpr (Root->Left); + FreeExpr (Root->Right); + FreeExprNode (Root); } } @@ -102,27 +102,27 @@ int IsConstExpr (ExprNode* Root) MemoryArea* M; if (EXPR_IS_LEAF (Root->Op)) { - switch (Root->Op) { + switch (Root->Op) { - case EXPR_LITERAL: - return 1; + case EXPR_LITERAL: + return 1; - case EXPR_SYMBOL: - /* Get the referenced export */ - E = GetExprExport (Root); - /* If this export has a mark set, we've already encountered it. - * This means that the export is used to define it's own value, - * which in turn means, that we have a circular reference. - */ - if (ExportHasMark (E)) { + case EXPR_SYMBOL: + /* Get the referenced export */ + E = GetExprExport (Root); + /* If this export has a mark set, we've already encountered it. + * This means that the export is used to define it's own value, + * which in turn means, that we have a circular reference. + */ + if (ExportHasMark (E)) { CircularRefError (E); - Const = 0; - } else { - MarkExport (E); - Const = IsConstExport (E); - UnmarkExport (E); - } - return Const; + Const = 0; + } else { + MarkExport (E); + Const = IsConstExport (E); + UnmarkExport (E); + } + return Const; case EXPR_SECTION: /* A section expression is const if the segment it is in is @@ -142,11 +142,11 @@ int IsConstExpr (ExprNode* Root) return !Root->V.Mem->Relocatable && (Root->V.Mem->Flags & MF_PLACED); - default: + default: /* Anything else is not const */ - return 0; + return 0; - } + } } else if (EXPR_IS_UNARY (Root->Op)) { @@ -177,41 +177,41 @@ int IsConstExpr (ExprNode* Root) } else { - /* We must handle shortcut boolean expressions here */ - switch (Root->Op) { + /* We must handle shortcut boolean expressions here */ + switch (Root->Op) { - case EXPR_BOOLAND: - if (IsConstExpr (Root->Left)) { - /* lhs is const, if it is zero, don't eval right */ - if (GetExprVal (Root->Left) == 0) { - return 1; - } else { - return IsConstExpr (Root->Right); - } - } else { - /* lhs not const --> tree not const */ - return 0; - } - break; + case EXPR_BOOLAND: + if (IsConstExpr (Root->Left)) { + /* lhs is const, if it is zero, don't eval right */ + if (GetExprVal (Root->Left) == 0) { + return 1; + } else { + return IsConstExpr (Root->Right); + } + } else { + /* lhs not const --> tree not const */ + return 0; + } + break; - case EXPR_BOOLOR: - if (IsConstExpr (Root->Left)) { - /* lhs is const, if it is not zero, don't eval right */ - if (GetExprVal (Root->Left) != 0) { - return 1; - } else { - return IsConstExpr (Root->Right); - } - } else { - /* lhs not const --> tree not const */ - return 0; - } - break; + case EXPR_BOOLOR: + if (IsConstExpr (Root->Left)) { + /* lhs is const, if it is not zero, don't eval right */ + if (GetExprVal (Root->Left) != 0) { + return 1; + } else { + return IsConstExpr (Root->Right); + } + } else { + /* lhs not const --> tree not const */ + return 0; + } + break; - default: - /* All others are handled normal */ - return IsConstExpr (Root->Left) && IsConstExpr (Root->Right); - } + default: + /* All others are handled normal */ + return IsConstExpr (Root->Left) && IsConstExpr (Root->Right); + } } } @@ -228,10 +228,10 @@ Import* GetExprImport (ExprNode* Expr) * import pointer. */ if (Expr->Obj) { - /* Return the Import */ - return GetObjImport (Expr->Obj, Expr->V.ImpNum); + /* Return the Import */ + return GetObjImport (Expr->Obj, Expr->V.ImpNum); } else { - return Expr->V.Imp; + return Expr->V.Imp; } } @@ -260,10 +260,10 @@ Section* GetExprSection (ExprNode* Expr) * section pointer. */ if (Expr->Obj) { - /* Return the export */ - return CollAt (&Expr->Obj->Sections, Expr->V.SecNum); + /* Return the export */ + return CollAt (&Expr->Obj->Sections, Expr->V.SecNum); } else { - return Expr->V.Sec; + return Expr->V.Sec; } } @@ -281,102 +281,102 @@ long GetExprVal (ExprNode* Expr) switch (Expr->Op) { - case EXPR_LITERAL: - return Expr->V.IVal; + case EXPR_LITERAL: + return Expr->V.IVal; - case EXPR_SYMBOL: - /* Get the referenced export */ - E = GetExprExport (Expr); - /* If this export has a mark set, we've already encountered it. - * This means that the export is used to define it's own value, - * which in turn means, that we have a circular reference. - */ - if (ExportHasMark (E)) { - CircularRefError (E); - Val = 0; - } else { - MarkExport (E); - Val = GetExportVal (E); - UnmarkExport (E); - } - return Val; + case EXPR_SYMBOL: + /* Get the referenced export */ + E = GetExprExport (Expr); + /* If this export has a mark set, we've already encountered it. + * This means that the export is used to define it's own value, + * which in turn means, that we have a circular reference. + */ + if (ExportHasMark (E)) { + CircularRefError (E); + Val = 0; + } else { + MarkExport (E); + Val = GetExportVal (E); + UnmarkExport (E); + } + return Val; case EXPR_SECTION: - S = GetExprSection (Expr); - return S->Offs + S->Seg->PC; + S = GetExprSection (Expr); + return S->Offs + S->Seg->PC; - case EXPR_SEGMENT: - return Expr->V.Seg->PC; + case EXPR_SEGMENT: + return Expr->V.Seg->PC; case EXPR_MEMAREA: return Expr->V.Mem->Start; - case EXPR_PLUS: - return GetExprVal (Expr->Left) + GetExprVal (Expr->Right); + case EXPR_PLUS: + return GetExprVal (Expr->Left) + GetExprVal (Expr->Right); - case EXPR_MINUS: - return GetExprVal (Expr->Left) - GetExprVal (Expr->Right); + case EXPR_MINUS: + return GetExprVal (Expr->Left) - GetExprVal (Expr->Right); - case EXPR_MUL: - return GetExprVal (Expr->Left) * GetExprVal (Expr->Right); + case EXPR_MUL: + return GetExprVal (Expr->Left) * GetExprVal (Expr->Right); - case EXPR_DIV: - Left = GetExprVal (Expr->Left); - Right = GetExprVal (Expr->Right); - if (Right == 0) { - Error ("Division by zero"); - } - return Left / Right; + case EXPR_DIV: + Left = GetExprVal (Expr->Left); + Right = GetExprVal (Expr->Right); + if (Right == 0) { + Error ("Division by zero"); + } + return Left / Right; - case EXPR_MOD: - Left = GetExprVal (Expr->Left); - Right = GetExprVal (Expr->Right); - if (Right == 0) { - Error ("Modulo operation with zero"); - } - return Left % Right; + case EXPR_MOD: + Left = GetExprVal (Expr->Left); + Right = GetExprVal (Expr->Right); + if (Right == 0) { + Error ("Modulo operation with zero"); + } + return Left % Right; - case EXPR_OR: - return GetExprVal (Expr->Left) | GetExprVal (Expr->Right); + case EXPR_OR: + return GetExprVal (Expr->Left) | GetExprVal (Expr->Right); - case EXPR_XOR: - return GetExprVal (Expr->Left) ^ GetExprVal (Expr->Right); + case EXPR_XOR: + return GetExprVal (Expr->Left) ^ GetExprVal (Expr->Right); - case EXPR_AND: - return GetExprVal (Expr->Left) & GetExprVal (Expr->Right); + case EXPR_AND: + return GetExprVal (Expr->Left) & GetExprVal (Expr->Right); - case EXPR_SHL: - return GetExprVal (Expr->Left) << GetExprVal (Expr->Right); + case EXPR_SHL: + return GetExprVal (Expr->Left) << GetExprVal (Expr->Right); - case EXPR_SHR: - return GetExprVal (Expr->Left) >> GetExprVal (Expr->Right); + case EXPR_SHR: + return GetExprVal (Expr->Left) >> GetExprVal (Expr->Right); - case EXPR_EQ: - return (GetExprVal (Expr->Left) == GetExprVal (Expr->Right)); + case EXPR_EQ: + return (GetExprVal (Expr->Left) == GetExprVal (Expr->Right)); - case EXPR_NE: - return (GetExprVal (Expr->Left) != GetExprVal (Expr->Right)); + case EXPR_NE: + return (GetExprVal (Expr->Left) != GetExprVal (Expr->Right)); - case EXPR_LT: - return (GetExprVal (Expr->Left) < GetExprVal (Expr->Right)); + case EXPR_LT: + return (GetExprVal (Expr->Left) < GetExprVal (Expr->Right)); - case EXPR_GT: - return (GetExprVal (Expr->Left) > GetExprVal (Expr->Right)); + case EXPR_GT: + return (GetExprVal (Expr->Left) > GetExprVal (Expr->Right)); - case EXPR_LE: - return (GetExprVal (Expr->Left) <= GetExprVal (Expr->Right)); + case EXPR_LE: + return (GetExprVal (Expr->Left) <= GetExprVal (Expr->Right)); - case EXPR_GE: - return (GetExprVal (Expr->Left) >= GetExprVal (Expr->Right)); + case EXPR_GE: + return (GetExprVal (Expr->Left) >= GetExprVal (Expr->Right)); - case EXPR_BOOLAND: - return GetExprVal (Expr->Left) && GetExprVal (Expr->Right); + case EXPR_BOOLAND: + return GetExprVal (Expr->Left) && GetExprVal (Expr->Right); - case EXPR_BOOLOR: - return GetExprVal (Expr->Left) || GetExprVal (Expr->Right); + case EXPR_BOOLOR: + return GetExprVal (Expr->Left) || GetExprVal (Expr->Right); - case EXPR_BOOLXOR: - return (GetExprVal (Expr->Left) != 0) ^ (GetExprVal (Expr->Right) != 0); + case EXPR_BOOLXOR: + return (GetExprVal (Expr->Left) != 0) ^ (GetExprVal (Expr->Right) != 0); case EXPR_MAX: Left = GetExprVal (Expr->Left); @@ -388,18 +388,18 @@ long GetExprVal (ExprNode* Expr) Right = GetExprVal (Expr->Right); return (Left < Right)? Left : Right; - case EXPR_UNARY_MINUS: - return -GetExprVal (Expr->Left); + case EXPR_UNARY_MINUS: + return -GetExprVal (Expr->Left); - case EXPR_NOT: - return ~GetExprVal (Expr->Left); + case EXPR_NOT: + return ~GetExprVal (Expr->Left); case EXPR_SWAP: - Left = GetExprVal (Expr->Left); - return ((Left >> 8) & 0x00FF) | ((Left << 8) & 0xFF00); + Left = GetExprVal (Expr->Left); + return ((Left >> 8) & 0x00FF) | ((Left << 8) & 0xFF00); - case EXPR_BOOLNOT: - return !GetExprVal (Expr->Left); + case EXPR_BOOLNOT: + return !GetExprVal (Expr->Left); case EXPR_BANK: GetSegExprVal (Expr->Left, &D); @@ -418,23 +418,23 @@ long GetExprVal (ExprNode* Expr) } return GetExprVal (D.Seg->MemArea->BankExpr); - case EXPR_BYTE0: - return GetExprVal (Expr->Left) & 0xFF; + case EXPR_BYTE0: + return GetExprVal (Expr->Left) & 0xFF; - case EXPR_BYTE1: - return (GetExprVal (Expr->Left) >> 8) & 0xFF; + case EXPR_BYTE1: + return (GetExprVal (Expr->Left) >> 8) & 0xFF; - case EXPR_BYTE2: - return (GetExprVal (Expr->Left) >> 16) & 0xFF; + case EXPR_BYTE2: + return (GetExprVal (Expr->Left) >> 16) & 0xFF; - case EXPR_BYTE3: - return (GetExprVal (Expr->Left) >> 24) & 0xFF; + case EXPR_BYTE3: + return (GetExprVal (Expr->Left) >> 24) & 0xFF; - case EXPR_WORD0: - return GetExprVal (Expr->Left) & 0xFFFF; + case EXPR_WORD0: + return GetExprVal (Expr->Left) & 0xFFFF; - case EXPR_WORD1: - return (GetExprVal (Expr->Left) >> 16) & 0xFFFF; + case EXPR_WORD1: + return (GetExprVal (Expr->Left) >> 16) & 0xFFFF; case EXPR_FARADDR: return GetExprVal (Expr->Left) & 0xFFFFFF; @@ -443,9 +443,9 @@ long GetExprVal (ExprNode* Expr) return GetExprVal (Expr->Left) & 0xFFFFFFFF; default: - Internal ("Unknown expression Op type: %u", Expr->Op); - /* NOTREACHED */ - return 0; + Internal ("Unknown expression Op type: %u", Expr->Op); + /* NOTREACHED */ + return 0; } } @@ -462,66 +462,66 @@ static void GetSegExprValInternal (ExprNode* Expr, SegExprDesc* D, int Sign) switch (Expr->Op) { - case EXPR_LITERAL: + case EXPR_LITERAL: D->Val += (Sign * Expr->V.IVal); - break; + break; - case EXPR_SYMBOL: - /* Get the referenced export */ - E = GetExprExport (Expr); - /* If this export has a mark set, we've already encountered it. - * This means that the export is used to define it's own value, - * which in turn means, that we have a circular reference. - */ - if (ExportHasMark (E)) { - CircularRefError (E); - } else { - MarkExport (E); - GetSegExprValInternal (E->Expr, D, Sign); - UnmarkExport (E); - } - break; + case EXPR_SYMBOL: + /* Get the referenced export */ + E = GetExprExport (Expr); + /* If this export has a mark set, we've already encountered it. + * This means that the export is used to define it's own value, + * which in turn means, that we have a circular reference. + */ + if (ExportHasMark (E)) { + CircularRefError (E); + } else { + MarkExport (E); + GetSegExprValInternal (E->Expr, D, Sign); + UnmarkExport (E); + } + break; - case EXPR_SECTION: - if (D->Seg) { - /* We cannot handle more than one segment reference in o65 */ - D->TooComplex = 1; - } else { + case EXPR_SECTION: + if (D->Seg) { + /* We cannot handle more than one segment reference in o65 */ + D->TooComplex = 1; + } else { /* Get the section from the expression */ Section* S = GetExprSection (Expr); - /* Remember the segment reference */ - D->Seg = S->Seg; + /* Remember the segment reference */ + D->Seg = S->Seg; /* Add the offset of the section to the constant value */ D->Val += Sign * (S->Offs + D->Seg->PC); - } - break; + } + break; case EXPR_SEGMENT: - if (D->Seg) { - /* We cannot handle more than one segment reference in o65 */ - D->TooComplex = 1; - } else { - /* Remember the segment reference */ - D->Seg = Expr->V.Seg; + if (D->Seg) { + /* We cannot handle more than one segment reference in o65 */ + D->TooComplex = 1; + } else { + /* Remember the segment reference */ + D->Seg = Expr->V.Seg; /* Add the offset of the segment to the constant value */ D->Val += (Sign * D->Seg->PC); - } - break; + } + break; - case EXPR_PLUS: - GetSegExprValInternal (Expr->Left, D, Sign); - GetSegExprValInternal (Expr->Right, D, Sign); - break; + case EXPR_PLUS: + GetSegExprValInternal (Expr->Left, D, Sign); + GetSegExprValInternal (Expr->Right, D, Sign); + break; - case EXPR_MINUS: - GetSegExprValInternal (Expr->Left, D, Sign); - GetSegExprValInternal (Expr->Right, D, -Sign); - break; + case EXPR_MINUS: + GetSegExprValInternal (Expr->Left, D, Sign); + GetSegExprValInternal (Expr->Right, D, -Sign); + break; - default: - /* Expression contains illegal operators */ - D->TooComplex = 1; - break; + default: + /* Expression contains illegal operators */ + D->TooComplex = 1; + break; } } @@ -626,7 +626,7 @@ ExprNode* ReadExpr (FILE* F, ObjData* O) /* Read the node tag and handle NULL nodes */ unsigned char Op = Read8 (F); if (Op == EXPR_NULL) { - return 0; + return 0; } /* Create a new node */ @@ -634,32 +634,32 @@ ExprNode* ReadExpr (FILE* F, ObjData* O) /* Check the tag and handle the different expression types */ if (EXPR_IS_LEAF (Op)) { - switch (Op) { + switch (Op) { - case EXPR_LITERAL: - Expr->V.IVal = Read32Signed (F); - break; + case EXPR_LITERAL: + Expr->V.IVal = Read32Signed (F); + break; - case EXPR_SYMBOL: - /* Read the import number */ - Expr->V.ImpNum = ReadVar (F); - break; + case EXPR_SYMBOL: + /* Read the import number */ + Expr->V.ImpNum = ReadVar (F); + break; - case EXPR_SECTION: - /* Read the section number */ - Expr->V.SecNum = ReadVar (F); - break; + case EXPR_SECTION: + /* Read the section number */ + Expr->V.SecNum = ReadVar (F); + break; - default: - Error ("Invalid expression op: %02X", Op); + default: + Error ("Invalid expression op: %02X", Op); - } + } } else { - /* Not a leaf node */ - Expr->Left = ReadExpr (F, O); - Expr->Right = ReadExpr (F, O); + /* Not a leaf node */ + Expr->Left = ReadExpr (F, O); + Expr->Right = ReadExpr (F, O); } @@ -674,43 +674,43 @@ int EqualExpr (ExprNode* E1, ExprNode* E2) { /* If one pointer is NULL, both must be NULL */ if ((E1 == 0) ^ (E2 == 0)) { - return 0; + return 0; } if (E1 == 0) { - return 1; + return 1; } /* Both pointers not NULL, check OP */ if (E1->Op != E2->Op) { - return 0; + return 0; } /* OPs are identical, check data for leafs, or subtrees */ switch (E1->Op) { - case EXPR_LITERAL: - /* Value must be identical */ - return (E1->V.IVal == E2->V.IVal); + case EXPR_LITERAL: + /* Value must be identical */ + return (E1->V.IVal == E2->V.IVal); - case EXPR_SYMBOL: - /* Import must be identical */ - return (GetExprImport (E1) == GetExprImport (E2)); + case EXPR_SYMBOL: + /* Import must be identical */ + return (GetExprImport (E1) == GetExprImport (E2)); - case EXPR_SECTION: - /* Section must be identical */ - return (GetExprSection (E1) == GetExprSection (E2)); + case EXPR_SECTION: + /* Section must be identical */ + return (GetExprSection (E1) == GetExprSection (E2)); - case EXPR_SEGMENT: - /* Segment must be identical */ - return (E1->V.Seg == E2->V.Seg); + case EXPR_SEGMENT: + /* Segment must be identical */ + return (E1->V.Seg == E2->V.Seg); - case EXPR_MEMAREA: - /* Memory area must be identical */ - return (E1->V.Mem == E2->V.Mem); + case EXPR_MEMAREA: + /* Memory area must be identical */ + return (E1->V.Mem == E2->V.Mem); - default: - /* Not a leaf node */ - return EqualExpr (E1->Left, E2->Left) && EqualExpr (E1->Right, E2->Right); + default: + /* Not a leaf node */ + return EqualExpr (E1->Left, E2->Left) && EqualExpr (E1->Right, E2->Right); } } diff --git a/src/ld65/expr.h b/src/ld65/expr.h index e35cfdf13..bc3e8b216 100644 --- a/src/ld65/expr.h +++ b/src/ld65/expr.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* expr.h */ +/* expr.h */ /* */ -/* Expression evaluation for the ld65 linker */ +/* Expression evaluation for the ld65 linker */ /* */ /* */ /* */ @@ -57,15 +57,15 @@ /* Structure for parsing segment based expression trees */ typedef struct SegExprDesc SegExprDesc; struct SegExprDesc { - long Val; /* The offset value */ - int TooComplex; /* Expression too complex */ + long Val; /* The offset value */ + int TooComplex; /* Expression too complex */ Segment* Seg; /* Segment reference if any */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/extsyms.c b/src/ld65/extsyms.c index 261af681c..b19c23100 100644 --- a/src/ld65/extsyms.c +++ b/src/ld65/extsyms.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* extsyms.c */ +/* extsyms.c */ /* */ -/* Handle program external symbols for relocatable output formats */ +/* Handle program external symbols for relocatable output formats */ /* */ /* */ /* */ @@ -47,34 +47,34 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Structure holding an external symbol */ struct ExtSym { - unsigned Name; /* Name index */ - ExtSym* List; /* Next entry in list of all symbols */ - ExtSym* Next; /* Next entry in hash list */ - unsigned Flags; /* Generic flags */ - unsigned Num; /* Number of external symbol */ + unsigned Name; /* Name index */ + ExtSym* List; /* Next entry in list of all symbols */ + ExtSym* Next; /* Next entry in hash list */ + unsigned Flags; /* Generic flags */ + unsigned Num; /* Number of external symbol */ }; /* External symbol table structure */ #define HASHTAB_MASK 0x3FU -#define HASHTAB_SIZE (HASHTAB_MASK + 1) +#define HASHTAB_SIZE (HASHTAB_MASK + 1) struct ExtSymTab { - ExtSym* Root; /* List of symbols */ - ExtSym* Last; /* Pointer to last symbol */ - unsigned Count; /* Number of symbols */ - ExtSym* HashTab[HASHTAB_SIZE]; + ExtSym* Root; /* List of symbols */ + ExtSym* Last; /* Pointer to last symbol */ + unsigned Count; /* Number of symbols */ + ExtSym* HashTab[HASHTAB_SIZE]; }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -86,10 +86,10 @@ ExtSym* NewExtSym (ExtSymTab* Tab, unsigned Name) unsigned Hash = (Name & HASHTAB_MASK); /* Check for duplicates */ - ExtSym* E = GetExtSym (Tab, Name); + ExtSym* E = GetExtSym (Tab, Name); if (E != 0) { - /* We do already have a symbol with this name */ - Error ("Duplicate external symbol `%s'", GetString (Name)); + /* We do already have a symbol with this name */ + Error ("Duplicate external symbol `%s'", GetString (Name)); } /* Allocate memory for the structure */ @@ -103,11 +103,11 @@ ExtSym* NewExtSym (ExtSymTab* Tab, unsigned Name) /* Insert the entry into the list of all symbols */ if (Tab->Last == 0) { - /* List is empty */ - Tab->Root = E; + /* List is empty */ + Tab->Root = E; } else { - /* List not empty */ - Tab->Last->List = E; + /* List not empty */ + Tab->Last->List = E; } Tab->Last = E; ++Tab->Count; @@ -141,11 +141,11 @@ ExtSymTab* NewExtSymTab (void) ExtSymTab* Tab = xmalloc (sizeof (ExtSymTab)); /* Initialize the fields */ - Tab->Root = 0; + Tab->Root = 0; Tab->Last = 0; Tab->Count = 0; for (I = 0; I < HASHTAB_SIZE; ++I) { - Tab->HashTab [I] = 0; + Tab->HashTab [I] = 0; } /* Done, return the hash table */ @@ -159,9 +159,9 @@ void FreeExtSymTab (ExtSymTab* Tab) { /* Free all entries */ while (Tab->Root) { - ExtSym* E = Tab->Root; - Tab->Root = E->Next; - FreeExtSym (E); + ExtSym* E = Tab->Root; + Tab->Root = E->Next; + FreeExtSym (E); } /* Free the struct itself */ @@ -181,11 +181,11 @@ ExtSym* GetExtSym (const ExtSymTab* Tab, unsigned Name) /* Check the linked list */ ExtSym* E = Tab->HashTab[Hash]; while (E) { - if (E->Name == Name) { - /* Found it */ - break; - } - E = E->Next; + if (E->Name == Name) { + /* Found it */ + break; + } + E = E->Next; } /* Return the symbol we found */ diff --git a/src/ld65/extsyms.h b/src/ld65/extsyms.h index 74801e915..c3c82b2e2 100644 --- a/src/ld65/extsyms.h +++ b/src/ld65/extsyms.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* extsyms.h */ +/* extsyms.h */ /* */ -/* Handle program external symbols for relocatable output formats */ +/* Handle program external symbols for relocatable output formats */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -53,7 +53,7 @@ typedef struct ExtSymTab ExtSymTab; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/fileinfo.c b/src/ld65/fileinfo.c index 6c17fbd4a..cc0238166 100644 --- a/src/ld65/fileinfo.c +++ b/src/ld65/fileinfo.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fileinfo.c */ +/* fileinfo.c */ /* */ -/* Source file info structure */ +/* Source file info structure */ /* */ /* */ /* */ @@ -57,7 +57,7 @@ static Collection FileInfos = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/fileinfo.h b/src/ld65/fileinfo.h index c4efc5a3a..038e2404c 100644 --- a/src/ld65/fileinfo.h +++ b/src/ld65/fileinfo.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fileinfo.h */ +/* fileinfo.h */ /* */ -/* Source file info structure */ +/* Source file info structure */ /* */ /* */ /* */ @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,7 +58,7 @@ typedef struct FileInfo FileInfo; struct FileInfo { unsigned Id; /* Id of file for debug info */ - unsigned Name; /* File name index */ + unsigned Name; /* File name index */ unsigned long MTime; /* Time of last modification */ unsigned long Size; /* Size of the file */ Collection Modules; /* Modules that use this file */ @@ -67,7 +67,7 @@ struct FileInfo { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/fileio.c b/src/ld65/fileio.c index af00e3567..9edb911ab 100644 --- a/src/ld65/fileio.c +++ b/src/ld65/fileio.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fileio.c */ +/* fileio.c */ /* */ -/* File I/O for the ld65 linker */ +/* File I/O for the ld65 linker */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -56,7 +56,7 @@ void FileSetPos (FILE* F, unsigned long Pos) /* Seek to the given absolute position, fail on errors */ { if (fseek (F, Pos, SEEK_SET) != 0) { - Error ("Cannot seek: %s", strerror (errno)); + Error ("Cannot seek: %s", strerror (errno)); } } @@ -67,7 +67,7 @@ unsigned long FileGetPos (FILE* F) { long Pos = ftell (F); if (Pos < 0) { - Error ("Error in ftell: %s", strerror (errno)); + Error ("Error in ftell: %s", strerror (errno)); } return Pos; } @@ -78,7 +78,7 @@ void Write8 (FILE* F, unsigned Val) /* Write an 8 bit value to the file */ { if (putc (Val, F) == EOF) { - Error ("Write error (disk full?)"); + Error ("Write error (disk full?)"); } } @@ -119,24 +119,24 @@ void WriteVal (FILE* F, unsigned long Val, unsigned Size) { switch (Size) { - case 1: - Write8 (F, Val); - break; + case 1: + Write8 (F, Val); + break; - case 2: - Write16 (F, Val); - break; + case 2: + Write16 (F, Val); + break; - case 3: - Write24 (F, Val); - break; + case 3: + Write24 (F, Val); + break; - case 4: - Write32 (F, Val); - break; + case 4: + Write32 (F, Val); + break; - default: - Internal ("WriteVal: Invalid size: %u", Size); + default: + Internal ("WriteVal: Invalid size: %u", Size); } } @@ -152,12 +152,12 @@ void WriteVar (FILE* F, unsigned long V) * needing 5 bytes if a 32 bit value is written to file. */ do { - unsigned char C = (V & 0x7F); - V >>= 7; - if (V) { - C |= 0x80; - } - Write8 (F, C); + unsigned char C = (V & 0x7F); + V >>= 7; + if (V) { + C |= 0x80; + } + Write8 (F, C); } while (V != 0); } @@ -177,7 +177,7 @@ void WriteData (FILE* F, const void* Data, unsigned Size) /* Write data to the file */ { if (fwrite (Data, 1, Size, F) != Size) { - Error ("Write error (disk full?)"); + Error ("Write error (disk full?)"); } } @@ -187,7 +187,7 @@ void WriteMult (FILE* F, unsigned char Val, unsigned long Count) /* Write one byte several times to the file */ { while (Count--) { - Write8 (F, Val); + Write8 (F, Val); } } @@ -199,7 +199,7 @@ unsigned Read8 (FILE* F) int C = getc (F); if (C == EOF) { long Pos = ftell (F); - Error ("Read error at position %ld (file corrupt?)", Pos); + Error ("Read error at position %ld (file corrupt?)", Pos); } return C; } @@ -244,8 +244,8 @@ long Read32Signed (FILE* F) /* Sign extend the value */ if (V & 0x80000000UL) { - /* Signed value */ - V |= ~0xFFFFFFFFUL; + /* Signed value */ + V |= ~0xFFFFFFFFUL; } /* Return it as a long */ @@ -264,12 +264,12 @@ unsigned long ReadVar (FILE* F) unsigned long V = 0; unsigned Shift = 0; do { - /* Read one byte */ - C = Read8 (F); - /* Encode it into the target value */ - V |= ((unsigned long)(C & 0x7F)) << Shift; - /* Next value */ - Shift += 7; + /* Read one byte */ + C = Read8 (F); + /* Encode it into the target value */ + V |= ((unsigned long)(C & 0x7F)) << Shift; + /* Next value */ + Shift += 7; } while (C & 0x80); /* Return the value read */ @@ -312,7 +312,7 @@ FilePos* ReadFilePos (FILE* F, FilePos* Pos) /* Read a file position from the file */ { /* Read the data fields */ - Pos->Line = ReadVar (F); + Pos->Line = ReadVar (F); Pos->Col = ReadVar (F); Pos->Name = ReadVar (F); return Pos; @@ -325,10 +325,10 @@ void* ReadData (FILE* F, void* Data, unsigned Size) { /* Explicitly allow reading zero bytes */ if (Size > 0) { - if (fread (Data, 1, Size, F) != Size) { + if (fread (Data, 1, Size, F) != Size) { long Pos = ftell (F); Error ("Read error at position %ld (file corrupt?)", Pos); - } + } } return Data; } diff --git a/src/ld65/fileio.h b/src/ld65/fileio.h index 7bcc96f30..f78f4a11b 100644 --- a/src/ld65/fileio.h +++ b/src/ld65/fileio.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fileio.h */ +/* fileio.h */ /* */ -/* File I/O for the ld65 linker */ +/* File I/O for the ld65 linker */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/filepath.c b/src/ld65/filepath.c index 803efbf2d..42357bb47 100644 --- a/src/ld65/filepath.c +++ b/src/ld65/filepath.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* filepath.c */ +/* filepath.c */ /* */ /* File search path handling for ld65 */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -55,7 +55,7 @@ SearchPath* CfgDefaultPath; /* Default Config file path */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/filepath.h b/src/ld65/filepath.h index 4d267b156..97e77068b 100644 --- a/src/ld65/filepath.h +++ b/src/ld65/filepath.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* filepath.h */ +/* filepath.h */ /* */ /* File search path handling for ld65 */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -60,7 +60,7 @@ extern SearchPath* CfgDefaultPath; /* Default Config file path */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/fragment.c b/src/ld65/fragment.c index 3a9e13c73..70ca3d037 100644 --- a/src/ld65/fragment.c +++ b/src/ld65/fragment.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fragment.c */ +/* fragment.c */ /* */ -/* Code/data fragment routines */ +/* Code/data fragment routines */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -78,10 +78,10 @@ Fragment* NewFragment (unsigned char Type, unsigned Size, Section* S) /* Insert the code fragment into the section */ if (S->FragRoot == 0) { - /* First fragment */ - S->FragRoot = F; + /* First fragment */ + S->FragRoot = F; } else { - S->FragLast->Next = F; + S->FragLast->Next = F; } S->FragLast = F; diff --git a/src/ld65/fragment.h b/src/ld65/fragment.h index a94aad2c2..98f90f568 100644 --- a/src/ld65/fragment.h +++ b/src/ld65/fragment.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fragment.h */ +/* fragment.h */ /* */ -/* Code/data fragment routines */ +/* Code/data fragment routines */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -58,7 +58,7 @@ struct Section; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -66,20 +66,20 @@ struct Section; /* Fragment structure */ typedef struct Fragment Fragment; struct Fragment { - Fragment* Next; /* Next fragment in list */ - struct ObjData* Obj; /* Source of fragment */ + Fragment* Next; /* Next fragment in list */ + struct ObjData* Obj; /* Source of fragment */ struct Section* Sec; /* Section for this fragment */ - unsigned Size; /* Size of data/expression */ - struct ExprNode* Expr; /* Expression if FRAG_EXPR */ + unsigned Size; /* Size of data/expression */ + struct ExprNode* Expr; /* Expression if FRAG_EXPR */ Collection LineInfos; /* Line info for this fragment */ - unsigned char Type; /* Type of fragment */ - unsigned char LitBuf [1]; /* Dynamically alloc'ed literal buffer */ + unsigned char Type; /* Type of fragment */ + unsigned char LitBuf [1]; /* Dynamically alloc'ed literal buffer */ }; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/global.c b/src/ld65/global.c index 94f378dec..985a5914f 100644 --- a/src/ld65/global.c +++ b/src/ld65/global.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ -/* Global variables for the ld65 linker */ +/* Global variables for the ld65 linker */ /* */ /* */ /* */ @@ -38,12 +38,12 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -const char* OutputName = "a.out"; /* Name of output file */ +const char* OutputName = "a.out"; /* Name of output file */ unsigned OutputNameUsed = 0; /* Output name was used by %O */ unsigned ModuleId = 0; /* Id for o65 module */ @@ -52,9 +52,9 @@ unsigned ModuleId = 0; /* Id for o65 module */ unsigned char HaveStartAddr = 0; /* Start address not given */ unsigned long StartAddr = 0x200; /* Start address */ -unsigned char VerboseMap = 0; /* Verbose map file */ -const char* MapFileName = 0; /* Name of the map file */ -const char* LabelFileName = 0; /* Name of the label file */ +unsigned char VerboseMap = 0; /* Verbose map file */ +const char* MapFileName = 0; /* Name of the map file */ +const char* LabelFileName = 0; /* Name of the label file */ const char* DbgFileName = 0; /* Name of the debug file */ diff --git a/src/ld65/global.h b/src/ld65/global.h index 9ddec43fb..957d34041 100644 --- a/src/ld65/global.h +++ b/src/ld65/global.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ -/* Global variables for the ld65 linker */ +/* Global variables for the ld65 linker */ /* */ /* */ /* */ @@ -39,22 +39,22 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -extern const char* OutputName; /* Name of output file */ +extern const char* OutputName; /* Name of output file */ extern unsigned OutputNameUsed; /* Output name was used by %O */ extern unsigned ModuleId; /* Id for o65 module */ extern unsigned char HaveStartAddr; /* True if start address was given */ -extern unsigned long StartAddr; /* Start address */ +extern unsigned long StartAddr; /* Start address */ -extern unsigned char VerboseMap; /* Verbose map file */ -extern const char* MapFileName; /* Name of the map file */ -extern const char* LabelFileName; /* Name of the label file */ +extern unsigned char VerboseMap; /* Verbose map file */ +extern const char* MapFileName; /* Name of the map file */ +extern const char* LabelFileName; /* Name of the label file */ extern const char* DbgFileName; /* Name of the debug file */ diff --git a/src/ld65/library.c b/src/ld65/library.c index de7d378e7..c81ee6f91 100644 --- a/src/ld65/library.c +++ b/src/ld65/library.c @@ -1,34 +1,34 @@ /*****************************************************************************/ -/* */ -/* library.c */ -/* */ -/* Library data structures and helpers for the ld65 linker */ -/* */ -/* */ -/* */ +/* */ +/* library.c */ +/* */ +/* Library data structures and helpers for the ld65 linker */ +/* */ +/* */ +/* */ /* (C) 1998-2011, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -57,7 +57,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -135,7 +135,7 @@ static void FreeLibrary (Library* L) /*****************************************************************************/ -/* Reading file data structures */ +/* Reading file data structures */ /*****************************************************************************/ @@ -158,7 +158,7 @@ static void LibReadHeader (Library* L) L->Header.Magic = LIB_MAGIC; L->Header.Version = Read16 (L->F); if (L->Header.Version != LIB_VERSION) { - Error ("Wrong data version in `%s'", GetString (L->Name)); + Error ("Wrong data version in `%s'", GetString (L->Name)); } L->Header.Flags = Read16 (L->F); L->Header.IndexOffs = Read32 (L->F); @@ -171,21 +171,21 @@ static void LibReadObjHeader (Library* L, ObjData* O) { O->Header.Magic = Read32 (L->F); if (O->Header.Magic != OBJ_MAGIC) { - Error ("Object file `%s' in library `%s' is invalid", - GetObjFileName (O), GetString (L->Name)); + Error ("Object file `%s' in library `%s' is invalid", + GetObjFileName (O), GetString (L->Name)); } O->Header.Version = Read16 (L->F); if (O->Header.Version != OBJ_VERSION) { - Error ("Object file `%s' in library `%s' has wrong version", - GetObjFileName (O), GetString (L->Name)); + Error ("Object file `%s' in library `%s' has wrong version", + GetObjFileName (O), GetString (L->Name)); } - O->Header.Flags = Read16 (L->F); + O->Header.Flags = Read16 (L->F); O->Header.OptionOffs = Read32 (L->F); O->Header.OptionSize = Read32 (L->F); - O->Header.FileOffs = Read32 (L->F); - O->Header.FileSize = Read32 (L->F); - O->Header.SegOffs = Read32 (L->F); - O->Header.SegSize = Read32 (L->F); + O->Header.FileOffs = Read32 (L->F); + O->Header.FileSize = Read32 (L->F); + O->Header.SegOffs = Read32 (L->F); + O->Header.SegSize = Read32 (L->F); O->Header.ImportOffs = Read32 (L->F); O->Header.ImportSize = Read32 (L->F); O->Header.ExportOffs = Read32 (L->F); @@ -210,7 +210,7 @@ static ObjData* ReadIndexEntry (Library* L) /* Read one entry in the index */ { /* Create a new entry and insert it into the list */ - ObjData* O = NewObjData (); + ObjData* O = NewObjData (); /* Remember from which library this module is */ O->Lib = L; @@ -219,10 +219,10 @@ static ObjData* ReadIndexEntry (Library* L) O->Name = ReadStr (L->F); /* Module flags/MTime/Start/Size */ - O->Flags = Read16 (L->F); + O->Flags = Read16 (L->F); O->MTime = Read32 (L->F); - O->Start = Read32 (L->F); - Read32 (L->F); /* Skip Size */ + O->Start = Read32 (L->F); + Read32 (L->F); /* Skip Size */ /* Done */ return O; @@ -271,7 +271,7 @@ static void LibReadIndex (Library* L) /* Read all entries in the index */ while (ModuleCount--) { - CollAppend (&L->Modules, ReadIndexEntry (L)); + CollAppend (&L->Modules, ReadIndexEntry (L)); } /* Walk over the index and read basic data for all object files in the @@ -285,7 +285,7 @@ static void LibReadIndex (Library* L) /*****************************************************************************/ -/* High level stuff */ +/* High level stuff */ /*****************************************************************************/ @@ -300,12 +300,12 @@ static void LibCheckExports (ObjData* O) /* Check all exports */ for (I = 0; I < CollCount (&O->Exports); ++I) { const Export* E = CollConstAt (&O->Exports, I); - if (IsUnresolved (E->Name)) { + if (IsUnresolved (E->Name)) { /* We need this module, insert the imports and exports */ - O->Flags |= OBJ_REF; + O->Flags |= OBJ_REF; InsertObjGlobals (O); break; - } + } } } diff --git a/src/ld65/library.h b/src/ld65/library.h index 425b32181..19648630c 100644 --- a/src/ld65/library.h +++ b/src/ld65/library.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* library.h */ +/* library.h */ /* */ -/* Library data structures and helpers for the ld65 linker */ +/* Library data structures and helpers for the ld65 linker */ /* */ /* */ /* */ diff --git a/src/ld65/lineinfo.c b/src/ld65/lineinfo.c index 3ff8491c6..cc54055c3 100644 --- a/src/ld65/lineinfo.c +++ b/src/ld65/lineinfo.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* lineinfo.h */ +/* lineinfo.h */ /* */ -/* Source file line info structure */ +/* Source file line info structure */ /* */ /* */ /* */ @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/lineinfo.h b/src/ld65/lineinfo.h index c965b2d67..5af9e5788 100644 --- a/src/ld65/lineinfo.h +++ b/src/ld65/lineinfo.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* lineinfo.h */ +/* lineinfo.h */ /* */ -/* Source file line info structure */ +/* Source file line info structure */ /* */ /* */ /* */ @@ -51,7 +51,7 @@ /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -62,7 +62,7 @@ struct Segment; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -74,7 +74,7 @@ struct Segment; typedef struct LineInfo LineInfo; struct LineInfo { unsigned Id; /* Line info id */ - struct FileInfo* File; /* File struct for this line if any */ + struct FileInfo* File; /* File struct for this line if any */ unsigned Type; /* Type of line info */ FilePos Pos; /* Position in file */ unsigned* Spans; /* Spans for this line */ @@ -83,7 +83,7 @@ struct LineInfo { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/main.c b/src/ld65/main.c index 0f7eaa07f..25a6c76f8 100644 --- a/src/ld65/main.c +++ b/src/ld65/main.c @@ -1,34 +1,34 @@ /*****************************************************************************/ -/* */ -/* main.c */ -/* */ -/* Main program for the ld65 linker */ -/* */ -/* */ -/* */ +/* */ +/* main.c */ +/* */ +/* Main program for the ld65 linker */ +/* */ +/* */ +/* */ /* (C) 1998-2013, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -72,18 +72,18 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -static unsigned ObjFiles = 0; /* Count of object files linked */ -static unsigned LibFiles = 0; /* Count of library files linked */ +static unsigned ObjFiles = 0; /* Count of object files linked */ +static unsigned LibFiles = 0; /* Count of library files linked */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -139,19 +139,19 @@ static unsigned long CvtNumber (const char* Arg, const char* Number) */ { unsigned long Val; - int Converted; + int Converted; /* Convert */ if (*Number == '$') { - ++Number; - Converted = sscanf (Number, "%lx", &Val); + ++Number; + Converted = sscanf (Number, "%lx", &Val); } else { - Converted = sscanf (Number, "%li", (long*)&Val); + Converted = sscanf (Number, "%li", (long*)&Val); } /* Check if we do really have a number */ if (Converted != 1) { - Error ("Invalid number given in argument: %s\n", Arg); + Error ("Invalid number given in argument: %s\n", Arg); } /* Return the result */ @@ -217,19 +217,19 @@ static void LinkFile (const char* Name, FILETYPE Type) */ switch (Magic) { - case OBJ_MAGIC: - ObjAdd (F, PathName); - ++ObjFiles; - break; + case OBJ_MAGIC: + ObjAdd (F, PathName); + ++ObjFiles; + break; - case LIB_MAGIC: - LibAdd (F, PathName); - ++LibFiles; - break; + case LIB_MAGIC: + LibAdd (F, PathName); + ++LibFiles; + break; - default: - fclose (F); - Error ("File `%s' has unknown type", PathName); + default: + fclose (F); + Error ("File `%s' has unknown type", PathName); } @@ -249,7 +249,7 @@ static void DefineSymbol (const char* Def) /* The symbol must start with a character or underline */ if (Def [0] != '_' && !IsAlpha (Def [0])) { - InvDef (Def); + InvDef (Def); } P = Def; @@ -263,18 +263,18 @@ static void DefineSymbol (const char* Def) if (*P != '=') { InvDef (Def); } else { - /* We have a value */ - ++P; - if (*P == '$') { - ++P; - if (sscanf (P, "%lx", &Val) != 1) { - InvDef (Def); - } - } else { - if (sscanf (P, "%li", &Val) != 1) { - InvDef (Def); - } - } + /* We have a value */ + ++P; + if (*P == '$') { + ++P; + if (sscanf (P, "%lx", &Val) != 1) { + InvDef (Def); + } + } else { + if (sscanf (P, "%li", &Val) != 1) { + InvDef (Def); + } + } } /* Define the new symbol */ @@ -297,7 +297,7 @@ static void OptConfig (const char* Opt attribute ((unused)), const char* Arg) char* PathName; if (CfgAvail ()) { - Error ("Cannot use -C/-t twice"); + Error ("Cannot use -C/-t twice"); } /* Search for the file */ PathName = SearchFile (CfgSearchPath, Arg); @@ -332,7 +332,7 @@ static void OptDefine (const char* Opt attribute ((unused)), const char* Arg) static void OptEndGroup (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* End a library group */ { LibEndGroup (); @@ -379,7 +379,7 @@ static void OptForceImport (const char* Opt attribute ((unused)), const char* Ar static void OptHelp (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print usage information and exit */ { Usage (); @@ -465,7 +465,7 @@ static void OptStartAddr (const char* Opt, const char* Arg) static void OptStartGroup (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Start a library group */ { LibStartGroup (); @@ -482,7 +482,7 @@ static void OptTarget (const char* Opt attribute ((unused)), const char* Arg) /* Map the target name to a target id */ Target = FindTarget (Arg); if (Target == TGT_UNKNOWN) { - Error ("Invalid target name: `%s'", Arg); + Error ("Invalid target name: `%s'", Arg); } /* Set the target binary format */ @@ -513,7 +513,7 @@ static void OptTarget (const char* Opt attribute ((unused)), const char* Arg) static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print the assembler version */ { fprintf (stderr, "ld65 V%s\n", GetVersionAsString ()); @@ -526,23 +526,23 @@ int main (int argc, char* argv []) { /* Program long options */ static const LongOpt OptTab[] = { - { "--cfg-path", 1, OptCfgPath }, - { "--config", 1, OptConfig }, - { "--dbgfile", 1, OptDbgFile }, + { "--cfg-path", 1, OptCfgPath }, + { "--config", 1, OptConfig }, + { "--dbgfile", 1, OptDbgFile }, { "--define", 1, OptDefine }, { "--end-group", 0, OptEndGroup }, { "--force-import", 1, OptForceImport }, - { "--help", 0, OptHelp }, + { "--help", 0, OptHelp }, { "--lib", 1, OptLib }, - { "--lib-path", 1, OptLibPath }, - { "--mapfile", 1, OptMapFile }, - { "--module-id", 1, OptModuleId }, + { "--lib-path", 1, OptLibPath }, + { "--mapfile", 1, OptMapFile }, + { "--module-id", 1, OptModuleId }, { "--obj", 1, OptObj }, - { "--obj-path", 1, OptObjPath }, - { "--start-addr", 1, OptStartAddr }, + { "--obj-path", 1, OptObjPath }, + { "--start-addr", 1, OptStartAddr }, { "--start-group", 0, OptStartGroup }, - { "--target", 1, OptTarget }, - { "--version", 0, OptVersion }, + { "--target", 1, OptTarget }, + { "--version", 0, OptVersion }, }; unsigned I; @@ -564,18 +564,18 @@ int main (int argc, char* argv []) I = 1; while (I < ArgCount) { - /* Get the argument */ - const char* Arg = ArgVec[I]; + /* Get the argument */ + const char* Arg = ArgVec[I]; - /* Check for an option */ - if (Arg [0] == '-') { + /* Check for an option */ + if (Arg [0] == '-') { - /* An option */ - switch (Arg [1]) { + /* An option */ + switch (Arg [1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; case '(': OptStartGroup (Arg, 0); @@ -585,86 +585,86 @@ int main (int argc, char* argv []) OptEndGroup (Arg, 0); break; - case 'h': - case '?': - OptHelp (Arg, 0); - break; + case 'h': + case '?': + OptHelp (Arg, 0); + break; - case 'm': - OptMapFile (Arg, GetArg (&I, 2)); - break; + case 'm': + OptMapFile (Arg, GetArg (&I, 2)); + break; - case 'o': - OptOutputName (Arg, GetArg (&I, 2)); - break; + case 'o': + OptOutputName (Arg, GetArg (&I, 2)); + break; - case 't': - if (CfgAvail ()) { - Error ("Cannot use -C/-t twice"); - } - OptTarget (Arg, GetArg (&I, 2)); - break; + case 't': + if (CfgAvail ()) { + Error ("Cannot use -C/-t twice"); + } + OptTarget (Arg, GetArg (&I, 2)); + break; case 'u': OptForceImport (Arg, GetArg (&I, 2)); break; - case 'v': - switch (Arg [2]) { - case 'm': VerboseMap = 1; break; - case '\0': ++Verbosity; break; - default: UnknownOption (Arg); - } - break; + case 'v': + switch (Arg [2]) { + case 'm': VerboseMap = 1; break; + case '\0': ++Verbosity; break; + default: UnknownOption (Arg); + } + break; - case 'C': - OptConfig (Arg, GetArg (&I, 2)); - break; + case 'C': + OptConfig (Arg, GetArg (&I, 2)); + break; case 'D': OptDefine (Arg, GetArg (&I, 2)); break; - case 'L': - switch (Arg [2]) { + case 'L': + switch (Arg [2]) { /* ## The first one is obsolete and will go */ - case 'n': LabelFileName = GetArg (&I, 3); break; - default: OptLibPath (Arg, GetArg (&I, 2)); break; - } - break; + case 'n': LabelFileName = GetArg (&I, 3); break; + default: OptLibPath (Arg, GetArg (&I, 2)); break; + } + break; - case 'S': - OptStartAddr (Arg, GetArg (&I, 2)); - break; + case 'S': + OptStartAddr (Arg, GetArg (&I, 2)); + break; - case 'V': - OptVersion (Arg, 0); - break; + case 'V': + OptVersion (Arg, 0); + break; - default: - UnknownOption (Arg); - break; - } + default: + UnknownOption (Arg); + break; + } - } else { + } else { - /* A filename */ - LinkFile (Arg, FILETYPE_UNKNOWN); + /* A filename */ + LinkFile (Arg, FILETYPE_UNKNOWN); - } + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Check if we had any object files */ if (ObjFiles == 0) { - Error ("No object files to link"); + Error ("No object files to link"); } /* Check if we have a valid configuration */ if (!CfgAvail ()) { - Error ("Memory configuration missing"); + Error ("Memory configuration missing"); } /* Check if we have open library groups */ @@ -705,19 +705,19 @@ int main (int argc, char* argv []) /* If requested, create a map file and a label file for VICE */ if (MapFileName) { - CreateMapFile (LONG_MAPFILE); + CreateMapFile (LONG_MAPFILE); } if (LabelFileName) { - CreateLabelFile (); + CreateLabelFile (); } if (DbgFileName) { - CreateDbgFile (); + CreateDbgFile (); } /* Dump the data for debugging */ if (Verbosity > 1) { - SegDump (); - ConDesDump (); + SegDump (); + ConDesDump (); } /* Return an apropriate exit code */ diff --git a/src/ld65/mapfile.c b/src/ld65/mapfile.c index 6dc4ffb60..fa8d98efc 100644 --- a/src/ld65/mapfile.c +++ b/src/ld65/mapfile.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* mapfile.c */ +/* mapfile.c */ /* */ -/* Map file creation for the ld65 linker */ +/* Map file creation for the ld65 linker */ /* */ /* */ /* */ @@ -52,7 +52,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -67,12 +67,12 @@ void CreateMapFile (int ShortMap) /* Open the map file */ FILE* F = fopen (MapFileName, "w"); if (F == 0) { - Error ("Cannot create map file `%s': %s", MapFileName, strerror (errno)); + Error ("Cannot create map file `%s': %s", MapFileName, strerror (errno)); } /* Write a modules list */ fprintf (F, "Modules list:\n" - "-------------\n"); + "-------------\n"); for (I = 0; I < CollCount (&ObjDataList); ++I) { unsigned J; @@ -104,8 +104,8 @@ void CreateMapFile (int ShortMap) /* Write the segment list */ fprintf (F, "\n\n" - "Segment list:\n" - "-------------\n"); + "Segment list:\n" + "-------------\n"); PrintSegmentMap (F); /* The remainder is not written for short map files */ @@ -126,7 +126,7 @@ void CreateMapFile (int ShortMap) /* Close the file */ if (fclose (F) != 0) { - Error ("Error closing map file `%s': %s", MapFileName, strerror (errno)); + Error ("Error closing map file `%s': %s", MapFileName, strerror (errno)); } } @@ -138,7 +138,7 @@ void CreateLabelFile (void) /* Open the label file */ FILE* F = fopen (LabelFileName, "w"); if (F == 0) { - Error ("Cannot create label file `%s': %s", LabelFileName, strerror (errno)); + Error ("Cannot create label file `%s': %s", LabelFileName, strerror (errno)); } /* Print the labels for the export symbols */ @@ -149,7 +149,7 @@ void CreateLabelFile (void) /* Close the file */ if (fclose (F) != 0) { - Error ("Error closing label file `%s': %s", LabelFileName, strerror (errno)); + Error ("Error closing label file `%s': %s", LabelFileName, strerror (errno)); } } diff --git a/src/ld65/mapfile.h b/src/ld65/mapfile.h index f1016aca7..c2685e7aa 100644 --- a/src/ld65/mapfile.h +++ b/src/ld65/mapfile.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* mapfile.h */ +/* mapfile.h */ /* */ -/* Map file creation for the ld65 linker */ +/* Map file creation for the ld65 linker */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -53,7 +53,7 @@ enum { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/memarea.c b/src/ld65/memarea.c index 4dbf8b3f6..5b562b34a 100644 --- a/src/ld65/memarea.c +++ b/src/ld65/memarea.c @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/memarea.h b/src/ld65/memarea.h index 936edc3f7..4e051871c 100644 --- a/src/ld65/memarea.h +++ b/src/ld65/memarea.h @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -61,32 +61,32 @@ typedef struct MemoryArea MemoryArea; struct MemoryArea { LineInfo* LI; /* Where was the area was defined? */ unsigned Name; /* Name index of the memory area */ - unsigned Attr; /* Which values are valid? */ - unsigned Flags; /* Set of bitmapped flags */ + unsigned Attr; /* Which values are valid? */ + unsigned Flags; /* Set of bitmapped flags */ unsigned long FileOffs; /* Offset in output file */ struct ExprNode* StartExpr; /* Expression for start address */ - unsigned long Start; /* Start address */ + unsigned long Start; /* Start address */ struct ExprNode* SizeExpr; /* Expression for size */ - unsigned long Size; /* Length of memory section */ + unsigned long Size; /* Length of memory section */ struct ExprNode* BankExpr; /* Expression for bank */ - unsigned long FillLevel; /* Actual fill level of segment */ - unsigned char FillVal; /* Value used to fill rest of seg */ + unsigned long FillLevel; /* Actual fill level of segment */ + unsigned char FillVal; /* Value used to fill rest of seg */ unsigned char Relocatable; /* Memory area is relocatable */ - Collection SegList; /* List of segments for this area */ - struct File* F; /* Output file for this area */ + Collection SegList; /* List of segments for this area */ + struct File* F; /* Output file for this area */ }; /* Memory flags */ -#define MF_DEFINE 0x0001 /* Define start and size */ -#define MF_FILL 0x0002 /* Fill segment */ -#define MF_RO 0x0004 /* Read only memory area */ +#define MF_DEFINE 0x0001 /* Define start and size */ +#define MF_FILL 0x0002 /* Fill segment */ +#define MF_RO 0x0004 /* Read only memory area */ #define MF_OVERFLOW 0x0008 /* Memory area overflow */ #define MF_PLACED 0x0010 /* Memory area was placed */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/o65.c b/src/ld65/o65.c index 9bf722944..7373c23c7 100644 --- a/src/ld65/o65.c +++ b/src/ld65/o65.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* o65.c */ +/* o65.c */ /* */ -/* Module to handle the o65 binary format */ +/* Module to handle the o65 binary format */ /* */ /* */ /* */ @@ -61,13 +61,13 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Header mode bits */ -#define MF_CPU_65816 0x8000 /* Executable is for 65816 */ +#define MF_CPU_65816 0x8000 /* Executable is for 65816 */ #define MF_CPU_6502 0x0000 /* Executable is for the 6502 */ #define MF_CPU_MASK 0x8000 /* Mask to extract CPU type */ @@ -75,7 +75,7 @@ #define MF_RELOC_BYTE 0x0000 /* Byte wise relocation */ #define MF_RELOC_MASK 0x4000 /* Mask to extract relocation type */ -#define MF_SIZE_32BIT 0x2000 /* All size words are 32bit */ +#define MF_SIZE_32BIT 0x2000 /* All size words are 32bit */ #define MF_SIZE_16BIT 0x0000 /* All size words are 16bit */ #define MF_SIZE_MASK 0x2000 /* Mask to extract size */ @@ -91,102 +91,102 @@ #define MF_ALIGN_2 0x0001 /* Align words */ #define MF_ALIGN_4 0x0002 /* Align longwords */ #define MF_ALIGN_256 0x0003 /* Align pages (256 bytes) */ -#define MF_ALIGN_MASK 0x0003 /* Mask to extract alignment */ +#define MF_ALIGN_MASK 0x0003 /* Mask to extract alignment */ /* The four o65 segment types. Note: These values are identical to the values * needed for the segmentID in the o65 spec. */ -#define O65SEG_UNDEF 0x00 -#define O65SEG_ABS 0x01 -#define O65SEG_TEXT 0x02 -#define O65SEG_DATA 0x03 -#define O65SEG_BSS 0x04 -#define O65SEG_ZP 0x05 +#define O65SEG_UNDEF 0x00 +#define O65SEG_ABS 0x01 +#define O65SEG_TEXT 0x02 +#define O65SEG_DATA 0x03 +#define O65SEG_BSS 0x04 +#define O65SEG_ZP 0x05 /* Relocation type codes for the o65 format */ -#define O65RELOC_WORD 0x80 -#define O65RELOC_HIGH 0x40 -#define O65RELOC_LOW 0x20 -#define O65RELOC_SEGADR 0xC0 -#define O65RELOC_SEG 0xA0 +#define O65RELOC_WORD 0x80 +#define O65RELOC_HIGH 0x40 +#define O65RELOC_LOW 0x20 +#define O65RELOC_SEGADR 0xC0 +#define O65RELOC_SEG 0xA0 #define O65RELOC_MASK 0xE0 /* O65 executable file header */ typedef struct O65Header O65Header; struct O65Header { - unsigned Version; /* Version number for o65 format */ - unsigned Mode; /* Mode word */ - unsigned long TextBase; /* Base address of text segment */ - unsigned long TextSize; /* Size of text segment */ - unsigned long DataBase; /* Base of data segment */ - unsigned long DataSize; /* Size of data segment */ - unsigned long BssBase; /* Base of bss segment */ - unsigned long BssSize; /* Size of bss segment */ - unsigned long ZPBase; /* Base of zeropage segment */ - unsigned long ZPSize; /* Size of zeropage segment */ - unsigned long StackSize; /* Requested stack size */ + unsigned Version; /* Version number for o65 format */ + unsigned Mode; /* Mode word */ + unsigned long TextBase; /* Base address of text segment */ + unsigned long TextSize; /* Size of text segment */ + unsigned long DataBase; /* Base of data segment */ + unsigned long DataSize; /* Size of data segment */ + unsigned long BssBase; /* Base of bss segment */ + unsigned long BssSize; /* Size of bss segment */ + unsigned long ZPBase; /* Base of zeropage segment */ + unsigned long ZPSize; /* Size of zeropage segment */ + unsigned long StackSize; /* Requested stack size */ }; /* An o65 option */ typedef struct O65Option O65Option; struct O65Option { - O65Option* Next; /* Next in option list */ - unsigned char Type; /* Type of option */ - unsigned char Len; /* Data length */ - unsigned char Data [1]; /* Data, dynamically allocated */ + O65Option* Next; /* Next in option list */ + unsigned char Type; /* Type of option */ + unsigned char Len; /* Data length */ + unsigned char Data [1]; /* Data, dynamically allocated */ }; /* A o65 relocation table */ typedef struct O65RelocTab O65RelocTab; struct O65RelocTab { - unsigned Size; /* Size of the table */ - unsigned Fill; /* Amount used */ - unsigned char* Buf; /* Buffer, dynamically allocated */ + unsigned Size; /* Size of the table */ + unsigned Fill; /* Amount used */ + unsigned char* Buf; /* Buffer, dynamically allocated */ }; /* Structure describing the format */ struct O65Desc { - O65Header Header; /* File header */ - O65Option* Options; /* List of file options */ - ExtSymTab* Exports; /* Table with exported symbols */ - ExtSymTab* Imports; /* Table with imported symbols */ - unsigned Undef; /* Count of undefined symbols */ - FILE* F; /* The file we're writing to */ - const char* Filename; /* Name of the output file */ - O65RelocTab* TextReloc; /* Relocation table for text segment */ - O65RelocTab* DataReloc; /* Relocation table for data segment */ + O65Header Header; /* File header */ + O65Option* Options; /* List of file options */ + ExtSymTab* Exports; /* Table with exported symbols */ + ExtSymTab* Imports; /* Table with imported symbols */ + unsigned Undef; /* Count of undefined symbols */ + FILE* F; /* The file we're writing to */ + const char* Filename; /* Name of the output file */ + O65RelocTab* TextReloc; /* Relocation table for text segment */ + O65RelocTab* DataReloc; /* Relocation table for data segment */ - unsigned TextCount; /* Number of segments assigned to .text */ - SegDesc** TextSeg; /* Array of text segments */ - unsigned DataCount; /* Number of segments assigned to .data */ - SegDesc** DataSeg; /* Array of data segments */ - unsigned BssCount; /* Number of segments assigned to .bss */ - SegDesc** BssSeg; /* Array of bss segments */ - unsigned ZPCount; /* Number of segments assigned to .zp */ - SegDesc** ZPSeg; /* Array of zp segments */ + unsigned TextCount; /* Number of segments assigned to .text */ + SegDesc** TextSeg; /* Array of text segments */ + unsigned DataCount; /* Number of segments assigned to .data */ + SegDesc** DataSeg; /* Array of data segments */ + unsigned BssCount; /* Number of segments assigned to .bss */ + SegDesc** BssSeg; /* Array of bss segments */ + unsigned ZPCount; /* Number of segments assigned to .zp */ + SegDesc** ZPSeg; /* Array of zp segments */ /* Temporary data for writing segments */ unsigned long SegSize; O65RelocTab* CurReloc; - long LastOffs; + long LastOffs; }; /* Structure for parsing expression trees */ typedef struct ExprDesc ExprDesc; struct ExprDesc { - O65Desc* D; /* File format descriptor */ - long Val; /* The offset value */ - int TooComplex; /* Expression too complex */ + O65Desc* D; /* File format descriptor */ + long Val; /* The offset value */ + int TooComplex; /* Expression too complex */ MemoryArea* MemRef; /* Memory reference if any */ Segment* SegRef; /* Segment reference if any */ - Section* SecRef; /* Section reference if any */ - ExtSym* ExtRef; /* External reference if any */ + Section* SecRef; /* Section reference if any */ + ExtSym* ExtRef; /* External reference if any */ }; /*****************************************************************************/ -/* Helper functions */ +/* Helper functions */ /*****************************************************************************/ @@ -194,8 +194,8 @@ struct ExprDesc { static ExprDesc* InitExprDesc (ExprDesc* ED, O65Desc* D) /* Initialize an ExprDesc structure for use with O65ParseExpr */ { - ED->D = D; - ED->Val = 0; + ED->D = D; + ED->Val = 0; ED->TooComplex = 0; ED->MemRef = 0; ED->SegRef = 0; @@ -210,9 +210,9 @@ static void WriteSize (const O65Desc* D, unsigned long Val) /* Write a "size" word to the file */ { switch (D->Header.Mode & MF_SIZE_MASK) { - case MF_SIZE_16BIT: Write16 (D->F, (unsigned) Val); break; - case MF_SIZE_32BIT: Write32 (D->F, Val); break; - default: Internal ("Invalid size in header: %04X", D->Header.Mode); + case MF_SIZE_16BIT: Write16 (D->F, (unsigned) Val); break; + case MF_SIZE_32BIT: Write32 (D->F, Val); break; + default: Internal ("Invalid size in header: %04X", D->Header.Mode); } } @@ -228,13 +228,13 @@ static unsigned O65SegType (const SegDesc* S) * to check SF_ZP first. */ if (S->Flags & SF_RO) { - return O65SEG_TEXT; + return O65SEG_TEXT; } else if (S->Flags & SF_ZP) { - return O65SEG_ZP; + return O65SEG_ZP; } else if (S->Flags & SF_BSS) { - return O65SEG_BSS; + return O65SEG_BSS; } else { - return O65SEG_DATA; + return O65SEG_DATA; } } @@ -257,7 +257,7 @@ static void CvtMemoryToSegment (ExprDesc* ED) for (I = 0; I < CollCount (&M->SegList); ++I) { /* Get the segment and check if it's a run segment */ - SegDesc* S = CollAtUnchecked (&M->SegList, I); + SegDesc* S = CollAtUnchecked (&M->SegList, I); if (S->Run == M) { unsigned long O; @@ -297,10 +297,10 @@ static const SegDesc* FindSeg (SegDesc** const List, unsigned Count, const Segme unsigned I; for (I = 0; I < Count; ++I) { - if (List[I]->Seg == S) { - /* Found */ - return List[I]; - } + if (List[I]->Seg == S) { + /* Found */ + return List[I]; + } } /* Not found */ @@ -315,16 +315,16 @@ static const SegDesc* O65FindSeg (const O65Desc* D, const Segment* S) const SegDesc* SD; if ((SD = FindSeg (D->TextSeg, D->TextCount, S)) != 0) { - return SD; + return SD; } if ((SD = FindSeg (D->DataSeg, D->DataCount, S)) != 0) { - return SD; + return SD; } if ((SD = FindSeg (D->BssSeg, D->BssCount, S)) != 0) { - return SD; + return SD; } if ((SD = FindSeg (D->ZPSeg, D->ZPCount, S)) != 0) { - return SD; + return SD; } /* Not found */ @@ -334,7 +334,7 @@ static const SegDesc* O65FindSeg (const O65Desc* D, const Segment* S) /*****************************************************************************/ -/* Expression handling */ +/* Expression handling */ /*****************************************************************************/ @@ -349,89 +349,89 @@ static void O65ParseExpr (ExprNode* Expr, ExprDesc* D, int Sign) switch (Expr->Op) { - case EXPR_LITERAL: + case EXPR_LITERAL: D->Val += (Sign * Expr->V.IVal); - break; + break; - case EXPR_SYMBOL: - /* Get the referenced Export */ - E = GetExprExport (Expr); - /* If this export has a mark set, we've already encountered it. - * This means that the export is used to define it's own value, - * which in turn means, that we have a circular reference. - */ - if (ExportHasMark (E)) { - CircularRefError (E); - } else if (E->Expr == 0) { - /* Dummy export, must be an o65 imported symbol */ - ExtSym* S = O65GetImport (D->D, E->Name); - CHECK (S != 0); - if (D->ExtRef) { - /* We cannot have more than one external reference in o65 */ - D->TooComplex = 1; - } else { - /* Remember the external reference */ - D->ExtRef = S; - } - } else { - MarkExport (E); - O65ParseExpr (E->Expr, D, Sign); - UnmarkExport (E); - } - break; + case EXPR_SYMBOL: + /* Get the referenced Export */ + E = GetExprExport (Expr); + /* If this export has a mark set, we've already encountered it. + * This means that the export is used to define it's own value, + * which in turn means, that we have a circular reference. + */ + if (ExportHasMark (E)) { + CircularRefError (E); + } else if (E->Expr == 0) { + /* Dummy export, must be an o65 imported symbol */ + ExtSym* S = O65GetImport (D->D, E->Name); + CHECK (S != 0); + if (D->ExtRef) { + /* We cannot have more than one external reference in o65 */ + D->TooComplex = 1; + } else { + /* Remember the external reference */ + D->ExtRef = S; + } + } else { + MarkExport (E); + O65ParseExpr (E->Expr, D, Sign); + UnmarkExport (E); + } + break; - case EXPR_SECTION: - if (D->SecRef) { - /* We cannot handle more than one segment reference in o65 */ - D->TooComplex = 1; - } else { - /* Remember the segment reference */ - D->SecRef = GetExprSection (Expr); + case EXPR_SECTION: + if (D->SecRef) { + /* We cannot handle more than one segment reference in o65 */ + D->TooComplex = 1; + } else { + /* Remember the segment reference */ + D->SecRef = GetExprSection (Expr); /* Add the offset of the section to the constant value */ D->Val += Sign * (D->SecRef->Offs + D->SecRef->Seg->PC); - } - break; + } + break; case EXPR_SEGMENT: - if (D->SegRef) { - /* We cannot handle more than one segment reference in o65 */ - D->TooComplex = 1; - } else { - /* Remember the segment reference */ - D->SegRef = Expr->V.Seg; + if (D->SegRef) { + /* We cannot handle more than one segment reference in o65 */ + D->TooComplex = 1; + } else { + /* Remember the segment reference */ + D->SegRef = Expr->V.Seg; /* Add the offset of the segment to the constant value */ D->Val += (Sign * D->SegRef->PC); - } - break; + } + break; case EXPR_MEMAREA: - if (D->MemRef) { - /* We cannot handle more than one memory reference in o65 */ - D->TooComplex = 1; - } else { - /* Remember the memory area reference */ - D->MemRef = Expr->V.Mem; + if (D->MemRef) { + /* We cannot handle more than one memory reference in o65 */ + D->TooComplex = 1; + } else { + /* Remember the memory area reference */ + D->MemRef = Expr->V.Mem; /* Add the start address of the memory area to the constant * value */ D->Val += (Sign * D->MemRef->Start); - } - break; + } + break; - case EXPR_PLUS: - O65ParseExpr (Expr->Left, D, Sign); - O65ParseExpr (Expr->Right, D, Sign); - break; + case EXPR_PLUS: + O65ParseExpr (Expr->Left, D, Sign); + O65ParseExpr (Expr->Right, D, Sign); + break; - case EXPR_MINUS: - O65ParseExpr (Expr->Left, D, Sign); - O65ParseExpr (Expr->Right, D, -Sign); - break; + case EXPR_MINUS: + O65ParseExpr (Expr->Left, D, Sign); + O65ParseExpr (Expr->Right, D, -Sign); + break; - default: - /* Expression contains illegal operators */ - D->TooComplex = 1; - break; + default: + /* Expression contains illegal operators */ + D->TooComplex = 1; + break; } } @@ -439,7 +439,7 @@ static void O65ParseExpr (ExprNode* Expr, ExprDesc* D, int Sign) /*****************************************************************************/ -/* Relocation tables */ +/* Relocation tables */ /*****************************************************************************/ @@ -475,7 +475,7 @@ static void O65RelocPutByte (O65RelocTab* R, unsigned B) { /* Do we have enough space in the buffer? */ if (R->Fill == R->Size) { - /* We need to grow the buffer */ + /* We need to grow the buffer */ if (R->Size) { R->Size *= 2; } else { @@ -508,7 +508,7 @@ static void O65WriteReloc (O65RelocTab* R, FILE* F) /*****************************************************************************/ -/* Option handling */ +/* Option handling */ /*****************************************************************************/ @@ -525,9 +525,9 @@ static O65Option* NewO65Option (unsigned Type, const void* Data, unsigned DataLe O = xmalloc (sizeof (O65Option) - 1 + DataLen); /* Initialize the structure */ - O->Next = 0; - O->Type = Type; - O->Len = DataLen; + O->Next = 0; + O->Type = Type; + O->Len = DataLen; memcpy (O->Data, Data, DataLen); /* Return the created struct */ @@ -537,7 +537,7 @@ static O65Option* NewO65Option (unsigned Type, const void* Data, unsigned DataLe static void FreeO65Option (O65Option* O) -/* Free an O65Option struct */ +/* Free an O65Option struct */ { xfree (O); } @@ -545,7 +545,7 @@ static void FreeO65Option (O65Option* O) /*****************************************************************************/ -/* Subroutines to write o65 sections */ +/* Subroutines to write o65 sections */ /*****************************************************************************/ @@ -554,7 +554,7 @@ static void O65WriteHeader (O65Desc* D) /* Write the header of the executable to the given file */ { static unsigned char Trailer [5] = { - 0x01, 0x00, 0x6F, 0x36, 0x35 + 0x01, 0x00, 0x6F, 0x36, 0x35 }; O65Option* O; @@ -576,12 +576,12 @@ static void O65WriteHeader (O65Desc* D) /* Write the options */ O = D->Options; while (O) { - Write8 (D->F, O->Len + 2); /* Account for len and type bytes */ - Write8 (D->F, O->Type); - if (O->Len) { - WriteData (D->F, O->Data, O->Len); - } - O = O->Next; + Write8 (D->F, O->Len + 2); /* Account for len and type bytes */ + Write8 (D->F, O->Type); + if (O->Len) { + WriteData (D->F, O->Data, O->Len); + } + O = O->Next; } /* Write the end-of-options byte */ @@ -591,7 +591,7 @@ static void O65WriteHeader (O65Desc* D) static unsigned O65WriteExpr (ExprNode* E, int Signed, unsigned Size, - unsigned long Offs, void* Data) + unsigned long Offs, void* Data) /* Called from SegWrite for an expression. Evaluate the expression, check the * range and write the expression value to the file, update the relocation * table. @@ -609,19 +609,19 @@ static unsigned O65WriteExpr (ExprNode* E, int Signed, unsigned Size, /* Check for a constant expression */ if (IsConstExpr (E)) { - /* Write out the constant expression */ - return SegWriteConstExpr (((O65Desc*)Data)->F, E, Signed, Size); + /* Write out the constant expression */ + return SegWriteConstExpr (((O65Desc*)Data)->F, E, Signed, Size); } /* We have a relocatable expression that needs a relocation table entry. * Calculate the number of bytes between this entry and the last one, and * setup all necessary intermediate bytes in the relocation table. */ - Offs += D->SegSize; /* Calulate full offset */ + Offs += D->SegSize; /* Calulate full offset */ Diff = ((long) Offs) - D->LastOffs; while (Diff > 0xFE) { - O65RelocPutByte (D->CurReloc, 0xFF); - Diff -= 0xFE; + O65RelocPutByte (D->CurReloc, 0xFF); + Diff -= 0xFE; } O65RelocPutByte (D->CurReloc, (unsigned char) Diff); @@ -631,11 +631,11 @@ static unsigned O65WriteExpr (ExprNode* E, int Signed, unsigned Size, /* Determine the expression to relocate */ Expr = E; if (E->Op == EXPR_BYTE0 || E->Op == EXPR_BYTE1 || - E->Op == EXPR_BYTE2 || E->Op == EXPR_BYTE3 || - E->Op == EXPR_WORD0 || E->Op == EXPR_WORD1 || + E->Op == EXPR_BYTE2 || E->Op == EXPR_BYTE3 || + E->Op == EXPR_WORD0 || E->Op == EXPR_WORD1 || E->Op == EXPR_FARADDR || E->Op == EXPR_DWORD) { - /* Use the real expression */ - Expr = E->Left; + /* Use the real expression */ + Expr = E->Left; } /* Recursively collect information about this expression */ @@ -645,7 +645,7 @@ static unsigned O65WriteExpr (ExprNode* E, int Signed, unsigned Size, RefCount = (ED.MemRef != 0) + (ED.SegRef != 0) + (ED.SecRef != 0) + (ED.ExtRef != 0); if (RefCount > 1) { - ED.TooComplex = 1; + ED.TooComplex = 1; } /* If we have a memory area reference, we need to convert it into a @@ -661,7 +661,7 @@ static unsigned O65WriteExpr (ExprNode* E, int Signed, unsigned Size, /* Bail out if we cannot handle the expression */ if (ED.TooComplex) { - return SEG_EXPR_TOO_COMPLEX; + return SEG_EXPR_TOO_COMPLEX; } /* Safety: Check that we have exactly one reference */ @@ -670,12 +670,12 @@ static unsigned O65WriteExpr (ExprNode* E, int Signed, unsigned Size, /* Write out the offset that goes into the segment. */ BinVal = ED.Val; switch (E->Op) { - case EXPR_BYTE0: BinVal &= 0xFF; break; - case EXPR_BYTE1: BinVal = (BinVal >> 8) & 0xFF; break; - case EXPR_BYTE2: BinVal = (BinVal >> 16) & 0xFF; break; - case EXPR_BYTE3: BinVal = (BinVal >> 24) & 0xFF; break; - case EXPR_WORD0: BinVal &= 0xFFFF; break; - case EXPR_WORD1: BinVal = (BinVal >> 16) & 0xFFFF; break; + case EXPR_BYTE0: BinVal &= 0xFF; break; + case EXPR_BYTE1: BinVal = (BinVal >> 8) & 0xFF; break; + case EXPR_BYTE2: BinVal = (BinVal >> 16) & 0xFF; break; + case EXPR_BYTE3: BinVal = (BinVal >> 24) & 0xFF; break; + case EXPR_WORD0: BinVal &= 0xFFFF; break; + case EXPR_WORD1: BinVal = (BinVal >> 16) & 0xFFFF; break; case EXPR_FARADDR: BinVal &= 0xFFFFFFUL; break; case EXPR_DWORD: BinVal &= 0xFFFFFFFFUL; break; } @@ -685,34 +685,34 @@ static unsigned O65WriteExpr (ExprNode* E, int Signed, unsigned Size, * information gathered about the expression. */ if (E->Op == EXPR_BYTE0) { - RelocType = O65RELOC_LOW; + RelocType = O65RELOC_LOW; } else if (E->Op == EXPR_BYTE1) { - RelocType = O65RELOC_HIGH; + RelocType = O65RELOC_HIGH; } else if (E->Op == EXPR_BYTE2) { - RelocType = O65RELOC_SEG; + RelocType = O65RELOC_SEG; } else { - switch (Size) { + switch (Size) { - case 1: - RelocType = O65RELOC_LOW; - break; + case 1: + RelocType = O65RELOC_LOW; + break; - case 2: - RelocType = O65RELOC_WORD; - break; + case 2: + RelocType = O65RELOC_WORD; + break; - case 3: - RelocType = O65RELOC_SEGADR; - break; + case 3: + RelocType = O65RELOC_SEGADR; + break; - case 4: - /* 4 byte expression not supported by o65 */ - return SEG_EXPR_TOO_COMPLEX; + case 4: + /* 4 byte expression not supported by o65 */ + return SEG_EXPR_TOO_COMPLEX; - default: - Internal ("O65WriteExpr: Invalid expression size: %u", Size); - RelocType = 0; /* Avoid gcc warnings */ - } + default: + Internal ("O65WriteExpr: Invalid expression size: %u", Size); + RelocType = 0; /* Avoid gcc warnings */ + } } /* Determine which segment we're referencing */ @@ -726,33 +726,33 @@ static unsigned O65WriteExpr (ExprNode* E, int Signed, unsigned Size, ED.SegRef = ED.SecRef->Seg; } - /* Search for the segment and map it to it's o65 segmentID */ - Seg = O65FindSeg (D, ED.SegRef); - if (Seg == 0) { - /* For some reason, we didn't find this segment in the list of - * segments written to the o65 file. - */ - return SEG_EXPR_INVALID; - } - RelocType |= O65SegType (Seg); - O65RelocPutByte (D->CurReloc, RelocType); + /* Search for the segment and map it to it's o65 segmentID */ + Seg = O65FindSeg (D, ED.SegRef); + if (Seg == 0) { + /* For some reason, we didn't find this segment in the list of + * segments written to the o65 file. + */ + return SEG_EXPR_INVALID; + } + RelocType |= O65SegType (Seg); + O65RelocPutByte (D->CurReloc, RelocType); - /* Output additional data if needed */ - switch (RelocType & O65RELOC_MASK) { - case O65RELOC_HIGH: - O65RelocPutByte (D->CurReloc, ED.Val & 0xFF); - break; - case O65RELOC_SEG: - O65RelocPutWord (D->CurReloc, ED.Val & 0xFFFF); - break; - } + /* Output additional data if needed */ + switch (RelocType & O65RELOC_MASK) { + case O65RELOC_HIGH: + O65RelocPutByte (D->CurReloc, ED.Val & 0xFF); + break; + case O65RELOC_SEG: + O65RelocPutWord (D->CurReloc, ED.Val & 0xFFFF); + break; + } } else if (ED.ExtRef) { - /* Imported symbol */ - RelocType |= O65SEG_UNDEF; - O65RelocPutByte (D->CurReloc, RelocType); - /* Put the number of the imported symbol into the table */ - O65RelocPutWord (D->CurReloc, ExtSymNum (ED.ExtRef)); + /* Imported symbol */ + RelocType |= O65SEG_UNDEF; + O65RelocPutByte (D->CurReloc, RelocType); + /* Put the number of the imported symbol into the table */ + O65RelocPutWord (D->CurReloc, ExtSymNum (ED.ExtRef)); } else { @@ -780,22 +780,22 @@ static void O65WriteSeg (O65Desc* D, SegDesc** Seg, unsigned Count, int DoWrite) /* Write out all segments */ for (I = 0; I < Count; ++I) { - /* Get the segment from the list node */ - S = Seg [I]; + /* Get the segment from the list node */ + S = Seg [I]; - /* Keep the user happy */ - Print (stdout, 1, " Writing `%s'\n", GetString (S->Name)); + /* Keep the user happy */ + Print (stdout, 1, " Writing `%s'\n", GetString (S->Name)); - /* Write this segment */ - if (DoWrite) { - SegWrite (D->Filename, D->F, S->Seg, O65WriteExpr, D); - } + /* Write this segment */ + if (DoWrite) { + SegWrite (D->Filename, D->F, S->Seg, O65WriteExpr, D); + } - /* Mark the segment as dumped */ - S->Seg->Dumped = 1; + /* Mark the segment as dumped */ + S->Seg->Dumped = 1; - /* Calculate the total size */ - D->SegSize += S->Seg->Size; + /* Calculate the total size */ + D->SegSize += S->Seg->Size; } /* Terminate the relocation table for this segment */ @@ -805,7 +805,7 @@ static void O65WriteSeg (O65Desc* D, SegDesc** Seg, unsigned Count, int DoWrite) /* Check the size of the segment for overflow */ if ((D->Header.Mode & MF_SIZE_MASK) == MF_SIZE_16BIT && D->SegSize > 0xFFFF) { - Error ("Segment overflow in file `%s'", D->Filename); + Error ("Segment overflow in file `%s'", D->Filename); } } @@ -816,7 +816,7 @@ static void O65WriteTextSeg (O65Desc* D) /* Write the code segment to the o65 output file */ { /* Initialize variables */ - D->CurReloc = D->TextReloc; + D->CurReloc = D->TextReloc; /* Dump all text segments */ O65WriteSeg (D, D->TextSeg, D->TextCount, 1); @@ -831,7 +831,7 @@ static void O65WriteDataSeg (O65Desc* D) /* Write the data segment to the o65 output file */ { /* Initialize variables */ - D->CurReloc = D->DataReloc; + D->CurReloc = D->DataReloc; /* Dump all data segments */ O65WriteSeg (D, D->DataSeg, D->DataCount, 1); @@ -848,7 +848,7 @@ static void O65WriteBssSeg (O65Desc* D) */ { /* Initialize variables */ - D->CurReloc = 0; + D->CurReloc = 0; /* Dump all bss segments */ O65WriteSeg (D, D->BssSeg, D->BssCount, 0); @@ -865,7 +865,7 @@ static void O65WriteZPSeg (O65Desc* D) */ { /* Initialize variables */ - D->CurReloc = 0; + D->CurReloc = 0; /* Dump all zp segments */ O65WriteSeg (D, D->ZPSeg, D->ZPCount, 0); @@ -887,12 +887,12 @@ static void O65WriteImports (O65Desc* D) /* Write out the symbol names, zero terminated */ S = ExtSymList (D->Imports); while (S) { - /* Get the name */ - const char* Name = GetString (ExtSymName (S)); - /* And write it to the output file */ - WriteData (D->F, Name, strlen (Name) + 1); - /* Next symbol */ - S = ExtSymNext (S); + /* Get the name */ + const char* Name = GetString (ExtSymName (S)); + /* And write it to the output file */ + WriteData (D->F, Name, strlen (Name) + 1); + /* Next symbol */ + S = ExtSymNext (S); } } @@ -926,42 +926,42 @@ static void O65WriteExports (O65Desc* D) S = ExtSymList (D->Exports); while (S) { - ExprNode* Expr; - unsigned char SegmentID; - ExprDesc ED; + ExprNode* Expr; + unsigned char SegmentID; + ExprDesc ED; - /* Get the name */ - unsigned NameIdx = ExtSymName (S); + /* Get the name */ + unsigned NameIdx = ExtSymName (S); const char* Name = GetString (NameIdx); - /* Get the export for this symbol. We've checked before that this - * export does really exist, so if it is unresolved, or if we don't - * find it, there is an error in the linker code. - */ - Export* E = FindExport (NameIdx); - if (E == 0 || IsUnresolvedExport (E)) { - Internal ("Unresolved export `%s' found in O65WriteExports", Name); - } + /* Get the export for this symbol. We've checked before that this + * export does really exist, so if it is unresolved, or if we don't + * find it, there is an error in the linker code. + */ + Export* E = FindExport (NameIdx); + if (E == 0 || IsUnresolvedExport (E)) { + Internal ("Unresolved export `%s' found in O65WriteExports", Name); + } - /* Get the expression for the symbol */ - Expr = E->Expr; + /* Get the expression for the symbol */ + Expr = E->Expr; - /* Recursively collect information about this expression */ - O65ParseExpr (Expr, InitExprDesc (&ED, D), 1); + /* Recursively collect information about this expression */ + O65ParseExpr (Expr, InitExprDesc (&ED, D), 1); - /* We cannot handle expressions with imported symbols, or expressions + /* We cannot handle expressions with imported symbols, or expressions * with more than one segment reference here */ - if (ED.ExtRef != 0 || (ED.SegRef != 0 && ED.SecRef != 0)) { - ED.TooComplex = 1; - } + if (ED.ExtRef != 0 || (ED.SegRef != 0 && ED.SecRef != 0)) { + ED.TooComplex = 1; + } - /* Bail out if we cannot handle the expression */ - if (ED.TooComplex) { - Error ("Expression for symbol `%s' is too complex", Name); - } + /* Bail out if we cannot handle the expression */ + if (ED.TooComplex) { + Error ("Expression for symbol `%s' is too complex", Name); + } - /* Determine the segment id for the expression */ + /* Determine the segment id for the expression */ if (ED.SegRef != 0 || ED.SecRef != 0) { const SegDesc* Seg; @@ -971,39 +971,39 @@ static void O65WriteExports (O65Desc* D) ED.SegRef = ED.SecRef->Seg; /* Get segment from section */ } - /* Search for the segment and map it to it's o65 segmentID */ - Seg = O65FindSeg (D, ED.SegRef); - if (Seg == 0) { - /* For some reason, we didn't find this segment in the list of - * segments written to the o65 file. - */ - Error ("Segment for symbol `%s' is undefined", Name); - } - SegmentID = O65SegType (Seg); + /* Search for the segment and map it to it's o65 segmentID */ + Seg = O65FindSeg (D, ED.SegRef); + if (Seg == 0) { + /* For some reason, we didn't find this segment in the list of + * segments written to the o65 file. + */ + Error ("Segment for symbol `%s' is undefined", Name); + } + SegmentID = O65SegType (Seg); } else { - /* Absolute value */ - SegmentID = O65SEG_ABS; + /* Absolute value */ + SegmentID = O65SEG_ABS; - } + } - /* Write the name to the output file */ - WriteData (D->F, Name, strlen (Name) + 1); + /* Write the name to the output file */ + WriteData (D->F, Name, strlen (Name) + 1); - /* Output the segment id followed by the literal value */ - Write8 (D->F, SegmentID); - WriteSize (D, ED.Val); + /* Output the segment id followed by the literal value */ + Write8 (D->F, SegmentID); + WriteSize (D, ED.Val); - /* Next symbol */ - S = ExtSymNext (S); + /* Next symbol */ + S = ExtSymNext (S); } } /*****************************************************************************/ -/* Public code */ +/* Public code */ /*****************************************************************************/ @@ -1015,9 +1015,9 @@ O65Desc* NewO65Desc (void) O65Desc* D = xmalloc (sizeof (O65Desc)); /* Initialize the header */ - D->Header.Version = 0; + D->Header.Version = 0; D->Header.Mode = 0; - D->Header.TextBase = 0; + D->Header.TextBase = 0; D->Header.TextSize = 0; D->Header.DataBase = 0; D->Header.DataSize = 0; @@ -1025,25 +1025,25 @@ O65Desc* NewO65Desc (void) D->Header.BssSize = 0; D->Header.ZPBase = 0; D->Header.ZPSize = 0; - D->Header.StackSize = 0; /* Let OS choose a good value */ + D->Header.StackSize = 0; /* Let OS choose a good value */ /* Initialize other data */ - D->Options = 0; - D->Exports = NewExtSymTab (); - D->Imports = NewExtSymTab (); - D->Undef = 0; - D->F = 0; - D->Filename = 0; - D->TextReloc = NewO65RelocTab (); - D->DataReloc = NewO65RelocTab (); - D->TextCount = 0; - D->TextSeg = 0; - D->DataCount = 0; - D->DataSeg = 0; - D->BssCount = 0; - D->BssSeg = 0; - D->ZPCount = 0; - D->ZPSeg = 0; + D->Options = 0; + D->Exports = NewExtSymTab (); + D->Imports = NewExtSymTab (); + D->Undef = 0; + D->F = 0; + D->Filename = 0; + D->TextReloc = NewO65RelocTab (); + D->DataReloc = NewO65RelocTab (); + D->TextCount = 0; + D->TextSeg = 0; + D->DataCount = 0; + D->DataSeg = 0; + D->BssCount = 0; + D->BssSeg = 0; + D->ZPCount = 0; + D->ZPSeg = 0; /* Return the created struct */ return D; @@ -1067,8 +1067,8 @@ void FreeO65Desc (O65Desc* D) /* Free the option list */ while (D->Options) { O65Option* O = D->Options; - D->Options = D->Options->Next; - FreeO65Option (O); + D->Options = D->Options->Next; + FreeO65Option (O); } /* Free the external symbol tables */ @@ -1121,9 +1121,9 @@ void O65SetAlignment (O65Desc* D, unsigned Alignment) /* Set the alignment bits */ switch (Alignment) { - case 1: D->Header.Mode |= MF_ALIGN_1; break; - case 2: D->Header.Mode |= MF_ALIGN_2; break; - case 4: D->Header.Mode |= MF_ALIGN_4; break; + case 1: D->Header.Mode |= MF_ALIGN_1; break; + case 2: D->Header.Mode |= MF_ALIGN_2; break; + case 4: D->Header.Mode |= MF_ALIGN_4; break; case 256: D->Header.Mode |= MF_ALIGN_256; break; default: Error ("Invalid alignment for O65 format: %u", Alignment); } @@ -1155,17 +1155,17 @@ void O65SetOS (O65Desc* D, unsigned OS, unsigned Version, unsigned Id) /* Write the correct option length */ switch (OS) { - case O65OS_CC65: + case O65OS_CC65: /* Set the 16 bit id */ Opt[2] = (unsigned char) Id; Opt[3] = (unsigned char) (Id >> 8); - O65SetOption (D, O65OPT_OS, Opt, 4); - break; + O65SetOption (D, O65OPT_OS, Opt, 4); + break; - default: + default: /* No id for OS/A65, Lunix, and unknown OSes */ - O65SetOption (D, O65OPT_OS, Opt, 2); - break; + O65SetOption (D, O65OPT_OS, Opt, 2); + break; } } @@ -1207,7 +1207,7 @@ void O65SetExport (O65Desc* D, unsigned Ident) */ Export* E = FindExport (Ident); if (E == 0 || IsUnresolvedExport (E)) { - Error ("Unresolved export: `%s'", GetString (Ident)); + Error ("Unresolved export: `%s'", GetString (Ident)); } /* Insert the entry into the table */ @@ -1245,8 +1245,8 @@ static void O65SetupSegments (O65Desc* D, File* F) case O65SEG_TEXT: D->TextCount++; break; case O65SEG_DATA: D->DataCount++; break; case O65SEG_BSS: D->BssCount++; break; - case O65SEG_ZP: D->ZPCount++; break; - default: Internal ("Invalid return from O65SegType"); + case O65SEG_ZP: D->ZPCount++; break; + default: Internal ("Invalid return from O65SegType"); } } } @@ -1272,11 +1272,11 @@ static void O65SetupSegments (O65Desc* D, File* F) /* Check the segment type. */ switch (O65SegType (S)) { - case O65SEG_TEXT: D->TextSeg [TextIdx++] = S; break; - case O65SEG_DATA: D->DataSeg [DataIdx++] = S; break; + case O65SEG_TEXT: D->TextSeg [TextIdx++] = S; break; + case O65SEG_DATA: D->DataSeg [DataIdx++] = S; break; case O65SEG_BSS: D->BssSeg [BssIdx++] = S; break; - case O65SEG_ZP: D->ZPSeg [ZPIdx++] = S; break; - default: Internal ("Invalid return from O65SegType"); + case O65SEG_ZP: D->ZPSeg [ZPIdx++] = S; break; + default: Internal ("Invalid return from O65SegType"); } } } @@ -1289,12 +1289,12 @@ static int O65Unresolved (unsigned Name, void* D) { /* Check if the symbol is an imported o65 symbol */ if (O65GetImport (D, Name) != 0) { - /* This is an external symbol, relax... */ - return 1; + /* This is an external symbol, relax... */ + return 1; } else { - /* This is actually an unresolved external. Bump the counter */ - ((O65Desc*) D)->Undef++; - return 0; + /* This is actually an unresolved external. Bump the counter */ + ((O65Desc*) D)->Undef++; + return 0; } } @@ -1335,7 +1335,7 @@ static void O65SetupHeader (O65Desc* D) void O65WriteTarget (O65Desc* D, File* F) /* Write an o65 output file */ { - char OptBuf [256]; /* Buffer for option strings */ + char OptBuf [256]; /* Buffer for option strings */ unsigned OptLen; time_t T; const char* Name; @@ -1346,11 +1346,11 @@ void O65WriteTarget (O65Desc* D, File* F) /* Check for unresolved symbols. The function O65Unresolved is called * if we get an unresolved symbol. */ - D->Undef = 0; /* Reset the counter */ + D->Undef = 0; /* Reset the counter */ CheckUnresolvedImports (O65Unresolved, D); if (D->Undef > 0) { - /* We had unresolved symbols, cannot create output file */ - Error ("%u unresolved external(s) found - cannot create output file", D->Undef); + /* We had unresolved symbols, cannot create output file */ + Error ("%u unresolved external(s) found - cannot create output file", D->Undef); } /* Setup the segment arrays */ @@ -1362,7 +1362,7 @@ void O65WriteTarget (O65Desc* D, File* F) /* Open the file */ D->F = fopen (D->Filename, "wb"); if (D->F == 0) { - Error ("Cannot open `%s': %s", D->Filename, strerror (errno)); + Error ("Cannot open `%s': %s", D->Filename, strerror (errno)); } /* Keep the user happy */ @@ -1417,7 +1417,7 @@ void O65WriteTarget (O65Desc* D, File* F) /* Close the file */ if (fclose (D->F) != 0) { - Error ("Cannot write to `%s': %s", D->Filename, strerror (errno)); + Error ("Cannot write to `%s': %s", D->Filename, strerror (errno)); } /* Reset the file and filename */ diff --git a/src/ld65/o65.h b/src/ld65/o65.h index aec220a3c..7de0832a8 100644 --- a/src/ld65/o65.h +++ b/src/ld65/o65.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* o65.h */ +/* o65.h */ /* */ -/* Module to handle the o65 binary format */ +/* Module to handle the o65 binary format */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -55,16 +55,16 @@ typedef struct O65Desc O65Desc; /* Option tags */ -#define O65OPT_FILENAME 0 -#define O65OPT_OS 1 -#define O65OPT_ASM 2 -#define O65OPT_AUTHOR 3 -#define O65OPT_TIMESTAMP 4 +#define O65OPT_FILENAME 0 +#define O65OPT_OS 1 +#define O65OPT_ASM 2 +#define O65OPT_AUTHOR 3 +#define O65OPT_TIMESTAMP 4 /* Operating system codes for O65OPT_OS */ #define O65OS_MIN 1 -#define O65OS_OSA65 1 -#define O65OS_LUNIX 2 +#define O65OS_OSA65 1 +#define O65OS_LUNIX 2 #define O65OS_CC65 3 #define O65OS_OPENCBM 4 #define O65OS_MAX 255 @@ -72,7 +72,7 @@ typedef struct O65Desc O65Desc; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/objdata.c b/src/ld65/objdata.c index 2a7a0ac1d..1bdef6bd7 100644 --- a/src/ld65/objdata.c +++ b/src/ld65/objdata.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objdata.c */ +/* objdata.c */ /* */ -/* Handling object file data for the ld65 linker */ +/* Handling object file data for the ld65 linker */ /* */ /* */ /* */ @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -61,7 +61,7 @@ Collection ObjDataList = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -73,21 +73,21 @@ ObjData* NewObjData (void) ObjData* O = xmalloc (sizeof (ObjData)); /* Initialize the data */ - O->Next = 0; - O->Name = INVALID_STRING_ID; + O->Next = 0; + O->Name = INVALID_STRING_ID; O->Lib = 0; O->MTime = 0; - O->Start = 0; - O->Flags = 0; + O->Start = 0; + O->Flags = 0; O->HLLSymBaseId = 0; O->SymBaseId = 0; O->ScopeBaseId = 0; O->SpanBaseId = 0; O->Files = EmptyCollection; O->Sections = EmptyCollection; - O->Exports = EmptyCollection; - O->Imports = EmptyCollection; - O->DbgSyms = EmptyCollection; + O->Exports = EmptyCollection; + O->Imports = EmptyCollection; + O->DbgSyms = EmptyCollection; O->HLLDbgSyms = EmptyCollection; O->LineInfos = EmptyCollection; O->StringCount = 0; @@ -184,8 +184,8 @@ unsigned MakeGlobalStringId (const ObjData* O, unsigned Index) /* Convert a local string id into a global one and return it. */ { if (Index >= O->StringCount) { - Error ("Invalid string index (%u) in module `%s'", - Index, GetObjFileName (O)); + Error ("Invalid string index (%u) in module `%s'", + Index, GetObjFileName (O)); } return O->Strings[Index]; } diff --git a/src/ld65/objdata.h b/src/ld65/objdata.h index 95f694bbd..4c477eee0 100644 --- a/src/ld65/objdata.h +++ b/src/ld65/objdata.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objdata.h */ +/* objdata.h */ /* */ -/* Handling object file data for the ld65 linker */ +/* Handling object file data for the ld65 linker */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -60,30 +60,30 @@ struct Section; struct StrBuf; /* Values for the Flags field */ -#define OBJ_REF 0x0001 /* We have a reference to this file */ +#define OBJ_REF 0x0001 /* We have a reference to this file */ /* Internal structure holding object file data */ typedef struct ObjData ObjData; struct ObjData { - ObjData* Next; /* Linked list of all objects */ + ObjData* Next; /* Linked list of all objects */ unsigned Id; /* Id of this module */ - unsigned Name; /* Module name */ + unsigned Name; /* Module name */ struct Library* Lib; /* Library where module comes from */ unsigned long MTime; /* Time of last modification */ - ObjHeader Header; /* Header of file */ - unsigned long Start; /* Start offset of data in library */ - unsigned Flags; + ObjHeader Header; /* Header of file */ + unsigned long Start; /* Start offset of data in library */ + unsigned Flags; unsigned HLLSymBaseId; /* Debug info base id for hll symbols */ unsigned SymBaseId; /* Debug info base id for symbols */ unsigned ScopeBaseId; /* Debug info base id for scopes */ unsigned SpanBaseId; /* Debug info base id for spans */ - Collection Files; /* List of input files */ - Collection Sections; /* List of all sections */ - Collection Exports; /* List of all exports */ - Collection Imports; /* List of all imports */ - Collection DbgSyms; /* List of debug symbols */ + Collection Files; /* List of input files */ + Collection Sections; /* List of all sections */ + Collection Exports; /* List of all exports */ + Collection Imports; /* List of all imports */ + Collection DbgSyms; /* List of debug symbols */ Collection HLLDbgSyms; /* List of hll debug symbols */ Collection LineInfos; /* List of line infos */ unsigned StringCount; /* Count of strings */ @@ -101,7 +101,7 @@ extern Collection ObjDataList; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/objfile.c b/src/ld65/objfile.c index 24a9afda8..7b8dc4419 100644 --- a/src/ld65/objfile.c +++ b/src/ld65/objfile.c @@ -1,34 +1,34 @@ /*****************************************************************************/ -/* */ -/* objfile.c */ -/* */ -/* Object file handling for the ld65 linker */ -/* */ -/* */ -/* */ +/* */ +/* objfile.c */ +/* */ +/* Object file handling for the ld65 linker */ +/* */ +/* */ +/* */ /* (C) 1998-2012, Ullrich von Bassewitz */ /* Roemerstrasse 52 */ /* D-70794 Filderstadt */ /* EMail: uz@cc65.org */ -/* */ -/* */ -/* This software is provided 'as-is', without any expressed or implied */ +/* */ +/* */ +/* This software is provided 'as-is', without any expressed or implied */ /* warranty. In no event will the authors be held liable for any damages */ -/* arising from the use of this software. */ -/* */ +/* arising from the use of this software. */ +/* */ /* Permission is granted to anyone to use this software for any purpose, */ /* including commercial applications, and to alter it and redistribute it */ -/* freely, subject to the following restrictions: */ -/* */ +/* freely, subject to the following restrictions: */ +/* */ /* 1. The origin of this software must not be misrepresented; you must not */ /* claim that you wrote the original software. If you use this software */ /* in a product, an acknowledgment in the product documentation would be */ -/* appreciated but is not required. */ +/* appreciated but is not required. */ /* 2. Altered source versions must be plainly marked as such, and must not */ -/* be misrepresented as being the original software. */ -/* 3. This notice may not be removed or altered from any source */ -/* distribution. */ -/* */ +/* be misrepresented as being the original software. */ +/* 3. This notice may not be removed or altered from any source */ +/* distribution. */ +/* */ /*****************************************************************************/ @@ -56,7 +56,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -67,7 +67,7 @@ static unsigned GetModule (const char* Name) /* Make a module name from the file name */ const char* Module = FindName (Name); if (*Module == 0) { - Error ("Cannot make module name from `%s'", Name); + Error ("Cannot make module name from `%s'", Name); } return GetStringId (Module); } @@ -77,18 +77,18 @@ static unsigned GetModule (const char* Name) static void ObjReadHeader (FILE* Obj, ObjHeader* H, const char* Name) /* Read the header of the object file checking the signature */ { - H->Version = Read16 (Obj); + H->Version = Read16 (Obj); if (H->Version != OBJ_VERSION) { - Error ("Object file `%s' has wrong version, expected %08X, got %08X", + Error ("Object file `%s' has wrong version, expected %08X, got %08X", Name, OBJ_VERSION, H->Version); } - H->Flags = Read16 (Obj); + H->Flags = Read16 (Obj); H->OptionOffs = Read32 (Obj); H->OptionSize = Read32 (Obj); H->FileOffs = Read32 (Obj); H->FileSize = Read32 (Obj); - H->SegOffs = Read32 (Obj); - H->SegSize = Read32 (Obj); + H->SegOffs = Read32 (Obj); + H->SegSize = Read32 (Obj); H->ImportOffs = Read32 (Obj); H->ImportSize = Read32 (Obj); H->ExportOffs = Read32 (Obj); @@ -122,7 +122,7 @@ void ObjReadFiles (FILE* F, unsigned long Pos, ObjData* O) FileCount = ReadVar (F); CollGrow (&O->Files, FileCount); for (I = 0; I < FileCount; ++I) { - CollAppend (&O->Files, ReadFileInfo (F, O)); + CollAppend (&O->Files, ReadFileInfo (F, O)); } } @@ -141,7 +141,7 @@ void ObjReadSections (FILE* F, unsigned long Pos, ObjData* O) SectionCount = ReadVar (F); CollGrow (&O->Sections, SectionCount); for (I = 0; I < SectionCount; ++I) { - CollAppend (&O->Sections, ReadSection (F, O)); + CollAppend (&O->Sections, ReadSection (F, O)); } } @@ -160,7 +160,7 @@ void ObjReadImports (FILE* F, unsigned long Pos, ObjData* O) ImportCount = ReadVar (F); CollGrow (&O->Imports, ImportCount); for (I = 0; I < ImportCount; ++I) { - CollAppend (&O->Imports, ReadImport (F, O)); + CollAppend (&O->Imports, ReadImport (F, O)); } } @@ -179,7 +179,7 @@ void ObjReadExports (FILE* F, unsigned long Pos, ObjData* O) ExportCount = ReadVar (F); CollGrow (&O->Exports, ExportCount); for (I = 0; I < ExportCount; ++I) { - CollAppend (&O->Exports, ReadExport (F, O)); + CollAppend (&O->Exports, ReadExport (F, O)); } } @@ -198,14 +198,14 @@ void ObjReadDbgSyms (FILE* F, unsigned long Pos, ObjData* O) DbgSymCount = ReadVar (F); CollGrow (&O->DbgSyms, DbgSymCount); for (I = 0; I < DbgSymCount; ++I) { - CollAppend (&O->DbgSyms, ReadDbgSym (F, O, I)); + CollAppend (&O->DbgSyms, ReadDbgSym (F, O, I)); } /* Read the hll debug symbols */ DbgSymCount = ReadVar (F); CollGrow (&O->HLLDbgSyms, DbgSymCount); for (I = 0; I < DbgSymCount; ++I) { - CollAppend (&O->HLLDbgSyms, ReadHLLDbgSym (F, O, I)); + CollAppend (&O->HLLDbgSyms, ReadHLLDbgSym (F, O, I)); } } @@ -224,7 +224,7 @@ void ObjReadLineInfos (FILE* F, unsigned long Pos, ObjData* O) LineInfoCount = ReadVar (F); CollGrow (&O->LineInfos, LineInfoCount); for (I = 0; I < LineInfoCount; ++I) { - CollAppend (&O->LineInfos, ReadLineInfo (F, O)); + CollAppend (&O->LineInfos, ReadLineInfo (F, O)); } } diff --git a/src/ld65/objfile.h b/src/ld65/objfile.h index 1b7796625..e982f90b5 100644 --- a/src/ld65/objfile.h +++ b/src/ld65/objfile.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* objfile.h */ +/* objfile.h */ /* */ -/* Object file handling for the ld65 linker */ +/* Object file handling for the ld65 linker */ /* */ /* */ /* */ @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/scanner.c b/src/ld65/scanner.c index b60381fb6..b6d45354a 100644 --- a/src/ld65/scanner.c +++ b/src/ld65/scanner.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* scanner.c */ +/* scanner.c */ /* */ -/* Configuration file scanner for the ld65 linker */ +/* Configuration file scanner for the ld65 linker */ /* */ /* */ /* */ @@ -53,13 +53,13 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Current token and attributes */ -cfgtok_t CfgTok; +cfgtok_t CfgTok; StrBuf CfgSVal = STATIC_STRBUF_INITIALIZER; unsigned long CfgIVal; @@ -67,17 +67,17 @@ unsigned long CfgIVal; FilePos CfgErrorPos; /* Input source for the configuration */ -static const char* CfgName = 0; +static const char* CfgName = 0; /* Other input stuff */ -static int C = ' '; +static int C = ' '; static FilePos InputPos; -static FILE* InputFile = 0; +static FILE* InputFile = 0; /*****************************************************************************/ -/* Error handling */ +/* Error handling */ /*****************************************************************************/ @@ -117,7 +117,7 @@ void CfgError (const FilePos* Pos, const char* Format, ...) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -130,13 +130,13 @@ static void NextChar (void) /* Count columns */ if (C != EOF) { - ++InputPos.Col; + ++InputPos.Col; } /* Count lines */ if (C == '\n') { - ++InputPos.Line; - InputPos.Col = 0; + ++InputPos.Line; + InputPos.Col = 0; } } @@ -146,9 +146,9 @@ static unsigned DigitVal (int C) /* Return the value for a numeric digit */ { if (isdigit (C)) { - return C - '0'; + return C - '0'; } else { - return toupper (C) - 'A' + 10; + return toupper (C) - 'A' + 10; } } @@ -228,7 +228,7 @@ void CfgNextTok (void) Again: /* Skip whitespace */ while (isspace (C)) { - NextChar (); + NextChar (); } /* Remember the current position */ @@ -237,41 +237,41 @@ Again: /* Identifier? */ if (C == '_' || IsAlpha (C)) { - /* Read the identifier */ - SB_Clear (&CfgSVal); - while (C == '_' || IsAlNum (C)) { + /* Read the identifier */ + SB_Clear (&CfgSVal); + while (C == '_' || IsAlNum (C)) { SB_AppendChar (&CfgSVal, C); - NextChar (); - } - SB_Terminate (&CfgSVal); - CfgTok = CFGTOK_IDENT; - return; + NextChar (); + } + SB_Terminate (&CfgSVal); + CfgTok = CFGTOK_IDENT; + return; } /* Hex number? */ if (C == '$') { - NextChar (); - if (!isxdigit (C)) { - CfgError (&CfgErrorPos, "Hex digit expected"); - } - CfgIVal = 0; - while (isxdigit (C)) { - CfgIVal = CfgIVal * 16 + DigitVal (C); - NextChar (); - } - CfgTok = CFGTOK_INTCON; - return; + NextChar (); + if (!isxdigit (C)) { + CfgError (&CfgErrorPos, "Hex digit expected"); + } + CfgIVal = 0; + while (isxdigit (C)) { + CfgIVal = CfgIVal * 16 + DigitVal (C); + NextChar (); + } + CfgTok = CFGTOK_INTCON; + return; } /* Decimal number? */ if (isdigit (C)) { - CfgIVal = 0; - while (isdigit (C)) { - CfgIVal = CfgIVal * 10 + DigitVal (C); - NextChar (); - } - CfgTok = CFGTOK_INTCON; - return; + CfgIVal = 0; + while (isdigit (C)) { + CfgIVal = CfgIVal * 10 + DigitVal (C); + NextChar (); + } + CfgTok = CFGTOK_INTCON; + return; } /* Other characters */ @@ -297,99 +297,99 @@ Again: CfgTok = CFGTOK_DIV; break; - case '(': - NextChar (); - CfgTok = CFGTOK_LPAR; - break; + case '(': + NextChar (); + CfgTok = CFGTOK_LPAR; + break; - case ')': - NextChar (); - CfgTok = CFGTOK_RPAR; - break; + case ')': + NextChar (); + CfgTok = CFGTOK_RPAR; + break; - case '{': - NextChar (); - CfgTok = CFGTOK_LCURLY; - break; + case '{': + NextChar (); + CfgTok = CFGTOK_LCURLY; + break; - case '}': - NextChar (); - CfgTok = CFGTOK_RCURLY; - break; + case '}': + NextChar (); + CfgTok = CFGTOK_RCURLY; + break; - case ';': - NextChar (); - CfgTok = CFGTOK_SEMI; - break; + case ';': + NextChar (); + CfgTok = CFGTOK_SEMI; + break; - case '.': - NextChar (); - CfgTok = CFGTOK_DOT; - break; + case '.': + NextChar (); + CfgTok = CFGTOK_DOT; + break; - case ',': - NextChar (); - CfgTok = CFGTOK_COMMA; - break; + case ',': + NextChar (); + CfgTok = CFGTOK_COMMA; + break; - case '=': - NextChar (); - CfgTok = CFGTOK_EQ; - break; + case '=': + NextChar (); + CfgTok = CFGTOK_EQ; + break; case ':': - NextChar (); - CfgTok = CFGTOK_COLON; - break; + NextChar (); + CfgTok = CFGTOK_COLON; + break; case '\"': StrVal (); - break; + break; case '#': - /* Comment */ - while (C != '\n' && C != EOF) { - NextChar (); - } - if (C != EOF) { - goto Again; - } - CfgTok = CFGTOK_EOF; - break; + /* Comment */ + while (C != '\n' && C != EOF) { + NextChar (); + } + if (C != EOF) { + goto Again; + } + CfgTok = CFGTOK_EOF; + break; case '%': - NextChar (); - switch (C) { + NextChar (); + switch (C) { - case 'O': - NextChar (); - if (OutputName) { + case 'O': + NextChar (); + if (OutputName) { SB_CopyStr (&CfgSVal, OutputName); - } else { - SB_Clear (&CfgSVal); - } + } else { + SB_Clear (&CfgSVal); + } SB_Terminate (&CfgSVal); OutputNameUsed = 1; - CfgTok = CFGTOK_STRCON; - break; + CfgTok = CFGTOK_STRCON; + break; - case 'S': - NextChar (); - CfgIVal = StartAddr; - CfgTok = CFGTOK_INTCON; - break; + case 'S': + NextChar (); + CfgIVal = StartAddr; + CfgTok = CFGTOK_INTCON; + break; - default: - CfgError (&CfgErrorPos, "Invalid format specification"); - } - break; + default: + CfgError (&CfgErrorPos, "Invalid format specification"); + } + break; case EOF: - CfgTok = CFGTOK_EOF; - break; + CfgTok = CFGTOK_EOF; + break; - default: - CfgError (&CfgErrorPos, "Invalid character `%c'", C); + default: + CfgError (&CfgErrorPos, "Invalid character `%c'", C); } } @@ -400,7 +400,7 @@ void CfgConsume (cfgtok_t T, const char* Msg) /* Skip a token, print an error message if not found */ { if (CfgTok != T) { - CfgError (&CfgErrorPos, "%s", Msg); + CfgError (&CfgErrorPos, "%s", Msg); } CfgNextTok (); } @@ -427,7 +427,7 @@ void CfgOptionalComma (void) /* Consume a comma if there is one */ { if (CfgTok == CFGTOK_COMMA) { - CfgNextTok (); + CfgNextTok (); } } @@ -437,7 +437,7 @@ void CfgOptionalAssign (void) /* Consume an equal sign if there is one */ { if (CfgTok == CFGTOK_EQ) { - CfgNextTok (); + CfgNextTok (); } } @@ -447,7 +447,7 @@ void CfgAssureInt (void) /* Make sure the next token is an integer */ { if (CfgTok != CFGTOK_INTCON) { - CfgError (&CfgErrorPos, "Integer constant expected"); + CfgError (&CfgErrorPos, "Integer constant expected"); } } @@ -457,7 +457,7 @@ void CfgAssureStr (void) /* Make sure the next token is a string constant */ { if (CfgTok != CFGTOK_STRCON) { - CfgError (&CfgErrorPos, "String constant expected"); + CfgError (&CfgErrorPos, "String constant expected"); } } @@ -467,7 +467,7 @@ void CfgAssureIdent (void) /* Make sure the next token is an identifier */ { if (CfgTok != CFGTOK_IDENT) { - CfgError (&CfgErrorPos, "Identifier expected"); + CfgError (&CfgErrorPos, "Identifier expected"); } } @@ -477,7 +477,7 @@ void CfgRangeCheck (unsigned long Lo, unsigned long Hi) /* Check the range of CfgIVal */ { if (CfgIVal < Lo || CfgIVal > Hi) { - CfgError (&CfgErrorPos, "Range error"); + CfgError (&CfgErrorPos, "Range error"); } } @@ -491,16 +491,16 @@ void CfgSpecialToken (const IdentTok* Table, unsigned Size, const char* Name) /* We need an identifier */ if (CfgTok == CFGTOK_IDENT) { - /* Make it upper case */ + /* Make it upper case */ SB_ToUpper (&CfgSVal); - /* Linear search */ - for (I = 0; I < Size; ++I) { - if (SB_CompareStr (&CfgSVal, Table[I].Ident) == 0) { - CfgTok = Table[I].Tok; - return; - } - } + /* Linear search */ + for (I = 0; I < Size; ++I) { + if (SB_CompareStr (&CfgSVal, Table[I].Ident) == 0) { + CfgTok = Table[I].Tok; + return; + } + } } @@ -514,21 +514,21 @@ void CfgBoolToken (void) /* Map an identifier or integer to a boolean token */ { static const IdentTok Booleans [] = { - { "YES", CFGTOK_TRUE }, - { "NO", CFGTOK_FALSE }, + { "YES", CFGTOK_TRUE }, + { "NO", CFGTOK_FALSE }, { "TRUE", CFGTOK_TRUE }, { "FALSE", CFGTOK_FALSE }, }; /* If we have an identifier, map it to a boolean token */ if (CfgTok == CFGTOK_IDENT) { - CfgSpecialToken (Booleans, ENTRY_COUNT (Booleans), "Boolean"); + CfgSpecialToken (Booleans, ENTRY_COUNT (Booleans), "Boolean"); } else { - /* We expected an integer here */ - if (CfgTok != CFGTOK_INTCON) { - CfgError (&CfgErrorPos, "Boolean value expected"); - } - CfgTok = (CfgIVal == 0)? CFGTOK_FALSE : CFGTOK_TRUE; + /* We expected an integer here */ + if (CfgTok != CFGTOK_INTCON) { + CfgError (&CfgErrorPos, "Boolean value expected"); + } + CfgTok = (CfgIVal == 0)? CFGTOK_FALSE : CFGTOK_TRUE; } } @@ -577,7 +577,7 @@ void CfgCloseInput (void) /* Close the input file if we had one */ if (InputFile) { (void) fclose (InputFile); - InputFile = 0; + InputFile = 0; } } diff --git a/src/ld65/scanner.h b/src/ld65/scanner.h index cb3914657..9e27b6720 100644 --- a/src/ld65/scanner.h +++ b/src/ld65/scanner.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* scanner.h */ +/* scanner.h */ /* */ -/* Configuration file scanner for the ld65 linker */ +/* Configuration file scanner for the ld65 linker */ /* */ /* */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -153,17 +153,17 @@ typedef enum { /* Mapping table entry, special identifier --> token */ typedef struct IdentTok IdentTok; struct IdentTok { - const char* Ident; /* Identifier */ - cfgtok_t Tok; /* Token for identifier */ + const char* Ident; /* Identifier */ + cfgtok_t Tok; /* Token for identifier */ }; -#define ENTRY_COUNT(s) (sizeof (s) / sizeof (s [0])) +#define ENTRY_COUNT(s) (sizeof (s) / sizeof (s [0])) /* Current token and attributes */ -extern cfgtok_t CfgTok; +extern cfgtok_t CfgTok; extern StrBuf CfgSVal; -extern unsigned long CfgIVal; +extern unsigned long CfgIVal; /* Error location. PLEASE NOTE: I'm abusing the FilePos structure to some * degree. It is used mostly to hold a file position, where the Name member @@ -177,7 +177,7 @@ extern FilePos CfgErrorPos; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/scopes.c b/src/ld65/scopes.c index 7243805bf..b3acc0d7d 100644 --- a/src/ld65/scopes.c +++ b/src/ld65/scopes.c @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/scopes.h b/src/ld65/scopes.h index bb9fc85e2..142dc16bb 100644 --- a/src/ld65/scopes.h +++ b/src/ld65/scopes.h @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -59,7 +59,7 @@ typedef struct Scope Scope; struct Scope { unsigned Id; /* Id of scope */ - ObjData* Obj; /* Object file that contains the scope */ + ObjData* Obj; /* Object file that contains the scope */ unsigned ParentId; /* Id of parent scope */ unsigned LabelId; /* Id of the scope label if any */ unsigned LexicalLevel; /* Lexical level */ @@ -73,7 +73,7 @@ struct Scope { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/segments.c b/src/ld65/segments.c index 413c8020d..e42a40d22 100644 --- a/src/ld65/segments.c +++ b/src/ld65/segments.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* segments.c */ +/* segments.c */ /* */ -/* Segment handling for the ld65 linker */ +/* Segment handling for the ld65 linker */ /* */ /* */ /* */ @@ -62,15 +62,15 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Hash table */ #define HASHTAB_MASK 0x3FU -#define HASHTAB_SIZE (HASHTAB_MASK + 1) -static Segment* HashTab[HASHTAB_SIZE]; +#define HASHTAB_SIZE (HASHTAB_MASK + 1) +static Segment* HashTab[HASHTAB_SIZE]; /* List of all segments */ static Collection SegmentList = STATIC_COLLECTION_INITIALIZER; @@ -78,7 +78,7 @@ static Collection SegmentList = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -93,16 +93,16 @@ static Segment* NewSegment (unsigned Name, unsigned char AddrSize) /* Initialize the fields */ S->Name = Name; - S->Next = 0; + S->Next = 0; S->Flags = SEG_FLAG_NONE; S->Sections = EmptyCollection; S->MemArea = 0; - S->PC = 0; - S->Size = 0; + S->PC = 0; + S->Size = 0; S->OutputName = 0; S->OutputOffs = 0; S->Alignment = 1; - S->FillVal = 0; + S->FillVal = 0; S->AddrSize = AddrSize; S->ReadOnly = 0; S->Dumped = 0; @@ -135,18 +135,18 @@ Segment* GetSegment (unsigned Name, unsigned char AddrSize, const char* ObjName) * the first section. */ if (S == 0) { - /* Create a new segment */ - S = NewSegment (Name, AddrSize); + /* Create a new segment */ + S = NewSegment (Name, AddrSize); } else { - /* Check if the existing segment has the requested address size */ - if (S->AddrSize != AddrSize) { - /* Allow an empty object name */ - if (ObjName == 0) { - ObjName = "[linker generated]"; - } - Error ("Module `%s': Type mismatch for segment `%s'", ObjName, + /* Check if the existing segment has the requested address size */ + if (S->AddrSize != AddrSize) { + /* Allow an empty object name */ + if (ObjName == 0) { + ObjName = "[linker generated]"; + } + Error ("Module `%s': Type mismatch for segment `%s'", ObjName, GetString (Name)); - } + } } /* Return the segment */ @@ -162,12 +162,12 @@ Section* NewSection (Segment* Seg, unsigned long Alignment, unsigned char AddrSi Section* S = xmalloc (sizeof (Section)); /* Initialize the data */ - S->Next = 0; - S->Seg = Seg; + S->Next = 0; + S->Seg = Seg; S->Obj = 0; S->FragRoot = 0; S->FragLast = 0; - S->Size = 0; + S->Size = 0; S->Alignment= Alignment; S->AddrSize = AddrSize; @@ -176,7 +176,7 @@ Section* NewSection (Segment* Seg, unsigned long Alignment, unsigned char AddrSi /* Adjust the segment size and set the section offset */ Seg->Size += S->Fill; - S->Offs = Seg->Size; /* Current size is offset */ + S->Offs = Seg->Size; /* Current size is offset */ /* Insert the section into the segment */ CollAppend (&Seg->Sections, S); @@ -211,7 +211,7 @@ Section* ReadSection (FILE* F, ObjData* O) /* Print some data */ Print (stdout, 2, "Module `%s': Found segment `%s', size = %u, alignment = %lu, type = %u\n", - GetObjFileName (O), GetString (Name), Size, Alignment, Type); + GetObjFileName (O), GetString (Name), Size, Alignment, Type); /* Get the segment for this section */ S = GetSegment (Name, Type, GetObjFileName (O)); @@ -241,46 +241,46 @@ Section* ReadSection (FILE* F, ObjData* O) /* Start reading fragments from the file and insert them into the section . */ while (FragCount--) { - Fragment* Frag; + Fragment* Frag; - /* Read the fragment type */ - unsigned char Type = Read8 (F); + /* Read the fragment type */ + unsigned char Type = Read8 (F); /* Extract the check mask from the type */ unsigned char Bytes = Type & FRAG_BYTEMASK; Type &= FRAG_TYPEMASK; - /* Handle the different fragment types */ - switch (Type) { + /* Handle the different fragment types */ + switch (Type) { - case FRAG_LITERAL: - Frag = NewFragment (Type, ReadVar (F), Sec); - ReadData (F, Frag->LitBuf, Frag->Size); - break; + case FRAG_LITERAL: + Frag = NewFragment (Type, ReadVar (F), Sec); + ReadData (F, Frag->LitBuf, Frag->Size); + break; - case FRAG_EXPR: - case FRAG_SEXPR: - Frag = NewFragment (Type, Bytes, Sec); - Frag->Expr = ReadExpr (F, O); - break; + case FRAG_EXPR: + case FRAG_SEXPR: + Frag = NewFragment (Type, Bytes, Sec); + Frag->Expr = ReadExpr (F, O); + break; - case FRAG_FILL: - /* Will allocate memory, but we don't care... */ - Frag = NewFragment (Type, ReadVar (F), Sec); - break; + case FRAG_FILL: + /* Will allocate memory, but we don't care... */ + Frag = NewFragment (Type, ReadVar (F), Sec); + break; - default: - Error ("Unknown fragment type in module `%s', segment `%s': %02X", - GetObjFileName (O), GetString (S->Name), Type); - /* NOTREACHED */ - return 0; - } + default: + Error ("Unknown fragment type in module `%s', segment `%s': %02X", + GetObjFileName (O), GetString (S->Name), Type); + /* NOTREACHED */ + return 0; + } /* Read the line infos into the list of the fragment */ ReadLineInfoList (F, O, &Frag->LineInfos); - /* Remember the module we had this fragment from */ - Frag->Obj = O; + /* Remember the module we had this fragment from */ + Frag->Obj = O; } /* Return the section */ @@ -294,11 +294,11 @@ Segment* SegFind (unsigned Name) { Segment* S = HashTab[Name & HASHTAB_MASK]; while (S) { - if (Name == S->Name) { - /* Found */ - break; - } - S = S->Next; + if (Name == S->Name) { + /* Found */ + break; + } + S = S->Next; } /* Not found */ return S; @@ -318,24 +318,24 @@ int IsBSSType (Segment* S) /* Get the next section */ Section* Sec = CollAtUnchecked (&S->Sections, I); - /* Loop over all fragments */ - Fragment* F = Sec->FragRoot; - while (F) { - if (F->Type == FRAG_LITERAL) { - unsigned char* Data = F->LitBuf; - unsigned long Count = F->Size; - while (Count--) { - if (*Data++ != 0) { - return 0; - } - } - } else if (F->Type == FRAG_EXPR || F->Type == FRAG_SEXPR) { - if (GetExprVal (F->Expr) != 0) { - return 0; - } - } - F = F->Next; - } + /* Loop over all fragments */ + Fragment* F = Sec->FragRoot; + while (F) { + if (F->Type == FRAG_LITERAL) { + unsigned char* Data = F->LitBuf; + unsigned long Count = F->Size; + while (Count--) { + if (*Data++ != 0) { + return 0; + } + } + } else if (F->Type == FRAG_EXPR || F->Type == FRAG_SEXPR) { + if (GetExprVal (F->Expr) != 0) { + return 0; + } + } + F = F->Next; + } } return 1; } @@ -351,53 +351,53 @@ void SegDump (void) for (I = 0; I < CollCount (&SegmentList); ++I) { Segment* Seg = CollAtUnchecked (&SegmentList, I); - printf ("Segment: %s (%lu)\n", GetString (Seg->Name), Seg->Size); + printf ("Segment: %s (%lu)\n", GetString (Seg->Name), Seg->Size); for (J = 0; J < CollCount (&Seg->Sections); ++J) { Section* S = CollAtUnchecked (&Seg->Sections, J); unsigned J; - Fragment* F = S->FragRoot; - printf (" Section:\n"); - while (F) { - switch (F->Type) { + Fragment* F = S->FragRoot; + printf (" Section:\n"); + while (F) { + switch (F->Type) { - case FRAG_LITERAL: - printf (" Literal (%u bytes):", F->Size); - Count = F->Size; - Data = F->LitBuf; - J = 100; - while (Count--) { - if (J > 75) { - printf ("\n "); - J = 3; - } - printf (" %02X", *Data++); - J += 3; - } - printf ("\n"); - break; + case FRAG_LITERAL: + printf (" Literal (%u bytes):", F->Size); + Count = F->Size; + Data = F->LitBuf; + J = 100; + while (Count--) { + if (J > 75) { + printf ("\n "); + J = 3; + } + printf (" %02X", *Data++); + J += 3; + } + printf ("\n"); + break; - case FRAG_EXPR: - printf (" Expression (%u bytes):\n", F->Size); - printf (" "); - DumpExpr (F->Expr, 0); - break; + case FRAG_EXPR: + printf (" Expression (%u bytes):\n", F->Size); + printf (" "); + DumpExpr (F->Expr, 0); + break; - case FRAG_SEXPR: - printf (" Signed expression (%u bytes):\n", F->Size); - printf (" "); - DumpExpr (F->Expr, 0); - break; + case FRAG_SEXPR: + printf (" Signed expression (%u bytes):\n", F->Size); + printf (" "); + DumpExpr (F->Expr, 0); + break; - case FRAG_FILL: - printf (" Empty space (%u bytes)\n", F->Size); - break; + case FRAG_FILL: + printf (" Empty space (%u bytes)\n", F->Size); + break; - default: - Internal ("Invalid fragment type: %02X", F->Type); - } - F = F->Next; - } - } + default: + Internal ("Invalid fragment type: %02X", F->Type); + } + F = F->Next; + } + } } } @@ -409,13 +409,13 @@ unsigned SegWriteConstExpr (FILE* F, ExprNode* E, int Signed, unsigned Size) */ { static const unsigned long U_Hi[4] = { - 0x000000FFUL, 0x0000FFFFUL, 0x00FFFFFFUL, 0xFFFFFFFFUL + 0x000000FFUL, 0x0000FFFFUL, 0x00FFFFFFUL, 0xFFFFFFFFUL }; static const long S_Hi[4] = { - 0x0000007FL, 0x00007FFFL, 0x007FFFFFL, 0x7FFFFFFFL + 0x0000007FL, 0x00007FFFL, 0x007FFFFFL, 0x7FFFFFFFL }; static const long S_Lo[4] = { - ~0x0000007FL, ~0x00007FFFL, ~0x007FFFFFL, ~0x7FFFFFFFL + ~0x0000007FL, ~0x00007FFFL, ~0x007FFFFFL, ~0x7FFFFFFFL }; @@ -427,15 +427,15 @@ unsigned SegWriteConstExpr (FILE* F, ExprNode* E, int Signed, unsigned Size) /* Check for a range error */ if (Signed) { - if (Val > S_Hi[Size-1] || Val < S_Lo[Size-1]) { - /* Range error */ - return SEG_EXPR_RANGE_ERROR; - } + if (Val > S_Hi[Size-1] || Val < S_Lo[Size-1]) { + /* Range error */ + return SEG_EXPR_RANGE_ERROR; + } } else { - if (((unsigned long)Val) > U_Hi[Size-1]) { - /* Range error */ - return SEG_EXPR_RANGE_ERROR; - } + if (((unsigned long)Val) > U_Hi[Size-1]) { + /* Range error */ + return SEG_EXPR_RANGE_ERROR; + } } /* Write the value to the file */ @@ -465,81 +465,81 @@ void SegWrite (const char* TgtName, FILE* Tgt, Segment* S, SegWriteFunc F, void* for (I = 0; I < CollCount (&S->Sections); ++I) { Section* Sec = CollAtUnchecked (&S->Sections, I); - Fragment* Frag; + Fragment* Frag; unsigned char FillVal; /* Output were this section is from */ Print (stdout, 2, " Section from \"%s\"\n", GetObjFileName (Sec->Obj)); - /* If we have fill bytes, write them now. Beware: If this is the + /* If we have fill bytes, write them now. Beware: If this is the * first section, the fill value is not considered part of the segment * and therefore taken from the memory area. */ FillVal = (I == 0)? S->MemArea->FillVal : S->FillVal; - Print (stdout, 2, " Filling 0x%lx bytes with 0x%02x\n", + Print (stdout, 2, " Filling 0x%lx bytes with 0x%02x\n", Sec->Fill, FillVal); - WriteMult (Tgt, FillVal, Sec->Fill); - Offs += Sec->Fill; + WriteMult (Tgt, FillVal, Sec->Fill); + Offs += Sec->Fill; - /* Loop over all fragments in this section */ - Frag = Sec->FragRoot; - while (Frag) { + /* Loop over all fragments in this section */ + Frag = Sec->FragRoot; + while (Frag) { /* Output fragment data */ - switch (Frag->Type) { + switch (Frag->Type) { - case FRAG_LITERAL: - WriteData (Tgt, Frag->LitBuf, Frag->Size); - break; + case FRAG_LITERAL: + WriteData (Tgt, Frag->LitBuf, Frag->Size); + break; - case FRAG_EXPR: - case FRAG_SEXPR: - Sign = (Frag->Type == FRAG_SEXPR); - /* Call the users function and evaluate the result */ - switch (F (Frag->Expr, Sign, Frag->Size, Offs, Data)) { + case FRAG_EXPR: + case FRAG_SEXPR: + Sign = (Frag->Type == FRAG_SEXPR); + /* Call the users function and evaluate the result */ + switch (F (Frag->Expr, Sign, Frag->Size, Offs, Data)) { - case SEG_EXPR_OK: - break; + case SEG_EXPR_OK: + break; - case SEG_EXPR_RANGE_ERROR: - Error ("Range error in module `%s', line %u", - GetFragmentSourceName (Frag), - GetFragmentSourceLine (Frag)); - break; + case SEG_EXPR_RANGE_ERROR: + Error ("Range error in module `%s', line %u", + GetFragmentSourceName (Frag), + GetFragmentSourceLine (Frag)); + break; - case SEG_EXPR_TOO_COMPLEX: - Error ("Expression too complex in module `%s', line %u", - GetFragmentSourceName (Frag), - GetFragmentSourceLine (Frag)); - break; + case SEG_EXPR_TOO_COMPLEX: + Error ("Expression too complex in module `%s', line %u", + GetFragmentSourceName (Frag), + GetFragmentSourceLine (Frag)); + break; - case SEG_EXPR_INVALID: - Error ("Invalid expression in module `%s', line %u", - GetFragmentSourceName (Frag), - GetFragmentSourceLine (Frag)); - break; + case SEG_EXPR_INVALID: + Error ("Invalid expression in module `%s', line %u", + GetFragmentSourceName (Frag), + GetFragmentSourceLine (Frag)); + break; - default: - Internal ("Invalid return code from SegWriteFunc"); - } - break; + default: + Internal ("Invalid return code from SegWriteFunc"); + } + break; - case FRAG_FILL: - WriteMult (Tgt, S->FillVal, Frag->Size); - break; + case FRAG_FILL: + WriteMult (Tgt, S->FillVal, Frag->Size); + break; - default: - Internal ("Invalid fragment type: %02X", Frag->Type); - } + default: + Internal ("Invalid fragment type: %02X", Frag->Type); + } - /* Update the offset */ + /* Update the offset */ Print (stdout, 2, " Fragment with 0x%x bytes\n", Frag->Size); - Offs += Frag->Size; + Offs += Frag->Size; - /* Next fragment */ - Frag = Frag->Next; - } + /* Next fragment */ + Frag = Frag->Next; + } } } @@ -562,12 +562,12 @@ static int CmpSegStart (const void* K1, const void* K2) /* Compare the start addresses */ if (S1->PC > S2->PC) { - return 1; + return 1; } else if (S1->PC < S2->PC) { - return -1; + return -1; } else { - /* Sort segments with equal starts by name */ - return strcmp (GetString (S1->Name), GetString (S2->Name)); + /* Sort segments with equal starts by name */ + return strcmp (GetString (S1->Name), GetString (S2->Name)); } } @@ -591,25 +591,25 @@ void PrintSegmentMap (FILE* F) /* Print a header */ fprintf (F, "Name Start End Size Align\n" - "----------------------------------------------------\n"); + "----------------------------------------------------\n"); /* Print the segments */ for (I = 0; I < CollCount (&SegmentList); ++I) { - /* Get a pointer to the segment */ - Segment* S = SegPool[I]; + /* Get a pointer to the segment */ + Segment* S = SegPool[I]; - /* Print empty segments only if explicitly requested */ - if (VerboseMap || S->Size > 0) { - /* Print the segment data */ - long End = S->PC + S->Size; - if (S->Size > 0) { - /* Point to last element addressed */ - --End; - } - fprintf (F, "%-20s %06lX %06lX %06lX %05lX\n", - GetString (S->Name), S->PC, End, S->Size, S->Alignment); - } + /* Print empty segments only if explicitly requested */ + if (VerboseMap || S->Size > 0) { + /* Print the segment data */ + long End = S->PC + S->Size; + if (S->Size > 0) { + /* Point to last element addressed */ + --End; + } + fprintf (F, "%-20s %06lX %06lX %06lX %05lX\n", + GetString (S->Name), S->PC, End, S->Size, S->Alignment); + } } /* Free the segment pool */ @@ -656,10 +656,10 @@ void CheckSegments (void) const Segment* S = CollAtUnchecked (&SegmentList, I); /* Check it */ - if (S->Size > 0 && S->Dumped == 0) { - Error ("Missing memory area assignment for segment `%s'", + if (S->Size > 0 && S->Dumped == 0) { + Error ("Missing memory area assignment for segment `%s'", GetString (S->Name)); - } + } } } diff --git a/src/ld65/segments.h b/src/ld65/segments.h index 9810c0f57..67006bcc1 100644 --- a/src/ld65/segments.h +++ b/src/ld65/segments.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* segments.h */ +/* segments.h */ /* */ -/* Segment handling for the ld65 linker */ +/* Segment handling for the ld65 linker */ /* */ /* */ /* */ @@ -47,7 +47,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -60,19 +60,19 @@ typedef struct Segment Segment; struct Segment { unsigned Name; /* Name index of the segment */ unsigned Id; /* Segment id for debug info */ - Segment* Next; /* Hash list */ + Segment* Next; /* Hash list */ unsigned Flags; /* Segment flags */ Collection Sections; /* Sections in this segment */ struct MemoryArea* MemArea; /* Run memory area once placed */ - unsigned long PC; /* PC were this segment is located */ - unsigned long Size; /* Size of data so far */ + unsigned long PC; /* PC were this segment is located */ + unsigned long Size; /* Size of data so far */ const char* OutputName; /* Name of output file or NULL */ unsigned long OutputOffs; /* Offset in output file */ unsigned long Alignment; /* Alignment needed */ - unsigned char FillVal; /* Value to use for fill bytes */ - unsigned char AddrSize; /* Address size of segment */ + unsigned char FillVal; /* Value to use for fill bytes */ + unsigned char AddrSize; /* Address size of segment */ unsigned char ReadOnly; /* True for readonly segments (config) */ - unsigned char Dumped; /* Did we dump this segment? */ + unsigned char Dumped; /* Did we dump this segment? */ }; @@ -80,16 +80,16 @@ struct Segment { /* Section structure (a section is a part of a segment) */ typedef struct Section Section; struct Section { - Section* Next; /* List of sections in a segment */ - Segment* Seg; /* Segment that contains the section */ + Section* Next; /* List of sections in a segment */ + Segment* Seg; /* Segment that contains the section */ struct ObjData* Obj; /* Object file this section comes from */ - struct Fragment* FragRoot; /* Fragment list */ - struct Fragment* FragLast; /* Pointer to last fragment */ - unsigned long Offs; /* Offset into the segment */ - unsigned long Size; /* Size of the section */ + struct Fragment* FragRoot; /* Fragment list */ + struct Fragment* FragLast; /* Pointer to last fragment */ + unsigned long Offs; /* Offset into the segment */ + unsigned long Size; /* Size of the section */ unsigned long Fill; /* Fill bytes for alignment */ unsigned long Alignment; /* Alignment */ - unsigned char AddrSize; /* Address size of segment */ + unsigned char AddrSize; /* Address size of segment */ }; @@ -97,21 +97,21 @@ struct Section { /* Prototype for a function that is used to write expressions to the target * file (used in SegWrite). It returns one of the following values: */ -#define SEG_EXPR_OK 0U /* Ok */ -#define SEG_EXPR_RANGE_ERROR 1U /* Range error */ -#define SEG_EXPR_TOO_COMPLEX 2U /* Expression too complex */ +#define SEG_EXPR_OK 0U /* Ok */ +#define SEG_EXPR_RANGE_ERROR 1U /* Range error */ +#define SEG_EXPR_TOO_COMPLEX 2U /* Expression too complex */ #define SEG_EXPR_INVALID 3U /* Expression is invalid (e.g. unmapped segment) */ -typedef unsigned (*SegWriteFunc) (ExprNode* E, /* The expression to write */ - int Signed, /* Signed expression? */ - unsigned Size, /* Size (=range) */ - unsigned long Offs, /* File offset */ - void* Data); /* Callers data */ +typedef unsigned (*SegWriteFunc) (ExprNode* E, /* The expression to write */ + int Signed, /* Signed expression? */ + unsigned Size, /* Size (=range) */ + unsigned long Offs, /* File offset */ + void* Data); /* Callers data */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/span.c b/src/ld65/span.c index 19bf8abe1..1b3f35e06 100644 --- a/src/ld65/span.c +++ b/src/ld65/span.c @@ -54,7 +54,7 @@ /* Definition of a span */ struct Span { - unsigned Id; /* Id of the span */ + unsigned Id; /* Id of the span */ unsigned Sec; /* Section id of this span */ unsigned long Offs; /* Offset of span within segment */ unsigned long Size; /* Size of span */ @@ -64,7 +64,7 @@ struct Span { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/span.h b/src/ld65/span.h index d8382a028..6e549189b 100644 --- a/src/ld65/span.h +++ b/src/ld65/span.h @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Forwards */ +/* Forwards */ /*****************************************************************************/ @@ -57,7 +57,7 @@ struct Segment; /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -68,7 +68,7 @@ typedef struct Span Span; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/spool.c b/src/ld65/spool.c index d5ce7fe13..b3173eb17 100644 --- a/src/ld65/spool.c +++ b/src/ld65/spool.c @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -49,7 +49,7 @@ StringPool* StrPool = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/spool.h b/src/ld65/spool.h index 9c84f06b8..bd5a7a627 100644 --- a/src/ld65/spool.h +++ b/src/ld65/spool.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -58,7 +58,7 @@ extern StringPool* StrPool; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/tpool.c b/src/ld65/tpool.c index 06957cb5d..f943fa704 100644 --- a/src/ld65/tpool.c +++ b/src/ld65/tpool.c @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -53,7 +53,7 @@ StringPool* TypePool = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/ld65/tpool.h b/src/ld65/tpool.h index 2b1a63dd1..d2a8510d9 100644 --- a/src/ld65/tpool.h +++ b/src/ld65/tpool.h @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -60,7 +60,7 @@ extern StringPool* TypePool; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/od65/dump.c b/src/od65/dump.c index 21a039e7f..ffca41907 100644 --- a/src/od65/dump.c +++ b/src/od65/dump.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* dump.c */ +/* dump.c */ /* */ -/* Dump subroutines for the od65 object file dump utility */ +/* Dump subroutines for the od65 object file dump utility */ /* */ /* */ /* */ @@ -57,7 +57,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -91,8 +91,8 @@ static const char* GetString (const Collection* C, unsigned Index) static void DumpObjHeaderSection (const char* Name, - unsigned long Offset, - unsigned long Size) + unsigned long Offset, + unsigned long Size) /* Dump a header section */ { printf (" %s:\n", Name); @@ -112,7 +112,7 @@ static char* TimeToStr (unsigned long Time) /* Remove the trailing newline */ unsigned Len = strlen (S); if (Len > 0 && S[Len-1] == '\n') { - S[Len-1 ] = '\0'; + S[Len-1 ] = '\0'; } /* Return the time string */ @@ -155,38 +155,38 @@ static void SkipExpr (FILE* F) /* Read the node tag and handle NULL nodes */ unsigned char Op = Read8 (F); if (Op == EXPR_NULL) { - return; + return; } /* Check the tag and handle the different expression types */ if (EXPR_IS_LEAF (Op)) { - switch (Op) { + switch (Op) { - case EXPR_LITERAL: - (void) Read32Signed (F); - break; + case EXPR_LITERAL: + (void) Read32Signed (F); + break; - case EXPR_SYMBOL: - /* Read the import number */ - (void) ReadVar (F); - break; + case EXPR_SYMBOL: + /* Read the import number */ + (void) ReadVar (F); + break; - case EXPR_SECTION: + case EXPR_SECTION: case EXPR_BANK: - /* Read the segment number */ - (void) ReadVar (F); - break; + /* Read the segment number */ + (void) ReadVar (F); + break; - default: - Error ("Invalid expression op: %02X", Op); + default: + Error ("Invalid expression op: %02X", Op); - } + } } else { - /* Not a leaf node */ - SkipExpr (F); - SkipExpr (F); + /* Not a leaf node */ + SkipExpr (F); + SkipExpr (F); } } @@ -205,20 +205,20 @@ static const char* GetExportFlags (unsigned Flags, const unsigned char* ConDes) /* Symbol type */ TypeDesc[0] = '\0'; switch (Flags & SYM_MASK_TYPE) { - case SYM_STD: strcat (TypeDesc, "SYM_STD"); break; - case SYM_CHEAP_LOCAL: strcat (TypeDesc, "SYM_CHEAP_LOCAL"); break; + case SYM_STD: strcat (TypeDesc, "SYM_STD"); break; + case SYM_CHEAP_LOCAL: strcat (TypeDesc, "SYM_CHEAP_LOCAL"); break; } /* Symbol usage */ switch (Flags & SYM_MASK_LABEL) { - case SYM_EQUATE: strcat (TypeDesc, ",SYM_EQUATE"); break; - case SYM_LABEL: strcat (TypeDesc, ",SYM_LABEL"); break; + case SYM_EQUATE: strcat (TypeDesc, ",SYM_EQUATE"); break; + case SYM_LABEL: strcat (TypeDesc, ",SYM_LABEL"); break; } /* Type of expression */ switch (Flags & SYM_MASK_VAL) { - case SYM_CONST: strcat (TypeDesc, ",SYM_CONST"); break; - case SYM_EXPR: strcat (TypeDesc, ",SYM_EXPR"); break; + case SYM_CONST: strcat (TypeDesc, ",SYM_CONST"); break; + case SYM_EXPR: strcat (TypeDesc, ",SYM_EXPR"); break; } /* Size available? */ @@ -231,15 +231,15 @@ static const char* GetExportFlags (unsigned Flags, const unsigned char* ConDes) T = TypeDesc + strlen (TypeDesc); Count = SYM_GET_CONDES_COUNT (Flags); if (Count > 0 && ConDes) { - T += sprintf (T, ",SYM_CONDES="); - for (I = 0; I < Count; ++I) { - unsigned Type = CD_GET_TYPE (ConDes[I]); - unsigned Prio = CD_GET_PRIO (ConDes[I]); - if (I > 0) { - *T++ = ','; - } - T += sprintf (T, "[%u,%u]", Type, Prio); - } + T += sprintf (T, ",SYM_CONDES="); + for (I = 0; I < Count; ++I) { + unsigned Type = CD_GET_TYPE (ConDes[I]); + unsigned Prio = CD_GET_PRIO (ConDes[I]); + if (I > 0) { + *T++ = ','; + } + T += sprintf (T, "[%u,%u]", Type, Prio); + } } /* Return the result */ @@ -289,7 +289,7 @@ void DumpObjHeader (FILE* F, unsigned long Offset) /* Flags */ printf (" Flags:%21s0x%04X (", "", H.Flags); if (H.Flags & OBJ_FLAGS_DBGINFO) { - printf ("OBJ_FLAGS_DBGINFO"); + printf ("OBJ_FLAGS_DBGINFO"); } printf (")\n"); @@ -355,57 +355,57 @@ void DumpObjOptions (FILE* F, unsigned long Offset) /* Read and print all options */ for (I = 0; I < Count; ++I) { - const char* ArgStr; - unsigned ArgLen; + const char* ArgStr; + unsigned ArgLen; - /* Read the type of the option and the value */ - unsigned char Type = Read8 (F); + /* Read the type of the option and the value */ + unsigned char Type = Read8 (F); unsigned long Val = ReadVar (F); - /* Get the type of the argument */ - unsigned char ArgType = Type & OPT_ARGMASK; + /* Get the type of the argument */ + unsigned char ArgType = Type & OPT_ARGMASK; - /* Determine which option follows */ - const char* TypeDesc; - switch (Type) { - case OPT_COMMENT: TypeDesc = "OPT_COMMENT"; break; - case OPT_AUTHOR: TypeDesc = "OPT_AUTHOR"; break; - case OPT_TRANSLATOR:TypeDesc = "OPT_TRANSLATOR"; break; - case OPT_COMPILER: TypeDesc = "OPT_COMPILER"; break; - case OPT_OS: TypeDesc = "OPT_OS"; break; - case OPT_DATETIME: TypeDesc = "OPT_DATETIME"; break; - default: TypeDesc = "OPT_UNKNOWN"; break; - } + /* Determine which option follows */ + const char* TypeDesc; + switch (Type) { + case OPT_COMMENT: TypeDesc = "OPT_COMMENT"; break; + case OPT_AUTHOR: TypeDesc = "OPT_AUTHOR"; break; + case OPT_TRANSLATOR:TypeDesc = "OPT_TRANSLATOR"; break; + case OPT_COMPILER: TypeDesc = "OPT_COMPILER"; break; + case OPT_OS: TypeDesc = "OPT_OS"; break; + case OPT_DATETIME: TypeDesc = "OPT_DATETIME"; break; + default: TypeDesc = "OPT_UNKNOWN"; break; + } - /* Print the header */ - printf (" Index:%27u\n", I); + /* Print the header */ + printf (" Index:%27u\n", I); - /* Print the data */ - printf (" Type:%22s0x%02X (%s)\n", "", Type, TypeDesc); - switch (ArgType) { + /* Print the data */ + printf (" Type:%22s0x%02X (%s)\n", "", Type, TypeDesc); + switch (ArgType) { - case OPT_ARGSTR: - ArgStr = GetString (&StrPool, Val); - ArgLen = strlen (ArgStr); - printf (" Data:%*s\"%s\"\n", (int)(24-ArgLen), "", ArgStr); - break; + case OPT_ARGSTR: + ArgStr = GetString (&StrPool, Val); + ArgLen = strlen (ArgStr); + printf (" Data:%*s\"%s\"\n", (int)(24-ArgLen), "", ArgStr); + break; - case OPT_ARGNUM: - printf (" Data:%26lu", Val); - if (Type == OPT_DATETIME) { - /* Print the time as a string */ - printf (" (%s)", TimeToStr (Val)); - } - printf ("\n"); - break; + case OPT_ARGNUM: + printf (" Data:%26lu", Val); + if (Type == OPT_DATETIME) { + /* Print the time as a string */ + printf (" (%s)", TimeToStr (Val)); + } + printf ("\n"); + break; - default: - /* Unknown argument type. This means that we cannot determine - * the option length, so we cannot proceed. - */ - Error ("Unknown option type: 0x%02X", Type); - break; - } + default: + /* Unknown argument type. This means that we cannot determine + * the option length, so we cannot proceed. + */ + Error ("Unknown option type: 0x%02X", Type); + break; + } } /* Destroy the string pool */ @@ -443,19 +443,19 @@ void DumpObjFiles (FILE* F, unsigned long Offset) /* Read and print all files */ for (I = 0; I < Count; ++I) { - /* Read the data for one file */ - const char* Name = GetString (&StrPool, ReadVar (F)); - unsigned long MTime = Read32 (F); - unsigned long Size = ReadVar (F); - unsigned Len = strlen (Name); + /* Read the data for one file */ + const char* Name = GetString (&StrPool, ReadVar (F)); + unsigned long MTime = Read32 (F); + unsigned long Size = ReadVar (F); + unsigned Len = strlen (Name); - /* Print the header */ - printf (" Index:%27u\n", I); + /* Print the header */ + printf (" Index:%27u\n", I); - /* Print the data */ - printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); - printf (" Size:%26lu\n", Size); - printf (" Modification time:%13lu (%s)\n", MTime, TimeToStr (MTime)); + /* Print the data */ + printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); + printf (" Size:%26lu\n", Size); + printf (" Modification time:%13lu (%s)\n", MTime, TimeToStr (MTime)); } /* Destroy the string pool */ @@ -493,28 +493,28 @@ void DumpObjSegments (FILE* F, unsigned long Offset) /* Read and print all segments */ for (I = 0; I < Count; ++I) { - /* Read the data for one segments */ + /* Read the data for one segments */ unsigned long DataSize = Read32 (F); unsigned long NextSeg = ftell (F) + DataSize; - const char* Name = GetString (&StrPool, ReadVar (F)); - unsigned Len = strlen (Name); + const char* Name = GetString (&StrPool, ReadVar (F)); + unsigned Len = strlen (Name); unsigned Flags = ReadVar (F); - unsigned long Size = ReadVar (F); - unsigned long Align = ReadVar (F); - unsigned char AddrSize = Read8 (F); + unsigned long Size = ReadVar (F); + unsigned long Align = ReadVar (F); + unsigned char AddrSize = Read8 (F); unsigned long FragCount = ReadVar (F); - /* Print the header */ - printf (" Index:%27u\n", I); + /* Print the header */ + printf (" Index:%27u\n", I); - /* Print the data */ - printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); + /* Print the data */ + printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); printf (" Flags:%25u\n", Flags); - printf (" Size:%26lu\n", Size); - printf (" Alignment:%21lu\n", Align); - printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, + printf (" Size:%26lu\n", Size); + printf (" Alignment:%21lu\n", Align); + printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, AddrSizeToStr (AddrSize)); - printf (" Fragment count:%16lu\n", FragCount); + printf (" Fragment count:%16lu\n", FragCount); /* Seek to the end of the segment data (start of next) */ FileSetPos (F, NextSeg); @@ -555,22 +555,22 @@ void DumpObjImports (FILE* F, unsigned long Offset) /* Read and print all imports */ for (I = 0; I < Count; ++I) { - /* Read the data for one import */ - unsigned char AddrSize = Read8 (F); - const char* Name = GetString (&StrPool, ReadVar (F)); - unsigned Len = strlen (Name); + /* Read the data for one import */ + unsigned char AddrSize = Read8 (F); + const char* Name = GetString (&StrPool, ReadVar (F)); + unsigned Len = strlen (Name); /* Skip both line info lists */ SkipLineInfoList (F); SkipLineInfoList (F); - /* Print the header */ - printf (" Index:%27u\n", I); + /* Print the header */ + printf (" Index:%27u\n", I); - /* Print the data */ - printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, + /* Print the data */ + printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, AddrSizeToStr (AddrSize)); - printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); + printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); } /* Destroy the string pool */ @@ -582,10 +582,10 @@ void DumpObjImports (FILE* F, unsigned long Offset) void DumpObjExports (FILE* F, unsigned long Offset) /* Dump the exports in the object file */ { - ObjHeader H; + ObjHeader H; Collection StrPool = AUTO_COLLECTION_INITIALIZER; - unsigned Count; - unsigned I; + unsigned Count; + unsigned I; /* Seek to the header position and read the header */ FileSetPos (F, Offset); @@ -608,24 +608,24 @@ void DumpObjExports (FILE* F, unsigned long Offset) /* Read and print all exports */ for (I = 0; I < Count; ++I) { - unsigned long Value = 0; + unsigned long Value = 0; unsigned long Size = 0; - unsigned char ConDes[CD_TYPE_COUNT]; - const char* Name; - unsigned Len; + unsigned char ConDes[CD_TYPE_COUNT]; + const char* Name; + unsigned Len; - /* Read the data for one export */ - unsigned Type = ReadVar (F); + /* Read the data for one export */ + unsigned Type = ReadVar (F); unsigned char AddrSize = Read8 (F); - ReadData (F, ConDes, SYM_GET_CONDES_COUNT (Type)); - Name = GetString (&StrPool, ReadVar (F)); - Len = strlen (Name); - if (SYM_IS_CONST (Type)) { - Value = Read32 (F); - } else { - SkipExpr (F); - } + ReadData (F, ConDes, SYM_GET_CONDES_COUNT (Type)); + Name = GetString (&StrPool, ReadVar (F)); + Len = strlen (Name); + if (SYM_IS_CONST (Type)) { + Value = Read32 (F); + } else { + SkipExpr (F); + } if (SYM_HAS_SIZE (Type)) { Size = ReadVar (F); } @@ -634,20 +634,20 @@ void DumpObjExports (FILE* F, unsigned long Offset) SkipLineInfoList (F); SkipLineInfoList (F); - /* Print the header */ - printf (" Index:%27u\n", I); + /* Print the header */ + printf (" Index:%27u\n", I); - /* Print the data */ - printf (" Type:%22s0x%02X (%s)\n", "", Type, GetExportFlags (Type, ConDes)); - printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, + /* Print the data */ + printf (" Type:%22s0x%02X (%s)\n", "", Type, GetExportFlags (Type, ConDes)); + printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, AddrSizeToStr (AddrSize)); - printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); - if (SYM_IS_CONST (Type)) { - printf (" Value:%15s0x%08lX (%lu)\n", "", Value, Value); - } - if (SYM_HAS_SIZE (Type)) { - printf (" Size:%16s0x%04lX (%lu)\n", "", Size, Size); - } + printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); + if (SYM_IS_CONST (Type)) { + printf (" Value:%15s0x%08lX (%lu)\n", "", Value, Value); + } + if (SYM_HAS_SIZE (Type)) { + printf (" Size:%16s0x%04lX (%lu)\n", "", Size, Size); + } } /* Destroy the string pool */ @@ -680,9 +680,9 @@ void DumpObjDbgSyms (FILE* F, unsigned long Offset) /* Check if the object file was compiled with debug info */ if ((H.Flags & OBJ_FLAGS_DBGINFO) == 0) { - /* Print that there no debug symbols and bail out */ - printf (" Count:%27u\n", 0); - return; + /* Print that there no debug symbols and bail out */ + printf (" Count:%27u\n", 0); + return; } /* Read the number of exports and print it */ @@ -692,22 +692,22 @@ void DumpObjDbgSyms (FILE* F, unsigned long Offset) /* Read and print all debug symbols */ for (I = 0; I < Count; ++I) { - unsigned long Value = 0; + unsigned long Value = 0; unsigned long Size = 0; unsigned ImportId = 0; unsigned ExportId = 0; - /* Read the data for one symbol */ - unsigned Type = ReadVar (F); + /* Read the data for one symbol */ + unsigned Type = ReadVar (F); unsigned char AddrSize = Read8 (F); unsigned long Owner = ReadVar (F); - const char* Name = GetString (&StrPool, ReadVar (F)); - unsigned Len = strlen (Name); - if (SYM_IS_CONST (Type)) { - Value = Read32 (F); - } else { - SkipExpr (F); - } + const char* Name = GetString (&StrPool, ReadVar (F)); + unsigned Len = strlen (Name); + if (SYM_IS_CONST (Type)) { + Value = Read32 (F); + } else { + SkipExpr (F); + } if (SYM_HAS_SIZE (Type)) { Size = ReadVar (F); } @@ -722,27 +722,27 @@ void DumpObjDbgSyms (FILE* F, unsigned long Offset) SkipLineInfoList (F); SkipLineInfoList (F); - /* Print the header */ - printf (" Index:%27u\n", I); + /* Print the header */ + printf (" Index:%27u\n", I); - /* Print the data */ - printf (" Type:%22s0x%02X (%s)\n", "", Type, GetExportFlags (Type, 0)); - printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, + /* Print the data */ + printf (" Type:%22s0x%02X (%s)\n", "", Type, GetExportFlags (Type, 0)); + printf (" Address size:%14s0x%02X (%s)\n", "", AddrSize, AddrSizeToStr (AddrSize)); - printf (" Owner:%25lu\n", Owner); - printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); - if (SYM_IS_CONST (Type)) { - printf (" Value:%15s0x%08lX (%lu)\n", "", Value, Value); - } - if (SYM_HAS_SIZE (Type)) { - printf (" Size:%20s0x%04lX (%lu)\n", "", Size, Size); - } - if (SYM_IS_IMPORT (Type)) { - printf (" Import:%24u\n", ImportId); - } - if (SYM_IS_EXPORT (Type)) { - printf (" Export:%24u\n", ExportId); - } + printf (" Owner:%25lu\n", Owner); + printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); + if (SYM_IS_CONST (Type)) { + printf (" Value:%15s0x%08lX (%lu)\n", "", Value, Value); + } + if (SYM_HAS_SIZE (Type)) { + printf (" Size:%20s0x%04lX (%lu)\n", "", Size, Size); + } + if (SYM_IS_IMPORT (Type)) { + printf (" Import:%24u\n", ImportId); + } + if (SYM_IS_EXPORT (Type)) { + printf (" Export:%24u\n", ExportId); + } } /* Destroy the string pool */ @@ -775,9 +775,9 @@ void DumpObjLineInfo (FILE* F, unsigned long Offset) /* Check if the object file was compiled with debug info */ if ((H.Flags & OBJ_FLAGS_DBGINFO) == 0) { - /* Print that there no line infos and bail out */ - printf (" Count:%27u\n", 0); - return; + /* Print that there no line infos and bail out */ + printf (" Count:%27u\n", 0); + return; } /* Read the number of line infos and print it */ @@ -787,11 +787,11 @@ void DumpObjLineInfo (FILE* F, unsigned long Offset) /* Read and print all line infos */ for (I = 0; I < Count; ++I) { - FilePos Pos; + FilePos Pos; unsigned Type; - /* File position of line info */ - ReadFilePos (F, &Pos); + /* File position of line info */ + ReadFilePos (F, &Pos); /* Type of line info */ Type = ReadVar (F); @@ -799,15 +799,15 @@ void DumpObjLineInfo (FILE* F, unsigned long Offset) /* Skip the spans */ SkipSpanList (F); - /* Print the header */ - printf (" Index:%27u\n", I); + /* Print the header */ + printf (" Index:%27u\n", I); - /* Print the data */ + /* Print the data */ printf (" Type:%26u\n", LI_GET_TYPE (Type)); printf (" Count:%25u\n", LI_GET_COUNT (Type)); - printf (" Line:%26u\n", Pos.Line); - printf (" Col:%27u\n", Pos.Col); - printf (" Name:%26u\n", Pos.Name); + printf (" Line:%26u\n", Pos.Line); + printf (" Col:%27u\n", Pos.Col); + printf (" Name:%26u\n", Pos.Name); } /* Destroy the string pool */ @@ -840,9 +840,9 @@ void DumpObjScopes (FILE* F, unsigned long Offset) /* Check if the object file was compiled with debug info */ if ((H.Flags & OBJ_FLAGS_DBGINFO) == 0) { - /* Print that there no scopes and bail out */ - printf (" Count:%27u\n", 0); - return; + /* Print that there no scopes and bail out */ + printf (" Count:%27u\n", 0); + return; } /* Read the number of scopes and print it */ @@ -861,25 +861,25 @@ void DumpObjScopes (FILE* F, unsigned long Offset) unsigned Flags = ReadVar (F); const char* ScopeType = GetScopeType (ReadVar (F)); - /* Print the header */ - printf (" Index:%27u\n", I); + /* Print the header */ + printf (" Index:%27u\n", I); - /* Print the data */ + /* Print the data */ printf (" Parent id:%21u\n", ParentId); printf (" Lexical level:%17u\n", LexicalLevel); - printf (" Flags:%21s0x%02X\n", "", Flags); + printf (" Flags:%21s0x%02X\n", "", Flags); printf (" Type:%26s\n", ScopeType); /* Resolve and print the name */ - Name = GetString (&StrPool, ReadVar (F)); - Len = strlen (Name); - printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); + Name = GetString (&StrPool, ReadVar (F)); + Len = strlen (Name); + printf (" Name:%*s\"%s\"\n", (int)(24-Len), "", Name); /* Size */ - if (SCOPE_HAS_SIZE (Flags)) { + if (SCOPE_HAS_SIZE (Flags)) { unsigned long Size = ReadVar (F); - printf (" Size:%20s0x%04lX (%lu)\n", "", Size, Size); - } + printf (" Size:%20s0x%04lX (%lu)\n", "", Size, Size); + } /* Label */ if (SCOPE_HAS_LABEL (Flags)) { @@ -926,11 +926,11 @@ void DumpObjSegSize (FILE* F, unsigned long Offset) unsigned long Size; - /* Read the data for one segment */ + /* Read the data for one segment */ unsigned long DataSize = Read32 (F); unsigned long NextSeg = ftell (F) + DataSize; - const char* Name = GetString (&StrPool, ReadVar (F)); - unsigned Len = strlen (Name); + const char* Name = GetString (&StrPool, ReadVar (F)); + unsigned Len = strlen (Name); /* Skip segment flags, read size */ (void) ReadVar (F); @@ -941,8 +941,8 @@ void DumpObjSegSize (FILE* F, unsigned long Offset) (void) Read8 (F); (void) ReadVar (F); - /* Print the size for this segment */ - printf (" %s:%*s%6lu\n", Name, (int)(24-Len), "", Size); + /* Print the size for this segment */ + printf (" %s:%*s%6lu\n", Name, (int)(24-Len), "", Size); /* Seek to the end of the segment data (start of next) */ FileSetPos (F, NextSeg); diff --git a/src/od65/dump.h b/src/od65/dump.h index 23971fe83..eafb86a3c 100644 --- a/src/od65/dump.h +++ b/src/od65/dump.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* dump.h */ +/* dump.h */ /* */ -/* Dump subroutines for the od65 object file dump utility */ +/* Dump subroutines for the od65 object file dump utility */ /* */ /* */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/od65/error.c b/src/od65/error.c index 3d934e5c1..2b5827571 100644 --- a/src/od65/error.c +++ b/src/od65/error.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* error.c */ +/* error.c */ /* */ -/* Error handling for the od65 object file dump utility */ +/* Error handling for the od65 object file dump utility */ /* */ /* */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/od65/error.h b/src/od65/error.h index af5c907fd..16eabdb0e 100644 --- a/src/od65/error.h +++ b/src/od65/error.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ -/* Error handling for the od65 object file dump utility */ +/* Error handling for the od65 object file dump utility */ /* */ /* */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/od65/fileio.c b/src/od65/fileio.c index a14935006..9ddab17af 100644 --- a/src/od65/fileio.c +++ b/src/od65/fileio.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fileio.c */ +/* fileio.c */ /* */ -/* File I/O for the od65 object file dump utility */ +/* File I/O for the od65 object file dump utility */ /* */ /* */ /* */ @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -55,7 +55,7 @@ void FileSetPos (FILE* F, unsigned long Pos) /* Seek to the given absolute position, fail on errors */ { if (fseek (F, Pos, SEEK_SET) != 0) { - Error ("Cannot seek: %s", strerror (errno)); + Error ("Cannot seek: %s", strerror (errno)); } } @@ -66,7 +66,7 @@ unsigned long FileGetPos (FILE* F) { long Pos = ftell (F); if (Pos < 0) { - Error ("Error in ftell: %s", strerror (errno)); + Error ("Error in ftell: %s", strerror (errno)); } return Pos; } @@ -78,7 +78,7 @@ unsigned Read8 (FILE* F) { int C = getc (F); if (C == EOF) { - Error ("Read error (file corrupt?)"); + Error ("Read error (file corrupt?)"); } return C; } @@ -123,8 +123,8 @@ long Read32Signed (FILE* F) /* Sign extend the value */ if (V & 0x80000000UL) { - /* Signed value */ - V |= ~0xFFFFFFFFUL; + /* Signed value */ + V |= ~0xFFFFFFFFUL; } /* Return it as a long */ @@ -143,12 +143,12 @@ unsigned long ReadVar (FILE* F) unsigned long V = 0; unsigned Shift = 0; do { - /* Read one byte */ - C = Read8 (F); - /* Encode it into the target value */ - V |= ((unsigned long)(C & 0x7F)) << Shift; - /* Next value */ - Shift += 7; + /* Read one byte */ + C = Read8 (F); + /* Encode it into the target value */ + V |= ((unsigned long)(C & 0x7F)) << Shift; + /* Next value */ + Shift += 7; } while (C & 0x80); /* Return the value read */ @@ -180,7 +180,7 @@ FilePos* ReadFilePos (FILE* F, FilePos* Pos) /* Read a file position from the file */ { /* Read the data fields */ - Pos->Line = ReadVar (F); + Pos->Line = ReadVar (F); Pos->Col = ReadVar (F); Pos->Name = ReadVar (F); return Pos; @@ -193,9 +193,9 @@ void* ReadData (FILE* F, void* Data, unsigned Size) { /* Accept zero sized reads */ if (Size > 0) { - if (fread (Data, 1, Size, F) != Size) { - Error ("Read error (file corrupt?)"); - } + if (fread (Data, 1, Size, F) != Size) { + Error ("Read error (file corrupt?)"); + } } return Data; } @@ -206,15 +206,15 @@ void ReadObjHeader (FILE* F, ObjHeader* H) /* Read an object file header from the file */ { /* Read all fields */ - H->Magic = Read32 (F); - H->Version = Read16 (F); - H->Flags = Read16 (F); + H->Magic = Read32 (F); + H->Version = Read16 (F); + H->Flags = Read16 (F); H->OptionOffs = Read32 (F); H->OptionSize = Read32 (F); - H->FileOffs = Read32 (F); - H->FileSize = Read32 (F); - H->SegOffs = Read32 (F); - H->SegSize = Read32 (F); + H->FileOffs = Read32 (F); + H->FileSize = Read32 (F); + H->SegOffs = Read32 (F); + H->SegSize = Read32 (F); H->ImportOffs = Read32 (F); H->ImportSize = Read32 (F); H->ExportOffs = Read32 (F); diff --git a/src/od65/fileio.h b/src/od65/fileio.h index 1601fbee8..cf05a7dad 100644 --- a/src/od65/fileio.h +++ b/src/od65/fileio.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* fileio.h */ +/* fileio.h */ /* */ -/* File I/O for the od65 object file dump utility */ +/* File I/O for the od65 object file dump utility */ /* */ /* */ /* */ @@ -48,7 +48,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/od65/global.c b/src/od65/global.c index 64e14c272..eb6555154 100644 --- a/src/od65/global.c +++ b/src/od65/global.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ -/* Global variables for the od65 object file dump utility */ +/* Global variables for the od65 object file dump utility */ /* */ /* */ /* */ @@ -38,12 +38,12 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -unsigned What = 0; /* What should get dumped? */ +unsigned What = 0; /* What should get dumped? */ diff --git a/src/od65/global.h b/src/od65/global.h index 7cc531f6e..624fe2a84 100644 --- a/src/od65/global.h +++ b/src/od65/global.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ -/* Global variables for the od65 object file dump utility */ +/* Global variables for the od65 object file dump utility */ /* */ /* */ /* */ @@ -39,26 +39,26 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -#define D_HEADER 0x0001U /* Dump the header */ -#define D_OPTIONS 0x0002U /* Dump the options */ -#define D_FILES 0x0004U /* Dump source file info */ -#define D_SEGMENTS 0x0008U /* Dump segment info */ -#define D_IMPORTS 0x0010U /* Dump imported symbols */ -#define D_EXPORTS 0x0020U /* Dump exported symbols */ -#define D_DBGSYMS 0x0040U /* Dump debug symbols */ +#define D_HEADER 0x0001U /* Dump the header */ +#define D_OPTIONS 0x0002U /* Dump the options */ +#define D_FILES 0x0004U /* Dump source file info */ +#define D_SEGMENTS 0x0008U /* Dump segment info */ +#define D_IMPORTS 0x0010U /* Dump imported symbols */ +#define D_EXPORTS 0x0020U /* Dump exported symbols */ +#define D_DBGSYMS 0x0040U /* Dump debug symbols */ #define D_LINEINFO 0x0080U /* Dump line infos */ #define D_SCOPES 0x0100U /* Dump scopes */ #define D_SEGSIZE 0x0200U /* Dump segment sizes */ -#define D_ALL 0xFFFFU /* Dump anything */ +#define D_ALL 0xFFFFU /* Dump anything */ -extern unsigned What; /* What should get dumped? */ +extern unsigned What; /* What should get dumped? */ diff --git a/src/od65/main.c b/src/od65/main.c index ce1a54535..aa0e6f86d 100644 --- a/src/od65/main.c +++ b/src/od65/main.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* main.c */ +/* main.c */ /* */ -/* Main program of the od65 object file dump utility */ +/* Main program of the od65 object file dump utility */ /* */ /* */ /* */ @@ -52,7 +52,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -62,7 +62,7 @@ static unsigned FilesProcessed = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -71,32 +71,32 @@ static void Usage (void) /* Print usage information and exit */ { printf ("Usage: %s [options] file [options] [file]\n" - "Short options:\n" - " -h\t\t\tHelp (this text)\n" - " -H\t\t\tDump the object file header\n" - " -S\t\t\tDump segments sizes\n" - " -V\t\t\tPrint the version number and exit\n" - "\n" - "Long options:\n" - " --dump-all\t\tDump all object file information\n" - " --dump-dbgsyms\tDump debug symbols\n" - " --dump-exports\tDump exported symbols\n" - " --dump-files\t\tDump the source files\n" - " --dump-header\t\tDump the object file header\n" - " --dump-imports\tDump imported symbols\n" - " --dump-lineinfo\tDump line information\n" - " --dump-options\tDump object file options\n" - " --dump-segments\tDump the segments in the file\n" - " --dump-segsize\tDump segments sizes\n" - " --help\t\tHelp (this text)\n" - " --version\t\tPrint the version number and exit\n", - ProgName); + "Short options:\n" + " -h\t\t\tHelp (this text)\n" + " -H\t\t\tDump the object file header\n" + " -S\t\t\tDump segments sizes\n" + " -V\t\t\tPrint the version number and exit\n" + "\n" + "Long options:\n" + " --dump-all\t\tDump all object file information\n" + " --dump-dbgsyms\tDump debug symbols\n" + " --dump-exports\tDump exported symbols\n" + " --dump-files\t\tDump the source files\n" + " --dump-header\t\tDump the object file header\n" + " --dump-imports\tDump imported symbols\n" + " --dump-lineinfo\tDump line information\n" + " --dump-options\tDump object file options\n" + " --dump-segments\tDump the segments in the file\n" + " --dump-segsize\tDump segments sizes\n" + " --help\t\tHelp (this text)\n" + " --version\t\tPrint the version number and exit\n", + ProgName); } static void OptDumpAll (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump all object file information */ { What |= D_ALL; @@ -105,7 +105,7 @@ static void OptDumpAll (const char* Opt attribute ((unused)), static void OptDumpDbgSyms (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump debug symbols contained in the object file */ { What |= D_DBGSYMS; @@ -114,7 +114,7 @@ static void OptDumpDbgSyms (const char* Opt attribute ((unused)), static void OptDumpExports (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump the exported symbols */ { What |= D_EXPORTS; @@ -123,7 +123,7 @@ static void OptDumpExports (const char* Opt attribute ((unused)), static void OptDumpFiles (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump the source files */ { What |= D_FILES; @@ -132,7 +132,7 @@ static void OptDumpFiles (const char* Opt attribute ((unused)), static void OptDumpHeader (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump the object file header */ { What |= D_HEADER; @@ -141,7 +141,7 @@ static void OptDumpHeader (const char* Opt attribute ((unused)), static void OptDumpImports (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump the imported symbols */ { What |= D_IMPORTS; @@ -150,7 +150,7 @@ static void OptDumpImports (const char* Opt attribute ((unused)), static void OptDumpLineInfo (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump the line infos */ { What |= D_LINEINFO; @@ -159,7 +159,7 @@ static void OptDumpLineInfo (const char* Opt attribute ((unused)), static void OptDumpOptions (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump the object file options */ { What |= D_OPTIONS; @@ -168,7 +168,7 @@ static void OptDumpOptions (const char* Opt attribute ((unused)), static void OptDumpScopes (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump the scopes in the object file */ { What |= D_SCOPES; @@ -177,7 +177,7 @@ static void OptDumpScopes (const char* Opt attribute ((unused)), static void OptDumpSegments (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump the segments in the object file */ { What |= D_SEGMENTS; @@ -186,7 +186,7 @@ static void OptDumpSegments (const char* Opt attribute ((unused)), static void OptDumpSegSize (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Dump the segments in the object file */ { What |= D_SEGSIZE; @@ -195,7 +195,7 @@ static void OptDumpSegSize (const char* Opt attribute ((unused)), static void OptHelp (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print usage information and exit */ { Usage (); @@ -205,7 +205,7 @@ static void OptHelp (const char* Opt attribute ((unused)), static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print the assembler version */ { fprintf (stderr, "%s V%s\n", ProgName, GetVersionAsString ()); @@ -221,7 +221,7 @@ static void DumpFile (const char* Name) /* Try to open the file */ FILE* F = fopen (Name, "rb"); if (F == 0) { - Error ("Cannot open `%s': %s", Name, strerror (errno)); + Error ("Cannot open `%s': %s", Name, strerror (errno)); } /* Read the magic word */ @@ -230,50 +230,50 @@ static void DumpFile (const char* Name) /* Do we know this type of file? */ if (Magic != OBJ_MAGIC) { - /* Unknown format */ - printf ("%s: (no xo65 object file)\n", Name); + /* Unknown format */ + printf ("%s: (no xo65 object file)\n", Name); } else if (What == 0) { - /* Special handling if no info was requested */ - printf ("%s: (no information requested)\n", Name); + /* Special handling if no info was requested */ + printf ("%s: (no information requested)\n", Name); } else { - /* Print the filename */ - printf ("%s:\n", Name); + /* Print the filename */ + printf ("%s:\n", Name); - /* Check what to dump */ - if (What & D_HEADER) { - DumpObjHeader (F, 0); - } - if (What & D_OPTIONS) { - DumpObjOptions (F, 0); - } - if (What & D_FILES) { - DumpObjFiles (F, 0); - } - if (What & D_SEGMENTS) { - DumpObjSegments (F, 0); - } - if (What & D_IMPORTS) { - DumpObjImports (F, 0); - } - if (What & D_EXPORTS) { - DumpObjExports (F, 0); - } - if (What & D_DBGSYMS) { - DumpObjDbgSyms (F, 0); - } - if (What & D_LINEINFO) { - DumpObjLineInfo (F, 0); - } - if (What & D_SCOPES) { - DumpObjScopes (F, 0); - } - if (What & D_SEGSIZE) { - DumpObjSegSize (F, 0); - } + /* Check what to dump */ + if (What & D_HEADER) { + DumpObjHeader (F, 0); + } + if (What & D_OPTIONS) { + DumpObjOptions (F, 0); + } + if (What & D_FILES) { + DumpObjFiles (F, 0); + } + if (What & D_SEGMENTS) { + DumpObjSegments (F, 0); + } + if (What & D_IMPORTS) { + DumpObjImports (F, 0); + } + if (What & D_EXPORTS) { + DumpObjExports (F, 0); + } + if (What & D_DBGSYMS) { + DumpObjDbgSyms (F, 0); + } + if (What & D_LINEINFO) { + DumpObjLineInfo (F, 0); + } + if (What & D_SCOPES) { + DumpObjScopes (F, 0); + } + if (What & D_SEGSIZE) { + DumpObjSegSize (F, 0); + } } /* Close the file */ @@ -287,19 +287,19 @@ int main (int argc, char* argv []) { /* Program long options */ static const LongOpt OptTab[] = { - { "--dump-all", 0, OptDumpAll }, - { "--dump-dbgsyms", 0, OptDumpDbgSyms }, - { "--dump-exports", 0, OptDumpExports }, - { "--dump-files", 0, OptDumpFiles }, - { "--dump-header", 0, OptDumpHeader }, - { "--dump-imports", 0, OptDumpImports }, + { "--dump-all", 0, OptDumpAll }, + { "--dump-dbgsyms", 0, OptDumpDbgSyms }, + { "--dump-exports", 0, OptDumpExports }, + { "--dump-files", 0, OptDumpFiles }, + { "--dump-header", 0, OptDumpHeader }, + { "--dump-imports", 0, OptDumpImports }, { "--dump-lineinfo", 0, OptDumpLineInfo }, - { "--dump-options", 0, OptDumpOptions }, + { "--dump-options", 0, OptDumpOptions }, { "--dump-scopes", 0, OptDumpScopes }, - { "--dump-segments", 0, OptDumpSegments }, - { "--dump-segsize", 0, OptDumpSegSize }, - { "--help", 0, OptHelp }, - { "--version", 0, OptVersion }, + { "--dump-segments", 0, OptDumpSegments }, + { "--dump-segsize", 0, OptDumpSegSize }, + { "--help", 0, OptHelp }, + { "--version", 0, OptVersion }, }; unsigned I; @@ -311,51 +311,51 @@ int main (int argc, char* argv []) I = 1; while (I < ArgCount) { - /* Get the argument */ - const char* Arg = ArgVec[I]; + /* Get the argument */ + const char* Arg = ArgVec[I]; - /* Check for an option */ - if (Arg [0] == '-') { - switch (Arg [1]) { + /* Check for an option */ + if (Arg [0] == '-') { + switch (Arg [1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; - case 'h': - OptHelp (Arg, 0); - break; + case 'h': + OptHelp (Arg, 0); + break; - case 'H': - OptDumpHeader (Arg, 0); - break; + case 'H': + OptDumpHeader (Arg, 0); + break; - case 'S': - OptDumpSegSize (Arg, 0); - break; + case 'S': + OptDumpSegSize (Arg, 0); + break; - case 'V': - OptVersion (Arg, 0); - break; + case 'V': + OptVersion (Arg, 0); + break; - default: - UnknownOption (Arg); - break; + default: + UnknownOption (Arg); + break; - } - } else { - /* Filename. Dump it. */ - DumpFile (Arg); - ++FilesProcessed; - } + } + } else { + /* Filename. Dump it. */ + DumpFile (Arg); + ++FilesProcessed; + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Print a message if we did not process any files */ if (FilesProcessed == 0) { - fprintf (stderr, "%s: No input files\n", ProgName); + fprintf (stderr, "%s: No input files\n", ProgName); } /* Success */ diff --git a/src/sim65/addrspace.c b/src/sim65/addrspace.c index 78c069437..8cb663e50 100644 --- a/src/sim65/addrspace.c +++ b/src/sim65/addrspace.c @@ -46,7 +46,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/addrspace.h b/src/sim65/addrspace.h index 8d50156b4..ae8228fdf 100644 --- a/src/sim65/addrspace.h +++ b/src/sim65/addrspace.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -61,7 +61,7 @@ struct AddressSpace { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/callback.c b/src/sim65/callback.c index 19e1d5f88..8dea9ade7 100644 --- a/src/sim65/callback.c +++ b/src/sim65/callback.c @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -101,17 +101,17 @@ static void RemoveCallback (Callback* C) Callback* N; Callback** L = &List; while ((N = *L) != 0) { - if (N == C) { - /* Found, remove it */ - if (C->Next) { - /* Adjust the counter of the following callback */ - C->Next->Ticks += C->Ticks; - } - *L = C->Next; - return; - } else { - L = &N->Next; - } + if (N == C) { + /* Found, remove it */ + if (C->Next) { + /* Adjust the counter of the following callback */ + C->Next->Ticks += C->Ticks; + } + *L = C->Next; + return; + } else { + L = &N->Next; + } } /* Callback was not found */ @@ -121,7 +121,7 @@ static void RemoveCallback (Callback* C) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/callback.h b/src/sim65/callback.h index 637e66c4e..0797a9604 100644 --- a/src/sim65/callback.h +++ b/src/sim65/callback.h @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -53,7 +53,7 @@ typedef struct Callback Callback; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/cfgdata.c b/src/sim65/cfgdata.c index e1cbf98e9..00a9ef744 100644 --- a/src/sim65/cfgdata.c +++ b/src/sim65/cfgdata.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* cfgdata.c */ +/* cfgdata.c */ /* */ -/* Config data structure */ +/* Config data structure */ /* */ /* */ /* */ diff --git a/src/sim65/cfgdata.h b/src/sim65/cfgdata.h index f1a278f92..1d43d4789 100644 --- a/src/sim65/cfgdata.h +++ b/src/sim65/cfgdata.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* cfgdata.h */ +/* cfgdata.h */ /* */ -/* Config data structure */ +/* Config data structure */ /* */ /* */ /* */ @@ -53,17 +53,17 @@ typedef struct CfgData CfgData; struct CfgData { enum { CfgDataInvalid, - CfgDataId, - CfgDataNumber, - CfgDataString - } Type; /* Type of the value */ + CfgDataId, + CfgDataNumber, + CfgDataString + } Type; /* Type of the value */ union { char* SVal; /* String or id value */ - long IVal; /* Integer value */ + long IVal; /* Integer value */ } V; unsigned Line; /* Line where the attribute was defined */ unsigned Col; /* Column of attribute definition */ - char Attr[1]; /* The attribute name */ + char Attr[1]; /* The attribute name */ }; diff --git a/src/sim65/chip.c b/src/sim65/chip.c index 4a3cc39a1..2b5ae940b 100644 --- a/src/sim65/chip.c +++ b/src/sim65/chip.c @@ -95,8 +95,8 @@ static Collection ChipLibraries = STATIC_COLLECTION_INITIALIZER; /* SimData instance */ static const SimData Sim65Data = { - 1, /* MajorVersion */ - 1, /* MinorVersion */ + 1, /* MajorVersion */ + 1, /* MinorVersion */ xmalloc, xfree, Warning, @@ -158,7 +158,7 @@ static int GetCfgNum (void* CfgInfo, const char* Name, long* Val) static int CmpChips (void* Data attribute ((unused)), - const void* lhs, const void* rhs) + const void* lhs, const void* rhs) /* Compare function for CollSort */ { /* Cast the object pointers */ @@ -181,14 +181,14 @@ static Chip* FindChip (const char* Name) /* ## We do a linear search for now */ for (I = 0; I < CollCount (&Chips); ++I) { - /* Get the chip at this position */ - Chip* C = CollAt (&Chips, I); + /* Get the chip at this position */ + Chip* C = CollAt (&Chips, I); - /* Compare the name */ - if (strcmp (Name, C->Data->ChipName) == 0) { - /* Found */ - return C; - } + /* Compare the name */ + if (strcmp (Name, C->Data->ChipName) == 0) { + /* Found */ + return C; + } } /* Not found */ @@ -198,7 +198,7 @@ static Chip* FindChip (const char* Name) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -358,7 +358,7 @@ void LoadChipLibrary (const char* LibName) /* Check the error message */ Msg = dlerror (); if (Msg) { - /* We had an error */ + /* We had an error */ Error ("Cannot find export `GetChipData' in `%s': %s", L->LibName, Msg); FreeChipLibrary (L); return; @@ -395,8 +395,8 @@ void LoadChipLibrary (const char* LibName) continue; } - /* Initialize the chip passing the simulator data */ - D->InitChip (&Sim65Data); + /* Initialize the chip passing the simulator data */ + D->InitChip (&Sim65Data); /* Generate a new chip */ C = NewChip (L, D); @@ -407,7 +407,7 @@ void LoadChipLibrary (const char* LibName) /* Output chip name and version to keep the user happy */ Print (stdout, 1, " Found %s `%s', version %u.%u in library `%s'\n", - (D->Type == CHIPDATA_TYPE_CHIP)? "chip" : "cpu", + (D->Type == CHIPDATA_TYPE_CHIP)? "chip" : "cpu", D->ChipName, D->MajorVersion, D->MinorVersion, diff --git a/src/sim65/chip.h b/src/sim65/chip.h index ddfad2475..d45f8c1f7 100644 --- a/src/sim65/chip.h +++ b/src/sim65/chip.h @@ -87,7 +87,7 @@ struct ChipLibrary { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/chipdata.h b/src/sim65/chipdata.h index 98cb08ad3..916a718ff 100644 --- a/src/sim65/chipdata.h +++ b/src/sim65/chipdata.h @@ -65,7 +65,7 @@ struct ChipData { /* -- Exported functions -- */ int (*InitChip) (const struct SimData* Data); void* (*CreateInstance) (unsigned Addr, unsigned Range, void* CfgInfo); - void (*DestroyInstance) (void* Data); + void (*DestroyInstance) (void* Data); void (*WriteCtrl) (void* Data, unsigned Offs, unsigned char Val); void (*Write) (void* Data, unsigned Offs, unsigned char Val); unsigned char (*ReadCtrl) (void* Data, unsigned Offs); diff --git a/src/sim65/chipif.h b/src/sim65/chipif.h index 93133d0ce..f5f1ab102 100644 --- a/src/sim65/chipif.h +++ b/src/sim65/chipif.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* chipif.h */ +/* chipif.h */ /* */ /* Interface header file for chip plugins - unused by sim65 */ /* */ diff --git a/src/sim65/chippath.c b/src/sim65/chippath.c index d3befeeea..88fc7d5f2 100644 --- a/src/sim65/chippath.c +++ b/src/sim65/chippath.c @@ -49,7 +49,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -59,7 +59,7 @@ SearchPath* ChipSearchPath; /* Search paths for chip libs */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/chippath.h b/src/sim65/chippath.h index 1bc864a5a..be61bb517 100644 --- a/src/sim65/chippath.h +++ b/src/sim65/chippath.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -54,7 +54,7 @@ extern SearchPath* ChipSearchPath; /* Search paths for chip libs */ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/chips/console.c b/src/sim65/chips/console.c index 528925b14..526cc04f1 100644 --- a/src/sim65/chips/console.c +++ b/src/sim65/chips/console.c @@ -106,7 +106,7 @@ static const struct ChipData CData[] = { /* -- Exported functions -- */ ScreenInitChip, ScreenCreateInstance, - ScreenDestroyInstance, + ScreenDestroyInstance, ScreenWrite, ScreenWrite, ScreenRead, @@ -624,7 +624,7 @@ static void ScreenEventLoop (void) switch (Event.type) { case Expose: - /* Calculate the area to redraw, then update the screen */ + /* Calculate the area to redraw, then update the screen */ X1 = Event.xexpose.x; Y1 = Event.xexpose.y; X2 = Event.xexpose.x + Event.xexpose.width - 1; diff --git a/src/sim65/chips/ram.c b/src/sim65/chips/ram.c index 6ca4b5089..61691aaa8 100644 --- a/src/sim65/chips/ram.c +++ b/src/sim65/chips/ram.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* ram.c */ +/* ram.c */ /* */ -/* RAM plugin for the sim65 6502 simulator */ +/* RAM plugin for the sim65 6502 simulator */ /* */ /* */ /* */ @@ -87,7 +87,7 @@ static const struct ChipData CData[1] = { /* -- Exported functions -- */ InitChip, CreateInstance, - DestroyInstance, + DestroyInstance, WriteCtrl, Write, ReadCtrl, @@ -100,7 +100,7 @@ static const SimData* Sim; /* Possible RAM attributes */ #define ATTR_INITIALIZED 0x01 /* RAM cell is intialized */ -#define ATTR_WPROT 0x02 /* RAM cell is write protected */ +#define ATTR_WPROT 0x02 /* RAM cell is write protected */ /* Data for one RAM instance */ typedef struct InstanceData InstanceData; diff --git a/src/sim65/chips/rom.c b/src/sim65/chips/rom.c index ac734b36f..fb88b9e5d 100644 --- a/src/sim65/chips/rom.c +++ b/src/sim65/chips/rom.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* rom.c */ +/* rom.c */ /* */ -/* ROM plugin for the sim65 6502 simulator */ +/* ROM plugin for the sim65 6502 simulator */ /* */ /* */ /* */ @@ -89,7 +89,7 @@ static const struct ChipData CData[1] = { /* -- Exported functions -- */ InitChip, CreateInstance, - DestroyInstance, + DestroyInstance, WriteCtrl, Write, ReadCtrl, @@ -224,7 +224,7 @@ static void Write (void* Data, unsigned Offs, unsigned char Val) /* Print a warning */ Sim->Break ("Writing to write protected memory at $%04X (value = $%02X)", - D->BaseAddr+Offs, Val); + D->BaseAddr+Offs, Val); } diff --git a/src/sim65/chips/stdio.c b/src/sim65/chips/stdio.c index 1e66feb97..ec3403f98 100644 --- a/src/sim65/chips/stdio.c +++ b/src/sim65/chips/stdio.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* stdio.c */ +/* stdio.c */ /* */ -/* STDIO plugin for the sim65 6502 simulator */ +/* STDIO plugin for the sim65 6502 simulator */ /* */ /* */ /* */ @@ -94,7 +94,7 @@ static const struct ChipData CData[1] = { /* -- Exported functions -- */ InitChip, CreateInstance, - DestroyInstance, + DestroyInstance, WriteCtrl, Write, ReadCtrl, diff --git a/src/sim65/chips/vic2.c b/src/sim65/chips/vic2.c index 616eec97a..98e9d8df8 100644 --- a/src/sim65/chips/vic2.c +++ b/src/sim65/chips/vic2.c @@ -2,7 +2,7 @@ /* */ /* vic2.c */ /* */ -/* VIC II plugin for the sim65 6502 simulator */ +/* VIC II plugin for the sim65 6502 simulator */ /* */ /* */ /* */ @@ -136,7 +136,7 @@ static const struct ChipData CData[] = { /* -- Exported functions -- */ VicInitChip, VicCreateInstance, - VicDestroyInstance, + VicDestroyInstance, VicWrite, VicWrite, VicRead, @@ -151,7 +151,7 @@ static const struct ChipData CData[] = { /* -- Exported functions -- */ VRamInitChip, VRamCreateInstance, - VRamDestroyInstance, + VRamDestroyInstance, VRamWrite, VRamWrite, VRamRead, @@ -166,7 +166,7 @@ static const struct ChipData CData[] = { /* -- Exported functions -- */ CRamInitChip, CRamCreateInstance, - CRamDestroyInstance, + CRamDestroyInstance, CRamWrite, CRamWrite, CRamRead, @@ -176,8 +176,8 @@ static const struct ChipData CData[] = { /* Defines for the VIC chip */ #define VIC_COLOR_COUNT 16 -#define VIC_BLACK 0 -#define VIC_WHITE 1 +#define VIC_BLACK 0 +#define VIC_WHITE 1 /* The application color map. VIC II color values are taken from * http://www.pepto.de/projects/colorvic/ (Philip "Pepto" Timmermann) @@ -774,7 +774,7 @@ static void VRamEventLoop (void) switch (Event.type) { case Expose: - /* Calculate the area to redraw, then update the screen */ + /* Calculate the area to redraw, then update the screen */ X1 = Event.xexpose.x; Y1 = Event.xexpose.y; X2 = Event.xexpose.x + Event.xexpose.width - 1; diff --git a/src/sim65/config.c b/src/sim65/config.c index 36187224c..f595361fc 100644 --- a/src/sim65/config.c +++ b/src/sim65/config.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* config.c */ +/* config.c */ /* */ /* Configuration file parsing for the sim65 6502 simulator */ /* */ @@ -58,7 +58,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -69,7 +69,7 @@ static void FlagAttr (unsigned* Flags, unsigned Mask, const char* Name) */ { if (*Flags & Mask) { - CfgError ("%s is already defined", Name); + CfgError ("%s is already defined", Name); } *Flags |= Mask; } @@ -80,7 +80,7 @@ static void AttrCheck (unsigned Attr, unsigned Mask, const char* Name) /* Check that a mandatory attribute was given */ { if ((Attr & Mask) == 0) { - CfgError ("%s attribute is missing", Name); + CfgError ("%s attribute is missing", Name); } } @@ -195,8 +195,8 @@ static void ParseAddrSpace (void) CfgData* D = NewCfgData (); CfgNextTok (); - /* An optional assignment follows */ - CfgOptionalAssign (); + /* An optional assignment follows */ + CfgOptionalAssign (); /* Check and assign the attribute value */ switch (CfgTok) { @@ -223,13 +223,13 @@ static void ParseAddrSpace (void) /* Add the attribute to the location */ CollAppend (&L->Attributes, D); - /* Skip the attribute value and an optional comma */ - CfgNextTok (); - CfgOptionalComma (); - } + /* Skip the attribute value and an optional comma */ + CfgNextTok (); + CfgOptionalComma (); + } - /* Skip the semicolon */ - CfgConsumeSemi (); + /* Skip the semicolon */ + CfgConsumeSemi (); } /* Sort all memory locations */ @@ -335,23 +335,23 @@ static void ParseConfig (void) /* Parse the config file */ { static const IdentTok BlockNames [] = { - { "ADDRSPACE", CFGTOK_ADDRSPACE }, - { "CPU", CFGTOK_CPU }, + { "ADDRSPACE", CFGTOK_ADDRSPACE }, + { "CPU", CFGTOK_CPU }, }; cfgtok_t BlockTok; do { - /* Read the block ident */ - CfgSpecialToken (BlockNames, ENTRY_COUNT (BlockNames), "Block identifier"); - BlockTok = CfgTok; - CfgNextTok (); + /* Read the block ident */ + CfgSpecialToken (BlockNames, ENTRY_COUNT (BlockNames), "Block identifier"); + BlockTok = CfgTok; + CfgNextTok (); - /* Expected a curly brace */ - CfgConsume (CFGTOK_LCURLY, "`{' expected"); + /* Expected a curly brace */ + CfgConsume (CFGTOK_LCURLY, "`{' expected"); - /* Read the block */ - switch (BlockTok) { + /* Read the block */ + switch (BlockTok) { case CFGTOK_ADDRSPACE: ParseAddrSpace (); @@ -361,13 +361,13 @@ static void ParseConfig (void) ParseCPU (); break; - default: - FAIL ("Unexpected block token"); + default: + FAIL ("Unexpected block token"); - } + } - /* Skip closing brace */ - CfgConsumeRCurly (); + /* Skip closing brace */ + CfgConsumeRCurly (); } while (CfgTok != CFGTOK_EOF); } diff --git a/src/sim65/config.h b/src/sim65/config.h index 020903e11..a6446c624 100644 --- a/src/sim65/config.h +++ b/src/sim65/config.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* config.h */ +/* config.h */ /* */ /* Configuration file parsing for the sim65 6502 simulator */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/cpucore.c b/src/sim65/cpucore.c index ad0c70897..87f349ec7 100644 --- a/src/sim65/cpucore.c +++ b/src/sim65/cpucore.c @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/cpucore.h b/src/sim65/cpucore.h index fba8fb835..b312f56e5 100644 --- a/src/sim65/cpucore.h +++ b/src/sim65/cpucore.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -64,7 +64,7 @@ struct CPUCore { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/cpudata.h b/src/sim65/cpudata.h index 69702e919..c060fe3f0 100644 --- a/src/sim65/cpudata.h +++ b/src/sim65/cpudata.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* cpudata.h */ +/* cpudata.h */ /* */ /* CPU data passed from the CPU plugins */ /* */ diff --git a/src/sim65/cpus/6502.c b/src/sim65/cpus/6502.c index 932ecc24a..5eaeb659c 100644 --- a/src/sim65/cpus/6502.c +++ b/src/sim65/cpus/6502.c @@ -84,7 +84,7 @@ static unsigned long GetCycles (void* Data); /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -95,23 +95,23 @@ static const SimData* Sim; /* 6502 CPU registers */ typedef struct CPURegs CPURegs; struct CPURegs { - unsigned AC; /* Accumulator */ - unsigned XR; /* X register */ - unsigned YR; /* Y register */ + unsigned AC; /* Accumulator */ + unsigned XR; /* X register */ + unsigned YR; /* Y register */ unsigned ZR; /* Z register */ - unsigned SR; /* Status register */ - unsigned SP; /* Stackpointer */ - unsigned PC; /* Program counter */ + unsigned SR; /* Status register */ + unsigned SP; /* Stackpointer */ + unsigned PC; /* Program counter */ }; /* Status register bits */ -#define CF 0x01 /* Carry flag */ -#define ZF 0x02 /* Zero flag */ -#define IF 0x04 /* Interrupt flag */ -#define DF 0x08 /* Decimal flag */ -#define BF 0x10 /* Break flag */ -#define OF 0x40 /* Overflow flag */ -#define SF 0x80 /* Sign flag */ +#define CF 0x01 /* Carry flag */ +#define ZF 0x02 /* Zero flag */ +#define IF 0x04 /* Interrupt flag */ +#define DF 0x08 /* Decimal flag */ +#define BF 0x10 /* Break flag */ +#define OF 0x40 /* Overflow flag */ +#define SF 0x80 /* Sign flag */ /* Type of an opcode handler function */ struct CPUInstance; @@ -172,7 +172,7 @@ struct CPUInstance { /*****************************************************************************/ -/* Helper functions and macros */ +/* Helper functions and macros */ /*****************************************************************************/ @@ -205,8 +205,8 @@ struct CPUInstance { #define TEST_CF(v) SET_CF (((v) & 0xFF00) != 0) /* Program counter halves */ -#define PCL (D->Regs.PC & 0xFF) -#define PCH ((D->Regs.PC >> 8) & 0xFF) +#define PCL (D->Regs.PC & 0xFF) +#define PCH ((D->Regs.PC >> 8) & 0xFF) /* Stack operations */ #define PUSH(Val) MemWriteByte (D->StackPage + D->Regs.SP--, Val) @@ -2909,7 +2909,7 @@ static const OPFunc OP65C02Table[256] = { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/cputype.c b/src/sim65/cputype.c index 5d56557f4..0a06d36d8 100644 --- a/src/sim65/cputype.c +++ b/src/sim65/cputype.c @@ -2,7 +2,7 @@ /* */ /* cputype.h */ /* */ -/* CPU type definitions */ +/* CPU type definitions */ /* */ /* */ /* */ @@ -38,13 +38,13 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Current CPU */ -CPUType CPU = CPU_6502; +CPUType CPU = CPU_6502; diff --git a/src/sim65/cputype.h b/src/sim65/cputype.h index b66b060f7..88f3d7a14 100644 --- a/src/sim65/cputype.h +++ b/src/sim65/cputype.h @@ -2,7 +2,7 @@ /* */ /* cputype.h */ /* */ -/* CPU type definitions */ +/* CPU type definitions */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -51,7 +51,7 @@ typedef enum CPUType { } CPUType; /* Current CPU */ -extern CPUType CPU; +extern CPUType CPU; diff --git a/src/sim65/error.c b/src/sim65/error.c index d5b9524b8..378403e55 100644 --- a/src/sim65/error.c +++ b/src/sim65/error.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* error.c */ +/* error.c */ /* */ /* Error handling for the sim65 simulator */ /* */ @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/error.h b/src/sim65/error.h index 8a50bab07..507294b90 100644 --- a/src/sim65/error.h +++ b/src/sim65/error.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* error.h */ +/* error.h */ /* */ /* Error handling for the sim65 simulator */ /* */ @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/global.c b/src/sim65/global.c index d52d506f1..bd3756229 100644 --- a/src/sim65/global.c +++ b/src/sim65/global.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* global.c */ +/* global.c */ /* */ /* Global variables for the sim65 6502 simulator */ /* */ @@ -38,12 +38,12 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -unsigned char Debug = 0; /* Debug mode */ +unsigned char Debug = 0; /* Debug mode */ diff --git a/src/sim65/global.h b/src/sim65/global.h index 29c22aa29..a7434e225 100644 --- a/src/sim65/global.h +++ b/src/sim65/global.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* global.h */ +/* global.h */ /* */ /* Global variables for the sim65 6502 simulator */ /* */ @@ -39,12 +39,12 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ -extern unsigned char Debug; /* Debug mode */ +extern unsigned char Debug; /* Debug mode */ diff --git a/src/sim65/location.c b/src/sim65/location.c index f235bd99d..e7985ee34 100644 --- a/src/sim65/location.c +++ b/src/sim65/location.c @@ -57,7 +57,7 @@ Collection Locations = STATIC_COLLECTION_INITIALIZER; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -82,7 +82,7 @@ Location* NewLocation (unsigned long Start, unsigned long End) static int CmpLocations (void* Data attribute ((unused)), - const void* lhs, const void* rhs) + const void* lhs, const void* rhs) /* Compare function for CollSort */ { /* Cast the object pointers */ diff --git a/src/sim65/location.h b/src/sim65/location.h index a695bf210..aea46e8c1 100644 --- a/src/sim65/location.h +++ b/src/sim65/location.h @@ -65,7 +65,7 @@ struct Location { /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/main.c b/src/sim65/main.c index f3bb8a112..3608be3f7 100644 --- a/src/sim65/main.c +++ b/src/sim65/main.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* main.c */ +/* main.c */ /* */ /* sim65 main program */ /* */ @@ -62,7 +62,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -108,17 +108,17 @@ static void OptChipDir (const char* Opt attribute ((unused)), const char* Arg) /* Read in all files and treat them as libraries */ while ((E = readdir (D)) != 0) { - char* Name; + char* Name; struct stat S; - /* ### Ignore anything but *.so files */ - unsigned NameLen = strlen (E->d_name); - if (NameLen <= 3) { - continue; - } - if (strcmp (E->d_name + NameLen - 3, ".so") != 0) { - continue; - } + /* ### Ignore anything but *.so files */ + unsigned NameLen = strlen (E->d_name); + if (NameLen <= 3) { + continue; + } + if (strcmp (E->d_name + NameLen - 3, ".so") != 0) { + continue; + } /* Create the full file name */ Name = xmalloc (DirLen + 1 + NameLen + 1); @@ -153,11 +153,11 @@ static void OptCPU (const char* Opt, const char* Arg) /* Handle the --cpu option */ { if (strcmp (Arg, "6502") == 0) { - CPU = CPU_6502; + CPU = CPU_6502; } else if (strcmp (Arg, "65C02") == 0) { - CPU = CPU_65C02; + CPU = CPU_65C02; } else { - AbEnd ("Invalid argument for %s: `%s'", Opt, Arg); + AbEnd ("Invalid argument for %s: `%s'", Opt, Arg); } } @@ -167,7 +167,7 @@ static void OptConfig (const char* Opt attribute ((unused)), const char* Arg) /* Define the config file */ { if (CfgAvail ()) { - Error ("Cannot use -C twice"); + Error ("Cannot use -C twice"); } CfgSetName (Arg); } @@ -175,7 +175,7 @@ static void OptConfig (const char* Opt attribute ((unused)), const char* Arg) static void OptDebug (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Simulator debug mode */ { Debug = 1; @@ -184,7 +184,7 @@ static void OptDebug (const char* Opt attribute ((unused)), static void OptHelp (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print usage information and exit */ { Usage (); @@ -194,7 +194,7 @@ static void OptHelp (const char* Opt attribute ((unused)), static void OptVerbose (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Increase verbosity */ { ++Verbosity; @@ -203,7 +203,7 @@ static void OptVerbose (const char* Opt attribute ((unused)), static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print the assembler version */ { fprintf (stderr, "sim65 V%s\n", GetVersionAsString ()); @@ -215,13 +215,13 @@ int main (int argc, char* argv[]) { /* Program long options */ static const LongOpt OptTab[] = { - { "--chipdir", 1, OptChipDir }, - { "--config", 1, OptConfig }, - { "--cpu", 1, OptCPU }, - { "--debug", 0, OptDebug }, - { "--help", 0, OptHelp }, - { "--verbose", 0, OptVerbose }, - { "--version", 0, OptVersion }, + { "--chipdir", 1, OptChipDir }, + { "--config", 1, OptConfig }, + { "--cpu", 1, OptCPU }, + { "--debug", 0, OptDebug }, + { "--help", 0, OptHelp }, + { "--verbose", 0, OptVerbose }, + { "--version", 0, OptVersion }, }; unsigned I; @@ -239,57 +239,57 @@ int main (int argc, char* argv[]) I = 1; while (I < ArgCount) { - /* Get the argument */ - const char* Arg = ArgVec[I]; + /* Get the argument */ + const char* Arg = ArgVec[I]; - /* Check for an option */ - if (Arg [0] == '-') { + /* Check for an option */ + if (Arg [0] == '-') { - switch (Arg [1]) { + switch (Arg [1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; - case 'd': - OptDebug (Arg, 0); - break; + case 'd': + OptDebug (Arg, 0); + break; - case 'h': - case '?': - OptHelp (Arg, 0); - break; + case 'h': + case '?': + OptHelp (Arg, 0); + break; - case 'v': - OptVerbose (Arg, 0); - break; + case 'v': + OptVerbose (Arg, 0); + break; - case 'C': - OptConfig (Arg, GetArg (&I, 2)); - break; + case 'C': + OptConfig (Arg, GetArg (&I, 2)); + break; - case 'L': - OptChipDir (Arg, GetArg (&I, 2)); - break; + case 'L': + OptChipDir (Arg, GetArg (&I, 2)); + break; - case 'V': - OptVersion (Arg, 0); - break; + case 'V': + OptVersion (Arg, 0); + break; - default: - UnknownOption (Arg); - break; - } - } else { - if (InputFile) { - fprintf (stderr, "additional file specs ignored\n"); - } else { - InputFile = Arg; - } - } + default: + UnknownOption (Arg); + break; + } + } else { + if (InputFile) { + fprintf (stderr, "additional file specs ignored\n"); + } else { + InputFile = Arg; + } + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Sort the already loaded chips */ @@ -297,7 +297,7 @@ int main (int argc, char* argv[]) /* Check if we have a valid configuration */ if (!CfgAvail ()) { - Error ("Simulator configuration missing"); + Error ("Simulator configuration missing"); } /* Initialize the simulated CPU memory */ diff --git a/src/sim65/memory.c b/src/sim65/memory.c index 90edf46e6..e141fdf7a 100644 --- a/src/sim65/memory.c +++ b/src/sim65/memory.c @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* memory.h */ +/* memory.h */ /* */ -/* Memory subsystem for the 6502 simulator */ +/* Memory subsystem for the 6502 simulator */ /* */ /* */ /* */ @@ -50,7 +50,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -62,7 +62,7 @@ unsigned MemSize = 0; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/memory.h b/src/sim65/memory.h index cafca0052..dc20efff7 100644 --- a/src/sim65/memory.h +++ b/src/sim65/memory.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* memory.h */ +/* memory.h */ /* */ -/* Memory subsystem for the 6502 simulator */ +/* Memory subsystem for the 6502 simulator */ /* */ /* */ /* */ @@ -39,7 +39,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -53,7 +53,7 @@ extern unsigned MemSize; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/scanner.c b/src/sim65/scanner.c index 86c88fb6f..b07c0cc72 100644 --- a/src/sim65/scanner.c +++ b/src/sim65/scanner.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* scanner.c */ +/* scanner.c */ /* */ /* Configuration file scanner for the sim65 6502 simulator */ /* */ @@ -50,34 +50,34 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ /* Current token and attributes */ -cfgtok_t CfgTok; -StrBuf CfgSVal = STATIC_STRBUF_INITIALIZER; +cfgtok_t CfgTok; +StrBuf CfgSVal = STATIC_STRBUF_INITIALIZER; unsigned long CfgIVal; /* Error location */ -unsigned CfgErrorLine; -unsigned CfgErrorCol; +unsigned CfgErrorLine; +unsigned CfgErrorCol; /* Input sources for the configuration */ -static const char* CfgName = 0; -static const char* CfgBuf = 0; +static const char* CfgName = 0; +static const char* CfgBuf = 0; /* Other input stuff */ -static int C = ' '; -static unsigned InputLine = 1; -static unsigned InputCol = 0; -static FILE* InputFile = 0; +static int C = ' '; +static unsigned InputLine = 1; +static unsigned InputCol = 0; +static FILE* InputFile = 0; /*****************************************************************************/ -/* Error handling */ +/* Error handling */ /*****************************************************************************/ @@ -113,7 +113,7 @@ void CfgError (const char* Format, ...) /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -122,27 +122,27 @@ static void NextChar (void) /* Read the next character from the input file */ { if (CfgBuf) { - /* Read from buffer */ - C = (unsigned char)(*CfgBuf); - if (C == 0) { - C = EOF; - } else { - ++CfgBuf; - } + /* Read from buffer */ + C = (unsigned char)(*CfgBuf); + if (C == 0) { + C = EOF; + } else { + ++CfgBuf; + } } else { - /* Read from the file */ - C = getc (InputFile); + /* Read from the file */ + C = getc (InputFile); } /* Count columns */ if (C != EOF) { - ++InputCol; + ++InputCol; } /* Count lines */ if (C == '\n') { - ++InputLine; - InputCol = 0; + ++InputLine; + InputCol = 0; } } @@ -152,9 +152,9 @@ static unsigned DigitVal (int C) /* Return the value for a numeric digit */ { if (isdigit (C)) { - return C - '0'; + return C - '0'; } else { - return toupper (C) - 'A' + 10; + return toupper (C) - 'A' + 10; } } @@ -169,7 +169,7 @@ void CfgNextTok (void) Again: /* Skip whitespace */ while (isspace (C)) { - NextChar (); + NextChar (); } /* Remember the current position */ @@ -179,122 +179,122 @@ Again: /* Identifier? */ if (C == '_' || IsAlpha (C)) { - /* Read the identifier */ - I = 0; - while (C == '_' || IsAlNum (C)) { - if (I < CFG_MAX_IDENT_LEN) { - CfgSVal [I++] = C; - } - NextChar (); - } - CfgSVal [I] = '\0'; - CfgTok = CFGTOK_IDENT; - return; + /* Read the identifier */ + I = 0; + while (C == '_' || IsAlNum (C)) { + if (I < CFG_MAX_IDENT_LEN) { + CfgSVal [I++] = C; + } + NextChar (); + } + CfgSVal [I] = '\0'; + CfgTok = CFGTOK_IDENT; + return; } /* Hex number? */ if (C == '$') { - NextChar (); - if (!isxdigit (C)) { - Error ("%s(%u): Hex digit expected", CfgName, InputLine); - } - CfgIVal = 0; - while (isxdigit (C)) { - CfgIVal = CfgIVal * 16 + DigitVal (C); - NextChar (); - } - CfgTok = CFGTOK_INTCON; - return; + NextChar (); + if (!isxdigit (C)) { + Error ("%s(%u): Hex digit expected", CfgName, InputLine); + } + CfgIVal = 0; + while (isxdigit (C)) { + CfgIVal = CfgIVal * 16 + DigitVal (C); + NextChar (); + } + CfgTok = CFGTOK_INTCON; + return; } /* Decimal number? */ if (isdigit (C)) { - CfgIVal = 0; - while (isdigit (C)) { - CfgIVal = CfgIVal * 10 + DigitVal (C); - NextChar (); - } - CfgTok = CFGTOK_INTCON; - return; + CfgIVal = 0; + while (isdigit (C)) { + CfgIVal = CfgIVal * 10 + DigitVal (C); + NextChar (); + } + CfgTok = CFGTOK_INTCON; + return; } /* Other characters */ switch (C) { - case '{': - NextChar (); - CfgTok = CFGTOK_LCURLY; - break; + case '{': + NextChar (); + CfgTok = CFGTOK_LCURLY; + break; - case '}': - NextChar (); - CfgTok = CFGTOK_RCURLY; - break; + case '}': + NextChar (); + CfgTok = CFGTOK_RCURLY; + break; - case ';': - NextChar (); - CfgTok = CFGTOK_SEMI; - break; + case ';': + NextChar (); + CfgTok = CFGTOK_SEMI; + break; - case '.': - NextChar (); + case '.': + NextChar (); if (C == '.') { NextChar (); CfgTok = CFGTOK_DOTDOT; } else { - CfgTok = CFGTOK_DOT; + CfgTok = CFGTOK_DOT; } - break; + break; - case ',': - NextChar (); - CfgTok = CFGTOK_COMMA; - break; + case ',': + NextChar (); + CfgTok = CFGTOK_COMMA; + break; - case '=': - NextChar (); - CfgTok = CFGTOK_EQ; - break; + case '=': + NextChar (); + CfgTok = CFGTOK_EQ; + break; case ':': - NextChar (); - CfgTok = CFGTOK_COLON; - break; + NextChar (); + CfgTok = CFGTOK_COLON; + break; case '\"': - NextChar (); - I = 0; - while (C != '\"') { - if (C == EOF || C == '\n') { - Error ("%s(%u): Unterminated string", CfgName, InputLine); - } - if (I < CFG_MAX_IDENT_LEN) { - CfgSVal [I++] = C; - } - NextChar (); - } - NextChar (); - CfgSVal [I] = '\0'; - CfgTok = CFGTOK_STRCON; - break; + NextChar (); + I = 0; + while (C != '\"') { + if (C == EOF || C == '\n') { + Error ("%s(%u): Unterminated string", CfgName, InputLine); + } + if (I < CFG_MAX_IDENT_LEN) { + CfgSVal [I++] = C; + } + NextChar (); + } + NextChar (); + CfgSVal [I] = '\0'; + CfgTok = CFGTOK_STRCON; + break; case '#': - /* Comment */ - while (C != '\n' && C != EOF) { - NextChar (); - } - if (C != EOF) { - goto Again; - } - CfgTok = CFGTOK_EOF; - break; + /* Comment */ + while (C != '\n' && C != EOF) { + NextChar (); + } + if (C != EOF) { + goto Again; + } + CfgTok = CFGTOK_EOF; + break; case EOF: - CfgTok = CFGTOK_EOF; - break; + CfgTok = CFGTOK_EOF; + break; - default: - Error ("%s(%u): Invalid character `%c'", CfgName, InputLine, C); + default: + Error ("%s(%u): Invalid character `%c'", CfgName, InputLine, C); } } @@ -305,7 +305,7 @@ void CfgConsume (cfgtok_t T, const char* Msg) /* Skip a token, print an error message if not found */ { if (CfgTok != T) { - CfgError ("%s", Msg); + CfgError ("%s", Msg); } CfgNextTok (); } @@ -340,7 +340,7 @@ void CfgOptionalComma (void) /* Consume a comma if there is one */ { if (CfgTok == CFGTOK_COMMA) { - CfgNextTok (); + CfgNextTok (); } } @@ -350,7 +350,7 @@ void CfgOptionalAssign (void) /* Consume an equal sign if there is one */ { if (CfgTok == CFGTOK_EQ) { - CfgNextTok (); + CfgNextTok (); } } @@ -360,7 +360,7 @@ void CfgAssureInt (void) /* Make sure the next token is an integer */ { if (CfgTok != CFGTOK_INTCON) { - CfgError ("Integer constant expected"); + CfgError ("Integer constant expected"); } } @@ -370,7 +370,7 @@ void CfgAssureStr (void) /* Make sure the next token is a string constant */ { if (CfgTok != CFGTOK_STRCON) { - CfgError ("String constant expected"); + CfgError ("String constant expected"); } } @@ -380,7 +380,7 @@ void CfgAssureIdent (void) /* Make sure the next token is an identifier */ { if (CfgTok != CFGTOK_IDENT) { - CfgError ("Identifier expected"); + CfgError ("Identifier expected"); } } @@ -390,7 +390,7 @@ void CfgRangeCheck (unsigned long Lo, unsigned long Hi) /* Check the range of CfgIVal */ { if (CfgIVal < Lo || CfgIVal > Hi) { - CfgError ("Range error"); + CfgError ("Range error"); } } @@ -404,20 +404,20 @@ void CfgSpecialToken (const IdentTok* Table, unsigned Size, const char* Name) /* We need an identifier */ if (CfgTok == CFGTOK_IDENT) { - /* Make it upper case */ - I = 0; - while (CfgSVal [I]) { - CfgSVal [I] = toupper (CfgSVal [I]); - ++I; - } + /* Make it upper case */ + I = 0; + while (CfgSVal [I]) { + CfgSVal [I] = toupper (CfgSVal [I]); + ++I; + } - /* Linear search */ - for (I = 0; I < Size; ++I) { - if (strcmp (CfgSVal, Table [I].Ident) == 0) { - CfgTok = Table [I].Tok; - return; - } - } + /* Linear search */ + for (I = 0; I < Size; ++I) { + if (strcmp (CfgSVal, Table [I].Ident) == 0) { + CfgTok = Table [I].Tok; + return; + } + } } @@ -431,21 +431,21 @@ void CfgBoolToken (void) /* Map an identifier or integer to a boolean token */ { static const IdentTok Booleans [] = { - { "YES", CFGTOK_TRUE }, - { "NO", CFGTOK_FALSE }, + { "YES", CFGTOK_TRUE }, + { "NO", CFGTOK_FALSE }, { "TRUE", CFGTOK_TRUE }, { "FALSE", CFGTOK_FALSE }, }; /* If we have an identifier, map it to a boolean token */ if (CfgTok == CFGTOK_IDENT) { - CfgSpecialToken (Booleans, ENTRY_COUNT (Booleans), "Boolean"); + CfgSpecialToken (Booleans, ENTRY_COUNT (Booleans), "Boolean"); } else { - /* We expected an integer here */ - if (CfgTok != CFGTOK_INTCON) { - CfgError ("Boolean value expected"); - } - CfgTok = (CfgIVal == 0)? CFGTOK_FALSE : CFGTOK_TRUE; + /* We expected an integer here */ + if (CfgTok != CFGTOK_INTCON) { + CfgError ("Boolean value expected"); + } + CfgTok = (CfgIVal == 0)? CFGTOK_FALSE : CFGTOK_TRUE; } } @@ -463,11 +463,11 @@ const char* CfgGetName (void) /* Get the name of the config file */ { if (CfgName) { - return CfgName; + return CfgName; } else if (CfgBuf) { - return "[builtin config]"; + return "[builtin config]"; } else { - return ""; + return ""; } } @@ -497,11 +497,11 @@ void CfgOpenInput (void) */ if (!CfgBuf) { - /* Open the file */ - InputFile = fopen (CfgName, "r"); - if (InputFile == 0) { - Error ("Cannot open `%s': %s", CfgName, strerror (errno)); - } + /* Open the file */ + InputFile = fopen (CfgName, "r"); + if (InputFile == 0) { + Error ("Cannot open `%s': %s", CfgName, strerror (errno)); + } } @@ -522,7 +522,7 @@ void CfgCloseInput (void) /* Close the input file if we had one */ if (InputFile) { (void) fclose (InputFile); - InputFile = 0; + InputFile = 0; } } diff --git a/src/sim65/scanner.h b/src/sim65/scanner.h index 5cb2342b2..bd8bbcfca 100644 --- a/src/sim65/scanner.h +++ b/src/sim65/scanner.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* scanner.h */ +/* scanner.h */ /* */ /* Configuration file scanner for the sim65 6502 simulator */ /* */ @@ -45,7 +45,7 @@ /*****************************************************************************/ -/* Data */ +/* Data */ /*****************************************************************************/ @@ -84,26 +84,26 @@ typedef enum { /* Mapping table entry, special identifier --> token */ typedef struct IdentTok IdentTok; struct IdentTok { - const char* Ident; /* Identifier */ - cfgtok_t Tok; /* Token for identifier */ + const char* Ident; /* Identifier */ + cfgtok_t Tok; /* Token for identifier */ }; -#define ENTRY_COUNT(s) (sizeof (s) / sizeof (s [0])) +#define ENTRY_COUNT(s) (sizeof (s) / sizeof (s [0])) /* Current token and attributes */ -extern cfgtok_t CfgTok; -extern StrBuf CfgSVal; -extern unsigned long CfgIVal; +extern cfgtok_t CfgTok; +extern StrBuf CfgSVal; +extern unsigned long CfgIVal; /* Error location */ -extern unsigned CfgErrorLine; -extern unsigned CfgErrorCol; +extern unsigned CfgErrorLine; +extern unsigned CfgErrorCol; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/simdata.h b/src/sim65/simdata.h index 7eadc6e63..d0669ea59 100644 --- a/src/sim65/simdata.h +++ b/src/sim65/simdata.h @@ -1,8 +1,8 @@ /*****************************************************************************/ /* */ -/* simdata.h */ +/* simdata.h */ /* */ -/* Simulator data passed to the chip plugins */ +/* Simulator data passed to the chip plugins */ /* */ /* */ /* */ @@ -47,8 +47,8 @@ /* SimData structure */ typedef struct SimData SimData; struct SimData { - unsigned MajorVersion; - unsigned MinorVersion; + unsigned MajorVersion; + unsigned MinorVersion; /* -- Callback functions -- */ diff --git a/src/sim65/system.c b/src/sim65/system.c index d8860a799..b898e3974 100644 --- a/src/sim65/system.c +++ b/src/sim65/system.c @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sim65/system.h b/src/sim65/system.h index 873a3f7b3..abe75e178 100644 --- a/src/sim65/system.h +++ b/src/sim65/system.h @@ -70,7 +70,7 @@ extern System* System; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sp65/error.c b/src/sp65/error.c index 40e289de4..70bc5bdb3 100644 --- a/src/sp65/error.c +++ b/src/sp65/error.c @@ -42,7 +42,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sp65/error.h b/src/sp65/error.h index 5c2cfd637..7643cefa9 100644 --- a/src/sp65/error.h +++ b/src/sp65/error.h @@ -44,7 +44,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sp65/fileio.c b/src/sp65/fileio.c index 79552d6c2..a43b7eb26 100644 --- a/src/sp65/fileio.c +++ b/src/sp65/fileio.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* fileio.c */ +/* fileio.c */ /* */ /* File I/O for the sp65 sprite and bitmap utility */ /* */ @@ -43,7 +43,7 @@ /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -52,7 +52,7 @@ void FileSetPos (FILE* F, unsigned long Pos) /* Seek to the given absolute position, fail on errors */ { if (fseek (F, Pos, SEEK_SET) != 0) { - Error ("Cannot seek: %s", strerror (errno)); + Error ("Cannot seek: %s", strerror (errno)); } } @@ -63,7 +63,7 @@ unsigned long FileGetPos (FILE* F) { long Pos = ftell (F); if (Pos < 0) { - Error ("Error in ftell: %s", strerror (errno)); + Error ("Error in ftell: %s", strerror (errno)); } return Pos; } @@ -75,7 +75,7 @@ unsigned Read8 (FILE* F) { int C = getc (F); if (C == EOF) { - Error ("Read error (file corrupt?)"); + Error ("Read error (file corrupt?)"); } return C; } @@ -117,9 +117,9 @@ void* ReadData (FILE* F, void* Data, unsigned Size) { /* Accept zero sized reads */ if (Size > 0) { - if (fread (Data, 1, Size, F) != Size) { - Error ("Read error (file corrupt?)"); - } + if (fread (Data, 1, Size, F) != Size) { + Error ("Read error (file corrupt?)"); + } } return Data; } diff --git a/src/sp65/fileio.h b/src/sp65/fileio.h index 488dac40a..de2cdd2ce 100644 --- a/src/sp65/fileio.h +++ b/src/sp65/fileio.h @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* fileio.h */ +/* fileio.h */ /* */ /* File I/O for the sp65 sprite and bitmap utility */ /* */ @@ -41,7 +41,7 @@ #include /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ diff --git a/src/sp65/main.c b/src/sp65/main.c index ec3223c08..92cd71114 100644 --- a/src/sp65/main.c +++ b/src/sp65/main.c @@ -1,6 +1,6 @@ /*****************************************************************************/ /* */ -/* main.c */ +/* main.c */ /* */ /* Main program of the sp65 sprite and bitmap utility */ /* */ @@ -71,7 +71,7 @@ static StrBuf* D; /*****************************************************************************/ -/* Code */ +/* Code */ /*****************************************************************************/ @@ -80,27 +80,27 @@ static void Usage (void) /* Print usage information and exit */ { printf ( - "Usage: %s [options] file [options] [file]\n" - "Short options:\n" - " -V\t\t\t\tPrint the version number and exit\n" + "Usage: %s [options] file [options] [file]\n" + "Short options:\n" + " -V\t\t\t\tPrint the version number and exit\n" " -c fmt[,attrlist]\t\tConvert into target format\n" - " -h\t\t\t\tHelp (this text)\n" + " -h\t\t\t\tHelp (this text)\n" " -lc\t\t\t\tList all possible conversions\n" " -r file[,attrlist]\t\tRead an input file\n" " -v\t\t\t\tIncrease verbosity\n" " -w file[,attrlist]\t\tWrite the output to a file\n" - "\n" - "Long options:\n" + "\n" + "Long options:\n" " --convert-to fmt[,attrlist]\tConvert into target format\n" - " --help\t\t\tHelp (this text)\n" + " --help\t\t\tHelp (this text)\n" " --list-conversions\t\tList all possible conversions\n" " --pop\t\t\t\tRestore the original loaded image\n" " --read file[,attrlist]\tRead an input file\n" " --slice x,y,w,h\t\tGenerate a slice from the loaded bitmap\n" " --verbose\t\t\tIncrease verbosity\n" - " --version\t\t\tPrint the version number and exit\n" + " --version\t\t\tPrint the version number and exit\n" " --write file[,attrlist]\tWrite the output to a file\n", - ProgName); + ProgName); } @@ -182,7 +182,7 @@ static void OptDumpPalette (const char* Opt attribute ((unused)), static void OptHelp (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print usage information and exit */ { Usage (); @@ -192,7 +192,7 @@ static void OptHelp (const char* Opt attribute ((unused)), static void OptListConversions (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print a list of all conversions */ { ListConversionTargets (stdout); @@ -202,7 +202,7 @@ static void OptListConversions (const char* Opt attribute ((unused)), static void OptPop (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Restore the original image */ { /* C and B must differ and we must have an original */ @@ -272,7 +272,7 @@ static void OptSlice (const char* Opt attribute ((unused)), const char* Arg) static void OptVerbose (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Increase versbosity */ { ++Verbosity; @@ -281,7 +281,7 @@ static void OptVerbose (const char* Opt attribute ((unused)), static void OptVersion (const char* Opt attribute ((unused)), - const char* Arg attribute ((unused))) + const char* Arg attribute ((unused))) /* Print the assembler version */ { fprintf (stderr, "%s V%s\n", ProgName, GetVersionAsString ()); @@ -321,14 +321,14 @@ int main (int argc, char* argv []) static const LongOpt OptTab[] = { { "--convert-to", 1, OptConvertTo }, { "--dump-palette", 0, OptDumpPalette }, - { "--help", 0, OptHelp }, + { "--help", 0, OptHelp }, { "--list-conversions", 0, OptListConversions }, { "--pop", 0, OptPop }, { "--read", 1, OptRead }, { "--slice", 1, OptSlice }, - { "--verbose", 0, OptVerbose }, - { "--version", 0, OptVersion }, - { "--write", 1, OptWrite }, + { "--verbose", 0, OptVerbose }, + { "--version", 0, OptVersion }, + { "--write", 1, OptWrite }, }; unsigned I; @@ -340,28 +340,28 @@ int main (int argc, char* argv []) I = 1; while (I < ArgCount) { - /* Get the argument */ - const char* Arg = ArgVec[I]; + /* Get the argument */ + const char* Arg = ArgVec[I]; - /* Check for an option */ - if (Arg[0] == '-') { - switch (Arg[1]) { + /* Check for an option */ + if (Arg[0] == '-') { + switch (Arg[1]) { - case '-': - LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); - break; + case '-': + LongOption (&I, OptTab, sizeof(OptTab)/sizeof(OptTab[0])); + break; - case 'V': - OptVersion (Arg, 0); - break; + case 'V': + OptVersion (Arg, 0); + break; case 'c': OptConvertTo (Arg, GetArg (&I, 2)); break; - case 'h': - OptHelp (Arg, 0); - break; + case 'h': + OptHelp (Arg, 0); + break; case 'l': if (Arg[2] == 'c') { @@ -375,26 +375,26 @@ int main (int argc, char* argv []) OptRead (Arg, GetArg (&I, 2)); break; - case 'v': - OptVerbose (Arg, 0); - break; + case 'v': + OptVerbose (Arg, 0); + break; case 'w': OptWrite (Arg, GetArg (&I, 2)); break; - default: - UnknownOption (Arg); - break; + default: + UnknownOption (Arg); + break; - } - } else { - /* We don't accept anything else */ + } + } else { + /* We don't accept anything else */ AbEnd ("Don't know what to do with `%s'", Arg); - } + } - /* Next argument */ - ++I; + /* Next argument */ + ++I; } /* Cleanup data */ diff --git a/testcode/compiler/pptest1.c b/testcode/compiler/pptest1.c index b80c8b7d7..e42135688 100644 --- a/testcode/compiler/pptest1.c +++ b/testcode/compiler/pptest1.c @@ -1,6 +1,6 @@ -#define hash_hash # ## # -#define mkstr(a) # a -#define in_between(a) mkstr(a) -#define join(c, d) in_between(c hash_hash d) +#define hash_hash # ## # +#define mkstr(a) # a +#define in_between(a) mkstr(a) +#define join(c, d) in_between(c hash_hash d) -char p[] = join(x, y); // Comment +char p[] = join(x, y); // Comment diff --git a/testcode/compiler/pptest2.c b/testcode/compiler/pptest2.c index 0d613cdc3..e127d53fb 100644 --- a/testcode/compiler/pptest2.c +++ b/testcode/compiler/pptest2.c @@ -1,17 +1,17 @@ -#define x 3 -#define f(a) f(x * (a)) -#undef x -#define x 2 -#define g f -#define z z[0] -#define h g(~ -#define m(a) a(w) -#define w 0,1 -#define t(a) a -#define p() int -#define q(x) x -#define r(x,y) x ## y -#define str(x) # x +#define x 3 +#define f(a) f(x * (a)) +#undef x +#define x 2 +#define g f +#define z z[0] +#define h g(~ +#define m(a) a(w) +#define w 0,1 +#define t(a) a +#define p() int +#define q(x) x +#define r(x,y) x ## y +#define str(x) # x f(y+1) + f(f(z)) % t(t(g) (0) + t)(1); g(x+(3,4)-w) | h 5) & m(f)^m(m); diff --git a/testcode/compiler/pptest3.c b/testcode/compiler/pptest3.c index 2c2df87e5..62aa7f705 100644 --- a/testcode/compiler/pptest3.c +++ b/testcode/compiler/pptest3.c @@ -1,16 +1,16 @@ -#define str(s) # s -#define xstr(s) str(s) -#define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \ - x ## s, x ## t) -#define INCFILE(n) vers ## n // Comment -#define glue(a,b) a ## b -#define xglue(a,b) glue(a,b) -#define HIGHLOW "hello" -#define LOW LOW ", world" +#define str(s) # s +#define xstr(s) str(s) +#define debug(s, t) printf("x" # s "= %d, x" # t "= %s", \ + x ## s, x ## t) +#define INCFILE(n) vers ## n // Comment +#define glue(a,b) a ## b +#define xglue(a,b) glue(a,b) +#define HIGHLOW "hello" +#define LOW LOW ", world" debug (1, 2); fputs (str (strncmp("abc\0d", "abc", '\4') // Comment - == 0) str (: @\n), s); + == 0) str (: @\n), s); glue (HIGH, LOW); xglue (HIGH, LOW); diff --git a/testcode/compiler/pptest4.c b/testcode/compiler/pptest4.c index abb0d24b5..b8540b5c5 100644 --- a/testcode/compiler/pptest4.c +++ b/testcode/compiler/pptest4.c @@ -1,3 +1,3 @@ -#define t(x,y,z) x ## y ## z +#define t(x,y,z) x ## y ## z int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), - t(10,,), t(,11,), t(,,12), t(,,) }; + t(10,,), t(,11,), t(,,12), t(,,) }; diff --git a/testcode/compiler/pptest5.c b/testcode/compiler/pptest5.c index 7dd075e6e..1f0bd4328 100644 --- a/testcode/compiler/pptest5.c +++ b/testcode/compiler/pptest5.c @@ -1,3 +1,3 @@ #define t(x,y,z) x ## y ## z int j[] = { t(1,2,3), t(,4,5), t(6,,7), t(8,9,), - t(10,,), t(,11,), t(,,12), t(,,) }; + t(10,,), t(,11,), t(,,12), t(,,) }; diff --git a/testcode/grc/vlir0.s b/testcode/grc/vlir0.s index bdb38b51b..2e9a3ffd9 100644 --- a/testcode/grc/vlir0.s +++ b/testcode/grc/vlir0.s @@ -5,74 +5,74 @@ ; include some GEOS defines - .include "../../libsrc/geos/inc/const.inc" - .include "../../libsrc/geos/inc/jumptab.inc" - .include "../../libsrc/geos/inc/geossym.inc" - .include "../../libsrc/geos/inc/geosmac.inc" + .include "../../libsrc/geos/inc/const.inc" + .include "../../libsrc/geos/inc/jumptab.inc" + .include "../../libsrc/geos/inc/geossym.inc" + .include "../../libsrc/geos/inc/geosmac.inc" ; import load addresses for all VLIR chains ; these labels are defined upon linking with ld65 - .import __OVERLAYADDR__ - .import __OVERLAYSIZE__ + .import __OVERLAYADDR__ + .import __OVERLAYSIZE__ ; import names of functions defined (and exported) in each VLIR part ; of your application ; here I used an OVERLAYx_ prefix to prevent name clashes - .import OVERLAY1_Function1 - .import OVERLAY2_Function1 + .import OVERLAY1_Function1 + .import OVERLAY2_Function1 ; segments "STARTUP", "CODE", "DATA", "RODATA" and "BSS" all go to VLIR0 chain - .segment "STARTUP" - ; code segment for VLIR 0 chain + .segment "STARTUP" + ; code segment for VLIR 0 chain ProgExec: - LoadW r0, paramString ; show something - jsr DoDlgBox + LoadW r0, paramString ; show something + jsr DoDlgBox - MoveW dirEntryBuf+OFF_DE_TR_SC, r1 - LoadW r4, fileHeader - jsr GetBlock ; load back VLIR t&s table - bnex error + MoveW dirEntryBuf+OFF_DE_TR_SC, r1 + LoadW r4, fileHeader + jsr GetBlock ; load back VLIR t&s table + bnex error - lda #1 - jsr PointRecord ; we want next module (#1) - LoadW r2, __OVERLAYSIZE__ ; length - as many bytes as we have room for - LoadW r7, __OVERLAYADDR__ ; all VLIR segments have the same load address - jsr ReadRecord ; load it - bnex error - jsr OVERLAY1_Function1 ; execute something + lda #1 + jsr PointRecord ; we want next module (#1) + LoadW r2, __OVERLAYSIZE__ ; length - as many bytes as we have room for + LoadW r7, __OVERLAYADDR__ ; all VLIR segments have the same load address + jsr ReadRecord ; load it + bnex error + jsr OVERLAY1_Function1 ; execute something - lda #2 - jsr PointRecord ; next module - LoadW r2, __OVERLAYSIZE__ - LoadW r7, __OVERLAYADDR__ - jsr ReadRecord ; load it - bnex error - jsr OVERLAY2_Function1 ; execute something + lda #2 + jsr PointRecord ; next module + LoadW r2, __OVERLAYSIZE__ + LoadW r7, __OVERLAYADDR__ + jsr ReadRecord ; load it + bnex error + jsr OVERLAY2_Function1 ; execute something -error: jmp EnterDeskTop ; end of application +error: jmp EnterDeskTop ; end of application - .segment "RODATA" - ; read-only data segment + .segment "RODATA" + ; read-only data segment paramString: - .byte DEF_DB_POS | 1 - .byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y - .word line1 - .byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y - .word line2 - .byte OK, DBI_X_0, DBI_Y_2 - .byte NULL + .byte DEF_DB_POS | 1 + .byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y + .word line1 + .byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y + .word line2 + .byte OK, DBI_X_0, DBI_Y_2 + .byte NULL -line1: .byte BOLDON, "Hello World!",0 -line2: .byte OUTLINEON,"Hello",PLAINTEXT," world!",0 +line1: .byte BOLDON, "Hello World!",0 +line2: .byte OUTLINEON,"Hello",PLAINTEXT," world!",0 - .segment "DATA" - ; read/write initialized data segment + .segment "DATA" + ; read/write initialized data segment counter: .word 0 - .segment "BSS" - ; read/write uninitialized data segment - ; this space doesn't go into output file, only its size and - ; position is remembered + .segment "BSS" + ; read/write uninitialized data segment + ; this space doesn't go into output file, only its size and + ; position is remembered diff --git a/testcode/grc/vlir1.s b/testcode/grc/vlir1.s index bebb028b3..eae34565e 100644 --- a/testcode/grc/vlir1.s +++ b/testcode/grc/vlir1.s @@ -5,41 +5,41 @@ ; include some GEOS defines - .include "../../libsrc/geos/inc/const.inc" - .include "../../libsrc/geos/inc/jumptab.inc" - .include "../../libsrc/geos/inc/geossym.inc" - .include "../../libsrc/geos/inc/geosmac.inc" + .include "../../libsrc/geos/inc/const.inc" + .include "../../libsrc/geos/inc/jumptab.inc" + .include "../../libsrc/geos/inc/geossym.inc" + .include "../../libsrc/geos/inc/geosmac.inc" ; export names of functions that will be used in the main program - .export OVERLAY1_Function1 - .export OVERLAY1_Function2 + .export OVERLAY1_Function1 + .export OVERLAY1_Function2 ; go into OVERLAY1 segment - everything that is here will go into ; VLIR chain #1 - .segment "OVERLAY1" + .segment "OVERLAY1" -OVERLAY1_Function1: jmp Function1 ; jump table, not really necessary -OVERLAY1_Function2: jmp Function2 - ; etc. +OVERLAY1_Function1: jmp Function1 ; jump table, not really necessary +OVERLAY1_Function2: jmp Function2 + ; etc. ; rodata - if this is defined in .segment "RODATA" ; it will end up in the VLIR0 part, you don't want that paramString: - .byte DEF_DB_POS | 1 - .byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y - .word line1 - .byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y - .word line2 - .byte OK, DBI_X_0, DBI_Y_2 - .byte NULL + .byte DEF_DB_POS | 1 + .byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y + .word line1 + .byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y + .word line2 + .byte OK, DBI_X_0, DBI_Y_2 + .byte NULL -line1: .byte "This is in module 1",0 -line2: .byte "This is in module 1",0 +line1: .byte "This is in module 1",0 +line2: .byte "This is in module 1",0 ; code -Function1: LoadW r0, paramString - jsr DoDlgBox -Function2: rts +Function1: LoadW r0, paramString + jsr DoDlgBox +Function2: rts diff --git a/testcode/grc/vlir2.s b/testcode/grc/vlir2.s index d376eee1b..9d180c847 100644 --- a/testcode/grc/vlir2.s +++ b/testcode/grc/vlir2.s @@ -5,32 +5,32 @@ ; similar to vlir1.s except the fact that this is chain #2 - .include "../../libsrc/geos/inc/const.inc" - .include "../../libsrc/geos/inc/jumptab.inc" - .include "../../libsrc/geos/inc/geossym.inc" - .include "../../libsrc/geos/inc/geosmac.inc" + .include "../../libsrc/geos/inc/const.inc" + .include "../../libsrc/geos/inc/jumptab.inc" + .include "../../libsrc/geos/inc/geossym.inc" + .include "../../libsrc/geos/inc/geosmac.inc" - .export OVERLAY2_Function1 - .export OVERLAY2_Function2 + .export OVERLAY2_Function1 + .export OVERLAY2_Function2 - .segment "OVERLAY2" + .segment "OVERLAY2" -OVERLAY2_Function1: jmp Function1 -OVERLAY2_Function2: jmp Function2 - ; etc. +OVERLAY2_Function1: jmp Function1 +OVERLAY2_Function2: jmp Function2 + ; etc. paramString: - .byte DEF_DB_POS | 1 - .byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y - .word line1 - .byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y - .word line2 - .byte OK, DBI_X_0, DBI_Y_2 - .byte NULL + .byte DEF_DB_POS | 1 + .byte DBTXTSTR, TXT_LN_X, TXT_LN_2_Y + .word line1 + .byte DBTXTSTR, TXT_LN_X, TXT_LN_3_Y + .word line2 + .byte OK, DBI_X_0, DBI_Y_2 + .byte NULL -Function2: LoadW r0, paramString - jsr DoDlgBox -Function1: rts +Function2: LoadW r0, paramString + jsr DoDlgBox +Function1: rts -line1: .byte "This is in module 2",0 -line2: .byte "This is in module 2",0 +line1: .byte "This is in module 2",0 +line2: .byte "This is in module 2",0 diff --git a/testcode/lib/atari/defdev.c b/testcode/lib/atari/defdev.c index 717eaa4f3..aef8400ae 100644 --- a/testcode/lib/atari/defdev.c +++ b/testcode/lib/atari/defdev.c @@ -12,7 +12,7 @@ extern char _defdev[]; int main(void) { - printf("default device: %s\n", _defdev); - if (_dos_type != SPARTADOS && _dos_type != OSADOS) cgetc(); - return 0; + printf("default device: %s\n", _defdev); + if (_dos_type != SPARTADOS && _dos_type != OSADOS) cgetc(); + return 0; } diff --git a/testcode/lib/atari/scrcode.s b/testcode/lib/atari/scrcode.s index 3bdc9b863..cd4290781 100644 --- a/testcode/lib/atari/scrcode.s +++ b/testcode/lib/atari/scrcode.s @@ -3,56 +3,56 @@ ; scrcode macro test ; ; compile with -; ca65 -I../../../asminc -tatari -o scrcode.o scrcode.s -; ld65 -tatari -o scrcode.com scrcode.o +; ca65 -I../../../asminc -tatari -o scrcode.o scrcode.s +; ld65 -tatari -o scrcode.com scrcode.o -.import __CODE_LOAD__, __BSS_LOAD__ +.import __CODE_LOAD__, __BSS_LOAD__ -.include "atari.inc" -.macpack atari +.include "atari.inc" +.macpack atari .code - rts ; SpartaDOS workaround + rts ; SpartaDOS workaround ; entry point - lda #0 - tay - tax + lda #0 + tay + tax ; display dispdata -disp: lda dispdata,x - sta (SAVMSC),y - inx - iny - cpx #disp_len - bne disp +disp: lda dispdata,x + sta (SAVMSC),y + inx + iny + cpx #disp_len + bne disp ; wait for key press -key: lda CH - cmp #255 - beq key +key: lda CH + cmp #255 + beq key - rts + rts .data -dispdata: scrcode "fooBa", 'r', $66, 3+4 -disp_len = * - dispdata +dispdata: scrcode "fooBa", 'r', $66, 3+4 +disp_len = * - dispdata -.segment "AUTOSTRT" +.segment "AUTOSTRT" - .word $02E0 - .word $02E1 - .word __CODE_LOAD__+1 + .word $02E0 + .word $02E1 + .word __CODE_LOAD__+1 -.segment "EXEHDR" +.segment "EXEHDR" - .word $FFFF - .word __CODE_LOAD__ - .word __BSS_LOAD__ - 1 + .word $FFFF + .word __CODE_LOAD__ + .word __BSS_LOAD__ - 1 .end diff --git a/testcode/lib/cprintf.c b/testcode/lib/cprintf.c index 7f58070f5..bc8f47af2 100644 --- a/testcode/lib/cprintf.c +++ b/testcode/lib/cprintf.c @@ -25,14 +25,14 @@ int main(void) { - clrscr(); - cprintf("12345\n"); - cprintf("67890\n"); - gotoxy(0,4); - cprintf("12345\r"); - cprintf("67890\r"); - printf("\n\n"); - printf("hit return to exit....\n"); - fgetc(stdin); - return(0); + clrscr(); + cprintf("12345\n"); + cprintf("67890\n"); + gotoxy(0,4); + cprintf("12345\r"); + cprintf("67890\r"); + printf("\n\n"); + printf("hit return to exit....\n"); + fgetc(stdin); + return(0); } diff --git a/testcode/lib/cursor.c b/testcode/lib/cursor.c index 2d3504cb4..a608236cb 100644 --- a/testcode/lib/cursor.c +++ b/testcode/lib/cursor.c @@ -18,32 +18,32 @@ int main(void) { - char c; + char c; NEWLINE; cursor (1); - PRINTF("enter key (cursor on): "); - c = cgetc(); + PRINTF("enter key (cursor on): "); + c = cgetc(); NEWLINE; cursor (0); - PRINTF("enter key (cursor off): "); - c = cgetc(); + PRINTF("enter key (cursor off): "); + c = cgetc(); NEWLINE; - PRINTF("enter key (cursor on): "); + PRINTF("enter key (cursor on): "); cursor (1); - c = cgetc(); + c = cgetc(); NEWLINE; - PRINTF("enter key (cursor off): "); + PRINTF("enter key (cursor off): "); cursor (0); - c = cgetc(); + c = cgetc(); NEWLINE; PRINTF("hit any key to exit..."); c = cgetc(); NEWLINE; - return(0); + return(0); } diff --git a/testcode/lib/dir-test.c b/testcode/lib/dir-test.c index 93fdcb7c4..9102fc74d 100644 --- a/testcode/lib/dir-test.c +++ b/testcode/lib/dir-test.c @@ -1,17 +1,17 @@ /* - first test for posix directory routines for the c64 - kludges: - - currently uses cbm_open, which conflicts with standard i/o, - which in turn makes it infact kindof unuseable. this can - be easily changed however, since the only reason not to use - open/read was that it currently appends ,u,r to filenames - - the offset in current dir stream should better be calculated - from the values returned by "read". - - the type flag isnt filled in atm. - - scandir/alphasort/versionsort is missing - - some bits are currently untested (ie, unused in the testprogram) - 27/02/2003 gpz + first test for posix directory routines for the c64 + kludges: + - currently uses cbm_open, which conflicts with standard i/o, + which in turn makes it infact kindof unuseable. this can + be easily changed however, since the only reason not to use + open/read was that it currently appends ,u,r to filenames + - the offset in current dir stream should better be calculated + from the values returned by "read". + - the type flag isnt filled in atm. + - scandir/alphasort/versionsort is missing + - some bits are currently untested (ie, unused in the testprogram) + 27/02/2003 gpz */ #include diff --git a/testcode/lib/div-test.c b/testcode/lib/div-test.c index 5b34341f7..ce290ad38 100644 --- a/testcode/lib/div-test.c +++ b/testcode/lib/div-test.c @@ -11,30 +11,30 @@ #include static bool test(int dividend, int divisor) { - div_t result; + div_t result; - result = div(dividend, divisor); - printf("%+d/%+d= %+d, %+d%%%+d= %+d, div()= %+d, %+d\n", - dividend, divisor, dividend / divisor, - dividend, divisor, dividend % divisor, - result.quot, result.rem); - return result.quot * divisor + result.rem != dividend; - } + result = div(dividend, divisor); + printf("%+d/%+d= %+d, %+d%%%+d= %+d, div()= %+d, %+d\n", + dividend, divisor, dividend / divisor, + dividend, divisor, dividend % divisor, + result.quot, result.rem); + return result.quot * divisor + result.rem != dividend; + } int main(void) { - bool t; + bool t; - printf("\nTest of division and modulus operations:\n\n"); - t = test(+40, +3) || - test(+40, -3) || - test(-40, +3) || - test(-40, -3); - if (t) - printf("\nThe div() function made a wrong result!\n"); + printf("\nTest of division and modulus operations:\n\n"); + t = test(+40, +3) || + test(+40, -3) || + test(-40, +3) || + test(-40, -3); + if (t) + printf("\nThe div() function made a wrong result!\n"); #ifdef __ATARI__ - /* Atari DOS 2 clears the screen after program-termination, so wait. */ - printf("\nTap a key, to exit. "); - getchar(); + /* Atari DOS 2 clears the screen after program-termination, so wait. */ + printf("\nTap a key, to exit. "); + getchar(); #endif - return (int)t; - } + return (int)t; + } diff --git a/testcode/lib/em-test.c b/testcode/lib/em-test.c index d66d346e0..a6feed938 100644 --- a/testcode/lib/em-test.c +++ b/testcode/lib/em-test.c @@ -11,17 +11,17 @@ #elif defined(__C128__) #define DRIVERNAME "c128-ram.emd" #elif defined(__C16__) -#define DRIVERNAME "c16-ram.emd" +#define DRIVERNAME "c16-ram.emd" #elif defined(__CBM510__) -#define DRIVERNAME "cbm510-ram.emd" +#define DRIVERNAME "cbm510-ram.emd" #elif defined(__CBM610__) -#define DRIVERNAME "cbm610-ram.emd" +#define DRIVERNAME "cbm610-ram.emd" #elif defined(__APPLE2__) -#define DRIVERNAME "a2.auxmem.emd" +#define DRIVERNAME "a2.auxmem.emd" #elif defined(__APPLE2ENH__) -#define DRIVERNAME "a2e.auxmem.emd" +#define DRIVERNAME "a2e.auxmem.emd" #else -#define DRIVERNAME "unknown" +#define DRIVERNAME "unknown" #error "Unknown target system" #endif @@ -82,9 +82,9 @@ int main (void) clrscr (); Res = em_load_driver (DRIVERNAME); if (Res != EM_ERR_OK) { - cprintf ("Error in em_load_driver: %u\r\n", Res); + cprintf ("Error in em_load_driver: %u\r\n", Res); cprintf ("os: %u, %s\r\n", _oserror, _stroserror (_oserror)); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } atexit (cleanup); diff --git a/testcode/lib/getsp.s b/testcode/lib/getsp.s index 61ff02420..9f169dc0b 100644 --- a/testcode/lib/getsp.s +++ b/testcode/lib/getsp.s @@ -1,12 +1,12 @@ - .export _getsp - .importzp sp + .export _getsp + .importzp sp -.proc _getsp +.proc _getsp - ldx sp+1 - lda sp - rts + ldx sp+1 + lda sp + rts .endproc diff --git a/testcode/lib/heaptest.c b/testcode/lib/heaptest.c index 2058aabb6..fb10646cd 100644 --- a/testcode/lib/heaptest.c +++ b/testcode/lib/heaptest.c @@ -23,10 +23,10 @@ static char* Alloc (void) * also allow us to retrieve it later. */ if (P) { - memset (P, Size, Size); + memset (P, Size, Size); } else { - printf ("Could not allocate %u bytes\n", Size); - exit (EXIT_FAILURE); + printf ("Could not allocate %u bytes\n", Size); + exit (EXIT_FAILURE); } return P; } @@ -43,11 +43,11 @@ static void Free (unsigned char* P) /* Scan the block */ for (I = 1; I < Size; ++I) { - if (P[I] != Size) { - printf ("Scan failed - expected %02X, got %02X\n", - Size, P[I]); - exit (EXIT_FAILURE); - } + if (P[I] != Size) { + printf ("Scan failed - expected %02X, got %02X\n", + Size, P[I]); + exit (EXIT_FAILURE); + } } /* Free the block */ @@ -61,8 +61,8 @@ static void FillArray (void) { unsigned char I = 0; do { - V[I] = Alloc (); - ++I; + V[I] = Alloc (); + ++I; } while (I != 0); } @@ -75,20 +75,20 @@ static void ShowInfo (void) unsigned Count = 0; register struct freeblock* P = _heapfirst; while (P) { - ++Count; - P = P->next; + ++Count; + P = P->next; } printf ("%04X %04X %04X %04X %04X %u\n", - _heaporg, _heapptr, _heapend, _heapfirst, _heaplast, Count); + _heaporg, _heapptr, _heapend, _heapfirst, _heaplast, Count); if (Count) { - P = _heapfirst; - while (P) { - printf ("%04X %04X %04X %04X(%u)\n", - (unsigned) P, P[2], P[1], P[0], P[0]); - P = P->next; - } - getchar (); + P = _heapfirst; + while (P) { + printf ("%04X %04X %04X %04X(%u)\n", + (unsigned) P, P[2], P[1], P[0], P[0]); + P = P->next; + } + getchar (); } } @@ -99,8 +99,8 @@ static void Test1 (void) unsigned char I; FillArray (); for (I = 0; I < 0x80; ++I) { - Free (V[0x7F-I]); - Free (V[0x80+I]); + Free (V[0x7F-I]); + Free (V[0x80+I]); } ShowInfo (); } @@ -113,8 +113,8 @@ static void Test2 (void) FillArray (); I = 0; do { - Free (V[I]); - ++I; + Free (V[I]); + ++I; } while (I != 0); ShowInfo (); } @@ -127,8 +127,8 @@ static void Test3 (void) FillArray (); I = 0; do { - --I; - Free (V[I]); + --I; + Free (V[I]); } while (I != 0); ShowInfo (); } @@ -141,13 +141,13 @@ static void Test4 (void) FillArray (); I = 0; do { - Free (V[I]); - I += 2; + Free (V[I]); + I += 2; } while (I != 0); I = 1; do { - Free (V[I]); - I += 2; + Free (V[I]); + I += 2; } while (I != 1); ShowInfo (); } @@ -160,26 +160,26 @@ static void Test5 (void) FillArray (); I = 0; do { - Free (V[I]); - I += 2; + Free (V[I]); + I += 2; } while (I != 0); do { - V[I] = Alloc (); - I += 2; + V[I] = Alloc (); + I += 2; } while (I != 0); I = 1; do { - Free (V[I]); - I += 2; + Free (V[I]); + I += 2; } while (I != 1); do { - V[I] = Alloc (); - I += 2; + V[I] = Alloc (); + I += 2; } while (I != 1); I = 0; do { - Free (V[I]); - ++I; + Free (V[I]); + ++I; } while (I != 0); ShowInfo (); } @@ -192,16 +192,16 @@ static void Test6 (void) FillArray (); I = J = 0; do { - do { - Free (V[I]); - V[I] = Alloc (); - ++I; - } while (I != 0); - ++J; + do { + Free (V[I]); + V[I] = Alloc (); + ++I; + } while (I != 0); + ++J; } while (J < 5); do { - Free (V[I]); - ++I; + Free (V[I]); + ++I; } while (I != 0); ShowInfo (); } diff --git a/testcode/lib/joy-test.c b/testcode/lib/joy-test.c index e1f44f8e5..c4bda1e53 100644 --- a/testcode/lib/joy-test.c +++ b/testcode/lib/joy-test.c @@ -19,27 +19,27 @@ int main (void) unsigned char Res = joy_load_driver (joy_stddrv); #endif if (Res != JOY_ERR_OK) { - cprintf ("Error in joy_load_driver: %u\r\n", Res); + cprintf ("Error in joy_load_driver: %u\r\n", Res); cprintf ("os: %u, %s\r\n", _oserror, _stroserror (_oserror)); - exit (EXIT_FAILURE); + exit (EXIT_FAILURE); } clrscr (); count = joy_count (); cprintf ("Driver supports %d joystick(s)", count); while (1) { - for (i = 0; i < count; ++i) { - gotoxy (0, i+1); - j = joy_read (i); - cprintf ("%2d: %-6s%-6s%-6s%-6s%-6s%-6s", - i, - (j & joy_masks[JOY_UP])? " up " : " ---- ", - (j & joy_masks[JOY_DOWN])? " down " : " ---- ", - (j & joy_masks[JOY_LEFT])? " left " : " ---- ", - (j & joy_masks[JOY_RIGHT])? "right " : " ---- ", - (j & joy_masks[JOY_FIRE])? " fire " : " ---- ", - (j & joy_masks[JOY_FIRE2])? "fire2 " : " ---- "); - } + for (i = 0; i < count; ++i) { + gotoxy (0, i+1); + j = joy_read (i); + cprintf ("%2d: %-6s%-6s%-6s%-6s%-6s%-6s", + i, + (j & joy_masks[JOY_UP])? " up " : " ---- ", + (j & joy_masks[JOY_DOWN])? " down " : " ---- ", + (j & joy_masks[JOY_LEFT])? " left " : " ---- ", + (j & joy_masks[JOY_RIGHT])? "right " : " ---- ", + (j & joy_masks[JOY_FIRE])? " fire " : " ---- ", + (j & joy_masks[JOY_FIRE2])? "fire2 " : " ---- "); + } } return 0; } diff --git a/testcode/lib/mul-test.c b/testcode/lib/mul-test.c index ccbacf523..1ce626894 100644 --- a/testcode/lib/mul-test.c +++ b/testcode/lib/mul-test.c @@ -101,7 +101,7 @@ int main(void) ** (And, run emulators at their maximun speed.) */ #if 0 - continue; + continue; #endif /* Do one row of tests */ @@ -130,9 +130,9 @@ int main(void) } } - if (kbhit () && toupper (cgetc ()) == 'Q') { - goto Done; - } + if (kbhit () && toupper (cgetc ()) == 'Q') { + goto Done; + } res += lhs; } while (++rhs != 0); @@ -164,8 +164,8 @@ Done: #ifdef __ATARI__ if (_dos_type != SPARTADOS && _dos_type != OSADOS) { - cprintf ("\rTap a key, to exit. "); - cgetc(); + cprintf ("\rTap a key, to exit. "); + cgetc(); } #endif return 0; diff --git a/testcode/lib/rename-test.c b/testcode/lib/rename-test.c index 67785258d..0e9160b9e 100644 --- a/testcode/lib/rename-test.c +++ b/testcode/lib/rename-test.c @@ -20,36 +20,36 @@ int main(void) /* Generate two temporary file-names that have a random, unused spelling. */ _randomize(); for (;;) { - r = rand(); - sprintf(name1, "r%04.4u.1", (unsigned)r); - sprintf(name2, "r%04.4u.2", (unsigned)r); + r = rand(); + sprintf(name1, "r%04.4u.1", (unsigned)r); + sprintf(name2, "r%04.4u.2", (unsigned)r); - /* Ensure that neither file-name exists. */ - errno = 0; - file = fopen(name1, "r"); - if (file != NULL) { - fclose(file); - continue; /* try a different spelling */ - } + /* Ensure that neither file-name exists. */ + errno = 0; + file = fopen(name1, "r"); + if (file != NULL) { + fclose(file); + continue; /* try a different spelling */ + } - /* Make sure that fopen() failed for the right reason. */ - if (errno != ENOENT) { - perror("Disk error with first name"); - return EXIT_FAILURE; - } + /* Make sure that fopen() failed for the right reason. */ + if (errno != ENOENT) { + perror("Disk error with first name"); + return EXIT_FAILURE; + } - errno = 0; - file = fopen(name2, "r"); - if (file != NULL) { - fclose(file); - continue; - } - if (errno != ENOENT) { - perror("Disk error with second name"); - return EXIT_FAILURE; - } + errno = 0; + file = fopen(name2, "r"); + if (file != NULL) { + fclose(file); + continue; + } + if (errno != ENOENT) { + perror("Disk error with second name"); + return EXIT_FAILURE; + } - break; /* neither one exists; do next step */ + break; /* neither one exists; do next step */ } /* Create the first file. @@ -58,16 +58,16 @@ int main(void) printf("Creating file: %s\n", name1); file = fopen(name1, "w"); if (file == NULL) { - _poserror("Disk error making first file"); - return EXIT_FAILURE; + _poserror("Disk error making first file"); + return EXIT_FAILURE; } fclose(file); /* Verify that the file-name exists now. */ file = fopen(name1, "r"); if (file == NULL) { - _poserror("Cannot find first name"); - return EXIT_FAILURE; + _poserror("Cannot find first name"); + return EXIT_FAILURE; } fclose(file); @@ -78,23 +78,23 @@ int main(void) printf("Renaming %s to %s\n", name1, name2); r = rename(name1, name2); if (r < 0) { - _poserror("rename() failed"); - return EXIT_FAILURE; + _poserror("rename() failed"); + return EXIT_FAILURE; } /* Verify that the first file-name no longer exists. */ file = fopen(name1, "r"); if (file != NULL) { - fclose(file); - _poserror("First name still exists"); - return EXIT_FAILURE; + fclose(file); + _poserror("First name still exists"); + return EXIT_FAILURE; } /* Verify that the second file-name exists now. */ file = fopen(name2, "r"); if (file == NULL) { - _poserror("Cannot find second name"); - return EXIT_FAILURE; + _poserror("Cannot find second name"); + return EXIT_FAILURE; } fclose(file); @@ -104,8 +104,8 @@ int main(void) printf("Removing %s\n", name2); r = remove(name2); if (r < 0) { - _poserror("remove() failed"); - return EXIT_FAILURE; + _poserror("remove() failed"); + return EXIT_FAILURE; } printf("rename() passed the test.\n"); diff --git a/testcode/lib/scanf-test.c b/testcode/lib/scanf-test.c index 1f1da6f9e..85cfe39a7 100644 --- a/testcode/lib/scanf-test.c +++ b/testcode/lib/scanf-test.c @@ -209,7 +209,7 @@ int main(void) { "\tto the first argument.\r\n\n", t + 1, n1, test_data[t].v1.nvalue); } - else { /* test_data[t].type1 == CHAR */ + else { /* test_data[t].type1 == CHAR */ if (strcmp(test_data[t].v1.svalue, s1)) PRINTF("Test #%u assigned\r\n\"%s\",\r\n" "\tinstead of\r\n\"%s\",\r\n" @@ -223,7 +223,7 @@ int main(void) { "\tto the second argument.\r\n\n", t + 1, n2, test_data[t].v2.nvalue); } - else { /* test_data[t].type2 == CHAR */ + else { /* test_data[t].type2 == CHAR */ if (strcmp(test_data[t].v2.svalue, s2)) PRINTF("Test #%u assigned\r\n\"%s\",\r\n" "\tinstead of\r\n\"%s\",\r\n" @@ -249,8 +249,8 @@ int main(void) { */ PRINTF("Testing \"%%p\"...\r\n"); sprintf(s1, "%p %p %p %p", NULL, NULL, - Pause, /* static (program) storage */ - &c); /* automatic (stack) storage */ + Pause, /* static (program) storage */ + &c); /* automatic (stack) storage */ sscanf(s1, "%p%p%p %p", &p1, &p2, &p3, &p4); if (p1 != NULL || p2 != NULL || p3 != (void *)Pause || p4 != (void *)&c) diff --git a/testcode/lib/ser-test.c b/testcode/lib/ser-test.c index 0a631d4b0..a3f92b633 100644 --- a/testcode/lib/ser-test.c +++ b/testcode/lib/ser-test.c @@ -10,15 +10,15 @@ #elif defined(__C128__) #define DRIVERNAME "c128-swlink.ser" #elif defined(__PLUS4__) -#define DRIVERNAME "plus4-stdser.ser" +#define DRIVERNAME "plus4-stdser.ser" #elif defined(__CBM610__) -#define DRIVERNAME "cbm610-std.ser" +#define DRIVERNAME "cbm610-std.ser" #elif defined(__APPLE2__) -#define DRIVERNAME "a2.ssc.ser" +#define DRIVERNAME "a2.ssc.ser" #elif defined(__APPLE2ENH__) -#define DRIVERNAME "a2e.ssc.ser" +#define DRIVERNAME "a2e.ssc.ser" #else -#define DRIVERNAME "unknown" +#define DRIVERNAME "unknown" #error "Unknown target system" #endif diff --git a/testcode/lib/strchr-test.c b/testcode/lib/strchr-test.c index ed5b73f88..7aba1de1e 100644 --- a/testcode/lib/strchr-test.c +++ b/testcode/lib/strchr-test.c @@ -3,7 +3,7 @@ #include - + /* Test string. Must NOT have duplicate characters! */ static char S[] = "Helo wrd!\n"; @@ -26,28 +26,28 @@ int main (void) /* Search for all characters in the string, including the terminator */ for (I = 0; I < Len+1; ++I) { - /* Search for this char */ - P = strchr (S, S[I]); + /* Search for this char */ + P = strchr (S, S[I]); - /* Check if we found it */ - if (P == 0 || (P - S) != I) { - printf ("Failed for code 0x%02X, offset %u!\n", S[I], I); - printf ("P = %04X offset = %04X\n", P, P-S); - exit (EXIT_FAILURE); - } + /* Check if we found it */ + if (P == 0 || (P - S) != I) { + printf ("Failed for code 0x%02X, offset %u!\n", S[I], I); + printf ("P = %04X offset = %04X\n", P, P-S); + exit (EXIT_FAILURE); + } - /* Mark the char as checked */ - Found[S[I]] = 1; + /* Mark the char as checked */ + Found[S[I]] = 1; } /* Search for all other characters and make sure they aren't found */ for (I = 0; I < 256; ++I) { - if (Found[I] == 0) { - if (strchr (S, (char)I) != 0) { - printf ("Failed for code 0x%02X\n", I); - exit (EXIT_FAILURE); - } - } + if (Found[I] == 0) { + if (strchr (S, (char)I) != 0) { + printf ("Failed for code 0x%02X\n", I); + exit (EXIT_FAILURE); + } + } } /* Test passed */ diff --git a/testcode/lib/strdup-test.c b/testcode/lib/strdup-test.c index 535ec9caa..5514471f9 100644 --- a/testcode/lib/strdup-test.c +++ b/testcode/lib/strdup-test.c @@ -5,11 +5,11 @@ /* From _heap.h */ -extern unsigned _horg; /* Bottom of heap */ -extern unsigned _hptr; /* Current top */ -extern unsigned _hend; /* Upper limit */ -extern unsigned _hfirst; /* First free block in list */ -extern unsigned _hlast; /* Last free block in list */ +extern unsigned _horg; /* Bottom of heap */ +extern unsigned _hptr; /* Current top */ +extern unsigned _hend; /* Upper limit */ +extern unsigned _hfirst; /* First free block in list */ +extern unsigned _hlast; /* Last free block in list */ static unsigned char* V[256]; @@ -23,20 +23,20 @@ static void ShowInfo (void) unsigned Count = 0; unsigned** P = (unsigned**) _hfirst; while (P) { - ++Count; - P = P[1]; + ++Count; + P = P[1]; } printf ("%04X %04X %04X %04X %04X %u\n", - _horg, _hptr, _hend, _hfirst, _hlast, Count); + _horg, _hptr, _hend, _hfirst, _hlast, Count); if (Count) { - P = (unsigned**) _hfirst; - while (P) { - printf ("%04X %04X %04X %04X(%u)\n", - (unsigned) P, P[2], P[1], P[0], P[0]); - P = P[1]; - } - getchar (); + P = (unsigned**) _hfirst; + while (P) { + printf ("%04X %04X %04X %04X(%u)\n", + (unsigned) P, P[2], P[1], P[0], P[0]); + P = P[1]; + } + getchar (); } } @@ -51,10 +51,10 @@ static const char* RandStr (void) char C; for (I = 0; I < Len; ++I) { - do { - C = rand() & 0xFF; - } while (C == 0); - S[I] = C; + do { + C = rand() & 0xFF; + } while (C == 0); + S[I] = C; } S[Len] = '\0'; @@ -68,8 +68,8 @@ static void FillArray (void) { unsigned char I = 0; do { - V[I] = strdup (RandStr ()); - ++I; + V[I] = strdup (RandStr ()); + ++I; } while (I != 0); } @@ -80,8 +80,8 @@ static void FreeArray (void) { unsigned char I = 0; do { - free (V[I]); - ++I; + free (V[I]); + ++I; } while (I != 0); } diff --git a/testcode/lib/strncmp-test.c b/testcode/lib/strncmp-test.c index 453eb88fe..b15565036 100644 --- a/testcode/lib/strncmp-test.c +++ b/testcode/lib/strncmp-test.c @@ -17,7 +17,7 @@ int main (void) { char I; for (I = 0; I < 20; ++I) { - printf ("%02d: %d\n", I, strncmp (S1, S2, I)); + printf ("%02d: %d\n", I, strncmp (S1, S2, I)); } return 0; } diff --git a/util/atari/ataricvt.c b/util/atari/ataricvt.c index 35a8ebb5b..104d4f6de 100644 --- a/util/atari/ataricvt.c +++ b/util/atari/ataricvt.c @@ -4,13 +4,13 @@ int main (void) { int C; while ((C = getchar ()) != EOF) { - if (C == 0x9B) { - putchar ('\n'); - } else if (C == 0x7F) { - putchar ('\t'); - } else { - putchar (C); - } + if (C == 0x9B) { + putchar ('\n'); + } else if (C == 0x7F) { + putchar ('\t'); + } else { + putchar (C); + } } return 0; } diff --git a/util/cbm/cbmcvt.c b/util/cbm/cbmcvt.c index fe5bea718..11c0325e4 100644 --- a/util/cbm/cbmcvt.c +++ b/util/cbm/cbmcvt.c @@ -32,24 +32,24 @@ int main (int argc, char *argv[]) { size_t I = 0u; if (isatty(fileno(stdin))) { - fputs("cbmcvt v2.1 -- Conversion Filter (stdin --> stdout)\n" - " -p converts ISO-8859-1 to PetSCII\n" - " else, converts in other direction.\n", stderr); - return 0; - } + fputs("cbmcvt v2.1 -- Conversion Filter (stdin --> stdout)\n" + " -p converts ISO-8859-1 to PetSCII\n" + " else, converts in other direction.\n", stderr); + return 0; + } if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'p') { - while ((C = fgetc (stdin)) != EOF) { - fputc (CTPET[C], stdout); - } + while ((C = fgetc (stdin)) != EOF) { + fputc (CTPET[C], stdout); + } } else { - /* Create translation table PetSCII -> ISO-8859-1 */ - for (; I < sizeof CTPET; ++I) { - CTISO[CTPET[I]] = I; - } + /* Create translation table PetSCII -> ISO-8859-1 */ + for (; I < sizeof CTPET; ++I) { + CTISO[CTPET[I]] = I; + } - while ((C = fgetc (stdin)) != EOF) { - fputc (CTISO[C], stdout); - } + while ((C = fgetc (stdin)) != EOF) { + fputc (CTISO[C], stdout); + } } return 0; } diff --git a/util/zlib/deflater.c b/util/zlib/deflater.c index 59ee3f7e5..34fac2779 100644 --- a/util/zlib/deflater.c +++ b/util/zlib/deflater.c @@ -15,76 +15,76 @@ int main(int argc, char* argv[]) { - FILE* fp; - char* inbuf; - char* outbuf; - size_t inlen; - size_t outlen; - z_stream stream; + FILE* fp; + char* inbuf; + char* outbuf; + size_t inlen; + size_t outlen; + z_stream stream; - /* check command line */ - if (argc != 3) { - fprintf(stderr, - "Compresses a file to the DEFLATE format.\n" - "24 Aug 2002, Piotr Fusik \n" - "Usage: deflater input_file deflated_file\n" - ); - return 3; - } + /* check command line */ + if (argc != 3) { + fprintf(stderr, + "Compresses a file to the DEFLATE format.\n" + "24 Aug 2002, Piotr Fusik \n" + "Usage: deflater input_file deflated_file\n" + ); + return 3; + } - /* alloc buffers */ - inbuf = malloc(IN_SIZE_MAX); - outbuf = malloc(OUT_SIZE_MAX); - if (inbuf == NULL || outbuf == NULL) { - fprintf(stderr, "deflater: Out of memory!\n"); - return 1; - } + /* alloc buffers */ + inbuf = malloc(IN_SIZE_MAX); + outbuf = malloc(OUT_SIZE_MAX); + if (inbuf == NULL || outbuf == NULL) { + fprintf(stderr, "deflater: Out of memory!\n"); + return 1; + } - /* read input file */ - fp = fopen(argv[1], "rb"); - if (fp == NULL) { - perror(argv[1]); - return 1; - } - inlen = fread(inbuf, 1, IN_SIZE_MAX, fp); - fclose(fp); + /* read input file */ + fp = fopen(argv[1], "rb"); + if (fp == NULL) { + perror(argv[1]); + return 1; + } + inlen = fread(inbuf, 1, IN_SIZE_MAX, fp); + fclose(fp); - /* compress */ - stream.next_in = inbuf; - stream.avail_in = inlen; - stream.next_out = outbuf; - stream.avail_out = OUT_SIZE_MAX; - stream.zalloc = (alloc_func) 0; - stream.zfree = (free_func) 0; - if (deflateInit2(&stream, Z_BEST_COMPRESSION, Z_DEFLATED, - -MAX_WBITS, 9, Z_DEFAULT_STRATEGY) != Z_OK) { - fprintf(stderr, "deflater: deflateInit2 failed\n"); - return 1; - } - if (deflate(&stream, Z_FINISH) != Z_STREAM_END) { - fprintf(stderr, "deflater: deflate failed\n"); - return 1; - } - if (deflateEnd(&stream) != Z_OK) { - fprintf(stderr, "deflater: deflateEnd failed\n"); - return 1; - } + /* compress */ + stream.next_in = inbuf; + stream.avail_in = inlen; + stream.next_out = outbuf; + stream.avail_out = OUT_SIZE_MAX; + stream.zalloc = (alloc_func) 0; + stream.zfree = (free_func) 0; + if (deflateInit2(&stream, Z_BEST_COMPRESSION, Z_DEFLATED, + -MAX_WBITS, 9, Z_DEFAULT_STRATEGY) != Z_OK) { + fprintf(stderr, "deflater: deflateInit2 failed\n"); + return 1; + } + if (deflate(&stream, Z_FINISH) != Z_STREAM_END) { + fprintf(stderr, "deflater: deflate failed\n"); + return 1; + } + if (deflateEnd(&stream) != Z_OK) { + fprintf(stderr, "deflater: deflateEnd failed\n"); + return 1; + } - /* write output */ - fp = fopen(argv[2], "wb"); - if (fp == NULL) { - perror(argv[2]); - return 1; - } - outlen = fwrite(outbuf, 1, stream.total_out, fp); - fclose(fp); - if (outlen != stream.total_out) { - perror(argv[2]); - return 1; - } + /* write output */ + fp = fopen(argv[2], "wb"); + if (fp == NULL) { + perror(argv[2]); + return 1; + } + outlen = fwrite(outbuf, 1, stream.total_out, fp); + fclose(fp); + if (outlen != stream.total_out) { + perror(argv[2]); + return 1; + } - /* display summary */ - printf("Compressed %s (%d bytes) to %s (%d bytes)\n", - argv[1], inlen, argv[2], outlen); - return 0; + /* display summary */ + printf("Compressed %s (%d bytes) to %s (%d bytes)\n", + argv[1], inlen, argv[2], outlen); + return 0; }