Merge branch 'master' into master
This commit is contained in:
@@ -93,7 +93,7 @@ INSTALL = install
|
||||
|
||||
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) -m0644 ../$(dir)/*.* $(DESTDIR)$(datadir)/$(dir)
|
||||
|
||||
|
||||
@@ -44,15 +44,15 @@
|
||||
.addr $0000
|
||||
|
||||
; Jump table
|
||||
.addr INSTALL
|
||||
.addr UNINSTALL
|
||||
.addr OPEN
|
||||
.addr CLOSE
|
||||
.addr GET
|
||||
.addr PUT
|
||||
.addr STATUS
|
||||
.addr IOCTL
|
||||
.addr IRQ
|
||||
.addr SER_INSTALL
|
||||
.addr SER_UNINSTALL
|
||||
.addr SER_OPEN
|
||||
.addr SER_CLOSE
|
||||
.addr SER_GET
|
||||
.addr SER_PUT
|
||||
.addr SER_STATUS
|
||||
.addr SER_IOCTL
|
||||
.addr SER_IRQ
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; I/O definitions
|
||||
@@ -141,23 +141,23 @@ IdTableLen = * - IdValTable
|
||||
.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.
|
||||
;
|
||||
; Since we don't have to manage the IRQ vector on the Apple II, this is
|
||||
; 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).
|
||||
;
|
||||
; 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.
|
||||
|
||||
INSTALL:
|
||||
UNINSTALL:
|
||||
CLOSE:
|
||||
SER_INSTALL:
|
||||
SER_UNINSTALL:
|
||||
SER_CLOSE:
|
||||
ldx Index ; Check for open port
|
||||
beq :+
|
||||
|
||||
@@ -172,16 +172,16 @@ CLOSE:
|
||||
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.
|
||||
|
||||
OPEN:
|
||||
SER_OPEN:
|
||||
ldx #<$C000
|
||||
stx ptr2
|
||||
lda #>$C000
|
||||
ora Slot
|
||||
sta ptr2+1
|
||||
|
||||
|
||||
; Check Pascal 1.1 Firmware Protocol ID bytes
|
||||
: ldy IdOfsTable,x
|
||||
lda IdValTable,x
|
||||
@@ -190,7 +190,7 @@ OPEN:
|
||||
inx
|
||||
cpx #IdTableLen
|
||||
bcc :-
|
||||
|
||||
|
||||
; Convert slot to I/O register index
|
||||
lda Slot
|
||||
asl
|
||||
@@ -273,11 +273,11 @@ InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
|
||||
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
|
||||
; returned.
|
||||
|
||||
GET:
|
||||
SER_GET:
|
||||
ldx Index
|
||||
ldy SendFreeCnt ; Send data if necessary
|
||||
iny ; Y == $FF?
|
||||
@@ -315,10 +315,10 @@ GET:
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; PUT: Output character in A.
|
||||
; SER_PUT: Output character in A.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
PUT:
|
||||
SER_PUT:
|
||||
ldx Index
|
||||
|
||||
; Try to send
|
||||
@@ -348,10 +348,10 @@ PUT:
|
||||
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.
|
||||
|
||||
STATUS:
|
||||
SER_STATUS:
|
||||
ldx Index
|
||||
lda ACIA_STATUS,x
|
||||
ldx #$00
|
||||
@@ -360,11 +360,11 @@ STATUS:
|
||||
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.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
IOCTL:
|
||||
SER_IOCTL:
|
||||
; Check data msb and code to be 0
|
||||
ora ptr1+1
|
||||
bne :+
|
||||
@@ -384,12 +384,12 @@ IOCTL:
|
||||
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
|
||||
; is clear on entry. The routine must return with carry set if the interrupt
|
||||
; was handled, otherwise with carry clear.
|
||||
|
||||
IRQ:
|
||||
SER_IRQ:
|
||||
ldx Index ; Check for open port
|
||||
beq Done
|
||||
lda ACIA_STATUS,x ; Check ACIA status for receive interrupt
|
||||
@@ -431,7 +431,7 @@ Again: lda SendFreeCnt
|
||||
lda ACIA_STATUS,x
|
||||
and #$10
|
||||
bne Send
|
||||
bit tmp1 ; Keep trying if must try hard
|
||||
bit tmp1 ; Keep trying if must try hard
|
||||
bmi Again
|
||||
Quit: rts
|
||||
|
||||
|
||||
@@ -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 cputc (char c);
|
||||
@@ -30,16 +30,13 @@ L4: cmp #$0A ; LF
|
||||
cmp #ATEOL ; Atari-EOL?
|
||||
beq newline
|
||||
|
||||
tay
|
||||
rol a
|
||||
rol a
|
||||
rol a
|
||||
rol a
|
||||
and #3
|
||||
tax
|
||||
tya
|
||||
and #$9f
|
||||
ora ataint,x
|
||||
asl a ; shift out the inverse bit
|
||||
adc #$c0 ; grab the inverse bit; convert ATASCII to screen code
|
||||
bpl codeok ; screen code ok?
|
||||
eor #$40 ; needs correction
|
||||
codeok: lsr a ; undo the shift
|
||||
bcc cputdirect
|
||||
eor #$80 ; restore the inverse bit
|
||||
|
||||
cputdirect: ; accepts screen code
|
||||
jsr putchar
|
||||
@@ -89,6 +86,3 @@ putchar:
|
||||
ldy COLCRS
|
||||
sta (ptr4),y
|
||||
jmp setcursor
|
||||
|
||||
.rodata
|
||||
ataint: .byte 64,0,32,96
|
||||
|
||||
@@ -1110,11 +1110,8 @@ skipm: ; Loop while --dy > 0
|
||||
|
||||
; locals
|
||||
string := tmp1
|
||||
cols := tmp3
|
||||
pixels := tmp4
|
||||
font := regsave
|
||||
.rodata
|
||||
ataint: .byte 64,0,32,96
|
||||
.bss
|
||||
rows: .res 1
|
||||
|
||||
@@ -1222,32 +1219,31 @@ scvert: ldx x1
|
||||
.endif
|
||||
|
||||
; Draw one character
|
||||
; Convert to ANTIC code
|
||||
draw: tay
|
||||
rol a
|
||||
rol a
|
||||
rol a
|
||||
rol a
|
||||
and #3
|
||||
tax
|
||||
tya
|
||||
and #$9f
|
||||
ora ataint,x
|
||||
; Save and clear inverse video bit
|
||||
sta inv
|
||||
and #$7F
|
||||
draw:
|
||||
; Extract the inverse mask
|
||||
ldx #0
|
||||
asl a
|
||||
bcc noinv
|
||||
dex
|
||||
noinv: stx inv
|
||||
|
||||
; 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
|
||||
lda #0
|
||||
sta font + 1
|
||||
stx font+1
|
||||
|
||||
.repeat 3
|
||||
asl font
|
||||
rol a
|
||||
.endrepeat
|
||||
|
||||
adc CHBAS
|
||||
sta font + 1
|
||||
; Save old coords
|
||||
bit text_dir
|
||||
bpl hor
|
||||
@@ -1273,15 +1269,12 @@ cont: ldy #7
|
||||
; Put one row of the glyph
|
||||
putrow: sty rows
|
||||
lda (font),y
|
||||
bit inv
|
||||
bpl noinv
|
||||
eor #$FF
|
||||
noinv: sta pixels
|
||||
lda #7
|
||||
sta cols
|
||||
eor inv
|
||||
sec
|
||||
rol a
|
||||
sta pixels
|
||||
; Put one column of the row
|
||||
putcol: asl pixels
|
||||
bcc next_col
|
||||
putcol: bcc next_col
|
||||
lda x1
|
||||
pha
|
||||
lda x1 + 1
|
||||
@@ -1317,8 +1310,8 @@ vertinc:
|
||||
sub mag_x
|
||||
sta y2
|
||||
L2:
|
||||
dec cols
|
||||
bpl putcol
|
||||
asl pixels
|
||||
bne putcol
|
||||
next_row:
|
||||
; Go to next row
|
||||
bit text_dir
|
||||
|
||||
@@ -44,15 +44,15 @@
|
||||
.addr $0000
|
||||
|
||||
; Jump table
|
||||
.addr INSTALL
|
||||
.addr UNINSTALL
|
||||
.addr OPEN
|
||||
.addr CLOSE
|
||||
.addr GET
|
||||
.addr PUT
|
||||
.addr SER_INSTALL
|
||||
.addr SER_UNINSTALL
|
||||
.addr SER_OPEN
|
||||
.addr SER_CLOSE
|
||||
.addr SER_GET
|
||||
.addr SER_PUT
|
||||
.addr SER_STATUS
|
||||
.addr IOCTL
|
||||
.addr IRQ
|
||||
.addr SER_IOCTL
|
||||
.addr SER_IRQ
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Global variables
|
||||
@@ -116,23 +116,23 @@ ParityTable:
|
||||
.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.
|
||||
;
|
||||
; Since we don't have to manage the IRQ vector on the Telestrat/Atmos, this is
|
||||
; 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).
|
||||
;
|
||||
; 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.
|
||||
|
||||
INSTALL:
|
||||
UNINSTALL:
|
||||
CLOSE:
|
||||
SER_INSTALL:
|
||||
SER_UNINSTALL:
|
||||
SER_CLOSE:
|
||||
ldx Index ; Check for open port
|
||||
beq :+
|
||||
|
||||
@@ -147,10 +147,10 @@ CLOSE:
|
||||
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.
|
||||
|
||||
OPEN:
|
||||
SER_OPEN:
|
||||
; Check if the handshake setting is valid
|
||||
ldy #SER_PARAMS::HANDSHAKE ; Handshake
|
||||
lda (ptr1),y
|
||||
@@ -220,11 +220,11 @@ InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
|
||||
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
|
||||
; returned.
|
||||
|
||||
GET:
|
||||
SER_GET:
|
||||
ldy SendFreeCnt ; Send data if necessary
|
||||
iny ; Y == $FF?
|
||||
beq :+
|
||||
@@ -261,10 +261,10 @@ GET:
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; PUT: Output character in A.
|
||||
; SER_PUT: Output character in A.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
PUT:
|
||||
SER_PUT:
|
||||
; Try to send
|
||||
ldy SendFreeCnt
|
||||
iny ; Y = $FF?
|
||||
@@ -303,22 +303,22 @@ SER_STATUS:
|
||||
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.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
IOCTL:
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
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
|
||||
; is clear on entry. The routine must return with carry set if the interrupt
|
||||
; was handled, otherwise with carry clear.
|
||||
|
||||
IRQ:
|
||||
SER_IRQ:
|
||||
ldx Index ; Check for open port
|
||||
beq Done
|
||||
lda ACIA::STATUS,x ; Check ACIA status for receive interrupt
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
.import cursor
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "c128.inc"
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
@@ -17,8 +18,8 @@
|
||||
_cgetc: lda KEY_COUNT ; Get number of characters
|
||||
bne L2 ; Jump if there are already chars waiting
|
||||
|
||||
; Switch on the cursor if needed. We MUST always switch the cursor on,
|
||||
; before switching it off, because switching it off will restore the
|
||||
; Switch on the cursor if needed. We MUST always switch the cursor on,
|
||||
; before switching it off, because switching it off will restore the
|
||||
; character attribute remembered when it was switched on. So just switching
|
||||
; it off will restore the wrong character attribute.
|
||||
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
|
||||
.export _clrscr
|
||||
|
||||
.include "c128.inc"
|
||||
.include "cbm_kernal.inc"
|
||||
|
||||
_clrscr = CLRSCR
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
.import gotoxy
|
||||
.import PLOT
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "c128.inc"
|
||||
|
||||
newline = NEWLINE
|
||||
@@ -85,4 +85,3 @@ plot: ldy CURS_X
|
||||
; position in Y
|
||||
|
||||
putchar = $CC2F
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
.constructor initmainargs, 24
|
||||
.import __argc, __argv
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "c128.inc"
|
||||
|
||||
|
||||
|
||||
@@ -45,15 +45,15 @@
|
||||
|
||||
; Jump table
|
||||
|
||||
.word INSTALL
|
||||
.word UNINSTALL
|
||||
.word OPEN
|
||||
.word CLOSE
|
||||
.word GET
|
||||
.word PUT
|
||||
.word STATUS
|
||||
.word IOCTL
|
||||
.word IRQ
|
||||
.word SER_INSTALL
|
||||
.word SER_UNINSTALL
|
||||
.word SER_OPEN
|
||||
.word SER_CLOSE
|
||||
.word SER_GET
|
||||
.word SER_PUT
|
||||
.word SER_STATUS
|
||||
.word SER_IOCTL
|
||||
.word SER_IRQ
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; I/O definitions
|
||||
@@ -155,11 +155,11 @@ Vector := *+1
|
||||
.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.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
INSTALL:
|
||||
SER_INSTALL:
|
||||
|
||||
; Deactivate DTR and disable 6551 interrupts
|
||||
|
||||
@@ -192,10 +192,10 @@ SetNMI: sta NMIVec
|
||||
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.
|
||||
|
||||
UNINSTALL:
|
||||
SER_UNINSTALL:
|
||||
|
||||
; Stop interrupts, drop DTR
|
||||
|
||||
@@ -212,7 +212,7 @@ UNINSTALL:
|
||||
; PARAMS routine. A pointer to a ser_params structure is passed in ptr1.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
OPEN:
|
||||
SER_OPEN:
|
||||
|
||||
; Check if the handshake setting is valid
|
||||
|
||||
@@ -283,11 +283,11 @@ InvBaud:
|
||||
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.
|
||||
;
|
||||
|
||||
CLOSE:
|
||||
SER_CLOSE:
|
||||
|
||||
; Stop interrupts, drop DTR
|
||||
|
||||
@@ -305,12 +305,13 @@ CLOSE:
|
||||
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
|
||||
; return.
|
||||
;
|
||||
|
||||
GET: ldx SendFreeCnt ; Send data if necessary
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
@@ -349,11 +350,11 @@ GET: ldx SendFreeCnt ; Send data if necessary
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; PUT: Output character in A.
|
||||
; SER_PUT: Output character in A.
|
||||
; Must return an error code in a/x.
|
||||
;
|
||||
|
||||
PUT:
|
||||
SER_PUT:
|
||||
|
||||
; Try to send
|
||||
|
||||
@@ -383,23 +384,25 @@ PUT:
|
||||
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.
|
||||
;
|
||||
|
||||
STATUS: lda ACIA_STATUS
|
||||
SER_STATUS:
|
||||
lda ACIA_STATUS
|
||||
ldx #0
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
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.
|
||||
; 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
|
||||
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 = $0000
|
||||
SER_IRQ = $0000
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
;
|
||||
@@ -500,5 +503,3 @@ InitBuffers:
|
||||
stx RecvFreeCnt
|
||||
stx SendFreeCnt
|
||||
rts
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
.export _cgetc
|
||||
.import cursor
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "plus4.inc"
|
||||
|
||||
|
||||
|
||||
@@ -6,10 +6,6 @@
|
||||
|
||||
.export _clrscr
|
||||
|
||||
.include "plus4.inc"
|
||||
.include "cbm_kernal.inc"
|
||||
|
||||
_clrscr = CLRSCR
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
.export _cgetc
|
||||
.import cursor
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "c64.inc"
|
||||
|
||||
_cgetc: lda KEY_COUNT ; Get number of characters
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
|
||||
.export _clrscr
|
||||
|
||||
.include "c64.inc"
|
||||
.include "cbm_kernal.inc"
|
||||
|
||||
_clrscr = CLRSCR
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
.include "zeropage.inc"
|
||||
.include "ser-kernel.inc"
|
||||
.include "ser-error.inc"
|
||||
.include "cbm_kernal.inc"
|
||||
.include "c64.inc"
|
||||
|
||||
.macpack module
|
||||
@@ -45,15 +46,15 @@
|
||||
|
||||
; Jump table
|
||||
|
||||
.word INSTALL
|
||||
.word UNINSTALL
|
||||
.word OPEN
|
||||
.word CLOSE
|
||||
.word GET
|
||||
.word PUT
|
||||
.word STATUS
|
||||
.word IOCTL
|
||||
.word IRQ
|
||||
.word SER_INSTALL
|
||||
.word SER_UNINSTALL
|
||||
.word SER_OPEN
|
||||
.word SER_CLOSE
|
||||
.word SER_GET
|
||||
.word SER_PUT
|
||||
.word SER_STATUS
|
||||
.word SER_IOCTL
|
||||
.word SER_IRQ
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; I/O definitions
|
||||
@@ -136,11 +137,11 @@ ParityTable:
|
||||
.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.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
INSTALL:
|
||||
SER_INSTALL:
|
||||
|
||||
; Deactivate DTR and disable 6551 interrupts
|
||||
|
||||
@@ -165,10 +166,10 @@ SetNMI: sta NMIVec
|
||||
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.
|
||||
|
||||
UNINSTALL:
|
||||
SER_UNINSTALL:
|
||||
|
||||
; Stop interrupts, drop DTR
|
||||
|
||||
@@ -185,7 +186,7 @@ UNINSTALL:
|
||||
; PARAMS routine. A pointer to a ser_params structure is passed in ptr1.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
OPEN:
|
||||
SER_OPEN:
|
||||
|
||||
; Check if the handshake setting is valid
|
||||
|
||||
@@ -256,11 +257,11 @@ InvBaud:
|
||||
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.
|
||||
;
|
||||
|
||||
CLOSE:
|
||||
SER_CLOSE:
|
||||
|
||||
; Stop interrupts, drop DTR
|
||||
|
||||
@@ -278,12 +279,13 @@ CLOSE:
|
||||
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
|
||||
; return.
|
||||
;
|
||||
|
||||
GET: ldx SendFreeCnt ; Send data if necessary
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
@@ -322,11 +324,11 @@ GET: ldx SendFreeCnt ; Send data if necessary
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; PUT: Output character in A.
|
||||
; SER_PUT: Output character in A.
|
||||
; Must return an error code in a/x.
|
||||
;
|
||||
|
||||
PUT:
|
||||
SER_PUT:
|
||||
|
||||
; Try to send
|
||||
|
||||
@@ -356,31 +358,33 @@ PUT:
|
||||
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.
|
||||
;
|
||||
|
||||
STATUS: lda ACIA_STATUS
|
||||
SER_STATUS:
|
||||
lda ACIA_STATUS
|
||||
ldx #0
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
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.
|
||||
; 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
|
||||
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 SendFreeCnt
|
||||
rts
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
.import cursor
|
||||
.importzp tmp1
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "c64.inc"
|
||||
.include "soft80.inc"
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
.import cursor
|
||||
.importzp tmp1
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "c64.inc"
|
||||
.include "soft80.inc"
|
||||
|
||||
|
||||
@@ -46,15 +46,15 @@
|
||||
|
||||
; Jump table
|
||||
|
||||
.word INSTALL
|
||||
.word UNINSTALL
|
||||
.word OPEN
|
||||
.word CLOSE
|
||||
.word GET
|
||||
.word PUT
|
||||
.word STATUS
|
||||
.word IOCTL
|
||||
.word IRQ
|
||||
.word SER_INSTALL
|
||||
.word SER_UNINSTALL
|
||||
.word SER_OPEN
|
||||
.word SER_CLOSE
|
||||
.word SER_GET
|
||||
.word SER_PUT
|
||||
.word SER_STATUS
|
||||
.word SER_IOCTL
|
||||
.word SER_IRQ
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
;
|
||||
@@ -122,24 +122,24 @@ ParityTable:
|
||||
.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.
|
||||
; 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
|
||||
; 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.
|
||||
; 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.
|
||||
;
|
||||
|
||||
INSTALL:
|
||||
UNINSTALL:
|
||||
CLOSE:
|
||||
SER_INSTALL:
|
||||
SER_UNINSTALL:
|
||||
SER_CLOSE:
|
||||
|
||||
; Deactivate DTR and disable 6551 interrupts
|
||||
|
||||
@@ -156,7 +156,7 @@ CLOSE:
|
||||
; PARAMS routine. A pointer to a ser_params structure is passed in ptr1.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
OPEN:
|
||||
SER_OPEN:
|
||||
|
||||
; Check if the handshake setting is valid
|
||||
|
||||
@@ -236,12 +236,13 @@ InvBaud:
|
||||
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
|
||||
; return.
|
||||
;
|
||||
|
||||
GET: ldx SendFreeCnt ; Send data if necessary
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
@@ -280,11 +281,11 @@ GET: ldx SendFreeCnt ; Send data if necessary
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; PUT: Output character in A.
|
||||
; SER_PUT: Output character in A.
|
||||
; Must return an error code in a/x.
|
||||
;
|
||||
|
||||
PUT:
|
||||
SER_PUT:
|
||||
|
||||
; Try to send
|
||||
|
||||
@@ -314,11 +315,12 @@ PUT:
|
||||
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.
|
||||
;
|
||||
|
||||
STATUS: lda #$0F
|
||||
SER_STATUS:
|
||||
lda #$0F
|
||||
sta IndReg
|
||||
ldy #ACIA::STATUS
|
||||
lda (acia),y
|
||||
@@ -330,23 +332,25 @@ STATUS: lda #$0F
|
||||
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.
|
||||
; 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
|
||||
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
|
||||
; is clear on entry. The routine must return with carry set if the interrupt
|
||||
; was handled, otherwise with carry clear.
|
||||
;
|
||||
|
||||
IRQ: lda #$0F
|
||||
SER_IRQ:
|
||||
lda #$0F
|
||||
sta IndReg ; Switch to the system bank
|
||||
ldy #ACIA::STATUS
|
||||
lda (acia),y ; Check ACIA status for receive interrupt
|
||||
@@ -435,4 +439,3 @@ write: pha
|
||||
lda ExecReg
|
||||
sta IndReg
|
||||
rts
|
||||
|
||||
|
||||
@@ -46,15 +46,15 @@
|
||||
|
||||
; Jump table
|
||||
|
||||
.word INSTALL
|
||||
.word UNINSTALL
|
||||
.word OPEN
|
||||
.word CLOSE
|
||||
.word GET
|
||||
.word PUT
|
||||
.word STATUS
|
||||
.word IOCTL
|
||||
.word IRQ
|
||||
.word SER_INSTALL
|
||||
.word SER_UNINSTALL
|
||||
.word SER_OPEN
|
||||
.word SER_CLOSE
|
||||
.word SER_GET
|
||||
.word SER_PUT
|
||||
.word SER_STATUS
|
||||
.word SER_IOCTL
|
||||
.word SER_IRQ
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
;
|
||||
@@ -122,25 +122,25 @@ ParityTable:
|
||||
.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.
|
||||
; 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
|
||||
; 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.
|
||||
;
|
||||
; 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.
|
||||
;
|
||||
|
||||
INSTALL:
|
||||
UNINSTALL:
|
||||
CLOSE:
|
||||
SER_INSTALL:
|
||||
SER_UNINSTALL:
|
||||
SER_CLOSE:
|
||||
|
||||
; Deactivate DTR and disable 6551 interrupts
|
||||
|
||||
@@ -157,7 +157,7 @@ CLOSE:
|
||||
; PARAMS routine. A pointer to a ser_params structure is passed in ptr1.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
OPEN:
|
||||
SER_OPEN:
|
||||
|
||||
; Check if the handshake setting is valid
|
||||
|
||||
@@ -237,12 +237,13 @@ InvBaud:
|
||||
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
|
||||
; return.
|
||||
;
|
||||
|
||||
GET: ldx SendFreeCnt ; Send data if necessary
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
@@ -281,11 +282,11 @@ GET: ldx SendFreeCnt ; Send data if necessary
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; PUT: Output character in A.
|
||||
; SER_PUT: Output character in A.
|
||||
; Must return an error code in a/x.
|
||||
;
|
||||
|
||||
PUT:
|
||||
SER_PUT:
|
||||
|
||||
; Try to send
|
||||
|
||||
@@ -315,11 +316,12 @@ PUT:
|
||||
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.
|
||||
;
|
||||
|
||||
STATUS: lda #$0F
|
||||
SER_STATUS:
|
||||
lda #$0F
|
||||
sta IndReg
|
||||
ldy #ACIA::STATUS
|
||||
lda (acia),y
|
||||
@@ -331,23 +333,25 @@ STATUS: lda #$0F
|
||||
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.
|
||||
; 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
|
||||
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
|
||||
; is clear on entry. The routine must return with carry set if the interrupt
|
||||
; was handled, otherwise with carry clear.
|
||||
;
|
||||
|
||||
IRQ: lda #$0F
|
||||
SER_IRQ:
|
||||
lda #$0F
|
||||
sta IndReg ; Switch to the system bank
|
||||
ldy #ACIA::STATUS
|
||||
lda (acia),y ; Check ACIA status for receive interrupt
|
||||
@@ -436,4 +440,3 @@ write: pha
|
||||
lda ExecReg
|
||||
sta IndReg
|
||||
rts
|
||||
|
||||
|
||||
@@ -18,12 +18,15 @@
|
||||
.importzp sreg, ptr1, tmp1
|
||||
|
||||
_div: jsr tosdivax ; Division-operator does most of the work
|
||||
lda sreg ; Unsigned remainder is in sreg
|
||||
ldx sreg+1
|
||||
ldy ptr1 ; transfer quotient to sreg
|
||||
sty sreg
|
||||
ldy ptr1+1
|
||||
sty sreg+1
|
||||
|
||||
ldy sreg ; low byte remainder from sreg
|
||||
sta sreg ; store low byte quotient to sreg
|
||||
|
||||
lda sreg+1 ; high byte remainder from sreg
|
||||
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.
|
||||
; 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
|
||||
|
||||
Pos: rts
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
;
|
||||
; unsigned char getcpu (void);
|
||||
;
|
||||
|
||||
.include "zeropage.inc"
|
||||
.export _getcpu
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
@@ -17,6 +17,7 @@
|
||||
; - carry set and 5 in A for a 65CE02
|
||||
; - carry set and 6 in A for a HuC6280
|
||||
; - 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
|
||||
; (interpreted as a NOP) on a NMOS 6502. There are several CMOS versions
|
||||
@@ -26,52 +27,95 @@
|
||||
.p816 ; Enable 65816 instructions
|
||||
|
||||
_getcpu:
|
||||
|
||||
lda #0
|
||||
inc a ; .byte $1A ; nop on nmos, inc on every cmos
|
||||
cmp #1
|
||||
bcc @L8
|
||||
bcc @IsNMOS
|
||||
|
||||
; 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
|
||||
cmp #1
|
||||
beq @L6
|
||||
beq @HasINCA
|
||||
|
||||
; This is at least a 65CE02, check for 4510
|
||||
|
||||
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)
|
||||
lda #3 ; CPU_4510 constant
|
||||
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
|
||||
@L8:
|
||||
@IsNMOS:
|
||||
sed ; set decimal mode, no decimal mode on the 2a03/2a07
|
||||
lda #9
|
||||
clc
|
||||
adc #1 ; $01+$09 = $10 on 6502, $01+$09 = $0A on 2a03/2a07
|
||||
cld
|
||||
cmp #$0a
|
||||
beq @L5
|
||||
beq @Is2a03
|
||||
lda #0 ; CPU_6502 constant
|
||||
beq @L9
|
||||
@L5:
|
||||
beq @LoadXAndReturn
|
||||
@Is2a03:
|
||||
lda #7 ; CPU_2A0x constant
|
||||
bne @L9
|
||||
bne @LoadXAndReturn
|
||||
|
||||
; 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)
|
||||
bne @L9
|
||||
bne @LoadXAndReturn
|
||||
|
||||
; 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
|
||||
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
|
||||
cmp #2
|
||||
beq @L9
|
||||
beq @LoadXAndReturn
|
||||
|
||||
; check for 65SC02
|
||||
|
||||
@@ -82,9 +126,8 @@ _getcpu:
|
||||
ldx $F7
|
||||
sty $F7
|
||||
cpx #$00
|
||||
bne @L4
|
||||
bne @CheckHuC6280
|
||||
lda #4 ; CPU_65SC02 constant
|
||||
|
||||
@L9: ldx #0 ; Load high byte of word
|
||||
@LoadXAndReturn:
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
|
||||
18
libsrc/geos-cbm/graph/setnewmode.s
Normal file
18
libsrc/geos-cbm/graph/setnewmode.s
Normal 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
|
||||
|
||||
@@ -1062,7 +1062,7 @@ SndSetValues:
|
||||
ldx #4-1
|
||||
set0: ldy SndOffsets,x
|
||||
lda SndChannel+2,y
|
||||
_IFNE ; flag == 0 => don`t set
|
||||
_IFNE ; flag == 0 => don't set
|
||||
|
||||
bit #$80
|
||||
_IFNE ;
|
||||
|
||||
@@ -25,15 +25,15 @@
|
||||
.addr $0000
|
||||
|
||||
; Jump table
|
||||
.addr INSTALL
|
||||
.addr UNINSTALL
|
||||
.addr OPEN
|
||||
.addr CLOSE
|
||||
.addr GET
|
||||
.addr PUT
|
||||
.addr STATUS
|
||||
.addr IOCTL
|
||||
.addr IRQ
|
||||
.addr SER_INSTALL
|
||||
.addr SER_UNINSTALL
|
||||
.addr SER_OPEN
|
||||
.addr SER_CLOSE
|
||||
.addr SER_GET
|
||||
.addr SER_PUT
|
||||
.addr SER_STATUS
|
||||
.addr SER_IOCTL
|
||||
.addr SER_IRQ
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Global variables
|
||||
@@ -54,25 +54,25 @@ TxDone: .res 1
|
||||
.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.
|
||||
|
||||
INSTALL:
|
||||
SER_INSTALL:
|
||||
; 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).
|
||||
;
|
||||
|
||||
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.
|
||||
|
||||
CLOSE:
|
||||
SER_CLOSE:
|
||||
; Disable interrupts
|
||||
; Done, return an error code
|
||||
lda #<SER_ERR_OK
|
||||
@@ -80,7 +80,7 @@ CLOSE:
|
||||
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:
|
||||
; 8 bits, parity mark, 1 stop bit
|
||||
@@ -101,7 +101,7 @@ CLOSE:
|
||||
;
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
OPEN:
|
||||
SER_OPEN:
|
||||
stz RxPtrIn
|
||||
stz RxPtrOut
|
||||
stz TxPtrIn
|
||||
@@ -247,11 +247,11 @@ invparameter:
|
||||
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
|
||||
; returned.
|
||||
|
||||
GET:
|
||||
SER_GET:
|
||||
lda RxPtrIn
|
||||
cmp RxPtrOut
|
||||
bne GetByte
|
||||
@@ -260,7 +260,7 @@ GET:
|
||||
rts
|
||||
GetByte:
|
||||
ldy RxPtrOut
|
||||
lda RxBuffer,y
|
||||
lda RxBuffer,y
|
||||
inc RxPtrOut
|
||||
ldx #$00
|
||||
sta (ptr1,x)
|
||||
@@ -268,10 +268,10 @@ GetByte:
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; PUT: Output character in A.
|
||||
; SER_PUT: Output character in A.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
PUT:
|
||||
SER_PUT:
|
||||
tax
|
||||
lda TxPtrIn
|
||||
ina
|
||||
@@ -301,10 +301,10 @@ PutByte:
|
||||
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.
|
||||
|
||||
STATUS:
|
||||
SER_STATUS:
|
||||
ldy SerialStat
|
||||
ldx #$00
|
||||
sta (ptr1,x)
|
||||
@@ -312,17 +312,17 @@ STATUS:
|
||||
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.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
IOCTL:
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
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
|
||||
; is clear on entry. The routine must return with carry set if the interrupt
|
||||
; was handled, otherwise with carry clear.
|
||||
@@ -330,7 +330,7 @@ IOCTL:
|
||||
; 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.
|
||||
|
||||
IRQ:
|
||||
SER_IRQ:
|
||||
lda INTSET ; Poll all pending interrupts
|
||||
and #SERIAL_INTERRUPT
|
||||
bne @L0
|
||||
@@ -411,4 +411,3 @@ IRQ:
|
||||
@IRQexit:
|
||||
clc
|
||||
rts
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
.export _cgetc
|
||||
.import cursor
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "plus4.inc"
|
||||
|
||||
; --------------------------------------------------------------------------
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
.export _clrscr
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "plus4.inc"
|
||||
|
||||
.segment "LOWCODE" ; Must go into low memory
|
||||
@@ -16,9 +17,3 @@
|
||||
sta ENABLE_RAM ; Switch back to RAM
|
||||
rts ; Return to caller
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -45,15 +45,15 @@
|
||||
|
||||
; Jump table
|
||||
|
||||
.word INSTALL
|
||||
.word UNINSTALL
|
||||
.word OPEN
|
||||
.word CLOSE
|
||||
.word GET
|
||||
.word PUT
|
||||
.word STATUS
|
||||
.word IOCTL
|
||||
.word IRQ
|
||||
.word SER_INSTALL
|
||||
.word SER_UNINSTALL
|
||||
.word SER_OPEN
|
||||
.word SER_CLOSE
|
||||
.word SER_GET
|
||||
.word SER_PUT
|
||||
.word SER_STATUS
|
||||
.word SER_IOCTL
|
||||
.word SER_IRQ
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; I/O definitions
|
||||
@@ -130,25 +130,25 @@ ParityTable:
|
||||
.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.
|
||||
; 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
|
||||
; 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.
|
||||
;
|
||||
; 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.
|
||||
;
|
||||
|
||||
INSTALL:
|
||||
UNINSTALL:
|
||||
CLOSE:
|
||||
SER_INSTALL:
|
||||
SER_UNINSTALL:
|
||||
SER_CLOSE:
|
||||
|
||||
; Deactivate DTR and disable 6551 interrupts
|
||||
|
||||
@@ -165,7 +165,7 @@ CLOSE:
|
||||
; PARAMS routine. A pointer to a ser_params structure is passed in ptr1.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
OPEN:
|
||||
SER_OPEN:
|
||||
|
||||
; Check if the handshake setting is valid
|
||||
|
||||
@@ -244,12 +244,13 @@ InvBaud:
|
||||
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
|
||||
; return.
|
||||
;
|
||||
|
||||
GET: ldx SendFreeCnt ; Send data if necessary
|
||||
SER_GET:
|
||||
ldx SendFreeCnt ; Send data if necessary
|
||||
inx ; X == $FF?
|
||||
beq @L1
|
||||
lda #$00
|
||||
@@ -288,11 +289,11 @@ GET: ldx SendFreeCnt ; Send data if necessary
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; PUT: Output character in A.
|
||||
; SER_PUT: Output character in A.
|
||||
; Must return an error code in a/x.
|
||||
;
|
||||
|
||||
PUT:
|
||||
SER_PUT:
|
||||
|
||||
; Try to send
|
||||
|
||||
@@ -322,34 +323,37 @@ PUT:
|
||||
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.
|
||||
;
|
||||
|
||||
STATUS: lda ACIA_STATUS
|
||||
SER_STATUS:
|
||||
lda ACIA_STATUS
|
||||
ldx #0
|
||||
sta (ptr1,x)
|
||||
txa ; SER_ERR_OK
|
||||
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.
|
||||
; 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
|
||||
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
|
||||
; is clear on entry. The routine must return with carry set if the interrupt
|
||||
; 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
|
||||
beq @L9 ; Jump if no ACIA interrupt (carry still clear)
|
||||
lda ACIA_DATA ; Get byte from ACIA
|
||||
@@ -405,5 +409,3 @@ IRQ: lda ACIA_STATUS ; Check ACIA status for receive interrupt
|
||||
jmp @L0
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
.export _cgetc
|
||||
.import cursor
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
.include "vic20.inc"
|
||||
|
||||
_cgetc: lda KEY_COUNT ; Get number of characters
|
||||
|
||||
@@ -6,9 +6,6 @@
|
||||
|
||||
.export _clrscr
|
||||
|
||||
.include "vic20.inc"
|
||||
.include "cbm_kernal.inc"
|
||||
|
||||
_clrscr = CLRSCR
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user