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,7 +4,7 @@
; Screen size variables
;
.export screensize
.export screensize
.proc screensize

View File

@@ -2,24 +2,24 @@
; based on code by Twilighte
; void __fastcall__ atmos_load(const char* name);
.export _atmos_load
.import store_filename
.export _atmos_load
.import store_filename
.proc _atmos_load
.proc _atmos_load
sei
jsr store_filename
ldx #$00
stx $02ad
stx $02ae
stx $025a
stx $025b
jsr cload_bit
cli
rts
sei
jsr store_filename
ldx #$00
stx $02ad
stx $02ae
stx $025a
stx $025b
jsr cload_bit
cli
rts
cload_bit:
pha
jmp $e874
pha
jmp $e874
.endproc

View File

@@ -2,27 +2,27 @@
; based on code by Twilighte
; void __fastcall__ atmos_save(const char* name, const void* start, const void* end);
.export _atmos_save
.import popax, store_filename
.export _atmos_save
.import popax, store_filename
.proc _atmos_save
.proc _atmos_save
sei
sta $02ab ; file end lo
stx $02ac ; file end hi
jsr popax
sta $02a9 ; file start lo
stx $02aa ; file start hi
jsr popax
jsr store_filename
lda #00
sta $02ad
jsr csave_bit
cli
rts
sei
sta $02ab ; file end lo
stx $02ac ; file end hi
jsr popax
sta $02a9 ; file start lo
stx $02aa ; file start hi
jsr popax
jsr store_filename
lda #00
sta $02ad
jsr csave_bit
cli
rts
csave_bit:
php
jmp $e92c
php
jmp $e92c
.endproc

View File

@@ -5,25 +5,25 @@
; void cclear (unsigned char length);
;
.export _cclearxy, _cclear
.export _cclearxy, _cclear
.import setscrptr
.import rvs
.import popax
.import popax
.importzp ptr2
.include "atmos.inc"
_cclearxy:
pha ; Save the length
jsr popax ; Get X and Y
pha ; Save the length
jsr popax ; Get X and Y
sta CURS_Y ; Store Y
stx CURS_X ; Store X
pla ; Restore the length and run into _cclear
pla ; Restore the length and run into _cclear
_cclear:
tax ; Is the length zero?
beq @L9 ; Jump if done
tax ; Is the length zero?
beq @L9 ; Jump if done
jsr setscrptr ; Set ptr2 to screen, won't use X
lda #' '
ora rvs
@@ -33,6 +33,6 @@ _cclear:
inc ptr2+1 ; Bump high byte of screen pointer
@L2: dex
bne @L1
@L9: rts
@L9: rts

View File

@@ -4,11 +4,11 @@
; char cgetc (void);
;
.export _cgetc
.export _cgetc
.constructor initcgetc
.import cursor
.import cursor
.include "atmos.inc"
.include "atmos.inc"

View File

@@ -5,25 +5,25 @@
; void chline (unsigned char length);
;
.export _chlinexy, _chline
.export _chlinexy, _chline
.import setscrptr
.import rvs
.import popax
.import popax
.importzp ptr2
.include "atmos.inc"
_chlinexy:
pha ; Save the length
jsr popax ; Get X and Y
pha ; Save the length
jsr popax ; Get X and Y
sta CURS_Y ; Store Y
stx CURS_X ; Store X
pla ; Restore the length and run into _chline
pla ; Restore the length and run into _chline
_chline:
tax ; Is the length zero?
beq @L9 ; Jump if done
tax ; Is the length zero?
beq @L9 ; Jump if done
jsr setscrptr ; Set ptr2 to screen, won't use X
txa ; Length into A
clc
@@ -37,5 +37,5 @@ _chline:
inc ptr2+1 ; Bump high byte of screen pointer
@L2: dex
bne @L1
@L9: rts
@L9: rts

View File

@@ -4,14 +4,14 @@
; clock_t clock (void);
;
.export _clock
.export _clock
.import negax
.importzp sreg
.importzp sreg
.include "atmos.inc"
.include "atmos.inc"
.proc _clock
.proc _clock
; Clear the timer high 16 bits

View File

@@ -2,15 +2,15 @@
; Ullrich von Bassewitz, 2003-04-13
;
.export _clrscr
.export _clrscr
.importzp ptr2
.include "atmos.inc"
.include "atmos.inc"
; ------------------------------------------------------------------------
; void clrscr (void);
.proc _clrscr
.proc _clrscr
; Set the cursor to top left cursor position

View File

@@ -6,13 +6,13 @@
; unsigned char __fastcall__ bordercolor (unsigned char color);
;
.export _textcolor, _bgcolor, _bordercolor
.export _textcolor, _bgcolor, _bordercolor
.import return0, return1
_textcolor = return1
_textcolor = return1
_bgcolor = return0
_bgcolor = return0
_bordercolor = return0
_bordercolor = return0

View File

@@ -5,34 +5,34 @@
; void cputc (char c);
;
.export _cputcxy, _cputc
.export setscrptr, putchar
.export _cputcxy, _cputc
.export setscrptr, putchar
.import rvs
.import popax
.import popax
.importzp ptr2
.include "atmos.inc"
.include "atmos.inc"
_cputcxy:
pha ; Save C
jsr popax ; Get X and Y
pha ; Save C
jsr popax ; Get X and Y
sta CURS_Y ; Store Y
stx CURS_X ; Store X
pla ; Restore C
pla ; Restore C
; Plot a character - also used as internal function
_cputc: cmp #$0D ; CR?
bne L1
lda #0
sta CURS_X ; Carriage return
_cputc: cmp #$0D ; CR?
bne L1
lda #0
sta CURS_X ; Carriage return
rts
L1: cmp #$0A ; LF?
bne output
inc CURS_Y ; Newline
rts
L1: cmp #$0A ; LF?
bne output
inc CURS_Y ; Newline
rts
; Output the character, then advance the cursor position
@@ -40,13 +40,13 @@ output:
jsr putchar
advance:
iny
cpy #40
bne L3
inc CURS_Y ; new line
ldy #0 ; + cr
L3: sty CURS_X
rts
iny
cpy #40
bne L3
inc CURS_Y ; new line
ldy #0 ; + cr
L3: sty CURS_X
rts
; ------------------------------------------------------------------------
; Set ptr2 to the screen, load the X offset into Y
@@ -59,7 +59,7 @@ L3: sty CURS_X
sta ptr2
lda ScrTabHi,y ; Get high byte of line address
sta ptr2+1
ldy CURS_X ; Get X offset
ldy CURS_X ; Get X offset
rts
.endproc
@@ -71,12 +71,12 @@ L3: sty CURS_X
.code
.proc putchar
ora rvs ; Set revers bit
ora rvs ; Set revers bit
pha ; And save
jsr setscrptr ; Set ptr2 to the screen
pla ; Restore the character
sta (ptr2),y ; Set char
rts
sta (ptr2),y ; Set char
rts
.endproc

View File

@@ -4,110 +4,110 @@
; By Debrune J<>r<EFBFBD>me <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib
.import callmain, zerobss
.import __RAM_START__, __RAM_SIZE__
.import __ZPSAVE_LOAD__, __STACKSIZE__
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib
.import callmain, zerobss
.import __RAM_START__, __RAM_SIZE__
.import __ZPSAVE_LOAD__, __STACKSIZE__
.include "zeropage.inc"
.include "atmos.inc"
.include "zeropage.inc"
.include "atmos.inc"
; ------------------------------------------------------------------------
; Oric tape header
.segment "TAPEHDR"
.segment "TAPEHDR"
.byte $16, $16, $16 ; Sync bytes
.byte $24 ; End of header marker
.byte $16, $16, $16 ; Sync bytes
.byte $24 ; End of header marker
.byte $00 ; $2B0
.byte $00 ; $2AF
.byte $80 ; $2AE Machine code flag
.byte $C7 ; $2AD Autoload flag
.dbyt __ZPSAVE_LOAD__ - 1 ; $2AB
.dbyt __RAM_START__ ; $2A9
.byte $00 ; $2A8
.byte ((.VERSION >> 8) & $0F) + '0'
.byte ((.VERSION >> 4) & $0F) + '0'
.byte (.VERSION & $0F) + '0'
.byte $00 ; Zero terminated compiler version
.byte $00 ; $2B0
.byte $00 ; $2AF
.byte $80 ; $2AE Machine code flag
.byte $C7 ; $2AD Autoload flag
.dbyt __ZPSAVE_LOAD__ - 1 ; $2AB
.dbyt __RAM_START__ ; $2A9
.byte $00 ; $2A8
.byte ((.VERSION >> 8) & $0F) + '0'
.byte ((.VERSION >> 4) & $0F) + '0'
.byte (.VERSION & $0F) + '0'
.byte $00 ; Zero terminated compiler version
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
.segment "STARTUP"
.segment "STARTUP"
; Save the zero page area we're about to use
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x ; Save the zero page locations we need
dex
bpl L1
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x ; Save the zero page locations we need
dex
bpl L1
; Clear the BSS data
jsr zerobss
jsr zerobss
; Unprotect columns 0 and 1
lda STATUS
sta stsave
and #%11011111
sta STATUS
lda STATUS
sta stsave
and #%11011111
sta STATUS
; Save system stuff and setup the stack
tsx
stx spsave ; Save system stk ptr
tsx
stx spsave ; Save system stk ptr
lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
sta sp
lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
sta sp+1 ; Set argument stack ptr
lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
sta sp
lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
sta sp+1 ; Set argument stack ptr
; Call module constructors
jsr initlib
jsr initlib
; Push arguments and call main()
jsr callmain
jsr callmain
; Call module destructors. This is also the _exit entry.
_exit: jsr donelib ; Run module destructors
_exit: jsr donelib ; Run module destructors
; Restore system stuff
ldx spsave
txs
lda stsave
sta STATUS
ldx spsave
txs
lda stsave
sta STATUS
; Copy back the zero page stuff
ldx #zpspace-1
L2: lda zpsave,x
sta sp,x
dex
bpl L2
ldx #zpspace-1
L2: lda zpsave,x
sta sp,x
dex
bpl L2
; Back to BASIC
rts
rts
; ------------------------------------------------------------------------
.segment "ZPSAVE"
.segment "ZPSAVE"
zpsave: .res zpspace
zpsave: .res zpspace
; ------------------------------------------------------------------------
.bss
spsave: .res 1
stsave: .res 1
spsave: .res 1
stsave: .res 1

View File

