Sym-1 lib changes

This commit is contained in:
Wayne Parham
2021-06-06 21:28:03 -05:00
parent e687f2f048
commit 6c4c959141
17 changed files with 339 additions and 421 deletions

View File

@@ -1,12 +1,8 @@
; ---------------------------------------------------------------------------
; beep.s
;
; for Sym-1
; Wayne Parham (wayne@parhamdata.com)
;
; Wayne Parham
; void beep (void);
;
; wayne@parhamdata.com
; ---------------------------------------------------------------------------
.include "sym1.inc"
@@ -15,10 +11,8 @@
.segment "CODE"
.proc _beep: near
; ---------------------------------------------------------------------------
jsr BEEP ; Beep
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc

View File

@@ -1,12 +1,31 @@
; ---------------------------------------------------------------------------
; bitio.s
;
; for Sym-1
; Wayne Parham (wayne@parhamdata.com)
;
; Wayne Parham
; void set_DDR1A (int value);
; int get_DDR1A (void);
; void set_IOR1A (int value);
; int get_IOR1A (void);
; void set_DDR1B (int value);
; int get_DDR1B (void);
; void set_IOR1B (int value);
; int get_IOR1B (void);
; void set_DDR2A (int value);
; int get_DDR2A (void);
; void set_IOR2A (int value);
; int get_IOR2A (void);
; void set_DDR2B (int value);
; int get_DDR2B (void);
; void set_IOR2B (int value);
; int get_IOR2B (void);
; void set_DDR3A (int value);
; int get_DDR3A (void);
; void set_IOR3A (int value);
; int get_IOR3A (void);
; void set_DDR3B (int value);
; int get_DDR3B (void);
; void set_IOR3B (int value);
; int get_IOR3B (void);
;
; wayne@parhamdata.com
; ---------------------------------------------------------------------------
.include "sym1.inc"
@@ -20,211 +39,182 @@
.segment "CODE"
.proc _set_DDR1A: near
; ---------------------------------------------------------------------------
sta DDR1A ; Write data direction register for port 1A
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_DDR1A: near
; ---------------------------------------------------------------------------
lda DDR1A ; Read data direction register for port 1A
ldx #$00 ;
rts ; Return DDR1A
; ---------------------------------------------------------------------------
.endproc
.proc _set_IOR1A: near
; ---------------------------------------------------------------------------
sta OR1A ; Write I/O register for port 1A
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_IOR1A: near
; ---------------------------------------------------------------------------
lda OR1A ; Read I/O register for port 1A
ldx #$00 ;
rts ; Return OR1A
; ---------------------------------------------------------------------------
.endproc
.proc _set_DDR1B: near
; ---------------------------------------------------------------------------
sta DDR1B ; Write data direction register for port 1B
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_DDR1B: near
; ---------------------------------------------------------------------------
lda DDR1B ; Read data direction register for port 1B
ldx #$00 ;
rts ; Return DDR1B
; ---------------------------------------------------------------------------
.endproc
.proc _set_IOR1B: near
; ---------------------------------------------------------------------------
sta OR1B ; Write I/O register for port 1B
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_IOR1B: near
; ---------------------------------------------------------------------------
lda OR1B ; Read I/O register for port 1B
ldx #$00 ;
rts ; Return OR1B
; ---------------------------------------------------------------------------
.endproc
.proc _set_DDR2A: near
; ---------------------------------------------------------------------------
sta DDR2A ; Write data direction register for port 2A
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_DDR2A: near
; ---------------------------------------------------------------------------
lda DDR2A ; Read data direction register for port 2A
ldx #$00 ;
rts ; Return DDR2A
; ---------------------------------------------------------------------------
.endproc
.proc _set_IOR2A: near
; ---------------------------------------------------------------------------
sta OR2A ; Write I/O register for port 2A
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_IOR2A: near
; ---------------------------------------------------------------------------
lda OR2A ; Read I/O register for port 2A
ldx #$00 ;
rts ; Return OR2A
; ---------------------------------------------------------------------------
.endproc
.proc _set_DDR2B: near
; ---------------------------------------------------------------------------
sta DDR2B ; Write data direction register for port 2B
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_DDR2B: near
; ---------------------------------------------------------------------------
lda DDR2B ; Read data direction register for port 2B
ldx #$00 ;
rts ; Return DDR2B
; ---------------------------------------------------------------------------
.endproc
.proc _set_IOR2B: near
; ---------------------------------------------------------------------------
sta OR2B ; Write I/O register for port 2B
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_IOR2B: near
; ---------------------------------------------------------------------------
lda OR2B ; Read I/O register for port 2B
ldx #$00 ;
rts ; Return OR2B
; ---------------------------------------------------------------------------
.endproc
.proc _set_DDR3A: near
; ---------------------------------------------------------------------------
sta DDR3A ; Write data direction register for port 3A
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_DDR3A: near
; ---------------------------------------------------------------------------
lda DDR3A ; Read data direction register for port 3A
ldx #$00 ;
rts ; Return DDR3A
; ---------------------------------------------------------------------------
.endproc
.proc _set_IOR3A: near
; ---------------------------------------------------------------------------
sta OR3A ; Write I/O register for port 3A
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
.endproc
.proc _get_IOR3A: near
; ---------------------------------------------------------------------------
lda OR3A ; Read I/O register for port 3A
ldx #$00 ;
rts ; Return OR3A
; ---------------------------------------------------------------------------
.endproc
.proc _set_DDR3B: near
; ---------------------------------------------------------------------------
sta DDR3B ; Write data direction register for port 3B
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_DDR3B: near
; ---------------------------------------------------------------------------
lda DDR3B ; Read data direction register for port 3B
ldx #$00 ;
rts ; Return DDR3B
; ---------------------------------------------------------------------------
.endproc
.proc _set_IOR3B: near
; ---------------------------------------------------------------------------
sta OR3B ; Write I/O register for port 3B
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_IOR3B: near
; ---------------------------------------------------------------------------
lda OR3B ; Read I/O register for port 3B
ldx #$00 ;
rts ; Return OR3B
; ---------------------------------------------------------------------------
.endproc

