Polish to docs and sample code

This commit is contained in:
Quinn Dunki 2015-02-08 17:50:44 -08:00
parent b84ca22261
commit aa7425b99a
6 changed files with 34 additions and 157 deletions

View File

@ -3,7 +3,7 @@ WeeGUI
WeeGUI is a lightweight library for creating graphical user interfaces in 80 column text mode on the Apple IIe Enhanced and Apple IIc family of computers. It supports both keyboard and mouse controls for your interface. It is designed to take minimal RAM (less than 6k), and can be used from assembly language or Applesoft BASIC programs under ProDOS. WeeGUI installs itself at the top of memory, using an area normally vacant in most BASIC and assembly programs. WeeGUI is a lightweight library for creating graphical user interfaces in 80 column text mode on the Apple IIe Enhanced and Apple IIc family of computers. It supports both keyboard and mouse controls for your interface. It is designed to take minimal RAM (less than 6k), and can be used from assembly language or Applesoft BASIC programs under ProDOS. WeeGUI installs itself at the top of memory, using an area normally vacant in most BASIC and assembly programs.
You can use WeeGUI as a full-blown user interface system, or as a simple drawing library for ASCII art. Use as much or as little of its features as you wish. WeeGUI tries not to enforce any particular structure or use-case on your program. It is intended to be so easy to use that you'll choose it over rolling your own menuing system for whatever application you're building. You can use WeeGUI as a full-blown user interface system, or as a simple drawing library for ASCII art. Use as much or as little of its features as you wish. WeeGUI tries not to enforce any particular structure or use-case on your program. It is intended to be so easy to use that you'll choose it over rolling your own menuing system for whatever application you're building. Whether you're building the next ProTERM, or just a quick-and-dirty interface for your Arduino project, WeeGUI can be your go-to library.
<br> <br>
@ -46,7 +46,7 @@ When using assembly language, you can install WeeGUI by loading the *WEEGUI* lib
ldx #0 ldx #0
ldy #0 ldy #0
@0: lda bloadCmdLine,x @0: lda brunCmdLine,x
beq @1 beq @1
sta $0200,y sta $0200,y
inx inx
@ -54,7 +54,7 @@ When using assembly language, you can install WeeGUI by loading the *WEEGUI* lib
bra @0 bra @0
@1: jsr $be03 @1: jsr $be03
bloadCmdLine: brunCmdLine:
.byte "BRUN WEEGUI",$8d,0 .byte "BRUN WEEGUI",$8d,0
@ -147,7 +147,7 @@ A typical assembly language run loop simply waits for keypresses and responds to
; Respond to keys as needed ; Respond to keys as needed
jmp runLoop bra runLoop
If you want to support the mouse, WeeGUI has you covered. You just need to add one piece to your run loop: If you want to support the mouse, WeeGUI has you covered. You just need to add one piece to your run loop:
@ -161,7 +161,7 @@ If you want to support the mouse, WeeGUI has you covered. You just need to add o
; Respond to keys as needed ; Respond to keys as needed
jmp runLoop bra runLoop
Note the call to *WGPendingViewAction* on each pass through the loop. For the mouse, WeeGUI will make note of actions taken by the user, but won't act until you say so. It is up to your program to call *WGPendingViewAction* periodically to allow WeeGUI to handle these events. Note the call to *WGPendingViewAction* on each pass through the loop. For the mouse, WeeGUI will make note of actions taken by the user, but won't act until you say so. It is up to your program to call *WGPendingViewAction* periodically to allow WeeGUI to handle these events.

View File

@ -18,7 +18,7 @@ PGM=weegui
DEMO=asmdemo DEMO=asmdemo
all: $(DEMO) $(PGM) all: $(DEMO) $(PGM)
#all: $(PGM)
$(DEMO): $(DEMO):
@PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --start-addr $(ADDRDEMO) -l$(DEMO).lst $(DEMO).s @PATH=$(PATH):/usr/local/bin; $(CL65) -t apple2enh --start-addr $(ADDRDEMO) -l$(DEMO).lst $(DEMO).s

View File

@ -2,14 +2,13 @@
Known issues Known issues
------------ ------------
- Hitting Reset during a WeeGUI application will leave your Apple II in an unsafe state - Hitting Reset during a WeeGUI application will leave your Apple II in an unsafe state.
- Calling WGEraseView on a view that shares border rendering with other views will require manually redrawing those views. - Calling WGEraseView on a view that shares border rendering with other views will require manually redrawing those views.
- ProDOS reports NO BUFFERS AVAILABLE after three successive runs of ASMDEMO. Doing a CAT will restore normal operation.
To Do: To Do:
------ ------
- Write sample code
- Update side effects in assembly API
- Support for frameless views - Support for frameless views
- Document final memory map - Document final memory map
- Remove references to ORG in docs (except in memory map)

172
asmdemo.s
View File