@@ -33,267 +33,267 @@
; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v')
; 7 - Space or tab character
.export __ctype
.export __ctype
__ctype:
.byte $10 ; 0/00 ___ctrl_@___
.byte $10 ; 1/01 ___ctrl_A___
.byte $10 ; 2/02 ___ctrl_B___
.byte $10 ; 3/03 ___ctrl_C___
.byte $10 ; 4/04 ___ctrl_D___
.byte $10 ; 5/05 ___ctrl_E___
.byte $10 ; 6/06 ___ctrl_F___
.byte $10 ; 7/07 ___ctrl_G___
.byte $10 ; 8/08 ___ctrl_H___
.byte $D0 ; 9/09 ___ctrl_I___
.byte $50 ; 10/0a ___ctrl_J___
.byte $50 ; 11/0b ___ctrl_K___
.byte $50 ; 12/0c ___ctrl_L___
.byte $50 ; 13/0d ___ctrl_M___
.byte $10 ; 14/0e ___ctrl_N___
.byte $10 ; 15/0f ___ctrl_O___
.byte $10 ; 16/10 ___ctrl_P___
.byte $10 ; 17/11 ___ctrl_Q___
.byte $10 ; 18/12 ___ctrl_R___
.byte $10 ; 19/13 ___ctrl_S___
.byte $10 ; 20/14 ___ctrl_T___
.byte $10 ; 21/15 ___ctrl_U___
.byte $10 ; 22/16 ___ctrl_V___
.byte $10 ; 23/17 ___ctrl_W___
.byte $10 ; 24/18 ___ctrl_X___
.byte $10 ; 25/19 ___ctrl_Y___
.byte $10 ; 26/1a ___ctrl_Z___
.byte $10 ; 27/1b ___ctrl_[___
.byte $10 ; 28/1c ___ctrl_\___
.byte $10 ; 29/1d ___ctrl_]___
.byte $10 ; 30/1e ___ctrl_^___
.byte $10 ; 31/1f ___ctrl_____
.byte $A0 ; 32/20 ___SPACE___
.byte $00 ; 33/21 _____!_____
.byte $00 ; 34/22 _____"_____
.byte $00 ; 35/23 _____#_____
.byte $00 ; 36/24 _____$_____
.byte $00 ; 37/25 _____%_____
.byte $00 ; 38/26 _____&_____
.byte $00 ; 39/27 _____'_____
.byte $00 ; 40/28 _____(_____
.byte $00 ; 41/29 _____)_____
.byte $00 ; 42/2a _____*_____
.byte $00 ; 43/2b _____+_____
.byte $00 ; 44/2c _____,_____
.byte $00 ; 45/2d _____-_____
.byte $00 ; 46/2e _____._____
.byte $00 ; 47/2f _____/_____
.byte $0C ; 48/30 _____0_____
.byte $0C ; 49/31 _____1_____
.byte $0C ; 50/32 _____2_____
.byte $0C ; 51/33 _____3_____
.byte $0C ; 52/34 _____4_____
.byte $0C ; 53/35 _____5_____
.byte $0C ; 54/36 _____6_____
.byte $0C ; 55/37 _____7_____
.byte $0C ; 56/38 _____8_____
.byte $0C ; 57/39 _____9_____
.byte $00 ; 58/3a _____:_____
.byte $00 ; 59/3b _____;_____
.byte $00 ; 60/3c _____<_____
.byte $00 ; 61/3d _____=_____
.byte $00 ; 62/3e _____>_____
.byte $00 ; 63/3f _____?_____
.byte $10 ; 0/00 ___ctrl_@___
.byte $10 ; 1/01 ___ctrl_A___
.byte $10 ; 2/02 ___ctrl_B___
.byte $10 ; 3/03 ___ctrl_C___
.byte $10 ; 4/04 ___ctrl_D___
.byte $10 ; 5/05 ___ctrl_E___
.byte $10 ; 6/06 ___ctrl_F___
.byte $10 ; 7/07 ___ctrl_G___
.byte $10 ; 8/08 ___ctrl_H___
.byte $D0 ; 9/09 ___ctrl_I___
.byte $50 ; 10/0a ___ctrl_J___
.byte $50 ; 11/0b ___ctrl_K___
.byte $50 ; 12/0c ___ctrl_L___
.byte $50 ; 13/0d ___ctrl_M___
.byte $10 ; 14/0e ___ctrl_N___
.byte $10 ; 15/0f ___ctrl_O___
.byte $10 ; 16/10 ___ctrl_P___
.byte $10 ; 17/11 ___ctrl_Q___
.byte $10 ; 18/12 ___ctrl_R___
.byte $10 ; 19/13 ___ctrl_S___
.byte $10 ; 20/14 ___ctrl_T___
.byte $10 ; 21/15 ___ctrl_U___
.byte $10 ; 22/16 ___ctrl_V___
.byte $10 ; 23/17 ___ctrl_W___
.byte $10 ; 24/18 ___ctrl_X___
.byte $10 ; 25/19 ___ctrl_Y___
.byte $10 ; 26/1a ___ctrl_Z___
.byte $10 ; 27/1b ___ctrl_[___
.byte $10 ; 28/1c ___ctrl_\___
.byte $10 ; 29/1d ___ctrl_]___
.byte $10 ; 30/1e ___ctrl_^___
.byte $10 ; 31/1f ___ctrl_____
.byte $A0 ; 32/20 ___SPACE___
.byte $00 ; 33/21 _____!_____
.byte $00 ; 34/22 _____"_____
.byte $00 ; 35/23 _____#_____
.byte $00 ; 36/24 _____$_____
.byte $00 ; 37/25 _____%_____
.byte $00 ; 38/26 _____&_____
.byte $00 ; 39/27 _____'_____
.byte $00 ; 40/28 _____(_____
.byte $00 ; 41/29 _____)_____
.byte $00 ; 42/2a _____*_____
.byte $00 ; 43/2b _____+_____
.byte $00 ; 44/2c _____,_____
.byte $00 ; 45/2d _____-_____
.byte $00 ; 46/2e _____._____
.byte $00 ; 47/2f _____/_____
.byte $0C ; 48/30 _____0_____
.byte $0C ; 49/31 _____1_____
.byte $0C ; 50/32 _____2_____
.byte $0C ; 51/33 _____3_____
.byte $0C ; 52/34 _____4_____
.byte $0C ; 53/35 _____5_____
.byte $0C ; 54/36 _____6_____
.byte $0C ; 55/37 _____7_____
.byte $0C ; 56/38 _____8_____
.byte $0C ; 57/39 _____9_____
.byte $00 ; 58/3a _____:_____
.byte $00 ; 59/3b _____;_____
.byte $00 ; 60/3c _____<_____
.byte $00 ; 61/3d _____=_____
.byte $00 ; 62/3e _____>_____
.byte $00 ; 63/3f _____?_____
.byte $00 ; 64/40 _____@_____
.byte $0A ; 65/41 _____A_____
.byte $0A ; 66/42 _____B_____
.byte $0A ; 67/43 _____C_____
.byte $0A ; 68/44 _____D_____
.byte $0A ; 69/45 _____E_____
.byte $0A ; 70/46 _____F_____
.byte $02 ; 71/47 _____G_____
.byte $02 ; 72/48 _____H_____
.byte $02 ; 73/49 _____I_____
.byte $02 ; 74/4a _____J_____
.byte $02 ; 75/4b _____K_____
.byte $02 ; 76/4c _____L_____
.byte $02 ; 77/4d _____M_____
.byte $02 ; 78/4e _____N_____
.byte $02 ; 79/4f _____O_____
.byte $02 ; 80/50 _____P_____
.byte $02 ; 81/51 _____Q_____
.byte $02 ; 82/52 _____R_____
.byte $02 ; 83/53 _____S_____
.byte $02 ; 84/54 _____T_____
.byte $02 ; 85/55 _____U_____
.byte $02 ; 86/56 _____V_____
.byte $02 ; 87/57 _____W_____
.byte $02 ; 88/58 _____X_____
.byte $02 ; 89/59 _____Y_____
.byte $02 ; 90/5a _____Z_____
.byte $00 ; 91/5b _____[_____
.byte $00 ; 92/5c _____\_____
.byte $00 ; 93/5d _____]_____
.byte $00 ; 94/5e _____^_____
.byte $00 ; 95/5f _UNDERLINE_
.byte $00 ; 96/60 ___grave___
.byte $09 ; 97/61 _____a_____
.byte $09 ; 98/62 _____b_____
.byte $09 ; 99/63 _____c_____
.byte $09 ; 100/64 _____d_____
.byte $09 ; 101/65 _____e_____
.byte $09 ; 102/66 _____f_____
.byte $01 ; 103/67 _____g_____
.byte $01 ; 104/68 _____h_____
.byte $01 ; 105/69 _____i_____
.byte $01 ; 106/6a _____j_____
.byte $01 ; 107/6b _____k_____
.byte $01 ; 108/6c _____l_____
.byte $01 ; 109/6d _____m_____
.byte $01 ; 110/6e _____n_____
.byte $01 ; 111/6f _____o_____
.byte $01 ; 112/70 _____p_____
.byte $01 ; 113/71 _____q_____
.byte $01 ; 114/72 _____r_____
.byte $01 ; 115/73 _____s_____
.byte $01 ; 116/74 _____t_____
.byte $01 ; 117/75 _____u_____
.byte $01 ; 118/76 _____v_____
.byte $01 ; 119/77 _____w_____
.byte $01 ; 120/78 _____x_____
.byte $01 ; 121/79 _____y_____
.byte $01 ; 122/7a _____z_____
.byte $00 ; 123/7b _____{_____
.byte $00 ; 124/7c _____|_____
.byte $00 ; 125/7d _____}_____
.byte $00 ; 126/7e _____~_____
.byte $40 ; 127/7f ____DEL____
.byte $00 ; 64/40 _____@_____
.byte $0A ; 65/41 _____A_____
.byte $0A ; 66/42 _____B_____
.byte $0A ; 67/43 _____C_____
.byte $0A ; 68/44 _____D_____
.byte $0A ; 69/45 _____E_____
.byte $0A ; 70/46 _____F_____
.byte $02 ; 71/47 _____G_____
.byte $02 ; 72/48 _____H_____
.byte $02 ; 73/49 _____I_____
.byte $02 ; 74/4a _____J_____
.byte $02 ; 75/4b _____K_____
.byte $02 ; 76/4c _____L_____
.byte $02 ; 77/4d _____M_____
.byte $02 ; 78/4e _____N_____
.byte $02 ; 79/4f _____O_____
.byte $02 ; 80/50 _____P_____
.byte $02 ; 81/51 _____Q_____
.byte $02 ; 82/52 _____R_____
.byte $02 ; 83/53 _____S_____
.byte $02 ; 84/54 _____T_____
.byte $02 ; 85/55 _____U_____
.byte $02 ; 86/56 _____V_____
.byte $02 ; 87/57 _____W_____
.byte $02 ; 88/58 _____X_____
.byte $02 ; 89/59 _____Y_____
.byte $02 ; 90/5a _____Z_____
.byte $00 ; 91/5b _____[_____
.byte $00 ; 92/5c _____\_____
.byte $00 ; 93/5d _____]_____
.byte $00 ; 94/5e _____^_____
.byte $00 ; 95/5f _UNDERLINE_
.byte $00 ; 96/60 ___grave___
.byte $09 ; 97/61 _____a_____
.byte $09 ; 98/62 _____b_____
.byte $09 ; 99/63 _____c_____
.byte $09 ; 100/64 _____d_____
.byte $09 ; 101/65 _____e_____
.byte $09 ; 102/66 _____f_____
.byte $01 ; 103/67 _____g_____
.byte $01 ; 104/68 _____h_____
.byte $01 ; 105/69 _____i_____
.byte $01 ; 106/6a _____j_____
.byte $01 ; 107/6b _____k_____
.byte $01 ; 108/6c _____l_____
.byte $01 ; 109/6d _____m_____
.byte $01 ; 110/6e _____n_____
.byte $01 ; 111/6f _____o_____
.byte $01 ; 112/70 _____p_____
.byte $01 ; 113/71 _____q_____
.byte $01 ; 114/72 _____r_____
.byte $01 ; 115/73 _____s_____
.byte $01 ; 116/74 _____t_____
.byte $01 ; 117/75 _____u_____
.byte $01 ; 118/76 _____v_____
.byte $01 ; 119/77 _____w_____
.byte $01 ; 120/78 _____x_____
.byte $01 ; 121/79 _____y_____
.byte $01 ; 122/7a _____z_____
.byte $00 ; 123/7b _____{_____
.byte $00 ; 124/7c _____|_____
.byte $00 ; 125/7d _____}_____
.byte $00 ; 126/7e _____~_____
.byte $40 ; 127/7f ____DEL____
.byte $00 ; 128/80 ___________
.byte $00 ; 129/81 ___________
.byte $00 ; 130/82 ___________
.byte $00 ; 131/83 ___________
.byte $00 ; 132/84 ___________
.byte $00 ; 133/85 ___________
.byte $00 ; 134/86 ___________
.byte $00 ; 135/87 ___________
.byte $00 ; 136/88 ___________
.byte $00 ; 137/89 ___________
.byte $00 ; 138/8a ___________
.byte $00 ; 139/8b ___________
.byte $00 ; 140/8c ___________
.byte $00 ; 141/8d ___________
.byte $00 ; 142/8e ___________
.byte $00 ; 143/8f ___________
.byte $00 ; 144/90 ___________
.byte $00 ; 145/91 ___________
.byte $00 ; 146/92 ___________
.byte $10 ; 147/93 ___________
.byte $00 ; 148/94 ___________
.byte $00 ; 149/95 ___________
.byte $00 ; 150/96 ___________
.byte $00 ; 151/97 ___________
.byte $00 ; 152/98 ___________
.byte $00 ; 153/99 ___________
.byte $00 ; 154/9a ___________
.byte $00 ; 155/9b ___________
.byte $00 ; 156/9c ___________
.byte $00 ; 157/9d ___________
.byte $00 ; 158/9e ___________
.byte $00 ; 159/9f ___________
.byte $00 ; 128/80 ___________
.byte $00 ; 129/81 ___________
.byte $00 ; 130/82 ___________
.byte $00 ; 131/83 ___________
.byte $00 ; 132/84 ___________
.byte $00 ; 133/85 ___________
.byte $00 ; 134/86 ___________
.byte $00 ; 135/87 ___________
.byte $00 ; 136/88 ___________
.byte $00 ; 137/89 ___________
.byte $00 ; 138/8a ___________
.byte $00 ; 139/8b ___________
.byte $00 ; 140/8c ___________
.byte $00 ; 141/8d ___________
.byte $00 ; 142/8e ___________
.byte $00 ; 143/8f ___________
.byte $00 ; 144/90 ___________
.byte $00 ; 145/91 ___________
.byte $00 ; 146/92 ___________
.byte $10 ; 147/93 ___________
.byte $00 ; 148/94 ___________
.byte $00 ; 149/95 ___________
.byte $00 ; 150/96 ___________
.byte $00 ; 151/97 ___________
.byte $00 ; 152/98 ___________
.byte $00 ; 153/99 ___________
.byte $00 ; 154/9a ___________
.byte $00 ; 155/9b ___________
.byte $00 ; 156/9c ___________
.byte $00 ; 157/9d ___________
.byte $00 ; 158/9e ___________
.byte $00 ; 159/9f ___________
.byte $00 ; 160/a0 ___________
.byte $00 ; 161/a1 ___________
.byte $00 ; 162/a2 ___________
.byte $00 ; 163/a3 ___________
.byte $00 ; 164/a4 ___________
.byte $00 ; 165/a5 ___________
.byte $00 ; 166/a6 ___________
.byte $00 ; 167/a7 ___________
.byte $00 ; 168/a8 ___________
.byte $00 ; 169/a9 ___________
.byte $00 ; 170/aa ___________
.byte $00 ; 171/ab ___________
.byte $00 ; 172/ac ___________
.byte $00 ; 173/ad ___________
.byte $00 ; 174/ae ___________
.byte $00 ; 175/af ___________
.byte $00 ; 176/b0 ___________
.byte $00 ; 177/b1 ___________
.byte $00 ; 178/b2 ___________
.byte $00 ; 179/b3 ___________
.byte $00 ; 180/b4 ___________
.byte $00 ; 181/b5 ___________
.byte $00 ; 182/b6 ___________
.byte $00 ; 183/b7 ___________
.byte $00 ; 184/b8 ___________
.byte $00 ; 185/b9 ___________
.byte $00 ; 186/ba ___________
.byte $00 ; 187/bb ___________
.byte $00 ; 188/bc ___________
.byte $00 ; 189/bd ___________
.byte $00 ; 190/be ___________
.byte $00 ; 191/bf ___________
.byte $00 ; 160/a0 ___________
.byte $00 ; 161/a1 ___________
.byte $00 ; 162/a2 ___________
.byte $00 ; 163/a3 ___________
.byte $00 ; 164/a4 ___________
.byte $00 ; 165/a5 ___________
.byte $00 ; 166/a6 ___________
.byte $00 ; 167/a7 ___________
.byte $00 ; 168/a8 ___________
.byte $00 ; 169/a9 ___________
.byte $00 ; 170/aa ___________
.byte $00 ; 171/ab ___________
.byte $00 ; 172/ac ___________
.byte $00 ; 173/ad ___________
.byte $00 ; 174/ae ___________
.byte $00 ; 175/af ___________
.byte $00 ; 176/b0 ___________
.byte $00 ; 177/b1 ___________
.byte $00 ; 178/b2 ___________
.byte $00 ; 179/b3 ___________
.byte $00 ; 180/b4 ___________
.byte $00 ; 181/b5 ___________
.byte $00 ; 182/b6 ___________
.byte $00 ; 183/b7 ___________
.byte $00 ; 184/b8 ___________
.byte $00 ; 185/b9 ___________
.byte $00 ; 186/ba ___________
.byte $00 ; 187/bb ___________
.byte $00 ; 188/bc ___________
.byte $00 ; 189/bd ___________
.byte $00 ; 190/be ___________
.byte $00 ; 191/bf ___________
.byte $02 ; 192/c0 ___________
.byte $02 ; 193/c1 ___________
.byte $02 ; 194/c2 ___________
.byte $02 ; 195/c3 ___________
.byte $02 ; 196/c4 ___________
.byte $02 ; 197/c5 ___________
.byte $02 ; 198/c6 ___________
.byte $02 ; 199/c7 ___________
.byte $02 ; 200/c8 ___________
.byte $02 ; 201/c9 ___________
.byte $02 ; 202/ca ___________
.byte $02 ; 203/cb ___________
.byte $02 ; 204/cc ___________
.byte $02 ; 205/cd ___________
.byte $02 ; 206/ce ___________
.byte $02 ; 207/cf ___________
.byte $02 ; 208/d0 ___________
.byte $02 ; 209/d1 ___________
.byte $02 ; 210/d2 ___________
.byte $02 ; 211/d3 ___________
.byte $02 ; 212/d4 ___________
.byte $02 ; 213/d5 ___________
.byte $02 ; 214/d6 ___________
.byte $02 ; 215/d7 ___________
.byte $02 ; 216/d8 ___________
.byte $02 ; 217/d9 ___________
.byte $02 ; 218/da ___________
.byte $02 ; 219/db ___________
.byte $02 ; 220/dc ___________
.byte $02 ; 221/dd ___________
.byte $02 ; 222/de ___________
.byte $00 ; 223/df ___________
.byte $01 ; 224/e0 ___________
.byte $01 ; 225/e1 ___________
.byte $01 ; 226/e2 ___________
.byte $01 ; 227/e3 ___________
.byte $01 ; 228/e4 ___________
.byte $01 ; 229/e5 ___________
.byte $01 ; 230/e6 ___________
.byte $01 ; 231/e7 ___________
.byte $01 ; 232/e8 ___________
.byte $01 ; 233/e9 ___________
.byte $01 ; 234/ea ___________
.byte $01 ; 235/eb ___________
.byte $01 ; 236/ec ___________
.byte $01 ; 237/ed ___________
.byte $01 ; 238/ee ___________
.byte $01 ; 239/ef ___________
.byte $01 ; 240/f0 ___________
.byte $01 ; 241/f1 ___________
.byte $01 ; 242/f2 ___________
.byte $01 ; 243/f3 ___________
.byte $01 ; 244/f4 ___________
.byte $01 ; 245/f5 ___________
.byte $01 ; 246/f6 ___________
.byte $01 ; 247/f7 ___________
.byte $01 ; 248/f8 ___________
.byte $01 ; 249/f9 ___________
.byte $01 ; 250/fa ___________
.byte $01 ; 251/fb ___________
.byte $01 ; 252/fc ___________
.byte $01 ; 253/fd ___________
.byte $01 ; 254/fe ___________
.byte $00 ; 255/ff ___________
.byte $02 ; 192/c0 ___________
.byte $02 ; 193/c1 ___________
.byte $02 ; 194/c2 ___________
.byte $02 ; 195/c3 ___________
.byte $02 ; 196/c4 ___________
.byte $02 ; 197/c5 ___________
.byte $02 ; 198/c6 ___________
.byte $02 ; 199/c7 ___________
.byte $02 ; 200/c8 ___________
.byte $02 ; 201/c9 ___________
.byte $02 ; 202/ca ___________
.byte $02 ; 203/cb ___________
.byte $02 ; 204/cc ___________
.byte $02 ; 205/cd ___________
.byte $02 ; 206/ce ___________
.byte $02 ; 207/cf ___________
.byte $02 ; 208/d0 ___________
.byte $02 ; 209/d1 ___________
.byte $02 ; 210/d2 ___________
.byte $02 ; 211/d3 ___________
.byte $02 ; 212/d4 ___________
.byte $02 ; 213/d5 ___________
.byte $02 ; 214/d6 ___________
.byte $02 ; 215/d7 ___________
.byte $02 ; 216/d8 ___________
.byte $02 ; 217/d9 ___________
.byte $02 ; 218/da ___________
.byte $02 ; 219/db ___________
.byte $02 ; 220/dc ___________
.byte $02 ; 221/dd ___________
.byte $02 ; 222/de ___________
.byte $00 ; 223/df ___________
.byte $01 ; 224/e0 ___________
.byte $01 ; 225/e1 ___________
.byte $01 ; 226/e2 ___________
.byte $01 ; 227/e3 ___________
.byte $01 ; 228/e4 ___________
.byte $01 ; 229/e5 ___________
.byte $01 ; 230/e6 ___________
.byte $01 ; 231/e7 ___________
.byte $01 ; 232/e8 ___________
.byte $01 ; 233/e9 ___________
.byte $01 ; 234/ea ___________
.byte $01 ; 235/eb ___________
.byte $01 ; 236/ec ___________
.byte $01 ; 237/ed ___________
.byte $01 ; 238/ee ___________
.byte $01 ; 239/ef ___________
.byte $01 ; 240/f0 ___________
.byte $01 ; 241/f1 ___________
.byte $01 ; 242/f2 ___________
.byte $01 ; 243/f3 ___________
.byte $01 ; 244/f4 ___________
.byte $01 ; 245/f5 ___________
.byte $01 ; 246/f6 ___________
.byte $01 ; 247/f7 ___________
.byte $01 ; 248/f8 ___________
.byte $01 ; 249/f9 ___________
.byte $01 ; 250/fa ___________
.byte $01 ; 251/fb ___________
.byte $01 ; 252/fc ___________
.byte $01 ; 253/fd ___________
.byte $01 ; 254/fe ___________
.byte $00 ; 255/ff ___________

