Removed (pretty inconsistently used) tab chars from source code base.

This commit is contained in:
Oliver Schmidt
2013-05-09 13:56:54 +02:00
parent 44fd1082ae
commit 85885001b1
1773 changed files with 62864 additions and 62868 deletions

View File

@@ -4,8 +4,8 @@
; Screen size variables
;
.export screensize
.include "atari.inc"
.export screensize
.include "atari.inc"
.proc screensize

View File

@@ -5,65 +5,65 @@
; void reset_brk (void);
;
.export _set_brk, _reset_brk
.destructor _reset_brk
.export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
.export _set_brk, _reset_brk
.destructor _reset_brk
.export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
.include "atari.inc"
.include "atari.inc"
.bss
_brk_a: .res 1
_brk_x: .res 1
_brk_y: .res 1
_brk_sr: .res 1
_brk_pc: .res 2
_brk_a: .res 1
_brk_x: .res 1
_brk_y: .res 1
_brk_sr: .res 1
_brk_pc: .res 2
oldvec: .res 2 ; Old vector
oldvec: .res 2 ; Old vector
.data
uservec: jmp $FFFF ; Patched at runtime
uservec: jmp $FFFF ; Patched at runtime
.code
; Set the break vector
.proc _set_brk
.proc _set_brk
sta uservec+1
stx uservec+2 ; Set the user vector
sta uservec+1
stx uservec+2 ; Set the user vector
lda oldvec
ora oldvec+1 ; Did we save the vector already?
bne L1 ; Jump if we installed the handler already
lda oldvec
ora oldvec+1 ; Did we save the vector already?
bne L1 ; Jump if we installed the handler already
lda VBREAK
sta oldvec
lda VBREAK+1
sta oldvec+1 ; Save the old vector
lda VBREAK
sta oldvec
lda VBREAK+1
sta oldvec+1 ; Save the old vector
L1: lda #<brk_handler ; Set the break vector to our routine
sta VBREAK
lda #>brk_handler
sta VBREAK+1
rts
L1: lda #<brk_handler ; Set the break vector to our routine
sta VBREAK
lda #>brk_handler
sta VBREAK+1
rts
.endproc
; Reset the break vector
.proc _reset_brk
.proc _reset_brk
lda oldvec
ldx oldvec+1
beq @L9 ; Jump if vector not installed
sta VBREAK
stx VBREAK+1
lda #$00
sta oldvec ; Clear the old vector
stx oldvec+1
@L9: rts
lda oldvec
ldx oldvec+1
beq @L9 ; Jump if vector not installed
sta VBREAK
stx VBREAK+1
lda #$00
sta oldvec ; Clear the old vector
stx oldvec+1
@L9: rts
.endproc
@@ -71,35 +71,35 @@ L1: lda #<brk_handler ; Set the break vector to our routine
; Break handler, called if a break occurs
.proc brk_handler
.proc brk_handler
sty _brk_y
stx _brk_x
pla
sta _brk_a
pla
and #$EF ; Clear break bit
sta _brk_sr
pla ; PC low
sec
sbc #2 ; Point to start of brk
sta _brk_pc
pla ; PC high
sbc #0
sta _brk_pc+1
sty _brk_y
stx _brk_x
pla
sta _brk_a
pla
and #$EF ; Clear break bit
sta _brk_sr
pla ; PC low
sec
sbc #2 ; Point to start of brk
sta _brk_pc
pla ; PC high
sbc #0
sta _brk_pc+1
jsr uservec ; Call the user's routine
jsr uservec ; Call the user's routine
lda _brk_pc+1
pha
lda _brk_pc
pha
lda _brk_sr
pha
ldx _brk_x
ldy _brk_y
lda _brk_a
rti ; Jump back...
lda _brk_pc+1
pha
lda _brk_pc
pha
lda _brk_sr
pha
ldx _brk_x
ldy _brk_y
lda _brk_a
rti ; Jump back...
.endproc

View File

@@ -5,25 +5,25 @@
; void cclear (unsigned char length);
;
.export _cclearxy, _cclear
.import popa, _gotoxy, cputdirect
.importzp tmp1
.export _cclearxy, _cclear
.import popa, _gotoxy, cputdirect
.importzp tmp1
_cclearxy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cclear
_cclear:
cmp #0 ; Is the length zero?
beq L9 ; Jump if done
sta tmp1
L1: lda #0 ; Blank - screen code
jsr cputdirect ; Direct output
dec tmp1
bne L1
L9: rts
cmp #0 ; Is the length zero?
beq L9 ; Jump if done
sta tmp1
L1: lda #0 ; Blank - screen code
jsr cputdirect ; Direct output
dec tmp1
bne L1
L9: rts

View File

@@ -5,61 +5,61 @@
; char cgetc(void)
;
.include "atari.inc"
.export _cgetc,setcursor
.import cursor,mul40
.include "atari.inc"
.export _cgetc,setcursor
.import cursor,mul40
_cgetc:
jsr setcursor
jsr @1
ldx #0
rts
jsr setcursor
jsr @1
ldx #0
rts
@1: lda KEYBDV+5
pha
lda KEYBDV+4
pha
lda #12
sta ICAX1Z ; fix problems with direct call to KEYBDV
rts
@1: lda KEYBDV+5
pha
lda KEYBDV+4
pha
lda #12
sta ICAX1Z ; fix problems with direct call to KEYBDV
rts
.proc setcursor
.proc setcursor
ldy #0
lda OLDCHR
sta (OLDADR),y
ldy #0
lda OLDCHR
sta (OLDADR),y
lda ROWCRS
jsr mul40
clc
adc SAVMSC ; add start of screen memory
sta OLDADR
txa
adc SAVMSC+1
sta OLDADR+1
lda COLCRS
adc OLDADR
sta OLDADR
bcc nc
inc OLDADR+1
nc: lda (OLDADR),y
sta OLDCHR
lda ROWCRS
jsr mul40
clc
adc SAVMSC ; add start of screen memory
sta OLDADR
txa
adc SAVMSC+1
sta OLDADR+1
lda COLCRS
adc OLDADR
sta OLDADR
bcc nc
inc OLDADR+1
nc: lda (OLDADR),y
sta OLDCHR
ldx cursor ; current cursor setting as requested by the user
beq off
ldx #0
beq cont
ldx cursor ; current cursor setting as requested by the user
beq off
ldx #0
beq cont
off: inx
cont: stx CRSINH ; update system variable
off: inx
cont: stx CRSINH ; update system variable
beq turnon
and #$7f ; clear high bit / inverse flag
finish: sta (OLDADR),y ; update on-screen display
rts
beq turnon
and #$7f ; clear high bit / inverse flag
finish: sta (OLDADR),y ; update on-screen display
rts
turnon: ora #$80 ; set high bit / inverse flag
bne finish
turnon: ora #$80 ; set high bit / inverse flag
bne finish
.endproc

View File

@@ -5,25 +5,25 @@
; void chline (unsigned char length);
;
.export _chlinexy, _chline
.import popa, _gotoxy, cputdirect, setcursor
.importzp tmp1
.export _chlinexy, _chline
.import popa, _gotoxy, cputdirect, setcursor
.importzp tmp1
_chlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length
_chline:
cmp #0 ; Is the length zero?
beq L9 ; Jump if done
sta tmp1
L1: lda #$12+64 ; Horizontal line, screen code
jsr cputdirect ; Direct output
dec tmp1
bne L1
L9: jmp setcursor
cmp #0 ; Is the length zero?
beq L9 ; Jump if done
sta tmp1
L1: lda #$12+64 ; Horizontal line, screen code
jsr cputdirect ; Direct output
dec tmp1
bne L1
L9: jmp setcursor

View File

@@ -6,37 +6,37 @@
; unsigned _clocks_per_sec (void);
;
.export _clock, __clocks_per_sec
.importzp sreg
.export _clock, __clocks_per_sec
.importzp sreg
.include "atari.inc"
.include "atari.inc"
.proc _clock
.proc _clock
ldx #5 ; Synchronize with Antic, so the interrupt won't change RTCLOK
stx WSYNC ; while we're reading it. The synchronization is done same as
@L1: dex ; in SETVBLV function in Atari OS.
bne @L1
stx sreg+1 ; Byte 3 is always zero
lda RTCLOK+2
ldx RTCLOK+1
ldy RTCLOK
sty sreg
rts
ldx #5 ; Synchronize with Antic, so the interrupt won't change RTCLOK
stx WSYNC ; while we're reading it. The synchronization is done same as
@L1: dex ; in SETVBLV function in Atari OS.
bne @L1
stx sreg+1 ; Byte 3 is always zero
lda RTCLOK+2
ldx RTCLOK+1
ldy RTCLOK
sty sreg
rts
.endproc
.proc __clocks_per_sec
.proc __clocks_per_sec
ldx #$00 ; Clear high byte of return value
lda PAL ; use hw register, PALNTS is only supported on XL/XE ROM
and #$0e
bne @NTSC
lda #50
rts
@NTSC: lda #60
rts
lda PAL ; use hw register, PALNTS is only supported on XL/XE ROM
and #$0e
bne @NTSC
lda #50
rts
@NTSC: lda #60
rts
.endproc

View File

@@ -4,26 +4,26 @@
; int __fastcall__ close(int fd);
;
.include "atari.inc"
.export _close
.import __do_oserror,popax,__oserror
.import fdtoiocb_down,__inviocb
.include "atari.inc"
.export _close
.import __do_oserror,popax,__oserror
.import fdtoiocb_down,__inviocb
.proc _close
jsr fdtoiocb_down ; get iocb index into X and decr. usage count
bmi inverr
bne ok ; not last one -> don't close yet
lda #CLOSE
sta ICCOM,x
jsr CIOV
bmi closerr
ok: ldx #0
stx __oserror ; clear system specific error code
txa
rts
.proc _close
jsr fdtoiocb_down ; get iocb index into X and decr. usage count
bmi inverr
bne ok ; not last one -> don't close yet
lda #CLOSE
sta ICCOM,x
jsr CIOV
bmi closerr
ok: ldx #0
stx __oserror ; clear system specific error code
txa
rts
inverr: jmp __inviocb
closerr:jmp __do_oserror
inverr: jmp __inviocb
closerr:jmp __do_oserror
.endproc

View File

@@ -4,33 +4,33 @@
; void clrscr (void);
;
.export _clrscr
.include "atari.inc"
.importzp ptr1
.import setcursor
.export _clrscr
.include "atari.inc"
.importzp ptr1
.import setcursor
_clrscr:lda SAVMSC ; screen memory
sta ptr1
lda SAVMSC+1
clc
adc #>(40*24)
sta ptr1+1
lda #0 ; screen code of space char
sta OLDCHR
ldy #<(40*24) ; 40x24: size of default atari screen
ldx #>(40*24)
_clr1: sta (ptr1),y
dey
bne _clr1
sta (ptr1),y
dex
bmi done
ldy ptr1+1
dey
sty ptr1+1
ldy #255
jmp _clr1
_clrscr:lda SAVMSC ; screen memory
sta ptr1
lda SAVMSC+1
clc
adc #>(40*24)
sta ptr1+1
lda #0 ; screen code of space char
sta OLDCHR
ldy #<(40*24) ; 40x24: size of default atari screen
ldx #>(40*24)
_clr1: sta (ptr1),y
dey
bne _clr1
sta (ptr1),y
dex
bmi done
ldy ptr1+1
dey
sty ptr1+1
ldy #255
jmp _clr1
done: sta COLCRS
sta ROWCRS
jmp setcursor
done: sta COLCRS
sta ROWCRS
jmp setcursor

View File

@@ -2,33 +2,33 @@
; Christian Groessler, 27-Dec-2002
;
.export _textcolor, _bgcolor, _bordercolor
.import return1
.export _textcolor, _bgcolor, _bordercolor
.import return1
.include "atari.inc"
.include "atari.inc"
_textcolor = return1
_textcolor = return1
_bgcolor:
ldx COLOR2 ; get old value
sta COLOR2 ; set new value
and #$0e
cmp #8
bcs bright
lda #$0e
.byte $2c ; bit opcode, eats the next 2 bytes
bright: lda #0
sta COLOR1
txa
ldx #0 ; fix X
rts
ldx COLOR2 ; get old value
sta COLOR2 ; set new value
and #$0e
cmp #8
bcs bright
lda #$0e
.byte $2c ; bit opcode, eats the next 2 bytes
bright: lda #0
sta COLOR1
txa
ldx #0 ; fix X
rts
_bordercolor:
ldx COLOR4 ; get old value
sta COLOR4 ; set new value
txa
ldx #0 ; fix X
rts
ldx COLOR4 ; get old value
sta COLOR4 ; set new value
txa
ldx #0 ; fix X
rts

View File

@@ -5,91 +5,91 @@
; void cputc (char c);
;
.export _cputcxy, _cputc
.export plot, cputdirect, putchar
.import popa, _gotoxy, mul40
.importzp tmp4,ptr4
.import _revflag,setcursor
.export _cputcxy, _cputc
.export plot, cputdirect, putchar
.import popa, _gotoxy, mul40
.importzp tmp4,ptr4
.import _revflag,setcursor
.include "atari.inc"
.include "atari.inc"
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
pla ; Restore C
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
pla ; Restore C
_cputc:
cmp #$0D ; CR
bne L4
lda #0
sta COLCRS
beq plot ; return
cmp #$0D ; CR
bne L4
lda #0
sta COLCRS
beq plot ; return
L4: cmp #$0A ; LF
beq newline
cmp #ATEOL ; Atari-EOL?
beq newline
L4: cmp #$0A ; LF
beq newline
cmp #ATEOL ; Atari-EOL?
beq newline
tay
rol a
rol a
rol a
rol a
and #3
tax
tya
and #$9f
ora ataint,x
tay
rol a
rol a
rol a
rol a
and #3
tax
tya
and #$9f
ora ataint,x
cputdirect: ; accepts screen code
jsr putchar
cputdirect: ; accepts screen code
jsr putchar
; advance cursor
inc COLCRS
lda COLCRS
cmp #40
bcc plot
lda #0
sta COLCRS
inc COLCRS
lda COLCRS
cmp #40
bcc plot
lda #0
sta COLCRS
.export newline
.export newline
newline:
inc ROWCRS
lda ROWCRS
cmp #24
bne plot
lda #0
sta ROWCRS
plot: jsr setcursor
ldy COLCRS
ldx ROWCRS
rts
inc ROWCRS
lda ROWCRS
cmp #24
bne plot
lda #0
sta ROWCRS
plot: jsr setcursor
ldy COLCRS
ldx ROWCRS
rts
; turn off cursor, update screen, turn on cursor
putchar:
pha ; save char
pha ; save char
ldy #0
lda OLDCHR
sta (OLDADR),y
ldy #0
lda OLDCHR
sta (OLDADR),y
lda ROWCRS
jsr mul40 ; destroys tmp4
clc
adc SAVMSC ; add start of screen memory
sta ptr4
txa
adc SAVMSC+1
sta ptr4+1
pla ; get char again
lda ROWCRS
jsr mul40 ; destroys tmp4
clc
adc SAVMSC ; add start of screen memory
sta ptr4
txa
adc SAVMSC+1
sta ptr4+1
pla ; get char again
ora _revflag
sta OLDCHR
ora _revflag
sta OLDCHR
ldy COLCRS
sta (ptr4),y
jmp setcursor
ldy COLCRS
sta (ptr4),y
jmp setcursor
.rodata
ataint: .byte 64,0,32,96
.rodata
ataint: .byte 64,0,32,96

View File

@@ -2,165 +2,165 @@
; Startup code for cc65 (ATARI version)
;
; Contributing authors:
; Mark Keates
; Freddy Offenga
; Christian Groessler
; Stefan Haubenthal
; Mark Keates
; Freddy Offenga
; Christian Groessler
; Stefan Haubenthal
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib
.import callmain, zerobss
.import __STARTUP_LOAD__, __ZPSAVE_LOAD__
.import __RESERVED_MEMORY__
.import initlib, donelib
.import callmain, zerobss
.import __STARTUP_LOAD__, __ZPSAVE_LOAD__
.import __RESERVED_MEMORY__
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
; ------------------------------------------------------------------------
; EXE header
.segment "EXEHDR"
.segment "EXEHDR"
.word $FFFF
.word __STARTUP_LOAD__
.word __ZPSAVE_LOAD__ - 1
.word $FFFF
.word __STARTUP_LOAD__
.word __ZPSAVE_LOAD__ - 1
; ------------------------------------------------------------------------
; Actual code
.segment "STARTUP"
.segment "STARTUP"
rts ; fix for SpartaDOS / OS/A+
; they first call the entry point from AUTOSTRT and
; then the load addess (this rts here).
; We point AUTOSTRT directly after the rts.
rts ; fix for SpartaDOS / OS/A+
; they first call the entry point from AUTOSTRT and
; then the load addess (this rts here).
; We point AUTOSTRT directly after the rts.
; Real entry point:
; Save the zero page locations we need
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x
dex
bpl L1
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x
dex
bpl L1
; Clear the BSS data
jsr zerobss
jsr zerobss
; Setup the stack
tsx
stx spsave
tsx
stx spsave
; Report memory usage
lda APPMHI
sta appmsav ; remember old APPMHI value
lda APPMHI+1
sta appmsav+1
lda APPMHI
sta appmsav ; remember old APPMHI value
lda APPMHI+1
sta appmsav+1
sec
lda MEMTOP
sbc #<__RESERVED_MEMORY__
sta APPMHI ; initialize our APPMHI value
sta sp ; setup runtime stack part 1
lda MEMTOP+1
sbc #>__RESERVED_MEMORY__
sta APPMHI+1
sta sp+1 ; setup runtime stack part 2
sec
lda MEMTOP
sbc #<__RESERVED_MEMORY__
sta APPMHI ; initialize our APPMHI value
sta sp ; setup runtime stack part 1
lda MEMTOP+1
sbc #>__RESERVED_MEMORY__
sta APPMHI+1
sta sp+1 ; setup runtime stack part 2
; Call module constructors
jsr initlib
jsr initlib
; Set left margin to 0
lda LMARGN
sta old_lmargin
ldy #0
sty LMARGN
lda LMARGN
sta old_lmargin
ldy #0
sty LMARGN
; Set keyb to upper/lowercase mode
ldx SHFLOK
stx old_shflok
sty SHFLOK
ldx SHFLOK
stx old_shflok
sty SHFLOK
; Initialize conio stuff
dey ; Set X to $FF
sty CH
dey ; Set X to $FF
sty CH
; Push arguments and call main
jsr callmain
jsr callmain
; Call module destructors. This is also the _exit entry.
_exit: jsr donelib ; Run module destructors
_exit: jsr donelib ; Run module destructors
; Restore system stuff
ldx spsave
txs ; Restore stack pointer
ldx spsave
txs ; Restore stack pointer
; Restore left margin
lda old_lmargin
sta LMARGN
lda old_lmargin
sta LMARGN
; Restore kb mode
lda old_shflok
sta SHFLOK
lda old_shflok
sta SHFLOK
; Restore APPMHI
lda appmsav
sta APPMHI
lda appmsav+1
sta APPMHI+1
lda appmsav
sta APPMHI
lda appmsav+1
sta APPMHI+1
; Copy back the zero page stuff
ldx #zpspace-1
L2: lda zpsave,x
sta sp,x
dex
bpl L2
ldx #zpspace-1
L2: lda zpsave,x
sta sp,x
dex
bpl L2
; Turn on cursor
inx
stx CRSINH
inx
stx CRSINH
; Back to DOS
rts
rts
; *** end of main startup code
; ------------------------------------------------------------------------
.segment "ZPSAVE"
.segment "ZPSAVE"
zpsave: .res zpspace
zpsave: .res zpspace
; ------------------------------------------------------------------------
.bss
spsave: .res 1
appmsav: .res 1
old_shflok: .res 1
old_lmargin: .res 1
spsave: .res 1
appmsav: .res 1
old_shflok: .res 1
old_lmargin: .res 1
.segment "AUTOSTRT"
.word RUNAD ; defined in atari.h
.word RUNAD+1
.word __STARTUP_LOAD__ + 1
.segment "AUTOSTRT"
.word RUNAD ; defined in atari.h
.word RUNAD+1
.word __STARTUP_LOAD__ + 1

View File

