Removed (pretty inconsistently used) tab chars from source code base.

This commit is contained in:
Oliver Schmidt
2013-05-09 13:56:54 +02:00
parent 44fd1082ae
commit 85885001b1
1773 changed files with 62864 additions and 62868 deletions

View File

@@ -4,7 +4,7 @@
; Screen size variables
;
.export screensize
.export screensize
.import SCREEN
screensize = SCREEN

View File

@@ -5,65 +5,65 @@
; void reset_brk (void);
;
.export _set_brk, _reset_brk
.destructor _reset_brk
.export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
.export _set_brk, _reset_brk
.destructor _reset_brk
.export _brk_a, _brk_x, _brk_y, _brk_sr, _brk_pc
.include "plus4.inc"
.include "plus4.inc"
.bss
_brk_a: .res 1
_brk_x: .res 1
_brk_y: .res 1
_brk_sr: .res 1
_brk_pc: .res 2
_brk_a: .res 1
_brk_x: .res 1
_brk_y: .res 1
_brk_sr: .res 1
_brk_pc: .res 2
oldvec: .res 2 ; Old vector
oldvec: .res 2 ; Old vector
.data
uservec: jmp $FFFF ; Patched at runtime
uservec: jmp $FFFF ; Patched at runtime
.code
; Set the break vector
.proc _set_brk
.proc _set_brk
sta uservec+1
stx uservec+2 ; Set the user vector
sta uservec+1
stx uservec+2 ; Set the user vector
lda oldvec
ora oldvec+1 ; Did we save the vector already?
bne L1 ; Jump if we installed the handler already
lda oldvec
ora oldvec+1 ; Did we save the vector already?
bne L1 ; Jump if we installed the handler already
lda BRKVec
sta oldvec
lda BRKVec+1
sta oldvec+1 ; Save the old vector
lda BRKVec
sta oldvec
lda BRKVec+1
sta oldvec+1 ; Save the old vector
L1: lda #<brk_handler ; Set the break vector to our routine
ldx #>brk_handler
sta BRKVec
stx BRKVec+1
rts
L1: lda #<brk_handler ; Set the break vector to our routine
ldx #>brk_handler
sta BRKVec
stx BRKVec+1
rts
.endproc
; Reset the break vector
.proc _reset_brk
.proc _reset_brk
lda oldvec
ldx oldvec+1
beq @L9 ; Jump if vector not installed
sta BRKVec
stx BRKVec+1
lda #$00
sta oldvec ; Clear the old vector
stx oldvec+1
@L9: rts
lda oldvec
ldx oldvec+1
beq @L9 ; Jump if vector not installed
sta BRKVec
stx BRKVec+1
lda #$00
sta oldvec ; Clear the old vector
stx oldvec+1
@L9: rts
.endproc
@@ -71,37 +71,37 @@ L1: lda #<brk_handler ; Set the break vector to our routine
; Break handler, called if a break occurs
.proc brk_handler
.proc brk_handler
pla
sta _brk_y
pla
sta _brk_x
pla
sta _brk_a
pla
and #$EF ; Clear break bit
sta _brk_sr
pla ; PC low
sec
sbc #2 ; Point to start of brk
sta _brk_pc
pla ; PC high
sbc #0
sta _brk_pc+1
pla
sta _brk_y
pla
sta _brk_x
pla
sta _brk_a
pla
and #$EF ; Clear break bit
sta _brk_sr
pla ; PC low
sec
sbc #2 ; Point to start of brk
sta _brk_pc
pla ; PC high
sbc #0
sta _brk_pc+1
jsr uservec ; Call the user's routine
jsr uservec ; Call the user's routine
lda _brk_pc+1
pha
lda _brk_pc
pha
lda _brk_sr
pha
ldx _brk_x
ldy _brk_y
lda _brk_a
rti ; Jump back...
lda _brk_pc+1
pha
lda _brk_pc
pha
lda _brk_sr
pha
ldx _brk_x
ldy _brk_y
lda _brk_a
rti ; Jump back...
.endproc