View File

@@ -5,25 +5,25 @@
; void cvline (unsigned char length);
;
.export _cvlinexy, _cvline
.export _cvlinexy, _cvline
.import setscrptr
.import rvs
.import popax
.import popax
.importzp ptr2
.include "atmos.inc"
_cvlinexy:
pha ; Save the length
jsr popax ; Get X and Y
pha ; Save the length
jsr popax ; Get X and Y
sta CURS_Y ; Store Y
stx CURS_X ; Store X
pla ; Restore the length and run into _cvline
pla ; Restore the length and run into _cvline
_cvline:
tax ; Is the length zero?
beq @L9 ; Jump if done
tax ; Is the length zero?
beq @L9 ; Jump if done
@L1: jsr setscrptr ; Set ptr2 to screen, won't use X
lda #'|'
ora rvs
@@ -31,6 +31,6 @@ _cvline:
inc CURS_Y
@L2: dex
bne @L1
@L9: rts
@L9: rts

View File

@@ -4,13 +4,13 @@
; void gotox (unsigned char x);
;
.export _gotox
.export _gotox
.include "atmos.inc"
.proc _gotox
sta CURS_X ; Set X
sta CURS_X ; Set X
rts
.endproc

View File

@@ -4,16 +4,16 @@
; void gotoxy (unsigned char x, unsigned char y);
;
.export _gotoxy
.import popa
.export _gotoxy
.import popa
.include "atmos.inc"
.proc _gotoxy
sta CURS_Y ; Set Y
jsr popa ; Get X
sta CURS_X ; Set X
sta CURS_Y ; Set Y
jsr popa ; Get X
sta CURS_X ; Set X
rts
.endproc