@@ -35,267 +35,267 @@
; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v')
; 7 - Space or tab character
.export __ctype
.export __ctype
__ctype:
.byte $00 ; 0/00 ___heart____
.byte $00 ; 1/01 ___l_tee____
.byte $00 ; 2/02 ___ctrl_B___
.byte $00 ; 3/03 ___ctrl_C___
.byte $00 ; 4/04 ___r_tee____
.byte $00 ; 5/05 ___ctrl_E___
.byte $00 ; 6/06 ___ctrl_F___
.byte $00 ; 7/07 ___ctrl_G___
.byte $00 ; 8/08 ___ctrl_H___
.byte $00 ; 9/09 ___ctrl_I___
.byte $00 ; 10/0a ___ctrl_J___
.byte $00 ; 11/0b ___ctrl_K___
.byte $00 ; 12/0c ___ctrl_L___
.byte $00 ; 13/0d ___ctrl_M___
.byte $00 ; 14/0e ___ctrl_N___
.byte $00 ; 15/0f ___ctrl_O___
.byte $00 ; 16/10 ____club____
.byte $00 ; 17/11 ___ctrl_Q___
.byte $00 ; 18/12 ___h_line___
.byte $00 ; 19/13 ___ctrl_S___
.byte $00 ; 20/14 ____ball____
.byte $00 ; 21/15 ___ctrl_U___
.byte $00 ; 22/16 ___ctrl_V___
.byte $00 ; 23/17 ___t_tee____
.byte $00 ; 24/18 ___b_tee____
.byte $00 ; 25/19 ___ctrl_Y___
.byte $00 ; 26/1a ___ctrl_Z___
.byte $10 ; 27/1b ____ESC_____
.byte $10 ; 28/1c ___crsr_up__
.byte $10 ; 29/1d ___crsr_dn__
.byte $10 ; 30/1e ___crsr_lf__
.byte $10 ; 31/1f ___crsr_rg__
.byte $A0 ; 32/20 ___SPACE___
.byte $00 ; 33/21 _____!_____
.byte $00 ; 34/22 _____"_____
.byte $00 ; 35/23 _____#_____
.byte $00 ; 36/24 _____$_____
.byte $00 ; 37/25 _____%_____
.byte $00 ; 38/26 _____&_____
.byte $00 ; 39/27 _____'_____
.byte $00 ; 40/28 _____(_____
.byte $00 ; 41/29 _____)_____
.byte $00 ; 42/2a _____*_____
.byte $00 ; 43/2b _____+_____
.byte $00 ; 44/2c _____,_____
.byte $00 ; 45/2d _____-_____
.byte $00 ; 46/2e _____._____
.byte $00 ; 47/2f _____/_____
.byte $0C ; 48/30 _____0_____
.byte $0C ; 49/31 _____1_____
.byte $0C ; 50/32 _____2_____
.byte $0C ; 51/33 _____3_____
.byte $0C ; 52/34 _____4_____
.byte $0C ; 53/35 _____5_____
.byte $0C ; 54/36 _____6_____
.byte $0C ; 55/37 _____7_____
.byte $0C ; 56/38 _____8_____
.byte $0C ; 57/39 _____9_____
.byte $00 ; 58/3a _____:_____
.byte $00 ; 59/3b _____;_____
.byte $00 ; 60/3c _____<_____
.byte $00 ; 61/3d _____=_____
.byte $00 ; 62/3e _____>_____
.byte $00 ; 63/3f _____?_____
.byte $00 ; 0/00 ___heart____
.byte $00 ; 1/01 ___l_tee____
.byte $00 ; 2/02 ___ctrl_B___
.byte $00 ; 3/03 ___ctrl_C___
.byte $00 ; 4/04 ___r_tee____
.byte $00 ; 5/05 ___ctrl_E___
.byte $00 ; 6/06 ___ctrl_F___
.byte $00 ; 7/07 ___ctrl_G___
.byte $00 ; 8/08 ___ctrl_H___
.byte $00 ; 9/09 ___ctrl_I___
.byte $00 ; 10/0a ___ctrl_J___
.byte $00 ; 11/0b ___ctrl_K___
.byte $00 ; 12/0c ___ctrl_L___
.byte $00 ; 13/0d ___ctrl_M___
.byte $00 ; 14/0e ___ctrl_N___
.byte $00 ; 15/0f ___ctrl_O___
.byte $00 ; 16/10 ____club____
.byte $00 ; 17/11 ___ctrl_Q___
.byte $00 ; 18/12 ___h_line___
.byte $00 ; 19/13 ___ctrl_S___
.byte $00 ; 20/14 ____ball____
.byte $00 ; 21/15 ___ctrl_U___
.byte $00 ; 22/16 ___ctrl_V___
.byte $00 ; 23/17 ___t_tee____
.byte $00 ; 24/18 ___b_tee____
.byte $00 ; 25/19 ___ctrl_Y___
.byte $00 ; 26/1a ___ctrl_Z___
.byte $10 ; 27/1b ____ESC_____
.byte $10 ; 28/1c ___crsr_up__
.byte $10 ; 29/1d ___crsr_dn__
.byte $10 ; 30/1e ___crsr_lf__
.byte $10 ; 31/1f ___crsr_rg__
.byte $A0 ; 32/20 ___SPACE___
.byte $00 ; 33/21 _____!_____
.byte $00 ; 34/22 _____"_____
.byte $00 ; 35/23 _____#_____
.byte $00 ; 36/24 _____$_____
.byte $00 ; 37/25 _____%_____
.byte $00 ; 38/26 _____&_____
.byte $00 ; 39/27 _____'_____
.byte $00 ; 40/28 _____(_____
.byte $00 ; 41/29 _____)_____
.byte $00 ; 42/2a _____*_____
.byte $00 ; 43/2b _____+_____
.byte $00 ; 44/2c _____,_____
.byte $00 ; 45/2d _____-_____
.byte $00 ; 46/2e _____._____
.byte $00 ; 47/2f _____/_____
.byte $0C ; 48/30 _____0_____
.byte $0C ; 49/31 _____1_____
.byte $0C ; 50/32 _____2_____
.byte $0C ; 51/33 _____3_____
.byte $0C ; 52/34 _____4_____
.byte $0C ; 53/35 _____5_____
.byte $0C ; 54/36 _____6_____
.byte $0C ; 55/37 _____7_____
.byte $0C ; 56/38 _____8_____
.byte $0C ; 57/39 _____9_____
.byte $00 ; 58/3a _____:_____
.byte $00 ; 59/3b _____;_____
.byte $00 ; 60/3c _____<_____
.byte $00 ; 61/3d _____=_____
.byte $00 ; 62/3e _____>_____
.byte $00 ; 63/3f _____?_____
.byte $00 ; 64/40 _____@_____
.byte $0A ; 65/41 _____A_____
.byte $0A ; 66/42 _____B_____
.byte $0A ; 67/43 _____C_____
.byte $0A ; 68/44 _____D_____
.byte $0A ; 69/45 _____E_____
.byte $0A ; 70/46 _____F_____
.byte $02 ; 71/47 _____G_____
.byte $02 ; 72/48 _____H_____
.byte $02 ; 73/49 _____I_____
.byte $02 ; 74/4a _____J_____
.byte $02 ; 75/4b _____K_____
.byte $02 ; 76/4c _____L_____
.byte $02 ; 77/4d _____M_____
.byte $02 ; 78/4e _____N_____
.byte $02 ; 79/4f _____O_____
.byte $02 ; 80/50 _____P_____
.byte $02 ; 81/51 _____Q_____
.byte $02 ; 82/52 _____R_____
.byte $02 ; 83/53 _____S_____
.byte $02 ; 84/54 _____T_____
.byte $02 ; 85/55 _____U_____
.byte $02 ; 86/56 _____V_____
.byte $02 ; 87/57 _____W_____
.byte $02 ; 88/58 _____X_____
.byte $02 ; 89/59 _____Y_____
.byte $02 ; 90/5a _____Z_____
.byte $00 ; 91/5b _____[_____
.byte $00 ; 92/5c _____\_____
.byte $00 ; 93/5d _____]_____
.byte $00 ; 94/5e _____^_____
.byte $00 ; 95/5f _UNDERLINE_
.byte $00 ; 96/60 __diamond__
.byte $09 ; 97/61 _____a_____
.byte $09 ; 98/62 _____b_____
.byte $09 ; 99/63 _____c_____
.byte $09 ; 100/64 _____d_____
.byte $09 ; 101/65 _____e_____
.byte $09 ; 102/66 _____f_____
.byte $01 ; 103/67 _____g_____
.byte $01 ; 104/68 _____h_____
.byte $01 ; 105/69 _____i_____
.byte $01 ; 106/6a _____j_____
.byte $01 ; 107/6b _____k_____
.byte $01 ; 108/6c _____l_____
.byte $01 ; 109/6d _____m_____
.byte $01 ; 110/6e _____n_____
.byte $01 ; 111/6f _____o_____
.byte $01 ; 112/70 _____p_____
.byte $01 ; 113/71 _____q_____
.byte $01 ; 114/72 _____r_____
.byte $01 ; 115/73 _____s_____
.byte $01 ; 116/74 _____t_____
.byte $01 ; 117/75 _____u_____
.byte $01 ; 118/76 _____v_____
.byte $01 ; 119/77 _____w_____
.byte $01 ; 120/78 _____x_____
.byte $01 ; 121/79 _____y_____
.byte $01 ; 122/7a _____z_____
.byte $00 ; 123/7b ___spade___
.byte $00 ; 124/7c __v_line___
.byte $10 ; 125/7d __CLRSCR___
.byte $D0 ; 126/7e __backtab__
.byte $D0 ; 127/7f ____tab____
.byte $00 ; 64/40 _____@_____
.byte $0A ; 65/41 _____A_____
.byte $0A ; 66/42 _____B_____
.byte $0A ; 67/43 _____C_____
.byte $0A ; 68/44 _____D_____
.byte $0A ; 69/45 _____E_____
.byte $0A ; 70/46 _____F_____
.byte $02 ; 71/47 _____G_____
.byte $02 ; 72/48 _____H_____
.byte $02 ; 73/49 _____I_____
.byte $02 ; 74/4a _____J_____
.byte $02 ; 75/4b _____K_____
.byte $02 ; 76/4c _____L_____
.byte $02 ; 77/4d _____M_____
.byte $02 ; 78/4e _____N_____
.byte $02 ; 79/4f _____O_____
.byte $02 ; 80/50 _____P_____
.byte $02 ; 81/51 _____Q_____
.byte $02 ; 82/52 _____R_____
.byte $02 ; 83/53 _____S_____
.byte $02 ; 84/54 _____T_____
.byte $02 ; 85/55 _____U_____
.byte $02 ; 86/56 _____V_____
.byte $02 ; 87/57 _____W_____
.byte $02 ; 88/58 _____X_____
.byte $02 ; 89/59 _____Y_____
.byte $02 ; 90/5a _____Z_____
.byte $00 ; 91/5b _____[_____
.byte $00 ; 92/5c _____\_____
.byte $00 ; 93/5d _____]_____
.byte $00 ; 94/5e _____^_____
.byte $00 ; 95/5f _UNDERLINE_
.byte $00 ; 96/60 __diamond__
.byte $09 ; 97/61 _____a_____
.byte $09 ; 98/62 _____b_____
.byte $09 ; 99/63 _____c_____
.byte $09 ; 100/64 _____d_____
.byte $09 ; 101/65 _____e_____
.byte $09 ; 102/66 _____f_____
.byte $01 ; 103/67 _____g_____
.byte $01 ; 104/68 _____h_____
.byte $01 ; 105/69 _____i_____
.byte $01 ; 106/6a _____j_____
.byte $01 ; 107/6b _____k_____
.byte $01 ; 108/6c _____l_____
.byte $01 ; 109/6d _____m_____
.byte $01 ; 110/6e _____n_____
.byte $01 ; 111/6f _____o_____
.byte $01 ; 112/70 _____p_____
.byte $01 ; 113/71 _____q_____
.byte $01 ; 114/72 _____r_____
.byte $01 ; 115/73 _____s_____
.byte $01 ; 116/74 _____t_____
.byte $01 ; 117/75 _____u_____
.byte $01 ; 118/76 _____v_____
.byte $01 ; 119/77 _____w_____
.byte $01 ; 120/78 _____x_____
.byte $01 ; 121/79 _____y_____
.byte $01 ; 122/7a _____z_____
.byte $00 ; 123/7b ___spade___
.byte $00 ; 124/7c __v_line___
.byte $10 ; 125/7d __CLRSCR___
.byte $D0 ; 126/7e __backtab__
.byte $D0 ; 127/7f ____tab____
.byte $00 ; 128/80 _inv_heart___
.byte $00 ; 129/81 _inv_l_tee___
.byte $00 ; 130/82 _inv_ctrl_B__
.byte $00 ; 131/83 _inv_ctrl_C__
.byte $00 ; 132/84 _inv_r_tee___
.byte $00 ; 133/85 _inv_ctrl_E__
.byte $00 ; 134/86 _inv_ctrl_F__
.byte $00 ; 135/87 _inv_ctrl_G__
.byte $00 ; 136/88 _inv_ctrl_H__
.byte $00 ; 137/89 _inv_ctrl_I__
.byte $00 ; 138/8a _inv_ctrl_J__
.byte $00 ; 139/8b _inv_ctrl_K__
.byte $00 ; 140/8c _inv_ctrl_L__
.byte $00 ; 141/8d _inv_ctrl_M__
.byte $00 ; 142/8e _inv_ctrl_N__
.byte $00 ; 143/8f _inv_ctrl_O__
.byte $00 ; 144/90 __inv__club__
.byte $00 ; 145/91 _inv_ctrl_Q__
.byte $00 ; 146/92 _inv_h_line__
.byte $00 ; 147/93 _inv_ctrl_S__
.byte $00 ; 148/94 __inv__ball__
.byte $00 ; 149/95 _inv_ctrl_U__
.byte $00 ; 150/96 _inv_ctrl_V__
.byte $00 ; 151/97 __inv_t_tee__
.byte $00 ; 152/98 __inv_b_tee__
.byte $00 ; 153/99 _inv_ctrl_Y__
.byte $00 ; 154/9a _inv_ctrl_Z__
.byte $50 ; 155/9b _____EOL_____
.byte $10 ; 156/9c ___CLRLINE___
.byte $10 ; 157/9d ___INSLINE___
.byte $10 ; 158/9e ____CLRTAB___
.byte $10 ; 159/9f ____INSTAB___
.byte $A0 ; 160/a0 __inv_SPACE__
.byte $00 ; 161/a1 ___inv_!_____
.byte $00 ; 162/a2 ___inv_"_____
.byte $00 ; 163/a3 ___inv_#_____
.byte $00 ; 164/a4 ___inv_$_____
.byte $00 ; 165/a5 ___inv_%_____
.byte $00 ; 166/a6 ___inv_&_____
.byte $00 ; 167/a7 ___inv_'_____
.byte $00 ; 168/a8 ___inv_(_____
.byte $00 ; 169/a9 ___inv_)_____
.byte $00 ; 170/aa ___inv_*_____
.byte $00 ; 171/ab ___inv_+_____
.byte $00 ; 172/ac ___inv_,_____
.byte $00 ; 173/ad ___inv_-_____
.byte $00 ; 174/ae ___inv_._____
.byte $00 ; 175/af ___inv_/_____
.byte $0C ; 176/b0 ___inv_0_____
.byte $0C ; 177/b1 ___inv_1_____
.byte $0C ; 178/b2 ___inv_2_____
.byte $0C ; 179/b3 ___inv_3_____
.byte $0C ; 180/b4 ___inv_4_____
.byte $0C ; 181/b5 ___inv_5_____
.byte $0C ; 182/b6 ___inv_6_____
.byte $0C ; 183/b7 ___inv_7_____
.byte $0C ; 184/b8 ___inv_8_____
.byte $0C ; 185/b9 ___inv_9_____
.byte $00 ; 186/ba ___inv_:_____
.byte $00 ; 187/bb ___inv_;_____
.byte $00 ; 188/bc ___inv_<_____
.byte $00 ; 189/bd ___inv_=_____
.byte $00 ; 190/be ___inv_>_____
.byte $00 ; 191/bf ___inv_?_____
.byte $00 ; 128/80 _inv_heart___
.byte $00 ; 129/81 _inv_l_tee___
.byte $00 ; 130/82 _inv_ctrl_B__
.byte $00 ; 131/83 _inv_ctrl_C__
.byte $00 ; 132/84 _inv_r_tee___
.byte $00 ; 133/85 _inv_ctrl_E__
.byte $00 ; 134/86 _inv_ctrl_F__
.byte $00 ; 135/87 _inv_ctrl_G__
.byte $00 ; 136/88 _inv_ctrl_H__
.byte $00 ; 137/89 _inv_ctrl_I__
.byte $00 ; 138/8a _inv_ctrl_J__
.byte $00 ; 139/8b _inv_ctrl_K__
.byte $00 ; 140/8c _inv_ctrl_L__
.byte $00 ; 141/8d _inv_ctrl_M__
.byte $00 ; 142/8e _inv_ctrl_N__
.byte $00 ; 143/8f _inv_ctrl_O__
.byte $00 ; 144/90 __inv__club__
.byte $00 ; 145/91 _inv_ctrl_Q__
.byte $00 ; 146/92 _inv_h_line__
.byte $00 ; 147/93 _inv_ctrl_S__
.byte $00 ; 148/94 __inv__ball__
.byte $00 ; 149/95 _inv_ctrl_U__
.byte $00 ; 150/96 _inv_ctrl_V__
.byte $00 ; 151/97 __inv_t_tee__
.byte $00 ; 152/98 __inv_b_tee__
.byte $00 ; 153/99 _inv_ctrl_Y__
.byte $00 ; 154/9a _inv_ctrl_Z__
.byte $50 ; 155/9b _____EOL_____
.byte $10 ; 156/9c ___CLRLINE___
.byte $10 ; 157/9d ___INSLINE___
.byte $10 ; 158/9e ____CLRTAB___
.byte $10 ; 159/9f ____INSTAB___
.byte $A0 ; 160/a0 __inv_SPACE__
.byte $00 ; 161/a1 ___inv_!_____
.byte $00 ; 162/a2 ___inv_"_____
.byte $00 ; 163/a3 ___inv_#_____
.byte $00 ; 164/a4 ___inv_$_____
.byte $00 ; 165/a5 ___inv_%_____
.byte $00 ; 166/a6 ___inv_&_____
.byte $00 ; 167/a7 ___inv_'_____
.byte $00 ; 168/a8 ___inv_(_____
.byte $00 ; 169/a9 ___inv_)_____
.byte $00 ; 170/aa ___inv_*_____
.byte $00 ; 171/ab ___inv_+_____
.byte $00 ; 172/ac ___inv_,_____
.byte $00 ; 173/ad ___inv_-_____
.byte $00 ; 174/ae ___inv_._____
.byte $00 ; 175/af ___inv_/_____
.byte $0C ; 176/b0 ___inv_0_____
.byte $0C ; 177/b1 ___inv_1_____
.byte $0C ; 178/b2 ___inv_2_____
.byte $0C ; 179/b3 ___inv_3_____
.byte $0C ; 180/b4 ___inv_4_____
.byte $0C ; 181/b5 ___inv_5_____
.byte $0C ; 182/b6 ___inv_6_____
.byte $0C ; 183/b7 ___inv_7_____
.byte $0C ; 184/b8 ___inv_8_____
.byte $0C ; 185/b9 ___inv_9_____
.byte $00 ; 186/ba ___inv_:_____
.byte $00 ; 187/bb ___inv_;_____
.byte $00 ; 188/bc ___inv_<_____
.byte $00 ; 189/bd ___inv_=_____
.byte $00 ; 190/be ___inv_>_____
.byte $00 ; 191/bf ___inv_?_____
.byte $00 ; 192/c0 ___inv_@_____
.byte $0A ; 193/c1 ___inv_A_____
.byte $0A ; 194/c2 ___inv_B_____
.byte $0A ; 195/c3 ___inv_C_____
.byte $0A ; 196/c4 ___inv_D_____
.byte $0A ; 197/c5 ___inv_E_____
.byte $0A ; 198/c6 ___inv_F_____
.byte $02 ; 199/c7 ___inv_G_____
.byte $02 ; 200/c8 ___inv_H_____
.byte $02 ; 201/c9 ___inv_I_____
.byte $02 ; 202/ca ___inv_J_____
.byte $02 ; 203/cb ___inv_K_____
.byte $02 ; 204/cc ___inv_L_____
.byte $02 ; 205/cd ___inv_M_____
.byte $02 ; 206/ce ___inv_N_____
.byte $02 ; 207/cf ___inv_O_____
.byte $02 ; 208/d0 ___inv_P_____
.byte $02 ; 209/d1 ___inv_Q_____
.byte $02 ; 210/d2 ___inv_R_____
.byte $02 ; 211/d3 ___inv_S_____
.byte $02 ; 212/d4 ___inv_T_____
.byte $02 ; 213/d5 ___inv_U_____
.byte $02 ; 214/d6 ___inv_V_____
.byte $02 ; 215/d7 ___inv_W_____
.byte $02 ; 216/d8 ___inv_X_____
.byte $02 ; 217/d9 ___inv_Y_____
.byte $02 ; 218/da ___inv_Z_____
.byte $00 ; 219/db ___inv_[_____
.byte $00 ; 220/dc ___inv_\_____
.byte $00 ; 221/dd ___inv_]_____
.byte $00 ; 222/de ___inv_^_____
.byte $00 ; 223/df _inv_UNDRLIN_
.byte $00 ; 224/e0 _inv_diamond_
.byte $09 ; 225/e1 ___inv_a_____
.byte $09 ; 226/e2 ___inv_b_____
.byte $09 ; 227/e3 ___inv_c_____
.byte $09 ; 228/e4 ___inv_d_____
.byte $09 ; 229/e5 ___inv_e_____
.byte $09 ; 230/e6 ___inv_f_____
.byte $01 ; 231/e7 ___inv_g_____
.byte $01 ; 232/e8 ___inv_h_____
.byte $01 ; 233/e9 ___inv_i_____
.byte $01 ; 234/ea ___inv_j_____
.byte $01 ; 235/eb ___inv_k_____
.byte $01 ; 236/ec ___inv_l_____
.byte $01 ; 237/ed ___inv_m_____
.byte $01 ; 238/ee ___inv_n_____
.byte $01 ; 239/ef ___inv_o_____
.byte $01 ; 240/f0 ___inv_p_____
.byte $01 ; 241/f1 ___inv_q_____
.byte $01 ; 242/f2 ___inv_r_____
.byte $01 ; 243/f3 ___inv_s_____
.byte $01 ; 244/f4 ___inv_t_____
.byte $01 ; 245/f5 ___inv_u_____
.byte $01 ; 246/f6 ___inv_v_____
.byte $01 ; 247/f7 ___inv_w_____
.byte $01 ; 248/f8 ___inv_x_____
.byte $01 ; 249/f9 ___inv_y_____
.byte $01 ; 250/fa ___inv_z_____
.byte $00 ; 251/fb __inv_spade__
.byte $00 ; 252/fc __inv_v_line_
.byte $10 ; 253/fd ____BEEP_____
.byte $10 ; 254/fe ____DELBS____
.byte $10 ; 255/ff ___INSERT____
.byte $00 ; 192/c0 ___inv_@_____
.byte $0A ; 193/c1 ___inv_A_____
.byte $0A ; 194/c2 ___inv_B_____
.byte $0A ; 195/c3 ___inv_C_____
.byte $0A ; 196/c4 ___inv_D_____
.byte $0A ; 197/c5 ___inv_E_____
.byte $0A ; 198/c6 ___inv_F_____
.byte $02 ; 199/c7 ___inv_G_____
.byte $02 ; 200/c8 ___inv_H_____
.byte $02 ; 201/c9 ___inv_I_____
.byte $02 ; 202/ca ___inv_J_____
.byte $02 ; 203/cb ___inv_K_____
.byte $02 ; 204/cc ___inv_L_____
.byte $02 ; 205/cd ___inv_M_____
.byte $02 ; 206/ce ___inv_N_____
.byte $02 ; 207/cf ___inv_O_____
.byte $02 ; 208/d0 ___inv_P_____
.byte $02 ; 209/d1 ___inv_Q_____
.byte $02 ; 210/d2 ___inv_R_____
.byte $02 ; 211/d3 ___inv_S_____
.byte $02 ; 212/d4 ___inv_T_____
.byte $02 ; 213/d5 ___inv_U_____
.byte $02 ; 214/d6 ___inv_V_____
.byte $02 ; 215/d7 ___inv_W_____
.byte $02 ; 216/d8 ___inv_X_____
.byte $02 ; 217/d9 ___inv_Y_____
.byte $02 ; 218/da ___inv_Z_____
.byte $00 ; 219/db ___inv_[_____
.byte $00 ; 220/dc ___inv_\_____
.byte $00 ; 221/dd ___inv_]_____
.byte $00 ; 222/de ___inv_^_____
.byte $00 ; 223/df _inv_UNDRLIN_
.byte $00 ; 224/e0 _inv_diamond_
.byte $09 ; 225/e1 ___inv_a_____
.byte $09 ; 226/e2 ___inv_b_____
.byte $09 ; 227/e3 ___inv_c_____
.byte $09 ; 228/e4 ___inv_d_____
.byte $09 ; 229/e5 ___inv_e_____
.byte $09 ; 230/e6 ___inv_f_____
.byte $01 ; 231/e7 ___inv_g_____
.byte $01 ; 232/e8 ___inv_h_____
.byte $01 ; 233/e9 ___inv_i_____
.byte $01 ; 234/ea ___inv_j_____
.byte $01 ; 235/eb ___inv_k_____
.byte $01 ; 236/ec ___inv_l_____
.byte $01 ; 237/ed ___inv_m_____
.byte $01 ; 238/ee ___inv_n_____
.byte $01 ; 239/ef ___inv_o_____
.byte $01 ; 240/f0 ___inv_p_____
.byte $01 ; 241/f1 ___inv_q_____
.byte $01 ; 242/f2 ___inv_r_____
.byte $01 ; 243/f3 ___inv_s_____
.byte $01 ; 244/f4 ___inv_t_____
.byte $01 ; 245/f5 ___inv_u_____
.byte $01 ; 246/f6 ___inv_v_____
.byte $01 ; 247/f7 ___inv_w_____
.byte $01 ; 248/f8 ___inv_x_____
.byte $01 ; 249/f9 ___inv_y_____
.byte $01 ; 250/fa ___inv_z_____
.byte $00 ; 251/fb __inv_spade__
.byte $00 ; 252/fc __inv_v_line_
.byte $10 ; 253/fd ____BEEP_____
.byte $10 ; 254/fe ____DELBS____
.byte $10 ; 255/ff ___INSERT____

View File

@@ -4,32 +4,32 @@
; void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
; void cvline (unsigned char length);
;
.include "atari.inc"
.export _cvlinexy, _cvline
.import popa, _gotoxy, putchar, setcursor
.importzp tmp1
.include "atari.inc"
.export _cvlinexy, _cvline
.import popa, _gotoxy, putchar, setcursor
.importzp tmp1
_cvlinexy:
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
pha ; Save the length
jsr popa ; Get y
jsr _gotoxy ; Call this one, will pop params
pla ; Restore the length and run into _cvline
_cvline:
cmp #0 ; Is the length zero?
beq L9 ; Jump if done
sta tmp1
L1: lda COLCRS
pha
lda #$7C ; Vertical bar
jsr putchar ; Write, no cursor advance
pla
sta COLCRS
inc ROWCRS
dec tmp1
bne L1
L9: jmp setcursor
cmp #0 ; Is the length zero?
beq L9 ; Jump if done
sta tmp1
L1: lda COLCRS
pha
lda #$7C ; Vertical bar
jsr putchar ; Write, no cursor advance
pla
sta COLCRS
inc ROWCRS
dec tmp1
bne L1
L9: jmp setcursor

View File

@@ -9,60 +9,60 @@
; sector number it got
;
; unsigned char __fastcall__ dio_phys_to_log(dhandle_t handle,
; dio_phys_pos *physpos, /* input */
; unsigned *sectnum); /* output */
; dio_phys_pos *physpos, /* input */
; unsigned *sectnum); /* output */
;
; dhandle_t - 16bit (ptr)
;
.export _dio_phys_to_log
.import popax,__oserror
.importzp ptr1,ptr2,ptr3
.include "atari.inc"
.export _dio_phys_to_log
.import popax,__oserror
.importzp ptr1,ptr2,ptr3
.include "atari.inc"
.proc _dio_phys_to_log
.proc _dio_phys_to_log
sta ptr1
stx ptr1+1 ; pointer to result
sta ptr1
stx ptr1+1 ; pointer to result
jsr popax
sta ptr2
stx ptr2+1 ; pointer to input structure
jsr popax
sta ptr2
stx ptr2+1 ; pointer to input structure
jsr popax
sta ptr3
stx ptr3+1 ; pointer to handle
jsr popax
sta ptr3
stx ptr3+1 ; pointer to handle
ldy #sst_flag
lda (ptr3),y
and #128
beq _inv_hand ; handle not open or invalid
ldy #sst_flag
lda (ptr3),y
and #128
beq _inv_hand ; handle not open or invalid
; ignore head and track and return the sector value
ldy #diopp_sector
lda (ptr2),y
tax
iny
lda (ptr2),y
ldy #1
sta (ptr1),y
dey
txa
sta (ptr1),y
ldy #diopp_sector
lda (ptr2),y
tax
iny
lda (ptr2),y
ldy #1
sta (ptr1),y
dey
txa
sta (ptr1),y
ldx #0
txa
ldx #0
txa
ret:
sta __oserror
rts ; return success
sta __oserror
rts ; return success
; invalid handle
_inv_hand:
ldx #0
lda #BADIOC
bne ret
ldx #0
lda #BADIOC
bne ret
.endproc

View File

@@ -8,65 +8,65 @@
; cylinder and head 0 and as sector the sectnum it got
;
; unsigned char __fastcall__ dio_log_to_phys(dhandle_t handle,
; unsigned *sectnum, /* input */
; dio_phys_pos *physpos); /* output */
; unsigned *sectnum, /* input */
; dio_phys_pos *physpos); /* output */
;
; dhandle_t - 16bit (ptr)
;
.export _dio_log_to_phys
.include "atari.inc"
.importzp ptr1,ptr2,ptr3
.import popax,__oserror
.export _dio_log_to_phys
.include "atari.inc"
.importzp ptr1,ptr2,ptr3
.import popax,__oserror
.proc _dio_log_to_phys
.proc _dio_log_to_phys
sta ptr2
stx ptr2+1 ; pointer to output structure
sta ptr2
stx ptr2+1 ; pointer to output structure
jsr popax
sta ptr1
stx ptr1+1 ; save pointer to input data
jsr popax
sta ptr1
stx ptr1+1 ; save pointer to input data
jsr popax
sta ptr3
stx ptr3+1 ; pointer to handle
jsr popax
sta ptr3
stx ptr3+1 ; pointer to handle
ldy #sst_flag
lda (ptr3),y
and #128
beq _inv_hand ; handle not open or invalid
ldy #sst_flag
lda (ptr3),y
and #128
beq _inv_hand ; handle not open or invalid
lda #0
tay
tax
sta (ptr2),y ; head
iny
sta (ptr2),y ; track (low)
iny
sta (ptr2),y ; track (high)
iny
lda #0
tay
tax
sta (ptr2),y ; head
iny
sta (ptr2),y ; track (low)
iny
sta (ptr2),y ; track (high)
iny
lda (ptr1,x)
sta (ptr2),y
iny
inc ptr1
bne _l1
inc ptr1+1
_l1: lda (ptr1,x)
sta (ptr2),y
lda (ptr1,x)
sta (ptr2),y
iny
inc ptr1
bne _l1
inc ptr1+1
_l1: lda (ptr1,x)
sta (ptr2),y
txa
txa
ret:
sta __oserror
rts ; return success
sta __oserror
rts ; return success
; invalid handle
_inv_hand:
ldx #0
lda #BADIOC
bne ret
ldx #0
lda #BADIOC
bne ret
.endproc

View File

@@ -8,156 +8,156 @@
; _dio_write functions. To query the sector size, the _dio_open
; accesses the disk drive.
;
; dhandle_t __fastcall__ dio_open (unsigned char device);
; dhandle_t __fastcall__ dio_open (unsigned char device);
; unsigned char __fastcall__ dio_close (dhandle_t handle);
;
.export _dio_open, _dio_close
.export sectsizetab
.import __oserror, __sio_call, _dio_read
.import pushax, addysp, subysp
.importzp ptr2, sp
.include "atari.inc"
.export _dio_open, _dio_close
.export sectsizetab
.import __oserror, __sio_call, _dio_read
.import pushax, addysp, subysp
.importzp ptr2, sp
.include "atari.inc"
.bss
sectsizetab:
.res NUMDRVS * sst_size
.res NUMDRVS * sst_size
.code
; code for _dio_open
_inv_drive:
lda #NONDEV ; non-existent device
sta __oserror
lda #0
tax
rts ; return NULL
lda #NONDEV ; non-existent device
sta __oserror
lda #0
tax
rts ; return NULL
_dio_open:
cmp #NUMDRVS ; valid drive id?
bcs _inv_drive
tay ; drive #
asl a ; make index from drive id
asl a
tax
lda #128 ; preset sectsize
sta sectsizetab+sst_sectsize,x
sta sectsizetab+sst_flag,x ; set flag that drive is "open"
lda #0
sta sectsizetab+sst_sectsize+1,x
sta __oserror ; success
tya
sta sectsizetab+sst_driveno,x
stx ptr2
lda #<sectsizetab
clc
adc ptr2
sta ptr2
lda #>sectsizetab
adc #0
tax
stx ptr2+1 ; ptr2: pointer to sectsizetab entry
cmp #NUMDRVS ; valid drive id?
bcs _inv_drive
tay ; drive #
asl a ; make index from drive id
asl a
tax
lda #128 ; preset sectsize
sta sectsizetab+sst_sectsize,x
sta sectsizetab+sst_flag,x ; set flag that drive is "open"
lda #0
sta sectsizetab+sst_sectsize+1,x
sta __oserror ; success
tya
sta sectsizetab+sst_driveno,x
stx ptr2
lda #<sectsizetab
clc
adc ptr2
sta ptr2
lda #>sectsizetab
adc #0
tax
stx ptr2+1 ; ptr2: pointer to sectsizetab entry
; query drive for current sector size
; procedure:
; - read sector #4 (SIO command $54) to update drive status;
; read length is 128 bytes, buffer is allocated on the stack,
; sector data is ignored;
; sector data is ignored;
; returned command status is ignored, we will get an error with
; a DD disk anyway (read size 128 vs. sector size 256);
; a DD disk anyway (read size 128 vs. sector size 256);
; - issue SIO command $53 (get status) to retrieve the sector size;
; use the DVSTAT system area as return buffer;
; if the command returns with an error, set sector size to 128
; bytes;
; bytes;
;
ldy #128
jsr subysp ; allocate buffer on the stack
ldy #128
jsr subysp ; allocate buffer on the stack
lda sp
pha
lda sp+1
pha ; save sp (buffer address) on processor stack
lda sp
pha
lda sp+1
pha ; save sp (buffer address) on processor stack
lda ptr2
ldx ptr2+1
jsr pushax ; handle
lda ptr2
ldx ptr2+1
jsr pushax ; handle
ldx #0
lda #4
jsr pushax ; sect_num
ldx #0
lda #4
jsr pushax ; sect_num
pla
tax
pla ; AX - buffer address
pla
tax
pla ; AX - buffer address
; sst_sectsize currently 128
jsr _dio_read ; read sector to update status
; sst_sectsize currently 128
jsr _dio_read ; read sector to update status
ldy #128
jsr addysp ; discard stack buffer
ldy #128
jsr addysp ; discard stack buffer
lda ptr2
ldx ptr2+1
jsr pushax ; handle
lda ptr2
ldx ptr2+1
jsr pushax ; handle
ldx #0
lda #4
jsr pushax ; dummy sector #, ignored by this SIO command,
; but set to circumvent the special 1-3 sector
; handling in __sio_call
ldx #0
lda #4
jsr pushax ; dummy sector #, ignored by this SIO command,
; but set to circumvent the special 1-3 sector
; handling in __sio_call
ldx #>DVSTAT
lda #<DVSTAT
jsr pushax ; buffer address
ldx #>DVSTAT
lda #<DVSTAT
jsr pushax ; buffer address
ldy #sst_sectsize
lda #4
sta (ptr2),y ; 4 bytes transfer
ldy #sst_sectsize
lda #4
sta (ptr2),y ; 4 bytes transfer
ldx #%01000000 ; direction value
lda #SIO_STAT ; get status
ldx #%01000000 ; direction value
lda #SIO_STAT ; get status
jsr __sio_call
jsr __sio_call
bmi error
bmi error
ldy #sst_sectsize
lda DVSTAT
and #%100000
beq s128
ldy #sst_sectsize
lda DVSTAT
and #%100000
beq s128
;s256
lda #0
sta (ptr2),y
iny
lda #1
lda #0
sta (ptr2),y
iny
lda #1
finish: sta (ptr2),y ; set default sector size
fini2: lda ptr2
ldx ptr2+1
rts
finish: sta (ptr2),y ; set default sector size
fini2: lda ptr2
ldx ptr2+1
rts
error: ldy #sst_sectsize
s128: lda #128
bne finish
error: ldy #sst_sectsize
s128: lda #128
bne finish
; end of _dio_open
.proc _dio_close
.proc _dio_close
sta ptr2
stx ptr2+1
lda #0
ldy #sst_flag
sta (ptr2),y
sta __oserror ; success
tax
rts ; return no error
sta ptr2
stx ptr2+1
lda #0
ldy #sst_flag
sta (ptr2),y
sta __oserror ; success
tax
rts ; return no error
.endproc