View File

@@ -1,12 +1,6 @@
; ---------------------------------------------------------------------------
; crt0.s
;
; for Sym-1
; Startup code for cc65 (Sym-1 version)
;
; Wayne Parham
;
; wayne@parhamdata.com
; ---------------------------------------------------------------------------
.export _init, _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
@@ -19,40 +13,40 @@
.include "zeropage.inc"
.include "sym1.inc"
; ---------------------------------------------------------------------------
; Place the startup code in a special segment
.segment "STARTUP"
; ---------------------------------------------------------------------------
; A little light housekeeping
_init: jsr ACCESS ; Unlock System RAM
cld ; Clear decimal mode
; ---------------------------------------------------------------------------
; Turn off console echo
lda TECHO
and #$7F
sta TECHO
; ---------------------------------------------------------------------------
; Set cc65 argument stack pointer
lda #<(__RAM_START__ + __RAM_SIZE__)
sta sp
lda #>(__RAM_START__ + __RAM_SIZE__)
sta sp+1
; ---------------------------------------------------------------------------
; Initialize memory storage
jsr zerobss ; Clear BSS segment
jsr copydata ; Initialize DATA segment
jsr initlib ; Run constructors
; ---------------------------------------------------------------------------
; Call main()
jsr _main
; ---------------------------------------------------------------------------
; Back from main (this is also the _exit entry)
_exit: jsr donelib ; Run destructors
@@ -61,5 +55,5 @@ _exit: jsr donelib ; Run destructors
sta TECHO
jsr NACCES ; Lock System RAM
rts ; Re-enter Sym-1 monitor
; ---------------------------------------------------------------------------

View File

@@ -1,12 +1,22 @@
; ---------------------------------------------------------------------------
; display.s
;
; for Sym-1
; Wayne Parham (wayne@parhamdata.com)
;
; Wayne Parham
; int fdisp (void);
; void set_D0 (char segments);
; int get_D0 (void);
; void set_D1 (char segments);
; int get_D1 (void);
; void set_D2 (char segments);
; int get_D2 (void);
; void set_D3 (char segments);
; int get_D3 (void);
; void set_D4 (char segments);
; int get_D4 (void);
; void set_D5 (char segments);
; int get_D5 (void);
; void set_D6 (char segments);
; int get_D6 (void);
;
; wayne@parhamdata.com
; ---------------------------------------------------------------------------
.include "sym1.inc"
@@ -18,137 +28,114 @@
.segment "CODE"
.proc _fdisp: near
; ---------------------------------------------------------------------------
jsr SCAND ; Flash Display
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _set_D0: near
; ---------------------------------------------------------------------------
sta DISBUF0 ; Write Digit 0
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_D0: near
; ---------------------------------------------------------------------------
lda DISBUF0 ; Read Digit 0
ldx #$00 ;
rts ; Return DISBUF0
; ---------------------------------------------------------------------------
.endproc
.proc _set_D1: near
; ---------------------------------------------------------------------------
sta DISBUF1 ; Write Digit 1
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_D1: near
; ---------------------------------------------------------------------------
lda DISBUF1 ; Read Digit 1
ldx #$00 ;
rts ; Return DISBUF1
; ---------------------------------------------------------------------------
rts
.endproc
.proc _set_D2: near
; ---------------------------------------------------------------------------
sta DISBUF2 ; Write Digit 2
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_D2: near
; ---------------------------------------------------------------------------
lda DISBUF2 ; Read Digit 2
ldx #$00 ;
rts ; Return DISBUF2
; ---------------------------------------------------------------------------
.endproc
.proc _set_D3: near
; ---------------------------------------------------------------------------
sta DISBUF3 ; Write Digit 3
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_D3: near
; ---------------------------------------------------------------------------
lda DISBUF3 ; Read Digit 3
ldx #$00 ;
rts ; Return DISBUF3
; ---------------------------------------------------------------------------
.endproc
.proc _set_D4: near
; ---------------------------------------------------------------------------
sta DISBUF4 ; Write Digit 4
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_D4: near
; ---------------------------------------------------------------------------
lda DISBUF4 ; Read Digit 4
ldx #$00 ;
rts ; Return DISBUF4
; ---------------------------------------------------------------------------
.endproc
.proc _set_D5: near
; ---------------------------------------------------------------------------
sta DISBUF5 ; Write Digit 5
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_D5: near
; ---------------------------------------------------------------------------
lda DISBUF5 ; Read Digit 5
ldx #$00 ;
rts ; Return DISBUF5
; ---------------------------------------------------------------------------
.endproc
.proc _set_D6: near
; ---------------------------------------------------------------------------
sta DISBUF6 ; Write byte to the right of display
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
rts
.endproc
.proc _get_D6: near
; ---------------------------------------------------------------------------
lda DISBUF6 ; Read byte to the right of display
ldx #$00 ;
rts ; Return DISBUF6
; ---------------------------------------------------------------------------
.endproc