View File

@@ -4,13 +4,13 @@
; void gotoy (unsigned char y);
;
.export _gotoy
.export _gotoy
.include "atmos.inc"
.proc _gotoy
sta CURS_Y ; Set Y
sta CURS_Y ; Set Y
rts
.endproc

View File

@@ -2,58 +2,58 @@
; IRQ handling (Oric version)
;
.export initirq, doneirq
.import callirq
.export initirq, doneirq
.import callirq
.include "atmos.inc"
.include "atmos.inc"
; ------------------------------------------------------------------------
.segment "INIT"
.segment "INIT"
initirq:
lda IRQVec
ldx IRQVec+1
sta IRQInd+1
stx IRQInd+2
lda #<IRQStub
ldx #>IRQStub
jmp setvec
lda IRQVec
ldx IRQVec+1
sta IRQInd+1
stx IRQInd+2
lda #<IRQStub
ldx #>IRQStub
jmp setvec
; ------------------------------------------------------------------------
.code
doneirq:
lda IRQInd+1
ldx IRQInd+2
setvec: sei
sta IRQVec
stx IRQVec+1
cli
rts
lda IRQInd+1
ldx IRQInd+2
setvec: sei
sta IRQVec
stx IRQVec+1
cli
rts
; ------------------------------------------------------------------------
.segment "LOWCODE"
.segment "LOWCODE"
IRQStub:
cld ; Just to be sure
pha
txa
pha
tya
pha
jsr callirq ; Call the functions
pla
tay
pla
tax
pla
jmp IRQInd ; Jump to the saved IRQ vector
cld ; Just to be sure
pha
txa
pha
tya
pha
jsr callirq ; Call the functions
pla
tay
pla
tax
pla
jmp IRQInd ; Jump to the saved IRQ vector
; ------------------------------------------------------------------------
.data
IRQInd: jmp $0000
IRQInd: jmp $0000

View File

@@ -6,55 +6,55 @@
; Based on Ullrich von Bassewitz, 2002-12-20
;
.include "joy-kernel.inc"
.include "joy-error.inc"
; .include "atmos.inc"
.include "joy-kernel.inc"
.include "joy-error.inc"
; .include "atmos.inc"
; ------------------------------------------------------------------------
; Header. Includes jump table
.segment "JUMPTABLE"
.segment "JUMPTABLE"
; Driver signature
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
.byte $6A, $6F, $79 ; "joy"
.byte JOY_API_VERSION ; Driver API version number
; Button state masks (8 values)
.byte $10 ; JOY_UP
.byte $08 ; JOY_DOWN
.byte $01 ; JOY_LEFT
.byte $02 ; JOY_RIGHT
.byte $20 ; JOY_FIRE
.byte $00 ; Future expansion
.byte $00 ; Future expansion
.byte $00 ; Future expansion
.byte $10 ; JOY_UP
.byte $08 ; JOY_DOWN
.byte $01 ; JOY_LEFT
.byte $02 ; JOY_RIGHT
.byte $20 ; JOY_FIRE
.byte $00 ; Future expansion
.byte $00 ; Future expansion
.byte $00 ; Future expansion
; Jump table.
.addr INSTALL
.addr UNINSTALL
.addr COUNT
.addr READ
.addr 0 ; IRQ entry unused
.addr INSTALL
.addr UNINSTALL
.addr COUNT
.addr READ
.addr 0 ; IRQ entry unused
; ------------------------------------------------------------------------
; Constants
JOY_COUNT = 2 ; Number of joysticks we support
JOY_COUNT = 2 ; Number of joysticks we support
PRA = $0301
DDRA = $0303
PRA2 = $030F
PRA = $0301
DDRA = $0303
PRA2 = $030F
; ------------------------------------------------------------------------
; Data.
.bss
temp1: .byte $00
temp2: .byte $00
temp1: .byte $00
temp2: .byte $00
.code
@@ -66,9 +66,9 @@ temp2: .byte $00
;
INSTALL:
lda #JOY_ERR_OK
ldx #0
; rts ; Run into UNINSTALL instead
lda #JOY_ERR_OK
ldx #0
; rts ; Run into UNINSTALL instead
; ------------------------------------------------------------------------
; UNINSTALL routine. Is called before the driver is removed from memory.
@@ -76,7 +76,7 @@ INSTALL:
;
UNINSTALL:
rts
rts
; ------------------------------------------------------------------------
@@ -84,42 +84,42 @@ UNINSTALL:
;
COUNT:
lda #JOY_COUNT
ldx #0
rts
lda #JOY_COUNT
ldx #0
rts
; ------------------------------------------------------------------------
; READ: Read a particular joystick passed in A.
;
READ:
tay
tay
lda PRA
pha
lda DDRA
pha
lda #%11000000
sta DDRA
lda #%10000000
sta PRA2
lda PRA2
sta temp1
lda #%01000000
sta PRA2
lda PRA
sta temp2
pla
sta DDRA
pla
sta PRA2
lda PRA
pha
lda DDRA
pha
lda #%11000000
sta DDRA
lda #%10000000
sta PRA2
lda PRA2
sta temp1
lda #%01000000
sta PRA2
lda PRA
sta temp2
pla
sta DDRA
pla
sta PRA2
ldx #0
tya
bne @L1
lda temp1
eor #$FF
rts
@L1: lda temp2
eor #$FF
rts
ldx #0
tya
bne @L1
lda temp1
eor #$FF
rts
@L1: lda temp2
eor #$FF
rts

View File

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

View File

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

View File

@@ -4,9 +4,9 @@
; int kbhit (void);
;
.export _kbhit
.export _kbhit
.include "atmos.inc"
.include "atmos.inc"
_kbhit:
ldx #$00 ; Load high byte

View File

@@ -5,117 +5,117 @@
; Setup arguments for main
;
.constructor initmainargs, 24
.import __argc, __argv
.macpack generic
.constructor initmainargs, 24
.import __argc, __argv
.macpack generic
MAXARGS = 10 ; Maximum number of arguments allowed
REM = $9d ; BASIC token-code
NAME_LEN = 16 ; maximum length of command-name
MAXARGS = 10 ; Maximum number of arguments allowed
REM = $9d ; BASIC token-code
NAME_LEN = 16 ; maximum length of command-name
BASIC_BUF = $35
FNAM = $293
FNAM = $293
;---------------------------------------------------------------------------
; Get possible command-line arguments. Goes into the special INIT segment,
; which may be reused after the startup code is run
.segment "INIT"
.segment "INIT"
.proc initmainargs
.proc initmainargs
; Assume that the program was loaded, a moment ago, by the traditional LOAD
; statement. Save the "most-recent filename" as argument #0.
; Because the buffer, that we're copying into, was zeroed out,
; we don't need to add a NUL character.
;
ldy #NAME_LEN - 1 ; limit the length
L0: lda FNAM,y
sta name,y
dey
bpl L0
inc __argc ; argc always is equal to, at least, 1
ldy #NAME_LEN - 1 ; limit the length
L0: lda FNAM,y
sta name,y
dey
bpl L0
inc __argc ; argc always is equal to, at least, 1
; Find the "rem" token.
;
ldx #0
L2: lda BASIC_BUF,x
beq done ; no "rem," no args.
inx
cmp #REM
bne L2
ldy #1 * 2
ldx #0
L2: lda BASIC_BUF,x
beq done ; no "rem," no args.
inx
cmp #REM
bne L2
ldy #1 * 2
; Find the next argument
next: lda BASIC_BUF,x
beq done ; End of line reached
inx
cmp #' ' ; Skip leading spaces
beq next ;
next: lda BASIC_BUF,x
beq done ; End of line reached
inx
cmp #' ' ; Skip leading spaces
beq next ;
; Found start of next argument. We've incremented the pointer in X already, so
; it points to the second character of the argument. This is useful since we
; will check now for a quoted argument, in which case we will have to skip this
; first character.
found: cmp #'"' ; Is the argument quoted?
beq setterm ; Jump if so
dex ; Reset pointer to first argument character
lda #' ' ; A space ends the argument
setterm:sta term ; Set end of argument marker
found: cmp #'"' ; Is the argument quoted?
beq setterm ; Jump if so
dex ; Reset pointer to first argument character
lda #' ' ; A space ends the argument
setterm:sta term ; Set end of argument marker
; Now store a pointer to the argument into the next slot. Since the BASIC
; input buffer is located at the zero page, no calculations are necessary.
txa ; Get low byte
add #<BASIC_BUF ; Not at page boundary
sta argv,y ; argv[y]= &arg
iny
iny
inc __argc ; Found another arg
txa ; Get low byte
add #<BASIC_BUF ; Not at page boundary
sta argv,y ; argv[y]= &arg
iny
iny
inc __argc ; Found another arg
; Search for the end of the argument
argloop:lda BASIC_BUF,x
beq done
inx
cmp term
bne argloop
argloop:lda BASIC_BUF,x
beq done
inx
cmp term
bne argloop
; We've found the end of the argument. X points one character behind it, and
; A contains the terminating character. To make the argument a valid C string,
; replace the terminating character by a zero.
lda #0
sta BASIC_BUF-1,x
lda #0
sta BASIC_BUF-1,x
; Check if the maximum number of command line arguments is reached. If not,
; parse the next one.
lda __argc ; Get low byte of argument count
cmp #MAXARGS ; Maximum number of arguments reached?
bcc next ; Parse next one if not
lda __argc ; Get low byte of argument count
cmp #MAXARGS ; Maximum number of arguments reached?
bcc next ; Parse next one if not
; (The last vector in argv[] already is NULL.)
done: lda #<argv
ldx #>argv
sta __argv
stx __argv + 1
done: lda #<argv
ldx #>argv
sta __argv
stx __argv + 1
rts
rts
.endproc
; These arrays are zeroed before initmainargs is called.
; char name[16+1];
; char name[16+1];
; char* argv[MAXARGS+1]={name};
;
.bss
term: .res 1
name: .res NAME_LEN + 1
term: .res 1
name: .res NAME_LEN + 1
.data
argv: .addr name
.res MAXARGS * 2
argv: .addr name
.res MAXARGS * 2

View File

@@ -41,35 +41,35 @@ End:
.rodata
__sys_oserrlist:
sys_oserr_entry 1, "File not found"
sys_oserr_entry 2, "Invalid command end"
sys_oserr_entry 3, "No drive number"
sys_oserr_entry 4, "Bad drive number"
sys_oserr_entry 5, "Invalid filename"
sys_oserr_entry 6, "fderr=(error number)"
sys_oserr_entry 7, "Illegal attribute"
sys_oserr_entry 8, "Wildcard(s) not allowed"
sys_oserr_entry 9, "File already exists"
sys_oserr_entry 10, "Insufficient disc space"
sys_oserr_entry 11, "File open"
sys_oserr_entry 12, "Illegal quantity"
sys_oserr_entry 13, "End address missing"
sys_oserr_entry 14, "Start address > end address"
sys_oserr_entry 15, "Missing 'to'"
sys_oserr_entry 16, "Renamed file not on same disc"
sys_oserr_entry 17, "Unknown array"
sys_oserr_entry 18, "Target drive not source drive"
sys_oserr_entry 19, "Destination not specified"
sys_oserr_entry 20, "Cannot merge and overwrite"
sys_oserr_entry 21, "Single target file illegal"
sys_oserr_entry 22, "Syntax"
sys_oserr_entry 23, "Filename missing"
sys_oserr_entry 24, "Source file missing"
sys_oserr_entry 25, "Type mismatch"
sys_oserr_entry 26, "Disc write-protected"
sys_oserr_entry 27, "Incompatible drives"
sys_oserr_entry 28, "File not open"
sys_oserr_entry 29, "File end"
sys_oserr_sentinel "Unknown error"
sys_oserr_entry 1, "File not found"
sys_oserr_entry 2, "Invalid command end"
sys_oserr_entry 3, "No drive number"
sys_oserr_entry 4, "Bad drive number"
sys_oserr_entry 5, "Invalid filename"
sys_oserr_entry 6, "fderr=(error number)"
sys_oserr_entry 7, "Illegal attribute"
sys_oserr_entry 8, "Wildcard(s) not allowed"
sys_oserr_entry 9, "File already exists"
sys_oserr_entry 10, "Insufficient disc space"
sys_oserr_entry 11, "File open"
sys_oserr_entry 12, "Illegal quantity"
sys_oserr_entry 13, "End address missing"
sys_oserr_entry 14, "Start address > end address"
sys_oserr_entry 15, "Missing 'to'"
sys_oserr_entry 16, "Renamed file not on same disc"
sys_oserr_entry 17, "Unknown array"
sys_oserr_entry 18, "Target drive not source drive"
sys_oserr_entry 19, "Destination not specified"
sys_oserr_entry 20, "Cannot merge and overwrite"
sys_oserr_entry 21, "Single target file illegal"
sys_oserr_entry 22, "Syntax"
sys_oserr_entry 23, "Filename missing"
sys_oserr_entry 24, "Source file missing"
sys_oserr_entry 25, "Type mismatch"
sys_oserr_entry 26, "Disc write-protected"
sys_oserr_entry 27, "Incompatible drives"
sys_oserr_entry 28, "File not open"
sys_oserr_entry 29, "File end"
sys_oserr_sentinel "Unknown error"