View File

@@ -4,82 +4,82 @@
; char cgetc (void);
;
.export _cgetc
.import cursor
.export _cgetc
.import cursor
.include "plus4.inc"
.include "plus4.inc"
; --------------------------------------------------------------------------
_cgetc: lda KEY_COUNT ; Get number of characters
ora FKEY_COUNT ; Or with number of function key chars
bne L2 ; Jump if there are already chars waiting
_cgetc: lda KEY_COUNT ; Get number of characters
ora FKEY_COUNT ; Or with number of function key chars
bne L2 ; Jump if there are already chars waiting
; Switch on the cursor if needed
ldy CURS_X
lda (CRAM_PTR),y ; Get current char
pha ; And save it
lda CHARCOLOR
sta (CRAM_PTR),y
ldy CURS_X
lda (CRAM_PTR),y ; Get current char
pha ; And save it
lda CHARCOLOR
sta (CRAM_PTR),y
lda cursor
beq L1 ; Jump if no cursor
tya
clc
adc SCREEN_PTR
sta TED_CURSLO
lda SCREEN_PTR+1
adc #$00
sbc #$0B ; + carry = $C00 (screen address)
sta TED_CURSHI
lda cursor
beq L1 ; Jump if no cursor
tya
clc
adc SCREEN_PTR
sta TED_CURSLO
lda SCREEN_PTR+1
adc #$00
sbc #$0B ; + carry = $C00 (screen address)
sta TED_CURSHI
L1: lda KEY_COUNT
ora FKEY_COUNT
beq L1
pla
sta (CRAM_PTR),y
lda #$ff
sta TED_CURSLO ; Cursor off
sta TED_CURSHI
L1: lda KEY_COUNT
ora FKEY_COUNT
beq L1
pla
sta (CRAM_PTR),y
lda #$ff
sta TED_CURSLO ; Cursor off
sta TED_CURSHI
L2: jsr KBDREAD ; Read char and return in A
ldx #0
rts
L2: jsr KBDREAD ; Read char and return in A
ldx #0
rts
; --------------------------------------------------------------------------
; Make the function keys return function key codes instead of the current
; strings so the program will see and may handle them.
; Undo this change when the program ends
.constructor initkbd
.destructor donekbd
.constructor initkbd
.destructor donekbd
.segment "INIT"
.proc initkbd
.proc initkbd
ldy #15
@L1: lda fnkeys,y
sta FKEY_SPACE,y
dey
bpl @L1
rts
ldy #15
@L1: lda fnkeys,y
sta FKEY_SPACE,y
dey
bpl @L1
rts
.endproc
.code
.proc donekbd
.proc donekbd
ldx #$39 ; Copy the original function keys
@L1: lda FKEY_ORIG,x
sta FKEY_SPACE,x
dex
bpl @L1
rts
ldx #$39 ; Copy the original function keys
@L1: lda FKEY_ORIG,x
sta FKEY_SPACE,x
dex
bpl @L1
rts
.endproc
@@ -87,6 +87,6 @@ L2: jsr KBDREAD ; Read char and return in A
; Function key table, readonly
.rodata
fnkeys: .byte $01, $01, $01, $01, $01, $01, $01, $01
.byte 133, 137, 134, 138, 135, 139, 136, 140
fnkeys: .byte $01, $01, $01, $01, $01, $01, $01, $01
.byte 133, 137, 134, 138, 135, 139, 136, 140

View File

@@ -4,11 +4,11 @@
; void clrscr (void);
;
.export _clrscr
.export _clrscr
.include "plus4.inc"
.include "plus4.inc"
_clrscr = CLRSCR
_clrscr = CLRSCR

View File