View File

@@ -4,24 +4,24 @@
; unsigned __fastcall__ dio_query_sectsize(dhandle_t handle);
;
.include "atari.inc"
.export _dio_query_sectsize
.importzp ptr1,tmp1
.import popax, __oserror
.include "atari.inc"
.export _dio_query_sectsize
.importzp ptr1,tmp1
.import popax, __oserror
.proc _dio_query_sectsize
.proc _dio_query_sectsize
sta ptr1 ; handle
stx ptr1+1
sta ptr1 ; handle
stx ptr1+1
lda #0
sta __oserror
lda #0
sta __oserror
ldy #sst_sectsize+1
lda (ptr1),y
tax
dey
lda (ptr1),y
rts
ldy #sst_sectsize+1
lda (ptr1),y
tax
dey
lda (ptr1),y
rts
.endproc

View File

@@ -7,16 +7,16 @@
; dhandle_t - 16bit (ptr)
;
.import __sio_call,pushax
.export _dio_read
.include "atari.inc"
.import __sio_call,pushax
.export _dio_read
.include "atari.inc"
.proc _dio_read
.proc _dio_read
jsr pushax ; push buffer address
ldx #%01000000 ; direction value
lda #SIO_READ ; read sector command
jmp __sio_call ; do the call and return to the user
jsr pushax ; push buffer address
ldx #%01000000 ; direction value
lda #SIO_READ ; read sector command
jmp __sio_call ; do the call and return to the user
.endproc

View File

@@ -7,16 +7,16 @@
; dhandle_t - 16bit (ptr)
;
.import __sio_call,pushax
.export _dio_write
.include "atari.inc"
.import __sio_call,pushax
.export _dio_write
.include "atari.inc"
.proc _dio_write
.proc _dio_write
jsr pushax ; push buffer address
ldx #%10000000 ; indicate i/o direction (write)
lda #SIO_WRITE ; write sector command
jmp __sio_call ; do the call and return to the user
jsr pushax ; push buffer address
ldx #%10000000 ; indicate i/o direction (write)
lda #SIO_WRITE ; write sector command
jmp __sio_call ; do the call and return to the user
.endproc

View File

@@ -7,16 +7,16 @@
; dhandle_t - 16bit (ptr)
;
.import __sio_call,pushax
.export _dio_write_verify
.include "atari.inc"
.import __sio_call,pushax
.export _dio_write_verify
.include "atari.inc"
.proc _dio_write_verify
.proc _dio_write_verify
jsr pushax ; push buffer address
ldx #%10000000 ; indicate i/o direction (write)
lda #SIO_WRITEV ; write sector command
jmp __sio_call ; do the call and return to the user
jsr pushax ; push buffer address
ldx #%10000000 ; indicate i/o direction (write)
lda #SIO_WRITEV ; write sector command
jmp __sio_call ; do the call and return to the user
.endproc

View File

@@ -3,10 +3,10 @@
; calling CIOV. It will return with AX set to -1 ($FFFF). It expects the CIO
; status in Y.
;
.include "errno.inc"
.include "errno.inc"
.export __do_oserror
.export __do_oserror
__do_oserror:
tya
jmp __mappederrno
tya
jmp __mappederrno

View File

@@ -4,50 +4,50 @@
; detect the DOS version we're running on
;
.include "atari.inc"
.constructor detect,26
.export __dos_type
.include "atari.inc"
.constructor detect,26
.export __dos_type
; ------------------------------------------------------------------------
; DOS type detection
.segment "INIT"
.segment "INIT"
detect: lda DOS
cmp #'S' ; SpartaDOS
beq spdos
cmp #'M' ; MyDOS
beq mydos
cmp #'X' ; XDOS
beq xdos
detect: lda DOS
cmp #'S' ; SpartaDOS
beq spdos
cmp #'M' ; MyDOS
beq mydos
cmp #'X' ; XDOS
beq xdos
lda #$4C ; probably default
ldy #COMTAB
cmp (DOSVEC),y
bne done
ldy #ZCRNAME
cmp (DOSVEC),y
bne done
lda #$4C ; probably default
ldy #COMTAB
cmp (DOSVEC),y
bne done
ldy #ZCRNAME
cmp (DOSVEC),y
bne done
ldy #6 ; OS/A+ has a jmp here
cmp (DOSVEC),y
beq done
lda #OSADOS
.byte $2C ; BIT <abs>
ldy #6 ; OS/A+ has a jmp here
cmp (DOSVEC),y
beq done
lda #OSADOS
.byte $2C ; BIT <abs>
spdos: lda #SPARTADOS
.byte $2C ; BIT <abs>
spdos: lda #SPARTADOS
.byte $2C ; BIT <abs>
mydos: lda #MYDOS
.byte $2C ; BIT <abs>
mydos: lda #MYDOS
.byte $2C ; BIT <abs>
xdos: lda #XDOS
sta __dos_type
done: rts
xdos: lda #XDOS
sta __dos_type
done: rts
; ------------------------------------------------------------------------
; Data
.bss
.bss
__dos_type: .res 1 ; default to ATARIDOS
__dos_type: .res 1 ; default to ATARIDOS

View File

@@ -24,13 +24,13 @@
; Ullrich von Bassewitz, 2002-12-02
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.macpack generic
.macpack generic
; ------------------------------------------------------------------------
@@ -40,19 +40,19 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
; Jump table.
.word INSTALL
.word DEINSTALL
.word PAGECOUNT
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYTO
.word INSTALL
.word DEINSTALL
.word PAGECOUNT
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
; Constants
@@ -69,50 +69,50 @@ PAGES = 256 ; 4 x 16k banks
banks: .byte $E3,$E7,$EB,$EF ; 130XE banks for cpu banking
stacktest: sei
ldy banks
sty $D301
tax ; A is set by caller
inx
stx $4000 ; change $4000
ldy #$FF ; STACK+13
sty $D301
cmp $4000 ; changed?
beq @1
sec ; error
bcs @2
ldy banks
sty $D301
tax ; A is set by caller
inx
stx $4000 ; change $4000
ldy #$FF ; STACK+13
sty $D301
cmp $4000 ; changed?
beq @1
sec ; error
bcs @2
@1: clc
@2: sta $4000 ; restore
cli
rts
cli
rts
stacktest_end:
stackcopy: sei ; disable interrupts
@1: dex ; pre-decrement (full page x=0)
ldy #$FF ; this will be replaced STACK+3
sty $D301 ; set bank
lda $FF00,x ; address to copy from STACK+8,+9
ldy #$FF ; this will be replaced STACK+11
sty $D301
sta $FF00,x ; address to copy to STACK+16,+17
cpx #0
bne @1
ldy #$FF ; portb_save STACK+23
sty $D301
cli ; enable interrupts
rts
ldy #$FF ; this will be replaced STACK+3
sty $D301 ; set bank
lda $FF00,x ; address to copy from STACK+8,+9
ldy #$FF ; this will be replaced STACK+11
sty $D301
sta $FF00,x ; address to copy to STACK+16,+17
cpx #0
bne @1
ldy #$FF ; portb_save STACK+23
sty $D301
cli ; enable interrupts
rts
stackcopy_end:
stackcopy_byte: sei
ldy #$FF ; STACK+2
sty $D301
lda $FFFF ; STACK+7 +8
ldy #$FF ; STACK+10
sty $D301
sta $FFFF ; STACK+15 +16
ldy #$FF ; STACK+18
sty $D301
cli
rts
ldy #$FF ; STACK+2
sty $D301
lda $FFFF ; STACK+7 +8
ldy #$FF ; STACK+10
sty $D301
sta $FFFF ; STACK+15 +16
ldy #$FF ; STACK+18
sty $D301
cli
rts
stackcopy_byte_end:
@@ -127,44 +127,44 @@ portb_save: .res 1 ; portb state
.code
install_transfer:
ldx #stackcopy_end - stackcopy - 1
ldx #stackcopy_end - stackcopy - 1
@1: lda stackcopy,x
sta STACK,x
dex
bpl @1
rts
sta STACK,x
dex
bpl @1
rts
install_byte_transfer:
ldx #stackcopy_byte_end - stackcopy_byte - 1
ldx #stackcopy_byte_end - stackcopy_byte - 1
@2: lda stackcopy_byte,x
sta STACK,x
dex
bpl @2
rts
sta STACK,x
dex
bpl @2
rts
install_test:
ldx #stacktest_end - stacktest - 1
ldx #stacktest_end - stacktest - 1
@3: lda stacktest,x
sta STACK,x
dex
bpl @3
rts
sta STACK,x
dex
bpl @3
rts
setpage:
tax ; save page
and #$C0 ; mask out bank
clc
ror
ror ; divide by 64
ror ; 64 pages in each bank
ror
ror
ror
sta curbank ; Remember the new bank
txa ; bring back page
and #$3F ; mask out page
sta curpage ; curpage in bank
rts
tax ; save page
and #$C0 ; mask out bank
clc
ror
ror ; divide by 64
ror ; 64 pages in each bank
ror
ror
ror
sta curbank ; Remember the new bank
txa ; bring back page
and #$3F ; mask out page
sta curpage ; curpage in bank
rts
; ------------------------------------------------------------------------
@@ -175,20 +175,20 @@ setpage:
;
INSTALL:
lda $D301 ; save state of portb
sta portb_save
tay
lda $D301 ; save state of portb
sta portb_save
tay
jsr install_test ; doesn't touch Y
sty STACK+13
jsr install_test ; doesn't touch Y
sty STACK+13
lda $4000 ; test for extended memory
jsr STACK
bcs @1
lda #EM_ERR_OK
rts
lda $4000 ; test for extended memory
jsr STACK
bcs @1
lda #EM_ERR_OK
rts
@1: lda #EM_ERR_NO_DEVICE
rts
rts
; ------------------------------------------------------------------------
; DEINSTALL routine. Is called before the driver is removed from memory.
@@ -196,7 +196,7 @@ INSTALL:
;
DEINSTALL:
rts
rts
; ------------------------------------------------------------------------
@@ -204,9 +204,9 @@ DEINSTALL:
;
PAGECOUNT:
lda #<PAGES
ldx #>PAGES
rts
lda #<PAGES
ldx #>PAGES
rts
; ------------------------------------------------------------------------
; MAP: Map the page in a/x into memory and return a pointer to the page in
@@ -215,96 +215,96 @@ PAGECOUNT:
;
MAP: jsr setpage ; extract the bank/page
add #>BANK ; $4000 + page (carry is cleared)
sta ptr1+1
;ldy #$00
;sty ptr1
add #>BANK ; $4000 + page (carry is cleared)
sta ptr1+1
;ldy #$00
;sty ptr1
lda #<window
sta ptr2
lda #>window
sta ptr2+1
lda #<window
sta ptr2
lda #>window
sta ptr2+1
; Transfer one page
jsr install_transfer ; Transfer one page
jsr install_transfer ; Transfer one page
ldx curbank
lda banks,x
sta STACK+3 ; set bank to copy from
ldx curbank
lda banks,x
sta STACK+3 ; set bank to copy from
; lda ptr1
; sta STACK+8
lda ptr1+1
sta STACK+9 ; set copy from address
lda portb_save
sta STACK+11 ; set portb restore
sta STACK+23 ; set final portb restore
lda ptr2
sta STACK+16
lda ptr2+1
sta STACK+17 ; set copy to address
lda ptr1+1
sta STACK+9 ; set copy from address
lda portb_save
sta STACK+11 ; set portb restore
sta STACK+23 ; set final portb restore
lda ptr2
sta STACK+16
lda ptr2+1
sta STACK+17 ; set copy to address
ldx #0 ; full page copy
jsr STACK ; do the copy!
ldx #0 ; full page copy
jsr STACK ; do the copy!
; Return the memory window
lda #<window
ldx #>window ; Return the window address
lda #<window
ldx #>window ; Return the window address
rts
rts
; ------------------------------------------------------------------------
; USE: Tell the driver that the window is now associated with a given page.
USE: ;sta curpage ; Remember the page
jsr setpage ; extract bank/page
lda #<window
ldx #>window ; Return the window
rts
jsr setpage ; extract bank/page
lda #<window
ldx #>window ; Return the window
rts
; ------------------------------------------------------------------------
; COMMIT: Commit changes in the memory window to extended storage.
COMMIT: lda curpage ; Get the current page
cmp #$FF
beq commit_done ; Jump if no page mapped
cmp #$FF
beq commit_done ; Jump if no page mapped
clc
add #>BANK
sta ptr2+1
;ldy #$00
;sty ptr2
clc
add #>BANK
sta ptr2+1
;ldy #$00
;sty ptr2
lda #<window
sta ptr1
lda #>window
sta ptr1+1
lda #<window
sta ptr1
lda #>window
sta ptr1+1
; Transfer one page/all bytes
jsr install_transfer ; Transfer one page
jsr install_transfer ; Transfer one page
lda portb_save
sta STACK+3 ; set bank to copy from
sta STACK+23 ; set final portb restore
lda ptr1
sta STACK+8
lda ptr1+1
sta STACK+9 ; set copy from address
ldx curbank
lda banks,x
sta STACK+11 ; set bank to copy to
;lda ptr2
;sta STACK+16
lda ptr2+1
sta STACK+17 ; set copy to address
lda portb_save
sta STACK+3 ; set bank to copy from
sta STACK+23 ; set final portb restore
lda ptr1
sta STACK+8
lda ptr1+1
sta STACK+9 ; set copy from address
ldx curbank
lda banks,x
sta STACK+11 ; set bank to copy to
;lda ptr2
;sta STACK+16
lda ptr2+1
sta STACK+17 ; set copy to address
ldx #0 ; full page copy
jsr STACK ; do the copy!
ldx #0 ; full page copy
jsr STACK ; do the copy!
commit_done:
rts
rts
; ------------------------------------------------------------------------
@@ -313,87 +313,87 @@ commit_done:
; The function must not return anything.
;
COPYFROM:
sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer
sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer
jsr install_byte_transfer ; install the stack copy routine
jsr install_byte_transfer ; install the stack copy routine
ldy #EM_COPY::OFFS
lda (ptr3),y
sta STACK+7 ; offset goes into BANK low
ldy #EM_COPY::OFFS
lda (ptr3),y
sta STACK+7 ; offset goes into BANK low
ldy #EM_COPY::PAGE
lda (ptr3),y
sta tmp1 ; save page for later
;add #>BANK
;sta STACK+8 ; BANK + page goes into BANK high
ldy #EM_COPY::PAGE
lda (ptr3),y
sta tmp1 ; save page for later
;add #>BANK
;sta STACK+8 ; BANK + page goes into BANK high
ldy #EM_COPY::BUF
lda (ptr3),y
sta STACK+15 ; buffer goes into dest low
iny
lda (ptr3),y
sta STACK+16 ; buffer goes into dest high
ldy #EM_COPY::BUF
lda (ptr3),y
sta STACK+15 ; buffer goes into dest low
iny
lda (ptr3),y
sta STACK+16 ; buffer goes into dest high
ldy #EM_COPY::COUNT
lda (ptr3),y ; Get bytes in last page
sta ptr4
iny
lda (ptr3),y ; Get number of pages
sta ptr4+1
ldy #EM_COPY::COUNT
lda (ptr3),y ; Get bytes in last page
sta ptr4
iny
lda (ptr3),y ; Get number of pages
sta ptr4+1
lda tmp1 ; extract bank/page
jsr setpage ; sets curbank/curpage
lda curpage
add #>BANK ; add to BANK address
sta STACK+8 ; current page in bank
ldx curbank
lda banks,x
sta STACK+2 ; set bank in stack
lda portb_save
sta STACK+10 ; set bank restore in stack
sta STACK+18 ; set final restore too
lda tmp1 ; extract bank/page
jsr setpage ; sets curbank/curpage
lda curpage
add #>BANK ; add to BANK address
sta STACK+8 ; current page in bank
ldx curbank
lda banks,x
sta STACK+2 ; set bank in stack
lda portb_save
sta STACK+10 ; set bank restore in stack
sta STACK+18 ; set final restore too
copyfrom_copy:
lda ptr4 ; check if count is zero
bne @4
lda ptr4+1
beq done
lda ptr4 ; check if count is zero
bne @4
lda ptr4+1
beq done
@4: jsr STACK ; copy one byte
sec
lda ptr4
sub #1
sta ptr4
bcs @1
lda ptr4+1
beq @1
sub #1
sta ptr4+1
sec
lda ptr4
sub #1
sta ptr4
bcs @1
lda ptr4+1
beq @1
sub #1
sta ptr4+1
@1: inc STACK+7 ; increment address in BANK
bne @2
inc STACK+8
lda STACK+8
cmp #$80 ; we stepped outside bank
bne @2
bne @2
inc STACK+8
lda STACK+8
cmp #$80 ; we stepped outside bank
bne @2
inc curbank ; get next bank
ldx curbank
lda banks,x
sta STACK+2 ; set new bank
lda #$40 ; set address back to $4000
sta STACK+8
inc curbank ; get next bank
ldx curbank
lda banks,x
sta STACK+2 ; set new bank
lda #$40 ; set address back to $4000
sta STACK+8
@2: inc STACK+15 ; increment buffer address
bne @3
inc STACK+16
bne @3
inc STACK+16
@3: jmp copyfrom_copy ; copy another byte
done:
rts
rts
; ------------------------------------------------------------------------
; COPYTO: Copy from linear into extended memory. A pointer to a structure
@@ -402,82 +402,82 @@ done:
;
COPYTO:
sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer
sta ptr3
stx ptr3+1 ; Save the passed em_copy pointer
jsr install_byte_transfer ; install the stack copy routine
jsr install_byte_transfer ; install the stack copy routine
ldy #EM_COPY::OFFS
lda (ptr3),y
sta STACK+15 ; offset goes into BANK low
ldy #EM_COPY::OFFS
lda (ptr3),y
sta STACK+15 ; offset goes into BANK low
ldy #EM_COPY::PAGE
lda (ptr3),y
sta tmp1 ; save page for later
;add #>BANK
;sta STACK+16 ; BANK + page goes into BANK high
ldy #EM_COPY::PAGE
lda (ptr3),y
sta tmp1 ; save page for later
;add #>BANK
;sta STACK+16 ; BANK + page goes into BANK high
ldy #EM_COPY::BUF
lda (ptr3),y
sta STACK+7 ; buffer goes into dest low
iny
lda (ptr3),y
sta STACK+8 ; buffer goes into dest high
ldy #EM_COPY::BUF
lda (ptr3),y
sta STACK+7 ; buffer goes into dest low
iny
lda (ptr3),y
sta STACK+8 ; buffer goes into dest high
ldy #EM_COPY::COUNT
lda (ptr3),y ; Get bytes in last page
sta ptr4
iny
lda (ptr3),y ; Get number of pages
sta ptr4+1
ldy #EM_COPY::COUNT
lda (ptr3),y ; Get bytes in last page
sta ptr4
iny
lda (ptr3),y ; Get number of pages
sta ptr4+1
lda tmp1 ; extract bank/page
jsr setpage ; sets curbank/curpage
lda curpage
add #>BANK ; add to BANK address
sta STACK+16 ; current page in bank
ldx curbank
lda banks,x
sta STACK+10 ; set bank in stack
lda portb_save
sta STACK+2 ; set bank restore in stack
sta STACK+18 ; set final restore too
lda tmp1 ; extract bank/page
jsr setpage ; sets curbank/curpage
lda curpage
add #>BANK ; add to BANK address
sta STACK+16 ; current page in bank
ldx curbank
lda banks,x
sta STACK+10 ; set bank in stack
lda portb_save
sta STACK+2 ; set bank restore in stack
sta STACK+18 ; set final restore too
copyto_copy:
lda ptr4 ; check if count is zero
bne @4
lda ptr4+1
beq done
lda ptr4 ; check if count is zero
bne @4
lda ptr4+1
beq done
@4: jsr STACK ; copy one byte
sec
lda ptr4
sub #1
sta ptr4
bcs @1
lda ptr4+1
beq @1
sub #1
sta ptr4+1
sec
lda ptr4
sub #1
sta ptr4
bcs @1
lda ptr4+1
beq @1
sub #1
sta ptr4+1
@1: inc STACK+15 ; increment address in BANK
bne @2
inc STACK+16
lda STACK+16
cmp #$80 ; we stepped outside bank
bne @2
bne @2
inc STACK+16
lda STACK+16
cmp #$80 ; we stepped outside bank
bne @2
inc curbank ; get next bank
ldx curbank
lda banks,x
sta STACK+10 ; set new bank
lda #$40 ; set address back to $4000
sta STACK+16
inc curbank ; get next bank
ldx curbank
lda banks,x
sta STACK+10 ; set new bank
lda #$40 ; set address back to $4000
sta STACK+16
@2: inc STACK+7 ; increment buffer address
bne @3
inc STACK+8
bne @3
inc STACK+8
@3: jmp copyto_copy ; copy another byte

View File

@@ -4,18 +4,18 @@
; offsets and defines for fdtable (internal use only)
;
MAX_FD_INDEX = 12 ; max. # of open fds
MAX_FD_VAL = 8 ; we have 8 IOCBs
MAX_FD_INDEX = 12 ; max. # of open fds
MAX_FD_VAL = 8 ; we have 8 IOCBs
ft_entrylen = 4 ; length of table entry (it's not sufficient to change here!
; the code sometimes does two bit shifts to multiply/divide by
; this length)
ft_entrylen = 4 ; length of table entry (it's not sufficient to change here!
; the code sometimes does two bit shifts to multiply/divide by
; this length)
ft_usa = 0 ; usage counter
ft_iocb = 1 ; iocb index (0,$10,$20,etc.), $ff for empty entry
ft_dev = 2 ; device of open iocb (0 - device not remembered, eg. filename specified)
ft_flag = 3 ; flags
; lower 3 bits: device number (for R: and D:)
; bit 3 - seeking supported by DOS/disk combination
; bit 4 - indicates a fd opened by the program as apposed to the
; inherited ones from program start (fd 0 to fd 2)
ft_usa = 0 ; usage counter
ft_iocb = 1 ; iocb index (0,$10,$20,etc.), $ff for empty entry
ft_dev = 2 ; device of open iocb (0 - device not remembered, eg. filename specified)
ft_flag = 3 ; flags
; lower 3 bits: device number (for R: and D:)
; bit 3 - seeking supported by DOS/disk combination
; bit 4 - indicates a fd opened by the program as apposed to the
; inherited ones from program start (fd 0 to fd 2)

View File