View File

@@ -5,13 +5,13 @@
; /* Map a system specific error into a system independent code */
;
.include "errno.inc"
.export __osmaperrno
.include "errno.inc"
.export __osmaperrno
.proc __osmaperrno
.proc __osmaperrno
lda #<EUNKNOWN
ldx #>EUNKNOWN
rts
lda #<EUNKNOWN
ldx #>EUNKNOWN
rts
.endproc

View File

@@ -4,7 +4,7 @@
; unsigned char revers (unsigned char onoff);
;
.export _revers
.export _revers
.export rvs
; ------------------------------------------------------------------------
@@ -13,18 +13,18 @@
.code
.proc _revers
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
ldy #$00 ; Assume old value is zero
L1: lda rvs ; Load old value
stx rvs ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
ldx #$00 ; Assume revers off
tay ; Test onoff
beq L1 ; Jump if off
ldx #$80 ; Load on value
ldy #$00 ; Assume old value is zero
L1: lda rvs ; Load old value
stx rvs ; Set new value
beq L2 ; Jump if old value zero
iny ; Make old value = 1
L2: ldx #$00 ; Load high byte of result
tya ; Load low byte, set CC
rts
.endproc

View File

@@ -22,99 +22,99 @@
; interrupt handling assumes that the 65816 is in 6502-emulation mode.
;
.include "zeropage.inc"
.include "ser-kernel.inc"
.include "ser-error.inc"
.include "zeropage.inc"
.include "ser-kernel.inc"
.include "ser-error.inc"
; ------------------------------------------------------------------------
; Header. Includes jump table
.segment "JUMPTABLE"
.segment "JUMPTABLE"
; Driver signature
.byte $73, $65, $72 ; "ser"
.byte SER_API_VERSION ; Serial API version number
; Driver signature
.byte $73, $65, $72 ; "ser"
.byte SER_API_VERSION ; Serial API version number
; Jump table.
.addr INSTALL
.addr UNINSTALL
.addr OPEN
.addr CLOSE
.addr GET
.addr PUT
.addr STATUS
.addr IOCTL
.addr IRQ
; Jump table.
.addr INSTALL
.addr UNINSTALL
.addr OPEN
.addr CLOSE
.addr GET
.addr PUT
.addr STATUS
.addr IOCTL
.addr IRQ
;----------------------------------------------------------------------------
; I/O definitions
ACIA = $031C
ACIA_DATA = ACIA+0 ; Data register
ACIA_STATUS = ACIA+1 ; Status register
ACIA_CMD = ACIA+2 ; Command register
ACIA_CTRL = ACIA+3 ; Control register
ACIA = $031C
ACIA_DATA = ACIA+0 ; Data register
ACIA_STATUS = ACIA+1 ; Status register
ACIA_CMD = ACIA+2 ; Command register
ACIA_CTRL = ACIA+3 ; Control register
;----------------------------------------------------------------------------
; Global variables
.bss
.bss
RecvHead: .res 1 ; Head of receive buffer
RecvTail: .res 1 ; Tail of receive buffer
RecvFreeCnt: .res 1 ; Number of bytes in receive buffer
SendHead: .res 1 ; Head of send buffer
SendTail: .res 1 ; Tail of send buffer
SendFreeCnt: .res 1 ; Number of bytes in send buffer
RecvHead: .res 1 ; Head of receive buffer
RecvTail: .res 1 ; Tail of receive buffer
RecvFreeCnt: .res 1 ; Number of bytes in receive buffer
SendHead: .res 1 ; Head of send buffer
SendTail: .res 1 ; Tail of send buffer
SendFreeCnt: .res 1 ; Number of bytes in send buffer
Stopped: .res 1 ; Flow-stopped flag
RtsOff: .res 1 ;
Stopped: .res 1 ; Flow-stopped flag
RtsOff: .res 1 ;
RecvBuf: .res 256 ; Receive buffers: 256 bytes
SendBuf: .res 256 ; Send buffers: 256 bytes
RecvBuf: .res 256 ; Receive buffers: 256 bytes
SendBuf: .res 256 ; Send buffers: 256 bytes
Index: .res 1 ; I/O register index
Index: .res 1 ; I/O register index
.rodata
.rodata
; Tables used to translate RS232 params into register values
BaudTable: ; bit7 = 1 means setting is invalid
.byte $FF ; SER_BAUD_45_5
.byte $01 ; SER_BAUD_50
.byte $02 ; SER_BAUD_75
.byte $03 ; SER_BAUD_110
.byte $04 ; SER_BAUD_134_5
.byte $05 ; SER_BAUD_150
.byte $06 ; SER_BAUD_300
.byte $07 ; SER_BAUD_600
.byte $08 ; SER_BAUD_1200
.byte $09 ; SER_BAUD_1800
.byte $0A ; SER_BAUD_2400
.byte $0B ; SER_BAUD_3600
.byte $0C ; SER_BAUD_4800
.byte $0D ; SER_BAUD_7200
.byte $0E ; SER_BAUD_9600
.byte $0F ; SER_BAUD_19200
.byte $FF ; SER_BAUD_38400
.byte $FF ; SER_BAUD_57600
.byte $FF ; SER_BAUD_115200
.byte $FF ; SER_BAUD_230400
; Tables used to translate RS232 params into register values
BaudTable: ; bit7 = 1 means setting is invalid
.byte $FF ; SER_BAUD_45_5
.byte $01 ; SER_BAUD_50
.byte $02 ; SER_BAUD_75
.byte $03 ; SER_BAUD_110
.byte $04 ; SER_BAUD_134_5
.byte $05 ; SER_BAUD_150
.byte $06 ; SER_BAUD_300
.byte $07 ; SER_BAUD_600
.byte $08 ; SER_BAUD_1200
.byte $09 ; SER_BAUD_1800
.byte $0A ; SER_BAUD_2400
.byte $0B ; SER_BAUD_3600
.byte $0C ; SER_BAUD_4800
.byte $0D ; SER_BAUD_7200
.byte $0E ; SER_BAUD_9600
.byte $0F ; SER_BAUD_19200
.byte $FF ; SER_BAUD_38400
.byte $FF ; SER_BAUD_57600
.byte $FF ; SER_BAUD_115200
.byte $FF ; SER_BAUD_230400
BitTable:
.byte $60 ; SER_BITS_5
.byte $40 ; SER_BITS_6
.byte $20 ; SER_BITS_7
.byte $00 ; SER_BITS_8
.byte $60 ; SER_BITS_5
.byte $40 ; SER_BITS_6
.byte $20 ; SER_BITS_7
.byte $00 ; SER_BITS_8
StopTable:
.byte $00 ; SER_STOP_1
.byte $80 ; SER_STOP_2
.byte $00 ; SER_STOP_1
.byte $80 ; SER_STOP_2
ParityTable:
.byte $00 ; SER_PAR_NONE
.byte $20 ; SER_PAR_ODD
.byte $60 ; SER_PAR_EVEN
.byte $A0 ; SER_PAR_MARK
.byte $E0 ; SER_PAR_SPACE
.byte $00 ; SER_PAR_NONE
.byte $20 ; SER_PAR_ODD
.byte $60 ; SER_PAR_EVEN
.byte $A0 ; SER_PAR_MARK
.byte $E0 ; SER_PAR_SPACE
.code
.code
;----------------------------------------------------------------------------
; INSTALL: Is called after the driver is loaded into memory. If possible,
@@ -134,91 +134,91 @@ ParityTable:
INSTALL:
UNINSTALL:
CLOSE:
ldx Index ; Check for open port
beq :+
ldx Index ; Check for open port
beq :+
; Deactivate DTR and disable 6551 interrupts
lda #%00001010
sta ACIA_CMD,x
; Deactivate DTR and disable 6551 interrupts
lda #%00001010
sta ACIA_CMD,x
; Done, return an error code
: lda #<SER_ERR_OK
tax ; A is zero
stx Index ; Mark port as closed
rts
; Done, return an error code
: lda #<SER_ERR_OK
tax ; A is zero
stx Index ; Mark port as closed
rts
;----------------------------------------------------------------------------
; OPEN: A pointer to a ser_params structure is passed in ptr1.
; Must return an SER_ERR_xx code in a/x.
OPEN:
; Check if the handshake setting is valid
ldy #SER_PARAMS::HANDSHAKE ; Handshake
lda (ptr1),y
cmp #SER_HS_HW ; This is all we support
bne InvParam
; Check if the handshake setting is valid
ldy #SER_PARAMS::HANDSHAKE ; Handshake
lda (ptr1),y
cmp #SER_HS_HW ; This is all we support
bne InvParam
; Initialize buffers
ldy #$00
sty Stopped
sty RecvHead
sty RecvTail
sty SendHead
sty SendTail
dey ; Y = 255
sty RecvFreeCnt
sty SendFreeCnt
; Initialize buffers
ldy #$00
sty Stopped
sty RecvHead
sty RecvTail
sty SendHead
sty SendTail
dey ; Y = 255
sty RecvFreeCnt
sty SendFreeCnt
; Set the value for the control register, which contains stop bits,
; word length and the baud rate.
ldy #SER_PARAMS::BAUDRATE
lda (ptr1),y ; Baudrate index
tay
lda BaudTable,y ; Get 6551 value
bmi InvBaud ; Branch if rate not supported
sta tmp1
; Set the value for the control register, which contains stop bits,
; word length and the baud rate.
ldy #SER_PARAMS::BAUDRATE
lda (ptr1),y ; Baudrate index
tay
lda BaudTable,y ; Get 6551 value
bmi InvBaud ; Branch if rate not supported
sta tmp1
ldy #SER_PARAMS::DATABITS ; Databits
lda (ptr1),y
tay
lda BitTable,y
ora tmp1
sta tmp1
ldy #SER_PARAMS::DATABITS ; Databits
lda (ptr1),y
tay
lda BitTable,y
ora tmp1
sta tmp1
ldy #SER_PARAMS::STOPBITS ; Stopbits
lda (ptr1),y
tay
lda StopTable,y
ora tmp1
ora #%00010000 ; Receiver clock source = baudrate
sta ACIA_CTRL
ldy #SER_PARAMS::STOPBITS ; Stopbits
lda (ptr1),y
tay
lda StopTable,y
ora tmp1
ora #%00010000 ; Receiver clock source = baudrate
sta ACIA_CTRL
; Set the value for the command register. We remember the base value
; in RtsOff, since we will have to manipulate ACIA_CMD often.
ldy #SER_PARAMS::PARITY ; Parity
lda (ptr1),y
tay
lda ParityTable,y
ora #%00000001 ; DTR active
sta RtsOff
ora #%00001000 ; Enable receive interrupts
sta ACIA_CMD
; Set the value for the command register. We remember the base value
; in RtsOff, since we will have to manipulate ACIA_CMD often.
ldy #SER_PARAMS::PARITY ; Parity
lda (ptr1),y
tay
lda ParityTable,y
ora #%00000001 ; DTR active
sta RtsOff
ora #%00001000 ; Enable receive interrupts
sta ACIA_CMD
; Done
stx Index ; Mark port as open
lda #<SER_ERR_OK
tax ; A is zero
rts
; Done
stx Index ; Mark port as open
lda #<SER_ERR_OK
tax ; A is zero
rts
; Invalid parameter
InvParam:lda #<SER_ERR_INIT_FAILED
ldx #>SER_ERR_INIT_FAILED
rts
; Invalid parameter
InvParam:lda #<SER_ERR_INIT_FAILED
ldx #>SER_ERR_INIT_FAILED
rts
; Baud rate not available
InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
ldx #>SER_ERR_BAUD_UNAVAIL
rts
; Baud rate not available
InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
ldx #>SER_ERR_BAUD_UNAVAIL
rts
;----------------------------------------------------------------------------
; GET: Will fetch a character from the receive buffer and store it into the
@@ -226,82 +226,82 @@ InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
; returned.
GET:
ldy SendFreeCnt ; Send data if necessary
iny ; Y == $FF?
beq :+
lda #$00 ; TryHard = false
jsr TryToSend
ldy SendFreeCnt ; Send data if necessary
iny ; Y == $FF?
beq :+
lda #$00 ; TryHard = false
jsr TryToSend
; Check for buffer empty
: lda RecvFreeCnt ; (25)
cmp #$FF
bne :+
lda #<SER_ERR_NO_DATA
ldx #>SER_ERR_NO_DATA
rts
; Check for buffer empty
: lda RecvFreeCnt ; (25)
cmp #$FF
bne :+
lda #<SER_ERR_NO_DATA
ldx #>SER_ERR_NO_DATA
rts
; Check for flow stopped & enough free: release flow control
: ldy Stopped ; (34)
beq :+
cmp #63
bcc :+
lda #$00
sta Stopped
lda RtsOff
ora #%00001000
sta ACIA_CMD
; Check for flow stopped & enough free: release flow control
: ldy Stopped ; (34)
beq :+
cmp #63
bcc :+
lda #$00
sta Stopped
lda RtsOff
ora #%00001000
sta ACIA_CMD
; Get byte from buffer
: ldy RecvHead ; (41)
lda RecvBuf,y
inc RecvHead
inc RecvFreeCnt
ldx #$00 ; (59)
sta (ptr1,x)
txa ; Return code = 0
rts
; Get byte from buffer
: ldy RecvHead ; (41)
lda RecvBuf,y
inc RecvHead
inc RecvFreeCnt
ldx #$00 ; (59)
sta (ptr1,x)
txa ; Return code = 0
rts
;----------------------------------------------------------------------------
; PUT: Output character in A.
; Must return an SER_ERR_xx code in a/x.
PUT:
; Try to send
ldy SendFreeCnt
iny ; Y = $FF?
beq :+
pha
lda #$00 ; TryHard = false
jsr TryToSend
pla
; Try to send
ldy SendFreeCnt
iny ; Y = $FF?
beq :+
pha
lda #$00 ; TryHard = false
jsr TryToSend
pla
; Put byte into send buffer & send
: ldy SendFreeCnt
bne :+
lda #<SER_ERR_OVERFLOW
ldx #>SER_ERR_OVERFLOW
rts
; Put byte into send buffer & send
: ldy SendFreeCnt
bne :+
lda #<SER_ERR_OVERFLOW
ldx #>SER_ERR_OVERFLOW
rts
: ldy SendTail
sta SendBuf,y
inc SendTail
dec SendFreeCnt
lda #$FF ; TryHard = true
jsr TryToSend
lda #<SER_ERR_OK
tax
rts
: ldy SendTail
sta SendBuf,y
inc SendTail
dec SendFreeCnt
lda #$FF ; TryHard = true
jsr TryToSend
lda #<SER_ERR_OK
tax
rts
;----------------------------------------------------------------------------
; STATUS: Return the status in the variable pointed to by ptr1.
; Must return an SER_ERR_xx code in a/x.
STATUS:
lda ACIA_STATUS
ldx #$00
sta (ptr1,x)
txa ; SER_ERR_OK
rts
lda ACIA_STATUS
ldx #$00
sta (ptr1,x)
txa ; SER_ERR_OK
rts
;----------------------------------------------------------------------------
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
@@ -309,9 +309,9 @@ STATUS:
; Must return an SER_ERR_xx code in a/x.
IOCTL:
lda #<SER_ERR_INV_IOCTL
ldx #>SER_ERR_INV_IOCTL
rts
lda #<SER_ERR_INV_IOCTL
ldx #>SER_ERR_INV_IOCTL
rts
;----------------------------------------------------------------------------
; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All
@@ -320,55 +320,55 @@ IOCTL:
; was handled, otherwise with carry clear.
IRQ:
ldx Index ; Check for open port
beq Done
lda ACIA_STATUS,x ; Check ACIA status for receive interrupt
and #$08
beq Done ; Jump if no ACIA interrupt
lda ACIA_DATA,x ; Get byte from ACIA
ldy RecvFreeCnt ; Check if we have free space left
beq Flow ; Jump if no space in receive buffer
ldy RecvTail ; Load buffer pointer
sta RecvBuf,y ; Store received byte in buffer
inc RecvTail ; Increment buffer pointer
dec RecvFreeCnt ; Decrement free space counter
ldy RecvFreeCnt ; Check for buffer space low
cpy #33
bcc Flow ; Assert flow control if buffer space low
rts ; Interrupt handled (carry already set)
ldx Index ; Check for open port
beq Done
lda ACIA_STATUS,x ; Check ACIA status for receive interrupt
and #$08
beq Done ; Jump if no ACIA interrupt
lda ACIA_DATA,x ; Get byte from ACIA
ldy RecvFreeCnt ; Check if we have free space left
beq Flow ; Jump if no space in receive buffer
ldy RecvTail ; Load buffer pointer
sta RecvBuf,y ; Store received byte in buffer
inc RecvTail ; Increment buffer pointer
dec RecvFreeCnt ; Decrement free space counter
ldy RecvFreeCnt ; Check for buffer space low
cpy #33
bcc Flow ; Assert flow control if buffer space low
rts ; Interrupt handled (carry already set)
; Assert flow control if buffer space too low
Flow: lda RtsOff
sta ACIA_CMD,x
sta Stopped
sec ; Interrupt handled
Done: rts
; Assert flow control if buffer space too low
Flow: lda RtsOff
sta ACIA_CMD,x
sta Stopped
sec ; Interrupt handled
Done: rts
;----------------------------------------------------------------------------
; Try to send a byte. Internal routine. A = TryHard
TryToSend:
sta tmp1 ; Remember tryHard flag
Again: lda SendFreeCnt
cmp #$FF
beq Quit ; Bail out
sta tmp1 ; Remember tryHard flag
Again: lda SendFreeCnt
cmp #$FF
beq Quit ; Bail out
; Check for flow stopped
lda Stopped
bne Quit ; Bail out
; Check for flow stopped
lda Stopped
bne Quit ; Bail out
; Check that ACIA is ready to send
lda ACIA_STATUS
and #$10
bne Send
bit tmp1 ; Keep trying if must try hard
bmi Again
Quit: rts
; Check that ACIA is ready to send
lda ACIA_STATUS
and #$10
bne Send
bit tmp1 ; Keep trying if must try hard
bmi Again
Quit: rts
; Send byte and try again
Send: ldy SendHead
lda SendBuf,y
sta ACIA_DATA
inc SendHead
inc SendFreeCnt
jmp Again
; Send byte and try again
Send: ldy SendHead
lda SendBuf,y
sta ACIA_DATA
inc SendHead
inc SendFreeCnt
jmp Again

