;
; 2003-03-07, Ullrich von Bassewitz
; 2011-01-28, Stefan Haubenthal
-; 2013-12-22, Greg King
+; 2014-09-10, Greg King
;
-; Setup arguments for main
+; Set up arguments for main
;
.constructor initmainargs, 24
txa ; Get low byte
add #<args
sta argv,y ; argv[y]= &arg
- lda #>0
+ lda #>$0000
adc #>args
sta argv+1,y
iny
; A contains the terminating character. To make the argument a valid C string,
; replace the terminating character by a zero.
- lda #0
+ lda #$00
sta args-1,x
; Check if the maximum number of command line arguments is reached. If not,
.data
argv: .addr name
- .res MAXARGS * 2, 0
+ .res MAXARGS * 2, $00
; Graphics driver for the 228x200x3 palette mode on the Atmos
;
; Stefan Haubenthal <polluks@sdf.lonestar.org>
-; 2013-07-15, Greg King <gregdk@users.sf.net>
+; 2014-09-10, Greg King <gregdk@users.sf.net>
;
.include "zeropage.inc"
lda X1
add #2 * XSIZE ; Skip screen attribute columns
sta PARAM1
- lda #0
+ lda #>$0000
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
sta PARAM1
lda Y1
sta PARAM2
- lda #0
+ lda #>$0000
sta PARAM1+1
sta PARAM2+1
jsr POINT
lda PARAM1
and #%00000001
- ldx #0
+ ldx #>$0000
rts
; ------------------------------------------------------------------------
sta PARAM2+1
lda MODE
sta PARAM3
- ldx #>0
+ ldx #>$0000
stx PARAM3+1
jmp DRAW
; ------------------------------------------------------------------------
; TEXTSTYLE: Set the style used when calling OUTTEXT. Text scaling in the x
-; and y directions is passend in X/Y, the text direction is passed in A.
+; and y directions is passed in X/Y, the text direction is passed in A.
;
; Must set an error code: NO
;
; ------------------------------------------------------------------------
-; OUTTEXT: Output text at X/Y = ptr1/ptr2 using the current color and the
+; OUTTEXT: Output text at x/y = ptr1/ptr2, using the current color and the
; current text style. The text to output is given as a zero-terminated
; string with its address in ptr3.
;
; Graphics driver for the 240x200x2 monochrome mode on the Atmos
;
; Stefan Haubenthal <polluks@sdf.lonestar.org>
-; 2013-07-16, Greg King <gregdk@users.sf.net>
+; 2014-09-10, Greg King <gregdk@users.sf.net>
;
.include "zeropage.inc"
mymode: sta PARAM3
lda X1
sta PARAM1
- lda #0
+ lda #>$0000
sta PARAM1+1
sta PARAM2+1
sta PARAM3+1
sta PARAM1
lda Y1
sta PARAM2
- lda #0
+ lda #>$0000
sta PARAM1+1
sta PARAM2+1
jsr POINT
lda PARAM1
and #%00000001
- ldx #0
+ ldx #>$0000
rts
; ------------------------------------------------------------------------
sta PARAM2+1
lda MODE
sta PARAM3
- ldx #>0
+ ldx #>$0000
stx PARAM3+1
jmp DRAW
.proc _toascii
; .X must be zero, on return.
- ldx #>0
+ ldx #>$0000
rts
.endproc
; Driver for the Inkwell Systems 170-C and 184-C lightpens.
;
; 2014-04-26, Christian Groessler
-; 2014-05-01, Greg King
+; 2014-09-10, Greg King
;
.include "zeropage.inc"
; Default Inkwell calibration.
; The first number is the width of the left border;
; the second number is the actual calibration value.
+; See a comment below (at "Calculate the new X co-ordinate")
+; for the reason for the third number.
XOffset: .byte (24 + 24) / 2 ; x-offset
; Because it's called via "rts", we must decrement it by one.
iny
lda old_irq
- sub #<1
+ sub #<$0001
sta (ptr3),y
iny
lda old_irq+1
- sbc #>1
+ sbc #>$0001
sta (ptr3),y
cli
BUTTONS:
lda Buttons
- ldx #>0
+ ldx #>$0000
; Make the lightpen buttons look like a 1351 mouse.
sub #50
tay ; Remember low byte
- ldx #>0
+ ldx #>$0000
; Limit the Y co-ordinate to the bounding box.
asl a
tay ; Remember low byte
- lda #>0
+ lda #>$0000
rol a
tax ; Remember high byte
;
; Driver for the Inkwell Systems 170-C and 184-C lightpens.
;
-; 2013-07-01, Greg King
+; 2014-09-10, Greg King
;
.include "zeropage.inc"
; Default Inkwell calibration.
; The first number is the width of the left border;
; the second number is the actual calibration value.
+; See a comment below (at "Calculate the new X co-ordinate")
+; for the reason for the third number.
XOffset: .byte (24 + 24) / 2 ; x-offset
BUTTONS:
lda Buttons
- ldx #>0
+ ldx #>$0000
; Make the lightpen buttons look like a 1351 mouse.
sub #50
tay ; Remember low byte
- ldx #>0
+ ldx #>$0000
; Limit the Y co-ordinate to the bounding box.
asl a
tay ; Remember low byte
- lda #>0
+ lda #>$0000
rol a
tax ; Remember high byte
; 2003-03-07, Ullrich von Bassewitz,
; based on code from Stefan A. Haubenthal, <polluks@web.de>
; 2005-02-26, Ullrich von Bassewitz
-; 2014-04-02, Greg King
+; 2014-09-10, Greg King
;
; Scan a group of arguments that are in BASIC's input-buffer.
; Build an array that points to the beginning of each argument.
txa ; Get low byte
add #<BASIC_BUF
sta argv,y ; argv[y]= &arg
- lda #>0
+ lda #>$0000
adc #>BASIC_BUF
sta argv+1,y
iny
; A contains the terminating character. To make the argument a valid C string,
; replace the terminating character by a zero.
;
- lda #0
+ lda #$00
sta BASIC_BUF-1,x
; Check if the maximum number of command-line arguments is reached. If not,
.data
argv: .addr name
- .res MAXARGS * 2, 0
+ .res MAXARGS * 2, $00
;
; This driver reads only the main button on the 184-C.
;
-; 2013-09-05, Greg King
+; 2014-09-10, Greg King
;
.include "zeropage.inc"
; Default Inkwell calibration.
; The first number is the width of the left border;
; the second number is the actual calibration value.
+; See a comment below (at "Calculate the new X co-ordinate")
+; for the reason for the third number.
XOffset: .byte (24 + 24) / 2 ; x-offset
asl a ; ... to fire-button bit
eor #MOUSE_BTN_LEFT
and #MOUSE_BTN_LEFT
- ldx #>0
+ ldx #>$0000
rts
;----------------------------------------------------------------------------
sub #50
tay ; Remember low byte
- ldx #>0
+ ldx #>$0000
; Limit the Y co-ordinate to the bounding box.
asl a
tay ; Remember low byte
- lda #>0
+ lda #>$0000
rol a
tax ; Remember high byte
; Driver for a "joystick mouse".
;
; 2009-09-26, Ullrich von Bassewitz
-; 2013-09-05, Greg King
+; 2014-09-10, Greg King
;
.include "zeropage.inc"
; Bits go up when buttons go down.
eor #MOUSE_BTN_LEFT | MOUSE_BTN_RIGHT
- ldx #>0
+ ldx #>$0000
rts
;----------------------------------------------------------------------------
and #JOY::RIGHT << 4 ; Check RIGHT bit
bnz @Right
- lda #<-1
+ lda #<-$0001
tax
bnz @AddX ; Branch always
-@Right: lda #<1
- ldx #>1
+@Right: lda #<$0001
+ ldx #>$0001
; Calculate the new x co-ordinate (--> .YA).
and #JOY::UP << 4 ; Check UP bit
bze @Down
- lda #<-1
+ lda #<-$0001
tax
bnz @AddY
-@Down: lda #<1
- ldx #>1
+@Down: lda #<$0001
+ ldx #>$0001
; Calculate the new y co-ordinate (--> .YA).
; 2003-03-07, Ullrich von Bassewitz,
; based on code from Stefan A. Haubenthal, <polluks@web.de>
; 2005-02-26, Ullrich von Bassewitz
-; 2014-04-02, Greg King
+; 2014-09-10, Greg King
;
; Scan a group of arguments that are in BASIC's input-buffer.
; Build an array that points to the beginning of each argument.
txa ; Get low byte
add #<BASIC_BUF
sta argv,y ; argv[y]= &arg
- lda #>0
+ lda #>$0000
adc #>BASIC_BUF
sta argv+1,y
iny
; A contains the terminating character. To make the argument a valid C string,
; replace the terminating character by a zero.
;
- lda #0
+ lda #$00
sta BASIC_BUF-1,x
; Check if the maximum number of command-line arguments is reached. If not,
.data
argv: .addr name
- .res MAXARGS * 2, 0
+ .res MAXARGS * 2, $00
** _scanf.c
**
** (c) Copyright 2001-2005, Ullrich von Bassewitz <uz@cc65.org>
-** 2005-01-24, Greg King <greg.king5@ver5z6n.net>
+** 2014-09-10, Greg King <greg.king5@verizon.net>
**
** This is the basic layer for all scanf-type functions. It should be
** rewritten in assembly, at some time in the future. So, some of the code
(char*) __AX__ = JumpBuf;
asm ("jsr pushax");
asm ("pla");
- asm ("ldx #>0");
+ asm ("ldx #>$0000");
asm ("jmp %v", longjmp);
}
++format;
asm ("ldy #0");
asm ("lda (regsave),y");
- asm ("ldx #>0");
+ asm ("ldx #>$0000");
return (F = (char) __AX__);
}
;
; 1998-06-02, Ullrich von Bassewitz
-; 2013-05-01, Greg King
+; 2014-09-10, Greg King
;
; int isgraph (int c);
;
.include "ctype.inc"
_isgraph:
- cpx #>0 ; Char range OK?
+ cpx #>$0000 ; Char range OK?
bne @L1 ; Jump if no
tay
lda __ctype,y ; Get character classification
;
; 1998-06-02, Ullrich von Bassewitz
-; 2013-05-01, Greg King
+; 2014-09-10, Greg King
;
; int ispunct (int c);
;
.include "ctype.inc"
_ispunct:
- cpx #>0 ; Char range OK?
+ cpx #>$0000 ; Char range OK?
bne @L1 ; Jump if no
tay
lda __ctype,y ; Get character classification
; /* Standard C function */
;
; 2004-11-28, Ullrich von Bassewitz
-; 2004-12-21, Greg King
+; 2014-09-10, Greg King
;
.export _vsscanf
; Return EOF if we are at the end of the string
bne L1
- lda #$FF
+ lda #<-1
tax
rts
L1: tax ; Save return value
tya ; Low byte of index
ldy #SSCANFDATA::INDEX
- add #<1
+ add #<$0001
sta (ptr1),y
iny
lda (ptr1),y
- adc #>1
+ adc #>$0001
sta (ptr1),y
; Return the char just read
txa
- ldx #>0
+ ldx #>$0000
rts
.endproc
ldy #SSCANFDATA::INDEX
lda (ptr1),y
- sub #<1
+ sub #<$0001
sta (ptr1),y
iny
lda (ptr1),y
- sbc #>1
+ sbc #>$0001
sta (ptr1),y
; Return c
;
; int fastcall vcscanf(const char* format, va_list ap);
;
-; 2005-01-02, Greg King
+; 2014-09-10, Greg King
;
.export _vcscanf
; Return the old, pushed-back character (instead of getting a new one).
;
- dex ; ldx #>0
+ dex ; ldx #>$0000
stx pushed
lda back
rts
pha
jsr _cputc
pla
- ldx #>0
+ ldx #>$0000
rts
;
; 2010-11-02, Ullrich von Bassewitz
-; 2014-05-10, Greg King
+; 2014-09-10, Greg King
;
; CC65 runtime: 8x8 => 16 signed multiplication
;
sta ptr3
imul8x8r16m:
- ldx #>0
+ ldx #>$0000
bit ptr3
bpl @L7
dex
@L7: stx ptr3+1 ; Extend sign of Left-Hand Side
- ldy #<0 ; Clear .XY accumulator
- ldx #>0
+ ldy #<$0000 ; Clear .XY accumulator
+ ldx #>$0000
lda ptr1
bmi NegMult
bpl @L2 ; Branch always