@@ -6,28 +6,28 @@
; unsigned char __fastcall__ bordercolor (unsigned char color);
;
.export _textcolor, _bgcolor, _bordercolor
.export _textcolor, _bgcolor, _bordercolor
.include "plus4.inc"
.include "plus4.inc"
_textcolor:
ldx CHARCOLOR ; get old value
sta CHARCOLOR ; set new value
txa
rts
ldx CHARCOLOR ; get old value
sta CHARCOLOR ; set new value
txa
rts
_bgcolor:
ldx TED_BGCOLOR ; get old value
sta TED_BGCOLOR ; set new value
txa
rts
ldx TED_BGCOLOR ; get old value
sta TED_BGCOLOR ; set new value
txa
rts
_bordercolor:
ldx TED_BORDERCOLOR ; get old value
sta TED_BORDERCOLOR ; set new value
txa
rts
ldx TED_BORDERCOLOR ; get old value
sta TED_BORDERCOLOR ; set new value
txa
rts

View File

@@ -4,7 +4,7 @@
; Low level stuff for screen output/console input
;
.exportzp CURS_X, CURS_Y
.exportzp CURS_X, CURS_Y
.include "plus4.inc"
.include "plus4.inc"

View File

@@ -5,45 +5,45 @@
; void cputc (char c);
;
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.export _cputcxy, _cputc, cputdirect, putchar
.export newline, plot
.import popa, _gotoxy
.import PLOT
.include "plus4.inc"
.include "plus4.inc"
_cputcxy:
pha ; Save C
jsr popa ; Get Y
jsr _gotoxy ; Set cursor, drop x
pla ; Restore C
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
_cputc: cmp #$0A ; CR?
bne L1
lda #0
sta CURS_X
beq plot ; Recalculate pointers
L1: cmp #$0D ; LF?
beq newline ; 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
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
jsr putchar ; Write the character to the screen
; Advance cursor position
@@ -57,39 +57,39 @@ 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
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 #$7E ; PI?
bne L11
lda #$5E ; Load screen code for PI
bne cputdirect
L11: ora #$40
bne cputdirect
L10: and #$7F
cmp #$7E ; PI?
bne L11
lda #$5E ; Load screen code for PI
bne cputdirect
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
plot: ldy CURS_X
ldx CURS_Y
clc
jmp PLOT ; Set the new cursor
@@ -97,9 +97,9 @@ plot: ldy CURS_X
; position in Y
putchar:
ora RVS ; Set revers bit
ldy CURS_X
sta (SCREEN_PTR),y ; Set char
lda CHARCOLOR
sta (CRAM_PTR),y ; Set color
rts
ora RVS ; Set revers bit
ldy CURS_X
sta (SCREEN_PTR),y ; Set char
lda CHARCOLOR
sta (CRAM_PTR),y ; Set color
rts

View File

@@ -5,97 +5,97 @@
; things are similar here, and we even use the plus4.inc include file.
;
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib
.import callmain, zerobss
.import MEMTOP, RESTOR, BSOUT, CLRCH
.importzp ST
.export _exit
.export __STARTUP__ : absolute = 1 ; Mark as startup
.import initlib, donelib
.import callmain, zerobss
.import MEMTOP, RESTOR, BSOUT, CLRCH
.importzp ST
.include "zeropage.inc"
.include "plus4.inc"
.include "zeropage.inc"
.include "plus4.inc"
; ------------------------------------------------------------------------
; Startup code
.segment "STARTUP"
.segment "STARTUP"
Start:
; Save the zero page locations we need
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x
dex
bpl L1
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x
dex
bpl L1
; Switch to second charset
lda #14
jsr BSOUT
lda #14
jsr BSOUT
; Clear the BSS data
jsr zerobss
jsr zerobss
; Save system stuff and setup the stack
tsx
stx spsave ; save system stk ptr
tsx
stx spsave ; save system stk ptr
sec
jsr MEMTOP ; Get top memory
cpy #$80 ; We can only use the low 32K :-(
bcc MemOk
ldy #$80
ldx #$00
MemOk: stx sp
sty sp+1 ; set argument stack ptr
sec
jsr MEMTOP ; Get top memory
cpy #$80 ; We can only use the low 32K :-(
bcc MemOk
ldy #$80
ldx #$00
MemOk: stx sp
sty sp+1 ; set argument stack ptr
; Call module constructors
jsr initlib
jsr initlib
; Push arguments and call main()
jsr callmain
jsr callmain
; Call module destructors. This is also the _exit entry.
_exit: pha ; Save the return code on stack
jsr donelib ; Run module destructors
_exit: pha ; Save the return code on stack
jsr donelib ; Run module destructors
; Copy back the zero page stuff
ldx #zpspace-1
L2: lda zpsave,x
sta sp,x
dex
bpl L2
ldx #zpspace-1
L2: lda zpsave,x
sta sp,x
dex
bpl L2
; Store the return code into ST
pla
sta ST
pla
sta ST
; Restore the stack pointer
ldx spsave
txs
ldx spsave
txs
; Back to BASIC
rts
rts
; ------------------------------------------------------------------------
.segment "ZPSAVE"
.segment "ZPSAVE"
zpsave: .res zpspace
zpsave: .res zpspace
; ------------------------------------------------------------------------
.bss
spsave: .res 1
spsave: .res 1

