Merge branch 'master' into master

This commit is contained in:
jedeoric
2019-01-25 10:15:21 +01:00
committed by GitHub
185 changed files with 2366 additions and 1226 deletions

View File

@@ -831,6 +831,104 @@ PDVS = $D1FF ;##rev2## parallel device select
POKEY = $D200 ;POKEY area POKEY = $D200 ;POKEY area
.include "atari_pokey.inc" .include "atari_pokey.inc"
; POKEY KBCODE Values
KEY_NONE = $FF
KEY_0 = $32
KEY_1 = $1F
KEY_2 = $1E
KEY_3 = $1A
KEY_4 = $18
KEY_5 = $1D
KEY_6 = $1B
KEY_7 = $33
KEY_8 = $35
KEY_9 = $30
KEY_A = $3F
KEY_B = $15
KEY_C = $12
KEY_D = $3A
KEY_E = $2A
KEY_F = $38
KEY_G = $3D
KEY_H = $39
KEY_I = $0D
KEY_J = $01
KEY_K = $05
KEY_L = $00
KEY_M = $25
KEY_N = $23
KEY_O = $08
KEY_P = $0A
KEY_Q = $2F
KEY_R = $28
KEY_S = $3E
KEY_T = $2D
KEY_U = $0B
KEY_V = $10
KEY_W = $2E
KEY_X = $16
KEY_Y = $2B
KEY_Z = $17
KEY_COMMA = $20
KEY_PERIOD = $22
KEY_SLASH = $26
KEY_SEMICOLON = $02
KEY_PLUS = $06
KEY_ASTERISK = $07
KEY_DASH = $0E
KEY_EQUALS = $0F
KEY_LESSTHAN = $36
KEY_GREATERTHAN = $37
KEY_ESC = $1C
KEY_TAB = $2C
KEY_SPACE = $21
KEY_RETURN = $0C
KEY_DELETE = $34
KEY_CAPS = $3C
KEY_INVERSE = $27
KEY_HELP = $11
KEY_F1 = $03
KEY_F2 = $04
KEY_F3 = $13
KEY_F4 = $14
KEY_SHIFT = $40
KEY_CTRL = $80
; Composed keys
KEY_EXCLAMATIONMARK = KEY_1 | KEY_SHIFT
KEY_QUOTE = KEY_2 | KEY_SHIFT
KEY_HASH = KEY_3 | KEY_SHIFT
KEY_DOLLAR = KEY_4 | KEY_SHIFT
KEY_PERCENT = KEY_5 | KEY_SHIFT
KEY_AMPERSAND = KEY_6 | KEY_SHIFT
KEY_APOSTROPHE = KEY_7 | KEY_SHIFT
KEY_AT = KEY_8 | KEY_SHIFT
KEY_OPENINGPARAN = KEY_9 | KEY_SHIFT
KEY_CLOSINGPARAN = KEY_0 | KEY_SHIFT
KEY_UNDERLINE = KEY_DASH | KEY_SHIFT
KEY_BAR = KEY_EQUALS | KEY_SHIFT
KEY_COLON = KEY_SEMICOLON | KEY_SHIFT
KEY_BACKSLASH = KEY_PLUS | KEY_SHIFT
KEY_CIRCUMFLEX = KEY_ASTERISK | KEY_SHIFT
KEY_OPENINGBRACKET = KEY_COMMA | KEY_SHIFT
KEY_CLOSINGBRACKET = KEY_PERIOD | KEY_SHIFT
KEY_QUESTIONMARK = KEY_SLASH | KEY_SHIFT
KEY_CLEAR = KEY_LESSTHAN | KEY_SHIFT
KEY_INSERT = KEY_GREATERTHAN | KEY_SHIFT
KEY_UP = KEY_UNDERLINE | KEY_CTRL
KEY_DOWN = KEY_EQUALS | KEY_CTRL
KEY_LEFT = KEY_PLUS | KEY_CTRL
KEY_RIGHT = KEY_ASTERISK | KEY_CTRL
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------
; ANTIC Address Equates ; ANTIC Address Equates
;------------------------------------------------------------------------- ;-------------------------------------------------------------------------

View File

@@ -41,4 +41,3 @@ POTGO = POKEY + $0B ;start potentiometer scan sequence
SEROUT = POKEY + $0D ;serial port output SEROUT = POKEY + $0D ;serial port output
IRQEN = POKEY + $0E ;IRQ interrupt enable IRQEN = POKEY + $0E ;IRQ interrupt enable
SKCTL = POKEY + $0F ;serial port and keyboard control SKCTL = POKEY + $0F ;serial port and keyboard control

View File

@@ -45,20 +45,6 @@ KBDREPEAT := $028a
KBDREPEATRATE := $028b KBDREPEATRATE := $028b
KBDREPEATDELAY := $028c KBDREPEATDELAY := $028c
; ---------------------------------------------------------------------------
; Kernal routines
; Direct entries
CURS_SET := $CD57
CURS_ON := $CD6F
CURS_OFF := $CD9F
CLRSCR := $C142
KBDREAD := $C006
NEWLINE := $C363
PRINT := $C322
NMIEXIT := $FF33
INDFET := $FF74
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; Vectors ; Vectors

View File

@@ -37,14 +37,6 @@ KBDREPEAT := $28a
KBDREPEATRATE := $28b KBDREPEATRATE := $28b
KBDREPEATDELAY := $28c KBDREPEATDELAY := $28c
; ---------------------------------------------------------------------------
; Kernal routines
; Direct entries
CLRSCR := $E544
KBDREAD := $E5B4
NMIEXIT := $FEBC
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; Vector and other locations ; Vector and other locations

View File

@@ -82,3 +82,28 @@ UDTIM := $FFEA
PLOT := $FFF0 PLOT := $FFF0
IOBASE := $FFF3 IOBASE := $FFF3
.endif .endif
; ---------------------------------------------------------------------------
; Kernal routines, direct entries
.if .def(__VIC20__)
CLRSCR := $E55F
KBDREAD := $E5CF
.elseif .def(__C64__)
CLRSCR := $E544
KBDREAD := $E5B4
NMIEXIT := $FEBC
.elseif .def(__C128__)
CLRSCR := $C142
KBDREAD := $C006
NMIEXIT := $FF33
NEWLINE := $C363
PRINT := $C322
CURS_SET := $CD57
CURS_ON := $CD6F
CURS_OFF := $CD9F
INDFET := $FF74
.elseif .def(__C16__)
CLRSCR := $D88B
KBDREAD := $D8C1
.endif

View File

@@ -37,13 +37,6 @@ KBDREPEAT := $540
KBDREPEATRATE := $541 KBDREPEATRATE := $541
KBDREPEATDELAY := $542 KBDREPEATDELAY := $542
; ---------------------------------------------------------------------------
; Kernal routines
; Direct entries
CLRSCR := $D88B
KBDREAD := $D8C1
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; Vector and other locations ; Vector and other locations
@@ -90,5 +83,3 @@ TED_RAMSEL := $FF3F
ENABLE_ROM := TED_ROMSEL ENABLE_ROM := TED_ROMSEL
ENABLE_RAM := TED_RAMSEL ENABLE_RAM := TED_RAMSEL

View File

@@ -41,15 +41,15 @@
VERSION .byte 1 ; Interface version VERSION .byte 1 ; Interface version
LIBREF .addr ; Library reference LIBREF .addr ; Library reference
JUMPTAB .struct JUMPTAB .struct
INSTALL .addr ; INSTALL routine SER_INSTALL .addr ; SER_INSTALL routine
UNINSTALL .addr ; UNINSTALL routine SER_UNINSTALL .addr ; SER_UNINSTALL routine
OPEN .addr ; OPEN routine SER_OPEN .addr ; SER_OPEN routine
CLOSE .addr ; CLOSE routine SER_CLOSE .addr ; SER_CLOSE routine
GET .addr ; GET routine SER_GET .addr ; SER_GET routine
PUT .addr ; PUT routine SER_PUT .addr ; SER_PUT routine
STATUS .addr ; STATUS routine SER_STATUS .addr ; SER_STATUS routine
IOCTL .addr ; IOCTL routine SER_IOCTL .addr ; SER_IOCTL routine
IRQ .addr ; IRQ routine SER_IRQ .addr ; SER_IRQ routine
.endstruct .endstruct
.endstruct .endstruct
@@ -160,4 +160,3 @@ SER_STATUS_DSR = $40 ; NOT data set ready
.global _ser_ioctl .global _ser_ioctl
.global _ser_clear_ptr .global _ser_clear_ptr

View File

@@ -73,7 +73,9 @@ XLPRBI := $48 ; Printer flag (b7)
HRSX40 := $49 HRSX40 := $49
HRSX6 := $4A HRSX6 := $4A
ADHRS := $4B ; hires screen address (word) ADHRS := $4B ; hires screen address (word)
HRS1 := $4D HRS1 := $4D
HRS2 := $4F HRS2 := $4F
HRS3 := $51 HRS3 := $51
@@ -229,8 +231,10 @@ XFREAD = $27 ; Only in TELEMON 3.x (bank 7 of Orix)
XBINDX = $28 ; Convert a number into hex and displays on channel 0 XBINDX = $28 ; Convert a number into hex and displays on channel 0
XDECIM = $29 XDECIM = $29
XHEXA = $2A ; Convert a number into hex XHEXA = $2A ; Convert a number into hex
XEDT = $2D ; Launch editor XEDT = $2D ; Launch editor
XINSER = $2E XINSER = $2E
XSCELG = $2F ; Search a line in editor mode XSCELG = $2F ; Search a line in editor mode
XOPEN = $30 ; Only in TELEMON 3.x (bank 7 of Orix) XOPEN = $30 ; Only in TELEMON 3.x (bank 7 of Orix)
XECRPR = $33 ; Displays prompt XECRPR = $33 ; Displays prompt
@@ -299,6 +303,7 @@ BUFTRV := $100
; Page $200 ; Page $200
BNKST := $200 ; Used to store signature of 8 bank (length : 8 bytes) BNKST := $200 ; Used to store signature of 8 bank (length : 8 bytes)
TABDRV := $208 TABDRV := $208
DRVDEF := $20C DRVDEF := $20C
FLGTEL := $20D FLGTEL := $20D
KOROM := $20E ; Used to compute the size of all rom bank. The result is store here. The value is in KB KOROM := $20E ; Used to compute the size of all rom bank. The result is store here. The value is in KB
@@ -314,10 +319,12 @@ FLGCUR := $216 ; cursor management flag
; screens position managements ; screens position managements
FLGCUR_STATE := $217 ; cursor state flag FLGCUR_STATE := $217 ; cursor state flag
ADSCRL := $218 ADSCRL := $218
ADSCRH := $21C ADSCRH := $21C
SCRX := $220 SCRX := $220
SCRY := $224 SCRY := $224
SCRDX := $228 SCRDX := $228
SCRFX := $22C SCRFX := $22C
SCRDY := $230 SCRDY := $230
@@ -335,15 +342,16 @@ SCRTXT := $256
SCRHIR := $25C SCRHIR := $25C
SCRTRA := $262 ; 6 bytes lenfth SCRTRA := $262 ; 6 bytes lenfth
; Keyboard management ; Keyboard management
KBDCOL := $268 ; 8 bytes length KBDCOL := $268 ; 8 bytes length
KBDFLG_KEY := $270 ; 0 if no key pressed KBDFLG_KEY := $270 ; 0 if no key pressed
KBDVRR := $272 KBDVRR := $272
KBDVRL := $273 KBDVRL := $273
FLGKBD := $275 FLGKBD := $275
KBDFCT := $276 KBDFCT := $276
KBDSHT := $278 KBDSHT := $278
KBDKEY := $279 KBDKEY := $279
KBDCTC := $27E KBDCTC := $27E
LPRX := $286 LPRX := $286
@@ -371,6 +379,7 @@ FLGRST := $2EE
CSRND := $2EF CSRND := $2EF
VNMI := $2F4 VNMI := $2F4
ADIODB_VECTOR := $2f7 ; 3 bytes length ADIODB_VECTOR := $2f7 ; 3 bytes length
IRQVECTOR := $2FA IRQVECTOR := $2FA
VAPLIC := $2FD VAPLIC := $2FD
@@ -459,6 +468,59 @@ XPBUF1 := $FFA4
XPMAP := $FFA7 XPMAP := $FFA7
XRWTS := $FFAA XRWTS := $FFAA
; ---------------------------------------------------------------------------
; Stratsed vectors
; Stratsed is the main OS for Telestrat
XMERGE := $FF0E
XFST := $FF11
XSPUT := $FF14
XSTAKE := $FF17
XTAKE := $FF20
XOPENS := $FF1A ; XOPEN from Stratsed
XCLOSES := $FF1D ; XCLOSE from Stratsed
XPUT := $FF23
XREWIN := $FF29
XJUMP := $FF2C
XLGBUF := $FF2F
XERVEC := $FF32
XESAVE := $FF35
XCOPY := $FF38
XDNAME := $FF3B
XSTATU := $FF3E
XUPDAT := $FF41
XFORMA := $FF44
XDELBK := $FF4A
XDELN := $FF4D
XPROT := $FF50
XUNPRO := $FF53
XDIRN := $FF56
XBKP := $FF59
XINITI := $FF5C
XERREU := $FF5F
XLOAD := $FF62
XDEFSA := $FF65
XDEFLO := $FF68
XSAVE := $FF6B
XNOMDE := $FF6E
XCREAY := $FF71
XDETSE := $FF74
XLIBSE := $FF77
XTRVCA := $FF7A
XTRVNM := $FF7D
XTRVNX := $FF80
XBUCA := $FF86
XVBUF1 := $FF89
XSVSEC := $FF8C
XSAY := $FF8F
XSBUF1 := $FF92
XSBUF2 := $FF95
XSBUF3 := $FF98
XSCAT := $FF9B
XPRSEC := $FFA1
XPBUF1 := $FFA4
XPMAP := $FFA7
XRWTS := $FFAA
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; MACRO ; MACRO

View File

@@ -41,13 +41,6 @@ KBDREPEATDELAY := $28c
XSIZE = 22 XSIZE = 22
YSIZE = 23 YSIZE = 23
; ---------------------------------------------------------------------------
; Kernal routines
; Direct entries
CLRSCR := $E55F
KBDREAD := $E5CF
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; Vector and other locations ; Vector and other locations
@@ -59,9 +52,25 @@ NMIVec := $0318
; I/O: 6560 VIC ; I/O: 6560 VIC
VIC := $9000 VIC := $9000
VIC_LINES := $9003 ; Screen lines, bit 7 is bit 0 from VIC_HLINE VIC_CR0 := VIC+$0
VIC_HLINE := $9004 ; Rasterline, bits 1-8 VIC_CR1 := VIC+$1
VIC_COLOR := $900F ; Border and background color VIC_CR2 := VIC+$2
VIC_CR3 := VIC+$3
VIC_LINES := VIC+$3 ; Screen lines, bit 7 is bit 0 from VIC_HLINE
VIC_CR4 := VIC+$4
VIC_HLINE := VIC+$4 ; Rasterline, bits 1-8
VIC_CR5 := VIC+$5
VIC_CR6 := VIC+$6
VIC_CR7 := VIC+$7
VIC_CR8 := VIC+$8
VIC_CR9 := VIC+$9
VIC_CRA := VIC+$A
VIC_CRB := VIC+$B
VIC_CRC := VIC+$C
VIC_CRD := VIC+$D
VIC_CRE := VIC+$E
VIC_CRF := VIC+$F
VIC_COLOR := VIC+$F ; Border and background color
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
; I/O: 6522 VIA1 ; I/O: 6522 VIA1

View File

