Skip to content
3 changes: 1 addition & 2 deletions css/ui.css
Original file line number Diff line number Diff line change
Expand Up @@ -251,17 +251,16 @@ div.emuspacer {
.emuvideo {
border-radius:20px;
border: 4px solid #222;
outline-color: #ccc;
padding: 20px;
background: #000;
margin-top:40px;
margin-left:3%;
margin-right:3%;
width:94%;
pointer-events:auto;
cursor: crosshair;
}
.emuvideo:focus {
outline:none;
border-color:#888;
}
canvas.pixelated {
Expand Down
7 changes: 7 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,13 @@
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joystick</span>
<span class="control-def"><span class="control-key small">Space</span> Button</span>
</div>
<div class="emucontrols-apple2 text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key small">Mouse</span> Paddles/Joystick</span>
<span class="control-def"><span class="control-key small">Click</span> Button 1</span>
<br>
<span class="control-def"><span class="control-key small">SHIFT-Click</span> Button 2</span>
<span class="control-def"><span class="control-key small">ALT-Click</span> Button 3</span>
</div>
<div class="emucontrols-nes emucontrols-atari7800 emucontrols-pce emucontrols-gb text-center small control-insns" style="display:none">
<span class="control-def"><span class="control-key">&#x2190;&#x2191;&#x2193;&#x2192;</span> Joypad</span>
<span class="control-def"><span class="control-key small">Space</span> Button A</span>
Expand Down
107 changes: 107 additions & 0 deletions presets/apple2/paddles.dasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
processor 6502
org $0803

; --- CONSTANTS ---
BASL equ $28
BASH equ $29
PREAD equ $FB1E
SW0 equ $C061
SW1 equ $C062
SW2 equ $C063
HOME equ $FC58
TABV equ $FB5B

; --- ZERO PAGE VARIABLES ---
PREVX equ $06
PREVY equ $07
NEWX equ $08
NEWY equ $09
BRUSH equ $0A

; --- PROGRAM ---
SETUP:
jsr HOME
lda #$00
sta PREVX
sta PREVY

LOOP:
; CHECK FOR MOVEMENT
lda NEWX
cmp PREVX
bne SELECT_BRUSH
lda NEWY
cmp PREVY
beq NOPAINT

SELECT_BRUSH:
; PAINT PREVIOUS X/Y
lda SW0
bpl NOSW0
lda #$20 ; INVERSE SPACE
jmp PAINT
NOSW0: lda SW1
bpl NOSW1
lda #$60 ; FLASHING SPACE
jmp PAINT
NOSW1: lda SW2
bpl NOSW2
lda #$AE ; PERIOD
jmp PAINT
NOSW2: lda #$A0 ; SPACE

PAINT:
sta BRUSH
lda PREVY
jsr TABV
ldy PREVX
lda BRUSH
sta (BASL),Y

; SAVE PREVIOUS X/Y
lda NEWX
sta PREVX
lda NEWY
sta PREVY
NOPAINT:
; CALCULATE NEW X (0-39)
ldx #$00
jsr PREAD
lda XTABLE,Y
sta NEWX

; CALCULATE NEW Y (0-23)
ldx #$01
jsr PREAD
lda YTABLE,Y
sta NEWY

; DRAW CURSOR
lda NEWY
jsr TABV
ldy NEWX

lda #$20 ; INVERSE SPACE
sta (BASL),Y
NODRAW:
jmp LOOP


; --- LOOKUP TABLES ---

XTABLE:
; MAP [0,255] -> [0,39]
X set 0
repeat 256
.byte X * 40 / 256
X set X + 1
repend

YTABLE:
; MAP [0,255] -> [0,23]
Y set 0
repeat 256
.byte Y * 24 / 256
Y set Y + 1
repend

5 changes: 5 additions & 0 deletions src/common/baseplatform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,11 @@ export abstract class BaseMachinePlatform<T extends Machine> extends BaseDebugPl
if (hasPaddleInput(this.machine)) {
this.machine.setPaddleInput(0, this.video.paddle_x);
this.machine.setPaddleInput(1, this.video.paddle_y);
if (this.machine.setPaddleButton) {
this.machine.setPaddleButton(0, this.video.paddle_buttons[0]);
this.machine.setPaddleButton(1, this.video.paddle_buttons[1]);
this.machine.setPaddleButton(2, this.video.paddle_buttons[2]);
}
}
// TODO: put into interface
if (this.machine['pollControls']) {
Expand Down
1 change: 1 addition & 0 deletions src/common/devices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ export interface AcceptsKeyInput {

export interface AcceptsPaddleInput {
setPaddleInput(controller: number, value: number): void;
setPaddleButton?(index: number, pressed: boolean): void;
}

// TODO: interface not yet used (setKeyInput() handles joystick)
Expand Down
Loading
Loading