@ -1,9 +1,9 @@
; ;
; guidemo.s ; asmdemo.s
; WeeGUI sample application ; WeeGUI sample application
; ;
; Created by Quinn Dunki on 8/15/14. ; Created by Quinn Dunki on 8/15/14.
; Copyright (c) 2014 One Girl, One Laptop Productions. All rights reserved. ; Copyright (c) 2015 One Girl, One Laptop Productions. All rights reserved.
; ;
@ -18,17 +18,6 @@ KBD = $c000
KBDSTRB = $c010 KBDSTRB = $c010
.macro WGCALL16 func,addr
lda #<addr
sta PARAM0
lda #>addr
sta PARAM1
ldx #func
jsr WeeGUI
.endmacro
; Sample code
main: main:
; BRUN the GUI library ; BRUN the GUI library
@ -43,49 +32,19 @@ main:
@1: jsr DOSCMD @1: jsr DOSCMD
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Show off some WeeGUI features
jmp animateRects
ldx #WGClearScreen
jsr WeeGUI
keyLoop:
ldx #WGPendingViewAction
jsr WeeGUI
lda KBD
bpl keyLoop
sta KBDSTRB
and #%01111111
cmp #113
beq keyLoop_quit
jmp keyLoop
keyLoop_quit:
ldx #WGExit
jsr WeeGUI
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; animateRects ; Show off rendering speed with some snazzy rectangle painting
; Strokes and paints rectangles of many different geometries
; ;
; Stack: ; Stack:
; Curr X ; Curr X
; Curr Y ; Curr Y
; Curr Width ; Curr Width
; Curr Height ; Curr Height
animateRects:
ldx #WGClearScreen ldx #WGClearScreen
jsr WeeGUI jsr WeeGUI
animateRectsEven: animateRects:
lda #38 ; Initialize lda #38 ; Initialize
pha pha
lda #11 lda #11
@ -110,7 +69,7 @@ animateRectsEvenLoop:
inc inc
sta $0100,x sta $0100,x
cmp #25 cmp #25
bcs animateRectsEvenDone bcs animateRects
inx ; Load Width, then modify inx ; Load Width, then modify
lda $0100,x lda $0100,x
@ -137,7 +96,7 @@ animateRectsEvenLoop:
dec dec
sta $0100,x sta $0100,x
ldy #'Q'+$80 ldy #64
ldx #WGFillRect ldx #WGFillRect
jsr WeeGUI jsr WeeGUI
ldx #WGStrokeRect ldx #WGStrokeRect
@ -146,84 +105,10 @@ animateRectsEvenLoop:
jsr delayShort jsr delayShort
jsr delayShort jsr delayShort
jsr delayShort jsr delayShort
jsr checkKbd
jmp animateRectsEvenLoop bra animateRectsEvenLoop
animateRectsEvenDone:
pla
pla
pla
pla
animateRectsOdd:
lda #37 ; Initialize
pha
lda #11
pha
lda #2
pha
lda #2
pha
animateRectsOddLoop:
ldx #WGClearScreen
jsr WeeGUI
tsx
inx
lda $0100,x ; Load Height, then modify
sta PARAM3
inc
inc
sta $0100,x
cmp #25
bcs animateRectsOddDone
inx ; Load Width, then modify
lda $0100,x
sta PARAM2
inc
inc
inc
inc
inc
inc
sta $0100,x
inx ; Load Y, then modify
lda $0100,x
sta PARAM1
dec
sta $0100,x
inx ; Load X, then modify
lda $0100,x
sta PARAM0
dec
dec
dec
sta $0100,x
ldy #'Q'+$80
ldx #WGFillRect
jsr WeeGUI
ldx #WGStrokeRect
jsr WeeGUI
jsr delayShort
jsr delayShort
jsr delayShort
jmp animateRectsOddLoop
animateRectsOddDone:
pla
pla
pla
pla
jmp animateRectsEven
delayShort: ; ~1/30 sec delayShort: ; ~1/30 sec
pha pha
@ -251,34 +136,27 @@ delayShortInner:
pla pla
rts rts
delay: ; ~1 sec checkKbd:
pha lda KBD
phx bpl checkKbdDone
phy sta KBDSTRB
ldy #$ce ; Loop a bunch cmp #241 ; 'q' with high bit set
delayOuter: bne checkKbdDone
ldx #$ff
delayInner:
nop
nop
nop
nop
nop
nop
nop
dex
bne delayInner
dey
bne delayOuter
ply ldx #WGExit
plx jsr WeeGUI
pla ; Pull our own frame off the stack...
pla pla
pla
pla
pla ; ...four local variables + return address...
pla
rts ; ...so we can quit to ProDOS from here
checkKbdDone:
rts rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
brunCmdLine: brunCmdLine:

Binary file not shown.

BIN
weegui_backup.dsk Normal file

Binary file not shown.