This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;The Header which declares the exports as | |
;addresses in the jump table. | |
;----------[ Input Header ]-------- | |
inpuths = $cfbe | |
initmouse = inpuths+0 | |
killmouse = inpuths+3 | |
hidemouse = inpuths+6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;And the jump table, in the memory management module, | |
;with jumps through the module's exports table. | |
;----------[ Input ]-------- | |
input = $cf7c4 | |
;*=cfbe | |
jmp (input+0) ;initmouse | |
jmp (input+2) ;killmouse |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chktimer ;Timer vector cannot be in ZP. | |
;If timer vector MSB is 0, RTS. | |
;Checks timer, JSR if reached. | |
lda timervec+2 | |
beq timerexit | |
lda jiffyhi | |
cmp timer+2 | |
bcc timerexit ;Not reached |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Recursive | |
var fac = function(start) { | |
if(start == 1) | |
return 1; | |
return start * fac(start-1); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Iterative | |
var fac = function(start) { | |
var total = 1; | |
while(start > 1) | |
total *= start--; | |
return total; | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Workspace | |
multiplier = $4e ;78 | |
multiplicand = $50 ;80 | |
product = $52 ;82 | |
mult16 ;multiplicand -> multiplicand lo byte | |
;multiplier -> multiplier lo byte | |
;product <- product lo byte | |
.block | |
LDA multiplier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LDA factor | |
STA multiplier | |
LDA #0 | |
STA multiplier+1 | |
next DEC factor | |
BEQ done | |
LDA factor | |
STA multiplicand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inttohex ;.A -> int | |
;.X <- lo hex digit | |
;.Y <- hi hex digit | |
.block | |
PHA | |
LSR | |
LSR | |
LSR | |
LSR | |
TAX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
chrout = $ffd2 | |
out16 .macro | |
LDA \1+1 | |
JSR inttohex | |
TYA | |
JSR chrout | |
TXA | |
JSR chrout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;*** Constants *** | |
chrout = $ffd2 | |
;Workspace | |
multiplier = $4e ;78 | |
multiplicand = $50 ;80 | |
product = $52 ;82 | |
;*** Macros *** |