View File

@@ -1,12 +1,12 @@
.export store_filename
.importzp ptr1
.export store_filename
.importzp ptr1
store_filename:
sta ptr1
stx ptr1+1
ldy #$0f ;store filename
: lda (ptr1),y
sta $027f,y
dey
bpl :-
rts
sta ptr1
stx ptr1+1
ldy #$0f ;store filename
: lda (ptr1),y
sta $027f,y
dey
bpl :-
rts

View File

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

View File

@@ -4,11 +4,11 @@
; unsigned char __fastcall__ _sysuname (struct utsname* buf);
;
.export __sysuname, utsdata
.export __sysuname, utsdata
.import utscopy
.import utscopy
__sysuname = utscopy
__sysuname = utscopy
;--------------------------------------------------------------------------
; Data. We define a fixed utsname struct here and just copy it.
@@ -16,31 +16,31 @@
.rodata
utsdata:
; sysname
.asciiz "cc65"
; sysname
.asciiz "cc65"
; nodename
.asciiz ""
; nodename
.asciiz ""
; release
.byte ((.VERSION >> 8) & $0F) + '0'
.byte '.'
.if ((.VERSION >> 4) & $0F) > 9
.byte ((.VERSION >> 4) & $0F) / 10 + '0'
.byte ((.VERSION >> 4) & $0F) .MOD 10 + '0'
.else
.byte ((.VERSION >> 4) & $0F) + '0'
.endif
.byte $00
; release
.byte ((.VERSION >> 8) & $0F) + '0'
.byte '.'
.if ((.VERSION >> 4) & $0F) > 9
.byte ((.VERSION >> 4) & $0F) / 10 + '0'
.byte ((.VERSION >> 4) & $0F) .MOD 10 + '0'
.else
.byte ((.VERSION >> 4) & $0F) + '0'
.endif
.byte $00
; version
.if (.VERSION & $0F) > 9
.byte (.VERSION & $0F) / 10 + '0'
.byte (.VERSION & $0F) .MOD 10 + '0'
.else
.byte (.VERSION & $0F) + '0'
.endif
.byte $00
; version
.if (.VERSION & $0F) > 9
.byte (.VERSION & $0F) / 10 + '0'
.byte (.VERSION & $0F) .MOD 10 + '0'
.else
.byte (.VERSION & $0F) + '0'
.endif
.byte $00
; machine
.asciiz "Oric Atmos"
; machine
.asciiz "Oric Atmos"

View File

