Split files
This commit is contained in:
@@ -6,31 +6,31 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.export _cputc
|
.export _cputc
|
||||||
.export _textcolor
|
.export _textcolor
|
||||||
.import _gotoxy, _gotox, _gotoy, pusha0
|
.import _gotoxy, gotox, gotoy, pusha0
|
||||||
.import pushax
|
.import pushax
|
||||||
.import _screen
|
.import _screen
|
||||||
.import CURS_X, CURS_Y
|
.import CURS_X, CURS_Y
|
||||||
|
|
||||||
.include "atari7800.inc"
|
.include "atari7800.inc"
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
.data
|
.data
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Holder of the text colour offset
|
; Holder of the text colour offset
|
||||||
; 0 = red, 42 = green, 84 = white
|
; 0 = red, 42 = green, 84 = white
|
||||||
;
|
;
|
||||||
txtcolor:
|
txtcolor:
|
||||||
.byte 0
|
.byte 0
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;---------------------------------------------------------------------------
|
;---------------------------------------------------------------------------
|
||||||
; 8x16 routine
|
; 8x16 routine
|
||||||
|
|
||||||
umula0:
|
umula0:
|
||||||
ldy #8 ; Number of bits
|
ldy #8 ; Number of bits
|
||||||
lda #0
|
lda #0
|
||||||
lsr ptr7800 ; Get first bit into carry
|
lsr ptr7800 ; Get first bit into carry
|
||||||
@L0: bcc @L1
|
@L0: bcc @L1
|
||||||
|
|
||||||
@@ -38,7 +38,7 @@ umula0:
|
|||||||
adc ptrtmp
|
adc ptrtmp
|
||||||
tax
|
tax
|
||||||
lda ptrtmp+1 ; hi byte of left op
|
lda ptrtmp+1 ; hi byte of left op
|
||||||
clc
|
clc
|
||||||
adc ptr7800+1
|
adc ptr7800+1
|
||||||
sta ptr7800+1
|
sta ptr7800+1
|
||||||
txa
|
txa
|
||||||
@@ -64,25 +64,25 @@ umula0:
|
|||||||
;
|
;
|
||||||
.proc _textcolor
|
.proc _textcolor
|
||||||
|
|
||||||
beq @L2
|
beq @L2
|
||||||
sec
|
sec
|
||||||
sbc #1
|
sbc #1
|
||||||
beq @L1
|
beq @L1
|
||||||
lda #84
|
lda #84
|
||||||
jmp @L2
|
jmp @L2
|
||||||
@L1: lda #42
|
@L1: lda #42
|
||||||
@L2: ldy txtcolor
|
@L2: ldy txtcolor
|
||||||
sta txtcolor ; Store new textcolor
|
sta txtcolor ; Store new textcolor
|
||||||
tya
|
tya
|
||||||
bne @L3
|
bne @L3
|
||||||
rts ; Old colour was 0
|
rts ; Old colour was 0
|
||||||
@L3: sec
|
@L3: sec
|
||||||
sbc #42
|
sbc #42
|
||||||
bne @L4
|
bne @L4
|
||||||
lda #1
|
lda #1
|
||||||
rts ; Old colour was 1
|
rts ; Old colour was 1
|
||||||
@L4: lda #2
|
@L4: lda #2
|
||||||
rts ; Old colour was 2
|
rts ; Old colour was 2
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
@@ -92,83 +92,83 @@ umula0:
|
|||||||
;
|
;
|
||||||
.proc _cputc
|
.proc _cputc
|
||||||
|
|
||||||
cmp #$0A ; LF
|
cmp #$0A ; LF
|
||||||
bne @L4
|
bne @L4
|
||||||
@L1: lda CURS_Y ; newline
|
@L1: lda CURS_Y ; newline
|
||||||
cmp #(screenrows-1)
|
cmp #(screenrows-1)
|
||||||
bne @L2
|
bne @L2
|
||||||
lda #0
|
lda #0
|
||||||
beq @L3
|
beq @L3
|
||||||
@L2: clc
|
@L2: clc
|
||||||
adc #1
|
adc #1
|
||||||
@L3: jsr _gotoy
|
@L3: jsr gotoy
|
||||||
lda #0
|
lda #0
|
||||||
jmp _gotox
|
jmp gotox
|
||||||
|
|
||||||
@L4:
|
@L4:
|
||||||
cmp #$20 ; ' '
|
cmp #$20 ; ' '
|
||||||
bne @L5
|
bne @L5
|
||||||
lda #$00
|
lda #$00
|
||||||
jmp @L10
|
jmp @L10
|
||||||
@L5:
|
@L5:
|
||||||
cmp #$3F ; '?'
|
cmp #$3F ; '?'
|
||||||
bne @L6
|
bne @L6
|
||||||
lda #$02
|
lda #$02
|
||||||
jmp @L9
|
jmp @L9
|
||||||
@L6:
|
@L6:
|
||||||
cmp #$7C ; '|'
|
cmp #$7C ; '|'
|
||||||
bne @L7
|
bne @L7
|
||||||
lda #$06
|
lda #$06
|
||||||
jmp @L9
|
jmp @L9
|
||||||
@L7:
|
@L7:
|
||||||
cmp #$41 ; >= 'A'
|
cmp #$41 ; >= 'A'
|
||||||
bcc @L8
|
bcc @L8
|
||||||
and #$5F ; make upper case
|
and #$5F ; make upper case
|
||||||
sec
|
sec
|
||||||
sbc #($41 - 17)
|
sbc #($41 - 17)
|
||||||
jmp @L9
|
jmp @L9
|
||||||
@L8:
|
@L8:
|
||||||
sec ; >= '*'
|
sec ; >= '*'
|
||||||
sbc #($2A - 1)
|
sbc #($2A - 1)
|
||||||
@L9:
|
@L9:
|
||||||
clc
|
clc
|
||||||
adc txtcolor
|
adc txtcolor
|
||||||
@L10:
|
@L10:
|
||||||
asl
|
asl
|
||||||
pha
|
pha
|
||||||
|
|
||||||
lda #0
|
lda #0
|
||||||
sta ptr7800+1
|
sta ptr7800+1
|
||||||
sta ptrtmp+1
|
sta ptrtmp+1
|
||||||
lda CURS_Y ; Find position on screen buffer
|
lda CURS_Y ; Find position on screen buffer
|
||||||
sta ptr7800
|
sta ptr7800
|
||||||
lda #charsperline
|
lda #charsperline
|
||||||
sta ptrtmp
|
sta ptrtmp
|
||||||
jsr umula0
|
jsr umula0
|
||||||
clc
|
clc
|
||||||
adc CURS_X
|
adc CURS_X
|
||||||
bcc @L11
|
bcc @L11
|
||||||
inx
|
inx
|
||||||
@L11: clc
|
@L11: clc
|
||||||
adc #<(_screen)
|
adc #<(_screen)
|
||||||
sta ptr7800
|
sta ptr7800
|
||||||
bcc @L12
|
bcc @L12
|
||||||
inx
|
inx
|
||||||
@L12: txa
|
@L12: txa
|
||||||
clc
|
clc
|
||||||
adc #>(_screen)
|
adc #>(_screen)
|
||||||
sta ptr7800+1
|
sta ptr7800+1
|
||||||
|
|
||||||
pla ; Print character on screen
|
pla ; Print character on screen
|
||||||
ldy #0
|
ldy #0
|
||||||
sta (ptr7800),y
|
sta (ptr7800),y
|
||||||
|
|
||||||
lda CURS_X ; Increment cursor
|
lda CURS_X ; Increment cursor
|
||||||
cmp #(charsperline-1)
|
cmp #(charsperline-1)
|
||||||
beq @L1
|
beq @L1
|
||||||
clc
|
clc
|
||||||
adc #1
|
adc #1
|
||||||
jmp _gotox
|
jmp gotox
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
|
|||||||
@@ -23,40 +23,40 @@
|
|||||||
; definitely not allow direct access to the variables.
|
; definitely not allow direct access to the variables.
|
||||||
;
|
;
|
||||||
|
|
||||||
.export gotoxy, _gotoxy, _gotox, _gotoy, _wherex, _wherey
|
.export gotoxy, _gotoxy, gotox, gotoy
|
||||||
.export CURS_X, CURS_Y
|
.export CURS_X, CURS_Y
|
||||||
.constructor init_cursor
|
.constructor init_cursor
|
||||||
.interruptor blink_cursor
|
.interruptor blink_cursor
|
||||||
|
|
||||||
.importzp sp
|
.importzp sp
|
||||||
.import _zones
|
.import _zones
|
||||||
.import cursor
|
.import cursor
|
||||||
.import pusha, incsp1, pusha0, pushax, popa
|
.import pusha, incsp1, pusha0, pushax, popa
|
||||||
.include "atari7800.inc"
|
.include "atari7800.inc"
|
||||||
.include "extzp.inc"
|
.include "extzp.inc"
|
||||||
|
|
||||||
.macpack generic
|
.macpack generic
|
||||||
|
|
||||||
.data
|
.data
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; The variables used by cursor functions
|
; The variables used by cursor functions
|
||||||
;
|
;
|
||||||
|
|
||||||
CURS_X:
|
CURS_X:
|
||||||
.byte 0
|
.byte 0
|
||||||
CURS_Y:
|
CURS_Y:
|
||||||
.byte 0
|
.byte 0
|
||||||
blink_time:
|
blink_time:
|
||||||
.byte 140
|
.byte 140
|
||||||
|
|
||||||
.code
|
.code
|
||||||
|
|
||||||
;---------------------------------------------------------------------------
|
;---------------------------------------------------------------------------
|
||||||
; 8x16 routine
|
; 8x16 routine
|
||||||
|
|
||||||
umula0:
|
umula0:
|
||||||
ldy #8 ; Number of bits
|
ldy #8 ; Number of bits
|
||||||
lda #0
|
lda #0
|
||||||
lsr ptr7800 ; Get first bit into carry
|
lsr ptr7800 ; Get first bit into carry
|
||||||
@L0: bcc @L1
|
@L0: bcc @L1
|
||||||
|
|
||||||
@@ -86,24 +86,24 @@ umula0:
|
|||||||
; A = CURS_Y
|
; A = CURS_Y
|
||||||
.proc calccursorzone
|
.proc calccursorzone
|
||||||
|
|
||||||
sta ptr7800
|
sta ptr7800
|
||||||
lda #11
|
lda #11
|
||||||
sta ptrtmp
|
sta ptrtmp
|
||||||
lda #0
|
lda #0
|
||||||
sta ptr7800+1
|
sta ptr7800+1
|
||||||
sta ptrtmp+1
|
sta ptrtmp+1
|
||||||
jsr umula0
|
jsr umula0
|
||||||
clc
|
clc
|
||||||
adc #5
|
adc #5
|
||||||
bcc @L1
|
bcc @L1
|
||||||
inx
|
inx
|
||||||
@L1: clc
|
@L1: clc
|
||||||
adc #<_zones
|
adc #<_zones
|
||||||
sta cursorzone ; calculate new cursorzone
|
sta cursorzone ; calculate new cursorzone
|
||||||
txa
|
txa
|
||||||
adc #>_zones
|
adc #>_zones
|
||||||
sta cursorzone+1
|
sta cursorzone+1
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@@ -122,23 +122,23 @@ umula0:
|
|||||||
; Enable cursor
|
; Enable cursor
|
||||||
; if showcursor cursorzone[1] = 30
|
; if showcursor cursorzone[1] = 30
|
||||||
;
|
;
|
||||||
.proc _gotoy
|
.proc gotoy
|
||||||
|
|
||||||
pha
|
pha
|
||||||
lda CURS_Y
|
lda CURS_Y
|
||||||
jsr calccursorzone
|
jsr calccursorzone
|
||||||
ldy #1
|
ldy #1
|
||||||
lda #0
|
lda #0
|
||||||
sta (cursorzone),y ; disable cursor
|
sta (cursorzone),y ; disable cursor
|
||||||
pla
|
pla
|
||||||
sta CURS_Y
|
sta CURS_Y
|
||||||
jsr calccursorzone
|
jsr calccursorzone
|
||||||
lda cursor
|
lda cursor
|
||||||
beq @L1
|
beq @L1
|
||||||
lda #30 ; enable cursor
|
lda #30 ; enable cursor
|
||||||
@L1: ldy #1
|
@L1: ldy #1
|
||||||
sta (cursorzone),y
|
sta (cursorzone),y
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
@@ -147,70 +147,53 @@ umula0:
|
|||||||
; You also need to set the hpos offset to the correct value on this line
|
; You also need to set the hpos offset to the correct value on this line
|
||||||
; cursorzone[3] = 8 * CURS_X
|
; cursorzone[3] = 8 * CURS_X
|
||||||
;
|
;
|
||||||
.proc _gotox
|
.proc gotox
|
||||||
|
|
||||||
sta CURS_X
|
sta CURS_X
|
||||||
ldy #3
|
ldy #3
|
||||||
clc
|
clc
|
||||||
rol
|
rol
|
||||||
rol
|
rol
|
||||||
rol
|
rol
|
||||||
sta (cursorzone),y
|
sta (cursorzone),y
|
||||||
rts
|
rts
|
||||||
|
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Set cursor to desired position (X,Y)
|
; Set cursor to desired position (X,Y)
|
||||||
;
|
;
|
||||||
.proc _gotoxy
|
.proc _gotoxy
|
||||||
|
|
||||||
jsr _gotoy
|
jsr gotoy
|
||||||
jsr popa
|
jsr popa
|
||||||
jsr _gotox
|
jsr gotox
|
||||||
rts
|
rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
.proc gotoxy
|
.proc gotoxy
|
||||||
jsr popa
|
jsr popa
|
||||||
jmp _gotoxy
|
jmp _gotoxy
|
||||||
.endproc
|
.endproc
|
||||||
;-----------------------------------------------------------------------------
|
|
||||||
; Get cursor X position
|
|
||||||
;
|
|
||||||
.proc _wherex
|
|
||||||
|
|
||||||
lda CURS_X
|
|
||||||
rts
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
|
||||||
; Get cursor Y position
|
|
||||||
;
|
|
||||||
.proc _wherey
|
|
||||||
|
|
||||||
lda CURS_Y
|
|
||||||
rts
|
|
||||||
.endproc
|
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Initialize cursorzone at startup
|
; Initialize cursorzone at startup
|
||||||
; Offset to cursor zone 5.
|
; Offset to cursor zone 5.
|
||||||
;
|
;
|
||||||
.proc blink_cursor
|
.proc blink_cursor
|
||||||
inc blink_time
|
inc blink_time
|
||||||
bne @L3
|
bne @L3
|
||||||
lda #140
|
lda #140
|
||||||
sta blink_time
|
sta blink_time
|
||||||
ldy #0
|
ldy #0
|
||||||
lda (cursorzone),y
|
lda (cursorzone),y
|
||||||
bne @L1
|
bne @L1
|
||||||
lda #254
|
lda #254
|
||||||
bne @L2
|
bne @L2
|
||||||
@L1: lda #0
|
@L1: lda #0
|
||||||
@L2: sta (cursorzone),y
|
@L2: sta (cursorzone),y
|
||||||
@L3: rts
|
@L3: rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Initialize cursorzone at startup
|
; Initialize cursorzone at startup
|
||||||
@@ -218,9 +201,9 @@ umula0:
|
|||||||
;
|
;
|
||||||
.segment "ONCE"
|
.segment "ONCE"
|
||||||
init_cursor:
|
init_cursor:
|
||||||
lda #0
|
lda #0
|
||||||
jsr calccursorzone
|
jsr calccursorzone
|
||||||
rts
|
rts
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; force the init constructor to be imported
|
; force the init constructor to be imported
|
||||||
|
|||||||
@@ -5,14 +5,15 @@
|
|||||||
;
|
;
|
||||||
|
|
||||||
.export _wherex
|
.export _wherex
|
||||||
.import CURS_X
|
.import CURS_X
|
||||||
|
|
||||||
;-----------------------------------------------------------------------------
|
;-----------------------------------------------------------------------------
|
||||||
; Get cursor X position
|
; Get cursor X position
|
||||||
;
|
;
|
||||||
.proc _wherex
|
.proc _wherex
|
||||||
|
|
||||||
lda CURS_X
|
ldx #0
|
||||||
rts
|
lda CURS_X
|
||||||
.endproc
|
rts
|
||||||
|
.endproc
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user