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.
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>
@ -46,7 +46,7 @@ When using assembly language, you can install WeeGUI by loading the *WEEGUI* lib
ldx #0
ldy #0
@0: lda bloadCmdLine,x
@0: lda brunCmdLine,x
beq @1
sta $0200,y
inx
@ -54,7 +54,7 @@ When using assembly language, you can install WeeGUI by loading the *WEEGUI* lib
bra @0
@1: jsr $be03
bloadCmdLine:
brunCmdLine:
.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
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:
@ -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
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.

View File

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

View File

@ -2,14 +2,13 @@
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.
- ProDOS reports NO BUFFERS AVAILABLE after three successive runs of ASMDEMO. Doing a CAT will restore normal operation.
To Do:
------
- Write sample code
- Update side effects in assembly API
- Support for frameless views
- 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
;
; 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
.macro WGCALL16 func,addr
lda #<addr
sta PARAM0
lda #>addr
sta PARAM1
ldx #func
jsr WeeGUI
.endmacro
; Sample code
main:
; BRUN the GUI library
@ -43,49 +32,19 @@ main:
@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
; Strokes and paints rectangles of many different geometries
; Show off rendering speed with some snazzy rectangle painting
;
; Stack:
; Curr X
; Curr Y
; Curr Width
; Curr Height
animateRects:
ldx #WGClearScreen
jsr WeeGUI
animateRectsEven:
animateRects:
lda #38 ; Initialize
pha
lda #11
@ -110,7 +69,7 @@ animateRectsEvenLoop:
inc
sta $0100,x
cmp #25
bcs animateRectsEvenDone
bcs animateRects
inx ; Load Width, then modify
lda $0100,x
@ -137,7 +96,7 @@ animateRectsEvenLoop:
dec
sta $0100,x
ldy #'Q'+$80
ldy #64
ldx #WGFillRect
jsr WeeGUI
ldx #WGStrokeRect
@ -146,84 +105,10 @@ animateRectsEvenLoop:
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
pha
@ -251,34 +136,27 @@ delayShortInner:
pla
rts
delay: ; ~1 sec
pha
phx
phy
checkKbd:
lda KBD
bpl checkKbdDone
sta KBDSTRB
ldy #$ce ; Loop a bunch
delayOuter:
ldx #$ff
delayInner:
nop
nop
nop
nop
nop
nop
nop
dex
bne delayInner
dey
bne delayOuter
cmp #241 ; 'q' with high bit set
bne checkKbdDone
ply
plx
ldx #WGExit
jsr WeeGUI
pla ; Pull our own frame off the stack...
pla
pla
pla
pla ; ...four local variables + return address...
pla
rts ; ...so we can quit to ProDOS from here
checkKbdDone:
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
brunCmdLine:

Binary file not shown.

BIN
weegui_backup.dsk Normal file

Binary file not shown.