@@ -5,26 +5,26 @@
; the fdtable itself is defined here
;
.include "fd.inc"
.include "fd.inc"
.export fd_table,fd_index
.export ___fd_table,___fd_index ; for test(debug purposes only
.export fd_table,fd_index
.export ___fd_table,___fd_index ; for test(debug purposes only
.data
.data
___fd_index:
fd_index: ; fd number is index into this table, entry's value specifies the fd_table entry
.byte 0,0,0 ; at start, three first files are stdin/stdout/stderr.
.res MAX_FD_INDEX-3,$ff
fd_index: ; fd number is index into this table, entry's value specifies the fd_table entry
.byte 0,0,0 ; at start, three first files are stdin/stdout/stderr.
.res MAX_FD_INDEX-3,$ff
___fd_table:
fd_table: ; each entry represents an open iocb
.byte 3,0,'E',0 ; system console, app starts with opened iocb #0 for E:
.byte 0,$ff,0,0
.byte 0,$ff,0,0
.byte 0,$ff,0,0
.byte 0,$ff,0,0
.byte 0,$ff,0,0
.byte 0,$ff,0,0
.byte 0,$ff,0,0
fd_table: ; each entry represents an open iocb
.byte 3,0,'E',0 ; system console, app starts with opened iocb #0 for E:
.byte 0,$ff,0,0
.byte 0,$ff,0,0
.byte 0,$ff,0,0
.byte 0,$ff,0,0
.byte 0,$ff,0,0
.byte 0,$ff,0,0
.byte 0,$ff,0,0

View File

@@ -4,85 +4,85 @@
; fd indirection table & helper functions
;
.include "atari.inc"
.include "fd.inc"
.importzp tmp1,tmp2,tmp3,ptr4,sp
.import fd_table,fd_index
.import fdt_to_fdi
.export clriocb
.export fdtoiocb_down
.export findfreeiocb
.export fddecusage
.export newfd
.include "atari.inc"
.include "fd.inc"
.importzp tmp1,tmp2,tmp3,ptr4,sp
.import fd_table,fd_index
.import fdt_to_fdi
.export clriocb
.export fdtoiocb_down
.export findfreeiocb
.export fddecusage
.export newfd
.code
.code
; gets fd in ax, decrements usage counter
; return iocb index in X
; return N bit set for invalid fd
; return Z bit set if last user
; all registers destroyed
.proc fdtoiocb_down
.proc fdtoiocb_down
cpx #0
bne inval
cmp #MAX_FD_INDEX
bcs inval
tax
lda fd_index,x ; get index
tay
lda #$ff
sta fd_index,x ; clear entry
tya
asl a ; create index into fd table
asl a
tax
lda #$ff
cmp fd_table+ft_iocb,x ; entry in use?
beq inval ; no, return error
lda fd_table+ft_usa,x ; get usage counter
beq ok_notlast ; 0? (shouldn't happen)
sec
sbc #1 ; decr usage counter
sta fd_table+ft_usa,x
cpx #0
bne inval
cmp #MAX_FD_INDEX
bcs inval
tax
lda fd_index,x ; get index
tay
lda #$ff
sta fd_index,x ; clear entry
tya
asl a ; create index into fd table
asl a
tax
lda #$ff
cmp fd_table+ft_iocb,x ; entry in use?
beq inval ; no, return error
lda fd_table+ft_usa,x ; get usage counter
beq ok_notlast ; 0? (shouldn't happen)
sec
sbc #1 ; decr usage counter
sta fd_table+ft_usa,x
retiocb:php
txa
tay
lda fd_table+ft_iocb,x ; get iocb
tax
plp
bne cont
lda #$ff
sta fd_table+ft_iocb,y ; clear table entry
lda fd_table+ft_flag,y
and #16 ; opened by app?
eor #16 ; return set Z if yes
cont: rts
txa
tay
lda fd_table+ft_iocb,x ; get iocb
tax
plp
bne cont
lda #$ff
sta fd_table+ft_iocb,y ; clear table entry
lda fd_table+ft_flag,y
and #16 ; opened by app?
eor #16 ; return set Z if yes
cont: rts
ok_notlast:
lda #1 ; clears Z
jmp retiocb
lda #1 ; clears Z
jmp retiocb
.endproc ; fdtoiocb_down
.endproc ; fdtoiocb_down
inval: ldx #$ff ; sets N
rts
inval: ldx #$ff ; sets N
rts
; clear iocb except for ICHID field
; expects X to be index to IOCB (0,$10,$20,etc.)
; all registers destroyed
.proc clriocb
.proc clriocb
inx ; don't clear ICHID
ldy #15
lda #0
loop: sta ICHID,x
inx
dey
bne loop
rts
inx ; don't clear ICHID
ldy #15
lda #0
loop: sta ICHID,x
inx
dey
bne loop
rts
.endproc
@@ -93,57 +93,57 @@ loop: sta ICHID,x
; index in X if found
; all registers destroyed
.proc findfreeiocb
.proc findfreeiocb
ldx #0
ldy #$FF
loop: tya
cmp ICHID,x
beq found
txa
clc
adc #$10
tax
cmp #$80
bcc loop
inx ; return ZF cleared
found: rts
ldx #0
ldy #$FF
loop: tya
cmp ICHID,x
beq found
txa
clc
adc #$10
tax
cmp #$80
bcc loop
inx ; return ZF cleared
found: rts
.endproc ; findfreeiocb
.endproc ; findfreeiocb
; decrements usage counter for fd
; if 0 reached, it's marked as unused
; get fd index in tmp2
; Y register preserved
.proc fddecusage
.proc fddecusage
lda tmp2 ; get fd
cmp #MAX_FD_INDEX
bcs ret ; invalid index, do nothing
tax
lda fd_index,x
pha
lda #$ff
sta fd_index,x
pla
asl a ; create index into fd table
asl a
tax
lda #$ff
cmp fd_table+ft_iocb,x ; entry in use?
beq ret ; no, do nothing
lda fd_table+ft_usa,x ; get usage counter
beq ret ; 0? should not happen
sec
sbc #1 ; decrement by one
sta fd_table+ft_usa,x
bne ret ; not 0
lda #$ff ; 0, table entry unused now
sta fd_table+ft_iocb,x ; clear table entry
ret: rts
lda tmp2 ; get fd
cmp #MAX_FD_INDEX
bcs ret ; invalid index, do nothing
tax
lda fd_index,x
pha
lda #$ff
sta fd_index,x
pla
asl a ; create index into fd table
asl a
tax
lda #$ff
cmp fd_table+ft_iocb,x ; entry in use?
beq ret ; no, do nothing
lda fd_table+ft_usa,x ; get usage counter
beq ret ; 0? should not happen
sec
sbc #1 ; decrement by one
sta fd_table+ft_usa,x
bne ret ; not 0
lda #$ff ; 0, table entry unused now
sta fd_table+ft_iocb,x ; clear table entry
ret: rts
.endproc ; fddecusage
.endproc ; fddecusage
; newfd
@@ -156,198 +156,198 @@ ret: rts
; a link to this open device is returned
;
; Calling parameters:
; tmp3 - length of filename + 1
; AX - points to filename
; Y - iocb to use (if we need a new open)
; tmp3 - length of filename + 1
; AX - points to filename
; Y - iocb to use (if we need a new open)
; Return parameters:
; tmp2 - fd num ($ff and C=0 in case of error - no free slot)
; C - 0/1 for no open needed/open should be performed
; tmp2 - fd num ($ff and C=0 in case of error - no free slot)
; C - 0/1 for no open needed/open should be performed
; all registers preserved!
.bss
.bss
; local variables:
loc_Y: .res 1
loc_ptr4_l: .res 1
loc_ptr4_h: .res 1
loc_tmp1: .res 1
loc_devnum: .res 1
loc_size: .res 1
loc_Y: .res 1
loc_ptr4_l: .res 1
loc_ptr4_h: .res 1
loc_tmp1: .res 1
loc_devnum: .res 1
loc_size: .res 1
.code
.code
.proc newfd
.proc newfd
pha
txa
pha
tya
pha
pha
txa
pha
tya
pha
ldx #0
stx loc_devnum
lda tmp1
sta loc_tmp1
stx tmp1 ; init tmp1
stx tmp2 ; init tmp2
lda ptr4+1
sta loc_ptr4_h
lda ptr4
sta loc_ptr4_l
pla
sta loc_Y
pla
sta ptr4+1
pla
sta ptr4
ldx #0
stx loc_devnum
lda tmp1
sta loc_tmp1
stx tmp1 ; init tmp1
stx tmp2 ; init tmp2
lda ptr4+1
sta loc_ptr4_h
lda ptr4
sta loc_ptr4_l
pla
sta loc_Y
pla
sta ptr4+1
pla
sta ptr4
; ptr4 points to filename
; ptr4 points to filename
ldy #1
lda #':'
cmp (ptr4),y ; "X:"
beq colon1
iny
cmp (ptr4),y ; "Xn:"
beq colon2
ldy #1
lda #':'
cmp (ptr4),y ; "X:"
beq colon1
iny
cmp (ptr4),y ; "Xn:"
beq colon2
; no colon there!? OK, then we use a fresh iocb....
; return error here? no, the subsequent open call should fail
; no colon there!? OK, then we use a fresh iocb....
; return error here? no, the subsequent open call should fail
do_open_nd: ; do open and don't remember device
lda #2
sta tmp1
do_open:lda tmp1
ora #1
sta tmp1 ; set flag to return 'open needed' : C = 1
ldx #ft_iocb
ldy #$ff
do_open_nd: ; do open and don't remember device
lda #2
sta tmp1
do_open:lda tmp1
ora #1
sta tmp1 ; set flag to return 'open needed' : C = 1
ldx #ft_iocb
ldy #$ff
srchfree:
tya
cmp fd_table,x ; check ft_iocb field for $ff
beq freefnd ; found a free slot
txa
clc
adc #ft_entrylen
tax
cmp #(MAX_FD_VAL*4)+ft_iocb ; end of table reached?
bcc srchfree
tya
cmp fd_table,x ; check ft_iocb field for $ff
beq freefnd ; found a free slot
txa
clc
adc #ft_entrylen
tax
cmp #(MAX_FD_VAL*4)+ft_iocb ; end of table reached?
bcc srchfree
; error: no free slot found
noslot: ldx #0
stx tmp1 ; return with C = 0
dex
stx tmp2 ; iocb: $ff marks error
jmp finish
noslot: ldx #0
stx tmp1 ; return with C = 0
dex
stx tmp2 ; iocb: $ff marks error
jmp finish
; found a free slot
freefnd:txa
sec
sbc #ft_iocb ; normalize
tax
lsr a
lsr a
sta tmp2 ; return fd
lda #2
bit tmp1 ; remember device?
beq l1 ; yes
lda #0 ; no, put 0 in field
beq l2
sec
sbc #ft_iocb ; normalize
tax
lsr a
lsr a
sta tmp2 ; return fd
lda #2
bit tmp1 ; remember device?
beq l1 ; yes
lda #0 ; no, put 0 in field
beq l2
l1: ldy #0
lda (sp),y ; get device
l2: sta fd_table+ft_dev,x ; set device
lda #1
sta fd_table+ft_usa,x ; set usage counter
lda loc_Y
sta fd_table+ft_iocb,x ; set iocb index
lda loc_devnum
and #7 ; device number is 3 bits
ora #16 ; indicated a fd actively opened by the app
sta fd_table+ft_flag,x
lda tmp2
jsr fdt_to_fdi ; get new index
noslot1:bcs noslot ; no one available (noslot1: helper label for branch out of range)
;cmp #$ff ; no one available
;beq noslot ;@@@ cleanup needed
sta tmp2 ; return index
jmp finish
l1: ldy #0
lda (sp),y ; get device
l2: sta fd_table+ft_dev,x ; set device
lda #1
sta fd_table+ft_usa,x ; set usage counter
lda loc_Y
sta fd_table+ft_iocb,x ; set iocb index
lda loc_devnum
and #7 ; device number is 3 bits
ora #16 ; indicated a fd actively opened by the app
sta fd_table+ft_flag,x
lda tmp2
jsr fdt_to_fdi ; get new index
noslot1:bcs noslot ; no one available (noslot1: helper label for branch out of range)
;cmp #$ff ; no one available
;beq noslot ;@@@ cleanup needed
sta tmp2 ; return index
jmp finish
; string in "Xn:xxx" format
colon2: dey
lda (ptr4),y ; get device number
sec
sbc #'0'
and #7
sta loc_devnum
sta tmp2 ; save it for speed later here also
lda #4 ; max. length if only device + number ("Xn:")
cmp tmp3
bcc do_open_nd ; string is longer -> contains filename
bcs check_dev ; handle device only string
colon2: dey
lda (ptr4),y ; get device number
sec
sbc #'0'
and #7
sta loc_devnum
sta tmp2 ; save it for speed later here also
lda #4 ; max. length if only device + number ("Xn:")
cmp tmp3
bcc do_open_nd ; string is longer -> contains filename
bcs check_dev ; handle device only string
; string in "X:xxx" format
colon1: lda #3 ; max. length if device only ("X:")
cmp tmp3
bcc do_open_nd ; string is longer -> contains filename
colon1: lda #3 ; max. length if device only ("X:")
cmp tmp3
bcc do_open_nd ; string is longer -> contains filename
; get device and search it in fd table
check_dev:
ldy #0
lda (ptr4),y ; get device id
tay
ldx #(MAX_FD_VAL*4) - ft_entrylen
srchdev:lda #$ff
cmp fd_table+ft_iocb,x ; is entry valid?
beq srch2 ; no, skip this entry
tya
cmp fd_table+ft_dev,x
beq fnddev
srch2: txa
sec
sbc #ft_entrylen+1
tax
bpl srchdev
ldy #0
lda (ptr4),y ; get device id
tay
ldx #(MAX_FD_VAL*4) - ft_entrylen
srchdev:lda #$ff
cmp fd_table+ft_iocb,x ; is entry valid?
beq srch2 ; no, skip this entry
tya
cmp fd_table+ft_dev,x
beq fnddev
srch2: txa
sec
sbc #ft_entrylen+1
tax
bpl srchdev
; not found, open new iocb
jmp do_open
jmp do_open
; found device in table, check device number (e.g R0 - R3)
fnddev: lda fd_table+ft_flag,x
and #7
cmp tmp2 ; contains devnum
bne srch2 ; different device numbers
fnddev: lda fd_table+ft_flag,x
and #7
cmp tmp2 ; contains devnum
bne srch2 ; different device numbers
; found existing open iocb with same device
txa
lsr a
lsr a
sta tmp2
inc fd_table+ft_usa,x ; increment usage counter
jsr fdt_to_fdi ; get new index
bcs noslot1 ; no one available
sta tmp2 ; return index
txa
lsr a
lsr a
sta tmp2
inc fd_table+ft_usa,x ; increment usage counter
jsr fdt_to_fdi ; get new index
bcs noslot1 ; no one available
sta tmp2 ; return index
; clean up and go home
finish: lda ptr4
pha
lda ptr4+1
pha
lda loc_Y
pha
lda tmp1
pha
lda loc_tmp1
sta tmp1
pla
lsr a ; set C as needed
finish: lda ptr4
pha
lda ptr4+1
pha
lda loc_Y
pha
lda tmp1
pha
lda loc_tmp1
sta tmp1
pla
lsr a ; set C as needed
pla
tay
pla
tax
pla
rts
pla
tay
pla
tax
pla
rts
.endproc ; newfd
.endproc ; newfd

View File

@@ -5,37 +5,37 @@
; Convert file descriptor to IOCB number
;
.include "atari.inc"
.include "fd.inc"
.import fd_table,fd_index
.export fdtoiocb
.include "atari.inc"
.include "fd.inc"
.import fd_table,fd_index
.export fdtoiocb
.code
.code
; gets fd in ax
; return iocb index in A, fd_table index in X
; return N bit set for invalid fd
; all registers destroyed
.proc fdtoiocb
.proc fdtoiocb
cpx #0
bne inval
cmp #MAX_FD_INDEX
bcs inval
tax
lda fd_index,x
asl a ; create index into fd table
asl a
tax
lda #$ff
cmp fd_table+ft_iocb,x ; entry in use?
beq inval ; no, return error
lda fd_table+ft_usa,x ; get usage counter
beq inval ; 0? should not happen
lda fd_table+ft_iocb,x ; get iocb
rts
cpx #0
bne inval
cmp #MAX_FD_INDEX
bcs inval
tax
lda fd_index,x
asl a ; create index into fd table
asl a
tax
lda #$ff
cmp fd_table+ft_iocb,x ; entry in use?
beq inval ; no, return error
lda fd_table+ft_usa,x ; get usage counter
beq inval ; 0? should not happen
lda fd_table+ft_iocb,x ; get iocb
rts
inval: ldx #$ff ; sets N
rts
inval: ldx #$ff ; sets N
rts
.endproc ; fdtoiocb
.endproc ; fdtoiocb

View File

@@ -7,15 +7,15 @@
; startup code but is nevertheless included in the compiled program when
; needed.
MAXARGS = 16 ; max. amount of arguments in arg. table
CL_SIZE = 64 ; command line buffer size
SPACE = 32 ; SPACE char.
MAXARGS = 16 ; max. amount of arguments in arg. table
CL_SIZE = 64 ; command line buffer size
SPACE = 32 ; SPACE char.
.include "atari.inc"
.import __argc, __argv
.importzp ptr1
.import __dos_type
.constructor initmainargs,25
.include "atari.inc"
.import __argc, __argv
.importzp ptr1
.import __dos_type
.constructor initmainargs,25
; --------------------------------------------------------------------------
; Get command line
@@ -23,121 +23,121 @@ SPACE = 32 ; SPACE char.
.segment "INIT"
initmainargs:
lda #0
sta __argc
sta __argc+1
sta __argv
sta __argv+1
lda #0
sta __argc
sta __argc+1
sta __argv
sta __argv+1
lda __dos_type ; which DOS?
cmp #ATARIDOS
beq nargdos ; DOS does not support arguments
cmp #MYDOS
bne argdos ; DOS supports arguments
lda __dos_type ; which DOS?
cmp #ATARIDOS
beq nargdos ; DOS does not support arguments
cmp #MYDOS
bne argdos ; DOS supports arguments
nargdos:rts
; Initialize ourcl buffer
argdos: lda #ATEOL
sta ourcl+CL_SIZE
argdos: lda #ATEOL
sta ourcl+CL_SIZE
; Move SpartaDOS command line to our own buffer
lda DOSVEC
clc
adc #<LBUF
sta ptr1
lda DOSVEC+1
adc #>LBUF
sta ptr1+1
lda DOSVEC
clc
adc #<LBUF
sta ptr1
lda DOSVEC+1
adc #>LBUF
sta ptr1+1
ldy #0
cpcl: lda (ptr1),y
sta ourcl,y
iny
cmp #ATEOL
beq movdon
cpy #CL_SIZE
bne cpcl
ldy #0
cpcl: lda (ptr1),y
sta ourcl,y
iny
cmp #ATEOL
beq movdon
cpy #CL_SIZE
bne cpcl
movdon: lda #0
sta ourcl,y ; null terminate behind ATEOL
movdon: lda #0
sta ourcl,y ; null terminate behind ATEOL
; Turn command line into argv table
;ldy #0
tay
eatspc: lda ourcl,y ; eat spaces
cmp #ATEOL
beq finargs
cmp #SPACE
bne rpar ; begin of argument found
iny
cpy #CL_SIZE
bne eatspc
beq finargs ; only spaces is no argument
;ldy #0
tay
eatspc: lda ourcl,y ; eat spaces
cmp #ATEOL
beq finargs
cmp #SPACE
bne rpar ; begin of argument found
iny
cpy #CL_SIZE
bne eatspc
beq finargs ; only spaces is no argument
; Store argument vector
rpar: lda __argc ; low-byte
asl
tax ; table index
tya ; ourcl index
clc
adc #<ourcl
sta argv,x
lda #>ourcl
adc #0
sta argv+1,x
ldx __argc
inx
stx __argc
cpx #MAXARGS
beq finargs
rpar: lda __argc ; low-byte
asl
tax ; table index
tya ; ourcl index
clc
adc #<ourcl
sta argv,x
lda #>ourcl
adc #0
sta argv+1,x
ldx __argc
inx
stx __argc
cpx #MAXARGS
beq finargs
; Skip this arg.
skiparg:
ldx ourcl,y
cpx #ATEOL ; end of line?
beq eopar
cpx #SPACE
beq eopar
iny
cpy #CL_SIZE
bne skiparg
ldx ourcl,y
cpx #ATEOL ; end of line?
beq eopar
cpx #SPACE
beq eopar
iny
cpy #CL_SIZE
bne skiparg
; End of arg. -> place 0
eopar:
lda #0
sta ourcl,y
iny ; y behind arg.
cpx #ATEOL ; was it the last arg?
bne eatspc
lda #0
sta ourcl,y
iny ; y behind arg.
cpx #ATEOL ; was it the last arg?
bne eatspc
; Finish args
finargs:
lda __argc
asl
tax
lda #0
sta argv,x
sta argv+1,x
lda #<argv
ldx #>argv
sta __argv
stx __argv+1
rts
lda __argc
asl
tax
lda #0
sta argv,x
sta argv+1,x
lda #<argv
ldx #>argv
sta __argv
stx __argv+1
rts
; --------------------------------------------------------------------------
; Data
.bss
argv: .res (1 + MAXARGS) * 2
argv: .res (1 + MAXARGS) * 2
; Buffer for command line / argv strings
ourcl: .res CL_SIZE+1
ourcl: .res CL_SIZE+1

View File

@@ -14,77 +14,77 @@
; ZCRNAME is slightly different from SpartaDOS. It will convert D:
; into Dn: where n is the default drive.
.include "atari.inc"
.import __dos_type
.export __getdefdev ; get default device
.export __defdev ; this is the default device string (e.g. "D1:")
.ifdef DYNAMIC_DD
.constructor __getdefdev,24
.include "atari.inc"
.import __dos_type
.export __getdefdev ; get default device
.export __defdev ; this is the default device string (e.g. "D1:")
.ifdef DYNAMIC_DD
.constructor __getdefdev,24
.endif
; Get default device (LBUF will be destroyed!!)
__getdefdev:
lda __dos_type ; which DOS?
cmp #ATARIDOS
beq finish
cmp #MYDOS
beq finish
lda __dos_type ; which DOS?
cmp #ATARIDOS
beq finish
cmp #MYDOS
beq finish
ldy #BUFOFF
lda #0
sta (DOSVEC),y ; reset buffer offset
ldy #BUFOFF
lda #0
sta (DOSVEC),y ; reset buffer offset
; Store dummy argument
ldy #LBUF
lda #'X'
sta (DOSVEC),y
iny
lda #ATEOL
sta (DOSVEC),y
ldy #LBUF
lda #'X'
sta (DOSVEC),y
iny
lda #ATEOL
sta (DOSVEC),y
; One extra store to avoid the buggy sequence from OS/A+ DOS:
; <D><RETURN><:> => drive number = <RETURN>
iny
sta (DOSVEC),y
iny
sta (DOSVEC),y
; Create crunch vector
ldy #ZCRNAME+1
lda (DOSVEC),y
sta crvec+1
iny
lda (DOSVEC),y
sta crvec+2
ldy #ZCRNAME+1
lda (DOSVEC),y
sta crvec+1
iny
lda (DOSVEC),y
sta crvec+2
crvec: jsr $FFFF ; will be set to crunch vector
crvec: jsr $FFFF ; will be set to crunch vector
; Get default device
ldy #COMFNAM ; COMFNAM is always "Dn:"
lda (DOSVEC),y
sta __defdev
iny
lda (DOSVEC),y
sta __defdev+1
ldy #COMFNAM ; COMFNAM is always "Dn:"
lda (DOSVEC),y
sta __defdev
iny
lda (DOSVEC),y
sta __defdev+1
; Return pointer to default device
finish: lda #<__defdev
ldx #>__defdev
rts
finish: lda #<__defdev
ldx #>__defdev
rts
.data
.data
; Default device
__defdev:
.ifdef DEFAULT_DEVICE
.byte 'D', '0'+DEFAULT_DEVICE, ':', 0
.ifdef DEFAULT_DEVICE
.byte 'D', '0'+DEFAULT_DEVICE, ':', 0
.else
.byte "D1:", 0
.byte "D1:", 0
.endif

View File

@@ -4,15 +4,15 @@
; allocates a new fd in the indirection table
;
.include "atari.inc"
.include "fd.inc"
.include "_file.inc"
.importzp tmp1
.import fd_table, fd_index
.include "atari.inc"
.include "fd.inc"
.include "_file.inc"
.importzp tmp1
.import fd_table, fd_index
.export fdt_to_fdi,getfd
.export fdt_to_fdi,getfd
.code
.code
; fdt_to_fdi
; returns a fd_index entry pointing to the given ft_table entry
@@ -20,24 +20,24 @@
; return C = 0/1 for OK/error
; return fd_index entry in A if OK
; registers destroyed
.proc fdt_to_fdi
.proc fdt_to_fdi
tay
lda #$ff
tax
inx
loop: cmp fd_index,x
beq found
inx
cpx #MAX_FD_INDEX
bcc loop
rts
tay
lda #$ff
tax
inx
loop: cmp fd_index,x
beq found
inx
cpx #MAX_FD_INDEX
bcc loop
rts
found: tya
sta fd_index,x
txa
clc
rts
found: tya
sta fd_index,x
txa
clc
rts
.endproc
@@ -48,19 +48,19 @@ found: tya
; return C = 0/1 for OK/error
; returns fd in A if OK
; registers destroyed, tmp1 destroyed
.proc getfd
.proc getfd
sta tmp1 ; save fd_table entry
jsr fdt_to_fdi
bcs error
sta tmp1 ; save fd_table entry
jsr fdt_to_fdi
bcs error
pha
lda tmp1
asl a
asl a ; also clears C
tax
inc fd_table+ft_usa,x ; increment usage counter
pla
error: rts
pha
lda tmp1
asl a
asl a ; also clears C
tax
inc fd_table+ft_usa,x ; increment usage counter
pla
error: rts
.endproc

View File

@@ -4,12 +4,12 @@
; void gotox (unsigned char x);
;
.include "atari.inc"
.export _gotox
.import setcursor
.include "atari.inc"
.export _gotox
.import setcursor
_gotox:
sta COLCRS ; Set X
lda #0
sta COLCRS+1
jmp setcursor
sta COLCRS ; Set X
lda #0
sta COLCRS+1
jmp setcursor

View File

@@ -4,16 +4,16 @@
; void gotoxy (unsigned char x, unsigned char y);
;
.include "atari.inc"
.include "atari.inc"
.export _gotoxy
.import popa
.import setcursor
.export _gotoxy
.import popa
.import setcursor
_gotoxy: ; Set the cursor position
sta ROWCRS ; Set Y
jsr popa ; Get X
sta COLCRS ; Set X
lda #0
sta COLCRS+1 ;
jmp setcursor
_gotoxy: ; Set the cursor position
sta ROWCRS ; Set Y
jsr popa ; Get X
sta COLCRS ; Set X
lda #0
sta COLCRS+1 ;
jmp setcursor

View File

@@ -4,10 +4,10 @@
; void gotoy (unsigned char y);
;
.include "atari.inc"
.export _gotoy
.import setcursor
.include "atari.inc"
.export _gotoy
.import setcursor
_gotoy:
sta ROWCRS ; Set Y
jmp setcursor
sta ROWCRS ; Set Y
jmp setcursor

View File

@@ -7,101 +7,101 @@
;
;
.export __graphics
.export __graphics
.import findfreeiocb
.import __do_oserror,__oserror
.import fddecusage
.import clriocb
.import fdtoiocb
.import newfd
.importzp tmp1,tmp2,tmp3
.import findfreeiocb
.import __do_oserror,__oserror
.import fddecusage
.import clriocb
.import fdtoiocb
.import newfd
.importzp tmp1,tmp2,tmp3
.include "atari.inc"
.include "errno.inc"
.include "atari.inc"
.include "errno.inc"
.code
.code
; set new grapics mode
; gets new mode in A
; returns handle or -1 on error
; uses tmp1, tmp2, tmp3, tmp4 (in subroutines)
.proc __graphics
.proc __graphics
; tax
; and #15 ; get required graphics mode
; cmp #12
; bcs invmode ; invalid mode
; txa
; and #$c0 ; invalid bits set?
; bne invmode
; tax
; and #15 ; get required graphics mode
; cmp #12
; bcs invmode ; invalid mode
; txa
; and #$c0 ; invalid bits set?
; bne invmode
; stx tmp1
sta tmp1 ; remember graphics mode
; stx tmp1
sta tmp1 ; remember graphics mode
parmok: jsr findfreeiocb
beq iocbok ; we found one
parmok: jsr findfreeiocb
beq iocbok ; we found one
lda #<EMFILE ; "too many open files"
seterr: jsr __mappederrno ; @@@ probably not correct to set errno here @@@
rts ; return -1
lda #<EMFILE ; "too many open files"
seterr: jsr __mappederrno ; @@@ probably not correct to set errno here @@@
rts ; return -1
;invmode:ldx #>EINVAL
; lda #<EINVAL
; bne seterr
;invmode:ldx #>EINVAL
; lda #<EINVAL
; bne seterr
iocbok: txa
tay ; move iocb # into Y
lda #3
sta tmp3 ; name length + 1
lda #<scrdev
ldx #>scrdev
jsr newfd
tya
tax
bcs doopen ; C set: open needed
iocbok: txa
tay ; move iocb # into Y
lda #3
sta tmp3 ; name length + 1
lda #<scrdev
ldx #>scrdev
jsr newfd
tya
tax
bcs doopen ; C set: open needed
ldx #0
lda tmp2 ; get fd used
jsr fdtoiocb
tax
ldx #0
lda tmp2 ; get fd used
jsr fdtoiocb
tax
doopen: txa
;brk
pha
jsr clriocb
pla
tax
lda #<scrdev
sta ICBAL,x
lda #>scrdev
sta ICBAH,x
lda #OPEN
sta ICCOM,x
lda tmp1 ; get requested graphics mode
and #15
sta ICAX2,x
lda tmp1
and #$30
eor #$10
ora #12
sta ICAX1,x
doopen: txa
;brk
pha
jsr clriocb
pla
tax
lda #<scrdev
sta ICBAL,x
lda #>scrdev
sta ICBAH,x
lda #OPEN
sta ICCOM,x
lda tmp1 ; get requested graphics mode
and #15
sta ICAX2,x
lda tmp1
and #$30
eor #$10
ora #12
sta ICAX1,x
jsr CIOV
bmi cioerr
jsr CIOV
bmi cioerr
lda tmp2 ; get fd
ldx #0
stx __oserror
rts
lda tmp2 ; get fd
ldx #0
stx __oserror
rts
cioerr: jsr fddecusage ; decrement usage counter of fd as open failed
jmp __do_oserror
cioerr: jsr fddecusage ; decrement usage counter of fd as open failed
jmp __do_oserror
.endproc ; __graphics
.endproc ; __graphics
.rodata
.rodata
scrdev: .byte "S:", 0
scrdev: .byte "S:", 0

View File

@@ -2,30 +2,30 @@
; Stefan Haubenthal, 2008-04-29
;
.export initcwd
.import findfreeiocb
.import __cwd
.include "atari.inc"
.export initcwd
.import findfreeiocb
.import __cwd
.include "atari.inc"
.proc initcwd
.proc initcwd
jsr findfreeiocb
bne oserr
lda #48
sta ICCOM,x
lda #<__cwd
sta ICBLL,x
lda #>__cwd
sta ICBLH,x
jsr CIOV
bmi oserr
ldx #0 ; ATEOL -> \0
: lda __cwd,x
inx
cmp #ATEOL
bne :-
lda #0
sta __cwd-1,x
oserr: rts
jsr findfreeiocb
bne oserr
lda #48
sta ICCOM,x
lda #<__cwd
sta ICBLL,x
lda #>__cwd
sta ICBLH,x
jsr CIOV
bmi oserr
ldx #0 ; ATEOL -> \0
: lda __cwd,x
inx
cmp #ATEOL
bne :-
lda #0
sta __cwd-1,x
oserr: rts
.endproc

View File

@@ -1,10 +1,10 @@
;
; set EINVAL error code and returns -1
;
.include "errno.inc"
.include "errno.inc"
.export __inviocb
.export __inviocb
__inviocb:
lda #<EINVAL
jmp __directerrno
lda #<EINVAL
jmp __directerrno

View File

@@ -2,48 +2,48 @@
; IRQ handling (ATARI version)
;
.export initirq, doneirq
.import callirq
.export initirq, doneirq
.import callirq
.include "atari.inc"
.include "atari.inc"
; ------------------------------------------------------------------------
.segment "INIT"
.segment "INIT"
initirq:
lda VVBLKI
ldx VVBLKI+1
sta IRQInd+1
stx IRQInd+2
lda #6
ldy #<IRQStub
ldx #>IRQStub
jsr SETVBV
rts
lda VVBLKI
ldx VVBLKI+1
sta IRQInd+1
stx IRQInd+2
lda #6
ldy #<IRQStub
ldx #>IRQStub
jsr SETVBV
rts
; ------------------------------------------------------------------------
.code
doneirq:
lda #6
ldy IRQInd+1
ldx IRQInd+2
jsr SETVBV
rts
lda #6
ldy IRQInd+1
ldx IRQInd+2
jsr SETVBV
rts
; ------------------------------------------------------------------------
.segment "LOWCODE"
.segment "LOWCODE"
IRQStub:
cld ; Just to be sure
jsr callirq ; Call the functions
jmp IRQInd ; Jump to the saved IRQ vector
cld ; Just to be sure
jsr callirq ; Call the functions
jmp IRQInd ; Jump to the saved IRQ vector
; ------------------------------------------------------------------------
.data
IRQInd: jmp $0000
IRQInd: jmp $0000

View File

@@ -7,48 +7,48 @@
; Using code from Carsten Strotmann and help from Christian Groessler
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "joy-kernel.inc"
.include "joy-error.inc"
.include "atari.inc"
.include "joy-kernel.inc"
.include "joy-error.inc"
.include "atari.inc"
.macpack generic
.macpack generic
; ------------------------------------------------------------------------
; Header. Includes jump table
.segment "JUMPTABLE"
.segment "JUMPTABLE"
; Driver signature
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
; Button state masks (8 values)
.byte $02 ; JOY_UP
.byte $04 ; JOY_DOWN
.byte $08 ; JOY_LEFT
.byte $10 ; JOY_RIGHT
.byte $01 ; JOY_FIRE
.byte $00 ; JOY_FIRE2 not available
.byte $00 ; Future expansion
.byte $00 ; Future expansion
.byte $02 ; JOY_UP
.byte $04 ; JOY_DOWN
.byte $08 ; JOY_LEFT
.byte $10 ; JOY_RIGHT
.byte $01 ; JOY_FIRE
.byte $00 ; JOY_FIRE2 not available
.byte $00 ; Future expansion
.byte $00 ; Future expansion
; Jump table.
.addr INSTALL
.addr UNINSTALL
.addr COUNT
.addr READJOY
.addr 0 ; IRQ entry not used
.addr INSTALL
.addr UNINSTALL
.addr COUNT
.addr READJOY
.addr 0 ; IRQ entry not used
; ------------------------------------------------------------------------
; Constants
JOY_COUNT = 8 ; Number of joysticks we support
JOY_COUNT = 8 ; Number of joysticks we support
; ------------------------------------------------------------------------
@@ -65,15 +65,15 @@ JOY_COUNT = 8 ; Number of joysticks we support
;
INSTALL:
lda #$30
sta PACTL
lda #$F0
sta PORTA
lda #$34
sta PACTL
lda #JOY_ERR_OK
ldx #0
; rts ; Run into UNINSTALL instead
lda #$30
sta PACTL
lda #$F0
sta PORTA
lda #$34
sta PACTL
lda #JOY_ERR_OK
ldx #0
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory.
@@ -81,7 +81,7 @@ INSTALL:
;
UNINSTALL:
rts
rts
; ------------------------------------------------------------------------
@@ -89,27 +89,27 @@ UNINSTALL:
;
COUNT:
lda #JOY_COUNT
ldx #0
rts
lda #JOY_COUNT
ldx #0
rts
; ------------------------------------------------------------------------
; READ: Read a particular joystick passed in A.
;
READJOY:
asl a
asl a
asl a
asl a
sta PORTA
asl a
asl a
asl a
asl a
sta PORTA
; Read joystick
lda PORTA ; get position
and #%00001111
asl a
ora TRIG0 ; add button information
eor #%00011111
ldx #0 ; fix X
rts
lda PORTA ; get position
and #%00001111
asl a
ora TRIG0 ; add button information
eor #%00011111
ldx #0 ; fix X
rts

View File

@@ -6,48 +6,48 @@
; Using the readjoy code from Christian Groessler
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "joy-kernel.inc"
.include "joy-error.inc"
.include "atari.inc"
.include "joy-kernel.inc"
.include "joy-error.inc"
.include "atari.inc"
.macpack generic
.macpack generic
; ------------------------------------------------------------------------
; Header. Includes jump table
.segment "JUMPTABLE"
.segment "JUMPTABLE"
; Driver signature
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
; Button state masks (8 values)
.byte $01 ; JOY_UP
.byte $02 ; JOY_DOWN
.byte $04 ; JOY_LEFT
.byte $08 ; JOY_RIGHT
.byte $10 ; JOY_FIRE
.byte $00 ; JOY_FIRE2 not available
.byte $00 ; Future expansion
.byte $00 ; Future expansion
.byte $01 ; JOY_UP
.byte $02 ; JOY_DOWN
.byte $04 ; JOY_LEFT
.byte $08 ; JOY_RIGHT
.byte $10 ; JOY_FIRE
.byte $00 ; JOY_FIRE2 not available
.byte $00 ; Future expansion
.byte $00 ; Future expansion
; Jump table.
.addr INSTALL
.addr UNINSTALL
.addr COUNT
.addr READJOY
.addr 0 ; IRQ entry not used
.addr INSTALL
.addr UNINSTALL
.addr COUNT
.addr READJOY
.addr 0 ; IRQ entry not used
; ------------------------------------------------------------------------
; Constants
JOY_COUNT = 4 ; Number of joysticks we support
JOY_COUNT = 4 ; Number of joysticks we support
; ------------------------------------------------------------------------
@@ -64,9 +64,9 @@ JOY_COUNT = 4 ; Number of joysticks we support
;
INSTALL:
lda #JOY_ERR_OK
ldx #0
; rts ; Run into UNINSTALL instead
lda #JOY_ERR_OK
ldx #0
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory.
@@ -74,7 +74,7 @@ INSTALL:
;
UNINSTALL:
rts
rts
; ------------------------------------------------------------------------
@@ -82,31 +82,31 @@ UNINSTALL:
;
COUNT:
lda #JOY_COUNT
ldx $fcd8
cpx #$a2
beq _400800
lsr a ; XL and newer machines only have 2 ports
lda #JOY_COUNT
ldx $fcd8
cpx #$a2
beq _400800
lsr a ; XL and newer machines only have 2 ports
_400800:
ldx #0
rts
ldx #0
rts
; ------------------------------------------------------------------------
; READ: Read a particular joystick passed in A.
;
READJOY:
and #3 ; fix joystick number
tax ; Joystick number (0-3) into X
and #3 ; fix joystick number
tax ; Joystick number (0-3) into X
; Read joystick
lda STRIG0,x ; get button
asl a
asl a
asl a
asl a
ora STICK0,x ; add position information
eor #$1F
ldx #0 ; fix X
rts
lda STRIG0,x ; get button
asl a
asl a
asl a
asl a
ora STICK0,x ; add position information
eor #$1F
ldx #0 ; fix X
rts

View File

@@ -6,8 +6,8 @@
; const void joy_static_stddrv[];
;
.export _joy_static_stddrv
.import _ataristd_joy
.export _joy_static_stddrv
.import _ataristd_joy
.rodata

View File

@@ -6,8 +6,8 @@
; const char joy_stddrv[];
;
.export _joy_stddrv
.export _joy_stddrv
.rodata
_joy_stddrv: .asciiz "ataristd.joy"
_joy_stddrv: .asciiz "ataristd.joy"

View File

@@ -4,19 +4,19 @@
; unsigned char kbhit (void);
;
.export _kbhit
.import return1
.export _kbhit
.import return1
.include "atari.inc"
.include "atari.inc"
.proc _kbhit
ldx CH ; last pressed key
inx ; 255 means "no key"
bne L1
ldx CH ; last pressed key
inx ; 255 means "no key"
bne L1
txa ; X = A = 0
rts
L1: jmp return1
L1: jmp return1
.endproc

View File

@@ -7,178 +7,178 @@
;
.export _lseek
.import incsp6,__oserror
.import __inviocb,ldax0sp,ldaxysp,fdtoiocb
.import __dos_type
.import fd_table
.importzp sreg,ptr1,ptr2,ptr3,ptr4
.importzp tmp1,tmp2,tmp3
.include "atari.inc"
.include "errno.inc"
.include "fd.inc"
.export _lseek
.import incsp6,__oserror
.import __inviocb,ldax0sp,ldaxysp,fdtoiocb
.import __dos_type
.import fd_table
.importzp sreg,ptr1,ptr2,ptr3,ptr4
.importzp tmp1,tmp2,tmp3
.include "atari.inc"
.include "errno.inc"
.include "fd.inc"
; seeking not supported, return -1 and ENOSYS errno value
no_supp:jsr incsp6
lda #<ENOSYS
jsr __directerrno ; returns with $FFFF in AX
sta sreg
sta sreg+1
rts
no_supp:jsr incsp6
lda #<ENOSYS
jsr __directerrno ; returns with $FFFF in AX
sta sreg
sta sreg+1
rts
parmerr:
iocberr:jsr incsp6
ldx #255
stx sreg
stx sreg+1
jmp __inviocb
iocberr:jsr incsp6
ldx #255
stx sreg
stx sreg+1
jmp __inviocb
; lseek() entry point
.proc _lseek
.proc _lseek
cpx #0 ; sanity check whence parameter
bne parmerr
cmp #3 ; valid values are 0..2
bcs parmerr
sta tmp1 ; remember whence
cpx #0 ; sanity check whence parameter
bne parmerr
cmp #3 ; valid values are 0..2
bcs parmerr
sta tmp1 ; remember whence
ldy #5
jsr ldaxysp ; get fd
jsr fdtoiocb ; convert to iocb in A, fd_table index in X
bmi iocberr
sta tmp3 ; remember iocb
ldy #5
jsr ldaxysp ; get fd
jsr fdtoiocb ; convert to iocb in A, fd_table index in X
bmi iocberr
sta tmp3 ; remember iocb
jsr chk_supp ; check, whether seeking is supported by DOS/Disk
bcc no_supp
jsr chk_supp ; check, whether seeking is supported by DOS/Disk
bcc no_supp
ldx tmp1 ; whence
beq cur
dex
beq end
ldx tmp1 ; whence
beq cur
dex
beq end
; SEEK_SET
dex
stx ptr3
stx ptr3+1
stx ptr4
stx ptr4+1
beq cont
dex
stx ptr3
stx ptr3+1
stx ptr4
stx ptr4+1
beq cont
; SEEK_CUR
cur: ldx tmp3
lda #38 ; NOTE
sta ICCOM,x
jsr CIOV ; read it
bmi xxerr
l01: lda ICAX3,x ; low byte of position
sta ptr3
lda ICAX4,x ; med byte of position
sta ptr3+1
lda ICAX5,x ; high byte of position
sta ptr4
lda #0
sta ptr4+1
beq cont
cur: ldx tmp3
lda #38 ; NOTE
sta ICCOM,x
jsr CIOV ; read it
bmi xxerr
l01: lda ICAX3,x ; low byte of position
sta ptr3
lda ICAX4,x ; med byte of position
sta ptr3+1
lda ICAX5,x ; high byte of position
sta ptr4
lda #0
sta ptr4+1
beq cont
; SEEK_END
end: ldx tmp3
lda #39 ; get file size
sta ICCOM,x
jsr CIOV
bpl l01
end: ldx tmp3
lda #39 ; get file size
sta ICCOM,x
jsr CIOV
bpl l01
; error returned from CIO
xxerr: tya
pha
jsr incsp6
pla
jsr __mappederrno ; returns with $FFFF in AX
sta sreg
sta sreg+1
rts
xxerr: tya
pha
jsr incsp6
pla
jsr __mappederrno ; returns with $FFFF in AX
sta sreg
sta sreg+1
rts
; check for offset 0, SEEK_CUR (get current position)
cont: ldy #3
jsr ldaxysp ; get upper word
sta ptr1
stx ptr1+1
jsr ldax0sp ; get lower word
stx tmp2
ora tmp2
ora ptr1
ora ptr1+1
bne seek
lda tmp1 ; whence (0 = SEEK_CUR)
bne seek
cont: ldy #3
jsr ldaxysp ; get upper word
sta ptr1
stx ptr1+1
jsr ldax0sp ; get lower word
stx tmp2
ora tmp2
ora ptr1
ora ptr1+1
bne seek
lda tmp1 ; whence (0 = SEEK_CUR)
bne seek
; offset 0, SEEK_CUR: return current fp
ret: jsr incsp6
ret: jsr incsp6
lda ptr4+1
sta sreg+1
lda ptr4
sta sreg
ldx ptr3+1
lda ptr3
lda ptr4+1
sta sreg+1
lda ptr4
sta sreg
ldx ptr3+1
lda ptr3
.if 0
; return exactly the position DOS has
ldx tmp3
lda #38 ; NOTE
sta ICCOM,x
jsr CIOV ; read it
bmi xxerr
lda #0
sta sreg+1
lda ICAX5,x ; high byte of position
sta sreg
lda ICAX3,x ; low byte of position
pha
lda ICAX4,x ; med byte of position
tax
pla
; return exactly the position DOS has
ldx tmp3
lda #38 ; NOTE
sta ICCOM,x
jsr CIOV ; read it
bmi xxerr
lda #0
sta sreg+1
lda ICAX5,x ; high byte of position
sta sreg
lda ICAX3,x ; low byte of position
pha
lda ICAX4,x ; med byte of position
tax
pla
.endif
rts
rts
parmerr1: jmp parmerr
parmerr1: jmp parmerr
; we have to call POINT
seek: jsr ldax0sp ; get lower word of new offset
clc
adc ptr3
sta ptr3
txa
adc ptr3+1
sta ptr3+1
lda ptr1
adc ptr4
sta ptr4
lda ptr1+1
adc ptr4+1
sta ptr4+1
bne parmerr1 ; resulting value too large
seek: jsr ldax0sp ; get lower word of new offset
clc
adc ptr3
sta ptr3
txa
adc ptr3+1
sta ptr3+1
lda ptr1
adc ptr4
sta ptr4
lda ptr1+1
adc ptr4+1
sta ptr4+1
bne parmerr1 ; resulting value too large
ldx tmp3 ; IOCB
lda ptr3
sta ICAX3,x
lda ptr3+1
sta ICAX4,x
lda ptr4
sta ICAX5,x
lda #37 ;POINT
sta ICCOM,x
jsr CIOV
bpl ret
bmi xxerr
ldx tmp3 ; IOCB
lda ptr3
sta ICAX3,x
lda ptr3+1
sta ICAX4,x
lda ptr4
sta ICAX5,x
lda #37 ;POINT
sta ICCOM,x
jsr CIOV
bpl ret
bmi xxerr
.endproc
; check, whether seeking is supported
; tmp3: iocb
; X: index into fd_table
; tmp3: iocb
; X: index into fd_table
;
; On non-SpartaDOS, seeking is not supported.
; We check, whether CIO function 39 (get file size) returns OK.
@@ -187,36 +187,36 @@ seek: jsr ldax0sp ; get lower word of new offset
; We remember a successful check in fd_table.ft_flag, bit 3.
chk_supp:
lda fd_table+ft_flag,x
and #8
bne supp
lda fd_table+ft_flag,x
and #8
bne supp
; do the test
lda __dos_type
cmp #SPARTADOS
bne ns1
txa
pha
lda DOS+1 ; get SpartaDOS version
cmp #$40
bcs supp1 ; SD-X (ver 4.xx) supports seeking on all disks
ldx tmp3 ; iocb to use
lda #39 ; get file size
sta ICCOM,x
jsr CIOV
bmi notsupp ; error code ? should be 168 (invalid command)
lda __dos_type
cmp #SPARTADOS
bne ns1
txa
pha
lda DOS+1 ; get SpartaDOS version
cmp #$40
bcs supp1 ; SD-X (ver 4.xx) supports seeking on all disks
ldx tmp3 ; iocb to use
lda #39 ; get file size
sta ICCOM,x
jsr CIOV
bmi notsupp ; error code ? should be 168 (invalid command)
; seeking is supported on this DOS/Disk combination
supp1: pla
tax
lda #8
ora fd_table+ft_flag,x
sta fd_table+ft_flag,x
supp: sec
rts
supp1: pla
tax
lda #8
ora fd_table+ft_flag,x
sta fd_table+ft_flag,x
supp: sec
rts
notsupp:pla
ns1: clc
rts
ns1: clc
rts

View File

@@ -5,31 +5,31 @@
; multiplies A by 40 and returns result in AX
; uses tmp4
.importzp tmp4
.export mul40
.importzp tmp4
.export mul40
.proc mul40
.proc mul40
ldx #0
stx tmp4
sta loc_tmp
asl a
rol tmp4
asl a
rol tmp4 ; val * 4
adc loc_tmp
bcc L1
inc tmp4 ; val * 5
L1: asl a
rol tmp4 ; val * 10
asl a
rol tmp4
asl a
rol tmp4 ; val * 40
ldx tmp4
rts
ldx #0
stx tmp4
sta loc_tmp
asl a
rol tmp4
asl a
rol tmp4 ; val * 4
adc loc_tmp
bcc L1
inc tmp4 ; val * 5
L1: asl a
rol tmp4 ; val * 10
asl a
rol tmp4
asl a
rol tmp4 ; val * 40
ldx tmp4
rts
.endproc
.bss
loc_tmp:.res 1
.bss
loc_tmp:.res 1

View File

@@ -4,150 +4,150 @@
; int open(const char *name,int flags,...);
;
.include "atari.inc"
.include "fcntl.inc"
.include "errno.inc"
.include "fd.inc"
.include "atari.inc"
.include "fcntl.inc"
.include "errno.inc"
.include "fd.inc"
.export _open
.export _open
.destructor closeallfiles, 5
.import _close
.import clriocb
.import fddecusage,newfd
.import findfreeiocb
.import incsp4
.import ldaxysp,addysp
.import __oserror
.importzp tmp4,tmp2
.ifdef UCASE_FILENAME
.importzp tmp3
.import ucase_fn
.import _close
.import clriocb
.import fddecusage,newfd
.import findfreeiocb
.import incsp4
.import ldaxysp,addysp
.import __oserror
.importzp tmp4,tmp2
.ifdef UCASE_FILENAME
.importzp tmp3
.import ucase_fn
.endif
.proc _open
.proc _open
dey ; parm count < 4 shouldn't be needed to be checked
dey ; (it generates a c compiler warning)
dey
dey
beq parmok ; parameter count ok
jsr addysp ; fix stack, throw away unused parameters
dey ; parm count < 4 shouldn't be needed to be checked
dey ; (it generates a c compiler warning)
dey
dey
beq parmok ; parameter count ok
jsr addysp ; fix stack, throw away unused parameters
parmok: jsr findfreeiocb
beq iocbok ; we found one
parmok: jsr findfreeiocb
beq iocbok ; we found one
lda #<EMFILE ; "too many open files"
seterr: jsr __directerrno
jsr incsp4 ; clean up stack
lda #$FF
tax
rts ; return -1
lda #<EMFILE ; "too many open files"
seterr: jsr __directerrno
jsr incsp4 ; clean up stack
lda #$FF
tax
rts ; return -1
; process the mode argument
; process the mode argument
iocbok: stx tmp4
jsr clriocb ; init with zero
ldy #1
jsr ldaxysp ; get mode
ldx tmp4
pha
and #O_APPEND
beq no_app
pla
and #15
cmp #O_RDONLY ; DOS supports append with write-only only
beq invret
cmp #O_RDWR
beq invret
lda #OPNOT|APPEND
bne set
iocbok: stx tmp4
jsr clriocb ; init with zero
ldy #1
jsr ldaxysp ; get mode
ldx tmp4
pha
and #O_APPEND
beq no_app
pla
and #15
cmp #O_RDONLY ; DOS supports append with write-only only
beq invret
cmp #O_RDWR
beq invret
lda #OPNOT|APPEND
bne set
.ifndef UCASE_FILENAME
invret: lda #<EINVAL ; file name is too long
jmp seterr
.ifndef UCASE_FILENAME
invret: lda #<EINVAL ; file name is too long
jmp seterr
.endif
no_app: pla
and #15
cmp #O_RDONLY
bne l1
lda #OPNIN
set: sta ICAX1,x
bne cont
no_app: pla
and #15
cmp #O_RDONLY
bne l1
lda #OPNIN
set: sta ICAX1,x
bne cont
l1: cmp #O_WRONLY
bne l2
lda #OPNOT
bne set
l1: cmp #O_WRONLY
bne l2
lda #OPNOT
bne set
l2: ; O_RDWR
lda #OPNOT|OPNIN
bne set
l2: ; O_RDWR
lda #OPNOT|OPNIN
bne set
; process the filename argument
; process the filename argument
cont: ldy #3
jsr ldaxysp
cont: ldy #3
jsr ldaxysp
.ifdef UCASE_FILENAME
.ifdef UCASE_FILENAME
jsr ucase_fn
bcc ucok1
invret: lda #<EINVAL ; file name is too long
jmp seterr
jsr ucase_fn
bcc ucok1
invret: lda #<EINVAL ; file name is too long
jmp seterr
ucok1:
.endif ; defined UCASE_FILENAME
.endif ; defined UCASE_FILENAME
ldy tmp4
ldy tmp4
;AX - points to filename
;Y - iocb to use, if open needed
jsr newfd ; maybe we don't need to open and can reuse an iocb
; returns fd num to use in tmp2, all regs unchanged
bcs doopen ; C set: open needed
lda #0 ; clears N flag
beq finish
;AX - points to filename
;Y - iocb to use, if open needed
jsr newfd ; maybe we don't need to open and can reuse an iocb
; returns fd num to use in tmp2, all regs unchanged
bcs doopen ; C set: open needed
lda #0 ; clears N flag
beq finish
doopen: sta ICBAL,y
txa
sta ICBAH,y
ldx tmp4
lda #OPEN
sta ICCOM,x
jsr CIOV
doopen: sta ICBAL,y
txa
sta ICBAH,y
ldx tmp4
lda #OPEN
sta ICCOM,x
jsr CIOV
; clean up the stack
; clean up the stack
finish: php
txa
pha
tya
pha
finish: php
txa
pha
tya
pha
.ifdef UCASE_FILENAME
ldy tmp3 ; get size
jsr addysp ; free used space on the stack
.endif ; defined UCASE_FILENAME
.ifdef UCASE_FILENAME
ldy tmp3 ; get size
jsr addysp ; free used space on the stack
.endif ; defined UCASE_FILENAME
jsr incsp4 ; clean up stack
jsr incsp4 ; clean up stack
pla
tay
pla
tax
plp
pla
tay
pla
tax
plp
bpl ok
jsr fddecusage ; decrement usage counter of fd as open failed
tya ; put error code into A
jmp __mappederrno
bpl ok
jsr fddecusage ; decrement usage counter of fd as open failed
tya ; put error code into A
jmp __mappederrno
ok: lda tmp2 ; get fd
ldx #0
stx __oserror
rts
ok: lda tmp2 ; get fd
ldx #0
stx __oserror
rts
.endproc
@@ -156,14 +156,14 @@ ok: lda tmp2 ; get fd
.proc closeallfiles
lda #MAX_FD_INDEX-1
loop: ldx #0
pha
jsr _close
pla
clc
sbc #0
bpl loop
rts
lda #MAX_FD_INDEX-1
loop: ldx #0
pha
jsr _close
pla
clc
sbc #0
bpl loop
rts
.endproc

View File

@@ -42,44 +42,44 @@ End:
__sys_oserrlist:
sys_oserr_entry 1, "no error"
sys_oserr_entry 128, "BREAK key abort"
sys_oserr_entry 129, "IOCB already open"
sys_oserr_entry 130, "device not found"
sys_oserr_entry 131, "IOCB write only"
sys_oserr_entry 132, "invalid command"
sys_oserr_entry 133, "IOCB not open"
sys_oserr_entry 134, "invalid IOCB index"
sys_oserr_entry 135, "IOCB read only"
sys_oserr_entry 136, "end-of-file"
sys_oserr_entry 137, "record truncated"
sys_oserr_entry 138, "device timeout"
sys_oserr_entry 139, "device nak"
sys_oserr_entry 140, "SIO frame error"
sys_oserr_entry 141, "cursor out of range"
sys_oserr_entry 142, "SIO data overrun"
sys_oserr_entry 143, "SIO checksum mismatch"
sys_oserr_entry 144, "general device failure"
sys_oserr_entry 145, "bad screen mode"
sys_oserr_entry 146, "invalid function"
sys_oserr_entry 147, "insufficient memory for mode"
sys_oserr_entry 148, "invalid disk format"
sys_oserr_entry 149, "disk format version mismatch"
sys_oserr_entry 150, "R: already open/dir not found"
sys_oserr_entry 151, "concurrent mode not enabled/file exists"
sys_oserr_entry 152, "concurrent mode invalid buffer address/not binary"
sys_oserr_entry 153, "concurrent mode enabled"
sys_oserr_entry 154, "concurrent mode not active/loader symbol not defined"
sys_oserr_entry 156, "invalid parameter"
sys_oserr_entry 158, "insufficient memory"
sys_oserr_entry 160, "drive number error"
sys_oserr_entry 161, "too many open files"
sys_oserr_entry 162, "no space left on device"
sys_oserr_entry 163, "unrecoverable system data I/O error"
sys_oserr_entry 164, "file number mismatch"
sys_oserr_entry 165, "invalid file name"
sys_oserr_entry 166, "point data length error"
sys_oserr_entry 167, "file read-only"
sys_oserr_entry 168, "invalid command for disk"
sys_oserr_entry 128, "BREAK key abort"
sys_oserr_entry 129, "IOCB already open"
sys_oserr_entry 130, "device not found"
sys_oserr_entry 131, "IOCB write only"
sys_oserr_entry 132, "invalid command"
sys_oserr_entry 133, "IOCB not open"
sys_oserr_entry 134, "invalid IOCB index"
sys_oserr_entry 135, "IOCB read only"
sys_oserr_entry 136, "end-of-file"
sys_oserr_entry 137, "record truncated"
sys_oserr_entry 138, "device timeout"
sys_oserr_entry 139, "device nak"
sys_oserr_entry 140, "SIO frame error"
sys_oserr_entry 141, "cursor out of range"
sys_oserr_entry 142, "SIO data overrun"
sys_oserr_entry 143, "SIO checksum mismatch"
sys_oserr_entry 144, "general device failure"
sys_oserr_entry 145, "bad screen mode"
sys_oserr_entry 146, "invalid function"
sys_oserr_entry 147, "insufficient memory for mode"
sys_oserr_entry 148, "invalid disk format"
sys_oserr_entry 149, "disk format version mismatch"
sys_oserr_entry 150, "R: already open/dir not found"
sys_oserr_entry 151, "concurrent mode not enabled/file exists"
sys_oserr_entry 152, "concurrent mode invalid buffer address/not binary"
sys_oserr_entry 153, "concurrent mode enabled"
sys_oserr_entry 154, "concurrent mode not active/loader symbol not defined"
sys_oserr_entry 156, "invalid parameter"
sys_oserr_entry 158, "insufficient memory"
sys_oserr_entry 160, "drive number error"
sys_oserr_entry 161, "too many open files"
sys_oserr_entry 162, "no space left on device"
sys_oserr_entry 163, "unrecoverable system data I/O error"
sys_oserr_entry 164, "file number mismatch"
sys_oserr_entry 165, "invalid file name"
sys_oserr_entry 166, "point data length error"
sys_oserr_entry 167, "file read-only"
sys_oserr_entry 168, "invalid command for disk"
sys_oserr_entry 169, "directory full"
sys_oserr_entry 170, "file not found"
sys_oserr_entry 171, "invalid point command"

View File

@@ -5,100 +5,100 @@
; int __fastcall__ _osmaperrno (unsigned char oserror);
;
.include "errno.inc"
.export __osmaperrno
.include "errno.inc"
.export __osmaperrno
.proc __osmaperrno
.proc __osmaperrno
cmp #$80 ; error or success
bcs errcode ; error, jump
cmp #$80 ; error or success
bcs errcode ; error, jump
lda #0 ; no error, return 0
tax
rts
lda #0 ; no error, return 0
tax
rts
errcode:and #$7f ; create index from error number
tax
cpx #MAX_OSERR_VAL ; valid number?
bcs inverr ; no
errcode:and #$7f ; create index from error number
tax
cpx #MAX_OSERR_VAL ; valid number?
bcs inverr ; no
lda maptable,x
ldx #0
rts
lda maptable,x
ldx #0
rts
inverr: lda #<EUNKNOWN
ldx #>EUNKNOWN
rts
inverr: lda #<EUNKNOWN
ldx #>EUNKNOWN
rts
.endproc
.rodata
maptable:
.byte EINTR ;BRKABT = 128 ;($80) BREAK key abort
.byte EBUSY ;PRVOPN = 129 ;($81) IOCB already open error
.byte ENODEV ;NONDEV = 130 ;($82) nonexistent device error
.byte EACCES ;WRONLY = 131 ;($83) IOCB opened for write only error
.byte ENOSYS ;NVALID = 132 ;($84) invalid command error
.byte EINVAL ;NOTOPN = 133 ;($85) device/file not open error
.byte EINVAL ;BADIOC = 134 ;($86) invalid IOCB index error
.byte EACCES ;RDONLY = 135 ;($87) IOCB opened for read only error
.byte EINVAL ;EOFERR = 136 ;($88) end of file error (should never come,
; specially handled by read.s)
.byte EIO ;TRNRCD = 137 ;($89) truncated record error
.byte EIO ;TIMOUT = 138 ;($8A) peripheral device timeout error
.byte EIO ;DNACK = 139 ;($8B) device does not acknowledge command
.byte EIO ;FRMERR = 140 ;($8C) serial bus framing error
.byte EINVAL ;CRSROR = 141 ;($8D) cursor out of range error
.byte EIO ;OVRRUN = 142 ;($8E) serial bus data overrun error
.byte EIO ;CHKERR = 143 ;($8F) serial bus checksum error
.byte EIO ;DERROR = 144 ;($90) general device failure
.byte EINVAL ;BADMOD = 145 ;($91) bad screen mode number error
.byte ENOSYS ;FNCNOT = 146 ;($92) function not implemented in handler
.byte ENOMEM ;SCRMEM = 147 ;($93) insufficient memory for screen mode
.byte EINTR ;BRKABT = 128 ;($80) BREAK key abort
.byte EBUSY ;PRVOPN = 129 ;($81) IOCB already open error
.byte ENODEV ;NONDEV = 130 ;($82) nonexistent device error
.byte EACCES ;WRONLY = 131 ;($83) IOCB opened for write only error
.byte ENOSYS ;NVALID = 132 ;($84) invalid command error
.byte EINVAL ;NOTOPN = 133 ;($85) device/file not open error
.byte EINVAL ;BADIOC = 134 ;($86) invalid IOCB index error
.byte EACCES ;RDONLY = 135 ;($87) IOCB opened for read only error
.byte EINVAL ;EOFERR = 136 ;($88) end of file error (should never come,
; specially handled by read.s)
.byte EIO ;TRNRCD = 137 ;($89) truncated record error
.byte EIO ;TIMOUT = 138 ;($8A) peripheral device timeout error
.byte EIO ;DNACK = 139 ;($8B) device does not acknowledge command
.byte EIO ;FRMERR = 140 ;($8C) serial bus framing error
.byte EINVAL ;CRSROR = 141 ;($8D) cursor out of range error
.byte EIO ;OVRRUN = 142 ;($8E) serial bus data overrun error
.byte EIO ;CHKERR = 143 ;($8F) serial bus checksum error
.byte EIO ;DERROR = 144 ;($90) general device failure
.byte EINVAL ;BADMOD = 145 ;($91) bad screen mode number error
.byte ENOSYS ;FNCNOT = 146 ;($92) function not implemented in handler
.byte ENOMEM ;SCRMEM = 147 ;($93) insufficient memory for screen mode
; codes below taken from "Mein Atari Computer" (german version of "Your Atari Computer")
; also SpartaDOS codes from http://www.atari-central.com/programming/cio_errors.txt
; MyDOS and XDOS codes from Stefan Haubenthal
.byte EUNKNOWN ; 148 - [SpartaDOS] unrecognized disk format
.byte EUNKNOWN ; 149 - [SpartaDOS] disk created by incompatible version of SD
.byte EBUSY ; 150 - serial port already open
; [SpartaDOS] directory not found
.byte EACCES ; 151 - concurrent mode I/O not enabled (serial)
; [SpartaDOS] file exists
.byte EINVAL ; 152 - invalid buffer address for concurrent mode
; [SpartaDOS] not binary format
.byte EAGAIN ; 153 - concurrent mode enabled (and another access tried)
.byte EACCES ; 154 - concurrent mode I/O not active (serial)
; [SpartaDOS X] loader symbol not defined
.byte EUNKNOWN ; 155 - haven't found documentation
.byte EUNKNOWN ; 156 - [SpartaDOS X] bad parameter
.byte EUNKNOWN ; 157 - haven't found documentation
.byte EUNKNOWN ; 158 - [SpartaDOS X] out of memory
.byte EUNKNOWN ; 159 - haven't found documentation
.byte ENOENT ; 160 - drive number error (DOS)
.byte EMFILE ; 161 - too many open files
.byte ENOSPC ; 162 - disk full
.byte EIO ; 163 - unrecoverable system data I/O error
.byte ESPIPE ; 164 - file number mismatch (inv. seek or disk data strucs damaged)
.byte ENOENT ; 165 - invalid file name (e.g. lowercase)
.byte ESPIPE ; 166 - point data length error
.byte EACCES ; 167 - file locked (read-only)
.byte ENOSYS ; 168 - command invalid for disk
.byte ENOSPC ; 169 - directory full
.byte ENOENT ; 170 - file not found
.byte ESPIPE ; 171 - point command invalid
.byte EEXIST ; 172 - [MYDOS] already exists in parent directory
.byte EUNKNOWN ; 173 - bad disk - format couldn't complete
.byte EUNKNOWN ; 174 - [MYDOS] directory not in parent directory
.byte EUNKNOWN ; 175 - [MYDOS] directory not empty
.byte EUNKNOWN ; 176 - [DOS 3] incompatible file system
.byte EUNKNOWN ; 177 - haven't found documentation
.byte EUNKNOWN ; 178 - haven't found documentation
.byte EUNKNOWN ; 179 - haven't found documentation
.byte EUNKNOWN ; 180 - not a binary file
.byte EUNKNOWN ; 181 - [MYDOS] invalid address range
.byte EUNKNOWN ; 182 - [XDOS] invalid parameter
.byte EUNKNOWN ; 148 - [SpartaDOS] unrecognized disk format
.byte EUNKNOWN ; 149 - [SpartaDOS] disk created by incompatible version of SD
.byte EBUSY ; 150 - serial port already open
; [SpartaDOS] directory not found
.byte EACCES ; 151 - concurrent mode I/O not enabled (serial)
; [SpartaDOS] file exists
.byte EINVAL ; 152 - invalid buffer address for concurrent mode
; [SpartaDOS] not binary format
.byte EAGAIN ; 153 - concurrent mode enabled (and another access tried)
.byte EACCES ; 154 - concurrent mode I/O not active (serial)
; [SpartaDOS X] loader symbol not defined
.byte EUNKNOWN ; 155 - haven't found documentation
.byte EUNKNOWN ; 156 - [SpartaDOS X] bad parameter
.byte EUNKNOWN ; 157 - haven't found documentation
.byte EUNKNOWN ; 158 - [SpartaDOS X] out of memory
.byte EUNKNOWN ; 159 - haven't found documentation
.byte ENOENT ; 160 - drive number error (DOS)
.byte EMFILE ; 161 - too many open files
.byte ENOSPC ; 162 - disk full
.byte EIO ; 163 - unrecoverable system data I/O error
.byte ESPIPE ; 164 - file number mismatch (inv. seek or disk data strucs damaged)
.byte ENOENT ; 165 - invalid file name (e.g. lowercase)
.byte ESPIPE ; 166 - point data length error
.byte EACCES ; 167 - file locked (read-only)
.byte ENOSYS ; 168 - command invalid for disk
.byte ENOSPC ; 169 - directory full
.byte ENOENT ; 170 - file not found
.byte ESPIPE ; 171 - point command invalid
.byte EEXIST ; 172 - [MYDOS] already exists in parent directory
.byte EUNKNOWN ; 173 - bad disk - format couldn't complete
.byte EUNKNOWN ; 174 - [MYDOS] directory not in parent directory
.byte EUNKNOWN ; 175 - [MYDOS] directory not empty
.byte EUNKNOWN ; 176 - [DOS 3] incompatible file system
.byte EUNKNOWN ; 177 - haven't found documentation
.byte EUNKNOWN ; 178 - haven't found documentation
.byte EUNKNOWN ; 179 - haven't found documentation
.byte EUNKNOWN ; 180 - not a binary file
.byte EUNKNOWN ; 181 - [MYDOS] invalid address range
.byte EUNKNOWN ; 182 - [XDOS] invalid parameter
.byte EINVAL ; 183 - dummy (used by cc65 rtl, see sysremove.s)
.byte EINVAL ; 183 - dummy (used by cc65 rtl, see sysremove.s)
MAX_OSERR_VAL = (* - maptable)

View File

@@ -4,149 +4,149 @@
;
; unsigned char get_ostype(void)
;
; x x x x x x x x - 8 bit flag
; x x x x x x x x - 8 bit flag
; | | | | | | | |
; | | | | | +-+-+-- main OS rev.
; | | +-+-+-------- minor OS rev.
; +-+-------------- unused
;
; main OS rev.:
; 000 - unknown
; 001 - 400/800 ROM
; 010 - 1200XL ROM
; 011 - XL/XE ROM
; 1xx - unassigned
; 000 - unknown
; 001 - 400/800 ROM
; 010 - 1200XL ROM
; 011 - XL/XE ROM
; 1xx - unassigned
; minor OS rev.: (depending on main OS rev.);
; 400/800:
; 000 - unknown
; 001 - Rev. A PAL
; 010 - Rev. B PAL
; 011 - Rev. A NTSC
; 100 - Rev. B NTSC
; 101 - unassigned (up to 111)
; 1200XL:
; 000 - unknown
; 001 - Rev. 10
; 010 - Rev. 11
; 011 - unassigned (up to 111)
; XL/XE:
; 000 - unknown
; 001 - Rev. 1
; 010 - Rev. 2
; 011 - Rev. 3
; 100 - Rev. 4
; 101 - unassigned (up to 111)
; 400/800:
; 000 - unknown
; 001 - Rev. A PAL
; 010 - Rev. B PAL
; 011 - Rev. A NTSC
; 100 - Rev. B NTSC
; 101 - unassigned (up to 111)
; 1200XL:
; 000 - unknown
; 001 - Rev. 10
; 010 - Rev. 11
; 011 - unassigned (up to 111)
; XL/XE:
; 000 - unknown
; 001 - Rev. 1
; 010 - Rev. 2
; 011 - Rev. 3
; 100 - Rev. 4
; 101 - unassigned (up to 111)
;
.export _get_ostype
.export _get_ostype
.proc _get_ostype
.proc _get_ostype
lda $fcd8
cmp #$a2
beq _400800
lda $fff1
cmp #1
beq _1200xl
lda $fff7
cmp #1
bcc _unknown
cmp #5
bcs _unknown
lda $fcd8
cmp #$a2
beq _400800
lda $fff1
cmp #1
beq _1200xl
lda $fff7
cmp #1
bcc _unknown
cmp #5
bcs _unknown
;XL/XE ROM
sec
asl a
asl a
asl a
and #%00111000
ora #%11
_fin: ldx #0
rts
sec
asl a
asl a
asl a
and #%00111000
ora #%11
_fin: ldx #0
rts
; unknown ROM
_unknown:
lda #0
tax
rts
lda #0
tax
rts
; 1200XL ROM
_1200xl:
lda $fff7 ; revision #
cmp #10
beq _1200_10
cmp #11
beq _1200_11
lda #0 ; for unknown
beq _1200_fin
lda $fff7 ; revision #
cmp #10
beq _1200_10
cmp #11
beq _1200_11
lda #0 ; for unknown
beq _1200_fin
_1200_10:
lda #%00001000
bne _1200_fin
lda #%00001000
bne _1200_fin
_1200_11:
lda #%00010000
lda #%00010000
_1200_fin:
ora #%010
bne _fin
ora #%010
bne _fin
; 400/800 ROM
_400800:
lda $fff8
ldx $fff9
cmp #$dd
bne _400800_1
cpx #$57
bne _400800_unknown
lda $fff8
ldx $fff9
cmp #$dd
bne _400800_1
cpx #$57
bne _400800_unknown
; 400/800 NTSC Rev. A
lda #%00011001
bne _fin
lda #%00011001
bne _fin
; 400/800 unknown
_400800_unknown:
lda #%00000001
bne _fin
lda #%00000001
bne _fin
_400800_1:
cmp #$d6
bne _400800_2
cpx #$57
bne _400800_unknown
cmp #$d6
bne _400800_2
cpx #$57
bne _400800_unknown
; 400/800 PAL Rev. A
lda #%00001001
bne _fin
lda #%00001001
bne _fin
_400800_2:
cmp #$f3
bne _400800_3
cpx #$e6
bne _400800_unknown
cmp #$f3
bne _400800_3
cpx #$e6
bne _400800_unknown
; 400/800 NTSC Rev. B
lda #%00100001
bne _fin
lda #%00100001
bne _fin
_400800_3:
cmp #$22
bne _400800_unknown
cpx #$58
bne _400800_unknown
cmp #$22
bne _400800_unknown
cpx #$58
bne _400800_unknown
; 400/800 PAL Rev. B
lda #%00010001
bne _fin
lda #%00010001
bne _fin
.endproc

View File

@@ -1,161 +1,161 @@
; Native: Shawn Jefferson, December 2005
; POSIX: Stefan Haubenthal, April 2008
.include "atari.inc"
.export _opendir, _readdir, _closedir
.import findfreeiocb, clriocb
.import __oserror, return0, __do_oserror
.importzp ptr1, tmp1
.include "atari.inc"
.export _opendir, _readdir, _closedir
.import findfreeiocb, clriocb
.import __oserror, return0, __do_oserror
.importzp ptr1, tmp1
.ifdef DEFAULT_DEVICE
.import __defdev
.import __defdev
.endif
.proc _opendir
sta ptr1
stx ptr1+1
jsr findfreeiocb
beq @iocbok
bne cioerr
@iocbok: stx diriocb
jsr clriocb
ldx diriocb
ldy #0 ; '.' -> "D:*.*"
lda (ptr1),y
cmp #'.'
bne @use_parm
.proc _opendir
sta ptr1
stx ptr1+1
jsr findfreeiocb
beq @iocbok
bne cioerr
@iocbok: stx diriocb
jsr clriocb
ldx diriocb
ldy #0 ; '.' -> "D:*.*"
lda (ptr1),y
cmp #'.'
bne @use_parm
; "." was given as parameter, use default device/dir
.ifdef DEFAULT_DEVICE
; construct a "Dn:*.*" like string from the default drive
lda __defdev+1
sta dddefdev+1 ; copy drive number (overwrite 2nd 'D')
lda #<dddefdev
sta ICBAL,x
lda #>dddefdev
sta ICBAH,x
bne @cont
; construct a "Dn:*.*" like string from the default drive
lda __defdev+1
sta dddefdev+1 ; copy drive number (overwrite 2nd 'D')
lda #<dddefdev
sta ICBAL,x
lda #>dddefdev
sta ICBAH,x
bne @cont
.else
lda #<defdev
sta ICBAL,x
lda #>defdev
sta ICBAH,x
bne @cont
lda #<defdev
sta ICBAL,x
lda #>defdev
sta ICBAH,x
bne @cont
.endif
@use_parm: lda ptr1
sta ICBAL,x
lda ptr1+1
sta ICBAH,x
@use_parm: lda ptr1
sta ICBAL,x
lda ptr1+1
sta ICBAH,x
@cont: lda #OPEN
sta ICCOM,x
lda #OPNIN|DIRECT
sta ICAX1,x
jsr CIOV
bmi cioerr
lda #0
sta __oserror
tax
lda diriocb
rts
@cont: lda #OPEN
sta ICCOM,x
lda #OPNIN|DIRECT
sta ICAX1,x
jsr CIOV
bmi cioerr
lda #0
sta __oserror
tax
lda diriocb
rts
.endproc
cioerr: sty __oserror
jmp return0
cioerr: sty __oserror
jmp return0
.proc _readdir
tax
lda #GETREC
sta ICCOM,x
lda #<entry
sta ICBAL,x
sta ptr1
lda #>entry
sta ICBAH,x
sta ptr1+1
lda #DSCTSZ
sta ICBLL,x
lda #0
sta ICBLH,x
jsr CIOV
bmi cioerr
ldy #0 ; FREE SECTORS
lda (ptr1),y
cmp #'0'
bcs cioerr
dey
@next: iny ; remove trailing spaces
iny
iny
lda (ptr1),y
dey
dey
sta (ptr1),y
cpy #8
bcs @break
cmp #' '
bne @next
.proc _readdir
tax
lda #GETREC
sta ICCOM,x
lda #<entry
sta ICBAL,x
sta ptr1
lda #>entry
sta ICBAH,x
sta ptr1+1
lda #DSCTSZ
sta ICBLL,x
lda #0
sta ICBLH,x
jsr CIOV
bmi cioerr
ldy #0 ; FREE SECTORS
lda (ptr1),y
cmp #'0'
bcs cioerr
dey
@next: iny ; remove trailing spaces
iny
iny
lda (ptr1),y
dey
dey
sta (ptr1),y
cpy #8
bcs @break
cmp #' '
bne @next
@break: lda #'.' ; extension dot
sta (ptr1),y
iny ; copy extension
sty tmp1
ldy #10
lda (ptr1),y
cmp #' '
bne @hasext
@break: lda #'.' ; extension dot
sta (ptr1),y
iny ; copy extension
sty tmp1
ldy #10
lda (ptr1),y
cmp #' '
bne @hasext
; no extension present: remove the trailing dot and be done
ldy tmp1
dey
bne @done
ldy tmp1
dey
bne @done
@hasext: jsr copychar
ldy #13 ; d_type
sta (ptr1),y
ldy #11
jsr copychar
ldy #12
jsr copychar
@hasext: jsr copychar
ldy #13 ; d_type
sta (ptr1),y
ldy #11
jsr copychar
ldy #12
jsr copychar
@done: lda #0 ; end of string
sta (ptr1),y
lda ptr1
ldx ptr1+1
rts
@done: lda #0 ; end of string
sta (ptr1),y
lda ptr1
ldx ptr1+1
rts
copychar: lda (ptr1),y ; src=y dest=tmp1
ldy tmp1
cmp #' '
beq @break
sta (ptr1),y
iny
sty tmp1
@break: rts
copychar: lda (ptr1),y ; src=y dest=tmp1
ldy tmp1
cmp #' '
beq @break
sta (ptr1),y
iny
sty tmp1
@break: rts
.endproc
.proc _closedir
tax
lda #CLOSE
sta ICCOM,x
jsr CIOV
bmi @cioerr
ldx #0
stx __oserror ; clear system specific error code
txa
rts
@cioerr: jmp __do_oserror
.proc _closedir
tax
lda #CLOSE
sta ICCOM,x
jsr CIOV
bmi @cioerr
ldx #0
stx __oserror ; clear system specific error code
txa
rts
@cioerr: jmp __do_oserror
.endproc
.data
.data
.ifdef DEFAULT_DEVICE
dddefdev: .byte "D"
dddefdev: .byte "D"
.endif
defdev: .asciiz "D:*.*"
defdev: .asciiz "D:*.*"
.bss
diriocb: .res 1
entry: .res DSCTSZ
.bss
diriocb: .res 1
entry: .res DSCTSZ

View File

@@ -5,13 +5,13 @@
; /* Initialize the random number generator */
;
.export __randomize
.import _srand
.export __randomize
.import _srand
.include "atari.inc"
.include "atari.inc"
__randomize:
ldx VCOUNT ; Use vertical line counter as high byte
lda RTCLOK+2 ; Use clock as low byte
jmp _srand ; Initialize generator
__randomize:
ldx VCOUNT ; Use vertical line counter as high byte
lda RTCLOK+2 ; Use clock as low byte
jmp _srand ; Initialize generator

View File

@@ -4,120 +4,120 @@
; int __fastcall__ read(int fd,void *buf,int count)
;
.include "atari.inc"
.import __rwsetup,__do_oserror,__inviocb,__oserror
.export _read
.include "atari.inc"
.import __rwsetup,__do_oserror,__inviocb,__oserror
.export _read
_read: jsr __rwsetup ; do common setup for read and write
beq done ; if size 0, it's a no-op
cpx #$FF ; invalid iocb?
beq _inviocb
_read: jsr __rwsetup ; do common setup for read and write
beq done ; if size 0, it's a no-op
cpx #$FF ; invalid iocb?
beq _inviocb
.ifdef LINEBUF
; E: should be always at IOCB #0
; fixme: what happens when user closes and reopens stdin?
cpx #0 ; E: handler (line oriented keyboard input)?
beq do_line
.ifdef LINEBUF
; E: should be always at IOCB #0
; fixme: what happens when user closes and reopens stdin?
cpx #0 ; E: handler (line oriented keyboard input)?
beq do_line
.endif
lda #GETCHR ; iocb command code
sta ICCOM,x
jsr CIOV ; read it
bpl done
cpy #EOFERR ; eof is treated specially
beq done
jmp __do_oserror ; update errno
lda #GETCHR ; iocb command code
sta ICCOM,x
jsr CIOV ; read it
bpl done
cpy #EOFERR ; eof is treated specially
beq done
jmp __do_oserror ; update errno
done: lda ICBLL,x ; buf len lo
pha ; save
lda ICBLH,x ; get buf len hi
tax ; to X
okdone: lda #0
sta __oserror ; clear system dependend error code
pla ; get buf len lo
rts
done: lda ICBLL,x ; buf len lo
pha ; save
lda ICBLH,x ; get buf len hi
tax ; to X
okdone: lda #0
sta __oserror ; clear system dependend error code
pla ; get buf len lo
rts
_inviocb:
jmp __inviocb
jmp __inviocb
.ifdef LINEBUF
.ifdef LINEBUF
; line oriented input
.segment "EXTZP" : zeropage
.segment "EXTZP" : zeropage
index: .res 1 ; index into line buffer
buflen: .res 1 ; length of used part of buffer
cbs: .res 1 ; current buffer size: buflen - index
dataptr:.res 2 ; temp pointer to user buffer
copylen:.res 1 ; temp counter
index: .res 1 ; index into line buffer
buflen: .res 1 ; length of used part of buffer
cbs: .res 1 ; current buffer size: buflen - index
dataptr:.res 2 ; temp pointer to user buffer
copylen:.res 1 ; temp counter
.bss
.bss
linebuf:.res LINEBUF ; the line buffer
linebuf:.res LINEBUF ; the line buffer
.code
do_line:
lda buflen ; line buffer active?
bne use_buf ; yes, get data from there
lda buflen ; line buffer active?
bne use_buf ; yes, get data from there
; save user buffer address & length
; update IOCB to point to line buffer
lda ICBLL,x
pha
lda #LINEBUF
sta ICBLL,x
;--------
lda ICBLH,x
pha
lda #0
sta ICBLH,x
;--------
lda ICBAL,x
pha
lda #<linebuf
sta ICBAL,x
;--------
lda ICBAH,x
pha
lda #>linebuf
sta ICBAH,x
; save user buffer address & length
; update IOCB to point to line buffer
lda ICBLL,x
pha
lda #LINEBUF
sta ICBLL,x
;--------
lda ICBLH,x
pha
lda #0
sta ICBLH,x
;--------
lda ICBAL,x
pha
lda #<linebuf
sta ICBAL,x
;--------
lda ICBAH,x
pha
lda #>linebuf
sta ICBAH,x
lda #GETREC
sta ICCOM,x
jsr CIOV ; read input data
bpl newbuf
cpy #EOFERR ; eof is treated specially
beq newbuf
pla ; fix stack
pla
pla
pla
jmp __do_oserror ; update errno
lda #GETREC
sta ICCOM,x
jsr CIOV ; read input data
bpl newbuf
cpy #EOFERR ; eof is treated specially
beq newbuf
pla ; fix stack
pla
pla
pla
jmp __do_oserror ; update errno
newbuf:
lda ICBLL,x ; get # of bytes read
sta buflen
lda #0
sta index ; fresh buffer
lda ICBLL,x ; get # of bytes read
sta buflen
lda #0
sta index ; fresh buffer
; restore user buffer address & length
pla
sta ICBAH,x
;--------
pla
sta ICBAL,x
;--------
pla
sta ICBLH,x
;--------
pla
sta ICBLL,x
; restore user buffer address & length
pla
sta ICBAH,x
;--------
pla
sta ICBAL,x
;--------
pla
sta ICBLH,x
;--------
pla
sta ICBLL,x
; fall into use_buf
lda buflen
; fall into use_buf
lda buflen
; return bytes from line buffer
; use buflen and index to access buffer
@@ -125,58 +125,58 @@ newbuf:
; use dataptr as a temporary pointer
use_buf:
sec
sbc index ; size of unread data in the buffer
sta cbs
sec
sbc index ; size of unread data in the buffer
sta cbs
lda ICBLL,x ; buf len lo
cmp cbs ; larger than buffer size?
beq bl1
bcs btsmall ; yes, adjust length
lda ICBLL,x ; buf len lo
cmp cbs ; larger than buffer size?
beq bl1
bcs btsmall ; yes, adjust length
bl1: lda ICBLH,x ; get buf len hi
bne btsmall ; buffer too small: buffer contents < read size
bl1: lda ICBLH,x ; get buf len hi
bne btsmall ; buffer too small: buffer contents < read size
; copy ICBLL,x bytes
icbll_copy:
lda ICBAL,x ; buffer address
sta dataptr
lda ICBAH,x ; buffer address
sta dataptr+1
lda ICBLL,x
sta copylen
pha ; remember for return value
ldy #0
ldx index
lda ICBAL,x ; buffer address
sta dataptr
lda ICBAH,x ; buffer address
sta dataptr+1
lda ICBLL,x
sta copylen
pha ; remember for return value
ldy #0
ldx index
copy: lda linebuf,x
sta (dataptr),y
iny
inx
dec copylen
bne copy
copy: lda linebuf,x
sta (dataptr),y
iny
inx
dec copylen
bne copy
pla ; length
pha ; save length to return at okdone
pla ; length
pha ; save length to return at okdone
clc
adc index
sta index
cmp buflen ; buffer used up?
bcc c1 ; not yet
clc
adc index
sta index
cmp buflen ; buffer used up?
bcc c1 ; not yet
lda #0
sta buflen ; indicate empty line buffer
lda #0
sta buflen ; indicate empty line buffer
c1: ldx #0
jmp okdone ; return to caller
c1: ldx #0
jmp okdone ; return to caller
btsmall:
lda cbs
sta ICBLL,x
bpl icbll_copy
lda cbs
sta ICBLL,x
bpl icbll_copy
.endif ; .ifdef LINEBUF
.endif ; .ifdef LINEBUF

View File

@@ -3,26 +3,26 @@
;
; unsigned char revers (unsigned char onoff);
;
.include "atari.inc"
.export _revers
.export _revflag
.include "atari.inc"
.export _revers
.export _revflag
_revers:
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
L1: ldy #$00 ; Assume old value is zero
lda _revflag ; Load old value
stx _revflag ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
L1: ldy #$00 ; Assume old value is zero
lda _revflag ; Load old value
stx _revflag ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.bss
.bss
_revflag:
.res 1
.res 1

View File

@@ -11,43 +11,43 @@
; unsigned char __fastcall__ rs232_pause (void); [TODO]
; unsigned char __fastcall__ rs232_unpause (void); [TODO]
; unsigned char __fastcall__ rs232_status (unsigned char* status,
; unsigned char* errors); [TODO]
; unsigned char* errors); [TODO]
;
.import findfreeiocb
.import __do_oserror
.import fddecusage
.import fdtoiocb
.import __inviocb
.import clriocb
.import newfd
.import _close, pushax, popax, popa
.importzp ptr1, tmp2, tmp3
.import findfreeiocb
.import __do_oserror
.import fddecusage
.import fdtoiocb
.import __inviocb
.import clriocb
.import newfd
.import _close, pushax, popax, popa
.importzp ptr1, tmp2, tmp3
.export _rs232_init, _rs232_params, _rs232_done, _rs232_get
.export _rs232_put, _rs232_pause, _rs232_unpause, _rs232_status
.export _rs232_init, _rs232_params, _rs232_done, _rs232_get
.export _rs232_put, _rs232_pause, _rs232_unpause, _rs232_status
.include "atari.inc"
.include "errno.inc"
.include "atari.inc"
.include "errno.inc"
.include "rs232.inc"
.rodata
.rodata
rdev: .byte "R:", ATEOL, 0
rdev: .byte "R:", ATEOL, 0
.bss
.bss
; receive buffer
RECVBUF_SZ = 256
recv_buf: .res RECVBUF_SZ
recv_buf: .res RECVBUF_SZ
cm_run: .res 1 ; concurrent mode running?
cm_run: .res 1 ; concurrent mode running?
.data
.data
rshand: .word $ffff
rshand: .word $ffff
.code
.code
;----------------------------------------------------------------------------
;
@@ -57,60 +57,60 @@ rshand: .word $ffff
; */
;
.proc _rs232_init
.proc _rs232_init
jsr findfreeiocb
bne init_err
txa
tay ; move iocb # into Y
lda #3
sta tmp3 ; name length + 1
lda #<rdev
ldx #>rdev
jsr newfd
tya
bcs doopen ; C set: open needed / device not already open
jsr findfreeiocb
bne init_err
txa
tay ; move iocb # into Y
lda #3
sta tmp3 ; name length + 1
lda #<rdev
ldx #>rdev
jsr newfd
tya
bcs doopen ; C set: open needed / device not already open
pha
jsr _rs232_done ;** shut down if started @@@TODO check this out!!
pla
pha
jsr _rs232_done ;** shut down if started @@@TODO check this out!!
pla
doopen: tax
pha
jsr clriocb
pla
tax
lda #<rdev
sta ICBAL,x
lda #>rdev
sta ICBAH,x
lda #OPEN
sta ICCOM,x
doopen: tax
pha
jsr clriocb
pla
tax
lda #<rdev
sta ICBAL,x
lda #>rdev
sta ICBAH,x
lda #OPEN
sta ICCOM,x
lda #$0D ; mode in+out+concurrent
sta ICAX1,x
lda #0
sta ICAX2,x
sta ICBLL,x ; zap buf len
sta ICBLH,x
jsr CIOV
bmi cioerr1
lda #$0D ; mode in+out+concurrent
sta ICAX1,x
lda #0
sta ICAX2,x
sta ICBLL,x ; zap buf len
sta ICBLH,x
jsr CIOV
bmi cioerr1
lda tmp2 ; get fd
sta rshand
ldx #0
stx rshand+1
txa
rts
lda tmp2 ; get fd
sta rshand
ldx #0
stx rshand+1
txa
rts
cioerr1:jsr fddecusage ; decrement usage counter of fd as open failed
cioerr1:jsr fddecusage ; decrement usage counter of fd as open failed
init_err:
ldx #0
lda #RS_ERR_INIT_FAILED
rts
ldx #0
lda #RS_ERR_INIT_FAILED
rts
.endproc ; _rs232_init
.endproc ; _rs232_init
;----------------------------------------------------------------------------
@@ -126,64 +126,64 @@ init_err:
; using 8 bit word size. So only 8 bit is currently tested.
;
.proc _rs232_params
.proc _rs232_params
sta tmp2
lda rshand
cmp #$ff
bne work ; work only if initialized
lda #RS_ERR_NOT_INITIALIZED
bne done
work: lda rshand
ldx #0
jsr fdtoiocb ; get iocb index into X
bmi inverr ; shouldn't happen
tax
sta tmp2
lda rshand
cmp #$ff
bne work ; work only if initialized
lda #RS_ERR_NOT_INITIALIZED
bne done
work: lda rshand
ldx #0
jsr fdtoiocb ; get iocb index into X
bmi inverr ; shouldn't happen
tax
; set handshake lines
; set handshake lines
lda #34 ; xio 34, set cts, dtr etc
sta ICCOM,x
lda #192+48+3 ; DTR on, RTS on, XMT on
sta ICAX1,x
lda #0
sta ICBLL,x
sta ICBLH,x
sta ICBAL,x
sta ICBAH,x
sta ICAX2,x
jsr CIOV
bmi cioerr
lda #34 ; xio 34, set cts, dtr etc
sta ICCOM,x
lda #192+48+3 ; DTR on, RTS on, XMT on
sta ICAX1,x
lda #0
sta ICBLL,x
sta ICBLH,x
sta ICBAL,x
sta ICBAH,x
sta ICAX2,x
jsr CIOV
bmi cioerr
; set baud rate, word size, stop bits and ready monitoring
; set baud rate, word size, stop bits and ready monitoring
lda #36 ; xio 36, baud rate
sta ICCOM,x
jsr popa ; get parameter
sta ICAX1,x
;ICAX2 = 0, monitor nothing
jsr CIOV
bmi cioerr
lda #36 ; xio 36, baud rate
sta ICCOM,x
jsr popa ; get parameter
sta ICAX1,x
;ICAX2 = 0, monitor nothing
jsr CIOV
bmi cioerr
; set translation and parity
; set translation and parity
lda #38 ; xio 38, translation and parity
sta ICCOM,x
lda tmp2
ora #32 ; no translation
sta ICAX1,x
jsr CIOV
bmi cioerr
lda #38 ; xio 38, translation and parity
sta ICCOM,x
lda tmp2
ora #32 ; no translation
sta ICAX1,x
jsr CIOV
bmi cioerr
lda #0
done: ldx #0
rts
lda #0
done: ldx #0
rts
inverr: jmp __inviocb
inverr: jmp __inviocb
.endproc ;_rs232_params
.endproc ;_rs232_params
cioerr: jmp __do_oserror
cioerr: jmp __do_oserror
;----------------------------------------------------------------------------
@@ -196,28 +196,28 @@ cioerr: jmp __do_oserror
; */
;
.proc _rs232_done
.proc _rs232_done
lda rshand
cmp #$ff
beq done
work: ldx rshand+1
jsr pushax
jsr _close
pha
txa
pha
ldx #$ff
stx rshand
stx rshand+1
inx
stx cm_run
pla
tax
pla
done: rts
lda rshand
cmp #$ff
beq done
work: ldx rshand+1
jsr pushax
jsr _close
pha
txa
pha
ldx #$ff
stx rshand
stx rshand+1
inx
stx cm_run
pla
tax
pla
done: rts
.endproc ;rs232_done
.endproc ;rs232_done
;----------------------------------------------------------------------------
@@ -228,61 +228,61 @@ done: rts
; */
;
.proc _rs232_get
.proc _rs232_get
ldy rshand
cpy #$ff
bne work ; work only if initialized
lda #RS_ERR_NOT_INITIALIZED
bne nierr
ldy rshand
cpy #$ff
bne work ; work only if initialized
lda #RS_ERR_NOT_INITIALIZED
bne nierr
work: sta ptr1
stx ptr1+1 ; store pointer to received char
work: sta ptr1
stx ptr1+1 ; store pointer to received char
lda rshand
ldx #0
jsr fdtoiocb
tax
lda cm_run ; concurrent mode already running?
bne go
jsr ena_cm ; turn on concurrent mode
lda rshand
ldx #0
jsr fdtoiocb
tax
lda cm_run ; concurrent mode already running?
bne go
jsr ena_cm ; turn on concurrent mode
go: ; check whether there is any input available
go: ; check whether there is any input available
lda #STATIS ; status request, returns bytes pending
sta ICCOM,x
jsr CIOV
bmi cioerr ; @@@ error handling
lda #STATIS ; status request, returns bytes pending
sta ICCOM,x
jsr CIOV
bmi cioerr ; @@@ error handling
lda DVSTAT+1 ; get byte count pending
ora DVSTAT+2
beq nix_da ; no input waiting...
lda DVSTAT+1 ; get byte count pending
ora DVSTAT+2
beq nix_da ; no input waiting...
; input is available: get it!
; input is available: get it!
lda #GETCHR ; get raw bytes
sta ICCOM,x ; in command code
lda #0
sta ICBLL,x
sta ICBLH,x
sta ICBAL,x
sta ICBAH,x
jsr CIOV ; go get it
bmi cioerr ; @@@ error handling
lda #GETCHR ; get raw bytes
sta ICCOM,x ; in command code
lda #0
sta ICBLL,x
sta ICBLH,x
sta ICBAL,x
sta ICBAH,x
jsr CIOV ; go get it
bmi cioerr ; @@@ error handling
ldx #0
sta (ptr1,x) ; return received byte
txa
rts
ldx #0
sta (ptr1,x) ; return received byte
txa
rts
nierr: ldx #0
rts
nierr: ldx #0
rts
nix_da: lda #RS_ERR_NO_DATA
ldx #0
rts
nix_da: lda #RS_ERR_NO_DATA
ldx #0
rts
.endproc ;_rs232_get
.endproc ;_rs232_get
;----------------------------------------------------------------------------
@@ -294,39 +294,39 @@ nix_da: lda #RS_ERR_NO_DATA
; */
;
.proc _rs232_put
.proc _rs232_put
ldy rshand
cpy #$ff
bne work ; work only if initialized
lda #RS_ERR_NOT_INITIALIZED
bne nierr
ldy rshand
cpy #$ff
bne work ; work only if initialized
lda #RS_ERR_NOT_INITIALIZED
bne nierr
work: pha
lda rshand
ldx #0
jsr fdtoiocb
tax
lda cm_run ; concurrent mode already running?
bne go
jsr ena_cm ; turn on concurrent mode
work: pha
lda rshand
ldx #0
jsr fdtoiocb
tax
lda cm_run ; concurrent mode already running?
bne go
jsr ena_cm ; turn on concurrent mode
; @@@TODO: check output buffer overflow
go: lda #PUTCHR ; put raw bytes
sta ICCOM,x ; in command code
lda #0
sta ICBLL,x
sta ICBLH,x
sta ICBAL,x
sta ICBAH,x
pla ; get the char back
jsr CIOV ; go do it
rts
; @@@TODO: check output buffer overflow
go: lda #PUTCHR ; put raw bytes
sta ICCOM,x ; in command code
lda #0
sta ICBLL,x
sta ICBLH,x
sta ICBAL,x
sta ICBAH,x
pla ; get the char back
jsr CIOV ; go do it
rts
nierr: ldx #0
rts
nierr: ldx #0
rts
.endproc ;_rs232_put
.endproc ;_rs232_put
;----------------------------------------------------------------------------
;
@@ -349,41 +349,41 @@ _rs232_unpause:
;----------------------------------------------------------------------------
;
; unsigned char __fastcall__ rs232_status (unsigned char* status,
; unsigned char* errors);
; unsigned char* errors);
; /* Return the serial port status. */
;
_rs232_status:
lda #255
tax
rts
lda #255
tax
rts
; enable concurrent rs232 mode
; gets iocb index in X
; all registers destroyed
.proc ena_cm
.proc ena_cm
lda #40 ; XIO 40, start concurrent IO
sta ICCOM,x
sta cm_run ; indicate concurrent mode is running
lda #0
sta ICAX1,x
sta ICAX2,x
lda #<recv_buf
sta ICBAL,x
lda #>recv_buf
sta ICBAH,x
lda #<RECVBUF_SZ
sta ICBLL,x
lda #>RECVBUF_SZ
sta ICBLH,x
lda #$0D ; value from 850 man, p62. must be 0D?,
sta ICAX1,x ; or any non-zero?
jmp CIOV
lda #40 ; XIO 40, start concurrent IO
sta ICCOM,x
sta cm_run ; indicate concurrent mode is running
lda #0
sta ICAX1,x
sta ICAX2,x
lda #<recv_buf
sta ICBAL,x
lda #>recv_buf
sta ICBAH,x
lda #<RECVBUF_SZ
sta ICBLL,x
lda #>RECVBUF_SZ
sta ICBLH,x
lda #$0D ; value from 850 man, p62. must be 0D?,
sta ICAX1,x ; or any non-zero?
jmp CIOV
.endproc ;ena_cm
.endproc ;ena_cm
.end
.end

View File

@@ -2,42 +2,42 @@
; common iocb setup routine for read, write
; expects __fastcall__ parameters (int fd, void *buf, int count)
;
.include "atari.inc"
.include "errno.inc"
.import popax
.import fdtoiocb
.include "atari.inc"
.include "errno.inc"
.import popax
.import fdtoiocb
.export __rwsetup
.export __rwsetup
__rwsetup:
pha ; push size in stack
txa
pha
jsr popax ; get buffer address
pha
txa
pha
jsr popax ; get handle
jsr fdtoiocb ; convert to iocb
bmi iocberr ; negative (X=$FF or A>$7F) on error.
tax
pla ; store address
sta ICBAH,x
pla
sta ICBAL,x
pla ; store length
sta ICBLH,x
pla
sta ICBLL,x
ora ICBLH,x ; returns Z if length is 0
rts
pha ; push size in stack
txa
pha
jsr popax ; get buffer address
pha
txa
pha
jsr popax ; get handle
jsr fdtoiocb ; convert to iocb
bmi iocberr ; negative (X=$FF or A>$7F) on error.
tax
pla ; store address
sta ICBAH,x
pla
sta ICBAL,x
pla ; store length
sta ICBLH,x
pla
sta ICBLL,x
ora ICBLH,x ; returns Z if length is 0
rts
iocberr:pla
pla
pla
pla
ldx #$FF ; indicate error + clear ZF
rts
pla
pla
pla
ldx #$FF ; indicate error + clear ZF
rts

View File

@@ -6,10 +6,10 @@
; void _rest_vecs(void);
;
.export __save_vecs,__rest_vecs
.include "atari.inc"
.export __save_vecs,__rest_vecs
.include "atari.inc"
.bss
.bss
old_dli: .res 2
old_dlist: .res 2
@@ -20,86 +20,86 @@ old_dma: .res 1
old_prior: .res 1
old_cols: .res 8
old_set: .res 1
old_rmargin: .res 1 ; lmargin saved in startup code
old_rmargin: .res 1 ; lmargin saved in startup code
.code
.code
.proc __save_vecs
.proc __save_vecs
lda VDSLST
sta old_dli
lda VDSLST+1
sta old_dli+1
lda SDLSTL
sta old_dlist
lda SDLSTL+1
sta old_dlist+1
lda VVBLKI
sta old_vbi
lda VVBLKI+1
sta old_vbi+1
lda VVBLKD
sta old_vbd
lda VVBLKD+1
sta old_vbd+1
lda GRACTL
sta old_gra
lda SDMCTL
sta old_dma
lda GPRIOR
sta old_prior
lda CHBAS
sta old_set
lda RMARGN
sta old_rmargin
lda VDSLST
sta old_dli
lda VDSLST+1
sta old_dli+1
lda SDLSTL
sta old_dlist
lda SDLSTL+1
sta old_dlist+1
lda VVBLKI
sta old_vbi
lda VVBLKI+1
sta old_vbi+1
lda VVBLKD
sta old_vbd
lda VVBLKD+1
sta old_vbd+1
lda GRACTL
sta old_gra
lda SDMCTL
sta old_dma
lda GPRIOR
sta old_prior
lda CHBAS
sta old_set
lda RMARGN
sta old_rmargin
ldy #7
ldy #7
SETUP1:
lda PCOLR0,y
sta old_cols,y
dey
bpl SETUP1
rts
lda PCOLR0,y
sta old_cols,y
dey
bpl SETUP1
rts
.endproc
.proc __rest_vecs
.proc __rest_vecs
lda #6
ldx old_vbi+1
ldy old_vbi
jsr SETVBV
lda #7
ldx old_vbd+1
ldy old_vbd
jsr SETVBV
lda old_dli
sta VDSLST
lda old_dli+1
sta VDSLST+1
lda old_dlist
sta SDLSTL
lda old_dlist+1
sta SDLSTL+1
lda old_gra
sta GRACTL
lda old_prior
sta GPRIOR
lda old_dma
sta SDMCTL
lda old_set
sta CHBAS
lda old_rmargin
sta RMARGN
lda #$FF
sta CH
ldy #7
lda #6
ldx old_vbi+1
ldy old_vbi
jsr SETVBV
lda #7
ldx old_vbd+1
ldy old_vbd
jsr SETVBV
lda old_dli
sta VDSLST
lda old_dli+1
sta VDSLST+1
lda old_dlist
sta SDLSTL
lda old_dlist+1
sta SDLSTL+1
lda old_gra
sta GRACTL
lda old_prior
sta GPRIOR
lda old_dma
sta SDMCTL
lda old_set
sta CHBAS
lda old_rmargin
sta RMARGN
lda #$FF
sta CH
ldy #7
SETUP2:
lda old_cols,Y
sta PCOLR0,Y
dey
bpl SETUP2
rts
lda old_cols,Y
sta PCOLR0,Y
dey
bpl SETUP2
rts
.endproc

View File

@@ -6,159 +6,159 @@
; numlines < 0 scrolls down
;
.include "atari.inc"
.importzp tmp1,tmp4,ptr1,ptr2
.import mul40,_clrscr
.export __scroll
.include "atari.inc"
.importzp tmp1,tmp4,ptr1,ptr2
.import mul40,_clrscr
.export __scroll
.proc __scroll
.proc __scroll
cmp #0
beq jmpfin
; cmp #$80
; bcc up
bpl up
cmp #0
beq jmpfin
; cmp #$80
; bcc up
bpl up
;scroll down
eor #$ff
clc
adc #1 ; make positive
sta tmp1
eor #$ff
clc
adc #1 ; make positive
sta tmp1
cmp #24 ; scroll >= the whole screen?
bcc down_ok
jmp _clrscr
cmp #24 ; scroll >= the whole screen?
bcc down_ok
jmp _clrscr
down_ok:lda SAVMSC
clc
adc #<(40*23)
sta ptr1
sta ptr2
lda SAVMSC+1
adc #>(40*23)
sta ptr1+1 ; point to last line on screen
sta ptr2+1
down_ok:lda SAVMSC
clc
adc #<(40*23)
sta ptr1
sta ptr2
lda SAVMSC+1
adc #>(40*23)
sta ptr1+1 ; point to last line on screen
sta ptr2+1
lda tmp1
jsr mul40
sta tmp4
lda ptr2
sec
sbc tmp4
sta ptr2
stx tmp4
lda ptr2+1
sbc tmp4
sta ptr2+1
lda tmp1
jsr mul40
sta tmp4
lda ptr2
sec
sbc tmp4
sta ptr2
stx tmp4
lda ptr2+1
sbc tmp4
sta ptr2+1
lda #24 ; # of lines on screen
sec
sbc tmp1 ; # of lines to move
tax
lda #24 ; # of lines on screen
sec
sbc tmp1 ; # of lines to move
tax
;very simple, could be improved
;very simple, could be improved
scrold: ldy #39 ; # of chars on a line - 1
copy_d: lda (ptr2),y
sta (ptr1),y
dey
bpl copy_d
lda ptr1
sec
sbc #40
sta ptr1
bcs u1
dec ptr1+1
u1: lda ptr2
sec
sbc #40
sta ptr2
bcs u2
dec ptr2+1
u2: dex
bne scrold
scrold: ldy #39 ; # of chars on a line - 1
copy_d: lda (ptr2),y
sta (ptr1),y
dey
bpl copy_d
lda ptr1
sec
sbc #40
sta ptr1
bcs u1
dec ptr1+1
u1: lda ptr2
sec
sbc #40
sta ptr2
bcs u2
dec ptr2+1
u2: dex
bne scrold
; fill new scrolled in lines with space
; fill new scrolled in lines with space
ldx tmp1 ; # of new lines
fild: lda #0
ldy #39
fill_d: sta (ptr1),y
dey
bpl fill_d
dex
jmpfin: beq finish
lda ptr1
sec
sbc #40
sta ptr1
bcs u3
dec ptr1+1
u3: jmp fild
ldx tmp1 ; # of new lines
fild: lda #0
ldy #39
fill_d: sta (ptr1),y
dey
bpl fill_d
dex
jmpfin: beq finish
lda ptr1
sec
sbc #40
sta ptr1
bcs u3
dec ptr1+1
u3: jmp fild
;scroll up
up: sta tmp1 ; # of lines to scroll
cmp #24 ; scroll >= the whole screen?
bcc up_ok
jmp _clrscr
up: sta tmp1 ; # of lines to scroll
cmp #24 ; scroll >= the whole screen?
bcc up_ok
jmp _clrscr
;multiply by 40 (xsize)
up_ok: jsr mul40
clc
adc SAVMSC ; add start of screen mem
sta ptr2
txa
adc SAVMSC+1
sta ptr2+1
lda SAVMSC+1
sta ptr1+1
lda SAVMSC
sta ptr1
lda #24 ; # of lines on screen
sec
sbc tmp1 ; # of lines to move
tax
;multiply by 40 (xsize)
up_ok: jsr mul40
clc
adc SAVMSC ; add start of screen mem
sta ptr2
txa
adc SAVMSC+1
sta ptr2+1
lda SAVMSC+1
sta ptr1+1
lda SAVMSC
sta ptr1
lda #24 ; # of lines on screen
sec
sbc tmp1 ; # of lines to move
tax
;very simple, could be improved
;very simple, could be improved
scroll: ldy #39 ; # of chars on a line - 1
copy_l: lda (ptr2),y
sta (ptr1),y
dey
bpl copy_l
lda #40
clc
adc ptr1
sta ptr1
bcc l1
inc ptr1+1
l1: lda #40
clc
adc ptr2
sta ptr2
bcc l2
inc ptr2+1
l2: dex
bne scroll
scroll: ldy #39 ; # of chars on a line - 1
copy_l: lda (ptr2),y
sta (ptr1),y
dey
bpl copy_l
lda #40
clc
adc ptr1
sta ptr1
bcc l1
inc ptr1+1
l1: lda #40
clc
adc ptr2
sta ptr2
bcc l2
inc ptr2+1
l2: dex
bne scroll
; fill new scrolled in lines with space
; fill new scrolled in lines with space
ldx tmp1 ; # of new lines
fill: lda #0
ldy #39
fill_l: sta (ptr1),y
dey
bpl fill_l
dex
beq finish
lda #40
clc
adc ptr1
sta ptr1
bcc l3
inc ptr1+1
l3: jmp fill
ldx tmp1 ; # of new lines
fill: lda #0
ldy #39
fill_l: sta (ptr1),y
dey
bpl fill_l
dex
beq finish
lda #40
clc
adc ptr1
sta ptr1
bcc l3
inc ptr1+1
l3: jmp fill
finish: rts
finish: rts
.endproc

View File

@@ -9,43 +9,43 @@
;
.export __setcolor, __setcolor_low, __getcolor
.import popa
.include "atari.inc"
.export __setcolor, __setcolor_low, __getcolor
.import popa
.include "atari.inc"
.proc __getcolor
.proc __getcolor
tax
lda COLOR0,x ; get current value
ldx #0
rts
tax
lda COLOR0,x ; get current value
ldx #0
rts
.endproc
.proc __setcolor
.proc __setcolor
; asl a ; not -> BASIC compatible
sta lum ; remember luminance
jsr popa ; get hue
asl a
asl a
asl a
asl a
ora lum
; jmp __setcolor_low
; asl a ; not -> BASIC compatible
sta lum ; remember luminance
jsr popa ; get hue
asl a
asl a
asl a
asl a
ora lum
; jmp __setcolor_low
.endproc
.proc __setcolor_low
.proc __setcolor_low
pha
jsr popa
tax
pla
sta COLOR0,x
rts
pha
jsr popa
tax
pla
sta COLOR0,x
rts
.endproc
.bss
lum: .res 1
.bss
lum: .res 1

View File

@@ -7,83 +7,83 @@
; to save space with _dio_read and _dio_write functions.
;
; unsigned char __fastcall__ _sio_call(dhandle_t handle,
; unsigned sect_num,
; void *buffer,
; unsigned sio_val);
; unsigned sect_num,
; void *buffer,
; unsigned sio_val);
; dhandle_t - 16bit (ptr)
; sio_val is (sio_command | sio_direction << 8)
;
.export __sio_call
.include "atari.inc"
.import popa,popax
.import sectsizetab,__oserror
.importzp ptr1
.export __sio_call
.include "atari.inc"
.import popa,popax
.import sectsizetab,__oserror
.importzp ptr1
.proc __sio_call
.proc __sio_call
sta DCOMND ; set command into DCB
stx DSTATS ; set data flow directon
jsr popax ; get buffer address
sta DBUFLO ; set buffer address into DCB
stx DBUFHI
jsr popax
sta DAUX1 ; set sector #
stx DAUX2
sta DCOMND ; set command into DCB
stx DSTATS ; set data flow directon
jsr popax ; get buffer address
sta DBUFLO ; set buffer address into DCB
stx DBUFHI
jsr popax
sta DAUX1 ; set sector #
stx DAUX2
jsr popax
sta ptr1
stx ptr1+1
jsr popax
sta ptr1
stx ptr1+1
ldy #sst_flag
lda (ptr1),y
and #128
beq _inv_hand ; handle not open or invalid
ldy #sst_flag
lda (ptr1),y
and #128
beq _inv_hand ; handle not open or invalid
ldy #sst_driveno
lda (ptr1),y
ldy #sst_driveno
lda (ptr1),y
clc
adc #1
sta DUNIT ; unit number (d1,d2,d3,...)
clc
adc #1
sta DUNIT ; unit number (d1,d2,d3,...)
lda DAUX2 ; high byte sector #
bne _realsz
lda DAUX1
cmp #4 ; sectors 1 to 3 are special (always 128 bytes)
bcs _realsz
lda DAUX2 ; high byte sector #
bne _realsz
lda DAUX1
cmp #4 ; sectors 1 to 3 are special (always 128 bytes)
bcs _realsz
lda #$80
sta DBYTLO
asl a
sta DBYTHI
beq _cont
lda #$80
sta DBYTLO
asl a
sta DBYTHI
beq _cont
_realsz:ldy #sst_sectsize
lda (ptr1),y
sta DBYTLO
iny
lda (ptr1),y
sta DBYTHI
_realsz:ldy #sst_sectsize
lda (ptr1),y
sta DBYTLO
iny
lda (ptr1),y
sta DBYTHI
_cont: lda #DISKID ; SIO bus ID of diskette drive
sta DDEVIC
lda #15
sta DTIMLO ; value got from DOS source
_cont: lda #DISKID ; SIO bus ID of diskette drive
sta DDEVIC
lda #15
sta DTIMLO ; value got from DOS source
jsr SIOV ; execute
jsr SIOV ; execute
ldx #0
lda DSTATS
bmi _req_err ; error occurred
txa ; no error occurred
ldx #0
lda DSTATS
bmi _req_err ; error occurred
txa ; no error occurred
_req_err:
sta __oserror
rts
sta __oserror
rts
_inv_hand:
ldx #0
lda #BADIOC
bne _req_err
ldx #0
lda #BADIOC
bne _req_err
.endproc

View File

@@ -6,83 +6,83 @@
; for SpartaDOS and MyDOS
;
.include "atari.inc"
.import findfreeiocb
.import __dos_type
.import initcwd
.importzp tmp4
.ifdef UCASE_FILENAME
.importzp tmp3
.import addysp
.import ucase_fn
.include "atari.inc"
.import findfreeiocb
.import __dos_type
.import initcwd
.importzp tmp4
.ifdef UCASE_FILENAME
.importzp tmp3
.import addysp
.import ucase_fn
.endif
.export __syschdir
.export __syschdir
.proc __syschdir
.proc __syschdir
pha ; save input parameter
txa
pha
pha ; save input parameter
txa
pha
jsr findfreeiocb
beq iocbok ; we found one
jsr findfreeiocb
beq iocbok ; we found one
pla
pla ; fix up stack
pla
pla ; fix up stack
lda #TMOF ; too many open files
rts
lda #TMOF ; too many open files
rts
iocbok: stx tmp4 ; remember IOCB index
pla
tax
pla ; get argument again
iocbok: stx tmp4 ; remember IOCB index
pla
tax
pla ; get argument again
.ifdef UCASE_FILENAME
.ifdef UCASE_FILENAME
jsr ucase_fn
bcc ucok1
jsr ucase_fn
bcc ucok1
lda #183 ; see oserror.s
rts
lda #183 ; see oserror.s
rts
ucok1:
.endif ; defined UCASE_FILENAME
.endif ; defined UCASE_FILENAME
ldy tmp4 ; IOCB index
sta ICBAL,y ; store pointer to filename
txa
sta ICBAH,y
tya
tax
lda __dos_type
cmp #SPARTADOS
beq :+
lda #41
.byte $2C ; BIT <abs>
: lda #44
sta ICCOM,x
lda #0
sta ICAX1,x
sta ICAX2,x
sta ICBLL,x
sta ICBLH,x
jsr CIOV
ldy tmp4 ; IOCB index
sta ICBAL,y ; store pointer to filename
txa
sta ICBAH,y
tya
tax
lda __dos_type
cmp #SPARTADOS
beq :+
lda #41
.byte $2C ; BIT <abs>
: lda #44
sta ICCOM,x
lda #0
sta ICAX1,x
sta ICAX2,x
sta ICBLL,x
sta ICBLH,x
jsr CIOV
.ifdef UCASE_FILENAME
tya
pha
ldy tmp3 ; get size
jsr addysp ; free used space on the stack
pla
tay
.endif ; defined UCASE_FILENAME
.ifdef UCASE_FILENAME
tya
pha
ldy tmp3 ; get size
jsr addysp ; free used space on the stack
pla
tay
.endif ; defined UCASE_FILENAME
bmi cioerr
jsr initcwd
lda #0
rts
cioerr: tya
rts
bmi cioerr
jsr initcwd
lda #0
rts
cioerr: tya
rts
.endproc ; __syschdir
.endproc ; __syschdir

View File

@@ -6,84 +6,84 @@
; for SpartaDOS and MYDOS
;
.include "atari.inc"
.include "errno.inc"
.import addysp
.import popax
.import findfreeiocb
.importzp tmp4
.ifdef UCASE_FILENAME
.importzp tmp3
.import ucase_fn
.include "atari.inc"
.include "errno.inc"
.import addysp
.import popax
.import findfreeiocb
.importzp tmp4
.ifdef UCASE_FILENAME
.importzp tmp3
.import ucase_fn
.endif
.export __sysmkdir
.export __sysmkdir
.proc __sysmkdir
.proc __sysmkdir
dey ; parm count < 2 shouldn't be needed to be...
dey ; ...checked (it generates a C compiler warning)
beq parmok ; branch if parameter count ok
jsr addysp ; fix stack, throw away unused parameters
dey ; parm count < 2 shouldn't be needed to be...
dey ; ...checked (it generates a C compiler warning)
beq parmok ; branch if parameter count ok
jsr addysp ; fix stack, throw away unused parameters
parmok: jsr popax ; get name
pha ; save input parameter
txa
pha
parmok: jsr popax ; get name
pha ; save input parameter
txa
pha
jsr findfreeiocb
beq iocbok ; we found one
jsr findfreeiocb
beq iocbok ; we found one
pla
pla ; fix up stack
pla
pla ; fix up stack
lda #TMOF ; too many open files
rts
lda #TMOF ; too many open files
rts
iocbok: stx tmp4 ; remember IOCB index
pla
tax
pla ; get argument again
iocbok: stx tmp4 ; remember IOCB index
pla
tax
pla ; get argument again
.ifdef UCASE_FILENAME
.ifdef UCASE_FILENAME
jsr ucase_fn
bcc ucok1
jsr ucase_fn
bcc ucok1
lda #183 ; see oserror.s
rts
lda #183 ; see oserror.s
rts
ucok1:
.endif ; defined UCASE_FILENAME
.endif ; defined UCASE_FILENAME
ldy tmp4 ; IOCB index
sta ICBAL,y ; store pointer to filename
txa
sta ICBAH,y
tya
tax
lda #42
sta ICCOM,x
lda #8
sta ICAX1,x
lda #0
sta ICAX2,x
sta ICBLL,x
sta ICBLH,x
jsr CIOV
ldy tmp4 ; IOCB index
sta ICBAL,y ; store pointer to filename
txa
sta ICBAH,y
tya
tax
lda #42
sta ICCOM,x
lda #8
sta ICAX1,x
lda #0
sta ICAX2,x
sta ICBLL,x
sta ICBLH,x
jsr CIOV
.ifdef UCASE_FILENAME
tya
pha
ldy tmp3 ; get size
jsr addysp ; free used space on the stack
pla
tay
.endif ; defined UCASE_FILENAME
.ifdef UCASE_FILENAME
tya
pha
ldy tmp3 ; get size
jsr addysp ; free used space on the stack
pla
tay
.endif ; defined UCASE_FILENAME
bmi cioerr
lda #0
rts
cioerr: tya
rts
bmi cioerr
lda #0
rts
cioerr: tya
rts
.endproc ; __sysmkdir
.endproc ; __sysmkdir

View File

@@ -4,76 +4,76 @@
; int remove (const char* name);
;
.include "atari.inc"
.include "errno.inc"
.import findfreeiocb
.importzp tmp4
.ifdef UCASE_FILENAME
.importzp tmp3
.import addysp
.import ucase_fn
.include "atari.inc"
.include "errno.inc"
.import findfreeiocb
.importzp tmp4
.ifdef UCASE_FILENAME
.importzp tmp3
.import addysp
.import ucase_fn
.endif
.export __sysremove
.export __sysremove
.proc __sysremove
.proc __sysremove
pha ; save input parameter
txa
pha
pha ; save input parameter
txa
pha
jsr findfreeiocb
beq iocbok ; we found one
jsr findfreeiocb
beq iocbok ; we found one
pla
pla ; fix up stack
pla
pla ; fix up stack
lda #TMOF ; too many open files
rts
lda #TMOF ; too many open files
rts
iocbok: stx tmp4 ; remember IOCB index
pla
tax
pla ; get argument again
iocbok: stx tmp4 ; remember IOCB index
pla
tax
pla ; get argument again
.ifdef UCASE_FILENAME
.ifdef UCASE_FILENAME
jsr ucase_fn
bcc ucok1
jsr ucase_fn
bcc ucok1
lda #183 ; see oserror.s
rts
lda #183 ; see oserror.s
rts
ucok1:
.endif ; defined UCASE_FILENAME
.endif ; defined UCASE_FILENAME
ldy tmp4 ; IOCB index
sta ICBAL,y ; store pointer to filename
txa
sta ICBAH,y
tya
tax
lda #DELETE
sta ICCOM,x
lda #0
sta ICAX1,x
sta ICAX2,x
sta ICBLL,x
sta ICBLH,x
jsr CIOV
ldy tmp4 ; IOCB index
sta ICBAL,y ; store pointer to filename
txa
sta ICBAH,y
tya
tax
lda #DELETE
sta ICCOM,x
lda #0
sta ICAX1,x
sta ICAX2,x
sta ICBLL,x
sta ICBLH,x
jsr CIOV
.ifdef UCASE_FILENAME
tya
pha
ldy tmp3 ; get size
jsr addysp ; free used space on the stack
pla
tay
.endif ; defined UCASE_FILENAME
.ifdef UCASE_FILENAME
tya
pha
ldy tmp3 ; get size
jsr addysp ; free used space on the stack
pla
tay
.endif ; defined UCASE_FILENAME
bmi cioerr
lda #0
rts
cioerr: tya
rts
bmi cioerr
lda #0
rts
cioerr: tya
rts
.endproc ; __sysremove
.endproc ; __sysremove

View File

@@ -4,7 +4,7 @@
; unsigned char __fastcall__ _sysrmdir (const char* name);
;
.export __sysrmdir
.import __sysremove
.export __sysrmdir
.import __sysremove
__sysrmdir := __sysremove

View File

@@ -9,7 +9,7 @@
; */
;
.export __systime
.export __systime
.importzp sreg

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 10
grmode = 10
; X resolution
x_res = 80
x_res = 80
; Y resolution
y_res = 192
y_res = 192
; Number of colors
colors = 9
colors = 9
; Pixels per byte
ppb = 2
ppb = 2
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $0330 ; based on 4/3 display
aspect = $0330 ; based on 4/3 display
; Free memory needed
mem_needed = 7147
mem_needed = 7147
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %11110000, %00001111
masks: ; Color masks
.byte $00, $11, $22, $33, $44, $55, $66, $77, $88
bar_table: ; Mask table for BAR
.byte %11111111, %00001111, %00000000
default_palette:
.byte $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A
mask_table: ; Mask table to set pixels
.byte %11110000, %00001111
masks: ; Color masks
.byte $00, $11, $22, $33, $44, $55, $66, $77, $88
bar_table: ; Mask table for BAR
.byte %11111111, %00001111, %00000000
default_palette:
.byte $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A
.code
@@ -55,22 +55,22 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
sta PCOLR0,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
sta PCOLR0,y
dey
bpl loop
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 11
grmode = 11
; X resolution
x_res = 80
x_res = 80
; Y resolution
y_res = 192
y_res = 192
; Number of colors
colors = 16
colors = 16
; Pixels per byte
ppb = 2
ppb = 2
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $0330 ; based on 4/3 display
aspect = $0330 ; based on 4/3 display
; Free memory needed
mem_needed = 7147
mem_needed = 7147
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %11110000, %00001111
masks: ; Color masks
.byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff
bar_table: ; Mask table for BAR
.byte %11111111, %00001111, %00000000
default_palette:
.byte $00, $10, $20, $30, $40, $50, $60, $70, $80, $90, $A0, $B0, $C0, $D0, $E0, $F0
mask_table: ; Mask table to set pixels
.byte %11110000, %00001111
masks: ; Color masks
.byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff
bar_table: ; Mask table for BAR
.byte %11111111, %00001111, %00000000
default_palette:
.byte $00, $10, $20, $30, $40, $50, $60, $70, $80, $90, $A0, $B0, $C0, $D0, $E0, $F0
.code
@@ -55,14 +55,14 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; No palettes
; No palettes
lda #TGI_ERR_INV_FUNC
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 14
grmode = 14
; X resolution
x_res = 160
x_res = 160
; Y resolution
y_res = 192
y_res = 192
; Number of colors
colors = 2
colors = 2
; Pixels per byte
ppb = 8
ppb = 8
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $0198 ; based on 4/3 display
aspect = $0198 ; based on 4/3 display
; Free memory needed
mem_needed = 3305
mem_needed = 3305
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
masks: ; Color masks
.byte %00000000, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
default_palette:
.byte $00, $0E
mask_table: ; Mask table to set pixels
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
masks: ; Color masks
.byte %00000000, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
default_palette:
.byte $00, $0E
.code
@@ -55,27 +55,27 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 15
grmode = 15
; X resolution
x_res = 160
x_res = 160
; Y resolution
y_res = 192
y_res = 192
; Number of colors
colors = 4
colors = 4
; Pixels per byte
ppb = 4
ppb = 4
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $0198 ; based on 4/3 display
aspect = $0198 ; based on 4/3 display
; Free memory needed
mem_needed = 7147
mem_needed = 7147
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %11000000, %00110000, %00001100, %00000011
masks: ; Color masks
.byte %00000000, %01010101, %10101010, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %00111111, %00001111, %00000011, %00000000
default_palette:
.byte $00, $0E, $32, $96
mask_table: ; Mask table to set pixels
.byte %11000000, %00110000, %00001100, %00000011
masks: ; Color masks
.byte %00000000, %01010101, %10101010, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %00111111, %00001111, %00000011, %00000000
default_palette:
.byte $00, $0E, $32, $96
.code
@@ -55,31 +55,31 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
lda palette + 2
sta COLOR1
lda palette + 3
sta COLOR2
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
lda palette + 2
sta COLOR1
lda palette + 3
sta COLOR2
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 3
grmode = 3
; X resolution
x_res = 40
x_res = 40
; Y resolution
y_res = 24
y_res = 24
; Number of colors
colors = 4
colors = 4
; Pixels per byte
ppb = 4
ppb = 4
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $00CC ; based on 4/3 display
aspect = $00CC ; based on 4/3 display
; Free memory needed
mem_needed = 1
mem_needed = 1
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %11000000, %00110000, %00001100, %00000011
masks: ; Color masks
.byte %00000000, %01010101, %10101010, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %00111111, %00001111, %00000011, %00000000
default_palette:
.byte $00, $0E, $32, $96
mask_table: ; Mask table to set pixels
.byte %11000000, %00110000, %00001100, %00000011
masks: ; Color masks
.byte %00000000, %01010101, %10101010, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %00111111, %00001111, %00000011, %00000000
default_palette:
.byte $00, $0E, $32, $96
.code
@@ -55,31 +55,31 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
lda palette + 2
sta COLOR1
lda palette + 3
sta COLOR2
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
lda palette + 2
sta COLOR1
lda palette + 3
sta COLOR2
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 4
grmode = 4
; X resolution
x_res = 80
x_res = 80
; Y resolution
y_res = 48
y_res = 48
; Number of colors
colors = 2
colors = 2
; Pixels per byte
ppb = 8
ppb = 8
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $00CC ; based on 4/3 display
aspect = $00CC ; based on 4/3 display
; Free memory needed
mem_needed = 1
mem_needed = 1
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
masks: ; Color masks
.byte %00000000, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
default_palette:
.byte $00, $0E
mask_table: ; Mask table to set pixels
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
masks: ; Color masks
.byte %00000000, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
default_palette:
.byte $00, $0E
.code
@@ -55,27 +55,27 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 5
grmode = 5
; X resolution
x_res = 80
x_res = 80
; Y resolution
y_res = 48
y_res = 48
; Number of colors
colors = 4
colors = 4
; Pixels per byte
ppb = 4
ppb = 4
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $00CC ; based on 4/3 display
aspect = $00CC ; based on 4/3 display
; Free memory needed
mem_needed = 185
mem_needed = 185
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %11000000, %00110000, %00001100, %00000011
masks: ; Color masks
.byte %00000000, %01010101, %10101010, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %00111111, %00001111, %00000011, %00000000
default_palette:
.byte $00, $0E, $32, $96
mask_table: ; Mask table to set pixels
.byte %11000000, %00110000, %00001100, %00000011
masks: ; Color masks
.byte %00000000, %01010101, %10101010, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %00111111, %00001111, %00000011, %00000000
default_palette:
.byte $00, $0E, $32, $96
.code
@@ -55,31 +55,31 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
lda palette + 2
sta COLOR1
lda palette + 3
sta COLOR2
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
lda palette + 2
sta COLOR1
lda palette + 3
sta COLOR2
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 6
grmode = 6
; X resolution
x_res = 160
x_res = 160
; Y resolution
y_res = 96
y_res = 96
; Number of colors
colors = 2
colors = 2
; Pixels per byte
ppb = 8
ppb = 8
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $00CC ; based on 4/3 display
aspect = $00CC ; based on 4/3 display
; Free memory needed
mem_needed = 1193
mem_needed = 1193
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
masks: ; Color masks
.byte %00000000, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
default_palette:
.byte $00, $0E
mask_table: ; Mask table to set pixels
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
masks: ; Color masks
.byte %00000000, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
default_palette:
.byte $00, $0E
.code
@@ -55,27 +55,27 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 7
grmode = 7
; X resolution
x_res = 160
x_res = 160
; Y resolution
y_res = 96
y_res = 96
; Number of colors
colors = 4
colors = 4
; Pixels per byte
ppb = 4
ppb = 4
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $00CC ; based on 4/3 display
aspect = $00CC ; based on 4/3 display
; Free memory needed
mem_needed = 3209
mem_needed = 3209
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %11000000, %00110000, %00001100, %00000011
masks: ; Color masks
.byte %00000000, %01010101, %10101010, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %00111111, %00001111, %00000011, %00000000
default_palette:
.byte $00, $0E, $32, $96
mask_table: ; Mask table to set pixels
.byte %11000000, %00110000, %00001100, %00000011
masks: ; Color masks
.byte %00000000, %01010101, %10101010, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %00111111, %00001111, %00000011, %00000000
default_palette:
.byte $00, $0E, $32, $96
.code
@@ -55,31 +55,31 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
lda palette + 2
sta COLOR1
lda palette + 3
sta COLOR2
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
lda palette + 2
sta COLOR1
lda palette + 3
sta COLOR2
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,77 +4,77 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 8
grmode = 8
; X resolution
x_res = 320
x_res = 320
; Y resolution
y_res = 192
y_res = 192
; Number of colors
colors = 2
colors = 2
; Pixels per byte
ppb = 8
ppb = 8
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $00CC ; based on 4/3 display
aspect = $00CC ; based on 4/3 display
; Free memory needed
mem_needed = 7147
mem_needed = 7147
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
masks: ; Color masks
.byte %00000000, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
default_palette:
.byte $00, $0E
mask_table: ; Mask table to set pixels
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
masks: ; Color masks
.byte %00000000, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
default_palette:
.byte $00, $0E
.code
; ******************************************************************************
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Get the color entries from the palette
lda palette
sta COLOR2
lda palette + 1
sta COLOR1
; Get the color entries from the palette
lda palette
sta COLOR2
lda palette + 1
sta COLOR1
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 9
grmode = 9
; X resolution
x_res = 80
x_res = 80
; Y resolution
y_res = 192
y_res = 192
; Number of colors
colors = 16
colors = 16
; Pixels per byte
ppb = 2
ppb = 2
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $0330 ; based on 4/3 display
aspect = $0330 ; based on 4/3 display
; Free memory needed
mem_needed = 7147
mem_needed = 7147
; Number of screen pages
pages = 1
pages = 1
.rodata
mask_table: ; Mask table to set pixels
.byte %11110000, %00001111
masks: ; Color masks
.byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff
bar_table: ; Mask table for BAR
.byte %11111111, %00001111, %00000000
default_palette:
.byte $00, $0F, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E
mask_table: ; Mask table to set pixels
.byte %11110000, %00001111
masks: ; Color masks
.byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff
bar_table: ; Mask table for BAR
.byte %11111111, %00001111, %00000000
default_palette:
.byte $00, $0F, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E
.code
@@ -55,14 +55,14 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; No palettes
; No palettes
lda #TGI_ERR_INV_FUNC
sta error
rts

File diff suppressed because it is too large Load Diff

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 10
grmode = 10
; X resolution
x_res = 80
x_res = 80
; Y resolution
y_res = 192
y_res = 192
; Number of colors
colors = 9
colors = 9
; Pixels per byte
ppb = 2
ppb = 2
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $0330 ; based on 4/3 display
aspect = $0330 ; based on 4/3 display
; Free memory needed
mem_needed = 15339
mem_needed = 15339
; Number of screen pages
pages = 2
pages = 2
.rodata
mask_table: ; Mask table to set pixels
.byte %11110000, %00001111
masks: ; Color masks
.byte $00, $11, $22, $33, $44, $55, $66, $77, $88
bar_table: ; Mask table for BAR
.byte %11111111, %00001111, %00000000
default_palette:
.byte $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A
mask_table: ; Mask table to set pixels
.byte %11110000, %00001111
masks: ; Color masks
.byte $00, $11, $22, $33, $44, $55, $66, $77, $88
bar_table: ; Mask table for BAR
.byte %11111111, %00001111, %00000000
default_palette:
.byte $00, $0E, $32, $96, $68, $C4, $74, $EE, $4A
.code
@@ -55,22 +55,22 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
sta PCOLR0,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
sta PCOLR0,y
dey
bpl loop
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 15
grmode = 15
; X resolution
x_res = 160
x_res = 160
; Y resolution
y_res = 192
y_res = 192
; Number of colors
colors = 4
colors = 4
; Pixels per byte
ppb = 4
ppb = 4
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $0198 ; based on 4/3 display
aspect = $0198 ; based on 4/3 display
; Free memory needed
mem_needed = 15339
mem_needed = 15339
; Number of screen pages
pages = 2
pages = 2
.rodata
mask_table: ; Mask table to set pixels
.byte %11000000, %00110000, %00001100, %00000011
masks: ; Color masks
.byte %00000000, %01010101, %10101010, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %00111111, %00001111, %00000011, %00000000
default_palette:
.byte $00, $0E, $32, $96
mask_table: ; Mask table to set pixels
.byte %11000000, %00110000, %00001100, %00000011
masks: ; Color masks
.byte %00000000, %01010101, %10101010, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %00111111, %00001111, %00000011, %00000000
default_palette:
.byte $00, $0E, $32, $96
.code
@@ -55,31 +55,31 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
lda palette + 2
sta COLOR1
lda palette + 3
sta COLOR2
; Get the color entries from the palette
lda palette
sta COLOR4
lda palette + 1
sta COLOR0
lda palette + 2
sta COLOR1
lda palette + 3
sta COLOR2
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,77 +4,77 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 8
grmode = 8
; X resolution
x_res = 320
x_res = 320
; Y resolution
y_res = 192
y_res = 192
; Number of colors
colors = 2
colors = 2
; Pixels per byte
ppb = 8
ppb = 8
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $00CC ; based on 4/3 display
aspect = $00CC ; based on 4/3 display
; Free memory needed
mem_needed = 15339
mem_needed = 15339
; Number of screen pages
pages = 2
pages = 2
.rodata
mask_table: ; Mask table to set pixels
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
masks: ; Color masks
.byte %00000000, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
default_palette:
.byte $00, $0E
mask_table: ; Mask table to set pixels
.byte %10000000, %01000000, %00100000, %00010000, %00001000, %00000100, %00000010, %00000001
masks: ; Color masks
.byte %00000000, %11111111
bar_table: ; Mask table for BAR
.byte %11111111, %01111111, %00111111, %00011111, %00001111, %00000111, %00000011, %00000001, %00000000
default_palette:
.byte $00, $0E
.code
; ******************************************************************************
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Copy the palette
ldy #colors - 1
loop: lda (ptr1),y
sta palette,y
dey
bpl loop
; Get the color entries from the palette
lda palette
sta COLOR2
lda palette + 1
sta COLOR1
; Get the color entries from the palette
lda palette
sta COLOR2
lda palette + 1
sta COLOR1
; Done, reset the error code
; Done, reset the error code
lda #TGI_ERR_OK
sta error
rts

View File

@@ -4,50 +4,50 @@
; Fatih Aygun (2009)
;
.include "atari.inc"
.include "zeropage.inc"
.include "atari.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.macpack generic
.macpack generic
; ******************************************************************************
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; Constants and tables
;
; ----------------------------------------------------------------------
; Graphics mode
grmode = 9
grmode = 9
; X resolution
x_res = 80
x_res = 80
; Y resolution
y_res = 192
y_res = 192
; Number of colors
colors = 16
colors = 16
; Pixels per byte
ppb = 2
ppb = 2
; Screen memory size in bytes
scrsize = x_res * y_res / ppb
scrsize = x_res * y_res / ppb
; Pixel aspect ratio
aspect = $0330 ; based on 4/3 display
aspect = $0330 ; based on 4/3 display
; Free memory needed
mem_needed = 15339
mem_needed = 15339
; Number of screen pages
pages = 2
pages = 2
.rodata
mask_table: ; Mask table to set pixels
.byte %11110000, %00001111
masks: ; Color masks
.byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff
bar_table: ; Mask table for BAR
.byte %11111111, %00001111, %00000000
default_palette:
.byte $00, $0F, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E
mask_table: ; Mask table to set pixels
.byte %11110000, %00001111
masks: ; Color masks
.byte $00, $11, $22, $33, $44, $55, $66, $77, $88, $99, $aa, $bb, $cc, $dd, $ee, $ff
bar_table: ; Mask table for BAR
.byte %11111111, %00001111, %00000000
default_palette:
.byte $00, $0F, $01, $02, $03, $04, $05, $06, $07, $08, $09, $0A, $0B, $0C, $0D, $0E
.code
@@ -55,14 +55,14 @@
.proc SETPALETTE
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
; ----------------------------------------------------------------------
;
; SETPALETTE: Set the palette (in ptr1)
;
; ----------------------------------------------------------------------
.code
; No palettes
; No palettes
lda #TGI_ERR_INV_FUNC
sta error
rts

View File

@@ -2,7 +2,7 @@
; Target-specific black & white values for use by the target-shared TGI kernel
;
.include "tgi-kernel.inc"
.include "tgi-kernel.inc"
.export tgi_color_black:zp = $00
.export tgi_color_white:zp = $01
.export tgi_color_black:zp = $00
.export tgi_color_white:zp = $01

View File

@@ -6,8 +6,8 @@
; const void tgi_static_stddrv[];
;
.export _tgi_static_stddrv
.import _atari8_tgi
.export _tgi_static_stddrv
.import _atari8_tgi
.rodata

View File

@@ -6,8 +6,8 @@
; const char tgi_stddrv[];
;
.export _tgi_stddrv
.export _tgi_stddrv
.rodata
_tgi_stddrv: .asciiz "atari8.tgi"
_tgi_stddrv: .asciiz "atari8.tgi"

View File

@@ -8,12 +8,12 @@
.proc _toascii
; Clear the inverse video bit
and #$7F
and #$7F
; X must be zero on return
ldx #0
ldx #0
; Done!
rts
rts
.endproc

View File

@@ -9,18 +9,18 @@
;
.include "atari.inc"
.include "get_tv.inc"
.include "atari.inc"
.include "get_tv.inc"
.proc _get_tv
.proc _get_tv
ldx #TV::NTSC ; Assume NTSC
lda PAL ; use hw register, PALNTS is only supported on XL/XE ROM
and #$0e
bne @NTSC
inx ; = TV::PAL
@NTSC: txa
ldx #0 ; Expand to int
rts
ldx #TV::NTSC ; Assume NTSC
lda PAL ; use hw register, PALNTS is only supported on XL/XE ROM
and #$0e
bne @NTSC
inx ; = TV::PAL
@NTSC: txa
ldx #0 ; Expand to int
rts
.endproc

View File

@@ -6,97 +6,97 @@
; used by open.s and remove.s
;
; Calling parameters:
; AX - points to filename
; AX - points to filename
; Return parameters:
; C - 0/1 for OK/Error (filename too long)
; AX - points to uppercased version of the filename on the stack
; tmp3 - amount of bytes used on the stack (needed for cleanup)
; C - 0/1 for OK/Error (filename too long)
; AX - points to uppercased version of the filename on the stack
; tmp3 - amount of bytes used on the stack (needed for cleanup)
; Uses:
; ptr4 - scratch pointer used to remember original AX pointer
;
;
.include "atari.inc"
.include "atari.inc"
.ifdef DEFAULT_DEVICE
.importzp tmp2
.import __defdev
.ifdef DEFAULT_DEVICE
.importzp tmp2
.import __defdev
.endif
.importzp tmp3,ptr4,sp
.import subysp,addysp
.export ucase_fn
.importzp tmp3,ptr4,sp
.import subysp,addysp
.export ucase_fn
.proc ucase_fn
; we make sure that the filename doesn't contain lowercase letters
; we copy the filename we got onto the stack, uppercase it and use this
; one to open the iocb
; we're using tmp3, ptr4
; we make sure that the filename doesn't contain lowercase letters
; we copy the filename we got onto the stack, uppercase it and use this
; one to open the iocb
; we're using tmp3, ptr4
; save the original pointer
sta ptr4
stx ptr4+1
; save the original pointer
sta ptr4
stx ptr4+1
.ifdef DEFAULT_DEVICE
ldy #1
sty tmp2 ; initialize flag: device present in passed string
lda #':'
cmp (ptr4),y
beq hasdev
iny
cmp (ptr4),y
beq hasdev
sta tmp2 ; set flag: no device in passed string
.ifdef DEFAULT_DEVICE
ldy #1
sty tmp2 ; initialize flag: device present in passed string
lda #':'
cmp (ptr4),y
beq hasdev
iny
cmp (ptr4),y
beq hasdev
sta tmp2 ; set flag: no device in passed string
hasdev:
.endif
ldy #128
sty tmp3 ; save size
jsr subysp ; make room on the stack
ldy #128
sty tmp3 ; save size
jsr subysp ; make room on the stack
; copy filename to the temp. place on the stack, also uppercasing it
ldy #0
; copy filename to the temp. place on the stack, also uppercasing it
ldy #0
loop2: lda (ptr4),y
sta (sp),y
beq copy_end
bmi L1 ; Not lowercase (also, invalid, should reject)
cmp #'a'
bcc L1 ; Not lowercase
and #$DF ; make upper case char, assume ASCII chars
sta (sp),y ; store back
loop2: lda (ptr4),y
sta (sp),y
beq copy_end
bmi L1 ; Not lowercase (also, invalid, should reject)
cmp #'a'
bcc L1 ; Not lowercase
and #$DF ; make upper case char, assume ASCII chars
sta (sp),y ; store back
L1:
iny
bpl loop2 ; bpl: this way we only support a max. length of 127
iny
bpl loop2 ; bpl: this way we only support a max. length of 127
; Filename too long
jsr addysp ; restore the stack
sec ; indicate error
rts
; Filename too long
jsr addysp ; restore the stack
sec ; indicate error
rts
copy_end:
.ifdef DEFAULT_DEVICE
lda tmp2
cmp #1 ; was device present in passed string?
beq hasdev2 ; yes, don't prepend something
.ifdef DEFAULT_DEVICE
lda tmp2
cmp #1 ; was device present in passed string?
beq hasdev2 ; yes, don't prepend something
ldy #128+3 ; no, prepend "D:" (or other device)
sty tmp3 ; adjust stack size used
ldy #3
jsr subysp ; adjust stack pointer
dey
cpdev: lda __defdev,y
sta (sp),y ; insert device name, number and ':'
dey
bpl cpdev
ldy #128+3 ; no, prepend "D:" (or other device)
sty tmp3 ; adjust stack size used
ldy #3
jsr subysp ; adjust stack pointer
dey
cpdev: lda __defdev,y
sta (sp),y ; insert device name, number and ':'
dey
bpl cpdev
hasdev2:
.endif
; leave A and X pointing to the modified filename
lda sp
ldx sp+1
clc ; indicate success
rts
; leave A and X pointing to the modified filename
lda sp
ldx sp+1
clc ; indicate success
rts
.endproc

View File

@@ -4,10 +4,10 @@
; unsigned char wherex (void);
;
.export _wherex
.include "atari.inc"
.export _wherex
.include "atari.inc"
_wherex:
lda COLCRS
ldx #0
rts
lda COLCRS
ldx #0
rts

View File

@@ -4,10 +4,10 @@
; unsigned char wherey (void);
;
.export _wherey
.include "atari.inc"
.export _wherey
.include "atari.inc"
_wherey:
lda ROWCRS
ldx #0
rts
lda ROWCRS
ldx #0
rts

View File

@@ -1,29 +1,29 @@
;
; int __fastcall__ write (int fd, const void* buf, unsigned count);
;
.include "atari.inc"
.import __rwsetup,__do_oserror,__inviocb,__oserror
.export _write
.include "atari.inc"
.import __rwsetup,__do_oserror,__inviocb,__oserror
.export _write
_write:
jsr __rwsetup ; do common setup
beq write9 ; if size 0, it's a no-op
cpx #$FF ; invalid iocb?
beq _inviocb
lda #PUTCHR
sta ICCOM,x
jsr CIOV
bpl write9
jmp __do_oserror ; update errno
jsr __rwsetup ; do common setup
beq write9 ; if size 0, it's a no-op
cpx #$FF ; invalid iocb?
beq _inviocb
lda #PUTCHR
sta ICCOM,x
jsr CIOV
bpl write9
jmp __do_oserror ; update errno
write9:
lda ICBLL,x ; get buf len low
pha
lda ICBLH,x ; buf len high
tax
lda #0
sta __oserror ; clear system dependend error code
pla
rts
lda ICBLL,x ; get buf len low
pha
lda ICBLH,x ; buf len high
tax
lda #0
sta __oserror ; clear system dependend error code
pla
rts
_inviocb:
jmp __inviocb
jmp __inviocb