Skip to content

Commit

Permalink
Prologue works. OSBYTE76 and OSBYTECA
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanizag committed Aug 11, 2021
1 parent e3d58ec commit c5dcc0e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 5 deletions.
2 changes: 1 addition & 1 deletion loadMemory.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const (
vectorBreak uint16 = 0xfffe

maxFiles = 5
errorTodo uint8 = 123 // TODO: find proper error number
errorTodo uint8 = 129 // TODO: find proper error number
)

func loadRom(env *environment, filename string) {
Expand Down
23 changes: 23 additions & 0 deletions osByte.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ func execOSBYTE(env *environment) {
*/
// We do nothing

case 0x76:
option = "Reflect keyboard status in keyboard LEDs"
/*
This call reflects the keyboard status in the state of the keyboard LEDs, and is
normally used after the status has been changed by OSBYTE &CA
*/
// We do nothing

case 0x7e:
option = "Ack detection of an ESC condition"
/*
Expand Down Expand Up @@ -146,6 +154,21 @@ func execOSBYTE(env *environment) {
*/
// TODO

case 0xca:
option = "Read/write keyboard status byte"
/*
The old value is returned in X. The contents of the next location are returned in Y.
bit 3: 1 if SHIFT is pressed.
bit 4: 0 if CAPS LOCK is engaged.
bit 5: 0 if SHIFT LOCK is engaged.
bit 6: 1 if CTRL is pressed.
bit 7: 1 SHIFT enabled, if a LOCK key is engaged then SHIFT reverses the LOCK.
We return 0 always
*/
newX = 0
newY = 0

case 0xda:
option = "R/W number of items in VDU"
/*
Expand Down
10 changes: 6 additions & 4 deletions osFind.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ func execOSFIND(env *environment) {
if y == 0 {
// Close all files
for i := 0; i < maxFiles; i++ {
err := env.file[i].Close()
if err != nil {
env.raiseError(errorTodo, err.Error())
if env.file[i] != nil {
err := env.file[i].Close()
if err != nil {
env.raiseError(errorTodo, err.Error())
}
env.file[i] = nil
}
env.file[i] = nil
}
env.log("OSFIND('Close all files')")
} else {
Expand Down

0 comments on commit c5dcc0e

Please sign in to comment.