a bunch of simple conio fixes, makes a few more samples work
This commit is contained in:
12
libsrc/mega65/_scrsize.s
Normal file
12
libsrc/mega65/_scrsize.s
Normal file
@@ -0,0 +1,12 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 26.10.2000
|
||||
;
|
||||
; Screen size variables
|
||||
;
|
||||
|
||||
.export screensize
|
||||
.import SCREEN
|
||||
|
||||
screensize = SCREEN
|
||||
|
||||
|
||||
17
libsrc/mega65/bordercolor.s
Normal file
17
libsrc/mega65/bordercolor.s
Normal file
@@ -0,0 +1,17 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
;
|
||||
; unsigned char __fastcall__ bordercolor (unsigned char color);
|
||||
;
|
||||
|
||||
|
||||
.export _bordercolor
|
||||
|
||||
.include "mega65.inc"
|
||||
|
||||
_bordercolor:
|
||||
ldx VIC_BORDERCOLOR ; get old value
|
||||
sta VIC_BORDERCOLOR ; set new value
|
||||
txa
|
||||
rts
|
||||
|
||||
15
libsrc/mega65/clrscr.s
Normal file
15
libsrc/mega65/clrscr.s
Normal file
@@ -0,0 +1,15 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
;
|
||||
; void clrscr (void);
|
||||
;
|
||||
|
||||
.export _clrscr
|
||||
|
||||
.include "cbm_kernal.inc"
|
||||
|
||||
;_clrscr = CLRSCR
|
||||
|
||||
_clrscr:
|
||||
lda #$93
|
||||
jmp CHROUT
|
||||
24
libsrc/mega65/color.s
Normal file
24
libsrc/mega65/color.s
Normal file
@@ -0,0 +1,24 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
;
|
||||
; unsigned char __fastcall__ textcolor (unsigned char color);
|
||||
; unsigned char __fastcall__ bgcolor (unsigned char color);
|
||||
;
|
||||
|
||||
|
||||
.export _textcolor, _bgcolor
|
||||
|
||||
.include "mega65.inc"
|
||||
|
||||
_textcolor:
|
||||
ldx CHARCOLOR ; get old value
|
||||
sta CHARCOLOR ; set new value
|
||||
txa
|
||||
rts
|
||||
|
||||
|
||||
_bgcolor:
|
||||
ldx VIC_BG_COLOR0 ; get old value
|
||||
sta VIC_BG_COLOR0 ; set new value
|
||||
txa
|
||||
rts
|
||||
10
libsrc/mega65/conio.s
Normal file
10
libsrc/mega65/conio.s
Normal file
@@ -0,0 +1,10 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
;
|
||||
; Low level stuff for screen output/console input
|
||||
;
|
||||
|
||||
.exportzp CURS_X, CURS_Y
|
||||
|
||||
.include "mega65.inc"
|
||||
|
||||
118
libsrc/mega65/cputc.s
Normal file
118
libsrc/mega65/cputc.s
Normal file
@@ -0,0 +1,118 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 1998-08-06, 2009-09-26
|
||||
;
|
||||
; void __fastcall__ cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void __fastcall__ cputc (char c);
|
||||
;
|
||||
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
.import gotoxy
|
||||
.import PLOT
|
||||
|
||||
.include "mega65.inc"
|
||||
|
||||
|
||||
_cputcxy:
|
||||
pha ; Save C
|
||||
jsr gotoxy ; Set cursor, drop x and y
|
||||
pla ; Restore C
|
||||
|
||||
; Plot a character - also used as internal function
|
||||
|
||||
_cputc: cmp #$0A ; CR?
|
||||
bne L1
|
||||
lda #0
|
||||
sta CURS_X
|
||||
beq plot ; Recalculate pointers
|
||||
|
||||
L1: cmp #$0D ; LF?
|
||||
beq newline ; Recalculate pointers
|
||||
|
||||
; Printable char of some sort
|
||||
|
||||
cmp #' '
|
||||
bcc cputdirect ; Other control char
|
||||
tay
|
||||
bmi L10
|
||||
cmp #$60
|
||||
bcc L2
|
||||
and #$DF
|
||||
bne cputdirect ; Branch always
|
||||
L2: and #$3F
|
||||
|
||||
cputdirect:
|
||||
jsr putchar ; Write the character to the screen
|
||||
|
||||
; Advance cursor position
|
||||
|
||||
advance:
|
||||
iny
|
||||
cpy #XSIZE
|
||||
bne L3
|
||||
jsr newline ; new line
|
||||
ldy #0 ; + cr
|
||||
L3: sty CURS_X
|
||||
rts
|
||||
|
||||
newline:
|
||||
clc
|
||||
lda #XSIZE
|
||||
adc SCREEN_PTR
|
||||
sta SCREEN_PTR
|
||||
bcc L4
|
||||
inc SCREEN_PTR+1
|
||||
clc
|
||||
L4: lda #XSIZE
|
||||
adc CRAM_PTR
|
||||
sta CRAM_PTR
|
||||
bcc L5
|
||||
inc CRAM_PTR+1
|
||||
L5: inc CURS_Y
|
||||
rts
|
||||
|
||||
; Handle character if high bit set
|
||||
|
||||
L10: and #$7F
|
||||
cmp #$7F ; PI?
|
||||
bne L11
|
||||
lda #$5E ; Load screen code for PI
|
||||
L11: ora #$40
|
||||
bne cputdirect
|
||||
|
||||
|
||||
|
||||
; Set cursor position, calculate RAM pointers.
|
||||
|
||||
plot: ldy CURS_X
|
||||
ldx CURS_Y
|
||||
clc
|
||||
jmp PLOT ; Set the new cursor
|
||||
|
||||
|
||||
|
||||
; Write one character to the screen without doing anything else, return X
|
||||
; position in Y
|
||||
|
||||
putchar:
|
||||
ora RVS ; Set revers bit
|
||||
ldy CURS_X
|
||||
|
||||
pha
|
||||
lda SCREEN_PTR + 1
|
||||
clc
|
||||
adc #>$0800
|
||||
sta SCREEN_PTR + 1
|
||||
pla
|
||||
|
||||
sta (SCREEN_PTR),y ; Set char
|
||||
|
||||
lda SCREEN_PTR + 1
|
||||
sec
|
||||
sbc #>$0800
|
||||
sta SCREEN_PTR + 1
|
||||
|
||||
lda CHARCOLOR
|
||||
; lda #$88
|
||||
; sta (CRAM_PTR),y ; Set color
|
||||
rts
|
||||
7
libsrc/mega65/devnum.s
Normal file
7
libsrc/mega65/devnum.s
Normal file
@@ -0,0 +1,7 @@
|
||||
;
|
||||
; Oliver Schmidt, 2010-02-14
|
||||
;
|
||||
|
||||
.include "mega65.inc"
|
||||
|
||||
.exportzp devnum := DEVNUM
|
||||
24
libsrc/mega65/kbhit.s
Normal file
24
libsrc/mega65/kbhit.s
Normal file
@@ -0,0 +1,24 @@
|
||||
|
||||
|
||||
; FIXME: is $d610 mega65 specific?
|
||||
; FIXME: this should rather use the kernal (with keyboard buffer etc)
|
||||
|
||||
.export _cgetc
|
||||
_cgetc:
|
||||
|
||||
: lda $d610
|
||||
beq :-
|
||||
ldx #0
|
||||
stx $d610
|
||||
rts
|
||||
|
||||
.export _kbhit
|
||||
_kbhit:
|
||||
lda $d610
|
||||
beq :+
|
||||
|
||||
lda #1
|
||||
:
|
||||
ldx #0
|
||||
rts
|
||||
|
||||
5
libsrc/mega65/status.s
Normal file
5
libsrc/mega65/status.s
Normal file
@@ -0,0 +1,5 @@
|
||||
;
|
||||
; Oliver Schmidt, 2012-09-30
|
||||
;
|
||||
|
||||
.exportzp ST := $90 ; IEC status byte
|
||||
Reference in New Issue
Block a user