Merge remote-tracking branch 'upstream/master' into pcenginetarget
This commit is contained in:
@@ -24,6 +24,7 @@ TARGETS = apple2 \
|
||||
$(GEOS) \
|
||||
lynx \
|
||||
nes \
|
||||
osic1p \
|
||||
pce \
|
||||
sim6502 \
|
||||
sim65c02 \
|
||||
|
||||
@@ -46,9 +46,9 @@
|
||||
sta $94
|
||||
sty $95
|
||||
|
||||
; Call into the Applesoft Block Transfer Utility -- which handles zero-
|
||||
; Call into Applesoft Block Transfer Up -- which handles zero-
|
||||
; sized blocks well -- to move the content of the LC memory area.
|
||||
jsr $D396 ; BLTU + 3
|
||||
jsr $D39A ; BLTU2
|
||||
|
||||
; Set the source start address.
|
||||
lda #<__ZPSAVE_RUN__
|
||||
@@ -68,9 +68,9 @@
|
||||
sta $94
|
||||
sty $95
|
||||
|
||||
; Call into the Applesoft Block Transfer Utility -- which handles moving
|
||||
; Call into Applesoft Block Transfer Up -- which handles moving
|
||||
; overlapping blocks upwards well -- to move the INIT segment.
|
||||
jsr $D396 ; BLTU + 3
|
||||
jsr $D39A ; BLTU2
|
||||
|
||||
; Delegate all further processing, to keep the STARTUP segment small.
|
||||
jsr init
|
||||
@@ -164,10 +164,6 @@ basic: lda HIMEM
|
||||
: sta sp
|
||||
stx sp+1
|
||||
|
||||
; Enable interrupts, as old ProDOS versions (i.e. 1.1.1)
|
||||
; jump to SYS and BIN programs with interrupts disabled.
|
||||
cli
|
||||
|
||||
; Call the module constructors.
|
||||
jsr initlib
|
||||
|
||||
|
||||
@@ -23,11 +23,29 @@ oserr: jsr popname ; Preserves A
|
||||
jmp __mappederrno
|
||||
|
||||
_exec:
|
||||
; Save cmdline
|
||||
sta ptr4
|
||||
stx ptr4+1
|
||||
|
||||
; Get and push name
|
||||
jsr popax
|
||||
jsr pushname
|
||||
bne oserr
|
||||
|
||||
; ProDOS TechRefMan, chapter 5.1.5.1:
|
||||
; "The complete or partial pathname of the system program
|
||||
; is stored at $280, starting with a length byte."
|
||||
; In fact BASIC.SYSTEM does the same for BLOAD and BRUN of
|
||||
; binary programs so we should do the same too in any case
|
||||
; especially as _we_ rely on it in mainargs.s for argv[0]
|
||||
ldy #$00
|
||||
lda (sp),y
|
||||
tay
|
||||
: lda (sp),y
|
||||
sta $0280,y
|
||||
dey
|
||||
bpl :-
|
||||
|
||||
; Set pushed name
|
||||
lda sp
|
||||
ldx sp+1
|
||||
@@ -52,24 +70,14 @@ _exec:
|
||||
lda mliparam + MLI::INFO::FILE_TYPE
|
||||
cmp #$FF ; SYS file?
|
||||
bne binary ; No, check for BIN file
|
||||
sta file_type ; Save file type for cmdline handling
|
||||
|
||||
; ProDOS TechRefMan, chapter 5.1.5.1:
|
||||
; "The complete or partial pathname of the system program
|
||||
; is stored at $280, starting with a length byte."
|
||||
ldy #$00
|
||||
lda (sp),y
|
||||
tay
|
||||
: lda (sp),y
|
||||
sta $0280,y
|
||||
dey
|
||||
bpl :-
|
||||
|
||||
; SYS programs replace BASIC.SYSTEM so set in the ProDOS system bit map
|
||||
; protection for pages $80 - $BF just in case BASIC.SYSTEM is there now
|
||||
ldx #$0F ; Start with protection for pages $B8 - $BF
|
||||
lda #%00000001 ; Protect only system global page
|
||||
: sta $BF60,x ; Set protection for 8 pages
|
||||
lda #$00 ; Protect no page
|
||||
lda #%00000000 ; Protect no page
|
||||
dex
|
||||
bpl :-
|
||||
bmi prodos ; Branch always
|
||||
@@ -112,7 +120,7 @@ setbuf: lda #$00 ; Low byte
|
||||
dex
|
||||
dex
|
||||
dex
|
||||
|
||||
|
||||
; Set I/O buffer
|
||||
sta mliparam + MLI::OPEN::IO_BUFFER
|
||||
stx mliparam + MLI::OPEN::IO_BUFFER+1
|
||||
@@ -126,7 +134,7 @@ setbuf: lda #$00 ; Low byte
|
||||
stx level
|
||||
beq :+
|
||||
dec LEVEL
|
||||
|
||||
|
||||
; Open file
|
||||
: lda #OPEN_CALL
|
||||
ldx #OPEN_COUNT
|
||||
@@ -158,8 +166,27 @@ setbuf: lda #$00 ; Low byte
|
||||
bit $C080
|
||||
.endif
|
||||
|
||||
; Reset stack as we already passed
|
||||
; the point of no return anyway
|
||||
ldx #$FF
|
||||
txs
|
||||
|
||||
; Store up to 127 chars of cmdline (if any)
|
||||
; including terminating zero in stack page
|
||||
ldy #$00
|
||||
lda ptr4+1 ; NULL?
|
||||
beq :++ ; Yes, store as '\0'
|
||||
: lda (ptr4),y
|
||||
: sta $0100,y
|
||||
beq :+ ; '\0' stored, done
|
||||
iny
|
||||
cpy #$7E
|
||||
bcc :--
|
||||
lda #$00 ; '\0'
|
||||
beq :- ; Branch always
|
||||
|
||||
; Call loader stub after C libary shutdown
|
||||
lda #<target
|
||||
: lda #<target
|
||||
ldx #>target
|
||||
sta done+1
|
||||
stx done+2
|
||||
@@ -177,16 +204,58 @@ level : .res 1
|
||||
source: jsr $BF00
|
||||
.byte READ_CALL
|
||||
.word read_param
|
||||
bcs :+
|
||||
bcs error
|
||||
|
||||
; Close program file
|
||||
jsr $BF00
|
||||
.byte CLOSE_CALL
|
||||
.word close_param
|
||||
bcs :+
|
||||
bcs error
|
||||
|
||||
; Check for cmdline handling
|
||||
lda $0100 ; Valid cmdline?
|
||||
beq jump ; No, jump to program right away
|
||||
ldx file_type ; SYS file?
|
||||
bne system ; Yes, check for startup filename
|
||||
|
||||
; Store REM and cmdline in BASIC input buffer
|
||||
lda #$B2 ; REM token
|
||||
bne :++ ; Branch always
|
||||
: inx
|
||||
lda a:$0100-1,x
|
||||
: sta $0200,x
|
||||
bne :--
|
||||
beq jump ; Branch always
|
||||
|
||||
; Check for startup filename support
|
||||
; ProDOS TechRefMan, chapter 5.1.5.1:
|
||||
; "$2000 is a jump instruction. $2003 and $2004 are $EE."
|
||||
system: lda $2000
|
||||
cmp #$4C
|
||||
bne jump
|
||||
lda $2003
|
||||
cmp #$EE
|
||||
bne jump
|
||||
lda $2004
|
||||
cmp #$EE
|
||||
bne jump
|
||||
|
||||
; Store cmdline in startup filename buffer
|
||||
ldx #$01
|
||||
: lda a:$0100-1,x
|
||||
beq :+
|
||||
sta $2006,x
|
||||
inx
|
||||
cpx $2005 ; Buffer full?
|
||||
bcc :- ; No, continue
|
||||
: dex
|
||||
stx $2006 ; Store cmdline length
|
||||
|
||||
; Go for it ...
|
||||
jmp (data_buffer)
|
||||
jump: jmp (data_buffer)
|
||||
|
||||
file_type = * - source + target
|
||||
.byte $00
|
||||
|
||||
read_param = * - source + target
|
||||
.byte $04 ; PARAM_COUNT
|
||||
@@ -204,7 +273,7 @@ close_ref = * - source + target
|
||||
|
||||
; Quit to ProDOS dispatcher
|
||||
quit = * - source + target
|
||||
: jsr $BF00
|
||||
error: jsr $BF00
|
||||
.byte $65 ; QUIT
|
||||
.word quit_param
|
||||
|
||||
|
||||
@@ -21,6 +21,10 @@ initirq:
|
||||
.byte $40 ; Alloc interrupt
|
||||
.addr i_param
|
||||
bcs prterr
|
||||
|
||||
; Enable interrupts, as old ProDOS versions (i.e. 1.1.1)
|
||||
; jump to SYS and BIN programs with interrupts disabled.
|
||||
cli
|
||||
rts
|
||||
|
||||
; Print error message and exit
|
||||
|
||||
@@ -34,12 +34,12 @@
|
||||
MAXARGS = 10
|
||||
|
||||
; ProDOS stores the filename in the second half of BASIC's input buffer, so
|
||||
; there are 128 characters left. At least 7 characters are necessary for the
|
||||
; CALLxxxx:REM so 121 characters may be used before overwriting the ProDOS
|
||||
; filename. As we don't want to put further restrictions on the command-line
|
||||
; length we reserve those 121 characters terminated by a zero.
|
||||
; there are 128 characters left. At least 1 character is necessary for the
|
||||
; REM so 127 characters (including the terminating zero) may be used before
|
||||
; overwriting the ProDOS filename. As we don't want to further restrict the
|
||||
; command-line length we reserve those 127 characters.
|
||||
|
||||
BUF_LEN = 122
|
||||
BUF_LEN = 127
|
||||
|
||||
BASIC_BUF = $200
|
||||
FNAM_LEN = $280
|
||||
@@ -176,4 +176,4 @@ argv: .addr FNAM
|
||||
|
||||
.bss
|
||||
|
||||
buffer: .res BUF_LEN
|
||||
buffer: .res BUF_LEN
|
||||
|
||||
@@ -22,14 +22,14 @@ READ_CALL = $CA
|
||||
CLOSE_CALL = $CC
|
||||
FILE_NOT_FOUND_ERR = $46
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.import __CODE_0300_SIZE__, __DATA_0300_SIZE__
|
||||
.import __CODE_0300_LOAD__, __CODE_0300_RUN__
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "DATA_2000"
|
||||
.segment "DATA_2000"
|
||||
|
||||
GET_FILE_INFO_PARAM:
|
||||
.byte $0A ;PARAM_COUNT
|
||||
@@ -57,9 +57,9 @@ LOADING:
|
||||
ELLIPSES:
|
||||
.byte " ...", $0D, $0D, $00
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "DATA_0300"
|
||||
.segment "DATA_0300"
|
||||
|
||||
READ_PARAM:
|
||||
.byte $04 ;PARAM_COUNT
|
||||
@@ -81,22 +81,22 @@ QUIT_PARAM:
|
||||
|
||||
FILE_NOT_FOUND:
|
||||
.asciiz "... File Not Found"
|
||||
|
||||
|
||||
ERROR_NUMBER:
|
||||
.asciiz "... Error $"
|
||||
|
||||
PRESS_ANY_KEY:
|
||||
.asciiz " - Press Any Key "
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "CODE_2000"
|
||||
.segment "CODE_2000"
|
||||
|
||||
jmp :+
|
||||
.byte $EE
|
||||
.byte $EE
|
||||
.byte 65
|
||||
STARTUP:.res 65
|
||||
.byte $7F
|
||||
STARTUP:.res $7F
|
||||
|
||||
; Reset stack
|
||||
: ldx #$FF
|
||||
@@ -104,8 +104,8 @@ STARTUP:.res 65
|
||||
|
||||
; Relocate CODE_0300 and DATA_0300
|
||||
ldx #<(__CODE_0300_SIZE__ + __DATA_0300_SIZE__)
|
||||
: lda __CODE_0300_LOAD__ - 1,x
|
||||
sta __CODE_0300_RUN__ - 1,x
|
||||
: lda __CODE_0300_LOAD__-1,x
|
||||
sta __CODE_0300_RUN__-1,x
|
||||
dex
|
||||
bne :-
|
||||
|
||||
@@ -118,23 +118,23 @@ STARTUP:.res 65
|
||||
; Add trailing '\0' to pathname
|
||||
tax
|
||||
lda #$00
|
||||
sta PATHNAME + 1,x
|
||||
sta PATHNAME+1,x
|
||||
|
||||
; Copy ProDOS startup filename and trailing '\0' to stack
|
||||
ldx STARTUP
|
||||
lda #$00
|
||||
beq :++ ; bra
|
||||
: lda STARTUP + 1,x
|
||||
beq :++ ; Branch always
|
||||
: lda STARTUP+1,x
|
||||
: sta STACK,x
|
||||
dex
|
||||
bpl :--
|
||||
bpl :--
|
||||
|
||||
; Provide some user feedback
|
||||
lda #<LOADING
|
||||
ldx #>LOADING
|
||||
jsr PRINT
|
||||
lda #<(PATHNAME + 1)
|
||||
ldx #>(PATHNAME + 1)
|
||||
lda #<(PATHNAME+1)
|
||||
ldx #>(PATHNAME+1)
|
||||
jsr PRINT
|
||||
lda #<ELLIPSES
|
||||
ldx #>ELLIPSES
|
||||
@@ -159,16 +159,16 @@ STARTUP:.res 65
|
||||
|
||||
; Get load address from aux-type
|
||||
lda FILE_INFO_ADDR
|
||||
ldx FILE_INFO_ADDR + 1
|
||||
ldx FILE_INFO_ADDR+1
|
||||
sta READ_ADDR
|
||||
stx READ_ADDR + 1
|
||||
stx READ_ADDR+1
|
||||
|
||||
; It's high time to leave this place
|
||||
jmp __CODE_0300_RUN__
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "CODE_0300"
|
||||
.segment "CODE_0300"
|
||||
|
||||
jsr MLI
|
||||
.byte READ_CALL
|
||||
@@ -180,15 +180,15 @@ STARTUP:.res 65
|
||||
.word CLOSE_PARAM
|
||||
bcs ERROR
|
||||
|
||||
; Copy REM token and startup filename to BASIC input buffer
|
||||
; Copy REM and startup filename to BASIC input buffer
|
||||
ldx #$00
|
||||
lda #$B2
|
||||
bne :++ ; bra
|
||||
lda #$B2 ; REM token
|
||||
bne :++ ; Branch always
|
||||
: inx
|
||||
lda a:STACK - 1,x
|
||||
lda a:STACK-1,x
|
||||
: sta BUF,x
|
||||
bne :--
|
||||
|
||||
|
||||
; Go for it ...
|
||||
jmp (READ_ADDR)
|
||||
|
||||
@@ -207,7 +207,7 @@ PRINT:
|
||||
: ora #$80
|
||||
jsr COUT
|
||||
iny
|
||||
bne :-- ; bra
|
||||
bne :-- ; Branch always
|
||||
: rts
|
||||
|
||||
ERROR:
|
||||
@@ -216,7 +216,7 @@ ERROR:
|
||||
lda #<FILE_NOT_FOUND
|
||||
ldx #>FILE_NOT_FOUND
|
||||
jsr PRINT
|
||||
beq :++ ; bra
|
||||
beq :++ ; Branch always
|
||||
: pha
|
||||
lda #<ERROR_NUMBER
|
||||
ldx #>ERROR_NUMBER
|
||||
@@ -230,5 +230,3 @@ ERROR:
|
||||
jsr MLI
|
||||
.byte QUIT_CALL
|
||||
.word QUIT_PARAM
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
24
libsrc/atmos/bashdr.s
Normal file
24
libsrc/atmos/bashdr.s
Normal file
@@ -0,0 +1,24 @@
|
||||
;
|
||||
; 2010-11-14, Ullrich von Bassewitz
|
||||
; 2014-09-06, Greg King
|
||||
;
|
||||
; This module supplies a small BASIC stub program that uses CALL
|
||||
; to jump to the machine-language code that follows it.
|
||||
;
|
||||
|
||||
; The following symbol is used by the linker config. file
|
||||
; to force this module to be included into the output file.
|
||||
.export __BASHDR__:abs = 1
|
||||
|
||||
|
||||
.segment "BASHDR"
|
||||
|
||||
.addr Next
|
||||
.word .version ; Line number
|
||||
.byte $BF,'#' ; CALL token, mark number as hexadecimal
|
||||
.byte <(Start >> 8 ) + '0' + (Start >> 8 > $09) * $07
|
||||
.byte <(Start >> 4 & $0F) + '0' + (Start >> 4 & $0F > $09) * $07
|
||||
.byte <(Start & $0F) + '0' + (Start & $0F > $09) * $07
|
||||
.byte $00 ; End of BASIC line
|
||||
Next: .addr $0000 ; BASIC program end marker
|
||||
Start:
|
||||
@@ -2,39 +2,18 @@
|
||||
; Startup code for cc65 (Oric version)
|
||||
;
|
||||
; By Debrune J<>r<EFBFBD>me <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
|
||||
; 2014-08-22, Greg King
|
||||
; 2015-01-09, Greg King
|
||||
;
|
||||
|
||||
.export _exit
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
.import initlib, donelib
|
||||
.import callmain, zerobss
|
||||
.import __RAM_START__, __RAM_SIZE__
|
||||
.import __ZPSAVE_LOAD__, __STACKSIZE__
|
||||
.import __RAM_START__, __RAM_SIZE__, __STACKSIZE__
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "atmos.inc"
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Oric tape header
|
||||
|
||||
.segment "TAPEHDR"
|
||||
|
||||
.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
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Place the startup code in a special segment.
|
||||
|
||||
@@ -52,7 +31,8 @@ L1: lda sp,x
|
||||
|
||||
jsr zerobss
|
||||
|
||||
; Unprotect screen columns 0 and 1.
|
||||
; Currently, color isn't supported on the text screen.
|
||||
; Unprotect screen columns 0 and 1 (where each line's color codes would sit).
|
||||
|
||||
lda STATUS
|
||||
sta stsave
|
||||
@@ -79,7 +59,7 @@ L1: lda sp,x
|
||||
|
||||
; Call the module destructors. This is also the exit() entry.
|
||||
|
||||
_exit: jsr donelib ; Run module destructors
|
||||
_exit: jsr donelib
|
||||
|
||||
; Restore the system stuff.
|
||||
|
||||
@@ -102,9 +82,23 @@ L2: lda zpsave,x
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "ZPSAVE"
|
||||
.segment "ZPSAVE1"
|
||||
|
||||
zpsave: .res zpspace
|
||||
zpsave:
|
||||
|
||||
; This padding is needed by a bug in the ROM.
|
||||
; (The CLOAD command starts BASIC's variables table on top of the last byte
|
||||
; that was loaded [instead of at the next address].)
|
||||
; This is overlaid on a buffer, so that it doesn't use extra space in RAM.
|
||||
|
||||
.byte 0
|
||||
|
||||
; The segments "ZPSAVE1" and "ZPSAVE2" always must be together.
|
||||
; They create a single object (the zpsave buffer).
|
||||
|
||||
.segment "ZPSAVE2"
|
||||
|
||||
.res zpspace - 1
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
|
||||
31
libsrc/atmos/tapehdr.s
Normal file
31
libsrc/atmos/tapehdr.s
Normal file
@@ -0,0 +1,31 @@
|
||||
;
|
||||
; Based on code by Debrune J<>r<EFBFBD>me <jede@oric.org>
|
||||
; 2015-01-08, Greg King
|
||||
;
|
||||
|
||||
; The following symbol is used by the linker config. file
|
||||
; to force this module to be included into the output file.
|
||||
.export __TAPEHDR__:abs = 1
|
||||
|
||||
; These symbols, also, come from the configuration file.
|
||||
.import __BASHDR_LOAD__, __ZPSAVE1_LOAD__, __AUTORUN__, __PROGFLAG__
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Oric cassette-tape header
|
||||
|
||||
.segment "TAPEHDR"
|
||||
|
||||
.byte $16, $16, $16 ; Sync bytes
|
||||
.byte $24 ; Beginning-of-header marker
|
||||
|
||||
.byte $00 ; $2B0
|
||||
.byte $00 ; $2AF
|
||||
.byte <__PROGFLAG__ ; $2AE Language flag ($00=BASIC, $80=machine code)
|
||||
.byte <__AUTORUN__ ; $2AD Auto-run flag ($C7=run, $00=only load)
|
||||
.dbyt __ZPSAVE1_LOAD__ ;$2AB Address of end of file
|
||||
.dbyt __BASHDR_LOAD__ ; $2A9 Address of start of file
|
||||
.byte $00 ; $2A8
|
||||
|
||||
; File name (a maximum of 17 characters), zero-terminated
|
||||
.asciiz .sprintf("%u", .time)
|
||||
@@ -1,9 +1,9 @@
|
||||
/*
|
||||
** Marc 'BlackJack' Rintsch, 06.03.2001
|
||||
**
|
||||
** unsigned int cbm_load(const char* name,
|
||||
** unsigned char device,
|
||||
** const unsigned char* data);
|
||||
** unsigned int __fastcall__ cbm_load(const char* name,
|
||||
** unsigned char device,
|
||||
** const unsigned char* data);
|
||||
*/
|
||||
|
||||
#include <cbm.h>
|
||||
@@ -11,7 +11,7 @@
|
||||
/* loads file "name" from given device to given address or to the load address
|
||||
** of the file if "data" is 0
|
||||
*/
|
||||
unsigned int cbm_load(const char* name, unsigned char device, void* data)
|
||||
unsigned int __fastcall__ cbm_load(const char* name, unsigned char device, void* data)
|
||||
{
|
||||
/* LFN is set to 0; but, it's not needed for loading
|
||||
** (BASIC V2 sets it to the value of the SA for LOAD).
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
** _afailed.c
|
||||
**
|
||||
** Ullrich von Bassewitz, 06.06.1998
|
||||
** 1998-06-06, Ullrich von Bassewitz
|
||||
** 2015-03-13, Greg King
|
||||
*/
|
||||
|
||||
|
||||
@@ -11,7 +12,7 @@
|
||||
|
||||
|
||||
|
||||
void _afailed (char* file, unsigned line)
|
||||
void __fastcall__ _afailed (char* file, unsigned line)
|
||||
{
|
||||
fprintf (stderr, "ASSERTION FAILED IN %s(%u)\n", file, line);
|
||||
exit (2);
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
struct outdesc;
|
||||
|
||||
/* Type of the function that is called to output data */
|
||||
typedef void (*outfunc) (struct outdesc* desc, const char* buf, unsigned count);
|
||||
typedef void __cdecl__ (* outfunc) (struct outdesc* desc, const char* buf, unsigned count);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
** bsearch.c
|
||||
**
|
||||
** Ullrich von Bassewitz, 17.06.1998
|
||||
** 1998-06-17, Ullrich von Bassewitz
|
||||
** 2015-06-21, Greg King
|
||||
*/
|
||||
|
||||
|
||||
@@ -11,7 +12,7 @@
|
||||
|
||||
|
||||
void* __fastcall__ bsearch (const void* key, const void* base, size_t n,
|
||||
size_t size, int (*cmp) (const void*, const void*))
|
||||
size_t size, int __fastcall__ (* cmp) (const void*, const void*))
|
||||
{
|
||||
int current;
|
||||
int result;
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
/*
|
||||
** qsort.c
|
||||
**
|
||||
** Ullrich von Bassewitz, 09.12.1998
|
||||
** 1998.12.09, Ullrich von Bassewitz
|
||||
** 2015-06-21, Greg King
|
||||
*/
|
||||
|
||||
|
||||
@@ -12,7 +13,7 @@
|
||||
|
||||
static void QuickSort (register unsigned char* Base, int Lo, int Hi,
|
||||
register size_t Size,
|
||||
int (*Compare)(const void*, const void*))
|
||||
int __fastcall__ (* Compare) (const void*, const void*))
|
||||
/* Internal recursive function. Works with ints, but this shouldn't be
|
||||
** a problem.
|
||||
*/
|
||||
@@ -52,7 +53,7 @@ static void QuickSort (register unsigned char* Base, int Lo, int Hi,
|
||||
|
||||
|
||||
void __fastcall__ qsort (void* base, size_t nmemb, size_t size,
|
||||
int (*compare)(const void*, const void*))
|
||||
int __fastcall__ (* compare) (const void*, const void*))
|
||||
/* Quicksort implementation */
|
||||
{
|
||||
if (nmemb > 1) {
|
||||
|
||||
@@ -33,7 +33,7 @@ ptr: .res 2 ; Points to output file
|
||||
; can ignore the passed pointer d, and access the data directly. While this
|
||||
; is not very clean, it gives better and shorter code.
|
||||
;
|
||||
; static void out (struct outdesc* d, const char* buf, unsigned count)
|
||||
; static void cdecl out (struct outdesc* d, const char* buf, unsigned count)
|
||||
; /* Routine used for writing */
|
||||
; {
|
||||
; register size_t cnt;
|
||||
@@ -56,7 +56,7 @@ out: ldy #5
|
||||
ldy #7
|
||||
jsr pushwysp ; Push count
|
||||
lda ptr
|
||||
ldx ptr+1
|
||||
ldx ptr+1
|
||||
jsr _fwrite
|
||||
sta ptr1 ; Save function result
|
||||
stx ptr1+1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
;
|
||||
; int vsnprintf (char* Buf, size_t size, const char* Format, va_list ap);
|
||||
; int __fastcall__ vsnprintf (char* Buf, size_t size, const char* Format, va_list ap);
|
||||
;
|
||||
; Ullrich von Bassewitz, 2009-09-26
|
||||
;
|
||||
@@ -130,7 +130,7 @@ L9: pla
|
||||
; ----------------------------------------------------------------------------
|
||||
; Callback routine used for the actual output.
|
||||
;
|
||||
; static void out (struct outdesc* d, const char* buf, unsigned count)
|
||||
; static void __cdecl__ out (struct outdesc* d, const char* buf, unsigned count)
|
||||
; /* Routine used for writing */
|
||||
;
|
||||
; Since we know, we're called with a pointer to our static outdesc structure,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 11.08.1998
|
||||
;
|
||||
; char* DbgMemDump (unsigend Addr, char* Buf, unsigned char Length);
|
||||
; char* __cdecl__ DbgMemDump (unsigend Addr, char* Buf, unsigned char Length);
|
||||
;
|
||||
|
||||
.export _DbgMemDump
|
||||
|
||||
153
libsrc/osic1p/bootstrap.s
Normal file
153
libsrc/osic1p/bootstrap.s
Normal file
@@ -0,0 +1,153 @@
|
||||
;
|
||||
; 2015-03-08, Greg King
|
||||
;
|
||||
|
||||
; When you want to create a program with the alternate file format,
|
||||
; add "-u __BOOT__" to the cl65/ld65 command line. Then, the linker
|
||||
; will import this symbol name; and, link this module at the front
|
||||
; of your program file.
|
||||
;
|
||||
.export __BOOT__:abs = 1
|
||||
|
||||
.import __RAM_START__, __RAM_SIZE__, __BSS_RUN__
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
load_addr := __RAM_START__
|
||||
load_size = __BSS_RUN__ - __RAM_START__
|
||||
ram_top := __RAM_START__ + __RAM_SIZE__
|
||||
|
||||
.segment "BOOT"
|
||||
|
||||
; If you want to change how this bootstrap loader works, then:
|
||||
; 1. edit this assembly source code,
|
||||
; 2. define the constant ASM (uncomment the line below),
|
||||
; 3. assemble this file (and, make a listing of that assembly),
|
||||
; 4. copy the listing's hex codes into the .byte lines below (notice that most
|
||||
; of the strings are followed by CR; it's required by the OS65V monitor)
|
||||
; (be sure to match the listing's lines against the .byte lines),
|
||||
; 5. undefine ASM (recomment the line),
|
||||
; 6. assemble this file, again,
|
||||
; 7. and, add the object file to "osic1p.lib".
|
||||
|
||||
;ASM = 1
|
||||
|
||||
.ifdef ASM
|
||||
|
||||
.include "osic1p.inc"
|
||||
.macpack generic
|
||||
|
||||
load := $08 ; private variables
|
||||
count := $0A
|
||||
|
||||
GETCHAR := $FFBF ; gets one character from ACIA
|
||||
|
||||
FIRSTVISC = $85 ; Offset of first visible character in video RAM
|
||||
LINEDIST = $20 ; Offset in video RAM between two lines
|
||||
|
||||
ldy #<$0000
|
||||
lda #<load_addr
|
||||
ldx #>load_addr
|
||||
sta load
|
||||
stx load+1
|
||||
lda #<load_size
|
||||
eor #$FF
|
||||
sta count ; store (-size - 1)
|
||||
lda #>load_size
|
||||
eor #$FF
|
||||
sta count+1
|
||||
|
||||
L1: inc count ; pre-count one's-complement upwards
|
||||
bnz L2
|
||||
inc count+1
|
||||
bze L3
|
||||
L2: jsr GETCHAR ; (doesn't change .Y)
|
||||
sta (load),y
|
||||
|
||||
; Show that the file is being loaded by rotating an arrow on the screen.
|
||||
;
|
||||
tya
|
||||
lsr a
|
||||
lsr a
|
||||
and #8 - 1
|
||||
ora #$10 ; eight arrow characters
|
||||
sta SCRNBASE + FIRSTVISC + 2 * LINEDIST + 11
|
||||
|
||||
iny
|
||||
bnz L1
|
||||
inc load+1
|
||||
bnz L1 ; branch always
|
||||
|
||||
L3: jmp load_addr
|
||||
|
||||
.else
|
||||
|
||||
.mac hex1 h
|
||||
.lobytes ((h) & $0F) + (((h) & $0F) > 9) * 7 + '0'
|
||||
.endmac
|
||||
|
||||
.mac hex2 h
|
||||
hex1 (h) >> 4
|
||||
hex1 (h) >> 0
|
||||
.endmac
|
||||
|
||||
.mac hex4 h
|
||||
hex2 >(h)
|
||||
hex2 <(h)
|
||||
.endmac
|
||||
|
||||
CR = $0D
|
||||
|
||||
.byte CR, CR
|
||||
.byte "." ; set an address
|
||||
hex4 ram_top ; put loader where stack will sit
|
||||
.byte "/" ; write bytes into RAM
|
||||
|
||||
; ASCII-coded hexadecimal translation of the above assembly code.
|
||||
; It was copied from the assembler listing.
|
||||
|
||||
.byte "A0", CR, "00", CR
|
||||
.byte "A9", CR
|
||||
hex2 <load_addr
|
||||
.byte CR, "A2", CR
|
||||
hex2 >load_addr
|
||||
.byte CR, "85", CR, "08", CR
|
||||
.byte "86", CR, "09", CR
|
||||
.byte "A9", CR
|
||||
hex2 <load_size
|
||||
.byte CR, "49", CR, "FF", CR
|
||||
.byte "85", CR, "0A", CR
|
||||
.byte "A9", CR
|
||||
hex2 >load_size
|
||||
.byte CR, "49", CR, "FF", CR
|
||||
.byte "85", CR, "0B", CR
|
||||
|
||||
.byte "E6", CR, "0A", CR
|
||||
.byte "D0", CR, "04", CR
|
||||
.byte "E6", CR, "0B", CR
|
||||
.byte "F0", CR, "16", CR
|
||||
.byte "20", CR, "BF", CR, "FF", CR
|
||||
.byte "91", CR, "08", CR
|
||||
|
||||
.byte "98", CR
|
||||
.byte "4A", CR
|
||||
.byte "4A", CR
|
||||
.byte "29", CR, "07", CR
|
||||
.byte "09", CR, "10", CR
|
||||
.byte "8D", CR, "D0", CR, "D0", CR
|
||||
|
||||
.byte "C8", CR
|
||||
.byte "D0", CR, "E6", CR
|
||||
.byte "E6", CR, "09", CR
|
||||
.byte "D0", CR, "E2", CR
|
||||
|
||||
.byte "4C", CR
|
||||
hex2 <load_addr
|
||||
.byte CR
|
||||
hex2 >load_addr
|
||||
|
||||
.byte CR, "."
|
||||
hex4 ram_top
|
||||
.byte "G" ; go to address
|
||||
|
||||
.endif
|
||||
29
libsrc/osic1p/cclear.s
Normal file
29
libsrc/osic1p/cclear.s
Normal file
@@ -0,0 +1,29 @@
|
||||
;
|
||||
; Copied from CBM implementation
|
||||
;
|
||||
; originally by:
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
;
|
||||
; void cclearxy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void cclear (unsigned char length);
|
||||
;
|
||||
|
||||
.export _cclearxy, _cclear
|
||||
.import popa, _gotoxy, cputdirect
|
||||
.importzp tmp1
|
||||
|
||||
_cclearxy:
|
||||
pha ; Save the length
|
||||
jsr popa ; Get y
|
||||
jsr _gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _cclear
|
||||
|
||||
_cclear:
|
||||
cmp #0 ; Is the length zero?
|
||||
beq L9 ; Jump if done
|
||||
sta tmp1
|
||||
L1: lda #' '
|
||||
jsr cputdirect ; Direct output
|
||||
dec tmp1
|
||||
bne L1
|
||||
L9: rts
|
||||
48
libsrc/osic1p/cgetc.s
Normal file
48
libsrc/osic1p/cgetc.s
Normal file
@@ -0,0 +1,48 @@
|
||||
;
|
||||
; char cgetc (void);
|
||||
;
|
||||
|
||||
.constructor initcgetc
|
||||
.export _cgetc
|
||||
.import cursor
|
||||
|
||||
.include "osic1p.inc"
|
||||
.include "extzp.inc"
|
||||
.include "zeropage.inc"
|
||||
|
||||
; Initialize one-character buffer that is filled by kbhit()
|
||||
initcgetc:
|
||||
lda #$00
|
||||
sta CHARBUF ; No character in buffer initially
|
||||
rts
|
||||
|
||||
; Input routine from 65V PROM MONITOR, show cursor if enabled
|
||||
_cgetc:
|
||||
lda CHARBUF ; character in buffer available?
|
||||
beq nobuffer
|
||||
tax ; save character in X
|
||||
lda #$00
|
||||
sta CHARBUF ; empty buffer
|
||||
beq restorex ; restore X and return
|
||||
nobuffer:
|
||||
lda cursor ; show cursor?
|
||||
beq nocursor
|
||||
ldy CURS_X
|
||||
lda (SCREEN_PTR),y ; fetch current character
|
||||
sta tmp1 ; save it
|
||||
lda #$A1 ; full white square
|
||||
sta (SCREEN_PTR),y ; store at cursor position
|
||||
nocursor:
|
||||
jsr INPUTC ; get input character in A
|
||||
ldx cursor
|
||||
beq done ; was cursor on?
|
||||
tax ; save A in X
|
||||
lda tmp1 ; fetch saved character
|
||||
ldy CURS_X
|
||||
sta (SCREEN_PTR),y ; store at cursor position
|
||||
|
||||
restorex:
|
||||
txa ; restore saved character from X
|
||||
done:
|
||||
ldx #$00 ; high byte of int return value
|
||||
rts
|
||||
29
libsrc/osic1p/chline.s
Normal file
29
libsrc/osic1p/chline.s
Normal file
@@ -0,0 +1,29 @@
|
||||
;
|
||||
; based on CBM implementation
|
||||
;
|
||||
; originally by:
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
;
|
||||
; void chlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void chline (unsigned char length);
|
||||
;
|
||||
|
||||
.export _chlinexy, _chline
|
||||
.import popa, _gotoxy, cputdirect
|
||||
.importzp tmp1
|
||||
|
||||
_chlinexy:
|
||||
pha ; Save the length
|
||||
jsr popa ; Get y
|
||||
jsr _gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length
|
||||
|
||||
_chline:
|
||||
cmp #0 ; Is the length zero?
|
||||
beq L9 ; Jump if done
|
||||
sta tmp1
|
||||
L1: lda #$94 ; Horizontal line, screen code
|
||||
jsr cputdirect ; Direct output
|
||||
dec tmp1
|
||||
bne L1
|
||||
L9: rts
|
||||
55
libsrc/osic1p/crt0.s
Normal file
55
libsrc/osic1p/crt0.s
Normal file
@@ -0,0 +1,55 @@
|
||||
; ---------------------------------------------------------------------------
|
||||
; crt0.s
|
||||
; ---------------------------------------------------------------------------
|
||||
;
|
||||
; Startup code for Ohio Scientific Challenger 1P
|
||||
|
||||
.export _init, _exit
|
||||
.import _main
|
||||
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
|
||||
.import __STACKSIZE__
|
||||
|
||||
.import zerobss, initlib, donelib
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "extzp.inc"
|
||||
.include "osic1p.inc"
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Place the startup code in a special segment
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; A little light 6502 housekeeping
|
||||
|
||||
_init: ldx #$FF ; Initialize stack pointer to $01FF
|
||||
txs
|
||||
cld ; Clear decimal mode
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Set cc65 argument stack pointer
|
||||
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||
sta sp
|
||||
lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||
sta sp+1
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Initialize memory storage
|
||||
|
||||
jsr zerobss ; Clear BSS segment
|
||||
jsr initlib ; Run constructors
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Call main()
|
||||
|
||||
jsr _main
|
||||
|
||||
; ---------------------------------------------------------------------------
|
||||
; Back from main (this is also the _exit entry):
|
||||
|
||||
_exit: jsr donelib ; Run destructors
|
||||
jmp RESET ; Display boot menu after program exit
|
||||
289
libsrc/osic1p/ctype.s
Normal file
289
libsrc/osic1p/ctype.s
Normal file
@@ -0,0 +1,289 @@
|
||||
;
|
||||
; Character specification table.
|
||||
;
|
||||
; Ullrich von Bassewitz, 02.06.1998
|
||||
; 2003-05-02, Greg King
|
||||
;
|
||||
; Copied from cbm/ctype.s
|
||||
|
||||
; The following 256-byte-wide table specifies attributes for the isxxx type
|
||||
; of functions. Doing it by a table means some overhead in space, but it
|
||||
; has major advantages:
|
||||
;
|
||||
; * It is fast. If it weren't for the slow parameter-passing of cc65,
|
||||
; one even could define C-language macroes for the isxxx functions
|
||||
; (as it usually is done, on other platforms).
|
||||
;
|
||||
; * It is highly portable. The only unportable part is the table itself;
|
||||
; all real code goes into the common library.
|
||||
;
|
||||
; * We save some code in the isxxx functions.
|
||||
|
||||
; This table is taken from Craig S. Bruce's technical docs. for the ACE OS.
|
||||
|
||||
.include "ctype.inc"
|
||||
|
||||
; The table is read-only, put it into the RODATA segment.
|
||||
|
||||
.rodata
|
||||
|
||||
__ctype:
|
||||
.byte CT_CTRL ; 0/00 ___rvs_@___
|
||||
.byte CT_CTRL ; 1/01 ___rvs_a___
|
||||
.byte CT_CTRL ; 2/02 ___rvs_b___
|
||||
.byte CT_CTRL ; 3/03 ___rvs_c___
|
||||
.byte CT_CTRL ; 4/04 ___rvs_d___
|
||||
.byte CT_CTRL ; 5/05 ___rvs_e___
|
||||
.byte CT_CTRL ; 6/06 ___rvs_f___
|
||||
.byte CT_CTRL ; 7/07 _BEL/rvs_g_
|
||||
.byte CT_CTRL ; 8/08 ___rvs_h___
|
||||
.byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB ; 9/09 _TAB/rvs_i_
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 10/0a _BOL/rvs_j_
|
||||
.byte CT_CTRL ; 11/0b ___rvs_k___
|
||||
.byte CT_CTRL ; 12/0c ___rvs_l___
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 13/0d _CR_/rvs_m_
|
||||
.byte CT_CTRL ; 14/0e ___rvs_n___
|
||||
.byte CT_CTRL ; 15/0f ___rvs_o___
|
||||
.byte CT_CTRL ; 16/10 ___rvs_p___
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 17/11 _VT_/rvs_q_
|
||||
.byte CT_CTRL ; 18/12 ___rvs_r___
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 19/13 HOME/rvs_s_
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 20/14 _BS_/rvs_t_
|
||||
.byte CT_CTRL ; 21/15 ___rvs_u___
|
||||
.byte CT_CTRL ; 22/16 ___rvs_v___
|
||||
.byte CT_CTRL ; 23/17 ___rvs_w___
|
||||
.byte CT_CTRL ; 24/18 ___rvs_x___
|
||||
.byte CT_CTRL ; 25/19 ___rvs_y___
|
||||
.byte CT_CTRL ; 26/1a ___rvs_z___
|
||||
.byte CT_CTRL ; 27/1b ___rvs_[___
|
||||
.byte CT_CTRL ; 28/1c ___rvs_\___
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 29/1d cursr-right
|
||||
.byte CT_CTRL ; 30/1e ___rvs_^___
|
||||
.byte CT_CTRL ; 31/1f _rvs_under_
|
||||
.byte CT_SPACE | CT_SPACE_TAB ; 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 CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
|
||||
.byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
|
||||
.byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
|
||||
.byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
|
||||
.byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
|
||||
.byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
|
||||
.byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
|
||||
.byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
|
||||
.byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
|
||||
.byte CT_DIGIT | CT_XDIGIT ; 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 CT_LOWER | CT_XDIGIT ; 65/41 _____a_____
|
||||
.byte CT_LOWER | CT_XDIGIT ; 66/42 _____b_____
|
||||
.byte CT_LOWER | CT_XDIGIT ; 67/43 _____c_____
|
||||
.byte CT_LOWER | CT_XDIGIT ; 68/44 _____d_____
|
||||
.byte CT_LOWER | CT_XDIGIT ; 69/45 _____e_____
|
||||
.byte CT_LOWER | CT_XDIGIT ; 70/46 _____f_____
|
||||
.byte CT_LOWER ; 71/47 _____g_____
|
||||
.byte CT_LOWER ; 72/48 _____h_____
|
||||
.byte CT_LOWER ; 73/49 _____i_____
|
||||
.byte CT_LOWER ; 74/4a _____j_____
|
||||
.byte CT_LOWER ; 75/4b _____k_____
|
||||
.byte CT_LOWER ; 76/4c _____l_____
|
||||
.byte CT_LOWER ; 77/4d _____m_____
|
||||
.byte CT_LOWER ; 78/4e _____n_____
|
||||
.byte CT_LOWER ; 79/4f _____o_____
|
||||
.byte CT_LOWER ; 80/50 _____p_____
|
||||
.byte CT_LOWER ; 81/51 _____q_____
|
||||
.byte CT_LOWER ; 82/52 _____r_____
|
||||
.byte CT_LOWER ; 83/53 _____s_____
|
||||
.byte CT_LOWER ; 84/54 _____t_____
|
||||
.byte CT_LOWER ; 85/55 _____u_____
|
||||
.byte CT_LOWER ; 86/56 _____v_____
|
||||
.byte CT_LOWER ; 87/57 _____w_____
|
||||
.byte CT_LOWER ; 88/58 _____x_____
|
||||
.byte CT_LOWER ; 89/59 _____y_____
|
||||
.byte CT_LOWER ; 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 _A`_grave__
|
||||
.byte $00 ; 97/61 _A'_acute__
|
||||
.byte $00 ; 98/62 _A^_circum_
|
||||
.byte $00 ; 99/63 _A~_tilde__
|
||||
.byte $00 ; 100/64 _A"_dieres_
|
||||
.byte $00 ; 101/65 _A__ring___
|
||||
.byte $00 ; 102/66 _AE________
|
||||
.byte $00 ; 103/67 _C,cedilla_
|
||||
.byte $00 ; 104/68 _E`_grave__
|
||||
.byte $00 ; 105/69 _E'_acute__
|
||||
.byte $00 ; 106/6a _E^_circum_
|
||||
.byte $00 ; 107/6b _E"_dieres_
|
||||
.byte $00 ; 108/6c _I`_grave__
|
||||
.byte $00 ; 109/6d _I'_acute__
|
||||
.byte $00 ; 110/6e _I^_circum_
|
||||
.byte $00 ; 111/6f _I"_dieres_
|
||||
.byte $00 ; 112/70 _D-_Eth_lr_
|
||||
.byte $00 ; 113/71 _N~_tilde__
|
||||
.byte $00 ; 114/72 _O`_grave__
|
||||
.byte $00 ; 115/73 _O'_acute__
|
||||
.byte $00 ; 116/74 _O^_circum_
|
||||
.byte $00 ; 117/75 _O~_tilde__
|
||||
.byte $00 ; 118/76 _O"_dieres_
|
||||
.byte $00 ; 119/77 __multiply_
|
||||
.byte $00 ; 120/78 _O/_slash__
|
||||
.byte $00 ; 121/79 _U`_grave__
|
||||
.byte $00 ; 122/7a _U'_acute__
|
||||
.byte $00 ; 123/7b _U^_circum_
|
||||
.byte $00 ; 124/7c _U"_dieres_
|
||||
.byte $00 ; 125/7d _Y'_acute__
|
||||
.byte $00 ; 126/7e _cap_thorn_
|
||||
.byte $00 ; 127/7f _Es-sed_B__
|
||||
|
||||
.byte CT_CTRL ; 128/80 __bullet___
|
||||
.byte CT_CTRL ; 129/81 __v_line___
|
||||
.byte CT_CTRL ; 130/82 __h_line___
|
||||
.byte CT_CTRL ; 131/83 ___cross___
|
||||
.byte CT_CTRL ; 132/84 _tl_corner_
|
||||
.byte CT_CTRL ; 133/85 _tr_corner_
|
||||
.byte CT_CTRL ; 134/86 _bl_corner_
|
||||
.byte CT_CTRL ; 135/87 _br_corner_
|
||||
.byte CT_CTRL ; 136/88 ___l_tee___
|
||||
.byte CT_CTRL ; 137/89 ___r_tee___
|
||||
.byte CT_CTRL ; 138/8a ___t_tee___
|
||||
.byte CT_CTRL ; 139/8b ___b_tee___
|
||||
.byte CT_CTRL ; 140/8c ___heart___
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 141/8d _CR/diamond
|
||||
.byte CT_CTRL ; 142/8e ___club____
|
||||
.byte CT_CTRL ; 143/8f ___spade___
|
||||
.byte CT_CTRL ; 144/90 _s_circle__
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 145/91 _cursor-up_
|
||||
.byte CT_CTRL ; 146/92 ___pound___
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 147/93 _CLS/check_
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 148/94 __INSert___
|
||||
.byte CT_CTRL ; 149/95 ____+/-____
|
||||
.byte CT_CTRL ; 150/96 __divide___
|
||||
.byte CT_CTRL ; 151/97 __degree___
|
||||
.byte CT_CTRL ; 152/98 _c_checker_
|
||||
.byte CT_CTRL ; 153/99 _f_checker_
|
||||
.byte CT_CTRL ; 154/9a _solid_sq__
|
||||
.byte CT_CTRL ; 155/9b __cr_char__
|
||||
.byte CT_CTRL ; 156/9c _up_arrow__
|
||||
.byte CT_CTRL | CT_OTHER_WS ; 157/9d cursor-left
|
||||
.byte CT_CTRL ; 158/9e _left_arro_
|
||||
.byte CT_CTRL ; 159/9f _right_arr_
|
||||
.byte CT_SPACE | CT_SPACE_TAB ; 160/a0 _req space_
|
||||
.byte $00 ; 161/a1 _!_invertd_
|
||||
.byte $00 ; 162/a2 ___cent____
|
||||
.byte $00 ; 163/a3 ___pound___
|
||||
.byte $00 ; 164/a4 __currency_
|
||||
.byte $00 ; 165/a5 ____yen____
|
||||
.byte $00 ; 166/a6 _|_broken__
|
||||
.byte $00 ; 167/a7 __section__
|
||||
.byte $00 ; 168/a8 __umulaut__
|
||||
.byte $00 ; 169/a9 _copyright_
|
||||
.byte $00 ; 170/aa __fem_ord__
|
||||
.byte $00 ; 171/ab _l_ang_quo_
|
||||
.byte $00 ; 172/ac ____not____
|
||||
.byte $00 ; 173/ad _syl_hyphn_
|
||||
.byte $00 ; 174/ae _registerd_
|
||||
.byte $00 ; 175/af _overline__
|
||||
.byte $00 ; 176/b0 __degrees__
|
||||
.byte $00 ; 177/b1 ____+/-____
|
||||
.byte $00 ; 178/b2 _2_supersc_
|
||||
.byte $00 ; 179/b3 _3_supersc_
|
||||
.byte $00 ; 180/b4 ___acute___
|
||||
.byte $00 ; 181/b5 ____mu_____
|
||||
.byte $00 ; 182/b6 _paragraph_
|
||||
.byte $00 ; 183/b7 __mid_dot__
|
||||
.byte $00 ; 184/b8 __cedilla__
|
||||
.byte $00 ; 185/b9 _1_supersc_
|
||||
.byte $00 ; 186/ba __mas_ord__
|
||||
.byte $00 ; 187/bb _r_ang_quo_
|
||||
.byte $00 ; 188/bc ____1/4____
|
||||
.byte $00 ; 189/bd ____1/2____
|
||||
.byte $00 ; 190/be ____3/4____
|
||||
.byte $00 ; 191/bf _?_invertd_
|
||||
|
||||
.byte $00 ; 192/c0 _____`_____
|
||||
.byte CT_UPPER | CT_XDIGIT ; 193/c1 _____A_____
|
||||
.byte CT_UPPER | CT_XDIGIT ; 194/c2 _____B_____
|
||||
.byte CT_UPPER | CT_XDIGIT ; 195/c3 _____C_____
|
||||
.byte CT_UPPER | CT_XDIGIT ; 196/c4 _____D_____
|
||||
.byte CT_UPPER | CT_XDIGIT ; 197/c5 _____E_____
|
||||
.byte CT_UPPER | CT_XDIGIT ; 198/c6 _____F_____
|
||||
.byte CT_UPPER ; 199/c7 _____G_____
|
||||
.byte CT_UPPER ; 200/c8 _____H_____
|
||||
.byte CT_UPPER ; 201/c9 _____I_____
|
||||
.byte CT_UPPER ; 202/ca _____J_____
|
||||
.byte CT_UPPER ; 203/cb _____K_____
|
||||
.byte CT_UPPER ; 204/cc _____L_____
|
||||
.byte CT_UPPER ; 205/cd _____M_____
|
||||
.byte CT_UPPER ; 206/ce _____N_____
|
||||
.byte CT_UPPER ; 207/cf _____O_____
|
||||
.byte CT_UPPER ; 208/d0 _____P_____
|
||||
.byte CT_UPPER ; 209/d1 _____Q_____
|
||||
.byte CT_UPPER ; 210/d2 _____R_____
|
||||
.byte CT_UPPER ; 211/d3 _____S_____
|
||||
.byte CT_UPPER ; 212/d4 _____T_____
|
||||
.byte CT_UPPER ; 213/d5 _____U_____
|
||||
.byte CT_UPPER ; 214/d6 _____V_____
|
||||
.byte CT_UPPER ; 215/d7 _____W_____
|
||||
.byte CT_UPPER ; 216/d8 _____X_____
|
||||
.byte CT_UPPER ; 217/d9 _____Y_____
|
||||
.byte CT_UPPER ; 218/da _____Z_____
|
||||
.byte $00 ; 219/db _____{_____
|
||||
.byte $00 ; 220/dc _____|_____
|
||||
.byte $00 ; 221/dd _____}_____
|
||||
.byte $00 ; 222/de _____~_____
|
||||
.byte $00 ; 223/df ___HOUSE___
|
||||
.byte $00 ; 224/e0 _a`_grave__
|
||||
.byte $00 ; 225/e1 _a'_acute__
|
||||
.byte $00 ; 226/e2 _a^_circum_
|
||||
.byte $00 ; 227/e3 _a~_tilde__
|
||||
.byte $00 ; 228/e4 _a"_dieres_
|
||||
.byte $00 ; 229/e5 _a__ring___
|
||||
.byte $00 ; 230/e6 _ae________
|
||||
.byte $00 ; 231/e7 _c,cedilla_
|
||||
.byte $00 ; 232/e8 _e`_grave__
|
||||
.byte $00 ; 233/e9 _e'_acute__
|
||||
.byte $00 ; 234/ea _e^_circum_
|
||||
.byte $00 ; 235/eb _e"_dieres_
|
||||
.byte $00 ; 236/ec _i`_grave__
|
||||
.byte $00 ; 237/ed _i'_acute__
|
||||
.byte $00 ; 238/ee _i^_circum_
|
||||
.byte $00 ; 239/ef _i"_dieres_
|
||||
.byte $00 ; 240/f0 _o^x_Eth_s_
|
||||
.byte $00 ; 241/f1 _n~_tilda__
|
||||
.byte $00 ; 242/f2 _o`_grave__
|
||||
.byte $00 ; 243/f3 _o'_acute__
|
||||
.byte $00 ; 244/f4 _o^_circum_
|
||||
.byte $00 ; 245/f5 _o~_tilde__
|
||||
.byte $00 ; 246/f6 _o"_dieres_
|
||||
.byte $00 ; 247/f7 __divide___
|
||||
.byte $00 ; 248/f8 _o/_slash__
|
||||
.byte $00 ; 249/f9 _u`_grave__
|
||||
.byte $00 ; 250/fa _u'_acute__
|
||||
.byte $00 ; 251/fb _u^_circum_
|
||||
.byte $00 ; 252/fc _u"_dieres_
|
||||
.byte $00 ; 253/fd _y'_acute__
|
||||
.byte $00 ; 254/fe _sm_thorn__
|
||||
.byte $00 ; 255/ff _y"_dieres_
|
||||
29
libsrc/osic1p/cvline.s
Normal file
29
libsrc/osic1p/cvline.s
Normal file
@@ -0,0 +1,29 @@
|
||||
;
|
||||
; based on CBM version
|
||||
; originally by:
|
||||
; Ullrich von Bassewitz, 08.08.1998
|
||||
;
|
||||
; void cvlinexy (unsigned char x, unsigned char y, unsigned char length);
|
||||
; void cvline (unsigned char length);
|
||||
;
|
||||
|
||||
.export _cvlinexy, _cvline
|
||||
.import popa, _gotoxy, putchar, newline
|
||||
.importzp tmp1
|
||||
|
||||
_cvlinexy:
|
||||
pha ; Save the length
|
||||
jsr popa ; Get y
|
||||
jsr _gotoxy ; Call this one, will pop params
|
||||
pla ; Restore the length and run into _cvline
|
||||
|
||||
_cvline:
|
||||
cmp #0 ; Is the length zero?
|
||||
beq L9 ; Jump if done
|
||||
sta tmp1
|
||||
L1: lda #$95 ; Vertical bar
|
||||
jsr putchar ; Write, no cursor advance
|
||||
jsr newline ; Advance cursor to next line
|
||||
dec tmp1
|
||||
bne L1
|
||||
L9: rts
|
||||
16
libsrc/osic1p/extra/screen-s3-32x28.s
Normal file
16
libsrc/osic1p/extra/screen-s3-32x28.s
Normal file
@@ -0,0 +1,16 @@
|
||||
;
|
||||
; Implementation of screen-layout related functions for Superboard ///
|
||||
;
|
||||
|
||||
.include "../osiscreen.inc"
|
||||
|
||||
S3_SCR_BASE := $D000 ; Base of Superboard /// video RAM
|
||||
S3_VRAM_SIZE = $0400 ; Size of Superboard /// video RAM (1 kB)
|
||||
S3_SCR_WIDTH = $20 ; Screen width
|
||||
S3_SCR_HEIGHT = $1C ; Screen height
|
||||
S3_SCR_FIRSTCHAR = $80 ; Offset of cursor position (0, 0) from base
|
||||
; of video RAM
|
||||
S3_SCROLL_DIST = $20 ; Memory distance for scrolling by one line
|
||||
|
||||
osi_screen_funcs S3_SCR_BASE, S3_VRAM_SIZE, S3_SCR_FIRSTCHAR, \
|
||||
S3_SCR_WIDTH, S3_SCR_HEIGHT, S3_SCROLL_DIST
|
||||
7
libsrc/osic1p/extzp.inc
Normal file
7
libsrc/osic1p/extzp.inc
Normal file
@@ -0,0 +1,7 @@
|
||||
;
|
||||
; Additional zero page locations for the Challenger 1P.
|
||||
;
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.globalzp CURS_X, CURS_Y, SCREEN_PTR, CHARBUF
|
||||
20
libsrc/osic1p/extzp.s
Normal file
20
libsrc/osic1p/extzp.s
Normal file
@@ -0,0 +1,20 @@
|
||||
;
|
||||
; Additional zero page locations for the Challenger 1P.
|
||||
; NOTE: The zeropage locations contained in this file get initialized
|
||||
; in the startup code, so if you change anything here, be sure to check
|
||||
; not only the linker config, but also the startup file.
|
||||
;
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.include "extzp.inc"
|
||||
|
||||
.segment "EXTZP" : zeropage
|
||||
|
||||
CURS_X: .res 1
|
||||
CURS_Y: .res 1
|
||||
SCREEN_PTR: .res 2
|
||||
CHARBUF: .res 1
|
||||
|
||||
; size 5
|
||||
; Adjust size of the ZP segment in osic1p.cfg if the size changes
|
||||
13
libsrc/osic1p/gotox.s
Normal file
13
libsrc/osic1p/gotox.s
Normal file
@@ -0,0 +1,13 @@
|
||||
;
|
||||
; copied from CBM implementation
|
||||
; originally by:
|
||||
; Ullrich von Bassewitz, 07.08.1998
|
||||
;
|
||||
; void gotox (unsigned char x);
|
||||
;
|
||||
.export _gotox
|
||||
.import plot
|
||||
.include "extzp.inc"
|
||||
|
||||
_gotox: sta CURS_X ; Set new position
|
||||
jmp plot ; And activate it
|
||||
17
libsrc/osic1p/gotoxy.s
Normal file
17
libsrc/osic1p/gotoxy.s
Normal file
@@ -0,0 +1,17 @@
|
||||
;
|
||||
; copied from CBM implementation
|
||||
;
|
||||
; originally by:
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
;
|
||||
; void gotoxy (unsigned char x, unsigned char y);
|
||||
;
|
||||
.export _gotoxy
|
||||
.import popa, plot
|
||||
.include "extzp.inc"
|
||||
|
||||
_gotoxy:
|
||||
sta CURS_Y ; Set Y
|
||||
jsr popa ; Get X
|
||||
sta CURS_X ; Set X
|
||||
jmp plot ; Set the cursor position
|
||||
13
libsrc/osic1p/gotoy.s
Normal file
13
libsrc/osic1p/gotoy.s
Normal file
@@ -0,0 +1,13 @@
|
||||
;
|
||||
; copied from CBM implementation
|
||||
; originally by:
|
||||
; Ullrich von Bassewitz, 0.08.1998
|
||||
;
|
||||
; void gotoy (unsigned char y);
|
||||
;
|
||||
.export _gotoy
|
||||
.import plot
|
||||
.include "extzp.inc"
|
||||
|
||||
_gotoy: sta CURS_Y ; Set the new position
|
||||
jmp plot ; And activate it
|
||||
47
libsrc/osic1p/kbhit.s
Normal file
47
libsrc/osic1p/kbhit.s
Normal file
@@ -0,0 +1,47 @@
|
||||
;
|
||||
; unsigned char kbhit (void);
|
||||
;
|
||||
; The method to detect a pressed key is based on the documentation in
|
||||
; "Section 3 Programmed Key Functions" in "The Challenger Character Graphics
|
||||
; Reference Manual"
|
||||
; We only want to return true for characters that can be returned by cgetc(),
|
||||
; but not for keys like <Shift> or <Ctrl>. Therefore a special handling is
|
||||
; needed for the first row. This is implemented by a bit mask that is stored
|
||||
; in tmp1 and that is set to zero after the first round.
|
||||
;
|
||||
|
||||
.export _kbhit
|
||||
.include "osic1p.inc"
|
||||
.include "extzp.inc"
|
||||
.include "zeropage.inc"
|
||||
|
||||
_kbhit:
|
||||
lda #%11011111 ; Mask for only checking the column for the
|
||||
sta tmp1 ; ESC key in the first keyboard row.
|
||||
|
||||
lda #%11111110 ; Mask for first keyboard row
|
||||
scan:
|
||||
sta KBD ; Select keyboard row
|
||||
tax ; Save A
|
||||
lda KBD ; Read keyboard columns
|
||||
ora tmp1 ; Mask out uninteresting keys (only relevant in
|
||||
; first row)
|
||||
cmp #$FF ; No keys pressed?
|
||||
bne keypressed
|
||||
lda #$00 ; For remaining rows no keys masked
|
||||
sta tmp1
|
||||
txa ; Restore A
|
||||
sec ; Want to shift in ones
|
||||
rol a ; Rotate row select to next bit position
|
||||
cmp #$FF ; Done?
|
||||
bne scan ; If not, continue
|
||||
lda #$00 ; Return false
|
||||
tax ; High byte of return is also zero
|
||||
sta CHARBUF ; No character in buffer
|
||||
rts
|
||||
keypressed:
|
||||
jsr INPUTC ; Get input character in A
|
||||
sta CHARBUF ; Save in buffer
|
||||
ldx #$00 ; High byte of return is always zero
|
||||
lda #$01 ; Return true
|
||||
rts
|
||||
20
libsrc/osic1p/oserror.s
Normal file
20
libsrc/osic1p/oserror.s
Normal file
@@ -0,0 +1,20 @@
|
||||
;
|
||||
; dummy implementation for Challenger 1P based on atmos implementation
|
||||
;
|
||||
; original by
|
||||
; Stefan Haubenthal, 2011-04-18
|
||||
;
|
||||
; int __fastcall__ _osmaperrno (unsigned char oserror);
|
||||
; /* Map a system specific error into a system independent code */
|
||||
;
|
||||
|
||||
.include "errno.inc"
|
||||
.export __osmaperrno
|
||||
|
||||
.proc __osmaperrno
|
||||
|
||||
lda #<EUNKNOWN
|
||||
ldx #>EUNKNOWN
|
||||
rts
|
||||
|
||||
.endproc
|
||||
4
libsrc/osic1p/osic1p.inc
Normal file
4
libsrc/osic1p/osic1p.inc
Normal file
@@ -0,0 +1,4 @@
|
||||
; Addresses
|
||||
INPUTC := $FD00 ; Input character from keyboard
|
||||
RESET := $FF00 ; Reset address, show boot prompt
|
||||
KBD := $DF00 ; Polled keyboard register
|
||||
184
libsrc/osic1p/osiscreen.inc
Normal file
184
libsrc/osic1p/osiscreen.inc
Normal file
@@ -0,0 +1,184 @@
|
||||
;
|
||||
; Macro definitions for screen layout modules
|
||||
;
|
||||
|
||||
.include "extzp.inc"
|
||||
|
||||
.linecont +
|
||||
|
||||
;
|
||||
; Internal function for screensize()
|
||||
;
|
||||
.macro osi_screensize ScrWidth, ScrHeight
|
||||
; Macro implementation of internal screensize
|
||||
; function for given width and height in
|
||||
; characters
|
||||
|
||||
.export screensize
|
||||
|
||||
.proc screensize
|
||||
ldx #ScrWidth
|
||||
ldy #ScrHeight
|
||||
rts
|
||||
.endproc
|
||||
.endmacro
|
||||
|
||||
;
|
||||
; void clrscr (void);
|
||||
;
|
||||
.macro osi_clrscr ScrBase, ScrRamSize
|
||||
|
||||
.export _clrscr
|
||||
|
||||
.proc _clrscr
|
||||
lda #<ScrBase ; Fill whole video RAM with blanks by calling
|
||||
ldx #>ScrBase ; memset appropriately
|
||||
jsr pushax
|
||||
|
||||
lda #' '
|
||||
ldx #$00
|
||||
jsr pushax
|
||||
|
||||
lda #<ScrRamSize
|
||||
ldx #>ScrRamSize
|
||||
jsr _memset
|
||||
|
||||
lda #$00 ; Cursor in upper left corner
|
||||
sta CURS_X
|
||||
sta CURS_Y
|
||||
|
||||
jmp plot ; Set the cursor position
|
||||
.endproc
|
||||
|
||||
.endmacro
|
||||
|
||||
;
|
||||
; cputc/cputcxy for Challenger 1P
|
||||
; Based on PET/CBM implementation
|
||||
;
|
||||
|
||||
.macro osi_cputfuncs ScrBase, ScrFirstChar, ScrWidth, ScrHeight, \
|
||||
ScrollDist, ScrLo, ScrHi
|
||||
|
||||
; Number of characters to move for scrolling
|
||||
; by one line
|
||||
ScrollLength = (ScrHeight - 1) * ScrollDist
|
||||
|
||||
;
|
||||
; void cputcxy (unsigned char x, unsigned char y, char c);
|
||||
; void cputc (char c);
|
||||
;
|
||||
.export _cputcxy, _cputc, cputdirect, putchar
|
||||
.export newline, plot
|
||||
|
||||
_cputcxy:
|
||||
pha ; Save C
|
||||
jsr popa ; Get Y
|
||||
jsr _gotoxy ; Set cursor, drop x
|
||||
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
|
||||
|
||||
cputdirect:
|
||||
jsr putchar ; Write the character to the screen
|
||||
|
||||
; Advance cursor position, register Y contains horizontal position after
|
||||
; putchar
|
||||
|
||||
cpy #(ScrWidth - 1) ; Check whether line is full
|
||||
bne L3
|
||||
jsr newline ; New line
|
||||
ldy #$FF ; + cr
|
||||
L3: iny
|
||||
sty CURS_X
|
||||
rts
|
||||
|
||||
newline:
|
||||
inc CURS_Y
|
||||
lda CURS_Y
|
||||
cmp #ScrHeight ; Screen height
|
||||
bne plot
|
||||
dec CURS_Y ; Bottom of screen reached, scroll
|
||||
|
||||
; Scroll destination address
|
||||
lda #<(ScrBase + ScrFirstChar)
|
||||
ldx #>(ScrBase + ScrFirstChar)
|
||||
jsr pushax
|
||||
|
||||
; Scroll source address
|
||||
lda #<(ScrBase + ScrFirstChar + ScrollDist)
|
||||
ldx #>(ScrBase + ScrFirstChar + ScrollDist)
|
||||
jsr pushax
|
||||
|
||||
; Number of characters to move
|
||||
lda #<ScrollLength
|
||||
ldx #>ScrollLength
|
||||
jsr _memmove
|
||||
|
||||
; Address of first character in last line
|
||||
; of screen
|
||||
lda #<(ScrBase + ScrFirstChar + ScrollLength)
|
||||
sta ptr1
|
||||
lda #>(ScrBase + ScrFirstChar + ScrollLength)
|
||||
sta ptr1+1
|
||||
|
||||
ldy #ScrWidth ; Fill last line with blanks
|
||||
lda #' '
|
||||
clrln: sta (ptr1),y
|
||||
dey
|
||||
bpl clrln
|
||||
|
||||
plot: ldy CURS_Y
|
||||
lda ScrLo,y
|
||||
sta SCREEN_PTR
|
||||
lda ScrHi,y
|
||||
sta SCREEN_PTR+1
|
||||
rts
|
||||
|
||||
; Write one character to the screen without doing anything else, return X
|
||||
; position in register Y
|
||||
|
||||
putchar:
|
||||
ldy CURS_X
|
||||
sta (SCREEN_PTR),y ; Set char
|
||||
rts
|
||||
|
||||
.endmacro
|
||||
|
||||
.macro osi_screen_funcs ScrBase, ScrRamSize, ScrFirstChar, \
|
||||
ScrWidth, ScrHeight, ScrollDist
|
||||
|
||||
.import popa, _gotoxy
|
||||
.import _memmove, _memset, pushax
|
||||
.importzp ptr1
|
||||
|
||||
.rodata
|
||||
|
||||
; Screen address tables - offset to real screen
|
||||
ScrTabLo:
|
||||
.repeat ScrHeight, I
|
||||
.byte <(ScrBase + ScrFirstChar + I * ScrollDist)
|
||||
.endrep
|
||||
|
||||
ScrTabHi:
|
||||
.repeat ScrHeight, I
|
||||
.byte >(ScrBase + ScrFirstChar + I * ScrollDist)
|
||||
.endrep
|
||||
|
||||
.code
|
||||
|
||||
osi_cputfuncs ScrBase, ScrFirstChar, ScrWidth, ScrHeight, \
|
||||
ScrollDist, ScrTabLo, ScrTabHi
|
||||
osi_screensize ScrWidth, ScrHeight
|
||||
osi_clrscr ScrBase, ScrRamSize
|
||||
|
||||
.endmacro
|
||||
16
libsrc/osic1p/screen-c1p-24x24.s
Normal file
16
libsrc/osic1p/screen-c1p-24x24.s
Normal file
@@ -0,0 +1,16 @@
|
||||
;
|
||||
; Implementation of screen-layout related functions for Challenger 1P
|
||||
;
|
||||
|
||||
.include "osiscreen.inc"
|
||||
|
||||
C1P_SCR_BASE := $D000 ; Base of C1P video RAM
|
||||
C1P_VRAM_SIZE = $0400 ; Size of C1P video RAM (1 kB)
|
||||
C1P_SCR_WIDTH = $18 ; Screen width
|
||||
C1P_SCR_HEIGHT = $18 ; Screen height
|
||||
C1P_SCR_FIRSTCHAR = $85 ; Offset of cursor position (0, 0) from base
|
||||
; of video RAM
|
||||
C1P_SCROLL_DIST = $20 ; Memory distance for scrolling by one line
|
||||
|
||||
osi_screen_funcs C1P_SCR_BASE, C1P_VRAM_SIZE, C1P_SCR_FIRSTCHAR, \
|
||||
C1P_SCR_WIDTH, C1P_SCR_HEIGHT, C1P_SCROLL_DIST
|
||||
14
libsrc/osic1p/wherex.s
Normal file
14
libsrc/osic1p/wherex.s
Normal file
@@ -0,0 +1,14 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Copied from cbm/wherex.s
|
||||
|
||||
; unsigned char wherex (void);
|
||||
;
|
||||
.export _wherex
|
||||
.include "extzp.inc"
|
||||
|
||||
.proc _wherex
|
||||
lda CURS_X
|
||||
ldx #$00
|
||||
rts
|
||||
.endproc
|
||||
14
libsrc/osic1p/wherey.s
Normal file
14
libsrc/osic1p/wherey.s
Normal file
@@ -0,0 +1,14 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 06.08.1998
|
||||
; Copied from cbm/wherey.s
|
||||
;
|
||||
; unsigned char wherey (void);
|
||||
;
|
||||
.export _wherey
|
||||
.include "extzp.inc"
|
||||
|
||||
.proc _wherey
|
||||
lda CURS_Y
|
||||
ldx #$00
|
||||
rts
|
||||
.endproc
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
#include <zlib.h>
|
||||
|
||||
int uncompress (char* dest, unsigned* destLen,
|
||||
const char* source, unsigned sourceLen)
|
||||
int __fastcall__ uncompress (char* dest, unsigned* destLen,
|
||||
const char* source, unsigned sourceLen)
|
||||
{
|
||||
unsigned len;
|
||||
unsigned char* ptr;
|
||||
|
||||
Reference in New Issue
Block a user