mirror of
https://github.com/irmen/prog8.git
synced 2025-02-16 22:30:46 +00:00
renamed c64scr. to txt.
This commit is contained in:
parent
462af76770
commit
f08fc18ab5
22
README.md
22
README.md
@ -67,7 +67,7 @@ Example code
|
||||
|
||||
This code calculates prime numbers using the Sieve of Eratosthenes algorithm::
|
||||
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -76,35 +76,33 @@ This code calculates prime numbers using the Sieve of Eratosthenes algorithm::
|
||||
ubyte candidate_prime = 2
|
||||
|
||||
sub start() {
|
||||
memset(sieve, 256, false)
|
||||
|
||||
c64scr.print("prime numbers up to 255:\n\n")
|
||||
memset(sieve, 256, false) ; clear the sieve
|
||||
txt.print("prime numbers up to 255:\n\n")
|
||||
ubyte amount=0
|
||||
repeat {
|
||||
ubyte prime = find_next_prime()
|
||||
if prime==0
|
||||
break
|
||||
c64scr.print_ub(prime)
|
||||
c64scr.print(", ")
|
||||
txt.print_ub(prime)
|
||||
txt.print(", ")
|
||||
amount++
|
||||
}
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("number of primes (expected 54): ")
|
||||
c64scr.print_ub(amount)
|
||||
txt.print("number of primes (expected 54): ")
|
||||
txt.print_ub(amount)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
|
||||
sub find_next_prime() -> ubyte {
|
||||
|
||||
while sieve[candidate_prime] {
|
||||
candidate_prime++
|
||||
if candidate_prime==0
|
||||
return 0
|
||||
return 0 ; we wrapped; no more primes available
|
||||
}
|
||||
|
||||
; found next one, mark the multiples and return it.
|
||||
sieve[candidate_prime] = true
|
||||
uword multiple = candidate_prime
|
||||
|
||||
while multiple < len(sieve) {
|
||||
sieve[lsb(multiple)] = true
|
||||
multiple += candidate_prime
|
||||
|
@ -174,7 +174,7 @@ c64 {
|
||||
; ---- end of SID registers ----
|
||||
|
||||
|
||||
; ---- C64 kernal routines ----
|
||||
; ---- C64 ROM kernal routines ----
|
||||
|
||||
romsub $AB1E = STROUT(uword strptr @ AY) clobbers(A, X, Y) ; print null-terminated string (use c64scr.print instead)
|
||||
romsub $E544 = CLEARSCR() clobbers(A,X,Y) ; clear the screen
|
||||
@ -221,9 +221,12 @@ romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of
|
||||
romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, ubyte dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use c64scr.plot for a 'safe' wrapper that preserves X.
|
||||
romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices
|
||||
|
||||
; ---- end of C64 kernal routines ----
|
||||
; ---- end of C64 ROM kernal routines ----
|
||||
|
||||
asmsub init_system() {
|
||||
|
||||
; ---- C64 specific system utility routines: ----
|
||||
|
||||
asmsub init_system() {
|
||||
; Initializes the machine to a sane starting state.
|
||||
; Called automatically by the loader program logic.
|
||||
; This means that the BASIC, KERNAL and CHARGEN ROMs are banked in,
|
||||
@ -255,4 +258,175 @@ asmsub init_system() {
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_irqvec_excl() clobbers(A) {
|
||||
%asm {{
|
||||
sei
|
||||
lda #<_irq_handler
|
||||
sta c64.CINV
|
||||
lda #>_irq_handler
|
||||
sta c64.CINV+1
|
||||
cli
|
||||
rts
|
||||
_irq_handler jsr set_irqvec._irq_handler_init
|
||||
jsr irq.irq
|
||||
jsr set_irqvec._irq_handler_end
|
||||
lda #$ff
|
||||
sta c64.VICIRQ ; acknowledge raster irq
|
||||
lda c64.CIA1ICR ; acknowledge CIA1 interrupt
|
||||
jmp c64.IRQDFEND ; end irq processing - don't call kernel
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_irqvec() clobbers(A) {
|
||||
%asm {{
|
||||
sei
|
||||
lda #<_irq_handler
|
||||
sta c64.CINV
|
||||
lda #>_irq_handler
|
||||
sta c64.CINV+1
|
||||
cli
|
||||
rts
|
||||
_irq_handler jsr _irq_handler_init
|
||||
jsr irq.irq
|
||||
jsr _irq_handler_end
|
||||
jmp c64.IRQDFRT ; continue with normal kernel irq routine
|
||||
|
||||
_irq_handler_init
|
||||
; save all zp scratch registers and the X register as these might be clobbered by the irq routine
|
||||
stx IRQ_X_REG
|
||||
lda P8ZP_SCRATCH_B1
|
||||
sta IRQ_SCRATCH_ZPB1
|
||||
lda P8ZP_SCRATCH_REG
|
||||
sta IRQ_SCRATCH_ZPREG
|
||||
lda P8ZP_SCRATCH_REG_X
|
||||
sta IRQ_SCRATCH_ZPREGX
|
||||
lda P8ZP_SCRATCH_W1
|
||||
sta IRQ_SCRATCH_ZPWORD1
|
||||
lda P8ZP_SCRATCH_W1+1
|
||||
sta IRQ_SCRATCH_ZPWORD1+1
|
||||
lda P8ZP_SCRATCH_W2
|
||||
sta IRQ_SCRATCH_ZPWORD2
|
||||
lda P8ZP_SCRATCH_W2+1
|
||||
sta IRQ_SCRATCH_ZPWORD2+1
|
||||
; stack protector; make sure we don't clobber the top of the evaluation stack
|
||||
dex
|
||||
dex
|
||||
dex
|
||||
dex
|
||||
dex
|
||||
dex
|
||||
cld
|
||||
rts
|
||||
|
||||
_irq_handler_end
|
||||
; restore all zp scratch registers and the X register
|
||||
lda IRQ_SCRATCH_ZPB1
|
||||
sta P8ZP_SCRATCH_B1
|
||||
lda IRQ_SCRATCH_ZPREG
|
||||
sta P8ZP_SCRATCH_REG
|
||||
lda IRQ_SCRATCH_ZPREGX
|
||||
sta P8ZP_SCRATCH_REG_X
|
||||
lda IRQ_SCRATCH_ZPWORD1
|
||||
sta P8ZP_SCRATCH_W1
|
||||
lda IRQ_SCRATCH_ZPWORD1+1
|
||||
sta P8ZP_SCRATCH_W1+1
|
||||
lda IRQ_SCRATCH_ZPWORD2
|
||||
sta P8ZP_SCRATCH_W2
|
||||
lda IRQ_SCRATCH_ZPWORD2+1
|
||||
sta P8ZP_SCRATCH_W2+1
|
||||
ldx IRQ_X_REG
|
||||
rts
|
||||
|
||||
IRQ_X_REG .byte 0
|
||||
IRQ_SCRATCH_ZPB1 .byte 0
|
||||
IRQ_SCRATCH_ZPREG .byte 0
|
||||
IRQ_SCRATCH_ZPREGX .byte 0
|
||||
IRQ_SCRATCH_ZPWORD1 .word 0
|
||||
IRQ_SCRATCH_ZPWORD2 .word 0
|
||||
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub restore_irqvec() {
|
||||
%asm {{
|
||||
sei
|
||||
lda #<c64.IRQDFRT
|
||||
sta c64.CINV
|
||||
lda #>c64.IRQDFRT
|
||||
sta c64.CINV+1
|
||||
lda #0
|
||||
sta c64.IREQMASK ; disable raster irq
|
||||
lda #%10000001
|
||||
sta c64.CIA1ICR ; restore CIA1 irq
|
||||
cli
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_rasterirq(uword rasterpos @ AY) clobbers(A) {
|
||||
%asm {{
|
||||
sei
|
||||
jsr _setup_raster_irq
|
||||
lda #<_raster_irq_handler
|
||||
sta c64.CINV
|
||||
lda #>_raster_irq_handler
|
||||
sta c64.CINV+1
|
||||
cli
|
||||
rts
|
||||
|
||||
_raster_irq_handler
|
||||
jsr set_irqvec._irq_handler_init
|
||||
jsr irq.irq
|
||||
jsr set_irqvec._irq_handler_end
|
||||
lda #$ff
|
||||
sta c64.VICIRQ ; acknowledge raster irq
|
||||
jmp c64.IRQDFRT
|
||||
|
||||
_setup_raster_irq
|
||||
pha
|
||||
lda #%01111111
|
||||
sta c64.CIA1ICR ; "switch off" interrupts signals from cia-1
|
||||
sta c64.CIA2ICR ; "switch off" interrupts signals from cia-2
|
||||
and c64.SCROLY
|
||||
sta c64.SCROLY ; clear most significant bit of raster position
|
||||
lda c64.CIA1ICR ; ack previous irq
|
||||
lda c64.CIA2ICR ; ack previous irq
|
||||
pla
|
||||
sta c64.RASTER ; set the raster line number where interrupt should occur
|
||||
cpy #0
|
||||
beq +
|
||||
lda c64.SCROLY
|
||||
ora #%10000000
|
||||
sta c64.SCROLY ; set most significant bit of raster position
|
||||
+ lda #%00000001
|
||||
sta c64.IREQMASK ;enable raster interrupt signals from vic
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_rasterirq_excl(uword rasterpos @ AY) clobbers(A) {
|
||||
%asm {{
|
||||
sei
|
||||
jsr set_rasterirq._setup_raster_irq
|
||||
lda #<_raster_irq_handler
|
||||
sta c64.CINV
|
||||
lda #>_raster_irq_handler
|
||||
sta c64.CINV+1
|
||||
cli
|
||||
rts
|
||||
|
||||
_raster_irq_handler
|
||||
jsr set_irqvec._irq_handler_init
|
||||
jsr irq.irq
|
||||
jsr set_irqvec._irq_handler_end
|
||||
lda #$ff
|
||||
sta c64.VICIRQ ; acknowledge raster irq
|
||||
jmp c64.IRQDFEND ; end irq processing - don't call kernel
|
||||
|
||||
}}
|
||||
}
|
||||
|
||||
; ---- end of C64 specific system utility routines ----
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
; Prog8 definitions for the Commodore-64
|
||||
; These are the utility subroutines.
|
||||
; Prog8 definitions for the Text I/O and Screen routines for the Commodore-64
|
||||
;
|
||||
; Written by Irmen de Jong (irmen@razorvine.net) - license: GNU GPL 3.0
|
||||
;
|
||||
@ -10,185 +9,7 @@
|
||||
%import conv
|
||||
|
||||
|
||||
c64utils {
|
||||
|
||||
asmsub set_irqvec_excl() clobbers(A) {
|
||||
%asm {{
|
||||
sei
|
||||
lda #<_irq_handler
|
||||
sta c64.CINV
|
||||
lda #>_irq_handler
|
||||
sta c64.CINV+1
|
||||
cli
|
||||
rts
|
||||
_irq_handler jsr set_irqvec._irq_handler_init
|
||||
jsr irq.irq
|
||||
jsr set_irqvec._irq_handler_end
|
||||
lda #$ff
|
||||
sta c64.VICIRQ ; acknowledge raster irq
|
||||
lda c64.CIA1ICR ; acknowledge CIA1 interrupt
|
||||
jmp c64.IRQDFEND ; end irq processing - don't call kernel
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_irqvec() clobbers(A) {
|
||||
%asm {{
|
||||
sei
|
||||
lda #<_irq_handler
|
||||
sta c64.CINV
|
||||
lda #>_irq_handler
|
||||
sta c64.CINV+1
|
||||
cli
|
||||
rts
|
||||
_irq_handler jsr _irq_handler_init
|
||||
jsr irq.irq
|
||||
jsr _irq_handler_end
|
||||
jmp c64.IRQDFRT ; continue with normal kernel irq routine
|
||||
|
||||
_irq_handler_init
|
||||
; save all zp scratch registers and the X register as these might be clobbered by the irq routine
|
||||
stx IRQ_X_REG
|
||||
lda P8ZP_SCRATCH_B1
|
||||
sta IRQ_SCRATCH_ZPB1
|
||||
lda P8ZP_SCRATCH_REG
|
||||
sta IRQ_SCRATCH_ZPREG
|
||||
lda P8ZP_SCRATCH_REG_X
|
||||
sta IRQ_SCRATCH_ZPREGX
|
||||
lda P8ZP_SCRATCH_W1
|
||||
sta IRQ_SCRATCH_ZPWORD1
|
||||
lda P8ZP_SCRATCH_W1+1
|
||||
sta IRQ_SCRATCH_ZPWORD1+1
|
||||
lda P8ZP_SCRATCH_W2
|
||||
sta IRQ_SCRATCH_ZPWORD2
|
||||
lda P8ZP_SCRATCH_W2+1
|
||||
sta IRQ_SCRATCH_ZPWORD2+1
|
||||
; stack protector; make sure we don't clobber the top of the evaluation stack
|
||||
dex
|
||||
dex
|
||||
dex
|
||||
dex
|
||||
dex
|
||||
dex
|
||||
cld
|
||||
rts
|
||||
|
||||
_irq_handler_end
|
||||
; restore all zp scratch registers and the X register
|
||||
lda IRQ_SCRATCH_ZPB1
|
||||
sta P8ZP_SCRATCH_B1
|
||||
lda IRQ_SCRATCH_ZPREG
|
||||
sta P8ZP_SCRATCH_REG
|
||||
lda IRQ_SCRATCH_ZPREGX
|
||||
sta P8ZP_SCRATCH_REG_X
|
||||
lda IRQ_SCRATCH_ZPWORD1
|
||||
sta P8ZP_SCRATCH_W1
|
||||
lda IRQ_SCRATCH_ZPWORD1+1
|
||||
sta P8ZP_SCRATCH_W1+1
|
||||
lda IRQ_SCRATCH_ZPWORD2
|
||||
sta P8ZP_SCRATCH_W2
|
||||
lda IRQ_SCRATCH_ZPWORD2+1
|
||||
sta P8ZP_SCRATCH_W2+1
|
||||
ldx IRQ_X_REG
|
||||
rts
|
||||
|
||||
IRQ_X_REG .byte 0
|
||||
IRQ_SCRATCH_ZPB1 .byte 0
|
||||
IRQ_SCRATCH_ZPREG .byte 0
|
||||
IRQ_SCRATCH_ZPREGX .byte 0
|
||||
IRQ_SCRATCH_ZPWORD1 .word 0
|
||||
IRQ_SCRATCH_ZPWORD2 .word 0
|
||||
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub restore_irqvec() {
|
||||
%asm {{
|
||||
sei
|
||||
lda #<c64.IRQDFRT
|
||||
sta c64.CINV
|
||||
lda #>c64.IRQDFRT
|
||||
sta c64.CINV+1
|
||||
lda #0
|
||||
sta c64.IREQMASK ; disable raster irq
|
||||
lda #%10000001
|
||||
sta c64.CIA1ICR ; restore CIA1 irq
|
||||
cli
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_rasterirq(uword rasterpos @ AY) clobbers(A) {
|
||||
%asm {{
|
||||
sei
|
||||
jsr _setup_raster_irq
|
||||
lda #<_raster_irq_handler
|
||||
sta c64.CINV
|
||||
lda #>_raster_irq_handler
|
||||
sta c64.CINV+1
|
||||
cli
|
||||
rts
|
||||
|
||||
_raster_irq_handler
|
||||
jsr set_irqvec._irq_handler_init
|
||||
jsr irq.irq
|
||||
jsr set_irqvec._irq_handler_end
|
||||
lda #$ff
|
||||
sta c64.VICIRQ ; acknowledge raster irq
|
||||
jmp c64.IRQDFRT
|
||||
|
||||
_setup_raster_irq
|
||||
pha
|
||||
lda #%01111111
|
||||
sta c64.CIA1ICR ; "switch off" interrupts signals from cia-1
|
||||
sta c64.CIA2ICR ; "switch off" interrupts signals from cia-2
|
||||
and c64.SCROLY
|
||||
sta c64.SCROLY ; clear most significant bit of raster position
|
||||
lda c64.CIA1ICR ; ack previous irq
|
||||
lda c64.CIA2ICR ; ack previous irq
|
||||
pla
|
||||
sta c64.RASTER ; set the raster line number where interrupt should occur
|
||||
cpy #0
|
||||
beq +
|
||||
lda c64.SCROLY
|
||||
ora #%10000000
|
||||
sta c64.SCROLY ; set most significant bit of raster position
|
||||
+ lda #%00000001
|
||||
sta c64.IREQMASK ;enable raster interrupt signals from vic
|
||||
rts
|
||||
}}
|
||||
}
|
||||
|
||||
asmsub set_rasterirq_excl(uword rasterpos @ AY) clobbers(A) {
|
||||
%asm {{
|
||||
sei
|
||||
jsr set_rasterirq._setup_raster_irq
|
||||
lda #<_raster_irq_handler
|
||||
sta c64.CINV
|
||||
lda #>_raster_irq_handler
|
||||
sta c64.CINV+1
|
||||
cli
|
||||
rts
|
||||
|
||||
_raster_irq_handler
|
||||
jsr set_irqvec._irq_handler_init
|
||||
jsr irq.irq
|
||||
jsr set_irqvec._irq_handler_end
|
||||
lda #$ff
|
||||
sta c64.VICIRQ ; acknowledge raster irq
|
||||
jmp c64.IRQDFEND ; end irq processing - don't call kernel
|
||||
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
} ; ------ end of block c64utils
|
||||
|
||||
|
||||
|
||||
|
||||
c64scr {
|
||||
; ---- this block contains (character) Screen and text I/O related functions ----
|
||||
|
||||
txt {
|
||||
|
||||
asmsub clear_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) {
|
||||
; ---- clear the character screen with the given fill character and character color.
|
||||
@ -376,7 +197,6 @@ _scroll_screen ; scroll the screen memory
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
asmsub print (str text @ AY) clobbers(A,Y) {
|
||||
; ---- print null terminated string from A/Y
|
||||
; note: the compiler contains an optimization that will replace
|
||||
@ -722,5 +542,4 @@ asmsub plot (ubyte col @ Y, ubyte row @ A) clobbers(A) {
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
} ; ---- end block c64scr
|
||||
}
|
@ -1,5 +1,4 @@
|
||||
; Prog8 definitions for the CommanderX16
|
||||
; These are utility subroutines.
|
||||
; Prog8 definitions for the Text I/O and Screen routines for the CommanderX16
|
||||
;
|
||||
; Written by Irmen de Jong (irmen@razorvine.net) - license: GNU GPL 3.0
|
||||
;
|
||||
@ -10,20 +9,7 @@
|
||||
%import conv
|
||||
|
||||
|
||||
cx16utils {
|
||||
|
||||
; --- nothing here yet at this time.
|
||||
|
||||
|
||||
} ; ------ end of block cx16utils
|
||||
|
||||
|
||||
|
||||
|
||||
screen {
|
||||
|
||||
; ---- this block contains (character) Screen and text I/O related functions ----
|
||||
|
||||
txt {
|
||||
|
||||
asmsub clear_screen (ubyte char @ A, ubyte color @ Y) clobbers(A) {
|
||||
; ---- clear the character screen with the given fill character and character color.
|
||||
@ -251,6 +237,4 @@ asmsub plot (ubyte col @ Y, ubyte row @ A) clobbers(A) {
|
||||
}}
|
||||
}
|
||||
|
||||
|
||||
|
||||
} ; ---- end block screen
|
||||
}
|
@ -67,11 +67,8 @@ internal object C64MachineDefinition: IMachineDefinition {
|
||||
}
|
||||
|
||||
override fun importLibs(compilerOptions: CompilationOptions, importer: ModuleImporter, program: Program) {
|
||||
// if we're producing a PRG or BASIC program, include the c64utils and c64lib libraries
|
||||
if (compilerOptions.launcher == LauncherType.BASIC || compilerOptions.output == OutputType.PRG) {
|
||||
if (compilerOptions.launcher == LauncherType.BASIC || compilerOptions.output == OutputType.PRG)
|
||||
importer.importLibraryModule(program, "c64lib")
|
||||
importer.importLibraryModule(program, "c64utils")
|
||||
}
|
||||
}
|
||||
|
||||
override fun launchEmulator(programName: String) {
|
||||
|
@ -31,11 +31,8 @@ internal object CX16MachineDefinition: IMachineDefinition {
|
||||
|
||||
override fun getFloatRomConst(number: Double): String? = null // TODO Does Cx16 have ROM float locations?
|
||||
override fun importLibs(compilerOptions: CompilationOptions, importer: ModuleImporter, program: Program) {
|
||||
// if we're producing a PRG or BASIC program, include the cx16utils and cx16lib libraries
|
||||
if (compilerOptions.launcher == LauncherType.BASIC || compilerOptions.output == OutputType.PRG) {
|
||||
if (compilerOptions.launcher == LauncherType.BASIC || compilerOptions.output == OutputType.PRG)
|
||||
importer.importLibraryModule(program, "cx16lib")
|
||||
importer.importLibraryModule(program, "cx16utils")
|
||||
}
|
||||
}
|
||||
|
||||
override fun launchEmulator(programName: String) {
|
||||
|
@ -109,8 +109,8 @@ A module source file is a text file with the ``.p8`` suffix, containing the prog
|
||||
It consists of compilation options and other directives, imports of other modules,
|
||||
and source code for one or more code blocks.
|
||||
|
||||
Prog8 has a couple of *LIBRARY* modules that are defined in special internal files provided by the compiler:
|
||||
``c64lib``, ``c64utils``, ``c64flt`` and ``prog8lib``. You should not overwrite these or reuse their names.
|
||||
Prog8 has various *LIBRARY* modules that are defined in special internal files provided by the compiler.
|
||||
You should not overwrite these or reuse their names.
|
||||
They are embedded into the packaged release version of the compiler so you don't have to worry about
|
||||
where they are, but their names are still reserved.
|
||||
|
||||
|
@ -42,7 +42,7 @@ Code examples
|
||||
|
||||
This code calculates prime numbers using the Sieve of Eratosthenes algorithm::
|
||||
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -51,35 +51,33 @@ This code calculates prime numbers using the Sieve of Eratosthenes algorithm::
|
||||
ubyte candidate_prime = 2
|
||||
|
||||
sub start() {
|
||||
memset(sieve, 256, false)
|
||||
|
||||
c64scr.print("prime numbers up to 255:\n\n")
|
||||
memset(sieve, 256, false) ; clear the sieve
|
||||
txt.print("prime numbers up to 255:\n\n")
|
||||
ubyte amount=0
|
||||
repeat {
|
||||
ubyte prime = find_next_prime()
|
||||
if prime==0
|
||||
break
|
||||
c64scr.print_ub(prime)
|
||||
c64scr.print(", ")
|
||||
txt.print_ub(prime)
|
||||
txt.print(", ")
|
||||
amount++
|
||||
}
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("number of primes (expected 54): ")
|
||||
c64scr.print_ub(amount)
|
||||
txt.print("number of primes (expected 54): ")
|
||||
txt.print_ub(amount)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
|
||||
sub find_next_prime() -> ubyte {
|
||||
|
||||
while sieve[candidate_prime] {
|
||||
candidate_prime++
|
||||
if candidate_prime==0
|
||||
return 0
|
||||
return 0 ; we wrapped; no more primes available
|
||||
}
|
||||
|
||||
; found next one, mark the multiples and return it.
|
||||
sieve[candidate_prime] = true
|
||||
uword multiple = candidate_prime
|
||||
|
||||
while multiple < len(sieve) {
|
||||
sieve[lsb(multiple)] = true
|
||||
multiple += candidate_prime
|
||||
@ -89,6 +87,7 @@ This code calculates prime numbers using the Sieve of Eratosthenes algorithm::
|
||||
}
|
||||
|
||||
|
||||
|
||||
when compiled an ran on a C-64 you get this:
|
||||
|
||||
.. image:: _static/primes_example.png
|
||||
@ -96,9 +95,11 @@ when compiled an ran on a C-64 you get this:
|
||||
:alt: result when run on C-64
|
||||
|
||||
|
||||
// TODO fix code example
|
||||
The following programs shows a use of the high level ``struct`` type::
|
||||
|
||||
%import c64utils
|
||||
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -111,22 +112,25 @@ The following programs shows a use of the high level ``struct`` type::
|
||||
|
||||
sub start() {
|
||||
|
||||
Color purple = {255, 0, 255}
|
||||
Color purple = [255, 0, 255]
|
||||
|
||||
Color other
|
||||
|
||||
other = purple
|
||||
other.red /= 2
|
||||
other.green = 10 + other.green / 2
|
||||
other.blue = 99
|
||||
|
||||
c64scr.print_ub(other.red)
|
||||
txt.print_ub(other.red)
|
||||
c64.CHROUT(',')
|
||||
c64scr.print_ub(other.green)
|
||||
txt.print_ub(other.green)
|
||||
c64.CHROUT(',')
|
||||
c64scr.print_ub(other.blue)
|
||||
txt.print_ub(other.blue)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
when compiled and ran, it prints ``127,10,99`` on the screen.
|
||||
|
||||
|
||||
|
@ -803,7 +803,7 @@ memset(address, numbytes, bytevalue)
|
||||
Efficiently set a part of memory to the given (u)byte value.
|
||||
But the most efficient will always be to write a specialized fill routine in assembly yourself!
|
||||
Note that for clearing the character screen, very fast specialized subroutines are
|
||||
available in the ``c64scr`` block (part of the ``c64utils`` module)
|
||||
available in the ``screen`` block (part of the ``c64textio`` or ``cx16textio`` modules)
|
||||
|
||||
memsetw(address, numwords, wordvalue)
|
||||
Efficiently set a part of memory to the given (u)word value.
|
||||
|
@ -149,13 +149,13 @@ but there are a few library routines available to make setting up C-64 IRQs and
|
||||
|
||||
These routines are::
|
||||
|
||||
c64utils.set_irqvec()
|
||||
c64utils.set_irqvec_excl()
|
||||
c64.set_irqvec()
|
||||
c64.set_irqvec_excl()
|
||||
|
||||
c64utils.set_rasterirq( <raster line> )
|
||||
c64utils.set_rasterirq_excl( <raster line> )
|
||||
c64.set_rasterirq( <raster line> )
|
||||
c64.set_rasterirq_excl( <raster line> )
|
||||
|
||||
c64utils.restore_irqvec() ; set it back to the systems default irq handler
|
||||
c64.restore_irqvec() ; set it back to the systems default irq handler
|
||||
|
||||
If you activate an IRQ handler with one of these, it expects the handler to be defined
|
||||
as a subroutine ``irq`` in the module ``irq`` so like this::
|
||||
|
@ -1,7 +1,6 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64flt
|
||||
%zeropage dontuse
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
|
||||
@ -20,90 +19,90 @@ main {
|
||||
|
||||
; LEN/STRLEN
|
||||
ubyte length = len(name)
|
||||
if length!=5 c64scr.print("error len1\n")
|
||||
if length!=5 txt.print("error len1\n")
|
||||
length = len(uwarr)
|
||||
if length!=5 c64scr.print("error len2\n")
|
||||
if length!=5 txt.print("error len2\n")
|
||||
length=strlen(name)
|
||||
if length!=5 c64scr.print("error strlen1\n")
|
||||
if length!=5 txt.print("error strlen1\n")
|
||||
name[3] = 0
|
||||
length=strlen(name)
|
||||
if length!=3 c64scr.print("error strlen2\n")
|
||||
if length!=3 txt.print("error strlen2\n")
|
||||
|
||||
; MAX
|
||||
ub = max(ubarr)
|
||||
if ub!=199 c64scr.print("error max1\n")
|
||||
if ub!=199 txt.print("error max1\n")
|
||||
bb = max(barr)
|
||||
if bb!=99 c64scr.print("error max2\n")
|
||||
if bb!=99 txt.print("error max2\n")
|
||||
uw = max(uwarr)
|
||||
if uw!=4444 c64scr.print("error max3\n")
|
||||
if uw!=4444 txt.print("error max3\n")
|
||||
ww = max(warr)
|
||||
if ww!=999 c64scr.print("error max4\n")
|
||||
if ww!=999 txt.print("error max4\n")
|
||||
ff = max(farr)
|
||||
if ff!=999.9 c64scr.print("error max5\n")
|
||||
if ff!=999.9 txt.print("error max5\n")
|
||||
|
||||
; MIN
|
||||
ub = min(ubarr)
|
||||
if ub!=0 c64scr.print("error min1\n")
|
||||
if ub!=0 txt.print("error min1\n")
|
||||
bb = min(barr)
|
||||
if bb!=-122 c64scr.print("error min2\n")
|
||||
if bb!=-122 txt.print("error min2\n")
|
||||
uw = min(uwarr)
|
||||
if uw!=0 c64scr.print("error min3\n")
|
||||
if uw!=0 txt.print("error min3\n")
|
||||
ww = min(warr)
|
||||
if ww!=-4444 c64scr.print("error min4\n")
|
||||
if ww!=-4444 txt.print("error min4\n")
|
||||
ff = min(farr)
|
||||
if ff!=-4444.4 c64scr.print("error min5\n")
|
||||
if ff!=-4444.4 txt.print("error min5\n")
|
||||
|
||||
; SUM
|
||||
uw = sum(ubarr)
|
||||
if uw!=420 c64scr.print("error sum1\n")
|
||||
if uw!=420 txt.print("error sum1\n")
|
||||
ww = sum(barr)
|
||||
if ww!=-101 c64scr.print("error sum2\n")
|
||||
if ww!=-101 txt.print("error sum2\n")
|
||||
uw = sum(uwarr)
|
||||
if uw!=6665 c64scr.print("error sum3\n")
|
||||
if uw!=6665 txt.print("error sum3\n")
|
||||
ww = sum(warr)
|
||||
if ww!=-4223 c64scr.print("error sum4\n")
|
||||
if ww!=-4223 txt.print("error sum4\n")
|
||||
ff = sum(farr)
|
||||
if ff!=-4222.4 c64scr.print("error sum5\n")
|
||||
if ff!=-4222.4 txt.print("error sum5\n")
|
||||
|
||||
; ANY
|
||||
ub = any(ubarr)
|
||||
if ub==0 c64scr.print("error any1\n")
|
||||
if ub==0 txt.print("error any1\n")
|
||||
ub = any(barr)
|
||||
if ub==0 c64scr.print("error any2\n")
|
||||
if ub==0 txt.print("error any2\n")
|
||||
ub = any(uwarr)
|
||||
if ub==0 c64scr.print("error any3\n")
|
||||
if ub==0 txt.print("error any3\n")
|
||||
ub = any(warr)
|
||||
if ub==0 c64scr.print("error any4\n")
|
||||
if ub==0 txt.print("error any4\n")
|
||||
ub = any(farr)
|
||||
if ub==0 c64scr.print("error any5\n")
|
||||
if ub==0 txt.print("error any5\n")
|
||||
|
||||
; ALL
|
||||
ub = all(ubarr)
|
||||
if ub==1 c64scr.print("error all1\n")
|
||||
if ub==1 txt.print("error all1\n")
|
||||
ub = all(barr)
|
||||
if ub==1 c64scr.print("error all2\n")
|
||||
if ub==1 txt.print("error all2\n")
|
||||
ub = all(uwarr)
|
||||
if ub==1 c64scr.print("error all3\n")
|
||||
if ub==1 txt.print("error all3\n")
|
||||
ub = all(warr)
|
||||
if ub==1 c64scr.print("error all4\n")
|
||||
if ub==1 txt.print("error all4\n")
|
||||
ub = all(farr)
|
||||
if ub==1 c64scr.print("error all5\n")
|
||||
if ub==1 txt.print("error all5\n")
|
||||
ubarr[1]=$40
|
||||
barr[1]=$40
|
||||
uwarr[1]=$4000
|
||||
warr[1]=$4000
|
||||
farr[1]=1.1
|
||||
ub = all(ubarr)
|
||||
if ub==0 c64scr.print("error all6\n")
|
||||
if ub==0 txt.print("error all6\n")
|
||||
ub = all(barr)
|
||||
if ub==0 c64scr.print("error all7\n")
|
||||
if ub==0 txt.print("error all7\n")
|
||||
ub = all(uwarr)
|
||||
if ub==0 c64scr.print("error all8\n")
|
||||
if ub==0 txt.print("error all8\n")
|
||||
ub = all(warr)
|
||||
if ub==0 c64scr.print("error all9\n")
|
||||
if ub==0 txt.print("error all9\n")
|
||||
ub = all(farr)
|
||||
if ub==0 c64scr.print("error all10\n")
|
||||
if ub==0 txt.print("error all10\n")
|
||||
|
||||
c64scr.print("\nyou should see no errors printed above (only at first run).")
|
||||
txt.print("\nyou should see no errors printed above (only at first run).")
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
%import c64utils
|
||||
%zeropage dontuse
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
main {
|
||||
@ -7,379 +7,379 @@ main {
|
||||
sub start() {
|
||||
ubyte A
|
||||
|
||||
c64scr.print("ubyte shift left\n")
|
||||
txt.print("ubyte shift left\n")
|
||||
A = shiftlb0()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftlb1()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftlb2()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftlb3()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftlb4()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftlb5()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftlb6()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftlb7()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftlb8()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftlb9()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("enter to continue:\n")
|
||||
txt.print("enter to continue:\n")
|
||||
void c64.CHRIN()
|
||||
|
||||
c64scr.print("ubyte shift right\n")
|
||||
txt.print("ubyte shift right\n")
|
||||
A = shiftrb0()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftrb1()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftrb2()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftrb3()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftrb4()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftrb5()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftrb6()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftrb7()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftrb8()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
A = shiftrb9()
|
||||
c64scr.print_ubbin(A, true)
|
||||
txt.print_ubbin(A, true)
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("enter to continue:\n")
|
||||
txt.print("enter to continue:\n")
|
||||
void c64.CHRIN()
|
||||
|
||||
|
||||
|
||||
|
||||
c64scr.print("signed byte shift left\n")
|
||||
txt.print("signed byte shift left\n")
|
||||
byte signedb
|
||||
signedb = shiftlsb0()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftlsb1()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftlsb2()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftlsb3()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftlsb4()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftlsb5()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftlsb6()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftlsb7()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftlsb8()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftlsb9()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("enter to continue:\n")
|
||||
txt.print("enter to continue:\n")
|
||||
void c64.CHRIN()
|
||||
|
||||
c64scr.print("signed byte shift right\n")
|
||||
txt.print("signed byte shift right\n")
|
||||
signedb = shiftrsb0()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftrsb1()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftrsb2()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftrsb3()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftrsb4()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftrsb5()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftrsb6()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftrsb7()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftrsb8()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
signedb = shiftrsb9()
|
||||
c64scr.print_ubbin(signedb as ubyte, true)
|
||||
txt.print_ubbin(signedb as ubyte, true)
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("enter to continue:\n")
|
||||
txt.print("enter to continue:\n")
|
||||
void c64.CHRIN()
|
||||
|
||||
|
||||
|
||||
|
||||
c64scr.print("uword shift left\n")
|
||||
txt.print("uword shift left\n")
|
||||
uword uw
|
||||
uw = shiftluw0()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw1()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw2()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw3()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw4()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw5()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw6()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw7()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw8()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw9()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw10()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw11()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw12()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw13()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw14()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw15()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw16()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftluw17()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("enter to continue:\n")
|
||||
txt.print("enter to continue:\n")
|
||||
void c64.CHRIN()
|
||||
|
||||
c64scr.print("uword shift right\n")
|
||||
txt.print("uword shift right\n")
|
||||
uw = shiftruw0()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw1()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw2()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw3()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw4()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw5()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw6()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw7()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw8()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw9()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw10()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw11()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw12()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw13()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw14()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw15()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw16()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
uw = shiftruw17()
|
||||
c64scr.print_uwbin(uw, true)
|
||||
txt.print_uwbin(uw, true)
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("enter to continue:\n")
|
||||
txt.print("enter to continue:\n")
|
||||
void c64.CHRIN()
|
||||
|
||||
c64scr.print("signed word shift left\n")
|
||||
txt.print("signed word shift left\n")
|
||||
word sw
|
||||
sw = shiftlsw0()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw1()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw2()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw3()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw4()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw5()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw6()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw7()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw8()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw9()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw10()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw11()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw12()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw13()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw14()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw15()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw16()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftlsw17()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("enter to continue:\n")
|
||||
txt.print("enter to continue:\n")
|
||||
void c64.CHRIN()
|
||||
|
||||
c64scr.print("signed word shift right\n")
|
||||
txt.print("signed word shift right\n")
|
||||
sw = shiftrsw0()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw1()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw2()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw3()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw4()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw5()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw6()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw7()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw8()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw9()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw10()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw11()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw12()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw13()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw14()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw15()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw16()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
sw = shiftrsw17()
|
||||
c64scr.print_uwbin(sw as uword, true)
|
||||
txt.print_uwbin(sw as uword, true)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64flt
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -10,16 +9,16 @@ main {
|
||||
div_ubyte(100, 6, 16)
|
||||
div_ubyte(255, 2, 127)
|
||||
|
||||
div_byte(0, 1, 0)
|
||||
div_byte(100, -6, -16)
|
||||
div_byte(127, -2, -63)
|
||||
div_byte(0, 1, 0) ; TODO fix type error
|
||||
div_byte(100, -6, -16) ; TODO fix type error
|
||||
div_byte(127, -2, -63) ; TODO fix type error
|
||||
|
||||
div_uword(0,1,0)
|
||||
div_uword(40000,500,80)
|
||||
div_uword(43211,2,21605)
|
||||
|
||||
div_word(0,1,0)
|
||||
div_word(-20000,500,-40)
|
||||
div_word(-20000,500,-40) ; TODO fix type error
|
||||
div_word(-2222,2,-1111)
|
||||
|
||||
div_float(0,1,0)
|
||||
@ -29,75 +28,75 @@ main {
|
||||
sub div_ubyte(ubyte a1, ubyte a2, ubyte c) {
|
||||
ubyte r = a1/a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("ubyte ")
|
||||
c64scr.print_ub(a1)
|
||||
c64scr.print(" / ")
|
||||
c64scr.print_ub(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_ub(r)
|
||||
txt.print("err! ")
|
||||
txt.print("ubyte ")
|
||||
txt.print_ub(a1)
|
||||
txt.print(" / ")
|
||||
txt.print_ub(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_ub(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub div_byte(byte a1, byte a2, byte c) {
|
||||
byte r = a1/a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("byte ")
|
||||
c64scr.print_b(a1)
|
||||
c64scr.print(" / ")
|
||||
c64scr.print_b(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_b(r)
|
||||
txt.print("err! ")
|
||||
txt.print("byte ")
|
||||
txt.print_b(a1)
|
||||
txt.print(" / ")
|
||||
txt.print_b(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_b(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub div_uword(uword a1, uword a2, uword c) {
|
||||
uword r = a1/a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("uword ")
|
||||
c64scr.print_uw(a1)
|
||||
c64scr.print(" / ")
|
||||
c64scr.print_uw(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_uw(r)
|
||||
txt.print("err! ")
|
||||
txt.print("uword ")
|
||||
txt.print_uw(a1)
|
||||
txt.print(" / ")
|
||||
txt.print_uw(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_uw(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub div_word(word a1, word a2, word c) {
|
||||
word r = a1/a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("word ")
|
||||
c64scr.print_w(a1)
|
||||
c64scr.print(" / ")
|
||||
c64scr.print_w(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_w(r)
|
||||
txt.print("err! ")
|
||||
txt.print("word ")
|
||||
txt.print_w(a1)
|
||||
txt.print(" / ")
|
||||
txt.print_w(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_w(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub div_float(float a1, float a2, float c) {
|
||||
float r = a1/a2
|
||||
if abs(r-c)<0.00001
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
txt.print("err! ")
|
||||
|
||||
c64scr.print("float ")
|
||||
txt.print("float ")
|
||||
c64flt.print_f(a1)
|
||||
c64scr.print(" / ")
|
||||
txt.print(" / ")
|
||||
c64flt.print_f(a2)
|
||||
c64scr.print(" = ")
|
||||
txt.print(" = ")
|
||||
c64flt.print_f(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64flt
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -11,11 +10,11 @@ main {
|
||||
minus_ubyte(200, 100, 100)
|
||||
minus_ubyte(100, 200, 156)
|
||||
|
||||
minus_byte(0, 0, 0)
|
||||
minus_byte(100, 100, 0)
|
||||
minus_byte(50, -50, 100)
|
||||
minus_byte(0, -30, 30)
|
||||
minus_byte(-30, 0, -30)
|
||||
minus_byte(0, 0, 0) ; TODO fix type error
|
||||
minus_byte(100, 100, 0) ; TODO fix type error
|
||||
minus_byte(50, -50, 100) ; TODO fix type error
|
||||
minus_byte(0, -30, 30) ; TODO fix type error
|
||||
minus_byte(-30, 0, -30) ; TODO fix type error
|
||||
|
||||
minus_uword(0,0,0)
|
||||
minus_uword(50000,0, 50000)
|
||||
@ -23,10 +22,10 @@ main {
|
||||
minus_uword(20000,50000,35536)
|
||||
|
||||
minus_word(0,0,0)
|
||||
minus_word(1000,1000,0)
|
||||
minus_word(-1000,1000,-2000)
|
||||
minus_word(1000,500,500)
|
||||
minus_word(0,-3333,3333)
|
||||
minus_word(1000,1000,0) ; TODO fix type error
|
||||
minus_word(-1000,1000,-2000) ; TODO fix type error
|
||||
minus_word(1000,500,500) ; TODO fix type error
|
||||
minus_word(0,-3333,3333) ; TODO fix type error
|
||||
minus_word(-3333,0,-3333)
|
||||
|
||||
minus_float(0,0,0)
|
||||
@ -37,75 +36,75 @@ main {
|
||||
sub minus_ubyte(ubyte a1, ubyte a2, ubyte c) {
|
||||
ubyte r = a1-a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("ubyte ")
|
||||
c64scr.print_ub(a1)
|
||||
c64scr.print(" - ")
|
||||
c64scr.print_ub(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_ub(r)
|
||||
txt.print("err! ")
|
||||
txt.print("ubyte ")
|
||||
txt.print_ub(a1)
|
||||
txt.print(" - ")
|
||||
txt.print_ub(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_ub(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub minus_byte(byte a1, byte a2, byte c) {
|
||||
byte r = a1-a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("byte ")
|
||||
c64scr.print_b(a1)
|
||||
c64scr.print(" - ")
|
||||
c64scr.print_b(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_b(r)
|
||||
txt.print("err! ")
|
||||
txt.print("byte ")
|
||||
txt.print_b(a1)
|
||||
txt.print(" - ")
|
||||
txt.print_b(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_b(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub minus_uword(uword a1, uword a2, uword c) {
|
||||
uword r = a1-a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("uword ")
|
||||
c64scr.print_uw(a1)
|
||||
c64scr.print(" - ")
|
||||
c64scr.print_uw(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_uw(r)
|
||||
txt.print("err! ")
|
||||
txt.print("uword ")
|
||||
txt.print_uw(a1)
|
||||
txt.print(" - ")
|
||||
txt.print_uw(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_uw(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub minus_word(word a1, word a2, word c) {
|
||||
word r = a1-a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("word ")
|
||||
c64scr.print_w(a1)
|
||||
c64scr.print(" - ")
|
||||
c64scr.print_w(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_w(r)
|
||||
txt.print("err! ")
|
||||
txt.print("word ")
|
||||
txt.print_w(a1)
|
||||
txt.print(" - ")
|
||||
txt.print_w(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_w(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub minus_float(float a1, float a2, float c) {
|
||||
float r = a1-a2
|
||||
if abs(r-c)<0.00001
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
txt.print("err! ")
|
||||
|
||||
c64scr.print("float ")
|
||||
txt.print("float ")
|
||||
c64flt.print_f(a1)
|
||||
c64scr.print(" - ")
|
||||
txt.print(" - ")
|
||||
c64flt.print_f(a2)
|
||||
c64scr.print(" = ")
|
||||
txt.print(" = ")
|
||||
c64flt.print_f(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64flt
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -10,17 +9,17 @@ main {
|
||||
mul_ubyte(20, 1, 20)
|
||||
mul_ubyte(20, 10, 200)
|
||||
|
||||
mul_byte(0, 0, 0)
|
||||
mul_byte(10, 10, 100)
|
||||
mul_byte(5, -5, -25)
|
||||
mul_byte(0, -30, 0)
|
||||
mul_byte(0, 0, 0) ; TODO fix type error
|
||||
mul_byte(10, 10, 100) ; TODO fix type error
|
||||
mul_byte(5, -5, -25) ; TODO fix type error
|
||||
mul_byte(0, -30, 0) ; TODO fix type error
|
||||
|
||||
mul_uword(0,0,0)
|
||||
mul_uword(50000,1, 50000)
|
||||
mul_uword(500,100,50000)
|
||||
|
||||
mul_word(0,0,0)
|
||||
mul_word(-10,1000,-10000)
|
||||
mul_word(-10,1000,-10000) ; TODO fix type error
|
||||
mul_word(1,-3333,-3333)
|
||||
|
||||
mul_float(0,0,0)
|
||||
@ -31,75 +30,75 @@ main {
|
||||
sub mul_ubyte(ubyte a1, ubyte a2, ubyte c) {
|
||||
ubyte r = a1*a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("ubyte ")
|
||||
c64scr.print_ub(a1)
|
||||
c64scr.print(" * ")
|
||||
c64scr.print_ub(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_ub(r)
|
||||
txt.print("err! ")
|
||||
txt.print("ubyte ")
|
||||
txt.print_ub(a1)
|
||||
txt.print(" * ")
|
||||
txt.print_ub(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_ub(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub mul_byte(byte a1, byte a2, byte c) {
|
||||
byte r = a1*a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("byte ")
|
||||
c64scr.print_b(a1)
|
||||
c64scr.print(" * ")
|
||||
c64scr.print_b(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_b(r)
|
||||
txt.print("err! ")
|
||||
txt.print("byte ")
|
||||
txt.print_b(a1)
|
||||
txt.print(" * ")
|
||||
txt.print_b(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_b(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub mul_uword(uword a1, uword a2, uword c) {
|
||||
uword r = a1*a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("uword ")
|
||||
c64scr.print_uw(a1)
|
||||
c64scr.print(" * ")
|
||||
c64scr.print_uw(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_uw(r)
|
||||
txt.print("err! ")
|
||||
txt.print("uword ")
|
||||
txt.print_uw(a1)
|
||||
txt.print(" * ")
|
||||
txt.print_uw(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_uw(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub mul_word(word a1, word a2, word c) {
|
||||
word r = a1*a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("word ")
|
||||
c64scr.print_w(a1)
|
||||
c64scr.print(" * ")
|
||||
c64scr.print_w(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_w(r)
|
||||
txt.print("err! ")
|
||||
txt.print("word ")
|
||||
txt.print_w(a1)
|
||||
txt.print(" * ")
|
||||
txt.print_w(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_w(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub mul_float(float a1, float a2, float c) {
|
||||
float r = a1*a2
|
||||
if abs(r-c)<0.00001
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
txt.print("err! ")
|
||||
|
||||
c64scr.print("float ")
|
||||
txt.print("float ")
|
||||
c64flt.print_f(a1)
|
||||
c64scr.print(" * ")
|
||||
txt.print(" * ")
|
||||
c64flt.print_f(a2)
|
||||
c64scr.print(" = ")
|
||||
txt.print(" = ")
|
||||
c64flt.print_f(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64flt
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -10,19 +9,19 @@ main {
|
||||
plus_ubyte(0, 200, 200)
|
||||
plus_ubyte(100, 200, 44)
|
||||
|
||||
plus_byte(0, 0, 0)
|
||||
plus_byte(-100, 100, 0)
|
||||
plus_byte(-50, 100, 50)
|
||||
plus_byte(0, -30, -30)
|
||||
plus_byte(-30, 0, -30)
|
||||
plus_byte(0, 0, 0) ; TODO fix type error
|
||||
plus_byte(-100, 100, 0) ; TODO fix type error
|
||||
plus_byte(-50, 100, 50) ; TODO fix type error
|
||||
plus_byte(0, -30, -30) ; TODO fix type error
|
||||
plus_byte(-30, 0, -30) ; TODO fix type error
|
||||
|
||||
plus_uword(0,0,0)
|
||||
plus_uword(0,50000,50000)
|
||||
plus_uword(50000,20000,4464)
|
||||
|
||||
plus_word(0,0,0)
|
||||
plus_word(-1000,1000,0)
|
||||
plus_word(-500,1000,500)
|
||||
plus_word(-1000,1000,0) ; TODO fix type error
|
||||
plus_word(-500,1000,500) ; TODO fix type error
|
||||
plus_word(0,-3333,-3333)
|
||||
plus_word(-3333,0,-3333)
|
||||
|
||||
@ -35,75 +34,75 @@ main {
|
||||
sub plus_ubyte(ubyte a1, ubyte a2, ubyte c) {
|
||||
ubyte r = a1+a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("ubyte ")
|
||||
c64scr.print_ub(a1)
|
||||
c64scr.print(" + ")
|
||||
c64scr.print_ub(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_ub(r)
|
||||
txt.print("err! ")
|
||||
txt.print("ubyte ")
|
||||
txt.print_ub(a1)
|
||||
txt.print(" + ")
|
||||
txt.print_ub(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_ub(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub plus_byte(byte a1, byte a2, byte c) {
|
||||
byte r = a1+a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("byte ")
|
||||
c64scr.print_b(a1)
|
||||
c64scr.print(" + ")
|
||||
c64scr.print_b(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_b(r)
|
||||
txt.print("err! ")
|
||||
txt.print("byte ")
|
||||
txt.print_b(a1)
|
||||
txt.print(" + ")
|
||||
txt.print_b(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_b(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub plus_uword(uword a1, uword a2, uword c) {
|
||||
uword r = a1+a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("uword ")
|
||||
c64scr.print_uw(a1)
|
||||
c64scr.print(" + ")
|
||||
c64scr.print_uw(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_uw(r)
|
||||
txt.print("err! ")
|
||||
txt.print("uword ")
|
||||
txt.print_uw(a1)
|
||||
txt.print(" + ")
|
||||
txt.print_uw(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_uw(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub plus_word(word a1, word a2, word c) {
|
||||
word r = a1+a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("word ")
|
||||
c64scr.print_w(a1)
|
||||
c64scr.print(" + ")
|
||||
c64scr.print_w(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_w(r)
|
||||
txt.print("err! ")
|
||||
txt.print("word ")
|
||||
txt.print_w(a1)
|
||||
txt.print(" + ")
|
||||
txt.print_w(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_w(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub plus_float(float a1, float a2, float c) {
|
||||
float r = a1+a2
|
||||
if abs(r-c)<0.00001
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
txt.print("err! ")
|
||||
|
||||
c64scr.print("float ")
|
||||
txt.print("float ")
|
||||
c64flt.print_f(a1)
|
||||
c64scr.print(" + ")
|
||||
txt.print(" + ")
|
||||
c64flt.print_f(a2)
|
||||
c64scr.print(" = ")
|
||||
txt.print(" = ")
|
||||
c64flt.print_f(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
@ -1,13 +1,12 @@
|
||||
%import c64utils
|
||||
%import c64flt
|
||||
%option enable_floats
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
|
||||
c64scr.plot(0,24)
|
||||
txt.plot(0,24)
|
||||
|
||||
ubyte Y
|
||||
ubyte ub=200
|
||||
@ -21,7 +20,7 @@ main {
|
||||
word[3] warr = -1000
|
||||
float[3] flarr = 999.99
|
||||
|
||||
c64scr.print("++\n")
|
||||
txt.print("++\n")
|
||||
ub++
|
||||
bb++
|
||||
uw++
|
||||
@ -52,7 +51,7 @@ main {
|
||||
check_uw(uwarr[1], 2001)
|
||||
check_w(warr[1], -999)
|
||||
|
||||
c64scr.print("--\n")
|
||||
txt.print("--\n")
|
||||
ub--
|
||||
bb--
|
||||
uw--
|
||||
@ -81,58 +80,58 @@ main {
|
||||
|
||||
sub check_ub(ubyte value, ubyte expected) {
|
||||
if value==expected
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print(" ubyte ")
|
||||
c64scr.print_ub(value)
|
||||
txt.print("err! ")
|
||||
txt.print(" ubyte ")
|
||||
txt.print_ub(value)
|
||||
c64.CHROUT(',')
|
||||
c64scr.print_ub(expected)
|
||||
txt.print_ub(expected)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub check_b(byte value, byte expected) {
|
||||
if value==expected
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print(" byte ")
|
||||
c64scr.print_b(value)
|
||||
txt.print("err! ")
|
||||
txt.print(" byte ")
|
||||
txt.print_b(value)
|
||||
c64.CHROUT(',')
|
||||
c64scr.print_b(expected)
|
||||
txt.print_b(expected)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub check_uw(uword value, uword expected) {
|
||||
if value==expected
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print(" uword ")
|
||||
c64scr.print_uw(value)
|
||||
txt.print("err! ")
|
||||
txt.print(" uword ")
|
||||
txt.print_uw(value)
|
||||
c64.CHROUT(',')
|
||||
c64scr.print_uw(expected)
|
||||
txt.print_uw(expected)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub check_w(word value, word expected) {
|
||||
if value==expected
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print(" word ")
|
||||
c64scr.print_w(value)
|
||||
txt.print("err! ")
|
||||
txt.print(" word ")
|
||||
txt.print_w(value)
|
||||
c64.CHROUT(',')
|
||||
c64scr.print_w(expected)
|
||||
txt.print_w(expected)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub check_fl(float value, float expected) {
|
||||
if value==expected
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print(" float ")
|
||||
txt.print("err! ")
|
||||
txt.print(" float ")
|
||||
c64flt.print_f(value)
|
||||
c64.CHROUT(',')
|
||||
c64flt.print_f(expected)
|
||||
|
@ -1,8 +1,9 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64flt
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
; TODO implement REMAINDER asmgeneration
|
||||
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
@ -20,30 +21,30 @@ main {
|
||||
sub remainder_ubyte(ubyte a1, ubyte a2, ubyte c) {
|
||||
ubyte r = a1%a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("ubyte ")
|
||||
c64scr.print_ub(a1)
|
||||
c64scr.print(" % ")
|
||||
c64scr.print_ub(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_ub(r)
|
||||
txt.print("err! ")
|
||||
txt.print("ubyte ")
|
||||
txt.print_ub(a1)
|
||||
txt.print(" % ")
|
||||
txt.print_ub(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_ub(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
sub remainder_uword(uword a1, uword a2, uword c) {
|
||||
uword r = a1%a2
|
||||
if r==c
|
||||
c64scr.print(" ok ")
|
||||
txt.print(" ok ")
|
||||
else
|
||||
c64scr.print("err! ")
|
||||
c64scr.print("uword ")
|
||||
c64scr.print_uw(a1)
|
||||
c64scr.print(" % ")
|
||||
c64scr.print_uw(a2)
|
||||
c64scr.print(" = ")
|
||||
c64scr.print_uw(r)
|
||||
txt.print("err! ")
|
||||
txt.print("uword ")
|
||||
txt.print_uw(a1)
|
||||
txt.print(" % ")
|
||||
txt.print_uw(a2)
|
||||
txt.print(" = ")
|
||||
txt.print_uw(r)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
%import c64flt
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -18,113 +19,113 @@ main {
|
||||
b1 = 10
|
||||
b2 = 10
|
||||
if sgn(b2-b1) != 0
|
||||
c64scr.print("sgn1 error1\n")
|
||||
txt.print("sgn1 error1\n")
|
||||
|
||||
b1 = -100
|
||||
b2 = -100
|
||||
if sgn(b2-b1) != 0
|
||||
c64scr.print("sgn1 error2\n")
|
||||
txt.print("sgn1 error2\n")
|
||||
|
||||
ub1 = 200
|
||||
ub2 = 200
|
||||
if sgn(ub2-ub1) != 0
|
||||
c64scr.print("sgn1 error3\n")
|
||||
txt.print("sgn1 error3\n")
|
||||
|
||||
w1 = 100
|
||||
w2 = 100
|
||||
if sgn(w2-w1) != 0
|
||||
c64scr.print("sgn1 error4\n")
|
||||
txt.print("sgn1 error4\n")
|
||||
|
||||
w1 = -2000
|
||||
w2 = -2000
|
||||
if sgn(w2-w1) != 0
|
||||
c64scr.print("sgn1 error5\n")
|
||||
txt.print("sgn1 error5\n")
|
||||
|
||||
uw1 = 999
|
||||
uw2 = 999
|
||||
if sgn(uw2-uw1) != 0
|
||||
c64scr.print("sgn1 error6\n")
|
||||
txt.print("sgn1 error6\n")
|
||||
|
||||
f1 = 3.45
|
||||
f2 = 3.45
|
||||
if sgn(f2-f1) != 0
|
||||
c64scr.print("sgn1 error7\n")
|
||||
txt.print("sgn1 error7\n")
|
||||
|
||||
|
||||
; -1
|
||||
b1 = 11
|
||||
b2 = 10
|
||||
if sgn(b2-b1) != -1
|
||||
c64scr.print("sgn2 error1\n")
|
||||
txt.print("sgn2 error1\n")
|
||||
|
||||
b1 = -10
|
||||
b2 = -100
|
||||
if sgn(b2-b1) != -1
|
||||
c64scr.print("sgn2 error2\n")
|
||||
txt.print("sgn2 error2\n")
|
||||
|
||||
ub1 = 202
|
||||
ub2 = 200
|
||||
if sgn(ub2 as byte - ub1 as byte) != -1
|
||||
c64scr.print("sgn2 error3\n")
|
||||
txt.print("sgn2 error3\n")
|
||||
|
||||
w1 = 101
|
||||
w2 = 100
|
||||
if sgn(w2-w1) != -1
|
||||
c64scr.print("sgn2 error4\n")
|
||||
txt.print("sgn2 error4\n")
|
||||
|
||||
w1 = -200
|
||||
w2 = -2000
|
||||
if sgn(w2-w1) != -1
|
||||
c64scr.print("sgn2 error5\n")
|
||||
txt.print("sgn2 error5\n")
|
||||
|
||||
uw1 = 2222
|
||||
uw2 = 999
|
||||
if sgn((uw2 as word) - (uw1 as word)) != -1
|
||||
c64scr.print("sgn2 error6a\n")
|
||||
txt.print("sgn2 error6a\n")
|
||||
if sgn(uw2 - uw1) != 1 ; always 0 or 1 if unsigned
|
||||
c64scr.print("sgn2 error6b\n")
|
||||
txt.print("sgn2 error6b\n")
|
||||
|
||||
f1 = 3.45
|
||||
f2 = 1.11
|
||||
if sgn(f2-f1) != -1
|
||||
c64scr.print("sgn2 error7\n")
|
||||
txt.print("sgn2 error7\n")
|
||||
|
||||
; +1
|
||||
b1 = 11
|
||||
b2 = 20
|
||||
if sgn(b2-b1) != 1
|
||||
c64scr.print("sgn3 error1\n")
|
||||
txt.print("sgn3 error1\n")
|
||||
|
||||
b1 = -10
|
||||
b2 = -1
|
||||
if sgn(b2-b1) != 1
|
||||
c64scr.print("sgn3 error2\n")
|
||||
txt.print("sgn3 error2\n")
|
||||
|
||||
ub1 = 202
|
||||
ub2 = 205
|
||||
if sgn(ub2-ub1) != 1
|
||||
c64scr.print("sgn3 error3\n")
|
||||
txt.print("sgn3 error3\n")
|
||||
|
||||
w1 = 101
|
||||
w2 = 200
|
||||
if sgn(w2-w1) != 1
|
||||
c64scr.print("sgn3 error4\n")
|
||||
txt.print("sgn3 error4\n")
|
||||
|
||||
w1 = -200
|
||||
w2 = -20
|
||||
if sgn(w2-w1) != 1
|
||||
c64scr.print("sgn3 error5\n")
|
||||
txt.print("sgn3 error5\n")
|
||||
|
||||
uw1 = 2222
|
||||
uw2 = 9999
|
||||
if sgn(uw2-uw1) != 1
|
||||
c64scr.print("sgn3 error6\n")
|
||||
txt.print("sgn3 error6\n")
|
||||
|
||||
f1 = 3.45
|
||||
f2 = 5.11
|
||||
if sgn(f2-f1) != 1
|
||||
c64scr.print("sgn3 error7\n")
|
||||
txt.print("sgn3 error7\n")
|
||||
|
||||
c64scr.print("should see no sgn errors\n")
|
||||
txt.print("should see no sgn errors\n")
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -15,7 +15,7 @@ main {
|
||||
|
||||
c64.SCROLX &= %11110111 ; 38 column mode
|
||||
|
||||
c64utils.set_rasterirq(1) ; enable animation
|
||||
c64.set_rasterirq(1) ; enable animation
|
||||
|
||||
ubyte target_height = 10
|
||||
ubyte active_height = 24
|
||||
@ -43,7 +43,7 @@ main {
|
||||
}
|
||||
|
||||
perform_scroll = false
|
||||
c64scr.scroll_left_full(true)
|
||||
txt.scroll_left_full(true)
|
||||
if c64.RASTER & 1
|
||||
c64.SPXY[1] ++
|
||||
else
|
||||
@ -51,17 +51,17 @@ main {
|
||||
|
||||
ubyte yy
|
||||
for yy in 0 to active_height-1 {
|
||||
c64scr.setcc(39, yy, 32, 2) ; clear top of screen
|
||||
txt.setcc(39, yy, 32, 2) ; clear top of screen
|
||||
}
|
||||
c64scr.setcc(39, active_height, mountain, 8) ; mountain edge
|
||||
txt.setcc(39, active_height, mountain, 8) ; mountain edge
|
||||
for yy in active_height+1 to 24 {
|
||||
c64scr.setcc(39, yy, 160, 8) ; draw mountain
|
||||
txt.setcc(39, yy, 160, 8) ; draw mountain
|
||||
}
|
||||
|
||||
yy = rnd()
|
||||
if yy > 100 {
|
||||
; draw a star
|
||||
c64scr.setcc(39, yy % (active_height-1), '.', rnd())
|
||||
txt.setcc(39, yy % (active_height-1), '.', rnd())
|
||||
}
|
||||
|
||||
if yy > 200 {
|
||||
@ -74,12 +74,12 @@ main {
|
||||
tree = 65
|
||||
if rnd() > 130
|
||||
treecolor = 13
|
||||
c64scr.setcc(39, active_height, tree, treecolor)
|
||||
txt.setcc(39, active_height, tree, treecolor)
|
||||
}
|
||||
|
||||
if yy > 235 {
|
||||
; draw a camel
|
||||
c64scr.setcc(39, active_height, 94, 9)
|
||||
txt.setcc(39, active_height, 94, 9)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,12 @@
|
||||
%zeropage basicsafe
|
||||
%import c64lib
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
c64scr.print("playing the music from boulderdash,\nmade in 1984 by peter liepa.\n\n")
|
||||
c64utils.set_rasterirq(60) ; enable raster irq
|
||||
txt.print("playing the music from boulderdash,\nmade in 1984 by peter liepa.\n\n")
|
||||
c64.set_rasterirq(60) ; enable raster irq
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64lib
|
||||
%import c64textio
|
||||
|
||||
main {
|
||||
|
||||
@ -12,7 +12,7 @@ sub start() {
|
||||
c64.SR2 = %00000000
|
||||
c64.MVOL = 15
|
||||
|
||||
c64scr.print("will play the music from boulderdash,\nmade in 1984 by peter liepa.\npress enter to start: ")
|
||||
txt.print("will play the music from boulderdash,\nmade in 1984 by peter liepa.\npress enter to start: ")
|
||||
void c64.CHRIN()
|
||||
c64.CLEARSCR()
|
||||
|
||||
@ -46,10 +46,10 @@ sub delay() {
|
||||
|
||||
sub print_notes(ubyte n1, ubyte n2) {
|
||||
c64.CHROUT('\n')
|
||||
c64scr.plot(n1/2, 24)
|
||||
txt.plot(n1/2, 24)
|
||||
c64.COLOR=7
|
||||
c64.CHROUT('Q')
|
||||
c64scr.plot(n2/2, 24)
|
||||
txt.plot(n2/2, 24)
|
||||
c64.COLOR=4
|
||||
c64.CHROUT('Q')
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64lib
|
||||
%import c64textio
|
||||
|
||||
; bitmap pixel graphics module for the C64
|
||||
; only black/white monchrome for now
|
||||
@ -18,7 +18,7 @@ graphics {
|
||||
|
||||
sub clear_screen() {
|
||||
memset(bitmap_address, 320*200/8, 0)
|
||||
c64scr.clear_screen($10, 0) ; pixel color $1 (white) backround $0 (black)
|
||||
txt.clear_screen($10, 0) ; pixel color $1 (white) backround $0 (black)
|
||||
}
|
||||
|
||||
sub line(uword x1, ubyte y1, uword x2, ubyte y2) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
@ -12,98 +12,98 @@ main {
|
||||
v1 = 100
|
||||
v2 = 127
|
||||
if v1==v2
|
||||
c64scr.print("error in 100==127!\n")
|
||||
txt.print("error in 100==127!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 not == 127\n")
|
||||
txt.print("ok: 100 not == 127\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("ok: 100 != 127\n")
|
||||
txt.print("ok: 100 != 127\n")
|
||||
else
|
||||
c64scr.print("error in 100!=127!\n")
|
||||
txt.print("error in 100!=127!\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("ok: 100 < 127\n")
|
||||
txt.print("ok: 100 < 127\n")
|
||||
else
|
||||
c64scr.print("error in 100<127!\n")
|
||||
txt.print("error in 100<127!\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: 100 <= 127\n")
|
||||
txt.print("ok: 100 <= 127\n")
|
||||
else
|
||||
c64scr.print("error in 100<=127!\n")
|
||||
txt.print("error in 100<=127!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in 100>127!\n")
|
||||
txt.print("error in 100>127!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 is not >127\n")
|
||||
txt.print("ok: 100 is not >127\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("error in 100>=127!\n")
|
||||
txt.print("error in 100>=127!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 is not >=127\n")
|
||||
txt.print("ok: 100 is not >=127\n")
|
||||
|
||||
|
||||
v1 = 125
|
||||
v2 = 22
|
||||
if v1==v2
|
||||
c64scr.print("error in 125==22!\n")
|
||||
txt.print("error in 125==22!\n")
|
||||
else
|
||||
c64scr.print("ok: 125 not == 22\n")
|
||||
txt.print("ok: 125 not == 22\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("ok: 125 != 22\n")
|
||||
txt.print("ok: 125 != 22\n")
|
||||
else
|
||||
c64scr.print("error in 125!=22!\n")
|
||||
txt.print("error in 125!=22!\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in 125<22!\n")
|
||||
txt.print("error in 125<22!\n")
|
||||
else
|
||||
c64scr.print("ok: 125 is not < 22\n")
|
||||
txt.print("ok: 125 is not < 22\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("error in 125<=22!\n")
|
||||
txt.print("error in 125<=22!\n")
|
||||
else
|
||||
c64scr.print("ok: 125 is not <= 22\n")
|
||||
txt.print("ok: 125 is not <= 22\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("ok: 125 > 22\n")
|
||||
txt.print("ok: 125 > 22\n")
|
||||
else
|
||||
c64scr.print("error in 125>22!\n")
|
||||
txt.print("error in 125>22!\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: 125 >= 22\n")
|
||||
txt.print("ok: 125 >= 22\n")
|
||||
else
|
||||
c64scr.print("error in 125>=22!\n")
|
||||
txt.print("error in 125>=22!\n")
|
||||
|
||||
v1 = 22
|
||||
v2 = 22
|
||||
if v1==v2
|
||||
c64scr.print("ok: 22 == 22\n")
|
||||
txt.print("ok: 22 == 22\n")
|
||||
else
|
||||
c64scr.print("error in 22==22!\n")
|
||||
txt.print("error in 22==22!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("error in 22!=22!\n")
|
||||
txt.print("error in 22!=22!\n")
|
||||
else
|
||||
c64scr.print("ok: 22 is not != 22\n")
|
||||
txt.print("ok: 22 is not != 22\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in 22<22!\n")
|
||||
txt.print("error in 22<22!\n")
|
||||
else
|
||||
c64scr.print("ok: 22 is not < 22\n")
|
||||
txt.print("ok: 22 is not < 22\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: 22 <= 22\n")
|
||||
txt.print("ok: 22 <= 22\n")
|
||||
else
|
||||
c64scr.print("error in 22<=22!\n")
|
||||
txt.print("error in 22<=22!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in 22>22!\n")
|
||||
txt.print("error in 22>22!\n")
|
||||
else
|
||||
c64scr.print("ok: 22 is not > 22\n")
|
||||
txt.print("ok: 22 is not > 22\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: 22 >= 22\n")
|
||||
txt.print("ok: 22 >= 22\n")
|
||||
else
|
||||
c64scr.print("error in 22>=22!\n")
|
||||
txt.print("error in 22>=22!\n")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%import c64flt
|
||||
%zeropage basicsafe
|
||||
|
||||
@ -12,98 +12,98 @@ main {
|
||||
v1 = 1.11
|
||||
v2 = 699.99
|
||||
if v1==v2
|
||||
c64scr.print("error in 1.11==699.99!\n")
|
||||
txt.print("error in 1.11==699.99!\n")
|
||||
else
|
||||
c64scr.print("ok: 1.11 not == 699.99\n")
|
||||
txt.print("ok: 1.11 not == 699.99\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("ok: 1.11 != 699.99\n")
|
||||
txt.print("ok: 1.11 != 699.99\n")
|
||||
else
|
||||
c64scr.print("error in 1.11!=699.99!\n")
|
||||
txt.print("error in 1.11!=699.99!\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("ok: 1.11 < 699.99\n")
|
||||
txt.print("ok: 1.11 < 699.99\n")
|
||||
else
|
||||
c64scr.print("error in 1.11<699.99!\n")
|
||||
txt.print("error in 1.11<699.99!\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: 1.11 <= 699.99\n")
|
||||
txt.print("ok: 1.11 <= 699.99\n")
|
||||
else
|
||||
c64scr.print("error in 1.11<=699.99!\n")
|
||||
txt.print("error in 1.11<=699.99!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in 1.11>699.99!\n")
|
||||
txt.print("error in 1.11>699.99!\n")
|
||||
else
|
||||
c64scr.print("ok: 1.11 is not >699.99\n")
|
||||
txt.print("ok: 1.11 is not >699.99\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("error in 1.11>=699.99!\n")
|
||||
txt.print("error in 1.11>=699.99!\n")
|
||||
else
|
||||
c64scr.print("ok: 1.11 is not >=699.99\n")
|
||||
txt.print("ok: 1.11 is not >=699.99\n")
|
||||
|
||||
|
||||
v1 = 555.5
|
||||
v2 = -22.2
|
||||
if v1==v2
|
||||
c64scr.print("error in 555.5==-22.2!\n")
|
||||
txt.print("error in 555.5==-22.2!\n")
|
||||
else
|
||||
c64scr.print("ok: 555.5 not == -22.2\n")
|
||||
txt.print("ok: 555.5 not == -22.2\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("ok: 555.5 != -22.2\n")
|
||||
txt.print("ok: 555.5 != -22.2\n")
|
||||
else
|
||||
c64scr.print("error in 555.5!=-22.2!\n")
|
||||
txt.print("error in 555.5!=-22.2!\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in 555.5<-22.2!\n")
|
||||
txt.print("error in 555.5<-22.2!\n")
|
||||
else
|
||||
c64scr.print("ok: 555.5 is not < -22.2\n")
|
||||
txt.print("ok: 555.5 is not < -22.2\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("error in 555.5<=-22.2!\n")
|
||||
txt.print("error in 555.5<=-22.2!\n")
|
||||
else
|
||||
c64scr.print("ok: 555.5 is not <= -22.2\n")
|
||||
txt.print("ok: 555.5 is not <= -22.2\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("ok: 555.5 > -22.2\n")
|
||||
txt.print("ok: 555.5 > -22.2\n")
|
||||
else
|
||||
c64scr.print("error in 555.5>-22.2!\n")
|
||||
txt.print("error in 555.5>-22.2!\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: 555.5 >= -22.2\n")
|
||||
txt.print("ok: 555.5 >= -22.2\n")
|
||||
else
|
||||
c64scr.print("error in 555.5>=-22.2!\n")
|
||||
txt.print("error in 555.5>=-22.2!\n")
|
||||
|
||||
v1 = -22.2
|
||||
v2 = -22.2
|
||||
if v1==v2
|
||||
c64scr.print("ok: -22.2 == -22.2\n")
|
||||
txt.print("ok: -22.2 == -22.2\n")
|
||||
else
|
||||
c64scr.print("error in -22.2==-22.2!\n")
|
||||
txt.print("error in -22.2==-22.2!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("error in -22.2!=-22.2!\n")
|
||||
txt.print("error in -22.2!=-22.2!\n")
|
||||
else
|
||||
c64scr.print("ok: -22.2 is not != -22.2\n")
|
||||
txt.print("ok: -22.2 is not != -22.2\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in -22.2<-22.2!\n")
|
||||
txt.print("error in -22.2<-22.2!\n")
|
||||
else
|
||||
c64scr.print("ok: -22.2 is not < -22.2\n")
|
||||
txt.print("ok: -22.2 is not < -22.2\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: -22.2 <= -22.2\n")
|
||||
txt.print("ok: -22.2 <= -22.2\n")
|
||||
else
|
||||
c64scr.print("error in -22.2<=-22.2!\n")
|
||||
txt.print("error in -22.2<=-22.2!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in -22.2>-22.2!\n")
|
||||
txt.print("error in -22.2>-22.2!\n")
|
||||
else
|
||||
c64scr.print("ok: -22.2 is not > -22.2\n")
|
||||
txt.print("ok: -22.2 is not > -22.2\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: -22.2 >= -22.2\n")
|
||||
txt.print("ok: -22.2 >= -22.2\n")
|
||||
else
|
||||
c64scr.print("error in -22.2>=-22.2!\n")
|
||||
txt.print("error in -22.2>=-22.2!\n")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
@ -12,98 +12,98 @@ main {
|
||||
v1 = 100
|
||||
v2 = 200
|
||||
if v1==v2
|
||||
c64scr.print("error in 100==200!\n")
|
||||
txt.print("error in 100==200!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 not == 200\n")
|
||||
txt.print("ok: 100 not == 200\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("ok: 100 != 200\n")
|
||||
txt.print("ok: 100 != 200\n")
|
||||
else
|
||||
c64scr.print("error in 100!=200!\n")
|
||||
txt.print("error in 100!=200!\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("ok: 100 < 200\n")
|
||||
txt.print("ok: 100 < 200\n")
|
||||
else
|
||||
c64scr.print("error in 100<200!\n")
|
||||
txt.print("error in 100<200!\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: 100 <= 200\n")
|
||||
txt.print("ok: 100 <= 200\n")
|
||||
else
|
||||
c64scr.print("error in 100<=200!\n")
|
||||
txt.print("error in 100<=200!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in 100>200!\n")
|
||||
txt.print("error in 100>200!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 is not >200\n")
|
||||
txt.print("ok: 100 is not >200\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("error in 100>=200!\n")
|
||||
txt.print("error in 100>=200!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 is not >=200\n")
|
||||
txt.print("ok: 100 is not >=200\n")
|
||||
|
||||
|
||||
v1 = 155
|
||||
v2 = 22
|
||||
if v1==v2
|
||||
c64scr.print("error in 155==22!\n")
|
||||
txt.print("error in 155==22!\n")
|
||||
else
|
||||
c64scr.print("ok: 155 not == 22\n")
|
||||
txt.print("ok: 155 not == 22\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("ok: 155 != 22\n")
|
||||
txt.print("ok: 155 != 22\n")
|
||||
else
|
||||
c64scr.print("error in 155!=22!\n")
|
||||
txt.print("error in 155!=22!\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in 155<22!\n")
|
||||
txt.print("error in 155<22!\n")
|
||||
else
|
||||
c64scr.print("ok: 155 is not < 22\n")
|
||||
txt.print("ok: 155 is not < 22\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("error in 155<=22!\n")
|
||||
txt.print("error in 155<=22!\n")
|
||||
else
|
||||
c64scr.print("ok: 155 is not <= 22\n")
|
||||
txt.print("ok: 155 is not <= 22\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("ok: 155 > 22\n")
|
||||
txt.print("ok: 155 > 22\n")
|
||||
else
|
||||
c64scr.print("error in 155>22!\n")
|
||||
txt.print("error in 155>22!\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: 155 >= 22\n")
|
||||
txt.print("ok: 155 >= 22\n")
|
||||
else
|
||||
c64scr.print("error in 155>=22!\n")
|
||||
txt.print("error in 155>=22!\n")
|
||||
|
||||
v1 = 22
|
||||
v2 = 22
|
||||
if v1==v2
|
||||
c64scr.print("ok: 22 == 22\n")
|
||||
txt.print("ok: 22 == 22\n")
|
||||
else
|
||||
c64scr.print("error in 22==22!\n")
|
||||
txt.print("error in 22==22!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("error in 22!=22!\n")
|
||||
txt.print("error in 22!=22!\n")
|
||||
else
|
||||
c64scr.print("ok: 22 is not != 22\n")
|
||||
txt.print("ok: 22 is not != 22\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in 22<22!\n")
|
||||
txt.print("error in 22<22!\n")
|
||||
else
|
||||
c64scr.print("ok: 22 is not < 22\n")
|
||||
txt.print("ok: 22 is not < 22\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: 22 <= 22\n")
|
||||
txt.print("ok: 22 <= 22\n")
|
||||
else
|
||||
c64scr.print("error in 22<=22!\n")
|
||||
txt.print("error in 22<=22!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in 22>22!\n")
|
||||
txt.print("error in 22>22!\n")
|
||||
else
|
||||
c64scr.print("ok: 22 is not > 22\n")
|
||||
txt.print("ok: 22 is not > 22\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: 22 >= 22\n")
|
||||
txt.print("ok: 22 >= 22\n")
|
||||
else
|
||||
c64scr.print("error in 22>=22!\n")
|
||||
txt.print("error in 22>=22!\n")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
@ -12,98 +12,98 @@ main {
|
||||
v1 = 100
|
||||
v2 = 64444
|
||||
if v1==v2
|
||||
c64scr.print("error in 100==64444!\n")
|
||||
txt.print("error in 100==64444!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 not == 64444\n")
|
||||
txt.print("ok: 100 not == 64444\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("ok: 100 != 64444\n")
|
||||
txt.print("ok: 100 != 64444\n")
|
||||
else
|
||||
c64scr.print("error in 100!=64444!\n")
|
||||
txt.print("error in 100!=64444!\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("ok: 100 < 64444\n")
|
||||
txt.print("ok: 100 < 64444\n")
|
||||
else
|
||||
c64scr.print("error in 100<64444!\n")
|
||||
txt.print("error in 100<64444!\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: 100 <= 64444\n")
|
||||
txt.print("ok: 100 <= 64444\n")
|
||||
else
|
||||
c64scr.print("error in 100<=64444!\n")
|
||||
txt.print("error in 100<=64444!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in 100>64444!\n")
|
||||
txt.print("error in 100>64444!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 is not >64444\n")
|
||||
txt.print("ok: 100 is not >64444\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("error in 100>=64444!\n")
|
||||
txt.print("error in 100>=64444!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 is not >=64444\n")
|
||||
txt.print("ok: 100 is not >=64444\n")
|
||||
|
||||
|
||||
v1 = 5555
|
||||
v2 = 322
|
||||
if v1==v2
|
||||
c64scr.print("error in 5555==322!\n")
|
||||
txt.print("error in 5555==322!\n")
|
||||
else
|
||||
c64scr.print("ok: 5555 not == 322\n")
|
||||
txt.print("ok: 5555 not == 322\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("ok: 5555 != 322\n")
|
||||
txt.print("ok: 5555 != 322\n")
|
||||
else
|
||||
c64scr.print("error in 5555!=322!\n")
|
||||
txt.print("error in 5555!=322!\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in 5555<322!\n")
|
||||
txt.print("error in 5555<322!\n")
|
||||
else
|
||||
c64scr.print("ok: 5555 is not < 322\n")
|
||||
txt.print("ok: 5555 is not < 322\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("error in 5555<=322!\n")
|
||||
txt.print("error in 5555<=322!\n")
|
||||
else
|
||||
c64scr.print("ok: 5555 is not <= 322\n")
|
||||
txt.print("ok: 5555 is not <= 322\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("ok: 5555 > 322\n")
|
||||
txt.print("ok: 5555 > 322\n")
|
||||
else
|
||||
c64scr.print("error in 5555>322!\n")
|
||||
txt.print("error in 5555>322!\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: 5555 >= 322\n")
|
||||
txt.print("ok: 5555 >= 322\n")
|
||||
else
|
||||
c64scr.print("error in 5555>=322!\n")
|
||||
txt.print("error in 5555>=322!\n")
|
||||
|
||||
v1 = 322
|
||||
v2 = 322
|
||||
if v1==v2
|
||||
c64scr.print("ok: 322 == 322\n")
|
||||
txt.print("ok: 322 == 322\n")
|
||||
else
|
||||
c64scr.print("error in 322==322!\n")
|
||||
txt.print("error in 322==322!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("error in 322!=322!\n")
|
||||
txt.print("error in 322!=322!\n")
|
||||
else
|
||||
c64scr.print("ok: 322 is not != 322\n")
|
||||
txt.print("ok: 322 is not != 322\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in 322<322!\n")
|
||||
txt.print("error in 322<322!\n")
|
||||
else
|
||||
c64scr.print("ok: 322 is not < 322\n")
|
||||
txt.print("ok: 322 is not < 322\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: 322 <= 322\n")
|
||||
txt.print("ok: 322 <= 322\n")
|
||||
else
|
||||
c64scr.print("error in 322<=322!\n")
|
||||
txt.print("error in 322<=322!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in 322>322!\n")
|
||||
txt.print("error in 322>322!\n")
|
||||
else
|
||||
c64scr.print("ok: 322 is not > 322\n")
|
||||
txt.print("ok: 322 is not > 322\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: 322 >= 322\n")
|
||||
txt.print("ok: 322 >= 322\n")
|
||||
else
|
||||
c64scr.print("error in 322>=322!\n")
|
||||
txt.print("error in 322>=322!\n")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
@ -12,130 +12,130 @@ main {
|
||||
v1 = 100
|
||||
v2 = 30333
|
||||
if v1==v2
|
||||
c64scr.print("error in 100==30333!\n")
|
||||
txt.print("error in 100==30333!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 not == 30333\n")
|
||||
txt.print("ok: 100 not == 30333\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("ok: 100 != 30333\n")
|
||||
txt.print("ok: 100 != 30333\n")
|
||||
else
|
||||
c64scr.print("error in 100!=30333!\n")
|
||||
txt.print("error in 100!=30333!\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("ok: 100 < 30333\n")
|
||||
txt.print("ok: 100 < 30333\n")
|
||||
else
|
||||
c64scr.print("error in 100<30333!\n")
|
||||
txt.print("error in 100<30333!\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: 100 <= 30333\n")
|
||||
txt.print("ok: 100 <= 30333\n")
|
||||
else
|
||||
c64scr.print("error in 100<=30333!\n")
|
||||
txt.print("error in 100<=30333!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in 100>30333!\n")
|
||||
txt.print("error in 100>30333!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 is not >30333\n")
|
||||
txt.print("ok: 100 is not >30333\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("error in 100>=30333!\n")
|
||||
txt.print("error in 100>=30333!\n")
|
||||
else
|
||||
c64scr.print("ok: 100 is not >=30333\n")
|
||||
txt.print("ok: 100 is not >=30333\n")
|
||||
|
||||
|
||||
v1 = 125
|
||||
v2 = -222
|
||||
if v1==v2
|
||||
c64scr.print("error in 125==-222!\n")
|
||||
txt.print("error in 125==-222!\n")
|
||||
else
|
||||
c64scr.print("ok: 125 not == -222\n")
|
||||
txt.print("ok: 125 not == -222\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("ok: 125 != -222\n")
|
||||
txt.print("ok: 125 != -222\n")
|
||||
else
|
||||
c64scr.print("error in 125!=-222!\n")
|
||||
txt.print("error in 125!=-222!\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in 125<-222!\n")
|
||||
txt.print("error in 125<-222!\n")
|
||||
else
|
||||
c64scr.print("ok: 125 is not < -222\n")
|
||||
txt.print("ok: 125 is not < -222\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("error in 125<=-222!\n")
|
||||
txt.print("error in 125<=-222!\n")
|
||||
else
|
||||
c64scr.print("ok: 125 is not <= -222\n")
|
||||
txt.print("ok: 125 is not <= -222\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("ok: 125 > -222\n")
|
||||
txt.print("ok: 125 > -222\n")
|
||||
else
|
||||
c64scr.print("error in 125>-222!\n")
|
||||
txt.print("error in 125>-222!\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: 125 >= -222\n")
|
||||
txt.print("ok: 125 >= -222\n")
|
||||
else
|
||||
c64scr.print("error in 125>=-222!\n")
|
||||
txt.print("error in 125>=-222!\n")
|
||||
|
||||
v1 = -222
|
||||
v2 = -222
|
||||
if v1==v2
|
||||
c64scr.print("ok: -222 == -222\n")
|
||||
txt.print("ok: -222 == -222\n")
|
||||
else
|
||||
c64scr.print("error in -222==-222!\n")
|
||||
txt.print("error in -222==-222!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("error in -222!=-222!\n")
|
||||
txt.print("error in -222!=-222!\n")
|
||||
else
|
||||
c64scr.print("ok: -222 is not != -222\n")
|
||||
txt.print("ok: -222 is not != -222\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in -222<-222!\n")
|
||||
txt.print("error in -222<-222!\n")
|
||||
else
|
||||
c64scr.print("ok: -222 is not < -222\n")
|
||||
txt.print("ok: -222 is not < -222\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: -222 <= -222\n")
|
||||
txt.print("ok: -222 <= -222\n")
|
||||
else
|
||||
c64scr.print("error in -222<=-222!\n")
|
||||
txt.print("error in -222<=-222!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in -222>-222!\n")
|
||||
txt.print("error in -222>-222!\n")
|
||||
else
|
||||
c64scr.print("ok: -222 is not > -222\n")
|
||||
txt.print("ok: -222 is not > -222\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: -222 >= -222\n")
|
||||
txt.print("ok: -222 >= -222\n")
|
||||
else
|
||||
c64scr.print("error in -222>=-222!\n")
|
||||
txt.print("error in -222>=-222!\n")
|
||||
|
||||
v1 = 1000
|
||||
v2 = 1000
|
||||
if v1==v2
|
||||
c64scr.print("ok: 1000 == 1000\n")
|
||||
txt.print("ok: 1000 == 1000\n")
|
||||
else
|
||||
c64scr.print("error in 1000==1000!\n")
|
||||
txt.print("error in 1000==1000!\n")
|
||||
|
||||
if v1!=v2
|
||||
c64scr.print("error in 1000!=1000!\n")
|
||||
txt.print("error in 1000!=1000!\n")
|
||||
else
|
||||
c64scr.print("ok: 1000 is not != 1000\n")
|
||||
txt.print("ok: 1000 is not != 1000\n")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print("error in 1000<1000!\n")
|
||||
txt.print("error in 1000<1000!\n")
|
||||
else
|
||||
c64scr.print("ok: 1000 is not < 1000\n")
|
||||
txt.print("ok: 1000 is not < 1000\n")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print("ok: 1000 <= 1000\n")
|
||||
txt.print("ok: 1000 <= 1000\n")
|
||||
else
|
||||
c64scr.print("error in 1000<=1000!\n")
|
||||
txt.print("error in 1000<=1000!\n")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print("error in 1000>1000!\n")
|
||||
txt.print("error in 1000>1000!\n")
|
||||
else
|
||||
c64scr.print("ok: 1000 is not > 1000\n")
|
||||
txt.print("ok: 1000 is not > 1000\n")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print("ok: 1000 >= 1000\n")
|
||||
txt.print("ok: 1000 >= 1000\n")
|
||||
else
|
||||
c64scr.print("error in 1000>=1000!\n")
|
||||
txt.print("error in 1000>=1000!\n")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -9,7 +9,7 @@ main {
|
||||
byte v2
|
||||
ubyte cr
|
||||
|
||||
c64scr.print("signed byte ")
|
||||
txt.print("signed byte ")
|
||||
|
||||
cr=v1==v2
|
||||
cr=v1==v2
|
||||
@ -39,52 +39,52 @@ main {
|
||||
; comparisons:
|
||||
v1=-20
|
||||
v2=125
|
||||
c64scr.print("v1=-20, v2=125\n")
|
||||
txt.print("v1=-20, v2=125\n")
|
||||
compare()
|
||||
|
||||
v1=80
|
||||
v2=80
|
||||
c64scr.print("v1 = v2 = 80\n")
|
||||
txt.print("v1 = v2 = 80\n")
|
||||
compare()
|
||||
|
||||
v1=20
|
||||
v2=-111
|
||||
c64scr.print("v1=20, v2=-111\n")
|
||||
txt.print("v1=20, v2=-111\n")
|
||||
compare()
|
||||
|
||||
return
|
||||
|
||||
sub compare() {
|
||||
c64scr.print(" == != < > <= >=\n")
|
||||
txt.print(" == != < > <= >=\n")
|
||||
|
||||
if v1==v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
if v1!=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%import c64flt
|
||||
%zeropage basicsafe
|
||||
|
||||
@ -10,7 +10,7 @@ main {
|
||||
float v2
|
||||
ubyte cr
|
||||
|
||||
c64scr.print("floating point ")
|
||||
txt.print("floating point ")
|
||||
|
||||
cr=v1==v2
|
||||
cr=v1==v2
|
||||
@ -40,67 +40,67 @@ main {
|
||||
; comparisons:
|
||||
v1=20
|
||||
v2=666.66
|
||||
c64scr.print("v1=20, v2=666.66\n")
|
||||
txt.print("v1=20, v2=666.66\n")
|
||||
compare()
|
||||
|
||||
v1=-20
|
||||
v2=666.66
|
||||
c64scr.print("v1=-20, v2=666.66\n")
|
||||
txt.print("v1=-20, v2=666.66\n")
|
||||
compare()
|
||||
|
||||
v1=666.66
|
||||
v2=555.55
|
||||
c64scr.print("v1=666.66, v2=555.55\n")
|
||||
txt.print("v1=666.66, v2=555.55\n")
|
||||
compare()
|
||||
|
||||
v1=3.1415
|
||||
v2=-3.1415
|
||||
c64scr.print("v1 = 3.1415, v2 = -3.1415\n")
|
||||
txt.print("v1 = 3.1415, v2 = -3.1415\n")
|
||||
compare()
|
||||
|
||||
v1=3.1415
|
||||
v2=3.1415
|
||||
c64scr.print("v1 = v2 = 3.1415\n")
|
||||
txt.print("v1 = v2 = 3.1415\n")
|
||||
compare()
|
||||
|
||||
v1=0
|
||||
v2=0
|
||||
c64scr.print("v1 = v2 = 0\n")
|
||||
txt.print("v1 = v2 = 0\n")
|
||||
compare()
|
||||
|
||||
return
|
||||
|
||||
sub compare() {
|
||||
c64scr.print(" == != < > <= >=\n")
|
||||
txt.print(" == != < > <= >=\n")
|
||||
|
||||
if v1==v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
if v1!=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -9,7 +9,7 @@ main {
|
||||
ubyte v2
|
||||
ubyte cr
|
||||
|
||||
c64scr.print("unsigned byte ")
|
||||
txt.print("unsigned byte ")
|
||||
|
||||
cr=v1==v2
|
||||
cr=v1==v2
|
||||
@ -39,52 +39,52 @@ main {
|
||||
; comparisons:
|
||||
v1=20
|
||||
v2=199
|
||||
c64scr.print("v1=20, v2=199\n")
|
||||
txt.print("v1=20, v2=199\n")
|
||||
compare()
|
||||
|
||||
v1=80
|
||||
v2=80
|
||||
c64scr.print("v1 = v2 = 80\n")
|
||||
txt.print("v1 = v2 = 80\n")
|
||||
compare()
|
||||
|
||||
v1=220
|
||||
v2=10
|
||||
c64scr.print("v1=220, v2=10\n")
|
||||
txt.print("v1=220, v2=10\n")
|
||||
compare()
|
||||
|
||||
return
|
||||
|
||||
sub compare() {
|
||||
c64scr.print(" == != < > <= >=\n")
|
||||
txt.print(" == != < > <= >=\n")
|
||||
|
||||
if v1==v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
if v1!=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -9,7 +9,7 @@ main {
|
||||
uword v2
|
||||
ubyte cr
|
||||
|
||||
c64scr.print("unsigned word ")
|
||||
txt.print("unsigned word ")
|
||||
|
||||
cr=v1==v2
|
||||
cr=v1==v2
|
||||
@ -39,82 +39,82 @@ main {
|
||||
; comparisons:
|
||||
v1=20
|
||||
v2=$00aa
|
||||
c64scr.print("v1=20, v2=$00aa\n")
|
||||
txt.print("v1=20, v2=$00aa\n")
|
||||
compare()
|
||||
|
||||
v1=20
|
||||
v2=$ea00
|
||||
c64scr.print("v1=20, v2=$ea00\n")
|
||||
txt.print("v1=20, v2=$ea00\n")
|
||||
compare()
|
||||
|
||||
v1=$c400
|
||||
v2=$22
|
||||
c64scr.print("v1=$c400, v2=$22\n")
|
||||
txt.print("v1=$c400, v2=$22\n")
|
||||
compare()
|
||||
|
||||
v1=$c400
|
||||
v2=$2a00
|
||||
c64scr.print("v1=$c400, v2=$2a00\n")
|
||||
txt.print("v1=$c400, v2=$2a00\n")
|
||||
compare()
|
||||
|
||||
v1=$c433
|
||||
v2=$2a00
|
||||
c64scr.print("v1=$c433, v2=$2a00\n")
|
||||
txt.print("v1=$c433, v2=$2a00\n")
|
||||
compare()
|
||||
|
||||
v1=$c433
|
||||
v2=$2aff
|
||||
c64scr.print("v1=$c433, v2=$2aff\n")
|
||||
txt.print("v1=$c433, v2=$2aff\n")
|
||||
compare()
|
||||
|
||||
v1=$aabb
|
||||
v2=$aabb
|
||||
c64scr.print("v1 = v2 = aabb\n")
|
||||
txt.print("v1 = v2 = aabb\n")
|
||||
compare()
|
||||
|
||||
v1=$aa00
|
||||
v2=$aa00
|
||||
c64scr.print("v1 = v2 = aa00\n")
|
||||
txt.print("v1 = v2 = aa00\n")
|
||||
compare()
|
||||
|
||||
v1=$aa
|
||||
v2=$aa
|
||||
c64scr.print("v1 = v2 = aa\n")
|
||||
txt.print("v1 = v2 = aa\n")
|
||||
compare()
|
||||
|
||||
return
|
||||
|
||||
sub compare() {
|
||||
c64scr.print(" == != < > <= >=\n")
|
||||
txt.print(" == != < > <= >=\n")
|
||||
|
||||
if v1==v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
if v1!=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -9,7 +9,7 @@ main {
|
||||
word v2
|
||||
ubyte cr
|
||||
|
||||
c64scr.print("signed word ")
|
||||
txt.print("signed word ")
|
||||
|
||||
cr=v1==v2
|
||||
cr=v1==v2
|
||||
@ -39,118 +39,118 @@ main {
|
||||
; comparisons:
|
||||
v1=20
|
||||
v2=$00aa
|
||||
c64scr.print("v1=20, v2=$00aa\n")
|
||||
txt.print("v1=20, v2=$00aa\n")
|
||||
compare()
|
||||
|
||||
v1=20
|
||||
v2=$7a00
|
||||
c64scr.print("v1=20, v2=$7a00\n")
|
||||
txt.print("v1=20, v2=$7a00\n")
|
||||
compare()
|
||||
|
||||
v1=$7400
|
||||
v2=$22
|
||||
c64scr.print("v1=$7400, v2=$22\n")
|
||||
txt.print("v1=$7400, v2=$22\n")
|
||||
compare()
|
||||
|
||||
v1=$7400
|
||||
v2=$2a00
|
||||
c64scr.print("v1=$7400, v2=$2a00\n")
|
||||
txt.print("v1=$7400, v2=$2a00\n")
|
||||
compare()
|
||||
|
||||
v1=$7433
|
||||
v2=$2a00
|
||||
c64scr.print("v1=$7433, v2=$2a00\n")
|
||||
txt.print("v1=$7433, v2=$2a00\n")
|
||||
compare()
|
||||
|
||||
v1=$7433
|
||||
v2=$2aff
|
||||
c64scr.print("v1=$7433, v2=$2aff\n")
|
||||
txt.print("v1=$7433, v2=$2aff\n")
|
||||
compare()
|
||||
|
||||
; with negative numbers:
|
||||
v1=-512
|
||||
v2=$00aa
|
||||
c64scr.print("v1=-512, v2=$00aa\n")
|
||||
txt.print("v1=-512, v2=$00aa\n")
|
||||
compare()
|
||||
|
||||
v1=-512
|
||||
v2=$7a00
|
||||
c64scr.print("v1=-512, v2=$7a00\n")
|
||||
txt.print("v1=-512, v2=$7a00\n")
|
||||
compare()
|
||||
|
||||
v1=$7400
|
||||
v2=-512
|
||||
c64scr.print("v1=$7400, v2=-512\n")
|
||||
txt.print("v1=$7400, v2=-512\n")
|
||||
compare()
|
||||
|
||||
v1=-20000
|
||||
v2=-1000
|
||||
c64scr.print("v1=-20000, v2=-1000\n")
|
||||
txt.print("v1=-20000, v2=-1000\n")
|
||||
compare()
|
||||
|
||||
v1=-1000
|
||||
v2=-20000
|
||||
c64scr.print("v1=-1000, v2=-20000\n")
|
||||
txt.print("v1=-1000, v2=-20000\n")
|
||||
compare()
|
||||
|
||||
v1=-1
|
||||
v2=32767
|
||||
c64scr.print("v1=-1, v2=32767\n")
|
||||
txt.print("v1=-1, v2=32767\n")
|
||||
compare()
|
||||
|
||||
v1=32767
|
||||
v2=-1
|
||||
c64scr.print("v1=32767, v2=-1\n")
|
||||
txt.print("v1=32767, v2=-1\n")
|
||||
compare()
|
||||
|
||||
v1=$7abb
|
||||
v2=$7abb
|
||||
c64scr.print("v1 = v2 = 7abb\n")
|
||||
txt.print("v1 = v2 = 7abb\n")
|
||||
compare()
|
||||
|
||||
v1=$7a00
|
||||
v2=$7a00
|
||||
c64scr.print("v1 = v2 = 7a00\n")
|
||||
txt.print("v1 = v2 = 7a00\n")
|
||||
compare()
|
||||
|
||||
v1=$aa
|
||||
v2=$aa
|
||||
c64scr.print("v1 = v2 = aa\n")
|
||||
txt.print("v1 = v2 = aa\n")
|
||||
compare()
|
||||
|
||||
return
|
||||
|
||||
sub compare() {
|
||||
c64scr.print(" == != < > <= >=\n")
|
||||
txt.print(" == != < > <= >=\n")
|
||||
|
||||
if v1==v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
if v1!=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1<v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1>v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1<=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
|
||||
if v1>=v2
|
||||
c64scr.print(" Q ")
|
||||
txt.print(" Q ")
|
||||
else
|
||||
c64scr.print(" . ")
|
||||
txt.print(" . ")
|
||||
c64.CHROUT('\n')
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%import c64flt
|
||||
|
||||
main {
|
||||
@ -21,15 +21,15 @@ main {
|
||||
float time=0.0
|
||||
repeat {
|
||||
rotate_vertices(time)
|
||||
c64scr.clear_screenchars(32)
|
||||
txt.clear_screenchars(32)
|
||||
draw_edges()
|
||||
time+=0.2
|
||||
c64scr.plot(0,0)
|
||||
c64scr.print("3d cube! (float) ")
|
||||
c64scr.print_ub(c64.TIME_LO)
|
||||
c64scr.print(" jiffies/fr = ")
|
||||
c64scr.print_ub(60/c64.TIME_LO)
|
||||
c64scr.print(" fps")
|
||||
txt.plot(0,0)
|
||||
txt.print("3d cube! (float) ")
|
||||
txt.print_ub(c64.TIME_LO)
|
||||
txt.print(" jiffies/fr = ")
|
||||
txt.print_ub(60/c64.TIME_LO)
|
||||
txt.print(" fps")
|
||||
c64.TIME_LO=0
|
||||
}
|
||||
}
|
||||
@ -81,7 +81,7 @@ main {
|
||||
persp = (5.0+rz)/(height as float)
|
||||
sx = rotatedx[i] / persp + width/2.0 as ubyte
|
||||
sy = rotatedy[i] / persp + height/2.0 as ubyte
|
||||
c64scr.setcc(sx, sy, 46, i+2)
|
||||
txt.setcc(sx, sy, 46, i+2)
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,7 +91,7 @@ main {
|
||||
persp = (5.0+rz)/(height as float)
|
||||
sx = rotatedx[i] / persp + width/2.0 as ubyte
|
||||
sy = rotatedy[i] / persp + height/2.0 as ubyte
|
||||
c64scr.setcc(sx, sy, 81, i+2)
|
||||
txt.setcc(sx, sy, 81, i+2)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,4 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64graphics
|
||||
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
|
||||
|
||||
spritedata $2000 {
|
||||
@ -89,12 +89,12 @@ main {
|
||||
anglex-=500
|
||||
angley+=217
|
||||
anglez+=452
|
||||
c64scr.plot(0,0)
|
||||
c64scr.print("3d cube! (sprites) ")
|
||||
c64scr.print_ub(c64.TIME_LO)
|
||||
c64scr.print(" jiffies/fr = ")
|
||||
c64scr.print_ub(60/c64.TIME_LO)
|
||||
c64scr.print(" fps")
|
||||
txt.plot(0,0)
|
||||
txt.print("3d cube! (sprites) ")
|
||||
txt.print_ub(c64.TIME_LO)
|
||||
txt.print(" jiffies/fr = ")
|
||||
txt.print_ub(60/c64.TIME_LO)
|
||||
txt.print(" fps")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
|
||||
main {
|
||||
|
||||
@ -23,17 +23,17 @@ main {
|
||||
uword anglez
|
||||
repeat {
|
||||
rotate_vertices(msb(anglex), msb(angley), msb(anglez))
|
||||
c64scr.clear_screenchars(32)
|
||||
txt.clear_screenchars(32)
|
||||
draw_edges()
|
||||
anglex+=1000
|
||||
angley+=433
|
||||
anglez+=907
|
||||
c64scr.plot(0,0)
|
||||
c64scr.print("3d cube! ")
|
||||
c64scr.print_ub(c64.TIME_LO)
|
||||
c64scr.print(" jiffies/fr = ")
|
||||
c64scr.print_ub(60/c64.TIME_LO)
|
||||
c64scr.print(" fps")
|
||||
txt.plot(0,0)
|
||||
txt.print("3d cube! ")
|
||||
txt.print_ub(c64.TIME_LO)
|
||||
txt.print(" jiffies/fr = ")
|
||||
txt.print_ub(60/c64.TIME_LO)
|
||||
txt.print(" fps")
|
||||
c64.TIME_LO=0
|
||||
}
|
||||
}
|
||||
@ -88,7 +88,7 @@ main {
|
||||
persp = 900 + rz/32
|
||||
sx = rotatedx[i] / persp as byte + width/2
|
||||
sy = rotatedy[i] / persp as byte + height/2
|
||||
c64scr.setcc(sx as ubyte, sy as ubyte, 46, 7)
|
||||
txt.setcc(sx as ubyte, sy as ubyte, 46, 7)
|
||||
}
|
||||
}
|
||||
|
||||
@ -98,7 +98,7 @@ main {
|
||||
persp = 900 + rz/32
|
||||
sx = rotatedx[i] / persp as byte + width/2
|
||||
sy = rotatedy[i] / persp as byte + height/2
|
||||
c64scr.setcc(sx as ubyte, sy as ubyte, 81, 7)
|
||||
txt.setcc(sx as ubyte, sy as ubyte, 81, 7)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,14 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
; This example computes the first 20 values of the Fibonacci sequence.
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
c64scr.print("fibonacci sequence\n")
|
||||
txt.print("fibonacci sequence\n")
|
||||
|
||||
repeat 21 {
|
||||
c64scr.print_uw(fib_next())
|
||||
txt.print_uw(fib_next())
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%import c64flt
|
||||
%zeropage basicsafe
|
||||
|
||||
@ -13,7 +13,7 @@ main {
|
||||
c64.VMCSB |= 2
|
||||
|
||||
; use optimized routine to write text
|
||||
c64scr.print("Hello!\n")
|
||||
txt.print("Hello!\n")
|
||||
|
||||
; use iteration to write text
|
||||
str question = "How are you?\n"
|
||||
@ -33,7 +33,7 @@ main {
|
||||
float minutes = floor(clock_seconds / 60)
|
||||
clock_seconds = floor(clock_seconds - minutes * 60.0)
|
||||
|
||||
c64scr.print("system time in ti$ is ")
|
||||
txt.print("system time in ti$ is ")
|
||||
c64flt.print_f(hours)
|
||||
c64.CHROUT(':')
|
||||
c64flt.print_f(minutes)
|
||||
@ -41,6 +41,6 @@ main {
|
||||
c64flt.print_f(clock_seconds)
|
||||
c64.CHROUT('\n')
|
||||
|
||||
c64scr.print("bye!\n")
|
||||
txt.print("bye!\n")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
%import c64lib
|
||||
%import c64graphics
|
||||
|
||||
main {
|
||||
|
@ -1,38 +1,38 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
c64scr.print("mid-point\ncircle\n and\nbresenham\nline\nalgorithms.\n")
|
||||
txt.print("mid-point\ncircle\n and\nbresenham\nline\nalgorithms.\n")
|
||||
|
||||
ubyte r
|
||||
for r in 3 to 12 step 3 {
|
||||
circle(20, 12, r)
|
||||
}
|
||||
|
||||
c64scr.print("enter for disc:")
|
||||
txt.print("enter for disc:")
|
||||
void c64.CHRIN()
|
||||
c64.CHROUT('\n')
|
||||
c64scr.clear_screen(' ', 1)
|
||||
txt.clear_screen(' ', 1)
|
||||
disc(20, 12, 12)
|
||||
|
||||
c64scr.print("enter for lines:")
|
||||
txt.print("enter for lines:")
|
||||
void c64.CHRIN()
|
||||
c64.CHROUT('\n')
|
||||
c64scr.clear_screen(' ', 1)
|
||||
txt.clear_screen(' ', 1)
|
||||
|
||||
line(1, 10, 38, 24)
|
||||
line(1, 20, 38, 2)
|
||||
line(20, 4, 10, 24)
|
||||
line(39, 16, 12, 0)
|
||||
|
||||
c64scr.print("enter for rectangles:")
|
||||
txt.print("enter for rectangles:")
|
||||
void c64.CHRIN()
|
||||
c64.CHROUT('\n')
|
||||
c64scr.clear_screen(' ', 1)
|
||||
txt.clear_screen(' ', 1)
|
||||
|
||||
rect(4, 8, 37, 23, false)
|
||||
rect(20, 12, 30, 20, true)
|
||||
@ -46,18 +46,18 @@ main {
|
||||
if fill {
|
||||
for y in y1 to y2 {
|
||||
for x in x1 to x2 {
|
||||
c64scr.setcc(x, y, 42, x+y)
|
||||
txt.setcc(x, y, 42, x+y)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for x in x1 to x2 {
|
||||
c64scr.setcc(x, y1, 42, 8)
|
||||
c64scr.setcc(x, y2, 42, 8)
|
||||
txt.setcc(x, y1, 42, 8)
|
||||
txt.setcc(x, y2, 42, 8)
|
||||
}
|
||||
if y2>y1 {
|
||||
for y in y1+1 to y2-1 {
|
||||
c64scr.setcc(x1, y, 42, 7)
|
||||
c64scr.setcc(x2, y, 42, 7)
|
||||
txt.setcc(x1, y, 42, 7)
|
||||
txt.setcc(x2, y, 42, 7)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -78,7 +78,7 @@ main {
|
||||
|
||||
if dx >= dy {
|
||||
repeat {
|
||||
c64scr.setcc(x, y, 42, 5)
|
||||
txt.setcc(x, y, 42, 5)
|
||||
if x==x2
|
||||
return
|
||||
x += ix
|
||||
@ -90,7 +90,7 @@ main {
|
||||
}
|
||||
} else {
|
||||
repeat {
|
||||
c64scr.setcc(x, y, 42, 5)
|
||||
txt.setcc(x, y, 42, 5)
|
||||
if y == y2
|
||||
return
|
||||
y += iy
|
||||
@ -110,14 +110,14 @@ main {
|
||||
byte decisionOver2 = 1-x as byte
|
||||
|
||||
while x>=y {
|
||||
c64scr.setcc(xcenter + x, ycenter + y as ubyte, 81, 1)
|
||||
c64scr.setcc(xcenter - x, ycenter + y as ubyte, 81, 2)
|
||||
c64scr.setcc(xcenter + x, ycenter - y as ubyte, 81, 3)
|
||||
c64scr.setcc(xcenter - x, ycenter - y as ubyte, 81, 4)
|
||||
c64scr.setcc(xcenter + y, ycenter + x as ubyte, 81, 5)
|
||||
c64scr.setcc(xcenter - y, ycenter + x as ubyte, 81, 6)
|
||||
c64scr.setcc(xcenter + y, ycenter - x as ubyte, 81, 7)
|
||||
c64scr.setcc(xcenter - y, ycenter - x as ubyte, 81, 8)
|
||||
txt.setcc(xcenter + x, ycenter + y as ubyte, 81, 1)
|
||||
txt.setcc(xcenter - x, ycenter + y as ubyte, 81, 2)
|
||||
txt.setcc(xcenter + x, ycenter - y as ubyte, 81, 3)
|
||||
txt.setcc(xcenter - x, ycenter - y as ubyte, 81, 4)
|
||||
txt.setcc(xcenter + y, ycenter + x as ubyte, 81, 5)
|
||||
txt.setcc(xcenter - y, ycenter + x as ubyte, 81, 6)
|
||||
txt.setcc(xcenter + y, ycenter - x as ubyte, 81, 7)
|
||||
txt.setcc(xcenter - y, ycenter - x as ubyte, 81, 8)
|
||||
y++
|
||||
if decisionOver2<=0
|
||||
decisionOver2 += 2*y+1
|
||||
@ -137,20 +137,20 @@ main {
|
||||
|
||||
while x>=y {
|
||||
for xx in cx to cx+x {
|
||||
c64scr.setcc(xx, cy + y as ubyte, 81, 1)
|
||||
c64scr.setcc(xx, cy - y as ubyte, 81, 2)
|
||||
txt.setcc(xx, cy + y as ubyte, 81, 1)
|
||||
txt.setcc(xx, cy - y as ubyte, 81, 2)
|
||||
}
|
||||
for xx in cx-x to cx-1 {
|
||||
c64scr.setcc(xx, cy + y as ubyte, 81, 3)
|
||||
c64scr.setcc(xx, cy - y as ubyte, 81, 4)
|
||||
txt.setcc(xx, cy + y as ubyte, 81, 3)
|
||||
txt.setcc(xx, cy - y as ubyte, 81, 4)
|
||||
}
|
||||
for xx in cx to cx+y {
|
||||
c64scr.setcc(xx, cy + x as ubyte, 81, 5)
|
||||
c64scr.setcc(xx, cy - x as ubyte, 81, 6)
|
||||
txt.setcc(xx, cy + x as ubyte, 81, 5)
|
||||
txt.setcc(xx, cy - x as ubyte, 81, 6)
|
||||
}
|
||||
for xx in cx-y to cx {
|
||||
c64scr.setcc(xx, cy + x as ubyte, 81, 7)
|
||||
c64scr.setcc(xx, cy - x as ubyte, 81, 8)
|
||||
txt.setcc(xx, cy + x as ubyte, 81, 7)
|
||||
txt.setcc(xx, cy - x as ubyte, 81, 8)
|
||||
}
|
||||
y++
|
||||
if decisionOver2<=0
|
||||
|
@ -1,6 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64flt
|
||||
%import c64graphics
|
||||
%import c64flt
|
||||
%zeropage floatsafe
|
||||
|
||||
; Draw a mandelbrot in graphics mode (the image will be 256 x 200 pixels).
|
||||
|
@ -1,5 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%import c64flt
|
||||
%zeropage basicsafe
|
||||
|
||||
@ -9,7 +9,7 @@ main {
|
||||
const ubyte max_iter = 16
|
||||
|
||||
sub start() {
|
||||
c64scr.print("calculating mandelbrot fractal...")
|
||||
txt.print("calculating mandelbrot fractal...")
|
||||
|
||||
c64.TIME_HI=0
|
||||
c64.TIME_MID=0
|
||||
@ -37,16 +37,16 @@ main {
|
||||
ysquared = y*y
|
||||
iter++
|
||||
}
|
||||
c64scr.setcc(pixelx+4, pixely+1, 160, max_iter-iter)
|
||||
txt.setcc(pixelx+4, pixely+1, 160, max_iter-iter)
|
||||
}
|
||||
}
|
||||
|
||||
float duration = ((c64.TIME_LO as float)
|
||||
+ 256.0*(c64.TIME_MID as float)
|
||||
+ 65536.0*(c64.TIME_HI as float))/60.0
|
||||
c64scr.plot(0, 21)
|
||||
c64scr.print("finished in ")
|
||||
txt.plot(0, 21)
|
||||
txt.print("finished in ")
|
||||
c64flt.print_f(duration)
|
||||
c64scr.print(" seconds!\n")
|
||||
txt.print(" seconds!\n")
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%import c64lib
|
||||
%import conv
|
||||
%zeropage basicsafe
|
||||
@ -14,32 +14,32 @@ main {
|
||||
ubyte attempts_left
|
||||
|
||||
c64.VMCSB |= 2 ; switch lowercase chars
|
||||
c64scr.print("Please introduce yourself: ")
|
||||
void c64scr.input_chars(name)
|
||||
c64scr.print("\n\nHello, ")
|
||||
c64scr.print(name)
|
||||
c64scr.print(".\nLet's play a number guessing game.\nI am thinking of a number from 1 to 100!You'll have to guess it!\n")
|
||||
txt.print("Please introduce yourself: ")
|
||||
void txt.input_chars(name)
|
||||
txt.print("\n\nHello, ")
|
||||
txt.print(name)
|
||||
txt.print(".\nLet's play a number guessing game.\nI am thinking of a number from 1 to 100!You'll have to guess it!\n")
|
||||
|
||||
for attempts_left in 10 downto 1 {
|
||||
|
||||
c64scr.print("\nYou have ")
|
||||
c64scr.print_ub(attempts_left)
|
||||
c64scr.print(" guess")
|
||||
txt.print("\nYou have ")
|
||||
txt.print_ub(attempts_left)
|
||||
txt.print(" guess")
|
||||
if attempts_left>1
|
||||
c64scr.print("es")
|
||||
c64scr.print(" left.\nWhat is your next guess? ")
|
||||
void c64scr.input_chars(input)
|
||||
txt.print("es")
|
||||
txt.print(" left.\nWhat is your next guess? ")
|
||||
void txt.input_chars(input)
|
||||
ubyte guess = lsb(conv.str2uword(input))
|
||||
|
||||
if guess==secretnumber {
|
||||
ending(true)
|
||||
return
|
||||
} else {
|
||||
c64scr.print("\n\nThat is too ")
|
||||
txt.print("\n\nThat is too ")
|
||||
if guess<secretnumber
|
||||
c64scr.print("low!\n")
|
||||
txt.print("low!\n")
|
||||
else
|
||||
c64scr.print("high!\n")
|
||||
txt.print("high!\n")
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,15 +49,15 @@ main {
|
||||
|
||||
sub ending(ubyte success) {
|
||||
if success
|
||||
c64scr.print("\n\nYou guessed it, impressive!\n")
|
||||
txt.print("\n\nYou guessed it, impressive!\n")
|
||||
else {
|
||||
c64scr.print("\nToo bad! My number was: ")
|
||||
c64scr.print_ub(secretnumber)
|
||||
c64scr.print(".\n")
|
||||
txt.print("\nToo bad! My number was: ")
|
||||
txt.print_ub(secretnumber)
|
||||
txt.print(".\n")
|
||||
}
|
||||
c64scr.print("Thanks for playing, ")
|
||||
c64scr.print(name)
|
||||
c64scr.print(".\n")
|
||||
txt.print("Thanks for playing, ")
|
||||
txt.print(name)
|
||||
txt.print(".\n")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64textio
|
||||
|
||||
|
||||
;/*****************************************************************************\
|
||||
@ -21,7 +22,7 @@ main {
|
||||
|
||||
sub start() {
|
||||
c64.COLOR = 1
|
||||
c64scr.print("creating charset...\n")
|
||||
txt.print("creating charset...\n")
|
||||
makechar()
|
||||
|
||||
ubyte block = c64.CIA2PRA
|
||||
@ -38,7 +39,7 @@ main {
|
||||
; restore screen (if you want)
|
||||
;c64.VMCSB = v
|
||||
;c64.CIA2PRA = block
|
||||
;c64scr.print("done!\n")
|
||||
;txt.print("done!\n")
|
||||
}
|
||||
|
||||
; several variables outside of doplasma to make them retain their value
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -10,19 +10,19 @@ main {
|
||||
memset(sieve, 256, false) ; clear the sieve, to reset starting situation on subsequent runs
|
||||
|
||||
; calculate primes
|
||||
c64scr.print("prime numbers up to 255:\n\n")
|
||||
txt.print("prime numbers up to 255:\n\n")
|
||||
ubyte amount=0
|
||||
repeat {
|
||||
ubyte prime = find_next_prime()
|
||||
if prime==0
|
||||
break
|
||||
c64scr.print_ub(prime)
|
||||
c64scr.print(", ")
|
||||
txt.print_ub(prime)
|
||||
txt.print(", ")
|
||||
amount++
|
||||
}
|
||||
c64.CHROUT('\n')
|
||||
c64scr.print("number of primes (expected 54): ")
|
||||
c64scr.print_ub(amount)
|
||||
txt.print("number of primes (expected 54): ")
|
||||
txt.print_ub(amount)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,10 @@
|
||||
%import c64utils
|
||||
%import c64lib
|
||||
|
||||
main {
|
||||
|
||||
sub start() {
|
||||
c64.SCROLY &= %11101111 ; blank the screen
|
||||
c64utils.set_rasterirq_excl(40) ; register exclusive raster irq handler
|
||||
c64.set_rasterirq_excl(40) ; register exclusive raster irq handler
|
||||
|
||||
repeat {
|
||||
; enjoy the moving bars :)
|
||||
|
@ -1,6 +1,5 @@
|
||||
%import c64flt
|
||||
%zeropage basicsafe
|
||||
%option enable_floats
|
||||
|
||||
main {
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
|
||||
@ -12,13 +12,13 @@ main {
|
||||
str s1 = "HELLO hello 1234 @[/]" ; regular strings have default encoding (petscii on c64)
|
||||
str s2 = @"HELLO hello 1234 @[/]" ; alternative encoding (screencodes on c64)
|
||||
|
||||
c64scr.print("\n\n\n\nString output via print:\n")
|
||||
c64scr.print("petscii-str: ")
|
||||
c64scr.print(s1)
|
||||
c64scr.print("\nscrcode-str: ")
|
||||
c64scr.print(s2)
|
||||
txt.print("\n\n\n\nString output via print:\n")
|
||||
txt.print("petscii-str: ")
|
||||
txt.print(s1)
|
||||
txt.print("\nscrcode-str: ")
|
||||
txt.print(s2)
|
||||
|
||||
c64scr.print("\n\nThe top two screen lines are set via screencodes.\n")
|
||||
txt.print("\n\nThe top two screen lines are set via screencodes.\n")
|
||||
ubyte i
|
||||
for i in 0 to len(s1)-1
|
||||
@($0400+i) = s1[i]
|
||||
@ -29,10 +29,10 @@ main {
|
||||
ubyte c1 = 'z'
|
||||
ubyte c2 = @'z'
|
||||
|
||||
c64scr.print("\npetscii z=")
|
||||
c64scr.print_ub(c1)
|
||||
c64scr.print("\nscreencode z=")
|
||||
c64scr.print_ub(c2)
|
||||
c64scr.print("\n")
|
||||
txt.print("\npetscii z=")
|
||||
txt.print_ub(c1)
|
||||
txt.print("\nscreencode z=")
|
||||
txt.print_ub(c2)
|
||||
txt.print("\n")
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -11,7 +11,7 @@ main {
|
||||
byte[] ba = [-10,0,-2,8,5,4,-3,9,-99]
|
||||
word[] wa = [-1000,0,-200,8000,50,31111,3,-900]
|
||||
|
||||
c64scr.print("original\n")
|
||||
txt.print("original\n")
|
||||
print_arrays()
|
||||
|
||||
sort(uba)
|
||||
@ -19,7 +19,7 @@ main {
|
||||
sort(ba)
|
||||
sort(wa)
|
||||
|
||||
c64scr.print("sorted\n")
|
||||
txt.print("sorted\n")
|
||||
print_arrays()
|
||||
|
||||
reverse(uba)
|
||||
@ -27,7 +27,7 @@ main {
|
||||
reverse(ba)
|
||||
reverse(wa)
|
||||
|
||||
c64scr.print("reversed\n")
|
||||
txt.print("reversed\n")
|
||||
print_arrays()
|
||||
|
||||
return
|
||||
@ -39,25 +39,25 @@ main {
|
||||
byte bb
|
||||
word ww
|
||||
for ub in uba {
|
||||
c64scr.print_ub(ub)
|
||||
txt.print_ub(ub)
|
||||
c64.CHROUT(',')
|
||||
}
|
||||
c64.CHROUT('\n')
|
||||
|
||||
for uw in uwa {
|
||||
c64scr.print_uw(uw)
|
||||
txt.print_uw(uw)
|
||||
c64.CHROUT(',')
|
||||
}
|
||||
c64.CHROUT('\n')
|
||||
|
||||
for bb in ba {
|
||||
c64scr.print_b(bb)
|
||||
txt.print_b(bb)
|
||||
c64.CHROUT(',')
|
||||
}
|
||||
c64.CHROUT('\n')
|
||||
|
||||
for ww in wa {
|
||||
c64scr.print_w(ww)
|
||||
txt.print_w(ww)
|
||||
c64.CHROUT(',')
|
||||
}
|
||||
c64.CHROUT('\n')
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%import c64lib
|
||||
%zeropage basicsafe
|
||||
|
||||
@ -35,7 +35,7 @@ main {
|
||||
|
||||
sub start() {
|
||||
|
||||
c64scr.print("balloon sprites!\n...we are all floating...\n")
|
||||
txt.print("balloon sprites!\n...we are all floating...\n")
|
||||
|
||||
ubyte @zp i
|
||||
for i in 0 to 7 {
|
||||
@ -45,7 +45,7 @@ main {
|
||||
}
|
||||
|
||||
c64.SPENA = 255 ; enable all sprites
|
||||
c64utils.set_rasterirq(51) ; enable animation
|
||||
c64.set_rasterirq(51) ; enable animation
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%zeropage basicsafe
|
||||
|
||||
main {
|
||||
@ -21,11 +21,11 @@ main {
|
||||
other.green = 10 + other.green / 2
|
||||
other.blue = 99
|
||||
|
||||
c64scr.print_ub(other.red)
|
||||
txt.print_ub(other.red)
|
||||
c64.CHROUT(',')
|
||||
c64scr.print_ub(other.green)
|
||||
txt.print_ub(other.green)
|
||||
c64.CHROUT(',')
|
||||
c64scr.print_ub(other.blue)
|
||||
txt.print_ub(other.blue)
|
||||
c64.CHROUT('\n')
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
%import c64flt
|
||||
|
||||
main {
|
||||
@ -14,7 +14,7 @@ main {
|
||||
repeat {
|
||||
ubyte xx=(sin(t) * width/2.2) + width/2.0 as ubyte
|
||||
ubyte yy=(cos(t*1.1356) * height/2.2) + height/2.0 as ubyte
|
||||
c64scr.setcc(xx, yy, 81, color)
|
||||
txt.setcc(xx, yy, 81, color)
|
||||
t += 0.08
|
||||
color++
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64utils
|
||||
%import c64textio
|
||||
|
||||
main {
|
||||
|
||||
@ -18,7 +18,7 @@ main {
|
||||
repeat {
|
||||
ubyte x = msb(sin8u(msb(ball.anglex)) as uword * width)
|
||||
ubyte y = msb(cos8u(msb(ball.angley)) as uword * height)
|
||||
c64scr.setcc(x, y, 81, ball.color)
|
||||
txt.setcc(x, y, 81, ball.color)
|
||||
|
||||
ball.anglex+=800
|
||||
ball.angley+=947
|
||||
|
@ -7,6 +7,9 @@
|
||||
; staged speed increase
|
||||
; some simple sound effects
|
||||
|
||||
%import c64lib
|
||||
%import c64textio
|
||||
|
||||
|
||||
main {
|
||||
|
||||
@ -196,7 +199,7 @@ waitkey:
|
||||
num_lines++
|
||||
ubyte x
|
||||
for x in boardOffsetX to boardOffsetX+boardWidth-1
|
||||
c64scr.setcc(x, linepos, 160, 1)
|
||||
txt.setcc(x, linepos, 160, 1)
|
||||
}
|
||||
}
|
||||
if num_lines {
|
||||
@ -222,26 +225,26 @@ waitkey:
|
||||
|
||||
sub gameOver() {
|
||||
sound.gameover()
|
||||
c64scr.plot(7, 7)
|
||||
txt.plot(7, 7)
|
||||
c64.CHROUT('U')
|
||||
c64scr.print("────────────────────────")
|
||||
txt.print("────────────────────────")
|
||||
c64.CHROUT('I')
|
||||
c64scr.plot(7, 8)
|
||||
c64scr.print("│*** g a m e o v e r ***│")
|
||||
c64scr.plot(7, 9)
|
||||
txt.plot(7, 8)
|
||||
txt.print("│*** g a m e o v e r ***│")
|
||||
txt.plot(7, 9)
|
||||
c64.CHROUT('J')
|
||||
c64scr.print("────────────────────────")
|
||||
txt.print("────────────────────────")
|
||||
c64.CHROUT('K')
|
||||
|
||||
c64scr.plot(7, 18)
|
||||
txt.plot(7, 18)
|
||||
c64.CHROUT('U')
|
||||
c64scr.print("────────────────────────")
|
||||
txt.print("────────────────────────")
|
||||
c64.CHROUT('I')
|
||||
c64scr.plot(7, 19)
|
||||
c64scr.print("│ f1 for new game │")
|
||||
c64scr.plot(7, 20)
|
||||
txt.plot(7, 19)
|
||||
txt.print("│ f1 for new game │")
|
||||
txt.plot(7, 20)
|
||||
c64.CHROUT('J')
|
||||
c64scr.print("────────────────────────")
|
||||
txt.print("────────────────────────")
|
||||
c64.CHROUT('K')
|
||||
|
||||
while c64.GETIN()!=133 {
|
||||
@ -278,61 +281,61 @@ waitkey:
|
||||
sub drawBoard() {
|
||||
c64.CLEARSCR()
|
||||
c64.COLOR = 7
|
||||
c64scr.plot(1,1)
|
||||
c64scr.print("irmen's")
|
||||
c64scr.plot(2,2)
|
||||
c64scr.print("teh▁triz")
|
||||
txt.plot(1,1)
|
||||
txt.print("irmen's")
|
||||
txt.plot(2,2)
|
||||
txt.print("teh▁triz")
|
||||
c64.COLOR = 5
|
||||
c64scr.plot(6,4)
|
||||
c64scr.print("hold:")
|
||||
c64scr.plot(2,22)
|
||||
c64scr.print("speed: ")
|
||||
c64scr.plot(28,3)
|
||||
c64scr.print("next:")
|
||||
c64scr.plot(28,10)
|
||||
c64scr.print("lines:")
|
||||
c64scr.plot(28,14)
|
||||
c64scr.print("score:")
|
||||
txt.plot(6,4)
|
||||
txt.print("hold:")
|
||||
txt.plot(2,22)
|
||||
txt.print("speed: ")
|
||||
txt.plot(28,3)
|
||||
txt.print("next:")
|
||||
txt.plot(28,10)
|
||||
txt.print("lines:")
|
||||
txt.plot(28,14)
|
||||
txt.print("score:")
|
||||
c64.COLOR = 12
|
||||
c64scr.plot(27,18)
|
||||
c64scr.print("controls:")
|
||||
txt.plot(27,18)
|
||||
txt.print("controls:")
|
||||
c64.COLOR = 11
|
||||
c64scr.plot(28,19)
|
||||
c64scr.print(",/ move")
|
||||
c64scr.plot(28,20)
|
||||
c64scr.print("zx rotate")
|
||||
c64scr.plot(29,21)
|
||||
c64scr.print(". descend")
|
||||
c64scr.plot(27,22)
|
||||
c64scr.print("spc drop")
|
||||
c64scr.plot(29,23)
|
||||
c64scr.print("c hold")
|
||||
txt.plot(28,19)
|
||||
txt.print(",/ move")
|
||||
txt.plot(28,20)
|
||||
txt.print("zx rotate")
|
||||
txt.plot(29,21)
|
||||
txt.print(". descend")
|
||||
txt.plot(27,22)
|
||||
txt.print("spc drop")
|
||||
txt.plot(29,23)
|
||||
txt.print("c hold")
|
||||
|
||||
c64scr.setcc(boardOffsetX-1, boardOffsetY-2, 255, 0) ; invisible barrier
|
||||
c64scr.setcc(boardOffsetX-1, boardOffsetY-3, 255, 0) ; invisible barrier
|
||||
c64scr.setcc(boardOffsetX+boardWidth, boardOffsetY-2, 255, 0) ; invisible barrier
|
||||
c64scr.setcc(boardOffsetX+boardWidth, boardOffsetY-3, 255, 0) ; invisible barrier
|
||||
txt.setcc(boardOffsetX-1, boardOffsetY-2, 255, 0) ; invisible barrier
|
||||
txt.setcc(boardOffsetX-1, boardOffsetY-3, 255, 0) ; invisible barrier
|
||||
txt.setcc(boardOffsetX+boardWidth, boardOffsetY-2, 255, 0) ; invisible barrier
|
||||
txt.setcc(boardOffsetX+boardWidth, boardOffsetY-3, 255, 0) ; invisible barrier
|
||||
|
||||
c64scr.setcc(boardOffsetX-1, boardOffsetY-1, 108, 12)
|
||||
c64scr.setcc(boardOffsetX+boardWidth, boardOffsetY-1, 123, 12)
|
||||
c64scr.setcc(boardOffsetX+boardWidth, boardOffsetY-1, 123, 12)
|
||||
c64scr.setcc(boardOffsetX-1, boardOffsetY+boardHeight, 124, 12)
|
||||
c64scr.setcc(boardOffsetX+boardWidth, boardOffsetY+boardHeight, 126, 12)
|
||||
txt.setcc(boardOffsetX-1, boardOffsetY-1, 108, 12)
|
||||
txt.setcc(boardOffsetX+boardWidth, boardOffsetY-1, 123, 12)
|
||||
txt.setcc(boardOffsetX+boardWidth, boardOffsetY-1, 123, 12)
|
||||
txt.setcc(boardOffsetX-1, boardOffsetY+boardHeight, 124, 12)
|
||||
txt.setcc(boardOffsetX+boardWidth, boardOffsetY+boardHeight, 126, 12)
|
||||
ubyte i
|
||||
for i in boardOffsetX+boardWidth-1 downto boardOffsetX {
|
||||
c64scr.setcc(i, boardOffsetY-3, 255, 0) ; invisible barrier
|
||||
c64scr.setcc(i, boardOffsetY+boardHeight, 69, 11)
|
||||
txt.setcc(i, boardOffsetY-3, 255, 0) ; invisible barrier
|
||||
txt.setcc(i, boardOffsetY+boardHeight, 69, 11)
|
||||
}
|
||||
for i in boardOffsetY+boardHeight-1 downto boardOffsetY {
|
||||
c64scr.setcc(boardOffsetX-1, i, 89, 11)
|
||||
c64scr.setcc(boardOffsetX+boardWidth, i, 84, 11)
|
||||
txt.setcc(boardOffsetX-1, i, 89, 11)
|
||||
txt.setcc(boardOffsetX+boardWidth, i, 84, 11)
|
||||
}
|
||||
|
||||
ubyte[] colors = [6,8,7,5,4]
|
||||
for i in len(colors)-1 downto 0 {
|
||||
ubyte x
|
||||
for x in 5 downto 0 {
|
||||
c64scr.setcc(6+x-i, 11+2*i, 102, colors[i])
|
||||
txt.setcc(6+x-i, 11+2*i, 102, colors[i])
|
||||
}
|
||||
}
|
||||
drawScore()
|
||||
@ -340,12 +343,12 @@ waitkey:
|
||||
|
||||
sub drawScore() {
|
||||
c64.COLOR=1
|
||||
c64scr.plot(30,11)
|
||||
c64scr.print_uw(lines)
|
||||
c64scr.plot(30,15)
|
||||
c64scr.print_uw(score)
|
||||
c64scr.plot(9,22)
|
||||
c64scr.print_ub(speedlevel)
|
||||
txt.plot(30,11)
|
||||
txt.print_uw(lines)
|
||||
txt.plot(30,15)
|
||||
txt.print_uw(score)
|
||||
txt.plot(9,22)
|
||||
txt.print_ub(speedlevel)
|
||||
}
|
||||
|
||||
sub drawNextBlock() {
|
||||
@ -353,8 +356,8 @@ waitkey:
|
||||
const ubyte nextBlockYpos = 5
|
||||
ubyte x
|
||||
for x in nextBlockXpos+3 downto nextBlockXpos {
|
||||
c64scr.setcc(x, nextBlockYpos, ' ', 0)
|
||||
c64scr.setcc(x, nextBlockYpos+1, ' ', 0)
|
||||
txt.setcc(x, nextBlockYpos, ' ', 0)
|
||||
txt.setcc(x, nextBlockYpos+1, ' ', 0)
|
||||
}
|
||||
|
||||
; reuse the normal block draw routine (because we can't manipulate array pointers yet)
|
||||
@ -369,8 +372,8 @@ waitkey:
|
||||
const ubyte holdBlockYpos = 6
|
||||
ubyte x
|
||||
for x in holdBlockXpos+3 downto holdBlockXpos {
|
||||
c64scr.setcc(x, holdBlockYpos, '@', 0)
|
||||
c64scr.setcc(x, holdBlockYpos+1, '@', 0)
|
||||
txt.setcc(x, holdBlockYpos, '@', 0)
|
||||
txt.setcc(x, holdBlockYpos+1, '@', 0)
|
||||
}
|
||||
if holding < 7 {
|
||||
; reuse the normal block draw routine (because we can't manipulate array pointers yet)
|
||||
@ -386,7 +389,7 @@ waitkey:
|
||||
for i in 15 downto 0 {
|
||||
ubyte c=blocklogic.currentBlock[i]
|
||||
if c
|
||||
c64scr.setcc((i&3)+x, (i/4)+y, character, c)
|
||||
txt.setcc((i&3)+x, (i/4)+y, character, c)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -533,7 +536,7 @@ blocklogic {
|
||||
sub noCollision(ubyte xpos, ubyte ypos) -> ubyte {
|
||||
ubyte i
|
||||
for i in 15 downto 0 {
|
||||
if currentBlock[i] and c64scr.getchr(xpos + (i&3), ypos+i/4)!=32
|
||||
if currentBlock[i] and txt.getchr(xpos + (i&3), ypos+i/4)!=32
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -549,7 +552,7 @@ blocklogic {
|
||||
sub isLineFull(ubyte ypos) -> ubyte {
|
||||
ubyte x
|
||||
for x in main.boardOffsetX to main.boardOffsetX+main.boardWidth-1 {
|
||||
if c64scr.getchr(x, ypos)==32
|
||||
if txt.getchr(x, ypos)==32
|
||||
return false
|
||||
}
|
||||
return true
|
||||
@ -559,9 +562,9 @@ blocklogic {
|
||||
while ypos>main.startYpos+1 {
|
||||
ubyte x
|
||||
for x in main.boardOffsetX+main.boardWidth-1 downto main.boardOffsetX {
|
||||
ubyte char = c64scr.getchr(x, ypos-1)
|
||||
ubyte color = c64scr.getclr(x, ypos-1)
|
||||
c64scr.setcc(x, ypos, char, color)
|
||||
ubyte char = txt.getchr(x, ypos-1)
|
||||
ubyte color = txt.getclr(x, ypos-1)
|
||||
txt.setcc(x, ypos, char, color)
|
||||
}
|
||||
ypos--
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
%import c64lib
|
||||
%import c64textio
|
||||
%import c64flt
|
||||
%zeropage basicsafe
|
||||
%option enable_floats
|
||||
@ -8,7 +8,7 @@ main {
|
||||
; this is only a parser/compiler test, there's no actual working program
|
||||
|
||||
sub start() {
|
||||
c64scr.print("this is only a parser/compiler test\n")
|
||||
txt.print("this is only a parser/compiler test\n")
|
||||
return
|
||||
|
||||
str s1 = "hello"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,5 @@
|
||||
%import c64lib
|
||||
%import c64flt
|
||||
%import c64graphics
|
||||
%option enable_floats
|
||||
|
||||
main {
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
%import c64utils
|
||||
%import c64lib
|
||||
%zeropage basicsafe
|
||||
|
||||
@ -38,7 +37,7 @@ main {
|
||||
c64.SPRPTR[i] = $0a00/64
|
||||
}
|
||||
c64.SPENA = 255 ; enable all sprites
|
||||
c64utils.set_rasterirq(220) ; enable animation
|
||||
c64.set_rasterirq(220) ; enable animation
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user