View File

@@ -2,6 +2,6 @@
; Oliver Schmidt, 2010-02-14
;
.include "c16.inc"
.include "c16.inc"
.exportzp devnum := DEVNUM
.exportzp devnum := DEVNUM

View File

@@ -5,11 +5,11 @@
; Ullrich von Bassewitz, 2003-12-15
;
.include "zeropage.inc"
.include "zeropage.inc"
.include "em-kernel.inc"
.include "em-kernel.inc"
.include "em-error.inc"
.include "plus4.inc"
.include "plus4.inc"
.macpack generic
@@ -22,7 +22,7 @@
; Driver signature
.byte $65, $6d, $64 ; "emd"
.byte EMD_API_VERSION ; EM API version number
.byte EMD_API_VERSION ; EM API version number
; Jump table.
@@ -32,13 +32,13 @@
.word MAP
.word USE
.word COMMIT
.word COPYFROM
.word COPYFROM
.word COPYTO
; ------------------------------------------------------------------------
; Constants
BASE = $8000
BASE = $8000
; ------------------------------------------------------------------------
; Data.
@@ -63,7 +63,7 @@ INSTALL:
; $8000 up to MEMTOP
sec
jsr $FF99 ; MEMTOP: Get top memory into Y/X
jsr $FF99 ; MEMTOP: Get top memory into Y/X
tya
sub #>BASE ; Low 32 K are used
bcc nomem
@@ -104,17 +104,17 @@ PAGECOUNT:
; by the driver.
;
MAP: sta curpage ; Remember the new page
MAP: sta curpage ; Remember the new page
add #>BASE
sta ptr1+1
ldy #$00
sty ptr1
sta ptr1+1
ldy #$00
sty ptr1
lda #<window
sta ptr2
lda #>window
sta ptr2+1
lda #<window
sta ptr2
lda #>window
sta ptr2+1
; Transfer one page
@@ -137,18 +137,18 @@ USE: sta curpage ; Remember the page
; ------------------------------------------------------------------------
; COMMIT: Commit changes in the memory window to extended storage.
COMMIT: lda curpage ; Get the current page
COMMIT: lda curpage ; Get the current page
bmi done ; Jump if no page mapped
add #>BASE
sta ptr2+1
ldy #$00
sty ptr2
sta ptr2+1
ldy #$00
sty ptr2
lda #<window
sta ptr1
lda #>window
sta ptr1+1
lda #<window
sta ptr1
lda #>window
sta ptr1+1
; Transfer one page. Y must be zero on entry. Because we bank out the
; kernal, we will run the routine with interrupts disabled but leave
@@ -158,11 +158,11 @@ transfer:
sei
sta ENABLE_RAM
.repeat 8
lda (ptr1),y
sta (ptr2),y
.repeat 8
lda (ptr1),y
sta (ptr2),y
iny
.endrepeat
.endrepeat
sta ENABLE_ROM
cli
@@ -225,8 +225,8 @@ common: ldy #EM_COPY::COUNT+1
; Transfer the bytes in the last page
ldy #$00
@L3: lda (ptr1),y
sta (ptr2),y
@L3: lda (ptr1),y
sta (ptr2),y
iny
dex
bne @L3