@@ -5,59 +5,59 @@
; 2012-08-11, Greg King <greg.king5@verizon.net>
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "atmos.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "atmos.inc"
.macpack generic
.macpack generic
XSIZE = 6 ; System font width
YSIZE = 8 ; System font height
XSIZE = 6 ; System font width
YSIZE = 8 ; System font height
; ------------------------------------------------------------------------
; Header. Includes jump table and constants.
.segment "JUMPTABLE"
.segment "JUMPTABLE"
; The first part of the header is a structure that has a signature,
; and defines the capabilities of the driver.
.byte "tgi"
.byte TGI_API_VERSION ; TGI API version number
.word 228 ; x resolution
.word 200 ; y resolution
.byte 3 ; Number of drawing colors
.byte 1 ; Number of screens available
.byte XSIZE ; System font x size
.byte YSIZE ; System font y size
.word $011C ; Aspect ratio (based on 4/3 display)
.byte 0 ; TGI driver flags
.byte "tgi"
.byte TGI_API_VERSION ; TGI API version number
.word 228 ; x resolution
.word 200 ; y resolution
.byte 3 ; Number of drawing colors
.byte 1 ; Number of screens available
.byte XSIZE ; System font x size
.byte YSIZE ; System font y size
.word $011C ; Aspect ratio (based on 4/3 display)
.byte 0 ; TGI driver flags
; Next comes the jump table. Currently, all entries must be valid;
; and, may point to an RTS, for test versions (function not implemented).
.addr INSTALL
.addr UNINSTALL
.addr INIT
.addr DONE
.addr GETERROR
.addr CONTROL
.addr CLEAR
.addr SETVIEWPAGE
.addr SETDRAWPAGE
.addr SETCOLOR
.addr SETPALETTE
.addr GETPALETTE
.addr GETDEFPALETTE
.addr SETPIXEL
.addr GETPIXEL
.addr LINE
.addr BAR
.addr TEXTSTYLE
.addr OUTTEXT
.addr 0 ; IRQ entry is unused
.addr INSTALL
.addr UNINSTALL
.addr INIT
.addr DONE
.addr GETERROR
.addr CONTROL
.addr CLEAR
.addr SETVIEWPAGE
.addr SETDRAWPAGE
.addr SETCOLOR
.addr SETPALETTE
.addr GETPALETTE
.addr GETDEFPALETTE
.addr SETPIXEL
.addr GETPIXEL
.addr LINE
.addr BAR
.addr TEXTSTYLE
.addr OUTTEXT
.addr 0 ; IRQ entry is unused
; ------------------------------------------------------------------------
; Data.
@@ -65,34 +65,34 @@ YSIZE = 8 ; System font height
; Variables mapped to the zero-page segment variables. These are
; used for passing parameters to the driver.
X1 := ptr1
Y1 := ptr2
X2 := ptr3
Y2 := ptr4
X1 := ptr1
Y1 := ptr2
X2 := ptr3
Y2 := ptr4
; Absolute variables used in the code
.bss
ERROR: .res 1 ; Error code
MODE: .res 1 ; Graphics mode
PALETTE: .res 2
ERROR: .res 1 ; Error code
MODE: .res 1 ; Graphics mode
PALETTE: .res 2
; Constants and table
; BASIC 1.1 addresses
PATTERN := $213
PARAM1 := $2E1 ; & $2E2
PARAM2 := $2E3 ; & $2E4
PARAM3 := $2E5 ; & $2E6
TEXT := $EC21
HIRES := $EC33
CURSET := $F0C8
CURMOV := $F0FD
DRAW := $F110
CHAR := $F12D
POINT := $F1C8
PAPER := $F204
INK := $F210
PATTERN := $213
PARAM1 := $2E1 ; & $2E2
PARAM2 := $2E3 ; & $2E4
PARAM3 := $2E5 ; & $2E6
TEXT := $EC21
HIRES := $EC33
CURSET := $F0C8
CURMOV := $F0FD
DRAW := $F110
CHAR := $F12D
POINT := $F1C8
PAPER := $F204
INK := $F210
.rodata
@@ -100,7 +100,7 @@ INK := $F210
; (The third "color" actually flips a pixel
; between the foreground and background colors.)
;
DEFPALETTE: .byte 0, 1
DEFPALETTE: .byte 0, 1
.code
@@ -121,7 +121,7 @@ INIT:
; Switch into graphics mode.
jsr HIRES
jsr HIRES
; Done, reset the error code.
@@ -129,9 +129,9 @@ INIT:
; GETERROR: Return the error code in A, and clear it.
GETERROR:
ldx #TGI_ERR_OK
lda ERROR
stx ERROR
ldx #TGI_ERR_OK
lda ERROR
stx ERROR
; ------------------------------------------------------------------------
; INSTALL routine. Is called after the driver is loaded into memory. May
@@ -151,7 +151,7 @@ INSTALL:
;
UNINSTALL:
rts
rts
; ------------------------------------------------------------------------
; DONE: Will be called to switch the graphics device back into text mode.
@@ -161,7 +161,7 @@ UNINSTALL:
; Must set an error code: NO
;
DONE := TEXT
DONE := TEXT
; ------------------------------------------------------------------------
; CONTROL: Platform-/driver-specific entry point.
@@ -170,10 +170,10 @@ DONE := TEXT
;
CONTROL:
sta PATTERN
lda #TGI_ERR_OK
sta ERROR
rts
sta PATTERN
lda #TGI_ERR_OK
sta ERROR
rts
; ------------------------------------------------------------------------
; CLEAR: Clears the screen.
@@ -181,7 +181,7 @@ CONTROL:
; Must set an error code: NO
;
CLEAR := HIRES
CLEAR := HIRES
; ------------------------------------------------------------------------
; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n).
@@ -200,7 +200,7 @@ SETVIEWPAGE:
;
SETDRAWPAGE:
rts
rts
; ------------------------------------------------------------------------
; SETCOLOR: Set the drawing color (in A). The new color already is checked
@@ -210,8 +210,8 @@ SETDRAWPAGE:
;
SETCOLOR:
sta MODE
rts
sta MODE
rts
; ------------------------------------------------------------------------
; SETPALETTE: Set the palette (not available with all drivers/hardware).
@@ -222,27 +222,27 @@ SETCOLOR:
;
SETPALETTE:
ldy #0
jsr flipcolor
sty PARAM1+1
jsr PAPER
ldy #1
jsr flipcolor
dey ; TGI_ERR_OK
sty ERROR
sty PARAM1+1
jmp INK
ldy #0
jsr flipcolor
sty PARAM1+1
jsr PAPER
ldy #1
jsr flipcolor
dey ; TGI_ERR_OK
sty ERROR
sty PARAM1+1
jmp INK
flipcolor:
lda (ptr1),y
sta PALETTE,y
cmp #1
beq @flip
cmp #7
bne @keep
@flip: eor #1 ^ 7
@keep: sta PARAM1
rts
lda (ptr1),y
sta PALETTE,y
cmp #1
beq @flip
cmp #7
bne @keep
@flip: eor #1 ^ 7
@keep: sta PARAM1
rts
; ------------------------------------------------------------------------
; GETPALETTE: Return the current palette in A/X. Even drivers that cannot
@@ -253,9 +253,9 @@ flipcolor:
;
GETPALETTE:
lda #<PALETTE
ldx #>PALETTE
rts
lda #<PALETTE
ldx #>PALETTE
rts
; ------------------------------------------------------------------------
; GETDEFPALETTE: Return the default palette for the driver in A/X. All
@@ -267,9 +267,9 @@ GETPALETTE:
;
GETDEFPALETTE:
lda #<DEFPALETTE
ldx #>DEFPALETTE
rts
lda #<DEFPALETTE
ldx #>DEFPALETTE
rts
; ------------------------------------------------------------------------
; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing
@@ -280,18 +280,18 @@ GETDEFPALETTE:
;
SETPIXEL:
lda Y1
sta PARAM2
lda MODE
mymode: sta PARAM3
lda X1
add #2 * XSIZE ; Skip screen attribute columns
sta PARAM1
lda #0
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
jmp CURSET
lda Y1
sta PARAM2
lda MODE
mymode: sta PARAM3
lda X1
add #2 * XSIZE ; Skip screen attribute columns
sta PARAM1
lda #0
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
jmp CURSET
; ------------------------------------------------------------------------
; GETPIXEL: Read the color value of a pixel, and return it in A/X. The
@@ -299,18 +299,18 @@ mymode: sta PARAM3
; area, so there is no need for clipping inside this function.
GETPIXEL:
lda X1
sta PARAM1
lda Y1
sta PARAM2
lda #0
sta PARAM1+1
sta PARAM2+1
jsr POINT
lda PARAM1
and #%00000001
ldx #0
rts
lda X1
sta PARAM1
lda Y1
sta PARAM2
lda #0
sta PARAM1+1
sta PARAM2+1
jsr POINT
lda PARAM1
and #%00000001
ldx #0
rts
; ------------------------------------------------------------------------
; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and
@@ -320,24 +320,24 @@ GETPIXEL:
;
LINE:
jsr SETPIXEL
lda X2
sub X1
sta PARAM1
lda X2+1
sbc X1+1
sta PARAM1+1
lda Y2
sub Y1
sta PARAM2
lda Y2+1
sbc Y1+1
sta PARAM2+1
lda MODE
sta PARAM3
ldx #>0
stx PARAM3+1
jmp DRAW
jsr SETPIXEL
lda X2
sub X1
sta PARAM1
lda X2+1
sbc X1+1
sta PARAM1+1
lda Y2
sub Y1
sta PARAM2
lda Y2+1
sbc Y1+1
sta PARAM2+1
lda MODE
sta PARAM3
ldx #>0
stx PARAM3+1
jmp DRAW
; ------------------------------------------------------------------------
; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where
@@ -345,29 +345,29 @@ LINE:
; Contrary to most other functions, the graphics kernel will sort and clip
; the co-ordinates before calling the driver; so, on entry, the following
; conditions are valid:
; X1 <= X2
; Y1 <= Y2
; (X1 >= 0) && (X1 < XRES)
; (X2 >= 0) && (X2 < XRES)
; (Y1 >= 0) && (Y1 < YRES)
; (Y2 >= 0) && (Y2 < YRES)
; X1 <= X2
; Y1 <= Y2
; (X1 >= 0) && (X1 < XRES)
; (X2 >= 0) && (X2 < XRES)
; (Y1 >= 0) && (Y1 < YRES)
; (Y2 >= 0) && (Y2 < YRES)
;
; Must set an error code: NO
;
BAR:
inc Y2
@L1: lda Y2
pha
lda Y1
sta Y2
jsr LINE
pla
sta Y2
inc Y1
cmp Y1
bne @L1
rts
inc Y2
@L1: lda Y2
pha
lda Y1
sta Y2
jsr LINE
pla
sta Y2
inc Y1
cmp Y1
bne @L1
rts
; ------------------------------------------------------------------------
; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in the x
@@ -377,7 +377,7 @@ BAR:
;
TEXTSTYLE:
rts
rts
; ------------------------------------------------------------------------
@@ -389,38 +389,38 @@ TEXTSTYLE:
;
OUTTEXT:
lda Y1
sub #(YSIZE - 1)
sta PARAM2
lda #3 ; (Move graphics cursor; don't draw)
jsr mymode
lda Y1
sub #(YSIZE - 1)
sta PARAM2
lda #3 ; (Move graphics cursor; don't draw)
jsr mymode
ldy #0
@next: lda (ptr3),y
beq @end
sta PARAM1
lda #0
sta PARAM2
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
lda MODE
sta PARAM3
tya
pha
jsr CHAR
lda #XSIZE
sta PARAM1
lda #0
sta PARAM2
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
lda #3
sta PARAM3
jsr CURMOV
pla
tay
iny
bne @next
@end: rts
ldy #0
@next: lda (ptr3),y
beq @end
sta PARAM1
lda #0
sta PARAM2
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
lda MODE
sta PARAM3
tya
pha
jsr CHAR
lda #XSIZE
sta PARAM1
lda #0
sta PARAM2
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
lda #3
sta PARAM3
jsr CURMOV
pla
tay
iny
bne @next
@end: rts

View File