@@ -1,15 +1,19 @@
FEATURES {
STARTADDRESS: default = $4000;
}
SYMBOLS { SYMBOLS {
__BACKBUFSIZE__: type = weak, value = $2000; __BACKBUFSIZE__: type = weak, value = $2000;
__HIMEM__: type = weak, value = $C000 - __BACKBUFSIZE__;
__OVERLAYSIZE__: type = weak, value = $0000; __OVERLAYSIZE__: type = weak, value = $0000;
__OVERLAYADDR__: type = weak, value = $C000 - __BACKBUFSIZE__ - __OVERLAYSIZE__; __OVERLAYADDR__: type = weak, value = __HIMEM__ - __OVERLAYSIZE__;
__STACKSIZE__: type = weak, value = $0400; __STACKSIZE__: type = weak, value = $0400; # 1k stack
__STACKADDR__: type = weak, value = $2000 - __STACKSIZE__; __STACKADDR__: type = weak, value = $2000 - __STACKSIZE__;
} }
MEMORY { MEMORY {
CVT: file = %O, start = $0, size = $20000; CVT: file = %O, start = $0, size = $20000;
ZP: define = yes, start = $80, size = $1A + $06; ZP: define = yes, start = $80, size = $1A + $06;
EXT: define = yes, start = $0C00, size = __STACKADDR__ - $0C00; EXT: define = yes, start = $0C00, size = __STACKADDR__ - __EXT_START__;
VLIR0: define = yes, start = $4000, size = __OVERLAYADDR__ - $4000; VLIR0: define = yes, start = %S, size = __OVERLAYADDR__ - %S;
VLIR1: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; VLIR1: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;
VLIR2: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; VLIR2: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;
VLIR3: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; VLIR3: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;

View File

@@ -1,14 +1,18 @@
FEATURES {
STARTADDRESS: default = $0400;
}
SYMBOLS { SYMBOLS {
__BACKBUFSIZE__: type = weak, value = $2000; __BACKBUFSIZE__: type = weak, value = $2000;
__HIMEM__: type = weak, value = $8000 - __BACKBUFSIZE__;
__OVERLAYSIZE__: type = weak, value = $0000; __OVERLAYSIZE__: type = weak, value = $0000;
__OVERLAYADDR__: type = weak, value = $8000 - __BACKBUFSIZE__ - __OVERLAYSIZE__; __OVERLAYADDR__: type = weak, value = __HIMEM__ - __OVERLAYSIZE__;
__STACKSIZE__: type = weak, value = $0400; __STACKSIZE__: type = weak, value = $0400; # 1k stack
__STACKADDR__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__; __STACKADDR__: type = weak, value = __OVERLAYADDR__ - __STACKSIZE__;
} }
MEMORY { MEMORY {
CVT: file = %O, start = $0, size = $40000; CVT: file = %O, start = $0, size = $40000;
ZP: define = yes, start = $58, size = $1A + $06; ZP: define = yes, start = $58, size = $1A + $06;
VLIR0: define = yes, start = $0400, size = __STACKADDR__ - $0400; VLIR0: define = yes, start = %S, size = __STACKADDR__ - %S;
VLIR1: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; VLIR1: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;
VLIR2: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; VLIR2: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;
VLIR3: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__; VLIR3: define = yes, start = __OVERLAYADDR__, size = __OVERLAYSIZE__;

View File

@@ -1,13 +1,17 @@
FEATURES {
STARTADDRESS: default = $1001;
}
SYMBOLS { SYMBOLS {
__LOADADDR__: type = import; __LOADADDR__: type = import;
__EXEHDR__: type = import; __EXEHDR__: type = import;
__STACKSIZE__: type = weak, value = $0800; # 2k stack __STACKSIZE__: type = weak, value = $0800; # 2k stack
__HIMEM__: type = weak, value = $FD00;
} }
MEMORY { MEMORY {
ZP: file = "", define = yes, start = $0002, size = $001A; ZP: file = "", define = yes, start = $0002, size = $001A;
LOADADDR: file = %O, start = $0FFF, size = $0002; LOADADDR: file = %O, start = %S - 2, size = $0002;
HEADER: file = %O, start = $1001, size = $000C; HEADER: file = %O, define = yes, start = %S, size = $000D;
MAIN: file = %O, define = yes, start = $100D, size = $ECF3 - __STACKSIZE__; MAIN: file = %O, define = yes, start = __HEADER_LAST__, size = __HIMEM__ - __MAIN_START__ - __STACKSIZE__;
} }
SEGMENTS { SEGMENTS {
ZEROPAGE: load = ZP, type = zp; ZEROPAGE: load = ZP, type = zp;
@@ -15,8 +19,8 @@ SEGMENTS {
EXEHDR: load = HEADER, type = ro; EXEHDR: load = HEADER, type = ro;
STARTUP: load = MAIN, type = ro; STARTUP: load = MAIN, type = ro;
LOWCODE: load = MAIN, type = ro, optional = yes; LOWCODE: load = MAIN, type = ro, optional = yes;
ONCE: load = MAIN, type = ro, optional = yes;
CODE: load = MAIN, type = ro; CODE: load = MAIN, type = ro;
ONCE: load = MAIN, type = ro, optional = yes;
RODATA: load = MAIN, type = ro; RODATA: load = MAIN, type = ro;
DATA: load = MAIN, type = rw; DATA: load = MAIN, type = rw;
INIT: load = MAIN, type = bss; INIT: load = MAIN, type = bss;

View File

@@ -46,7 +46,7 @@ clean:
$(RM) -r ../html ../info $(RM) -r ../html ../info
install: install:
$(if $(PREFIX),,$(error variable `PREFIX' must be set)) $(if $(PREFIX),,$(error variable "PREFIX" must be set))
ifeq ($(wildcard ../html),../html) ifeq ($(wildcard ../html),../html)
$(INSTALL) -d $(DESTDIR)$(htmldir) $(INSTALL) -d $(DESTDIR)$(htmldir)
$(INSTALL) -m0644 ../html/*.* $(DESTDIR)$(htmldir) $(INSTALL) -m0644 ../html/*.* $(DESTDIR)$(htmldir)

View File

@@ -469,25 +469,47 @@ BASIC.SYSTEM) there are some limitations for DOS 3.3:
<sect1>Direct console I/O<p> <sect1>Direct console I/O<p>
<descrip> The Apple&nbsp;&rsqb;&lsqb; has no color text mode. Therefore the functions
<tt/textcolor()/, <tt/bgcolor()/ and <tt/bordercolor()/ have no effect.
<tag/Color/
The Apple&nbsp;&rsqb;&lsqb; has no color text mode. Therefore the functions textcolor(),
bgcolor() and bordercolor() have no effect.
</descrip><p>
<sect1>Random number generator<p> <sect1>Random number generator<p>
<descrip> The random number seed is generated from the time the program waits for user input.
Therefore it is necessary to wait for at least one user keypress either via Standard
I/O or via Direct console I/O before initializing the pseudo random number generator.
<tag/Random number seed/
The random number seed is generated from the time the program waits for user input.
Therefore it is necessary to wait for at least one user keypress either via Standard
I/O or via Direct console I/O before initializing the pseudo random number generator.
</descrip><p> <sect1>Realtime clock<p>
There are several types of realtime clocks. It's not desirable to have specific code
for all of them. As ProDOS 8 supports file timestamps, realtime clock owners usually
use ProDOS 8 drivers for their realtime clock. Those drivers read the realtime clock
and write the result to the date/time location in RAM (&dollar;BF90 to &dollar;BF93).
ProDOS 8 reads the date/time from that RAM location. If there's no realtime clock the
RAM location keeps containing zeros. ProDOS 8 uses those zeros as timestamps and the
files show up in a directory as <tt/&lt;NO DATE&gt;/.
There's no common interface to set realtime clocks so if a realtme clock <bf/IS/
present there's just nothing to do. However, if there's <bf/NO/ realtime clock present,
the user might very well be interested to "manually" set the RAM location in order to
have timestamps. But he surely doesn't want to manually set the RAM location over and
over again. Rather he wants to set it just once after booting ProDOS 8.
From that perspective it makes most sense to not set both the date and the time but
rather only set the date and have the time just stay zero. Then files show up in a
directory as <tt/DD-MON-YY 0:00/.
So <tt/clock_settime()/ checks if the current time equals 0:00. If it does <bf/NOT/
then a realtime clock is supposed to be active and <tt/clock_settime()/ fails with
<tt/ERANGE/. Otherwise <tt/clock_settime()/ sets the date - and completely ignores
the time provided as parameter.
<tt/clock_getres()/ too checks if the current time equals 0:00. If it does <bf/NOT/
then a realtime clock is supposed to be active and <tt/clock_getres()/ returns a time
resolution of one minute. Otherwise <tt/clock_getres()/ presumes that the only one
who sets the RAM location is <tt/clock_settime()/ and therefore returns a time
resolution of one day.

View File

@@ -470,25 +470,47 @@ BASIC.SYSTEM) there are some limitations for DOS 3.3:
<sect1>Direct console I/O<p> <sect1>Direct console I/O<p>
<descrip> The enhanced&nbsp;Apple&nbsp;//e has no color text mode. Therefore the functions
<tt/textcolor()/, <tt/bgcolor()/ and <tt/bordercolor()/ have no effect.
<tag/Color/
The enhanced&nbsp;Apple&nbsp;//e has no color text mode. Therefore the functions
textcolor(), bgcolor() and bordercolor() have no effect.
</descrip><p>
<sect1>Random number generator<p> <sect1>Random number generator<p>
<descrip> The random number seed is generated from the time the program waits for user input.
Therefore it is necessary to wait for at least one user keypress either via Standard
I/O or via Direct console I/O before initializing the pseudo random number generator.
<tag/Random number seed/
The random number seed is generated from the time the program waits for user input.
Therefore it is necessary to wait for at least one user keypress either via Standard
I/O or via Direct console I/O before initializing the pseudo random number generator.
</descrip><p> <sect1>Realtime clock<p>
There are several types of realtime clocks. It's not desirable to have specific code
for all of them. As ProDOS 8 supports file timestamps, realtime clock owners usually
use ProDOS 8 drivers for their realtime clock. Those drivers read the realtime clock
and write the result to the date/time location in RAM (&dollar;BF90 to &dollar;BF93).
ProDOS 8 reads the date/time from that RAM location. If there's no realtime clock the
RAM location keeps containing zeros. ProDOS 8 uses those zeros as timestamps and the
files show up in a directory as <tt/&lt;NO DATE&gt;/.
There's no common interface to set realtime clocks so if a realtme clock <bf/IS/
present there's just nothing to do. However, if there's <bf/NO/ realtime clock present,
the user might very well be interested to "manually" set the RAM location in order to
have timestamps. But he surely doesn't want to manually set the RAM location over and
over again. Rather he wants to set it just once after booting ProDOS 8.
From that perspective it makes most sense to not set both the date and the time but
rather only set the date and have the time just stay zero. Then files show up in a
directory as <tt/DD-MON-YY 0:00/.
So <tt/clock_settime()/ checks if the current time equals 0:00. If it does <bf/NOT/
then a realtime clock is supposed to be active and <tt/clock_settime()/ fails with
<tt/ERANGE/. Otherwise <tt/clock_settime()/ sets the date - and completely ignores
the time provided as parameter.
<tt/clock_getres()/ too checks if the current time equals 0:00. If it does <bf/NOT/
then a realtime clock is supposed to be active and <tt/clock_getres()/ returns a time
resolution of one minute. Otherwise <tt/clock_getres()/ presumes that the only one
who sets the RAM location is <tt/clock_settime()/ and therefore returns a time
resolution of one day.

View File

@@ -40,7 +40,7 @@ The archiver is called as follows:
V Print the archiver version V Print the archiver version
</verb></tscreen> </verb></tscreen>
You may add modules to a library using the `r' command (`a' is deprecated). If the library You may add modules to a library using the <tt/'r'/ command ('a' is deprecated). If the library
does not exist, it is created (and a warning message is printed which you does not exist, it is created (and a warning message is printed which you
may ignore if creation of the library was your intention). You may may ignore if creation of the library was your intention). You may
specify any number of modules on the command line following the library. specify any number of modules on the command line following the library.
@@ -55,7 +55,7 @@ Here's an example:
ar65 r mysubs.lib sub1.o sub2.o ar65 r mysubs.lib sub1.o sub2.o
</verb></tscreen> </verb></tscreen>
This will add two modules to the library `mysubs.lib' creating the This will add two modules to the library 'mysubs.lib' creating the
library if necessary. If the library contains modules named sub1.o or library if necessary. If the library contains modules named sub1.o or
sub2.o, they are replaced by the new ones. sub2.o, they are replaced by the new ones.
@@ -65,9 +65,9 @@ Modules names in the library are stored without the path, so, using
ar65 v v r mysubs.lib ofiles/sub1.o ofiles/sub2.o ar65 v v r mysubs.lib ofiles/sub1.o ofiles/sub2.o
</verb></tscreen> </verb></tscreen>
will verbose add two modules named `sub1.o' and `sub2.o' to the library. will verbose add two modules named 'sub1.o' and 'sub2.o' to the library.
Deleting modules from a library is done with the `d' command. You may not Deleting modules from a library is done with the <tt/'d'/ command. You may not
give a path when naming the modules. give a path when naming the modules.
Example: Example:
@@ -76,11 +76,11 @@ Example:
ar65 d mysubs.lib sub1.o ar65 d mysubs.lib sub1.o
</verb></tscreen> </verb></tscreen>
This will delete the module named `sub1.o' from the library, printing an This will delete the module named 'sub1.o' from the library, printing an
error if the library does not contain that module. error if the library does not contain that module.
The `t' command prints a table of all modules in the library (`l' is deprecated). The <tt/'t'/ command prints a table of all modules in the library ('l' is deprecated).
Any module names on the command line are ignored. Any module names on the command line are ignored.
Example: Example:
@@ -90,7 +90,7 @@ Example:
</verb></tscreen> </verb></tscreen>
Using the `x' command, you may extract modules from the library. The Using the <tt/'x'/ command, you may extract modules from the library. The
modules named on the command line are extracted from the library and put modules named on the command line are extracted from the library and put
into the current directory. into the current directory.
@@ -107,7 +107,7 @@ Example for extracting a module from the library:
</verb></tscreen> </verb></tscreen>
The `V' command prints the version number of the assembler. If you send The <tt/'V'/ command prints the version number of the assembler. If you send
any suggestions or bugfixes, please include your version number. any suggestions or bugfixes, please include your version number.
In addition to these operations, the archiver will check for, and warn In addition to these operations, the archiver will check for, and warn

View File

@@ -29,7 +29,7 @@ supports XL type or newer machines (excluding the 600XL).
The <tt/atarixl/ runtime makes the whole 64K of memory available, with the The <tt/atarixl/ runtime makes the whole 64K of memory available, with the
exception of the I/O area at &dollar;D000 - &dollar;D7FF. Since the exception of the I/O area at &dollar;D000 - &dollar;D7FF. Since the
<tt/atarixl/ runtime has some <ref name="limitations" id="limitations">, it is <tt/atarixl/ runtime has some <ref name="limitations" id="xllimitations">, it is
recommended to use the <tt/atari/ target unless lack of memory dictates the recommended to use the <tt/atari/ target unless lack of memory dictates the
use of the <tt/atarixl/ target. use of the <tt/atarixl/ target.
@@ -329,20 +329,20 @@ unsigned char ScreenMemory[100];
void DisplayList = void DisplayList =
{ {
DL_BLK8, DL_BLK8,
DL_BLK8, DL_BLK8,
DL_BLK8, DL_BLK8,
DL_LMS(DL_CHR20x8x2), DL_LMS(DL_CHR20x8x2),
ScreenMemory, ScreenMemory,
DL_CHR20x8x2, DL_CHR20x8x2,
DL_CHR20x8x2, DL_CHR20x8x2,
DL_CHR20x8x2, DL_CHR20x8x2,
DL_BLK4, DL_BLK4,
DL_CHR20x8x2, DL_CHR20x8x2,
DL_JVB DL_JVB
}; };
... ...
POKEW(560,(unsigned int)&amp;DisplayList); // SDLSTL POKEW(560,(unsigned int)&amp;DisplayList); // SDLSTL
... ...
</verb> </verb>
@@ -411,6 +411,29 @@ char* pcAtasciiMappingString = "Hello Atari!";
does not. does not.
<sect1>Keyboard codes<p>
For direct keyboard scanning in conjunction with e.g. the OS location "CH" (764/$2FC),
all keyboard codes are available as defined values on C and assembler side.
Example:
<verb>
...
while (!kbhit());
switch (PEEK(764))
{
case KEY_RETURN:
...
case KEY_SPACE:
...
case KEY_1:
...
}
...
</verb>
You can find the C defines in the file "<tt/atari.h/" or "<tt/atari.inc/" for the assembler variant.
<sect>Loadable drivers<p> <sect>Loadable drivers<p>
@@ -611,7 +634,18 @@ interface module.
<sect>Limitations<p> <sect>Limitations<p>
<sect1><tt/atarixl/<#if output="info|latex2e"> limitations</#if><label id="limitations"<p> <sect1><tt/Realtime clock/<label id="realtimeclock"<p>
Access to the realtime clock is supported only when running on SpartaDOS-X.
There needs to be a realtime clock driver installed. This is normally the case
in the default installation (CONFIG.SYS) of SpartaDOS-X.
A missing realtime clock driver in SpartaDOS-X is not supported, and the program
may crash when calling the <tt/clock_settime()/ or <tt/clock_gettime()/
functions.
The resolution of the realtime clock driver is 1 second.
<sect1><tt/atarixl target/<#if output="info|latex2e"> limitations</#if><label id="xllimitations"<p>
<itemize> <itemize>
<item>The display is cleared at program start and at program termination. This is a side <item>The display is cleared at program start and at program termination. This is a side
@@ -932,16 +966,16 @@ chunk #2 (RAM memory area).
The contents of the new NEXEHDR and CHKHDR segments come from this The contents of the new NEXEHDR and CHKHDR segments come from this
file (split.s): file (split.s):
<tscreen><verb> <tscreen><verb>
.import __CODE_LOAD__, __BSS_LOAD__, __CODE_SIZE__ .import __CODE_LOAD__, __BSS_LOAD__, __CODE_SIZE__
.import __DATA_LOAD__, __RODATA_LOAD__, __STARTUP_LOAD__ .import __DATA_LOAD__, __RODATA_LOAD__, __STARTUP_LOAD__
.segment "NEXEHDR" .segment "NEXEHDR"
.word __STARTUP_LOAD__ .word __STARTUP_LOAD__
.word __CODE_LOAD__ + __CODE_SIZE__ - 1 .word __CODE_LOAD__ + __CODE_SIZE__ - 1
.segment "CHKHDR" .segment "CHKHDR"
.word __RODATA_LOAD__ .word __RODATA_LOAD__
.word __BSS_LOAD__ - 1 .word __BSS_LOAD__ - 1
</verb></tscreen> </verb></tscreen>
<p> <p>
Compile with Compile with
@@ -1008,16 +1042,16 @@ FEATURES {
New contents for NEXEHDR and CHKHDR are needed (split2.s): New contents for NEXEHDR and CHKHDR are needed (split2.s):
<tscreen><verb> <tscreen><verb>
.import __STARTUP_LOAD__, __BSS_LOAD__, __DATA_SIZE__ .import __STARTUP_LOAD__, __BSS_LOAD__, __DATA_SIZE__
.import __DATA_LOAD__, __RODATA_LOAD__ .import __DATA_LOAD__, __RODATA_LOAD__
.segment "NEXEHDR" .segment "NEXEHDR"
.word __RODATA_LOAD__ .word __RODATA_LOAD__
.word __DATA_LOAD__ + __DATA_SIZE__ - 1 .word __DATA_LOAD__ + __DATA_SIZE__ - 1
.segment "CHKHDR" .segment "CHKHDR"
.word __STARTUP_LOAD__ .word __STARTUP_LOAD__
.word __BSS_LOAD__ - 1 .word __BSS_LOAD__ - 1
</verb></tscreen> </verb></tscreen>
Compile with Compile with
@@ -1048,7 +1082,7 @@ If you are using a customized linker config file you might get some errors
regarding the MAINHDR segment. Like this: regarding the MAINHDR segment. Like this:
<tscreen><verb> <tscreen><verb>
ld65: Error: Missing memory area assignment for segment `MAINHDR' ld65: Error: Missing memory area assignment for segment 'MAINHDR'
</verb></tscreen> </verb></tscreen>
The old "HEADER" memory description contained six bytes: &dollar;FFFF The old "HEADER" memory description contained six bytes: &dollar;FFFF
@@ -1096,14 +1130,14 @@ including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions: freely, subject to the following restrictions:
<enum> <enum>
<item> The origin of this software must not be misrepresented; you must not <item> The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be in a product, an acknowledgment in the product documentation would be
appreciated but is not required. appreciated but is not required.
<item> Altered source versions must be plainly marked as such, and must not <item> Altered source versions must be plainly marked as such, and must not
be misrepresented as being the original software. be misrepresented as being the original software.
<item> This notice may not be removed or altered from any source <item> This notice may not be removed or altered from any source
distribution. distribution.
</enum> </enum>
</article> </article>

View File

@@ -339,6 +339,13 @@ The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/c128-
<sect>Limitations<p> <sect>Limitations<p>
<sect1>Realtime clock<p>
The realtime clock functions use the CIA1 TOD clock. As that clock only stores
the time but not the date, the date set by <tt/clock_settime()/ is simply stored
inside the C library for retrieval in the same program via <tt/clock_gettime()/.
<sect>Other hints<p> <sect>Other hints<p>

View File

@@ -418,6 +418,13 @@ The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/c64-1
<sect>Limitations<p> <sect>Limitations<p>
<sect1>Realtime clock<p>
The realtime clock functions use the CIA1 TOD clock. As that clock only stores
the time but not the date, the date set by <tt/clock_settime()/ is simply stored
inside the C library for retrieval in the same program via <tt/clock_gettime()/.
<sect>Other hints<p> <sect>Other hints<p>

View File

@@ -2730,7 +2730,7 @@ Here's a list of all control commands and a description, what they do:
<tag><tt>at_in_identifiers</tt><label id="at_in_identifiers"></tag> <tag><tt>at_in_identifiers</tt><label id="at_in_identifiers"></tag>
Accept the at character (`@') as a valid character in identifiers. The Accept the at character ('@') as a valid character in identifiers. The
at character is not allowed to start an identifier, even with this at character is not allowed to start an identifier, even with this
feature enabled. feature enabled.
@@ -2765,13 +2765,13 @@ Here's a list of all control commands and a description, what they do:
<tag><tt>dollar_in_identifiers</tt><label id="dollar_in_identifiers"></tag> <tag><tt>dollar_in_identifiers</tt><label id="dollar_in_identifiers"></tag>
Accept the dollar sign (`&dollar;') as a valid character in identifiers. The Accept the dollar sign ('&dollar;') as a valid character in identifiers. The
dollar character is not allowed to start an identifier, even with this dollar character is not allowed to start an identifier, even with this
feature enabled. feature enabled.
<tag><tt>dollar_is_pc</tt><label id="dollar_is_pc"></tag> <tag><tt>dollar_is_pc</tt><label id="dollar_is_pc"></tag>
The dollar sign may be used as an alias for the star (`*'), which The dollar sign may be used as an alias for the star ('*'), which
gives the value of the current PC in expressions. gives the value of the current PC in expressions.
Note: Assignment to the pseudo variable is not allowed. Note: Assignment to the pseudo variable is not allowed.
@@ -2789,7 +2789,7 @@ Here's a list of all control commands and a description, what they do:
<tag><tt>leading_dot_in_identifiers</tt><label id="leading_dot_in_identifiers"></tag> <tag><tt>leading_dot_in_identifiers</tt><label id="leading_dot_in_identifiers"></tag>
Accept the dot (`.') as the first character of an identifier. This may be Accept the dot ('.') as the first character of an identifier. This may be
used for example to create macro names that start with a dot emulating used for example to create macro names that start with a dot emulating
control directives of other assemblers. Note however, that none of the control directives of other assemblers. Note however, that none of the
reserved keywords built into the assembler, that starts with a dot, may be reserved keywords built into the assembler, that starts with a dot, may be
@@ -2825,12 +2825,30 @@ Here's a list of all control commands and a description, what they do:
<tag><tt>pc_assignment</tt><label id="pc_assignment"></tag> <tag><tt>pc_assignment</tt><label id="pc_assignment"></tag>
Allow assignments to the PC symbol (`*' or `&dollar;' if <tt/dollar_is_pc/ Allow assignments to the PC symbol ('*' or '&dollar;' if <tt/dollar_is_pc/
is enabled). Such an assignment is handled identical to the <tt><ref is enabled). Such an assignment is handled identical to the <tt><ref
id=".ORG" name=".ORG"></tt> command (which is usually not needed, so just id=".ORG" name=".ORG"></tt> command (which is usually not needed, so just
removing the lines with the assignments may also be an option when porting removing the lines with the assignments may also be an option when porting
code written for older assemblers). code written for older assemblers).
<tag><tt>string_escapes</tt><label id="string_escapes"></tag>
Allow C-style backslash escapes within string constants to embed
special characters. The following escapes are accepted:
<itemize>
<item><tt>\\</tt> backslash (<tt>$5C</tt>)
<item><tt>\'</tt> single quote (<tt>$27</tt>)
<item><tt>\&quot;</tt> double quote (<tt>$22</tt>)
<item><tt>\t</tt> tab (<tt>$09</tt>)
<item><tt>\r</tt> carriage return (<tt>$0D</tt>)
<item><tt>\n</tt> newline (<tt>$0A</tt>)
<item><tt>\xNN</tt> (<tt>$NN</tt>)
</itemize>
Note that <tt>\n</tt> maps to ASCII <tt>$0A</tt>, not a platform specific
line ending character.
<tag><tt>ubiquitous_idents</tt><label id="ubiquitous_idents"></tag> <tag><tt>ubiquitous_idents</tt><label id="ubiquitous_idents"></tag>
Allow the use of instructions names as names for macros and symbols. This Allow the use of instructions names as names for macros and symbols. This
@@ -3799,7 +3817,7 @@ Here's a list of all control commands and a description, what they do:
page and direct (short) addressing is possible for data in this segment. page and direct (short) addressing is possible for data in this segment.
Beware: Only labels in a segment with the zeropage attribute are marked Beware: Only labels in a segment with the zeropage attribute are marked
as reachable by short addressing. The `*' (PC counter) operator will as reachable by short addressing. The '*' (PC counter) operator will
work as in other segments and will create absolute variable values. work as in other segments and will create absolute variable values.
Please note that a segment cannot have two different address sizes. A Please note that a segment cannot have two different address sizes. A

View File

@@ -242,6 +242,13 @@ The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/cbm51
<sect>Limitations<label id="limitations"><p> <sect>Limitations<label id="limitations"><p>
<sect1>Realtime clock<p>
The realtime clock functions use the CIA1 TOD clock. As that clock only stores
the time but not the date, the date set by <tt/clock_settime()/ is simply stored
inside the C library for retrieval in the same program via <tt/clock_gettime()/.
<sect1>Kernal and hardware access<p> <sect1>Kernal and hardware access<p>
Since the program runs in bank 0, and the kernal and all I/O chips are located Since the program runs in bank 0, and the kernal and all I/O chips are located

View File

@@ -224,6 +224,13 @@ No mouse drivers are currently available for the Commodore 610.
<sect>Limitations<label id="limitations"><p> <sect>Limitations<label id="limitations"><p>
<sect1>Realtime clock<p>
The realtime clock functions use the CIA1 TOD clock. As that clock only stores
the time but not the date, the date set by <tt/clock_settime()/ is simply stored
inside the C library for retrieval in the same program via <tt/clock_gettime()/.
<sect1>Kernal and hardware access<p> <sect1>Kernal and hardware access<p>
Since the program runs in bank 1, and the kernal and all I/O chips are located Since the program runs in bank 1, and the kernal and all I/O chips are located

View File

@@ -44,7 +44,7 @@ Short options:
-o name Name the output file -o name Name the output file
-r Enable register variables -r Enable register variables
-t sys Set the target system -t sys Set the target system
-u sym Force an import of symbol `sym' -u sym Force an import of symbol 'sym'
-v Verbose mode -v Verbose mode
-vm Verbose map file -vm Verbose map file
-C name Use linker config file -C name Use linker config file
@@ -90,7 +90,7 @@ Long options:
--debug Debug mode --debug Debug mode
--debug-info Add debug info --debug-info Add debug info
--feature name Set an emulation feature --feature name Set an emulation feature
--force-import sym Force an import of symbol `sym' --force-import sym Force an import of symbol 'sym'
--help Help (this text) --help Help (this text)
--include-dir dir Set a compiler include directory path --include-dir dir Set a compiler include directory path
--ld-args options Pass options to the linker --ld-args options Pass options to the linker

View File

@@ -2587,7 +2587,7 @@ changing values. (See the description of <tt/cbm_k_udtim()/.)
of the realtime clock. <tt/clock_id/ has to be <tt/CLOCK_REALTIME/. If <tt/res/ of the realtime clock. <tt/clock_id/ has to be <tt/CLOCK_REALTIME/. If <tt/res/
is not <tt/NULL/, the resolution of the realtime clock is stored in the location is not <tt/NULL/, the resolution of the realtime clock is stored in the location
pointed to by <tt/res/. If <tt/res/ is <tt/NULL/, the clock resolution is not returned. pointed to by <tt/res/. If <tt/res/ is <tt/NULL/, the clock resolution is not returned.
If the <tt/time/ argument of <tt/<ref id="clock_settime" name="clock_settime">/ is not If the <tt/tp/ argument of <tt/<ref id="clock_settime" name="clock_settime">/ is not
a multiple of <tt/res/, then the value is truncated to a multiple of <tt/res/. On a multiple of <tt/res/, then the value is truncated to a multiple of <tt/res/. On
success, zero is returned. On error, -1 is returned and <tt/errno/ is set to an success, zero is returned. On error, -1 is returned and <tt/errno/ is set to an
error code describing the reason for the failure. error code describing the reason for the failure.
@@ -2626,7 +2626,7 @@ retrieved value may not be valid. See also the platform-specific information.
<tag/Availability/POSIX 1003.1 <tag/Availability/POSIX 1003.1
<tag/See also/ <tag/See also/
<ref id="clock_getres" name="clock_getres">, <ref id="clock_getres" name="clock_getres">,
<ref id="clock_settime" name="clock_settime"> <ref id="clock_settime" name="clock_settime">,
<ref id="time" name="time"> <ref id="time" name="time">
<tag/Example/None. <tag/Example/None.
</descrip> </descrip>
@@ -2637,7 +2637,7 @@ retrieved value may not be valid. See also the platform-specific information.
<quote> <quote>
<descrip> <descrip>
<tag/Function/Get the time from the realtime clock. <tag/Function/Set the time on the realtime clock.
<tag/Header/<tt/<ref id="time.h" name="time.h">/ <tag/Header/<tt/<ref id="time.h" name="time.h">/
<tag/Declaration/<tt/int __fastcall__ clock_settime (clockid_t clock_id, const struct timespec *tp);/ <tag/Declaration/<tt/int __fastcall__ clock_settime (clockid_t clock_id, const struct timespec *tp);/
<tag/Description/The <tt/clock_settime/ function sets the time since the 1970-01-01 00:00:00 <tag/Description/The <tt/clock_settime/ function sets the time since the 1970-01-01 00:00:00
@@ -3386,7 +3386,7 @@ used in presence of a prototype.
<descrip> <descrip>
<tag/Function/Load and initialize an extended memory driver. <tag/Function/Load and initialize an extended memory driver.
<tag/Header/<tt/<ref id="em.h" name="em.h">/ <tag/Header/<tt/<ref id="em.h" name="em.h">/
<tag/Declaration/<tt/void __fastcall__ em_load_driver (const char* name);/ <tag/Declaration/<tt/unsigned char __fastcall__ em_load_driver (const char* name);/
<tag/Description/Load an extended memory driver into memory and initialize <tag/Description/Load an extended memory driver into memory and initialize
it. The function returns an error code that tells if all this has been it. The function returns an error code that tells if all this has been
successful. successful.

View File

@@ -49,16 +49,6 @@ Programs containing Gamate specific code may use the <tt/gamate.h/ header file.
</itemize> </itemize>
<sect1>Hardware access<p>
The following pseudo variables declared in the <tt/gamate.inc/ include file do
allow access to hardware located in the address space.
<descrip>
</descrip><p>
<sect>Loadable drivers<p> <sect>Loadable drivers<p>
@@ -159,6 +149,3 @@ freely, subject to the following restrictions:
</enum> </enum>
</article> </article>

View File

@@ -48,7 +48,7 @@ changed between <tt/tgi_init/ and <tt/tgi_done/.
It is safe to use these standard includes and their contents: It is safe to use these standard includes and their contents:
<tt/assert.h, conio.h, dio.h, errno.h, em.h, geos.h, joystick.h, modload.h, mouse.h, stdlib.h, string.h, tgi.h, time.h/ <tt/assert.h, conio.h, dio.h, errno.h, em.h, geos.h, joystick.h, modload.h, mouse.h, stdlib.h, string.h, tgi.h, time.h/
<p> <p>
For <tt/time.h/ functions <tt/systime()/ and <tt/clock()/ note that the resolution is one second. For <tt/time.h/ functions <tt/clock()/ and <tt/clock_gettime()/ note that the resolution is one second.
<p> <p>
Functions from the headers above are either standard C library functions or cc65-specific, in Functions from the headers above are either standard C library functions or cc65-specific, in
either case they are not GEOS specific and so they are not described here. either case they are not GEOS specific and so they are not described here.
@@ -188,6 +188,14 @@ are covered by new names, but I tried to keep them in the naming convention.
<p> <p>
This section covers the drawing package of GEOS along with text output routines. This section covers the drawing package of GEOS along with text output routines.
<sect2>SetNewMode
<p>
<tt/void SetNewMode (void)/
<p>
This function is intended for use by GEOS 128 only, and will exhibit undefined behavior on the
C64. It will toggle between the 40 column screen mode and the 80 column screen mode. Many C128 GEOS
programs implement a "Switch 40/80" submenu option under the <tt/geos/ menu.
<sect2>SetPattern <sect2>SetPattern
<p> <p>
<tt/void SetPattern (char pattern)/ <tt/void SetPattern (char pattern)/
@@ -1553,7 +1561,7 @@ char text = "foo";
DB_VARSTR (TXT_LN_X, TXT_LN_1_Y, &amp;r15), DB_VARSTR (TXT_LN_X, TXT_LN_1_Y, &amp;r15),
... ...
</verb></tscreen> </verb></tscreen>
will cause the word ``foo'' to appear in the window, but you may store the pointer to any text in will cause the word ''foo'' to appear in the window, but you may store the pointer to any text in
<tt/r15/ (in this case) before the call to DoDlgBox. <tt/r15/ (in this case) before the call to DoDlgBox.
<p> <p>
<tt/DB_GETSTR(x, y, ptr, length)/ - will add a input-from-keyboard feature. <tt/ptr/ works as in the <tt/DB_GETSTR(x, y, ptr, length)/ - will add a input-from-keyboard feature. <tt/ptr/ works as in the

View File

@@ -66,7 +66,7 @@ Short options:
-m name Create a map file -m name Create a map file
-o name Name the default output file -o name Name the default output file
-t sys Set the target system -t sys Set the target system
-u sym Force an import of symbol `sym' -u sym Force an import of symbol 'sym'
-v Verbose mode -v Verbose mode
-vm Verbose map file -vm Verbose map file
@@ -76,7 +76,7 @@ Long options:
--dbgfile name Generate debug information --dbgfile name Generate debug information
--define sym=val Define a symbol --define sym=val Define a symbol
--end-group End a library group --end-group End a library group
--force-import sym Force an import of symbol `sym' --force-import sym Force an import of symbol 'sym'
--help Help (this text) --help Help (this text)
--lib file Link this library --lib file Link this library
--lib-path path Specify a library search path --lib-path path Specify a library search path
@@ -487,7 +487,7 @@ There are of course more attributes for a memory section than just start and
size. Start and size are mandatory attributes, that means, each memory area size. Start and size are mandatory attributes, that means, each memory area
defined <em/must/ have these attributes given (the linker will check that). I defined <em/must/ have these attributes given (the linker will check that). I
will cover other attributes later. As you may have noticed, I've used a will cover other attributes later. As you may have noticed, I've used a
comment in the example above. Comments start with a hash mark (`#'), the comment in the example above. Comments start with a hash mark ('#'), the
remainder of the line is ignored if this character is found. remainder of the line is ignored if this character is found.
@@ -572,7 +572,7 @@ default behaviour is OK for our purposes, I did not use the attribute in the
example above. Let's have a look at it now. example above. Let's have a look at it now.
The "file" attribute (the keyword may also be written as "FILE" if you like The "file" attribute (the keyword may also be written as "FILE" if you like
that better) takes a string enclosed in double quotes (`&dquot;') that specifies the that better) takes a string enclosed in double quotes ('&dquot;') that specifies the
file, where the data is written. You may specify the same file several times, file, where the data is written. You may specify the same file several times,
in that case the data for all memory areas having this file name is written in that case the data for all memory areas having this file name is written
into this file, in the order of the memory areas defined in the <tt/MEMORY/ into this file, in the order of the memory areas defined in the <tt/MEMORY/

View File

@@ -89,7 +89,7 @@ Example output for the command
sim65 --verbose --verbose samples/gunzip65 sim65 --verbose --verbose samples/gunzip65
</verb></tscreen> </verb></tscreen>
<tscreen><verb> <tscreen><verb>
Loaded `samples/gunzip65' at $0200-$151F Loaded 'samples/gunzip65' at $0200-$151F
PVWrite ($0001, $13C9, $000F) PVWrite ($0001, $13C9, $000F)
GZIP file name:PVWrite ($0001, $151F, $0001) GZIP file name:PVWrite ($0001, $151F, $0001)

View File

@@ -192,6 +192,7 @@ port cardridge.
<sect1>Joystick drivers<p> <sect1>Joystick drivers<p>
<descrip> <descrip>
Telemon 2.4 & 3.0 manages joysticks but it had been handled yet. This means that Telemon 2.4 & 3.0 manages joysticks but it had been handled yet. This means that
@@ -200,26 +201,24 @@ joysticks driver could be written easily.
Telemon 2.4 returns in keyboard buffer the direction of the joysticks. This means that Telemon 2.4 returns in keyboard buffer the direction of the joysticks. This means that
if you get input from keyboard by conio cgetc function, you will get direction from joysticks. if you get input from keyboard by conio cgetc function, you will get direction from joysticks.
</descrip>
<sect1>Mouse drivers<p> <sect1>Mouse drivers<p>
<descrip> <descrip>
Telestrat manages also mouse, but it had been no handled yet in this version. Telestrat manages also mouse, but it had been no handled yet in this version.
Telestrat mouse is really difficult to find. Telestrat mouse is really difficult to find.
</descrip>
<sect1>RS232 device drivers<p> <sect1>RS232 device drivers<p>
<descrip> <descrip>
Telestrat has a RS232 port, but it's not usable in cc65. It is possible to use Telestrat has a RS232 port, but it's not usable in cc65. It is possible to use
RS232 port with Telemon calls (see XSOUT primitive for example) RS232 port with Telemon calls (see XSOUT primitive for example)
</descrip>
<sect>Limitations<label id="limitations"><p> <sect>Limitations<label id="limitations"><p>

View File

@@ -55,6 +55,7 @@ typedef unsigned size_t;
#define CPU_65CE02 5 #define CPU_65CE02 5
#define CPU_HUC6280 6 #define CPU_HUC6280 6
#define CPU_2A0x 7 #define CPU_2A0x 7
#define CPU_45GS02 8
unsigned char getcpu (void); unsigned char getcpu (void);
/* Detect the CPU the program is running on */ /* Detect the CPU the program is running on */

View File

@@ -5,9 +5,20 @@
/* Internal include file, do not use directly */ /* Internal include file, do not use directly */
/* */ /* */
/* */ /* */
/* "ANTIC, Alphanumeric Television Interface Controller, is responsible for */
/* the generation of playfield graphics which is delivered as a datastream */
/* to the related CTIA/GTIA chip. The CTIA/GTIA provides the coloring of the */
/* playfield graphics, and is responsible for adding overlaid sprite */
/* (referred to as "Player/Missile graphics" by Atari). Atari advertised it */
/* as a true microprocessor, in that it has an instruction set to run */
/* programs (called display lists) to process data. ANTIC has no capacity */
/* for writing back computed values to memory, it merely reads data from */
/* memory and processes it for output to the screen, therefore it is not */
/* Turing complete." - Wikipedia article on "ANTIC" (with edits) */
/* */ /* */
/* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com> */ /* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com> */
/* 24-Jan-2011: Christian Krueger: Added defines for Antic instruction set */ /* 24-Jan-2011: Christian Krueger: Added defines for Antic instruction set */
/* 2019-01-16: Bill Kendrick <nbs@sonic.net>: More defines for registers */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
@@ -33,66 +44,211 @@
#ifndef __ANTIC_H #ifndef __ANTIC_H
#define __ANTIC_H #define __ANTIC_H
/* Define a structure with the antic register offsets */ /*****************************************************************************/
/* Define a structure with the ANTIC coprocessor's register offsets */
/*****************************************************************************/
struct __antic { struct __antic {
unsigned char dmactl; /* direct memory access control */ unsigned char dmactl; /* (W) direct memory access control */
unsigned char chactl; /* character mode control */ unsigned char chactl; /* (W) character mode control */
unsigned char dlistl; /* display list pointer low-byte */ unsigned char dlistl; /* display list pointer low-byte */
unsigned char dlisth; /* display list pointer high-byte */ unsigned char dlisth; /* display list pointer high-byte */
unsigned char hscrol; /* horizontal scroll enable */ unsigned char hscrol; /* (W) horizontal scroll enable */
unsigned char vscrol; /* vertical scroll enable */ unsigned char vscrol; /* (W) vertical scroll enable */
unsigned char unuse0; /* unused */ unsigned char unuse0; /* unused */
unsigned char pmbase; /* msb of p/m base address */ unsigned char pmbase; /* (W) msb of p/m base address (for when DMACTL has player and/or missile DMA enabled) */
unsigned char unuse1; /* unused */ unsigned char unuse1; /* unused */
unsigned char chbase; /* character base address */ unsigned char chbase; /* (W) msb of character set base address */
unsigned char wsync; /* wait for horizontal synchronization */ unsigned char wsync; /* (W) wait for horizontal synchronization */
unsigned char vcount; /* vertical line counter */ unsigned char vcount; /* (R) vertical line counter */
unsigned char penh; /* light pen horizontal position */ unsigned char penh; /* (R) light pen horizontal position */
unsigned char penv; /* light pen vertical position */ unsigned char penv; /* (R) light pen vertical position */
unsigned char nmien; /* non-maskable interrupt enable */ unsigned char nmien; /* (W) non-maskable interrupt enable */
unsigned char nmires; /* nmi reset/status */ union {
/* (W) ("NMIRES") nmi reset -- clears the interrupt request register;
** resets all of the NMI status together
*/
unsigned char nmires;
/* (R) ("NMIST") nmi status -- holds cause for the NMI interrupt */
unsigned char nmist;
};
}; };
/* antic instruction set */ /*****************************************************************************/
/* DMACTL register options */
/*****************************************************************************/
/* absolute instructions (non mode lines) */ /* Initialized to 0x22: DMA fetch, normal playfield, no PMG DMA, double-line PMGs */
#define DL_JMP (unsigned char) 1
#define DL_JVB (unsigned char) 65
#define DL_BLK1 (unsigned char) 0 /* Playfield modes: */
#define DL_BLK2 (unsigned char) 16 #define DMACTL_PLAYFIELD_NONE 0x00
#define DL_BLK3 (unsigned char) 32 #define DMACTL_PLAYFIELD_NARROW 0x01 /* e.g., 32 bytes per scanline with thick borders */
#define DL_BLK4 (unsigned char) 48 #define DMACTL_PLAYFIELD_NORMAL 0x02 /* e.g., 40 bytes per scanline with normal borders */
#define DL_BLK5 (unsigned char) 64 #define DMACTL_PLAYFIELD_WIDE 0x03 /* e.g., 48 bytes per scanline with no borders (overscan) */
#define DL_BLK6 (unsigned char) 80
#define DL_BLK7 (unsigned char) 96
#define DL_BLK8 (unsigned char) 112
/* absolute instructions (mode lines) */ /* Other options: */
#define DL_CHR40x8x1 (unsigned char) 2 /* monochrome, 40 character & 8 scanlines per mode line (GR. 0) */
#define DL_CHR40x10x1 (unsigned char) 3 /* monochrome, 40 character & 10 scanlines per mode line */
#define DL_CHR40x8x4 (unsigned char) 4 /* colour, 40 character & 8 scanlines per mode line (GR. 12) */
#define DL_CHR40x16x4 (unsigned char) 5 /* colour, 40 character & 16 scanlines per mode line (GR. 13) */
#define DL_CHR20x8x2 (unsigned char) 6 /* colour (duochrome per character), 20 character & 8 scanlines per mode line (GR. 1) */
#define DL_CHR20x16x2 (unsigned char) 7 /* colour (duochrome per character), 20 character & 16 scanlines per mode line (GR. 2) */
#define DL_MAP40x8x4 (unsigned char) 8 /* colour, 40 pixel & 8 scanlines per mode line (GR. 3) */ /* If not set, GTIA's GRAFP0 thru GRAFP3, and/or GRAFM registers are used for
#define DL_MAP80x4x2 (unsigned char) 9 /* 'duochrome', 80 pixel & 4 scanlines per mode line (GR.4) */ ** player & missile shapes, respectively. (Modify the registers during the horizontal blank
#define DL_MAP80x4x4 (unsigned char) 10 /* colour, 80 pixel & 4 scanlines per mode line (GR.5) */ ** (Display List Interrupt), a la "racing the beam" on an Atari VCS/2600, )
#define DL_MAP160x2x2 (unsigned char) 11 /* 'duochrome', 160 pixel & 2 scanlines per mode line (GR.6) */ ** if set, ANTIC's PMBASE will be used to fetch shapes from memory via DMA.
#define DL_MAP160x1x2 (unsigned char) 12 /* 'duochrome', 160 pixel & 1 scanline per mode line (GR.14) */ */
#define DL_MAP160x2x4 (unsigned char) 13 /* 4 colours, 160 pixel & 2 scanlines per mode line (GR.7) */ #define DMACTL_DMA_MISSILES 0x04
#define DL_MAP160x1x4 (unsigned char) 14 /* 4 colours, 160 pixel & 1 scanline per mode line (GR.15) */ #define DMACTL_DMA_PLAYERS 0x08
#define DL_MAP320x1x1 (unsigned char) 15 /* monochrome, 320 pixel & 1 scanline per mode line (GR.8) */
/* modifiers on mode lines */ /* Unless set, PMGs (as fetched via DMA) will be double-scanline resolution */
#define DL_HSCROL(x) (unsigned char)((x) | 16) #define DMACTL_PMG_SINGLELINE 0x10
#define DL_VSCROL(x) (unsigned char)((x) | 32)
#define DL_LMS(x) (unsigned char)((x) | 64) /* Unless set, ANTIC operation is disabled, since it cannot fetch
** Display List instructions
*/
#define DMACTL_DMA_FETCH 0x20
/*****************************************************************************/
/* CHACTL register options */
/*****************************************************************************/
/* Initialized to 2 (CHACTL_CHAR_NORMAL | CHACTL_INV_PRESENT) */
/* Inverted (upside-down) characters */
#define CHACTL_CHAR_NORMAL 0x00
#define CHACTL_CHAR_INVERTED 0x04
/* Inverse (reverse-video) characters */
#define CHACTL_INV_TRANS 0x00 /* chars with high-bit shown */
#define CHACTL_INV_OPAQUE 0x01 /* chars with high-bit appear as space */
#define CHACTL_INV_PRESENT 0x02 /* chars with high-bit are reverse-video */
/*****************************************************************************/
/* Values for NMIEN (enabling interrupts) & NMIST (cause for the interrupt) */
/*****************************************************************************/
/* Display List Interrupts
** Called on a modeline when "DL_DLI" bit is set the ANTIC instruction,
** and jumps through VDSLST vector.
*/
#define NMIEN_DLI 0x80
/* Vertical Blank Interrupt
** Called during every vertical blank; see SYSVBV, VVBLKI, CRITIC, and VVBLKD,
** as well as the SETVBV routine.
*/
#define NMIEN_VBI 0x40
/* [Reset] key pressed */
#define NMIEN_RESET 0x20
/*****************************************************************************/
/* ANTIC instruction set */
/*****************************************************************************/
/* Absolute instructions (non mode lines) */
#define DL_JMP ((unsigned char) 1)
#define DL_JVB ((unsigned char) 65)
#define DL_BLK1 ((unsigned char) 0) /* 1 blank scanline */
#define DL_BLK2 ((unsigned char) 16) /* 2 blank scanlines */
#define DL_BLK3 ((unsigned char) 32) /* ...etc. */
#define DL_BLK4 ((unsigned char) 48)
#define DL_BLK5 ((unsigned char) 64)
#define DL_BLK6 ((unsigned char) 80)
#define DL_BLK7 ((unsigned char) 96)
#define DL_BLK8 ((unsigned char) 112)
/* Absolute instructions (mode lines) */
/* Note: Actual width varies (e.g., 40 vs 32 vs 48) depending on
** normal vs narrow vs wide (overscan) playfield setting; see DMACTL
*/
/* Character modes (text, tile graphics, etc.) */
/* monochrome, 40 character & 8 scanlines per mode line (aka Atari BASIC GRAPHICS 0 via OS's CIO routines) */
#define DL_CHR40x8x1 ((unsigned char) 2)
/* monochrome, 40 character & 10 scanlines per mode line (like GR. 0, with descenders) */
#define DL_CHR40x10x1 ((unsigned char) 3)
/* colour, 40 character & 8 scanlines per mode line (GR. 12) */
#define DL_CHR40x8x4 ((unsigned char) 4)
/* colour, 40 character & 16 scanlines per mode line (GR. 13) */
#define DL_CHR40x16x4 ((unsigned char) 5)
/* colour (duochrome per character), 20 character & 8 scanlines per mode line (GR. 1) */
#define DL_CHR20x8x2 ((unsigned char) 6)
/* colour (duochrome per character), 20 character & 16 scanlines per mode line (GR. 2) */
#define DL_CHR20x16x2 ((unsigned char) 7)
/* Bitmap modes */
/* colour, 40 pixel & 8 scanlines per mode line (GR. 3) */
#define DL_MAP40x8x4 ((unsigned char) 8)
/* 'duochrome', 80 pixel & 4 scanlines per mode line (GR.4) */
#define DL_MAP80x4x2 ((unsigned char) 9)
/* colour, 80 pixel & 4 scanlines per mode line (GR.5) */
#define DL_MAP80x4x4 ((unsigned char) 10)
/* 'duochrome', 160 pixel & 2 scanlines per mode line (GR.6) */
#define DL_MAP160x2x2 ((unsigned char) 11)
/* 'duochrome', 160 pixel & 1 scanline per mode line (GR.14) */
#define DL_MAP160x1x2 ((unsigned char) 12)
/* 4 colours, 160 pixel & 2 scanlines per mode line (GR.7) */
#define DL_MAP160x2x4 ((unsigned char) 13)
/* 4 colours, 160 pixel & 1 scanline per mode line (GR.15) */
#define DL_MAP160x1x4 ((unsigned char) 14)
/* monochrome, 320 pixel & 1 scanline per mode line (GR.8) */
#define DL_MAP320x1x1 ((unsigned char) 15)
/* Equivalents, for people familiar with Atari 8-bit OS */
#define DL_GRAPHICS0 DL_CHR40x8x1
#define DL_GRAPHICS1 DL_CHR20x8x2
#define DL_GRAPHICS2 DL_CHR20x16x2
#define DL_GRAPHICS3 DL_MAP40x8x4
#define DL_GRAPHICS4 DL_MAP80x4x2
#define DL_GRAPHICS5 DL_MAP80x4x4
#define DL_GRAPHICS6 DL_MAP160x2x2
#define DL_GRAPHICS7 DL_MAP160x2x4
#define DL_GRAPHICS8 DL_MAP320x1x1
#define DL_GRAPHICS9 DL_MAP320x1x1 /* N.B.: GRAPHICS 9, 10, and 11 also involve GTIA's PRIOR register */
#define DL_GRAPHICS10 DL_MAP320x1x1
#define DL_GRAPHICS11 DL_MAP320x1x1
#define DL_GRAPHICS12 DL_CHR40x8x4 /* N.B.: Atari 400/800 OS didn't have GRAPHICS 12 or 13 */
#define DL_GRAPHICS13 DL_CHR40x16x4
#define DL_GRAPHICS14 DL_MAP160x1x2
#define DL_GRAPHICS15 DL_MAP160x1x4
/* Atari 400/800 OS didn't have GRAPHICS 14 or 15, so they were known by "6+" and "7+" */
#define DL_GRAPHICS6PLUS DL_GRAPHICS14
#define DL_GRAPHICS7PLUS DL_GRAPHICS15
/* Neither Atari 400/800 nor XL OS supported 10-scanline (descenders) text mode via CIO */
#define DL_GRAPHICS0_DESCENDERS DL_CHR40x10x1
/* Modifiers to mode lines */
#define DL_HSCROL(x) ((unsigned char)((x) | 16)) /* enable smooth horizontal scrolling on this line; see HSCROL */
#define DL_VSCROL(x) ((unsigned char)((x) | 32)) /* enable smooth vertical scrolling on this line; see VSCROL */
#define DL_LMS(x) ((unsigned char)((x) | 64)) /* Load Memory Scan (next two bytes must be the LSB/MSB of the data to load) */
/* General modifier */
#define DL_DLI(x) ((unsigned char)((x) | 128)) /* enable Display List Interrupt on this mode line */
/* general modifier */
#define DL_DLI(x) (unsigned char)((x) | 128)
/* End of _antic.h */ /* End of _antic.h */
#endif /* #ifndef __ANTIC_H */ #endif /* #ifndef __ANTIC_H */

View File

@@ -4,9 +4,16 @@
/* */ /* */
/* Internal include file, do not use directly */ /* Internal include file, do not use directly */
/* */ /* */
/* "GTIA, Graphic Television Interface Adaptor, is a custom chip used in the */
/* Atari 8-bit family of computers and in the Atari 5200 console. In these */
/* systems, GTIA chip works together with ANTIC to produce video display. */
/* ANTIC generates the playfield graphics (text and bitmap) while GTIA */
/* provides the color for the playfield and adds overlay objects known as */
/* player/missile graphics (sprites)" - Wikipedia article on "GTIA" */
/* */ /* */
/* */ /* */
/* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com> */ /* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com> */
/* 2019-01-16: Bill Kendrick <nbs@sonic.net>: More defines for registers */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
@@ -32,26 +39,32 @@
#ifndef __GTIA_H #ifndef __GTIA_H
#define __GTIA_H #define __GTIA_H
/* Define a structure with the gtia register offsets */ /*****************************************************************************/
/* Define a structure with the GTIA register offsets for write (W) */
/*****************************************************************************/
struct __gtia_write { struct __gtia_write {
unsigned char hposp0; /* 0x00: horizontal position player 0 */ unsigned char hposp0; /* 0x00: horizontal position of player 0 */
unsigned char hposp1; /* 0x01: horizontal position player 1 */ unsigned char hposp1; /* 0x01: horizontal position of player 1 */
unsigned char hposp2; /* 0x02: horizontal position player 2 */ unsigned char hposp2; /* 0x02: horizontal position of player 2 */
unsigned char hposp3; /* 0x03: horizontal position player 3 */ unsigned char hposp3; /* 0x03: horizontal position of player 3 */
unsigned char hposm0; /* 0x04: horizontal position missile 0 */ unsigned char hposm0; /* 0x04: horizontal position of missile 0 */
unsigned char hposm1; /* 0x05: horizontal position missile 1 */ unsigned char hposm1; /* 0x05: horizontal position of missile 1 */
unsigned char hposm2; /* 0x06: horizontal position missile 2 */ unsigned char hposm2; /* 0x06: horizontal position of missile 2 */
unsigned char hposm3; /* 0x07: horizontal position missile 3 */ unsigned char hposm3; /* 0x07: horizontal position of missile 3 */
unsigned char sizep0; /* 0x08: size of player 0 */ unsigned char sizep0; /* 0x08: size of player 0 */
unsigned char sizep1; /* 0x09: size of player 1 */ unsigned char sizep1; /* 0x09: size of player 1 */
unsigned char sizep2; /* 0x0A: size of player 2 */ unsigned char sizep2; /* 0x0A: size of player 2 */
unsigned char sizep3; /* 0x0B: size of player 3 */ unsigned char sizep3; /* 0x0B: size of player 3 */
unsigned char sizem; /* 0x0C: size of missiles */ unsigned char sizem; /* 0x0C: size of missiles */
unsigned char grafp0; /* 0x0D: graphics shape player 0 */
unsigned char grafp0; /* 0x0D: graphics shape player 0 (used when ANTIC is not instructed to use DMA; see DMACTL) */
unsigned char grafp1; /* 0x0E: graphics shape player 1 */ unsigned char grafp1; /* 0x0E: graphics shape player 1 */
unsigned char grafp2; /* 0x0F: graphics shape player 2 */ unsigned char grafp2; /* 0x0F: graphics shape player 2 */
unsigned char grafp3; /* 0x10: graphics shape player 3 */ unsigned char grafp3; /* 0x10: graphics shape player 3 */
unsigned char grafm; /* 0x11: graphics shape missiles */ unsigned char grafm; /* 0x11: graphics shape missiles */
unsigned char colpm0; /* 0x12: color player and missile 0 */ unsigned char colpm0; /* 0x12: color player and missile 0 */
unsigned char colpm1; /* 0x13: color player and missile 1 */ unsigned char colpm1; /* 0x13: color player and missile 1 */
unsigned char colpm2; /* 0x14: color player and missile 2 */ unsigned char colpm2; /* 0x14: color player and missile 2 */
@@ -61,14 +74,177 @@ struct __gtia_write {
unsigned char colpf2; /* 0x18: color playfield 2 */ unsigned char colpf2; /* 0x18: color playfield 2 */
unsigned char colpf3; /* 0x19: color playfield 3 */ unsigned char colpf3; /* 0x19: color playfield 3 */
unsigned char colbk; /* 0x1A: color background */ unsigned char colbk; /* 0x1A: color background */
unsigned char prior; /* 0x1B: priority selection */ unsigned char prior; /* 0x1B: priority selection */
unsigned char vdelay; /* 0x1C: vertical delay */
unsigned char vdelay;
/* 0x1C: vertical delay -- one-line resolution movement of
** vertical position of an object when two line resolution display is enabled
*/
unsigned char gractl; /* 0x1D: stick/paddle latch, p/m control */ unsigned char gractl; /* 0x1D: stick/paddle latch, p/m control */
unsigned char hitclr; /* 0x1E: clear p/m collision */ unsigned char hitclr; /* 0x1E: clear p/m collision */
unsigned char consol; /* 0x1F: builtin speaker */ unsigned char consol; /* 0x1F: builtin speaker */
}; };
/* Define a structure with the gtia register offsets */
/*****************************************************************************/
/* (W) Values for SIZEP0-SIZEP3 and SIZEM registers: */
/*****************************************************************************/
#define PMG_SIZE_NORMAL 0x0 /* one color clock per pixel */
#define PMG_SIZE_DOUBLE 0x1 /* two color clocks per pixel */
#define PMG_SIZE_QUAD 0x2 /* four color clocks per pixel */
/* COLPM0-COLPM3, COLPF0-COLPF3, COLBK color registers */
/*****************************************************************************/
/* Color definitions */
/*****************************************************************************/
/* Make a GTIA color value */
#define _gtia_mkcolor(hue,lum) (((hue) << 4) | ((lum) << 1))
/* Luminance values go from 0 (black) to 7 (white) */
/* Hue values */
/* (These can vary depending on TV standard (NTSC vs PAL),
** tint potentiometer settings, TV tint settings, emulator palette, etc.)
*/
#define HUE_GREY 0
#define HUE_GOLD 1
#define HUE_GOLDORANGE 2
#define HUE_REDORANGE 3
#define HUE_ORANGE 4
#define HUE_MAGENTA 5
#define HUE_PURPLE 6
#define HUE_BLUE 7
#define HUE_BLUE2 8
#define HUE_CYAN 9
#define HUE_BLUEGREEN 10
#define HUE_BLUEGREEN2 11
#define HUE_GREEN 12
#define HUE_YELLOWGREEN 13
#define HUE_YELLOW 14
#define HUE_YELLOWRED 15
/* 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)
/* 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_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
/*****************************************************************************/
/* (W) PRIOR register values */
/*****************************************************************************/
#define PRIOR_P03_PF03 0x01 /* Players 0-3, then Playfields 0-3, then background */
#define PRIOR_P01_PF03_P23 0x02 /* Players 0-1, then Playfields 0-3, then Players 2-3, then background */
#define PRIOR_PF03_P03 0x04 /* Playfields 0-3, then Players 0-3, then background */
#define PRIOR_PF01_P03_PF23 0x08 /* Playfields 0-1, then Players 0-3, then Playfields 2-3, then background */
#define PRIOR_5TH_PLAYER 0x10 /* Four missiles combine to be a 5th player (uses COLPF3) */
/* Causes overlap of players 0 & 1 and of players 2 & 3 to result in a third color,
** the logical OR of the two players' colors, and other overlaps (e.g., players 0 and 2)
** to result in black (0x00).
*/
#define PRIOR_OVERLAP_3RD_COLOR 0x20
/*****************************************************************************/
/* (W) GTIA special graphics mode options for GPRIOR */
/*****************************************************************************/
/* Pixels are 2 color clocks wide, and one scanline tall
** (so 80x192 in normal playfield width).
** May be used with both bitmap and character modelines.
*/
/* 16 shade shades of the background (COLBK) hue;
** Note: brightnesses other than 0 (darkest) in COLBK cause additional effects
*/
#define PRIOR_GFX_MODE_9 0x40
/* 9 color palette mode;
** COLPM0 (acts as background) thru COLPM3, followed by COLPF0 thru COLPF3, and COLBK
*/
#define PRIOR_GFX_MODE_10 0x80
/* 16 hues of the background (COLBK) brightness;
** Note: hues other than 0 (greys) in COLBK caus additional effects
*/
#define PRIOR_GFX_MODE_11 0xC0
/*****************************************************************************/
/* (W) VDELAY register values */
/*****************************************************************************/
#define VDELAY_MISSILE0 0x01
#define VDELAY_MISSILE1 0x02
#define VDELAY_MISSILE2 0x04
#define VDELAY_MISSILE3 0x08
#define VDELAY_PLAYER0 0x10
#define VDELAY_PLAYER1 0x20
#define VDELAY_PLAYER2 0x40
#define VDELAY_PLAYER3 0x80
/*****************************************************************************/
/* (W) GRACTL register values */
/*****************************************************************************/
#define GRACTL_MISSLES 0x01 /* enable missiles */
#define GRACTL_PLAYERS 0x02 /* enable players */
/* "Latch" triggers; once pressed, will give a continuous
** pressed input until this bit is cleared
*/
#define GRACTL_LATCH_TRIGGER_INPUTS 0x04
/*****************************************************************************/
/* Define a structure with the GTIA register offsets for read (R) */
/*****************************************************************************/
struct __gtia_read { struct __gtia_read {
unsigned char m0pf; /* 0x00: missile 0 to playfield collision */ unsigned char m0pf; /* 0x00: missile 0 to playfield collision */
unsigned char m1pf; /* 0x01: missile 1 to playfield collision */ unsigned char m1pf; /* 0x01: missile 1 to playfield collision */
@@ -86,15 +262,41 @@ struct __gtia_read {
unsigned char p1pl; /* 0x0D: player 1 to player collision */ unsigned char p1pl; /* 0x0D: player 1 to player collision */
unsigned char p2pl; /* 0x0E: player 2 to player collision */ unsigned char p2pl; /* 0x0E: player 2 to player collision */
unsigned char p3pl; /* 0x0F: player 3 to player collision */ unsigned char p3pl; /* 0x0F: player 3 to player collision */
unsigned char trig0; /* 0x10: joystick trigger 0 */
unsigned char trig0; /* 0x10: joystick trigger 0 (0=pressed, 1=released) */
unsigned char trig1; /* 0x11: joystick trigger 1 */ unsigned char trig1; /* 0x11: joystick trigger 1 */
unsigned char trig2; /* 0x12: joystick trigger 2 */ unsigned char trig2; /* 0x12: joystick trigger 2 */
unsigned char trig3; /* 0x13: joystick trigger 3 */ unsigned char trig3; /* 0x13: joystick trigger 3 */
unsigned char pal; /* 0x14: pal/ntsc flag */ unsigned char pal; /* 0x14: pal/ntsc flag */
unsigned char unused[10]; unsigned char unused[10];
unsigned char consol; /* 0x1F: console buttons */ unsigned char consol; /* 0x1F: console buttons */
}; };
/*****************************************************************************/
/* (R) PAL register possible values */
/*****************************************************************************/
/* Note: This only tells you whether the GTIA is PAL or NTSC; some NTSC
** systems are modded with PAL ANTIC chips; testing VCOUNT limits can be
** done to check for that. Seems like it's not possible to test for SECAM
*/
#define TV_STD_PAL 0x1
#define TV_STD_NTSC 0xE
/*****************************************************************************/
/* Macros for reading console keys (Start/Select/Option) via CONSOL register */
/*****************************************************************************/
#define CONSOL_START(x) !((unsigned char)((x) & 1)) /* true if Start pressed */
#define CONSOL_SELECT(x) !((unsigned char)((x) & 2)) /* true if Select pressed */
#define CONSOL_OPTION(x) !((unsigned char)((x) & 4)) /* true if Option pressed */
/* End of _gtia.h */ /* End of _gtia.h */
#endif /* #ifndef __GTIA_H */ #endif /* #ifndef __GTIA_H */

View File

@@ -4,9 +4,14 @@
/* */ /* */
/* Internal include file, do not use directly */ /* Internal include file, do not use directly */
/* */ /* */
/* The Peripheral Interface Adapter (PIA) chip (a 6520 or 6820) provides */
/* parallel I/O interfacing; it was used in Atari 400/800 and Commodore PET */
/* family of computers, for joystick and some interrupts. */
/* Sources; various + Wikpedia article on "Peripheral Interface Adapter". */
/* */ /* */
/* */ /* */
/* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com> */ /* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com> */
/* 2019-01-17: Bill Kendrick <nbs@sonic.net>: Defines for registers */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
@@ -34,7 +39,7 @@
#define __PIA_H #define __PIA_H
/* Define a structure with the pia register offsets */ /* Define a structure with the PIA register offsets */
struct __pia { struct __pia {
unsigned char porta; /* port A data r/w */ unsigned char porta; /* port A data r/w */
unsigned char portb; /* port B data r/w */ unsigned char portb; /* port B data r/w */
@@ -43,9 +48,119 @@ struct __pia {
}; };
/*****************************************************************************/
/* PORTA and PORTB register bits */
/*****************************************************************************/
/* See also: "JOY_xxx_MASK" in "atari.h" */
/* Paddle 0-3 triggers (per PORTA bits) */
#define PORTA_PTRIG3 0x80
#define PORTA_PTRIG2 0x40
#define PORTA_PTRIG1 0x08
#define PORTA_PTRIG0 0x04
/* On the Atari 400/800, PORTB is the same as PORTA, but for controller ports 3 & 4. */
/* Paddle 4-7 triggers (per PORTB bits); only 400/800 had four controller ports */
#define PORTB_PTRIG7 0x80
#define PORTB_PTRIG6 0x40
#define PORTB_PTRIG5 0x08
#define PORTB_PTRIG4 0x04
/* On the XL series of computers, PORTB has been changed to a memory and
** LED control (1200XL model only) register (read/write):
*/
/* If set, the built-in OS is enabled, and occupies the address range $C000-$FFFF
** (except that the area $D000-$D7FF will only access the hardware registers.)
** If clear, RAM is enabled in this area (again, save for the hole.)
*/
#define PORTB_OSROM 0x01
/* If set, RAM is enabled for the address range $A000-$BFFF.
** If clear, the built-in BASIC ROM is enabled at this address.
** And if there is a cartridge installed in the computer, it makes no difference.
*/
#define PORTB_BASICROM 0x02
/* If set, the corresponding LED is turned off. If clear, the LED will be on.
** (1200XL only)
*/
#define PORTB_LED1 0x04
#define PORTB_LED2 0x08
/* On the XE series of computers, PORTB is a bank-selected memory control register (read/write): */
/* These bits determine which memory bank is visible to the CPU and/or ANTIC chip
** when their Bank Switch bit is set. There are four possible banks of 16KB each.
*/
#define PORTB_BANKSELECT1 0x00
#define PORTB_BANKSELECT2 0x04
#define PORTB_BANKSELECT3 0x08
#define PORTB_BANKSELECT4 0x0C
/* If set, the CPU and/or ANTIC chip will access bank-switched memory mapped to the
** address range $4000-$7FFF.
** If clear, the CPU and/or ANTIC will see normal memory in this region.
*/
#define PORTB_BANKSWITCH_CPU 0x10
#define PORTB_BANKSWITCH_ANTIC 0x20
/* If set, RAM is enabled for the address range $5000-$57FF.
** If clear, the self-test ROM (physically located at $D000-$D7FF, under the hardware registers)
** is remapped to this memory area.
*/
#define PORTB_SELFTEST 0x80
/*****************************************************************************/
/* PACTL and PBCTL register bits */
/*****************************************************************************/
/* (W) Peripheral PA1/PB1 interrupt (IRQ) ("peripheral proceed line available") enable.
** One equals enable. Set by the OS but available to the user; reset on powerup.
** (PxCTL_IRQ_STATUS (R) bit will get set upon interrupt occurance)
*/
#define PxCTL_IRQ_ENABLE 0x01 /* bit 0 */
/* Note: Bit 1 is always set to */
/* (W) Controls PORTA/PORTB addressing
** 1 = PORTA/PORTB register; read/write to controller port
** 0 = direction control register; write to direction controls
** (allows setting data flow; write 0s & 1s to PORTA/PORTB bits
** to set which port's pins are read (input), or write (output),
** respectively)
*/
#define PxCTL_ADDRESSING 0x04 /* bit 2 */
/* (W) Peripheral motor control line; Turn the cassette on or off
** (PACTL-specific register bit)
** 0 = on
** 1 = off
*/
#define PACTL_MOTOR_CONTROL 0x08 /* bit 3 */
/* Peripheral command identification (serial bus command line)
** (PBCTL-specific register bit)
*/
#define PBCTL_PERIPH_CMD_IDENT 0x08 /* bit 3 */
/* Note: Bits 4 & 5 are always set to 1 */
/* Note: Bit 6 is always set to 0 */
/* (R) Peripheral interrupt (IRQ) status bit.
** Set by Peripherals (PORTA / PORTB). Reset by reading from PORTA / PORTB.
** PACTL's is interrupt status of PROCEED
** PBCTL's is interrupt status of SIO
*/
#define PxCTL_IRQ_STATUS 0x80
/* End of _pia.h */ /* End of _pia.h */
#endif #endif

View File

@@ -4,9 +4,17 @@
/* */ /* */
/* Internal include file, do not use directly */ /* Internal include file, do not use directly */
/* */ /* */
/* POKEY, Pot Keyboard Integrated Circuit, is a digital I/O chip designed */
/* for the Atari 8-bit family of home computers; it combines functions for */
/* sampling (ADC) potentiometers (such as game paddles) and scan matrices of */
/* switches (such as a computer keyboard) as well as sound generation. */
/* It produces four voices of distinctive square wave sound, either as clear */
/* tones or modified with a number of distortion settings. - Wikipedia */
/* "POKEY" article. */
/* */ /* */
/* */ /* */
/* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com> */ /* (C) 2000 Freddy Offenga <taf_offenga@yahoo.com> */
/* 2019-01-16: Bill Kendrick <nbs@sonic.net>: More defines for registers */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
@@ -35,7 +43,10 @@
/* Define a structure with the pokey register offsets */ /*****************************************************************************/
/* Define a structure with the POKEY register offsets for write (W) */
/*****************************************************************************/
struct __pokey_write { struct __pokey_write {
unsigned char audf1; /* audio channel #1 frequency */ unsigned char audf1; /* audio channel #1 frequency */
unsigned char audc1; /* audio channel #1 control */ unsigned char audc1; /* audio channel #1 control */
@@ -47,13 +58,122 @@ struct __pokey_write {
unsigned char audc4; /* audio channel #4 control */ unsigned char audc4; /* audio channel #4 control */
unsigned char audctl; /* audio control */ unsigned char audctl; /* audio control */
unsigned char stimer; /* start pokey timers */ unsigned char stimer; /* start pokey timers */
unsigned char skrest; /* reset serial port status reg. */
unsigned char potgo; /* start paddle scan sequence */ unsigned char skrest;
/* reset serial port status reg.;
** Reset BITs 5 - 7 of the serial port status register (SKCTL) to "1"
*/
unsigned char potgo; /* start paddle scan sequence (see "ALLPOT") */
unsigned char unuse1; /* unused */ unsigned char unuse1; /* unused */
unsigned char serout; /* serial port data output */ unsigned char serout; /* serial port data output */
unsigned char irqen; /* interrupt request enable */ unsigned char irqen; /* interrupt request enable */
unsigned char skctl; /* serial port control */ unsigned char skctl; /* serial port control */
}; };
/*****************************************************************************/
/* (W) AUDC1-4 register values */
/*****************************************************************************/
/* Meaningful values for the distortion bits.
** The first process is to divide the clock value by the frequency,
** then mask the output using the polys in the order below;
** finally, the result is divided by two.
*/
#define AUDC_POLYS_5_17 0x00
#define AUDC_POLYS_5 0x20 /* Same as 0x60 */
#define AUDC_POLYS_5_4 0x40
#define AUDC_POLYS_17 0x80
#define AUDC_POLYS_NONE 0xA0 /* Same as 0xE0 */
#define AUDC_POLYS_4 0xC0
/* When set, the volume value in AUDC1-4 bits 0-3 is sent directly to the speaker;
** it is not modulated with the frequency specified in the AUDF1-4 registers.
** (See "De Re Atari" Chapter 7: Sound)
*/
#define AUDC_VOLUME_ONLY 0x10
/*****************************************************************************/
/* (W) AUDCTL register values */
/*****************************************************************************/
#define AUDCTL_CLOCKBASE_15HZ 0x01 /* Switch main clock base from 64 KHz to 15 KHz */
#define AUDCTL_HIGHPASS_CHAN2 0x02 /* Insert high pass filter into channel two, clocked by channel four */
#define AUDCTL_HIGHPASS_CHAN1 0x04 /* Insert high pass filter into channel one, clocked by channel two */
#define AUDCTL_JOIN_CHAN34 0x08 /* Join channels four and three (16 bit) */
#define AUDCTL_JOIN_CHAN12 0x10 /* Join channels two and one (16 bit) */
#define AUDCTL_CLOCK_CHAN3_179MHZ 0x20 /* Clock channel three with 1.79 MHz */
#define AUDCTL_CLOCK_CHAN1_179MHZ 0x40 /* Clock channel one with 1.79 MHz */
#define AUDCTL_9BIT_POLY 0x80 /* Makes the 17 bit poly counter into nine bit poly (see also: RANDOM) */
/*****************************************************************************/
/* (W) IRQEN register values */
/*****************************************************************************/
#define IRQEN_TIMER_1 0x01 /* The POKEY timer one interrupt is enabled */
#define IRQEN_TIMER_2 0x02 /* The POKEY timer two interrupt is enabled */
#define IRQEN_TIMER_4 0x04 /* The POKEY timer four interrupt is enabled */
#define IRQEN_SERIAL_TRANS_FINISHED 0x08 /* The serial out transmission finished interrupt is enabled */
#define IRQEN_SERIAL_OUT_DATA_REQUIRED 0x10 /* The serial output data required interrupt is enabled */
#define IRQEN_SERIAL_IN_DATA_READY 0x20 /* The serial input data ready interrupt is enabled. */
#define IRQEN_OTHER_KEY 0x40 /* The "other key" interrupt is enabled */
#define IRQEN_BREAK_KEY 0x80 /* The BREAK key is enabled */
/*****************************************************************************/
/* (W) SKCTL register values */
/*****************************************************************************/
#define SKCTL_KEYBOARD_DEBOUNCE 0x01 /* Enable keyboard debounce circuits */
#define SKCTL_KEYBOARD_SCANNING 0x02 /* Enable keyboard scanning circuit */
/* Fast pot scan
** The pot scan counter completes its sequence in two TV line times instead of
** one frame time (228 scan lines). Not as accurate as the normal pot scan
*/
#define SKCTL_FAST_POT_SCAN 0x04
/* POKEY two-tone mode
** Serial output is transmitted as a two-tone signal rather than a logic true/false.
*/
#define SKCTL_TWO_TONE_MODE 0x08
/* Force break (serial output to zero) */
#define SKCTL_FORCE_BREAK 0x80
/* Bits 4, 5, and 6 of SKCTL set Serial Mode Control: */
/* Trans. & Receive rates set by external clock; Also internal clock phase reset to zero. */
#define SKCTL_SER_MODE_TX_EXT_RX_EXT 0x00
/* Trans. rate set by external clock; Receive asynch. (ch. 4) (CH3 and CH4). */
#define SKCTL_SER_MODE_TX_EXT_RX_ASYNC 0x10
/* Trans. & Receive rates set by Chan. 4; Chan. 4 output on Bi-Direct. clock line. */
#define SKCTL_SER_MODE_TX_CH4_RX_CH4_BIDIR 0x20
/* N.B.: Bit combination 0,1,1 not useful */
/* Trans. rate set by Chan. 4; Receive rate set by external clock. */
#define SKCTL_SER_MODE_TX_CH4_RX_EXT 0x40
/* N.B.: Bit combination 1,0,1 not useful */
/* Trans. rate set by Chan. 2; Receive rate set by Chan. 4; Chan. 4 out on Bi-Direct. clock line. */
#define SKCTL_SER_MODE_TX_CH2_RX_CH4_BIDIR 0x60
/* Trans. rate set by Chan. 2; Receive asynch. (chan 3 & 4); Bi-Direct. clock not used (tri-state condition). */
#define SKCTL_SER_MODE_TX_CH4_RX_ASYNC 0x70
/*****************************************************************************/
/* Define a structure with the POKEY register offsets for read (R) */
/*****************************************************************************/
struct __pokey_read { struct __pokey_read {
unsigned char pot0; /* paddle 0 value */ unsigned char pot0; /* paddle 0 value */
unsigned char pot1; /* paddle 1 value */ unsigned char pot1; /* paddle 1 value */
@@ -63,7 +183,7 @@ struct __pokey_read {
unsigned char pot5; /* paddle 5 value */ unsigned char pot5; /* paddle 5 value */
unsigned char pot6; /* paddle 6 value */ unsigned char pot6; /* paddle 6 value */
unsigned char pot7; /* paddle 7 value */ unsigned char pot7; /* paddle 7 value */
unsigned char allpot; /* eight paddle port status */ unsigned char allpot; /* eight paddle port status (see "POTGO") */
unsigned char kbcode; /* keyboard code */ unsigned char kbcode; /* keyboard code */
unsigned char random; /* random number generator */ unsigned char random; /* random number generator */
unsigned char unuse2; /* unused */ unsigned char unuse2; /* unused */
@@ -73,6 +193,28 @@ struct __pokey_read {
unsigned char skstat; /* serial port status */ unsigned char skstat; /* serial port status */
}; };
/*****************************************************************************/
/* (R) SKSTAT register values */
/*****************************************************************************/
#define SKSTAT_SERIN_SHIFTREG_BUSY 0x02 /* Serial input shift register busy */
#define SKSTAT_LASTKEY_PRESSED 0x04 /* the last key is still pressed */
#define SKSTAT_SHIFTKEY_PRESSED 0x08 /* the [Shift] key is pressed */
#define SKSTAT_DATA_READ_INGORING_SHIFTREG 0x10 /* Data can be read directly from the serial input port, ignoring the shift register. */
#define SKSTAT_KEYBOARD_OVERRUN 0x20 /* Keyboard over-run; Reset BITs 7, 6 and 5 (latches) to 1, using SKREST */
#define SKSTAT_INPUT_OVERRUN 0x40 /* Serial data input over-run. Reset latches as above. */
#define SKSTAT_INPUT_FRAMEERROR 0x80 /* Serial data input frame error caused by missing or extra bits. Reset latches as above. */
/* KBCODE, internal keyboard codes for Atari 8-bit computers,
** are #defined as "KEY_..." in "atari.h".
** Note some keys are not read via KBCODE:
** - Reset
** - Start, Select, and Option; see CONSOL in "gtia.h"
** - Break
*/
/* End of _pokey.h */ /* End of _pokey.h */
#endif /* #ifndef __POKEY_H */ #endif /* #ifndef __POKEY_H */

View File

@@ -6,9 +6,10 @@
/* */ /* */
/* */ /* */
/* */ /* */
/* (C) 2000-2018 Mark Keates <markk@dendrite.co.uk> */ /* (C) 2000-2019 Mark Keates <markk@dendrite.co.uk> */
/* Freddy Offenga <taf_offenga@yahoo.com> */ /* Freddy Offenga <taf_offenga@yahoo.com> */
/* Christian Groessler <chris@groessler.org> */ /* Christian Groessler <chris@groessler.org> */
/* Bill Kendrick <nbs@sonic.net> */
/* */ /* */
/* */ /* */
/* This software is provided 'as-is', without any expressed or implied */ /* This software is provided 'as-is', without any expressed or implied */
@@ -44,7 +45,10 @@
/* Character codes */ /*****************************************************************************/
/* Character codes */
/*****************************************************************************/
#define CH_DELCHR 0xFE /* delete char under the cursor */ #define CH_DELCHR 0xFE /* delete char under the cursor */
#define CH_ENTER 0x9B #define CH_ENTER 0x9B
#define CH_ESC 0x1B #define CH_ESC 0x1B
@@ -86,70 +90,11 @@
#define CH_HLINE 0x12 #define CH_HLINE 0x12
#define CH_VLINE 0x7C #define CH_VLINE 0x7C
/* color defines */
/* make GTIA color value */ /*****************************************************************************/
#define _gtia_mkcolor(hue,lum) (((hue) << 4) | ((lum) << 1)) /* Masks for joy_read */
/*****************************************************************************/
/* luminance values go from 0 (black) to 7 (white) */
/* hue values */
#define HUE_GREY 0
#define HUE_GOLD 1
#define HUE_GOLDORANGE 2
#define HUE_REDORANGE 3
#define HUE_ORANGE 4
#define HUE_MAGENTA 5
#define HUE_PURPLE 6
#define HUE_BLUE 7
#define HUE_BLUE2 8
#define HUE_CYAN 9
#define HUE_BLUEGREEN 10
#define HUE_BLUEGREEN2 11
#define HUE_GREEN 12
#define HUE_YELLOWGREEN 13
#define HUE_YELLOW 14
#define HUE_YELLOWRED 15
/* 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)
/* 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_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
/* Masks for joy_read */
#define JOY_UP_MASK 0x01 #define JOY_UP_MASK 0x01
#define JOY_DOWN_MASK 0x02 #define JOY_DOWN_MASK 0x02
#define JOY_LEFT_MASK 0x04 #define JOY_LEFT_MASK 0x04
@@ -159,18 +104,141 @@
#define JOY_FIRE_MASK JOY_BTN_1_MASK #define JOY_FIRE_MASK JOY_BTN_1_MASK
#define JOY_FIRE(v) ((v) & JOY_FIRE_MASK) #define JOY_FIRE(v) ((v) & JOY_FIRE_MASK)
/* color register functions */
/*****************************************************************************/
/* Keyboard values returned by kbcode / CH */
/*****************************************************************************/
#define KEY_NONE ((unsigned char) 0xFF)
#define KEY_0 ((unsigned char) 0x32)
#define KEY_1 ((unsigned char) 0x1F)
#define KEY_2 ((unsigned char) 0x1E)
#define KEY_3 ((unsigned char) 0x1A)
#define KEY_4 ((unsigned char) 0x18)
#define KEY_5 ((unsigned char) 0x1D)
#define KEY_6 ((unsigned char) 0x1B)
#define KEY_7 ((unsigned char) 0x33)
#define KEY_8 ((unsigned char) 0x35)
#define KEY_9 ((unsigned char) 0x30)
#define KEY_A ((unsigned char) 0x3F)
#define KEY_B ((unsigned char) 0x15)
#define KEY_C ((unsigned char) 0x12)
#define KEY_D ((unsigned char) 0x3A)
#define KEY_E ((unsigned char) 0x2A)
#define KEY_F ((unsigned char) 0x38)
#define KEY_G ((unsigned char) 0x3D)
#define KEY_H ((unsigned char) 0x39)
#define KEY_I ((unsigned char) 0x0D)
#define KEY_J ((unsigned char) 0x01)
#define KEY_K ((unsigned char) 0x05)
#define KEY_L ((unsigned char) 0x00)
#define KEY_M ((unsigned char) 0x25)
#define KEY_N ((unsigned char) 0x23)
#define KEY_O ((unsigned char) 0x08)
#define KEY_P ((unsigned char) 0x0A)
#define KEY_Q ((unsigned char) 0x2F)
#define KEY_R ((unsigned char) 0x28)
#define KEY_S ((unsigned char) 0x3E)
#define KEY_T ((unsigned char) 0x2D)
#define KEY_U ((unsigned char) 0x0B)
#define KEY_V ((unsigned char) 0x10)
#define KEY_W ((unsigned char) 0x2E)
#define KEY_X ((unsigned char) 0x16)
#define KEY_Y ((unsigned char) 0x2B)
#define KEY_Z ((unsigned char) 0x17)
#define KEY_COMMA ((unsigned char) 0x20)
#define KEY_PERIOD ((unsigned char) 0x22)
#define KEY_SLASH ((unsigned char) 0x26)
#define KEY_SEMICOLON ((unsigned char) 0x02)
#define KEY_PLUS ((unsigned char) 0x06)
#define KEY_ASTERISK ((unsigned char) 0x07)
#define KEY_DASH ((unsigned char) 0x0E)
#define KEY_EQUALS ((unsigned char) 0x0F)
#define KEY_LESSTHAN ((unsigned char) 0x36)
#define KEY_GREATERTHAN ((unsigned char) 0x37)
#define KEY_ESC ((unsigned char) 0x1C)
#define KEY_TAB ((unsigned char) 0x2C)
#define KEY_SPACE ((unsigned char) 0x21)
#define KEY_RETURN ((unsigned char) 0x0C)
#define KEY_DELETE ((unsigned char) 0x34)
#define KEY_CAPS ((unsigned char) 0x3C)
#define KEY_INVERSE ((unsigned char) 0x27)
#define KEY_HELP ((unsigned char) 0x11)
/* Function keys only exist on the 1200XL model. */
#define KEY_F1 ((unsigned char) 0x03)
#define KEY_F2 ((unsigned char) 0x04)
#define KEY_F3 ((unsigned char) 0x13)
#define KEY_F4 ((unsigned char) 0x14)
/* N.B. Cannot read Ctrl key alone */
#define KEY_CTRL ((unsigned char) 0x80)
/* N.B. Cannot read Shift key alone via KBCODE;
** instead, check "Shfit key press" bit of SKSTAT register.
** Also, no way to tell left Shift from right Shift.
*/
#define KEY_SHIFT ((unsigned char) 0x40)
/* Composed keys
** (Other combinations are possible, including Shift+Ctrl+key,
** though not all such combinations are available.)
*/
#define KEY_EXCLAMATIONMARK (KEY_1 | KEY_SHIFT)
#define KEY_QUOTE (KEY_2 | KEY_SHIFT)
#define KEY_HASH (KEY_3 | KEY_SHIFT)
#define KEY_DOLLAR (KEY_4 | KEY_SHIFT)
#define KEY_PERCENT (KEY_5 | KEY_SHIFT)
#define KEY_AMPERSAND (KEY_6 | KEY_SHIFT)
#define KEY_APOSTROPHE (KEY_7 | KEY_SHIFT)
#define KEY_AT (KEY_8 | KEY_SHIFT)
#define KEY_OPENINGPARAN (KEY_9 | KEY_SHIFT)
#define KEY_CLOSINGPARAN (KEY_0 | KEY_SHIFT)
#define KEY_UNDERLINE (KEY_DASH | KEY_SHIFT)
#define KEY_BAR (KEY_EQUALS | KEY_SHIFT)
#define KEY_COLON (KEY_SEMICOLON | KEY_SHIFT)
#define KEY_BACKSLASH (KEY_PLUS | KEY_SHIFT)
#define KEY_CIRCUMFLEX (KEY_ASTERISK | KEY_SHIFT)
#define KEY_OPENINGBRACKET (KEY_COMMA | KEY_SHIFT)
#define KEY_CLOSINGBRACKET (KEY_PERIOD | KEY_SHIFT)
#define KEY_QUESTIONMARK (KEY_SLASH | KEY_SHIFT)
#define KEY_CLEAR (KEY_LESSTHAN | KEY_SHIFT)
#define KEY_INSERT (KEY_GREATERTHAN | KEY_SHIFT)
#define KEY_UP (KEY_UNDERLINE | KEY_CTRL)
#define KEY_DOWN (KEY_EQUALS | KEY_CTRL)
#define KEY_LEFT (KEY_PLUS | KEY_CTRL)
#define KEY_RIGHT (KEY_ASTERISK | KEY_CTRL)
/*****************************************************************************/
/* Color register functions */
/*****************************************************************************/
extern void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminace); extern void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminace);
extern void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value); extern void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value);
extern unsigned char __fastcall__ _getcolor (unsigned char color_reg); extern unsigned char __fastcall__ _getcolor (unsigned char color_reg);
/* other screen functions */ /*****************************************************************************/
/* Other screen functions */
/*****************************************************************************/
extern int __fastcall__ _graphics (unsigned char mode); /* mode value same as in BASIC */ extern int __fastcall__ _graphics (unsigned char mode); /* mode value same as in BASIC */
extern void __fastcall__ _scroll (signed char numlines); extern void __fastcall__ _scroll (signed char numlines);
/* numlines > 0 scrolls up */ /* numlines > 0 scrolls up */
/* numlines < 0 scrolls down */ /* numlines < 0 scrolls down */
/* misc. functions */
/*****************************************************************************/
/* Misc. functions */
/*****************************************************************************/
extern unsigned char get_ostype(void); /* get ROM version */ extern unsigned char get_ostype(void); /* get ROM version */
extern unsigned char get_tv(void); /* get TV system */ extern unsigned char get_tv(void); /* get TV system */
extern void _save_vecs(void); /* save system vectors */ extern void _save_vecs(void); /* save system vectors */
@@ -178,7 +246,11 @@ extern void _rest_vecs(void); /* restore system vectors */
extern char *_getdefdev(void); /* get default floppy device */ extern char *_getdefdev(void); /* get default floppy device */
extern unsigned char _is_cmdline_dos(void); /* does DOS support command lines */ extern unsigned char _is_cmdline_dos(void); /* does DOS support command lines */
/* global variables */
/*****************************************************************************/
/* Global variables */
/*****************************************************************************/
extern unsigned char _dos_type; /* the DOS flavour */ extern unsigned char _dos_type; /* the DOS flavour */
#ifndef __ATARIXL__ #ifndef __ATARIXL__
extern void atr130_emd[]; extern void atr130_emd[];
@@ -232,7 +304,11 @@ extern void atrx15_tgi[];
extern void atrx15p2_tgi[]; extern void atrx15p2_tgi[];
#endif #endif
/* get_ostype return value defines (for explanation, see ostype.s) */
/*****************************************************************************/
/* get_ostype return value defines (for explanation, see ostype.s) */
/*****************************************************************************/
/* masks */ /* masks */
#define AT_OS_TYPE_MAIN 7 #define AT_OS_TYPE_MAIN 7
#define AT_OS_TYPE_MINOR (7 << 3) #define AT_OS_TYPE_MINOR (7 << 3)
@@ -255,11 +331,19 @@ extern void atrx15p2_tgi[];
#define AT_OS_XLXE_3 3 #define AT_OS_XLXE_3 3
#define AT_OS_XLXE_4 4 #define AT_OS_XLXE_4 4
/* get_tv return values */
/*****************************************************************************/
/* get_tv return values */
/*****************************************************************************/
#define AT_NTSC 0 #define AT_NTSC 0
#define AT_PAL 1 #define AT_PAL 1
/* valid _dos_type values */
/*****************************************************************************/
/* valid _dos_type values */
/*****************************************************************************/
#define SPARTADOS 0 #define SPARTADOS 0
#define REALDOS 1 #define REALDOS 1
#define BWDOS 2 #define BWDOS 2
@@ -269,7 +353,11 @@ extern void atrx15p2_tgi[];
#define MYDOS 6 #define MYDOS 6
#define NODOS 255 #define NODOS 255
/* Define hardware */
/*****************************************************************************/
/* Define hardware and where they're mapped in memory */
/*****************************************************************************/
#include <_gtia.h> #include <_gtia.h>
#define GTIA_READ (*(struct __gtia_read*)0xD000) #define GTIA_READ (*(struct __gtia_read*)0xD000)
#define GTIA_WRITE (*(struct __gtia_write*)0xD000) #define GTIA_WRITE (*(struct __gtia_write*)0xD000)
@@ -286,7 +374,68 @@ extern void atrx15p2_tgi[];
#include <_antic.h> #include <_antic.h>
#define ANTIC (*(struct __antic*)0xD400) #define ANTIC (*(struct __antic*)0xD400)
/* device control block */
/*****************************************************************************/
/* Shadow registers for hardware registers */
/*****************************************************************************/
/* GTIA */
#define STRIG0 (*(unsigned char*)0x284) /* TRIG0 */
#define STRIG1 (*(unsigned char*)0x285) /* TRIG1 */
#define STRIG2 (*(unsigned char*)0x286) /* TRIG2 */
#define STRIG3 (*(unsigned char*)0x287) /* TRIG3 */
#define PCOLR0 (*(unsigned char*)0x2C0) /* COLPM0 */
#define PCOLR1 (*(unsigned char*)0x2C1) /* COLPM1 */
#define PCOLR2 (*(unsigned char*)0x2C2) /* COLPM2 */
#define PCOLR3 (*(unsigned char*)0x2C3) /* COLPM3 */
#define COLOR0 (*(unsigned char*)0x2C4) /* COLPF0 */
#define COLOR1 (*(unsigned char*)0x2C5) /* COLPF1 */
#define COLOR2 (*(unsigned char*)0x2C6) /* COLPF2 */
#define COLOR3 (*(unsigned char*)0x2C7) /* COLPF3 */
#define COLOR4 (*(unsigned char*)0x2C8) /* COLPBK */
#define GPRIOR (*(unsigned char*)0x264) /* PRIOR */
/* ANTIC */
#define SDMCTL (*(unsigned char*)0x22F) /* DMACTL */
#define CHACT (*(unsigned char*)0x2F3) /* CHACTL */
#define SDLSTL (*(unsigned char*)0x230) /* DLISTL */
#define SDLSTH (*(unsigned char*)0x231) /* DLISTH */
#define SDLST (*(unsigned int*)0x230) /* DLISTL/H together */
#define CHBAS (*(unsigned char*)0x2F4) /* CHBASE */
#define LPENH (*(unsigned char*)0x233) /* PENH */
#define LPENV (*(unsigned char*)0x234) /* PENV */
/* POKEY */
#define PADDL0 (*(unsigned char*)0x270) /* POT0 */
#define PADDL1 (*(unsigned char*)0x271) /* POT1 */
#define PADDL2 (*(unsigned char*)0x272) /* POT2 */
#define PADDL3 (*(unsigned char*)0x273) /* POT3 */
#define PADDL4 (*(unsigned char*)0x274) /* POT4 */
#define PADDL5 (*(unsigned char*)0x275) /* POT5 */
#define PADDL6 (*(unsigned char*)0x276) /* POT6 */
#define PADDL7 (*(unsigned char*)0x277) /* POT7 */
#define CH (*(unsigned char*)0x2FC) /* KBCODE */
#define POKMSK (*(unsigned char*)0x10) /* IRQEN */
/* PIA */
#define STICK0 (*(unsigned char*)0x278) /* PORTA for controller port 1 */
#define STICK1 (*(unsigned char*)0x279) /* PORTA for controller port 2 */
#define STICK2 (*(unsigned char*)0x27A) /* PORTB for controller port 3 */
#define STICK3 (*(unsigned char*)0x27B) /* PORTB for controller port 4 */
#define PTRIG0 (*(unsigned char*)0x27C) /* PORTA for controller port 1, paddle 1 */
#define PTRIG1 (*(unsigned char*)0x27D) /* PORTA for controller port 1, paddle 2 */
#define PTRIG2 (*(unsigned char*)0x27E) /* PORTA for controller port 1, paddle 3 */
#define PTRIG3 (*(unsigned char*)0x27F) /* PORTA for controller port 1, paddle 4 */
#define PTRIG4 (*(unsigned char*)0x280) /* PORTA for controller port 2, paddle 5 */
#define PTRIG5 (*(unsigned char*)0x281) /* PORTA for controller port 2, paddle 6 */
#define PTRIG6 (*(unsigned char*)0x282) /* PORTA for controller port 2, paddle 7 */
#define PTRIG7 (*(unsigned char*)0x283) /* PORTA for controller port 2, paddle 8 */
/*****************************************************************************/
/* Device control block */
/*****************************************************************************/
struct __dcb { struct __dcb {
unsigned char device; /* device id */ unsigned char device; /* device id */
unsigned char unit; /* unit number */ unsigned char unit; /* unit number */
@@ -301,7 +450,11 @@ struct __dcb {
}; };
#define DCB (*(struct __dcb *)0x300) #define DCB (*(struct __dcb *)0x300)
/* I/O control block */
/*****************************************************************************/
/* I/O control block */
/*****************************************************************************/
struct __iocb { struct __iocb {
unsigned char handler; /* handler index number (0xff free) */ unsigned char handler; /* handler index number (0xff free) */
unsigned char drive; /* device number (drive) */ unsigned char drive; /* device number (drive) */
@@ -346,6 +499,5 @@ struct __iocb {
#define IOCB_FORMAT 0xFE /* format */ #define IOCB_FORMAT 0xFE /* format */
/* End of atari.h */ /* End of atari.h */
#endif #endif

View File

@@ -46,47 +46,6 @@
/* the addresses of the static drivers */ /* the addresses of the static drivers */
extern void atr5200std_joy[]; /* referred to by joy_static_stddrv[] */ extern void atr5200std_joy[]; /* referred to by joy_static_stddrv[] */
/* make GTIA color value */
#define _gtia_mkcolor(hue,lum) (((hue) << 4) | ((lum) << 1))
/* luminance values go from 0 (black) to 7 (white) */
/* hue values */
#define HUE_GREY 0
#define HUE_GOLD 1
#define HUE_GOLDORANGE 2
#define HUE_REDORANGE 3
#define HUE_ORANGE 4
#define HUE_MAGENTA 5
#define HUE_PURPLE 6
#define HUE_BLUE 7
#define HUE_BLUE2 8
#define HUE_CYAN 9
#define HUE_BLUEGREEN 10
#define HUE_BLUEGREEN2 11
#define HUE_GREEN 12
#define HUE_YELLOWGREEN 13
#define HUE_YELLOW 14
#define HUE_YELLOWRED 15
/* Color defines, similar to c64 colors (untested) */
#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)
/* Masks for joy_read */ /* Masks for joy_read */
#define JOY_UP_MASK 0x01 #define JOY_UP_MASK 0x01
#define JOY_DOWN_MASK 0x02 #define JOY_DOWN_MASK 0x02

View File

@@ -137,6 +137,7 @@
/* The addresses of the static drivers */ /* The addresses of the static drivers */
extern void c64_65816_emd[];
extern void c64_c256k_emd[]; extern void c64_c256k_emd[];
extern void c64_dqbb_emd[]; extern void c64_dqbb_emd[];
extern void c64_georam_emd[]; extern void c64_georam_emd[];

View File

@@ -45,6 +45,10 @@ void __fastcall__ BitOtherClip(void *proc1, void *proc2, char skipl,
void __fastcall__ GraphicsString(char *myGfxString); void __fastcall__ GraphicsString(char *myGfxString);
#ifdef __GEOS_CBM__
void SetNewMode(void);
#endif
/* VIC colour constants */ /* VIC colour constants */
#define BLACK 0 #define BLACK 0
#define WHITE 1 #define WHITE 1

View File

@@ -93,7 +93,7 @@ INSTALL = install
define INSTALL_recipe define INSTALL_recipe
$(if $(PREFIX),,$(error variable `PREFIX' must be set)) $(if $(PREFIX),,$(error variable "PREFIX" must be set))
$(INSTALL) -d $(DESTDIR)$(datadir)/$(dir) $(INSTALL) -d $(DESTDIR)$(datadir)/$(dir)
$(INSTALL) -m0644 ../$(dir)/*.* $(DESTDIR)$(datadir)/$(dir) $(INSTALL) -m0644 ../$(dir)/*.* $(DESTDIR)$(datadir)/$(dir)

View File

@@ -44,15 +44,15 @@
.addr $0000 .addr $0000
; Jump table ; Jump table
.addr INSTALL .addr SER_INSTALL
.addr UNINSTALL .addr SER_UNINSTALL
.addr OPEN .addr SER_OPEN
.addr CLOSE .addr SER_CLOSE
.addr GET .addr SER_GET
.addr PUT .addr SER_PUT
.addr STATUS .addr SER_STATUS
.addr IOCTL .addr SER_IOCTL
.addr IRQ .addr SER_IRQ
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; I/O definitions ; I/O definitions
@@ -141,23 +141,23 @@ IdTableLen = * - IdValTable
.code .code
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; INSTALL: Is called after the driver is loaded into memory. If possible, ; SER_INSTALL: Is called after the driver is loaded into memory. If possible,
; check if the hardware is present. Must return an SER_ERR_xx code in a/x. ; check if the hardware is present. Must return an SER_ERR_xx code in a/x.
; ;
; Since we don't have to manage the IRQ vector on the Apple II, this is ; Since we don't have to manage the IRQ vector on the Apple II, this is
; actually the same as: ; actually the same as:
; ;
; UNINSTALL: Is called before the driver is removed from memory. ; SER_UNINSTALL: Is called before the driver is removed from memory.
; No return code required (the driver is removed from memory on return). ; No return code required (the driver is removed from memory on return).
; ;
; and: ; and:
; ;
; CLOSE: Close the port and disable interrupts. Called without parameters. ; SER_CLOSE: Close the port and disable interrupts. Called without parameters.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
INSTALL: SER_INSTALL:
UNINSTALL: SER_UNINSTALL:
CLOSE: SER_CLOSE:
ldx Index ; Check for open port ldx Index ; Check for open port
beq :+ beq :+
@@ -172,10 +172,10 @@ CLOSE:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; OPEN: A pointer to a ser_params structure is passed in ptr1. ; SER_OPEN: A pointer to a ser_params structure is passed in ptr1.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
OPEN: SER_OPEN:
ldx #<$C000 ldx #<$C000
stx ptr2 stx ptr2
lda #>$C000 lda #>$C000
@@ -273,11 +273,11 @@ InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; GET: Will fetch a character from the receive buffer and store it into the ; SER_GET: Will fetch a character from the receive buffer and store it into the
; variable pointed to by ptr1. If no data is available, SER_ERR_NO_DATA is ; variable pointed to by ptr1. If no data is available, SER_ERR_NO_DATA is
; returned. ; returned.
GET: SER_GET:
ldx Index ldx Index
ldy SendFreeCnt ; Send data if necessary ldy SendFreeCnt ; Send data if necessary
iny ; Y == $FF? iny ; Y == $FF?
@@ -315,10 +315,10 @@ GET:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; PUT: Output character in A. ; SER_PUT: Output character in A.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
PUT: SER_PUT:
ldx Index ldx Index
; Try to send ; Try to send
@@ -348,10 +348,10 @@ PUT:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; STATUS: Return the status in the variable pointed to by ptr1. ; SER_STATUS: Return the status in the variable pointed to by ptr1.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
STATUS: SER_STATUS:
ldx Index ldx Index
lda ACIA_STATUS,x lda ACIA_STATUS,x
ldx #$00 ldx #$00
@@ -360,11 +360,11 @@ STATUS:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl ; SER_IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
; specific data in ptr1, and the ioctl code in A. ; specific data in ptr1, and the ioctl code in A.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
IOCTL: SER_IOCTL:
; Check data msb and code to be 0 ; Check data msb and code to be 0
ora ptr1+1 ora ptr1+1
bne :+ bne :+
@@ -384,12 +384,12 @@ IOCTL:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All ; SER_IRQ: Called from the builtin runtime IRQ handler as a subroutine. All
; registers are already saved, no parameters are passed, but the carry flag ; 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 ; is clear on entry. The routine must return with carry set if the interrupt
; was handled, otherwise with carry clear. ; was handled, otherwise with carry clear.
IRQ: SER_IRQ:
ldx Index ; Check for open port ldx Index ; Check for open port
beq Done beq Done
lda ACIA_STATUS,x ; Check ACIA status for receive interrupt lda ACIA_STATUS,x ; Check ACIA status for receive interrupt

View File

@@ -1,5 +1,5 @@
; ;
; Mark Keates, Christian Groessler ; Mark Keates, Christian Groessler, Piotr Fusik
; ;
; void cputcxy (unsigned char x, unsigned char y, char c); ; void cputcxy (unsigned char x, unsigned char y, char c);
; void cputc (char c); ; void cputc (char c);
@@ -30,16 +30,13 @@ L4: cmp #$0A ; LF
cmp #ATEOL ; Atari-EOL? cmp #ATEOL ; Atari-EOL?
beq newline beq newline
tay asl a ; shift out the inverse bit
rol a adc #$c0 ; grab the inverse bit; convert ATASCII to screen code
rol a bpl codeok ; screen code ok?
rol a eor #$40 ; needs correction
rol a codeok: lsr a ; undo the shift
and #3 bcc cputdirect
tax eor #$80 ; restore the inverse bit
tya
and #$9f
ora ataint,x
cputdirect: ; accepts screen code cputdirect: ; accepts screen code
jsr putchar jsr putchar
@@ -89,6 +86,3 @@ putchar:
ldy COLCRS ldy COLCRS
sta (ptr4),y sta (ptr4),y
jmp setcursor jmp setcursor
.rodata
ataint: .byte 64,0,32,96

View File

@@ -1110,11 +1110,8 @@ skipm: ; Loop while --dy > 0
; locals ; locals
string := tmp1 string := tmp1
cols := tmp3
pixels := tmp4 pixels := tmp4
font := regsave font := regsave
.rodata
ataint: .byte 64,0,32,96
.bss .bss
rows: .res 1 rows: .res 1
@@ -1222,32 +1219,31 @@ scvert: ldx x1
.endif .endif
; Draw one character ; Draw one character
; Convert to ANTIC code draw:
draw: tay ; Extract the inverse mask
rol a ldx #0
rol a asl a
rol a bcc noinv
rol a dex
and #3 noinv: stx inv
tax
tya
and #$9f
ora ataint,x
; Save and clear inverse video bit
sta inv
and #$7F
; Calculate font data address ; Calculate font data address
ldx CHBAS
cmp #$20*2
bpl lowhalf
; Semigraphic or lowercase
inx
inx
lowhalf:
asl a
bcc lowquarter
; Letter
inx
lowquarter:
asl a
sta font sta font
lda #0 stx font+1
sta font + 1
.repeat 3
asl font
rol a
.endrepeat
adc CHBAS
sta font + 1
; Save old coords ; Save old coords
bit text_dir bit text_dir
bpl hor bpl hor
@@ -1273,15 +1269,12 @@ cont: ldy #7
; Put one row of the glyph ; Put one row of the glyph
putrow: sty rows putrow: sty rows
lda (font),y lda (font),y
bit inv eor inv
bpl noinv sec
eor #$FF rol a
noinv: sta pixels sta pixels
lda #7
sta cols
; Put one column of the row ; Put one column of the row
putcol: asl pixels putcol: bcc next_col
bcc next_col
lda x1 lda x1
pha pha
lda x1 + 1 lda x1 + 1
@@ -1317,8 +1310,8 @@ vertinc:
sub mag_x sub mag_x
sta y2 sta y2
L2: L2:
dec cols asl pixels
bpl putcol bne putcol
next_row: next_row:
; Go to next row ; Go to next row
bit text_dir bit text_dir

View File

@@ -44,15 +44,15 @@
.addr $0000 .addr $0000
; Jump table ; Jump table
.addr INSTALL .addr SER_INSTALL
.addr UNINSTALL .addr SER_UNINSTALL
.addr OPEN .addr SER_OPEN
.addr CLOSE .addr SER_CLOSE
.addr GET .addr SER_GET
.addr PUT .addr SER_PUT
.addr SER_STATUS .addr SER_STATUS
.addr IOCTL .addr SER_IOCTL
.addr IRQ .addr SER_IRQ
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; Global variables ; Global variables
@@ -116,23 +116,23 @@ ParityTable:
.code .code
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; INSTALL: Is called after the driver is loaded into memory. If possible, ; SER_INSTALL: Is called after the driver is loaded into memory. If possible,
; check if the hardware is present. Must return an SER_ERR_xx code in a/x. ; check if the hardware is present. Must return an SER_ERR_xx code in a/x.
; ;
; Since we don't have to manage the IRQ vector on the Telestrat/Atmos, this is ; Since we don't have to manage the IRQ vector on the Telestrat/Atmos, this is
; actually the same as: ; actually the same as:
; ;
; UNINSTALL: Is called before the driver is removed from memory. ; SER_UNINSTALL: Is called before the driver is removed from memory.
; No return code required (the driver is removed from memory on return). ; No return code required (the driver is removed from memory on return).
; ;
; and: ; and:
; ;
; CLOSE: Close the port and disable interrupts. Called without parameters. ; SER_CLOSE: Close the port and disable interrupts. Called without parameters.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
INSTALL: SER_INSTALL:
UNINSTALL: SER_UNINSTALL:
CLOSE: SER_CLOSE:
ldx Index ; Check for open port ldx Index ; Check for open port
beq :+ beq :+
@@ -147,10 +147,10 @@ CLOSE:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; OPEN: A pointer to a ser_params structure is passed in ptr1. ; SER_OPEN: A pointer to a ser_params structure is passed in ptr1.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
OPEN: SER_OPEN:
; Check if the handshake setting is valid ; Check if the handshake setting is valid
ldy #SER_PARAMS::HANDSHAKE ; Handshake ldy #SER_PARAMS::HANDSHAKE ; Handshake
lda (ptr1),y lda (ptr1),y
@@ -220,11 +220,11 @@ InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; GET: Will fetch a character from the receive buffer and store it into the ; SER_GET: Will fetch a character from the receive buffer and store it into the
; variable pointed to by ptr1. If no data is available, SER_ERR_NO_DATA is ; variable pointed to by ptr1. If no data is available, SER_ERR_NO_DATA is
; returned. ; returned.
GET: SER_GET:
ldy SendFreeCnt ; Send data if necessary ldy SendFreeCnt ; Send data if necessary
iny ; Y == $FF? iny ; Y == $FF?
beq :+ beq :+
@@ -261,10 +261,10 @@ GET:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; PUT: Output character in A. ; SER_PUT: Output character in A.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
PUT: SER_PUT:
; Try to send ; Try to send
ldy SendFreeCnt ldy SendFreeCnt
iny ; Y = $FF? iny ; Y = $FF?
@@ -303,22 +303,22 @@ SER_STATUS:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl ; SER_IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
; specific data in ptr1, and the ioctl code in A. ; specific data in ptr1, and the ioctl code in A.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
IOCTL: SER_IOCTL:
lda #<SER_ERR_INV_IOCTL lda #<SER_ERR_INV_IOCTL
ldx #>SER_ERR_INV_IOCTL ldx #>SER_ERR_INV_IOCTL
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All ; SER_IRQ: Called from the builtin runtime IRQ handler as a subroutine. All
; registers are already saved, no parameters are passed, but the carry flag ; 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 ; is clear on entry. The routine must return with carry set if the interrupt
; was handled, otherwise with carry clear. ; was handled, otherwise with carry clear.
IRQ: SER_IRQ:
ldx Index ; Check for open port ldx Index ; Check for open port
beq Done beq Done
lda ACIA::STATUS,x ; Check ACIA status for receive interrupt lda ACIA::STATUS,x ; Check ACIA status for receive interrupt

View File

@@ -10,6 +10,7 @@
.import cursor .import cursor
.include "cbm_kernal.inc"
.include "c128.inc" .include "c128.inc"
;-------------------------------------------------------------------------- ;--------------------------------------------------------------------------

View File

@@ -6,9 +6,6 @@
.export _clrscr .export _clrscr
.include "c128.inc" .include "cbm_kernal.inc"
_clrscr = CLRSCR _clrscr = CLRSCR

View File

@@ -9,8 +9,8 @@
.export _cputcxy, _cputc, cputdirect, putchar .export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot .export newline, plot
.import gotoxy .import gotoxy
.import PLOT
.include "cbm_kernal.inc"
.include "c128.inc" .include "c128.inc"
newline = NEWLINE newline = NEWLINE
@@ -85,4 +85,3 @@ plot: ldy CURS_X
; position in Y ; position in Y
putchar = $CC2F putchar = $CC2F

View File

@@ -25,6 +25,7 @@
.constructor initmainargs, 24 .constructor initmainargs, 24
.import __argc, __argv .import __argc, __argv
.include "cbm_kernal.inc"
.include "c128.inc" .include "c128.inc"

View File

@@ -45,15 +45,15 @@
; Jump table ; Jump table
.word INSTALL .word SER_INSTALL
.word UNINSTALL .word SER_UNINSTALL
.word OPEN .word SER_OPEN
.word CLOSE .word SER_CLOSE
.word GET .word SER_GET
.word PUT .word SER_PUT
.word STATUS .word SER_STATUS
.word IOCTL .word SER_IOCTL
.word IRQ .word SER_IRQ
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; I/O definitions ; I/O definitions
@@ -155,11 +155,11 @@ Vector := *+1
.reloc .reloc
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; INSTALL routine. Is called after the driver is loaded into memory. If ; SER_INSTALL routine. Is called after the driver is loaded into memory. If
; possible, check if the hardware is present. ; possible, check if the hardware is present.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
INSTALL: SER_INSTALL:
; Deactivate DTR and disable 6551 interrupts ; Deactivate DTR and disable 6551 interrupts
@@ -192,10 +192,10 @@ SetNMI: sta NMIVec
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory. ; SER_UNINSTALL routine. Is called before the driver is removed from memory.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
UNINSTALL: SER_UNINSTALL:
; Stop interrupts, drop DTR ; Stop interrupts, drop DTR
@@ -212,7 +212,7 @@ UNINSTALL:
; PARAMS routine. A pointer to a ser_params structure is passed in ptr1. ; PARAMS routine. A pointer to a ser_params structure is passed in ptr1.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
OPEN: SER_OPEN:
; Check if the handshake setting is valid ; Check if the handshake setting is valid
@@ -283,11 +283,11 @@ InvBaud:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; CLOSE: Close the port, disable interrupts and flush the buffer. Called ; SER_CLOSE: Close the port, disable interrupts and flush the buffer. Called
; without parameters. Must return an error code in a/x. ; without parameters. Must return an error code in a/x.
; ;
CLOSE: SER_CLOSE:
; Stop interrupts, drop DTR ; Stop interrupts, drop DTR
@@ -305,12 +305,13 @@ CLOSE:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; GET: Will fetch a character from the receive buffer and store it into the ; SER_GET: Will fetch a character from the receive buffer and store it into the
; variable pointer to by ptr1. If no data is available, SER_ERR_NO_DATA is ; variable pointer to by ptr1. If no data is available, SER_ERR_NO_DATA is
; return. ; return.
; ;
GET: ldx SendFreeCnt ; Send data if necessary SER_GET:
ldx SendFreeCnt ; Send data if necessary
inx ; X == $FF? inx ; X == $FF?
beq @L1 beq @L1
lda #$00 lda #$00
@@ -349,11 +350,11 @@ GET: ldx SendFreeCnt ; Send data if necessary
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; PUT: Output character in A. ; SER_PUT: Output character in A.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
PUT: SER_PUT:
; Try to send ; Try to send
@@ -383,23 +384,25 @@ PUT:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; STATUS: Return the status in the variable pointed to by ptr1. ; SER_STATUS: Return the status in the variable pointed to by ptr1.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
STATUS: lda ACIA_STATUS SER_STATUS:
lda ACIA_STATUS
ldx #0 ldx #0
sta (ptr1,x) sta (ptr1,x)
txa ; SER_ERR_OK txa ; SER_ERR_OK
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl ; SER_IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
; specific data in ptr1, and the ioctl code in A. ; specific data in ptr1, and the ioctl code in A.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
IOCTL: lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now SER_IOCTL:
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
ldx #>SER_ERR_INV_IOCTL ldx #>SER_ERR_INV_IOCTL
rts rts
@@ -407,7 +410,7 @@ IOCTL: lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
; IRQ: Not used on the C128 ; IRQ: Not used on the C128
; ;
IRQ = $0000 SER_IRQ = $0000
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; ;
@@ -500,5 +503,3 @@ InitBuffers:
stx RecvFreeCnt stx RecvFreeCnt
stx SendFreeCnt stx SendFreeCnt
rts rts

View File

@@ -7,6 +7,7 @@
.export _cgetc .export _cgetc
.import cursor .import cursor
.include "cbm_kernal.inc"
.include "plus4.inc" .include "plus4.inc"

View File

@@ -6,10 +6,6 @@
.export _clrscr .export _clrscr
.include "plus4.inc" .include "cbm_kernal.inc"
_clrscr = CLRSCR _clrscr = CLRSCR

View File

@@ -7,6 +7,7 @@
.export _cgetc .export _cgetc
.import cursor .import cursor
.include "cbm_kernal.inc"
.include "c64.inc" .include "c64.inc"
_cgetc: lda KEY_COUNT ; Get number of characters _cgetc: lda KEY_COUNT ; Get number of characters

View File

@@ -6,9 +6,6 @@
.export _clrscr .export _clrscr
.include "c64.inc" .include "cbm_kernal.inc"
_clrscr = CLRSCR _clrscr = CLRSCR

View File

@@ -24,6 +24,7 @@
.include "zeropage.inc" .include "zeropage.inc"
.include "ser-kernel.inc" .include "ser-kernel.inc"
.include "ser-error.inc" .include "ser-error.inc"
.include "cbm_kernal.inc"
.include "c64.inc" .include "c64.inc"
.macpack module .macpack module
@@ -45,15 +46,15 @@
; Jump table ; Jump table
.word INSTALL .word SER_INSTALL
.word UNINSTALL .word SER_UNINSTALL
.word OPEN .word SER_OPEN
.word CLOSE .word SER_CLOSE
.word GET .word SER_GET
.word PUT .word SER_PUT
.word STATUS .word SER_STATUS
.word IOCTL .word SER_IOCTL
.word IRQ .word SER_IRQ
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; I/O definitions ; I/O definitions
@@ -136,11 +137,11 @@ ParityTable:
.code .code
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; INSTALL routine. Is called after the driver is loaded into memory. If ; SER_INSTALL routine. Is called after the driver is loaded into memory. If
; possible, check if the hardware is present. ; possible, check if the hardware is present.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
INSTALL: SER_INSTALL:
; Deactivate DTR and disable 6551 interrupts ; Deactivate DTR and disable 6551 interrupts
@@ -165,10 +166,10 @@ SetNMI: sta NMIVec
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory. ; SER_UNINSTALL routine. Is called before the driver is removed from memory.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
UNINSTALL: SER_UNINSTALL:
; Stop interrupts, drop DTR ; Stop interrupts, drop DTR
@@ -185,7 +186,7 @@ UNINSTALL:
; PARAMS routine. A pointer to a ser_params structure is passed in ptr1. ; PARAMS routine. A pointer to a ser_params structure is passed in ptr1.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
OPEN: SER_OPEN:
; Check if the handshake setting is valid ; Check if the handshake setting is valid
@@ -256,11 +257,11 @@ InvBaud:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; CLOSE: Close the port, disable interrupts and flush the buffer. Called ; SER_CLOSE: Close the port, disable interrupts and flush the buffer. Called
; without parameters. Must return an error code in a/x. ; without parameters. Must return an error code in a/x.
; ;
CLOSE: SER_CLOSE:
; Stop interrupts, drop DTR ; Stop interrupts, drop DTR
@@ -278,12 +279,13 @@ CLOSE:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; GET: Will fetch a character from the receive buffer and store it into the ; SER_GET: Will fetch a character from the receive buffer and store it into the
; variable pointer to by ptr1. If no data is available, SER_ERR_NO_DATA is ; variable pointer to by ptr1. If no data is available, SER_ERR_NO_DATA is
; return. ; return.
; ;
GET: ldx SendFreeCnt ; Send data if necessary SER_GET:
ldx SendFreeCnt ; Send data if necessary
inx ; X == $FF? inx ; X == $FF?
beq @L1 beq @L1
lda #$00 lda #$00
@@ -322,11 +324,11 @@ GET: ldx SendFreeCnt ; Send data if necessary
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; PUT: Output character in A. ; SER_PUT: Output character in A.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
PUT: SER_PUT:
; Try to send ; Try to send
@@ -356,31 +358,33 @@ PUT:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; STATUS: Return the status in the variable pointed to by ptr1. ; SER_STATUS: Return the status in the variable pointed to by ptr1.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
STATUS: lda ACIA_STATUS SER_STATUS:
lda ACIA_STATUS
ldx #0 ldx #0
sta (ptr1,x) sta (ptr1,x)
txa ; SER_ERR_OK txa ; SER_ERR_OK
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl ; SER_IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
; specific data in ptr1, and the ioctl code in A. ; specific data in ptr1, and the ioctl code in A.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
IOCTL: lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now SER_IOCTL:
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
ldx #>SER_ERR_INV_IOCTL ldx #>SER_ERR_INV_IOCTL
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IRQ: Not used on the C64 ; SER_IRQ: Not used on the C64
; ;
IRQ = $0000 SER_IRQ = $0000
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; ;
@@ -476,4 +480,3 @@ InitBuffers:
stx RecvFreeCnt stx RecvFreeCnt
stx SendFreeCnt stx SendFreeCnt
rts rts

View File

@@ -11,6 +11,7 @@
.import cursor .import cursor
.importzp tmp1 .importzp tmp1
.include "cbm_kernal.inc"
.include "c64.inc" .include "c64.inc"
.include "soft80.inc" .include "soft80.inc"

View File

@@ -12,6 +12,7 @@
.import cursor .import cursor
.importzp tmp1 .importzp tmp1
.include "cbm_kernal.inc"
.include "c64.inc" .include "c64.inc"
.include "soft80.inc" .include "soft80.inc"

View File

@@ -46,15 +46,15 @@
; Jump table ; Jump table
.word INSTALL .word SER_INSTALL
.word UNINSTALL .word SER_UNINSTALL
.word OPEN .word SER_OPEN
.word CLOSE .word SER_CLOSE
.word GET .word SER_GET
.word PUT .word SER_PUT
.word STATUS .word SER_STATUS
.word IOCTL .word SER_IOCTL
.word IRQ .word SER_IRQ
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; ;
@@ -122,24 +122,24 @@ ParityTable:
.code .code
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; INSTALL routine. Is called after the driver is loaded into memory. If ; SER_INSTALL routine. Is called after the driver is loaded into memory. If
; possible, check if the hardware is present. ; possible, check if the hardware is present.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
; ;
; Since we don't have to manage the IRQ vector on the Plus/4, this is actually ; Since we don't have to manage the IRQ vector on the Plus/4, this is actually
; the same as: ; the same as:
; ;
; UNINSTALL routine. Is called before the driver is removed from memory. ; SER_UNINSTALL routine. Is called before the driver is removed from memory.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
; and: ; and:
; ;
; CLOSE: Close the port, disable interrupts and flush the buffer. Called ; SER_CLOSE: Close the port, disable interrupts and flush the buffer. Called
; without parameters. Must return an error code in a/x. ; without parameters. Must return an error code in a/x.
; ;
INSTALL: SER_INSTALL:
UNINSTALL: SER_UNINSTALL:
CLOSE: SER_CLOSE:
; Deactivate DTR and disable 6551 interrupts ; Deactivate DTR and disable 6551 interrupts
@@ -156,7 +156,7 @@ CLOSE:
; PARAMS routine. A pointer to a ser_params structure is passed in ptr1. ; PARAMS routine. A pointer to a ser_params structure is passed in ptr1.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
OPEN: SER_OPEN:
; Check if the handshake setting is valid ; Check if the handshake setting is valid
@@ -236,12 +236,13 @@ InvBaud:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; GET: Will fetch a character from the receive buffer and store it into the ; SER_GET: Will fetch a character from the receive buffer and store it into the
; variable pointer to by ptr1. If no data is available, SER_ERR_NO_DATA is ; variable pointer to by ptr1. If no data is available, SER_ERR_NO_DATA is
; return. ; return.
; ;
GET: ldx SendFreeCnt ; Send data if necessary SER_GET:
ldx SendFreeCnt ; Send data if necessary
inx ; X == $FF? inx ; X == $FF?
beq @L1 beq @L1
lda #$00 lda #$00
@@ -280,11 +281,11 @@ GET: ldx SendFreeCnt ; Send data if necessary
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; PUT: Output character in A. ; SER_PUT: Output character in A.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
PUT: SER_PUT:
; Try to send ; Try to send
@@ -314,11 +315,12 @@ PUT:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; STATUS: Return the status in the variable pointed to by ptr1. ; SER_STATUS: Return the status in the variable pointed to by ptr1.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
STATUS: lda #$0F SER_STATUS:
lda #$0F
sta IndReg sta IndReg
ldy #ACIA::STATUS ldy #ACIA::STATUS
lda (acia),y lda (acia),y
@@ -330,23 +332,25 @@ STATUS: lda #$0F
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl ; SER_IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
; specific data in ptr1, and the ioctl code in A. ; specific data in ptr1, and the ioctl code in A.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
IOCTL: lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now SER_IOCTL:
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
ldx #>SER_ERR_INV_IOCTL ldx #>SER_ERR_INV_IOCTL
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All ; SER_IRQ: Called from the builtin runtime IRQ handler as a subroutine. All
; registers are already save, no parameters are passed, but the carry flag ; registers are already save, no parameters are passed, but the carry flag
; is clear on entry. The routine must return with carry set if the interrupt ; is clear on entry. The routine must return with carry set if the interrupt
; was handled, otherwise with carry clear. ; was handled, otherwise with carry clear.
; ;
IRQ: lda #$0F SER_IRQ:
lda #$0F
sta IndReg ; Switch to the system bank sta IndReg ; Switch to the system bank
ldy #ACIA::STATUS ldy #ACIA::STATUS
lda (acia),y ; Check ACIA status for receive interrupt lda (acia),y ; Check ACIA status for receive interrupt
@@ -435,4 +439,3 @@ write: pha
lda ExecReg lda ExecReg
sta IndReg sta IndReg
rts rts

View File

@@ -46,15 +46,15 @@
; Jump table ; Jump table
.word INSTALL .word SER_INSTALL
.word UNINSTALL .word SER_UNINSTALL
.word OPEN .word SER_OPEN
.word CLOSE .word SER_CLOSE
.word GET .word SER_GET
.word PUT .word SER_PUT
.word STATUS .word SER_STATUS
.word IOCTL .word SER_IOCTL
.word IRQ .word SER_IRQ
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; ;
@@ -122,25 +122,25 @@ ParityTable:
.code .code
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; INSTALL routine. Is called after the driver is loaded into memory. If ; SER_INSTALL routine. Is called after the driver is loaded into memory. If
; possible, check if the hardware is present. ; possible, check if the hardware is present.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
; ;
; Since we don't have to manage the IRQ vector on the Plus/4, this is actually ; Since we don't have to manage the IRQ vector on the Plus/4, this is actually
; the same as: ; the same as:
; ;
; UNINSTALL routine. Is called before the driver is removed from memory. ; SER_UNINSTALL routine. Is called before the driver is removed from memory.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
; ;
; and: ; and:
; ;
; CLOSE: Close the port, disable interrupts and flush the buffer. Called ; SER_CLOSE: Close the port, disable interrupts and flush the buffer. Called
; without parameters. Must return an error code in a/x. ; without parameters. Must return an error code in a/x.
; ;
INSTALL: SER_INSTALL:
UNINSTALL: SER_UNINSTALL:
CLOSE: SER_CLOSE:
; Deactivate DTR and disable 6551 interrupts ; Deactivate DTR and disable 6551 interrupts
@@ -157,7 +157,7 @@ CLOSE:
; PARAMS routine. A pointer to a ser_params structure is passed in ptr1. ; PARAMS routine. A pointer to a ser_params structure is passed in ptr1.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
OPEN: SER_OPEN:
; Check if the handshake setting is valid ; Check if the handshake setting is valid
@@ -237,12 +237,13 @@ InvBaud:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; GET: Will fetch a character from the receive buffer and store it into the ; SER_GET: Will fetch a character from the receive buffer and store it into the
; variable pointer to by ptr1. If no data is available, SER_ERR_NO_DATA is ; variable pointer to by ptr1. If no data is available, SER_ERR_NO_DATA is
; return. ; return.
; ;
GET: ldx SendFreeCnt ; Send data if necessary SER_GET:
ldx SendFreeCnt ; Send data if necessary
inx ; X == $FF? inx ; X == $FF?
beq @L1 beq @L1
lda #$00 lda #$00
@@ -281,11 +282,11 @@ GET: ldx SendFreeCnt ; Send data if necessary
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; PUT: Output character in A. ; SER_PUT: Output character in A.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
PUT: SER_PUT:
; Try to send ; Try to send
@@ -315,11 +316,12 @@ PUT:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; STATUS: Return the status in the variable pointed to by ptr1. ; SER_STATUS: Return the status in the variable pointed to by ptr1.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
STATUS: lda #$0F SER_STATUS:
lda #$0F
sta IndReg sta IndReg
ldy #ACIA::STATUS ldy #ACIA::STATUS
lda (acia),y lda (acia),y
@@ -331,23 +333,25 @@ STATUS: lda #$0F
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl ; SER_IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
; specific data in ptr1, and the ioctl code in A. ; specific data in ptr1, and the ioctl code in A.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
IOCTL: lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now SER_IOCTL:
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
ldx #>SER_ERR_INV_IOCTL ldx #>SER_ERR_INV_IOCTL
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All ; SER_IRQ: Called from the builtin runtime IRQ handler as a subroutine. All
; registers are already save, no parameters are passed, but the carry flag ; registers are already save, no parameters are passed, but the carry flag
; is clear on entry. The routine must return with carry set if the interrupt ; is clear on entry. The routine must return with carry set if the interrupt
; was handled, otherwise with carry clear. ; was handled, otherwise with carry clear.
; ;
IRQ: lda #$0F SER_IRQ:
lda #$0F
sta IndReg ; Switch to the system bank sta IndReg ; Switch to the system bank
ldy #ACIA::STATUS ldy #ACIA::STATUS
lda (acia),y ; Check ACIA status for receive interrupt lda (acia),y ; Check ACIA status for receive interrupt
@@ -436,4 +440,3 @@ write: pha
lda ExecReg lda ExecReg
sta IndReg sta IndReg
rts rts

View File

@@ -18,12 +18,15 @@
.importzp sreg, ptr1, tmp1 .importzp sreg, ptr1, tmp1
_div: jsr tosdivax ; Division-operator does most of the work _div: jsr tosdivax ; Division-operator does most of the work
lda sreg ; Unsigned remainder is in sreg
ldx sreg+1 ldy sreg ; low byte remainder from sreg
ldy ptr1 ; transfer quotient to sreg sta sreg ; store low byte quotient to sreg
sty sreg
ldy ptr1+1 lda sreg+1 ; high byte remainder from sreg
sty sreg+1 stx sreg+1 ; store high byte quotient to sreg
tax ; high byte remainder to x
tya ; low byte remainder to a
; Adjust the sign of the remainder. ; Adjust the sign of the remainder.
; It must be the same as the sign of the dividend. ; It must be the same as the sign of the dividend.
@@ -33,4 +36,3 @@ _div: jsr tosdivax ; Division-operator does most of the work
jmp negax ; Result is negative, adjust the sign jmp negax ; Result is negative, adjust the sign
Pos: rts Pos: rts

View File

@@ -3,7 +3,7 @@
; ;
; unsigned char getcpu (void); ; unsigned char getcpu (void);
; ;
.include "zeropage.inc"
.export _getcpu .export _getcpu
; --------------------------------------------------------------------------- ; ---------------------------------------------------------------------------
@@ -17,6 +17,7 @@
; - carry set and 5 in A for a 65CE02 ; - carry set and 5 in A for a 65CE02
; - carry set and 6 in A for a HuC6280 ; - carry set and 6 in A for a HuC6280
; - carry clear and 7 in A for a 2a03/2a07 ; - carry clear and 7 in A for a 2a03/2a07
; - carry set and 8 in A for a 45GS02
; ;
; This function uses a $1A opcode which is a INA on the 816 and ignored ; This function uses a $1A opcode which is a INA on the 816 and ignored
; (interpreted as a NOP) on a NMOS 6502. There are several CMOS versions ; (interpreted as a NOP) on a NMOS 6502. There are several CMOS versions
@@ -26,52 +27,95 @@
.p816 ; Enable 65816 instructions .p816 ; Enable 65816 instructions
_getcpu: _getcpu:
lda #0 lda #0
inc a ; .byte $1A ; nop on nmos, inc on every cmos inc a ; .byte $1A ; nop on nmos, inc on every cmos
cmp #1 cmp #1
bcc @L8 bcc @IsNMOS
; This is at least a 65C02, check for a 65CE02/4510 ; This is at least a 65C02, check for a 65CE02/4510
.byte $42,$EA ; neg on 65CE02/4510, nop #$EA on 65C02, wdm $EA on 65816 .byte $42,$EA ; neg on 65CE02/4510, nop #$EA on 65C02, wdm $EA on 65816
cmp #1 cmp #1
beq @L6 beq @HasINCA
; This is at least a 65CE02, check for 4510 ; This is at least a 65CE02, check for 4510
lda #5 ; CPU_65CE02 constant lda #5 ; CPU_65CE02 constant
ldx #0 ; to make sure MAP doesn't do anything, the upper nybl of X and Z must be clear
.byte $5C ; map on 4510, aug on 65CE02 (acts like 4 byte nop) .byte $5C ; map on 4510, aug on 65CE02 (acts like 4 byte nop)
lda #3 ; CPU_4510 constant lda #3 ; CPU_4510 constant
nop nop
bne @L9 cmp #5
beq @LoadXAndReturn
; It is either a 4510 (C65) or a 45GS02 (MEGA65)
; 45GS02 supports 32-bit ZP indirect, so use that to check CPU type
; without requiring a functioning MEGA65 hypervisor.
; We setup a read of $200xx, then store a different value in $xx
; and then re-read $200xx to see if it is unchanged.
; Setup 32-bit pointer to $00020000+tmp1
lda #<$020000+tmp1
sta regsave
lda #>$020000+tmp1
sta regsave+1
sta regsave+3 ; also write to upper byte of pointer to save an extra LDA #$00
lda #^$020000+tmp1
sta regsave+2
; Prefixing LDA ($nn),Z with a NOP uses 32-bit ZP pointer on 45GS02,
; but normal 16-bit ZP pointer on 4510
; (We assume Z=$00, which will be the normal case)
nop ; prefix to tell next instruction to be 32-bit ZP
.byte $b2,regsave ; LDA (regsave),Z
eor #$ff ; change the value
sta tmp1 ; store in $xx
; now try again to load it: If the same, then 45GS02, as $200xx is unchanged
nop ; prefix to tell next instruction to be 32-bit ZP
.byte $b2,regsave ; LDA (regsave),Z
cmp tmp1 ; does the loaded value match what is in $xx?
bne @Is45GS02 ; $200xx and $xx have different values, so must be a MEGA65 45GS02
@Is4510:
lda #3 ; CPU_4510 constant
ldx #0 ; load high byte of word
rts
@Is45GS02:
lda #8 ; CPU_45GS02 constant
ldx #0 ; load high byte of word
rts
; 6502 type of cpu, check for a 2a03/2a07 ; 6502 type of cpu, check for a 2a03/2a07
@L8: @IsNMOS:
sed ; set decimal mode, no decimal mode on the 2a03/2a07 sed ; set decimal mode, no decimal mode on the 2a03/2a07
lda #9 lda #9
clc clc
adc #1 ; $01+$09 = $10 on 6502, $01+$09 = $0A on 2a03/2a07 adc #1 ; $01+$09 = $10 on 6502, $01+$09 = $0A on 2a03/2a07
cld cld
cmp #$0a cmp #$0a
beq @L5 beq @Is2a03
lda #0 ; CPU_6502 constant lda #0 ; CPU_6502 constant
beq @L9 beq @LoadXAndReturn
@L5: @Is2a03:
lda #7 ; CPU_2A0x constant lda #7 ; CPU_2A0x constant
bne @L9 bne @LoadXAndReturn
; 65C02 cpu type, check for HuC6280 ; 65C02 cpu type, check for HuC6280
@L4: ldx #6 ; CPU_HUC6280 constant @CheckHuC6280:
ldx #6 ; CPU_HUC6280 constant
.byte $22,$EA ; sax nop on HuC6280 (A=$06, X=$01), nop #$EA on 65C02 (A=$01, X=$06) .byte $22,$EA ; sax nop on HuC6280 (A=$06, X=$01), nop #$EA on 65C02 (A=$01, X=$06)
bne @L9 bne @LoadXAndReturn
; Check for 65816/65802 ; Check for 65816/65802
@L6: xba ; .byte $EB, put $01 in B accu (nop on 65C02/65SC02) @HasINCA:
xba ; .byte $EB, put $01 in B accu (nop on 65C02/65SC02)
dec a ; .byte $3A, A=$00 dec a ; .byte $3A, A=$00
xba ; .byte $EB, A=$01 if 65816/65802 and A=$00 if 65C02/65SC02 xba ; .byte $EB, A=$01 if 65816/65802 and A=$00 if 65C02/65SC02
inc a ; .byte $1A, A=$02 if 65816/65802 and A=$01 if 65C02/65SC02 inc a ; .byte $1A, A=$02 if 65816/65802 and A=$01 if 65C02/65SC02
cmp #2 cmp #2
beq @L9 beq @LoadXAndReturn
; check for 65SC02 ; check for 65SC02
@@ -82,9 +126,8 @@ _getcpu:
ldx $F7 ldx $F7
sty $F7 sty $F7
cpx #$00 cpx #$00
bne @L4 bne @CheckHuC6280
lda #4 ; CPU_65SC02 constant lda #4 ; CPU_65SC02 constant
@LoadXAndReturn:
@L9: ldx #0 ; Load high byte of word ldx #0
rts rts

View File

@@ -0,0 +1,18 @@
;
; Scott Hutter
;
; 18.12.18
; void SetNewMode(void);
.export _SetNewMode
.include "jumptab.inc"
.include "geossym.inc"
_SetNewMode:
lda graphMode
eor #$80
sta graphMode
jmp SetNewMode

View File

@@ -1062,7 +1062,7 @@ SndSetValues:
ldx #4-1 ldx #4-1
set0: ldy SndOffsets,x set0: ldy SndOffsets,x
lda SndChannel+2,y lda SndChannel+2,y
_IFNE ; flag == 0 => don`t set _IFNE ; flag == 0 => don't set
bit #$80 bit #$80
_IFNE ; _IFNE ;

View File

@@ -25,15 +25,15 @@
.addr $0000 .addr $0000
; Jump table ; Jump table
.addr INSTALL .addr SER_INSTALL
.addr UNINSTALL .addr SER_UNINSTALL
.addr OPEN .addr SER_OPEN
.addr CLOSE .addr SER_CLOSE
.addr GET .addr SER_GET
.addr PUT .addr SER_PUT
.addr STATUS .addr SER_STATUS
.addr IOCTL .addr SER_IOCTL
.addr IRQ .addr SER_IRQ
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; Global variables ; Global variables
@@ -54,25 +54,25 @@ TxDone: .res 1
.code .code
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; INSTALL: Is called after the driver is loaded into memory. ; SER_INSTALL: Is called after the driver is loaded into memory.
; ;
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
INSTALL: SER_INSTALL:
; Set up IRQ vector ? ; Set up IRQ vector ?
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; UNINSTALL: Is called before the driver is removed from memory. ; SER_UNINSTALL: Is called before the driver is removed from memory.
; No return code required (the driver is removed from memory on return). ; No return code required (the driver is removed from memory on return).
; ;
UNINSTALL: SER_UNINSTALL:
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; CLOSE: Close the port and disable interrupts. Called without parameters. ; SER_CLOSE: Close the port and disable interrupts. Called without parameters.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
CLOSE: SER_CLOSE:
; Disable interrupts ; Disable interrupts
; Done, return an error code ; Done, return an error code
lda #<SER_ERR_OK lda #<SER_ERR_OK
@@ -80,7 +80,7 @@ CLOSE:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; OPEN: A pointer to a ser_params structure is passed in ptr1. ; SER_OPEN: A pointer to a ser_params structure is passed in ptr1.
; ;
; The Lynx has only two correct serial data formats: ; The Lynx has only two correct serial data formats:
; 8 bits, parity mark, 1 stop bit ; 8 bits, parity mark, 1 stop bit
@@ -101,7 +101,7 @@ CLOSE:
; ;
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
OPEN: SER_OPEN:
stz RxPtrIn stz RxPtrIn
stz RxPtrOut stz RxPtrOut
stz TxPtrIn stz TxPtrIn
@@ -247,11 +247,11 @@ invparameter:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; GET: Will fetch a character from the receive buffer and store it into the ; SER_GET: Will fetch a character from the receive buffer and store it into the
; variable pointed to by ptr1. If no data is available, SER_ERR_NO_DATA is ; variable pointed to by ptr1. If no data is available, SER_ERR_NO_DATA is
; returned. ; returned.
GET: SER_GET:
lda RxPtrIn lda RxPtrIn
cmp RxPtrOut cmp RxPtrOut
bne GetByte bne GetByte
@@ -268,10 +268,10 @@ GetByte:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; PUT: Output character in A. ; SER_PUT: Output character in A.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
PUT: SER_PUT:
tax tax
lda TxPtrIn lda TxPtrIn
ina ina
@@ -301,10 +301,10 @@ PutByte:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; STATUS: Return the status in the variable pointed to by ptr1. ; SER_STATUS: Return the status in the variable pointed to by ptr1.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
STATUS: SER_STATUS:
ldy SerialStat ldy SerialStat
ldx #$00 ldx #$00
sta (ptr1,x) sta (ptr1,x)
@@ -312,17 +312,17 @@ STATUS:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl ; SER_IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
; specific data in ptr1, and the ioctl code in A. ; specific data in ptr1, and the ioctl code in A.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
IOCTL: SER_IOCTL:
lda #<SER_ERR_INV_IOCTL lda #<SER_ERR_INV_IOCTL
ldx #>SER_ERR_INV_IOCTL ldx #>SER_ERR_INV_IOCTL
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All ; SER_IRQ: Called from the builtin runtime IRQ handler as a subroutine. All
; registers are already saved, no parameters are passed, but the carry flag ; 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 ; is clear on entry. The routine must return with carry set if the interrupt
; was handled, otherwise with carry clear. ; was handled, otherwise with carry clear.
@@ -330,7 +330,7 @@ IOCTL:
; Both the Tx and Rx interrupts are level sensitive instead of edge sensitive. ; Both the Tx and Rx interrupts are level sensitive instead of edge sensitive.
; Due to this bug you have to disable the interrupt before clearing it. ; Due to this bug you have to disable the interrupt before clearing it.
IRQ: SER_IRQ:
lda INTSET ; Poll all pending interrupts lda INTSET ; Poll all pending interrupts
and #SERIAL_INTERRUPT and #SERIAL_INTERRUPT
bne @L0 bne @L0
@@ -411,4 +411,3 @@ IRQ:
@IRQexit: @IRQexit:
clc clc
rts rts

View File

@@ -7,6 +7,7 @@
.export _cgetc .export _cgetc
.import cursor .import cursor
.include "cbm_kernal.inc"
.include "plus4.inc" .include "plus4.inc"
; -------------------------------------------------------------------------- ; --------------------------------------------------------------------------

View File

@@ -6,6 +6,7 @@
.export _clrscr .export _clrscr
.include "cbm_kernal.inc"
.include "plus4.inc" .include "plus4.inc"
.segment "LOWCODE" ; Must go into low memory .segment "LOWCODE" ; Must go into low memory
@@ -16,9 +17,3 @@
sta ENABLE_RAM ; Switch back to RAM sta ENABLE_RAM ; Switch back to RAM
rts ; Return to caller rts ; Return to caller
.endproc .endproc

View File

@@ -45,15 +45,15 @@
; Jump table ; Jump table
.word INSTALL .word SER_INSTALL
.word UNINSTALL .word SER_UNINSTALL
.word OPEN .word SER_OPEN
.word CLOSE .word SER_CLOSE
.word GET .word SER_GET
.word PUT .word SER_PUT
.word STATUS .word SER_STATUS
.word IOCTL .word SER_IOCTL
.word IRQ .word SER_IRQ
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; I/O definitions ; I/O definitions
@@ -130,25 +130,25 @@ ParityTable:
.code .code
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; INSTALL routine. Is called after the driver is loaded into memory. If ; SER_INSTALL routine. Is called after the driver is loaded into memory. If
; possible, check if the hardware is present. ; possible, check if the hardware is present.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
; ;
; Since we don't have to manage the IRQ vector on the Plus/4, this is actually ; Since we don't have to manage the IRQ vector on the Plus/4, this is actually
; the same as: ; the same as:
; ;
; UNINSTALL routine. Is called before the driver is removed from memory. ; SER_UNINSTALL routine. Is called before the driver is removed from memory.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
; ;
; and: ; and:
; ;
; CLOSE: Close the port, disable interrupts and flush the buffer. Called ; SER_CLOSE: Close the port, disable interrupts and flush the buffer. Called
; without parameters. Must return an error code in a/x. ; without parameters. Must return an error code in a/x.
; ;
INSTALL: SER_INSTALL:
UNINSTALL: SER_UNINSTALL:
CLOSE: SER_CLOSE:
; Deactivate DTR and disable 6551 interrupts ; Deactivate DTR and disable 6551 interrupts
@@ -165,7 +165,7 @@ CLOSE:
; PARAMS routine. A pointer to a ser_params structure is passed in ptr1. ; PARAMS routine. A pointer to a ser_params structure is passed in ptr1.
; Must return an SER_ERR_xx code in a/x. ; Must return an SER_ERR_xx code in a/x.
OPEN: SER_OPEN:
; Check if the handshake setting is valid ; Check if the handshake setting is valid
@@ -244,12 +244,13 @@ InvBaud:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; GET: Will fetch a character from the receive buffer and store it into the ; SER_GET: Will fetch a character from the receive buffer and store it into the
; variable pointer to by ptr1. If no data is available, SER_ERR_NO_DATA is ; variable pointer to by ptr1. If no data is available, SER_ERR_NO_DATA is
; return. ; return.
; ;
GET: ldx SendFreeCnt ; Send data if necessary SER_GET:
ldx SendFreeCnt ; Send data if necessary
inx ; X == $FF? inx ; X == $FF?
beq @L1 beq @L1
lda #$00 lda #$00
@@ -288,11 +289,11 @@ GET: ldx SendFreeCnt ; Send data if necessary
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; PUT: Output character in A. ; SER_PUT: Output character in A.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
PUT: SER_PUT:
; Try to send ; Try to send
@@ -322,34 +323,37 @@ PUT:
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; STATUS: Return the status in the variable pointed to by ptr1. ; SER_STATUS: Return the status in the variable pointed to by ptr1.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
STATUS: lda ACIA_STATUS SER_STATUS:
lda ACIA_STATUS
ldx #0 ldx #0
sta (ptr1,x) sta (ptr1,x)
txa ; SER_ERR_OK txa ; SER_ERR_OK
rts rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl ; SER_IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
; specific data in ptr1, and the ioctl code in A. ; specific data in ptr1, and the ioctl code in A.
; Must return an error code in a/x. ; Must return an error code in a/x.
; ;
IOCTL: lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now SER_IOCTL:
lda #<SER_ERR_INV_IOCTL ; We don't support ioclts for now
ldx #>SER_ERR_INV_IOCTL ldx #>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 ; SER_IRQ: Called from the builtin runtime IRQ handler as a subroutine. All
; registers are already save, no parameters are passed, but the carry flag ; registers are already save, no parameters are passed, but the carry flag
; is clear on entry. The routine must return with carry set if the interrupt ; is clear on entry. The routine must return with carry set if the interrupt
; was handled, otherwise with carry clear. ; was handled, otherwise with carry clear.
; ;
IRQ: lda ACIA_STATUS ; Check ACIA status for receive interrupt SER_IRQ:
lda ACIA_STATUS ; Check ACIA status for receive interrupt
and #$08 and #$08
beq @L9 ; Jump if no ACIA interrupt (carry still clear) beq @L9 ; Jump if no ACIA interrupt (carry still clear)
lda ACIA_DATA ; Get byte from ACIA lda ACIA_DATA ; Get byte from ACIA
@@ -405,5 +409,3 @@ IRQ: lda ACIA_STATUS ; Check ACIA status for receive interrupt
jmp @L0 jmp @L0
.endproc .endproc

View File

@@ -7,6 +7,7 @@
.export _cgetc .export _cgetc
.import cursor .import cursor
.include "cbm_kernal.inc"
.include "vic20.inc" .include "vic20.inc"
_cgetc: lda KEY_COUNT ; Get number of characters _cgetc: lda KEY_COUNT ; Get number of characters

View File

@@ -6,9 +6,6 @@
.export _clrscr .export _clrscr
.include "vic20.inc" .include "cbm_kernal.inc"
_clrscr = CLRSCR _clrscr = CLRSCR

View File

@@ -296,7 +296,7 @@ INSTALL = install
samplesdir = $(PREFIX)/share/cc65/samples samplesdir = $(PREFIX)/share/cc65/samples
install: install:
$(if $(PREFIX),,$(error variable `PREFIX' must be set)) $(if $(PREFIX),,$(error variable "PREFIX" must be set))
$(INSTALL) -d $(DESTDIR)$(samplesdir) $(INSTALL) -d $(DESTDIR)$(samplesdir)
$(INSTALL) -d $(DESTDIR)$(samplesdir)/geos $(INSTALL) -d $(DESTDIR)$(samplesdir)/geos
$(INSTALL) -d $(DESTDIR)$(samplesdir)/tutorial $(INSTALL) -d $(DESTDIR)$(samplesdir)/tutorial

View File

@@ -107,7 +107,7 @@ $(RM) /usr/local/bin/$(prog)
endef # UNAVAIL_recipe endef # UNAVAIL_recipe
install: install:
$(if $(PREFIX),,$(error variable `PREFIX' must be set)) $(if $(PREFIX),,$(error variable "PREFIX" must be set))
$(INSTALL) -d $(DESTDIR)$(bindir) $(INSTALL) -d $(DESTDIR)$(bindir)
$(INSTALL) ../bin/* $(DESTDIR)$(bindir) $(INSTALL) ../bin/* $(DESTDIR)$(bindir)

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@@ -14,16 +14,17 @@
<ProjectGuid>{5E8C19C6-B167-440C-8BEF-3CBF109CDB49}</ProjectGuid> <ProjectGuid>{5E8C19C6-B167-440C-8BEF-3CBF109CDB49}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>ar65</RootNamespace> <RootNamespace>ar65</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">

View File

@@ -113,8 +113,8 @@ void ExpInsert (const char* Name, const ObjData* Module)
while (1) { while (1) {
if (strcmp (L->Name, Name) == 0) { if (strcmp (L->Name, Name) == 0) {
/* Duplicate entry */ /* Duplicate entry */
Warning ("External symbol `%s' in module `%s', library `%s', " Warning ("External symbol '%s' in module '%s', library '%s', "
"is duplicated in module `%s'", "is duplicated in module '%s'",
Name, L->Module->Name, LibName, Module->Name); Name, L->Module->Name, LibName, Module->Name);
} }
if (L->Next == 0) { if (L->Next == 0) {

View File

@@ -95,11 +95,11 @@ static void ReadHeader (void)
/* Read the header fields, checking magic and version */ /* Read the header fields, checking magic and version */
Header.Magic = Read32 (Lib); Header.Magic = Read32 (Lib);
if (Header.Magic != LIB_MAGIC) { 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); Header.Version = Read16 (Lib);
if (Header.Version != LIB_VERSION) { if (Header.Version != LIB_VERSION) {
Error ("Wrong data version in `%s'", LibName); Error ("Wrong data version in '%s'", LibName);
} }
Header.Flags = Read16 (Lib); Header.Flags = Read16 (Lib);
Header.IndexOffs = Read32 (Lib); Header.IndexOffs = Read32 (Lib);
@@ -229,11 +229,11 @@ void LibOpen (const char* Name, int MustExist, int NeedTemp)
/* File does not exist */ /* File does not exist */
if (MustExist) { if (MustExist) {
Error ("Library `%s' does not exist", Name); Error ("Library '%s' does not exist", Name);
} else { } else {
/* Announce the library's creation if ar65 is verbose. */ /* Announce the library's creation if ar65 is verbose. */
Print (stdout, 1, Print (stdout, 1,
"%s: Library `%s' will be created.\n", ProgName, Name); "%s: Library '%s' will be created.\n", ProgName, Name);
} }
} else { } else {
@@ -317,7 +317,7 @@ static void LibCheckExports (ObjData* O)
unsigned I; unsigned I;
/* Let the user know what we do */ /* Let the user know what we do */
Print (stdout, 2, "Module `%s' (%u exports):\n", O->Name, CollCount (&O->Exports)); Print (stdout, 2, "Module '%s' (%u exports):\n", O->Name, CollCount (&O->Exports));
/* Insert the exports into the global table */ /* Insert the exports into the global table */
for (I = 0; I < CollCount (&O->Exports); ++I) { for (I = 0; I < CollCount (&O->Exports); ++I) {
@@ -381,7 +381,7 @@ void LibClose (void)
/* Reopen the library and truncate it */ /* Reopen the library and truncate it */
Lib = fopen (LibName, "wb"); Lib = fopen (LibName, "wb");
if (Lib == 0) { if (Lib == 0) {
Error ("Cannot open library `%s' for writing: %s", Error ("Cannot open library '%s' for writing: %s",
LibName, strerror (errno)); LibName, strerror (errno));
} }
@@ -389,14 +389,14 @@ void LibClose (void)
fseek (NewLib, 0, SEEK_SET); fseek (NewLib, 0, SEEK_SET);
while ((Count = fread (Buf, 1, sizeof (Buf), NewLib)) != 0) { while ((Count = fread (Buf, 1, sizeof (Buf), NewLib)) != 0) {
if (fwrite (Buf, 1, Count, Lib) != Count) { if (fwrite (Buf, 1, Count, Lib) != Count) {
Error ("Cannot write to `%s': %s", LibName, strerror (errno)); Error ("Cannot write to '%s': %s", LibName, strerror (errno));
} }
} }
} }
/* Close both files */ /* Close both files */
if (Lib && fclose (Lib) != 0) { 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) { if (NewLib && fclose (NewLib) != 0) {
Error ("Problem closing temporary library file: %s", strerror (errno)); Error ("Problem closing temporary library file: %s", strerror (errno));

View File

@@ -165,5 +165,5 @@ void DelObjData (const char* Module)
} }
/* Not found! */ /* Not found! */
Warning ("Module `%s' not found in library `%s'", Module, LibName); Warning ("Module '%s' not found in library '%s'", Module, LibName);
} }

View File

@@ -68,7 +68,7 @@ static const char* GetModule (const char* Name)
/* Must not end with a path separator */ /* Must not end with a path separator */
if (*Module == 0) { if (*Module == 0) {
Error ("Cannot make module name from `%s'", Name); Error ("Cannot make module name from '%s'", Name);
} }
/* Done */ /* Done */
@@ -82,11 +82,11 @@ static void ObjReadHeader (FILE* Obj, ObjHeader* H, const char* Name)
{ {
H->Magic = Read32 (Obj); H->Magic = Read32 (Obj);
if (H->Magic != OBJ_MAGIC) { 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) { 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->OptionOffs = Read32 (Obj);
@@ -236,7 +236,7 @@ void ObjAdd (const char* Name)
/* Open the object file */ /* Open the object file */
FILE* Obj = fopen (Name, "rb"); FILE* Obj = fopen (Name, "rb");
if (Obj == 0) { 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's a race condition /* Get the modification time of the object file. There's a race condition
@@ -248,7 +248,7 @@ void ObjAdd (const char* Name)
** here. ** here.
*/ */
if (FileStat (Name, &StatBuf) != 0) { 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 */ /* Read and check the header */
@@ -267,7 +267,7 @@ void ObjAdd (const char* Name)
** and the external one. ** and the external one.
*/ */
if (difftime ((time_t)O->MTime, StatBuf.st_mtime) > 0.0) { if (difftime ((time_t)O->MTime, StatBuf.st_mtime) > 0.0) {
Warning ("Replacing module `%s' by older version in library `%s'", Warning ("Replacing module '%s' by older version in library '%s'",
O->Name, LibName); O->Name, LibName);
} }
@@ -313,13 +313,13 @@ void ObjExtract (const char* Name)
/* Bail out if the module does not exist */ /* Bail out if the module does not exist */
if (O == 0) { 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 */ /* Open the output file */
Obj = fopen (Name, "w+b"); Obj = fopen (Name, "w+b");
if (Obj == 0) { 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 /* Copy the complete object file data from the library to the new object
@@ -329,11 +329,11 @@ void ObjExtract (const char* Name)
/* Close the file */ /* Close the file */
if (fclose (Obj) != 0) { 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 */ /* Set access and modification time */
if (SetFileTimes (Name, O->MTime) != 0) { 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));
} }
} }

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@@ -14,16 +14,17 @@
<ProjectGuid>{D28CB737-E6CA-49C4-8CE9-FF05F86DD4EC}</ProjectGuid> <ProjectGuid>{D28CB737-E6CA-49C4-8CE9-FF05F86DD4EC}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>ca65</RootNamespace> <RootNamespace>ca65</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">

View File

@@ -468,7 +468,7 @@ void DbgInfoCheck (void)
/* Search for the symbol name */ /* Search for the symbol name */
S->Sym = SymFindAny (S->Scope, GetStrBuf (S->AsmName)); S->Sym = SymFindAny (S->Scope, GetStrBuf (S->AsmName));
if (S->Sym == 0) { if (S->Sym == 0) {
PError (&S->Pos, "Assembler symbol `%s' not found", PError (&S->Pos, "Assembler symbol '%s' not found",
GetString (S->AsmName)); GetString (S->AsmName));
} else { } else {
/* Set the backlink */ /* Set the backlink */

View File

@@ -133,7 +133,7 @@ void GetEA (EffAddr* A)
A->AddrModeSet = AM65_STACK_REL_IND_Y; A->AddrModeSet = AM65_STACK_REL_IND_Y;
Consume (IndirectLeave, IndirectExpect); Consume (IndirectLeave, IndirectExpect);
ConsumeComma (); ConsumeComma ();
Consume (TOK_Y, "`Y' expected"); Consume (TOK_Y, "'Y' expected");
} else { } else {
Error ("Syntax error"); Error ("Syntax error");
} }
@@ -152,7 +152,7 @@ void GetEA (EffAddr* A)
A->AddrModeSet = AM65_DIR_IND; A->AddrModeSet = AM65_DIR_IND;
break; break;
default: default:
Consume (TOK_Y, "`Y' expected"); Consume (TOK_Y, "'Y' expected");
A->AddrModeSet = AM65_DIR_IND_Y; A->AddrModeSet = AM65_DIR_IND_Y;
break; break;
} }
@@ -173,7 +173,7 @@ void GetEA (EffAddr* A)
if (CurTok.Tok == TOK_COMMA) { if (CurTok.Tok == TOK_COMMA) {
/* [dir],y */ /* [dir],y */
NextTok (); NextTok ();
Consume (TOK_Y, "`Y' expected"); Consume (TOK_Y, "'Y' expected");
A->AddrModeSet = AM65_DIR_IND_LONG_Y; A->AddrModeSet = AM65_DIR_IND_LONG_Y;
} else { } else {
/* [dir] */ /* [dir] */

View File

@@ -146,7 +146,7 @@ void DoEnum (void)
} }
/* End of enum definition */ /* End of enum definition */
Consume (TOK_ENDENUM, "`.ENDENUM' expected"); Consume (TOK_ENDENUM, "'.ENDENUM' expected");
/* Free the base expression */ /* Free the base expression */
FreeExpr (BaseExpr); FreeExpr (BaseExpr);

View File

@@ -699,7 +699,7 @@ static ExprNode* FuncAddrSize (void)
/* Cheap local symbol */ /* Cheap local symbol */
Sym = SymFindLocal (SymLast, &CurTok.SVal, SYM_FIND_EXISTING); Sym = SymFindLocal (SymLast, &CurTok.SVal, SYM_FIND_EXISTING);
if (Sym == 0) { if (Sym == 0) {
Error ("Unknown symbol or scope: `%m%p'", &CurTok.SVal); Error ("Unknown symbol or scope: '%m%p'", &CurTok.SVal);
} else { } else {
AddrSize = Sym->AddrSize; AddrSize = Sym->AddrSize;
} }
@@ -739,13 +739,13 @@ static ExprNode* FuncAddrSize (void)
if (Sym) { if (Sym) {
AddrSize = Sym->AddrSize; AddrSize = Sym->AddrSize;
} else { } else {
Error ("Unknown symbol or scope: `%m%p%m%p'", &ScopeName, &Name); Error ("Unknown symbol or scope: '%m%p%m%p'", &ScopeName, &Name);
} }
} }
if (AddrSize == 0) { if (AddrSize == 0) {
Warning (1, "Unknown address size: `%m%p%m%p'", &ScopeName, &Name); Warning (1, "Unknown address size: '%m%p%m%p'", &ScopeName, &Name);
} }
/* Free the string buffers */ /* Free the string buffers */
@@ -780,7 +780,7 @@ static ExprNode* FuncSizeOf (void)
/* Cheap local symbol */ /* Cheap local symbol */
Sym = SymFindLocal (SymLast, &CurTok.SVal, SYM_FIND_EXISTING); Sym = SymFindLocal (SymLast, &CurTok.SVal, SYM_FIND_EXISTING);
if (Sym == 0) { if (Sym == 0) {
Error ("Unknown symbol or scope: `%m%p'", &CurTok.SVal); Error ("Unknown symbol or scope: '%m%p'", &CurTok.SVal);
} else { } else {
SizeSym = GetSizeOfSymbol (Sym); SizeSym = GetSizeOfSymbol (Sym);
} }
@@ -832,7 +832,7 @@ static ExprNode* FuncSizeOf (void)
if (Sym) { if (Sym) {
SizeSym = GetSizeOfSymbol (Sym); SizeSym = GetSizeOfSymbol (Sym);
} else { } else {
Error ("Unknown symbol or scope: `%m%p%m%p'", Error ("Unknown symbol or scope: '%m%p%m%p'",
&ScopeName, &Name); &ScopeName, &Name);
} }
} }
@@ -840,7 +840,7 @@ static ExprNode* FuncSizeOf (void)
/* Check if we have a size */ /* Check if we have a size */
if (SizeSym == 0 || !SymIsConst (SizeSym, &Size)) { if (SizeSym == 0 || !SymIsConst (SizeSym, &Size)) {
Error ("Size of `%m%p%m%p' is unknown", &ScopeName, &Name); Error ("Size of '%m%p%m%p' is unknown", &ScopeName, &Name);
Size = 0; Size = 0;
} }

View File

@@ -65,6 +65,7 @@ static const char* const FeatureKeys[FEAT_COUNT] = {
"underline_in_numbers", "underline_in_numbers",
"addrsize", "addrsize",
"bracket_as_indirect", "bracket_as_indirect",
"string_escapes",
}; };
@@ -123,6 +124,7 @@ feature_t SetFeature (const StrBuf* Key)
case FEAT_UNDERLINE_IN_NUMBERS: UnderlineInNumbers= 1; break; case FEAT_UNDERLINE_IN_NUMBERS: UnderlineInNumbers= 1; break;
case FEAT_ADDRSIZE: AddrSize = 1; break; case FEAT_ADDRSIZE: AddrSize = 1; break;
case FEAT_BRACKET_AS_INDIRECT: BracketAsIndirect = 1; break; case FEAT_BRACKET_AS_INDIRECT: BracketAsIndirect = 1; break;
case FEAT_STRING_ESCAPES: StringEscapes = 1; break;
default: /* Keep gcc silent */ break; default: /* Keep gcc silent */ break;
} }

View File

@@ -67,6 +67,7 @@ typedef enum {
FEAT_UNDERLINE_IN_NUMBERS, FEAT_UNDERLINE_IN_NUMBERS,
FEAT_ADDRSIZE, FEAT_ADDRSIZE,
FEAT_BRACKET_AS_INDIRECT, FEAT_BRACKET_AS_INDIRECT,
FEAT_STRING_ESCAPES,
/* Special value: Number of features available */ /* Special value: Number of features available */
FEAT_COUNT FEAT_COUNT

View File

@@ -211,7 +211,7 @@ unsigned GetFileIndex (const StrBuf* Name)
/* If we don't have this index, print a diagnostic and use the main file */ /* If we don't have this index, print a diagnostic and use the main file */
if (F == 0) { if (F == 0) {
Error ("File name `%m%p' not found in file table", Name); Error ("File name '%m%p' not found in file table", Name);
return 0; return 0;
} else { } else {
return F->Index; return F->Index;
@@ -316,7 +316,7 @@ static void CreateDepFile (const char* Name, FileType Types)
/* Open the file */ /* Open the file */
FILE* F = fopen (Name, "w"); FILE* F = fopen (Name, "w");
if (F == 0) { 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 */ /* Print the output file followed by a tab char */

View File

@@ -66,6 +66,7 @@ unsigned char DbgSyms = 0; /* Add debug symbols */
unsigned char LineCont = 0; /* Allow line continuation */ unsigned char LineCont = 0; /* Allow line continuation */
unsigned char LargeAlignment = 0; /* Don't warn about large alignments */ unsigned char LargeAlignment = 0; /* Don't warn about large alignments */
unsigned char RelaxChecks = 0; /* Relax a few assembler checks */ unsigned char RelaxChecks = 0; /* Relax a few assembler checks */
unsigned char StringEscapes = 0; /* Allow C-style escapes in strings */
/* Emulation features */ /* Emulation features */
unsigned char DollarIsPC = 0; /* Allow the $ symbol as current PC */ unsigned char DollarIsPC = 0; /* Allow the $ symbol as current PC */
@@ -84,4 +85,3 @@ unsigned char ForceRange = 0; /* Force values into expected range */
unsigned char UnderlineInNumbers = 0; /* Allow underlines in numbers */ unsigned char UnderlineInNumbers = 0; /* Allow underlines in numbers */
unsigned char AddrSize = 0; /* Allow .ADDRSIZE function */ unsigned char AddrSize = 0; /* Allow .ADDRSIZE function */
unsigned char BracketAsIndirect = 0; /* Use '[]' not '()' for indirection */ unsigned char BracketAsIndirect = 0; /* Use '[]' not '()' for indirection */

View File

@@ -68,6 +68,7 @@ extern unsigned char DbgSyms; /* Add debug symbols */
extern unsigned char LineCont; /* Allow line continuation */ extern unsigned char LineCont; /* Allow line continuation */
extern unsigned char LargeAlignment; /* Don't warn about large alignments */ extern unsigned char LargeAlignment; /* Don't warn about large alignments */
extern unsigned char RelaxChecks; /* Relax a few assembler checks */ extern unsigned char RelaxChecks; /* Relax a few assembler checks */
extern unsigned char StringEscapes; /* Allow C-style escapes in strings */
/* Emulation features */ /* Emulation features */
extern unsigned char DollarIsPC; /* Allow the $ symbol as current PC */ extern unsigned char DollarIsPC; /* Allow the $ symbol as current PC */

View File

@@ -304,7 +304,7 @@ void CreateListing (void)
/* Open the real listing file */ /* Open the real listing file */
F = fopen (SB_GetConstBuf (&ListingName), "w"); F = fopen (SB_GetConstBuf (&ListingName), "w");
if (F == 0) { if (F == 0) {
Fatal ("Cannot open listing file `%s': %s", Fatal ("Cannot open listing file '%s': %s",
SB_GetConstBuf (&ListingName), SB_GetConstBuf (&ListingName),
strerror (errno)); strerror (errno));
} }

View File

@@ -375,7 +375,7 @@ static void MacSkipDef (unsigned Style)
if (CurTok.Tok != TOK_EOF) { if (CurTok.Tok != TOK_EOF) {
SkipUntilSep (); SkipUntilSep ();
} else { } else {
Error ("`.ENDMACRO' expected"); Error ("'.ENDMACRO' expected");
} }
} else { } else {
/* Skip until end of line */ /* Skip until end of line */
@@ -409,7 +409,7 @@ void MacDef (unsigned Style)
/* Did we already define that macro? */ /* Did we already define that macro? */
if (HT_Find (&MacroTab, &CurTok.SVal) != 0) { if (HT_Find (&MacroTab, &CurTok.SVal) != 0) {
/* Macro is already defined */ /* Macro is already defined */
Error ("A macro named `%m%p' is already defined", &CurTok.SVal); Error ("A macro named '%m%p' is already defined", &CurTok.SVal);
/* Skip tokens until we reach the final .endmacro */ /* Skip tokens until we reach the final .endmacro */
MacSkipDef (Style); MacSkipDef (Style);
return; return;
@@ -451,7 +451,7 @@ void MacDef (unsigned Style)
IdDesc* List = M->Params; IdDesc* List = M->Params;
while (1) { while (1) {
if (SB_Compare (&List->Id, &CurTok.SVal) == 0) { if (SB_Compare (&List->Id, &CurTok.SVal) == 0) {
Error ("Duplicate symbol `%m%p'", &CurTok.SVal); Error ("Duplicate symbol '%m%p'", &CurTok.SVal);
} }
if (List->Next == 0) { if (List->Next == 0) {
break; break;
@@ -500,7 +500,7 @@ void MacDef (unsigned Style)
} }
/* May not have end of file in a macro definition */ /* May not have end of file in a macro definition */
if (CurTok.Tok == TOK_EOF) { if (CurTok.Tok == TOK_EOF) {
Error ("`.ENDMACRO' expected"); Error ("'.ENDMACRO' expected");
goto Done; goto Done;
} }
} else { } else {
@@ -930,7 +930,7 @@ static void StartExpDefine (MacExp* E)
if (CurTok.Tok == TOK_COMMA) { if (CurTok.Tok == TOK_COMMA) {
NextTok (); NextTok ();
} else { } else {
Error ("`,' expected"); Error ("',' expected");
} }
} }
} }

View File

@@ -168,7 +168,7 @@ static void NewSymbol (const char* SymName, long Val)
/* Check if have already a symbol with this name */ /* Check if have already a symbol with this name */
if (SymIsDef (Sym)) { if (SymIsDef (Sym)) {
AbEnd ("`%s' is already defined", SymName); AbEnd ("'%s' is already defined", SymName);
} }
/* Generate an expression for the symbol */ /* Generate an expression for the symbol */
@@ -201,7 +201,7 @@ static void SetSys (const char* Sys)
break; break;
case TGT_MODULE: case TGT_MODULE:
AbEnd ("Cannot use `module' as a target for the assembler"); AbEnd ("Cannot use 'module' as a target for the assembler");
break; break;
case TGT_ATARI2600: case TGT_ATARI2600:
@@ -331,7 +331,7 @@ static void SetSys (const char* Sys)
break; break;
default: default:
AbEnd ("Invalid target name: `%s'", Sys); AbEnd ("Invalid target name: '%s'", Sys);
} }
@@ -346,7 +346,7 @@ static void FileNameOption (const char* Opt, const char* Arg, StrBuf* Name)
{ {
/* Cannot have the option twice */ /* Cannot have the option twice */
if (SB_NotEmpty (Name)) { if (SB_NotEmpty (Name)) {
AbEnd ("Cannot use option `%s' twice", Opt); AbEnd ("Cannot use option '%s' twice", Opt);
} }
/* Remember the file name for later */ /* Remember the file name for later */
SB_CopyStr (Name, Arg); SB_CopyStr (Name, Arg);
@@ -427,7 +427,7 @@ static void OptCPU (const char* Opt attribute ((unused)), const char* Arg)
{ {
cpu_t CPU = FindCPU (Arg); cpu_t CPU = FindCPU (Arg);
if (CPU == CPU_UNKNOWN) { if (CPU == CPU_UNKNOWN) {
AbEnd ("Invalid CPU: `%s'", Arg); AbEnd ("Invalid CPU: '%s'", Arg);
} else { } else {
SetCPU (CPU); SetCPU (CPU);
} }
@@ -478,7 +478,7 @@ static void OptFeature (const char* Opt attribute ((unused)), const char* Arg)
/* Set the feature, check for errors */ /* Set the feature, check for errors */
if (SetFeature (SB_InitFromString (&Feature, Arg)) == FEAT_UNKNOWN) { if (SetFeature (SB_InitFromString (&Feature, Arg)) == FEAT_UNKNOWN) {
AbEnd ("Illegal emulation feature: `%s'", Arg); AbEnd ("Illegal emulation feature: '%s'", Arg);
} }
} }
@@ -533,7 +533,7 @@ static void OptListBytes (const char* Opt, const char* Arg)
/* Check the bounds */ /* Check the bounds */
if (Num != 0 && (Num < MIN_LIST_BYTES || Num > MAX_LIST_BYTES)) { if (Num != 0 && (Num < MIN_LIST_BYTES || Num > MAX_LIST_BYTES)) {
AbEnd ("Argument for option `%s' is out of range", Opt); AbEnd ("Argument for option '%s' is out of range", Opt);
} }
/* Use the value */ /* Use the value */
@@ -549,7 +549,7 @@ static void OptListing (const char* Opt, const char* Arg)
** the filename is empty or begins with the option char. ** the filename is empty or begins with the option char.
*/ */
if (Arg == 0 || *Arg == '\0' || *Arg == '-') { if (Arg == 0 || *Arg == '\0' || *Arg == '-') {
Fatal ("The meaning of `%s' has changed. It does now " Fatal ("The meaning of '%s' has changed. It does now "
"expect a file name as argument.", Opt); "expect a file name as argument.", Opt);
} }
@@ -566,7 +566,7 @@ static void OptMemoryModel (const char* Opt, const char* Arg)
/* Check the current memory model */ /* Check the current memory model */
if (MemoryModel != MMODEL_UNKNOWN) { if (MemoryModel != MMODEL_UNKNOWN) {
AbEnd ("Cannot use option `%s' twice", Opt); AbEnd ("Cannot use option '%s' twice", Opt);
} }
/* Translate the memory model name and check it */ /* Translate the memory model name and check it */
@@ -762,7 +762,7 @@ static void OneLine (void)
*/ */
if (CurTok.Tok != TOK_COLON) { if (CurTok.Tok != TOK_COLON) {
if (HadWS || !NoColonLabels) { if (HadWS || !NoColonLabels) {
Error ("`:' expected"); Error ("':' expected");
/* Try some smart error recovery */ /* Try some smart error recovery */
if (CurTok.Tok == TOK_NAMESPACE) { if (CurTok.Tok == TOK_NAMESPACE) {
NextTok (); NextTok ();
@@ -807,7 +807,7 @@ static void OneLine (void)
} else if (PCAssignment && (CurTok.Tok == TOK_STAR || CurTok.Tok == TOK_PC)) { } else if (PCAssignment && (CurTok.Tok == TOK_STAR || CurTok.Tok == TOK_PC)) {
NextTok (); NextTok ();
if (CurTok.Tok != TOK_EQ) { if (CurTok.Tok != TOK_EQ) {
Error ("`=' expected"); Error ("'=' expected");
SkipUntilSep (); SkipUntilSep ();
} else { } else {
/* Skip the equal sign */ /* Skip the equal sign */
@@ -1040,7 +1040,7 @@ int main (int argc, char* argv [])
} else { } else {
/* Filename. Check if we already had one */ /* Filename. Check if we already had one */
if (InFile) { if (InFile) {
fprintf (stderr, "%s: Don't know what to do with `%s'\n", fprintf (stderr, "%s: Don't know what to do with '%s'\n",
ProgName, Arg); ProgName, Arg);
exit (EXIT_FAILURE); exit (EXIT_FAILURE);
} else { } else {

View File

@@ -179,7 +179,7 @@ static void FuncConcat (void)
** by the string token just created. ** by the string token just created.
*/ */
if (CurTok.Tok != TOK_RPAREN) { if (CurTok.Tok != TOK_RPAREN) {
Error ("`)' expected"); Error ("')' expected");
} else { } else {
CurTok.Tok = TOK_STRCON; CurTok.Tok = TOK_STRCON;
SB_Copy (&CurTok.SVal, &Buf); SB_Copy (&CurTok.SVal, &Buf);
@@ -253,7 +253,7 @@ static void FuncIdent (void)
SB_Copy (&Buf, &CurTok.SVal); SB_Copy (&Buf, &CurTok.SVal);
NextTok (); NextTok ();
if (CurTok.Tok != TOK_RPAREN) { if (CurTok.Tok != TOK_RPAREN) {
Error ("`)' expected"); Error ("')' expected");
} else { } else {
CurTok.Tok = Id; CurTok.Tok = Id;
SB_Copy (&CurTok.SVal, &Buf); SB_Copy (&CurTok.SVal, &Buf);
@@ -600,7 +600,7 @@ static void FuncSPrintF (void)
** by the string token just created. ** by the string token just created.
*/ */
if (CurTok.Tok != TOK_RPAREN) { if (CurTok.Tok != TOK_RPAREN) {
Error ("`)' expected"); Error ("')' expected");
} else { } else {
CurTok.Tok = TOK_STRCON; CurTok.Tok = TOK_STRCON;
SB_Copy (&CurTok.SVal, &R); SB_Copy (&CurTok.SVal, &R);
@@ -660,7 +660,7 @@ static void FuncString (void)
** by the string token just created. ** by the string token just created.
*/ */
if (CurTok.Tok != TOK_RPAREN) { if (CurTok.Tok != TOK_RPAREN) {
Error ("`)' expected"); Error ("')' expected");
} else { } else {
CurTok.Tok = TOK_STRCON; CurTok.Tok = TOK_STRCON;
SB_Copy (&CurTok.SVal, &Buf); SB_Copy (&CurTok.SVal, &Buf);
@@ -754,7 +754,7 @@ void ConsumeSep (void)
void ConsumeLParen (void) void ConsumeLParen (void)
/* Consume a left paren */ /* Consume a left paren */
{ {
Consume (TOK_LPAREN, "`(' expected"); Consume (TOK_LPAREN, "'(' expected");
} }
@@ -762,7 +762,7 @@ void ConsumeLParen (void)
void ConsumeRParen (void) void ConsumeRParen (void)
/* Consume a right paren */ /* Consume a right paren */
{ {
Consume (TOK_RPAREN, "`)' expected"); Consume (TOK_RPAREN, "')' expected");
} }
@@ -770,7 +770,7 @@ void ConsumeRParen (void)
void ConsumeComma (void) void ConsumeComma (void)
/* Consume a comma */ /* Consume a comma */
{ {
Consume (TOK_COMMA, "`,' expected"); Consume (TOK_COMMA, "',' expected");
} }

View File

@@ -113,7 +113,7 @@ static void ObjWriteError (void)
remove (OutFile); remove (OutFile);
/* Now abort with a fatal error */ /* Now abort with a fatal error */
Fatal ("Cannot write to output file `%s': %s", OutFile, strerror (Error)); Fatal ("Cannot write to output file '%s': %s", OutFile, strerror (Error));
} }
@@ -170,7 +170,7 @@ void ObjOpen (void)
/* Create the output file */ /* Create the output file */
F = fopen (OutFile, "w+b"); F = fopen (OutFile, "w+b");
if (F == 0) { 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 */ /* Write a dummy header */

View File

@@ -167,13 +167,13 @@ static void SetBoolOption (unsigned char* Flag)
switch (GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0]))) { switch (GetSubKey (Keys, sizeof (Keys) / sizeof (Keys [0]))) {
case 0: *Flag = 0; NextTok (); break; case 0: *Flag = 0; NextTok (); break;
case 1: *Flag = 1; NextTok (); break; case 1: *Flag = 1; NextTok (); break;
default: ErrorSkip ("`on' or `off' expected"); break; default: ErrorSkip ("'on' or 'off' expected"); break;
} }
} else if (TokIsSep (CurTok.Tok)) { } else if (TokIsSep (CurTok.Tok)) {
/* Without anything assume switch on */ /* Without anything assume switch on */
*Flag = 1; *Flag = 1;
} else { } else {
ErrorSkip ("`on' or `off' expected"); ErrorSkip ("'on' or 'off' expected");
} }
} }
@@ -1017,7 +1017,7 @@ static void DoFeature (void)
/* Set the feature and check for errors */ /* Set the feature and check for errors */
if (SetFeature (&CurTok.SVal) == FEAT_UNKNOWN) { if (SetFeature (&CurTok.SVal) == FEAT_UNKNOWN) {
/* Not found */ /* Not found */
ErrorSkip ("Invalid feature: `%m%p'", &CurTok.SVal); ErrorSkip ("Invalid feature: '%m%p'", &CurTok.SVal);
return; return;
} else { } else {
/* Skip the keyword */ /* Skip the keyword */
@@ -1242,7 +1242,7 @@ static void DoIncBin (void)
char* PathName = SearchFile (BinSearchPath, SB_GetConstBuf (&Name)); char* PathName = SearchFile (BinSearchPath, SB_GetConstBuf (&Name));
if (PathName == 0 || (F = fopen (PathName, "rb")) == 0) { if (PathName == 0 || (F = fopen (PathName, "rb")) == 0) {
/* Not found or cannot open, print an error and bail out */ /* Not found or cannot open, print an error and bail out */
ErrorSkip ("Cannot open include file `%m%p': %s", &Name, strerror (errno)); ErrorSkip ("Cannot open include file '%m%p': %s", &Name, strerror (errno));
xfree (PathName); xfree (PathName);
goto ExitPoint; goto ExitPoint;
} }
@@ -1268,7 +1268,7 @@ static void DoIncBin (void)
*/ */
SB_Terminate (&Name); SB_Terminate (&Name);
if (FileStat (SB_GetConstBuf (&Name), &StatBuf) != 0) { if (FileStat (SB_GetConstBuf (&Name), &StatBuf) != 0) {
Fatal ("Cannot stat input file `%m%p': %s", &Name, strerror (errno)); Fatal ("Cannot stat input file '%m%p': %s", &Name, strerror (errno));
} }
/* Add the file to the input file table */ /* Add the file to the input file table */
@@ -1305,7 +1305,7 @@ static void DoIncBin (void)
size_t BytesRead = fread (Buf, 1, BytesToRead, F); size_t BytesRead = fread (Buf, 1, BytesToRead, F);
if (BytesToRead != BytesRead) { if (BytesToRead != BytesRead) {
/* Some sort of error */ /* Some sort of error */
ErrorSkip ("Cannot read from include file `%m%p': %s", ErrorSkip ("Cannot read from include file '%m%p': %s",
&Name, strerror (errno)); &Name, strerror (errno));
break; break;
} }
@@ -1896,7 +1896,7 @@ static void DoUnDef (void)
static void DoUnexpected (void) static void DoUnexpected (void)
/* Got an unexpected keyword */ /* Got an unexpected keyword */
{ {
Error ("Unexpected `%m%p'", &Keyword); Error ("Unexpected '%m%p'", &Keyword);
SkipUntilSep (); SkipUntilSep ();
} }

View File

@@ -501,7 +501,7 @@ int NewInputFile (const char* Name)
/* Main file */ /* Main file */
F = fopen (Name, "r"); F = fopen (Name, "r");
if (F == 0) { if (F == 0) {
Fatal ("Cannot open input file `%s': %s", Name, strerror (errno)); Fatal ("Cannot open input file '%s': %s", Name, strerror (errno));
} }
} else { } else {
/* We are on include level. Search for the file in the include /* We are on include level. Search for the file in the include
@@ -510,7 +510,7 @@ int NewInputFile (const char* Name)
PathName = SearchFile (IncSearchPath, Name); PathName = SearchFile (IncSearchPath, Name);
if (PathName == 0 || (F = fopen (PathName, "r")) == 0) { if (PathName == 0 || (F = fopen (PathName, "r")) == 0) {
/* Not found or cannot open, print an error and bail out */ /* Not found or cannot open, print an error and bail out */
Error ("Cannot open include file `%s': %s", Name, strerror (errno)); Error ("Cannot open include file '%s': %s", Name, strerror (errno));
goto ExitPoint; goto ExitPoint;
} }
@@ -527,7 +527,7 @@ int NewInputFile (const char* Name)
** here. ** here.
*/ */
if (FileStat (Name, &Buf) != 0) { if (FileStat (Name, &Buf) != 0) {
Fatal ("Cannot stat input file `%s': %s", Name, strerror (errno)); Fatal ("Cannot stat input file '%s': %s", Name, strerror (errno));
} }
/* Add the file to the input file table and remember the index */ /* Add the file to the input file table and remember the index */
@@ -794,6 +794,43 @@ static void ReadStringConst (int StringTerm)
break; break;
} }
if (C == '\\' && StringEscapes) {
NextChar ();
switch (C) {
case EOF:
Error ("Unterminated escape sequence in string constant");
break;
case '\\':
case '\'':
case '"':
break;
case 't':
C = '\x09';
break;
case 'r':
C = '\x0D';
break;
case 'n':
C = '\x0A';
break;
case 'x':
NextChar ();
if (IsXDigit (C)) {
char high_nibble = DigitVal (C) << 4;
NextChar ();
if (IsXDigit (C)) {
C = high_nibble | DigitVal (C);
break;
}
}
/* otherwise, fall through */
default:
Error ("Unsupported escape sequence in string constant");
break;
}
}
/* Append the char to the string */ /* Append the char to the string */
SB_AppendChar (&CurTok.SVal, C); SB_AppendChar (&CurTok.SVal, C);
@@ -1054,7 +1091,7 @@ Again:
/* Not found */ /* Not found */
if (!LeadingDotInIdents) { if (!LeadingDotInIdents) {
/* Invalid pseudo instruction */ /* Invalid pseudo instruction */
Error ("`%m%p' is not a recognized control command", &CurTok.SVal); Error ("'%m%p' is not a recognized control command", &CurTok.SVal);
goto Again; goto Again;
} }

View File

@@ -134,7 +134,7 @@ static Segment* NewSegment (const char* Name, unsigned char AddrSize)
/* Check the segment name for invalid names */ /* Check the segment name for invalid names */
if (!ValidSegName (Name)) { if (!ValidSegName (Name)) {
Error ("Illegal segment name: `%s'", Name); Error ("Illegal segment name: '%s'", Name);
} }
/* Create a new segment and return it */ /* Create a new segment and return it */

View File

@@ -261,9 +261,9 @@ static long DoStructInternal (long Offs, unsigned Type)
/* End of struct/union definition */ /* End of struct/union definition */
if (Type == STRUCT) { if (Type == STRUCT) {
Consume (TOK_ENDSTRUCT, "`.ENDSTRUCT' expected"); Consume (TOK_ENDSTRUCT, "'.ENDSTRUCT' expected");
} else { } else {
Consume (TOK_ENDUNION, "`.ENDUNION' expected"); Consume (TOK_ENDUNION, "'.ENDUNION' expected");
} }
/* Return the size of the struct */ /* Return the size of the struct */

View File

@@ -524,7 +524,7 @@ static void StudySymbol (ExprNode* Expr, ExprDesc* D)
if (SymHasUserMark (Sym)) { if (SymHasUserMark (Sym)) {
LIError (&Sym->DefLines, LIError (&Sym->DefLines,
"Circular reference in definition of symbol `%m%p'", "Circular reference in definition of symbol '%m%p'",
GetSymName (Sym)); GetSymName (Sym));
ED_SetError (D); ED_SetError (D);
} else { } else {

View File

@@ -95,7 +95,7 @@ SymTable* ParseScopedIdent (StrBuf* Name, StrBuf* FullName)
if (Scope == 0) { if (Scope == 0) {
/* Scope not found */ /* Scope not found */
SB_Terminate (FullName); SB_Terminate (FullName);
Error ("No such scope: `%m%p'", FullName); Error ("No such scope: '%m%p'", FullName);
return 0; return 0;
} }
@@ -139,7 +139,7 @@ SymTable* ParseScopedIdent (StrBuf* Name, StrBuf* FullName)
Scope = SymFindScope (Scope, Name, SYM_FIND_EXISTING); Scope = SymFindScope (Scope, Name, SYM_FIND_EXISTING);
if (Scope == 0) { if (Scope == 0) {
/* Scope not found */ /* Scope not found */
Error ("No such scope: `%m%p'", FullName); Error ("No such scope: '%m%p'", FullName);
return 0; return 0;
} }

View File

@@ -213,24 +213,24 @@ void SymDef (SymEntry* S, ExprNode* Expr, unsigned char AddrSize, unsigned Flags
{ {
if (S->Flags & SF_IMPORT) { if (S->Flags & SF_IMPORT) {
/* Defined symbol is marked as imported external symbol */ /* Defined symbol is marked as imported external symbol */
Error ("Symbol `%m%p' is already an import", GetSymName (S)); Error ("Symbol '%m%p' is already an import", GetSymName (S));
return; return;
} }
if ((Flags & SF_VAR) != 0 && (S->Flags & (SF_EXPORT | SF_GLOBAL))) { if ((Flags & SF_VAR) != 0 && (S->Flags & (SF_EXPORT | SF_GLOBAL))) {
/* Variable symbols cannot be exports or globals */ /* Variable symbols cannot be exports or globals */
Error ("Var symbol `%m%p' cannot be an export or global symbol", GetSymName (S)); Error ("Var symbol '%m%p' cannot be an export or global symbol", GetSymName (S));
return; return;
} }
if (S->Flags & SF_DEFINED) { 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) { if ((S->Flags & SF_VAR) == 0) {
Error ("Symbol `%m%p' is already defined", GetSymName (S)); Error ("Symbol '%m%p' is already defined", GetSymName (S));
S->Flags |= SF_MULTDEF; S->Flags |= SF_MULTDEF;
return; return;
} else { } else {
/* Redefinition must also be a variable symbol */ /* Redefinition must also be a variable symbol */
if ((Flags & SF_VAR) == 0) { if ((Flags & SF_VAR) == 0) {
Error ("Symbol `%m%p' is already different kind", GetSymName (S)); Error ("Symbol '%m%p' is already different kind", GetSymName (S));
return; return;
} }
/* Delete the current symbol expression, since it will get /* Delete the current symbol expression, since it will get
@@ -285,7 +285,7 @@ void SymDef (SymEntry* S, ExprNode* Expr, unsigned char AddrSize, unsigned Flags
S->ExportSize = S->AddrSize; S->ExportSize = S->AddrSize;
} else if (S->AddrSize > S->ExportSize) { } else if (S->AddrSize > S->ExportSize) {
/* We're exporting a symbol smaller than it actually is */ /* We're exporting a symbol smaller than it actually is */
Warning (1, "Symbol `%m%p' is %s but exported %s", Warning (1, "Symbol '%m%p' is %s but exported %s",
GetSymName (S), AddrSizeToStr (S->AddrSize), GetSymName (S), AddrSizeToStr (S->AddrSize),
AddrSizeToStr (S->ExportSize)); AddrSizeToStr (S->ExportSize));
} }
@@ -315,13 +315,13 @@ void SymImport (SymEntry* S, unsigned char AddrSize, unsigned Flags)
/* Mark the given symbol as an imported symbol */ /* Mark the given symbol as an imported symbol */
{ {
if (S->Flags & SF_DEFINED) { if (S->Flags & SF_DEFINED) {
Error ("Symbol `%m%p' is already defined", GetSymName (S)); Error ("Symbol '%m%p' is already defined", GetSymName (S));
S->Flags |= SF_MULTDEF; S->Flags |= SF_MULTDEF;
return; return;
} }
if (S->Flags & SF_EXPORT) { if (S->Flags & SF_EXPORT) {
/* The symbol is already marked as exported symbol */ /* The symbol is already marked as exported symbol */
Error ("Cannot import exported symbol `%m%p'", GetSymName (S)); Error ("Cannot import exported symbol '%m%p'", GetSymName (S));
return; return;
} }
@@ -337,16 +337,16 @@ void SymImport (SymEntry* S, unsigned char AddrSize, unsigned Flags)
*/ */
if (S->Flags & SF_IMPORT) { if (S->Flags & SF_IMPORT) {
if ((Flags & SF_FORCED) != (S->Flags & SF_FORCED)) { if ((Flags & SF_FORCED) != (S->Flags & SF_FORCED)) {
Error ("Redeclaration mismatch for symbol `%m%p'", GetSymName (S)); Error ("Redeclaration mismatch for symbol '%m%p'", GetSymName (S));
} }
if (AddrSize != S->AddrSize) { if (AddrSize != S->AddrSize) {
Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); Error ("Address size mismatch for symbol '%m%p'", GetSymName (S));
} }
} }
if (S->Flags & SF_GLOBAL) { if (S->Flags & SF_GLOBAL) {
S->Flags &= ~SF_GLOBAL; S->Flags &= ~SF_GLOBAL;
if (AddrSize != S->AddrSize) { if (AddrSize != S->AddrSize) {
Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); Error ("Address size mismatch for symbol '%m%p'", GetSymName (S));
} }
} }
@@ -369,12 +369,12 @@ void SymExport (SymEntry* S, unsigned char AddrSize, unsigned Flags)
/* Check if it's ok to export the symbol */ /* Check if it's ok to export the symbol */
if (S->Flags & SF_IMPORT) { if (S->Flags & SF_IMPORT) {
/* The symbol is already marked as imported external symbol */ /* The symbol is already marked as imported external symbol */
Error ("Symbol `%m%p' is already an import", GetSymName (S)); Error ("Symbol '%m%p' is already an import", GetSymName (S));
return; return;
} }
if (S->Flags & SF_VAR) { if (S->Flags & SF_VAR) {
/* Variable symbols cannot be exported */ /* Variable symbols cannot be exported */
Error ("Var symbol `%m%p' cannot be exported", GetSymName (S)); Error ("Var symbol '%m%p' cannot be exported", GetSymName (S));
return; return;
} }
@@ -383,7 +383,7 @@ void SymExport (SymEntry* S, unsigned char AddrSize, unsigned Flags)
*/ */
if (S->Flags & SF_GLOBAL) { if (S->Flags & SF_GLOBAL) {
if (AddrSize != S->ExportSize) { if (AddrSize != S->ExportSize) {
Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); Error ("Address size mismatch for symbol '%m%p'", GetSymName (S));
} }
S->Flags &= ~SF_GLOBAL; S->Flags &= ~SF_GLOBAL;
@@ -398,7 +398,7 @@ void SymExport (SymEntry* S, unsigned char AddrSize, unsigned Flags)
*/ */
if ((S->Flags & (SF_EXPORT|SF_DEFINED)) == SF_EXPORT) { if ((S->Flags & (SF_EXPORT|SF_DEFINED)) == SF_EXPORT) {
if (S->ExportSize != AddrSize) { if (S->ExportSize != AddrSize) {
Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); Error ("Address size mismatch for symbol '%m%p'", GetSymName (S));
} }
} }
S->ExportSize = AddrSize; S->ExportSize = AddrSize;
@@ -412,7 +412,7 @@ void SymExport (SymEntry* S, unsigned char AddrSize, unsigned Flags)
S->ExportSize = S->AddrSize; S->ExportSize = S->AddrSize;
} else if (S->AddrSize > S->ExportSize) { } else if (S->AddrSize > S->ExportSize) {
/* We're exporting a symbol smaller than it actually is */ /* We're exporting a symbol smaller than it actually is */
Warning (1, "Symbol `%m%p' is %s but exported %s", Warning (1, "Symbol '%m%p' is %s but exported %s",
GetSymName (S), AddrSizeToStr (S->AddrSize), GetSymName (S), AddrSizeToStr (S->AddrSize),
AddrSizeToStr (S->ExportSize)); AddrSizeToStr (S->ExportSize));
} }
@@ -434,7 +434,7 @@ void SymGlobal (SymEntry* S, unsigned char AddrSize, unsigned Flags)
{ {
if (S->Flags & SF_VAR) { if (S->Flags & SF_VAR) {
/* Variable symbols cannot be exported or imported */ /* Variable symbols cannot be exported or imported */
Error ("Var symbol `%m%p' cannot be made global", GetSymName (S)); Error ("Var symbol '%m%p' cannot be made global", GetSymName (S));
return; return;
} }
@@ -447,7 +447,7 @@ void SymGlobal (SymEntry* S, unsigned char AddrSize, unsigned Flags)
AddrSize = GetCurrentSegAddrSize (); AddrSize = GetCurrentSegAddrSize ();
} }
if (AddrSize != S->AddrSize) { if (AddrSize != S->AddrSize) {
Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); Error ("Address size mismatch for symbol '%m%p'", GetSymName (S));
} }
return; return;
} }
@@ -459,12 +459,12 @@ void SymGlobal (SymEntry* S, unsigned char AddrSize, unsigned Flags)
if ((S->Flags & SF_DEFINED) == 0) { if ((S->Flags & SF_DEFINED) == 0) {
/* Symbol is undefined */ /* Symbol is undefined */
if (AddrSize != S->ExportSize) { if (AddrSize != S->ExportSize) {
Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); Error ("Address size mismatch for symbol '%m%p'", GetSymName (S));
} }
} else if (AddrSize != ADDR_SIZE_DEFAULT) { } else if (AddrSize != ADDR_SIZE_DEFAULT) {
/* Symbol is defined and address size given */ /* Symbol is defined and address size given */
if (AddrSize != S->ExportSize) { if (AddrSize != S->ExportSize) {
Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); Error ("Address size mismatch for symbol '%m%p'", GetSymName (S));
} }
} }
return; return;
@@ -476,7 +476,7 @@ void SymGlobal (SymEntry* S, unsigned char AddrSize, unsigned Flags)
*/ */
if (S->Flags & SF_GLOBAL) { if (S->Flags & SF_GLOBAL) {
if (AddrSize != S->ExportSize) { if (AddrSize != S->ExportSize) {
Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); Error ("Address size mismatch for symbol '%m%p'", GetSymName (S));
} }
return; return;
} }
@@ -494,7 +494,7 @@ void SymGlobal (SymEntry* S, unsigned char AddrSize, unsigned Flags)
S->ExportSize = S->AddrSize; S->ExportSize = S->AddrSize;
} else if (S->AddrSize > S->ExportSize) { } else if (S->AddrSize > S->ExportSize) {
/* We're exporting a symbol smaller than it actually is */ /* We're exporting a symbol smaller than it actually is */
Warning (1, "Symbol `%m%p' is %s but exported %s", Warning (1, "Symbol '%m%p' is %s but exported %s",
GetSymName (S), AddrSizeToStr (S->AddrSize), GetSymName (S), AddrSizeToStr (S->AddrSize),
AddrSizeToStr (S->ExportSize)); AddrSizeToStr (S->ExportSize));
} }
@@ -537,12 +537,12 @@ void SymConDes (SymEntry* S, unsigned char AddrSize, unsigned Type, unsigned Pri
/* Check for errors */ /* Check for errors */
if (S->Flags & SF_IMPORT) { if (S->Flags & SF_IMPORT) {
/* The symbol is already marked as imported external symbol */ /* The symbol is already marked as imported external symbol */
Error ("Symbol `%m%p' is already an import", GetSymName (S)); Error ("Symbol '%m%p' is already an import", GetSymName (S));
return; return;
} }
if (S->Flags & SF_VAR) { if (S->Flags & SF_VAR) {
/* Variable symbols cannot be exported or imported */ /* Variable symbols cannot be exported or imported */
Error ("Var symbol `%m%p' cannot be exported", GetSymName (S)); Error ("Var symbol '%m%p' cannot be exported", GetSymName (S));
return; return;
} }
@@ -552,7 +552,7 @@ void SymConDes (SymEntry* S, unsigned char AddrSize, unsigned Type, unsigned Pri
*/ */
if (S->Flags & (SF_EXPORT | SF_GLOBAL)) { if (S->Flags & (SF_EXPORT | SF_GLOBAL)) {
if (S->ExportSize != AddrSize) { if (S->ExportSize != AddrSize) {
Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); Error ("Address size mismatch for symbol '%m%p'", GetSymName (S));
} }
S->Flags &= ~SF_GLOBAL; S->Flags &= ~SF_GLOBAL;
} }
@@ -566,7 +566,7 @@ void SymConDes (SymEntry* S, unsigned char AddrSize, unsigned Type, unsigned Pri
/* Use the real size of the symbol */ /* Use the real size of the symbol */
S->ExportSize = S->AddrSize; S->ExportSize = S->AddrSize;
} else if (S->AddrSize != S->ExportSize) { } else if (S->AddrSize != S->ExportSize) {
Error ("Address size mismatch for symbol `%m%p'", GetSymName (S)); Error ("Address size mismatch for symbol '%m%p'", GetSymName (S));
} }
} }
@@ -575,7 +575,7 @@ void SymConDes (SymEntry* S, unsigned char AddrSize, unsigned Type, unsigned Pri
*/ */
if (S->ConDesPrio[Type] != CD_PRIO_NONE) { if (S->ConDesPrio[Type] != CD_PRIO_NONE) {
if (S->ConDesPrio[Type] != Prio) { if (S->ConDesPrio[Type] != Prio) {
Error ("Redeclaration mismatch for symbol `%m%p'", GetSymName (S)); Error ("Redeclaration mismatch for symbol '%m%p'", GetSymName (S));
} }
} }
S->ConDesPrio[Type] = Prio; S->ConDesPrio[Type] = Prio;

View File

@@ -178,7 +178,7 @@ static SymTable* NewSymTable (SymTable* Parent, const StrBuf* Name)
} }
} else { } else {
/* Duplicate scope name */ /* Duplicate scope name */
Internal ("Duplicate scope name: `%m%p'", Name); Internal ("Duplicate scope name: '%m%p'", Name);
} }
} }
} }
@@ -216,7 +216,7 @@ void SymEnterLevel (const StrBuf* ScopeName, unsigned char Type,
/* Check if the scope has been defined before */ /* Check if the scope has been defined before */
if (CurrentScope->Flags & ST_DEFINED) { if (CurrentScope->Flags & ST_DEFINED) {
Error ("Duplicate scope `%m%p'", ScopeName); Error ("Duplicate scope '%m%p'", ScopeName);
} }
} else { } else {
@@ -502,7 +502,7 @@ static void SymCheckUndefined (SymEntry* S)
if (Sym->Flags & SF_IMPORT) { if (Sym->Flags & SF_IMPORT) {
/* The symbol is already marked as import */ /* The symbol is already marked as import */
LIError (&S->RefLines, LIError (&S->RefLines,
"Symbol `%s' is already an import", "Symbol '%s' is already an import",
GetString (Sym->Name)); GetString (Sym->Name));
} }
if ((Sym->Flags & SF_EXPORT) == 0) { if ((Sym->Flags & SF_EXPORT) == 0) {
@@ -516,7 +516,7 @@ static void SymCheckUndefined (SymEntry* S)
if (Sym->AddrSize > Sym->ExportSize) { if (Sym->AddrSize > Sym->ExportSize) {
/* We're exporting a symbol smaller than it actually is */ /* We're exporting a symbol smaller than it actually is */
LIWarning (&Sym->DefLines, 1, LIWarning (&Sym->DefLines, 1,
"Symbol `%m%p' is %s but exported %s", "Symbol '%m%p' is %s but exported %s",
GetSymName (Sym), GetSymName (Sym),
AddrSizeToStr (Sym->AddrSize), AddrSizeToStr (Sym->AddrSize),
AddrSizeToStr (Sym->ExportSize)); AddrSizeToStr (Sym->ExportSize));
@@ -541,7 +541,7 @@ static void SymCheckUndefined (SymEntry* S)
if (S->Flags & SF_EXPORT) { if (S->Flags & SF_EXPORT) {
/* We will not auto-import an export */ /* We will not auto-import an export */
LIError (&S->RefLines, LIError (&S->RefLines,
"Exported symbol `%m%p' was never defined", "Exported symbol '%m%p' was never defined",
GetSymName (S)); GetSymName (S));
} else { } else {
if (AutoImport) { if (AutoImport) {
@@ -554,7 +554,7 @@ static void SymCheckUndefined (SymEntry* S)
} else { } else {
/* Error */ /* Error */
LIError (&S->RefLines, LIError (&S->RefLines,
"Symbol `%m%p' is undefined", "Symbol '%m%p' is undefined",
GetSymName (S)); GetSymName (S));
} }
} }
@@ -616,7 +616,7 @@ void SymCheck (void)
ReleaseFullLineInfo (&S->RefLines); ReleaseFullLineInfo (&S->RefLines);
} else if ((S->Flags & SF_DEFINED) != 0 && (S->Flags & SF_REFERENCED) == 0) { } else if ((S->Flags & SF_DEFINED) != 0 && (S->Flags & SF_REFERENCED) == 0) {
LIWarning (&S->DefLines, 2, LIWarning (&S->DefLines, 2,
"Symbol `%m%p' is defined but never used", "Symbol '%m%p' is defined but never used",
GetSymName (S)); GetSymName (S));
} }
@@ -625,7 +625,7 @@ void SymCheck (void)
if ((S->Flags & (SF_REFERENCED | SF_FORCED)) == SF_NONE) { if ((S->Flags & (SF_REFERENCED | SF_FORCED)) == SF_NONE) {
/* Imported symbol is not referenced */ /* Imported symbol is not referenced */
LIWarning (&S->DefLines, 2, LIWarning (&S->DefLines, 2,
"Symbol `%m%p' is imported but never used", "Symbol '%m%p' is imported but never used",
GetSymName (S)); GetSymName (S));
} else { } else {
/* Give the import an id, count imports */ /* Give the import an id, count imports */
@@ -653,7 +653,7 @@ void SymCheck (void)
} else if (S->AddrSize > S->ExportSize) { } else if (S->AddrSize > S->ExportSize) {
/* We're exporting a symbol smaller than it actually is */ /* We're exporting a symbol smaller than it actually is */
LIWarning (&S->DefLines, 1, LIWarning (&S->DefLines, 1,
"Symbol `%m%p' is %s but exported %s", "Symbol '%m%p' is %s but exported %s",
GetSymName (S), GetSymName (S),
AddrSizeToStr (S->AddrSize), AddrSizeToStr (S->AddrSize),
AddrSizeToStr (S->ExportSize)); AddrSizeToStr (S->ExportSize));
@@ -673,7 +673,7 @@ void SymCheck (void)
const FilePos* P = S->GuessedUse[S->AddrSize - 1]; const FilePos* P = S->GuessedUse[S->AddrSize - 1];
if (P) { if (P) {
PWarning (P, 0, PWarning (P, 0,
"Didn't use %s addressing for `%m%p'", "Didn't use %s addressing for '%m%p'",
AddrSizeToStr (S->AddrSize), AddrSizeToStr (S->AddrSize),
GetSymName (S)); GetSymName (S));
} }

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration> <Configuration>Debug</Configuration>
@@ -14,16 +14,17 @@
<ProjectGuid>{B17EDBD5-DC04-4970-9CBD-56A98B6A3FCA}</ProjectGuid> <ProjectGuid>{B17EDBD5-DC04-4970-9CBD-56A98B6A3FCA}</ProjectGuid>
<Keyword>Win32Proj</Keyword> <Keyword>Win32Proj</Keyword>
<RootNamespace>cc65</RootNamespace> <RootNamespace>cc65</RootNamespace>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries> <UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries> <UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
<PlatformToolset>v140</PlatformToolset> <PlatformToolset>v141</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">

View File

@@ -102,7 +102,7 @@ static SymEntry* AsmGetSym (unsigned Arg, unsigned Type)
/* Did we find a symbol with this name? */ /* Did we find a symbol with this name? */
if (Sym == 0) { if (Sym == 0) {
Error ("Undefined symbol `%s' for argument %u", CurTok.Ident, Arg); Error ("Undefined symbol '%s' for argument %u", CurTok.Ident, Arg);
AsmErrorSkip (); AsmErrorSkip ();
return 0; return 0;
} }

View File

@@ -461,7 +461,7 @@ void GetFuncInfo (const char* Name, unsigned short* Use, unsigned short* Chg)
** use and change all registers. ** use and change all registers.
*/ */
if (Debug) { if (Debug) {
fprintf (stderr, "No info about internal function `%s'\n", Name); fprintf (stderr, "No info about internal function '%s'\n", Name);
} }
*Use = REG_ALL; *Use = REG_ALL;
*Chg = REG_ALL; *Chg = REG_ALL;

Some files were not shown because too many files have changed in this diff Show More