View File

@@ -6,7 +6,7 @@
;
.include "plus4.inc"
.include "get_tv.inc"
.include "get_tv.inc"
;--------------------------------------------------------------------------
@@ -14,7 +14,7 @@
.proc _get_tv
ldx #TV::PAL ; Assume PAL
ldx #TV::PAL ; Assume PAL
bit TED_MULTI1 ; Test bit 6
bvc pal
dex ; NTSC

View File

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

View File

@@ -5,5 +5,5 @@
; Ullrich von Bassewitz, 2002-12-21
;
.include "../../plus4/joy/plus4-stdjoy.s"
.include "../../plus4/joy/plus4-stdjoy.s"

View File

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

View File

@@ -6,9 +6,9 @@
; const char joy_stddrv[];
;
.export _joy_stddrv
.export _joy_stddrv
.rodata
_joy_stddrv: .asciiz "c16-stdjoy.joy"
_joy_stddrv: .asciiz "c16-stdjoy.joy"

View File

@@ -4,16 +4,16 @@
; unsigned char kbhit (void);
;
.export _kbhit
.export _kbhit
.include "plus4.inc"
.include "plus4.inc"
.proc _kbhit
ldx #0 ; High byte of return is always zero
lda KEY_COUNT ; Get number of characters
ora FKEY_COUNT ; Or with number of chars from function keys
lda KEY_COUNT ; Get number of characters
ora FKEY_COUNT ; Or with number of chars from function keys
beq L9
lda #1
L9: rts

View File

@@ -7,8 +7,8 @@
.export CLOSE
.proc CLOSE
clc ; Force C64 compatible behaviour
jmp $FFC3 ; Call the ROM routine
clc ; Force C64 compatible behaviour
jmp $FFC3 ; Call the ROM routine
.endproc

View File

@@ -47,43 +47,43 @@
;-----------------------------------------------------------------------------
; All functions are available in the kernal jump table
CINT = $FF81
IOINIT = $FF84
RAMTAS = $FF87
RESTOR = $FF8A
VECTOR = $FF8D
SETMSG = $FF90
SECOND = $FF93
TKSA = $FF96
MEMTOP = $FF99
MEMBOT = $FF9C
SCNKEY = $FF9F
SETTMO = $FFA2
ACPTR = $FFA5
CIOUT = $FFA8
UNTLK = $FFAB
UNLSN = $FFAE
LISTEN = $FFB1
TALK = $FFB4
READST = $FFB7
SETLFS = $FFBA
SETNAM = $FFBD
OPEN = $FFC0
;CLOSE = $FFC3
CHKIN = $FFC6
CKOUT = $FFC9
CLRCH = $FFCC
BASIN = $FFCF
BSOUT = $FFD2
LOAD = $FFD5
SAVE = $FFD8
SETTIM = $FFDB
RDTIM = $FFDE
STOP = $FFE1
GETIN = $FFE4
CLALL = $FFE7
UDTIM = $FFEA
SCREEN = $FFED
PLOT = $FFF0
IOBASE = $FFF3
CINT = $FF81
IOINIT = $FF84
RAMTAS = $FF87
RESTOR = $FF8A
VECTOR = $FF8D
SETMSG = $FF90
SECOND = $FF93
TKSA = $FF96
MEMTOP = $FF99
MEMBOT = $FF9C
SCNKEY = $FF9F
SETTMO = $FFA2
ACPTR = $FFA5
CIOUT = $FFA8
UNTLK = $FFAB
UNLSN = $FFAE
LISTEN = $FFB1
TALK = $FFB4
READST = $FFB7
SETLFS = $FFBA
SETNAM = $FFBD
OPEN = $FFC0
;CLOSE = $FFC3
CHKIN = $FFC6
CKOUT = $FFC9
CLRCH = $FFCC
BASIN = $FFCF
BSOUT = $FFD2
LOAD = $FFD5
SAVE = $FFD8
SETTIM = $FFDB
RDTIM = $FFDE
STOP = $FFE1
GETIN = $FFE4
CLALL = $FFE7
UDTIM = $FFEA
SCREEN = $FFED
PLOT = $FFF0
IOBASE = $FFF3