@@ -5,58 +5,58 @@
; 2012-08-11, Greg King <greg.king5@verizon.net>
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "atmos.inc"
.include "tgi-kernel.inc"
.include "tgi-error.inc"
.include "atmos.inc"
.macpack generic
.macpack generic
XSIZE = 6 ; System font width
YSIZE = 8 ; System font height
XSIZE = 6 ; System font width
YSIZE = 8 ; System font height
; ------------------------------------------------------------------------
; Header. Includes jump table and constants.
.segment "JUMPTABLE"
.segment "JUMPTABLE"
; First part of the header is a structure that has a magic and defines the
; capabilities of the driver
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
.word 240 ; X resolution
.word 200 ; Y resolution
.byte 2 ; Number of drawing colors
.byte 1 ; Number of screens available
.byte XSIZE ; System font X size
.byte YSIZE ; System font Y size
.byte $74, $67, $69 ; "tgi"
.byte TGI_API_VERSION ; TGI API version number
.word 240 ; X resolution
.word 200 ; Y resolution
.byte 2 ; Number of drawing colors
.byte 1 ; Number of screens available
.byte XSIZE ; System font X size
.byte YSIZE ; System font Y size
.word $011C ; Aspect ratio (based on 4/3 display)
.byte 0 ; TGI driver flags
; Next comes the jump table. Currently all entries must be valid and may point
; to an RTS for test versions (function not implemented).
.addr INSTALL
.addr UNINSTALL
.addr INIT
.addr DONE
.addr GETERROR
.addr CONTROL
.addr CLEAR
.addr SETVIEWPAGE
.addr SETDRAWPAGE
.addr SETCOLOR
.addr SETPALETTE
.addr GETPALETTE
.addr GETDEFPALETTE
.addr SETPIXEL
.addr GETPIXEL
.addr LINE
.addr BAR
.addr TEXTSTYLE
.addr OUTTEXT
.addr INSTALL
.addr UNINSTALL
.addr INIT
.addr DONE
.addr GETERROR
.addr CONTROL
.addr CLEAR
.addr SETVIEWPAGE
.addr SETDRAWPAGE
.addr SETCOLOR
.addr SETPALETTE
.addr GETPALETTE
.addr GETDEFPALETTE
.addr SETPIXEL
.addr GETPIXEL
.addr LINE
.addr BAR
.addr TEXTSTYLE
.addr OUTTEXT
.addr 0 ; IRQ entry is unused
; ------------------------------------------------------------------------
@@ -65,35 +65,35 @@ YSIZE = 8 ; System font height
; Variables mapped to the zero page segment variables. Some of these are
; used for passing parameters to the driver.
X1 = ptr1
Y1 = ptr2
X2 = ptr3
Y2 = ptr4
X1 = ptr1
Y1 = ptr2
X2 = ptr3
Y2 = ptr4
; Absolute variables used in the code
.bss
ERROR: .res 1 ; Error code
MODE: .res 1 ; Graphics mode
ERROR: .res 1 ; Error code
MODE: .res 1 ; Graphics mode
; Constants and tables
PARAM1 = $2E1
PARAM2 = $2E3
PARAM3 = $2E5
TEXT = $EC21
HIRES = $EC33
CURSET = $F0C8
CURMOV = $F0FD
DRAW = $F110
CHAR = $F12D
POINT = $F1C8
PAPER = $F204
INK = $F210
PARAM1 = $2E1
PARAM2 = $2E3
PARAM3 = $2E5
TEXT = $EC21
HIRES = $EC33
CURSET = $F0C8
CURMOV = $F0FD
DRAW = $F110
CHAR = $F12D
POINT = $F1C8
PAPER = $F204
INK = $F210
.rodata
DEFPALETTE: .byte 0, 1
DEFPALETTE: .byte 0, 1
.code
@@ -115,7 +115,7 @@ INSTALL:
;
UNINSTALL:
rts
rts
; ------------------------------------------------------------------------
; INIT: Changes an already installed device from text mode to graphics
@@ -135,13 +135,13 @@ INIT:
; Switch into graphics mode
jsr HIRES
jsr HIRES
; Done, reset the error code
lda #TGI_ERR_OK
sta ERROR
rts
lda #TGI_ERR_OK
sta ERROR
rts
; ------------------------------------------------------------------------
; DONE: Will be called to switch the graphics device back into text mode.
@@ -151,16 +151,16 @@ INIT:
; Must set an error code: NO
;
DONE = TEXT
DONE = TEXT
; ------------------------------------------------------------------------
; GETERROR: Return the error code in A and clear it.
GETERROR:
ldx #TGI_ERR_OK
lda ERROR
stx ERROR
rts
ldx #TGI_ERR_OK
lda ERROR
stx ERROR
rts
; ------------------------------------------------------------------------
; CONTROL: Platform/driver specific entry point.
@@ -169,10 +169,10 @@ GETERROR:
;
CONTROL:
sta $213
lda #TGI_ERR_OK
sta ERROR
rts
sta $213
lda #TGI_ERR_OK
sta ERROR
rts
; ------------------------------------------------------------------------
; CLEAR: Clears the screen.
@@ -180,7 +180,7 @@ CONTROL:
; Must set an error code: NO
;
CLEAR = HIRES
CLEAR = HIRES
; ------------------------------------------------------------------------
; SETVIEWPAGE: Set the visible page. Called with the new page in A (0..n).
@@ -199,7 +199,7 @@ SETVIEWPAGE:
;
SETDRAWPAGE:
rts
rts
; ------------------------------------------------------------------------
; SETCOLOR: Set the drawing color (in A). The new color is already checked
@@ -209,8 +209,8 @@ SETDRAWPAGE:
;
SETCOLOR:
sta MODE
rts
sta MODE
rts
; ------------------------------------------------------------------------
; SETPALETTE: Set the palette (not available with all drivers/hardware).
@@ -221,9 +221,9 @@ SETCOLOR:
;
SETPALETTE:
lda #TGI_ERR_INV_FUNC ; This resolution has no palette
sta ERROR
rts
lda #TGI_ERR_INV_FUNC ; This resolution has no palette
sta ERROR
rts
; ------------------------------------------------------------------------
; GETPALETTE: Return the current palette in A/X. Even drivers that cannot
@@ -245,9 +245,9 @@ GETPALETTE:
;
GETDEFPALETTE:
lda #<DEFPALETTE
ldx #>DEFPALETTE
rts
lda #<DEFPALETTE
ldx #>DEFPALETTE
rts
; ------------------------------------------------------------------------
; SETPIXEL: Draw one pixel at X1/Y1 = ptr1/ptr2 with the current drawing
@@ -258,17 +258,17 @@ GETDEFPALETTE:
;
SETPIXEL:
lda Y1
sta PARAM2
lda MODE
mymode: sta PARAM3
lda X1
sta PARAM1
lda #0
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
jmp CURSET
lda Y1
sta PARAM2
lda MODE
mymode: sta PARAM3
lda X1
sta PARAM1
lda #0
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
jmp CURSET
; ------------------------------------------------------------------------
; GETPIXEL: Read the color value of a pixel and return it in A/X. The
@@ -276,18 +276,18 @@ mymode: sta PARAM3
; area, so there is no need for clipping inside this function.
GETPIXEL:
lda X1
sta PARAM1
lda Y1
sta PARAM2
lda #0
sta PARAM1+1
sta PARAM2+1
jsr POINT
lda PARAM1
and #%00000001
ldx #0
rts
lda X1
sta PARAM1
lda Y1
sta PARAM2
lda #0
sta PARAM1+1
sta PARAM2+1
jsr POINT
lda PARAM1
and #%00000001
ldx #0
rts
; ------------------------------------------------------------------------
; LINE: Draw a line from X1/Y1 to X2/Y2, where X1/Y1 = ptr1/ptr2 and
@@ -297,24 +297,24 @@ GETPIXEL:
;
LINE:
jsr SETPIXEL
lda X2
sub X1
sta PARAM1
lda X2+1
sbc X1+1
sta PARAM1+1
lda Y2
sub Y1
sta PARAM2
lda Y2+1
sbc Y1+1
sta PARAM2+1
lda MODE
sta PARAM3
ldx #>0
stx PARAM3+1
jmp DRAW
jsr SETPIXEL
lda X2
sub X1
sta PARAM1
lda X2+1
sbc X1+1
sta PARAM1+1
lda Y2
sub Y1
sta PARAM2
lda Y2+1
sbc Y1+1
sta PARAM2+1
lda MODE
sta PARAM3
ldx #>0
stx PARAM3+1
jmp DRAW
; ------------------------------------------------------------------------
; BAR: Draw a filled rectangle with the corners X1/Y1, X2/Y2, where
@@ -322,29 +322,29 @@ LINE:
; Contrary to most other functions, the graphics kernel will sort and clip
; the coordinates before calling the driver, so on entry the following
; conditions are valid:
; X1 <= X2
; Y1 <= Y2
; (X1 >= 0) && (X1 < XRES)
; (X2 >= 0) && (X2 < XRES)
; (Y1 >= 0) && (Y1 < YRES)
; (Y2 >= 0) && (Y2 < YRES)
; X1 <= X2
; Y1 <= Y2
; (X1 >= 0) && (X1 < XRES)
; (X2 >= 0) && (X2 < XRES)
; (Y1 >= 0) && (Y1 < YRES)
; (Y2 >= 0) && (Y2 < YRES)
;
; Must set an error code: NO
;
BAR:
inc Y2
@L1: lda Y2
pha
lda Y1
sta Y2
jsr LINE
pla
sta Y2
inc Y1
cmp Y1
bne @L1
rts
inc Y2
@L1: lda Y2
pha
lda Y1
sta Y2
jsr LINE
pla
sta Y2
inc Y1
cmp Y1
bne @L1
rts
; ------------------------------------------------------------------------
; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in X and Y
@@ -354,7 +354,7 @@ BAR:
;
TEXTSTYLE:
rts
rts
; ------------------------------------------------------------------------
@@ -366,38 +366,38 @@ TEXTSTYLE:
;
OUTTEXT:
lda Y1
sub #(YSIZE - 1)
sta PARAM2
lda #3 ; (Move graphics cursor; don't draw)
jsr mymode
lda Y1
sub #(YSIZE - 1)
sta PARAM2
lda #3 ; (Move graphics cursor; don't draw)
jsr mymode
ldy #0
@next: lda (ptr3),y
beq @end
sta PARAM1
lda #0
sta PARAM2
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
lda MODE
sta PARAM3
tya
pha
jsr CHAR
lda #XSIZE
sta PARAM1
lda #0
sta PARAM2
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
lda #3
sta PARAM3
jsr CURMOV
pla
tay
iny
bne @next
@end: rts
ldy #0
@next: lda (ptr3),y
beq @end
sta PARAM1
lda #0
sta PARAM2
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
lda MODE
sta PARAM3
tya
pha
jsr CHAR
lda #XSIZE
sta PARAM1
lda #0
sta PARAM2
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
lda #3
sta PARAM3
jsr CURMOV
pla
tay
iny
bne @next
@end: rts

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 _atmos_240_200_2_tgi
.export _tgi_static_stddrv
.import _atmos_240_200_2_tgi
.rodata

View File

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

View File

@@ -3,12 +3,12 @@
; /* Convert a target-specific character to ASCII. */
;
.export _toascii
.export _toascii
.proc _toascii
.proc _toascii
; .X must be zero, on return.
ldx #>0
rts
ldx #>0
rts
.endproc

View File

@@ -4,7 +4,7 @@
; unsigned char wherex (void);
;
.export _wherex
.export _wherex
.include "atmos.inc"
@@ -12,7 +12,7 @@
ldx #$00
lda CURS_X
rts
rts
.endproc

View File

@@ -4,7 +4,7 @@
; unsigned char wherey (void);
;
.export _wherey
.export _wherey
.include "atmos.inc"
@@ -12,7 +12,7 @@
ldx #$00
lda CURS_Y
rts
rts
.endproc

View File

@@ -6,16 +6,16 @@
; This function is a hack!
;
.export _write
.import popax
.importzp ptr1, ptr2, ptr3, tmp1
.export _write
.import popax
.importzp ptr1, ptr2, ptr3, tmp1
.include "atmos.inc"
.include "atmos.inc"
.proc _write
sta ptr3
stx ptr3+1 ; save count as result
sta ptr3
stx ptr3+1 ; save count as result
eor #$FF
sta ptr2
@@ -23,32 +23,32 @@
eor #$FF
sta ptr2+1 ; Remember -count-1
jsr popax ; get buf
sta ptr1
stx ptr1+1
jsr popax ; get fd and discard
L1: inc ptr2
jsr popax ; get buf
sta ptr1
stx ptr1+1
jsr popax ; get fd and discard
L1: inc ptr2
bne L2
inc ptr2+1
beq L9
L2: ldy #0
lda (ptr1),y
lda (ptr1),y
tax
cpx #$0A ; Check for \n
bne L3
jsr PRINT
ldx #$0D
L3: jsr PRINT
inc ptr1
bne L1
inc ptr1+1
inc ptr1
bne L1
inc ptr1+1
jmp L1
; No error, return count
L9: lda ptr3
ldx ptr3+1
rts
L9: lda ptr3
ldx ptr3+1
rts
.endproc