From: Oliver Schmidt
Date: Tue, 28 May 2013 19:20:37 +0000 (+0200)
Subject: Renamed Atari drivers.
X-Git-Tag: V2.15~280
X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=2e8a65bda43bba9022adf1b73d004c7623ed4e0a;p=cc65
Renamed Atari drivers.
As a preparation for the introduction of the 'atarixl' target it is
necessary that all drivers have a base name...
- no longer than 7 characters
- with a common prefix
---
diff --git a/include/atari.h b/include/atari.h
index 26c555cc4..b6714e715 100644
--- a/include/atari.h
+++ b/include/atari.h
@@ -150,25 +150,25 @@ extern void _rest_vecs(void); /* restore system vectors */
extern char *_getdefdev(void); /* get default floppy device */
/* global variables */
-extern unsigned char _dos_type; /* the DOS flavour */
-extern void atr130xe_emd[];
-extern void ataristd_joy[]; /* referred to by joy_static_stddrv[] */
-extern void atarim8_joy[];
-extern void atari10_tgi[];
-extern void atr10p2_tgi[];
-extern void atari11_tgi[];
-extern void atari14_tgi[];
-extern void atari15_tgi[];
-extern void atr15p2_tgi[];
-extern void atari3_tgi[];
-extern void atari4_tgi[];
-extern void atari5_tgi[];
-extern void atari6_tgi[];
-extern void atari7_tgi[];
-extern void atari8_tgi[]; /* referred to by tgi_static_stddrv[] */
+extern unsigned char _dos_type; /* the DOS flavour */
+extern void atr130_emd[];
+extern void atrstd_joy[]; /* referred to by joy_static_stddrv[] */
+extern void atrm8_joy[];
+extern void atr3_tgi[];
+extern void atr4_tgi[];
+extern void atr5_tgi[];
+extern void atr6_tgi[];
+extern void atr7_tgi[];
+extern void atr8_tgi[]; /* referred to by tgi_static_stddrv[] */
extern void atr8p2_tgi[];
-extern void atari9_tgi[];
+extern void atr9_tgi[];
extern void atr9p2_tgi[];
+extern void atr10_tgi[];
+extern void atr10p2_tgi[];
+extern void atr11_tgi[];
+extern void atr14_tgi[];
+extern void atr15_tgi[];
+extern void atr15p2_tgi[];
/* provide old names for backwards compatibility */
#ifdef ATARI_COMPAT_PRE_2_11
diff --git a/libsrc/atari/emd/atr130.s b/libsrc/atari/emd/atr130.s
new file mode 100644
index 000000000..b3c31a205
--- /dev/null
+++ b/libsrc/atari/emd/atr130.s
@@ -0,0 +1,483 @@
+;
+; Extended memory driver for the Atari 130XE memory standard
+; Shawn Jefferson, 2012-08-11
+;
+; Banking Register $D301:
+; Bit 7: Self-Test on/off
+; Bit 6: Unused
+; Bit 5: Antic sees bank
+; Bit 4: CPU sees bank
+; Bit 3: bank control
+; Bit 2: bank control
+; Bit 1: BASIC on/off
+; Bit 0: OS RAM on/off
+;
+; Masks: %11100011 $E3 Bank 0
+; %11100111 $E7 Bank 1
+; %11101011 $EB Bank 2
+; %11101111 $EF Bank 3
+; %11111111 $FF Off
+;
+; Based on the Extended memory driver for the Apple II auxiliary memory
+; by
+; Stefan Haubenthal, 2003-12-12
+; Ullrich von Bassewitz, 2002-12-02
+;
+
+ .include "zeropage.inc"
+
+ .include "em-kernel.inc"
+ .include "em-error.inc"
+
+
+ .macpack generic
+
+
+; ------------------------------------------------------------------------
+; Header. Includes jump table
+
+.segment "JUMPTABLE"
+
+; Driver signature
+
+ .byte $65, $6d, $64 ; "emd"
+ .byte EMD_API_VERSION ; EM API version number
+
+; Jump table.
+
+ .word INSTALL
+ .word DEINSTALL
+ .word PAGECOUNT
+ .word MAP
+ .word USE
+ .word COMMIT
+ .word COPYFROM
+ .word COPYTO
+
+; ------------------------------------------------------------------------
+; Constants
+
+BANK = $4000 ; bank window
+STACK = $0100 ; stack location
+PAGES = 256 ; 4 x 16k banks
+
+
+; ------------------------------------------------------------------------
+; Data.
+
+.rodata
+banks: .byte $E3,$E7,$EB,$EF ; 130XE banks for cpu banking
+
+stacktest: sei
+ ldy banks
+ sty $D301
+ tax ; A is set by caller
+ inx
+ stx $4000 ; change $4000
+ ldy #$FF ; STACK+13
+ sty $D301
+ cmp $4000 ; changed?
+ beq @1
+ sec ; error
+ bcs @2
+@1: clc
+@2: sta $4000 ; restore
+ cli
+ rts
+stacktest_end:
+
+stackcopy: sei ; disable interrupts
+@1: dex ; pre-decrement (full page x=0)
+ ldy #$FF ; this will be replaced STACK+3
+ sty $D301 ; set bank
+ lda $FF00,x ; address to copy from STACK+8,+9
+ ldy #$FF ; this will be replaced STACK+11
+ sty $D301
+ sta $FF00,x ; address to copy to STACK+16,+17
+ cpx #0
+ bne @1
+ ldy #$FF ; portb_save STACK+23
+ sty $D301
+ cli ; enable interrupts
+ rts
+stackcopy_end:
+
+stackcopy_byte: sei
+ ldy #$FF ; STACK+2
+ sty $D301
+ lda $FFFF ; STACK+7 +8
+ ldy #$FF ; STACK+10
+ sty $D301
+ sta $FFFF ; STACK+15 +16
+ ldy #$FF ; STACK+18
+ sty $D301
+ cli
+ rts
+stackcopy_byte_end:
+
+
+.data
+curpage: .byte $FF ; Current page number in bank (invalid)
+curbank: .byte $FF ; Current bank number
+
+.bss
+window: .res 256 ; Memory "window"
+portb_save: .res 1 ; portb state
+
+.code
+
+install_transfer:
+ ldx #stackcopy_end - stackcopy - 1
+@1: lda stackcopy,x
+ sta STACK,x
+ dex
+ bpl @1
+ rts
+
+install_byte_transfer:
+ ldx #stackcopy_byte_end - stackcopy_byte - 1
+@2: lda stackcopy_byte,x
+ sta STACK,x
+ dex
+ bpl @2
+ rts
+
+install_test:
+ ldx #stacktest_end - stacktest - 1
+@3: lda stacktest,x
+ sta STACK,x
+ dex
+ bpl @3
+ rts
+
+setpage:
+ tax ; save page
+ and #$C0 ; mask out bank
+ clc
+ ror
+ ror ; divide by 64
+ ror ; 64 pages in each bank
+ ror
+ ror
+ ror
+ sta curbank ; Remember the new bank
+ txa ; bring back page
+ and #$3F ; mask out page
+ sta curpage ; curpage in bank
+ rts
+
+
+; ------------------------------------------------------------------------
+; INSTALL routine. Is called after the driver is loaded into memory. If
+; possible, check if the hardware is present and determine the amount of
+; memory available.
+; Must return an EM_ERR_xx code in a/x.
+;
+
+INSTALL:
+ lda $D301 ; save state of portb
+ sta portb_save
+ tay
+
+ jsr install_test ; doesn't touch Y
+ sty STACK+13
+
+ lda $4000 ; test for extended memory
+ jsr STACK
+ bcs @1
+ lda #EM_ERR_OK
+ rts
+@1: lda #EM_ERR_NO_DEVICE
+ rts
+
+; ------------------------------------------------------------------------
+; DEINSTALL routine. Is called before the driver is removed from memory.
+; Can do cleanup or whatever. Must not return anything.
+;
+
+DEINSTALL:
+ rts
+
+
+; ------------------------------------------------------------------------
+; PAGECOUNT: Return the total number of available pages in a/x.
+;
+
+PAGECOUNT:
+ lda #PAGES
+ rts
+
+; ------------------------------------------------------------------------
+; MAP: Map the page in a/x into memory and return a pointer to the page in
+; a/x. The contents of the currently mapped page (if any) may be discarded
+; by the driver.
+;
+
+MAP: jsr setpage ; extract the bank/page
+ add #>BANK ; $4000 + page (carry is cleared)
+ sta ptr1+1
+ ;ldy #$00
+ ;sty ptr1
+
+ lda #window
+ sta ptr2+1
+
+; Transfer one page
+
+ jsr install_transfer ; Transfer one page
+
+ ldx curbank
+ lda banks,x
+ sta STACK+3 ; set bank to copy from
+; lda ptr1
+; sta STACK+8
+ lda ptr1+1
+ sta STACK+9 ; set copy from address
+ lda portb_save
+ sta STACK+11 ; set portb restore
+ sta STACK+23 ; set final portb restore
+ lda ptr2
+ sta STACK+16
+ lda ptr2+1
+ sta STACK+17 ; set copy to address
+
+ ldx #0 ; full page copy
+ jsr STACK ; do the copy!
+
+; Return the memory window
+
+ lda #window ; Return the window address
+
+ rts
+
+; ------------------------------------------------------------------------
+; USE: Tell the driver that the window is now associated with a given page.
+
+USE: ;sta curpage ; Remember the page
+ jsr setpage ; extract bank/page
+ lda #window ; Return the window
+ rts
+
+; ------------------------------------------------------------------------
+; COMMIT: Commit changes in the memory window to extended storage.
+
+COMMIT: lda curpage ; Get the current page
+ cmp #$FF
+ beq commit_done ; Jump if no page mapped
+
+ clc
+ add #>BANK
+ sta ptr2+1
+ ;ldy #$00
+ ;sty ptr2
+
+ lda #window
+ sta ptr1+1
+
+; Transfer one page/all bytes
+
+ jsr install_transfer ; Transfer one page
+
+ lda portb_save
+ sta STACK+3 ; set bank to copy from
+ sta STACK+23 ; set final portb restore
+ lda ptr1
+ sta STACK+8
+ lda ptr1+1
+ sta STACK+9 ; set copy from address
+ ldx curbank
+ lda banks,x
+ sta STACK+11 ; set bank to copy to
+ ;lda ptr2
+ ;sta STACK+16
+ lda ptr2+1
+ sta STACK+17 ; set copy to address
+
+ ldx #0 ; full page copy
+ jsr STACK ; do the copy!
+
+commit_done:
+ rts
+
+
+; ------------------------------------------------------------------------
+; COPYFROM: Copy from extended into linear memory. A pointer to a structure
+; describing the request is passed in a/x.
+; The function must not return anything.
+;
+COPYFROM:
+ sta ptr3
+ stx ptr3+1 ; Save the passed em_copy pointer
+
+ jsr install_byte_transfer ; install the stack copy routine
+
+ ldy #EM_COPY::OFFS
+ lda (ptr3),y
+ sta STACK+7 ; offset goes into BANK low
+
+ ldy #EM_COPY::PAGE
+ lda (ptr3),y
+ sta tmp1 ; save page for later
+ ;add #>BANK
+ ;sta STACK+8 ; BANK + page goes into BANK high
+
+ ldy #EM_COPY::BUF
+ lda (ptr3),y
+ sta STACK+15 ; buffer goes into dest low
+ iny
+ lda (ptr3),y
+ sta STACK+16 ; buffer goes into dest high
+
+ ldy #EM_COPY::COUNT
+ lda (ptr3),y ; Get bytes in last page
+ sta ptr4
+ iny
+ lda (ptr3),y ; Get number of pages
+ sta ptr4+1
+
+ lda tmp1 ; extract bank/page
+ jsr setpage ; sets curbank/curpage
+ lda curpage
+ add #>BANK ; add to BANK address
+ sta STACK+8 ; current page in bank
+ ldx curbank
+ lda banks,x
+ sta STACK+2 ; set bank in stack
+ lda portb_save
+ sta STACK+10 ; set bank restore in stack
+ sta STACK+18 ; set final restore too
+
+copyfrom_copy:
+ lda ptr4 ; check if count is zero
+ bne @4
+ lda ptr4+1
+ beq done
+
+@4: jsr STACK ; copy one byte
+
+ sec
+ lda ptr4
+ sub #1
+ sta ptr4
+ bcs @1
+ lda ptr4+1
+ beq @1
+ sub #1
+ sta ptr4+1
+
+@1: inc STACK+7 ; increment address in BANK
+ bne @2
+ inc STACK+8
+ lda STACK+8
+ cmp #$80 ; we stepped outside bank
+ bne @2
+
+ inc curbank ; get next bank
+ ldx curbank
+ lda banks,x
+ sta STACK+2 ; set new bank
+ lda #$40 ; set address back to $4000
+ sta STACK+8
+
+@2: inc STACK+15 ; increment buffer address
+ bne @3
+ inc STACK+16
+
+@3: jmp copyfrom_copy ; copy another byte
+
+done:
+ rts
+
+; ------------------------------------------------------------------------
+; COPYTO: Copy from linear into extended memory. A pointer to a structure
+; describing the request is passed in a/x.
+; The function must not return anything.
+;
+
+COPYTO:
+ sta ptr3
+ stx ptr3+1 ; Save the passed em_copy pointer
+
+ jsr install_byte_transfer ; install the stack copy routine
+
+ ldy #EM_COPY::OFFS
+ lda (ptr3),y
+ sta STACK+15 ; offset goes into BANK low
+
+ ldy #EM_COPY::PAGE
+ lda (ptr3),y
+ sta tmp1 ; save page for later
+ ;add #>BANK
+ ;sta STACK+16 ; BANK + page goes into BANK high
+
+ ldy #EM_COPY::BUF
+ lda (ptr3),y
+ sta STACK+7 ; buffer goes into dest low
+ iny
+ lda (ptr3),y
+ sta STACK+8 ; buffer goes into dest high
+
+ ldy #EM_COPY::COUNT
+ lda (ptr3),y ; Get bytes in last page
+ sta ptr4
+ iny
+ lda (ptr3),y ; Get number of pages
+ sta ptr4+1
+
+ lda tmp1 ; extract bank/page
+ jsr setpage ; sets curbank/curpage
+ lda curpage
+ add #>BANK ; add to BANK address
+ sta STACK+16 ; current page in bank
+ ldx curbank
+ lda banks,x
+ sta STACK+10 ; set bank in stack
+ lda portb_save
+ sta STACK+2 ; set bank restore in stack
+ sta STACK+18 ; set final restore too
+
+copyto_copy:
+ lda ptr4 ; check if count is zero
+ bne @4
+ lda ptr4+1
+ beq done
+
+@4: jsr STACK ; copy one byte
+
+ sec
+ lda ptr4
+ sub #1
+ sta ptr4
+ bcs @1
+ lda ptr4+1
+ beq @1
+ sub #1
+ sta ptr4+1
+
+@1: inc STACK+15 ; increment address in BANK
+ bne @2
+ inc STACK+16
+ lda STACK+16
+ cmp #$80 ; we stepped outside bank
+ bne @2
+
+ inc curbank ; get next bank
+ ldx curbank
+ lda banks,x
+ sta STACK+10 ; set new bank
+ lda #$40 ; set address back to $4000
+ sta STACK+16
+
+@2: inc STACK+7 ; increment buffer address
+ bne @3
+ inc STACK+8
+
+@3: jmp copyto_copy ; copy another byte
+
diff --git a/libsrc/atari/emd/atr130xe.s b/libsrc/atari/emd/atr130xe.s
deleted file mode 100644
index b3c31a205..000000000
--- a/libsrc/atari/emd/atr130xe.s
+++ /dev/null
@@ -1,483 +0,0 @@
-;
-; Extended memory driver for the Atari 130XE memory standard
-; Shawn Jefferson, 2012-08-11
-;
-; Banking Register $D301:
-; Bit 7: Self-Test on/off
-; Bit 6: Unused
-; Bit 5: Antic sees bank
-; Bit 4: CPU sees bank
-; Bit 3: bank control
-; Bit 2: bank control
-; Bit 1: BASIC on/off
-; Bit 0: OS RAM on/off
-;
-; Masks: %11100011 $E3 Bank 0
-; %11100111 $E7 Bank 1
-; %11101011 $EB Bank 2
-; %11101111 $EF Bank 3
-; %11111111 $FF Off
-;
-; Based on the Extended memory driver for the Apple II auxiliary memory
-; by
-; Stefan Haubenthal, 2003-12-12
-; Ullrich von Bassewitz, 2002-12-02
-;
-
- .include "zeropage.inc"
-
- .include "em-kernel.inc"
- .include "em-error.inc"
-
-
- .macpack generic
-
-
-; ------------------------------------------------------------------------
-; Header. Includes jump table
-
-.segment "JUMPTABLE"
-
-; Driver signature
-
- .byte $65, $6d, $64 ; "emd"
- .byte EMD_API_VERSION ; EM API version number
-
-; Jump table.
-
- .word INSTALL
- .word DEINSTALL
- .word PAGECOUNT
- .word MAP
- .word USE
- .word COMMIT
- .word COPYFROM
- .word COPYTO
-
-; ------------------------------------------------------------------------
-; Constants
-
-BANK = $4000 ; bank window
-STACK = $0100 ; stack location
-PAGES = 256 ; 4 x 16k banks
-
-
-; ------------------------------------------------------------------------
-; Data.
-
-.rodata
-banks: .byte $E3,$E7,$EB,$EF ; 130XE banks for cpu banking
-
-stacktest: sei
- ldy banks
- sty $D301
- tax ; A is set by caller
- inx
- stx $4000 ; change $4000
- ldy #$FF ; STACK+13
- sty $D301
- cmp $4000 ; changed?
- beq @1
- sec ; error
- bcs @2
-@1: clc
-@2: sta $4000 ; restore
- cli
- rts
-stacktest_end:
-
-stackcopy: sei ; disable interrupts
-@1: dex ; pre-decrement (full page x=0)
- ldy #$FF ; this will be replaced STACK+3
- sty $D301 ; set bank
- lda $FF00,x ; address to copy from STACK+8,+9
- ldy #$FF ; this will be replaced STACK+11
- sty $D301
- sta $FF00,x ; address to copy to STACK+16,+17
- cpx #0
- bne @1
- ldy #$FF ; portb_save STACK+23
- sty $D301
- cli ; enable interrupts
- rts
-stackcopy_end:
-
-stackcopy_byte: sei
- ldy #$FF ; STACK+2
- sty $D301
- lda $FFFF ; STACK+7 +8
- ldy #$FF ; STACK+10
- sty $D301
- sta $FFFF ; STACK+15 +16
- ldy #$FF ; STACK+18
- sty $D301
- cli
- rts
-stackcopy_byte_end:
-
-
-.data
-curpage: .byte $FF ; Current page number in bank (invalid)
-curbank: .byte $FF ; Current bank number
-
-.bss
-window: .res 256 ; Memory "window"
-portb_save: .res 1 ; portb state
-
-.code
-
-install_transfer:
- ldx #stackcopy_end - stackcopy - 1
-@1: lda stackcopy,x
- sta STACK,x
- dex
- bpl @1
- rts
-
-install_byte_transfer:
- ldx #stackcopy_byte_end - stackcopy_byte - 1
-@2: lda stackcopy_byte,x
- sta STACK,x
- dex
- bpl @2
- rts
-
-install_test:
- ldx #stacktest_end - stacktest - 1
-@3: lda stacktest,x
- sta STACK,x
- dex
- bpl @3
- rts
-
-setpage:
- tax ; save page
- and #$C0 ; mask out bank
- clc
- ror
- ror ; divide by 64
- ror ; 64 pages in each bank
- ror
- ror
- ror
- sta curbank ; Remember the new bank
- txa ; bring back page
- and #$3F ; mask out page
- sta curpage ; curpage in bank
- rts
-
-
-; ------------------------------------------------------------------------
-; INSTALL routine. Is called after the driver is loaded into memory. If
-; possible, check if the hardware is present and determine the amount of
-; memory available.
-; Must return an EM_ERR_xx code in a/x.
-;
-
-INSTALL:
- lda $D301 ; save state of portb
- sta portb_save
- tay
-
- jsr install_test ; doesn't touch Y
- sty STACK+13
-
- lda $4000 ; test for extended memory
- jsr STACK
- bcs @1
- lda #EM_ERR_OK
- rts
-@1: lda #EM_ERR_NO_DEVICE
- rts
-
-; ------------------------------------------------------------------------
-; DEINSTALL routine. Is called before the driver is removed from memory.
-; Can do cleanup or whatever. Must not return anything.
-;
-
-DEINSTALL:
- rts
-
-
-; ------------------------------------------------------------------------
-; PAGECOUNT: Return the total number of available pages in a/x.
-;
-
-PAGECOUNT:
- lda #PAGES
- rts
-
-; ------------------------------------------------------------------------
-; MAP: Map the page in a/x into memory and return a pointer to the page in
-; a/x. The contents of the currently mapped page (if any) may be discarded
-; by the driver.
-;
-
-MAP: jsr setpage ; extract the bank/page
- add #>BANK ; $4000 + page (carry is cleared)
- sta ptr1+1
- ;ldy #$00
- ;sty ptr1
-
- lda #window
- sta ptr2+1
-
-; Transfer one page
-
- jsr install_transfer ; Transfer one page
-
- ldx curbank
- lda banks,x
- sta STACK+3 ; set bank to copy from
-; lda ptr1
-; sta STACK+8
- lda ptr1+1
- sta STACK+9 ; set copy from address
- lda portb_save
- sta STACK+11 ; set portb restore
- sta STACK+23 ; set final portb restore
- lda ptr2
- sta STACK+16
- lda ptr2+1
- sta STACK+17 ; set copy to address
-
- ldx #0 ; full page copy
- jsr STACK ; do the copy!
-
-; Return the memory window
-
- lda #window ; Return the window address
-
- rts
-
-; ------------------------------------------------------------------------
-; USE: Tell the driver that the window is now associated with a given page.
-
-USE: ;sta curpage ; Remember the page
- jsr setpage ; extract bank/page
- lda #window ; Return the window
- rts
-
-; ------------------------------------------------------------------------
-; COMMIT: Commit changes in the memory window to extended storage.
-
-COMMIT: lda curpage ; Get the current page
- cmp #$FF
- beq commit_done ; Jump if no page mapped
-
- clc
- add #>BANK
- sta ptr2+1
- ;ldy #$00
- ;sty ptr2
-
- lda #window
- sta ptr1+1
-
-; Transfer one page/all bytes
-
- jsr install_transfer ; Transfer one page
-
- lda portb_save
- sta STACK+3 ; set bank to copy from
- sta STACK+23 ; set final portb restore
- lda ptr1
- sta STACK+8
- lda ptr1+1
- sta STACK+9 ; set copy from address
- ldx curbank
- lda banks,x
- sta STACK+11 ; set bank to copy to
- ;lda ptr2
- ;sta STACK+16
- lda ptr2+1
- sta STACK+17 ; set copy to address
-
- ldx #0 ; full page copy
- jsr STACK ; do the copy!
-
-commit_done:
- rts
-
-
-; ------------------------------------------------------------------------
-; COPYFROM: Copy from extended into linear memory. A pointer to a structure
-; describing the request is passed in a/x.
-; The function must not return anything.
-;
-COPYFROM:
- sta ptr3
- stx ptr3+1 ; Save the passed em_copy pointer
-
- jsr install_byte_transfer ; install the stack copy routine
-
- ldy #EM_COPY::OFFS
- lda (ptr3),y
- sta STACK+7 ; offset goes into BANK low
-
- ldy #EM_COPY::PAGE
- lda (ptr3),y
- sta tmp1 ; save page for later
- ;add #>BANK
- ;sta STACK+8 ; BANK + page goes into BANK high
-
- ldy #EM_COPY::BUF
- lda (ptr3),y
- sta STACK+15 ; buffer goes into dest low
- iny
- lda (ptr3),y
- sta STACK+16 ; buffer goes into dest high
-
- ldy #EM_COPY::COUNT
- lda (ptr3),y ; Get bytes in last page
- sta ptr4
- iny
- lda (ptr3),y ; Get number of pages
- sta ptr4+1
-
- lda tmp1 ; extract bank/page
- jsr setpage ; sets curbank/curpage
- lda curpage
- add #>BANK ; add to BANK address
- sta STACK+8 ; current page in bank
- ldx curbank
- lda banks,x
- sta STACK+2 ; set bank in stack
- lda portb_save
- sta STACK+10 ; set bank restore in stack
- sta STACK+18 ; set final restore too
-
-copyfrom_copy:
- lda ptr4 ; check if count is zero
- bne @4
- lda ptr4+1
- beq done
-
-@4: jsr STACK ; copy one byte
-
- sec
- lda ptr4
- sub #1
- sta ptr4
- bcs @1
- lda ptr4+1
- beq @1
- sub #1
- sta ptr4+1
-
-@1: inc STACK+7 ; increment address in BANK
- bne @2
- inc STACK+8
- lda STACK+8
- cmp #$80 ; we stepped outside bank
- bne @2
-
- inc curbank ; get next bank
- ldx curbank
- lda banks,x
- sta STACK+2 ; set new bank
- lda #$40 ; set address back to $4000
- sta STACK+8
-
-@2: inc STACK+15 ; increment buffer address
- bne @3
- inc STACK+16
-
-@3: jmp copyfrom_copy ; copy another byte
-
-done:
- rts
-
-; ------------------------------------------------------------------------
-; COPYTO: Copy from linear into extended memory. A pointer to a structure
-; describing the request is passed in a/x.
-; The function must not return anything.
-;
-
-COPYTO:
- sta ptr3
- stx ptr3+1 ; Save the passed em_copy pointer
-
- jsr install_byte_transfer ; install the stack copy routine
-
- ldy #EM_COPY::OFFS
- lda (ptr3),y
- sta STACK+15 ; offset goes into BANK low
-
- ldy #EM_COPY::PAGE
- lda (ptr3),y
- sta tmp1 ; save page for later
- ;add #>BANK
- ;sta STACK+16 ; BANK + page goes into BANK high
-
- ldy #EM_COPY::BUF
- lda (ptr3),y
- sta STACK+7 ; buffer goes into dest low
- iny
- lda (ptr3),y
- sta STACK+8 ; buffer goes into dest high
-
- ldy #EM_COPY::COUNT
- lda (ptr3),y ; Get bytes in last page
- sta ptr4
- iny
- lda (ptr3),y ; Get number of pages
- sta ptr4+1
-
- lda tmp1 ; extract bank/page
- jsr setpage ; sets curbank/curpage
- lda curpage
- add #>BANK ; add to BANK address
- sta STACK+16 ; current page in bank
- ldx curbank
- lda banks,x
- sta STACK+10 ; set bank in stack
- lda portb_save
- sta STACK+2 ; set bank restore in stack
- sta STACK+18 ; set final restore too
-
-copyto_copy:
- lda ptr4 ; check if count is zero
- bne @4
- lda ptr4+1
- beq done
-
-@4: jsr STACK ; copy one byte
-
- sec
- lda ptr4
- sub #1
- sta ptr4
- bcs @1
- lda ptr4+1
- beq @1
- sub #1
- sta ptr4+1
-
-@1: inc STACK+15 ; increment address in BANK
- bne @2
- inc STACK+16
- lda STACK+16
- cmp #$80 ; we stepped outside bank
- bne @2
-
- inc curbank ; get next bank
- ldx curbank
- lda banks,x
- sta STACK+10 ; set new bank
- lda #$40 ; set address back to $4000
- sta STACK+16
-
-@2: inc STACK+7 ; increment buffer address
- bne @3
- inc STACK+8
-
-@3: jmp copyto_copy ; copy another byte
-
diff --git a/libsrc/atari/joy/atarimj8.s b/libsrc/atari/joy/atarimj8.s
deleted file mode 100644
index 777a52615..000000000
--- a/libsrc/atari/joy/atarimj8.s
+++ /dev/null
@@ -1,115 +0,0 @@
-;
-; MultiJoy joystick driver for the Atari. May be used multiple times when linked
-; to the statically application.
-;
-; Ullrich von Bassewitz, 2002-12-21
-; Stefan Haubenthal, 2009-04-10
-; Using code from Carsten Strotmann and help from Christian Groessler
-;
-
- .include "zeropage.inc"
-
- .include "joy-kernel.inc"
- .include "joy-error.inc"
- .include "atari.inc"
-
- .macpack generic
-
-
-; ------------------------------------------------------------------------
-; Header. Includes jump table
-
-.segment "JUMPTABLE"
-
-; Driver signature
-
- .byte $6A, $6F, $79 ; "joy"
- .byte JOY_API_VERSION ; Driver API version number
-
-; Button state masks (8 values)
-
- .byte $02 ; JOY_UP
- .byte $04 ; JOY_DOWN
- .byte $08 ; JOY_LEFT
- .byte $10 ; JOY_RIGHT
- .byte $01 ; JOY_FIRE
- .byte $00 ; JOY_FIRE2 not available
- .byte $00 ; Future expansion
- .byte $00 ; Future expansion
-
-; Jump table.
-
- .addr INSTALL
- .addr UNINSTALL
- .addr COUNT
- .addr READJOY
- .addr 0 ; IRQ entry not used
-
-; ------------------------------------------------------------------------
-; Constants
-
-JOY_COUNT = 8 ; Number of joysticks we support
-
-
-; ------------------------------------------------------------------------
-; Data.
-
-
-.code
-
-; ------------------------------------------------------------------------
-; INSTALL routine. Is called after the driver is loaded into memory. If
-; possible, check if the hardware is present and determine the amount of
-; memory available.
-; Must return an JOY_ERR_xx code in a/x.
-;
-
-INSTALL:
- lda #$30
- sta PACTL
- lda #$F0
- sta PORTA
- lda #$34
- sta PACTL
- lda #JOY_ERR_OK
- ldx #0
-; rts ; Run into UNINSTALL instead
-
-; ------------------------------------------------------------------------
-; UNINSTALL routine. Is called before the driver is removed from memory.
-; Can do cleanup or whatever. Must not return anything.
-;
-
-UNINSTALL:
- rts
-
-
-; ------------------------------------------------------------------------
-; COUNT: Return the total number of available joysticks in a/x.
-;
-
-COUNT:
- lda #JOY_COUNT
- ldx #0
- rts
-
-; ------------------------------------------------------------------------
-; READ: Read a particular joystick passed in A.
-;
-
-READJOY:
- asl a
- asl a
- asl a
- asl a
- sta PORTA
-
-; Read joystick
-
- lda PORTA ; get position
- and #%00001111
- asl a
- ora TRIG0 ; add button information
- eor #%00011111
- ldx #0 ; fix X
- rts
diff --git a/libsrc/atari/joy/ataristd.s b/libsrc/atari/joy/ataristd.s
deleted file mode 100644
index caca34cc5..000000000
--- a/libsrc/atari/joy/ataristd.s
+++ /dev/null
@@ -1,112 +0,0 @@
-;
-; Standard joystick driver for the Atari. May be used multiple times when linked
-; to the statically application.
-;
-; Ullrich von Bassewitz, 2002-12-21
-; Using the readjoy code from Christian Groessler
-;
-
- .include "zeropage.inc"
-
- .include "joy-kernel.inc"
- .include "joy-error.inc"
- .include "atari.inc"
-
- .macpack generic
-
-
-; ------------------------------------------------------------------------
-; Header. Includes jump table
-
-.segment "JUMPTABLE"
-
-; Driver signature
-
- .byte $6A, $6F, $79 ; "joy"
- .byte JOY_API_VERSION ; Driver API version number
-
-; Button state masks (8 values)
-
- .byte $01 ; JOY_UP
- .byte $02 ; JOY_DOWN
- .byte $04 ; JOY_LEFT
- .byte $08 ; JOY_RIGHT
- .byte $10 ; JOY_FIRE
- .byte $00 ; JOY_FIRE2 not available
- .byte $00 ; Future expansion
- .byte $00 ; Future expansion
-
-; Jump table.
-
- .addr INSTALL
- .addr UNINSTALL
- .addr COUNT
- .addr READJOY
- .addr 0 ; IRQ entry not used
-
-; ------------------------------------------------------------------------
-; Constants
-
-JOY_COUNT = 4 ; Number of joysticks we support
-
-
-; ------------------------------------------------------------------------
-; Data.
-
-
-.code
-
-; ------------------------------------------------------------------------
-; INSTALL routine. Is called after the driver is loaded into memory. If
-; possible, check if the hardware is present and determine the amount of
-; memory available.
-; Must return an JOY_ERR_xx code in a/x.
-;
-
-INSTALL:
- lda #JOY_ERR_OK
- ldx #0
-; rts ; Run into UNINSTALL instead
-
-; ------------------------------------------------------------------------
-; UNINSTALL routine. Is called before the driver is removed from memory.
-; Can do cleanup or whatever. Must not return anything.
-;
-
-UNINSTALL:
- rts
-
-
-; ------------------------------------------------------------------------
-; COUNT: Return the total number of available joysticks in a/x.
-;
-
-COUNT:
- lda #JOY_COUNT
- ldx $fcd8
- cpx #$a2
- beq _400800
- lsr a ; XL and newer machines only have 2 ports
-_400800:
- ldx #0
- rts
-
-; ------------------------------------------------------------------------
-; READ: Read a particular joystick passed in A.
-;
-
-READJOY:
- and #3 ; fix joystick number
- tax ; Joystick number (0-3) into X
-
-; Read joystick
-
- lda STRIG0,x ; get button
- asl a
- asl a
- asl a
- asl a
- ora STICK0,x ; add position information
- eor #$1F
- ldx #0 ; fix X
- rts
diff --git a/libsrc/atari/joy/atrmj8.s b/libsrc/atari/joy/atrmj8.s
new file mode 100644
index 000000000..777a52615
--- /dev/null
+++ b/libsrc/atari/joy/atrmj8.s
@@ -0,0 +1,115 @@
+;
+; MultiJoy joystick driver for the Atari. May be used multiple times when linked
+; to the statically application.
+;
+; Ullrich von Bassewitz, 2002-12-21
+; Stefan Haubenthal, 2009-04-10
+; Using code from Carsten Strotmann and help from Christian Groessler
+;
+
+ .include "zeropage.inc"
+
+ .include "joy-kernel.inc"
+ .include "joy-error.inc"
+ .include "atari.inc"
+
+ .macpack generic
+
+
+; ------------------------------------------------------------------------
+; Header. Includes jump table
+
+.segment "JUMPTABLE"
+
+; Driver signature
+
+ .byte $6A, $6F, $79 ; "joy"
+ .byte JOY_API_VERSION ; Driver API version number
+
+; Button state masks (8 values)
+
+ .byte $02 ; JOY_UP
+ .byte $04 ; JOY_DOWN
+ .byte $08 ; JOY_LEFT
+ .byte $10 ; JOY_RIGHT
+ .byte $01 ; JOY_FIRE
+ .byte $00 ; JOY_FIRE2 not available
+ .byte $00 ; Future expansion
+ .byte $00 ; Future expansion
+
+; Jump table.
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr COUNT
+ .addr READJOY
+ .addr 0 ; IRQ entry not used
+
+; ------------------------------------------------------------------------
+; Constants
+
+JOY_COUNT = 8 ; Number of joysticks we support
+
+
+; ------------------------------------------------------------------------
+; Data.
+
+
+.code
+
+; ------------------------------------------------------------------------
+; INSTALL routine. Is called after the driver is loaded into memory. If
+; possible, check if the hardware is present and determine the amount of
+; memory available.
+; Must return an JOY_ERR_xx code in a/x.
+;
+
+INSTALL:
+ lda #$30
+ sta PACTL
+ lda #$F0
+ sta PORTA
+ lda #$34
+ sta PACTL
+ lda #JOY_ERR_OK
+ ldx #0
+; rts ; Run into UNINSTALL instead
+
+; ------------------------------------------------------------------------
+; UNINSTALL routine. Is called before the driver is removed from memory.
+; Can do cleanup or whatever. Must not return anything.
+;
+
+UNINSTALL:
+ rts
+
+
+; ------------------------------------------------------------------------
+; COUNT: Return the total number of available joysticks in a/x.
+;
+
+COUNT:
+ lda #JOY_COUNT
+ ldx #0
+ rts
+
+; ------------------------------------------------------------------------
+; READ: Read a particular joystick passed in A.
+;
+
+READJOY:
+ asl a
+ asl a
+ asl a
+ asl a
+ sta PORTA
+
+; Read joystick
+
+ lda PORTA ; get position
+ and #%00001111
+ asl a
+ ora TRIG0 ; add button information
+ eor #%00011111
+ ldx #0 ; fix X
+ rts
diff --git a/libsrc/atari/joy/atrstd.s b/libsrc/atari/joy/atrstd.s
new file mode 100644
index 000000000..caca34cc5
--- /dev/null
+++ b/libsrc/atari/joy/atrstd.s
@@ -0,0 +1,112 @@
+;
+; Standard joystick driver for the Atari. May be used multiple times when linked
+; to the statically application.
+;
+; Ullrich von Bassewitz, 2002-12-21
+; Using the readjoy code from Christian Groessler
+;
+
+ .include "zeropage.inc"
+
+ .include "joy-kernel.inc"
+ .include "joy-error.inc"
+ .include "atari.inc"
+
+ .macpack generic
+
+
+; ------------------------------------------------------------------------
+; Header. Includes jump table
+
+.segment "JUMPTABLE"
+
+; Driver signature
+
+ .byte $6A, $6F, $79 ; "joy"
+ .byte JOY_API_VERSION ; Driver API version number
+
+; Button state masks (8 values)
+
+ .byte $01 ; JOY_UP
+ .byte $02 ; JOY_DOWN
+ .byte $04 ; JOY_LEFT
+ .byte $08 ; JOY_RIGHT
+ .byte $10 ; JOY_FIRE
+ .byte $00 ; JOY_FIRE2 not available
+ .byte $00 ; Future expansion
+ .byte $00 ; Future expansion
+
+; Jump table.
+
+ .addr INSTALL
+ .addr UNINSTALL
+ .addr COUNT
+ .addr READJOY
+ .addr 0 ; IRQ entry not used
+
+; ------------------------------------------------------------------------
+; Constants
+
+JOY_COUNT = 4 ; Number of joysticks we support
+
+
+; ------------------------------------------------------------------------
+; Data.
+
+
+.code
+
+; ------------------------------------------------------------------------
+; INSTALL routine. Is called after the driver is loaded into memory. If
+; possible, check if the hardware is present and determine the amount of
+; memory available.
+; Must return an JOY_ERR_xx code in a/x.
+;
+
+INSTALL:
+ lda #JOY_ERR_OK
+ ldx #0
+; rts ; Run into UNINSTALL instead
+
+; ------------------------------------------------------------------------
+; UNINSTALL routine. Is called before the driver is removed from memory.
+; Can do cleanup or whatever. Must not return anything.
+;
+
+UNINSTALL:
+ rts
+
+
+; ------------------------------------------------------------------------
+; COUNT: Return the total number of available joysticks in a/x.
+;
+
+COUNT:
+ lda #JOY_COUNT
+ ldx $fcd8
+ cpx #$a2
+ beq _400800
+ lsr a ; XL and newer machines only have 2 ports
+_400800:
+ ldx #0
+ rts
+
+; ------------------------------------------------------------------------
+; READ: Read a particular joystick passed in A.
+;
+
+READJOY:
+ and #3 ; fix joystick number
+ tax ; Joystick number (0-3) into X
+
+; Read joystick
+
+ lda STRIG0,x ; get button
+ asl a
+ asl a
+ asl a
+ asl a
+ ora STICK0,x ; add position information
+ eor #$1F
+ ldx #0 ; fix X
+ rts
diff --git a/libsrc/atari/joy_stat_stddrv.s b/libsrc/atari/joy_stat_stddrv.s
index dffe40ebf..cbaf344d0 100644
--- a/libsrc/atari/joy_stat_stddrv.s
+++ b/libsrc/atari/joy_stat_stddrv.s
@@ -7,8 +7,8 @@
;
.export _joy_static_stddrv
- .import _ataristd_joy
+ .import _atrstd_joy
.rodata
-_joy_static_stddrv := _ataristd_joy
+_joy_static_stddrv := _atrstd_joy
diff --git a/libsrc/atari/joy_stddrv.s b/libsrc/atari/joy_stddrv.s
index aec33bf57..f3ab74e7b 100644
--- a/libsrc/atari/joy_stddrv.s
+++ b/libsrc/atari/joy_stddrv.s
@@ -10,4 +10,4 @@
.rodata
-_joy_stddrv: .asciiz "ataristd.joy"
+_joy_stddrv: .asciiz "atrstd.joy"
diff --git a/libsrc/atari/tgi/atari10.s b/libsrc/atari/tgi/atari10.s
deleted file mode 100644
index 10271b7f0..000000000
--- a/libsrc/atari/tgi/atari10.s
+++ /dev/null
@@ -1,79 +0,0 @@
-;
-; Graphics driver for the 80x192x9 (CIO mode 10, ANTIC mode F, GTIA mode $80) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 10
-; X resolution
- x_res = 80
-; Y resolution
- y_res = 192
-; Number of colors
- colors = 9
-; Pixels per byte
- ppb = 2
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $0330 ; based on 4/3 display
-; Free memory needed
- mem_needed = 7147
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %11110000, %00001111
- masks: ; Color masks
- .byte $00, $11, $22, $33, $44, $55, $66, $77, $88
- bar_table: ; Mask table for BAR
- .byte %11111111, %00001111, %00000000
- default_palette:
- .byte $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A
-
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; Copy the palette
- ldy #colors - 1
-loop: lda (ptr1),y
- sta palette,y
- sta PCOLR0,y
- dey
- bpl loop
-
- ; Done, reset the error code
- lda #TGI_ERR_OK
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atari11.s b/libsrc/atari/tgi/atari11.s
deleted file mode 100644
index 74b7db3b9..000000000
--- a/libsrc/atari/tgi/atari11.s
+++ /dev/null
@@ -1,71 +0,0 @@
-;
-; Graphics driver for the 80x192x16h (CIO mode 11, ANTIC mode F, GTIA mode $C0) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 11
-; X resolution
- x_res = 80
-; Y resolution
- y_res = 192
-; Number of colors
- colors = 16
-; Pixels per byte
- ppb = 2
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $0330 ; based on 4/3 display
-; Free memory needed
- mem_needed = 7147
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %11110000, %00001111
- masks: ; Color masks
- .byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff
- bar_table: ; Mask table for BAR
- .byte %11111111, %00001111, %00000000
- default_palette:
- .byte $00, $10, $20, $30, $40, $50, $60, $70, $80, $90, $A0, $B0, $C0, $D0, $E0, $F0
-
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; No palettes
- lda #TGI_ERR_INV_FUNC
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atari14.s b/libsrc/atari/tgi/atari14.s
deleted file mode 100644
index e0ae9b579..000000000
--- a/libsrc/atari/tgi/atari14.s
+++ /dev/null
@@ -1,84 +0,0 @@
-;
-; Graphics driver for the 160x192x2 (CIO mode 14, ANTIC mode C) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 14
-; X resolution
- x_res = 160
-; Y resolution
- y_res = 192
-; Number of colors
- colors = 2
-; Pixels per byte
- ppb = 8
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $0198 ; based on 4/3 display
-; Free memory needed
- mem_needed = 3305
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
- masks: ; Color masks
- .byte %00000000, %11111111
- bar_table: ; Mask table for BAR
- .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
- default_palette:
- .byte $00, $0E
-
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; Copy the palette
- ldy #colors - 1
-loop: lda (ptr1),y
- sta palette,y
- dey
- bpl loop
-
- ; Get the color entries from the palette
- lda palette
- sta COLOR4
- lda palette + 1
- sta COLOR0
-
- ; Done, reset the error code
- lda #TGI_ERR_OK
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atari15.s b/libsrc/atari/tgi/atari15.s
deleted file mode 100644
index d1b85f39a..000000000
--- a/libsrc/atari/tgi/atari15.s
+++ /dev/null
@@ -1,88 +0,0 @@
-;
-; Graphics driver for the 160x192x2 (CIO mode 15, ANTIC mode E) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 15
-; X resolution
- x_res = 160
-; Y resolution
- y_res = 192
-; Number of colors
- colors = 4
-; Pixels per byte
- ppb = 4
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $0198 ; based on 4/3 display
-; Free memory needed
- mem_needed = 7147
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %11000000, %00110000, %00001100, %00000011
- masks: ; Color masks
- .byte %00000000, %01010101, %10101010, %11111111
- bar_table: ; Mask table for BAR
- .byte %11111111, %00111111, %00001111, %00000011, %00000000
- default_palette:
- .byte $00, $0E, $32, $96
-
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; Copy the palette
- ldy #colors - 1
-loop: lda (ptr1),y
- sta palette,y
- dey
- bpl loop
-
- ; Get the color entries from the palette
- lda palette
- sta COLOR4
- lda palette + 1
- sta COLOR0
- lda palette + 2
- sta COLOR1
- lda palette + 3
- sta COLOR2
-
- ; Done, reset the error code
- lda #TGI_ERR_OK
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atari3.s b/libsrc/atari/tgi/atari3.s
deleted file mode 100644
index 7cacc185b..000000000
--- a/libsrc/atari/tgi/atari3.s
+++ /dev/null
@@ -1,88 +0,0 @@
-;
-; Graphics driver for the 40x24x4 (CIO mode 3, ANTIC mode 8) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 3
-; X resolution
- x_res = 40
-; Y resolution
- y_res = 24
-; Number of colors
- colors = 4
-; Pixels per byte
- ppb = 4
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $00CC ; based on 4/3 display
-; Free memory needed
- mem_needed = 1
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %11000000, %00110000, %00001100, %00000011
- masks: ; Color masks
- .byte %00000000, %01010101, %10101010, %11111111
- bar_table: ; Mask table for BAR
- .byte %11111111, %00111111, %00001111, %00000011, %00000000
- default_palette:
- .byte $00, $0E, $32, $96
-
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; Copy the palette
- ldy #colors - 1
-loop: lda (ptr1),y
- sta palette,y
- dey
- bpl loop
-
- ; Get the color entries from the palette
- lda palette
- sta COLOR4
- lda palette + 1
- sta COLOR0
- lda palette + 2
- sta COLOR1
- lda palette + 3
- sta COLOR2
-
- ; Done, reset the error code
- lda #TGI_ERR_OK
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atari4.s b/libsrc/atari/tgi/atari4.s
deleted file mode 100644
index a37ec2fa3..000000000
--- a/libsrc/atari/tgi/atari4.s
+++ /dev/null
@@ -1,84 +0,0 @@
-;
-; Graphics driver for the 80x48x2 (CIO mode 4, ANTIC mode 9) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 4
-; X resolution
- x_res = 80
-; Y resolution
- y_res = 48
-; Number of colors
- colors = 2
-; Pixels per byte
- ppb = 8
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $00CC ; based on 4/3 display
-; Free memory needed
- mem_needed = 1
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
- masks: ; Color masks
- .byte %00000000, %11111111
- bar_table: ; Mask table for BAR
- .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
- default_palette:
- .byte $00, $0E
-
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; Copy the palette
- ldy #colors - 1
-loop: lda (ptr1),y
- sta palette,y
- dey
- bpl loop
-
- ; Get the color entries from the palette
- lda palette
- sta COLOR4
- lda palette + 1
- sta COLOR0
-
- ; Done, reset the error code
- lda #TGI_ERR_OK
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atari5.s b/libsrc/atari/tgi/atari5.s
deleted file mode 100644
index cf917d573..000000000
--- a/libsrc/atari/tgi/atari5.s
+++ /dev/null
@@ -1,88 +0,0 @@
-;
-; Graphics driver for the 80x48x4 (CIO mode 5, ANTIC mode A) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 5
-; X resolution
- x_res = 80
-; Y resolution
- y_res = 48
-; Number of colors
- colors = 4
-; Pixels per byte
- ppb = 4
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $00CC ; based on 4/3 display
-; Free memory needed
- mem_needed = 185
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %11000000, %00110000, %00001100, %00000011
- masks: ; Color masks
- .byte %00000000, %01010101, %10101010, %11111111
- bar_table: ; Mask table for BAR
- .byte %11111111, %00111111, %00001111, %00000011, %00000000
- default_palette:
- .byte $00, $0E, $32, $96
-
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; Copy the palette
- ldy #colors - 1
-loop: lda (ptr1),y
- sta palette,y
- dey
- bpl loop
-
- ; Get the color entries from the palette
- lda palette
- sta COLOR4
- lda palette + 1
- sta COLOR0
- lda palette + 2
- sta COLOR1
- lda palette + 3
- sta COLOR2
-
- ; Done, reset the error code
- lda #TGI_ERR_OK
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atari6.s b/libsrc/atari/tgi/atari6.s
deleted file mode 100644
index be9f6b779..000000000
--- a/libsrc/atari/tgi/atari6.s
+++ /dev/null
@@ -1,84 +0,0 @@
-;
-; Graphics driver for the 160x96x2 (CIO mode 6, ANTIC mode B) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 6
-; X resolution
- x_res = 160
-; Y resolution
- y_res = 96
-; Number of colors
- colors = 2
-; Pixels per byte
- ppb = 8
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $00CC ; based on 4/3 display
-; Free memory needed
- mem_needed = 1193
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
- masks: ; Color masks
- .byte %00000000, %11111111
- bar_table: ; Mask table for BAR
- .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
- default_palette:
- .byte $00, $0E
-
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; Copy the palette
- ldy #colors - 1
-loop: lda (ptr1),y
- sta palette,y
- dey
- bpl loop
-
- ; Get the color entries from the palette
- lda palette
- sta COLOR4
- lda palette + 1
- sta COLOR0
-
- ; Done, reset the error code
- lda #TGI_ERR_OK
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atari7.s b/libsrc/atari/tgi/atari7.s
deleted file mode 100644
index 6e9d49acb..000000000
--- a/libsrc/atari/tgi/atari7.s
+++ /dev/null
@@ -1,88 +0,0 @@
-;
-; Graphics driver for the 160x96x4 (CIO mode 7, ANTIC mode D) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 7
-; X resolution
- x_res = 160
-; Y resolution
- y_res = 96
-; Number of colors
- colors = 4
-; Pixels per byte
- ppb = 4
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $00CC ; based on 4/3 display
-; Free memory needed
- mem_needed = 3209
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %11000000, %00110000, %00001100, %00000011
- masks: ; Color masks
- .byte %00000000, %01010101, %10101010, %11111111
- bar_table: ; Mask table for BAR
- .byte %11111111, %00111111, %00001111, %00000011, %00000000
- default_palette:
- .byte $00, $0E, $32, $96
-
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; Copy the palette
- ldy #colors - 1
-loop: lda (ptr1),y
- sta palette,y
- dey
- bpl loop
-
- ; Get the color entries from the palette
- lda palette
- sta COLOR4
- lda palette + 1
- sta COLOR0
- lda palette + 2
- sta COLOR1
- lda palette + 3
- sta COLOR2
-
- ; Done, reset the error code
- lda #TGI_ERR_OK
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atari8.s b/libsrc/atari/tgi/atari8.s
deleted file mode 100644
index 7d2a63863..000000000
--- a/libsrc/atari/tgi/atari8.s
+++ /dev/null
@@ -1,83 +0,0 @@
-;
-; Graphics driver for the 320x192x2 (CIO mode 8, ANTIC mode F) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 8
-; X resolution
- x_res = 320
-; Y resolution
- y_res = 192
-; Number of colors
- colors = 2
-; Pixels per byte
- ppb = 8
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $00CC ; based on 4/3 display
-; Free memory needed
- mem_needed = 7147
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
- masks: ; Color masks
- .byte %00000000, %11111111
- bar_table: ; Mask table for BAR
- .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
- default_palette:
- .byte $00, $0E
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; Copy the palette
- ldy #colors - 1
-loop: lda (ptr1),y
- sta palette,y
- dey
- bpl loop
-
- ; Get the color entries from the palette
- lda palette
- sta COLOR2
- lda palette + 1
- sta COLOR1
-
- ; Done, reset the error code
- lda #TGI_ERR_OK
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atari9.s b/libsrc/atari/tgi/atari9.s
deleted file mode 100644
index 41c783de1..000000000
--- a/libsrc/atari/tgi/atari9.s
+++ /dev/null
@@ -1,71 +0,0 @@
-;
-; Graphics driver for the 80x192x16b (CIO mode 9, ANTIC mode F, GTIA mode $40) on the Atari.
-;
-; Fatih Aygun (2009)
-;
-
- .include "atari.inc"
- .include "zeropage.inc"
-
- .include "tgi-kernel.inc"
- .include "tgi-error.inc"
-
- .macpack generic
-
-; ******************************************************************************
-
- ; ----------------------------------------------------------------------
- ;
- ; Constants and tables
- ;
- ; ----------------------------------------------------------------------
-
-; Graphics mode
- grmode = 9
-; X resolution
- x_res = 80
-; Y resolution
- y_res = 192
-; Number of colors
- colors = 16
-; Pixels per byte
- ppb = 2
-; Screen memory size in bytes
- scrsize = x_res * y_res / ppb
-; Pixel aspect ratio
- aspect = $0330 ; based on 4/3 display
-; Free memory needed
- mem_needed = 7147
-; Number of screen pages
- pages = 1
-
-.rodata
- mask_table: ; Mask table to set pixels
- .byte %11110000, %00001111
- masks: ; Color masks
- .byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff
- bar_table: ; Mask table for BAR
- .byte %11111111, %00001111, %00000000
- default_palette:
- .byte $00, $0F, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E
-
-.code
-
-; ******************************************************************************
-
-.proc SETPALETTE
-
- ; ----------------------------------------------------------------------
- ;
- ; SETPALETTE: Set the palette (in ptr1)
- ;
- ; ----------------------------------------------------------------------
-
-.code
- ; No palettes
- lda #TGI_ERR_INV_FUNC
- sta error
- rts
-.endproc
-
-.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr10.s b/libsrc/atari/tgi/atr10.s
new file mode 100644
index 000000000..10271b7f0
--- /dev/null
+++ b/libsrc/atari/tgi/atr10.s
@@ -0,0 +1,79 @@
+;
+; Graphics driver for the 80x192x9 (CIO mode 10, ANTIC mode F, GTIA mode $80) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 10
+; X resolution
+ x_res = 80
+; Y resolution
+ y_res = 192
+; Number of colors
+ colors = 9
+; Pixels per byte
+ ppb = 2
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $0330 ; based on 4/3 display
+; Free memory needed
+ mem_needed = 7147
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %11110000, %00001111
+ masks: ; Color masks
+ .byte $00, $11, $22, $33, $44, $55, $66, $77, $88
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %00001111, %00000000
+ default_palette:
+ .byte $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A
+
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; Copy the palette
+ ldy #colors - 1
+loop: lda (ptr1),y
+ sta palette,y
+ sta PCOLR0,y
+ dey
+ bpl loop
+
+ ; Done, reset the error code
+ lda #TGI_ERR_OK
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr11.s b/libsrc/atari/tgi/atr11.s
new file mode 100644
index 000000000..74b7db3b9
--- /dev/null
+++ b/libsrc/atari/tgi/atr11.s
@@ -0,0 +1,71 @@
+;
+; Graphics driver for the 80x192x16h (CIO mode 11, ANTIC mode F, GTIA mode $C0) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 11
+; X resolution
+ x_res = 80
+; Y resolution
+ y_res = 192
+; Number of colors
+ colors = 16
+; Pixels per byte
+ ppb = 2
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $0330 ; based on 4/3 display
+; Free memory needed
+ mem_needed = 7147
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %11110000, %00001111
+ masks: ; Color masks
+ .byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %00001111, %00000000
+ default_palette:
+ .byte $00, $10, $20, $30, $40, $50, $60, $70, $80, $90, $A0, $B0, $C0, $D0, $E0, $F0
+
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; No palettes
+ lda #TGI_ERR_INV_FUNC
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr14.s b/libsrc/atari/tgi/atr14.s
new file mode 100644
index 000000000..e0ae9b579
--- /dev/null
+++ b/libsrc/atari/tgi/atr14.s
@@ -0,0 +1,84 @@
+;
+; Graphics driver for the 160x192x2 (CIO mode 14, ANTIC mode C) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 14
+; X resolution
+ x_res = 160
+; Y resolution
+ y_res = 192
+; Number of colors
+ colors = 2
+; Pixels per byte
+ ppb = 8
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $0198 ; based on 4/3 display
+; Free memory needed
+ mem_needed = 3305
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
+ masks: ; Color masks
+ .byte %00000000, %11111111
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
+ default_palette:
+ .byte $00, $0E
+
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; Copy the palette
+ ldy #colors - 1
+loop: lda (ptr1),y
+ sta palette,y
+ dey
+ bpl loop
+
+ ; Get the color entries from the palette
+ lda palette
+ sta COLOR4
+ lda palette + 1
+ sta COLOR0
+
+ ; Done, reset the error code
+ lda #TGI_ERR_OK
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr15.s b/libsrc/atari/tgi/atr15.s
new file mode 100644
index 000000000..d1b85f39a
--- /dev/null
+++ b/libsrc/atari/tgi/atr15.s
@@ -0,0 +1,88 @@
+;
+; Graphics driver for the 160x192x2 (CIO mode 15, ANTIC mode E) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 15
+; X resolution
+ x_res = 160
+; Y resolution
+ y_res = 192
+; Number of colors
+ colors = 4
+; Pixels per byte
+ ppb = 4
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $0198 ; based on 4/3 display
+; Free memory needed
+ mem_needed = 7147
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %11000000, %00110000, %00001100, %00000011
+ masks: ; Color masks
+ .byte %00000000, %01010101, %10101010, %11111111
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %00111111, %00001111, %00000011, %00000000
+ default_palette:
+ .byte $00, $0E, $32, $96
+
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; Copy the palette
+ ldy #colors - 1
+loop: lda (ptr1),y
+ sta palette,y
+ dey
+ bpl loop
+
+ ; Get the color entries from the palette
+ lda palette
+ sta COLOR4
+ lda palette + 1
+ sta COLOR0
+ lda palette + 2
+ sta COLOR1
+ lda palette + 3
+ sta COLOR2
+
+ ; Done, reset the error code
+ lda #TGI_ERR_OK
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr3.s b/libsrc/atari/tgi/atr3.s
new file mode 100644
index 000000000..7cacc185b
--- /dev/null
+++ b/libsrc/atari/tgi/atr3.s
@@ -0,0 +1,88 @@
+;
+; Graphics driver for the 40x24x4 (CIO mode 3, ANTIC mode 8) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 3
+; X resolution
+ x_res = 40
+; Y resolution
+ y_res = 24
+; Number of colors
+ colors = 4
+; Pixels per byte
+ ppb = 4
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $00CC ; based on 4/3 display
+; Free memory needed
+ mem_needed = 1
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %11000000, %00110000, %00001100, %00000011
+ masks: ; Color masks
+ .byte %00000000, %01010101, %10101010, %11111111
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %00111111, %00001111, %00000011, %00000000
+ default_palette:
+ .byte $00, $0E, $32, $96
+
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; Copy the palette
+ ldy #colors - 1
+loop: lda (ptr1),y
+ sta palette,y
+ dey
+ bpl loop
+
+ ; Get the color entries from the palette
+ lda palette
+ sta COLOR4
+ lda palette + 1
+ sta COLOR0
+ lda palette + 2
+ sta COLOR1
+ lda palette + 3
+ sta COLOR2
+
+ ; Done, reset the error code
+ lda #TGI_ERR_OK
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr4.s b/libsrc/atari/tgi/atr4.s
new file mode 100644
index 000000000..a37ec2fa3
--- /dev/null
+++ b/libsrc/atari/tgi/atr4.s
@@ -0,0 +1,84 @@
+;
+; Graphics driver for the 80x48x2 (CIO mode 4, ANTIC mode 9) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 4
+; X resolution
+ x_res = 80
+; Y resolution
+ y_res = 48
+; Number of colors
+ colors = 2
+; Pixels per byte
+ ppb = 8
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $00CC ; based on 4/3 display
+; Free memory needed
+ mem_needed = 1
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
+ masks: ; Color masks
+ .byte %00000000, %11111111
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
+ default_palette:
+ .byte $00, $0E
+
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; Copy the palette
+ ldy #colors - 1
+loop: lda (ptr1),y
+ sta palette,y
+ dey
+ bpl loop
+
+ ; Get the color entries from the palette
+ lda palette
+ sta COLOR4
+ lda palette + 1
+ sta COLOR0
+
+ ; Done, reset the error code
+ lda #TGI_ERR_OK
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr5.s b/libsrc/atari/tgi/atr5.s
new file mode 100644
index 000000000..cf917d573
--- /dev/null
+++ b/libsrc/atari/tgi/atr5.s
@@ -0,0 +1,88 @@
+;
+; Graphics driver for the 80x48x4 (CIO mode 5, ANTIC mode A) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 5
+; X resolution
+ x_res = 80
+; Y resolution
+ y_res = 48
+; Number of colors
+ colors = 4
+; Pixels per byte
+ ppb = 4
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $00CC ; based on 4/3 display
+; Free memory needed
+ mem_needed = 185
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %11000000, %00110000, %00001100, %00000011
+ masks: ; Color masks
+ .byte %00000000, %01010101, %10101010, %11111111
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %00111111, %00001111, %00000011, %00000000
+ default_palette:
+ .byte $00, $0E, $32, $96
+
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; Copy the palette
+ ldy #colors - 1
+loop: lda (ptr1),y
+ sta palette,y
+ dey
+ bpl loop
+
+ ; Get the color entries from the palette
+ lda palette
+ sta COLOR4
+ lda palette + 1
+ sta COLOR0
+ lda palette + 2
+ sta COLOR1
+ lda palette + 3
+ sta COLOR2
+
+ ; Done, reset the error code
+ lda #TGI_ERR_OK
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr6.s b/libsrc/atari/tgi/atr6.s
new file mode 100644
index 000000000..be9f6b779
--- /dev/null
+++ b/libsrc/atari/tgi/atr6.s
@@ -0,0 +1,84 @@
+;
+; Graphics driver for the 160x96x2 (CIO mode 6, ANTIC mode B) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 6
+; X resolution
+ x_res = 160
+; Y resolution
+ y_res = 96
+; Number of colors
+ colors = 2
+; Pixels per byte
+ ppb = 8
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $00CC ; based on 4/3 display
+; Free memory needed
+ mem_needed = 1193
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
+ masks: ; Color masks
+ .byte %00000000, %11111111
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
+ default_palette:
+ .byte $00, $0E
+
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; Copy the palette
+ ldy #colors - 1
+loop: lda (ptr1),y
+ sta palette,y
+ dey
+ bpl loop
+
+ ; Get the color entries from the palette
+ lda palette
+ sta COLOR4
+ lda palette + 1
+ sta COLOR0
+
+ ; Done, reset the error code
+ lda #TGI_ERR_OK
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr7.s b/libsrc/atari/tgi/atr7.s
new file mode 100644
index 000000000..6e9d49acb
--- /dev/null
+++ b/libsrc/atari/tgi/atr7.s
@@ -0,0 +1,88 @@
+;
+; Graphics driver for the 160x96x4 (CIO mode 7, ANTIC mode D) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 7
+; X resolution
+ x_res = 160
+; Y resolution
+ y_res = 96
+; Number of colors
+ colors = 4
+; Pixels per byte
+ ppb = 4
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $00CC ; based on 4/3 display
+; Free memory needed
+ mem_needed = 3209
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %11000000, %00110000, %00001100, %00000011
+ masks: ; Color masks
+ .byte %00000000, %01010101, %10101010, %11111111
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %00111111, %00001111, %00000011, %00000000
+ default_palette:
+ .byte $00, $0E, $32, $96
+
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; Copy the palette
+ ldy #colors - 1
+loop: lda (ptr1),y
+ sta palette,y
+ dey
+ bpl loop
+
+ ; Get the color entries from the palette
+ lda palette
+ sta COLOR4
+ lda palette + 1
+ sta COLOR0
+ lda palette + 2
+ sta COLOR1
+ lda palette + 3
+ sta COLOR2
+
+ ; Done, reset the error code
+ lda #TGI_ERR_OK
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr8.s b/libsrc/atari/tgi/atr8.s
new file mode 100644
index 000000000..7d2a63863
--- /dev/null
+++ b/libsrc/atari/tgi/atr8.s
@@ -0,0 +1,83 @@
+;
+; Graphics driver for the 320x192x2 (CIO mode 8, ANTIC mode F) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 8
+; X resolution
+ x_res = 320
+; Y resolution
+ y_res = 192
+; Number of colors
+ colors = 2
+; Pixels per byte
+ ppb = 8
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $00CC ; based on 4/3 display
+; Free memory needed
+ mem_needed = 7147
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
+ masks: ; Color masks
+ .byte %00000000, %11111111
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
+ default_palette:
+ .byte $00, $0E
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; Copy the palette
+ ldy #colors - 1
+loop: lda (ptr1),y
+ sta palette,y
+ dey
+ bpl loop
+
+ ; Get the color entries from the palette
+ lda palette
+ sta COLOR2
+ lda palette + 1
+ sta COLOR1
+
+ ; Done, reset the error code
+ lda #TGI_ERR_OK
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi/atr9.s b/libsrc/atari/tgi/atr9.s
new file mode 100644
index 000000000..41c783de1
--- /dev/null
+++ b/libsrc/atari/tgi/atr9.s
@@ -0,0 +1,71 @@
+;
+; Graphics driver for the 80x192x16b (CIO mode 9, ANTIC mode F, GTIA mode $40) on the Atari.
+;
+; Fatih Aygun (2009)
+;
+
+ .include "atari.inc"
+ .include "zeropage.inc"
+
+ .include "tgi-kernel.inc"
+ .include "tgi-error.inc"
+
+ .macpack generic
+
+; ******************************************************************************
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; Constants and tables
+ ;
+ ; ----------------------------------------------------------------------
+
+; Graphics mode
+ grmode = 9
+; X resolution
+ x_res = 80
+; Y resolution
+ y_res = 192
+; Number of colors
+ colors = 16
+; Pixels per byte
+ ppb = 2
+; Screen memory size in bytes
+ scrsize = x_res * y_res / ppb
+; Pixel aspect ratio
+ aspect = $0330 ; based on 4/3 display
+; Free memory needed
+ mem_needed = 7147
+; Number of screen pages
+ pages = 1
+
+.rodata
+ mask_table: ; Mask table to set pixels
+ .byte %11110000, %00001111
+ masks: ; Color masks
+ .byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff
+ bar_table: ; Mask table for BAR
+ .byte %11111111, %00001111, %00000000
+ default_palette:
+ .byte $00, $0F, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E
+
+.code
+
+; ******************************************************************************
+
+.proc SETPALETTE
+
+ ; ----------------------------------------------------------------------
+ ;
+ ; SETPALETTE: Set the palette (in ptr1)
+ ;
+ ; ----------------------------------------------------------------------
+
+.code
+ ; No palettes
+ lda #TGI_ERR_INV_FUNC
+ sta error
+ rts
+.endproc
+
+.include "atari_tgi_common.inc"
diff --git a/libsrc/atari/tgi_stat_stddrv.s b/libsrc/atari/tgi_stat_stddrv.s
index 05c570d7a..5f1be70f8 100644
--- a/libsrc/atari/tgi_stat_stddrv.s
+++ b/libsrc/atari/tgi_stat_stddrv.s
@@ -7,8 +7,8 @@
;
.export _tgi_static_stddrv
- .import _atari8_tgi
+ .import _atr8_tgi
.rodata
-_tgi_static_stddrv := _atari8_tgi
+_tgi_static_stddrv := _atr8_tgi
diff --git a/libsrc/atari/tgi_stddrv.s b/libsrc/atari/tgi_stddrv.s
index 94ced91d4..bec030511 100644
--- a/libsrc/atari/tgi_stddrv.s
+++ b/libsrc/atari/tgi_stddrv.s
@@ -10,4 +10,4 @@
.rodata
-_tgi_stddrv: .asciiz "atari8.tgi"
+_tgi_stddrv: .asciiz "atr8.tgi"