View File

@@ -22,16 +22,16 @@
; - The "file-name" might be a path-name; don't copy the directory-components.
; - Add a control-character quoting mechanism.
.constructor initmainargs, 24
.import __argc, __argv
.constructor initmainargs, 24
.import __argc, __argv
.include "plus4.inc"
.include "plus4.inc"
MAXARGS = 10 ; Maximum number of arguments allowed
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; maximum length of command-name
MAXARGS = 10 ; Maximum number of arguments allowed
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; maximum length of command-name
; Get possible command-line arguments. Goes into the special INIT segment,
; which may be reused after the startup code is run
@@ -45,26 +45,26 @@ initmainargs:
; Because the buffer, that we're copying into, was zeroed out,
; we don't need to add a NUL character.
;
ldy FNAM_LEN
cpy #NAME_LEN + 1
bcc L1
ldy #NAME_LEN - 1 ; limit the length
L0: lda #FNAM ; Vector address
ldy FNAM_LEN
cpy #NAME_LEN + 1
bcc L1
ldy #NAME_LEN - 1 ; limit the length
L0: lda #FNAM ; Vector address
jsr FETCH ; Load byte from RAM
sta name,y
L1: dey
bpl L0
inc __argc ; argc always is equal to, at least, 1
sta name,y
L1: dey
bpl L0
inc __argc ; argc always is equal to, at least, 1
; Find the "rem" token.
;
ldx #0
L2: lda BASIC_BUF,x
beq done ; no "rem," no args.
inx
cmp #REM
bne L2
ldy #1 * 2
ldx #0
L2: lda BASIC_BUF,x
beq done ; no "rem," no args.
inx
cmp #REM
bne L2
ldy #1 * 2
; Find the next argument
@@ -90,11 +90,11 @@ setterm:sta term ; Set end of argument marker
; necessary.
txa ; Get low byte
sta argv,y ; argv[y]= &arg
iny
lda #>BASIC_BUF
sta argv,y
iny
sta argv,y ; argv[y]= &arg
iny
lda #>BASIC_BUF
sta argv,y
iny
inc __argc ; Found another arg
; Search for the end of the argument
@@ -121,21 +121,21 @@ argloop:lda BASIC_BUF,x
; (The last vector in argv[] already is NULL.)
done: lda #<argv
ldx #>argv
sta __argv
stx __argv + 1
rts
done: lda #<argv
ldx #>argv
sta __argv
stx __argv + 1
rts
; These arrays are zeroed before initmainargs is called.
; char name[16+1];
; char name[16+1];
; char* argv[MAXARGS+1]={name};
;
.bss
term: .res 1
name: .res NAME_LEN + 1
term: .res 1
name: .res NAME_LEN + 1
.data
argv: .addr name
.res MAXARGS * 2
.res MAXARGS * 2

View File

@@ -5,10 +5,10 @@
; /* Initialize the random number generator */
;
.export __randomize
.import _srand
.export __randomize
.import _srand
.include "plus4.inc"
.include "plus4.inc"
__randomize:
ldx TED_VLINELO ; Use TED rasterline as high byte

View File

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

View File

@@ -2,4 +2,4 @@
; Oliver Schmidt, 2012-09-30
;
.exportzp ST := $90 ; IEC status byte
.exportzp ST := $90 ; IEC status byte

View File

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