View File

@@ -1,21 +0,0 @@
; ---------------------------------------------------------------------------
; getchar.s
;
; for Sym-1
;
; Wayne Parham
; ---------------------------------------------------------------------------
.include "sym1.inc"
.export _getchar
.segment "CODE"
.proc _getchar: near
; ---------------------------------------------------------------------------
jsr INTCHR ; Get character using Monitor ROM call
and #$7F ; Strip off top bit
ldx #$00 ;
rts ; Return char
; ---------------------------------------------------------------------------
.endproc

View File

@@ -1,23 +0,0 @@
; ---------------------------------------------------------------------------
; putchar.s
;
; for Sym-1
;
; Wayne Parham
;
; wayne@parhamdata.com
; ---------------------------------------------------------------------------
.include "sym1.inc"
.export _putchar
.segment "CODE"
.proc _putchar: near
; ---------------------------------------------------------------------------
jsr OUTCHR ; Send character using Monitor ROM call
lda #$00 ;
ldx #$00 ;
rts ; Return 0000
; ---------------------------------------------------------------------------
.endproc

View File

@@ -1,12 +1,8 @@
; ---------------------------------------------------------------------------
; read.s
;
; for Sym-1
; Wayne Parham (wayne@parhamdata.com)
;
; Wayne Parham
; int read (int fd, void* buf, unsigned count);
;
; wayne@parhamdata.com
; ---------------------------------------------------------------------------
.include "sym1.inc"
@@ -16,7 +12,7 @@
.export _read
.proc _read
; ---------------------------------------------------------------------------
sta ptr3
stx ptr3+1 ; Count in ptr3
inx
@@ -49,6 +45,6 @@ putch: ldy #$00 ; Put char into return buffer
done: lda ptr3
ldx ptr3+1
rts ; Return count
; ---------------------------------------------------------------------------
.endproc

View File

@@ -1,12 +1,9 @@
; ---------------------------------------------------------------------------
; tapeio.s
;
; for Sym-1
; Wayne Parham (wayne@parhamdata.com)
;
; Wayne Parham
; int loadt (int id);
; int dumpt (int id, int start_addr, int end_addr);
;
; wayne@parhamdata.com
; ---------------------------------------------------------------------------
.include "sym1.inc"
@@ -17,7 +14,7 @@
.segment "CODE"
.proc _loadt: near
; ---------------------------------------------------------------------------
sta P1L ; Tape record ID to P1L
ldx #$00
stx P1H
@@ -30,11 +27,11 @@
error: ldx #$00
lda #$FF ; or 00FF if not
done: rts
; ---------------------------------------------------------------------------
.endproc
.proc _dumpt: near
; ---------------------------------------------------------------------------
sta P3L ; End address
stx P3H
jsr popax
@@ -53,6 +50,6 @@ done: rts
error: ldx #$00
lda #$FF ; or 00FF if not
done: rts
; ---------------------------------------------------------------------------
.endproc

View File

@@ -1,12 +1,8 @@
; ---------------------------------------------------------------------------
; write.s
;
; for Sym-1
; Wayne Parham (wayne@parhamdata.com)
;
; Wayne Parham
; int write (int fd, const void* buf, int count);
;
; wayne@parhamdata.com
; ---------------------------------------------------------------------------
.include "sym1.inc"
@@ -16,7 +12,7 @@
.export _write
.proc _write
; ---------------------------------------------------------------------------
sta ptr3
stx ptr3+1 ; Count in ptr3
inx
@@ -48,6 +44,6 @@ next: inc ptr1
done: lda ptr3
ldx ptr3+1
rts ; Return count
; ---------------------------------------------------------------------------
.endproc